From: Andrea Bianco Date: Fri, 1 Feb 2019 11:00:33 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.0.74 X-Git-Tag: 2.0.74 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=dbf35923e2a4df25aa48797cf136352237cfb231;p=motion2.git Built motion from commit (unavailable).|2.0.74 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 76ca04f..b9a96b9 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.0.73", "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-01-30T15:16:16.481Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); +define({ "name": "xCALLY Motion API", "version": "2.0.74", "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-02-01T10:53:18.014Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index cd8e5f9..7120377 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.0.73", "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-01-30T15:16:16.481Z", "url": "http://apidocjs.com", "version": "0.17.7" } } +{ "name": "xCALLY Motion API", "version": "2.0.74", "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-02-01T10:53:18.014Z", "url": "http://apidocjs.com", "version": "0.17.7" } } diff --git a/package.json b/package.json index 2d9579b..82ef207 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.0.73", + "version": "2.0.74", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 3c9c780..27a61fe 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 _0x05da=['motionbar','jscripty','urlForward','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','STRING','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','getDataValue','contactManager','integration'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0x05da,0x110));var _0xa05d=function(_0x4e8c98,_0xfcb6ec){_0x4e8c98=_0x4e8c98-0x0;var _0x5d63a7=_0x05da[_0x4e8c98];return _0x5d63a7;};'use strict';var Sequelize=require(_0xa05d('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x54a844){return this[_0xa05d('0x1')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xa05d('0x2'),_0xa05d('0x3'),_0xa05d('0x4'),_0xa05d('0x5'),_0xa05d('0x6'),'browser']],'msg':_0xa05d('0x7')}},'comment':_0xa05d('0x7')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xa05d('0x8')},'data2':{'type':Sequelize[_0xa05d('0x9')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0xa05d('0x9')](0x1000),'comment':_0xa05d('0xa')},'data4':{'type':Sequelize[_0xa05d('0x9')](0x1000)},'data5':{'type':Sequelize[_0xa05d('0x9')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xa05d('0xb')]}}; \ No newline at end of file +var _0x1746=['contactManager','integration','jscripty','urlForward','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x1746,0xeb));var _0x6174=function(_0x1d5bd3,_0x38e0d7){_0x1d5bd3=_0x1d5bd3-0x0;var _0x476ea4=_0x1746[_0x1d5bd3];return _0x476ea4;};'use strict';var Sequelize=require(_0x6174('0x0'));module[_0x6174('0x1')]={'name':{'type':Sequelize[_0x6174('0x2')],'get':function(_0x5bcc2e){return this[_0x6174('0x3')](_0x6174('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x6174('0x5'),_0x6174('0x6'),'motionbar',_0x6174('0x7'),_0x6174('0x8'),'browser']],'msg':_0x6174('0x9')}},'comment':_0x6174('0x9')},'data1':{'type':Sequelize[_0x6174('0xa')](0x1000),'comment':_0x6174('0xb')},'data2':{'type':Sequelize[_0x6174('0xa')](0x1000),'comment':_0x6174('0xc')},'data3':{'type':Sequelize[_0x6174('0xa')](0x1000),'comment':_0x6174('0xd')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x6174('0xa')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x6174('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e1d6e9b..d7ed6ca 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 _0x67b1=['body','Action','find','params','catch','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','name','send'];(function(_0xad15c7,_0x210cb4){var _0x520045=function(_0x43e9fd){while(--_0x43e9fd){_0xad15c7['push'](_0xad15c7['shift']());}};_0x520045(++_0x210cb4);}(_0x67b1,0xfb));var _0x167b=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0x67b1[_0x50e0b4];return _0x2fa8b0;};'use strict';var jsonpatch=require(_0x167b('0x0'));var rp=require(_0x167b('0x1'));var moment=require(_0x167b('0x2'));var BPromise=require(_0x167b('0x3'));var Mustache=require(_0x167b('0x4'));var util=require(_0x167b('0x5'));var path=require(_0x167b('0x6'));var sox=require('sox');var csv=require(_0x167b('0x7'));var ejs=require(_0x167b('0x8'));var fs=require('fs');var _=require(_0x167b('0x9'));var squel=require(_0x167b('0xa'));var crypto=require(_0x167b('0xb'));var jsforce=require(_0x167b('0xc'));var deskjs=require(_0x167b('0xd'));var toCsv=require(_0x167b('0x7'));var querystring=require(_0x167b('0xe'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x167b('0xf'))('api');var utils=require(_0x167b('0x10'));var config=require(_0x167b('0x11'));var db=require(_0x167b('0x12'))['db'];function respondWithStatusCode(_0x4b514d,_0x1601c2){_0x1601c2=_0x1601c2||0xcc;return function(_0x4a6bc1){if(_0x4a6bc1){return _0x4b514d[_0x167b('0x13')](_0x1601c2);}return _0x4b514d[_0x167b('0x14')](_0x1601c2)['end']();};}function respondWithResult(_0x15da01,_0x2d4625){_0x2d4625=_0x2d4625||0xc8;return function(_0x1e4b78){if(_0x1e4b78){return _0x15da01['status'](_0x2d4625)['json'](_0x1e4b78);}};}function respondWithFilteredResult(_0x28f2d7,_0x53784a){return function(_0x214e9d){if(_0x214e9d){var _0x549c30=_0x214e9d[_0x167b('0x15')],_0x17756d=_0x53784a[_0x167b('0x16')],_0x1c8f8b=_0x53784a[_0x167b('0x16')]+_0x53784a[_0x167b('0x17')],_0x18035c;if(_0x1c8f8b>=_0x549c30){_0x1c8f8b=_0x549c30;_0x18035c=0xc8;}else{_0x18035c=0xce;}_0x28f2d7[_0x167b('0x14')](_0x18035c);return _0x28f2d7[_0x167b('0x18')](_0x167b('0x19'),_0x17756d+'-'+_0x1c8f8b+'/'+_0x549c30)[_0x167b('0x1a')](_0x214e9d);}return null;};}function patchUpdates(_0xbfe5f){return function(_0x223d40){try{jsonpatch[_0x167b('0x1b')](_0x223d40,_0xbfe5f,!![]);}catch(_0x2c8448){return BPromise['reject'](_0x2c8448);}return _0x223d40[_0x167b('0x1c')]();};}function saveUpdates(_0x1bc38a,_0x5182fc){return function(_0x519297){if(_0x519297){return _0x519297[_0x167b('0x1d')](_0x1bc38a)[_0x167b('0x1e')](function(_0x37cd42){return _0x37cd42;});}return null;};}function removeEntity(_0x3bf37d,_0x3f9d57){return function(_0x3ea40f){if(_0x3ea40f){return _0x3ea40f[_0x167b('0x1f')]()[_0x167b('0x1e')](function(){_0x3bf37d[_0x167b('0x14')](0xcc)[_0x167b('0x20')]();});}};}function handleEntityNotFound(_0xddca1,_0x130336){return function(_0x2a35cb){if(!_0x2a35cb){_0xddca1['sendStatus'](0x194);}return _0x2a35cb;};}function handleError(_0x25587b,_0x17cfa4){_0x17cfa4=_0x17cfa4||0x1f4;return function(_0x221ec1){logger[_0x167b('0x21')](_0x221ec1['stack']);if(_0x221ec1[_0x167b('0x22')]){delete _0x221ec1[_0x167b('0x22')];}_0x25587b['status'](_0x17cfa4)[_0x167b('0x23')](_0x221ec1);};}exports[_0x167b('0x1d')]=function(_0x57920c,_0x3ad11b){if(_0x57920c[_0x167b('0x24')]['id']){delete _0x57920c[_0x167b('0x24')]['id'];}return db[_0x167b('0x25')][_0x167b('0x26')]({'where':{'id':_0x57920c[_0x167b('0x27')]['id']}})[_0x167b('0x1e')](handleEntityNotFound(_0x3ad11b,null))['then'](saveUpdates(_0x57920c['body'],null))[_0x167b('0x1e')](respondWithResult(_0x3ad11b,null))[_0x167b('0x28')](handleError(_0x3ad11b,null));};exports[_0x167b('0x1f')]=function(_0x2658e6,_0x2b690e){return db[_0x167b('0x25')][_0x167b('0x26')]({'where':{'id':_0x2658e6['params']['id']}})['then'](handleEntityNotFound(_0x2b690e,null))[_0x167b('0x1e')](removeEntity(_0x2b690e,null))[_0x167b('0x28')](handleError(_0x2b690e,null));}; \ No newline at end of file +var _0xf8c1=['to-csv','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','find','params','Action','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x773d77,_0x4815fd){var _0x47afc7=function(_0xa0aa17){while(--_0xa0aa17){_0x773d77['push'](_0x773d77['shift']());}};_0x47afc7(++_0x4815fd);}(_0xf8c1,0x17b));var _0x1f8c=function(_0x9193a3,_0x3188b6){_0x9193a3=_0x9193a3-0x0;var _0x5dad5d=_0xf8c1[_0x9193a3];return _0x5dad5d;};'use strict';var jsonpatch=require(_0x1f8c('0x0'));var rp=require('request-promise');var moment=require(_0x1f8c('0x1'));var BPromise=require(_0x1f8c('0x2'));var Mustache=require(_0x1f8c('0x3'));var util=require('util');var path=require(_0x1f8c('0x4'));var sox=require(_0x1f8c('0x5'));var csv=require(_0x1f8c('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1f8c('0x7'));var crypto=require('crypto');var jsforce=require(_0x1f8c('0x8'));var deskjs=require(_0x1f8c('0x9'));var toCsv=require(_0x1f8c('0x6'));var querystring=require(_0x1f8c('0xa'));var Papa=require(_0x1f8c('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x1f8c('0xc'))('api');var utils=require('../../config/utils');var config=require(_0x1f8c('0xd'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20c464,_0x117bbe){_0x117bbe=_0x117bbe||0xcc;return function(_0x513b47){if(_0x513b47){return _0x20c464[_0x1f8c('0xe')](_0x117bbe);}return _0x20c464[_0x1f8c('0xf')](_0x117bbe)[_0x1f8c('0x10')]();};}function respondWithResult(_0x527924,_0x151f49){_0x151f49=_0x151f49||0xc8;return function(_0x38c41e){if(_0x38c41e){return _0x527924[_0x1f8c('0xf')](_0x151f49)[_0x1f8c('0x11')](_0x38c41e);}};}function respondWithFilteredResult(_0x428f93,_0xae4e79){return function(_0x5341c6){if(_0x5341c6){var _0x13f6d2=_0x5341c6[_0x1f8c('0x12')],_0xd85888=_0xae4e79[_0x1f8c('0x13')],_0x260448=_0xae4e79['offset']+_0xae4e79['limit'],_0xecbb54;if(_0x260448>=_0x13f6d2){_0x260448=_0x13f6d2;_0xecbb54=0xc8;}else{_0xecbb54=0xce;}_0x428f93[_0x1f8c('0xf')](_0xecbb54);return _0x428f93[_0x1f8c('0x14')](_0x1f8c('0x15'),_0xd85888+'-'+_0x260448+'/'+_0x13f6d2)[_0x1f8c('0x11')](_0x5341c6);}return null;};}function patchUpdates(_0x56d677){return function(_0x534e74){try{jsonpatch['apply'](_0x534e74,_0x56d677,!![]);}catch(_0x526144){return BPromise[_0x1f8c('0x16')](_0x526144);}return _0x534e74[_0x1f8c('0x17')]();};}function saveUpdates(_0x309d0b,_0xe545de){return function(_0x1885a0){if(_0x1885a0){return _0x1885a0[_0x1f8c('0x18')](_0x309d0b)[_0x1f8c('0x19')](function(_0x5bfad3){return _0x5bfad3;});}return null;};}function removeEntity(_0x520d0c,_0x3e1764){return function(_0x2b6a8c){if(_0x2b6a8c){return _0x2b6a8c[_0x1f8c('0x1a')]()[_0x1f8c('0x19')](function(){_0x520d0c[_0x1f8c('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3257b9,_0x5bd846){return function(_0x34ee4b){if(!_0x34ee4b){_0x3257b9[_0x1f8c('0xe')](0x194);}return _0x34ee4b;};}function handleError(_0x429cf3,_0x3ec826){_0x3ec826=_0x3ec826||0x1f4;return function(_0x1dab55){logger[_0x1f8c('0x1b')](_0x1dab55[_0x1f8c('0x1c')]);if(_0x1dab55[_0x1f8c('0x1d')]){delete _0x1dab55[_0x1f8c('0x1d')];}_0x429cf3[_0x1f8c('0xf')](_0x3ec826)[_0x1f8c('0x1e')](_0x1dab55);};}exports['update']=function(_0x17fed3,_0x4b6aed){if(_0x17fed3[_0x1f8c('0x1f')]['id']){delete _0x17fed3['body']['id'];}return db['Action'][_0x1f8c('0x20')]({'where':{'id':_0x17fed3[_0x1f8c('0x21')]['id']}})[_0x1f8c('0x19')](handleEntityNotFound(_0x4b6aed,null))['then'](saveUpdates(_0x17fed3[_0x1f8c('0x1f')],null))[_0x1f8c('0x19')](respondWithResult(_0x4b6aed,null))['catch'](handleError(_0x4b6aed,null));};exports[_0x1f8c('0x1a')]=function(_0x1a616a,_0xfbd851){return db[_0x1f8c('0x22')][_0x1f8c('0x20')]({'where':{'id':_0x1a616a[_0x1f8c('0x21')]['id']}})[_0x1f8c('0x19')](handleEntityNotFound(_0xfbd851,null))['then'](removeEntity(_0xfbd851,null))['catch'](handleError(_0xfbd851,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 4505b6c..97dc835 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 _0x7558=['Action','tools_actions','api','request-promise','./action.attributes','define'];(function(_0x26394d,_0x547eea){var _0x5c7861=function(_0x252805){while(--_0x252805){_0x26394d['push'](_0x26394d['shift']());}};_0x5c7861(++_0x547eea);}(_0x7558,0x122));var _0x8755=function(_0x316897,_0x1bf4ed){_0x316897=_0x316897-0x0;var _0x1b7af9=_0x7558[_0x316897];return _0x1b7af9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8755('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8755('0x1'));var attributes=require(_0x8755('0x2'));module['exports']=function(_0x54b70c,_0x16e3e5){return _0x54b70c[_0x8755('0x3')](_0x8755('0x4'),attributes,{'tableName':_0x8755('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9076=['define','Action','lodash','util','../../config/logger','moment','bluebird','request-promise','./action.attributes','exports'];(function(_0x5a550c,_0x4b1bc0){var _0x5f2417=function(_0x4c8528){while(--_0x4c8528){_0x5a550c['push'](_0x5a550c['shift']());}};_0x5f2417(++_0x4b1bc0);}(_0x9076,0xe8));var _0x6907=function(_0x151f56,_0x31b5b9){_0x151f56=_0x151f56-0x0;var _0x18c689=_0x9076[_0x151f56];return _0x18c689;};'use strict';var _=require(_0x6907('0x0'));var util=require(_0x6907('0x1'));var logger=require(_0x6907('0x2'))('api');var moment=require(_0x6907('0x3'));var BPromise=require(_0x6907('0x4'));var rp=require(_0x6907('0x5'));var attributes=require(_0x6907('0x6'));module[_0x6907('0x7')]=function(_0x4e82c7,_0x5812b8){return _0x4e82c7[_0x6907('0x8')](_0x6907('0x9'),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 ba8237e..97aac38 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 _0xf12b=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf12b,0xb6));var _0xbf12=function(_0x1d1acc,_0x2ea3c7){_0x1d1acc=_0x1d1acc-0x0;var _0x2d3504=_0xf12b[_0x1d1acc];return _0x2d3504;};'use strict';var _=require('lodash');var util=require(_0xbf12('0x0'));var moment=require(_0xbf12('0x1'));var BPromise=require(_0xbf12('0x2'));var rs=require(_0xbf12('0x3'));var fs=require('fs');var db=require(_0xbf12('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf12('0x5'))(_0xbf12('0x6'));var config=require(_0xbf12('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbf12('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3c10,_0x2915fe,_0x3b43f9){return new BPromise(function(_0xd90b78,_0x4f6339){return client[_0xbf12('0x9')](_0x3e3c10,_0x3b43f9)[_0xbf12('0xa')](function(_0x4ec9a2){logger[_0xbf12('0xb')]('Action,\x20%s,\x20%s',_0x2915fe,'request\x20sent');logger['debug'](_0xbf12('0xc'),_0x2915fe,_0xbf12('0xd'),JSON[_0xbf12('0xe')](_0x4ec9a2));if(_0x4ec9a2[_0xbf12('0xf')]){if(_0x4ec9a2[_0xbf12('0xf')][_0xbf12('0x10')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x2915fe,_0x4ec9a2[_0xbf12('0xf')][_0xbf12('0x11')]);return _0x4f6339(_0x4ec9a2['error'][_0xbf12('0x11')]);}logger[_0xbf12('0xf')]('Action,\x20%s,\x20%s',_0x2915fe,_0x4ec9a2['error'][_0xbf12('0x11')]);return _0xd90b78(_0x4ec9a2[_0xbf12('0xf')][_0xbf12('0x11')]);}else{logger[_0xbf12('0xb')]('Action,\x20%s,\x20%s',_0x2915fe,_0xbf12('0xd'));_0xd90b78(_0x4ec9a2[_0xbf12('0x12')][_0xbf12('0x11')]);}})[_0xbf12('0x13')](function(_0x290697){logger[_0xbf12('0xf')]('Action,\x20%s,\x20%s',_0x2915fe,_0x290697);_0x4f6339(_0x290697);});});} \ No newline at end of file +var _0x842d=['../../config/environment','jayson/promise','client','http','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x50087f,_0x529c91){var _0x2f8b62=function(_0x13d7f7){while(--_0x13d7f7){_0x50087f['push'](_0x50087f['shift']());}};_0x2f8b62(++_0x529c91);}(_0x842d,0x1ee));var _0xd842=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0x842d[_0x32cf96];return _0x125cc1;};'use strict';var _=require(_0xd842('0x0'));var util=require('util');var moment=require(_0xd842('0x1'));var BPromise=require(_0xd842('0x2'));var rs=require(_0xd842('0x3'));var fs=require('fs');var db=require(_0xd842('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd842('0x5'));var config=require(_0xd842('0x6'));var jayson=require(_0xd842('0x7'));var client=jayson[_0xd842('0x8')][_0xd842('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11dab9,_0x8a7818,_0x1ba775){return new BPromise(function(_0xc709ab,_0x3b9add){return client['request'](_0x11dab9,_0x1ba775)['then'](function(_0x3e495c){logger['info'](_0xd842('0xa'),_0x8a7818,'request\x20sent');logger[_0xd842('0xb')](_0xd842('0xc'),_0x8a7818,_0xd842('0xd'),JSON[_0xd842('0xe')](_0x3e495c));if(_0x3e495c[_0xd842('0xf')]){if(_0x3e495c[_0xd842('0xf')][_0xd842('0x10')]===0x1f4){logger['error'](_0xd842('0xa'),_0x8a7818,_0x3e495c['error'][_0xd842('0x11')]);return _0x3b9add(_0x3e495c[_0xd842('0xf')]['message']);}logger[_0xd842('0xf')](_0xd842('0xa'),_0x8a7818,_0x3e495c[_0xd842('0xf')]['message']);return _0xc709ab(_0x3e495c[_0xd842('0xf')][_0xd842('0x11')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x8a7818,_0xd842('0xd'));_0xc709ab(_0x3e495c[_0xd842('0x12')]['message']);}})[_0xd842('0x13')](function(_0x4c50fe){logger[_0xd842('0xf')](_0xd842('0xa'),_0x8a7818,_0x4c50fe);_0x3b9add(_0x4c50fe);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 963c6cb..6a030a3 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 _0x9e08=['isAuthenticated','exports','multer','Router','../../config/environment','./action.controller','/:id','update'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x9e08,0x1ea));var _0x89e0=function(_0x17ad60,_0x2a3d29){_0x17ad60=_0x17ad60-0x0;var _0x519eba=_0x9e08[_0x17ad60];return _0x519eba;};'use strict';var multer=require(_0x89e0('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0x89e0('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x89e0('0x2'));var controller=require(_0x89e0('0x3'));router['put'](_0x89e0('0x4'),auth['isAuthenticated'](),controller[_0x89e0('0x5')]);router['delete'](_0x89e0('0x4'),auth[_0x89e0('0x6')](),controller['destroy']);module[_0x89e0('0x7')]=router; \ No newline at end of file +var _0xbc18=['util','path','express','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','destroy','exports'];(function(_0x279d16,_0x1d3f45){var _0x24f8eb=function(_0x12711f){while(--_0x12711f){_0x279d16['push'](_0x279d16['shift']());}};_0x24f8eb(++_0x1d3f45);}(_0xbc18,0xd1));var _0x8bc1=function(_0x4c7149,_0x335342){_0x4c7149=_0x4c7149-0x0;var _0x200122=_0xbc18[_0x4c7149];return _0x200122;};'use strict';var multer=require('multer');var util=require(_0x8bc1('0x0'));var path=require(_0x8bc1('0x1'));var express=require(_0x8bc1('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8bc1('0x3'));var config=require(_0x8bc1('0x4'));var controller=require(_0x8bc1('0x5'));router[_0x8bc1('0x6')](_0x8bc1('0x7'),auth[_0x8bc1('0x8')](),controller['update']);router['delete'](_0x8bc1('0x7'),auth[_0x8bc1('0x8')](),controller[_0x8bc1('0x9')]);module[_0x8bc1('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 230a05c..94b877c 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 _0xe362=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe362,0xfd));var _0x2e36=function(_0x7beb92,_0x359ed8){_0x7beb92=_0x7beb92-0x0;var _0x2e07dc=_0xe362[_0x7beb92];return _0x2e07dc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2e36('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x2e36('0x0')]},'parent':{'type':Sequelize[_0x2e36('0x0')]},'table':{'type':Sequelize[_0x2e36('0x0')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x2e36('0x1')]}}; \ No newline at end of file +var _0x0179=['sequelize','exports','STRING','TEXT'];(function(_0x1b1939,_0x3d1bbd){var _0x5a6bf1=function(_0x342134){while(--_0x342134){_0x1b1939['push'](_0x1b1939['shift']());}};_0x5a6bf1(++_0x3d1bbd);}(_0x0179,0x140));var _0x9017=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x0179[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0x9017('0x0'));module[_0x9017('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9017('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9017('0x3')]},'joins':{'type':Sequelize[_0x9017('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 88556f6..8304627 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 _0xa2eb=['parse','group','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','operator','getFields','AnalyticMetric','from','metric','SELECT','No\x20Data!','output','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','create','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','../../config/logger','api','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','options','includeAll','include','rows','catch','show','params','fields','length','find','body','update','destroy','preview','join','left_join','right_join','outer_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','field','condition','value','Sequelize','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','findAll','keyBy','select','table','MetricId','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','type','%s.%s\x20=\x20%s.%s','conditions'];(function(_0x300860,_0x509371){var _0x2094ad=function(_0x2090a2){while(--_0x2090a2){_0x300860['push'](_0x300860['shift']());}};_0x2094ad(++_0x509371);}(_0xa2eb,0xbc));var _0xba2e=function(_0x538b31,_0x80e294){_0x538b31=_0x538b31-0x0;var _0x4348f0=_0xa2eb[_0x538b31];return _0x4348f0;};'use strict';var jsonpatch=require(_0xba2e('0x0'));var rp=require(_0xba2e('0x1'));var moment=require('moment');var BPromise=require(_0xba2e('0x2'));var Mustache=require('mustache');var util=require(_0xba2e('0x3'));var path=require(_0xba2e('0x4'));var sox=require(_0xba2e('0x5'));var csv=require(_0xba2e('0x6'));var ejs=require(_0xba2e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xba2e('0x8'));var deskjs=require(_0xba2e('0x9'));var toCsv=require(_0xba2e('0x6'));var querystring=require(_0xba2e('0xa'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xba2e('0xb'))(_0xba2e('0xc'));var utils=require('../../config/utils');var config=require(_0xba2e('0xd'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530ea0,_0x193474){_0x193474=_0x193474||0xcc;return function(_0x2aaaf9){if(_0x2aaaf9){return _0x530ea0['sendStatus'](_0x193474);}return _0x530ea0[_0xba2e('0xe')](_0x193474)['end']();};}function respondWithResult(_0x17905c,_0x4aa8b9){_0x4aa8b9=_0x4aa8b9||0xc8;return function(_0x16efc5){if(_0x16efc5){return _0x17905c[_0xba2e('0xe')](_0x4aa8b9)[_0xba2e('0xf')](_0x16efc5);}};}function respondWithFilteredResult(_0x5b2ed5,_0x15dc82){return function(_0x25bfd0){if(_0x25bfd0){var _0x308420=_0x25bfd0[_0xba2e('0x10')],_0x283465=_0x15dc82[_0xba2e('0x11')],_0x3f19dd=_0x15dc82['offset']+_0x15dc82[_0xba2e('0x12')],_0x209a96;if(_0x3f19dd>=_0x308420){_0x3f19dd=_0x308420;_0x209a96=0xc8;}else{_0x209a96=0xce;}_0x5b2ed5[_0xba2e('0xe')](_0x209a96);return _0x5b2ed5[_0xba2e('0x13')](_0xba2e('0x14'),_0x283465+'-'+_0x3f19dd+'/'+_0x308420)[_0xba2e('0xf')](_0x25bfd0);}return null;};}function patchUpdates(_0x3cfb8f){return function(_0x2e7c77){try{jsonpatch[_0xba2e('0x15')](_0x2e7c77,_0x3cfb8f,!![]);}catch(_0x165d9b){return BPromise[_0xba2e('0x16')](_0x165d9b);}return _0x2e7c77[_0xba2e('0x17')]();};}function saveUpdates(_0x5829ad,_0x111f02){return function(_0x4d1271){if(_0x4d1271){return _0x4d1271['update'](_0x5829ad)['then'](function(_0x58c634){return _0x58c634;});}return null;};}function removeEntity(_0xf92c6d,_0x5adfe9){return function(_0x4df86c){if(_0x4df86c){return _0x4df86c['destroy']()[_0xba2e('0x18')](function(){_0xf92c6d['status'](0xcc)[_0xba2e('0x19')]();});}};}function handleEntityNotFound(_0x32824d,_0x4f6ce4){return function(_0x593410){if(!_0x593410){_0x32824d[_0xba2e('0x1a')](0x194);}return _0x593410;};}function handleError(_0x37a8a0,_0x3135a0){_0x3135a0=_0x3135a0||0x1f4;return function(_0x5289e9){logger[_0xba2e('0x1b')](_0x5289e9[_0xba2e('0x1c')]);if(_0x5289e9[_0xba2e('0x1d')]){delete _0x5289e9['name'];}_0x37a8a0[_0xba2e('0xe')](_0x3135a0)[_0xba2e('0x1e')](_0x5289e9);};}exports[_0xba2e('0x1f')]=function(_0x5c1136,_0x3bc72e){var _0x30cb7b={},_0x225f15={},_0x1e4fe4={'count':0x0,'rows':[]};var _0x122b34=db[_0xba2e('0x20')][_0xba2e('0x21')];_0x225f15[_0xba2e('0x22')]=_[_0xba2e('0x23')](_0x122b34);var _0xef2c47={'dateStart':_0x5c1136[_0xba2e('0x24')][_0xba2e('0x25')],'dateEnd':_0x5c1136[_0xba2e('0x24')]['dateEnd']};delete _0x5c1136[_0xba2e('0x24')][_0xba2e('0x25')];delete _0x5c1136[_0xba2e('0x24')][_0xba2e('0x26')];_0x225f15[_0xba2e('0x24')]=_[_0xba2e('0x23')](_0x5c1136[_0xba2e('0x24')]);_0x225f15[_0xba2e('0x27')]=_[_0xba2e('0x28')](_0x225f15['model'],_0x225f15['query']);_0x30cb7b[_0xba2e('0x29')]=_[_0xba2e('0x28')](_0x225f15[_0xba2e('0x22')],qs['fields'](_0x5c1136[_0xba2e('0x24')]['fields']));_0x30cb7b[_0xba2e('0x29')]=_0x30cb7b[_0xba2e('0x29')]['length']?_0x30cb7b[_0xba2e('0x29')]:_0x225f15[_0xba2e('0x22')];if(!_0x5c1136[_0xba2e('0x24')][_0xba2e('0x2a')](_0xba2e('0x2b'))){_0x30cb7b['limit']=qs[_0xba2e('0x12')](_0x5c1136[_0xba2e('0x24')][_0xba2e('0x12')]);_0x30cb7b[_0xba2e('0x11')]=qs[_0xba2e('0x11')](_0x5c1136[_0xba2e('0x24')][_0xba2e('0x11')]);}_0x30cb7b[_0xba2e('0x2c')]=qs[_0xba2e('0x2d')](_0x5c1136[_0xba2e('0x24')][_0xba2e('0x2d')]);_0x30cb7b['where']=qs[_0xba2e('0x27')](_['pick'](_0x5c1136['query'],_0x225f15[_0xba2e('0x27')]));if(_0xef2c47[_0xba2e('0x25')]){if(_0xef2c47[_0xba2e('0x26')]){_0xef2c47['dateEnd']=moment(_0xef2c47[_0xba2e('0x26')])[_0xba2e('0x2e')](0x1,_0xba2e('0x2f'));}else{_0xef2c47[_0xba2e('0x26')]=moment(_0xef2c47[_0xba2e('0x25')])['add'](0x1,_0xba2e('0x2f'));}_[_0xba2e('0x30')](_0x30cb7b[_0xba2e('0x31')],{'createdAt':{'$gte':_0xef2c47[_0xba2e('0x25')],'$lte':_0xef2c47[_0xba2e('0x26')]}});}if(_0x5c1136[_0xba2e('0x24')][_0xba2e('0x32')]){_0x30cb7b[_0xba2e('0x31')]=_[_0xba2e('0x30')](_0x30cb7b[_0xba2e('0x31')],{'$or':_[_0xba2e('0x33')](_0x30cb7b[_0xba2e('0x29')],function(_0x192278){var _0x4723cc={};_0x4723cc[_0x192278]={'$like':'%'+_0x5c1136[_0xba2e('0x24')]['filter']+'%'};return _0x4723cc;})});}_0x30cb7b=_[_0xba2e('0x30')]({},_0x30cb7b,_0x5c1136[_0xba2e('0x34')]);var _0x4b1aa1={'where':_0x30cb7b['where']};return db['AnalyticCustomReport'][_0xba2e('0x10')](_0x4b1aa1)[_0xba2e('0x18')](function(_0x5d25a1){_0x1e4fe4[_0xba2e('0x10')]=_0x5d25a1;if(_0x5c1136['query'][_0xba2e('0x35')]){_0x30cb7b[_0xba2e('0x36')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x30cb7b);})['then'](function(_0x4ef994){_0x1e4fe4[_0xba2e('0x37')]=_0x4ef994;return _0x1e4fe4;})['then'](respondWithFilteredResult(_0x3bc72e,_0x30cb7b))[_0xba2e('0x38')](handleError(_0x3bc72e,null));};exports[_0xba2e('0x39')]=function(_0x1f6239,_0x596c44){var _0x4877e8={'raw':![],'where':{'id':_0x1f6239[_0xba2e('0x3a')]['id']}},_0x3c3d30={};_0x3c3d30['model']=_[_0xba2e('0x23')](db[_0xba2e('0x20')][_0xba2e('0x21')]);_0x3c3d30[_0xba2e('0x24')]=_[_0xba2e('0x23')](_0x1f6239[_0xba2e('0x24')]);_0x3c3d30['filters']=_['intersection'](_0x3c3d30[_0xba2e('0x22')],_0x3c3d30[_0xba2e('0x24')]);_0x4877e8[_0xba2e('0x29')]=_[_0xba2e('0x28')](_0x3c3d30[_0xba2e('0x22')],qs[_0xba2e('0x3b')](_0x1f6239[_0xba2e('0x24')][_0xba2e('0x3b')]));_0x4877e8['attributes']=_0x4877e8['attributes'][_0xba2e('0x3c')]?_0x4877e8[_0xba2e('0x29')]:_0x3c3d30[_0xba2e('0x22')];if(_0x1f6239['query']['includeAll']){_0x4877e8[_0xba2e('0x36')]=[{'all':!![]}];}_0x4877e8=_[_0xba2e('0x30')]({},_0x4877e8,_0x1f6239['options']);return db[_0xba2e('0x20')][_0xba2e('0x3d')](_0x4877e8)[_0xba2e('0x18')](handleEntityNotFound(_0x596c44,null))[_0xba2e('0x18')](respondWithResult(_0x596c44,null))[_0xba2e('0x38')](handleError(_0x596c44,null));};exports['create']=function(_0x56d469,_0x3c108f){return db[_0xba2e('0x20')]['create'](_0x56d469[_0xba2e('0x3e')],{})[_0xba2e('0x18')](respondWithResult(_0x3c108f,0xc9))[_0xba2e('0x38')](handleError(_0x3c108f,null));};exports[_0xba2e('0x3f')]=function(_0x34d171,_0x40f44e){if(_0x34d171[_0xba2e('0x3e')]['id']){delete _0x34d171[_0xba2e('0x3e')]['id'];}return db[_0xba2e('0x20')]['find']({'where':{'id':_0x34d171[_0xba2e('0x3a')]['id']}})[_0xba2e('0x18')](handleEntityNotFound(_0x40f44e,null))[_0xba2e('0x18')](saveUpdates(_0x34d171[_0xba2e('0x3e')],null))[_0xba2e('0x18')](respondWithResult(_0x40f44e,null))[_0xba2e('0x38')](handleError(_0x40f44e,null));};exports[_0xba2e('0x40')]=function(_0x5ec3b7,_0x31af1e){return db[_0xba2e('0x20')][_0xba2e('0x3d')]({'where':{'id':_0x5ec3b7[_0xba2e('0x3a')]['id']}})[_0xba2e('0x18')](handleEntityNotFound(_0x31af1e,null))[_0xba2e('0x18')](removeEntity(_0x31af1e,null))[_0xba2e('0x38')](handleError(_0x31af1e,null));};exports[_0xba2e('0x41')]=function(_0x408bd6,_0xa01d4d){var _0x21db70=0xa;var _0x5b1c64=[_0xba2e('0x42'),_0xba2e('0x43'),_0xba2e('0x44'),_0xba2e('0x45'),_0xba2e('0x46')];var _0x4ab118={'SUM':_0xba2e('0x47'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xba2e('0x48'),'MAX':_0xba2e('0x49'),'MIN':_0xba2e('0x4a'),'AVG':_0xba2e('0x4b'),'GROUP_CONCAT':_0xba2e('0x4c'),'GROUP_CONCAT ASC':_0xba2e('0x4d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5b42a8={'SEC_TO_TIME':_0xba2e('0x4e'),'DATE':_0xba2e('0x4f'),'HOUR':_0xba2e('0x50'),'ROUND':_0xba2e('0x51'),'UNIX_TIMESTAMP':_0xba2e('0x52')};var _0x3deb88=function(_0x1e90ff){return!_[_0xba2e('0x53')]([_0xba2e('0x54'),_0xba2e('0x55'),_0xba2e('0x56'),'IS\x20NOT\x20EMPTY'],_0x1e90ff);};var _0x43873e=function(_0x3aa66c){if(!_0x3aa66c||!_0x3aa66c['rules'][_0xba2e('0x3c')]){return'';}for(var _0x382c59='(',_0x27c810=0x0;_0x27c810<_0x3aa66c[_0xba2e('0x57')][_0xba2e('0x3c')];_0x27c810+=0x1){_0x27c810>0x0&&(_0x382c59+='\x20'+_0x3aa66c['operator']+'\x20');_0x382c59+=_0x3aa66c[_0xba2e('0x57')][_0x27c810]['group']?_0x43873e(_0x3aa66c[_0xba2e('0x57')][_0x27c810]['group']):_0x3aa66c[_0xba2e('0x57')][_0x27c810][_0xba2e('0x58')]+'\x20'+_0x3aa66c[_0xba2e('0x57')][_0x27c810][_0xba2e('0x59')]+(_0x3deb88(_0x3aa66c[_0xba2e('0x57')][_0x27c810][_0xba2e('0x59')])?'\x20'+_0x3aa66c['rules'][_0x27c810][_0xba2e('0x5a')]:'');}return _0x382c59+')';};var _0x578d2a={'where':{'id':_0x408bd6[_0xba2e('0x3a')]['id']}},_0x48bf4b,_0x13e0c7,_0x26f681,_0x4c8d11,_0x3d2a72;_0x578d2a=_[_0xba2e('0x30')]({},_0x578d2a,_0x408bd6[_0xba2e('0x34')]);return db['AnalyticCustomReport'][_0xba2e('0x3d')](_0x578d2a)['then'](function(_0x3ef0d1){if(_0x3ef0d1){_0x48bf4b=_0x3ef0d1;return _0x3ef0d1['getFields']();}return null;})['then'](function(_0x260dc9){if(_0x260dc9){if(!_0x260dc9[_0xba2e('0x3c')]){throw new db[(_0xba2e('0x5b'))][(_0xba2e('0x5c'))](_0xba2e('0x5d'));}_0x13e0c7=_0x260dc9;return db['AnalyticMetric'][_0xba2e('0x5e')]({'raw':!![]});}return null;})[_0xba2e('0x18')](function(_0x4166ba){if(_0x4166ba){_0x26f681=_[_0xba2e('0x5f')](_0x4166ba,'id');var _0x399bc9;var _0x300164=squel[_0xba2e('0x60')]();_0x300164['from'](_0x48bf4b[_0xba2e('0x61')]);for(var _0x3aea8e=0x0;_0x3aea8e<_0x13e0c7[_0xba2e('0x3c')];_0x3aea8e+=0x1){_0x399bc9=_0x13e0c7[_0x3aea8e][_0xba2e('0x62')]?_0x26f681[_0x13e0c7[_0x3aea8e][_0xba2e('0x62')]]['metric']:_0x13e0c7[_0x3aea8e][_0xba2e('0x58')];_0x399bc9=_0x13e0c7[_0x3aea8e][_0xba2e('0x63')]?_[_0xba2e('0x64')](_0x4ab118[_0x13e0c7[_0x3aea8e][_0xba2e('0x63')]],'%s',_0x399bc9):_0x399bc9;_0x399bc9=_0x13e0c7[_0x3aea8e][_0xba2e('0x65')]?_[_0xba2e('0x64')](_0x5b42a8[_0x13e0c7[_0x3aea8e][_0xba2e('0x65')]],'%s',_0x399bc9):_0x399bc9;if(_0x13e0c7[_0x3aea8e]['groupBy']){_0x300164['group'](_0x399bc9);}_0x13e0c7[_0x3aea8e][_0xba2e('0x66')]&&_0x300164[_0xba2e('0x2c')](_0x399bc9,_0x13e0c7[_0x3aea8e][_0xba2e('0x66')]===_0xba2e('0x67')?![]:!![]);_0x300164['field'](_0x399bc9,_0x13e0c7[_0x3aea8e][_0xba2e('0x68')]||_0x399bc9);}if(_0x48bf4b[_0xba2e('0x69')]){_0x48bf4b[_0xba2e('0x69')]=JSON['parse'](_0x48bf4b[_0xba2e('0x69')]);for(var _0x2f844c=0x0;_0x2f844c<_0x48bf4b[_0xba2e('0x69')]['length'];_0x2f844c+=0x1){if(_0x48bf4b[_0xba2e('0x69')][_0x2f844c]['type']&&_[_0xba2e('0x53')](_0x5b1c64,_0x48bf4b['joins'][_0x2f844c]['type'])&&_0x48bf4b['joins'][_0x2f844c][_0xba2e('0x6a')]&&_0x48bf4b['joins'][_0x2f844c][_0xba2e('0x6b')]&&_0x48bf4b[_0xba2e('0x69')][_0x2f844c][_0xba2e('0x6c')]){_0x300164[_0x48bf4b['joins'][_0x2f844c][_0xba2e('0x6d')]](_0x48bf4b['joins'][_0x2f844c][_0xba2e('0x6b')],null,util[_0xba2e('0x65')](_0xba2e('0x6e'),_0x48bf4b[_0xba2e('0x61')],_0x48bf4b[_0xba2e('0x69')][_0x2f844c][_0xba2e('0x6a')],_0x48bf4b[_0xba2e('0x69')][_0x2f844c][_0xba2e('0x6b')],_0x48bf4b[_0xba2e('0x69')][_0x2f844c][_0xba2e('0x6c')]));}}}if(_0x48bf4b[_0xba2e('0x6f')]){_0x48bf4b[_0xba2e('0x6f')]=JSON[_0xba2e('0x70')](_0x48bf4b[_0xba2e('0x6f')]);_0x300164[_0xba2e('0x31')](_0x43873e(_0x48bf4b[_0xba2e('0x6f')][_0xba2e('0x71')]));}_0x3d2a72=_0x300164[_0xba2e('0x72')]();_0x300164[_0xba2e('0x12')](_0x21db70);_0x300164[_0xba2e('0x11')](0x0);logger[_0xba2e('0x73')](_0xba2e('0x74'),_0x300164[_0xba2e('0x75')]());return db[_0xba2e('0x76')][_0xba2e('0x24')](_0x300164[_0xba2e('0x75')](),{'type':db[_0xba2e('0x76')][_0xba2e('0x77')]['SELECT']});}})['then'](respondWithResult(_0xa01d4d,null))[_0xba2e('0x38')](handleError(_0xa01d4d,null));};function runReport(_0x211ad3,_0x379de4,_0x57fa1c){var _0x26690a=_0x379de4[_0xba2e('0x1d')];var _0x1a9ed3=0xa;var _0x523fb6=[_0xba2e('0x42'),_0xba2e('0x43'),_0xba2e('0x44'),_0xba2e('0x45'),_0xba2e('0x46')];var _0x42e173={'SUM':_0xba2e('0x47'),'COUNT':_0xba2e('0x78'),'COUNT DISTINCT':_0xba2e('0x48'),'MAX':_0xba2e('0x49'),'MIN':_0xba2e('0x4a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xba2e('0x4d'),'GROUP_CONCAT DESC':_0xba2e('0x79')};var _0x78b5b5={'SEC_TO_TIME':_0xba2e('0x4e'),'DATE':_0xba2e('0x4f'),'HOUR':_0xba2e('0x50'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xba2e('0x52')};var _0x4592ea=function(_0x5b5a46){return!_[_0xba2e('0x53')]([_0xba2e('0x54'),_0xba2e('0x55'),_0xba2e('0x56'),_0xba2e('0x7a')],_0x5b5a46);};var _0x51ff83=function(_0xdeafa9){if(!_0xdeafa9||!_0xdeafa9['rules'][_0xba2e('0x3c')]){return'';}for(var _0x266dec='(',_0x390b54=0x0;_0x390b54<_0xdeafa9[_0xba2e('0x57')][_0xba2e('0x3c')];_0x390b54+=0x1){_0x390b54>0x0&&(_0x266dec+='\x20'+_0xdeafa9[_0xba2e('0x7b')]+'\x20');_0x266dec+=_0xdeafa9[_0xba2e('0x57')][_0x390b54]['group']?_0x51ff83(_0xdeafa9[_0xba2e('0x57')][_0x390b54][_0xba2e('0x71')]):_0xdeafa9['rules'][_0x390b54]['field']+'\x20'+_0xdeafa9[_0xba2e('0x57')][_0x390b54][_0xba2e('0x59')]+(_0x4592ea(_0xdeafa9[_0xba2e('0x57')][_0x390b54][_0xba2e('0x59')])?'\x20'+_0xdeafa9[_0xba2e('0x57')][_0x390b54][_0xba2e('0x5a')]:'');}return _0x266dec+')';};var _0x342fb6={'where':{'id':_0x211ad3['id']}},_0x58f465,_0x395c24,_0x2c1d45,_0x24b9c5,_0x44f40d;_0x342fb6=_[_0xba2e('0x30')]({},_0x342fb6,_0x57fa1c);return db[_0xba2e('0x20')]['find'](_0x342fb6)[_0xba2e('0x18')](function(_0x567171){if(_0x567171){_0x58f465=_0x567171;return _0x567171[_0xba2e('0x7c')]();}return null;})[_0xba2e('0x18')](function(_0x3d19b9){if(_0x3d19b9){if(!_0x3d19b9[_0xba2e('0x3c')]){throw new db[(_0xba2e('0x5b'))][(_0xba2e('0x5c'))](_0xba2e('0x5d'));}_0x395c24=_0x3d19b9;return db[_0xba2e('0x7d')][_0xba2e('0x5e')]({'raw':!![]});}return null;})['then'](function(_0x249d7c){if(_0x249d7c){_0x2c1d45=_[_0xba2e('0x5f')](_0x249d7c,'id');var _0x16106c;var _0x3be0b1=squel[_0xba2e('0x60')]();_0x3be0b1[_0xba2e('0x7e')](_0x58f465['table']);for(var _0x30f46e=0x0;_0x30f46e<_0x395c24[_0xba2e('0x3c')];_0x30f46e+=0x1){_0x16106c=_0x395c24[_0x30f46e]['MetricId']?_0x2c1d45[_0x395c24[_0x30f46e][_0xba2e('0x62')]][_0xba2e('0x7f')]:_0x395c24[_0x30f46e]['field'];_0x16106c=_0x395c24[_0x30f46e][_0xba2e('0x63')]?_[_0xba2e('0x64')](_0x42e173[_0x395c24[_0x30f46e][_0xba2e('0x63')]],'%s',_0x16106c):_0x16106c;_0x16106c=_0x395c24[_0x30f46e]['format']?_['replace'](_0x78b5b5[_0x395c24[_0x30f46e][_0xba2e('0x65')]],'%s',_0x16106c):_0x16106c;if(_0x395c24[_0x30f46e]['groupBy']){_0x3be0b1[_0xba2e('0x71')](_0x16106c);}_0x395c24[_0x30f46e][_0xba2e('0x66')]&&_0x3be0b1[_0xba2e('0x2c')](_0x16106c,_0x395c24[_0x30f46e][_0xba2e('0x66')]===_0xba2e('0x67')?![]:!![]);_0x3be0b1[_0xba2e('0x58')](_0x16106c,_0x395c24[_0x30f46e][_0xba2e('0x68')]||_0x16106c);}if(_0x58f465[_0xba2e('0x69')]){_0x58f465[_0xba2e('0x69')]=JSON[_0xba2e('0x70')](_0x58f465[_0xba2e('0x69')]);for(var _0x4b18f2=0x0;_0x4b18f2<_0x58f465[_0xba2e('0x69')]['length'];_0x4b18f2+=0x1){if(_0x58f465[_0xba2e('0x69')][_0x4b18f2][_0xba2e('0x6d')]&&_[_0xba2e('0x53')](_0x523fb6,_0x58f465['joins'][_0x4b18f2][_0xba2e('0x6d')])&&_0x58f465[_0xba2e('0x69')][_0x4b18f2][_0xba2e('0x6a')]&&_0x58f465[_0xba2e('0x69')][_0x4b18f2][_0xba2e('0x6b')]&&_0x58f465[_0xba2e('0x69')][_0x4b18f2][_0xba2e('0x6c')]){_0x3be0b1[_0x58f465[_0xba2e('0x69')][_0x4b18f2][_0xba2e('0x6d')]](_0x58f465[_0xba2e('0x69')][_0x4b18f2]['foreignTable'],null,util[_0xba2e('0x65')]('%s.%s\x20=\x20%s.%s',_0x58f465['table'],_0x58f465['joins'][_0x4b18f2]['parentKey'],_0x58f465[_0xba2e('0x69')][_0x4b18f2][_0xba2e('0x6b')],_0x58f465[_0xba2e('0x69')][_0x4b18f2]['foreignKey']));}}}if(_0x58f465[_0xba2e('0x6f')]){_0x58f465[_0xba2e('0x6f')]=JSON[_0xba2e('0x70')](_0x58f465[_0xba2e('0x6f')]);_0x3be0b1['where'](_0x51ff83(_0x58f465[_0xba2e('0x6f')][_0xba2e('0x71')]));}_0x44f40d=_0x3be0b1[_0xba2e('0x72')]();_0x3be0b1['limit'](_0x1a9ed3);_0x3be0b1[_0xba2e('0x11')](0x0);logger[_0xba2e('0x73')](_0xba2e('0x74'),_0x3be0b1[_0xba2e('0x75')]());return db[_0xba2e('0x76')]['query'](_0x3be0b1['toString'](),{'type':db['sequelize'][_0xba2e('0x77')][_0xba2e('0x80')]});}})[_0xba2e('0x18')](function(_0x176350){if(!_0x176350[_0xba2e('0x3c')]){throw new db['Sequelize'][(_0xba2e('0x5c'))](_0xba2e('0x81'));}if(_0x379de4[_0xba2e('0x82')]==='web'){return null;}var _0x490982=_[_0xba2e('0x30')](_0x379de4,{'name':_0x379de4[_0xba2e('0x83')]||_0x379de4[_0xba2e('0x1d')]||_0x58f465[_0xba2e('0x1d')],'basename':_0x26690a,'savename':util[_0xba2e('0x65')](_0xba2e('0x84'),_0x379de4[_0xba2e('0x1d')]||_0x58f465[_0xba2e('0x1d')],require(_0xba2e('0x85'))['generate'](0x4),_0x379de4[_0xba2e('0x82')]||_0xba2e('0x86'))});return db[_0xba2e('0x87')][_0xba2e('0x88')](_0x490982,{'raw':!![]});})['then'](function(_0x2cbca6){_0x44f40d[_0xba2e('0x31')](_0x58f465[_0xba2e('0x61')]+_0xba2e('0x89'),_0x379de4[_0xba2e('0x8a')],_0x379de4['endDate']);if(_0x2cbca6){logger[_0xba2e('0x8b')](_0xba2e('0x8c'),_0x44f40d[_0xba2e('0x75')]());require(_0xba2e('0x8d'))[_0xba2e('0x8e')](path[_0xba2e('0x42')](__dirname,_0xba2e('0x8f'),_0x2cbca6[_0xba2e('0x82')]),[_0x2cbca6['id'],_0x44f40d[_0xba2e('0x75')](),path[_0xba2e('0x42')](__dirname,_0xba2e('0x90'),_0x2cbca6[_0xba2e('0x91')]),_0x26690a]);return _0x2cbca6;}else{var _0x94ee1d=squel[_0xba2e('0x60')]();_0x94ee1d['from']('('+_0x44f40d[_0xba2e('0x75')]()+')',_0xba2e('0x92'));_0x94ee1d[_0xba2e('0x58')](_0xba2e('0x93'),_0xba2e('0x10'));_0x44f40d[_0xba2e('0x12')](_0x379de4['limit']||_0x1a9ed3);_0x44f40d[_0xba2e('0x11')](_0x379de4[_0xba2e('0x11')]||0x0);return db[_0xba2e('0x76')]['query'](_0x94ee1d[_0xba2e('0x75')](),{'type':db[_0xba2e('0x76')][_0xba2e('0x77')][_0xba2e('0x80')]})[_0xba2e('0x18')](function(_0x41f28a){if(!_0x41f28a[_0xba2e('0x3c')]){_0x24b9c5=0x0;}else{_0x24b9c5=_0x41f28a[0x0][_0xba2e('0x10')]||0x0;}return db[_0xba2e('0x76')][_0xba2e('0x24')](_0x44f40d['toString'](),{'type':db[_0xba2e('0x76')][_0xba2e('0x77')][_0xba2e('0x80')]});})[_0xba2e('0x18')](function(_0x4a4e95){return{'rows':_0x4a4e95||[],'count':_0x24b9c5};});}});}exports[_0xba2e('0x94')]=function(_0x3eab4f,_0x4978a0){return runReport(_0x3eab4f[_0xba2e('0x3a')],_0x3eab4f[_0xba2e('0x24')],_0x3eab4f[_0xba2e('0x34')])[_0xba2e('0x18')](respondWithResult(_0x4978a0,null))['catch'](handleError(_0x4978a0,null));};exports[_0xba2e('0x95')]=runReport;exports[_0xba2e('0x24')]=function(_0x207f90,_0x19e531){var _0x4ccc6a=0xa;var _0xec68be=[_0xba2e('0x42'),_0xba2e('0x43'),'right_join',_0xba2e('0x45'),_0xba2e('0x46')];var _0xebab84={'SUM':_0xba2e('0x47'),'COUNT':_0xba2e('0x78'),'COUNT DISTINCT':_0xba2e('0x48'),'MAX':_0xba2e('0x49'),'MIN':_0xba2e('0x4a'),'AVG':_0xba2e('0x4b'),'GROUP_CONCAT':_0xba2e('0x4c'),'GROUP_CONCAT ASC':_0xba2e('0x4d'),'GROUP_CONCAT DESC':_0xba2e('0x79')};var _0x24f629={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xba2e('0x50'),'ROUND':_0xba2e('0x51'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x293c9f=function(_0x253092){return!_['includes']([_0xba2e('0x54'),'IS\x20NOT\x20NULL',_0xba2e('0x56'),_0xba2e('0x7a')],_0x253092);};var _0x57c8cb=function(_0x2bbd37){if(!_0x2bbd37||!_0x2bbd37[_0xba2e('0x57')]['length']){return'';}for(var _0x3cbb24='(',_0x3006dd=0x0;_0x3006dd<_0x2bbd37[_0xba2e('0x57')][_0xba2e('0x3c')];_0x3006dd+=0x1){_0x3006dd>0x0&&(_0x3cbb24+='\x20'+_0x2bbd37[_0xba2e('0x7b')]+'\x20');_0x3cbb24+=_0x2bbd37[_0xba2e('0x57')][_0x3006dd]['group']?_0x57c8cb(_0x2bbd37[_0xba2e('0x57')][_0x3006dd][_0xba2e('0x71')]):_0x2bbd37[_0xba2e('0x57')][_0x3006dd][_0xba2e('0x58')]+'\x20'+_0x2bbd37[_0xba2e('0x57')][_0x3006dd]['condition']+(_0x293c9f(_0x2bbd37[_0xba2e('0x57')][_0x3006dd]['condition'])?'\x20'+_0x2bbd37['rules'][_0x3006dd]['value']:'');}return _0x3cbb24+')';};var _0x37c338={'where':{'id':_0x207f90[_0xba2e('0x3a')]['id']}},_0x12c48d,_0x4ea6f7,_0x157451,_0x29e1c9,_0x3bc92e;_0x37c338=_[_0xba2e('0x30')]({},_0x37c338,_0x207f90['options']);return db[_0xba2e('0x20')][_0xba2e('0x3d')](_0x37c338)[_0xba2e('0x18')](function(_0x46b04c){if(_0x46b04c){_0x12c48d=_0x46b04c;return _0x46b04c[_0xba2e('0x7c')]();}return null;})['then'](function(_0x40d7dc){if(_0x40d7dc){if(!_0x40d7dc[_0xba2e('0x3c')]){throw new db['Sequelize'][(_0xba2e('0x5c'))](_0xba2e('0x5d'));}_0x4ea6f7=_0x40d7dc;return db[_0xba2e('0x7d')][_0xba2e('0x5e')]({'raw':!![]});}return null;})[_0xba2e('0x18')](function(_0x2a5463){if(_0x2a5463){_0x157451=_[_0xba2e('0x5f')](_0x2a5463,'id');var _0x18d037;var _0x28154f=squel[_0xba2e('0x60')]();_0x28154f['from'](_0x12c48d['table']);for(var _0x3070e3=0x0;_0x3070e3<_0x4ea6f7[_0xba2e('0x3c')];_0x3070e3+=0x1){_0x18d037=_0x4ea6f7[_0x3070e3][_0xba2e('0x62')]?_0x157451[_0x4ea6f7[_0x3070e3][_0xba2e('0x62')]]['metric']:_0x4ea6f7[_0x3070e3][_0xba2e('0x58')];_0x18d037=_0x4ea6f7[_0x3070e3][_0xba2e('0x63')]?_[_0xba2e('0x64')](_0xebab84[_0x4ea6f7[_0x3070e3][_0xba2e('0x63')]],'%s',_0x18d037):_0x18d037;_0x18d037=_0x4ea6f7[_0x3070e3][_0xba2e('0x65')]?_['replace'](_0x24f629[_0x4ea6f7[_0x3070e3][_0xba2e('0x65')]],'%s',_0x18d037):_0x18d037;if(_0x4ea6f7[_0x3070e3]['groupBy']){_0x28154f['group'](_0x18d037);}_0x4ea6f7[_0x3070e3][_0xba2e('0x66')]&&_0x28154f['order'](_0x18d037,_0x4ea6f7[_0x3070e3][_0xba2e('0x66')]===_0xba2e('0x67')?![]:!![]);_0x28154f[_0xba2e('0x58')](_0x18d037,_0x4ea6f7[_0x3070e3][_0xba2e('0x68')]||_0x18d037);}if(_0x12c48d[_0xba2e('0x69')]){_0x12c48d['joins']=JSON[_0xba2e('0x70')](_0x12c48d[_0xba2e('0x69')]);for(var _0x3b244b=0x0;_0x3b244b<_0x12c48d[_0xba2e('0x69')][_0xba2e('0x3c')];_0x3b244b+=0x1){if(_0x12c48d[_0xba2e('0x69')][_0x3b244b][_0xba2e('0x6d')]&&_['includes'](_0xec68be,_0x12c48d[_0xba2e('0x69')][_0x3b244b][_0xba2e('0x6d')])&&_0x12c48d['joins'][_0x3b244b][_0xba2e('0x6a')]&&_0x12c48d['joins'][_0x3b244b][_0xba2e('0x6b')]&&_0x12c48d['joins'][_0x3b244b][_0xba2e('0x6c')]){_0x28154f[_0x12c48d[_0xba2e('0x69')][_0x3b244b][_0xba2e('0x6d')]](_0x12c48d[_0xba2e('0x69')][_0x3b244b][_0xba2e('0x6b')],null,util[_0xba2e('0x65')](_0xba2e('0x6e'),_0x12c48d[_0xba2e('0x61')],_0x12c48d['joins'][_0x3b244b][_0xba2e('0x6a')],_0x12c48d[_0xba2e('0x69')][_0x3b244b][_0xba2e('0x6b')],_0x12c48d[_0xba2e('0x69')][_0x3b244b][_0xba2e('0x6c')]));}}}if(_0x12c48d[_0xba2e('0x6f')]){_0x12c48d[_0xba2e('0x6f')]=JSON['parse'](_0x12c48d[_0xba2e('0x6f')]);_0x28154f[_0xba2e('0x31')](_0x57c8cb(_0x12c48d[_0xba2e('0x6f')][_0xba2e('0x71')]));}_0x3bc92e=_0x28154f[_0xba2e('0x72')]();_0x28154f['limit'](_0x4ccc6a);_0x28154f[_0xba2e('0x11')](0x0);logger[_0xba2e('0x73')](_0xba2e('0x74'),_0x28154f[_0xba2e('0x75')]());return db['sequelize'][_0xba2e('0x24')](_0x28154f[_0xba2e('0x75')](),{'type':db[_0xba2e('0x76')][_0xba2e('0x77')][_0xba2e('0x80')]});}})[_0xba2e('0x18')](function(){return{'sql':_0x3bc92e[_0xba2e('0x75')]()};})[_0xba2e('0x18')](respondWithResult(_0x19e531,null))[_0xba2e('0x38')](handleError(_0x19e531,null));}; \ No newline at end of file +var _0x8ae5=['Run\x20Query:','child_process','fork','../../components/export/','output','../../files/reports','savename','countTable','COUNT(*)','run','runReport','condition','DESC','alias','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','status','error','stack','name','send','index','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','options','AnalyticCustomReport','include','rows','catch','params','includeAll','find','create','body','destroy','join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Sequelize','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','findAll','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','joins','parse','type','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','left_join','right_join','outer_join','SUM(%s)','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','from','clone','SELECT','web','fullPath','randomstring','generate','csv','AnalyticExtractedReport','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate'];(function(_0x16d7b7,_0x46ee07){var _0x1f41a7=function(_0x118acf){while(--_0x118acf){_0x16d7b7['push'](_0x16d7b7['shift']());}};_0x1f41a7(++_0x46ee07);}(_0x8ae5,0xa6));var _0x58ae=function(_0x129c73,_0x900895){_0x129c73=_0x129c73-0x0;var _0x15a8bf=_0x8ae5[_0x129c73];return _0x15a8bf;};'use strict';var jsonpatch=require(_0x58ae('0x0'));var rp=require(_0x58ae('0x1'));var moment=require(_0x58ae('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x58ae('0x3'));var util=require(_0x58ae('0x4'));var path=require(_0x58ae('0x5'));var sox=require(_0x58ae('0x6'));var csv=require('to-csv');var ejs=require(_0x58ae('0x7'));var fs=require('fs');var _=require(_0x58ae('0x8'));var squel=require('squel');var crypto=require(_0x58ae('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x58ae('0xa'));var toCsv=require(_0x58ae('0xb'));var querystring=require(_0x58ae('0xc'));var Papa=require('papaparse');var qs=require(_0x58ae('0xd'));var logger=require(_0x58ae('0xe'))(_0x58ae('0xf'));var utils=require(_0x58ae('0x10'));var config=require(_0x58ae('0x11'));var db=require(_0x58ae('0x12'))['db'];function respondWithStatusCode(_0x36395b,_0x51be09){_0x51be09=_0x51be09||0xcc;return function(_0xe81b27){if(_0xe81b27){return _0x36395b[_0x58ae('0x13')](_0x51be09);}return _0x36395b['status'](_0x51be09)[_0x58ae('0x14')]();};}function respondWithResult(_0x1811fa,_0x453866){_0x453866=_0x453866||0xc8;return function(_0x37642c){if(_0x37642c){return _0x1811fa['status'](_0x453866)[_0x58ae('0x15')](_0x37642c);}};}function respondWithFilteredResult(_0x8c47ba,_0x49cb24){return function(_0x17bd48){if(_0x17bd48){var _0x5ee872=_0x17bd48[_0x58ae('0x16')],_0xfca75e=_0x49cb24[_0x58ae('0x17')],_0x1cd7fe=_0x49cb24[_0x58ae('0x17')]+_0x49cb24[_0x58ae('0x18')],_0x33c8f0;if(_0x1cd7fe>=_0x5ee872){_0x1cd7fe=_0x5ee872;_0x33c8f0=0xc8;}else{_0x33c8f0=0xce;}_0x8c47ba['status'](_0x33c8f0);return _0x8c47ba[_0x58ae('0x19')](_0x58ae('0x1a'),_0xfca75e+'-'+_0x1cd7fe+'/'+_0x5ee872)['json'](_0x17bd48);}return null;};}function patchUpdates(_0xbd601b){return function(_0x2b43c1){try{jsonpatch[_0x58ae('0x1b')](_0x2b43c1,_0xbd601b,!![]);}catch(_0x11eb65){return BPromise['reject'](_0x11eb65);}return _0x2b43c1[_0x58ae('0x1c')]();};}function saveUpdates(_0x41bd70,_0x5787be){return function(_0x4a2117){if(_0x4a2117){return _0x4a2117[_0x58ae('0x1d')](_0x41bd70)[_0x58ae('0x1e')](function(_0xabee5c){return _0xabee5c;});}return null;};}function removeEntity(_0x4b66f2,_0x53e985){return function(_0x577288){if(_0x577288){return _0x577288['destroy']()[_0x58ae('0x1e')](function(){_0x4b66f2[_0x58ae('0x1f')](0xcc)[_0x58ae('0x14')]();});}};}function handleEntityNotFound(_0xe10cd0,_0x11be82){return function(_0x3987f5){if(!_0x3987f5){_0xe10cd0[_0x58ae('0x13')](0x194);}return _0x3987f5;};}function handleError(_0xf068e6,_0x442302){_0x442302=_0x442302||0x1f4;return function(_0x21543b){logger[_0x58ae('0x20')](_0x21543b[_0x58ae('0x21')]);if(_0x21543b[_0x58ae('0x22')]){delete _0x21543b[_0x58ae('0x22')];}_0xf068e6[_0x58ae('0x1f')](_0x442302)[_0x58ae('0x23')](_0x21543b);};}exports[_0x58ae('0x24')]=function(_0x546583,_0x4ffd14){var _0x45609e={},_0x12708c={},_0x565f09={'count':0x0,'rows':[]};var _0x4489dd=db['AnalyticCustomReport'][_0x58ae('0x25')];_0x12708c[_0x58ae('0x26')]=_[_0x58ae('0x27')](_0x4489dd);var _0x19dbd9={'dateStart':_0x546583[_0x58ae('0x28')]['dateStart'],'dateEnd':_0x546583[_0x58ae('0x28')][_0x58ae('0x29')]};delete _0x546583[_0x58ae('0x28')][_0x58ae('0x2a')];delete _0x546583[_0x58ae('0x28')][_0x58ae('0x29')];_0x12708c[_0x58ae('0x28')]=_[_0x58ae('0x27')](_0x546583['query']);_0x12708c[_0x58ae('0x2b')]=_[_0x58ae('0x2c')](_0x12708c[_0x58ae('0x26')],_0x12708c['query']);_0x45609e[_0x58ae('0x2d')]=_['intersection'](_0x12708c[_0x58ae('0x26')],qs[_0x58ae('0x2e')](_0x546583[_0x58ae('0x28')]['fields']));_0x45609e[_0x58ae('0x2d')]=_0x45609e[_0x58ae('0x2d')][_0x58ae('0x2f')]?_0x45609e['attributes']:_0x12708c['model'];if(!_0x546583['query'][_0x58ae('0x30')](_0x58ae('0x31'))){_0x45609e[_0x58ae('0x18')]=qs[_0x58ae('0x18')](_0x546583[_0x58ae('0x28')][_0x58ae('0x18')]);_0x45609e[_0x58ae('0x17')]=qs[_0x58ae('0x17')](_0x546583[_0x58ae('0x28')][_0x58ae('0x17')]);}_0x45609e[_0x58ae('0x32')]=qs[_0x58ae('0x33')](_0x546583[_0x58ae('0x28')]['sort']);_0x45609e[_0x58ae('0x34')]=qs[_0x58ae('0x2b')](_[_0x58ae('0x35')](_0x546583[_0x58ae('0x28')],_0x12708c[_0x58ae('0x2b')]));if(_0x19dbd9[_0x58ae('0x2a')]){if(_0x19dbd9[_0x58ae('0x29')]){_0x19dbd9['dateEnd']=moment(_0x19dbd9['dateEnd'])[_0x58ae('0x36')](0x1,_0x58ae('0x37'));}else{_0x19dbd9[_0x58ae('0x29')]=moment(_0x19dbd9[_0x58ae('0x2a')])['add'](0x1,_0x58ae('0x37'));}_['merge'](_0x45609e[_0x58ae('0x34')],{'createdAt':{'$gte':_0x19dbd9['dateStart'],'$lte':_0x19dbd9[_0x58ae('0x29')]}});}if(_0x546583[_0x58ae('0x28')][_0x58ae('0x38')]){_0x45609e[_0x58ae('0x34')]=_['merge'](_0x45609e[_0x58ae('0x34')],{'$or':_['map'](_0x45609e[_0x58ae('0x2d')],function(_0xdd515c){var _0xab4608={};_0xab4608[_0xdd515c]={'$like':'%'+_0x546583[_0x58ae('0x28')]['filter']+'%'};return _0xab4608;})});}_0x45609e=_[_0x58ae('0x39')]({},_0x45609e,_0x546583[_0x58ae('0x3a')]);var _0x1aae3a={'where':_0x45609e[_0x58ae('0x34')]};return db[_0x58ae('0x3b')]['count'](_0x1aae3a)[_0x58ae('0x1e')](function(_0x45f083){_0x565f09[_0x58ae('0x16')]=_0x45f083;if(_0x546583[_0x58ae('0x28')]['includeAll']){_0x45609e[_0x58ae('0x3c')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x45609e);})['then'](function(_0x114ef9){_0x565f09[_0x58ae('0x3d')]=_0x114ef9;return _0x565f09;})[_0x58ae('0x1e')](respondWithFilteredResult(_0x4ffd14,_0x45609e))[_0x58ae('0x3e')](handleError(_0x4ffd14,null));};exports['show']=function(_0x5b8f04,_0x4581f8){var _0x33b1b6={'raw':![],'where':{'id':_0x5b8f04[_0x58ae('0x3f')]['id']}},_0x563b40={};_0x563b40['model']=_[_0x58ae('0x27')](db['AnalyticCustomReport'][_0x58ae('0x25')]);_0x563b40[_0x58ae('0x28')]=_['keys'](_0x5b8f04['query']);_0x563b40[_0x58ae('0x2b')]=_[_0x58ae('0x2c')](_0x563b40[_0x58ae('0x26')],_0x563b40['query']);_0x33b1b6['attributes']=_[_0x58ae('0x2c')](_0x563b40['model'],qs[_0x58ae('0x2e')](_0x5b8f04[_0x58ae('0x28')]['fields']));_0x33b1b6[_0x58ae('0x2d')]=_0x33b1b6[_0x58ae('0x2d')][_0x58ae('0x2f')]?_0x33b1b6[_0x58ae('0x2d')]:_0x563b40[_0x58ae('0x26')];if(_0x5b8f04['query'][_0x58ae('0x40')]){_0x33b1b6[_0x58ae('0x3c')]=[{'all':!![]}];}_0x33b1b6=_['merge']({},_0x33b1b6,_0x5b8f04[_0x58ae('0x3a')]);return db[_0x58ae('0x3b')][_0x58ae('0x41')](_0x33b1b6)[_0x58ae('0x1e')](handleEntityNotFound(_0x4581f8,null))['then'](respondWithResult(_0x4581f8,null))['catch'](handleError(_0x4581f8,null));};exports[_0x58ae('0x42')]=function(_0x30b0c3,_0x4ce498){return db[_0x58ae('0x3b')][_0x58ae('0x42')](_0x30b0c3['body'],{})['then'](respondWithResult(_0x4ce498,0xc9))[_0x58ae('0x3e')](handleError(_0x4ce498,null));};exports[_0x58ae('0x1d')]=function(_0x9730ba,_0x5c12a2){if(_0x9730ba[_0x58ae('0x43')]['id']){delete _0x9730ba[_0x58ae('0x43')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x9730ba[_0x58ae('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5c12a2,null))[_0x58ae('0x1e')](saveUpdates(_0x9730ba[_0x58ae('0x43')],null))[_0x58ae('0x1e')](respondWithResult(_0x5c12a2,null))[_0x58ae('0x3e')](handleError(_0x5c12a2,null));};exports[_0x58ae('0x44')]=function(_0x343681,_0x6dd5f9){return db['AnalyticCustomReport']['find']({'where':{'id':_0x343681[_0x58ae('0x3f')]['id']}})[_0x58ae('0x1e')](handleEntityNotFound(_0x6dd5f9,null))[_0x58ae('0x1e')](removeEntity(_0x6dd5f9,null))['catch'](handleError(_0x6dd5f9,null));};exports['preview']=function(_0x29a4dd,_0x4c36a5){var _0xa2822b=0xa;var _0x4ca33d=[_0x58ae('0x45'),'left_join','right_join','outer_join',_0x58ae('0x46')];var _0x4a053e={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x58ae('0x47'),'MAX':_0x58ae('0x48'),'MIN':_0x58ae('0x49'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x58ae('0x4a'),'GROUP_CONCAT ASC':_0x58ae('0x4b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x362951={'SEC_TO_TIME':_0x58ae('0x4c'),'DATE':'DATE(%s)','HOUR':_0x58ae('0x4d'),'ROUND':_0x58ae('0x4e'),'UNIX_TIMESTAMP':_0x58ae('0x4f')};var _0x5ad8eb=function(_0x5b7e66){return!_['includes']([_0x58ae('0x50'),_0x58ae('0x51'),_0x58ae('0x52'),_0x58ae('0x53')],_0x5b7e66);};var _0x58c908=function(_0x1ed106){if(!_0x1ed106||!_0x1ed106[_0x58ae('0x54')][_0x58ae('0x2f')]){return'';}for(var _0x2ff75a='(',_0x45e612=0x0;_0x45e612<_0x1ed106[_0x58ae('0x54')][_0x58ae('0x2f')];_0x45e612+=0x1){_0x45e612>0x0&&(_0x2ff75a+='\x20'+_0x1ed106[_0x58ae('0x55')]+'\x20');_0x2ff75a+=_0x1ed106[_0x58ae('0x54')][_0x45e612][_0x58ae('0x56')]?_0x58c908(_0x1ed106['rules'][_0x45e612][_0x58ae('0x56')]):_0x1ed106[_0x58ae('0x54')][_0x45e612][_0x58ae('0x57')]+'\x20'+_0x1ed106[_0x58ae('0x54')][_0x45e612]['condition']+(_0x5ad8eb(_0x1ed106[_0x58ae('0x54')][_0x45e612]['condition'])?'\x20'+_0x1ed106['rules'][_0x45e612][_0x58ae('0x58')]:'');}return _0x2ff75a+')';};var _0x335cb1={'where':{'id':_0x29a4dd[_0x58ae('0x3f')]['id']}},_0x5d3438,_0x25cfb4,_0x469b8b,_0x27eeb9,_0x57f8bf;_0x335cb1=_['merge']({},_0x335cb1,_0x29a4dd['options']);return db['AnalyticCustomReport'][_0x58ae('0x41')](_0x335cb1)[_0x58ae('0x1e')](function(_0x2f8cd0){if(_0x2f8cd0){_0x5d3438=_0x2f8cd0;return _0x2f8cd0[_0x58ae('0x59')]();}return null;})[_0x58ae('0x1e')](function(_0x364d6){if(_0x364d6){if(!_0x364d6[_0x58ae('0x2f')]){throw new db[(_0x58ae('0x5a'))][(_0x58ae('0x5b'))](_0x58ae('0x5c'));}_0x25cfb4=_0x364d6;return db[_0x58ae('0x5d')][_0x58ae('0x5e')]({'raw':!![]});}return null;})['then'](function(_0x1175d1){if(_0x1175d1){_0x469b8b=_[_0x58ae('0x5f')](_0x1175d1,'id');var _0x46f5d9;var _0x36add2=squel[_0x58ae('0x60')]();_0x36add2['from'](_0x5d3438[_0x58ae('0x61')]);for(var _0x5c255a=0x0;_0x5c255a<_0x25cfb4[_0x58ae('0x2f')];_0x5c255a+=0x1){_0x46f5d9=_0x25cfb4[_0x5c255a][_0x58ae('0x62')]?_0x469b8b[_0x25cfb4[_0x5c255a][_0x58ae('0x62')]][_0x58ae('0x63')]:_0x25cfb4[_0x5c255a][_0x58ae('0x57')];_0x46f5d9=_0x25cfb4[_0x5c255a][_0x58ae('0x64')]?_[_0x58ae('0x65')](_0x4a053e[_0x25cfb4[_0x5c255a]['function']],'%s',_0x46f5d9):_0x46f5d9;_0x46f5d9=_0x25cfb4[_0x5c255a][_0x58ae('0x66')]?_['replace'](_0x362951[_0x25cfb4[_0x5c255a]['format']],'%s',_0x46f5d9):_0x46f5d9;if(_0x25cfb4[_0x5c255a][_0x58ae('0x67')]){_0x36add2[_0x58ae('0x56')](_0x46f5d9);}_0x25cfb4[_0x5c255a]['orderBy']&&_0x36add2[_0x58ae('0x32')](_0x46f5d9,_0x25cfb4[_0x5c255a][_0x58ae('0x68')]==='DESC'?![]:!![]);_0x36add2['field'](_0x46f5d9,_0x25cfb4[_0x5c255a]['alias']||_0x46f5d9);}if(_0x5d3438[_0x58ae('0x69')]){_0x5d3438['joins']=JSON[_0x58ae('0x6a')](_0x5d3438[_0x58ae('0x69')]);for(var _0x2afe65=0x0;_0x2afe65<_0x5d3438['joins'][_0x58ae('0x2f')];_0x2afe65+=0x1){if(_0x5d3438[_0x58ae('0x69')][_0x2afe65][_0x58ae('0x6b')]&&_[_0x58ae('0x6c')](_0x4ca33d,_0x5d3438['joins'][_0x2afe65][_0x58ae('0x6b')])&&_0x5d3438[_0x58ae('0x69')][_0x2afe65][_0x58ae('0x6d')]&&_0x5d3438[_0x58ae('0x69')][_0x2afe65][_0x58ae('0x6e')]&&_0x5d3438[_0x58ae('0x69')][_0x2afe65][_0x58ae('0x6f')]){_0x36add2[_0x5d3438['joins'][_0x2afe65][_0x58ae('0x6b')]](_0x5d3438[_0x58ae('0x69')][_0x2afe65]['foreignTable'],null,util['format'](_0x58ae('0x70'),_0x5d3438[_0x58ae('0x61')],_0x5d3438[_0x58ae('0x69')][_0x2afe65]['parentKey'],_0x5d3438[_0x58ae('0x69')][_0x2afe65][_0x58ae('0x6e')],_0x5d3438[_0x58ae('0x69')][_0x2afe65]['foreignKey']));}}}if(_0x5d3438[_0x58ae('0x71')]){_0x5d3438[_0x58ae('0x71')]=JSON[_0x58ae('0x6a')](_0x5d3438[_0x58ae('0x71')]);_0x36add2[_0x58ae('0x34')](_0x58c908(_0x5d3438[_0x58ae('0x71')][_0x58ae('0x56')]));}_0x57f8bf=_0x36add2['clone']();_0x36add2[_0x58ae('0x18')](_0xa2822b);_0x36add2[_0x58ae('0x17')](0x0);logger[_0x58ae('0x72')](_0x58ae('0x73'),_0x36add2['toString']());return db[_0x58ae('0x74')][_0x58ae('0x28')](_0x36add2[_0x58ae('0x75')](),{'type':db[_0x58ae('0x74')][_0x58ae('0x76')]['SELECT']});}})[_0x58ae('0x1e')](respondWithResult(_0x4c36a5,null))[_0x58ae('0x3e')](handleError(_0x4c36a5,null));};function runReport(_0x5b2b18,_0x365340,_0x2b088a){var _0x5b3dfc=_0x365340['name'];var _0x18b9c7=0xa;var _0x347edc=[_0x58ae('0x45'),_0x58ae('0x77'),_0x58ae('0x78'),_0x58ae('0x79'),_0x58ae('0x46')];var _0x2af2b9={'SUM':_0x58ae('0x7a'),'COUNT':_0x58ae('0x7b'),'COUNT DISTINCT':_0x58ae('0x47'),'MAX':_0x58ae('0x48'),'MIN':_0x58ae('0x49'),'AVG':_0x58ae('0x7c'),'GROUP_CONCAT':_0x58ae('0x4a'),'GROUP_CONCAT ASC':_0x58ae('0x4b'),'GROUP_CONCAT DESC':_0x58ae('0x7d')};var _0x42b5d0={'SEC_TO_TIME':_0x58ae('0x4c'),'DATE':_0x58ae('0x7e'),'HOUR':_0x58ae('0x4d'),'ROUND':_0x58ae('0x4e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x385442=function(_0x842df2){return!_[_0x58ae('0x6c')]([_0x58ae('0x50'),_0x58ae('0x51'),_0x58ae('0x52'),'IS\x20NOT\x20EMPTY'],_0x842df2);};var _0x7bbb53=function(_0x1efdfc){if(!_0x1efdfc||!_0x1efdfc[_0x58ae('0x54')][_0x58ae('0x2f')]){return'';}for(var _0x11352c='(',_0x5bcbf5=0x0;_0x5bcbf5<_0x1efdfc[_0x58ae('0x54')][_0x58ae('0x2f')];_0x5bcbf5+=0x1){_0x5bcbf5>0x0&&(_0x11352c+='\x20'+_0x1efdfc[_0x58ae('0x55')]+'\x20');_0x11352c+=_0x1efdfc['rules'][_0x5bcbf5][_0x58ae('0x56')]?_0x7bbb53(_0x1efdfc[_0x58ae('0x54')][_0x5bcbf5][_0x58ae('0x56')]):_0x1efdfc['rules'][_0x5bcbf5][_0x58ae('0x57')]+'\x20'+_0x1efdfc[_0x58ae('0x54')][_0x5bcbf5]['condition']+(_0x385442(_0x1efdfc[_0x58ae('0x54')][_0x5bcbf5]['condition'])?'\x20'+_0x1efdfc[_0x58ae('0x54')][_0x5bcbf5][_0x58ae('0x58')]:'');}return _0x11352c+')';};var _0x12f08c={'where':{'id':_0x5b2b18['id']}},_0x407555,_0xdafe18,_0x37b110,_0x5ac317,_0x5941df;_0x12f08c=_[_0x58ae('0x39')]({},_0x12f08c,_0x2b088a);return db['AnalyticCustomReport'][_0x58ae('0x41')](_0x12f08c)[_0x58ae('0x1e')](function(_0x4eaf7c){if(_0x4eaf7c){_0x407555=_0x4eaf7c;return _0x4eaf7c[_0x58ae('0x59')]();}return null;})['then'](function(_0x303d80){if(_0x303d80){if(!_0x303d80[_0x58ae('0x2f')]){throw new db[(_0x58ae('0x5a'))][(_0x58ae('0x5b'))]('Please\x20insert\x20at\x20least\x20one\x20field!');}_0xdafe18=_0x303d80;return db['AnalyticMetric'][_0x58ae('0x5e')]({'raw':!![]});}return null;})[_0x58ae('0x1e')](function(_0x5cedbf){if(_0x5cedbf){_0x37b110=_[_0x58ae('0x5f')](_0x5cedbf,'id');var _0x2abdee;var _0x14cd25=squel[_0x58ae('0x60')]();_0x14cd25[_0x58ae('0x7f')](_0x407555['table']);for(var _0xe7e4d6=0x0;_0xe7e4d6<_0xdafe18[_0x58ae('0x2f')];_0xe7e4d6+=0x1){_0x2abdee=_0xdafe18[_0xe7e4d6]['MetricId']?_0x37b110[_0xdafe18[_0xe7e4d6][_0x58ae('0x62')]][_0x58ae('0x63')]:_0xdafe18[_0xe7e4d6]['field'];_0x2abdee=_0xdafe18[_0xe7e4d6][_0x58ae('0x64')]?_[_0x58ae('0x65')](_0x2af2b9[_0xdafe18[_0xe7e4d6]['function']],'%s',_0x2abdee):_0x2abdee;_0x2abdee=_0xdafe18[_0xe7e4d6][_0x58ae('0x66')]?_[_0x58ae('0x65')](_0x42b5d0[_0xdafe18[_0xe7e4d6][_0x58ae('0x66')]],'%s',_0x2abdee):_0x2abdee;if(_0xdafe18[_0xe7e4d6][_0x58ae('0x67')]){_0x14cd25[_0x58ae('0x56')](_0x2abdee);}_0xdafe18[_0xe7e4d6][_0x58ae('0x68')]&&_0x14cd25[_0x58ae('0x32')](_0x2abdee,_0xdafe18[_0xe7e4d6][_0x58ae('0x68')]==='DESC'?![]:!![]);_0x14cd25[_0x58ae('0x57')](_0x2abdee,_0xdafe18[_0xe7e4d6]['alias']||_0x2abdee);}if(_0x407555[_0x58ae('0x69')]){_0x407555[_0x58ae('0x69')]=JSON['parse'](_0x407555['joins']);for(var _0x3dc5fe=0x0;_0x3dc5fe<_0x407555['joins']['length'];_0x3dc5fe+=0x1){if(_0x407555[_0x58ae('0x69')][_0x3dc5fe][_0x58ae('0x6b')]&&_['includes'](_0x347edc,_0x407555[_0x58ae('0x69')][_0x3dc5fe][_0x58ae('0x6b')])&&_0x407555['joins'][_0x3dc5fe][_0x58ae('0x6d')]&&_0x407555[_0x58ae('0x69')][_0x3dc5fe]['foreignTable']&&_0x407555[_0x58ae('0x69')][_0x3dc5fe][_0x58ae('0x6f')]){_0x14cd25[_0x407555[_0x58ae('0x69')][_0x3dc5fe]['type']](_0x407555[_0x58ae('0x69')][_0x3dc5fe][_0x58ae('0x6e')],null,util[_0x58ae('0x66')](_0x58ae('0x70'),_0x407555['table'],_0x407555[_0x58ae('0x69')][_0x3dc5fe]['parentKey'],_0x407555[_0x58ae('0x69')][_0x3dc5fe]['foreignTable'],_0x407555[_0x58ae('0x69')][_0x3dc5fe][_0x58ae('0x6f')]));}}}if(_0x407555[_0x58ae('0x71')]){_0x407555[_0x58ae('0x71')]=JSON[_0x58ae('0x6a')](_0x407555['conditions']);_0x14cd25[_0x58ae('0x34')](_0x7bbb53(_0x407555['conditions'][_0x58ae('0x56')]));}_0x5941df=_0x14cd25[_0x58ae('0x80')]();_0x14cd25[_0x58ae('0x18')](_0x18b9c7);_0x14cd25['offset'](0x0);logger[_0x58ae('0x72')](_0x58ae('0x73'),_0x14cd25[_0x58ae('0x75')]());return db[_0x58ae('0x74')][_0x58ae('0x28')](_0x14cd25[_0x58ae('0x75')](),{'type':db[_0x58ae('0x74')][_0x58ae('0x76')][_0x58ae('0x81')]});}})['then'](function(_0x3cada3){if(!_0x3cada3[_0x58ae('0x2f')]){throw new db['Sequelize'][(_0x58ae('0x5b'))]('No\x20Data!');}if(_0x365340['output']===_0x58ae('0x82')){return null;}var _0x2e8758=_[_0x58ae('0x39')](_0x365340,{'name':_0x365340[_0x58ae('0x83')]||_0x365340[_0x58ae('0x22')]||_0x407555['name'],'basename':_0x5b3dfc,'savename':util[_0x58ae('0x66')]('%s-%s.%s',_0x365340[_0x58ae('0x22')]||_0x407555[_0x58ae('0x22')],require(_0x58ae('0x84'))[_0x58ae('0x85')](0x4),_0x365340['output']||_0x58ae('0x86'))});return db[_0x58ae('0x87')][_0x58ae('0x42')](_0x2e8758,{'raw':!![]});})[_0x58ae('0x1e')](function(_0x161fea){_0x5941df[_0x58ae('0x34')](_0x407555['table']+_0x58ae('0x88'),_0x365340[_0x58ae('0x89')],_0x365340['endDate']);if(_0x161fea){logger['info'](_0x58ae('0x8a'),_0x5941df['toString']());require(_0x58ae('0x8b'))[_0x58ae('0x8c')](path[_0x58ae('0x45')](__dirname,_0x58ae('0x8d'),_0x161fea[_0x58ae('0x8e')]),[_0x161fea['id'],_0x5941df['toString'](),path[_0x58ae('0x45')](__dirname,_0x58ae('0x8f'),_0x161fea[_0x58ae('0x90')]),_0x5b3dfc]);return _0x161fea;}else{var _0x44307f=squel['select']();_0x44307f[_0x58ae('0x7f')]('('+_0x5941df[_0x58ae('0x75')]()+')',_0x58ae('0x91'));_0x44307f['field'](_0x58ae('0x92'),_0x58ae('0x16'));_0x5941df[_0x58ae('0x18')](_0x365340[_0x58ae('0x18')]||_0x18b9c7);_0x5941df[_0x58ae('0x17')](_0x365340[_0x58ae('0x17')]||0x0);return db['sequelize']['query'](_0x44307f['toString'](),{'type':db[_0x58ae('0x74')][_0x58ae('0x76')][_0x58ae('0x81')]})[_0x58ae('0x1e')](function(_0x34d55a){if(!_0x34d55a['length']){_0x5ac317=0x0;}else{_0x5ac317=_0x34d55a[0x0][_0x58ae('0x16')]||0x0;}return db['sequelize']['query'](_0x5941df['toString'](),{'type':db[_0x58ae('0x74')]['QueryTypes']['SELECT']});})[_0x58ae('0x1e')](function(_0x4ae83a){return{'rows':_0x4ae83a||[],'count':_0x5ac317};});}});}exports[_0x58ae('0x93')]=function(_0xa30fd,_0x34ed30){return runReport(_0xa30fd['params'],_0xa30fd['query'],_0xa30fd[_0x58ae('0x3a')])[_0x58ae('0x1e')](respondWithResult(_0x34ed30,null))[_0x58ae('0x3e')](handleError(_0x34ed30,null));};exports[_0x58ae('0x94')]=runReport;exports['query']=function(_0x3b04f5,_0xae4db9){var _0x327cac=0xa;var _0x285e87=[_0x58ae('0x45'),_0x58ae('0x77'),_0x58ae('0x78'),'outer_join',_0x58ae('0x46')];var _0x221bd4={'SUM':_0x58ae('0x7a'),'COUNT':_0x58ae('0x7b'),'COUNT DISTINCT':_0x58ae('0x47'),'MAX':_0x58ae('0x48'),'MIN':_0x58ae('0x49'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x58ae('0x4a'),'GROUP_CONCAT ASC':_0x58ae('0x4b'),'GROUP_CONCAT DESC':_0x58ae('0x7d')};var _0x391087={'SEC_TO_TIME':_0x58ae('0x4c'),'DATE':_0x58ae('0x7e'),'HOUR':_0x58ae('0x4d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x8b51ad=function(_0x4beb50){return!_[_0x58ae('0x6c')]([_0x58ae('0x50'),_0x58ae('0x51'),_0x58ae('0x52'),_0x58ae('0x53')],_0x4beb50);};var _0x590752=function(_0x767bd0){if(!_0x767bd0||!_0x767bd0['rules'][_0x58ae('0x2f')]){return'';}for(var _0x1a1e70='(',_0xfc0cc9=0x0;_0xfc0cc9<_0x767bd0[_0x58ae('0x54')][_0x58ae('0x2f')];_0xfc0cc9+=0x1){_0xfc0cc9>0x0&&(_0x1a1e70+='\x20'+_0x767bd0[_0x58ae('0x55')]+'\x20');_0x1a1e70+=_0x767bd0[_0x58ae('0x54')][_0xfc0cc9][_0x58ae('0x56')]?_0x590752(_0x767bd0[_0x58ae('0x54')][_0xfc0cc9][_0x58ae('0x56')]):_0x767bd0['rules'][_0xfc0cc9][_0x58ae('0x57')]+'\x20'+_0x767bd0[_0x58ae('0x54')][_0xfc0cc9][_0x58ae('0x95')]+(_0x8b51ad(_0x767bd0[_0x58ae('0x54')][_0xfc0cc9]['condition'])?'\x20'+_0x767bd0['rules'][_0xfc0cc9][_0x58ae('0x58')]:'');}return _0x1a1e70+')';};var _0x2a4e06={'where':{'id':_0x3b04f5[_0x58ae('0x3f')]['id']}},_0x1cad78,_0x2970cf,_0x4946cb,_0x52e61a,_0x39d879;_0x2a4e06=_[_0x58ae('0x39')]({},_0x2a4e06,_0x3b04f5[_0x58ae('0x3a')]);return db[_0x58ae('0x3b')][_0x58ae('0x41')](_0x2a4e06)['then'](function(_0x2c0fcf){if(_0x2c0fcf){_0x1cad78=_0x2c0fcf;return _0x2c0fcf[_0x58ae('0x59')]();}return null;})[_0x58ae('0x1e')](function(_0x4c65b7){if(_0x4c65b7){if(!_0x4c65b7[_0x58ae('0x2f')]){throw new db[(_0x58ae('0x5a'))][(_0x58ae('0x5b'))](_0x58ae('0x5c'));}_0x2970cf=_0x4c65b7;return db[_0x58ae('0x5d')][_0x58ae('0x5e')]({'raw':!![]});}return null;})[_0x58ae('0x1e')](function(_0x142c5d){if(_0x142c5d){_0x4946cb=_[_0x58ae('0x5f')](_0x142c5d,'id');var _0x3f415f;var _0x396386=squel[_0x58ae('0x60')]();_0x396386[_0x58ae('0x7f')](_0x1cad78[_0x58ae('0x61')]);for(var _0x230914=0x0;_0x230914<_0x2970cf[_0x58ae('0x2f')];_0x230914+=0x1){_0x3f415f=_0x2970cf[_0x230914]['MetricId']?_0x4946cb[_0x2970cf[_0x230914][_0x58ae('0x62')]][_0x58ae('0x63')]:_0x2970cf[_0x230914][_0x58ae('0x57')];_0x3f415f=_0x2970cf[_0x230914]['function']?_['replace'](_0x221bd4[_0x2970cf[_0x230914][_0x58ae('0x64')]],'%s',_0x3f415f):_0x3f415f;_0x3f415f=_0x2970cf[_0x230914][_0x58ae('0x66')]?_[_0x58ae('0x65')](_0x391087[_0x2970cf[_0x230914]['format']],'%s',_0x3f415f):_0x3f415f;if(_0x2970cf[_0x230914][_0x58ae('0x67')]){_0x396386[_0x58ae('0x56')](_0x3f415f);}_0x2970cf[_0x230914]['orderBy']&&_0x396386[_0x58ae('0x32')](_0x3f415f,_0x2970cf[_0x230914]['orderBy']===_0x58ae('0x96')?![]:!![]);_0x396386[_0x58ae('0x57')](_0x3f415f,_0x2970cf[_0x230914][_0x58ae('0x97')]||_0x3f415f);}if(_0x1cad78[_0x58ae('0x69')]){_0x1cad78[_0x58ae('0x69')]=JSON[_0x58ae('0x6a')](_0x1cad78[_0x58ae('0x69')]);for(var _0x744243=0x0;_0x744243<_0x1cad78[_0x58ae('0x69')][_0x58ae('0x2f')];_0x744243+=0x1){if(_0x1cad78[_0x58ae('0x69')][_0x744243][_0x58ae('0x6b')]&&_['includes'](_0x285e87,_0x1cad78['joins'][_0x744243][_0x58ae('0x6b')])&&_0x1cad78[_0x58ae('0x69')][_0x744243][_0x58ae('0x6d')]&&_0x1cad78[_0x58ae('0x69')][_0x744243]['foreignTable']&&_0x1cad78['joins'][_0x744243][_0x58ae('0x6f')]){_0x396386[_0x1cad78[_0x58ae('0x69')][_0x744243][_0x58ae('0x6b')]](_0x1cad78[_0x58ae('0x69')][_0x744243][_0x58ae('0x6e')],null,util[_0x58ae('0x66')](_0x58ae('0x70'),_0x1cad78[_0x58ae('0x61')],_0x1cad78[_0x58ae('0x69')][_0x744243][_0x58ae('0x6d')],_0x1cad78[_0x58ae('0x69')][_0x744243]['foreignTable'],_0x1cad78['joins'][_0x744243][_0x58ae('0x6f')]));}}}if(_0x1cad78[_0x58ae('0x71')]){_0x1cad78[_0x58ae('0x71')]=JSON[_0x58ae('0x6a')](_0x1cad78['conditions']);_0x396386['where'](_0x590752(_0x1cad78[_0x58ae('0x71')][_0x58ae('0x56')]));}_0x39d879=_0x396386[_0x58ae('0x80')]();_0x396386[_0x58ae('0x18')](_0x327cac);_0x396386[_0x58ae('0x17')](0x0);logger['debug'](_0x58ae('0x73'),_0x396386[_0x58ae('0x75')]());return db[_0x58ae('0x74')][_0x58ae('0x28')](_0x396386['toString'](),{'type':db['sequelize'][_0x58ae('0x76')][_0x58ae('0x81')]});}})[_0x58ae('0x1e')](function(){return{'sql':_0x39d879[_0x58ae('0x75')]()};})['then'](respondWithResult(_0xae4db9,null))['catch'](handleError(_0xae4db9,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9c3a612..a6b95d2 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 _0x1a13=['bluebird','request-promise','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment'];(function(_0x3fdcee,_0x17dbfe){var _0x4a5788=function(_0x2030aa){while(--_0x2030aa){_0x3fdcee['push'](_0x3fdcee['shift']());}};_0x4a5788(++_0x17dbfe);}(_0x1a13,0xc4));var _0x31a1=function(_0x1ba697,_0x186781){_0x1ba697=_0x1ba697-0x0;var _0x433b23=_0x1a13[_0x1ba697];return _0x433b23;};'use strict';var _=require(_0x31a1('0x0'));var util=require(_0x31a1('0x1'));var logger=require('../../config/logger')(_0x31a1('0x2'));var moment=require(_0x31a1('0x3'));var BPromise=require(_0x31a1('0x4'));var rp=require(_0x31a1('0x5'));var attributes=require(_0x31a1('0x6'));module[_0x31a1('0x7')]=function(_0x79bd57,_0xd8cdeb){return _0x79bd57['define'](_0x31a1('0x8'),attributes,{'tableName':_0x31a1('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd0=['AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','bluebird','./analyticCustomReport.attributes','exports'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xecd0,0xda));var _0x0ecd=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0xecd0[_0x47a12a];return _0x30cd40;};'use strict';var _=require(_0x0ecd('0x0'));var util=require(_0x0ecd('0x1'));var logger=require(_0x0ecd('0x2'))(_0x0ecd('0x3'));var moment=require('moment');var BPromise=require(_0x0ecd('0x4'));var rp=require('request-promise');var attributes=require(_0x0ecd('0x5'));module[_0x0ecd('0x6')]=function(_0x4e8045,_0x522d5a){return _0x4e8045['define'](_0x0ecd('0x7'),attributes,{'tableName':_0x0ecd('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 98dc117..3c79e0d 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 _0x29ac=['../../config/environment','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','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x104415,_0x4648a7){var _0x4c81ab=function(_0x5c7006){while(--_0x5c7006){_0x104415['push'](_0x104415['shift']());}};_0x4c81ab(++_0x4648a7);}(_0x29ac,0x1b1));var _0xc29a=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x29ac[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xc29a('0x0'));var util=require(_0xc29a('0x1'));var moment=require(_0xc29a('0x2'));var BPromise=require(_0xc29a('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xc29a('0x4'))['db'];var utils=require(_0xc29a('0x5'));var logger=require(_0xc29a('0x6'))('rpc');var config=require(_0xc29a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc29a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d76d4,_0x3b7669,_0x1dc3c0){return new BPromise(function(_0x548cb8,_0x112ac8){return client[_0xc29a('0x9')](_0x3d76d4,_0x1dc3c0)[_0xc29a('0xa')](function(_0x5a2a31){logger[_0xc29a('0xb')](_0xc29a('0xc'),_0x3b7669,_0xc29a('0xd'));logger[_0xc29a('0xe')](_0xc29a('0xf'),_0x3b7669,_0xc29a('0xd'),JSON[_0xc29a('0x10')](_0x5a2a31));if(_0x5a2a31[_0xc29a('0x11')]){if(_0x5a2a31['error'][_0xc29a('0x12')]===0x1f4){logger[_0xc29a('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3b7669,_0x5a2a31['error']['message']);return _0x112ac8(_0x5a2a31[_0xc29a('0x11')][_0xc29a('0x13')]);}logger[_0xc29a('0x11')](_0xc29a('0xc'),_0x3b7669,_0x5a2a31['error'][_0xc29a('0x13')]);return _0x548cb8(_0x5a2a31[_0xc29a('0x11')][_0xc29a('0x13')]);}else{logger[_0xc29a('0xb')](_0xc29a('0xc'),_0x3b7669,_0xc29a('0xd'));_0x548cb8(_0x5a2a31[_0xc29a('0x14')]['message']);}})[_0xc29a('0x15')](function(_0x5b36f3){logger[_0xc29a('0x11')](_0xc29a('0xc'),_0x3b7669,_0x5b36f3);_0x112ac8(_0x5b36f3);});});} \ No newline at end of file +var _0xaf74=['info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x24591f,_0x2b14a){var _0x5de3de=function(_0x48a1d0){while(--_0x48a1d0){_0x24591f['push'](_0x24591f['shift']());}};_0x5de3de(++_0x2b14a);}(_0xaf74,0x1ac));var _0x4af7=function(_0x28f1b1,_0x415846){_0x28f1b1=_0x28f1b1-0x0;var _0x3d149c=_0xaf74[_0x28f1b1];return _0x3d149c;};'use strict';var _=require(_0x4af7('0x0'));var util=require(_0x4af7('0x1'));var moment=require(_0x4af7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x4af7('0x3'));var logger=require(_0x4af7('0x4'))(_0x4af7('0x5'));var config=require(_0x4af7('0x6'));var jayson=require(_0x4af7('0x7'));var client=jayson[_0x4af7('0x8')][_0x4af7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ca32,_0x42b34f,_0xc45d8e){return new BPromise(function(_0x4e52ee,_0x23ff7a){return client[_0x4af7('0xa')](_0x23ca32,_0xc45d8e)[_0x4af7('0xb')](function(_0x15a4c1){logger[_0x4af7('0xc')](_0x4af7('0xd'),_0x42b34f,'request\x20sent');logger[_0x4af7('0xe')](_0x4af7('0xf'),_0x42b34f,'request\x20sent',JSON['stringify'](_0x15a4c1));if(_0x15a4c1[_0x4af7('0x10')]){if(_0x15a4c1[_0x4af7('0x10')][_0x4af7('0x11')]===0x1f4){logger[_0x4af7('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x42b34f,_0x15a4c1[_0x4af7('0x10')][_0x4af7('0x12')]);return _0x23ff7a(_0x15a4c1[_0x4af7('0x10')]['message']);}logger[_0x4af7('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x42b34f,_0x15a4c1['error'][_0x4af7('0x12')]);return _0x4e52ee(_0x15a4c1[_0x4af7('0x10')]['message']);}else{logger[_0x4af7('0xc')](_0x4af7('0xd'),_0x42b34f,'request\x20sent');_0x4e52ee(_0x15a4c1[_0x4af7('0x13')][_0x4af7('0x12')]);}})['catch'](function(_0x5f10a0){logger[_0x4af7('0x10')](_0x4af7('0xd'),_0x42b34f,_0x5f10a0);_0x23ff7a(_0x5f10a0);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 820a3df..16bf7c3 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 _0xa8a6=['../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xa8a6,0x187));var _0x6a8a=function(_0x5bb710,_0x2f29f4){_0x5bb710=_0x5bb710-0x0;var _0x40ed91=_0xa8a6[_0x5bb710];return _0x40ed91;};'use strict';var multer=require(_0x6a8a('0x0'));var util=require(_0x6a8a('0x1'));var path=require(_0x6a8a('0x2'));var express=require('express');var router=express[_0x6a8a('0x3')]();var auth=require(_0x6a8a('0x4'));var interaction=require(_0x6a8a('0x5'));var config=require('../../config/environment');var controller=require(_0x6a8a('0x6'));router[_0x6a8a('0x7')]('/',auth[_0x6a8a('0x8')](),controller['index']);router[_0x6a8a('0x7')](_0x6a8a('0x9'),auth[_0x6a8a('0x8')](),controller['show']);router[_0x6a8a('0x7')](_0x6a8a('0xa'),auth[_0x6a8a('0x8')](),controller[_0x6a8a('0xb')]);router['get'](_0x6a8a('0xc'),auth['isAuthenticated'](),controller[_0x6a8a('0xd')]);router[_0x6a8a('0x7')](_0x6a8a('0xe'),auth[_0x6a8a('0x8')](),controller[_0x6a8a('0xf')]);router['post']('/',auth[_0x6a8a('0x8')](),controller[_0x6a8a('0x10')]);router[_0x6a8a('0x11')](_0x6a8a('0x9'),auth[_0x6a8a('0x8')](),controller[_0x6a8a('0x12')]);router[_0x6a8a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6a8a('0x14')]);module[_0x6a8a('0x15')]=router; \ No newline at end of file +var _0x2921=['multer','util','path','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2921,0x19e));var _0x1292=function(_0x993d3d,_0x26d9c8){_0x993d3d=_0x993d3d-0x0;var _0x34bf5a=_0x2921[_0x993d3d];return _0x34bf5a;};'use strict';var multer=require(_0x1292('0x0'));var util=require(_0x1292('0x1'));var path=require(_0x1292('0x2'));var express=require('express');var router=express[_0x1292('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1292('0x4'));var config=require(_0x1292('0x5'));var controller=require(_0x1292('0x6'));router[_0x1292('0x7')]('/',auth[_0x1292('0x8')](),controller[_0x1292('0x9')]);router['get'](_0x1292('0xa'),auth[_0x1292('0x8')](),controller['show']);router[_0x1292('0x7')](_0x1292('0xb'),auth[_0x1292('0x8')](),controller['preview']);router[_0x1292('0x7')](_0x1292('0xc'),auth[_0x1292('0x8')](),controller[_0x1292('0xd')]);router[_0x1292('0x7')](_0x1292('0xe'),auth['isAuthenticated'](),controller[_0x1292('0xf')]);router[_0x1292('0x10')]('/',auth['isAuthenticated'](),controller[_0x1292('0x11')]);router[_0x1292('0x12')](_0x1292('0xa'),auth[_0x1292('0x8')](),controller[_0x1292('0x13')]);router[_0x1292('0x14')](_0x1292('0xa'),auth[_0x1292('0x8')](),controller[_0x1292('0x15')]);module[_0x1292('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 0c9cc70..bcab668 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 _0x13c4=['TEXT','sequelize','STRING'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x13c4,0xbe));var _0x413c=function(_0xd099b9,_0x1ae821){_0xd099b9=_0xd099b9-0x0;var _0x12a5bb=_0x13c4[_0xd099b9];return _0x12a5bb;};'use strict';var Sequelize=require(_0x413c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x413c('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x413c('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb989=['TEXT','sequelize','STRING'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0xb989,0x14b));var _0x9b98=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0xb989[_0xe4bb3d];return _0xd9e51;};'use strict';var Sequelize=require(_0x9b98('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b98('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x9b98('0x1')]},'conditions':{'type':Sequelize[_0x9b98('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 85051cc..d182e1e 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 _0xb32a=['fields','options','find','create','body','update','preview','join','left_join','right_join','outer_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','keyBy','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','operator','getFields','select','from','groupBy','type','%s.%s\x20=\x20%s.%s','debug','Limited\x20Query:','No\x20Data!','output','web','fullPath','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','COUNT(*)','run','runReport','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','json','apply','reject','then','destroy','name','send','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params'];(function(_0x1e0499,_0x2222ed){var _0x527766=function(_0xac41b8){while(--_0xac41b8){_0x1e0499['push'](_0x1e0499['shift']());}};_0x527766(++_0x2222ed);}(_0xb32a,0xe9));var _0xab32=function(_0x5a2b82,_0x28fb8a){_0x5a2b82=_0x5a2b82-0x0;var _0x39e1dd=_0xb32a[_0x5a2b82];return _0x39e1dd;};'use strict';var jsonpatch=require(_0xab32('0x0'));var rp=require(_0xab32('0x1'));var moment=require('moment');var BPromise=require(_0xab32('0x2'));var Mustache=require('mustache');var util=require(_0xab32('0x3'));var path=require(_0xab32('0x4'));var sox=require('sox');var csv=require(_0xab32('0x5'));var ejs=require(_0xab32('0x6'));var fs=require('fs');var _=require(_0xab32('0x7'));var squel=require(_0xab32('0x8'));var crypto=require(_0xab32('0x9'));var jsforce=require(_0xab32('0xa'));var deskjs=require(_0xab32('0xb'));var toCsv=require(_0xab32('0x5'));var querystring=require(_0xab32('0xc'));var Papa=require(_0xab32('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xab32('0xe'))(_0xab32('0xf'));var utils=require(_0xab32('0x10'));var config=require(_0xab32('0x11'));var db=require(_0xab32('0x12'))['db'];function respondWithStatusCode(_0x188397,_0x4fa54e){_0x4fa54e=_0x4fa54e||0xcc;return function(_0x179678){if(_0x179678){return _0x188397[_0xab32('0x13')](_0x4fa54e);}return _0x188397[_0xab32('0x14')](_0x4fa54e)[_0xab32('0x15')]();};}function respondWithResult(_0x48ed2f,_0x189176){_0x189176=_0x189176||0xc8;return function(_0x2e351e){if(_0x2e351e){return _0x48ed2f[_0xab32('0x14')](_0x189176)['json'](_0x2e351e);}};}function respondWithFilteredResult(_0x449cc0,_0xf8f9ac){return function(_0x130fe3){if(_0x130fe3){var _0x51fc18=_0x130fe3[_0xab32('0x16')],_0x3a8d10=_0xf8f9ac[_0xab32('0x17')],_0x292f20=_0xf8f9ac[_0xab32('0x17')]+_0xf8f9ac['limit'],_0x343705;if(_0x292f20>=_0x51fc18){_0x292f20=_0x51fc18;_0x343705=0xc8;}else{_0x343705=0xce;}_0x449cc0['status'](_0x343705);return _0x449cc0['set']('Content-Range',_0x3a8d10+'-'+_0x292f20+'/'+_0x51fc18)[_0xab32('0x18')](_0x130fe3);}return null;};}function patchUpdates(_0xffe8fa){return function(_0x555883){try{jsonpatch[_0xab32('0x19')](_0x555883,_0xffe8fa,!![]);}catch(_0x43472c){return BPromise[_0xab32('0x1a')](_0x43472c);}return _0x555883['save']();};}function saveUpdates(_0x5ea5c3,_0xd9e1){return function(_0x373e39){if(_0x373e39){return _0x373e39['update'](_0x5ea5c3)[_0xab32('0x1b')](function(_0x4d8e72){return _0x4d8e72;});}return null;};}function removeEntity(_0x34b6e3,_0x1d8198){return function(_0x3e292f){if(_0x3e292f){return _0x3e292f[_0xab32('0x1c')]()['then'](function(){_0x34b6e3[_0xab32('0x14')](0xcc)[_0xab32('0x15')]();});}};}function handleEntityNotFound(_0x5aeb3e,_0x471ce8){return function(_0x282769){if(!_0x282769){_0x5aeb3e['sendStatus'](0x194);}return _0x282769;};}function handleError(_0x5a1c07,_0x32d835){_0x32d835=_0x32d835||0x1f4;return function(_0x5e3cf6){logger['error'](_0x5e3cf6['stack']);if(_0x5e3cf6[_0xab32('0x1d')]){delete _0x5e3cf6[_0xab32('0x1d')];}_0x5a1c07[_0xab32('0x14')](_0x32d835)[_0xab32('0x1e')](_0x5e3cf6);};}exports['index']=function(_0x312aaa,_0x302419){var _0x343a41={},_0x299db3={},_0x596fef={'count':0x0,'rows':[]};var _0x1e30f4=db['AnalyticDefaultReport'][_0xab32('0x1f')];_0x299db3[_0xab32('0x20')]=_[_0xab32('0x21')](_0x1e30f4);var _0x593e1b={'dateStart':_0x312aaa['query'][_0xab32('0x22')],'dateEnd':_0x312aaa['query']['dateEnd']};delete _0x312aaa[_0xab32('0x23')][_0xab32('0x22')];delete _0x312aaa[_0xab32('0x23')][_0xab32('0x24')];_0x299db3[_0xab32('0x23')]=_[_0xab32('0x21')](_0x312aaa['query']);_0x299db3[_0xab32('0x25')]=_[_0xab32('0x26')](_0x299db3[_0xab32('0x20')],_0x299db3['query']);_0x343a41[_0xab32('0x27')]=_[_0xab32('0x26')](_0x299db3[_0xab32('0x20')],qs['fields'](_0x312aaa[_0xab32('0x23')]['fields']));_0x343a41['attributes']=_0x343a41[_0xab32('0x27')][_0xab32('0x28')]?_0x343a41[_0xab32('0x27')]:_0x299db3['model'];if(!_0x312aaa[_0xab32('0x23')][_0xab32('0x29')](_0xab32('0x2a'))){_0x343a41[_0xab32('0x2b')]=qs['limit'](_0x312aaa[_0xab32('0x23')][_0xab32('0x2b')]);_0x343a41[_0xab32('0x17')]=qs[_0xab32('0x17')](_0x312aaa[_0xab32('0x23')][_0xab32('0x17')]);}_0x343a41[_0xab32('0x2c')]=qs[_0xab32('0x2d')](_0x312aaa[_0xab32('0x23')][_0xab32('0x2d')]);_0x343a41[_0xab32('0x2e')]=qs[_0xab32('0x25')](_[_0xab32('0x2f')](_0x312aaa[_0xab32('0x23')],_0x299db3['filters']));if(_0x593e1b[_0xab32('0x22')]){if(_0x593e1b['dateEnd']){_0x593e1b['dateEnd']=moment(_0x593e1b[_0xab32('0x24')])[_0xab32('0x30')](0x1,_0xab32('0x31'));}else{_0x593e1b[_0xab32('0x24')]=moment(_0x593e1b[_0xab32('0x22')])[_0xab32('0x30')](0x1,_0xab32('0x31'));}_[_0xab32('0x32')](_0x343a41['where'],{'createdAt':{'$gte':_0x593e1b[_0xab32('0x22')],'$lte':_0x593e1b[_0xab32('0x24')]}});}if(_0x312aaa[_0xab32('0x23')][_0xab32('0x33')]){_0x343a41[_0xab32('0x2e')]=_[_0xab32('0x32')](_0x343a41[_0xab32('0x2e')],{'$or':_[_0xab32('0x34')](_0x343a41[_0xab32('0x27')],function(_0x3e6706){var _0x595765={};_0x595765[_0x3e6706]={'$like':'%'+_0x312aaa['query'][_0xab32('0x33')]+'%'};return _0x595765;})});}_0x343a41=_[_0xab32('0x32')]({},_0x343a41,_0x312aaa['options']);var _0x47d79f={'where':_0x343a41['where']};return db[_0xab32('0x35')][_0xab32('0x16')](_0x47d79f)[_0xab32('0x1b')](function(_0x3f0020){_0x596fef[_0xab32('0x16')]=_0x3f0020;if(_0x312aaa[_0xab32('0x23')][_0xab32('0x36')]){_0x343a41[_0xab32('0x37')]=[{'all':!![]}];}return db[_0xab32('0x35')][_0xab32('0x38')](_0x343a41);})[_0xab32('0x1b')](function(_0x5d836c){_0x596fef[_0xab32('0x39')]=_0x5d836c;return _0x596fef;})['then'](respondWithFilteredResult(_0x302419,_0x343a41))[_0xab32('0x3a')](handleError(_0x302419,null));};exports[_0xab32('0x3b')]=function(_0x5b82dc,_0x2231fa){var _0x5bf4a1={'raw':!![],'where':{'id':_0x5b82dc[_0xab32('0x3c')]['id']}},_0x51c090={};_0x51c090[_0xab32('0x20')]=_[_0xab32('0x21')](db[_0xab32('0x35')]['rawAttributes']);_0x51c090[_0xab32('0x23')]=_[_0xab32('0x21')](_0x5b82dc[_0xab32('0x23')]);_0x51c090['filters']=_[_0xab32('0x26')](_0x51c090[_0xab32('0x20')],_0x51c090[_0xab32('0x23')]);_0x5bf4a1[_0xab32('0x27')]=_[_0xab32('0x26')](_0x51c090['model'],qs[_0xab32('0x3d')](_0x5b82dc[_0xab32('0x23')][_0xab32('0x3d')]));_0x5bf4a1['attributes']=_0x5bf4a1['attributes']['length']?_0x5bf4a1['attributes']:_0x51c090['model'];if(_0x5b82dc['query'][_0xab32('0x36')]){_0x5bf4a1[_0xab32('0x37')]=[{'all':!![]}];}_0x5bf4a1=_[_0xab32('0x32')]({},_0x5bf4a1,_0x5b82dc[_0xab32('0x3e')]);return db['AnalyticDefaultReport'][_0xab32('0x3f')](_0x5bf4a1)['then'](handleEntityNotFound(_0x2231fa,null))[_0xab32('0x1b')](respondWithResult(_0x2231fa,null))[_0xab32('0x3a')](handleError(_0x2231fa,null));};exports[_0xab32('0x40')]=function(_0x227001,_0x5a74c4){return db['AnalyticDefaultReport'][_0xab32('0x40')](_0x227001[_0xab32('0x41')],{})[_0xab32('0x1b')](respondWithResult(_0x5a74c4,0xc9))[_0xab32('0x3a')](handleError(_0x5a74c4,null));};exports[_0xab32('0x42')]=function(_0xb5f17b,_0x3c1114){if(_0xb5f17b[_0xab32('0x41')]['id']){delete _0xb5f17b['body']['id'];}return db[_0xab32('0x35')][_0xab32('0x3f')]({'where':{'id':_0xb5f17b[_0xab32('0x3c')]['id']}})[_0xab32('0x1b')](handleEntityNotFound(_0x3c1114,null))[_0xab32('0x1b')](saveUpdates(_0xb5f17b['body'],null))['then'](respondWithResult(_0x3c1114,null))[_0xab32('0x3a')](handleError(_0x3c1114,null));};exports[_0xab32('0x1c')]=function(_0x555cf3,_0x164de1){return db[_0xab32('0x35')]['find']({'where':{'id':_0x555cf3[_0xab32('0x3c')]['id']}})[_0xab32('0x1b')](handleEntityNotFound(_0x164de1,null))[_0xab32('0x1b')](removeEntity(_0x164de1,null))[_0xab32('0x3a')](handleError(_0x164de1,null));};exports[_0xab32('0x43')]=function(_0x27349d,_0x394a5d){var _0x156b84=0xa;var _0x1c5b95=[_0xab32('0x44'),_0xab32('0x45'),_0xab32('0x46'),_0xab32('0x47'),_0xab32('0x48')];var _0xe778ee={'SUM':_0xab32('0x49'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xab32('0x4a'),'MIN':_0xab32('0x4b'),'AVG':_0xab32('0x4c'),'GROUP_CONCAT':_0xab32('0x4d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x44d579={'SEC_TO_TIME':_0xab32('0x4e'),'DATE':'DATE(%s)','HOUR':_0xab32('0x4f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd2313=function(_0x5e2c0e){return!_['includes']([_0xab32('0x50'),'IS\x20NOT\x20NULL',_0xab32('0x51'),_0xab32('0x52')],_0x5e2c0e);};var _0x4a0918=function(_0x565563){if(!_0x565563||!_0x565563[_0xab32('0x53')][_0xab32('0x28')]){return'';}for(var _0x33fee7='(',_0x227abc=0x0;_0x227abc<_0x565563[_0xab32('0x53')][_0xab32('0x28')];_0x227abc+=0x1){_0x227abc>0x0&&(_0x33fee7+='\x20'+_0x565563['operator']+'\x20');_0x33fee7+=_0x565563[_0xab32('0x53')][_0x227abc][_0xab32('0x54')]?_0x4a0918(_0x565563[_0xab32('0x53')][_0x227abc]['group']):_0x565563['rules'][_0x227abc][_0xab32('0x55')]+'\x20'+_0x565563[_0xab32('0x53')][_0x227abc][_0xab32('0x56')]+(_0xd2313(_0x565563[_0xab32('0x53')][_0x227abc][_0xab32('0x56')])?'\x20'+_0x565563[_0xab32('0x53')][_0x227abc][_0xab32('0x57')]:'');}return _0x33fee7+')';};var _0x27760d={'where':{'id':_0x27349d['params']['id']}},_0x3e28e0,_0x3be6d3,_0x4e8418,_0x4a999d,_0x2387db;_0x27760d=_[_0xab32('0x32')]({},_0x27760d,_0x27349d[_0xab32('0x3e')]);return db['AnalyticDefaultReport'][_0xab32('0x3f')](_0x27760d)[_0xab32('0x1b')](function(_0x5adf4b){if(_0x5adf4b){_0x3e28e0=_0x5adf4b;return _0x5adf4b['getFields']();}return null;})[_0xab32('0x1b')](function(_0x16378b){if(_0x16378b){if(!_0x16378b[_0xab32('0x28')]){throw new db[(_0xab32('0x58'))][(_0xab32('0x59'))](_0xab32('0x5a'));}_0x3be6d3=_0x16378b;return db[_0xab32('0x5b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0xd2b047){if(_0xd2b047){_0x4e8418=_[_0xab32('0x5c')](_0xd2b047,'id');var _0x583b26;var _0x21a6b3=squel['select']();_0x21a6b3['from'](_0x3e28e0[_0xab32('0x5d')]);for(var _0x4b42c5=0x0;_0x4b42c5<_0x3be6d3['length'];_0x4b42c5+=0x1){_0x583b26=_0x3be6d3[_0x4b42c5][_0xab32('0x5e')]?_0x4e8418[_0x3be6d3[_0x4b42c5][_0xab32('0x5e')]][_0xab32('0x5f')]:_0x3be6d3[_0x4b42c5][_0xab32('0x55')];_0x583b26=_0x3be6d3[_0x4b42c5][_0xab32('0x60')]?_['replace'](_0xe778ee[_0x3be6d3[_0x4b42c5][_0xab32('0x60')]],'%s',_0x583b26):_0x583b26;_0x583b26=_0x3be6d3[_0x4b42c5]['format']?_[_0xab32('0x61')](_0x44d579[_0x3be6d3[_0x4b42c5][_0xab32('0x62')]],'%s',_0x583b26):_0x583b26;if(_0x3be6d3[_0x4b42c5]['groupBy']){_0x21a6b3[_0xab32('0x54')](_0x583b26);}_0x3be6d3[_0x4b42c5]['orderBy']&&_0x21a6b3['order'](_0x583b26,_0x3be6d3[_0x4b42c5][_0xab32('0x63')]===_0xab32('0x64')?![]:!![]);_0x21a6b3[_0xab32('0x55')](_0x583b26,_0x3be6d3[_0x4b42c5][_0xab32('0x65')]||_0x583b26);}if(_0x3e28e0[_0xab32('0x66')]){_0x3e28e0[_0xab32('0x66')]=JSON[_0xab32('0x67')](_0x3e28e0[_0xab32('0x66')]);for(var _0x68a6ae=0x0;_0x68a6ae<_0x3e28e0[_0xab32('0x66')][_0xab32('0x28')];_0x68a6ae+=0x1){if(_0x3e28e0['joins'][_0x68a6ae]['type']&&_['includes'](_0x1c5b95,_0x3e28e0['joins'][_0x68a6ae]['type'])&&_0x3e28e0[_0xab32('0x66')][_0x68a6ae][_0xab32('0x68')]&&_0x3e28e0[_0xab32('0x66')][_0x68a6ae][_0xab32('0x69')]&&_0x3e28e0['joins'][_0x68a6ae][_0xab32('0x6a')]){_0x21a6b3[_0x3e28e0[_0xab32('0x66')][_0x68a6ae]['type']](_0x3e28e0[_0xab32('0x66')][_0x68a6ae][_0xab32('0x69')],null,util[_0xab32('0x62')]('%s.%s\x20=\x20%s.%s',_0x3e28e0['table'],_0x3e28e0[_0xab32('0x66')][_0x68a6ae][_0xab32('0x68')],_0x3e28e0[_0xab32('0x66')][_0x68a6ae][_0xab32('0x69')],_0x3e28e0['joins'][_0x68a6ae]['foreignKey']));}}}if(_0x3e28e0[_0xab32('0x6b')]){_0x3e28e0[_0xab32('0x6b')]=JSON[_0xab32('0x67')](_0x3e28e0[_0xab32('0x6b')]);_0x21a6b3[_0xab32('0x2e')](_0x4a0918(_0x3e28e0[_0xab32('0x6b')]['group']));}_0x2387db=_0x21a6b3[_0xab32('0x6c')]();_0x21a6b3['limit'](_0x156b84);_0x21a6b3[_0xab32('0x17')](0x0);logger['debug']('Limited\x20Query:',_0x21a6b3[_0xab32('0x6d')]());return db['sequelize'][_0xab32('0x23')](_0x21a6b3[_0xab32('0x6d')](),{'type':db[_0xab32('0x6e')][_0xab32('0x6f')][_0xab32('0x70')]});}})[_0xab32('0x1b')](respondWithResult(_0x394a5d,null))[_0xab32('0x3a')](handleError(_0x394a5d,null));};function runReport(_0x522879,_0x22a7f8,_0x3c6639){var _0x50a8e5=_0x22a7f8[_0xab32('0x1d')];var _0x188e5d=0xa;var _0x48b67f=[_0xab32('0x44'),_0xab32('0x45'),_0xab32('0x46'),_0xab32('0x47'),_0xab32('0x48')];var _0x40cb5b={'SUM':'SUM(%s)','COUNT':_0xab32('0x71'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xab32('0x4b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xab32('0x4d'),'GROUP_CONCAT ASC':_0xab32('0x72'),'GROUP_CONCAT DESC':_0xab32('0x73')};var _0x5457da={'SEC_TO_TIME':_0xab32('0x4e'),'DATE':_0xab32('0x74'),'HOUR':_0xab32('0x4f'),'ROUND':_0xab32('0x75'),'UNIX_TIMESTAMP':_0xab32('0x76')};var _0x361463=function(_0x539216){return!_[_0xab32('0x77')]([_0xab32('0x50'),'IS\x20NOT\x20NULL',_0xab32('0x51'),_0xab32('0x52')],_0x539216);};var _0x48c63b=function(_0x29d817){if(!_0x29d817||!_0x29d817['rules']['length']){return'';}for(var _0x5e53ca='(',_0x139d94=0x0;_0x139d94<_0x29d817[_0xab32('0x53')]['length'];_0x139d94+=0x1){_0x139d94>0x0&&(_0x5e53ca+='\x20'+_0x29d817[_0xab32('0x78')]+'\x20');_0x5e53ca+=_0x29d817[_0xab32('0x53')][_0x139d94][_0xab32('0x54')]?_0x48c63b(_0x29d817[_0xab32('0x53')][_0x139d94]['group']):_0x29d817['rules'][_0x139d94]['field']+'\x20'+_0x29d817[_0xab32('0x53')][_0x139d94][_0xab32('0x56')]+(_0x361463(_0x29d817[_0xab32('0x53')][_0x139d94][_0xab32('0x56')])?'\x20'+_0x29d817[_0xab32('0x53')][_0x139d94]['value']:'');}return _0x5e53ca+')';};var _0x1481e1={'where':{'id':_0x522879['id']}},_0x140e44,_0x2941b9,_0x9d888e,_0x1dda8c,_0x1e5c45;_0x1481e1=_[_0xab32('0x32')]({},_0x1481e1,_0x3c6639);return db['AnalyticDefaultReport'][_0xab32('0x3f')](_0x1481e1)['then'](function(_0x2ee40c){if(_0x2ee40c){_0x140e44=_0x2ee40c;return _0x2ee40c[_0xab32('0x79')]();}return null;})[_0xab32('0x1b')](function(_0x349472){if(_0x349472){if(!_0x349472[_0xab32('0x28')]){throw new db[(_0xab32('0x58'))][(_0xab32('0x59'))]('Please\x20insert\x20at\x20least\x20one\x20field!');}_0x2941b9=_0x349472;return db[_0xab32('0x5b')][_0xab32('0x38')]({'raw':!![]});}return null;})[_0xab32('0x1b')](function(_0xf12ba){if(_0xf12ba){_0x9d888e=_[_0xab32('0x5c')](_0xf12ba,'id');var _0x4e6568;var _0x3bed10=squel[_0xab32('0x7a')]();_0x3bed10[_0xab32('0x7b')](_0x140e44[_0xab32('0x5d')]);for(var _0x327858=0x0;_0x327858<_0x2941b9['length'];_0x327858+=0x1){_0x4e6568=_0x2941b9[_0x327858][_0xab32('0x5e')]?_0x9d888e[_0x2941b9[_0x327858][_0xab32('0x5e')]][_0xab32('0x5f')]:_0x2941b9[_0x327858][_0xab32('0x55')];_0x4e6568=_0x2941b9[_0x327858][_0xab32('0x60')]?_['replace'](_0x40cb5b[_0x2941b9[_0x327858][_0xab32('0x60')]],'%s',_0x4e6568):_0x4e6568;_0x4e6568=_0x2941b9[_0x327858]['format']?_['replace'](_0x5457da[_0x2941b9[_0x327858][_0xab32('0x62')]],'%s',_0x4e6568):_0x4e6568;if(_0x2941b9[_0x327858][_0xab32('0x7c')]){_0x3bed10[_0xab32('0x54')](_0x4e6568);}_0x2941b9[_0x327858][_0xab32('0x63')]&&_0x3bed10[_0xab32('0x2c')](_0x4e6568,_0x2941b9[_0x327858][_0xab32('0x63')]===_0xab32('0x64')?![]:!![]);_0x3bed10[_0xab32('0x55')](_0x4e6568,_0x2941b9[_0x327858][_0xab32('0x65')]||_0x4e6568);}if(_0x140e44['joins']){_0x140e44[_0xab32('0x66')]=JSON[_0xab32('0x67')](_0x140e44[_0xab32('0x66')]);for(var _0x4ffd93=0x0;_0x4ffd93<_0x140e44[_0xab32('0x66')][_0xab32('0x28')];_0x4ffd93+=0x1){if(_0x140e44[_0xab32('0x66')][_0x4ffd93][_0xab32('0x7d')]&&_[_0xab32('0x77')](_0x48b67f,_0x140e44[_0xab32('0x66')][_0x4ffd93][_0xab32('0x7d')])&&_0x140e44['joins'][_0x4ffd93][_0xab32('0x68')]&&_0x140e44[_0xab32('0x66')][_0x4ffd93][_0xab32('0x69')]&&_0x140e44[_0xab32('0x66')][_0x4ffd93][_0xab32('0x6a')]){_0x3bed10[_0x140e44['joins'][_0x4ffd93][_0xab32('0x7d')]](_0x140e44[_0xab32('0x66')][_0x4ffd93][_0xab32('0x69')],null,util[_0xab32('0x62')](_0xab32('0x7e'),_0x140e44[_0xab32('0x5d')],_0x140e44[_0xab32('0x66')][_0x4ffd93][_0xab32('0x68')],_0x140e44[_0xab32('0x66')][_0x4ffd93]['foreignTable'],_0x140e44[_0xab32('0x66')][_0x4ffd93]['foreignKey']));}}}if(_0x140e44[_0xab32('0x6b')]){_0x140e44[_0xab32('0x6b')]=JSON['parse'](_0x140e44[_0xab32('0x6b')]);_0x3bed10['where'](_0x48c63b(_0x140e44[_0xab32('0x6b')][_0xab32('0x54')]));}_0x1e5c45=_0x3bed10['clone']();_0x3bed10[_0xab32('0x2b')](_0x188e5d);_0x3bed10[_0xab32('0x17')](0x0);logger[_0xab32('0x7f')](_0xab32('0x80'),_0x3bed10['toString']());return db[_0xab32('0x6e')][_0xab32('0x23')](_0x3bed10[_0xab32('0x6d')](),{'type':db[_0xab32('0x6e')][_0xab32('0x6f')][_0xab32('0x70')]});}})[_0xab32('0x1b')](function(_0x2912a2){if(!_0x2912a2[_0xab32('0x28')]){throw new db[(_0xab32('0x58'))][(_0xab32('0x59'))](_0xab32('0x81'));}if(_0x22a7f8[_0xab32('0x82')]===_0xab32('0x83')){return null;}var _0x55ab6b=_['merge'](_0x22a7f8,{'name':_0x22a7f8[_0xab32('0x84')]||_0x22a7f8[_0xab32('0x1d')]||_0x140e44[_0xab32('0x1d')],'basename':_0x50a8e5,'savename':util[_0xab32('0x62')](_0xab32('0x85'),_0x22a7f8['name']||_0x140e44[_0xab32('0x1d')],require(_0xab32('0x86'))[_0xab32('0x87')](0x4),_0x22a7f8[_0xab32('0x82')]||'csv')});return db[_0xab32('0x88')][_0xab32('0x40')](_0x55ab6b,{'raw':!![]});})[_0xab32('0x1b')](function(_0x6f1d23){_0x1e5c45[_0xab32('0x2e')](_0x140e44[_0xab32('0x5d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x22a7f8[_0xab32('0x89')],_0x22a7f8[_0xab32('0x8a')]);if(_0x6f1d23){logger[_0xab32('0x8b')](_0xab32('0x8c'),_0x1e5c45[_0xab32('0x6d')]());require('child_process')[_0xab32('0x8d')](path['join'](__dirname,_0xab32('0x8e'),_0x6f1d23['output']),[_0x6f1d23['id'],_0x1e5c45['toString'](),path['join'](__dirname,_0xab32('0x8f'),_0x6f1d23['savename']),_0x50a8e5]);return _0x6f1d23;}else{var _0x51cc50=squel[_0xab32('0x7a')]();_0x51cc50[_0xab32('0x7b')]('('+_0x1e5c45[_0xab32('0x6d')]()+')','countTable');_0x51cc50[_0xab32('0x55')](_0xab32('0x90'),_0xab32('0x16'));_0x1e5c45['limit'](_0x22a7f8[_0xab32('0x2b')]||_0x188e5d);_0x1e5c45[_0xab32('0x17')](_0x22a7f8[_0xab32('0x17')]||0x0);return db[_0xab32('0x6e')][_0xab32('0x23')](_0x51cc50[_0xab32('0x6d')](),{'type':db[_0xab32('0x6e')][_0xab32('0x6f')][_0xab32('0x70')]})[_0xab32('0x1b')](function(_0x8fc807){if(!_0x8fc807['length']){_0x1dda8c=0x0;}else{_0x1dda8c=_0x8fc807[0x0][_0xab32('0x16')]||0x0;}return db[_0xab32('0x6e')]['query'](_0x1e5c45[_0xab32('0x6d')](),{'type':db[_0xab32('0x6e')][_0xab32('0x6f')][_0xab32('0x70')]});})[_0xab32('0x1b')](function(_0x25f2be){return{'rows':_0x25f2be||[],'count':_0x1dda8c};});}});}exports[_0xab32('0x91')]=function(_0x3ea8a3,_0x80798e){return runReport(_0x3ea8a3[_0xab32('0x3c')],_0x3ea8a3[_0xab32('0x23')],_0x3ea8a3[_0xab32('0x3e')])[_0xab32('0x1b')](respondWithResult(_0x80798e,null))[_0xab32('0x3a')](handleError(_0x80798e,null));};exports[_0xab32('0x92')]=runReport;exports[_0xab32('0x23')]=function(_0x902339,_0x364eab){var _0x43d08f=0xa;var _0x3ec9aa=[_0xab32('0x44'),_0xab32('0x45'),'right_join',_0xab32('0x47'),_0xab32('0x48')];var _0x2e37ab={'SUM':_0xab32('0x49'),'COUNT':_0xab32('0x71'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xab32('0x4a'),'MIN':'MIN(%s)','AVG':_0xab32('0x4c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xab32('0x72'),'GROUP_CONCAT DESC':_0xab32('0x73')};var _0x4ef35d={'SEC_TO_TIME':_0xab32('0x4e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xab32('0x76')};var _0x522421=function(_0x5fa811){return!_[_0xab32('0x77')]([_0xab32('0x50'),'IS\x20NOT\x20NULL',_0xab32('0x51'),_0xab32('0x52')],_0x5fa811);};var _0x6727cc=function(_0xa9bab0){if(!_0xa9bab0||!_0xa9bab0[_0xab32('0x53')][_0xab32('0x28')]){return'';}for(var _0xeef978='(',_0x51f98d=0x0;_0x51f98d<_0xa9bab0['rules']['length'];_0x51f98d+=0x1){_0x51f98d>0x0&&(_0xeef978+='\x20'+_0xa9bab0[_0xab32('0x78')]+'\x20');_0xeef978+=_0xa9bab0['rules'][_0x51f98d][_0xab32('0x54')]?_0x6727cc(_0xa9bab0[_0xab32('0x53')][_0x51f98d][_0xab32('0x54')]):_0xa9bab0['rules'][_0x51f98d][_0xab32('0x55')]+'\x20'+_0xa9bab0[_0xab32('0x53')][_0x51f98d][_0xab32('0x56')]+(_0x522421(_0xa9bab0['rules'][_0x51f98d][_0xab32('0x56')])?'\x20'+_0xa9bab0['rules'][_0x51f98d]['value']:'');}return _0xeef978+')';};var _0x5f268c={'where':{'id':_0x902339[_0xab32('0x3c')]['id']}},_0x4b33ca,_0x10a488,_0x56e996,_0x4ccf5a,_0x152089;_0x5f268c=_[_0xab32('0x32')]({},_0x5f268c,_0x902339[_0xab32('0x3e')]);return db[_0xab32('0x35')][_0xab32('0x3f')](_0x5f268c)[_0xab32('0x1b')](function(_0x381728){if(_0x381728){_0x4b33ca=_0x381728;return _0x381728['getFields']();}return null;})[_0xab32('0x1b')](function(_0x40b1b6){if(_0x40b1b6){if(!_0x40b1b6[_0xab32('0x28')]){throw new db['Sequelize']['ValidationError'](_0xab32('0x5a'));}_0x10a488=_0x40b1b6;return db[_0xab32('0x5b')][_0xab32('0x38')]({'raw':!![]});}return null;})['then'](function(_0x4f1f8f){if(_0x4f1f8f){_0x56e996=_[_0xab32('0x5c')](_0x4f1f8f,'id');var _0x10546d;var _0x33903a=squel[_0xab32('0x7a')]();_0x33903a[_0xab32('0x7b')](_0x4b33ca[_0xab32('0x5d')]);for(var _0x25fb51=0x0;_0x25fb51<_0x10a488[_0xab32('0x28')];_0x25fb51+=0x1){_0x10546d=_0x10a488[_0x25fb51][_0xab32('0x5e')]?_0x56e996[_0x10a488[_0x25fb51][_0xab32('0x5e')]][_0xab32('0x5f')]:_0x10a488[_0x25fb51][_0xab32('0x55')];_0x10546d=_0x10a488[_0x25fb51][_0xab32('0x60')]?_[_0xab32('0x61')](_0x2e37ab[_0x10a488[_0x25fb51][_0xab32('0x60')]],'%s',_0x10546d):_0x10546d;_0x10546d=_0x10a488[_0x25fb51][_0xab32('0x62')]?_[_0xab32('0x61')](_0x4ef35d[_0x10a488[_0x25fb51][_0xab32('0x62')]],'%s',_0x10546d):_0x10546d;if(_0x10a488[_0x25fb51][_0xab32('0x7c')]){_0x33903a['group'](_0x10546d);}_0x10a488[_0x25fb51][_0xab32('0x63')]&&_0x33903a[_0xab32('0x2c')](_0x10546d,_0x10a488[_0x25fb51][_0xab32('0x63')]==='DESC'?![]:!![]);_0x33903a[_0xab32('0x55')](_0x10546d,_0x10a488[_0x25fb51][_0xab32('0x65')]||_0x10546d);}if(_0x4b33ca[_0xab32('0x66')]){_0x4b33ca['joins']=JSON[_0xab32('0x67')](_0x4b33ca[_0xab32('0x66')]);for(var _0x4d9ad9=0x0;_0x4d9ad9<_0x4b33ca[_0xab32('0x66')]['length'];_0x4d9ad9+=0x1){if(_0x4b33ca['joins'][_0x4d9ad9][_0xab32('0x7d')]&&_[_0xab32('0x77')](_0x3ec9aa,_0x4b33ca[_0xab32('0x66')][_0x4d9ad9][_0xab32('0x7d')])&&_0x4b33ca[_0xab32('0x66')][_0x4d9ad9]['parentKey']&&_0x4b33ca[_0xab32('0x66')][_0x4d9ad9][_0xab32('0x69')]&&_0x4b33ca[_0xab32('0x66')][_0x4d9ad9][_0xab32('0x6a')]){_0x33903a[_0x4b33ca[_0xab32('0x66')][_0x4d9ad9][_0xab32('0x7d')]](_0x4b33ca[_0xab32('0x66')][_0x4d9ad9][_0xab32('0x69')],null,util[_0xab32('0x62')](_0xab32('0x7e'),_0x4b33ca['table'],_0x4b33ca[_0xab32('0x66')][_0x4d9ad9]['parentKey'],_0x4b33ca['joins'][_0x4d9ad9][_0xab32('0x69')],_0x4b33ca['joins'][_0x4d9ad9][_0xab32('0x6a')]));}}}if(_0x4b33ca[_0xab32('0x6b')]){_0x4b33ca['conditions']=JSON['parse'](_0x4b33ca[_0xab32('0x6b')]);_0x33903a[_0xab32('0x2e')](_0x6727cc(_0x4b33ca[_0xab32('0x6b')]['group']));}_0x152089=_0x33903a['clone']();_0x33903a[_0xab32('0x2b')](_0x43d08f);_0x33903a[_0xab32('0x17')](0x0);logger[_0xab32('0x7f')](_0xab32('0x80'),_0x33903a['toString']());return db[_0xab32('0x6e')]['query'](_0x33903a['toString'](),{'type':db[_0xab32('0x6e')][_0xab32('0x6f')]['SELECT']});}})['then'](function(){return{'sql':_0x152089[_0xab32('0x6d')]()};})[_0xab32('0x1b')](respondWithResult(_0x364eab,null))[_0xab32('0x3a')](handleError(_0x364eab,null));}; \ No newline at end of file +var _0x4b91=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','day','merge','filter','map','options','include','catch','show','params','length','find','create','body','join','left_join','outer_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','field','function','replace','format','orderBy','alias','joins','type','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','Limited\x20Query:','toString','sequelize','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','Sequelize','groupBy','DESC','parentKey','debug','QueryTypes','No\x20Data!','fullPath','%s-%s.%s','randomstring','output','csv','AnalyticExtractedReport','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','right_join','ROUND(%s)','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','AnalyticDefaultReport','rawAttributes','model','dateStart','query','dateEnd'];(function(_0x2b4948,_0x237d97){var _0x4a0f7c=function(_0x464c98){while(--_0x464c98){_0x2b4948['push'](_0x2b4948['shift']());}};_0x4a0f7c(++_0x237d97);}(_0x4b91,0xfe));var _0x14b9=function(_0x10b247,_0x484b02){_0x10b247=_0x10b247-0x0;var _0x4236c5=_0x4b91[_0x10b247];return _0x4236c5;};'use strict';var jsonpatch=require(_0x14b9('0x0'));var rp=require(_0x14b9('0x1'));var moment=require(_0x14b9('0x2'));var BPromise=require(_0x14b9('0x3'));var Mustache=require(_0x14b9('0x4'));var util=require(_0x14b9('0x5'));var path=require(_0x14b9('0x6'));var sox=require(_0x14b9('0x7'));var csv=require(_0x14b9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x14b9('0x9'));var squel=require(_0x14b9('0xa'));var crypto=require(_0x14b9('0xb'));var jsforce=require(_0x14b9('0xc'));var deskjs=require(_0x14b9('0xd'));var toCsv=require(_0x14b9('0x8'));var querystring=require(_0x14b9('0xe'));var Papa=require(_0x14b9('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x14b9('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x14b9('0x11'))['db'];function respondWithStatusCode(_0x30d617,_0x1fbf54){_0x1fbf54=_0x1fbf54||0xcc;return function(_0x238045){if(_0x238045){return _0x30d617['sendStatus'](_0x1fbf54);}return _0x30d617['status'](_0x1fbf54)[_0x14b9('0x12')]();};}function respondWithResult(_0x4b30ef,_0x23667c){_0x23667c=_0x23667c||0xc8;return function(_0x8b88e1){if(_0x8b88e1){return _0x4b30ef[_0x14b9('0x13')](_0x23667c)[_0x14b9('0x14')](_0x8b88e1);}};}function respondWithFilteredResult(_0x5f4474,_0x1a2f10){return function(_0x4c574d){if(_0x4c574d){var _0x56ab4d=_0x4c574d[_0x14b9('0x15')],_0x4557e1=_0x1a2f10[_0x14b9('0x16')],_0x4b36d2=_0x1a2f10[_0x14b9('0x16')]+_0x1a2f10[_0x14b9('0x17')],_0x12d314;if(_0x4b36d2>=_0x56ab4d){_0x4b36d2=_0x56ab4d;_0x12d314=0xc8;}else{_0x12d314=0xce;}_0x5f4474[_0x14b9('0x13')](_0x12d314);return _0x5f4474[_0x14b9('0x18')](_0x14b9('0x19'),_0x4557e1+'-'+_0x4b36d2+'/'+_0x56ab4d)[_0x14b9('0x14')](_0x4c574d);}return null;};}function patchUpdates(_0x1eeddc){return function(_0x4e3f5f){try{jsonpatch[_0x14b9('0x1a')](_0x4e3f5f,_0x1eeddc,!![]);}catch(_0x43040f){return BPromise[_0x14b9('0x1b')](_0x43040f);}return _0x4e3f5f[_0x14b9('0x1c')]();};}function saveUpdates(_0x3be5a2,_0x35c819){return function(_0x3029fd){if(_0x3029fd){return _0x3029fd['update'](_0x3be5a2)[_0x14b9('0x1d')](function(_0x360ee1){return _0x360ee1;});}return null;};}function removeEntity(_0x2aa430,_0x4b4f05){return function(_0x49ec03){if(_0x49ec03){return _0x49ec03[_0x14b9('0x1e')]()[_0x14b9('0x1d')](function(){_0x2aa430['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x517c4f,_0x384449){return function(_0x2a2f67){if(!_0x2a2f67){_0x517c4f[_0x14b9('0x1f')](0x194);}return _0x2a2f67;};}function handleError(_0x16aa34,_0x45f7f5){_0x45f7f5=_0x45f7f5||0x1f4;return function(_0x4c2d19){logger[_0x14b9('0x20')](_0x4c2d19[_0x14b9('0x21')]);if(_0x4c2d19[_0x14b9('0x22')]){delete _0x4c2d19[_0x14b9('0x22')];}_0x16aa34[_0x14b9('0x13')](_0x45f7f5)[_0x14b9('0x23')](_0x4c2d19);};}exports['index']=function(_0x20e358,_0x2a7134){var _0xe1b03c={},_0x4b3b02={},_0x2de4d3={'count':0x0,'rows':[]};var _0x395c17=db[_0x14b9('0x24')][_0x14b9('0x25')];_0x4b3b02[_0x14b9('0x26')]=_['keys'](_0x395c17);var _0x2c415b={'dateStart':_0x20e358['query'][_0x14b9('0x27')],'dateEnd':_0x20e358[_0x14b9('0x28')][_0x14b9('0x29')]};delete _0x20e358[_0x14b9('0x28')][_0x14b9('0x27')];delete _0x20e358[_0x14b9('0x28')][_0x14b9('0x29')];_0x4b3b02[_0x14b9('0x28')]=_[_0x14b9('0x2a')](_0x20e358[_0x14b9('0x28')]);_0x4b3b02[_0x14b9('0x2b')]=_[_0x14b9('0x2c')](_0x4b3b02['model'],_0x4b3b02['query']);_0xe1b03c['attributes']=_[_0x14b9('0x2c')](_0x4b3b02[_0x14b9('0x26')],qs['fields'](_0x20e358[_0x14b9('0x28')][_0x14b9('0x2d')]));_0xe1b03c[_0x14b9('0x2e')]=_0xe1b03c['attributes']['length']?_0xe1b03c['attributes']:_0x4b3b02[_0x14b9('0x26')];if(!_0x20e358[_0x14b9('0x28')][_0x14b9('0x2f')](_0x14b9('0x30'))){_0xe1b03c[_0x14b9('0x17')]=qs[_0x14b9('0x17')](_0x20e358[_0x14b9('0x28')][_0x14b9('0x17')]);_0xe1b03c[_0x14b9('0x16')]=qs[_0x14b9('0x16')](_0x20e358[_0x14b9('0x28')][_0x14b9('0x16')]);}_0xe1b03c[_0x14b9('0x31')]=qs[_0x14b9('0x32')](_0x20e358[_0x14b9('0x28')][_0x14b9('0x32')]);_0xe1b03c[_0x14b9('0x33')]=qs['filters'](_[_0x14b9('0x34')](_0x20e358[_0x14b9('0x28')],_0x4b3b02[_0x14b9('0x2b')]));if(_0x2c415b[_0x14b9('0x27')]){if(_0x2c415b['dateEnd']){_0x2c415b['dateEnd']=moment(_0x2c415b[_0x14b9('0x29')])['add'](0x1,_0x14b9('0x35'));}else{_0x2c415b[_0x14b9('0x29')]=moment(_0x2c415b[_0x14b9('0x27')])['add'](0x1,_0x14b9('0x35'));}_[_0x14b9('0x36')](_0xe1b03c['where'],{'createdAt':{'$gte':_0x2c415b[_0x14b9('0x27')],'$lte':_0x2c415b[_0x14b9('0x29')]}});}if(_0x20e358['query'][_0x14b9('0x37')]){_0xe1b03c[_0x14b9('0x33')]=_['merge'](_0xe1b03c[_0x14b9('0x33')],{'$or':_[_0x14b9('0x38')](_0xe1b03c[_0x14b9('0x2e')],function(_0x4b8dd2){var _0x318f86={};_0x318f86[_0x4b8dd2]={'$like':'%'+_0x20e358['query'][_0x14b9('0x37')]+'%'};return _0x318f86;})});}_0xe1b03c=_[_0x14b9('0x36')]({},_0xe1b03c,_0x20e358[_0x14b9('0x39')]);var _0x189cae={'where':_0xe1b03c[_0x14b9('0x33')]};return db[_0x14b9('0x24')]['count'](_0x189cae)[_0x14b9('0x1d')](function(_0x51ee6e){_0x2de4d3[_0x14b9('0x15')]=_0x51ee6e;if(_0x20e358[_0x14b9('0x28')]['includeAll']){_0xe1b03c[_0x14b9('0x3a')]=[{'all':!![]}];}return db[_0x14b9('0x24')]['findAll'](_0xe1b03c);})[_0x14b9('0x1d')](function(_0x289f9c){_0x2de4d3['rows']=_0x289f9c;return _0x2de4d3;})[_0x14b9('0x1d')](respondWithFilteredResult(_0x2a7134,_0xe1b03c))[_0x14b9('0x3b')](handleError(_0x2a7134,null));};exports[_0x14b9('0x3c')]=function(_0x4729ac,_0x4660f3){var _0x2c3193={'raw':!![],'where':{'id':_0x4729ac[_0x14b9('0x3d')]['id']}},_0x5ad791={};_0x5ad791[_0x14b9('0x26')]=_[_0x14b9('0x2a')](db[_0x14b9('0x24')][_0x14b9('0x25')]);_0x5ad791[_0x14b9('0x28')]=_[_0x14b9('0x2a')](_0x4729ac['query']);_0x5ad791[_0x14b9('0x2b')]=_[_0x14b9('0x2c')](_0x5ad791['model'],_0x5ad791[_0x14b9('0x28')]);_0x2c3193[_0x14b9('0x2e')]=_[_0x14b9('0x2c')](_0x5ad791[_0x14b9('0x26')],qs['fields'](_0x4729ac['query'][_0x14b9('0x2d')]));_0x2c3193['attributes']=_0x2c3193[_0x14b9('0x2e')][_0x14b9('0x3e')]?_0x2c3193[_0x14b9('0x2e')]:_0x5ad791[_0x14b9('0x26')];if(_0x4729ac['query']['includeAll']){_0x2c3193['include']=[{'all':!![]}];}_0x2c3193=_[_0x14b9('0x36')]({},_0x2c3193,_0x4729ac[_0x14b9('0x39')]);return db['AnalyticDefaultReport'][_0x14b9('0x3f')](_0x2c3193)['then'](handleEntityNotFound(_0x4660f3,null))[_0x14b9('0x1d')](respondWithResult(_0x4660f3,null))[_0x14b9('0x3b')](handleError(_0x4660f3,null));};exports[_0x14b9('0x40')]=function(_0x503ea5,_0x10359d){return db[_0x14b9('0x24')]['create'](_0x503ea5[_0x14b9('0x41')],{})[_0x14b9('0x1d')](respondWithResult(_0x10359d,0xc9))[_0x14b9('0x3b')](handleError(_0x10359d,null));};exports['update']=function(_0x42db4a,_0x43ac4a){if(_0x42db4a['body']['id']){delete _0x42db4a[_0x14b9('0x41')]['id'];}return db['AnalyticDefaultReport'][_0x14b9('0x3f')]({'where':{'id':_0x42db4a[_0x14b9('0x3d')]['id']}})[_0x14b9('0x1d')](handleEntityNotFound(_0x43ac4a,null))[_0x14b9('0x1d')](saveUpdates(_0x42db4a[_0x14b9('0x41')],null))['then'](respondWithResult(_0x43ac4a,null))[_0x14b9('0x3b')](handleError(_0x43ac4a,null));};exports[_0x14b9('0x1e')]=function(_0x3bc855,_0x118145){return db[_0x14b9('0x24')][_0x14b9('0x3f')]({'where':{'id':_0x3bc855[_0x14b9('0x3d')]['id']}})[_0x14b9('0x1d')](handleEntityNotFound(_0x118145,null))[_0x14b9('0x1d')](removeEntity(_0x118145,null))[_0x14b9('0x3b')](handleError(_0x118145,null));};exports['preview']=function(_0x3a7b05,_0x41b07c){var _0x53201e=0xa;var _0x40d8e6=[_0x14b9('0x42'),_0x14b9('0x43'),'right_join',_0x14b9('0x44'),_0x14b9('0x45')];var _0x19f009={'SUM':_0x14b9('0x46'),'COUNT':_0x14b9('0x47'),'COUNT DISTINCT':_0x14b9('0x48'),'MAX':_0x14b9('0x49'),'MIN':_0x14b9('0x4a'),'AVG':_0x14b9('0x4b'),'GROUP_CONCAT':_0x14b9('0x4c'),'GROUP_CONCAT ASC':_0x14b9('0x4d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x31d54d={'SEC_TO_TIME':_0x14b9('0x4e'),'DATE':_0x14b9('0x4f'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x14b9('0x50')};var _0x2ae221=function(_0x10b7b2){return!_[_0x14b9('0x51')]([_0x14b9('0x52'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x14b9('0x53')],_0x10b7b2);};var _0x3e8537=function(_0xf08a61){if(!_0xf08a61||!_0xf08a61[_0x14b9('0x54')][_0x14b9('0x3e')]){return'';}for(var _0x50cc76='(',_0x1cb32f=0x0;_0x1cb32f<_0xf08a61[_0x14b9('0x54')][_0x14b9('0x3e')];_0x1cb32f+=0x1){_0x1cb32f>0x0&&(_0x50cc76+='\x20'+_0xf08a61['operator']+'\x20');_0x50cc76+=_0xf08a61[_0x14b9('0x54')][_0x1cb32f][_0x14b9('0x55')]?_0x3e8537(_0xf08a61['rules'][_0x1cb32f][_0x14b9('0x55')]):_0xf08a61[_0x14b9('0x54')][_0x1cb32f]['field']+'\x20'+_0xf08a61[_0x14b9('0x54')][_0x1cb32f]['condition']+(_0x2ae221(_0xf08a61['rules'][_0x1cb32f][_0x14b9('0x56')])?'\x20'+_0xf08a61[_0x14b9('0x54')][_0x1cb32f][_0x14b9('0x57')]:'');}return _0x50cc76+')';};var _0x85c82e={'where':{'id':_0x3a7b05[_0x14b9('0x3d')]['id']}},_0x4af54c,_0x193107,_0x18b323,_0x377de0,_0x322df0;_0x85c82e=_[_0x14b9('0x36')]({},_0x85c82e,_0x3a7b05[_0x14b9('0x39')]);return db[_0x14b9('0x24')][_0x14b9('0x3f')](_0x85c82e)['then'](function(_0x577ad4){if(_0x577ad4){_0x4af54c=_0x577ad4;return _0x577ad4[_0x14b9('0x58')]();}return null;})[_0x14b9('0x1d')](function(_0x284a62){if(_0x284a62){if(!_0x284a62[_0x14b9('0x3e')]){throw new db['Sequelize'][(_0x14b9('0x59'))](_0x14b9('0x5a'));}_0x193107=_0x284a62;return db[_0x14b9('0x5b')][_0x14b9('0x5c')]({'raw':!![]});}return null;})[_0x14b9('0x1d')](function(_0x27c5d3){if(_0x27c5d3){_0x18b323=_[_0x14b9('0x5d')](_0x27c5d3,'id');var _0x3b9d42;var _0x408db3=squel[_0x14b9('0x5e')]();_0x408db3[_0x14b9('0x5f')](_0x4af54c[_0x14b9('0x60')]);for(var _0x3ad5ac=0x0;_0x3ad5ac<_0x193107[_0x14b9('0x3e')];_0x3ad5ac+=0x1){_0x3b9d42=_0x193107[_0x3ad5ac][_0x14b9('0x61')]?_0x18b323[_0x193107[_0x3ad5ac][_0x14b9('0x61')]][_0x14b9('0x62')]:_0x193107[_0x3ad5ac][_0x14b9('0x63')];_0x3b9d42=_0x193107[_0x3ad5ac][_0x14b9('0x64')]?_[_0x14b9('0x65')](_0x19f009[_0x193107[_0x3ad5ac][_0x14b9('0x64')]],'%s',_0x3b9d42):_0x3b9d42;_0x3b9d42=_0x193107[_0x3ad5ac][_0x14b9('0x66')]?_['replace'](_0x31d54d[_0x193107[_0x3ad5ac][_0x14b9('0x66')]],'%s',_0x3b9d42):_0x3b9d42;if(_0x193107[_0x3ad5ac]['groupBy']){_0x408db3[_0x14b9('0x55')](_0x3b9d42);}_0x193107[_0x3ad5ac][_0x14b9('0x67')]&&_0x408db3[_0x14b9('0x31')](_0x3b9d42,_0x193107[_0x3ad5ac][_0x14b9('0x67')]==='DESC'?![]:!![]);_0x408db3[_0x14b9('0x63')](_0x3b9d42,_0x193107[_0x3ad5ac][_0x14b9('0x68')]||_0x3b9d42);}if(_0x4af54c[_0x14b9('0x69')]){_0x4af54c[_0x14b9('0x69')]=JSON['parse'](_0x4af54c[_0x14b9('0x69')]);for(var _0x54fff5=0x0;_0x54fff5<_0x4af54c['joins']['length'];_0x54fff5+=0x1){if(_0x4af54c[_0x14b9('0x69')][_0x54fff5][_0x14b9('0x6a')]&&_['includes'](_0x40d8e6,_0x4af54c[_0x14b9('0x69')][_0x54fff5][_0x14b9('0x6a')])&&_0x4af54c[_0x14b9('0x69')][_0x54fff5]['parentKey']&&_0x4af54c[_0x14b9('0x69')][_0x54fff5]['foreignTable']&&_0x4af54c['joins'][_0x54fff5]['foreignKey']){_0x408db3[_0x4af54c[_0x14b9('0x69')][_0x54fff5][_0x14b9('0x6a')]](_0x4af54c[_0x14b9('0x69')][_0x54fff5][_0x14b9('0x6b')],null,util[_0x14b9('0x66')](_0x14b9('0x6c'),_0x4af54c['table'],_0x4af54c[_0x14b9('0x69')][_0x54fff5]['parentKey'],_0x4af54c['joins'][_0x54fff5][_0x14b9('0x6b')],_0x4af54c['joins'][_0x54fff5][_0x14b9('0x6d')]));}}}if(_0x4af54c['conditions']){_0x4af54c[_0x14b9('0x6e')]=JSON[_0x14b9('0x6f')](_0x4af54c[_0x14b9('0x6e')]);_0x408db3['where'](_0x3e8537(_0x4af54c['conditions'][_0x14b9('0x55')]));}_0x322df0=_0x408db3[_0x14b9('0x70')]();_0x408db3[_0x14b9('0x17')](_0x53201e);_0x408db3['offset'](0x0);logger['debug'](_0x14b9('0x71'),_0x408db3[_0x14b9('0x72')]());return db['sequelize'][_0x14b9('0x28')](_0x408db3[_0x14b9('0x72')](),{'type':db[_0x14b9('0x73')]['QueryTypes'][_0x14b9('0x74')]});}})[_0x14b9('0x1d')](respondWithResult(_0x41b07c,null))[_0x14b9('0x3b')](handleError(_0x41b07c,null));};function runReport(_0x29fe04,_0x4e5c28,_0x3b3e01){var _0x38b99d=_0x4e5c28[_0x14b9('0x22')];var _0x36228c=0xa;var _0x2b0a6c=[_0x14b9('0x42'),_0x14b9('0x43'),'right_join',_0x14b9('0x44'),_0x14b9('0x45')];var _0x3df99e={'SUM':_0x14b9('0x46'),'COUNT':_0x14b9('0x47'),'COUNT DISTINCT':_0x14b9('0x48'),'MAX':_0x14b9('0x49'),'MIN':_0x14b9('0x4a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x14b9('0x4c'),'GROUP_CONCAT ASC':_0x14b9('0x4d'),'GROUP_CONCAT DESC':_0x14b9('0x75')};var _0xf87a02={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x14b9('0x4f'),'HOUR':_0x14b9('0x76'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x14b9('0x50')};var _0x14e1c3=function(_0x521781){return!_[_0x14b9('0x51')]([_0x14b9('0x52'),_0x14b9('0x77'),_0x14b9('0x78'),_0x14b9('0x53')],_0x521781);};var _0x1416c4=function(_0x18146b){if(!_0x18146b||!_0x18146b[_0x14b9('0x54')]['length']){return'';}for(var _0xc6ceef='(',_0x533a21=0x0;_0x533a21<_0x18146b[_0x14b9('0x54')]['length'];_0x533a21+=0x1){_0x533a21>0x0&&(_0xc6ceef+='\x20'+_0x18146b[_0x14b9('0x79')]+'\x20');_0xc6ceef+=_0x18146b[_0x14b9('0x54')][_0x533a21][_0x14b9('0x55')]?_0x1416c4(_0x18146b[_0x14b9('0x54')][_0x533a21][_0x14b9('0x55')]):_0x18146b[_0x14b9('0x54')][_0x533a21][_0x14b9('0x63')]+'\x20'+_0x18146b[_0x14b9('0x54')][_0x533a21]['condition']+(_0x14e1c3(_0x18146b[_0x14b9('0x54')][_0x533a21]['condition'])?'\x20'+_0x18146b[_0x14b9('0x54')][_0x533a21][_0x14b9('0x57')]:'');}return _0xc6ceef+')';};var _0xed8deb={'where':{'id':_0x29fe04['id']}},_0x510da4,_0x33d4e6,_0x2c98aa,_0x1121bd,_0x25d5a1;_0xed8deb=_['merge']({},_0xed8deb,_0x3b3e01);return db['AnalyticDefaultReport']['find'](_0xed8deb)['then'](function(_0x2b9a18){if(_0x2b9a18){_0x510da4=_0x2b9a18;return _0x2b9a18['getFields']();}return null;})[_0x14b9('0x1d')](function(_0x20263d){if(_0x20263d){if(!_0x20263d[_0x14b9('0x3e')]){throw new db[(_0x14b9('0x7a'))][(_0x14b9('0x59'))]('Please\x20insert\x20at\x20least\x20one\x20field!');}_0x33d4e6=_0x20263d;return db[_0x14b9('0x5b')][_0x14b9('0x5c')]({'raw':!![]});}return null;})['then'](function(_0x2daf47){if(_0x2daf47){_0x2c98aa=_['keyBy'](_0x2daf47,'id');var _0x340c06;var _0x425708=squel['select']();_0x425708[_0x14b9('0x5f')](_0x510da4[_0x14b9('0x60')]);for(var _0x17d9bf=0x0;_0x17d9bf<_0x33d4e6[_0x14b9('0x3e')];_0x17d9bf+=0x1){_0x340c06=_0x33d4e6[_0x17d9bf][_0x14b9('0x61')]?_0x2c98aa[_0x33d4e6[_0x17d9bf][_0x14b9('0x61')]][_0x14b9('0x62')]:_0x33d4e6[_0x17d9bf][_0x14b9('0x63')];_0x340c06=_0x33d4e6[_0x17d9bf][_0x14b9('0x64')]?_['replace'](_0x3df99e[_0x33d4e6[_0x17d9bf][_0x14b9('0x64')]],'%s',_0x340c06):_0x340c06;_0x340c06=_0x33d4e6[_0x17d9bf]['format']?_[_0x14b9('0x65')](_0xf87a02[_0x33d4e6[_0x17d9bf]['format']],'%s',_0x340c06):_0x340c06;if(_0x33d4e6[_0x17d9bf][_0x14b9('0x7b')]){_0x425708[_0x14b9('0x55')](_0x340c06);}_0x33d4e6[_0x17d9bf][_0x14b9('0x67')]&&_0x425708[_0x14b9('0x31')](_0x340c06,_0x33d4e6[_0x17d9bf][_0x14b9('0x67')]===_0x14b9('0x7c')?![]:!![]);_0x425708[_0x14b9('0x63')](_0x340c06,_0x33d4e6[_0x17d9bf]['alias']||_0x340c06);}if(_0x510da4[_0x14b9('0x69')]){_0x510da4[_0x14b9('0x69')]=JSON['parse'](_0x510da4[_0x14b9('0x69')]);for(var _0x32472d=0x0;_0x32472d<_0x510da4[_0x14b9('0x69')][_0x14b9('0x3e')];_0x32472d+=0x1){if(_0x510da4[_0x14b9('0x69')][_0x32472d]['type']&&_[_0x14b9('0x51')](_0x2b0a6c,_0x510da4['joins'][_0x32472d][_0x14b9('0x6a')])&&_0x510da4[_0x14b9('0x69')][_0x32472d][_0x14b9('0x7d')]&&_0x510da4[_0x14b9('0x69')][_0x32472d]['foreignTable']&&_0x510da4[_0x14b9('0x69')][_0x32472d]['foreignKey']){_0x425708[_0x510da4[_0x14b9('0x69')][_0x32472d][_0x14b9('0x6a')]](_0x510da4[_0x14b9('0x69')][_0x32472d][_0x14b9('0x6b')],null,util[_0x14b9('0x66')](_0x14b9('0x6c'),_0x510da4[_0x14b9('0x60')],_0x510da4[_0x14b9('0x69')][_0x32472d]['parentKey'],_0x510da4['joins'][_0x32472d][_0x14b9('0x6b')],_0x510da4['joins'][_0x32472d][_0x14b9('0x6d')]));}}}if(_0x510da4[_0x14b9('0x6e')]){_0x510da4[_0x14b9('0x6e')]=JSON[_0x14b9('0x6f')](_0x510da4[_0x14b9('0x6e')]);_0x425708['where'](_0x1416c4(_0x510da4[_0x14b9('0x6e')][_0x14b9('0x55')]));}_0x25d5a1=_0x425708[_0x14b9('0x70')]();_0x425708[_0x14b9('0x17')](_0x36228c);_0x425708[_0x14b9('0x16')](0x0);logger[_0x14b9('0x7e')](_0x14b9('0x71'),_0x425708[_0x14b9('0x72')]());return db[_0x14b9('0x73')]['query'](_0x425708[_0x14b9('0x72')](),{'type':db['sequelize'][_0x14b9('0x7f')]['SELECT']});}})[_0x14b9('0x1d')](function(_0x523ce6){if(!_0x523ce6['length']){throw new db[(_0x14b9('0x7a'))][(_0x14b9('0x59'))](_0x14b9('0x80'));}if(_0x4e5c28['output']==='web'){return null;}var _0x1d23bd=_['merge'](_0x4e5c28,{'name':_0x4e5c28[_0x14b9('0x81')]||_0x4e5c28[_0x14b9('0x22')]||_0x510da4[_0x14b9('0x22')],'basename':_0x38b99d,'savename':util[_0x14b9('0x66')](_0x14b9('0x82'),_0x4e5c28[_0x14b9('0x22')]||_0x510da4[_0x14b9('0x22')],require(_0x14b9('0x83'))['generate'](0x4),_0x4e5c28[_0x14b9('0x84')]||_0x14b9('0x85'))});return db[_0x14b9('0x86')][_0x14b9('0x40')](_0x1d23bd,{'raw':!![]});})[_0x14b9('0x1d')](function(_0x4643e1){_0x25d5a1[_0x14b9('0x33')](_0x510da4[_0x14b9('0x60')]+_0x14b9('0x87'),_0x4e5c28[_0x14b9('0x88')],_0x4e5c28[_0x14b9('0x89')]);if(_0x4643e1){logger['info']('Run\x20Query:',_0x25d5a1[_0x14b9('0x72')]());require(_0x14b9('0x8a'))['fork'](path['join'](__dirname,_0x14b9('0x8b'),_0x4643e1[_0x14b9('0x84')]),[_0x4643e1['id'],_0x25d5a1[_0x14b9('0x72')](),path['join'](__dirname,_0x14b9('0x8c'),_0x4643e1[_0x14b9('0x8d')]),_0x38b99d]);return _0x4643e1;}else{var _0x1eb2fc=squel[_0x14b9('0x5e')]();_0x1eb2fc['from']('('+_0x25d5a1[_0x14b9('0x72')]()+')',_0x14b9('0x8e'));_0x1eb2fc[_0x14b9('0x63')](_0x14b9('0x8f'),_0x14b9('0x15'));_0x25d5a1[_0x14b9('0x17')](_0x4e5c28['limit']||_0x36228c);_0x25d5a1['offset'](_0x4e5c28['offset']||0x0);return db[_0x14b9('0x73')][_0x14b9('0x28')](_0x1eb2fc[_0x14b9('0x72')](),{'type':db[_0x14b9('0x73')]['QueryTypes']['SELECT']})[_0x14b9('0x1d')](function(_0x33c0e1){if(!_0x33c0e1[_0x14b9('0x3e')]){_0x1121bd=0x0;}else{_0x1121bd=_0x33c0e1[0x0][_0x14b9('0x15')]||0x0;}return db[_0x14b9('0x73')][_0x14b9('0x28')](_0x25d5a1[_0x14b9('0x72')](),{'type':db['sequelize'][_0x14b9('0x7f')]['SELECT']});})[_0x14b9('0x1d')](function(_0x29f898){return{'rows':_0x29f898||[],'count':_0x1121bd};});}});}exports[_0x14b9('0x90')]=function(_0x46b0e4,_0x5c8d66){return runReport(_0x46b0e4[_0x14b9('0x3d')],_0x46b0e4[_0x14b9('0x28')],_0x46b0e4[_0x14b9('0x39')])[_0x14b9('0x1d')](respondWithResult(_0x5c8d66,null))[_0x14b9('0x3b')](handleError(_0x5c8d66,null));};exports[_0x14b9('0x91')]=runReport;exports['query']=function(_0x22bfeb,_0x42b4cf){var _0x44be1c=0xa;var _0x310c33=[_0x14b9('0x42'),_0x14b9('0x43'),_0x14b9('0x92'),'outer_join',_0x14b9('0x45')];var _0x35c7be={'SUM':_0x14b9('0x46'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x14b9('0x48'),'MAX':_0x14b9('0x49'),'MIN':_0x14b9('0x4a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x14b9('0x4c'),'GROUP_CONCAT ASC':_0x14b9('0x4d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4f4fd5={'SEC_TO_TIME':_0x14b9('0x4e'),'DATE':'DATE(%s)','HOUR':_0x14b9('0x76'),'ROUND':_0x14b9('0x93'),'UNIX_TIMESTAMP':_0x14b9('0x50')};var _0x491add=function(_0x3bce81){return!_['includes']([_0x14b9('0x52'),_0x14b9('0x77'),'IS\x20EMPTY',_0x14b9('0x53')],_0x3bce81);};var _0x5215c7=function(_0x12d547){if(!_0x12d547||!_0x12d547[_0x14b9('0x54')][_0x14b9('0x3e')]){return'';}for(var _0x5bd21d='(',_0x231f75=0x0;_0x231f75<_0x12d547[_0x14b9('0x54')][_0x14b9('0x3e')];_0x231f75+=0x1){_0x231f75>0x0&&(_0x5bd21d+='\x20'+_0x12d547['operator']+'\x20');_0x5bd21d+=_0x12d547[_0x14b9('0x54')][_0x231f75][_0x14b9('0x55')]?_0x5215c7(_0x12d547[_0x14b9('0x54')][_0x231f75]['group']):_0x12d547[_0x14b9('0x54')][_0x231f75][_0x14b9('0x63')]+'\x20'+_0x12d547[_0x14b9('0x54')][_0x231f75][_0x14b9('0x56')]+(_0x491add(_0x12d547[_0x14b9('0x54')][_0x231f75]['condition'])?'\x20'+_0x12d547[_0x14b9('0x54')][_0x231f75][_0x14b9('0x57')]:'');}return _0x5bd21d+')';};var _0x3d02f9={'where':{'id':_0x22bfeb['params']['id']}},_0x456499,_0x3fc75f,_0x30bcba,_0x23110d,_0x32b4f4;_0x3d02f9=_[_0x14b9('0x36')]({},_0x3d02f9,_0x22bfeb[_0x14b9('0x39')]);return db[_0x14b9('0x24')]['find'](_0x3d02f9)[_0x14b9('0x1d')](function(_0xf7192c){if(_0xf7192c){_0x456499=_0xf7192c;return _0xf7192c[_0x14b9('0x58')]();}return null;})[_0x14b9('0x1d')](function(_0x3ef0b5){if(_0x3ef0b5){if(!_0x3ef0b5['length']){throw new db[(_0x14b9('0x7a'))]['ValidationError']('Please\x20insert\x20at\x20least\x20one\x20field!');}_0x3fc75f=_0x3ef0b5;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x14b9('0x1d')](function(_0x5d9c6e){if(_0x5d9c6e){_0x30bcba=_[_0x14b9('0x5d')](_0x5d9c6e,'id');var _0x20fc5f;var _0x201ca4=squel[_0x14b9('0x5e')]();_0x201ca4['from'](_0x456499[_0x14b9('0x60')]);for(var _0xbc9f4a=0x0;_0xbc9f4a<_0x3fc75f[_0x14b9('0x3e')];_0xbc9f4a+=0x1){_0x20fc5f=_0x3fc75f[_0xbc9f4a]['MetricId']?_0x30bcba[_0x3fc75f[_0xbc9f4a][_0x14b9('0x61')]]['metric']:_0x3fc75f[_0xbc9f4a][_0x14b9('0x63')];_0x20fc5f=_0x3fc75f[_0xbc9f4a][_0x14b9('0x64')]?_[_0x14b9('0x65')](_0x35c7be[_0x3fc75f[_0xbc9f4a][_0x14b9('0x64')]],'%s',_0x20fc5f):_0x20fc5f;_0x20fc5f=_0x3fc75f[_0xbc9f4a]['format']?_[_0x14b9('0x65')](_0x4f4fd5[_0x3fc75f[_0xbc9f4a][_0x14b9('0x66')]],'%s',_0x20fc5f):_0x20fc5f;if(_0x3fc75f[_0xbc9f4a][_0x14b9('0x7b')]){_0x201ca4[_0x14b9('0x55')](_0x20fc5f);}_0x3fc75f[_0xbc9f4a]['orderBy']&&_0x201ca4[_0x14b9('0x31')](_0x20fc5f,_0x3fc75f[_0xbc9f4a][_0x14b9('0x67')]===_0x14b9('0x7c')?![]:!![]);_0x201ca4['field'](_0x20fc5f,_0x3fc75f[_0xbc9f4a][_0x14b9('0x68')]||_0x20fc5f);}if(_0x456499[_0x14b9('0x69')]){_0x456499[_0x14b9('0x69')]=JSON[_0x14b9('0x6f')](_0x456499[_0x14b9('0x69')]);for(var _0x15cb23=0x0;_0x15cb23<_0x456499[_0x14b9('0x69')]['length'];_0x15cb23+=0x1){if(_0x456499[_0x14b9('0x69')][_0x15cb23][_0x14b9('0x6a')]&&_[_0x14b9('0x51')](_0x310c33,_0x456499[_0x14b9('0x69')][_0x15cb23][_0x14b9('0x6a')])&&_0x456499[_0x14b9('0x69')][_0x15cb23][_0x14b9('0x7d')]&&_0x456499['joins'][_0x15cb23][_0x14b9('0x6b')]&&_0x456499[_0x14b9('0x69')][_0x15cb23]['foreignKey']){_0x201ca4[_0x456499[_0x14b9('0x69')][_0x15cb23][_0x14b9('0x6a')]](_0x456499[_0x14b9('0x69')][_0x15cb23][_0x14b9('0x6b')],null,util[_0x14b9('0x66')](_0x14b9('0x6c'),_0x456499[_0x14b9('0x60')],_0x456499[_0x14b9('0x69')][_0x15cb23][_0x14b9('0x7d')],_0x456499[_0x14b9('0x69')][_0x15cb23][_0x14b9('0x6b')],_0x456499['joins'][_0x15cb23]['foreignKey']));}}}if(_0x456499[_0x14b9('0x6e')]){_0x456499[_0x14b9('0x6e')]=JSON['parse'](_0x456499[_0x14b9('0x6e')]);_0x201ca4[_0x14b9('0x33')](_0x5215c7(_0x456499[_0x14b9('0x6e')]['group']));}_0x32b4f4=_0x201ca4[_0x14b9('0x70')]();_0x201ca4[_0x14b9('0x17')](_0x44be1c);_0x201ca4['offset'](0x0);logger['debug'](_0x14b9('0x71'),_0x201ca4['toString']());return db[_0x14b9('0x73')][_0x14b9('0x28')](_0x201ca4[_0x14b9('0x72')](),{'type':db[_0x14b9('0x73')][_0x14b9('0x7f')][_0x14b9('0x74')]});}})['then'](function(){return{'sql':_0x32b4f4[_0x14b9('0x72')]()};})[_0x14b9('0x1d')](respondWithResult(_0x42b4cf,null))[_0x14b9('0x3b')](handleError(_0x42b4cf,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 439f277..cb008df 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 _0x3560=['util','../../config/logger','api','moment','bluebird','request-promise','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x8012d1,_0x4ad6c7){var _0x14df77=function(_0x1e1283){while(--_0x1e1283){_0x8012d1['push'](_0x8012d1['shift']());}};_0x14df77(++_0x4ad6c7);}(_0x3560,0xcb));var _0x0356=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0x3560[_0x246227];return _0x37bd4a;};'use strict';var _=require(_0x0356('0x0'));var util=require(_0x0356('0x1'));var logger=require(_0x0356('0x2'))(_0x0356('0x3'));var moment=require(_0x0356('0x4'));var BPromise=require(_0x0356('0x5'));var rp=require(_0x0356('0x6'));var attributes=require(_0x0356('0x7'));module[_0x0356('0x8')]=function(_0x818e1e,_0x2510d8){return _0x818e1e[_0x0356('0x9')](_0x0356('0xa'),attributes,{'tableName':_0x0356('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2854=['moment','bluebird','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','api'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0x2854,0x8e));var _0x4285=function(_0x22e708,_0x3e5113){_0x22e708=_0x22e708-0x0;var _0x2c48fb=_0x2854[_0x22e708];return _0x2c48fb;};'use strict';var _=require(_0x4285('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4285('0x1'));var moment=require(_0x4285('0x2'));var BPromise=require(_0x4285('0x3'));var rp=require('request-promise');var attributes=require('./analyticDefaultReport.attributes');module[_0x4285('0x4')]=function(_0x329bde,_0x352457){return _0x329bde[_0x4285('0x5')](_0x4285('0x6'),attributes,{'tableName':_0x4285('0x7'),'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 395205a..f4969a8 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 _0x1575=['jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x20f259,_0xabaa49){var _0xe59bde=function(_0x5bfc69){while(--_0x5bfc69){_0x20f259['push'](_0x20f259['shift']());}};_0xe59bde(++_0xabaa49);}(_0x1575,0x184));var _0x5157=function(_0x32f8a2,_0x49c502){_0x32f8a2=_0x32f8a2-0x0;var _0x258cca=_0x1575[_0x32f8a2];return _0x258cca;};'use strict';var _=require(_0x5157('0x0'));var util=require('util');var moment=require(_0x5157('0x1'));var BPromise=require(_0x5157('0x2'));var rs=require(_0x5157('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5157('0x4'));var logger=require(_0x5157('0x5'))(_0x5157('0x6'));var config=require(_0x5157('0x7'));var jayson=require(_0x5157('0x8'));var client=jayson[_0x5157('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x263f77,_0x3167fb,_0x32414c){return new BPromise(function(_0x49655c,_0x3f7e0){return client[_0x5157('0xa')](_0x263f77,_0x32414c)[_0x5157('0xb')](function(_0x2ffccc){logger[_0x5157('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3167fb,_0x5157('0xd'));logger[_0x5157('0xe')](_0x5157('0xf'),_0x3167fb,_0x5157('0xd'),JSON[_0x5157('0x10')](_0x2ffccc));if(_0x2ffccc[_0x5157('0x11')]){if(_0x2ffccc['error'][_0x5157('0x12')]===0x1f4){logger[_0x5157('0x11')](_0x5157('0x13'),_0x3167fb,_0x2ffccc[_0x5157('0x11')][_0x5157('0x14')]);return _0x3f7e0(_0x2ffccc['error'][_0x5157('0x14')]);}logger[_0x5157('0x11')](_0x5157('0x13'),_0x3167fb,_0x2ffccc[_0x5157('0x11')][_0x5157('0x14')]);return _0x49655c(_0x2ffccc[_0x5157('0x11')][_0x5157('0x14')]);}else{logger[_0x5157('0xc')](_0x5157('0x13'),_0x3167fb,_0x5157('0xd'));_0x49655c(_0x2ffccc[_0x5157('0x15')][_0x5157('0x14')]);}})['catch'](function(_0x485b24){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3167fb,_0x485b24);_0x3f7e0(_0x485b24);});});} \ No newline at end of file +var _0x0ca1=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4cc03b,_0x299f1c){var _0xf0358c=function(_0x3d0da8){while(--_0x3d0da8){_0x4cc03b['push'](_0x4cc03b['shift']());}};_0xf0358c(++_0x299f1c);}(_0x0ca1,0x86));var _0x10ca=function(_0x59b425,_0x18a75a){_0x59b425=_0x59b425-0x0;var _0x569246=_0x0ca1[_0x59b425];return _0x569246;};'use strict';var _=require(_0x10ca('0x0'));var util=require(_0x10ca('0x1'));var moment=require('moment');var BPromise=require(_0x10ca('0x2'));var rs=require(_0x10ca('0x3'));var fs=require('fs');var db=require(_0x10ca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x10ca('0x5'))('rpc');var config=require(_0x10ca('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x10ca('0x7')][_0x10ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b2cb4,_0x70aefc,_0x583272){return new BPromise(function(_0xa86de6,_0x159f17){return client['request'](_0x4b2cb4,_0x583272)[_0x10ca('0x9')](function(_0xb3b510){logger[_0x10ca('0xa')](_0x10ca('0xb'),_0x70aefc,_0x10ca('0xc'));logger[_0x10ca('0xd')](_0x10ca('0xe'),_0x70aefc,_0x10ca('0xc'),JSON[_0x10ca('0xf')](_0xb3b510));if(_0xb3b510[_0x10ca('0x10')]){if(_0xb3b510['error'][_0x10ca('0x11')]===0x1f4){logger[_0x10ca('0x10')](_0x10ca('0xb'),_0x70aefc,_0xb3b510[_0x10ca('0x10')][_0x10ca('0x12')]);return _0x159f17(_0xb3b510[_0x10ca('0x10')][_0x10ca('0x12')]);}logger[_0x10ca('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x70aefc,_0xb3b510['error'][_0x10ca('0x12')]);return _0xa86de6(_0xb3b510['error'][_0x10ca('0x12')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x70aefc,_0x10ca('0xc'));_0xa86de6(_0xb3b510[_0x10ca('0x13')][_0x10ca('0x12')]);}})[_0x10ca('0x14')](function(_0x32a641){logger[_0x10ca('0x10')](_0x10ca('0xb'),_0x70aefc,_0x32a641);_0x159f17(_0x32a641);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ebb4d6b..1bb225c 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 _0xbd59=['/:id','show','/:id/preview','preview','/:id/query','create','put','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get'];(function(_0x7f1086,_0x434356){var _0x358a47=function(_0x1f14ab){while(--_0x1f14ab){_0x7f1086['push'](_0x7f1086['shift']());}};_0x358a47(++_0x434356);}(_0xbd59,0x173));var _0x9bd5=function(_0x5b9e58,_0x51f4e1){_0x5b9e58=_0x5b9e58-0x0;var _0x5f1012=_0xbd59[_0x5b9e58];return _0x5f1012;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9bd5('0x0'));var express=require(_0x9bd5('0x1'));var router=express[_0x9bd5('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x9bd5('0x3'));var config=require(_0x9bd5('0x4'));var controller=require(_0x9bd5('0x5'));router['get']('/',auth[_0x9bd5('0x6')](),controller[_0x9bd5('0x7')]);router[_0x9bd5('0x8')](_0x9bd5('0x9'),auth[_0x9bd5('0x6')](),controller[_0x9bd5('0xa')]);router[_0x9bd5('0x8')](_0x9bd5('0xb'),auth[_0x9bd5('0x6')](),controller[_0x9bd5('0xc')]);router['get']('/:id/run',auth[_0x9bd5('0x6')](),controller['run']);router[_0x9bd5('0x8')](_0x9bd5('0xd'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x9bd5('0x6')](),controller[_0x9bd5('0xe')]);router[_0x9bd5('0xf')](_0x9bd5('0x9'),auth['isAuthenticated'](),controller[_0x9bd5('0x10')]);router[_0x9bd5('0x11')]('/:id',auth[_0x9bd5('0x6')](),controller[_0x9bd5('0x12')]);module[_0x9bd5('0x13')]=router; \ No newline at end of file +var _0x8828=['/:id/query','query','post','create','put','/:id','update','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run'];(function(_0x441d3a,_0x49bed8){var _0x32a7c3=function(_0x34dcaf){while(--_0x34dcaf){_0x441d3a['push'](_0x441d3a['shift']());}};_0x32a7c3(++_0x49bed8);}(_0x8828,0x184));var _0x8882=function(_0x3adced,_0x39344b){_0x3adced=_0x3adced-0x0;var _0xd3b1e6=_0x8828[_0x3adced];return _0xd3b1e6;};'use strict';var multer=require(_0x8882('0x0'));var util=require('util');var path=require(_0x8882('0x1'));var express=require('express');var router=express[_0x8882('0x2')]();var auth=require(_0x8882('0x3'));var interaction=require(_0x8882('0x4'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x8882('0x5')]('/',auth[_0x8882('0x6')](),controller[_0x8882('0x7')]);router[_0x8882('0x5')]('/:id',auth[_0x8882('0x6')](),controller['show']);router[_0x8882('0x5')](_0x8882('0x8'),auth[_0x8882('0x6')](),controller[_0x8882('0x9')]);router[_0x8882('0x5')](_0x8882('0xa'),auth[_0x8882('0x6')](),controller[_0x8882('0xb')]);router[_0x8882('0x5')](_0x8882('0xc'),auth[_0x8882('0x6')](),controller[_0x8882('0xd')]);router[_0x8882('0xe')]('/',auth['isAuthenticated'](),controller[_0x8882('0xf')]);router[_0x8882('0x10')](_0x8882('0x11'),auth[_0x8882('0x6')](),controller[_0x8882('0x12')]);router['delete'](_0x8882('0x11'),auth[_0x8882('0x6')](),controller['destroy']);module[_0x8882('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e396cfa..39154a9 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 _0x3e02=['csv','xlsx','DATE','manual','scheduled','sequelize','exports','STRING','ENUM'];(function(_0x13ebd4,_0x4f3936){var _0x16bea3=function(_0x1ed836){while(--_0x1ed836){_0x13ebd4['push'](_0x13ebd4['shift']());}};_0x16bea3(++_0x4f3936);}(_0x3e02,0x176));var _0x23e0=function(_0x5b080b,_0xe34631){_0x5b080b=_0x5b080b-0x0;var _0x3d724c=_0x3e02[_0x5b080b];return _0x3d724c;};'use strict';var Sequelize=require(_0x23e0('0x0'));var moment=require('moment');module[_0x23e0('0x1')]={'name':{'type':Sequelize[_0x23e0('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x23e0('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x23e0('0x3')](_0x23e0('0x4'),'pdf',_0x23e0('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x23e0('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x23e0('0x6')]},'endDate':{'type':Sequelize[_0x23e0('0x6')]},'status':{'type':Sequelize[_0x23e0('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x23e0('0x7'),_0x23e0('0x8')),'allowNull':![],'defaultValue':_0x23e0('0x7')}}; \ No newline at end of file +var _0x380d=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x380d,0x6c));var _0xd380=function(_0x447717,_0x529b1c){_0x447717=_0x447717-0x0;var _0x26cdd9=_0x380d[_0x447717];return _0x26cdd9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd380('0x0')]={'name':{'type':Sequelize[_0xd380('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xd380('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xd380('0x2')](_0xd380('0x3'),_0xd380('0x4'),_0xd380('0x5')),'allowNull':![],'defaultValue':_0xd380('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xd380('0x6')]},'endDate':{'type':Sequelize[_0xd380('0x6')]},'status':{'type':Sequelize[_0xd380('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xd380('0x2')](_0xd380('0x7'),_0xd380('0x8')),'allowNull':![],'defaultValue':_0xd380('0x7')}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9130789..fa4b54c 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 _0x5b10=['ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','nolimit','sort','where','pick','add','day','merge','filter','map','AnalyticExtractedReport','count','includeAll','findAll','rows','catch','params','length','include','find','create','body','download','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5b10,0xae));var _0x05b1=function(_0x1bcfbd,_0x5c4004){_0x1bcfbd=_0x1bcfbd-0x0;var _0x345ae2=_0x5b10[_0x1bcfbd];return _0x345ae2;};'use strict';var jsonpatch=require(_0x05b1('0x0'));var rp=require(_0x05b1('0x1'));var moment=require(_0x05b1('0x2'));var BPromise=require(_0x05b1('0x3'));var Mustache=require('mustache');var util=require(_0x05b1('0x4'));var path=require('path');var sox=require(_0x05b1('0x5'));var csv=require(_0x05b1('0x6'));var ejs=require(_0x05b1('0x7'));var fs=require('fs');var _=require(_0x05b1('0x8'));var squel=require(_0x05b1('0x9'));var crypto=require(_0x05b1('0xa'));var jsforce=require(_0x05b1('0xb'));var deskjs=require(_0x05b1('0xc'));var toCsv=require(_0x05b1('0x6'));var querystring=require(_0x05b1('0xd'));var Papa=require(_0x05b1('0xe'));var qs=require(_0x05b1('0xf'));var logger=require(_0x05b1('0x10'))('api');var utils=require(_0x05b1('0x11'));var config=require(_0x05b1('0x12'));var db=require(_0x05b1('0x13'))['db'];function respondWithStatusCode(_0x5d99b4,_0x4851f5){_0x4851f5=_0x4851f5||0xcc;return function(_0x15d177){if(_0x15d177){return _0x5d99b4[_0x05b1('0x14')](_0x4851f5);}return _0x5d99b4[_0x05b1('0x15')](_0x4851f5)[_0x05b1('0x16')]();};}function respondWithResult(_0x5edb02,_0xc04a0c){_0xc04a0c=_0xc04a0c||0xc8;return function(_0x260d3f){if(_0x260d3f){return _0x5edb02['status'](_0xc04a0c)['json'](_0x260d3f);}};}function respondWithFilteredResult(_0x3c9154,_0x58dece){return function(_0xf9527c){if(_0xf9527c){var _0x5eb1fe=_0xf9527c['count'],_0x4aa55e=_0x58dece[_0x05b1('0x17')],_0x12b2ec=_0x58dece[_0x05b1('0x17')]+_0x58dece[_0x05b1('0x18')],_0x41e4c5;if(_0x12b2ec>=_0x5eb1fe){_0x12b2ec=_0x5eb1fe;_0x41e4c5=0xc8;}else{_0x41e4c5=0xce;}_0x3c9154[_0x05b1('0x15')](_0x41e4c5);return _0x3c9154['set'](_0x05b1('0x19'),_0x4aa55e+'-'+_0x12b2ec+'/'+_0x5eb1fe)[_0x05b1('0x1a')](_0xf9527c);}return null;};}function patchUpdates(_0x319365){return function(_0x339aa4){try{jsonpatch[_0x05b1('0x1b')](_0x339aa4,_0x319365,!![]);}catch(_0x3a9623){return BPromise[_0x05b1('0x1c')](_0x3a9623);}return _0x339aa4[_0x05b1('0x1d')]();};}function saveUpdates(_0x30ebfd,_0x4b27f5){return function(_0x25259f){if(_0x25259f){return _0x25259f[_0x05b1('0x1e')](_0x30ebfd)[_0x05b1('0x1f')](function(_0x2d0fb3){return _0x2d0fb3;});}return null;};}function removeEntity(_0xc696d6,_0x2fab50){return function(_0x29972d){if(_0x29972d){return _0x29972d[_0x05b1('0x20')]()[_0x05b1('0x1f')](function(){_0xc696d6[_0x05b1('0x15')](0xcc)[_0x05b1('0x16')]();});}};}function handleEntityNotFound(_0x24ff40,_0x16f2f0){return function(_0x1d601e){if(!_0x1d601e){_0x24ff40[_0x05b1('0x14')](0x194);}return _0x1d601e;};}function handleError(_0x11f8cc,_0x340c9b){_0x340c9b=_0x340c9b||0x1f4;return function(_0x5a83d2){logger[_0x05b1('0x21')](_0x5a83d2[_0x05b1('0x22')]);if(_0x5a83d2[_0x05b1('0x23')]){delete _0x5a83d2[_0x05b1('0x23')];}_0x11f8cc[_0x05b1('0x15')](_0x340c9b)[_0x05b1('0x24')](_0x5a83d2);};}exports[_0x05b1('0x25')]=function(_0x3c4aef,_0x21d794){var _0x23fc31={},_0x914100={},_0x5438a3={'count':0x0,'rows':[]};var _0x377ab1=db['AnalyticExtractedReport'][_0x05b1('0x26')];_0x914100[_0x05b1('0x27')]=_[_0x05b1('0x28')](_0x377ab1);var _0x4d668d={'dateStart':_0x3c4aef[_0x05b1('0x29')][_0x05b1('0x2a')],'dateEnd':_0x3c4aef[_0x05b1('0x29')][_0x05b1('0x2b')]};delete _0x3c4aef[_0x05b1('0x29')][_0x05b1('0x2a')];delete _0x3c4aef['query'][_0x05b1('0x2b')];_0x914100[_0x05b1('0x29')]=_[_0x05b1('0x28')](_0x3c4aef['query']);_0x914100[_0x05b1('0x2c')]=_[_0x05b1('0x2d')](_0x914100[_0x05b1('0x27')],_0x914100['query']);_0x23fc31[_0x05b1('0x2e')]=_['intersection'](_0x914100[_0x05b1('0x27')],qs['fields'](_0x3c4aef[_0x05b1('0x29')][_0x05b1('0x2f')]));_0x23fc31['attributes']=_0x23fc31[_0x05b1('0x2e')]['length']?_0x23fc31[_0x05b1('0x2e')]:_0x914100[_0x05b1('0x27')];if(!_0x3c4aef['query']['hasOwnProperty'](_0x05b1('0x30'))){_0x23fc31['limit']=qs[_0x05b1('0x18')](_0x3c4aef[_0x05b1('0x29')][_0x05b1('0x18')]);_0x23fc31[_0x05b1('0x17')]=qs[_0x05b1('0x17')](_0x3c4aef[_0x05b1('0x29')]['offset']);}_0x23fc31['order']=qs[_0x05b1('0x31')](_0x3c4aef[_0x05b1('0x29')][_0x05b1('0x31')]);_0x23fc31[_0x05b1('0x32')]=qs[_0x05b1('0x2c')](_[_0x05b1('0x33')](_0x3c4aef[_0x05b1('0x29')],_0x914100[_0x05b1('0x2c')]));if(_0x4d668d[_0x05b1('0x2a')]){if(_0x4d668d[_0x05b1('0x2b')]){_0x4d668d[_0x05b1('0x2b')]=moment(_0x4d668d[_0x05b1('0x2b')])[_0x05b1('0x34')](0x1,_0x05b1('0x35'));}else{_0x4d668d[_0x05b1('0x2b')]=moment(_0x4d668d['dateStart'])[_0x05b1('0x34')](0x1,_0x05b1('0x35'));}_[_0x05b1('0x36')](_0x23fc31[_0x05b1('0x32')],{'createdAt':{'$gte':_0x4d668d[_0x05b1('0x2a')],'$lte':_0x4d668d[_0x05b1('0x2b')]}});}if(_0x3c4aef[_0x05b1('0x29')][_0x05b1('0x37')]){_0x23fc31[_0x05b1('0x32')]=_[_0x05b1('0x36')](_0x23fc31[_0x05b1('0x32')],{'$or':_[_0x05b1('0x38')](_0x23fc31[_0x05b1('0x2e')],function(_0x2b8879){var _0x120fde={};_0x120fde[_0x2b8879]={'$like':'%'+_0x3c4aef[_0x05b1('0x29')][_0x05b1('0x37')]+'%'};return _0x120fde;})});}_0x23fc31=_[_0x05b1('0x36')]({},_0x23fc31,_0x3c4aef['options']);var _0x49645f={'where':_0x23fc31[_0x05b1('0x32')]};return db[_0x05b1('0x39')][_0x05b1('0x3a')](_0x49645f)['then'](function(_0x19fcf7){_0x5438a3['count']=_0x19fcf7;if(_0x3c4aef['query'][_0x05b1('0x3b')]){_0x23fc31['include']=[{'all':!![]}];}return db[_0x05b1('0x39')][_0x05b1('0x3c')](_0x23fc31);})[_0x05b1('0x1f')](function(_0x4626e1){_0x5438a3[_0x05b1('0x3d')]=_0x4626e1;return _0x5438a3;})['then'](respondWithFilteredResult(_0x21d794,_0x23fc31))[_0x05b1('0x3e')](handleError(_0x21d794,null));};exports['show']=function(_0x5021f,_0x567da3){var _0x563e15={'raw':!![],'where':{'id':_0x5021f[_0x05b1('0x3f')]['id']}},_0x448b2f={};_0x448b2f[_0x05b1('0x27')]=_[_0x05b1('0x28')](db[_0x05b1('0x39')][_0x05b1('0x26')]);_0x448b2f[_0x05b1('0x29')]=_[_0x05b1('0x28')](_0x5021f[_0x05b1('0x29')]);_0x448b2f[_0x05b1('0x2c')]=_['intersection'](_0x448b2f[_0x05b1('0x27')],_0x448b2f['query']);_0x563e15['attributes']=_[_0x05b1('0x2d')](_0x448b2f['model'],qs['fields'](_0x5021f[_0x05b1('0x29')][_0x05b1('0x2f')]));_0x563e15[_0x05b1('0x2e')]=_0x563e15['attributes'][_0x05b1('0x40')]?_0x563e15[_0x05b1('0x2e')]:_0x448b2f[_0x05b1('0x27')];if(_0x5021f['query'][_0x05b1('0x3b')]){_0x563e15[_0x05b1('0x41')]=[{'all':!![]}];}_0x563e15=_[_0x05b1('0x36')]({},_0x563e15,_0x5021f['options']);return db[_0x05b1('0x39')][_0x05b1('0x42')](_0x563e15)[_0x05b1('0x1f')](handleEntityNotFound(_0x567da3,null))['then'](respondWithResult(_0x567da3,null))[_0x05b1('0x3e')](handleError(_0x567da3,null));};exports[_0x05b1('0x43')]=function(_0x3ae1fe,_0x26b5cf){return db['AnalyticExtractedReport'][_0x05b1('0x43')](_0x3ae1fe[_0x05b1('0x44')],{})[_0x05b1('0x1f')](respondWithResult(_0x26b5cf,0xc9))[_0x05b1('0x3e')](handleError(_0x26b5cf,null));};exports[_0x05b1('0x1e')]=function(_0xbcc172,_0x534f32){if(_0xbcc172[_0x05b1('0x44')]['id']){delete _0xbcc172['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0xbcc172[_0x05b1('0x3f')]['id']}})[_0x05b1('0x1f')](handleEntityNotFound(_0x534f32,null))['then'](saveUpdates(_0xbcc172['body'],null))[_0x05b1('0x1f')](respondWithResult(_0x534f32,null))['catch'](handleError(_0x534f32,null));};exports[_0x05b1('0x20')]=function(_0x1d9693,_0x545ba9){return db[_0x05b1('0x39')][_0x05b1('0x42')]({'where':{'id':_0x1d9693[_0x05b1('0x3f')]['id']}})[_0x05b1('0x1f')](handleEntityNotFound(_0x545ba9,null))['then'](removeEntity(_0x545ba9,null))[_0x05b1('0x3e')](handleError(_0x545ba9,null));};exports[_0x05b1('0x45')]=function(_0x11f7df,_0x43cb9f,_0x48ef24){return db[_0x05b1('0x39')][_0x05b1('0x42')]({'where':{'id':_0x11f7df[_0x05b1('0x3f')]['id']},'attributes':[_0x05b1('0x23'),_0x05b1('0x46'),'savename',_0x05b1('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x43cb9f,null))[_0x05b1('0x1f')](function(_0x31eb3a){if(_0x31eb3a){if(!fs[_0x05b1('0x48')](path[_0x05b1('0x49')](config[_0x05b1('0x4a')],_0x05b1('0x4b'),_0x31eb3a[_0x05b1('0x4c')]))){throw new db[(_0x05b1('0x4d'))][(_0x05b1('0x4e'))](_0x05b1('0x4f'));}if(_0x11f7df['query'][_0x05b1('0x50')]){return _0x43cb9f[_0x05b1('0x14')](0xc8);}return _0x43cb9f[_0x05b1('0x45')](path[_0x05b1('0x49')](config[_0x05b1('0x4a')],_0x05b1('0x4b'),_0x31eb3a[_0x05b1('0x4c')]),util[_0x05b1('0x51')](_0x05b1('0x52'),_0x31eb3a[_0x05b1('0x46')]||_0x31eb3a['name'],_0x31eb3a[_0x05b1('0x47')][_0x05b1('0x53')]()));}})[_0x05b1('0x3e')](handleError(_0x43cb9f,null));}; \ No newline at end of file +var _0x1473=['querystring','papaparse','../../components/parsers/qs','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','AnalyticExtractedReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','filter','merge','map','count','includeAll','include','findAll','catch','show','params','create','body','find','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce'];(function(_0x2d79fe,_0x33dcb0){var _0x666ce4=function(_0x442d94){while(--_0x442d94){_0x2d79fe['push'](_0x2d79fe['shift']());}};_0x666ce4(++_0x33dcb0);}(_0x1473,0x163));var _0x3147=function(_0x1c0a04,_0x34e60c){_0x1c0a04=_0x1c0a04-0x0;var _0x5df28d=_0x1473[_0x1c0a04];return _0x5df28d;};'use strict';var jsonpatch=require(_0x3147('0x0'));var rp=require(_0x3147('0x1'));var moment=require('moment');var BPromise=require(_0x3147('0x2'));var Mustache=require(_0x3147('0x3'));var util=require(_0x3147('0x4'));var path=require(_0x3147('0x5'));var sox=require('sox');var csv=require(_0x3147('0x6'));var ejs=require(_0x3147('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3147('0x8'));var jsforce=require(_0x3147('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3147('0x6'));var querystring=require(_0x3147('0xa'));var Papa=require(_0x3147('0xb'));var qs=require(_0x3147('0xc'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3147('0xd'));var db=require(_0x3147('0xe'))['db'];function respondWithStatusCode(_0x43135a,_0x24d3c5){_0x24d3c5=_0x24d3c5||0xcc;return function(_0x442547){if(_0x442547){return _0x43135a['sendStatus'](_0x24d3c5);}return _0x43135a['status'](_0x24d3c5)[_0x3147('0xf')]();};}function respondWithResult(_0x1a9c31,_0x5bcf52){_0x5bcf52=_0x5bcf52||0xc8;return function(_0x1b70ce){if(_0x1b70ce){return _0x1a9c31[_0x3147('0x10')](_0x5bcf52)[_0x3147('0x11')](_0x1b70ce);}};}function respondWithFilteredResult(_0x86bda5,_0x1d6907){return function(_0x523ee2){if(_0x523ee2){var _0x37ee9d=_0x523ee2['count'],_0x838128=_0x1d6907[_0x3147('0x12')],_0xba4dfa=_0x1d6907[_0x3147('0x12')]+_0x1d6907[_0x3147('0x13')],_0x362379;if(_0xba4dfa>=_0x37ee9d){_0xba4dfa=_0x37ee9d;_0x362379=0xc8;}else{_0x362379=0xce;}_0x86bda5[_0x3147('0x10')](_0x362379);return _0x86bda5['set'](_0x3147('0x14'),_0x838128+'-'+_0xba4dfa+'/'+_0x37ee9d)[_0x3147('0x11')](_0x523ee2);}return null;};}function patchUpdates(_0x23a434){return function(_0x1157cb){try{jsonpatch[_0x3147('0x15')](_0x1157cb,_0x23a434,!![]);}catch(_0x285018){return BPromise[_0x3147('0x16')](_0x285018);}return _0x1157cb[_0x3147('0x17')]();};}function saveUpdates(_0x203920,_0x511390){return function(_0x407d53){if(_0x407d53){return _0x407d53[_0x3147('0x18')](_0x203920)[_0x3147('0x19')](function(_0x10800c){return _0x10800c;});}return null;};}function removeEntity(_0xe80ec4,_0x51abea){return function(_0x23768e){if(_0x23768e){return _0x23768e[_0x3147('0x1a')]()[_0x3147('0x19')](function(){_0xe80ec4[_0x3147('0x10')](0xcc)[_0x3147('0xf')]();});}};}function handleEntityNotFound(_0x2927c8,_0x577ad2){return function(_0x26a643){if(!_0x26a643){_0x2927c8[_0x3147('0x1b')](0x194);}return _0x26a643;};}function handleError(_0x32b052,_0x465084){_0x465084=_0x465084||0x1f4;return function(_0x251d09){logger['error'](_0x251d09[_0x3147('0x1c')]);if(_0x251d09[_0x3147('0x1d')]){delete _0x251d09[_0x3147('0x1d')];}_0x32b052['status'](_0x465084)['send'](_0x251d09);};}exports[_0x3147('0x1e')]=function(_0x18e30d,_0x43c184){var _0x16655e={},_0x136d49={},_0x1fad5b={'count':0x0,'rows':[]};var _0x551b59=db[_0x3147('0x1f')][_0x3147('0x20')];_0x136d49[_0x3147('0x21')]=_[_0x3147('0x22')](_0x551b59);var _0x194b60={'dateStart':_0x18e30d['query'][_0x3147('0x23')],'dateEnd':_0x18e30d[_0x3147('0x24')]['dateEnd']};delete _0x18e30d[_0x3147('0x24')][_0x3147('0x23')];delete _0x18e30d[_0x3147('0x24')][_0x3147('0x25')];_0x136d49[_0x3147('0x24')]=_[_0x3147('0x22')](_0x18e30d[_0x3147('0x24')]);_0x136d49[_0x3147('0x26')]=_[_0x3147('0x27')](_0x136d49[_0x3147('0x21')],_0x136d49['query']);_0x16655e[_0x3147('0x28')]=_['intersection'](_0x136d49[_0x3147('0x21')],qs[_0x3147('0x29')](_0x18e30d[_0x3147('0x24')]['fields']));_0x16655e[_0x3147('0x28')]=_0x16655e[_0x3147('0x28')][_0x3147('0x2a')]?_0x16655e[_0x3147('0x28')]:_0x136d49[_0x3147('0x21')];if(!_0x18e30d[_0x3147('0x24')][_0x3147('0x2b')](_0x3147('0x2c'))){_0x16655e[_0x3147('0x13')]=qs['limit'](_0x18e30d[_0x3147('0x24')]['limit']);_0x16655e[_0x3147('0x12')]=qs['offset'](_0x18e30d[_0x3147('0x24')][_0x3147('0x12')]);}_0x16655e['order']=qs[_0x3147('0x2d')](_0x18e30d['query'][_0x3147('0x2d')]);_0x16655e[_0x3147('0x2e')]=qs[_0x3147('0x26')](_[_0x3147('0x2f')](_0x18e30d[_0x3147('0x24')],_0x136d49['filters']));if(_0x194b60['dateStart']){if(_0x194b60[_0x3147('0x25')]){_0x194b60['dateEnd']=moment(_0x194b60[_0x3147('0x25')])[_0x3147('0x30')](0x1,'day');}else{_0x194b60[_0x3147('0x25')]=moment(_0x194b60['dateStart'])[_0x3147('0x30')](0x1,_0x3147('0x31'));}_['merge'](_0x16655e[_0x3147('0x2e')],{'createdAt':{'$gte':_0x194b60[_0x3147('0x23')],'$lte':_0x194b60[_0x3147('0x25')]}});}if(_0x18e30d[_0x3147('0x24')][_0x3147('0x32')]){_0x16655e[_0x3147('0x2e')]=_[_0x3147('0x33')](_0x16655e[_0x3147('0x2e')],{'$or':_[_0x3147('0x34')](_0x16655e[_0x3147('0x28')],function(_0x36df78){var _0x35f7cd={};_0x35f7cd[_0x36df78]={'$like':'%'+_0x18e30d[_0x3147('0x24')][_0x3147('0x32')]+'%'};return _0x35f7cd;})});}_0x16655e=_[_0x3147('0x33')]({},_0x16655e,_0x18e30d['options']);var _0x555e3d={'where':_0x16655e[_0x3147('0x2e')]};return db['AnalyticExtractedReport'][_0x3147('0x35')](_0x555e3d)['then'](function(_0x1e8168){_0x1fad5b[_0x3147('0x35')]=_0x1e8168;if(_0x18e30d[_0x3147('0x24')][_0x3147('0x36')]){_0x16655e[_0x3147('0x37')]=[{'all':!![]}];}return db[_0x3147('0x1f')][_0x3147('0x38')](_0x16655e);})['then'](function(_0x14d742){_0x1fad5b['rows']=_0x14d742;return _0x1fad5b;})[_0x3147('0x19')](respondWithFilteredResult(_0x43c184,_0x16655e))[_0x3147('0x39')](handleError(_0x43c184,null));};exports[_0x3147('0x3a')]=function(_0x44a35e,_0x4affa5){var _0x974ad9={'raw':!![],'where':{'id':_0x44a35e[_0x3147('0x3b')]['id']}},_0x3e2799={};_0x3e2799[_0x3147('0x21')]=_['keys'](db[_0x3147('0x1f')][_0x3147('0x20')]);_0x3e2799['query']=_[_0x3147('0x22')](_0x44a35e['query']);_0x3e2799['filters']=_[_0x3147('0x27')](_0x3e2799[_0x3147('0x21')],_0x3e2799[_0x3147('0x24')]);_0x974ad9[_0x3147('0x28')]=_['intersection'](_0x3e2799[_0x3147('0x21')],qs[_0x3147('0x29')](_0x44a35e[_0x3147('0x24')][_0x3147('0x29')]));_0x974ad9[_0x3147('0x28')]=_0x974ad9[_0x3147('0x28')]['length']?_0x974ad9['attributes']:_0x3e2799[_0x3147('0x21')];if(_0x44a35e[_0x3147('0x24')][_0x3147('0x36')]){_0x974ad9['include']=[{'all':!![]}];}_0x974ad9=_['merge']({},_0x974ad9,_0x44a35e['options']);return db[_0x3147('0x1f')]['find'](_0x974ad9)['then'](handleEntityNotFound(_0x4affa5,null))[_0x3147('0x19')](respondWithResult(_0x4affa5,null))[_0x3147('0x39')](handleError(_0x4affa5,null));};exports[_0x3147('0x3c')]=function(_0x48915e,_0x30fb41){return db['AnalyticExtractedReport'][_0x3147('0x3c')](_0x48915e[_0x3147('0x3d')],{})[_0x3147('0x19')](respondWithResult(_0x30fb41,0xc9))['catch'](handleError(_0x30fb41,null));};exports[_0x3147('0x18')]=function(_0x59a0ea,_0x2543f5){if(_0x59a0ea[_0x3147('0x3d')]['id']){delete _0x59a0ea[_0x3147('0x3d')]['id'];}return db[_0x3147('0x1f')]['find']({'where':{'id':_0x59a0ea[_0x3147('0x3b')]['id']}})[_0x3147('0x19')](handleEntityNotFound(_0x2543f5,null))['then'](saveUpdates(_0x59a0ea[_0x3147('0x3d')],null))[_0x3147('0x19')](respondWithResult(_0x2543f5,null))[_0x3147('0x39')](handleError(_0x2543f5,null));};exports['destroy']=function(_0x3d39ce,_0x4d909d){return db['AnalyticExtractedReport'][_0x3147('0x3e')]({'where':{'id':_0x3d39ce[_0x3147('0x3b')]['id']}})[_0x3147('0x19')](handleEntityNotFound(_0x4d909d,null))['then'](removeEntity(_0x4d909d,null))[_0x3147('0x39')](handleError(_0x4d909d,null));};exports['download']=function(_0x2537bc,_0x357c3a,_0x39b43b){return db[_0x3147('0x1f')][_0x3147('0x3e')]({'where':{'id':_0x2537bc[_0x3147('0x3b')]['id']},'attributes':[_0x3147('0x1d'),'basename',_0x3147('0x3f'),'output'],'raw':!![]})[_0x3147('0x19')](handleEntityNotFound(_0x357c3a,null))[_0x3147('0x19')](function(_0x10b58e){if(_0x10b58e){if(!fs[_0x3147('0x40')](path[_0x3147('0x41')](config[_0x3147('0x42')],_0x3147('0x43'),_0x10b58e[_0x3147('0x3f')]))){throw new db[(_0x3147('0x44'))][(_0x3147('0x45'))](_0x3147('0x46'));}if(_0x2537bc[_0x3147('0x24')]['exists']){return _0x357c3a[_0x3147('0x1b')](0xc8);}return _0x357c3a[_0x3147('0x47')](path[_0x3147('0x41')](config[_0x3147('0x42')],'server/files/reports',_0x10b58e[_0x3147('0x3f')]),util[_0x3147('0x48')]('%s.%s',_0x10b58e['basename']||_0x10b58e['name'],_0x10b58e['output']['toLowerCase']()));}})['catch'](handleError(_0x357c3a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 060390d..d9e6f8e 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 _0x42f9=['exports','AnalyticExtractedReport','analytics_extracted_reports','moment','bluebird','request-promise'];(function(_0x397ce4,_0x4970aa){var _0x3b0ead=function(_0x4179e4){while(--_0x4179e4){_0x397ce4['push'](_0x397ce4['shift']());}};_0x3b0ead(++_0x4970aa);}(_0x42f9,0xc9));var _0x942f=function(_0x5d33e2,_0x52a63c){_0x5d33e2=_0x5d33e2-0x0;var _0x40cc7a=_0x42f9[_0x5d33e2];return _0x40cc7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x942f('0x0'));var BPromise=require(_0x942f('0x1'));var rp=require(_0x942f('0x2'));var attributes=require('./analyticExtractedReport.attributes');module[_0x942f('0x3')]=function(_0xaf6a9d,_0x260ad6){return _0xaf6a9d['define'](_0x942f('0x4'),attributes,{'tableName':_0x942f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d87=['bluebird','request-promise','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment'];(function(_0x288897,_0x1c4166){var _0x33f6aa=function(_0x3a6757){while(--_0x3a6757){_0x288897['push'](_0x288897['shift']());}};_0x33f6aa(++_0x1c4166);}(_0x7d87,0x178));var _0x77d8=function(_0x41930d,_0x478ed3){_0x41930d=_0x41930d-0x0;var _0x455ade=_0x7d87[_0x41930d];return _0x455ade;};'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/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 5cd794c..301fa3d 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 _0xd573=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','request','then'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xd573,0x1c2));var _0x3d57=function(_0x284bea,_0x3b18c8){_0x284bea=_0x284bea-0x0;var _0x17fd1f=_0xd573[_0x284bea];return _0x17fd1f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d57('0x0'));var BPromise=require(_0x3d57('0x1'));var rs=require(_0x3d57('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x3d57('0x3'));var logger=require('../../config/logger')(_0x3d57('0x4'));var config=require(_0x3d57('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3d57('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22fdf0,_0x324e0f,_0x211c71){return new BPromise(function(_0x2e0540,_0x12d0c4){return client[_0x3d57('0x7')](_0x22fdf0,_0x211c71)[_0x3d57('0x8')](function(_0x27dcea){logger[_0x3d57('0x9')](_0x3d57('0xa'),_0x324e0f,_0x3d57('0xb'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x324e0f,_0x3d57('0xb'),JSON[_0x3d57('0xc')](_0x27dcea));if(_0x27dcea[_0x3d57('0xd')]){if(_0x27dcea['error'][_0x3d57('0xe')]===0x1f4){logger[_0x3d57('0xd')](_0x3d57('0xa'),_0x324e0f,_0x27dcea[_0x3d57('0xd')][_0x3d57('0xf')]);return _0x12d0c4(_0x27dcea['error']['message']);}logger['error'](_0x3d57('0xa'),_0x324e0f,_0x27dcea['error'][_0x3d57('0xf')]);return _0x2e0540(_0x27dcea[_0x3d57('0xd')][_0x3d57('0xf')]);}else{logger[_0x3d57('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x324e0f,_0x3d57('0xb'));_0x2e0540(_0x27dcea['result']['message']);}})[_0x3d57('0x10')](function(_0x4b8c2d){logger['error'](_0x3d57('0xa'),_0x324e0f,_0x4b8c2d);_0x12d0c4(_0x4b8c2d);});});} \ No newline at end of file +var _0x60b1=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x60b1,0x198));var _0x160b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b1[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x160b('0x0'));var util=require(_0x160b('0x1'));var moment=require(_0x160b('0x2'));var BPromise=require(_0x160b('0x3'));var rs=require(_0x160b('0x4'));var fs=require('fs');var db=require(_0x160b('0x5'))['db'];var utils=require(_0x160b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x160b('0x7'));var jayson=require(_0x160b('0x8'));var client=jayson['client'][_0x160b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x399799,_0x1a73f7,_0x57b51d){return new BPromise(function(_0x2b3f9e,_0x276dd1){return client[_0x160b('0xa')](_0x399799,_0x57b51d)[_0x160b('0xb')](function(_0x3ddc02){logger[_0x160b('0xc')](_0x160b('0xd'),_0x1a73f7,_0x160b('0xe'));logger['debug'](_0x160b('0xf'),_0x1a73f7,'request\x20sent',JSON[_0x160b('0x10')](_0x3ddc02));if(_0x3ddc02[_0x160b('0x11')]){if(_0x3ddc02[_0x160b('0x11')][_0x160b('0x12')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1a73f7,_0x3ddc02[_0x160b('0x11')][_0x160b('0x13')]);return _0x276dd1(_0x3ddc02[_0x160b('0x11')][_0x160b('0x13')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1a73f7,_0x3ddc02['error'][_0x160b('0x13')]);return _0x2b3f9e(_0x3ddc02[_0x160b('0x11')][_0x160b('0x13')]);}else{logger[_0x160b('0xc')](_0x160b('0xd'),_0x1a73f7,_0x160b('0xe'));_0x2b3f9e(_0x3ddc02[_0x160b('0x14')][_0x160b('0x13')]);}})[_0x160b('0x15')](function(_0x8aa6f9){logger[_0x160b('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1a73f7,_0x8aa6f9);_0x276dd1(_0x8aa6f9);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e1e60e1..c0e6d7d 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 _0x3b59=['isAuthenticated','index','/:id','show','put','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x29b341,_0xe7b79b){var _0x5a6f89=function(_0x225c8f){while(--_0x225c8f){_0x29b341['push'](_0x29b341['shift']());}};_0x5a6f89(++_0xe7b79b);}(_0x3b59,0xb0));var _0x93b5=function(_0x1e66d7,_0x35f813){_0x1e66d7=_0x1e66d7-0x0;var _0x2e2eb6=_0x3b59[_0x1e66d7];return _0x2e2eb6;};'use strict';var multer=require(_0x93b5('0x0'));var util=require('util');var path=require(_0x93b5('0x1'));var express=require(_0x93b5('0x2'));var router=express[_0x93b5('0x3')]();var auth=require(_0x93b5('0x4'));var interaction=require(_0x93b5('0x5'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x93b5('0x6')](),controller[_0x93b5('0x7')]);router['get'](_0x93b5('0x8'),auth[_0x93b5('0x6')](),controller[_0x93b5('0x9')]);router['get']('/:id/download',auth[_0x93b5('0x6')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x93b5('0xa')]('/:id',auth[_0x93b5('0x6')](),controller['update']);router[_0x93b5('0xb')](_0x93b5('0x8'),auth[_0x93b5('0x6')](),controller[_0x93b5('0xc')]);module['exports']=router; \ No newline at end of file +var _0x740d=['../../config/environment','get','index','/:id','isAuthenticated','/:id/download','post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x31ccb3,_0x32486c){var _0x218a21=function(_0x15aec9){while(--_0x15aec9){_0x31ccb3['push'](_0x31ccb3['shift']());}};_0x218a21(++_0x32486c);}(_0x740d,0x83));var _0xd740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd740('0x0'));var util=require(_0xd740('0x1'));var path=require('path');var express=require(_0xd740('0x2'));var router=express[_0xd740('0x3')]();var auth=require(_0xd740('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd740('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0xd740('0x6')]('/',auth['isAuthenticated'](),controller[_0xd740('0x7')]);router[_0xd740('0x6')](_0xd740('0x8'),auth[_0xd740('0x9')](),controller['show']);router[_0xd740('0x6')](_0xd740('0xa'),auth[_0xd740('0x9')](),controller['download']);router[_0xd740('0xb')]('/',auth[_0xd740('0x9')](),controller[_0xd740('0xc')]);router['put'](_0xd740('0x8'),auth['isAuthenticated'](),controller[_0xd740('0xd')]);router[_0xd740('0xe')](_0xd740('0x8'),auth[_0xd740('0x9')](),controller[_0xd740('0xf')]);module[_0xd740('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index db12bc8..b778179 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 _0x42a6=['BOOLEAN','exports'];(function(_0x2444c0,_0x3b21db){var _0x263663=function(_0x15b62e){while(--_0x15b62e){_0x2444c0['push'](_0x2444c0['shift']());}};_0x263663(++_0x3b21db);}(_0x42a6,0xd7));var _0x642a=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x42a6[_0x14e9f0];return _0xa63f7e;};'use strict';var Sequelize=require('sequelize');module[_0x642a('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x642a('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c99=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3ebd2a,_0x2850f5){var _0x7e54e=function(_0x3ee9f0){while(--_0x3ee9f0){_0x3ebd2a['push'](_0x3ebd2a['shift']());}};_0x7e54e(++_0x2850f5);}(_0x3c99,0xef));var _0x93c9=function(_0x469fe6,_0x5e1de1){_0x469fe6=_0x469fe6-0x0;var _0x266666=_0x3c99[_0x469fe6];return _0x266666;};'use strict';var Sequelize=require(_0x93c9('0x0'));module[_0x93c9('0x1')]={'field':{'type':Sequelize[_0x93c9('0x2')]},'alias':{'type':Sequelize[_0x93c9('0x3')]},'function':{'type':Sequelize[_0x93c9('0x3')]},'format':{'type':Sequelize[_0x93c9('0x3')]},'groupBy':{'type':Sequelize[_0x93c9('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x93c9('0x3')]},'custom':{'type':Sequelize[_0x93c9('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index fa82b90..901e995 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 _0x4991=['bulkCreate','bulkDestroy','ids','AnalyticCustomReport','sequelize','transaction','CustomReportId','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','create','body','catch'];(function(_0xdbcc94,_0x77f5b6){var _0x3f6243=function(_0x158260){while(--_0x158260){_0xdbcc94['push'](_0xdbcc94['shift']());}};_0x3f6243(++_0x77f5b6);}(_0x4991,0xf7));var _0x1499=function(_0x3753cb,_0x514352){_0x3753cb=_0x3753cb-0x0;var _0x12297c=_0x4991[_0x3753cb];return _0x12297c;};'use strict';var jsonpatch=require(_0x1499('0x0'));var rp=require('request-promise');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1499('0x2'));var util=require(_0x1499('0x3'));var path=require(_0x1499('0x4'));var sox=require(_0x1499('0x5'));var csv=require(_0x1499('0x6'));var ejs=require(_0x1499('0x7'));var fs=require('fs');var _=require(_0x1499('0x8'));var squel=require(_0x1499('0x9'));var crypto=require('crypto');var jsforce=require(_0x1499('0xa'));var deskjs=require(_0x1499('0xb'));var toCsv=require(_0x1499('0x6'));var querystring=require(_0x1499('0xc'));var Papa=require(_0x1499('0xd'));var qs=require(_0x1499('0xe'));var logger=require(_0x1499('0xf'))(_0x1499('0x10'));var utils=require('../../config/utils');var config=require(_0x1499('0x11'));var db=require(_0x1499('0x12'))['db'];function respondWithStatusCode(_0x575251,_0x2a4816){_0x2a4816=_0x2a4816||0xcc;return function(_0x352180){if(_0x352180){return _0x575251['sendStatus'](_0x2a4816);}return _0x575251[_0x1499('0x13')](_0x2a4816)[_0x1499('0x14')]();};}function respondWithResult(_0x5de9a2,_0x4ab173){_0x4ab173=_0x4ab173||0xc8;return function(_0x4dd594){if(_0x4dd594){return _0x5de9a2[_0x1499('0x13')](_0x4ab173)[_0x1499('0x15')](_0x4dd594);}};}function respondWithFilteredResult(_0x34a928,_0x334d7e){return function(_0x2b95a5){if(_0x2b95a5){var _0x57a0a2=_0x2b95a5[_0x1499('0x16')],_0x5f34f2=_0x334d7e[_0x1499('0x17')],_0x308177=_0x334d7e[_0x1499('0x17')]+_0x334d7e[_0x1499('0x18')],_0x4e5195;if(_0x308177>=_0x57a0a2){_0x308177=_0x57a0a2;_0x4e5195=0xc8;}else{_0x4e5195=0xce;}_0x34a928['status'](_0x4e5195);return _0x34a928[_0x1499('0x19')](_0x1499('0x1a'),_0x5f34f2+'-'+_0x308177+'/'+_0x57a0a2)['json'](_0x2b95a5);}return null;};}function patchUpdates(_0x25164c){return function(_0x2d405f){try{jsonpatch[_0x1499('0x1b')](_0x2d405f,_0x25164c,!![]);}catch(_0xc92272){return BPromise[_0x1499('0x1c')](_0xc92272);}return _0x2d405f[_0x1499('0x1d')]();};}function saveUpdates(_0x5b9859,_0x541477){return function(_0x5bcb5f){if(_0x5bcb5f){return _0x5bcb5f[_0x1499('0x1e')](_0x5b9859)[_0x1499('0x1f')](function(_0x4a4e28){return _0x4a4e28;});}return null;};}function removeEntity(_0x351da9,_0x3c13a1){return function(_0x28dff3){if(_0x28dff3){return _0x28dff3[_0x1499('0x20')]()[_0x1499('0x1f')](function(){_0x351da9[_0x1499('0x13')](0xcc)[_0x1499('0x14')]();});}};}function handleEntityNotFound(_0x253439,_0xf8003e){return function(_0x15bcd4){if(!_0x15bcd4){_0x253439[_0x1499('0x21')](0x194);}return _0x15bcd4;};}function handleError(_0x836081,_0x223f4c){_0x223f4c=_0x223f4c||0x1f4;return function(_0x3b73f6){logger[_0x1499('0x22')](_0x3b73f6[_0x1499('0x23')]);if(_0x3b73f6[_0x1499('0x24')]){delete _0x3b73f6['name'];}_0x836081[_0x1499('0x13')](_0x223f4c)[_0x1499('0x25')](_0x3b73f6);};}exports[_0x1499('0x26')]=function(_0x3d10f3,_0x3968e0){var _0x16d036={},_0x54f3c2={},_0x501c0d={'count':0x0,'rows':[]};var _0x12739b=db[_0x1499('0x27')][_0x1499('0x28')];_0x54f3c2[_0x1499('0x29')]=_[_0x1499('0x2a')](_0x12739b);var _0x525d6f={'dateStart':_0x3d10f3[_0x1499('0x2b')]['dateStart'],'dateEnd':_0x3d10f3['query']['dateEnd']};delete _0x3d10f3[_0x1499('0x2b')][_0x1499('0x2c')];delete _0x3d10f3[_0x1499('0x2b')][_0x1499('0x2d')];_0x54f3c2[_0x1499('0x2b')]=_[_0x1499('0x2a')](_0x3d10f3[_0x1499('0x2b')]);_0x54f3c2['filters']=_[_0x1499('0x2e')](_0x54f3c2[_0x1499('0x29')],_0x54f3c2[_0x1499('0x2b')]);_0x16d036['attributes']=_[_0x1499('0x2e')](_0x54f3c2[_0x1499('0x29')],qs['fields'](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x2f')]));_0x16d036['attributes']=_0x16d036[_0x1499('0x30')][_0x1499('0x31')]?_0x16d036[_0x1499('0x30')]:_0x54f3c2[_0x1499('0x29')];if(!_0x3d10f3[_0x1499('0x2b')][_0x1499('0x32')](_0x1499('0x33'))){_0x16d036[_0x1499('0x18')]=qs[_0x1499('0x18')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x18')]);_0x16d036[_0x1499('0x17')]=qs[_0x1499('0x17')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x17')]);}_0x16d036[_0x1499('0x34')]=qs[_0x1499('0x35')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x35')]);_0x16d036[_0x1499('0x36')]=qs['filters'](_[_0x1499('0x37')](_0x3d10f3[_0x1499('0x2b')],_0x54f3c2[_0x1499('0x38')]));if(_0x525d6f[_0x1499('0x2c')]){if(_0x525d6f[_0x1499('0x2d')]){_0x525d6f[_0x1499('0x2d')]=moment(_0x525d6f[_0x1499('0x2d')])[_0x1499('0x39')](0x1,_0x1499('0x3a'));}else{_0x525d6f[_0x1499('0x2d')]=moment(_0x525d6f[_0x1499('0x2c')])['add'](0x1,'day');}_[_0x1499('0x3b')](_0x16d036['where'],{'createdAt':{'$gte':_0x525d6f[_0x1499('0x2c')],'$lte':_0x525d6f['dateEnd']}});}if(_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3c')]){_0x16d036[_0x1499('0x36')]=_[_0x1499('0x3b')](_0x16d036['where'],{'$or':_[_0x1499('0x3d')](_0x16d036['attributes'],function(_0x2f9c59){var _0x3d518d={};_0x3d518d[_0x2f9c59]={'$like':'%'+_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3c')]+'%'};return _0x3d518d;})});}_0x16d036=_['merge']({},_0x16d036,_0x3d10f3[_0x1499('0x3e')]);var _0x815a99={'where':_0x16d036[_0x1499('0x36')]};return db[_0x1499('0x27')]['count'](_0x815a99)[_0x1499('0x1f')](function(_0x4cc411){_0x501c0d[_0x1499('0x16')]=_0x4cc411;if(_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3f')]){_0x16d036[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x27')][_0x1499('0x41')](_0x16d036);})[_0x1499('0x1f')](function(_0xcb85eb){_0x501c0d[_0x1499('0x42')]=_0xcb85eb;return _0x501c0d;})[_0x1499('0x1f')](respondWithFilteredResult(_0x3968e0,_0x16d036))['catch'](handleError(_0x3968e0,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x29')]=_[_0x1499('0x2a')](db[_0x1499('0x27')][_0x1499('0x28')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2b')]);_0x5646cf[_0x1499('0x38')]=_['intersection'](_0x5646cf[_0x1499('0x29')],_0x5646cf[_0x1499('0x2b')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x29')],qs[_0x1499('0x2f')](_0x5dd36c[_0x1499('0x2b')]['fields']));_0x1af1a1[_0x1499('0x30')]=_0x1af1a1[_0x1499('0x30')][_0x1499('0x31')]?_0x1af1a1[_0x1499('0x30')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2b')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3b')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x27')][_0x1499('0x45')](_0x1af1a1)[_0x1499('0x1f')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x46')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x27')][_0x1499('0x46')](_0x491777[_0x1499('0x47')],{})[_0x1499('0x1f')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x48')](handleError(_0x7fa101,null));};exports[_0x1499('0x49')]=function(_0x591aa8,_0x420d16){return db['AnalyticFieldReport'][_0x1499('0x49')](_0x591aa8[_0x1499('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x420d16,0xc9))[_0x1499('0x48')](handleError(_0x420d16,null));};exports[_0x1499('0x1e')]=function(_0x3de674,_0x4d1d24){if(_0x3de674[_0x1499('0x47')]['id']){delete _0x3de674[_0x1499('0x47')]['id'];}return db[_0x1499('0x27')][_0x1499('0x45')]({'where':{'id':_0x3de674[_0x1499('0x44')]['id']}})[_0x1499('0x1f')](handleEntityNotFound(_0x4d1d24,null))[_0x1499('0x1f')](saveUpdates(_0x3de674[_0x1499('0x47')],null))[_0x1499('0x1f')](respondWithResult(_0x4d1d24,null))[_0x1499('0x48')](handleError(_0x4d1d24,null));};exports['destroy']=function(_0x13770a,_0x9f0520){return db[_0x1499('0x27')]['find']({'where':{'id':_0x13770a[_0x1499('0x44')]['id']}})[_0x1499('0x1f')](handleEntityNotFound(_0x9f0520,null))['then'](removeEntity(_0x9f0520,null))[_0x1499('0x48')](handleError(_0x9f0520,null));};exports[_0x1499('0x4a')]=function(_0x54134d,_0x3f658b){return db[_0x1499('0x27')][_0x1499('0x20')]({'where':{'id':_0x54134d[_0x1499('0x2b')][_0x1499('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x1499('0x1f')](respondWithResult(_0x3f658b,0xcc))[_0x1499('0x48')](handleError(_0x3f658b,null));};exports['addFields']=function(_0x21653a,_0x2a9f23,_0xf2e353){return db[_0x1499('0x4c')]['findOne']({'where':{'id':_0x21653a['params']['id']}})[_0x1499('0x1f')](handleEntityNotFound(_0x2a9f23,null))[_0x1499('0x1f')](function(_0x5a83ad){if(_0x5a83ad){return db[_0x1499('0x4d')][_0x1499('0x4e')](function(_0xf09b4c){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x21653a['params']['id']},'transaction':_0xf09b4c})[_0x1499('0x1f')](function(_0x1f39f3){var _0x2d1c32=_['map'](_0x21653a[_0x1499('0x47')],function(_0x588e56){delete _0x588e56['id'];_0x588e56[_0x1499('0x4f')]=_0x21653a[_0x1499('0x44')]['id'];return _0x588e56;});return db[_0x1499('0x27')][_0x1499('0x49')](_0x2d1c32,{'transaction':_0xf09b4c});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x21653a[_0x1499('0x44')]['id']}});});}})[_0x1499('0x1f')](respondWithResult(_0x2a9f23,null))[_0x1499('0x48')](handleError(_0x2a9f23,null));}; \ No newline at end of file +var _0x1883=['filters','pick','add','day','filter','merge','map','options','includeAll','include','findAll','params','catch','create','body','bulkCreate','find','destroy','bulkDestroy','addFields','AnalyticCustomReport','transaction','CustomReportId','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','AnalyticFieldReport','rawAttributes','keys','dateStart','query','dateEnd','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','sort','where'];(function(_0x162b3c,_0x510575){var _0x217ebe=function(_0xcfa023){while(--_0xcfa023){_0x162b3c['push'](_0x162b3c['shift']());}};_0x217ebe(++_0x510575);}(_0x1883,0xab));var _0x3188=function(_0x57ebea,_0x18e53e){_0x57ebea=_0x57ebea-0x0;var _0x37fd85=_0x1883[_0x57ebea];return _0x37fd85;};'use strict';var jsonpatch=require(_0x3188('0x0'));var rp=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var Mustache=require(_0x3188('0x4'));var util=require(_0x3188('0x5'));var path=require(_0x3188('0x6'));var sox=require(_0x3188('0x7'));var csv=require(_0x3188('0x8'));var ejs=require(_0x3188('0x9'));var fs=require('fs');var _=require(_0x3188('0xa'));var squel=require(_0x3188('0xb'));var crypto=require(_0x3188('0xc'));var jsforce=require(_0x3188('0xd'));var deskjs=require(_0x3188('0xe'));var toCsv=require(_0x3188('0x8'));var querystring=require(_0x3188('0xf'));var Papa=require('papaparse');var qs=require(_0x3188('0x10'));var logger=require(_0x3188('0x11'))('api');var utils=require(_0x3188('0x12'));var config=require('../../config/environment');var db=require(_0x3188('0x13'))['db'];function respondWithStatusCode(_0x34fc82,_0x209e31){_0x209e31=_0x209e31||0xcc;return function(_0x43b69){if(_0x43b69){return _0x34fc82['sendStatus'](_0x209e31);}return _0x34fc82[_0x3188('0x14')](_0x209e31)[_0x3188('0x15')]();};}function respondWithResult(_0x4dcadb,_0x5c029f){_0x5c029f=_0x5c029f||0xc8;return function(_0x339b4a){if(_0x339b4a){return _0x4dcadb[_0x3188('0x14')](_0x5c029f)[_0x3188('0x16')](_0x339b4a);}};}function respondWithFilteredResult(_0x3ae228,_0x4bb424){return function(_0xc01ce6){if(_0xc01ce6){var _0x490104=_0xc01ce6[_0x3188('0x17')],_0x276d69=_0x4bb424['offset'],_0x5e0044=_0x4bb424['offset']+_0x4bb424[_0x3188('0x18')],_0x4a2f36;if(_0x5e0044>=_0x490104){_0x5e0044=_0x490104;_0x4a2f36=0xc8;}else{_0x4a2f36=0xce;}_0x3ae228[_0x3188('0x14')](_0x4a2f36);return _0x3ae228[_0x3188('0x19')](_0x3188('0x1a'),_0x276d69+'-'+_0x5e0044+'/'+_0x490104)[_0x3188('0x16')](_0xc01ce6);}return null;};}function patchUpdates(_0x259321){return function(_0x56e302){try{jsonpatch[_0x3188('0x1b')](_0x56e302,_0x259321,!![]);}catch(_0x1c3598){return BPromise[_0x3188('0x1c')](_0x1c3598);}return _0x56e302[_0x3188('0x1d')]();};}function saveUpdates(_0x18a71a,_0x4f27b0){return function(_0xac7f48){if(_0xac7f48){return _0xac7f48[_0x3188('0x1e')](_0x18a71a)['then'](function(_0x354338){return _0x354338;});}return null;};}function removeEntity(_0x36050a,_0x5512f4){return function(_0x518b2f){if(_0x518b2f){return _0x518b2f['destroy']()[_0x3188('0x1f')](function(){_0x36050a[_0x3188('0x14')](0xcc)[_0x3188('0x15')]();});}};}function handleEntityNotFound(_0x5980f3,_0x48673c){return function(_0x266260){if(!_0x266260){_0x5980f3[_0x3188('0x20')](0x194);}return _0x266260;};}function handleError(_0x375077,_0xaf6a8e){_0xaf6a8e=_0xaf6a8e||0x1f4;return function(_0xb61717){logger['error'](_0xb61717[_0x3188('0x21')]);if(_0xb61717[_0x3188('0x22')]){delete _0xb61717['name'];}_0x375077[_0x3188('0x14')](_0xaf6a8e)['send'](_0xb61717);};}exports['index']=function(_0x45ae2f,_0x129bd7){var _0x87d5a3={},_0x1aeaba={},_0x336be5={'count':0x0,'rows':[]};var _0x2cd060=db[_0x3188('0x23')][_0x3188('0x24')];_0x1aeaba['model']=_[_0x3188('0x25')](_0x2cd060);var _0x2d000a={'dateStart':_0x45ae2f['query'][_0x3188('0x26')],'dateEnd':_0x45ae2f[_0x3188('0x27')][_0x3188('0x28')]};delete _0x45ae2f[_0x3188('0x27')][_0x3188('0x26')];delete _0x45ae2f[_0x3188('0x27')][_0x3188('0x28')];_0x1aeaba[_0x3188('0x27')]=_['keys'](_0x45ae2f[_0x3188('0x27')]);_0x1aeaba['filters']=_[_0x3188('0x29')](_0x1aeaba['model'],_0x1aeaba[_0x3188('0x27')]);_0x87d5a3[_0x3188('0x2a')]=_[_0x3188('0x29')](_0x1aeaba[_0x3188('0x2b')],qs[_0x3188('0x2c')](_0x45ae2f[_0x3188('0x27')][_0x3188('0x2c')]));_0x87d5a3[_0x3188('0x2a')]=_0x87d5a3[_0x3188('0x2a')][_0x3188('0x2d')]?_0x87d5a3[_0x3188('0x2a')]:_0x1aeaba[_0x3188('0x2b')];if(!_0x45ae2f[_0x3188('0x27')][_0x3188('0x2e')](_0x3188('0x2f'))){_0x87d5a3[_0x3188('0x18')]=qs[_0x3188('0x18')](_0x45ae2f[_0x3188('0x27')]['limit']);_0x87d5a3[_0x3188('0x30')]=qs['offset'](_0x45ae2f[_0x3188('0x27')][_0x3188('0x30')]);}_0x87d5a3['order']=qs[_0x3188('0x31')](_0x45ae2f[_0x3188('0x27')][_0x3188('0x31')]);_0x87d5a3[_0x3188('0x32')]=qs[_0x3188('0x33')](_[_0x3188('0x34')](_0x45ae2f[_0x3188('0x27')],_0x1aeaba['filters']));if(_0x2d000a['dateStart']){if(_0x2d000a[_0x3188('0x28')]){_0x2d000a[_0x3188('0x28')]=moment(_0x2d000a[_0x3188('0x28')])[_0x3188('0x35')](0x1,'day');}else{_0x2d000a[_0x3188('0x28')]=moment(_0x2d000a[_0x3188('0x26')])[_0x3188('0x35')](0x1,_0x3188('0x36'));}_['merge'](_0x87d5a3[_0x3188('0x32')],{'createdAt':{'$gte':_0x2d000a['dateStart'],'$lte':_0x2d000a[_0x3188('0x28')]}});}if(_0x45ae2f['query'][_0x3188('0x37')]){_0x87d5a3[_0x3188('0x32')]=_[_0x3188('0x38')](_0x87d5a3[_0x3188('0x32')],{'$or':_[_0x3188('0x39')](_0x87d5a3[_0x3188('0x2a')],function(_0x4666b2){var _0xa8443={};_0xa8443[_0x4666b2]={'$like':'%'+_0x45ae2f[_0x3188('0x27')][_0x3188('0x37')]+'%'};return _0xa8443;})});}_0x87d5a3=_['merge']({},_0x87d5a3,_0x45ae2f[_0x3188('0x3a')]);var _0x2bad0f={'where':_0x87d5a3[_0x3188('0x32')]};return db[_0x3188('0x23')][_0x3188('0x17')](_0x2bad0f)[_0x3188('0x1f')](function(_0x5a815d){_0x336be5[_0x3188('0x17')]=_0x5a815d;if(_0x45ae2f['query'][_0x3188('0x3b')]){_0x87d5a3[_0x3188('0x3c')]=[{'all':!![]}];}return db[_0x3188('0x23')][_0x3188('0x3d')](_0x87d5a3);})[_0x3188('0x1f')](function(_0x549ab2){_0x336be5['rows']=_0x549ab2;return _0x336be5;})['then'](respondWithFilteredResult(_0x129bd7,_0x87d5a3))['catch'](handleError(_0x129bd7,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x3e')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x25')](db['AnalyticFieldReport'][_0x3188('0x24')]);_0x1b40b1[_0x3188('0x27')]=_[_0x3188('0x25')](_0x763943[_0x3188('0x27')]);_0x1b40b1['filters']=_[_0x3188('0x29')](_0x1b40b1[_0x3188('0x2b')],_0x1b40b1[_0x3188('0x27')]);_0x3e5f90[_0x3188('0x2a')]=_[_0x3188('0x29')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x27')][_0x3188('0x2c')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x2a')][_0x3188('0x2d')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2b')];if(_0x763943[_0x3188('0x27')][_0x3188('0x3b')]){_0x3e5f90[_0x3188('0x3c')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x38')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x23')]['find'](_0x3e5f90)[_0x3188('0x1f')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x1f')](respondWithResult(_0x28c224,null))[_0x3188('0x3f')](handleError(_0x28c224,null));};exports[_0x3188('0x40')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x23')][_0x3188('0x40')](_0xe4cbb0[_0x3188('0x41')],{})[_0x3188('0x1f')](respondWithResult(_0x315524,0xc9))[_0x3188('0x3f')](handleError(_0x315524,null));};exports['bulkCreate']=function(_0x50fd56,_0x1b012d){return db['AnalyticFieldReport'][_0x3188('0x42')](_0x50fd56[_0x3188('0x41')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1b012d,0xc9))[_0x3188('0x3f')](handleError(_0x1b012d,null));};exports[_0x3188('0x1e')]=function(_0x9526a8,_0x250903){if(_0x9526a8[_0x3188('0x41')]['id']){delete _0x9526a8[_0x3188('0x41')]['id'];}return db[_0x3188('0x23')][_0x3188('0x43')]({'where':{'id':_0x9526a8['params']['id']}})[_0x3188('0x1f')](handleEntityNotFound(_0x250903,null))[_0x3188('0x1f')](saveUpdates(_0x9526a8['body'],null))[_0x3188('0x1f')](respondWithResult(_0x250903,null))['catch'](handleError(_0x250903,null));};exports[_0x3188('0x44')]=function(_0x13ffa9,_0x4f8852){return db['AnalyticFieldReport']['find']({'where':{'id':_0x13ffa9['params']['id']}})['then'](handleEntityNotFound(_0x4f8852,null))['then'](removeEntity(_0x4f8852,null))[_0x3188('0x3f')](handleError(_0x4f8852,null));};exports[_0x3188('0x45')]=function(_0x482433,_0x1e72b7){return db[_0x3188('0x23')]['destroy']({'where':{'id':_0x482433['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1e72b7,0xcc))['catch'](handleError(_0x1e72b7,null));};exports[_0x3188('0x46')]=function(_0x4763a5,_0x9860ab,_0x3c2e53){return db[_0x3188('0x47')]['findOne']({'where':{'id':_0x4763a5[_0x3188('0x3e')]['id']}})[_0x3188('0x1f')](handleEntityNotFound(_0x9860ab,null))['then'](function(_0x5c8c90){if(_0x5c8c90){return db['sequelize'][_0x3188('0x48')](function(_0x4168fe){return db[_0x3188('0x23')]['destroy']({'where':{'CustomReportId':_0x4763a5[_0x3188('0x3e')]['id']},'transaction':_0x4168fe})[_0x3188('0x1f')](function(_0x137c7b){var _0x1dfdbf=_[_0x3188('0x39')](_0x4763a5['body'],function(_0x152f9d){delete _0x152f9d['id'];_0x152f9d[_0x3188('0x49')]=_0x4763a5[_0x3188('0x3e')]['id'];return _0x152f9d;});return db['AnalyticFieldReport'][_0x3188('0x42')](_0x1dfdbf,{'transaction':_0x4168fe});});})[_0x3188('0x1f')](function(){return db[_0x3188('0x23')][_0x3188('0x3d')]({'where':{'CustomReportId':_0x4763a5['params']['id']}});});}})[_0x3188('0x1f')](respondWithResult(_0x9860ab,null))[_0x3188('0x3f')](handleError(_0x9860ab,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 617da1a..d9cbc3a 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 _0x555c=['../../config/logger','bluebird','define','analytics_report_fields','lodash','util'];(function(_0x203c8c,_0x2728e5){var _0x1e5322=function(_0x4f2814){while(--_0x4f2814){_0x203c8c['push'](_0x203c8c['shift']());}};_0x1e5322(++_0x2728e5);}(_0x555c,0x160));var _0xc555=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x555c[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xc555('0x0'));var util=require(_0xc555('0x1'));var logger=require(_0xc555('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc555('0x3'));var rp=require('request-promise');var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0xda099d,_0x115c02){return _0xda099d[_0xc555('0x4')]('AnalyticFieldReport',attributes,{'tableName':_0xc555('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b49=['./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c5cf0,_0x534b4f){var _0x358c88=function(_0x280c26){while(--_0x280c26){_0x5c5cf0['push'](_0x5c5cf0['shift']());}};_0x358c88(++_0x534b4f);}(_0x8b49,0x193));var _0x98b4=function(_0x11af6c,_0xf0fc16){_0x11af6c=_0x11af6c-0x0;var _0x2b043f=_0x8b49[_0x11af6c];return _0x2b043f;};'use strict';var _=require(_0x98b4('0x0'));var util=require(_0x98b4('0x1'));var logger=require(_0x98b4('0x2'))(_0x98b4('0x3'));var moment=require(_0x98b4('0x4'));var BPromise=require(_0x98b4('0x5'));var rp=require(_0x98b4('0x6'));var attributes=require(_0x98b4('0x7'));module['exports']=function(_0x5293dc,_0x2c91e4){return _0x5293dc[_0x98b4('0x8')](_0x98b4('0x9'),attributes,{'tableName':'analytics_report_fields','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 39d1d42..60d58a0 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 _0xc3fd=['info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request'];(function(_0x4d01f3,_0x51b822){var _0x4f2752=function(_0x4f36ff){while(--_0x4f36ff){_0x4d01f3['push'](_0x4d01f3['shift']());}};_0x4f2752(++_0x51b822);}(_0xc3fd,0x82));var _0xdc3f=function(_0x53d7f1,_0x1e0457){_0x53d7f1=_0x53d7f1-0x0;var _0x15eae6=_0xc3fd[_0x53d7f1];return _0x15eae6;};'use strict';var _=require(_0xdc3f('0x0'));var util=require(_0xdc3f('0x1'));var moment=require(_0xdc3f('0x2'));var BPromise=require(_0xdc3f('0x3'));var rs=require(_0xdc3f('0x4'));var fs=require('fs');var db=require(_0xdc3f('0x5'))['db'];var utils=require(_0xdc3f('0x6'));var logger=require('../../config/logger')(_0xdc3f('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc3f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a9ac0,_0x15d4e1,_0x2d6e71){return new BPromise(function(_0x1b23c8,_0x585a80){return client[_0xdc3f('0x9')](_0x4a9ac0,_0x2d6e71)['then'](function(_0x19409b){logger[_0xdc3f('0xa')](_0xdc3f('0xb'),_0x15d4e1,'request\x20sent');logger[_0xdc3f('0xc')](_0xdc3f('0xd'),_0x15d4e1,_0xdc3f('0xe'),JSON[_0xdc3f('0xf')](_0x19409b));if(_0x19409b[_0xdc3f('0x10')]){if(_0x19409b[_0xdc3f('0x10')][_0xdc3f('0x11')]===0x1f4){logger[_0xdc3f('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15d4e1,_0x19409b[_0xdc3f('0x10')][_0xdc3f('0x12')]);return _0x585a80(_0x19409b[_0xdc3f('0x10')][_0xdc3f('0x12')]);}logger[_0xdc3f('0x10')](_0xdc3f('0xb'),_0x15d4e1,_0x19409b[_0xdc3f('0x10')][_0xdc3f('0x12')]);return _0x1b23c8(_0x19409b['error'][_0xdc3f('0x12')]);}else{logger[_0xdc3f('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15d4e1,_0xdc3f('0xe'));_0x1b23c8(_0x19409b[_0xdc3f('0x13')][_0xdc3f('0x12')]);}})['catch'](function(_0x15b16c){logger[_0xdc3f('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15d4e1,_0x15b16c);_0x585a80(_0x15b16c);});});} \ No newline at end of file +var _0xc006=['../../config/utils','rpc','../../config/environment','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x21ef12,_0x218d17){var _0x3ff1ed=function(_0x147d92){while(--_0x147d92){_0x21ef12['push'](_0x21ef12['shift']());}};_0x3ff1ed(++_0x218d17);}(_0xc006,0x119));var _0x6c00=function(_0x51f012,_0x629f0d){_0x51f012=_0x51f012-0x0;var _0x1e3e8f=_0xc006[_0x51f012];return _0x1e3e8f;};'use strict';var _=require(_0x6c00('0x0'));var util=require(_0x6c00('0x1'));var moment=require(_0x6c00('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c00('0x3'));var fs=require('fs');var db=require(_0x6c00('0x4'))['db'];var utils=require(_0x6c00('0x5'));var logger=require('../../config/logger')(_0x6c00('0x6'));var config=require(_0x6c00('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6c00('0x8')][_0x6c00('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32e02b,_0x2bc235,_0x443c67){return new BPromise(function(_0x2b6ee0,_0x4ff046){return client['request'](_0x32e02b,_0x443c67)[_0x6c00('0xa')](function(_0x300336){logger[_0x6c00('0xb')](_0x6c00('0xc'),_0x2bc235,_0x6c00('0xd'));logger[_0x6c00('0xe')](_0x6c00('0xf'),_0x2bc235,_0x6c00('0xd'),JSON[_0x6c00('0x10')](_0x300336));if(_0x300336[_0x6c00('0x11')]){if(_0x300336[_0x6c00('0x11')][_0x6c00('0x12')]===0x1f4){logger['error'](_0x6c00('0xc'),_0x2bc235,_0x300336[_0x6c00('0x11')]['message']);return _0x4ff046(_0x300336[_0x6c00('0x11')][_0x6c00('0x13')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2bc235,_0x300336[_0x6c00('0x11')][_0x6c00('0x13')]);return _0x2b6ee0(_0x300336[_0x6c00('0x11')][_0x6c00('0x13')]);}else{logger[_0x6c00('0xb')](_0x6c00('0xc'),_0x2bc235,'request\x20sent');_0x2b6ee0(_0x300336[_0x6c00('0x14')]['message']);}})[_0x6c00('0x15')](function(_0x52609e){logger[_0x6c00('0x11')](_0x6c00('0xc'),_0x2bc235,_0x52609e);_0x4ff046(_0x52609e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 73f3d12..e9b8a90 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 _0x7bd0=['put','/destroy_many','bulkDestroy','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','show','create','/create_many','isAuthenticated','bulkCreate','post','/:id/create_many','addFields'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x7bd0,0x10a));var _0x07bd=function(_0x591e16,_0x5aefc1){_0x591e16=_0x591e16-0x0;var _0x543b35=_0x7bd0[_0x591e16];return _0x543b35;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var express=require(_0x07bd('0x3'));var router=express[_0x07bd('0x4')]();var auth=require(_0x07bd('0x5'));var interaction=require(_0x07bd('0x6'));var config=require(_0x07bd('0x7'));var controller=require(_0x07bd('0x8'));router[_0x07bd('0x9')]('/',auth['isAuthenticated'](),controller[_0x07bd('0xa')]);router[_0x07bd('0x9')](_0x07bd('0xb'),auth['isAuthenticated'](),controller[_0x07bd('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x07bd('0xd')]);router['post'](_0x07bd('0xe'),auth[_0x07bd('0xf')](),controller[_0x07bd('0x10')]);router[_0x07bd('0x11')](_0x07bd('0x12'),auth['isAuthenticated'](),controller[_0x07bd('0x13')]);router[_0x07bd('0x14')]('/:id',auth[_0x07bd('0xf')](),controller['update']);router['delete'](_0x07bd('0x15'),auth[_0x07bd('0xf')](),controller[_0x07bd('0x16')]);router[_0x07bd('0x17')](_0x07bd('0xb'),auth[_0x07bd('0xf')](),controller[_0x07bd('0x18')]);module[_0x07bd('0x19')]=router; \ No newline at end of file +var _0xdf56=['bulkCreate','/:id/create_many','put','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','isAuthenticated','get','/:id','create','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdf56,0xc5));var _0x6df5=function(_0x36ba9b,_0x51e087){_0x36ba9b=_0x36ba9b-0x0;var _0x29c05b=_0xdf56[_0x36ba9b];return _0x29c05b;};'use strict';var multer=require(_0x6df5('0x0'));var util=require(_0x6df5('0x1'));var path=require('path');var express=require(_0x6df5('0x2'));var router=express[_0x6df5('0x3')]();var auth=require(_0x6df5('0x4'));var interaction=require(_0x6df5('0x5'));var config=require(_0x6df5('0x6'));var controller=require(_0x6df5('0x7'));router['get']('/',auth[_0x6df5('0x8')](),controller['index']);router[_0x6df5('0x9')](_0x6df5('0xa'),auth[_0x6df5('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6df5('0xb')]);router[_0x6df5('0xc')]('/create_many',auth[_0x6df5('0x8')](),controller[_0x6df5('0xd')]);router[_0x6df5('0xc')](_0x6df5('0xe'),auth['isAuthenticated'](),controller['addFields']);router[_0x6df5('0xf')](_0x6df5('0xa'),auth[_0x6df5('0x8')](),controller['update']);router[_0x6df5('0x10')](_0x6df5('0x11'),auth[_0x6df5('0x8')](),controller[_0x6df5('0x12')]);router[_0x6df5('0x10')](_0x6df5('0xa'),auth[_0x6df5('0x8')](),controller[_0x6df5('0x13')]);module[_0x6df5('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index a590edd..9c1edb6 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 _0xbbd0=['sequelize','exports','STRING','name'];(function(_0x5694e2,_0x2ca0a6){var _0xa80669=function(_0x425eea){while(--_0x425eea){_0x5694e2['push'](_0x5694e2['shift']());}};_0xa80669(++_0x2ca0a6);}(_0xbbd0,0x9c));var _0x0bbd=function(_0x3e23fd,_0x10e0cc){_0x3e23fd=_0x3e23fd-0x0;var _0xe51a4c=_0xbbd0[_0x3e23fd];return _0xe51a4c;};'use strict';var Sequelize=require(_0x0bbd('0x0'));module[_0x0bbd('0x1')]={'name':{'type':Sequelize[_0x0bbd('0x2')],'allowNull':![],'unique':_0x0bbd('0x3')},'table':{'type':Sequelize[_0x0bbd('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x30af=['name','TEXT','STRING'];(function(_0x363a2f,_0x51b1e3){var _0x4c54fc=function(_0x586f64){while(--_0x586f64){_0x363a2f['push'](_0x363a2f['shift']());}};_0x4c54fc(++_0x51b1e3);}(_0x30af,0x86));var _0xf30a=function(_0x230471,_0x10441f){_0x230471=_0x230471-0x0;var _0x5dd908=_0x30af[_0x230471];return _0x5dd908;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf30a('0x0')],'allowNull':![],'unique':_0xf30a('0x1')},'table':{'type':Sequelize[_0xf30a('0x0')]},'metric':{'type':Sequelize[_0xf30a('0x2')]},'description':{'type':Sequelize[_0xf30a('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7cd4204..593afdf 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 _0xcc5f=['find','create','body','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','AnalyticMetric','rawAttributes','model','query','dateEnd','dateStart','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','add','day','where','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','keys','length','options'];(function(_0x27964e,_0x53626d){var _0x3e9045=function(_0x2556df){while(--_0x2556df){_0x27964e['push'](_0x27964e['shift']());}};_0x3e9045(++_0x53626d);}(_0xcc5f,0x157));var _0xfcc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc5f[_0x14add3];return _0x4a174f;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xfcc5('0x0'));var moment=require(_0xfcc5('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfcc5('0x2'));var sox=require(_0xfcc5('0x3'));var csv=require('to-csv');var ejs=require(_0xfcc5('0x4'));var fs=require('fs');var _=require(_0xfcc5('0x5'));var squel=require(_0xfcc5('0x6'));var crypto=require(_0xfcc5('0x7'));var jsforce=require(_0xfcc5('0x8'));var deskjs=require(_0xfcc5('0x9'));var toCsv=require(_0xfcc5('0xa'));var querystring=require(_0xfcc5('0xb'));var Papa=require('papaparse');var qs=require(_0xfcc5('0xc'));var logger=require(_0xfcc5('0xd'))('api');var utils=require(_0xfcc5('0xe'));var config=require(_0xfcc5('0xf'));var db=require(_0xfcc5('0x10'))['db'];function respondWithStatusCode(_0x48723a,_0x1431d3){_0x1431d3=_0x1431d3||0xcc;return function(_0x1e54c5){if(_0x1e54c5){return _0x48723a[_0xfcc5('0x11')](_0x1431d3);}return _0x48723a[_0xfcc5('0x12')](_0x1431d3)['end']();};}function respondWithResult(_0x2a2da1,_0x4e0988){_0x4e0988=_0x4e0988||0xc8;return function(_0x5a2678){if(_0x5a2678){return _0x2a2da1['status'](_0x4e0988)[_0xfcc5('0x13')](_0x5a2678);}};}function respondWithFilteredResult(_0x42f423,_0x1cf1bb){return function(_0x38a9e7){if(_0x38a9e7){var _0x2b86bb=_0x38a9e7[_0xfcc5('0x14')],_0x9e1c57=_0x1cf1bb[_0xfcc5('0x15')],_0x35c76f=_0x1cf1bb[_0xfcc5('0x15')]+_0x1cf1bb[_0xfcc5('0x16')],_0x3995f3;if(_0x35c76f>=_0x2b86bb){_0x35c76f=_0x2b86bb;_0x3995f3=0xc8;}else{_0x3995f3=0xce;}_0x42f423[_0xfcc5('0x12')](_0x3995f3);return _0x42f423[_0xfcc5('0x17')](_0xfcc5('0x18'),_0x9e1c57+'-'+_0x35c76f+'/'+_0x2b86bb)[_0xfcc5('0x13')](_0x38a9e7);}return null;};}function patchUpdates(_0x50c1d3){return function(_0x25237b){try{jsonpatch[_0xfcc5('0x19')](_0x25237b,_0x50c1d3,!![]);}catch(_0x4ac8e2){return BPromise['reject'](_0x4ac8e2);}return _0x25237b[_0xfcc5('0x1a')]();};}function saveUpdates(_0x47453f,_0x46fb7a){return function(_0x1c2033){if(_0x1c2033){return _0x1c2033[_0xfcc5('0x1b')](_0x47453f)[_0xfcc5('0x1c')](function(_0x5dfd72){return _0x5dfd72;});}return null;};}function removeEntity(_0x373be7,_0x3fda57){return function(_0x38e016){if(_0x38e016){return _0x38e016[_0xfcc5('0x1d')]()[_0xfcc5('0x1c')](function(){_0x373be7[_0xfcc5('0x12')](0xcc)[_0xfcc5('0x1e')]();});}};}function handleEntityNotFound(_0x4c4fbf,_0x50937e){return function(_0x2e2354){if(!_0x2e2354){_0x4c4fbf[_0xfcc5('0x11')](0x194);}return _0x2e2354;};}function handleError(_0x3681e1,_0x1e9442){_0x1e9442=_0x1e9442||0x1f4;return function(_0x408aba){logger[_0xfcc5('0x1f')](_0x408aba[_0xfcc5('0x20')]);if(_0x408aba['name']){delete _0x408aba[_0xfcc5('0x21')];}_0x3681e1[_0xfcc5('0x12')](_0x1e9442)['send'](_0x408aba);};}exports[_0xfcc5('0x22')]=function(_0x221220,_0x125370){var _0x4358a9={},_0x3eac25={},_0x4f1d1d={'count':0x0,'rows':[]};var _0x2a13a2=db[_0xfcc5('0x23')][_0xfcc5('0x24')];_0x3eac25[_0xfcc5('0x25')]=_['keys'](_0x2a13a2);var _0x275ebf={'dateStart':_0x221220['query']['dateStart'],'dateEnd':_0x221220[_0xfcc5('0x26')][_0xfcc5('0x27')]};delete _0x221220['query'][_0xfcc5('0x28')];delete _0x221220[_0xfcc5('0x26')][_0xfcc5('0x27')];_0x3eac25['query']=_['keys'](_0x221220[_0xfcc5('0x26')]);_0x3eac25[_0xfcc5('0x29')]=_[_0xfcc5('0x2a')](_0x3eac25[_0xfcc5('0x25')],_0x3eac25['query']);_0x4358a9[_0xfcc5('0x2b')]=_[_0xfcc5('0x2a')](_0x3eac25[_0xfcc5('0x25')],qs[_0xfcc5('0x2c')](_0x221220['query'][_0xfcc5('0x2c')]));_0x4358a9[_0xfcc5('0x2b')]=_0x4358a9[_0xfcc5('0x2b')]['length']?_0x4358a9['attributes']:_0x3eac25['model'];if(!_0x221220['query'][_0xfcc5('0x2d')](_0xfcc5('0x2e'))){_0x4358a9[_0xfcc5('0x16')]=qs['limit'](_0x221220[_0xfcc5('0x26')][_0xfcc5('0x16')]);_0x4358a9[_0xfcc5('0x15')]=qs[_0xfcc5('0x15')](_0x221220[_0xfcc5('0x26')][_0xfcc5('0x15')]);}_0x4358a9['order']=qs[_0xfcc5('0x2f')](_0x221220[_0xfcc5('0x26')][_0xfcc5('0x2f')]);_0x4358a9['where']=qs[_0xfcc5('0x29')](_[_0xfcc5('0x30')](_0x221220[_0xfcc5('0x26')],_0x3eac25['filters']));if(_0x275ebf[_0xfcc5('0x28')]){if(_0x275ebf['dateEnd']){_0x275ebf[_0xfcc5('0x27')]=moment(_0x275ebf[_0xfcc5('0x27')])[_0xfcc5('0x31')](0x1,'day');}else{_0x275ebf[_0xfcc5('0x27')]=moment(_0x275ebf[_0xfcc5('0x28')])[_0xfcc5('0x31')](0x1,_0xfcc5('0x32'));}_['merge'](_0x4358a9[_0xfcc5('0x33')],{'createdAt':{'$gte':_0x275ebf['dateStart'],'$lte':_0x275ebf[_0xfcc5('0x27')]}});}if(_0x221220[_0xfcc5('0x26')][_0xfcc5('0x34')]){_0x4358a9[_0xfcc5('0x33')]=_[_0xfcc5('0x35')](_0x4358a9['where'],{'$or':_[_0xfcc5('0x36')](_0x4358a9[_0xfcc5('0x2b')],function(_0x343b99){var _0x13984d={};_0x13984d[_0x343b99]={'$like':'%'+_0x221220[_0xfcc5('0x26')][_0xfcc5('0x34')]+'%'};return _0x13984d;})});}_0x4358a9=_[_0xfcc5('0x35')]({},_0x4358a9,_0x221220['options']);var _0x458c1e={'where':_0x4358a9['where']};return db['AnalyticMetric'][_0xfcc5('0x14')](_0x458c1e)[_0xfcc5('0x1c')](function(_0x42a345){_0x4f1d1d[_0xfcc5('0x14')]=_0x42a345;if(_0x221220['query'][_0xfcc5('0x37')]){_0x4358a9[_0xfcc5('0x38')]=[{'all':!![]}];}return db[_0xfcc5('0x23')][_0xfcc5('0x39')](_0x4358a9);})[_0xfcc5('0x1c')](function(_0x44a286){_0x4f1d1d[_0xfcc5('0x3a')]=_0x44a286;return _0x4f1d1d;})[_0xfcc5('0x1c')](respondWithFilteredResult(_0x125370,_0x4358a9))[_0xfcc5('0x3b')](handleError(_0x125370,null));};exports[_0xfcc5('0x3c')]=function(_0x4fffde,_0x4e7693){var _0x224706={'raw':!![],'where':{'id':_0x4fffde[_0xfcc5('0x3d')]['id']}},_0x509bdd={};_0x509bdd[_0xfcc5('0x25')]=_[_0xfcc5('0x3e')](db[_0xfcc5('0x23')][_0xfcc5('0x24')]);_0x509bdd['query']=_[_0xfcc5('0x3e')](_0x4fffde[_0xfcc5('0x26')]);_0x509bdd[_0xfcc5('0x29')]=_[_0xfcc5('0x2a')](_0x509bdd[_0xfcc5('0x25')],_0x509bdd['query']);_0x224706[_0xfcc5('0x2b')]=_[_0xfcc5('0x2a')](_0x509bdd[_0xfcc5('0x25')],qs[_0xfcc5('0x2c')](_0x4fffde[_0xfcc5('0x26')][_0xfcc5('0x2c')]));_0x224706['attributes']=_0x224706['attributes'][_0xfcc5('0x3f')]?_0x224706['attributes']:_0x509bdd[_0xfcc5('0x25')];if(_0x4fffde[_0xfcc5('0x26')][_0xfcc5('0x37')]){_0x224706[_0xfcc5('0x38')]=[{'all':!![]}];}_0x224706=_[_0xfcc5('0x35')]({},_0x224706,_0x4fffde[_0xfcc5('0x40')]);return db['AnalyticMetric'][_0xfcc5('0x41')](_0x224706)[_0xfcc5('0x1c')](handleEntityNotFound(_0x4e7693,null))[_0xfcc5('0x1c')](respondWithResult(_0x4e7693,null))[_0xfcc5('0x3b')](handleError(_0x4e7693,null));};exports[_0xfcc5('0x42')]=function(_0x8ca97b,_0x1c6d8e){return db[_0xfcc5('0x23')][_0xfcc5('0x42')](_0x8ca97b[_0xfcc5('0x43')],{})[_0xfcc5('0x1c')](respondWithResult(_0x1c6d8e,0xc9))[_0xfcc5('0x3b')](handleError(_0x1c6d8e,null));};exports['update']=function(_0x5927a1,_0x3643e2){if(_0x5927a1[_0xfcc5('0x43')]['id']){delete _0x5927a1[_0xfcc5('0x43')]['id'];}return db['AnalyticMetric'][_0xfcc5('0x41')]({'where':{'id':_0x5927a1['params']['id']}})[_0xfcc5('0x1c')](handleEntityNotFound(_0x3643e2,null))['then'](saveUpdates(_0x5927a1[_0xfcc5('0x43')],null))[_0xfcc5('0x1c')](respondWithResult(_0x3643e2,null))[_0xfcc5('0x3b')](handleError(_0x3643e2,null));};exports['destroy']=function(_0x48ca46,_0x4cd76a){return db['AnalyticMetric'][_0xfcc5('0x41')]({'where':{'id':_0x48ca46[_0xfcc5('0x3d')]['id']}})[_0xfcc5('0x1c')](handleEntityNotFound(_0x4cd76a,null))[_0xfcc5('0x1c')](removeEntity(_0x4cd76a,null))[_0xfcc5('0x3b')](handleError(_0x4cd76a,null));}; \ No newline at end of file +var _0xa450=['index','AnalyticMetric','rawAttributes','keys','query','dateEnd','dateStart','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','add','day','filter','merge','map','includeAll','rows','catch','params','include','options','create','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','destroy','then','name','send'];(function(_0x30af6d,_0x1c2ae6){var _0x25d333=function(_0x1f93dc){while(--_0x1f93dc){_0x30af6d['push'](_0x30af6d['shift']());}};_0x25d333(++_0x1c2ae6);}(_0xa450,0x176));var _0x0a45=function(_0x31ed6e,_0x5424a8){_0x31ed6e=_0x31ed6e-0x0;var _0x2908d6=_0xa450[_0x31ed6e];return _0x2908d6;};'use strict';var jsonpatch=require(_0x0a45('0x0'));var rp=require(_0x0a45('0x1'));var moment=require(_0x0a45('0x2'));var BPromise=require(_0x0a45('0x3'));var Mustache=require(_0x0a45('0x4'));var util=require(_0x0a45('0x5'));var path=require(_0x0a45('0x6'));var sox=require(_0x0a45('0x7'));var csv=require(_0x0a45('0x8'));var ejs=require(_0x0a45('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0a45('0xa'));var crypto=require('crypto');var jsforce=require(_0x0a45('0xb'));var deskjs=require(_0x0a45('0xc'));var toCsv=require(_0x0a45('0x8'));var querystring=require('querystring');var Papa=require(_0x0a45('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x0a45('0xe'))(_0x0a45('0xf'));var utils=require(_0x0a45('0x10'));var config=require(_0x0a45('0x11'));var db=require(_0x0a45('0x12'))['db'];function respondWithStatusCode(_0x28ae4e,_0x2cc80a){_0x2cc80a=_0x2cc80a||0xcc;return function(_0x168335){if(_0x168335){return _0x28ae4e[_0x0a45('0x13')](_0x2cc80a);}return _0x28ae4e[_0x0a45('0x14')](_0x2cc80a)[_0x0a45('0x15')]();};}function respondWithResult(_0x379fe4,_0x23390b){_0x23390b=_0x23390b||0xc8;return function(_0x528be9){if(_0x528be9){return _0x379fe4[_0x0a45('0x14')](_0x23390b)[_0x0a45('0x16')](_0x528be9);}};}function respondWithFilteredResult(_0x59e1bc,_0x302053){return function(_0x2d6d35){if(_0x2d6d35){var _0x5d24e3=_0x2d6d35[_0x0a45('0x17')],_0x5cee29=_0x302053['offset'],_0x59439c=_0x302053['offset']+_0x302053[_0x0a45('0x18')],_0xe94f74;if(_0x59439c>=_0x5d24e3){_0x59439c=_0x5d24e3;_0xe94f74=0xc8;}else{_0xe94f74=0xce;}_0x59e1bc['status'](_0xe94f74);return _0x59e1bc[_0x0a45('0x19')](_0x0a45('0x1a'),_0x5cee29+'-'+_0x59439c+'/'+_0x5d24e3)[_0x0a45('0x16')](_0x2d6d35);}return null;};}function patchUpdates(_0xab6e1a){return function(_0x573dd5){try{jsonpatch['apply'](_0x573dd5,_0xab6e1a,!![]);}catch(_0x4a1fbe){return BPromise[_0x0a45('0x1b')](_0x4a1fbe);}return _0x573dd5[_0x0a45('0x1c')]();};}function saveUpdates(_0x1b76cc,_0x21a65b){return function(_0x574f87){if(_0x574f87){return _0x574f87[_0x0a45('0x1d')](_0x1b76cc)['then'](function(_0x579c47){return _0x579c47;});}return null;};}function removeEntity(_0xbaf0df,_0x41c6f4){return function(_0x242a6c){if(_0x242a6c){return _0x242a6c[_0x0a45('0x1e')]()[_0x0a45('0x1f')](function(){_0xbaf0df[_0x0a45('0x14')](0xcc)[_0x0a45('0x15')]();});}};}function handleEntityNotFound(_0x50d1ec,_0x583ed0){return function(_0x225c34){if(!_0x225c34){_0x50d1ec[_0x0a45('0x13')](0x194);}return _0x225c34;};}function handleError(_0x16b498,_0x115dee){_0x115dee=_0x115dee||0x1f4;return function(_0x1080ee){logger['error'](_0x1080ee['stack']);if(_0x1080ee[_0x0a45('0x20')]){delete _0x1080ee[_0x0a45('0x20')];}_0x16b498['status'](_0x115dee)[_0x0a45('0x21')](_0x1080ee);};}exports[_0x0a45('0x22')]=function(_0xe1d99e,_0x4b454f){var _0x268469={},_0x106db6={},_0x2a1523={'count':0x0,'rows':[]};var _0x1206ac=db[_0x0a45('0x23')][_0x0a45('0x24')];_0x106db6['model']=_[_0x0a45('0x25')](_0x1206ac);var _0x3d6236={'dateStart':_0xe1d99e[_0x0a45('0x26')]['dateStart'],'dateEnd':_0xe1d99e[_0x0a45('0x26')][_0x0a45('0x27')]};delete _0xe1d99e[_0x0a45('0x26')][_0x0a45('0x28')];delete _0xe1d99e[_0x0a45('0x26')][_0x0a45('0x27')];_0x106db6[_0x0a45('0x26')]=_[_0x0a45('0x25')](_0xe1d99e['query']);_0x106db6['filters']=_[_0x0a45('0x29')](_0x106db6[_0x0a45('0x2a')],_0x106db6[_0x0a45('0x26')]);_0x268469[_0x0a45('0x2b')]=_[_0x0a45('0x29')](_0x106db6[_0x0a45('0x2a')],qs[_0x0a45('0x2c')](_0xe1d99e[_0x0a45('0x26')][_0x0a45('0x2c')]));_0x268469[_0x0a45('0x2b')]=_0x268469[_0x0a45('0x2b')][_0x0a45('0x2d')]?_0x268469[_0x0a45('0x2b')]:_0x106db6['model'];if(!_0xe1d99e[_0x0a45('0x26')][_0x0a45('0x2e')](_0x0a45('0x2f'))){_0x268469['limit']=qs['limit'](_0xe1d99e[_0x0a45('0x26')][_0x0a45('0x18')]);_0x268469[_0x0a45('0x30')]=qs['offset'](_0xe1d99e[_0x0a45('0x26')]['offset']);}_0x268469[_0x0a45('0x31')]=qs[_0x0a45('0x32')](_0xe1d99e[_0x0a45('0x26')][_0x0a45('0x32')]);_0x268469[_0x0a45('0x33')]=qs[_0x0a45('0x34')](_[_0x0a45('0x35')](_0xe1d99e[_0x0a45('0x26')],_0x106db6[_0x0a45('0x34')]));if(_0x3d6236[_0x0a45('0x28')]){if(_0x3d6236[_0x0a45('0x27')]){_0x3d6236['dateEnd']=moment(_0x3d6236[_0x0a45('0x27')])[_0x0a45('0x36')](0x1,_0x0a45('0x37'));}else{_0x3d6236[_0x0a45('0x27')]=moment(_0x3d6236[_0x0a45('0x28')])[_0x0a45('0x36')](0x1,_0x0a45('0x37'));}_['merge'](_0x268469['where'],{'createdAt':{'$gte':_0x3d6236[_0x0a45('0x28')],'$lte':_0x3d6236[_0x0a45('0x27')]}});}if(_0xe1d99e[_0x0a45('0x26')][_0x0a45('0x38')]){_0x268469[_0x0a45('0x33')]=_[_0x0a45('0x39')](_0x268469[_0x0a45('0x33')],{'$or':_[_0x0a45('0x3a')](_0x268469['attributes'],function(_0x2fd471){var _0x3c2b5e={};_0x3c2b5e[_0x2fd471]={'$like':'%'+_0xe1d99e[_0x0a45('0x26')]['filter']+'%'};return _0x3c2b5e;})});}_0x268469=_['merge']({},_0x268469,_0xe1d99e['options']);var _0x2096a9={'where':_0x268469[_0x0a45('0x33')]};return db[_0x0a45('0x23')][_0x0a45('0x17')](_0x2096a9)[_0x0a45('0x1f')](function(_0x20985b){_0x2a1523[_0x0a45('0x17')]=_0x20985b;if(_0xe1d99e[_0x0a45('0x26')][_0x0a45('0x3b')]){_0x268469['include']=[{'all':!![]}];}return db[_0x0a45('0x23')]['findAll'](_0x268469);})[_0x0a45('0x1f')](function(_0x51d9ef){_0x2a1523[_0x0a45('0x3c')]=_0x51d9ef;return _0x2a1523;})[_0x0a45('0x1f')](respondWithFilteredResult(_0x4b454f,_0x268469))[_0x0a45('0x3d')](handleError(_0x4b454f,null));};exports['show']=function(_0x103a5a,_0xbd924a){var _0x345d70={'raw':!![],'where':{'id':_0x103a5a[_0x0a45('0x3e')]['id']}},_0x46fb2f={};_0x46fb2f['model']=_[_0x0a45('0x25')](db[_0x0a45('0x23')][_0x0a45('0x24')]);_0x46fb2f[_0x0a45('0x26')]=_[_0x0a45('0x25')](_0x103a5a[_0x0a45('0x26')]);_0x46fb2f['filters']=_[_0x0a45('0x29')](_0x46fb2f[_0x0a45('0x2a')],_0x46fb2f[_0x0a45('0x26')]);_0x345d70[_0x0a45('0x2b')]=_[_0x0a45('0x29')](_0x46fb2f[_0x0a45('0x2a')],qs['fields'](_0x103a5a[_0x0a45('0x26')][_0x0a45('0x2c')]));_0x345d70['attributes']=_0x345d70[_0x0a45('0x2b')][_0x0a45('0x2d')]?_0x345d70[_0x0a45('0x2b')]:_0x46fb2f['model'];if(_0x103a5a[_0x0a45('0x26')]['includeAll']){_0x345d70[_0x0a45('0x3f')]=[{'all':!![]}];}_0x345d70=_[_0x0a45('0x39')]({},_0x345d70,_0x103a5a[_0x0a45('0x40')]);return db[_0x0a45('0x23')]['find'](_0x345d70)[_0x0a45('0x1f')](handleEntityNotFound(_0xbd924a,null))[_0x0a45('0x1f')](respondWithResult(_0xbd924a,null))[_0x0a45('0x3d')](handleError(_0xbd924a,null));};exports[_0x0a45('0x41')]=function(_0x408010,_0x1f8ae6){return db[_0x0a45('0x23')][_0x0a45('0x41')](_0x408010[_0x0a45('0x42')],{})[_0x0a45('0x1f')](respondWithResult(_0x1f8ae6,0xc9))[_0x0a45('0x3d')](handleError(_0x1f8ae6,null));};exports[_0x0a45('0x1d')]=function(_0x26e6f8,_0x2198d0){if(_0x26e6f8[_0x0a45('0x42')]['id']){delete _0x26e6f8[_0x0a45('0x42')]['id'];}return db[_0x0a45('0x23')][_0x0a45('0x43')]({'where':{'id':_0x26e6f8['params']['id']}})['then'](handleEntityNotFound(_0x2198d0,null))['then'](saveUpdates(_0x26e6f8[_0x0a45('0x42')],null))[_0x0a45('0x1f')](respondWithResult(_0x2198d0,null))[_0x0a45('0x3d')](handleError(_0x2198d0,null));};exports[_0x0a45('0x1e')]=function(_0x17f1d1,_0x4279b4){return db[_0x0a45('0x23')][_0x0a45('0x43')]({'where':{'id':_0x17f1d1['params']['id']}})['then'](handleEntityNotFound(_0x4279b4,null))[_0x0a45('0x1f')](removeEntity(_0x4279b4,null))[_0x0a45('0x3d')](handleError(_0x4279b4,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 77cada1..d1d4923 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 _0x9c2b=['request-promise','./analyticMetric.attributes','exports','define','analytics_metrics','util','api','moment','bluebird'];(function(_0x52c30a,_0x40107d){var _0x33a05b=function(_0x404d55){while(--_0x404d55){_0x52c30a['push'](_0x52c30a['shift']());}};_0x33a05b(++_0x40107d);}(_0x9c2b,0x1ac));var _0xb9c2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x9c2b[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0xb9c2('0x0'));var logger=require('../../config/logger')(_0xb9c2('0x1'));var moment=require(_0xb9c2('0x2'));var BPromise=require(_0xb9c2('0x3'));var rp=require(_0xb9c2('0x4'));var attributes=require(_0xb9c2('0x5'));module[_0xb9c2('0x6')]=function(_0x17c283,_0x59c4c8){return _0x17c283[_0xb9c2('0x7')]('AnalyticMetric',attributes,{'tableName':_0xb9c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefcf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','define'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0xefcf,0x150));var _0xfefc=function(_0x2db4b2,_0x5a978b){_0x2db4b2=_0x2db4b2-0x0;var _0x1e993b=_0xefcf[_0x2db4b2];return _0x1e993b;};'use strict';var _=require(_0xfefc('0x0'));var util=require(_0xfefc('0x1'));var logger=require(_0xfefc('0x2'))(_0xfefc('0x3'));var moment=require(_0xfefc('0x4'));var BPromise=require(_0xfefc('0x5'));var rp=require(_0xfefc('0x6'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x5e7480,_0x34e465){return _0x5e7480[_0xfefc('0x7')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 95c23d6..74218db 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 _0xa9e0=['error','message','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x33c603,_0x6d0ce4){var _0xae96f4=function(_0x2679f8){while(--_0x2679f8){_0x33c603['push'](_0x33c603['shift']());}};_0xae96f4(++_0x6d0ce4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x219af0,_0x441e3a,_0x2cc193){return new BPromise(function(_0x5f41ea,_0x503809){return client[_0x0a9e('0x9')](_0x219af0,_0x2cc193)['then'](function(_0x52cace){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x441e3a,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x441e3a,_0x0a9e('0xc'),JSON['stringify'](_0x52cace));if(_0x52cace['error']){if(_0x52cace['error']['code']===0x1f4){logger[_0x0a9e('0xf')](_0x0a9e('0xb'),_0x441e3a,_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);return _0x503809(_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);}logger['error'](_0x0a9e('0xb'),_0x441e3a,_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);return _0x5f41ea(_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);}else{logger[_0x0a9e('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x441e3a,_0x0a9e('0xc'));_0x5f41ea(_0x52cace['result'][_0x0a9e('0x10')]);}})['catch'](function(_0x16033c){logger[_0x0a9e('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x441e3a,_0x16033c);_0x503809(_0x16033c);});});} \ No newline at end of file +var _0x9957=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 db=require(_0x7995('0x4'))['db'];var utils=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var jayson=require(_0x7995('0x8'));var client=jayson[_0x7995('0x9')][_0x7995('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219534,_0xbda126,_0x326741){return new BPromise(function(_0x4996ca,_0x465276){return client[_0x7995('0xb')](_0x219534,_0x326741)['then'](function(_0xa2e5f0){logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));logger[_0x7995('0xf')](_0x7995('0x10'),_0xbda126,_0x7995('0xe'),JSON['stringify'](_0xa2e5f0));if(_0xa2e5f0[_0x7995('0x11')]){if(_0xa2e5f0[_0x7995('0x11')]['code']===0x1f4){logger[_0x7995('0x11')](_0x7995('0xd'),_0xbda126,_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);return _0x465276(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}logger[_0x7995('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0xbda126,_0xa2e5f0['error'][_0x7995('0x12')]);return _0x4996ca(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}else{logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));_0x4996ca(_0xa2e5f0[_0x7995('0x13')][_0x7995('0x12')]);}})['catch'](function(_0x2eeacc){logger['error'](_0x7995('0xd'),_0xbda126,_0x2eeacc);_0x465276(_0x2eeacc);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 817ccbc..c57ff99 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 _0x0126=['delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x419c0c,_0x2598ad){var _0x391694=function(_0x530772){while(--_0x530772){_0x419c0c['push'](_0x419c0c['shift']());}};_0x391694(++_0x2598ad);}(_0x0126,0x1cd));var _0x6012=function(_0x43b9aa,_0x347984){_0x43b9aa=_0x43b9aa-0x0;var _0x221cfa=_0x0126[_0x43b9aa];return _0x221cfa;};'use strict';var multer=require(_0x6012('0x0'));var util=require(_0x6012('0x1'));var path=require('path');var express=require(_0x6012('0x2'));var router=express[_0x6012('0x3')]();var auth=require(_0x6012('0x4'));var interaction=require(_0x6012('0x5'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x6012('0x6')]('/',auth[_0x6012('0x7')](),controller[_0x6012('0x8')]);router[_0x6012('0x6')](_0x6012('0x9'),auth['isAuthenticated'](),controller[_0x6012('0xa')]);router[_0x6012('0xb')]('/',auth['isAuthenticated'](),controller[_0x6012('0xc')]);router[_0x6012('0xd')](_0x6012('0x9'),auth[_0x6012('0x7')](),controller[_0x6012('0xe')]);router[_0x6012('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6012('0x10')]);module['exports']=router; \ No newline at end of file +var _0x05af=['express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x05af,0x165));var _0xf05a=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x05af[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0xf05a('0x0'));var util=require(_0xf05a('0x1'));var path=require(_0xf05a('0x2'));var express=require(_0xf05a('0x3'));var router=express[_0xf05a('0x4')]();var auth=require(_0xf05a('0x5'));var interaction=require(_0xf05a('0x6'));var config=require('../../config/environment');var controller=require(_0xf05a('0x7'));router[_0xf05a('0x8')]('/',auth[_0xf05a('0x9')](),controller[_0xf05a('0xa')]);router[_0xf05a('0x8')](_0xf05a('0xb'),auth[_0xf05a('0x9')](),controller[_0xf05a('0xc')]);router['post']('/',auth[_0xf05a('0x9')](),controller['create']);router[_0xf05a('0xd')](_0xf05a('0xb'),auth['isAuthenticated'](),controller[_0xf05a('0xe')]);router[_0xf05a('0xf')](_0xf05a('0xb'),auth[_0xf05a('0x9')](),controller[_0xf05a('0x10')]);module[_0xf05a('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6bb4c2a..75a6793 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 _0x79b6=['sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x79b6,0x136));var _0x679b=function(_0x33766e,_0x2fbb2f){_0x33766e=_0x33766e-0x0;var _0x1c7536=_0x79b6[_0x33766e];return _0x1c7536;};'use strict';var Sequelize=require(_0x679b('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xe7ef=['TEXT'];(function(_0x2cf207,_0x527404){var _0x48137f=function(_0x3b7111){while(--_0x3b7111){_0x2cf207['push'](_0x2cf207['shift']());}};_0x48137f(++_0x527404);}(_0xe7ef,0x19c));var _0xfe7e=function(_0x179f71,_0x1af53f){_0x179f71=_0x179f71-0x0;var _0x4a9c57=_0xe7ef[_0x179f71];return _0x4a9c57;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0xfe7e('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7f620ec..9a019f7 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 _0xb332=['error','stack','name','send','AnalyticTreeReport','rawAttributes','model','query','dateEnd','dateStart','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','day','add','merge','filter','map','options','include','findAll','rows','show','includeAll','find','create','catch','update','body','destroy','params','fast-json-patch','moment','bluebird','mustache','util','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','limit','apply','reject','then'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb332,0x17f));var _0x2b33=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0xb332[_0x47f7ec];return _0x415101;};'use strict';var jsonpatch=require(_0x2b33('0x0'));var rp=require('request-promise');var moment=require(_0x2b33('0x1'));var BPromise=require(_0x2b33('0x2'));var Mustache=require(_0x2b33('0x3'));var util=require(_0x2b33('0x4'));var path=require('path');var sox=require(_0x2b33('0x5'));var csv=require(_0x2b33('0x6'));var ejs=require(_0x2b33('0x7'));var fs=require('fs');var _=require(_0x2b33('0x8'));var squel=require(_0x2b33('0x9'));var crypto=require(_0x2b33('0xa'));var jsforce=require(_0x2b33('0xb'));var deskjs=require(_0x2b33('0xc'));var toCsv=require(_0x2b33('0x6'));var querystring=require(_0x2b33('0xd'));var Papa=require(_0x2b33('0xe'));var qs=require(_0x2b33('0xf'));var logger=require(_0x2b33('0x10'))(_0x2b33('0x11'));var utils=require(_0x2b33('0x12'));var config=require(_0x2b33('0x13'));var db=require(_0x2b33('0x14'))['db'];function respondWithStatusCode(_0x24640f,_0xbbba34){_0xbbba34=_0xbbba34||0xcc;return function(_0x16cbb6){if(_0x16cbb6){return _0x24640f[_0x2b33('0x15')](_0xbbba34);}return _0x24640f[_0x2b33('0x16')](_0xbbba34)[_0x2b33('0x17')]();};}function respondWithResult(_0x30d0da,_0x417895){_0x417895=_0x417895||0xc8;return function(_0x52229f){if(_0x52229f){return _0x30d0da[_0x2b33('0x16')](_0x417895)[_0x2b33('0x18')](_0x52229f);}};}function respondWithFilteredResult(_0x545a05,_0x3b9ffc){return function(_0x49a497){if(_0x49a497){var _0x3afa14=_0x49a497[_0x2b33('0x19')],_0x2f1396=_0x3b9ffc[_0x2b33('0x1a')],_0x59b69a=_0x3b9ffc['offset']+_0x3b9ffc[_0x2b33('0x1b')],_0x1b3ffc;if(_0x59b69a>=_0x3afa14){_0x59b69a=_0x3afa14;_0x1b3ffc=0xc8;}else{_0x1b3ffc=0xce;}_0x545a05[_0x2b33('0x16')](_0x1b3ffc);return _0x545a05['set']('Content-Range',_0x2f1396+'-'+_0x59b69a+'/'+_0x3afa14)[_0x2b33('0x18')](_0x49a497);}return null;};}function patchUpdates(_0x4202f6){return function(_0x402c61){try{jsonpatch[_0x2b33('0x1c')](_0x402c61,_0x4202f6,!![]);}catch(_0x271c59){return BPromise[_0x2b33('0x1d')](_0x271c59);}return _0x402c61['save']();};}function saveUpdates(_0x1d1543,_0x20606c){return function(_0x38defa){if(_0x38defa){return _0x38defa['update'](_0x1d1543)[_0x2b33('0x1e')](function(_0x19aef0){return _0x19aef0;});}return null;};}function removeEntity(_0x345024,_0x50fb09){return function(_0x5d688a){if(_0x5d688a){return _0x5d688a['destroy']()[_0x2b33('0x1e')](function(){_0x345024[_0x2b33('0x16')](0xcc)[_0x2b33('0x17')]();});}};}function handleEntityNotFound(_0x51034e,_0x21852f){return function(_0x3c2d64){if(!_0x3c2d64){_0x51034e['sendStatus'](0x194);}return _0x3c2d64;};}function handleError(_0x1f4554,_0x291818){_0x291818=_0x291818||0x1f4;return function(_0x53f8dc){logger[_0x2b33('0x1f')](_0x53f8dc[_0x2b33('0x20')]);if(_0x53f8dc[_0x2b33('0x21')]){delete _0x53f8dc[_0x2b33('0x21')];}_0x1f4554[_0x2b33('0x16')](_0x291818)[_0x2b33('0x22')](_0x53f8dc);};}exports['index']=function(_0x25c955,_0x37fc3a){var _0x44bd2a={},_0x4fa744={},_0xeefefa={'count':0x0,'rows':[]};var _0x26e223=db[_0x2b33('0x23')][_0x2b33('0x24')];_0x4fa744[_0x2b33('0x25')]=_['keys'](_0x26e223);var _0x171d48={'dateStart':_0x25c955[_0x2b33('0x26')]['dateStart'],'dateEnd':_0x25c955[_0x2b33('0x26')][_0x2b33('0x27')]};delete _0x25c955[_0x2b33('0x26')][_0x2b33('0x28')];delete _0x25c955['query'][_0x2b33('0x27')];_0x4fa744[_0x2b33('0x26')]=_[_0x2b33('0x29')](_0x25c955['query']);_0x4fa744['filters']=_[_0x2b33('0x2a')](_0x4fa744[_0x2b33('0x25')],_0x4fa744[_0x2b33('0x26')]);_0x44bd2a[_0x2b33('0x2b')]=_['intersection'](_0x4fa744['model'],qs[_0x2b33('0x2c')](_0x25c955[_0x2b33('0x26')]['fields']));_0x44bd2a['attributes']=_0x44bd2a[_0x2b33('0x2b')][_0x2b33('0x2d')]?_0x44bd2a[_0x2b33('0x2b')]:_0x4fa744[_0x2b33('0x25')];if(!_0x25c955['query'][_0x2b33('0x2e')](_0x2b33('0x2f'))){_0x44bd2a[_0x2b33('0x1b')]=qs['limit'](_0x25c955[_0x2b33('0x26')][_0x2b33('0x1b')]);_0x44bd2a[_0x2b33('0x1a')]=qs[_0x2b33('0x1a')](_0x25c955[_0x2b33('0x26')][_0x2b33('0x1a')]);}_0x44bd2a['order']=qs[_0x2b33('0x30')](_0x25c955[_0x2b33('0x26')]['sort']);_0x44bd2a[_0x2b33('0x31')]=qs[_0x2b33('0x32')](_['pick'](_0x25c955[_0x2b33('0x26')],_0x4fa744[_0x2b33('0x32')]));if(_0x171d48[_0x2b33('0x28')]){if(_0x171d48[_0x2b33('0x27')]){_0x171d48[_0x2b33('0x27')]=moment(_0x171d48[_0x2b33('0x27')])['add'](0x1,_0x2b33('0x33'));}else{_0x171d48[_0x2b33('0x27')]=moment(_0x171d48[_0x2b33('0x28')])[_0x2b33('0x34')](0x1,'day');}_[_0x2b33('0x35')](_0x44bd2a[_0x2b33('0x31')],{'createdAt':{'$gte':_0x171d48['dateStart'],'$lte':_0x171d48[_0x2b33('0x27')]}});}if(_0x25c955[_0x2b33('0x26')][_0x2b33('0x36')]){_0x44bd2a[_0x2b33('0x31')]=_[_0x2b33('0x35')](_0x44bd2a[_0x2b33('0x31')],{'$or':_[_0x2b33('0x37')](_0x44bd2a[_0x2b33('0x2b')],function(_0x28751b){var _0x3e1c5c={};_0x3e1c5c[_0x28751b]={'$like':'%'+_0x25c955['query'][_0x2b33('0x36')]+'%'};return _0x3e1c5c;})});}_0x44bd2a=_[_0x2b33('0x35')]({},_0x44bd2a,_0x25c955[_0x2b33('0x38')]);var _0x2cb1d6={'where':_0x44bd2a[_0x2b33('0x31')]};return db['AnalyticTreeReport']['count'](_0x2cb1d6)['then'](function(_0x10d70c){_0xeefefa[_0x2b33('0x19')]=_0x10d70c;if(_0x25c955[_0x2b33('0x26')]['includeAll']){_0x44bd2a[_0x2b33('0x39')]=[{'all':!![]}];}return db[_0x2b33('0x23')][_0x2b33('0x3a')](_0x44bd2a);})[_0x2b33('0x1e')](function(_0xfd63b8){_0xeefefa[_0x2b33('0x3b')]=_0xfd63b8;return _0xeefefa;})['then'](respondWithFilteredResult(_0x37fc3a,_0x44bd2a))['catch'](handleError(_0x37fc3a,null));};exports[_0x2b33('0x3c')]=function(_0x5efd12,_0x36b075){var _0x28410e={'raw':!![],'where':{'id':_0x5efd12['params']['id']}},_0x30ba7e={};_0x30ba7e[_0x2b33('0x25')]=_[_0x2b33('0x29')](db['AnalyticTreeReport'][_0x2b33('0x24')]);_0x30ba7e[_0x2b33('0x26')]=_['keys'](_0x5efd12[_0x2b33('0x26')]);_0x30ba7e[_0x2b33('0x32')]=_[_0x2b33('0x2a')](_0x30ba7e['model'],_0x30ba7e[_0x2b33('0x26')]);_0x28410e[_0x2b33('0x2b')]=_[_0x2b33('0x2a')](_0x30ba7e[_0x2b33('0x25')],qs[_0x2b33('0x2c')](_0x5efd12[_0x2b33('0x26')][_0x2b33('0x2c')]));_0x28410e['attributes']=_0x28410e[_0x2b33('0x2b')][_0x2b33('0x2d')]?_0x28410e['attributes']:_0x30ba7e[_0x2b33('0x25')];if(_0x5efd12[_0x2b33('0x26')][_0x2b33('0x3d')]){_0x28410e[_0x2b33('0x39')]=[{'all':!![]}];}_0x28410e=_[_0x2b33('0x35')]({},_0x28410e,_0x5efd12[_0x2b33('0x38')]);return db['AnalyticTreeReport'][_0x2b33('0x3e')](_0x28410e)[_0x2b33('0x1e')](handleEntityNotFound(_0x36b075,null))[_0x2b33('0x1e')](respondWithResult(_0x36b075,null))['catch'](handleError(_0x36b075,null));};exports[_0x2b33('0x3f')]=function(_0x3c5438,_0xf323bb){return db[_0x2b33('0x23')][_0x2b33('0x3f')](_0x3c5438['body'],{})['then'](respondWithResult(_0xf323bb,0xc9))[_0x2b33('0x40')](handleError(_0xf323bb,null));};exports[_0x2b33('0x41')]=function(_0x4c5670,_0x54f15a){if(_0x4c5670[_0x2b33('0x42')]['id']){delete _0x4c5670[_0x2b33('0x42')]['id'];}return db['AnalyticTreeReport'][_0x2b33('0x3e')]({'where':{'id':_0x4c5670['params']['id']}})[_0x2b33('0x1e')](handleEntityNotFound(_0x54f15a,null))[_0x2b33('0x1e')](saveUpdates(_0x4c5670[_0x2b33('0x42')],null))['then'](respondWithResult(_0x54f15a,null))[_0x2b33('0x40')](handleError(_0x54f15a,null));};exports[_0x2b33('0x43')]=function(_0x1441cc,_0x310ec5){return db[_0x2b33('0x23')][_0x2b33('0x3e')]({'where':{'id':_0x1441cc[_0x2b33('0x44')]['id']}})['then'](handleEntityNotFound(_0x310ec5,null))[_0x2b33('0x1e')](removeEntity(_0x310ec5,null))['catch'](handleError(_0x310ec5,null));}; \ No newline at end of file +var _0x0af9=['path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','name','send','index','AnalyticTreeReport','keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','request-promise','moment','bluebird','mustache','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0af9,0x87));var _0x90af=function(_0x10ed68,_0x5cd53c){_0x10ed68=_0x10ed68-0x0;var _0x4c4ebc=_0x0af9[_0x10ed68];return _0x4c4ebc;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x90af('0x0'));var moment=require(_0x90af('0x1'));var BPromise=require(_0x90af('0x2'));var Mustache=require(_0x90af('0x3'));var util=require(_0x90af('0x4'));var path=require(_0x90af('0x5'));var sox=require(_0x90af('0x6'));var csv=require(_0x90af('0x7'));var ejs=require(_0x90af('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x90af('0x9'));var crypto=require('crypto');var jsforce=require(_0x90af('0xa'));var deskjs=require(_0x90af('0xb'));var toCsv=require(_0x90af('0x7'));var querystring=require(_0x90af('0xc'));var Papa=require(_0x90af('0xd'));var qs=require(_0x90af('0xe'));var logger=require(_0x90af('0xf'))(_0x90af('0x10'));var utils=require(_0x90af('0x11'));var config=require(_0x90af('0x12'));var db=require(_0x90af('0x13'))['db'];function respondWithStatusCode(_0x415df9,_0x5a344e){_0x5a344e=_0x5a344e||0xcc;return function(_0x1e45dd){if(_0x1e45dd){return _0x415df9[_0x90af('0x14')](_0x5a344e);}return _0x415df9[_0x90af('0x15')](_0x5a344e)[_0x90af('0x16')]();};}function respondWithResult(_0x1da49d,_0x187e4d){_0x187e4d=_0x187e4d||0xc8;return function(_0x7f27fd){if(_0x7f27fd){return _0x1da49d[_0x90af('0x15')](_0x187e4d)[_0x90af('0x17')](_0x7f27fd);}};}function respondWithFilteredResult(_0x1657e6,_0x5b50fe){return function(_0x1121e2){if(_0x1121e2){var _0x16a59=_0x1121e2[_0x90af('0x18')],_0x5db2b9=_0x5b50fe[_0x90af('0x19')],_0x5db8e2=_0x5b50fe[_0x90af('0x19')]+_0x5b50fe[_0x90af('0x1a')],_0x5602a9;if(_0x5db8e2>=_0x16a59){_0x5db8e2=_0x16a59;_0x5602a9=0xc8;}else{_0x5602a9=0xce;}_0x1657e6[_0x90af('0x15')](_0x5602a9);return _0x1657e6[_0x90af('0x1b')]('Content-Range',_0x5db2b9+'-'+_0x5db8e2+'/'+_0x16a59)[_0x90af('0x17')](_0x1121e2);}return null;};}function patchUpdates(_0x4d8bf3){return function(_0x442833){try{jsonpatch[_0x90af('0x1c')](_0x442833,_0x4d8bf3,!![]);}catch(_0x525a14){return BPromise[_0x90af('0x1d')](_0x525a14);}return _0x442833['save']();};}function saveUpdates(_0x328807,_0x27870e){return function(_0x33d921){if(_0x33d921){return _0x33d921[_0x90af('0x1e')](_0x328807)[_0x90af('0x1f')](function(_0x4435d4){return _0x4435d4;});}return null;};}function removeEntity(_0x4fbf9a,_0x13f0e0){return function(_0x12c594){if(_0x12c594){return _0x12c594[_0x90af('0x20')]()[_0x90af('0x1f')](function(){_0x4fbf9a[_0x90af('0x15')](0xcc)[_0x90af('0x16')]();});}};}function handleEntityNotFound(_0x45d0b8,_0x3fe651){return function(_0x452c01){if(!_0x452c01){_0x45d0b8[_0x90af('0x14')](0x194);}return _0x452c01;};}function handleError(_0x4608d5,_0x103cf3){_0x103cf3=_0x103cf3||0x1f4;return function(_0xa3d2a){logger['error'](_0xa3d2a['stack']);if(_0xa3d2a[_0x90af('0x21')]){delete _0xa3d2a[_0x90af('0x21')];}_0x4608d5['status'](_0x103cf3)[_0x90af('0x22')](_0xa3d2a);};}exports[_0x90af('0x23')]=function(_0x3a8c29,_0x90ab7){var _0xfcda83={},_0x297455={},_0x4ab20c={'count':0x0,'rows':[]};var _0x36cb59=db[_0x90af('0x24')]['rawAttributes'];_0x297455['model']=_[_0x90af('0x25')](_0x36cb59);var _0x3e0f06={'dateStart':_0x3a8c29['query']['dateStart'],'dateEnd':_0x3a8c29[_0x90af('0x26')][_0x90af('0x27')]};delete _0x3a8c29['query'][_0x90af('0x28')];delete _0x3a8c29['query'][_0x90af('0x27')];_0x297455['query']=_[_0x90af('0x25')](_0x3a8c29[_0x90af('0x26')]);_0x297455[_0x90af('0x29')]=_[_0x90af('0x2a')](_0x297455[_0x90af('0x2b')],_0x297455[_0x90af('0x26')]);_0xfcda83['attributes']=_[_0x90af('0x2a')](_0x297455['model'],qs['fields'](_0x3a8c29[_0x90af('0x26')][_0x90af('0x2c')]));_0xfcda83[_0x90af('0x2d')]=_0xfcda83[_0x90af('0x2d')][_0x90af('0x2e')]?_0xfcda83[_0x90af('0x2d')]:_0x297455[_0x90af('0x2b')];if(!_0x3a8c29[_0x90af('0x26')][_0x90af('0x2f')](_0x90af('0x30'))){_0xfcda83['limit']=qs[_0x90af('0x1a')](_0x3a8c29[_0x90af('0x26')][_0x90af('0x1a')]);_0xfcda83[_0x90af('0x19')]=qs[_0x90af('0x19')](_0x3a8c29[_0x90af('0x26')][_0x90af('0x19')]);}_0xfcda83[_0x90af('0x31')]=qs['sort'](_0x3a8c29[_0x90af('0x26')][_0x90af('0x32')]);_0xfcda83[_0x90af('0x33')]=qs[_0x90af('0x29')](_[_0x90af('0x34')](_0x3a8c29[_0x90af('0x26')],_0x297455['filters']));if(_0x3e0f06[_0x90af('0x28')]){if(_0x3e0f06[_0x90af('0x27')]){_0x3e0f06['dateEnd']=moment(_0x3e0f06[_0x90af('0x27')])['add'](0x1,_0x90af('0x35'));}else{_0x3e0f06[_0x90af('0x27')]=moment(_0x3e0f06['dateStart'])[_0x90af('0x36')](0x1,_0x90af('0x35'));}_[_0x90af('0x37')](_0xfcda83['where'],{'createdAt':{'$gte':_0x3e0f06[_0x90af('0x28')],'$lte':_0x3e0f06[_0x90af('0x27')]}});}if(_0x3a8c29['query'][_0x90af('0x38')]){_0xfcda83[_0x90af('0x33')]=_['merge'](_0xfcda83[_0x90af('0x33')],{'$or':_[_0x90af('0x39')](_0xfcda83[_0x90af('0x2d')],function(_0x56f04e){var _0x3eaf5e={};_0x3eaf5e[_0x56f04e]={'$like':'%'+_0x3a8c29['query'][_0x90af('0x38')]+'%'};return _0x3eaf5e;})});}_0xfcda83=_[_0x90af('0x37')]({},_0xfcda83,_0x3a8c29[_0x90af('0x3a')]);var _0x3137ce={'where':_0xfcda83[_0x90af('0x33')]};return db[_0x90af('0x24')][_0x90af('0x18')](_0x3137ce)[_0x90af('0x1f')](function(_0x3dd7a0){_0x4ab20c[_0x90af('0x18')]=_0x3dd7a0;if(_0x3a8c29[_0x90af('0x26')][_0x90af('0x3b')]){_0xfcda83[_0x90af('0x3c')]=[{'all':!![]}];}return db[_0x90af('0x24')][_0x90af('0x3d')](_0xfcda83);})[_0x90af('0x1f')](function(_0x383260){_0x4ab20c[_0x90af('0x3e')]=_0x383260;return _0x4ab20c;})[_0x90af('0x1f')](respondWithFilteredResult(_0x90ab7,_0xfcda83))[_0x90af('0x3f')](handleError(_0x90ab7,null));};exports[_0x90af('0x40')]=function(_0x3ec6a3,_0x5af478){var _0x9a57b5={'raw':!![],'where':{'id':_0x3ec6a3['params']['id']}},_0x7b77cf={};_0x7b77cf['model']=_[_0x90af('0x25')](db[_0x90af('0x24')][_0x90af('0x41')]);_0x7b77cf[_0x90af('0x26')]=_[_0x90af('0x25')](_0x3ec6a3[_0x90af('0x26')]);_0x7b77cf['filters']=_[_0x90af('0x2a')](_0x7b77cf[_0x90af('0x2b')],_0x7b77cf[_0x90af('0x26')]);_0x9a57b5[_0x90af('0x2d')]=_['intersection'](_0x7b77cf[_0x90af('0x2b')],qs[_0x90af('0x2c')](_0x3ec6a3[_0x90af('0x26')][_0x90af('0x2c')]));_0x9a57b5['attributes']=_0x9a57b5['attributes']['length']?_0x9a57b5[_0x90af('0x2d')]:_0x7b77cf['model'];if(_0x3ec6a3[_0x90af('0x26')][_0x90af('0x3b')]){_0x9a57b5[_0x90af('0x3c')]=[{'all':!![]}];}_0x9a57b5=_['merge']({},_0x9a57b5,_0x3ec6a3[_0x90af('0x3a')]);return db[_0x90af('0x24')][_0x90af('0x42')](_0x9a57b5)[_0x90af('0x1f')](handleEntityNotFound(_0x5af478,null))['then'](respondWithResult(_0x5af478,null))[_0x90af('0x3f')](handleError(_0x5af478,null));};exports[_0x90af('0x43')]=function(_0x54e6d3,_0x39484e){return db[_0x90af('0x24')]['create'](_0x54e6d3['body'],{})[_0x90af('0x1f')](respondWithResult(_0x39484e,0xc9))[_0x90af('0x3f')](handleError(_0x39484e,null));};exports['update']=function(_0x75911d,_0x4c9291){if(_0x75911d[_0x90af('0x44')]['id']){delete _0x75911d[_0x90af('0x44')]['id'];}return db[_0x90af('0x24')]['find']({'where':{'id':_0x75911d['params']['id']}})['then'](handleEntityNotFound(_0x4c9291,null))[_0x90af('0x1f')](saveUpdates(_0x75911d[_0x90af('0x44')],null))[_0x90af('0x1f')](respondWithResult(_0x4c9291,null))[_0x90af('0x3f')](handleError(_0x4c9291,null));};exports[_0x90af('0x20')]=function(_0x220fa8,_0x1f91a3){return db[_0x90af('0x24')][_0x90af('0x42')]({'where':{'id':_0x220fa8[_0x90af('0x45')]['id']}})[_0x90af('0x1f')](handleEntityNotFound(_0x1f91a3,null))[_0x90af('0x1f')](removeEntity(_0x1f91a3,null))['catch'](handleError(_0x1f91a3,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 31b4d42..2b8e67e 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 _0x1d78=['AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','./analyticTreeReport.attributes','define'];(function(_0x23338e,_0xaa5a7b){var _0x3d953d=function(_0x3da274){while(--_0x3da274){_0x23338e['push'](_0x23338e['shift']());}};_0x3d953d(++_0xaa5a7b);}(_0x1d78,0x82));var _0x81d7=function(_0x5a3bfa,_0x1ad6d2){_0x5a3bfa=_0x5a3bfa-0x0;var _0x1a47ec=_0x1d78[_0x5a3bfa];return _0x1a47ec;};'use strict';var _=require('lodash');var util=require(_0x81d7('0x0'));var logger=require(_0x81d7('0x1'))(_0x81d7('0x2'));var moment=require('moment');var BPromise=require(_0x81d7('0x3'));var rp=require('request-promise');var attributes=require(_0x81d7('0x4'));module['exports']=function(_0x4d8795,_0x161d21){return _0x4d8795[_0x81d7('0x5')](_0x81d7('0x6'),attributes,{'tableName':_0x81d7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac83=['util','bluebird','request-promise','./analyticTreeReport.attributes','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x46890c,_0x3d5a6d){var _0x32a474=function(_0x5ea435){while(--_0x5ea435){_0x46890c['push'](_0x46890c['shift']());}};_0x32a474(++_0x3d5a6d);}(_0xac83,0xed));var _0x3ac8=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0xac83[_0x4b8156];return _0x4a819c;};'use strict';var _=require(_0x3ac8('0x0'));var util=require(_0x3ac8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3ac8('0x2'));var rp=require(_0x3ac8('0x3'));var attributes=require(_0x3ac8('0x4'));module['exports']=function(_0x3f5552,_0x4c479d){return _0x3f5552['define'](_0x3ac8('0x5'),attributes,{'tableName':_0x3ac8('0x6'),'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 ee00425..6e06549 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 _0x772f=['AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','then','info'];(function(_0xf2726b,_0x87deb7){var _0xa61a5=function(_0x27759c){while(--_0x27759c){_0xf2726b['push'](_0xf2726b['shift']());}};_0xa61a5(++_0x87deb7);}(_0x772f,0xcf));var _0xf772=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0x772f[_0x82140];return _0x2b15a6;};'use strict';var _=require(_0xf772('0x0'));var util=require('util');var moment=require(_0xf772('0x1'));var BPromise=require(_0xf772('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xf772('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf772('0x4'))(_0xf772('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf772('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x21065c,_0x57baf4,_0x47439c){return new BPromise(function(_0x2ed16a,_0x1f12ed){return client['request'](_0x21065c,_0x47439c)[_0xf772('0x7')](function(_0x31265b){logger[_0xf772('0x8')](_0xf772('0x9'),_0x57baf4,'request\x20sent');logger[_0xf772('0xa')](_0xf772('0xb'),_0x57baf4,_0xf772('0xc'),JSON['stringify'](_0x31265b));if(_0x31265b[_0xf772('0xd')]){if(_0x31265b[_0xf772('0xd')][_0xf772('0xe')]===0x1f4){logger[_0xf772('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x57baf4,_0x31265b['error'][_0xf772('0xf')]);return _0x1f12ed(_0x31265b['error']['message']);}logger[_0xf772('0xd')](_0xf772('0x9'),_0x57baf4,_0x31265b['error'][_0xf772('0xf')]);return _0x2ed16a(_0x31265b['error'][_0xf772('0xf')]);}else{logger[_0xf772('0x8')](_0xf772('0x9'),_0x57baf4,_0xf772('0xc'));_0x2ed16a(_0x31265b[_0xf772('0x10')][_0xf772('0xf')]);}})[_0xf772('0x11')](function(_0x12d5df){logger[_0xf772('0xd')](_0xf772('0x9'),_0x57baf4,_0x12d5df);_0x1f12ed(_0x12d5df);});});} \ No newline at end of file +var _0xd20d=['AnalyticTreeReport,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x4be116,_0x44e2df){var _0x216c01=function(_0x428012){while(--_0x428012){_0x4be116['push'](_0x4be116['shift']());}};_0x216c01(++_0x44e2df);}(_0xd20d,0x1d6));var _0xdd20=function(_0x23853e,_0x299fb8){_0x23853e=_0x23853e-0x0;var _0x3bf651=_0xd20d[_0x23853e];return _0x3bf651;};'use strict';var _=require(_0xdd20('0x0'));var util=require('util');var moment=require(_0xdd20('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd20('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdd20('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd20('0x4'));var client=jayson[_0xdd20('0x5')][_0xdd20('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x512d45,_0x2a9ca0,_0x54435f){return new BPromise(function(_0x14cf79,_0x58a87f){return client[_0xdd20('0x7')](_0x512d45,_0x54435f)[_0xdd20('0x8')](function(_0x25210c){logger[_0xdd20('0x9')](_0xdd20('0xa'),_0x2a9ca0,'request\x20sent');logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x2a9ca0,'request\x20sent',JSON['stringify'](_0x25210c));if(_0x25210c['error']){if(_0x25210c[_0xdd20('0xb')]['code']===0x1f4){logger[_0xdd20('0xb')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2a9ca0,_0x25210c[_0xdd20('0xb')]['message']);return _0x58a87f(_0x25210c[_0xdd20('0xb')][_0xdd20('0xc')]);}logger[_0xdd20('0xb')](_0xdd20('0xa'),_0x2a9ca0,_0x25210c['error']['message']);return _0x14cf79(_0x25210c['error'][_0xdd20('0xc')]);}else{logger['info'](_0xdd20('0xa'),_0x2a9ca0,'request\x20sent');_0x14cf79(_0x25210c[_0xdd20('0xd')][_0xdd20('0xc')]);}})[_0xdd20('0xe')](function(_0x2f5a07){logger[_0xdd20('0xb')](_0xdd20('0xa'),_0x2a9ca0,_0x2f5a07);_0x58a87f(_0x2f5a07);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 69e97e0..ab6f82e 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 _0x7ecb=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','update'];(function(_0x160e13,_0x1bf21d){var _0xe63c28=function(_0x5c6723){while(--_0x5c6723){_0x160e13['push'](_0x160e13['shift']());}};_0xe63c28(++_0x1bf21d);}(_0x7ecb,0xbe));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb7ec('0x0'));var util=require(_0xb7ec('0x1'));var path=require(_0xb7ec('0x2'));var express=require(_0xb7ec('0x3'));var router=express[_0xb7ec('0x4')]();var auth=require(_0xb7ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb7ec('0x6'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0xb7ec('0x7')](),controller[_0xb7ec('0x8')]);router[_0xb7ec('0x9')](_0xb7ec('0xa'),auth[_0xb7ec('0x7')](),controller[_0xb7ec('0xb')]);router['post']('/',auth[_0xb7ec('0x7')](),controller[_0xb7ec('0xc')]);router['put'](_0xb7ec('0xa'),auth[_0xb7ec('0x7')](),controller[_0xb7ec('0xd')]);router[_0xb7ec('0xe')](_0xb7ec('0xa'),auth[_0xb7ec('0x7')](),controller[_0xb7ec('0xf')]);module[_0xb7ec('0x10')]=router; \ No newline at end of file +var _0xff67=['Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x456551,_0x4c9050){var _0x1af692=function(_0x2dabdd){while(--_0x2dabdd){_0x456551['push'](_0x456551['shift']());}};_0x1af692(++_0x4c9050);}(_0xff67,0x1c8));var _0x7ff6=function(_0x2f7fc7,_0x4f2a36){_0x2f7fc7=_0x2f7fc7-0x0;var _0x1fbe8d=_0xff67[_0x2f7fc7];return _0x1fbe8d;};'use strict';var multer=require(_0x7ff6('0x0'));var util=require(_0x7ff6('0x1'));var path=require(_0x7ff6('0x2'));var express=require('express');var router=express[_0x7ff6('0x3')]();var auth=require(_0x7ff6('0x4'));var interaction=require(_0x7ff6('0x5'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x7ff6('0x6')](),controller[_0x7ff6('0x7')]);router[_0x7ff6('0x8')](_0x7ff6('0x9'),auth[_0x7ff6('0x6')](),controller[_0x7ff6('0xa')]);router[_0x7ff6('0xb')]('/',auth[_0x7ff6('0x6')](),controller[_0x7ff6('0xc')]);router[_0x7ff6('0xd')](_0x7ff6('0x9'),auth[_0x7ff6('0x6')](),controller[_0x7ff6('0xe')]);router['delete'](_0x7ff6('0x9'),auth['isAuthenticated'](),controller[_0x7ff6('0xf')]);module[_0x7ff6('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 da7839e..94e60c1 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 _0x3649=['sequelize','STRING'];(function(_0x37e5b7,_0x349484){var _0x3d7260=function(_0x2b6c34){while(--_0x2b6c34){_0x37e5b7['push'](_0x37e5b7['shift']());}};_0x3d7260(++_0x349484);}(_0x3649,0x1d6));var _0x9364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3649[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x9364('0x0'));module['exports']={'name':{'type':Sequelize[_0x9364('0x1')]},'basename':{'type':Sequelize[_0x9364('0x1')]},'type':{'type':Sequelize[_0x9364('0x1')]}}; \ No newline at end of file +var _0xb08d=['exports','STRING','sequelize'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xb08d,0xad));var _0xdb08=function(_0x24d6da,_0x2eb754){_0x24d6da=_0x24d6da-0x0;var _0x3e4e6c=_0xb08d[_0x24d6da];return _0x3e4e6c;};'use strict';var Sequelize=require(_0xdb08('0x0'));module[_0xdb08('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xdb08('0x2')]},'type':{'type':Sequelize[_0xdb08('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 6745b50..07e156b 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 _0xabe3=['basename','filename','type','mimetype','create','download','join','root','server/files/attachments/','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','Attachment','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','day','merge','filter','options','include','findAll','rows','catch','show','length','includeAll','body','find','params','file'];(function(_0x22f878,_0x2260ba){var _0x10fc55=function(_0x32e2a2){while(--_0x32e2a2){_0x22f878['push'](_0x22f878['shift']());}};_0x10fc55(++_0x2260ba);}(_0xabe3,0x9d));var _0x3abe=function(_0x12a147,_0x2404d5){_0x12a147=_0x12a147-0x0;var _0x430e81=_0xabe3[_0x12a147];return _0x430e81;};'use strict';var jsonpatch=require(_0x3abe('0x0'));var rp=require(_0x3abe('0x1'));var moment=require(_0x3abe('0x2'));var BPromise=require(_0x3abe('0x3'));var Mustache=require(_0x3abe('0x4'));var util=require('util');var path=require(_0x3abe('0x5'));var sox=require('sox');var csv=require(_0x3abe('0x6'));var ejs=require(_0x3abe('0x7'));var fs=require('fs');var _=require(_0x3abe('0x8'));var squel=require('squel');var crypto=require(_0x3abe('0x9'));var jsforce=require(_0x3abe('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3abe('0x6'));var querystring=require(_0x3abe('0xb'));var Papa=require('papaparse');var qs=require(_0x3abe('0xc'));var logger=require(_0x3abe('0xd'))(_0x3abe('0xe'));var utils=require(_0x3abe('0xf'));var config=require(_0x3abe('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e809b,_0x5dc81e){_0x5dc81e=_0x5dc81e||0xcc;return function(_0x5aaa18){if(_0x5aaa18){return _0x2e809b[_0x3abe('0x11')](_0x5dc81e);}return _0x2e809b[_0x3abe('0x12')](_0x5dc81e)[_0x3abe('0x13')]();};}function respondWithResult(_0x54d1a1,_0x5366db){_0x5366db=_0x5366db||0xc8;return function(_0x14871b){if(_0x14871b){return _0x54d1a1['status'](_0x5366db)[_0x3abe('0x14')](_0x14871b);}};}function respondWithFilteredResult(_0x2a1f34,_0x1744d3){return function(_0x4b65bb){if(_0x4b65bb){var _0x4b0c7c=_0x4b65bb[_0x3abe('0x15')],_0x29afdb=_0x1744d3[_0x3abe('0x16')],_0x402986=_0x1744d3['offset']+_0x1744d3[_0x3abe('0x17')],_0x191213;if(_0x402986>=_0x4b0c7c){_0x402986=_0x4b0c7c;_0x191213=0xc8;}else{_0x191213=0xce;}_0x2a1f34[_0x3abe('0x12')](_0x191213);return _0x2a1f34[_0x3abe('0x18')](_0x3abe('0x19'),_0x29afdb+'-'+_0x402986+'/'+_0x4b0c7c)[_0x3abe('0x14')](_0x4b65bb);}return null;};}function patchUpdates(_0x465e9b){return function(_0x165853){try{jsonpatch['apply'](_0x165853,_0x465e9b,!![]);}catch(_0x1a30a0){return BPromise['reject'](_0x1a30a0);}return _0x165853[_0x3abe('0x1a')]();};}function saveUpdates(_0xed616f,_0x4928b7){return function(_0x2cdacf){if(_0x2cdacf){return _0x2cdacf[_0x3abe('0x1b')](_0xed616f)[_0x3abe('0x1c')](function(_0x480e33){return _0x480e33;});}return null;};}function removeEntity(_0x47e747,_0x4345ef){return function(_0x4d5a2f){if(_0x4d5a2f){return _0x4d5a2f[_0x3abe('0x1d')]()['then'](function(){_0x47e747[_0x3abe('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x133c30,_0x259987){return function(_0x3c0353){if(!_0x3c0353){_0x133c30[_0x3abe('0x11')](0x194);}return _0x3c0353;};}function handleError(_0x129554,_0x60cd7c){_0x60cd7c=_0x60cd7c||0x1f4;return function(_0x449841){logger[_0x3abe('0x1e')](_0x449841[_0x3abe('0x1f')]);if(_0x449841[_0x3abe('0x20')]){delete _0x449841[_0x3abe('0x20')];}_0x129554[_0x3abe('0x12')](_0x60cd7c)['send'](_0x449841);};}exports[_0x3abe('0x21')]=function(_0x5ddc37,_0x5caa96){var _0x159dc2={},_0x4b070c={},_0x55cfab={'count':0x0,'rows':[]};var _0x27ded4=db[_0x3abe('0x22')][_0x3abe('0x23')];_0x4b070c[_0x3abe('0x24')]=_[_0x3abe('0x25')](_0x27ded4);var _0x28167c={'dateStart':_0x5ddc37[_0x3abe('0x26')][_0x3abe('0x27')],'dateEnd':_0x5ddc37['query'][_0x3abe('0x28')]};delete _0x5ddc37[_0x3abe('0x26')][_0x3abe('0x27')];delete _0x5ddc37[_0x3abe('0x26')]['dateEnd'];_0x4b070c['query']=_['keys'](_0x5ddc37[_0x3abe('0x26')]);_0x4b070c[_0x3abe('0x29')]=_[_0x3abe('0x2a')](_0x4b070c['model'],_0x4b070c['query']);_0x159dc2[_0x3abe('0x2b')]=_[_0x3abe('0x2a')](_0x4b070c[_0x3abe('0x24')],qs[_0x3abe('0x2c')](_0x5ddc37[_0x3abe('0x26')][_0x3abe('0x2c')]));_0x159dc2[_0x3abe('0x2b')]=_0x159dc2[_0x3abe('0x2b')]['length']?_0x159dc2[_0x3abe('0x2b')]:_0x4b070c[_0x3abe('0x24')];if(!_0x5ddc37[_0x3abe('0x26')]['hasOwnProperty'](_0x3abe('0x2d'))){_0x159dc2['limit']=qs[_0x3abe('0x17')](_0x5ddc37[_0x3abe('0x26')][_0x3abe('0x17')]);_0x159dc2[_0x3abe('0x16')]=qs[_0x3abe('0x16')](_0x5ddc37['query'][_0x3abe('0x16')]);}_0x159dc2[_0x3abe('0x2e')]=qs[_0x3abe('0x2f')](_0x5ddc37['query']['sort']);_0x159dc2[_0x3abe('0x30')]=qs['filters'](_[_0x3abe('0x31')](_0x5ddc37['query'],_0x4b070c[_0x3abe('0x29')]));if(_0x28167c[_0x3abe('0x27')]){if(_0x28167c[_0x3abe('0x28')]){_0x28167c[_0x3abe('0x28')]=moment(_0x28167c[_0x3abe('0x28')])['add'](0x1,_0x3abe('0x32'));}else{_0x28167c['dateEnd']=moment(_0x28167c['dateStart'])['add'](0x1,'day');}_[_0x3abe('0x33')](_0x159dc2['where'],{'createdAt':{'$gte':_0x28167c[_0x3abe('0x27')],'$lte':_0x28167c['dateEnd']}});}if(_0x5ddc37['query'][_0x3abe('0x34')]){_0x159dc2[_0x3abe('0x30')]=_[_0x3abe('0x33')](_0x159dc2[_0x3abe('0x30')],{'$or':_['map'](_0x159dc2[_0x3abe('0x2b')],function(_0x2d004f){var _0x38b253={};_0x38b253[_0x2d004f]={'$like':'%'+_0x5ddc37[_0x3abe('0x26')][_0x3abe('0x34')]+'%'};return _0x38b253;})});}_0x159dc2=_[_0x3abe('0x33')]({},_0x159dc2,_0x5ddc37[_0x3abe('0x35')]);var _0x590372={'where':_0x159dc2[_0x3abe('0x30')]};return db[_0x3abe('0x22')][_0x3abe('0x15')](_0x590372)['then'](function(_0x286074){_0x55cfab[_0x3abe('0x15')]=_0x286074;if(_0x5ddc37[_0x3abe('0x26')]['includeAll']){_0x159dc2[_0x3abe('0x36')]=[{'all':!![]}];}return db['Attachment'][_0x3abe('0x37')](_0x159dc2);})[_0x3abe('0x1c')](function(_0x354078){_0x55cfab[_0x3abe('0x38')]=_0x354078;return _0x55cfab;})['then'](respondWithFilteredResult(_0x5caa96,_0x159dc2))[_0x3abe('0x39')](handleError(_0x5caa96,null));};exports[_0x3abe('0x3a')]=function(_0x50972a,_0x45c205){var _0x282b2c={'raw':!![],'where':{'id':_0x50972a['params']['id']}},_0x55f6ed={};_0x55f6ed[_0x3abe('0x24')]=_[_0x3abe('0x25')](db[_0x3abe('0x22')][_0x3abe('0x23')]);_0x55f6ed[_0x3abe('0x26')]=_[_0x3abe('0x25')](_0x50972a[_0x3abe('0x26')]);_0x55f6ed[_0x3abe('0x29')]=_[_0x3abe('0x2a')](_0x55f6ed[_0x3abe('0x24')],_0x55f6ed['query']);_0x282b2c[_0x3abe('0x2b')]=_['intersection'](_0x55f6ed[_0x3abe('0x24')],qs[_0x3abe('0x2c')](_0x50972a['query']['fields']));_0x282b2c['attributes']=_0x282b2c[_0x3abe('0x2b')][_0x3abe('0x3b')]?_0x282b2c[_0x3abe('0x2b')]:_0x55f6ed[_0x3abe('0x24')];if(_0x50972a[_0x3abe('0x26')][_0x3abe('0x3c')]){_0x282b2c[_0x3abe('0x36')]=[{'all':!![]}];}_0x282b2c=_[_0x3abe('0x33')]({},_0x282b2c,_0x50972a['options']);return db[_0x3abe('0x22')]['find'](_0x282b2c)[_0x3abe('0x1c')](handleEntityNotFound(_0x45c205,null))[_0x3abe('0x1c')](respondWithResult(_0x45c205,null))['catch'](handleError(_0x45c205,null));};exports[_0x3abe('0x1b')]=function(_0x38ee38,_0x5cb433){if(_0x38ee38[_0x3abe('0x3d')]['id']){delete _0x38ee38['body']['id'];}return db[_0x3abe('0x22')][_0x3abe('0x3e')]({'where':{'id':_0x38ee38['params']['id']}})[_0x3abe('0x1c')](handleEntityNotFound(_0x5cb433,null))[_0x3abe('0x1c')](saveUpdates(_0x38ee38['body'],null))['then'](respondWithResult(_0x5cb433,null))[_0x3abe('0x39')](handleError(_0x5cb433,null));};exports[_0x3abe('0x1d')]=function(_0x3b0d7d,_0x32a826){return db[_0x3abe('0x22')][_0x3abe('0x3e')]({'where':{'id':_0x3b0d7d[_0x3abe('0x3f')]['id']}})[_0x3abe('0x1c')](handleEntityNotFound(_0x32a826,null))[_0x3abe('0x1c')](removeEntity(_0x32a826,null))['catch'](handleError(_0x32a826,null));};exports['create']=function(_0xf2eb7c,_0x54c677,_0x5ac698){_0xf2eb7c['body'][_0x3abe('0x20')]=_0xf2eb7c[_0x3abe('0x40')]['originalname'];_0xf2eb7c[_0x3abe('0x3d')][_0x3abe('0x41')]=_0xf2eb7c[_0x3abe('0x40')][_0x3abe('0x42')];_0xf2eb7c[_0x3abe('0x3d')][_0x3abe('0x43')]=_0xf2eb7c[_0x3abe('0x40')][_0x3abe('0x44')];return db[_0x3abe('0x22')][_0x3abe('0x45')](_0xf2eb7c[_0x3abe('0x3d')])[_0x3abe('0x1c')](respondWithResult(_0x54c677,0xc9))[_0x3abe('0x39')](handleError(_0x54c677,null));};exports[_0x3abe('0x46')]=function(_0x53da16,_0x488be4,_0x9d93fa){return db[_0x3abe('0x22')]['findOne']({'where':{'id':_0x53da16['params']['id']},'raw':!![]})[_0x3abe('0x1c')](handleEntityNotFound(_0x488be4,null))['then'](function(_0x5f4ac8){if(_0x5f4ac8){return _0x488be4['download'](path[_0x3abe('0x47')](config[_0x3abe('0x48')],_0x3abe('0x49'),_0x5f4ac8['basename']));}})[_0x3abe('0x39')](handleError(_0x488be4,null));}; \ No newline at end of file +var _0x3ea0=['include','rows','catch','show','params','find','update','body','create','file','filename','type','mimetype','download','findOne','root','server/files/attachments/','basename','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','then','destroy','stack','name','index','Attachment','rawAttributes','model','dateStart','dateEnd','query','keys','filters','intersection','attributes','fields','length','order','sort','where','add','day','merge','filter','map','options','includeAll'];(function(_0x148fef,_0x44dd4a){var _0xba78c0=function(_0x14accb){while(--_0x14accb){_0x148fef['push'](_0x148fef['shift']());}};_0xba78c0(++_0x44dd4a);}(_0x3ea0,0xa6));var _0x03ea=function(_0x5169ca,_0x2356e5){_0x5169ca=_0x5169ca-0x0;var _0x13f00d=_0x3ea0[_0x5169ca];return _0x13f00d;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x03ea('0x0'));var moment=require(_0x03ea('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x03ea('0x2'));var util=require(_0x03ea('0x3'));var path=require(_0x03ea('0x4'));var sox=require(_0x03ea('0x5'));var csv=require(_0x03ea('0x6'));var ejs=require(_0x03ea('0x7'));var fs=require('fs');var _=require(_0x03ea('0x8'));var squel=require(_0x03ea('0x9'));var crypto=require(_0x03ea('0xa'));var jsforce=require(_0x03ea('0xb'));var deskjs=require(_0x03ea('0xc'));var toCsv=require(_0x03ea('0x6'));var querystring=require(_0x03ea('0xd'));var Papa=require(_0x03ea('0xe'));var qs=require(_0x03ea('0xf'));var logger=require('../../config/logger')(_0x03ea('0x10'));var utils=require(_0x03ea('0x11'));var config=require(_0x03ea('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e0ea0,_0x517999){_0x517999=_0x517999||0xcc;return function(_0x13afe5){if(_0x13afe5){return _0x2e0ea0[_0x03ea('0x13')](_0x517999);}return _0x2e0ea0['status'](_0x517999)[_0x03ea('0x14')]();};}function respondWithResult(_0x42d64f,_0x53c164){_0x53c164=_0x53c164||0xc8;return function(_0x6ad58){if(_0x6ad58){return _0x42d64f[_0x03ea('0x15')](_0x53c164)['json'](_0x6ad58);}};}function respondWithFilteredResult(_0x3258a8,_0x366c65){return function(_0x4a3a09){if(_0x4a3a09){var _0x29d902=_0x4a3a09[_0x03ea('0x16')],_0x1f6b73=_0x366c65[_0x03ea('0x17')],_0x156503=_0x366c65[_0x03ea('0x17')]+_0x366c65[_0x03ea('0x18')],_0x336b86;if(_0x156503>=_0x29d902){_0x156503=_0x29d902;_0x336b86=0xc8;}else{_0x336b86=0xce;}_0x3258a8['status'](_0x336b86);return _0x3258a8[_0x03ea('0x19')](_0x03ea('0x1a'),_0x1f6b73+'-'+_0x156503+'/'+_0x29d902)[_0x03ea('0x1b')](_0x4a3a09);}return null;};}function patchUpdates(_0x2035db){return function(_0x2ce0f9){try{jsonpatch[_0x03ea('0x1c')](_0x2ce0f9,_0x2035db,!![]);}catch(_0x3507ea){return BPromise['reject'](_0x3507ea);}return _0x2ce0f9['save']();};}function saveUpdates(_0x2f74b8,_0x472501){return function(_0xbcc0c0){if(_0xbcc0c0){return _0xbcc0c0['update'](_0x2f74b8)[_0x03ea('0x1d')](function(_0x3e82c1){return _0x3e82c1;});}return null;};}function removeEntity(_0x3acdd4,_0x524484){return function(_0x262b22){if(_0x262b22){return _0x262b22[_0x03ea('0x1e')]()[_0x03ea('0x1d')](function(){_0x3acdd4[_0x03ea('0x15')](0xcc)[_0x03ea('0x14')]();});}};}function handleEntityNotFound(_0x57438d,_0x3ad461){return function(_0x360375){if(!_0x360375){_0x57438d['sendStatus'](0x194);}return _0x360375;};}function handleError(_0x206fea,_0x455458){_0x455458=_0x455458||0x1f4;return function(_0x2061bb){logger['error'](_0x2061bb[_0x03ea('0x1f')]);if(_0x2061bb[_0x03ea('0x20')]){delete _0x2061bb[_0x03ea('0x20')];}_0x206fea[_0x03ea('0x15')](_0x455458)['send'](_0x2061bb);};}exports[_0x03ea('0x21')]=function(_0x6c235d,_0x17e791){var _0x3c4c76={},_0x4148e6={},_0x49dcfa={'count':0x0,'rows':[]};var _0x3cc30c=db[_0x03ea('0x22')][_0x03ea('0x23')];_0x4148e6[_0x03ea('0x24')]=_['keys'](_0x3cc30c);var _0x265bb9={'dateStart':_0x6c235d['query'][_0x03ea('0x25')],'dateEnd':_0x6c235d['query'][_0x03ea('0x26')]};delete _0x6c235d[_0x03ea('0x27')][_0x03ea('0x25')];delete _0x6c235d[_0x03ea('0x27')]['dateEnd'];_0x4148e6[_0x03ea('0x27')]=_[_0x03ea('0x28')](_0x6c235d[_0x03ea('0x27')]);_0x4148e6[_0x03ea('0x29')]=_[_0x03ea('0x2a')](_0x4148e6[_0x03ea('0x24')],_0x4148e6[_0x03ea('0x27')]);_0x3c4c76[_0x03ea('0x2b')]=_['intersection'](_0x4148e6[_0x03ea('0x24')],qs[_0x03ea('0x2c')](_0x6c235d[_0x03ea('0x27')]['fields']));_0x3c4c76[_0x03ea('0x2b')]=_0x3c4c76['attributes'][_0x03ea('0x2d')]?_0x3c4c76['attributes']:_0x4148e6['model'];if(!_0x6c235d[_0x03ea('0x27')]['hasOwnProperty']('nolimit')){_0x3c4c76[_0x03ea('0x18')]=qs[_0x03ea('0x18')](_0x6c235d[_0x03ea('0x27')][_0x03ea('0x18')]);_0x3c4c76[_0x03ea('0x17')]=qs[_0x03ea('0x17')](_0x6c235d[_0x03ea('0x27')]['offset']);}_0x3c4c76[_0x03ea('0x2e')]=qs[_0x03ea('0x2f')](_0x6c235d[_0x03ea('0x27')]['sort']);_0x3c4c76[_0x03ea('0x30')]=qs[_0x03ea('0x29')](_['pick'](_0x6c235d[_0x03ea('0x27')],_0x4148e6[_0x03ea('0x29')]));if(_0x265bb9[_0x03ea('0x25')]){if(_0x265bb9[_0x03ea('0x26')]){_0x265bb9[_0x03ea('0x26')]=moment(_0x265bb9[_0x03ea('0x26')])[_0x03ea('0x31')](0x1,_0x03ea('0x32'));}else{_0x265bb9['dateEnd']=moment(_0x265bb9['dateStart'])[_0x03ea('0x31')](0x1,_0x03ea('0x32'));}_[_0x03ea('0x33')](_0x3c4c76[_0x03ea('0x30')],{'createdAt':{'$gte':_0x265bb9[_0x03ea('0x25')],'$lte':_0x265bb9[_0x03ea('0x26')]}});}if(_0x6c235d[_0x03ea('0x27')][_0x03ea('0x34')]){_0x3c4c76[_0x03ea('0x30')]=_[_0x03ea('0x33')](_0x3c4c76[_0x03ea('0x30')],{'$or':_[_0x03ea('0x35')](_0x3c4c76[_0x03ea('0x2b')],function(_0x5f2cdd){var _0x3b2223={};_0x3b2223[_0x5f2cdd]={'$like':'%'+_0x6c235d[_0x03ea('0x27')][_0x03ea('0x34')]+'%'};return _0x3b2223;})});}_0x3c4c76=_[_0x03ea('0x33')]({},_0x3c4c76,_0x6c235d[_0x03ea('0x36')]);var _0x3a78d6={'where':_0x3c4c76[_0x03ea('0x30')]};return db[_0x03ea('0x22')][_0x03ea('0x16')](_0x3a78d6)[_0x03ea('0x1d')](function(_0x41c94e){_0x49dcfa[_0x03ea('0x16')]=_0x41c94e;if(_0x6c235d[_0x03ea('0x27')][_0x03ea('0x37')]){_0x3c4c76[_0x03ea('0x38')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x3c4c76);})[_0x03ea('0x1d')](function(_0x39678d){_0x49dcfa[_0x03ea('0x39')]=_0x39678d;return _0x49dcfa;})['then'](respondWithFilteredResult(_0x17e791,_0x3c4c76))[_0x03ea('0x3a')](handleError(_0x17e791,null));};exports[_0x03ea('0x3b')]=function(_0x721816,_0x1929ef){var _0x34e10d={'raw':!![],'where':{'id':_0x721816[_0x03ea('0x3c')]['id']}},_0x43fc78={};_0x43fc78[_0x03ea('0x24')]=_['keys'](db['Attachment'][_0x03ea('0x23')]);_0x43fc78[_0x03ea('0x27')]=_['keys'](_0x721816[_0x03ea('0x27')]);_0x43fc78[_0x03ea('0x29')]=_[_0x03ea('0x2a')](_0x43fc78[_0x03ea('0x24')],_0x43fc78[_0x03ea('0x27')]);_0x34e10d['attributes']=_[_0x03ea('0x2a')](_0x43fc78[_0x03ea('0x24')],qs['fields'](_0x721816[_0x03ea('0x27')][_0x03ea('0x2c')]));_0x34e10d['attributes']=_0x34e10d[_0x03ea('0x2b')][_0x03ea('0x2d')]?_0x34e10d[_0x03ea('0x2b')]:_0x43fc78['model'];if(_0x721816['query'][_0x03ea('0x37')]){_0x34e10d['include']=[{'all':!![]}];}_0x34e10d=_[_0x03ea('0x33')]({},_0x34e10d,_0x721816[_0x03ea('0x36')]);return db['Attachment'][_0x03ea('0x3d')](_0x34e10d)[_0x03ea('0x1d')](handleEntityNotFound(_0x1929ef,null))[_0x03ea('0x1d')](respondWithResult(_0x1929ef,null))['catch'](handleError(_0x1929ef,null));};exports[_0x03ea('0x3e')]=function(_0x3d037f,_0x1ffc23){if(_0x3d037f['body']['id']){delete _0x3d037f[_0x03ea('0x3f')]['id'];}return db['Attachment'][_0x03ea('0x3d')]({'where':{'id':_0x3d037f[_0x03ea('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1ffc23,null))[_0x03ea('0x1d')](saveUpdates(_0x3d037f[_0x03ea('0x3f')],null))[_0x03ea('0x1d')](respondWithResult(_0x1ffc23,null))[_0x03ea('0x3a')](handleError(_0x1ffc23,null));};exports[_0x03ea('0x1e')]=function(_0x2e6f83,_0x460c4a){return db[_0x03ea('0x22')][_0x03ea('0x3d')]({'where':{'id':_0x2e6f83[_0x03ea('0x3c')]['id']}})[_0x03ea('0x1d')](handleEntityNotFound(_0x460c4a,null))[_0x03ea('0x1d')](removeEntity(_0x460c4a,null))[_0x03ea('0x3a')](handleError(_0x460c4a,null));};exports[_0x03ea('0x40')]=function(_0x331f44,_0x39dbac,_0xd01f2f){_0x331f44['body'][_0x03ea('0x20')]=_0x331f44[_0x03ea('0x41')]['originalname'];_0x331f44[_0x03ea('0x3f')]['basename']=_0x331f44[_0x03ea('0x41')][_0x03ea('0x42')];_0x331f44['body'][_0x03ea('0x43')]=_0x331f44[_0x03ea('0x41')][_0x03ea('0x44')];return db[_0x03ea('0x22')][_0x03ea('0x40')](_0x331f44[_0x03ea('0x3f')])[_0x03ea('0x1d')](respondWithResult(_0x39dbac,0xc9))['catch'](handleError(_0x39dbac,null));};exports[_0x03ea('0x45')]=function(_0x22e8aa,_0xc87962,_0x246bbc){return db[_0x03ea('0x22')][_0x03ea('0x46')]({'where':{'id':_0x22e8aa[_0x03ea('0x3c')]['id']},'raw':!![]})[_0x03ea('0x1d')](handleEntityNotFound(_0xc87962,null))[_0x03ea('0x1d')](function(_0x30bd80){if(_0x30bd80){return _0xc87962['download'](path['join'](config[_0x03ea('0x47')],_0x03ea('0x48'),_0x30bd80[_0x03ea('0x49')]));}})[_0x03ea('0x3a')](handleError(_0xc87962,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 390f7b0..c5f6560 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 _0xabce=['./attachment.attributes','exports','Attachment','lodash','util','../../config/logger','api','moment'];(function(_0x2e130c,_0x195c90){var _0x470478=function(_0x357625){while(--_0x357625){_0x2e130c['push'](_0x2e130c['shift']());}};_0x470478(++_0x195c90);}(_0xabce,0x103));var _0xeabc=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xabce[_0x21aec3];return _0x288bbc;};'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 +var _0x7217=['lodash','../../config/logger','api','moment','bluebird','request-promise','define','Attachment','attachments'];(function(_0x306812,_0x3ce592){var _0x5df9e1=function(_0x46a5b2){while(--_0x46a5b2){_0x306812['push'](_0x306812['shift']());}};_0x5df9e1(++_0x3ce592);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var attributes=require('./attachment.attributes');module['exports']=function(_0x472a96,_0xce17f9){return _0x472a96[_0x7721('0x6')](_0x7721('0x7'),attributes,{'tableName':_0x7721('0x8'),'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 6f38575..2ffa298 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 _0x88c3=['info','Attachment,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','options','raw','lodash','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x11cb1d,_0x410835){var _0x5bee03=function(_0x36025c){while(--_0x36025c){_0x11cb1d['push'](_0x11cb1d['shift']());}};_0x5bee03(++_0x410835);}(_0x88c3,0x1ee));var _0x388c=function(_0x178e16,_0x1c7def){_0x178e16=_0x178e16-0x0;var _0x3c2594=_0x88c3[_0x178e16];return _0x3c2594;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var moment=require(_0x388c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x388c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x388c('0x3'));var config=require(_0x388c('0x4'));var jayson=require(_0x388c('0x5'));var client=jayson[_0x388c('0x6')][_0x388c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23199c,_0x5a1c0d,_0x3e79d8){return new BPromise(function(_0x374b99,_0x26be80){return client[_0x388c('0x8')](_0x23199c,_0x3e79d8)[_0x388c('0x9')](function(_0x17dbf8){logger[_0x388c('0xa')](_0x388c('0xb'),_0x5a1c0d,'request\x20sent');logger[_0x388c('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5a1c0d,'request\x20sent',JSON[_0x388c('0xd')](_0x17dbf8));if(_0x17dbf8[_0x388c('0xe')]){if(_0x17dbf8[_0x388c('0xe')][_0x388c('0xf')]===0x1f4){logger[_0x388c('0xe')](_0x388c('0xb'),_0x5a1c0d,_0x17dbf8[_0x388c('0xe')][_0x388c('0x10')]);return _0x26be80(_0x17dbf8[_0x388c('0xe')]['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x5a1c0d,_0x17dbf8[_0x388c('0xe')][_0x388c('0x10')]);return _0x374b99(_0x17dbf8['error'][_0x388c('0x10')]);}else{logger[_0x388c('0xa')]('Attachment,\x20%s,\x20%s',_0x5a1c0d,'request\x20sent');_0x374b99(_0x17dbf8[_0x388c('0x11')][_0x388c('0x10')]);}})[_0x388c('0x12')](function(_0x4d5230){logger[_0x388c('0xe')]('Attachment,\x20%s,\x20%s',_0x5a1c0d,_0x4d5230);_0x26be80(_0x4d5230);});});}exports[_0x388c('0x13')]=function(_0x5f5cd9){var _0x50ff33=this;return new Promise(function(_0x52c787,_0x36f18a){return db[_0x388c('0x14')][_0x388c('0x15')](_0x5f5cd9['body'],{'raw':_0x5f5cd9[_0x388c('0x16')]?_0x5f5cd9['options'][_0x388c('0x17')]===undefined?!![]:![]:!![]})[_0x388c('0x9')](function(_0x37a5dd){logger['info']('CreateAttachment',_0x5f5cd9);logger['debug']('CreateAttachment',_0x5f5cd9,JSON[_0x388c('0xd')](_0x37a5dd));_0x52c787(_0x37a5dd);})['catch'](function(_0xfff1f5){logger['error'](_0x388c('0x13'),_0xfff1f5['message'],_0x5f5cd9);_0x36f18a(_0x50ff33[_0x388c('0xe')](0x1f4,_0xfff1f5['message']));});});}; \ No newline at end of file +var _0x8325=['../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateAttachment','Attachment','create','body','options','lodash','moment','randomstring'];(function(_0x1564da,_0x434395){var _0x3bc014=function(_0x520e9b){while(--_0x520e9b){_0x1564da['push'](_0x1564da['shift']());}};_0x3bc014(++_0x434395);}(_0x8325,0x1f1));var _0x5832=function(_0x5b19ce,_0x4a0307){_0x5b19ce=_0x5b19ce-0x0;var _0x214bff=_0x8325[_0x5b19ce];return _0x214bff;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var moment=require(_0x5832('0x1'));var BPromise=require('bluebird');var rs=require(_0x5832('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5832('0x3'));var logger=require(_0x5832('0x4'))(_0x5832('0x5'));var config=require(_0x5832('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5832('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c7977,_0x8b3b30,_0xe80d1d){return new BPromise(function(_0xb4e9b9,_0x333780){return client['request'](_0x2c7977,_0xe80d1d)[_0x5832('0x8')](function(_0x278709){logger[_0x5832('0x9')](_0x5832('0xa'),_0x8b3b30,_0x5832('0xb'));logger[_0x5832('0xc')](_0x5832('0xd'),_0x8b3b30,_0x5832('0xb'),JSON[_0x5832('0xe')](_0x278709));if(_0x278709['error']){if(_0x278709['error'][_0x5832('0xf')]===0x1f4){logger[_0x5832('0x10')](_0x5832('0xa'),_0x8b3b30,_0x278709[_0x5832('0x10')]['message']);return _0x333780(_0x278709['error'][_0x5832('0x11')]);}logger[_0x5832('0x10')](_0x5832('0xa'),_0x8b3b30,_0x278709[_0x5832('0x10')]['message']);return _0xb4e9b9(_0x278709[_0x5832('0x10')][_0x5832('0x11')]);}else{logger[_0x5832('0x9')](_0x5832('0xa'),_0x8b3b30,'request\x20sent');_0xb4e9b9(_0x278709[_0x5832('0x12')][_0x5832('0x11')]);}})[_0x5832('0x13')](function(_0x4a8462){logger[_0x5832('0x10')](_0x5832('0xa'),_0x8b3b30,_0x4a8462);_0x333780(_0x4a8462);});});}exports[_0x5832('0x14')]=function(_0xd9e622){var _0x1f986d=this;return new Promise(function(_0x3598f5,_0x2c929f){return db[_0x5832('0x15')][_0x5832('0x16')](_0xd9e622[_0x5832('0x17')],{'raw':_0xd9e622['options']?_0xd9e622[_0x5832('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x526043){logger[_0x5832('0x9')]('CreateAttachment',_0xd9e622);logger['debug']('CreateAttachment',_0xd9e622,JSON['stringify'](_0x526043));_0x3598f5(_0x526043);})[_0x5832('0x13')](function(_0x5b9f75){logger['error'](_0x5832('0x14'),_0x5b9f75['message'],_0xd9e622);_0x2c929f(_0x1f986d[_0x5832('0x10')](0x1f4,_0x5b9f75['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 52d03cb..b1d430c 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 _0xf108=['create','put','update','delete','exports','multer','path','express','Router','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','file'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf108,0x1d9));var _0x8f10=function(_0x32b155,_0xea8c1b){_0x32b155=_0x32b155-0x0;var _0x5beca5=_0xf108[_0x32b155];return _0x5beca5;};'use strict';var multer=require(_0x8f10('0x0'));var util=require('util');var path=require(_0x8f10('0x1'));var express=require(_0x8f10('0x2'));var router=express[_0x8f10('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8f10('0x4'));router[_0x8f10('0x5')]('/',auth[_0x8f10('0x6')](),controller[_0x8f10('0x7')]);router[_0x8f10('0x5')](_0x8f10('0x8'),auth[_0x8f10('0x6')](),controller[_0x8f10('0x9')]);router[_0x8f10('0x5')](_0x8f10('0xa'),auth[_0x8f10('0x6')](),controller['download']);var upload=multer({'storage':multer[_0x8f10('0xb')]({'destination':function(_0x1787d2,_0x1bbe48,_0x1d863a){_0x1d863a(null,path[_0x8f10('0xc')](config[_0x8f10('0xd')],_0x8f10('0xe')));},'filename':function(_0x3ebfd4,_0x440f86,_0x23c485){_0x23c485(null,util[_0x8f10('0xf')](_0x8f10('0x10'),Date[_0x8f10('0x11')](),_0x440f86[_0x8f10('0x12')][_0x8f10('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single'](_0x8f10('0x14')),controller[_0x8f10('0x15')]);router[_0x8f10('0x16')](_0x8f10('0x8'),auth[_0x8f10('0x6')](),controller[_0x8f10('0x17')]);router[_0x8f10('0x18')](_0x8f10('0x8'),auth[_0x8f10('0x6')](),controller['destroy']);module[_0x8f10('0x19')]=router; \ No newline at end of file +var _0x8ace=['../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','download','join','root','server/files/attachments/','format','now','originalname','post','single','file','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0xa90f08,_0x28bd19){var _0x41dd9c=function(_0x31973c){while(--_0x31973c){_0xa90f08['push'](_0xa90f08['shift']());}};_0x41dd9c(++_0x28bd19);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x251597,_0x3ffa57){_0x251597=_0x251597-0x0;var _0x4c8d25=_0x8ace[_0x251597];return _0x4c8d25;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var express=require(_0xe8ac('0x3'));var router=express[_0xe8ac('0x4')]();var auth=require(_0xe8ac('0x5'));var interaction=require(_0xe8ac('0x6'));var config=require(_0xe8ac('0x7'));var controller=require(_0xe8ac('0x8'));router[_0xe8ac('0x9')]('/',auth[_0xe8ac('0xa')](),controller[_0xe8ac('0xb')]);router[_0xe8ac('0x9')](_0xe8ac('0xc'),auth['isAuthenticated'](),controller[_0xe8ac('0xd')]);router[_0xe8ac('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xe8ac('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1b5467,_0x271fdb,_0x19d9c8){_0x19d9c8(null,path[_0xe8ac('0xf')](config[_0xe8ac('0x10')],_0xe8ac('0x11')));},'filename':function(_0x55219e,_0x22ae07,_0x2e3b25){_0x2e3b25(null,util[_0xe8ac('0x12')]('%s-%s',Date[_0xe8ac('0x13')](),_0x22ae07[_0xe8ac('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe8ac('0x15')]('/',upload[_0xe8ac('0x16')](_0xe8ac('0x17')),controller[_0xe8ac('0x18')]);router[_0xe8ac('0x19')](_0xe8ac('0xc'),auth[_0xe8ac('0xa')](),controller[_0xe8ac('0x1a')]);router[_0xe8ac('0x1b')](_0xe8ac('0xc'),auth['isAuthenticated'](),controller[_0xe8ac('0x1c')]);module[_0xe8ac('0x1d')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 24e2aa5..ae03629 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 _0x78cb=['User\x20email\x20not\x20found!','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','callbackURL','find','map','emails','admin','user','agent','then'];(function(_0x2b7950,_0x433dec){var _0x1a0eb2=function(_0x4ce371){while(--_0x4ce371){_0x2b7950['push'](_0x2b7950['shift']());}};_0x1a0eb2(++_0x433dec);}(_0x78cb,0x9e));var _0xb78c=function(_0x14228e,_0x498d3c){_0x14228e=_0x14228e-0x0;var _0x8d6f54=_0x78cb[_0x14228e];return _0x8d6f54;};'use strict';var _=require(_0xb78c('0x0'));var passport=require(_0xb78c('0x1'));var GoogleStrategy=require(_0xb78c('0x2'))[_0xb78c('0x3')];var db=require(_0xb78c('0x4'))['db'];var config=require(_0xb78c('0x5'));var signToken=require('../../components/auth/service')['signToken'];exports[_0xb78c('0x6')]=passport[_0xb78c('0x7')](_0xb78c('0x8'),{'failureRedirect':_0xb78c('0x9'),'scope':[_0xb78c('0xa'),_0xb78c('0xb')],'session':![]});exports[_0xb78c('0xc')]=passport[_0xb78c('0x7')](_0xb78c('0x8'),{'failureRedirect':'/login','session':![]});passport[_0xb78c('0xd')](new GoogleStrategy({'clientID':config[_0xb78c('0x8')]?config[_0xb78c('0x8')][_0xb78c('0xe')]:'id','clientSecret':config[_0xb78c('0x8')]?config[_0xb78c('0x8')][_0xb78c('0xf')]:'secret','callbackURL':config[_0xb78c('0x8')]?config['google'][_0xb78c('0x10')]:''},function(_0x136853,_0x4cea68,_0x474fbc,_0x2de92a){db['User'][_0xb78c('0x11')]({'where':{'email':_[_0xb78c('0x12')](_0x474fbc[_0xb78c('0x13')],'value'),'role':{'$or':[_0xb78c('0x14'),_0xb78c('0x15'),_0xb78c('0x16')]}}})[_0xb78c('0x17')](function(_0x519e8d){if(_0x519e8d){return _0x2de92a(null,_0x519e8d);}_0x2de92a(_0xb78c('0x18'));})[_0xb78c('0x19')](function(_0x17fb68){_0x2de92a(_0x17fb68);});})); \ No newline at end of file +var _0xe7c2=['catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','authenticate','google','/login','email','callback','use','clientID','secret','callbackURL','User','map','emails','value','user','agent','then'];(function(_0x23d9d1,_0x3f1d1c){var _0xecd43e=function(_0x5d9fe0){while(--_0x5d9fe0){_0x23d9d1['push'](_0x23d9d1['shift']());}};_0xecd43e(++_0x3f1d1c);}(_0xe7c2,0x114));var _0x2e7c=function(_0x30ae7e,_0x479e1e){_0x30ae7e=_0x30ae7e-0x0;var _0xa5852a=_0xe7c2[_0x30ae7e];return _0xa5852a;};'use strict';var _=require(_0x2e7c('0x0'));var passport=require(_0x2e7c('0x1'));var GoogleStrategy=require(_0x2e7c('0x2'))[_0x2e7c('0x3')];var db=require(_0x2e7c('0x4'))['db'];var config=require(_0x2e7c('0x5'));var signToken=require(_0x2e7c('0x6'))[_0x2e7c('0x7')];exports['login']=passport[_0x2e7c('0x8')](_0x2e7c('0x9'),{'failureRedirect':_0x2e7c('0xa'),'scope':['profile',_0x2e7c('0xb')],'session':![]});exports[_0x2e7c('0xc')]=passport[_0x2e7c('0x8')](_0x2e7c('0x9'),{'failureRedirect':_0x2e7c('0xa'),'session':![]});passport[_0x2e7c('0xd')](new GoogleStrategy({'clientID':config[_0x2e7c('0x9')]?config['google'][_0x2e7c('0xe')]:'id','clientSecret':config[_0x2e7c('0x9')]?config['google']['clientSecret']:_0x2e7c('0xf'),'callbackURL':config[_0x2e7c('0x9')]?config[_0x2e7c('0x9')][_0x2e7c('0x10')]:''},function(_0x2a47aa,_0xda7ba9,_0x53b1fd,_0x3e8be2){db[_0x2e7c('0x11')]['find']({'where':{'email':_[_0x2e7c('0x12')](_0x53b1fd[_0x2e7c('0x13')],_0x2e7c('0x14')),'role':{'$or':['admin',_0x2e7c('0x15'),_0x2e7c('0x16')]}}})[_0x2e7c('0x17')](function(_0x428dd8){if(_0x428dd8){return _0x3e8be2(null,_0x428dd8);}_0x3e8be2('User\x20email\x20not\x20found!');})[_0x2e7c('0x18')](function(_0x113825){_0x3e8be2(_0x113825);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8ad599f..2782b0d 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 _0xcb2d=['setTokenCookie','login','/callback','callback','express','passport','Router','./authGoogle.controller'];(function(_0x4f3759,_0x15aa4b){var _0x4d1332=function(_0x2b5b4d){while(--_0x2b5b4d){_0x4f3759['push'](_0x4f3759['shift']());}};_0x4d1332(++_0x15aa4b);}(_0xcb2d,0x1bc));var _0xdcb2=function(_0x8aab93,_0x4908d3){_0x8aab93=_0x8aab93-0x0;var _0x21eb31=_0xcb2d[_0x8aab93];return _0x21eb31;};'use strict';var express=require(_0xdcb2('0x0'));var passport=require(_0xdcb2('0x1'));var router=express[_0xdcb2('0x2')]();var controller=require(_0xdcb2('0x3'));var setTokenCookie=require('../../components/auth/service')[_0xdcb2('0x4')];router['get']('/',controller[_0xdcb2('0x5')]);router['get'](_0xdcb2('0x6'),controller[_0xdcb2('0x7')],setTokenCookie);module['exports']=router; \ No newline at end of file +var _0xe15e=['passport','Router','./authGoogle.controller','setTokenCookie','get','login','/callback','callback','exports','express'];(function(_0x388eba,_0x5d71a8){var _0x57e52f=function(_0x228775){while(--_0x228775){_0x388eba['push'](_0x388eba['shift']());}};_0x57e52f(++_0x5d71a8);}(_0xe15e,0x6d));var _0xee15=function(_0x2160c6,_0x15382e){_0x2160c6=_0x2160c6-0x0;var _0x392c0e=_0xe15e[_0x2160c6];return _0x392c0e;};'use strict';var express=require(_0xee15('0x0'));var passport=require(_0xee15('0x1'));var router=express[_0xee15('0x2')]();var controller=require(_0xee15('0x3'));var setTokenCookie=require('../../components/auth/service')[_0xee15('0x4')];router[_0xee15('0x5')]('/',controller[_0xee15('0x6')]);router[_0xee15('0x5')](_0xee15('0x7'),controller[_0xee15('0x8')],setTokenCookie);module[_0xee15('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 87c78a9..4dcdb64 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 _0xdc12=['send','local','forgot','Email\x20parameter\x20is\x20missing','generate','body','This\x20email\x20is\x20not\x20registered.','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','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','password','resetPasswordToken','Password\x20reset!','util','passport','passport-local','Strategy','bluebird','jayson/promise','../../config/logger','api','randomstring','../../mysqldb','signToken','client','http','role','agent','User','count','getLicense','then','Maximum\x20login\x20has\x20been\x20reached','catch','find','trim','admin','user','This\x20name\x20is\x20not\x20registered.','This\x20password\x20is\x20not\x20correct.','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','name','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status'];(function(_0x1ec341,_0x2b6426){var _0x1eeb8e=function(_0x476161){while(--_0x476161){_0x1ec341['push'](_0x1ec341['shift']());}};_0x1eeb8e(++_0x2b6426);}(_0xdc12,0xa1));var _0x2dc1=function(_0x1478d9,_0x5bb1d6){_0x1478d9=_0x1478d9-0x0;var _0xb60dca=_0xdc12[_0x1478d9];return _0xb60dca;};'use strict';var util=require(_0x2dc1('0x0'));var passport=require(_0x2dc1('0x1'));var LocalStrategy=require(_0x2dc1('0x2'))[_0x2dc1('0x3')];var BPromise=require(_0x2dc1('0x4'));var jayson=require(_0x2dc1('0x5'));var _=require('lodash');var logger=require(_0x2dc1('0x6'))(_0x2dc1('0x7'));var rs=require(_0x2dc1('0x8'));var db=require(_0x2dc1('0x9'))['db'];var signToken=require('../../components/auth/service')[_0x2dc1('0xa')];var client=jayson[_0x2dc1('0xb')][_0x2dc1('0xc')]({'port':0x232b});var getLicense=function(_0x1d92ef){return new BPromise(function(_0x213843,_0x3cbdae){var _0x250641=0x0;_0x1d92ef[_0x2dc1('0xd')]!==_0x2dc1('0xe')&&_0x213843(_0x1d92ef);return db[_0x2dc1('0xf')][_0x2dc1('0x10')]({'where':{'role':_0x2dc1('0xe'),'online':!![],'id':{'$ne':_0x1d92ef['id']}}})['then'](function(_0xdc842){_0x250641=_0xdc842;return require('../../config/license/util')[_0x2dc1('0x11')]();})[_0x2dc1('0x12')](function(_0x1315db){if(_0x1315db&&_0x1315db['agents']&&_0x250641>=_0x1315db['agents']){return _0x3cbdae({'message':_0x2dc1('0x13')});}return _0x213843(_0x1d92ef);})[_0x2dc1('0x14')](function(_0x4b67a2){return _0x3cbdae(_0x4b67a2);});});};function localAuthenticate(_0x4b9bc9,_0x15e83d,_0x30fb21,_0x23e6ed){var _0x44caa2;_0x4b9bc9[_0x2dc1('0x15')]({'where':{'name':_0x15e83d[_0x2dc1('0x16')](),'role':{'$or':[_0x2dc1('0x17'),_0x2dc1('0x18'),_0x2dc1('0xe')]}}})[_0x2dc1('0x12')](function(_0x263e12){if(!_0x263e12){return _0x23e6ed(null,![],{'message':_0x2dc1('0x19')});}return getLicense(_0x263e12);})['then'](function(_0x47b0bb){_0x47b0bb['authenticate'](_0x30fb21,function(_0x2a96f8,_0xdb8475){if(_0x2a96f8){return _0x23e6ed(_0x2a96f8);}if(!_0xdb8475){return _0x23e6ed(null,![],{'message':_0x2dc1('0x1a')});}else{return _0x23e6ed(null,_0x47b0bb);}});})[_0x2dc1('0x14')](function(_0x10f28b){_0x23e6ed(_0x10f28b);});}function sendServiceMail(_0x3296fa){return db[_0x2dc1('0x1b')][_0x2dc1('0x15')]({'where':{'service':!![]},'attributes':['id','name',_0x2dc1('0x1c')],'include':[{'model':db[_0x2dc1('0x1d')],'as':_0x2dc1('0x1e')}]})['then'](function(_0x5213d4){if(!_0x5213d4){throw new Error(_0x2dc1('0x1f'));}var _0x1ba6cd={'tls':{'rejectUnauthorized':![]}};if(_0x5213d4[_0x2dc1('0x1e')][_0x2dc1('0x20')]){_0x1ba6cd[_0x2dc1('0x20')]=_0x5213d4[_0x2dc1('0x1e')][_0x2dc1('0x20')];}else{_0x1ba6cd[_0x2dc1('0x21')]=_0x5213d4[_0x2dc1('0x1e')][_0x2dc1('0x21')];_0x1ba6cd['port']=_0x5213d4['Smtp'][_0x2dc1('0x22')];_0x1ba6cd[_0x2dc1('0x23')]=_0x5213d4[_0x2dc1('0x1e')][_0x2dc1('0x23')];}if(_0x5213d4['Smtp'][_0x2dc1('0x24')]){_0x1ba6cd[_0x2dc1('0x25')]={'user':_0x5213d4[_0x2dc1('0x1e')]['user'],'pass':_0x5213d4[_0x2dc1('0x1e')][_0x2dc1('0x26')]};}var _0x403e18={'account':_0x1ba6cd,'message':_[_0x2dc1('0x27')]({'from':util[_0x2dc1('0x28')]('\x22%s\x22\x20<%s>',_0x5213d4[_0x2dc1('0x29')],_0x5213d4[_0x2dc1('0x1c')]||_0x5213d4[_0x2dc1('0x1e')]['user'])},_0x3296fa)};return client[_0x2dc1('0x2a')](_0x2dc1('0x2b'),_0x403e18);})[_0x2dc1('0x12')](function(_0x331b00){if(_0x331b00[_0x2dc1('0x2c')]){throw new Error(util['format'](_0x2dc1('0x2d'),_0x331b00[_0x2dc1('0x2c')][_0x2dc1('0x2e')]||JSON[_0x2dc1('0x2f')](_0x331b00[_0x2dc1('0x2c')])));}return!![];});}function handleError(_0x272407,_0x5f4ad5,_0x188beb){return _0x272407[_0x2dc1('0x30')](_0x5f4ad5||0x1f4)[_0x2dc1('0x31')]({'message':_0x188beb?_0x188beb[_0x2dc1('0x2e')]||_0x188beb:''});}exports['login']=function(_0x12ebe7,_0x59ce2c,_0xba060a){passport['authenticate'](_0x2dc1('0x32'),function(_0x2de4e9,_0x551c2e,_0x39ae37){var _0x84608=_0x2de4e9||_0x39ae37;if(_0x84608){return handleError(_0x59ce2c,0x191,_0x84608);}if(!_0x551c2e){return handleError(_0x59ce2c,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}var _0x55a198=signToken(_0x551c2e['id'],_0x551c2e['role']);_0x59ce2c['json']({'id':_0x551c2e['id'],'token':_0x55a198,'statusCall':'','isAlreadyLogged':_0x551c2e['online']});})(_0x12ebe7,_0x59ce2c,_0xba060a);};exports[_0x2dc1('0x33')]=function(_0x3fc15b,_0x5cc9ca,_0x518829){if(!_0x3fc15b['body'][_0x2dc1('0x1c')]){return handleError(_0x5cc9ca,0x1f4,{'message':_0x2dc1('0x34')});}var _0x257392=rs[_0x2dc1('0x35')]();_0x3fc15b['body'][_0x2dc1('0x1c')]=_0x3fc15b[_0x2dc1('0x36')][_0x2dc1('0x1c')][_0x2dc1('0x16')]()['toLowerCase']();return db[_0x2dc1('0xf')][_0x2dc1('0x15')]({'where':{'email':_0x3fc15b[_0x2dc1('0x36')][_0x2dc1('0x1c')]}})[_0x2dc1('0x12')](function(_0x16a109){if(!_0x16a109){throw new Error(_0x2dc1('0x37'));}_0x16a109['resetPasswordToken']=_0x257392;_0x16a109[_0x2dc1('0x38')]=Date[_0x2dc1('0x39')]()+0x36ee80;return _0x16a109[_0x2dc1('0x3a')]();})['then'](function(){return sendServiceMail({'to':_0x3fc15b[_0x2dc1('0x36')][_0x2dc1('0x1c')],'subject':_0x2dc1('0x3b'),'text':_0x2dc1('0x3c')+_0x2dc1('0x3d')+'http://'+_0x3fc15b[_0x2dc1('0x3e')][_0x2dc1('0x21')]+'/reset/'+_0x257392+'\x0a\x0a'+_0x2dc1('0x3f')});})[_0x2dc1('0x12')](function(){_0x5cc9ca['status'](0xc8)[_0x2dc1('0x31')]({'message':_0x2dc1('0x40')});})[_0x2dc1('0x14')](function(_0x3d1dcd){return handleError(_0x5cc9ca,0x1f4,_0x3d1dcd);});};exports['reset']=function(_0x2718a7,_0x401317,_0x28aca9){return db[_0x2dc1('0xf')][_0x2dc1('0x15')]({'where':{'resetPasswordToken':_0x2718a7[_0x2dc1('0x41')][_0x2dc1('0x42')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x1acb9a){if(!_0x1acb9a){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}_0x1acb9a[_0x2dc1('0x43')]=_0x2718a7[_0x2dc1('0x36')]['password'];_0x1acb9a[_0x2dc1('0x44')]=null;_0x1acb9a['resetPasswordExpires']=null;return _0x1acb9a[_0x2dc1('0x3a')]();})[_0x2dc1('0x12')](function(){_0x401317['status'](0xc8)[_0x2dc1('0x31')]({'message':_0x2dc1('0x45')});})[_0x2dc1('0x14')](function(_0x25b7ec){return handleError(_0x401317,0x1f4,_0x25b7ec);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':_0x2dc1('0x43')},function(_0x44a89b,_0x5a54ba,_0x52cff5){return localAuthenticate(db['User'],_0x44a89b,_0x5a54ba,_0x52cff5);})); \ No newline at end of file +var _0x8de2=['resetPasswordToken','now','save','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','passport','passport-local','jayson/promise','lodash','../../config/logger','../../mysqldb','../../components/auth/service','signToken','client','http','role','User','count','agent','then','../../config/license/util','getLicense','agents','catch','find','admin','user','This\x20name\x20is\x20not\x20registered.','authenticate','This\x20password\x20is\x20not\x20correct.','MailAccount','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','name','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0x8de2,0x19f));var _0x28de=function(_0xc5bb7f,_0x336c16){_0xc5bb7f=_0xc5bb7f-0x0;var _0x5ed8f7=_0x8de2[_0xc5bb7f];return _0x5ed8f7;};'use strict';var util=require('util');var passport=require(_0x28de('0x0'));var LocalStrategy=require(_0x28de('0x1'))['Strategy'];var BPromise=require('bluebird');var jayson=require(_0x28de('0x2'));var _=require(_0x28de('0x3'));var logger=require(_0x28de('0x4'))('api');var rs=require('randomstring');var db=require(_0x28de('0x5'))['db'];var signToken=require(_0x28de('0x6'))[_0x28de('0x7')];var client=jayson[_0x28de('0x8')][_0x28de('0x9')]({'port':0x232b});var getLicense=function(_0x2da98e){return new BPromise(function(_0x259357,_0x244bc1){var _0x2bcc60=0x0;_0x2da98e[_0x28de('0xa')]!=='agent'&&_0x259357(_0x2da98e);return db[_0x28de('0xb')][_0x28de('0xc')]({'where':{'role':_0x28de('0xd'),'online':!![],'id':{'$ne':_0x2da98e['id']}}})[_0x28de('0xe')](function(_0x2e18d5){_0x2bcc60=_0x2e18d5;return require(_0x28de('0xf'))[_0x28de('0x10')]();})[_0x28de('0xe')](function(_0x2ca06b){if(_0x2ca06b&&_0x2ca06b['agents']&&_0x2bcc60>=_0x2ca06b[_0x28de('0x11')]){return _0x244bc1({'message':'Maximum\x20login\x20has\x20been\x20reached'});}return _0x259357(_0x2da98e);})[_0x28de('0x12')](function(_0x45ef43){return _0x244bc1(_0x45ef43);});});};function localAuthenticate(_0x46e940,_0x367a17,_0x25505c,_0x3d02b9){var _0x4f88cb;_0x46e940[_0x28de('0x13')]({'where':{'name':_0x367a17['trim'](),'role':{'$or':[_0x28de('0x14'),_0x28de('0x15'),_0x28de('0xd')]}}})[_0x28de('0xe')](function(_0x5dcbad){if(!_0x5dcbad){return _0x3d02b9(null,![],{'message':_0x28de('0x16')});}return getLicense(_0x5dcbad);})[_0x28de('0xe')](function(_0x5d17d2){_0x5d17d2[_0x28de('0x17')](_0x25505c,function(_0x2f8834,_0x222d40){if(_0x2f8834){return _0x3d02b9(_0x2f8834);}if(!_0x222d40){return _0x3d02b9(null,![],{'message':_0x28de('0x18')});}else{return _0x3d02b9(null,_0x5d17d2);}});})[_0x28de('0x12')](function(_0x319247){_0x3d02b9(_0x319247);});}function sendServiceMail(_0x3886e9){return db[_0x28de('0x19')][_0x28de('0x13')]({'where':{'service':!![]},'attributes':['id','name',_0x28de('0x1a')],'include':[{'model':db[_0x28de('0x1b')],'as':_0x28de('0x1c')}]})[_0x28de('0xe')](function(_0x4edefc){if(!_0x4edefc){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x554555={'tls':{'rejectUnauthorized':![]}};if(_0x4edefc[_0x28de('0x1c')][_0x28de('0x1d')]){_0x554555[_0x28de('0x1d')]=_0x4edefc[_0x28de('0x1c')][_0x28de('0x1d')];}else{_0x554555[_0x28de('0x1e')]=_0x4edefc['Smtp'][_0x28de('0x1e')];_0x554555[_0x28de('0x1f')]=_0x4edefc[_0x28de('0x1c')][_0x28de('0x1f')];_0x554555['secure']=_0x4edefc[_0x28de('0x1c')][_0x28de('0x20')];}if(_0x4edefc[_0x28de('0x1c')][_0x28de('0x21')]){_0x554555[_0x28de('0x22')]={'user':_0x4edefc[_0x28de('0x1c')][_0x28de('0x15')],'pass':_0x4edefc[_0x28de('0x1c')][_0x28de('0x23')]};}var _0x2618ca={'account':_0x554555,'message':_[_0x28de('0x24')]({'from':util[_0x28de('0x25')]('\x22%s\x22\x20<%s>',_0x4edefc[_0x28de('0x26')],_0x4edefc[_0x28de('0x1a')]||_0x4edefc[_0x28de('0x1c')]['user'])},_0x3886e9)};return client[_0x28de('0x27')](_0x28de('0x28'),_0x2618ca);})['then'](function(_0x3b761b){if(_0x3b761b[_0x28de('0x29')]){throw new Error(util[_0x28de('0x25')](_0x28de('0x2a'),_0x3b761b['error'][_0x28de('0x2b')]||JSON['stringify'](_0x3b761b[_0x28de('0x29')])));}return!![];});}function handleError(_0x20df3f,_0x560e78,_0xeb6d42){return _0x20df3f[_0x28de('0x2c')](_0x560e78||0x1f4)[_0x28de('0x2d')]({'message':_0xeb6d42?_0xeb6d42['message']||_0xeb6d42:''});}exports['login']=function(_0x54386b,_0x2bf01c,_0x5f3237){passport[_0x28de('0x17')](_0x28de('0x2e'),function(_0x1f8465,_0x2cb2f7,_0x5322e4){var _0x102130=_0x1f8465||_0x5322e4;if(_0x102130){return handleError(_0x2bf01c,0x191,_0x102130);}if(!_0x2cb2f7){return handleError(_0x2bf01c,0x194,{'message':_0x28de('0x2f')});}var _0x2191de=signToken(_0x2cb2f7['id'],_0x2cb2f7[_0x28de('0xa')]);_0x2bf01c['json']({'id':_0x2cb2f7['id'],'token':_0x2191de,'statusCall':'','isAlreadyLogged':_0x2cb2f7[_0x28de('0x30')]});})(_0x54386b,_0x2bf01c,_0x5f3237);};exports['forgot']=function(_0x4ed2e7,_0x50c843,_0x292205){if(!_0x4ed2e7[_0x28de('0x31')][_0x28de('0x1a')]){return handleError(_0x50c843,0x1f4,{'message':_0x28de('0x32')});}var _0x1f9e36=rs[_0x28de('0x33')]();_0x4ed2e7[_0x28de('0x31')]['email']=_0x4ed2e7['body']['email'][_0x28de('0x34')]()[_0x28de('0x35')]();return db[_0x28de('0xb')][_0x28de('0x13')]({'where':{'email':_0x4ed2e7[_0x28de('0x31')][_0x28de('0x1a')]}})[_0x28de('0xe')](function(_0x595435){if(!_0x595435){throw new Error('This\x20email\x20is\x20not\x20registered.');}_0x595435[_0x28de('0x36')]=_0x1f9e36;_0x595435['resetPasswordExpires']=Date[_0x28de('0x37')]()+0x36ee80;return _0x595435[_0x28de('0x38')]();})[_0x28de('0xe')](function(){return sendServiceMail({'to':_0x4ed2e7[_0x28de('0x31')][_0x28de('0x1a')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x28de('0x39')+_0x28de('0x3a')+'http://'+_0x4ed2e7['headers']['host']+_0x28de('0x3b')+_0x1f9e36+'\x0a\x0a'+_0x28de('0x3c')});})[_0x28de('0xe')](function(){_0x50c843[_0x28de('0x2c')](0xc8)['send']({'message':_0x28de('0x3d')});})[_0x28de('0x12')](function(_0x49352f){return handleError(_0x50c843,0x1f4,_0x49352f);});};exports[_0x28de('0x3e')]=function(_0xa27fb0,_0x3d49aa,_0xba4ec7){return db[_0x28de('0xb')][_0x28de('0x13')]({'where':{'resetPasswordToken':_0xa27fb0[_0x28de('0x3f')][_0x28de('0x40')],'resetPasswordExpires':{'$gt':Date[_0x28de('0x37')]()}}})[_0x28de('0xe')](function(_0x583287){if(!_0x583287){throw new Error(_0x28de('0x41'));}_0x583287[_0x28de('0x42')]=_0xa27fb0[_0x28de('0x31')][_0x28de('0x42')];_0x583287['resetPasswordToken']=null;_0x583287['resetPasswordExpires']=null;return _0x583287[_0x28de('0x38')]();})[_0x28de('0xe')](function(){_0x3d49aa['status'](0xc8)[_0x28de('0x2d')]({'message':'Password\x20reset!'});})['catch'](function(_0x238897){return handleError(_0x3d49aa,0x1f4,_0x238897);});};passport['use'](new LocalStrategy({'usernameField':_0x28de('0x26'),'passwordField':'password'},function(_0x20fa69,_0x376d29,_0x88b143){return localAuthenticate(db[_0x28de('0xb')],_0x20fa69,_0x376d29,_0x88b143);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3f04e20..beb9f21 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 _0x5924=['post','/forgot','/reset/:token','reset','express','Router','./authLocal.controller'];(function(_0x89a001,_0x3a9a8c){var _0x5f3ec2=function(_0x3e849b){while(--_0x3e849b){_0x89a001['push'](_0x89a001['shift']());}};_0x5f3ec2(++_0x3a9a8c);}(_0x5924,0x18c));var _0x4592=function(_0x3f6426,_0x12cbf9){_0x3f6426=_0x3f6426-0x0;var _0x25d790=_0x5924[_0x3f6426];return _0x25d790;};'use strict';var express=require(_0x4592('0x0'));var router=express[_0x4592('0x1')]();var controller=require(_0x4592('0x2'));router['post']('/',controller['login']);router[_0x4592('0x3')](_0x4592('0x4'),controller['forgot']);router[_0x4592('0x3')](_0x4592('0x5'),controller[_0x4592('0x6')]);module['exports']=router; \ No newline at end of file +var _0x0a39=['login','/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller','post'];(function(_0x1e3c1c,_0x569735){var _0x30fc02=function(_0x400d60){while(--_0x400d60){_0x1e3c1c['push'](_0x1e3c1c['shift']());}};_0x30fc02(++_0x569735);}(_0x0a39,0x83));var _0x90a3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0a39[_0x19950b];return _0x3c6b41;};'use strict';var express=require(_0x90a3('0x0'));var router=express[_0x90a3('0x1')]();var controller=require(_0x90a3('0x2'));router[_0x90a3('0x3')]('/',controller[_0x90a3('0x4')]);router[_0x90a3('0x3')](_0x90a3('0x5'),controller[_0x90a3('0x6')]);router[_0x90a3('0x3')](_0x90a3('0x7'),controller[_0x90a3('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 0d9cd66..91ff69b 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 _0x2b4a=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x2b4a,0x13e));var _0xa2b4=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x2b4a[_0x145b3c];return _0x1b6e36;};'use strict';var Sequelize=require(_0xa2b4('0x0'));module[_0xa2b4('0x1')]={'name':{'type':Sequelize[_0xa2b4('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xa2b4('0x2')]},'description':{'type':Sequelize[_0xa2b4('0x2')]},'status':{'type':Sequelize[_0xa2b4('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa2b4('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x52a1=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x4392f3,_0x1b1307){var _0x556942=function(_0x19c68a){while(--_0x19c68a){_0x4392f3['push'](_0x4392f3['shift']());}};_0x556942(++_0x1b1307);}(_0x52a1,0x1b7));var _0x152a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x52a1[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x152a('0x0'));module[_0x152a('0x1')]={'name':{'type':Sequelize[_0x152a('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x152a('0x2')]},'description':{'type':Sequelize[_0x152a('0x2')]},'status':{'type':Sequelize[_0x152a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x152a('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index c28601f..b98f11d 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 _0xc030=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Automation','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','Condition','ids','omit','getConditions','findOne','pick','hasOwnProperty','nolimit','getActions','Action','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','../../components/parsers/qs','api','../../config/utils','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x2660b7,_0x544e35){var _0x2174b5=function(_0x1e891d){while(--_0x1e891d){_0x2660b7['push'](_0x2660b7['shift']());}};_0x2174b5(++_0x544e35);}(_0xc030,0xca));var _0x0c03=function(_0x7843c8,_0x2e73cf){_0x7843c8=_0x7843c8-0x0;var _0x238f6d=_0xc030[_0x7843c8];return _0x238f6d;};'use strict';var jsonpatch=require(_0x0c03('0x0'));var rp=require(_0x0c03('0x1'));var moment=require(_0x0c03('0x2'));var BPromise=require(_0x0c03('0x3'));var Mustache=require(_0x0c03('0x4'));var util=require('util');var path=require(_0x0c03('0x5'));var sox=require('sox');var csv=require(_0x0c03('0x6'));var ejs=require(_0x0c03('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0c03('0x8'));var crypto=require(_0x0c03('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0c03('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0c03('0xb'));var logger=require('../../config/logger')(_0x0c03('0xc'));var utils=require(_0x0c03('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13ea16,_0x4c8340){_0x4c8340=_0x4c8340||0xcc;return function(_0xaa7f9b){if(_0xaa7f9b){return _0x13ea16['sendStatus'](_0x4c8340);}return _0x13ea16[_0x0c03('0xe')](_0x4c8340)[_0x0c03('0xf')]();};}function respondWithResult(_0x524b6e,_0x2347e7){_0x2347e7=_0x2347e7||0xc8;return function(_0x504a9c){if(_0x504a9c){return _0x524b6e[_0x0c03('0xe')](_0x2347e7)[_0x0c03('0x10')](_0x504a9c);}};}function respondWithFilteredResult(_0xd5f1b3,_0x5eddb4){return function(_0x11325b){if(_0x11325b){var _0x4c3aa5=_0x11325b[_0x0c03('0x11')],_0x2d8abf=_0x5eddb4[_0x0c03('0x12')],_0x30e31b=_0x5eddb4[_0x0c03('0x12')]+_0x5eddb4[_0x0c03('0x13')],_0x2f7cea;if(_0x30e31b>=_0x4c3aa5){_0x30e31b=_0x4c3aa5;_0x2f7cea=0xc8;}else{_0x2f7cea=0xce;}_0xd5f1b3[_0x0c03('0xe')](_0x2f7cea);return _0xd5f1b3[_0x0c03('0x14')](_0x0c03('0x15'),_0x2d8abf+'-'+_0x30e31b+'/'+_0x4c3aa5)[_0x0c03('0x10')](_0x11325b);}return null;};}function patchUpdates(_0x4bfe19){return function(_0x49a8cc){try{jsonpatch[_0x0c03('0x16')](_0x49a8cc,_0x4bfe19,!![]);}catch(_0x3e09df){return BPromise[_0x0c03('0x17')](_0x3e09df);}return _0x49a8cc[_0x0c03('0x18')]();};}function saveUpdates(_0x594665,_0x1c0962){return function(_0xbc79dc){if(_0xbc79dc){return _0xbc79dc[_0x0c03('0x19')](_0x594665)[_0x0c03('0x1a')](function(_0x410988){return _0x410988;});}return null;};}function removeEntity(_0x573500,_0x10fd6d){return function(_0x2b2206){if(_0x2b2206){return _0x2b2206[_0x0c03('0x1b')]()[_0x0c03('0x1a')](function(){_0x573500[_0x0c03('0xe')](0xcc)[_0x0c03('0xf')]();});}};}function handleEntityNotFound(_0xb85c6a,_0x228775){return function(_0x21f7d9){if(!_0x21f7d9){_0xb85c6a[_0x0c03('0x1c')](0x194);}return _0x21f7d9;};}function handleError(_0x16076b,_0x28c65e){_0x28c65e=_0x28c65e||0x1f4;return function(_0x1b3ea9){logger[_0x0c03('0x1d')](_0x1b3ea9[_0x0c03('0x1e')]);if(_0x1b3ea9[_0x0c03('0x1f')]){delete _0x1b3ea9[_0x0c03('0x1f')];}_0x16076b[_0x0c03('0xe')](_0x28c65e)[_0x0c03('0x20')](_0x1b3ea9);};}exports[_0x0c03('0x21')]=function(_0x10673f,_0x28f8d6){var _0x1a3d62={},_0x5af1c8={},_0x20d2bf={'count':0x0,'rows':[]};var _0x214ba2=db[_0x0c03('0x22')][_0x0c03('0x23')];_0x5af1c8[_0x0c03('0x24')]=_[_0x0c03('0x25')](_0x214ba2);var _0x7c6ba2={'dateStart':_0x10673f[_0x0c03('0x26')][_0x0c03('0x27')],'dateEnd':_0x10673f['query'][_0x0c03('0x28')]};delete _0x10673f[_0x0c03('0x26')][_0x0c03('0x27')];delete _0x10673f[_0x0c03('0x26')]['dateEnd'];_0x5af1c8[_0x0c03('0x26')]=_['keys'](_0x10673f[_0x0c03('0x26')]);_0x5af1c8[_0x0c03('0x29')]=_[_0x0c03('0x2a')](_0x5af1c8[_0x0c03('0x24')],_0x5af1c8[_0x0c03('0x26')]);_0x1a3d62['attributes']=_[_0x0c03('0x2a')](_0x5af1c8['model'],qs[_0x0c03('0x2b')](_0x10673f['query'][_0x0c03('0x2b')]));_0x1a3d62[_0x0c03('0x2c')]=_0x1a3d62[_0x0c03('0x2c')][_0x0c03('0x2d')]?_0x1a3d62['attributes']:_0x5af1c8[_0x0c03('0x24')];if(!_0x10673f[_0x0c03('0x26')]['hasOwnProperty']('nolimit')){_0x1a3d62['limit']=qs[_0x0c03('0x13')](_0x10673f[_0x0c03('0x26')][_0x0c03('0x13')]);_0x1a3d62[_0x0c03('0x12')]=qs['offset'](_0x10673f[_0x0c03('0x26')][_0x0c03('0x12')]);}_0x1a3d62[_0x0c03('0x2e')]=qs[_0x0c03('0x2f')](_0x10673f[_0x0c03('0x26')]['sort']);_0x1a3d62[_0x0c03('0x30')]=qs[_0x0c03('0x29')](_['pick'](_0x10673f[_0x0c03('0x26')],_0x5af1c8[_0x0c03('0x29')]));if(_0x7c6ba2['dateStart']){if(_0x7c6ba2[_0x0c03('0x28')]){_0x7c6ba2['dateEnd']=moment(_0x7c6ba2[_0x0c03('0x28')])[_0x0c03('0x31')](0x1,_0x0c03('0x32'));}else{_0x7c6ba2[_0x0c03('0x28')]=moment(_0x7c6ba2['dateStart'])[_0x0c03('0x31')](0x1,_0x0c03('0x32'));}_[_0x0c03('0x33')](_0x1a3d62[_0x0c03('0x30')],{'createdAt':{'$gte':_0x7c6ba2[_0x0c03('0x27')],'$lte':_0x7c6ba2['dateEnd']}});}if(_0x10673f[_0x0c03('0x26')][_0x0c03('0x34')]){_0x1a3d62[_0x0c03('0x30')]=_[_0x0c03('0x33')](_0x1a3d62['where'],{'$or':_[_0x0c03('0x35')](_0x1a3d62['attributes'],function(_0x324341){var _0x1d1b5a={};_0x1d1b5a[_0x324341]={'$like':'%'+_0x10673f['query'][_0x0c03('0x34')]+'%'};return _0x1d1b5a;})});}_0x1a3d62=_[_0x0c03('0x33')]({},_0x1a3d62,_0x10673f[_0x0c03('0x36')]);var _0x4d1704={'where':_0x1a3d62['where']};return db[_0x0c03('0x22')][_0x0c03('0x11')](_0x4d1704)[_0x0c03('0x1a')](function(_0x3d76fb){_0x20d2bf['count']=_0x3d76fb;if(_0x10673f[_0x0c03('0x26')][_0x0c03('0x37')]){_0x1a3d62[_0x0c03('0x38')]=[{'all':!![]}];}return db[_0x0c03('0x22')][_0x0c03('0x39')](_0x1a3d62);})[_0x0c03('0x1a')](function(_0x5aef19){_0x20d2bf[_0x0c03('0x3a')]=_0x5aef19;return _0x20d2bf;})[_0x0c03('0x1a')](respondWithFilteredResult(_0x28f8d6,_0x1a3d62))[_0x0c03('0x3b')](handleError(_0x28f8d6,null));};exports[_0x0c03('0x3c')]=function(_0x2ddea9,_0x41848c){var _0x5e4130={'raw':![],'where':{'id':_0x2ddea9[_0x0c03('0x3d')]['id']}},_0x2e01f8={};_0x2e01f8[_0x0c03('0x24')]=_[_0x0c03('0x25')](db[_0x0c03('0x22')][_0x0c03('0x23')]);_0x2e01f8['query']=_[_0x0c03('0x25')](_0x2ddea9[_0x0c03('0x26')]);_0x2e01f8[_0x0c03('0x29')]=_[_0x0c03('0x2a')](_0x2e01f8[_0x0c03('0x24')],_0x2e01f8[_0x0c03('0x26')]);_0x5e4130[_0x0c03('0x2c')]=_[_0x0c03('0x2a')](_0x2e01f8[_0x0c03('0x24')],qs['fields'](_0x2ddea9['query']['fields']));_0x5e4130[_0x0c03('0x2c')]=_0x5e4130[_0x0c03('0x2c')][_0x0c03('0x2d')]?_0x5e4130[_0x0c03('0x2c')]:_0x2e01f8[_0x0c03('0x24')];if(_0x2ddea9[_0x0c03('0x26')][_0x0c03('0x37')]){_0x5e4130[_0x0c03('0x38')]=[{'all':!![]}];}_0x5e4130=_[_0x0c03('0x33')]({},_0x5e4130,_0x2ddea9[_0x0c03('0x36')]);return db['Automation']['find'](_0x5e4130)['then'](handleEntityNotFound(_0x41848c,null))[_0x0c03('0x1a')](respondWithResult(_0x41848c,null))['catch'](handleError(_0x41848c,null));};exports['create']=function(_0x283046,_0x42c428){return db['Automation'][_0x0c03('0x3e')](_0x283046[_0x0c03('0x3f')],{})[_0x0c03('0x1a')](respondWithResult(_0x42c428,0xc9))[_0x0c03('0x3b')](handleError(_0x42c428,null));};exports[_0x0c03('0x19')]=function(_0xf29c93,_0xb50878){if(_0xf29c93[_0x0c03('0x3f')]['id']){delete _0xf29c93[_0x0c03('0x3f')]['id'];}return db[_0x0c03('0x22')]['find']({'where':{'id':_0xf29c93[_0x0c03('0x3d')]['id']}})[_0x0c03('0x1a')](handleEntityNotFound(_0xb50878,null))['then'](saveUpdates(_0xf29c93[_0x0c03('0x3f')],null))[_0x0c03('0x1a')](respondWithResult(_0xb50878,null))[_0x0c03('0x3b')](handleError(_0xb50878,null));};exports[_0x0c03('0x1b')]=function(_0x35a09c,_0x41038f){return db['Automation'][_0x0c03('0x40')]({'where':{'id':_0x35a09c[_0x0c03('0x3d')]['id']}})[_0x0c03('0x1a')](handleEntityNotFound(_0x41038f,null))[_0x0c03('0x1a')](removeEntity(_0x41038f,null))['catch'](handleError(_0x41038f,null));};exports['addConditions']=function(_0x325123,_0x1f8978,_0x438689){return db[_0x0c03('0x41')]['find']({'where':{'id':_0x325123['params']['id']}})[_0x0c03('0x1a')](handleEntityNotFound(_0x1f8978,null))[_0x0c03('0x1a')](function(_0x474adb){if(_0x474adb){return _0x474adb['addConditions'](_0x325123[_0x0c03('0x3f')][_0x0c03('0x42')],_[_0x0c03('0x43')](_0x325123[_0x0c03('0x3f')],[_0x0c03('0x42'),'id'])||{});}})['then'](respondWithResult(_0x1f8978,null))[_0x0c03('0x3b')](handleError(_0x1f8978,null));};exports[_0x0c03('0x44')]=function(_0x354cfa,_0x218f54,_0x4dd7bd){var _0xf7bf64={};var _0x44d8fd={};var _0xb1d889;var _0x151069;return db[_0x0c03('0x22')][_0x0c03('0x45')]({'where':{'id':_0x354cfa['params']['id']}})['then'](handleEntityNotFound(_0x218f54,null))['then'](function(_0x500d7a){if(_0x500d7a){_0xb1d889=_0x500d7a;_0x44d8fd[_0x0c03('0x24')]=_[_0x0c03('0x25')](db[_0x0c03('0x41')][_0x0c03('0x23')]);_0x44d8fd['query']=_[_0x0c03('0x25')](_0x354cfa['query']);_0x44d8fd[_0x0c03('0x29')]=_[_0x0c03('0x2a')](_0x44d8fd[_0x0c03('0x24')],_0x44d8fd[_0x0c03('0x26')]);_0xf7bf64[_0x0c03('0x2c')]=_[_0x0c03('0x2a')](_0x44d8fd['model'],qs['fields'](_0x354cfa['query'][_0x0c03('0x2b')]));_0xf7bf64[_0x0c03('0x2c')]=_0xf7bf64[_0x0c03('0x2c')][_0x0c03('0x2d')]?_0xf7bf64[_0x0c03('0x2c')]:_0x44d8fd['model'];_0xf7bf64[_0x0c03('0x2e')]=qs['sort'](_0x354cfa[_0x0c03('0x26')][_0x0c03('0x2f')]);_0xf7bf64[_0x0c03('0x30')]=qs[_0x0c03('0x29')](_[_0x0c03('0x46')](_0x354cfa[_0x0c03('0x26')],_0x44d8fd[_0x0c03('0x29')]));if(_0x354cfa[_0x0c03('0x26')][_0x0c03('0x34')]){_0xf7bf64[_0x0c03('0x30')]=_[_0x0c03('0x33')](_0xf7bf64[_0x0c03('0x30')],{'$or':_['map'](_0xf7bf64['attributes'],function(_0x4190ea){var _0x450db7={};_0x450db7[_0x4190ea]={'$like':'%'+_0x354cfa[_0x0c03('0x26')]['filter']+'%'};return _0x450db7;})});}_0xf7bf64=_[_0x0c03('0x33')]({},_0xf7bf64,_0x354cfa['options']);return _0xb1d889[_0x0c03('0x44')](_0xf7bf64);}})[_0x0c03('0x1a')](function(_0x452e17){if(_0x452e17){_0x151069=_0x452e17['length'];if(!_0x354cfa[_0x0c03('0x26')][_0x0c03('0x47')](_0x0c03('0x48'))){_0xf7bf64[_0x0c03('0x13')]=qs[_0x0c03('0x13')](_0x354cfa[_0x0c03('0x26')][_0x0c03('0x13')]);_0xf7bf64[_0x0c03('0x12')]=qs[_0x0c03('0x12')](_0x354cfa['query'][_0x0c03('0x12')]);}return _0xb1d889[_0x0c03('0x44')](_0xf7bf64);}})['then'](function(_0x4c537d){if(_0x4c537d){return _0x4c537d?{'count':_0x151069,'rows':_0x4c537d}:null;}})[_0x0c03('0x1a')](respondWithResult(_0x218f54,null))[_0x0c03('0x3b')](handleError(_0x218f54,null));};exports['addActions']=function(_0x5130f4,_0x27ad0a,_0x2d12f5){return db['Action'][_0x0c03('0x40')]({'where':{'id':_0x5130f4[_0x0c03('0x3d')]['id']}})[_0x0c03('0x1a')](handleEntityNotFound(_0x27ad0a,null))['then'](function(_0x2779e7){if(_0x2779e7){return _0x2779e7['addActions'](_0x5130f4[_0x0c03('0x3f')]['ids'],_[_0x0c03('0x43')](_0x5130f4[_0x0c03('0x3f')],['ids','id'])||{});}})[_0x0c03('0x1a')](respondWithResult(_0x27ad0a,null))[_0x0c03('0x3b')](handleError(_0x27ad0a,null));};exports[_0x0c03('0x49')]=function(_0x413c81,_0x193602,_0x57f3a7){var _0x3f9e4d={};var _0x4dd54a={};var _0x49b09a;var _0x17e302;return db[_0x0c03('0x22')]['findOne']({'where':{'id':_0x413c81['params']['id']}})[_0x0c03('0x1a')](handleEntityNotFound(_0x193602,null))[_0x0c03('0x1a')](function(_0x69f8e2){if(_0x69f8e2){_0x49b09a=_0x69f8e2;_0x4dd54a['model']=_[_0x0c03('0x25')](db[_0x0c03('0x4a')][_0x0c03('0x23')]);_0x4dd54a[_0x0c03('0x26')]=_[_0x0c03('0x25')](_0x413c81[_0x0c03('0x26')]);_0x4dd54a[_0x0c03('0x29')]=_[_0x0c03('0x2a')](_0x4dd54a[_0x0c03('0x24')],_0x4dd54a[_0x0c03('0x26')]);_0x3f9e4d[_0x0c03('0x2c')]=_[_0x0c03('0x2a')](_0x4dd54a[_0x0c03('0x24')],qs[_0x0c03('0x2b')](_0x413c81['query'][_0x0c03('0x2b')]));_0x3f9e4d[_0x0c03('0x2c')]=_0x3f9e4d['attributes'][_0x0c03('0x2d')]?_0x3f9e4d[_0x0c03('0x2c')]:_0x4dd54a[_0x0c03('0x24')];_0x3f9e4d[_0x0c03('0x2e')]=qs['sort'](_0x413c81[_0x0c03('0x26')]['sort']);_0x3f9e4d[_0x0c03('0x30')]=qs[_0x0c03('0x29')](_['pick'](_0x413c81[_0x0c03('0x26')],_0x4dd54a[_0x0c03('0x29')]));if(_0x413c81['query'][_0x0c03('0x34')]){_0x3f9e4d[_0x0c03('0x30')]=_[_0x0c03('0x33')](_0x3f9e4d[_0x0c03('0x30')],{'$or':_[_0x0c03('0x35')](_0x3f9e4d[_0x0c03('0x2c')],function(_0x5bcd61){var _0x327d9f={};_0x327d9f[_0x5bcd61]={'$like':'%'+_0x413c81[_0x0c03('0x26')]['filter']+'%'};return _0x327d9f;})});}_0x3f9e4d=_[_0x0c03('0x33')]({},_0x3f9e4d,_0x413c81[_0x0c03('0x36')]);return _0x49b09a[_0x0c03('0x49')](_0x3f9e4d);}})[_0x0c03('0x1a')](function(_0x5440c6){if(_0x5440c6){_0x17e302=_0x5440c6['length'];if(!_0x413c81['query'][_0x0c03('0x47')](_0x0c03('0x48'))){_0x3f9e4d[_0x0c03('0x13')]=qs[_0x0c03('0x13')](_0x413c81[_0x0c03('0x26')][_0x0c03('0x13')]);_0x3f9e4d['offset']=qs['offset'](_0x413c81[_0x0c03('0x26')][_0x0c03('0x12')]);}return _0x49b09a[_0x0c03('0x49')](_0x3f9e4d);}})[_0x0c03('0x1a')](function(_0x1f2fc7){if(_0x1f2fc7){return _0x1f2fc7?{'count':_0x17e302,'rows':_0x1f2fc7}:null;}})['then'](respondWithResult(_0x193602,null))[_0x0c03('0x3b')](handleError(_0x193602,null));}; \ No newline at end of file +var _0x3286=['sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','Automation','count','includeAll','include','catch','params','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','pick','map','addActions','Action','getActions','options','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4676ce,_0xd438c3){var _0x582624=function(_0x509231){while(--_0x509231){_0x4676ce['push'](_0x4676ce['shift']());}};_0x582624(++_0xd438c3);}(_0x3286,0x12d));var _0x6328=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3286[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0x6328('0x0'));var rp=require(_0x6328('0x1'));var moment=require(_0x6328('0x2'));var BPromise=require(_0x6328('0x3'));var Mustache=require(_0x6328('0x4'));var util=require(_0x6328('0x5'));var path=require(_0x6328('0x6'));var sox=require(_0x6328('0x7'));var csv=require(_0x6328('0x8'));var ejs=require(_0x6328('0x9'));var fs=require('fs');var _=require(_0x6328('0xa'));var squel=require(_0x6328('0xb'));var crypto=require(_0x6328('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6328('0xd'));var toCsv=require(_0x6328('0x8'));var querystring=require(_0x6328('0xe'));var Papa=require('papaparse');var qs=require(_0x6328('0xf'));var logger=require(_0x6328('0x10'))('api');var utils=require(_0x6328('0x11'));var config=require(_0x6328('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20f24c,_0x17d6fb){_0x17d6fb=_0x17d6fb||0xcc;return function(_0x59f083){if(_0x59f083){return _0x20f24c[_0x6328('0x13')](_0x17d6fb);}return _0x20f24c[_0x6328('0x14')](_0x17d6fb)[_0x6328('0x15')]();};}function respondWithResult(_0x5c8fec,_0x5cf4eb){_0x5cf4eb=_0x5cf4eb||0xc8;return function(_0x4a2c3a){if(_0x4a2c3a){return _0x5c8fec[_0x6328('0x14')](_0x5cf4eb)[_0x6328('0x16')](_0x4a2c3a);}};}function respondWithFilteredResult(_0x38f52f,_0x500c95){return function(_0x95b25){if(_0x95b25){var _0x10888b=_0x95b25['count'],_0x37d927=_0x500c95[_0x6328('0x17')],_0x160f2c=_0x500c95[_0x6328('0x17')]+_0x500c95[_0x6328('0x18')],_0x1379c7;if(_0x160f2c>=_0x10888b){_0x160f2c=_0x10888b;_0x1379c7=0xc8;}else{_0x1379c7=0xce;}_0x38f52f[_0x6328('0x14')](_0x1379c7);return _0x38f52f[_0x6328('0x19')](_0x6328('0x1a'),_0x37d927+'-'+_0x160f2c+'/'+_0x10888b)[_0x6328('0x16')](_0x95b25);}return null;};}function patchUpdates(_0x3730ba){return function(_0xe73fe5){try{jsonpatch['apply'](_0xe73fe5,_0x3730ba,!![]);}catch(_0x3f01ed){return BPromise[_0x6328('0x1b')](_0x3f01ed);}return _0xe73fe5[_0x6328('0x1c')]();};}function saveUpdates(_0x3ff27e,_0x5df505){return function(_0x46331c){if(_0x46331c){return _0x46331c[_0x6328('0x1d')](_0x3ff27e)[_0x6328('0x1e')](function(_0x58dcad){return _0x58dcad;});}return null;};}function removeEntity(_0x51b115,_0x2f45f6){return function(_0x3d4f1c){if(_0x3d4f1c){return _0x3d4f1c['destroy']()['then'](function(){_0x51b115[_0x6328('0x14')](0xcc)[_0x6328('0x15')]();});}};}function handleEntityNotFound(_0x14bbb0,_0x1dcd64){return function(_0x168317){if(!_0x168317){_0x14bbb0[_0x6328('0x13')](0x194);}return _0x168317;};}function handleError(_0x229387,_0x16ae5b){_0x16ae5b=_0x16ae5b||0x1f4;return function(_0x27fe2d){logger[_0x6328('0x1f')](_0x27fe2d[_0x6328('0x20')]);if(_0x27fe2d[_0x6328('0x21')]){delete _0x27fe2d[_0x6328('0x21')];}_0x229387[_0x6328('0x14')](_0x16ae5b)[_0x6328('0x22')](_0x27fe2d);};}exports[_0x6328('0x23')]=function(_0x1cab13,_0x45e1b2){var _0xaa1e1f={},_0x4f5a40={},_0x2b1f9c={'count':0x0,'rows':[]};var _0x44a4e3=db['Automation'][_0x6328('0x24')];_0x4f5a40[_0x6328('0x25')]=_[_0x6328('0x26')](_0x44a4e3);var _0x29bbfe={'dateStart':_0x1cab13[_0x6328('0x27')][_0x6328('0x28')],'dateEnd':_0x1cab13[_0x6328('0x27')][_0x6328('0x29')]};delete _0x1cab13[_0x6328('0x27')][_0x6328('0x28')];delete _0x1cab13[_0x6328('0x27')][_0x6328('0x29')];_0x4f5a40[_0x6328('0x27')]=_['keys'](_0x1cab13[_0x6328('0x27')]);_0x4f5a40[_0x6328('0x2a')]=_[_0x6328('0x2b')](_0x4f5a40[_0x6328('0x25')],_0x4f5a40[_0x6328('0x27')]);_0xaa1e1f[_0x6328('0x2c')]=_[_0x6328('0x2b')](_0x4f5a40[_0x6328('0x25')],qs['fields'](_0x1cab13[_0x6328('0x27')][_0x6328('0x2d')]));_0xaa1e1f[_0x6328('0x2c')]=_0xaa1e1f[_0x6328('0x2c')][_0x6328('0x2e')]?_0xaa1e1f['attributes']:_0x4f5a40[_0x6328('0x25')];if(!_0x1cab13[_0x6328('0x27')][_0x6328('0x2f')](_0x6328('0x30'))){_0xaa1e1f[_0x6328('0x18')]=qs['limit'](_0x1cab13[_0x6328('0x27')][_0x6328('0x18')]);_0xaa1e1f['offset']=qs[_0x6328('0x17')](_0x1cab13[_0x6328('0x27')]['offset']);}_0xaa1e1f[_0x6328('0x31')]=qs['sort'](_0x1cab13['query'][_0x6328('0x32')]);_0xaa1e1f[_0x6328('0x33')]=qs[_0x6328('0x2a')](_['pick'](_0x1cab13['query'],_0x4f5a40[_0x6328('0x2a')]));if(_0x29bbfe[_0x6328('0x28')]){if(_0x29bbfe[_0x6328('0x29')]){_0x29bbfe['dateEnd']=moment(_0x29bbfe['dateEnd'])[_0x6328('0x34')](0x1,_0x6328('0x35'));}else{_0x29bbfe[_0x6328('0x29')]=moment(_0x29bbfe[_0x6328('0x28')])[_0x6328('0x34')](0x1,_0x6328('0x35'));}_[_0x6328('0x36')](_0xaa1e1f[_0x6328('0x33')],{'createdAt':{'$gte':_0x29bbfe['dateStart'],'$lte':_0x29bbfe[_0x6328('0x29')]}});}if(_0x1cab13[_0x6328('0x27')][_0x6328('0x37')]){_0xaa1e1f[_0x6328('0x33')]=_['merge'](_0xaa1e1f['where'],{'$or':_['map'](_0xaa1e1f['attributes'],function(_0x1961a1){var _0x53d648={};_0x53d648[_0x1961a1]={'$like':'%'+_0x1cab13['query']['filter']+'%'};return _0x53d648;})});}_0xaa1e1f=_[_0x6328('0x36')]({},_0xaa1e1f,_0x1cab13['options']);var _0x5a830c={'where':_0xaa1e1f[_0x6328('0x33')]};return db[_0x6328('0x38')][_0x6328('0x39')](_0x5a830c)[_0x6328('0x1e')](function(_0x3386e3){_0x2b1f9c[_0x6328('0x39')]=_0x3386e3;if(_0x1cab13[_0x6328('0x27')][_0x6328('0x3a')]){_0xaa1e1f[_0x6328('0x3b')]=[{'all':!![]}];}return db['Automation']['findAll'](_0xaa1e1f);})[_0x6328('0x1e')](function(_0x44193a){_0x2b1f9c['rows']=_0x44193a;return _0x2b1f9c;})[_0x6328('0x1e')](respondWithFilteredResult(_0x45e1b2,_0xaa1e1f))[_0x6328('0x3c')](handleError(_0x45e1b2,null));};exports['show']=function(_0x88004b,_0x2e3666){var _0x452621={'raw':![],'where':{'id':_0x88004b[_0x6328('0x3d')]['id']}},_0x420468={};_0x420468['model']=_['keys'](db[_0x6328('0x38')][_0x6328('0x24')]);_0x420468['query']=_[_0x6328('0x26')](_0x88004b[_0x6328('0x27')]);_0x420468['filters']=_['intersection'](_0x420468[_0x6328('0x25')],_0x420468[_0x6328('0x27')]);_0x452621[_0x6328('0x2c')]=_['intersection'](_0x420468[_0x6328('0x25')],qs[_0x6328('0x2d')](_0x88004b['query'][_0x6328('0x2d')]));_0x452621[_0x6328('0x2c')]=_0x452621[_0x6328('0x2c')][_0x6328('0x2e')]?_0x452621['attributes']:_0x420468['model'];if(_0x88004b[_0x6328('0x27')][_0x6328('0x3a')]){_0x452621['include']=[{'all':!![]}];}_0x452621=_[_0x6328('0x36')]({},_0x452621,_0x88004b['options']);return db[_0x6328('0x38')][_0x6328('0x3e')](_0x452621)[_0x6328('0x1e')](handleEntityNotFound(_0x2e3666,null))[_0x6328('0x1e')](respondWithResult(_0x2e3666,null))[_0x6328('0x3c')](handleError(_0x2e3666,null));};exports[_0x6328('0x3f')]=function(_0x1eddf1,_0x1b0889){return db[_0x6328('0x38')]['create'](_0x1eddf1[_0x6328('0x40')],{})[_0x6328('0x1e')](respondWithResult(_0x1b0889,0xc9))[_0x6328('0x3c')](handleError(_0x1b0889,null));};exports['update']=function(_0x3a5836,_0x37603b){if(_0x3a5836[_0x6328('0x40')]['id']){delete _0x3a5836[_0x6328('0x40')]['id'];}return db[_0x6328('0x38')][_0x6328('0x3e')]({'where':{'id':_0x3a5836[_0x6328('0x3d')]['id']}})[_0x6328('0x1e')](handleEntityNotFound(_0x37603b,null))[_0x6328('0x1e')](saveUpdates(_0x3a5836[_0x6328('0x40')],null))['then'](respondWithResult(_0x37603b,null))[_0x6328('0x3c')](handleError(_0x37603b,null));};exports['destroy']=function(_0x354fb8,_0x1c396e){return db[_0x6328('0x38')][_0x6328('0x3e')]({'where':{'id':_0x354fb8[_0x6328('0x3d')]['id']}})[_0x6328('0x1e')](handleEntityNotFound(_0x1c396e,null))[_0x6328('0x1e')](removeEntity(_0x1c396e,null))[_0x6328('0x3c')](handleError(_0x1c396e,null));};exports[_0x6328('0x41')]=function(_0xc8ff08,_0x579b8e,_0x301c4d){return db[_0x6328('0x42')][_0x6328('0x3e')]({'where':{'id':_0xc8ff08[_0x6328('0x3d')]['id']}})[_0x6328('0x1e')](handleEntityNotFound(_0x579b8e,null))['then'](function(_0xc9d027){if(_0xc9d027){return _0xc9d027[_0x6328('0x41')](_0xc8ff08['body'][_0x6328('0x43')],_[_0x6328('0x44')](_0xc8ff08[_0x6328('0x40')],[_0x6328('0x43'),'id'])||{});}})[_0x6328('0x1e')](respondWithResult(_0x579b8e,null))['catch'](handleError(_0x579b8e,null));};exports[_0x6328('0x45')]=function(_0x1267fd,_0x178c4b,_0x19f20c){var _0x170d17={};var _0x2346ef={};var _0x4f038a;var _0x27012d;return db[_0x6328('0x38')][_0x6328('0x46')]({'where':{'id':_0x1267fd[_0x6328('0x3d')]['id']}})[_0x6328('0x1e')](handleEntityNotFound(_0x178c4b,null))[_0x6328('0x1e')](function(_0x4fbe20){if(_0x4fbe20){_0x4f038a=_0x4fbe20;_0x2346ef[_0x6328('0x25')]=_[_0x6328('0x26')](db[_0x6328('0x42')][_0x6328('0x24')]);_0x2346ef['query']=_['keys'](_0x1267fd[_0x6328('0x27')]);_0x2346ef[_0x6328('0x2a')]=_[_0x6328('0x2b')](_0x2346ef['model'],_0x2346ef['query']);_0x170d17[_0x6328('0x2c')]=_[_0x6328('0x2b')](_0x2346ef['model'],qs[_0x6328('0x2d')](_0x1267fd[_0x6328('0x27')][_0x6328('0x2d')]));_0x170d17[_0x6328('0x2c')]=_0x170d17[_0x6328('0x2c')][_0x6328('0x2e')]?_0x170d17['attributes']:_0x2346ef[_0x6328('0x25')];_0x170d17[_0x6328('0x31')]=qs['sort'](_0x1267fd['query']['sort']);_0x170d17[_0x6328('0x33')]=qs[_0x6328('0x2a')](_[_0x6328('0x47')](_0x1267fd['query'],_0x2346ef[_0x6328('0x2a')]));if(_0x1267fd[_0x6328('0x27')][_0x6328('0x37')]){_0x170d17[_0x6328('0x33')]=_[_0x6328('0x36')](_0x170d17[_0x6328('0x33')],{'$or':_[_0x6328('0x48')](_0x170d17['attributes'],function(_0x7601de){var _0x44c558={};_0x44c558[_0x7601de]={'$like':'%'+_0x1267fd[_0x6328('0x27')][_0x6328('0x37')]+'%'};return _0x44c558;})});}_0x170d17=_[_0x6328('0x36')]({},_0x170d17,_0x1267fd['options']);return _0x4f038a['getConditions'](_0x170d17);}})[_0x6328('0x1e')](function(_0x48315e){if(_0x48315e){_0x27012d=_0x48315e[_0x6328('0x2e')];if(!_0x1267fd[_0x6328('0x27')][_0x6328('0x2f')](_0x6328('0x30'))){_0x170d17[_0x6328('0x18')]=qs['limit'](_0x1267fd[_0x6328('0x27')][_0x6328('0x18')]);_0x170d17['offset']=qs['offset'](_0x1267fd[_0x6328('0x27')][_0x6328('0x17')]);}return _0x4f038a[_0x6328('0x45')](_0x170d17);}})[_0x6328('0x1e')](function(_0x3805f9){if(_0x3805f9){return _0x3805f9?{'count':_0x27012d,'rows':_0x3805f9}:null;}})[_0x6328('0x1e')](respondWithResult(_0x178c4b,null))[_0x6328('0x3c')](handleError(_0x178c4b,null));};exports[_0x6328('0x49')]=function(_0x43233d,_0x30104b,_0x5e4536){return db[_0x6328('0x4a')]['find']({'where':{'id':_0x43233d[_0x6328('0x3d')]['id']}})['then'](handleEntityNotFound(_0x30104b,null))[_0x6328('0x1e')](function(_0x488194){if(_0x488194){return _0x488194[_0x6328('0x49')](_0x43233d['body']['ids'],_[_0x6328('0x44')](_0x43233d['body'],[_0x6328('0x43'),'id'])||{});}})[_0x6328('0x1e')](respondWithResult(_0x30104b,null))[_0x6328('0x3c')](handleError(_0x30104b,null));};exports[_0x6328('0x4b')]=function(_0x41fe03,_0x29562d,_0x293878){var _0x2e8482={};var _0x21455b={};var _0x20e94b;var _0x2a4cbd;return db[_0x6328('0x38')][_0x6328('0x46')]({'where':{'id':_0x41fe03[_0x6328('0x3d')]['id']}})['then'](handleEntityNotFound(_0x29562d,null))['then'](function(_0x25cbb4){if(_0x25cbb4){_0x20e94b=_0x25cbb4;_0x21455b[_0x6328('0x25')]=_[_0x6328('0x26')](db['Action'][_0x6328('0x24')]);_0x21455b[_0x6328('0x27')]=_['keys'](_0x41fe03[_0x6328('0x27')]);_0x21455b[_0x6328('0x2a')]=_[_0x6328('0x2b')](_0x21455b['model'],_0x21455b[_0x6328('0x27')]);_0x2e8482['attributes']=_[_0x6328('0x2b')](_0x21455b['model'],qs[_0x6328('0x2d')](_0x41fe03[_0x6328('0x27')][_0x6328('0x2d')]));_0x2e8482['attributes']=_0x2e8482['attributes'][_0x6328('0x2e')]?_0x2e8482['attributes']:_0x21455b[_0x6328('0x25')];_0x2e8482[_0x6328('0x31')]=qs[_0x6328('0x32')](_0x41fe03['query']['sort']);_0x2e8482['where']=qs[_0x6328('0x2a')](_[_0x6328('0x47')](_0x41fe03[_0x6328('0x27')],_0x21455b[_0x6328('0x2a')]));if(_0x41fe03[_0x6328('0x27')][_0x6328('0x37')]){_0x2e8482[_0x6328('0x33')]=_[_0x6328('0x36')](_0x2e8482[_0x6328('0x33')],{'$or':_[_0x6328('0x48')](_0x2e8482[_0x6328('0x2c')],function(_0x44c98e){var _0x11f866={};_0x11f866[_0x44c98e]={'$like':'%'+_0x41fe03[_0x6328('0x27')][_0x6328('0x37')]+'%'};return _0x11f866;})});}_0x2e8482=_[_0x6328('0x36')]({},_0x2e8482,_0x41fe03[_0x6328('0x4c')]);return _0x20e94b[_0x6328('0x4b')](_0x2e8482);}})[_0x6328('0x1e')](function(_0x3ff02b){if(_0x3ff02b){_0x2a4cbd=_0x3ff02b[_0x6328('0x2e')];if(!_0x41fe03['query'][_0x6328('0x2f')](_0x6328('0x30'))){_0x2e8482[_0x6328('0x18')]=qs[_0x6328('0x18')](_0x41fe03[_0x6328('0x27')][_0x6328('0x18')]);_0x2e8482[_0x6328('0x17')]=qs['offset'](_0x41fe03[_0x6328('0x27')]['offset']);}return _0x20e94b[_0x6328('0x4b')](_0x2e8482);}})['then'](function(_0x9221b3){if(_0x9221b3){return _0x9221b3?{'count':_0x2a4cbd,'rows':_0x9221b3}:null;}})[_0x6328('0x1e')](respondWithResult(_0x29562d,null))[_0x6328('0x3c')](handleError(_0x29562d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8176d2c..6403b8e 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 _0x7753=['exports','define','tools_automations','lodash','util','../../config/logger','api','moment','request-promise','./automation.attributes'];(function(_0x3bd6d8,_0x56131e){var _0x553332=function(_0x5d0e8f){while(--_0x5d0e8f){_0x3bd6d8['push'](_0x3bd6d8['shift']());}};_0x553332(++_0x56131e);}(_0x7753,0xfd));var _0x3775=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x7753[_0x845505];return _0x2513b9;};'use strict';var _=require(_0x3775('0x0'));var util=require(_0x3775('0x1'));var logger=require(_0x3775('0x2'))(_0x3775('0x3'));var moment=require(_0x3775('0x4'));var BPromise=require('bluebird');var rp=require(_0x3775('0x5'));var attributes=require(_0x3775('0x6'));module[_0x3775('0x7')]=function(_0x5afdec,_0x1762a6){return _0x5afdec[_0x3775('0x8')]('Automation',attributes,{'tableName':_0x3775('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x191f=['Automation','tools_automations','api','moment','bluebird','request-promise','./automation.attributes','exports','define'];(function(_0x4207a8,_0x289988){var _0x394eed=function(_0x9304fa){while(--_0x9304fa){_0x4207a8['push'](_0x4207a8['shift']());}};_0x394eed(++_0x289988);}(_0x191f,0x9b));var _0xf191=function(_0x1fa29d,_0x458e1b){_0x1fa29d=_0x1fa29d-0x0;var _0x1614eb=_0x191f[_0x1fa29d];return _0x1614eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf191('0x0'));var moment=require(_0xf191('0x1'));var BPromise=require(_0xf191('0x2'));var rp=require(_0xf191('0x3'));var attributes=require(_0xf191('0x4'));module[_0xf191('0x5')]=function(_0x4d1368,_0x57fbce){return _0x4d1368[_0xf191('0x6')](_0xf191('0x7'),attributes,{'tableName':_0xf191('0x8'),'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 22f6598..5814a90 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 _0xe63b=['request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x6f116f,_0x48c8bd){var _0x120342=function(_0xa8e20a){while(--_0xa8e20a){_0x6f116f['push'](_0x6f116f['shift']());}};_0x120342(++_0x48c8bd);}(_0xe63b,0xf2));var _0xbe63=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0xe63b[_0x217c2e];return _0x22b7d8;};'use strict';var _=require(_0xbe63('0x0'));var util=require(_0xbe63('0x1'));var moment=require(_0xbe63('0x2'));var BPromise=require(_0xbe63('0x3'));var rs=require(_0xbe63('0x4'));var fs=require('fs');var db=require(_0xbe63('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe63('0x6'))(_0xbe63('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbe63('0x8')][_0xbe63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xec936b,_0x51c4dd,_0x36ea5a){return new BPromise(function(_0xbcc65c,_0x5c5ee1){return client[_0xbe63('0xa')](_0xec936b,_0x36ea5a)[_0xbe63('0xb')](function(_0x14da1c){logger[_0xbe63('0xc')](_0xbe63('0xd'),_0x51c4dd,_0xbe63('0xe'));logger[_0xbe63('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x51c4dd,_0xbe63('0xe'),JSON['stringify'](_0x14da1c));if(_0x14da1c[_0xbe63('0x10')]){if(_0x14da1c[_0xbe63('0x10')][_0xbe63('0x11')]===0x1f4){logger[_0xbe63('0x10')]('Automation,\x20%s,\x20%s',_0x51c4dd,_0x14da1c[_0xbe63('0x10')]['message']);return _0x5c5ee1(_0x14da1c['error']['message']);}logger[_0xbe63('0x10')](_0xbe63('0xd'),_0x51c4dd,_0x14da1c[_0xbe63('0x10')]['message']);return _0xbcc65c(_0x14da1c['error'][_0xbe63('0x12')]);}else{logger['info'](_0xbe63('0xd'),_0x51c4dd,_0xbe63('0xe'));_0xbcc65c(_0x14da1c[_0xbe63('0x13')][_0xbe63('0x12')]);}})[_0xbe63('0x14')](function(_0x3d0520){logger['error'](_0xbe63('0xd'),_0x51c4dd,_0x3d0520);_0x5c5ee1(_0x3d0520);});});} \ No newline at end of file +var _0x8cdf=['stringify','code','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8cdf,0xa6));var _0xf8cd=function(_0x3c7aca,_0x23435d){_0x3c7aca=_0x3c7aca-0x0;var _0x50637f=_0x8cdf[_0x3c7aca];return _0x50637f;};'use strict';var _=require(_0xf8cd('0x0'));var util=require(_0xf8cd('0x1'));var moment=require(_0xf8cd('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8cd('0x3'));var fs=require('fs');var db=require(_0xf8cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf8cd('0x5'));var config=require(_0xf8cd('0x6'));var jayson=require(_0xf8cd('0x7'));var client=jayson['client'][_0xf8cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x594db5,_0x32d02a,_0x17660a){return new BPromise(function(_0x50fb30,_0x598f1c){return client['request'](_0x594db5,_0x17660a)['then'](function(_0x597a3c){logger[_0xf8cd('0x9')](_0xf8cd('0xa'),_0x32d02a,'request\x20sent');logger[_0xf8cd('0xb')](_0xf8cd('0xc'),_0x32d02a,_0xf8cd('0xd'),JSON[_0xf8cd('0xe')](_0x597a3c));if(_0x597a3c['error']){if(_0x597a3c['error'][_0xf8cd('0xf')]===0x1f4){logger[_0xf8cd('0x10')]('Automation,\x20%s,\x20%s',_0x32d02a,_0x597a3c[_0xf8cd('0x10')]['message']);return _0x598f1c(_0x597a3c[_0xf8cd('0x10')][_0xf8cd('0x11')]);}logger['error'](_0xf8cd('0xa'),_0x32d02a,_0x597a3c[_0xf8cd('0x10')][_0xf8cd('0x11')]);return _0x50fb30(_0x597a3c[_0xf8cd('0x10')][_0xf8cd('0x11')]);}else{logger['info'](_0xf8cd('0xa'),_0x32d02a,_0xf8cd('0xd'));_0x50fb30(_0x597a3c[_0xf8cd('0x12')][_0xf8cd('0x11')]);}})[_0xf8cd('0x13')](function(_0x4f604c){logger[_0xf8cd('0x10')]('Automation,\x20%s,\x20%s',_0x32d02a,_0x4f604c);_0x598f1c(_0x4f604c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4b89fc3..c801dd3 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 _0x9957=['./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','/:id/actions','getActions','post','create','addActions','put','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b9a51,_0x11f56b){var _0x3a4866=function(_0x278101){while(--_0x278101){_0x1b9a51['push'](_0x1b9a51['shift']());}};_0x3a4866(++_0x11f56b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var express=require(_0x7995('0x3'));var router=express['Router']();var auth=require(_0x7995('0x4'));var interaction=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));var controller=require(_0x7995('0x7'));router['get']('/',auth[_0x7995('0x8')](),controller[_0x7995('0x9')]);router[_0x7995('0xa')](_0x7995('0xb'),auth[_0x7995('0x8')](),controller[_0x7995('0xc')]);router['get'](_0x7995('0xd'),auth[_0x7995('0x8')](),controller['getConditions']);router[_0x7995('0xa')](_0x7995('0xe'),auth[_0x7995('0x8')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x8')](),controller[_0x7995('0x11')]);router['post'](_0x7995('0xd'),auth[_0x7995('0x8')](),controller['addConditions']);router[_0x7995('0x10')](_0x7995('0xe'),auth[_0x7995('0x8')](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xb'),auth[_0x7995('0x8')](),controller['update']);router['delete'](_0x7995('0xb'),auth[_0x7995('0x8')](),controller[_0x7995('0x14')]);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x7a54=['path','Router','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getActions','/:id/conditions','addConditions','post','/:id/actions','addActions','update','delete','destroy','exports','multer','util'];(function(_0x36b015,_0x324d28){var _0x7cbd02=function(_0x1508c0){while(--_0x1508c0){_0x36b015['push'](_0x36b015['shift']());}};_0x7cbd02(++_0x324d28);}(_0x7a54,0x106));var _0x47a5=function(_0x25c5b2,_0x116ec8){_0x25c5b2=_0x25c5b2-0x0;var _0x2f87d3=_0x7a54[_0x25c5b2];return _0x2f87d3;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var express=require('express');var router=express[_0x47a5('0x3')]();var auth=require(_0x47a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47a5('0x5'));var controller=require(_0x47a5('0x6'));router[_0x47a5('0x7')]('/',auth[_0x47a5('0x8')](),controller[_0x47a5('0x9')]);router['get'](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router[_0x47a5('0x7')]('/:id/conditions',auth[_0x47a5('0x8')](),controller['getConditions']);router['get']('/:id/actions',auth[_0x47a5('0x8')](),controller[_0x47a5('0xc')]);router['post']('/',auth[_0x47a5('0x8')](),controller['create']);router['post'](_0x47a5('0xd'),auth[_0x47a5('0x8')](),controller[_0x47a5('0xe')]);router[_0x47a5('0xf')](_0x47a5('0x10'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x11')]);router['put'](_0x47a5('0xa'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x13')](_0x47a5('0xa'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x14')]);module[_0x47a5('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 28d00f2..8dd27fc 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 _0xcb45=['#AMD\x20Between\x20Words\x20Silence','#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)','sequelize','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','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)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length'];(function(_0x2613bd,_0x4b3449){var _0x125748=function(_0x24fbc6){while(--_0x24fbc6){_0x2613bd['push'](_0x2613bd['shift']());}};_0x125748(++_0x4b3449);}(_0xcb45,0x19b));var _0x5cb4=function(_0x2215b,_0x3a576a){_0x2215b=_0x2215b-0x0;var _0x3808bb=_0xcb45[_0x2215b];return _0x3808bb;};'use strict';var Sequelize=require(_0x5cb4('0x0'));module['exports']={'name':{'type':Sequelize[_0x5cb4('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5cb4('0x2')](_0x5cb4('0x3')),'allowNull':![],'defaultValue':_0x5cb4('0x3')},'description':{'type':Sequelize[_0x5cb4('0x1')]},'active':{'type':Sequelize[_0x5cb4('0x4')],'defaultValue':0x0,'comment':_0x5cb4('0x5')},'limitCalls':{'type':Sequelize[_0x5cb4('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5cb4('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5cb4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5cb4('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x5cb4('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5cb4('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5cb4('0x6')](0x3)[_0x5cb4('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5cb4('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5cb4('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x5cb4('0x6')](0x3)[_0x5cb4('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5cb4('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5cb4('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5cb4('0x9')],'defaultValue':0x3,'comment':_0x5cb4('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5cb4('0x6')](0x5)[_0x5cb4('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x5cb4('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x5cb4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5cb4('0x1')],'defaultValue':_0x5cb4('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x5cb4('0x2')]('always',_0x5cb4('0xe'),'onlyIfOpen'),'defaultValue':_0x5cb4('0xf')},'dialAMDActive':{'type':Sequelize[_0x5cb4('0x4')],'defaultValue':0x0,'comment':_0x5cb4('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x5cb4('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x5cb4('0x6')](0x9)[_0x5cb4('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5cb4('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5cb4('0x6')](0x9)[_0x5cb4('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5cb4('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5cb4('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5cb4('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0x5cb4('0x6')](0x9)[_0x5cb4('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5cb4('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5cb4('0x6')](0x9)[_0x5cb4('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5cb4('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5cb4('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5cb4('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5cb4('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5cb4('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x5cb4('0x17'),_0x5cb4('0x18')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x5cb4('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5cb4('0x6')](0x3)[_0x5cb4('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5cb4('0x19')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5cb4('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5cb4('0x1a')}}; \ No newline at end of file +var _0x2027=['sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x2e0f70,_0x18264a){var _0x403ba3=function(_0x3f2f24){while(--_0x3f2f24){_0x2e0f70['push'](_0x2e0f70['shift']());}};_0x403ba3(++_0x18264a);}(_0x2027,0x9b));var _0x7202=function(_0x5c3270,_0x47a464){_0x5c3270=_0x5c3270-0x0;var _0x441c5e=_0x2027[_0x5c3270];return _0x441c5e;};'use strict';var Sequelize=require(_0x7202('0x0'));module[_0x7202('0x1')]={'name':{'type':Sequelize[_0x7202('0x2')],'unique':_0x7202('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7202('0x4')](_0x7202('0x5')),'allowNull':![],'defaultValue':_0x7202('0x5')},'description':{'type':Sequelize[_0x7202('0x2')]},'active':{'type':Sequelize[_0x7202('0x6')],'defaultValue':0x0,'comment':_0x7202('0x7')},'limitCalls':{'type':Sequelize[_0x7202('0x8')](0x4)[_0x7202('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7202('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7202('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x7202('0x8')](0x3)[_0x7202('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7202('0x8')](0x3)[_0x7202('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7202('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7202('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7202('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7202('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7202('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7202('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7202('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7202('0x8')](0x3)[_0x7202('0x9')],'defaultValue':0x3,'comment':_0x7202('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7202('0x8')](0x5)[_0x7202('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7202('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7202('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7202('0x10')},'dialTimezone':{'type':Sequelize[_0x7202('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7202('0x2')],'defaultValue':_0x7202('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x7202('0x4')]('always','never',_0x7202('0x12')),'defaultValue':_0x7202('0x13')},'dialAMDActive':{'type':Sequelize[_0x7202('0x6')],'defaultValue':0x0,'comment':_0x7202('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x7202('0x8')](0x9)[_0x7202('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7202('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x7202('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7202('0x8')](0x9)[_0x7202('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7202('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7202('0x8')](0x9)[_0x7202('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7202('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x7202('0x8')](0x9)[_0x7202('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7202('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7202('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7202('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7202('0x8')](0x5)[_0x7202('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7202('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7202('0x8')](0x9)[_0x7202('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7202('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x7202('0x1b'),_0x7202('0x1c')),'defaultValue':_0x7202('0x1b')},'dialPrefix':{'type':Sequelize[_0x7202('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7202('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7202('0x1d')},'dialCutDigit':{'type':Sequelize[_0x7202('0x8')](0x3)[_0x7202('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7202('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 79723af..5a5f54e 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 _0xbc8f=['getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','dialCheckDuplicateType','always','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','calleridnum','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','insert','fromQuery','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','spread','cm_hopper_black','push','removeBlackLists','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','save','then','destroy','error','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','map','options','count','includeAll','include','Campaign','catch','show','params','find','create','body','clone','get','createdAt','updatedAt','omit','update','findOne','CmHopper','pick','CampaignId','filter','findAll','rows'];(function(_0xb4bdb3,_0x48dca0){var _0x4c8c02=function(_0xf9850c){while(--_0xf9850c){_0xb4bdb3['push'](_0xb4bdb3['shift']());}};_0x4c8c02(++_0x48dca0);}(_0xbc8f,0x110));var _0xfbc8=function(_0xb66c03,_0x31ac80){_0xb66c03=_0xb66c03-0x0;var _0x536309=_0xbc8f[_0xb66c03];return _0x536309;};'use strict';var jsonpatch=require(_0xfbc8('0x0'));var rp=require(_0xfbc8('0x1'));var moment=require('moment');var BPromise=require(_0xfbc8('0x2'));var Mustache=require(_0xfbc8('0x3'));var util=require('util');var path=require(_0xfbc8('0x4'));var sox=require('sox');var csv=require(_0xfbc8('0x5'));var ejs=require(_0xfbc8('0x6'));var fs=require('fs');var _=require(_0xfbc8('0x7'));var squel=require(_0xfbc8('0x8'));var crypto=require(_0xfbc8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfbc8('0xa'));var toCsv=require('to-csv');var querystring=require(_0xfbc8('0xb'));var Papa=require(_0xfbc8('0xc'));var qs=require(_0xfbc8('0xd'));var logger=require(_0xfbc8('0xe'))(_0xfbc8('0xf'));var utils=require('../../config/utils');var config=require(_0xfbc8('0x10'));var db=require(_0xfbc8('0x11'))['db'];function respondWithStatusCode(_0x530d09,_0xd39077){_0xd39077=_0xd39077||0xcc;return function(_0x4758f4){if(_0x4758f4){return _0x530d09[_0xfbc8('0x12')](_0xd39077);}return _0x530d09[_0xfbc8('0x13')](_0xd39077)[_0xfbc8('0x14')]();};}function respondWithResult(_0x31bd24,_0x5ba005){_0x5ba005=_0x5ba005||0xc8;return function(_0x1d9671){if(_0x1d9671){return _0x31bd24['status'](_0x5ba005)[_0xfbc8('0x15')](_0x1d9671);}};}function respondWithFilteredResult(_0x45a520,_0x36a730){return function(_0x5c8df0){if(_0x5c8df0){var _0x3f2f69=_0x5c8df0['count'],_0x5701e9=_0x36a730[_0xfbc8('0x16')],_0x56da57=_0x36a730['offset']+_0x36a730[_0xfbc8('0x17')],_0x608809;if(_0x56da57>=_0x3f2f69){_0x56da57=_0x3f2f69;_0x608809=0xc8;}else{_0x608809=0xce;}_0x45a520['status'](_0x608809);return _0x45a520['set']('Content-Range',_0x5701e9+'-'+_0x56da57+'/'+_0x3f2f69)[_0xfbc8('0x15')](_0x5c8df0);}return null;};}function patchUpdates(_0x57c344){return function(_0xf0e5b7){try{jsonpatch['apply'](_0xf0e5b7,_0x57c344,!![]);}catch(_0xd3fa9){return BPromise[_0xfbc8('0x18')](_0xd3fa9);}return _0xf0e5b7[_0xfbc8('0x19')]();};}function saveUpdates(_0xcac8a0,_0x53a783){return function(_0xa7f274){if(_0xa7f274){return _0xa7f274['update'](_0xcac8a0)[_0xfbc8('0x1a')](function(_0x1a9f3e){return _0x1a9f3e;});}return null;};}function removeEntity(_0x1ee100,_0x4d2e0e){return function(_0x306dae){if(_0x306dae){return _0x306dae[_0xfbc8('0x1b')]()[_0xfbc8('0x1a')](function(){_0x1ee100['status'](0xcc)[_0xfbc8('0x14')]();});}};}function handleEntityNotFound(_0x17e09e,_0xdd234){return function(_0x5c2812){if(!_0x5c2812){_0x17e09e[_0xfbc8('0x12')](0x194);}return _0x5c2812;};}function handleError(_0x13d968,_0x26a37e){_0x26a37e=_0x26a37e||0x1f4;return function(_0x4a283f){logger[_0xfbc8('0x1c')](_0x4a283f['stack']);if(_0x4a283f[_0xfbc8('0x1d')]){delete _0x4a283f[_0xfbc8('0x1d')];}_0x13d968[_0xfbc8('0x13')](_0x26a37e)[_0xfbc8('0x1e')](_0x4a283f);};}exports[_0xfbc8('0x1f')]=function(_0x4df185,_0x35c232){var _0x21e17b={},_0x20292f={},_0x3d65e5={'count':0x0,'rows':[]};var _0x540de7=db['Campaign'][_0xfbc8('0x20')];_0x20292f[_0xfbc8('0x21')]=_[_0xfbc8('0x22')](_0x540de7);var _0x507cd0={'dateStart':_0x4df185[_0xfbc8('0x23')][_0xfbc8('0x24')],'dateEnd':_0x4df185[_0xfbc8('0x23')][_0xfbc8('0x25')]};delete _0x4df185[_0xfbc8('0x23')][_0xfbc8('0x24')];delete _0x4df185[_0xfbc8('0x23')][_0xfbc8('0x25')];_0x20292f['query']=_[_0xfbc8('0x22')](_0x4df185[_0xfbc8('0x23')]);_0x20292f[_0xfbc8('0x26')]=_[_0xfbc8('0x27')](_0x20292f['model'],_0x20292f['query']);_0x21e17b[_0xfbc8('0x28')]=_[_0xfbc8('0x27')](_0x20292f[_0xfbc8('0x21')],qs['fields'](_0x4df185[_0xfbc8('0x23')][_0xfbc8('0x29')]));_0x21e17b[_0xfbc8('0x28')]=_0x21e17b[_0xfbc8('0x28')][_0xfbc8('0x2a')]?_0x21e17b[_0xfbc8('0x28')]:_0x20292f[_0xfbc8('0x21')];if(!_0x4df185[_0xfbc8('0x23')][_0xfbc8('0x2b')](_0xfbc8('0x2c'))){_0x21e17b[_0xfbc8('0x17')]=qs[_0xfbc8('0x17')](_0x4df185[_0xfbc8('0x23')][_0xfbc8('0x17')]);_0x21e17b[_0xfbc8('0x16')]=qs['offset'](_0x4df185[_0xfbc8('0x23')][_0xfbc8('0x16')]);}_0x21e17b[_0xfbc8('0x2d')]=qs[_0xfbc8('0x2e')](_0x4df185[_0xfbc8('0x23')][_0xfbc8('0x2e')]);_0x21e17b[_0xfbc8('0x2f')]=qs['filters'](_['pick'](_0x4df185[_0xfbc8('0x23')],_0x20292f['filters']));if(_0x507cd0[_0xfbc8('0x24')]){if(_0x507cd0['dateEnd']){_0x507cd0['dateEnd']=moment(_0x507cd0['dateEnd'])[_0xfbc8('0x30')](0x1,_0xfbc8('0x31'));}else{_0x507cd0['dateEnd']=moment(_0x507cd0[_0xfbc8('0x24')])[_0xfbc8('0x30')](0x1,'day');}_['merge'](_0x21e17b[_0xfbc8('0x2f')],{'createdAt':{'$gte':_0x507cd0[_0xfbc8('0x24')],'$lte':_0x507cd0[_0xfbc8('0x25')]}});}if(_0x4df185[_0xfbc8('0x23')]['filter']){_0x21e17b[_0xfbc8('0x2f')]=_[_0xfbc8('0x32')](_0x21e17b[_0xfbc8('0x2f')],{'$or':_[_0xfbc8('0x33')](_0x21e17b[_0xfbc8('0x28')],function(_0x42feaa){var _0x7ef3a8={};_0x7ef3a8[_0x42feaa]={'$like':'%'+_0x4df185['query']['filter']+'%'};return _0x7ef3a8;})});}_0x21e17b=_['merge']({},_0x21e17b,_0x4df185[_0xfbc8('0x34')]);var _0x2c2e1a={'where':_0x21e17b['where']};return db['Campaign'][_0xfbc8('0x35')](_0x2c2e1a)['then'](function(_0xe7ce11){_0x3d65e5[_0xfbc8('0x35')]=_0xe7ce11;if(_0x4df185['query'][_0xfbc8('0x36')]){_0x21e17b[_0xfbc8('0x37')]=[{'all':!![]}];}return db[_0xfbc8('0x38')]['findAll'](_0x21e17b);})['then'](function(_0x2cf582){_0x3d65e5['rows']=_0x2cf582;return _0x3d65e5;})[_0xfbc8('0x1a')](respondWithFilteredResult(_0x35c232,_0x21e17b))[_0xfbc8('0x39')](handleError(_0x35c232,null));};exports[_0xfbc8('0x3a')]=function(_0x3431fd,_0x327041){var _0xd0bc68={'raw':![],'where':{'id':_0x3431fd[_0xfbc8('0x3b')]['id']}},_0x1757bf={};_0x1757bf['model']=_['keys'](db[_0xfbc8('0x38')][_0xfbc8('0x20')]);_0x1757bf[_0xfbc8('0x23')]=_[_0xfbc8('0x22')](_0x3431fd[_0xfbc8('0x23')]);_0x1757bf[_0xfbc8('0x26')]=_[_0xfbc8('0x27')](_0x1757bf[_0xfbc8('0x21')],_0x1757bf[_0xfbc8('0x23')]);_0xd0bc68[_0xfbc8('0x28')]=_['intersection'](_0x1757bf[_0xfbc8('0x21')],qs[_0xfbc8('0x29')](_0x3431fd[_0xfbc8('0x23')][_0xfbc8('0x29')]));_0xd0bc68[_0xfbc8('0x28')]=_0xd0bc68[_0xfbc8('0x28')][_0xfbc8('0x2a')]?_0xd0bc68[_0xfbc8('0x28')]:_0x1757bf[_0xfbc8('0x21')];if(_0x3431fd[_0xfbc8('0x23')]['includeAll']){_0xd0bc68['include']=[{'all':!![]}];}_0xd0bc68=_[_0xfbc8('0x32')]({},_0xd0bc68,_0x3431fd[_0xfbc8('0x34')]);return db[_0xfbc8('0x38')][_0xfbc8('0x3c')](_0xd0bc68)[_0xfbc8('0x1a')](handleEntityNotFound(_0x327041,null))[_0xfbc8('0x1a')](respondWithResult(_0x327041,null))['catch'](handleError(_0x327041,null));};exports['create']=function(_0x3daa37,_0x380202){return db[_0xfbc8('0x38')][_0xfbc8('0x3d')](_0x3daa37[_0xfbc8('0x3e')],{})[_0xfbc8('0x1a')](respondWithResult(_0x380202,0xc9))[_0xfbc8('0x39')](handleError(_0x380202,null));};exports[_0xfbc8('0x3f')]=function(_0x5a7cfc,_0x258eb8){var _0x16d5cb={'raw':![],'where':{'id':_0x5a7cfc[_0xfbc8('0x3b')]['id']}},_0x2a115c={};_0x2a115c[_0xfbc8('0x21')]=_[_0xfbc8('0x22')](db[_0xfbc8('0x38')]['rawAttributes']);_0x16d5cb['attributes']=_[_0xfbc8('0x27')](_0x2a115c[_0xfbc8('0x21')],qs[_0xfbc8('0x29')](_0x5a7cfc[_0xfbc8('0x23')][_0xfbc8('0x29')]));_0x16d5cb[_0xfbc8('0x28')]=_0x16d5cb[_0xfbc8('0x28')]['length']?_0x16d5cb[_0xfbc8('0x28')]:_0x2a115c[_0xfbc8('0x21')];if(_0x5a7cfc[_0xfbc8('0x23')][_0xfbc8('0x36')]){_0x16d5cb['include']=[{'all':!![]}];}_0x16d5cb=_['merge']({},_0x16d5cb,_0x5a7cfc[_0xfbc8('0x34')]);return db['Campaign']['find'](_0x16d5cb)[_0xfbc8('0x1a')](handleEntityNotFound(_0x258eb8,null))[_0xfbc8('0x1a')](function(_0x24c77a){if(_0x24c77a){var _0x5f2c7f=_0x24c77a[_0xfbc8('0x40')]({'plain':!![]});_0x5f2c7f=qs['omit'](_0x5f2c7f,['id',_0xfbc8('0x41'),_0xfbc8('0x42')]);_0x5a7cfc[_0xfbc8('0x3e')]=_[_0xfbc8('0x43')](_0x5a7cfc[_0xfbc8('0x3e')],['id',_0xfbc8('0x41'),_0xfbc8('0x42')]);return db[_0xfbc8('0x38')][_0xfbc8('0x3d')](_[_0xfbc8('0x32')](_0x5f2c7f,_0x5a7cfc[_0xfbc8('0x3e')]),{'include':_0x5a7cfc[_0xfbc8('0x23')][_0xfbc8('0x36')]?[{'all':!![]}]:undefined});}})[_0xfbc8('0x1a')](respondWithResult(_0x258eb8,0xc9))[_0xfbc8('0x39')](handleError(_0x258eb8,null));};exports[_0xfbc8('0x44')]=function(_0x23a77d,_0x55d9f9){if(_0x23a77d[_0xfbc8('0x3e')]['id']){delete _0x23a77d[_0xfbc8('0x3e')]['id'];}return db[_0xfbc8('0x38')]['find']({'where':{'id':_0x23a77d[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x55d9f9,null))[_0xfbc8('0x1a')](saveUpdates(_0x23a77d[_0xfbc8('0x3e')],null))[_0xfbc8('0x1a')](respondWithResult(_0x55d9f9,null))[_0xfbc8('0x39')](handleError(_0x55d9f9,null));};exports[_0xfbc8('0x1b')]=function(_0x4cae53,_0x17f150){return db[_0xfbc8('0x38')][_0xfbc8('0x3c')]({'where':{'id':_0x4cae53[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x17f150,null))['then'](removeEntity(_0x17f150,null))[_0xfbc8('0x39')](handleError(_0x17f150,null));};exports['getHoppers']=function(_0xe3c30d,_0x56edc3,_0x2129c1){var _0x4b22db={'raw':!![],'where':{}};var _0x2c281e={};var _0x25d797={'count':0x0,'rows':[]};return db[_0xfbc8('0x38')][_0xfbc8('0x45')]({'where':{'id':_0xe3c30d['params']['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x56edc3,null))[_0xfbc8('0x1a')](function(_0x585ca7){if(_0x585ca7){_0x2c281e[_0xfbc8('0x21')]=_[_0xfbc8('0x22')](db[_0xfbc8('0x46')][_0xfbc8('0x20')]);_0x2c281e['query']=_['keys'](_0xe3c30d['query']);_0x2c281e[_0xfbc8('0x26')]=_[_0xfbc8('0x27')](_0x2c281e[_0xfbc8('0x21')],_0x2c281e[_0xfbc8('0x23')]);_0x4b22db[_0xfbc8('0x28')]=_[_0xfbc8('0x27')](_0x2c281e[_0xfbc8('0x21')],qs[_0xfbc8('0x29')](_0xe3c30d[_0xfbc8('0x23')][_0xfbc8('0x29')]));_0x4b22db[_0xfbc8('0x28')]=_0x4b22db[_0xfbc8('0x28')][_0xfbc8('0x2a')]?_0x4b22db['attributes']:_0x2c281e['model'];if(!_0xe3c30d['query'][_0xfbc8('0x2b')](_0xfbc8('0x2c'))){_0x4b22db[_0xfbc8('0x17')]=qs['limit'](_0xe3c30d[_0xfbc8('0x23')]['limit']);_0x4b22db[_0xfbc8('0x16')]=qs[_0xfbc8('0x16')](_0xe3c30d[_0xfbc8('0x23')]['offset']);}_0x4b22db[_0xfbc8('0x2d')]=qs[_0xfbc8('0x2e')](_0xe3c30d['query'][_0xfbc8('0x2e')]);_0x4b22db['where']=qs['filters'](_[_0xfbc8('0x47')](_0xe3c30d[_0xfbc8('0x23')],_0x2c281e[_0xfbc8('0x26')]));_0x4b22db[_0xfbc8('0x2f')][_0xfbc8('0x48')]=_0x585ca7['id'];if(_0xe3c30d['query'][_0xfbc8('0x49')]){_0x4b22db[_0xfbc8('0x2f')]=_['merge'](_0x4b22db[_0xfbc8('0x2f')],{'$or':_[_0xfbc8('0x33')](_0x4b22db[_0xfbc8('0x28')],function(_0x4fc42e){var _0xed13a={};_0xed13a[_0x4fc42e]={'$like':'%'+_0xe3c30d['query'][_0xfbc8('0x49')]+'%'};return _0xed13a;})});}_0x4b22db=_[_0xfbc8('0x32')]({},_0x4b22db,_0xe3c30d['options']);return db[_0xfbc8('0x46')][_0xfbc8('0x35')]({'where':_0x4b22db['where']})[_0xfbc8('0x1a')](function(_0x2b9bff){_0x25d797['count']=_0x2b9bff;if(_0xe3c30d[_0xfbc8('0x23')][_0xfbc8('0x36')]){_0x4b22db['include']=[{'all':!![]}];}return db[_0xfbc8('0x46')][_0xfbc8('0x4a')](_0x4b22db);})[_0xfbc8('0x1a')](function(_0x10cf37){_0x25d797[_0xfbc8('0x4b')]=_0x10cf37;return _0x25d797;});}})[_0xfbc8('0x1a')](respondWithFilteredResult(_0x56edc3,_0x4b22db))['catch'](handleError(_0x56edc3,null));};exports[_0xfbc8('0x4c')]=function(_0x9e80c9,_0x871d9c,_0x527a59){var _0x1f693e={'raw':!![],'where':{}};var _0x1050a2={};var _0x30fcc5={'count':0x0,'rows':[]};return db['Campaign'][_0xfbc8('0x45')]({'where':{'id':_0x9e80c9['params']['id']}})['then'](handleEntityNotFound(_0x871d9c,null))[_0xfbc8('0x1a')](function(_0x54e3c2){if(_0x54e3c2){_0x1050a2[_0xfbc8('0x21')]=_['keys'](db[_0xfbc8('0x4d')]['rawAttributes']);_0x1050a2['query']=_[_0xfbc8('0x22')](_0x9e80c9['query']);_0x1050a2[_0xfbc8('0x26')]=_[_0xfbc8('0x27')](_0x1050a2[_0xfbc8('0x21')],_0x1050a2[_0xfbc8('0x23')]);_0x1f693e[_0xfbc8('0x28')]=_[_0xfbc8('0x27')](_0x1050a2[_0xfbc8('0x21')],qs[_0xfbc8('0x29')](_0x9e80c9['query']['fields']));_0x1f693e[_0xfbc8('0x28')]=_0x1f693e[_0xfbc8('0x28')][_0xfbc8('0x2a')]?_0x1f693e[_0xfbc8('0x28')]:_0x1050a2[_0xfbc8('0x21')];if(!_0x9e80c9[_0xfbc8('0x23')][_0xfbc8('0x2b')](_0xfbc8('0x2c'))){_0x1f693e['limit']=qs[_0xfbc8('0x17')](_0x9e80c9['query'][_0xfbc8('0x17')]);_0x1f693e[_0xfbc8('0x16')]=qs[_0xfbc8('0x16')](_0x9e80c9[_0xfbc8('0x23')][_0xfbc8('0x16')]);}_0x1f693e[_0xfbc8('0x2d')]=qs[_0xfbc8('0x2e')](_0x9e80c9[_0xfbc8('0x23')][_0xfbc8('0x2e')]);_0x1f693e[_0xfbc8('0x2f')]=qs[_0xfbc8('0x26')](_['pick'](_0x9e80c9[_0xfbc8('0x23')],_0x1050a2[_0xfbc8('0x26')]));_0x1f693e[_0xfbc8('0x2f')][_0xfbc8('0x48')]=_0x54e3c2['id'];if(_0x9e80c9['query'][_0xfbc8('0x49')]){_0x1f693e[_0xfbc8('0x2f')]=_['merge'](_0x1f693e[_0xfbc8('0x2f')],{'$or':_['map'](_0x1f693e[_0xfbc8('0x28')],function(_0x30a482){var _0x33d976={};_0x33d976[_0x30a482]={'$like':'%'+_0x9e80c9['query'][_0xfbc8('0x49')]+'%'};return _0x33d976;})});}_0x1f693e=_[_0xfbc8('0x32')]({},_0x1f693e,_0x9e80c9[_0xfbc8('0x34')]);return db[_0xfbc8('0x4d')][_0xfbc8('0x35')]({'where':_0x1f693e['where']})[_0xfbc8('0x1a')](function(_0x325afa){_0x30fcc5[_0xfbc8('0x35')]=_0x325afa;if(_0x9e80c9[_0xfbc8('0x23')][_0xfbc8('0x36')]){_0x1f693e[_0xfbc8('0x37')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xfbc8('0x4a')](_0x1f693e);})[_0xfbc8('0x1a')](function(_0x56bb79){_0x30fcc5['rows']=_0x56bb79;return _0x30fcc5;});}})[_0xfbc8('0x1a')](respondWithFilteredResult(_0x871d9c,_0x1f693e))[_0xfbc8('0x39')](handleError(_0x871d9c,null));};exports['getHopperFinals']=function(_0x1bdadf,_0x250821,_0x400bc5){var _0x277f5d={'raw':!![],'where':{}};var _0x51b7a2={};var _0x52f62d={'count':0x0,'rows':[]};return db[_0xfbc8('0x38')][_0xfbc8('0x45')]({'where':{'id':_0x1bdadf[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x250821,null))[_0xfbc8('0x1a')](function(_0x1c894d){if(_0x1c894d){_0x51b7a2[_0xfbc8('0x21')]=_['keys'](db[_0xfbc8('0x4e')][_0xfbc8('0x20')]);_0x51b7a2['query']=_[_0xfbc8('0x22')](_0x1bdadf[_0xfbc8('0x23')]);_0x51b7a2[_0xfbc8('0x26')]=_[_0xfbc8('0x27')](_0x51b7a2[_0xfbc8('0x21')],_0x51b7a2[_0xfbc8('0x23')]);_0x277f5d[_0xfbc8('0x28')]=_[_0xfbc8('0x27')](_0x51b7a2[_0xfbc8('0x21')],qs[_0xfbc8('0x29')](_0x1bdadf[_0xfbc8('0x23')][_0xfbc8('0x29')]));_0x277f5d[_0xfbc8('0x28')]=_0x277f5d[_0xfbc8('0x28')]['length']?_0x277f5d['attributes']:_0x51b7a2[_0xfbc8('0x21')];if(!_0x1bdadf[_0xfbc8('0x23')]['hasOwnProperty'](_0xfbc8('0x2c'))){_0x277f5d['limit']=qs[_0xfbc8('0x17')](_0x1bdadf['query'][_0xfbc8('0x17')]);_0x277f5d[_0xfbc8('0x16')]=qs[_0xfbc8('0x16')](_0x1bdadf[_0xfbc8('0x23')][_0xfbc8('0x16')]);}_0x277f5d[_0xfbc8('0x2d')]=qs[_0xfbc8('0x2e')](_0x1bdadf[_0xfbc8('0x23')][_0xfbc8('0x2e')]);_0x277f5d[_0xfbc8('0x2f')]=qs[_0xfbc8('0x26')](_[_0xfbc8('0x47')](_0x1bdadf[_0xfbc8('0x23')],_0x51b7a2[_0xfbc8('0x26')]));_0x277f5d[_0xfbc8('0x2f')][_0xfbc8('0x48')]=_0x1c894d['id'];if(_0x1bdadf[_0xfbc8('0x23')]['filter']){_0x277f5d['where']=_[_0xfbc8('0x32')](_0x277f5d[_0xfbc8('0x2f')],{'$or':_[_0xfbc8('0x33')](_0x277f5d[_0xfbc8('0x28')],function(_0xa6453a){var _0x1e969d={};_0x1e969d[_0xa6453a]={'$like':'%'+_0x1bdadf['query']['filter']+'%'};return _0x1e969d;})});}_0x277f5d=_[_0xfbc8('0x32')]({},_0x277f5d,_0x1bdadf[_0xfbc8('0x34')]);return db['CmHopperFinal'][_0xfbc8('0x35')]({'where':_0x277f5d[_0xfbc8('0x2f')]})[_0xfbc8('0x1a')](function(_0x290ef5){_0x52f62d['count']=_0x290ef5;if(_0x1bdadf[_0xfbc8('0x23')]['includeAll']){_0x277f5d['include']=[{'all':!![]}];}return db[_0xfbc8('0x4e')]['findAll'](_0x277f5d);})[_0xfbc8('0x1a')](function(_0x58efce){_0x52f62d['rows']=_0x58efce;return _0x52f62d;});}})[_0xfbc8('0x1a')](respondWithFilteredResult(_0x250821,_0x277f5d))[_0xfbc8('0x39')](handleError(_0x250821,null));};exports[_0xfbc8('0x4f')]=function(_0x43cb4f,_0x15228c,_0x5f3b3c){var _0x33ea33={'raw':!![],'where':{}};var _0x4aaec8={};var _0x41da40={'count':0x0,'rows':[]};return db[_0xfbc8('0x38')][_0xfbc8('0x45')]({'where':{'id':_0x43cb4f[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x15228c,null))[_0xfbc8('0x1a')](function(_0xde6557){if(_0xde6557){_0x4aaec8[_0xfbc8('0x21')]=_[_0xfbc8('0x22')](db['CmHopperBlack'][_0xfbc8('0x20')]);_0x4aaec8['query']=_['keys'](_0x43cb4f[_0xfbc8('0x23')]);_0x4aaec8[_0xfbc8('0x26')]=_[_0xfbc8('0x27')](_0x4aaec8['model'],_0x4aaec8['query']);_0x33ea33[_0xfbc8('0x28')]=_[_0xfbc8('0x27')](_0x4aaec8[_0xfbc8('0x21')],qs[_0xfbc8('0x29')](_0x43cb4f[_0xfbc8('0x23')][_0xfbc8('0x29')]));_0x33ea33[_0xfbc8('0x28')]=_0x33ea33[_0xfbc8('0x28')][_0xfbc8('0x2a')]?_0x33ea33[_0xfbc8('0x28')]:_0x4aaec8['model'];if(!_0x43cb4f[_0xfbc8('0x23')][_0xfbc8('0x2b')](_0xfbc8('0x2c'))){_0x33ea33[_0xfbc8('0x17')]=qs['limit'](_0x43cb4f[_0xfbc8('0x23')]['limit']);_0x33ea33[_0xfbc8('0x16')]=qs[_0xfbc8('0x16')](_0x43cb4f[_0xfbc8('0x23')]['offset']);}_0x33ea33[_0xfbc8('0x2d')]=qs['sort'](_0x43cb4f[_0xfbc8('0x23')][_0xfbc8('0x2e')]);_0x33ea33[_0xfbc8('0x2f')]=qs[_0xfbc8('0x26')](_[_0xfbc8('0x47')](_0x43cb4f['query'],_0x4aaec8[_0xfbc8('0x26')]));_0x33ea33[_0xfbc8('0x2f')][_0xfbc8('0x48')]=_0xde6557['id'];if(_0x43cb4f['query'][_0xfbc8('0x49')]){_0x33ea33['where']=_[_0xfbc8('0x32')](_0x33ea33[_0xfbc8('0x2f')],{'$or':_[_0xfbc8('0x33')](_0x33ea33[_0xfbc8('0x28')],function(_0x526edf){var _0x1509db={};_0x1509db[_0x526edf]={'$like':'%'+_0x43cb4f['query'][_0xfbc8('0x49')]+'%'};return _0x1509db;})});}_0x33ea33=_[_0xfbc8('0x32')]({},_0x33ea33,_0x43cb4f[_0xfbc8('0x34')]);return db[_0xfbc8('0x50')]['count']({'where':_0x33ea33[_0xfbc8('0x2f')]})[_0xfbc8('0x1a')](function(_0x46766e){_0x41da40[_0xfbc8('0x35')]=_0x46766e;if(_0x43cb4f[_0xfbc8('0x23')][_0xfbc8('0x36')]){_0x33ea33[_0xfbc8('0x37')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x33ea33);})[_0xfbc8('0x1a')](function(_0x4f82d2){_0x41da40[_0xfbc8('0x4b')]=_0x4f82d2;return _0x41da40;});}})[_0xfbc8('0x1a')](respondWithFilteredResult(_0x15228c,_0x33ea33))[_0xfbc8('0x39')](handleError(_0x15228c,null));};exports['getLists']=function(_0x3650af,_0x3ffa4f,_0x88cf8d){var _0xd4e187={};var _0x29421c={};var _0x2ea6fe;var _0x45ba16;return db['Campaign'][_0xfbc8('0x45')]({'where':{'id':_0x3650af[_0xfbc8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3ffa4f,null))['then'](function(_0x2033db){if(_0x2033db){_0x2ea6fe=_0x2033db;_0x29421c[_0xfbc8('0x21')]=_[_0xfbc8('0x22')](db[_0xfbc8('0x51')]['rawAttributes']);_0x29421c[_0xfbc8('0x23')]=_['keys'](_0x3650af['query']);_0x29421c['filters']=_['intersection'](_0x29421c['model'],_0x29421c[_0xfbc8('0x23')]);_0xd4e187[_0xfbc8('0x28')]=_[_0xfbc8('0x27')](_0x29421c['model'],qs[_0xfbc8('0x29')](_0x3650af[_0xfbc8('0x23')]['fields']));_0xd4e187['attributes']=_0xd4e187[_0xfbc8('0x28')]['length']?_0xd4e187[_0xfbc8('0x28')]:_0x29421c[_0xfbc8('0x21')];_0xd4e187['order']=qs['sort'](_0x3650af['query']['sort']);_0xd4e187[_0xfbc8('0x2f')]=qs[_0xfbc8('0x26')](_['pick'](_0x3650af[_0xfbc8('0x23')],_0x29421c[_0xfbc8('0x26')]));if(_0x3650af[_0xfbc8('0x23')][_0xfbc8('0x49')]){_0xd4e187['where']=_[_0xfbc8('0x32')](_0xd4e187[_0xfbc8('0x2f')],{'$or':_[_0xfbc8('0x33')](_0xd4e187[_0xfbc8('0x28')],function(_0x289e91){var _0x2a40ac={};_0x2a40ac[_0x289e91]={'$like':'%'+_0x3650af[_0xfbc8('0x23')][_0xfbc8('0x49')]+'%'};return _0x2a40ac;})});}_0xd4e187=_[_0xfbc8('0x32')]({},_0xd4e187,_0x3650af['options']);return _0x2ea6fe['getLists'](_0xd4e187);}})[_0xfbc8('0x1a')](function(_0x33d0e){if(_0x33d0e){_0x45ba16=_0x33d0e[_0xfbc8('0x2a')];if(!_0x3650af[_0xfbc8('0x23')]['hasOwnProperty'](_0xfbc8('0x2c'))){_0xd4e187[_0xfbc8('0x17')]=qs['limit'](_0x3650af[_0xfbc8('0x23')]['limit']);_0xd4e187[_0xfbc8('0x16')]=qs[_0xfbc8('0x16')](_0x3650af[_0xfbc8('0x23')][_0xfbc8('0x16')]);}return _0x2ea6fe['getLists'](_0xd4e187);}})[_0xfbc8('0x1a')](function(_0x3ea9dd){if(_0x3ea9dd){return _0x3ea9dd?{'count':_0x45ba16,'rows':_0x3ea9dd}:null;}})[_0xfbc8('0x1a')](respondWithResult(_0x3ffa4f,null))[_0xfbc8('0x39')](handleError(_0x3ffa4f,null));};exports[_0xfbc8('0x52')]=function(_0xc3237a,_0x90c189,_0x1495bc){var _0x1f977b,_0x2bea11;return db['Campaign']['find']({'where':{'id':_0xc3237a[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x90c189,null))['then'](function(_0x552305){if(_0x552305){_0x2bea11=_0x552305;return _0x552305[_0xfbc8('0x52')](_0xc3237a[_0xfbc8('0x3e')]['ids'],_['omit'](_0xc3237a[_0xfbc8('0x3e')],['ids','id'])||{});}return null;})['spread'](function(_0x505e76){var _0x54f046;_0x1f977b=_0x505e76||[];var _0x19c69a=[];if(_0x505e76){for(var _0x4f88e6=0x0;_0x4f88e6<_0x505e76[_0xfbc8('0x2a')];_0x4f88e6+=0x1){var _0x5eb6cb=_0x505e76[_0x4f88e6][_0xfbc8('0x40')]({'plain':!![]});_0x2bea11[_0xfbc8('0x53')]=_0xc3237a[_0xfbc8('0x3e')][_0xfbc8('0x53')]?_0xc3237a[_0xfbc8('0x3e')][_0xfbc8('0x53')]:_0x2bea11[_0xfbc8('0x53')];switch(_0x2bea11[_0xfbc8('0x53')]){case _0xfbc8('0x54'):_0x54f046=squel['insert']()[_0xfbc8('0x55')]('cm_hopper')['fromQuery']([_0xfbc8('0x56'),_0xfbc8('0x57'),_0xfbc8('0x58'),_0xfbc8('0x59'),'CampaignId',_0xfbc8('0x41'),_0xfbc8('0x42')],squel[_0xfbc8('0x5a')]()[_0xfbc8('0x5b')]('phone',_0xfbc8('0x56'))[_0xfbc8('0x5b')](_0xfbc8('0x5c'),_0xfbc8('0x57'))[_0xfbc8('0x5b')]('id',_0xfbc8('0x58'))[_0xfbc8('0x5b')](_0x5eb6cb['CmListId'][_0xfbc8('0x5d')](),'ListId')['field'](_0xc3237a[_0xfbc8('0x3b')]['id']['toString'](),_0xfbc8('0x48'))[_0xfbc8('0x5b')](_0xfbc8('0x5c'),_0xfbc8('0x41'))[_0xfbc8('0x5b')]('NOW()',_0xfbc8('0x42'))[_0xfbc8('0x5e')](_0xfbc8('0x5f'))[_0xfbc8('0x2f')](_0xfbc8('0x60'))[_0xfbc8('0x2f')](_0xfbc8('0x61'),_0x5eb6cb[_0xfbc8('0x62')][_0xfbc8('0x5d')]())[_0xfbc8('0x2f')](_0xfbc8('0x63'))[_0xfbc8('0x2f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfbc8('0x5a')]()[_0xfbc8('0x5b')](_0xfbc8('0x64'))[_0xfbc8('0x5e')]('cm_hopper_final')[_0xfbc8('0x2f')](_0xfbc8('0x65'),_0xc3237a[_0xfbc8('0x3b')]['id'][_0xfbc8('0x5d')]()))['where'](_0xfbc8('0x66'),squel[_0xfbc8('0x5a')]()[_0xfbc8('0x5b')](_0xfbc8('0x56'))[_0xfbc8('0x5e')](_0xfbc8('0x67'))[_0xfbc8('0x2f')](_0xfbc8('0x65'),_0xc3237a[_0xfbc8('0x3b')]['id'][_0xfbc8('0x5d')]())))['toString']();break;case'onlyIfOpen':_0x54f046=squel[_0xfbc8('0x68')]()[_0xfbc8('0x55')](_0xfbc8('0x67'))[_0xfbc8('0x69')]([_0xfbc8('0x56'),_0xfbc8('0x57'),_0xfbc8('0x58'),_0xfbc8('0x59'),_0xfbc8('0x48'),_0xfbc8('0x41'),_0xfbc8('0x42')],squel[_0xfbc8('0x5a')]()[_0xfbc8('0x5b')](_0xfbc8('0x56'),'phone')[_0xfbc8('0x5b')](_0xfbc8('0x5c'),_0xfbc8('0x57'))[_0xfbc8('0x5b')]('id',_0xfbc8('0x58'))[_0xfbc8('0x5b')](_0x5eb6cb[_0xfbc8('0x62')][_0xfbc8('0x5d')](),_0xfbc8('0x59'))[_0xfbc8('0x5b')](_0xc3237a['params']['id'][_0xfbc8('0x5d')](),'CampaignId')[_0xfbc8('0x5b')](_0xfbc8('0x5c'),'createdAt')[_0xfbc8('0x5b')](_0xfbc8('0x5c'),_0xfbc8('0x42'))[_0xfbc8('0x5e')]('cm_contacts')[_0xfbc8('0x2f')](_0xfbc8('0x60'))[_0xfbc8('0x2f')]('ListId\x20=\x20?',_0x5eb6cb[_0xfbc8('0x62')][_0xfbc8('0x5d')]())[_0xfbc8('0x2f')]('phone\x20IS\x20NOT\x20NULL')[_0xfbc8('0x2f')](_0xfbc8('0x66'),squel[_0xfbc8('0x5a')]()[_0xfbc8('0x5b')]('phone')['from'](_0xfbc8('0x67'))[_0xfbc8('0x2f')](_0xfbc8('0x65'),_0xc3237a['params']['id'][_0xfbc8('0x5d')]())))[_0xfbc8('0x5d')]();break;default:_0x54f046=squel['insert']()[_0xfbc8('0x55')]('cm_hopper')[_0xfbc8('0x69')]([_0xfbc8('0x56'),_0xfbc8('0x57'),_0xfbc8('0x58'),'ListId',_0xfbc8('0x48'),'createdAt','updatedAt'],squel[_0xfbc8('0x5a')]()[_0xfbc8('0x5b')]('phone',_0xfbc8('0x56'))['field'](_0xfbc8('0x5c'),_0xfbc8('0x57'))[_0xfbc8('0x5b')]('id','ContactId')['field'](_0x5eb6cb[_0xfbc8('0x62')][_0xfbc8('0x5d')](),_0xfbc8('0x59'))[_0xfbc8('0x5b')](_0xc3237a[_0xfbc8('0x3b')]['id']['toString'](),_0xfbc8('0x48'))[_0xfbc8('0x5b')](_0xfbc8('0x5c'),_0xfbc8('0x41'))[_0xfbc8('0x5b')](_0xfbc8('0x5c'),_0xfbc8('0x42'))[_0xfbc8('0x5e')](_0xfbc8('0x5f'))[_0xfbc8('0x2f')](_0xfbc8('0x60'))[_0xfbc8('0x2f')]('ListId\x20=\x20?',_0x5eb6cb[_0xfbc8('0x62')][_0xfbc8('0x5d')]())[_0xfbc8('0x2f')](_0xfbc8('0x63')))['toString']();}_0x19c69a['push'](db[_0xfbc8('0x6a')][_0xfbc8('0x23')](_0x54f046));}return BPromise[_0xfbc8('0x6b')](_0x19c69a);}})[_0xfbc8('0x1a')](function(){return _0x1f977b;})[_0xfbc8('0x1a')](respondWithResult(_0x90c189,null))[_0xfbc8('0x39')](handleError(_0x90c189,null));};exports['removeLists']=function(_0xa7892b,_0x51e8ab,_0x142995){var _0x28b49a;return db[_0xfbc8('0x38')][_0xfbc8('0x3c')]({'where':{'id':_0xa7892b[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x51e8ab,null))[_0xfbc8('0x1a')](function(_0x273377){if(_0x273377){return _0x273377[_0xfbc8('0x6c')](_0xa7892b['query'][_0xfbc8('0x6d')]);}})[_0xfbc8('0x1a')](function(_0x166169){if(_0x166169){_0x28b49a=_0x166169;return db[_0xfbc8('0x46')][_0xfbc8('0x1b')]({'where':{'ListId':_0xa7892b[_0xfbc8('0x23')]['ids'],'CampaignId':_0xa7892b[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](function(){return _0x28b49a;});}})[_0xfbc8('0x1a')](respondWithStatusCode(_0x51e8ab,null))[_0xfbc8('0x39')](handleError(_0x51e8ab,null));};exports[_0xfbc8('0x6e')]=function(_0x2faf93,_0x43f0fa,_0x5c275c){var _0x3ab54e={'raw':!![],'where':{}};var _0x15fdfd={};var _0x168528={'count':0x0,'rows':[]};return db[_0xfbc8('0x38')]['findOne']({'where':{'id':_0x2faf93['params']['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x43f0fa,null))[_0xfbc8('0x1a')](function(_0x401712){if(_0x401712){_0x15fdfd[_0xfbc8('0x21')]=_[_0xfbc8('0x22')](db[_0xfbc8('0x51')][_0xfbc8('0x20')]);_0x15fdfd['query']=_[_0xfbc8('0x22')](_0x2faf93[_0xfbc8('0x23')]);_0x15fdfd[_0xfbc8('0x26')]=_['intersection'](_0x15fdfd[_0xfbc8('0x21')],_0x15fdfd[_0xfbc8('0x23')]);_0x3ab54e[_0xfbc8('0x28')]=_[_0xfbc8('0x27')](_0x15fdfd[_0xfbc8('0x21')],qs[_0xfbc8('0x29')](_0x2faf93['query'][_0xfbc8('0x29')]));_0x3ab54e[_0xfbc8('0x28')]=_0x3ab54e[_0xfbc8('0x28')][_0xfbc8('0x2a')]?_0x3ab54e[_0xfbc8('0x28')]:_0x15fdfd[_0xfbc8('0x21')];if(!_0x2faf93[_0xfbc8('0x23')][_0xfbc8('0x2b')](_0xfbc8('0x2c'))){_0x3ab54e[_0xfbc8('0x17')]=qs[_0xfbc8('0x17')](_0x2faf93[_0xfbc8('0x23')][_0xfbc8('0x17')]);_0x3ab54e[_0xfbc8('0x16')]=qs[_0xfbc8('0x16')](_0x2faf93[_0xfbc8('0x23')][_0xfbc8('0x16')]);}_0x3ab54e[_0xfbc8('0x2d')]=qs[_0xfbc8('0x2e')](_0x2faf93['query'][_0xfbc8('0x2e')]);_0x3ab54e['where']=qs['filters'](_[_0xfbc8('0x47')](_0x2faf93[_0xfbc8('0x23')],_0x15fdfd[_0xfbc8('0x26')]));_0x3ab54e[_0xfbc8('0x2f')][_0xfbc8('0x48')]=_0x401712['id'];if(_0x2faf93[_0xfbc8('0x23')][_0xfbc8('0x49')]){_0x3ab54e[_0xfbc8('0x2f')]=_['merge'](_0x3ab54e[_0xfbc8('0x2f')],{'$or':_[_0xfbc8('0x33')](_0x3ab54e['attributes'],function(_0x406f18){var _0x147940={};_0x147940[_0x406f18]={'$like':'%'+_0x2faf93['query'][_0xfbc8('0x49')]+'%'};return _0x147940;})});}_0x3ab54e=_[_0xfbc8('0x32')]({},_0x3ab54e,_0x2faf93[_0xfbc8('0x34')]);return db[_0xfbc8('0x51')][_0xfbc8('0x35')]({'where':_0x3ab54e[_0xfbc8('0x2f')]})[_0xfbc8('0x1a')](function(_0x40f934){_0x168528[_0xfbc8('0x35')]=_0x40f934;if(_0x2faf93[_0xfbc8('0x23')][_0xfbc8('0x36')]){_0x3ab54e['include']=[{'all':!![]}];}return db[_0xfbc8('0x51')][_0xfbc8('0x4a')](_0x3ab54e);})['then'](function(_0x3b8587){_0x168528[_0xfbc8('0x4b')]=_0x3b8587;return _0x168528;});}})[_0xfbc8('0x1a')](respondWithFilteredResult(_0x43f0fa,_0x3ab54e))['catch'](handleError(_0x43f0fa,null));};exports[_0xfbc8('0x6f')]=function(_0x486068,_0xa8ea79,_0x40f345){var _0x1a03ff,_0xb4bed9;return db[_0xfbc8('0x38')]['find']({'where':{'id':_0x486068[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0xa8ea79,null))[_0xfbc8('0x1a')](function(_0x5b479c){if(_0x5b479c){_0xb4bed9=_0x5b479c;return _0x5b479c[_0xfbc8('0x6f')](_0x486068[_0xfbc8('0x3e')][_0xfbc8('0x6d')],_[_0xfbc8('0x43')](_0x486068['body'],[_0xfbc8('0x6d'),'id'])||{});}return null;})[_0xfbc8('0x70')](function(_0x15f3e3){var _0x918e8b;_0x1a03ff=_0x15f3e3||[];var _0x534f86=[];if(_0x15f3e3){for(var _0x39e487=0x0;_0x39e487<_0x15f3e3[_0xfbc8('0x2a')];_0x39e487+=0x1){var _0x3c7788=_0x15f3e3[_0x39e487][_0xfbc8('0x40')]({'plain':!![]});_0x918e8b=squel[_0xfbc8('0x68')]()[_0xfbc8('0x55')](_0xfbc8('0x71'))[_0xfbc8('0x69')](['phone','ContactId','ListId','CampaignId',_0xfbc8('0x41'),_0xfbc8('0x42')],squel[_0xfbc8('0x5a')]()[_0xfbc8('0x5b')]('phone',_0xfbc8('0x56'))[_0xfbc8('0x5b')]('id',_0xfbc8('0x58'))[_0xfbc8('0x5b')](_0x3c7788['CmListId'][_0xfbc8('0x5d')](),_0xfbc8('0x59'))[_0xfbc8('0x5b')](_0x486068[_0xfbc8('0x3b')]['id']['toString'](),_0xfbc8('0x48'))[_0xfbc8('0x5b')]('NOW()','createdAt')[_0xfbc8('0x5b')](_0xfbc8('0x5c'),_0xfbc8('0x42'))[_0xfbc8('0x5e')](_0xfbc8('0x5f'))[_0xfbc8('0x2f')](_0xfbc8('0x60'))['where'](_0xfbc8('0x61'),_0x3c7788['CmListId'][_0xfbc8('0x5d')]())[_0xfbc8('0x2f')](_0xfbc8('0x63')))[_0xfbc8('0x5d')]();_0x534f86[_0xfbc8('0x72')](db[_0xfbc8('0x6a')][_0xfbc8('0x23')](_0x918e8b));}return BPromise['all'](_0x534f86);}})[_0xfbc8('0x1a')](function(){return _0x1a03ff;})[_0xfbc8('0x1a')](respondWithResult(_0xa8ea79,null))[_0xfbc8('0x39')](handleError(_0xa8ea79,null));};exports[_0xfbc8('0x73')]=function(_0x496698,_0x109a42,_0x404605){var _0x1c1e81;return db['Campaign'][_0xfbc8('0x3c')]({'where':{'id':_0x496698[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](handleEntityNotFound(_0x109a42,null))[_0xfbc8('0x1a')](function(_0x361bf8){if(_0x361bf8){return _0x361bf8[_0xfbc8('0x73')](_0x496698['query']['ids']);}})[_0xfbc8('0x1a')](function(_0x5b23a5){if(_0x5b23a5){_0x1c1e81=_0x5b23a5;return db['CmHopperBlack'][_0xfbc8('0x1b')]({'where':{'ListId':_0x496698[_0xfbc8('0x23')][_0xfbc8('0x6d')],'CampaignId':_0x496698[_0xfbc8('0x3b')]['id']}})[_0xfbc8('0x1a')](function(){return _0x1c1e81;});}})[_0xfbc8('0x1a')](respondWithStatusCode(_0x109a42,null))[_0xfbc8('0x39')](handleError(_0x109a42,null));}; \ No newline at end of file +var _0xd479=['select','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','push','all','removeLists','removeBlackLists','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','Campaign','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','add','day','merge','filter','where','options','include','rows','catch','show','params','includeAll','find','create','body','clone','get','omit','createdAt','updatedAt','getHoppers','findOne','rawAttributes','order','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','map','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','field','NOW()','ContactId','CmListId','ListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL'];(function(_0x34be66,_0x5ab7d7){var _0xd590f2=function(_0xc85f6e){while(--_0xc85f6e){_0x34be66['push'](_0x34be66['shift']());}};_0xd590f2(++_0x5ab7d7);}(_0xd479,0x15f));var _0x9d47=function(_0x325043,_0x435e6d){_0x325043=_0x325043-0x0;var _0x46a560=_0xd479[_0x325043];return _0x46a560;};'use strict';var jsonpatch=require(_0x9d47('0x0'));var rp=require('request-promise');var moment=require(_0x9d47('0x1'));var BPromise=require(_0x9d47('0x2'));var Mustache=require(_0x9d47('0x3'));var util=require(_0x9d47('0x4'));var path=require(_0x9d47('0x5'));var sox=require('sox');var csv=require(_0x9d47('0x6'));var ejs=require(_0x9d47('0x7'));var fs=require('fs');var _=require(_0x9d47('0x8'));var squel=require(_0x9d47('0x9'));var crypto=require(_0x9d47('0xa'));var jsforce=require(_0x9d47('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9d47('0x6'));var querystring=require(_0x9d47('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x9d47('0xd'))('api');var utils=require(_0x9d47('0xe'));var config=require(_0x9d47('0xf'));var db=require(_0x9d47('0x10'))['db'];function respondWithStatusCode(_0x1d6c26,_0x989c4d){_0x989c4d=_0x989c4d||0xcc;return function(_0x4eed90){if(_0x4eed90){return _0x1d6c26[_0x9d47('0x11')](_0x989c4d);}return _0x1d6c26[_0x9d47('0x12')](_0x989c4d)['end']();};}function respondWithResult(_0x3e2e18,_0x2ac79b){_0x2ac79b=_0x2ac79b||0xc8;return function(_0x28a769){if(_0x28a769){return _0x3e2e18['status'](_0x2ac79b)['json'](_0x28a769);}};}function respondWithFilteredResult(_0x1652a1,_0x1f167a){return function(_0x48dda5){if(_0x48dda5){var _0x6de034=_0x48dda5[_0x9d47('0x13')],_0x184686=_0x1f167a[_0x9d47('0x14')],_0x1647ed=_0x1f167a[_0x9d47('0x14')]+_0x1f167a['limit'],_0x1f9d39;if(_0x1647ed>=_0x6de034){_0x1647ed=_0x6de034;_0x1f9d39=0xc8;}else{_0x1f9d39=0xce;}_0x1652a1[_0x9d47('0x12')](_0x1f9d39);return _0x1652a1[_0x9d47('0x15')](_0x9d47('0x16'),_0x184686+'-'+_0x1647ed+'/'+_0x6de034)[_0x9d47('0x17')](_0x48dda5);}return null;};}function patchUpdates(_0x44ef78){return function(_0x2638d1){try{jsonpatch[_0x9d47('0x18')](_0x2638d1,_0x44ef78,!![]);}catch(_0x24d03c){return BPromise[_0x9d47('0x19')](_0x24d03c);}return _0x2638d1[_0x9d47('0x1a')]();};}function saveUpdates(_0x54e644,_0x516757){return function(_0xe85b93){if(_0xe85b93){return _0xe85b93[_0x9d47('0x1b')](_0x54e644)[_0x9d47('0x1c')](function(_0x532855){return _0x532855;});}return null;};}function removeEntity(_0x446ada,_0x56ffc4){return function(_0x54cf87){if(_0x54cf87){return _0x54cf87[_0x9d47('0x1d')]()[_0x9d47('0x1c')](function(){_0x446ada['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ad381,_0x44b541){return function(_0x5479f9){if(!_0x5479f9){_0x3ad381['sendStatus'](0x194);}return _0x5479f9;};}function handleError(_0xe0c708,_0x40e865){_0x40e865=_0x40e865||0x1f4;return function(_0x138464){logger[_0x9d47('0x1e')](_0x138464['stack']);if(_0x138464[_0x9d47('0x1f')]){delete _0x138464[_0x9d47('0x1f')];}_0xe0c708[_0x9d47('0x12')](_0x40e865)[_0x9d47('0x20')](_0x138464);};}exports[_0x9d47('0x21')]=function(_0x2ed77c,_0x21b89e){var _0x116661={},_0x3b76ce={},_0x18d24f={'count':0x0,'rows':[]};var _0x563ad6=db[_0x9d47('0x22')]['rawAttributes'];_0x3b76ce[_0x9d47('0x23')]=_[_0x9d47('0x24')](_0x563ad6);var _0x3912d0={'dateStart':_0x2ed77c[_0x9d47('0x25')][_0x9d47('0x26')],'dateEnd':_0x2ed77c[_0x9d47('0x25')][_0x9d47('0x27')]};delete _0x2ed77c[_0x9d47('0x25')][_0x9d47('0x26')];delete _0x2ed77c[_0x9d47('0x25')]['dateEnd'];_0x3b76ce[_0x9d47('0x25')]=_[_0x9d47('0x24')](_0x2ed77c['query']);_0x3b76ce[_0x9d47('0x28')]=_[_0x9d47('0x29')](_0x3b76ce[_0x9d47('0x23')],_0x3b76ce[_0x9d47('0x25')]);_0x116661[_0x9d47('0x2a')]=_[_0x9d47('0x29')](_0x3b76ce[_0x9d47('0x23')],qs[_0x9d47('0x2b')](_0x2ed77c[_0x9d47('0x25')][_0x9d47('0x2b')]));_0x116661['attributes']=_0x116661[_0x9d47('0x2a')][_0x9d47('0x2c')]?_0x116661[_0x9d47('0x2a')]:_0x3b76ce['model'];if(!_0x2ed77c[_0x9d47('0x25')][_0x9d47('0x2d')](_0x9d47('0x2e'))){_0x116661['limit']=qs[_0x9d47('0x2f')](_0x2ed77c['query'][_0x9d47('0x2f')]);_0x116661['offset']=qs[_0x9d47('0x14')](_0x2ed77c[_0x9d47('0x25')][_0x9d47('0x14')]);}_0x116661['order']=qs[_0x9d47('0x30')](_0x2ed77c['query'][_0x9d47('0x30')]);_0x116661['where']=qs[_0x9d47('0x28')](_[_0x9d47('0x31')](_0x2ed77c[_0x9d47('0x25')],_0x3b76ce[_0x9d47('0x28')]));if(_0x3912d0[_0x9d47('0x26')]){if(_0x3912d0[_0x9d47('0x27')]){_0x3912d0['dateEnd']=moment(_0x3912d0[_0x9d47('0x27')])[_0x9d47('0x32')](0x1,_0x9d47('0x33'));}else{_0x3912d0[_0x9d47('0x27')]=moment(_0x3912d0['dateStart'])[_0x9d47('0x32')](0x1,_0x9d47('0x33'));}_[_0x9d47('0x34')](_0x116661['where'],{'createdAt':{'$gte':_0x3912d0[_0x9d47('0x26')],'$lte':_0x3912d0[_0x9d47('0x27')]}});}if(_0x2ed77c[_0x9d47('0x25')][_0x9d47('0x35')]){_0x116661[_0x9d47('0x36')]=_[_0x9d47('0x34')](_0x116661[_0x9d47('0x36')],{'$or':_['map'](_0x116661[_0x9d47('0x2a')],function(_0x2db260){var _0x20b651={};_0x20b651[_0x2db260]={'$like':'%'+_0x2ed77c[_0x9d47('0x25')]['filter']+'%'};return _0x20b651;})});}_0x116661=_['merge']({},_0x116661,_0x2ed77c[_0x9d47('0x37')]);var _0x4e09b0={'where':_0x116661['where']};return db[_0x9d47('0x22')]['count'](_0x4e09b0)[_0x9d47('0x1c')](function(_0x1e8c72){_0x18d24f[_0x9d47('0x13')]=_0x1e8c72;if(_0x2ed77c[_0x9d47('0x25')]['includeAll']){_0x116661[_0x9d47('0x38')]=[{'all':!![]}];}return db[_0x9d47('0x22')]['findAll'](_0x116661);})[_0x9d47('0x1c')](function(_0x4ef712){_0x18d24f[_0x9d47('0x39')]=_0x4ef712;return _0x18d24f;})['then'](respondWithFilteredResult(_0x21b89e,_0x116661))[_0x9d47('0x3a')](handleError(_0x21b89e,null));};exports[_0x9d47('0x3b')]=function(_0x1a662c,_0x34a106){var _0x133695={'raw':![],'where':{'id':_0x1a662c[_0x9d47('0x3c')]['id']}},_0x4e1089={};_0x4e1089[_0x9d47('0x23')]=_[_0x9d47('0x24')](db[_0x9d47('0x22')]['rawAttributes']);_0x4e1089[_0x9d47('0x25')]=_[_0x9d47('0x24')](_0x1a662c[_0x9d47('0x25')]);_0x4e1089[_0x9d47('0x28')]=_[_0x9d47('0x29')](_0x4e1089[_0x9d47('0x23')],_0x4e1089['query']);_0x133695[_0x9d47('0x2a')]=_[_0x9d47('0x29')](_0x4e1089[_0x9d47('0x23')],qs[_0x9d47('0x2b')](_0x1a662c['query']['fields']));_0x133695[_0x9d47('0x2a')]=_0x133695[_0x9d47('0x2a')]['length']?_0x133695['attributes']:_0x4e1089[_0x9d47('0x23')];if(_0x1a662c['query'][_0x9d47('0x3d')]){_0x133695[_0x9d47('0x38')]=[{'all':!![]}];}_0x133695=_[_0x9d47('0x34')]({},_0x133695,_0x1a662c[_0x9d47('0x37')]);return db[_0x9d47('0x22')][_0x9d47('0x3e')](_0x133695)[_0x9d47('0x1c')](handleEntityNotFound(_0x34a106,null))[_0x9d47('0x1c')](respondWithResult(_0x34a106,null))[_0x9d47('0x3a')](handleError(_0x34a106,null));};exports[_0x9d47('0x3f')]=function(_0x26dec1,_0x2906a7){return db[_0x9d47('0x22')]['create'](_0x26dec1[_0x9d47('0x40')],{})[_0x9d47('0x1c')](respondWithResult(_0x2906a7,0xc9))[_0x9d47('0x3a')](handleError(_0x2906a7,null));};exports[_0x9d47('0x41')]=function(_0x1d0a1a,_0x49b8d2){var _0x54058a={'raw':![],'where':{'id':_0x1d0a1a['params']['id']}},_0x2e49a0={};_0x2e49a0[_0x9d47('0x23')]=_[_0x9d47('0x24')](db[_0x9d47('0x22')]['rawAttributes']);_0x54058a[_0x9d47('0x2a')]=_[_0x9d47('0x29')](_0x2e49a0[_0x9d47('0x23')],qs['fields'](_0x1d0a1a['query'][_0x9d47('0x2b')]));_0x54058a['attributes']=_0x54058a[_0x9d47('0x2a')]['length']?_0x54058a[_0x9d47('0x2a')]:_0x2e49a0[_0x9d47('0x23')];if(_0x1d0a1a['query'][_0x9d47('0x3d')]){_0x54058a[_0x9d47('0x38')]=[{'all':!![]}];}_0x54058a=_[_0x9d47('0x34')]({},_0x54058a,_0x1d0a1a[_0x9d47('0x37')]);return db[_0x9d47('0x22')][_0x9d47('0x3e')](_0x54058a)['then'](handleEntityNotFound(_0x49b8d2,null))['then'](function(_0x3f89ba){if(_0x3f89ba){var _0x5218b5=_0x3f89ba[_0x9d47('0x42')]({'plain':!![]});_0x5218b5=qs[_0x9d47('0x43')](_0x5218b5,['id',_0x9d47('0x44'),'updatedAt']);_0x1d0a1a[_0x9d47('0x40')]=_[_0x9d47('0x43')](_0x1d0a1a[_0x9d47('0x40')],['id',_0x9d47('0x44'),_0x9d47('0x45')]);return db[_0x9d47('0x22')][_0x9d47('0x3f')](_[_0x9d47('0x34')](_0x5218b5,_0x1d0a1a[_0x9d47('0x40')]),{'include':_0x1d0a1a[_0x9d47('0x25')][_0x9d47('0x3d')]?[{'all':!![]}]:undefined});}})[_0x9d47('0x1c')](respondWithResult(_0x49b8d2,0xc9))['catch'](handleError(_0x49b8d2,null));};exports[_0x9d47('0x1b')]=function(_0x2eca0c,_0x10bcae){if(_0x2eca0c['body']['id']){delete _0x2eca0c['body']['id'];}return db[_0x9d47('0x22')]['find']({'where':{'id':_0x2eca0c[_0x9d47('0x3c')]['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x10bcae,null))[_0x9d47('0x1c')](saveUpdates(_0x2eca0c[_0x9d47('0x40')],null))['then'](respondWithResult(_0x10bcae,null))[_0x9d47('0x3a')](handleError(_0x10bcae,null));};exports[_0x9d47('0x1d')]=function(_0x16e743,_0x31b12b){return db[_0x9d47('0x22')]['find']({'where':{'id':_0x16e743[_0x9d47('0x3c')]['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x31b12b,null))[_0x9d47('0x1c')](removeEntity(_0x31b12b,null))[_0x9d47('0x3a')](handleError(_0x31b12b,null));};exports[_0x9d47('0x46')]=function(_0x4b670e,_0x3e91cb,_0x3519c6){var _0x44f264={'raw':!![],'where':{}};var _0x46f749={};var _0xf258be={'count':0x0,'rows':[]};return db[_0x9d47('0x22')][_0x9d47('0x47')]({'where':{'id':_0x4b670e['params']['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x3e91cb,null))[_0x9d47('0x1c')](function(_0x53c15e){if(_0x53c15e){_0x46f749['model']=_[_0x9d47('0x24')](db['CmHopper'][_0x9d47('0x48')]);_0x46f749[_0x9d47('0x25')]=_['keys'](_0x4b670e['query']);_0x46f749['filters']=_['intersection'](_0x46f749[_0x9d47('0x23')],_0x46f749['query']);_0x44f264['attributes']=_[_0x9d47('0x29')](_0x46f749[_0x9d47('0x23')],qs[_0x9d47('0x2b')](_0x4b670e[_0x9d47('0x25')][_0x9d47('0x2b')]));_0x44f264[_0x9d47('0x2a')]=_0x44f264[_0x9d47('0x2a')][_0x9d47('0x2c')]?_0x44f264[_0x9d47('0x2a')]:_0x46f749[_0x9d47('0x23')];if(!_0x4b670e['query'][_0x9d47('0x2d')](_0x9d47('0x2e'))){_0x44f264[_0x9d47('0x2f')]=qs[_0x9d47('0x2f')](_0x4b670e['query'][_0x9d47('0x2f')]);_0x44f264[_0x9d47('0x14')]=qs[_0x9d47('0x14')](_0x4b670e[_0x9d47('0x25')][_0x9d47('0x14')]);}_0x44f264[_0x9d47('0x49')]=qs[_0x9d47('0x30')](_0x4b670e[_0x9d47('0x25')][_0x9d47('0x30')]);_0x44f264[_0x9d47('0x36')]=qs['filters'](_[_0x9d47('0x31')](_0x4b670e['query'],_0x46f749['filters']));_0x44f264[_0x9d47('0x36')][_0x9d47('0x4a')]=_0x53c15e['id'];if(_0x4b670e[_0x9d47('0x25')][_0x9d47('0x35')]){_0x44f264[_0x9d47('0x36')]=_[_0x9d47('0x34')](_0x44f264[_0x9d47('0x36')],{'$or':_['map'](_0x44f264[_0x9d47('0x2a')],function(_0x4aa587){var _0x2ac5ec={};_0x2ac5ec[_0x4aa587]={'$like':'%'+_0x4b670e[_0x9d47('0x25')]['filter']+'%'};return _0x2ac5ec;})});}_0x44f264=_[_0x9d47('0x34')]({},_0x44f264,_0x4b670e[_0x9d47('0x37')]);return db[_0x9d47('0x4b')][_0x9d47('0x13')]({'where':_0x44f264[_0x9d47('0x36')]})[_0x9d47('0x1c')](function(_0x384087){_0xf258be['count']=_0x384087;if(_0x4b670e['query']['includeAll']){_0x44f264[_0x9d47('0x38')]=[{'all':!![]}];}return db[_0x9d47('0x4b')][_0x9d47('0x4c')](_0x44f264);})['then'](function(_0xf13f06){_0xf258be[_0x9d47('0x39')]=_0xf13f06;return _0xf258be;});}})[_0x9d47('0x1c')](respondWithFilteredResult(_0x3e91cb,_0x44f264))['catch'](handleError(_0x3e91cb,null));};exports[_0x9d47('0x4d')]=function(_0x3dd84d,_0x3dbb55,_0x452de9){var _0x4d90b5={'raw':!![],'where':{}};var _0x185ddd={};var _0x260a22={'count':0x0,'rows':[]};return db[_0x9d47('0x22')][_0x9d47('0x47')]({'where':{'id':_0x3dd84d[_0x9d47('0x3c')]['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x3dbb55,null))[_0x9d47('0x1c')](function(_0x587c97){if(_0x587c97){_0x185ddd['model']=_['keys'](db[_0x9d47('0x4e')]['rawAttributes']);_0x185ddd[_0x9d47('0x25')]=_[_0x9d47('0x24')](_0x3dd84d['query']);_0x185ddd[_0x9d47('0x28')]=_[_0x9d47('0x29')](_0x185ddd[_0x9d47('0x23')],_0x185ddd['query']);_0x4d90b5['attributes']=_['intersection'](_0x185ddd[_0x9d47('0x23')],qs[_0x9d47('0x2b')](_0x3dd84d[_0x9d47('0x25')][_0x9d47('0x2b')]));_0x4d90b5['attributes']=_0x4d90b5[_0x9d47('0x2a')]['length']?_0x4d90b5['attributes']:_0x185ddd[_0x9d47('0x23')];if(!_0x3dd84d[_0x9d47('0x25')][_0x9d47('0x2d')]('nolimit')){_0x4d90b5[_0x9d47('0x2f')]=qs[_0x9d47('0x2f')](_0x3dd84d['query'][_0x9d47('0x2f')]);_0x4d90b5[_0x9d47('0x14')]=qs[_0x9d47('0x14')](_0x3dd84d['query'][_0x9d47('0x14')]);}_0x4d90b5[_0x9d47('0x49')]=qs[_0x9d47('0x30')](_0x3dd84d['query'][_0x9d47('0x30')]);_0x4d90b5[_0x9d47('0x36')]=qs['filters'](_[_0x9d47('0x31')](_0x3dd84d[_0x9d47('0x25')],_0x185ddd['filters']));_0x4d90b5[_0x9d47('0x36')][_0x9d47('0x4a')]=_0x587c97['id'];if(_0x3dd84d[_0x9d47('0x25')][_0x9d47('0x35')]){_0x4d90b5['where']=_[_0x9d47('0x34')](_0x4d90b5[_0x9d47('0x36')],{'$or':_[_0x9d47('0x4f')](_0x4d90b5[_0x9d47('0x2a')],function(_0x46294d){var _0x32ff1b={};_0x32ff1b[_0x46294d]={'$like':'%'+_0x3dd84d[_0x9d47('0x25')][_0x9d47('0x35')]+'%'};return _0x32ff1b;})});}_0x4d90b5=_[_0x9d47('0x34')]({},_0x4d90b5,_0x3dd84d[_0x9d47('0x37')]);return db[_0x9d47('0x4e')]['count']({'where':_0x4d90b5[_0x9d47('0x36')]})['then'](function(_0x4fba9b){_0x260a22['count']=_0x4fba9b;if(_0x3dd84d[_0x9d47('0x25')][_0x9d47('0x3d')]){_0x4d90b5['include']=[{'all':!![]}];}return db[_0x9d47('0x4e')][_0x9d47('0x4c')](_0x4d90b5);})[_0x9d47('0x1c')](function(_0x2cd50a){_0x260a22[_0x9d47('0x39')]=_0x2cd50a;return _0x260a22;});}})['then'](respondWithFilteredResult(_0x3dbb55,_0x4d90b5))[_0x9d47('0x3a')](handleError(_0x3dbb55,null));};exports['getHopperFinals']=function(_0x1669db,_0x159532,_0x26af29){var _0x1986e8={'raw':!![],'where':{}};var _0xb66d3d={};var _0x3574d5={'count':0x0,'rows':[]};return db[_0x9d47('0x22')][_0x9d47('0x47')]({'where':{'id':_0x1669db['params']['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x159532,null))[_0x9d47('0x1c')](function(_0x2180a6){if(_0x2180a6){_0xb66d3d[_0x9d47('0x23')]=_[_0x9d47('0x24')](db[_0x9d47('0x50')][_0x9d47('0x48')]);_0xb66d3d[_0x9d47('0x25')]=_[_0x9d47('0x24')](_0x1669db['query']);_0xb66d3d['filters']=_['intersection'](_0xb66d3d[_0x9d47('0x23')],_0xb66d3d[_0x9d47('0x25')]);_0x1986e8['attributes']=_[_0x9d47('0x29')](_0xb66d3d[_0x9d47('0x23')],qs[_0x9d47('0x2b')](_0x1669db[_0x9d47('0x25')][_0x9d47('0x2b')]));_0x1986e8['attributes']=_0x1986e8[_0x9d47('0x2a')]['length']?_0x1986e8[_0x9d47('0x2a')]:_0xb66d3d[_0x9d47('0x23')];if(!_0x1669db[_0x9d47('0x25')]['hasOwnProperty'](_0x9d47('0x2e'))){_0x1986e8[_0x9d47('0x2f')]=qs[_0x9d47('0x2f')](_0x1669db['query'][_0x9d47('0x2f')]);_0x1986e8[_0x9d47('0x14')]=qs['offset'](_0x1669db[_0x9d47('0x25')][_0x9d47('0x14')]);}_0x1986e8['order']=qs[_0x9d47('0x30')](_0x1669db[_0x9d47('0x25')]['sort']);_0x1986e8[_0x9d47('0x36')]=qs[_0x9d47('0x28')](_[_0x9d47('0x31')](_0x1669db[_0x9d47('0x25')],_0xb66d3d['filters']));_0x1986e8[_0x9d47('0x36')][_0x9d47('0x4a')]=_0x2180a6['id'];if(_0x1669db[_0x9d47('0x25')][_0x9d47('0x35')]){_0x1986e8[_0x9d47('0x36')]=_[_0x9d47('0x34')](_0x1986e8[_0x9d47('0x36')],{'$or':_[_0x9d47('0x4f')](_0x1986e8[_0x9d47('0x2a')],function(_0x448603){var _0x36d0fd={};_0x36d0fd[_0x448603]={'$like':'%'+_0x1669db[_0x9d47('0x25')][_0x9d47('0x35')]+'%'};return _0x36d0fd;})});}_0x1986e8=_[_0x9d47('0x34')]({},_0x1986e8,_0x1669db[_0x9d47('0x37')]);return db[_0x9d47('0x50')]['count']({'where':_0x1986e8[_0x9d47('0x36')]})[_0x9d47('0x1c')](function(_0x42c823){_0x3574d5[_0x9d47('0x13')]=_0x42c823;if(_0x1669db[_0x9d47('0x25')][_0x9d47('0x3d')]){_0x1986e8[_0x9d47('0x38')]=[{'all':!![]}];}return db[_0x9d47('0x50')][_0x9d47('0x4c')](_0x1986e8);})[_0x9d47('0x1c')](function(_0x58452c){_0x3574d5[_0x9d47('0x39')]=_0x58452c;return _0x3574d5;});}})[_0x9d47('0x1c')](respondWithFilteredResult(_0x159532,_0x1986e8))[_0x9d47('0x3a')](handleError(_0x159532,null));};exports['getHopperBlacks']=function(_0x490e35,_0x358980,_0x5df5e1){var _0x22f6bf={'raw':!![],'where':{}};var _0x385d39={};var _0x2f4d95={'count':0x0,'rows':[]};return db[_0x9d47('0x22')][_0x9d47('0x47')]({'where':{'id':_0x490e35['params']['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x358980,null))[_0x9d47('0x1c')](function(_0x449dc0){if(_0x449dc0){_0x385d39['model']=_[_0x9d47('0x24')](db['CmHopperBlack']['rawAttributes']);_0x385d39[_0x9d47('0x25')]=_[_0x9d47('0x24')](_0x490e35['query']);_0x385d39[_0x9d47('0x28')]=_[_0x9d47('0x29')](_0x385d39['model'],_0x385d39[_0x9d47('0x25')]);_0x22f6bf[_0x9d47('0x2a')]=_['intersection'](_0x385d39[_0x9d47('0x23')],qs[_0x9d47('0x2b')](_0x490e35[_0x9d47('0x25')][_0x9d47('0x2b')]));_0x22f6bf[_0x9d47('0x2a')]=_0x22f6bf[_0x9d47('0x2a')][_0x9d47('0x2c')]?_0x22f6bf[_0x9d47('0x2a')]:_0x385d39[_0x9d47('0x23')];if(!_0x490e35[_0x9d47('0x25')][_0x9d47('0x2d')]('nolimit')){_0x22f6bf[_0x9d47('0x2f')]=qs['limit'](_0x490e35[_0x9d47('0x25')][_0x9d47('0x2f')]);_0x22f6bf[_0x9d47('0x14')]=qs[_0x9d47('0x14')](_0x490e35[_0x9d47('0x25')][_0x9d47('0x14')]);}_0x22f6bf[_0x9d47('0x49')]=qs[_0x9d47('0x30')](_0x490e35[_0x9d47('0x25')][_0x9d47('0x30')]);_0x22f6bf[_0x9d47('0x36')]=qs[_0x9d47('0x28')](_[_0x9d47('0x31')](_0x490e35[_0x9d47('0x25')],_0x385d39[_0x9d47('0x28')]));_0x22f6bf[_0x9d47('0x36')][_0x9d47('0x4a')]=_0x449dc0['id'];if(_0x490e35[_0x9d47('0x25')]['filter']){_0x22f6bf[_0x9d47('0x36')]=_[_0x9d47('0x34')](_0x22f6bf[_0x9d47('0x36')],{'$or':_[_0x9d47('0x4f')](_0x22f6bf[_0x9d47('0x2a')],function(_0x35313d){var _0x310f4c={};_0x310f4c[_0x35313d]={'$like':'%'+_0x490e35[_0x9d47('0x25')][_0x9d47('0x35')]+'%'};return _0x310f4c;})});}_0x22f6bf=_[_0x9d47('0x34')]({},_0x22f6bf,_0x490e35[_0x9d47('0x37')]);return db[_0x9d47('0x51')][_0x9d47('0x13')]({'where':_0x22f6bf[_0x9d47('0x36')]})['then'](function(_0x2f72e8){_0x2f4d95[_0x9d47('0x13')]=_0x2f72e8;if(_0x490e35['query'][_0x9d47('0x3d')]){_0x22f6bf['include']=[{'all':!![]}];}return db[_0x9d47('0x51')][_0x9d47('0x4c')](_0x22f6bf);})[_0x9d47('0x1c')](function(_0x522664){_0x2f4d95[_0x9d47('0x39')]=_0x522664;return _0x2f4d95;});}})[_0x9d47('0x1c')](respondWithFilteredResult(_0x358980,_0x22f6bf))[_0x9d47('0x3a')](handleError(_0x358980,null));};exports[_0x9d47('0x52')]=function(_0x1ec94b,_0x45edc5,_0x120ab3){var _0x1b923a={};var _0x48600d={};var _0x3585e1;var _0x224942;return db[_0x9d47('0x22')]['findOne']({'where':{'id':_0x1ec94b[_0x9d47('0x3c')]['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x45edc5,null))['then'](function(_0x48cb42){if(_0x48cb42){_0x3585e1=_0x48cb42;_0x48600d[_0x9d47('0x23')]=_[_0x9d47('0x24')](db[_0x9d47('0x53')][_0x9d47('0x48')]);_0x48600d[_0x9d47('0x25')]=_[_0x9d47('0x24')](_0x1ec94b[_0x9d47('0x25')]);_0x48600d[_0x9d47('0x28')]=_[_0x9d47('0x29')](_0x48600d[_0x9d47('0x23')],_0x48600d[_0x9d47('0x25')]);_0x1b923a[_0x9d47('0x2a')]=_['intersection'](_0x48600d['model'],qs[_0x9d47('0x2b')](_0x1ec94b['query'][_0x9d47('0x2b')]));_0x1b923a['attributes']=_0x1b923a[_0x9d47('0x2a')][_0x9d47('0x2c')]?_0x1b923a[_0x9d47('0x2a')]:_0x48600d[_0x9d47('0x23')];_0x1b923a[_0x9d47('0x49')]=qs[_0x9d47('0x30')](_0x1ec94b[_0x9d47('0x25')][_0x9d47('0x30')]);_0x1b923a[_0x9d47('0x36')]=qs[_0x9d47('0x28')](_[_0x9d47('0x31')](_0x1ec94b[_0x9d47('0x25')],_0x48600d[_0x9d47('0x28')]));if(_0x1ec94b[_0x9d47('0x25')][_0x9d47('0x35')]){_0x1b923a[_0x9d47('0x36')]=_['merge'](_0x1b923a['where'],{'$or':_[_0x9d47('0x4f')](_0x1b923a['attributes'],function(_0x2e59d4){var _0x28c6a0={};_0x28c6a0[_0x2e59d4]={'$like':'%'+_0x1ec94b['query']['filter']+'%'};return _0x28c6a0;})});}_0x1b923a=_[_0x9d47('0x34')]({},_0x1b923a,_0x1ec94b['options']);return _0x3585e1['getLists'](_0x1b923a);}})[_0x9d47('0x1c')](function(_0x3a60a2){if(_0x3a60a2){_0x224942=_0x3a60a2[_0x9d47('0x2c')];if(!_0x1ec94b[_0x9d47('0x25')][_0x9d47('0x2d')](_0x9d47('0x2e'))){_0x1b923a['limit']=qs['limit'](_0x1ec94b[_0x9d47('0x25')]['limit']);_0x1b923a[_0x9d47('0x14')]=qs['offset'](_0x1ec94b['query']['offset']);}return _0x3585e1['getLists'](_0x1b923a);}})[_0x9d47('0x1c')](function(_0x2f1a22){if(_0x2f1a22){return _0x2f1a22?{'count':_0x224942,'rows':_0x2f1a22}:null;}})['then'](respondWithResult(_0x45edc5,null))[_0x9d47('0x3a')](handleError(_0x45edc5,null));};exports['addLists']=function(_0x4cabdc,_0x3b3653,_0x1d062d){var _0x4a1d85,_0x3fa65b;return db[_0x9d47('0x22')][_0x9d47('0x3e')]({'where':{'id':_0x4cabdc[_0x9d47('0x3c')]['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x3b3653,null))[_0x9d47('0x1c')](function(_0x4442f2){if(_0x4442f2){_0x3fa65b=_0x4442f2;return _0x4442f2[_0x9d47('0x54')](_0x4cabdc[_0x9d47('0x40')]['ids'],_[_0x9d47('0x43')](_0x4cabdc[_0x9d47('0x40')],[_0x9d47('0x55'),'id'])||{});}return null;})['spread'](function(_0x538611){var _0x55adb3;_0x4a1d85=_0x538611||[];var _0x46dd4f=[];if(_0x538611){for(var _0x47c0e6=0x0;_0x47c0e6<_0x538611[_0x9d47('0x2c')];_0x47c0e6+=0x1){var _0x572594=_0x538611[_0x47c0e6][_0x9d47('0x42')]({'plain':!![]});_0x3fa65b[_0x9d47('0x56')]=_0x4cabdc[_0x9d47('0x40')][_0x9d47('0x56')]?_0x4cabdc[_0x9d47('0x40')]['dialCheckDuplicateType']:_0x3fa65b[_0x9d47('0x56')];switch(_0x3fa65b[_0x9d47('0x56')]){case _0x9d47('0x57'):_0x55adb3=squel[_0x9d47('0x58')]()[_0x9d47('0x59')](_0x9d47('0x5a'))[_0x9d47('0x5b')]([_0x9d47('0x5c'),_0x9d47('0x5d'),'ContactId','ListId',_0x9d47('0x4a'),_0x9d47('0x44'),'updatedAt'],squel['select']()[_0x9d47('0x5e')]('phone',_0x9d47('0x5c'))[_0x9d47('0x5e')](_0x9d47('0x5f'),_0x9d47('0x5d'))['field']('id',_0x9d47('0x60'))[_0x9d47('0x5e')](_0x572594[_0x9d47('0x61')]['toString'](),_0x9d47('0x62'))['field'](_0x4cabdc[_0x9d47('0x3c')]['id'][_0x9d47('0x63')](),_0x9d47('0x4a'))['field'](_0x9d47('0x5f'),_0x9d47('0x44'))[_0x9d47('0x5e')](_0x9d47('0x5f'),_0x9d47('0x45'))[_0x9d47('0x64')](_0x9d47('0x65'))[_0x9d47('0x36')](_0x9d47('0x66'))['where'](_0x9d47('0x67'),_0x572594['CmListId'][_0x9d47('0x63')]())[_0x9d47('0x36')](_0x9d47('0x68'))[_0x9d47('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9d47('0x69')]()['field']('calleridnum')[_0x9d47('0x64')](_0x9d47('0x6a'))['where'](_0x9d47('0x6b'),_0x4cabdc[_0x9d47('0x3c')]['id'][_0x9d47('0x63')]()))[_0x9d47('0x36')](_0x9d47('0x6c'),squel[_0x9d47('0x69')]()[_0x9d47('0x5e')](_0x9d47('0x5c'))[_0x9d47('0x64')]('cm_hopper')[_0x9d47('0x36')](_0x9d47('0x6b'),_0x4cabdc[_0x9d47('0x3c')]['id'][_0x9d47('0x63')]())))[_0x9d47('0x63')]();break;case _0x9d47('0x6d'):_0x55adb3=squel['insert']()[_0x9d47('0x59')](_0x9d47('0x5a'))[_0x9d47('0x5b')]([_0x9d47('0x5c'),_0x9d47('0x5d'),_0x9d47('0x60'),_0x9d47('0x62'),'CampaignId','createdAt','updatedAt'],squel['select']()[_0x9d47('0x5e')](_0x9d47('0x5c'),_0x9d47('0x5c'))[_0x9d47('0x5e')](_0x9d47('0x5f'),_0x9d47('0x5d'))['field']('id',_0x9d47('0x60'))[_0x9d47('0x5e')](_0x572594[_0x9d47('0x61')][_0x9d47('0x63')](),'ListId')[_0x9d47('0x5e')](_0x4cabdc['params']['id']['toString'](),'CampaignId')[_0x9d47('0x5e')](_0x9d47('0x5f'),_0x9d47('0x44'))[_0x9d47('0x5e')]('NOW()','updatedAt')[_0x9d47('0x64')](_0x9d47('0x65'))[_0x9d47('0x36')]('deletedAt\x20IS\x20NULL')[_0x9d47('0x36')](_0x9d47('0x67'),_0x572594[_0x9d47('0x61')][_0x9d47('0x63')]())[_0x9d47('0x36')](_0x9d47('0x68'))[_0x9d47('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9d47('0x69')]()[_0x9d47('0x5e')](_0x9d47('0x5c'))[_0x9d47('0x64')](_0x9d47('0x5a'))['where']('CampaignId\x20=\x20?',_0x4cabdc['params']['id']['toString']())))[_0x9d47('0x63')]();break;default:_0x55adb3=squel['insert']()[_0x9d47('0x59')](_0x9d47('0x5a'))[_0x9d47('0x5b')]([_0x9d47('0x5c'),'scheduledAt','ContactId','ListId',_0x9d47('0x4a'),_0x9d47('0x44'),_0x9d47('0x45')],squel['select']()['field'](_0x9d47('0x5c'),'phone')[_0x9d47('0x5e')](_0x9d47('0x5f'),_0x9d47('0x5d'))[_0x9d47('0x5e')]('id',_0x9d47('0x60'))[_0x9d47('0x5e')](_0x572594[_0x9d47('0x61')][_0x9d47('0x63')](),'ListId')['field'](_0x4cabdc['params']['id'][_0x9d47('0x63')](),'CampaignId')['field'](_0x9d47('0x5f'),_0x9d47('0x44'))[_0x9d47('0x5e')](_0x9d47('0x5f'),_0x9d47('0x45'))[_0x9d47('0x64')](_0x9d47('0x65'))[_0x9d47('0x36')]('deletedAt\x20IS\x20NULL')[_0x9d47('0x36')](_0x9d47('0x67'),_0x572594[_0x9d47('0x61')][_0x9d47('0x63')]())[_0x9d47('0x36')](_0x9d47('0x68')))[_0x9d47('0x63')]();}_0x46dd4f[_0x9d47('0x6e')](db['sequelize'][_0x9d47('0x25')](_0x55adb3));}return BPromise[_0x9d47('0x6f')](_0x46dd4f);}})[_0x9d47('0x1c')](function(){return _0x4a1d85;})['then'](respondWithResult(_0x3b3653,null))['catch'](handleError(_0x3b3653,null));};exports[_0x9d47('0x70')]=function(_0xc3ddb5,_0x3e3bb9,_0x589b9b){var _0x18f69b;return db[_0x9d47('0x22')][_0x9d47('0x3e')]({'where':{'id':_0xc3ddb5[_0x9d47('0x3c')]['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x3e3bb9,null))['then'](function(_0x4a0431){if(_0x4a0431){return _0x4a0431[_0x9d47('0x70')](_0xc3ddb5['query']['ids']);}})[_0x9d47('0x1c')](function(_0x426309){if(_0x426309){_0x18f69b=_0x426309;return db[_0x9d47('0x4b')][_0x9d47('0x1d')]({'where':{'ListId':_0xc3ddb5[_0x9d47('0x25')][_0x9d47('0x55')],'CampaignId':_0xc3ddb5[_0x9d47('0x3c')]['id']}})[_0x9d47('0x1c')](function(){return _0x18f69b;});}})[_0x9d47('0x1c')](respondWithStatusCode(_0x3e3bb9,null))[_0x9d47('0x3a')](handleError(_0x3e3bb9,null));};exports['getBlackLists']=function(_0x27bf52,_0x5d7eed,_0x15593c){var _0x41ca4d={'raw':!![],'where':{}};var _0x4bcc94={};var _0x182ad5={'count':0x0,'rows':[]};return db[_0x9d47('0x22')][_0x9d47('0x47')]({'where':{'id':_0x27bf52['params']['id']}})[_0x9d47('0x1c')](handleEntityNotFound(_0x5d7eed,null))[_0x9d47('0x1c')](function(_0x5baad1){if(_0x5baad1){_0x4bcc94[_0x9d47('0x23')]=_['keys'](db[_0x9d47('0x53')][_0x9d47('0x48')]);_0x4bcc94['query']=_[_0x9d47('0x24')](_0x27bf52[_0x9d47('0x25')]);_0x4bcc94[_0x9d47('0x28')]=_['intersection'](_0x4bcc94['model'],_0x4bcc94[_0x9d47('0x25')]);_0x41ca4d['attributes']=_[_0x9d47('0x29')](_0x4bcc94['model'],qs[_0x9d47('0x2b')](_0x27bf52[_0x9d47('0x25')][_0x9d47('0x2b')]));_0x41ca4d[_0x9d47('0x2a')]=_0x41ca4d['attributes'][_0x9d47('0x2c')]?_0x41ca4d[_0x9d47('0x2a')]:_0x4bcc94[_0x9d47('0x23')];if(!_0x27bf52['query'][_0x9d47('0x2d')](_0x9d47('0x2e'))){_0x41ca4d[_0x9d47('0x2f')]=qs['limit'](_0x27bf52[_0x9d47('0x25')][_0x9d47('0x2f')]);_0x41ca4d['offset']=qs[_0x9d47('0x14')](_0x27bf52[_0x9d47('0x25')][_0x9d47('0x14')]);}_0x41ca4d[_0x9d47('0x49')]=qs[_0x9d47('0x30')](_0x27bf52[_0x9d47('0x25')][_0x9d47('0x30')]);_0x41ca4d['where']=qs[_0x9d47('0x28')](_['pick'](_0x27bf52[_0x9d47('0x25')],_0x4bcc94[_0x9d47('0x28')]));_0x41ca4d['where'][_0x9d47('0x4a')]=_0x5baad1['id'];if(_0x27bf52[_0x9d47('0x25')][_0x9d47('0x35')]){_0x41ca4d['where']=_[_0x9d47('0x34')](_0x41ca4d['where'],{'$or':_[_0x9d47('0x4f')](_0x41ca4d['attributes'],function(_0x5a7882){var _0x59dfb7={};_0x59dfb7[_0x5a7882]={'$like':'%'+_0x27bf52[_0x9d47('0x25')][_0x9d47('0x35')]+'%'};return _0x59dfb7;})});}_0x41ca4d=_[_0x9d47('0x34')]({},_0x41ca4d,_0x27bf52[_0x9d47('0x37')]);return db[_0x9d47('0x53')][_0x9d47('0x13')]({'where':_0x41ca4d['where']})[_0x9d47('0x1c')](function(_0xb405d4){_0x182ad5[_0x9d47('0x13')]=_0xb405d4;if(_0x27bf52[_0x9d47('0x25')][_0x9d47('0x3d')]){_0x41ca4d[_0x9d47('0x38')]=[{'all':!![]}];}return db[_0x9d47('0x53')]['findAll'](_0x41ca4d);})[_0x9d47('0x1c')](function(_0x24dde9){_0x182ad5[_0x9d47('0x39')]=_0x24dde9;return _0x182ad5;});}})['then'](respondWithFilteredResult(_0x5d7eed,_0x41ca4d))[_0x9d47('0x3a')](handleError(_0x5d7eed,null));};exports['addBlackLists']=function(_0x434235,_0x3d59ff,_0x1081aa){var _0x1b711f,_0x3c82c0;return db[_0x9d47('0x22')][_0x9d47('0x3e')]({'where':{'id':_0x434235['params']['id']}})['then'](handleEntityNotFound(_0x3d59ff,null))[_0x9d47('0x1c')](function(_0x58ac68){if(_0x58ac68){_0x3c82c0=_0x58ac68;return _0x58ac68['addBlackLists'](_0x434235[_0x9d47('0x40')][_0x9d47('0x55')],_['omit'](_0x434235[_0x9d47('0x40')],[_0x9d47('0x55'),'id'])||{});}return null;})['spread'](function(_0x4a529b){var _0xd1728b;_0x1b711f=_0x4a529b||[];var _0x98ccb6=[];if(_0x4a529b){for(var _0x24c0f8=0x0;_0x24c0f8<_0x4a529b['length'];_0x24c0f8+=0x1){var _0x2d221e=_0x4a529b[_0x24c0f8]['get']({'plain':!![]});_0xd1728b=squel[_0x9d47('0x58')]()['into']('cm_hopper_black')[_0x9d47('0x5b')]([_0x9d47('0x5c'),'ContactId',_0x9d47('0x62'),_0x9d47('0x4a'),_0x9d47('0x44'),_0x9d47('0x45')],squel['select']()[_0x9d47('0x5e')](_0x9d47('0x5c'),_0x9d47('0x5c'))[_0x9d47('0x5e')]('id','ContactId')[_0x9d47('0x5e')](_0x2d221e[_0x9d47('0x61')]['toString'](),'ListId')[_0x9d47('0x5e')](_0x434235[_0x9d47('0x3c')]['id'][_0x9d47('0x63')](),_0x9d47('0x4a'))[_0x9d47('0x5e')]('NOW()',_0x9d47('0x44'))[_0x9d47('0x5e')](_0x9d47('0x5f'),'updatedAt')[_0x9d47('0x64')](_0x9d47('0x65'))[_0x9d47('0x36')](_0x9d47('0x66'))[_0x9d47('0x36')](_0x9d47('0x67'),_0x2d221e[_0x9d47('0x61')][_0x9d47('0x63')]())[_0x9d47('0x36')](_0x9d47('0x68')))[_0x9d47('0x63')]();_0x98ccb6[_0x9d47('0x6e')](db['sequelize'][_0x9d47('0x25')](_0xd1728b));}return BPromise[_0x9d47('0x6f')](_0x98ccb6);}})['then'](function(){return _0x1b711f;})[_0x9d47('0x1c')](respondWithResult(_0x3d59ff,null))[_0x9d47('0x3a')](handleError(_0x3d59ff,null));};exports[_0x9d47('0x71')]=function(_0x32b280,_0x147128,_0x500e8e){var _0x3abc7e;return db[_0x9d47('0x22')][_0x9d47('0x3e')]({'where':{'id':_0x32b280[_0x9d47('0x3c')]['id']}})['then'](handleEntityNotFound(_0x147128,null))[_0x9d47('0x1c')](function(_0x489f60){if(_0x489f60){return _0x489f60[_0x9d47('0x71')](_0x32b280[_0x9d47('0x25')]['ids']);}})['then'](function(_0x1a3fb4){if(_0x1a3fb4){_0x3abc7e=_0x1a3fb4;return db['CmHopperBlack'][_0x9d47('0x1d')]({'where':{'ListId':_0x32b280['query'][_0x9d47('0x55')],'CampaignId':_0x32b280['params']['id']}})[_0x9d47('0x1c')](function(){return _0x3abc7e;});}})['then'](respondWithStatusCode(_0x147128,null))[_0x9d47('0x3a')](handleError(_0x147128,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 80ce9f0..e771375 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 _0x7a28=['moment','request-promise','exports','Campaign','lodash','util','../../config/logger','api'];(function(_0x46e9f2,_0xb8c5f9){var _0x2ff437=function(_0x231e71){while(--_0x231e71){_0x46e9f2['push'](_0x46e9f2['shift']());}};_0x2ff437(++_0xb8c5f9);}(_0x7a28,0xbc));var _0x87a2=function(_0x46a151,_0xaacfaa){_0x46a151=_0x46a151-0x0;var _0x2d4557=_0x7a28[_0x46a151];return _0x2d4557;};'use strict';var _=require(_0x87a2('0x0'));var util=require(_0x87a2('0x1'));var logger=require(_0x87a2('0x2'))(_0x87a2('0x3'));var moment=require(_0x87a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x87a2('0x5'));var attributes=require('./campaign.attributes');module[_0x87a2('0x6')]=function(_0x1559eb,_0x54a0c1){return _0x1559eb['define'](_0x87a2('0x7'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5180=['bluebird','request-promise','./campaign.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x3c6b7a,_0x35fab8){var _0x2ca712=function(_0x148978){while(--_0x148978){_0x3c6b7a['push'](_0x3c6b7a['shift']());}};_0x2ca712(++_0x35fab8);}(_0x5180,0x1d1));var _0x0518=function(_0x5ce51d,_0x39f17c){_0x5ce51d=_0x5ce51d-0x0;var _0x835be7=_0x5180[_0x5ce51d];return _0x835be7;};'use strict';var _=require(_0x0518('0x0'));var util=require(_0x0518('0x1'));var logger=require(_0x0518('0x2'))(_0x0518('0x3'));var moment=require(_0x0518('0x4'));var BPromise=require(_0x0518('0x5'));var rp=require(_0x0518('0x6'));var attributes=require(_0x0518('0x7'));module[_0x0518('0x8')]=function(_0x572c17,_0x23935a){return _0x572c17[_0x0518('0x9')]('Campaign',attributes,{'tableName':'campaigns','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 635d6ef..4165c03 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 _0xd304=['error','code','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','include','model','map','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Campaign,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd304,0x65));var _0x4d30=function(_0x2c1b38,_0xb5166d){_0x2c1b38=_0x2c1b38-0x0;var _0x172d79=_0xd304[_0x2c1b38];return _0x172d79;};'use strict';var _=require('lodash');var util=require(_0x4d30('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d30('0x1'));var fs=require('fs');var db=require(_0x4d30('0x2'))['db'];var utils=require(_0x4d30('0x3'));var logger=require(_0x4d30('0x4'))(_0x4d30('0x5'));var config=require(_0x4d30('0x6'));var jayson=require(_0x4d30('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x294167,_0x3af95f,_0x520fc2){return new BPromise(function(_0x592e63,_0x3c184d){return client[_0x4d30('0x8')](_0x294167,_0x520fc2)[_0x4d30('0x9')](function(_0x417277){logger[_0x4d30('0xa')](_0x4d30('0xb'),_0x3af95f,'request\x20sent');logger[_0x4d30('0xc')]('Campaign,\x20%s,\x20%s,\x20%s',_0x3af95f,_0x4d30('0xd'),JSON[_0x4d30('0xe')](_0x417277));if(_0x417277[_0x4d30('0xf')]){if(_0x417277['error'][_0x4d30('0x10')]===0x1f4){logger[_0x4d30('0xf')]('Campaign,\x20%s,\x20%s',_0x3af95f,_0x417277[_0x4d30('0xf')][_0x4d30('0x11')]);return _0x3c184d(_0x417277[_0x4d30('0xf')][_0x4d30('0x11')]);}logger[_0x4d30('0xf')](_0x4d30('0xb'),_0x3af95f,_0x417277[_0x4d30('0xf')][_0x4d30('0x11')]);return _0x592e63(_0x417277[_0x4d30('0xf')]['message']);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x3af95f,_0x4d30('0xd'));_0x592e63(_0x417277['result'][_0x4d30('0x11')]);}})[_0x4d30('0x12')](function(_0x21befd){logger['error'](_0x4d30('0xb'),_0x3af95f,_0x21befd);_0x3c184d(_0x21befd);});});}exports[_0x4d30('0x13')]=function(_0xf6e63){var _0x4eb054=this;return new Promise(function(_0x2511d9,_0x38acdd){return db[_0x4d30('0x14')][_0x4d30('0x15')]({'raw':_0xf6e63[_0x4d30('0x16')]?_0xf6e63[_0x4d30('0x16')][_0x4d30('0x17')]===undefined?!![]:![]:!![],'where':_0xf6e63[_0x4d30('0x16')]?_0xf6e63[_0x4d30('0x16')][_0x4d30('0x18')]||null:null,'attributes':_0xf6e63[_0x4d30('0x16')]?_0xf6e63['options'][_0x4d30('0x19')]||null:null,'limit':_0xf6e63[_0x4d30('0x16')]?_0xf6e63[_0x4d30('0x16')]['limit']||null:null,'include':_0xf6e63[_0x4d30('0x16')]?_0xf6e63[_0x4d30('0x16')]['include']?_['map'](_0xf6e63[_0x4d30('0x16')][_0x4d30('0x1a')],function(_0x31d5d0){return{'model':db[_0x31d5d0[_0x4d30('0x1b')]],'as':_0x31d5d0['as'],'attributes':_0x31d5d0[_0x4d30('0x19')],'include':_0x31d5d0[_0x4d30('0x1a')]?_[_0x4d30('0x1c')](_0x31d5d0[_0x4d30('0x1a')],function(_0x1f16c2){return{'model':db[_0x1f16c2['model']],'as':_0x1f16c2['as'],'attributes':_0x1f16c2[_0x4d30('0x19')],'include':_0x1f16c2[_0x4d30('0x1a')]?_['map'](_0x1f16c2[_0x4d30('0x1a')],function(_0x4446fb){return{'model':db[_0x4446fb['model']],'as':_0x4446fb['as'],'attributes':_0x4446fb[_0x4d30('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4d30('0x9')](function(_0x2c040c){logger[_0x4d30('0xa')]('GetCampaign',_0xf6e63);logger[_0x4d30('0xc')](_0x4d30('0x13'),_0xf6e63,JSON[_0x4d30('0xe')](_0x2c040c));_0x2511d9(_0x2c040c);})[_0x4d30('0x12')](function(_0x382f6e){logger[_0x4d30('0xf')](_0x4d30('0x13'),_0x382f6e['message'],_0xf6e63);_0x38acdd(_0x4eb054[_0x4d30('0xf')](0x1f4,_0x382f6e[_0x4d30('0x11')]));});});}; \ No newline at end of file +var _0x396f=['request\x20sent','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','map','include','model','bluebird','../../mysqldb','../../config/logger','rpc','http','then','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x181c12,_0x42241d){var _0x219ffd=function(_0x2808aa){while(--_0x2808aa){_0x181c12['push'](_0x181c12['shift']());}};_0x219ffd(++_0x42241d);}(_0x396f,0x74));var _0xf396=function(_0x26a4f7,_0x2be0b2){_0x26a4f7=_0x26a4f7-0x0;var _0x16a318=_0x396f[_0x26a4f7];return _0x16a318;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf396('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xf396('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xf396('0x2'))(_0xf396('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf396('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x1a85d9,_0x3a61f4,_0x14fd7c){return new BPromise(function(_0x4d6362,_0x5295fd){return client['request'](_0x1a85d9,_0x14fd7c)[_0xf396('0x5')](function(_0x9833f1){logger[_0xf396('0x6')](_0xf396('0x7'),_0x3a61f4,'request\x20sent');logger['debug'](_0xf396('0x8'),_0x3a61f4,_0xf396('0x9'),JSON[_0xf396('0xa')](_0x9833f1));if(_0x9833f1[_0xf396('0xb')]){if(_0x9833f1[_0xf396('0xb')][_0xf396('0xc')]===0x1f4){logger[_0xf396('0xb')]('Campaign,\x20%s,\x20%s',_0x3a61f4,_0x9833f1[_0xf396('0xb')]['message']);return _0x5295fd(_0x9833f1['error'][_0xf396('0xd')]);}logger[_0xf396('0xb')](_0xf396('0x7'),_0x3a61f4,_0x9833f1['error'][_0xf396('0xd')]);return _0x4d6362(_0x9833f1[_0xf396('0xb')][_0xf396('0xd')]);}else{logger['info'](_0xf396('0x7'),_0x3a61f4,_0xf396('0x9'));_0x4d6362(_0x9833f1[_0xf396('0xe')][_0xf396('0xd')]);}})[_0xf396('0xf')](function(_0x5e9ed0){logger[_0xf396('0xb')](_0xf396('0x7'),_0x3a61f4,_0x5e9ed0);_0x5295fd(_0x5e9ed0);});});}exports[_0xf396('0x10')]=function(_0x49a9d3){var _0x102c61=this;return new Promise(function(_0x5d3a46,_0x4348cb){return db[_0xf396('0x11')][_0xf396('0x12')]({'raw':_0x49a9d3[_0xf396('0x13')]?_0x49a9d3[_0xf396('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x49a9d3[_0xf396('0x13')]?_0x49a9d3['options'][_0xf396('0x14')]||null:null,'attributes':_0x49a9d3[_0xf396('0x13')]?_0x49a9d3['options'][_0xf396('0x15')]||null:null,'limit':_0x49a9d3[_0xf396('0x13')]?_0x49a9d3['options']['limit']||null:null,'include':_0x49a9d3['options']?_0x49a9d3[_0xf396('0x13')]['include']?_[_0xf396('0x16')](_0x49a9d3['options']['include'],function(_0x74c2){return{'model':db[_0x74c2['model']],'as':_0x74c2['as'],'attributes':_0x74c2[_0xf396('0x15')],'include':_0x74c2['include']?_[_0xf396('0x16')](_0x74c2[_0xf396('0x17')],function(_0x15096d){return{'model':db[_0x15096d[_0xf396('0x18')]],'as':_0x15096d['as'],'attributes':_0x15096d[_0xf396('0x15')],'include':_0x15096d[_0xf396('0x17')]?_[_0xf396('0x16')](_0x15096d[_0xf396('0x17')],function(_0xaec6c8){return{'model':db[_0xaec6c8['model']],'as':_0xaec6c8['as'],'attributes':_0xaec6c8[_0xf396('0x15')]};}):[]};}):[]};}):[]:[]})[_0xf396('0x5')](function(_0x3bfb43){logger['info'](_0xf396('0x10'),_0x49a9d3);logger['debug'](_0xf396('0x10'),_0x49a9d3,JSON[_0xf396('0xa')](_0x3bfb43));_0x5d3a46(_0x3bfb43);})[_0xf396('0xf')](function(_0xd428df){logger['error'](_0xf396('0x10'),_0xd428df[_0xf396('0xd')],_0x49a9d3);_0x4348cb(_0x102c61[_0xf396('0xb')](0x1f4,_0xd428df[_0xf396('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f98763f..9893f53 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 _0xcd59=['isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','post','create','clone','addLists','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0xcd59,0x14b));var _0x9cd5=function(_0x4e4e83,_0x2f29a7){_0x4e4e83=_0x4e4e83-0x0;var _0x4cbeb6=_0xcd59[_0x4e4e83];return _0x4cbeb6;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var express=require(_0x9cd5('0x3'));var router=express[_0x9cd5('0x4')]();var auth=require(_0x9cd5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9cd5('0x6'));var controller=require(_0x9cd5('0x7'));router[_0x9cd5('0x8')]('/',auth[_0x9cd5('0x9')](),controller[_0x9cd5('0xa')]);router[_0x9cd5('0x8')](_0x9cd5('0xb'),auth[_0x9cd5('0x9')](),controller[_0x9cd5('0xc')]);router[_0x9cd5('0x8')]('/:id/hoppers',auth[_0x9cd5('0x9')](),controller[_0x9cd5('0xd')]);router[_0x9cd5('0x8')](_0x9cd5('0xe'),auth[_0x9cd5('0x9')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0x8')](_0x9cd5('0x10'),auth['isAuthenticated'](),controller[_0x9cd5('0x11')]);router[_0x9cd5('0x8')](_0x9cd5('0x12'),auth[_0x9cd5('0x9')](),controller['getHopperBlacks']);router['get'](_0x9cd5('0x13'),auth[_0x9cd5('0x9')](),controller[_0x9cd5('0x14')]);router[_0x9cd5('0x8')](_0x9cd5('0x15'),auth[_0x9cd5('0x9')](),controller['getBlackLists']);router[_0x9cd5('0x16')]('/',auth[_0x9cd5('0x9')](),controller[_0x9cd5('0x17')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x9cd5('0x18')]);router[_0x9cd5('0x16')]('/:id/lists',auth[_0x9cd5('0x9')](),controller[_0x9cd5('0x19')]);router[_0x9cd5('0x16')]('/:id/blacklists',auth[_0x9cd5('0x9')](),controller[_0x9cd5('0x1a')]);router[_0x9cd5('0x1b')](_0x9cd5('0xb'),auth[_0x9cd5('0x9')](),controller[_0x9cd5('0x1c')]);router['delete'](_0x9cd5('0xb'),auth[_0x9cd5('0x9')](),controller[_0x9cd5('0x1d')]);router[_0x9cd5('0x1e')](_0x9cd5('0x13'),auth['isAuthenticated'](),controller[_0x9cd5('0x1f')]);router[_0x9cd5('0x1e')](_0x9cd5('0x15'),auth[_0x9cd5('0x9')](),controller[_0x9cd5('0x20')]);module[_0x9cd5('0x21')]=router; \ No newline at end of file +var _0x2eb6=['removeLists','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','put','delete','destroy','/:id/lists'];(function(_0x546c09,_0x289f17){var _0x5e512d=function(_0xc77a41){while(--_0xc77a41){_0x546c09['push'](_0x546c09['shift']());}};_0x5e512d(++_0x289f17);}(_0x2eb6,0x102));var _0x62eb=function(_0x2c4a57,_0x4a297b){_0x2c4a57=_0x2c4a57-0x0;var _0x2417ef=_0x2eb6[_0x2c4a57];return _0x2417ef;};'use strict';var multer=require(_0x62eb('0x0'));var util=require(_0x62eb('0x1'));var path=require(_0x62eb('0x2'));var express=require(_0x62eb('0x3'));var router=express[_0x62eb('0x4')]();var auth=require(_0x62eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x62eb('0x6'));var controller=require(_0x62eb('0x7'));router[_0x62eb('0x8')]('/',auth[_0x62eb('0x9')](),controller[_0x62eb('0xa')]);router[_0x62eb('0x8')](_0x62eb('0xb'),auth[_0x62eb('0x9')](),controller[_0x62eb('0xc')]);router[_0x62eb('0x8')](_0x62eb('0xd'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x62eb('0x8')](_0x62eb('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x62eb('0x8')](_0x62eb('0xf'),auth[_0x62eb('0x9')](),controller['getHopperFinals']);router[_0x62eb('0x8')](_0x62eb('0x10'),auth[_0x62eb('0x9')](),controller[_0x62eb('0x11')]);router[_0x62eb('0x8')]('/:id/lists',auth[_0x62eb('0x9')](),controller[_0x62eb('0x12')]);router[_0x62eb('0x8')](_0x62eb('0x13'),auth[_0x62eb('0x9')](),controller[_0x62eb('0x14')]);router[_0x62eb('0x15')]('/',auth['isAuthenticated'](),controller[_0x62eb('0x16')]);router[_0x62eb('0x15')](_0x62eb('0x17'),auth['isAuthenticated'](),controller[_0x62eb('0x18')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router['post'](_0x62eb('0x13'),auth[_0x62eb('0x9')](),controller[_0x62eb('0x19')]);router[_0x62eb('0x1a')](_0x62eb('0xb'),auth[_0x62eb('0x9')](),controller['update']);router[_0x62eb('0x1b')](_0x62eb('0xb'),auth[_0x62eb('0x9')](),controller[_0x62eb('0x1c')]);router['delete'](_0x62eb('0x1d'),auth['isAuthenticated'](),controller[_0x62eb('0x1e')]);router[_0x62eb('0x1b')](_0x62eb('0x13'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x62eb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 44848e7..2ac266a 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 _0x5fc3=['sequelize','exports','TEXT','STRING'];(function(_0x94b8d2,_0x55b70c){var _0x28b924=function(_0x36fad8){while(--_0x36fad8){_0x94b8d2['push'](_0x94b8d2['shift']());}};_0x28b924(++_0x55b70c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x5fc3[_0x10c51f];return _0x56a0cd;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x35fc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file +var _0xee14=['STRING','TEXT'];(function(_0x255534,_0x30f82f){var _0x4a65eb=function(_0x3fe04b){while(--_0x3fe04b){_0x255534['push'](_0x255534['shift']());}};_0x4a65eb(++_0x30f82f);}(_0xee14,0x13a));var _0x4ee1=function(_0x341e42,_0x1c6efe){_0x341e42=_0x341e42-0x0;var _0x344db5=_0xee14[_0x341e42];return _0x344db5;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4ee1('0x0')]}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5ee30b8..a79c1a5 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 _0x773c=['destroy','error','stack','name','send','CannedAnswer','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','sort','where','pick','filters','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','find','body','params','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then'];(function(_0x264326,_0x37c5e0){var _0x2bb755=function(_0x32093c){while(--_0x32093c){_0x264326['push'](_0x264326['shift']());}};_0x2bb755(++_0x37c5e0);}(_0x773c,0x1e8));var _0xc773=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0x773c[_0x500785];return _0x1f8bcc;};'use strict';var jsonpatch=require(_0xc773('0x0'));var rp=require(_0xc773('0x1'));var moment=require(_0xc773('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc773('0x3'));var path=require(_0xc773('0x4'));var sox=require(_0xc773('0x5'));var csv=require(_0xc773('0x6'));var ejs=require(_0xc773('0x7'));var fs=require('fs');var _=require(_0xc773('0x8'));var squel=require(_0xc773('0x9'));var crypto=require('crypto');var jsforce=require(_0xc773('0xa'));var deskjs=require(_0xc773('0xb'));var toCsv=require(_0xc773('0x6'));var querystring=require('querystring');var Papa=require(_0xc773('0xc'));var qs=require(_0xc773('0xd'));var logger=require(_0xc773('0xe'))('api');var utils=require(_0xc773('0xf'));var config=require(_0xc773('0x10'));var db=require(_0xc773('0x11'))['db'];function respondWithStatusCode(_0x20c4c9,_0x237437){_0x237437=_0x237437||0xcc;return function(_0x41d8e5){if(_0x41d8e5){return _0x20c4c9[_0xc773('0x12')](_0x237437);}return _0x20c4c9[_0xc773('0x13')](_0x237437)[_0xc773('0x14')]();};}function respondWithResult(_0x36fd4b,_0x3c04e4){_0x3c04e4=_0x3c04e4||0xc8;return function(_0x5a8091){if(_0x5a8091){return _0x36fd4b[_0xc773('0x13')](_0x3c04e4)[_0xc773('0x15')](_0x5a8091);}};}function respondWithFilteredResult(_0x2ec984,_0x3a1295){return function(_0x323b4a){if(_0x323b4a){var _0x51ce2e=_0x323b4a[_0xc773('0x16')],_0x3d63d2=_0x3a1295[_0xc773('0x17')],_0xbb1956=_0x3a1295[_0xc773('0x17')]+_0x3a1295[_0xc773('0x18')],_0x5600d8;if(_0xbb1956>=_0x51ce2e){_0xbb1956=_0x51ce2e;_0x5600d8=0xc8;}else{_0x5600d8=0xce;}_0x2ec984[_0xc773('0x13')](_0x5600d8);return _0x2ec984[_0xc773('0x19')]('Content-Range',_0x3d63d2+'-'+_0xbb1956+'/'+_0x51ce2e)['json'](_0x323b4a);}return null;};}function patchUpdates(_0x3a2d23){return function(_0x1e6d0f){try{jsonpatch[_0xc773('0x1a')](_0x1e6d0f,_0x3a2d23,!![]);}catch(_0x3205ac){return BPromise['reject'](_0x3205ac);}return _0x1e6d0f[_0xc773('0x1b')]();};}function saveUpdates(_0x1fde18,_0x537924){return function(_0x3d78c7){if(_0x3d78c7){return _0x3d78c7[_0xc773('0x1c')](_0x1fde18)[_0xc773('0x1d')](function(_0x47df6a){return _0x47df6a;});}return null;};}function removeEntity(_0x2c2fca,_0x2f4d2e){return function(_0xa40c44){if(_0xa40c44){return _0xa40c44[_0xc773('0x1e')]()[_0xc773('0x1d')](function(){_0x2c2fca[_0xc773('0x13')](0xcc)[_0xc773('0x14')]();});}};}function handleEntityNotFound(_0x311b83,_0x2b6b25){return function(_0x29331b){if(!_0x29331b){_0x311b83[_0xc773('0x12')](0x194);}return _0x29331b;};}function handleError(_0x3baaa2,_0x5b64fd){_0x5b64fd=_0x5b64fd||0x1f4;return function(_0x17dc56){logger[_0xc773('0x1f')](_0x17dc56[_0xc773('0x20')]);if(_0x17dc56[_0xc773('0x21')]){delete _0x17dc56['name'];}_0x3baaa2[_0xc773('0x13')](_0x5b64fd)[_0xc773('0x22')](_0x17dc56);};}exports['index']=function(_0x5a1a95,_0x396904){var _0x57ac7c={},_0x1af419={},_0x334d79={'count':0x0,'rows':[]};var _0x37e693=db[_0xc773('0x23')][_0xc773('0x24')];_0x1af419[_0xc773('0x25')]=_[_0xc773('0x26')](_0x37e693);var _0x10ac58={'dateStart':_0x5a1a95[_0xc773('0x27')][_0xc773('0x28')],'dateEnd':_0x5a1a95[_0xc773('0x27')][_0xc773('0x29')]};delete _0x5a1a95[_0xc773('0x27')][_0xc773('0x28')];delete _0x5a1a95[_0xc773('0x27')][_0xc773('0x29')];_0x1af419[_0xc773('0x27')]=_[_0xc773('0x26')](_0x5a1a95[_0xc773('0x27')]);_0x1af419['filters']=_[_0xc773('0x2a')](_0x1af419[_0xc773('0x25')],_0x1af419[_0xc773('0x27')]);_0x57ac7c[_0xc773('0x2b')]=_[_0xc773('0x2a')](_0x1af419[_0xc773('0x25')],qs[_0xc773('0x2c')](_0x5a1a95[_0xc773('0x27')][_0xc773('0x2c')]));_0x57ac7c[_0xc773('0x2b')]=_0x57ac7c['attributes'][_0xc773('0x2d')]?_0x57ac7c[_0xc773('0x2b')]:_0x1af419[_0xc773('0x25')];if(!_0x5a1a95[_0xc773('0x27')]['hasOwnProperty']('nolimit')){_0x57ac7c[_0xc773('0x18')]=qs[_0xc773('0x18')](_0x5a1a95[_0xc773('0x27')][_0xc773('0x18')]);_0x57ac7c[_0xc773('0x17')]=qs[_0xc773('0x17')](_0x5a1a95[_0xc773('0x27')][_0xc773('0x17')]);}_0x57ac7c['order']=qs['sort'](_0x5a1a95['query'][_0xc773('0x2e')]);_0x57ac7c[_0xc773('0x2f')]=qs['filters'](_[_0xc773('0x30')](_0x5a1a95[_0xc773('0x27')],_0x1af419[_0xc773('0x31')]));if(_0x10ac58['dateStart']){if(_0x10ac58[_0xc773('0x29')]){_0x10ac58['dateEnd']=moment(_0x10ac58[_0xc773('0x29')])[_0xc773('0x32')](0x1,_0xc773('0x33'));}else{_0x10ac58[_0xc773('0x29')]=moment(_0x10ac58['dateStart'])['add'](0x1,_0xc773('0x33'));}_[_0xc773('0x34')](_0x57ac7c[_0xc773('0x2f')],{'createdAt':{'$gte':_0x10ac58[_0xc773('0x28')],'$lte':_0x10ac58[_0xc773('0x29')]}});}if(_0x5a1a95[_0xc773('0x27')][_0xc773('0x35')]){_0x57ac7c['where']=_[_0xc773('0x34')](_0x57ac7c['where'],{'$or':_[_0xc773('0x36')](_0x57ac7c[_0xc773('0x2b')],function(_0x58e9fc){var _0x1c3bc9={};_0x1c3bc9[_0x58e9fc]={'$like':'%'+_0x5a1a95[_0xc773('0x27')][_0xc773('0x35')]+'%'};return _0x1c3bc9;})});}_0x57ac7c=_['merge']({},_0x57ac7c,_0x5a1a95[_0xc773('0x37')]);var _0x3f7675={'where':_0x57ac7c[_0xc773('0x2f')]};return db[_0xc773('0x23')][_0xc773('0x16')](_0x3f7675)[_0xc773('0x1d')](function(_0x4c40f5){_0x334d79[_0xc773('0x16')]=_0x4c40f5;if(_0x5a1a95[_0xc773('0x27')][_0xc773('0x38')]){_0x57ac7c[_0xc773('0x39')]=[{'all':!![]}];}return db[_0xc773('0x23')][_0xc773('0x3a')](_0x57ac7c);})['then'](function(_0x45ac42){_0x334d79[_0xc773('0x3b')]=_0x45ac42;return _0x334d79;})[_0xc773('0x1d')](respondWithFilteredResult(_0x396904,_0x57ac7c))[_0xc773('0x3c')](handleError(_0x396904,null));};exports[_0xc773('0x3d')]=function(_0x54ffec,_0x173115){var _0x28ea48={'raw':!![],'where':{'id':_0x54ffec['params']['id']}},_0x292785={};_0x292785[_0xc773('0x25')]=_[_0xc773('0x26')](db[_0xc773('0x23')][_0xc773('0x24')]);_0x292785[_0xc773('0x27')]=_[_0xc773('0x26')](_0x54ffec[_0xc773('0x27')]);_0x292785['filters']=_[_0xc773('0x2a')](_0x292785[_0xc773('0x25')],_0x292785[_0xc773('0x27')]);_0x28ea48[_0xc773('0x2b')]=_[_0xc773('0x2a')](_0x292785['model'],qs[_0xc773('0x2c')](_0x54ffec['query'][_0xc773('0x2c')]));_0x28ea48[_0xc773('0x2b')]=_0x28ea48[_0xc773('0x2b')][_0xc773('0x2d')]?_0x28ea48[_0xc773('0x2b')]:_0x292785['model'];if(_0x54ffec[_0xc773('0x27')][_0xc773('0x38')]){_0x28ea48[_0xc773('0x39')]=[{'all':!![]}];}_0x28ea48=_[_0xc773('0x34')]({},_0x28ea48,_0x54ffec['options']);return db[_0xc773('0x23')][_0xc773('0x3e')](_0x28ea48)[_0xc773('0x1d')](handleEntityNotFound(_0x173115,null))[_0xc773('0x1d')](respondWithResult(_0x173115,null))['catch'](handleError(_0x173115,null));};exports[_0xc773('0x1c')]=function(_0x2f8b0f,_0x224181){if(_0x2f8b0f[_0xc773('0x3f')]['id']){delete _0x2f8b0f['body']['id'];}return db[_0xc773('0x23')][_0xc773('0x3e')]({'where':{'id':_0x2f8b0f[_0xc773('0x40')]['id']}})[_0xc773('0x1d')](handleEntityNotFound(_0x224181,null))['then'](saveUpdates(_0x2f8b0f[_0xc773('0x3f')],null))[_0xc773('0x1d')](respondWithResult(_0x224181,null))['catch'](handleError(_0x224181,null));};exports[_0xc773('0x1e')]=function(_0x4a5e31,_0x56130b){return db[_0xc773('0x23')][_0xc773('0x3e')]({'where':{'id':_0x4a5e31[_0xc773('0x40')]['id']}})['then'](handleEntityNotFound(_0x56130b,null))[_0xc773('0x1d')](removeEntity(_0x56130b,null))[_0xc773('0x3c')](handleError(_0x56130b,null));};exports['create']=function(_0x4b58fe,_0x207af5){var _0x246b3d={'key':_0x4b58fe['body'][_0xc773('0x41')]};if(_0x4b58fe[_0xc773('0x3f')][_0xc773('0x42')]){_0x246b3d[_0xc773('0x42')]=_0x4b58fe[_0xc773('0x3f')][_0xc773('0x42')];}else if(_0x4b58fe[_0xc773('0x3f')][_0xc773('0x43')]){_0x246b3d[_0xc773('0x43')]=_0x4b58fe[_0xc773('0x3f')][_0xc773('0x43')];}else if(_0x4b58fe[_0xc773('0x3f')][_0xc773('0x44')]){_0x246b3d['OpenchannelAccountId']=_0x4b58fe[_0xc773('0x3f')][_0xc773('0x44')];}else if(_0x4b58fe[_0xc773('0x3f')][_0xc773('0x45')]){_0x246b3d[_0xc773('0x45')]=_0x4b58fe[_0xc773('0x3f')][_0xc773('0x45')];}return db[_0xc773('0x23')][_0xc773('0x3e')]({'where':_0x246b3d})['then'](function(_0x1efbea){if(_0x1efbea){throw new db[(_0xc773('0x46'))][(_0xc773('0x47'))](_0xc773('0x48'));}return db['CannedAnswer'][_0xc773('0x49')](_0x4b58fe[_0xc773('0x3f')]);})[_0xc773('0x1d')](respondWithResult(_0x207af5,0xc9))['catch'](handleError(_0x207af5,null));}; \ No newline at end of file +var _0x5cf2=['Content-Range','apply','reject','save','destroy','then','error','send','index','CannedAnswer','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set'];(function(_0x37fece,_0x26f625){var _0x272a43=function(_0x497f49){while(--_0x497f49){_0x37fece['push'](_0x37fece['shift']());}};_0x272a43(++_0x26f625);}(_0x5cf2,0x7d));var _0x25cf=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x5cf2[_0x3074f3];return _0x53f112;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x25cf('0x0'));var moment=require(_0x25cf('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x25cf('0x2'));var util=require(_0x25cf('0x3'));var path=require(_0x25cf('0x4'));var sox=require('sox');var csv=require(_0x25cf('0x5'));var ejs=require(_0x25cf('0x6'));var fs=require('fs');var _=require(_0x25cf('0x7'));var squel=require(_0x25cf('0x8'));var crypto=require(_0x25cf('0x9'));var jsforce=require(_0x25cf('0xa'));var deskjs=require(_0x25cf('0xb'));var toCsv=require(_0x25cf('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x25cf('0xc'));var utils=require(_0x25cf('0xd'));var config=require(_0x25cf('0xe'));var db=require(_0x25cf('0xf'))['db'];function respondWithStatusCode(_0x3856da,_0x38f398){_0x38f398=_0x38f398||0xcc;return function(_0x1ea7db){if(_0x1ea7db){return _0x3856da[_0x25cf('0x10')](_0x38f398);}return _0x3856da[_0x25cf('0x11')](_0x38f398)[_0x25cf('0x12')]();};}function respondWithResult(_0x3cfc13,_0x306557){_0x306557=_0x306557||0xc8;return function(_0x2ba8cc){if(_0x2ba8cc){return _0x3cfc13[_0x25cf('0x11')](_0x306557)['json'](_0x2ba8cc);}};}function respondWithFilteredResult(_0x13fab1,_0x58d70b){return function(_0x2d5f70){if(_0x2d5f70){var _0x1127ce=_0x2d5f70[_0x25cf('0x13')],_0x314752=_0x58d70b[_0x25cf('0x14')],_0x1de84e=_0x58d70b['offset']+_0x58d70b[_0x25cf('0x15')],_0x4f3212;if(_0x1de84e>=_0x1127ce){_0x1de84e=_0x1127ce;_0x4f3212=0xc8;}else{_0x4f3212=0xce;}_0x13fab1[_0x25cf('0x11')](_0x4f3212);return _0x13fab1[_0x25cf('0x16')](_0x25cf('0x17'),_0x314752+'-'+_0x1de84e+'/'+_0x1127ce)['json'](_0x2d5f70);}return null;};}function patchUpdates(_0x485bc5){return function(_0x3d26c8){try{jsonpatch[_0x25cf('0x18')](_0x3d26c8,_0x485bc5,!![]);}catch(_0x312ae4){return BPromise[_0x25cf('0x19')](_0x312ae4);}return _0x3d26c8[_0x25cf('0x1a')]();};}function saveUpdates(_0x33ee5c,_0x375565){return function(_0xc9c3e9){if(_0xc9c3e9){return _0xc9c3e9['update'](_0x33ee5c)['then'](function(_0x372511){return _0x372511;});}return null;};}function removeEntity(_0x49a069,_0x11482a){return function(_0x2ed6f1){if(_0x2ed6f1){return _0x2ed6f1[_0x25cf('0x1b')]()[_0x25cf('0x1c')](function(){_0x49a069[_0x25cf('0x11')](0xcc)[_0x25cf('0x12')]();});}};}function handleEntityNotFound(_0x408151,_0x1b244c){return function(_0x31f9f1){if(!_0x31f9f1){_0x408151[_0x25cf('0x10')](0x194);}return _0x31f9f1;};}function handleError(_0x185c52,_0x5db524){_0x5db524=_0x5db524||0x1f4;return function(_0x3f415e){logger[_0x25cf('0x1d')](_0x3f415e['stack']);if(_0x3f415e['name']){delete _0x3f415e['name'];}_0x185c52[_0x25cf('0x11')](_0x5db524)[_0x25cf('0x1e')](_0x3f415e);};}exports[_0x25cf('0x1f')]=function(_0x304f3c,_0x5f0392){var _0x27e45a={},_0x2033c2={},_0x35a7fa={'count':0x0,'rows':[]};var _0x29a6d9=db[_0x25cf('0x20')][_0x25cf('0x21')];_0x2033c2[_0x25cf('0x22')]=_['keys'](_0x29a6d9);var _0x5b30fc={'dateStart':_0x304f3c[_0x25cf('0x23')]['dateStart'],'dateEnd':_0x304f3c[_0x25cf('0x23')][_0x25cf('0x24')]};delete _0x304f3c[_0x25cf('0x23')][_0x25cf('0x25')];delete _0x304f3c['query'][_0x25cf('0x24')];_0x2033c2[_0x25cf('0x23')]=_[_0x25cf('0x26')](_0x304f3c[_0x25cf('0x23')]);_0x2033c2[_0x25cf('0x27')]=_[_0x25cf('0x28')](_0x2033c2[_0x25cf('0x22')],_0x2033c2[_0x25cf('0x23')]);_0x27e45a['attributes']=_['intersection'](_0x2033c2['model'],qs['fields'](_0x304f3c['query'][_0x25cf('0x29')]));_0x27e45a[_0x25cf('0x2a')]=_0x27e45a[_0x25cf('0x2a')][_0x25cf('0x2b')]?_0x27e45a[_0x25cf('0x2a')]:_0x2033c2['model'];if(!_0x304f3c[_0x25cf('0x23')][_0x25cf('0x2c')](_0x25cf('0x2d'))){_0x27e45a['limit']=qs[_0x25cf('0x15')](_0x304f3c[_0x25cf('0x23')][_0x25cf('0x15')]);_0x27e45a[_0x25cf('0x14')]=qs['offset'](_0x304f3c[_0x25cf('0x23')]['offset']);}_0x27e45a[_0x25cf('0x2e')]=qs['sort'](_0x304f3c[_0x25cf('0x23')][_0x25cf('0x2f')]);_0x27e45a[_0x25cf('0x30')]=qs['filters'](_[_0x25cf('0x31')](_0x304f3c[_0x25cf('0x23')],_0x2033c2[_0x25cf('0x27')]));if(_0x5b30fc[_0x25cf('0x25')]){if(_0x5b30fc['dateEnd']){_0x5b30fc[_0x25cf('0x24')]=moment(_0x5b30fc[_0x25cf('0x24')])[_0x25cf('0x32')](0x1,_0x25cf('0x33'));}else{_0x5b30fc['dateEnd']=moment(_0x5b30fc[_0x25cf('0x25')])[_0x25cf('0x32')](0x1,_0x25cf('0x33'));}_[_0x25cf('0x34')](_0x27e45a[_0x25cf('0x30')],{'createdAt':{'$gte':_0x5b30fc[_0x25cf('0x25')],'$lte':_0x5b30fc['dateEnd']}});}if(_0x304f3c[_0x25cf('0x23')][_0x25cf('0x35')]){_0x27e45a[_0x25cf('0x30')]=_[_0x25cf('0x34')](_0x27e45a[_0x25cf('0x30')],{'$or':_[_0x25cf('0x36')](_0x27e45a['attributes'],function(_0x371924){var _0x386d94={};_0x386d94[_0x371924]={'$like':'%'+_0x304f3c[_0x25cf('0x23')][_0x25cf('0x35')]+'%'};return _0x386d94;})});}_0x27e45a=_[_0x25cf('0x34')]({},_0x27e45a,_0x304f3c[_0x25cf('0x37')]);var _0x2f6dbc={'where':_0x27e45a[_0x25cf('0x30')]};return db['CannedAnswer'][_0x25cf('0x13')](_0x2f6dbc)['then'](function(_0x232035){_0x35a7fa[_0x25cf('0x13')]=_0x232035;if(_0x304f3c[_0x25cf('0x23')][_0x25cf('0x38')]){_0x27e45a[_0x25cf('0x39')]=[{'all':!![]}];}return db['CannedAnswer'][_0x25cf('0x3a')](_0x27e45a);})[_0x25cf('0x1c')](function(_0x101d98){_0x35a7fa[_0x25cf('0x3b')]=_0x101d98;return _0x35a7fa;})[_0x25cf('0x1c')](respondWithFilteredResult(_0x5f0392,_0x27e45a))[_0x25cf('0x3c')](handleError(_0x5f0392,null));};exports[_0x25cf('0x3d')]=function(_0x257dd8,_0x959765){var _0x5a4b05={'raw':!![],'where':{'id':_0x257dd8[_0x25cf('0x3e')]['id']}},_0x9462f3={};_0x9462f3[_0x25cf('0x22')]=_[_0x25cf('0x26')](db[_0x25cf('0x20')][_0x25cf('0x21')]);_0x9462f3[_0x25cf('0x23')]=_[_0x25cf('0x26')](_0x257dd8[_0x25cf('0x23')]);_0x9462f3[_0x25cf('0x27')]=_['intersection'](_0x9462f3[_0x25cf('0x22')],_0x9462f3[_0x25cf('0x23')]);_0x5a4b05['attributes']=_[_0x25cf('0x28')](_0x9462f3['model'],qs[_0x25cf('0x29')](_0x257dd8[_0x25cf('0x23')]['fields']));_0x5a4b05[_0x25cf('0x2a')]=_0x5a4b05[_0x25cf('0x2a')][_0x25cf('0x2b')]?_0x5a4b05[_0x25cf('0x2a')]:_0x9462f3['model'];if(_0x257dd8[_0x25cf('0x23')][_0x25cf('0x38')]){_0x5a4b05['include']=[{'all':!![]}];}_0x5a4b05=_[_0x25cf('0x34')]({},_0x5a4b05,_0x257dd8['options']);return db[_0x25cf('0x20')][_0x25cf('0x3f')](_0x5a4b05)['then'](handleEntityNotFound(_0x959765,null))[_0x25cf('0x1c')](respondWithResult(_0x959765,null))[_0x25cf('0x3c')](handleError(_0x959765,null));};exports[_0x25cf('0x40')]=function(_0x119a0b,_0x453b04){if(_0x119a0b[_0x25cf('0x41')]['id']){delete _0x119a0b[_0x25cf('0x41')]['id'];}return db[_0x25cf('0x20')][_0x25cf('0x3f')]({'where':{'id':_0x119a0b[_0x25cf('0x3e')]['id']}})[_0x25cf('0x1c')](handleEntityNotFound(_0x453b04,null))[_0x25cf('0x1c')](saveUpdates(_0x119a0b[_0x25cf('0x41')],null))['then'](respondWithResult(_0x453b04,null))['catch'](handleError(_0x453b04,null));};exports['destroy']=function(_0x5e371d,_0x297ead){return db[_0x25cf('0x20')][_0x25cf('0x3f')]({'where':{'id':_0x5e371d['params']['id']}})[_0x25cf('0x1c')](handleEntityNotFound(_0x297ead,null))[_0x25cf('0x1c')](removeEntity(_0x297ead,null))[_0x25cf('0x3c')](handleError(_0x297ead,null));};exports['create']=function(_0x58753c,_0x343abb){var _0x5c7f11={'key':_0x58753c[_0x25cf('0x41')][_0x25cf('0x42')]};if(_0x58753c[_0x25cf('0x41')]['MailAccountId']){_0x5c7f11[_0x25cf('0x43')]=_0x58753c[_0x25cf('0x41')]['MailAccountId'];}else if(_0x58753c[_0x25cf('0x41')][_0x25cf('0x44')]){_0x5c7f11['SmsAccountId']=_0x58753c[_0x25cf('0x41')][_0x25cf('0x44')];}else if(_0x58753c['body']['OpenchannelAccountId']){_0x5c7f11[_0x25cf('0x45')]=_0x58753c[_0x25cf('0x41')]['OpenchannelAccountId'];}else if(_0x58753c[_0x25cf('0x41')][_0x25cf('0x46')]){_0x5c7f11[_0x25cf('0x46')]=_0x58753c[_0x25cf('0x41')][_0x25cf('0x46')];}return db['CannedAnswer'][_0x25cf('0x3f')]({'where':_0x5c7f11})['then'](function(_0x29ee42){if(_0x29ee42){throw new db[(_0x25cf('0x47'))]['ValidationError'](_0x25cf('0x48'));}return db[_0x25cf('0x20')][_0x25cf('0x49')](_0x58753c[_0x25cf('0x41')]);})[_0x25cf('0x1c')](respondWithResult(_0x343abb,0xc9))['catch'](handleError(_0x343abb,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 6f2fa7e..9cc7c4c 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 _0x9823=['moment','./cannedAnswer.attributes','exports','tools_canned_answers','lodash','api'];(function(_0x4e3bff,_0x54ca13){var _0x58de8e=function(_0x558cfb){while(--_0x558cfb){_0x4e3bff['push'](_0x4e3bff['shift']());}};_0x58de8e(++_0x54ca13);}(_0x9823,0xd0));var _0x3982=function(_0x5b5199,_0x58a8e5){_0x5b5199=_0x5b5199-0x0;var _0x2f5736=_0x9823[_0x5b5199];return _0x2f5736;};'use strict';var _=require(_0x3982('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3982('0x1'));var moment=require(_0x3982('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x3982('0x3'));module[_0x3982('0x4')]=function(_0x40b94d,_0xcafc7b){return _0x40b94d['define']('CannedAnswer',attributes,{'tableName':_0x3982('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd61e=['moment','bluebird','request-promise','define','CannedAnswer','tools_canned_answers','lodash','util'];(function(_0x19b19c,_0x55118f){var _0x2cf470=function(_0x479e1d){while(--_0x479e1d){_0x19b19c['push'](_0x19b19c['shift']());}};_0x2cf470(++_0x55118f);}(_0xd61e,0xbe));var _0xed61=function(_0x2466e7,_0x444931){_0x2466e7=_0x2466e7-0x0;var _0x507044=_0xd61e[_0x2466e7];return _0x507044;};'use strict';var _=require(_0xed61('0x0'));var util=require(_0xed61('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xed61('0x2'));var BPromise=require(_0xed61('0x3'));var rp=require(_0xed61('0x4'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x2c9768,_0x355d39){return _0x2c9768[_0xed61('0x5')](_0xed61('0x6'),attributes,{'tableName':_0xed61('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 77e233a..9813c8d 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 _0x34e1=['util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x3dc55d,_0xd07e93){var _0x3aa7f3=function(_0x506b46){while(--_0x506b46){_0x3dc55d['push'](_0x3dc55d['shift']());}};_0x3aa7f3(++_0xd07e93);}(_0x34e1,0x17c));var _0x134e=function(_0x3af11f,_0x131f29){_0x3af11f=_0x3af11f-0x0;var _0x5c4801=_0x34e1[_0x3af11f];return _0x5c4801;};'use strict';var _=require('lodash');var util=require(_0x134e('0x0'));var moment=require(_0x134e('0x1'));var BPromise=require(_0x134e('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x134e('0x3'))['db'];var utils=require(_0x134e('0x4'));var logger=require('../../config/logger')(_0x134e('0x5'));var config=require(_0x134e('0x6'));var jayson=require(_0x134e('0x7'));var client=jayson[_0x134e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ecaec,_0x70ba45,_0x3cf03e){return new BPromise(function(_0x3b1e67,_0x5967da){return client['request'](_0x5ecaec,_0x3cf03e)[_0x134e('0x9')](function(_0x30e411){logger[_0x134e('0xa')](_0x134e('0xb'),_0x70ba45,'request\x20sent');logger['debug'](_0x134e('0xc'),_0x70ba45,_0x134e('0xd'),JSON[_0x134e('0xe')](_0x30e411));if(_0x30e411['error']){if(_0x30e411[_0x134e('0xf')]['code']===0x1f4){logger[_0x134e('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x70ba45,_0x30e411[_0x134e('0xf')][_0x134e('0x10')]);return _0x5967da(_0x30e411[_0x134e('0xf')]['message']);}logger[_0x134e('0xf')](_0x134e('0xb'),_0x70ba45,_0x30e411[_0x134e('0xf')][_0x134e('0x10')]);return _0x3b1e67(_0x30e411[_0x134e('0xf')]['message']);}else{logger['info'](_0x134e('0xb'),_0x70ba45,'request\x20sent');_0x3b1e67(_0x30e411[_0x134e('0x11')][_0x134e('0x10')]);}})[_0x134e('0x12')](function(_0x389ac8){logger[_0x134e('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x70ba45,_0x389ac8);_0x5967da(_0x389ac8);});});} \ No newline at end of file +var _0xb899=['CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xb899,0x1bc));var _0x9b89=function(_0xf270f6,_0x4c671a){_0xf270f6=_0xf270f6-0x0;var _0x2303a3=_0xb899[_0xf270f6];return _0x2303a3;};'use strict';var _=require(_0x9b89('0x0'));var util=require(_0x9b89('0x1'));var moment=require(_0x9b89('0x2'));var BPromise=require(_0x9b89('0x3'));var rs=require(_0x9b89('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x9b89('0x5'));var logger=require(_0x9b89('0x6'))(_0x9b89('0x7'));var config=require(_0x9b89('0x8'));var jayson=require(_0x9b89('0x9'));var client=jayson[_0x9b89('0xa')][_0x9b89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbee177,_0x430b23,_0x985f22){return new BPromise(function(_0x2b3bad,_0x5baf97){return client[_0x9b89('0xc')](_0xbee177,_0x985f22)[_0x9b89('0xd')](function(_0x3fe446){logger[_0x9b89('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x430b23,_0x9b89('0xf'));logger['debug'](_0x9b89('0x10'),_0x430b23,_0x9b89('0xf'),JSON['stringify'](_0x3fe446));if(_0x3fe446['error']){if(_0x3fe446[_0x9b89('0x11')][_0x9b89('0x12')]===0x1f4){logger[_0x9b89('0x11')](_0x9b89('0x13'),_0x430b23,_0x3fe446[_0x9b89('0x11')][_0x9b89('0x14')]);return _0x5baf97(_0x3fe446['error'][_0x9b89('0x14')]);}logger[_0x9b89('0x11')](_0x9b89('0x13'),_0x430b23,_0x3fe446['error']['message']);return _0x2b3bad(_0x3fe446[_0x9b89('0x11')][_0x9b89('0x14')]);}else{logger['info'](_0x9b89('0x13'),_0x430b23,_0x9b89('0xf'));_0x2b3bad(_0x3fe446[_0x9b89('0x15')][_0x9b89('0x14')]);}})[_0x9b89('0x16')](function(_0x48c68a){logger[_0x9b89('0x11')](_0x9b89('0x13'),_0x430b23,_0x48c68a);_0x5baf97(_0x48c68a);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 68ea350..f4f72b6 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 _0x2044=['express','Router','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x1f1cfa,_0x4f92a0){var _0x21e05a=function(_0x408c31){while(--_0x408c31){_0x1f1cfa['push'](_0x1f1cfa['shift']());}};_0x21e05a(++_0x4f92a0);}(_0x2044,0x10c));var _0x4204=function(_0x37bb3e,_0x295424){_0x37bb3e=_0x37bb3e-0x0;var _0x5331d2=_0x2044[_0x37bb3e];return _0x5331d2;};'use strict';var multer=require(_0x4204('0x0'));var util=require('util');var path=require(_0x4204('0x1'));var express=require(_0x4204('0x2'));var router=express[_0x4204('0x3')]();var auth=require(_0x4204('0x4'));var interaction=require(_0x4204('0x5'));var config=require('../../config/environment');var controller=require(_0x4204('0x6'));router[_0x4204('0x7')]('/',auth[_0x4204('0x8')](),controller[_0x4204('0x9')]);router['get'](_0x4204('0xa'),auth['isAuthenticated'](),controller[_0x4204('0xb')]);router[_0x4204('0xc')]('/',auth[_0x4204('0x8')](),controller[_0x4204('0xd')]);router[_0x4204('0xe')](_0x4204('0xa'),auth[_0x4204('0x8')](),controller[_0x4204('0xf')]);router['delete'](_0x4204('0xa'),auth[_0x4204('0x8')](),controller[_0x4204('0x10')]);module[_0x4204('0x11')]=router; \ No newline at end of file +var _0x3e6f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','put','delete','destroy','multer','util','path'];(function(_0x3b8211,_0x536d0a){var _0x5169b4=function(_0x4be2c2){while(--_0x4be2c2){_0x3b8211['push'](_0x3b8211['shift']());}};_0x5169b4(++_0x536d0a);}(_0x3e6f,0x85));var _0xf3e6=function(_0x3d67db,_0x311097){_0x3d67db=_0x3d67db-0x0;var _0x2ad253=_0x3e6f[_0x3d67db];return _0x2ad253;};'use strict';var multer=require(_0xf3e6('0x0'));var util=require(_0xf3e6('0x1'));var path=require(_0xf3e6('0x2'));var express=require(_0xf3e6('0x3'));var router=express[_0xf3e6('0x4')]();var auth=require(_0xf3e6('0x5'));var interaction=require(_0xf3e6('0x6'));var config=require(_0xf3e6('0x7'));var controller=require(_0xf3e6('0x8'));router[_0xf3e6('0x9')]('/',auth[_0xf3e6('0xa')](),controller[_0xf3e6('0xb')]);router[_0xf3e6('0x9')](_0xf3e6('0xc'),auth[_0xf3e6('0xa')](),controller['show']);router[_0xf3e6('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf3e6('0xe')](_0xf3e6('0xc'),auth[_0xf3e6('0xa')](),controller['update']);router[_0xf3e6('0xf')]('/:id',auth[_0xf3e6('0xa')](),controller[_0xf3e6('0x10')]);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 ebc34d4..636d1f0 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 _0xd1cd=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x20df68,_0x1b170b){var _0x1bca9d=function(_0x257f10){while(--_0x257f10){_0x20df68['push'](_0x20df68['shift']());}};_0x1bca9d(++_0x1b170b);}(_0xd1cd,0x120));var _0xdd1c=function(_0x23cdec,_0x4fe0df){_0x23cdec=_0x23cdec-0x0;var _0x1c425d=_0xd1cd[_0x23cdec];return _0x1c425d;};'use strict';var Sequelize=require(_0xdd1c('0x0'));module[_0xdd1c('0x1')]={'calldate':{'type':Sequelize[_0xdd1c('0x2')],'allowNull':![],'defaultValue':_0xdd1c('0x3')},'clid':{'type':Sequelize[_0xdd1c('0x4')]},'src':{'type':Sequelize[_0xdd1c('0x4')]},'dst':{'type':Sequelize[_0xdd1c('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xdd1c('0x4')]},'lastapp':{'type':Sequelize[_0xdd1c('0x4')]},'lastdata':{'type':Sequelize[_0xdd1c('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdd1c('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xdd1c('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xdd1c('0x4')]},'sequence':{'type':Sequelize[_0xdd1c('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xdd1c('0x4')]}}; \ No newline at end of file +var _0xc5a8=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x4d1f10,_0x505a29){var _0x595d3f=function(_0x20fc90){while(--_0x20fc90){_0x4d1f10['push'](_0x4d1f10['shift']());}};_0x595d3f(++_0x505a29);}(_0xc5a8,0xf4));var _0x8c5a=function(_0x569049,_0x5d1c4f){_0x569049=_0x569049-0x0;var _0x3c6bed=_0xc5a8[_0x569049];return _0x3c6bed;};'use strict';var Sequelize=require(_0x8c5a('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x8c5a('0x1')],'allowNull':![],'defaultValue':_0x8c5a('0x2')},'clid':{'type':Sequelize[_0x8c5a('0x3')]},'src':{'type':Sequelize[_0x8c5a('0x3')]},'dst':{'type':Sequelize[_0x8c5a('0x3')]},'dcontext':{'type':Sequelize[_0x8c5a('0x3')]},'channel':{'type':Sequelize[_0x8c5a('0x3')]},'dstchannel':{'type':Sequelize[_0x8c5a('0x3')]},'lastapp':{'type':Sequelize[_0x8c5a('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x8c5a('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8c5a('0x3')]},'userfield':{'type':Sequelize[_0x8c5a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x8c5a('0x3')]},'type':{'type':Sequelize[_0x8c5a('0x3')]},'tag':{'type':Sequelize[_0x8c5a('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 20397b4..dc8825d 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 _0x1328=['rawAttributes','keys','dateStart','query','dateEnd','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','add','day','map','filter','merge','options','Cdr','includeAll','include','findAll','catch','show','params','create','body','update','find','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','then','destroy','error','stack','index'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x1328,0x1a6));var _0x8132=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x1328[_0x6a0266];return _0x309e00;};'use strict';var jsonpatch=require(_0x8132('0x0'));var rp=require('request-promise');var moment=require(_0x8132('0x1'));var BPromise=require(_0x8132('0x2'));var Mustache=require(_0x8132('0x3'));var util=require('util');var path=require(_0x8132('0x4'));var sox=require(_0x8132('0x5'));var csv=require(_0x8132('0x6'));var ejs=require(_0x8132('0x7'));var fs=require('fs');var _=require(_0x8132('0x8'));var squel=require(_0x8132('0x9'));var crypto=require('crypto');var jsforce=require(_0x8132('0xa'));var deskjs=require(_0x8132('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8132('0xc'));var Papa=require(_0x8132('0xd'));var qs=require(_0x8132('0xe'));var logger=require(_0x8132('0xf'))('api');var utils=require(_0x8132('0x10'));var config=require(_0x8132('0x11'));var db=require(_0x8132('0x12'))['db'];function respondWithStatusCode(_0x34129b,_0x498783){_0x498783=_0x498783||0xcc;return function(_0x494953){if(_0x494953){return _0x34129b[_0x8132('0x13')](_0x498783);}return _0x34129b[_0x8132('0x14')](_0x498783)[_0x8132('0x15')]();};}function respondWithResult(_0x1b1cbe,_0x21dd9b){_0x21dd9b=_0x21dd9b||0xc8;return function(_0x32f1ae){if(_0x32f1ae){return _0x1b1cbe[_0x8132('0x14')](_0x21dd9b)['json'](_0x32f1ae);}};}function respondWithFilteredResult(_0xb27fcc,_0xedbbf){return function(_0x505940){if(_0x505940){var _0x1478b6=_0x505940[_0x8132('0x16')],_0x4919e0=_0xedbbf[_0x8132('0x17')],_0x558127=_0xedbbf[_0x8132('0x17')]+_0xedbbf[_0x8132('0x18')],_0x123387;if(_0x558127>=_0x1478b6){_0x558127=_0x1478b6;_0x123387=0xc8;}else{_0x123387=0xce;}_0xb27fcc[_0x8132('0x14')](_0x123387);return _0xb27fcc[_0x8132('0x19')](_0x8132('0x1a'),_0x4919e0+'-'+_0x558127+'/'+_0x1478b6)[_0x8132('0x1b')](_0x505940);}return null;};}function patchUpdates(_0x132346){return function(_0x42f524){try{jsonpatch['apply'](_0x42f524,_0x132346,!![]);}catch(_0x1f2436){return BPromise['reject'](_0x1f2436);}return _0x42f524['save']();};}function saveUpdates(_0x34c5d7,_0x68ed4f){return function(_0xdd75c5){if(_0xdd75c5){return _0xdd75c5['update'](_0x34c5d7)[_0x8132('0x1c')](function(_0x146d62){return _0x146d62;});}return null;};}function removeEntity(_0x49fc3a,_0x53a38f){return function(_0x2b0b8a){if(_0x2b0b8a){return _0x2b0b8a[_0x8132('0x1d')]()[_0x8132('0x1c')](function(){_0x49fc3a[_0x8132('0x14')](0xcc)[_0x8132('0x15')]();});}};}function handleEntityNotFound(_0x30fb3f,_0xc1c52a){return function(_0x43d162){if(!_0x43d162){_0x30fb3f[_0x8132('0x13')](0x194);}return _0x43d162;};}function handleError(_0x4a3e8f,_0x3998a7){_0x3998a7=_0x3998a7||0x1f4;return function(_0x1569b0){logger[_0x8132('0x1e')](_0x1569b0[_0x8132('0x1f')]);if(_0x1569b0['name']){delete _0x1569b0['name'];}_0x4a3e8f[_0x8132('0x14')](_0x3998a7)['send'](_0x1569b0);};}exports[_0x8132('0x20')]=function(_0x34757e,_0x25ff73){var _0x1d335d={},_0x26f402={},_0x43a1bb={'count':0x0,'rows':[]};var _0x3f346e=db['Cdr'][_0x8132('0x21')];_0x26f402['model']=_[_0x8132('0x22')](_0x3f346e);var _0x27f34e={'dateStart':_0x34757e['query'][_0x8132('0x23')],'dateEnd':_0x34757e[_0x8132('0x24')][_0x8132('0x25')]};delete _0x34757e['query']['dateStart'];delete _0x34757e[_0x8132('0x24')][_0x8132('0x25')];_0x26f402[_0x8132('0x24')]=_['keys'](_0x34757e[_0x8132('0x24')]);_0x26f402[_0x8132('0x26')]=_[_0x8132('0x27')](_0x26f402[_0x8132('0x28')],_0x26f402[_0x8132('0x24')]);_0x1d335d[_0x8132('0x29')]=_[_0x8132('0x27')](_0x26f402['model'],qs['fields'](_0x34757e['query']['fields']));_0x1d335d['attributes']=_0x1d335d[_0x8132('0x29')][_0x8132('0x2a')]?_0x1d335d[_0x8132('0x29')]:_0x26f402['model'];if(!_0x34757e[_0x8132('0x24')][_0x8132('0x2b')]('nolimit')){_0x1d335d[_0x8132('0x18')]=qs[_0x8132('0x18')](_0x34757e['query'][_0x8132('0x18')]);_0x1d335d[_0x8132('0x17')]=qs[_0x8132('0x17')](_0x34757e[_0x8132('0x24')]['offset']);}_0x1d335d[_0x8132('0x2c')]=qs['sort'](_0x34757e[_0x8132('0x24')][_0x8132('0x2d')]);_0x1d335d[_0x8132('0x2e')]=qs[_0x8132('0x26')](_[_0x8132('0x2f')](_0x34757e[_0x8132('0x24')],_0x26f402[_0x8132('0x26')]));if(_0x27f34e[_0x8132('0x23')]){if(_0x27f34e[_0x8132('0x25')]){_0x27f34e[_0x8132('0x25')]=moment(_0x27f34e[_0x8132('0x25')])[_0x8132('0x30')](0x1,_0x8132('0x31'));}else{_0x27f34e['dateEnd']=moment(_0x27f34e[_0x8132('0x23')])[_0x8132('0x30')](0x1,'day');}_['merge'](_0x1d335d['where'],{'createdAt':{'$gte':_0x27f34e['dateStart'],'$lte':_0x27f34e['dateEnd']}});}if(_0x34757e[_0x8132('0x24')]['filter']){_0x1d335d['where']=_['merge'](_0x1d335d[_0x8132('0x2e')],{'$or':_[_0x8132('0x32')](_0x1d335d[_0x8132('0x29')],function(_0x308198){var _0x598315={};_0x598315[_0x308198]={'$like':'%'+_0x34757e[_0x8132('0x24')][_0x8132('0x33')]+'%'};return _0x598315;})});}_0x1d335d=_[_0x8132('0x34')]({},_0x1d335d,_0x34757e[_0x8132('0x35')]);var _0xaeaf4e={'where':_0x1d335d[_0x8132('0x2e')]};return db[_0x8132('0x36')][_0x8132('0x16')](_0xaeaf4e)[_0x8132('0x1c')](function(_0x3e1457){_0x43a1bb[_0x8132('0x16')]=_0x3e1457;if(_0x34757e[_0x8132('0x24')][_0x8132('0x37')]){_0x1d335d[_0x8132('0x38')]=[{'all':!![]}];}return db[_0x8132('0x36')][_0x8132('0x39')](_0x1d335d);})[_0x8132('0x1c')](function(_0x3b548c){_0x43a1bb['rows']=_0x3b548c;return _0x43a1bb;})[_0x8132('0x1c')](respondWithFilteredResult(_0x25ff73,_0x1d335d))[_0x8132('0x3a')](handleError(_0x25ff73,null));};exports[_0x8132('0x3b')]=function(_0x1eb04f,_0x3dd3d9){var _0x4ffc28={'raw':!![],'where':{'id':_0x1eb04f[_0x8132('0x3c')]['id']}},_0x4ee9c5={};_0x4ee9c5['model']=_[_0x8132('0x22')](db[_0x8132('0x36')][_0x8132('0x21')]);_0x4ee9c5['query']=_[_0x8132('0x22')](_0x1eb04f[_0x8132('0x24')]);_0x4ee9c5[_0x8132('0x26')]=_[_0x8132('0x27')](_0x4ee9c5[_0x8132('0x28')],_0x4ee9c5[_0x8132('0x24')]);_0x4ffc28['attributes']=_[_0x8132('0x27')](_0x4ee9c5[_0x8132('0x28')],qs['fields'](_0x1eb04f[_0x8132('0x24')]['fields']));_0x4ffc28[_0x8132('0x29')]=_0x4ffc28[_0x8132('0x29')][_0x8132('0x2a')]?_0x4ffc28[_0x8132('0x29')]:_0x4ee9c5[_0x8132('0x28')];if(_0x1eb04f[_0x8132('0x24')][_0x8132('0x37')]){_0x4ffc28[_0x8132('0x38')]=[{'all':!![]}];}_0x4ffc28=_[_0x8132('0x34')]({},_0x4ffc28,_0x1eb04f['options']);return db[_0x8132('0x36')]['find'](_0x4ffc28)[_0x8132('0x1c')](handleEntityNotFound(_0x3dd3d9,null))[_0x8132('0x1c')](respondWithResult(_0x3dd3d9,null))[_0x8132('0x3a')](handleError(_0x3dd3d9,null));};exports[_0x8132('0x3d')]=function(_0x25d772,_0x27ff1e){return db[_0x8132('0x36')][_0x8132('0x3d')](_0x25d772[_0x8132('0x3e')],{})[_0x8132('0x1c')](respondWithResult(_0x27ff1e,0xc9))[_0x8132('0x3a')](handleError(_0x27ff1e,null));};exports[_0x8132('0x3f')]=function(_0x2c8ef8,_0xe00053){if(_0x2c8ef8[_0x8132('0x3e')]['id']){delete _0x2c8ef8[_0x8132('0x3e')]['id'];}return db['Cdr']['find']({'where':{'id':_0x2c8ef8['params']['id']}})[_0x8132('0x1c')](handleEntityNotFound(_0xe00053,null))['then'](saveUpdates(_0x2c8ef8[_0x8132('0x3e')],null))['then'](respondWithResult(_0xe00053,null))[_0x8132('0x3a')](handleError(_0xe00053,null));};exports[_0x8132('0x1d')]=function(_0x567f66,_0x1a8cab){return db[_0x8132('0x36')][_0x8132('0x40')]({'where':{'id':_0x567f66[_0x8132('0x3c')]['id']}})[_0x8132('0x1c')](handleEntityNotFound(_0x1a8cab,null))[_0x8132('0x1c')](removeEntity(_0x1a8cab,null))[_0x8132('0x3a')](handleError(_0x1a8cab,null));}; \ No newline at end of file +var _0x0ce8=['include','rows','show','catch','create','body','find','params','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','Cdr','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','filter','map','options','includeAll'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x0ce8,0x120));var _0x80ce=function(_0x208d71,_0x4669cb){_0x208d71=_0x208d71-0x0;var _0x14184b=_0x0ce8[_0x208d71];return _0x14184b;};'use strict';var jsonpatch=require(_0x80ce('0x0'));var rp=require(_0x80ce('0x1'));var moment=require(_0x80ce('0x2'));var BPromise=require(_0x80ce('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x80ce('0x4'));var sox=require(_0x80ce('0x5'));var csv=require(_0x80ce('0x6'));var ejs=require(_0x80ce('0x7'));var fs=require('fs');var _=require(_0x80ce('0x8'));var squel=require('squel');var crypto=require(_0x80ce('0x9'));var jsforce=require(_0x80ce('0xa'));var deskjs=require(_0x80ce('0xb'));var toCsv=require(_0x80ce('0x6'));var querystring=require('querystring');var Papa=require(_0x80ce('0xc'));var qs=require(_0x80ce('0xd'));var logger=require(_0x80ce('0xe'))(_0x80ce('0xf'));var utils=require(_0x80ce('0x10'));var config=require(_0x80ce('0x11'));var db=require(_0x80ce('0x12'))['db'];function respondWithStatusCode(_0x2f2a8d,_0x39248b){_0x39248b=_0x39248b||0xcc;return function(_0xa885ac){if(_0xa885ac){return _0x2f2a8d['sendStatus'](_0x39248b);}return _0x2f2a8d[_0x80ce('0x13')](_0x39248b)[_0x80ce('0x14')]();};}function respondWithResult(_0x87696e,_0x5d9744){_0x5d9744=_0x5d9744||0xc8;return function(_0x371350){if(_0x371350){return _0x87696e[_0x80ce('0x13')](_0x5d9744)[_0x80ce('0x15')](_0x371350);}};}function respondWithFilteredResult(_0x2884df,_0xe714c6){return function(_0x136fda){if(_0x136fda){var _0x13d10c=_0x136fda[_0x80ce('0x16')],_0xd07aa7=_0xe714c6['offset'],_0x597455=_0xe714c6[_0x80ce('0x17')]+_0xe714c6[_0x80ce('0x18')],_0x58527b;if(_0x597455>=_0x13d10c){_0x597455=_0x13d10c;_0x58527b=0xc8;}else{_0x58527b=0xce;}_0x2884df[_0x80ce('0x13')](_0x58527b);return _0x2884df[_0x80ce('0x19')](_0x80ce('0x1a'),_0xd07aa7+'-'+_0x597455+'/'+_0x13d10c)[_0x80ce('0x15')](_0x136fda);}return null;};}function patchUpdates(_0x53e54d){return function(_0x178349){try{jsonpatch[_0x80ce('0x1b')](_0x178349,_0x53e54d,!![]);}catch(_0x296352){return BPromise['reject'](_0x296352);}return _0x178349[_0x80ce('0x1c')]();};}function saveUpdates(_0x18b68f,_0x55d185){return function(_0x591210){if(_0x591210){return _0x591210[_0x80ce('0x1d')](_0x18b68f)[_0x80ce('0x1e')](function(_0x18d0ac){return _0x18d0ac;});}return null;};}function removeEntity(_0x1d9948,_0x305305){return function(_0x269515){if(_0x269515){return _0x269515[_0x80ce('0x1f')]()[_0x80ce('0x1e')](function(){_0x1d9948[_0x80ce('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6aac,_0x4e8a66){return function(_0x2f1fdc){if(!_0x2f1fdc){_0x3c6aac[_0x80ce('0x20')](0x194);}return _0x2f1fdc;};}function handleError(_0x3a592e,_0x455aa){_0x455aa=_0x455aa||0x1f4;return function(_0x57b269){logger[_0x80ce('0x21')](_0x57b269[_0x80ce('0x22')]);if(_0x57b269[_0x80ce('0x23')]){delete _0x57b269[_0x80ce('0x23')];}_0x3a592e[_0x80ce('0x13')](_0x455aa)['send'](_0x57b269);};}exports[_0x80ce('0x24')]=function(_0x5f1f60,_0x2c0f16){var _0x597227={},_0x372eb4={},_0x4cdd84={'count':0x0,'rows':[]};var _0x501018=db[_0x80ce('0x25')][_0x80ce('0x26')];_0x372eb4[_0x80ce('0x27')]=_[_0x80ce('0x28')](_0x501018);var _0x37b5da={'dateStart':_0x5f1f60[_0x80ce('0x29')][_0x80ce('0x2a')],'dateEnd':_0x5f1f60[_0x80ce('0x29')][_0x80ce('0x2b')]};delete _0x5f1f60[_0x80ce('0x29')]['dateStart'];delete _0x5f1f60[_0x80ce('0x29')]['dateEnd'];_0x372eb4[_0x80ce('0x29')]=_[_0x80ce('0x28')](_0x5f1f60[_0x80ce('0x29')]);_0x372eb4[_0x80ce('0x2c')]=_[_0x80ce('0x2d')](_0x372eb4[_0x80ce('0x27')],_0x372eb4['query']);_0x597227[_0x80ce('0x2e')]=_[_0x80ce('0x2d')](_0x372eb4[_0x80ce('0x27')],qs[_0x80ce('0x2f')](_0x5f1f60[_0x80ce('0x29')]['fields']));_0x597227['attributes']=_0x597227[_0x80ce('0x2e')][_0x80ce('0x30')]?_0x597227[_0x80ce('0x2e')]:_0x372eb4['model'];if(!_0x5f1f60[_0x80ce('0x29')][_0x80ce('0x31')](_0x80ce('0x32'))){_0x597227[_0x80ce('0x18')]=qs[_0x80ce('0x18')](_0x5f1f60[_0x80ce('0x29')][_0x80ce('0x18')]);_0x597227[_0x80ce('0x17')]=qs['offset'](_0x5f1f60[_0x80ce('0x29')][_0x80ce('0x17')]);}_0x597227[_0x80ce('0x33')]=qs[_0x80ce('0x34')](_0x5f1f60[_0x80ce('0x29')][_0x80ce('0x34')]);_0x597227[_0x80ce('0x35')]=qs[_0x80ce('0x2c')](_[_0x80ce('0x36')](_0x5f1f60[_0x80ce('0x29')],_0x372eb4[_0x80ce('0x2c')]));if(_0x37b5da[_0x80ce('0x2a')]){if(_0x37b5da[_0x80ce('0x2b')]){_0x37b5da['dateEnd']=moment(_0x37b5da[_0x80ce('0x2b')])['add'](0x1,_0x80ce('0x37'));}else{_0x37b5da[_0x80ce('0x2b')]=moment(_0x37b5da['dateStart'])[_0x80ce('0x38')](0x1,_0x80ce('0x37'));}_[_0x80ce('0x39')](_0x597227[_0x80ce('0x35')],{'createdAt':{'$gte':_0x37b5da['dateStart'],'$lte':_0x37b5da['dateEnd']}});}if(_0x5f1f60[_0x80ce('0x29')][_0x80ce('0x3a')]){_0x597227[_0x80ce('0x35')]=_['merge'](_0x597227[_0x80ce('0x35')],{'$or':_[_0x80ce('0x3b')](_0x597227[_0x80ce('0x2e')],function(_0x19befa){var _0x4073d6={};_0x4073d6[_0x19befa]={'$like':'%'+_0x5f1f60[_0x80ce('0x29')][_0x80ce('0x3a')]+'%'};return _0x4073d6;})});}_0x597227=_[_0x80ce('0x39')]({},_0x597227,_0x5f1f60[_0x80ce('0x3c')]);var _0x25b2f5={'where':_0x597227[_0x80ce('0x35')]};return db['Cdr'][_0x80ce('0x16')](_0x25b2f5)[_0x80ce('0x1e')](function(_0x49c07d){_0x4cdd84[_0x80ce('0x16')]=_0x49c07d;if(_0x5f1f60['query'][_0x80ce('0x3d')]){_0x597227[_0x80ce('0x3e')]=[{'all':!![]}];}return db[_0x80ce('0x25')]['findAll'](_0x597227);})[_0x80ce('0x1e')](function(_0x4b9b1a){_0x4cdd84[_0x80ce('0x3f')]=_0x4b9b1a;return _0x4cdd84;})[_0x80ce('0x1e')](respondWithFilteredResult(_0x2c0f16,_0x597227))['catch'](handleError(_0x2c0f16,null));};exports[_0x80ce('0x40')]=function(_0x494841,_0x1e06f8){var _0x48785e={'raw':!![],'where':{'id':_0x494841['params']['id']}},_0x1f8d5b={};_0x1f8d5b[_0x80ce('0x27')]=_['keys'](db[_0x80ce('0x25')][_0x80ce('0x26')]);_0x1f8d5b[_0x80ce('0x29')]=_['keys'](_0x494841[_0x80ce('0x29')]);_0x1f8d5b['filters']=_[_0x80ce('0x2d')](_0x1f8d5b['model'],_0x1f8d5b[_0x80ce('0x29')]);_0x48785e[_0x80ce('0x2e')]=_['intersection'](_0x1f8d5b['model'],qs[_0x80ce('0x2f')](_0x494841[_0x80ce('0x29')]['fields']));_0x48785e[_0x80ce('0x2e')]=_0x48785e[_0x80ce('0x2e')][_0x80ce('0x30')]?_0x48785e[_0x80ce('0x2e')]:_0x1f8d5b[_0x80ce('0x27')];if(_0x494841['query'][_0x80ce('0x3d')]){_0x48785e[_0x80ce('0x3e')]=[{'all':!![]}];}_0x48785e=_[_0x80ce('0x39')]({},_0x48785e,_0x494841[_0x80ce('0x3c')]);return db['Cdr']['find'](_0x48785e)[_0x80ce('0x1e')](handleEntityNotFound(_0x1e06f8,null))[_0x80ce('0x1e')](respondWithResult(_0x1e06f8,null))[_0x80ce('0x41')](handleError(_0x1e06f8,null));};exports[_0x80ce('0x42')]=function(_0x307ecd,_0x45ffd1){return db[_0x80ce('0x25')]['create'](_0x307ecd[_0x80ce('0x43')],{})[_0x80ce('0x1e')](respondWithResult(_0x45ffd1,0xc9))[_0x80ce('0x41')](handleError(_0x45ffd1,null));};exports[_0x80ce('0x1d')]=function(_0x416349,_0x516f1f){if(_0x416349['body']['id']){delete _0x416349[_0x80ce('0x43')]['id'];}return db[_0x80ce('0x25')][_0x80ce('0x44')]({'where':{'id':_0x416349['params']['id']}})['then'](handleEntityNotFound(_0x516f1f,null))[_0x80ce('0x1e')](saveUpdates(_0x416349['body'],null))[_0x80ce('0x1e')](respondWithResult(_0x516f1f,null))[_0x80ce('0x41')](handleError(_0x516f1f,null));};exports[_0x80ce('0x1f')]=function(_0x8f03dc,_0x548264){return db[_0x80ce('0x25')][_0x80ce('0x44')]({'where':{'id':_0x8f03dc[_0x80ce('0x45')]['id']}})[_0x80ce('0x1e')](handleEntityNotFound(_0x548264,null))[_0x80ce('0x1e')](removeEntity(_0x548264,null))['catch'](handleError(_0x548264,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 6577e7b..ac944b1 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 _0x2cc8=['disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','./cdr.attributes','define','Cdr','accountcode','calldate'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x2cc8,0x6d));var _0x82cc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2cc8[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x82cc('0x0'));var logger=require(_0x82cc('0x1'))(_0x82cc('0x2'));var moment=require(_0x82cc('0x3'));var BPromise=require(_0x82cc('0x4'));var rp=require(_0x82cc('0x5'));var attributes=require(_0x82cc('0x6'));module['exports']=function(_0x6a9a29,_0x1484f2){return _0x6a9a29[_0x82cc('0x7')](_0x82cc('0x8'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x82cc('0x9'),'fields':['accountcode']},{'name':'calldate','fields':[_0x82cc('0xa')]},{'name':_0x82cc('0xb'),'fields':[_0x82cc('0xb')]},{'name':_0x82cc('0xc'),'fields':[_0x82cc('0xc')]},{'name':_0x82cc('0xd'),'fields':[_0x82cc('0xd')]},{'name':_0x82cc('0xe'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0x29e7=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./cdr.attributes','exports','define','cdr','accountcode','calldate','disposition','dst','src'];(function(_0x127afe,_0x49fa41){var _0x4334d1=function(_0x526a5c){while(--_0x526a5c){_0x127afe['push'](_0x127afe['shift']());}};_0x4334d1(++_0x49fa41);}(_0x29e7,0x9a));var _0x729e=function(_0x5ccab3,_0x5c7df5){_0x5ccab3=_0x5ccab3-0x0;var _0x8a5eb3=_0x29e7[_0x5ccab3];return _0x8a5eb3;};'use strict';var _=require(_0x729e('0x0'));var util=require(_0x729e('0x1'));var logger=require(_0x729e('0x2'))(_0x729e('0x3'));var moment=require(_0x729e('0x4'));var BPromise=require(_0x729e('0x5'));var rp=require(_0x729e('0x6'));var attributes=require(_0x729e('0x7'));module[_0x729e('0x8')]=function(_0x117b3f,_0x27c507){return _0x117b3f[_0x729e('0x9')]('Cdr',attributes,{'tableName':_0x729e('0xa'),'paranoid':![],'indexes':[{'name':_0x729e('0xb'),'fields':['accountcode']},{'name':_0x729e('0xc'),'fields':[_0x729e('0xc')]},{'name':_0x729e('0xd'),'fields':[_0x729e('0xd')]},{'name':_0x729e('0xe'),'fields':[_0x729e('0xe')]},{'name':_0x729e('0xf'),'fields':[_0x729e('0xf')]},{'name':'uniqueid','fields':[_0x729e('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 5b5a169..48f9e3b 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 _0xcfaa=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','catch'];(function(_0x397c8d,_0xf0a1a4){var _0x1c5b0a=function(_0x4585d8){while(--_0x4585d8){_0x397c8d['push'](_0x397c8d['shift']());}};_0x1c5b0a(++_0xf0a1a4);}(_0xcfaa,0xdc));var _0xacfa=function(_0x34158b,_0x6e54c0){_0x34158b=_0x34158b-0x0;var _0xf70991=_0xcfaa[_0x34158b];return _0xf70991;};'use strict';var _=require(_0xacfa('0x0'));var util=require(_0xacfa('0x1'));var moment=require(_0xacfa('0x2'));var BPromise=require(_0xacfa('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xacfa('0x4'))['db'];var utils=require(_0xacfa('0x5'));var logger=require(_0xacfa('0x6'))('rpc');var config=require(_0xacfa('0x7'));var jayson=require(_0xacfa('0x8'));var client=jayson[_0xacfa('0x9')][_0xacfa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23af05,_0x54ba21,_0x5d33c7){return new BPromise(function(_0x12ba2a,_0x539857){return client['request'](_0x23af05,_0x5d33c7)[_0xacfa('0xb')](function(_0x519d25){logger[_0xacfa('0xc')]('Cdr,\x20%s,\x20%s',_0x54ba21,_0xacfa('0xd'));logger[_0xacfa('0xe')](_0xacfa('0xf'),_0x54ba21,'request\x20sent',JSON[_0xacfa('0x10')](_0x519d25));if(_0x519d25[_0xacfa('0x11')]){if(_0x519d25[_0xacfa('0x11')][_0xacfa('0x12')]===0x1f4){logger[_0xacfa('0x11')](_0xacfa('0x13'),_0x54ba21,_0x519d25[_0xacfa('0x11')]['message']);return _0x539857(_0x519d25[_0xacfa('0x11')][_0xacfa('0x14')]);}logger[_0xacfa('0x11')](_0xacfa('0x13'),_0x54ba21,_0x519d25['error'][_0xacfa('0x14')]);return _0x12ba2a(_0x519d25['error'][_0xacfa('0x14')]);}else{logger[_0xacfa('0xc')](_0xacfa('0x13'),_0x54ba21,_0xacfa('0xd'));_0x12ba2a(_0x519d25['result']['message']);}})[_0xacfa('0x15')](function(_0x29e6ea){logger['error'](_0xacfa('0x13'),_0x54ba21,_0x29e6ea);_0x539857(_0x29e6ea);});});} \ No newline at end of file +var _0x21aa=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x21aa,0x154));var _0xa21a=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x21aa[_0x32f26d];return _0x5d9ddc;};'use strict';var _=require(_0xa21a('0x0'));var util=require('util');var moment=require(_0xa21a('0x1'));var BPromise=require(_0xa21a('0x2'));var rs=require(_0xa21a('0x3'));var fs=require('fs');var db=require(_0xa21a('0x4'))['db'];var utils=require(_0xa21a('0x5'));var logger=require(_0xa21a('0x6'))(_0xa21a('0x7'));var config=require('../../config/environment');var jayson=require(_0xa21a('0x8'));var client=jayson[_0xa21a('0x9')][_0xa21a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e624b,_0x5a763b,_0x19e72a){return new BPromise(function(_0x2766a3,_0x329c08){return client['request'](_0x5e624b,_0x19e72a)['then'](function(_0x5a3ea8){logger['info'](_0xa21a('0xb'),_0x5a763b,_0xa21a('0xc'));logger[_0xa21a('0xd')](_0xa21a('0xe'),_0x5a763b,_0xa21a('0xc'),JSON['stringify'](_0x5a3ea8));if(_0x5a3ea8[_0xa21a('0xf')]){if(_0x5a3ea8[_0xa21a('0xf')][_0xa21a('0x10')]===0x1f4){logger[_0xa21a('0xf')](_0xa21a('0xb'),_0x5a763b,_0x5a3ea8[_0xa21a('0xf')][_0xa21a('0x11')]);return _0x329c08(_0x5a3ea8[_0xa21a('0xf')][_0xa21a('0x11')]);}logger[_0xa21a('0xf')](_0xa21a('0xb'),_0x5a763b,_0x5a3ea8[_0xa21a('0xf')][_0xa21a('0x11')]);return _0x2766a3(_0x5a3ea8[_0xa21a('0xf')]['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x5a763b,_0xa21a('0xc'));_0x2766a3(_0x5a3ea8[_0xa21a('0x12')]['message']);}})['catch'](function(_0x59b79d){logger['error']('Cdr,\x20%s,\x20%s',_0x5a763b,_0x59b79d);_0x329c08(_0x59b79d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b5f14a4..8c197d8 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 _0x834d=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','express'];(function(_0x8ab2d1,_0x64a40b){var _0x6aec97=function(_0x1f7603){while(--_0x1f7603){_0x8ab2d1['push'](_0x8ab2d1['shift']());}};_0x6aec97(++_0x64a40b);}(_0x834d,0x140));var _0xd834=function(_0x55ae8c,_0x1c5cd3){_0x55ae8c=_0x55ae8c-0x0;var _0x48154a=_0x834d[_0x55ae8c];return _0x48154a;};'use strict';var multer=require(_0xd834('0x0'));var util=require(_0xd834('0x1'));var path=require('path');var express=require(_0xd834('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd834('0x3'));var config=require(_0xd834('0x4'));var controller=require(_0xd834('0x5'));router[_0xd834('0x6')]('/',auth['isAuthenticated'](),controller[_0xd834('0x7')]);router[_0xd834('0x6')](_0xd834('0x8'),auth[_0xd834('0x9')](),controller[_0xd834('0xa')]);router[_0xd834('0xb')]('/',auth[_0xd834('0x9')](),controller[_0xd834('0xc')]);router[_0xd834('0xd')](_0xd834('0x8'),auth['isAuthenticated'](),controller[_0xd834('0xe')]);router[_0xd834('0xf')]('/:id',auth[_0xd834('0x9')](),controller[_0xd834('0x10')]);module['exports']=router; \ No newline at end of file +var _0xaa3f=['util','express','Router','../../config/environment','./cdr.controller','isAuthenticated','get','show','post','put','/:id','delete','destroy','exports','multer'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0xaa3f,0x95));var _0xfaa3=function(_0x19a090,_0x41a6ce){_0x19a090=_0x19a090-0x0;var _0x2a25e3=_0xaa3f[_0x19a090];return _0x2a25e3;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require('path');var express=require(_0xfaa3('0x2'));var router=express[_0xfaa3('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfaa3('0x4'));var controller=require(_0xfaa3('0x5'));router['get']('/',auth[_0xfaa3('0x6')](),controller['index']);router[_0xfaa3('0x7')]('/:id',auth[_0xfaa3('0x6')](),controller[_0xfaa3('0x8')]);router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfaa3('0xa')](_0xfaa3('0xb'),auth[_0xfaa3('0x6')](),controller['update']);router[_0xfaa3('0xc')](_0xfaa3('0xb'),auth['isAuthenticated'](),controller[_0xfaa3('0xd')]);module[_0xfaa3('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f21a4e1..e3c68ae 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 _0x2a19=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x2a19,0x14a));var _0x92a1=function(_0x1d917c,_0x4b4425){_0x1d917c=_0x1d917c-0x0;var _0x4a147d=_0x2a19[_0x1d917c];return _0x4a147d;};'use strict';var Sequelize=require(_0x92a1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x92a1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x92a1('0x2')],'allowNull':![],'defaultValue':_0x92a1('0x3')},'appdata':{'type':Sequelize[_0x92a1('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x92a1('0x4')}}; \ No newline at end of file +var _0x9a26=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x3c521f,_0x29c5d1){var _0x97eccc=function(_0x3af9a3){while(--_0x3af9a3){_0x3c521f['push'](_0x3c521f['shift']());}};_0x97eccc(++_0x29c5d1);}(_0x9a26,0xd8));var _0x69a2=function(_0x36b506,_0x5e3e4e){_0x36b506=_0x36b506-0x0;var _0x58a254=_0x9a26[_0x36b506];return _0x58a254;};'use strict';var Sequelize=require(_0x69a2('0x0'));module['exports']={'priority':{'type':Sequelize[_0x69a2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x69a2('0x2')],'allowNull':![],'defaultValue':_0x69a2('0x3')},'appdata':{'type':Sequelize[_0x69a2('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x69a2('0x2')]},'interval':{'type':Sequelize[_0x69a2('0x2')],'defaultValue':_0x69a2('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 24abbec..bc6ca7d 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 _0x6528=['merge','find','body','catch','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../config/logger','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','show','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','includeAll','include'];(function(_0x5cbd1a,_0x3712ea){var _0x37b2bf=function(_0x76075f){while(--_0x76075f){_0x5cbd1a['push'](_0x5cbd1a['shift']());}};_0x37b2bf(++_0x3712ea);}(_0x6528,0x11e));var _0x8652=function(_0x5ddb24,_0x81cab2){_0x5ddb24=_0x5ddb24-0x0;var _0x3578b8=_0x6528[_0x5ddb24];return _0x3578b8;};'use strict';var jsonpatch=require(_0x8652('0x0'));var rp=require('request-promise');var moment=require(_0x8652('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8652('0x2'));var util=require(_0x8652('0x3'));var path=require(_0x8652('0x4'));var sox=require('sox');var csv=require(_0x8652('0x5'));var ejs=require(_0x8652('0x6'));var fs=require('fs');var _=require(_0x8652('0x7'));var squel=require('squel');var crypto=require(_0x8652('0x8'));var jsforce=require(_0x8652('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8652('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0x8652('0xb'))('api');var utils=require('../../config/utils');var config=require(_0x8652('0xc'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c3965,_0x1c85a9){_0x1c85a9=_0x1c85a9||0xcc;return function(_0xa1a73e){if(_0xa1a73e){return _0x2c3965[_0x8652('0xd')](_0x1c85a9);}return _0x2c3965[_0x8652('0xe')](_0x1c85a9)['end']();};}function respondWithResult(_0x1e4408,_0x15c945){_0x15c945=_0x15c945||0xc8;return function(_0x10200f){if(_0x10200f){return _0x1e4408[_0x8652('0xe')](_0x15c945)['json'](_0x10200f);}};}function respondWithFilteredResult(_0x361ccc,_0x19fceb){return function(_0x20b6d5){if(_0x20b6d5){var _0x3f1c69=_0x20b6d5[_0x8652('0xf')],_0x5941b1=_0x19fceb[_0x8652('0x10')],_0x1ccb58=_0x19fceb[_0x8652('0x10')]+_0x19fceb[_0x8652('0x11')],_0x314b5c;if(_0x1ccb58>=_0x3f1c69){_0x1ccb58=_0x3f1c69;_0x314b5c=0xc8;}else{_0x314b5c=0xce;}_0x361ccc[_0x8652('0xe')](_0x314b5c);return _0x361ccc[_0x8652('0x12')](_0x8652('0x13'),_0x5941b1+'-'+_0x1ccb58+'/'+_0x3f1c69)[_0x8652('0x14')](_0x20b6d5);}return null;};}function patchUpdates(_0x7c82b){return function(_0x10522c){try{jsonpatch[_0x8652('0x15')](_0x10522c,_0x7c82b,!![]);}catch(_0x4f6365){return BPromise[_0x8652('0x16')](_0x4f6365);}return _0x10522c[_0x8652('0x17')]();};}function saveUpdates(_0x196acb,_0x10b940){return function(_0x3f6069){if(_0x3f6069){return _0x3f6069[_0x8652('0x18')](_0x196acb)['then'](function(_0x25142f){return _0x25142f;});}return null;};}function removeEntity(_0x384f2a,_0x126b70){return function(_0x33ce7c){if(_0x33ce7c){return _0x33ce7c[_0x8652('0x19')]()[_0x8652('0x1a')](function(){_0x384f2a['status'](0xcc)[_0x8652('0x1b')]();});}};}function handleEntityNotFound(_0x1522ee,_0x2a19e4){return function(_0x19104d){if(!_0x19104d){_0x1522ee[_0x8652('0xd')](0x194);}return _0x19104d;};}function handleError(_0x194d7c,_0x3954eb){_0x3954eb=_0x3954eb||0x1f4;return function(_0x188cd2){logger[_0x8652('0x1c')](_0x188cd2[_0x8652('0x1d')]);if(_0x188cd2['name']){delete _0x188cd2['name'];}_0x194d7c[_0x8652('0xe')](_0x3954eb)['send'](_0x188cd2);};}exports[_0x8652('0x1e')]=function(_0x11b49d,_0x16639a){var _0x3a721e={'raw':!![],'where':{'id':_0x11b49d[_0x8652('0x1f')]['id']}},_0xe6795a={};_0xe6795a[_0x8652('0x20')]=_['keys'](db[_0x8652('0x21')][_0x8652('0x22')]);_0xe6795a[_0x8652('0x23')]=_[_0x8652('0x24')](_0x11b49d[_0x8652('0x23')]);_0xe6795a[_0x8652('0x25')]=_[_0x8652('0x26')](_0xe6795a['model'],_0xe6795a[_0x8652('0x23')]);_0x3a721e[_0x8652('0x27')]=_[_0x8652('0x26')](_0xe6795a[_0x8652('0x20')],qs[_0x8652('0x28')](_0x11b49d['query'][_0x8652('0x28')]));_0x3a721e[_0x8652('0x27')]=_0x3a721e['attributes']['length']?_0x3a721e['attributes']:_0xe6795a[_0x8652('0x20')];if(_0x11b49d['query'][_0x8652('0x29')]){_0x3a721e[_0x8652('0x2a')]=[{'all':!![]}];}_0x3a721e=_[_0x8652('0x2b')]({},_0x3a721e,_0x11b49d['options']);return db[_0x8652('0x21')][_0x8652('0x2c')](_0x3a721e)[_0x8652('0x1a')](handleEntityNotFound(_0x16639a,null))[_0x8652('0x1a')](respondWithResult(_0x16639a,null))['catch'](handleError(_0x16639a,null));};exports[_0x8652('0x18')]=function(_0x1ea9da,_0x43d8f7){if(_0x1ea9da[_0x8652('0x2d')]['id']){delete _0x1ea9da['body']['id'];}return db[_0x8652('0x21')][_0x8652('0x2c')]({'where':{'id':_0x1ea9da['params']['id']}})[_0x8652('0x1a')](handleEntityNotFound(_0x43d8f7,null))['then'](saveUpdates(_0x1ea9da[_0x8652('0x2d')],null))[_0x8652('0x1a')](respondWithResult(_0x43d8f7,null))[_0x8652('0x2e')](handleError(_0x43d8f7,null));};exports[_0x8652('0x19')]=function(_0xb93aad,_0x248631){return db[_0x8652('0x21')][_0x8652('0x2c')]({'where':{'id':_0xb93aad[_0x8652('0x1f')]['id']}})[_0x8652('0x1a')](handleEntityNotFound(_0x248631,null))[_0x8652('0x1a')](removeEntity(_0x248631,null))[_0x8652('0x2e')](handleError(_0x248631,null));}; \ No newline at end of file +var _0xe855=['includeAll','include','merge','ChatApplication','body','find','catch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length'];(function(_0x1ad769,_0x457944){var _0x20e717=function(_0x4cad6c){while(--_0x4cad6c){_0x1ad769['push'](_0x1ad769['shift']());}};_0x20e717(++_0x457944);}(_0xe855,0x133));var _0x5e85=function(_0x523db2,_0x12b854){_0x523db2=_0x523db2-0x0;var _0x3efa08=_0xe855[_0x523db2];return _0x3efa08;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x5e85('0x0'));var moment=require(_0x5e85('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x5e85('0x2'));var util=require(_0x5e85('0x3'));var path=require('path');var sox=require(_0x5e85('0x4'));var csv=require(_0x5e85('0x5'));var ejs=require(_0x5e85('0x6'));var fs=require('fs');var _=require(_0x5e85('0x7'));var squel=require(_0x5e85('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5e85('0x9'));var toCsv=require('to-csv');var querystring=require(_0x5e85('0xa'));var Papa=require(_0x5e85('0xb'));var qs=require(_0x5e85('0xc'));var logger=require(_0x5e85('0xd'))(_0x5e85('0xe'));var utils=require(_0x5e85('0xf'));var config=require(_0x5e85('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37d107,_0x2bbf7f){_0x2bbf7f=_0x2bbf7f||0xcc;return function(_0x255820){if(_0x255820){return _0x37d107[_0x5e85('0x11')](_0x2bbf7f);}return _0x37d107[_0x5e85('0x12')](_0x2bbf7f)[_0x5e85('0x13')]();};}function respondWithResult(_0x2b52bc,_0x4405bc){_0x4405bc=_0x4405bc||0xc8;return function(_0x2e9d1b){if(_0x2e9d1b){return _0x2b52bc[_0x5e85('0x12')](_0x4405bc)['json'](_0x2e9d1b);}};}function respondWithFilteredResult(_0x3efa6d,_0x27cc07){return function(_0x5da8bf){if(_0x5da8bf){var _0x1d5104=_0x5da8bf['count'],_0x1e6abb=_0x27cc07['offset'],_0x587cf5=_0x27cc07[_0x5e85('0x14')]+_0x27cc07['limit'],_0x5138e7;if(_0x587cf5>=_0x1d5104){_0x587cf5=_0x1d5104;_0x5138e7=0xc8;}else{_0x5138e7=0xce;}_0x3efa6d[_0x5e85('0x12')](_0x5138e7);return _0x3efa6d[_0x5e85('0x15')](_0x5e85('0x16'),_0x1e6abb+'-'+_0x587cf5+'/'+_0x1d5104)[_0x5e85('0x17')](_0x5da8bf);}return null;};}function patchUpdates(_0xbb221e){return function(_0x2c5503){try{jsonpatch[_0x5e85('0x18')](_0x2c5503,_0xbb221e,!![]);}catch(_0x5da8a3){return BPromise[_0x5e85('0x19')](_0x5da8a3);}return _0x2c5503[_0x5e85('0x1a')]();};}function saveUpdates(_0x481b69,_0x5b4f79){return function(_0x4c7297){if(_0x4c7297){return _0x4c7297[_0x5e85('0x1b')](_0x481b69)[_0x5e85('0x1c')](function(_0x544965){return _0x544965;});}return null;};}function removeEntity(_0x203846,_0x4c3218){return function(_0x4020c2){if(_0x4020c2){return _0x4020c2[_0x5e85('0x1d')]()[_0x5e85('0x1c')](function(){_0x203846['status'](0xcc)[_0x5e85('0x13')]();});}};}function handleEntityNotFound(_0x4ec2b4,_0x30ad0d){return function(_0x592817){if(!_0x592817){_0x4ec2b4[_0x5e85('0x11')](0x194);}return _0x592817;};}function handleError(_0x56ed0b,_0x6da969){_0x6da969=_0x6da969||0x1f4;return function(_0x1cbbf2){logger[_0x5e85('0x1e')](_0x1cbbf2['stack']);if(_0x1cbbf2[_0x5e85('0x1f')]){delete _0x1cbbf2[_0x5e85('0x1f')];}_0x56ed0b[_0x5e85('0x12')](_0x6da969)[_0x5e85('0x20')](_0x1cbbf2);};}exports['show']=function(_0xe9156c,_0x30c1b3){var _0x4c8d82={'raw':!![],'where':{'id':_0xe9156c[_0x5e85('0x21')]['id']}},_0x4ec6d7={};_0x4ec6d7[_0x5e85('0x22')]=_[_0x5e85('0x23')](db['ChatApplication'][_0x5e85('0x24')]);_0x4ec6d7['query']=_['keys'](_0xe9156c[_0x5e85('0x25')]);_0x4ec6d7[_0x5e85('0x26')]=_['intersection'](_0x4ec6d7[_0x5e85('0x22')],_0x4ec6d7[_0x5e85('0x25')]);_0x4c8d82[_0x5e85('0x27')]=_[_0x5e85('0x28')](_0x4ec6d7[_0x5e85('0x22')],qs[_0x5e85('0x29')](_0xe9156c[_0x5e85('0x25')]['fields']));_0x4c8d82[_0x5e85('0x27')]=_0x4c8d82['attributes'][_0x5e85('0x2a')]?_0x4c8d82[_0x5e85('0x27')]:_0x4ec6d7[_0x5e85('0x22')];if(_0xe9156c['query'][_0x5e85('0x2b')]){_0x4c8d82[_0x5e85('0x2c')]=[{'all':!![]}];}_0x4c8d82=_[_0x5e85('0x2d')]({},_0x4c8d82,_0xe9156c['options']);return db[_0x5e85('0x2e')]['find'](_0x4c8d82)['then'](handleEntityNotFound(_0x30c1b3,null))[_0x5e85('0x1c')](respondWithResult(_0x30c1b3,null))['catch'](handleError(_0x30c1b3,null));};exports[_0x5e85('0x1b')]=function(_0x4b0107,_0x236344){if(_0x4b0107['body']['id']){delete _0x4b0107[_0x5e85('0x2f')]['id'];}return db[_0x5e85('0x2e')]['find']({'where':{'id':_0x4b0107[_0x5e85('0x21')]['id']}})[_0x5e85('0x1c')](handleEntityNotFound(_0x236344,null))[_0x5e85('0x1c')](saveUpdates(_0x4b0107['body'],null))[_0x5e85('0x1c')](respondWithResult(_0x236344,null))['catch'](handleError(_0x236344,null));};exports[_0x5e85('0x1d')]=function(_0x27feb9,_0x281b0c){return db['ChatApplication'][_0x5e85('0x30')]({'where':{'id':_0x27feb9[_0x5e85('0x21')]['id']}})['then'](handleEntityNotFound(_0x281b0c,null))[_0x5e85('0x1c')](removeEntity(_0x281b0c,null))[_0x5e85('0x31')](handleError(_0x281b0c,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 52af3fc..fcb6582 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 _0x6f4f=['request-promise','exports','define','chat_applications','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6f4f,0x16c));var _0xf6f4=function(_0x2cdd1c,_0x5f11f7){_0x2cdd1c=_0x2cdd1c-0x0;var _0x2fe37b=_0x6f4f[_0x2cdd1c];return _0x2fe37b;};'use strict';var _=require(_0xf6f4('0x0'));var util=require(_0xf6f4('0x1'));var logger=require(_0xf6f4('0x2'))(_0xf6f4('0x3'));var moment=require(_0xf6f4('0x4'));var BPromise=require(_0xf6f4('0x5'));var rp=require(_0xf6f4('0x6'));var attributes=require('./chatApplication.attributes');module[_0xf6f4('0x7')]=function(_0x87d1ba,_0x4792c5){return _0x87d1ba[_0xf6f4('0x8')]('ChatApplication',attributes,{'tableName':_0xf6f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d2e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatApplication.attributes','define','ChatApplication','chat_applications'];(function(_0x2a2b4,_0xcc17b){var _0x16bec5=function(_0x5d5e08){while(--_0x5d5e08){_0x2a2b4['push'](_0x2a2b4['shift']());}};_0x16bec5(++_0xcc17b);}(_0x9d2e,0x8f));var _0xe9d2=function(_0x83aa1a,_0x54c5cb){_0x83aa1a=_0x83aa1a-0x0;var _0x162dcb=_0x9d2e[_0x83aa1a];return _0x162dcb;};'use strict';var _=require(_0xe9d2('0x0'));var util=require(_0xe9d2('0x1'));var logger=require(_0xe9d2('0x2'))(_0xe9d2('0x3'));var moment=require(_0xe9d2('0x4'));var BPromise=require(_0xe9d2('0x5'));var rp=require(_0xe9d2('0x6'));var attributes=require(_0xe9d2('0x7'));module['exports']=function(_0x40be45,_0x27fb47){return _0x40be45[_0xe9d2('0x8')](_0xe9d2('0x9'),attributes,{'tableName':_0xe9d2('0xa'),'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 7c8cbd6..1e01384 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 _0x8f06=['message','result','catch','lodash','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0x8f06,0xc9));var _0x68f0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8f06[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x68f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x68f0('0x1'))['db'];var utils=require(_0x68f0('0x2'));var logger=require('../../config/logger')(_0x68f0('0x3'));var config=require('../../config/environment');var jayson=require(_0x68f0('0x4'));var client=jayson['client'][_0x68f0('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x19c75f,_0x3166ea,_0x33b720){return new BPromise(function(_0x51748f,_0x1556c9){return client[_0x68f0('0x6')](_0x19c75f,_0x33b720)[_0x68f0('0x7')](function(_0x3d4127){logger[_0x68f0('0x8')](_0x68f0('0x9'),_0x3166ea,_0x68f0('0xa'));logger[_0x68f0('0xb')](_0x68f0('0xc'),_0x3166ea,'request\x20sent',JSON['stringify'](_0x3d4127));if(_0x3d4127[_0x68f0('0xd')]){if(_0x3d4127['error'][_0x68f0('0xe')]===0x1f4){logger[_0x68f0('0xd')]('ChatApplication,\x20%s,\x20%s',_0x3166ea,_0x3d4127[_0x68f0('0xd')][_0x68f0('0xf')]);return _0x1556c9(_0x3d4127['error'][_0x68f0('0xf')]);}logger['error'](_0x68f0('0x9'),_0x3166ea,_0x3d4127[_0x68f0('0xd')][_0x68f0('0xf')]);return _0x51748f(_0x3d4127[_0x68f0('0xd')][_0x68f0('0xf')]);}else{logger[_0x68f0('0x8')](_0x68f0('0x9'),_0x3166ea,_0x68f0('0xa'));_0x51748f(_0x3d4127[_0x68f0('0x10')][_0x68f0('0xf')]);}})[_0x68f0('0x11')](function(_0x25d2c6){logger[_0x68f0('0xd')]('ChatApplication,\x20%s,\x20%s',_0x3166ea,_0x25d2c6);_0x1556c9(_0x25d2c6);});});} \ No newline at end of file +var _0x3017=['client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x31e2cd,_0x4c05ba){var _0x48af4e=function(_0x270bdd){while(--_0x270bdd){_0x31e2cd['push'](_0x31e2cd['shift']());}};_0x48af4e(++_0x4c05ba);}(_0x3017,0x99));var _0x7301=function(_0x8ac26c,_0x5dacb8){_0x8ac26c=_0x8ac26c-0x0;var _0x3d43ae=_0x3017[_0x8ac26c];return _0x3d43ae;};'use strict';var _=require(_0x7301('0x0'));var util=require('util');var moment=require(_0x7301('0x1'));var BPromise=require('bluebird');var rs=require(_0x7301('0x2'));var fs=require('fs');var db=require(_0x7301('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7301('0x4'))(_0x7301('0x5'));var config=require(_0x7301('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7301('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25a648,_0x1ddcf7,_0x435b61){return new BPromise(function(_0x33d53f,_0x1c9104){return client[_0x7301('0x8')](_0x25a648,_0x435b61)[_0x7301('0x9')](function(_0x4d5a9b){logger['info'](_0x7301('0xa'),_0x1ddcf7,_0x7301('0xb'));logger[_0x7301('0xc')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1ddcf7,_0x7301('0xb'),JSON[_0x7301('0xd')](_0x4d5a9b));if(_0x4d5a9b[_0x7301('0xe')]){if(_0x4d5a9b[_0x7301('0xe')][_0x7301('0xf')]===0x1f4){logger[_0x7301('0xe')](_0x7301('0xa'),_0x1ddcf7,_0x4d5a9b['error'][_0x7301('0x10')]);return _0x1c9104(_0x4d5a9b['error']['message']);}logger[_0x7301('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1ddcf7,_0x4d5a9b[_0x7301('0xe')][_0x7301('0x10')]);return _0x33d53f(_0x4d5a9b[_0x7301('0xe')][_0x7301('0x10')]);}else{logger[_0x7301('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1ddcf7,_0x7301('0xb'));_0x33d53f(_0x4d5a9b[_0x7301('0x12')]['message']);}})[_0x7301('0x13')](function(_0xa2648){logger[_0x7301('0xe')](_0x7301('0xa'),_0x1ddcf7,_0xa2648);_0x1c9104(_0xa2648);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 94e2204..fd29449 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 _0x8a73=['path','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x53fc07,_0x4812f0){var _0x1eceb6=function(_0x54475e){while(--_0x54475e){_0x53fc07['push'](_0x53fc07['shift']());}};_0x1eceb6(++_0x4812f0);}(_0x8a73,0x140));var _0x38a7=function(_0x358a16,_0x24a3e0){_0x358a16=_0x358a16-0x0;var _0xd4581d=_0x8a73[_0x358a16];return _0xd4581d;};'use strict';var multer=require(_0x38a7('0x0'));var util=require(_0x38a7('0x1'));var path=require(_0x38a7('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x38a7('0x3'));var config=require(_0x38a7('0x4'));var controller=require('./chatApplication.controller');router[_0x38a7('0x5')]('/:id',auth[_0x38a7('0x6')](),controller[_0x38a7('0x7')]);router[_0x38a7('0x8')](_0x38a7('0x9'),auth[_0x38a7('0x6')](),controller[_0x38a7('0xa')]);router[_0x38a7('0xb')](_0x38a7('0x9'),auth['isAuthenticated'](),controller[_0x38a7('0xc')]);module[_0x38a7('0xd')]=router; \ No newline at end of file +var _0xf708=['destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf708,0x1f1));var _0x8f70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf708[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8f70('0x0'));var util=require('util');var path=require(_0x8f70('0x1'));var express=require(_0x8f70('0x2'));var router=express['Router']();var auth=require(_0x8f70('0x3'));var interaction=require(_0x8f70('0x4'));var config=require(_0x8f70('0x5'));var controller=require(_0x8f70('0x6'));router[_0x8f70('0x7')](_0x8f70('0x8'),auth[_0x8f70('0x9')](),controller[_0x8f70('0xa')]);router[_0x8f70('0xb')](_0x8f70('0x8'),auth['isAuthenticated'](),controller[_0x8f70('0xc')]);router['delete']('/:id',auth[_0x8f70('0x9')](),controller[_0x8f70('0xd')]);module[_0x8f70('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 0cefa08..86d668b 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 _0xc453=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2bab95,_0x15f1a8){var _0x5b31cd=function(_0x1fc7ea){while(--_0x1fc7ea){_0x2bab95['push'](_0x2bab95['shift']());}};_0x5b31cd(++_0x15f1a8);}(_0xc453,0x133));var _0x3c45=function(_0x1e8236,_0x4dc703){_0x1e8236=_0x1e8236-0x0;var _0x2f1c1b=_0xc453[_0x1e8236];return _0x2f1c1b;};'use strict';var Sequelize=require(_0x3c45('0x0'));module[_0x3c45('0x1')]={'name':{'type':Sequelize[_0x3c45('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3c45('0x2')]},'write':{'type':Sequelize[_0x3c45('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaddf=['STRING','BOOLEAN','sequelize'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xaddf,0x65));var _0xfadd=function(_0xde77d3,_0x9c3a89){_0xde77d3=_0xde77d3-0x0;var _0x1fadb3=_0xaddf[_0xde77d3];return _0x1fadb3;};'use strict';var Sequelize=require(_0xfadd('0x0'));module['exports']={'name':{'type':Sequelize[_0xfadd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfadd('0x1')]},'write':{'type':Sequelize[_0xfadd('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index ca24b41..c3a56a4 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 _0x18ff=['../../mysqldb','socket.io-emitter','localhost','./chatGroup.socket','register','jayson/promise','client','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','then','destroy','name','send','index','ChatGroup','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','findAll','rows','show','params','include','find','create','body','update','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','nolimit','removeMembers','ChatInternalMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x18ff,0x1db));var _0xf18f=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x18ff[_0x56482c];return _0x5aae7a;};'use strict';var jsonpatch=require(_0xf18f('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf18f('0x1'));var Mustache=require(_0xf18f('0x2'));var util=require('util');var path=require(_0xf18f('0x3'));var sox=require('sox');var csv=require(_0xf18f('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf18f('0x5'));var squel=require(_0xf18f('0x6'));var crypto=require(_0xf18f('0x7'));var jsforce=require(_0xf18f('0x8'));var deskjs=require(_0xf18f('0x9'));var toCsv=require(_0xf18f('0x4'));var querystring=require(_0xf18f('0xa'));var Papa=require(_0xf18f('0xb'));var qs=require(_0xf18f('0xc'));var logger=require('../../config/logger')(_0xf18f('0xd'));var utils=require(_0xf18f('0xe'));var config=require('../../config/environment');var db=require(_0xf18f('0xf'))['db'];var socket=require(_0xf18f('0x10'))({'host':_0xf18f('0x11'),'port':0x18eb});require(_0xf18f('0x12'))[_0xf18f('0x13')](socket);var jayson=require(_0xf18f('0x14'));var client=jayson[_0xf18f('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195cb6,_0x153c99,_0x38517,_0x36b538){return new BPromise(function(_0x50709d,_0x4a25e0){var _0x5f07be=_0x36b538||client;return _0x5f07be[_0xf18f('0x16')](_0x195cb6,_0x38517)['then'](function(_0x47bcf2){logger[_0xf18f('0x17')](_0xf18f('0x18'),_0x153c99,'request\x20sent');logger[_0xf18f('0x19')](_0xf18f('0x1a'),_0x153c99,_0xf18f('0x1b'),JSON[_0xf18f('0x1c')](_0x47bcf2));if(_0x47bcf2[_0xf18f('0x1d')]){if(_0x47bcf2[_0xf18f('0x1d')][_0xf18f('0x1e')]===0x1f4){logger[_0xf18f('0x1d')](_0xf18f('0x18'),_0x153c99,_0x47bcf2[_0xf18f('0x1d')][_0xf18f('0x1f')]);return _0x4a25e0(_0x47bcf2[_0xf18f('0x1d')][_0xf18f('0x1f')]);}logger[_0xf18f('0x1d')]('ChatGroup,\x20%s,\x20%s',_0x153c99,_0x47bcf2['error'][_0xf18f('0x1f')]);return _0x50709d(_0x47bcf2[_0xf18f('0x1d')]['message']);}else{logger['info'](_0xf18f('0x18'),_0x153c99,'request\x20sent');_0x50709d(_0x47bcf2[_0xf18f('0x20')][_0xf18f('0x1f')]);}})[_0xf18f('0x21')](function(_0x16bb40){logger[_0xf18f('0x1d')](_0xf18f('0x18'),_0x153c99,_0x16bb40);_0x4a25e0(_0x16bb40);});});}function respondWithStatusCode(_0x346a77,_0x1af145){_0x1af145=_0x1af145||0xcc;return function(_0x1e50ac){if(_0x1e50ac){return _0x346a77[_0xf18f('0x22')](_0x1af145);}return _0x346a77[_0xf18f('0x23')](_0x1af145)[_0xf18f('0x24')]();};}function respondWithResult(_0x16418f,_0x5d5aea){_0x5d5aea=_0x5d5aea||0xc8;return function(_0x1f5552){if(_0x1f5552){return _0x16418f[_0xf18f('0x23')](_0x5d5aea)[_0xf18f('0x25')](_0x1f5552);}};}function respondWithFilteredResult(_0x4c3967,_0x5b8ada){return function(_0x5aa900){if(_0x5aa900){var _0x54217c=_0x5aa900[_0xf18f('0x26')],_0x4965fb=_0x5b8ada[_0xf18f('0x27')],_0x9761dd=_0x5b8ada['offset']+_0x5b8ada[_0xf18f('0x28')],_0x29b1f0;if(_0x9761dd>=_0x54217c){_0x9761dd=_0x54217c;_0x29b1f0=0xc8;}else{_0x29b1f0=0xce;}_0x4c3967[_0xf18f('0x23')](_0x29b1f0);return _0x4c3967[_0xf18f('0x29')]('Content-Range',_0x4965fb+'-'+_0x9761dd+'/'+_0x54217c)['json'](_0x5aa900);}return null;};}function patchUpdates(_0x13942a){return function(_0xa8f17f){try{jsonpatch['apply'](_0xa8f17f,_0x13942a,!![]);}catch(_0x38521e){return BPromise[_0xf18f('0x2a')](_0x38521e);}return _0xa8f17f['save']();};}function saveUpdates(_0x29a712,_0x41045b){return function(_0x5097f4){if(_0x5097f4){return _0x5097f4['update'](_0x29a712)[_0xf18f('0x2b')](function(_0x32b1bc){return _0x32b1bc;});}return null;};}function removeEntity(_0x490a34,_0x4b188f){return function(_0x1e2572){if(_0x1e2572){return _0x1e2572[_0xf18f('0x2c')]()[_0xf18f('0x2b')](function(){_0x490a34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x245237,_0x4e78f6){return function(_0x9fc678){if(!_0x9fc678){_0x245237[_0xf18f('0x22')](0x194);}return _0x9fc678;};}function handleError(_0x255874,_0x5c1abf){_0x5c1abf=_0x5c1abf||0x1f4;return function(_0x337aa3){logger['error'](_0x337aa3['stack']);if(_0x337aa3['name']){delete _0x337aa3[_0xf18f('0x2d')];}_0x255874[_0xf18f('0x23')](_0x5c1abf)[_0xf18f('0x2e')](_0x337aa3);};}exports[_0xf18f('0x2f')]=function(_0x4b2603,_0x5802fc){var _0x44a0fc={},_0x3113b3={},_0x1b4f79={'count':0x0,'rows':[]};var _0x223eff=db[_0xf18f('0x30')][_0xf18f('0x31')];_0x3113b3['model']=_[_0xf18f('0x32')](_0x223eff);var _0x217570={'dateStart':_0x4b2603[_0xf18f('0x33')][_0xf18f('0x34')],'dateEnd':_0x4b2603['query'][_0xf18f('0x35')]};delete _0x4b2603['query'][_0xf18f('0x34')];delete _0x4b2603[_0xf18f('0x33')][_0xf18f('0x35')];_0x3113b3[_0xf18f('0x33')]=_[_0xf18f('0x32')](_0x4b2603['query']);_0x3113b3[_0xf18f('0x36')]=_[_0xf18f('0x37')](_0x3113b3[_0xf18f('0x38')],_0x3113b3['query']);_0x44a0fc[_0xf18f('0x39')]=_[_0xf18f('0x37')](_0x3113b3[_0xf18f('0x38')],qs[_0xf18f('0x3a')](_0x4b2603['query']['fields']));_0x44a0fc['attributes']=_0x44a0fc['attributes'][_0xf18f('0x3b')]?_0x44a0fc[_0xf18f('0x39')]:_0x3113b3[_0xf18f('0x38')];if(!_0x4b2603[_0xf18f('0x33')][_0xf18f('0x3c')]('nolimit')){_0x44a0fc[_0xf18f('0x28')]=qs[_0xf18f('0x28')](_0x4b2603[_0xf18f('0x33')][_0xf18f('0x28')]);_0x44a0fc['offset']=qs['offset'](_0x4b2603['query'][_0xf18f('0x27')]);}_0x44a0fc[_0xf18f('0x3d')]=qs['sort'](_0x4b2603[_0xf18f('0x33')][_0xf18f('0x3e')]);_0x44a0fc[_0xf18f('0x3f')]=qs['filters'](_[_0xf18f('0x40')](_0x4b2603['query'],_0x3113b3[_0xf18f('0x36')]));if(_0x217570[_0xf18f('0x34')]){if(_0x217570[_0xf18f('0x35')]){_0x217570[_0xf18f('0x35')]=moment(_0x217570[_0xf18f('0x35')])[_0xf18f('0x41')](0x1,'day');}else{_0x217570['dateEnd']=moment(_0x217570[_0xf18f('0x34')])[_0xf18f('0x41')](0x1,_0xf18f('0x42'));}_[_0xf18f('0x43')](_0x44a0fc[_0xf18f('0x3f')],{'createdAt':{'$gte':_0x217570[_0xf18f('0x34')],'$lte':_0x217570[_0xf18f('0x35')]}});}if(_0x4b2603[_0xf18f('0x33')][_0xf18f('0x44')]){_0x44a0fc[_0xf18f('0x3f')]=_[_0xf18f('0x43')](_0x44a0fc[_0xf18f('0x3f')],{'$or':_[_0xf18f('0x45')](_0x44a0fc[_0xf18f('0x39')],function(_0x25af05){var _0x2c8a45={};_0x2c8a45[_0x25af05]={'$like':'%'+_0x4b2603[_0xf18f('0x33')][_0xf18f('0x44')]+'%'};return _0x2c8a45;})});}_0x44a0fc=_['merge']({},_0x44a0fc,_0x4b2603[_0xf18f('0x46')]);var _0x2fa287={'where':_0x44a0fc['where']};return db[_0xf18f('0x30')]['count'](_0x2fa287)['then'](function(_0x327123){_0x1b4f79[_0xf18f('0x26')]=_0x327123;if(_0x4b2603[_0xf18f('0x33')][_0xf18f('0x47')]){_0x44a0fc['include']=[{'all':!![]}];}return db[_0xf18f('0x30')][_0xf18f('0x48')](_0x44a0fc);})[_0xf18f('0x2b')](function(_0x3c0fb0){_0x1b4f79[_0xf18f('0x49')]=_0x3c0fb0;return _0x1b4f79;})[_0xf18f('0x2b')](respondWithFilteredResult(_0x5802fc,_0x44a0fc))[_0xf18f('0x21')](handleError(_0x5802fc,null));};exports[_0xf18f('0x4a')]=function(_0x13117f,_0x4543a1){var _0x363d28={'raw':!![],'where':{'id':_0x13117f[_0xf18f('0x4b')]['id']}},_0x4c4c06={};_0x4c4c06[_0xf18f('0x38')]=_[_0xf18f('0x32')](db[_0xf18f('0x30')][_0xf18f('0x31')]);_0x4c4c06[_0xf18f('0x33')]=_[_0xf18f('0x32')](_0x13117f[_0xf18f('0x33')]);_0x4c4c06[_0xf18f('0x36')]=_['intersection'](_0x4c4c06[_0xf18f('0x38')],_0x4c4c06['query']);_0x363d28[_0xf18f('0x39')]=_[_0xf18f('0x37')](_0x4c4c06[_0xf18f('0x38')],qs[_0xf18f('0x3a')](_0x13117f[_0xf18f('0x33')][_0xf18f('0x3a')]));_0x363d28[_0xf18f('0x39')]=_0x363d28[_0xf18f('0x39')][_0xf18f('0x3b')]?_0x363d28['attributes']:_0x4c4c06[_0xf18f('0x38')];if(_0x13117f['query'][_0xf18f('0x47')]){_0x363d28[_0xf18f('0x4c')]=[{'all':!![]}];}_0x363d28=_[_0xf18f('0x43')]({},_0x363d28,_0x13117f[_0xf18f('0x46')]);return db[_0xf18f('0x30')][_0xf18f('0x4d')](_0x363d28)[_0xf18f('0x2b')](handleEntityNotFound(_0x4543a1,null))[_0xf18f('0x2b')](respondWithResult(_0x4543a1,null))[_0xf18f('0x21')](handleError(_0x4543a1,null));};exports[_0xf18f('0x4e')]=function(_0x397963,_0x1d1398){return db[_0xf18f('0x30')]['create'](_0x397963[_0xf18f('0x4f')],{})[_0xf18f('0x2b')](respondWithResult(_0x1d1398,0xc9))[_0xf18f('0x21')](handleError(_0x1d1398,null));};exports[_0xf18f('0x50')]=function(_0x29b280,_0x1063ee){if(_0x29b280[_0xf18f('0x4f')]['id']){delete _0x29b280['body']['id'];}return db[_0xf18f('0x30')][_0xf18f('0x4d')]({'where':{'id':_0x29b280[_0xf18f('0x4b')]['id']}})[_0xf18f('0x2b')](handleEntityNotFound(_0x1063ee,null))[_0xf18f('0x2b')](saveUpdates(_0x29b280[_0xf18f('0x4f')],null))[_0xf18f('0x2b')](respondWithResult(_0x1063ee,null))['catch'](handleError(_0x1063ee,null));};exports[_0xf18f('0x2c')]=function(_0x4686d8,_0x58e5e9){return db[_0xf18f('0x30')][_0xf18f('0x4d')]({'where':{'id':_0x4686d8[_0xf18f('0x4b')]['id']}})[_0xf18f('0x2b')](handleEntityNotFound(_0x58e5e9,null))[_0xf18f('0x2b')](removeEntity(_0x58e5e9,null))['catch'](handleError(_0x58e5e9,null));};exports[_0xf18f('0x51')]=function(_0x508d75,_0x78f4b0){return db[_0xf18f('0x30')][_0xf18f('0x51')]()[_0xf18f('0x2b')](respondWithResult(_0x78f4b0,null))['catch'](handleError(_0x78f4b0,null));};exports[_0xf18f('0x52')]=function(_0x76f689,_0x546e3f,_0xba1560){return db['ChatInternalMessage'][_0xf18f('0x26')]({'where':{'ChatGroupId':_0x76f689[_0xf18f('0x4b')]['id'],'ToId':_0x76f689[_0xf18f('0x53')]['id'],'read':![]}})['then'](function(_0x149800){return{'id':_[_0xf18f('0x54')](_0x76f689[_0xf18f('0x4b')]['id']),'count':_0x149800};})[_0xf18f('0x2b')](respondWithResult(_0x546e3f,null))[_0xf18f('0x21')](handleError(_0x546e3f,null));};exports['addMembers']=function(_0xd3055,_0x17ca78,_0x477f2d){return db['ChatGroup'][_0xf18f('0x4d')]({'where':{'id':_0xd3055[_0xf18f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x17ca78,null))[_0xf18f('0x2b')](function(_0x30ca51){if(_0x30ca51){return _0x30ca51[_0xf18f('0x55')](_0xd3055[_0xf18f('0x4f')][_0xf18f('0x56')],_[_0xf18f('0x57')](_0xd3055[_0xf18f('0x4f')],[_0xf18f('0x56'),'id'])||{});}})[_0xf18f('0x2b')](respondWithResult(_0x17ca78,null))[_0xf18f('0x21')](handleError(_0x17ca78,null));};exports[_0xf18f('0x58')]=function(_0xb4d11,_0x15e136,_0x434322){var _0x5c972f={};var _0x34489d={};var _0x524237;var _0x49fb33;return db[_0xf18f('0x30')][_0xf18f('0x59')]({'where':{'id':_0xb4d11['params']['id']}})[_0xf18f('0x2b')](handleEntityNotFound(_0x15e136,null))['then'](function(_0x4ad205){if(_0x4ad205){_0x524237=_0x4ad205;_0x34489d[_0xf18f('0x38')]=_['keys'](db[_0xf18f('0x5a')]['rawAttributes']);_0x34489d['query']=_[_0xf18f('0x32')](_0xb4d11['query']);_0x34489d[_0xf18f('0x36')]=_['intersection'](_0x34489d[_0xf18f('0x38')],_0x34489d[_0xf18f('0x33')]);_0x5c972f[_0xf18f('0x39')]=_[_0xf18f('0x37')](_0x34489d['model'],qs[_0xf18f('0x3a')](_0xb4d11[_0xf18f('0x33')][_0xf18f('0x3a')]));_0x5c972f['attributes']=_0x5c972f[_0xf18f('0x39')][_0xf18f('0x3b')]?_0x5c972f[_0xf18f('0x39')]:_0x34489d['model'];_0x5c972f[_0xf18f('0x3d')]=qs[_0xf18f('0x3e')](_0xb4d11[_0xf18f('0x33')][_0xf18f('0x3e')]);_0x5c972f[_0xf18f('0x3f')]=qs[_0xf18f('0x36')](_[_0xf18f('0x40')](_0xb4d11[_0xf18f('0x33')],_0x34489d[_0xf18f('0x36')]));if(_0xb4d11[_0xf18f('0x33')]['filter']){_0x5c972f[_0xf18f('0x3f')]=_[_0xf18f('0x43')](_0x5c972f[_0xf18f('0x3f')],{'$or':_[_0xf18f('0x45')](_0x5c972f['attributes'],function(_0x37bb7e){var _0x39c99c={};_0x39c99c[_0x37bb7e]={'$like':'%'+_0xb4d11[_0xf18f('0x33')][_0xf18f('0x44')]+'%'};return _0x39c99c;})});}_0x5c972f=_[_0xf18f('0x43')]({},_0x5c972f,_0xb4d11[_0xf18f('0x46')]);return _0x524237[_0xf18f('0x58')](_0x5c972f);}})[_0xf18f('0x2b')](function(_0x357feb){if(_0x357feb){_0x49fb33=_0x357feb['length'];if(!_0xb4d11[_0xf18f('0x33')][_0xf18f('0x3c')](_0xf18f('0x5b'))){_0x5c972f['limit']=qs[_0xf18f('0x28')](_0xb4d11[_0xf18f('0x33')][_0xf18f('0x28')]);_0x5c972f['offset']=qs[_0xf18f('0x27')](_0xb4d11[_0xf18f('0x33')][_0xf18f('0x27')]);}return _0x524237[_0xf18f('0x58')](_0x5c972f);}})['then'](function(_0x680cf5){if(_0x680cf5){return _0x680cf5?{'count':_0x49fb33,'rows':_0x680cf5}:null;}})['then'](respondWithResult(_0x15e136,null))[_0xf18f('0x21')](handleError(_0x15e136,null));};exports[_0xf18f('0x5c')]=function(_0x166af3,_0x89c03e,_0x15e258){var _0x207cb2;return db[_0xf18f('0x30')][_0xf18f('0x4d')]({'where':{'id':_0x166af3['params']['id']}})[_0xf18f('0x2b')](handleEntityNotFound(_0x89c03e,null))['then'](function(_0x563a7e){if(_0x563a7e){return _0x563a7e[_0xf18f('0x5c')](_0x166af3[_0xf18f('0x33')]['ids']);}})[_0xf18f('0x2b')](respondWithStatusCode(_0x89c03e,null))['catch'](handleError(_0x89c03e,null));};exports['addMessage']=function(_0x477ae5,_0xe3475e,_0x528c56){if(_0x477ae5[_0xf18f('0x4f')]['id']){delete _0x477ae5['body']['id'];}return db[_0xf18f('0x30')][_0xf18f('0x4d')]({'where':{'id':_0x477ae5[_0xf18f('0x4b')]['id']}})[_0xf18f('0x2b')](handleEntityNotFound(_0xe3475e,null))[_0xf18f('0x2b')](function(_0x254dcc){if(_0x254dcc){_0x477ae5['body']['ChatGroupId']=_0x254dcc['id'];return db[_0xf18f('0x5d')][_0xf18f('0x4e')](_0x477ae5[_0xf18f('0x4f')]);}})['then'](respondWithResult(_0xe3475e,null))[_0xf18f('0x21')](handleError(_0xe3475e,null));};exports['getMessages']=function(_0x478042,_0x58f15a,_0x264cb7){var _0x2779d7={};var _0x1a5338={};var _0x1617a0;var _0x528870;return db[_0xf18f('0x30')][_0xf18f('0x59')]({'where':{'id':_0x478042[_0xf18f('0x4b')]['id']}})[_0xf18f('0x2b')](handleEntityNotFound(_0x58f15a,null))['then'](function(_0x52cc0b){if(_0x52cc0b){_0x1617a0=_0x52cc0b;_0x1a5338[_0xf18f('0x38')]=_[_0xf18f('0x32')](db[_0xf18f('0x5d')][_0xf18f('0x31')]);_0x1a5338[_0xf18f('0x33')]=_['keys'](_0x478042['query']);_0x1a5338[_0xf18f('0x36')]=_[_0xf18f('0x37')](_0x1a5338[_0xf18f('0x38')],_0x1a5338[_0xf18f('0x33')]);_0x2779d7[_0xf18f('0x39')]=_[_0xf18f('0x37')](_0x1a5338[_0xf18f('0x38')],qs[_0xf18f('0x3a')](_0x478042[_0xf18f('0x33')][_0xf18f('0x3a')]));_0x2779d7[_0xf18f('0x39')]=_0x2779d7[_0xf18f('0x39')][_0xf18f('0x3b')]?_0x2779d7[_0xf18f('0x39')]:_0x1a5338[_0xf18f('0x38')];_0x2779d7['order']=qs['sort'](_0x478042[_0xf18f('0x33')][_0xf18f('0x3e')]);_0x2779d7['where']=qs['filters'](_[_0xf18f('0x40')](_0x478042[_0xf18f('0x33')],_0x1a5338[_0xf18f('0x36')]));if(_0x478042[_0xf18f('0x33')][_0xf18f('0x44')]){_0x2779d7['where']=_[_0xf18f('0x43')](_0x2779d7['where'],{'$or':_[_0xf18f('0x45')](_0x2779d7[_0xf18f('0x39')],function(_0x454df2){var _0x984d21={};_0x984d21[_0x454df2]={'$like':'%'+_0x478042[_0xf18f('0x33')][_0xf18f('0x44')]+'%'};return _0x984d21;})});}if(_0x478042[_0xf18f('0x33')][_0xf18f('0x5e')]){var _0x55d2d6=_0x478042['query'][_0xf18f('0x5e')][_0xf18f('0x5f')](',');var _0x24b3db={};_0x24b3db[_0x55d2d6[0x0]]={'$gte':moment(_0x55d2d6[0x1])['format'](_0xf18f('0x60'))};_0x2779d7[_0xf18f('0x3f')]=_[_0xf18f('0x43')](_0x2779d7[_0xf18f('0x3f')],_0x24b3db);}_0x2779d7=_['merge']({},_0x2779d7,_0x478042[_0xf18f('0x46')]);return _0x1617a0['getMessages'](_0x2779d7);}})[_0xf18f('0x2b')](function(_0x526674){if(_0x526674){_0x528870=_0x526674[_0xf18f('0x3b')];if(!_0x478042['query'][_0xf18f('0x3c')](_0xf18f('0x5b'))){_0x2779d7[_0xf18f('0x28')]=qs[_0xf18f('0x28')](_0x478042[_0xf18f('0x33')]['limit']);_0x2779d7[_0xf18f('0x27')]=qs[_0xf18f('0x27')](_0x478042[_0xf18f('0x33')][_0xf18f('0x27')]);}return _0x1617a0[_0xf18f('0x61')](_0x2779d7);}})[_0xf18f('0x2b')](function(_0x5336fb){if(_0x5336fb){return _0x5336fb?{'count':_0x528870,'rows':_0x5336fb}:null;}})[_0xf18f('0x2b')](respondWithResult(_0x58f15a,null))[_0xf18f('0x21')](handleError(_0x58f15a,null));}; \ No newline at end of file +var _0x26ea=['User','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','create','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','localhost','./chatGroup.socket','register','jayson/promise','client','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','ChatGroup','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','includeAll','include','findAll','rows','show','params','options','body','find','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne'];(function(_0x53966d,_0x1f1797){var _0x70a280=function(_0x5ef2a9){while(--_0x5ef2a9){_0x53966d['push'](_0x53966d['shift']());}};_0x70a280(++_0x1f1797);}(_0x26ea,0xd1));var _0xa26e=function(_0x3f35a1,_0x4b028e){_0x3f35a1=_0x3f35a1-0x0;var _0x476087=_0x26ea[_0x3f35a1];return _0x476087;};'use strict';var jsonpatch=require(_0xa26e('0x0'));var rp=require('request-promise');var moment=require(_0xa26e('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa26e('0x2'));var util=require(_0xa26e('0x3'));var path=require(_0xa26e('0x4'));var sox=require(_0xa26e('0x5'));var csv=require(_0xa26e('0x6'));var ejs=require(_0xa26e('0x7'));var fs=require('fs');var _=require(_0xa26e('0x8'));var squel=require(_0xa26e('0x9'));var crypto=require(_0xa26e('0xa'));var jsforce=require(_0xa26e('0xb'));var deskjs=require(_0xa26e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa26e('0xd'));var Papa=require(_0xa26e('0xe'));var qs=require(_0xa26e('0xf'));var logger=require('../../config/logger')(_0xa26e('0x10'));var utils=require(_0xa26e('0x11'));var config=require(_0xa26e('0x12'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':_0xa26e('0x13'),'port':0x18eb});require(_0xa26e('0x14'))[_0xa26e('0x15')](socket);var jayson=require(_0xa26e('0x16'));var client=jayson[_0xa26e('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1585f1,_0x3a991d,_0x1683f8,_0x3f6a3b){return new BPromise(function(_0x49befb,_0x59fd11){var _0x1c1d30=_0x3f6a3b||client;return _0x1c1d30['request'](_0x1585f1,_0x1683f8)['then'](function(_0x5d82b3){logger['info'](_0xa26e('0x18'),_0x3a991d,_0xa26e('0x19'));logger['debug'](_0xa26e('0x1a'),_0x3a991d,'request\x20sent',JSON[_0xa26e('0x1b')](_0x5d82b3));if(_0x5d82b3[_0xa26e('0x1c')]){if(_0x5d82b3[_0xa26e('0x1c')][_0xa26e('0x1d')]===0x1f4){logger['error'](_0xa26e('0x18'),_0x3a991d,_0x5d82b3[_0xa26e('0x1c')][_0xa26e('0x1e')]);return _0x59fd11(_0x5d82b3[_0xa26e('0x1c')][_0xa26e('0x1e')]);}logger[_0xa26e('0x1c')](_0xa26e('0x18'),_0x3a991d,_0x5d82b3[_0xa26e('0x1c')][_0xa26e('0x1e')]);return _0x49befb(_0x5d82b3[_0xa26e('0x1c')][_0xa26e('0x1e')]);}else{logger['info'](_0xa26e('0x18'),_0x3a991d,_0xa26e('0x19'));_0x49befb(_0x5d82b3['result'][_0xa26e('0x1e')]);}})[_0xa26e('0x1f')](function(_0x14fc11){logger['error'](_0xa26e('0x18'),_0x3a991d,_0x14fc11);_0x59fd11(_0x14fc11);});});}function respondWithStatusCode(_0x116567,_0x32520b){_0x32520b=_0x32520b||0xcc;return function(_0x311519){if(_0x311519){return _0x116567['sendStatus'](_0x32520b);}return _0x116567[_0xa26e('0x20')](_0x32520b)[_0xa26e('0x21')]();};}function respondWithResult(_0x2f2736,_0x58c45b){_0x58c45b=_0x58c45b||0xc8;return function(_0x2ad774){if(_0x2ad774){return _0x2f2736[_0xa26e('0x20')](_0x58c45b)['json'](_0x2ad774);}};}function respondWithFilteredResult(_0x2891f3,_0x428a89){return function(_0x4aab54){if(_0x4aab54){var _0x57c16d=_0x4aab54[_0xa26e('0x22')],_0x9c43de=_0x428a89[_0xa26e('0x23')],_0x122d0d=_0x428a89['offset']+_0x428a89[_0xa26e('0x24')],_0x489ac2;if(_0x122d0d>=_0x57c16d){_0x122d0d=_0x57c16d;_0x489ac2=0xc8;}else{_0x489ac2=0xce;}_0x2891f3['status'](_0x489ac2);return _0x2891f3[_0xa26e('0x25')](_0xa26e('0x26'),_0x9c43de+'-'+_0x122d0d+'/'+_0x57c16d)[_0xa26e('0x27')](_0x4aab54);}return null;};}function patchUpdates(_0x550fd8){return function(_0x399329){try{jsonpatch[_0xa26e('0x28')](_0x399329,_0x550fd8,!![]);}catch(_0x2294ca){return BPromise['reject'](_0x2294ca);}return _0x399329[_0xa26e('0x29')]();};}function saveUpdates(_0x404be1,_0x5177cb){return function(_0x2122cb){if(_0x2122cb){return _0x2122cb[_0xa26e('0x2a')](_0x404be1)[_0xa26e('0x2b')](function(_0x1fb3d5){return _0x1fb3d5;});}return null;};}function removeEntity(_0x281944,_0x244af7){return function(_0x5f3c6a){if(_0x5f3c6a){return _0x5f3c6a[_0xa26e('0x2c')]()['then'](function(){_0x281944['status'](0xcc)[_0xa26e('0x21')]();});}};}function handleEntityNotFound(_0x4014ef,_0x5655d6){return function(_0x6987b){if(!_0x6987b){_0x4014ef['sendStatus'](0x194);}return _0x6987b;};}function handleError(_0x3df10a,_0x10b50a){_0x10b50a=_0x10b50a||0x1f4;return function(_0x2a6c63){logger[_0xa26e('0x1c')](_0x2a6c63[_0xa26e('0x2d')]);if(_0x2a6c63['name']){delete _0x2a6c63[_0xa26e('0x2e')];}_0x3df10a['status'](_0x10b50a)[_0xa26e('0x2f')](_0x2a6c63);};}exports['index']=function(_0xc6e195,_0x3cfe90){var _0x52b4ae={},_0x210379={},_0x1f9d3d={'count':0x0,'rows':[]};var _0x32c4e3=db[_0xa26e('0x30')][_0xa26e('0x31')];_0x210379[_0xa26e('0x32')]=_[_0xa26e('0x33')](_0x32c4e3);var _0x282ca6={'dateStart':_0xc6e195[_0xa26e('0x34')][_0xa26e('0x35')],'dateEnd':_0xc6e195['query']['dateEnd']};delete _0xc6e195[_0xa26e('0x34')][_0xa26e('0x35')];delete _0xc6e195[_0xa26e('0x34')]['dateEnd'];_0x210379[_0xa26e('0x34')]=_['keys'](_0xc6e195[_0xa26e('0x34')]);_0x210379[_0xa26e('0x36')]=_[_0xa26e('0x37')](_0x210379[_0xa26e('0x32')],_0x210379['query']);_0x52b4ae[_0xa26e('0x38')]=_[_0xa26e('0x37')](_0x210379['model'],qs[_0xa26e('0x39')](_0xc6e195['query']['fields']));_0x52b4ae['attributes']=_0x52b4ae[_0xa26e('0x38')][_0xa26e('0x3a')]?_0x52b4ae[_0xa26e('0x38')]:_0x210379[_0xa26e('0x32')];if(!_0xc6e195[_0xa26e('0x34')][_0xa26e('0x3b')](_0xa26e('0x3c'))){_0x52b4ae['limit']=qs[_0xa26e('0x24')](_0xc6e195[_0xa26e('0x34')]['limit']);_0x52b4ae[_0xa26e('0x23')]=qs[_0xa26e('0x23')](_0xc6e195[_0xa26e('0x34')][_0xa26e('0x23')]);}_0x52b4ae[_0xa26e('0x3d')]=qs[_0xa26e('0x3e')](_0xc6e195[_0xa26e('0x34')][_0xa26e('0x3e')]);_0x52b4ae[_0xa26e('0x3f')]=qs[_0xa26e('0x36')](_[_0xa26e('0x40')](_0xc6e195['query'],_0x210379['filters']));if(_0x282ca6[_0xa26e('0x35')]){if(_0x282ca6[_0xa26e('0x41')]){_0x282ca6[_0xa26e('0x41')]=moment(_0x282ca6['dateEnd'])[_0xa26e('0x42')](0x1,_0xa26e('0x43'));}else{_0x282ca6[_0xa26e('0x41')]=moment(_0x282ca6[_0xa26e('0x35')])[_0xa26e('0x42')](0x1,_0xa26e('0x43'));}_[_0xa26e('0x44')](_0x52b4ae[_0xa26e('0x3f')],{'createdAt':{'$gte':_0x282ca6['dateStart'],'$lte':_0x282ca6[_0xa26e('0x41')]}});}if(_0xc6e195['query'][_0xa26e('0x45')]){_0x52b4ae[_0xa26e('0x3f')]=_[_0xa26e('0x44')](_0x52b4ae[_0xa26e('0x3f')],{'$or':_[_0xa26e('0x46')](_0x52b4ae[_0xa26e('0x38')],function(_0x4e4b27){var _0x48050c={};_0x48050c[_0x4e4b27]={'$like':'%'+_0xc6e195[_0xa26e('0x34')][_0xa26e('0x45')]+'%'};return _0x48050c;})});}_0x52b4ae=_[_0xa26e('0x44')]({},_0x52b4ae,_0xc6e195['options']);var _0x2f9561={'where':_0x52b4ae[_0xa26e('0x3f')]};return db[_0xa26e('0x30')]['count'](_0x2f9561)[_0xa26e('0x2b')](function(_0x124330){_0x1f9d3d[_0xa26e('0x22')]=_0x124330;if(_0xc6e195['query'][_0xa26e('0x47')]){_0x52b4ae[_0xa26e('0x48')]=[{'all':!![]}];}return db['ChatGroup'][_0xa26e('0x49')](_0x52b4ae);})['then'](function(_0x364625){_0x1f9d3d[_0xa26e('0x4a')]=_0x364625;return _0x1f9d3d;})[_0xa26e('0x2b')](respondWithFilteredResult(_0x3cfe90,_0x52b4ae))[_0xa26e('0x1f')](handleError(_0x3cfe90,null));};exports[_0xa26e('0x4b')]=function(_0xd8a2db,_0x38bccc){var _0x391de6={'raw':!![],'where':{'id':_0xd8a2db[_0xa26e('0x4c')]['id']}},_0x3f1652={};_0x3f1652['model']=_['keys'](db[_0xa26e('0x30')][_0xa26e('0x31')]);_0x3f1652[_0xa26e('0x34')]=_[_0xa26e('0x33')](_0xd8a2db[_0xa26e('0x34')]);_0x3f1652[_0xa26e('0x36')]=_[_0xa26e('0x37')](_0x3f1652[_0xa26e('0x32')],_0x3f1652[_0xa26e('0x34')]);_0x391de6[_0xa26e('0x38')]=_[_0xa26e('0x37')](_0x3f1652[_0xa26e('0x32')],qs[_0xa26e('0x39')](_0xd8a2db['query'][_0xa26e('0x39')]));_0x391de6['attributes']=_0x391de6[_0xa26e('0x38')]['length']?_0x391de6['attributes']:_0x3f1652[_0xa26e('0x32')];if(_0xd8a2db[_0xa26e('0x34')][_0xa26e('0x47')]){_0x391de6[_0xa26e('0x48')]=[{'all':!![]}];}_0x391de6=_[_0xa26e('0x44')]({},_0x391de6,_0xd8a2db[_0xa26e('0x4d')]);return db[_0xa26e('0x30')]['find'](_0x391de6)['then'](handleEntityNotFound(_0x38bccc,null))[_0xa26e('0x2b')](respondWithResult(_0x38bccc,null))[_0xa26e('0x1f')](handleError(_0x38bccc,null));};exports['create']=function(_0x52b039,_0x3ebb58){return db['ChatGroup']['create'](_0x52b039[_0xa26e('0x4e')],{})[_0xa26e('0x2b')](respondWithResult(_0x3ebb58,0xc9))['catch'](handleError(_0x3ebb58,null));};exports[_0xa26e('0x2a')]=function(_0x243830,_0x7fc938){if(_0x243830[_0xa26e('0x4e')]['id']){delete _0x243830[_0xa26e('0x4e')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x243830[_0xa26e('0x4c')]['id']}})[_0xa26e('0x2b')](handleEntityNotFound(_0x7fc938,null))[_0xa26e('0x2b')](saveUpdates(_0x243830[_0xa26e('0x4e')],null))['then'](respondWithResult(_0x7fc938,null))[_0xa26e('0x1f')](handleError(_0x7fc938,null));};exports[_0xa26e('0x2c')]=function(_0x140baa,_0x47c723){return db[_0xa26e('0x30')][_0xa26e('0x4f')]({'where':{'id':_0x140baa[_0xa26e('0x4c')]['id']}})[_0xa26e('0x2b')](handleEntityNotFound(_0x47c723,null))[_0xa26e('0x2b')](removeEntity(_0x47c723,null))[_0xa26e('0x1f')](handleError(_0x47c723,null));};exports['describe']=function(_0x46d8d3,_0x3a2a61){return db[_0xa26e('0x30')][_0xa26e('0x50')]()[_0xa26e('0x2b')](respondWithResult(_0x3a2a61,null))[_0xa26e('0x1f')](handleError(_0x3a2a61,null));};exports[_0xa26e('0x51')]=function(_0x1e9ae3,_0xa49651,_0x13e80b){return db['ChatInternalMessage'][_0xa26e('0x22')]({'where':{'ChatGroupId':_0x1e9ae3[_0xa26e('0x4c')]['id'],'ToId':_0x1e9ae3[_0xa26e('0x52')]['id'],'read':![]}})[_0xa26e('0x2b')](function(_0x52177e){return{'id':_[_0xa26e('0x53')](_0x1e9ae3[_0xa26e('0x4c')]['id']),'count':_0x52177e};})[_0xa26e('0x2b')](respondWithResult(_0xa49651,null))[_0xa26e('0x1f')](handleError(_0xa49651,null));};exports[_0xa26e('0x54')]=function(_0x49b4dd,_0xe005a4,_0x548468){return db['ChatGroup'][_0xa26e('0x4f')]({'where':{'id':_0x49b4dd[_0xa26e('0x4c')]['id']}})[_0xa26e('0x2b')](handleEntityNotFound(_0xe005a4,null))[_0xa26e('0x2b')](function(_0x462bd0){if(_0x462bd0){return _0x462bd0[_0xa26e('0x54')](_0x49b4dd['body'][_0xa26e('0x55')],_['omit'](_0x49b4dd[_0xa26e('0x4e')],[_0xa26e('0x55'),'id'])||{});}})[_0xa26e('0x2b')](respondWithResult(_0xe005a4,null))['catch'](handleError(_0xe005a4,null));};exports[_0xa26e('0x56')]=function(_0x535af4,_0x517e27,_0x5bc63d){var _0x571c01={};var _0x55bff3={};var _0x12eb11;var _0x37574e;return db['ChatGroup'][_0xa26e('0x57')]({'where':{'id':_0x535af4[_0xa26e('0x4c')]['id']}})[_0xa26e('0x2b')](handleEntityNotFound(_0x517e27,null))[_0xa26e('0x2b')](function(_0x45d5f5){if(_0x45d5f5){_0x12eb11=_0x45d5f5;_0x55bff3['model']=_['keys'](db[_0xa26e('0x58')]['rawAttributes']);_0x55bff3[_0xa26e('0x34')]=_[_0xa26e('0x33')](_0x535af4[_0xa26e('0x34')]);_0x55bff3[_0xa26e('0x36')]=_[_0xa26e('0x37')](_0x55bff3[_0xa26e('0x32')],_0x55bff3['query']);_0x571c01[_0xa26e('0x38')]=_[_0xa26e('0x37')](_0x55bff3[_0xa26e('0x32')],qs[_0xa26e('0x39')](_0x535af4[_0xa26e('0x34')][_0xa26e('0x39')]));_0x571c01[_0xa26e('0x38')]=_0x571c01[_0xa26e('0x38')][_0xa26e('0x3a')]?_0x571c01[_0xa26e('0x38')]:_0x55bff3[_0xa26e('0x32')];_0x571c01[_0xa26e('0x3d')]=qs[_0xa26e('0x3e')](_0x535af4[_0xa26e('0x34')][_0xa26e('0x3e')]);_0x571c01[_0xa26e('0x3f')]=qs['filters'](_['pick'](_0x535af4[_0xa26e('0x34')],_0x55bff3[_0xa26e('0x36')]));if(_0x535af4[_0xa26e('0x34')][_0xa26e('0x45')]){_0x571c01['where']=_['merge'](_0x571c01[_0xa26e('0x3f')],{'$or':_['map'](_0x571c01[_0xa26e('0x38')],function(_0x498845){var _0x32b5e6={};_0x32b5e6[_0x498845]={'$like':'%'+_0x535af4[_0xa26e('0x34')]['filter']+'%'};return _0x32b5e6;})});}_0x571c01=_[_0xa26e('0x44')]({},_0x571c01,_0x535af4['options']);return _0x12eb11['getMembers'](_0x571c01);}})[_0xa26e('0x2b')](function(_0x5b2058){if(_0x5b2058){_0x37574e=_0x5b2058[_0xa26e('0x3a')];if(!_0x535af4[_0xa26e('0x34')][_0xa26e('0x3b')](_0xa26e('0x3c'))){_0x571c01[_0xa26e('0x24')]=qs[_0xa26e('0x24')](_0x535af4['query'][_0xa26e('0x24')]);_0x571c01[_0xa26e('0x23')]=qs[_0xa26e('0x23')](_0x535af4[_0xa26e('0x34')][_0xa26e('0x23')]);}return _0x12eb11[_0xa26e('0x56')](_0x571c01);}})['then'](function(_0x56d976){if(_0x56d976){return _0x56d976?{'count':_0x37574e,'rows':_0x56d976}:null;}})[_0xa26e('0x2b')](respondWithResult(_0x517e27,null))[_0xa26e('0x1f')](handleError(_0x517e27,null));};exports[_0xa26e('0x59')]=function(_0x4e5631,_0x1e42fe,_0x5e2a03){var _0x107674;return db[_0xa26e('0x30')][_0xa26e('0x4f')]({'where':{'id':_0x4e5631['params']['id']}})[_0xa26e('0x2b')](handleEntityNotFound(_0x1e42fe,null))[_0xa26e('0x2b')](function(_0x54e94d){if(_0x54e94d){return _0x54e94d[_0xa26e('0x59')](_0x4e5631[_0xa26e('0x34')]['ids']);}})[_0xa26e('0x2b')](respondWithStatusCode(_0x1e42fe,null))['catch'](handleError(_0x1e42fe,null));};exports[_0xa26e('0x5a')]=function(_0x26d55f,_0x5a43fd,_0x2ad99e){if(_0x26d55f[_0xa26e('0x4e')]['id']){delete _0x26d55f[_0xa26e('0x4e')]['id'];}return db[_0xa26e('0x30')][_0xa26e('0x4f')]({'where':{'id':_0x26d55f[_0xa26e('0x4c')]['id']}})[_0xa26e('0x2b')](handleEntityNotFound(_0x5a43fd,null))[_0xa26e('0x2b')](function(_0xe2353a){if(_0xe2353a){_0x26d55f[_0xa26e('0x4e')][_0xa26e('0x5b')]=_0xe2353a['id'];return db[_0xa26e('0x5c')][_0xa26e('0x5d')](_0x26d55f[_0xa26e('0x4e')]);}})[_0xa26e('0x2b')](respondWithResult(_0x5a43fd,null))[_0xa26e('0x1f')](handleError(_0x5a43fd,null));};exports[_0xa26e('0x5e')]=function(_0x4d455e,_0x2845ab,_0x36a07b){var _0x2664a4={};var _0x5a23b9={};var _0x13b512;var _0x7843de;return db[_0xa26e('0x30')][_0xa26e('0x57')]({'where':{'id':_0x4d455e[_0xa26e('0x4c')]['id']}})[_0xa26e('0x2b')](handleEntityNotFound(_0x2845ab,null))[_0xa26e('0x2b')](function(_0x14e6e2){if(_0x14e6e2){_0x13b512=_0x14e6e2;_0x5a23b9[_0xa26e('0x32')]=_['keys'](db[_0xa26e('0x5c')]['rawAttributes']);_0x5a23b9[_0xa26e('0x34')]=_['keys'](_0x4d455e[_0xa26e('0x34')]);_0x5a23b9[_0xa26e('0x36')]=_['intersection'](_0x5a23b9[_0xa26e('0x32')],_0x5a23b9[_0xa26e('0x34')]);_0x2664a4[_0xa26e('0x38')]=_[_0xa26e('0x37')](_0x5a23b9[_0xa26e('0x32')],qs[_0xa26e('0x39')](_0x4d455e[_0xa26e('0x34')][_0xa26e('0x39')]));_0x2664a4[_0xa26e('0x38')]=_0x2664a4[_0xa26e('0x38')][_0xa26e('0x3a')]?_0x2664a4[_0xa26e('0x38')]:_0x5a23b9[_0xa26e('0x32')];_0x2664a4[_0xa26e('0x3d')]=qs[_0xa26e('0x3e')](_0x4d455e[_0xa26e('0x34')][_0xa26e('0x3e')]);_0x2664a4[_0xa26e('0x3f')]=qs[_0xa26e('0x36')](_[_0xa26e('0x40')](_0x4d455e[_0xa26e('0x34')],_0x5a23b9[_0xa26e('0x36')]));if(_0x4d455e[_0xa26e('0x34')][_0xa26e('0x45')]){_0x2664a4[_0xa26e('0x3f')]=_['merge'](_0x2664a4['where'],{'$or':_[_0xa26e('0x46')](_0x2664a4[_0xa26e('0x38')],function(_0x58ece8){var _0x3f74f2={};_0x3f74f2[_0x58ece8]={'$like':'%'+_0x4d455e[_0xa26e('0x34')]['filter']+'%'};return _0x3f74f2;})});}if(_0x4d455e['query'][_0xa26e('0x5f')]){var _0x4e2a2b=_0x4d455e[_0xa26e('0x34')][_0xa26e('0x5f')][_0xa26e('0x60')](',');var _0x5f4b6d={};_0x5f4b6d[_0x4e2a2b[0x0]]={'$gte':moment(_0x4e2a2b[0x1])[_0xa26e('0x61')](_0xa26e('0x62'))};_0x2664a4['where']=_[_0xa26e('0x44')](_0x2664a4[_0xa26e('0x3f')],_0x5f4b6d);}_0x2664a4=_[_0xa26e('0x44')]({},_0x2664a4,_0x4d455e[_0xa26e('0x4d')]);return _0x13b512['getMessages'](_0x2664a4);}})[_0xa26e('0x2b')](function(_0x2b1ba3){if(_0x2b1ba3){_0x7843de=_0x2b1ba3[_0xa26e('0x3a')];if(!_0x4d455e[_0xa26e('0x34')][_0xa26e('0x3b')]('nolimit')){_0x2664a4[_0xa26e('0x24')]=qs[_0xa26e('0x24')](_0x4d455e[_0xa26e('0x34')]['limit']);_0x2664a4[_0xa26e('0x23')]=qs[_0xa26e('0x23')](_0x4d455e['query']['offset']);}return _0x13b512['getMessages'](_0x2664a4);}})[_0xa26e('0x2b')](function(_0x487d6f){if(_0x487d6f){return _0x487d6f?{'count':_0x7843de,'rows':_0x487d6f}:null;}})[_0xa26e('0x2b')](respondWithResult(_0x2845ab,null))[_0xa26e('0x1f')](handleError(_0x2845ab,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 080b864..e73bfc9 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 _0xb84b=['exports','events','update','remove','emit','hasOwnProperty'];(function(_0x43975e,_0x2fafdb){var _0x1ae777=function(_0x560c34){while(--_0x560c34){_0x43975e['push'](_0x43975e['shift']());}};_0x1ae777(++_0x2fafdb);}(_0xb84b,0x13f));var _0xbb84=function(_0x6c370d,_0x13db44){_0x6c370d=_0x6c370d-0x0;var _0x228345=_0xb84b[_0x6c370d];return _0x228345;};'use strict';var EventEmitter=require(_0xbb84('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb84('0x1'),'afterDestroy':_0xbb84('0x2')};function emitEvent(_0x2323ae){return function(_0x3e864d,_0x45a105,_0x138683){ChatGroupEvents['emit'](_0x2323ae+':'+_0x3e864d['id'],_0x3e864d);ChatGroupEvents[_0xbb84('0x3')](_0x2323ae,_0x3e864d);_0x138683(null);};}for(var e in events){if(events[_0xbb84('0x4')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xbb84('0x5')]=ChatGroupEvents; \ No newline at end of file +var _0x8a8e=['save','remove','emit','hook','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8a8e,0x184));var _0xe8a8=function(_0x5a89ea,_0x436388){_0x5a89ea=_0x5a89ea-0x0;var _0x21193d=_0x8a8e[_0x5a89ea];return _0x21193d;};'use strict';var EventEmitter=require(_0xe8a8('0x0'));var ChatGroup=require(_0xe8a8('0x1'))['db'][_0xe8a8('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe8a8('0x3')](0x0);var events={'afterCreate':_0xe8a8('0x4'),'afterUpdate':'update','afterDestroy':_0xe8a8('0x5')};function emitEvent(_0x35ffd6){return function(_0x359b8d,_0x5c1131,_0x94efec){ChatGroupEvents['emit'](_0x35ffd6+':'+_0x359b8d['id'],_0x359b8d);ChatGroupEvents[_0xe8a8('0x6')](_0x35ffd6,_0x359b8d);_0x94efec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe8a8('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index bcf3302..54aa624 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 _0xeccf=['define','ChatGroup','lodash','util','../../config/logger','api','./chatGroup.attributes','exports'];(function(_0x2bbf21,_0x5b017c){var _0x32722b=function(_0x48314e){while(--_0x48314e){_0x2bbf21['push'](_0x2bbf21['shift']());}};_0x32722b(++_0x5b017c);}(_0xeccf,0x1c2));var _0xfecc=function(_0x51ba70,_0x35278a){_0x51ba70=_0x51ba70-0x0;var _0x2d6cb1=_0xeccf[_0x51ba70];return _0x2d6cb1;};'use strict';var _=require(_0xfecc('0x0'));var util=require(_0xfecc('0x1'));var logger=require(_0xfecc('0x2'))(_0xfecc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xfecc('0x4'));module[_0xfecc('0x5')]=function(_0x3cf2c1,_0x41fa4b){return _0x3cf2c1[_0xfecc('0x6')](_0xfecc('0x7'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e4e=['moment','request-promise','./chatGroup.attributes','define','ChatGroup','lodash','util','../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4e4e,0x10d));var _0xe4e4=function(_0x15256d,_0x8ddec6){_0x15256d=_0x15256d-0x0;var _0x88fa0a=_0x4e4e[_0x15256d];return _0x88fa0a;};'use strict';var _=require(_0xe4e4('0x0'));var util=require(_0xe4e4('0x1'));var logger=require(_0xe4e4('0x2'))('api');var moment=require(_0xe4e4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4e4('0x4'));var attributes=require(_0xe4e4('0x5'));module['exports']=function(_0x1d978b,_0x14bd84){return _0x1d978b[_0xe4e4('0x6')](_0xe4e4('0x7'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index e3b57ff..a5766e3 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 _0xfa33=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./chatGroup.socket','request','ChatGroup,\x20%s,\x20%s'];(function(_0x150870,_0x3fac72){var _0x41a7a7=function(_0xb848ea){while(--_0xb848ea){_0x150870['push'](_0x150870['shift']());}};_0x41a7a7(++_0x3fac72);}(_0xfa33,0x1d4));var _0x3fa3=function(_0x56ba58,_0x1697c4){_0x56ba58=_0x56ba58-0x0;var _0x337772=_0xfa33[_0x56ba58];return _0x337772;};'use strict';var _=require(_0x3fa3('0x0'));var util=require(_0x3fa3('0x1'));var moment=require(_0x3fa3('0x2'));var BPromise=require(_0x3fa3('0x3'));var rs=require(_0x3fa3('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x3fa3('0x5'));var logger=require('../../config/logger')(_0x3fa3('0x6'));var config=require(_0x3fa3('0x7'));var jayson=require(_0x3fa3('0x8'));var client=jayson['client'][_0x3fa3('0x9')]({'port':0x232a});var socket=require(_0x3fa3('0xa'))({'host':_0x3fa3('0xb'),'port':0x18eb});require(_0x3fa3('0xc'))['register'](socket);function respondWithRpcPromise(_0x1319f6,_0x13764b,_0x1c9a5e){return new BPromise(function(_0x53509b,_0x31b9f3){return client[_0x3fa3('0xd')](_0x1319f6,_0x1c9a5e)['then'](function(_0x3707e2){logger['info'](_0x3fa3('0xe'),_0x13764b,'request\x20sent');logger[_0x3fa3('0xf')](_0x3fa3('0x10'),_0x13764b,_0x3fa3('0x11'),JSON[_0x3fa3('0x12')](_0x3707e2));if(_0x3707e2[_0x3fa3('0x13')]){if(_0x3707e2[_0x3fa3('0x13')][_0x3fa3('0x14')]===0x1f4){logger[_0x3fa3('0x13')](_0x3fa3('0xe'),_0x13764b,_0x3707e2[_0x3fa3('0x13')][_0x3fa3('0x15')]);return _0x31b9f3(_0x3707e2[_0x3fa3('0x13')]['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x13764b,_0x3707e2[_0x3fa3('0x13')][_0x3fa3('0x15')]);return _0x53509b(_0x3707e2[_0x3fa3('0x13')][_0x3fa3('0x15')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x13764b,_0x3fa3('0x11'));_0x53509b(_0x3707e2['result'][_0x3fa3('0x15')]);}})[_0x3fa3('0x16')](function(_0x1fd1c4){logger[_0x3fa3('0x13')]('ChatGroup,\x20%s,\x20%s',_0x13764b,_0x1fd1c4);_0x31b9f3(_0x1fd1c4);});});} \ No newline at end of file +var _0x2fe4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x32b1a6,_0x195339){var _0x34d887=function(_0xed6673){while(--_0xed6673){_0x32b1a6['push'](_0x32b1a6['shift']());}};_0x34d887(++_0x195339);}(_0x2fe4,0x9b));var _0x42fe=function(_0x1a85fb,_0x1989c6){_0x1a85fb=_0x1a85fb-0x0;var _0x1cc11b=_0x2fe4[_0x1a85fb];return _0x1cc11b;};'use strict';var _=require(_0x42fe('0x0'));var util=require(_0x42fe('0x1'));var moment=require(_0x42fe('0x2'));var BPromise=require(_0x42fe('0x3'));var rs=require(_0x42fe('0x4'));var fs=require('fs');var db=require(_0x42fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x42fe('0x6'))(_0x42fe('0x7'));var config=require(_0x42fe('0x8'));var jayson=require(_0x42fe('0x9'));var client=jayson[_0x42fe('0xa')]['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x42fe('0xb'),'port':0x18eb});require(_0x42fe('0xc'))[_0x42fe('0xd')](socket);function respondWithRpcPromise(_0x1757f2,_0x23debd,_0x507508){return new BPromise(function(_0x25266d,_0x64a855){return client[_0x42fe('0xe')](_0x1757f2,_0x507508)[_0x42fe('0xf')](function(_0x11a7cd){logger[_0x42fe('0x10')](_0x42fe('0x11'),_0x23debd,_0x42fe('0x12'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x23debd,_0x42fe('0x12'),JSON['stringify'](_0x11a7cd));if(_0x11a7cd[_0x42fe('0x13')]){if(_0x11a7cd[_0x42fe('0x13')]['code']===0x1f4){logger[_0x42fe('0x13')]('ChatGroup,\x20%s,\x20%s',_0x23debd,_0x11a7cd['error'][_0x42fe('0x14')]);return _0x64a855(_0x11a7cd[_0x42fe('0x13')][_0x42fe('0x14')]);}logger[_0x42fe('0x13')](_0x42fe('0x11'),_0x23debd,_0x11a7cd[_0x42fe('0x13')]['message']);return _0x25266d(_0x11a7cd[_0x42fe('0x13')][_0x42fe('0x14')]);}else{logger[_0x42fe('0x10')]('ChatGroup,\x20%s,\x20%s',_0x23debd,_0x42fe('0x12'));_0x25266d(_0x11a7cd[_0x42fe('0x15')][_0x42fe('0x14')]);}})[_0x42fe('0x16')](function(_0x54c292){logger['error'](_0x42fe('0x11'),_0x23debd,_0x54c292);_0x64a855(_0x54c292);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index bcd7a61..d06a2e5 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 _0x2e35=['removeListener','register','./chatGroup.events','save','remove','emit'];(function(_0xd2d1c8,_0x25acb5){var _0x1a255c=function(_0x37ebf4){while(--_0x37ebf4){_0xd2d1c8['push'](_0xd2d1c8['shift']());}};_0x1a255c(++_0x25acb5);}(_0x2e35,0x1d0));var _0x52e3=function(_0x3b820f,_0x4b853a){_0x3b820f=_0x3b820f-0x0;var _0xaea152=_0x2e35[_0x3b820f];return _0xaea152;};'use strict';var ChatGroupEvents=require(_0x52e3('0x0'));var events=[_0x52e3('0x1'),_0x52e3('0x2'),'update'];function createListener(_0x145ad0,_0xcbe6c5){return function(_0x16d807){_0xcbe6c5[_0x52e3('0x3')](_0x145ad0,_0x16d807);};}function removeListener(_0x4ccab4,_0x158226){return function(){ChatGroupEvents[_0x52e3('0x4')](_0x4ccab4,_0x158226);};}exports[_0x52e3('0x5')]=function(_0x20d1bc){for(var _0x5f117a=0x0,_0x483b93=events['length'];_0x5f117a<_0x483b93;_0x5f117a++){var _0x21ae13=events[_0x5f117a];var _0x4d77a0=createListener('chatGroup:'+_0x21ae13,_0x20d1bc);ChatGroupEvents['on'](_0x21ae13,_0x4d77a0);}}; \ No newline at end of file +var _0xd240=['emit','length','chatGroup:','save'];(function(_0x196655,_0x3664e2){var _0x51e53f=function(_0x2514fe){while(--_0x2514fe){_0x196655['push'](_0x196655['shift']());}};_0x51e53f(++_0x3664e2);}(_0xd240,0x1c7));var _0x0d24=function(_0x3c2a4c,_0x192e2a){_0x3c2a4c=_0x3c2a4c-0x0;var _0x2fe014=_0xd240[_0x3c2a4c];return _0x2fe014;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x0d24('0x0'),'remove','update'];function createListener(_0x1c5100,_0x58d41c){return function(_0x24493f){_0x58d41c[_0x0d24('0x1')](_0x1c5100,_0x24493f);};}function removeListener(_0x359c54,_0x3dc015){return function(){ChatGroupEvents['removeListener'](_0x359c54,_0x3dc015);};}exports['register']=function(_0x30fbee){for(var _0x2accfe=0x0,_0x1005ff=events[_0x0d24('0x2')];_0x2accfe<_0x1005ff;_0x2accfe++){var _0x48fb91=events[_0x2accfe];var _0xdb2d81=createListener(_0x0d24('0x3')+_0x48fb91,_0x30fbee);ChatGroupEvents['on'](_0x48fb91,_0xdb2d81);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 5bfebf5..3fd2409 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 _0xf158=['getMessages','post','addMembers','/:id/messages','delete','destroy','removeMembers','exports','path','express','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','/:id/members','getMembers'];(function(_0x7725f,_0x501b7e){var _0x571443=function(_0x2e43d0){while(--_0x2e43d0){_0x7725f['push'](_0x7725f['shift']());}};_0x571443(++_0x501b7e);}(_0xf158,0x1d4));var _0x8f15=function(_0x5667d9,_0x33e536){_0x5667d9=_0x5667d9-0x0;var _0x1a508d=_0xf158[_0x5667d9];return _0x1a508d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f15('0x0'));var express=require(_0x8f15('0x1'));var router=express['Router']();var auth=require(_0x8f15('0x2'));var interaction=require(_0x8f15('0x3'));var config=require('../../config/environment');var controller=require(_0x8f15('0x4'));router[_0x8f15('0x5')]('/',auth['isAuthenticated'](),controller[_0x8f15('0x6')]);router[_0x8f15('0x5')](_0x8f15('0x7'),auth[_0x8f15('0x8')](),controller[_0x8f15('0x9')]);router[_0x8f15('0x5')](_0x8f15('0xa'),auth[_0x8f15('0x8')](),controller[_0x8f15('0xb')]);router[_0x8f15('0x5')](_0x8f15('0xc'),auth[_0x8f15('0x8')](),controller['getUnread']);router['get'](_0x8f15('0xd'),auth['isAuthenticated'](),controller[_0x8f15('0xe')]);router['get']('/:id/messages',auth[_0x8f15('0x8')](),controller[_0x8f15('0xf')]);router[_0x8f15('0x10')]('/',auth[_0x8f15('0x8')](),controller['create']);router[_0x8f15('0x10')](_0x8f15('0xd'),auth[_0x8f15('0x8')](),controller[_0x8f15('0x11')]);router[_0x8f15('0x10')](_0x8f15('0x12'),auth[_0x8f15('0x8')](),controller['addMessage']);router['put']('/:id',auth[_0x8f15('0x8')](),controller['update']);router[_0x8f15('0x13')](_0x8f15('0xa'),auth[_0x8f15('0x8')](),controller[_0x8f15('0x14')]);router['delete']('/:id/members',auth[_0x8f15('0x8')](),controller[_0x8f15('0x15')]);module[_0x8f15('0x16')]=router; \ No newline at end of file +var _0xfeb3=['addMembers','addMessage','put','update','delete','removeMembers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index','/describe','isAuthenticated','/:id','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','create','post','/:id/members'];(function(_0x25f94a,_0x39d7c1){var _0x29484c=function(_0x340d66){while(--_0x340d66){_0x25f94a['push'](_0x25f94a['shift']());}};_0x29484c(++_0x39d7c1);}(_0xfeb3,0x11f));var _0x3feb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfeb3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3feb('0x0'));var util=require(_0x3feb('0x1'));var path=require(_0x3feb('0x2'));var express=require(_0x3feb('0x3'));var router=express[_0x3feb('0x4')]();var auth=require(_0x3feb('0x5'));var interaction=require(_0x3feb('0x6'));var config=require('../../config/environment');var controller=require(_0x3feb('0x7'));router[_0x3feb('0x8')]('/',auth['isAuthenticated'](),controller[_0x3feb('0x9')]);router['get'](_0x3feb('0xa'),auth[_0x3feb('0xb')](),controller['describe']);router[_0x3feb('0x8')](_0x3feb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3feb('0x8')](_0x3feb('0xd'),auth['isAuthenticated'](),controller[_0x3feb('0xe')]);router[_0x3feb('0x8')]('/:id/members',auth[_0x3feb('0xb')](),controller[_0x3feb('0xf')]);router[_0x3feb('0x8')](_0x3feb('0x10'),auth[_0x3feb('0xb')](),controller[_0x3feb('0x11')]);router['post']('/',auth[_0x3feb('0xb')](),controller[_0x3feb('0x12')]);router[_0x3feb('0x13')](_0x3feb('0x14'),auth[_0x3feb('0xb')](),controller[_0x3feb('0x15')]);router[_0x3feb('0x13')](_0x3feb('0x10'),auth[_0x3feb('0xb')](),controller[_0x3feb('0x16')]);router[_0x3feb('0x17')](_0x3feb('0xc'),auth['isAuthenticated'](),controller[_0x3feb('0x18')]);router[_0x3feb('0x19')](_0x3feb('0xc'),auth[_0x3feb('0xb')](),controller['destroy']);router[_0x3feb('0x19')](_0x3feb('0x14'),auth[_0x3feb('0xb')](),controller[_0x3feb('0x1a')]);module[_0x3feb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index efd581a..91023db 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 _0xee5b=['sequelize','BOOLEAN','INTEGER','star','thumb','TEXT','DATE','STRING','ENUM','out'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4bf43a,_0x1412be){_0x4bf43a=_0x4bf43a-0x0;var _0x5d9995=_0xee5b[_0x4bf43a];return _0x5d9995;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'closed':{'type':Sequelize[_0xbee5('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbee5('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xbee5('0x3'),_0xbee5('0x4')),'defaultValue':_0xbee5('0x3')},'ratingMessage':{'type':Sequelize[_0xbee5('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbee5('0x6')]},'disposition':{'type':Sequelize[_0xbee5('0x7')]},'note':{'type':Sequelize[_0xbee5('0x7')]},'browserName':{'type':Sequelize[_0xbee5('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xbee5('0x7')]},'referer':{'type':Sequelize[_0xbee5('0x7')]},'customerIp':{'type':Sequelize[_0xbee5('0x7')]},'formData':{'type':Sequelize[_0xbee5('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xbee5('0x6')]},'lastMsgAt':{'type':Sequelize[_0xbee5('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xbee5('0x8')]('in',_0xbee5('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbee5('0x7')]}}; \ No newline at end of file +var _0xb7e7=['out','sequelize','BOOLEAN','ENUM','thumb','TEXT','STRING','DATE'];(function(_0x971146,_0x3b5d8f){var _0x29da37=function(_0x3f3ba8){while(--_0x3f3ba8){_0x971146['push'](_0x971146['shift']());}};_0x29da37(++_0x3b5d8f);}(_0xb7e7,0x121));var _0x7b7e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xb7e7[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x7b7e('0x2')]('star',_0x7b7e('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x7b7e('0x4')]},'pathTranscript':{'type':Sequelize[_0x7b7e('0x4')]},'mailTranscript':{'type':Sequelize[_0x7b7e('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7b7e('0x5')]},'browserName':{'type':Sequelize[_0x7b7e('0x5')]},'browserVersion':{'type':Sequelize[_0x7b7e('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7b7e('0x5')]},'deviceModel':{'type':Sequelize[_0x7b7e('0x5')]},'deviceVendor':{'type':Sequelize[_0x7b7e('0x5')]},'deviceType':{'type':Sequelize[_0x7b7e('0x5')]},'referer':{'type':Sequelize[_0x7b7e('0x5')]},'customerIp':{'type':Sequelize[_0x7b7e('0x5')]},'formData':{'type':Sequelize[_0x7b7e('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x7b7e('0x6')]},'lastMsgAt':{'type':Sequelize[_0x7b7e('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x7b7e('0x2')]('in',_0x7b7e('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7b7e('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4b4c819..676259f 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 _0x3516=['appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','order','sort','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','secret','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','localhost','./chatInteraction.socket','register','client','http','request','then','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','set','Content-Range','reject','update','destroy','end','name','index','ChatInteraction','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','limit','pick','add','day','merge','where','filter','map','options','include','tag','push','Tags','distinct','read','ChatMessage','Messages','createdAt','includeAll','User','fullname','CmContact','Owner','internal','ChatWebsite','Account','key','color','Tag','findAll','rows','params','create','body','find','catch','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Sequelize','ValidationError','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','filename','mimetype','Attachment','findOne','attachId','download','root','server/files/attachments/','basename','close','mailTranscript','join','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatWebsiteId','%s%d','agentAlias','System','customer','ContactId','agentIdentifier','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3516,0xc9));var _0x6351=function(_0x1c5282,_0x1f4c1b){_0x1c5282=_0x1c5282-0x0;var _0x5edbf6=_0x3516[_0x1c5282];return _0x5edbf6;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x6351('0x0'));var moment=require(_0x6351('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6351('0x2'));var util=require(_0x6351('0x3'));var path=require(_0x6351('0x4'));var sox=require('sox');var csv=require(_0x6351('0x5'));var ejs=require(_0x6351('0x6'));var fs=require('fs');var _=require(_0x6351('0x7'));var squel=require(_0x6351('0x8'));var crypto=require('crypto');var jsforce=require(_0x6351('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x6351('0x5'));var querystring=require(_0x6351('0xa'));var Papa=require(_0x6351('0xb'));var qs=require(_0x6351('0xc'));var logger=require(_0x6351('0xd'))(_0x6351('0xe'));var utils=require(_0x6351('0xf'));var config=require(_0x6351('0x10'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':_0x6351('0x11'),'port':0x18eb});require(_0x6351('0x12'))[_0x6351('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6351('0x14')][_0x6351('0x15')]({'port':0x232b});var client9004=jayson['client'][_0x6351('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x11b933,_0x2a3169,_0x42037e,_0x5e3fdb){return new BPromise(function(_0x2664a0,_0x5de5bb){var _0x38d853=_0x5e3fdb||client;return _0x38d853[_0x6351('0x16')](_0x11b933,_0x42037e)[_0x6351('0x17')](function(_0x20e78e){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2a3169,_0x6351('0x18'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2a3169,_0x6351('0x18'),JSON[_0x6351('0x19')](_0x20e78e));if(_0x20e78e[_0x6351('0x1a')]){if(_0x20e78e[_0x6351('0x1a')][_0x6351('0x1b')]===0x1f4){logger[_0x6351('0x1a')](_0x6351('0x1c'),_0x2a3169,_0x20e78e['error'][_0x6351('0x1d')]);return _0x5de5bb(_0x20e78e[_0x6351('0x1a')][_0x6351('0x1d')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2a3169,_0x20e78e[_0x6351('0x1a')][_0x6351('0x1d')]);return _0x2664a0(_0x20e78e['error'][_0x6351('0x1d')]);}else{logger['info'](_0x6351('0x1c'),_0x2a3169,_0x6351('0x18'));_0x2664a0(_0x20e78e[_0x6351('0x1e')]['message']);}})['catch'](function(_0x362077){logger[_0x6351('0x1a')](_0x6351('0x1c'),_0x2a3169,_0x362077);_0x5de5bb(_0x362077);});});}function respondWithStatusCode(_0x147082,_0x4a7926){_0x4a7926=_0x4a7926||0xcc;return function(_0x27fbdc){if(_0x27fbdc){return _0x147082[_0x6351('0x1f')](_0x4a7926);}return _0x147082[_0x6351('0x20')](_0x4a7926)['end']();};}function respondWithResult(_0x4fb6e9,_0x51ec1f){_0x51ec1f=_0x51ec1f||0xc8;return function(_0x5d2071){if(_0x5d2071){return _0x4fb6e9['status'](_0x51ec1f)[_0x6351('0x21')](_0x5d2071);}};}function respondWithFilteredResult(_0x2f21b0,_0x2755ef){return function(_0x30ccee){if(_0x30ccee){var _0x422902=_0x30ccee[_0x6351('0x22')],_0x1b2a16=_0x2755ef[_0x6351('0x23')],_0x223c16=_0x2755ef[_0x6351('0x23')]+_0x2755ef['limit'],_0xf080f6;if(_0x223c16>=_0x422902){_0x223c16=_0x422902;_0xf080f6=0xc8;}else{_0xf080f6=0xce;}_0x2f21b0[_0x6351('0x20')](_0xf080f6);return _0x2f21b0[_0x6351('0x24')](_0x6351('0x25'),_0x1b2a16+'-'+_0x223c16+'/'+_0x422902)['json'](_0x30ccee);}return null;};}function patchUpdates(_0x1cc0f5){return function(_0x303a39){try{jsonpatch['apply'](_0x303a39,_0x1cc0f5,!![]);}catch(_0xbc75f2){return BPromise[_0x6351('0x26')](_0xbc75f2);}return _0x303a39['save']();};}function saveUpdates(_0x337900,_0x2f3787){return function(_0x9baa0d){if(_0x9baa0d){return _0x9baa0d[_0x6351('0x27')](_0x337900)[_0x6351('0x17')](function(_0x436c92){return _0x436c92;});}return null;};}function removeEntity(_0x4734df,_0xa06cd3){return function(_0x36d7c8){if(_0x36d7c8){return _0x36d7c8[_0x6351('0x28')]()[_0x6351('0x17')](function(){_0x4734df[_0x6351('0x20')](0xcc)[_0x6351('0x29')]();});}};}function handleEntityNotFound(_0xf6e8,_0x291bd7){return function(_0x4109ca){if(!_0x4109ca){_0xf6e8[_0x6351('0x1f')](0x194);}return _0x4109ca;};}function handleError(_0x2a15a0,_0x58ba80){_0x58ba80=_0x58ba80||0x1f4;return function(_0x7ae37){logger[_0x6351('0x1a')](_0x7ae37['stack']);if(_0x7ae37[_0x6351('0x2a')]){delete _0x7ae37[_0x6351('0x2a')];}_0x2a15a0[_0x6351('0x20')](_0x58ba80)['send'](_0x7ae37);};}exports[_0x6351('0x2b')]=function(_0x46a986,_0x1ba215){var _0x38ec85={},_0x1fda46={},_0x2234ff={'count':0x0,'rows':[]};var _0x348595=db[_0x6351('0x2c')][_0x6351('0x2d')];_0x1fda46[_0x6351('0x2e')]=_[_0x6351('0x2f')](_0x348595);var _0x28beed={'dateStart':_0x46a986[_0x6351('0x30')]['dateStart'],'dateEnd':_0x46a986[_0x6351('0x30')]['dateEnd']};delete _0x46a986[_0x6351('0x30')][_0x6351('0x31')];delete _0x46a986[_0x6351('0x30')][_0x6351('0x32')];_0x1fda46['query']=_[_0x6351('0x2f')](_0x46a986['query']);_0x1fda46[_0x6351('0x33')]=_['intersection'](_0x1fda46[_0x6351('0x2e')],_0x1fda46[_0x6351('0x30')]);_0x38ec85[_0x6351('0x34')]=_[_0x6351('0x35')](_0x1fda46[_0x6351('0x2e')],qs['fields'](_0x46a986[_0x6351('0x30')][_0x6351('0x36')]));_0x38ec85['attributes']=_0x38ec85[_0x6351('0x34')][_0x6351('0x37')]?_0x38ec85['attributes']:_0x1fda46['model'];if(!_0x46a986[_0x6351('0x30')]['hasOwnProperty'](_0x6351('0x38'))){_0x38ec85[_0x6351('0x39')]=qs[_0x6351('0x39')](_0x46a986[_0x6351('0x30')][_0x6351('0x39')]);_0x38ec85[_0x6351('0x23')]=qs[_0x6351('0x23')](_0x46a986[_0x6351('0x30')][_0x6351('0x23')]);}_0x38ec85['order']=qs['sort'](_0x46a986['query']['sort']);_0x38ec85['where']=qs[_0x6351('0x33')](_[_0x6351('0x3a')](_0x46a986['query'],_0x1fda46[_0x6351('0x33')]));if(_0x28beed[_0x6351('0x31')]){if(_0x28beed[_0x6351('0x32')]){_0x28beed[_0x6351('0x32')]=moment(_0x28beed['dateEnd'])['add'](0x1,'day');}else{_0x28beed['dateEnd']=moment(_0x28beed['dateStart'])[_0x6351('0x3b')](0x1,_0x6351('0x3c'));}_[_0x6351('0x3d')](_0x38ec85[_0x6351('0x3e')],{'createdAt':{'$gte':_0x28beed[_0x6351('0x31')],'$lte':_0x28beed['dateEnd']}});}if(_0x46a986['query'][_0x6351('0x3f')]){_0x38ec85[_0x6351('0x3e')]=_[_0x6351('0x3d')](_0x38ec85['where'],{'$or':_[_0x6351('0x40')](_0x38ec85[_0x6351('0x34')],function(_0x327f3a){var _0xe0cb33={};_0xe0cb33[_0x327f3a]={'$like':'%'+_0x46a986[_0x6351('0x30')][_0x6351('0x3f')]+'%'};return _0xe0cb33;})});}_0x38ec85=_[_0x6351('0x3d')]({},_0x38ec85,_0x46a986[_0x6351('0x41')]);var _0x308929={'where':_0x38ec85[_0x6351('0x3e')]};_0x308929[_0x6351('0x42')]=[];if(_0x46a986[_0x6351('0x30')][_0x6351('0x43')]){_0x308929[_0x6351('0x42')][_0x6351('0x44')]({'model':db['Tag'],'as':_0x6351('0x45'),'attributes':['id'],'where':{'id':_0x46a986['query'][_0x6351('0x43')]},'required':!![]});_0x308929[_0x6351('0x46')]=!![];}if(_0x46a986[_0x6351('0x30')][_0x6351('0x47')]){_0x308929['include'][_0x6351('0x44')]({'model':db[_0x6351('0x48')],'as':_0x6351('0x49'),'attributes':['id','direction',_0x6351('0x4a'),_0x6351('0x47')],'where':{'direction':'in','read':_0x46a986['query'][_0x6351('0x47')]||![]},'required':!![]});_0x308929[_0x6351('0x46')]=!![];}return db[_0x6351('0x2c')][_0x6351('0x22')](_0x308929)[_0x6351('0x17')](function(_0x47fea7){_0x2234ff[_0x6351('0x22')]=_0x47fea7;if(_0x46a986['query'][_0x6351('0x4b')]){_0x38ec85[_0x6351('0x42')]=[{'model':db[_0x6351('0x4c')],'as':'Users','required':![],'attributes':['id','name',_0x6351('0x4d')]},{'model':db[_0x6351('0x4e')],'as':'Contact','required':![]},{'model':db[_0x6351('0x4c')],'as':_0x6351('0x4f'),'attributes':['name','fullname',_0x6351('0x50')],'required':![]},{'model':db[_0x6351('0x51')],'as':_0x6351('0x52'),'attributes':[_0x6351('0x2a'),_0x6351('0x53')],'required':![]},{'model':db[_0x6351('0x48')],'as':_0x6351('0x49'),'attributes':['id','direction',_0x6351('0x4a'),_0x6351('0x47')],'where':{'direction':'in','read':_0x46a986[_0x6351('0x30')]['read']||![]},'required':_0x46a986[_0x6351('0x30')][_0x6351('0x47')]||![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x6351('0x2a'),_0x6351('0x54')],'required':_0x46a986[_0x6351('0x30')][_0x6351('0x43')]?!![]:![]},{'model':db[_0x6351('0x55')],'as':'ThroughTags','attributes':['id','name','color'],'through':_0x46a986[_0x6351('0x30')][_0x6351('0x43')]?{'attributes':[],'where':{'TagId':_0x46a986[_0x6351('0x30')]['tag']||undefined}}:{},'required':_0x46a986[_0x6351('0x30')][_0x6351('0x43')]?!![]:![]}];}return db[_0x6351('0x2c')][_0x6351('0x56')](_0x38ec85);})['then'](function(_0x43fbf0){_0x2234ff[_0x6351('0x57')]=_0x43fbf0;return _0x2234ff;})['then'](respondWithFilteredResult(_0x1ba215,_0x38ec85))['catch'](handleError(_0x1ba215,null));};exports['show']=function(_0x1f145d,_0x56958f){var _0x40b0d6={'raw':![],'where':{'id':_0x1f145d[_0x6351('0x58')]['id']}},_0x56692e={};_0x56692e[_0x6351('0x2e')]=_[_0x6351('0x2f')](db[_0x6351('0x2c')]['rawAttributes']);_0x56692e[_0x6351('0x30')]=_[_0x6351('0x2f')](_0x1f145d['query']);_0x56692e[_0x6351('0x33')]=_[_0x6351('0x35')](_0x56692e['model'],_0x56692e[_0x6351('0x30')]);_0x40b0d6[_0x6351('0x34')]=_[_0x6351('0x35')](_0x56692e['model'],qs['fields'](_0x1f145d[_0x6351('0x30')][_0x6351('0x36')]));_0x40b0d6['attributes']=_0x40b0d6[_0x6351('0x34')][_0x6351('0x37')]?_0x40b0d6[_0x6351('0x34')]:_0x56692e['model'];if(_0x1f145d[_0x6351('0x30')]['includeAll']){_0x40b0d6[_0x6351('0x42')]=[{'all':!![]}];}_0x40b0d6=_[_0x6351('0x3d')]({},_0x40b0d6,_0x1f145d[_0x6351('0x41')]);return db[_0x6351('0x2c')]['find'](_0x40b0d6)[_0x6351('0x17')](handleEntityNotFound(_0x56958f,null))[_0x6351('0x17')](respondWithResult(_0x56958f,null))['catch'](handleError(_0x56958f,null));};exports[_0x6351('0x59')]=function(_0x963ed7,_0x2fe664){return db['ChatInteraction'][_0x6351('0x59')](_0x963ed7[_0x6351('0x5a')],{})[_0x6351('0x17')](respondWithResult(_0x2fe664,0xc9))['catch'](handleError(_0x2fe664,null));};exports['update']=function(_0x425281,_0x1758bd){if(_0x425281['body']['id']){delete _0x425281[_0x6351('0x5a')]['id'];}return db[_0x6351('0x2c')][_0x6351('0x5b')]({'where':{'id':_0x425281[_0x6351('0x58')]['id']}})[_0x6351('0x17')](handleEntityNotFound(_0x1758bd,null))['then'](saveUpdates(_0x425281[_0x6351('0x5a')],null))[_0x6351('0x17')](respondWithResult(_0x1758bd,null))['catch'](handleError(_0x1758bd,null));};exports[_0x6351('0x28')]=function(_0x15a2d1,_0x10e310){return db[_0x6351('0x2c')][_0x6351('0x5b')]({'where':{'id':_0x15a2d1[_0x6351('0x58')]['id']}})['then'](handleEntityNotFound(_0x10e310,null))[_0x6351('0x17')](removeEntity(_0x10e310,null))[_0x6351('0x5c')](handleError(_0x10e310,null));};exports['describe']=function(_0x199f41,_0x555937){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x555937,null))[_0x6351('0x5c')](handleError(_0x555937,null));};exports[_0x6351('0x5d')]=function(_0x807e25,_0x254164){if(_0x807e25['body']['id']){delete _0x807e25['body']['id'];}return db[_0x6351('0x2c')][_0x6351('0x5b')]({'where':{'id':_0x807e25[_0x6351('0x58')]['id']}})[_0x6351('0x17')](handleEntityNotFound(_0x254164,null))[_0x6351('0x17')](saveUpdates(_0x807e25['body'],null))['then'](respondWithResult(_0x254164,null))[_0x6351('0x5c')](handleError(_0x254164,null));};exports[_0x6351('0x5e')]=function(_0x2ca8f9,_0x2335da,_0x5949ad){if(_0x2ca8f9[_0x6351('0x5a')]['id']){delete _0x2ca8f9[_0x6351('0x5a')]['id'];}return db['ChatInteraction'][_0x6351('0x5b')]({'where':{'id':_0x2ca8f9['params']['id']}})['then'](function(_0x15ff22){if(!_0x15ff22){logger['error'](_0x6351('0x5f'),_0x6351('0x5e'),0x194,_0x6351('0x60'));_0x2335da[_0x6351('0x1f')](0x194);}else{if(_0x15ff22[_0x6351('0x61')]){throw new db[(_0x6351('0x62'))][(_0x6351('0x63'))](_0x6351('0x64'));}}return _0x15ff22;})[_0x6351('0x17')](function(_0x5647e9){if(_0x5647e9){return _0x5647e9[_0x6351('0x27')]({'closed':_0x2ca8f9[_0x6351('0x5a')][_0x6351('0x65')],'closedAt':_0x2ca8f9[_0x6351('0x5a')]['closedAt'],'disposition':_0x2ca8f9[_0x6351('0x5a')][_0x6351('0x66')]})[_0x6351('0x17')](function(_0x588e0b){return _0x588e0b;});}})[_0x6351('0x17')](function(_0x431d6d){return respondWithRpcPromise(_0x6351('0x67'),'abandon',_0x2ca8f9['body'],client9004);})['then'](respondWithResult(_0x2335da,null))['catch'](handleError(_0x2335da,null));};exports['attachmentUpload']=function(_0x5b4524,_0x1ff23f,_0x3b0150){_0x5b4524[_0x6351('0x5a')][_0x6351('0x2a')]=_0x5b4524[_0x6351('0x68')][_0x6351('0x69')];_0x5b4524[_0x6351('0x5a')]['basename']=_0x5b4524[_0x6351('0x68')][_0x6351('0x6a')];_0x5b4524[_0x6351('0x5a')]['type']=_0x5b4524['file'][_0x6351('0x6b')];return db[_0x6351('0x6c')][_0x6351('0x59')](_0x5b4524[_0x6351('0x5a')])[_0x6351('0x17')](respondWithResult(_0x1ff23f,0xc9))[_0x6351('0x5c')](handleError(_0x1ff23f,null));};exports['attachmentDownload']=function(_0x1648e0,_0x4eaa2b,_0xc653f8){return db['ChatInteraction'][_0x6351('0x6d')]({'where':{'id':_0x1648e0['params']['id']},'raw':!![]})[_0x6351('0x17')](handleEntityNotFound(_0x4eaa2b,null))[_0x6351('0x17')](function(_0xdf1e13){if(_0xdf1e13){if(_0xdf1e13[_0x6351('0x65')]){return _0x4eaa2b[_0x6351('0x20')](0x193)[_0x6351('0x21')]({'status':0x193,'message':'Unauthorized'});}return db[_0x6351('0x6c')][_0x6351('0x6d')]({'where':{'id':_0x1648e0[_0x6351('0x30')][_0x6351('0x6e')]},'raw':!![]})['then'](handleEntityNotFound(_0x4eaa2b,null));}})[_0x6351('0x17')](function(_0x5c9206){if(_0x5c9206){return _0x4eaa2b[_0x6351('0x6f')](path['join'](config[_0x6351('0x70')],_0x6351('0x71'),_0x5c9206[_0x6351('0x72')]));}})[_0x6351('0x5c')](handleError(_0x4eaa2b,null));};exports[_0x6351('0x73')]=function(_0x4afe77,_0x5ab0e3){var _0x2ce82a=null;var _0x4c42b5=null;var _0x16ed21=null;var _0x16d9ee=null;if(_0x4afe77[_0x6351('0x5a')]['id']){delete _0x4afe77['body']['id'];}if(_0x4afe77[_0x6351('0x5a')][_0x6351('0x74')]){_0x16d9ee=path[_0x6351('0x75')](config['root'],_0x6351('0x76'),util[_0x6351('0x77')](_0x6351('0x78'),Date[_0x6351('0x79')]()));_0x4afe77['body'][_0x6351('0x7a')]=_0x16d9ee;}return db['ChatInteraction'][_0x6351('0x5b')]({'where':{'id':_0x4afe77[_0x6351('0x58')]['id']},'include':[{'model':db[_0x6351('0x48')],'as':_0x6351('0x49'),'include':[{'model':db[_0x6351('0x4c')],'as':_0x6351('0x4c')}]}]})[_0x6351('0x17')](handleEntityNotFound(_0x5ab0e3,null))['then'](saveUpdates(_0x4afe77[_0x6351('0x5a')],null))[_0x6351('0x17')](function(_0x5ef56b){if(_0x5ef56b){_0x2ce82a=_0x5ef56b;return db[_0x6351('0x51')][_0x6351('0x5b')]({'where':{'id':_0x2ce82a[_0x6351('0x7b')]}});}})[_0x6351('0x17')](function(_0x4987de){if(_0x4987de){_0x16ed21=_0x4987de;return db[_0x6351('0x4e')]['find']({'where':{'id':_0x2ce82a['ContactId']}});}})[_0x6351('0x17')](function(_0xb22b39){if(_0xb22b39){_0x4c42b5=_0xb22b39;if(_0x16d9ee){var _0x37d425=null;for(var _0x40abab=0x1;_0x40abab<_0x2ce82a['Messages'][_0x6351('0x37')];++_0x40abab){_0x37d425=_0x2ce82a[_0x6351('0x49')][_0x40abab];var _0x1d0970=_0x37d425[_0x6351('0x61')]?util[_0x6351('0x77')](_0x6351('0x7c'),_0x16ed21[_0x6351('0x7d')],_0x37d425[_0x6351('0x61')]):_0x6351('0x7e');var _0x433ac8=_0x4afe77[_0x6351('0x5a')][_0x6351('0x7f')]||util[_0x6351('0x77')](_0x6351('0x7c'),'Visitor',_0x37d425[_0x6351('0x80')]);switch(_0x16ed21[_0x6351('0x81')]){case'website_alias':_0x1d0970=_0x37d425[_0x6351('0x61')]?util[_0x6351('0x77')](_0x6351('0x7c'),_0x16ed21[_0x6351('0x7d')],_0x37d425['UserId']):_0x6351('0x7e');break;case'agent_alias':_0x1d0970=_0x37d425['UserId']?_0x37d425[_0x6351('0x4c')][_0x6351('0x82')]||_0x37d425[_0x6351('0x4c')]['fullname']:_0x6351('0x7e');break;case'agent_fullname':_0x1d0970=_0x37d425[_0x6351('0x61')]?_0x37d425[_0x6351('0x4c')]['fullname']:_0x6351('0x7e');break;default:_0x1d0970=_0x37d425[_0x6351('0x61')]?util[_0x6351('0x77')](_0x6351('0x7c'),_0x16ed21[_0x6351('0x7d')],_0x37d425[_0x6351('0x61')]):'System';}var _0x56a04b=util[_0x6351('0x77')](_0x6351('0x83'),moment(_0x37d425['createdAt'])['format'](_0x6351('0x84')),_0x37d425['direction']==='in'?_0x433ac8:_0x1d0970,_0x37d425[_0x6351('0x5a')]);if(!_0x37d425['secret']){fs[_0x6351('0x85')](_0x16d9ee,_0x56a04b);}}return db[_0x6351('0x86')][_0x6351('0x6d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x6351('0x87'),'raw':!![]}]});}}})[_0x6351('0x17')](function(_0x4b11ac){if(_0x4b11ac&&_0x4b11ac[_0x6351('0x87')]&&_0x4afe77[_0x6351('0x5a')]){var _0x5405c6={'tls':{'rejectUnauthorized':![]}};if(_0x4b11ac[_0x6351('0x87')][_0x6351('0x88')]){_0x5405c6[_0x6351('0x88')]=_0x4b11ac['Smtp']['service'];}else{_0x5405c6['host']=_0x4b11ac[_0x6351('0x87')][_0x6351('0x89')];_0x5405c6[_0x6351('0x8a')]=_0x4b11ac[_0x6351('0x87')][_0x6351('0x8a')];_0x5405c6['secure']=_0x4b11ac[_0x6351('0x87')][_0x6351('0x8b')];}if(_0x4b11ac['Smtp'][_0x6351('0x8c')]){_0x5405c6[_0x6351('0x8d')]={'user':_0x4b11ac[_0x6351('0x87')][_0x6351('0x8e')],'pass':_0x4b11ac[_0x6351('0x87')][_0x6351('0x8f')]};}return respondWithRpcPromise(_0x6351('0x90'),_0x6351('0x91'),{'account':_0x5405c6,'message':{'from':util['format'](_0x6351('0x92'),_0x4b11ac[_0x6351('0x2a')],_0x4b11ac['email']||_0x4b11ac['Smtp'][_0x6351('0x8e')]),'to':_0x4afe77[_0x6351('0x5a')][_0x6351('0x74')],'subject':_0x6351('0x93'),'text':util[_0x6351('0x77')](_0x6351('0x94'),_0x4afe77['body'][_0x6351('0x74')]),'attachments':[{'path':_0x16d9ee}]}})[_0x6351('0x17')](function(){return _0x2ce82a;})['catch'](function(_0x540efc){console[_0x6351('0x1a')](_0x540efc);});}else{return _0x2ce82a;}})[_0x6351('0x17')](respondWithStatusCode(_0x5ab0e3,0xc8))[_0x6351('0x5c')](handleError(_0x5ab0e3,null));};exports[_0x6351('0x95')]=function(_0x454d07,_0xaebdc0,_0x4900ea){return db[_0x6351('0x48')]['find']({'where':{'id':_0x454d07['params']['id']}})[_0x6351('0x17')](handleEntityNotFound(_0xaebdc0,null))[_0x6351('0x17')](function(_0x498426){if(_0x498426){return _0x498426[_0x6351('0x95')](_0x454d07[_0x6351('0x5a')][_0x6351('0x96')],_[_0x6351('0x97')](_0x454d07[_0x6351('0x5a')],[_0x6351('0x96'),'id'])||{});}})['then'](respondWithResult(_0xaebdc0,null))['catch'](handleError(_0xaebdc0,null));};exports[_0x6351('0x98')]=function(_0x2cf62d,_0x258528,_0x27031c){var _0x2ecc3f={'raw':![],'where':{}};var _0x40d70d={};var _0x1cc2dc={'count':0x0,'rows':[]};return db[_0x6351('0x2c')][_0x6351('0x6d')]({'where':{'id':_0x2cf62d[_0x6351('0x58')]['id']}})[_0x6351('0x17')](handleEntityNotFound(_0x258528,null))[_0x6351('0x17')](function(_0x263642){if(_0x263642){_0x40d70d[_0x6351('0x2e')]=_[_0x6351('0x2f')](db[_0x6351('0x48')]['rawAttributes']);_0x40d70d[_0x6351('0x30')]=_['keys'](_0x2cf62d['query']);_0x40d70d[_0x6351('0x33')]=_['intersection'](_0x40d70d[_0x6351('0x2e')],_0x40d70d['query']);_0x2ecc3f['attributes']=_[_0x6351('0x35')](_0x40d70d[_0x6351('0x2e')],qs[_0x6351('0x36')](_0x2cf62d[_0x6351('0x30')][_0x6351('0x36')]));_0x2ecc3f[_0x6351('0x34')]=_0x2ecc3f[_0x6351('0x34')]['length']?_0x2ecc3f['attributes']:_0x40d70d[_0x6351('0x2e')];if(!_0x2cf62d[_0x6351('0x30')][_0x6351('0x99')](_0x6351('0x38'))){_0x2ecc3f['limit']=qs[_0x6351('0x39')](_0x2cf62d['query'][_0x6351('0x39')]);_0x2ecc3f[_0x6351('0x23')]=qs[_0x6351('0x23')](_0x2cf62d[_0x6351('0x30')][_0x6351('0x23')]);}_0x2ecc3f[_0x6351('0x9a')]=qs[_0x6351('0x9b')](_0x2cf62d[_0x6351('0x30')]['sort']);_0x2ecc3f[_0x6351('0x3e')]=qs[_0x6351('0x33')](_[_0x6351('0x3a')](_0x2cf62d[_0x6351('0x30')],_0x40d70d[_0x6351('0x33')]));_0x2ecc3f['where']['ChatInteractionId']=_0x263642['id'];if(_0x2cf62d[_0x6351('0x30')][_0x6351('0x3f')]){_0x2ecc3f['where']=_[_0x6351('0x3d')](_0x2ecc3f[_0x6351('0x3e')],{'$or':_[_0x6351('0x40')](_0x2ecc3f[_0x6351('0x34')],function(_0x42a2df){var _0x1c6c4e={};_0x1c6c4e[_0x42a2df]={'$like':'%'+_0x2cf62d[_0x6351('0x30')]['filter']+'%'};return _0x1c6c4e;})});}if(_0x2cf62d[_0x6351('0x30')][_0x6351('0x9c')]){var _0xde9b43=_0x2cf62d['query'][_0x6351('0x9c')][_0x6351('0x9d')](',');var _0x454b04={};_0x454b04[_0xde9b43[0x0]]={'$gte':moment(_0xde9b43[0x1])[_0x6351('0x77')](_0x6351('0x9e'))};_0x2ecc3f[_0x6351('0x3e')]=_[_0x6351('0x3d')](_0x2ecc3f[_0x6351('0x3e')],_0x454b04);}_0x2ecc3f=_[_0x6351('0x3d')]({},_0x2ecc3f,_0x2cf62d[_0x6351('0x41')]);return db[_0x6351('0x48')][_0x6351('0x22')]({'where':_0x2ecc3f['where']})['then'](function(_0x69fd29){_0x1cc2dc[_0x6351('0x22')]=_0x69fd29;if(_0x2cf62d[_0x6351('0x30')][_0x6351('0x4b')]){_0x2ecc3f[_0x6351('0x42')]=[{'all':!![]}];}return db[_0x6351('0x48')][_0x6351('0x56')](_0x2ecc3f);})[_0x6351('0x17')](function(_0x474c49){_0x1cc2dc[_0x6351('0x57')]=_0x474c49;return _0x1cc2dc;});}})[_0x6351('0x17')](respondWithFilteredResult(_0x258528,_0x2ecc3f))['catch'](handleError(_0x258528,null));};exports[_0x6351('0x9f')]=function(_0x577dd7,_0x17285d,_0x4150be){var _0x47f564={'where':{}},_0x1eeb67={},_0x485bfb={'count':0x0,'rows':[]};return db[_0x6351('0x2c')][_0x6351('0x6d')]({'where':{'id':_0x577dd7[_0x6351('0x58')]['id']}})[_0x6351('0x17')](handleEntityNotFound(_0x17285d,null))[_0x6351('0x17')](function(_0x334a8d){if(_0x334a8d){_0x1eeb67[_0x6351('0x2e')]=_[_0x6351('0x2f')](db[_0x6351('0x48')][_0x6351('0x2d')]);_0x1eeb67['query']=_[_0x6351('0x2f')](_0x577dd7[_0x6351('0x30')]);_0x1eeb67['filters']=_[_0x6351('0x35')](_0x1eeb67['model'],_0x1eeb67[_0x6351('0x30')]);_0x47f564[_0x6351('0x34')]=_[_0x6351('0x35')](_0x1eeb67[_0x6351('0x2e')],qs[_0x6351('0x36')](_0x577dd7[_0x6351('0x30')][_0x6351('0x36')]));_0x47f564['attributes']=_0x47f564[_0x6351('0x34')][_0x6351('0x37')]?_0x47f564[_0x6351('0x34')]:_0x1eeb67[_0x6351('0x2e')];if(!_0x577dd7[_0x6351('0x30')][_0x6351('0x99')](_0x6351('0x38'))){_0x47f564[_0x6351('0x39')]=qs[_0x6351('0x39')](_0x577dd7['query']['limit']);_0x47f564[_0x6351('0x23')]=qs[_0x6351('0x23')](_0x577dd7['query'][_0x6351('0x23')]);}_0x47f564['order']=qs[_0x6351('0x9b')](_0x577dd7[_0x6351('0x30')][_0x6351('0x9b')]);_0x47f564['where']=qs[_0x6351('0x33')](_[_0x6351('0x3a')](_0x577dd7[_0x6351('0x30')],_0x1eeb67[_0x6351('0x33')]));_0x47f564[_0x6351('0x3e')]['ChatInteractionId']=_0x334a8d['id'];if(_0x577dd7['query'][_0x6351('0x3f')]){_0x47f564[_0x6351('0x3e')]=_['merge'](_0x47f564['where'],{'$or':_[_0x6351('0x40')](_0x47f564['attributes'],function(_0x1ac04f){var _0x1d4474={};_0x1d4474[_0x1ac04f]={'$like':'%'+_0x577dd7[_0x6351('0x30')][_0x6351('0x3f')]+'%'};return _0x1d4474;})});}_0x47f564[_0x6351('0x3e')][_0x6351('0xa0')]=![];if(_0x577dd7[_0x6351('0x30')]['id']){_0x47f564['where']['id']={'$gt':_0x577dd7[_0x6351('0x30')]['id']};}_0x47f564=_[_0x6351('0x3d')]({},_0x47f564,_0x577dd7[_0x6351('0x41')]);return db[_0x6351('0x48')][_0x6351('0x22')]({'where':_0x47f564[_0x6351('0x3e')]})[_0x6351('0x17')](function(_0x52751c){_0x485bfb[_0x6351('0x22')]=_0x52751c;_0x47f564[_0x6351('0x42')]=[];if(_0x577dd7[_0x6351('0x30')][_0x6351('0xa1')]){_0x47f564[_0x6351('0x42')][_0x6351('0x44')]({'model':db[_0x6351('0x4c')],'as':_0x6351('0x4c'),'attributes':['id','fullname',_0x6351('0x82')]});}if(_0x577dd7['query'][_0x6351('0x4b')]){_0x47f564['include']=[{'all':!![]}];}return db[_0x6351('0x48')]['findAll'](_0x47f564);})[_0x6351('0x17')](function(_0x2d120d){_0x485bfb[_0x6351('0x57')]=_0x2d120d;return _0x485bfb;});}})['then'](respondWithFilteredResult(_0x17285d,_0x47f564))[_0x6351('0x5c')](handleError(_0x17285d,null));};exports['addTags']=function(_0x12bea0,_0x23c360,_0x5aaa57){return db['ChatInteraction']['find']({'where':{'id':_0x12bea0[_0x6351('0x58')]['id']}})[_0x6351('0x17')](handleEntityNotFound(_0x23c360,null))[_0x6351('0x17')](function(_0x3f2bee){if(_0x3f2bee){return _0x3f2bee[_0x6351('0xa2')](_0x12bea0['body'][_0x6351('0x96')],_[_0x6351('0x97')](_0x12bea0['body'],[_0x6351('0x96'),'id'])||{})[_0x6351('0xa3')](function(){return db[_0x6351('0x55')]['findAll']({'attributes':['id',_0x6351('0x2a'),_0x6351('0x54')],'where':{'id':_0x12bea0['body']['ids']}});})[_0x6351('0x17')](function(_0x345ae5){socket[_0x6351('0xa4')](_0x6351('0xa5'),{'id':Number(_0x12bea0['params']['id']),'tags':_0x345ae5||[]});return{'id':Number(_0x12bea0['params']['id']),'tags':_0x345ae5||[]};});}})[_0x6351('0x17')](respondWithResult(_0x23c360,null))['catch'](handleError(_0x23c360,null));};exports[_0x6351('0xa6')]=function(_0x4ea169,_0x3d70b2,_0x401749){var _0x3bc1af;return db[_0x6351('0x2c')]['find']({'where':{'id':_0x4ea169[_0x6351('0x58')]['id']}})[_0x6351('0x17')](handleEntityNotFound(_0x3d70b2,null))[_0x6351('0x17')](function(_0x22b6d2){if(_0x22b6d2){return _0x22b6d2[_0x6351('0xa6')](_0x4ea169[_0x6351('0x30')]['ids']);}})[_0x6351('0x17')](respondWithStatusCode(_0x3d70b2,null))[_0x6351('0x5c')](handleError(_0x3d70b2,null));}; \ No newline at end of file +var _0x0e1c=['catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','stack','index','ChatInteraction','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','add','day','merge','where','filter','map','include','push','tag','read','ChatMessage','Messages','distinct','includeAll','User','Users','name','fullname','CmContact','Contact','Owner','internal','ChatWebsite','Account','key','direction','createdAt','Tags','color','Tag','findAll','rows','params','options','find','create','body','update','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Sequelize','ValidationError','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','type','mimetype','attachmentDownload','Unauthorized','Attachment','findOne','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatWebsiteId','ContactId','%s%d','agentAlias','System','customer','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','user','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','order','$gte','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','ChatInteractionId','includeAgent','addTags','setTags','emit','chatInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result'];(function(_0x4dc11a,_0x4b90f4){var _0x35f697=function(_0x106760){while(--_0x106760){_0x4dc11a['push'](_0x4dc11a['shift']());}};_0x35f697(++_0x4b90f4);}(_0x0e1c,0x140));var _0xc0e1=function(_0x50823f,_0x4a3c61){_0x50823f=_0x50823f-0x0;var _0x35561c=_0x0e1c[_0x50823f];return _0x35561c;};'use strict';var jsonpatch=require(_0xc0e1('0x0'));var rp=require(_0xc0e1('0x1'));var moment=require(_0xc0e1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc0e1('0x3'));var util=require(_0xc0e1('0x4'));var path=require(_0xc0e1('0x5'));var sox=require(_0xc0e1('0x6'));var csv=require(_0xc0e1('0x7'));var ejs=require(_0xc0e1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc0e1('0x9'));var crypto=require('crypto');var jsforce=require(_0xc0e1('0xa'));var deskjs=require(_0xc0e1('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc0e1('0xc'));var Papa=require(_0xc0e1('0xd'));var qs=require(_0xc0e1('0xe'));var logger=require(_0xc0e1('0xf'))('api');var utils=require(_0xc0e1('0x10'));var config=require(_0xc0e1('0x11'));var db=require(_0xc0e1('0x12'))['db'];var socket=require(_0xc0e1('0x13'))({'host':_0xc0e1('0x14'),'port':0x18eb});require(_0xc0e1('0x15'))[_0xc0e1('0x16')](socket);var jayson=require(_0xc0e1('0x17'));var client=jayson[_0xc0e1('0x18')]['http']({'port':0x232b});var client9004=jayson[_0xc0e1('0x18')][_0xc0e1('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x57ff11,_0x17ba53,_0x45d693,_0xc4cd16){return new BPromise(function(_0x2e956d,_0x3fe4a4){var _0x51809d=_0xc4cd16||client;return _0x51809d[_0xc0e1('0x1a')](_0x57ff11,_0x45d693)[_0xc0e1('0x1b')](function(_0x2d761e){logger[_0xc0e1('0x1c')](_0xc0e1('0x1d'),_0x17ba53,'request\x20sent');logger[_0xc0e1('0x1e')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x17ba53,_0xc0e1('0x1f'),JSON[_0xc0e1('0x20')](_0x2d761e));if(_0x2d761e[_0xc0e1('0x21')]){if(_0x2d761e[_0xc0e1('0x21')]['code']===0x1f4){logger[_0xc0e1('0x21')](_0xc0e1('0x1d'),_0x17ba53,_0x2d761e['error']['message']);return _0x3fe4a4(_0x2d761e[_0xc0e1('0x21')][_0xc0e1('0x22')]);}logger[_0xc0e1('0x21')](_0xc0e1('0x1d'),_0x17ba53,_0x2d761e[_0xc0e1('0x21')][_0xc0e1('0x22')]);return _0x2e956d(_0x2d761e[_0xc0e1('0x21')]['message']);}else{logger[_0xc0e1('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x17ba53,_0xc0e1('0x1f'));_0x2e956d(_0x2d761e[_0xc0e1('0x23')][_0xc0e1('0x22')]);}})[_0xc0e1('0x24')](function(_0x2fa45e){logger[_0xc0e1('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x17ba53,_0x2fa45e);_0x3fe4a4(_0x2fa45e);});});}function respondWithStatusCode(_0x548d1d,_0x173645){_0x173645=_0x173645||0xcc;return function(_0x3d0b13){if(_0x3d0b13){return _0x548d1d[_0xc0e1('0x25')](_0x173645);}return _0x548d1d[_0xc0e1('0x26')](_0x173645)['end']();};}function respondWithResult(_0x918ad3,_0x4f1581){_0x4f1581=_0x4f1581||0xc8;return function(_0x19f5a5){if(_0x19f5a5){return _0x918ad3['status'](_0x4f1581)[_0xc0e1('0x27')](_0x19f5a5);}};}function respondWithFilteredResult(_0x4d9e01,_0x1d42ab){return function(_0x636138){if(_0x636138){var _0x51a302=_0x636138[_0xc0e1('0x28')],_0x5f1d06=_0x1d42ab[_0xc0e1('0x29')],_0x1a8e3e=_0x1d42ab[_0xc0e1('0x29')]+_0x1d42ab[_0xc0e1('0x2a')],_0x4c4512;if(_0x1a8e3e>=_0x51a302){_0x1a8e3e=_0x51a302;_0x4c4512=0xc8;}else{_0x4c4512=0xce;}_0x4d9e01['status'](_0x4c4512);return _0x4d9e01[_0xc0e1('0x2b')](_0xc0e1('0x2c'),_0x5f1d06+'-'+_0x1a8e3e+'/'+_0x51a302)['json'](_0x636138);}return null;};}function patchUpdates(_0x24c6b9){return function(_0x4aee04){try{jsonpatch[_0xc0e1('0x2d')](_0x4aee04,_0x24c6b9,!![]);}catch(_0x56d179){return BPromise[_0xc0e1('0x2e')](_0x56d179);}return _0x4aee04[_0xc0e1('0x2f')]();};}function saveUpdates(_0x4e37e5,_0xa815b){return function(_0x159caa){if(_0x159caa){return _0x159caa['update'](_0x4e37e5)['then'](function(_0x464080){return _0x464080;});}return null;};}function removeEntity(_0x3d8bf9,_0x372fd7){return function(_0x6b2b08){if(_0x6b2b08){return _0x6b2b08[_0xc0e1('0x30')]()[_0xc0e1('0x1b')](function(){_0x3d8bf9[_0xc0e1('0x26')](0xcc)[_0xc0e1('0x31')]();});}};}function handleEntityNotFound(_0x12adee,_0x357e8f){return function(_0x228df9){if(!_0x228df9){_0x12adee[_0xc0e1('0x25')](0x194);}return _0x228df9;};}function handleError(_0x461793,_0x40c24f){_0x40c24f=_0x40c24f||0x1f4;return function(_0xf8568){logger[_0xc0e1('0x21')](_0xf8568[_0xc0e1('0x32')]);if(_0xf8568['name']){delete _0xf8568['name'];}_0x461793[_0xc0e1('0x26')](_0x40c24f)['send'](_0xf8568);};}exports[_0xc0e1('0x33')]=function(_0x40d405,_0x19df43){var _0x18914d={},_0x249484={},_0x28f163={'count':0x0,'rows':[]};var _0x280621=db[_0xc0e1('0x34')][_0xc0e1('0x35')];_0x249484[_0xc0e1('0x36')]=_[_0xc0e1('0x37')](_0x280621);var _0x2093e6={'dateStart':_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x39')],'dateEnd':_0x40d405[_0xc0e1('0x38')]['dateEnd']};delete _0x40d405[_0xc0e1('0x38')][_0xc0e1('0x39')];delete _0x40d405[_0xc0e1('0x38')][_0xc0e1('0x3a')];_0x249484[_0xc0e1('0x38')]=_[_0xc0e1('0x37')](_0x40d405[_0xc0e1('0x38')]);_0x249484['filters']=_[_0xc0e1('0x3b')](_0x249484['model'],_0x249484['query']);_0x18914d[_0xc0e1('0x3c')]=_[_0xc0e1('0x3b')](_0x249484['model'],qs[_0xc0e1('0x3d')](_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x3d')]));_0x18914d[_0xc0e1('0x3c')]=_0x18914d['attributes'][_0xc0e1('0x3e')]?_0x18914d[_0xc0e1('0x3c')]:_0x249484[_0xc0e1('0x36')];if(!_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x3f')](_0xc0e1('0x40'))){_0x18914d['limit']=qs[_0xc0e1('0x2a')](_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x2a')]);_0x18914d[_0xc0e1('0x29')]=qs[_0xc0e1('0x29')](_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x29')]);}_0x18914d['order']=qs[_0xc0e1('0x41')](_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x41')]);_0x18914d['where']=qs[_0xc0e1('0x42')](_[_0xc0e1('0x43')](_0x40d405[_0xc0e1('0x38')],_0x249484[_0xc0e1('0x42')]));if(_0x2093e6[_0xc0e1('0x39')]){if(_0x2093e6['dateEnd']){_0x2093e6[_0xc0e1('0x3a')]=moment(_0x2093e6[_0xc0e1('0x3a')])[_0xc0e1('0x44')](0x1,_0xc0e1('0x45'));}else{_0x2093e6[_0xc0e1('0x3a')]=moment(_0x2093e6[_0xc0e1('0x39')])['add'](0x1,_0xc0e1('0x45'));}_[_0xc0e1('0x46')](_0x18914d[_0xc0e1('0x47')],{'createdAt':{'$gte':_0x2093e6[_0xc0e1('0x39')],'$lte':_0x2093e6[_0xc0e1('0x3a')]}});}if(_0x40d405['query'][_0xc0e1('0x48')]){_0x18914d['where']=_[_0xc0e1('0x46')](_0x18914d['where'],{'$or':_[_0xc0e1('0x49')](_0x18914d[_0xc0e1('0x3c')],function(_0x224928){var _0x2ec093={};_0x2ec093[_0x224928]={'$like':'%'+_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x48')]+'%'};return _0x2ec093;})});}_0x18914d=_[_0xc0e1('0x46')]({},_0x18914d,_0x40d405['options']);var _0x418bff={'where':_0x18914d[_0xc0e1('0x47')]};_0x418bff[_0xc0e1('0x4a')]=[];if(_0x40d405[_0xc0e1('0x38')]['tag']){_0x418bff[_0xc0e1('0x4a')][_0xc0e1('0x4b')]({'model':db['Tag'],'as':'Tags','attributes':['id'],'where':{'id':_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x4c')]},'required':!![]});_0x418bff['distinct']=!![];}if(_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x4d')]){_0x418bff[_0xc0e1('0x4a')][_0xc0e1('0x4b')]({'model':db[_0xc0e1('0x4e')],'as':_0xc0e1('0x4f'),'attributes':['id','direction','createdAt',_0xc0e1('0x4d')],'where':{'direction':'in','read':_0x40d405[_0xc0e1('0x38')]['read']||![]},'required':!![]});_0x418bff[_0xc0e1('0x50')]=!![];}return db[_0xc0e1('0x34')][_0xc0e1('0x28')](_0x418bff)[_0xc0e1('0x1b')](function(_0x4ef6e6){_0x28f163[_0xc0e1('0x28')]=_0x4ef6e6;if(_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x51')]){_0x18914d['include']=[{'model':db[_0xc0e1('0x52')],'as':_0xc0e1('0x53'),'required':![],'attributes':['id',_0xc0e1('0x54'),_0xc0e1('0x55')]},{'model':db[_0xc0e1('0x56')],'as':_0xc0e1('0x57'),'required':![]},{'model':db[_0xc0e1('0x52')],'as':_0xc0e1('0x58'),'attributes':[_0xc0e1('0x54'),_0xc0e1('0x55'),_0xc0e1('0x59')],'required':![]},{'model':db[_0xc0e1('0x5a')],'as':_0xc0e1('0x5b'),'attributes':[_0xc0e1('0x54'),_0xc0e1('0x5c')],'required':![]},{'model':db[_0xc0e1('0x4e')],'as':'Messages','attributes':['id',_0xc0e1('0x5d'),_0xc0e1('0x5e'),'read'],'where':{'direction':'in','read':_0x40d405[_0xc0e1('0x38')]['read']||![]},'required':_0x40d405['query'][_0xc0e1('0x4d')]||![]},{'model':db['Tag'],'as':_0xc0e1('0x5f'),'attributes':['id',_0xc0e1('0x54'),_0xc0e1('0x60')],'required':_0x40d405[_0xc0e1('0x38')]['tag']?!![]:![]},{'model':db[_0xc0e1('0x61')],'as':'ThroughTags','attributes':['id',_0xc0e1('0x54'),_0xc0e1('0x60')],'through':_0x40d405[_0xc0e1('0x38')]['tag']?{'attributes':[],'where':{'TagId':_0x40d405[_0xc0e1('0x38')][_0xc0e1('0x4c')]||undefined}}:{},'required':_0x40d405['query'][_0xc0e1('0x4c')]?!![]:![]}];}return db[_0xc0e1('0x34')][_0xc0e1('0x62')](_0x18914d);})[_0xc0e1('0x1b')](function(_0x31e901){_0x28f163[_0xc0e1('0x63')]=_0x31e901;return _0x28f163;})['then'](respondWithFilteredResult(_0x19df43,_0x18914d))['catch'](handleError(_0x19df43,null));};exports['show']=function(_0x1ed8cc,_0x2ab274){var _0x2e29af={'raw':![],'where':{'id':_0x1ed8cc[_0xc0e1('0x64')]['id']}},_0x34972a={};_0x34972a[_0xc0e1('0x36')]=_['keys'](db[_0xc0e1('0x34')]['rawAttributes']);_0x34972a[_0xc0e1('0x38')]=_[_0xc0e1('0x37')](_0x1ed8cc[_0xc0e1('0x38')]);_0x34972a[_0xc0e1('0x42')]=_[_0xc0e1('0x3b')](_0x34972a[_0xc0e1('0x36')],_0x34972a['query']);_0x2e29af[_0xc0e1('0x3c')]=_[_0xc0e1('0x3b')](_0x34972a[_0xc0e1('0x36')],qs[_0xc0e1('0x3d')](_0x1ed8cc['query'][_0xc0e1('0x3d')]));_0x2e29af[_0xc0e1('0x3c')]=_0x2e29af[_0xc0e1('0x3c')]['length']?_0x2e29af['attributes']:_0x34972a[_0xc0e1('0x36')];if(_0x1ed8cc[_0xc0e1('0x38')][_0xc0e1('0x51')]){_0x2e29af['include']=[{'all':!![]}];}_0x2e29af=_[_0xc0e1('0x46')]({},_0x2e29af,_0x1ed8cc[_0xc0e1('0x65')]);return db[_0xc0e1('0x34')][_0xc0e1('0x66')](_0x2e29af)[_0xc0e1('0x1b')](handleEntityNotFound(_0x2ab274,null))[_0xc0e1('0x1b')](respondWithResult(_0x2ab274,null))['catch'](handleError(_0x2ab274,null));};exports[_0xc0e1('0x67')]=function(_0x4701c4,_0x2b8c54){return db[_0xc0e1('0x34')][_0xc0e1('0x67')](_0x4701c4[_0xc0e1('0x68')],{})[_0xc0e1('0x1b')](respondWithResult(_0x2b8c54,0xc9))[_0xc0e1('0x24')](handleError(_0x2b8c54,null));};exports[_0xc0e1('0x69')]=function(_0x288156,_0x34ee24){if(_0x288156[_0xc0e1('0x68')]['id']){delete _0x288156[_0xc0e1('0x68')]['id'];}return db[_0xc0e1('0x34')][_0xc0e1('0x66')]({'where':{'id':_0x288156['params']['id']}})[_0xc0e1('0x1b')](handleEntityNotFound(_0x34ee24,null))[_0xc0e1('0x1b')](saveUpdates(_0x288156['body'],null))['then'](respondWithResult(_0x34ee24,null))[_0xc0e1('0x24')](handleError(_0x34ee24,null));};exports[_0xc0e1('0x30')]=function(_0x51a4ca,_0x38639a){return db[_0xc0e1('0x34')][_0xc0e1('0x66')]({'where':{'id':_0x51a4ca['params']['id']}})[_0xc0e1('0x1b')](handleEntityNotFound(_0x38639a,null))['then'](removeEntity(_0x38639a,null))['catch'](handleError(_0x38639a,null));};exports['describe']=function(_0x335a92,_0x207646){return db[_0xc0e1('0x34')]['describe']()[_0xc0e1('0x1b')](respondWithResult(_0x207646,null))[_0xc0e1('0x24')](handleError(_0x207646,null));};exports[_0xc0e1('0x6a')]=function(_0x3267f7,_0x3146d7){if(_0x3267f7[_0xc0e1('0x68')]['id']){delete _0x3267f7[_0xc0e1('0x68')]['id'];}return db[_0xc0e1('0x34')][_0xc0e1('0x66')]({'where':{'id':_0x3267f7[_0xc0e1('0x64')]['id']}})[_0xc0e1('0x1b')](handleEntityNotFound(_0x3146d7,null))['then'](saveUpdates(_0x3267f7[_0xc0e1('0x68')],null))[_0xc0e1('0x1b')](respondWithResult(_0x3146d7,null))[_0xc0e1('0x24')](handleError(_0x3146d7,null));};exports['abandon']=function(_0x2a5eed,_0x398399,_0x12fe69){if(_0x2a5eed[_0xc0e1('0x68')]['id']){delete _0x2a5eed[_0xc0e1('0x68')]['id'];}return db['ChatInteraction'][_0xc0e1('0x66')]({'where':{'id':_0x2a5eed['params']['id']}})[_0xc0e1('0x1b')](function(_0x46e9bc){if(!_0x46e9bc){logger[_0xc0e1('0x21')](_0xc0e1('0x6b'),_0xc0e1('0x6c'),0x194,_0xc0e1('0x6d'));_0x398399[_0xc0e1('0x25')](0x194);}else{if(_0x46e9bc[_0xc0e1('0x6e')]){throw new db[(_0xc0e1('0x6f'))][(_0xc0e1('0x70'))](_0xc0e1('0x71'));}}return _0x46e9bc;})[_0xc0e1('0x1b')](function(_0x1cb517){if(_0x1cb517){return _0x1cb517[_0xc0e1('0x69')]({'closed':_0x2a5eed['body'][_0xc0e1('0x72')],'closedAt':_0x2a5eed[_0xc0e1('0x68')]['closedAt'],'disposition':_0x2a5eed[_0xc0e1('0x68')][_0xc0e1('0x73')]})[_0xc0e1('0x1b')](function(_0x486d82){return _0x486d82;});}})[_0xc0e1('0x1b')](function(_0x1c6878){return respondWithRpcPromise(_0xc0e1('0x74'),_0xc0e1('0x6c'),_0x2a5eed[_0xc0e1('0x68')],client9004);})[_0xc0e1('0x1b')](respondWithResult(_0x398399,null))[_0xc0e1('0x24')](handleError(_0x398399,null));};exports['attachmentUpload']=function(_0x2b33ba,_0xeba276,_0x34fd1a){_0x2b33ba['body']['name']=_0x2b33ba[_0xc0e1('0x75')][_0xc0e1('0x76')];_0x2b33ba[_0xc0e1('0x68')][_0xc0e1('0x77')]=_0x2b33ba[_0xc0e1('0x75')][_0xc0e1('0x78')];_0x2b33ba['body'][_0xc0e1('0x79')]=_0x2b33ba[_0xc0e1('0x75')][_0xc0e1('0x7a')];return db['Attachment'][_0xc0e1('0x67')](_0x2b33ba[_0xc0e1('0x68')])[_0xc0e1('0x1b')](respondWithResult(_0xeba276,0xc9))[_0xc0e1('0x24')](handleError(_0xeba276,null));};exports[_0xc0e1('0x7b')]=function(_0x3442db,_0x164fa6,_0x3bf351){return db[_0xc0e1('0x34')]['findOne']({'where':{'id':_0x3442db['params']['id']},'raw':!![]})[_0xc0e1('0x1b')](handleEntityNotFound(_0x164fa6,null))[_0xc0e1('0x1b')](function(_0x1d64f9){if(_0x1d64f9){if(_0x1d64f9[_0xc0e1('0x72')]){return _0x164fa6[_0xc0e1('0x26')](0x193)['json']({'status':0x193,'message':_0xc0e1('0x7c')});}return db[_0xc0e1('0x7d')][_0xc0e1('0x7e')]({'where':{'id':_0x3442db[_0xc0e1('0x38')]['attachId']},'raw':!![]})[_0xc0e1('0x1b')](handleEntityNotFound(_0x164fa6,null));}})[_0xc0e1('0x1b')](function(_0x42645b){if(_0x42645b){return _0x164fa6[_0xc0e1('0x7f')](path[_0xc0e1('0x80')](config[_0xc0e1('0x81')],_0xc0e1('0x82'),_0x42645b['basename']));}})['catch'](handleError(_0x164fa6,null));};exports[_0xc0e1('0x83')]=function(_0x1e471c,_0x4beb91){var _0x3063a2=null;var _0x1ad860=null;var _0x3998cb=null;var _0x4d7ac5=null;if(_0x1e471c[_0xc0e1('0x68')]['id']){delete _0x1e471c[_0xc0e1('0x68')]['id'];}if(_0x1e471c[_0xc0e1('0x68')][_0xc0e1('0x84')]){_0x4d7ac5=path[_0xc0e1('0x80')](config['root'],_0xc0e1('0x85'),util[_0xc0e1('0x86')](_0xc0e1('0x87'),Date[_0xc0e1('0x88')]()));_0x1e471c[_0xc0e1('0x68')][_0xc0e1('0x89')]=_0x4d7ac5;}return db[_0xc0e1('0x34')]['find']({'where':{'id':_0x1e471c[_0xc0e1('0x64')]['id']},'include':[{'model':db[_0xc0e1('0x4e')],'as':_0xc0e1('0x4f'),'include':[{'model':db[_0xc0e1('0x52')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x4beb91,null))[_0xc0e1('0x1b')](saveUpdates(_0x1e471c['body'],null))[_0xc0e1('0x1b')](function(_0x392627){if(_0x392627){_0x3063a2=_0x392627;return db[_0xc0e1('0x5a')][_0xc0e1('0x66')]({'where':{'id':_0x3063a2[_0xc0e1('0x8a')]}});}})[_0xc0e1('0x1b')](function(_0x4bb5f5){if(_0x4bb5f5){_0x3998cb=_0x4bb5f5;return db[_0xc0e1('0x56')][_0xc0e1('0x66')]({'where':{'id':_0x3063a2[_0xc0e1('0x8b')]}});}})[_0xc0e1('0x1b')](function(_0x949ac0){if(_0x949ac0){_0x1ad860=_0x949ac0;if(_0x4d7ac5){var _0x5e9d60=null;for(var _0x34c56b=0x1;_0x34c56b<_0x3063a2[_0xc0e1('0x4f')][_0xc0e1('0x3e')];++_0x34c56b){_0x5e9d60=_0x3063a2[_0xc0e1('0x4f')][_0x34c56b];var _0xee95f2=_0x5e9d60['UserId']?util[_0xc0e1('0x86')](_0xc0e1('0x8c'),_0x3998cb[_0xc0e1('0x8d')],_0x5e9d60[_0xc0e1('0x6e')]):_0xc0e1('0x8e');var _0x572b59=_0x1e471c['body'][_0xc0e1('0x8f')]||util[_0xc0e1('0x86')](_0xc0e1('0x8c'),'Visitor',_0x5e9d60[_0xc0e1('0x8b')]);switch(_0x3998cb['agentIdentifier']){case _0xc0e1('0x90'):_0xee95f2=_0x5e9d60['UserId']?util[_0xc0e1('0x86')](_0xc0e1('0x8c'),_0x3998cb['agentAlias'],_0x5e9d60[_0xc0e1('0x6e')]):_0xc0e1('0x8e');break;case'agent_alias':_0xee95f2=_0x5e9d60[_0xc0e1('0x6e')]?_0x5e9d60[_0xc0e1('0x52')][_0xc0e1('0x91')]||_0x5e9d60[_0xc0e1('0x52')][_0xc0e1('0x55')]:'System';break;case _0xc0e1('0x92'):_0xee95f2=_0x5e9d60[_0xc0e1('0x6e')]?_0x5e9d60[_0xc0e1('0x52')]['fullname']:_0xc0e1('0x8e');break;default:_0xee95f2=_0x5e9d60['UserId']?util[_0xc0e1('0x86')](_0xc0e1('0x8c'),_0x3998cb[_0xc0e1('0x8d')],_0x5e9d60[_0xc0e1('0x6e')]):_0xc0e1('0x8e');}var _0x50bf1d=util[_0xc0e1('0x86')](_0xc0e1('0x93'),moment(_0x5e9d60[_0xc0e1('0x5e')])[_0xc0e1('0x86')](_0xc0e1('0x94')),_0x5e9d60[_0xc0e1('0x5d')]==='in'?_0x572b59:_0xee95f2,_0x5e9d60[_0xc0e1('0x68')]);if(!_0x5e9d60[_0xc0e1('0x95')]){fs[_0xc0e1('0x96')](_0x4d7ac5,_0x50bf1d);}}return db[_0xc0e1('0x97')][_0xc0e1('0x7e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc0e1('0x98'),'raw':!![]}]});}}})[_0xc0e1('0x1b')](function(_0x57b225){if(_0x57b225&&_0x57b225[_0xc0e1('0x98')]&&_0x1e471c['body']){var _0xa81a28={'tls':{'rejectUnauthorized':![]}};if(_0x57b225[_0xc0e1('0x98')][_0xc0e1('0x99')]){_0xa81a28['service']=_0x57b225['Smtp'][_0xc0e1('0x99')];}else{_0xa81a28[_0xc0e1('0x9a')]=_0x57b225[_0xc0e1('0x98')][_0xc0e1('0x9a')];_0xa81a28[_0xc0e1('0x9b')]=_0x57b225[_0xc0e1('0x98')]['port'];_0xa81a28[_0xc0e1('0x9c')]=_0x57b225[_0xc0e1('0x98')][_0xc0e1('0x9c')];}if(_0x57b225[_0xc0e1('0x98')]['authentication']){_0xa81a28[_0xc0e1('0x9d')]={'user':_0x57b225[_0xc0e1('0x98')]['user'],'pass':_0x57b225[_0xc0e1('0x98')]['pass']};}return respondWithRpcPromise(_0xc0e1('0x9e'),_0xc0e1('0x9f'),{'account':_0xa81a28,'message':{'from':util[_0xc0e1('0x86')](_0xc0e1('0xa0'),_0x57b225['name'],_0x57b225['email']||_0x57b225[_0xc0e1('0x98')][_0xc0e1('0xa1')]),'to':_0x1e471c[_0xc0e1('0x68')][_0xc0e1('0x84')],'subject':_0xc0e1('0xa2'),'text':util['format'](_0xc0e1('0xa3'),_0x1e471c['body'][_0xc0e1('0x84')]),'attachments':[{'path':_0x4d7ac5}]}})[_0xc0e1('0x1b')](function(){return _0x3063a2;})[_0xc0e1('0x24')](function(_0x592707){console[_0xc0e1('0x21')](_0x592707);});}else{return _0x3063a2;}})[_0xc0e1('0x1b')](respondWithStatusCode(_0x4beb91,0xc8))[_0xc0e1('0x24')](handleError(_0x4beb91,null));};exports[_0xc0e1('0xa4')]=function(_0x2978a8,_0x5e24a8,_0x170df9){return db[_0xc0e1('0x4e')]['find']({'where':{'id':_0x2978a8[_0xc0e1('0x64')]['id']}})['then'](handleEntityNotFound(_0x5e24a8,null))['then'](function(_0x119319){if(_0x119319){return _0x119319[_0xc0e1('0xa4')](_0x2978a8[_0xc0e1('0x68')][_0xc0e1('0xa5')],_[_0xc0e1('0xa6')](_0x2978a8[_0xc0e1('0x68')],[_0xc0e1('0xa5'),'id'])||{});}})[_0xc0e1('0x1b')](respondWithResult(_0x5e24a8,null))[_0xc0e1('0x24')](handleError(_0x5e24a8,null));};exports['getMessages']=function(_0x4c2fdd,_0x56d831,_0x46bb05){var _0x1a1403={'raw':![],'where':{}};var _0x5e830e={};var _0x5471e4={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x4c2fdd[_0xc0e1('0x64')]['id']}})[_0xc0e1('0x1b')](handleEntityNotFound(_0x56d831,null))['then'](function(_0x41a7b8){if(_0x41a7b8){_0x5e830e['model']=_['keys'](db[_0xc0e1('0x4e')]['rawAttributes']);_0x5e830e[_0xc0e1('0x38')]=_['keys'](_0x4c2fdd[_0xc0e1('0x38')]);_0x5e830e[_0xc0e1('0x42')]=_[_0xc0e1('0x3b')](_0x5e830e[_0xc0e1('0x36')],_0x5e830e[_0xc0e1('0x38')]);_0x1a1403[_0xc0e1('0x3c')]=_[_0xc0e1('0x3b')](_0x5e830e['model'],qs[_0xc0e1('0x3d')](_0x4c2fdd[_0xc0e1('0x38')][_0xc0e1('0x3d')]));_0x1a1403['attributes']=_0x1a1403[_0xc0e1('0x3c')][_0xc0e1('0x3e')]?_0x1a1403[_0xc0e1('0x3c')]:_0x5e830e[_0xc0e1('0x36')];if(!_0x4c2fdd[_0xc0e1('0x38')][_0xc0e1('0x3f')](_0xc0e1('0x40'))){_0x1a1403[_0xc0e1('0x2a')]=qs['limit'](_0x4c2fdd['query']['limit']);_0x1a1403[_0xc0e1('0x29')]=qs[_0xc0e1('0x29')](_0x4c2fdd[_0xc0e1('0x38')][_0xc0e1('0x29')]);}_0x1a1403[_0xc0e1('0xa7')]=qs[_0xc0e1('0x41')](_0x4c2fdd[_0xc0e1('0x38')][_0xc0e1('0x41')]);_0x1a1403[_0xc0e1('0x47')]=qs['filters'](_[_0xc0e1('0x43')](_0x4c2fdd[_0xc0e1('0x38')],_0x5e830e[_0xc0e1('0x42')]));_0x1a1403[_0xc0e1('0x47')]['ChatInteractionId']=_0x41a7b8['id'];if(_0x4c2fdd[_0xc0e1('0x38')][_0xc0e1('0x48')]){_0x1a1403[_0xc0e1('0x47')]=_['merge'](_0x1a1403[_0xc0e1('0x47')],{'$or':_[_0xc0e1('0x49')](_0x1a1403['attributes'],function(_0x8fea39){var _0x5c4da1={};_0x5c4da1[_0x8fea39]={'$like':'%'+_0x4c2fdd[_0xc0e1('0x38')][_0xc0e1('0x48')]+'%'};return _0x5c4da1;})});}if(_0x4c2fdd[_0xc0e1('0x38')]['$gte']){var _0x36bb48=_0x4c2fdd[_0xc0e1('0x38')][_0xc0e1('0xa8')]['split'](',');var _0x5086d2={};_0x5086d2[_0x36bb48[0x0]]={'$gte':moment(_0x36bb48[0x1])[_0xc0e1('0x86')](_0xc0e1('0xa9'))};_0x1a1403[_0xc0e1('0x47')]=_[_0xc0e1('0x46')](_0x1a1403[_0xc0e1('0x47')],_0x5086d2);}_0x1a1403=_[_0xc0e1('0x46')]({},_0x1a1403,_0x4c2fdd['options']);return db['ChatMessage'][_0xc0e1('0x28')]({'where':_0x1a1403['where']})[_0xc0e1('0x1b')](function(_0x1adb79){_0x5471e4['count']=_0x1adb79;if(_0x4c2fdd[_0xc0e1('0x38')][_0xc0e1('0x51')]){_0x1a1403[_0xc0e1('0x4a')]=[{'all':!![]}];}return db[_0xc0e1('0x4e')][_0xc0e1('0x62')](_0x1a1403);})['then'](function(_0x2cebdd){_0x5471e4[_0xc0e1('0x63')]=_0x2cebdd;return _0x5471e4;});}})[_0xc0e1('0x1b')](respondWithFilteredResult(_0x56d831,_0x1a1403))[_0xc0e1('0x24')](handleError(_0x56d831,null));};exports[_0xc0e1('0xaa')]=function(_0x3e8972,_0x1d32eb,_0x401c99){var _0x1be5cd={'where':{}},_0x2a0447={},_0x26b75d={'count':0x0,'rows':[]};return db[_0xc0e1('0x34')][_0xc0e1('0x7e')]({'where':{'id':_0x3e8972['params']['id']}})[_0xc0e1('0x1b')](handleEntityNotFound(_0x1d32eb,null))[_0xc0e1('0x1b')](function(_0x58cf2f){if(_0x58cf2f){_0x2a0447[_0xc0e1('0x36')]=_['keys'](db['ChatMessage'][_0xc0e1('0x35')]);_0x2a0447[_0xc0e1('0x38')]=_[_0xc0e1('0x37')](_0x3e8972['query']);_0x2a0447[_0xc0e1('0x42')]=_['intersection'](_0x2a0447[_0xc0e1('0x36')],_0x2a0447[_0xc0e1('0x38')]);_0x1be5cd['attributes']=_[_0xc0e1('0x3b')](_0x2a0447[_0xc0e1('0x36')],qs['fields'](_0x3e8972[_0xc0e1('0x38')][_0xc0e1('0x3d')]));_0x1be5cd['attributes']=_0x1be5cd['attributes'][_0xc0e1('0x3e')]?_0x1be5cd['attributes']:_0x2a0447[_0xc0e1('0x36')];if(!_0x3e8972[_0xc0e1('0x38')][_0xc0e1('0x3f')](_0xc0e1('0x40'))){_0x1be5cd['limit']=qs[_0xc0e1('0x2a')](_0x3e8972[_0xc0e1('0x38')][_0xc0e1('0x2a')]);_0x1be5cd[_0xc0e1('0x29')]=qs[_0xc0e1('0x29')](_0x3e8972[_0xc0e1('0x38')]['offset']);}_0x1be5cd['order']=qs[_0xc0e1('0x41')](_0x3e8972[_0xc0e1('0x38')][_0xc0e1('0x41')]);_0x1be5cd[_0xc0e1('0x47')]=qs[_0xc0e1('0x42')](_[_0xc0e1('0x43')](_0x3e8972['query'],_0x2a0447[_0xc0e1('0x42')]));_0x1be5cd['where'][_0xc0e1('0xab')]=_0x58cf2f['id'];if(_0x3e8972[_0xc0e1('0x38')][_0xc0e1('0x48')]){_0x1be5cd[_0xc0e1('0x47')]=_[_0xc0e1('0x46')](_0x1be5cd['where'],{'$or':_['map'](_0x1be5cd[_0xc0e1('0x3c')],function(_0x3bd33f){var _0x50cc8d={};_0x50cc8d[_0x3bd33f]={'$like':'%'+_0x3e8972[_0xc0e1('0x38')]['filter']+'%'};return _0x50cc8d;})});}_0x1be5cd[_0xc0e1('0x47')][_0xc0e1('0x95')]=![];if(_0x3e8972[_0xc0e1('0x38')]['id']){_0x1be5cd[_0xc0e1('0x47')]['id']={'$gt':_0x3e8972[_0xc0e1('0x38')]['id']};}_0x1be5cd=_[_0xc0e1('0x46')]({},_0x1be5cd,_0x3e8972[_0xc0e1('0x65')]);return db[_0xc0e1('0x4e')][_0xc0e1('0x28')]({'where':_0x1be5cd[_0xc0e1('0x47')]})[_0xc0e1('0x1b')](function(_0x1a7d7d){_0x26b75d[_0xc0e1('0x28')]=_0x1a7d7d;_0x1be5cd['include']=[];if(_0x3e8972[_0xc0e1('0x38')][_0xc0e1('0xac')]){_0x1be5cd['include']['push']({'model':db[_0xc0e1('0x52')],'as':'User','attributes':['id','fullname',_0xc0e1('0x91')]});}if(_0x3e8972[_0xc0e1('0x38')]['includeAll']){_0x1be5cd[_0xc0e1('0x4a')]=[{'all':!![]}];}return db[_0xc0e1('0x4e')][_0xc0e1('0x62')](_0x1be5cd);})['then'](function(_0x409ec4){_0x26b75d[_0xc0e1('0x63')]=_0x409ec4;return _0x26b75d;});}})[_0xc0e1('0x1b')](respondWithFilteredResult(_0x1d32eb,_0x1be5cd))[_0xc0e1('0x24')](handleError(_0x1d32eb,null));};exports[_0xc0e1('0xad')]=function(_0x41be64,_0x47f6a2,_0x5253d7){return db['ChatInteraction'][_0xc0e1('0x66')]({'where':{'id':_0x41be64['params']['id']}})[_0xc0e1('0x1b')](handleEntityNotFound(_0x47f6a2,null))[_0xc0e1('0x1b')](function(_0x5f3947){if(_0x5f3947){return _0x5f3947[_0xc0e1('0xae')](_0x41be64[_0xc0e1('0x68')][_0xc0e1('0xa5')],_[_0xc0e1('0xa6')](_0x41be64[_0xc0e1('0x68')],['ids','id'])||{})['spread'](function(){return db[_0xc0e1('0x61')][_0xc0e1('0x62')]({'attributes':['id','name',_0xc0e1('0x60')],'where':{'id':_0x41be64[_0xc0e1('0x68')][_0xc0e1('0xa5')]}});})[_0xc0e1('0x1b')](function(_0x5275f6){socket[_0xc0e1('0xaf')](_0xc0e1('0xb0'),{'id':Number(_0x41be64[_0xc0e1('0x64')]['id']),'tags':_0x5275f6||[]});return{'id':Number(_0x41be64[_0xc0e1('0x64')]['id']),'tags':_0x5275f6||[]};});}})['then'](respondWithResult(_0x47f6a2,null))[_0xc0e1('0x24')](handleError(_0x47f6a2,null));};exports[_0xc0e1('0xb1')]=function(_0x23bc1c,_0x4c3d77,_0x497509){var _0x3e912b;return db[_0xc0e1('0x34')][_0xc0e1('0x66')]({'where':{'id':_0x23bc1c['params']['id']}})[_0xc0e1('0x1b')](handleEntityNotFound(_0x4c3d77,null))['then'](function(_0x36661f){if(_0x36661f){return _0x36661f[_0xc0e1('0xb1')](_0x23bc1c[_0xc0e1('0x38')][_0xc0e1('0xa5')]);}})[_0xc0e1('0x1b')](respondWithStatusCode(_0x4c3d77,null))[_0xc0e1('0x24')](handleError(_0x4c3d77,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c323901..367a7a5 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 _0xa88c=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3119a5,_0x3258a0){var _0x3fe45a=function(_0x884afd){while(--_0x884afd){_0x3119a5['push'](_0x3119a5['shift']());}};_0x3fe45a(++_0x3258a0);}(_0xa88c,0x120));var _0xca88=function(_0x3e7c59,_0x270f7d){_0x3e7c59=_0x3e7c59-0x0;var _0x169d9e=_0xa88c[_0x3e7c59];return _0x169d9e;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xca88('0x0'))['db']['ChatInteraction'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca88('0x1'),'afterUpdate':_0xca88('0x2'),'afterDestroy':_0xca88('0x3')};function emitEvent(_0x111df3){return function(_0x28bd06,_0x28efa0,_0xbcadf9){ChatInteractionEvents['emit'](_0x111df3+':'+_0x28bd06['id'],_0x28bd06);ChatInteractionEvents[_0xca88('0x4')](_0x111df3,_0x28bd06);_0xbcadf9(null);};}for(var e in events){if(events[_0xca88('0x5')](e)){var event=events[e];ChatInteraction[_0xca88('0x6')](e,emitEvent(event));}}module[_0xca88('0x7')]=ChatInteractionEvents; \ No newline at end of file +var _0xbbc4=['exports','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xbbc4,0xb0));var _0x4bbc=function(_0x58cad0,_0x275180){_0x58cad0=_0x58cad0-0x0;var _0x534036=_0xbbc4[_0x58cad0];return _0x534036;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4bbc('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4bbc('0x1'),'afterDestroy':_0x4bbc('0x2')};function emitEvent(_0x3f98e6){return function(_0x3d3d1d,_0x7328c3,_0x19c4e9){ChatInteractionEvents['emit'](_0x3f98e6+':'+_0x3d3d1d['id'],_0x3d3d1d);ChatInteractionEvents['emit'](_0x3f98e6,_0x3d3d1d);_0x19c4e9(null);};}for(var e in events){if(events[_0x4bbc('0x3')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x4bbc('0x4')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c237b8f..20c91b4 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 _0x6728=['lodash','../../config/logger','api','moment','bluebird','./chatInteraction.attributes','exports','define','utf8mb4'];(function(_0x235ad6,_0x5e4437){var _0x2885d9=function(_0x3e55ba){while(--_0x3e55ba){_0x235ad6['push'](_0x235ad6['shift']());}};_0x2885d9(++_0x5e4437);}(_0x6728,0x144));var _0x8672=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0x6728[_0x272d90];return _0x2bf4a2;};'use strict';var _=require(_0x8672('0x0'));var util=require('util');var logger=require(_0x8672('0x1'))(_0x8672('0x2'));var moment=require(_0x8672('0x3'));var BPromise=require(_0x8672('0x4'));var rp=require('request-promise');var attributes=require(_0x8672('0x5'));module[_0x8672('0x6')]=function(_0xc0f690,_0x305a49){return _0xc0f690[_0x8672('0x7')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8672('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3dc4=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','./chatInteraction.attributes','define','ChatInteraction','chat_interactions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3dc4,0x86));var _0x43dc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3dc4[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x43dc('0x0'));var util=require(_0x43dc('0x1'));var logger=require('../../config/logger')(_0x43dc('0x2'));var moment=require(_0x43dc('0x3'));var BPromise=require(_0x43dc('0x4'));var rp=require(_0x43dc('0x5'));var attributes=require(_0x43dc('0x6'));module['exports']=function(_0x2a6dc1,_0x498864){return _0x2a6dc1[_0x43dc('0x7')](_0x43dc('0x8'),attributes,{'tableName':_0x43dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x43dc('0xa'),'collate':_0x43dc('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4b6bf76..527dcc5 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 _0x4139=['debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','raw','options','attributes','limit','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','socket.io-emitter','localhost','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4139,0x14d));var _0x9413=function(_0x32391a,_0x510bfc){_0x32391a=_0x32391a-0x0;var _0xc9aa3c=_0x4139[_0x32391a];return _0xc9aa3c;};'use strict';var _=require(_0x9413('0x0'));var util=require('util');var moment=require(_0x9413('0x1'));var BPromise=require(_0x9413('0x2'));var rs=require(_0x9413('0x3'));var fs=require('fs');var db=require(_0x9413('0x4'))['db'];var utils=require(_0x9413('0x5'));var logger=require(_0x9413('0x6'))('rpc');var config=require(_0x9413('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9413('0x8')][_0x9413('0x9')]({'port':0x232a});var socket=require(_0x9413('0xa'))({'host':_0x9413('0xb'),'port':0x18eb});require('./chatInteraction.socket')[_0x9413('0xc')](socket);function respondWithRpcPromise(_0x27c5d4,_0x9d9e98,_0x2dfa2b){return new BPromise(function(_0x181c19,_0xaf5bf6){return client[_0x9413('0xd')](_0x27c5d4,_0x2dfa2b)[_0x9413('0xe')](function(_0x31ccc7){logger[_0x9413('0xf')](_0x9413('0x10'),_0x9d9e98,_0x9413('0x11'));logger[_0x9413('0x12')](_0x9413('0x13'),_0x9d9e98,_0x9413('0x11'),JSON[_0x9413('0x14')](_0x31ccc7));if(_0x31ccc7[_0x9413('0x15')]){if(_0x31ccc7['error'][_0x9413('0x16')]===0x1f4){logger['error'](_0x9413('0x10'),_0x9d9e98,_0x31ccc7[_0x9413('0x15')][_0x9413('0x17')]);return _0xaf5bf6(_0x31ccc7[_0x9413('0x15')]['message']);}logger[_0x9413('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x9d9e98,_0x31ccc7[_0x9413('0x15')]['message']);return _0x181c19(_0x31ccc7[_0x9413('0x15')][_0x9413('0x17')]);}else{logger[_0x9413('0xf')](_0x9413('0x10'),_0x9d9e98,_0x9413('0x11'));_0x181c19(_0x31ccc7[_0x9413('0x18')][_0x9413('0x17')]);}})[_0x9413('0x19')](function(_0x329ab1){logger[_0x9413('0x15')](_0x9413('0x10'),_0x9d9e98,_0x329ab1);_0xaf5bf6(_0x329ab1);});});}exports[_0x9413('0x1a')]=function(_0x58c859){var _0x16a843=this;return new Promise(function(_0x352013,_0x531762){return db[_0x9413('0x1b')][_0x9413('0x1c')](_0x58c859[_0x9413('0x1d')],{'raw':_0x58c859['options']?_0x58c859['options'][_0x9413('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58c859[_0x9413('0x1f')]?_0x58c859[_0x9413('0x1f')]['where']||null:null,'attributes':_0x58c859['options']?_0x58c859['options'][_0x9413('0x20')]||null:null,'limit':_0x58c859[_0x9413('0x1f')]?_0x58c859[_0x9413('0x1f')][_0x9413('0x21')]||null:null})['then'](function(_0x412be6){logger['info']('UpdateChatInteraction',_0x58c859);logger['debug'](_0x9413('0x1a'),_0x58c859,JSON[_0x9413('0x14')](_0x412be6));_0x352013(_0x412be6);})['catch'](function(_0x4495e4){logger[_0x9413('0x15')](_0x9413('0x1a'),_0x4495e4['message'],_0x58c859);_0x531762(_0x16a843['error'](0x1f4,_0x4495e4['message']));});});};exports['AddTagsToChatInteraction']=function(_0x1db71e){return new Promise(function(_0x44d5fe,_0x170347){return db[_0x9413('0x1b')]['find']({'where':_0x1db71e['options']?_0x1db71e['options']['where']||null:null})['then'](function(_0x3d14f6){if(_0x3d14f6){return _0x3d14f6[_0x9413('0x22')](_0x1db71e[_0x9413('0x1d')][_0x9413('0x23')],_[_0x9413('0x24')](_0x1db71e[_0x9413('0x1d')],['ids','id'])||{});}})[_0x9413('0x25')](function(_0x406cd8){logger[_0x9413('0xf')](_0x9413('0x26'),_0x1db71e);logger[_0x9413('0x12')]('AddTags',_0x1db71e,JSON[_0x9413('0x14')](_0x406cd8));_0x44d5fe(_0x406cd8);})['catch'](function(_0x33e3e4){logger[_0x9413('0x15')](_0x9413('0x26'),_0x33e3e4[_0x9413('0x17')],_0x1db71e);_0x170347(_this[_0x9413('0x15')](0x1f4,_0x33e3e4[_0x9413('0x17')]));});});}; \ No newline at end of file +var _0x9e00=['omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','addTags','ids'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x9e00,0x19e));var _0x09e0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9e00[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x09e0('0x0'));var util=require(_0x09e0('0x1'));var moment=require(_0x09e0('0x2'));var BPromise=require(_0x09e0('0x3'));var rs=require(_0x09e0('0x4'));var fs=require('fs');var db=require(_0x09e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x09e0('0x6'))('rpc');var config=require(_0x09e0('0x7'));var jayson=require(_0x09e0('0x8'));var client=jayson[_0x09e0('0x9')]['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x09e0('0xa'),'port':0x18eb});require(_0x09e0('0xb'))[_0x09e0('0xc')](socket);function respondWithRpcPromise(_0x35b24e,_0x1bab58,_0xd9f1bc){return new BPromise(function(_0x5acc4f,_0x15b5c3){return client[_0x09e0('0xd')](_0x35b24e,_0xd9f1bc)[_0x09e0('0xe')](function(_0x33dd3b){logger[_0x09e0('0xf')](_0x09e0('0x10'),_0x1bab58,_0x09e0('0x11'));logger[_0x09e0('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1bab58,_0x09e0('0x11'),JSON['stringify'](_0x33dd3b));if(_0x33dd3b[_0x09e0('0x13')]){if(_0x33dd3b[_0x09e0('0x13')][_0x09e0('0x14')]===0x1f4){logger[_0x09e0('0x13')](_0x09e0('0x10'),_0x1bab58,_0x33dd3b['error'][_0x09e0('0x15')]);return _0x15b5c3(_0x33dd3b[_0x09e0('0x13')][_0x09e0('0x15')]);}logger[_0x09e0('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x1bab58,_0x33dd3b[_0x09e0('0x13')][_0x09e0('0x15')]);return _0x5acc4f(_0x33dd3b[_0x09e0('0x13')][_0x09e0('0x15')]);}else{logger[_0x09e0('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x1bab58,_0x09e0('0x11'));_0x5acc4f(_0x33dd3b[_0x09e0('0x16')]['message']);}})['catch'](function(_0x33ed66){logger[_0x09e0('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x1bab58,_0x33ed66);_0x15b5c3(_0x33ed66);});});}exports['UpdateChatInteraction']=function(_0x1a05fc){var _0x427a96=this;return new Promise(function(_0x36a918,_0x1d8f38){return db[_0x09e0('0x17')][_0x09e0('0x18')](_0x1a05fc[_0x09e0('0x19')],{'raw':_0x1a05fc[_0x09e0('0x1a')]?_0x1a05fc[_0x09e0('0x1a')][_0x09e0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a05fc[_0x09e0('0x1a')]?_0x1a05fc[_0x09e0('0x1a')][_0x09e0('0x1c')]||null:null,'attributes':_0x1a05fc['options']?_0x1a05fc[_0x09e0('0x1a')][_0x09e0('0x1d')]||null:null,'limit':_0x1a05fc['options']?_0x1a05fc['options'][_0x09e0('0x1e')]||null:null})[_0x09e0('0xe')](function(_0xdd2655){logger['info'](_0x09e0('0x1f'),_0x1a05fc);logger['debug'](_0x09e0('0x1f'),_0x1a05fc,JSON[_0x09e0('0x20')](_0xdd2655));_0x36a918(_0xdd2655);})['catch'](function(_0x328a48){logger[_0x09e0('0x13')]('UpdateChatInteraction',_0x328a48[_0x09e0('0x15')],_0x1a05fc);_0x1d8f38(_0x427a96[_0x09e0('0x13')](0x1f4,_0x328a48[_0x09e0('0x15')]));});});};exports[_0x09e0('0x21')]=function(_0x2ecbf9){return new Promise(function(_0x4fef0f,_0x4c4514){return db[_0x09e0('0x17')][_0x09e0('0x22')]({'where':_0x2ecbf9[_0x09e0('0x1a')]?_0x2ecbf9[_0x09e0('0x1a')][_0x09e0('0x1c')]||null:null})[_0x09e0('0xe')](function(_0x4a12d8){if(_0x4a12d8){return _0x4a12d8[_0x09e0('0x23')](_0x2ecbf9[_0x09e0('0x19')][_0x09e0('0x24')],_[_0x09e0('0x25')](_0x2ecbf9[_0x09e0('0x19')],['ids','id'])||{});}})[_0x09e0('0x26')](function(_0x2c94c4){logger[_0x09e0('0xf')](_0x09e0('0x27'),_0x2ecbf9);logger['debug'](_0x09e0('0x27'),_0x2ecbf9,JSON['stringify'](_0x2c94c4));_0x4fef0f(_0x2c94c4);})[_0x09e0('0x28')](function(_0x1a99b6){logger[_0x09e0('0x13')](_0x09e0('0x27'),_0x1a99b6[_0x09e0('0x15')],_0x2ecbf9);_0x4c4514(_this[_0x09e0('0x13')](0x1f4,_0x1a99b6[_0x09e0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 870e54f..ed6f7c6 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 _0xb9dd=['remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x1603a0,_0xa6dbbc){var _0x5e2793=function(_0x2bfc67){while(--_0x2bfc67){_0x1603a0['push'](_0x1603a0['shift']());}};_0x5e2793(++_0xa6dbbc);}(_0xb9dd,0x1c7));var _0xdb9d=function(_0x41a1a8,_0x19214b){_0x41a1a8=_0x41a1a8-0x0;var _0x2e3157=_0xb9dd[_0x41a1a8];return _0x2e3157;};'use strict';var ChatInteractionEvents=require(_0xdb9d('0x0'));var events=['save',_0xdb9d('0x1'),_0xdb9d('0x2')];function createListener(_0x945694,_0x3e39d8){return function(_0x304d03){_0x3e39d8[_0xdb9d('0x3')](_0x945694,_0x304d03);};}function removeListener(_0x2ae12e,_0x1e6b77){return function(){ChatInteractionEvents[_0xdb9d('0x4')](_0x2ae12e,_0x1e6b77);};}exports[_0xdb9d('0x5')]=function(_0x2f205d){for(var _0x3cb85d=0x0,_0x24344b=events[_0xdb9d('0x6')];_0x3cb85d<_0x24344b;_0x3cb85d++){var _0x7ca0f7=events[_0x3cb85d];var _0x3e8553=createListener(_0xdb9d('0x7')+_0x7ca0f7,_0x2f205d);ChatInteractionEvents['on'](_0x7ca0f7,_0x3e8553);}}; \ No newline at end of file +var _0x6af3=['length','chatInteraction:','./chatInteraction.events','save','emit','register'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x6af3,0x194));var _0x36af=function(_0x517af8,_0x511bde){_0x517af8=_0x517af8-0x0;var _0x196467=_0x6af3[_0x517af8];return _0x196467;};'use strict';var ChatInteractionEvents=require(_0x36af('0x0'));var events=[_0x36af('0x1'),'remove','update'];function createListener(_0x35705e,_0xf744c6){return function(_0x18c5f6){_0xf744c6[_0x36af('0x2')](_0x35705e,_0x18c5f6);};}function removeListener(_0x1890a0,_0x115379){return function(){ChatInteractionEvents['removeListener'](_0x1890a0,_0x115379);};}exports[_0x36af('0x3')]=function(_0x748da8){for(var _0x48fcb9=0x0,_0x468a29=events[_0x36af('0x4')];_0x48fcb9<_0x468a29;_0x48fcb9++){var _0x203954=events[_0x48fcb9];var _0x18fa54=createListener(_0x36af('0x5')+_0x203954,_0x748da8);ChatInteractionEvents['on'](_0x203954,_0x18fa54);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3e5cc1b..8115533 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 _0x2874=['chatinteraction:update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','post','create','join','root','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','file','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','/:id','tracked'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x2874,0xc6));var _0x4287=function(_0x29379a,_0x16b64f){_0x29379a=_0x29379a-0x0;var _0x125b52=_0x2874[_0x29379a];return _0x125b52;};'use strict';var multer=require('multer');var util=require(_0x4287('0x0'));var path=require(_0x4287('0x1'));var express=require(_0x4287('0x2'));var router=express[_0x4287('0x3')]();var auth=require(_0x4287('0x4'));var interaction=require(_0x4287('0x5'));var config=require(_0x4287('0x6'));var controller=require(_0x4287('0x7'));router[_0x4287('0x8')]('/',auth[_0x4287('0x9')](),controller[_0x4287('0xa')]);router[_0x4287('0x8')]('/describe',auth[_0x4287('0x9')](),controller[_0x4287('0xb')]);router['get']('/:id',auth[_0x4287('0xc')](),controller[_0x4287('0xd')]);router[_0x4287('0x8')](_0x4287('0xe'),auth[_0x4287('0xc')](),controller[_0x4287('0xf')]);router[_0x4287('0x8')](_0x4287('0x10'),auth[_0x4287('0x9')](),controller[_0x4287('0x11')]);router['get'](_0x4287('0x12'),auth[_0x4287('0xc')](),controller['getMyMessages']);router[_0x4287('0x13')]('/',auth[_0x4287('0x9')](),controller[_0x4287('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bfad8,_0x587f57,_0x4d0c48){_0x4d0c48(null,path[_0x4287('0x15')](config[_0x4287('0x16')],_0x4287('0x17')));},'filename':function(_0x1605ac,_0x519a31,_0x53c8fd){_0x53c8fd(null,util['format'](_0x4287('0x18'),Date[_0x4287('0x19')](),_0x519a31['originalname'][_0x4287('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x4287('0x1b'),upload['single'](_0x4287('0x1c')),controller['attachmentUpload']);router[_0x4287('0x13')](_0x4287('0x10'),auth[_0x4287('0xc')](),controller[_0x4287('0x1d')]);router['post'](_0x4287('0x1e'),auth[_0x4287('0x9')](),interaction['tracked'](_0x4287('0x1f'),_0x4287('0x20')),controller[_0x4287('0x21')]);router[_0x4287('0x22')](_0x4287('0x23'),auth['isAuthenticated'](),interaction[_0x4287('0x24')]('chat',_0x4287('0x25')),controller['update']);router[_0x4287('0x22')](_0x4287('0x26'),controller['customUpdate']);router['put'](_0x4287('0x27'),auth[_0x4287('0xc')](),controller[_0x4287('0x28')]);router[_0x4287('0x22')](_0x4287('0x29'),controller[_0x4287('0x2a')]);router[_0x4287('0x2b')](_0x4287('0x23'),auth['isAuthenticated'](),interaction[_0x4287('0x24')]('chat',_0x4287('0x2c')),controller[_0x4287('0x2d')]);router[_0x4287('0x2b')](_0x4287('0x1e'),auth[_0x4287('0x9')](),controller[_0x4287('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x0345=['%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','post','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','getMyMessages','diskStorage','join','root','server/files/attachments/'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0345,0x199));var _0x5034=function(_0x205af4,_0x47ec17){_0x205af4=_0x205af4-0x0;var _0x399600=_0x0345[_0x205af4];return _0x399600;};'use strict';var multer=require(_0x5034('0x0'));var util=require(_0x5034('0x1'));var path=require(_0x5034('0x2'));var express=require('express');var router=express[_0x5034('0x3')]();var auth=require(_0x5034('0x4'));var interaction=require(_0x5034('0x5'));var config=require(_0x5034('0x6'));var controller=require(_0x5034('0x7'));router[_0x5034('0x8')]('/',auth[_0x5034('0x9')](),controller[_0x5034('0xa')]);router['get'](_0x5034('0xb'),auth[_0x5034('0x9')](),controller[_0x5034('0xc')]);router[_0x5034('0x8')]('/:id',auth[_0x5034('0xd')](),controller[_0x5034('0xe')]);router[_0x5034('0x8')](_0x5034('0xf'),auth[_0x5034('0xd')](),controller['attachmentDownload']);router[_0x5034('0x8')]('/:id/messages',auth[_0x5034('0x9')](),controller[_0x5034('0x10')]);router['get'](_0x5034('0x11'),auth[_0x5034('0xd')](),controller[_0x5034('0x12')]);router['post']('/',auth[_0x5034('0x9')](),controller['create']);var upload=multer({'storage':multer[_0x5034('0x13')]({'destination':function(_0xf2f339,_0x37c3aa,_0x449e4f){_0x449e4f(null,path[_0x5034('0x14')](config[_0x5034('0x15')],_0x5034('0x16')));},'filename':function(_0x10ba6a,_0x22ea47,_0x294f26){_0x294f26(null,util['format'](_0x5034('0x17'),Date[_0x5034('0x18')](),_0x22ea47[_0x5034('0x19')][_0x5034('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5034('0x1b'),upload['single'](_0x5034('0x1c')),controller[_0x5034('0x1d')]);router[_0x5034('0x1e')](_0x5034('0x1f'),auth['isChatInteractionAuthorized'](),controller[_0x5034('0x20')]);router['post'](_0x5034('0x21'),auth[_0x5034('0x9')](),interaction[_0x5034('0x22')](_0x5034('0x23'),_0x5034('0x24')),controller['addTags']);router[_0x5034('0x25')]('/:id',auth['isAuthenticated'](),interaction[_0x5034('0x22')](_0x5034('0x23'),_0x5034('0x26')),controller['update']);router[_0x5034('0x25')](_0x5034('0x27'),controller[_0x5034('0x28')]);router[_0x5034('0x25')]('/:id/abandon',auth[_0x5034('0xd')](),controller[_0x5034('0x29')]);router[_0x5034('0x25')](_0x5034('0x2a'),controller[_0x5034('0x2b')]);router[_0x5034('0x2c')](_0x5034('0x2d'),auth[_0x5034('0x9')](),interaction[_0x5034('0x22')](_0x5034('0x23'),'chatinteraction:destroy'),controller[_0x5034('0x2e')]);router[_0x5034('0x2c')](_0x5034('0x21'),auth[_0x5034('0x9')](),controller['removeTags']);module[_0x5034('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index afd4641..e4fa023 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 _0xc359=['INTEGER','exports','medium','BOOLEAN'];(function(_0x4d5e45,_0xe6b062){var _0x26d7f5=function(_0xe526c9){while(--_0xe526c9){_0x4d5e45['push'](_0x4d5e45['shift']());}};_0x26d7f5(++_0xe6b062);}(_0xc359,0x1d9));var _0x9c35=function(_0x5d4460,_0x400e28){_0x5d4460=_0x5d4460-0x0;var _0x5bdc5e=_0xc359[_0x5d4460];return _0x5bdc5e;};'use strict';var Sequelize=require('sequelize');module[_0x9c35('0x0')]={'body':{'type':Sequelize['TEXT'](_0x9c35('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x9c35('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9c35('0x3')]}}; \ No newline at end of file +var _0xba34=['BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xba34,0x119));var _0x4ba3=function(_0x4540f2,_0x117f60){_0x4540f2=_0x4540f2-0x0;var _0x3b8bcc=_0xba34[_0x4540f2];return _0x3b8bcc;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'body':{'type':Sequelize[_0x4ba3('0x2')](_0x4ba3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 52e1055..ff7d254 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 _0x9ee6=['model','keys','query','dateStart','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','dateEnd','add','day','merge','map','includeAll','rows','catch','show','params','rawAttributes','options','find','create','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','-online','VoiceQueues','type','push','FromId','ToId','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','ChatInternalMessage'];(function(_0x479c9b,_0x18e2a2){var _0x19d355=function(_0x463390){while(--_0x463390){_0x479c9b['push'](_0x479c9b['shift']());}};_0x19d355(++_0x18e2a2);}(_0x9ee6,0x94));var _0x69ee=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x9ee6[_0x4d8dc3];return _0x9b03d9;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x69ee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x69ee('0x1'));var util=require('util');var path=require(_0x69ee('0x2'));var sox=require(_0x69ee('0x3'));var csv=require(_0x69ee('0x4'));var ejs=require(_0x69ee('0x5'));var fs=require('fs');var _=require(_0x69ee('0x6'));var squel=require('squel');var crypto=require(_0x69ee('0x7'));var jsforce=require(_0x69ee('0x8'));var deskjs=require(_0x69ee('0x9'));var toCsv=require(_0x69ee('0x4'));var querystring=require(_0x69ee('0xa'));var Papa=require(_0x69ee('0xb'));var qs=require(_0x69ee('0xc'));var logger=require(_0x69ee('0xd'))(_0x69ee('0xe'));var utils=require(_0x69ee('0xf'));var config=require(_0x69ee('0x10'));var db=require(_0x69ee('0x11'))['db'];var socket=require(_0x69ee('0x12'))({'host':_0x69ee('0x13'),'port':0x18eb});require(_0x69ee('0x14'))['register'](socket);function respondWithStatusCode(_0x211853,_0x55c103){_0x55c103=_0x55c103||0xcc;return function(_0x2be268){if(_0x2be268){return _0x211853[_0x69ee('0x15')](_0x55c103);}return _0x211853[_0x69ee('0x16')](_0x55c103)[_0x69ee('0x17')]();};}function respondWithResult(_0x72b6c5,_0x3d19a5){_0x3d19a5=_0x3d19a5||0xc8;return function(_0x5b9c94){if(_0x5b9c94){return _0x72b6c5[_0x69ee('0x16')](_0x3d19a5)[_0x69ee('0x18')](_0x5b9c94);}};}function respondWithFilteredResult(_0x15927a,_0x5bae3f){return function(_0x4b6902){if(_0x4b6902){var _0x57da68=_0x4b6902[_0x69ee('0x19')],_0x2cef52=_0x5bae3f['offset'],_0x2de49a=_0x5bae3f['offset']+_0x5bae3f[_0x69ee('0x1a')],_0x4e39a7;if(_0x2de49a>=_0x57da68){_0x2de49a=_0x57da68;_0x4e39a7=0xc8;}else{_0x4e39a7=0xce;}_0x15927a[_0x69ee('0x16')](_0x4e39a7);return _0x15927a[_0x69ee('0x1b')](_0x69ee('0x1c'),_0x2cef52+'-'+_0x2de49a+'/'+_0x57da68)[_0x69ee('0x18')](_0x4b6902);}return null;};}function patchUpdates(_0x4d47b7){return function(_0x4140e){try{jsonpatch[_0x69ee('0x1d')](_0x4140e,_0x4d47b7,!![]);}catch(_0x1402b5){return BPromise[_0x69ee('0x1e')](_0x1402b5);}return _0x4140e[_0x69ee('0x1f')]();};}function saveUpdates(_0x583bd0,_0x3d86e1){return function(_0x17ce69){if(_0x17ce69){return _0x17ce69[_0x69ee('0x20')](_0x583bd0)[_0x69ee('0x21')](function(_0x423e5c){return _0x423e5c;});}return null;};}function removeEntity(_0x183d76,_0x6b3a52){return function(_0x47782a){if(_0x47782a){return _0x47782a[_0x69ee('0x22')]()[_0x69ee('0x21')](function(){_0x183d76['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x185e9b,_0x5b8a9f){return function(_0x524a9b){if(!_0x524a9b){_0x185e9b[_0x69ee('0x15')](0x194);}return _0x524a9b;};}function handleError(_0x319428,_0x2d9250){_0x2d9250=_0x2d9250||0x1f4;return function(_0x4465ae){logger[_0x69ee('0x23')](_0x4465ae['stack']);if(_0x4465ae[_0x69ee('0x24')]){delete _0x4465ae[_0x69ee('0x24')];}_0x319428[_0x69ee('0x16')](_0x2d9250)[_0x69ee('0x25')](_0x4465ae);};}exports[_0x69ee('0x26')]=function(_0x2aeb1e,_0x759b4f){var _0xcabf09={},_0x300e28={},_0x3c34f7={'count':0x0,'rows':[]};var _0x160151=db[_0x69ee('0x27')]['rawAttributes'];_0x300e28[_0x69ee('0x28')]=_[_0x69ee('0x29')](_0x160151);var _0x34e1cd={'dateStart':_0x2aeb1e[_0x69ee('0x2a')][_0x69ee('0x2b')],'dateEnd':_0x2aeb1e[_0x69ee('0x2a')]['dateEnd']};delete _0x2aeb1e['query'][_0x69ee('0x2b')];delete _0x2aeb1e['query']['dateEnd'];_0x300e28['query']=_[_0x69ee('0x29')](_0x2aeb1e[_0x69ee('0x2a')]);_0x300e28['filters']=_[_0x69ee('0x2c')](_0x300e28[_0x69ee('0x28')],_0x300e28['query']);_0xcabf09[_0x69ee('0x2d')]=_[_0x69ee('0x2c')](_0x300e28[_0x69ee('0x28')],qs[_0x69ee('0x2e')](_0x2aeb1e[_0x69ee('0x2a')][_0x69ee('0x2e')]));_0xcabf09[_0x69ee('0x2d')]=_0xcabf09[_0x69ee('0x2d')][_0x69ee('0x2f')]?_0xcabf09[_0x69ee('0x2d')]:_0x300e28[_0x69ee('0x28')];if(!_0x2aeb1e['query'][_0x69ee('0x30')](_0x69ee('0x31'))){_0xcabf09[_0x69ee('0x1a')]=qs[_0x69ee('0x1a')](_0x2aeb1e[_0x69ee('0x2a')][_0x69ee('0x1a')]);_0xcabf09[_0x69ee('0x32')]=qs[_0x69ee('0x32')](_0x2aeb1e[_0x69ee('0x2a')][_0x69ee('0x32')]);}_0xcabf09[_0x69ee('0x33')]=qs['sort'](_0x2aeb1e[_0x69ee('0x2a')][_0x69ee('0x34')]);_0xcabf09[_0x69ee('0x35')]=qs[_0x69ee('0x36')](_[_0x69ee('0x37')](_0x2aeb1e['query'],_0x300e28['filters']));if(_0x34e1cd['dateStart']){if(_0x34e1cd['dateEnd']){_0x34e1cd[_0x69ee('0x38')]=moment(_0x34e1cd[_0x69ee('0x38')])[_0x69ee('0x39')](0x1,_0x69ee('0x3a'));}else{_0x34e1cd['dateEnd']=moment(_0x34e1cd[_0x69ee('0x2b')])[_0x69ee('0x39')](0x1,'day');}_[_0x69ee('0x3b')](_0xcabf09['where'],{'createdAt':{'$gte':_0x34e1cd[_0x69ee('0x2b')],'$lte':_0x34e1cd[_0x69ee('0x38')]}});}if(_0x2aeb1e[_0x69ee('0x2a')]['filter']){_0xcabf09[_0x69ee('0x35')]=_[_0x69ee('0x3b')](_0xcabf09[_0x69ee('0x35')],{'$or':_[_0x69ee('0x3c')](_0xcabf09[_0x69ee('0x2d')],function(_0x5e600){var _0x1ca988={};_0x1ca988[_0x5e600]={'$like':'%'+_0x2aeb1e[_0x69ee('0x2a')]['filter']+'%'};return _0x1ca988;})});}_0xcabf09=_[_0x69ee('0x3b')]({},_0xcabf09,_0x2aeb1e['options']);var _0x446f4d={'where':_0xcabf09['where']};return db[_0x69ee('0x27')][_0x69ee('0x19')](_0x446f4d)[_0x69ee('0x21')](function(_0x11e64d){_0x3c34f7[_0x69ee('0x19')]=_0x11e64d;if(_0x2aeb1e['query'][_0x69ee('0x3d')]){_0xcabf09['include']=[{'all':!![]}];}return db[_0x69ee('0x27')]['findAll'](_0xcabf09);})['then'](function(_0x535a54){_0x3c34f7[_0x69ee('0x3e')]=_0x535a54;return _0x3c34f7;})['then'](respondWithFilteredResult(_0x759b4f,_0xcabf09))[_0x69ee('0x3f')](handleError(_0x759b4f,null));};exports[_0x69ee('0x40')]=function(_0x2c2277,_0x3c3f8d){var _0x57cf24={'raw':!![],'where':{'id':_0x2c2277[_0x69ee('0x41')]['id']}},_0x59a4d1={};_0x59a4d1[_0x69ee('0x28')]=_[_0x69ee('0x29')](db['ChatInternalMessage'][_0x69ee('0x42')]);_0x59a4d1[_0x69ee('0x2a')]=_['keys'](_0x2c2277[_0x69ee('0x2a')]);_0x59a4d1['filters']=_[_0x69ee('0x2c')](_0x59a4d1[_0x69ee('0x28')],_0x59a4d1[_0x69ee('0x2a')]);_0x57cf24[_0x69ee('0x2d')]=_['intersection'](_0x59a4d1[_0x69ee('0x28')],qs[_0x69ee('0x2e')](_0x2c2277[_0x69ee('0x2a')][_0x69ee('0x2e')]));_0x57cf24[_0x69ee('0x2d')]=_0x57cf24[_0x69ee('0x2d')][_0x69ee('0x2f')]?_0x57cf24[_0x69ee('0x2d')]:_0x59a4d1[_0x69ee('0x28')];if(_0x2c2277[_0x69ee('0x2a')][_0x69ee('0x3d')]){_0x57cf24['include']=[{'all':!![]}];}_0x57cf24=_[_0x69ee('0x3b')]({},_0x57cf24,_0x2c2277[_0x69ee('0x43')]);return db[_0x69ee('0x27')][_0x69ee('0x44')](_0x57cf24)[_0x69ee('0x21')](handleEntityNotFound(_0x3c3f8d,null))['then'](respondWithResult(_0x3c3f8d,null))[_0x69ee('0x3f')](handleError(_0x3c3f8d,null));};exports[_0x69ee('0x45')]=function(_0x3aef3e,_0x5063fd){return db[_0x69ee('0x27')][_0x69ee('0x45')](_0x3aef3e['body'],{})['then'](respondWithResult(_0x5063fd,0xc9))[_0x69ee('0x3f')](handleError(_0x5063fd,null));};exports[_0x69ee('0x20')]=function(_0x177cec,_0x4016c3){if(_0x177cec['body']['id']){delete _0x177cec['body']['id'];}return db[_0x69ee('0x27')][_0x69ee('0x44')]({'where':{'id':_0x177cec[_0x69ee('0x41')]['id']}})['then'](handleEntityNotFound(_0x4016c3,null))[_0x69ee('0x21')](saveUpdates(_0x177cec['body'],null))[_0x69ee('0x21')](respondWithResult(_0x4016c3,null))[_0x69ee('0x3f')](handleError(_0x4016c3,null));};exports[_0x69ee('0x22')]=function(_0xe1e121,_0x3c98c4){return db[_0x69ee('0x27')][_0x69ee('0x44')]({'where':{'id':_0xe1e121[_0x69ee('0x41')]['id']}})[_0x69ee('0x21')](handleEntityNotFound(_0x3c98c4,null))[_0x69ee('0x21')](removeEntity(_0x3c98c4,null))[_0x69ee('0x3f')](handleError(_0x3c98c4,null));};exports['describe']=function(_0x53bf0c,_0x1aea2d){return db[_0x69ee('0x27')][_0x69ee('0x46')]()[_0x69ee('0x21')](respondWithResult(_0x1aea2d,null))[_0x69ee('0x3f')](handleError(_0x1aea2d,null));};function wrapUser(_0x754da0){return function(_0x410a6b){var _0x52d77f=_0x754da0[_0x69ee('0x47')]({'plain':!![]});_0x52d77f['messages']=[];if(_0x410a6b){_0x52d77f[_0x69ee('0x48')]=_0x410a6b[_0x69ee('0x49')];_0x52d77f[_0x69ee('0x4a')]=_0x410a6b;}else{_0x52d77f[_0x69ee('0x48')]=moment(0x0)[_0x69ee('0x4b')](_0x69ee('0x4c'));_0x52d77f['lastMessage']={};}return _0x52d77f;};}exports['getUsers']=function(_0x4cfb1b,_0x5e062c,_0x23aaf7){var _0xe4fd26=[];return db[_0x69ee('0x4d')][_0x69ee('0x4e')]({'where':{'role':[_0x69ee('0x4f'),_0x69ee('0x50'),_0x69ee('0x51')]},'attributes':['id',_0x69ee('0x52'),_0x69ee('0x24'),_0x69ee('0x53'),_0x69ee('0x54'),_0x69ee('0x55'),'online',_0x69ee('0x56'),_0x69ee('0x57'),'showWebBar'],'order':qs[_0x69ee('0x34')](_0x69ee('0x58')),'include':[{'model':db['VoiceQueue'],'as':_0x69ee('0x59'),'attributes':['id','name',_0x69ee('0x5a')],'through':{'attributes':[]}}]})[_0x69ee('0x21')](function(_0x577060){var _0x42b2a0=[];if(_0x577060){_0xe4fd26=_0x577060;for(var _0x46fa14=0x0;_0x46fa14<_0x577060['length'];_0x46fa14+=0x1){_0xe4fd26[_0x46fa14]['messages']=[];_0x42b2a0[_0x69ee('0x5b')](db[_0x69ee('0x27')][_0x69ee('0x44')]({'where':{'FromId':[_0x4cfb1b['user']['id'],_0x577060[_0x46fa14]['id']],'ToId':[_0x4cfb1b[_0x69ee('0x51')]['id'],_0x577060[_0x46fa14]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x69ee('0x5c'),_0x69ee('0x5d'),'read','body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x69ee('0x21')](wrapUser(_0x577060[_0x46fa14])));}return BPromise['all'](_0x42b2a0);}return[];})[_0x69ee('0x21')](function(_0x2c8aec){return{'rows':_0x2c8aec,'count':_0x2c8aec[_0x69ee('0x2f')]};})['then'](respondWithResult(_0x5e062c,null))['catch'](handleError(_0x5e062c,null));}; \ No newline at end of file +var _0x19be=['day','merge','filter','map','options','ChatInternalMessage','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','userpic','internal','lastLoginAt','allowmessenger','-online','VoiceQueue','push','FromId','ToId','read','-createdAt','all','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','nolimit','sort','where'];(function(_0x3f54f4,_0x988092){var _0x2008de=function(_0x399831){while(--_0x399831){_0x3f54f4['push'](_0x3f54f4['shift']());}};_0x2008de(++_0x988092);}(_0x19be,0x1de));var _0xe19b=function(_0x49f876,_0x232e17){_0x49f876=_0x49f876-0x0;var _0x2d5f8c=_0x19be[_0x49f876];return _0x2d5f8c;};'use strict';var jsonpatch=require(_0xe19b('0x0'));var rp=require(_0xe19b('0x1'));var moment=require(_0xe19b('0x2'));var BPromise=require(_0xe19b('0x3'));var Mustache=require('mustache');var util=require(_0xe19b('0x4'));var path=require('path');var sox=require(_0xe19b('0x5'));var csv=require(_0xe19b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe19b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe19b('0x8'));var toCsv=require('to-csv');var querystring=require(_0xe19b('0x9'));var Papa=require(_0xe19b('0xa'));var qs=require(_0xe19b('0xb'));var logger=require(_0xe19b('0xc'))('api');var utils=require('../../config/utils');var config=require(_0xe19b('0xd'));var db=require(_0xe19b('0xe'))['db'];var socket=require(_0xe19b('0xf'))({'host':_0xe19b('0x10'),'port':0x18eb});require(_0xe19b('0x11'))[_0xe19b('0x12')](socket);function respondWithStatusCode(_0x3fbcd3,_0x376cf4){_0x376cf4=_0x376cf4||0xcc;return function(_0x32da06){if(_0x32da06){return _0x3fbcd3[_0xe19b('0x13')](_0x376cf4);}return _0x3fbcd3[_0xe19b('0x14')](_0x376cf4)[_0xe19b('0x15')]();};}function respondWithResult(_0xfe565f,_0x29d7f5){_0x29d7f5=_0x29d7f5||0xc8;return function(_0x403835){if(_0x403835){return _0xfe565f[_0xe19b('0x14')](_0x29d7f5)[_0xe19b('0x16')](_0x403835);}};}function respondWithFilteredResult(_0x1bd3dd,_0x530f7d){return function(_0x5451dd){if(_0x5451dd){var _0xf5b854=_0x5451dd[_0xe19b('0x17')],_0x6895d9=_0x530f7d[_0xe19b('0x18')],_0x244a43=_0x530f7d[_0xe19b('0x18')]+_0x530f7d[_0xe19b('0x19')],_0x3e94f3;if(_0x244a43>=_0xf5b854){_0x244a43=_0xf5b854;_0x3e94f3=0xc8;}else{_0x3e94f3=0xce;}_0x1bd3dd[_0xe19b('0x14')](_0x3e94f3);return _0x1bd3dd[_0xe19b('0x1a')]('Content-Range',_0x6895d9+'-'+_0x244a43+'/'+_0xf5b854)['json'](_0x5451dd);}return null;};}function patchUpdates(_0x32adb4){return function(_0x3e6fa1){try{jsonpatch[_0xe19b('0x1b')](_0x3e6fa1,_0x32adb4,!![]);}catch(_0x4a011d){return BPromise[_0xe19b('0x1c')](_0x4a011d);}return _0x3e6fa1[_0xe19b('0x1d')]();};}function saveUpdates(_0x54dcd7,_0x56413e){return function(_0x412d32){if(_0x412d32){return _0x412d32[_0xe19b('0x1e')](_0x54dcd7)[_0xe19b('0x1f')](function(_0xe3dc1b){return _0xe3dc1b;});}return null;};}function removeEntity(_0x54c32d,_0x412a6a){return function(_0x2f7f3b){if(_0x2f7f3b){return _0x2f7f3b[_0xe19b('0x20')]()[_0xe19b('0x1f')](function(){_0x54c32d[_0xe19b('0x14')](0xcc)[_0xe19b('0x15')]();});}};}function handleEntityNotFound(_0x1e7e45,_0x4e4fee){return function(_0x1e2b41){if(!_0x1e2b41){_0x1e7e45[_0xe19b('0x13')](0x194);}return _0x1e2b41;};}function handleError(_0x4dfe6f,_0xef87){_0xef87=_0xef87||0x1f4;return function(_0x7d35ab){logger['error'](_0x7d35ab[_0xe19b('0x21')]);if(_0x7d35ab[_0xe19b('0x22')]){delete _0x7d35ab['name'];}_0x4dfe6f[_0xe19b('0x14')](_0xef87)['send'](_0x7d35ab);};}exports[_0xe19b('0x23')]=function(_0x24a959,_0x34d390){var _0x273bbb={},_0x284338={},_0x55f54c={'count':0x0,'rows':[]};var _0x45b053=db['ChatInternalMessage'][_0xe19b('0x24')];_0x284338[_0xe19b('0x25')]=_[_0xe19b('0x26')](_0x45b053);var _0x4cbb40={'dateStart':_0x24a959[_0xe19b('0x27')][_0xe19b('0x28')],'dateEnd':_0x24a959['query'][_0xe19b('0x29')]};delete _0x24a959[_0xe19b('0x27')]['dateStart'];delete _0x24a959['query']['dateEnd'];_0x284338[_0xe19b('0x27')]=_[_0xe19b('0x26')](_0x24a959[_0xe19b('0x27')]);_0x284338[_0xe19b('0x2a')]=_[_0xe19b('0x2b')](_0x284338[_0xe19b('0x25')],_0x284338[_0xe19b('0x27')]);_0x273bbb['attributes']=_[_0xe19b('0x2b')](_0x284338[_0xe19b('0x25')],qs[_0xe19b('0x2c')](_0x24a959[_0xe19b('0x27')][_0xe19b('0x2c')]));_0x273bbb[_0xe19b('0x2d')]=_0x273bbb[_0xe19b('0x2d')][_0xe19b('0x2e')]?_0x273bbb['attributes']:_0x284338[_0xe19b('0x25')];if(!_0x24a959[_0xe19b('0x27')]['hasOwnProperty'](_0xe19b('0x2f'))){_0x273bbb[_0xe19b('0x19')]=qs[_0xe19b('0x19')](_0x24a959[_0xe19b('0x27')][_0xe19b('0x19')]);_0x273bbb[_0xe19b('0x18')]=qs[_0xe19b('0x18')](_0x24a959['query']['offset']);}_0x273bbb['order']=qs[_0xe19b('0x30')](_0x24a959[_0xe19b('0x27')][_0xe19b('0x30')]);_0x273bbb[_0xe19b('0x31')]=qs[_0xe19b('0x2a')](_['pick'](_0x24a959['query'],_0x284338['filters']));if(_0x4cbb40[_0xe19b('0x28')]){if(_0x4cbb40[_0xe19b('0x29')]){_0x4cbb40[_0xe19b('0x29')]=moment(_0x4cbb40[_0xe19b('0x29')])['add'](0x1,_0xe19b('0x32'));}else{_0x4cbb40['dateEnd']=moment(_0x4cbb40[_0xe19b('0x28')])['add'](0x1,_0xe19b('0x32'));}_[_0xe19b('0x33')](_0x273bbb[_0xe19b('0x31')],{'createdAt':{'$gte':_0x4cbb40[_0xe19b('0x28')],'$lte':_0x4cbb40[_0xe19b('0x29')]}});}if(_0x24a959['query'][_0xe19b('0x34')]){_0x273bbb[_0xe19b('0x31')]=_[_0xe19b('0x33')](_0x273bbb[_0xe19b('0x31')],{'$or':_[_0xe19b('0x35')](_0x273bbb[_0xe19b('0x2d')],function(_0x224725){var _0x57485d={};_0x57485d[_0x224725]={'$like':'%'+_0x24a959[_0xe19b('0x27')]['filter']+'%'};return _0x57485d;})});}_0x273bbb=_[_0xe19b('0x33')]({},_0x273bbb,_0x24a959[_0xe19b('0x36')]);var _0x232026={'where':_0x273bbb['where']};return db[_0xe19b('0x37')]['count'](_0x232026)['then'](function(_0x59c697){_0x55f54c['count']=_0x59c697;if(_0x24a959['query'][_0xe19b('0x38')]){_0x273bbb['include']=[{'all':!![]}];}return db[_0xe19b('0x37')][_0xe19b('0x39')](_0x273bbb);})[_0xe19b('0x1f')](function(_0x7acb21){_0x55f54c[_0xe19b('0x3a')]=_0x7acb21;return _0x55f54c;})[_0xe19b('0x1f')](respondWithFilteredResult(_0x34d390,_0x273bbb))[_0xe19b('0x3b')](handleError(_0x34d390,null));};exports[_0xe19b('0x3c')]=function(_0x56f0ac,_0x1059ac){var _0x4b5b01={'raw':!![],'where':{'id':_0x56f0ac[_0xe19b('0x3d')]['id']}},_0x4ad549={};_0x4ad549[_0xe19b('0x25')]=_[_0xe19b('0x26')](db[_0xe19b('0x37')][_0xe19b('0x24')]);_0x4ad549['query']=_[_0xe19b('0x26')](_0x56f0ac[_0xe19b('0x27')]);_0x4ad549[_0xe19b('0x2a')]=_[_0xe19b('0x2b')](_0x4ad549[_0xe19b('0x25')],_0x4ad549['query']);_0x4b5b01[_0xe19b('0x2d')]=_[_0xe19b('0x2b')](_0x4ad549[_0xe19b('0x25')],qs[_0xe19b('0x2c')](_0x56f0ac[_0xe19b('0x27')]['fields']));_0x4b5b01['attributes']=_0x4b5b01[_0xe19b('0x2d')][_0xe19b('0x2e')]?_0x4b5b01['attributes']:_0x4ad549[_0xe19b('0x25')];if(_0x56f0ac[_0xe19b('0x27')]['includeAll']){_0x4b5b01[_0xe19b('0x3e')]=[{'all':!![]}];}_0x4b5b01=_[_0xe19b('0x33')]({},_0x4b5b01,_0x56f0ac[_0xe19b('0x36')]);return db[_0xe19b('0x37')][_0xe19b('0x3f')](_0x4b5b01)[_0xe19b('0x1f')](handleEntityNotFound(_0x1059ac,null))[_0xe19b('0x1f')](respondWithResult(_0x1059ac,null))[_0xe19b('0x3b')](handleError(_0x1059ac,null));};exports[_0xe19b('0x40')]=function(_0x22dccd,_0x77c44a){return db[_0xe19b('0x37')][_0xe19b('0x40')](_0x22dccd[_0xe19b('0x41')],{})[_0xe19b('0x1f')](respondWithResult(_0x77c44a,0xc9))['catch'](handleError(_0x77c44a,null));};exports[_0xe19b('0x1e')]=function(_0x137c81,_0x2d56a0){if(_0x137c81['body']['id']){delete _0x137c81[_0xe19b('0x41')]['id'];}return db[_0xe19b('0x37')][_0xe19b('0x3f')]({'where':{'id':_0x137c81[_0xe19b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2d56a0,null))[_0xe19b('0x1f')](saveUpdates(_0x137c81[_0xe19b('0x41')],null))[_0xe19b('0x1f')](respondWithResult(_0x2d56a0,null))['catch'](handleError(_0x2d56a0,null));};exports[_0xe19b('0x20')]=function(_0x539509,_0x4852ec){return db[_0xe19b('0x37')]['find']({'where':{'id':_0x539509[_0xe19b('0x3d')]['id']}})[_0xe19b('0x1f')](handleEntityNotFound(_0x4852ec,null))[_0xe19b('0x1f')](removeEntity(_0x4852ec,null))['catch'](handleError(_0x4852ec,null));};exports[_0xe19b('0x42')]=function(_0x2f34bd,_0x1f45ca){return db[_0xe19b('0x37')][_0xe19b('0x42')]()[_0xe19b('0x1f')](respondWithResult(_0x1f45ca,null))[_0xe19b('0x3b')](handleError(_0x1f45ca,null));};function wrapUser(_0x285916){return function(_0x2c93cc){var _0x25221b=_0x285916['get']({'plain':!![]});_0x25221b[_0xe19b('0x43')]=[];if(_0x2c93cc){_0x25221b[_0xe19b('0x44')]=_0x2c93cc[_0xe19b('0x45')];_0x25221b['lastMessage']=_0x2c93cc;}else{_0x25221b[_0xe19b('0x44')]=moment(0x0)['format'](_0xe19b('0x46'));_0x25221b['lastMessage']={};}return _0x25221b;};}exports[_0xe19b('0x47')]=function(_0x403a80,_0x349396,_0xda84b0){var _0x31ee9e=[];return db[_0xe19b('0x48')][_0xe19b('0x39')]({'where':{'role':[_0xe19b('0x49'),'admin',_0xe19b('0x4a')]},'attributes':['id',_0xe19b('0x4b'),_0xe19b('0x22'),'role',_0xe19b('0x4c'),_0xe19b('0x4d'),'online',_0xe19b('0x4e'),_0xe19b('0x4f'),'showWebBar'],'order':qs[_0xe19b('0x30')](_0xe19b('0x50')),'include':[{'model':db[_0xe19b('0x51')],'as':'VoiceQueues','attributes':['id',_0xe19b('0x22'),'type'],'through':{'attributes':[]}}]})['then'](function(_0xf35aa){var _0x2c8987=[];if(_0xf35aa){_0x31ee9e=_0xf35aa;for(var _0x576b05=0x0;_0x576b05<_0xf35aa[_0xe19b('0x2e')];_0x576b05+=0x1){_0x31ee9e[_0x576b05][_0xe19b('0x43')]=[];_0x2c8987[_0xe19b('0x52')](db['ChatInternalMessage'][_0xe19b('0x3f')]({'where':{'FromId':[_0x403a80['user']['id'],_0xf35aa[_0x576b05]['id']],'ToId':[_0x403a80[_0xe19b('0x4a')]['id'],_0xf35aa[_0x576b05]['id']],'ChatGroupId':null},'attributes':['id',_0xe19b('0x45'),_0xe19b('0x53'),_0xe19b('0x54'),_0xe19b('0x55'),_0xe19b('0x41')],'order':qs['sort'](_0xe19b('0x56')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe19b('0x1f')](wrapUser(_0xf35aa[_0x576b05])));}return BPromise[_0xe19b('0x57')](_0x2c8987);}return[];})[_0xe19b('0x1f')](function(_0x34a91d){return{'rows':_0x34a91d,'count':_0x34a91d[_0xe19b('0x2e')]};})[_0xe19b('0x1f')](respondWithResult(_0x349396,null))[_0xe19b('0x3b')](handleError(_0x349396,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 481adf1..ca37318 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 _0x2b9e=['update','remove','emit','hasOwnProperty','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x2b9e,0x1c4));var _0xe2b9=function(_0x445741,_0x28e35c){_0x445741=_0x445741-0x0;var _0x466635=_0x2b9e[_0x445741];return _0x466635;};'use strict';var EventEmitter=require(_0xe2b9('0x0'));var ChatInternalMessage=require(_0xe2b9('0x1'))['db'][_0xe2b9('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe2b9('0x3'),'afterUpdate':_0xe2b9('0x4'),'afterDestroy':_0xe2b9('0x5')};function emitEvent(_0x558828){return function(_0x24e6b0,_0x532c1a,_0x57a42f){ChatInternalMessageEvents[_0xe2b9('0x6')](_0x558828+':'+_0x24e6b0['id'],_0x24e6b0);ChatInternalMessageEvents[_0xe2b9('0x6')](_0x558828,_0x24e6b0);_0x57a42f(null);};}for(var e in events){if(events[_0xe2b9('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x5c18=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x38fbd4,_0xfc188e){var _0x23a8df=function(_0x228366){while(--_0x228366){_0x38fbd4['push'](_0x38fbd4['shift']());}};_0x23a8df(++_0xfc188e);}(_0x5c18,0xe9));var _0x85c1=function(_0x2ff3e7,_0x42fcfb){_0x2ff3e7=_0x2ff3e7-0x0;var _0x4393af=_0x5c18[_0x2ff3e7];return _0x4393af;};'use strict';var EventEmitter=require(_0x85c1('0x0'));var ChatInternalMessage=require(_0x85c1('0x1'))['db'][_0x85c1('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x85c1('0x3')](0x0);var events={'afterCreate':_0x85c1('0x4'),'afterUpdate':_0x85c1('0x5'),'afterDestroy':_0x85c1('0x6')};function emitEvent(_0x3711e9){return function(_0x4a032e,_0x5bbe7b,_0x2c15fa){ChatInternalMessageEvents[_0x85c1('0x7')](_0x3711e9+':'+_0x4a032e['id'],_0x4a032e);ChatInternalMessageEvents['emit'](_0x3711e9,_0x4a032e);_0x2c15fa(null);};}for(var e in events){if(events[_0x85c1('0x8')](e)){var event=events[e];ChatInternalMessage[_0x85c1('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 2ac6664..515b861 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 _0x3d32=['./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4','lodash','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d32,0x13c));var _0x23d3=function(_0x46d090,_0x4440df){_0x46d090=_0x46d090-0x0;var _0x5ca51e=_0x3d32[_0x46d090];return _0x5ca51e;};'use strict';var _=require(_0x23d3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x23d3('0x1'));var attributes=require(_0x23d3('0x2'));module[_0x23d3('0x3')]=function(_0x14b943,_0x4ac82c){return _0x14b943['define'](_0x23d3('0x4'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x23d3('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf9e6=['../../config/logger','api','moment','bluebird','request-promise','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2847dc,_0x15ddf7){var _0x5b6232=function(_0xdf5743){while(--_0xdf5743){_0x2847dc['push'](_0x2847dc['shift']());}};_0x5b6232(++_0x15ddf7);}(_0xf9e6,0x9a));var _0x6f9e=function(_0x31cd42,_0x1b1a81){_0x31cd42=_0x31cd42-0x0;var _0xfee011=_0xf9e6[_0x31cd42];return _0xfee011;};'use strict';var _=require(_0x6f9e('0x0'));var util=require(_0x6f9e('0x1'));var logger=require(_0x6f9e('0x2'))(_0x6f9e('0x3'));var moment=require(_0x6f9e('0x4'));var BPromise=require(_0x6f9e('0x5'));var rp=require(_0x6f9e('0x6'));var attributes=require(_0x6f9e('0x7'));module['exports']=function(_0x5454b7,_0x3ce111){return _0x5454b7[_0x6f9e('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x6f9e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f9e('0xa'),'collate':_0x6f9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index df5a94a..2caa0c1 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 _0x4c7f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','./chatInternalMessage.socket','register','then','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4c7f,0x19a));var _0xf4c7=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x4c7f[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0xf4c7('0x0'));var util=require(_0xf4c7('0x1'));var moment=require(_0xf4c7('0x2'));var BPromise=require(_0xf4c7('0x3'));var rs=require(_0xf4c7('0x4'));var fs=require('fs');var db=require(_0xf4c7('0x5'))['db'];var utils=require(_0xf4c7('0x6'));var logger=require(_0xf4c7('0x7'))(_0xf4c7('0x8'));var config=require(_0xf4c7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf4c7('0xa')][_0xf4c7('0xb')]({'port':0x232a});var socket=require(_0xf4c7('0xc'))({'host':'localhost','port':0x18eb});require(_0xf4c7('0xd'))[_0xf4c7('0xe')](socket);function respondWithRpcPromise(_0x2c2161,_0x2101fe,_0x134202){return new BPromise(function(_0x22361f,_0xc0e148){return client['request'](_0x2c2161,_0x134202)[_0xf4c7('0xf')](function(_0x24e823){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x2101fe,_0xf4c7('0x10'));logger[_0xf4c7('0x11')](_0xf4c7('0x12'),_0x2101fe,'request\x20sent',JSON[_0xf4c7('0x13')](_0x24e823));if(_0x24e823[_0xf4c7('0x14')]){if(_0x24e823[_0xf4c7('0x14')][_0xf4c7('0x15')]===0x1f4){logger[_0xf4c7('0x14')](_0xf4c7('0x16'),_0x2101fe,_0x24e823[_0xf4c7('0x14')][_0xf4c7('0x17')]);return _0xc0e148(_0x24e823[_0xf4c7('0x14')][_0xf4c7('0x17')]);}logger[_0xf4c7('0x14')](_0xf4c7('0x16'),_0x2101fe,_0x24e823[_0xf4c7('0x14')]['message']);return _0x22361f(_0x24e823[_0xf4c7('0x14')][_0xf4c7('0x17')]);}else{logger[_0xf4c7('0x18')](_0xf4c7('0x16'),_0x2101fe,_0xf4c7('0x10'));_0x22361f(_0x24e823['result']['message']);}})[_0xf4c7('0x19')](function(_0x3ce098){logger[_0xf4c7('0x14')](_0xf4c7('0x16'),_0x2101fe,_0x3ce098);_0xc0e148(_0x3ce098);});});} \ No newline at end of file +var _0x0db1=['request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x36a075,_0x24f514){var _0x57203c=function(_0x27c686){while(--_0x27c686){_0x36a075['push'](_0x36a075['shift']());}};_0x57203c(++_0x24f514);}(_0x0db1,0xf9));var _0x10db=function(_0x9e5c4,_0xc0192b){_0x9e5c4=_0x9e5c4-0x0;var _0x2e41fb=_0x0db1[_0x9e5c4];return _0x2e41fb;};'use strict';var _=require(_0x10db('0x0'));var util=require(_0x10db('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x10db('0x2'));var fs=require('fs');var db=require(_0x10db('0x3'))['db'];var utils=require(_0x10db('0x4'));var logger=require(_0x10db('0x5'))('rpc');var config=require(_0x10db('0x6'));var jayson=require(_0x10db('0x7'));var client=jayson[_0x10db('0x8')][_0x10db('0x9')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x10db('0xa'),'port':0x18eb});require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5b4b7c,_0x5e7ed8,_0x25a53f){return new BPromise(function(_0xaf8fbe,_0x4f57f3){return client[_0x10db('0xb')](_0x5b4b7c,_0x25a53f)[_0x10db('0xc')](function(_0x1d47b5){logger[_0x10db('0xd')](_0x10db('0xe'),_0x5e7ed8,_0x10db('0xf'));logger[_0x10db('0x10')](_0x10db('0x11'),_0x5e7ed8,_0x10db('0xf'),JSON[_0x10db('0x12')](_0x1d47b5));if(_0x1d47b5[_0x10db('0x13')]){if(_0x1d47b5[_0x10db('0x13')][_0x10db('0x14')]===0x1f4){logger['error'](_0x10db('0xe'),_0x5e7ed8,_0x1d47b5['error'][_0x10db('0x15')]);return _0x4f57f3(_0x1d47b5[_0x10db('0x13')][_0x10db('0x15')]);}logger['error'](_0x10db('0xe'),_0x5e7ed8,_0x1d47b5[_0x10db('0x13')][_0x10db('0x15')]);return _0xaf8fbe(_0x1d47b5[_0x10db('0x13')][_0x10db('0x15')]);}else{logger[_0x10db('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x5e7ed8,_0x10db('0xf'));_0xaf8fbe(_0x1d47b5[_0x10db('0x16')][_0x10db('0x15')]);}})[_0x10db('0x17')](function(_0x58ce97){logger[_0x10db('0x13')](_0x10db('0xe'),_0x5e7ed8,_0x58ce97);_0x4f57f3(_0x58ce97);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f29dfeb..3737aa0 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 _0x38e6=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x3a912c,_0x433098){var _0x368368=function(_0x3197ec){while(--_0x3197ec){_0x3a912c['push'](_0x3a912c['shift']());}};_0x368368(++_0x433098);}(_0x38e6,0x68));var _0x638e=function(_0x2edfee,_0x16bdb5){_0x2edfee=_0x2edfee-0x0;var _0x8710ef=_0x38e6[_0x2edfee];return _0x8710ef;};'use strict';var ChatInternalMessageEvents=require(_0x638e('0x0'));var events=['save','remove',_0x638e('0x1')];function createListener(_0x463db7,_0x489485){return function(_0x190fbb){_0x489485[_0x638e('0x2')](_0x463db7,_0x190fbb);};}function removeListener(_0x483ee3,_0x320299){return function(){ChatInternalMessageEvents[_0x638e('0x3')](_0x483ee3,_0x320299);};}exports[_0x638e('0x4')]=function(_0x3ba66d){for(var _0x3ec550=0x0,_0x124933=events[_0x638e('0x5')];_0x3ec550<_0x124933;_0x3ec550++){var _0x579e8b=events[_0x3ec550];var _0xfdfc95=createListener(_0x638e('0x6')+_0x579e8b,_0x3ba66d);ChatInternalMessageEvents['on'](_0x579e8b,_0xfdfc95);}}; \ No newline at end of file +var _0x7edd=['removeListener','register','chatInternalMessage:','remove','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7edd,0xcb));var _0xd7ed=function(_0x20bad3,_0x186256){_0x20bad3=_0x20bad3-0x0;var _0x350c5a=_0x7edd[_0x20bad3];return _0x350c5a;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0xd7ed('0x0'),'update'];function createListener(_0x4e841f,_0x2d502a){return function(_0x18e41e){_0x2d502a[_0xd7ed('0x1')](_0x4e841f,_0x18e41e);};}function removeListener(_0x2f5bd1,_0x5c1061){return function(){ChatInternalMessageEvents[_0xd7ed('0x2')](_0x2f5bd1,_0x5c1061);};}exports[_0xd7ed('0x3')]=function(_0x331a57){for(var _0x1fd14f=0x0,_0x1c4737=events['length'];_0x1fd14f<_0x1c4737;_0x1fd14f++){var _0x36415d=events[_0x1fd14f];var _0x14c4cf=createListener(_0xd7ed('0x4')+_0x36415d,_0x331a57);ChatInternalMessageEvents['on'](_0x36415d,_0x14c4cf);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 077efd1..3163bf5 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 _0xac4a=['util','path','express','Router','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','/users','create','put','/:id','update','destroy','exports','multer'];(function(_0x599d2e,_0x3a3d4f){var _0x5bba1d=function(_0x51eba6){while(--_0x51eba6){_0x599d2e['push'](_0x599d2e['shift']());}};_0x5bba1d(++_0x3a3d4f);}(_0xac4a,0x13f));var _0xaac4=function(_0x26a759,_0x578e13){_0x26a759=_0x26a759-0x0;var _0x43f7d1=_0xac4a[_0x26a759];return _0x43f7d1;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var express=require(_0xaac4('0x3'));var router=express[_0xaac4('0x4')]();var auth=require(_0xaac4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaac4('0x6'));router[_0xaac4('0x7')]('/',auth[_0xaac4('0x8')](),controller['index']);router[_0xaac4('0x7')]('/describe',auth[_0xaac4('0x8')](),controller['describe']);router[_0xaac4('0x7')](_0xaac4('0x9'),auth['isAuthenticated'](),controller['getUsers']);router[_0xaac4('0x7')]('/:id',auth[_0xaac4('0x8')](),controller['show']);router['post']('/',auth[_0xaac4('0x8')](),controller[_0xaac4('0xa')]);router[_0xaac4('0xb')](_0xaac4('0xc'),controller[_0xaac4('0xd')]);router['delete']('/:id',auth[_0xaac4('0x8')](),controller[_0xaac4('0xe')]);module[_0xaac4('0xf')]=router; \ No newline at end of file +var _0xac4a=['util','path','express','Router','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','/users','create','put','/:id','update','destroy','exports','multer'];(function(_0xdc7ea2,_0x5476df){var _0x5d98e5=function(_0x3adc2f){while(--_0x3adc2f){_0xdc7ea2['push'](_0xdc7ea2['shift']());}};_0x5d98e5(++_0x5476df);}(_0xac4a,0x13f));var _0xaac4=function(_0x2f18f4,_0x6aa48f){_0x2f18f4=_0x2f18f4-0x0;var _0x156fc7=_0xac4a[_0x2f18f4];return _0x156fc7;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var express=require(_0xaac4('0x3'));var router=express[_0xaac4('0x4')]();var auth=require(_0xaac4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaac4('0x6'));router[_0xaac4('0x7')]('/',auth[_0xaac4('0x8')](),controller['index']);router[_0xaac4('0x7')]('/describe',auth[_0xaac4('0x8')](),controller['describe']);router[_0xaac4('0x7')](_0xaac4('0x9'),auth['isAuthenticated'](),controller['getUsers']);router[_0xaac4('0x7')]('/:id',auth[_0xaac4('0x8')](),controller['show']);router['post']('/',auth[_0xaac4('0x8')](),controller[_0xaac4('0xa')]);router[_0xaac4('0xb')](_0xaac4('0xc'),controller[_0xaac4('0xd')]);router['delete']('/:id',auth[_0xaac4('0x8')](),controller[_0xaac4('0xe')]);module[_0xaac4('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ed5bb9b..a2b9b65 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 _0xb11d=['medium','BOOLEAN','out','DATE','sequelize','exports','TEXT'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0xb11d,0x6d));var _0xdb11=function(_0x3b4a5b,_0x108d63){_0x3b4a5b=_0x3b4a5b-0x0;var _0x22a556=_0xb11d[_0x3b4a5b];return _0x22a556;};'use strict';var Sequelize=require(_0xdb11('0x0'));module[_0xdb11('0x1')]={'body':{'type':Sequelize[_0xdb11('0x2')](_0xdb11('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdb11('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xdb11('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdb11('0x5')),'defaultValue':_0xdb11('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdb11('0x6')]}}; \ No newline at end of file +var _0x2d9a=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x18889f,_0x5322d6){var _0x4f0a11=function(_0x2513a6){while(--_0x2513a6){_0x18889f['push'](_0x18889f['shift']());}};_0x4f0a11(++_0x5322d6);}(_0x2d9a,0x1c9));var _0xa2d9=function(_0x11090e,_0x2f1226){_0x11090e=_0x11090e-0x0;var _0x103e19=_0x2d9a[_0x11090e];return _0x103e19;};'use strict';var Sequelize=require(_0xa2d9('0x0'));module[_0xa2d9('0x1')]={'body':{'type':Sequelize[_0xa2d9('0x2')](_0xa2d9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa2d9('0x5')]('in','out'),'defaultValue':_0xa2d9('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa2d9('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 552b62b..f7b2540 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 _0xbcad=['end','json','count','offset','set','Content-Range','save','destroy','send','index','keys','query','dateStart','dateEnd','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','add','day','filter','merge','map','options','includeAll','ChatMessage','findAll','catch','show','rawAttributes','include','create','body','update','find','params','describe','chat-interactions','accept','chat','format','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','AcceptMessage','acceptMessage','interface','channel','EventManager','acceptmessage','parse','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SIP/%s','event','reject','rejectmessage','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','./chatMessage.socket','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status'];(function(_0x499b6c,_0xed685f){var _0x14c559=function(_0x5df933){while(--_0x5df933){_0x499b6c['push'](_0x499b6c['shift']());}};_0x14c559(++_0xed685f);}(_0xbcad,0x129));var _0xdbca=function(_0x1ab873,_0xa4fc2a){_0x1ab873=_0x1ab873-0x0;var _0x36bcd9=_0xbcad[_0x1ab873];return _0x36bcd9;};'use strict';var jsonpatch=require(_0xdbca('0x0'));var rp=require(_0xdbca('0x1'));var moment=require(_0xdbca('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdbca('0x3'));var util=require(_0xdbca('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdbca('0x5'));var fs=require('fs');var _=require(_0xdbca('0x6'));var squel=require(_0xdbca('0x7'));var crypto=require(_0xdbca('0x8'));var jsforce=require(_0xdbca('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdbca('0xa'));var Papa=require(_0xdbca('0xb'));var qs=require(_0xdbca('0xc'));var logger=require(_0xdbca('0xd'))(_0xdbca('0xe'));var utils=require(_0xdbca('0xf'));var config=require('../../config/environment');var db=require(_0xdbca('0x10'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xdbca('0x11'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdbca('0x12')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59104b,_0x9faae0,_0x4ccacd,_0x165aa7){return new BPromise(function(_0x36851e,_0x817db8){var _0xf9143a=_0x165aa7||client;return _0xf9143a[_0xdbca('0x13')](_0x59104b,_0x4ccacd)[_0xdbca('0x14')](function(_0x5bdf8e){logger[_0xdbca('0x15')](_0xdbca('0x16'),_0x9faae0,_0xdbca('0x17'));logger[_0xdbca('0x18')](_0xdbca('0x19'),_0x9faae0,_0xdbca('0x17'),JSON[_0xdbca('0x1a')](_0x5bdf8e));if(_0x5bdf8e[_0xdbca('0x1b')]){if(_0x5bdf8e['error'][_0xdbca('0x1c')]===0x1f4){logger[_0xdbca('0x1b')](_0xdbca('0x16'),_0x9faae0,_0x5bdf8e[_0xdbca('0x1b')][_0xdbca('0x1d')]);return _0x817db8(_0x5bdf8e[_0xdbca('0x1b')][_0xdbca('0x1d')]);}logger[_0xdbca('0x1b')](_0xdbca('0x16'),_0x9faae0,_0x5bdf8e['error'][_0xdbca('0x1d')]);return _0x36851e(_0x5bdf8e['error'][_0xdbca('0x1d')]);}else{logger[_0xdbca('0x15')](_0xdbca('0x16'),_0x9faae0,_0xdbca('0x17'));_0x36851e(_0x5bdf8e[_0xdbca('0x1e')][_0xdbca('0x1d')]);}})['catch'](function(_0x1d7a20){logger['error'](_0xdbca('0x16'),_0x9faae0,_0x1d7a20);_0x817db8(_0x1d7a20);});});}function respondWithStatusCode(_0xc94427,_0x516b98){_0x516b98=_0x516b98||0xcc;return function(_0x26ceec){if(_0x26ceec){return _0xc94427[_0xdbca('0x1f')](_0x516b98);}return _0xc94427[_0xdbca('0x20')](_0x516b98)[_0xdbca('0x21')]();};}function respondWithResult(_0x4c542a,_0x359466){_0x359466=_0x359466||0xc8;return function(_0x1845df){if(_0x1845df){return _0x4c542a[_0xdbca('0x20')](_0x359466)[_0xdbca('0x22')](_0x1845df);}};}function respondWithFilteredResult(_0xef619c,_0x5b0116){return function(_0x12f896){if(_0x12f896){var _0x43a38b=_0x12f896[_0xdbca('0x23')],_0x48e196=_0x5b0116[_0xdbca('0x24')],_0x4f8fa4=_0x5b0116[_0xdbca('0x24')]+_0x5b0116['limit'],_0x25eb39;if(_0x4f8fa4>=_0x43a38b){_0x4f8fa4=_0x43a38b;_0x25eb39=0xc8;}else{_0x25eb39=0xce;}_0xef619c['status'](_0x25eb39);return _0xef619c[_0xdbca('0x25')](_0xdbca('0x26'),_0x48e196+'-'+_0x4f8fa4+'/'+_0x43a38b)[_0xdbca('0x22')](_0x12f896);}return null;};}function patchUpdates(_0x32d0d8){return function(_0x2d2d34){try{jsonpatch['apply'](_0x2d2d34,_0x32d0d8,!![]);}catch(_0x4bc38f){return BPromise['reject'](_0x4bc38f);}return _0x2d2d34[_0xdbca('0x27')]();};}function saveUpdates(_0x21f1f9,_0x513d0b){return function(_0x4648da){if(_0x4648da){return _0x4648da['update'](_0x21f1f9)[_0xdbca('0x14')](function(_0x2d1608){return _0x2d1608;});}return null;};}function removeEntity(_0x242ab6,_0x21a790){return function(_0x4e29fa){if(_0x4e29fa){return _0x4e29fa[_0xdbca('0x28')]()[_0xdbca('0x14')](function(){_0x242ab6[_0xdbca('0x20')](0xcc)[_0xdbca('0x21')]();});}};}function handleEntityNotFound(_0x98e34f,_0xfee7b4){return function(_0x3cb103){if(!_0x3cb103){_0x98e34f['sendStatus'](0x194);}return _0x3cb103;};}function handleError(_0x52d701,_0x20e34a){_0x20e34a=_0x20e34a||0x1f4;return function(_0x4c0dcb){logger['error'](_0x4c0dcb['stack']);if(_0x4c0dcb['name']){delete _0x4c0dcb['name'];}_0x52d701[_0xdbca('0x20')](_0x20e34a)[_0xdbca('0x29')](_0x4c0dcb);};}exports[_0xdbca('0x2a')]=function(_0x4e51c8,_0x2753be){var _0x3be426={},_0x568825={},_0xfbb400={'count':0x0,'rows':[]};var _0xb23d71=db['ChatMessage']['rawAttributes'];_0x568825['model']=_[_0xdbca('0x2b')](_0xb23d71);var _0x5aba12={'dateStart':_0x4e51c8[_0xdbca('0x2c')][_0xdbca('0x2d')],'dateEnd':_0x4e51c8[_0xdbca('0x2c')][_0xdbca('0x2e')]};delete _0x4e51c8['query'][_0xdbca('0x2d')];delete _0x4e51c8[_0xdbca('0x2c')]['dateEnd'];_0x568825[_0xdbca('0x2c')]=_[_0xdbca('0x2b')](_0x4e51c8['query']);_0x568825['filters']=_['intersection'](_0x568825['model'],_0x568825['query']);_0x3be426['attributes']=_[_0xdbca('0x2f')](_0x568825[_0xdbca('0x30')],qs[_0xdbca('0x31')](_0x4e51c8['query']['fields']));_0x3be426[_0xdbca('0x32')]=_0x3be426['attributes'][_0xdbca('0x33')]?_0x3be426['attributes']:_0x568825[_0xdbca('0x30')];if(!_0x4e51c8[_0xdbca('0x2c')]['hasOwnProperty'](_0xdbca('0x34'))){_0x3be426[_0xdbca('0x35')]=qs[_0xdbca('0x35')](_0x4e51c8[_0xdbca('0x2c')]['limit']);_0x3be426[_0xdbca('0x24')]=qs['offset'](_0x4e51c8['query'][_0xdbca('0x24')]);}_0x3be426[_0xdbca('0x36')]=qs[_0xdbca('0x37')](_0x4e51c8['query'][_0xdbca('0x37')]);_0x3be426[_0xdbca('0x38')]=qs[_0xdbca('0x39')](_[_0xdbca('0x3a')](_0x4e51c8[_0xdbca('0x2c')],_0x568825[_0xdbca('0x39')]));if(_0x5aba12['dateStart']){if(_0x5aba12['dateEnd']){_0x5aba12['dateEnd']=moment(_0x5aba12[_0xdbca('0x2e')])[_0xdbca('0x3b')](0x1,_0xdbca('0x3c'));}else{_0x5aba12[_0xdbca('0x2e')]=moment(_0x5aba12['dateStart'])[_0xdbca('0x3b')](0x1,_0xdbca('0x3c'));}_['merge'](_0x3be426[_0xdbca('0x38')],{'createdAt':{'$gte':_0x5aba12[_0xdbca('0x2d')],'$lte':_0x5aba12[_0xdbca('0x2e')]}});}if(_0x4e51c8[_0xdbca('0x2c')][_0xdbca('0x3d')]){_0x3be426[_0xdbca('0x38')]=_[_0xdbca('0x3e')](_0x3be426[_0xdbca('0x38')],{'$or':_[_0xdbca('0x3f')](_0x3be426['attributes'],function(_0x24dc7d){var _0x28007b={};_0x28007b[_0x24dc7d]={'$like':'%'+_0x4e51c8['query']['filter']+'%'};return _0x28007b;})});}_0x3be426=_[_0xdbca('0x3e')]({},_0x3be426,_0x4e51c8[_0xdbca('0x40')]);var _0x19f9f2={'where':_0x3be426['where']};return db['ChatMessage']['count'](_0x19f9f2)['then'](function(_0x4cf603){_0xfbb400[_0xdbca('0x23')]=_0x4cf603;if(_0x4e51c8[_0xdbca('0x2c')][_0xdbca('0x41')]){_0x3be426['include']=[{'all':!![]}];}return db[_0xdbca('0x42')][_0xdbca('0x43')](_0x3be426);})[_0xdbca('0x14')](function(_0x67be3f){_0xfbb400['rows']=_0x67be3f;return _0xfbb400;})[_0xdbca('0x14')](respondWithFilteredResult(_0x2753be,_0x3be426))[_0xdbca('0x44')](handleError(_0x2753be,null));};exports[_0xdbca('0x45')]=function(_0x3d15d8,_0xf51bff){var _0x2242a2={'raw':!![],'where':{'id':_0x3d15d8['params']['id']}},_0x38f33d={};_0x38f33d[_0xdbca('0x30')]=_['keys'](db['ChatMessage'][_0xdbca('0x46')]);_0x38f33d['query']=_[_0xdbca('0x2b')](_0x3d15d8[_0xdbca('0x2c')]);_0x38f33d[_0xdbca('0x39')]=_[_0xdbca('0x2f')](_0x38f33d[_0xdbca('0x30')],_0x38f33d['query']);_0x2242a2[_0xdbca('0x32')]=_[_0xdbca('0x2f')](_0x38f33d[_0xdbca('0x30')],qs[_0xdbca('0x31')](_0x3d15d8[_0xdbca('0x2c')][_0xdbca('0x31')]));_0x2242a2['attributes']=_0x2242a2['attributes'][_0xdbca('0x33')]?_0x2242a2['attributes']:_0x38f33d['model'];if(_0x3d15d8['query'][_0xdbca('0x41')]){_0x2242a2[_0xdbca('0x47')]=[{'all':!![]}];}_0x2242a2=_['merge']({},_0x2242a2,_0x3d15d8['options']);return db[_0xdbca('0x42')]['find'](_0x2242a2)[_0xdbca('0x14')](handleEntityNotFound(_0xf51bff,null))['then'](respondWithResult(_0xf51bff,null))[_0xdbca('0x44')](handleError(_0xf51bff,null));};exports[_0xdbca('0x48')]=function(_0x36dfd6,_0x494780){return db[_0xdbca('0x42')][_0xdbca('0x48')](_0x36dfd6[_0xdbca('0x49')],{})[_0xdbca('0x14')](respondWithResult(_0x494780,0xc9))[_0xdbca('0x44')](handleError(_0x494780,null));};exports[_0xdbca('0x4a')]=function(_0xdbf320,_0x350c7a){if(_0xdbf320[_0xdbca('0x49')]['id']){delete _0xdbf320[_0xdbca('0x49')]['id'];}return db[_0xdbca('0x42')][_0xdbca('0x4b')]({'where':{'id':_0xdbf320[_0xdbca('0x4c')]['id']}})[_0xdbca('0x14')](handleEntityNotFound(_0x350c7a,null))[_0xdbca('0x14')](saveUpdates(_0xdbf320[_0xdbca('0x49')],null))[_0xdbca('0x14')](respondWithResult(_0x350c7a,null))[_0xdbca('0x44')](handleError(_0x350c7a,null));};exports[_0xdbca('0x28')]=function(_0x361930,_0x5eee28){return db[_0xdbca('0x42')][_0xdbca('0x4b')]({'where':{'id':_0x361930[_0xdbca('0x4c')]['id']}})[_0xdbca('0x14')](handleEntityNotFound(_0x5eee28,null))[_0xdbca('0x14')](removeEntity(_0x5eee28,null))[_0xdbca('0x44')](handleError(_0x5eee28,null));};exports['describe']=function(_0x5207f1,_0x43fd78){return db[_0xdbca('0x42')][_0xdbca('0x4d')]()[_0xdbca('0x14')](respondWithResult(_0x43fd78,null))[_0xdbca('0x44')](handleError(_0x43fd78,null));};var interaction_log=require('../../config/logger')(_0xdbca('0x4e'));exports[_0xdbca('0x4f')]=function(_0x44d50f,_0x2d8cf4,_0x51a4a8){var _0xdcfe6c={'channel':_0xdbca('0x50')};if(_0x44d50f['body']['id']){delete _0x44d50f[_0xdbca('0x49')]['id'];}_0x44d50f[_0xdbca('0x49')]['read']=!![];_0x44d50f[_0xdbca('0x49')]['readAt']=moment()[_0xdbca('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x44d50f[_0xdbca('0x49')][_0xdbca('0x52')]=_0x44d50f[_0xdbca('0x49')]['UserId']||_0x44d50f[_0xdbca('0x53')]['id'];return db[_0xdbca('0x42')]['find']({'where':{'id':_0x44d50f[_0xdbca('0x4c')]['id'],'UserId':null},'include':[{'model':db[_0xdbca('0x54')],'as':_0xdbca('0x55')}]})['then'](handleEntityNotFound(_0x2d8cf4,null))[_0xdbca('0x14')](saveUpdates(_0x44d50f[_0xdbca('0x49')],null))[_0xdbca('0x14')](function(_0x43a0d2){if(_0x43a0d2){_0xdcfe6c[_0xdbca('0x1d')]=_0x43a0d2[_0xdbca('0x56')]({'plain':!![]});return db[_0xdbca('0x57')][_0xdbca('0x4b')]({'where':{'id':_0x43a0d2[_0xdbca('0x58')]}});}return null;})[_0xdbca('0x14')](handleEntityNotFound(_0x2d8cf4,null))[_0xdbca('0x14')](function(_0x45a75d){if(_0x45a75d){return _0x45a75d['update']({'UserId':_0x44d50f[_0xdbca('0x49')][_0xdbca('0x52')],'read1stAt':_[_0xdbca('0x59')](_0x45a75d['read1stAt'])?moment()[_0xdbca('0x51')](_0xdbca('0x5a')):undefined});}return null;})[_0xdbca('0x14')](function(_0x5c7eea){if(_0x5c7eea){_0xdcfe6c[_0xdbca('0x5b')]=_0x5c7eea[_0xdbca('0x56')]({'plain':!![]});interaction_log[_0xdbca('0x15')](_0xdbca('0x5c'),_0x44d50f[_0xdbca('0x53')]['id'],_0x44d50f[_0xdbca('0x53')][_0xdbca('0x5d')],_0x44d50f[_0xdbca('0x53')][_0xdbca('0x5e')],_0xdcfe6c[_0xdbca('0x5b')]['id'],_0x44d50f[_0xdbca('0x49')]?JSON[_0xdbca('0x1a')](_0x44d50f[_0xdbca('0x49')]):_0xdbca('0x5f'));return respondWithRpcPromise(_0xdbca('0x60'),_0xdbca('0x61'),_0xdcfe6c);}return null;})[_0xdbca('0x14')](function(_0x17d1a7){if(_0x17d1a7){if(_0x44d50f[_0xdbca('0x49')]['manual']){_0xdcfe6c[_0xdbca('0x1d')][_0xdbca('0x62')]=util[_0xdbca('0x51')]('SIP/%s',_0x44d50f[_0xdbca('0x53')][_0xdbca('0x5d')]);_0xdcfe6c[_0xdbca('0x1d')]['channel']=_0xdcfe6c[_0xdbca('0x63')];_0xdcfe6c['message']['event']='accept';return respondWithRpcPromise(_0xdbca('0x64'),_0xdbca('0x64'),{'event':_0xdbca('0x65'),'message':_[_0xdbca('0x3e')](_0xdcfe6c[_0xdbca('0x1d')],JSON[_0xdbca('0x66')](_0xdcfe6c[_0xdbca('0x5b')][_0xdbca('0x67')]))},client9002)['then'](function(){return _0xdcfe6c;});}return _0xdcfe6c;}return null;})[_0xdbca('0x14')](respondWithResult(_0x2d8cf4,null))[_0xdbca('0x44')](handleError(_0x2d8cf4,null));};var interaction_log=require(_0xdbca('0xd'))(_0xdbca('0x4e'));exports['reject']=function(_0xd65658,_0x51cf11,_0x395890){var _0x225618={'agent':{},'channel':'chat'};if(_0xd65658['body']['id']){delete _0xd65658[_0xdbca('0x49')]['id'];}_0xd65658['body']['UserId']=_0xd65658[_0xdbca('0x49')][_0xdbca('0x52')]||_0xd65658['user']['id'];_0x225618[_0xdbca('0x68')]['id']=_0xd65658['body'][_0xdbca('0x52')];return db[_0xdbca('0x42')][_0xdbca('0x4b')]({'where':{'id':_0xd65658[_0xdbca('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51cf11,null))[_0xdbca('0x14')](function(_0x5532de){if(_0x5532de){_0x225618[_0xdbca('0x1d')]=_0x5532de[_0xdbca('0x56')]({'plain':!![]});return db[_0xdbca('0x57')][_0xdbca('0x4b')]({'where':{'id':_0x5532de['ChatInteractionId']}});}return null;})[_0xdbca('0x14')](handleEntityNotFound(_0x51cf11,null))[_0xdbca('0x14')](function(_0x4fb1ef){if(_0x4fb1ef){_0x225618[_0xdbca('0x5b')]=_0x4fb1ef[_0xdbca('0x56')]({'plain':!![]});interaction_log[_0xdbca('0x15')](_0xdbca('0x69'),_0xd65658[_0xdbca('0x53')]['id'],_0xd65658['user'][_0xdbca('0x5d')],_0xd65658['user'][_0xdbca('0x5e')],_0x225618[_0xdbca('0x5b')]['id'],_0xd65658[_0xdbca('0x49')]?JSON[_0xdbca('0x1a')](_0xd65658[_0xdbca('0x49')]):_0xdbca('0x5f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x225618);}return null;})[_0xdbca('0x14')](function(_0x380a9c){if(_0x380a9c){_0x380a9c[_0xdbca('0x1d')][_0xdbca('0x62')]=util['format'](_0xdbca('0x6a'),_0xd65658['user'][_0xdbca('0x5d')]);_0x380a9c['message'][_0xdbca('0x63')]=_0x225618['channel'];_0x380a9c[_0xdbca('0x1d')][_0xdbca('0x6b')]=_0xdbca('0x6c');respondWithRpcPromise(_0xdbca('0x64'),'EventManager',{'event':_0xdbca('0x6d'),'message':_0x380a9c[_0xdbca('0x1d')]},client9002);return _0x225618;}return null;})['then'](respondWithResult(_0x51cf11,null))[_0xdbca('0x44')](handleError(_0x51cf11,null));}; \ No newline at end of file +var _0x1e9c=['fast-json-patch','moment','bluebird','mustache','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/environment','../../mysqldb','localhost','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','name','index','ChatMessage','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','filter','merge','map','options','count','include','params','includeAll','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','ChatInteraction','ChatInteractionId','isNil','read1stAt','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','../../config/logger','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1e9c,0x1bc));var _0xc1e9=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x1e9c[_0x2aec52];return _0x3b8835;};'use strict';var jsonpatch=require(_0xc1e9('0x0'));var rp=require('request-promise');var moment=require(_0xc1e9('0x1'));var BPromise=require(_0xc1e9('0x2'));var Mustache=require(_0xc1e9('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc1e9('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc1e9('0x5'));var jsforce=require(_0xc1e9('0x6'));var deskjs=require(_0xc1e9('0x7'));var toCsv=require(_0xc1e9('0x8'));var querystring=require(_0xc1e9('0x9'));var Papa=require(_0xc1e9('0xa'));var qs=require(_0xc1e9('0xb'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc1e9('0xc'));var db=require(_0xc1e9('0xd'))['db'];var socket=require('socket.io-emitter')({'host':_0xc1e9('0xe'),'port':0x18eb});require('./chatMessage.socket')[_0xc1e9('0xf')](socket);var jayson=require(_0xc1e9('0x10'));var client=jayson[_0xc1e9('0x11')][_0xc1e9('0x12')]({'port':0x232c});var client9002=jayson[_0xc1e9('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed0fe,_0x3b96fd,_0x3f490a,_0x30f8e1){return new BPromise(function(_0x3503a2,_0x3b3c9d){var _0x48d591=_0x30f8e1||client;return _0x48d591[_0xc1e9('0x13')](_0x4ed0fe,_0x3f490a)[_0xc1e9('0x14')](function(_0x130e8e){logger['info'](_0xc1e9('0x15'),_0x3b96fd,_0xc1e9('0x16'));logger[_0xc1e9('0x17')](_0xc1e9('0x18'),_0x3b96fd,_0xc1e9('0x16'),JSON[_0xc1e9('0x19')](_0x130e8e));if(_0x130e8e[_0xc1e9('0x1a')]){if(_0x130e8e[_0xc1e9('0x1a')]['code']===0x1f4){logger[_0xc1e9('0x1a')](_0xc1e9('0x15'),_0x3b96fd,_0x130e8e['error'][_0xc1e9('0x1b')]);return _0x3b3c9d(_0x130e8e[_0xc1e9('0x1a')][_0xc1e9('0x1b')]);}logger[_0xc1e9('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x3b96fd,_0x130e8e[_0xc1e9('0x1a')][_0xc1e9('0x1b')]);return _0x3503a2(_0x130e8e[_0xc1e9('0x1a')][_0xc1e9('0x1b')]);}else{logger[_0xc1e9('0x1c')](_0xc1e9('0x15'),_0x3b96fd,_0xc1e9('0x16'));_0x3503a2(_0x130e8e[_0xc1e9('0x1d')][_0xc1e9('0x1b')]);}})[_0xc1e9('0x1e')](function(_0x79158d){logger['error'](_0xc1e9('0x15'),_0x3b96fd,_0x79158d);_0x3b3c9d(_0x79158d);});});}function respondWithStatusCode(_0x1664a5,_0x579cf6){_0x579cf6=_0x579cf6||0xcc;return function(_0x137b65){if(_0x137b65){return _0x1664a5['sendStatus'](_0x579cf6);}return _0x1664a5['status'](_0x579cf6)[_0xc1e9('0x1f')]();};}function respondWithResult(_0x5b17d4,_0x35f2bf){_0x35f2bf=_0x35f2bf||0xc8;return function(_0x230185){if(_0x230185){return _0x5b17d4[_0xc1e9('0x20')](_0x35f2bf)[_0xc1e9('0x21')](_0x230185);}};}function respondWithFilteredResult(_0xb3f5b6,_0x4c3fba){return function(_0x1eede9){if(_0x1eede9){var _0x4c0b87=_0x1eede9['count'],_0x587c8c=_0x4c3fba[_0xc1e9('0x22')],_0x55ffb3=_0x4c3fba['offset']+_0x4c3fba[_0xc1e9('0x23')],_0x899dba;if(_0x55ffb3>=_0x4c0b87){_0x55ffb3=_0x4c0b87;_0x899dba=0xc8;}else{_0x899dba=0xce;}_0xb3f5b6['status'](_0x899dba);return _0xb3f5b6[_0xc1e9('0x24')](_0xc1e9('0x25'),_0x587c8c+'-'+_0x55ffb3+'/'+_0x4c0b87)[_0xc1e9('0x21')](_0x1eede9);}return null;};}function patchUpdates(_0x41623e){return function(_0x2205ba){try{jsonpatch[_0xc1e9('0x26')](_0x2205ba,_0x41623e,!![]);}catch(_0x2b8dcf){return BPromise[_0xc1e9('0x27')](_0x2b8dcf);}return _0x2205ba['save']();};}function saveUpdates(_0x5eb8e7,_0x1c5081){return function(_0x5ebd4e){if(_0x5ebd4e){return _0x5ebd4e[_0xc1e9('0x28')](_0x5eb8e7)[_0xc1e9('0x14')](function(_0x34c06e){return _0x34c06e;});}return null;};}function removeEntity(_0x3d38f3,_0x36cf6a){return function(_0x262ada){if(_0x262ada){return _0x262ada[_0xc1e9('0x29')]()[_0xc1e9('0x14')](function(){_0x3d38f3['status'](0xcc)[_0xc1e9('0x1f')]();});}};}function handleEntityNotFound(_0x4e3800,_0x58eec8){return function(_0x229a38){if(!_0x229a38){_0x4e3800[_0xc1e9('0x2a')](0x194);}return _0x229a38;};}function handleError(_0x3b885e,_0x5e951a){_0x5e951a=_0x5e951a||0x1f4;return function(_0x4a73a0){logger[_0xc1e9('0x1a')](_0x4a73a0['stack']);if(_0x4a73a0[_0xc1e9('0x2b')]){delete _0x4a73a0[_0xc1e9('0x2b')];}_0x3b885e['status'](_0x5e951a)['send'](_0x4a73a0);};}exports[_0xc1e9('0x2c')]=function(_0x1f3442,_0x29c2e7){var _0x2b07cd={},_0x531763={},_0xea7c83={'count':0x0,'rows':[]};var _0xea82fd=db[_0xc1e9('0x2d')][_0xc1e9('0x2e')];_0x531763[_0xc1e9('0x2f')]=_[_0xc1e9('0x30')](_0xea82fd);var _0x11fd5c={'dateStart':_0x1f3442[_0xc1e9('0x31')]['dateStart'],'dateEnd':_0x1f3442[_0xc1e9('0x31')][_0xc1e9('0x32')]};delete _0x1f3442[_0xc1e9('0x31')][_0xc1e9('0x33')];delete _0x1f3442[_0xc1e9('0x31')][_0xc1e9('0x32')];_0x531763[_0xc1e9('0x31')]=_[_0xc1e9('0x30')](_0x1f3442[_0xc1e9('0x31')]);_0x531763['filters']=_[_0xc1e9('0x34')](_0x531763['model'],_0x531763['query']);_0x2b07cd[_0xc1e9('0x35')]=_[_0xc1e9('0x34')](_0x531763['model'],qs[_0xc1e9('0x36')](_0x1f3442[_0xc1e9('0x31')][_0xc1e9('0x36')]));_0x2b07cd['attributes']=_0x2b07cd['attributes'][_0xc1e9('0x37')]?_0x2b07cd[_0xc1e9('0x35')]:_0x531763[_0xc1e9('0x2f')];if(!_0x1f3442[_0xc1e9('0x31')][_0xc1e9('0x38')](_0xc1e9('0x39'))){_0x2b07cd[_0xc1e9('0x23')]=qs[_0xc1e9('0x23')](_0x1f3442[_0xc1e9('0x31')][_0xc1e9('0x23')]);_0x2b07cd[_0xc1e9('0x22')]=qs[_0xc1e9('0x22')](_0x1f3442['query']['offset']);}_0x2b07cd[_0xc1e9('0x3a')]=qs[_0xc1e9('0x3b')](_0x1f3442['query'][_0xc1e9('0x3b')]);_0x2b07cd[_0xc1e9('0x3c')]=qs[_0xc1e9('0x3d')](_[_0xc1e9('0x3e')](_0x1f3442[_0xc1e9('0x31')],_0x531763[_0xc1e9('0x3d')]));if(_0x11fd5c['dateStart']){if(_0x11fd5c[_0xc1e9('0x32')]){_0x11fd5c[_0xc1e9('0x32')]=moment(_0x11fd5c[_0xc1e9('0x32')])[_0xc1e9('0x3f')](0x1,'day');}else{_0x11fd5c[_0xc1e9('0x32')]=moment(_0x11fd5c['dateStart'])[_0xc1e9('0x3f')](0x1,_0xc1e9('0x40'));}_['merge'](_0x2b07cd[_0xc1e9('0x3c')],{'createdAt':{'$gte':_0x11fd5c[_0xc1e9('0x33')],'$lte':_0x11fd5c[_0xc1e9('0x32')]}});}if(_0x1f3442[_0xc1e9('0x31')][_0xc1e9('0x41')]){_0x2b07cd[_0xc1e9('0x3c')]=_[_0xc1e9('0x42')](_0x2b07cd[_0xc1e9('0x3c')],{'$or':_[_0xc1e9('0x43')](_0x2b07cd[_0xc1e9('0x35')],function(_0x56dd5b){var _0x53cb19={};_0x53cb19[_0x56dd5b]={'$like':'%'+_0x1f3442[_0xc1e9('0x31')][_0xc1e9('0x41')]+'%'};return _0x53cb19;})});}_0x2b07cd=_['merge']({},_0x2b07cd,_0x1f3442[_0xc1e9('0x44')]);var _0x3bd9a1={'where':_0x2b07cd[_0xc1e9('0x3c')]};return db[_0xc1e9('0x2d')][_0xc1e9('0x45')](_0x3bd9a1)[_0xc1e9('0x14')](function(_0x2a2641){_0xea7c83['count']=_0x2a2641;if(_0x1f3442['query']['includeAll']){_0x2b07cd[_0xc1e9('0x46')]=[{'all':!![]}];}return db[_0xc1e9('0x2d')]['findAll'](_0x2b07cd);})[_0xc1e9('0x14')](function(_0x5ac972){_0xea7c83['rows']=_0x5ac972;return _0xea7c83;})[_0xc1e9('0x14')](respondWithFilteredResult(_0x29c2e7,_0x2b07cd))['catch'](handleError(_0x29c2e7,null));};exports['show']=function(_0x40660c,_0x18113d){var _0xfcb2={'raw':!![],'where':{'id':_0x40660c[_0xc1e9('0x47')]['id']}},_0x13d6c1={};_0x13d6c1[_0xc1e9('0x2f')]=_['keys'](db[_0xc1e9('0x2d')]['rawAttributes']);_0x13d6c1[_0xc1e9('0x31')]=_['keys'](_0x40660c['query']);_0x13d6c1[_0xc1e9('0x3d')]=_['intersection'](_0x13d6c1['model'],_0x13d6c1[_0xc1e9('0x31')]);_0xfcb2[_0xc1e9('0x35')]=_[_0xc1e9('0x34')](_0x13d6c1[_0xc1e9('0x2f')],qs[_0xc1e9('0x36')](_0x40660c[_0xc1e9('0x31')][_0xc1e9('0x36')]));_0xfcb2[_0xc1e9('0x35')]=_0xfcb2[_0xc1e9('0x35')]['length']?_0xfcb2[_0xc1e9('0x35')]:_0x13d6c1['model'];if(_0x40660c['query'][_0xc1e9('0x48')]){_0xfcb2['include']=[{'all':!![]}];}_0xfcb2=_[_0xc1e9('0x42')]({},_0xfcb2,_0x40660c[_0xc1e9('0x44')]);return db['ChatMessage'][_0xc1e9('0x49')](_0xfcb2)['then'](handleEntityNotFound(_0x18113d,null))['then'](respondWithResult(_0x18113d,null))[_0xc1e9('0x1e')](handleError(_0x18113d,null));};exports['create']=function(_0x247e1e,_0x4b3c0b){return db[_0xc1e9('0x2d')][_0xc1e9('0x4a')](_0x247e1e[_0xc1e9('0x4b')],{})[_0xc1e9('0x14')](respondWithResult(_0x4b3c0b,0xc9))[_0xc1e9('0x1e')](handleError(_0x4b3c0b,null));};exports['update']=function(_0x1d19fd,_0x3ef28e){if(_0x1d19fd[_0xc1e9('0x4b')]['id']){delete _0x1d19fd[_0xc1e9('0x4b')]['id'];}return db['ChatMessage'][_0xc1e9('0x49')]({'where':{'id':_0x1d19fd[_0xc1e9('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ef28e,null))[_0xc1e9('0x14')](saveUpdates(_0x1d19fd['body'],null))[_0xc1e9('0x14')](respondWithResult(_0x3ef28e,null))[_0xc1e9('0x1e')](handleError(_0x3ef28e,null));};exports[_0xc1e9('0x29')]=function(_0x554001,_0xf13c3f){return db['ChatMessage'][_0xc1e9('0x49')]({'where':{'id':_0x554001['params']['id']}})['then'](handleEntityNotFound(_0xf13c3f,null))[_0xc1e9('0x14')](removeEntity(_0xf13c3f,null))[_0xc1e9('0x1e')](handleError(_0xf13c3f,null));};exports[_0xc1e9('0x4c')]=function(_0x1851d7,_0x45c9e0){return db[_0xc1e9('0x2d')][_0xc1e9('0x4c')]()['then'](respondWithResult(_0x45c9e0,null))['catch'](handleError(_0x45c9e0,null));};var interaction_log=require('../../config/logger')(_0xc1e9('0x4d'));exports[_0xc1e9('0x4e')]=function(_0x144427,_0x219abc,_0x521038){var _0x3c2441={'channel':_0xc1e9('0x4f')};if(_0x144427[_0xc1e9('0x4b')]['id']){delete _0x144427[_0xc1e9('0x4b')]['id'];}_0x144427[_0xc1e9('0x4b')][_0xc1e9('0x50')]=!![];_0x144427[_0xc1e9('0x4b')][_0xc1e9('0x51')]=moment()[_0xc1e9('0x52')](_0xc1e9('0x53'));_0x144427[_0xc1e9('0x4b')][_0xc1e9('0x54')]=_0x144427[_0xc1e9('0x4b')][_0xc1e9('0x54')]||_0x144427[_0xc1e9('0x55')]['id'];return db[_0xc1e9('0x2d')][_0xc1e9('0x49')]({'where':{'id':_0x144427[_0xc1e9('0x47')]['id'],'UserId':null},'include':[{'model':db[_0xc1e9('0x56')],'as':_0xc1e9('0x57')}]})[_0xc1e9('0x14')](handleEntityNotFound(_0x219abc,null))[_0xc1e9('0x14')](saveUpdates(_0x144427[_0xc1e9('0x4b')],null))[_0xc1e9('0x14')](function(_0x48d045){if(_0x48d045){_0x3c2441['message']=_0x48d045['get']({'plain':!![]});return db[_0xc1e9('0x58')][_0xc1e9('0x49')]({'where':{'id':_0x48d045[_0xc1e9('0x59')]}});}return null;})[_0xc1e9('0x14')](handleEntityNotFound(_0x219abc,null))[_0xc1e9('0x14')](function(_0x2067bf){if(_0x2067bf){return _0x2067bf[_0xc1e9('0x28')]({'UserId':_0x144427[_0xc1e9('0x4b')][_0xc1e9('0x54')],'read1stAt':_[_0xc1e9('0x5a')](_0x2067bf[_0xc1e9('0x5b')])?moment()[_0xc1e9('0x52')](_0xc1e9('0x53')):undefined});}return null;})[_0xc1e9('0x14')](function(_0x2088f0){if(_0x2088f0){_0x3c2441['interaction']=_0x2088f0[_0xc1e9('0x5c')]({'plain':!![]});interaction_log['info'](_0xc1e9('0x5d'),_0x144427['user']['id'],_0x144427[_0xc1e9('0x55')][_0xc1e9('0x2b')],_0x144427['user'][_0xc1e9('0x5e')],_0x3c2441[_0xc1e9('0x5f')]['id'],_0x144427[_0xc1e9('0x4b')]?JSON[_0xc1e9('0x19')](_0x144427['body']):_0xc1e9('0x60'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3c2441);}return null;})[_0xc1e9('0x14')](function(_0x238a37){if(_0x238a37){if(_0x144427[_0xc1e9('0x4b')][_0xc1e9('0x61')]){_0x3c2441[_0xc1e9('0x1b')][_0xc1e9('0x62')]=util[_0xc1e9('0x52')](_0xc1e9('0x63'),_0x144427['user'][_0xc1e9('0x2b')]);_0x3c2441['message'][_0xc1e9('0x64')]=_0x3c2441['channel'];_0x3c2441[_0xc1e9('0x1b')][_0xc1e9('0x65')]=_0xc1e9('0x4e');return respondWithRpcPromise(_0xc1e9('0x66'),'EventManager',{'event':_0xc1e9('0x67'),'message':_[_0xc1e9('0x42')](_0x3c2441['message'],JSON[_0xc1e9('0x68')](_0x3c2441[_0xc1e9('0x5f')][_0xc1e9('0x69')]))},client9002)[_0xc1e9('0x14')](function(){return _0x3c2441;});}return _0x3c2441;}return null;})[_0xc1e9('0x14')](respondWithResult(_0x219abc,null))[_0xc1e9('0x1e')](handleError(_0x219abc,null));};var interaction_log=require(_0xc1e9('0x6a'))(_0xc1e9('0x4d'));exports[_0xc1e9('0x27')]=function(_0x44403b,_0x1aefc3,_0x319f51){var _0xd4f80e={'agent':{},'channel':_0xc1e9('0x4f')};if(_0x44403b[_0xc1e9('0x4b')]['id']){delete _0x44403b[_0xc1e9('0x4b')]['id'];}_0x44403b['body']['UserId']=_0x44403b[_0xc1e9('0x4b')]['UserId']||_0x44403b[_0xc1e9('0x55')]['id'];_0xd4f80e[_0xc1e9('0x6b')]['id']=_0x44403b[_0xc1e9('0x4b')][_0xc1e9('0x54')];return db['ChatMessage'][_0xc1e9('0x49')]({'where':{'id':_0x44403b['params']['id'],'UserId':null}})[_0xc1e9('0x14')](handleEntityNotFound(_0x1aefc3,null))[_0xc1e9('0x14')](function(_0x4367a3){if(_0x4367a3){_0xd4f80e[_0xc1e9('0x1b')]=_0x4367a3[_0xc1e9('0x5c')]({'plain':!![]});return db['ChatInteraction'][_0xc1e9('0x49')]({'where':{'id':_0x4367a3['ChatInteractionId']}});}return null;})[_0xc1e9('0x14')](handleEntityNotFound(_0x1aefc3,null))[_0xc1e9('0x14')](function(_0x3bea69){if(_0x3bea69){_0xd4f80e[_0xc1e9('0x5f')]=_0x3bea69['get']({'plain':!![]});interaction_log[_0xc1e9('0x1c')](_0xc1e9('0x6c'),_0x44403b[_0xc1e9('0x55')]['id'],_0x44403b[_0xc1e9('0x55')][_0xc1e9('0x2b')],_0x44403b['user'][_0xc1e9('0x5e')],_0xd4f80e[_0xc1e9('0x5f')]['id'],_0x44403b['body']?JSON['stringify'](_0x44403b['body']):_0xc1e9('0x60'));return respondWithRpcPromise(_0xc1e9('0x6d'),_0xc1e9('0x6e'),_0xd4f80e);}return null;})['then'](function(_0x409d9e){if(_0x409d9e){_0x409d9e['message']['interface']=util[_0xc1e9('0x52')]('SIP/%s',_0x44403b[_0xc1e9('0x55')][_0xc1e9('0x2b')]);_0x409d9e[_0xc1e9('0x1b')][_0xc1e9('0x64')]=_0xd4f80e[_0xc1e9('0x64')];_0x409d9e[_0xc1e9('0x1b')][_0xc1e9('0x65')]='reject';respondWithRpcPromise(_0xc1e9('0x66'),_0xc1e9('0x66'),{'event':'rejectmessage','message':_0x409d9e[_0xc1e9('0x1b')]},client9002);return _0xd4f80e;}return null;})[_0xc1e9('0x14')](respondWithResult(_0x1aefc3,null))[_0xc1e9('0x1e')](handleError(_0x1aefc3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 15f7bd2..39447ca 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 _0xf335=['remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x3bf23e,_0xc42a31){var _0x46f042=function(_0x35ddd0){while(--_0x35ddd0){_0x3bf23e['push'](_0x3bf23e['shift']());}};_0x46f042(++_0xc42a31);}(_0xf335,0x1c5));var _0x5f33=function(_0x489cd3,_0x51de7c){_0x489cd3=_0x489cd3-0x0;var _0x41e3af=_0xf335[_0x489cd3];return _0x41e3af;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5f33('0x0')](0x0);var events={'afterCreate':_0x5f33('0x1'),'afterUpdate':'update','afterDestroy':_0x5f33('0x2')};function emitEvent(_0x440780){return function(_0x30a50a,_0x33de32,_0x54f737){ChatMessageEvents['emit'](_0x440780+':'+_0x30a50a['id'],_0x30a50a);ChatMessageEvents[_0x5f33('0x3')](_0x440780,_0x30a50a);_0x54f737(null);};}for(var e in events){if(events[_0x5f33('0x4')](e)){var event=events[e];ChatMessage[_0x5f33('0x5')](e,emitEvent(event));}}module[_0x5f33('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x131a=['ChatMessage','update','emit','hook','exports','events'];(function(_0x5c4e61,_0x1648ba){var _0x42790d=function(_0x581168){while(--_0x581168){_0x5c4e61['push'](_0x5c4e61['shift']());}};_0x42790d(++_0x1648ba);}(_0x131a,0x173));var _0xa131=function(_0x8cfd63,_0x234e75){_0x8cfd63=_0x8cfd63-0x0;var _0x4649f8=_0x131a[_0x8cfd63];return _0x4649f8;};'use strict';var EventEmitter=require(_0xa131('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xa131('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa131('0x2'),'afterDestroy':'remove'};function emitEvent(_0x39d111){return function(_0x516ac5,_0x39b563,_0x7dd7d0){ChatMessageEvents[_0xa131('0x3')](_0x39d111+':'+_0x516ac5['id'],_0x516ac5);ChatMessageEvents['emit'](_0x39d111,_0x516ac5);_0x7dd7d0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xa131('0x4')](e,emitEvent(event));}}module[_0xa131('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 79f049a..1ad976a 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 _0x36be=['secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','body','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','./chatMessage.attributes','models','get','direction','toLowerCase'];(function(_0x2d6138,_0x219734){var _0x55eb00=function(_0xff8f6){while(--_0xff8f6){_0x2d6138['push'](_0x2d6138['shift']());}};_0x55eb00(++_0x219734);}(_0x36be,0xd3));var _0xe36b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x36be[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xe36b('0x0'));var util=require(_0xe36b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe36b('0x2'));var BPromise=require(_0xe36b('0x3'));var rp=require('request-promise');var attributes=require(_0xe36b('0x4'));module['exports']=function(_0x13efae,_0x3d54aa){return _0x13efae['define']('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9fdf8e,_0x3be49f,_0x57f896){var _0x45714e=_0x13efae[_0xe36b('0x5')];var _0x51f4c9=_0x9fdf8e[_0xe36b('0x6')]({'plain':!![]});if(_0x51f4c9[_0xe36b('0x7')][_0xe36b('0x8')]()==='in'||_0x51f4c9[_0xe36b('0x7')]['toLowerCase']()==='out'&&!_0x51f4c9[_0xe36b('0x9')]&&!_[_0xe36b('0xa')](_0x51f4c9[_0xe36b('0xb')])){_0x45714e[_0xe36b('0xc')][_0xe36b('0xd')]({'where':{'id':_0x51f4c9[_0xe36b('0xe')]}})[_0xe36b('0xf')](function(_0x375f91){if(_0x375f91){_0x375f91[_0xe36b('0x10')]({'lastMsgAt':_0x51f4c9[_0xe36b('0x11')],'lastMsgDirection':_0x51f4c9[_0xe36b('0x7')][_0xe36b('0x8')](),'lastMsgBody':_0x51f4c9[_0xe36b('0x12')]});}})['catch'](function(_0x1dafc3){console[_0xe36b('0x13')](_0x1dafc3);});}_0x57f896();}},'charset':_0xe36b('0x14'),'collate':_0xe36b('0x15')});}; \ No newline at end of file +var _0x83e4=['ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','body','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','./chatMessage.attributes','ChatMessage','chat_messages','direction','toLowerCase','secret','isNil','UserId'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x83e4,0x137));var _0x483e=function(_0x1094c9,_0x45d00b){_0x1094c9=_0x1094c9-0x0;var _0x3ead5b=_0x83e4[_0x1094c9];return _0x3ead5b;};'use strict';var _=require(_0x483e('0x0'));var util=require(_0x483e('0x1'));var logger=require('../../config/logger')(_0x483e('0x2'));var moment=require(_0x483e('0x3'));var BPromise=require(_0x483e('0x4'));var rp=require(_0x483e('0x5'));var attributes=require(_0x483e('0x6'));module['exports']=function(_0x1a9eea,_0xee62a7){return _0x1a9eea['define'](_0x483e('0x7'),attributes,{'tableName':_0x483e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e0026,_0x54dfc3,_0x5ef802){var _0x5dd412=_0x1a9eea['models'];var _0x5707c5=_0x1e0026['get']({'plain':!![]});if(_0x5707c5[_0x483e('0x9')][_0x483e('0xa')]()==='in'||_0x5707c5['direction'][_0x483e('0xa')]()==='out'&&!_0x5707c5[_0x483e('0xb')]&&!_[_0x483e('0xc')](_0x5707c5[_0x483e('0xd')])){_0x5dd412[_0x483e('0xe')][_0x483e('0xf')]({'where':{'id':_0x5707c5[_0x483e('0x10')]}})[_0x483e('0x11')](function(_0x153298){if(_0x153298){_0x153298[_0x483e('0x12')]({'lastMsgAt':_0x5707c5[_0x483e('0x13')],'lastMsgDirection':_0x5707c5[_0x483e('0x9')][_0x483e('0xa')](),'lastMsgBody':_0x5707c5[_0x483e('0x14')]});}})[_0x483e('0x15')](function(_0x38858f){console[_0x483e('0x16')](_0x38858f);});}_0x5ef802();}},'charset':_0x483e('0x17'),'collate':_0x483e('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 01b1cdb..cfffda9 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 _0x5f2f=['client','http','socket.io-emitter','localhost','./chatMessage.socket','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateChatMessage','create','body','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x4ec76a,_0x53b8a9){var _0x182fcb=function(_0x40dfda){while(--_0x40dfda){_0x4ec76a['push'](_0x4ec76a['shift']());}};_0x182fcb(++_0x53b8a9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x82310e,_0x4d5b4e){_0x82310e=_0x82310e-0x0;var _0x188192=_0x5f2f[_0x82310e];return _0x188192;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var db=require(_0xf5f2('0x5'))['db'];var utils=require(_0xf5f2('0x6'));var logger=require(_0xf5f2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf5f2('0x8'));var client=jayson[_0xf5f2('0x9')][_0xf5f2('0xa')]({'port':0x232a});var socket=require(_0xf5f2('0xb'))({'host':_0xf5f2('0xc'),'port':0x18eb});require(_0xf5f2('0xd'))['register'](socket);function respondWithRpcPromise(_0x466882,_0x46cd9c,_0x2ec345){return new BPromise(function(_0x56a69f,_0x375da4){return client[_0xf5f2('0xe')](_0x466882,_0x2ec345)[_0xf5f2('0xf')](function(_0x4e0e6b){logger[_0xf5f2('0x10')]('ChatMessage,\x20%s,\x20%s',_0x46cd9c,'request\x20sent');logger[_0xf5f2('0x11')](_0xf5f2('0x12'),_0x46cd9c,'request\x20sent',JSON[_0xf5f2('0x13')](_0x4e0e6b));if(_0x4e0e6b[_0xf5f2('0x14')]){if(_0x4e0e6b[_0xf5f2('0x14')][_0xf5f2('0x15')]===0x1f4){logger[_0xf5f2('0x14')](_0xf5f2('0x16'),_0x46cd9c,_0x4e0e6b['error'][_0xf5f2('0x17')]);return _0x375da4(_0x4e0e6b[_0xf5f2('0x14')][_0xf5f2('0x17')]);}logger[_0xf5f2('0x14')](_0xf5f2('0x16'),_0x46cd9c,_0x4e0e6b['error'][_0xf5f2('0x17')]);return _0x56a69f(_0x4e0e6b[_0xf5f2('0x14')][_0xf5f2('0x17')]);}else{logger[_0xf5f2('0x10')](_0xf5f2('0x16'),_0x46cd9c,_0xf5f2('0x18'));_0x56a69f(_0x4e0e6b[_0xf5f2('0x19')][_0xf5f2('0x17')]);}})[_0xf5f2('0x1a')](function(_0x228ace){logger[_0xf5f2('0x14')](_0xf5f2('0x16'),_0x46cd9c,_0x228ace);_0x375da4(_0x228ace);});});}exports[_0xf5f2('0x1b')]=function(_0x3ee69){var _0x3cf5ea=this;return new Promise(function(_0x626999,_0x1bf655){return db['ChatMessage'][_0xf5f2('0x1c')](_0x3ee69[_0xf5f2('0x1d')],{'raw':_0x3ee69['options']?_0x3ee69['options'][_0xf5f2('0x1e')]===undefined?!![]:![]:!![]})[_0xf5f2('0xf')](function(_0x4ae323){logger[_0xf5f2('0x10')](_0xf5f2('0x1b'),_0x3ee69);logger[_0xf5f2('0x11')](_0xf5f2('0x1b'),_0x3ee69,JSON[_0xf5f2('0x13')](_0x4ae323));_0x626999(_0x4ae323);})['catch'](function(_0x21cd91){logger[_0xf5f2('0x14')](_0xf5f2('0x1b'),_0x21cd91[_0xf5f2('0x17')],_0x3ee69);_0x1bf655(_0x3cf5ea[_0xf5f2('0x14')](0x1f4,_0x21cd91['message']));});});}; \ No newline at end of file +var _0x5fab=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','./chatMessage.socket','register','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5fab,0x177));var _0xb5fa=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x5fab[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var db=require(_0xb5fa('0x4'))['db'];var utils=require(_0xb5fa('0x5'));var logger=require(_0xb5fa('0x6'))(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var jayson=require(_0xb5fa('0x9'));var client=jayson[_0xb5fa('0xa')][_0xb5fa('0xb')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xb5fa('0xc'))[_0xb5fa('0xd')](socket);function respondWithRpcPromise(_0x9c7bce,_0x56d018,_0x410eff){return new BPromise(function(_0x38d9a3,_0x2cf4a5){return client['request'](_0x9c7bce,_0x410eff)['then'](function(_0x3a8e1b){logger[_0xb5fa('0xe')](_0xb5fa('0xf'),_0x56d018,_0xb5fa('0x10'));logger[_0xb5fa('0x11')](_0xb5fa('0x12'),_0x56d018,_0xb5fa('0x10'),JSON[_0xb5fa('0x13')](_0x3a8e1b));if(_0x3a8e1b[_0xb5fa('0x14')]){if(_0x3a8e1b['error'][_0xb5fa('0x15')]===0x1f4){logger[_0xb5fa('0x14')]('ChatMessage,\x20%s,\x20%s',_0x56d018,_0x3a8e1b[_0xb5fa('0x14')]['message']);return _0x2cf4a5(_0x3a8e1b[_0xb5fa('0x14')][_0xb5fa('0x16')]);}logger[_0xb5fa('0x14')](_0xb5fa('0xf'),_0x56d018,_0x3a8e1b[_0xb5fa('0x14')]['message']);return _0x38d9a3(_0x3a8e1b['error'][_0xb5fa('0x16')]);}else{logger[_0xb5fa('0xe')](_0xb5fa('0xf'),_0x56d018,_0xb5fa('0x10'));_0x38d9a3(_0x3a8e1b['result']['message']);}})[_0xb5fa('0x17')](function(_0x1f7f05){logger[_0xb5fa('0x14')](_0xb5fa('0xf'),_0x56d018,_0x1f7f05);_0x2cf4a5(_0x1f7f05);});});}exports[_0xb5fa('0x18')]=function(_0x13e82b){var _0x3b0f69=this;return new Promise(function(_0x21f4f4,_0xc14dc4){return db[_0xb5fa('0x19')][_0xb5fa('0x1a')](_0x13e82b[_0xb5fa('0x1b')],{'raw':_0x13e82b['options']?_0x13e82b[_0xb5fa('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xb5fa('0x1d')](function(_0x4a6c04){logger[_0xb5fa('0xe')](_0xb5fa('0x18'),_0x13e82b);logger['debug'](_0xb5fa('0x18'),_0x13e82b,JSON[_0xb5fa('0x13')](_0x4a6c04));_0x21f4f4(_0x4a6c04);})[_0xb5fa('0x17')](function(_0x47f71a){logger[_0xb5fa('0x14')](_0xb5fa('0x18'),_0x47f71a[_0xb5fa('0x16')],_0x13e82b);_0xc14dc4(_0x3b0f69['error'](0x1f4,_0x47f71a[_0xb5fa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index b1c1dcc..0689de1 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(_0x4dbef1,_0x13eddb){var _0x6cabb2=function(_0x4ab698){while(--_0x4ab698){_0x4dbef1['push'](_0x4dbef1['shift']());}};_0x6cabb2(++_0x13eddb);}(_0xedd9,0xfc));var _0x9edd=function(_0x2826f3,_0x1c8cd1){_0x2826f3=_0x2826f3-0x0;var _0x1b6068=_0xedd9[_0x2826f3];return _0x1b6068;};'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 _0x008c=['./chatMessage.events','save','remove','update','emit','removeListener','register','chatMessage:'];(function(_0x38a1fe,_0x33582c){var _0x21aa34=function(_0x420066){while(--_0x420066){_0x38a1fe['push'](_0x38a1fe['shift']());}};_0x21aa34(++_0x33582c);}(_0x008c,0x188));var _0xc008=function(_0x28b83a,_0x401d6f){_0x28b83a=_0x28b83a-0x0;var _0x5985d9=_0x008c[_0x28b83a];return _0x5985d9;};'use strict';var ChatMessageEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){ChatMessageEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);ChatMessageEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 885df3a..9a5a8cd 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 _0xe197=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','post','tracked','put','/:id','update','/:id/accept','accept','reject','destroy','exports','multer','util'];(function(_0x3c13bf,_0x286e83){var _0xd2b883=function(_0x28895c){while(--_0x28895c){_0x3c13bf['push'](_0x3c13bf['shift']());}};_0xd2b883(++_0x286e83);}(_0xe197,0x15e));var _0x7e19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe197[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7e19('0x0'));var util=require(_0x7e19('0x1'));var path=require(_0x7e19('0x2'));var express=require(_0x7e19('0x3'));var router=express[_0x7e19('0x4')]();var auth=require(_0x7e19('0x5'));var interaction=require(_0x7e19('0x6'));var config=require(_0x7e19('0x7'));var controller=require(_0x7e19('0x8'));router['get']('/',auth[_0x7e19('0x9')](),controller[_0x7e19('0xa')]);router['get']('/describe',auth[_0x7e19('0x9')](),controller['describe']);router[_0x7e19('0xb')]('/:id',auth[_0x7e19('0x9')](),controller['show']);router[_0x7e19('0xc')]('/',auth[_0x7e19('0x9')](),interaction[_0x7e19('0xd')]('chat','chatmessage:create'),controller['create']);router[_0x7e19('0xe')](_0x7e19('0xf'),controller[_0x7e19('0x10')]);router[_0x7e19('0xe')](_0x7e19('0x11'),auth[_0x7e19('0x9')](),controller[_0x7e19('0x12')]);router[_0x7e19('0xe')]('/:id/reject',auth[_0x7e19('0x9')](),controller[_0x7e19('0x13')]);router['delete'](_0x7e19('0xf'),auth[_0x7e19('0x9')](),controller[_0x7e19('0x14')]);module[_0x7e19('0x15')]=router; \ No newline at end of file +var _0xe94f=['post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xe94f,0x178));var _0xfe94=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0xe94f[_0x2d4065];return _0xef6016;};'use strict';var multer=require(_0xfe94('0x0'));var util=require(_0xfe94('0x1'));var path=require(_0xfe94('0x2'));var express=require(_0xfe94('0x3'));var router=express[_0xfe94('0x4')]();var auth=require(_0xfe94('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfe94('0x6'));var controller=require('./chatMessage.controller');router[_0xfe94('0x7')]('/',auth[_0xfe94('0x8')](),controller[_0xfe94('0x9')]);router[_0xfe94('0x7')](_0xfe94('0xa'),auth['isAuthenticated'](),controller[_0xfe94('0xb')]);router[_0xfe94('0x7')](_0xfe94('0xc'),auth[_0xfe94('0x8')](),controller[_0xfe94('0xd')]);router[_0xfe94('0xe')]('/',auth[_0xfe94('0x8')](),interaction[_0xfe94('0xf')](_0xfe94('0x10'),_0xfe94('0x11')),controller[_0xfe94('0x12')]);router[_0xfe94('0x13')](_0xfe94('0xc'),controller[_0xfe94('0x14')]);router[_0xfe94('0x13')](_0xfe94('0x15'),auth[_0xfe94('0x8')](),controller['accept']);router[_0xfe94('0x13')]('/:id/reject',auth[_0xfe94('0x8')](),controller[_0xfe94('0x16')]);router[_0xfe94('0x17')](_0xfe94('0xc'),auth['isAuthenticated'](),controller[_0xfe94('0x18')]);module[_0xfe94('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ac680e7..a7bd6b5 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 _0x427f=['sequelize','exports','TEXT','medium'];(function(_0x230e48,_0x82b0cc){var _0x33e6f5=function(_0x210b21){while(--_0x210b21){_0x230e48['push'](_0x230e48['shift']());}};_0x33e6f5(++_0x82b0cc);}(_0x427f,0xc4));var _0xf427=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x427f[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xf427('0x0'));module[_0xf427('0x1')]={'body':{'type':Sequelize[_0xf427('0x2')](_0xf427('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x95c8=['exports','medium','sequelize'];(function(_0x31074e,_0x2caaf7){var _0x145609=function(_0x1f8b8a){while(--_0x1f8b8a){_0x31074e['push'](_0x31074e['shift']());}};_0x145609(++_0x2caaf7);}(_0x95c8,0x128));var _0x895c=function(_0x4be118,_0x3f9a3f){_0x4be118=_0x4be118-0x0;var _0x2df11a=_0x95c8[_0x4be118];return _0x2df11a;};'use strict';var Sequelize=require(_0x895c('0x0'));module[_0x895c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x895c('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 466e4a5..be53a93 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 _0xb80a=['../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','dateStart','add','day','where','filter','merge','map','options','ChatOfflineMessage','include','catch','show','params','find','create','body','describe','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x364312,_0x22c92a){var _0x4d15a3=function(_0xb6c4a9){while(--_0xb6c4a9){_0x364312['push'](_0x364312['shift']());}};_0x4d15a3(++_0x22c92a);}(_0xb80a,0xb9));var _0xab80=function(_0x5ac02c,_0x47ff41){_0x5ac02c=_0x5ac02c-0x0;var _0xf1f2c9=_0xb80a[_0x5ac02c];return _0xf1f2c9;};'use strict';var jsonpatch=require(_0xab80('0x0'));var rp=require(_0xab80('0x1'));var moment=require(_0xab80('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab80('0x3'));var path=require(_0xab80('0x4'));var sox=require(_0xab80('0x5'));var csv=require(_0xab80('0x6'));var ejs=require(_0xab80('0x7'));var fs=require('fs');var _=require(_0xab80('0x8'));var squel=require(_0xab80('0x9'));var crypto=require(_0xab80('0xa'));var jsforce=require(_0xab80('0xb'));var deskjs=require(_0xab80('0xc'));var toCsv=require(_0xab80('0x6'));var querystring=require(_0xab80('0xd'));var Papa=require(_0xab80('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xab80('0xf'))(_0xab80('0x10'));var utils=require(_0xab80('0x11'));var config=require(_0xab80('0x12'));var db=require(_0xab80('0x13'))['db'];function respondWithStatusCode(_0x27014d,_0x29dafb){_0x29dafb=_0x29dafb||0xcc;return function(_0x1cd53f){if(_0x1cd53f){return _0x27014d[_0xab80('0x14')](_0x29dafb);}return _0x27014d[_0xab80('0x15')](_0x29dafb)['end']();};}function respondWithResult(_0x228dcd,_0x151542){_0x151542=_0x151542||0xc8;return function(_0xaeb27d){if(_0xaeb27d){return _0x228dcd[_0xab80('0x15')](_0x151542)['json'](_0xaeb27d);}};}function respondWithFilteredResult(_0x5435a6,_0x546777){return function(_0x175bf5){if(_0x175bf5){var _0x304a4d=_0x175bf5[_0xab80('0x16')],_0x51d9b6=_0x546777[_0xab80('0x17')],_0x6c91e=_0x546777[_0xab80('0x17')]+_0x546777[_0xab80('0x18')],_0x5442cb;if(_0x6c91e>=_0x304a4d){_0x6c91e=_0x304a4d;_0x5442cb=0xc8;}else{_0x5442cb=0xce;}_0x5435a6[_0xab80('0x15')](_0x5442cb);return _0x5435a6['set'](_0xab80('0x19'),_0x51d9b6+'-'+_0x6c91e+'/'+_0x304a4d)[_0xab80('0x1a')](_0x175bf5);}return null;};}function patchUpdates(_0x2a3e2d){return function(_0x1943aa){try{jsonpatch[_0xab80('0x1b')](_0x1943aa,_0x2a3e2d,!![]);}catch(_0x174c43){return BPromise[_0xab80('0x1c')](_0x174c43);}return _0x1943aa['save']();};}function saveUpdates(_0x288bf7,_0x220aca){return function(_0x3db10e){if(_0x3db10e){return _0x3db10e[_0xab80('0x1d')](_0x288bf7)[_0xab80('0x1e')](function(_0x4ed393){return _0x4ed393;});}return null;};}function removeEntity(_0x2e4a88,_0x4dc4b0){return function(_0x50e658){if(_0x50e658){return _0x50e658[_0xab80('0x1f')]()['then'](function(){_0x2e4a88[_0xab80('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf60d,_0x4ba1e9){return function(_0x566bc0){if(!_0x566bc0){_0x5bf60d[_0xab80('0x14')](0x194);}return _0x566bc0;};}function handleError(_0x51118f,_0xb7bfb8){_0xb7bfb8=_0xb7bfb8||0x1f4;return function(_0x24ad50){logger['error'](_0x24ad50[_0xab80('0x20')]);if(_0x24ad50[_0xab80('0x21')]){delete _0x24ad50[_0xab80('0x21')];}_0x51118f['status'](_0xb7bfb8)[_0xab80('0x22')](_0x24ad50);};}exports[_0xab80('0x23')]=function(_0x4d0d07,_0x143896){var _0x13be90={},_0x32a1ec={},_0x2dc1d5={'count':0x0,'rows':[]};var _0x2ea7bb=db['ChatOfflineMessage'][_0xab80('0x24')];_0x32a1ec[_0xab80('0x25')]=_[_0xab80('0x26')](_0x2ea7bb);var _0x2ec952={'dateStart':_0x4d0d07[_0xab80('0x27')]['dateStart'],'dateEnd':_0x4d0d07['query']['dateEnd']};delete _0x4d0d07['query']['dateStart'];delete _0x4d0d07['query'][_0xab80('0x28')];_0x32a1ec[_0xab80('0x27')]=_[_0xab80('0x26')](_0x4d0d07[_0xab80('0x27')]);_0x32a1ec[_0xab80('0x29')]=_[_0xab80('0x2a')](_0x32a1ec[_0xab80('0x25')],_0x32a1ec['query']);_0x13be90[_0xab80('0x2b')]=_[_0xab80('0x2a')](_0x32a1ec[_0xab80('0x25')],qs[_0xab80('0x2c')](_0x4d0d07[_0xab80('0x27')][_0xab80('0x2c')]));_0x13be90[_0xab80('0x2b')]=_0x13be90[_0xab80('0x2b')][_0xab80('0x2d')]?_0x13be90[_0xab80('0x2b')]:_0x32a1ec[_0xab80('0x25')];if(!_0x4d0d07['query'][_0xab80('0x2e')](_0xab80('0x2f'))){_0x13be90[_0xab80('0x18')]=qs[_0xab80('0x18')](_0x4d0d07['query'][_0xab80('0x18')]);_0x13be90[_0xab80('0x17')]=qs[_0xab80('0x17')](_0x4d0d07[_0xab80('0x27')][_0xab80('0x17')]);}_0x13be90[_0xab80('0x30')]=qs[_0xab80('0x31')](_0x4d0d07[_0xab80('0x27')][_0xab80('0x31')]);_0x13be90['where']=qs[_0xab80('0x29')](_[_0xab80('0x32')](_0x4d0d07['query'],_0x32a1ec[_0xab80('0x29')]));if(_0x2ec952[_0xab80('0x33')]){if(_0x2ec952['dateEnd']){_0x2ec952[_0xab80('0x28')]=moment(_0x2ec952[_0xab80('0x28')])[_0xab80('0x34')](0x1,'day');}else{_0x2ec952[_0xab80('0x28')]=moment(_0x2ec952[_0xab80('0x33')])[_0xab80('0x34')](0x1,_0xab80('0x35'));}_['merge'](_0x13be90[_0xab80('0x36')],{'createdAt':{'$gte':_0x2ec952['dateStart'],'$lte':_0x2ec952[_0xab80('0x28')]}});}if(_0x4d0d07[_0xab80('0x27')][_0xab80('0x37')]){_0x13be90['where']=_[_0xab80('0x38')](_0x13be90['where'],{'$or':_[_0xab80('0x39')](_0x13be90[_0xab80('0x2b')],function(_0x3bd394){var _0x370ac5={};_0x370ac5[_0x3bd394]={'$like':'%'+_0x4d0d07[_0xab80('0x27')]['filter']+'%'};return _0x370ac5;})});}_0x13be90=_[_0xab80('0x38')]({},_0x13be90,_0x4d0d07[_0xab80('0x3a')]);var _0x3e4bfd={'where':_0x13be90['where']};return db[_0xab80('0x3b')][_0xab80('0x16')](_0x3e4bfd)['then'](function(_0x1ca778){_0x2dc1d5['count']=_0x1ca778;if(_0x4d0d07['query']['includeAll']){_0x13be90[_0xab80('0x3c')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x13be90);})['then'](function(_0x48a9b0){_0x2dc1d5['rows']=_0x48a9b0;return _0x2dc1d5;})['then'](respondWithFilteredResult(_0x143896,_0x13be90))[_0xab80('0x3d')](handleError(_0x143896,null));};exports[_0xab80('0x3e')]=function(_0xfdb61f,_0x4ca1d5){var _0x1e283e={'raw':!![],'where':{'id':_0xfdb61f[_0xab80('0x3f')]['id']}},_0x3c402f={};_0x3c402f['model']=_[_0xab80('0x26')](db['ChatOfflineMessage']['rawAttributes']);_0x3c402f[_0xab80('0x27')]=_['keys'](_0xfdb61f[_0xab80('0x27')]);_0x3c402f['filters']=_[_0xab80('0x2a')](_0x3c402f['model'],_0x3c402f[_0xab80('0x27')]);_0x1e283e[_0xab80('0x2b')]=_[_0xab80('0x2a')](_0x3c402f[_0xab80('0x25')],qs[_0xab80('0x2c')](_0xfdb61f[_0xab80('0x27')][_0xab80('0x2c')]));_0x1e283e['attributes']=_0x1e283e[_0xab80('0x2b')][_0xab80('0x2d')]?_0x1e283e['attributes']:_0x3c402f[_0xab80('0x25')];if(_0xfdb61f[_0xab80('0x27')]['includeAll']){_0x1e283e[_0xab80('0x3c')]=[{'all':!![]}];}_0x1e283e=_['merge']({},_0x1e283e,_0xfdb61f[_0xab80('0x3a')]);return db['ChatOfflineMessage'][_0xab80('0x40')](_0x1e283e)[_0xab80('0x1e')](handleEntityNotFound(_0x4ca1d5,null))[_0xab80('0x1e')](respondWithResult(_0x4ca1d5,null))[_0xab80('0x3d')](handleError(_0x4ca1d5,null));};exports['create']=function(_0x1029d8,_0x45fd1f){return db['ChatOfflineMessage'][_0xab80('0x41')](_0x1029d8[_0xab80('0x42')],{})[_0xab80('0x1e')](respondWithResult(_0x45fd1f,0xc9))[_0xab80('0x3d')](handleError(_0x45fd1f,null));};exports[_0xab80('0x1d')]=function(_0x2bf61c,_0x2431f9){if(_0x2bf61c['body']['id']){delete _0x2bf61c['body']['id'];}return db['ChatOfflineMessage'][_0xab80('0x40')]({'where':{'id':_0x2bf61c[_0xab80('0x3f')]['id']}})[_0xab80('0x1e')](handleEntityNotFound(_0x2431f9,null))[_0xab80('0x1e')](saveUpdates(_0x2bf61c[_0xab80('0x42')],null))[_0xab80('0x1e')](respondWithResult(_0x2431f9,null))[_0xab80('0x3d')](handleError(_0x2431f9,null));};exports[_0xab80('0x1f')]=function(_0x3de187,_0x2a34f4){return db[_0xab80('0x3b')][_0xab80('0x40')]({'where':{'id':_0x3de187['params']['id']}})[_0xab80('0x1e')](handleEntityNotFound(_0x2a34f4,null))['then'](removeEntity(_0x2a34f4,null))[_0xab80('0x3d')](handleError(_0x2a34f4,null));};exports[_0xab80('0x43')]=function(_0x512a9f,_0x1d0fa6){return db[_0xab80('0x3b')][_0xab80('0x43')]()['then'](respondWithResult(_0x1d0fa6,null))[_0xab80('0x3d')](handleError(_0x1d0fa6,null));}; \ No newline at end of file +var _0xbb09=['path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','query','dateStart','dateEnd','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','ChatOfflineMessage','includeAll','include','findAll','catch','params','find','create','body','describe','request-promise','moment','bluebird','mustache'];(function(_0x189607,_0x209dbb){var _0x3c90c4=function(_0x198b70){while(--_0x198b70){_0x189607['push'](_0x189607['shift']());}};_0x3c90c4(++_0x209dbb);}(_0xbb09,0x86));var _0x9bb0=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xbb09[_0x77d310];return _0x2cdce4;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x9bb0('0x0'));var moment=require(_0x9bb0('0x1'));var BPromise=require(_0x9bb0('0x2'));var Mustache=require(_0x9bb0('0x3'));var util=require('util');var path=require(_0x9bb0('0x4'));var sox=require(_0x9bb0('0x5'));var csv=require(_0x9bb0('0x6'));var ejs=require(_0x9bb0('0x7'));var fs=require('fs');var _=require(_0x9bb0('0x8'));var squel=require('squel');var crypto=require(_0x9bb0('0x9'));var jsforce=require(_0x9bb0('0xa'));var deskjs=require(_0x9bb0('0xb'));var toCsv=require(_0x9bb0('0x6'));var querystring=require(_0x9bb0('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9bb0('0xd'));var utils=require(_0x9bb0('0xe'));var config=require(_0x9bb0('0xf'));var db=require(_0x9bb0('0x10'))['db'];function respondWithStatusCode(_0x14f994,_0x1fd1cf){_0x1fd1cf=_0x1fd1cf||0xcc;return function(_0x174c29){if(_0x174c29){return _0x14f994['sendStatus'](_0x1fd1cf);}return _0x14f994[_0x9bb0('0x11')](_0x1fd1cf)[_0x9bb0('0x12')]();};}function respondWithResult(_0x1fc302,_0x3ef889){_0x3ef889=_0x3ef889||0xc8;return function(_0x147879){if(_0x147879){return _0x1fc302[_0x9bb0('0x11')](_0x3ef889)[_0x9bb0('0x13')](_0x147879);}};}function respondWithFilteredResult(_0x1912d9,_0x381c2f){return function(_0x3c9b2e){if(_0x3c9b2e){var _0x11e4bd=_0x3c9b2e[_0x9bb0('0x14')],_0x10bb04=_0x381c2f[_0x9bb0('0x15')],_0x3dd81b=_0x381c2f[_0x9bb0('0x15')]+_0x381c2f[_0x9bb0('0x16')],_0x3570d7;if(_0x3dd81b>=_0x11e4bd){_0x3dd81b=_0x11e4bd;_0x3570d7=0xc8;}else{_0x3570d7=0xce;}_0x1912d9[_0x9bb0('0x11')](_0x3570d7);return _0x1912d9[_0x9bb0('0x17')](_0x9bb0('0x18'),_0x10bb04+'-'+_0x3dd81b+'/'+_0x11e4bd)[_0x9bb0('0x13')](_0x3c9b2e);}return null;};}function patchUpdates(_0xf700e2){return function(_0x90728d){try{jsonpatch[_0x9bb0('0x19')](_0x90728d,_0xf700e2,!![]);}catch(_0x350ef8){return BPromise[_0x9bb0('0x1a')](_0x350ef8);}return _0x90728d[_0x9bb0('0x1b')]();};}function saveUpdates(_0x54818f,_0x29078a){return function(_0x2a117d){if(_0x2a117d){return _0x2a117d[_0x9bb0('0x1c')](_0x54818f)[_0x9bb0('0x1d')](function(_0x3d8420){return _0x3d8420;});}return null;};}function removeEntity(_0x1bbc90,_0x539803){return function(_0x2caa97){if(_0x2caa97){return _0x2caa97[_0x9bb0('0x1e')]()[_0x9bb0('0x1d')](function(){_0x1bbc90['status'](0xcc)[_0x9bb0('0x12')]();});}};}function handleEntityNotFound(_0x1ee571,_0x4df8b3){return function(_0x107513){if(!_0x107513){_0x1ee571[_0x9bb0('0x1f')](0x194);}return _0x107513;};}function handleError(_0x487d8c,_0x3c2d80){_0x3c2d80=_0x3c2d80||0x1f4;return function(_0x11bd6b){logger[_0x9bb0('0x20')](_0x11bd6b[_0x9bb0('0x21')]);if(_0x11bd6b[_0x9bb0('0x22')]){delete _0x11bd6b['name'];}_0x487d8c[_0x9bb0('0x11')](_0x3c2d80)[_0x9bb0('0x23')](_0x11bd6b);};}exports[_0x9bb0('0x24')]=function(_0xfc5446,_0x3b04f7){var _0x216461={},_0x24ab4a={},_0x2f3a12={'count':0x0,'rows':[]};var _0x484f8b=db['ChatOfflineMessage'][_0x9bb0('0x25')];_0x24ab4a['model']=_['keys'](_0x484f8b);var _0x4a2f7c={'dateStart':_0xfc5446[_0x9bb0('0x26')][_0x9bb0('0x27')],'dateEnd':_0xfc5446['query'][_0x9bb0('0x28')]};delete _0xfc5446[_0x9bb0('0x26')]['dateStart'];delete _0xfc5446['query']['dateEnd'];_0x24ab4a[_0x9bb0('0x26')]=_[_0x9bb0('0x29')](_0xfc5446[_0x9bb0('0x26')]);_0x24ab4a[_0x9bb0('0x2a')]=_['intersection'](_0x24ab4a[_0x9bb0('0x2b')],_0x24ab4a[_0x9bb0('0x26')]);_0x216461[_0x9bb0('0x2c')]=_[_0x9bb0('0x2d')](_0x24ab4a[_0x9bb0('0x2b')],qs[_0x9bb0('0x2e')](_0xfc5446[_0x9bb0('0x26')][_0x9bb0('0x2e')]));_0x216461[_0x9bb0('0x2c')]=_0x216461[_0x9bb0('0x2c')][_0x9bb0('0x2f')]?_0x216461[_0x9bb0('0x2c')]:_0x24ab4a[_0x9bb0('0x2b')];if(!_0xfc5446[_0x9bb0('0x26')][_0x9bb0('0x30')](_0x9bb0('0x31'))){_0x216461[_0x9bb0('0x16')]=qs['limit'](_0xfc5446[_0x9bb0('0x26')]['limit']);_0x216461[_0x9bb0('0x15')]=qs[_0x9bb0('0x15')](_0xfc5446[_0x9bb0('0x26')][_0x9bb0('0x15')]);}_0x216461[_0x9bb0('0x32')]=qs[_0x9bb0('0x33')](_0xfc5446['query'][_0x9bb0('0x33')]);_0x216461[_0x9bb0('0x34')]=qs['filters'](_[_0x9bb0('0x35')](_0xfc5446[_0x9bb0('0x26')],_0x24ab4a['filters']));if(_0x4a2f7c[_0x9bb0('0x27')]){if(_0x4a2f7c[_0x9bb0('0x28')]){_0x4a2f7c['dateEnd']=moment(_0x4a2f7c['dateEnd'])[_0x9bb0('0x36')](0x1,_0x9bb0('0x37'));}else{_0x4a2f7c[_0x9bb0('0x28')]=moment(_0x4a2f7c[_0x9bb0('0x27')])['add'](0x1,_0x9bb0('0x37'));}_[_0x9bb0('0x38')](_0x216461[_0x9bb0('0x34')],{'createdAt':{'$gte':_0x4a2f7c['dateStart'],'$lte':_0x4a2f7c[_0x9bb0('0x28')]}});}if(_0xfc5446[_0x9bb0('0x26')][_0x9bb0('0x39')]){_0x216461['where']=_[_0x9bb0('0x38')](_0x216461[_0x9bb0('0x34')],{'$or':_['map'](_0x216461[_0x9bb0('0x2c')],function(_0x3b72b0){var _0x33e1ec={};_0x33e1ec[_0x3b72b0]={'$like':'%'+_0xfc5446['query']['filter']+'%'};return _0x33e1ec;})});}_0x216461=_['merge']({},_0x216461,_0xfc5446[_0x9bb0('0x3a')]);var _0x1dc248={'where':_0x216461[_0x9bb0('0x34')]};return db[_0x9bb0('0x3b')][_0x9bb0('0x14')](_0x1dc248)[_0x9bb0('0x1d')](function(_0x2fcf77){_0x2f3a12[_0x9bb0('0x14')]=_0x2fcf77;if(_0xfc5446[_0x9bb0('0x26')][_0x9bb0('0x3c')]){_0x216461[_0x9bb0('0x3d')]=[{'all':!![]}];}return db[_0x9bb0('0x3b')][_0x9bb0('0x3e')](_0x216461);})['then'](function(_0x31a926){_0x2f3a12['rows']=_0x31a926;return _0x2f3a12;})['then'](respondWithFilteredResult(_0x3b04f7,_0x216461))[_0x9bb0('0x3f')](handleError(_0x3b04f7,null));};exports['show']=function(_0x31115d,_0x3d6a0b){var _0x58f8c4={'raw':!![],'where':{'id':_0x31115d[_0x9bb0('0x40')]['id']}},_0x9d2ad2={};_0x9d2ad2[_0x9bb0('0x2b')]=_[_0x9bb0('0x29')](db[_0x9bb0('0x3b')][_0x9bb0('0x25')]);_0x9d2ad2[_0x9bb0('0x26')]=_['keys'](_0x31115d[_0x9bb0('0x26')]);_0x9d2ad2[_0x9bb0('0x2a')]=_[_0x9bb0('0x2d')](_0x9d2ad2['model'],_0x9d2ad2['query']);_0x58f8c4[_0x9bb0('0x2c')]=_['intersection'](_0x9d2ad2[_0x9bb0('0x2b')],qs[_0x9bb0('0x2e')](_0x31115d[_0x9bb0('0x26')][_0x9bb0('0x2e')]));_0x58f8c4['attributes']=_0x58f8c4[_0x9bb0('0x2c')]['length']?_0x58f8c4[_0x9bb0('0x2c')]:_0x9d2ad2[_0x9bb0('0x2b')];if(_0x31115d[_0x9bb0('0x26')][_0x9bb0('0x3c')]){_0x58f8c4[_0x9bb0('0x3d')]=[{'all':!![]}];}_0x58f8c4=_[_0x9bb0('0x38')]({},_0x58f8c4,_0x31115d[_0x9bb0('0x3a')]);return db[_0x9bb0('0x3b')][_0x9bb0('0x41')](_0x58f8c4)[_0x9bb0('0x1d')](handleEntityNotFound(_0x3d6a0b,null))[_0x9bb0('0x1d')](respondWithResult(_0x3d6a0b,null))['catch'](handleError(_0x3d6a0b,null));};exports[_0x9bb0('0x42')]=function(_0x9a8cac,_0x3bdc1f){return db[_0x9bb0('0x3b')][_0x9bb0('0x42')](_0x9a8cac[_0x9bb0('0x43')],{})[_0x9bb0('0x1d')](respondWithResult(_0x3bdc1f,0xc9))['catch'](handleError(_0x3bdc1f,null));};exports[_0x9bb0('0x1c')]=function(_0x10c214,_0x592f1d){if(_0x10c214[_0x9bb0('0x43')]['id']){delete _0x10c214[_0x9bb0('0x43')]['id'];}return db[_0x9bb0('0x3b')][_0x9bb0('0x41')]({'where':{'id':_0x10c214[_0x9bb0('0x40')]['id']}})[_0x9bb0('0x1d')](handleEntityNotFound(_0x592f1d,null))['then'](saveUpdates(_0x10c214['body'],null))[_0x9bb0('0x1d')](respondWithResult(_0x592f1d,null))['catch'](handleError(_0x592f1d,null));};exports['destroy']=function(_0x5e81b5,_0xfad926){return db[_0x9bb0('0x3b')][_0x9bb0('0x41')]({'where':{'id':_0x5e81b5[_0x9bb0('0x40')]['id']}})['then'](handleEntityNotFound(_0xfad926,null))[_0x9bb0('0x1d')](removeEntity(_0xfad926,null))[_0x9bb0('0x3f')](handleError(_0xfad926,null));};exports[_0x9bb0('0x44')]=function(_0x52d329,_0xfc669a){return db[_0x9bb0('0x3b')][_0x9bb0('0x44')]()[_0x9bb0('0x1d')](respondWithResult(_0xfc669a,null))[_0x9bb0('0x3f')](handleError(_0xfc669a,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b7bd634..4635ecf 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 _0x1321=['define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','./chatOfflineMessage.attributes','exports'];(function(_0x41075d,_0x112862){var _0x11f102=function(_0x49f373){while(--_0x49f373){_0x41075d['push'](_0x41075d['shift']());}};_0x11f102(++_0x112862);}(_0x1321,0xe0));var _0x1132=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1321[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x1132('0x0'));var util=require(_0x1132('0x1'));var logger=require('../../config/logger')(_0x1132('0x2'));var moment=require(_0x1132('0x3'));var BPromise=require('bluebird');var rp=require(_0x1132('0x4'));var attributes=require(_0x1132('0x5'));module[_0x1132('0x6')]=function(_0x56af9f,_0x1857d7){return _0x56af9f[_0x1132('0x7')](_0x1132('0x8'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1132('0x9'),'collate':_0x1132('0xa')});}; \ No newline at end of file +var _0xd169=['exports','define','ChatOfflineMessage','chat_offline_messages','util','../../config/logger','api','bluebird','request-promise'];(function(_0x211199,_0x36422e){var _0x1bf46b=function(_0x2fdb8b){while(--_0x2fdb8b){_0x211199['push'](_0x211199['shift']());}};_0x1bf46b(++_0x36422e);}(_0xd169,0x1a2));var _0x9d16=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd169[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x9d16('0x0'));var logger=require(_0x9d16('0x1'))(_0x9d16('0x2'));var moment=require('moment');var BPromise=require(_0x9d16('0x3'));var rp=require(_0x9d16('0x4'));var attributes=require('./chatOfflineMessage.attributes');module[_0x9d16('0x5')]=function(_0x2fe942,_0x3f9d96){return _0x2fe942[_0x9d16('0x6')](_0x9d16('0x7'),attributes,{'tableName':_0x9d16('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 3f302a5..6c70706 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 _0x8c9c=['info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x292301,_0x2367e7){var _0x5547fd=function(_0x532f3f){while(--_0x532f3f){_0x292301['push'](_0x292301['shift']());}};_0x5547fd(++_0x2367e7);}(_0x8c9c,0x131));var _0xc8c9=function(_0x5b9169,_0xabd955){_0x5b9169=_0x5b9169-0x0;var _0x281367=_0x8c9c[_0x5b9169];return _0x281367;};'use strict';var _=require('lodash');var util=require(_0xc8c9('0x0'));var moment=require(_0xc8c9('0x1'));var BPromise=require(_0xc8c9('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc8c9('0x3'));var logger=require(_0xc8c9('0x4'))(_0xc8c9('0x5'));var config=require('../../config/environment');var jayson=require(_0xc8c9('0x6'));var client=jayson[_0xc8c9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe27865,_0x519cda,_0x1eacb4){return new BPromise(function(_0x12437b,_0x2ef0ce){return client[_0xc8c9('0x8')](_0xe27865,_0x1eacb4)[_0xc8c9('0x9')](function(_0xd4165d){logger[_0xc8c9('0xa')](_0xc8c9('0xb'),_0x519cda,_0xc8c9('0xc'));logger[_0xc8c9('0xd')](_0xc8c9('0xe'),_0x519cda,_0xc8c9('0xc'),JSON[_0xc8c9('0xf')](_0xd4165d));if(_0xd4165d[_0xc8c9('0x10')]){if(_0xd4165d[_0xc8c9('0x10')][_0xc8c9('0x11')]===0x1f4){logger['error'](_0xc8c9('0xb'),_0x519cda,_0xd4165d[_0xc8c9('0x10')][_0xc8c9('0x12')]);return _0x2ef0ce(_0xd4165d[_0xc8c9('0x10')][_0xc8c9('0x12')]);}logger['error'](_0xc8c9('0xb'),_0x519cda,_0xd4165d['error'][_0xc8c9('0x12')]);return _0x12437b(_0xd4165d[_0xc8c9('0x10')]['message']);}else{logger['info'](_0xc8c9('0xb'),_0x519cda,'request\x20sent');_0x12437b(_0xd4165d[_0xc8c9('0x13')][_0xc8c9('0x12')]);}})[_0xc8c9('0x14')](function(_0x3a99fc){logger[_0xc8c9('0x10')](_0xc8c9('0xb'),_0x519cda,_0x3a99fc);_0x2ef0ce(_0x3a99fc);});});} \ No newline at end of file +var _0x36f9=['catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x12c06e,_0x4dd7cb){var _0x41f248=function(_0x427c7d){while(--_0x427c7d){_0x12c06e['push'](_0x12c06e['shift']());}};_0x41f248(++_0x4dd7cb);}(_0x36f9,0x151));var _0x936f=function(_0x5e2256,_0x39ab49){_0x5e2256=_0x5e2256-0x0;var _0x445f1c=_0x36f9[_0x5e2256];return _0x445f1c;};'use strict';var _=require(_0x936f('0x0'));var util=require('util');var moment=require(_0x936f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x936f('0x2'))['db'];var utils=require(_0x936f('0x3'));var logger=require(_0x936f('0x4'))(_0x936f('0x5'));var config=require(_0x936f('0x6'));var jayson=require(_0x936f('0x7'));var client=jayson[_0x936f('0x8')][_0x936f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c9c87,_0x361291,_0x3fa338){return new BPromise(function(_0x5b3cf7,_0xdaf708){return client[_0x936f('0xa')](_0x1c9c87,_0x3fa338)[_0x936f('0xb')](function(_0xd3b753){logger[_0x936f('0xc')](_0x936f('0xd'),_0x361291,_0x936f('0xe'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x361291,'request\x20sent',JSON[_0x936f('0xf')](_0xd3b753));if(_0xd3b753[_0x936f('0x10')]){if(_0xd3b753[_0x936f('0x10')][_0x936f('0x11')]===0x1f4){logger[_0x936f('0x10')](_0x936f('0xd'),_0x361291,_0xd3b753[_0x936f('0x10')][_0x936f('0x12')]);return _0xdaf708(_0xd3b753['error'][_0x936f('0x12')]);}logger[_0x936f('0x10')](_0x936f('0xd'),_0x361291,_0xd3b753[_0x936f('0x10')][_0x936f('0x12')]);return _0x5b3cf7(_0xd3b753[_0x936f('0x10')]['message']);}else{logger[_0x936f('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x361291,_0x936f('0xe'));_0x5b3cf7(_0xd3b753[_0x936f('0x13')]['message']);}})[_0x936f('0x14')](function(_0x1be75c){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x361291,_0x1be75c);_0xdaf708(_0x1be75c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 35b3ab1..af303d3 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 _0x03fc=['create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xcb1fa8,_0x873fa9){var _0x3b8917=function(_0x4f0785){while(--_0x4f0785){_0xcb1fa8['push'](_0xcb1fa8['shift']());}};_0x3b8917(++_0x873fa9);}(_0x03fc,0xb9));var _0xc03f=function(_0x34f75c,_0x29cfa3){_0x34f75c=_0x34f75c-0x0;var _0x4b96cc=_0x03fc[_0x34f75c];return _0x4b96cc;};'use strict';var multer=require(_0xc03f('0x0'));var util=require(_0xc03f('0x1'));var path=require(_0xc03f('0x2'));var express=require(_0xc03f('0x3'));var router=express['Router']();var auth=require(_0xc03f('0x4'));var interaction=require(_0xc03f('0x5'));var config=require('../../config/environment');var controller=require(_0xc03f('0x6'));router[_0xc03f('0x7')]('/',auth[_0xc03f('0x8')](),controller[_0xc03f('0x9')]);router['get'](_0xc03f('0xa'),auth[_0xc03f('0x8')](),controller[_0xc03f('0xb')]);router['get'](_0xc03f('0xc'),auth['isAuthenticated'](),controller[_0xc03f('0xd')]);router[_0xc03f('0xe')]('/',auth[_0xc03f('0x8')](),controller[_0xc03f('0xf')]);router[_0xc03f('0x10')](_0xc03f('0xc'),auth[_0xc03f('0x8')](),controller['update']);router[_0xc03f('0x11')](_0xc03f('0xc'),auth['isAuthenticated'](),controller[_0xc03f('0x12')]);module[_0xc03f('0x13')]=router; \ No newline at end of file +var _0x2e30=['./chatOfflineMessage.controller','get','index','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e30,0x1e3));var _0x02e3=function(_0x580afd,_0x43ab1d){_0x580afd=_0x580afd-0x0;var _0x4d2c7a=_0x2e30[_0x580afd];return _0x4d2c7a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x02e3('0x0'));var interaction=require(_0x02e3('0x1'));var config=require(_0x02e3('0x2'));var controller=require(_0x02e3('0x3'));router[_0x02e3('0x4')]('/',auth['isAuthenticated'](),controller[_0x02e3('0x5')]);router['get'](_0x02e3('0x6'),auth['isAuthenticated'](),controller[_0x02e3('0x7')]);router['get'](_0x02e3('0x8'),auth['isAuthenticated'](),controller[_0x02e3('0x9')]);router[_0x02e3('0xa')]('/',auth[_0x02e3('0xb')](),controller[_0x02e3('0xc')]);router[_0x02e3('0xd')](_0x02e3('0x8'),auth[_0x02e3('0xb')](),controller[_0x02e3('0xe')]);router[_0x02e3('0xf')](_0x02e3('0x8'),auth[_0x02e3('0xb')](),controller[_0x02e3('0x10')]);module[_0x02e3('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4cac579..6ccd234 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 _0x09cb=['INTEGER','sequelize','STRING','ENUM','mouseOver','timeout'];(function(_0x559a99,_0x50e9d8){var _0x5aef70=function(_0x59d7f9){while(--_0x59d7f9){_0x559a99['push'](_0x559a99['shift']());}};_0x5aef70(++_0x50e9d8);}(_0x09cb,0x109));var _0xb09c=function(_0x1952f0,_0x18e5ad){_0x1952f0=_0x1952f0-0x0;var _0x40a681=_0x09cb[_0x1952f0];return _0x40a681;};'use strict';var Sequelize=require(_0xb09c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb09c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb09c('0x2')](_0xb09c('0x3'),_0xb09c('0x4')),'defaultValue':_0xb09c('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb09c('0x5')]}}; \ No newline at end of file +var _0x648a=['STRING','INTEGER','sequelize','exports','mouseOver'];(function(_0x4e81eb,_0x1a1e7c){var _0x4f52e3=function(_0x509e73){while(--_0x509e73){_0x4e81eb['push'](_0x4e81eb['shift']());}};_0x4f52e3(++_0x1a1e7c);}(_0x648a,0xc0));var _0xa648=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x648a[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xa648('0x0'));module[_0xa648('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':_0xa648('0x2')},'selector':{'type':Sequelize[_0xa648('0x3')]},'timeout':{'type':Sequelize[_0xa648('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 23e0410..c3bacfc 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 _0x02b6=['offset','set','Content-Range','apply','reject','then','destroy','end','sendStatus','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','create','update','body','find','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x02b6,0xfe));var _0x602b=function(_0x208c24,_0x1ffb79){_0x208c24=_0x208c24-0x0;var _0x238624=_0x02b6[_0x208c24];return _0x238624;};'use strict';var jsonpatch=require(_0x602b('0x0'));var rp=require('request-promise');var moment=require(_0x602b('0x1'));var BPromise=require(_0x602b('0x2'));var Mustache=require(_0x602b('0x3'));var util=require('util');var path=require('path');var sox=require(_0x602b('0x4'));var csv=require(_0x602b('0x5'));var ejs=require(_0x602b('0x6'));var fs=require('fs');var _=require(_0x602b('0x7'));var squel=require('squel');var crypto=require(_0x602b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x602b('0x9'));var toCsv=require(_0x602b('0x5'));var querystring=require(_0x602b('0xa'));var Papa=require(_0x602b('0xb'));var qs=require(_0x602b('0xc'));var logger=require(_0x602b('0xd'))(_0x602b('0xe'));var utils=require(_0x602b('0xf'));var config=require(_0x602b('0x10'));var db=require(_0x602b('0x11'))['db'];function respondWithStatusCode(_0x4fb0a2,_0x470cf0){_0x470cf0=_0x470cf0||0xcc;return function(_0x5ca85d){if(_0x5ca85d){return _0x4fb0a2['sendStatus'](_0x470cf0);}return _0x4fb0a2[_0x602b('0x12')](_0x470cf0)['end']();};}function respondWithResult(_0x1d67d4,_0x474100){_0x474100=_0x474100||0xc8;return function(_0x4bb9a4){if(_0x4bb9a4){return _0x1d67d4[_0x602b('0x12')](_0x474100)[_0x602b('0x13')](_0x4bb9a4);}};}function respondWithFilteredResult(_0x135847,_0x56a4d3){return function(_0x408852){if(_0x408852){var _0x38ae6a=_0x408852[_0x602b('0x14')],_0x2c7f9a=_0x56a4d3[_0x602b('0x15')],_0x3742f1=_0x56a4d3['offset']+_0x56a4d3['limit'],_0x27eb0a;if(_0x3742f1>=_0x38ae6a){_0x3742f1=_0x38ae6a;_0x27eb0a=0xc8;}else{_0x27eb0a=0xce;}_0x135847[_0x602b('0x12')](_0x27eb0a);return _0x135847[_0x602b('0x16')](_0x602b('0x17'),_0x2c7f9a+'-'+_0x3742f1+'/'+_0x38ae6a)[_0x602b('0x13')](_0x408852);}return null;};}function patchUpdates(_0x2aed6b){return function(_0x3f540c){try{jsonpatch[_0x602b('0x18')](_0x3f540c,_0x2aed6b,!![]);}catch(_0x1c440f){return BPromise[_0x602b('0x19')](_0x1c440f);}return _0x3f540c['save']();};}function saveUpdates(_0x48d992,_0x7dd35d){return function(_0x3ddabd){if(_0x3ddabd){return _0x3ddabd['update'](_0x48d992)[_0x602b('0x1a')](function(_0x581a3b){return _0x581a3b;});}return null;};}function removeEntity(_0x4ddfe0,_0x311da8){return function(_0x4e888d){if(_0x4e888d){return _0x4e888d[_0x602b('0x1b')]()['then'](function(){_0x4ddfe0[_0x602b('0x12')](0xcc)[_0x602b('0x1c')]();});}};}function handleEntityNotFound(_0x3339a9,_0x5c1893){return function(_0x258e11){if(!_0x258e11){_0x3339a9[_0x602b('0x1d')](0x194);}return _0x258e11;};}function handleError(_0x580b66,_0x315ea8){_0x315ea8=_0x315ea8||0x1f4;return function(_0x1d82c2){logger[_0x602b('0x1e')](_0x1d82c2[_0x602b('0x1f')]);if(_0x1d82c2[_0x602b('0x20')]){delete _0x1d82c2[_0x602b('0x20')];}_0x580b66[_0x602b('0x12')](_0x315ea8)[_0x602b('0x21')](_0x1d82c2);};}exports[_0x602b('0x22')]=function(_0x5066e4,_0x43acc3){var _0x427bf1={'raw':!![],'where':{'id':_0x5066e4[_0x602b('0x23')]['id']}},_0x5ce51b={};_0x5ce51b[_0x602b('0x24')]=_['keys'](db[_0x602b('0x25')][_0x602b('0x26')]);_0x5ce51b[_0x602b('0x27')]=_[_0x602b('0x28')](_0x5066e4[_0x602b('0x27')]);_0x5ce51b[_0x602b('0x29')]=_[_0x602b('0x2a')](_0x5ce51b[_0x602b('0x24')],_0x5ce51b[_0x602b('0x27')]);_0x427bf1[_0x602b('0x2b')]=_[_0x602b('0x2a')](_0x5ce51b['model'],qs[_0x602b('0x2c')](_0x5066e4['query'][_0x602b('0x2c')]));_0x427bf1[_0x602b('0x2b')]=_0x427bf1[_0x602b('0x2b')][_0x602b('0x2d')]?_0x427bf1[_0x602b('0x2b')]:_0x5ce51b[_0x602b('0x24')];if(_0x5066e4[_0x602b('0x27')][_0x602b('0x2e')]){_0x427bf1[_0x602b('0x2f')]=[{'all':!![]}];}_0x427bf1=_[_0x602b('0x30')]({},_0x427bf1,_0x5066e4[_0x602b('0x31')]);return db['ChatProactiveAction']['find'](_0x427bf1)[_0x602b('0x1a')](handleEntityNotFound(_0x43acc3,null))[_0x602b('0x1a')](respondWithResult(_0x43acc3,null))[_0x602b('0x32')](handleError(_0x43acc3,null));};exports[_0x602b('0x33')]=function(_0x4bd438,_0x3a761b){return db[_0x602b('0x25')][_0x602b('0x33')](_0x4bd438['body'],{})[_0x602b('0x1a')](respondWithResult(_0x3a761b,0xc9))[_0x602b('0x32')](handleError(_0x3a761b,null));};exports[_0x602b('0x34')]=function(_0x5cca49,_0x5be386){if(_0x5cca49[_0x602b('0x35')]['id']){delete _0x5cca49['body']['id'];}return db[_0x602b('0x25')][_0x602b('0x36')]({'where':{'id':_0x5cca49[_0x602b('0x23')]['id']}})[_0x602b('0x1a')](handleEntityNotFound(_0x5be386,null))[_0x602b('0x1a')](saveUpdates(_0x5cca49[_0x602b('0x35')],null))['then'](respondWithResult(_0x5be386,null))[_0x602b('0x32')](handleError(_0x5be386,null));};exports[_0x602b('0x1b')]=function(_0x9f9357,_0x49a234){return db[_0x602b('0x25')]['find']({'where':{'id':_0x9f9357[_0x602b('0x23')]['id']}})[_0x602b('0x1a')](handleEntityNotFound(_0x49a234,null))['then'](removeEntity(_0x49a234,null))['catch'](handleError(_0x49a234,null));}; \ No newline at end of file +var _0x9235=['show','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','length','include','find','create','body','catch','destroy','params','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../mysqldb','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9235,0x101));var _0x5923=function(_0x1ba7d9,_0x56a49c){_0x1ba7d9=_0x1ba7d9-0x0;var _0x40975c=_0x9235[_0x1ba7d9];return _0x40975c;};'use strict';var jsonpatch=require(_0x5923('0x0'));var rp=require(_0x5923('0x1'));var moment=require(_0x5923('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5923('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5923('0x4'));var ejs=require(_0x5923('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5923('0x6'));var crypto=require(_0x5923('0x7'));var jsforce=require(_0x5923('0x8'));var deskjs=require(_0x5923('0x9'));var toCsv=require(_0x5923('0x4'));var querystring=require(_0x5923('0xa'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x5923('0xb'))(_0x5923('0xc'));var utils=require(_0x5923('0xd'));var config=require('../../config/environment');var db=require(_0x5923('0xe'))['db'];function respondWithStatusCode(_0x5e050f,_0x5a78d7){_0x5a78d7=_0x5a78d7||0xcc;return function(_0x224c9e){if(_0x224c9e){return _0x5e050f['sendStatus'](_0x5a78d7);}return _0x5e050f['status'](_0x5a78d7)[_0x5923('0xf')]();};}function respondWithResult(_0x1220b3,_0xf26329){_0xf26329=_0xf26329||0xc8;return function(_0x5e9203){if(_0x5e9203){return _0x1220b3['status'](_0xf26329)['json'](_0x5e9203);}};}function respondWithFilteredResult(_0x585b8b,_0x3b1f79){return function(_0x5ed8a4){if(_0x5ed8a4){var _0x1cbaf3=_0x5ed8a4[_0x5923('0x10')],_0x479d83=_0x3b1f79[_0x5923('0x11')],_0xdbaf02=_0x3b1f79[_0x5923('0x11')]+_0x3b1f79[_0x5923('0x12')],_0x4f1d6b;if(_0xdbaf02>=_0x1cbaf3){_0xdbaf02=_0x1cbaf3;_0x4f1d6b=0xc8;}else{_0x4f1d6b=0xce;}_0x585b8b['status'](_0x4f1d6b);return _0x585b8b[_0x5923('0x13')](_0x5923('0x14'),_0x479d83+'-'+_0xdbaf02+'/'+_0x1cbaf3)[_0x5923('0x15')](_0x5ed8a4);}return null;};}function patchUpdates(_0x2672ab){return function(_0x282fbd){try{jsonpatch[_0x5923('0x16')](_0x282fbd,_0x2672ab,!![]);}catch(_0x262e8a){return BPromise[_0x5923('0x17')](_0x262e8a);}return _0x282fbd[_0x5923('0x18')]();};}function saveUpdates(_0x5b2269,_0x289189){return function(_0x124f32){if(_0x124f32){return _0x124f32[_0x5923('0x19')](_0x5b2269)['then'](function(_0x1884e7){return _0x1884e7;});}return null;};}function removeEntity(_0x15e6a9,_0x11d3cb){return function(_0x4c7b03){if(_0x4c7b03){return _0x4c7b03['destroy']()[_0x5923('0x1a')](function(){_0x15e6a9['status'](0xcc)[_0x5923('0xf')]();});}};}function handleEntityNotFound(_0x1e8cfd,_0x354987){return function(_0x4b0cb7){if(!_0x4b0cb7){_0x1e8cfd[_0x5923('0x1b')](0x194);}return _0x4b0cb7;};}function handleError(_0x164713,_0x42eb37){_0x42eb37=_0x42eb37||0x1f4;return function(_0x156e61){logger[_0x5923('0x1c')](_0x156e61['stack']);if(_0x156e61[_0x5923('0x1d')]){delete _0x156e61[_0x5923('0x1d')];}_0x164713[_0x5923('0x1e')](_0x42eb37)['send'](_0x156e61);};}exports[_0x5923('0x1f')]=function(_0x1b7ee5,_0x497f3d){var _0x5ed051={'raw':!![],'where':{'id':_0x1b7ee5['params']['id']}},_0x5ae47e={};_0x5ae47e[_0x5923('0x20')]=_[_0x5923('0x21')](db[_0x5923('0x22')][_0x5923('0x23')]);_0x5ae47e[_0x5923('0x24')]=_['keys'](_0x1b7ee5[_0x5923('0x24')]);_0x5ae47e['filters']=_['intersection'](_0x5ae47e[_0x5923('0x20')],_0x5ae47e[_0x5923('0x24')]);_0x5ed051[_0x5923('0x25')]=_[_0x5923('0x26')](_0x5ae47e['model'],qs[_0x5923('0x27')](_0x1b7ee5[_0x5923('0x24')][_0x5923('0x27')]));_0x5ed051['attributes']=_0x5ed051[_0x5923('0x25')][_0x5923('0x28')]?_0x5ed051[_0x5923('0x25')]:_0x5ae47e[_0x5923('0x20')];if(_0x1b7ee5[_0x5923('0x24')]['includeAll']){_0x5ed051[_0x5923('0x29')]=[{'all':!![]}];}_0x5ed051=_['merge']({},_0x5ed051,_0x1b7ee5['options']);return db[_0x5923('0x22')][_0x5923('0x2a')](_0x5ed051)[_0x5923('0x1a')](handleEntityNotFound(_0x497f3d,null))[_0x5923('0x1a')](respondWithResult(_0x497f3d,null))['catch'](handleError(_0x497f3d,null));};exports[_0x5923('0x2b')]=function(_0x30703e,_0x2114dc){return db[_0x5923('0x22')][_0x5923('0x2b')](_0x30703e[_0x5923('0x2c')],{})[_0x5923('0x1a')](respondWithResult(_0x2114dc,0xc9))[_0x5923('0x2d')](handleError(_0x2114dc,null));};exports['update']=function(_0x2fd230,_0x5a857d){if(_0x2fd230[_0x5923('0x2c')]['id']){delete _0x2fd230['body']['id'];}return db[_0x5923('0x22')]['find']({'where':{'id':_0x2fd230['params']['id']}})[_0x5923('0x1a')](handleEntityNotFound(_0x5a857d,null))[_0x5923('0x1a')](saveUpdates(_0x2fd230['body'],null))['then'](respondWithResult(_0x5a857d,null))['catch'](handleError(_0x5a857d,null));};exports[_0x5923('0x2e')]=function(_0x9408e8,_0x3bd576){return db[_0x5923('0x22')][_0x5923('0x2a')]({'where':{'id':_0x9408e8[_0x5923('0x2f')]['id']}})[_0x5923('0x1a')](handleEntityNotFound(_0x3bd576,null))[_0x5923('0x1a')](removeEntity(_0x3bd576,null))[_0x5923('0x2d')](handleError(_0x3bd576,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f5cd019..3f85e0f 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 _0x2032=['chat_proactive_actions','util','../../config/logger','api','bluebird','request-promise','exports','define','ChatProactiveAction'];(function(_0x315729,_0xafa2ba){var _0x424254=function(_0x97702e){while(--_0x97702e){_0x315729['push'](_0x315729['shift']());}};_0x424254(++_0xafa2ba);}(_0x2032,0xd9));var _0x2203=function(_0x246543,_0x3bf9b8){_0x246543=_0x246543-0x0;var _0x1149e1=_0x2032[_0x246543];return _0x1149e1;};'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 +var _0x8603=['util','../../config/logger','api','request-promise','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0xfbd7f5,_0x12d61e){var _0x164665=function(_0x5adbbd){while(--_0x5adbbd){_0xfbd7f5['push'](_0xfbd7f5['shift']());}};_0x164665(++_0x12d61e);}(_0x8603,0x190));var _0x3860=function(_0x312a7f,_0x509e83){_0x312a7f=_0x312a7f-0x0;var _0x2fb5ba=_0x8603[_0x312a7f];return _0x2fb5ba;};'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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index a581368..dc1d276 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 _0x2292=['request\x20sent','debug','stringify','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x4b3678,_0x2c5d26){var _0x4eeac2=function(_0x1a266d){while(--_0x1a266d){_0x4b3678['push'](_0x4b3678['shift']());}};_0x4eeac2(++_0x2c5d26);}(_0x2292,0x91));var _0x2229=function(_0x5c8736,_0x2a2a03){_0x5c8736=_0x5c8736-0x0;var _0x142bdb=_0x2292[_0x5c8736];return _0x142bdb;};'use strict';var _=require(_0x2229('0x0'));var util=require('util');var moment=require(_0x2229('0x1'));var BPromise=require(_0x2229('0x2'));var rs=require(_0x2229('0x3'));var fs=require('fs');var db=require(_0x2229('0x4'))['db'];var utils=require(_0x2229('0x5'));var logger=require('../../config/logger')(_0x2229('0x6'));var config=require(_0x2229('0x7'));var jayson=require(_0x2229('0x8'));var client=jayson[_0x2229('0x9')][_0x2229('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55945c,_0x5d16cd,_0x18c60a){return new BPromise(function(_0x528c71,_0x3dd789){return client[_0x2229('0xb')](_0x55945c,_0x18c60a)[_0x2229('0xc')](function(_0x447839){logger[_0x2229('0xd')](_0x2229('0xe'),_0x5d16cd,_0x2229('0xf'));logger[_0x2229('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5d16cd,_0x2229('0xf'),JSON[_0x2229('0x11')](_0x447839));if(_0x447839[_0x2229('0x12')]){if(_0x447839[_0x2229('0x12')]['code']===0x1f4){logger['error'](_0x2229('0xe'),_0x5d16cd,_0x447839[_0x2229('0x12')][_0x2229('0x13')]);return _0x3dd789(_0x447839['error'][_0x2229('0x13')]);}logger[_0x2229('0x12')](_0x2229('0xe'),_0x5d16cd,_0x447839['error']['message']);return _0x528c71(_0x447839['error'][_0x2229('0x13')]);}else{logger[_0x2229('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5d16cd,'request\x20sent');_0x528c71(_0x447839['result'][_0x2229('0x13')]);}})['catch'](function(_0x18386a){logger['error'](_0x2229('0xe'),_0x5d16cd,_0x18386a);_0x3dd789(_0x18386a);});});} \ No newline at end of file +var _0x3c54=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x581b46,_0x57f89d){var _0x1dd58e=function(_0x22e657){while(--_0x22e657){_0x581b46['push'](_0x581b46['shift']());}};_0x1dd58e(++_0x57f89d);}(_0x3c54,0x14d));var _0x43c5=function(_0x586af9,_0x2e8944){_0x586af9=_0x586af9-0x0;var _0x249ea2=_0x3c54[_0x586af9];return _0x249ea2;};'use strict';var _=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var moment=require(_0x43c5('0x2'));var BPromise=require(_0x43c5('0x3'));var rs=require(_0x43c5('0x4'));var fs=require('fs');var db=require(_0x43c5('0x5'))['db'];var utils=require(_0x43c5('0x6'));var logger=require(_0x43c5('0x7'))(_0x43c5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x43c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11954b,_0x5e137d,_0x48ae46){return new BPromise(function(_0x2d1330,_0x4c0594){return client['request'](_0x11954b,_0x48ae46)[_0x43c5('0xa')](function(_0x3aa80d){logger[_0x43c5('0xb')](_0x43c5('0xc'),_0x5e137d,_0x43c5('0xd'));logger[_0x43c5('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5e137d,_0x43c5('0xd'),JSON[_0x43c5('0xf')](_0x3aa80d));if(_0x3aa80d[_0x43c5('0x10')]){if(_0x3aa80d['error'][_0x43c5('0x11')]===0x1f4){logger[_0x43c5('0x10')](_0x43c5('0xc'),_0x5e137d,_0x3aa80d['error']['message']);return _0x4c0594(_0x3aa80d[_0x43c5('0x10')]['message']);}logger[_0x43c5('0x10')](_0x43c5('0xc'),_0x5e137d,_0x3aa80d['error'][_0x43c5('0x12')]);return _0x2d1330(_0x3aa80d['error'][_0x43c5('0x12')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5e137d,_0x43c5('0xd'));_0x2d1330(_0x3aa80d[_0x43c5('0x13')][_0x43c5('0x12')]);}})[_0x43c5('0x14')](function(_0x184677){logger[_0x43c5('0x10')](_0x43c5('0xc'),_0x5e137d,_0x184677);_0x4c0594(_0x184677);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 946e40a..fa8286d 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 _0x581e=['exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x36678c,_0x39c636){var _0x3e4f6b=function(_0x13c1cc){while(--_0x13c1cc){_0x36678c['push'](_0x36678c['shift']());}};_0x3e4f6b(++_0x39c636);}(_0x581e,0x1aa));var _0xe581=function(_0x31f59c,_0x473ee1){_0x31f59c=_0x31f59c-0x0;var _0x38deaf=_0x581e[_0x31f59c];return _0x38deaf;};'use strict';var multer=require(_0xe581('0x0'));var util=require('util');var path=require(_0xe581('0x1'));var express=require(_0xe581('0x2'));var router=express[_0xe581('0x3')]();var auth=require(_0xe581('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe581('0x5'));var controller=require(_0xe581('0x6'));router[_0xe581('0x7')](_0xe581('0x8'),auth[_0xe581('0x9')](),controller[_0xe581('0xa')]);router[_0xe581('0xb')]('/',auth[_0xe581('0x9')](),controller[_0xe581('0xc')]);router['put'](_0xe581('0x8'),auth['isAuthenticated'](),controller[_0xe581('0xd')]);router[_0xe581('0xe')](_0xe581('0x8'),auth[_0xe581('0x9')](),controller[_0xe581('0xf')]);module[_0xe581('0x10')]=router; \ No newline at end of file +var _0x7267=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','express'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7267,0x13f));var _0x7726=function(_0x1c9033,_0x43ddfa){_0x1c9033=_0x1c9033-0x0;var _0x124570=_0x7267[_0x1c9033];return _0x124570;};'use strict';var multer=require(_0x7726('0x0'));var util=require(_0x7726('0x1'));var path=require(_0x7726('0x2'));var express=require(_0x7726('0x3'));var router=express[_0x7726('0x4')]();var auth=require(_0x7726('0x5'));var interaction=require(_0x7726('0x6'));var config=require(_0x7726('0x7'));var controller=require(_0x7726('0x8'));router[_0x7726('0x9')](_0x7726('0xa'),auth[_0x7726('0xb')](),controller[_0x7726('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7726('0xd')](_0x7726('0xa'),auth[_0x7726('0xb')](),controller['update']);router[_0x7726('0xe')](_0x7726('0xa'),auth[_0x7726('0xb')](),controller[_0x7726('0xf')]);module[_0x7726('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index eb54984..9a94a5d 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 _0x7898=['ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x37d4ec,_0x28863f){var _0x4b2f04=function(_0x510c54){while(--_0x510c54){_0x37d4ec['push'](_0x37d4ec['shift']());}};_0x4b2f04(++_0x28863f);}(_0x7898,0x1b7));var _0x8789=function(_0x23f2a7,_0x3bc14f){_0x23f2a7=_0x23f2a7-0x0;var _0x547933=_0x7898[_0x23f2a7];return _0x547933;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8789('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8789('0x1')](_0x8789('0x2'),_0x8789('0x3'),_0x8789('0x4'))}}; \ No newline at end of file +var _0xb5aa=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x322e89,_0x29cc1d){var _0x88f22b=function(_0x1aedce){while(--_0x1aedce){_0x322e89['push'](_0x322e89['shift']());}};_0x88f22b(++_0x29cc1d);}(_0xb5aa,0xf0));var _0xab5a=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb5aa[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0xab5a('0x0'));module[_0xab5a('0x1')]={'name':{'type':Sequelize[_0xab5a('0x2')],'unique':_0xab5a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab5a('0x2')]},'timeout':{'type':Sequelize[_0xab5a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xab5a('0x5'),_0xab5a('0x6'),_0xab5a('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a736124..06ba3e6 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 _0x557d=['to-csv','papaparse','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatQueue.socket','register','client','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','json','apply','reject','save','then','destroy','stack','name','send','ChatQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','merge','filter','where','map','options','include','rows','show','params','includeAll','create','body','update','find','describe','findOne','hasOwnProperty','ChatQueueId','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','%s/%s','SIP','Team','getTeams','Agents','union','addTeams','ids','removeTeams','addAgents','omit','spread','emit','removeAgents','isArray','userChatQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','path','sox','squel','jsforce','desk.js'];(function(_0x880536,_0x5755e1){var _0x567755=function(_0x264b53){while(--_0x264b53){_0x880536['push'](_0x880536['shift']());}};_0x567755(++_0x5755e1);}(_0x557d,0xcb));var _0xd557=function(_0x373f7b,_0x4b24d9){_0x373f7b=_0x373f7b-0x0;var _0x2245de=_0x557d[_0x373f7b];return _0x2245de;};'use strict';var jsonpatch=require(_0xd557('0x0'));var rp=require(_0xd557('0x1'));var moment=require(_0xd557('0x2'));var BPromise=require(_0xd557('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd557('0x4'));var sox=require(_0xd557('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd557('0x6'));var crypto=require('crypto');var jsforce=require(_0xd557('0x7'));var deskjs=require(_0xd557('0x8'));var toCsv=require(_0xd557('0x9'));var querystring=require('querystring');var Papa=require(_0xd557('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0xd557('0xb'))('api');var utils=require('../../config/utils');var config=require(_0xd557('0xc'));var db=require(_0xd557('0xd'))['db'];var socket=require(_0xd557('0xe'))({'host':_0xd557('0xf'),'port':0x18eb});require(_0xd557('0x10'))[_0xd557('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd557('0x12')][_0xd557('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x370f2c,_0x2fd036,_0x1b5a7d,_0x2ee82a){return new BPromise(function(_0x1cf73c,_0x23c5ca){var _0x2c34fd=_0x2ee82a||client;return _0x2c34fd[_0xd557('0x14')](_0x370f2c,_0x1b5a7d)['then'](function(_0x3704db){logger[_0xd557('0x15')](_0xd557('0x16'),_0x2fd036,_0xd557('0x17'));logger[_0xd557('0x18')](_0xd557('0x19'),_0x2fd036,_0xd557('0x17'),JSON[_0xd557('0x1a')](_0x3704db));if(_0x3704db[_0xd557('0x1b')]){if(_0x3704db[_0xd557('0x1b')][_0xd557('0x1c')]===0x1f4){logger[_0xd557('0x1b')](_0xd557('0x16'),_0x2fd036,_0x3704db['error'][_0xd557('0x1d')]);return _0x23c5ca(_0x3704db[_0xd557('0x1b')][_0xd557('0x1d')]);}logger[_0xd557('0x1b')](_0xd557('0x16'),_0x2fd036,_0x3704db['error'][_0xd557('0x1d')]);return _0x1cf73c(_0x3704db['error'][_0xd557('0x1d')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2fd036,_0xd557('0x17'));_0x1cf73c(_0x3704db[_0xd557('0x1e')][_0xd557('0x1d')]);}})[_0xd557('0x1f')](function(_0x551f8f){logger[_0xd557('0x1b')]('ChatQueue,\x20%s,\x20%s',_0x2fd036,_0x551f8f);_0x23c5ca(_0x551f8f);});});}function respondWithStatusCode(_0x246790,_0x5f3d46){_0x5f3d46=_0x5f3d46||0xcc;return function(_0x5b0a7d){if(_0x5b0a7d){return _0x246790[_0xd557('0x20')](_0x5f3d46);}return _0x246790['status'](_0x5f3d46)[_0xd557('0x21')]();};}function respondWithResult(_0x31501b,_0x4aeeb1){_0x4aeeb1=_0x4aeeb1||0xc8;return function(_0x13250b){if(_0x13250b){return _0x31501b[_0xd557('0x22')](_0x4aeeb1)['json'](_0x13250b);}};}function respondWithFilteredResult(_0x4d7b36,_0x33785e){return function(_0x45fdf9){if(_0x45fdf9){var _0x53995e=_0x45fdf9[_0xd557('0x23')],_0x44bd00=_0x33785e[_0xd557('0x24')],_0x5adfff=_0x33785e[_0xd557('0x24')]+_0x33785e['limit'],_0x386a4e;if(_0x5adfff>=_0x53995e){_0x5adfff=_0x53995e;_0x386a4e=0xc8;}else{_0x386a4e=0xce;}_0x4d7b36[_0xd557('0x22')](_0x386a4e);return _0x4d7b36['set']('Content-Range',_0x44bd00+'-'+_0x5adfff+'/'+_0x53995e)[_0xd557('0x25')](_0x45fdf9);}return null;};}function patchUpdates(_0x2fbc3e){return function(_0x2bb78d){try{jsonpatch[_0xd557('0x26')](_0x2bb78d,_0x2fbc3e,!![]);}catch(_0xee9dea){return BPromise[_0xd557('0x27')](_0xee9dea);}return _0x2bb78d[_0xd557('0x28')]();};}function saveUpdates(_0x1a896e,_0x565e88){return function(_0x5b3be1){if(_0x5b3be1){return _0x5b3be1['update'](_0x1a896e)[_0xd557('0x29')](function(_0x530f8e){return _0x530f8e;});}return null;};}function removeEntity(_0x1f9d55,_0x4fec06){return function(_0x4367fc){if(_0x4367fc){return _0x4367fc[_0xd557('0x2a')]()[_0xd557('0x29')](function(){_0x1f9d55[_0xd557('0x22')](0xcc)[_0xd557('0x21')]();});}};}function handleEntityNotFound(_0x5c2165,_0x5e490e){return function(_0x1f4acf){if(!_0x1f4acf){_0x5c2165[_0xd557('0x20')](0x194);}return _0x1f4acf;};}function handleError(_0x52644a,_0x378f61){_0x378f61=_0x378f61||0x1f4;return function(_0x2d3542){logger[_0xd557('0x1b')](_0x2d3542[_0xd557('0x2b')]);if(_0x2d3542[_0xd557('0x2c')]){delete _0x2d3542[_0xd557('0x2c')];}_0x52644a[_0xd557('0x22')](_0x378f61)[_0xd557('0x2d')](_0x2d3542);};}exports['index']=function(_0x54a72e,_0xb2b6b2){var _0x22c6cc={},_0x5705cd={},_0x2f816f={'count':0x0,'rows':[]};var _0x414b2c=db[_0xd557('0x2e')][_0xd557('0x2f')];_0x5705cd[_0xd557('0x30')]=_[_0xd557('0x31')](_0x414b2c);var _0x6c94e9={'dateStart':_0x54a72e[_0xd557('0x32')][_0xd557('0x33')],'dateEnd':_0x54a72e[_0xd557('0x32')][_0xd557('0x34')]};delete _0x54a72e['query'][_0xd557('0x33')];delete _0x54a72e[_0xd557('0x32')][_0xd557('0x34')];_0x5705cd[_0xd557('0x32')]=_['keys'](_0x54a72e[_0xd557('0x32')]);_0x5705cd[_0xd557('0x35')]=_[_0xd557('0x36')](_0x5705cd[_0xd557('0x30')],_0x5705cd[_0xd557('0x32')]);_0x22c6cc[_0xd557('0x37')]=_[_0xd557('0x36')](_0x5705cd[_0xd557('0x30')],qs[_0xd557('0x38')](_0x54a72e[_0xd557('0x32')]['fields']));_0x22c6cc[_0xd557('0x37')]=_0x22c6cc[_0xd557('0x37')][_0xd557('0x39')]?_0x22c6cc[_0xd557('0x37')]:_0x5705cd[_0xd557('0x30')];if(!_0x54a72e['query']['hasOwnProperty'](_0xd557('0x3a'))){_0x22c6cc[_0xd557('0x3b')]=qs['limit'](_0x54a72e['query'][_0xd557('0x3b')]);_0x22c6cc[_0xd557('0x24')]=qs[_0xd557('0x24')](_0x54a72e[_0xd557('0x32')]['offset']);}_0x22c6cc[_0xd557('0x3c')]=qs[_0xd557('0x3d')](_0x54a72e[_0xd557('0x32')][_0xd557('0x3d')]);_0x22c6cc['where']=qs['filters'](_[_0xd557('0x3e')](_0x54a72e[_0xd557('0x32')],_0x5705cd['filters']));if(_0x6c94e9[_0xd557('0x33')]){if(_0x6c94e9[_0xd557('0x34')]){_0x6c94e9[_0xd557('0x34')]=moment(_0x6c94e9[_0xd557('0x34')])['add'](0x1,'day');}else{_0x6c94e9['dateEnd']=moment(_0x6c94e9[_0xd557('0x33')])['add'](0x1,'day');}_[_0xd557('0x3f')](_0x22c6cc['where'],{'createdAt':{'$gte':_0x6c94e9[_0xd557('0x33')],'$lte':_0x6c94e9[_0xd557('0x34')]}});}if(_0x54a72e[_0xd557('0x32')][_0xd557('0x40')]){_0x22c6cc[_0xd557('0x41')]=_[_0xd557('0x3f')](_0x22c6cc[_0xd557('0x41')],{'$or':_[_0xd557('0x42')](_0x22c6cc[_0xd557('0x37')],function(_0x53d9d4){var _0x5eb3d3={};_0x5eb3d3[_0x53d9d4]={'$like':'%'+_0x54a72e[_0xd557('0x32')][_0xd557('0x40')]+'%'};return _0x5eb3d3;})});}_0x22c6cc=_[_0xd557('0x3f')]({},_0x22c6cc,_0x54a72e[_0xd557('0x43')]);var _0x674a50={'where':_0x22c6cc['where']};return db[_0xd557('0x2e')][_0xd557('0x23')](_0x674a50)[_0xd557('0x29')](function(_0x1cb995){_0x2f816f['count']=_0x1cb995;if(_0x54a72e[_0xd557('0x32')]['includeAll']){_0x22c6cc[_0xd557('0x44')]=[{'all':!![]}];}return db[_0xd557('0x2e')]['findAll'](_0x22c6cc);})[_0xd557('0x29')](function(_0x512c21){_0x2f816f[_0xd557('0x45')]=_0x512c21;return _0x2f816f;})[_0xd557('0x29')](respondWithFilteredResult(_0xb2b6b2,_0x22c6cc))[_0xd557('0x1f')](handleError(_0xb2b6b2,null));};exports[_0xd557('0x46')]=function(_0xefc8b3,_0x3203da){var _0x58da01={'raw':!![],'where':{'id':_0xefc8b3[_0xd557('0x47')]['id']}},_0x3824fa={};_0x3824fa[_0xd557('0x30')]=_[_0xd557('0x31')](db[_0xd557('0x2e')][_0xd557('0x2f')]);_0x3824fa['query']=_['keys'](_0xefc8b3[_0xd557('0x32')]);_0x3824fa[_0xd557('0x35')]=_[_0xd557('0x36')](_0x3824fa[_0xd557('0x30')],_0x3824fa['query']);_0x58da01[_0xd557('0x37')]=_['intersection'](_0x3824fa[_0xd557('0x30')],qs[_0xd557('0x38')](_0xefc8b3[_0xd557('0x32')][_0xd557('0x38')]));_0x58da01[_0xd557('0x37')]=_0x58da01[_0xd557('0x37')][_0xd557('0x39')]?_0x58da01[_0xd557('0x37')]:_0x3824fa[_0xd557('0x30')];if(_0xefc8b3[_0xd557('0x32')][_0xd557('0x48')]){_0x58da01['include']=[{'all':!![]}];}_0x58da01=_[_0xd557('0x3f')]({},_0x58da01,_0xefc8b3[_0xd557('0x43')]);return db['ChatQueue']['find'](_0x58da01)[_0xd557('0x29')](handleEntityNotFound(_0x3203da,null))[_0xd557('0x29')](respondWithResult(_0x3203da,null))[_0xd557('0x1f')](handleError(_0x3203da,null));};exports[_0xd557('0x49')]=function(_0x533ba1,_0x4374c9){return db[_0xd557('0x2e')]['create'](_0x533ba1[_0xd557('0x4a')],{})[_0xd557('0x29')](respondWithResult(_0x4374c9,0xc9))[_0xd557('0x1f')](handleError(_0x4374c9,null));};exports[_0xd557('0x4b')]=function(_0x28cb61,_0x538166){if(_0x28cb61[_0xd557('0x4a')]['id']){delete _0x28cb61['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x28cb61[_0xd557('0x47')]['id']}})['then'](handleEntityNotFound(_0x538166,null))[_0xd557('0x29')](saveUpdates(_0x28cb61[_0xd557('0x4a')],null))[_0xd557('0x29')](respondWithResult(_0x538166,null))[_0xd557('0x1f')](handleError(_0x538166,null));};exports[_0xd557('0x2a')]=function(_0x3d9063,_0x5b0790){return db['ChatQueue'][_0xd557('0x4c')]({'where':{'id':_0x3d9063[_0xd557('0x47')]['id']}})[_0xd557('0x29')](handleEntityNotFound(_0x5b0790,null))['then'](removeEntity(_0x5b0790,null))[_0xd557('0x1f')](handleError(_0x5b0790,null));};exports[_0xd557('0x4d')]=function(_0x3fafc0,_0x3d0a23){return db[_0xd557('0x2e')][_0xd557('0x4d')]()[_0xd557('0x29')](respondWithResult(_0x3d0a23,null))[_0xd557('0x1f')](handleError(_0x3d0a23,null));};exports['getMembers']=function(_0x18d40c,_0x5a3c4a,_0x474926){var _0x3ccee0={'raw':!![],'where':{}},_0x7ccda3={},_0x44252b;return db['ChatQueue'][_0xd557('0x4e')]({'where':{'id':_0x18d40c[_0xd557('0x47')]['id']}})[_0xd557('0x29')](handleEntityNotFound(_0x5a3c4a,null))['then'](function(_0x21918f){if(_0x21918f){_0x44252b=_0x21918f['get']({'plain':!![]});_0x7ccda3['model']=_[_0xd557('0x31')](db['UserChatQueue'][_0xd557('0x2f')]);_0x7ccda3['query']=_[_0xd557('0x31')](_0x18d40c[_0xd557('0x32')]);_0x7ccda3['filters']=_[_0xd557('0x36')](_0x7ccda3[_0xd557('0x30')],_0x7ccda3[_0xd557('0x32')]);_0x3ccee0['attributes']=_[_0xd557('0x36')](_0x7ccda3['model'],qs[_0xd557('0x38')](_0x18d40c[_0xd557('0x32')][_0xd557('0x38')]));_0x3ccee0[_0xd557('0x37')]=_0x3ccee0[_0xd557('0x37')][_0xd557('0x39')]?_0x3ccee0['attributes']:_0x7ccda3[_0xd557('0x30')];if(!_0x18d40c[_0xd557('0x32')][_0xd557('0x4f')](_0xd557('0x3a'))){_0x3ccee0[_0xd557('0x3b')]=qs['limit'](_0x18d40c[_0xd557('0x32')]['limit']);_0x3ccee0['offset']=qs['offset'](_0x18d40c[_0xd557('0x32')]['offset']);}_0x3ccee0[_0xd557('0x3c')]=qs[_0xd557('0x3d')](_0x18d40c[_0xd557('0x32')]['sort']);_0x3ccee0[_0xd557('0x41')]=qs[_0xd557('0x35')](_[_0xd557('0x3e')](_0x18d40c[_0xd557('0x32')],_0x7ccda3[_0xd557('0x35')]));_0x3ccee0[_0xd557('0x41')][_0xd557('0x50')]=_0x21918f['id'];if(_0x18d40c[_0xd557('0x32')][_0xd557('0x40')]){_0x3ccee0[_0xd557('0x41')]=_[_0xd557('0x3f')](_0x3ccee0['where'],{'$or':_[_0xd557('0x42')](_0x3ccee0[_0xd557('0x37')],function(_0x457917){var _0x321c82={};_0x321c82[_0x457917]={'$like':'%'+_0x18d40c[_0xd557('0x32')][_0xd557('0x40')]+'%'};return _0x321c82;})});}_0x3ccee0=_[_0xd557('0x3f')]({},_0x3ccee0,_0x18d40c[_0xd557('0x43')]);return db[_0xd557('0x51')][_0xd557('0x52')](_0x3ccee0);}})[_0xd557('0x29')](function(_0x116479){if(_0x116479){return db[_0xd557('0x53')][_0xd557('0x54')]({'where':{'id':_[_0xd557('0x42')](_0x116479,_0xd557('0x55')),'role':_0xd557('0x56')},'attributes':['id',_0xd557('0x2c'),_0xd557('0x57'),_0xd557('0x58'),'createdAt']});}})[_0xd557('0x29')](function(_0x41028b){if(_0x41028b){return{'count':_0x41028b[_0xd557('0x23')],'rows':_[_0xd557('0x42')](_0x41028b['rows'],function(_0x10d34d){return{'membername':_0x10d34d[_0xd557('0x2c')],'UserId':_0x10d34d['id'],'queue_name':_0x44252b[_0xd557('0x2c')],'ChatQueueId':_0x44252b['id'],'interface':util['format'](_0xd557('0x59'),_0xd557('0x5a'),_0x10d34d[_0xd557('0x2c')]),'penalty':0x0,'paused':_0x10d34d['chatPause'],'createdAt':_0x10d34d['createdAt'],'updatedAt':_0x10d34d[_0xd557('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5a3c4a,_0x3ccee0))['catch'](handleError(_0x5a3c4a,null));};exports['getTeams']=function(_0x4da225,_0x5eef96,_0x3f57b7){var _0x382c6f={};var _0x1f4178={};var _0xd0502e;var _0x595a5b;return db[_0xd557('0x2e')]['findOne']({'where':{'id':_0x4da225[_0xd557('0x47')]['id']}})[_0xd557('0x29')](handleEntityNotFound(_0x5eef96,null))['then'](function(_0x19e42a){if(_0x19e42a){_0xd0502e=_0x19e42a;_0x1f4178[_0xd557('0x30')]=_[_0xd557('0x31')](db[_0xd557('0x5b')]['rawAttributes']);_0x1f4178[_0xd557('0x32')]=_[_0xd557('0x31')](_0x4da225[_0xd557('0x32')]);_0x1f4178[_0xd557('0x35')]=_[_0xd557('0x36')](_0x1f4178[_0xd557('0x30')],_0x1f4178[_0xd557('0x32')]);_0x382c6f[_0xd557('0x37')]=_[_0xd557('0x36')](_0x1f4178['model'],qs['fields'](_0x4da225[_0xd557('0x32')]['fields']));_0x382c6f[_0xd557('0x37')]=_0x382c6f['attributes'][_0xd557('0x39')]?_0x382c6f['attributes']:_0x1f4178[_0xd557('0x30')];_0x382c6f[_0xd557('0x3c')]=qs[_0xd557('0x3d')](_0x4da225['query'][_0xd557('0x3d')]);_0x382c6f[_0xd557('0x41')]=qs[_0xd557('0x35')](_[_0xd557('0x3e')](_0x4da225[_0xd557('0x32')],_0x1f4178[_0xd557('0x35')]));if(_0x4da225['query']['filter']){_0x382c6f[_0xd557('0x41')]=_[_0xd557('0x3f')](_0x382c6f[_0xd557('0x41')],{'$or':_[_0xd557('0x42')](_0x382c6f[_0xd557('0x37')],function(_0x4d74a9){var _0x51daba={};_0x51daba[_0x4d74a9]={'$like':'%'+_0x4da225[_0xd557('0x32')][_0xd557('0x40')]+'%'};return _0x51daba;})});}_0x382c6f=_[_0xd557('0x3f')]({},_0x382c6f,_0x4da225[_0xd557('0x43')]);return _0xd0502e[_0xd557('0x5c')](_0x382c6f);}})[_0xd557('0x29')](function(_0x167c88){if(_0x167c88){_0x595a5b=_0x167c88[_0xd557('0x39')];if(!_0x4da225['query'][_0xd557('0x4f')](_0xd557('0x3a'))){_0x382c6f[_0xd557('0x3b')]=qs[_0xd557('0x3b')](_0x4da225[_0xd557('0x32')]['limit']);_0x382c6f[_0xd557('0x24')]=qs['offset'](_0x4da225[_0xd557('0x32')][_0xd557('0x24')]);}return _0xd0502e[_0xd557('0x5c')](_0x382c6f);}})['then'](function(_0x35db48){if(_0x35db48){return _0x35db48?{'count':_0x595a5b,'rows':_0x35db48}:null;}})[_0xd557('0x29')](respondWithResult(_0x5eef96,null))[_0xd557('0x1f')](handleError(_0x5eef96,null));};exports['addTeams']=function(_0x8d329b,_0x4f9705,_0x96a53c){var _0x3c6d9d=[];var _0x2e897a;return db[_0xd557('0x5b')][_0xd557('0x52')]({'where':{'id':_0x8d329b['body']['ids']},'attributes':['id'],'include':[{'model':db[_0xd557('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd557('0x29')](function(_0x30776f){if(_0x30776f){for(var _0x3fd727=0x0;_0x3fd727<_0x30776f[_0xd557('0x39')];_0x3fd727+=0x1){for(var _0x30abb4=0x0;_0x30abb4<_0x30776f[_0x3fd727][_0xd557('0x5d')][_0xd557('0x39')];_0x30abb4+=0x1){_0x3c6d9d=_[_0xd557('0x5e')](_0x3c6d9d,[_0x30776f[_0x3fd727]['Agents'][_0x30abb4]['id']]);}}return _0x3c6d9d;}})['then'](function(_0x32ca0b){if(_0x32ca0b){return db[_0xd557('0x2e')][_0xd557('0x4c')]({'where':{'id':_0x8d329b[_0xd557('0x47')]['id']}});}})[_0xd557('0x29')](function(_0x235f67){if(_0x235f67){_0x2e897a=_0x235f67;return _0x2e897a['addAgents'](_0x3c6d9d,{'penalty':_0x8d329b[_0xd557('0x4a')]['penalty']});}})[_0xd557('0x29')](function(_0x51e6de){if(_0x51e6de){return _0x2e897a[_0xd557('0x5f')](_0x8d329b[_0xd557('0x4a')][_0xd557('0x60')]);}})['then'](handleEntityNotFound(_0x4f9705,null))[_0xd557('0x29')](respondWithStatusCode(_0x4f9705,null))[_0xd557('0x1f')](handleError(_0x4f9705,null));};exports[_0xd557('0x61')]=function(_0x1d1371,_0x5733ae,_0x59ff61){var _0x9d1f99=[];var _0x490b2c;return db[_0xd557('0x5b')][_0xd557('0x52')]({'where':{'id':_0x1d1371[_0xd557('0x32')][_0xd557('0x60')]},'attributes':['id'],'include':[{'model':db[_0xd557('0x53')],'as':_0xd557('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xd557('0x29')](function(_0x1ffc92){if(_0x1ffc92){for(var _0x2c8e49=0x0;_0x2c8e49<_0x1ffc92[_0xd557('0x39')];_0x2c8e49+=0x1){for(var _0x53b277=0x0;_0x53b277<_0x1ffc92[_0x2c8e49][_0xd557('0x5d')]['length'];_0x53b277+=0x1){_0x9d1f99=_[_0xd557('0x5e')](_0x9d1f99,[_0x1ffc92[_0x2c8e49][_0xd557('0x5d')][_0x53b277]['id']]);}}return _0x9d1f99;}})[_0xd557('0x29')](function(_0x4412a4){if(_0x4412a4){return db[_0xd557('0x2e')][_0xd557('0x4c')]({'where':{'id':_0x1d1371[_0xd557('0x47')]['id']}});}})[_0xd557('0x29')](function(_0x9d59fc){if(_0x9d59fc){_0x490b2c=_0x9d59fc;return _0x490b2c['removeAgents'](_0x9d1f99);}})[_0xd557('0x29')](function(_0x105e03){if(_0x490b2c){return _0x490b2c[_0xd557('0x61')](_0x1d1371[_0xd557('0x32')][_0xd557('0x60')]);}})['then'](handleEntityNotFound(_0x5733ae,null))[_0xd557('0x29')](respondWithStatusCode(_0x5733ae,null))[_0xd557('0x1f')](handleError(_0x5733ae,null));};exports[_0xd557('0x62')]=function(_0xeeee17,_0x195df5,_0x152c00){return db[_0xd557('0x2e')][_0xd557('0x4c')]({'where':{'id':_0xeeee17['params']['id']}})[_0xd557('0x29')](handleEntityNotFound(_0x195df5,null))[_0xd557('0x29')](function(_0x38ab7b){if(_0x38ab7b){return _0x38ab7b[_0xd557('0x62')](_0xeeee17['body'][_0xd557('0x60')],_[_0xd557('0x63')](_0xeeee17[_0xd557('0x4a')],['ids','id'])||{})[_0xd557('0x64')](function(_0x3773cd){for(var _0x5063c9=0x0;_0x5063c9<_0xeeee17[_0xd557('0x4a')][_0xd557('0x60')][_0xd557('0x39')];_0x5063c9+=0x1){socket[_0xd557('0x65')]('userChatQueue:save',{'UserId':_0xeeee17['body'][_0xd557('0x60')][_0x5063c9],'ChatQueueId':_0xeeee17['params']['id']});}return _0x3773cd;});}})[_0xd557('0x29')](respondWithResult(_0x195df5,null))[_0xd557('0x1f')](handleError(_0x195df5,null));};exports[_0xd557('0x66')]=function(_0x39b646,_0x3599fa,_0x2f62a2){var _0x4bcd93;return db['ChatQueue'][_0xd557('0x4c')]({'where':{'id':_0x39b646[_0xd557('0x47')]['id']}})[_0xd557('0x29')](handleEntityNotFound(_0x3599fa,null))[_0xd557('0x29')](function(_0x2daa49){if(_0x2daa49){return _0x2daa49[_0xd557('0x66')](_0x39b646['query'][_0xd557('0x60')])['then'](function(_0x3bfdd9){if(_[_0xd557('0x67')](_0x39b646['query'][_0xd557('0x60')])){for(var _0x5a04e6=0x0;_0x5a04e6<_0x39b646['query'][_0xd557('0x60')][_0xd557('0x39')];_0x5a04e6+=0x1){socket['emit'](_0xd557('0x68'),{'UserId':_0x39b646[_0xd557('0x32')]['ids'][_0x5a04e6],'ChatQueueId':_0x39b646[_0xd557('0x47')]['id']});}}else{socket[_0xd557('0x65')](_0xd557('0x68'),{'UserId':_0x39b646[_0xd557('0x32')][_0xd557('0x60')],'ChatQueueId':_0x39b646[_0xd557('0x47')]['id']});}});}})[_0xd557('0x29')](respondWithStatusCode(_0x3599fa,null))[_0xd557('0x1f')](handleError(_0x3599fa,null));};exports['getAgents']=function(_0x431879,_0x2f8358,_0x2b0ecf){var _0x1d252b={};var _0x588624={};var _0x41c646;var _0x5324e9;return db[_0xd557('0x2e')][_0xd557('0x4e')]({'where':{'id':_0x431879[_0xd557('0x47')]['id']}})[_0xd557('0x29')](handleEntityNotFound(_0x2f8358,null))[_0xd557('0x29')](function(_0x53ad25){if(_0x53ad25){_0x41c646=_0x53ad25;_0x588624['model']=_[_0xd557('0x31')](db[_0xd557('0x53')]['rawAttributes']);_0x588624[_0xd557('0x32')]=_[_0xd557('0x31')](_0x431879['query']);_0x588624[_0xd557('0x35')]=_[_0xd557('0x36')](_0x588624[_0xd557('0x30')],_0x588624[_0xd557('0x32')]);_0x1d252b['attributes']=_[_0xd557('0x36')](_0x588624[_0xd557('0x30')],qs[_0xd557('0x38')](_0x431879[_0xd557('0x32')][_0xd557('0x38')]));_0x1d252b[_0xd557('0x37')]=_0x1d252b[_0xd557('0x37')][_0xd557('0x39')]?_0x1d252b['attributes']:_0x588624['model'];_0x1d252b[_0xd557('0x3c')]=qs['sort'](_0x431879[_0xd557('0x32')][_0xd557('0x3d')]);_0x1d252b[_0xd557('0x41')]=qs[_0xd557('0x35')](_['pick'](_0x431879[_0xd557('0x32')],_0x588624['filters']));if(_0x431879[_0xd557('0x32')][_0xd557('0x40')]){_0x1d252b['where']=_['merge'](_0x1d252b[_0xd557('0x41')],{'$or':_[_0xd557('0x42')](_0x1d252b[_0xd557('0x37')],function(_0x465321){var _0xb600c1={};_0xb600c1[_0x465321]={'$like':'%'+_0x431879[_0xd557('0x32')][_0xd557('0x40')]+'%'};return _0xb600c1;})});}_0x1d252b=_['merge']({},_0x1d252b,_0x431879[_0xd557('0x43')]);return _0x41c646[_0xd557('0x69')](_0x1d252b);}})[_0xd557('0x29')](function(_0x2759b3){if(_0x2759b3){_0x5324e9=_0x2759b3[_0xd557('0x39')];if(!_0x431879[_0xd557('0x32')]['hasOwnProperty'](_0xd557('0x3a'))){_0x1d252b[_0xd557('0x3b')]=qs[_0xd557('0x3b')](_0x431879['query'][_0xd557('0x3b')]);_0x1d252b['offset']=qs[_0xd557('0x24')](_0x431879[_0xd557('0x32')]['offset']);}return _0x41c646[_0xd557('0x69')](_0x1d252b);}})[_0xd557('0x29')](function(_0x15cbd3){if(_0x15cbd3){return _0x15cbd3?{'count':_0x5324e9,'rows':_0x15cbd3}:null;}})[_0xd557('0x29')](respondWithResult(_0x2f8358,null))[_0xd557('0x1f')](handleError(_0x2f8358,null));}; \ No newline at end of file +var _0x1789=['findOne','get','UserChatQueue','ChatQueueId','map','findAll','User','findAndCountAll','UserId','agent','chatPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','union','removeTeams','removeAgents','addAgents','omit','emit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../mysqldb','socket.io-emitter','localhost','./chatQueue.socket','jayson/promise','client','request','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','ChatQueue','keys','dateStart','query','dateEnd','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','add','merge','where','filter','include','rows','show','params','rawAttributes','includeAll','options','find','create','body','describe','getMembers'];(function(_0x5c13d9,_0x443930){var _0x4b3a34=function(_0xc12a1){while(--_0xc12a1){_0x5c13d9['push'](_0x5c13d9['shift']());}};_0x4b3a34(++_0x443930);}(_0x1789,0x92));var _0x9178=function(_0x24721a,_0x1ac53c){_0x24721a=_0x24721a-0x0;var _0x6a9880=_0x1789[_0x24721a];return _0x6a9880;};'use strict';var jsonpatch=require(_0x9178('0x0'));var rp=require(_0x9178('0x1'));var moment=require(_0x9178('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9178('0x3'));var util=require(_0x9178('0x4'));var path=require(_0x9178('0x5'));var sox=require(_0x9178('0x6'));var csv=require(_0x9178('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9178('0x8'));var crypto=require(_0x9178('0x9'));var jsforce=require(_0x9178('0xa'));var deskjs=require(_0x9178('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9178('0xc'));var Papa=require(_0x9178('0xd'));var qs=require(_0x9178('0xe'));var logger=require(_0x9178('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9178('0x10'))['db'];var socket=require(_0x9178('0x11'))({'host':_0x9178('0x12'),'port':0x18eb});require(_0x9178('0x13'))['register'](socket);var jayson=require(_0x9178('0x14'));var client=jayson[_0x9178('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50ea8c,_0x5b3737,_0x1400a4,_0x321d98){return new BPromise(function(_0x593e69,_0x254281){var _0x1113a6=_0x321d98||client;return _0x1113a6[_0x9178('0x16')](_0x50ea8c,_0x1400a4)['then'](function(_0x2daff3){logger[_0x9178('0x17')]('ChatQueue,\x20%s,\x20%s',_0x5b3737,_0x9178('0x18'));logger['debug'](_0x9178('0x19'),_0x5b3737,_0x9178('0x18'),JSON[_0x9178('0x1a')](_0x2daff3));if(_0x2daff3[_0x9178('0x1b')]){if(_0x2daff3[_0x9178('0x1b')][_0x9178('0x1c')]===0x1f4){logger[_0x9178('0x1b')](_0x9178('0x1d'),_0x5b3737,_0x2daff3[_0x9178('0x1b')][_0x9178('0x1e')]);return _0x254281(_0x2daff3[_0x9178('0x1b')][_0x9178('0x1e')]);}logger[_0x9178('0x1b')](_0x9178('0x1d'),_0x5b3737,_0x2daff3['error'][_0x9178('0x1e')]);return _0x593e69(_0x2daff3[_0x9178('0x1b')]['message']);}else{logger[_0x9178('0x17')]('ChatQueue,\x20%s,\x20%s',_0x5b3737,_0x9178('0x18'));_0x593e69(_0x2daff3[_0x9178('0x1f')][_0x9178('0x1e')]);}})[_0x9178('0x20')](function(_0x3f570b){logger[_0x9178('0x1b')](_0x9178('0x1d'),_0x5b3737,_0x3f570b);_0x254281(_0x3f570b);});});}function respondWithStatusCode(_0x4c13cf,_0x48e47b){_0x48e47b=_0x48e47b||0xcc;return function(_0x428118){if(_0x428118){return _0x4c13cf['sendStatus'](_0x48e47b);}return _0x4c13cf['status'](_0x48e47b)[_0x9178('0x21')]();};}function respondWithResult(_0x19aafe,_0x15471a){_0x15471a=_0x15471a||0xc8;return function(_0x411006){if(_0x411006){return _0x19aafe[_0x9178('0x22')](_0x15471a)[_0x9178('0x23')](_0x411006);}};}function respondWithFilteredResult(_0x4115ad,_0x23c04a){return function(_0x1b39c5){if(_0x1b39c5){var _0x2114ec=_0x1b39c5[_0x9178('0x24')],_0x16cebe=_0x23c04a['offset'],_0x1b3cc7=_0x23c04a[_0x9178('0x25')]+_0x23c04a[_0x9178('0x26')],_0x3dccbf;if(_0x1b3cc7>=_0x2114ec){_0x1b3cc7=_0x2114ec;_0x3dccbf=0xc8;}else{_0x3dccbf=0xce;}_0x4115ad['status'](_0x3dccbf);return _0x4115ad[_0x9178('0x27')](_0x9178('0x28'),_0x16cebe+'-'+_0x1b3cc7+'/'+_0x2114ec)[_0x9178('0x23')](_0x1b39c5);}return null;};}function patchUpdates(_0x2b977b){return function(_0x23e54c){try{jsonpatch[_0x9178('0x29')](_0x23e54c,_0x2b977b,!![]);}catch(_0x5d9747){return BPromise[_0x9178('0x2a')](_0x5d9747);}return _0x23e54c[_0x9178('0x2b')]();};}function saveUpdates(_0x553a32,_0x20263c){return function(_0x2f045c){if(_0x2f045c){return _0x2f045c[_0x9178('0x2c')](_0x553a32)[_0x9178('0x2d')](function(_0x403f4d){return _0x403f4d;});}return null;};}function removeEntity(_0x30b8fc,_0x40261d){return function(_0x5ca420){if(_0x5ca420){return _0x5ca420[_0x9178('0x2e')]()['then'](function(){_0x30b8fc[_0x9178('0x22')](0xcc)[_0x9178('0x21')]();});}};}function handleEntityNotFound(_0x499156,_0xb8681){return function(_0x31e3ba){if(!_0x31e3ba){_0x499156[_0x9178('0x2f')](0x194);}return _0x31e3ba;};}function handleError(_0xacff1,_0x55a3c4){_0x55a3c4=_0x55a3c4||0x1f4;return function(_0x1f3248){logger[_0x9178('0x1b')](_0x1f3248[_0x9178('0x30')]);if(_0x1f3248[_0x9178('0x31')]){delete _0x1f3248[_0x9178('0x31')];}_0xacff1[_0x9178('0x22')](_0x55a3c4)[_0x9178('0x32')](_0x1f3248);};}exports[_0x9178('0x33')]=function(_0x5ac1ae,_0xcdf5fa){var _0x41b4e7={},_0x53bd6a={},_0x1727aa={'count':0x0,'rows':[]};var _0x4e6eff=db[_0x9178('0x34')]['rawAttributes'];_0x53bd6a['model']=_[_0x9178('0x35')](_0x4e6eff);var _0x33c4ab={'dateStart':_0x5ac1ae['query'][_0x9178('0x36')],'dateEnd':_0x5ac1ae[_0x9178('0x37')]['dateEnd']};delete _0x5ac1ae['query'][_0x9178('0x36')];delete _0x5ac1ae[_0x9178('0x37')][_0x9178('0x38')];_0x53bd6a[_0x9178('0x37')]=_['keys'](_0x5ac1ae['query']);_0x53bd6a[_0x9178('0x39')]=_['intersection'](_0x53bd6a['model'],_0x53bd6a[_0x9178('0x37')]);_0x41b4e7[_0x9178('0x3a')]=_[_0x9178('0x3b')](_0x53bd6a['model'],qs[_0x9178('0x3c')](_0x5ac1ae[_0x9178('0x37')][_0x9178('0x3c')]));_0x41b4e7['attributes']=_0x41b4e7[_0x9178('0x3a')][_0x9178('0x3d')]?_0x41b4e7[_0x9178('0x3a')]:_0x53bd6a[_0x9178('0x3e')];if(!_0x5ac1ae[_0x9178('0x37')][_0x9178('0x3f')](_0x9178('0x40'))){_0x41b4e7['limit']=qs[_0x9178('0x26')](_0x5ac1ae[_0x9178('0x37')][_0x9178('0x26')]);_0x41b4e7[_0x9178('0x25')]=qs['offset'](_0x5ac1ae[_0x9178('0x37')][_0x9178('0x25')]);}_0x41b4e7[_0x9178('0x41')]=qs[_0x9178('0x42')](_0x5ac1ae['query'][_0x9178('0x42')]);_0x41b4e7['where']=qs['filters'](_[_0x9178('0x43')](_0x5ac1ae[_0x9178('0x37')],_0x53bd6a[_0x9178('0x39')]));if(_0x33c4ab[_0x9178('0x36')]){if(_0x33c4ab['dateEnd']){_0x33c4ab[_0x9178('0x38')]=moment(_0x33c4ab[_0x9178('0x38')])[_0x9178('0x44')](0x1,'day');}else{_0x33c4ab[_0x9178('0x38')]=moment(_0x33c4ab[_0x9178('0x36')])[_0x9178('0x44')](0x1,'day');}_[_0x9178('0x45')](_0x41b4e7[_0x9178('0x46')],{'createdAt':{'$gte':_0x33c4ab[_0x9178('0x36')],'$lte':_0x33c4ab['dateEnd']}});}if(_0x5ac1ae[_0x9178('0x37')][_0x9178('0x47')]){_0x41b4e7['where']=_[_0x9178('0x45')](_0x41b4e7[_0x9178('0x46')],{'$or':_['map'](_0x41b4e7[_0x9178('0x3a')],function(_0x4062b5){var _0x3c5125={};_0x3c5125[_0x4062b5]={'$like':'%'+_0x5ac1ae['query']['filter']+'%'};return _0x3c5125;})});}_0x41b4e7=_[_0x9178('0x45')]({},_0x41b4e7,_0x5ac1ae['options']);var _0x3ae3a9={'where':_0x41b4e7[_0x9178('0x46')]};return db[_0x9178('0x34')][_0x9178('0x24')](_0x3ae3a9)[_0x9178('0x2d')](function(_0x5ec980){_0x1727aa[_0x9178('0x24')]=_0x5ec980;if(_0x5ac1ae[_0x9178('0x37')]['includeAll']){_0x41b4e7[_0x9178('0x48')]=[{'all':!![]}];}return db[_0x9178('0x34')]['findAll'](_0x41b4e7);})[_0x9178('0x2d')](function(_0x4d5496){_0x1727aa[_0x9178('0x49')]=_0x4d5496;return _0x1727aa;})[_0x9178('0x2d')](respondWithFilteredResult(_0xcdf5fa,_0x41b4e7))[_0x9178('0x20')](handleError(_0xcdf5fa,null));};exports[_0x9178('0x4a')]=function(_0x179b89,_0xbf647b){var _0x5701ca={'raw':!![],'where':{'id':_0x179b89[_0x9178('0x4b')]['id']}},_0xd7dd57={};_0xd7dd57[_0x9178('0x3e')]=_[_0x9178('0x35')](db[_0x9178('0x34')][_0x9178('0x4c')]);_0xd7dd57[_0x9178('0x37')]=_[_0x9178('0x35')](_0x179b89[_0x9178('0x37')]);_0xd7dd57[_0x9178('0x39')]=_['intersection'](_0xd7dd57[_0x9178('0x3e')],_0xd7dd57[_0x9178('0x37')]);_0x5701ca[_0x9178('0x3a')]=_[_0x9178('0x3b')](_0xd7dd57[_0x9178('0x3e')],qs[_0x9178('0x3c')](_0x179b89[_0x9178('0x37')]['fields']));_0x5701ca[_0x9178('0x3a')]=_0x5701ca[_0x9178('0x3a')][_0x9178('0x3d')]?_0x5701ca[_0x9178('0x3a')]:_0xd7dd57['model'];if(_0x179b89[_0x9178('0x37')][_0x9178('0x4d')]){_0x5701ca[_0x9178('0x48')]=[{'all':!![]}];}_0x5701ca=_['merge']({},_0x5701ca,_0x179b89[_0x9178('0x4e')]);return db[_0x9178('0x34')][_0x9178('0x4f')](_0x5701ca)[_0x9178('0x2d')](handleEntityNotFound(_0xbf647b,null))[_0x9178('0x2d')](respondWithResult(_0xbf647b,null))[_0x9178('0x20')](handleError(_0xbf647b,null));};exports['create']=function(_0x498902,_0x8581f1){return db[_0x9178('0x34')][_0x9178('0x50')](_0x498902[_0x9178('0x51')],{})[_0x9178('0x2d')](respondWithResult(_0x8581f1,0xc9))[_0x9178('0x20')](handleError(_0x8581f1,null));};exports[_0x9178('0x2c')]=function(_0x3fe618,_0x1c8bf7){if(_0x3fe618[_0x9178('0x51')]['id']){delete _0x3fe618[_0x9178('0x51')]['id'];}return db[_0x9178('0x34')][_0x9178('0x4f')]({'where':{'id':_0x3fe618['params']['id']}})[_0x9178('0x2d')](handleEntityNotFound(_0x1c8bf7,null))['then'](saveUpdates(_0x3fe618[_0x9178('0x51')],null))['then'](respondWithResult(_0x1c8bf7,null))[_0x9178('0x20')](handleError(_0x1c8bf7,null));};exports['destroy']=function(_0x1ca6f3,_0x51ab26){return db['ChatQueue'][_0x9178('0x4f')]({'where':{'id':_0x1ca6f3[_0x9178('0x4b')]['id']}})[_0x9178('0x2d')](handleEntityNotFound(_0x51ab26,null))['then'](removeEntity(_0x51ab26,null))[_0x9178('0x20')](handleError(_0x51ab26,null));};exports[_0x9178('0x52')]=function(_0x427dda,_0x4c4fba){return db[_0x9178('0x34')][_0x9178('0x52')]()[_0x9178('0x2d')](respondWithResult(_0x4c4fba,null))[_0x9178('0x20')](handleError(_0x4c4fba,null));};exports[_0x9178('0x53')]=function(_0x39dfbd,_0x4f99f2,_0x1e2acc){var _0x3985f5={'raw':!![],'where':{}},_0x26ae3d={},_0x4faed1;return db['ChatQueue'][_0x9178('0x54')]({'where':{'id':_0x39dfbd[_0x9178('0x4b')]['id']}})[_0x9178('0x2d')](handleEntityNotFound(_0x4f99f2,null))['then'](function(_0x4357e7){if(_0x4357e7){_0x4faed1=_0x4357e7[_0x9178('0x55')]({'plain':!![]});_0x26ae3d[_0x9178('0x3e')]=_['keys'](db[_0x9178('0x56')][_0x9178('0x4c')]);_0x26ae3d['query']=_[_0x9178('0x35')](_0x39dfbd[_0x9178('0x37')]);_0x26ae3d[_0x9178('0x39')]=_['intersection'](_0x26ae3d['model'],_0x26ae3d[_0x9178('0x37')]);_0x3985f5[_0x9178('0x3a')]=_['intersection'](_0x26ae3d[_0x9178('0x3e')],qs[_0x9178('0x3c')](_0x39dfbd[_0x9178('0x37')]['fields']));_0x3985f5['attributes']=_0x3985f5[_0x9178('0x3a')]['length']?_0x3985f5['attributes']:_0x26ae3d['model'];if(!_0x39dfbd[_0x9178('0x37')][_0x9178('0x3f')](_0x9178('0x40'))){_0x3985f5['limit']=qs[_0x9178('0x26')](_0x39dfbd[_0x9178('0x37')][_0x9178('0x26')]);_0x3985f5[_0x9178('0x25')]=qs[_0x9178('0x25')](_0x39dfbd[_0x9178('0x37')][_0x9178('0x25')]);}_0x3985f5[_0x9178('0x41')]=qs['sort'](_0x39dfbd[_0x9178('0x37')][_0x9178('0x42')]);_0x3985f5[_0x9178('0x46')]=qs[_0x9178('0x39')](_[_0x9178('0x43')](_0x39dfbd[_0x9178('0x37')],_0x26ae3d['filters']));_0x3985f5['where'][_0x9178('0x57')]=_0x4357e7['id'];if(_0x39dfbd['query']['filter']){_0x3985f5[_0x9178('0x46')]=_[_0x9178('0x45')](_0x3985f5[_0x9178('0x46')],{'$or':_[_0x9178('0x58')](_0x3985f5[_0x9178('0x3a')],function(_0x490051){var _0x16a435={};_0x16a435[_0x490051]={'$like':'%'+_0x39dfbd[_0x9178('0x37')][_0x9178('0x47')]+'%'};return _0x16a435;})});}_0x3985f5=_[_0x9178('0x45')]({},_0x3985f5,_0x39dfbd[_0x9178('0x4e')]);return db['UserChatQueue'][_0x9178('0x59')](_0x3985f5);}})['then'](function(_0x4c60b7){if(_0x4c60b7){return db[_0x9178('0x5a')][_0x9178('0x5b')]({'where':{'id':_['map'](_0x4c60b7,_0x9178('0x5c')),'role':_0x9178('0x5d')},'attributes':['id',_0x9178('0x31'),_0x9178('0x5e'),'updatedAt','createdAt']});}})[_0x9178('0x2d')](function(_0x1b0b98){if(_0x1b0b98){return{'count':_0x1b0b98[_0x9178('0x24')],'rows':_[_0x9178('0x58')](_0x1b0b98['rows'],function(_0x419fe1){return{'membername':_0x419fe1['name'],'UserId':_0x419fe1['id'],'queue_name':_0x4faed1[_0x9178('0x31')],'ChatQueueId':_0x4faed1['id'],'interface':util[_0x9178('0x5f')](_0x9178('0x60'),_0x9178('0x61'),_0x419fe1[_0x9178('0x31')]),'penalty':0x0,'paused':_0x419fe1[_0x9178('0x5e')],'createdAt':_0x419fe1[_0x9178('0x62')],'updatedAt':_0x419fe1[_0x9178('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4f99f2,_0x3985f5))['catch'](handleError(_0x4f99f2,null));};exports[_0x9178('0x64')]=function(_0x43d73e,_0x152304,_0x99c63f){var _0x1eab32={};var _0x27f711={};var _0x444bcd;var _0x198793;return db[_0x9178('0x34')][_0x9178('0x54')]({'where':{'id':_0x43d73e[_0x9178('0x4b')]['id']}})[_0x9178('0x2d')](handleEntityNotFound(_0x152304,null))[_0x9178('0x2d')](function(_0x1b7995){if(_0x1b7995){_0x444bcd=_0x1b7995;_0x27f711['model']=_['keys'](db[_0x9178('0x65')][_0x9178('0x4c')]);_0x27f711[_0x9178('0x37')]=_[_0x9178('0x35')](_0x43d73e['query']);_0x27f711[_0x9178('0x39')]=_[_0x9178('0x3b')](_0x27f711[_0x9178('0x3e')],_0x27f711[_0x9178('0x37')]);_0x1eab32[_0x9178('0x3a')]=_[_0x9178('0x3b')](_0x27f711[_0x9178('0x3e')],qs['fields'](_0x43d73e['query']['fields']));_0x1eab32[_0x9178('0x3a')]=_0x1eab32[_0x9178('0x3a')][_0x9178('0x3d')]?_0x1eab32['attributes']:_0x27f711[_0x9178('0x3e')];_0x1eab32[_0x9178('0x41')]=qs['sort'](_0x43d73e['query'][_0x9178('0x42')]);_0x1eab32[_0x9178('0x46')]=qs['filters'](_[_0x9178('0x43')](_0x43d73e[_0x9178('0x37')],_0x27f711['filters']));if(_0x43d73e[_0x9178('0x37')]['filter']){_0x1eab32['where']=_[_0x9178('0x45')](_0x1eab32[_0x9178('0x46')],{'$or':_[_0x9178('0x58')](_0x1eab32[_0x9178('0x3a')],function(_0x4a3652){var _0x28b1ee={};_0x28b1ee[_0x4a3652]={'$like':'%'+_0x43d73e[_0x9178('0x37')][_0x9178('0x47')]+'%'};return _0x28b1ee;})});}_0x1eab32=_[_0x9178('0x45')]({},_0x1eab32,_0x43d73e[_0x9178('0x4e')]);return _0x444bcd[_0x9178('0x64')](_0x1eab32);}})['then'](function(_0x3f17e1){if(_0x3f17e1){_0x198793=_0x3f17e1[_0x9178('0x3d')];if(!_0x43d73e['query']['hasOwnProperty'](_0x9178('0x40'))){_0x1eab32[_0x9178('0x26')]=qs[_0x9178('0x26')](_0x43d73e['query']['limit']);_0x1eab32[_0x9178('0x25')]=qs[_0x9178('0x25')](_0x43d73e[_0x9178('0x37')][_0x9178('0x25')]);}return _0x444bcd[_0x9178('0x64')](_0x1eab32);}})[_0x9178('0x2d')](function(_0x26d6c9){if(_0x26d6c9){return _0x26d6c9?{'count':_0x198793,'rows':_0x26d6c9}:null;}})['then'](respondWithResult(_0x152304,null))[_0x9178('0x20')](handleError(_0x152304,null));};exports[_0x9178('0x66')]=function(_0x266bd1,_0x47160d,_0x18358b){var _0x4ef8ec=[];var _0x4c62ff;return db['Team']['findAll']({'where':{'id':_0x266bd1[_0x9178('0x51')][_0x9178('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9178('0x68'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x10acdf){if(_0x10acdf){for(var _0xa73c85=0x0;_0xa73c85<_0x10acdf[_0x9178('0x3d')];_0xa73c85+=0x1){for(var _0x365dfc=0x0;_0x365dfc<_0x10acdf[_0xa73c85]['Agents'][_0x9178('0x3d')];_0x365dfc+=0x1){_0x4ef8ec=_[_0x9178('0x69')](_0x4ef8ec,[_0x10acdf[_0xa73c85][_0x9178('0x68')][_0x365dfc]['id']]);}}return _0x4ef8ec;}})[_0x9178('0x2d')](function(_0x3e996f){if(_0x3e996f){return db[_0x9178('0x34')][_0x9178('0x4f')]({'where':{'id':_0x266bd1[_0x9178('0x4b')]['id']}});}})[_0x9178('0x2d')](function(_0x1910a4){if(_0x1910a4){_0x4c62ff=_0x1910a4;return _0x4c62ff['addAgents'](_0x4ef8ec,{'penalty':_0x266bd1[_0x9178('0x51')]['penalty']});}})['then'](function(_0x13c1c3){if(_0x13c1c3){return _0x4c62ff[_0x9178('0x66')](_0x266bd1[_0x9178('0x51')][_0x9178('0x67')]);}})['then'](handleEntityNotFound(_0x47160d,null))[_0x9178('0x2d')](respondWithStatusCode(_0x47160d,null))[_0x9178('0x20')](handleError(_0x47160d,null));};exports[_0x9178('0x6a')]=function(_0x32a2e4,_0xbf6971,_0x2bee40){var _0x13fd3f=[];var _0x39bfed;return db['Team'][_0x9178('0x59')]({'where':{'id':_0x32a2e4['query'][_0x9178('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9178('0x68'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x483f85){if(_0x483f85){for(var _0x52dfab=0x0;_0x52dfab<_0x483f85[_0x9178('0x3d')];_0x52dfab+=0x1){for(var _0x5b9166=0x0;_0x5b9166<_0x483f85[_0x52dfab][_0x9178('0x68')]['length'];_0x5b9166+=0x1){_0x13fd3f=_[_0x9178('0x69')](_0x13fd3f,[_0x483f85[_0x52dfab][_0x9178('0x68')][_0x5b9166]['id']]);}}return _0x13fd3f;}})['then'](function(_0x3316cf){if(_0x3316cf){return db[_0x9178('0x34')]['find']({'where':{'id':_0x32a2e4[_0x9178('0x4b')]['id']}});}})[_0x9178('0x2d')](function(_0x12d929){if(_0x12d929){_0x39bfed=_0x12d929;return _0x39bfed[_0x9178('0x6b')](_0x13fd3f);}})['then'](function(_0x21c7f6){if(_0x39bfed){return _0x39bfed[_0x9178('0x6a')](_0x32a2e4[_0x9178('0x37')]['ids']);}})['then'](handleEntityNotFound(_0xbf6971,null))[_0x9178('0x2d')](respondWithStatusCode(_0xbf6971,null))['catch'](handleError(_0xbf6971,null));};exports[_0x9178('0x6c')]=function(_0x1c7ccf,_0x7e600b,_0x2bb3db){return db[_0x9178('0x34')]['find']({'where':{'id':_0x1c7ccf[_0x9178('0x4b')]['id']}})[_0x9178('0x2d')](handleEntityNotFound(_0x7e600b,null))[_0x9178('0x2d')](function(_0x4c225f){if(_0x4c225f){return _0x4c225f['addAgents'](_0x1c7ccf[_0x9178('0x51')][_0x9178('0x67')],_[_0x9178('0x6d')](_0x1c7ccf[_0x9178('0x51')],['ids','id'])||{})['spread'](function(_0xe64715){for(var _0x1329fc=0x0;_0x1329fc<_0x1c7ccf[_0x9178('0x51')]['ids']['length'];_0x1329fc+=0x1){socket[_0x9178('0x6e')](_0x9178('0x6f'),{'UserId':_0x1c7ccf[_0x9178('0x51')]['ids'][_0x1329fc],'ChatQueueId':_0x1c7ccf[_0x9178('0x4b')]['id']});}return _0xe64715;});}})[_0x9178('0x2d')](respondWithResult(_0x7e600b,null))[_0x9178('0x20')](handleError(_0x7e600b,null));};exports['removeAgents']=function(_0x318cb0,_0x37c5de,_0x3bd309){var _0x4cc4c5;return db[_0x9178('0x34')][_0x9178('0x4f')]({'where':{'id':_0x318cb0['params']['id']}})['then'](handleEntityNotFound(_0x37c5de,null))[_0x9178('0x2d')](function(_0x2b61f0){if(_0x2b61f0){return _0x2b61f0[_0x9178('0x6b')](_0x318cb0[_0x9178('0x37')][_0x9178('0x67')])[_0x9178('0x2d')](function(_0x506489){if(_[_0x9178('0x70')](_0x318cb0[_0x9178('0x37')][_0x9178('0x67')])){for(var _0xb94f76=0x0;_0xb94f76<_0x318cb0['query'][_0x9178('0x67')][_0x9178('0x3d')];_0xb94f76+=0x1){socket[_0x9178('0x6e')](_0x9178('0x71'),{'UserId':_0x318cb0['query']['ids'][_0xb94f76],'ChatQueueId':_0x318cb0[_0x9178('0x4b')]['id']});}}else{socket['emit'](_0x9178('0x71'),{'UserId':_0x318cb0['query']['ids'],'ChatQueueId':_0x318cb0[_0x9178('0x4b')]['id']});}});}})[_0x9178('0x2d')](respondWithStatusCode(_0x37c5de,null))[_0x9178('0x20')](handleError(_0x37c5de,null));};exports[_0x9178('0x72')]=function(_0x40a8fc,_0xd65c70,_0xcabd81){var _0x718e22={};var _0x12891c={};var _0x18eca4;var _0x541ae4;return db[_0x9178('0x34')]['findOne']({'where':{'id':_0x40a8fc[_0x9178('0x4b')]['id']}})[_0x9178('0x2d')](handleEntityNotFound(_0xd65c70,null))[_0x9178('0x2d')](function(_0x5b9ebf){if(_0x5b9ebf){_0x18eca4=_0x5b9ebf;_0x12891c[_0x9178('0x3e')]=_[_0x9178('0x35')](db[_0x9178('0x5a')][_0x9178('0x4c')]);_0x12891c[_0x9178('0x37')]=_[_0x9178('0x35')](_0x40a8fc[_0x9178('0x37')]);_0x12891c[_0x9178('0x39')]=_[_0x9178('0x3b')](_0x12891c['model'],_0x12891c[_0x9178('0x37')]);_0x718e22[_0x9178('0x3a')]=_[_0x9178('0x3b')](_0x12891c[_0x9178('0x3e')],qs[_0x9178('0x3c')](_0x40a8fc['query'][_0x9178('0x3c')]));_0x718e22[_0x9178('0x3a')]=_0x718e22[_0x9178('0x3a')]['length']?_0x718e22['attributes']:_0x12891c[_0x9178('0x3e')];_0x718e22[_0x9178('0x41')]=qs[_0x9178('0x42')](_0x40a8fc[_0x9178('0x37')][_0x9178('0x42')]);_0x718e22[_0x9178('0x46')]=qs['filters'](_[_0x9178('0x43')](_0x40a8fc[_0x9178('0x37')],_0x12891c[_0x9178('0x39')]));if(_0x40a8fc[_0x9178('0x37')]['filter']){_0x718e22[_0x9178('0x46')]=_['merge'](_0x718e22[_0x9178('0x46')],{'$or':_[_0x9178('0x58')](_0x718e22['attributes'],function(_0x24eb40){var _0xc4f0e0={};_0xc4f0e0[_0x24eb40]={'$like':'%'+_0x40a8fc[_0x9178('0x37')][_0x9178('0x47')]+'%'};return _0xc4f0e0;})});}_0x718e22=_[_0x9178('0x45')]({},_0x718e22,_0x40a8fc['options']);return _0x18eca4[_0x9178('0x72')](_0x718e22);}})[_0x9178('0x2d')](function(_0x4ed852){if(_0x4ed852){_0x541ae4=_0x4ed852[_0x9178('0x3d')];if(!_0x40a8fc[_0x9178('0x37')]['hasOwnProperty'](_0x9178('0x40'))){_0x718e22[_0x9178('0x26')]=qs[_0x9178('0x26')](_0x40a8fc['query']['limit']);_0x718e22[_0x9178('0x25')]=qs[_0x9178('0x25')](_0x40a8fc[_0x9178('0x37')][_0x9178('0x25')]);}return _0x18eca4['getAgents'](_0x718e22);}})[_0x9178('0x2d')](function(_0x5c9880){if(_0x5c9880){return _0x5c9880?{'count':_0x541ae4,'rows':_0x5c9880}:null;}})[_0x9178('0x2d')](respondWithResult(_0xd65c70,null))[_0x9178('0x20')](handleError(_0xd65c70,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 60311d8..438dc5a 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 _0x7a28=['ChatQueue','setMaxListeners','update','remove','emit','exports','../../mysqldb'];(function(_0x4c141d,_0x95e6e8){var _0x3f2f39=function(_0x4983b6){while(--_0x4983b6){_0x4c141d['push'](_0x4c141d['shift']());}};_0x3f2f39(++_0x95e6e8);}(_0x7a28,0x1cd));var _0x87a2=function(_0x232c10,_0x3bea75){_0x232c10=_0x232c10-0x0;var _0x2d5fef=_0x7a28[_0x232c10];return _0x2d5fef;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x87a2('0x0'))['db'][_0x87a2('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x87a2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x87a2('0x3'),'afterDestroy':_0x87a2('0x4')};function emitEvent(_0x2f74df){return function(_0x490293,_0x355063,_0x35fe3d){ChatQueueEvents[_0x87a2('0x5')](_0x2f74df+':'+_0x490293['id'],_0x490293);ChatQueueEvents[_0x87a2('0x5')](_0x2f74df,_0x490293);_0x35fe3d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x87a2('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0xd139=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x52316f,_0x53cf8c){var _0x8aff49=function(_0x29306d){while(--_0x29306d){_0x52316f['push'](_0x52316f['shift']());}};_0x8aff49(++_0x53cf8c);}(_0xd139,0x14e));var _0x9d13=function(_0x4c5a12,_0x5b08ab){_0x4c5a12=_0x4c5a12-0x0;var _0x59947c=_0xd139[_0x4c5a12];return _0x59947c;};'use strict';var EventEmitter=require(_0x9d13('0x0'));var ChatQueue=require(_0x9d13('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9d13('0x2'),'afterUpdate':_0x9d13('0x3'),'afterDestroy':_0x9d13('0x4')};function emitEvent(_0x1994e8){return function(_0x1d39f0,_0xdeacf6,_0x16b9f2){ChatQueueEvents['emit'](_0x1994e8+':'+_0x1d39f0['id'],_0x1d39f0);ChatQueueEvents[_0x9d13('0x5')](_0x1994e8,_0x1d39f0);_0x16b9f2(null);};}for(var e in events){if(events[_0x9d13('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x9d13('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 5365cd9..c9b2efa 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 _0x425d=['bluebird','request-promise','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x425d,0x1e0));var _0xd425=function(_0x1d6a39,_0x5e3ba1){_0x1d6a39=_0x1d6a39-0x0;var _0x534782=_0x425d[_0x1d6a39];return _0x534782;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var attributes=require(_0xd425('0x6'));module[_0xd425('0x7')]=function(_0x596be7,_0x2987c5){return _0x596be7[_0xd425('0x8')](_0xd425('0x9'),attributes,{'tableName':_0xd425('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5292=['./chatQueue.attributes','exports','lodash','util','api','bluebird','request-promise'];(function(_0x201211,_0x2e2788){var _0x3641da=function(_0xfb58b4){while(--_0xfb58b4){_0x201211['push'](_0x201211['shift']());}};_0x3641da(++_0x2e2788);}(_0x5292,0xf7));var _0x2529=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x5292[_0x53b8e0];return _0x10630c;};'use strict';var _=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var logger=require('../../config/logger')(_0x2529('0x2'));var moment=require('moment');var BPromise=require(_0x2529('0x3'));var rp=require(_0x2529('0x4'));var attributes=require(_0x2529('0x5'));module[_0x2529('0x6')]=function(_0x5d25dc,_0x28c08d){return _0x5d25dc['define']('ChatQueue',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 65207a6..47edd48 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 _0xa9e0=['rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','map','include','model','attributes','debug','ShowChatQueue','find','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x1a11e9,_0x5c909f){var _0x12a2f7=function(_0x5291a6){while(--_0x5291a6){_0x1a11e9['push'](_0x1a11e9['shift']());}};_0x12a2f7(++_0x5c909f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});var socket=require(_0x0a9e('0x9'))({'host':_0x0a9e('0xa'),'port':0x18eb});require(_0x0a9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x503809,_0xe42b77,_0x56465b){return new BPromise(function(_0x52cace,_0x39753a){return client[_0x0a9e('0xc')](_0x503809,_0x56465b)[_0x0a9e('0xd')](function(_0x3ab53f){logger[_0x0a9e('0xe')](_0x0a9e('0xf'),_0xe42b77,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0xe42b77,'request\x20sent',JSON[_0x0a9e('0x10')](_0x3ab53f));if(_0x3ab53f[_0x0a9e('0x11')]){if(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x12')]===0x1f4){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f['error'][_0x0a9e('0x13')]);return _0x39753a(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x13')]);}logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f[_0x0a9e('0x11')]['message']);return _0x52cace(_0x3ab53f[_0x0a9e('0x11')]['message']);}else{logger[_0x0a9e('0xe')]('ChatQueue,\x20%s,\x20%s',_0xe42b77,_0x0a9e('0x14'));_0x52cace(_0x3ab53f[_0x0a9e('0x15')]['message']);}})[_0x0a9e('0x16')](function(_0x5a0a06){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x5a0a06);_0x39753a(_0x5a0a06);});});}exports[_0x0a9e('0x17')]=function(_0x205fd6){var _0x31b1ca=this;return new Promise(function(_0x2eb11f,_0x530eb7){return db[_0x0a9e('0x18')][_0x0a9e('0x19')]({'raw':_0x205fd6[_0x0a9e('0x1a')]?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1b')]===undefined?!![]:![]:!![],'where':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1c')]||null:null,'attributes':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')]['attributes']||null:null,'limit':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1d')]||null:null,'include':_0x205fd6[_0x0a9e('0x1a')]?_0x205fd6[_0x0a9e('0x1a')]['include']?_[_0x0a9e('0x1e')](_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1f')],function(_0x4d00e6){return{'model':db[_0x4d00e6[_0x0a9e('0x20')]],'as':_0x4d00e6['as'],'attributes':_0x4d00e6[_0x0a9e('0x21')],'include':_0x4d00e6[_0x0a9e('0x1f')]?_['map'](_0x4d00e6['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x20')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x21')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x20')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0xd')](function(_0x34dc65){logger[_0x0a9e('0xe')](_0x0a9e('0x17'),_0x205fd6);logger[_0x0a9e('0x22')](_0x0a9e('0x17'),_0x205fd6,JSON[_0x0a9e('0x10')](_0x34dc65));_0x2eb11f(_0x34dc65);})[_0x0a9e('0x16')](function(_0x5a101a){logger[_0x0a9e('0x11')](_0x0a9e('0x17'),_0x5a101a[_0x0a9e('0x13')],_0x205fd6);_0x530eb7(_0x31b1ca[_0x0a9e('0x11')](0x1f4,_0x5a101a['message']));});});};exports[_0x0a9e('0x23')]=function(_0x40e7a3){var _0x1843b2=this;return new Promise(function(_0x824a4f,_0x58b06f){return db[_0x0a9e('0x18')][_0x0a9e('0x24')]({'raw':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3[_0x0a9e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3['options'][_0x0a9e('0x1c')]||null:null,'attributes':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3[_0x0a9e('0x1a')][_0x0a9e('0x21')]||null:null,'include':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3['options'][_0x0a9e('0x1f')]?_[_0x0a9e('0x1e')](_0x40e7a3[_0x0a9e('0x1a')][_0x0a9e('0x1f')],function(_0x2b45ea){return{'model':db[_0x2b45ea[_0x0a9e('0x20')]],'as':_0x2b45ea['as'],'attributes':_0x2b45ea[_0x0a9e('0x21')],'include':_0x2b45ea[_0x0a9e('0x1f')]?_['map'](_0x2b45ea[_0x0a9e('0x1f')],function(_0x5e7238){return{'model':db[_0x5e7238[_0x0a9e('0x20')]],'as':_0x5e7238['as'],'attributes':_0x5e7238[_0x0a9e('0x21')],'include':_0x5e7238[_0x0a9e('0x1f')]?_[_0x0a9e('0x1e')](_0x5e7238['include'],function(_0x191e91){return{'model':db[_0x191e91[_0x0a9e('0x20')]],'as':_0x191e91['as'],'attributes':_0x191e91[_0x0a9e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0xd')](function(_0x4853b1){logger['info'](_0x0a9e('0x23'),_0x40e7a3);logger['debug'](_0x0a9e('0x23'),_0x40e7a3,JSON[_0x0a9e('0x10')](_0x4853b1));_0x824a4f(_0x4853b1);})[_0x0a9e('0x16')](function(_0x1ef87a){logger['error'](_0x0a9e('0x23'),_0x1ef87a[_0x0a9e('0x13')],_0x40e7a3);_0x58b06f(_0x1843b2[_0x0a9e('0x11')](0x1f4,_0x1ef87a['message']));});});}; \ No newline at end of file +var _0xa9e0=['rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','map','include','model','attributes','debug','ShowChatQueue','find','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x4acc20,_0xc514ad){var _0x110216=function(_0x47d63d){while(--_0x47d63d){_0x4acc20['push'](_0x4acc20['shift']());}};_0x110216(++_0xc514ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});var socket=require(_0x0a9e('0x9'))({'host':_0x0a9e('0xa'),'port':0x18eb});require(_0x0a9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x503809,_0xe42b77,_0x56465b){return new BPromise(function(_0x52cace,_0x39753a){return client[_0x0a9e('0xc')](_0x503809,_0x56465b)[_0x0a9e('0xd')](function(_0x3ab53f){logger[_0x0a9e('0xe')](_0x0a9e('0xf'),_0xe42b77,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0xe42b77,'request\x20sent',JSON[_0x0a9e('0x10')](_0x3ab53f));if(_0x3ab53f[_0x0a9e('0x11')]){if(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x12')]===0x1f4){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f['error'][_0x0a9e('0x13')]);return _0x39753a(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x13')]);}logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f[_0x0a9e('0x11')]['message']);return _0x52cace(_0x3ab53f[_0x0a9e('0x11')]['message']);}else{logger[_0x0a9e('0xe')]('ChatQueue,\x20%s,\x20%s',_0xe42b77,_0x0a9e('0x14'));_0x52cace(_0x3ab53f[_0x0a9e('0x15')]['message']);}})[_0x0a9e('0x16')](function(_0x5a0a06){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x5a0a06);_0x39753a(_0x5a0a06);});});}exports[_0x0a9e('0x17')]=function(_0x205fd6){var _0x31b1ca=this;return new Promise(function(_0x2eb11f,_0x530eb7){return db[_0x0a9e('0x18')][_0x0a9e('0x19')]({'raw':_0x205fd6[_0x0a9e('0x1a')]?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1b')]===undefined?!![]:![]:!![],'where':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1c')]||null:null,'attributes':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')]['attributes']||null:null,'limit':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1d')]||null:null,'include':_0x205fd6[_0x0a9e('0x1a')]?_0x205fd6[_0x0a9e('0x1a')]['include']?_[_0x0a9e('0x1e')](_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1f')],function(_0x4d00e6){return{'model':db[_0x4d00e6[_0x0a9e('0x20')]],'as':_0x4d00e6['as'],'attributes':_0x4d00e6[_0x0a9e('0x21')],'include':_0x4d00e6[_0x0a9e('0x1f')]?_['map'](_0x4d00e6['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x20')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x21')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x20')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0xd')](function(_0x34dc65){logger[_0x0a9e('0xe')](_0x0a9e('0x17'),_0x205fd6);logger[_0x0a9e('0x22')](_0x0a9e('0x17'),_0x205fd6,JSON[_0x0a9e('0x10')](_0x34dc65));_0x2eb11f(_0x34dc65);})[_0x0a9e('0x16')](function(_0x5a101a){logger[_0x0a9e('0x11')](_0x0a9e('0x17'),_0x5a101a[_0x0a9e('0x13')],_0x205fd6);_0x530eb7(_0x31b1ca[_0x0a9e('0x11')](0x1f4,_0x5a101a['message']));});});};exports[_0x0a9e('0x23')]=function(_0x40e7a3){var _0x1843b2=this;return new Promise(function(_0x824a4f,_0x58b06f){return db[_0x0a9e('0x18')][_0x0a9e('0x24')]({'raw':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3[_0x0a9e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3['options'][_0x0a9e('0x1c')]||null:null,'attributes':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3[_0x0a9e('0x1a')][_0x0a9e('0x21')]||null:null,'include':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3['options'][_0x0a9e('0x1f')]?_[_0x0a9e('0x1e')](_0x40e7a3[_0x0a9e('0x1a')][_0x0a9e('0x1f')],function(_0x2b45ea){return{'model':db[_0x2b45ea[_0x0a9e('0x20')]],'as':_0x2b45ea['as'],'attributes':_0x2b45ea[_0x0a9e('0x21')],'include':_0x2b45ea[_0x0a9e('0x1f')]?_['map'](_0x2b45ea[_0x0a9e('0x1f')],function(_0x5e7238){return{'model':db[_0x5e7238[_0x0a9e('0x20')]],'as':_0x5e7238['as'],'attributes':_0x5e7238[_0x0a9e('0x21')],'include':_0x5e7238[_0x0a9e('0x1f')]?_[_0x0a9e('0x1e')](_0x5e7238['include'],function(_0x191e91){return{'model':db[_0x191e91[_0x0a9e('0x20')]],'as':_0x191e91['as'],'attributes':_0x191e91[_0x0a9e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0xd')](function(_0x4853b1){logger['info'](_0x0a9e('0x23'),_0x40e7a3);logger['debug'](_0x0a9e('0x23'),_0x40e7a3,JSON[_0x0a9e('0x10')](_0x4853b1));_0x824a4f(_0x4853b1);})[_0x0a9e('0x16')](function(_0x1ef87a){logger['error'](_0x0a9e('0x23'),_0x1ef87a[_0x0a9e('0x13')],_0x40e7a3);_0x58b06f(_0x1843b2[_0x0a9e('0x11')](0x1f4,_0x1ef87a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f928911..6eaf9ce 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(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 091bdeb..e9fe892 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 _0x7767=['post','create','put','update','delete','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x14f5c3,_0x1e3047){var _0x2ea070=function(_0x1c8cd4){while(--_0x1c8cd4){_0x14f5c3['push'](_0x14f5c3['shift']());}};_0x2ea070(++_0x1e3047);}(_0x7767,0x1e3));var _0x7776=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x7767[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require(_0x7776('0x0'));var util=require(_0x7776('0x1'));var path=require(_0x7776('0x2'));var express=require(_0x7776('0x3'));var router=express[_0x7776('0x4')]();var auth=require(_0x7776('0x5'));var interaction=require(_0x7776('0x6'));var config=require(_0x7776('0x7'));var controller=require('./chatQueue.controller');router[_0x7776('0x8')]('/',auth[_0x7776('0x9')](),controller[_0x7776('0xa')]);router[_0x7776('0x8')](_0x7776('0xb'),auth[_0x7776('0x9')](),controller[_0x7776('0xc')]);router[_0x7776('0x8')](_0x7776('0xd'),auth['isAuthenticated'](),controller[_0x7776('0xe')]);router[_0x7776('0x8')](_0x7776('0xf'),auth['isAuthenticated'](),controller[_0x7776('0x10')]);router[_0x7776('0x8')](_0x7776('0x11'),auth[_0x7776('0x9')](),controller[_0x7776('0x12')]);router[_0x7776('0x8')](_0x7776('0x13'),auth['isAuthenticated'](),controller[_0x7776('0x14')]);router[_0x7776('0x15')]('/',auth[_0x7776('0x9')](),controller[_0x7776('0x16')]);router['post'](_0x7776('0x11'),auth[_0x7776('0x9')](),controller['addTeams']);router[_0x7776('0x15')]('/:id/users',auth[_0x7776('0x9')](),controller['addAgents']);router[_0x7776('0x17')](_0x7776('0xd'),auth['isAuthenticated'](),controller[_0x7776('0x18')]);router[_0x7776('0x19')](_0x7776('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x7776('0x19')]('/:id/teams',auth[_0x7776('0x9')](),controller['removeTeams']);router[_0x7776('0x19')](_0x7776('0x13'),auth[_0x7776('0x9')](),controller[_0x7776('0x1a')]);module[_0x7776('0x1b')]=router; \ No newline at end of file +var _0x7b72=['post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x57ee65,_0xb85464){var _0x581b1f=function(_0x3153de){while(--_0x3153de){_0x57ee65['push'](_0x57ee65['shift']());}};_0x581b1f(++_0xb85464);}(_0x7b72,0xcd));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x27b7('0x0'));var util=require(_0x27b7('0x1'));var path=require(_0x27b7('0x2'));var express=require(_0x27b7('0x3'));var router=express[_0x27b7('0x4')]();var auth=require(_0x27b7('0x5'));var interaction=require(_0x27b7('0x6'));var config=require(_0x27b7('0x7'));var controller=require(_0x27b7('0x8'));router[_0x27b7('0x9')]('/',auth[_0x27b7('0xa')](),controller[_0x27b7('0xb')]);router[_0x27b7('0x9')](_0x27b7('0xc'),auth[_0x27b7('0xa')](),controller['describe']);router['get'](_0x27b7('0xd'),auth[_0x27b7('0xa')](),controller[_0x27b7('0xe')]);router['get']('/:id/members',auth[_0x27b7('0xa')](),controller[_0x27b7('0xf')]);router[_0x27b7('0x9')](_0x27b7('0x10'),auth[_0x27b7('0xa')](),controller[_0x27b7('0x11')]);router[_0x27b7('0x9')](_0x27b7('0x12'),auth[_0x27b7('0xa')](),controller['getAgents']);router[_0x27b7('0x13')]('/',auth['isAuthenticated'](),controller[_0x27b7('0x14')]);router['post'](_0x27b7('0x10'),auth['isAuthenticated'](),controller[_0x27b7('0x15')]);router[_0x27b7('0x13')](_0x27b7('0x12'),auth[_0x27b7('0xa')](),controller['addAgents']);router[_0x27b7('0x16')](_0x27b7('0xd'),auth[_0x27b7('0xa')](),controller[_0x27b7('0x17')]);router['delete']('/:id',auth[_0x27b7('0xa')](),controller[_0x27b7('0x18')]);router[_0x27b7('0x19')](_0x27b7('0x10'),auth['isAuthenticated'](),controller[_0x27b7('0x1a')]);router['delete'](_0x27b7('0x12'),auth['isAuthenticated'](),controller[_0x27b7('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index ce9d0a3..d1344a8 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 _0x7fdb=['sequelize','exports','STRING','DATE','moment'];(function(_0x5e2b4e,_0x2db128){var _0x392434=function(_0x3ff2f4){while(--_0x3ff2f4){_0x5e2b4e['push'](_0x5e2b4e['shift']());}};_0x392434(++_0x2db128);}(_0x7fdb,0xf9));var _0xb7fd=function(_0x4cc1c1,_0x3ad908){_0x4cc1c1=_0x4cc1c1-0x0;var _0x483778=_0x7fdb[_0x4cc1c1];return _0x483778;};'use strict';var moment=require(_0xb7fd('0x0'));var Sequelize=require(_0xb7fd('0x1'));module[_0xb7fd('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb7fd('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb7fd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb7fd('0x4')]},'reason':{'type':Sequelize[_0xb7fd('0x3')]}}; \ No newline at end of file +var _0x0ab8=['sequelize','STRING','DATE'];(function(_0x12dd14,_0x2268ff){var _0x436659=function(_0x198768){while(--_0x198768){_0x12dd14['push'](_0x12dd14['shift']());}};_0x436659(++_0x2268ff);}(_0x0ab8,0x1f2));var _0x80ab=function(_0x434ce8,_0x23e52f){_0x434ce8=_0x434ce8-0x0;var _0x1ccc57=_0x0ab8[_0x434ce8];return _0x1ccc57;};'use strict';var moment=require('moment');var Sequelize=require(_0x80ab('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x80ab('0x1')]},'joinAt':{'type':Sequelize[_0x80ab('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x80ab('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 284c5b3..7f5ef5a 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 _0x8f1a=['path','sox','ejs','lodash','squel','crypto','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','name','ChatQueueReport','model','keys','dateStart','dateEnd','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','add','day','where','map','merge','includeAll','include','findAll','rows','params','rawAttributes','options','find','catch','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xc544f8,_0x4a99a8){var _0x358719=function(_0x3385dc){while(--_0x3385dc){_0xc544f8['push'](_0xc544f8['shift']());}};_0x358719(++_0x4a99a8);}(_0x8f1a,0x192));var _0xa8f1=function(_0x2fe0ab,_0x3cf68e){_0x2fe0ab=_0x2fe0ab-0x0;var _0x5fed16=_0x8f1a[_0x2fe0ab];return _0x5fed16;};'use strict';var jsonpatch=require(_0xa8f1('0x0'));var rp=require(_0xa8f1('0x1'));var moment=require(_0xa8f1('0x2'));var BPromise=require(_0xa8f1('0x3'));var Mustache=require(_0xa8f1('0x4'));var util=require(_0xa8f1('0x5'));var path=require(_0xa8f1('0x6'));var sox=require(_0xa8f1('0x7'));var csv=require('to-csv');var ejs=require(_0xa8f1('0x8'));var fs=require('fs');var _=require(_0xa8f1('0x9'));var squel=require(_0xa8f1('0xa'));var crypto=require(_0xa8f1('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa8f1('0xc'));var querystring=require(_0xa8f1('0xd'));var Papa=require('papaparse');var qs=require(_0xa8f1('0xe'));var logger=require(_0xa8f1('0xf'))(_0xa8f1('0x10'));var utils=require(_0xa8f1('0x11'));var config=require('../../config/environment');var db=require(_0xa8f1('0x12'))['db'];function respondWithStatusCode(_0x418d14,_0x254040){_0x254040=_0x254040||0xcc;return function(_0x2a4f19){if(_0x2a4f19){return _0x418d14[_0xa8f1('0x13')](_0x254040);}return _0x418d14['status'](_0x254040)[_0xa8f1('0x14')]();};}function respondWithResult(_0x3d523a,_0x355ccc){_0x355ccc=_0x355ccc||0xc8;return function(_0x175dab){if(_0x175dab){return _0x3d523a['status'](_0x355ccc)[_0xa8f1('0x15')](_0x175dab);}};}function respondWithFilteredResult(_0x58db7e,_0x5ca3fd){return function(_0x3bb405){if(_0x3bb405){var _0x3fe58b=_0x3bb405[_0xa8f1('0x16')],_0x32efa3=_0x5ca3fd[_0xa8f1('0x17')],_0x1b966d=_0x5ca3fd['offset']+_0x5ca3fd['limit'],_0x4a621c;if(_0x1b966d>=_0x3fe58b){_0x1b966d=_0x3fe58b;_0x4a621c=0xc8;}else{_0x4a621c=0xce;}_0x58db7e[_0xa8f1('0x18')](_0x4a621c);return _0x58db7e[_0xa8f1('0x19')](_0xa8f1('0x1a'),_0x32efa3+'-'+_0x1b966d+'/'+_0x3fe58b)[_0xa8f1('0x15')](_0x3bb405);}return null;};}function patchUpdates(_0xfba0a8){return function(_0x4ae3f1){try{jsonpatch[_0xa8f1('0x1b')](_0x4ae3f1,_0xfba0a8,!![]);}catch(_0x33598e){return BPromise[_0xa8f1('0x1c')](_0x33598e);}return _0x4ae3f1[_0xa8f1('0x1d')]();};}function saveUpdates(_0x4a2d70,_0x34bd7e){return function(_0x5f259f){if(_0x5f259f){return _0x5f259f[_0xa8f1('0x1e')](_0x4a2d70)[_0xa8f1('0x1f')](function(_0x51b6a3){return _0x51b6a3;});}return null;};}function removeEntity(_0x54b5a5,_0x28a9ab){return function(_0x35f10f){if(_0x35f10f){return _0x35f10f[_0xa8f1('0x20')]()[_0xa8f1('0x1f')](function(){_0x54b5a5[_0xa8f1('0x18')](0xcc)[_0xa8f1('0x14')]();});}};}function handleEntityNotFound(_0x192abc,_0x39915f){return function(_0x394f10){if(!_0x394f10){_0x192abc['sendStatus'](0x194);}return _0x394f10;};}function handleError(_0x7c7584,_0x265fc0){_0x265fc0=_0x265fc0||0x1f4;return function(_0x31f8f5){logger['error'](_0x31f8f5['stack']);if(_0x31f8f5[_0xa8f1('0x21')]){delete _0x31f8f5['name'];}_0x7c7584['status'](_0x265fc0)['send'](_0x31f8f5);};}exports['index']=function(_0x15f011,_0x10d495){var _0x38bf21={},_0x5d9cf4={},_0x15b613={'count':0x0,'rows':[]};var _0x4bbfc8=db[_0xa8f1('0x22')]['rawAttributes'];_0x5d9cf4[_0xa8f1('0x23')]=_[_0xa8f1('0x24')](_0x4bbfc8);var _0xb394b1={'dateStart':_0x15f011['query'][_0xa8f1('0x25')],'dateEnd':_0x15f011['query'][_0xa8f1('0x26')]};delete _0x15f011[_0xa8f1('0x27')]['dateStart'];delete _0x15f011['query'][_0xa8f1('0x26')];_0x5d9cf4[_0xa8f1('0x27')]=_['keys'](_0x15f011[_0xa8f1('0x27')]);_0x5d9cf4['filters']=_[_0xa8f1('0x28')](_0x5d9cf4['model'],_0x5d9cf4[_0xa8f1('0x27')]);_0x38bf21[_0xa8f1('0x29')]=_[_0xa8f1('0x28')](_0x5d9cf4[_0xa8f1('0x23')],qs[_0xa8f1('0x2a')](_0x15f011['query'][_0xa8f1('0x2a')]));_0x38bf21[_0xa8f1('0x29')]=_0x38bf21[_0xa8f1('0x29')][_0xa8f1('0x2b')]?_0x38bf21['attributes']:_0x5d9cf4[_0xa8f1('0x23')];if(!_0x15f011[_0xa8f1('0x27')][_0xa8f1('0x2c')](_0xa8f1('0x2d'))){_0x38bf21['limit']=qs[_0xa8f1('0x2e')](_0x15f011[_0xa8f1('0x27')][_0xa8f1('0x2e')]);_0x38bf21[_0xa8f1('0x17')]=qs[_0xa8f1('0x17')](_0x15f011['query']['offset']);}_0x38bf21[_0xa8f1('0x2f')]=qs['sort'](_0x15f011[_0xa8f1('0x27')][_0xa8f1('0x30')]);_0x38bf21['where']=qs[_0xa8f1('0x31')](_[_0xa8f1('0x32')](_0x15f011[_0xa8f1('0x27')],_0x5d9cf4[_0xa8f1('0x31')]));if(_0xb394b1[_0xa8f1('0x25')]){if(_0xb394b1['dateEnd']){_0xb394b1[_0xa8f1('0x26')]=moment(_0xb394b1[_0xa8f1('0x26')])[_0xa8f1('0x33')](0x1,_0xa8f1('0x34'));}else{_0xb394b1['dateEnd']=moment(_0xb394b1[_0xa8f1('0x25')])[_0xa8f1('0x33')](0x1,_0xa8f1('0x34'));}_['merge'](_0x38bf21[_0xa8f1('0x35')],{'createdAt':{'$gte':_0xb394b1[_0xa8f1('0x25')],'$lte':_0xb394b1[_0xa8f1('0x26')]}});}if(_0x15f011['query']['filter']){_0x38bf21[_0xa8f1('0x35')]=_['merge'](_0x38bf21['where'],{'$or':_[_0xa8f1('0x36')](_0x38bf21[_0xa8f1('0x29')],function(_0x2e8716){var _0x5d2aa9={};_0x5d2aa9[_0x2e8716]={'$like':'%'+_0x15f011[_0xa8f1('0x27')]['filter']+'%'};return _0x5d2aa9;})});}_0x38bf21=_[_0xa8f1('0x37')]({},_0x38bf21,_0x15f011['options']);var _0xf12127={'where':_0x38bf21['where']};return db['ChatQueueReport'][_0xa8f1('0x16')](_0xf12127)[_0xa8f1('0x1f')](function(_0x165e62){_0x15b613[_0xa8f1('0x16')]=_0x165e62;if(_0x15f011[_0xa8f1('0x27')][_0xa8f1('0x38')]){_0x38bf21[_0xa8f1('0x39')]=[{'all':!![]}];}return db[_0xa8f1('0x22')][_0xa8f1('0x3a')](_0x38bf21);})[_0xa8f1('0x1f')](function(_0xe7ee2){_0x15b613[_0xa8f1('0x3b')]=_0xe7ee2;return _0x15b613;})[_0xa8f1('0x1f')](respondWithFilteredResult(_0x10d495,_0x38bf21))['catch'](handleError(_0x10d495,null));};exports['show']=function(_0x35bf2f,_0x2d12a7){var _0x60ef0={'raw':!![],'where':{'id':_0x35bf2f[_0xa8f1('0x3c')]['id']}},_0xe527a5={};_0xe527a5[_0xa8f1('0x23')]=_[_0xa8f1('0x24')](db[_0xa8f1('0x22')][_0xa8f1('0x3d')]);_0xe527a5['query']=_[_0xa8f1('0x24')](_0x35bf2f[_0xa8f1('0x27')]);_0xe527a5[_0xa8f1('0x31')]=_[_0xa8f1('0x28')](_0xe527a5[_0xa8f1('0x23')],_0xe527a5['query']);_0x60ef0[_0xa8f1('0x29')]=_['intersection'](_0xe527a5[_0xa8f1('0x23')],qs[_0xa8f1('0x2a')](_0x35bf2f['query'][_0xa8f1('0x2a')]));_0x60ef0[_0xa8f1('0x29')]=_0x60ef0[_0xa8f1('0x29')][_0xa8f1('0x2b')]?_0x60ef0[_0xa8f1('0x29')]:_0xe527a5[_0xa8f1('0x23')];if(_0x35bf2f[_0xa8f1('0x27')][_0xa8f1('0x38')]){_0x60ef0[_0xa8f1('0x39')]=[{'all':!![]}];}_0x60ef0=_[_0xa8f1('0x37')]({},_0x60ef0,_0x35bf2f[_0xa8f1('0x3e')]);return db[_0xa8f1('0x22')][_0xa8f1('0x3f')](_0x60ef0)[_0xa8f1('0x1f')](handleEntityNotFound(_0x2d12a7,null))[_0xa8f1('0x1f')](respondWithResult(_0x2d12a7,null))[_0xa8f1('0x40')](handleError(_0x2d12a7,null));};exports[_0xa8f1('0x41')]=function(_0x405f8e,_0x21a890){return db[_0xa8f1('0x22')][_0xa8f1('0x41')](_0x405f8e['body'],{})[_0xa8f1('0x1f')](respondWithResult(_0x21a890,0xc9))[_0xa8f1('0x40')](handleError(_0x21a890,null));};exports['update']=function(_0x2a3d90,_0x29599c){if(_0x2a3d90[_0xa8f1('0x42')]['id']){delete _0x2a3d90['body']['id'];}return db[_0xa8f1('0x22')][_0xa8f1('0x3f')]({'where':{'id':_0x2a3d90[_0xa8f1('0x3c')]['id']}})[_0xa8f1('0x1f')](handleEntityNotFound(_0x29599c,null))[_0xa8f1('0x1f')](saveUpdates(_0x2a3d90[_0xa8f1('0x42')],null))[_0xa8f1('0x1f')](respondWithResult(_0x29599c,null))[_0xa8f1('0x40')](handleError(_0x29599c,null));};exports[_0xa8f1('0x20')]=function(_0x533f9d,_0xc884e2){return db[_0xa8f1('0x22')]['find']({'where':{'id':_0x533f9d['params']['id']}})['then'](handleEntityNotFound(_0xc884e2,null))[_0xa8f1('0x1f')](removeEntity(_0xc884e2,null))['catch'](handleError(_0xc884e2,null));};exports[_0xa8f1('0x43')]=function(_0x17cd2e,_0x23f1bc){return db['ChatQueueReport'][_0xa8f1('0x43')]()[_0xa8f1('0x1f')](respondWithResult(_0x23f1bc,null))[_0xa8f1('0x40')](handleError(_0x23f1bc,null));}; \ No newline at end of file +var _0x337e=['find','catch','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','update','then','error','stack','name','send','index','ChatQueueReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','options','count','includeAll','include','findAll','rows','show','params'];(function(_0x225a75,_0x43c1de){var _0xee995d=function(_0x31a816){while(--_0x31a816){_0x225a75['push'](_0x225a75['shift']());}};_0xee995d(++_0x43c1de);}(_0x337e,0x1aa));var _0xe337=function(_0x431953,_0x22d793){_0x431953=_0x431953-0x0;var _0x4d9317=_0x337e[_0x431953];return _0x4d9317;};'use strict';var jsonpatch=require(_0xe337('0x0'));var rp=require(_0xe337('0x1'));var moment=require(_0xe337('0x2'));var BPromise=require(_0xe337('0x3'));var Mustache=require(_0xe337('0x4'));var util=require(_0xe337('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe337('0x6'));var ejs=require(_0xe337('0x7'));var fs=require('fs');var _=require(_0xe337('0x8'));var squel=require(_0xe337('0x9'));var crypto=require(_0xe337('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe337('0xb'));var toCsv=require(_0xe337('0x6'));var querystring=require('querystring');var Papa=require(_0xe337('0xc'));var qs=require(_0xe337('0xd'));var logger=require('../../config/logger')(_0xe337('0xe'));var utils=require(_0xe337('0xf'));var config=require(_0xe337('0x10'));var db=require(_0xe337('0x11'))['db'];function respondWithStatusCode(_0x18b23b,_0x598576){_0x598576=_0x598576||0xcc;return function(_0x4a7fec){if(_0x4a7fec){return _0x18b23b[_0xe337('0x12')](_0x598576);}return _0x18b23b[_0xe337('0x13')](_0x598576)[_0xe337('0x14')]();};}function respondWithResult(_0x26f84a,_0x1832ed){_0x1832ed=_0x1832ed||0xc8;return function(_0x202dba){if(_0x202dba){return _0x26f84a[_0xe337('0x13')](_0x1832ed)[_0xe337('0x15')](_0x202dba);}};}function respondWithFilteredResult(_0x357555,_0x5600d3){return function(_0x5d17de){if(_0x5d17de){var _0x584217=_0x5d17de['count'],_0x48aac4=_0x5600d3[_0xe337('0x16')],_0x5aeef2=_0x5600d3[_0xe337('0x16')]+_0x5600d3['limit'],_0x561f09;if(_0x5aeef2>=_0x584217){_0x5aeef2=_0x584217;_0x561f09=0xc8;}else{_0x561f09=0xce;}_0x357555[_0xe337('0x13')](_0x561f09);return _0x357555[_0xe337('0x17')]('Content-Range',_0x48aac4+'-'+_0x5aeef2+'/'+_0x584217)['json'](_0x5d17de);}return null;};}function patchUpdates(_0x458738){return function(_0x442c2a){try{jsonpatch[_0xe337('0x18')](_0x442c2a,_0x458738,!![]);}catch(_0x537369){return BPromise[_0xe337('0x19')](_0x537369);}return _0x442c2a['save']();};}function saveUpdates(_0x3f640c,_0x46a9eb){return function(_0xde527d){if(_0xde527d){return _0xde527d[_0xe337('0x1a')](_0x3f640c)[_0xe337('0x1b')](function(_0x16e2b1){return _0x16e2b1;});}return null;};}function removeEntity(_0x108ef6,_0x148765){return function(_0x3edda0){if(_0x3edda0){return _0x3edda0['destroy']()['then'](function(){_0x108ef6['status'](0xcc)[_0xe337('0x14')]();});}};}function handleEntityNotFound(_0x5eb046,_0x55d2bf){return function(_0x130e30){if(!_0x130e30){_0x5eb046[_0xe337('0x12')](0x194);}return _0x130e30;};}function handleError(_0x38fd73,_0x2bf60f){_0x2bf60f=_0x2bf60f||0x1f4;return function(_0x544d9f){logger[_0xe337('0x1c')](_0x544d9f[_0xe337('0x1d')]);if(_0x544d9f[_0xe337('0x1e')]){delete _0x544d9f[_0xe337('0x1e')];}_0x38fd73['status'](_0x2bf60f)[_0xe337('0x1f')](_0x544d9f);};}exports[_0xe337('0x20')]=function(_0x1eb9eb,_0x36d593){var _0x4c1b52={},_0xa8eaaa={},_0x386f58={'count':0x0,'rows':[]};var _0x56fa61=db[_0xe337('0x21')][_0xe337('0x22')];_0xa8eaaa[_0xe337('0x23')]=_[_0xe337('0x24')](_0x56fa61);var _0x28122c={'dateStart':_0x1eb9eb[_0xe337('0x25')]['dateStart'],'dateEnd':_0x1eb9eb['query'][_0xe337('0x26')]};delete _0x1eb9eb['query'][_0xe337('0x27')];delete _0x1eb9eb[_0xe337('0x25')][_0xe337('0x26')];_0xa8eaaa[_0xe337('0x25')]=_[_0xe337('0x24')](_0x1eb9eb[_0xe337('0x25')]);_0xa8eaaa[_0xe337('0x28')]=_[_0xe337('0x29')](_0xa8eaaa[_0xe337('0x23')],_0xa8eaaa[_0xe337('0x25')]);_0x4c1b52[_0xe337('0x2a')]=_[_0xe337('0x29')](_0xa8eaaa[_0xe337('0x23')],qs[_0xe337('0x2b')](_0x1eb9eb['query'][_0xe337('0x2b')]));_0x4c1b52[_0xe337('0x2a')]=_0x4c1b52[_0xe337('0x2a')][_0xe337('0x2c')]?_0x4c1b52[_0xe337('0x2a')]:_0xa8eaaa[_0xe337('0x23')];if(!_0x1eb9eb[_0xe337('0x25')][_0xe337('0x2d')](_0xe337('0x2e'))){_0x4c1b52[_0xe337('0x2f')]=qs['limit'](_0x1eb9eb[_0xe337('0x25')][_0xe337('0x2f')]);_0x4c1b52[_0xe337('0x16')]=qs[_0xe337('0x16')](_0x1eb9eb[_0xe337('0x25')]['offset']);}_0x4c1b52[_0xe337('0x30')]=qs[_0xe337('0x31')](_0x1eb9eb[_0xe337('0x25')][_0xe337('0x31')]);_0x4c1b52[_0xe337('0x32')]=qs['filters'](_[_0xe337('0x33')](_0x1eb9eb[_0xe337('0x25')],_0xa8eaaa['filters']));if(_0x28122c[_0xe337('0x27')]){if(_0x28122c[_0xe337('0x26')]){_0x28122c[_0xe337('0x26')]=moment(_0x28122c['dateEnd'])[_0xe337('0x34')](0x1,_0xe337('0x35'));}else{_0x28122c[_0xe337('0x26')]=moment(_0x28122c[_0xe337('0x27')])['add'](0x1,_0xe337('0x35'));}_[_0xe337('0x36')](_0x4c1b52[_0xe337('0x32')],{'createdAt':{'$gte':_0x28122c['dateStart'],'$lte':_0x28122c[_0xe337('0x26')]}});}if(_0x1eb9eb[_0xe337('0x25')]['filter']){_0x4c1b52[_0xe337('0x32')]=_[_0xe337('0x36')](_0x4c1b52['where'],{'$or':_['map'](_0x4c1b52[_0xe337('0x2a')],function(_0x5f2e76){var _0x1b10a0={};_0x1b10a0[_0x5f2e76]={'$like':'%'+_0x1eb9eb[_0xe337('0x25')][_0xe337('0x37')]+'%'};return _0x1b10a0;})});}_0x4c1b52=_[_0xe337('0x36')]({},_0x4c1b52,_0x1eb9eb[_0xe337('0x38')]);var _0x5eb7bc={'where':_0x4c1b52[_0xe337('0x32')]};return db['ChatQueueReport'][_0xe337('0x39')](_0x5eb7bc)[_0xe337('0x1b')](function(_0x3442f4){_0x386f58[_0xe337('0x39')]=_0x3442f4;if(_0x1eb9eb[_0xe337('0x25')][_0xe337('0x3a')]){_0x4c1b52[_0xe337('0x3b')]=[{'all':!![]}];}return db[_0xe337('0x21')][_0xe337('0x3c')](_0x4c1b52);})['then'](function(_0x261f0f){_0x386f58[_0xe337('0x3d')]=_0x261f0f;return _0x386f58;})[_0xe337('0x1b')](respondWithFilteredResult(_0x36d593,_0x4c1b52))['catch'](handleError(_0x36d593,null));};exports[_0xe337('0x3e')]=function(_0x4af349,_0x2771ef){var _0x514223={'raw':!![],'where':{'id':_0x4af349[_0xe337('0x3f')]['id']}},_0x2641bc={};_0x2641bc[_0xe337('0x23')]=_[_0xe337('0x24')](db[_0xe337('0x21')]['rawAttributes']);_0x2641bc[_0xe337('0x25')]=_[_0xe337('0x24')](_0x4af349[_0xe337('0x25')]);_0x2641bc['filters']=_[_0xe337('0x29')](_0x2641bc[_0xe337('0x23')],_0x2641bc[_0xe337('0x25')]);_0x514223[_0xe337('0x2a')]=_['intersection'](_0x2641bc[_0xe337('0x23')],qs['fields'](_0x4af349[_0xe337('0x25')][_0xe337('0x2b')]));_0x514223[_0xe337('0x2a')]=_0x514223[_0xe337('0x2a')][_0xe337('0x2c')]?_0x514223['attributes']:_0x2641bc[_0xe337('0x23')];if(_0x4af349['query'][_0xe337('0x3a')]){_0x514223[_0xe337('0x3b')]=[{'all':!![]}];}_0x514223=_[_0xe337('0x36')]({},_0x514223,_0x4af349['options']);return db['ChatQueueReport'][_0xe337('0x40')](_0x514223)[_0xe337('0x1b')](handleEntityNotFound(_0x2771ef,null))[_0xe337('0x1b')](respondWithResult(_0x2771ef,null))[_0xe337('0x41')](handleError(_0x2771ef,null));};exports[_0xe337('0x42')]=function(_0x275642,_0x19e71f){return db[_0xe337('0x21')][_0xe337('0x42')](_0x275642[_0xe337('0x43')],{})[_0xe337('0x1b')](respondWithResult(_0x19e71f,0xc9))[_0xe337('0x41')](handleError(_0x19e71f,null));};exports[_0xe337('0x1a')]=function(_0xdf52d9,_0x48f54b){if(_0xdf52d9['body']['id']){delete _0xdf52d9['body']['id'];}return db['ChatQueueReport'][_0xe337('0x40')]({'where':{'id':_0xdf52d9[_0xe337('0x3f')]['id']}})[_0xe337('0x1b')](handleEntityNotFound(_0x48f54b,null))['then'](saveUpdates(_0xdf52d9['body'],null))[_0xe337('0x1b')](respondWithResult(_0x48f54b,null))[_0xe337('0x41')](handleError(_0x48f54b,null));};exports[_0xe337('0x44')]=function(_0x2fb46e,_0x13f6a5){return db['ChatQueueReport'][_0xe337('0x40')]({'where':{'id':_0x2fb46e['params']['id']}})[_0xe337('0x1b')](handleEntityNotFound(_0x13f6a5,null))[_0xe337('0x1b')](removeEntity(_0x13f6a5,null))['catch'](handleError(_0x13f6a5,null));};exports[_0xe337('0x45')]=function(_0x12249d,_0x347a84){return db[_0xe337('0x21')][_0xe337('0x45')]()['then'](respondWithResult(_0x347a84,null))[_0xe337('0x41')](handleError(_0x347a84,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f4d558a..98ac4bf 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 _0xe14b=['ChatQueueReport','report_chat_queue','uniqueid','lodash','util','moment','bluebird','./chatQueueReport.attributes','define'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x26c138,_0x47de78){_0x26c138=_0x26c138-0x0;var _0x4f36cd=_0xe14b[_0x26c138];return _0x4f36cd;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var attributes=require(_0xbe14('0x4'));module['exports']=function(_0x496c04,_0x1833e3){return _0x496c04[_0xbe14('0x5')](_0xbe14('0x6'),attributes,{'tableName':_0xbe14('0x7'),'paranoid':![],'indexes':[{'name':_0xbe14('0x8'),'fields':[_0xbe14('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['define','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3690de,_0xaad404){var _0x9737de=function(_0x4bc616){while(--_0x4bc616){_0x3690de['push'](_0x3690de['shift']());}};_0x9737de(++_0xaad404);}(_0x7217,0x19e));var _0x7721=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7217[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x472a96,_0xce17f9){return _0x472a96[_0x7721('0x6')](_0x7721('0x7'),attributes,{'tableName':_0x7721('0x8'),'paranoid':![],'indexes':[{'name':_0x7721('0x9'),'fields':[_0x7721('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 408ed1f..a63d898 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 _0x2675=['http','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatQueueReport','create','body','options','then','info','stringify','ChatQueueReport','update','raw','where','attributes','limit','UpdateChatQueueReport','lodash','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x20ca5a,_0x1b2de0){var _0x421b96=function(_0x2f60a9){while(--_0x2f60a9){_0x20ca5a['push'](_0x20ca5a['shift']());}};_0x421b96(++_0x1b2de0);}(_0x2675,0x75));var _0x5267=function(_0x5e10d6,_0x2380b){_0x5e10d6=_0x5e10d6-0x0;var _0x148a09=_0x2675[_0x5e10d6];return _0x148a09;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var db=require(_0x5267('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5267('0x3'))(_0x5267('0x4'));var config=require('../../config/environment');var jayson=require(_0x5267('0x5'));var client=jayson[_0x5267('0x6')][_0x5267('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10f92c,_0x20f065,_0xc56cd5){return new BPromise(function(_0x527c16,_0x9e0a27){return client[_0x5267('0x8')](_0x10f92c,_0xc56cd5)['then'](function(_0x799fcc){logger['info'](_0x5267('0x9'),_0x20f065,_0x5267('0xa'));logger[_0x5267('0xb')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x20f065,_0x5267('0xa'),JSON['stringify'](_0x799fcc));if(_0x799fcc[_0x5267('0xc')]){if(_0x799fcc['error'][_0x5267('0xd')]===0x1f4){logger[_0x5267('0xc')](_0x5267('0x9'),_0x20f065,_0x799fcc[_0x5267('0xc')][_0x5267('0xe')]);return _0x9e0a27(_0x799fcc[_0x5267('0xc')][_0x5267('0xe')]);}logger[_0x5267('0xc')](_0x5267('0x9'),_0x20f065,_0x799fcc[_0x5267('0xc')][_0x5267('0xe')]);return _0x527c16(_0x799fcc[_0x5267('0xc')][_0x5267('0xe')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x20f065,_0x5267('0xa'));_0x527c16(_0x799fcc[_0x5267('0xf')][_0x5267('0xe')]);}})[_0x5267('0x10')](function(_0x46b2c2){logger[_0x5267('0xc')](_0x5267('0x9'),_0x20f065,_0x46b2c2);_0x9e0a27(_0x46b2c2);});});}exports[_0x5267('0x11')]=function(_0x15d81e){var _0xb1c97a=this;return new Promise(function(_0x376387,_0x1ab03){return db['ChatQueueReport'][_0x5267('0x12')](_0x15d81e[_0x5267('0x13')],{'raw':_0x15d81e['options']?_0x15d81e[_0x5267('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x5267('0x15')](function(_0x1019e7){logger[_0x5267('0x16')](_0x5267('0x11'),_0x15d81e);logger[_0x5267('0xb')]('CreateChatQueueReport',_0x15d81e,JSON[_0x5267('0x17')](_0x1019e7));_0x376387(_0x1019e7);})['catch'](function(_0xa32663){logger[_0x5267('0xc')](_0x5267('0x11'),_0xa32663['message'],_0x15d81e);_0x1ab03(_0xb1c97a['error'](0x1f4,_0xa32663['message']));});});};exports['UpdateChatQueueReport']=function(_0x5ea6a6){var _0x26c7f8=this;return new Promise(function(_0x399e64,_0x2d761d){return db[_0x5267('0x18')][_0x5267('0x19')](_0x5ea6a6[_0x5267('0x13')],{'raw':_0x5ea6a6[_0x5267('0x14')]?_0x5ea6a6[_0x5267('0x14')][_0x5267('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ea6a6['options']?_0x5ea6a6['options'][_0x5267('0x1b')]||null:null,'attributes':_0x5ea6a6[_0x5267('0x14')]?_0x5ea6a6['options'][_0x5267('0x1c')]||null:null,'limit':_0x5ea6a6['options']?_0x5ea6a6['options'][_0x5267('0x1d')]||null:null})[_0x5267('0x15')](function(_0x1f33b7){logger[_0x5267('0x16')](_0x5267('0x1e'),_0x5ea6a6);logger['debug']('UpdateChatQueueReport',_0x5ea6a6,JSON[_0x5267('0x17')](_0x1f33b7));_0x399e64(_0x1f33b7);})[_0x5267('0x10')](function(_0x24496d){logger['error']('UpdateChatQueueReport',_0x24496d[_0x5267('0xe')],_0x5ea6a6);_0x2d761d(_0x26c7f8[_0x5267('0xc')](0x1f4,_0x24496d[_0x5267('0xe')]));});});}; \ No newline at end of file +var _0x31f0=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','update','where','attributes','limit','UpdateChatQueueReport','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x5219e4,_0x50cdef){var _0x390418=function(_0x589678){while(--_0x589678){_0x5219e4['push'](_0x5219e4['shift']());}};_0x390418(++_0x50cdef);}(_0x31f0,0xb7));var _0x031f=function(_0x2097d9,_0x387d28){_0x2097d9=_0x2097d9-0x0;var _0x35445c=_0x31f0[_0x2097d9];return _0x35445c;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var db=require(_0x031f('0x3'))['db'];var utils=require(_0x031f('0x4'));var logger=require(_0x031f('0x5'))('rpc');var config=require(_0x031f('0x6'));var jayson=require(_0x031f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56328c,_0x3dc98e,_0x487e65){return new BPromise(function(_0x365f59,_0x4300b4){return client[_0x031f('0x8')](_0x56328c,_0x487e65)[_0x031f('0x9')](function(_0x4d47c5){logger[_0x031f('0xa')](_0x031f('0xb'),_0x3dc98e,_0x031f('0xc'));logger[_0x031f('0xd')](_0x031f('0xe'),_0x3dc98e,_0x031f('0xc'),JSON[_0x031f('0xf')](_0x4d47c5));if(_0x4d47c5[_0x031f('0x10')]){if(_0x4d47c5['error'][_0x031f('0x11')]===0x1f4){logger[_0x031f('0x10')](_0x031f('0xb'),_0x3dc98e,_0x4d47c5[_0x031f('0x10')][_0x031f('0x12')]);return _0x4300b4(_0x4d47c5[_0x031f('0x10')][_0x031f('0x12')]);}logger['error'](_0x031f('0xb'),_0x3dc98e,_0x4d47c5[_0x031f('0x10')][_0x031f('0x12')]);return _0x365f59(_0x4d47c5[_0x031f('0x10')][_0x031f('0x12')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3dc98e,_0x031f('0xc'));_0x365f59(_0x4d47c5[_0x031f('0x13')][_0x031f('0x12')]);}})[_0x031f('0x14')](function(_0x5196b1){logger[_0x031f('0x10')](_0x031f('0xb'),_0x3dc98e,_0x5196b1);_0x4300b4(_0x5196b1);});});}exports['CreateChatQueueReport']=function(_0xcdae16){var _0x535e70=this;return new Promise(function(_0x421f75,_0x5f2199){return db[_0x031f('0x15')][_0x031f('0x16')](_0xcdae16[_0x031f('0x17')],{'raw':_0xcdae16[_0x031f('0x18')]?_0xcdae16[_0x031f('0x18')][_0x031f('0x19')]===undefined?!![]:![]:!![]})[_0x031f('0x9')](function(_0x345bde){logger[_0x031f('0xa')]('CreateChatQueueReport',_0xcdae16);logger[_0x031f('0xd')](_0x031f('0x1a'),_0xcdae16,JSON[_0x031f('0xf')](_0x345bde));_0x421f75(_0x345bde);})['catch'](function(_0x5c4184){logger[_0x031f('0x10')]('CreateChatQueueReport',_0x5c4184[_0x031f('0x12')],_0xcdae16);_0x5f2199(_0x535e70['error'](0x1f4,_0x5c4184['message']));});});};exports['UpdateChatQueueReport']=function(_0x971691){var _0x12c406=this;return new Promise(function(_0x2920cd,_0x4c8126){return db['ChatQueueReport'][_0x031f('0x1b')](_0x971691['body'],{'raw':_0x971691[_0x031f('0x18')]?_0x971691[_0x031f('0x18')][_0x031f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x971691['options']?_0x971691[_0x031f('0x18')][_0x031f('0x1c')]||null:null,'attributes':_0x971691['options']?_0x971691[_0x031f('0x18')][_0x031f('0x1d')]||null:null,'limit':_0x971691[_0x031f('0x18')]?_0x971691['options'][_0x031f('0x1e')]||null:null})[_0x031f('0x9')](function(_0xb6ed6c){logger[_0x031f('0xa')](_0x031f('0x1f'),_0x971691);logger[_0x031f('0xd')]('UpdateChatQueueReport',_0x971691,JSON[_0x031f('0xf')](_0xb6ed6c));_0x2920cd(_0xb6ed6c);})[_0x031f('0x14')](function(_0x34f249){logger[_0x031f('0x10')](_0x031f('0x1f'),_0x34f249[_0x031f('0x12')],_0x971691);_0x4c8126(_0x12c406[_0x031f('0x10')](0x1f4,_0x34f249[_0x031f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a62c177..8fd8e7e 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 _0xb281=['path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','create','put','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb281,0x1df));var _0x1b28=function(_0x191846,_0x37b154){_0x191846=_0x191846-0x0;var _0x16fbcc=_0xb281[_0x191846];return _0x16fbcc;};'use strict';var multer=require(_0x1b28('0x0'));var util=require('util');var path=require(_0x1b28('0x1'));var express=require(_0x1b28('0x2'));var router=express[_0x1b28('0x3')]();var auth=require(_0x1b28('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1b28('0x5'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x1b28('0x6')](),controller[_0x1b28('0x7')]);router['get'](_0x1b28('0x8'),auth['isAuthenticated'](),controller[_0x1b28('0x9')]);router[_0x1b28('0xa')](_0x1b28('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1b28('0x6')](),controller[_0x1b28('0xc')]);router[_0x1b28('0xd')]('/:id',auth[_0x1b28('0x6')](),controller['update']);router[_0x1b28('0xe')]('/:id',auth[_0x1b28('0x6')](),controller['destroy']);module[_0x1b28('0xf')]=router; \ No newline at end of file +var _0x88f1=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0x111a53,_0x37312b){var _0x49088b=function(_0x4b9b8e){while(--_0x4b9b8e){_0x111a53['push'](_0x111a53['shift']());}};_0x49088b(++_0x37312b);}(_0x88f1,0x177));var _0x188f=function(_0xa92101,_0x1a851a){_0xa92101=_0xa92101-0x0;var _0x220b9e=_0x88f1[_0xa92101];return _0x220b9e;};'use strict';var multer=require('multer');var util=require(_0x188f('0x0'));var path=require(_0x188f('0x1'));var express=require(_0x188f('0x2'));var router=express[_0x188f('0x3')]();var auth=require(_0x188f('0x4'));var interaction=require(_0x188f('0x5'));var config=require(_0x188f('0x6'));var controller=require(_0x188f('0x7'));router[_0x188f('0x8')]('/',auth[_0x188f('0x9')](),controller[_0x188f('0xa')]);router[_0x188f('0x8')]('/describe',auth[_0x188f('0x9')](),controller[_0x188f('0xb')]);router['get'](_0x188f('0xc'),auth[_0x188f('0x9')](),controller[_0x188f('0xd')]);router[_0x188f('0xe')]('/',auth[_0x188f('0x9')](),controller[_0x188f('0xf')]);router[_0x188f('0x10')]('/:id',auth[_0x188f('0x9')](),controller['update']);router[_0x188f('0x11')](_0x188f('0xc'),auth[_0x188f('0x9')](),controller[_0x188f('0x12')]);module[_0x188f('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 2e6a207..ccaae91 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 _0x272b=['queue','NOW','sequelize','exports','ENUM','agent'];(function(_0x148b06,_0x375597){var _0x222dbf=function(_0x5e8b5d){while(--_0x5e8b5d){_0x148b06['push'](_0x148b06['shift']());}};_0x222dbf(++_0x375597);}(_0x272b,0x1ca));var _0xb272=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0x272b[_0x390733];return _0x33beb9;};'use strict';var moment=require('moment');var Sequelize=require(_0xb272('0x0'));module[_0xb272('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb272('0x2')]('account',_0xb272('0x3'),'queue'),'allowNull':![],'defaultValue':_0xb272('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb272('0x5')]}}; \ No newline at end of file +var _0x4d3a=['NOW','moment','sequelize','STRING','ENUM','account','agent'];(function(_0x4fcd26,_0x563b57){var _0x28bb22=function(_0x54a01f){while(--_0x54a01f){_0x4fcd26['push'](_0x4fcd26['shift']());}};_0x28bb22(++_0x563b57);}(_0x4d3a,0x158));var _0xa4d3=function(_0x368eb4,_0x1512b3){_0x368eb4=_0x368eb4-0x0;var _0x398603=_0x4d3a[_0x368eb4];return _0x398603;};'use strict';var moment=require(_0xa4d3('0x0'));var Sequelize=require(_0xa4d3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa4d3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa4d3('0x3')](_0xa4d3('0x4'),_0xa4d3('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xa4d3('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index de23676..b6f60ca 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 _0xd0ea=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','name','send','index','ChatTransferReport','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','day','add','merge','where','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy','describe','request-promise','moment','bluebird'];(function(_0x10e913,_0x437629){var _0x143f77=function(_0x4e81b6){while(--_0x4e81b6){_0x10e913['push'](_0x10e913['shift']());}};_0x143f77(++_0x437629);}(_0xd0ea,0x81));var _0xad0e=function(_0x2b0275,_0x3fe1fe){_0x2b0275=_0x2b0275-0x0;var _0x43708e=_0xd0ea[_0x2b0275];return _0x43708e;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xad0e('0x0'));var moment=require(_0xad0e('0x1'));var BPromise=require(_0xad0e('0x2'));var Mustache=require('mustache');var util=require(_0xad0e('0x3'));var path=require(_0xad0e('0x4'));var sox=require(_0xad0e('0x5'));var csv=require(_0xad0e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xad0e('0x7'));var squel=require(_0xad0e('0x8'));var crypto=require(_0xad0e('0x9'));var jsforce=require(_0xad0e('0xa'));var deskjs=require(_0xad0e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xad0e('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xad0e('0xd'))('api');var utils=require('../../config/utils');var config=require(_0xad0e('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a3693,_0x2cecdd){_0x2cecdd=_0x2cecdd||0xcc;return function(_0x29fd36){if(_0x29fd36){return _0x4a3693[_0xad0e('0xf')](_0x2cecdd);}return _0x4a3693[_0xad0e('0x10')](_0x2cecdd)[_0xad0e('0x11')]();};}function respondWithResult(_0x22f897,_0x139db0){_0x139db0=_0x139db0||0xc8;return function(_0x4698d8){if(_0x4698d8){return _0x22f897[_0xad0e('0x10')](_0x139db0)['json'](_0x4698d8);}};}function respondWithFilteredResult(_0x393e5a,_0x26936f){return function(_0x57140f){if(_0x57140f){var _0x362df2=_0x57140f[_0xad0e('0x12')],_0x60bd4f=_0x26936f[_0xad0e('0x13')],_0x2c9bf4=_0x26936f['offset']+_0x26936f[_0xad0e('0x14')],_0x34e9cf;if(_0x2c9bf4>=_0x362df2){_0x2c9bf4=_0x362df2;_0x34e9cf=0xc8;}else{_0x34e9cf=0xce;}_0x393e5a[_0xad0e('0x10')](_0x34e9cf);return _0x393e5a[_0xad0e('0x15')](_0xad0e('0x16'),_0x60bd4f+'-'+_0x2c9bf4+'/'+_0x362df2)[_0xad0e('0x17')](_0x57140f);}return null;};}function patchUpdates(_0x18a4ee){return function(_0x32b387){try{jsonpatch['apply'](_0x32b387,_0x18a4ee,!![]);}catch(_0x1ad0ac){return BPromise[_0xad0e('0x18')](_0x1ad0ac);}return _0x32b387[_0xad0e('0x19')]();};}function saveUpdates(_0x14968d,_0x5514f8){return function(_0x51a966){if(_0x51a966){return _0x51a966[_0xad0e('0x1a')](_0x14968d)['then'](function(_0x1d7ddd){return _0x1d7ddd;});}return null;};}function removeEntity(_0x242e55,_0x266497){return function(_0x2091b5){if(_0x2091b5){return _0x2091b5['destroy']()[_0xad0e('0x1b')](function(){_0x242e55[_0xad0e('0x10')](0xcc)[_0xad0e('0x11')]();});}};}function handleEntityNotFound(_0x12c398,_0x26e164){return function(_0x1c03b5){if(!_0x1c03b5){_0x12c398[_0xad0e('0xf')](0x194);}return _0x1c03b5;};}function handleError(_0x46a89a,_0x2fe374){_0x2fe374=_0x2fe374||0x1f4;return function(_0x317d70){logger['error'](_0x317d70['stack']);if(_0x317d70[_0xad0e('0x1c')]){delete _0x317d70[_0xad0e('0x1c')];}_0x46a89a[_0xad0e('0x10')](_0x2fe374)[_0xad0e('0x1d')](_0x317d70);};}exports[_0xad0e('0x1e')]=function(_0x4c0c82,_0x3fc7ce){var _0xf089da={},_0x5dc625={},_0x89f214={'count':0x0,'rows':[]};var _0x1dd99b=db[_0xad0e('0x1f')]['rawAttributes'];_0x5dc625[_0xad0e('0x20')]=_['keys'](_0x1dd99b);var _0x1f565f={'dateStart':_0x4c0c82[_0xad0e('0x21')][_0xad0e('0x22')],'dateEnd':_0x4c0c82[_0xad0e('0x21')][_0xad0e('0x23')]};delete _0x4c0c82[_0xad0e('0x21')]['dateStart'];delete _0x4c0c82[_0xad0e('0x21')][_0xad0e('0x23')];_0x5dc625[_0xad0e('0x21')]=_[_0xad0e('0x24')](_0x4c0c82[_0xad0e('0x21')]);_0x5dc625['filters']=_[_0xad0e('0x25')](_0x5dc625['model'],_0x5dc625['query']);_0xf089da[_0xad0e('0x26')]=_[_0xad0e('0x25')](_0x5dc625[_0xad0e('0x20')],qs['fields'](_0x4c0c82[_0xad0e('0x21')][_0xad0e('0x27')]));_0xf089da[_0xad0e('0x26')]=_0xf089da[_0xad0e('0x26')][_0xad0e('0x28')]?_0xf089da[_0xad0e('0x26')]:_0x5dc625[_0xad0e('0x20')];if(!_0x4c0c82[_0xad0e('0x21')][_0xad0e('0x29')](_0xad0e('0x2a'))){_0xf089da[_0xad0e('0x14')]=qs[_0xad0e('0x14')](_0x4c0c82[_0xad0e('0x21')][_0xad0e('0x14')]);_0xf089da[_0xad0e('0x13')]=qs[_0xad0e('0x13')](_0x4c0c82['query'][_0xad0e('0x13')]);}_0xf089da[_0xad0e('0x2b')]=qs['sort'](_0x4c0c82[_0xad0e('0x21')][_0xad0e('0x2c')]);_0xf089da['where']=qs[_0xad0e('0x2d')](_[_0xad0e('0x2e')](_0x4c0c82['query'],_0x5dc625[_0xad0e('0x2d')]));if(_0x1f565f[_0xad0e('0x22')]){if(_0x1f565f['dateEnd']){_0x1f565f['dateEnd']=moment(_0x1f565f['dateEnd'])['add'](0x1,_0xad0e('0x2f'));}else{_0x1f565f[_0xad0e('0x23')]=moment(_0x1f565f[_0xad0e('0x22')])[_0xad0e('0x30')](0x1,_0xad0e('0x2f'));}_[_0xad0e('0x31')](_0xf089da[_0xad0e('0x32')],{'createdAt':{'$gte':_0x1f565f[_0xad0e('0x22')],'$lte':_0x1f565f['dateEnd']}});}if(_0x4c0c82[_0xad0e('0x21')]['filter']){_0xf089da[_0xad0e('0x32')]=_[_0xad0e('0x31')](_0xf089da[_0xad0e('0x32')],{'$or':_['map'](_0xf089da[_0xad0e('0x26')],function(_0x1c3922){var _0x1eb44c={};_0x1eb44c[_0x1c3922]={'$like':'%'+_0x4c0c82[_0xad0e('0x21')][_0xad0e('0x33')]+'%'};return _0x1eb44c;})});}_0xf089da=_[_0xad0e('0x31')]({},_0xf089da,_0x4c0c82[_0xad0e('0x34')]);var _0x5e4fe9={'where':_0xf089da[_0xad0e('0x32')]};return db[_0xad0e('0x1f')][_0xad0e('0x12')](_0x5e4fe9)[_0xad0e('0x1b')](function(_0x367bae){_0x89f214[_0xad0e('0x12')]=_0x367bae;if(_0x4c0c82[_0xad0e('0x21')][_0xad0e('0x35')]){_0xf089da[_0xad0e('0x36')]=[{'all':!![]}];}return db[_0xad0e('0x1f')][_0xad0e('0x37')](_0xf089da);})[_0xad0e('0x1b')](function(_0x1ca7bd){_0x89f214[_0xad0e('0x38')]=_0x1ca7bd;return _0x89f214;})[_0xad0e('0x1b')](respondWithFilteredResult(_0x3fc7ce,_0xf089da))[_0xad0e('0x39')](handleError(_0x3fc7ce,null));};exports[_0xad0e('0x3a')]=function(_0x3c78f9,_0x1eda71){var _0x49fe5f={'raw':!![],'where':{'id':_0x3c78f9[_0xad0e('0x3b')]['id']}},_0x10988e={};_0x10988e['model']=_[_0xad0e('0x24')](db[_0xad0e('0x1f')][_0xad0e('0x3c')]);_0x10988e['query']=_[_0xad0e('0x24')](_0x3c78f9[_0xad0e('0x21')]);_0x10988e[_0xad0e('0x2d')]=_[_0xad0e('0x25')](_0x10988e[_0xad0e('0x20')],_0x10988e[_0xad0e('0x21')]);_0x49fe5f[_0xad0e('0x26')]=_[_0xad0e('0x25')](_0x10988e[_0xad0e('0x20')],qs[_0xad0e('0x27')](_0x3c78f9['query']['fields']));_0x49fe5f['attributes']=_0x49fe5f[_0xad0e('0x26')][_0xad0e('0x28')]?_0x49fe5f[_0xad0e('0x26')]:_0x10988e[_0xad0e('0x20')];if(_0x3c78f9[_0xad0e('0x21')][_0xad0e('0x35')]){_0x49fe5f['include']=[{'all':!![]}];}_0x49fe5f=_['merge']({},_0x49fe5f,_0x3c78f9[_0xad0e('0x34')]);return db[_0xad0e('0x1f')]['find'](_0x49fe5f)[_0xad0e('0x1b')](handleEntityNotFound(_0x1eda71,null))[_0xad0e('0x1b')](respondWithResult(_0x1eda71,null))[_0xad0e('0x39')](handleError(_0x1eda71,null));};exports['create']=function(_0x18a914,_0x34e824){return db[_0xad0e('0x1f')][_0xad0e('0x3d')](_0x18a914[_0xad0e('0x3e')],{})[_0xad0e('0x1b')](respondWithResult(_0x34e824,0xc9))[_0xad0e('0x39')](handleError(_0x34e824,null));};exports['update']=function(_0x591824,_0x524344){if(_0x591824[_0xad0e('0x3e')]['id']){delete _0x591824[_0xad0e('0x3e')]['id'];}return db[_0xad0e('0x1f')][_0xad0e('0x3f')]({'where':{'id':_0x591824[_0xad0e('0x3b')]['id']}})[_0xad0e('0x1b')](handleEntityNotFound(_0x524344,null))[_0xad0e('0x1b')](saveUpdates(_0x591824['body'],null))[_0xad0e('0x1b')](respondWithResult(_0x524344,null))[_0xad0e('0x39')](handleError(_0x524344,null));};exports[_0xad0e('0x40')]=function(_0x442247,_0x582d9c){return db[_0xad0e('0x1f')][_0xad0e('0x3f')]({'where':{'id':_0x442247[_0xad0e('0x3b')]['id']}})[_0xad0e('0x1b')](handleEntityNotFound(_0x582d9c,null))[_0xad0e('0x1b')](removeEntity(_0x582d9c,null))[_0xad0e('0x39')](handleError(_0x582d9c,null));};exports[_0xad0e('0x41')]=function(_0x2c703b,_0x2e0d84){return db[_0xad0e('0x1f')][_0xad0e('0x41')]()['then'](respondWithResult(_0x2e0d84,null))['catch'](handleError(_0x2e0d84,null));}; \ No newline at end of file +var _0x105d=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','add','day','merge','filter','options','count','then','include','ChatTransferReport','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','limit','set','reject','error','stack','name','send','model','keys','query','dateStart','dateEnd'];(function(_0x42a007,_0x1bfb3d){var _0xe43fab=function(_0x4ce4e1){while(--_0x4ce4e1){_0x42a007['push'](_0x42a007['shift']());}};_0xe43fab(++_0x1bfb3d);}(_0x105d,0xa5));var _0xd105=function(_0x5cca84,_0x3889cd){_0x5cca84=_0x5cca84-0x0;var _0x129dad=_0x105d[_0x5cca84];return _0x129dad;};'use strict';var jsonpatch=require(_0xd105('0x0'));var rp=require(_0xd105('0x1'));var moment=require(_0xd105('0x2'));var BPromise=require(_0xd105('0x3'));var Mustache=require(_0xd105('0x4'));var util=require('util');var path=require(_0xd105('0x5'));var sox=require(_0xd105('0x6'));var csv=require('to-csv');var ejs=require(_0xd105('0x7'));var fs=require('fs');var _=require(_0xd105('0x8'));var squel=require(_0xd105('0x9'));var crypto=require(_0xd105('0xa'));var jsforce=require(_0xd105('0xb'));var deskjs=require(_0xd105('0xc'));var toCsv=require(_0xd105('0xd'));var querystring=require(_0xd105('0xe'));var Papa=require(_0xd105('0xf'));var qs=require(_0xd105('0x10'));var logger=require(_0xd105('0x11'))(_0xd105('0x12'));var utils=require('../../config/utils');var config=require(_0xd105('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8ccbbc,_0x20a0f7){_0x20a0f7=_0x20a0f7||0xcc;return function(_0xb2089e){if(_0xb2089e){return _0x8ccbbc[_0xd105('0x14')](_0x20a0f7);}return _0x8ccbbc[_0xd105('0x15')](_0x20a0f7)[_0xd105('0x16')]();};}function respondWithResult(_0x5df788,_0x1160e2){_0x1160e2=_0x1160e2||0xc8;return function(_0x154e07){if(_0x154e07){return _0x5df788[_0xd105('0x15')](_0x1160e2)['json'](_0x154e07);}};}function respondWithFilteredResult(_0x3ab26c,_0x365b66){return function(_0x5a5c48){if(_0x5a5c48){var _0x498290=_0x5a5c48['count'],_0x155580=_0x365b66[_0xd105('0x17')],_0x3e8592=_0x365b66[_0xd105('0x17')]+_0x365b66[_0xd105('0x18')],_0x5cb332;if(_0x3e8592>=_0x498290){_0x3e8592=_0x498290;_0x5cb332=0xc8;}else{_0x5cb332=0xce;}_0x3ab26c[_0xd105('0x15')](_0x5cb332);return _0x3ab26c[_0xd105('0x19')]('Content-Range',_0x155580+'-'+_0x3e8592+'/'+_0x498290)['json'](_0x5a5c48);}return null;};}function patchUpdates(_0x158371){return function(_0x3ad6c3){try{jsonpatch['apply'](_0x3ad6c3,_0x158371,!![]);}catch(_0x2671ad){return BPromise[_0xd105('0x1a')](_0x2671ad);}return _0x3ad6c3['save']();};}function saveUpdates(_0x5d05b4,_0x60c72e){return function(_0x3b99f6){if(_0x3b99f6){return _0x3b99f6['update'](_0x5d05b4)['then'](function(_0x50bffe){return _0x50bffe;});}return null;};}function removeEntity(_0x336140,_0x1da46e){return function(_0x33e281){if(_0x33e281){return _0x33e281['destroy']()['then'](function(){_0x336140[_0xd105('0x15')](0xcc)[_0xd105('0x16')]();});}};}function handleEntityNotFound(_0x160d7c,_0x4761ac){return function(_0x472843){if(!_0x472843){_0x160d7c['sendStatus'](0x194);}return _0x472843;};}function handleError(_0x4ce7a3,_0x22883e){_0x22883e=_0x22883e||0x1f4;return function(_0x2aa3cc){logger[_0xd105('0x1b')](_0x2aa3cc[_0xd105('0x1c')]);if(_0x2aa3cc[_0xd105('0x1d')]){delete _0x2aa3cc[_0xd105('0x1d')];}_0x4ce7a3[_0xd105('0x15')](_0x22883e)[_0xd105('0x1e')](_0x2aa3cc);};}exports['index']=function(_0x5a4b5f,_0x1d9762){var _0x156d31={},_0x25c075={},_0x216345={'count':0x0,'rows':[]};var _0x5d77e0=db['ChatTransferReport']['rawAttributes'];_0x25c075[_0xd105('0x1f')]=_[_0xd105('0x20')](_0x5d77e0);var _0x44a9d1={'dateStart':_0x5a4b5f[_0xd105('0x21')][_0xd105('0x22')],'dateEnd':_0x5a4b5f[_0xd105('0x21')][_0xd105('0x23')]};delete _0x5a4b5f[_0xd105('0x21')][_0xd105('0x22')];delete _0x5a4b5f[_0xd105('0x21')]['dateEnd'];_0x25c075[_0xd105('0x21')]=_[_0xd105('0x20')](_0x5a4b5f[_0xd105('0x21')]);_0x25c075[_0xd105('0x24')]=_[_0xd105('0x25')](_0x25c075['model'],_0x25c075[_0xd105('0x21')]);_0x156d31[_0xd105('0x26')]=_['intersection'](_0x25c075['model'],qs[_0xd105('0x27')](_0x5a4b5f[_0xd105('0x21')][_0xd105('0x27')]));_0x156d31[_0xd105('0x26')]=_0x156d31['attributes'][_0xd105('0x28')]?_0x156d31['attributes']:_0x25c075['model'];if(!_0x5a4b5f[_0xd105('0x21')][_0xd105('0x29')](_0xd105('0x2a'))){_0x156d31[_0xd105('0x18')]=qs[_0xd105('0x18')](_0x5a4b5f[_0xd105('0x21')][_0xd105('0x18')]);_0x156d31[_0xd105('0x17')]=qs[_0xd105('0x17')](_0x5a4b5f[_0xd105('0x21')][_0xd105('0x17')]);}_0x156d31['order']=qs['sort'](_0x5a4b5f[_0xd105('0x21')][_0xd105('0x2b')]);_0x156d31[_0xd105('0x2c')]=qs[_0xd105('0x24')](_['pick'](_0x5a4b5f[_0xd105('0x21')],_0x25c075[_0xd105('0x24')]));if(_0x44a9d1['dateStart']){if(_0x44a9d1[_0xd105('0x23')]){_0x44a9d1['dateEnd']=moment(_0x44a9d1[_0xd105('0x23')])[_0xd105('0x2d')](0x1,_0xd105('0x2e'));}else{_0x44a9d1[_0xd105('0x23')]=moment(_0x44a9d1[_0xd105('0x22')])['add'](0x1,_0xd105('0x2e'));}_[_0xd105('0x2f')](_0x156d31['where'],{'createdAt':{'$gte':_0x44a9d1[_0xd105('0x22')],'$lte':_0x44a9d1['dateEnd']}});}if(_0x5a4b5f['query'][_0xd105('0x30')]){_0x156d31[_0xd105('0x2c')]=_['merge'](_0x156d31['where'],{'$or':_['map'](_0x156d31[_0xd105('0x26')],function(_0x79a02e){var _0x144e7e={};_0x144e7e[_0x79a02e]={'$like':'%'+_0x5a4b5f[_0xd105('0x21')]['filter']+'%'};return _0x144e7e;})});}_0x156d31=_[_0xd105('0x2f')]({},_0x156d31,_0x5a4b5f[_0xd105('0x31')]);var _0x40d20d={'where':_0x156d31[_0xd105('0x2c')]};return db['ChatTransferReport'][_0xd105('0x32')](_0x40d20d)[_0xd105('0x33')](function(_0x590705){_0x216345[_0xd105('0x32')]=_0x590705;if(_0x5a4b5f['query']['includeAll']){_0x156d31[_0xd105('0x34')]=[{'all':!![]}];}return db[_0xd105('0x35')][_0xd105('0x36')](_0x156d31);})[_0xd105('0x33')](function(_0x17ecc6){_0x216345[_0xd105('0x37')]=_0x17ecc6;return _0x216345;})['then'](respondWithFilteredResult(_0x1d9762,_0x156d31))[_0xd105('0x38')](handleError(_0x1d9762,null));};exports[_0xd105('0x39')]=function(_0x82f3d7,_0x402b77){var _0x41b7b5={'raw':!![],'where':{'id':_0x82f3d7[_0xd105('0x3a')]['id']}},_0x3a96b5={};_0x3a96b5['model']=_[_0xd105('0x20')](db[_0xd105('0x35')][_0xd105('0x3b')]);_0x3a96b5['query']=_[_0xd105('0x20')](_0x82f3d7[_0xd105('0x21')]);_0x3a96b5['filters']=_[_0xd105('0x25')](_0x3a96b5[_0xd105('0x1f')],_0x3a96b5['query']);_0x41b7b5[_0xd105('0x26')]=_[_0xd105('0x25')](_0x3a96b5[_0xd105('0x1f')],qs['fields'](_0x82f3d7['query'][_0xd105('0x27')]));_0x41b7b5[_0xd105('0x26')]=_0x41b7b5[_0xd105('0x26')][_0xd105('0x28')]?_0x41b7b5[_0xd105('0x26')]:_0x3a96b5[_0xd105('0x1f')];if(_0x82f3d7[_0xd105('0x21')][_0xd105('0x3c')]){_0x41b7b5[_0xd105('0x34')]=[{'all':!![]}];}_0x41b7b5=_[_0xd105('0x2f')]({},_0x41b7b5,_0x82f3d7['options']);return db[_0xd105('0x35')][_0xd105('0x3d')](_0x41b7b5)[_0xd105('0x33')](handleEntityNotFound(_0x402b77,null))[_0xd105('0x33')](respondWithResult(_0x402b77,null))[_0xd105('0x38')](handleError(_0x402b77,null));};exports[_0xd105('0x3e')]=function(_0x1f57b3,_0x14db2a){return db[_0xd105('0x35')]['create'](_0x1f57b3[_0xd105('0x3f')],{})['then'](respondWithResult(_0x14db2a,0xc9))['catch'](handleError(_0x14db2a,null));};exports[_0xd105('0x40')]=function(_0x204d64,_0x4b4e5b){if(_0x204d64['body']['id']){delete _0x204d64[_0xd105('0x3f')]['id'];}return db['ChatTransferReport'][_0xd105('0x3d')]({'where':{'id':_0x204d64['params']['id']}})[_0xd105('0x33')](handleEntityNotFound(_0x4b4e5b,null))['then'](saveUpdates(_0x204d64[_0xd105('0x3f')],null))[_0xd105('0x33')](respondWithResult(_0x4b4e5b,null))[_0xd105('0x38')](handleError(_0x4b4e5b,null));};exports[_0xd105('0x41')]=function(_0x539456,_0x29b423){return db[_0xd105('0x35')][_0xd105('0x3d')]({'where':{'id':_0x539456[_0xd105('0x3a')]['id']}})['then'](handleEntityNotFound(_0x29b423,null))[_0xd105('0x33')](removeEntity(_0x29b423,null))[_0xd105('0x38')](handleError(_0x29b423,null));};exports[_0xd105('0x42')]=function(_0xa994d,_0x2e3767){return db['ChatTransferReport'][_0xd105('0x42')]()[_0xd105('0x33')](respondWithResult(_0x2e3767,null))['catch'](handleError(_0x2e3767,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 34112e9..391e966 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 _0xd908=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','./chatTransferReport.attributes','exports'];(function(_0x18211c,_0x5da85f){var _0x519e10=function(_0x832252){while(--_0x832252){_0x18211c['push'](_0x18211c['shift']());}};_0x519e10(++_0x5da85f);}(_0xd908,0xdc));var _0x8d90=function(_0x7130d,_0x3c5f62){_0x7130d=_0x7130d-0x0;var _0x4fcc9c=_0xd908[_0x7130d];return _0x4fcc9c;};'use strict';var _=require(_0x8d90('0x0'));var util=require(_0x8d90('0x1'));var logger=require(_0x8d90('0x2'))('api');var moment=require(_0x8d90('0x3'));var BPromise=require(_0x8d90('0x4'));var rp=require(_0x8d90('0x5'));var attributes=require(_0x8d90('0x6'));module[_0x8d90('0x7')]=function(_0x2d36ec,_0x4425a0){return _0x2d36ec[_0x8d90('0x8')](_0x8d90('0x9'),attributes,{'tableName':_0x8d90('0xa'),'paranoid':![],'indexes':[{'name':_0x8d90('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x77cb=['lodash','util','../../config/logger','moment','request-promise','exports','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x45c148,_0x5425c7){var _0x17ab7b=function(_0x1293a3){while(--_0x1293a3){_0x45c148['push'](_0x45c148['shift']());}};_0x17ab7b(++_0x5425c7);}(_0x77cb,0x1ea));var _0xb77c=function(_0x2397c4,_0x531dec){_0x2397c4=_0x2397c4-0x0;var _0x393e7e=_0x77cb[_0x2397c4];return _0x393e7e;};'use strict';var _=require(_0xb77c('0x0'));var util=require(_0xb77c('0x1'));var logger=require(_0xb77c('0x2'))('api');var moment=require(_0xb77c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb77c('0x4'));var attributes=require('./chatTransferReport.attributes');module[_0xb77c('0x5')]=function(_0x5c9234,_0x3b9354){return _0x5c9234[_0xb77c('0x6')](_0xb77c('0x7'),attributes,{'tableName':_0xb77c('0x8'),'paranoid':![],'indexes':[{'name':_0xb77c('0x9'),'fields':[_0xb77c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ead67f6..e5fbdf9 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 _0xd76c=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatTransferReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd76c,0xc8));var _0xcd76=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0xd76c[_0x42ca15];return _0x1c6ded;};'use strict';var _=require(_0xcd76('0x0'));var util=require(_0xcd76('0x1'));var moment=require(_0xcd76('0x2'));var BPromise=require(_0xcd76('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xcd76('0x4'))['db'];var utils=require(_0xcd76('0x5'));var logger=require(_0xcd76('0x6'))('rpc');var config=require(_0xcd76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcd76('0x8')][_0xcd76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x475026,_0x365e66,_0x38b979){return new BPromise(function(_0x5cec8e,_0xb7d74b){return client[_0xcd76('0xa')](_0x475026,_0x38b979)[_0xcd76('0xb')](function(_0x3cad3f){logger[_0xcd76('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x365e66,_0xcd76('0xd'));logger[_0xcd76('0xe')](_0xcd76('0xf'),_0x365e66,_0xcd76('0xd'),JSON[_0xcd76('0x10')](_0x3cad3f));if(_0x3cad3f[_0xcd76('0x11')]){if(_0x3cad3f['error']['code']===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x365e66,_0x3cad3f[_0xcd76('0x11')][_0xcd76('0x12')]);return _0xb7d74b(_0x3cad3f[_0xcd76('0x11')]['message']);}logger['error'](_0xcd76('0x13'),_0x365e66,_0x3cad3f[_0xcd76('0x11')][_0xcd76('0x12')]);return _0x5cec8e(_0x3cad3f['error'][_0xcd76('0x12')]);}else{logger[_0xcd76('0xc')](_0xcd76('0x13'),_0x365e66,_0xcd76('0xd'));_0x5cec8e(_0x3cad3f[_0xcd76('0x14')]['message']);}})[_0xcd76('0x15')](function(_0x502390){logger[_0xcd76('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x365e66,_0x502390);_0xb7d74b(_0x502390);});});} \ No newline at end of file +var _0x2005=['../../config/logger','rpc','jayson/promise','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1c5d9d,_0x1e1bb1){var _0x498144=function(_0x1b5091){while(--_0x1b5091){_0x1c5d9d['push'](_0x1c5d9d['shift']());}};_0x498144(++_0x1e1bb1);}(_0x2005,0x186));var _0x5200=function(_0x45ca66,_0x47f5d2){_0x45ca66=_0x45ca66-0x0;var _0x329bdc=_0x2005[_0x45ca66];return _0x329bdc;};'use strict';var _=require('lodash');var util=require(_0x5200('0x0'));var moment=require(_0x5200('0x1'));var BPromise=require(_0x5200('0x2'));var rs=require(_0x5200('0x3'));var fs=require('fs');var db=require(_0x5200('0x4'))['db'];var utils=require(_0x5200('0x5'));var logger=require(_0x5200('0x6'))(_0x5200('0x7'));var config=require('../../config/environment');var jayson=require(_0x5200('0x8'));var client=jayson['client'][_0x5200('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8319,_0x4b393c,_0x2bf989){return new BPromise(function(_0xd42e36,_0x5e56f3){return client['request'](_0x4e8319,_0x2bf989)[_0x5200('0xa')](function(_0x29942b){logger[_0x5200('0xb')](_0x5200('0xc'),_0x4b393c,_0x5200('0xd'));logger[_0x5200('0xe')](_0x5200('0xf'),_0x4b393c,_0x5200('0xd'),JSON[_0x5200('0x10')](_0x29942b));if(_0x29942b[_0x5200('0x11')]){if(_0x29942b[_0x5200('0x11')][_0x5200('0x12')]===0x1f4){logger['error'](_0x5200('0xc'),_0x4b393c,_0x29942b[_0x5200('0x11')]['message']);return _0x5e56f3(_0x29942b[_0x5200('0x11')][_0x5200('0x13')]);}logger['error'](_0x5200('0xc'),_0x4b393c,_0x29942b[_0x5200('0x11')][_0x5200('0x13')]);return _0xd42e36(_0x29942b[_0x5200('0x11')][_0x5200('0x13')]);}else{logger[_0x5200('0xb')](_0x5200('0xc'),_0x4b393c,_0x5200('0xd'));_0xd42e36(_0x29942b[_0x5200('0x14')][_0x5200('0x13')]);}})[_0x5200('0x15')](function(_0x147b89){logger[_0x5200('0x11')](_0x5200('0xc'),_0x4b393c,_0x147b89);_0x5e56f3(_0x147b89);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 5045874..8d6fa3c 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 _0xac4a=['express','Router','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','/:id','post','create','update','delete','multer','util','path'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0xac4a,0x13f));var _0xaac4=function(_0x22d8ca,_0x2d8ba1){_0x22d8ca=_0x22d8ca-0x0;var _0x101c9e=_0xac4a[_0x22d8ca];return _0x101c9e;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var express=require(_0xaac4('0x3'));var router=express[_0xaac4('0x4')]();var auth=require(_0xaac4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaac4('0x6'));router[_0xaac4('0x7')]('/',auth[_0xaac4('0x8')](),controller['index']);router[_0xaac4('0x7')]('/describe',auth[_0xaac4('0x8')](),controller['describe']);router[_0xaac4('0x7')](_0xaac4('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xaac4('0xa')]('/',auth['isAuthenticated'](),controller[_0xaac4('0xb')]);router['put']('/:id',auth[_0xaac4('0x8')](),controller[_0xaac4('0xc')]);router[_0xaac4('0xd')](_0xaac4('0x9'),auth[_0xaac4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x757a=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x757a,0xde));var _0xa757=function(_0x2d025a,_0x31566){_0x2d025a=_0x2d025a-0x0;var _0x1965f6=_0x757a[_0x2d025a];return _0x1965f6;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa757('0x2'));var config=require(_0xa757('0x3'));var controller=require(_0xa757('0x4'));router[_0xa757('0x5')]('/',auth[_0xa757('0x6')](),controller[_0xa757('0x7')]);router['get'](_0xa757('0x8'),auth[_0xa757('0x6')](),controller['describe']);router[_0xa757('0x5')](_0xa757('0x9'),auth[_0xa757('0x6')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth['isAuthenticated'](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0x9'),auth[_0xa757('0x6')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index cdc50e5..1dfa3d3 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 _0x3fc6=['System','sequelize','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','ENUM','star','name','text','onlineForm','getDataValue','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa'];(function(_0x17501e,_0x9edfa3){var _0x5d1cc4=function(_0x1d666c){while(--_0x1d666c){_0x17501e['push'](_0x17501e['shift']());}};_0x5d1cc4(++_0x9edfa3);}(_0x3fc6,0x115));var _0x63fc=function(_0x224d03,_0x4be6b2){_0x224d03=_0x224d03-0x0;var _0x2a65e5=_0x3fc6[_0x224d03];return _0x2a65e5;};'use strict';var Sequelize=require(_0x63fc('0x0'));var rs=require('randomstring');module[_0x63fc('0x1')]={'name':{'type':Sequelize[_0x63fc('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x63fc('0x2')],'allowNull':![],'unique':_0x63fc('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x4')},'mapKeyOffline':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x63fc('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x5')},'customerAlias':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x63fc('0x2')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x63fc('0x2')],'allowNull':![],'defaultValue':_0x63fc('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x63fc('0x2')],'allowNull':![],'defaultValue':_0x63fc('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x63fc('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x63fc('0xa')),'defaultValue':_0x63fc('0xb')},'header_online':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0xc')},'start_chat_button':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0xd')},'offline_chat_button':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0xf')},'download_transcript':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x63fc('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x63fc('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x14')},'noteTitle':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x15')},'placeholderMessage':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x16')},'closingMessage':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x17')},'closingMessageButton':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0xe')},'skipMessageButton':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x63fc('0x18')](_0x63fc('0x19'),'thumb'),'defaultValue':_0x63fc('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x63fc('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x63fc('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x63fc('0x1a'),'type':_0x63fc('0x1b'),'required':!![]},'props':{'title':_0x63fc('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0x63fc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x63fc('0x4'),'type':_0x63fc('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x63fc('0x1c'))?JSON['parse'](this[_0x63fc('0x1d')]('onlineForm')):{};},'set':function(_0x184e5e){return this[_0x63fc('0x1e')](_0x63fc('0x1c'),JSON[_0x63fc('0x1f')](_0x184e5e));}},'offlineForm':{'type':Sequelize[_0x63fc('0x11')],'defaultValue':function(){return JSON[_0x63fc('0x1f')]({'items':[{'type':'input','props':{'title':_0x63fc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x63fc('0x4'),'type':_0x63fc('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x63fc('0x20')},'props':{'title':'Comments','helpText':_0x63fc('0x21')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x63fc('0x22'))?JSON[_0x63fc('0x23')](this['getDataValue'](_0x63fc('0x22'))):{};},'set':function(_0x380bea){return this[_0x63fc('0x1e')](_0x63fc('0x22'),JSON['stringify'](_0x380bea));}},'token':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x63fc('0x2')]},'forwardOffline':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x63fc('0x2')]},'waitingTitle':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x24')},'waitingMessage':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x26')},'offlineMessageBody':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x27')},'skipUnmanaged':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x28')},'sendUnmanaged':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x63fc('0x2')]},'notificationTemplate':{'type':Sequelize[_0x63fc('0x11')],'defaultValue':function(){return _0x63fc('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x63fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x2b')},'verticalAlignment':{'type':Sequelize[_0x63fc('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x63fc('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x63fc('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x63fc('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x63fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x63fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':_0x63fc('0x2d')},'systemAvatar':{'type':Sequelize[_0x63fc('0x11')]}}; \ No newline at end of file +var _0xe797=['star','TEXT','stringify','input','name','getDataValue','parse','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','sequelize','randomstring','exports','STRING','address','email','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','thumb'];(function(_0xa8f18e,_0x422e0b){var _0x191d59=function(_0x55ff21){while(--_0x55ff21){_0xa8f18e['push'](_0xa8f18e['shift']());}};_0x191d59(++_0x422e0b);}(_0xe797,0x12a));var _0x7e79=function(_0x550193,_0x50f021){_0x550193=_0x550193-0x0;var _0x4f93ed=_0xe797[_0x550193];return _0x4f93ed;};'use strict';var Sequelize=require(_0x7e79('0x0'));var rs=require(_0x7e79('0x1'));module[_0x7e79('0x2')]={'name':{'type':Sequelize[_0x7e79('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x7e79('0x3')],'allowNull':![],'unique':_0x7e79('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x7e79('0x5')},'key':{'type':Sequelize[_0x7e79('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7e79('0x3')],'allowNull':![],'defaultValue':_0x7e79('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7e79('0x3')],'allowNull':![],'defaultValue':_0x7e79('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7e79('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7e79('0xa')](_0x7e79('0xb'),_0x7e79('0xc')),'defaultValue':_0x7e79('0xb')},'header_online':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0xd')},'start_chat_button':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7e79('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x7e79('0x10')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7e79('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x14')},'noteTitle':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x15')},'closingMessage':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x16')},'closingMessageButton':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0xf')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x7e79('0xa')]('star',_0x7e79('0x17')),'defaultValue':_0x7e79('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x7e79('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7e79('0x19')],'defaultValue':function(){return JSON[_0x7e79('0x1a')]({'items':[{'type':_0x7e79('0x1b'),'variable':null,'config':{'placeholder':_0x7e79('0x1c'),'type':'text','required':!![]},'props':{'title':_0x7e79('0x1c'),'helpText':''}},{'type':_0x7e79('0x1b'),'props':{'title':_0x7e79('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x7e79('0x5'),'type':_0x7e79('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x7e79('0x1d')]('onlineForm')?JSON[_0x7e79('0x1e')](this['getDataValue'](_0x7e79('0x1f'))):{};},'set':function(_0x51bcf1){return this['setDataValue'](_0x7e79('0x1f'),JSON[_0x7e79('0x1a')](_0x51bcf1));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x7e79('0x1a')]({'items':[{'type':_0x7e79('0x1b'),'props':{'title':_0x7e79('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x7e79('0x5'),'type':'email'},'variable':null},{'type':_0x7e79('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x7e79('0x21'),'helpText':_0x7e79('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x7e79('0x1d')](_0x7e79('0x23'))?JSON[_0x7e79('0x1e')](this['getDataValue'](_0x7e79('0x23'))):{};},'set':function(_0xcbd3da){return this[_0x7e79('0x24')]('offlineForm',JSON['stringify'](_0xcbd3da));}},'token':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':function(){return rs[_0x7e79('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7e79('0x3')]},'waitingTitle':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x26')},'waitingMessage':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x28')},'skipUnmanaged':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x29')},'sendUnmanaged':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x7e79('0x19')]},'showAgentAvatar':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7e79('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7e79('0x2a');}},'notificationSound':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7e79('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x7e79('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':_0x7e79('0x2c')},'defaultTitle':{'type':Sequelize[_0x7e79('0x3')]},'customerAvatar':{'type':Sequelize[_0x7e79('0x19')]},'showCustomerAvatar':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7e79('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7e79('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7e79('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7e79('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x7e79('0x19')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index ccbcaec..e1429dc 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 _0x6956=['offlineMessageSubject','addInteraction','omit','Contact','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','License','increment','server/files/chat/iframe.js','utf8','x-forwarded-for','x-real-ip','connection','virtual','replace','alignment','verticalAlignment','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','fast-json-patch','moment','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','socket.io-emitter','localhost','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','ChatWebsite','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','sort','where','add','day','merge','filter','map','options','count','includeAll','include','rows','show','params','rawAttributes','length','body','find','destroy','describe','addDisposition','Disposition','create','getDispositions','findOne','order','pick','ChatWebsiteId','findAll','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','removeAnswers','filename','addAvatar','file','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','chat','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','ChatApplication','Applications','List','account','list','applications','orderBy','priority','Contacts','defaults','contact','firstName','lastName','referer','browser','version','unknown','format','%s\x20%s','device','vendor','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','get','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','user','pass','sendMail','\x22%s\x22\x20<%s>','email'];(function(_0x52e795,_0x49ffc4){var _0x4baca=function(_0x3b5bd5){while(--_0x3b5bd5){_0x52e795['push'](_0x52e795['shift']());}};_0x4baca(++_0x49ffc4);}(_0x6956,0x149));var _0x6695=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0x6956[_0x146837];return _0x3d7e60;};'use strict';var jsonpatch=require(_0x6695('0x0'));var rp=require('request-promise');var moment=require(_0x6695('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6695('0x2'));var path=require('path');var sox=require(_0x6695('0x3'));var csv=require('to-csv');var ejs=require(_0x6695('0x4'));var fs=require('fs');var _=require(_0x6695('0x5'));var squel=require(_0x6695('0x6'));var crypto=require(_0x6695('0x7'));var jsforce=require(_0x6695('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6695('0x9'));var querystring=require(_0x6695('0xa'));var Papa=require(_0x6695('0xb'));var qs=require(_0x6695('0xc'));var logger=require(_0x6695('0xd'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x6695('0xe'))({'host':_0x6695('0xf'),'port':0x18eb});require(_0x6695('0x10'))['register'](socket);var jayson=require(_0x6695('0x11'));var client=jayson[_0x6695('0x12')]['http']({'port':0x232c});var client9002=jayson[_0x6695('0x12')]['http']({'port':0x232a});var client9003=jayson['client'][_0x6695('0x13')]({'port':0x232b});function respondWithRpcPromise(_0x1e5f0e,_0x33af01,_0x2f5bb2,_0x8c678c){return new BPromise(function(_0x395267,_0x429137){var _0x2329f8=_0x8c678c||client;return _0x2329f8[_0x6695('0x14')](_0x1e5f0e,_0x2f5bb2)[_0x6695('0x15')](function(_0x2ca910){logger[_0x6695('0x16')](_0x6695('0x17'),_0x33af01,_0x6695('0x18'));logger[_0x6695('0x19')](_0x6695('0x1a'),_0x33af01,_0x6695('0x18'),JSON[_0x6695('0x1b')](_0x2ca910));if(_0x2ca910[_0x6695('0x1c')]){if(_0x2ca910['error'][_0x6695('0x1d')]===0x1f4){logger[_0x6695('0x1c')](_0x6695('0x17'),_0x33af01,_0x2ca910[_0x6695('0x1c')][_0x6695('0x1e')]);return _0x429137(_0x2ca910[_0x6695('0x1c')][_0x6695('0x1e')]);}logger[_0x6695('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x33af01,_0x2ca910[_0x6695('0x1c')][_0x6695('0x1e')]);return _0x395267(_0x2ca910['error']['message']);}else{logger[_0x6695('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x33af01,_0x6695('0x18'));_0x395267(_0x2ca910[_0x6695('0x1f')][_0x6695('0x1e')]);}})[_0x6695('0x20')](function(_0x34a724){logger[_0x6695('0x1c')](_0x6695('0x17'),_0x33af01,_0x34a724);_0x429137(_0x34a724);});});}function respondWithStatusCode(_0x198988,_0xa6004b){_0xa6004b=_0xa6004b||0xcc;return function(_0x4242dd){if(_0x4242dd){return _0x198988[_0x6695('0x21')](_0xa6004b);}return _0x198988[_0x6695('0x22')](_0xa6004b)[_0x6695('0x23')]();};}function respondWithResult(_0x42a1bc,_0xdccadc){_0xdccadc=_0xdccadc||0xc8;return function(_0x5ec429){if(_0x5ec429){return _0x42a1bc[_0x6695('0x22')](_0xdccadc)[_0x6695('0x24')](_0x5ec429);}};}function respondWithFilteredResult(_0x5b159a,_0x5a3b22){return function(_0x2941c1){if(_0x2941c1){var _0xb4aba6=_0x2941c1['count'],_0x25ca36=_0x5a3b22[_0x6695('0x25')],_0x4a885d=_0x5a3b22[_0x6695('0x25')]+_0x5a3b22[_0x6695('0x26')],_0x3c8c04;if(_0x4a885d>=_0xb4aba6){_0x4a885d=_0xb4aba6;_0x3c8c04=0xc8;}else{_0x3c8c04=0xce;}_0x5b159a[_0x6695('0x22')](_0x3c8c04);return _0x5b159a[_0x6695('0x27')](_0x6695('0x28'),_0x25ca36+'-'+_0x4a885d+'/'+_0xb4aba6)[_0x6695('0x24')](_0x2941c1);}return null;};}function patchUpdates(_0x24beb9){return function(_0x237029){try{jsonpatch[_0x6695('0x29')](_0x237029,_0x24beb9,!![]);}catch(_0x561440){return BPromise[_0x6695('0x2a')](_0x561440);}return _0x237029[_0x6695('0x2b')]();};}function saveUpdates(_0x54f993,_0x11cafd){return function(_0x222f35){if(_0x222f35){return _0x222f35[_0x6695('0x2c')](_0x54f993)[_0x6695('0x15')](function(_0x235e3b){return _0x235e3b;});}return null;};}function removeEntity(_0x35503d,_0x3e6bcf){return function(_0x4a7ad1){if(_0x4a7ad1){return _0x4a7ad1['destroy']()[_0x6695('0x15')](function(){_0x35503d['status'](0xcc)[_0x6695('0x23')]();});}};}function handleEntityNotFound(_0x462ec7,_0x111d19){return function(_0x3f6b17){if(!_0x3f6b17){_0x462ec7[_0x6695('0x21')](0x194);}return _0x3f6b17;};}function handleError(_0x2f852f,_0x776e62){_0x776e62=_0x776e62||0x1f4;return function(_0x5322a5){logger[_0x6695('0x1c')](_0x5322a5[_0x6695('0x2d')]);if(_0x5322a5['name']){delete _0x5322a5[_0x6695('0x2e')];}_0x2f852f[_0x6695('0x22')](_0x776e62)[_0x6695('0x2f')](_0x5322a5);};}exports[_0x6695('0x30')]=function(_0xd2e18a,_0x4995e6){var _0x37e301={},_0x4dc13e={},_0x1901df={'count':0x0,'rows':[]};var _0x412e8b=db[_0x6695('0x31')]['rawAttributes'];_0x4dc13e[_0x6695('0x32')]=_[_0x6695('0x33')](_0x412e8b);var _0x151ec6={'dateStart':_0xd2e18a[_0x6695('0x34')][_0x6695('0x35')],'dateEnd':_0xd2e18a[_0x6695('0x34')]['dateEnd']};delete _0xd2e18a['query']['dateStart'];delete _0xd2e18a['query'][_0x6695('0x36')];_0x4dc13e['query']=_[_0x6695('0x33')](_0xd2e18a[_0x6695('0x34')]);_0x4dc13e[_0x6695('0x37')]=_[_0x6695('0x38')](_0x4dc13e[_0x6695('0x32')],_0x4dc13e[_0x6695('0x34')]);_0x37e301['attributes']=_[_0x6695('0x38')](_0x4dc13e[_0x6695('0x32')],qs[_0x6695('0x39')](_0xd2e18a[_0x6695('0x34')][_0x6695('0x39')]));_0x37e301[_0x6695('0x3a')]=_0x37e301[_0x6695('0x3a')]['length']?_0x37e301[_0x6695('0x3a')]:_0x4dc13e[_0x6695('0x32')];if(!_0xd2e18a['query'][_0x6695('0x3b')]('nolimit')){_0x37e301[_0x6695('0x26')]=qs[_0x6695('0x26')](_0xd2e18a[_0x6695('0x34')][_0x6695('0x26')]);_0x37e301[_0x6695('0x25')]=qs[_0x6695('0x25')](_0xd2e18a[_0x6695('0x34')][_0x6695('0x25')]);}_0x37e301['order']=qs[_0x6695('0x3c')](_0xd2e18a[_0x6695('0x34')]['sort']);_0x37e301[_0x6695('0x3d')]=qs[_0x6695('0x37')](_['pick'](_0xd2e18a[_0x6695('0x34')],_0x4dc13e['filters']));if(_0x151ec6['dateStart']){if(_0x151ec6[_0x6695('0x36')]){_0x151ec6[_0x6695('0x36')]=moment(_0x151ec6['dateEnd'])[_0x6695('0x3e')](0x1,_0x6695('0x3f'));}else{_0x151ec6[_0x6695('0x36')]=moment(_0x151ec6[_0x6695('0x35')])['add'](0x1,'day');}_[_0x6695('0x40')](_0x37e301[_0x6695('0x3d')],{'createdAt':{'$gte':_0x151ec6[_0x6695('0x35')],'$lte':_0x151ec6[_0x6695('0x36')]}});}if(_0xd2e18a['query'][_0x6695('0x41')]){_0x37e301[_0x6695('0x3d')]=_['merge'](_0x37e301['where'],{'$or':_[_0x6695('0x42')](_0x37e301['attributes'],function(_0x484ede){var _0x4962cc={};_0x4962cc[_0x484ede]={'$like':'%'+_0xd2e18a[_0x6695('0x34')]['filter']+'%'};return _0x4962cc;})});}_0x37e301=_[_0x6695('0x40')]({},_0x37e301,_0xd2e18a[_0x6695('0x43')]);var _0xd4130={'where':_0x37e301[_0x6695('0x3d')]};return db['ChatWebsite'][_0x6695('0x44')](_0xd4130)[_0x6695('0x15')](function(_0x4fbc89){_0x1901df['count']=_0x4fbc89;if(_0xd2e18a[_0x6695('0x34')][_0x6695('0x45')]){_0x37e301[_0x6695('0x46')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x37e301);})[_0x6695('0x15')](function(_0x4fd35c){_0x1901df[_0x6695('0x47')]=_0x4fd35c;return _0x1901df;})[_0x6695('0x15')](respondWithFilteredResult(_0x4995e6,_0x37e301))[_0x6695('0x20')](handleError(_0x4995e6,null));};exports[_0x6695('0x48')]=function(_0x427cab,_0x42a61f){var _0x3b08c7={'raw':![],'where':{'id':_0x427cab[_0x6695('0x49')]['id']}},_0x2043a7={};_0x2043a7[_0x6695('0x32')]=_['keys'](db[_0x6695('0x31')][_0x6695('0x4a')]);_0x2043a7['query']=_['keys'](_0x427cab['query']);_0x2043a7['filters']=_[_0x6695('0x38')](_0x2043a7[_0x6695('0x32')],_0x2043a7['query']);_0x3b08c7['attributes']=_[_0x6695('0x38')](_0x2043a7[_0x6695('0x32')],qs[_0x6695('0x39')](_0x427cab['query'][_0x6695('0x39')]));_0x3b08c7[_0x6695('0x3a')]=_0x3b08c7['attributes'][_0x6695('0x4b')]?_0x3b08c7['attributes']:_0x2043a7[_0x6695('0x32')];if(_0x427cab[_0x6695('0x34')][_0x6695('0x45')]){_0x3b08c7['include']=[{'all':!![]}];}_0x3b08c7=_[_0x6695('0x40')]({},_0x3b08c7,_0x427cab[_0x6695('0x43')]);return db[_0x6695('0x31')]['find'](_0x3b08c7)[_0x6695('0x15')](handleEntityNotFound(_0x42a61f,null))['then'](respondWithResult(_0x42a61f,null))[_0x6695('0x20')](handleError(_0x42a61f,null));};exports['create']=function(_0x43bea3,_0x36b914){return db['ChatWebsite']['create'](_0x43bea3[_0x6695('0x4c')],{})[_0x6695('0x15')](respondWithResult(_0x36b914,0xc9))[_0x6695('0x20')](handleError(_0x36b914,null));};exports[_0x6695('0x2c')]=function(_0x5bb434,_0x22d57d){if(_0x5bb434['body']['id']){delete _0x5bb434[_0x6695('0x4c')]['id'];}return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x5bb434[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x22d57d,null))[_0x6695('0x15')](saveUpdates(_0x5bb434[_0x6695('0x4c')],null))[_0x6695('0x15')](respondWithResult(_0x22d57d,null))[_0x6695('0x20')](handleError(_0x22d57d,null));};exports[_0x6695('0x4e')]=function(_0x4ec9c6,_0x4b36f1){return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x4ec9c6['params']['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x4b36f1,null))[_0x6695('0x15')](removeEntity(_0x4b36f1,null))['catch'](handleError(_0x4b36f1,null));};exports[_0x6695('0x4f')]=function(_0x61de36,_0x5f25e7){return db['ChatWebsite'][_0x6695('0x4f')]()['then'](respondWithResult(_0x5f25e7,null))[_0x6695('0x20')](handleError(_0x5f25e7,null));};exports[_0x6695('0x50')]=function(_0x245475,_0x511702,_0x58617f){if(_0x245475[_0x6695('0x4c')]['id']){delete _0x245475['body']['id'];}return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x245475['params']['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x511702,null))[_0x6695('0x15')](function(_0x3033c4){if(_0x3033c4){_0x245475[_0x6695('0x4c')]['ChatWebsiteId']=_0x3033c4['id'];return db[_0x6695('0x51')][_0x6695('0x52')](_0x245475['body']);}})['then'](respondWithResult(_0x511702,null))['catch'](handleError(_0x511702,null));};exports[_0x6695('0x53')]=function(_0x4d8f8d,_0x38a82e,_0x1509ed){var _0x2bbf60={'raw':![],'where':{}};var _0x25e8db={};var _0x48ab16={'count':0x0,'rows':[]};return db[_0x6695('0x31')][_0x6695('0x54')]({'where':{'id':_0x4d8f8d[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x38a82e,null))[_0x6695('0x15')](function(_0x4e1e00){if(_0x4e1e00){_0x25e8db[_0x6695('0x32')]=_[_0x6695('0x33')](db[_0x6695('0x51')][_0x6695('0x4a')]);_0x25e8db[_0x6695('0x34')]=_[_0x6695('0x33')](_0x4d8f8d[_0x6695('0x34')]);_0x25e8db[_0x6695('0x37')]=_[_0x6695('0x38')](_0x25e8db[_0x6695('0x32')],_0x25e8db['query']);_0x2bbf60[_0x6695('0x3a')]=_[_0x6695('0x38')](_0x25e8db[_0x6695('0x32')],qs[_0x6695('0x39')](_0x4d8f8d['query'][_0x6695('0x39')]));_0x2bbf60[_0x6695('0x3a')]=_0x2bbf60[_0x6695('0x3a')]['length']?_0x2bbf60[_0x6695('0x3a')]:_0x25e8db['model'];if(!_0x4d8f8d[_0x6695('0x34')][_0x6695('0x3b')]('nolimit')){_0x2bbf60[_0x6695('0x26')]=qs['limit'](_0x4d8f8d[_0x6695('0x34')][_0x6695('0x26')]);_0x2bbf60[_0x6695('0x25')]=qs['offset'](_0x4d8f8d[_0x6695('0x34')][_0x6695('0x25')]);}_0x2bbf60[_0x6695('0x55')]=qs[_0x6695('0x3c')](_0x4d8f8d['query'][_0x6695('0x3c')]);_0x2bbf60[_0x6695('0x3d')]=qs['filters'](_[_0x6695('0x56')](_0x4d8f8d[_0x6695('0x34')],_0x25e8db[_0x6695('0x37')]));_0x2bbf60[_0x6695('0x3d')][_0x6695('0x57')]=_0x4e1e00['id'];if(_0x4d8f8d[_0x6695('0x34')]['filter']){_0x2bbf60[_0x6695('0x3d')]=_[_0x6695('0x40')](_0x2bbf60[_0x6695('0x3d')],{'$or':_['map'](_0x2bbf60[_0x6695('0x3a')],function(_0x3ed8b8){var _0x25a946={};_0x25a946[_0x3ed8b8]={'$like':'%'+_0x4d8f8d[_0x6695('0x34')]['filter']+'%'};return _0x25a946;})});}_0x2bbf60=_[_0x6695('0x40')]({},_0x2bbf60,_0x4d8f8d[_0x6695('0x43')]);return db['Disposition'][_0x6695('0x44')]({'where':_0x2bbf60[_0x6695('0x3d')]})[_0x6695('0x15')](function(_0x3f28a1){_0x48ab16[_0x6695('0x44')]=_0x3f28a1;if(_0x4d8f8d[_0x6695('0x34')]['includeAll']){_0x2bbf60[_0x6695('0x46')]=[{'all':!![]}];}return db[_0x6695('0x51')][_0x6695('0x58')](_0x2bbf60);})['then'](function(_0x5210a8){_0x48ab16[_0x6695('0x47')]=_0x5210a8;return _0x48ab16;});}})[_0x6695('0x15')](respondWithFilteredResult(_0x38a82e,_0x2bbf60))[_0x6695('0x20')](handleError(_0x38a82e,null));};exports[_0x6695('0x59')]=function(_0xc64b91,_0x2f0944,_0x10239b){var _0x1b519c;return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0xc64b91[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x2f0944,null))['then'](function(_0x1a9806){if(_0x1a9806){return _0x1a9806[_0x6695('0x59')](_0xc64b91[_0x6695('0x34')][_0x6695('0x5a')]);}})['then'](respondWithStatusCode(_0x2f0944,null))[_0x6695('0x20')](handleError(_0x2f0944,null));};exports['addAnswer']=function(_0x28f677,_0x7b8cbf,_0x374e6c){if(_0x28f677[_0x6695('0x4c')]['id']){delete _0x28f677[_0x6695('0x4c')]['id'];}return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x28f677[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x7b8cbf,null))[_0x6695('0x15')](function(_0x4e8e66){if(_0x4e8e66){_0x28f677['body'][_0x6695('0x57')]=_0x4e8e66['id'];return db[_0x6695('0x5b')]['create'](_0x28f677[_0x6695('0x4c')]);}})[_0x6695('0x15')](respondWithResult(_0x7b8cbf,null))[_0x6695('0x20')](handleError(_0x7b8cbf,null));};exports[_0x6695('0x5c')]=function(_0x41d930,_0x2f3fec,_0x19e7f6){var _0x1597ff={'raw':![],'where':{}};var _0x538462={};var _0x531c65={'count':0x0,'rows':[]};return db[_0x6695('0x31')][_0x6695('0x54')]({'where':{'id':_0x41d930['params']['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x2f3fec,null))[_0x6695('0x15')](function(_0x2d872b){if(_0x2d872b){_0x538462[_0x6695('0x32')]=_[_0x6695('0x33')](db[_0x6695('0x5b')]['rawAttributes']);_0x538462[_0x6695('0x34')]=_[_0x6695('0x33')](_0x41d930[_0x6695('0x34')]);_0x538462['filters']=_[_0x6695('0x38')](_0x538462['model'],_0x538462['query']);_0x1597ff[_0x6695('0x3a')]=_['intersection'](_0x538462['model'],qs[_0x6695('0x39')](_0x41d930[_0x6695('0x34')][_0x6695('0x39')]));_0x1597ff[_0x6695('0x3a')]=_0x1597ff[_0x6695('0x3a')]['length']?_0x1597ff[_0x6695('0x3a')]:_0x538462[_0x6695('0x32')];if(!_0x41d930[_0x6695('0x34')][_0x6695('0x3b')](_0x6695('0x5d'))){_0x1597ff[_0x6695('0x26')]=qs[_0x6695('0x26')](_0x41d930[_0x6695('0x34')][_0x6695('0x26')]);_0x1597ff[_0x6695('0x25')]=qs['offset'](_0x41d930['query'][_0x6695('0x25')]);}_0x1597ff[_0x6695('0x55')]=qs[_0x6695('0x3c')](_0x41d930['query']['sort']);_0x1597ff['where']=qs['filters'](_[_0x6695('0x56')](_0x41d930[_0x6695('0x34')],_0x538462[_0x6695('0x37')]));_0x1597ff[_0x6695('0x3d')][_0x6695('0x57')]=_0x2d872b['id'];if(_0x41d930['query'][_0x6695('0x41')]){_0x1597ff[_0x6695('0x3d')]=_[_0x6695('0x40')](_0x1597ff['where'],{'$or':_['map'](_0x1597ff[_0x6695('0x3a')],function(_0x2ff417){var _0x5bb73f={};_0x5bb73f[_0x2ff417]={'$like':'%'+_0x41d930['query'][_0x6695('0x41')]+'%'};return _0x5bb73f;})});}_0x1597ff=_[_0x6695('0x40')]({},_0x1597ff,_0x41d930['options']);return db[_0x6695('0x5b')][_0x6695('0x44')]({'where':_0x1597ff[_0x6695('0x3d')]})[_0x6695('0x15')](function(_0x145e1e){_0x531c65[_0x6695('0x44')]=_0x145e1e;if(_0x41d930['query'][_0x6695('0x45')]){_0x1597ff[_0x6695('0x46')]=[{'all':!![]}];}return db[_0x6695('0x5b')][_0x6695('0x58')](_0x1597ff);})[_0x6695('0x15')](function(_0x43c289){_0x531c65[_0x6695('0x47')]=_0x43c289;return _0x531c65;});}})['then'](respondWithFilteredResult(_0x2f3fec,_0x1597ff))[_0x6695('0x20')](handleError(_0x2f3fec,null));};exports[_0x6695('0x5e')]=function(_0x40e310,_0x248198,_0x20a59a){var _0x28c2c5;return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x40e310[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x248198,null))[_0x6695('0x15')](function(_0x4e2f4c){if(_0x4e2f4c){return _0x4e2f4c[_0x6695('0x5e')](_0x40e310[_0x6695('0x34')]['ids']);}})[_0x6695('0x15')](respondWithStatusCode(_0x248198,null))['catch'](handleError(_0x248198,null));};exports['addLogo']=function(_0x5ee69c,_0x8e961,_0x214047){_0x5ee69c[_0x6695('0x4c')]['sitepic']=_0x5ee69c['file'][_0x6695('0x5f')];return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x5ee69c[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x8e961,null))[_0x6695('0x15')](saveUpdates(_0x5ee69c['body'],null))[_0x6695('0x15')](respondWithResult(_0x8e961,null))['catch'](handleError(_0x8e961,null));};exports[_0x6695('0x60')]=function(_0x1b53d9,_0x2f4d0f,_0x49bfab){_0x1b53d9[_0x6695('0x4c')]['agentAvatar']=_0x1b53d9[_0x6695('0x61')][_0x6695('0x5f')];return db[_0x6695('0x31')]['find']({'where':{'id':_0x1b53d9[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x2f4d0f,null))[_0x6695('0x15')](saveUpdates(_0x1b53d9[_0x6695('0x4c')],null))['then'](respondWithResult(_0x2f4d0f,null))[_0x6695('0x20')](handleError(_0x2f4d0f,null));};exports[_0x6695('0x62')]=function(_0x3888f6,_0x1618e4,_0x423d10){_0x3888f6[_0x6695('0x4c')]['customerAvatar']=_0x3888f6[_0x6695('0x61')][_0x6695('0x5f')];return db['ChatWebsite'][_0x6695('0x4d')]({'where':{'id':_0x3888f6['params']['id']}})['then'](handleEntityNotFound(_0x1618e4,null))[_0x6695('0x15')](saveUpdates(_0x3888f6[_0x6695('0x4c')],null))[_0x6695('0x15')](respondWithResult(_0x1618e4,null))['catch'](handleError(_0x1618e4,null));};exports[_0x6695('0x63')]=function(_0x5679ec,_0x3483e3,_0x111203){_0x5679ec[_0x6695('0x4c')][_0x6695('0x64')]=_0x5679ec[_0x6695('0x61')]['filename'];return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x5679ec[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x3483e3,null))['then'](saveUpdates(_0x5679ec[_0x6695('0x4c')],null))[_0x6695('0x15')](respondWithResult(_0x3483e3,null))[_0x6695('0x20')](handleError(_0x3483e3,null));};exports[_0x6695('0x65')]=function(_0x9880ae,_0x3767e7,_0x3247f4){var _0x39a15d=path[_0x6695('0x66')](config[_0x6695('0x67')],_0x6695('0x68'));var _0x54c761={'where':{'id':_0x9880ae['params']['id']},'attributes':['id',_0x6695('0x69')],'raw':!![]};var _0x37fded=![];return require('../../config/license/util')[_0x6695('0x6a')]()[_0x6695('0x15')](function(_0x2483df){if(_0x2483df){_0x37fded=_0x2483df[_0x6695('0x6b')];}})[_0x6695('0x15')](function(){return db[_0x6695('0x31')]['find'](_0x54c761);})['then'](handleEntityNotFound(_0x3767e7,null))[_0x6695('0x15')](function(_0x411191){if(_0x411191){if(!_[_0x6695('0x6c')](_0x411191[_0x6695('0x69')])){if(fs[_0x6695('0x6d')](path[_0x6695('0x66')](config['root'],'server/files/images/logos/',_0x411191['sitepic']))&&_0x37fded){_0x39a15d=path[_0x6695('0x66')](config[_0x6695('0x67')],_0x6695('0x6e'),_0x411191[_0x6695('0x69')]);}}return _0x3767e7[_0x6695('0x6f')](_0x39a15d);}})[_0x6695('0x20')](handleError(_0x3767e7,null));};exports[_0x6695('0x70')]=function(_0x1eadbc,_0x40a65d,_0x19bf6a){var _0x3457eb=path[_0x6695('0x66')](config[_0x6695('0x67')],'server/files/images/avatars/default_avatar.png');var _0x46e52f={'where':{'id':_0x1eadbc[_0x6695('0x49')]['id']},'attributes':['id',_0x6695('0x71')],'raw':!![]};return db[_0x6695('0x31')][_0x6695('0x4d')](_0x46e52f)[_0x6695('0x15')](handleEntityNotFound(_0x40a65d,null))[_0x6695('0x15')](function(_0x32343b){if(_0x32343b){if(!_[_0x6695('0x6c')](_0x32343b['agentAvatar'])){if(fs[_0x6695('0x6d')](path[_0x6695('0x66')](config[_0x6695('0x67')],_0x6695('0x72'),_0x32343b[_0x6695('0x71')]))){_0x3457eb=path[_0x6695('0x66')](config[_0x6695('0x67')],_0x6695('0x72'),_0x32343b[_0x6695('0x71')]);}}return _0x40a65d[_0x6695('0x6f')](_0x3457eb);}})['catch'](handleError(_0x40a65d,null));};exports[_0x6695('0x73')]=function(_0x394b51,_0xf08745,_0x3bcfe7){var _0x1631b8=path['join'](config[_0x6695('0x67')],_0x6695('0x74'));var _0x142bb2={'where':{'id':_0x394b51['params']['id']},'attributes':['id','customerAvatar',_0x6695('0x75')],'raw':!![]};return db[_0x6695('0x31')][_0x6695('0x4d')](_0x142bb2)[_0x6695('0x15')](handleEntityNotFound(_0xf08745,null))[_0x6695('0x15')](function(_0x23de37){if(_0x23de37){if(!_[_0x6695('0x6c')](_0x23de37['customerAvatar'])){if(fs['existsSync'](path['join'](config[_0x6695('0x67')],'server/files/images/avatars/',_0x23de37['customerAvatar']))&&_0x23de37[_0x6695('0x75')]){_0x1631b8=path[_0x6695('0x66')](config[_0x6695('0x67')],_0x6695('0x72'),_0x23de37[_0x6695('0x76')]);}}return _0xf08745[_0x6695('0x6f')](_0x1631b8);}})[_0x6695('0x20')](handleError(_0xf08745,null));};exports[_0x6695('0x77')]=function(_0x123a59,_0x46f471,_0x2b6cb0){var _0xc54d7d=path[_0x6695('0x66')](config[_0x6695('0x67')],_0x6695('0x78'));var _0x500088={'where':{'id':_0x123a59[_0x6695('0x49')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x6695('0x4d')](_0x500088)['then'](handleEntityNotFound(_0x46f471,null))['then'](function(_0x3e3c19){if(_0x3e3c19){if(!_['isNil'](_0x3e3c19['systemAvatar'])){if(fs[_0x6695('0x6d')](path['join'](config[_0x6695('0x67')],'server/files/images/avatars/',_0x3e3c19[_0x6695('0x64')]))){_0xc54d7d=path[_0x6695('0x66')](config[_0x6695('0x67')],_0x6695('0x72'),_0x3e3c19[_0x6695('0x64')]);}}return _0x46f471[_0x6695('0x6f')](_0xc54d7d);}})[_0x6695('0x20')](handleError(_0x46f471,null));};exports[_0x6695('0x79')]=function(_0xf288e3,_0x250134,_0x3b637d){var _0x3da08d=require('user-agent-parser');var _0x5c8609=new _0x3da08d();var _0x3866ec=_0x5c8609[_0x6695('0x7a')](_0xf288e3[_0x6695('0x7b')]['user-agent'])['getResult']();var _0x3f9dca={'body':_0xf288e3[_0x6695('0x4c')],'channel':_0x6695('0x7c')};var _0x5999ed=[];var _0x281ffe=[];var _0x2bb4ba={};var _0x3f6450=![];return db[_0x6695('0x7d')][_0x6695('0x4f')]()['then'](function(_0x195376){if(!_0x195376){throw new db[(_0x6695('0x7e'))]['ValidationError']('no\x20available\x20attributes');}_0x5999ed=_[_0x6695('0x7f')](_[_0x6695('0x33')](_0x195376),[_0x6695('0x80'),_0x6695('0x81')]);_0x281ffe=_[_0x6695('0x7f')](_['keys'](_0x195376),['createdAt',_0x6695('0x81'),_0x6695('0x82'),_0x6695('0x83')]);if(_0xf288e3[_0x6695('0x4c')]['id']){delete _0xf288e3[_0x6695('0x4c')]['id'];}if(_[_0x6695('0x6c')](_0xf288e3[_0x6695('0x4c')][_0x6695('0x84')])){throw new db[(_0x6695('0x7e'))][(_0x6695('0x85'))](_0x6695('0x86'));}if(_['isNil'](_0xf288e3['body']['body'])||_0xf288e3['body'][_0x6695('0x4c')]===''){throw new db[(_0x6695('0x7e'))][(_0x6695('0x85'))](_0x6695('0x87'));}if(_[_0x6695('0x6c')](_0xf288e3[_0x6695('0x4c')]['mapKey'])){throw new db['Sequelize'][(_0x6695('0x85'))](_0x6695('0x88')+_0x281ffe);}if(!_['includes'](_0x281ffe,_0xf288e3[_0x6695('0x4c')][_0x6695('0x89')])){throw new db[(_0x6695('0x7e'))][(_0x6695('0x85'))](_0x6695('0x8a')+_0x281ffe);}_0x2bb4ba[_0xf288e3[_0x6695('0x4c')][_0x6695('0x89')]]=_0xf288e3['body'][_0x6695('0x84')];})[_0x6695('0x15')](function(){return db['ChatWebsite']['find']({'where':{'id':_0xf288e3['params']['id']},'include':[{'model':db[_0x6695('0x8b')],'as':'List','include':[{'model':db[_0x6695('0x7d')],'as':'Contacts','where':_0x2bb4ba,'limit':0x1,'order':[[_0x6695('0x81'),_0x6695('0x8c')]]}]},{'model':db[_0x6695('0x8d')],'as':_0x6695('0x8e')}]});})[_0x6695('0x15')](handleEntityNotFound(_0x250134,null))[_0x6695('0x15')](function(_0x40a534){if(_0x40a534&&_0x40a534[_0x6695('0x8f')]){_0x3f9dca[_0x6695('0x90')]=_0x40a534;_0x3f9dca['applications']=_0x40a534[_0x6695('0x8e')];_0x3f9dca[_0x6695('0x91')]=_0x40a534[_0x6695('0x8f')];_0x3f9dca[_0x6695('0x92')]=_[_0x6695('0x93')](_0x3f9dca[_0x6695('0x92')],[_0x6695('0x94')],['asc']);if(_0x3f9dca[_0x6695('0x90')]['Applications']){delete _0x3f9dca[_0x6695('0x90')]['Applications'];}if(_0x3f9dca[_0x6695('0x90')][_0x6695('0x8f')]&&_0x3f9dca[_0x6695('0x90')][_0x6695('0x8f')][_0x6695('0x95')][_0x6695('0x4b')]){return _0x3f9dca['account']['List'][_0x6695('0x95')][0x0];}var _0x2c1200=_[_0x6695('0x96')](_0xf288e3[_0x6695('0x4c')],{'firstName':_0xf288e3[_0x6695('0x4c')]['from'],'ListId':_0x40a534[_0x6695('0x83')]});_0x2c1200[_0xf288e3['body'][_0x6695('0x89')]]=_0xf288e3[_0x6695('0x4c')]['from'];return db['CmContact']['create'](_0x2c1200,{'fields':_0x5999ed,'raw':!![]});}})[_0x6695('0x15')](handleEntityNotFound(_0x250134,null))[_0x6695('0x15')](function(_0x71c5bb){_0x3f9dca[_0x6695('0x97')]=_0x71c5bb;if(_0x71c5bb){var _0x2844c1={'ContactId':_0x71c5bb['id'],'ChatWebsiteId':_0xf288e3[_0x6695('0x49')]['id'],'from':(_0x71c5bb[_0x6695('0x98')]||'')+'\x20'+(_0x71c5bb[_0x6695('0x99')]||''),'customerIp':_0xf288e3[_0x6695('0x4c')]['customerIp'],'referer':_0xf288e3[_0x6695('0x4c')][_0x6695('0x9a')],'browserName':_0x3866ec[_0x6695('0x9b')]['name']&&_0x3866ec[_0x6695('0x9b')][_0x6695('0x9c')]?util['format']('%s\x20%s',_0x3866ec[_0x6695('0x9b')]['name'],_0x3866ec[_0x6695('0x9b')][_0x6695('0x9c')]):_0x6695('0x9d'),'browserVersion':_0x3866ec[_0x6695('0x9b')][_0x6695('0x9c')]||'unknown','osName':util[_0x6695('0x9e')](_0x6695('0x9f'),_0x3866ec['os']['name'],_0x3866ec['os']['version']),'osVersion':_0x3866ec['os'][_0x6695('0x9c')],'deviceModel':_0x3866ec[_0x6695('0xa0')][_0x6695('0x32')]&&_0x3866ec[_0x6695('0xa0')][_0x6695('0xa1')]?util[_0x6695('0x9e')]('%s\x20%s\x20%s',_0x3866ec[_0x6695('0xa0')][_0x6695('0x32')],_0x3866ec[_0x6695('0xa0')][_0x6695('0xa1')],_0x3866ec['device'][_0x6695('0xa2')]):null,'deviceVendor':_0x3866ec[_0x6695('0xa0')][_0x6695('0xa1')],'deviceType':_0x3866ec['device'][_0x6695('0xa2')],'formData':JSON[_0x6695('0x1b')](_0xf288e3[_0x6695('0x4c')])};var _0x57f28d={'ChatWebsiteId':_0xf288e3[_0x6695('0x49')]['id'],'closed':![]};if(_0xf288e3[_0x6695('0x4c')][_0x6695('0xa3')]){_0x57f28d[_0x6695('0xa3')]=_0xf288e3[_0x6695('0x4c')]['threadId'];return db[_0x6695('0xa4')][_0x6695('0x4d')]({'where':_0x57f28d})['then'](function(_0x5dc0d6){if(_0x5dc0d6){return[_0x5dc0d6,![]];}_0x2844c1[_0x6695('0xa3')]=_0xf288e3[_0x6695('0x4c')]['threadId'];_0x2844c1[_0x6695('0xa5')]=_0xf288e3[_0x6695('0x4c')][_0x6695('0xa5')];return db[_0x6695('0xa4')][_0x6695('0x52')](_0x2844c1)[_0x6695('0x15')](function(_0x218bff){return[_0x218bff,!![]];});});}_0x57f28d[_0x6695('0xa6')]=_0x71c5bb['id'];if(_0xf288e3[_0x6695('0x4c')]['interaction']&&_0xf288e3[_0x6695('0x4c')][_0x6695('0xa7')]['id']){_0x57f28d['id']=_0xf288e3[_0x6695('0x4c')][_0x6695('0xa7')]['id'];return db['ChatInteraction'][_0x6695('0x4d')]({'where':_0x57f28d})[_0x6695('0x15')](function(_0x3852d4){if(_0x3852d4){return[_0x3852d4,![]];}return db[_0x6695('0xa4')][_0x6695('0x52')](_0x2844c1)['then'](function(_0x5b4c8c){return[_0x5b4c8c,!![]];});});}return db[_0x6695('0xa4')][_0x6695('0x52')](_0x2844c1)[_0x6695('0x15')](function(_0x461080){return[_0x461080,!![]];});}})[_0x6695('0xa8')](function(_0x151269,_0xb8ea35){if(_0x151269){_0x3f6450=_0xb8ea35;if(!_0xb8ea35){return _0x151269[_0x6695('0x2c')]({'from':(_0x3f9dca[_0x6695('0x97')][_0x6695('0x98')]||'')+'\x20'+(_0x3f9dca['contact']['lastName']||'')});}else{return _0x151269;}}})['then'](function(_0x37987e){_0x3f9dca['interaction']=_0x37987e[_0x6695('0xa9')]({'plain':!![]});_0x3f9dca[_0x6695('0xa7')][_0x6695('0xaa')]=_0x3f6450;if(_0x3f9dca[_0x6695('0xa7')][_0x6695('0xaa')]){if(_0x3f9dca['account'][_0x6695('0xab')]){_0x3f9dca['applications'][_0x6695('0xac')]({'id':0x0,'priority':_0x3f9dca[_0x6695('0x92')]['length']+0x1,'app':_0x6695('0xad'),'appdata':_0x6695('0xae'),'interval':_0x6695('0xaf')});}}return db[_0x6695('0xb0')][_0x6695('0x52')]({'body':_0xf288e3[_0x6695('0x4c')][_0x6695('0x4c')],'ChatWebsiteId':_0xf288e3[_0x6695('0x49')]['id'],'ChatInteractionId':_0x37987e['id'],'direction':'in','ContactId':_0x3f9dca[_0x6695('0x97')]['id'],'AttachmentId':_0xf288e3[_0x6695('0x4c')][_0x6695('0xb1')]});})[_0x6695('0x15')](function(_0x49c7b6){_0x3f9dca[_0x6695('0x1e')]=_0x49c7b6;if(_0x3f9dca[_0x6695('0xa7')]['UserId']){return db['User'][_0x6695('0x4d')]({'attributes':['id',_0x6695('0x2e')],'where':{'id':_0x3f9dca[_0x6695('0xa7')][_0x6695('0xb2')]}})[_0x6695('0x15')](function(_0x8e3866){if(_0x8e3866){_0x3f9dca['applications'][_0x6695('0xb3')]({'id':0x0,'priority':0x0,'app':_0x6695('0xb4'),'appdata':_0x8e3866['name']+','+(_0x3f9dca['account'][_0x6695('0xb5')]||0xa),'interval':_0x6695('0xaf')});_0x3f9dca[_0x6695('0xb6')]=!![];}return respondWithRpcPromise(_0x6695('0xb7'),_0x6695('0xb8'),_0x3f9dca);});}return respondWithRpcPromise(_0x6695('0xb7'),'startRouting',_0x3f9dca);})[_0x6695('0x15')](function(_0x5cc317){respondWithRpcPromise(_0x6695('0xb9'),'EventManager',{'event':'notify','message':_0x5cc317},client9002);return _0x5cc317;})[_0x6695('0x15')](respondWithResult(_0x250134,null))[_0x6695('0x20')](handleError(_0x250134,null));};exports[_0x6695('0xba')]=function(_0x314a7c,_0x195316,_0x302a00){var _0x343018,_0x3c3cf3,_0x81ae94;var _0x2f399b=[];var _0x11d616=[];var _0x39e9ee={};return db[_0x6695('0x7d')][_0x6695('0x4f')]()['then'](function(_0x337658){if(!_0x337658){throw new db[(_0x6695('0x7e'))][(_0x6695('0x85'))](_0x6695('0xbb'));}_0x11d616=_[_0x6695('0x7f')](_[_0x6695('0x33')](_0x337658),[_0x6695('0x80'),'updatedAt']);_0x2f399b=_[_0x6695('0x7f')](_[_0x6695('0x33')](_0x337658),[_0x6695('0x80'),_0x6695('0x81'),_0x6695('0x82'),'ListId']);if(_0x314a7c[_0x6695('0x4c')]['id']){delete _0x314a7c['body']['id'];}if(_[_0x6695('0x6c')](_0x314a7c[_0x6695('0x4c')][_0x6695('0x84')])){throw _0x195316['status'](0x1f4)[_0x6695('0x2f')](new db[(_0x6695('0x7e'))]['ValidationError'](_0x6695('0x86')));}if(_[_0x6695('0x6c')](_0x314a7c[_0x6695('0x4c')]['body'])||_0x314a7c['body'][_0x6695('0x4c')]===''){throw _0x195316[_0x6695('0x22')](0x1f4)[_0x6695('0x2f')](new db[(_0x6695('0x7e'))][(_0x6695('0x85'))](_0x6695('0x87')));}if(_['isNil'](_0x314a7c[_0x6695('0x4c')][_0x6695('0xbc')])){throw _0x195316['status'](0x1f4)[_0x6695('0x2f')](new db[(_0x6695('0x7e'))][(_0x6695('0x85'))](_0x6695('0xbd')+_0x2f399b));}if(!_['includes'](_0x2f399b,_0x314a7c[_0x6695('0x4c')][_0x6695('0xbc')])){throw _0x195316[_0x6695('0x22')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x6695('0xbe')+_0x2f399b));}_0x39e9ee[_0x314a7c[_0x6695('0x4c')][_0x6695('0xbc')]]=_0x314a7c[_0x6695('0x4c')][_0x6695('0x84')];})[_0x6695('0x15')](function(){return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x314a7c['params']['id']},'include':[{'model':db[_0x6695('0x8b')],'as':'List'}]});})[_0x6695('0x15')](handleEntityNotFound(_0x195316,null))['then'](function(_0xa327d7){if(_0xa327d7&&_0xa327d7[_0x6695('0x8f')]){_0x3c3cf3=_0xa327d7;var _0x2d5bce=_[_0x6695('0x96')](_0x314a7c[_0x6695('0x4c')],{'firstName':_0x314a7c[_0x6695('0x4c')][_0x6695('0x84')],'phone':_0x314a7c[_0x6695('0x4c')][_0x6695('0x84')],'ListId':_0xa327d7['ListId']});_0x2d5bce[_0x314a7c[_0x6695('0x4c')]['mapKeyOffline']]=_0x314a7c[_0x6695('0x4c')][_0x6695('0x84')];return db['CmContact'][_0x6695('0xbf')]({'where':_0x39e9ee,'defaults':_0x2d5bce});}})[_0x6695('0xa8')](function(_0x21f08d){if(_0x21f08d){_0x81ae94=_0x21f08d;var _0x485d51=fs[_0x6695('0xc0')](path[_0x6695('0x66')](config[_0x6695('0x67')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x384a10=ejs[_0x6695('0xc1')](_0x485d51,{'body':_[_0x6695('0xc2')](_0x314a7c[_0x6695('0x4c')][_0x6695('0x4c')]),'bodyTitle':_0x3c3cf3[_0x6695('0xc3')]});return db[_0x6695('0xc4')][_0x6695('0x52')]({'body':_0x384a10,'ContactId':_0x21f08d['id'],'ChatWebsiteId':_0x3c3cf3['id']});}})[_0x6695('0x15')](function(_0x411bd9){if(_0x411bd9){_0x343018=_0x411bd9;return db['MailAccount'][_0x6695('0x54')]({'where':{'service':!![]},'include':[{'model':db[_0x6695('0xc5')],'as':'Smtp','raw':!![]}]});}})[_0x6695('0x15')](function(_0x2f8d3f){if(_0x2f8d3f&&_0x2f8d3f['Smtp']&&_0x3c3cf3[_0x6695('0xc6')]){var _0x3d60b6={'tls':{'rejectUnauthorized':![]}};if(_0x2f8d3f[_0x6695('0xc7')][_0x6695('0xc8')]){_0x3d60b6['service']=_0x2f8d3f[_0x6695('0xc7')]['service'];}else{_0x3d60b6[_0x6695('0xc9')]=_0x2f8d3f[_0x6695('0xc7')]['host'];_0x3d60b6[_0x6695('0xca')]=_0x2f8d3f[_0x6695('0xc7')][_0x6695('0xca')];_0x3d60b6[_0x6695('0xcb')]=_0x2f8d3f['Smtp'][_0x6695('0xcb')];}if(_0x2f8d3f['Smtp'][_0x6695('0xcc')]){_0x3d60b6[_0x6695('0xcd')]={'user':_0x2f8d3f[_0x6695('0xc7')][_0x6695('0xce')],'pass':_0x2f8d3f['Smtp'][_0x6695('0xcf')]};}return respondWithRpcPromise('SendMail',_0x6695('0xd0'),{'account':_0x3d60b6,'message':{'from':util['format'](_0x6695('0xd1'),_0x2f8d3f['name'],_0x2f8d3f[_0x6695('0xd2')]||_0x2f8d3f[_0x6695('0xc7')][_0x6695('0xce')]),'to':_0x3c3cf3[_0x6695('0xc6')],'subject':_0x3c3cf3[_0x6695('0xd3')],'text':_0x343018['body']}},client9003)[_0x6695('0x15')](function(){return _0x343018;})[_0x6695('0x20')](function(_0x251d06){console['error'](_0x251d06);});}})[_0x6695('0x15')](function(){if(_0x343018){return _0x343018;}})[_0x6695('0x15')](respondWithResult(_0x195316,null))['catch'](handleError(_0x195316,null));};exports[_0x6695('0xd4')]=function(_0x290483,_0x5d1988,_0x49d5db){return db['ChatInteraction']['find']({'where':{'id':_0x290483['params']['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x5d1988,null))[_0x6695('0x15')](function(_0x347065){if(_0x347065){return _0x347065[_0x6695('0xd4')](_0x290483[_0x6695('0x4c')][_0x6695('0x5a')],_[_0x6695('0xd5')](_0x290483[_0x6695('0x4c')],[_0x6695('0x5a'),'id'])||{});}})[_0x6695('0x15')](respondWithResult(_0x5d1988,null))[_0x6695('0x20')](handleError(_0x5d1988,null));};exports['getInteractions']=function(_0x33da5c,_0x3b5100,_0x40fb04){var _0x29366d={'raw':![],'where':{}};var _0x6a2d5a={};var _0x513469={'count':0x0,'rows':[]};return db[_0x6695('0x31')][_0x6695('0x54')]({'where':{'id':_0x33da5c[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b5100,null))['then'](function(_0x131544){if(_0x131544){_0x6a2d5a[_0x6695('0x32')]=_[_0x6695('0x33')](db[_0x6695('0xa4')][_0x6695('0x4a')]);_0x6a2d5a[_0x6695('0x34')]=_['keys'](_0x33da5c[_0x6695('0x34')]);_0x6a2d5a[_0x6695('0x37')]=_['intersection'](_0x6a2d5a['model'],_0x6a2d5a[_0x6695('0x34')]);_0x29366d[_0x6695('0x3a')]=_[_0x6695('0x38')](_0x6a2d5a['model'],qs['fields'](_0x33da5c[_0x6695('0x34')]['fields']));_0x29366d['attributes']=_0x29366d[_0x6695('0x3a')][_0x6695('0x4b')]?_0x29366d['attributes']:_0x6a2d5a[_0x6695('0x32')];if(!_0x33da5c['query'][_0x6695('0x3b')](_0x6695('0x5d'))){_0x29366d[_0x6695('0x26')]=qs[_0x6695('0x26')](_0x33da5c[_0x6695('0x34')][_0x6695('0x26')]);_0x29366d[_0x6695('0x25')]=qs[_0x6695('0x25')](_0x33da5c[_0x6695('0x34')][_0x6695('0x25')]);}_0x29366d[_0x6695('0x55')]=qs[_0x6695('0x3c')](_0x33da5c['query'][_0x6695('0x3c')]);_0x29366d[_0x6695('0x3d')]=qs[_0x6695('0x37')](_['pick'](_0x33da5c[_0x6695('0x34')],_0x6a2d5a[_0x6695('0x37')]));_0x29366d['where'][_0x6695('0x57')]=_0x131544['id'];if(_0x33da5c[_0x6695('0x34')][_0x6695('0x41')]){_0x29366d[_0x6695('0x3d')]=_['merge'](_0x29366d[_0x6695('0x3d')],{'$or':_['map'](_0x29366d['attributes'],function(_0x3c8f06){var _0x246ea0={};_0x246ea0[_0x3c8f06]={'$like':'%'+_0x33da5c[_0x6695('0x34')]['filter']+'%'};return _0x246ea0;})});}_0x29366d=_[_0x6695('0x40')]({},_0x29366d,_0x33da5c[_0x6695('0x43')]);return db[_0x6695('0xa4')][_0x6695('0x44')]({'where':_0x29366d[_0x6695('0x3d')]})[_0x6695('0x15')](function(_0x43813c){_0x513469[_0x6695('0x44')]=_0x43813c;if(_0x33da5c[_0x6695('0x34')]['includeAll']){_0x29366d[_0x6695('0x46')]=[{'model':db['CmContact'],'as':_0x6695('0xd6'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x6695('0x2e'),_0x6695('0xd7'),_0x6695('0xd8')],'required':![]},{'model':db['Tag'],'as':_0x6695('0xd9'),'attributes':['id','name',_0x6695('0xda')],'where':_0x33da5c[_0x6695('0x34')]['tag']?{'id':_0x33da5c['query'][_0x6695('0xdb')]}:undefined,'required':_0x33da5c[_0x6695('0x34')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0x6695('0x58')](_0x29366d);})[_0x6695('0x15')](function(_0x255d95){_0x513469[_0x6695('0x47')]=_0x255d95;return _0x513469;});}})['then'](respondWithFilteredResult(_0x3b5100,_0x29366d))[_0x6695('0x20')](handleError(_0x3b5100,null));};function iftimePromise(_0x111e84,_0x5a2b3e){return respondWithRpcPromise(_0x6695('0xdc'),_0x6695('0xdd'),{'command':_0x5a2b3e[_0x6695('0xde')]?util[_0x6695('0x9e')](_0x6695('0xdf'),_0x111e84['interval'],_0x5a2b3e[_0x6695('0xde')]):util[_0x6695('0x9e')](_0x6695('0xe0'),_0x111e84[_0x6695('0xe1')])},client9002)[_0x6695('0x15')](function(_0x1d73a1){var _0x2cbd7c=_0x1d73a1&&_0x1d73a1[_0x6695('0xe2')]('true')>=0x0?!![]:![];logger[_0x6695('0x16')](_0x6695('0xe3'),_0x5a2b3e['id'],_0x111e84['id'],_0x111e84[_0x6695('0xe1')],_0x2cbd7c?_0x6695('0xe4'):_0x6695('0xe5'),_0x5a2b3e[_0x6695('0xde')]?_0x5a2b3e[_0x6695('0xde')]:_0x6695('0xe6'));return _0x2cbd7c;})['catch'](function(_0xa5958a){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5a2b3e['id'],_0x111e84['id'],_0x111e84[_0x6695('0xe1')],util[_0x6695('0xe7')](_0xa5958a,{'showHidden':![],'depth':null}),_0x5a2b3e['timezone']?_0x5a2b3e[_0x6695('0xde')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x180988,_0x2b0415,_0x3c0aa8){var _0x2aa526=0x0;var _0x33fd9f=0x0;var _0x1cdd90=![];var _0x21e7fe;var _0x1ae475;return db[_0x6695('0x31')]['find']({'where':{'id':_0x180988[_0x6695('0x49')]['id']},'include':[{'model':db[_0x6695('0xe8')],'as':_0x6695('0xe8'),'include':[{'model':db[_0x6695('0xe8')],'as':_0x6695('0xe9'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x6695('0x15')](handleEntityNotFound(_0x2b0415,null))[_0x6695('0x15')](function(_0x17008b){if(_0x17008b){_0x21e7fe=_0x17008b;return _0x17008b[_0x6695('0xea')]({'raw':!![]});}})[_0x6695('0x15')](function(_0x249969){if(_0x21e7fe){if(_0x249969){_0x1ae475=_0x249969;}}return require(_0x6695('0xeb'))[_0x6695('0x6a')]();})['then'](function(_0x204724){if(_0x204724){_0x33fd9f=_0x204724['virtual'];_0x1cdd90=_0x204724['custom'];}})[_0x6695('0x15')](function(){return db[_0x6695('0xa4')][_0x6695('0x44')]({'where':{'closed':![]}});})[_0x6695('0x15')](function(_0x39997f){_0x2aa526=_0x39997f;if(_0x33fd9f&&_0x39997f>_0x33fd9f){return db[_0x6695('0xec')]['findOne']({'where':{'id':0x1}})[_0x6695('0x15')](function(_0x8cf105){if(_0x8cf105){_0x8cf105[_0x6695('0xed')]('chatLicenseExceeded');}});}})[_0x6695('0x15')](function(){if(_0x21e7fe['Interval']&&_0x21e7fe[_0x6695('0xe8')]['Intervals']){var _0x2965a6=[];for(var _0x4cfe89=0x0;_0x4cfe89<_0x21e7fe[_0x6695('0xe8')][_0x6695('0xe9')][_0x6695('0x4b')];_0x4cfe89++){var _0x2d8074=_0x21e7fe[_0x6695('0xe8')][_0x6695('0xe9')][_0x4cfe89][_0x6695('0xa9')]({'plain':!![]});_0x2965a6[_0x6695('0xac')](iftimePromise(_0x2d8074,_0x21e7fe));}return BPromise['all'](_0x2965a6)[_0x6695('0x15')](function(_0x49fe71){return _['some'](_0x49fe71);});}else{return!![];}})[_0x6695('0x15')](function(_0x4aea46){var _0x45d12c=fs[_0x6695('0xc0')](path['join'](config[_0x6695('0x67')],_0x6695('0xee')),_0x6695('0xef'));var _0x49cc22={'remote':_0x21e7fe['remote'],'query':querystring[_0x6695('0x1b')](_[_0x6695('0x40')](_0x21e7fe[_0x6695('0xa9')]({'plain':!![]}),{'customerIp':_0x180988[_0x6695('0x7b')][_0x6695('0xf0')]||_0x180988['headers'][_0x6695('0xf1')]||_0x180988[_0x6695('0xf2')]['remoteAddress']||_0x180988['ip'],'referer':_0x180988['headers']['referer'],'openedInteractions':_0x2aa526,'maxInteractions':_0x33fd9f,'virtual':_0x1cdd90[_0x6695('0xf3')],'online':_0x4aea46,'custom':_0x1cdd90}))[_0x6695('0xf4')](/'/g,'\x5c\x27')};_0x2b0415[_0x6695('0x2f')](ejs[_0x6695('0xc1')](Mustache['render'](_0x45d12c,_0x49cc22),{'proactiveActions':_0x1ae475,'alignment':_0x21e7fe[_0x6695('0xf5')],'verticalAlignment':_0x21e7fe[_0x6695('0xf6')]}));})[_0x6695('0x20')](handleError(_0x2b0415,null));};exports[_0x6695('0xf7')]=function(_0x569a3a,_0x5d0836,_0x4919dd){return db[_0x6695('0x31')]['findOne']({'where':{'id':_0x569a3a[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x5d0836,null))['then'](function(_0xdd65d4){if(_0xdd65d4){return db[_0x6695('0xf8')][_0x6695('0xf9')](function(_0x531f42){return db[_0x6695('0x8d')][_0x6695('0x4e')]({'where':{'ChatWebsiteId':_0x569a3a[_0x6695('0x49')]['id']},'transaction':_0x531f42})[_0x6695('0x15')](function(_0x33584f){var _0x35ade0=_[_0x6695('0x42')](_0x569a3a[_0x6695('0x4c')],function(_0x3138a9){_0x3138a9[_0x6695('0x57')]=_0x569a3a[_0x6695('0x49')]['id'];return _0x3138a9;});return db[_0x6695('0x8d')][_0x6695('0xfa')](_0x35ade0,{'transaction':_0x531f42});});})['then'](function(){return db['ChatApplication'][_0x6695('0xfb')]({'where':{'ChatWebsiteId':_0x569a3a[_0x6695('0x49')]['id']},'order':_0x6695('0x94')});});}})[_0x6695('0x15')](respondWithResult(_0x5d0836,null))[_0x6695('0x20')](handleError(_0x5d0836,null));};exports[_0x6695('0xfc')]=function(_0xb10c61,_0x51a840,_0x296862){var _0x375ea4={};var _0x5e1521={};var _0x1e6f8e;var _0x360bbf;return db['ChatWebsite']['findOne']({'where':{'id':_0xb10c61[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x51a840,null))[_0x6695('0x15')](function(_0x3e6f54){if(_0x3e6f54){_0x1e6f8e=_0x3e6f54;_0x5e1521['model']=_[_0x6695('0x33')](db[_0x6695('0x8d')]['rawAttributes']);_0x5e1521['query']=_['keys'](_0xb10c61[_0x6695('0x34')]);_0x5e1521[_0x6695('0x37')]=_['intersection'](_0x5e1521['model'],_0x5e1521[_0x6695('0x34')]);_0x375ea4[_0x6695('0x3a')]=_[_0x6695('0x38')](_0x5e1521[_0x6695('0x32')],qs[_0x6695('0x39')](_0xb10c61['query'][_0x6695('0x39')]));_0x375ea4[_0x6695('0x3a')]=_0x375ea4[_0x6695('0x3a')][_0x6695('0x4b')]?_0x375ea4['attributes']:_0x5e1521['model'];_0x375ea4[_0x6695('0x55')]=qs[_0x6695('0x3c')](_0xb10c61['query'][_0x6695('0x3c')]);_0x375ea4[_0x6695('0x3d')]=qs[_0x6695('0x37')](_[_0x6695('0x56')](_0xb10c61[_0x6695('0x34')],_0x5e1521[_0x6695('0x37')]));if(_0xb10c61[_0x6695('0x34')]['filter']){_0x375ea4[_0x6695('0x3d')]=_['merge'](_0x375ea4[_0x6695('0x3d')],{'$or':_[_0x6695('0x42')](_0x375ea4[_0x6695('0x3a')],function(_0x463cbc){var _0xba5def={};_0xba5def[_0x463cbc]={'$like':'%'+_0xb10c61['query'][_0x6695('0x41')]+'%'};return _0xba5def;})});}_0x375ea4=_[_0x6695('0x40')]({},_0x375ea4,_0xb10c61[_0x6695('0x43')]);return _0x1e6f8e['getApplications'](_0x375ea4);}})[_0x6695('0x15')](function(_0x12bfc9){if(_0x12bfc9){_0x360bbf=_0x12bfc9[_0x6695('0x4b')];if(!_0xb10c61[_0x6695('0x34')][_0x6695('0x3b')](_0x6695('0x5d'))){_0x375ea4[_0x6695('0x26')]=qs[_0x6695('0x26')](_0xb10c61[_0x6695('0x34')][_0x6695('0x26')]);_0x375ea4[_0x6695('0x25')]=qs[_0x6695('0x25')](_0xb10c61['query'][_0x6695('0x25')]);}return _0x1e6f8e[_0x6695('0xfc')](_0x375ea4);}})[_0x6695('0x15')](function(_0x117835){if(_0x117835){return _0x117835?{'count':_0x360bbf,'rows':_0x117835}:null;}})[_0x6695('0x15')](respondWithResult(_0x51a840,null))[_0x6695('0x20')](handleError(_0x51a840,null));};exports[_0x6695('0xfd')]=function(_0x432743,_0x5148ea,_0x1b1856){return db['chatProactiveAction'][_0x6695('0x4d')]({'where':{'id':_0x432743[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x5148ea,null))[_0x6695('0x15')](function(_0x373d79){if(_0x373d79){return _0x373d79[_0x6695('0xfd')](_0x432743[_0x6695('0x4c')][_0x6695('0x5a')],_[_0x6695('0xd5')](_0x432743[_0x6695('0x4c')],[_0x6695('0x5a'),'id'])||{});}})[_0x6695('0x15')](respondWithResult(_0x5148ea,null))[_0x6695('0x20')](handleError(_0x5148ea,null));};exports['getProactiveActions']=function(_0x472332,_0x2572d8,_0x58b973){var _0x113c4c={};var _0x4d1ec3={};var _0x30e559;var _0x1f02d7;return db[_0x6695('0x31')][_0x6695('0x54')]({'where':{'id':_0x472332[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x2572d8,null))[_0x6695('0x15')](function(_0x11de64){if(_0x11de64){_0x30e559=_0x11de64;_0x4d1ec3[_0x6695('0x32')]=_['keys'](db[_0x6695('0xfe')][_0x6695('0x4a')]);_0x4d1ec3[_0x6695('0x34')]=_[_0x6695('0x33')](_0x472332[_0x6695('0x34')]);_0x4d1ec3['filters']=_['intersection'](_0x4d1ec3[_0x6695('0x32')],_0x4d1ec3['query']);_0x113c4c[_0x6695('0x3a')]=_[_0x6695('0x38')](_0x4d1ec3[_0x6695('0x32')],qs[_0x6695('0x39')](_0x472332['query'][_0x6695('0x39')]));_0x113c4c[_0x6695('0x3a')]=_0x113c4c[_0x6695('0x3a')][_0x6695('0x4b')]?_0x113c4c[_0x6695('0x3a')]:_0x4d1ec3[_0x6695('0x32')];_0x113c4c[_0x6695('0x55')]=qs[_0x6695('0x3c')](_0x472332['query'][_0x6695('0x3c')]);_0x113c4c[_0x6695('0x3d')]=qs['filters'](_[_0x6695('0x56')](_0x472332[_0x6695('0x34')],_0x4d1ec3[_0x6695('0x37')]));if(_0x472332[_0x6695('0x34')][_0x6695('0x41')]){_0x113c4c[_0x6695('0x3d')]=_['merge'](_0x113c4c[_0x6695('0x3d')],{'$or':_[_0x6695('0x42')](_0x113c4c[_0x6695('0x3a')],function(_0x3b6547){var _0x51cdc6={};_0x51cdc6[_0x3b6547]={'$like':'%'+_0x472332['query'][_0x6695('0x41')]+'%'};return _0x51cdc6;})});}_0x113c4c=_[_0x6695('0x40')]({},_0x113c4c,_0x472332[_0x6695('0x43')]);return _0x30e559[_0x6695('0xea')](_0x113c4c);}})[_0x6695('0x15')](function(_0x53d050){if(_0x53d050){_0x1f02d7=_0x53d050[_0x6695('0x4b')];if(!_0x472332[_0x6695('0x34')][_0x6695('0x3b')]('nolimit')){_0x113c4c[_0x6695('0x26')]=qs['limit'](_0x472332[_0x6695('0x34')]['limit']);_0x113c4c[_0x6695('0x25')]=qs[_0x6695('0x25')](_0x472332[_0x6695('0x34')][_0x6695('0x25')]);}return _0x30e559[_0x6695('0xea')](_0x113c4c);}})[_0x6695('0x15')](function(_0x32bc0e){if(_0x32bc0e){return _0x32bc0e?{'count':_0x1f02d7,'rows':_0x32bc0e}:null;}})['then'](respondWithResult(_0x2572d8,null))[_0x6695('0x20')](handleError(_0x2572d8,null));};exports[_0x6695('0xff')]=function(_0x1a9bd9,_0x595bbc,_0x152104){var _0x3e7c5c=_0x1a9bd9[_0x6695('0x34')][_0x6695('0x100')]===_0x6695('0x101')?_0x6695('0x102'):_0x6695('0x103');return db[_0x6695('0x31')][_0x6695('0x4d')]({'attributes':['id',_0x3e7c5c],'where':{'id':_0x1a9bd9[_0x6695('0x49')]['id']}})[_0x6695('0x15')](handleEntityNotFound(_0x595bbc,null))[_0x6695('0x15')](function(_0x56c7b9){if(_0x56c7b9){var _0x3e71bf=_0x56c7b9[_0x3e7c5c];var _0x2ba938=_0x3e71bf&&_0x3e71bf[_0x6695('0x104')]?_0x3e71bf[_0x6695('0x104')]:[];_0x595bbc[_0x6695('0x2f')]({'fromKey':_[_0x6695('0x6c')](_0x3e71bf[_0x6695('0x105')])?undefined:_0x3e71bf['fromKey'],'count':_0x2ba938[_0x6695('0x4b')],'rows':_0x2ba938});}})['catch'](handleError(_0x595bbc,null));};exports[_0x6695('0x106')]=function(_0x474932,_0x2cc572,_0x90f3c6){var _0x1a8809={'raw':!![],'where':{}};var _0x5d4992={};var _0x2d3ab2={'count':0x0,'rows':[]};return db[_0x6695('0x31')][_0x6695('0x54')]({'where':{'id':_0x474932[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cc572,null))[_0x6695('0x15')](function(_0x58c276){if(_0x58c276){_0x5d4992[_0x6695('0x32')]=_[_0x6695('0x33')](db[_0x6695('0xc4')][_0x6695('0x4a')]);_0x5d4992['query']=_[_0x6695('0x33')](_0x474932[_0x6695('0x34')]);_0x5d4992[_0x6695('0x37')]=_[_0x6695('0x38')](_0x5d4992[_0x6695('0x32')],_0x5d4992['query']);_0x1a8809[_0x6695('0x3a')]=_[_0x6695('0x38')](_0x5d4992[_0x6695('0x32')],qs[_0x6695('0x39')](_0x474932[_0x6695('0x34')][_0x6695('0x39')]));_0x1a8809[_0x6695('0x3a')]=_0x1a8809['attributes'][_0x6695('0x4b')]?_0x1a8809['attributes']:_0x5d4992['model'];if(!_0x474932[_0x6695('0x34')][_0x6695('0x3b')](_0x6695('0x5d'))){_0x1a8809['limit']=qs['limit'](_0x474932[_0x6695('0x34')]['limit']);_0x1a8809[_0x6695('0x25')]=qs[_0x6695('0x25')](_0x474932[_0x6695('0x34')][_0x6695('0x25')]);}_0x1a8809[_0x6695('0x55')]=qs[_0x6695('0x3c')](_0x474932[_0x6695('0x34')][_0x6695('0x3c')]);_0x1a8809[_0x6695('0x3d')]=qs[_0x6695('0x37')](_['pick'](_0x474932[_0x6695('0x34')],_0x5d4992['filters']));_0x1a8809[_0x6695('0x3d')][_0x6695('0x57')]=_0x58c276['id'];if(_0x474932[_0x6695('0x34')]['filter']){_0x1a8809['where']=_['merge'](_0x1a8809['where'],{'$or':_[_0x6695('0x42')](_0x1a8809[_0x6695('0x3a')],function(_0x181514){var _0x27d5ba={};_0x27d5ba[_0x181514]={'$like':'%'+_0x474932[_0x6695('0x34')][_0x6695('0x41')]+'%'};return _0x27d5ba;})});}_0x1a8809=_[_0x6695('0x40')]({},_0x1a8809,_0x474932[_0x6695('0x43')]);return db[_0x6695('0xc4')][_0x6695('0x44')]({'where':_0x1a8809[_0x6695('0x3d')]})[_0x6695('0x15')](function(_0x2da29b){_0x2d3ab2[_0x6695('0x44')]=_0x2da29b;if(_0x474932['query'][_0x6695('0x45')]){_0x1a8809[_0x6695('0x46')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x6695('0x58')](_0x1a8809);})[_0x6695('0x15')](function(_0x4a2ce6){_0x2d3ab2[_0x6695('0x47')]=_0x4a2ce6;return _0x2d3ab2;});}})[_0x6695('0x15')](respondWithFilteredResult(_0x2cc572,_0x1a8809))[_0x6695('0x20')](handleError(_0x2cc572,null));};exports['addAgents']=function(_0x4301b3,_0x4834ce,_0x5e7e64){return db[_0x6695('0x31')][_0x6695('0x4d')]({'where':{'id':_0x4301b3[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x4834ce,null))[_0x6695('0x15')](function(_0x4bfba4){if(_0x4bfba4){return _0x4bfba4[_0x6695('0x107')](_0x4301b3[_0x6695('0x4c')][_0x6695('0x5a')],_[_0x6695('0xd5')](_0x4301b3[_0x6695('0x4c')],[_0x6695('0x5a'),'id'])||{})[_0x6695('0xa8')](function(_0x57f751){for(var _0x5b1c42=0x0;_0x5b1c42<_0x4301b3['body'][_0x6695('0x5a')][_0x6695('0x4b')];_0x5b1c42+=0x1){socket[_0x6695('0x108')](_0x6695('0x109'),{'UserId':_0x4301b3[_0x6695('0x4c')]['ids'][_0x5b1c42],'ChatWebsiteId':_0x4301b3[_0x6695('0x49')]['id']});}return _0x57f751;});}})[_0x6695('0x15')](respondWithResult(_0x4834ce,null))[_0x6695('0x20')](handleError(_0x4834ce,null));};exports[_0x6695('0x10a')]=function(_0x4d1dce,_0x4a9efb,_0x61da29){var _0x412717;return db['ChatWebsite'][_0x6695('0x4d')]({'where':{'id':_0x4d1dce[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a9efb,null))[_0x6695('0x15')](function(_0x1a4c4b){if(_0x1a4c4b){return _0x1a4c4b[_0x6695('0x10a')](_0x4d1dce[_0x6695('0x34')][_0x6695('0x5a')])[_0x6695('0x15')](function(_0x3650ab){if(_[_0x6695('0x10b')](_0x4d1dce[_0x6695('0x34')][_0x6695('0x5a')])){for(var _0x1612d5=0x0;_0x1612d5<_0x4d1dce[_0x6695('0x34')][_0x6695('0x5a')][_0x6695('0x4b')];_0x1612d5+=0x1){socket[_0x6695('0x108')]('userChatWebsite:remove',{'UserId':_0x4d1dce['query'][_0x6695('0x5a')][_0x1612d5],'ChatWebsiteId':_0x4d1dce[_0x6695('0x49')]['id']});}}else{socket[_0x6695('0x108')](_0x6695('0x10c'),{'UserId':_0x4d1dce[_0x6695('0x34')]['ids'],'ChatWebsiteId':_0x4d1dce[_0x6695('0x49')]['id']});}});}})[_0x6695('0x15')](respondWithStatusCode(_0x4a9efb,null))[_0x6695('0x20')](handleError(_0x4a9efb,null));};exports['getAgents']=function(_0x57b959,_0x3e0be8,_0x51eaa5){var _0x3420d3={};var _0x2d8037={};var _0x3b33bb;var _0x171407;return db['ChatWebsite']['findOne']({'where':{'id':_0x57b959[_0x6695('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e0be8,null))[_0x6695('0x15')](function(_0x4ed46c){if(_0x4ed46c){_0x3b33bb=_0x4ed46c;_0x2d8037['model']=_['keys'](db['User'][_0x6695('0x4a')]);_0x2d8037['query']=_['keys'](_0x57b959[_0x6695('0x34')]);_0x2d8037[_0x6695('0x37')]=_[_0x6695('0x38')](_0x2d8037[_0x6695('0x32')],_0x2d8037[_0x6695('0x34')]);_0x3420d3[_0x6695('0x3a')]=_[_0x6695('0x38')](_0x2d8037['model'],qs[_0x6695('0x39')](_0x57b959[_0x6695('0x34')]['fields']));_0x3420d3['attributes']=_0x3420d3[_0x6695('0x3a')][_0x6695('0x4b')]?_0x3420d3[_0x6695('0x3a')]:_0x2d8037[_0x6695('0x32')];_0x3420d3[_0x6695('0x55')]=qs[_0x6695('0x3c')](_0x57b959[_0x6695('0x34')][_0x6695('0x3c')]);_0x3420d3[_0x6695('0x3d')]=qs['filters'](_[_0x6695('0x56')](_0x57b959[_0x6695('0x34')],_0x2d8037[_0x6695('0x37')]));if(_0x57b959[_0x6695('0x34')][_0x6695('0x41')]){_0x3420d3[_0x6695('0x3d')]=_['merge'](_0x3420d3[_0x6695('0x3d')],{'$or':_[_0x6695('0x42')](_0x3420d3[_0x6695('0x3a')],function(_0x3f3236){var _0x34c47b={};_0x34c47b[_0x3f3236]={'$like':'%'+_0x57b959[_0x6695('0x34')][_0x6695('0x41')]+'%'};return _0x34c47b;})});}_0x3420d3=_[_0x6695('0x40')]({},_0x3420d3,_0x57b959['options']);return _0x3b33bb[_0x6695('0x10d')](_0x3420d3);}})[_0x6695('0x15')](function(_0x13dc35){if(_0x13dc35){_0x171407=_0x13dc35[_0x6695('0x4b')];if(!_0x57b959[_0x6695('0x34')]['hasOwnProperty']('nolimit')){_0x3420d3[_0x6695('0x26')]=qs[_0x6695('0x26')](_0x57b959[_0x6695('0x34')][_0x6695('0x26')]);_0x3420d3[_0x6695('0x25')]=qs[_0x6695('0x25')](_0x57b959[_0x6695('0x34')]['offset']);}return _0x3b33bb['getAgents'](_0x3420d3);}})[_0x6695('0x15')](function(_0x4dcc27){if(_0x4dcc27){return _0x4dcc27?{'count':_0x171407,'rows':_0x4dcc27}:null;}})['then'](respondWithResult(_0x3e0be8,null))['catch'](handleError(_0x3e0be8,null));}; \ No newline at end of file +var _0x2a29=['day','merge','filter','map','options','findAll','show','includeAll','include','find','create','params','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','rows','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','custom','existsSync','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','getCustomerAvatar','server/files/images/avatars/','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','Sequelize','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','List','DESC','ChatApplication','Applications','account','applications','priority','asc','Contacts','defaults','contact','firstName','lastName','customerIp','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','type','threadId','ChatInteraction','externalUrl','interaction','spread','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','user','forwardOfflineAddress','offlineMessageSubject','addInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','timezone','iftime\x20%s,%s','iftime\x20%s','interval','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','getSnippet','Interval','Intervals','getProactiveActions','../../config/license/util','getLicense','License','increment','chatLicenseExceeded','all','remote','headers','x-real-ip','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','ChatWebsite','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add'];(function(_0x50701,_0x4fa7a1){var _0x5eb3bf=function(_0x17c119){while(--_0x17c119){_0x50701['push'](_0x50701['shift']());}};_0x5eb3bf(++_0x4fa7a1);}(_0x2a29,0xc5));var _0x92a2=function(_0x5461f0,_0xb3181a){_0x5461f0=_0x5461f0-0x0;var _0x1868d3=_0x2a29[_0x5461f0];return _0x1868d3;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x92a2('0x0'));var Mustache=require('mustache');var util=require(_0x92a2('0x1'));var path=require(_0x92a2('0x2'));var sox=require(_0x92a2('0x3'));var csv=require(_0x92a2('0x4'));var ejs=require(_0x92a2('0x5'));var fs=require('fs');var _=require(_0x92a2('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x92a2('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x92a2('0x4'));var querystring=require(_0x92a2('0x8'));var Papa=require(_0x92a2('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0x92a2('0xa'))('api');var utils=require('../../config/utils');var config=require(_0x92a2('0xb'));var db=require(_0x92a2('0xc'))['db'];var socket=require(_0x92a2('0xd'))({'host':_0x92a2('0xe'),'port':0x18eb});require('./chatWebsite.socket')[_0x92a2('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x92a2('0x10')]['http']({'port':0x232c});var client9002=jayson['client'][_0x92a2('0x11')]({'port':0x232a});var client9003=jayson['client'][_0x92a2('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x4a01d6,_0x5cc8f2,_0x51fd72,_0x1a6a38){return new BPromise(function(_0x5beded,_0x576cac){var _0x49160c=_0x1a6a38||client;return _0x49160c[_0x92a2('0x12')](_0x4a01d6,_0x51fd72)[_0x92a2('0x13')](function(_0x3ee05e){logger['info'](_0x92a2('0x14'),_0x5cc8f2,_0x92a2('0x15'));logger[_0x92a2('0x16')](_0x92a2('0x17'),_0x5cc8f2,_0x92a2('0x15'),JSON[_0x92a2('0x18')](_0x3ee05e));if(_0x3ee05e[_0x92a2('0x19')]){if(_0x3ee05e[_0x92a2('0x19')]['code']===0x1f4){logger[_0x92a2('0x19')](_0x92a2('0x14'),_0x5cc8f2,_0x3ee05e['error'][_0x92a2('0x1a')]);return _0x576cac(_0x3ee05e[_0x92a2('0x19')][_0x92a2('0x1a')]);}logger[_0x92a2('0x19')](_0x92a2('0x14'),_0x5cc8f2,_0x3ee05e['error'][_0x92a2('0x1a')]);return _0x5beded(_0x3ee05e[_0x92a2('0x19')]['message']);}else{logger[_0x92a2('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x5cc8f2,'request\x20sent');_0x5beded(_0x3ee05e[_0x92a2('0x1c')]['message']);}})[_0x92a2('0x1d')](function(_0x8e7be3){logger['error'](_0x92a2('0x14'),_0x5cc8f2,_0x8e7be3);_0x576cac(_0x8e7be3);});});}function respondWithStatusCode(_0x6d0377,_0x5a56f8){_0x5a56f8=_0x5a56f8||0xcc;return function(_0x43df16){if(_0x43df16){return _0x6d0377['sendStatus'](_0x5a56f8);}return _0x6d0377[_0x92a2('0x1e')](_0x5a56f8)[_0x92a2('0x1f')]();};}function respondWithResult(_0x580669,_0x50238b){_0x50238b=_0x50238b||0xc8;return function(_0x50d7bb){if(_0x50d7bb){return _0x580669[_0x92a2('0x1e')](_0x50238b)[_0x92a2('0x20')](_0x50d7bb);}};}function respondWithFilteredResult(_0xc5106d,_0xa11761){return function(_0x3bfb71){if(_0x3bfb71){var _0x4f7b95=_0x3bfb71[_0x92a2('0x21')],_0x17cf0c=_0xa11761['offset'],_0xb9125=_0xa11761[_0x92a2('0x22')]+_0xa11761[_0x92a2('0x23')],_0x4c5217;if(_0xb9125>=_0x4f7b95){_0xb9125=_0x4f7b95;_0x4c5217=0xc8;}else{_0x4c5217=0xce;}_0xc5106d[_0x92a2('0x1e')](_0x4c5217);return _0xc5106d[_0x92a2('0x24')](_0x92a2('0x25'),_0x17cf0c+'-'+_0xb9125+'/'+_0x4f7b95)[_0x92a2('0x20')](_0x3bfb71);}return null;};}function patchUpdates(_0x507625){return function(_0x58b3eb){try{jsonpatch[_0x92a2('0x26')](_0x58b3eb,_0x507625,!![]);}catch(_0xcd45f3){return BPromise[_0x92a2('0x27')](_0xcd45f3);}return _0x58b3eb[_0x92a2('0x28')]();};}function saveUpdates(_0x276956,_0xf992ef){return function(_0x36018e){if(_0x36018e){return _0x36018e[_0x92a2('0x29')](_0x276956)[_0x92a2('0x13')](function(_0x2108b7){return _0x2108b7;});}return null;};}function removeEntity(_0x1720a8,_0x3b9fd0){return function(_0x4db64a){if(_0x4db64a){return _0x4db64a[_0x92a2('0x2a')]()[_0x92a2('0x13')](function(){_0x1720a8[_0x92a2('0x1e')](0xcc)[_0x92a2('0x1f')]();});}};}function handleEntityNotFound(_0x5434a5,_0x3af8c7){return function(_0x394c27){if(!_0x394c27){_0x5434a5['sendStatus'](0x194);}return _0x394c27;};}function handleError(_0x425208,_0x2b6728){_0x2b6728=_0x2b6728||0x1f4;return function(_0x2b6de0){logger['error'](_0x2b6de0['stack']);if(_0x2b6de0[_0x92a2('0x2b')]){delete _0x2b6de0[_0x92a2('0x2b')];}_0x425208['status'](_0x2b6728)[_0x92a2('0x2c')](_0x2b6de0);};}exports[_0x92a2('0x2d')]=function(_0x5904bf,_0x3839cf){var _0x3cf441={},_0x423959={},_0x4d6a22={'count':0x0,'rows':[]};var _0x1ba372=db[_0x92a2('0x2e')][_0x92a2('0x2f')];_0x423959[_0x92a2('0x30')]=_[_0x92a2('0x31')](_0x1ba372);var _0x268288={'dateStart':_0x5904bf['query'][_0x92a2('0x32')],'dateEnd':_0x5904bf[_0x92a2('0x33')][_0x92a2('0x34')]};delete _0x5904bf[_0x92a2('0x33')][_0x92a2('0x32')];delete _0x5904bf[_0x92a2('0x33')]['dateEnd'];_0x423959[_0x92a2('0x33')]=_['keys'](_0x5904bf[_0x92a2('0x33')]);_0x423959[_0x92a2('0x35')]=_[_0x92a2('0x36')](_0x423959[_0x92a2('0x30')],_0x423959['query']);_0x3cf441[_0x92a2('0x37')]=_[_0x92a2('0x36')](_0x423959[_0x92a2('0x30')],qs['fields'](_0x5904bf[_0x92a2('0x33')][_0x92a2('0x38')]));_0x3cf441[_0x92a2('0x37')]=_0x3cf441[_0x92a2('0x37')][_0x92a2('0x39')]?_0x3cf441[_0x92a2('0x37')]:_0x423959[_0x92a2('0x30')];if(!_0x5904bf[_0x92a2('0x33')]['hasOwnProperty'](_0x92a2('0x3a'))){_0x3cf441[_0x92a2('0x23')]=qs[_0x92a2('0x23')](_0x5904bf[_0x92a2('0x33')][_0x92a2('0x23')]);_0x3cf441[_0x92a2('0x22')]=qs[_0x92a2('0x22')](_0x5904bf[_0x92a2('0x33')][_0x92a2('0x22')]);}_0x3cf441[_0x92a2('0x3b')]=qs[_0x92a2('0x3c')](_0x5904bf[_0x92a2('0x33')][_0x92a2('0x3c')]);_0x3cf441[_0x92a2('0x3d')]=qs[_0x92a2('0x35')](_[_0x92a2('0x3e')](_0x5904bf['query'],_0x423959['filters']));if(_0x268288[_0x92a2('0x32')]){if(_0x268288[_0x92a2('0x34')]){_0x268288[_0x92a2('0x34')]=moment(_0x268288[_0x92a2('0x34')])[_0x92a2('0x3f')](0x1,_0x92a2('0x40'));}else{_0x268288[_0x92a2('0x34')]=moment(_0x268288[_0x92a2('0x32')])[_0x92a2('0x3f')](0x1,_0x92a2('0x40'));}_[_0x92a2('0x41')](_0x3cf441[_0x92a2('0x3d')],{'createdAt':{'$gte':_0x268288[_0x92a2('0x32')],'$lte':_0x268288[_0x92a2('0x34')]}});}if(_0x5904bf['query'][_0x92a2('0x42')]){_0x3cf441[_0x92a2('0x3d')]=_[_0x92a2('0x41')](_0x3cf441[_0x92a2('0x3d')],{'$or':_[_0x92a2('0x43')](_0x3cf441[_0x92a2('0x37')],function(_0x103f69){var _0x5dad55={};_0x5dad55[_0x103f69]={'$like':'%'+_0x5904bf[_0x92a2('0x33')][_0x92a2('0x42')]+'%'};return _0x5dad55;})});}_0x3cf441=_[_0x92a2('0x41')]({},_0x3cf441,_0x5904bf[_0x92a2('0x44')]);var _0x412631={'where':_0x3cf441[_0x92a2('0x3d')]};return db[_0x92a2('0x2e')][_0x92a2('0x21')](_0x412631)[_0x92a2('0x13')](function(_0x5e383f){_0x4d6a22[_0x92a2('0x21')]=_0x5e383f;if(_0x5904bf[_0x92a2('0x33')]['includeAll']){_0x3cf441['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x92a2('0x45')](_0x3cf441);})[_0x92a2('0x13')](function(_0x36b70b){_0x4d6a22['rows']=_0x36b70b;return _0x4d6a22;})[_0x92a2('0x13')](respondWithFilteredResult(_0x3839cf,_0x3cf441))[_0x92a2('0x1d')](handleError(_0x3839cf,null));};exports[_0x92a2('0x46')]=function(_0x5b1624,_0x2e66a6){var _0x290099={'raw':![],'where':{'id':_0x5b1624['params']['id']}},_0x5e4227={};_0x5e4227[_0x92a2('0x30')]=_[_0x92a2('0x31')](db[_0x92a2('0x2e')][_0x92a2('0x2f')]);_0x5e4227['query']=_['keys'](_0x5b1624[_0x92a2('0x33')]);_0x5e4227[_0x92a2('0x35')]=_[_0x92a2('0x36')](_0x5e4227[_0x92a2('0x30')],_0x5e4227[_0x92a2('0x33')]);_0x290099['attributes']=_[_0x92a2('0x36')](_0x5e4227[_0x92a2('0x30')],qs[_0x92a2('0x38')](_0x5b1624['query'][_0x92a2('0x38')]));_0x290099['attributes']=_0x290099[_0x92a2('0x37')][_0x92a2('0x39')]?_0x290099[_0x92a2('0x37')]:_0x5e4227['model'];if(_0x5b1624[_0x92a2('0x33')][_0x92a2('0x47')]){_0x290099[_0x92a2('0x48')]=[{'all':!![]}];}_0x290099=_['merge']({},_0x290099,_0x5b1624['options']);return db['ChatWebsite'][_0x92a2('0x49')](_0x290099)[_0x92a2('0x13')](handleEntityNotFound(_0x2e66a6,null))[_0x92a2('0x13')](respondWithResult(_0x2e66a6,null))[_0x92a2('0x1d')](handleError(_0x2e66a6,null));};exports['create']=function(_0x30c551,_0x1b8730){return db['ChatWebsite'][_0x92a2('0x4a')](_0x30c551['body'],{})[_0x92a2('0x13')](respondWithResult(_0x1b8730,0xc9))[_0x92a2('0x1d')](handleError(_0x1b8730,null));};exports['update']=function(_0x557780,_0x5c5d3d){if(_0x557780['body']['id']){delete _0x557780['body']['id'];}return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x557780[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x5c5d3d,null))[_0x92a2('0x13')](saveUpdates(_0x557780[_0x92a2('0x4c')],null))[_0x92a2('0x13')](respondWithResult(_0x5c5d3d,null))[_0x92a2('0x1d')](handleError(_0x5c5d3d,null));};exports[_0x92a2('0x2a')]=function(_0x1720be,_0x444764){return db[_0x92a2('0x2e')]['find']({'where':{'id':_0x1720be[_0x92a2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x444764,null))[_0x92a2('0x13')](removeEntity(_0x444764,null))[_0x92a2('0x1d')](handleError(_0x444764,null));};exports[_0x92a2('0x4d')]=function(_0x31fd3b,_0x33e87f){return db[_0x92a2('0x2e')][_0x92a2('0x4d')]()[_0x92a2('0x13')](respondWithResult(_0x33e87f,null))[_0x92a2('0x1d')](handleError(_0x33e87f,null));};exports[_0x92a2('0x4e')]=function(_0x440a43,_0x40e3ee,_0x38effa){if(_0x440a43[_0x92a2('0x4c')]['id']){delete _0x440a43[_0x92a2('0x4c')]['id'];}return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x440a43['params']['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x40e3ee,null))['then'](function(_0xfad081){if(_0xfad081){_0x440a43[_0x92a2('0x4c')][_0x92a2('0x4f')]=_0xfad081['id'];return db[_0x92a2('0x50')]['create'](_0x440a43[_0x92a2('0x4c')]);}})['then'](respondWithResult(_0x40e3ee,null))[_0x92a2('0x1d')](handleError(_0x40e3ee,null));};exports[_0x92a2('0x51')]=function(_0x2b7d12,_0x51c168,_0x2f7ed6){var _0x10c4d0={'raw':![],'where':{}};var _0x1755be={};var _0x3f1ea5={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x92a2('0x52')]({'where':{'id':_0x2b7d12[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x51c168,null))[_0x92a2('0x13')](function(_0x299696){if(_0x299696){_0x1755be[_0x92a2('0x30')]=_['keys'](db[_0x92a2('0x50')][_0x92a2('0x2f')]);_0x1755be['query']=_[_0x92a2('0x31')](_0x2b7d12[_0x92a2('0x33')]);_0x1755be[_0x92a2('0x35')]=_['intersection'](_0x1755be['model'],_0x1755be[_0x92a2('0x33')]);_0x10c4d0[_0x92a2('0x37')]=_['intersection'](_0x1755be[_0x92a2('0x30')],qs[_0x92a2('0x38')](_0x2b7d12[_0x92a2('0x33')][_0x92a2('0x38')]));_0x10c4d0[_0x92a2('0x37')]=_0x10c4d0[_0x92a2('0x37')][_0x92a2('0x39')]?_0x10c4d0[_0x92a2('0x37')]:_0x1755be['model'];if(!_0x2b7d12['query'][_0x92a2('0x53')]('nolimit')){_0x10c4d0[_0x92a2('0x23')]=qs['limit'](_0x2b7d12[_0x92a2('0x33')][_0x92a2('0x23')]);_0x10c4d0[_0x92a2('0x22')]=qs['offset'](_0x2b7d12[_0x92a2('0x33')]['offset']);}_0x10c4d0[_0x92a2('0x3b')]=qs[_0x92a2('0x3c')](_0x2b7d12[_0x92a2('0x33')][_0x92a2('0x3c')]);_0x10c4d0[_0x92a2('0x3d')]=qs['filters'](_[_0x92a2('0x3e')](_0x2b7d12[_0x92a2('0x33')],_0x1755be[_0x92a2('0x35')]));_0x10c4d0[_0x92a2('0x3d')][_0x92a2('0x4f')]=_0x299696['id'];if(_0x2b7d12[_0x92a2('0x33')][_0x92a2('0x42')]){_0x10c4d0[_0x92a2('0x3d')]=_[_0x92a2('0x41')](_0x10c4d0[_0x92a2('0x3d')],{'$or':_[_0x92a2('0x43')](_0x10c4d0[_0x92a2('0x37')],function(_0x3e066a){var _0x490307={};_0x490307[_0x3e066a]={'$like':'%'+_0x2b7d12[_0x92a2('0x33')]['filter']+'%'};return _0x490307;})});}_0x10c4d0=_[_0x92a2('0x41')]({},_0x10c4d0,_0x2b7d12[_0x92a2('0x44')]);return db[_0x92a2('0x50')][_0x92a2('0x21')]({'where':_0x10c4d0[_0x92a2('0x3d')]})[_0x92a2('0x13')](function(_0x5a82fc){_0x3f1ea5['count']=_0x5a82fc;if(_0x2b7d12[_0x92a2('0x33')][_0x92a2('0x47')]){_0x10c4d0['include']=[{'all':!![]}];}return db[_0x92a2('0x50')][_0x92a2('0x45')](_0x10c4d0);})['then'](function(_0x17f446){_0x3f1ea5['rows']=_0x17f446;return _0x3f1ea5;});}})[_0x92a2('0x13')](respondWithFilteredResult(_0x51c168,_0x10c4d0))['catch'](handleError(_0x51c168,null));};exports[_0x92a2('0x54')]=function(_0x12ddbd,_0x256155,_0x8d4456){var _0x140129;return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x12ddbd['params']['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x256155,null))[_0x92a2('0x13')](function(_0x197054){if(_0x197054){return _0x197054[_0x92a2('0x54')](_0x12ddbd[_0x92a2('0x33')]['ids']);}})[_0x92a2('0x13')](respondWithStatusCode(_0x256155,null))[_0x92a2('0x1d')](handleError(_0x256155,null));};exports[_0x92a2('0x55')]=function(_0x3bbb40,_0x4b2da0,_0x3dcddb){if(_0x3bbb40[_0x92a2('0x4c')]['id']){delete _0x3bbb40['body']['id'];}return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x3bbb40[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x4b2da0,null))[_0x92a2('0x13')](function(_0xa01ab0){if(_0xa01ab0){_0x3bbb40[_0x92a2('0x4c')]['ChatWebsiteId']=_0xa01ab0['id'];return db[_0x92a2('0x56')][_0x92a2('0x4a')](_0x3bbb40[_0x92a2('0x4c')]);}})[_0x92a2('0x13')](respondWithResult(_0x4b2da0,null))[_0x92a2('0x1d')](handleError(_0x4b2da0,null));};exports['getAnswers']=function(_0x2cc9b5,_0x3829ac,_0x713e85){var _0x30058c={'raw':![],'where':{}};var _0x34808d={};var _0x2a92cb={'count':0x0,'rows':[]};return db[_0x92a2('0x2e')][_0x92a2('0x52')]({'where':{'id':_0x2cc9b5[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x3829ac,null))['then'](function(_0x3a50d5){if(_0x3a50d5){_0x34808d['model']=_[_0x92a2('0x31')](db[_0x92a2('0x56')]['rawAttributes']);_0x34808d[_0x92a2('0x33')]=_[_0x92a2('0x31')](_0x2cc9b5[_0x92a2('0x33')]);_0x34808d['filters']=_[_0x92a2('0x36')](_0x34808d[_0x92a2('0x30')],_0x34808d[_0x92a2('0x33')]);_0x30058c[_0x92a2('0x37')]=_[_0x92a2('0x36')](_0x34808d[_0x92a2('0x30')],qs[_0x92a2('0x38')](_0x2cc9b5[_0x92a2('0x33')][_0x92a2('0x38')]));_0x30058c[_0x92a2('0x37')]=_0x30058c['attributes'][_0x92a2('0x39')]?_0x30058c[_0x92a2('0x37')]:_0x34808d[_0x92a2('0x30')];if(!_0x2cc9b5[_0x92a2('0x33')]['hasOwnProperty']('nolimit')){_0x30058c[_0x92a2('0x23')]=qs['limit'](_0x2cc9b5[_0x92a2('0x33')][_0x92a2('0x23')]);_0x30058c[_0x92a2('0x22')]=qs[_0x92a2('0x22')](_0x2cc9b5[_0x92a2('0x33')][_0x92a2('0x22')]);}_0x30058c['order']=qs[_0x92a2('0x3c')](_0x2cc9b5[_0x92a2('0x33')][_0x92a2('0x3c')]);_0x30058c[_0x92a2('0x3d')]=qs[_0x92a2('0x35')](_['pick'](_0x2cc9b5[_0x92a2('0x33')],_0x34808d['filters']));_0x30058c[_0x92a2('0x3d')]['ChatWebsiteId']=_0x3a50d5['id'];if(_0x2cc9b5[_0x92a2('0x33')]['filter']){_0x30058c[_0x92a2('0x3d')]=_[_0x92a2('0x41')](_0x30058c[_0x92a2('0x3d')],{'$or':_[_0x92a2('0x43')](_0x30058c[_0x92a2('0x37')],function(_0x4ab17d){var _0x5d8f94={};_0x5d8f94[_0x4ab17d]={'$like':'%'+_0x2cc9b5[_0x92a2('0x33')][_0x92a2('0x42')]+'%'};return _0x5d8f94;})});}_0x30058c=_['merge']({},_0x30058c,_0x2cc9b5[_0x92a2('0x44')]);return db['CannedAnswer'][_0x92a2('0x21')]({'where':_0x30058c[_0x92a2('0x3d')]})[_0x92a2('0x13')](function(_0x4b987d){_0x2a92cb['count']=_0x4b987d;if(_0x2cc9b5[_0x92a2('0x33')][_0x92a2('0x47')]){_0x30058c[_0x92a2('0x48')]=[{'all':!![]}];}return db[_0x92a2('0x56')][_0x92a2('0x45')](_0x30058c);})['then'](function(_0x2016a7){_0x2a92cb[_0x92a2('0x57')]=_0x2016a7;return _0x2a92cb;});}})[_0x92a2('0x13')](respondWithFilteredResult(_0x3829ac,_0x30058c))[_0x92a2('0x1d')](handleError(_0x3829ac,null));};exports['removeAnswers']=function(_0x2006a4,_0x2f008d,_0x3625f2){var _0x36874c;return db[_0x92a2('0x2e')]['find']({'where':{'id':_0x2006a4['params']['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x2f008d,null))[_0x92a2('0x13')](function(_0x20b44d){if(_0x20b44d){return _0x20b44d[_0x92a2('0x58')](_0x2006a4[_0x92a2('0x33')][_0x92a2('0x59')]);}})[_0x92a2('0x13')](respondWithStatusCode(_0x2f008d,null))['catch'](handleError(_0x2f008d,null));};exports[_0x92a2('0x5a')]=function(_0x1cb5d1,_0x35e513,_0x6edb7b){_0x1cb5d1['body'][_0x92a2('0x5b')]=_0x1cb5d1[_0x92a2('0x5c')][_0x92a2('0x5d')];return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x1cb5d1[_0x92a2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x35e513,null))[_0x92a2('0x13')](saveUpdates(_0x1cb5d1['body'],null))[_0x92a2('0x13')](respondWithResult(_0x35e513,null))['catch'](handleError(_0x35e513,null));};exports[_0x92a2('0x5e')]=function(_0x228d1b,_0x5dc195,_0x4f64dd){_0x228d1b['body'][_0x92a2('0x5f')]=_0x228d1b[_0x92a2('0x5c')][_0x92a2('0x5d')];return db['ChatWebsite'][_0x92a2('0x49')]({'where':{'id':_0x228d1b[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x5dc195,null))['then'](saveUpdates(_0x228d1b[_0x92a2('0x4c')],null))[_0x92a2('0x13')](respondWithResult(_0x5dc195,null))[_0x92a2('0x1d')](handleError(_0x5dc195,null));};exports[_0x92a2('0x60')]=function(_0x3687eb,_0x1763f7,_0x24594e){_0x3687eb['body'][_0x92a2('0x61')]=_0x3687eb['file'][_0x92a2('0x5d')];return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x3687eb[_0x92a2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1763f7,null))[_0x92a2('0x13')](saveUpdates(_0x3687eb['body'],null))[_0x92a2('0x13')](respondWithResult(_0x1763f7,null))[_0x92a2('0x1d')](handleError(_0x1763f7,null));};exports[_0x92a2('0x62')]=function(_0x446e01,_0x28b2d7,_0x2fd42b){_0x446e01[_0x92a2('0x4c')]['systemAvatar']=_0x446e01[_0x92a2('0x5c')][_0x92a2('0x5d')];return db[_0x92a2('0x2e')]['find']({'where':{'id':_0x446e01[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x28b2d7,null))[_0x92a2('0x13')](saveUpdates(_0x446e01[_0x92a2('0x4c')],null))[_0x92a2('0x13')](respondWithResult(_0x28b2d7,null))['catch'](handleError(_0x28b2d7,null));};exports['getLogo']=function(_0x55ee53,_0x5f4e3f,_0x590300){var _0x4d6d7b=path['join'](config['root'],'server/files/images/logos/default_logo.png');var _0x10c1ea={'where':{'id':_0x55ee53[_0x92a2('0x4b')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x575045=![];return require('../../config/license/util')['getLicense']()[_0x92a2('0x13')](function(_0x32763a){if(_0x32763a){_0x575045=_0x32763a[_0x92a2('0x63')];}})['then'](function(){return db[_0x92a2('0x2e')]['find'](_0x10c1ea);})[_0x92a2('0x13')](handleEntityNotFound(_0x5f4e3f,null))[_0x92a2('0x13')](function(_0x194b25){if(_0x194b25){if(!_['isNil'](_0x194b25[_0x92a2('0x5b')])){if(fs[_0x92a2('0x64')](path[_0x92a2('0x65')](config[_0x92a2('0x66')],'server/files/images/logos/',_0x194b25[_0x92a2('0x5b')]))&&_0x575045){_0x4d6d7b=path[_0x92a2('0x65')](config[_0x92a2('0x66')],_0x92a2('0x67'),_0x194b25['sitepic']);}}return _0x5f4e3f[_0x92a2('0x68')](_0x4d6d7b);}})[_0x92a2('0x1d')](handleError(_0x5f4e3f,null));};exports[_0x92a2('0x69')]=function(_0x3b990d,_0x396164,_0x21e0a4){var _0x221daf=path[_0x92a2('0x65')](config[_0x92a2('0x66')],_0x92a2('0x6a'));var _0x4783a2={'where':{'id':_0x3b990d['params']['id']},'attributes':['id',_0x92a2('0x5f')],'raw':!![]};return db[_0x92a2('0x2e')]['find'](_0x4783a2)[_0x92a2('0x13')](handleEntityNotFound(_0x396164,null))[_0x92a2('0x13')](function(_0x431848){if(_0x431848){if(!_[_0x92a2('0x6b')](_0x431848[_0x92a2('0x5f')])){if(fs[_0x92a2('0x64')](path[_0x92a2('0x65')](config['root'],'server/files/images/avatars/',_0x431848[_0x92a2('0x5f')]))){_0x221daf=path[_0x92a2('0x65')](config[_0x92a2('0x66')],'server/files/images/avatars/',_0x431848[_0x92a2('0x5f')]);}}return _0x396164[_0x92a2('0x68')](_0x221daf);}})[_0x92a2('0x1d')](handleError(_0x396164,null));};exports[_0x92a2('0x6c')]=function(_0x5b0e9c,_0x37575f,_0x459a24){var _0x214c65=path[_0x92a2('0x65')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x8b51b4={'where':{'id':_0x5b0e9c[_0x92a2('0x4b')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x92a2('0x2e')]['find'](_0x8b51b4)[_0x92a2('0x13')](handleEntityNotFound(_0x37575f,null))[_0x92a2('0x13')](function(_0x984ff8){if(_0x984ff8){if(!_['isNil'](_0x984ff8[_0x92a2('0x61')])){if(fs[_0x92a2('0x64')](path[_0x92a2('0x65')](config[_0x92a2('0x66')],_0x92a2('0x6d'),_0x984ff8[_0x92a2('0x61')]))&&_0x984ff8['showCustomerAvatar']){_0x214c65=path[_0x92a2('0x65')](config[_0x92a2('0x66')],_0x92a2('0x6d'),_0x984ff8[_0x92a2('0x61')]);}}return _0x37575f[_0x92a2('0x68')](_0x214c65);}})['catch'](handleError(_0x37575f,null));};exports['getSystemAvatar']=function(_0x435124,_0x2d8a75,_0x26d41e){var _0x1c9478=path['join'](config[_0x92a2('0x66')],'server/files/images/avatars/system_avatar.png');var _0x31ec39={'where':{'id':_0x435124[_0x92a2('0x4b')]['id']},'attributes':['id',_0x92a2('0x6e')],'raw':!![]};return db[_0x92a2('0x2e')][_0x92a2('0x49')](_0x31ec39)[_0x92a2('0x13')](handleEntityNotFound(_0x2d8a75,null))[_0x92a2('0x13')](function(_0x4a9f99){if(_0x4a9f99){if(!_[_0x92a2('0x6b')](_0x4a9f99[_0x92a2('0x6e')])){if(fs[_0x92a2('0x64')](path[_0x92a2('0x65')](config[_0x92a2('0x66')],_0x92a2('0x6d'),_0x4a9f99[_0x92a2('0x6e')]))){_0x1c9478=path['join'](config[_0x92a2('0x66')],_0x92a2('0x6d'),_0x4a9f99[_0x92a2('0x6e')]);}}return _0x2d8a75[_0x92a2('0x68')](_0x1c9478);}})[_0x92a2('0x1d')](handleError(_0x2d8a75,null));};exports[_0x92a2('0x6f')]=function(_0x14ea13,_0x55d59e,_0x3d1c78){var _0x336a3b=require(_0x92a2('0x70'));var _0x40a40b=new _0x336a3b();var _0x22d259=_0x40a40b[_0x92a2('0x71')](_0x14ea13['headers'][_0x92a2('0x72')])[_0x92a2('0x73')]();var _0x30475f={'body':_0x14ea13[_0x92a2('0x4c')],'channel':_0x92a2('0x74')};var _0x22105c=[];var _0x4ab65c=[];var _0x3fca39={};var _0x593dbf=![];return db[_0x92a2('0x75')][_0x92a2('0x4d')]()[_0x92a2('0x13')](function(_0x836f5d){if(!_0x836f5d){throw new db['Sequelize'][(_0x92a2('0x76'))](_0x92a2('0x77'));}_0x22105c=_[_0x92a2('0x78')](_['keys'](_0x836f5d),[_0x92a2('0x79'),_0x92a2('0x7a')]);_0x4ab65c=_[_0x92a2('0x78')](_[_0x92a2('0x31')](_0x836f5d),[_0x92a2('0x79'),'updatedAt','CompanyId',_0x92a2('0x7b')]);if(_0x14ea13[_0x92a2('0x4c')]['id']){delete _0x14ea13[_0x92a2('0x4c')]['id'];}if(_['isNil'](_0x14ea13['body'][_0x92a2('0x7c')])){throw new db[(_0x92a2('0x7d'))]['ValidationError'](_0x92a2('0x7e'));}if(_[_0x92a2('0x6b')](_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x4c')])||_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x4c')]===''){throw new db[(_0x92a2('0x7d'))][(_0x92a2('0x76'))](_0x92a2('0x7f'));}if(_['isNil'](_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x80')])){throw new db[(_0x92a2('0x7d'))][(_0x92a2('0x76'))](_0x92a2('0x81')+_0x4ab65c);}if(!_['includes'](_0x4ab65c,_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x80')])){throw new db['Sequelize']['ValidationError'](_0x92a2('0x82')+_0x4ab65c);}_0x3fca39[_0x14ea13['body'][_0x92a2('0x80')]]=_0x14ea13['body']['from'];})[_0x92a2('0x13')](function(){return db[_0x92a2('0x2e')]['find']({'where':{'id':_0x14ea13['params']['id']},'include':[{'model':db['CmList'],'as':_0x92a2('0x83'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3fca39,'limit':0x1,'order':[[_0x92a2('0x7a'),_0x92a2('0x84')]]}]},{'model':db[_0x92a2('0x85')],'as':_0x92a2('0x86')}]});})[_0x92a2('0x13')](handleEntityNotFound(_0x55d59e,null))[_0x92a2('0x13')](function(_0x3faad7){if(_0x3faad7&&_0x3faad7[_0x92a2('0x83')]){_0x30475f[_0x92a2('0x87')]=_0x3faad7;_0x30475f['applications']=_0x3faad7[_0x92a2('0x86')];_0x30475f['list']=_0x3faad7[_0x92a2('0x83')];_0x30475f[_0x92a2('0x88')]=_['orderBy'](_0x30475f[_0x92a2('0x88')],[_0x92a2('0x89')],[_0x92a2('0x8a')]);if(_0x30475f[_0x92a2('0x87')][_0x92a2('0x86')]){delete _0x30475f['account'][_0x92a2('0x86')];}if(_0x30475f[_0x92a2('0x87')][_0x92a2('0x83')]&&_0x30475f['account'][_0x92a2('0x83')][_0x92a2('0x8b')][_0x92a2('0x39')]){return _0x30475f[_0x92a2('0x87')][_0x92a2('0x83')]['Contacts'][0x0];}var _0x373fd7=_[_0x92a2('0x8c')](_0x14ea13[_0x92a2('0x4c')],{'firstName':_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x7c')],'ListId':_0x3faad7[_0x92a2('0x7b')]});_0x373fd7[_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x80')]]=_0x14ea13['body']['from'];return db[_0x92a2('0x75')][_0x92a2('0x4a')](_0x373fd7,{'fields':_0x22105c,'raw':!![]});}})['then'](handleEntityNotFound(_0x55d59e,null))['then'](function(_0x5a6d3b){_0x30475f[_0x92a2('0x8d')]=_0x5a6d3b;if(_0x5a6d3b){var _0x2bc978={'ContactId':_0x5a6d3b['id'],'ChatWebsiteId':_0x14ea13[_0x92a2('0x4b')]['id'],'from':(_0x5a6d3b[_0x92a2('0x8e')]||'')+'\x20'+(_0x5a6d3b[_0x92a2('0x8f')]||''),'customerIp':_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x90')],'referer':_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x91')],'browserName':_0x22d259[_0x92a2('0x92')]['name']&&_0x22d259['browser'][_0x92a2('0x93')]?util[_0x92a2('0x94')]('%s\x20%s',_0x22d259[_0x92a2('0x92')]['name'],_0x22d259[_0x92a2('0x92')][_0x92a2('0x93')]):_0x92a2('0x95'),'browserVersion':_0x22d259[_0x92a2('0x92')][_0x92a2('0x93')]||_0x92a2('0x95'),'osName':util[_0x92a2('0x94')](_0x92a2('0x96'),_0x22d259['os'][_0x92a2('0x2b')],_0x22d259['os'][_0x92a2('0x93')]),'osVersion':_0x22d259['os'][_0x92a2('0x93')],'deviceModel':_0x22d259[_0x92a2('0x97')][_0x92a2('0x30')]&&_0x22d259[_0x92a2('0x97')][_0x92a2('0x98')]?util[_0x92a2('0x94')](_0x92a2('0x99'),_0x22d259['device'][_0x92a2('0x30')],_0x22d259['device'][_0x92a2('0x98')],_0x22d259[_0x92a2('0x97')]['type']):null,'deviceVendor':_0x22d259[_0x92a2('0x97')][_0x92a2('0x98')],'deviceType':_0x22d259[_0x92a2('0x97')][_0x92a2('0x9a')],'formData':JSON[_0x92a2('0x18')](_0x14ea13[_0x92a2('0x4c')])};var _0x4176d3={'ChatWebsiteId':_0x14ea13[_0x92a2('0x4b')]['id'],'closed':![]};if(_0x14ea13['body'][_0x92a2('0x9b')]){_0x4176d3['threadId']=_0x14ea13['body'][_0x92a2('0x9b')];return db[_0x92a2('0x9c')][_0x92a2('0x49')]({'where':_0x4176d3})[_0x92a2('0x13')](function(_0x1d9388){if(_0x1d9388){return[_0x1d9388,![]];}_0x2bc978[_0x92a2('0x9b')]=_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x9b')];_0x2bc978[_0x92a2('0x9d')]=_0x14ea13[_0x92a2('0x4c')]['externalUrl'];return db[_0x92a2('0x9c')][_0x92a2('0x4a')](_0x2bc978)['then'](function(_0x5f253e){return[_0x5f253e,!![]];});});}_0x4176d3['ContactId']=_0x5a6d3b['id'];if(_0x14ea13[_0x92a2('0x4c')]['interaction']&&_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x9e')]['id']){_0x4176d3['id']=_0x14ea13['body'][_0x92a2('0x9e')]['id'];return db[_0x92a2('0x9c')][_0x92a2('0x49')]({'where':_0x4176d3})[_0x92a2('0x13')](function(_0x2ae8d3){if(_0x2ae8d3){return[_0x2ae8d3,![]];}return db['ChatInteraction'][_0x92a2('0x4a')](_0x2bc978)[_0x92a2('0x13')](function(_0x33bbaf){return[_0x33bbaf,!![]];});});}return db[_0x92a2('0x9c')][_0x92a2('0x4a')](_0x2bc978)[_0x92a2('0x13')](function(_0x2c5198){return[_0x2c5198,!![]];});}})[_0x92a2('0x9f')](function(_0x7d58f2,_0x3e1050){if(_0x7d58f2){_0x593dbf=_0x3e1050;if(!_0x3e1050){return _0x7d58f2[_0x92a2('0x29')]({'from':(_0x30475f['contact']['firstName']||'')+'\x20'+(_0x30475f[_0x92a2('0x8d')][_0x92a2('0x8f')]||'')});}else{return _0x7d58f2;}}})[_0x92a2('0x13')](function(_0x16ccf6){_0x30475f[_0x92a2('0x9e')]=_0x16ccf6['get']({'plain':!![]});_0x30475f[_0x92a2('0x9e')][_0x92a2('0xa0')]=_0x593dbf;if(_0x30475f[_0x92a2('0x9e')][_0x92a2('0xa0')]){if(_0x30475f[_0x92a2('0x87')][_0x92a2('0xa1')]){_0x30475f[_0x92a2('0x88')][_0x92a2('0xa2')]({'id':0x0,'priority':_0x30475f['applications'][_0x92a2('0x39')]+0x1,'app':_0x92a2('0xa3'),'appdata':'unmanaged','interval':_0x92a2('0xa4')});}}return db[_0x92a2('0xa5')][_0x92a2('0x4a')]({'body':_0x14ea13[_0x92a2('0x4c')][_0x92a2('0x4c')],'ChatWebsiteId':_0x14ea13[_0x92a2('0x4b')]['id'],'ChatInteractionId':_0x16ccf6['id'],'direction':'in','ContactId':_0x30475f[_0x92a2('0x8d')]['id'],'AttachmentId':_0x14ea13[_0x92a2('0x4c')][_0x92a2('0xa6')]});})['then'](function(_0x1c9bd5){_0x30475f[_0x92a2('0x1a')]=_0x1c9bd5;if(_0x30475f[_0x92a2('0x9e')][_0x92a2('0xa7')]){return db['User'][_0x92a2('0x49')]({'attributes':['id','name'],'where':{'id':_0x30475f[_0x92a2('0x9e')][_0x92a2('0xa7')]}})[_0x92a2('0x13')](function(_0x280385){if(_0x280385){_0x30475f[_0x92a2('0x88')][_0x92a2('0xa8')]({'id':0x0,'priority':0x0,'app':_0x92a2('0xa9'),'appdata':_0x280385[_0x92a2('0x2b')]+','+(_0x30475f['account'][_0x92a2('0xaa')]||0xa),'interval':_0x92a2('0xa4')});_0x30475f['forcedOwnership']=!![];}return respondWithRpcPromise(_0x92a2('0xab'),_0x92a2('0xac'),_0x30475f);});}return respondWithRpcPromise(_0x92a2('0xab'),'startRouting',_0x30475f);})[_0x92a2('0x13')](function(_0x2a2c58){respondWithRpcPromise(_0x92a2('0xad'),_0x92a2('0xad'),{'event':_0x92a2('0x6f'),'message':_0x2a2c58},client9002);return _0x2a2c58;})['then'](respondWithResult(_0x55d59e,null))[_0x92a2('0x1d')](handleError(_0x55d59e,null));};exports[_0x92a2('0xae')]=function(_0x3a2272,_0x5911d5,_0x2e1274){var _0xa5d66b,_0x59c23d,_0x3411d5;var _0x486659=[];var _0x3d148d=[];var _0xc53142={};return db[_0x92a2('0x75')][_0x92a2('0x4d')]()[_0x92a2('0x13')](function(_0x3a4a53){if(!_0x3a4a53){throw new db['Sequelize'][(_0x92a2('0x76'))](_0x92a2('0x77'));}_0x3d148d=_[_0x92a2('0x78')](_[_0x92a2('0x31')](_0x3a4a53),[_0x92a2('0x79'),_0x92a2('0x7a')]);_0x486659=_['difference'](_[_0x92a2('0x31')](_0x3a4a53),[_0x92a2('0x79'),'updatedAt',_0x92a2('0xaf'),_0x92a2('0x7b')]);if(_0x3a2272[_0x92a2('0x4c')]['id']){delete _0x3a2272[_0x92a2('0x4c')]['id'];}if(_[_0x92a2('0x6b')](_0x3a2272[_0x92a2('0x4c')]['from'])){throw _0x5911d5[_0x92a2('0x1e')](0x1f4)['send'](new db[(_0x92a2('0x7d'))][(_0x92a2('0x76'))](_0x92a2('0x7e')));}if(_[_0x92a2('0x6b')](_0x3a2272['body'][_0x92a2('0x4c')])||_0x3a2272[_0x92a2('0x4c')]['body']===''){throw _0x5911d5['status'](0x1f4)[_0x92a2('0x2c')](new db[(_0x92a2('0x7d'))][(_0x92a2('0x76'))](_0x92a2('0x7f')));}if(_['isNil'](_0x3a2272[_0x92a2('0x4c')][_0x92a2('0xb0')])){throw _0x5911d5['status'](0x1f4)['send'](new db[(_0x92a2('0x7d'))][(_0x92a2('0x76'))](_0x92a2('0xb1')+_0x486659));}if(!_[_0x92a2('0xb2')](_0x486659,_0x3a2272['body'][_0x92a2('0xb0')])){throw _0x5911d5[_0x92a2('0x1e')](0x1f4)[_0x92a2('0x2c')](new db['Sequelize']['ValidationError'](_0x92a2('0xb3')+_0x486659));}_0xc53142[_0x3a2272['body']['mapKeyOffline']]=_0x3a2272[_0x92a2('0x4c')]['from'];})[_0x92a2('0x13')](function(){return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x3a2272[_0x92a2('0x4b')]['id']},'include':[{'model':db[_0x92a2('0xb4')],'as':_0x92a2('0x83')}]});})['then'](handleEntityNotFound(_0x5911d5,null))['then'](function(_0x5f4aa7){if(_0x5f4aa7&&_0x5f4aa7[_0x92a2('0x83')]){_0x59c23d=_0x5f4aa7;var _0x2fa83f=_['defaults'](_0x3a2272[_0x92a2('0x4c')],{'firstName':_0x3a2272[_0x92a2('0x4c')][_0x92a2('0x7c')],'phone':_0x3a2272[_0x92a2('0x4c')]['from'],'ListId':_0x5f4aa7[_0x92a2('0x7b')]});_0x2fa83f[_0x3a2272['body'][_0x92a2('0xb0')]]=_0x3a2272[_0x92a2('0x4c')]['from'];return db['CmContact'][_0x92a2('0xb5')]({'where':_0xc53142,'defaults':_0x2fa83f});}})['spread'](function(_0x1c6a97){if(_0x1c6a97){_0x3411d5=_0x1c6a97;var _0xacb633=fs[_0x92a2('0xb6')](path[_0x92a2('0x65')](config[_0x92a2('0x66')],_0x92a2('0xb7')),_0x92a2('0xb8'));var _0x317b78=ejs[_0x92a2('0xb9')](_0xacb633,{'body':_[_0x92a2('0xba')](_0x3a2272['body'][_0x92a2('0x4c')]),'bodyTitle':_0x59c23d['offlineMessageBody']});return db[_0x92a2('0xbb')][_0x92a2('0x4a')]({'body':_0x317b78,'ContactId':_0x1c6a97['id'],'ChatWebsiteId':_0x59c23d['id']});}})[_0x92a2('0x13')](function(_0x182b9d){if(_0x182b9d){_0xa5d66b=_0x182b9d;return db['MailAccount'][_0x92a2('0x52')]({'where':{'service':!![]},'include':[{'model':db[_0x92a2('0xbc')],'as':_0x92a2('0xbd'),'raw':!![]}]});}})['then'](function(_0x45d10e){if(_0x45d10e&&_0x45d10e['Smtp']&&_0x59c23d['forwardOfflineAddress']){var _0x2eee94={'tls':{'rejectUnauthorized':![]}};if(_0x45d10e[_0x92a2('0xbd')][_0x92a2('0xbe')]){_0x2eee94[_0x92a2('0xbe')]=_0x45d10e[_0x92a2('0xbd')]['service'];}else{_0x2eee94[_0x92a2('0xbf')]=_0x45d10e[_0x92a2('0xbd')][_0x92a2('0xbf')];_0x2eee94['port']=_0x45d10e[_0x92a2('0xbd')][_0x92a2('0xc0')];_0x2eee94[_0x92a2('0xc1')]=_0x45d10e[_0x92a2('0xbd')][_0x92a2('0xc1')];}if(_0x45d10e[_0x92a2('0xbd')]['authentication']){_0x2eee94[_0x92a2('0xc2')]={'user':_0x45d10e[_0x92a2('0xbd')]['user'],'pass':_0x45d10e[_0x92a2('0xbd')][_0x92a2('0xc3')]};}return respondWithRpcPromise(_0x92a2('0xc4'),_0x92a2('0xc5'),{'account':_0x2eee94,'message':{'from':util[_0x92a2('0x94')](_0x92a2('0xc6'),_0x45d10e[_0x92a2('0x2b')],_0x45d10e['email']||_0x45d10e['Smtp'][_0x92a2('0xc7')]),'to':_0x59c23d[_0x92a2('0xc8')],'subject':_0x59c23d[_0x92a2('0xc9')],'text':_0xa5d66b[_0x92a2('0x4c')]}},client9003)[_0x92a2('0x13')](function(){return _0xa5d66b;})[_0x92a2('0x1d')](function(_0x22e247){console['error'](_0x22e247);});}})[_0x92a2('0x13')](function(){if(_0xa5d66b){return _0xa5d66b;}})[_0x92a2('0x13')](respondWithResult(_0x5911d5,null))['catch'](handleError(_0x5911d5,null));};exports[_0x92a2('0xca')]=function(_0x464be6,_0x691208,_0x9a99aa){return db[_0x92a2('0x9c')][_0x92a2('0x49')]({'where':{'id':_0x464be6[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x691208,null))[_0x92a2('0x13')](function(_0x3eaf60){if(_0x3eaf60){return _0x3eaf60[_0x92a2('0xca')](_0x464be6[_0x92a2('0x4c')][_0x92a2('0x59')],_['omit'](_0x464be6['body'],[_0x92a2('0x59'),'id'])||{});}})[_0x92a2('0x13')](respondWithResult(_0x691208,null))['catch'](handleError(_0x691208,null));};exports[_0x92a2('0xcb')]=function(_0x520d25,_0x354c19,_0x4a20ea){var _0x4986a7={'raw':![],'where':{}};var _0x1c2d51={};var _0x54577b={'count':0x0,'rows':[]};return db[_0x92a2('0x2e')][_0x92a2('0x52')]({'where':{'id':_0x520d25['params']['id']}})['then'](handleEntityNotFound(_0x354c19,null))[_0x92a2('0x13')](function(_0x193c07){if(_0x193c07){_0x1c2d51[_0x92a2('0x30')]=_[_0x92a2('0x31')](db[_0x92a2('0x9c')][_0x92a2('0x2f')]);_0x1c2d51['query']=_[_0x92a2('0x31')](_0x520d25[_0x92a2('0x33')]);_0x1c2d51[_0x92a2('0x35')]=_[_0x92a2('0x36')](_0x1c2d51[_0x92a2('0x30')],_0x1c2d51[_0x92a2('0x33')]);_0x4986a7['attributes']=_[_0x92a2('0x36')](_0x1c2d51[_0x92a2('0x30')],qs[_0x92a2('0x38')](_0x520d25[_0x92a2('0x33')][_0x92a2('0x38')]));_0x4986a7[_0x92a2('0x37')]=_0x4986a7[_0x92a2('0x37')][_0x92a2('0x39')]?_0x4986a7[_0x92a2('0x37')]:_0x1c2d51['model'];if(!_0x520d25['query']['hasOwnProperty']('nolimit')){_0x4986a7[_0x92a2('0x23')]=qs['limit'](_0x520d25[_0x92a2('0x33')][_0x92a2('0x23')]);_0x4986a7['offset']=qs[_0x92a2('0x22')](_0x520d25[_0x92a2('0x33')][_0x92a2('0x22')]);}_0x4986a7[_0x92a2('0x3b')]=qs[_0x92a2('0x3c')](_0x520d25[_0x92a2('0x33')]['sort']);_0x4986a7['where']=qs[_0x92a2('0x35')](_[_0x92a2('0x3e')](_0x520d25['query'],_0x1c2d51[_0x92a2('0x35')]));_0x4986a7[_0x92a2('0x3d')][_0x92a2('0x4f')]=_0x193c07['id'];if(_0x520d25['query'][_0x92a2('0x42')]){_0x4986a7[_0x92a2('0x3d')]=_['merge'](_0x4986a7[_0x92a2('0x3d')],{'$or':_[_0x92a2('0x43')](_0x4986a7[_0x92a2('0x37')],function(_0x35a334){var _0x2bc0c0={};_0x2bc0c0[_0x35a334]={'$like':'%'+_0x520d25[_0x92a2('0x33')][_0x92a2('0x42')]+'%'};return _0x2bc0c0;})});}_0x4986a7=_['merge']({},_0x4986a7,_0x520d25[_0x92a2('0x44')]);return db[_0x92a2('0x9c')][_0x92a2('0x21')]({'where':_0x4986a7[_0x92a2('0x3d')]})['then'](function(_0x211530){_0x54577b['count']=_0x211530;if(_0x520d25[_0x92a2('0x33')][_0x92a2('0x47')]){_0x4986a7[_0x92a2('0x48')]=[{'model':db[_0x92a2('0x75')],'as':_0x92a2('0xcc'),'required':![]},{'model':db[_0x92a2('0xcd')],'as':_0x92a2('0xce'),'attributes':[_0x92a2('0x2b'),_0x92a2('0xcf'),_0x92a2('0xd0')],'required':![]},{'model':db[_0x92a2('0xd1')],'as':'Tags','attributes':['id',_0x92a2('0x2b'),_0x92a2('0xd2')],'where':_0x520d25['query'][_0x92a2('0xd3')]?{'id':_0x520d25[_0x92a2('0x33')][_0x92a2('0xd3')]}:undefined,'required':_0x520d25[_0x92a2('0x33')][_0x92a2('0xd3')]?!![]:![]}];}return db[_0x92a2('0x9c')]['findAll'](_0x4986a7);})[_0x92a2('0x13')](function(_0x1a7308){_0x54577b[_0x92a2('0x57')]=_0x1a7308;return _0x54577b;});}})[_0x92a2('0x13')](respondWithFilteredResult(_0x354c19,_0x4986a7))[_0x92a2('0x1d')](handleError(_0x354c19,null));};function iftimePromise(_0x53b429,_0x839009){return respondWithRpcPromise('Command','getSnippet',{'command':_0x839009[_0x92a2('0xd4')]?util['format'](_0x92a2('0xd5'),_0x53b429['interval'],_0x839009[_0x92a2('0xd4')]):util[_0x92a2('0x94')](_0x92a2('0xd6'),_0x53b429['interval'])},client9002)[_0x92a2('0x13')](function(_0x334bd1){var _0x5d5e5f=_0x334bd1&&_0x334bd1['indexOf']('true')>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x839009['id'],_0x53b429['id'],_0x53b429[_0x92a2('0xd7')],_0x5d5e5f?'ONLINE':_0x92a2('0xd8'),_0x839009[_0x92a2('0xd4')]?_0x839009[_0x92a2('0xd4')]:_0x92a2('0xd9'));return _0x5d5e5f;})[_0x92a2('0x1d')](function(_0x3fbe63){logger['error'](_0x92a2('0xda'),_0x839009['id'],_0x53b429['id'],_0x53b429[_0x92a2('0xd7')],util[_0x92a2('0xdb')](_0x3fbe63,{'showHidden':![],'depth':null}),_0x839009[_0x92a2('0xd4')]?_0x839009[_0x92a2('0xd4')]:'No\x20timezone');return![];});}exports[_0x92a2('0xdc')]=function(_0x3e2b30,_0xfe4f8b,_0x4bdf5e){var _0x5d0d2b=0x0;var _0x4cfbbb=0x0;var _0x383102=![];var _0x2f4bfd;var _0x48163b;return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x3e2b30[_0x92a2('0x4b')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x92a2('0xdd')],'as':_0x92a2('0xde'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x92a2('0x13')](handleEntityNotFound(_0xfe4f8b,null))['then'](function(_0x53d674){if(_0x53d674){_0x2f4bfd=_0x53d674;return _0x53d674[_0x92a2('0xdf')]({'raw':!![]});}})[_0x92a2('0x13')](function(_0x15a5ee){if(_0x2f4bfd){if(_0x15a5ee){_0x48163b=_0x15a5ee;}}return require(_0x92a2('0xe0'))[_0x92a2('0xe1')]();})['then'](function(_0x1c36d2){if(_0x1c36d2){_0x4cfbbb=_0x1c36d2['virtual'];_0x383102=_0x1c36d2['custom'];}})[_0x92a2('0x13')](function(){return db[_0x92a2('0x9c')]['count']({'where':{'closed':![]}});})[_0x92a2('0x13')](function(_0x3c700d){_0x5d0d2b=_0x3c700d;if(_0x4cfbbb&&_0x3c700d>_0x4cfbbb){return db[_0x92a2('0xe2')][_0x92a2('0x52')]({'where':{'id':0x1}})[_0x92a2('0x13')](function(_0x521a0a){if(_0x521a0a){_0x521a0a[_0x92a2('0xe3')](_0x92a2('0xe4'));}});}})[_0x92a2('0x13')](function(){if(_0x2f4bfd[_0x92a2('0xdd')]&&_0x2f4bfd[_0x92a2('0xdd')][_0x92a2('0xde')]){var _0x51ea34=[];for(var _0x391ceb=0x0;_0x391ceb<_0x2f4bfd[_0x92a2('0xdd')]['Intervals']['length'];_0x391ceb++){var _0x21d873=_0x2f4bfd[_0x92a2('0xdd')][_0x92a2('0xde')][_0x391ceb]['get']({'plain':!![]});_0x51ea34['push'](iftimePromise(_0x21d873,_0x2f4bfd));}return BPromise[_0x92a2('0xe5')](_0x51ea34)[_0x92a2('0x13')](function(_0x435438){return _['some'](_0x435438);});}else{return!![];}})[_0x92a2('0x13')](function(_0x262765){var _0x4b84f5=fs['readFileSync'](path[_0x92a2('0x65')](config[_0x92a2('0x66')],'server/files/chat/iframe.js'),'utf8');var _0x4b524b={'remote':_0x2f4bfd[_0x92a2('0xe6')],'query':querystring[_0x92a2('0x18')](_[_0x92a2('0x41')](_0x2f4bfd['get']({'plain':!![]}),{'customerIp':_0x3e2b30[_0x92a2('0xe7')]['x-forwarded-for']||_0x3e2b30['headers'][_0x92a2('0xe8')]||_0x3e2b30[_0x92a2('0xe9')][_0x92a2('0xea')]||_0x3e2b30['ip'],'referer':_0x3e2b30['headers']['referer'],'openedInteractions':_0x5d0d2b,'maxInteractions':_0x4cfbbb,'virtual':_0x383102[_0x92a2('0xeb')],'online':_0x262765,'custom':_0x383102}))[_0x92a2('0xec')](/'/g,'\x5c\x27')};_0xfe4f8b[_0x92a2('0x2c')](ejs[_0x92a2('0xb9')](Mustache[_0x92a2('0xb9')](_0x4b84f5,_0x4b524b),{'proactiveActions':_0x48163b,'alignment':_0x2f4bfd[_0x92a2('0xed')],'verticalAlignment':_0x2f4bfd[_0x92a2('0xee')]}));})['catch'](handleError(_0xfe4f8b,null));};exports[_0x92a2('0xef')]=function(_0x3987c7,_0xe026e7,_0x58890){return db[_0x92a2('0x2e')][_0x92a2('0x52')]({'where':{'id':_0x3987c7[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0xe026e7,null))['then'](function(_0x489fff){if(_0x489fff){return db['sequelize'][_0x92a2('0xf0')](function(_0x20f12f){return db['ChatApplication'][_0x92a2('0x2a')]({'where':{'ChatWebsiteId':_0x3987c7['params']['id']},'transaction':_0x20f12f})[_0x92a2('0x13')](function(_0x17fa2d){var _0x315a57=_[_0x92a2('0x43')](_0x3987c7[_0x92a2('0x4c')],function(_0x395870){_0x395870[_0x92a2('0x4f')]=_0x3987c7[_0x92a2('0x4b')]['id'];return _0x395870;});return db[_0x92a2('0x85')][_0x92a2('0xf1')](_0x315a57,{'transaction':_0x20f12f});});})[_0x92a2('0x13')](function(){return db['ChatApplication'][_0x92a2('0xf2')]({'where':{'ChatWebsiteId':_0x3987c7[_0x92a2('0x4b')]['id']},'order':_0x92a2('0x89')});});}})[_0x92a2('0x13')](respondWithResult(_0xe026e7,null))[_0x92a2('0x1d')](handleError(_0xe026e7,null));};exports['getApplications']=function(_0x5234be,_0x392c18,_0x26a506){var _0x4e0949={};var _0x12382b={};var _0xa8f818;var _0x385d9a;return db[_0x92a2('0x2e')][_0x92a2('0x52')]({'where':{'id':_0x5234be[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x392c18,null))[_0x92a2('0x13')](function(_0x3d2004){if(_0x3d2004){_0xa8f818=_0x3d2004;_0x12382b[_0x92a2('0x30')]=_[_0x92a2('0x31')](db[_0x92a2('0x85')][_0x92a2('0x2f')]);_0x12382b[_0x92a2('0x33')]=_[_0x92a2('0x31')](_0x5234be[_0x92a2('0x33')]);_0x12382b[_0x92a2('0x35')]=_[_0x92a2('0x36')](_0x12382b[_0x92a2('0x30')],_0x12382b[_0x92a2('0x33')]);_0x4e0949[_0x92a2('0x37')]=_['intersection'](_0x12382b[_0x92a2('0x30')],qs[_0x92a2('0x38')](_0x5234be[_0x92a2('0x33')][_0x92a2('0x38')]));_0x4e0949[_0x92a2('0x37')]=_0x4e0949[_0x92a2('0x37')][_0x92a2('0x39')]?_0x4e0949[_0x92a2('0x37')]:_0x12382b[_0x92a2('0x30')];_0x4e0949['order']=qs['sort'](_0x5234be[_0x92a2('0x33')][_0x92a2('0x3c')]);_0x4e0949['where']=qs[_0x92a2('0x35')](_['pick'](_0x5234be['query'],_0x12382b['filters']));if(_0x5234be['query'][_0x92a2('0x42')]){_0x4e0949[_0x92a2('0x3d')]=_[_0x92a2('0x41')](_0x4e0949['where'],{'$or':_['map'](_0x4e0949[_0x92a2('0x37')],function(_0x503c86){var _0x34f730={};_0x34f730[_0x503c86]={'$like':'%'+_0x5234be[_0x92a2('0x33')][_0x92a2('0x42')]+'%'};return _0x34f730;})});}_0x4e0949=_['merge']({},_0x4e0949,_0x5234be[_0x92a2('0x44')]);return _0xa8f818['getApplications'](_0x4e0949);}})[_0x92a2('0x13')](function(_0x3c1517){if(_0x3c1517){_0x385d9a=_0x3c1517[_0x92a2('0x39')];if(!_0x5234be[_0x92a2('0x33')][_0x92a2('0x53')](_0x92a2('0x3a'))){_0x4e0949[_0x92a2('0x23')]=qs[_0x92a2('0x23')](_0x5234be['query'][_0x92a2('0x23')]);_0x4e0949[_0x92a2('0x22')]=qs[_0x92a2('0x22')](_0x5234be[_0x92a2('0x33')][_0x92a2('0x22')]);}return _0xa8f818[_0x92a2('0xf3')](_0x4e0949);}})[_0x92a2('0x13')](function(_0xbe3cf7){if(_0xbe3cf7){return _0xbe3cf7?{'count':_0x385d9a,'rows':_0xbe3cf7}:null;}})[_0x92a2('0x13')](respondWithResult(_0x392c18,null))['catch'](handleError(_0x392c18,null));};exports[_0x92a2('0xf4')]=function(_0x40c648,_0x4e9da0,_0x92e531){return db[_0x92a2('0xf5')][_0x92a2('0x49')]({'where':{'id':_0x40c648['params']['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x4e9da0,null))[_0x92a2('0x13')](function(_0x5b9212){if(_0x5b9212){return _0x5b9212['addProactiveActions'](_0x40c648[_0x92a2('0x4c')][_0x92a2('0x59')],_[_0x92a2('0xf6')](_0x40c648[_0x92a2('0x4c')],[_0x92a2('0x59'),'id'])||{});}})[_0x92a2('0x13')](respondWithResult(_0x4e9da0,null))['catch'](handleError(_0x4e9da0,null));};exports['getProactiveActions']=function(_0x4fec0e,_0x785aaf,_0x4a2f0e){var _0x261b45={};var _0x19b911={};var _0x50b096;var _0x5a4d5f;return db[_0x92a2('0x2e')][_0x92a2('0x52')]({'where':{'id':_0x4fec0e[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x785aaf,null))['then'](function(_0x5e5f86){if(_0x5e5f86){_0x50b096=_0x5e5f86;_0x19b911[_0x92a2('0x30')]=_[_0x92a2('0x31')](db[_0x92a2('0xf7')][_0x92a2('0x2f')]);_0x19b911['query']=_[_0x92a2('0x31')](_0x4fec0e[_0x92a2('0x33')]);_0x19b911['filters']=_['intersection'](_0x19b911[_0x92a2('0x30')],_0x19b911['query']);_0x261b45[_0x92a2('0x37')]=_['intersection'](_0x19b911['model'],qs[_0x92a2('0x38')](_0x4fec0e[_0x92a2('0x33')][_0x92a2('0x38')]));_0x261b45[_0x92a2('0x37')]=_0x261b45[_0x92a2('0x37')]['length']?_0x261b45[_0x92a2('0x37')]:_0x19b911[_0x92a2('0x30')];_0x261b45[_0x92a2('0x3b')]=qs[_0x92a2('0x3c')](_0x4fec0e[_0x92a2('0x33')][_0x92a2('0x3c')]);_0x261b45[_0x92a2('0x3d')]=qs[_0x92a2('0x35')](_[_0x92a2('0x3e')](_0x4fec0e[_0x92a2('0x33')],_0x19b911[_0x92a2('0x35')]));if(_0x4fec0e[_0x92a2('0x33')][_0x92a2('0x42')]){_0x261b45[_0x92a2('0x3d')]=_[_0x92a2('0x41')](_0x261b45['where'],{'$or':_['map'](_0x261b45[_0x92a2('0x37')],function(_0x49e70f){var _0x255ae2={};_0x255ae2[_0x49e70f]={'$like':'%'+_0x4fec0e[_0x92a2('0x33')]['filter']+'%'};return _0x255ae2;})});}_0x261b45=_['merge']({},_0x261b45,_0x4fec0e[_0x92a2('0x44')]);return _0x50b096[_0x92a2('0xdf')](_0x261b45);}})[_0x92a2('0x13')](function(_0x405a3a){if(_0x405a3a){_0x5a4d5f=_0x405a3a['length'];if(!_0x4fec0e[_0x92a2('0x33')][_0x92a2('0x53')](_0x92a2('0x3a'))){_0x261b45[_0x92a2('0x23')]=qs[_0x92a2('0x23')](_0x4fec0e[_0x92a2('0x33')][_0x92a2('0x23')]);_0x261b45[_0x92a2('0x22')]=qs['offset'](_0x4fec0e[_0x92a2('0x33')][_0x92a2('0x22')]);}return _0x50b096[_0x92a2('0xdf')](_0x261b45);}})['then'](function(_0x3712f1){if(_0x3712f1){return _0x3712f1?{'count':_0x5a4d5f,'rows':_0x3712f1}:null;}})['then'](respondWithResult(_0x785aaf,null))[_0x92a2('0x1d')](handleError(_0x785aaf,null));};exports[_0x92a2('0xf8')]=function(_0x5df7fa,_0x4ee47d,_0x2d6f81){var _0x268dd0=_0x5df7fa[_0x92a2('0x33')][_0x92a2('0xf9')]===_0x92a2('0xfa')?'offlineForm':_0x92a2('0xfb');return db['ChatWebsite'][_0x92a2('0x49')]({'attributes':['id',_0x268dd0],'where':{'id':_0x5df7fa[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x4ee47d,null))[_0x92a2('0x13')](function(_0x12367a){if(_0x12367a){var _0x5570cc=_0x12367a[_0x268dd0];var _0x448023=_0x5570cc&&_0x5570cc[_0x92a2('0xfc')]?_0x5570cc['items']:[];_0x4ee47d[_0x92a2('0x2c')]({'fromKey':_[_0x92a2('0x6b')](_0x5570cc[_0x92a2('0xfd')])?undefined:_0x5570cc[_0x92a2('0xfd')],'count':_0x448023[_0x92a2('0x39')],'rows':_0x448023});}})[_0x92a2('0x1d')](handleError(_0x4ee47d,null));};exports[_0x92a2('0xfe')]=function(_0x2c99c4,_0x15e782,_0x5d90ba){var _0x2460d9={'raw':!![],'where':{}};var _0x4b3925={};var _0x332512={'count':0x0,'rows':[]};return db[_0x92a2('0x2e')][_0x92a2('0x52')]({'where':{'id':_0x2c99c4['params']['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x15e782,null))[_0x92a2('0x13')](function(_0x1efaac){if(_0x1efaac){_0x4b3925['model']=_['keys'](db[_0x92a2('0xbb')][_0x92a2('0x2f')]);_0x4b3925['query']=_[_0x92a2('0x31')](_0x2c99c4[_0x92a2('0x33')]);_0x4b3925[_0x92a2('0x35')]=_[_0x92a2('0x36')](_0x4b3925['model'],_0x4b3925[_0x92a2('0x33')]);_0x2460d9[_0x92a2('0x37')]=_['intersection'](_0x4b3925[_0x92a2('0x30')],qs[_0x92a2('0x38')](_0x2c99c4[_0x92a2('0x33')]['fields']));_0x2460d9[_0x92a2('0x37')]=_0x2460d9['attributes'][_0x92a2('0x39')]?_0x2460d9[_0x92a2('0x37')]:_0x4b3925['model'];if(!_0x2c99c4['query']['hasOwnProperty'](_0x92a2('0x3a'))){_0x2460d9[_0x92a2('0x23')]=qs[_0x92a2('0x23')](_0x2c99c4[_0x92a2('0x33')]['limit']);_0x2460d9[_0x92a2('0x22')]=qs[_0x92a2('0x22')](_0x2c99c4[_0x92a2('0x33')][_0x92a2('0x22')]);}_0x2460d9[_0x92a2('0x3b')]=qs[_0x92a2('0x3c')](_0x2c99c4[_0x92a2('0x33')][_0x92a2('0x3c')]);_0x2460d9['where']=qs['filters'](_[_0x92a2('0x3e')](_0x2c99c4['query'],_0x4b3925[_0x92a2('0x35')]));_0x2460d9[_0x92a2('0x3d')][_0x92a2('0x4f')]=_0x1efaac['id'];if(_0x2c99c4[_0x92a2('0x33')][_0x92a2('0x42')]){_0x2460d9[_0x92a2('0x3d')]=_[_0x92a2('0x41')](_0x2460d9[_0x92a2('0x3d')],{'$or':_[_0x92a2('0x43')](_0x2460d9[_0x92a2('0x37')],function(_0x625fd0){var _0x52d394={};_0x52d394[_0x625fd0]={'$like':'%'+_0x2c99c4[_0x92a2('0x33')]['filter']+'%'};return _0x52d394;})});}_0x2460d9=_['merge']({},_0x2460d9,_0x2c99c4[_0x92a2('0x44')]);return db[_0x92a2('0xbb')]['count']({'where':_0x2460d9[_0x92a2('0x3d')]})[_0x92a2('0x13')](function(_0x2da574){_0x332512[_0x92a2('0x21')]=_0x2da574;if(_0x2c99c4[_0x92a2('0x33')]['includeAll']){_0x2460d9[_0x92a2('0x48')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x2460d9);})[_0x92a2('0x13')](function(_0x1b4bcf){_0x332512[_0x92a2('0x57')]=_0x1b4bcf;return _0x332512;});}})['then'](respondWithFilteredResult(_0x15e782,_0x2460d9))[_0x92a2('0x1d')](handleError(_0x15e782,null));};exports['addAgents']=function(_0x2048ec,_0x50fc97,_0x5aa30f){return db['ChatWebsite'][_0x92a2('0x49')]({'where':{'id':_0x2048ec[_0x92a2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50fc97,null))['then'](function(_0x1944ca){if(_0x1944ca){return _0x1944ca['addAgents'](_0x2048ec[_0x92a2('0x4c')][_0x92a2('0x59')],_[_0x92a2('0xf6')](_0x2048ec['body'],[_0x92a2('0x59'),'id'])||{})[_0x92a2('0x9f')](function(_0x5b2f1b){for(var _0x546fd6=0x0;_0x546fd6<_0x2048ec[_0x92a2('0x4c')][_0x92a2('0x59')]['length'];_0x546fd6+=0x1){socket['emit'](_0x92a2('0xff'),{'UserId':_0x2048ec['body'][_0x92a2('0x59')][_0x546fd6],'ChatWebsiteId':_0x2048ec['params']['id']});}return _0x5b2f1b;});}})[_0x92a2('0x13')](respondWithResult(_0x50fc97,null))[_0x92a2('0x1d')](handleError(_0x50fc97,null));};exports[_0x92a2('0x100')]=function(_0x37976f,_0x3c5c12,_0x43765a){var _0x5e78e3;return db[_0x92a2('0x2e')][_0x92a2('0x49')]({'where':{'id':_0x37976f[_0x92a2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3c5c12,null))['then'](function(_0x554de6){if(_0x554de6){return _0x554de6[_0x92a2('0x100')](_0x37976f[_0x92a2('0x33')][_0x92a2('0x59')])[_0x92a2('0x13')](function(_0x31fc6a){if(_[_0x92a2('0x101')](_0x37976f[_0x92a2('0x33')]['ids'])){for(var _0x3e154b=0x0;_0x3e154b<_0x37976f[_0x92a2('0x33')][_0x92a2('0x59')][_0x92a2('0x39')];_0x3e154b+=0x1){socket[_0x92a2('0x102')]('userChatWebsite:remove',{'UserId':_0x37976f[_0x92a2('0x33')][_0x92a2('0x59')][_0x3e154b],'ChatWebsiteId':_0x37976f[_0x92a2('0x4b')]['id']});}}else{socket[_0x92a2('0x102')](_0x92a2('0x103'),{'UserId':_0x37976f['query'][_0x92a2('0x59')],'ChatWebsiteId':_0x37976f[_0x92a2('0x4b')]['id']});}});}})[_0x92a2('0x13')](respondWithStatusCode(_0x3c5c12,null))['catch'](handleError(_0x3c5c12,null));};exports['getAgents']=function(_0xd37303,_0x78714e,_0x7e6c61){var _0x20e28e={};var _0x47164f={};var _0x5f9b8f;var _0xb6ca18;return db[_0x92a2('0x2e')][_0x92a2('0x52')]({'where':{'id':_0xd37303[_0x92a2('0x4b')]['id']}})[_0x92a2('0x13')](handleEntityNotFound(_0x78714e,null))[_0x92a2('0x13')](function(_0x1d643c){if(_0x1d643c){_0x5f9b8f=_0x1d643c;_0x47164f['model']=_['keys'](db[_0x92a2('0xcd')][_0x92a2('0x2f')]);_0x47164f[_0x92a2('0x33')]=_[_0x92a2('0x31')](_0xd37303[_0x92a2('0x33')]);_0x47164f[_0x92a2('0x35')]=_[_0x92a2('0x36')](_0x47164f[_0x92a2('0x30')],_0x47164f[_0x92a2('0x33')]);_0x20e28e[_0x92a2('0x37')]=_['intersection'](_0x47164f['model'],qs[_0x92a2('0x38')](_0xd37303['query']['fields']));_0x20e28e[_0x92a2('0x37')]=_0x20e28e['attributes'][_0x92a2('0x39')]?_0x20e28e[_0x92a2('0x37')]:_0x47164f[_0x92a2('0x30')];_0x20e28e[_0x92a2('0x3b')]=qs['sort'](_0xd37303[_0x92a2('0x33')]['sort']);_0x20e28e[_0x92a2('0x3d')]=qs[_0x92a2('0x35')](_['pick'](_0xd37303[_0x92a2('0x33')],_0x47164f[_0x92a2('0x35')]));if(_0xd37303[_0x92a2('0x33')][_0x92a2('0x42')]){_0x20e28e[_0x92a2('0x3d')]=_[_0x92a2('0x41')](_0x20e28e[_0x92a2('0x3d')],{'$or':_[_0x92a2('0x43')](_0x20e28e['attributes'],function(_0x1c5449){var _0x58df72={};_0x58df72[_0x1c5449]={'$like':'%'+_0xd37303[_0x92a2('0x33')]['filter']+'%'};return _0x58df72;})});}_0x20e28e=_['merge']({},_0x20e28e,_0xd37303[_0x92a2('0x44')]);return _0x5f9b8f[_0x92a2('0x104')](_0x20e28e);}})[_0x92a2('0x13')](function(_0x2951d6){if(_0x2951d6){_0xb6ca18=_0x2951d6[_0x92a2('0x39')];if(!_0xd37303[_0x92a2('0x33')][_0x92a2('0x53')](_0x92a2('0x3a'))){_0x20e28e[_0x92a2('0x23')]=qs['limit'](_0xd37303[_0x92a2('0x33')]['limit']);_0x20e28e[_0x92a2('0x22')]=qs[_0x92a2('0x22')](_0xd37303[_0x92a2('0x33')]['offset']);}return _0x5f9b8f['getAgents'](_0x20e28e);}})[_0x92a2('0x13')](function(_0x9b5b61){if(_0x9b5b61){return _0x9b5b61?{'count':_0xb6ca18,'rows':_0x9b5b61}:null;}})[_0x92a2('0x13')](respondWithResult(_0x78714e,null))['catch'](handleError(_0x78714e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 93d61cc..2f40613 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 _0x1354=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x56a812,_0xf82f66){var _0x38f56a=function(_0x1462b7){while(--_0x1462b7){_0x56a812['push'](_0x56a812['shift']());}};_0x38f56a(++_0xf82f66);}(_0x1354,0x95));var _0x4135=function(_0x33fc57,_0xdd2591){_0x33fc57=_0x33fc57-0x0;var _0xf701ca=_0x1354[_0x33fc57];return _0xf701ca;};'use strict';var EventEmitter=require(_0x4135('0x0'));var ChatWebsite=require(_0x4135('0x1'))['db'][_0x4135('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4135('0x3')](0x0);var events={'afterCreate':_0x4135('0x4'),'afterUpdate':_0x4135('0x5'),'afterDestroy':_0x4135('0x6')};function emitEvent(_0x537b00){return function(_0x2c75a3,_0x4ed434,_0x202042){ChatWebsiteEvents['emit'](_0x537b00+':'+_0x2c75a3['id'],_0x2c75a3);ChatWebsiteEvents[_0x4135('0x7')](_0x537b00,_0x2c75a3);_0x202042(null);};}for(var e in events){if(events[_0x4135('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x4135('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x1501=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1501,0x126));var _0x1150=function(_0x158b49,_0x37457a){_0x158b49=_0x158b49-0x0;var _0xaff79=_0x1501[_0x158b49];return _0xaff79;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x1150('0x0'))['db'][_0x1150('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1150('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1150('0x3'),'afterDestroy':_0x1150('0x4')};function emitEvent(_0x2518d5){return function(_0x28eb65,_0x4d218f,_0x2525e7){ChatWebsiteEvents['emit'](_0x2518d5+':'+_0x28eb65['id'],_0x28eb65);ChatWebsiteEvents[_0x1150('0x5')](_0x2518d5,_0x28eb65);_0x2525e7(null);};}for(var e in events){if(events[_0x1150('0x6')](e)){var event=events[e];ChatWebsite[_0x1150('0x7')](e,emitEvent(event));}}module[_0x1150('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index f34eba4..3564bf2 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 _0x4dd3=['ChatWebsite','chat_websites','lodash','util','../../config/logger','bluebird','./chatWebsite.attributes','exports','define'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0x4dd3,0xf5));var _0x34dd=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x4dd3[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var logger=require(_0x34dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34dd('0x3'));var rp=require('request-promise');var attributes=require(_0x34dd('0x4'));module[_0x34dd('0x5')]=function(_0x7e6807,_0x4908f2){return _0x7e6807[_0x34dd('0x6')](_0x34dd('0x7'),attributes,{'tableName':_0x34dd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeea4=['moment','bluebird','request-promise','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api'];(function(_0x23592e,_0x3907ca){var _0xab5418=function(_0x20c68f){while(--_0x20c68f){_0x23592e['push'](_0x23592e['shift']());}};_0xab5418(++_0x3907ca);}(_0xeea4,0x19e));var _0x4eea=function(_0x3c5f05,_0x1ab387){_0x3c5f05=_0x3c5f05-0x0;var _0x5d9578=_0xeea4[_0x3c5f05];return _0x5d9578;};'use strict';var _=require(_0x4eea('0x0'));var util=require(_0x4eea('0x1'));var logger=require(_0x4eea('0x2'))(_0x4eea('0x3'));var moment=require(_0x4eea('0x4'));var BPromise=require(_0x4eea('0x5'));var rp=require(_0x4eea('0x6'));var attributes=require(_0x4eea('0x7'));module[_0x4eea('0x8')]=function(_0x5c02db,_0x399e8b){return _0x5c02db['define'](_0x4eea('0x9'),attributes,{'tableName':_0x4eea('0xa'),'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 c334610..7648c10 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 _0x4588=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','socket.io-emitter','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x57ae71,_0x4f793f){var _0xdab35d=function(_0x5d88db){while(--_0x5d88db){_0x57ae71['push'](_0x57ae71['shift']());}};_0xdab35d(++_0x4f793f);}(_0x4588,0x179));var _0x8458=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x4588[_0xdd0313];return _0x2bd7e8;};'use strict';var _=require(_0x8458('0x0'));var util=require(_0x8458('0x1'));var moment=require(_0x8458('0x2'));var BPromise=require(_0x8458('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x8458('0x4'))['db'];var utils=require(_0x8458('0x5'));var logger=require(_0x8458('0x6'))(_0x8458('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8458('0x8')]({'port':0x232a});var socket=require(_0x8458('0x9'))({'host':_0x8458('0xa'),'port':0x18eb});require(_0x8458('0xb'))[_0x8458('0xc')](socket);function respondWithRpcPromise(_0x5cda6e,_0x4621e5,_0x3812aa){return new BPromise(function(_0x346b61,_0x3e81d9){return client[_0x8458('0xd')](_0x5cda6e,_0x3812aa)[_0x8458('0xe')](function(_0x18f576){logger['info'](_0x8458('0xf'),_0x4621e5,_0x8458('0x10'));logger[_0x8458('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4621e5,_0x8458('0x10'),JSON[_0x8458('0x12')](_0x18f576));if(_0x18f576[_0x8458('0x13')]){if(_0x18f576[_0x8458('0x13')][_0x8458('0x14')]===0x1f4){logger[_0x8458('0x13')](_0x8458('0xf'),_0x4621e5,_0x18f576['error'][_0x8458('0x15')]);return _0x3e81d9(_0x18f576[_0x8458('0x13')][_0x8458('0x15')]);}logger[_0x8458('0x13')](_0x8458('0xf'),_0x4621e5,_0x18f576[_0x8458('0x13')][_0x8458('0x15')]);return _0x346b61(_0x18f576[_0x8458('0x13')][_0x8458('0x15')]);}else{logger[_0x8458('0x16')](_0x8458('0xf'),_0x4621e5,_0x8458('0x10'));_0x346b61(_0x18f576[_0x8458('0x17')]['message']);}})[_0x8458('0x18')](function(_0x409a92){logger[_0x8458('0x13')](_0x8458('0xf'),_0x4621e5,_0x409a92);_0x3e81d9(_0x409a92);});});} \ No newline at end of file +var _0x2821=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch'];(function(_0x283a1f,_0x32700a){var _0x141d6b=function(_0x5a697c){while(--_0x5a697c){_0x283a1f['push'](_0x283a1f['shift']());}};_0x141d6b(++_0x32700a);}(_0x2821,0x87));var _0x1282=function(_0x15e01c,_0x51c6a1){_0x15e01c=_0x15e01c-0x0;var _0x410103=_0x2821[_0x15e01c];return _0x410103;};'use strict';var _=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var moment=require(_0x1282('0x2'));var BPromise=require(_0x1282('0x3'));var rs=require(_0x1282('0x4'));var fs=require('fs');var db=require(_0x1282('0x5'))['db'];var utils=require(_0x1282('0x6'));var logger=require(_0x1282('0x7'))(_0x1282('0x8'));var config=require(_0x1282('0x9'));var jayson=require(_0x1282('0xa'));var client=jayson['client'][_0x1282('0xb')]({'port':0x232a});var socket=require(_0x1282('0xc'))({'host':_0x1282('0xd'),'port':0x18eb});require(_0x1282('0xe'))[_0x1282('0xf')](socket);function respondWithRpcPromise(_0x1a8666,_0x18d69a,_0x1436ba){return new BPromise(function(_0x5682bd,_0x41c458){return client[_0x1282('0x10')](_0x1a8666,_0x1436ba)[_0x1282('0x11')](function(_0x2ad86c){logger[_0x1282('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x18d69a,_0x1282('0x13'));logger[_0x1282('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x18d69a,_0x1282('0x13'),JSON[_0x1282('0x15')](_0x2ad86c));if(_0x2ad86c['error']){if(_0x2ad86c[_0x1282('0x16')]['code']===0x1f4){logger['error'](_0x1282('0x17'),_0x18d69a,_0x2ad86c[_0x1282('0x16')][_0x1282('0x18')]);return _0x41c458(_0x2ad86c[_0x1282('0x16')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x18d69a,_0x2ad86c[_0x1282('0x16')][_0x1282('0x18')]);return _0x5682bd(_0x2ad86c[_0x1282('0x16')][_0x1282('0x18')]);}else{logger[_0x1282('0x12')](_0x1282('0x17'),_0x18d69a,_0x1282('0x13'));_0x5682bd(_0x2ad86c[_0x1282('0x19')]['message']);}})[_0x1282('0x1a')](function(_0x28eeef){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x18d69a,_0x28eeef);_0x41c458(_0x28eeef);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c96e9cb..ac48867 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 _0x890b=['register','length','chatWebsite:','./chatWebsite.events','remove','update','emit'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0x890b,0x168));var _0xb890=function(_0x540ccc,_0x173678){_0x540ccc=_0x540ccc-0x0;var _0x3cd293=_0x890b[_0x540ccc];return _0x3cd293;};'use strict';var ChatWebsiteEvents=require(_0xb890('0x0'));var events=['save',_0xb890('0x1'),_0xb890('0x2')];function createListener(_0x3376ff,_0x35edf5){return function(_0x1246ca){_0x35edf5[_0xb890('0x3')](_0x3376ff,_0x1246ca);};}function removeListener(_0x240155,_0x53cfb1){return function(){ChatWebsiteEvents['removeListener'](_0x240155,_0x53cfb1);};}exports[_0xb890('0x4')]=function(_0x51d3a8){for(var _0x28e19c=0x0,_0x1b502f=events[_0xb890('0x5')];_0x28e19c<_0x1b502f;_0x28e19c++){var _0x550589=events[_0x28e19c];var _0x525cf7=createListener(_0xb890('0x6')+_0x550589,_0x51d3a8);ChatWebsiteEvents['on'](_0x550589,_0x525cf7);}}; \ No newline at end of file +var _0xabe8=['remove','removeListener','length','chatWebsite:','./chatWebsite.events'];(function(_0x36183f,_0x683bae){var _0x4e80bc=function(_0xd738f9){while(--_0xd738f9){_0x36183f['push'](_0x36183f['shift']());}};_0x4e80bc(++_0x683bae);}(_0xabe8,0x135));var _0x8abe=function(_0x2fa9f2,_0x422104){_0x2fa9f2=_0x2fa9f2-0x0;var _0xe5c811=_0xabe8[_0x2fa9f2];return _0xe5c811;};'use strict';var ChatWebsiteEvents=require(_0x8abe('0x0'));var events=['save',_0x8abe('0x1'),'update'];function createListener(_0x24a835,_0x1760c6){return function(_0x33149f){_0x1760c6['emit'](_0x24a835,_0x33149f);};}function removeListener(_0x50f681,_0x3b0e77){return function(){ChatWebsiteEvents[_0x8abe('0x2')](_0x50f681,_0x3b0e77);};}exports['register']=function(_0x1431e4){for(var _0x9b998a=0x0,_0x3d62e6=events[_0x8abe('0x3')];_0x9b998a<_0x3d62e6;_0x9b998a++){var _0x2ad14c=events[_0x9b998a];var _0x6ae3bb=createListener(_0x8abe('0x4')+_0x2ad14c,_0x1431e4);ChatWebsiteEvents['on'](_0x2ad14c,_0x6ae3bb);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index aee550f..459d33f 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 _0x7d02=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline','addApplications','addProactiveActions','addAgents','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x9f8f0e,_0x1be745){var _0x40c47a=function(_0x5bd0c4){while(--_0x5bd0c4){_0x9f8f0e['push'](_0x9f8f0e['shift']());}};_0x40c47a(++_0x1be745);}(_0x7d02,0x72));var _0x27d0=function(_0x50d536,_0xfe6484){_0x50d536=_0x50d536-0x0;var _0x2c9c0e=_0x7d02[_0x50d536];return _0x2c9c0e;};'use strict';var multer=require(_0x27d0('0x0'));var util=require(_0x27d0('0x1'));var path=require(_0x27d0('0x2'));var express=require(_0x27d0('0x3'));var router=express['Router']();var auth=require(_0x27d0('0x4'));var interaction=require(_0x27d0('0x5'));var config=require(_0x27d0('0x6'));var controller=require(_0x27d0('0x7'));router[_0x27d0('0x8')]('/',auth['isAuthenticated'](),controller[_0x27d0('0x9')]);router[_0x27d0('0x8')]('/describe',auth[_0x27d0('0xa')](),controller[_0x27d0('0xb')]);router[_0x27d0('0x8')](_0x27d0('0xc'),auth[_0x27d0('0xa')](),controller[_0x27d0('0xd')]);router['get'](_0x27d0('0xe'),auth[_0x27d0('0xa')](),controller[_0x27d0('0xf')]);router[_0x27d0('0x8')](_0x27d0('0x10'),auth[_0x27d0('0xa')](),controller[_0x27d0('0x11')]);router[_0x27d0('0x8')]('/:id/logo',controller['getLogo']);router[_0x27d0('0x8')](_0x27d0('0x12'),controller[_0x27d0('0x13')]);router[_0x27d0('0x8')](_0x27d0('0x14'),controller[_0x27d0('0x15')]);router[_0x27d0('0x8')](_0x27d0('0x16'),controller[_0x27d0('0x17')]);router[_0x27d0('0x8')](_0x27d0('0x18'),auth['isAuthenticated'](),controller[_0x27d0('0x19')]);router[_0x27d0('0x8')](_0x27d0('0x1a'),controller[_0x27d0('0x1b')]);router[_0x27d0('0x8')](_0x27d0('0x1c'),auth[_0x27d0('0xa')](),controller['getApplications']);router[_0x27d0('0x8')](_0x27d0('0x1d'),auth[_0x27d0('0xa')](),controller['getProactiveActions']);router['get'](_0x27d0('0x1e'),controller[_0x27d0('0x1f')]);router['get'](_0x27d0('0x20'),auth[_0x27d0('0xa')](),controller[_0x27d0('0x21')]);router[_0x27d0('0x8')](_0x27d0('0x22'),auth[_0x27d0('0xa')](),controller[_0x27d0('0x23')]);router['post']('/',auth[_0x27d0('0xa')](),controller['create']);router[_0x27d0('0x24')](_0x27d0('0xe'),auth[_0x27d0('0xa')](),controller['addDisposition']);router[_0x27d0('0x24')](_0x27d0('0x10'),auth[_0x27d0('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x27d0('0x25')]({'destination':function(_0x35f82c,_0x518dd1,_0x31f214){_0x31f214(null,path[_0x27d0('0x26')](config[_0x27d0('0x27')],_0x27d0('0x28')));},'filename':function(_0x44a28d,_0x81a62f,_0x4903cb){_0x4903cb(null,util[_0x27d0('0x29')](_0x27d0('0x2a'),Date[_0x27d0('0x2b')](),_0x81a62f[_0x27d0('0x2c')]));}})});router[_0x27d0('0x24')](_0x27d0('0x2d'),upload[_0x27d0('0x2e')](_0x27d0('0x2f')),controller['addLogo']);var upload=multer({'storage':multer[_0x27d0('0x25')]({'destination':function(_0x29be23,_0x1cc083,_0x2599bd){_0x2599bd(null,path[_0x27d0('0x26')](config[_0x27d0('0x27')],_0x27d0('0x30')));},'filename':function(_0x15746b,_0x25f24e,_0x3c825b){_0x3c825b(null,util[_0x27d0('0x29')]('%s-%s',Date[_0x27d0('0x2b')](),_0x25f24e[_0x27d0('0x2c')]));}})});router[_0x27d0('0x24')](_0x27d0('0x12'),upload['single'](_0x27d0('0x2f')),controller[_0x27d0('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x59e9c2,_0x5cdd3b,_0x2dff63){_0x2dff63(null,path[_0x27d0('0x26')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x32c943,_0x1a8626,_0xe0735){_0xe0735(null,util[_0x27d0('0x29')](_0x27d0('0x2a'),Date[_0x27d0('0x2b')](),_0x1a8626['originalname']));}})});router['post'](_0x27d0('0x14'),upload[_0x27d0('0x2e')](_0x27d0('0x2f')),controller[_0x27d0('0x32')]);var upload=multer({'storage':multer[_0x27d0('0x25')]({'destination':function(_0x496085,_0x1c9b07,_0x64845){_0x64845(null,path[_0x27d0('0x26')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x48fef6,_0x375c40,_0x3a558f){_0x3a558f(null,util['format'](_0x27d0('0x2a'),Date[_0x27d0('0x2b')](),_0x375c40[_0x27d0('0x2c')]));}})});router['post']('/:id/system_avatar',upload[_0x27d0('0x2e')](_0x27d0('0x2f')),controller[_0x27d0('0x33')]);router[_0x27d0('0x24')](_0x27d0('0x34'),controller[_0x27d0('0x35')]);router['post']('/:id/offline',controller[_0x27d0('0x36')]);router[_0x27d0('0x24')](_0x27d0('0x18'),auth[_0x27d0('0xa')](),controller['addInteraction']);router[_0x27d0('0x24')](_0x27d0('0x1c'),auth[_0x27d0('0xa')](),controller[_0x27d0('0x37')]);router[_0x27d0('0x24')]('/:id/proactive_actions',auth[_0x27d0('0xa')](),controller[_0x27d0('0x38')]);router['post'](_0x27d0('0x22'),auth[_0x27d0('0xa')](),controller[_0x27d0('0x39')]);router['put']('/:id',auth[_0x27d0('0xa')](),controller[_0x27d0('0x3a')]);router['delete'](_0x27d0('0xc'),auth[_0x27d0('0xa')](),controller[_0x27d0('0x3b')]);router[_0x27d0('0x3c')](_0x27d0('0xe'),auth[_0x27d0('0xa')](),controller[_0x27d0('0x3d')]);router[_0x27d0('0x3c')](_0x27d0('0x10'),auth[_0x27d0('0xa')](),controller['removeAnswers']);router[_0x27d0('0x3c')](_0x27d0('0x22'),auth[_0x27d0('0xa')](),controller[_0x27d0('0x3e')]);module[_0x27d0('0x3f')]=router; \ No newline at end of file +var _0xa825=['addSystemAvatar','/:id/notify','notify','offline','addInteraction','addApplications','addAgents','put','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','file','addLogo','%s-%s','single','server/files/images/avatars/'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xa825,0x117));var _0x5a82=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa825[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x5a82('0x0'));var util=require('util');var path=require(_0x5a82('0x1'));var express=require(_0x5a82('0x2'));var router=express[_0x5a82('0x3')]();var auth=require(_0x5a82('0x4'));var interaction=require(_0x5a82('0x5'));var config=require(_0x5a82('0x6'));var controller=require(_0x5a82('0x7'));router[_0x5a82('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a82('0x9')]);router['get'](_0x5a82('0xa'),auth[_0x5a82('0xb')](),controller[_0x5a82('0xc')]);router[_0x5a82('0x8')](_0x5a82('0xd'),auth['isAuthenticated'](),controller[_0x5a82('0xe')]);router['get'](_0x5a82('0xf'),auth[_0x5a82('0xb')](),controller[_0x5a82('0x10')]);router[_0x5a82('0x8')](_0x5a82('0x11'),auth[_0x5a82('0xb')](),controller[_0x5a82('0x12')]);router[_0x5a82('0x8')](_0x5a82('0x13'),controller['getLogo']);router['get'](_0x5a82('0x14'),controller[_0x5a82('0x15')]);router[_0x5a82('0x8')](_0x5a82('0x16'),controller[_0x5a82('0x17')]);router[_0x5a82('0x8')](_0x5a82('0x18'),controller[_0x5a82('0x19')]);router[_0x5a82('0x8')](_0x5a82('0x1a'),auth[_0x5a82('0xb')](),controller['getInteractions']);router[_0x5a82('0x8')](_0x5a82('0x1b'),controller[_0x5a82('0x1c')]);router[_0x5a82('0x8')]('/:id/applications',auth[_0x5a82('0xb')](),controller['getApplications']);router['get'](_0x5a82('0x1d'),auth[_0x5a82('0xb')](),controller[_0x5a82('0x1e')]);router[_0x5a82('0x8')](_0x5a82('0x1f'),controller[_0x5a82('0x20')]);router[_0x5a82('0x8')](_0x5a82('0x21'),auth[_0x5a82('0xb')](),controller['getOfflineMessages']);router[_0x5a82('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x5a82('0x22')]);router[_0x5a82('0x23')]('/',auth[_0x5a82('0xb')](),controller[_0x5a82('0x24')]);router[_0x5a82('0x23')](_0x5a82('0xf'),auth[_0x5a82('0xb')](),controller[_0x5a82('0x25')]);router[_0x5a82('0x23')](_0x5a82('0x11'),auth['isAuthenticated'](),controller[_0x5a82('0x26')]);var upload=multer({'storage':multer[_0x5a82('0x27')]({'destination':function(_0x1290ab,_0x1776bc,_0x57d1d9){_0x57d1d9(null,path[_0x5a82('0x28')](config[_0x5a82('0x29')],_0x5a82('0x2a')));},'filename':function(_0x24c106,_0x22d424,_0x289128){_0x289128(null,util[_0x5a82('0x2b')]('%s-%s',Date[_0x5a82('0x2c')](),_0x22d424[_0x5a82('0x2d')]));}})});router[_0x5a82('0x23')](_0x5a82('0x13'),upload['single'](_0x5a82('0x2e')),controller[_0x5a82('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d2744,_0x565c0d,_0x5b3a83){_0x5b3a83(null,path[_0x5a82('0x28')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x3fd1ce,_0x1a4608,_0x23faa3){_0x23faa3(null,util[_0x5a82('0x2b')](_0x5a82('0x30'),Date[_0x5a82('0x2c')](),_0x1a4608[_0x5a82('0x2d')]));}})});router[_0x5a82('0x23')](_0x5a82('0x14'),upload[_0x5a82('0x31')](_0x5a82('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5a82('0x27')]({'destination':function(_0x3eb627,_0x2cfaa8,_0x3cd8d1){_0x3cd8d1(null,path[_0x5a82('0x28')](config['root'],_0x5a82('0x32')));},'filename':function(_0x5a9e66,_0x5f4a83,_0x5874c8){_0x5874c8(null,util['format']('%s-%s',Date['now'](),_0x5f4a83['originalname']));}})});router[_0x5a82('0x23')]('/:id/customer_avatar',upload['single'](_0x5a82('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x5a82('0x27')]({'destination':function(_0x19f1cb,_0x3c5284,_0x34cf09){_0x34cf09(null,path[_0x5a82('0x28')](config['root'],_0x5a82('0x32')));},'filename':function(_0x44df70,_0x53ba37,_0x23b446){_0x23b446(null,util[_0x5a82('0x2b')](_0x5a82('0x30'),Date[_0x5a82('0x2c')](),_0x53ba37[_0x5a82('0x2d')]));}})});router[_0x5a82('0x23')](_0x5a82('0x18'),upload[_0x5a82('0x31')](_0x5a82('0x2e')),controller[_0x5a82('0x33')]);router[_0x5a82('0x23')](_0x5a82('0x34'),controller[_0x5a82('0x35')]);router['post']('/:id/offline',controller[_0x5a82('0x36')]);router[_0x5a82('0x23')]('/:id/interactions',auth[_0x5a82('0xb')](),controller[_0x5a82('0x37')]);router[_0x5a82('0x23')]('/:id/applications',auth['isAuthenticated'](),controller[_0x5a82('0x38')]);router[_0x5a82('0x23')](_0x5a82('0x1d'),auth[_0x5a82('0xb')](),controller['addProactiveActions']);router[_0x5a82('0x23')]('/:id/users',auth[_0x5a82('0xb')](),controller[_0x5a82('0x39')]);router[_0x5a82('0x3a')](_0x5a82('0xd'),auth[_0x5a82('0xb')](),controller[_0x5a82('0x3b')]);router[_0x5a82('0x3c')](_0x5a82('0xd'),auth[_0x5a82('0xb')](),controller['destroy']);router[_0x5a82('0x3c')](_0x5a82('0xf'),auth[_0x5a82('0xb')](),controller[_0x5a82('0x3d')]);router[_0x5a82('0x3c')](_0x5a82('0x11'),auth[_0x5a82('0xb')](),controller[_0x5a82('0x3e')]);router['delete'](_0x5a82('0x3f'),auth[_0x5a82('0xb')](),controller[_0x5a82('0x40')]);module[_0x5a82('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 ca2fd3e..f2f3f5b 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 _0x2e22=['STRING','name','sequelize'];(function(_0x2a7f92,_0x1be24c){var _0x289973=function(_0x19f57f){while(--_0x19f57f){_0x2a7f92['push'](_0x2a7f92['shift']());}};_0x289973(++_0x1be24c);}(_0x2e22,0x188));var _0x22e2=function(_0x3d13d7,_0x295266){_0x3d13d7=_0x3d13d7-0x0;var _0x34fdde=_0x2e22[_0x3d13d7];return _0x34fdde;};'use strict';var Sequelize=require(_0x22e2('0x0'));module['exports']={'name':{'type':Sequelize[_0x22e2('0x1')],'unique':_0x22e2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x22e2('0x1')]},'companyId':{'type':Sequelize[_0x22e2('0x1')]},'website':{'type':Sequelize[_0x22e2('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x22e2('0x1')]},'type':{'type':Sequelize[_0x22e2('0x1')]},'street':{'type':Sequelize[_0x22e2('0x1')]},'postalCode':{'type':Sequelize[_0x22e2('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x22e2('0x1')]},'email':{'type':Sequelize[_0x22e2('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x22e2('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x22e2('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x22e2('0x1')]}}; \ No newline at end of file +var _0x80b6=['STRING','name','sequelize'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x80b6,0x128));var _0x680b=function(_0x36f22c,_0x45e2da){_0x36f22c=_0x36f22c-0x0;var _0x45a1eb=_0x80b6[_0x36f22c];return _0x45a1eb;};'use strict';var Sequelize=require(_0x680b('0x0'));module['exports']={'name':{'type':Sequelize[_0x680b('0x1')],'unique':_0x680b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x680b('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x680b('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x680b('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x680b('0x1')]},'email':{'type':Sequelize[_0x680b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x680b('0x1')]},'sStreet':{'type':Sequelize[_0x680b('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x680b('0x1')]},'sCountry':{'type':Sequelize[_0x680b('0x1')]},'description':{'type':Sequelize[_0x680b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7477816..2b7894d 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 _0x96dd=['filter','options','count','includeAll','include','findAll','rows','catch','show','params','create','update','body','addContacts','CmContact','find','ids','getContacts','findOne','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','json','offset','Content-Range','save','then','destroy','end','name','index','CmCompany','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96dd,0x1b7));var _0xd96d=function(_0x7b68e3,_0x2eaf81){_0x7b68e3=_0x7b68e3-0x0;var _0x24bfca=_0x96dd[_0x7b68e3];return _0x24bfca;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xd96d('0x0'));var moment=require(_0xd96d('0x1'));var BPromise=require(_0xd96d('0x2'));var Mustache=require(_0xd96d('0x3'));var util=require(_0xd96d('0x4'));var path=require(_0xd96d('0x5'));var sox=require(_0xd96d('0x6'));var csv=require(_0xd96d('0x7'));var ejs=require(_0xd96d('0x8'));var fs=require('fs');var _=require(_0xd96d('0x9'));var squel=require(_0xd96d('0xa'));var crypto=require('crypto');var jsforce=require(_0xd96d('0xb'));var deskjs=require(_0xd96d('0xc'));var toCsv=require(_0xd96d('0x7'));var querystring=require(_0xd96d('0xd'));var Papa=require('papaparse');var qs=require(_0xd96d('0xe'));var logger=require(_0xd96d('0xf'))('api');var utils=require(_0xd96d('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x974367,_0x31d1c2){_0x31d1c2=_0x31d1c2||0xcc;return function(_0x465a86){if(_0x465a86){return _0x974367[_0xd96d('0x11')](_0x31d1c2);}return _0x974367[_0xd96d('0x12')](_0x31d1c2)['end']();};}function respondWithResult(_0x41c676,_0x23388a){_0x23388a=_0x23388a||0xc8;return function(_0x554072){if(_0x554072){return _0x41c676[_0xd96d('0x12')](_0x23388a)[_0xd96d('0x13')](_0x554072);}};}function respondWithFilteredResult(_0x3aac98,_0x392451){return function(_0x4d4d75){if(_0x4d4d75){var _0x5ce349=_0x4d4d75['count'],_0x2bdc98=_0x392451[_0xd96d('0x14')],_0x48bf4a=_0x392451[_0xd96d('0x14')]+_0x392451['limit'],_0x30b52e;if(_0x48bf4a>=_0x5ce349){_0x48bf4a=_0x5ce349;_0x30b52e=0xc8;}else{_0x30b52e=0xce;}_0x3aac98[_0xd96d('0x12')](_0x30b52e);return _0x3aac98['set'](_0xd96d('0x15'),_0x2bdc98+'-'+_0x48bf4a+'/'+_0x5ce349)[_0xd96d('0x13')](_0x4d4d75);}return null;};}function patchUpdates(_0x18aa97){return function(_0x2fde53){try{jsonpatch['apply'](_0x2fde53,_0x18aa97,!![]);}catch(_0x2436a3){return BPromise['reject'](_0x2436a3);}return _0x2fde53[_0xd96d('0x16')]();};}function saveUpdates(_0x12ab4c,_0x2ca269){return function(_0x1868fc){if(_0x1868fc){return _0x1868fc['update'](_0x12ab4c)[_0xd96d('0x17')](function(_0x2cb125){return _0x2cb125;});}return null;};}function removeEntity(_0x15b000,_0xc6c15d){return function(_0x15879b){if(_0x15879b){return _0x15879b[_0xd96d('0x18')]()[_0xd96d('0x17')](function(){_0x15b000[_0xd96d('0x12')](0xcc)[_0xd96d('0x19')]();});}};}function handleEntityNotFound(_0x2b7e82,_0x83be8a){return function(_0xd33f2b){if(!_0xd33f2b){_0x2b7e82['sendStatus'](0x194);}return _0xd33f2b;};}function handleError(_0x1fd4c1,_0x1a3af6){_0x1a3af6=_0x1a3af6||0x1f4;return function(_0x3a66fe){logger['error'](_0x3a66fe['stack']);if(_0x3a66fe[_0xd96d('0x1a')]){delete _0x3a66fe[_0xd96d('0x1a')];}_0x1fd4c1[_0xd96d('0x12')](_0x1a3af6)['send'](_0x3a66fe);};}exports[_0xd96d('0x1b')]=function(_0x4c8546,_0x56329e){var _0x1d2f45={},_0x5ec6cd={},_0x37c60a={'count':0x0,'rows':[]};var _0x4221ee=db[_0xd96d('0x1c')][_0xd96d('0x1d')];_0x5ec6cd[_0xd96d('0x1e')]=_[_0xd96d('0x1f')](_0x4221ee);var _0x52ebda={'dateStart':_0x4c8546[_0xd96d('0x20')][_0xd96d('0x21')],'dateEnd':_0x4c8546['query'][_0xd96d('0x22')]};delete _0x4c8546['query']['dateStart'];delete _0x4c8546['query'][_0xd96d('0x22')];_0x5ec6cd[_0xd96d('0x20')]=_['keys'](_0x4c8546[_0xd96d('0x20')]);_0x5ec6cd[_0xd96d('0x23')]=_[_0xd96d('0x24')](_0x5ec6cd[_0xd96d('0x1e')],_0x5ec6cd['query']);_0x1d2f45['attributes']=_[_0xd96d('0x24')](_0x5ec6cd['model'],qs[_0xd96d('0x25')](_0x4c8546[_0xd96d('0x20')][_0xd96d('0x25')]));_0x1d2f45['attributes']=_0x1d2f45[_0xd96d('0x26')][_0xd96d('0x27')]?_0x1d2f45[_0xd96d('0x26')]:_0x5ec6cd['model'];if(!_0x4c8546[_0xd96d('0x20')][_0xd96d('0x28')](_0xd96d('0x29'))){_0x1d2f45[_0xd96d('0x2a')]=qs[_0xd96d('0x2a')](_0x4c8546[_0xd96d('0x20')][_0xd96d('0x2a')]);_0x1d2f45[_0xd96d('0x14')]=qs[_0xd96d('0x14')](_0x4c8546[_0xd96d('0x20')]['offset']);}_0x1d2f45[_0xd96d('0x2b')]=qs[_0xd96d('0x2c')](_0x4c8546['query'][_0xd96d('0x2c')]);_0x1d2f45[_0xd96d('0x2d')]=qs[_0xd96d('0x23')](_[_0xd96d('0x2e')](_0x4c8546['query'],_0x5ec6cd['filters']));if(_0x52ebda['dateStart']){if(_0x52ebda[_0xd96d('0x22')]){_0x52ebda['dateEnd']=moment(_0x52ebda['dateEnd'])[_0xd96d('0x2f')](0x1,_0xd96d('0x30'));}else{_0x52ebda[_0xd96d('0x22')]=moment(_0x52ebda[_0xd96d('0x21')])[_0xd96d('0x2f')](0x1,_0xd96d('0x30'));}_[_0xd96d('0x31')](_0x1d2f45[_0xd96d('0x2d')],{'createdAt':{'$gte':_0x52ebda[_0xd96d('0x21')],'$lte':_0x52ebda[_0xd96d('0x22')]}});}if(_0x4c8546[_0xd96d('0x20')]['filter']){_0x1d2f45[_0xd96d('0x2d')]=_[_0xd96d('0x31')](_0x1d2f45[_0xd96d('0x2d')],{'$or':_[_0xd96d('0x32')](_0x1d2f45[_0xd96d('0x26')],function(_0x4ff661){var _0x5328f1={};_0x5328f1[_0x4ff661]={'$like':'%'+_0x4c8546['query'][_0xd96d('0x33')]+'%'};return _0x5328f1;})});}_0x1d2f45=_[_0xd96d('0x31')]({},_0x1d2f45,_0x4c8546[_0xd96d('0x34')]);var _0x4e0f2e={'where':_0x1d2f45[_0xd96d('0x2d')]};return db[_0xd96d('0x1c')]['count'](_0x4e0f2e)[_0xd96d('0x17')](function(_0x17feac){_0x37c60a[_0xd96d('0x35')]=_0x17feac;if(_0x4c8546[_0xd96d('0x20')][_0xd96d('0x36')]){_0x1d2f45[_0xd96d('0x37')]=[{'all':!![]}];}return db[_0xd96d('0x1c')][_0xd96d('0x38')](_0x1d2f45);})[_0xd96d('0x17')](function(_0xcfdaf9){_0x37c60a[_0xd96d('0x39')]=_0xcfdaf9;return _0x37c60a;})[_0xd96d('0x17')](respondWithFilteredResult(_0x56329e,_0x1d2f45))[_0xd96d('0x3a')](handleError(_0x56329e,null));};exports[_0xd96d('0x3b')]=function(_0x470c84,_0x57c48e){var _0x13d71b={'raw':![],'where':{'id':_0x470c84[_0xd96d('0x3c')]['id']}},_0x56bb48={};_0x56bb48['model']=_[_0xd96d('0x1f')](db[_0xd96d('0x1c')][_0xd96d('0x1d')]);_0x56bb48[_0xd96d('0x20')]=_['keys'](_0x470c84['query']);_0x56bb48['filters']=_[_0xd96d('0x24')](_0x56bb48[_0xd96d('0x1e')],_0x56bb48['query']);_0x13d71b['attributes']=_['intersection'](_0x56bb48[_0xd96d('0x1e')],qs[_0xd96d('0x25')](_0x470c84[_0xd96d('0x20')]['fields']));_0x13d71b['attributes']=_0x13d71b[_0xd96d('0x26')][_0xd96d('0x27')]?_0x13d71b[_0xd96d('0x26')]:_0x56bb48[_0xd96d('0x1e')];if(_0x470c84['query']['includeAll']){_0x13d71b[_0xd96d('0x37')]=[{'all':!![]}];}_0x13d71b=_[_0xd96d('0x31')]({},_0x13d71b,_0x470c84['options']);return db[_0xd96d('0x1c')]['find'](_0x13d71b)[_0xd96d('0x17')](handleEntityNotFound(_0x57c48e,null))['then'](respondWithResult(_0x57c48e,null))[_0xd96d('0x3a')](handleError(_0x57c48e,null));};exports[_0xd96d('0x3d')]=function(_0x4b6b77,_0x263e54){return db[_0xd96d('0x1c')][_0xd96d('0x3d')](_0x4b6b77['body'],{})['then'](respondWithResult(_0x263e54,0xc9))[_0xd96d('0x3a')](handleError(_0x263e54,null));};exports[_0xd96d('0x3e')]=function(_0x8c9a97,_0x4bf29a){if(_0x8c9a97[_0xd96d('0x3f')]['id']){delete _0x8c9a97[_0xd96d('0x3f')]['id'];}return db[_0xd96d('0x1c')]['find']({'where':{'id':_0x8c9a97[_0xd96d('0x3c')]['id']}})[_0xd96d('0x17')](handleEntityNotFound(_0x4bf29a,null))[_0xd96d('0x17')](saveUpdates(_0x8c9a97[_0xd96d('0x3f')],null))[_0xd96d('0x17')](respondWithResult(_0x4bf29a,null))[_0xd96d('0x3a')](handleError(_0x4bf29a,null));};exports[_0xd96d('0x18')]=function(_0x40d544,_0x352ad9){return db[_0xd96d('0x1c')]['find']({'where':{'id':_0x40d544[_0xd96d('0x3c')]['id']}})[_0xd96d('0x17')](handleEntityNotFound(_0x352ad9,null))[_0xd96d('0x17')](removeEntity(_0x352ad9,null))['catch'](handleError(_0x352ad9,null));};exports[_0xd96d('0x40')]=function(_0x552bc9,_0x51d884,_0xba79a9){return db[_0xd96d('0x41')][_0xd96d('0x42')]({'where':{'id':_0x552bc9[_0xd96d('0x3c')]['id']}})[_0xd96d('0x17')](handleEntityNotFound(_0x51d884,null))[_0xd96d('0x17')](function(_0x50b865){if(_0x50b865){return _0x50b865[_0xd96d('0x40')](_0x552bc9[_0xd96d('0x3f')][_0xd96d('0x43')],_['omit'](_0x552bc9[_0xd96d('0x3f')],[_0xd96d('0x43'),'id'])||{});}})['then'](respondWithResult(_0x51d884,null))[_0xd96d('0x3a')](handleError(_0x51d884,null));};exports[_0xd96d('0x44')]=function(_0x113c07,_0x5a796e,_0x369dc9){var _0x18b1c2={};var _0x5ad7dd={};var _0x25e2ed;var _0x3a7f10;return db[_0xd96d('0x1c')][_0xd96d('0x45')]({'where':{'id':_0x113c07[_0xd96d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5a796e,null))[_0xd96d('0x17')](function(_0x111e81){if(_0x111e81){_0x25e2ed=_0x111e81;_0x5ad7dd[_0xd96d('0x1e')]=_[_0xd96d('0x1f')](db['CmContact'][_0xd96d('0x1d')]);_0x5ad7dd[_0xd96d('0x20')]=_[_0xd96d('0x1f')](_0x113c07[_0xd96d('0x20')]);_0x5ad7dd[_0xd96d('0x23')]=_[_0xd96d('0x24')](_0x5ad7dd[_0xd96d('0x1e')],_0x5ad7dd[_0xd96d('0x20')]);_0x18b1c2[_0xd96d('0x26')]=_['intersection'](_0x5ad7dd[_0xd96d('0x1e')],qs[_0xd96d('0x25')](_0x113c07['query'][_0xd96d('0x25')]));_0x18b1c2[_0xd96d('0x26')]=_0x18b1c2[_0xd96d('0x26')]['length']?_0x18b1c2[_0xd96d('0x26')]:_0x5ad7dd[_0xd96d('0x1e')];_0x18b1c2[_0xd96d('0x2b')]=qs[_0xd96d('0x2c')](_0x113c07[_0xd96d('0x20')][_0xd96d('0x2c')]);_0x18b1c2[_0xd96d('0x2d')]=qs['filters'](_['pick'](_0x113c07[_0xd96d('0x20')],_0x5ad7dd[_0xd96d('0x23')]));if(_0x113c07[_0xd96d('0x20')][_0xd96d('0x33')]){_0x18b1c2['where']=_[_0xd96d('0x31')](_0x18b1c2[_0xd96d('0x2d')],{'$or':_[_0xd96d('0x32')](_0x18b1c2[_0xd96d('0x26')],function(_0x9dcf76){var _0x28be63={};_0x28be63[_0x9dcf76]={'$like':'%'+_0x113c07[_0xd96d('0x20')][_0xd96d('0x33')]+'%'};return _0x28be63;})});}_0x18b1c2=_['merge']({},_0x18b1c2,_0x113c07[_0xd96d('0x34')]);return _0x25e2ed[_0xd96d('0x44')](_0x18b1c2);}})[_0xd96d('0x17')](function(_0x4fce9a){if(_0x4fce9a){_0x3a7f10=_0x4fce9a[_0xd96d('0x27')];if(!_0x113c07[_0xd96d('0x20')][_0xd96d('0x28')](_0xd96d('0x29'))){_0x18b1c2[_0xd96d('0x2a')]=qs[_0xd96d('0x2a')](_0x113c07['query'][_0xd96d('0x2a')]);_0x18b1c2[_0xd96d('0x14')]=qs[_0xd96d('0x14')](_0x113c07[_0xd96d('0x20')][_0xd96d('0x14')]);}return _0x25e2ed[_0xd96d('0x44')](_0x18b1c2);}})['then'](function(_0x49a781){if(_0x49a781){return _0x49a781?{'count':_0x3a7f10,'rows':_0x49a781}:null;}})[_0xd96d('0x17')](respondWithResult(_0x5a796e,null))[_0xd96d('0x3a')](handleError(_0x5a796e,null));}; \ No newline at end of file +var _0x0b61=['status','count','offset','limit','Content-Range','json','then','destroy','end','name','index','CmCompany','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','add','day','where','dateStart','merge','map','filter','options','include','rows','catch','show','params','rawAttributes','find','create','body','update','addContacts','CmContact','ids','omit','getContacts','findOne','nolimit','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/logger','api','../../mysqldb','sendStatus'];(function(_0x31fd62,_0x4820f9){var _0xd5e251=function(_0x35d9ee){while(--_0x35d9ee){_0x31fd62['push'](_0x31fd62['shift']());}};_0xd5e251(++_0x4820f9);}(_0x0b61,0x1d0));var _0x10b6=function(_0x16df47,_0x52d80c){_0x16df47=_0x16df47-0x0;var _0x3eed6c=_0x0b61[_0x16df47];return _0x3eed6c;};'use strict';var jsonpatch=require(_0x10b6('0x0'));var rp=require(_0x10b6('0x1'));var moment=require(_0x10b6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x10b6('0x3'));var util=require(_0x10b6('0x4'));var path=require(_0x10b6('0x5'));var sox=require(_0x10b6('0x6'));var csv=require(_0x10b6('0x7'));var ejs=require(_0x10b6('0x8'));var fs=require('fs');var _=require(_0x10b6('0x9'));var squel=require(_0x10b6('0xa'));var crypto=require(_0x10b6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x10b6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x10b6('0xd'));var Papa=require(_0x10b6('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x10b6('0xf'))(_0x10b6('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x10b6('0x11'))['db'];function respondWithStatusCode(_0x30822a,_0x2082fb){_0x2082fb=_0x2082fb||0xcc;return function(_0x50fb4c){if(_0x50fb4c){return _0x30822a[_0x10b6('0x12')](_0x2082fb);}return _0x30822a[_0x10b6('0x13')](_0x2082fb)['end']();};}function respondWithResult(_0x203a01,_0x52db08){_0x52db08=_0x52db08||0xc8;return function(_0x1dabb7){if(_0x1dabb7){return _0x203a01['status'](_0x52db08)['json'](_0x1dabb7);}};}function respondWithFilteredResult(_0x3aa460,_0x401f4a){return function(_0x33882){if(_0x33882){var _0x5381aa=_0x33882[_0x10b6('0x14')],_0x1059a2=_0x401f4a[_0x10b6('0x15')],_0x3c64ee=_0x401f4a[_0x10b6('0x15')]+_0x401f4a[_0x10b6('0x16')],_0x5579e2;if(_0x3c64ee>=_0x5381aa){_0x3c64ee=_0x5381aa;_0x5579e2=0xc8;}else{_0x5579e2=0xce;}_0x3aa460['status'](_0x5579e2);return _0x3aa460['set'](_0x10b6('0x17'),_0x1059a2+'-'+_0x3c64ee+'/'+_0x5381aa)[_0x10b6('0x18')](_0x33882);}return null;};}function patchUpdates(_0x1e040d){return function(_0x28bd16){try{jsonpatch['apply'](_0x28bd16,_0x1e040d,!![]);}catch(_0x42c89d){return BPromise['reject'](_0x42c89d);}return _0x28bd16['save']();};}function saveUpdates(_0x5682d0,_0x219a9a){return function(_0x4f383a){if(_0x4f383a){return _0x4f383a['update'](_0x5682d0)[_0x10b6('0x19')](function(_0x34cd18){return _0x34cd18;});}return null;};}function removeEntity(_0x5aa368,_0x907116){return function(_0x172e2d){if(_0x172e2d){return _0x172e2d[_0x10b6('0x1a')]()['then'](function(){_0x5aa368['status'](0xcc)[_0x10b6('0x1b')]();});}};}function handleEntityNotFound(_0x102e11,_0x6e7851){return function(_0x22a44b){if(!_0x22a44b){_0x102e11[_0x10b6('0x12')](0x194);}return _0x22a44b;};}function handleError(_0x210359,_0x4d69d6){_0x4d69d6=_0x4d69d6||0x1f4;return function(_0xae0848){logger['error'](_0xae0848['stack']);if(_0xae0848['name']){delete _0xae0848[_0x10b6('0x1c')];}_0x210359[_0x10b6('0x13')](_0x4d69d6)['send'](_0xae0848);};}exports[_0x10b6('0x1d')]=function(_0x2b09e3,_0x160b3f){var _0x288442={},_0x570301={},_0x1e55be={'count':0x0,'rows':[]};var _0x3e3501=db[_0x10b6('0x1e')]['rawAttributes'];_0x570301[_0x10b6('0x1f')]=_[_0x10b6('0x20')](_0x3e3501);var _0x2d0856={'dateStart':_0x2b09e3[_0x10b6('0x21')]['dateStart'],'dateEnd':_0x2b09e3[_0x10b6('0x21')][_0x10b6('0x22')]};delete _0x2b09e3[_0x10b6('0x21')]['dateStart'];delete _0x2b09e3['query'][_0x10b6('0x22')];_0x570301[_0x10b6('0x21')]=_['keys'](_0x2b09e3[_0x10b6('0x21')]);_0x570301[_0x10b6('0x23')]=_[_0x10b6('0x24')](_0x570301['model'],_0x570301[_0x10b6('0x21')]);_0x288442[_0x10b6('0x25')]=_['intersection'](_0x570301['model'],qs[_0x10b6('0x26')](_0x2b09e3['query']['fields']));_0x288442['attributes']=_0x288442[_0x10b6('0x25')][_0x10b6('0x27')]?_0x288442[_0x10b6('0x25')]:_0x570301['model'];if(!_0x2b09e3['query'][_0x10b6('0x28')]('nolimit')){_0x288442[_0x10b6('0x16')]=qs['limit'](_0x2b09e3[_0x10b6('0x21')][_0x10b6('0x16')]);_0x288442[_0x10b6('0x15')]=qs[_0x10b6('0x15')](_0x2b09e3[_0x10b6('0x21')]['offset']);}_0x288442[_0x10b6('0x29')]=qs[_0x10b6('0x2a')](_0x2b09e3[_0x10b6('0x21')]['sort']);_0x288442['where']=qs[_0x10b6('0x23')](_[_0x10b6('0x2b')](_0x2b09e3[_0x10b6('0x21')],_0x570301['filters']));if(_0x2d0856['dateStart']){if(_0x2d0856[_0x10b6('0x22')]){_0x2d0856[_0x10b6('0x22')]=moment(_0x2d0856[_0x10b6('0x22')])[_0x10b6('0x2c')](0x1,_0x10b6('0x2d'));}else{_0x2d0856[_0x10b6('0x22')]=moment(_0x2d0856['dateStart'])[_0x10b6('0x2c')](0x1,_0x10b6('0x2d'));}_['merge'](_0x288442[_0x10b6('0x2e')],{'createdAt':{'$gte':_0x2d0856[_0x10b6('0x2f')],'$lte':_0x2d0856[_0x10b6('0x22')]}});}if(_0x2b09e3[_0x10b6('0x21')]['filter']){_0x288442[_0x10b6('0x2e')]=_[_0x10b6('0x30')](_0x288442['where'],{'$or':_[_0x10b6('0x31')](_0x288442[_0x10b6('0x25')],function(_0x229d35){var _0x14ad91={};_0x14ad91[_0x229d35]={'$like':'%'+_0x2b09e3['query'][_0x10b6('0x32')]+'%'};return _0x14ad91;})});}_0x288442=_[_0x10b6('0x30')]({},_0x288442,_0x2b09e3[_0x10b6('0x33')]);var _0x26ecc2={'where':_0x288442[_0x10b6('0x2e')]};return db[_0x10b6('0x1e')][_0x10b6('0x14')](_0x26ecc2)['then'](function(_0xe97150){_0x1e55be[_0x10b6('0x14')]=_0xe97150;if(_0x2b09e3[_0x10b6('0x21')]['includeAll']){_0x288442[_0x10b6('0x34')]=[{'all':!![]}];}return db[_0x10b6('0x1e')]['findAll'](_0x288442);})[_0x10b6('0x19')](function(_0x5e2132){_0x1e55be[_0x10b6('0x35')]=_0x5e2132;return _0x1e55be;})[_0x10b6('0x19')](respondWithFilteredResult(_0x160b3f,_0x288442))[_0x10b6('0x36')](handleError(_0x160b3f,null));};exports[_0x10b6('0x37')]=function(_0x43edb3,_0x22cc95){var _0x43de5f={'raw':![],'where':{'id':_0x43edb3[_0x10b6('0x38')]['id']}},_0x23a8ed={};_0x23a8ed['model']=_[_0x10b6('0x20')](db['CmCompany'][_0x10b6('0x39')]);_0x23a8ed['query']=_[_0x10b6('0x20')](_0x43edb3['query']);_0x23a8ed[_0x10b6('0x23')]=_[_0x10b6('0x24')](_0x23a8ed[_0x10b6('0x1f')],_0x23a8ed['query']);_0x43de5f[_0x10b6('0x25')]=_[_0x10b6('0x24')](_0x23a8ed[_0x10b6('0x1f')],qs[_0x10b6('0x26')](_0x43edb3[_0x10b6('0x21')]['fields']));_0x43de5f[_0x10b6('0x25')]=_0x43de5f['attributes'][_0x10b6('0x27')]?_0x43de5f['attributes']:_0x23a8ed['model'];if(_0x43edb3[_0x10b6('0x21')]['includeAll']){_0x43de5f[_0x10b6('0x34')]=[{'all':!![]}];}_0x43de5f=_['merge']({},_0x43de5f,_0x43edb3[_0x10b6('0x33')]);return db[_0x10b6('0x1e')][_0x10b6('0x3a')](_0x43de5f)[_0x10b6('0x19')](handleEntityNotFound(_0x22cc95,null))['then'](respondWithResult(_0x22cc95,null))[_0x10b6('0x36')](handleError(_0x22cc95,null));};exports[_0x10b6('0x3b')]=function(_0x16812f,_0x326aa7){return db[_0x10b6('0x1e')][_0x10b6('0x3b')](_0x16812f[_0x10b6('0x3c')],{})[_0x10b6('0x19')](respondWithResult(_0x326aa7,0xc9))[_0x10b6('0x36')](handleError(_0x326aa7,null));};exports[_0x10b6('0x3d')]=function(_0x258f2e,_0x31e519){if(_0x258f2e['body']['id']){delete _0x258f2e[_0x10b6('0x3c')]['id'];}return db[_0x10b6('0x1e')][_0x10b6('0x3a')]({'where':{'id':_0x258f2e[_0x10b6('0x38')]['id']}})['then'](handleEntityNotFound(_0x31e519,null))[_0x10b6('0x19')](saveUpdates(_0x258f2e[_0x10b6('0x3c')],null))[_0x10b6('0x19')](respondWithResult(_0x31e519,null))['catch'](handleError(_0x31e519,null));};exports['destroy']=function(_0xb4b4cc,_0x41d9c0){return db[_0x10b6('0x1e')][_0x10b6('0x3a')]({'where':{'id':_0xb4b4cc['params']['id']}})['then'](handleEntityNotFound(_0x41d9c0,null))[_0x10b6('0x19')](removeEntity(_0x41d9c0,null))[_0x10b6('0x36')](handleError(_0x41d9c0,null));};exports[_0x10b6('0x3e')]=function(_0x32f8ff,_0x405c54,_0x1c079a){return db[_0x10b6('0x3f')][_0x10b6('0x3a')]({'where':{'id':_0x32f8ff[_0x10b6('0x38')]['id']}})['then'](handleEntityNotFound(_0x405c54,null))['then'](function(_0x4ded71){if(_0x4ded71){return _0x4ded71['addContacts'](_0x32f8ff[_0x10b6('0x3c')][_0x10b6('0x40')],_[_0x10b6('0x41')](_0x32f8ff['body'],[_0x10b6('0x40'),'id'])||{});}})[_0x10b6('0x19')](respondWithResult(_0x405c54,null))[_0x10b6('0x36')](handleError(_0x405c54,null));};exports[_0x10b6('0x42')]=function(_0xf17eea,_0x4e6ff2,_0x4bac26){var _0x40d6e7={};var _0x5e5c7b={};var _0x3659d1;var _0x49ffaa;return db[_0x10b6('0x1e')][_0x10b6('0x43')]({'where':{'id':_0xf17eea['params']['id']}})['then'](handleEntityNotFound(_0x4e6ff2,null))['then'](function(_0x3ecb32){if(_0x3ecb32){_0x3659d1=_0x3ecb32;_0x5e5c7b[_0x10b6('0x1f')]=_[_0x10b6('0x20')](db[_0x10b6('0x3f')][_0x10b6('0x39')]);_0x5e5c7b[_0x10b6('0x21')]=_[_0x10b6('0x20')](_0xf17eea[_0x10b6('0x21')]);_0x5e5c7b[_0x10b6('0x23')]=_['intersection'](_0x5e5c7b[_0x10b6('0x1f')],_0x5e5c7b['query']);_0x40d6e7[_0x10b6('0x25')]=_['intersection'](_0x5e5c7b[_0x10b6('0x1f')],qs['fields'](_0xf17eea[_0x10b6('0x21')][_0x10b6('0x26')]));_0x40d6e7[_0x10b6('0x25')]=_0x40d6e7[_0x10b6('0x25')]['length']?_0x40d6e7[_0x10b6('0x25')]:_0x5e5c7b[_0x10b6('0x1f')];_0x40d6e7['order']=qs[_0x10b6('0x2a')](_0xf17eea['query'][_0x10b6('0x2a')]);_0x40d6e7[_0x10b6('0x2e')]=qs[_0x10b6('0x23')](_[_0x10b6('0x2b')](_0xf17eea[_0x10b6('0x21')],_0x5e5c7b[_0x10b6('0x23')]));if(_0xf17eea[_0x10b6('0x21')][_0x10b6('0x32')]){_0x40d6e7[_0x10b6('0x2e')]=_[_0x10b6('0x30')](_0x40d6e7[_0x10b6('0x2e')],{'$or':_[_0x10b6('0x31')](_0x40d6e7[_0x10b6('0x25')],function(_0x1486b4){var _0x433a57={};_0x433a57[_0x1486b4]={'$like':'%'+_0xf17eea[_0x10b6('0x21')][_0x10b6('0x32')]+'%'};return _0x433a57;})});}_0x40d6e7=_[_0x10b6('0x30')]({},_0x40d6e7,_0xf17eea['options']);return _0x3659d1[_0x10b6('0x42')](_0x40d6e7);}})[_0x10b6('0x19')](function(_0xa6d7b4){if(_0xa6d7b4){_0x49ffaa=_0xa6d7b4[_0x10b6('0x27')];if(!_0xf17eea[_0x10b6('0x21')][_0x10b6('0x28')](_0x10b6('0x44'))){_0x40d6e7[_0x10b6('0x16')]=qs[_0x10b6('0x16')](_0xf17eea[_0x10b6('0x21')]['limit']);_0x40d6e7[_0x10b6('0x15')]=qs[_0x10b6('0x15')](_0xf17eea[_0x10b6('0x21')][_0x10b6('0x15')]);}return _0x3659d1[_0x10b6('0x42')](_0x40d6e7);}})[_0x10b6('0x19')](function(_0x2f38c5){if(_0x2f38c5){return _0x2f38c5?{'count':_0x49ffaa,'rows':_0x2f38c5}:null;}})[_0x10b6('0x19')](respondWithResult(_0x4e6ff2,null))[_0x10b6('0x36')](handleError(_0x4e6ff2,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 3cc6cf1..12d1287 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 _0x04b8=['define','cm_companies','util','api','moment','request-promise','./cmCompany.attributes'];(function(_0x1c46dc,_0x4ed128){var _0x5e8d18=function(_0x254798){while(--_0x254798){_0x1c46dc['push'](_0x1c46dc['shift']());}};_0x5e8d18(++_0x4ed128);}(_0x04b8,0x159));var _0x804b=function(_0x15ea8d,_0x132b40){_0x15ea8d=_0x15ea8d-0x0;var _0x17e921=_0x04b8[_0x15ea8d];return _0x17e921;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var logger=require('../../config/logger')(_0x804b('0x1'));var moment=require(_0x804b('0x2'));var BPromise=require('bluebird');var rp=require(_0x804b('0x3'));var attributes=require(_0x804b('0x4'));module['exports']=function(_0x3530f6,_0x1c3474){return _0x3530f6[_0x804b('0x5')]('CmCompany',attributes,{'tableName':_0x804b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe02=['bluebird','request-promise','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api'];(function(_0x23c2c3,_0x27ecc8){var _0x41e09f=function(_0x5e6873){while(--_0x5e6873){_0x23c2c3['push'](_0x23c2c3['shift']());}};_0x41e09f(++_0x27ecc8);}(_0xbe02,0x146));var _0x2be0=function(_0x2f427c,_0x2fc826){_0x2f427c=_0x2f427c-0x0;var _0x20e799=_0xbe02[_0x2f427c];return _0x20e799;};'use strict';var _=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var logger=require(_0x2be0('0x2'))(_0x2be0('0x3'));var moment=require('moment');var BPromise=require(_0x2be0('0x4'));var rp=require(_0x2be0('0x5'));var attributes=require(_0x2be0('0x6'));module[_0x2be0('0x7')]=function(_0x22ed11,_0x3b824){return _0x22ed11[_0x2be0('0x8')](_0x2be0('0x9'),attributes,{'tableName':_0x2be0('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 a44c59b..4391042 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 _0x7da7=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x7da7,0x10d));var _0x77da=function(_0x1cfc39,_0x1d3913){_0x1cfc39=_0x1cfc39-0x0;var _0x957a28=_0x7da7[_0x1cfc39];return _0x957a28;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x77da('0x3'))['db'];var utils=require(_0x77da('0x4'));var logger=require('../../config/logger')(_0x77da('0x5'));var config=require(_0x77da('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x77da('0x7')][_0x77da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47da81,_0x30afe0,_0x47cf1d){return new BPromise(function(_0x1191de,_0x13992e){return client[_0x77da('0x9')](_0x47da81,_0x47cf1d)[_0x77da('0xa')](function(_0x252128){logger['info'](_0x77da('0xb'),_0x30afe0,_0x77da('0xc'));logger[_0x77da('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x30afe0,_0x77da('0xc'),JSON[_0x77da('0xe')](_0x252128));if(_0x252128[_0x77da('0xf')]){if(_0x252128[_0x77da('0xf')]['code']===0x1f4){logger[_0x77da('0xf')](_0x77da('0xb'),_0x30afe0,_0x252128[_0x77da('0xf')]['message']);return _0x13992e(_0x252128['error'][_0x77da('0x10')]);}logger[_0x77da('0xf')]('CmCompany,\x20%s,\x20%s',_0x30afe0,_0x252128[_0x77da('0xf')][_0x77da('0x10')]);return _0x1191de(_0x252128[_0x77da('0xf')][_0x77da('0x10')]);}else{logger['info'](_0x77da('0xb'),_0x30afe0,'request\x20sent');_0x1191de(_0x252128[_0x77da('0x11')][_0x77da('0x10')]);}})[_0x77da('0x12')](function(_0x4500c4){logger['error']('CmCompany,\x20%s,\x20%s',_0x30afe0,_0x4500c4);_0x13992e(_0x4500c4);});});} \ No newline at end of file +var _0x7fbe=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x387f26,_0x324ff6){_0x387f26=_0x387f26-0x0;var _0x4118b3=_0x7fbe[_0x387f26];return _0x4118b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var db=require(_0xe7fb('0x3'))['db'];var utils=require(_0xe7fb('0x4'));var logger=require(_0xe7fb('0x5'))(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var jayson=require(_0xe7fb('0x8'));var client=jayson[_0xe7fb('0x9')][_0xe7fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12d1b0,_0x24cd67,_0x1f943f){return new BPromise(function(_0x5ad75b,_0x213ebc){return client[_0xe7fb('0xb')](_0x12d1b0,_0x1f943f)[_0xe7fb('0xc')](function(_0x190a7a){logger['info']('CmCompany,\x20%s,\x20%s',_0x24cd67,_0xe7fb('0xd'));logger[_0xe7fb('0xe')](_0xe7fb('0xf'),_0x24cd67,_0xe7fb('0xd'),JSON[_0xe7fb('0x10')](_0x190a7a));if(_0x190a7a[_0xe7fb('0x11')]){if(_0x190a7a[_0xe7fb('0x11')][_0xe7fb('0x12')]===0x1f4){logger[_0xe7fb('0x11')](_0xe7fb('0x13'),_0x24cd67,_0x190a7a[_0xe7fb('0x11')][_0xe7fb('0x14')]);return _0x213ebc(_0x190a7a[_0xe7fb('0x11')][_0xe7fb('0x14')]);}logger[_0xe7fb('0x11')]('CmCompany,\x20%s,\x20%s',_0x24cd67,_0x190a7a[_0xe7fb('0x11')][_0xe7fb('0x14')]);return _0x5ad75b(_0x190a7a['error'][_0xe7fb('0x14')]);}else{logger[_0xe7fb('0x15')]('CmCompany,\x20%s,\x20%s',_0x24cd67,_0xe7fb('0xd'));_0x5ad75b(_0x190a7a['result'][_0xe7fb('0x14')]);}})[_0xe7fb('0x16')](function(_0x12603d){logger[_0xe7fb('0x11')]('CmCompany,\x20%s,\x20%s',_0x24cd67,_0x12603d);_0x213ebc(_0x12603d);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index db911d2..b8cf8fa 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 _0x1a0c=['Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/:id','show','getContacts','post','create','/:id/contacts','addContacts','update','delete','destroy','exports'];(function(_0x2a58ab,_0x57057f){var _0xc363d4=function(_0x1d1f72){while(--_0x1d1f72){_0x2a58ab['push'](_0x2a58ab['shift']());}};_0xc363d4(++_0x57057f);}(_0x1a0c,0xb4));var _0xc1a0=function(_0x3f8d2c,_0x18fe61){_0x3f8d2c=_0x3f8d2c-0x0;var _0x19f7a2=_0x1a0c[_0x3f8d2c];return _0x19f7a2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express[_0xc1a0('0x0')]();var auth=require(_0xc1a0('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0xc1a0('0x2'));var controller=require(_0xc1a0('0x3'));router[_0xc1a0('0x4')]('/',auth[_0xc1a0('0x5')](),controller[_0xc1a0('0x6')]);router['get'](_0xc1a0('0x7'),auth[_0xc1a0('0x5')](),controller[_0xc1a0('0x8')]);router[_0xc1a0('0x4')]('/:id/contacts',auth[_0xc1a0('0x5')](),controller[_0xc1a0('0x9')]);router[_0xc1a0('0xa')]('/',auth[_0xc1a0('0x5')](),controller[_0xc1a0('0xb')]);router[_0xc1a0('0xa')](_0xc1a0('0xc'),auth['isAuthenticated'](),controller[_0xc1a0('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc1a0('0xe')]);router[_0xc1a0('0xf')](_0xc1a0('0x7'),auth['isAuthenticated'](),controller[_0xc1a0('0x10')]);module[_0xc1a0('0x11')]=router; \ No newline at end of file +var _0x68be=['path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','addContacts','put','delete','destroy','exports','util'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0x68be,0xf6));var _0xe68b=function(_0x521378,_0x2f8004){_0x521378=_0x521378-0x0;var _0x4b2fc4=_0x68be[_0x521378];return _0x4b2fc4;};'use strict';var multer=require('multer');var util=require(_0xe68b('0x0'));var path=require(_0xe68b('0x1'));var express=require(_0xe68b('0x2'));var router=express[_0xe68b('0x3')]();var auth=require(_0xe68b('0x4'));var interaction=require(_0xe68b('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xe68b('0x6')]('/',auth[_0xe68b('0x7')](),controller[_0xe68b('0x8')]);router[_0xe68b('0x6')](_0xe68b('0x9'),auth['isAuthenticated'](),controller[_0xe68b('0xa')]);router[_0xe68b('0x6')](_0xe68b('0xb'),auth[_0xe68b('0x7')](),controller[_0xe68b('0xc')]);router[_0xe68b('0xd')]('/',auth[_0xe68b('0x7')](),controller['create']);router[_0xe68b('0xd')]('/:id/contacts',auth[_0xe68b('0x7')](),controller[_0xe68b('0xe')]);router[_0xe68b('0xf')](_0xe68b('0x9'),auth[_0xe68b('0x7')](),controller['update']);router[_0xe68b('0x10')](_0xe68b('0x9'),auth[_0xe68b('0x7')](),controller[_0xe68b('0x11')]);module[_0xe68b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 4fe39c9..312f1e8 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 _0x36c8=['exports','STRING','TEXT','INTEGER','DATE','lodash'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x36c8,0x1b5));var _0x836c=function(_0x172b0b,_0x5600cd){_0x172b0b=_0x172b0b-0x0;var _0x2ea1e1=_0x36c8[_0x172b0b];return _0x2ea1e1;};'use strict';var _=require(_0x836c('0x0'));var Sequelize=require('sequelize');module[_0x836c('0x1')]={'firstName':{'type':Sequelize[_0x836c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x836c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x836c('0x2')]},'description':{'type':Sequelize[_0x836c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x836c('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x836c('0x2')]},'url':{'type':Sequelize[_0x836c('0x2')]},'facebook':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x836c('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x836c('0x2')]},'line':{'type':Sequelize[_0x836c('0x2')]},'wechat':{'type':Sequelize[_0x836c('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x836c('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x836c('0x5')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3072=['sequelize','exports','STRING','INTEGER','UNSIGNED','DATE','lodash'];(function(_0x36e20b,_0x2e5876){var _0x2feca8=function(_0x3bc0ff){while(--_0x3bc0ff){_0x36e20b['push'](_0x36e20b['shift']());}};_0x2feca8(++_0x2e5876);}(_0x3072,0x1e9));var _0x2307=function(_0x9a5135,_0x1a864a){_0x9a5135=_0x9a5135-0x0;var _0x294d09=_0x3072[_0x9a5135];return _0x294d09;};'use strict';var _=require(_0x2307('0x0'));var Sequelize=require(_0x2307('0x1'));module[_0x2307('0x2')]={'firstName':{'type':Sequelize[_0x2307('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x2307('0x3')]},'street':{'type':Sequelize[_0x2307('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x2307('0x3')]},'country':{'type':Sequelize[_0x2307('0x3')]},'dateOfBirth':{'type':Sequelize[_0x2307('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x2307('0x3')]},'mobile':{'type':Sequelize[_0x2307('0x3')]},'fax':{'type':Sequelize[_0x2307('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x2307('0x3')]},'facebook':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x2307('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x2307('0x3')]},'line':{'type':Sequelize[_0x2307('0x3')]},'wechat':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x2307('0x4')]},'priority':{'type':Sequelize[_0x2307('0x4')](0x2)[_0x2307('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2307('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b44c9d8..770c748 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 _0x0392=['OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','join','bulkCreate','each','duplicates','$or','ListId','spread','error','show','$and','CmCustomField','omit','map','cf_%d','pickBy','startsWith','format','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','sequelize','text','values','phone','findOne','rawAttributes','intersection','pick','getTags','setTags','ids','getHoppers','ContactId','getHopperHistories','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','path','meta','User','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','fast-json-patch','moment','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','./cmContact.socket','register','status','end','json','count','offset','set','Content-Range','reject','destroy','stack','name','send','index','then','query','dateStart','dateEnd','keys','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','add','day','filter','merge','options','include','tag','push','Tag','Tags','distinct','CmContact','includeAll','color','ThroughTags','findAll','rows','find','params','catch','describe','body','get','isArray','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','from','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsMessage'];(function(_0x4c89cd,_0x2c57e2){var _0x1090d2=function(_0x1e9dda){while(--_0x1e9dda){_0x4c89cd['push'](_0x4c89cd['shift']());}};_0x1090d2(++_0x2c57e2);}(_0x0392,0xf5));var _0x2039=function(_0x19c978,_0x451c13){_0x19c978=_0x19c978-0x0;var _0x1eab29=_0x0392[_0x19c978];return _0x1eab29;};'use strict';var jsonpatch=require(_0x2039('0x0'));var rp=require('request-promise');var moment=require(_0x2039('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x2039('0x2'));var util=require('util');var path=require('path');var sox=require(_0x2039('0x3'));var csv=require(_0x2039('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2039('0x5'));var squel=require('squel');var crypto=require(_0x2039('0x6'));var jsforce=require(_0x2039('0x7'));var deskjs=require(_0x2039('0x8'));var toCsv=require(_0x2039('0x4'));var querystring=require(_0x2039('0x9'));var Papa=require('papaparse');var qs=require(_0x2039('0xa'));var logger=require(_0x2039('0xb'))(_0x2039('0xc'));var utils=require(_0x2039('0xd'));var config=require(_0x2039('0xe'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x2039('0xf'))[_0x2039('0x10')](socket);function respondWithStatusCode(_0x4b65c7,_0x2a6fb4){_0x2a6fb4=_0x2a6fb4||0xcc;return function(_0x39c36a){if(_0x39c36a){return _0x4b65c7['sendStatus'](_0x2a6fb4);}return _0x4b65c7[_0x2039('0x11')](_0x2a6fb4)[_0x2039('0x12')]();};}function respondWithResult(_0x2868d6,_0x1b0085){_0x1b0085=_0x1b0085||0xc8;return function(_0x7b363b){if(_0x7b363b){return _0x2868d6[_0x2039('0x11')](_0x1b0085)[_0x2039('0x13')](_0x7b363b);}};}function respondWithFilteredResult(_0x2268c2,_0x446aa7){return function(_0x1075e5){if(_0x1075e5){var _0x451112=_0x1075e5[_0x2039('0x14')],_0x14524f=_0x446aa7[_0x2039('0x15')],_0x2d45b4=_0x446aa7[_0x2039('0x15')]+_0x446aa7['limit'],_0xa6da07;if(_0x2d45b4>=_0x451112){_0x2d45b4=_0x451112;_0xa6da07=0xc8;}else{_0xa6da07=0xce;}_0x2268c2[_0x2039('0x11')](_0xa6da07);return _0x2268c2[_0x2039('0x16')](_0x2039('0x17'),_0x14524f+'-'+_0x2d45b4+'/'+_0x451112)[_0x2039('0x13')](_0x1075e5);}return null;};}function patchUpdates(_0x349d51){return function(_0x300a9f){try{jsonpatch['apply'](_0x300a9f,_0x349d51,!![]);}catch(_0x3fed5d){return BPromise[_0x2039('0x18')](_0x3fed5d);}return _0x300a9f['save']();};}function saveUpdates(_0x1d6755,_0x3d2a31){return function(_0x5ddf12){if(_0x5ddf12){return _0x5ddf12['update'](_0x1d6755)['then'](function(_0x26f6a6){return _0x26f6a6;});}return null;};}function removeEntity(_0x4d8340,_0x32b120){return function(_0x2f29a9){if(_0x2f29a9){return _0x2f29a9[_0x2039('0x19')]()['then'](function(){_0x4d8340[_0x2039('0x11')](0xcc)[_0x2039('0x12')]();});}};}function handleEntityNotFound(_0x43514c,_0xb2669){return function(_0x367ab3){if(!_0x367ab3){_0x43514c['sendStatus'](0x194);}return _0x367ab3;};}function handleError(_0x30eecf,_0x1e22ff){_0x1e22ff=_0x1e22ff||0x1f4;return function(_0x1ae0ab){logger['error'](_0x1ae0ab[_0x2039('0x1a')]);if(_0x1ae0ab[_0x2039('0x1b')]){delete _0x1ae0ab[_0x2039('0x1b')];}_0x30eecf[_0x2039('0x11')](_0x1e22ff)[_0x2039('0x1c')](_0x1ae0ab);};}exports[_0x2039('0x1d')]=function(_0x5eab29,_0x17c0d0){var _0x3e0a2c={},_0x58ecfc={},_0x2939ab={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0x2039('0x1e')](function(_0x22fed5){_0x58ecfc['model']=_['keys'](_0x22fed5);var _0x140723={'dateStart':_0x5eab29[_0x2039('0x1f')][_0x2039('0x20')],'dateEnd':_0x5eab29[_0x2039('0x1f')][_0x2039('0x21')]};delete _0x5eab29[_0x2039('0x1f')][_0x2039('0x20')];delete _0x5eab29[_0x2039('0x1f')][_0x2039('0x21')];_0x58ecfc[_0x2039('0x1f')]=_[_0x2039('0x22')](_0x5eab29[_0x2039('0x1f')]);_0x58ecfc['filters']=_['intersection'](_0x58ecfc['model'],_0x58ecfc[_0x2039('0x1f')]);_0x3e0a2c['attributes']=_['intersection'](_0x58ecfc[_0x2039('0x23')],qs[_0x2039('0x24')](_0x5eab29[_0x2039('0x1f')][_0x2039('0x24')]));_0x3e0a2c['attributes']=_0x3e0a2c[_0x2039('0x25')][_0x2039('0x26')]?_0x3e0a2c['attributes']:_0x58ecfc['model'];if(!_0x5eab29[_0x2039('0x1f')][_0x2039('0x27')](_0x2039('0x28'))){_0x3e0a2c[_0x2039('0x29')]=qs[_0x2039('0x29')](_0x5eab29[_0x2039('0x1f')][_0x2039('0x29')]);_0x3e0a2c[_0x2039('0x15')]=qs['offset'](_0x5eab29[_0x2039('0x1f')]['offset']);}_0x3e0a2c[_0x2039('0x2a')]=qs['sort'](_0x5eab29[_0x2039('0x1f')][_0x2039('0x2b')]);_0x3e0a2c[_0x2039('0x2c')]=qs[_0x2039('0x2d')](_['pick'](_0x5eab29['query'],_0x58ecfc[_0x2039('0x2d')]));if(_0x140723[_0x2039('0x20')]){if(_0x140723[_0x2039('0x21')]){_0x140723[_0x2039('0x21')]=moment(_0x140723['dateEnd'])[_0x2039('0x2e')](0x1,_0x2039('0x2f'));}else{_0x140723[_0x2039('0x21')]=moment(_0x140723[_0x2039('0x20')])[_0x2039('0x2e')](0x1,_0x2039('0x2f'));}_['merge'](_0x3e0a2c['where'],{'createdAt':{'$gte':_0x140723[_0x2039('0x20')],'$lte':_0x140723[_0x2039('0x21')]}});}if(_0x5eab29[_0x2039('0x1f')][_0x2039('0x30')]){_0x3e0a2c[_0x2039('0x2c')]=_[_0x2039('0x31')](_0x3e0a2c[_0x2039('0x2c')],{'$or':_['map'](_0x3e0a2c[_0x2039('0x25')],function(_0x2dfdf9){var _0x5d48af={};_0x5d48af[_0x2dfdf9]={'$like':'%'+_0x5eab29[_0x2039('0x1f')][_0x2039('0x30')]+'%'};return _0x5d48af;})});}_0x3e0a2c=_[_0x2039('0x31')]({},_0x3e0a2c,_0x5eab29[_0x2039('0x32')]);var _0x260ba4={'where':_0x3e0a2c[_0x2039('0x2c')]};_0x260ba4[_0x2039('0x33')]=[];if(_0x5eab29[_0x2039('0x1f')][_0x2039('0x34')]){_0x260ba4[_0x2039('0x33')][_0x2039('0x35')]({'model':db[_0x2039('0x36')],'as':_0x2039('0x37'),'attributes':['id'],'where':{'id':_0x5eab29[_0x2039('0x1f')][_0x2039('0x34')]},'required':!![]});_0x260ba4[_0x2039('0x38')]=!![];}return db[_0x2039('0x39')][_0x2039('0x14')](_0x260ba4)[_0x2039('0x1e')](function(_0x131aba){_0x2939ab[_0x2039('0x14')]=_0x131aba;if(_0x5eab29[_0x2039('0x1f')][_0x2039('0x3a')]){_0x3e0a2c['include']=[{'model':db[_0x2039('0x36')],'as':_0x2039('0x37'),'attributes':['id','name',_0x2039('0x3b')],'required':_0x5eab29[_0x2039('0x1f')]['tag']?!![]:![]},{'model':db[_0x2039('0x36')],'as':_0x2039('0x3c'),'attributes':['id',_0x2039('0x1b'),'color'],'through':_0x5eab29['query'][_0x2039('0x34')]?{'attributes':[],'where':{'TagId':_0x5eab29[_0x2039('0x1f')]['tag']||undefined}}:{},'required':_0x5eab29[_0x2039('0x1f')][_0x2039('0x34')]?!![]:![]}];}return db['CmContact'][_0x2039('0x3d')](_0x3e0a2c);})[_0x2039('0x1e')](function(_0x13726a){_0x2939ab[_0x2039('0x3e')]=_0x13726a;return _0x2939ab;})[_0x2039('0x1e')](respondWithFilteredResult(_0x17c0d0,_0x3e0a2c))['catch'](handleError(_0x17c0d0,null));});};exports[_0x2039('0x19')]=function(_0x5d7b27,_0x35439e){return db[_0x2039('0x39')][_0x2039('0x3f')]({'where':{'id':_0x5d7b27[_0x2039('0x40')]['id']}})[_0x2039('0x1e')](handleEntityNotFound(_0x35439e,null))[_0x2039('0x1e')](removeEntity(_0x35439e,null))[_0x2039('0x41')](handleError(_0x35439e,null));};exports['describe']=function(_0xc53a56,_0xc23647){return db[_0x2039('0x39')][_0x2039('0x42')]()[_0x2039('0x1e')](respondWithResult(_0xc23647,null))['catch'](handleError(_0xc23647,null));};exports[_0x2039('0x31')]=function(_0x2ae0fe,_0x27ea10){var _0x4f8664;var _0x433618;var _0x15a4e9;if(_0x2ae0fe[_0x2039('0x43')]['id']){delete _0x2ae0fe['body']['id'];}return db['CmContact'][_0x2039('0x3d')]({'where':{'id':[_0x2ae0fe['body']['to'],_0x2ae0fe['body']['from']]}})[_0x2039('0x1e')](function(_0x3f229c){if(_0x3f229c){if(_0x3f229c['length']!==0x2){return null;}_0x3f229c[0x0]=_0x3f229c[0x0][_0x2039('0x44')]({'plain':!![]});_0x3f229c[0x1]=_0x3f229c[0x1]['get']({'plain':!![]});delete _0x3f229c[0x0]['id'];delete _0x3f229c[0x1]['id'];return _['mergeWith'](_0x3f229c[0x0],_0x3f229c[0x1],function(_0x2dd43f,_0x27717b){if(Array[_0x2039('0x45')](_0x27717b)&&!_0x27717b[_0x2039('0x26')]){return _0x2dd43f;}else if(!_0x27717b){return _0x2dd43f;}});}})[_0x2039('0x1e')](handleEntityNotFound(_0x27ea10,null))[_0x2039('0x1e')](function(_0x20f322){if(_0x20f322){if(_0x20f322[_0x2039('0x46')]&&_['isArray'](_0x20f322['tags'])){_0x20f322['tags']=_0x20f322[_0x2039('0x46')]['join']();}logger[_0x2039('0x47')](_0x2039('0x48'),_0x2ae0fe[_0x2039('0x43')]['to'],_0x2ae0fe[_0x2039('0x43')]['from']);return db[_0x2039('0x49')]['destroy']({'where':{'ContactId':[_0x2ae0fe['body']['to'],_0x2ae0fe[_0x2039('0x43')][_0x2039('0x4a')]]}})['then'](function(_0x436f09){logger['info'](_0x2039('0x4b'),_0x436f09);return db['CmHopperBlack'][_0x2039('0x19')]({'where':{'ContactId':[_0x2ae0fe[_0x2039('0x43')]['to'],_0x2ae0fe['body'][_0x2039('0x4a')]]}})[_0x2039('0x1e')](function(_0x13a9b2){logger[_0x2039('0x47')](_0x2039('0x4c'),_0x13a9b2);return db[_0x2039('0x39')][_0x2039('0x4d')](_0x20f322);});});}})[_0x2039('0x1e')](function(_0x437307){if(_0x437307){_0x4f8664=_0x437307;_0x433618={'ContactId':_0x4f8664['id']};_0x15a4e9={'where':{'ContactId':[_0x2ae0fe['body']['to'],_0x2ae0fe[_0x2039('0x43')][_0x2039('0x4a')]]}};return db[_0x2039('0x4e')][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x50')][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x51')]['update'](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db['MailInteraction'][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x52')][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x53')]['update'](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x52')]['update'](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db['SmsInteraction'][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db[_0x2039('0x54')]['update'](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db['FaxInteraction'][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db['FaxMessage'][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db[_0x2039('0x55')][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x56')]['update'](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x57')][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x58')]['update'](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db['ReportAgentPreview'][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x59')]['update'](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x5a')][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db[_0x2039('0x5b')][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db[_0x2039('0x5c')]['update'](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db[_0x2039('0x5d')]['update'](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db[_0x2039('0x5e')][_0x2039('0x4f')](_0x433618,_0x15a4e9);}})['then'](function(){if(_0x4f8664){return db[_0x2039('0x5f')]['update'](_0x433618,_0x15a4e9);}})[_0x2039('0x1e')](function(){if(_0x4f8664){return db['CmContact'][_0x2039('0x19')]({'where':{'id':[_0x2ae0fe[_0x2039('0x43')]['to'],_0x2ae0fe[_0x2039('0x43')]['from']]}});}})['then'](function(){if(_0x4f8664){return _0x4f8664;}})[_0x2039('0x1e')](respondWithResult(_0x27ea10,null))[_0x2039('0x41')](handleError(_0x27ea10,null));};exports[_0x2039('0x4d')]=function(_0xbaf641,_0x555df4){return db[_0x2039('0x39')][_0x2039('0x42')]()[_0x2039('0x1e')](function(_0x3a9ad3){if(_0xbaf641[_0x2039('0x43')][_0x2039('0x46')]&&_['isArray'](_0xbaf641[_0x2039('0x43')]['tags'])){if(_0xbaf641[_0x2039('0x43')][_0x2039('0x46')][_0x2039('0x26')]){_0xbaf641['body']['tags']=_0xbaf641['body']['tags'][_0x2039('0x60')](';')+';';}else{_0xbaf641[_0x2039('0x43')][_0x2039('0x46')]=null;}}else{_0xbaf641['body'][_0x2039('0x46')]=null;}return db[_0x2039('0x39')][_0x2039('0x4d')](_0xbaf641['body'],{'fields':_[_0x2039('0x22')](_0x3a9ad3),'raw':!![]});})[_0x2039('0x1e')](respondWithResult(_0x555df4,0xc9))[_0x2039('0x41')](handleError(_0x555df4,null));};exports[_0x2039('0x61')]=function(_0x25c729,_0x5a88e7){var _0xd23908=[];var _0x5ba825=0x0;var _0x2450d4=0x0;var _0x23bc40=0x0;return db[_0x2039('0x39')][_0x2039('0x42')]()[_0x2039('0x1e')](function(_0x8b2d69){return BPromise[_0x2039('0x62')](_0x25c729[_0x2039('0x43')],function(_0x1af1b2){var _0x233210={'where':{'$or':[]},'defaults':_0x1af1b2,'fields':_['keys'](_0x8b2d69),'raw':!![]};if(_0x1af1b2[_0x2039('0x63')]){for(var _0x24c6ea=0x0;_0x24c6ea<_0x1af1b2[_0x2039('0x63')]['length'];_0x24c6ea++){var _0x5df66b={};_0x5df66b[_0x1af1b2[_0x2039('0x63')][_0x24c6ea]]=_0x1af1b2[_0x1af1b2[_0x2039('0x63')][_0x24c6ea]];_0x233210[_0x2039('0x2c')][_0x2039('0x64')][_0x2039('0x35')](_0x5df66b);}_0x233210['where'][_0x2039('0x65')]=_0x1af1b2[_0x2039('0x65')];}return db[_0x2039('0x39')]['findOrCreate'](_0x233210)[_0x2039('0x66')](function(_0x475670,_0x3e8584){if(_0x3e8584){_0x5ba825++;}else{_0x23bc40++;}})[_0x2039('0x41')](function(_0x17562b){console[_0x2039('0x67')](_0x17562b);_0x2450d4++;});});})['then'](function(_0x44604c){if(_0x44604c){return{'success':_0x5ba825,'failure':_0x2450d4,'duplicates':_0x23bc40};}})[_0x2039('0x1e')](respondWithResult(_0x5a88e7,0xc9))[_0x2039('0x41')](handleError(_0x5a88e7,null));};exports[_0x2039('0x68')]=function(_0x1872cf,_0x475f76,_0x13b757){var _0x51102b;return db[_0x2039('0x39')]['describe']()[_0x2039('0x1e')](function(_0x409095){return db[_0x2039('0x39')][_0x2039('0x3f')]({'where':{'id':_0x1872cf[_0x2039('0x40')]['id']},'include':[{'model':db['Tag'],'as':_0x2039('0x37'),'attributes':['id',_0x2039('0x1b'),_0x2039('0x3b')],'required':_0x1872cf[_0x2039('0x1f')][_0x2039('0x34')]?!![]:![]}],'attributes':_[_0x2039('0x22')](_0x409095)});})[_0x2039('0x1e')](function(_0x5832df){_0x51102b=_0x5832df[_0x2039('0x44')]({'plain':!![]});var _0x542464={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5832df&&_0x5832df[_0x2039('0x65')]){if(_0x5832df[_0x2039('0x65')]){_0x542464['where'][_0x2039('0x69')][_0x2039('0x35')]({'ListId':{'$ne':_0x5832df[_0x2039('0x65')]}});}}return db[_0x2039('0x6a')][_0x2039('0x3d')](_0x542464);})[_0x2039('0x1e')](function(_0x22e7a8){return _[_0x2039('0x6b')](_0x51102b,_[_0x2039('0x6c')](_0x22e7a8,function(_0x5390d2){return util['format'](_0x2039('0x6d'),_0x5390d2['id']);}));})[_0x2039('0x1e')](handleEntityNotFound(_0x475f76,null))[_0x2039('0x1e')](respondWithResult(_0x475f76,null))['catch'](handleError(_0x475f76,null));};exports['update']=function(_0x5f0dee,_0x59efda){var _0x57495e;if(_0x5f0dee[_0x2039('0x43')]['id']){delete _0x5f0dee[_0x2039('0x43')]['id'];}return db[_0x2039('0x39')][_0x2039('0x3f')]({'where':{'id':_0x5f0dee[_0x2039('0x40')]['id']}})[_0x2039('0x1e')](handleEntityNotFound(_0x59efda,null))[_0x2039('0x1e')](saveUpdates(_0x5f0dee['body'],null))[_0x2039('0x1e')](function(_0x5c2345){_0x57495e=_0x5c2345;var _0x478596={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5c2345&&_0x5c2345[_0x2039('0x65')]){if(_0x5c2345['ListId']){_0x478596[_0x2039('0x2c')][_0x2039('0x69')][_0x2039('0x35')]({'ListId':{'$ne':_0x5c2345['ListId']}});}}return db[_0x2039('0x6a')][_0x2039('0x3d')](_0x478596);})['then'](function(_0x4c59bc){if(_0x4c59bc){return _[_0x2039('0x6b')](_[_0x2039('0x6e')](_0x5f0dee[_0x2039('0x43')],function(_0xa18675,_0x5d0fad){return _[_0x2039('0x6f')](_0x5d0fad,'cf_');}),_['map'](_0x4c59bc,function(_0x11975b){return util[_0x2039('0x70')](_0x2039('0x6d'),_0x11975b['id']);}));}})[_0x2039('0x1e')](function(_0x2827a5){if(_0x2827a5&&!_[_0x2039('0x71')](_0x2827a5)){var _0x1795df=squel[_0x2039('0x4f')]()[_0x2039('0x72')](_0x2039('0x73'))['setFields'](_0x2827a5)[_0x2039('0x2c')](_0x2039('0x74'),_0x5f0dee[_0x2039('0x40')]['id'])[_0x2039('0x75')]();return db[_0x2039('0x76')][_0x2039('0x1f')](_0x1795df[_0x2039('0x77')],{'replacements':_0x1795df[_0x2039('0x78')]});}})['then'](function(){if(_0x5f0dee[_0x2039('0x43')][_0x2039('0x79')]&&_0x57495e){return db[_0x2039('0x49')]['update']({'phone':_0x5f0dee['body'][_0x2039('0x79')]},{'where':{'ContactId':_0x57495e['id']}});}})[_0x2039('0x1e')](function(){return _0x57495e;})['then'](respondWithResult(_0x59efda,null))[_0x2039('0x41')](handleError(_0x59efda,null));};exports['getTags']=function(_0x4dd865,_0x445df7,_0x1a0459){var _0x38ec16={};var _0x18a66d={};var _0x202531;var _0x40380a;return db['CmContact'][_0x2039('0x7a')]({'where':{'id':_0x4dd865[_0x2039('0x40')]['id']}})['then'](handleEntityNotFound(_0x445df7,null))['then'](function(_0x58ce2c){if(_0x58ce2c){_0x202531=_0x58ce2c;_0x18a66d['model']=_[_0x2039('0x22')](db[_0x2039('0x36')][_0x2039('0x7b')]);_0x18a66d[_0x2039('0x1f')]=_[_0x2039('0x22')](_0x4dd865[_0x2039('0x1f')]);_0x18a66d[_0x2039('0x2d')]=_[_0x2039('0x7c')](_0x18a66d[_0x2039('0x23')],_0x18a66d[_0x2039('0x1f')]);_0x38ec16[_0x2039('0x25')]=_[_0x2039('0x7c')](_0x18a66d[_0x2039('0x23')],qs[_0x2039('0x24')](_0x4dd865[_0x2039('0x1f')][_0x2039('0x24')]));_0x38ec16[_0x2039('0x25')]=_0x38ec16[_0x2039('0x25')][_0x2039('0x26')]?_0x38ec16[_0x2039('0x25')]:_0x18a66d[_0x2039('0x23')];_0x38ec16[_0x2039('0x2a')]=qs[_0x2039('0x2b')](_0x4dd865[_0x2039('0x1f')]['sort']);_0x38ec16[_0x2039('0x2c')]=qs[_0x2039('0x2d')](_[_0x2039('0x7d')](_0x4dd865['query'],_0x18a66d['filters']));if(_0x4dd865['query'][_0x2039('0x30')]){_0x38ec16['where']=_['merge'](_0x38ec16[_0x2039('0x2c')],{'$or':_[_0x2039('0x6c')](_0x38ec16[_0x2039('0x25')],function(_0x30a879){var _0x54cee2={};_0x54cee2[_0x30a879]={'$like':'%'+_0x4dd865[_0x2039('0x1f')][_0x2039('0x30')]+'%'};return _0x54cee2;})});}_0x38ec16=_['merge']({},_0x38ec16,_0x4dd865['options']);return _0x202531[_0x2039('0x7e')](_0x38ec16);}})[_0x2039('0x1e')](function(_0x5c0dd8){if(_0x5c0dd8){_0x40380a=_0x5c0dd8[_0x2039('0x26')];if(!_0x4dd865[_0x2039('0x1f')][_0x2039('0x27')](_0x2039('0x28'))){_0x38ec16[_0x2039('0x29')]=qs['limit'](_0x4dd865[_0x2039('0x1f')][_0x2039('0x29')]);_0x38ec16[_0x2039('0x15')]=qs[_0x2039('0x15')](_0x4dd865['query'][_0x2039('0x15')]);}return _0x202531[_0x2039('0x7e')](_0x38ec16);}})[_0x2039('0x1e')](function(_0x4ebe0a){if(_0x4ebe0a){return _0x4ebe0a?{'count':_0x40380a,'rows':_0x4ebe0a}:null;}})[_0x2039('0x1e')](respondWithResult(_0x445df7,null))[_0x2039('0x41')](handleError(_0x445df7,null));};exports[_0x2039('0x7f')]=function(_0x3bb44d,_0x1b0487,_0x4ef3cb){if(_0x3bb44d['body']['id']){delete _0x3bb44d[_0x2039('0x43')]['id'];}return db[_0x2039('0x39')][_0x2039('0x7a')]({'where':{'id':_0x3bb44d[_0x2039('0x40')]['id']}})['then'](handleEntityNotFound(_0x1b0487,null))['then'](function(_0x64a974){if(_0x64a974){return _0x64a974[_0x2039('0x7f')](_0x3bb44d[_0x2039('0x43')][_0x2039('0x80')]||[]);}return null;})[_0x2039('0x1e')](respondWithResult(_0x1b0487,null))['catch'](handleError(_0x1b0487,null));};exports[_0x2039('0x81')]=function(_0x53dc08,_0x2e4b23,_0x4bfcd9){var _0x561896={'raw':![],'where':{}};var _0x52f993={};var _0x2f2b9b={'count':0x0,'rows':[]};return db[_0x2039('0x39')]['findOne']({'where':{'id':_0x53dc08['params']['id']}})[_0x2039('0x1e')](handleEntityNotFound(_0x2e4b23,null))[_0x2039('0x1e')](function(_0x40b847){if(_0x40b847){_0x52f993[_0x2039('0x23')]=_[_0x2039('0x22')](db[_0x2039('0x49')]['rawAttributes']);_0x52f993['query']=_[_0x2039('0x22')](_0x53dc08[_0x2039('0x1f')]);_0x52f993[_0x2039('0x2d')]=_[_0x2039('0x7c')](_0x52f993[_0x2039('0x23')],_0x52f993[_0x2039('0x1f')]);_0x561896[_0x2039('0x25')]=_[_0x2039('0x7c')](_0x52f993[_0x2039('0x23')],qs[_0x2039('0x24')](_0x53dc08[_0x2039('0x1f')]['fields']));_0x561896[_0x2039('0x25')]=_0x561896[_0x2039('0x25')][_0x2039('0x26')]?_0x561896['attributes']:_0x52f993[_0x2039('0x23')];if(!_0x53dc08[_0x2039('0x1f')][_0x2039('0x27')](_0x2039('0x28'))){_0x561896[_0x2039('0x29')]=qs['limit'](_0x53dc08[_0x2039('0x1f')][_0x2039('0x29')]);_0x561896[_0x2039('0x15')]=qs[_0x2039('0x15')](_0x53dc08['query'][_0x2039('0x15')]);}_0x561896[_0x2039('0x2a')]=qs[_0x2039('0x2b')](_0x53dc08['query']['sort']);_0x561896['where']=qs[_0x2039('0x2d')](_['pick'](_0x53dc08[_0x2039('0x1f')],_0x52f993['filters']));_0x561896['where'][_0x2039('0x82')]=_0x40b847['id'];if(_0x53dc08['query'][_0x2039('0x30')]){_0x561896[_0x2039('0x2c')]=_[_0x2039('0x31')](_0x561896[_0x2039('0x2c')],{'$or':_[_0x2039('0x6c')](_0x561896['attributes'],function(_0x4ec46d){var _0x5b9179={};_0x5b9179[_0x4ec46d]={'$like':'%'+_0x53dc08[_0x2039('0x1f')][_0x2039('0x30')]+'%'};return _0x5b9179;})});}_0x561896=_[_0x2039('0x31')]({},_0x561896,_0x53dc08[_0x2039('0x32')]);return db[_0x2039('0x49')][_0x2039('0x14')]({'where':_0x561896['where']})['then'](function(_0xf4e991){_0x2f2b9b[_0x2039('0x14')]=_0xf4e991;if(_0x53dc08[_0x2039('0x1f')][_0x2039('0x3a')]){_0x561896['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x561896);})['then'](function(_0x1a0b5){_0x2f2b9b['rows']=_0x1a0b5;return _0x2f2b9b;});}})['then'](respondWithFilteredResult(_0x2e4b23,_0x561896))[_0x2039('0x41')](handleError(_0x2e4b23,null));};exports[_0x2039('0x83')]=function(_0x3968a8,_0x3b530b,_0x12d25e){var _0x54e0ca={'raw':!![],'where':{}};var _0x771bc8={};var _0x40027c={'count':0x0,'rows':[]};return db[_0x2039('0x39')]['findOne']({'where':{'id':_0x3968a8[_0x2039('0x40')]['id']}})['then'](handleEntityNotFound(_0x3b530b,null))[_0x2039('0x1e')](function(_0x29f8b6){if(_0x29f8b6){_0x771bc8[_0x2039('0x23')]=_[_0x2039('0x22')](db['CmHopperHistory']['rawAttributes']);_0x771bc8['query']=_['keys'](_0x3968a8[_0x2039('0x1f')]);_0x771bc8['filters']=_[_0x2039('0x7c')](_0x771bc8[_0x2039('0x23')],_0x771bc8['query']);_0x54e0ca[_0x2039('0x25')]=_[_0x2039('0x7c')](_0x771bc8[_0x2039('0x23')],qs[_0x2039('0x24')](_0x3968a8[_0x2039('0x1f')]['fields']));_0x54e0ca[_0x2039('0x25')]=_0x54e0ca['attributes'][_0x2039('0x26')]?_0x54e0ca['attributes']:_0x771bc8[_0x2039('0x23')];if(!_0x3968a8[_0x2039('0x1f')]['hasOwnProperty'](_0x2039('0x28'))){_0x54e0ca[_0x2039('0x29')]=qs[_0x2039('0x29')](_0x3968a8[_0x2039('0x1f')][_0x2039('0x29')]);_0x54e0ca['offset']=qs[_0x2039('0x15')](_0x3968a8['query'][_0x2039('0x15')]);}_0x54e0ca[_0x2039('0x2a')]=qs['sort'](_0x3968a8['query'][_0x2039('0x2b')]);_0x54e0ca[_0x2039('0x2c')]=qs[_0x2039('0x2d')](_[_0x2039('0x7d')](_0x3968a8[_0x2039('0x1f')],_0x771bc8[_0x2039('0x2d')]));_0x54e0ca[_0x2039('0x2c')][_0x2039('0x82')]=_0x29f8b6['id'];if(_0x3968a8['query'][_0x2039('0x30')]){_0x54e0ca[_0x2039('0x2c')]=_[_0x2039('0x31')](_0x54e0ca[_0x2039('0x2c')],{'$or':_[_0x2039('0x6c')](_0x54e0ca[_0x2039('0x25')],function(_0x1e720f){var _0x4a936d={};_0x4a936d[_0x1e720f]={'$like':'%'+_0x3968a8[_0x2039('0x1f')][_0x2039('0x30')]+'%'};return _0x4a936d;})});}_0x54e0ca=_[_0x2039('0x31')]({},_0x54e0ca,_0x3968a8['options']);return db[_0x2039('0x58')][_0x2039('0x14')]({'where':_0x54e0ca[_0x2039('0x2c')]})[_0x2039('0x1e')](function(_0x126a3e){_0x40027c[_0x2039('0x14')]=_0x126a3e;if(_0x3968a8[_0x2039('0x1f')][_0x2039('0x3a')]){_0x54e0ca['include']=[{'all':!![]}];}return db[_0x2039('0x58')][_0x2039('0x3d')](_0x54e0ca);})[_0x2039('0x1e')](function(_0x4c0751){_0x40027c['rows']=_0x4c0751;return _0x40027c;});}})[_0x2039('0x1e')](respondWithFilteredResult(_0x3b530b,_0x54e0ca))[_0x2039('0x41')](handleError(_0x3b530b,null));};exports['getHopperFinals']=function(_0xaf8318,_0x52d061,_0x5e7165){var _0x131f99={'raw':!![],'where':{}};var _0x1ba96c={};var _0x35815b={'count':0x0,'rows':[]};return db[_0x2039('0x39')]['findOne']({'where':{'id':_0xaf8318[_0x2039('0x40')]['id']}})[_0x2039('0x1e')](handleEntityNotFound(_0x52d061,null))[_0x2039('0x1e')](function(_0x4d6c1f){if(_0x4d6c1f){_0x1ba96c[_0x2039('0x23')]=_['keys'](db['CmHopperFinal'][_0x2039('0x7b')]);_0x1ba96c[_0x2039('0x1f')]=_['keys'](_0xaf8318[_0x2039('0x1f')]);_0x1ba96c[_0x2039('0x2d')]=_[_0x2039('0x7c')](_0x1ba96c['model'],_0x1ba96c[_0x2039('0x1f')]);_0x131f99[_0x2039('0x25')]=_['intersection'](_0x1ba96c[_0x2039('0x23')],qs['fields'](_0xaf8318[_0x2039('0x1f')][_0x2039('0x24')]));_0x131f99[_0x2039('0x25')]=_0x131f99[_0x2039('0x25')]['length']?_0x131f99[_0x2039('0x25')]:_0x1ba96c[_0x2039('0x23')];if(!_0xaf8318[_0x2039('0x1f')][_0x2039('0x27')](_0x2039('0x28'))){_0x131f99[_0x2039('0x29')]=qs['limit'](_0xaf8318['query'][_0x2039('0x29')]);_0x131f99['offset']=qs[_0x2039('0x15')](_0xaf8318['query'][_0x2039('0x15')]);}_0x131f99[_0x2039('0x2a')]=qs[_0x2039('0x2b')](_0xaf8318[_0x2039('0x1f')][_0x2039('0x2b')]);_0x131f99[_0x2039('0x2c')]=qs[_0x2039('0x2d')](_[_0x2039('0x7d')](_0xaf8318[_0x2039('0x1f')],_0x1ba96c[_0x2039('0x2d')]));_0x131f99['where']['ContactId']=_0x4d6c1f['id'];if(_0xaf8318[_0x2039('0x1f')][_0x2039('0x30')]){_0x131f99[_0x2039('0x2c')]=_[_0x2039('0x31')](_0x131f99['where'],{'$or':_[_0x2039('0x6c')](_0x131f99[_0x2039('0x25')],function(_0x6da711){var _0x541766={};_0x541766[_0x6da711]={'$like':'%'+_0xaf8318['query'][_0x2039('0x30')]+'%'};return _0x541766;})});}_0x131f99=_['merge']({},_0x131f99,_0xaf8318[_0x2039('0x32')]);return db[_0x2039('0x57')][_0x2039('0x14')]({'where':_0x131f99[_0x2039('0x2c')]})[_0x2039('0x1e')](function(_0x2b63ae){_0x35815b[_0x2039('0x14')]=_0x2b63ae;if(_0xaf8318[_0x2039('0x1f')][_0x2039('0x3a')]){_0x131f99['include']=[{'all':!![]}];}return db[_0x2039('0x57')][_0x2039('0x3d')](_0x131f99);})[_0x2039('0x1e')](function(_0x177ce6){_0x35815b[_0x2039('0x3e')]=_0x177ce6;return _0x35815b;});}})[_0x2039('0x1e')](respondWithFilteredResult(_0x52d061,_0x131f99))[_0x2039('0x41')](handleError(_0x52d061,null));};exports['getJscriptySessions']=function(_0x2d417c,_0x57a36a,_0x15a63a){var _0x587ef3={'raw':!![],'where':{}};var _0x2b1371={};var _0x102494={'count':0x0,'rows':[]};return db[_0x2039('0x39')][_0x2039('0x7a')]({'where':{'id':_0x2d417c['params']['id']}})['then'](handleEntityNotFound(_0x57a36a,null))['then'](function(_0x1a15f1){if(_0x1a15f1){_0x2b1371[_0x2039('0x23')]=_[_0x2039('0x22')](db[_0x2039('0x5f')][_0x2039('0x7b')]);_0x2b1371['query']=_[_0x2039('0x22')](_0x2d417c[_0x2039('0x1f')]);_0x2b1371['filters']=_[_0x2039('0x7c')](_0x2b1371[_0x2039('0x23')],_0x2b1371[_0x2039('0x1f')]);_0x587ef3[_0x2039('0x25')]=_[_0x2039('0x7c')](_0x2b1371['model'],qs[_0x2039('0x24')](_0x2d417c[_0x2039('0x1f')]['fields']));_0x587ef3[_0x2039('0x25')]=_0x587ef3[_0x2039('0x25')][_0x2039('0x26')]?_0x587ef3[_0x2039('0x25')]:_0x2b1371[_0x2039('0x23')];if(!_0x2d417c[_0x2039('0x1f')][_0x2039('0x27')](_0x2039('0x28'))){_0x587ef3[_0x2039('0x29')]=qs[_0x2039('0x29')](_0x2d417c['query'][_0x2039('0x29')]);_0x587ef3['offset']=qs[_0x2039('0x15')](_0x2d417c['query'][_0x2039('0x15')]);}_0x587ef3['order']=qs[_0x2039('0x2b')](_0x2d417c[_0x2039('0x1f')][_0x2039('0x2b')]);_0x587ef3[_0x2039('0x2c')]=qs['filters'](_[_0x2039('0x7d')](_0x2d417c['query'],_0x2b1371['filters']));_0x587ef3[_0x2039('0x2c')][_0x2039('0x82')]=_0x1a15f1['id'];if(_0x2d417c[_0x2039('0x1f')][_0x2039('0x30')]){_0x587ef3[_0x2039('0x2c')]=_[_0x2039('0x31')](_0x587ef3[_0x2039('0x2c')],{'$or':_[_0x2039('0x6c')](_0x587ef3[_0x2039('0x25')],function(_0x1ce1d9){var _0x3d1dce={};_0x3d1dce[_0x1ce1d9]={'$like':'%'+_0x2d417c[_0x2039('0x1f')][_0x2039('0x30')]+'%'};return _0x3d1dce;})});}_0x587ef3=_['merge']({},_0x587ef3,_0x2d417c['options']);return db[_0x2039('0x5f')][_0x2039('0x14')]({'where':_0x587ef3[_0x2039('0x2c')]})['then'](function(_0x55ad61){_0x102494[_0x2039('0x14')]=_0x55ad61;if(_0x2d417c['query'][_0x2039('0x3a')]){_0x587ef3[_0x2039('0x33')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2039('0x3d')](_0x587ef3);})[_0x2039('0x1e')](function(_0x461b19){_0x102494['rows']=_0x461b19;return _0x102494;});}})['then'](respondWithFilteredResult(_0x57a36a,_0x587ef3))['catch'](handleError(_0x57a36a,null));};exports['uploadCsv']=function(_0x44a915,_0x5cc64d,_0x52d3c5){try{if(!_0x44a915[_0x2039('0x43')][_0x2039('0x65')]){throw new Error(_0x2039('0x84'));}if(!_0x44a915[_0x2039('0x43')][_0x2039('0x85')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x44a915[_0x2039('0x43')][_0x2039('0x86')]){throw new Error(_0x2039('0x87'));}if(!_0x44a915[_0x2039('0x43')][_0x2039('0x88')]){throw new Error(_0x2039('0x89'));}var _0x215a96=_0x44a915['body']['binding_keys']['split'](',');var _0x3eefc7=_0x44a915[_0x2039('0x43')][_0x2039('0x86')][_0x2039('0x8a')](',');if(!_0x215a96[_0x2039('0x26')]||!_0x3eefc7[_0x2039('0x26')]||_0x215a96['length']!==_0x3eefc7[_0x2039('0x26')]){throw new Error(_0x2039('0x8b'));}_0x44a915['body'][_0x2039('0x24')]=_[_0x2039('0x8c')](_0x215a96,_0x3eefc7);if(!_0x44a915[_0x2039('0x43')][_0x2039('0x24')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x44a915['body']['fields'][_0x2039('0x8d')]){throw new Error(_0x2039('0x8e'));}var _0x575707=path[_0x2039('0x60')](config[_0x2039('0x8f')],_0x2039('0x90'),_0x44a915[_0x2039('0x91')][_0x2039('0x92')]);fs[_0x2039('0x93')](_0x575707,parseInt(_0x2039('0x94'),0x8));var _0x30b9f6=require(_0x2039('0x95'))[_0x2039('0x96')](path[_0x2039('0x60')](__dirname,'../../components/import/cm/csv'),[_0x575707,_0x44a915['body'][_0x2039('0x85')],_0x44a915[_0x2039('0x43')]['binding_values'],_0x44a915['body'][_0x2039('0x65')],_0x44a915['body'][_0x2039('0x97')],_0x44a915['body']['duplicates'],_0x44a915['body'][_0x2039('0x88')]]);return _0x5cc64d[_0x2039('0x11')](0xc8)[_0x2039('0x13')]({'message':_0x2039('0x98'),'pid':_0x30b9f6[_0x2039('0x99')]});}catch(_0x2da0f5){return _0x5cc64d[_0x2039('0x11')](0x1f4)[_0x2039('0x1c')](_0x2da0f5);}};exports['upload']=function(_0x44f6c2,_0x254ef8,_0x2feac6){var _0x3d8cd4=fs[_0x2039('0x9a')](_0x44f6c2['file'][_0x2039('0x9b')]);Papa['parse'](_0x3d8cd4,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1a87dc){return _0x254ef8['status'](0xc8)[_0x2039('0x13')]({'file':_0x44f6c2[_0x2039('0x91')],'fields':_0x1a87dc[_0x2039('0x9c')]['fields']});}});};exports['import']=function(_0x13c081,_0x3ff49b,_0xd86dee){return db[_0x2039('0x9d')][_0x2039('0x3d')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x2039('0x1e')](function(_0x2c7c2d){var _0x30a349=![];if(!_0x13c081['body']['ListId']){throw new Error(_0x2039('0x84'));}if(!_0x13c081['body'][_0x2039('0x9e')][_0x2039('0x79')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x13c081[_0x2039('0x43')][_0x2039('0x9e')][_0x2039('0x8d')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x13c081[_0x2039('0x43')][_0x2039('0x88')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0xbb3a27=require('child_process')[_0x2039('0x96')](path[_0x2039('0x60')](__dirname,_0x2039('0x9f')),[_0x13c081[_0x2039('0x40')]['id'],JSON[_0x2039('0xa0')](_0x13c081['body']),JSON[_0x2039('0xa0')](_0x2c7c2d)]);_0xbb3a27['on'](_0x2039('0xa1'),function(_0x4323db){_0x30a349=!![];return _0x3ff49b[_0x2039('0x11')](0xc8)['json']({'message':_0x2039('0xa2'),'pid':_0xbb3a27['pid']});});_0xbb3a27['on'](_0x2039('0xa3'),function(_0x3c0c52){if(_0x3c0c52&&!_0x30a349){return _0x3ff49b[_0x2039('0x11')](0x1f4)[_0x2039('0x13')]({'message':_0x2039('0xa4'),'pid':_0xbb3a27[_0x2039('0x99')]});}});})[_0x2039('0x41')](handleError(_0x3ff49b,null));}; \ No newline at end of file +var _0x451c=['setFields','toParam','sequelize','text','values','CmHopper','phone','findOne','getTags','hasOwnProperty','nolimit','setTags','ids','rawAttributes','ContactId','CmHopperHistory','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','join','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','import','User','No\x20ListId\x20specified','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','socket.io-emitter','localhost','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmContact','describe','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','add','day','merge','filter','map','options','include','tag','push','Tag','distinct','includeAll','ThroughTags','findAll','rows','find','catch','body','from','get','mergeWith','tags','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','OpenchannelMessage','VoiceCallReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','ListId','findOrCreate','spread','show','params','Tags','color','$and','CmCustomField','omit','format','cf_%d','cf_','table','cm_contacts'];(function(_0x2a26a8,_0xd6b224){var _0x25b98b=function(_0x3b1905){while(--_0x3b1905){_0x2a26a8['push'](_0x2a26a8['shift']());}};_0x25b98b(++_0xd6b224);}(_0x451c,0xe2));var _0xc451=function(_0x56bd6a,_0xb544ce){_0x56bd6a=_0x56bd6a-0x0;var _0x1a223b=_0x451c[_0x56bd6a];return _0x1a223b;};'use strict';var jsonpatch=require(_0xc451('0x0'));var rp=require(_0xc451('0x1'));var moment=require(_0xc451('0x2'));var BPromise=require(_0xc451('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc451('0x4'));var sox=require(_0xc451('0x5'));var csv=require(_0xc451('0x6'));var ejs=require(_0xc451('0x7'));var fs=require('fs');var _=require(_0xc451('0x8'));var squel=require(_0xc451('0x9'));var crypto=require(_0xc451('0xa'));var jsforce=require(_0xc451('0xb'));var deskjs=require(_0xc451('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc451('0xd'));var qs=require(_0xc451('0xe'));var logger=require(_0xc451('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xc451('0x10'));var db=require('../../mysqldb')['db'];var socket=require(_0xc451('0x11'))({'host':_0xc451('0x12'),'port':0x18eb});require('./cmContact.socket')[_0xc451('0x13')](socket);function respondWithStatusCode(_0x13917f,_0x2fb6b2){_0x2fb6b2=_0x2fb6b2||0xcc;return function(_0x4bb924){if(_0x4bb924){return _0x13917f[_0xc451('0x14')](_0x2fb6b2);}return _0x13917f[_0xc451('0x15')](_0x2fb6b2)[_0xc451('0x16')]();};}function respondWithResult(_0x55caea,_0x32a31c){_0x32a31c=_0x32a31c||0xc8;return function(_0x343411){if(_0x343411){return _0x55caea[_0xc451('0x15')](_0x32a31c)['json'](_0x343411);}};}function respondWithFilteredResult(_0x48cabf,_0x23fccb){return function(_0x3ef85f){if(_0x3ef85f){var _0x22d489=_0x3ef85f[_0xc451('0x17')],_0x42b7eb=_0x23fccb[_0xc451('0x18')],_0x1f9d25=_0x23fccb[_0xc451('0x18')]+_0x23fccb['limit'],_0x1d6d83;if(_0x1f9d25>=_0x22d489){_0x1f9d25=_0x22d489;_0x1d6d83=0xc8;}else{_0x1d6d83=0xce;}_0x48cabf[_0xc451('0x15')](_0x1d6d83);return _0x48cabf[_0xc451('0x19')](_0xc451('0x1a'),_0x42b7eb+'-'+_0x1f9d25+'/'+_0x22d489)[_0xc451('0x1b')](_0x3ef85f);}return null;};}function patchUpdates(_0x45bb77){return function(_0x4c305f){try{jsonpatch[_0xc451('0x1c')](_0x4c305f,_0x45bb77,!![]);}catch(_0x544dd1){return BPromise[_0xc451('0x1d')](_0x544dd1);}return _0x4c305f[_0xc451('0x1e')]();};}function saveUpdates(_0x1124c7,_0x5bff09){return function(_0x421d6b){if(_0x421d6b){return _0x421d6b[_0xc451('0x1f')](_0x1124c7)[_0xc451('0x20')](function(_0x1dd5f1){return _0x1dd5f1;});}return null;};}function removeEntity(_0x446613,_0x12db14){return function(_0x16c18d){if(_0x16c18d){return _0x16c18d[_0xc451('0x21')]()[_0xc451('0x20')](function(){_0x446613[_0xc451('0x15')](0xcc)[_0xc451('0x16')]();});}};}function handleEntityNotFound(_0x4cebe6,_0x34d136){return function(_0x4afe8f){if(!_0x4afe8f){_0x4cebe6[_0xc451('0x14')](0x194);}return _0x4afe8f;};}function handleError(_0x177515,_0x5901c7){_0x5901c7=_0x5901c7||0x1f4;return function(_0x7c60c9){logger[_0xc451('0x22')](_0x7c60c9[_0xc451('0x23')]);if(_0x7c60c9[_0xc451('0x24')]){delete _0x7c60c9[_0xc451('0x24')];}_0x177515['status'](_0x5901c7)[_0xc451('0x25')](_0x7c60c9);};}exports[_0xc451('0x26')]=function(_0x77e634,_0x7eb0ed){var _0x13e99c={},_0x3e6704={},_0x39b993={'count':0x0,'rows':[]};return db[_0xc451('0x27')][_0xc451('0x28')]()['then'](function(_0x2fafdc){_0x3e6704[_0xc451('0x29')]=_[_0xc451('0x2a')](_0x2fafdc);var _0x340ec9={'dateStart':_0x77e634[_0xc451('0x2b')][_0xc451('0x2c')],'dateEnd':_0x77e634[_0xc451('0x2b')][_0xc451('0x2d')]};delete _0x77e634[_0xc451('0x2b')][_0xc451('0x2c')];delete _0x77e634[_0xc451('0x2b')][_0xc451('0x2d')];_0x3e6704[_0xc451('0x2b')]=_[_0xc451('0x2a')](_0x77e634[_0xc451('0x2b')]);_0x3e6704[_0xc451('0x2e')]=_[_0xc451('0x2f')](_0x3e6704[_0xc451('0x29')],_0x3e6704['query']);_0x13e99c[_0xc451('0x30')]=_[_0xc451('0x2f')](_0x3e6704[_0xc451('0x29')],qs[_0xc451('0x31')](_0x77e634[_0xc451('0x2b')][_0xc451('0x31')]));_0x13e99c[_0xc451('0x30')]=_0x13e99c['attributes'][_0xc451('0x32')]?_0x13e99c[_0xc451('0x30')]:_0x3e6704[_0xc451('0x29')];if(!_0x77e634[_0xc451('0x2b')]['hasOwnProperty']('nolimit')){_0x13e99c[_0xc451('0x33')]=qs[_0xc451('0x33')](_0x77e634[_0xc451('0x2b')][_0xc451('0x33')]);_0x13e99c[_0xc451('0x18')]=qs[_0xc451('0x18')](_0x77e634['query'][_0xc451('0x18')]);}_0x13e99c[_0xc451('0x34')]=qs['sort'](_0x77e634[_0xc451('0x2b')][_0xc451('0x35')]);_0x13e99c[_0xc451('0x36')]=qs['filters'](_[_0xc451('0x37')](_0x77e634[_0xc451('0x2b')],_0x3e6704[_0xc451('0x2e')]));if(_0x340ec9['dateStart']){if(_0x340ec9[_0xc451('0x2d')]){_0x340ec9[_0xc451('0x2d')]=moment(_0x340ec9[_0xc451('0x2d')])[_0xc451('0x38')](0x1,_0xc451('0x39'));}else{_0x340ec9['dateEnd']=moment(_0x340ec9[_0xc451('0x2c')])[_0xc451('0x38')](0x1,_0xc451('0x39'));}_[_0xc451('0x3a')](_0x13e99c[_0xc451('0x36')],{'createdAt':{'$gte':_0x340ec9[_0xc451('0x2c')],'$lte':_0x340ec9[_0xc451('0x2d')]}});}if(_0x77e634['query'][_0xc451('0x3b')]){_0x13e99c[_0xc451('0x36')]=_['merge'](_0x13e99c[_0xc451('0x36')],{'$or':_[_0xc451('0x3c')](_0x13e99c[_0xc451('0x30')],function(_0x2c6083){var _0x25e2e5={};_0x25e2e5[_0x2c6083]={'$like':'%'+_0x77e634[_0xc451('0x2b')][_0xc451('0x3b')]+'%'};return _0x25e2e5;})});}_0x13e99c=_[_0xc451('0x3a')]({},_0x13e99c,_0x77e634[_0xc451('0x3d')]);var _0x1ab347={'where':_0x13e99c[_0xc451('0x36')]};_0x1ab347[_0xc451('0x3e')]=[];if(_0x77e634['query'][_0xc451('0x3f')]){_0x1ab347[_0xc451('0x3e')][_0xc451('0x40')]({'model':db[_0xc451('0x41')],'as':'Tags','attributes':['id'],'where':{'id':_0x77e634[_0xc451('0x2b')][_0xc451('0x3f')]},'required':!![]});_0x1ab347[_0xc451('0x42')]=!![];}return db[_0xc451('0x27')][_0xc451('0x17')](_0x1ab347)[_0xc451('0x20')](function(_0x2f4c37){_0x39b993[_0xc451('0x17')]=_0x2f4c37;if(_0x77e634[_0xc451('0x2b')][_0xc451('0x43')]){_0x13e99c[_0xc451('0x3e')]=[{'model':db[_0xc451('0x41')],'as':'Tags','attributes':['id',_0xc451('0x24'),'color'],'required':_0x77e634['query'][_0xc451('0x3f')]?!![]:![]},{'model':db[_0xc451('0x41')],'as':_0xc451('0x44'),'attributes':['id',_0xc451('0x24'),'color'],'through':_0x77e634['query'][_0xc451('0x3f')]?{'attributes':[],'where':{'TagId':_0x77e634[_0xc451('0x2b')]['tag']||undefined}}:{},'required':_0x77e634[_0xc451('0x2b')][_0xc451('0x3f')]?!![]:![]}];}return db['CmContact'][_0xc451('0x45')](_0x13e99c);})['then'](function(_0x45de73){_0x39b993[_0xc451('0x46')]=_0x45de73;return _0x39b993;})[_0xc451('0x20')](respondWithFilteredResult(_0x7eb0ed,_0x13e99c))['catch'](handleError(_0x7eb0ed,null));});};exports[_0xc451('0x21')]=function(_0x4134f4,_0x726586){return db[_0xc451('0x27')][_0xc451('0x47')]({'where':{'id':_0x4134f4['params']['id']}})[_0xc451('0x20')](handleEntityNotFound(_0x726586,null))[_0xc451('0x20')](removeEntity(_0x726586,null))['catch'](handleError(_0x726586,null));};exports[_0xc451('0x28')]=function(_0x1cb666,_0x3c0a62){return db['CmContact'][_0xc451('0x28')]()['then'](respondWithResult(_0x3c0a62,null))[_0xc451('0x48')](handleError(_0x3c0a62,null));};exports[_0xc451('0x3a')]=function(_0x4225ce,_0x9b6557){var _0x5ad238;var _0x48e7a6;var _0x4eb38d;if(_0x4225ce[_0xc451('0x49')]['id']){delete _0x4225ce[_0xc451('0x49')]['id'];}return db[_0xc451('0x27')][_0xc451('0x45')]({'where':{'id':[_0x4225ce['body']['to'],_0x4225ce[_0xc451('0x49')][_0xc451('0x4a')]]}})[_0xc451('0x20')](function(_0x1726ec){if(_0x1726ec){if(_0x1726ec[_0xc451('0x32')]!==0x2){return null;}_0x1726ec[0x0]=_0x1726ec[0x0][_0xc451('0x4b')]({'plain':!![]});_0x1726ec[0x1]=_0x1726ec[0x1][_0xc451('0x4b')]({'plain':!![]});delete _0x1726ec[0x0]['id'];delete _0x1726ec[0x1]['id'];return _[_0xc451('0x4c')](_0x1726ec[0x0],_0x1726ec[0x1],function(_0x4b3275,_0x559d2b){if(Array['isArray'](_0x559d2b)&&!_0x559d2b['length']){return _0x4b3275;}else if(!_0x559d2b){return _0x4b3275;}});}})[_0xc451('0x20')](handleEntityNotFound(_0x9b6557,null))[_0xc451('0x20')](function(_0x3ae40b){if(_0x3ae40b){if(_0x3ae40b[_0xc451('0x4d')]&&_[_0xc451('0x4e')](_0x3ae40b[_0xc451('0x4d')])){_0x3ae40b[_0xc451('0x4d')]=_0x3ae40b[_0xc451('0x4d')]['join']();}logger['info'](_0xc451('0x4f'),_0x4225ce[_0xc451('0x49')]['to'],_0x4225ce[_0xc451('0x49')][_0xc451('0x4a')]);return db['CmHopper'][_0xc451('0x21')]({'where':{'ContactId':[_0x4225ce[_0xc451('0x49')]['to'],_0x4225ce[_0xc451('0x49')]['from']]}})[_0xc451('0x20')](function(_0x363329){logger[_0xc451('0x50')](_0xc451('0x51'),_0x363329);return db['CmHopperBlack'][_0xc451('0x21')]({'where':{'ContactId':[_0x4225ce[_0xc451('0x49')]['to'],_0x4225ce['body'][_0xc451('0x4a')]]}})[_0xc451('0x20')](function(_0x2d8d7f){logger[_0xc451('0x50')](_0xc451('0x52'),_0x2d8d7f);return db[_0xc451('0x27')][_0xc451('0x53')](_0x3ae40b);});});}})['then'](function(_0x1eb5b4){if(_0x1eb5b4){_0x5ad238=_0x1eb5b4;_0x48e7a6={'ContactId':_0x5ad238['id']};_0x4eb38d={'where':{'ContactId':[_0x4225ce['body']['to'],_0x4225ce[_0xc451('0x49')]['from']]}};return db[_0xc451('0x54')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db[_0xc451('0x55')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db[_0xc451('0x56')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db[_0xc451('0x57')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db[_0xc451('0x58')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db['MailInteraction'][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db[_0xc451('0x58')]['update'](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db[_0xc451('0x59')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db['SmsMessage'][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db[_0xc451('0x5a')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db['FaxMessage'][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db['OpenchannelInteraction'][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db[_0xc451('0x5b')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db['CmHopperFinal'][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db['CmHopperHistory'][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db['ReportAgentPreview']['update'](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db[_0xc451('0x5c')]['update'](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db['ChatQueueReport'][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db[_0xc451('0x5d')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db['MailQueueReport'][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db[_0xc451('0x5e')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})[_0xc451('0x20')](function(){if(_0x5ad238){return db[_0xc451('0x5f')][_0xc451('0x1f')](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db[_0xc451('0x60')]['update'](_0x48e7a6,_0x4eb38d);}})['then'](function(){if(_0x5ad238){return db[_0xc451('0x27')][_0xc451('0x21')]({'where':{'id':[_0x4225ce['body']['to'],_0x4225ce[_0xc451('0x49')][_0xc451('0x4a')]]}});}})['then'](function(){if(_0x5ad238){return _0x5ad238;}})[_0xc451('0x20')](respondWithResult(_0x9b6557,null))[_0xc451('0x48')](handleError(_0x9b6557,null));};exports['create']=function(_0x319a3f,_0x585e57){return db[_0xc451('0x27')][_0xc451('0x28')]()[_0xc451('0x20')](function(_0x8f26d9){if(_0x319a3f[_0xc451('0x49')]['tags']&&_[_0xc451('0x4e')](_0x319a3f[_0xc451('0x49')]['tags'])){if(_0x319a3f[_0xc451('0x49')][_0xc451('0x4d')][_0xc451('0x32')]){_0x319a3f[_0xc451('0x49')][_0xc451('0x4d')]=_0x319a3f['body'][_0xc451('0x4d')]['join'](';')+';';}else{_0x319a3f[_0xc451('0x49')][_0xc451('0x4d')]=null;}}else{_0x319a3f[_0xc451('0x49')][_0xc451('0x4d')]=null;}return db[_0xc451('0x27')][_0xc451('0x53')](_0x319a3f[_0xc451('0x49')],{'fields':_[_0xc451('0x2a')](_0x8f26d9),'raw':!![]});})[_0xc451('0x20')](respondWithResult(_0x585e57,0xc9))[_0xc451('0x48')](handleError(_0x585e57,null));};exports[_0xc451('0x61')]=function(_0x24376c,_0xe11dcf){var _0x23e96e=[];var _0xae81ba=0x0;var _0x1d5b7a=0x0;var _0x1786b3=0x0;return db[_0xc451('0x27')][_0xc451('0x28')]()['then'](function(_0x3a1679){return BPromise[_0xc451('0x62')](_0x24376c['body'],function(_0x38335b){var _0x459abb={'where':{'$or':[]},'defaults':_0x38335b,'fields':_[_0xc451('0x2a')](_0x3a1679),'raw':!![]};if(_0x38335b[_0xc451('0x63')]){for(var _0x3119ad=0x0;_0x3119ad<_0x38335b['duplicates']['length'];_0x3119ad++){var _0x2d6ada={};_0x2d6ada[_0x38335b['duplicates'][_0x3119ad]]=_0x38335b[_0x38335b[_0xc451('0x63')][_0x3119ad]];_0x459abb[_0xc451('0x36')][_0xc451('0x64')]['push'](_0x2d6ada);}_0x459abb[_0xc451('0x36')][_0xc451('0x65')]=_0x38335b[_0xc451('0x65')];}return db[_0xc451('0x27')][_0xc451('0x66')](_0x459abb)[_0xc451('0x67')](function(_0x5182d8,_0x1ff9a2){if(_0x1ff9a2){_0xae81ba++;}else{_0x1786b3++;}})['catch'](function(_0xcc9323){console[_0xc451('0x22')](_0xcc9323);_0x1d5b7a++;});});})[_0xc451('0x20')](function(_0x151e73){if(_0x151e73){return{'success':_0xae81ba,'failure':_0x1d5b7a,'duplicates':_0x1786b3};}})[_0xc451('0x20')](respondWithResult(_0xe11dcf,0xc9))[_0xc451('0x48')](handleError(_0xe11dcf,null));};exports[_0xc451('0x68')]=function(_0x559582,_0x1c1ebc,_0x44c02c){var _0x368cae;return db[_0xc451('0x27')]['describe']()[_0xc451('0x20')](function(_0x29cfe1){return db[_0xc451('0x27')][_0xc451('0x47')]({'where':{'id':_0x559582[_0xc451('0x69')]['id']},'include':[{'model':db['Tag'],'as':_0xc451('0x6a'),'attributes':['id',_0xc451('0x24'),_0xc451('0x6b')],'required':_0x559582[_0xc451('0x2b')][_0xc451('0x3f')]?!![]:![]}],'attributes':_[_0xc451('0x2a')](_0x29cfe1)});})[_0xc451('0x20')](function(_0x556a9d){_0x368cae=_0x556a9d[_0xc451('0x4b')]({'plain':!![]});var _0x5a5563={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x556a9d&&_0x556a9d['ListId']){if(_0x556a9d[_0xc451('0x65')]){_0x5a5563[_0xc451('0x36')][_0xc451('0x6c')][_0xc451('0x40')]({'ListId':{'$ne':_0x556a9d[_0xc451('0x65')]}});}}return db[_0xc451('0x6d')][_0xc451('0x45')](_0x5a5563);})[_0xc451('0x20')](function(_0x489a60){return _[_0xc451('0x6e')](_0x368cae,_['map'](_0x489a60,function(_0x37f7eb){return util[_0xc451('0x6f')](_0xc451('0x70'),_0x37f7eb['id']);}));})[_0xc451('0x20')](handleEntityNotFound(_0x1c1ebc,null))[_0xc451('0x20')](respondWithResult(_0x1c1ebc,null))[_0xc451('0x48')](handleError(_0x1c1ebc,null));};exports[_0xc451('0x1f')]=function(_0x1e8a11,_0x57e955){var _0x21c161;if(_0x1e8a11['body']['id']){delete _0x1e8a11[_0xc451('0x49')]['id'];}return db[_0xc451('0x27')][_0xc451('0x47')]({'where':{'id':_0x1e8a11[_0xc451('0x69')]['id']}})[_0xc451('0x20')](handleEntityNotFound(_0x57e955,null))['then'](saveUpdates(_0x1e8a11[_0xc451('0x49')],null))[_0xc451('0x20')](function(_0x426d47){_0x21c161=_0x426d47;var _0x262023={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x426d47&&_0x426d47[_0xc451('0x65')]){if(_0x426d47[_0xc451('0x65')]){_0x262023[_0xc451('0x36')][_0xc451('0x6c')][_0xc451('0x40')]({'ListId':{'$ne':_0x426d47[_0xc451('0x65')]}});}}return db['CmCustomField']['findAll'](_0x262023);})[_0xc451('0x20')](function(_0x209d39){if(_0x209d39){return _[_0xc451('0x6e')](_['pickBy'](_0x1e8a11[_0xc451('0x49')],function(_0xdfcbc8,_0x1848e6){return _['startsWith'](_0x1848e6,_0xc451('0x71'));}),_[_0xc451('0x3c')](_0x209d39,function(_0x576162){return util[_0xc451('0x6f')](_0xc451('0x70'),_0x576162['id']);}));}})[_0xc451('0x20')](function(_0x47544f){if(_0x47544f&&!_['isEmpty'](_0x47544f)){var _0x4fddb2=squel[_0xc451('0x1f')]()[_0xc451('0x72')](_0xc451('0x73'))[_0xc451('0x74')](_0x47544f)[_0xc451('0x36')]('id\x20=\x20?',_0x1e8a11[_0xc451('0x69')]['id'])[_0xc451('0x75')]();return db[_0xc451('0x76')]['query'](_0x4fddb2[_0xc451('0x77')],{'replacements':_0x4fddb2[_0xc451('0x78')]});}})[_0xc451('0x20')](function(){if(_0x1e8a11['body']['phone']&&_0x21c161){return db[_0xc451('0x79')][_0xc451('0x1f')]({'phone':_0x1e8a11[_0xc451('0x49')][_0xc451('0x7a')]},{'where':{'ContactId':_0x21c161['id']}});}})[_0xc451('0x20')](function(){return _0x21c161;})[_0xc451('0x20')](respondWithResult(_0x57e955,null))[_0xc451('0x48')](handleError(_0x57e955,null));};exports['getTags']=function(_0x319d88,_0x3a5aa8,_0x711834){var _0x447bd4={};var _0x2a5020={};var _0x4baae2;var _0x32ee7f;return db[_0xc451('0x27')][_0xc451('0x7b')]({'where':{'id':_0x319d88[_0xc451('0x69')]['id']}})['then'](handleEntityNotFound(_0x3a5aa8,null))[_0xc451('0x20')](function(_0x472ad5){if(_0x472ad5){_0x4baae2=_0x472ad5;_0x2a5020['model']=_[_0xc451('0x2a')](db[_0xc451('0x41')]['rawAttributes']);_0x2a5020[_0xc451('0x2b')]=_[_0xc451('0x2a')](_0x319d88['query']);_0x2a5020[_0xc451('0x2e')]=_[_0xc451('0x2f')](_0x2a5020['model'],_0x2a5020[_0xc451('0x2b')]);_0x447bd4['attributes']=_[_0xc451('0x2f')](_0x2a5020[_0xc451('0x29')],qs[_0xc451('0x31')](_0x319d88[_0xc451('0x2b')][_0xc451('0x31')]));_0x447bd4[_0xc451('0x30')]=_0x447bd4[_0xc451('0x30')]['length']?_0x447bd4['attributes']:_0x2a5020[_0xc451('0x29')];_0x447bd4[_0xc451('0x34')]=qs[_0xc451('0x35')](_0x319d88['query'][_0xc451('0x35')]);_0x447bd4[_0xc451('0x36')]=qs[_0xc451('0x2e')](_['pick'](_0x319d88[_0xc451('0x2b')],_0x2a5020[_0xc451('0x2e')]));if(_0x319d88['query']['filter']){_0x447bd4[_0xc451('0x36')]=_[_0xc451('0x3a')](_0x447bd4[_0xc451('0x36')],{'$or':_[_0xc451('0x3c')](_0x447bd4['attributes'],function(_0x20a117){var _0x2ed55a={};_0x2ed55a[_0x20a117]={'$like':'%'+_0x319d88[_0xc451('0x2b')]['filter']+'%'};return _0x2ed55a;})});}_0x447bd4=_[_0xc451('0x3a')]({},_0x447bd4,_0x319d88[_0xc451('0x3d')]);return _0x4baae2[_0xc451('0x7c')](_0x447bd4);}})[_0xc451('0x20')](function(_0x5d27b7){if(_0x5d27b7){_0x32ee7f=_0x5d27b7['length'];if(!_0x319d88[_0xc451('0x2b')][_0xc451('0x7d')](_0xc451('0x7e'))){_0x447bd4['limit']=qs['limit'](_0x319d88[_0xc451('0x2b')]['limit']);_0x447bd4[_0xc451('0x18')]=qs[_0xc451('0x18')](_0x319d88[_0xc451('0x2b')][_0xc451('0x18')]);}return _0x4baae2[_0xc451('0x7c')](_0x447bd4);}})[_0xc451('0x20')](function(_0x343277){if(_0x343277){return _0x343277?{'count':_0x32ee7f,'rows':_0x343277}:null;}})['then'](respondWithResult(_0x3a5aa8,null))[_0xc451('0x48')](handleError(_0x3a5aa8,null));};exports[_0xc451('0x7f')]=function(_0x19c840,_0x568193,_0x12452d){if(_0x19c840[_0xc451('0x49')]['id']){delete _0x19c840[_0xc451('0x49')]['id'];}return db[_0xc451('0x27')][_0xc451('0x7b')]({'where':{'id':_0x19c840[_0xc451('0x69')]['id']}})[_0xc451('0x20')](handleEntityNotFound(_0x568193,null))[_0xc451('0x20')](function(_0x46c791){if(_0x46c791){return _0x46c791[_0xc451('0x7f')](_0x19c840['body'][_0xc451('0x80')]||[]);}return null;})[_0xc451('0x20')](respondWithResult(_0x568193,null))['catch'](handleError(_0x568193,null));};exports['getHoppers']=function(_0x5790e1,_0x48745d,_0x4bb74d){var _0xe8c67c={'raw':![],'where':{}};var _0x5f21fb={};var _0x257475={'count':0x0,'rows':[]};return db[_0xc451('0x27')]['findOne']({'where':{'id':_0x5790e1['params']['id']}})['then'](handleEntityNotFound(_0x48745d,null))['then'](function(_0x307fce){if(_0x307fce){_0x5f21fb[_0xc451('0x29')]=_['keys'](db['CmHopper'][_0xc451('0x81')]);_0x5f21fb[_0xc451('0x2b')]=_['keys'](_0x5790e1[_0xc451('0x2b')]);_0x5f21fb[_0xc451('0x2e')]=_[_0xc451('0x2f')](_0x5f21fb[_0xc451('0x29')],_0x5f21fb['query']);_0xe8c67c[_0xc451('0x30')]=_['intersection'](_0x5f21fb[_0xc451('0x29')],qs['fields'](_0x5790e1[_0xc451('0x2b')]['fields']));_0xe8c67c[_0xc451('0x30')]=_0xe8c67c[_0xc451('0x30')][_0xc451('0x32')]?_0xe8c67c[_0xc451('0x30')]:_0x5f21fb[_0xc451('0x29')];if(!_0x5790e1[_0xc451('0x2b')][_0xc451('0x7d')]('nolimit')){_0xe8c67c['limit']=qs['limit'](_0x5790e1['query'][_0xc451('0x33')]);_0xe8c67c[_0xc451('0x18')]=qs[_0xc451('0x18')](_0x5790e1[_0xc451('0x2b')][_0xc451('0x18')]);}_0xe8c67c[_0xc451('0x34')]=qs['sort'](_0x5790e1[_0xc451('0x2b')][_0xc451('0x35')]);_0xe8c67c['where']=qs[_0xc451('0x2e')](_[_0xc451('0x37')](_0x5790e1[_0xc451('0x2b')],_0x5f21fb['filters']));_0xe8c67c[_0xc451('0x36')][_0xc451('0x82')]=_0x307fce['id'];if(_0x5790e1['query'][_0xc451('0x3b')]){_0xe8c67c[_0xc451('0x36')]=_[_0xc451('0x3a')](_0xe8c67c['where'],{'$or':_['map'](_0xe8c67c[_0xc451('0x30')],function(_0x78599){var _0xe5862f={};_0xe5862f[_0x78599]={'$like':'%'+_0x5790e1['query']['filter']+'%'};return _0xe5862f;})});}_0xe8c67c=_[_0xc451('0x3a')]({},_0xe8c67c,_0x5790e1[_0xc451('0x3d')]);return db['CmHopper'][_0xc451('0x17')]({'where':_0xe8c67c[_0xc451('0x36')]})[_0xc451('0x20')](function(_0x2e341f){_0x257475[_0xc451('0x17')]=_0x2e341f;if(_0x5790e1[_0xc451('0x2b')]['includeAll']){_0xe8c67c[_0xc451('0x3e')]=[{'all':!![]}];}return db[_0xc451('0x79')]['findAll'](_0xe8c67c);})[_0xc451('0x20')](function(_0x501d62){_0x257475[_0xc451('0x46')]=_0x501d62;return _0x257475;});}})[_0xc451('0x20')](respondWithFilteredResult(_0x48745d,_0xe8c67c))['catch'](handleError(_0x48745d,null));};exports['getHopperHistories']=function(_0x53aaf5,_0x55c89c,_0x24ed7e){var _0x4a0853={'raw':!![],'where':{}};var _0x30c428={};var _0x1a821b={'count':0x0,'rows':[]};return db[_0xc451('0x27')][_0xc451('0x7b')]({'where':{'id':_0x53aaf5[_0xc451('0x69')]['id']}})[_0xc451('0x20')](handleEntityNotFound(_0x55c89c,null))[_0xc451('0x20')](function(_0x50792a){if(_0x50792a){_0x30c428['model']=_[_0xc451('0x2a')](db[_0xc451('0x83')][_0xc451('0x81')]);_0x30c428['query']=_[_0xc451('0x2a')](_0x53aaf5[_0xc451('0x2b')]);_0x30c428[_0xc451('0x2e')]=_[_0xc451('0x2f')](_0x30c428[_0xc451('0x29')],_0x30c428[_0xc451('0x2b')]);_0x4a0853['attributes']=_[_0xc451('0x2f')](_0x30c428[_0xc451('0x29')],qs[_0xc451('0x31')](_0x53aaf5[_0xc451('0x2b')][_0xc451('0x31')]));_0x4a0853[_0xc451('0x30')]=_0x4a0853[_0xc451('0x30')]['length']?_0x4a0853[_0xc451('0x30')]:_0x30c428[_0xc451('0x29')];if(!_0x53aaf5[_0xc451('0x2b')][_0xc451('0x7d')]('nolimit')){_0x4a0853[_0xc451('0x33')]=qs[_0xc451('0x33')](_0x53aaf5[_0xc451('0x2b')][_0xc451('0x33')]);_0x4a0853[_0xc451('0x18')]=qs[_0xc451('0x18')](_0x53aaf5[_0xc451('0x2b')][_0xc451('0x18')]);}_0x4a0853[_0xc451('0x34')]=qs[_0xc451('0x35')](_0x53aaf5[_0xc451('0x2b')][_0xc451('0x35')]);_0x4a0853[_0xc451('0x36')]=qs['filters'](_[_0xc451('0x37')](_0x53aaf5[_0xc451('0x2b')],_0x30c428[_0xc451('0x2e')]));_0x4a0853['where'][_0xc451('0x82')]=_0x50792a['id'];if(_0x53aaf5[_0xc451('0x2b')][_0xc451('0x3b')]){_0x4a0853[_0xc451('0x36')]=_['merge'](_0x4a0853['where'],{'$or':_[_0xc451('0x3c')](_0x4a0853['attributes'],function(_0xdbcc63){var _0x244f17={};_0x244f17[_0xdbcc63]={'$like':'%'+_0x53aaf5[_0xc451('0x2b')][_0xc451('0x3b')]+'%'};return _0x244f17;})});}_0x4a0853=_['merge']({},_0x4a0853,_0x53aaf5[_0xc451('0x3d')]);return db[_0xc451('0x83')][_0xc451('0x17')]({'where':_0x4a0853[_0xc451('0x36')]})[_0xc451('0x20')](function(_0xf33be8){_0x1a821b[_0xc451('0x17')]=_0xf33be8;if(_0x53aaf5[_0xc451('0x2b')][_0xc451('0x43')]){_0x4a0853[_0xc451('0x3e')]=[{'all':!![]}];}return db[_0xc451('0x83')][_0xc451('0x45')](_0x4a0853);})[_0xc451('0x20')](function(_0x422a37){_0x1a821b[_0xc451('0x46')]=_0x422a37;return _0x1a821b;});}})[_0xc451('0x20')](respondWithFilteredResult(_0x55c89c,_0x4a0853))[_0xc451('0x48')](handleError(_0x55c89c,null));};exports[_0xc451('0x84')]=function(_0x3e1b64,_0x28c035,_0x57bed2){var _0x12b935={'raw':!![],'where':{}};var _0x58b291={};var _0x470b4e={'count':0x0,'rows':[]};return db[_0xc451('0x27')][_0xc451('0x7b')]({'where':{'id':_0x3e1b64[_0xc451('0x69')]['id']}})[_0xc451('0x20')](handleEntityNotFound(_0x28c035,null))['then'](function(_0x199e5c){if(_0x199e5c){_0x58b291[_0xc451('0x29')]=_[_0xc451('0x2a')](db[_0xc451('0x85')][_0xc451('0x81')]);_0x58b291['query']=_[_0xc451('0x2a')](_0x3e1b64[_0xc451('0x2b')]);_0x58b291[_0xc451('0x2e')]=_[_0xc451('0x2f')](_0x58b291['model'],_0x58b291['query']);_0x12b935[_0xc451('0x30')]=_[_0xc451('0x2f')](_0x58b291[_0xc451('0x29')],qs['fields'](_0x3e1b64[_0xc451('0x2b')][_0xc451('0x31')]));_0x12b935[_0xc451('0x30')]=_0x12b935[_0xc451('0x30')][_0xc451('0x32')]?_0x12b935[_0xc451('0x30')]:_0x58b291[_0xc451('0x29')];if(!_0x3e1b64[_0xc451('0x2b')]['hasOwnProperty']('nolimit')){_0x12b935[_0xc451('0x33')]=qs['limit'](_0x3e1b64[_0xc451('0x2b')][_0xc451('0x33')]);_0x12b935['offset']=qs[_0xc451('0x18')](_0x3e1b64[_0xc451('0x2b')]['offset']);}_0x12b935[_0xc451('0x34')]=qs['sort'](_0x3e1b64['query'][_0xc451('0x35')]);_0x12b935[_0xc451('0x36')]=qs['filters'](_[_0xc451('0x37')](_0x3e1b64['query'],_0x58b291[_0xc451('0x2e')]));_0x12b935['where'][_0xc451('0x82')]=_0x199e5c['id'];if(_0x3e1b64['query'][_0xc451('0x3b')]){_0x12b935[_0xc451('0x36')]=_['merge'](_0x12b935[_0xc451('0x36')],{'$or':_[_0xc451('0x3c')](_0x12b935[_0xc451('0x30')],function(_0x228209){var _0x34f374={};_0x34f374[_0x228209]={'$like':'%'+_0x3e1b64[_0xc451('0x2b')][_0xc451('0x3b')]+'%'};return _0x34f374;})});}_0x12b935=_[_0xc451('0x3a')]({},_0x12b935,_0x3e1b64[_0xc451('0x3d')]);return db[_0xc451('0x85')][_0xc451('0x17')]({'where':_0x12b935['where']})[_0xc451('0x20')](function(_0x33bc50){_0x470b4e[_0xc451('0x17')]=_0x33bc50;if(_0x3e1b64[_0xc451('0x2b')][_0xc451('0x43')]){_0x12b935['include']=[{'all':!![]}];}return db[_0xc451('0x85')][_0xc451('0x45')](_0x12b935);})[_0xc451('0x20')](function(_0xb823dd){_0x470b4e[_0xc451('0x46')]=_0xb823dd;return _0x470b4e;});}})[_0xc451('0x20')](respondWithFilteredResult(_0x28c035,_0x12b935))[_0xc451('0x48')](handleError(_0x28c035,null));};exports[_0xc451('0x86')]=function(_0x229069,_0x563d0c,_0x15a980){var _0x2a4266={'raw':!![],'where':{}};var _0x3a306d={};var _0x4dabab={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x229069[_0xc451('0x69')]['id']}})[_0xc451('0x20')](handleEntityNotFound(_0x563d0c,null))[_0xc451('0x20')](function(_0x23df96){if(_0x23df96){_0x3a306d['model']=_[_0xc451('0x2a')](db[_0xc451('0x60')]['rawAttributes']);_0x3a306d[_0xc451('0x2b')]=_[_0xc451('0x2a')](_0x229069['query']);_0x3a306d[_0xc451('0x2e')]=_['intersection'](_0x3a306d[_0xc451('0x29')],_0x3a306d['query']);_0x2a4266[_0xc451('0x30')]=_['intersection'](_0x3a306d['model'],qs[_0xc451('0x31')](_0x229069[_0xc451('0x2b')]['fields']));_0x2a4266[_0xc451('0x30')]=_0x2a4266[_0xc451('0x30')][_0xc451('0x32')]?_0x2a4266[_0xc451('0x30')]:_0x3a306d[_0xc451('0x29')];if(!_0x229069[_0xc451('0x2b')]['hasOwnProperty'](_0xc451('0x7e'))){_0x2a4266[_0xc451('0x33')]=qs[_0xc451('0x33')](_0x229069['query'][_0xc451('0x33')]);_0x2a4266[_0xc451('0x18')]=qs[_0xc451('0x18')](_0x229069[_0xc451('0x2b')][_0xc451('0x18')]);}_0x2a4266[_0xc451('0x34')]=qs[_0xc451('0x35')](_0x229069[_0xc451('0x2b')][_0xc451('0x35')]);_0x2a4266['where']=qs[_0xc451('0x2e')](_[_0xc451('0x37')](_0x229069[_0xc451('0x2b')],_0x3a306d[_0xc451('0x2e')]));_0x2a4266[_0xc451('0x36')][_0xc451('0x82')]=_0x23df96['id'];if(_0x229069[_0xc451('0x2b')][_0xc451('0x3b')]){_0x2a4266['where']=_[_0xc451('0x3a')](_0x2a4266[_0xc451('0x36')],{'$or':_['map'](_0x2a4266[_0xc451('0x30')],function(_0x502d97){var _0x386977={};_0x386977[_0x502d97]={'$like':'%'+_0x229069['query'][_0xc451('0x3b')]+'%'};return _0x386977;})});}_0x2a4266=_['merge']({},_0x2a4266,_0x229069[_0xc451('0x3d')]);return db['JscriptySessionReport'][_0xc451('0x17')]({'where':_0x2a4266['where']})[_0xc451('0x20')](function(_0x422d82){_0x4dabab[_0xc451('0x17')]=_0x422d82;if(_0x229069[_0xc451('0x2b')][_0xc451('0x43')]){_0x2a4266[_0xc451('0x3e')]=[{'all':!![]}];}return db[_0xc451('0x60')][_0xc451('0x45')](_0x2a4266);})[_0xc451('0x20')](function(_0x4e7c36){_0x4dabab[_0xc451('0x46')]=_0x4e7c36;return _0x4dabab;});}})[_0xc451('0x20')](respondWithFilteredResult(_0x563d0c,_0x2a4266))[_0xc451('0x48')](handleError(_0x563d0c,null));};exports[_0xc451('0x87')]=function(_0x563168,_0x3802a8,_0x33115f){try{if(!_0x563168[_0xc451('0x49')][_0xc451('0x65')]){throw new Error('No\x20ListId\x20specified');}if(!_0x563168[_0xc451('0x49')][_0xc451('0x88')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x563168[_0xc451('0x49')]['binding_values']){throw new Error(_0xc451('0x89'));}if(!_0x563168[_0xc451('0x49')][_0xc451('0x8a')]){throw new Error(_0xc451('0x8b'));}var _0x3c2c34=_0x563168[_0xc451('0x49')][_0xc451('0x88')][_0xc451('0x8c')](',');var _0x406359=_0x563168['body'][_0xc451('0x8d')]['split'](',');if(!_0x3c2c34[_0xc451('0x32')]||!_0x406359['length']||_0x3c2c34['length']!==_0x406359[_0xc451('0x32')]){throw new Error(_0xc451('0x8e'));}_0x563168[_0xc451('0x49')]['fields']=_[_0xc451('0x8f')](_0x3c2c34,_0x406359);if(!_0x563168[_0xc451('0x49')]['fields'][_0xc451('0x7a')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x563168['body']['fields'][_0xc451('0x90')]){throw new Error(_0xc451('0x91'));}var _0x2b331a=path[_0xc451('0x92')](config['root'],_0xc451('0x93'),_0x563168[_0xc451('0x94')][_0xc451('0x95')]);fs[_0xc451('0x96')](_0x2b331a,parseInt(_0xc451('0x97'),0x8));var _0x4e1044=require('child_process')[_0xc451('0x98')](path[_0xc451('0x92')](__dirname,_0xc451('0x99')),[_0x2b331a,_0x563168[_0xc451('0x49')][_0xc451('0x88')],_0x563168[_0xc451('0x49')][_0xc451('0x8d')],_0x563168[_0xc451('0x49')][_0xc451('0x65')],_0x563168['body'][_0xc451('0x9a')],_0x563168[_0xc451('0x49')][_0xc451('0x63')],_0x563168[_0xc451('0x49')]['socket_timestamp']]);return _0x3802a8['status'](0xc8)[_0xc451('0x1b')]({'message':_0xc451('0x9b'),'pid':_0x4e1044[_0xc451('0x9c')]});}catch(_0xcde023){return _0x3802a8[_0xc451('0x15')](0x1f4)['send'](_0xcde023);}};exports['upload']=function(_0x251e28,_0x51e7e6,_0x1e6913){var _0x50a58f=fs[_0xc451('0x9d')](_0x251e28[_0xc451('0x94')][_0xc451('0x4')]);Papa[_0xc451('0x9e')](_0x50a58f,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x43f985){return _0x51e7e6['status'](0xc8)['json']({'file':_0x251e28[_0xc451('0x94')],'fields':_0x43f985[_0xc451('0x9f')][_0xc451('0x31')]});}});};exports[_0xc451('0xa0')]=function(_0xb7d11c,_0x4dd763,_0x365fbc){return db[_0xc451('0xa1')][_0xc451('0x45')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xc451('0x20')](function(_0x64eb47){var _0xd7ea50=![];if(!_0xb7d11c[_0xc451('0x49')][_0xc451('0x65')]){throw new Error(_0xc451('0xa2'));}if(!_0xb7d11c[_0xc451('0x49')]['binding'][_0xc451('0x7a')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xb7d11c['body'][_0xc451('0xa3')][_0xc451('0x90')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xb7d11c[_0xc451('0x49')]['socket_timestamp']){throw new Error(_0xc451('0x8b'));}var _0xc3fd21=require(_0xc451('0xa4'))['fork'](path['join'](__dirname,_0xc451('0xa5')),[_0xb7d11c[_0xc451('0x69')]['id'],JSON[_0xc451('0xa6')](_0xb7d11c[_0xc451('0x49')]),JSON[_0xc451('0xa6')](_0x64eb47)]);_0xc3fd21['on'](_0xc451('0xa7'),function(_0x405aa7){_0xd7ea50=!![];return _0x4dd763[_0xc451('0x15')](0xc8)[_0xc451('0x1b')]({'message':_0xc451('0xa8'),'pid':_0xc3fd21[_0xc451('0x9c')]});});_0xc3fd21['on'](_0xc451('0xa9'),function(_0x51d11e){if(_0x51d11e&&!_0xd7ea50){return _0x4dd763[_0xc451('0x15')](0x1f4)[_0xc451('0x1b')]({'message':_0xc451('0xaa'),'pid':_0xc3fd21['pid']});}});})['catch'](handleError(_0x4dd763,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index fc22ee6..963686d 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfb7=['exports','events','../../mysqldb','save','update','remove','hasOwnProperty'];(function(_0x291139,_0x7f30de){var _0x3c42c0=function(_0x5832e3){while(--_0x5832e3){_0x291139['push'](_0x291139['shift']());}};_0x3c42c0(++_0x7f30de);}(_0xdfb7,0xda));var _0x7dfb=function(_0x1c8d08,_0x2c11b4){_0x1c8d08=_0x1c8d08-0x0;var _0x74a0c9=_0xdfb7[_0x1c8d08];return _0x74a0c9;};'use strict';var EventEmitter=require(_0x7dfb('0x0'));var CmContact=require(_0x7dfb('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7dfb('0x2'),'afterUpdate':_0x7dfb('0x3'),'afterDestroy':_0x7dfb('0x4')};function emitEvent(_0x39630){return function(_0x572b8d,_0x2a0ceb,_0x247855){CmContactEvents['emit'](_0x39630+':'+_0x572b8d['id'],_0x572b8d);CmContactEvents['emit'](_0x39630,_0x572b8d);_0x247855(null);};}for(var e in events){if(events[_0x7dfb('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x7dfb('0x6')]=CmContactEvents; \ No newline at end of file +var _0xbfd5=['remove','emit','hasOwnProperty','exports','../../mysqldb','CmContact','setMaxListeners','update'];(function(_0xe66b90,_0x234632){var _0x104441=function(_0x32f92f){while(--_0x32f92f){_0xe66b90['push'](_0xe66b90['shift']());}};_0x104441(++_0x234632);}(_0xbfd5,0x9c));var _0x5bfd=function(_0x244ce7,_0x20f858){_0x244ce7=_0x244ce7-0x0;var _0x5bb663=_0xbfd5[_0x244ce7];return _0x5bb663;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x5bfd('0x0'))['db'][_0x5bfd('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5bfd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5bfd('0x3'),'afterDestroy':_0x5bfd('0x4')};function emitEvent(_0x5372cf){return function(_0x238fb2,_0x333f1b,_0x9480db){CmContactEvents['emit'](_0x5372cf+':'+_0x238fb2['id'],_0x238fb2);CmContactEvents[_0x5bfd('0x5')](_0x5372cf,_0x238fb2);_0x9480db(null);};}for(var e in events){if(events[_0x5bfd('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x5bfd('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 9b778e0..0a3d8b6 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x240d=['onlyIfOpen','VoiceQueue','BlackLists','get','CmHopperBlack','cmContact,\x20%s,\x20%s','afterCreate','message','Campaign','List\x20not\x20found','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./cmContact.attributes','cm_contacts','phone','models','inspect','findOne','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','scheduledAt','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','CmHopper','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','length','dialCheckDuplicateType','always'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x240d,0x1d0));var _0xd240=function(_0x4c07a8,_0x443826){_0x4c07a8=_0x4c07a8-0x0;var _0xd99a9=_0x240d[_0x4c07a8];return _0xd99a9;};'use strict';var _=require(_0xd240('0x0'));var util=require(_0xd240('0x1'));var logger=require(_0xd240('0x2'))(_0xd240('0x3'));var moment=require(_0xd240('0x4'));var BPromise=require(_0xd240('0x5'));var rp=require(_0xd240('0x6'));var attributes=require(_0xd240('0x7'));module['exports']=function(_0x324f09,_0x2f38b6){return _0x324f09['define']('CmContact',attributes,{'tableName':_0xd240('0x8'),'paranoid':!![],'indexes':[{'name':_0xd240('0x9'),'fields':['phone']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5eaef2,_0x22f109,_0x2c8ea1){var _0x33f559=_0x324f09[_0xd240('0xa')];var _0x37ff03=_0x5eaef2['get']({'plain':!![]});function _0x2589d3(){return function(_0x4c6d1b){logger['error']('cmContact','afterCreate',util[_0xd240('0xb')](_0x4c6d1b,{'showHidden':![],'depth':null}));};}var _0x3be79e=function(_0x2a0cc6){return new BPromise(function(_0x36a197,_0x48f497){_0x33f559['CmHopper'][_0xd240('0xc')]({'where':{'phone':_0x37ff03['phone'],'VoiceQueueId':_0x2a0cc6['id']}})[_0xd240('0xd')](function(_0x4cca92){if(!_['isNil'](_0x4cca92)){throw new Error('cmContact,\x20afterCreate\x20'+_0x37ff03['phone']+_0xd240('0xe')+_0x2a0cc6['id']);}return _0x33f559['CmHopper'][_0xd240('0xf')]({'phone':_0x37ff03[_0xd240('0x9')],'ContactId':_0x37ff03['id'],'ListId':_0x37ff03[_0xd240('0x10')],'priority':_0x37ff03['priority']?_0x37ff03[_0xd240('0x11')]:0x2,'scheduledat':_0x37ff03['scheduledAt']?_0x37ff03[_0xd240('0x12')]:moment()[_0xd240('0x13')](_0xd240('0x14')),'callback':_0x37ff03[_0xd240('0x15')]?!![]:![],'callbackuniqueid':_0x37ff03[_0xd240('0x15')]?_0x37ff03[_0xd240('0x15')]:undefined,'callbackat':_0x37ff03[_0xd240('0x15')]?moment()[_0xd240('0x13')](_0xd240('0x14')):undefined,'VoiceQueueId':_0x2a0cc6['id']});})[_0xd240('0x16')](function(_0xe7dd3d){_0x48f497(_0xe7dd3d);});});};var _0x3f408b=function(_0x104d5a){return new BPromise(function(_0x45269a,_0x366a05){_0x33f559[_0xd240('0x17')][_0xd240('0xc')]({'where':{'phone':_0x37ff03[_0xd240('0x9')],'VoiceQueueId':_0x104d5a['id']}})[_0xd240('0xd')](function(_0x191730){if(!_[_0xd240('0x18')](_0x191730)){throw new Error(_0xd240('0x19')+_0x37ff03[_0xd240('0x9')]+_0xd240('0x1a')+_0x104d5a['id']);}return _0x33f559[_0xd240('0x1b')]['findOne']({'where':{'calleridnum':_0x37ff03[_0xd240('0x9')],'VoiceQueueId':_0x104d5a['id']}});})[_0xd240('0xd')](function(_0x161b7d){if(!_[_0xd240('0x18')](_0x161b7d)){throw new Error(_0xd240('0x1c')+_0x37ff03[_0xd240('0x9')]+_0xd240('0x1d')+_0x104d5a['id']);}return _0x33f559[_0xd240('0x17')][_0xd240('0xf')]({'phone':_0x37ff03[_0xd240('0x9')],'ContactId':_0x37ff03['id'],'ListId':_0x37ff03[_0xd240('0x10')],'priority':_0x37ff03['priority']?_0x37ff03[_0xd240('0x11')]:0x2,'scheduledat':_0x37ff03[_0xd240('0x12')]?_0x37ff03['scheduledAt']:moment()['format'](_0xd240('0x14')),'callback':_0x37ff03[_0xd240('0x15')]?!![]:![],'callbackuniqueid':_0x37ff03[_0xd240('0x15')]?_0x37ff03[_0xd240('0x15')]:undefined,'callbackat':_0x37ff03['callbackUniqueid']?moment()['format'](_0xd240('0x14')):undefined,'VoiceQueueId':_0x104d5a['id']});})['catch'](function(_0x1cd100){_0x366a05(_0x1cd100);});});};function _0x609b85(){return function(_0x103707){logger[_0xd240('0x1e')]('cmContact','afterCreate',util['inspect'](_0x103707,{'showHidden':![],'depth':null}));};}var _0x51b206=function(_0x26823e){return new BPromise(function(_0x2c92ac,_0x4802db){_0x33f559[_0xd240('0x17')][_0xd240('0xc')]({'where':{'phone':_0x37ff03[_0xd240('0x9')],'CampaignId':_0x26823e['id']}})[_0xd240('0xd')](function(_0x47fbd3){if(!_[_0xd240('0x18')](_0x47fbd3)){throw new Error('cmContact,\x20afterCreate\x20'+_0x37ff03[_0xd240('0x9')]+_0xd240('0x1f')+_0x26823e['id']);}return _0x33f559['CmHopper'][_0xd240('0xf')]({'phone':_0x37ff03['phone'],'ContactId':_0x37ff03['id'],'ListId':_0x37ff03[_0xd240('0x10')],'priority':_0x37ff03[_0xd240('0x11')]?_0x37ff03[_0xd240('0x11')]:0x2,'scheduledat':_0x37ff03[_0xd240('0x12')]?_0x37ff03[_0xd240('0x12')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x37ff03['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x37ff03[_0xd240('0x15')]?_0x37ff03[_0xd240('0x15')]:undefined,'callbackat':_0x37ff03[_0xd240('0x15')]?moment()[_0xd240('0x13')](_0xd240('0x14')):undefined,'CampaignId':_0x26823e['id']});})[_0xd240('0x16')](function(_0x24e0fc){_0x4802db(_0x24e0fc);});});};var _0x8aaa5f=function(_0x2eef03){return new BPromise(function(_0x5ed80d,_0x15fab1){_0x33f559[_0xd240('0x17')]['findOne']({'where':{'phone':_0x37ff03[_0xd240('0x9')],'CampaignId':_0x2eef03['id']}})[_0xd240('0xd')](function(_0x52e166){if(!_[_0xd240('0x18')](_0x52e166)){throw new Error(_0xd240('0x19')+_0x37ff03[_0xd240('0x9')]+_0xd240('0x20')+_0x2eef03['id']);}return _0x33f559['CmHopperFinal'][_0xd240('0xc')]({'where':{'calleridnum':_0x37ff03[_0xd240('0x9')],'CampaignId':_0x2eef03['id']}});})[_0xd240('0xd')](function(_0x1387b6){if(!_[_0xd240('0x18')](_0x1387b6)){throw new Error(_0xd240('0x1c')+_0x37ff03[_0xd240('0x9')]+_0xd240('0x21')+_0x2eef03['id']);}return _0x33f559[_0xd240('0x17')]['create']({'phone':_0x37ff03['phone'],'ContactId':_0x37ff03['id'],'ListId':_0x37ff03[_0xd240('0x10')],'priority':_0x37ff03[_0xd240('0x11')]?_0x37ff03['priority']:0x2,'scheduledat':_0x37ff03[_0xd240('0x12')]?_0x37ff03[_0xd240('0x12')]:moment()[_0xd240('0x13')](_0xd240('0x14')),'callback':_0x37ff03[_0xd240('0x15')]?!![]:![],'callbackuniqueid':_0x37ff03[_0xd240('0x15')]?_0x37ff03[_0xd240('0x15')]:undefined,'callbackat':_0x37ff03['callbackUniqueid']?moment()['format'](_0xd240('0x14')):undefined,'CampaignId':_0x2eef03['id']});})[_0xd240('0x16')](function(_0x252dd5){_0x15fab1(_0x252dd5);});});};if(_0x37ff03['ListId']){_0x33f559['VoiceQueue'][_0xd240('0x22')]({'where':{'type':_0xd240('0x23')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x33f559[_0xd240('0x24')],'as':'Lists','where':{'id':_0x37ff03[_0xd240('0x10')]}}]})[_0xd240('0xd')](function(_0x2cb170){if(_0x2cb170){var _0x34f696=[];for(var _0x55dcad=0x0,_0x1e8ee9;_0x55dcad<_0x2cb170[_0xd240('0x25')];_0x55dcad+=0x1){_0x1e8ee9=_0x2cb170[_0x55dcad]['get']({'plain':!![]});switch(_0x1e8ee9[_0xd240('0x26')]){case _0xd240('0x27'):_0x3f408b(_0x1e8ee9)[_0xd240('0x16')](_0x2589d3());break;case _0xd240('0x28'):_0x3be79e(_0x1e8ee9)[_0xd240('0x16')](_0x2589d3());break;default:_0x33f559[_0xd240('0x17')][_0xd240('0xf')]({'phone':_0x37ff03['phone'],'ContactId':_0x37ff03['id'],'ListId':_0x37ff03['ListId'],'scheduledat':_0x37ff03[_0xd240('0x12')]?_0x37ff03[_0xd240('0x12')]:moment()[_0xd240('0x13')](_0xd240('0x14')),'priority':_0x37ff03[_0xd240('0x11')]?_0x37ff03[_0xd240('0x11')]:0x2,'callback':_0x37ff03[_0xd240('0x15')]?!![]:![],'callbackuniqueid':_0x37ff03['callbackUniqueid']?_0x37ff03['callbackUniqueid']:undefined,'callbackat':_0x37ff03[_0xd240('0x15')]?moment()['format'](_0xd240('0x14')):undefined,'VoiceQueueId':_0x1e8ee9['id']})[_0xd240('0x16')](_0x2589d3());}}}})[_0xd240('0xd')](function(){return _0x33f559[_0xd240('0x29')]['findAll']({'where':{'type':_0xd240('0x23')},'attributes':['id'],'include':[{'model':_0x33f559[_0xd240('0x24')],'as':_0xd240('0x2a'),'where':{'id':_0x37ff03[_0xd240('0x10')]}}]})[_0xd240('0xd')](function(_0x454194){if(_0x454194){var _0xcd48c4=[];for(var _0x3af84a=0x0,_0x287c26;_0x3af84a<_0x454194['length'];_0x3af84a+=0x1){_0x287c26=_0x454194[_0x3af84a][_0xd240('0x2b')]({'plain':!![]});_0x33f559[_0xd240('0x2c')][_0xd240('0xf')]({'phone':_0x37ff03['phone'],'ContactId':_0x37ff03['id'],'ListId':_0x37ff03[_0xd240('0x10')],'VoiceQueueId':_0x287c26['id']})[_0xd240('0x16')](function(_0x2fdc15){logger[_0xd240('0x1e')](_0xd240('0x2d'),_0xd240('0x2e'),_0x2fdc15[_0xd240('0x2f')]);});}}});})[_0xd240('0xd')](function(){return _0x33f559[_0xd240('0x30')][_0xd240('0x22')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x33f559[_0xd240('0x24')],'as':'Lists','where':{'id':_0x37ff03[_0xd240('0x10')]}}]})[_0xd240('0xd')](function(_0x5b3894){if(_0x5b3894){var _0x2228ab=[];for(var _0x429bdf=0x0,_0x208f25;_0x429bdf<_0x5b3894[_0xd240('0x25')];_0x429bdf+=0x1){_0x208f25=_0x5b3894[_0x429bdf][_0xd240('0x2b')]({'plain':!![]});switch(_0x208f25[_0xd240('0x26')]){case _0xd240('0x27'):_0x8aaa5f(_0x208f25)['catch'](_0x609b85());break;case _0xd240('0x28'):_0x51b206(_0x208f25)[_0xd240('0x16')](_0x609b85());break;default:_0x33f559['CmHopper'][_0xd240('0xf')]({'phone':_0x37ff03[_0xd240('0x9')],'ContactId':_0x37ff03['id'],'ListId':_0x37ff03[_0xd240('0x10')],'scheduledat':_0x37ff03[_0xd240('0x12')]?_0x37ff03['scheduledAt']:moment()[_0xd240('0x13')](_0xd240('0x14')),'priority':_0x37ff03['priority']?_0x37ff03[_0xd240('0x11')]:0x2,'callback':_0x37ff03['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x37ff03[_0xd240('0x15')]?_0x37ff03['callbackUniqueid']:undefined,'callbackat':_0x37ff03['callbackUniqueid']?moment()[_0xd240('0x13')](_0xd240('0x14')):undefined,'CampaignId':_0x208f25['id']})[_0xd240('0x16')](_0x609b85());}}}});})[_0xd240('0xd')](function(){return _0x33f559[_0xd240('0x30')][_0xd240('0x22')]({'attributes':['id'],'include':[{'model':_0x33f559[_0xd240('0x24')],'as':_0xd240('0x2a'),'where':{'id':_0x37ff03[_0xd240('0x10')]}}]})[_0xd240('0xd')](function(_0x2846b3){if(_0x2846b3){var _0x1c0ac9=[];for(var _0x2cdea5=0x0,_0x4918ae;_0x2cdea5<_0x2846b3[_0xd240('0x25')];_0x2cdea5+=0x1){_0x4918ae=_0x2846b3[_0x2cdea5][_0xd240('0x2b')]({'plain':!![]});_0x33f559['CmHopperBlack'][_0xd240('0xf')]({'phone':_0x37ff03['phone'],'ContactId':_0x37ff03['id'],'ListId':_0x37ff03['ListId'],'CampaignId':_0x4918ae['id']})['catch'](function(_0x7e17bc){logger[_0xd240('0x1e')](_0xd240('0x2d'),_0xd240('0x2e'),_0x7e17bc[_0xd240('0x2f')]);});}}});})[_0xd240('0xd')](function(){_0x2c8ea1();})[_0xd240('0x16')](function(_0xc0557a){logger[_0xd240('0x1e')](_0xd240('0x2d'),'afterCreate',_0xc0557a['message']);_0x2c8ea1(_0xc0557a);});}else{_0x2c8ea1(new Error(_0xd240('0x31')));}},'afterDestroy':function(_0x411045,_0x21249f,_0x184c0b){var _0x3a18d6=_0x324f09[_0xd240('0xa')];var _0x5bf9bf=_0x411045[_0xd240('0x2b')]({'plain':!![]});return _0x3a18d6['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x5bf9bf[_0xd240('0x10')],'ContactId':_0x5bf9bf['id']}})['then'](function(_0x5e3c71){if(!_['isEmpty'](_0x5e3c71)){var _0x5c73e7=[];for(var _0x5a6bab=0x0;_0x5a6bab<_0x5e3c71[_0xd240('0x25')];_0x5a6bab+=0x1){var _0x4e887a=_0x3a18d6[_0xd240('0x17')]['destroy']({'where':{'ListId':_0x5e3c71[_0x5a6bab][_0xd240('0x10')],'ContactId':_0x5e3c71[_0x5a6bab]['ContactId'],'VoiceQueueId':_0x5e3c71[_0x5a6bab][_0xd240('0x32')],'CampaignId':_0x5e3c71[_0x5a6bab][_0xd240('0x33')]}});_0x5c73e7[_0xd240('0x34')](_0x4e887a);}return BPromise[_0xd240('0x35')](_0x5c73e7);}})[_0xd240('0xd')](function(_0x95ecda){logger[_0xd240('0x36')]('[CmContact][afterDestroy][Succesfull]',util[_0xd240('0xb')](_0x95ecda,{'showHidden':![],'depth':null}));_0x184c0b();})['catch'](function(_0x243d81){logger[_0xd240('0x1e')](_0xd240('0x37'),util[_0xd240('0xb')](_0x243d81,{'showHidden':![],'depth':null}));_0x184c0b(_0x243d81);});}}});}; \ No newline at end of file +var _0xfd67=['phone','models','get','error','cmContact','afterCreate','inspect','CmHopper','findOne','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','scheduledAt','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','format','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','then','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','always','BlackLists','List\x20not\x20found','destroy','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','./cmContact.attributes','exports','define','CmContact'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xfd67,0x11e));var _0x7fd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd67[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7fd6('0x0'));var util=require(_0x7fd6('0x1'));var logger=require(_0x7fd6('0x2'))(_0x7fd6('0x3'));var moment=require(_0x7fd6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x7fd6('0x5'));module[_0x7fd6('0x6')]=function(_0x1f888b,_0x32f236){return _0x1f888b[_0x7fd6('0x7')](_0x7fd6('0x8'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x7fd6('0x9'),'fields':['phone']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40384d,_0x389387,_0x25eb26){var _0xae83fb=_0x1f888b[_0x7fd6('0xa')];var _0x7450e=_0x40384d[_0x7fd6('0xb')]({'plain':!![]});function _0xbf2fac(){return function(_0x538b33){logger[_0x7fd6('0xc')](_0x7fd6('0xd'),_0x7fd6('0xe'),util[_0x7fd6('0xf')](_0x538b33,{'showHidden':![],'depth':null}));};}var _0x5c46a8=function(_0x26d6ca){return new BPromise(function(_0x567878,_0x1b6b79){_0xae83fb[_0x7fd6('0x10')][_0x7fd6('0x11')]({'where':{'phone':_0x7450e[_0x7fd6('0x9')],'VoiceQueueId':_0x26d6ca['id']}})['then'](function(_0x561972){if(!_[_0x7fd6('0x12')](_0x561972)){throw new Error(_0x7fd6('0x13')+_0x7450e['phone']+_0x7fd6('0x14')+_0x26d6ca['id']);}return _0xae83fb[_0x7fd6('0x10')]['create']({'phone':_0x7450e['phone'],'ContactId':_0x7450e['id'],'ListId':_0x7450e[_0x7fd6('0x15')],'priority':_0x7450e[_0x7fd6('0x16')]?_0x7450e['priority']:0x2,'scheduledat':_0x7450e[_0x7fd6('0x17')]?_0x7450e[_0x7fd6('0x17')]:moment()['format'](_0x7fd6('0x18')),'callback':_0x7450e[_0x7fd6('0x19')]?!![]:![],'callbackuniqueid':_0x7450e[_0x7fd6('0x19')]?_0x7450e['callbackUniqueid']:undefined,'callbackat':_0x7450e[_0x7fd6('0x19')]?moment()[_0x7fd6('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x26d6ca['id']});})['catch'](function(_0x474d2e){_0x1b6b79(_0x474d2e);});});};var _0x5eb83d=function(_0x26d76f){return new BPromise(function(_0x1d57b5,_0x76f0e4){_0xae83fb[_0x7fd6('0x10')][_0x7fd6('0x11')]({'where':{'phone':_0x7450e[_0x7fd6('0x9')],'VoiceQueueId':_0x26d76f['id']}})['then'](function(_0x41c523){if(!_[_0x7fd6('0x12')](_0x41c523)){throw new Error(_0x7fd6('0x13')+_0x7450e[_0x7fd6('0x9')]+_0x7fd6('0x1b')+_0x26d76f['id']);}return _0xae83fb[_0x7fd6('0x1c')][_0x7fd6('0x11')]({'where':{'calleridnum':_0x7450e['phone'],'VoiceQueueId':_0x26d76f['id']}});})[_0x7fd6('0x1d')](function(_0x2b7a73){if(!_[_0x7fd6('0x12')](_0x2b7a73)){throw new Error(_0x7fd6('0x1e')+_0x7450e[_0x7fd6('0x9')]+_0x7fd6('0x1f')+_0x26d76f['id']);}return _0xae83fb[_0x7fd6('0x10')][_0x7fd6('0x20')]({'phone':_0x7450e[_0x7fd6('0x9')],'ContactId':_0x7450e['id'],'ListId':_0x7450e[_0x7fd6('0x15')],'priority':_0x7450e[_0x7fd6('0x16')]?_0x7450e[_0x7fd6('0x16')]:0x2,'scheduledat':_0x7450e[_0x7fd6('0x17')]?_0x7450e[_0x7fd6('0x17')]:moment()[_0x7fd6('0x1a')](_0x7fd6('0x18')),'callback':_0x7450e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x7450e[_0x7fd6('0x19')]?_0x7450e[_0x7fd6('0x19')]:undefined,'callbackat':_0x7450e['callbackUniqueid']?moment()[_0x7fd6('0x1a')](_0x7fd6('0x18')):undefined,'VoiceQueueId':_0x26d76f['id']});})[_0x7fd6('0x21')](function(_0x163f70){_0x76f0e4(_0x163f70);});});};function _0x37f32c(){return function(_0x55e0ca){logger[_0x7fd6('0xc')]('cmContact',_0x7fd6('0xe'),util['inspect'](_0x55e0ca,{'showHidden':![],'depth':null}));};}var _0x5dca47=function(_0x3941b1){return new BPromise(function(_0x436bef,_0x33d549){_0xae83fb[_0x7fd6('0x10')]['findOne']({'where':{'phone':_0x7450e['phone'],'CampaignId':_0x3941b1['id']}})['then'](function(_0x3288c5){if(!_[_0x7fd6('0x12')](_0x3288c5)){throw new Error(_0x7fd6('0x13')+_0x7450e['phone']+_0x7fd6('0x22')+_0x3941b1['id']);}return _0xae83fb[_0x7fd6('0x10')][_0x7fd6('0x20')]({'phone':_0x7450e['phone'],'ContactId':_0x7450e['id'],'ListId':_0x7450e[_0x7fd6('0x15')],'priority':_0x7450e['priority']?_0x7450e['priority']:0x2,'scheduledat':_0x7450e['scheduledAt']?_0x7450e[_0x7fd6('0x17')]:moment()[_0x7fd6('0x1a')](_0x7fd6('0x18')),'callback':_0x7450e[_0x7fd6('0x19')]?!![]:![],'callbackuniqueid':_0x7450e[_0x7fd6('0x19')]?_0x7450e['callbackUniqueid']:undefined,'callbackat':_0x7450e[_0x7fd6('0x19')]?moment()[_0x7fd6('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3941b1['id']});})[_0x7fd6('0x21')](function(_0x131e57){_0x33d549(_0x131e57);});});};var _0x4fe567=function(_0x3fcc7a){return new BPromise(function(_0x3aadeb,_0x4ed029){_0xae83fb['CmHopper'][_0x7fd6('0x11')]({'where':{'phone':_0x7450e[_0x7fd6('0x9')],'CampaignId':_0x3fcc7a['id']}})[_0x7fd6('0x1d')](function(_0x1f0e61){if(!_[_0x7fd6('0x12')](_0x1f0e61)){throw new Error(_0x7fd6('0x13')+_0x7450e['phone']+_0x7fd6('0x23')+_0x3fcc7a['id']);}return _0xae83fb[_0x7fd6('0x1c')]['findOne']({'where':{'calleridnum':_0x7450e[_0x7fd6('0x9')],'CampaignId':_0x3fcc7a['id']}});})['then'](function(_0x539afd){if(!_[_0x7fd6('0x12')](_0x539afd)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x7450e[_0x7fd6('0x9')]+_0x7fd6('0x24')+_0x3fcc7a['id']);}return _0xae83fb[_0x7fd6('0x10')][_0x7fd6('0x20')]({'phone':_0x7450e[_0x7fd6('0x9')],'ContactId':_0x7450e['id'],'ListId':_0x7450e[_0x7fd6('0x15')],'priority':_0x7450e[_0x7fd6('0x16')]?_0x7450e[_0x7fd6('0x16')]:0x2,'scheduledat':_0x7450e[_0x7fd6('0x17')]?_0x7450e['scheduledAt']:moment()[_0x7fd6('0x1a')](_0x7fd6('0x18')),'callback':_0x7450e[_0x7fd6('0x19')]?!![]:![],'callbackuniqueid':_0x7450e[_0x7fd6('0x19')]?_0x7450e[_0x7fd6('0x19')]:undefined,'callbackat':_0x7450e[_0x7fd6('0x19')]?moment()[_0x7fd6('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3fcc7a['id']});})[_0x7fd6('0x21')](function(_0x481525){_0x4ed029(_0x481525);});});};if(_0x7450e['ListId']){_0xae83fb[_0x7fd6('0x25')][_0x7fd6('0x26')]({'where':{'type':_0x7fd6('0x27')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0xae83fb[_0x7fd6('0x28')],'as':_0x7fd6('0x29'),'where':{'id':_0x7450e[_0x7fd6('0x15')]}}]})['then'](function(_0x14e58a){if(_0x14e58a){var _0x4275e5=[];for(var _0x1294e7=0x0,_0x4f2c5b;_0x1294e7<_0x14e58a[_0x7fd6('0x2a')];_0x1294e7+=0x1){_0x4f2c5b=_0x14e58a[_0x1294e7]['get']({'plain':!![]});switch(_0x4f2c5b[_0x7fd6('0x2b')]){case'always':_0x5eb83d(_0x4f2c5b)[_0x7fd6('0x21')](_0xbf2fac());break;case'onlyIfOpen':_0x5c46a8(_0x4f2c5b)[_0x7fd6('0x21')](_0xbf2fac());break;default:_0xae83fb['CmHopper']['create']({'phone':_0x7450e[_0x7fd6('0x9')],'ContactId':_0x7450e['id'],'ListId':_0x7450e[_0x7fd6('0x15')],'scheduledat':_0x7450e[_0x7fd6('0x17')]?_0x7450e[_0x7fd6('0x17')]:moment()[_0x7fd6('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x7450e[_0x7fd6('0x16')]?_0x7450e[_0x7fd6('0x16')]:0x2,'callback':_0x7450e[_0x7fd6('0x19')]?!![]:![],'callbackuniqueid':_0x7450e[_0x7fd6('0x19')]?_0x7450e[_0x7fd6('0x19')]:undefined,'callbackat':_0x7450e['callbackUniqueid']?moment()[_0x7fd6('0x1a')](_0x7fd6('0x18')):undefined,'VoiceQueueId':_0x4f2c5b['id']})[_0x7fd6('0x21')](_0xbf2fac());}}}})['then'](function(){return _0xae83fb[_0x7fd6('0x25')][_0x7fd6('0x26')]({'where':{'type':_0x7fd6('0x27')},'attributes':['id'],'include':[{'model':_0xae83fb['CmList'],'as':'BlackLists','where':{'id':_0x7450e[_0x7fd6('0x15')]}}]})[_0x7fd6('0x1d')](function(_0x57e196){if(_0x57e196){var _0x46accc=[];for(var _0x5d89d4=0x0,_0x5cedef;_0x5d89d4<_0x57e196[_0x7fd6('0x2a')];_0x5d89d4+=0x1){_0x5cedef=_0x57e196[_0x5d89d4][_0x7fd6('0xb')]({'plain':!![]});_0xae83fb[_0x7fd6('0x2c')][_0x7fd6('0x20')]({'phone':_0x7450e[_0x7fd6('0x9')],'ContactId':_0x7450e['id'],'ListId':_0x7450e['ListId'],'VoiceQueueId':_0x5cedef['id']})[_0x7fd6('0x21')](function(_0x500475){logger['error'](_0x7fd6('0x2d'),_0x7fd6('0xe'),_0x500475[_0x7fd6('0x2e')]);});}}});})['then'](function(){return _0xae83fb[_0x7fd6('0x2f')]['findAll']({'attributes':['id',_0x7fd6('0x2b')],'include':[{'model':_0xae83fb['CmList'],'as':'Lists','where':{'id':_0x7450e['ListId']}}]})[_0x7fd6('0x1d')](function(_0x279208){if(_0x279208){var _0x477283=[];for(var _0x551fcd=0x0,_0x560692;_0x551fcd<_0x279208[_0x7fd6('0x2a')];_0x551fcd+=0x1){_0x560692=_0x279208[_0x551fcd]['get']({'plain':!![]});switch(_0x560692[_0x7fd6('0x2b')]){case _0x7fd6('0x30'):_0x4fe567(_0x560692)[_0x7fd6('0x21')](_0x37f32c());break;case'onlyIfOpen':_0x5dca47(_0x560692)[_0x7fd6('0x21')](_0x37f32c());break;default:_0xae83fb[_0x7fd6('0x10')][_0x7fd6('0x20')]({'phone':_0x7450e[_0x7fd6('0x9')],'ContactId':_0x7450e['id'],'ListId':_0x7450e[_0x7fd6('0x15')],'scheduledat':_0x7450e['scheduledAt']?_0x7450e[_0x7fd6('0x17')]:moment()[_0x7fd6('0x1a')](_0x7fd6('0x18')),'priority':_0x7450e['priority']?_0x7450e[_0x7fd6('0x16')]:0x2,'callback':_0x7450e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x7450e[_0x7fd6('0x19')]?_0x7450e['callbackUniqueid']:undefined,'callbackat':_0x7450e['callbackUniqueid']?moment()['format'](_0x7fd6('0x18')):undefined,'CampaignId':_0x560692['id']})[_0x7fd6('0x21')](_0x37f32c());}}}});})[_0x7fd6('0x1d')](function(){return _0xae83fb[_0x7fd6('0x2f')][_0x7fd6('0x26')]({'attributes':['id'],'include':[{'model':_0xae83fb['CmList'],'as':_0x7fd6('0x31'),'where':{'id':_0x7450e[_0x7fd6('0x15')]}}]})[_0x7fd6('0x1d')](function(_0x4f3060){if(_0x4f3060){var _0x38e31b=[];for(var _0x3e3190=0x0,_0x3e8daf;_0x3e3190<_0x4f3060[_0x7fd6('0x2a')];_0x3e3190+=0x1){_0x3e8daf=_0x4f3060[_0x3e3190]['get']({'plain':!![]});_0xae83fb['CmHopperBlack']['create']({'phone':_0x7450e[_0x7fd6('0x9')],'ContactId':_0x7450e['id'],'ListId':_0x7450e[_0x7fd6('0x15')],'CampaignId':_0x3e8daf['id']})['catch'](function(_0x2fc050){logger[_0x7fd6('0xc')](_0x7fd6('0x2d'),'afterCreate',_0x2fc050[_0x7fd6('0x2e')]);});}}});})[_0x7fd6('0x1d')](function(){_0x25eb26();})[_0x7fd6('0x21')](function(_0x4102ec){logger[_0x7fd6('0xc')](_0x7fd6('0x2d'),_0x7fd6('0xe'),_0x4102ec[_0x7fd6('0x2e')]);_0x25eb26(_0x4102ec);});}else{_0x25eb26(new Error(_0x7fd6('0x32')));}},'afterDestroy':function(_0x40e0da,_0x400b1c,_0x339323){var _0x8e93e5=_0x1f888b['models'];var _0x5ac3e9=_0x40e0da['get']({'plain':!![]});return _0x8e93e5[_0x7fd6('0x10')][_0x7fd6('0x26')]({'raw':!![],'where':{'ListId':_0x5ac3e9['ListId'],'ContactId':_0x5ac3e9['id']}})[_0x7fd6('0x1d')](function(_0x42b43b){if(!_['isEmpty'](_0x42b43b)){var _0x2dde2b=[];for(var _0x509ef3=0x0;_0x509ef3<_0x42b43b[_0x7fd6('0x2a')];_0x509ef3+=0x1){var _0xcc9fe5=_0x8e93e5[_0x7fd6('0x10')][_0x7fd6('0x33')]({'where':{'ListId':_0x42b43b[_0x509ef3]['ListId'],'ContactId':_0x42b43b[_0x509ef3][_0x7fd6('0x34')],'VoiceQueueId':_0x42b43b[_0x509ef3][_0x7fd6('0x35')],'CampaignId':_0x42b43b[_0x509ef3][_0x7fd6('0x36')]}});_0x2dde2b['push'](_0xcc9fe5);}return BPromise[_0x7fd6('0x37')](_0x2dde2b);}})[_0x7fd6('0x1d')](function(_0xa573b0){logger[_0x7fd6('0x38')](_0x7fd6('0x39'),util[_0x7fd6('0xf')](_0xa573b0,{'showHidden':![],'depth':null}));_0x339323();})[_0x7fd6('0x21')](function(_0x4a4c49){logger['error'](_0x7fd6('0x3a'),util[_0x7fd6('0xf')](_0x4a4c49,{'showHidden':![],'depth':null}));_0x339323(_0x4a4c49);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 913c358..3a8f5fa 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdab=['info','CreateCmContact','create','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','socket.io-emitter','localhost','request','then','CmContact,\x20%s,\x20%s','CmContact,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowCmContact','CmContact','find','options','raw','where','include','attributes','map','model'];(function(_0x4a4371,_0x185b9d){var _0x50fadb=function(_0x35f843){while(--_0x35f843){_0x4a4371['push'](_0x4a4371['shift']());}};_0x50fadb(++_0x185b9d);}(_0xbdab,0x184));var _0xbbda=function(_0x2f5113,_0x36c6bd){_0x2f5113=_0x2f5113-0x0;var _0xf3c4d3=_0xbdab[_0x2f5113];return _0xf3c4d3;};'use strict';var _=require(_0xbbda('0x0'));var util=require(_0xbbda('0x1'));var moment=require('moment');var BPromise=require(_0xbbda('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xbbda('0x3'));var logger=require(_0xbbda('0x4'))(_0xbbda('0x5'));var config=require('../../config/environment');var jayson=require(_0xbbda('0x6'));var client=jayson[_0xbbda('0x7')][_0xbbda('0x8')]({'port':0x232a});var socket=require(_0xbbda('0x9'))({'host':_0xbbda('0xa'),'port':0x18eb});require('./cmContact.socket')['register'](socket);function respondWithRpcPromise(_0xbf1bf6,_0x5d8e09,_0x3c5887){return new BPromise(function(_0x6e44cb,_0x4cca08){return client[_0xbbda('0xb')](_0xbf1bf6,_0x3c5887)[_0xbbda('0xc')](function(_0x46221b){logger['info'](_0xbbda('0xd'),_0x5d8e09,'request\x20sent');logger['debug'](_0xbbda('0xe'),_0x5d8e09,_0xbbda('0xf'),JSON[_0xbbda('0x10')](_0x46221b));if(_0x46221b[_0xbbda('0x11')]){if(_0x46221b[_0xbbda('0x11')][_0xbbda('0x12')]===0x1f4){logger[_0xbbda('0x11')](_0xbbda('0xd'),_0x5d8e09,_0x46221b['error']['message']);return _0x4cca08(_0x46221b[_0xbbda('0x11')]['message']);}logger[_0xbbda('0x11')](_0xbbda('0xd'),_0x5d8e09,_0x46221b['error']['message']);return _0x6e44cb(_0x46221b[_0xbbda('0x11')][_0xbbda('0x13')]);}else{logger['info'](_0xbbda('0xd'),_0x5d8e09,_0xbbda('0xf'));_0x6e44cb(_0x46221b[_0xbbda('0x14')]['message']);}})[_0xbbda('0x15')](function(_0x5882b5){logger[_0xbbda('0x11')]('CmContact,\x20%s,\x20%s',_0x5d8e09,_0x5882b5);_0x4cca08(_0x5882b5);});});}exports[_0xbbda('0x16')]=function(_0x2e74a4){var _0x20d037=this;return new Promise(function(_0x4f8839,_0x561855){return db[_0xbbda('0x17')][_0xbbda('0x18')]({'raw':_0x2e74a4[_0xbbda('0x19')]?_0x2e74a4[_0xbbda('0x19')][_0xbbda('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e74a4[_0xbbda('0x19')]?_0x2e74a4[_0xbbda('0x19')][_0xbbda('0x1b')]||null:null,'attributes':_0x2e74a4['options']?_0x2e74a4[_0xbbda('0x19')]['attributes']||null:null,'include':_0x2e74a4[_0xbbda('0x19')]?_0x2e74a4[_0xbbda('0x19')][_0xbbda('0x1c')]?_['map'](_0x2e74a4[_0xbbda('0x19')][_0xbbda('0x1c')],function(_0x39e044){return{'model':db[_0x39e044['model']],'as':_0x39e044['as'],'attributes':_0x39e044[_0xbbda('0x1d')],'include':_0x39e044[_0xbbda('0x1c')]?_[_0xbbda('0x1e')](_0x39e044[_0xbbda('0x1c')],function(_0x4f1d27){return{'model':db[_0x4f1d27[_0xbbda('0x1f')]],'as':_0x4f1d27['as'],'attributes':_0x4f1d27['attributes'],'include':_0x4f1d27[_0xbbda('0x1c')]?_[_0xbbda('0x1e')](_0x4f1d27[_0xbbda('0x1c')],function(_0xba20e0){return{'model':db[_0xba20e0['model']],'as':_0xba20e0['as'],'attributes':_0xba20e0[_0xbbda('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x250790){logger[_0xbbda('0x20')](_0xbbda('0x16'),_0x2e74a4);logger['debug'](_0xbbda('0x16'),_0x2e74a4,JSON[_0xbbda('0x10')](_0x250790));_0x4f8839(_0x250790);})[_0xbbda('0x15')](function(_0xd8c3fe){logger[_0xbbda('0x11')](_0xbbda('0x16'),_0xd8c3fe[_0xbbda('0x13')],_0x2e74a4);_0x561855(_0x20d037[_0xbbda('0x11')](0x1f4,_0xd8c3fe[_0xbbda('0x13')]));});});};exports[_0xbbda('0x21')]=function(_0x40adad){var _0xd58091=this;return new Promise(function(_0x10f9e9,_0x28d94e){return db[_0xbbda('0x17')][_0xbbda('0x22')](_0x40adad['body'],{'raw':_0x40adad['options']?_0x40adad[_0xbbda('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x322cd3){logger[_0xbbda('0x20')]('CreateCmContact',_0x40adad);logger['debug'](_0xbbda('0x21'),_0x40adad,JSON[_0xbbda('0x10')](_0x322cd3));_0x10f9e9(_0x322cd3);})[_0xbbda('0x15')](function(_0x15147b){logger[_0xbbda('0x11')](_0xbbda('0x21'),_0x15147b[_0xbbda('0x13')],_0x40adad);_0x28d94e(_0xd58091[_0xbbda('0x11')](0x1f4,_0x15147b[_0xbbda('0x13')]));});});}; \ No newline at end of file +var _0x28f5=['body','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./cmContact.socket','request','then','CmContact,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','ShowCmContact','CmContact','find','options','where','attributes','include','model','map','stringify','CreateCmContact'];(function(_0x29782b,_0x33ff83){var _0x5c2c1f=function(_0x57e6b6){while(--_0x57e6b6){_0x29782b['push'](_0x29782b['shift']());}};_0x5c2c1f(++_0x33ff83);}(_0x28f5,0x132));var _0x528f=function(_0x44e9c7,_0x13df42){_0x44e9c7=_0x44e9c7-0x0;var _0x57c0ea=_0x28f5[_0x44e9c7];return _0x57c0ea;};'use strict';var _=require('lodash');var util=require(_0x528f('0x0'));var moment=require(_0x528f('0x1'));var BPromise=require(_0x528f('0x2'));var rs=require(_0x528f('0x3'));var fs=require('fs');var db=require(_0x528f('0x4'))['db'];var utils=require(_0x528f('0x5'));var logger=require(_0x528f('0x6'))(_0x528f('0x7'));var config=require(_0x528f('0x8'));var jayson=require(_0x528f('0x9'));var client=jayson[_0x528f('0xa')][_0x528f('0xb')]({'port':0x232a});var socket=require(_0x528f('0xc'))({'host':_0x528f('0xd'),'port':0x18eb});require(_0x528f('0xe'))['register'](socket);function respondWithRpcPromise(_0x38740c,_0x3d1ae8,_0x111078){return new BPromise(function(_0x34ecfe,_0x48f99b){return client[_0x528f('0xf')](_0x38740c,_0x111078)[_0x528f('0x10')](function(_0x5da577){logger['info'](_0x528f('0x11'),_0x3d1ae8,_0x528f('0x12'));logger[_0x528f('0x13')]('CmContact,\x20%s,\x20%s,\x20%s',_0x3d1ae8,_0x528f('0x12'),JSON['stringify'](_0x5da577));if(_0x5da577[_0x528f('0x14')]){if(_0x5da577[_0x528f('0x14')][_0x528f('0x15')]===0x1f4){logger[_0x528f('0x14')](_0x528f('0x11'),_0x3d1ae8,_0x5da577[_0x528f('0x14')][_0x528f('0x16')]);return _0x48f99b(_0x5da577['error'][_0x528f('0x16')]);}logger['error'](_0x528f('0x11'),_0x3d1ae8,_0x5da577[_0x528f('0x14')][_0x528f('0x16')]);return _0x34ecfe(_0x5da577[_0x528f('0x14')]['message']);}else{logger[_0x528f('0x17')](_0x528f('0x11'),_0x3d1ae8,_0x528f('0x12'));_0x34ecfe(_0x5da577['result']['message']);}})[_0x528f('0x18')](function(_0x522764){logger[_0x528f('0x14')](_0x528f('0x11'),_0x3d1ae8,_0x522764);_0x48f99b(_0x522764);});});}exports[_0x528f('0x19')]=function(_0x558d1e){var _0x2b9a84=this;return new Promise(function(_0xdf217d,_0x567339){return db[_0x528f('0x1a')][_0x528f('0x1b')]({'raw':_0x558d1e[_0x528f('0x1c')]?_0x558d1e[_0x528f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x558d1e[_0x528f('0x1c')]?_0x558d1e[_0x528f('0x1c')][_0x528f('0x1d')]||null:null,'attributes':_0x558d1e[_0x528f('0x1c')]?_0x558d1e[_0x528f('0x1c')][_0x528f('0x1e')]||null:null,'include':_0x558d1e[_0x528f('0x1c')]?_0x558d1e['options']['include']?_['map'](_0x558d1e['options'][_0x528f('0x1f')],function(_0x28328c){return{'model':db[_0x28328c[_0x528f('0x20')]],'as':_0x28328c['as'],'attributes':_0x28328c['attributes'],'include':_0x28328c[_0x528f('0x1f')]?_[_0x528f('0x21')](_0x28328c[_0x528f('0x1f')],function(_0x222338){return{'model':db[_0x222338[_0x528f('0x20')]],'as':_0x222338['as'],'attributes':_0x222338['attributes'],'include':_0x222338[_0x528f('0x1f')]?_[_0x528f('0x21')](_0x222338[_0x528f('0x1f')],function(_0x801baf){return{'model':db[_0x801baf['model']],'as':_0x801baf['as'],'attributes':_0x801baf[_0x528f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x528f('0x10')](function(_0x1b5326){logger['info'](_0x528f('0x19'),_0x558d1e);logger[_0x528f('0x13')](_0x528f('0x19'),_0x558d1e,JSON[_0x528f('0x22')](_0x1b5326));_0xdf217d(_0x1b5326);})[_0x528f('0x18')](function(_0x5f5c5a){logger[_0x528f('0x14')](_0x528f('0x19'),_0x5f5c5a['message'],_0x558d1e);_0x567339(_0x2b9a84[_0x528f('0x14')](0x1f4,_0x5f5c5a[_0x528f('0x16')]));});});};exports[_0x528f('0x23')]=function(_0x3cfa4d){var _0x52a95e=this;return new Promise(function(_0x13c283,_0xc837cb){return db['CmContact']['create'](_0x3cfa4d[_0x528f('0x24')],{'raw':_0x3cfa4d[_0x528f('0x1c')]?_0x3cfa4d[_0x528f('0x1c')][_0x528f('0x25')]===undefined?!![]:![]:!![]})['then'](function(_0x1ed15c){logger[_0x528f('0x17')]('CreateCmContact',_0x3cfa4d);logger[_0x528f('0x13')](_0x528f('0x23'),_0x3cfa4d,JSON['stringify'](_0x1ed15c));_0x13c283(_0x1ed15c);})[_0x528f('0x18')](function(_0x3f0b53){logger['error'](_0x528f('0x23'),_0x3f0b53[_0x528f('0x16')],_0x3cfa4d);_0xc837cb(_0x52a95e[_0x528f('0x14')](0x1f4,_0x3f0b53[_0x528f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.socket.js b/server/api/cmContact/cmContact.socket.js index adf06d0..ec5382d 100644 --- a/server/api/cmContact/cmContact.socket.js +++ b/server/api/cmContact/cmContact.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf021=['update','length','cmContact:','./cmContact.events','save','remove'];(function(_0x210ccc,_0x18a85a){var _0x334164=function(_0x2fd28a){while(--_0x2fd28a){_0x210ccc['push'](_0x210ccc['shift']());}};_0x334164(++_0x18a85a);}(_0xf021,0x18f));var _0x1f02=function(_0x67655b,_0x15ff31){_0x67655b=_0x67655b-0x0;var _0x71c09d=_0xf021[_0x67655b];return _0x71c09d;};'use strict';var CmContactEvents=require(_0x1f02('0x0'));var events=[_0x1f02('0x1'),_0x1f02('0x2'),_0x1f02('0x3')];function createListener(_0x30184d,_0x53cc42){return function(_0x1027d2){_0x53cc42['emit'](_0x30184d,_0x1027d2);};}function removeListener(_0x2e8594,_0x3164f0){return function(){CmContactEvents['removeListener'](_0x2e8594,_0x3164f0);};}exports['register']=function(_0x84a8f0){for(var _0x56b275=0x0,_0x383d0b=events[_0x1f02('0x4')];_0x56b275<_0x383d0b;_0x56b275++){var _0x2a6c50=events[_0x56b275];var _0x4193d2=createListener(_0x1f02('0x5')+_0x2a6c50,_0x84a8f0);CmContactEvents['on'](_0x2a6c50,_0x4193d2);}}; \ No newline at end of file +var _0x4491=['remove','emit','register','length','cmContact:','./cmContact.events'];(function(_0x14e244,_0x1e1445){var _0xeaa5b6=function(_0x571563){while(--_0x571563){_0x14e244['push'](_0x14e244['shift']());}};_0xeaa5b6(++_0x1e1445);}(_0x4491,0x1bb));var _0x1449=function(_0x4cec57,_0x98c58a){_0x4cec57=_0x4cec57-0x0;var _0x18b817=_0x4491[_0x4cec57];return _0x18b817;};'use strict';var CmContactEvents=require(_0x1449('0x0'));var events=['save',_0x1449('0x1'),'update'];function createListener(_0x4273ee,_0x176880){return function(_0x45474c){_0x176880[_0x1449('0x2')](_0x4273ee,_0x45474c);};}function removeListener(_0x1ff47f,_0x1b2870){return function(){CmContactEvents['removeListener'](_0x1ff47f,_0x1b2870);};}exports[_0x1449('0x3')]=function(_0x557482){for(var _0x1d45eb=0x0,_0x5dfe4c=events[_0x1449('0x4')];_0x1d45eb<_0x5dfe4c;_0x1d45eb++){var _0x2f4189=events[_0x1d45eb];var _0x10e119=createListener(_0x1449('0x5')+_0x2f4189,_0x557482);CmContactEvents['on'](_0x2f4189,_0x10e119);}}; \ No newline at end of file diff --git a/server/api/cmContact/index.js b/server/api/cmContact/index.js index 295fb94..00b8f17 100644 --- a/server/api/cmContact/index.js +++ b/server/api/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d53=['format','%s-%s%s','basename','extname','originalname','/csv','single','file','uploadCsv','now','/upload','upload','/upload/:id','import','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','index','get','isAuthenticated','describe','/:id','show','getTags','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','/create_many','/:id/tags','diskStorage','join','root','server/files/tmp','replace'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x0d53,0x19a));var _0x30d5=function(_0x1b6a58,_0x4e9924){_0x1b6a58=_0x1b6a58-0x0;var _0x5d1f07=_0x0d53[_0x1b6a58];return _0x5d1f07;};'use strict';var multer=require('multer');var util=require(_0x30d5('0x0'));var path=require(_0x30d5('0x1'));var express=require(_0x30d5('0x2'));var router=express[_0x30d5('0x3')]();var auth=require(_0x30d5('0x4'));var interaction=require(_0x30d5('0x5'));var config=require(_0x30d5('0x6'));var controller=require(_0x30d5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x30d5('0x8')]);router[_0x30d5('0x9')]('/describe',auth[_0x30d5('0xa')](),controller[_0x30d5('0xb')]);router[_0x30d5('0x9')](_0x30d5('0xc'),auth[_0x30d5('0xa')](),controller[_0x30d5('0xd')]);router[_0x30d5('0x9')]('/:id/tags',auth[_0x30d5('0xa')](),controller[_0x30d5('0xe')]);router[_0x30d5('0x9')]('/:id/hoppers',auth[_0x30d5('0xa')](),controller[_0x30d5('0xf')]);router[_0x30d5('0x9')](_0x30d5('0x10'),auth[_0x30d5('0xa')](),controller[_0x30d5('0x11')]);router[_0x30d5('0x9')](_0x30d5('0x12'),auth[_0x30d5('0xa')](),controller[_0x30d5('0x13')]);router['get'](_0x30d5('0x14'),auth[_0x30d5('0xa')](),controller[_0x30d5('0x15')]);router[_0x30d5('0x16')](_0x30d5('0x17'),auth[_0x30d5('0xa')](),controller['merge']);router[_0x30d5('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x30d5('0x16')](_0x30d5('0x18'),auth[_0x30d5('0xa')](),controller['bulkCreate']);router[_0x30d5('0x16')](_0x30d5('0x19'),auth[_0x30d5('0xa')](),controller['setTags']);var upload=multer({'storage':multer[_0x30d5('0x1a')]({'destination':function(_0x5e1786,_0x13573a,_0x3b63ee){_0x3b63ee(null,path[_0x30d5('0x1b')](config[_0x30d5('0x1c')],_0x30d5('0x1d')));},'filename':function(_0x167279,_0x4ad9e1,_0x1de1a0){_0x4ad9e1['originalname']=_0x4ad9e1['originalname'][_0x30d5('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1de1a0(null,util[_0x30d5('0x1f')](_0x30d5('0x20'),path[_0x30d5('0x21')](_0x4ad9e1['originalname'],path[_0x30d5('0x22')](_0x4ad9e1[_0x30d5('0x23')])),Date['now'](),path[_0x30d5('0x22')](_0x4ad9e1[_0x30d5('0x23')])));}})});router[_0x30d5('0x16')](_0x30d5('0x24'),upload[_0x30d5('0x25')](_0x30d5('0x26')),controller[_0x30d5('0x27')]);var upload=multer({'storage':multer[_0x30d5('0x1a')]({'destination':function(_0x29d0e7,_0x18a1ed,_0x331edf){_0x331edf(null,path[_0x30d5('0x1b')](config[_0x30d5('0x1c')],_0x30d5('0x1d')));},'filename':function(_0x15ef52,_0x3fc02d,_0x4e83fa){_0x3fc02d[_0x30d5('0x23')]=_0x3fc02d['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e83fa(null,util['format']('%s-%s%s',path[_0x30d5('0x21')](_0x3fc02d[_0x30d5('0x23')],path[_0x30d5('0x22')](_0x3fc02d[_0x30d5('0x23')])),Date[_0x30d5('0x28')](),path[_0x30d5('0x22')](_0x3fc02d[_0x30d5('0x23')])));}})});router['post'](_0x30d5('0x29'),upload[_0x30d5('0x25')](_0x30d5('0x26')),controller[_0x30d5('0x2a')]);router['post'](_0x30d5('0x2b'),auth[_0x30d5('0xa')](),controller[_0x30d5('0x2c')]);router[_0x30d5('0x2d')](_0x30d5('0xc'),auth[_0x30d5('0xa')](),controller[_0x30d5('0x2e')]);router[_0x30d5('0x2f')]('/:id',auth[_0x30d5('0xa')](),controller['destroy']);module[_0x30d5('0x30')]=router; \ No newline at end of file +var _0x4693=['basename','extname','/csv','single','diskStorage','/upload','upload','import','put','update','delete','destroy','exports','multer','express','Router','../../components/interaction/service','./cmContact.controller','get','index','isAuthenticated','describe','/:id','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','post','/merge','create','bulkCreate','setTags','join','root','server/files/tmp','originalname','replace','format','%s-%s%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4693,0xe4));var _0x3469=function(_0x433dbb,_0x5da3e3){_0x433dbb=_0x433dbb-0x0;var _0x3305c6=_0x4693[_0x433dbb];return _0x3305c6;};'use strict';var multer=require(_0x3469('0x0'));var util=require('util');var path=require('path');var express=require(_0x3469('0x1'));var router=express[_0x3469('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3469('0x3'));var config=require('../../config/environment');var controller=require(_0x3469('0x4'));router[_0x3469('0x5')]('/',auth['isAuthenticated'](),controller[_0x3469('0x6')]);router[_0x3469('0x5')]('/describe',auth[_0x3469('0x7')](),controller[_0x3469('0x8')]);router['get'](_0x3469('0x9'),auth[_0x3469('0x7')](),controller['show']);router['get'](_0x3469('0xa'),auth[_0x3469('0x7')](),controller[_0x3469('0xb')]);router[_0x3469('0x5')](_0x3469('0xc'),auth['isAuthenticated'](),controller[_0x3469('0xd')]);router[_0x3469('0x5')](_0x3469('0xe'),auth[_0x3469('0x7')](),controller[_0x3469('0xf')]);router[_0x3469('0x5')](_0x3469('0x10'),auth[_0x3469('0x7')](),controller[_0x3469('0x11')]);router[_0x3469('0x5')]('/:id/jscripty_sessions',auth[_0x3469('0x7')](),controller['getJscriptySessions']);router[_0x3469('0x12')](_0x3469('0x13'),auth[_0x3469('0x7')](),controller['merge']);router[_0x3469('0x12')]('/',auth[_0x3469('0x7')](),controller[_0x3469('0x14')]);router['post']('/create_many',auth[_0x3469('0x7')](),controller[_0x3469('0x15')]);router[_0x3469('0x12')]('/:id/tags',auth[_0x3469('0x7')](),controller[_0x3469('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28f1ae,_0x93ea6f,_0x3977a4){_0x3977a4(null,path[_0x3469('0x17')](config[_0x3469('0x18')],_0x3469('0x19')));},'filename':function(_0x412d81,_0x132f66,_0x11da62){_0x132f66[_0x3469('0x1a')]=_0x132f66[_0x3469('0x1a')][_0x3469('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x11da62(null,util[_0x3469('0x1c')](_0x3469('0x1d'),path[_0x3469('0x1e')](_0x132f66['originalname'],path['extname'](_0x132f66['originalname'])),Date['now'](),path[_0x3469('0x1f')](_0x132f66[_0x3469('0x1a')])));}})});router[_0x3469('0x12')](_0x3469('0x20'),upload[_0x3469('0x21')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0x3469('0x22')]({'destination':function(_0xbbdb63,_0x5e2ae8,_0xa12101){_0xa12101(null,path[_0x3469('0x17')](config[_0x3469('0x18')],_0x3469('0x19')));},'filename':function(_0x2d7031,_0x492c4b,_0x57ee28){_0x492c4b['originalname']=_0x492c4b[_0x3469('0x1a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57ee28(null,util['format'](_0x3469('0x1d'),path[_0x3469('0x1e')](_0x492c4b[_0x3469('0x1a')],path[_0x3469('0x1f')](_0x492c4b[_0x3469('0x1a')])),Date['now'](),path[_0x3469('0x1f')](_0x492c4b[_0x3469('0x1a')])));}})});router[_0x3469('0x12')](_0x3469('0x23'),upload[_0x3469('0x21')]('file'),controller[_0x3469('0x24')]);router['post']('/upload/:id',auth[_0x3469('0x7')](),controller[_0x3469('0x25')]);router[_0x3469('0x26')](_0x3469('0x9'),auth['isAuthenticated'](),controller[_0x3469('0x27')]);router[_0x3469('0x28')](_0x3469('0x9'),auth[_0x3469('0x7')](),controller[_0x3469('0x29')]);module[_0x3469('0x2a')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b95c10c..bc7d998 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 _0x91b6=['select','values','isArray','stringify','sequelize','lodash','getDataValue','alias','STRING','setDataValue','TEXT'];(function(_0x34d2b9,_0x5a44b2){var _0x500f67=function(_0x476c5d){while(--_0x476c5d){_0x34d2b9['push'](_0x34d2b9['shift']());}};_0x500f67(++_0x5a44b2);}(_0x91b6,0x14e));var _0x691b=function(_0x131e8a,_0x5eb754){_0x131e8a=_0x131e8a-0x0;var _0x2165ea=_0x91b6[_0x131e8a];return _0x2165ea;};'use strict';var Sequelize=require(_0x691b('0x0'));var _=require(_0x691b('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x152f78){return this[_0x691b('0x2')](_0x691b('0x3'));}},'alias':{'type':Sequelize[_0x691b('0x4')],'allowNull':![],'set':function(_0x49b436){this[_0x691b('0x5')](_0x691b('0x3'),_0x49b436?_0x49b436:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x691b('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x691b('0x6')]('long'),'get':function(){if(this[_0x691b('0x2')]('type')===_0x691b('0x7')){return JSON['parse'](this[_0x691b('0x2')](_0x691b('0x8')));}else{return this[_0x691b('0x2')](_0x691b('0x8'));}},'set':function(_0x2f9595){if(Array[_0x691b('0x9')](_0x2f9595)){this[_0x691b('0x5')](_0x691b('0x8'),JSON[_0x691b('0xa')](_0x2f9595));}else{this[_0x691b('0x5')](_0x691b('0x8'),_0x2f9595);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcefc=['values','isArray','stringify','sequelize','lodash','exports','VIRTUAL','getDataValue','setDataValue','alias','name','STRING','TEXT','type','select','parse'];(function(_0x28a6bc,_0x3c878c){var _0x2f130e=function(_0x6e79eb){while(--_0x6e79eb){_0x28a6bc['push'](_0x28a6bc['shift']());}};_0x2f130e(++_0x3c878c);}(_0xcefc,0x163));var _0xccef=function(_0x24d499,_0xf84f25){_0x24d499=_0x24d499-0x0;var _0x1af911=_0xcefc[_0x24d499];return _0x1af911;};'use strict';var Sequelize=require(_0xccef('0x0'));var _=require(_0xccef('0x1'));module[_0xccef('0x2')]={'name':{'type':Sequelize[_0xccef('0x3')],'get':function(_0x55b1b8){return this[_0xccef('0x4')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3c5e2e){this[_0xccef('0x5')](_0xccef('0x6'),_0x3c5e2e?_0x3c5e2e:this[_0xccef('0x4')](_0xccef('0x7')));}},'type':{'type':Sequelize[_0xccef('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0xccef('0x9')]('long'),'get':function(){if(this[_0xccef('0x4')](_0xccef('0xa'))===_0xccef('0xb')){return JSON[_0xccef('0xc')](this[_0xccef('0x4')](_0xccef('0xd')));}else{return this[_0xccef('0x4')](_0xccef('0xd'));}},'set':function(_0x3f688a){if(Array[_0xccef('0xe')](_0x3f688a)){this[_0xccef('0x5')](_0xccef('0xd'),JSON[_0xccef('0xf')](_0x3f688a));}else{this[_0xccef('0x5')](_0xccef('0xd'),_0x3f688a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 8ef7d27..36cf7b4 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 _0x59c3=['then','destroy','error','stack','name','send','index','rawAttributes','model','differenceBy','query','dateStart','dateEnd','keys','attributes','fields','length','limit','order','sort','where','filters','pick','add','day','filter','merge','map','options','CmCustomField','count','includeAll','include','findAll','catch','show','params','intersection','body','find','sequelize','transaction','create','Sequelize','TEXT','type','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update'];(function(_0x172d16,_0x447212){var _0x4197c9=function(_0x59edb9){while(--_0x59edb9){_0x172d16['push'](_0x172d16['shift']());}};_0x4197c9(++_0x447212);}(_0x59c3,0x133));var _0x359c=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x59c3[_0x24237f];return _0x48298e;};'use strict';var jsonpatch=require(_0x359c('0x0'));var rp=require(_0x359c('0x1'));var moment=require(_0x359c('0x2'));var BPromise=require(_0x359c('0x3'));var Mustache=require(_0x359c('0x4'));var util=require(_0x359c('0x5'));var path=require('path');var sox=require(_0x359c('0x6'));var csv=require(_0x359c('0x7'));var ejs=require(_0x359c('0x8'));var fs=require('fs');var _=require(_0x359c('0x9'));var squel=require(_0x359c('0xa'));var crypto=require(_0x359c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x359c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x359c('0xd'));var Papa=require(_0x359c('0xe'));var qs=require(_0x359c('0xf'));var logger=require(_0x359c('0x10'))('api');var utils=require(_0x359c('0x11'));var config=require('../../config/environment');var db=require(_0x359c('0x12'))['db'];function respondWithStatusCode(_0x1d7417,_0xb48a01){_0xb48a01=_0xb48a01||0xcc;return function(_0x134c91){if(_0x134c91){return _0x1d7417[_0x359c('0x13')](_0xb48a01);}return _0x1d7417[_0x359c('0x14')](_0xb48a01)['end']();};}function respondWithResult(_0x17943b,_0x804090){_0x804090=_0x804090||0xc8;return function(_0x4361a1){if(_0x4361a1){return _0x17943b[_0x359c('0x14')](_0x804090)[_0x359c('0x15')](_0x4361a1);}};}function respondWithFilteredResult(_0x29d295,_0x1a9d72){return function(_0x246dc1){if(_0x246dc1){var _0x3a73ca=_0x246dc1['count'],_0x4413ce=_0x1a9d72[_0x359c('0x16')],_0x2cf668=_0x1a9d72[_0x359c('0x16')]+_0x1a9d72['limit'],_0xd07946;if(_0x2cf668>=_0x3a73ca){_0x2cf668=_0x3a73ca;_0xd07946=0xc8;}else{_0xd07946=0xce;}_0x29d295[_0x359c('0x14')](_0xd07946);return _0x29d295[_0x359c('0x17')](_0x359c('0x18'),_0x4413ce+'-'+_0x2cf668+'/'+_0x3a73ca)[_0x359c('0x15')](_0x246dc1);}return null;};}function patchUpdates(_0x421bab){return function(_0x2e72c8){try{jsonpatch[_0x359c('0x19')](_0x2e72c8,_0x421bab,!![]);}catch(_0x3a6249){return BPromise[_0x359c('0x1a')](_0x3a6249);}return _0x2e72c8[_0x359c('0x1b')]();};}function saveUpdates(_0x2bdd3c,_0x2ae8ee){return function(_0x6fa3c0){if(_0x6fa3c0){return _0x6fa3c0[_0x359c('0x1c')](_0x2bdd3c)[_0x359c('0x1d')](function(_0x457302){return _0x457302;});}return null;};}function removeEntity(_0x25f0fd,_0x242ee3){return function(_0x57189a){if(_0x57189a){return _0x57189a[_0x359c('0x1e')]()['then'](function(){_0x25f0fd[_0x359c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1acb73,_0x23efb2){return function(_0x34f747){if(!_0x34f747){_0x1acb73[_0x359c('0x13')](0x194);}return _0x34f747;};}function handleError(_0x6e731c,_0x2d90a4){_0x2d90a4=_0x2d90a4||0x1f4;return function(_0x1c6650){logger[_0x359c('0x1f')](_0x1c6650[_0x359c('0x20')]);if(_0x1c6650[_0x359c('0x21')]){delete _0x1c6650[_0x359c('0x21')];}_0x6e731c[_0x359c('0x14')](_0x2d90a4)[_0x359c('0x22')](_0x1c6650);};}exports[_0x359c('0x23')]=function(_0x33318f,_0xf6f24){var _0x4fbc28={},_0xf0770b={},_0xd1ea73={'count':0x0,'rows':[]};var _0x35569d=db['CmCustomField'][_0x359c('0x24')];_0xf0770b[_0x359c('0x25')]=_[_0x359c('0x26')](_['keys'](_0x35569d),[_0x359c('0x21')]);var _0x5bfb51={'dateStart':_0x33318f[_0x359c('0x27')][_0x359c('0x28')],'dateEnd':_0x33318f[_0x359c('0x27')][_0x359c('0x29')]};delete _0x33318f['query'][_0x359c('0x28')];delete _0x33318f[_0x359c('0x27')][_0x359c('0x29')];_0xf0770b[_0x359c('0x27')]=_[_0x359c('0x2a')](_0x33318f[_0x359c('0x27')]);_0xf0770b['filters']=_['intersection'](_0xf0770b['model'],_0xf0770b[_0x359c('0x27')]);_0x4fbc28[_0x359c('0x2b')]=_['intersection'](_0xf0770b[_0x359c('0x25')],qs[_0x359c('0x2c')](_0x33318f[_0x359c('0x27')][_0x359c('0x2c')]));_0x4fbc28[_0x359c('0x2b')]=_0x4fbc28['attributes'][_0x359c('0x2d')]?_0x4fbc28[_0x359c('0x2b')]:_0xf0770b[_0x359c('0x25')];if(!_0x33318f['query']['hasOwnProperty']('nolimit')){_0x4fbc28[_0x359c('0x2e')]=qs[_0x359c('0x2e')](_0x33318f['query'][_0x359c('0x2e')]);_0x4fbc28[_0x359c('0x16')]=qs[_0x359c('0x16')](_0x33318f[_0x359c('0x27')][_0x359c('0x16')]);}_0x4fbc28[_0x359c('0x2f')]=qs['sort'](_0x33318f[_0x359c('0x27')][_0x359c('0x30')]);_0x4fbc28[_0x359c('0x31')]=qs[_0x359c('0x32')](_[_0x359c('0x33')](_0x33318f[_0x359c('0x27')],_0xf0770b['filters']));if(_0x5bfb51[_0x359c('0x28')]){if(_0x5bfb51['dateEnd']){_0x5bfb51['dateEnd']=moment(_0x5bfb51[_0x359c('0x29')])[_0x359c('0x34')](0x1,'day');}else{_0x5bfb51[_0x359c('0x29')]=moment(_0x5bfb51[_0x359c('0x28')])[_0x359c('0x34')](0x1,_0x359c('0x35'));}_['merge'](_0x4fbc28[_0x359c('0x31')],{'createdAt':{'$gte':_0x5bfb51[_0x359c('0x28')],'$lte':_0x5bfb51[_0x359c('0x29')]}});}if(_0x33318f['query'][_0x359c('0x36')]){_0x4fbc28['where']=_[_0x359c('0x37')](_0x4fbc28['where'],{'$or':_[_0x359c('0x38')](_0x4fbc28[_0x359c('0x2b')],function(_0x484f90){var _0x5a04e1={};_0x5a04e1[_0x484f90]={'$like':'%'+_0x33318f[_0x359c('0x27')][_0x359c('0x36')]+'%'};return _0x5a04e1;})});}_0x4fbc28=_[_0x359c('0x37')]({},_0x4fbc28,_0x33318f[_0x359c('0x39')]);var _0x43b07d={'where':_0x4fbc28[_0x359c('0x31')]};return db[_0x359c('0x3a')][_0x359c('0x3b')](_0x43b07d)['then'](function(_0x169289){_0xd1ea73[_0x359c('0x3b')]=_0x169289;if(_0x33318f[_0x359c('0x27')][_0x359c('0x3c')]){_0x4fbc28[_0x359c('0x3d')]=[{'all':!![]}];}return db[_0x359c('0x3a')][_0x359c('0x3e')](_0x4fbc28);})[_0x359c('0x1d')](function(_0xa9a7b0){_0xd1ea73['rows']=_0xa9a7b0;return _0xd1ea73;})[_0x359c('0x1d')](respondWithFilteredResult(_0xf6f24,_0x4fbc28))[_0x359c('0x3f')](handleError(_0xf6f24,null));};exports[_0x359c('0x40')]=function(_0x431d4e,_0x3e5284){var _0x3abcc4={'raw':!![],'where':{'id':_0x431d4e[_0x359c('0x41')]['id']}},_0x55f48a={};_0x55f48a['model']=_[_0x359c('0x2a')](db['CmCustomField']['rawAttributes']);_0x55f48a[_0x359c('0x27')]=_[_0x359c('0x2a')](_0x431d4e[_0x359c('0x27')]);_0x55f48a['filters']=_[_0x359c('0x42')](_0x55f48a[_0x359c('0x25')],_0x55f48a[_0x359c('0x27')]);_0x3abcc4['attributes']=_[_0x359c('0x42')](_0x55f48a[_0x359c('0x25')],qs['fields'](_0x431d4e[_0x359c('0x27')][_0x359c('0x2c')]));_0x3abcc4['attributes']=_0x3abcc4[_0x359c('0x2b')][_0x359c('0x2d')]?_0x3abcc4['attributes']:_0x55f48a['model'];if(_0x431d4e[_0x359c('0x27')][_0x359c('0x3c')]){_0x3abcc4[_0x359c('0x3d')]=[{'all':!![]}];}_0x3abcc4=_[_0x359c('0x37')]({},_0x3abcc4,_0x431d4e['options']);return db['CmCustomField']['find'](_0x3abcc4)[_0x359c('0x1d')](handleEntityNotFound(_0x3e5284,null))[_0x359c('0x1d')](respondWithResult(_0x3e5284,null))[_0x359c('0x3f')](handleError(_0x3e5284,null));};exports[_0x359c('0x1c')]=function(_0x3d7ce1,_0x323dc3){if(_0x3d7ce1[_0x359c('0x43')]['id']){delete _0x3d7ce1[_0x359c('0x43')]['id'];}return db[_0x359c('0x3a')][_0x359c('0x44')]({'where':{'id':_0x3d7ce1['params']['id']}})[_0x359c('0x1d')](handleEntityNotFound(_0x323dc3,null))[_0x359c('0x1d')](saveUpdates(_0x3d7ce1[_0x359c('0x43')],null))[_0x359c('0x1d')](respondWithResult(_0x323dc3,null))[_0x359c('0x3f')](handleError(_0x323dc3,null));};exports[_0x359c('0x1e')]=function(_0x48ea78,_0x51eb7b){return db[_0x359c('0x3a')][_0x359c('0x44')]({'where':{'id':_0x48ea78[_0x359c('0x41')]['id']}})['then'](handleEntityNotFound(_0x51eb7b,null))[_0x359c('0x1d')](removeEntity(_0x51eb7b,null))['catch'](handleError(_0x51eb7b,null));};exports['create']=function(_0x4490fc,_0x15f83f){var _0x5df068;return db[_0x359c('0x45')][_0x359c('0x46')](function(_0x536d81){return db[_0x359c('0x3a')][_0x359c('0x47')](_0x4490fc['body'],{'transaction':_0x536d81})[_0x359c('0x1d')](function(_0x4cc992){_0x5df068=_0x4cc992;var _0x15839a={'type':db[_0x359c('0x48')][_0x359c('0x49')],'transaction':_0x536d81};switch(_0x4490fc['body'][_0x359c('0x4a')]){case _0x359c('0x4b'):_0x15839a[_0x359c('0x4a')]=db[_0x359c('0x48')][_0x359c('0x49')];break;case _0x359c('0x4c'):_0x15839a['type']=db[_0x359c('0x48')][_0x359c('0x4d')];break;case'switch':_0x15839a[_0x359c('0x4a')]=db[_0x359c('0x48')][_0x359c('0x4e')];_0x15839a[_0x359c('0x4f')]=![];break;default:}return db[_0x359c('0x45')][_0x359c('0x50')]['addColumn'](_0x359c('0x51'),util[_0x359c('0x52')](_0x359c('0x53'),_0x5df068['id']),_0x15839a);})[_0x359c('0x1d')](function(){return _0x5df068;});})['then'](respondWithResult(_0x15f83f,0xc9))[_0x359c('0x3f')](handleError(_0x15f83f,null));}; \ No newline at end of file +var _0x1061=['rawAttributes','differenceBy','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','length','hasOwnProperty','sort','where','merge','map','filter','includeAll','rows','catch','show','params','fields','include','options','find','body','create','sequelize','transaction','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%d','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmCustomField'];(function(_0x158ab3,_0x4b5908){var _0x302830=function(_0x19fa14){while(--_0x19fa14){_0x158ab3['push'](_0x158ab3['shift']());}};_0x302830(++_0x4b5908);}(_0x1061,0x1b5));var _0x1106=function(_0x4845bc,_0x1d4ccb){_0x4845bc=_0x4845bc-0x0;var _0xb026b6=_0x1061[_0x4845bc];return _0xb026b6;};'use strict';var jsonpatch=require(_0x1106('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1106('0x1'));var util=require(_0x1106('0x2'));var path=require(_0x1106('0x3'));var sox=require(_0x1106('0x4'));var csv=require(_0x1106('0x5'));var ejs=require(_0x1106('0x6'));var fs=require('fs');var _=require(_0x1106('0x7'));var squel=require(_0x1106('0x8'));var crypto=require('crypto');var jsforce=require(_0x1106('0x9'));var deskjs=require(_0x1106('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1106('0xb'));var qs=require(_0x1106('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x1106('0xd'));var config=require(_0x1106('0xe'));var db=require(_0x1106('0xf'))['db'];function respondWithStatusCode(_0x3f940e,_0x456967){_0x456967=_0x456967||0xcc;return function(_0x2f9a44){if(_0x2f9a44){return _0x3f940e[_0x1106('0x10')](_0x456967);}return _0x3f940e[_0x1106('0x11')](_0x456967)[_0x1106('0x12')]();};}function respondWithResult(_0x125485,_0x4b9254){_0x4b9254=_0x4b9254||0xc8;return function(_0x2151f1){if(_0x2151f1){return _0x125485[_0x1106('0x11')](_0x4b9254)[_0x1106('0x13')](_0x2151f1);}};}function respondWithFilteredResult(_0x236dee,_0x216243){return function(_0x2c11e9){if(_0x2c11e9){var _0x3fee67=_0x2c11e9[_0x1106('0x14')],_0x1ce9d4=_0x216243[_0x1106('0x15')],_0x17a4ec=_0x216243[_0x1106('0x15')]+_0x216243[_0x1106('0x16')],_0x6dff51;if(_0x17a4ec>=_0x3fee67){_0x17a4ec=_0x3fee67;_0x6dff51=0xc8;}else{_0x6dff51=0xce;}_0x236dee[_0x1106('0x11')](_0x6dff51);return _0x236dee[_0x1106('0x17')](_0x1106('0x18'),_0x1ce9d4+'-'+_0x17a4ec+'/'+_0x3fee67)[_0x1106('0x13')](_0x2c11e9);}return null;};}function patchUpdates(_0x547ca3){return function(_0x5a2a61){try{jsonpatch[_0x1106('0x19')](_0x5a2a61,_0x547ca3,!![]);}catch(_0x3f2b84){return BPromise[_0x1106('0x1a')](_0x3f2b84);}return _0x5a2a61[_0x1106('0x1b')]();};}function saveUpdates(_0x5be7fc,_0x2c8ff5){return function(_0x3e4b0c){if(_0x3e4b0c){return _0x3e4b0c[_0x1106('0x1c')](_0x5be7fc)[_0x1106('0x1d')](function(_0x3b18a5){return _0x3b18a5;});}return null;};}function removeEntity(_0x39e6cc,_0xc7fccb){return function(_0x1cfc45){if(_0x1cfc45){return _0x1cfc45[_0x1106('0x1e')]()['then'](function(){_0x39e6cc[_0x1106('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ecb75,_0x53d2d9){return function(_0x54f17b){if(!_0x54f17b){_0x2ecb75[_0x1106('0x10')](0x194);}return _0x54f17b;};}function handleError(_0x5af16a,_0x4418d9){_0x4418d9=_0x4418d9||0x1f4;return function(_0xfd250d){logger[_0x1106('0x1f')](_0xfd250d[_0x1106('0x20')]);if(_0xfd250d[_0x1106('0x21')]){delete _0xfd250d[_0x1106('0x21')];}_0x5af16a[_0x1106('0x11')](_0x4418d9)[_0x1106('0x22')](_0xfd250d);};}exports[_0x1106('0x23')]=function(_0xa39cac,_0x1ff815){var _0x55dcec={},_0x4dd4e9={},_0xac5be4={'count':0x0,'rows':[]};var _0xf19506=db[_0x1106('0x24')][_0x1106('0x25')];_0x4dd4e9['model']=_[_0x1106('0x26')](_[_0x1106('0x27')](_0xf19506),[_0x1106('0x21')]);var _0x32fdb5={'dateStart':_0xa39cac[_0x1106('0x28')][_0x1106('0x29')],'dateEnd':_0xa39cac[_0x1106('0x28')]['dateEnd']};delete _0xa39cac['query']['dateStart'];delete _0xa39cac[_0x1106('0x28')][_0x1106('0x2a')];_0x4dd4e9[_0x1106('0x28')]=_[_0x1106('0x27')](_0xa39cac[_0x1106('0x28')]);_0x4dd4e9[_0x1106('0x2b')]=_[_0x1106('0x2c')](_0x4dd4e9[_0x1106('0x2d')],_0x4dd4e9[_0x1106('0x28')]);_0x55dcec[_0x1106('0x2e')]=_[_0x1106('0x2c')](_0x4dd4e9['model'],qs['fields'](_0xa39cac[_0x1106('0x28')]['fields']));_0x55dcec[_0x1106('0x2e')]=_0x55dcec[_0x1106('0x2e')][_0x1106('0x2f')]?_0x55dcec[_0x1106('0x2e')]:_0x4dd4e9[_0x1106('0x2d')];if(!_0xa39cac['query'][_0x1106('0x30')]('nolimit')){_0x55dcec[_0x1106('0x16')]=qs[_0x1106('0x16')](_0xa39cac[_0x1106('0x28')][_0x1106('0x16')]);_0x55dcec['offset']=qs[_0x1106('0x15')](_0xa39cac[_0x1106('0x28')][_0x1106('0x15')]);}_0x55dcec['order']=qs['sort'](_0xa39cac['query'][_0x1106('0x31')]);_0x55dcec[_0x1106('0x32')]=qs[_0x1106('0x2b')](_['pick'](_0xa39cac[_0x1106('0x28')],_0x4dd4e9['filters']));if(_0x32fdb5[_0x1106('0x29')]){if(_0x32fdb5[_0x1106('0x2a')]){_0x32fdb5[_0x1106('0x2a')]=moment(_0x32fdb5['dateEnd'])['add'](0x1,'day');}else{_0x32fdb5[_0x1106('0x2a')]=moment(_0x32fdb5['dateStart'])['add'](0x1,'day');}_[_0x1106('0x33')](_0x55dcec[_0x1106('0x32')],{'createdAt':{'$gte':_0x32fdb5[_0x1106('0x29')],'$lte':_0x32fdb5[_0x1106('0x2a')]}});}if(_0xa39cac['query']['filter']){_0x55dcec['where']=_[_0x1106('0x33')](_0x55dcec[_0x1106('0x32')],{'$or':_[_0x1106('0x34')](_0x55dcec['attributes'],function(_0x559d29){var _0x345662={};_0x345662[_0x559d29]={'$like':'%'+_0xa39cac[_0x1106('0x28')][_0x1106('0x35')]+'%'};return _0x345662;})});}_0x55dcec=_[_0x1106('0x33')]({},_0x55dcec,_0xa39cac['options']);var _0x3d540={'where':_0x55dcec['where']};return db[_0x1106('0x24')]['count'](_0x3d540)[_0x1106('0x1d')](function(_0x184648){_0xac5be4[_0x1106('0x14')]=_0x184648;if(_0xa39cac[_0x1106('0x28')][_0x1106('0x36')]){_0x55dcec['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x55dcec);})['then'](function(_0x177a2a){_0xac5be4[_0x1106('0x37')]=_0x177a2a;return _0xac5be4;})['then'](respondWithFilteredResult(_0x1ff815,_0x55dcec))[_0x1106('0x38')](handleError(_0x1ff815,null));};exports[_0x1106('0x39')]=function(_0x30bd0e,_0x730d25){var _0x253c95={'raw':!![],'where':{'id':_0x30bd0e[_0x1106('0x3a')]['id']}},_0x396b8f={};_0x396b8f[_0x1106('0x2d')]=_[_0x1106('0x27')](db[_0x1106('0x24')]['rawAttributes']);_0x396b8f[_0x1106('0x28')]=_[_0x1106('0x27')](_0x30bd0e[_0x1106('0x28')]);_0x396b8f[_0x1106('0x2b')]=_[_0x1106('0x2c')](_0x396b8f[_0x1106('0x2d')],_0x396b8f[_0x1106('0x28')]);_0x253c95[_0x1106('0x2e')]=_[_0x1106('0x2c')](_0x396b8f['model'],qs[_0x1106('0x3b')](_0x30bd0e[_0x1106('0x28')][_0x1106('0x3b')]));_0x253c95['attributes']=_0x253c95[_0x1106('0x2e')]['length']?_0x253c95[_0x1106('0x2e')]:_0x396b8f['model'];if(_0x30bd0e[_0x1106('0x28')][_0x1106('0x36')]){_0x253c95[_0x1106('0x3c')]=[{'all':!![]}];}_0x253c95=_[_0x1106('0x33')]({},_0x253c95,_0x30bd0e[_0x1106('0x3d')]);return db['CmCustomField'][_0x1106('0x3e')](_0x253c95)['then'](handleEntityNotFound(_0x730d25,null))[_0x1106('0x1d')](respondWithResult(_0x730d25,null))[_0x1106('0x38')](handleError(_0x730d25,null));};exports[_0x1106('0x1c')]=function(_0x1c75b9,_0x5198b9){if(_0x1c75b9[_0x1106('0x3f')]['id']){delete _0x1c75b9[_0x1106('0x3f')]['id'];}return db[_0x1106('0x24')][_0x1106('0x3e')]({'where':{'id':_0x1c75b9[_0x1106('0x3a')]['id']}})[_0x1106('0x1d')](handleEntityNotFound(_0x5198b9,null))[_0x1106('0x1d')](saveUpdates(_0x1c75b9[_0x1106('0x3f')],null))[_0x1106('0x1d')](respondWithResult(_0x5198b9,null))[_0x1106('0x38')](handleError(_0x5198b9,null));};exports[_0x1106('0x1e')]=function(_0x437fcd,_0x13afc0){return db[_0x1106('0x24')][_0x1106('0x3e')]({'where':{'id':_0x437fcd[_0x1106('0x3a')]['id']}})['then'](handleEntityNotFound(_0x13afc0,null))[_0x1106('0x1d')](removeEntity(_0x13afc0,null))[_0x1106('0x38')](handleError(_0x13afc0,null));};exports[_0x1106('0x40')]=function(_0x532aae,_0x5918c0){var _0x307761;return db[_0x1106('0x41')][_0x1106('0x42')](function(_0xc667df){return db[_0x1106('0x24')]['create'](_0x532aae[_0x1106('0x3f')],{'transaction':_0xc667df})[_0x1106('0x1d')](function(_0x56e334){_0x307761=_0x56e334;var _0x332b9f={'type':db[_0x1106('0x43')][_0x1106('0x44')],'transaction':_0xc667df};switch(_0x532aae[_0x1106('0x3f')][_0x1106('0x45')]){case _0x1106('0x46'):_0x332b9f[_0x1106('0x45')]=db['Sequelize'][_0x1106('0x44')];break;case _0x1106('0x47'):_0x332b9f['type']=db[_0x1106('0x43')][_0x1106('0x48')];break;case _0x1106('0x49'):_0x332b9f[_0x1106('0x45')]=db[_0x1106('0x43')][_0x1106('0x4a')];_0x332b9f[_0x1106('0x4b')]=![];break;default:}return db[_0x1106('0x41')][_0x1106('0x4c')]['addColumn'](_0x1106('0x4d'),util['format'](_0x1106('0x4e'),_0x307761['id']),_0x332b9f);})[_0x1106('0x1d')](function(){return _0x307761;});})['then'](respondWithResult(_0x5918c0,0xc9))[_0x1106('0x38')](handleError(_0x5918c0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6962861..66bdd42 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 _0xedb6=['./cmCustomField.attributes','CmCustomField','lodash','api','moment','bluebird','request-promise'];(function(_0x516bf4,_0x513818){var _0x47d87d=function(_0x237c4d){while(--_0x237c4d){_0x516bf4['push'](_0x516bf4['shift']());}};_0x47d87d(++_0x513818);}(_0xedb6,0x11a));var _0x6edb=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0xedb6[_0x28b0a4];return _0x105ce6;};'use strict';var _=require(_0x6edb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6edb('0x1'));var moment=require(_0x6edb('0x2'));var BPromise=require(_0x6edb('0x3'));var rp=require(_0x6edb('0x4'));var attributes=require(_0x6edb('0x5'));module['exports']=function(_0xdb275d,_0x3cc419){return _0xdb275d['define'](_0x6edb('0x6'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5716=['../../config/logger','api','moment','bluebird','request-promise','./cmCustomField.attributes','exports','cm_custom_fields','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5716,0x194));var _0x6571=function(_0xef4ef0,_0x3c72f9){_0xef4ef0=_0xef4ef0-0x0;var _0x39b60b=_0x5716[_0xef4ef0];return _0x39b60b;};'use strict';var _=require('lodash');var util=require(_0x6571('0x0'));var logger=require(_0x6571('0x1'))(_0x6571('0x2'));var moment=require(_0x6571('0x3'));var BPromise=require(_0x6571('0x4'));var rp=require(_0x6571('0x5'));var attributes=require(_0x6571('0x6'));module[_0x6571('0x7')]=function(_0x3e4967,_0xe207d6){return _0x3e4967['define']('CmCustomField',attributes,{'tableName':_0x6571('0x8'),'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 19ebc65..fcffecf 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 _0xd78f=['code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5e43d9,_0x28d012){var _0x230bfd=function(_0x25cb9f){while(--_0x25cb9f){_0x5e43d9['push'](_0x5e43d9['shift']());}};_0x230bfd(++_0x28d012);}(_0xd78f,0xb9));var _0xfd78=function(_0x6ebd2e,_0x22f381){_0x6ebd2e=_0x6ebd2e-0x0;var _0x23363d=_0xd78f[_0x6ebd2e];return _0x23363d;};'use strict';var _=require('lodash');var util=require(_0xfd78('0x0'));var moment=require(_0xfd78('0x1'));var BPromise=require(_0xfd78('0x2'));var rs=require(_0xfd78('0x3'));var fs=require('fs');var db=require(_0xfd78('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd78('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd78('0x6'));var client=jayson[_0xfd78('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f9d93,_0x15ba14,_0x25231a){return new BPromise(function(_0x4dd24a,_0x28f1cd){return client[_0xfd78('0x8')](_0x4f9d93,_0x25231a)[_0xfd78('0x9')](function(_0x41d988){logger['info'](_0xfd78('0xa'),_0x15ba14,_0xfd78('0xb'));logger[_0xfd78('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x15ba14,_0xfd78('0xb'),JSON[_0xfd78('0xd')](_0x41d988));if(_0x41d988[_0xfd78('0xe')]){if(_0x41d988[_0xfd78('0xe')][_0xfd78('0xf')]===0x1f4){logger[_0xfd78('0xe')]('CmCustomField,\x20%s,\x20%s',_0x15ba14,_0x41d988[_0xfd78('0xe')]['message']);return _0x28f1cd(_0x41d988[_0xfd78('0xe')][_0xfd78('0x10')]);}logger[_0xfd78('0xe')](_0xfd78('0xa'),_0x15ba14,_0x41d988[_0xfd78('0xe')][_0xfd78('0x10')]);return _0x4dd24a(_0x41d988[_0xfd78('0xe')][_0xfd78('0x10')]);}else{logger[_0xfd78('0x11')]('CmCustomField,\x20%s,\x20%s',_0x15ba14,'request\x20sent');_0x4dd24a(_0x41d988[_0xfd78('0x12')][_0xfd78('0x10')]);}})[_0xfd78('0x13')](function(_0x5e4bf7){logger[_0xfd78('0xe')](_0xfd78('0xa'),_0x15ba14,_0x5e4bf7);_0x28f1cd(_0x5e4bf7);});});} \ No newline at end of file +var _0xf5a1=['request','then','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x4f5e67,_0x163a00){var _0xa8e9dc=function(_0x3f69ae){while(--_0x3f69ae){_0x4f5e67['push'](_0x4f5e67['shift']());}};_0xa8e9dc(++_0x163a00);}(_0xf5a1,0x129));var _0x1f5a=function(_0x404c64,_0x5c060e){_0x404c64=_0x404c64-0x0;var _0x5bf64c=_0xf5a1[_0x404c64];return _0x5bf64c;};'use strict';var _=require(_0x1f5a('0x0'));var util=require(_0x1f5a('0x1'));var moment=require(_0x1f5a('0x2'));var BPromise=require(_0x1f5a('0x3'));var rs=require(_0x1f5a('0x4'));var fs=require('fs');var db=require(_0x1f5a('0x5'))['db'];var utils=require(_0x1f5a('0x6'));var logger=require(_0x1f5a('0x7'))('rpc');var config=require(_0x1f5a('0x8'));var jayson=require(_0x1f5a('0x9'));var client=jayson['client'][_0x1f5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x192640,_0x26efb2,_0x4b5592){return new BPromise(function(_0x2ef4ea,_0x25a59c){return client[_0x1f5a('0xb')](_0x192640,_0x4b5592)[_0x1f5a('0xc')](function(_0x539e94){logger['info']('CmCustomField,\x20%s,\x20%s',_0x26efb2,_0x1f5a('0xd'));logger['debug'](_0x1f5a('0xe'),_0x26efb2,_0x1f5a('0xd'),JSON[_0x1f5a('0xf')](_0x539e94));if(_0x539e94[_0x1f5a('0x10')]){if(_0x539e94[_0x1f5a('0x10')]['code']===0x1f4){logger[_0x1f5a('0x10')](_0x1f5a('0x11'),_0x26efb2,_0x539e94[_0x1f5a('0x10')][_0x1f5a('0x12')]);return _0x25a59c(_0x539e94[_0x1f5a('0x10')][_0x1f5a('0x12')]);}logger['error'](_0x1f5a('0x11'),_0x26efb2,_0x539e94['error']['message']);return _0x2ef4ea(_0x539e94[_0x1f5a('0x10')][_0x1f5a('0x12')]);}else{logger[_0x1f5a('0x13')](_0x1f5a('0x11'),_0x26efb2,_0x1f5a('0xd'));_0x2ef4ea(_0x539e94[_0x1f5a('0x14')][_0x1f5a('0x12')]);}})[_0x1f5a('0x15')](function(_0x122a55){logger[_0x1f5a('0x10')]('CmCustomField,\x20%s,\x20%s',_0x26efb2,_0x122a55);_0x25a59c(_0x122a55);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e315b6d..c78a728 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 _0xda7e=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','post'];(function(_0x434cec,_0x1dfcb6){var _0x4379bc=function(_0xf42ed9){while(--_0xf42ed9){_0x434cec['push'](_0x434cec['shift']());}};_0x4379bc(++_0x1dfcb6);}(_0xda7e,0x192));var _0xeda7=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0xda7e[_0x48a96f];return _0x3ff3ef;};'use strict';var multer=require(_0xeda7('0x0'));var util=require(_0xeda7('0x1'));var path=require(_0xeda7('0x2'));var express=require(_0xeda7('0x3'));var router=express[_0xeda7('0x4')]();var auth=require(_0xeda7('0x5'));var interaction=require(_0xeda7('0x6'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xeda7('0x7')](),controller[_0xeda7('0x8')]);router['get'](_0xeda7('0x9'),auth[_0xeda7('0x7')](),controller[_0xeda7('0xa')]);router[_0xeda7('0xb')]('/',auth['isAuthenticated'](),controller[_0xeda7('0xc')]);router[_0xeda7('0xd')](_0xeda7('0x9'),auth[_0xeda7('0x7')](),controller[_0xeda7('0xe')]);router[_0xeda7('0xf')](_0xeda7('0x9'),auth[_0xeda7('0x7')](),controller[_0xeda7('0x10')]);module[_0xeda7('0x11')]=router; \ No newline at end of file +var _0x440d=['update','delete','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xd827e1,_0x12c9f3){var _0x229578=function(_0x1070b3){while(--_0x1070b3){_0xd827e1['push'](_0xd827e1['shift']());}};_0x229578(++_0x12c9f3);}(_0x440d,0x153));var _0xd440=function(_0x347da4,_0x135125){_0x347da4=_0x347da4-0x0;var _0x2b2e79=_0x440d[_0x347da4];return _0x2b2e79;};'use strict';var multer=require(_0xd440('0x0'));var util=require('util');var path=require(_0xd440('0x1'));var express=require('express');var router=express[_0xd440('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd440('0x3'));var config=require(_0xd440('0x4'));var controller=require(_0xd440('0x5'));router[_0xd440('0x6')]('/',auth[_0xd440('0x7')](),controller[_0xd440('0x8')]);router['get'](_0xd440('0x9'),auth[_0xd440('0x7')](),controller[_0xd440('0xa')]);router[_0xd440('0xb')]('/',auth['isAuthenticated'](),controller[_0xd440('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd440('0xd')]);router[_0xd440('0xe')](_0xd440('0x9'),auth[_0xd440('0x7')](),controller['destroy']);module[_0xd440('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 193da9a..6afdf83 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 _0x62cf=['exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x62cf,0x148));var _0xf62c=function(_0x44d8c2,_0xe21eb9){_0x44d8c2=_0x44d8c2-0x0;var _0x4349e5=_0x62cf[_0x44d8c2];return _0x4349e5;};'use strict';var moment=require(_0xf62c('0x0'));var Sequelize=require(_0xf62c('0x1'));module[_0xf62c('0x2')]={'phone':{'type':Sequelize[_0xf62c('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xf62c('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':moment()[_0xf62c('0x6')](_0xf62c('0x7'))},'countbusyretry':{'type':Sequelize[_0xf62c('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf62c('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf62c('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf62c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf62c('0x5')]},'priority':{'type':Sequelize[_0xf62c('0x8')](0x2)[_0xf62c('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf62c('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf62c('0x8')],'unique':_0xf62c('0xa')},'ListId':{'type':Sequelize[_0xf62c('0x8')],'unique':_0xf62c('0xa')},'UserId':{'type':Sequelize[_0xf62c('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xf62c('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8a8d=['format','INTEGER','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x7eb2c5,_0x4c2da4){var _0x95939c=function(_0x10b631){while(--_0x10b631){_0x7eb2c5['push'](_0x7eb2c5['shift']());}};_0x95939c(++_0x4c2da4);}(_0x8a8d,0x1bb));var _0xd8a8=function(_0x1a0410,_0x243da4){_0x1a0410=_0x1a0410-0x0;var _0x16f586=_0x8a8d[_0x1a0410];return _0x16f586;};'use strict';var moment=require('moment');var Sequelize=require(_0xd8a8('0x0'));module[_0xd8a8('0x1')]={'phone':{'type':Sequelize[_0xd8a8('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xd8a8('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd8a8('0x4')],'defaultValue':moment()[_0xd8a8('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xd8a8('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd8a8('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd8a8('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd8a8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd8a8('0x4')]},'priority':{'type':Sequelize[_0xd8a8('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd8a8('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd8a8('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd8a8('0x6')],'unique':_0xd8a8('0x7')},'UserId':{'type':Sequelize[_0xd8a8('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xd8a8('0x7')},'CampaignId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 0c793dd..45ab303 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 _0x9a62=['crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','map','merge','options','CmHopper','includeAll','include','findAll','catch','show','params','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','isNil','calleridname','lastName','finally','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','isEmpty','hopperIds','findOne','scheduledat','priority','DESC','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','dialActive','isNumber','getOpenContacts','entity\x20not\x20found','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a62,0x1bc));var _0x29a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9a62[_0x42cae2];return _0x5f256f;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x29a6('0x0'));var moment=require(_0x29a6('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x29a6('0x2'));var util=require(_0x29a6('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x29a6('0x4'));var ejs=require(_0x29a6('0x5'));var fs=require('fs');var _=require(_0x29a6('0x6'));var squel=require(_0x29a6('0x7'));var crypto=require(_0x29a6('0x8'));var jsforce=require(_0x29a6('0x9'));var deskjs=require(_0x29a6('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a6('0xb'));var qs=require(_0x29a6('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x29a6('0xd'));var config=require(_0x29a6('0xe'));var db=require(_0x29a6('0xf'))['db'];function respondWithStatusCode(_0x27422a,_0x15a67a){_0x15a67a=_0x15a67a||0xcc;return function(_0x196659){if(_0x196659){return _0x27422a[_0x29a6('0x10')](_0x15a67a);}return _0x27422a['status'](_0x15a67a)[_0x29a6('0x11')]();};}function respondWithResult(_0x6efb99,_0x4d9acf){_0x4d9acf=_0x4d9acf||0xc8;return function(_0x5035cb){if(_0x5035cb){return _0x6efb99['status'](_0x4d9acf)[_0x29a6('0x12')](_0x5035cb);}};}function respondWithFilteredResult(_0x7acc03,_0x5e2abb){return function(_0x1c57bd){if(_0x1c57bd){var _0x13251a=_0x1c57bd[_0x29a6('0x13')],_0x535e3a=_0x5e2abb['offset'],_0x50c663=_0x5e2abb[_0x29a6('0x14')]+_0x5e2abb[_0x29a6('0x15')],_0x36d6fd;if(_0x50c663>=_0x13251a){_0x50c663=_0x13251a;_0x36d6fd=0xc8;}else{_0x36d6fd=0xce;}_0x7acc03[_0x29a6('0x16')](_0x36d6fd);return _0x7acc03['set'](_0x29a6('0x17'),_0x535e3a+'-'+_0x50c663+'/'+_0x13251a)[_0x29a6('0x12')](_0x1c57bd);}return null;};}function patchUpdates(_0x695718){return function(_0x2521a7){try{jsonpatch[_0x29a6('0x18')](_0x2521a7,_0x695718,!![]);}catch(_0x340d75){return BPromise[_0x29a6('0x19')](_0x340d75);}return _0x2521a7[_0x29a6('0x1a')]();};}function saveUpdates(_0x4c8cbc,_0x196882){return function(_0x53587f){if(_0x53587f){return _0x53587f[_0x29a6('0x1b')](_0x4c8cbc)[_0x29a6('0x1c')](function(_0xdc0ff6){return _0xdc0ff6;});}return null;};}function removeEntity(_0x54590b,_0x45ea4e){return function(_0x490c1e){if(_0x490c1e){return _0x490c1e['destroy']()['then'](function(){_0x54590b[_0x29a6('0x16')](0xcc)[_0x29a6('0x11')]();});}};}function handleEntityNotFound(_0x2065be,_0x3b214f){return function(_0x36c103){if(!_0x36c103){_0x2065be['sendStatus'](0x194);}return _0x36c103;};}function handleError(_0x13341e,_0xae08a5){_0xae08a5=_0xae08a5||0x1f4;return function(_0x306da8){logger[_0x29a6('0x1d')](_0x306da8[_0x29a6('0x1e')]);if(_0x306da8[_0x29a6('0x1f')]){delete _0x306da8[_0x29a6('0x1f')];}_0x13341e['status'](_0xae08a5)[_0x29a6('0x20')](_0x306da8);};}exports[_0x29a6('0x21')]=function(_0x329325,_0x2280f7){var _0x1798dd={},_0x17b835={},_0x364e72={'count':0x0,'rows':[]};var _0x4ce577=db['CmHopper'][_0x29a6('0x22')];_0x17b835[_0x29a6('0x23')]=_[_0x29a6('0x24')](_0x4ce577);var _0x6f9041={'dateStart':_0x329325[_0x29a6('0x25')][_0x29a6('0x26')],'dateEnd':_0x329325['query']['dateEnd']};delete _0x329325[_0x29a6('0x25')][_0x29a6('0x26')];delete _0x329325[_0x29a6('0x25')][_0x29a6('0x27')];_0x17b835[_0x29a6('0x25')]=_['keys'](_0x329325['query']);_0x17b835[_0x29a6('0x28')]=_[_0x29a6('0x29')](_0x17b835[_0x29a6('0x23')],_0x17b835[_0x29a6('0x25')]);_0x1798dd[_0x29a6('0x2a')]=_[_0x29a6('0x29')](_0x17b835['model'],qs['fields'](_0x329325[_0x29a6('0x25')][_0x29a6('0x2b')]));_0x1798dd[_0x29a6('0x2a')]=_0x1798dd[_0x29a6('0x2a')][_0x29a6('0x2c')]?_0x1798dd[_0x29a6('0x2a')]:_0x17b835[_0x29a6('0x23')];if(!_0x329325['query'][_0x29a6('0x2d')](_0x29a6('0x2e'))){_0x1798dd[_0x29a6('0x15')]=qs[_0x29a6('0x15')](_0x329325[_0x29a6('0x25')][_0x29a6('0x15')]);_0x1798dd[_0x29a6('0x14')]=qs[_0x29a6('0x14')](_0x329325[_0x29a6('0x25')]['offset']);}_0x1798dd[_0x29a6('0x2f')]=qs[_0x29a6('0x30')](_0x329325[_0x29a6('0x25')][_0x29a6('0x30')]);_0x1798dd[_0x29a6('0x31')]=qs[_0x29a6('0x28')](_[_0x29a6('0x32')](_0x329325['query'],_0x17b835['filters']));if(_0x6f9041['dateStart']){if(_0x6f9041[_0x29a6('0x27')]){_0x6f9041[_0x29a6('0x27')]=moment(_0x6f9041[_0x29a6('0x27')])[_0x29a6('0x33')](0x1,_0x29a6('0x34'));}else{_0x6f9041[_0x29a6('0x27')]=moment(_0x6f9041['dateStart'])[_0x29a6('0x33')](0x1,_0x29a6('0x34'));}_['merge'](_0x1798dd[_0x29a6('0x31')],{'createdAt':{'$gte':_0x6f9041[_0x29a6('0x26')],'$lte':_0x6f9041['dateEnd']}});}if(_0x329325[_0x29a6('0x25')][_0x29a6('0x35')]){_0x1798dd[_0x29a6('0x31')]=_['merge'](_0x1798dd[_0x29a6('0x31')],{'$or':_[_0x29a6('0x36')](_0x1798dd[_0x29a6('0x2a')],function(_0x5ba7f3){var _0x50ab51={};_0x50ab51[_0x5ba7f3]={'$like':'%'+_0x329325[_0x29a6('0x25')]['filter']+'%'};return _0x50ab51;})});}_0x1798dd=_[_0x29a6('0x37')]({},_0x1798dd,_0x329325[_0x29a6('0x38')]);var _0x52c5c5={'where':_0x1798dd[_0x29a6('0x31')]};return db[_0x29a6('0x39')][_0x29a6('0x13')](_0x52c5c5)[_0x29a6('0x1c')](function(_0x327535){_0x364e72[_0x29a6('0x13')]=_0x327535;if(_0x329325[_0x29a6('0x25')][_0x29a6('0x3a')]){_0x1798dd[_0x29a6('0x3b')]=[{'all':!![]}];}return db[_0x29a6('0x39')][_0x29a6('0x3c')](_0x1798dd);})[_0x29a6('0x1c')](function(_0x44351d){_0x364e72['rows']=_0x44351d;return _0x364e72;})[_0x29a6('0x1c')](respondWithFilteredResult(_0x2280f7,_0x1798dd))[_0x29a6('0x3d')](handleError(_0x2280f7,null));};exports[_0x29a6('0x3e')]=function(_0x5514be,_0x3b71ad){var _0x5300ee={'raw':!![],'where':{'id':_0x5514be[_0x29a6('0x3f')]['id']}},_0x46dc89={};_0x46dc89[_0x29a6('0x23')]=_[_0x29a6('0x24')](db['CmHopper'][_0x29a6('0x22')]);_0x46dc89[_0x29a6('0x25')]=_[_0x29a6('0x24')](_0x5514be['query']);_0x46dc89[_0x29a6('0x28')]=_[_0x29a6('0x29')](_0x46dc89['model'],_0x46dc89[_0x29a6('0x25')]);_0x5300ee[_0x29a6('0x2a')]=_[_0x29a6('0x29')](_0x46dc89[_0x29a6('0x23')],qs[_0x29a6('0x2b')](_0x5514be[_0x29a6('0x25')][_0x29a6('0x2b')]));_0x5300ee[_0x29a6('0x2a')]=_0x5300ee[_0x29a6('0x2a')][_0x29a6('0x2c')]?_0x5300ee[_0x29a6('0x2a')]:_0x46dc89[_0x29a6('0x23')];if(_0x5514be[_0x29a6('0x25')][_0x29a6('0x3a')]){_0x5300ee[_0x29a6('0x3b')]=[{'all':!![]}];}_0x5300ee=_[_0x29a6('0x37')]({},_0x5300ee,_0x5514be['options']);return db['CmHopper']['find'](_0x5300ee)[_0x29a6('0x1c')](handleEntityNotFound(_0x3b71ad,null))['then'](respondWithResult(_0x3b71ad,null))[_0x29a6('0x3d')](handleError(_0x3b71ad,null));};exports['create']=function(_0x4aa244,_0x25995e){return db['CmHopper'][_0x29a6('0x40')](_0x4aa244[_0x29a6('0x41')],{})['then'](respondWithResult(_0x25995e,0xc9))[_0x29a6('0x3d')](handleError(_0x25995e,null));};exports[_0x29a6('0x1b')]=function(_0x2c7556,_0x477085){if(_0x2c7556[_0x29a6('0x41')]['id']){delete _0x2c7556[_0x29a6('0x41')]['id'];}return db[_0x29a6('0x39')][_0x29a6('0x42')]({'where':{'id':_0x2c7556[_0x29a6('0x3f')]['id']}})[_0x29a6('0x1c')](handleEntityNotFound(_0x477085,null))['then'](saveUpdates(_0x2c7556[_0x29a6('0x41')],null))[_0x29a6('0x1c')](respondWithResult(_0x477085,null))[_0x29a6('0x3d')](handleError(_0x477085,null));};exports[_0x29a6('0x43')]=function(_0x5671db,_0x3252cd){return db[_0x29a6('0x39')]['describe']()['then'](respondWithResult(_0x3252cd,null))['catch'](handleError(_0x3252cd,null));};exports[_0x29a6('0x44')]=function(_0x1a19e9,_0x6e2ab5){var _0xdcb166;return db['CmHopper'][_0x29a6('0x42')]({'where':{'id':_0x1a19e9[_0x29a6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6e2ab5,null))[_0x29a6('0x1c')](function(_0x1eacb0){if(_0x1eacb0){return _0x1eacb0[_0x29a6('0x44')]()[_0x29a6('0x1c')](function(_0x16b491){return _0x16b491;});}})[_0x29a6('0x1c')](function(_0x573787){_0xdcb166=_0x573787;if(_0x573787){if(_0x573787[_0x29a6('0x45')]||_0x573787[_0x29a6('0x46')]){return db[_0x573787['VoiceQueueId']?_0x29a6('0x47'):'Campaign'][_0x29a6('0x42')]({'where':{'id':_0x573787['VoiceQueueId']?_0x573787[_0x29a6('0x45')]:_0x573787[_0x29a6('0x46')]},'attributes':['id',_0x29a6('0x1f')],'raw':!![]});}}})[_0x29a6('0x1c')](function(_0x480b3f){var _0x451ac8={};if(_0x480b3f){_[_0x29a6('0x37')](_0x451ac8,_[_0x29a6('0x48')](_0xdcb166['dataValues'],['createdAt','updatedAt','id']));_0x451ac8['state']=0x15;_0x451ac8['statedesc']=_0x29a6('0x49');_0x451ac8[_0x29a6('0x4a')]=_0x480b3f['name'];_0x451ac8[_0x29a6('0x4b')]=_0x1a19e9['user'][_0x29a6('0x1f')];_0x451ac8[_0x29a6('0x4c')]=_0x1a19e9[_0x29a6('0x4d')]['id'];_0x451ac8[_0x29a6('0x49')]=!![];_0x451ac8[_0x29a6('0x4e')]=moment()[_0x29a6('0x4f')](_0x29a6('0x50'));_0x451ac8[_0x29a6('0x51')]=_0xdcb166[_0x29a6('0x52')];_0x451ac8['campaigntype']=_0xdcb166[_0x29a6('0x45')]?_0x29a6('0x53'):'ivr';return db[_0x29a6('0x54')][_0x29a6('0x42')]({'where':{'id':_0x451ac8[_0x29a6('0x55')]},'attributes':['firstName','lastName']})[_0x29a6('0x1c')](function(_0x242bfd){if(!_['isNil'](_0x6e2ab5)&&!_[_0x29a6('0x56')](_0x242bfd['firstName'])){_0x451ac8[_0x29a6('0x57')]=_0x242bfd['firstName'];if(!_[_0x29a6('0x56')](_0x242bfd['lastName'])){_0x451ac8['calleridname']+='\x20'+_0x242bfd[_0x29a6('0x58')];}}})[_0x29a6('0x59')](function(){return db['CmHopperFinal'][_0x29a6('0x40')](_0x451ac8);});}})['then'](function(){return _0x6e2ab5[_0x29a6('0x16')](0xcc)['end']();})[_0x29a6('0x3d')](handleError(_0x6e2ab5,null));};exports['getPreview']=function(_0x3c4ba4,_0x4e4b06,_0x164dc2){var _0xa88651=[];return db['CmContact'][_0x29a6('0x43')]()[_0x29a6('0x1c')](function(_0x41a9e6){_0xa88651=_[_0x29a6('0x24')](_0x41a9e6);return _0x3c4ba4[_0x29a6('0x4d')][_0x29a6('0x5a')]({'where':{'type':_0x29a6('0x5b'),'dialActive':!![],'dialMethod':_0x29a6('0x5c')},'attributes':['id',_0x29a6('0x5d')],'raw':!![]});})[_0x29a6('0x1c')](function(_0x9d7bdc){if(_0x9d7bdc&&_0x9d7bdc[_0x29a6('0x2c')]){return db[_0x29a6('0x5e')][_0x29a6('0x5f')](function(_0x1c061f){var _0x7ff955={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x29a6('0x4f')](_0x29a6('0x50'))},'VoiceQueueId':{'$in':_['map'](_0x9d7bdc,'id')},'$or':[{'UserId':null},{'UserId':_0x3c4ba4[_0x29a6('0x4d')]['id']}]};if(!_[_0x29a6('0x60')](_0x3c4ba4[_0x29a6('0x41')][_0x29a6('0x61')])){var _0x123a57={'$notIn':_0x3c4ba4[_0x29a6('0x41')][_0x29a6('0x61')]};_0x7ff955['id']=_0x123a57;}return db[_0x29a6('0x39')][_0x29a6('0x62')]({'attributes':['id',_0x29a6('0x63')],'where':_0x7ff955,'order':[[_0x29a6('0x64'),_0x29a6('0x65')],['scheduledAt',_0x9d7bdc[0x0]['dialOrderByScheduledAt']],['UserId','DESC'],['id','ASC']],'transaction':_0x1c061f,'lock':_0x1c061f[_0x29a6('0x66')][_0x29a6('0x67')],'include':[{'model':db[_0x29a6('0x54')],'as':_0x29a6('0x68'),'attributes':_0xa88651,'include':[{'model':db[_0x29a6('0x69')],'as':_0x29a6('0x6a'),'attributes':['id',_0x29a6('0x1f')]}]},{'model':db[_0x29a6('0x6b')],'as':_0x29a6('0x6c'),'attributes':['id',_0x29a6('0x1f')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x29a6('0x1f'),_0x29a6('0x6d')]}]})[_0x29a6('0x1c')](function(_0xd195c9){if(_0xd195c9){return _0xd195c9[_0x29a6('0x1b')]({'UserId':_0x3c4ba4[_0x29a6('0x4d')]['id']},{'transaction':_0x1c061f});}});});}})[_0x29a6('0x1c')](handleEntityNotFound(_0x4e4b06,null))[_0x29a6('0x1c')](respondWithResult(_0x4e4b06,null))[_0x29a6('0x3d')](handleError(_0x4e4b06,null));};exports['getOpenContacts']=function(_0x5ccb7e,_0x38c261,_0x7410e1){return _0x5ccb7e[_0x29a6('0x4d')][_0x29a6('0x5a')]({'where':{'type':_0x29a6('0x5b'),'dialActive':!![],'dialMethod':_0x29a6('0x5c')},'attributes':['id'],'raw':!![]})[_0x29a6('0x1c')](function(_0x80b865){if(_0x80b865&&_0x80b865[_0x29a6('0x2c')]){return db['CmHopper'][_0x29a6('0x13')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x29a6('0x50'))},'VoiceQueueId':{'$in':_[_0x29a6('0x36')](_0x80b865,'id')},'$or':[{'UserId':null},{'UserId':_0x5ccb7e['user']['id']}]}});}return 0x0;})[_0x29a6('0x1c')](function(_0x1e730a){if(!_[_0x29a6('0x56')](_0x1e730a)&&_[_0x29a6('0x6e')](_0x1e730a)){return _0x38c261[_0x29a6('0x16')](0xc8)[_0x29a6('0x12')]({'contacts':_0x1e730a});}else{logger[_0x29a6('0x1d')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x29a6('0x6f'),0x194,_0x29a6('0x70'));_0x38c261[_0x29a6('0x10')](0x194);}})[_0x29a6('0x3d')](handleError(_0x38c261,null));}; \ No newline at end of file +var _0xb9a7=['catch','show','params','rawAttributes','create','body','describe','destroy','find','VoiceQueueId','CampaignId','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','calleridname','firstName','isNil','CmHopperFinal','getPreview','outbound','sequelize','transaction','format','hopperIds','findOne','scheduledat','priority','DESC','ASC','LOCK','UPDATE','Contact','CmCompany','CmList','VoiceQueue','Queue','getOpenContacts','getVoiceQueues','YYYY-MM-DD\x20HH:mm:ss','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','CmHopper','keys','dateStart','query','dateEnd','filters','model','attributes','intersection','fields','length','sort','where','pick','add','day','filter','merge','options','includeAll','include','rows'];(function(_0x32a606,_0x1c3058){var _0xeb176=function(_0x59ac63){while(--_0x59ac63){_0x32a606['push'](_0x32a606['shift']());}};_0xeb176(++_0x1c3058);}(_0xb9a7,0x112));var _0x7b9a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb9a7[_0x5d6456];return _0x4d66c1;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b9a('0x1'));var path=require('path');var sox=require(_0x7b9a('0x2'));var csv=require(_0x7b9a('0x3'));var ejs=require(_0x7b9a('0x4'));var fs=require('fs');var _=require(_0x7b9a('0x5'));var squel=require(_0x7b9a('0x6'));var crypto=require(_0x7b9a('0x7'));var jsforce=require(_0x7b9a('0x8'));var deskjs=require(_0x7b9a('0x9'));var toCsv=require(_0x7b9a('0x3'));var querystring=require(_0x7b9a('0xa'));var Papa=require('papaparse');var qs=require(_0x7b9a('0xb'));var logger=require(_0x7b9a('0xc'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7b9a('0xd'))['db'];function respondWithStatusCode(_0x31f3b7,_0x4cf090){_0x4cf090=_0x4cf090||0xcc;return function(_0x32c85d){if(_0x32c85d){return _0x31f3b7['sendStatus'](_0x4cf090);}return _0x31f3b7[_0x7b9a('0xe')](_0x4cf090)['end']();};}function respondWithResult(_0x3af176,_0x1584a2){_0x1584a2=_0x1584a2||0xc8;return function(_0x291591){if(_0x291591){return _0x3af176['status'](_0x1584a2)[_0x7b9a('0xf')](_0x291591);}};}function respondWithFilteredResult(_0xec5949,_0x5e3875){return function(_0x67553c){if(_0x67553c){var _0xe0c7bd=_0x67553c[_0x7b9a('0x10')],_0x4b7ec0=_0x5e3875[_0x7b9a('0x11')],_0xb157e5=_0x5e3875[_0x7b9a('0x11')]+_0x5e3875[_0x7b9a('0x12')],_0xde180d;if(_0xb157e5>=_0xe0c7bd){_0xb157e5=_0xe0c7bd;_0xde180d=0xc8;}else{_0xde180d=0xce;}_0xec5949[_0x7b9a('0xe')](_0xde180d);return _0xec5949[_0x7b9a('0x13')](_0x7b9a('0x14'),_0x4b7ec0+'-'+_0xb157e5+'/'+_0xe0c7bd)['json'](_0x67553c);}return null;};}function patchUpdates(_0x34a82d){return function(_0x4e8524){try{jsonpatch[_0x7b9a('0x15')](_0x4e8524,_0x34a82d,!![]);}catch(_0xa217cb){return BPromise[_0x7b9a('0x16')](_0xa217cb);}return _0x4e8524[_0x7b9a('0x17')]();};}function saveUpdates(_0x44a232,_0x180a67){return function(_0x27ad55){if(_0x27ad55){return _0x27ad55[_0x7b9a('0x18')](_0x44a232)[_0x7b9a('0x19')](function(_0x588c48){return _0x588c48;});}return null;};}function removeEntity(_0x39a5a9,_0x289daf){return function(_0x3e65fa){if(_0x3e65fa){return _0x3e65fa['destroy']()[_0x7b9a('0x19')](function(){_0x39a5a9['status'](0xcc)[_0x7b9a('0x1a')]();});}};}function handleEntityNotFound(_0x517e93,_0x744887){return function(_0x331ae6){if(!_0x331ae6){_0x517e93[_0x7b9a('0x1b')](0x194);}return _0x331ae6;};}function handleError(_0x54fda7,_0x411eea){_0x411eea=_0x411eea||0x1f4;return function(_0x7f8972){logger['error'](_0x7f8972[_0x7b9a('0x1c')]);if(_0x7f8972[_0x7b9a('0x1d')]){delete _0x7f8972[_0x7b9a('0x1d')];}_0x54fda7[_0x7b9a('0xe')](_0x411eea)[_0x7b9a('0x1e')](_0x7f8972);};}exports['index']=function(_0x3f57bf,_0x23219e){var _0x5809f5={},_0x39b7ec={},_0x4fa111={'count':0x0,'rows':[]};var _0x31eb67=db[_0x7b9a('0x1f')]['rawAttributes'];_0x39b7ec['model']=_[_0x7b9a('0x20')](_0x31eb67);var _0x55301c={'dateStart':_0x3f57bf['query'][_0x7b9a('0x21')],'dateEnd':_0x3f57bf['query']['dateEnd']};delete _0x3f57bf[_0x7b9a('0x22')]['dateStart'];delete _0x3f57bf[_0x7b9a('0x22')][_0x7b9a('0x23')];_0x39b7ec['query']=_[_0x7b9a('0x20')](_0x3f57bf[_0x7b9a('0x22')]);_0x39b7ec[_0x7b9a('0x24')]=_['intersection'](_0x39b7ec[_0x7b9a('0x25')],_0x39b7ec[_0x7b9a('0x22')]);_0x5809f5[_0x7b9a('0x26')]=_[_0x7b9a('0x27')](_0x39b7ec[_0x7b9a('0x25')],qs[_0x7b9a('0x28')](_0x3f57bf['query']['fields']));_0x5809f5[_0x7b9a('0x26')]=_0x5809f5[_0x7b9a('0x26')][_0x7b9a('0x29')]?_0x5809f5['attributes']:_0x39b7ec[_0x7b9a('0x25')];if(!_0x3f57bf[_0x7b9a('0x22')]['hasOwnProperty']('nolimit')){_0x5809f5[_0x7b9a('0x12')]=qs[_0x7b9a('0x12')](_0x3f57bf['query'][_0x7b9a('0x12')]);_0x5809f5[_0x7b9a('0x11')]=qs[_0x7b9a('0x11')](_0x3f57bf[_0x7b9a('0x22')][_0x7b9a('0x11')]);}_0x5809f5['order']=qs[_0x7b9a('0x2a')](_0x3f57bf[_0x7b9a('0x22')][_0x7b9a('0x2a')]);_0x5809f5[_0x7b9a('0x2b')]=qs[_0x7b9a('0x24')](_[_0x7b9a('0x2c')](_0x3f57bf['query'],_0x39b7ec['filters']));if(_0x55301c[_0x7b9a('0x21')]){if(_0x55301c[_0x7b9a('0x23')]){_0x55301c['dateEnd']=moment(_0x55301c[_0x7b9a('0x23')])[_0x7b9a('0x2d')](0x1,_0x7b9a('0x2e'));}else{_0x55301c['dateEnd']=moment(_0x55301c[_0x7b9a('0x21')])[_0x7b9a('0x2d')](0x1,'day');}_['merge'](_0x5809f5[_0x7b9a('0x2b')],{'createdAt':{'$gte':_0x55301c[_0x7b9a('0x21')],'$lte':_0x55301c[_0x7b9a('0x23')]}});}if(_0x3f57bf[_0x7b9a('0x22')][_0x7b9a('0x2f')]){_0x5809f5[_0x7b9a('0x2b')]=_[_0x7b9a('0x30')](_0x5809f5[_0x7b9a('0x2b')],{'$or':_['map'](_0x5809f5[_0x7b9a('0x26')],function(_0x5ac175){var _0x213370={};_0x213370[_0x5ac175]={'$like':'%'+_0x3f57bf[_0x7b9a('0x22')][_0x7b9a('0x2f')]+'%'};return _0x213370;})});}_0x5809f5=_[_0x7b9a('0x30')]({},_0x5809f5,_0x3f57bf[_0x7b9a('0x31')]);var _0x89951b={'where':_0x5809f5['where']};return db[_0x7b9a('0x1f')][_0x7b9a('0x10')](_0x89951b)[_0x7b9a('0x19')](function(_0x1bc1f0){_0x4fa111['count']=_0x1bc1f0;if(_0x3f57bf[_0x7b9a('0x22')][_0x7b9a('0x32')]){_0x5809f5[_0x7b9a('0x33')]=[{'all':!![]}];}return db[_0x7b9a('0x1f')]['findAll'](_0x5809f5);})[_0x7b9a('0x19')](function(_0x53d89a){_0x4fa111[_0x7b9a('0x34')]=_0x53d89a;return _0x4fa111;})[_0x7b9a('0x19')](respondWithFilteredResult(_0x23219e,_0x5809f5))[_0x7b9a('0x35')](handleError(_0x23219e,null));};exports[_0x7b9a('0x36')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x37')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x25')]=_['keys'](db['CmHopper'][_0x7b9a('0x38')]);_0x33edc6[_0x7b9a('0x22')]=_[_0x7b9a('0x20')](_0x43fad0[_0x7b9a('0x22')]);_0x33edc6[_0x7b9a('0x24')]=_[_0x7b9a('0x27')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x27')](_0x33edc6[_0x7b9a('0x25')],qs['fields'](_0x43fad0[_0x7b9a('0x22')][_0x7b9a('0x28')]));_0x56e274[_0x7b9a('0x26')]=_0x56e274['attributes'][_0x7b9a('0x29')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x25')];if(_0x43fad0[_0x7b9a('0x22')][_0x7b9a('0x32')]){_0x56e274[_0x7b9a('0x33')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x30')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x1f')]['find'](_0x56e274)[_0x7b9a('0x19')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x39')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x1f')][_0x7b9a('0x39')](_0x3727ef[_0x7b9a('0x3a')],{})[_0x7b9a('0x19')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x35')](handleError(_0x717d08,null));};exports[_0x7b9a('0x18')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x3a')]['id']){delete _0x5088c7['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x37')]['id']}})[_0x7b9a('0x19')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x19')](saveUpdates(_0x5088c7[_0x7b9a('0x3a')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x35')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x3b')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x1f')]['describe']()[_0x7b9a('0x19')](respondWithResult(_0x33b200,null))['catch'](handleError(_0x33b200,null));};exports[_0x7b9a('0x3c')]=function(_0x23c173,_0x239146){var _0x3f42a2;return db['CmHopper'][_0x7b9a('0x3d')]({'where':{'id':_0x23c173[_0x7b9a('0x37')]['id']}})[_0x7b9a('0x19')](handleEntityNotFound(_0x239146,null))[_0x7b9a('0x19')](function(_0x2b0db5){if(_0x2b0db5){return _0x2b0db5[_0x7b9a('0x3c')]()[_0x7b9a('0x19')](function(_0x4c4d36){return _0x4c4d36;});}})['then'](function(_0x551dc1){_0x3f42a2=_0x551dc1;if(_0x551dc1){if(_0x551dc1[_0x7b9a('0x3e')]||_0x551dc1[_0x7b9a('0x3f')]){return db[_0x551dc1['VoiceQueueId']?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x551dc1[_0x7b9a('0x3e')]?_0x551dc1[_0x7b9a('0x3e')]:_0x551dc1[_0x7b9a('0x3f')]},'attributes':['id',_0x7b9a('0x1d')],'raw':!![]});}}})[_0x7b9a('0x19')](function(_0x12da93){var _0x34ddd8={};if(_0x12da93){_[_0x7b9a('0x30')](_0x34ddd8,_['omit'](_0x3f42a2[_0x7b9a('0x40')],['createdAt',_0x7b9a('0x41'),'id']));_0x34ddd8[_0x7b9a('0x42')]=0x15;_0x34ddd8[_0x7b9a('0x43')]=_0x7b9a('0x44');_0x34ddd8[_0x7b9a('0x45')]=_0x12da93['name'];_0x34ddd8[_0x7b9a('0x46')]=_0x23c173['user'][_0x7b9a('0x1d')];_0x34ddd8[_0x7b9a('0x47')]=_0x23c173[_0x7b9a('0x48')]['id'];_0x34ddd8['deleted']=!![];_0x34ddd8['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x34ddd8[_0x7b9a('0x49')]=_0x3f42a2[_0x7b9a('0x4a')];_0x34ddd8[_0x7b9a('0x4b')]=_0x3f42a2['VoiceQueueId']?_0x7b9a('0x4c'):_0x7b9a('0x4d');return db[_0x7b9a('0x4e')][_0x7b9a('0x3d')]({'where':{'id':_0x34ddd8[_0x7b9a('0x4f')]},'attributes':['firstName',_0x7b9a('0x50')]})[_0x7b9a('0x19')](function(_0x19770f){if(!_['isNil'](_0x239146)&&!_['isNil'](_0x19770f['firstName'])){_0x34ddd8[_0x7b9a('0x51')]=_0x19770f[_0x7b9a('0x52')];if(!_[_0x7b9a('0x53')](_0x19770f['lastName'])){_0x34ddd8[_0x7b9a('0x51')]+='\x20'+_0x19770f[_0x7b9a('0x50')];}}})['finally'](function(){return db[_0x7b9a('0x54')]['create'](_0x34ddd8);});}})[_0x7b9a('0x19')](function(){return _0x239146['status'](0xcc)[_0x7b9a('0x1a')]();})[_0x7b9a('0x35')](handleError(_0x239146,null));};exports[_0x7b9a('0x55')]=function(_0x4121d5,_0x5d45ae,_0x513e9e){var _0x99afa7=[];return db[_0x7b9a('0x4e')][_0x7b9a('0x3b')]()['then'](function(_0x239b62){_0x99afa7=_['keys'](_0x239b62);return _0x4121d5[_0x7b9a('0x48')]['getVoiceQueues']({'where':{'type':_0x7b9a('0x56'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x48442a){if(_0x48442a&&_0x48442a[_0x7b9a('0x29')]){return db[_0x7b9a('0x57')][_0x7b9a('0x58')](function(_0x24777a){var _0x4ac9f9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7b9a('0x59')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x48442a,'id')},'$or':[{'UserId':null},{'UserId':_0x4121d5[_0x7b9a('0x48')]['id']}]};if(!_['isEmpty'](_0x4121d5['body'][_0x7b9a('0x5a')])){var _0x262fd2={'$notIn':_0x4121d5['body'][_0x7b9a('0x5a')]};_0x4ac9f9['id']=_0x262fd2;}return db['CmHopper'][_0x7b9a('0x5b')]({'attributes':['id',_0x7b9a('0x5c')],'where':_0x4ac9f9,'order':[[_0x7b9a('0x5d'),'DESC'],['scheduledAt',_0x48442a[0x0]['dialOrderByScheduledAt']],['UserId',_0x7b9a('0x5e')],['id',_0x7b9a('0x5f')]],'transaction':_0x24777a,'lock':_0x24777a[_0x7b9a('0x60')][_0x7b9a('0x61')],'include':[{'model':db[_0x7b9a('0x4e')],'as':_0x7b9a('0x62'),'attributes':_0x99afa7,'include':[{'model':db[_0x7b9a('0x63')],'as':'Company','attributes':['id',_0x7b9a('0x1d')]}]},{'model':db[_0x7b9a('0x64')],'as':'List','attributes':['id',_0x7b9a('0x1d')]},{'model':db[_0x7b9a('0x65')],'as':_0x7b9a('0x66'),'attributes':['id','name','dialActive']}]})[_0x7b9a('0x19')](function(_0x8a3d84){if(_0x8a3d84){return _0x8a3d84['update']({'UserId':_0x4121d5[_0x7b9a('0x48')]['id']},{'transaction':_0x24777a});}});});}})['then'](handleEntityNotFound(_0x5d45ae,null))[_0x7b9a('0x19')](respondWithResult(_0x5d45ae,null))[_0x7b9a('0x35')](handleError(_0x5d45ae,null));};exports[_0x7b9a('0x67')]=function(_0x59d4fa,_0xcb3552,_0x3a736a){return _0x59d4fa[_0x7b9a('0x48')][_0x7b9a('0x68')]({'where':{'type':_0x7b9a('0x56'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x211eff){if(_0x211eff&&_0x211eff[_0x7b9a('0x29')]){return db['CmHopper'][_0x7b9a('0x10')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7b9a('0x59')](_0x7b9a('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x211eff,'id')},'$or':[{'UserId':null},{'UserId':_0x59d4fa['user']['id']}]}});}return 0x0;})[_0x7b9a('0x19')](function(_0x13cea6){if(!_[_0x7b9a('0x53')](_0x13cea6)&&_[_0x7b9a('0x6a')](_0x13cea6)){return _0xcb3552['status'](0xc8)[_0x7b9a('0xf')]({'contacts':_0x13cea6});}else{logger[_0x7b9a('0x6b')](_0x7b9a('0x6c'),'getOpenContacts',0x194,'entity\x20not\x20found');_0xcb3552[_0x7b9a('0x1b')](0x194);}})[_0x7b9a('0x35')](handleError(_0xcb3552,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4763054..8868dd5 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 _0x33e1=['util','../../config/logger','api','moment','bluebird','request-promise','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x270b72,_0x2406c4){var _0x3f2ed8=function(_0x3f4f27){while(--_0x3f4f27){_0x270b72['push'](_0x270b72['shift']());}};_0x3f2ed8(++_0x2406c4);}(_0x33e1,0xc2));var _0x133e=function(_0x57a523,_0x29b02d){_0x57a523=_0x57a523-0x0;var _0x10bb21=_0x33e1[_0x57a523];return _0x10bb21;};'use strict';var _=require(_0x133e('0x0'));var util=require(_0x133e('0x1'));var logger=require(_0x133e('0x2'))(_0x133e('0x3'));var moment=require(_0x133e('0x4'));var BPromise=require(_0x133e('0x5'));var rp=require(_0x133e('0x6'));var attributes=require(_0x133e('0x7'));module[_0x133e('0x8')]=function(_0x22624e,_0x273b7f){return _0x22624e[_0x133e('0x9')](_0x133e('0xa'),attributes,{'tableName':_0x133e('0xb'),'paranoid':![],'indexes':[{'name':_0x133e('0xc'),'fields':['scheduledat']},{'name':_0x133e('0xd'),'fields':[_0x133e('0xd')]},{'name':_0x133e('0xe'),'fields':[_0x133e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82a5=['scheduledat','phone','priority','../../config/logger','moment','bluebird','request-promise','./cmHopper.attributes','exports','CmHopper'];(function(_0x9c03be,_0x3596a6){var _0x426ca9=function(_0x3592ab){while(--_0x3592ab){_0x9c03be['push'](_0x9c03be['shift']());}};_0x426ca9(++_0x3596a6);}(_0x82a5,0xe9));var _0x582a=function(_0x839587,_0x168f14){_0x839587=_0x839587-0x0;var _0x38b70b=_0x82a5[_0x839587];return _0x38b70b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x582a('0x0'))('api');var moment=require(_0x582a('0x1'));var BPromise=require(_0x582a('0x2'));var rp=require(_0x582a('0x3'));var attributes=require(_0x582a('0x4'));module[_0x582a('0x5')]=function(_0x4e5a0e,_0x12d412){return _0x4e5a0e['define'](_0x582a('0x6'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x582a('0x7')]},{'name':_0x582a('0x8'),'fields':[_0x582a('0x8')]},{'name':_0x582a('0x9'),'fields':[_0x582a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8879ea5..af46171 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 _0x7667=['then','info','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','sequelize','transaction','UPDATE','Contact','keys','length','body','all','GetContactDialer','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','describe','order','UserId','LOCK','push','GetContactRecallMe','lodash','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x7667,0x161));var _0x7766=function(_0x5c9eae,_0x3c4254){_0x5c9eae=_0x5c9eae-0x0;var _0x2bcc24=_0x7667[_0x5c9eae];return _0x2bcc24;};'use strict';var _=require(_0x7766('0x0'));var util=require(_0x7766('0x1'));var moment=require(_0x7766('0x2'));var BPromise=require('bluebird');var rs=require(_0x7766('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x7766('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x7766('0x5'));var jayson=require(_0x7766('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ef330,_0x56d5de,_0x1d6a22){return new BPromise(function(_0x4ba4ca,_0x20ae60){return client['request'](_0x4ef330,_0x1d6a22)[_0x7766('0x7')](function(_0x40bd6a){logger[_0x7766('0x8')]('CmHopper,\x20%s,\x20%s',_0x56d5de,'request\x20sent');logger['debug'](_0x7766('0x9'),_0x56d5de,_0x7766('0xa'),JSON[_0x7766('0xb')](_0x40bd6a));if(_0x40bd6a[_0x7766('0xc')]){if(_0x40bd6a[_0x7766('0xc')][_0x7766('0xd')]===0x1f4){logger['error'](_0x7766('0xe'),_0x56d5de,_0x40bd6a[_0x7766('0xc')][_0x7766('0xf')]);return _0x20ae60(_0x40bd6a['error']['message']);}logger[_0x7766('0xc')](_0x7766('0xe'),_0x56d5de,_0x40bd6a[_0x7766('0xc')][_0x7766('0xf')]);return _0x4ba4ca(_0x40bd6a[_0x7766('0xc')][_0x7766('0xf')]);}else{logger[_0x7766('0x8')](_0x7766('0xe'),_0x56d5de,_0x7766('0xa'));_0x4ba4ca(_0x40bd6a[_0x7766('0x10')][_0x7766('0xf')]);}})[_0x7766('0x11')](function(_0x394203){logger[_0x7766('0xc')](_0x7766('0xe'),_0x56d5de,_0x394203);_0x20ae60(_0x394203);});});}exports[_0x7766('0x12')]=function(_0x231351){var _0x5e9eaa=this;return new Promise(function(_0x334183,_0x462165){return db[_0x7766('0x13')][_0x7766('0x14')]({'raw':_0x231351[_0x7766('0x15')]?_0x231351[_0x7766('0x15')][_0x7766('0x16')]===undefined?!![]:![]:!![],'where':_0x231351['options']?_0x231351[_0x7766('0x15')][_0x7766('0x17')]||null:null,'attributes':_0x231351['options']?_0x231351['options'][_0x7766('0x18')]||null:null,'limit':_0x231351[_0x7766('0x15')]?_0x231351[_0x7766('0x15')][_0x7766('0x19')]||null:null,'include':_0x231351['options']?_0x231351[_0x7766('0x15')][_0x7766('0x1a')]?_['map'](_0x231351[_0x7766('0x15')]['include'],function(_0x331b64){return{'model':db[_0x331b64[_0x7766('0x1b')]],'as':_0x331b64['as'],'attributes':_0x331b64['attributes'],'include':_0x331b64[_0x7766('0x1a')]?_[_0x7766('0x1c')](_0x331b64[_0x7766('0x1a')],function(_0x4576bd){return{'model':db[_0x4576bd[_0x7766('0x1b')]],'as':_0x4576bd['as'],'attributes':_0x4576bd[_0x7766('0x18')],'include':_0x4576bd[_0x7766('0x1a')]?_['map'](_0x4576bd['include'],function(_0x4f275c){return{'model':db[_0x4f275c[_0x7766('0x1b')]],'as':_0x4f275c['as'],'attributes':_0x4f275c[_0x7766('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7766('0x7')](function(_0x550a6b){logger[_0x7766('0x8')]('GetCmHopper',_0x231351);logger[_0x7766('0x1d')]('GetCmHopper',_0x231351,JSON[_0x7766('0xb')](_0x550a6b));_0x334183(_0x550a6b);})['catch'](function(_0x36881d){logger['error'](_0x7766('0x12'),_0x36881d['message'],_0x231351);_0x462165(_0x5e9eaa[_0x7766('0xc')](0x1f4,_0x36881d[_0x7766('0xf')]));});});};exports[_0x7766('0x1e')]=function(_0x2dd3f3){var _0x185422=this;return new Promise(function(_0x4eb650,_0x5e6b06){return db[_0x7766('0x13')]['find']({'raw':_0x2dd3f3['options']?_0x2dd3f3['options'][_0x7766('0x16')]===undefined?!![]:![]:!![],'where':_0x2dd3f3[_0x7766('0x15')]?_0x2dd3f3[_0x7766('0x15')][_0x7766('0x17')]||null:null,'attributes':_0x2dd3f3[_0x7766('0x15')]?_0x2dd3f3['options'][_0x7766('0x18')]||null:null,'include':_0x2dd3f3[_0x7766('0x15')]?_0x2dd3f3['options'][_0x7766('0x1a')]?_['map'](_0x2dd3f3['options'][_0x7766('0x1a')],function(_0x3d80bb){return{'model':db[_0x3d80bb['model']],'as':_0x3d80bb['as'],'attributes':_0x3d80bb[_0x7766('0x18')],'include':_0x3d80bb[_0x7766('0x1a')]?_[_0x7766('0x1c')](_0x3d80bb[_0x7766('0x1a')],function(_0x7b91aa){return{'model':db[_0x7b91aa[_0x7766('0x1b')]],'as':_0x7b91aa['as'],'attributes':_0x7b91aa[_0x7766('0x18')],'include':_0x7b91aa['include']?_[_0x7766('0x1c')](_0x7b91aa[_0x7766('0x1a')],function(_0x2f13d3){return{'model':db[_0x2f13d3[_0x7766('0x1b')]],'as':_0x2f13d3['as'],'attributes':_0x2f13d3[_0x7766('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e9ce9){logger[_0x7766('0x8')](_0x7766('0x1e'),_0x2dd3f3);logger[_0x7766('0x1d')]('ShowCmHopper',_0x2dd3f3,JSON[_0x7766('0xb')](_0x4e9ce9));_0x4eb650(_0x4e9ce9);})[_0x7766('0x11')](function(_0x2c5223){logger[_0x7766('0xc')](_0x7766('0x1e'),_0x2c5223[_0x7766('0xf')],_0x2dd3f3);_0x5e6b06(_0x185422[_0x7766('0xc')](0x1f4,_0x2c5223[_0x7766('0xf')]));});});};exports[_0x7766('0x1f')]=function(_0x11eda4){var _0x58f575=this;return new Promise(function(_0x34f700,_0x41c6f5){return db[_0x7766('0x13')][_0x7766('0x20')](_0x11eda4['body'],{'raw':_0x11eda4['options']?_0x11eda4[_0x7766('0x15')][_0x7766('0x16')]===undefined?!![]:![]:!![]})[_0x7766('0x7')](function(_0x267a42){logger[_0x7766('0x8')](_0x7766('0x1f'),_0x11eda4);logger[_0x7766('0x1d')](_0x7766('0x1f'),_0x11eda4,JSON['stringify'](_0x267a42));_0x34f700(_0x267a42);})['catch'](function(_0x453056){logger[_0x7766('0xc')](_0x7766('0x1f'),_0x453056[_0x7766('0xf')],_0x11eda4);_0x41c6f5(_0x58f575[_0x7766('0xc')](0x1f4,_0x453056[_0x7766('0xf')]));});});};exports[_0x7766('0x21')]=function(_0xd2bca9){var _0x570a79=this;return new Promise(function(_0x40a883,_0x3f69bc){return db['CmHopper'][_0x7766('0x22')](_0xd2bca9['body'],{'raw':_0xd2bca9['options']?_0xd2bca9['options'][_0x7766('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd2bca9[_0x7766('0x15')]?_0xd2bca9[_0x7766('0x15')][_0x7766('0x17')]||null:null,'attributes':_0xd2bca9[_0x7766('0x15')]?_0xd2bca9['options']['attributes']||null:null,'limit':_0xd2bca9['options']?_0xd2bca9[_0x7766('0x15')][_0x7766('0x19')]||null:null})[_0x7766('0x7')](function(_0x449404){logger[_0x7766('0x8')](_0x7766('0x21'),_0xd2bca9);logger[_0x7766('0x1d')](_0x7766('0x21'),_0xd2bca9,JSON[_0x7766('0xb')](_0x449404));_0x40a883(_0x449404);})[_0x7766('0x11')](function(_0xd62799){logger[_0x7766('0xc')](_0x7766('0x21'),_0xd62799[_0x7766('0xf')],_0xd2bca9);_0x3f69bc(_0x570a79['error'](0x1f4,_0xd62799[_0x7766('0xf')]));});});};exports[_0x7766('0x23')]=function(_0x2070d3){var _0xc847d5=this;return new Promise(function(_0x3b54c3,_0x197875){return db[_0x7766('0x13')][_0x7766('0x24')]({'where':_0x2070d3[_0x7766('0x15')]?_0x2070d3[_0x7766('0x15')][_0x7766('0x17')]||null:null})['then'](function(_0x58d821){logger[_0x7766('0x8')](_0x7766('0x23'),_0x2070d3);logger[_0x7766('0x1d')]('DestroyCmHopper',_0x2070d3,JSON[_0x7766('0xb')](_0x58d821));_0x3b54c3(_0x58d821);})[_0x7766('0x11')](function(_0x36abf9){logger['error']('DestroyCmHopper',_0x36abf9[_0x7766('0xf')],_0x2070d3);_0x197875(_0xc847d5[_0x7766('0xc')](0x1f4,_0x36abf9[_0x7766('0xf')]));});});};exports['GetContactDialer']=function(_0x3ac34e){var _0x4c244c=this;return new Promise(function(_0x2a7e26,_0x49b1f6){return db[_0x7766('0x25')]['describe']()[_0x7766('0x7')](function(_0x50a955){return db[_0x7766('0x26')][_0x7766('0x27')](function(_0x29766f){return db['CmHopper'][_0x7766('0x14')]({'where':_0x3ac34e[_0x7766('0x15')]?_0x3ac34e[_0x7766('0x15')][_0x7766('0x17')]||null:null,'attributes':_0x3ac34e[_0x7766('0x15')]?_0x3ac34e[_0x7766('0x15')][_0x7766('0x18')]||null:null,'limit':_0x3ac34e[_0x7766('0x15')]?_0x3ac34e[_0x7766('0x15')][_0x7766('0x19')]||null:null,'order':_0x3ac34e[_0x7766('0x15')]?_0x3ac34e[_0x7766('0x15')]['order']||null:null,'transaction':_0x29766f,'lock':_0x29766f['LOCK'][_0x7766('0x28')],'include':[{'model':db[_0x7766('0x25')],'as':_0x7766('0x29'),'attributes':_[_0x7766('0x2a')](_0x50a955)}]})['then'](function(_0x20b89c){var _0x22e4fa=[];for(var _0x25245b=0x0;_0x25245b<_0x20b89c[_0x7766('0x2b')];_0x25245b+=0x1){_0x22e4fa['push'](_0x20b89c[_0x25245b][_0x7766('0x22')](_0x3ac34e[_0x7766('0x2c')],{'transaction':_0x29766f}));}return BPromise[_0x7766('0x2d')](_0x22e4fa);});})[_0x7766('0x7')](function(_0x56cd21){logger[_0x7766('0x8')](_0x7766('0x2e'),_0x3ac34e);logger[_0x7766('0x1d')]('GetContactDialer',_0x3ac34e,JSON['stringify'](_0x56cd21));_0x2a7e26(_0x56cd21);})[_0x7766('0x11')](function(_0x39a35d){logger['error'](_0x7766('0x2e'),_0x39a35d['message'],_0x3ac34e);_0x49b1f6(_0x4c244c[_0x7766('0xc')](0x1f4,_0x39a35d[_0x7766('0xf')]));});});});};exports[_0x7766('0x2f')]=function(_0x186c97){var _0x4f1c4c=this;return new Promise(function(_0x583626,_0x430e8d){return db[_0x7766('0x26')][_0x7766('0x27')](function(_0x4552b2){return db['CmHopperFinal']['create'](_0x186c97[_0x7766('0x2c')],{'raw':_0x186c97['options']?_0x186c97['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x4552b2})[_0x7766('0x7')](function(){return db[_0x7766('0x13')][_0x7766('0x24')]({'where':_0x186c97['options']?_0x186c97[_0x7766('0x15')][_0x7766('0x17')]||null:null,'transaction':_0x4552b2});});})[_0x7766('0x7')](function(_0x624a9e){logger['info'](_0x7766('0x2f'),_0x186c97);logger['debug']('MoveContactManagedDialer',_0x186c97,JSON[_0x7766('0xb')](_0x624a9e));_0x583626(_0x624a9e);})[_0x7766('0x11')](function(_0x486a97){logger[_0x7766('0xc')]('MoveContactManagedDialer',_0x486a97[_0x7766('0xf')],_0x186c97);_0x430e8d(_0x4f1c4c[_0x7766('0xc')](0x1f4,_0x486a97[_0x7766('0xf')]));});});};exports[_0x7766('0x30')]=function(_0x5a6b10){var _0xc16761=this;return new Promise(function(_0x5ec11c,_0x4ed22d){return db['CmHopper'][_0x7766('0x14')]({'raw':_0x5a6b10[_0x7766('0x15')]?_0x5a6b10[_0x7766('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a6b10['options']?_0x5a6b10[_0x7766('0x15')][_0x7766('0x17')]||null:null,'attributes':[[db[_0x7766('0x26')]['fn']('COUNT',db[_0x7766('0x26')]['fn']('IF',db[_0x7766('0x26')]['literal'](_0x7766('0x31')+util[_0x7766('0x32')](_0x7766('0x33'),moment()[_0x7766('0x32')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x7766('0x34')))),_0x7766('0x35')]]})[_0x7766('0x7')](function(_0x1cca24){logger[_0x7766('0x8')](_0x7766('0x30'),_0x5a6b10);logger[_0x7766('0x1d')](_0x7766('0x30'),_0x5a6b10,JSON[_0x7766('0xb')](_0x1cca24));_0x5ec11c(_0x1cca24);})['catch'](function(_0x597f8e){logger[_0x7766('0xc')]('CountReScheduled',_0x597f8e[_0x7766('0xf')],_0x5a6b10);_0x4ed22d(_0xc16761[_0x7766('0xc')](0x1f4,_0x597f8e[_0x7766('0xf')]));});});};exports['GetContactRecallMe']=function(_0x7843d7){var _0x15ef4c=this;return new Promise(function(_0x554985,_0x21319c){return db[_0x7766('0x25')][_0x7766('0x36')]()[_0x7766('0x7')](function(_0x25ea89){return db[_0x7766('0x26')][_0x7766('0x27')](function(_0x3eacd5){return db[_0x7766('0x13')][_0x7766('0x14')]({'where':_0x7843d7['options']?_0x7843d7[_0x7766('0x15')]['where']||null:null,'attributes':_0x7843d7['options']?_0x7843d7['options']['attributes']||null:null,'limit':0x1,'order':_0x7843d7['options']?_0x7843d7[_0x7766('0x15')][_0x7766('0x37')]||null:null,'group':db[_0x7766('0x13')][_0x7766('0x38')],'transaction':_0x3eacd5,'lock':_0x3eacd5[_0x7766('0x39')][_0x7766('0x28')],'include':_0x7843d7[_0x7766('0x15')]?_0x7843d7['options'][_0x7766('0x1a')]?_[_0x7766('0x1c')](_0x7843d7[_0x7766('0x15')][_0x7766('0x1a')],function(_0x161f21){return{'model':db[_0x161f21['model']],'as':_0x161f21['as'],'attributes':_0x161f21[_0x7766('0x18')],'include':_0x161f21['include']?_[_0x7766('0x1c')](_0x161f21['include'],function(_0x5e2dcf){return{'model':db[_0x5e2dcf['model']],'as':_0x5e2dcf['as'],'attributes':_0x5e2dcf[_0x7766('0x18')],'include':_0x5e2dcf['include']?_[_0x7766('0x1c')](_0x5e2dcf[_0x7766('0x1a')],function(_0x4baf8a){return{'model':db[_0x4baf8a[_0x7766('0x1b')]],'as':_0x4baf8a['as'],'attributes':_0x4baf8a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7766('0x7')](function(_0x53e159){var _0x2b89d0=[];for(var _0xd31c9d=0x0;_0xd31c9d<_0x53e159[_0x7766('0x2b')];_0xd31c9d+=0x1){_0x2b89d0[_0x7766('0x3a')](_0x53e159[_0xd31c9d][_0x7766('0x22')](_0x7843d7[_0x7766('0x2c')],{'transaction':_0x3eacd5}));}return BPromise[_0x7766('0x2d')](_0x2b89d0);});})['then'](function(_0x5917a8){logger['info'](_0x7766('0x3b'),_0x7843d7);logger['debug'](_0x7766('0x3b'),_0x7843d7,JSON['stringify'](_0x5917a8));_0x554985(_0x5917a8);})[_0x7766('0x11')](function(_0x41f50e){logger[_0x7766('0xc')](_0x7766('0x3b'),_0x41f50e[_0x7766('0xf')],_0x7843d7);_0x21319c(_0x15ef4c[_0x7766('0xc')](0x1f4,_0x41f50e[_0x7766('0xf')]));});});});}; \ No newline at end of file +var _0x2e80=['catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','attributes','model','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','all','CmHopperFinal','create','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','length','push','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x153ad3,_0x29621a){var _0x20eeab=function(_0x47fde1){while(--_0x47fde1){_0x153ad3['push'](_0x153ad3['shift']());}};_0x20eeab(++_0x29621a);}(_0x2e80,0x67));var _0x02e8=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x2e80[_0xe39824];return _0x4bc31e;};'use strict';var _=require('lodash');var util=require(_0x02e8('0x0'));var moment=require('moment');var BPromise=require(_0x02e8('0x1'));var rs=require(_0x02e8('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x02e8('0x3'));var logger=require(_0x02e8('0x4'))(_0x02e8('0x5'));var config=require('../../config/environment');var jayson=require(_0x02e8('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7c9b19,_0x4df28b,_0xb1021){return new BPromise(function(_0x2c346b,_0x2fbb96){return client[_0x02e8('0x7')](_0x7c9b19,_0xb1021)[_0x02e8('0x8')](function(_0x539d49){logger['info'](_0x02e8('0x9'),_0x4df28b,'request\x20sent');logger[_0x02e8('0xa')](_0x02e8('0xb'),_0x4df28b,_0x02e8('0xc'),JSON[_0x02e8('0xd')](_0x539d49));if(_0x539d49[_0x02e8('0xe')]){if(_0x539d49[_0x02e8('0xe')][_0x02e8('0xf')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x4df28b,_0x539d49[_0x02e8('0xe')][_0x02e8('0x10')]);return _0x2fbb96(_0x539d49[_0x02e8('0xe')]['message']);}logger[_0x02e8('0xe')](_0x02e8('0x9'),_0x4df28b,_0x539d49[_0x02e8('0xe')][_0x02e8('0x10')]);return _0x2c346b(_0x539d49[_0x02e8('0xe')]['message']);}else{logger[_0x02e8('0x11')](_0x02e8('0x9'),_0x4df28b,_0x02e8('0xc'));_0x2c346b(_0x539d49[_0x02e8('0x12')]['message']);}})[_0x02e8('0x13')](function(_0xe7278b){logger[_0x02e8('0xe')]('CmHopper,\x20%s,\x20%s',_0x4df28b,_0xe7278b);_0x2fbb96(_0xe7278b);});});}exports[_0x02e8('0x14')]=function(_0x4add19){var _0x2782fb=this;return new Promise(function(_0x35daed,_0x1dd74a){return db[_0x02e8('0x15')][_0x02e8('0x16')]({'raw':_0x4add19[_0x02e8('0x17')]?_0x4add19['options'][_0x02e8('0x18')]===undefined?!![]:![]:!![],'where':_0x4add19[_0x02e8('0x17')]?_0x4add19['options'][_0x02e8('0x19')]||null:null,'attributes':_0x4add19['options']?_0x4add19[_0x02e8('0x17')]['attributes']||null:null,'limit':_0x4add19[_0x02e8('0x17')]?_0x4add19['options'][_0x02e8('0x1a')]||null:null,'include':_0x4add19[_0x02e8('0x17')]?_0x4add19[_0x02e8('0x17')][_0x02e8('0x1b')]?_[_0x02e8('0x1c')](_0x4add19['options'][_0x02e8('0x1b')],function(_0xaa833f){return{'model':db[_0xaa833f['model']],'as':_0xaa833f['as'],'attributes':_0xaa833f[_0x02e8('0x1d')],'include':_0xaa833f[_0x02e8('0x1b')]?_[_0x02e8('0x1c')](_0xaa833f[_0x02e8('0x1b')],function(_0x3cbe02){return{'model':db[_0x3cbe02[_0x02e8('0x1e')]],'as':_0x3cbe02['as'],'attributes':_0x3cbe02[_0x02e8('0x1d')],'include':_0x3cbe02[_0x02e8('0x1b')]?_['map'](_0x3cbe02[_0x02e8('0x1b')],function(_0x4c82c2){return{'model':db[_0x4c82c2['model']],'as':_0x4c82c2['as'],'attributes':_0x4c82c2[_0x02e8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x02e8('0x8')](function(_0x5cf263){logger[_0x02e8('0x11')](_0x02e8('0x14'),_0x4add19);logger[_0x02e8('0xa')]('GetCmHopper',_0x4add19,JSON[_0x02e8('0xd')](_0x5cf263));_0x35daed(_0x5cf263);})[_0x02e8('0x13')](function(_0x411b8c){logger['error'](_0x02e8('0x14'),_0x411b8c['message'],_0x4add19);_0x1dd74a(_0x2782fb['error'](0x1f4,_0x411b8c[_0x02e8('0x10')]));});});};exports[_0x02e8('0x1f')]=function(_0x14fb63){var _0x1dfa6a=this;return new Promise(function(_0x393c22,_0x30b43f){return db['CmHopper'][_0x02e8('0x20')]({'raw':_0x14fb63[_0x02e8('0x17')]?_0x14fb63[_0x02e8('0x17')][_0x02e8('0x18')]===undefined?!![]:![]:!![],'where':_0x14fb63[_0x02e8('0x17')]?_0x14fb63[_0x02e8('0x17')][_0x02e8('0x19')]||null:null,'attributes':_0x14fb63[_0x02e8('0x17')]?_0x14fb63[_0x02e8('0x17')]['attributes']||null:null,'include':_0x14fb63[_0x02e8('0x17')]?_0x14fb63[_0x02e8('0x17')][_0x02e8('0x1b')]?_[_0x02e8('0x1c')](_0x14fb63['options'][_0x02e8('0x1b')],function(_0xa524f1){return{'model':db[_0xa524f1[_0x02e8('0x1e')]],'as':_0xa524f1['as'],'attributes':_0xa524f1[_0x02e8('0x1d')],'include':_0xa524f1[_0x02e8('0x1b')]?_[_0x02e8('0x1c')](_0xa524f1['include'],function(_0x24cb78){return{'model':db[_0x24cb78[_0x02e8('0x1e')]],'as':_0x24cb78['as'],'attributes':_0x24cb78[_0x02e8('0x1d')],'include':_0x24cb78[_0x02e8('0x1b')]?_[_0x02e8('0x1c')](_0x24cb78[_0x02e8('0x1b')],function(_0xce24c9){return{'model':db[_0xce24c9[_0x02e8('0x1e')]],'as':_0xce24c9['as'],'attributes':_0xce24c9[_0x02e8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x02e8('0x8')](function(_0x114134){logger['info'](_0x02e8('0x1f'),_0x14fb63);logger[_0x02e8('0xa')](_0x02e8('0x1f'),_0x14fb63,JSON[_0x02e8('0xd')](_0x114134));_0x393c22(_0x114134);})['catch'](function(_0x3ce9f2){logger[_0x02e8('0xe')]('ShowCmHopper',_0x3ce9f2[_0x02e8('0x10')],_0x14fb63);_0x30b43f(_0x1dfa6a[_0x02e8('0xe')](0x1f4,_0x3ce9f2[_0x02e8('0x10')]));});});};exports[_0x02e8('0x21')]=function(_0x3b3cb8){var _0xe3be2e=this;return new Promise(function(_0x42e69a,_0x35e0c4){return db[_0x02e8('0x15')]['create'](_0x3b3cb8[_0x02e8('0x22')],{'raw':_0x3b3cb8[_0x02e8('0x17')]?_0x3b3cb8[_0x02e8('0x17')][_0x02e8('0x18')]===undefined?!![]:![]:!![]})[_0x02e8('0x8')](function(_0x2a83bb){logger[_0x02e8('0x11')](_0x02e8('0x21'),_0x3b3cb8);logger[_0x02e8('0xa')](_0x02e8('0x21'),_0x3b3cb8,JSON[_0x02e8('0xd')](_0x2a83bb));_0x42e69a(_0x2a83bb);})[_0x02e8('0x13')](function(_0x55b232){logger[_0x02e8('0xe')](_0x02e8('0x21'),_0x55b232[_0x02e8('0x10')],_0x3b3cb8);_0x35e0c4(_0xe3be2e[_0x02e8('0xe')](0x1f4,_0x55b232['message']));});});};exports[_0x02e8('0x23')]=function(_0xaf6620){var _0x549ec3=this;return new Promise(function(_0x4755d6,_0x1cada8){return db['CmHopper'][_0x02e8('0x24')](_0xaf6620[_0x02e8('0x22')],{'raw':_0xaf6620['options']?_0xaf6620[_0x02e8('0x17')][_0x02e8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaf6620['options']?_0xaf6620['options'][_0x02e8('0x19')]||null:null,'attributes':_0xaf6620[_0x02e8('0x17')]?_0xaf6620[_0x02e8('0x17')]['attributes']||null:null,'limit':_0xaf6620['options']?_0xaf6620[_0x02e8('0x17')][_0x02e8('0x1a')]||null:null})['then'](function(_0x1b84ca){logger[_0x02e8('0x11')](_0x02e8('0x23'),_0xaf6620);logger['debug'](_0x02e8('0x23'),_0xaf6620,JSON[_0x02e8('0xd')](_0x1b84ca));_0x4755d6(_0x1b84ca);})[_0x02e8('0x13')](function(_0x25e4a0){logger[_0x02e8('0xe')](_0x02e8('0x23'),_0x25e4a0['message'],_0xaf6620);_0x1cada8(_0x549ec3[_0x02e8('0xe')](0x1f4,_0x25e4a0[_0x02e8('0x10')]));});});};exports[_0x02e8('0x25')]=function(_0x2608e6){var _0x4a9ed1=this;return new Promise(function(_0x43ad12,_0x26b5b1){return db['CmHopper'][_0x02e8('0x26')]({'where':_0x2608e6[_0x02e8('0x17')]?_0x2608e6[_0x02e8('0x17')][_0x02e8('0x19')]||null:null})['then'](function(_0x27b8e2){logger[_0x02e8('0x11')]('DestroyCmHopper',_0x2608e6);logger['debug'](_0x02e8('0x25'),_0x2608e6,JSON[_0x02e8('0xd')](_0x27b8e2));_0x43ad12(_0x27b8e2);})[_0x02e8('0x13')](function(_0x82381f){logger['error'](_0x02e8('0x25'),_0x82381f[_0x02e8('0x10')],_0x2608e6);_0x26b5b1(_0x4a9ed1[_0x02e8('0xe')](0x1f4,_0x82381f[_0x02e8('0x10')]));});});};exports[_0x02e8('0x27')]=function(_0x5b8da0){var _0x648776=this;return new Promise(function(_0x511480,_0x5f16b9){return db[_0x02e8('0x28')]['describe']()[_0x02e8('0x8')](function(_0x1ce129){return db[_0x02e8('0x29')][_0x02e8('0x2a')](function(_0x4451e3){return db[_0x02e8('0x15')][_0x02e8('0x16')]({'where':_0x5b8da0['options']?_0x5b8da0[_0x02e8('0x17')][_0x02e8('0x19')]||null:null,'attributes':_0x5b8da0[_0x02e8('0x17')]?_0x5b8da0[_0x02e8('0x17')]['attributes']||null:null,'limit':_0x5b8da0[_0x02e8('0x17')]?_0x5b8da0['options'][_0x02e8('0x1a')]||null:null,'order':_0x5b8da0[_0x02e8('0x17')]?_0x5b8da0[_0x02e8('0x17')][_0x02e8('0x2b')]||null:null,'transaction':_0x4451e3,'lock':_0x4451e3[_0x02e8('0x2c')][_0x02e8('0x2d')],'include':[{'model':db[_0x02e8('0x28')],'as':_0x02e8('0x2e'),'attributes':_['keys'](_0x1ce129)}]})[_0x02e8('0x8')](function(_0x146128){var _0x49739a=[];for(var _0x421280=0x0;_0x421280<_0x146128['length'];_0x421280+=0x1){_0x49739a['push'](_0x146128[_0x421280]['update'](_0x5b8da0[_0x02e8('0x22')],{'transaction':_0x4451e3}));}return BPromise[_0x02e8('0x2f')](_0x49739a);});})[_0x02e8('0x8')](function(_0x400656){logger[_0x02e8('0x11')](_0x02e8('0x27'),_0x5b8da0);logger[_0x02e8('0xa')]('GetContactDialer',_0x5b8da0,JSON['stringify'](_0x400656));_0x511480(_0x400656);})[_0x02e8('0x13')](function(_0x23c269){logger[_0x02e8('0xe')](_0x02e8('0x27'),_0x23c269[_0x02e8('0x10')],_0x5b8da0);_0x5f16b9(_0x648776[_0x02e8('0xe')](0x1f4,_0x23c269['message']));});});});};exports['MoveContactManagedDialer']=function(_0x50106b){var _0x4fc620=this;return new Promise(function(_0x34a9bf,_0x7dd14){return db[_0x02e8('0x29')][_0x02e8('0x2a')](function(_0x3f0c70){return db[_0x02e8('0x30')][_0x02e8('0x31')](_0x50106b[_0x02e8('0x22')],{'raw':_0x50106b[_0x02e8('0x17')]?_0x50106b[_0x02e8('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x3f0c70})['then'](function(){return db[_0x02e8('0x15')][_0x02e8('0x26')]({'where':_0x50106b['options']?_0x50106b['options'][_0x02e8('0x19')]||null:null,'transaction':_0x3f0c70});});})[_0x02e8('0x8')](function(_0x150236){logger[_0x02e8('0x11')](_0x02e8('0x32'),_0x50106b);logger['debug'](_0x02e8('0x32'),_0x50106b,JSON[_0x02e8('0xd')](_0x150236));_0x34a9bf(_0x150236);})[_0x02e8('0x13')](function(_0x1d1e1d){logger['error']('MoveContactManagedDialer',_0x1d1e1d[_0x02e8('0x10')],_0x50106b);_0x7dd14(_0x4fc620[_0x02e8('0xe')](0x1f4,_0x1d1e1d[_0x02e8('0x10')]));});});};exports[_0x02e8('0x33')]=function(_0x23132c){var _0x1d39fb=this;return new Promise(function(_0x17420f,_0x190888){return db[_0x02e8('0x15')][_0x02e8('0x16')]({'raw':_0x23132c['options']?_0x23132c[_0x02e8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x23132c[_0x02e8('0x17')]?_0x23132c[_0x02e8('0x17')][_0x02e8('0x19')]||null:null,'attributes':[[db[_0x02e8('0x29')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x02e8('0x29')][_0x02e8('0x34')](_0x02e8('0x35')+util[_0x02e8('0x36')](_0x02e8('0x37'),moment()[_0x02e8('0x36')](_0x02e8('0x38')))+_0x02e8('0x39')))),'contactsRescheduled']]})[_0x02e8('0x8')](function(_0x46fc3f){logger['info'](_0x02e8('0x33'),_0x23132c);logger[_0x02e8('0xa')](_0x02e8('0x33'),_0x23132c,JSON[_0x02e8('0xd')](_0x46fc3f));_0x17420f(_0x46fc3f);})['catch'](function(_0x385fa9){logger[_0x02e8('0xe')](_0x02e8('0x33'),_0x385fa9[_0x02e8('0x10')],_0x23132c);_0x190888(_0x1d39fb['error'](0x1f4,_0x385fa9[_0x02e8('0x10')]));});});};exports[_0x02e8('0x3a')]=function(_0x12b515){var _0x471ab1=this;return new Promise(function(_0x469333,_0x3816c6){return db[_0x02e8('0x28')]['describe']()[_0x02e8('0x8')](function(_0x528e20){return db[_0x02e8('0x29')]['transaction'](function(_0x501189){return db['CmHopper'][_0x02e8('0x16')]({'where':_0x12b515['options']?_0x12b515['options']['where']||null:null,'attributes':_0x12b515[_0x02e8('0x17')]?_0x12b515[_0x02e8('0x17')][_0x02e8('0x1d')]||null:null,'limit':0x1,'order':_0x12b515[_0x02e8('0x17')]?_0x12b515['options'][_0x02e8('0x2b')]||null:null,'group':db[_0x02e8('0x15')]['UserId'],'transaction':_0x501189,'lock':_0x501189[_0x02e8('0x2c')][_0x02e8('0x2d')],'include':_0x12b515[_0x02e8('0x17')]?_0x12b515[_0x02e8('0x17')]['include']?_[_0x02e8('0x1c')](_0x12b515[_0x02e8('0x17')][_0x02e8('0x1b')],function(_0x5cfdf5){return{'model':db[_0x5cfdf5['model']],'as':_0x5cfdf5['as'],'attributes':_0x5cfdf5[_0x02e8('0x1d')],'include':_0x5cfdf5[_0x02e8('0x1b')]?_[_0x02e8('0x1c')](_0x5cfdf5[_0x02e8('0x1b')],function(_0x3c85b3){return{'model':db[_0x3c85b3[_0x02e8('0x1e')]],'as':_0x3c85b3['as'],'attributes':_0x3c85b3[_0x02e8('0x1d')],'include':_0x3c85b3[_0x02e8('0x1b')]?_[_0x02e8('0x1c')](_0x3c85b3[_0x02e8('0x1b')],function(_0x3b4c18){return{'model':db[_0x3b4c18[_0x02e8('0x1e')]],'as':_0x3b4c18['as'],'attributes':_0x3b4c18[_0x02e8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x02e8('0x8')](function(_0x1b71b2){var _0x2b9094=[];for(var _0x38a628=0x0;_0x38a628<_0x1b71b2[_0x02e8('0x3b')];_0x38a628+=0x1){_0x2b9094[_0x02e8('0x3c')](_0x1b71b2[_0x38a628][_0x02e8('0x24')](_0x12b515[_0x02e8('0x22')],{'transaction':_0x501189}));}return BPromise['all'](_0x2b9094);});})['then'](function(_0x506059){logger[_0x02e8('0x11')](_0x02e8('0x3a'),_0x12b515);logger[_0x02e8('0xa')](_0x02e8('0x3a'),_0x12b515,JSON[_0x02e8('0xd')](_0x506059));_0x469333(_0x506059);})[_0x02e8('0x13')](function(_0x30703d){logger[_0x02e8('0xe')](_0x02e8('0x3a'),_0x30703d[_0x02e8('0x10')],_0x12b515);_0x3816c6(_0x471ab1[_0x02e8('0xe')](0x1f4,_0x30703d[_0x02e8('0x10')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ca12d4c..be4be98 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 _0xe706=['update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','show','post','create','getPreview','put'];(function(_0x4fcc9c,_0x352ff2){var _0x40fc48=function(_0x2c5155){while(--_0x2c5155){_0x4fcc9c['push'](_0x4fcc9c['shift']());}};_0x40fc48(++_0x352ff2);}(_0xe706,0xa3));var _0x6e70=function(_0x53e297,_0x53189b){_0x53e297=_0x53e297-0x0;var _0x4380ff=_0xe706[_0x53e297];return _0x4380ff;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var express=require('express');var router=express[_0x6e70('0x3')]();var auth=require(_0x6e70('0x4'));var interaction=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var controller=require(_0x6e70('0x7'));router[_0x6e70('0x8')]('/',auth[_0x6e70('0x9')](),controller[_0x6e70('0xa')]);router[_0x6e70('0x8')](_0x6e70('0xb'),auth[_0x6e70('0x9')](),controller[_0x6e70('0xc')]);router[_0x6e70('0x8')](_0x6e70('0xd'),auth[_0x6e70('0x9')](),controller[_0x6e70('0xe')]);router[_0x6e70('0x8')](_0x6e70('0xf'),auth[_0x6e70('0x9')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0x9')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x11')]('/preview',auth['isAuthenticated'](),controller[_0x6e70('0x13')]);router[_0x6e70('0x14')](_0x6e70('0xf'),auth[_0x6e70('0x9')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')](_0x6e70('0xf'),auth[_0x6e70('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbaf0=['getPreview','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/preview'];(function(_0x102cd2,_0x2b6376){var _0x323930=function(_0x43e32e){while(--_0x43e32e){_0x102cd2['push'](_0x102cd2['shift']());}};_0x323930(++_0x2b6376);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var express=require(_0x0baf('0x2'));var router=express[_0x0baf('0x3')]();var auth=require(_0x0baf('0x4'));var interaction=require(_0x0baf('0x5'));var config=require('../../config/environment');var controller=require(_0x0baf('0x6'));router[_0x0baf('0x7')]('/',auth[_0x0baf('0x8')](),controller[_0x0baf('0x9')]);router[_0x0baf('0x7')](_0x0baf('0xa'),auth[_0x0baf('0x8')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x7')]('/opencontacts',auth[_0x0baf('0x8')](),controller['getOpenContacts']);router[_0x0baf('0x7')](_0x0baf('0xc'),auth[_0x0baf('0x8')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0x8')](),controller[_0x0baf('0xf')]);router[_0x0baf('0xe')](_0x0baf('0x10'),auth[_0x0baf('0x8')](),controller[_0x0baf('0x11')]);router['put']('/:id',auth[_0x0baf('0x8')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xc'),auth['isAuthenticated'](),controller[_0x0baf('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 4064386..193928b 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 _0x5161=['INTEGER','contactListQueue','moment','exports'];(function(_0x32904d,_0x28b13c){var _0x252bd9=function(_0x39276f){while(--_0x39276f){_0x32904d['push'](_0x32904d['shift']());}};_0x252bd9(++_0x28b13c);}(_0x5161,0x13e));var _0x1516=function(_0x477cfe,_0x5588f7){_0x477cfe=_0x477cfe-0x0;var _0x2a31a3=_0x5161[_0x477cfe];return _0x2a31a3;};'use strict';var moment=require(_0x1516('0x0'));var Sequelize=require('sequelize');module[_0x1516('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1516('0x2')],'unique':_0x1516('0x3')},'ListId':{'type':Sequelize[_0x1516('0x2')],'unique':_0x1516('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1516('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xd8f4=['contactListQueue','exports','INTEGER'];(function(_0x554b96,_0xa7f28){var _0xe445a8=function(_0x1c2dfb){while(--_0x1c2dfb){_0x554b96['push'](_0x554b96['shift']());}};_0xe445a8(++_0xa7f28);}(_0xd8f4,0xb8));var _0x4d8f=function(_0x215f22,_0x5666fc){_0x215f22=_0x215f22-0x0;var _0x895dc9=_0xd8f4[_0x215f22];return _0x895dc9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4d8f('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4d8f('0x1')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4d8f('0x1')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x4d8f('0x1')],'unique':_0x4d8f('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ab44842..d29c797 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 _0x753d=['options','find','update','body','describe','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','destroy','error','stack','name','send','index','CmHopperBlack','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','nolimit','limit','order','sort','where','pick','day','add','filter','merge','includeAll','include','findAll','then','catch','show','params','rawAttributes','fields'];(function(_0x519aa1,_0x407334){var _0x106aa9=function(_0x44c6aa){while(--_0x44c6aa){_0x519aa1['push'](_0x519aa1['shift']());}};_0x106aa9(++_0x407334);}(_0x753d,0x89));var _0xd753=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x753d[_0x2641f9];return _0x585741;};'use strict';var jsonpatch=require(_0xd753('0x0'));var rp=require(_0xd753('0x1'));var moment=require('moment');var BPromise=require(_0xd753('0x2'));var Mustache=require(_0xd753('0x3'));var util=require('util');var path=require('path');var sox=require(_0xd753('0x4'));var csv=require(_0xd753('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd753('0x6'));var squel=require('squel');var crypto=require(_0xd753('0x7'));var jsforce=require(_0xd753('0x8'));var deskjs=require(_0xd753('0x9'));var toCsv=require(_0xd753('0x5'));var querystring=require(_0xd753('0xa'));var Papa=require('papaparse');var qs=require(_0xd753('0xb'));var logger=require(_0xd753('0xc'))(_0xd753('0xd'));var utils=require(_0xd753('0xe'));var config=require(_0xd753('0xf'));var db=require(_0xd753('0x10'))['db'];function respondWithStatusCode(_0x908595,_0x3f6e10){_0x3f6e10=_0x3f6e10||0xcc;return function(_0x4b41df){if(_0x4b41df){return _0x908595[_0xd753('0x11')](_0x3f6e10);}return _0x908595[_0xd753('0x12')](_0x3f6e10)[_0xd753('0x13')]();};}function respondWithResult(_0x226c5d,_0x922cbd){_0x922cbd=_0x922cbd||0xc8;return function(_0x450cb6){if(_0x450cb6){return _0x226c5d[_0xd753('0x12')](_0x922cbd)[_0xd753('0x14')](_0x450cb6);}};}function respondWithFilteredResult(_0x9ed08f,_0x3a7e9c){return function(_0xf0c91c){if(_0xf0c91c){var _0x6dc719=_0xf0c91c[_0xd753('0x15')],_0x183423=_0x3a7e9c[_0xd753('0x16')],_0x177101=_0x3a7e9c[_0xd753('0x16')]+_0x3a7e9c['limit'],_0x47abc9;if(_0x177101>=_0x6dc719){_0x177101=_0x6dc719;_0x47abc9=0xc8;}else{_0x47abc9=0xce;}_0x9ed08f['status'](_0x47abc9);return _0x9ed08f[_0xd753('0x17')](_0xd753('0x18'),_0x183423+'-'+_0x177101+'/'+_0x6dc719)[_0xd753('0x14')](_0xf0c91c);}return null;};}function patchUpdates(_0x4146b7){return function(_0x2b0180){try{jsonpatch[_0xd753('0x19')](_0x2b0180,_0x4146b7,!![]);}catch(_0x3e85f8){return BPromise['reject'](_0x3e85f8);}return _0x2b0180[_0xd753('0x1a')]();};}function saveUpdates(_0x19926a,_0x295f26){return function(_0x5bd45f){if(_0x5bd45f){return _0x5bd45f['update'](_0x19926a)['then'](function(_0x21831c){return _0x21831c;});}return null;};}function removeEntity(_0x31e61f,_0x5bcb07){return function(_0x45552c){if(_0x45552c){return _0x45552c[_0xd753('0x1b')]()['then'](function(){_0x31e61f['status'](0xcc)[_0xd753('0x13')]();});}};}function handleEntityNotFound(_0x4d1905,_0x5e32ae){return function(_0x35cee6){if(!_0x35cee6){_0x4d1905[_0xd753('0x11')](0x194);}return _0x35cee6;};}function handleError(_0x4a114c,_0x88d4d){_0x88d4d=_0x88d4d||0x1f4;return function(_0x3104bd){logger[_0xd753('0x1c')](_0x3104bd[_0xd753('0x1d')]);if(_0x3104bd['name']){delete _0x3104bd[_0xd753('0x1e')];}_0x4a114c['status'](_0x88d4d)[_0xd753('0x1f')](_0x3104bd);};}exports[_0xd753('0x20')]=function(_0x1c707e,_0x491f12){var _0x17f34a={},_0x48e14e={},_0x3ad9c5={'count':0x0,'rows':[]};var _0x5956a3=db[_0xd753('0x21')]['rawAttributes'];_0x48e14e[_0xd753('0x22')]=_[_0xd753('0x23')](_0x5956a3);var _0x1daf26={'dateStart':_0x1c707e[_0xd753('0x24')][_0xd753('0x25')],'dateEnd':_0x1c707e[_0xd753('0x24')][_0xd753('0x26')]};delete _0x1c707e[_0xd753('0x24')][_0xd753('0x25')];delete _0x1c707e[_0xd753('0x24')]['dateEnd'];_0x48e14e[_0xd753('0x24')]=_[_0xd753('0x23')](_0x1c707e[_0xd753('0x24')]);_0x48e14e[_0xd753('0x27')]=_['intersection'](_0x48e14e[_0xd753('0x22')],_0x48e14e[_0xd753('0x24')]);_0x17f34a[_0xd753('0x28')]=_[_0xd753('0x29')](_0x48e14e[_0xd753('0x22')],qs['fields'](_0x1c707e['query']['fields']));_0x17f34a[_0xd753('0x28')]=_0x17f34a['attributes']['length']?_0x17f34a[_0xd753('0x28')]:_0x48e14e[_0xd753('0x22')];if(!_0x1c707e['query']['hasOwnProperty'](_0xd753('0x2a'))){_0x17f34a[_0xd753('0x2b')]=qs['limit'](_0x1c707e[_0xd753('0x24')][_0xd753('0x2b')]);_0x17f34a['offset']=qs[_0xd753('0x16')](_0x1c707e['query'][_0xd753('0x16')]);}_0x17f34a[_0xd753('0x2c')]=qs['sort'](_0x1c707e[_0xd753('0x24')][_0xd753('0x2d')]);_0x17f34a[_0xd753('0x2e')]=qs[_0xd753('0x27')](_[_0xd753('0x2f')](_0x1c707e[_0xd753('0x24')],_0x48e14e[_0xd753('0x27')]));if(_0x1daf26[_0xd753('0x25')]){if(_0x1daf26[_0xd753('0x26')]){_0x1daf26['dateEnd']=moment(_0x1daf26[_0xd753('0x26')])['add'](0x1,_0xd753('0x30'));}else{_0x1daf26[_0xd753('0x26')]=moment(_0x1daf26['dateStart'])[_0xd753('0x31')](0x1,_0xd753('0x30'));}_['merge'](_0x17f34a[_0xd753('0x2e')],{'createdAt':{'$gte':_0x1daf26[_0xd753('0x25')],'$lte':_0x1daf26['dateEnd']}});}if(_0x1c707e['query'][_0xd753('0x32')]){_0x17f34a[_0xd753('0x2e')]=_[_0xd753('0x33')](_0x17f34a[_0xd753('0x2e')],{'$or':_['map'](_0x17f34a[_0xd753('0x28')],function(_0x1b8fa0){var _0x221f1d={};_0x221f1d[_0x1b8fa0]={'$like':'%'+_0x1c707e['query'][_0xd753('0x32')]+'%'};return _0x221f1d;})});}_0x17f34a=_[_0xd753('0x33')]({},_0x17f34a,_0x1c707e['options']);var _0x4d4e60={'where':_0x17f34a[_0xd753('0x2e')]};return db['CmHopperBlack']['count'](_0x4d4e60)['then'](function(_0x30df25){_0x3ad9c5['count']=_0x30df25;if(_0x1c707e[_0xd753('0x24')][_0xd753('0x34')]){_0x17f34a[_0xd753('0x35')]=[{'all':!![]}];}return db[_0xd753('0x21')][_0xd753('0x36')](_0x17f34a);})[_0xd753('0x37')](function(_0xba261){_0x3ad9c5['rows']=_0xba261;return _0x3ad9c5;})[_0xd753('0x37')](respondWithFilteredResult(_0x491f12,_0x17f34a))[_0xd753('0x38')](handleError(_0x491f12,null));};exports[_0xd753('0x39')]=function(_0x156c54,_0xf1c8a8){var _0x879cf7={'raw':!![],'where':{'id':_0x156c54[_0xd753('0x3a')]['id']}},_0x1dc75e={};_0x1dc75e[_0xd753('0x22')]=_['keys'](db[_0xd753('0x21')][_0xd753('0x3b')]);_0x1dc75e['query']=_[_0xd753('0x23')](_0x156c54['query']);_0x1dc75e[_0xd753('0x27')]=_[_0xd753('0x29')](_0x1dc75e[_0xd753('0x22')],_0x1dc75e['query']);_0x879cf7[_0xd753('0x28')]=_['intersection'](_0x1dc75e['model'],qs[_0xd753('0x3c')](_0x156c54['query'][_0xd753('0x3c')]));_0x879cf7[_0xd753('0x28')]=_0x879cf7[_0xd753('0x28')]['length']?_0x879cf7[_0xd753('0x28')]:_0x1dc75e[_0xd753('0x22')];if(_0x156c54[_0xd753('0x24')][_0xd753('0x34')]){_0x879cf7[_0xd753('0x35')]=[{'all':!![]}];}_0x879cf7=_['merge']({},_0x879cf7,_0x156c54[_0xd753('0x3d')]);return db[_0xd753('0x21')][_0xd753('0x3e')](_0x879cf7)['then'](handleEntityNotFound(_0xf1c8a8,null))[_0xd753('0x37')](respondWithResult(_0xf1c8a8,null))[_0xd753('0x38')](handleError(_0xf1c8a8,null));};exports[_0xd753('0x3f')]=function(_0x1cb2ef,_0x434164){if(_0x1cb2ef[_0xd753('0x40')]['id']){delete _0x1cb2ef[_0xd753('0x40')]['id'];}return db[_0xd753('0x21')][_0xd753('0x3e')]({'where':{'id':_0x1cb2ef[_0xd753('0x3a')]['id']}})[_0xd753('0x37')](handleEntityNotFound(_0x434164,null))['then'](saveUpdates(_0x1cb2ef[_0xd753('0x40')],null))[_0xd753('0x37')](respondWithResult(_0x434164,null))[_0xd753('0x38')](handleError(_0x434164,null));};exports[_0xd753('0x1b')]=function(_0x1152c6,_0x12cabb){return db[_0xd753('0x21')][_0xd753('0x3e')]({'where':{'id':_0x1152c6[_0xd753('0x3a')]['id']}})[_0xd753('0x37')](handleEntityNotFound(_0x12cabb,null))['then'](removeEntity(_0x12cabb,null))['catch'](handleError(_0x12cabb,null));};exports[_0xd753('0x41')]=function(_0x24a70a,_0x140ea3){return db[_0xd753('0x21')][_0xd753('0x41')]()[_0xd753('0x37')](respondWithResult(_0x140ea3,null))[_0xd753('0x38')](handleError(_0x140ea3,null));}; \ No newline at end of file +var _0xcdc6=['desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','then','error','stack','name','send','index','CmHopperBlack','rawAttributes','model','keys','query','dateStart','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','count','includeAll','findAll','rows','show','params','intersection','find','catch','update','body','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcdc6,0x156));var _0x6cdc=function(_0x27403a,_0x5f0938){_0x27403a=_0x27403a-0x0;var _0x3abc92=_0xcdc6[_0x27403a];return _0x3abc92;};'use strict';var jsonpatch=require(_0x6cdc('0x0'));var rp=require(_0x6cdc('0x1'));var moment=require(_0x6cdc('0x2'));var BPromise=require(_0x6cdc('0x3'));var Mustache=require(_0x6cdc('0x4'));var util=require(_0x6cdc('0x5'));var path=require(_0x6cdc('0x6'));var sox=require(_0x6cdc('0x7'));var csv=require(_0x6cdc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6cdc('0x9'));var squel=require(_0x6cdc('0xa'));var crypto=require(_0x6cdc('0xb'));var jsforce=require(_0x6cdc('0xc'));var deskjs=require(_0x6cdc('0xd'));var toCsv=require(_0x6cdc('0x8'));var querystring=require(_0x6cdc('0xe'));var Papa=require('papaparse');var qs=require(_0x6cdc('0xf'));var logger=require(_0x6cdc('0x10'))(_0x6cdc('0x11'));var utils=require(_0x6cdc('0x12'));var config=require(_0x6cdc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c1945,_0x126888){_0x126888=_0x126888||0xcc;return function(_0x465042){if(_0x465042){return _0x1c1945[_0x6cdc('0x14')](_0x126888);}return _0x1c1945['status'](_0x126888)[_0x6cdc('0x15')]();};}function respondWithResult(_0x4dc171,_0xc3804e){_0xc3804e=_0xc3804e||0xc8;return function(_0x35b067){if(_0x35b067){return _0x4dc171[_0x6cdc('0x16')](_0xc3804e)['json'](_0x35b067);}};}function respondWithFilteredResult(_0x4c3efb,_0x406206){return function(_0x4c6c5a){if(_0x4c6c5a){var _0x13dfe9=_0x4c6c5a['count'],_0x40a568=_0x406206[_0x6cdc('0x17')],_0x5eacc7=_0x406206[_0x6cdc('0x17')]+_0x406206[_0x6cdc('0x18')],_0x1130ed;if(_0x5eacc7>=_0x13dfe9){_0x5eacc7=_0x13dfe9;_0x1130ed=0xc8;}else{_0x1130ed=0xce;}_0x4c3efb[_0x6cdc('0x16')](_0x1130ed);return _0x4c3efb[_0x6cdc('0x19')](_0x6cdc('0x1a'),_0x40a568+'-'+_0x5eacc7+'/'+_0x13dfe9)[_0x6cdc('0x1b')](_0x4c6c5a);}return null;};}function patchUpdates(_0x4d06ef){return function(_0x44c36c){try{jsonpatch[_0x6cdc('0x1c')](_0x44c36c,_0x4d06ef,!![]);}catch(_0x2b735e){return BPromise[_0x6cdc('0x1d')](_0x2b735e);}return _0x44c36c['save']();};}function saveUpdates(_0x120c1a,_0x5b1b40){return function(_0x39d721){if(_0x39d721){return _0x39d721['update'](_0x120c1a)['then'](function(_0x12030b){return _0x12030b;});}return null;};}function removeEntity(_0x2b2dbb,_0x46da89){return function(_0x32f0fa){if(_0x32f0fa){return _0x32f0fa['destroy']()[_0x6cdc('0x1e')](function(){_0x2b2dbb[_0x6cdc('0x16')](0xcc)[_0x6cdc('0x15')]();});}};}function handleEntityNotFound(_0x1e0069,_0x1823f0){return function(_0x5366e7){if(!_0x5366e7){_0x1e0069['sendStatus'](0x194);}return _0x5366e7;};}function handleError(_0x211a63,_0x20612d){_0x20612d=_0x20612d||0x1f4;return function(_0x1a87ad){logger[_0x6cdc('0x1f')](_0x1a87ad[_0x6cdc('0x20')]);if(_0x1a87ad['name']){delete _0x1a87ad[_0x6cdc('0x21')];}_0x211a63[_0x6cdc('0x16')](_0x20612d)[_0x6cdc('0x22')](_0x1a87ad);};}exports[_0x6cdc('0x23')]=function(_0x55c47a,_0x260689){var _0x71af56={},_0x1d9458={},_0x42682b={'count':0x0,'rows':[]};var _0x16c0a1=db[_0x6cdc('0x24')][_0x6cdc('0x25')];_0x1d9458[_0x6cdc('0x26')]=_[_0x6cdc('0x27')](_0x16c0a1);var _0xc95c99={'dateStart':_0x55c47a[_0x6cdc('0x28')][_0x6cdc('0x29')],'dateEnd':_0x55c47a[_0x6cdc('0x28')]['dateEnd']};delete _0x55c47a[_0x6cdc('0x28')]['dateStart'];delete _0x55c47a[_0x6cdc('0x28')]['dateEnd'];_0x1d9458[_0x6cdc('0x28')]=_['keys'](_0x55c47a[_0x6cdc('0x28')]);_0x1d9458[_0x6cdc('0x2a')]=_['intersection'](_0x1d9458[_0x6cdc('0x26')],_0x1d9458['query']);_0x71af56[_0x6cdc('0x2b')]=_['intersection'](_0x1d9458[_0x6cdc('0x26')],qs[_0x6cdc('0x2c')](_0x55c47a[_0x6cdc('0x28')][_0x6cdc('0x2c')]));_0x71af56[_0x6cdc('0x2b')]=_0x71af56[_0x6cdc('0x2b')][_0x6cdc('0x2d')]?_0x71af56['attributes']:_0x1d9458['model'];if(!_0x55c47a[_0x6cdc('0x28')][_0x6cdc('0x2e')](_0x6cdc('0x2f'))){_0x71af56[_0x6cdc('0x18')]=qs[_0x6cdc('0x18')](_0x55c47a[_0x6cdc('0x28')][_0x6cdc('0x18')]);_0x71af56[_0x6cdc('0x17')]=qs['offset'](_0x55c47a[_0x6cdc('0x28')][_0x6cdc('0x17')]);}_0x71af56[_0x6cdc('0x30')]=qs['sort'](_0x55c47a['query'][_0x6cdc('0x31')]);_0x71af56[_0x6cdc('0x32')]=qs[_0x6cdc('0x2a')](_[_0x6cdc('0x33')](_0x55c47a[_0x6cdc('0x28')],_0x1d9458[_0x6cdc('0x2a')]));if(_0xc95c99['dateStart']){if(_0xc95c99[_0x6cdc('0x34')]){_0xc95c99[_0x6cdc('0x34')]=moment(_0xc95c99[_0x6cdc('0x34')])[_0x6cdc('0x35')](0x1,_0x6cdc('0x36'));}else{_0xc95c99[_0x6cdc('0x34')]=moment(_0xc95c99[_0x6cdc('0x29')])['add'](0x1,_0x6cdc('0x36'));}_[_0x6cdc('0x37')](_0x71af56['where'],{'createdAt':{'$gte':_0xc95c99[_0x6cdc('0x29')],'$lte':_0xc95c99[_0x6cdc('0x34')]}});}if(_0x55c47a['query'][_0x6cdc('0x38')]){_0x71af56[_0x6cdc('0x32')]=_[_0x6cdc('0x37')](_0x71af56['where'],{'$or':_[_0x6cdc('0x39')](_0x71af56[_0x6cdc('0x2b')],function(_0x284879){var _0x15e770={};_0x15e770[_0x284879]={'$like':'%'+_0x55c47a[_0x6cdc('0x28')][_0x6cdc('0x38')]+'%'};return _0x15e770;})});}_0x71af56=_[_0x6cdc('0x37')]({},_0x71af56,_0x55c47a[_0x6cdc('0x3a')]);var _0x139534={'where':_0x71af56['where']};return db[_0x6cdc('0x24')][_0x6cdc('0x3b')](_0x139534)[_0x6cdc('0x1e')](function(_0x52da09){_0x42682b[_0x6cdc('0x3b')]=_0x52da09;if(_0x55c47a[_0x6cdc('0x28')][_0x6cdc('0x3c')]){_0x71af56['include']=[{'all':!![]}];}return db[_0x6cdc('0x24')][_0x6cdc('0x3d')](_0x71af56);})[_0x6cdc('0x1e')](function(_0x60baf8){_0x42682b[_0x6cdc('0x3e')]=_0x60baf8;return _0x42682b;})[_0x6cdc('0x1e')](respondWithFilteredResult(_0x260689,_0x71af56))['catch'](handleError(_0x260689,null));};exports[_0x6cdc('0x3f')]=function(_0x4dcba1,_0x3f8913){var _0x540516={'raw':!![],'where':{'id':_0x4dcba1[_0x6cdc('0x40')]['id']}},_0xf059e5={};_0xf059e5[_0x6cdc('0x26')]=_[_0x6cdc('0x27')](db[_0x6cdc('0x24')][_0x6cdc('0x25')]);_0xf059e5[_0x6cdc('0x28')]=_['keys'](_0x4dcba1[_0x6cdc('0x28')]);_0xf059e5[_0x6cdc('0x2a')]=_[_0x6cdc('0x41')](_0xf059e5[_0x6cdc('0x26')],_0xf059e5[_0x6cdc('0x28')]);_0x540516[_0x6cdc('0x2b')]=_[_0x6cdc('0x41')](_0xf059e5[_0x6cdc('0x26')],qs[_0x6cdc('0x2c')](_0x4dcba1[_0x6cdc('0x28')][_0x6cdc('0x2c')]));_0x540516[_0x6cdc('0x2b')]=_0x540516[_0x6cdc('0x2b')][_0x6cdc('0x2d')]?_0x540516[_0x6cdc('0x2b')]:_0xf059e5[_0x6cdc('0x26')];if(_0x4dcba1['query'][_0x6cdc('0x3c')]){_0x540516['include']=[{'all':!![]}];}_0x540516=_['merge']({},_0x540516,_0x4dcba1[_0x6cdc('0x3a')]);return db[_0x6cdc('0x24')][_0x6cdc('0x42')](_0x540516)[_0x6cdc('0x1e')](handleEntityNotFound(_0x3f8913,null))[_0x6cdc('0x1e')](respondWithResult(_0x3f8913,null))[_0x6cdc('0x43')](handleError(_0x3f8913,null));};exports[_0x6cdc('0x44')]=function(_0x18920b,_0xa0b9ca){if(_0x18920b['body']['id']){delete _0x18920b[_0x6cdc('0x45')]['id'];}return db[_0x6cdc('0x24')]['find']({'where':{'id':_0x18920b[_0x6cdc('0x40')]['id']}})[_0x6cdc('0x1e')](handleEntityNotFound(_0xa0b9ca,null))[_0x6cdc('0x1e')](saveUpdates(_0x18920b['body'],null))['then'](respondWithResult(_0xa0b9ca,null))[_0x6cdc('0x43')](handleError(_0xa0b9ca,null));};exports[_0x6cdc('0x46')]=function(_0x16dc4c,_0x40ea14){return db[_0x6cdc('0x24')][_0x6cdc('0x42')]({'where':{'id':_0x16dc4c[_0x6cdc('0x40')]['id']}})[_0x6cdc('0x1e')](handleEntityNotFound(_0x40ea14,null))[_0x6cdc('0x1e')](removeEntity(_0x40ea14,null))['catch'](handleError(_0x40ea14,null));};exports['describe']=function(_0x6fbeec,_0x13f357){return db[_0x6cdc('0x24')]['describe']()[_0x6cdc('0x1e')](respondWithResult(_0x13f357,null))[_0x6cdc('0x43')](handleError(_0x13f357,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 739d573..b115bff 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 _0xcdb7=['request-promise','./cmHopperBlack.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1e2955,_0x3f138a){var _0x247255=function(_0x538e09){while(--_0x538e09){_0x1e2955['push'](_0x1e2955['shift']());}};_0x247255(++_0x3f138a);}(_0xcdb7,0x176));var _0x7cdb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcdb7[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7cdb('0x0'));var util=require(_0x7cdb('0x1'));var logger=require(_0x7cdb('0x2'))(_0x7cdb('0x3'));var moment=require(_0x7cdb('0x4'));var BPromise=require(_0x7cdb('0x5'));var rp=require(_0x7cdb('0x6'));var attributes=require(_0x7cdb('0x7'));module[_0x7cdb('0x8')]=function(_0x59eacb,_0x1e4ef3){return _0x59eacb[_0x7cdb('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa34e=['lodash','util','api','bluebird','request-promise','define'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa34e,0xf6));var _0xea34=function(_0x5d4241,_0x29fba1){_0x5d4241=_0x5d4241-0x0;var _0x5c044b=_0xa34e[_0x5d4241];return _0x5c044b;};'use strict';var _=require(_0xea34('0x0'));var util=require(_0xea34('0x1'));var logger=require('../../config/logger')(_0xea34('0x2'));var moment=require('moment');var BPromise=require(_0xea34('0x3'));var rp=require(_0xea34('0x4'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x189032,_0x4429c8){return _0x189032[_0xea34('0x5')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','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 92a5297..0e5f352 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 _0xa4b9=['model','GetCmHopperBlack','update','body','UpdateCmHopperBlack','catch','DestroyCmHopperBlack','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x322f35,_0x398481){var _0x487e3a=function(_0x55d109){while(--_0x55d109){_0x322f35['push'](_0x322f35['shift']());}};_0x487e3a(++_0x398481);}(_0xa4b9,0x1c3));var _0x9a4b=function(_0x33a47b,_0x25022a){_0x33a47b=_0x33a47b-0x0;var _0x3164d0=_0xa4b9[_0x33a47b];return _0x3164d0;};'use strict';var _=require(_0x9a4b('0x0'));var util=require(_0x9a4b('0x1'));var moment=require(_0x9a4b('0x2'));var BPromise=require(_0x9a4b('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x9a4b('0x4'))['db'];var utils=require(_0x9a4b('0x5'));var logger=require(_0x9a4b('0x6'))('rpc');var config=require(_0x9a4b('0x7'));var jayson=require(_0x9a4b('0x8'));var client=jayson[_0x9a4b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x547a93,_0x328cb4,_0x28cdfb){return new BPromise(function(_0x40b520,_0x354740){return client['request'](_0x547a93,_0x28cdfb)[_0x9a4b('0xa')](function(_0x3e6807){logger[_0x9a4b('0xb')](_0x9a4b('0xc'),_0x328cb4,'request\x20sent');logger[_0x9a4b('0xd')](_0x9a4b('0xe'),_0x328cb4,_0x9a4b('0xf'),JSON[_0x9a4b('0x10')](_0x3e6807));if(_0x3e6807[_0x9a4b('0x11')]){if(_0x3e6807[_0x9a4b('0x11')][_0x9a4b('0x12')]===0x1f4){logger[_0x9a4b('0x11')](_0x9a4b('0xc'),_0x328cb4,_0x3e6807[_0x9a4b('0x11')][_0x9a4b('0x13')]);return _0x354740(_0x3e6807[_0x9a4b('0x11')][_0x9a4b('0x13')]);}logger[_0x9a4b('0x11')](_0x9a4b('0xc'),_0x328cb4,_0x3e6807[_0x9a4b('0x11')][_0x9a4b('0x13')]);return _0x40b520(_0x3e6807[_0x9a4b('0x11')]['message']);}else{logger[_0x9a4b('0xb')](_0x9a4b('0xc'),_0x328cb4,_0x9a4b('0xf'));_0x40b520(_0x3e6807[_0x9a4b('0x14')][_0x9a4b('0x13')]);}})['catch'](function(_0x225698){logger[_0x9a4b('0x11')](_0x9a4b('0xc'),_0x328cb4,_0x225698);_0x354740(_0x225698);});});}exports['GetCmHopperBlack']=function(_0x17fef8){var _0x12581d=this;return new Promise(function(_0x559ef0,_0x17a4ec){return db[_0x9a4b('0x15')][_0x9a4b('0x16')]({'raw':_0x17fef8['options']?_0x17fef8[_0x9a4b('0x17')][_0x9a4b('0x18')]===undefined?!![]:![]:!![],'where':_0x17fef8['options']?_0x17fef8[_0x9a4b('0x17')][_0x9a4b('0x19')]||null:null,'attributes':_0x17fef8[_0x9a4b('0x17')]?_0x17fef8[_0x9a4b('0x17')][_0x9a4b('0x1a')]||null:null,'limit':_0x17fef8[_0x9a4b('0x17')]?_0x17fef8[_0x9a4b('0x17')][_0x9a4b('0x1b')]||null:null,'include':_0x17fef8[_0x9a4b('0x17')]?_0x17fef8['options'][_0x9a4b('0x1c')]?_[_0x9a4b('0x1d')](_0x17fef8[_0x9a4b('0x17')][_0x9a4b('0x1c')],function(_0x53369c){return{'model':db[_0x53369c['model']],'as':_0x53369c['as'],'attributes':_0x53369c[_0x9a4b('0x1a')],'include':_0x53369c[_0x9a4b('0x1c')]?_['map'](_0x53369c[_0x9a4b('0x1c')],function(_0x51a956){return{'model':db[_0x51a956[_0x9a4b('0x1e')]],'as':_0x51a956['as'],'attributes':_0x51a956[_0x9a4b('0x1a')],'include':_0x51a956['include']?_[_0x9a4b('0x1d')](_0x51a956[_0x9a4b('0x1c')],function(_0xb586e3){return{'model':db[_0xb586e3[_0x9a4b('0x1e')]],'as':_0xb586e3['as'],'attributes':_0xb586e3[_0x9a4b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcefc62){logger[_0x9a4b('0xb')](_0x9a4b('0x1f'),_0x17fef8);logger[_0x9a4b('0xd')](_0x9a4b('0x1f'),_0x17fef8,JSON[_0x9a4b('0x10')](_0xcefc62));_0x559ef0(_0xcefc62);})['catch'](function(_0x586096){logger[_0x9a4b('0x11')](_0x9a4b('0x1f'),_0x586096[_0x9a4b('0x13')],_0x17fef8);_0x17a4ec(_0x12581d['error'](0x1f4,_0x586096[_0x9a4b('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x4839ed){var _0x31db2d=this;return new Promise(function(_0x5eae8f,_0x33ca7b){return db[_0x9a4b('0x15')][_0x9a4b('0x20')](_0x4839ed[_0x9a4b('0x21')],{'raw':_0x4839ed[_0x9a4b('0x17')]?_0x4839ed[_0x9a4b('0x17')][_0x9a4b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4839ed[_0x9a4b('0x17')]?_0x4839ed[_0x9a4b('0x17')][_0x9a4b('0x19')]||null:null,'attributes':_0x4839ed[_0x9a4b('0x17')]?_0x4839ed['options'][_0x9a4b('0x1a')]||null:null,'limit':_0x4839ed[_0x9a4b('0x17')]?_0x4839ed[_0x9a4b('0x17')][_0x9a4b('0x1b')]||null:null})[_0x9a4b('0xa')](function(_0x580b4a){logger[_0x9a4b('0xb')](_0x9a4b('0x22'),_0x4839ed);logger[_0x9a4b('0xd')](_0x9a4b('0x22'),_0x4839ed,JSON[_0x9a4b('0x10')](_0x580b4a));_0x5eae8f(_0x580b4a);})[_0x9a4b('0x23')](function(_0x51646f){logger['error'](_0x9a4b('0x22'),_0x51646f['message'],_0x4839ed);_0x33ca7b(_0x31db2d[_0x9a4b('0x11')](0x1f4,_0x51646f[_0x9a4b('0x13')]));});});};exports[_0x9a4b('0x24')]=function(_0x37c0d1){var _0x521824=this;return new Promise(function(_0x4e4e30,_0x1e9fcc){return db[_0x9a4b('0x15')]['destroy']({'where':_0x37c0d1[_0x9a4b('0x17')]?_0x37c0d1[_0x9a4b('0x17')][_0x9a4b('0x19')]||null:null})['then'](function(_0x241d66){logger[_0x9a4b('0xb')](_0x9a4b('0x24'),_0x37c0d1);logger[_0x9a4b('0xd')](_0x9a4b('0x24'),_0x37c0d1,JSON[_0x9a4b('0x10')](_0x241d66));_0x4e4e30(_0x241d66);})['catch'](function(_0x3737bd){logger['error'](_0x9a4b('0x24'),_0x3737bd[_0x9a4b('0x13')],_0x37c0d1);_0x1e9fcc(_0x521824['error'](0x1f4,_0x3737bd[_0x9a4b('0x13')]));});});}; \ No newline at end of file +var _0xa318=['limit','map','include','attributes','model','debug','GetCmHopperBlack','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CmHopperBlack','options','raw','where'];(function(_0x2ddf0b,_0x5eb525){var _0x2ddde2=function(_0xe9282d){while(--_0xe9282d){_0x2ddf0b['push'](_0x2ddf0b['shift']());}};_0x2ddde2(++_0x5eb525);}(_0xa318,0x12c));var _0x8a31=function(_0x4753fd,_0x449dce){_0x4753fd=_0x4753fd-0x0;var _0x499128=_0xa318[_0x4753fd];return _0x499128;};'use strict';var _=require('lodash');var util=require(_0x8a31('0x0'));var moment=require(_0x8a31('0x1'));var BPromise=require(_0x8a31('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x8a31('0x3'))['db'];var utils=require(_0x8a31('0x4'));var logger=require(_0x8a31('0x5'))(_0x8a31('0x6'));var config=require(_0x8a31('0x7'));var jayson=require(_0x8a31('0x8'));var client=jayson[_0x8a31('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7ae2,_0xefcb3d,_0x5cb7ee){return new BPromise(function(_0x578995,_0x4e3fea){return client[_0x8a31('0xa')](_0x2c7ae2,_0x5cb7ee)[_0x8a31('0xb')](function(_0x2f5d60){logger[_0x8a31('0xc')](_0x8a31('0xd'),_0xefcb3d,_0x8a31('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xefcb3d,_0x8a31('0xe'),JSON[_0x8a31('0xf')](_0x2f5d60));if(_0x2f5d60[_0x8a31('0x10')]){if(_0x2f5d60[_0x8a31('0x10')][_0x8a31('0x11')]===0x1f4){logger[_0x8a31('0x10')](_0x8a31('0xd'),_0xefcb3d,_0x2f5d60[_0x8a31('0x10')][_0x8a31('0x12')]);return _0x4e3fea(_0x2f5d60['error'][_0x8a31('0x12')]);}logger[_0x8a31('0x10')](_0x8a31('0xd'),_0xefcb3d,_0x2f5d60[_0x8a31('0x10')]['message']);return _0x578995(_0x2f5d60['error'][_0x8a31('0x12')]);}else{logger[_0x8a31('0xc')](_0x8a31('0xd'),_0xefcb3d,_0x8a31('0xe'));_0x578995(_0x2f5d60['result'][_0x8a31('0x12')]);}})[_0x8a31('0x13')](function(_0x249177){logger['error'](_0x8a31('0xd'),_0xefcb3d,_0x249177);_0x4e3fea(_0x249177);});});}exports['GetCmHopperBlack']=function(_0x102227){var _0x3c1220=this;return new Promise(function(_0x1c94cb,_0x1bbba0){return db[_0x8a31('0x14')]['findAll']({'raw':_0x102227[_0x8a31('0x15')]?_0x102227[_0x8a31('0x15')][_0x8a31('0x16')]===undefined?!![]:![]:!![],'where':_0x102227[_0x8a31('0x15')]?_0x102227[_0x8a31('0x15')][_0x8a31('0x17')]||null:null,'attributes':_0x102227[_0x8a31('0x15')]?_0x102227['options']['attributes']||null:null,'limit':_0x102227['options']?_0x102227[_0x8a31('0x15')][_0x8a31('0x18')]||null:null,'include':_0x102227['options']?_0x102227[_0x8a31('0x15')]['include']?_[_0x8a31('0x19')](_0x102227['options'][_0x8a31('0x1a')],function(_0x43c483){return{'model':db[_0x43c483['model']],'as':_0x43c483['as'],'attributes':_0x43c483[_0x8a31('0x1b')],'include':_0x43c483[_0x8a31('0x1a')]?_[_0x8a31('0x19')](_0x43c483['include'],function(_0x284f2f){return{'model':db[_0x284f2f[_0x8a31('0x1c')]],'as':_0x284f2f['as'],'attributes':_0x284f2f['attributes'],'include':_0x284f2f[_0x8a31('0x1a')]?_[_0x8a31('0x19')](_0x284f2f[_0x8a31('0x1a')],function(_0xf20b54){return{'model':db[_0xf20b54['model']],'as':_0xf20b54['as'],'attributes':_0xf20b54[_0x8a31('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8a31('0xb')](function(_0x57058b){logger['info']('GetCmHopperBlack',_0x102227);logger[_0x8a31('0x1d')](_0x8a31('0x1e'),_0x102227,JSON[_0x8a31('0xf')](_0x57058b));_0x1c94cb(_0x57058b);})[_0x8a31('0x13')](function(_0x476c7d){logger[_0x8a31('0x10')](_0x8a31('0x1e'),_0x476c7d['message'],_0x102227);_0x1bbba0(_0x3c1220['error'](0x1f4,_0x476c7d[_0x8a31('0x12')]));});});};exports[_0x8a31('0x1f')]=function(_0x3d6810){var _0x228618=this;return new Promise(function(_0x384e0d,_0x2ef6c7){return db[_0x8a31('0x14')][_0x8a31('0x20')](_0x3d6810[_0x8a31('0x21')],{'raw':_0x3d6810[_0x8a31('0x15')]?_0x3d6810[_0x8a31('0x15')][_0x8a31('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6810['options']?_0x3d6810[_0x8a31('0x15')]['where']||null:null,'attributes':_0x3d6810[_0x8a31('0x15')]?_0x3d6810[_0x8a31('0x15')][_0x8a31('0x1b')]||null:null,'limit':_0x3d6810[_0x8a31('0x15')]?_0x3d6810[_0x8a31('0x15')]['limit']||null:null})['then'](function(_0x6f453c){logger[_0x8a31('0xc')](_0x8a31('0x1f'),_0x3d6810);logger[_0x8a31('0x1d')](_0x8a31('0x1f'),_0x3d6810,JSON[_0x8a31('0xf')](_0x6f453c));_0x384e0d(_0x6f453c);})[_0x8a31('0x13')](function(_0x553ad8){logger[_0x8a31('0x10')]('UpdateCmHopperBlack',_0x553ad8[_0x8a31('0x12')],_0x3d6810);_0x2ef6c7(_0x228618[_0x8a31('0x10')](0x1f4,_0x553ad8[_0x8a31('0x12')]));});});};exports[_0x8a31('0x22')]=function(_0x51d36b){var _0x34ff5c=this;return new Promise(function(_0x108f4d,_0x3bbc5e){return db[_0x8a31('0x14')][_0x8a31('0x23')]({'where':_0x51d36b[_0x8a31('0x15')]?_0x51d36b[_0x8a31('0x15')][_0x8a31('0x17')]||null:null})[_0x8a31('0xb')](function(_0x44f977){logger[_0x8a31('0xc')](_0x8a31('0x22'),_0x51d36b);logger[_0x8a31('0x1d')]('DestroyCmHopperBlack',_0x51d36b,JSON[_0x8a31('0xf')](_0x44f977));_0x108f4d(_0x44f977);})['catch'](function(_0x1991f5){logger[_0x8a31('0x10')](_0x8a31('0x22'),_0x1991f5[_0x8a31('0x12')],_0x51d36b);_0x3bbc5e(_0x34ff5c[_0x8a31('0x10')](0x1f4,_0x1991f5['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6a2f2fd..ea2cc84 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 _0x3f4d=['get','isAuthenticated','describe','/:id','show','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x3f4d,0xb3));var _0xd3f4=function(_0x1b2763,_0x49e0b5){_0x1b2763=_0x1b2763-0x0;var _0x5a02a5=_0x3f4d[_0x1b2763];return _0x5a02a5;};'use strict';var multer=require(_0xd3f4('0x0'));var util=require(_0xd3f4('0x1'));var path=require(_0xd3f4('0x2'));var express=require(_0xd3f4('0x3'));var router=express['Router']();var auth=require(_0xd3f4('0x4'));var interaction=require(_0xd3f4('0x5'));var config=require(_0xd3f4('0x6'));var controller=require(_0xd3f4('0x7'));router[_0xd3f4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd3f4('0x8')]('/describe',auth[_0xd3f4('0x9')](),controller[_0xd3f4('0xa')]);router['get'](_0xd3f4('0xb'),auth[_0xd3f4('0x9')](),controller[_0xd3f4('0xc')]);router[_0xd3f4('0xd')]('/:id',auth[_0xd3f4('0x9')](),controller[_0xd3f4('0xe')]);router['delete'](_0xd3f4('0xb'),auth[_0xd3f4('0x9')](),controller[_0xd3f4('0xf')]);module[_0xd3f4('0x10')]=router; \ No newline at end of file +var _0x4063=['describe','/:id','show','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x527fb4,_0xc15f2e){var _0x4d50cd=function(_0xb9ecaa){while(--_0xb9ecaa){_0x527fb4['push'](_0x527fb4['shift']());}};_0x4d50cd(++_0xc15f2e);}(_0x4063,0x1c9));var _0x3406=function(_0x41f6d4,_0x255693){_0x41f6d4=_0x41f6d4-0x0;var _0x42a2a9=_0x4063[_0x41f6d4];return _0x42a2a9;};'use strict';var multer=require('multer');var util=require(_0x3406('0x0'));var path=require(_0x3406('0x1'));var express=require(_0x3406('0x2'));var router=express[_0x3406('0x3')]();var auth=require(_0x3406('0x4'));var interaction=require(_0x3406('0x5'));var config=require(_0x3406('0x6'));var controller=require(_0x3406('0x7'));router[_0x3406('0x8')]('/',auth[_0x3406('0x9')](),controller[_0x3406('0xa')]);router[_0x3406('0x8')]('/describe',auth[_0x3406('0x9')](),controller[_0x3406('0xb')]);router[_0x3406('0x8')](_0x3406('0xc'),auth[_0x3406('0x9')](),controller[_0x3406('0xd')]);router[_0x3406('0xe')]('/:id',auth[_0x3406('0x9')](),controller[_0x3406('0xf')]);router['delete'](_0x3406('0xc'),auth[_0x3406('0x9')](),controller[_0x3406('0x10')]);module[_0x3406('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b2732f5..92cb4aa 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 _0x8f51=['STRING','DATE','getDataValue','endtime','followuptime','diff','setDataValue','dispositionat','BOOLEAN','moment','exports','INTEGER'];(function(_0x4881d4,_0x20675d){var _0x3d0940=function(_0x5ca9dd){while(--_0x5ca9dd){_0x4881d4['push'](_0x4881d4['shift']());}};_0x3d0940(++_0x20675d);}(_0x8f51,0xed));var _0x18f5=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x8f51[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x18f5('0x0'));module[_0x18f5('0x1')]={'state':{'type':Sequelize[_0x18f5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x18f5('0x3')]},'scheduledat':{'type':Sequelize[_0x18f5('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x18f5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x18f5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x18f5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x18f5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x18f5('0x3')]},'originatecalleridname':{'type':Sequelize[_0x18f5('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x18f5('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x18f5('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x18f5('0x4')]},'ringtime':{'type':Sequelize[_0x18f5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x18f5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x18f5('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x18f5('0x3')]},'reason':{'type':Sequelize[_0x18f5('0x3')]},'disposition':{'type':Sequelize[_0x18f5('0x3')]},'dispositionat':{'type':Sequelize[_0x18f5('0x4')],'set':function(_0x32ffc8){var _0x1f92a2=this[_0x18f5('0x5')](_0x18f5('0x6'));if(_0x1f92a2&&_0x32ffc8){this['setDataValue'](_0x18f5('0x7'),moment(_0x32ffc8)[_0x18f5('0x8')](moment(_0x1f92a2),'seconds'));}return this[_0x18f5('0x9')](_0x18f5('0xa'),_0x32ffc8);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x18f5('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x18f5('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x18f5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x18f5('0x4')]},'deleted':{'type':Sequelize[_0x18f5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x18f5('0x4')]}}; \ No newline at end of file +var _0xd6c8=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','exports'];(function(_0xda84bb,_0x2df3f7){var _0x2cf2ff=function(_0x430c2b){while(--_0x430c2b){_0xda84bb['push'](_0xda84bb['shift']());}};_0x2cf2ff(++_0x2df3f7);}(_0xd6c8,0xdb));var _0x8d6c=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0xd6c8[_0xfd495c];return _0x561dd8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x8d6c('0x0')]={'state':{'type':Sequelize[_0x8d6c('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8d6c('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x8d6c('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8d6c('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8d6c('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x8d6c('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8d6c('0x2')]},'calleridnum':{'type':Sequelize[_0x8d6c('0x2')]},'calleridname':{'type':Sequelize[_0x8d6c('0x2')]},'starttime':{'type':Sequelize[_0x8d6c('0x3')]},'responsetime':{'type':Sequelize[_0x8d6c('0x3')]},'answertime':{'type':Sequelize[_0x8d6c('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8d6c('0x3')]},'ringtime':{'type':Sequelize[_0x8d6c('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8d6c('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8d6c('0x2')]},'campaign':{'type':Sequelize[_0x8d6c('0x2')]},'campaigntype':{'type':Sequelize[_0x8d6c('0x2')]},'membername':{'type':Sequelize[_0x8d6c('0x2')]},'reason':{'type':Sequelize[_0x8d6c('0x2')]},'disposition':{'type':Sequelize[_0x8d6c('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x807ca5){var _0x57e27a=this[_0x8d6c('0x4')](_0x8d6c('0x5'));if(_0x57e27a&&_0x807ca5){this[_0x8d6c('0x6')](_0x8d6c('0x7'),moment(_0x807ca5)[_0x8d6c('0x8')](moment(_0x57e27a),_0x8d6c('0x9')));}return this[_0x8d6c('0x6')]('dispositionat',_0x807ca5);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8d6c('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8d6c('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x8d6c('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8d6c('0x3')]},'deleted':{'type':Sequelize[_0x8d6c('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8d6c('0x3')]},'recallme':{'type':Sequelize[_0x8d6c('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8d6c('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index eabb435..3367f78 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 _0x9b56=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','CmHopperFinal','rawAttributes','query','dateEnd','dateStart','keys','filters','intersection','attributes','model','fields','length','nolimit','order','where','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','find','describe','body','uniqueid','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','NOW()','field'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0x9b56,0x91));var _0x69b5=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x9b56[_0x872b02];return _0x1a6b24;};'use strict';var jsonpatch=require(_0x69b5('0x0'));var rp=require(_0x69b5('0x1'));var moment=require('moment');var BPromise=require(_0x69b5('0x2'));var Mustache=require('mustache');var util=require(_0x69b5('0x3'));var path=require('path');var sox=require(_0x69b5('0x4'));var csv=require(_0x69b5('0x5'));var ejs=require(_0x69b5('0x6'));var fs=require('fs');var _=require(_0x69b5('0x7'));var squel=require(_0x69b5('0x8'));var crypto=require(_0x69b5('0x9'));var jsforce=require(_0x69b5('0xa'));var deskjs=require(_0x69b5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x69b5('0xc'));var Papa=require(_0x69b5('0xd'));var qs=require(_0x69b5('0xe'));var logger=require(_0x69b5('0xf'))(_0x69b5('0x10'));var utils=require(_0x69b5('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x803642,_0x57e871){_0x57e871=_0x57e871||0xcc;return function(_0x32202d){if(_0x32202d){return _0x803642['sendStatus'](_0x57e871);}return _0x803642[_0x69b5('0x12')](_0x57e871)['end']();};}function respondWithResult(_0x14f366,_0x40c612){_0x40c612=_0x40c612||0xc8;return function(_0x5ea045){if(_0x5ea045){return _0x14f366[_0x69b5('0x12')](_0x40c612)['json'](_0x5ea045);}};}function respondWithFilteredResult(_0x287d0f,_0x2af3a2){return function(_0x2c25dc){if(_0x2c25dc){var _0x5cbd48=_0x2c25dc[_0x69b5('0x13')],_0x596ee8=_0x2af3a2[_0x69b5('0x14')],_0x46eb4d=_0x2af3a2['offset']+_0x2af3a2[_0x69b5('0x15')],_0xa4880e;if(_0x46eb4d>=_0x5cbd48){_0x46eb4d=_0x5cbd48;_0xa4880e=0xc8;}else{_0xa4880e=0xce;}_0x287d0f[_0x69b5('0x12')](_0xa4880e);return _0x287d0f[_0x69b5('0x16')](_0x69b5('0x17'),_0x596ee8+'-'+_0x46eb4d+'/'+_0x5cbd48)['json'](_0x2c25dc);}return null;};}function patchUpdates(_0xf19503){return function(_0x5179cc){try{jsonpatch['apply'](_0x5179cc,_0xf19503,!![]);}catch(_0x27e97e){return BPromise[_0x69b5('0x18')](_0x27e97e);}return _0x5179cc[_0x69b5('0x19')]();};}function saveUpdates(_0x317cfc,_0x57b2a9){return function(_0x4d8072){if(_0x4d8072){return _0x4d8072[_0x69b5('0x1a')](_0x317cfc)[_0x69b5('0x1b')](function(_0x4a81a9){return _0x4a81a9;});}return null;};}function removeEntity(_0x299019,_0x3ad539){return function(_0x18bd86){if(_0x18bd86){return _0x18bd86[_0x69b5('0x1c')]()[_0x69b5('0x1b')](function(){_0x299019[_0x69b5('0x12')](0xcc)[_0x69b5('0x1d')]();});}};}function handleEntityNotFound(_0xf8a1b1,_0xa8af9){return function(_0x24f43c){if(!_0x24f43c){_0xf8a1b1['sendStatus'](0x194);}return _0x24f43c;};}function handleError(_0x5a13ab,_0x3cc1e4){_0x3cc1e4=_0x3cc1e4||0x1f4;return function(_0x44e2a7){logger[_0x69b5('0x1e')](_0x44e2a7[_0x69b5('0x1f')]);if(_0x44e2a7[_0x69b5('0x20')]){delete _0x44e2a7[_0x69b5('0x20')];}_0x5a13ab['status'](_0x3cc1e4)[_0x69b5('0x21')](_0x44e2a7);};}exports['index']=function(_0x1d63a3,_0x3cc213){var _0x21f95a={},_0x2267da={},_0x3410d0={'count':0x0,'rows':[]};var _0x499c0d=db[_0x69b5('0x22')][_0x69b5('0x23')];_0x2267da['model']=_['keys'](_0x499c0d);var _0x344c79={'dateStart':_0x1d63a3[_0x69b5('0x24')]['dateStart'],'dateEnd':_0x1d63a3[_0x69b5('0x24')][_0x69b5('0x25')]};delete _0x1d63a3['query'][_0x69b5('0x26')];delete _0x1d63a3['query'][_0x69b5('0x25')];_0x2267da[_0x69b5('0x24')]=_[_0x69b5('0x27')](_0x1d63a3['query']);_0x2267da[_0x69b5('0x28')]=_[_0x69b5('0x29')](_0x2267da['model'],_0x2267da[_0x69b5('0x24')]);_0x21f95a[_0x69b5('0x2a')]=_[_0x69b5('0x29')](_0x2267da[_0x69b5('0x2b')],qs['fields'](_0x1d63a3['query'][_0x69b5('0x2c')]));_0x21f95a[_0x69b5('0x2a')]=_0x21f95a['attributes'][_0x69b5('0x2d')]?_0x21f95a[_0x69b5('0x2a')]:_0x2267da[_0x69b5('0x2b')];if(!_0x1d63a3[_0x69b5('0x24')]['hasOwnProperty'](_0x69b5('0x2e'))){_0x21f95a[_0x69b5('0x15')]=qs[_0x69b5('0x15')](_0x1d63a3['query']['limit']);_0x21f95a[_0x69b5('0x14')]=qs['offset'](_0x1d63a3['query'][_0x69b5('0x14')]);}_0x21f95a[_0x69b5('0x2f')]=qs['sort'](_0x1d63a3[_0x69b5('0x24')]['sort']);_0x21f95a[_0x69b5('0x30')]=qs[_0x69b5('0x28')](_['pick'](_0x1d63a3[_0x69b5('0x24')],_0x2267da['filters']));if(_0x344c79[_0x69b5('0x26')]){if(_0x344c79[_0x69b5('0x25')]){_0x344c79[_0x69b5('0x25')]=moment(_0x344c79[_0x69b5('0x25')])['add'](0x1,_0x69b5('0x31'));}else{_0x344c79['dateEnd']=moment(_0x344c79['dateStart'])['add'](0x1,'day');}_[_0x69b5('0x32')](_0x21f95a[_0x69b5('0x30')],{'createdAt':{'$gte':_0x344c79['dateStart'],'$lte':_0x344c79['dateEnd']}});}if(_0x1d63a3[_0x69b5('0x24')][_0x69b5('0x33')]){_0x21f95a[_0x69b5('0x30')]=_[_0x69b5('0x32')](_0x21f95a[_0x69b5('0x30')],{'$or':_[_0x69b5('0x34')](_0x21f95a[_0x69b5('0x2a')],function(_0x2b0b00){var _0x1a7121={};_0x1a7121[_0x2b0b00]={'$like':'%'+_0x1d63a3[_0x69b5('0x24')][_0x69b5('0x33')]+'%'};return _0x1a7121;})});}_0x21f95a=_[_0x69b5('0x32')]({},_0x21f95a,_0x1d63a3[_0x69b5('0x35')]);var _0x352fc7={'where':_0x21f95a[_0x69b5('0x30')]};return db[_0x69b5('0x22')][_0x69b5('0x13')](_0x352fc7)[_0x69b5('0x1b')](function(_0x5d2300){_0x3410d0[_0x69b5('0x13')]=_0x5d2300;if(_0x1d63a3[_0x69b5('0x24')][_0x69b5('0x36')]){_0x21f95a[_0x69b5('0x37')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x69b5('0x38')](_0x21f95a);})[_0x69b5('0x1b')](function(_0x53df98){_0x3410d0[_0x69b5('0x39')]=_0x53df98;return _0x3410d0;})[_0x69b5('0x1b')](respondWithFilteredResult(_0x3cc213,_0x21f95a))[_0x69b5('0x3a')](handleError(_0x3cc213,null));};exports[_0x69b5('0x3b')]=function(_0x17f3f4,_0x45bc8e){var _0x181285={'raw':!![],'where':{'id':_0x17f3f4[_0x69b5('0x3c')]['id']}},_0x34e702={};_0x34e702[_0x69b5('0x2b')]=_[_0x69b5('0x27')](db[_0x69b5('0x22')]['rawAttributes']);_0x34e702[_0x69b5('0x24')]=_[_0x69b5('0x27')](_0x17f3f4[_0x69b5('0x24')]);_0x34e702[_0x69b5('0x28')]=_['intersection'](_0x34e702['model'],_0x34e702[_0x69b5('0x24')]);_0x181285[_0x69b5('0x2a')]=_['intersection'](_0x34e702[_0x69b5('0x2b')],qs[_0x69b5('0x2c')](_0x17f3f4[_0x69b5('0x24')][_0x69b5('0x2c')]));_0x181285['attributes']=_0x181285[_0x69b5('0x2a')][_0x69b5('0x2d')]?_0x181285[_0x69b5('0x2a')]:_0x34e702[_0x69b5('0x2b')];if(_0x17f3f4[_0x69b5('0x24')][_0x69b5('0x36')]){_0x181285[_0x69b5('0x37')]=[{'all':!![]}];}_0x181285=_[_0x69b5('0x32')]({},_0x181285,_0x17f3f4[_0x69b5('0x35')]);return db[_0x69b5('0x22')][_0x69b5('0x3d')](_0x181285)[_0x69b5('0x1b')](handleEntityNotFound(_0x45bc8e,null))['then'](respondWithResult(_0x45bc8e,null))[_0x69b5('0x3a')](handleError(_0x45bc8e,null));};exports['describe']=function(_0x5a9ccc,_0x19f774){return db[_0x69b5('0x22')][_0x69b5('0x3e')]()['then'](respondWithResult(_0x19f774,null))[_0x69b5('0x3a')](handleError(_0x19f774,null));};exports[_0x69b5('0x1a')]=function(_0x33f220,_0x3085d8){if(_0x33f220[_0x69b5('0x3f')]['uniqueid']){delete _0x33f220['body'][_0x69b5('0x40')];}return db[_0x69b5('0x22')][_0x69b5('0x3d')]({'where':{'uniqueid':_0x33f220[_0x69b5('0x3c')]['id']}})[_0x69b5('0x1b')](handleEntityNotFound(_0x3085d8,null))['then'](saveUpdates(_0x33f220[_0x69b5('0x3f')],null))[_0x69b5('0x1b')](respondWithResult(_0x3085d8,null))['catch'](handleError(_0x3085d8,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x29f721,_0x1af6fd,_0xf2097b){return db[_0x69b5('0x22')][_0x69b5('0x38')]({'raw':![],'where':{'VoiceQueueId':_0x29f721[_0x69b5('0x3c')]['id']},'attributes':[[db[_0x69b5('0x41')]['fn'](_0x69b5('0x42'),db['sequelize']['fn']('IF',db[_0x69b5('0x41')][_0x69b5('0x43')](_0x69b5('0x44')))),_0x69b5('0x45')],[db[_0x69b5('0x41')]['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db['sequelize'][_0x69b5('0x43')]('`state`\x20=\x203,\x201,\x20null'))),_0x69b5('0x46')],[db[_0x69b5('0x41')]['fn']('COUNT',db[_0x69b5('0x41')]['fn']('IF',db[_0x69b5('0x41')][_0x69b5('0x43')](_0x69b5('0x47')))),_0x69b5('0x48')],[db[_0x69b5('0x41')]['fn'](_0x69b5('0x42'),db['sequelize']['fn']('IF',db['sequelize'][_0x69b5('0x43')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x69b5('0x41')]['fn']('COUNT',db[_0x69b5('0x41')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x69b5('0x49')],[db[_0x69b5('0x41')]['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db[_0x69b5('0x41')]['literal'](_0x69b5('0x4a')))),_0x69b5('0x4b')],[db[_0x69b5('0x41')]['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db[_0x69b5('0x41')][_0x69b5('0x43')](_0x69b5('0x4c')))),_0x69b5('0x4d')]]})['then'](handleEntityNotFound(_0x1af6fd,null))[_0x69b5('0x1b')](respondWithResult(_0x1af6fd,null))['catch'](handleError(_0x1af6fd,null));};exports[_0x69b5('0x4e')]=function(_0x551a0a,_0x1c9b15,_0x271466){return db[_0x69b5('0x22')][_0x69b5('0x38')]({'raw':![],'where':{'CampaignId':_0x551a0a[_0x69b5('0x3c')]['id']},'attributes':[[db['sequelize']['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db[_0x69b5('0x41')]['literal'](_0x69b5('0x44')))),'noSuchContacts'],[db['sequelize']['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db[_0x69b5('0x41')][_0x69b5('0x43')](_0x69b5('0x4f')))),_0x69b5('0x46')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x69b5('0x41')]['literal'](_0x69b5('0x47')))),_0x69b5('0x48')],[db[_0x69b5('0x41')]['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db['sequelize'][_0x69b5('0x43')](_0x69b5('0x50')))),_0x69b5('0x51')],[db['sequelize']['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db[_0x69b5('0x41')]['literal'](_0x69b5('0x52')))),_0x69b5('0x49')],[db[_0x69b5('0x41')]['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db[_0x69b5('0x41')][_0x69b5('0x43')](_0x69b5('0x4a')))),'abandonedContacts'],[db[_0x69b5('0x41')]['fn'](_0x69b5('0x42'),db[_0x69b5('0x41')]['fn']('IF',db[_0x69b5('0x41')][_0x69b5('0x43')](_0x69b5('0x4c')))),_0x69b5('0x4d')]]})[_0x69b5('0x1b')](handleEntityNotFound(_0x1c9b15,null))[_0x69b5('0x1b')](respondWithResult(_0x1c9b15,null))[_0x69b5('0x3a')](handleError(_0x1c9b15,null));};exports[_0x69b5('0x53')]=function(_0x259d1a,_0x5cc6a1,_0x556cd7){return db['VoiceQueue'][_0x69b5('0x3d')]({'where':{'id':_0x259d1a[_0x69b5('0x3c')]['id']}})[_0x69b5('0x1b')](handleEntityNotFound(_0x5cc6a1,null))[_0x69b5('0x1b')](function(_0x571c59){var _0x3e6675;if(_0x571c59){_0x3e6675=squel[_0x69b5('0x54')]()[_0x69b5('0x55')](_0x69b5('0x56'))[_0x69b5('0x57')]([_0x69b5('0x58'),_0x69b5('0x59'),_0x69b5('0x5a'),_0x69b5('0x5b'),'VoiceQueueId',_0x69b5('0x5c'),'updatedAt'],squel['select']()['field']('ANY_VALUE(calleridnum)',_0x69b5('0x58'))['field'](_0x69b5('0x5d'),_0x69b5('0x59'))[_0x69b5('0x5e')](_0x69b5('0x5f'),_0x69b5('0x5a'))['field'](_0x69b5('0x60'),_0x69b5('0x5b'))[_0x69b5('0x5e')](_0x69b5('0x61'),_0x69b5('0x62'))[_0x69b5('0x5e')](_0x69b5('0x5d'),_0x69b5('0x5c'))[_0x69b5('0x5e')]('NOW()',_0x69b5('0x63'))[_0x69b5('0x64')](_0x69b5('0x65'))[_0x69b5('0x30')](_0x69b5('0x66'),_0x259d1a['params']['id'][_0x69b5('0x67')]())[_0x69b5('0x30')](_0x69b5('0x68'),_0x259d1a[_0x69b5('0x3f')][_0x69b5('0x69')]['toString']())[_0x69b5('0x30')](_0x69b5('0x6a'))[_0x69b5('0x30')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x69b5('0x5e')]('phone')[_0x69b5('0x64')](_0x69b5('0x56'))['where'](_0x69b5('0x66'),_0x259d1a[_0x69b5('0x3c')]['id']['toString']()))[_0x69b5('0x30')](_0x69b5('0x6b'),squel['select']()[_0x69b5('0x5e')](_0x69b5('0x6c'))[_0x69b5('0x64')](_0x69b5('0x65'))[_0x69b5('0x30')](_0x69b5('0x66'),_0x259d1a['params']['id'][_0x69b5('0x67')]())[_0x69b5('0x30')](_0x69b5('0x6d')))[_0x69b5('0x6e')]('ContactId'))['toString']();return db[_0x69b5('0x41')]['query'](_0x3e6675);}return[];})[_0x69b5('0x1b')](respondWithResult(_0x5cc6a1,null))[_0x69b5('0x3a')](handleError(_0x5cc6a1,null));};exports[_0x69b5('0x6f')]=function(_0x4d9712,_0x1cc7ea,_0x420c7b){return db[_0x69b5('0x70')][_0x69b5('0x3d')]({'where':{'id':_0x4d9712[_0x69b5('0x3c')]['id']}})[_0x69b5('0x1b')](handleEntityNotFound(_0x1cc7ea,null))[_0x69b5('0x1b')](function(_0x22ee2b){var _0x58704b;if(_0x22ee2b){_0x58704b=squel[_0x69b5('0x54')]()[_0x69b5('0x55')](_0x69b5('0x56'))[_0x69b5('0x57')](['phone','scheduledAt','ContactId',_0x69b5('0x5b'),_0x69b5('0x71'),_0x69b5('0x5c'),_0x69b5('0x63')],squel[_0x69b5('0x72')]()[_0x69b5('0x5e')](_0x69b5('0x73'),_0x69b5('0x58'))['field'](_0x69b5('0x5d'),_0x69b5('0x59'))['field'](_0x69b5('0x5f'),'ContactId')[_0x69b5('0x5e')](_0x69b5('0x60'),_0x69b5('0x5b'))['field'](_0x69b5('0x74'),_0x69b5('0x71'))['field'](_0x69b5('0x5d'),_0x69b5('0x5c'))[_0x69b5('0x5e')](_0x69b5('0x5d'),_0x69b5('0x63'))[_0x69b5('0x64')](_0x69b5('0x65'))[_0x69b5('0x30')]('CampaignId\x20=\x20?',_0x4d9712['params']['id'][_0x69b5('0x67')]())[_0x69b5('0x30')](_0x69b5('0x68'),_0x4d9712[_0x69b5('0x3f')][_0x69b5('0x69')][_0x69b5('0x67')]())['where'](_0x69b5('0x6a'))[_0x69b5('0x30')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x69b5('0x72')]()[_0x69b5('0x5e')](_0x69b5('0x58'))[_0x69b5('0x64')](_0x69b5('0x56'))['where']('CampaignId\x20=\x20?',_0x4d9712['params']['id'][_0x69b5('0x67')]()))[_0x69b5('0x30')](_0x69b5('0x6b'),squel['select']()[_0x69b5('0x5e')]('calleridnum')[_0x69b5('0x64')](_0x69b5('0x65'))[_0x69b5('0x30')](_0x69b5('0x75'),_0x4d9712['params']['id'][_0x69b5('0x67')]())['where']('state\x20=\x204'))[_0x69b5('0x6e')](_0x69b5('0x5a')))[_0x69b5('0x67')]();return db[_0x69b5('0x41')]['query'](_0x58704b);}return[];})[_0x69b5('0x1b')](respondWithResult(_0x1cc7ea,null))['catch'](handleError(_0x1cc7ea,null));};exports[_0x69b5('0x76')]=function(_0x13aa21,_0x44e403,_0x30fb47){return db['CmHopper'][_0x69b5('0x77')]({'where':{'VoiceQueueId':_0x13aa21['body'][_0x69b5('0x62')],'CampaignId':_0x13aa21[_0x69b5('0x3f')][_0x69b5('0x71')],'ContactId':_0x13aa21[_0x69b5('0x3f')][_0x69b5('0x5a')]}})['then'](handleEntityNotFound(_0x44e403,null))[_0x69b5('0x1b')](function(_0x56d6bf){if(_0x56d6bf){return _0x56d6bf;}return null;})[_0x69b5('0x1b')](respondWithResult(_0x44e403,null))['catch'](handleError(_0x44e403,null));}; \ No newline at end of file +var _0xc0bb=['createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','state\x20=\x204','group','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','reject','save','update','then','destroy','end','stack','name','index','CmHopperFinal','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','sort','where','add','day','merge','map','options','include','findAll','rows','catch','show','rawAttributes','includeAll','describe','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','busyContacts','dropContacts','reCallContacts','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ContactId'];(function(_0x24eddb,_0x5b138f){var _0x3f331a=function(_0x5b6b8f){while(--_0x5b6b8f){_0x24eddb['push'](_0x24eddb['shift']());}};_0x3f331a(++_0x5b138f);}(_0xc0bb,0x102));var _0xbc0b=function(_0x544c03,_0x558fe4){_0x544c03=_0x544c03-0x0;var _0x5e86ad=_0xc0bb[_0x544c03];return _0x5e86ad;};'use strict';var jsonpatch=require(_0xbc0b('0x0'));var rp=require(_0xbc0b('0x1'));var moment=require(_0xbc0b('0x2'));var BPromise=require(_0xbc0b('0x3'));var Mustache=require(_0xbc0b('0x4'));var util=require(_0xbc0b('0x5'));var path=require(_0xbc0b('0x6'));var sox=require(_0xbc0b('0x7'));var csv=require(_0xbc0b('0x8'));var ejs=require(_0xbc0b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbc0b('0xa'));var crypto=require(_0xbc0b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbc0b('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xbc0b('0xd'))('api');var utils=require(_0xbc0b('0xe'));var config=require(_0xbc0b('0xf'));var db=require(_0xbc0b('0x10'))['db'];function respondWithStatusCode(_0x514639,_0x588421){_0x588421=_0x588421||0xcc;return function(_0x174c69){if(_0x174c69){return _0x514639[_0xbc0b('0x11')](_0x588421);}return _0x514639[_0xbc0b('0x12')](_0x588421)['end']();};}function respondWithResult(_0x47e1bf,_0x243da9){_0x243da9=_0x243da9||0xc8;return function(_0xbea832){if(_0xbea832){return _0x47e1bf['status'](_0x243da9)[_0xbc0b('0x13')](_0xbea832);}};}function respondWithFilteredResult(_0x130f33,_0x3ed63f){return function(_0x4e6658){if(_0x4e6658){var _0x18d5e8=_0x4e6658[_0xbc0b('0x14')],_0x3a0775=_0x3ed63f['offset'],_0xf2ed66=_0x3ed63f[_0xbc0b('0x15')]+_0x3ed63f[_0xbc0b('0x16')],_0x1f23e8;if(_0xf2ed66>=_0x18d5e8){_0xf2ed66=_0x18d5e8;_0x1f23e8=0xc8;}else{_0x1f23e8=0xce;}_0x130f33[_0xbc0b('0x12')](_0x1f23e8);return _0x130f33['set']('Content-Range',_0x3a0775+'-'+_0xf2ed66+'/'+_0x18d5e8)[_0xbc0b('0x13')](_0x4e6658);}return null;};}function patchUpdates(_0x17f233){return function(_0x4e740b){try{jsonpatch['apply'](_0x4e740b,_0x17f233,!![]);}catch(_0x1cb4df){return BPromise[_0xbc0b('0x17')](_0x1cb4df);}return _0x4e740b[_0xbc0b('0x18')]();};}function saveUpdates(_0x3bfb4b,_0x265355){return function(_0x5117e4){if(_0x5117e4){return _0x5117e4[_0xbc0b('0x19')](_0x3bfb4b)[_0xbc0b('0x1a')](function(_0x1a79ef){return _0x1a79ef;});}return null;};}function removeEntity(_0x34ec2d,_0xb76b85){return function(_0x4a1de4){if(_0x4a1de4){return _0x4a1de4[_0xbc0b('0x1b')]()[_0xbc0b('0x1a')](function(){_0x34ec2d[_0xbc0b('0x12')](0xcc)[_0xbc0b('0x1c')]();});}};}function handleEntityNotFound(_0x487a92,_0x514266){return function(_0x469a25){if(!_0x469a25){_0x487a92[_0xbc0b('0x11')](0x194);}return _0x469a25;};}function handleError(_0x314e0e,_0x29d730){_0x29d730=_0x29d730||0x1f4;return function(_0x58188d){logger['error'](_0x58188d[_0xbc0b('0x1d')]);if(_0x58188d[_0xbc0b('0x1e')]){delete _0x58188d[_0xbc0b('0x1e')];}_0x314e0e[_0xbc0b('0x12')](_0x29d730)['send'](_0x58188d);};}exports[_0xbc0b('0x1f')]=function(_0x14fd73,_0x52becd){var _0x272314={},_0x3a4da6={},_0x5f4ed7={'count':0x0,'rows':[]};var _0x50f9e4=db[_0xbc0b('0x20')]['rawAttributes'];_0x3a4da6[_0xbc0b('0x21')]=_[_0xbc0b('0x22')](_0x50f9e4);var _0x4cf67b={'dateStart':_0x14fd73[_0xbc0b('0x23')][_0xbc0b('0x24')],'dateEnd':_0x14fd73['query'][_0xbc0b('0x25')]};delete _0x14fd73['query'][_0xbc0b('0x24')];delete _0x14fd73[_0xbc0b('0x23')][_0xbc0b('0x25')];_0x3a4da6[_0xbc0b('0x23')]=_[_0xbc0b('0x22')](_0x14fd73[_0xbc0b('0x23')]);_0x3a4da6[_0xbc0b('0x26')]=_[_0xbc0b('0x27')](_0x3a4da6['model'],_0x3a4da6[_0xbc0b('0x23')]);_0x272314[_0xbc0b('0x28')]=_[_0xbc0b('0x27')](_0x3a4da6[_0xbc0b('0x21')],qs[_0xbc0b('0x29')](_0x14fd73[_0xbc0b('0x23')][_0xbc0b('0x29')]));_0x272314[_0xbc0b('0x28')]=_0x272314[_0xbc0b('0x28')][_0xbc0b('0x2a')]?_0x272314[_0xbc0b('0x28')]:_0x3a4da6['model'];if(!_0x14fd73['query']['hasOwnProperty'](_0xbc0b('0x2b'))){_0x272314[_0xbc0b('0x16')]=qs[_0xbc0b('0x16')](_0x14fd73[_0xbc0b('0x23')][_0xbc0b('0x16')]);_0x272314[_0xbc0b('0x15')]=qs[_0xbc0b('0x15')](_0x14fd73['query'][_0xbc0b('0x15')]);}_0x272314['order']=qs[_0xbc0b('0x2c')](_0x14fd73['query']['sort']);_0x272314[_0xbc0b('0x2d')]=qs[_0xbc0b('0x26')](_['pick'](_0x14fd73[_0xbc0b('0x23')],_0x3a4da6[_0xbc0b('0x26')]));if(_0x4cf67b[_0xbc0b('0x24')]){if(_0x4cf67b[_0xbc0b('0x25')]){_0x4cf67b[_0xbc0b('0x25')]=moment(_0x4cf67b[_0xbc0b('0x25')])[_0xbc0b('0x2e')](0x1,_0xbc0b('0x2f'));}else{_0x4cf67b[_0xbc0b('0x25')]=moment(_0x4cf67b[_0xbc0b('0x24')])[_0xbc0b('0x2e')](0x1,_0xbc0b('0x2f'));}_[_0xbc0b('0x30')](_0x272314[_0xbc0b('0x2d')],{'createdAt':{'$gte':_0x4cf67b['dateStart'],'$lte':_0x4cf67b[_0xbc0b('0x25')]}});}if(_0x14fd73['query']['filter']){_0x272314[_0xbc0b('0x2d')]=_['merge'](_0x272314['where'],{'$or':_[_0xbc0b('0x31')](_0x272314['attributes'],function(_0x270320){var _0x379704={};_0x379704[_0x270320]={'$like':'%'+_0x14fd73['query']['filter']+'%'};return _0x379704;})});}_0x272314=_[_0xbc0b('0x30')]({},_0x272314,_0x14fd73[_0xbc0b('0x32')]);var _0x283aad={'where':_0x272314['where']};return db[_0xbc0b('0x20')][_0xbc0b('0x14')](_0x283aad)[_0xbc0b('0x1a')](function(_0x295ba4){_0x5f4ed7[_0xbc0b('0x14')]=_0x295ba4;if(_0x14fd73[_0xbc0b('0x23')]['includeAll']){_0x272314[_0xbc0b('0x33')]=[{'all':!![]}];}return db[_0xbc0b('0x20')][_0xbc0b('0x34')](_0x272314);})[_0xbc0b('0x1a')](function(_0x103182){_0x5f4ed7[_0xbc0b('0x35')]=_0x103182;return _0x5f4ed7;})[_0xbc0b('0x1a')](respondWithFilteredResult(_0x52becd,_0x272314))[_0xbc0b('0x36')](handleError(_0x52becd,null));};exports[_0xbc0b('0x37')]=function(_0x30d88d,_0x488fa2){var _0x45be00={'raw':!![],'where':{'id':_0x30d88d['params']['id']}},_0x4ffcb0={};_0x4ffcb0[_0xbc0b('0x21')]=_[_0xbc0b('0x22')](db[_0xbc0b('0x20')][_0xbc0b('0x38')]);_0x4ffcb0[_0xbc0b('0x23')]=_[_0xbc0b('0x22')](_0x30d88d[_0xbc0b('0x23')]);_0x4ffcb0['filters']=_[_0xbc0b('0x27')](_0x4ffcb0['model'],_0x4ffcb0[_0xbc0b('0x23')]);_0x45be00[_0xbc0b('0x28')]=_[_0xbc0b('0x27')](_0x4ffcb0['model'],qs[_0xbc0b('0x29')](_0x30d88d[_0xbc0b('0x23')]['fields']));_0x45be00[_0xbc0b('0x28')]=_0x45be00[_0xbc0b('0x28')][_0xbc0b('0x2a')]?_0x45be00[_0xbc0b('0x28')]:_0x4ffcb0[_0xbc0b('0x21')];if(_0x30d88d[_0xbc0b('0x23')][_0xbc0b('0x39')]){_0x45be00[_0xbc0b('0x33')]=[{'all':!![]}];}_0x45be00=_[_0xbc0b('0x30')]({},_0x45be00,_0x30d88d[_0xbc0b('0x32')]);return db[_0xbc0b('0x20')]['find'](_0x45be00)['then'](handleEntityNotFound(_0x488fa2,null))['then'](respondWithResult(_0x488fa2,null))[_0xbc0b('0x36')](handleError(_0x488fa2,null));};exports[_0xbc0b('0x3a')]=function(_0x90be52,_0x1a6d4b){return db[_0xbc0b('0x20')][_0xbc0b('0x3a')]()['then'](respondWithResult(_0x1a6d4b,null))[_0xbc0b('0x36')](handleError(_0x1a6d4b,null));};exports[_0xbc0b('0x19')]=function(_0x4197bb,_0x25005b){if(_0x4197bb[_0xbc0b('0x3b')][_0xbc0b('0x3c')]){delete _0x4197bb['body'][_0xbc0b('0x3c')];}return db['CmHopperFinal'][_0xbc0b('0x3d')]({'where':{'uniqueid':_0x4197bb[_0xbc0b('0x3e')]['id']}})[_0xbc0b('0x1a')](handleEntityNotFound(_0x25005b,null))['then'](saveUpdates(_0x4197bb[_0xbc0b('0x3b')],null))['then'](respondWithResult(_0x25005b,null))[_0xbc0b('0x36')](handleError(_0x25005b,null));};exports[_0xbc0b('0x3f')]=function(_0xede8fb,_0x117279,_0x14de4a){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0xede8fb[_0xbc0b('0x3e')]['id']},'attributes':[[db[_0xbc0b('0x40')]['fn'](_0xbc0b('0x41'),db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xbc0b('0x40')]['fn']('COUNT',db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x43')))),'noAnswerContacts'],[db[_0xbc0b('0x40')]['fn'](_0xbc0b('0x41'),db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x44')))),'busyContacts'],[db[_0xbc0b('0x40')]['fn']('COUNT',db[_0xbc0b('0x40')]['fn']('IF',db['sequelize'][_0xbc0b('0x42')](_0xbc0b('0x45')))),_0xbc0b('0x46')],[db[_0xbc0b('0x40')]['fn'](_0xbc0b('0x41'),db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x47')))),'dropContacts'],[db[_0xbc0b('0x40')]['fn']('COUNT',db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x48')))),_0xbc0b('0x49')],[db['sequelize']['fn'](_0xbc0b('0x41'),db['sequelize']['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x4a')))),'reCallContacts']]})[_0xbc0b('0x1a')](handleEntityNotFound(_0x117279,null))[_0xbc0b('0x1a')](respondWithResult(_0x117279,null))['catch'](handleError(_0x117279,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x98b575,_0x9cfa04,_0x2fef19){return db[_0xbc0b('0x20')][_0xbc0b('0x34')]({'raw':![],'where':{'CampaignId':_0x98b575['params']['id']},'attributes':[[db[_0xbc0b('0x40')]['fn'](_0xbc0b('0x41'),db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x4b')))),_0xbc0b('0x4c')],[db[_0xbc0b('0x40')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x43')))),_0xbc0b('0x4d')],[db[_0xbc0b('0x40')]['fn'](_0xbc0b('0x41'),db['sequelize']['fn']('IF',db[_0xbc0b('0x40')]['literal'](_0xbc0b('0x44')))),_0xbc0b('0x4e')],[db[_0xbc0b('0x40')]['fn'](_0xbc0b('0x41'),db['sequelize']['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x45')))),_0xbc0b('0x46')],[db[_0xbc0b('0x40')]['fn'](_0xbc0b('0x41'),db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xbc0b('0x4f')],[db[_0xbc0b('0x40')]['fn'](_0xbc0b('0x41'),db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')][_0xbc0b('0x42')](_0xbc0b('0x48')))),_0xbc0b('0x49')],[db[_0xbc0b('0x40')]['fn']('COUNT',db[_0xbc0b('0x40')]['fn']('IF',db[_0xbc0b('0x40')]['literal'](_0xbc0b('0x4a')))),_0xbc0b('0x50')]]})['then'](handleEntityNotFound(_0x9cfa04,null))[_0xbc0b('0x1a')](respondWithResult(_0x9cfa04,null))['catch'](handleError(_0x9cfa04,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x255e3a,_0x5acb38,_0x2f83e8){return db[_0xbc0b('0x51')][_0xbc0b('0x3d')]({'where':{'id':_0x255e3a[_0xbc0b('0x3e')]['id']}})[_0xbc0b('0x1a')](handleEntityNotFound(_0x5acb38,null))['then'](function(_0x1d9cc4){var _0x30f825;if(_0x1d9cc4){_0x30f825=squel[_0xbc0b('0x52')]()['into'](_0xbc0b('0x53'))[_0xbc0b('0x54')](['phone',_0xbc0b('0x55'),_0xbc0b('0x56'),'ListId','VoiceQueueId',_0xbc0b('0x57'),_0xbc0b('0x58')],squel[_0xbc0b('0x59')]()['field'](_0xbc0b('0x5a'),'phone')[_0xbc0b('0x5b')](_0xbc0b('0x5c'),_0xbc0b('0x55'))[_0xbc0b('0x5b')](_0xbc0b('0x5d'),_0xbc0b('0x56'))[_0xbc0b('0x5b')](_0xbc0b('0x5e'),'ListId')[_0xbc0b('0x5b')](_0xbc0b('0x5f'),'VoiceQueueId')[_0xbc0b('0x5b')](_0xbc0b('0x5c'),_0xbc0b('0x57'))[_0xbc0b('0x5b')](_0xbc0b('0x5c'),_0xbc0b('0x58'))[_0xbc0b('0x60')](_0xbc0b('0x61'))['where'](_0xbc0b('0x62'),_0x255e3a[_0xbc0b('0x3e')]['id'][_0xbc0b('0x63')]())[_0xbc0b('0x2d')](_0xbc0b('0x64'),_0x255e3a[_0xbc0b('0x3b')][_0xbc0b('0x65')][_0xbc0b('0x63')]())['where'](_0xbc0b('0x66'))[_0xbc0b('0x2d')](_0xbc0b('0x67'),squel['select']()['field'](_0xbc0b('0x68'))[_0xbc0b('0x60')](_0xbc0b('0x53'))['where'](_0xbc0b('0x62'),_0x255e3a[_0xbc0b('0x3e')]['id'][_0xbc0b('0x63')]()))[_0xbc0b('0x2d')](_0xbc0b('0x67'),squel[_0xbc0b('0x59')]()[_0xbc0b('0x5b')]('calleridnum')[_0xbc0b('0x60')]('cm_hopper_final')['where'](_0xbc0b('0x62'),_0x255e3a[_0xbc0b('0x3e')]['id'][_0xbc0b('0x63')]())[_0xbc0b('0x2d')](_0xbc0b('0x69')))[_0xbc0b('0x6a')](_0xbc0b('0x56')))[_0xbc0b('0x63')]();return db[_0xbc0b('0x40')]['query'](_0x30f825);}return[];})[_0xbc0b('0x1a')](respondWithResult(_0x5acb38,null))[_0xbc0b('0x36')](handleError(_0x5acb38,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5c6d40,_0x544e61,_0x56939a){return db['Campaign'][_0xbc0b('0x3d')]({'where':{'id':_0x5c6d40['params']['id']}})[_0xbc0b('0x1a')](handleEntityNotFound(_0x544e61,null))['then'](function(_0x3eca91){var _0x27c93e;if(_0x3eca91){_0x27c93e=squel[_0xbc0b('0x52')]()['into'](_0xbc0b('0x53'))[_0xbc0b('0x54')]([_0xbc0b('0x68'),_0xbc0b('0x55'),'ContactId',_0xbc0b('0x6b'),'CampaignId',_0xbc0b('0x57'),'updatedAt'],squel[_0xbc0b('0x59')]()[_0xbc0b('0x5b')]('ANY_VALUE(calleridnum)',_0xbc0b('0x68'))[_0xbc0b('0x5b')]('NOW()',_0xbc0b('0x55'))[_0xbc0b('0x5b')]('ANY_VALUE(ContactId)','ContactId')[_0xbc0b('0x5b')](_0xbc0b('0x5e'),_0xbc0b('0x6b'))['field'](_0xbc0b('0x6c'),_0xbc0b('0x6d'))['field']('NOW()',_0xbc0b('0x57'))[_0xbc0b('0x5b')]('NOW()',_0xbc0b('0x58'))[_0xbc0b('0x60')]('cm_hopper_final')[_0xbc0b('0x2d')](_0xbc0b('0x6e'),_0x5c6d40[_0xbc0b('0x3e')]['id'][_0xbc0b('0x63')]())[_0xbc0b('0x2d')](_0xbc0b('0x64'),_0x5c6d40[_0xbc0b('0x3b')][_0xbc0b('0x65')][_0xbc0b('0x63')]())[_0xbc0b('0x2d')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xbc0b('0x2d')](_0xbc0b('0x67'),squel[_0xbc0b('0x59')]()[_0xbc0b('0x5b')](_0xbc0b('0x68'))['from'](_0xbc0b('0x53'))['where'](_0xbc0b('0x6e'),_0x5c6d40['params']['id'][_0xbc0b('0x63')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xbc0b('0x5b')](_0xbc0b('0x6f'))['from']('cm_hopper_final')[_0xbc0b('0x2d')](_0xbc0b('0x6e'),_0x5c6d40[_0xbc0b('0x3e')]['id']['toString']())[_0xbc0b('0x2d')](_0xbc0b('0x69')))[_0xbc0b('0x6a')](_0xbc0b('0x56')))[_0xbc0b('0x63')]();return db[_0xbc0b('0x40')][_0xbc0b('0x23')](_0x27c93e);}return[];})[_0xbc0b('0x1a')](respondWithResult(_0x544e61,null))[_0xbc0b('0x36')](handleError(_0x544e61,null));};exports[_0xbc0b('0x70')]=function(_0x11c369,_0x494abb,_0xf70c30){return db[_0xbc0b('0x71')][_0xbc0b('0x72')]({'where':{'VoiceQueueId':_0x11c369[_0xbc0b('0x3b')]['VoiceQueueId'],'CampaignId':_0x11c369[_0xbc0b('0x3b')][_0xbc0b('0x6d')],'ContactId':_0x11c369[_0xbc0b('0x3b')][_0xbc0b('0x56')]}})[_0xbc0b('0x1a')](handleEntityNotFound(_0x494abb,null))[_0xbc0b('0x1a')](function(_0x5853ce){if(_0x5853ce){return _0x5853ce;}return null;})[_0xbc0b('0x1a')](respondWithResult(_0x494abb,null))[_0xbc0b('0x36')](handleError(_0x494abb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 03d2829..8b34c73 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 _0x0295=['calleridnum','lodash','api','request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0295,0x1f0));var _0x5029=function(_0x4dec3b,_0x1acb3d){_0x4dec3b=_0x4dec3b-0x0;var _0x76fe18=_0x0295[_0x4dec3b];return _0x76fe18;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var attributes=require(_0x5029('0x3'));module[_0x5029('0x4')]=function(_0x3d0af1,_0x170504){return _0x3d0af1[_0x5029('0x5')](_0x5029('0x6'),attributes,{'tableName':_0x5029('0x7'),'paranoid':![],'indexes':[{'name':_0x5029('0x8'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['../../config/logger','api','moment','bluebird','request-promise','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0xe5d369,_0x567ad5){var _0x448d48=function(_0x560036){while(--_0x560036){_0xe5d369['push'](_0xe5d369['shift']());}};_0x448d48(++_0x567ad5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ee754,_0x503c21){_0x4ee754=_0x4ee754-0x0;var _0x61d356=_0x5f2f[_0x4ee754];return _0x61d356;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var attributes=require(_0xf5f2('0x7'));module['exports']=function(_0x4854b6,_0x1665c7){return _0x4854b6[_0xf5f2('0x8')](_0xf5f2('0x9'),attributes,{'tableName':_0xf5f2('0xa'),'paranoid':![],'indexes':[{'name':_0xf5f2('0xb'),'fields':[_0xf5f2('0xb')]},{'name':'uniqueid','fields':[_0xf5f2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 54b8be0..92b034a 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 _0x2901=['create','body','options','info','CreateCmHopperFinal','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperFinal'];(function(_0x334763,_0x575eff){var _0x566db0=function(_0x217cc2){while(--_0x217cc2){_0x334763['push'](_0x334763['shift']());}};_0x566db0(++_0x575eff);}(_0x2901,0x132));var _0x1290=function(_0x4e0ef3,_0x2d93e5){_0x4e0ef3=_0x4e0ef3-0x0;var _0x93873e=_0x2901[_0x4e0ef3];return _0x93873e;};'use strict';var _=require(_0x1290('0x0'));var util=require(_0x1290('0x1'));var moment=require('moment');var BPromise=require(_0x1290('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x1290('0x3'))['db'];var utils=require(_0x1290('0x4'));var logger=require(_0x1290('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1290('0x6'));var client=jayson['client'][_0x1290('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a1222,_0x3d4ee4,_0x3dbf40){return new BPromise(function(_0x2de520,_0x2dfd2d){return client['request'](_0x2a1222,_0x3dbf40)[_0x1290('0x8')](function(_0x540fe4){logger['info'](_0x1290('0x9'),_0x3d4ee4,_0x1290('0xa'));logger[_0x1290('0xb')](_0x1290('0xc'),_0x3d4ee4,'request\x20sent',JSON[_0x1290('0xd')](_0x540fe4));if(_0x540fe4[_0x1290('0xe')]){if(_0x540fe4[_0x1290('0xe')][_0x1290('0xf')]===0x1f4){logger['error'](_0x1290('0x9'),_0x3d4ee4,_0x540fe4[_0x1290('0xe')][_0x1290('0x10')]);return _0x2dfd2d(_0x540fe4['error'][_0x1290('0x10')]);}logger[_0x1290('0xe')](_0x1290('0x9'),_0x3d4ee4,_0x540fe4[_0x1290('0xe')][_0x1290('0x10')]);return _0x2de520(_0x540fe4[_0x1290('0xe')]['message']);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x3d4ee4,_0x1290('0xa'));_0x2de520(_0x540fe4[_0x1290('0x11')][_0x1290('0x10')]);}})['catch'](function(_0x5c36f8){logger[_0x1290('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x3d4ee4,_0x5c36f8);_0x2dfd2d(_0x5c36f8);});});}exports['CreateCmHopperFinal']=function(_0xdda9a6){var _0x3ef71e=this;return new Promise(function(_0x4a07c0,_0x47fbe5){return db[_0x1290('0x12')][_0x1290('0x13')](_0xdda9a6[_0x1290('0x14')],{'raw':_0xdda9a6['options']?_0xdda9a6[_0x1290('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x1290('0x8')](function(_0x41f051){logger[_0x1290('0x16')](_0x1290('0x17'),_0xdda9a6);logger[_0x1290('0xb')](_0x1290('0x17'),_0xdda9a6,JSON[_0x1290('0xd')](_0x41f051));_0x4a07c0(_0x41f051);})[_0x1290('0x18')](function(_0x5d6d90){logger[_0x1290('0xe')](_0x1290('0x17'),_0x5d6d90[_0x1290('0x10')],_0xdda9a6);_0x47fbe5(_0x3ef71e['error'](0x1f4,_0x5d6d90[_0x1290('0x10')]));});});}; \ No newline at end of file +var _0x01c2=['debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperFinal,\x20%s,\x20%s','message','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x01c2,0x16d));var _0x201c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01c2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x201c('0x0'));var moment=require(_0x201c('0x1'));var BPromise=require(_0x201c('0x2'));var rs=require(_0x201c('0x3'));var fs=require('fs');var db=require(_0x201c('0x4'))['db'];var utils=require(_0x201c('0x5'));var logger=require(_0x201c('0x6'))(_0x201c('0x7'));var config=require(_0x201c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x201c('0x9')][_0x201c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53b08b,_0xb8eb53,_0x587c4d){return new BPromise(function(_0x57bcde,_0x3fbe14){return client[_0x201c('0xb')](_0x53b08b,_0x587c4d)[_0x201c('0xc')](function(_0x295a28){logger[_0x201c('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0xb8eb53,'request\x20sent');logger['debug'](_0x201c('0xe'),_0xb8eb53,_0x201c('0xf'),JSON[_0x201c('0x10')](_0x295a28));if(_0x295a28[_0x201c('0x11')]){if(_0x295a28[_0x201c('0x11')]['code']===0x1f4){logger[_0x201c('0x11')](_0x201c('0x12'),_0xb8eb53,_0x295a28[_0x201c('0x11')][_0x201c('0x13')]);return _0x3fbe14(_0x295a28[_0x201c('0x11')][_0x201c('0x13')]);}logger[_0x201c('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0xb8eb53,_0x295a28['error'][_0x201c('0x13')]);return _0x57bcde(_0x295a28['error']['message']);}else{logger[_0x201c('0xd')](_0x201c('0x12'),_0xb8eb53,_0x201c('0xf'));_0x57bcde(_0x295a28['result'][_0x201c('0x13')]);}})[_0x201c('0x14')](function(_0x2cc438){logger[_0x201c('0x11')](_0x201c('0x12'),_0xb8eb53,_0x2cc438);_0x3fbe14(_0x2cc438);});});}exports[_0x201c('0x15')]=function(_0x274a08){var _0x578e2a=this;return new Promise(function(_0x41b7e2,_0x2cd052){return db[_0x201c('0x16')][_0x201c('0x17')](_0x274a08[_0x201c('0x18')],{'raw':_0x274a08['options']?_0x274a08[_0x201c('0x19')][_0x201c('0x1a')]===undefined?!![]:![]:!![]})[_0x201c('0xc')](function(_0x4c8120){logger[_0x201c('0xd')](_0x201c('0x15'),_0x274a08);logger[_0x201c('0x1b')]('CreateCmHopperFinal',_0x274a08,JSON[_0x201c('0x10')](_0x4c8120));_0x41b7e2(_0x4c8120);})['catch'](function(_0x3efb63){logger[_0x201c('0x11')](_0x201c('0x15'),_0x3efb63[_0x201c('0x13')],_0x274a08);_0x2cd052(_0x578e2a[_0x201c('0x11')](0x1f4,_0x3efb63[_0x201c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c9f1382..eade1b0 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 _0xf52f=['util','path','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','exports','multer'];(function(_0x43fb19,_0x56398b){var _0x1cf124=function(_0x1a5e4f){while(--_0x1a5e4f){_0x43fb19['push'](_0x43fb19['shift']());}};_0x1cf124(++_0x56398b);}(_0xf52f,0x113));var _0xff52=function(_0x2c80c1,_0xf479b3){_0x2c80c1=_0x2c80c1-0x0;var _0x375cd8=_0xf52f[_0x2c80c1];return _0x375cd8;};'use strict';var multer=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var path=require(_0xff52('0x2'));var express=require('express');var router=express[_0xff52('0x3')]();var auth=require(_0xff52('0x4'));var interaction=require(_0xff52('0x5'));var config=require('../../config/environment');var controller=require(_0xff52('0x6'));router[_0xff52('0x7')]('/',auth['isAuthenticated'](),controller[_0xff52('0x8')]);router[_0xff52('0x7')](_0xff52('0x9'),auth[_0xff52('0xa')](),controller[_0xff52('0xb')]);router[_0xff52('0x7')](_0xff52('0xc'),auth[_0xff52('0xa')](),controller[_0xff52('0xd')]);router[_0xff52('0x7')](_0xff52('0xe'),auth[_0xff52('0xa')](),controller[_0xff52('0xf')]);router[_0xff52('0x7')](_0xff52('0x10'),auth[_0xff52('0xa')](),controller[_0xff52('0x11')]);router[_0xff52('0x12')](_0xff52('0x13'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xff52('0x12')]('/voice/campaign/moveContacts/:id',auth[_0xff52('0xa')](),controller[_0xff52('0x14')]);router[_0xff52('0x12')](_0xff52('0x15'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0xff52('0xc'),auth['isAuthenticated'](),controller['update']);module[_0xff52('0x16')]=router; \ No newline at end of file +var _0xbe22=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','multer'];(function(_0x480eeb,_0x1bf9da){var _0x1bdade=function(_0x53d437){while(--_0x53d437){_0x480eeb['push'](_0x480eeb['shift']());}};_0x1bdade(++_0x1bf9da);}(_0xbe22,0x1c1));var _0x2be2=function(_0x40ac4a,_0x5abd5c){_0x40ac4a=_0x40ac4a-0x0;var _0x552413=_0xbe22[_0x40ac4a];return _0x552413;};'use strict';var multer=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var path=require('path');var express=require('express');var router=express[_0x2be2('0x2')]();var auth=require(_0x2be2('0x3'));var interaction=require(_0x2be2('0x4'));var config=require(_0x2be2('0x5'));var controller=require(_0x2be2('0x6'));router[_0x2be2('0x7')]('/',auth[_0x2be2('0x8')](),controller[_0x2be2('0x9')]);router[_0x2be2('0x7')](_0x2be2('0xa'),auth['isAuthenticated'](),controller[_0x2be2('0xb')]);router[_0x2be2('0x7')](_0x2be2('0xc'),auth['isAuthenticated'](),controller[_0x2be2('0xd')]);router[_0x2be2('0x7')](_0x2be2('0xe'),auth[_0x2be2('0x8')](),controller[_0x2be2('0xf')]);router[_0x2be2('0x7')](_0x2be2('0x10'),auth[_0x2be2('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x2be2('0x11')](_0x2be2('0x12'),auth['isAuthenticated'](),controller[_0x2be2('0x13')]);router[_0x2be2('0x11')](_0x2be2('0x14'),auth['isAuthenticated'](),controller[_0x2be2('0x15')]);router[_0x2be2('0x11')]('/checkContactHopper',auth[_0x2be2('0x8')](),controller[_0x2be2('0x16')]);router[_0x2be2('0x17')]('/:id',auth[_0x2be2('0x8')](),controller[_0x2be2('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 74474b2..a6529f5 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 _0xda19=['DATE','STRING','BOOLEAN','exports','INTEGER'];(function(_0x7ee119,_0x507b4f){var _0x163b72=function(_0x27d753){while(--_0x27d753){_0x7ee119['push'](_0x7ee119['shift']());}};_0x163b72(++_0x507b4f);}(_0xda19,0xd5));var _0x9da1=function(_0x18e24d,_0x1a3d5c){_0x18e24d=_0x18e24d-0x0;var _0x234ed8=_0xda19[_0x18e24d];return _0x234ed8;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'state':{'type':Sequelize[_0x9da1('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9da1('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9da1('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9da1('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9da1('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x9da1('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9da1('0x3')]},'calleridnum':{'type':Sequelize[_0x9da1('0x3')]},'calleridname':{'type':Sequelize[_0x9da1('0x3')]},'starttime':{'type':Sequelize[_0x9da1('0x2')]},'responsetime':{'type':Sequelize[_0x9da1('0x2')]},'answertime':{'type':Sequelize[_0x9da1('0x2')]},'droptime':{'type':Sequelize[_0x9da1('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9da1('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9da1('0x3')]},'campaign':{'type':Sequelize[_0x9da1('0x3')]},'campaigntype':{'type':Sequelize[_0x9da1('0x3')]},'membername':{'type':Sequelize[_0x9da1('0x3')]},'reason':{'type':Sequelize[_0x9da1('0x3')]},'amd':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9da1('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x9da1('0x2')]},'edited':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa7e6=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x542620,_0x665d39){var _0xa37008=function(_0x355beb){while(--_0x355beb){_0x542620['push'](_0x542620['shift']());}};_0xa37008(++_0x665d39);}(_0xa7e6,0x74));var _0x6a7e=function(_0x357ac9,_0x593a80){_0x357ac9=_0x357ac9-0x0;var _0x1dfc96=_0xa7e6[_0x357ac9];return _0x1dfc96;};'use strict';var Sequelize=require(_0x6a7e('0x0'));module[_0x6a7e('0x1')]={'state':{'type':Sequelize[_0x6a7e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6a7e('0x3')]},'scheduledat':{'type':Sequelize[_0x6a7e('0x4')]},'countbusyretry':{'type':Sequelize[_0x6a7e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6a7e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6a7e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6a7e('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6a7e('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6a7e('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6a7e('0x3')]},'starttime':{'type':Sequelize[_0x6a7e('0x4')]},'responsetime':{'type':Sequelize[_0x6a7e('0x4')]},'answertime':{'type':Sequelize[_0x6a7e('0x4')]},'droptime':{'type':Sequelize[_0x6a7e('0x4')]},'endtime':{'type':Sequelize[_0x6a7e('0x4')]},'ringtime':{'type':Sequelize[_0x6a7e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6a7e('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6a7e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6a7e('0x3')]},'reason':{'type':Sequelize[_0x6a7e('0x3')]},'amd':{'type':Sequelize[_0x6a7e('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6a7e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6a7e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6a7e('0x4')]},'recallme':{'type':Sequelize[_0x6a7e('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9f91349..b2035c2 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 _0x9fcd=['rows','show','params','fields','find','create','body','catch','describe','uniqueid','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','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','index','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','length','order','sort','where','pick','day','add','merge','filter','options','CmHopperHistory','includeAll','include','findAll'];(function(_0xf2931a,_0x2d490b){var _0x45c15d=function(_0x1ef510){while(--_0x1ef510){_0xf2931a['push'](_0xf2931a['shift']());}};_0x45c15d(++_0x2d490b);}(_0x9fcd,0x16d));var _0xd9fc=function(_0x49982c,_0x3fcfde){_0x49982c=_0x49982c-0x0;var _0x435680=_0x9fcd[_0x49982c];return _0x435680;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd9fc('0x0'));var BPromise=require(_0xd9fc('0x1'));var Mustache=require(_0xd9fc('0x2'));var util=require(_0xd9fc('0x3'));var path=require(_0xd9fc('0x4'));var sox=require(_0xd9fc('0x5'));var csv=require(_0xd9fc('0x6'));var ejs=require(_0xd9fc('0x7'));var fs=require('fs');var _=require(_0xd9fc('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd9fc('0x9'));var deskjs=require(_0xd9fc('0xa'));var toCsv=require(_0xd9fc('0x6'));var querystring=require(_0xd9fc('0xb'));var Papa=require('papaparse');var qs=require(_0xd9fc('0xc'));var logger=require(_0xd9fc('0xd'))(_0xd9fc('0xe'));var utils=require(_0xd9fc('0xf'));var config=require(_0xd9fc('0x10'));var db=require(_0xd9fc('0x11'))['db'];function respondWithStatusCode(_0x391b07,_0xf7031){_0xf7031=_0xf7031||0xcc;return function(_0x5595e3){if(_0x5595e3){return _0x391b07[_0xd9fc('0x12')](_0xf7031);}return _0x391b07['status'](_0xf7031)[_0xd9fc('0x13')]();};}function respondWithResult(_0x5a4130,_0x1fab63){_0x1fab63=_0x1fab63||0xc8;return function(_0x26d55a){if(_0x26d55a){return _0x5a4130[_0xd9fc('0x14')](_0x1fab63)[_0xd9fc('0x15')](_0x26d55a);}};}function respondWithFilteredResult(_0x4fccb7,_0xdc2696){return function(_0x5b754a){if(_0x5b754a){var _0x2e31d9=_0x5b754a[_0xd9fc('0x16')],_0x449fd3=_0xdc2696[_0xd9fc('0x17')],_0x5a8ce7=_0xdc2696[_0xd9fc('0x17')]+_0xdc2696[_0xd9fc('0x18')],_0x500534;if(_0x5a8ce7>=_0x2e31d9){_0x5a8ce7=_0x2e31d9;_0x500534=0xc8;}else{_0x500534=0xce;}_0x4fccb7[_0xd9fc('0x14')](_0x500534);return _0x4fccb7[_0xd9fc('0x19')](_0xd9fc('0x1a'),_0x449fd3+'-'+_0x5a8ce7+'/'+_0x2e31d9)[_0xd9fc('0x15')](_0x5b754a);}return null;};}function patchUpdates(_0x5f1ef6){return function(_0x16c4a9){try{jsonpatch[_0xd9fc('0x1b')](_0x16c4a9,_0x5f1ef6,!![]);}catch(_0x29cd54){return BPromise[_0xd9fc('0x1c')](_0x29cd54);}return _0x16c4a9[_0xd9fc('0x1d')]();};}function saveUpdates(_0x4cab46,_0x8c55d1){return function(_0x483a82){if(_0x483a82){return _0x483a82[_0xd9fc('0x1e')](_0x4cab46)[_0xd9fc('0x1f')](function(_0x4f85fe){return _0x4f85fe;});}return null;};}function removeEntity(_0x58edde,_0x1eb0b7){return function(_0x1ce3e7){if(_0x1ce3e7){return _0x1ce3e7[_0xd9fc('0x20')]()['then'](function(){_0x58edde[_0xd9fc('0x14')](0xcc)[_0xd9fc('0x13')]();});}};}function handleEntityNotFound(_0x2ebdff,_0x46f2e1){return function(_0x506660){if(!_0x506660){_0x2ebdff[_0xd9fc('0x12')](0x194);}return _0x506660;};}function handleError(_0x47cde0,_0x55136e){_0x55136e=_0x55136e||0x1f4;return function(_0x204a9d){logger[_0xd9fc('0x21')](_0x204a9d[_0xd9fc('0x22')]);if(_0x204a9d[_0xd9fc('0x23')]){delete _0x204a9d[_0xd9fc('0x23')];}_0x47cde0['status'](_0x55136e)[_0xd9fc('0x24')](_0x204a9d);};}exports[_0xd9fc('0x25')]=function(_0x3d0f73,_0x38af23){var _0x5d126f={},_0x91a023={},_0x3226f0={'count':0x0,'rows':[]};var _0x2e903f=db['CmHopperHistory'][_0xd9fc('0x26')];_0x91a023[_0xd9fc('0x27')]=_[_0xd9fc('0x28')](_0x2e903f);var _0x397d53={'dateStart':_0x3d0f73[_0xd9fc('0x29')]['dateStart'],'dateEnd':_0x3d0f73['query'][_0xd9fc('0x2a')]};delete _0x3d0f73[_0xd9fc('0x29')][_0xd9fc('0x2b')];delete _0x3d0f73[_0xd9fc('0x29')]['dateEnd'];_0x91a023[_0xd9fc('0x29')]=_[_0xd9fc('0x28')](_0x3d0f73[_0xd9fc('0x29')]);_0x91a023[_0xd9fc('0x2c')]=_[_0xd9fc('0x2d')](_0x91a023['model'],_0x91a023[_0xd9fc('0x29')]);_0x5d126f[_0xd9fc('0x2e')]=_[_0xd9fc('0x2d')](_0x91a023[_0xd9fc('0x27')],qs['fields'](_0x3d0f73['query']['fields']));_0x5d126f[_0xd9fc('0x2e')]=_0x5d126f[_0xd9fc('0x2e')][_0xd9fc('0x2f')]?_0x5d126f[_0xd9fc('0x2e')]:_0x91a023[_0xd9fc('0x27')];if(!_0x3d0f73['query']['hasOwnProperty']('nolimit')){_0x5d126f['limit']=qs[_0xd9fc('0x18')](_0x3d0f73[_0xd9fc('0x29')][_0xd9fc('0x18')]);_0x5d126f[_0xd9fc('0x17')]=qs[_0xd9fc('0x17')](_0x3d0f73[_0xd9fc('0x29')][_0xd9fc('0x17')]);}_0x5d126f[_0xd9fc('0x30')]=qs[_0xd9fc('0x31')](_0x3d0f73[_0xd9fc('0x29')]['sort']);_0x5d126f[_0xd9fc('0x32')]=qs[_0xd9fc('0x2c')](_[_0xd9fc('0x33')](_0x3d0f73[_0xd9fc('0x29')],_0x91a023[_0xd9fc('0x2c')]));if(_0x397d53[_0xd9fc('0x2b')]){if(_0x397d53[_0xd9fc('0x2a')]){_0x397d53[_0xd9fc('0x2a')]=moment(_0x397d53[_0xd9fc('0x2a')])['add'](0x1,_0xd9fc('0x34'));}else{_0x397d53['dateEnd']=moment(_0x397d53[_0xd9fc('0x2b')])[_0xd9fc('0x35')](0x1,_0xd9fc('0x34'));}_[_0xd9fc('0x36')](_0x5d126f[_0xd9fc('0x32')],{'createdAt':{'$gte':_0x397d53[_0xd9fc('0x2b')],'$lte':_0x397d53[_0xd9fc('0x2a')]}});}if(_0x3d0f73[_0xd9fc('0x29')][_0xd9fc('0x37')]){_0x5d126f[_0xd9fc('0x32')]=_[_0xd9fc('0x36')](_0x5d126f[_0xd9fc('0x32')],{'$or':_['map'](_0x5d126f[_0xd9fc('0x2e')],function(_0x129470){var _0x983dc1={};_0x983dc1[_0x129470]={'$like':'%'+_0x3d0f73[_0xd9fc('0x29')][_0xd9fc('0x37')]+'%'};return _0x983dc1;})});}_0x5d126f=_[_0xd9fc('0x36')]({},_0x5d126f,_0x3d0f73[_0xd9fc('0x38')]);var _0x42ea5b={'where':_0x5d126f[_0xd9fc('0x32')]};return db[_0xd9fc('0x39')][_0xd9fc('0x16')](_0x42ea5b)[_0xd9fc('0x1f')](function(_0x1117ce){_0x3226f0[_0xd9fc('0x16')]=_0x1117ce;if(_0x3d0f73['query'][_0xd9fc('0x3a')]){_0x5d126f[_0xd9fc('0x3b')]=[{'all':!![]}];}return db[_0xd9fc('0x39')][_0xd9fc('0x3c')](_0x5d126f);})[_0xd9fc('0x1f')](function(_0x52ce05){_0x3226f0[_0xd9fc('0x3d')]=_0x52ce05;return _0x3226f0;})[_0xd9fc('0x1f')](respondWithFilteredResult(_0x38af23,_0x5d126f))['catch'](handleError(_0x38af23,null));};exports[_0xd9fc('0x3e')]=function(_0x56c4ff,_0x4c1aed){var _0x7343b1={'raw':!![],'where':{'id':_0x56c4ff[_0xd9fc('0x3f')]['id']}},_0x48cde9={};_0x48cde9[_0xd9fc('0x27')]=_['keys'](db[_0xd9fc('0x39')][_0xd9fc('0x26')]);_0x48cde9[_0xd9fc('0x29')]=_[_0xd9fc('0x28')](_0x56c4ff[_0xd9fc('0x29')]);_0x48cde9[_0xd9fc('0x2c')]=_[_0xd9fc('0x2d')](_0x48cde9[_0xd9fc('0x27')],_0x48cde9[_0xd9fc('0x29')]);_0x7343b1[_0xd9fc('0x2e')]=_[_0xd9fc('0x2d')](_0x48cde9['model'],qs[_0xd9fc('0x40')](_0x56c4ff[_0xd9fc('0x29')]['fields']));_0x7343b1[_0xd9fc('0x2e')]=_0x7343b1[_0xd9fc('0x2e')]['length']?_0x7343b1[_0xd9fc('0x2e')]:_0x48cde9[_0xd9fc('0x27')];if(_0x56c4ff[_0xd9fc('0x29')][_0xd9fc('0x3a')]){_0x7343b1[_0xd9fc('0x3b')]=[{'all':!![]}];}_0x7343b1=_[_0xd9fc('0x36')]({},_0x7343b1,_0x56c4ff[_0xd9fc('0x38')]);return db[_0xd9fc('0x39')][_0xd9fc('0x41')](_0x7343b1)[_0xd9fc('0x1f')](handleEntityNotFound(_0x4c1aed,null))['then'](respondWithResult(_0x4c1aed,null))['catch'](handleError(_0x4c1aed,null));};exports[_0xd9fc('0x42')]=function(_0x1ad1d7,_0xede213){return db['CmHopperHistory'][_0xd9fc('0x42')](_0x1ad1d7[_0xd9fc('0x43')],{})[_0xd9fc('0x1f')](respondWithResult(_0xede213,0xc9))[_0xd9fc('0x44')](handleError(_0xede213,null));};exports[_0xd9fc('0x45')]=function(_0xf6aa01,_0x3da47e){return db[_0xd9fc('0x39')][_0xd9fc('0x45')]()[_0xd9fc('0x1f')](respondWithResult(_0x3da47e,null))[_0xd9fc('0x44')](handleError(_0x3da47e,null));};exports['update']=function(_0x4e156b,_0x976e41){if(_0x4e156b[_0xd9fc('0x43')][_0xd9fc('0x46')]){delete _0x4e156b['body'][_0xd9fc('0x46')];}return db['CmHopperHistory'][_0xd9fc('0x41')]({'where':{'uniqueid':_0x4e156b['params']['id']}})['then'](handleEntityNotFound(_0x976e41,null))['then'](saveUpdates(_0x4e156b[_0xd9fc('0x43')],null))[_0xd9fc('0x1f')](respondWithResult(_0x976e41,null))['catch'](handleError(_0x976e41,null));}; \ No newline at end of file +var _0x1768=['find','catch','create','describe','update','body','fast-json-patch','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','limit','sort','pick','day','merge','where','map','filter','options','CmHopperHistory','includeAll','include','findAll','rows','show','params','rawAttributes','length'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x1768,0x116));var _0x8176=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x1768[_0x7e2eb0];return _0xd92de4;};'use strict';var jsonpatch=require(_0x8176('0x0'));var rp=require('request-promise');var moment=require(_0x8176('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8176('0x2'));var util=require(_0x8176('0x3'));var path=require('path');var sox=require(_0x8176('0x4'));var csv=require('to-csv');var ejs=require(_0x8176('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8176('0x6'));var crypto=require(_0x8176('0x7'));var jsforce=require(_0x8176('0x8'));var deskjs=require(_0x8176('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8176('0xa'));var qs=require(_0x8176('0xb'));var logger=require(_0x8176('0xc'))(_0x8176('0xd'));var utils=require(_0x8176('0xe'));var config=require(_0x8176('0xf'));var db=require(_0x8176('0x10'))['db'];function respondWithStatusCode(_0x2e244c,_0x59e6e4){_0x59e6e4=_0x59e6e4||0xcc;return function(_0x5e9d92){if(_0x5e9d92){return _0x2e244c[_0x8176('0x11')](_0x59e6e4);}return _0x2e244c['status'](_0x59e6e4)[_0x8176('0x12')]();};}function respondWithResult(_0x3ff117,_0x581c65){_0x581c65=_0x581c65||0xc8;return function(_0x5f3cb5){if(_0x5f3cb5){return _0x3ff117[_0x8176('0x13')](_0x581c65)[_0x8176('0x14')](_0x5f3cb5);}};}function respondWithFilteredResult(_0x111ef5,_0x5c1612){return function(_0x311089){if(_0x311089){var _0x5964d5=_0x311089[_0x8176('0x15')],_0x45dce0=_0x5c1612[_0x8176('0x16')],_0x959db7=_0x5c1612['offset']+_0x5c1612['limit'],_0x18bca9;if(_0x959db7>=_0x5964d5){_0x959db7=_0x5964d5;_0x18bca9=0xc8;}else{_0x18bca9=0xce;}_0x111ef5[_0x8176('0x13')](_0x18bca9);return _0x111ef5[_0x8176('0x17')]('Content-Range',_0x45dce0+'-'+_0x959db7+'/'+_0x5964d5)[_0x8176('0x14')](_0x311089);}return null;};}function patchUpdates(_0x5bf06f){return function(_0x4c020e){try{jsonpatch[_0x8176('0x18')](_0x4c020e,_0x5bf06f,!![]);}catch(_0x11e9ef){return BPromise[_0x8176('0x19')](_0x11e9ef);}return _0x4c020e[_0x8176('0x1a')]();};}function saveUpdates(_0x3e27a1,_0x3dc0eb){return function(_0x3803d8){if(_0x3803d8){return _0x3803d8['update'](_0x3e27a1)[_0x8176('0x1b')](function(_0x56307f){return _0x56307f;});}return null;};}function removeEntity(_0x179994,_0xb566af){return function(_0x2dd2e7){if(_0x2dd2e7){return _0x2dd2e7[_0x8176('0x1c')]()['then'](function(){_0x179994[_0x8176('0x13')](0xcc)[_0x8176('0x12')]();});}};}function handleEntityNotFound(_0xb89ae8,_0x2e0c1e){return function(_0x18edbf){if(!_0x18edbf){_0xb89ae8['sendStatus'](0x194);}return _0x18edbf;};}function handleError(_0x23ed8d,_0x30054d){_0x30054d=_0x30054d||0x1f4;return function(_0x533169){logger[_0x8176('0x1d')](_0x533169[_0x8176('0x1e')]);if(_0x533169[_0x8176('0x1f')]){delete _0x533169[_0x8176('0x1f')];}_0x23ed8d['status'](_0x30054d)[_0x8176('0x20')](_0x533169);};}exports['index']=function(_0x534f27,_0x4ef667){var _0x4cceb1={},_0xc4f634={},_0x415853={'count':0x0,'rows':[]};var _0x4f1898=db['CmHopperHistory']['rawAttributes'];_0xc4f634['model']=_['keys'](_0x4f1898);var _0x8eda2a={'dateStart':_0x534f27[_0x8176('0x21')][_0x8176('0x22')],'dateEnd':_0x534f27['query'][_0x8176('0x23')]};delete _0x534f27[_0x8176('0x21')][_0x8176('0x22')];delete _0x534f27['query'][_0x8176('0x23')];_0xc4f634[_0x8176('0x21')]=_[_0x8176('0x24')](_0x534f27[_0x8176('0x21')]);_0xc4f634[_0x8176('0x25')]=_[_0x8176('0x26')](_0xc4f634['model'],_0xc4f634[_0x8176('0x21')]);_0x4cceb1['attributes']=_[_0x8176('0x26')](_0xc4f634['model'],qs['fields'](_0x534f27[_0x8176('0x21')][_0x8176('0x27')]));_0x4cceb1[_0x8176('0x28')]=_0x4cceb1['attributes']['length']?_0x4cceb1[_0x8176('0x28')]:_0xc4f634[_0x8176('0x29')];if(!_0x534f27[_0x8176('0x21')][_0x8176('0x2a')](_0x8176('0x2b'))){_0x4cceb1[_0x8176('0x2c')]=qs[_0x8176('0x2c')](_0x534f27[_0x8176('0x21')]['limit']);_0x4cceb1[_0x8176('0x16')]=qs[_0x8176('0x16')](_0x534f27[_0x8176('0x21')]['offset']);}_0x4cceb1['order']=qs[_0x8176('0x2d')](_0x534f27[_0x8176('0x21')]['sort']);_0x4cceb1['where']=qs['filters'](_[_0x8176('0x2e')](_0x534f27[_0x8176('0x21')],_0xc4f634['filters']));if(_0x8eda2a['dateStart']){if(_0x8eda2a[_0x8176('0x23')]){_0x8eda2a['dateEnd']=moment(_0x8eda2a[_0x8176('0x23')])['add'](0x1,_0x8176('0x2f'));}else{_0x8eda2a[_0x8176('0x23')]=moment(_0x8eda2a['dateStart'])['add'](0x1,_0x8176('0x2f'));}_[_0x8176('0x30')](_0x4cceb1[_0x8176('0x31')],{'createdAt':{'$gte':_0x8eda2a[_0x8176('0x22')],'$lte':_0x8eda2a[_0x8176('0x23')]}});}if(_0x534f27[_0x8176('0x21')]['filter']){_0x4cceb1['where']=_[_0x8176('0x30')](_0x4cceb1[_0x8176('0x31')],{'$or':_[_0x8176('0x32')](_0x4cceb1[_0x8176('0x28')],function(_0x23590b){var _0xbfd3d6={};_0xbfd3d6[_0x23590b]={'$like':'%'+_0x534f27[_0x8176('0x21')][_0x8176('0x33')]+'%'};return _0xbfd3d6;})});}_0x4cceb1=_[_0x8176('0x30')]({},_0x4cceb1,_0x534f27[_0x8176('0x34')]);var _0xf2c306={'where':_0x4cceb1[_0x8176('0x31')]};return db[_0x8176('0x35')][_0x8176('0x15')](_0xf2c306)[_0x8176('0x1b')](function(_0x24c69b){_0x415853[_0x8176('0x15')]=_0x24c69b;if(_0x534f27[_0x8176('0x21')][_0x8176('0x36')]){_0x4cceb1[_0x8176('0x37')]=[{'all':!![]}];}return db[_0x8176('0x35')][_0x8176('0x38')](_0x4cceb1);})[_0x8176('0x1b')](function(_0x2b2e1d){_0x415853[_0x8176('0x39')]=_0x2b2e1d;return _0x415853;})[_0x8176('0x1b')](respondWithFilteredResult(_0x4ef667,_0x4cceb1))['catch'](handleError(_0x4ef667,null));};exports[_0x8176('0x3a')]=function(_0x2a8a1e,_0x1c26c1){var _0xfaef10={'raw':!![],'where':{'id':_0x2a8a1e[_0x8176('0x3b')]['id']}},_0x3d7801={};_0x3d7801[_0x8176('0x29')]=_[_0x8176('0x24')](db['CmHopperHistory'][_0x8176('0x3c')]);_0x3d7801['query']=_[_0x8176('0x24')](_0x2a8a1e['query']);_0x3d7801[_0x8176('0x25')]=_[_0x8176('0x26')](_0x3d7801[_0x8176('0x29')],_0x3d7801[_0x8176('0x21')]);_0xfaef10[_0x8176('0x28')]=_[_0x8176('0x26')](_0x3d7801['model'],qs[_0x8176('0x27')](_0x2a8a1e[_0x8176('0x21')][_0x8176('0x27')]));_0xfaef10[_0x8176('0x28')]=_0xfaef10[_0x8176('0x28')][_0x8176('0x3d')]?_0xfaef10[_0x8176('0x28')]:_0x3d7801[_0x8176('0x29')];if(_0x2a8a1e[_0x8176('0x21')][_0x8176('0x36')]){_0xfaef10[_0x8176('0x37')]=[{'all':!![]}];}_0xfaef10=_['merge']({},_0xfaef10,_0x2a8a1e[_0x8176('0x34')]);return db[_0x8176('0x35')][_0x8176('0x3e')](_0xfaef10)[_0x8176('0x1b')](handleEntityNotFound(_0x1c26c1,null))[_0x8176('0x1b')](respondWithResult(_0x1c26c1,null))[_0x8176('0x3f')](handleError(_0x1c26c1,null));};exports[_0x8176('0x40')]=function(_0x36e3a3,_0x42e387){return db[_0x8176('0x35')]['create'](_0x36e3a3['body'],{})[_0x8176('0x1b')](respondWithResult(_0x42e387,0xc9))[_0x8176('0x3f')](handleError(_0x42e387,null));};exports[_0x8176('0x41')]=function(_0x565872,_0x5eb649){return db[_0x8176('0x35')]['describe']()[_0x8176('0x1b')](respondWithResult(_0x5eb649,null))[_0x8176('0x3f')](handleError(_0x5eb649,null));};exports[_0x8176('0x42')]=function(_0x41e5df,_0x22a397){if(_0x41e5df[_0x8176('0x43')]['uniqueid']){delete _0x41e5df[_0x8176('0x43')]['uniqueid'];}return db[_0x8176('0x35')][_0x8176('0x3e')]({'where':{'uniqueid':_0x41e5df[_0x8176('0x3b')]['id']}})[_0x8176('0x1b')](handleEntityNotFound(_0x22a397,null))[_0x8176('0x1b')](saveUpdates(_0x41e5df[_0x8176('0x43')],null))[_0x8176('0x1b')](respondWithResult(_0x22a397,null))['catch'](handleError(_0x22a397,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 6bfe262..2aaf645 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 _0x891d=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./cmHopperHistory.attributes','exports','endtime'];(function(_0x5d4510,_0x5aa2c8){var _0x3dfae0=function(_0x5d5587){while(--_0x5d5587){_0x5d4510['push'](_0x5d4510['shift']());}};_0x3dfae0(++_0x5aa2c8);}(_0x891d,0x198));var _0xd891=function(_0x188a50,_0x593551){_0x188a50=_0x188a50-0x0;var _0x10942c=_0x891d[_0x188a50];return _0x10942c;};'use strict';var _=require(_0xd891('0x0'));var util=require(_0xd891('0x1'));var logger=require(_0xd891('0x2'))(_0xd891('0x3'));var moment=require(_0xd891('0x4'));var BPromise=require(_0xd891('0x5'));var rp=require(_0xd891('0x6'));var attributes=require(_0xd891('0x7'));module[_0xd891('0x8')]=function(_0x2417f7,_0x15d8bb){return _0x2417f7['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xd891('0x9'),'fields':[_0xd891('0x9')]},{'name':'uniqueid','fields':[_0xd891('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8792=['../../config/logger','api','moment','bluebird','request-promise','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8792,0xd7));var _0x2879=function(_0x1e553c,_0x6aca7e){_0x1e553c=_0x1e553c-0x0;var _0x1103f8=_0x8792[_0x1e553c];return _0x1103f8;};'use strict';var _=require(_0x2879('0x0'));var util=require('util');var logger=require(_0x2879('0x1'))(_0x2879('0x2'));var moment=require(_0x2879('0x3'));var BPromise=require(_0x2879('0x4'));var rp=require(_0x2879('0x5'));var attributes=require(_0x2879('0x6'));module['exports']=function(_0x46a9f5,_0x2b092c){return _0x46a9f5[_0x2879('0x7')](_0x2879('0x8'),attributes,{'tableName':_0x2879('0x9'),'paranoid':![],'indexes':[{'name':_0x2879('0xa'),'fields':['endtime']},{'name':_0x2879('0xb'),'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 e866502..159b448 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 _0x7f63=['jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','findAll','sequelize','COUNT','col','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x7f63,0x15e));var _0x37f6=function(_0xa7ab4e,_0x454cc3){_0xa7ab4e=_0xa7ab4e-0x0;var _0x41f3be=_0x7f63[_0xa7ab4e];return _0x41f3be;};'use strict';var _=require(_0x37f6('0x0'));var util=require(_0x37f6('0x1'));var moment=require(_0x37f6('0x2'));var BPromise=require(_0x37f6('0x3'));var rs=require(_0x37f6('0x4'));var fs=require('fs');var db=require(_0x37f6('0x5'))['db'];var utils=require(_0x37f6('0x6'));var logger=require(_0x37f6('0x7'))(_0x37f6('0x8'));var config=require(_0x37f6('0x9'));var jayson=require(_0x37f6('0xa'));var client=jayson[_0x37f6('0xb')][_0x37f6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d9ea5,_0x501549,_0x915771){return new BPromise(function(_0x35676a,_0x3dc55a){return client[_0x37f6('0xd')](_0x5d9ea5,_0x915771)[_0x37f6('0xe')](function(_0x44d0db){logger[_0x37f6('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x501549,_0x37f6('0x10'));logger[_0x37f6('0x11')](_0x37f6('0x12'),_0x501549,'request\x20sent',JSON['stringify'](_0x44d0db));if(_0x44d0db[_0x37f6('0x13')]){if(_0x44d0db[_0x37f6('0x13')][_0x37f6('0x14')]===0x1f4){logger[_0x37f6('0x13')](_0x37f6('0x15'),_0x501549,_0x44d0db[_0x37f6('0x13')]['message']);return _0x3dc55a(_0x44d0db['error'][_0x37f6('0x16')]);}logger[_0x37f6('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x501549,_0x44d0db[_0x37f6('0x13')][_0x37f6('0x16')]);return _0x35676a(_0x44d0db[_0x37f6('0x13')][_0x37f6('0x16')]);}else{logger[_0x37f6('0xf')](_0x37f6('0x15'),_0x501549,'request\x20sent');_0x35676a(_0x44d0db[_0x37f6('0x17')]['message']);}})[_0x37f6('0x18')](function(_0xfdac56){logger['error'](_0x37f6('0x15'),_0x501549,_0xfdac56);_0x3dc55a(_0xfdac56);});});}exports[_0x37f6('0x19')]=function(_0xd67040){var _0x44dce6=this;return new Promise(function(_0x347b38,_0x44177f){return db[_0x37f6('0x1a')][_0x37f6('0x1b')](_0xd67040[_0x37f6('0x1c')],{'raw':_0xd67040[_0x37f6('0x1d')]?_0xd67040[_0x37f6('0x1d')][_0x37f6('0x1e')]===undefined?!![]:![]:!![]})[_0x37f6('0xe')](function(_0x5da8d8){logger[_0x37f6('0xf')](_0x37f6('0x19'),_0xd67040);logger[_0x37f6('0x11')](_0x37f6('0x19'),_0xd67040,JSON[_0x37f6('0x1f')](_0x5da8d8));_0x347b38(_0x5da8d8);})[_0x37f6('0x18')](function(_0x500171){logger[_0x37f6('0x13')](_0x37f6('0x19'),_0x500171[_0x37f6('0x16')],_0xd67040);_0x44177f(_0x44dce6[_0x37f6('0x13')](0x1f4,_0x500171['message']));});});};exports['AvgHandleTime']=function(_0x16f6c8){var _0x4efc13=this;return new Promise(function(_0x40cda0,_0x139dce){return db['CmHopperHistory'][_0x37f6('0x20')]({'raw':_0x16f6c8['options']?_0x16f6c8[_0x37f6('0x1d')][_0x37f6('0x1e')]===undefined?!![]:![]:!![],'where':_0x16f6c8['options']?_0x16f6c8[_0x37f6('0x1d')]['where']||null:null,'attributes':[[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')][_0x37f6('0x23')]('id')),'predictiveIntervalTotalCalls'],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db[_0x37f6('0x21')]['literal'](_0x37f6('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db['sequelize']['fn']('IF',db[_0x37f6('0x21')]['literal'](_0x37f6('0x25')))),_0x37f6('0x26')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')]('`state`\x20=\x2011,\x201,\x20null'))),_0x37f6('0x28')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x29'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize']['literal'](_0x37f6('0x2a')))),_0x37f6('0x2b')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x29'),db[_0x37f6('0x21')]['fn']('IF',db[_0x37f6('0x21')]['literal'](_0x37f6('0x2c')))),_0x37f6('0x2d')]]})['then'](function(_0x758374){logger[_0x37f6('0xf')]('AvgHandleTime',_0x16f6c8);logger[_0x37f6('0x11')](_0x37f6('0x2e'),_0x16f6c8,JSON[_0x37f6('0x1f')](_0x758374));_0x40cda0(_0x758374);})['catch'](function(_0x592b38){logger[_0x37f6('0x13')](_0x37f6('0x2e'),_0x592b38[_0x37f6('0x16')],_0x16f6c8);_0x139dce(_0x4efc13[_0x37f6('0x13')](0x1f4,_0x592b38['message']));});});};exports[_0x37f6('0x2f')]=function(_0x50ad5f){var _0x20cc43=this;return new Promise(function(_0x57a601,_0x4915cf){return db['CmHopperHistory'][_0x37f6('0x20')]({'raw':_0x50ad5f[_0x37f6('0x1d')]?_0x50ad5f[_0x37f6('0x1d')][_0x37f6('0x1e')]===undefined?!![]:![]:!![],'where':_0x50ad5f[_0x37f6('0x1d')]?_0x50ad5f['options'][_0x37f6('0x30')]||null:null,'attributes':[[_0x37f6('0x31'),_0x37f6('0x32')],[db['sequelize']['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')](_0x37f6('0x33')))),_0x37f6('0x34')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')](_0x37f6('0x24')))),_0x37f6('0x35')],[db['sequelize']['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')](_0x37f6('0x36')))),_0x37f6('0x37')],[db['sequelize']['fn']('COUNT',db[_0x37f6('0x21')]['fn']('IF',db[_0x37f6('0x21')]['literal'](_0x37f6('0x38')))),_0x37f6('0x39')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')](_0x37f6('0x3a')))),'outboundDropCallsDayCallersExit'],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db['sequelize']['fn']('IF',db[_0x37f6('0x21')][_0x37f6('0x27')](_0x37f6('0x3b')))),_0x37f6('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')](_0x37f6('0x3d')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db[_0x37f6('0x21')][_0x37f6('0x27')](_0x37f6('0x3e')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db['sequelize'][_0x37f6('0x27')](_0x37f6('0x3f')))),_0x37f6('0x40')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db[_0x37f6('0x21')][_0x37f6('0x27')]('`state`\x20=\x2016,\x201,\x20null'))),_0x37f6('0x41')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db['sequelize']['fn']('IF',db[_0x37f6('0x21')][_0x37f6('0x27')](_0x37f6('0x42')))),_0x37f6('0x40')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db[_0x37f6('0x21')]['literal'](_0x37f6('0x43')))),_0x37f6('0x44')]],'group':[_0x37f6('0x31')]})[_0x37f6('0xe')](function(_0x2b1a8b){logger[_0x37f6('0xf')](_0x37f6('0x2f'),_0x50ad5f);logger[_0x37f6('0x11')](_0x37f6('0x2f'),_0x50ad5f,JSON[_0x37f6('0x1f')](_0x2b1a8b));_0x57a601(_0x2b1a8b);})[_0x37f6('0x18')](function(_0x4f9fb4){logger['error']('GetVoiceQueueHopperHistory',_0x4f9fb4[_0x37f6('0x16')],_0x50ad5f);_0x4915cf(_0x20cc43['error'](0x1f4,_0x4f9fb4[_0x37f6('0x16')]));});});};exports[_0x37f6('0x45')]=function(_0x23572c){var _0x1cdfdf=this;return new Promise(function(_0x21015d,_0x59ed00){return db[_0x37f6('0x1a')][_0x37f6('0x20')]({'raw':_0x23572c[_0x37f6('0x1d')]?_0x23572c[_0x37f6('0x1d')][_0x37f6('0x1e')]===undefined?!![]:![]:!![],'where':_0x23572c['options']?_0x23572c['options'][_0x37f6('0x30')]||null:null,'attributes':[[_0x37f6('0x31'),_0x37f6('0x32')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['col']('id')),_0x37f6('0x46')],[db[_0x37f6('0x21')]['fn'](_0x37f6('0x22'),db[_0x37f6('0x21')]['fn']('IF',db[_0x37f6('0x21')][_0x37f6('0x27')](_0x37f6('0x24')))),_0x37f6('0x47')]],'group':['campaign']})[_0x37f6('0xe')](function(_0x17a3c5){logger['info']('GetCampaignHopperHistory',_0x23572c);logger['debug']('GetCampaignHopperHistory',_0x23572c,JSON[_0x37f6('0x1f')](_0x17a3c5));_0x21015d(_0x17a3c5);})[_0x37f6('0x18')](function(_0x14f3be){logger['error'](_0x37f6('0x45'),_0x14f3be[_0x37f6('0x16')],_0x23572c);_0x59ed00(_0x1cdfdf[_0x37f6('0x13')](0x1f4,_0x14f3be[_0x37f6('0x16')]));});});}; \ No newline at end of file +var _0xabf1=['`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','col','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xabf1,0x1f3));var _0x1abf=function(_0x426260,_0xf267f){_0x426260=_0x426260-0x0;var _0x2df679=_0xabf1[_0x426260];return _0x2df679;};'use strict';var _=require(_0x1abf('0x0'));var util=require(_0x1abf('0x1'));var moment=require(_0x1abf('0x2'));var BPromise=require(_0x1abf('0x3'));var rs=require(_0x1abf('0x4'));var fs=require('fs');var db=require(_0x1abf('0x5'))['db'];var utils=require(_0x1abf('0x6'));var logger=require(_0x1abf('0x7'))(_0x1abf('0x8'));var config=require('../../config/environment');var jayson=require(_0x1abf('0x9'));var client=jayson[_0x1abf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd177da,_0x2aac68,_0x13796a){return new BPromise(function(_0x4b1202,_0x20f433){return client[_0x1abf('0xb')](_0xd177da,_0x13796a)[_0x1abf('0xc')](function(_0x175b24){logger[_0x1abf('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x2aac68,_0x1abf('0xe'));logger[_0x1abf('0xf')](_0x1abf('0x10'),_0x2aac68,_0x1abf('0xe'),JSON[_0x1abf('0x11')](_0x175b24));if(_0x175b24[_0x1abf('0x12')]){if(_0x175b24[_0x1abf('0x12')][_0x1abf('0x13')]===0x1f4){logger[_0x1abf('0x12')](_0x1abf('0x14'),_0x2aac68,_0x175b24[_0x1abf('0x12')][_0x1abf('0x15')]);return _0x20f433(_0x175b24['error']['message']);}logger[_0x1abf('0x12')](_0x1abf('0x14'),_0x2aac68,_0x175b24[_0x1abf('0x12')][_0x1abf('0x15')]);return _0x4b1202(_0x175b24[_0x1abf('0x12')][_0x1abf('0x15')]);}else{logger[_0x1abf('0xd')](_0x1abf('0x14'),_0x2aac68,_0x1abf('0xe'));_0x4b1202(_0x175b24[_0x1abf('0x16')]['message']);}})[_0x1abf('0x17')](function(_0x5ac52a){logger['error'](_0x1abf('0x14'),_0x2aac68,_0x5ac52a);_0x20f433(_0x5ac52a);});});}exports[_0x1abf('0x18')]=function(_0x49ad0a){var _0x2405bc=this;return new Promise(function(_0x59d04f,_0x42a6c5){return db['CmHopperHistory']['create'](_0x49ad0a['body'],{'raw':_0x49ad0a['options']?_0x49ad0a[_0x1abf('0x19')][_0x1abf('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3440e4){logger[_0x1abf('0xd')](_0x1abf('0x18'),_0x49ad0a);logger['debug'](_0x1abf('0x18'),_0x49ad0a,JSON[_0x1abf('0x11')](_0x3440e4));_0x59d04f(_0x3440e4);})[_0x1abf('0x17')](function(_0x769652){logger[_0x1abf('0x12')](_0x1abf('0x18'),_0x769652[_0x1abf('0x15')],_0x49ad0a);_0x42a6c5(_0x2405bc[_0x1abf('0x12')](0x1f4,_0x769652['message']));});});};exports[_0x1abf('0x1b')]=function(_0x2c71a3){var _0x353f35=this;return new Promise(function(_0x67d92b,_0x5c596b){return db[_0x1abf('0x1c')][_0x1abf('0x1d')]({'raw':_0x2c71a3[_0x1abf('0x19')]?_0x2c71a3[_0x1abf('0x19')][_0x1abf('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c71a3['options']?_0x2c71a3[_0x1abf('0x19')][_0x1abf('0x1e')]||null:null,'attributes':[[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')][_0x1abf('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')]['literal'](_0x1abf('0x22')))),_0x1abf('0x23')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db['sequelize']['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0x1abf('0x25')],[db[_0x1abf('0x1f')]['fn']('COUNT',db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')](_0x1abf('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x27'),db[_0x1abf('0x1f')]['fn']('IF',db['sequelize'][_0x1abf('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x1abf('0x28')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x27'),db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')]['literal'](_0x1abf('0x29')))),_0x1abf('0x2a')]]})[_0x1abf('0xc')](function(_0x5780b5){logger[_0x1abf('0xd')](_0x1abf('0x1b'),_0x2c71a3);logger[_0x1abf('0xf')](_0x1abf('0x1b'),_0x2c71a3,JSON[_0x1abf('0x11')](_0x5780b5));_0x67d92b(_0x5780b5);})[_0x1abf('0x17')](function(_0x986eb6){logger['error']('AvgHandleTime',_0x986eb6['message'],_0x2c71a3);_0x5c596b(_0x353f35[_0x1abf('0x12')](0x1f4,_0x986eb6[_0x1abf('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x382f6e){var _0x47a2c0=this;return new Promise(function(_0x5d30ab,_0x560f1d){return db[_0x1abf('0x1c')]['findAll']({'raw':_0x382f6e[_0x1abf('0x19')]?_0x382f6e[_0x1abf('0x19')][_0x1abf('0x1a')]===undefined?!![]:![]:!![],'where':_0x382f6e[_0x1abf('0x19')]?_0x382f6e[_0x1abf('0x19')][_0x1abf('0x1e')]||null:null,'attributes':[[_0x1abf('0x2b'),'name'],[db['sequelize']['fn']('COUNT',db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x1abf('0x2c')],[db['sequelize']['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1abf('0x2d')))),_0x1abf('0x2e')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')]['literal'](_0x1abf('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1abf('0x2f')))),_0x1abf('0x30')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')]['literal'](_0x1abf('0x31')))),_0x1abf('0x32')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')](_0x1abf('0x33')))),_0x1abf('0x34')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')]['literal'](_0x1abf('0x35')))),_0x1abf('0x36')],[db[_0x1abf('0x1f')]['fn']('COUNT',db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')](_0x1abf('0x37')))),_0x1abf('0x38')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')](_0x1abf('0x39')))),_0x1abf('0x3a')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')](_0x1abf('0x3b')))),_0x1abf('0x3c')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db['sequelize']['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')](_0x1abf('0x3d')))),_0x1abf('0x3e')],[db[_0x1abf('0x1f')]['fn']('COUNT',db[_0x1abf('0x1f')]['fn']('IF',db[_0x1abf('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x1abf('0x1f')]['fn']('COUNT',db[_0x1abf('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1abf('0x3f')))),_0x1abf('0x3e')],[db[_0x1abf('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1abf('0x1f')][_0x1abf('0x24')](_0x1abf('0x40')))),'outboundReCallsDay']],'group':[_0x1abf('0x2b')]})[_0x1abf('0xc')](function(_0x1c4aa5){logger[_0x1abf('0xd')](_0x1abf('0x41'),_0x382f6e);logger[_0x1abf('0xf')]('GetVoiceQueueHopperHistory',_0x382f6e,JSON[_0x1abf('0x11')](_0x1c4aa5));_0x5d30ab(_0x1c4aa5);})['catch'](function(_0x2826bf){logger['error'](_0x1abf('0x41'),_0x2826bf['message'],_0x382f6e);_0x560f1d(_0x47a2c0[_0x1abf('0x12')](0x1f4,_0x2826bf[_0x1abf('0x15')]));});});};exports[_0x1abf('0x42')]=function(_0x44b6d9){var _0x322f5f=this;return new Promise(function(_0x16845c,_0x37cb72){return db[_0x1abf('0x1c')][_0x1abf('0x1d')]({'raw':_0x44b6d9[_0x1abf('0x19')]?_0x44b6d9[_0x1abf('0x19')][_0x1abf('0x1a')]===undefined?!![]:![]:!![],'where':_0x44b6d9['options']?_0x44b6d9[_0x1abf('0x19')][_0x1abf('0x1e')]||null:null,'attributes':[[_0x1abf('0x2b'),_0x1abf('0x43')],[db['sequelize']['fn'](_0x1abf('0x20'),db[_0x1abf('0x1f')]['col']('id')),_0x1abf('0x44')],[db[_0x1abf('0x1f')]['fn'](_0x1abf('0x20'),db['sequelize']['fn']('IF',db[_0x1abf('0x1f')]['literal'](_0x1abf('0x22')))),_0x1abf('0x45')]],'group':[_0x1abf('0x2b')]})['then'](function(_0x391055){logger[_0x1abf('0xd')](_0x1abf('0x42'),_0x44b6d9);logger['debug'](_0x1abf('0x42'),_0x44b6d9,JSON['stringify'](_0x391055));_0x16845c(_0x391055);})[_0x1abf('0x17')](function(_0x2400b4){logger[_0x1abf('0x12')]('GetCampaignHopperHistory',_0x2400b4['message'],_0x44b6d9);_0x37cb72(_0x322f5f['error'](0x1f4,_0x2400b4[_0x1abf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 460cc45..5e975a7 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 _0xa9e0=['/describe','describe','create','put','/:id','update','multer','util','path','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x2f942d,_0x26aaa4){var _0x5549ad=function(_0x5c9d99){while(--_0x5c9d99){_0x2f942d['push'](_0x2f942d['shift']());}};_0x5549ad(++_0x26aaa4);}(_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 express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id',auth[_0x0a9e('0x7')](),controller['show']);router['post']('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')](_0x0a9e('0xd'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/describe','describe','create','put','/:id','update','multer','util','path','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x59b798,_0x3c72de){var _0x305938=function(_0x33a4df){while(--_0x33a4df){_0x59b798['push'](_0x59b798['shift']());}};_0x305938(++_0x3c72de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id',auth[_0x0a9e('0x7')](),controller['show']);router['post']('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')](_0x0a9e('0xd'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 991fcb6..14a84c6 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(_0x55ac88,_0x3c5953){var _0x12232e=function(_0x3c61d6){while(--_0x3c61d6){_0x55ac88['push'](_0x55ac88['shift']());}};_0x12232e(++_0x3c5953);}(_0x187d,0x93));var _0xd187=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x187d[_0x102e37];return _0x35a07c;};'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 _0xf2ca=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x104993,_0x3f9a6b){_0x104993=_0x104993-0x0;var _0x105a96=_0xf2ca[_0x104993];return _0x105a96;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaf2c('0x2')]},'dialPrefix':{'type':Sequelize[_0xaf2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 362c8b1..b2ade42 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 _0x22a3=['type','text','Sequelize','INTEGER','switch','defaultValue','cm_contacts','cf_%s','getCustomFields','addAgents','omit','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','fast-json-patch','bluebird','mustache','path','sox','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','error','stack','name','CmList','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','show','params','body','find','destroy','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','join','push','each','create','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','cf_%d','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','TEXT'];(function(_0x304bf7,_0x4fcafc){var _0x5036cd=function(_0x39e810){while(--_0x39e810){_0x304bf7['push'](_0x304bf7['shift']());}};_0x5036cd(++_0x4fcafc);}(_0x22a3,0x185));var _0x322a=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x22a3[_0x29632e];return _0x426e04;};'use strict';var jsonpatch=require(_0x322a('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x322a('0x1'));var Mustache=require(_0x322a('0x2'));var util=require('util');var path=require(_0x322a('0x3'));var sox=require(_0x322a('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x322a('0x5'));var toCsv=require(_0x322a('0x6'));var querystring=require(_0x322a('0x7'));var Papa=require(_0x322a('0x8'));var qs=require(_0x322a('0x9'));var logger=require(_0x322a('0xa'))(_0x322a('0xb'));var utils=require(_0x322a('0xc'));var config=require(_0x322a('0xd'));var db=require('../../mysqldb')['db'];var socket=require(_0x322a('0xe'))({'host':'localhost','port':0x18eb});require(_0x322a('0xf'))[_0x322a('0x10')](socket);function respondWithStatusCode(_0x1ebeb2,_0xaa9f88){_0xaa9f88=_0xaa9f88||0xcc;return function(_0x40b342){if(_0x40b342){return _0x1ebeb2[_0x322a('0x11')](_0xaa9f88);}return _0x1ebeb2[_0x322a('0x12')](_0xaa9f88)[_0x322a('0x13')]();};}function respondWithResult(_0x15023c,_0x4fbcc7){_0x4fbcc7=_0x4fbcc7||0xc8;return function(_0x31e979){if(_0x31e979){return _0x15023c['status'](_0x4fbcc7)[_0x322a('0x14')](_0x31e979);}};}function respondWithFilteredResult(_0x8d2ef3,_0xf693cd){return function(_0x46e3ab){if(_0x46e3ab){var _0x174c21=_0x46e3ab['count'],_0x5b8f2a=_0xf693cd[_0x322a('0x15')],_0xaabc21=_0xf693cd[_0x322a('0x15')]+_0xf693cd[_0x322a('0x16')],_0x57f530;if(_0xaabc21>=_0x174c21){_0xaabc21=_0x174c21;_0x57f530=0xc8;}else{_0x57f530=0xce;}_0x8d2ef3[_0x322a('0x12')](_0x57f530);return _0x8d2ef3[_0x322a('0x17')]('Content-Range',_0x5b8f2a+'-'+_0xaabc21+'/'+_0x174c21)['json'](_0x46e3ab);}return null;};}function patchUpdates(_0xa25853){return function(_0x5b466d){try{jsonpatch[_0x322a('0x18')](_0x5b466d,_0xa25853,!![]);}catch(_0x5255e8){return BPromise[_0x322a('0x19')](_0x5255e8);}return _0x5b466d[_0x322a('0x1a')]();};}function saveUpdates(_0x1e854a,_0x4bc47f){return function(_0x5d51ac){if(_0x5d51ac){return _0x5d51ac[_0x322a('0x1b')](_0x1e854a)[_0x322a('0x1c')](function(_0x555093){return _0x555093;});}return null;};}function removeEntity(_0x1273cf,_0x57da6e){return function(_0x2f7ce9){if(_0x2f7ce9){return _0x2f7ce9['destroy']()[_0x322a('0x1c')](function(){_0x1273cf[_0x322a('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x385755,_0x3c6b76){return function(_0x379e28){if(!_0x379e28){_0x385755[_0x322a('0x11')](0x194);}return _0x379e28;};}function handleError(_0x104ab5,_0x5a0b91){_0x5a0b91=_0x5a0b91||0x1f4;return function(_0x343f77){logger[_0x322a('0x1d')](_0x343f77[_0x322a('0x1e')]);if(_0x343f77[_0x322a('0x1f')]){delete _0x343f77[_0x322a('0x1f')];}_0x104ab5[_0x322a('0x12')](_0x5a0b91)['send'](_0x343f77);};}exports['index']=function(_0x5bf320,_0x15afdf){var _0x1e661f={},_0x4578ed={},_0x5b2f74={'count':0x0,'rows':[]};var _0x1f521a=db[_0x322a('0x20')][_0x322a('0x21')];_0x4578ed[_0x322a('0x22')]=_[_0x322a('0x23')](_0x1f521a);var _0x512b45={'dateStart':_0x5bf320[_0x322a('0x24')][_0x322a('0x25')],'dateEnd':_0x5bf320[_0x322a('0x24')][_0x322a('0x26')]};delete _0x5bf320['query'][_0x322a('0x25')];delete _0x5bf320['query'][_0x322a('0x26')];_0x4578ed[_0x322a('0x24')]=_['keys'](_0x5bf320['query']);_0x4578ed[_0x322a('0x27')]=_[_0x322a('0x28')](_0x4578ed[_0x322a('0x22')],_0x4578ed[_0x322a('0x24')]);_0x1e661f['attributes']=_['intersection'](_0x4578ed[_0x322a('0x22')],qs[_0x322a('0x29')](_0x5bf320[_0x322a('0x24')][_0x322a('0x29')]));_0x1e661f[_0x322a('0x2a')]=_0x1e661f[_0x322a('0x2a')][_0x322a('0x2b')]?_0x1e661f['attributes']:_0x4578ed['model'];if(!_0x5bf320[_0x322a('0x24')][_0x322a('0x2c')](_0x322a('0x2d'))){_0x1e661f[_0x322a('0x16')]=qs[_0x322a('0x16')](_0x5bf320[_0x322a('0x24')][_0x322a('0x16')]);_0x1e661f[_0x322a('0x15')]=qs[_0x322a('0x15')](_0x5bf320[_0x322a('0x24')][_0x322a('0x15')]);}_0x1e661f[_0x322a('0x2e')]=qs[_0x322a('0x2f')](_0x5bf320['query'][_0x322a('0x2f')]);_0x1e661f[_0x322a('0x30')]=qs[_0x322a('0x27')](_[_0x322a('0x31')](_0x5bf320['query'],_0x4578ed['filters']));if(_0x512b45[_0x322a('0x25')]){if(_0x512b45['dateEnd']){_0x512b45[_0x322a('0x26')]=moment(_0x512b45[_0x322a('0x26')])[_0x322a('0x32')](0x1,_0x322a('0x33'));}else{_0x512b45[_0x322a('0x26')]=moment(_0x512b45['dateStart'])[_0x322a('0x32')](0x1,'day');}_[_0x322a('0x34')](_0x1e661f[_0x322a('0x30')],{'createdAt':{'$gte':_0x512b45['dateStart'],'$lte':_0x512b45[_0x322a('0x26')]}});}if(_0x5bf320[_0x322a('0x24')][_0x322a('0x35')]){_0x1e661f[_0x322a('0x30')]=_[_0x322a('0x34')](_0x1e661f[_0x322a('0x30')],{'$or':_[_0x322a('0x36')](_0x1e661f[_0x322a('0x2a')],function(_0x3c255f){var _0x1885ce={};_0x1885ce[_0x3c255f]={'$like':'%'+_0x5bf320[_0x322a('0x24')][_0x322a('0x35')]+'%'};return _0x1885ce;})});}_0x1e661f=_[_0x322a('0x34')]({},_0x1e661f,_0x5bf320[_0x322a('0x37')]);var _0x574723={'where':_0x1e661f[_0x322a('0x30')]};return db[_0x322a('0x20')]['count'](_0x574723)[_0x322a('0x1c')](function(_0x3c8efd){_0x5b2f74[_0x322a('0x38')]=_0x3c8efd;if(_0x5bf320['query'][_0x322a('0x39')]){_0x1e661f[_0x322a('0x3a')]=[{'all':!![]}];}return db[_0x322a('0x20')][_0x322a('0x3b')](_0x1e661f);})[_0x322a('0x1c')](function(_0x5192f8){_0x5b2f74[_0x322a('0x3c')]=_0x5192f8;return _0x5b2f74;})[_0x322a('0x1c')](respondWithFilteredResult(_0x15afdf,_0x1e661f))[_0x322a('0x3d')](handleError(_0x15afdf,null));};exports[_0x322a('0x3e')]=function(_0x5dfe0e,_0xe9a96c){var _0x2c1e77={'raw':![],'where':{'id':_0x5dfe0e[_0x322a('0x3f')]['id']}},_0x5604eb={};_0x5604eb[_0x322a('0x22')]=_['keys'](db[_0x322a('0x20')][_0x322a('0x21')]);_0x5604eb['query']=_[_0x322a('0x23')](_0x5dfe0e[_0x322a('0x24')]);_0x5604eb[_0x322a('0x27')]=_[_0x322a('0x28')](_0x5604eb[_0x322a('0x22')],_0x5604eb[_0x322a('0x24')]);_0x2c1e77[_0x322a('0x2a')]=_[_0x322a('0x28')](_0x5604eb['model'],qs['fields'](_0x5dfe0e[_0x322a('0x24')][_0x322a('0x29')]));_0x2c1e77[_0x322a('0x2a')]=_0x2c1e77[_0x322a('0x2a')][_0x322a('0x2b')]?_0x2c1e77['attributes']:_0x5604eb[_0x322a('0x22')];if(_0x5dfe0e['query'][_0x322a('0x39')]){_0x2c1e77[_0x322a('0x3a')]=[{'all':!![]}];}_0x2c1e77=_[_0x322a('0x34')]({},_0x2c1e77,_0x5dfe0e[_0x322a('0x37')]);return db['CmList']['find'](_0x2c1e77)[_0x322a('0x1c')](handleEntityNotFound(_0xe9a96c,null))[_0x322a('0x1c')](respondWithResult(_0xe9a96c,null))['catch'](handleError(_0xe9a96c,null));};exports['create']=function(_0x126943,_0x47788a){return db['CmList']['create'](_0x126943[_0x322a('0x40')],{})[_0x322a('0x1c')](respondWithResult(_0x47788a,0xc9))[_0x322a('0x3d')](handleError(_0x47788a,null));};exports[_0x322a('0x1b')]=function(_0x40086d,_0x255806){if(_0x40086d[_0x322a('0x40')]['id']){delete _0x40086d[_0x322a('0x40')]['id'];}return db['CmList'][_0x322a('0x41')]({'where':{'id':_0x40086d[_0x322a('0x3f')]['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0x255806,null))[_0x322a('0x1c')](saveUpdates(_0x40086d[_0x322a('0x40')],null))[_0x322a('0x1c')](respondWithResult(_0x255806,null))[_0x322a('0x3d')](handleError(_0x255806,null));};exports[_0x322a('0x42')]=function(_0x191dea,_0xa3339d){return db[_0x322a('0x20')]['find']({'where':{'id':_0x191dea[_0x322a('0x3f')]['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0xa3339d,null))['then'](removeEntity(_0xa3339d,null))['catch'](handleError(_0xa3339d,null));};exports[_0x322a('0x43')]=function(_0x599711,_0x41e437){return db[_0x322a('0x20')][_0x322a('0x43')]()['then'](respondWithResult(_0x41e437,null))[_0x322a('0x3d')](handleError(_0x41e437,null));};exports[_0x322a('0x44')]=function(_0x16835f,_0x3cb91c,_0x40d8f3){if(_0x16835f[_0x322a('0x40')]['id']){delete _0x16835f[_0x322a('0x40')]['id'];}return db[_0x322a('0x20')]['find']({'where':{'id':_0x16835f[_0x322a('0x3f')]['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0x3cb91c,null))[_0x322a('0x1c')](function(_0x46200a){if(_0x46200a){_0x16835f['body'][_0x322a('0x45')]=_0x46200a['id'];return db[_0x322a('0x46')]['create'](_0x16835f[_0x322a('0x40')]);}})['then'](respondWithResult(_0x3cb91c,null))[_0x322a('0x3d')](handleError(_0x3cb91c,null));};exports[_0x322a('0x47')]=function(_0x31306f,_0x3c768e,_0x39fc2c){var _0x1942bd={'raw':![],'where':{}};var _0x54bfb={};var _0x2fecdc={'count':0x0,'rows':[]};return db[_0x322a('0x20')][_0x322a('0x48')]({'where':{'id':_0x31306f['params']['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0x3c768e,null))[_0x322a('0x1c')](function(_0x2aa7b9){if(_0x2aa7b9){_0x54bfb['model']=_[_0x322a('0x23')](db['Disposition'][_0x322a('0x21')]);_0x54bfb['query']=_[_0x322a('0x23')](_0x31306f['query']);_0x54bfb['filters']=_[_0x322a('0x28')](_0x54bfb[_0x322a('0x22')],_0x54bfb[_0x322a('0x24')]);_0x1942bd['attributes']=_[_0x322a('0x28')](_0x54bfb['model'],qs[_0x322a('0x29')](_0x31306f[_0x322a('0x24')][_0x322a('0x29')]));_0x1942bd[_0x322a('0x2a')]=_0x1942bd[_0x322a('0x2a')]['length']?_0x1942bd[_0x322a('0x2a')]:_0x54bfb[_0x322a('0x22')];if(!_0x31306f[_0x322a('0x24')]['hasOwnProperty']('nolimit')){_0x1942bd[_0x322a('0x16')]=qs['limit'](_0x31306f[_0x322a('0x24')][_0x322a('0x16')]);_0x1942bd['offset']=qs[_0x322a('0x15')](_0x31306f['query'][_0x322a('0x15')]);}_0x1942bd[_0x322a('0x2e')]=qs[_0x322a('0x2f')](_0x31306f[_0x322a('0x24')][_0x322a('0x2f')]);_0x1942bd[_0x322a('0x30')]=qs['filters'](_[_0x322a('0x31')](_0x31306f[_0x322a('0x24')],_0x54bfb[_0x322a('0x27')]));_0x1942bd['where'][_0x322a('0x45')]=_0x2aa7b9['id'];if(_0x31306f[_0x322a('0x24')][_0x322a('0x35')]){_0x1942bd['where']=_[_0x322a('0x34')](_0x1942bd['where'],{'$or':_[_0x322a('0x36')](_0x1942bd['attributes'],function(_0x3355f5){var _0x444665={};_0x444665[_0x3355f5]={'$like':'%'+_0x31306f[_0x322a('0x24')]['filter']+'%'};return _0x444665;})});}_0x1942bd=_[_0x322a('0x34')]({},_0x1942bd,_0x31306f[_0x322a('0x37')]);return db[_0x322a('0x46')][_0x322a('0x38')]({'where':_0x1942bd['where']})[_0x322a('0x1c')](function(_0x49a82f){_0x2fecdc[_0x322a('0x38')]=_0x49a82f;if(_0x31306f[_0x322a('0x24')]['includeAll']){_0x1942bd[_0x322a('0x3a')]=[{'all':!![]}];}return db[_0x322a('0x46')]['findAll'](_0x1942bd);})[_0x322a('0x1c')](function(_0x47d8a1){_0x2fecdc[_0x322a('0x3c')]=_0x47d8a1;return _0x2fecdc;});}})['then'](respondWithFilteredResult(_0x3c768e,_0x1942bd))[_0x322a('0x3d')](handleError(_0x3c768e,null));};exports[_0x322a('0x49')]=function(_0x32e5f2,_0x1ffead,_0xd14420){var _0x42ca9f;return db[_0x322a('0x20')][_0x322a('0x41')]({'where':{'id':_0x32e5f2[_0x322a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1ffead,null))[_0x322a('0x1c')](function(_0x12cfa0){if(_0x12cfa0){return _0x12cfa0[_0x322a('0x49')](_0x32e5f2['query'][_0x322a('0x4a')]);}})['then'](respondWithStatusCode(_0x1ffead,null))[_0x322a('0x3d')](handleError(_0x1ffead,null));};exports[_0x322a('0x4b')]=function(_0x1f7cd9,_0x2658e0,_0x35d318){return db[_0x322a('0x20')]['find']({'where':{'id':_0x1f7cd9[_0x322a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2658e0,null))[_0x322a('0x1c')](function(_0x552996){if(_0x552996){var _0x378244=[];var _0x555dd9={'success':[],'errors':[]};return db[_0x322a('0x4c')][_0x322a('0x43')]()['then'](function(_0x455a58){if(_0x1f7cd9[_0x322a('0x40')][_0x322a('0x4d')]&&_['isArray'](_0x1f7cd9[_0x322a('0x40')]['tags'])){if(_0x1f7cd9['body']['tags'][_0x322a('0x2b')]){_0x1f7cd9[_0x322a('0x40')][_0x322a('0x4d')]=_0x1f7cd9[_0x322a('0x40')][_0x322a('0x4d')][_0x322a('0x4e')](';')+';';}else{_0x1f7cd9[_0x322a('0x40')][_0x322a('0x4d')]=null;}}else{_0x1f7cd9[_0x322a('0x40')][_0x322a('0x4d')]=null;}if(_0x1f7cd9[_0x322a('0x40')]&&_['isArray'](_0x1f7cd9[_0x322a('0x40')])){for(var _0x5480ca=0x0;_0x5480ca<_0x1f7cd9['body']['length'];_0x5480ca+=0x1){_0x1f7cd9['body'][_0x5480ca][_0x322a('0x45')]=_0x1f7cd9[_0x322a('0x3f')]['id'];_0x378244[_0x322a('0x4f')](_0x1f7cd9['body'][_0x5480ca]);}return BPromise[_0x322a('0x50')](_0x378244,function(_0x50043e){return db[_0x322a('0x4c')][_0x322a('0x51')](_['omit'](_0x50043e,[_0x322a('0x4a'),'id'])||{},{'fields':_[_0x322a('0x23')](_0x455a58),'raw':!![]})[_0x322a('0x1c')](function(_0x317984){_0x555dd9[_0x322a('0x52')][_0x322a('0x4f')](_0x317984[_0x322a('0x53')]);})[_0x322a('0x3d')](function(_0x29f07c){_0x555dd9[_0x322a('0x54')][_0x322a('0x4f')]({'data':_0x50043e,'error':_0x29f07c[_0x322a('0x55')]});});})['then'](function(_0x13f24e){return _0x555dd9;})[_0x322a('0x3d')](function(_0x3a06af){return _0x3a06af;});}else{_0x2658e0[_0x322a('0x12')](0x190)['json']({'message':_0x322a('0x56')});}});}})['then'](respondWithResult(_0x2658e0,null))[_0x322a('0x3d')](handleError(_0x2658e0,null));};exports[_0x322a('0x57')]=function(_0x5b1e7e,_0x30eb82,_0x465c27){var _0x215f21;return db[_0x322a('0x20')][_0x322a('0x41')]({'where':{'id':_0x5b1e7e[_0x322a('0x3f')]['id']},'include':[{'model':db[_0x322a('0x58')],'as':_0x322a('0x59')}]})[_0x322a('0x1c')](handleEntityNotFound(_0x30eb82,null))[_0x322a('0x1c')](function(_0xd648c9){if(_0xd648c9){_0x215f21=_0xd648c9;return db[_0x322a('0x4c')][_0x322a('0x21')];}})[_0x322a('0x1c')](function(_0x4f33f0){if(_0x4f33f0){var _0x167d6a={};var _0xa4e7f1={};_0xa4e7f1[_0x322a('0x22')]=_[_0x322a('0x5a')](_[_0x322a('0x23')](_0x4f33f0),_['map'](_0x215f21['CustomFields'],function(_0x2aa160){return util[_0x322a('0x5b')]('cf_%d',_0x2aa160['id']);}));_0xa4e7f1['query']=_['keys'](_0x5b1e7e[_0x322a('0x24')]);_0xa4e7f1['filters']=_[_0x322a('0x28')](_0xa4e7f1[_0x322a('0x22')],_0xa4e7f1['query']);_0x167d6a[_0x322a('0x2a')]=_[_0x322a('0x28')](_0xa4e7f1['model'],qs[_0x322a('0x29')](_0x5b1e7e['query'][_0x322a('0x29')]));_0x167d6a[_0x322a('0x2a')]=_0x167d6a['attributes'][_0x322a('0x2b')]?_0x167d6a['attributes']:_0xa4e7f1['model'];if(!_0x5b1e7e[_0x322a('0x24')][_0x322a('0x2c')](_0x322a('0x2d'))){_0x167d6a['limit']=qs[_0x322a('0x16')](_0x5b1e7e[_0x322a('0x24')]['limit']);_0x167d6a[_0x322a('0x15')]=qs[_0x322a('0x15')](_0x5b1e7e[_0x322a('0x24')][_0x322a('0x15')]);}_0x167d6a[_0x322a('0x2e')]=qs[_0x322a('0x2f')](_0x5b1e7e[_0x322a('0x24')]['sort']);_0x167d6a[_0x322a('0x30')]=qs[_0x322a('0x27')](_[_0x322a('0x31')](_0x5b1e7e['query'],_0xa4e7f1['filters']));_0x167d6a[_0x322a('0x5c')]=!![];if(_0x5b1e7e['query'][_0x322a('0x35')]){_0x167d6a[_0x322a('0x30')]=_[_0x322a('0x34')](_0x167d6a['where'],{'$or':_['map'](_0x167d6a['attributes'],function(_0x583cb2){var _0xe790ab={};_0xe790ab[_0x583cb2]={'$like':'%'+_0x5b1e7e[_0x322a('0x24')][_0x322a('0x35')]+'%'};return _0xe790ab;})});}_0x167d6a=_[_0x322a('0x34')]({},_0x167d6a,_0x5b1e7e[_0x322a('0x37')]);return _0x215f21[_0x322a('0x57')](_0x167d6a);}})[_0x322a('0x1c')](respondWithResult(_0x30eb82,null))[_0x322a('0x3d')](handleError(_0x30eb82,null));};exports['getContactsCsv']=function(_0xa25622,_0x28f467,_0x59265e){var _0x4689eb;return db[_0x322a('0x20')][_0x322a('0x41')]({'where':{'id':_0xa25622['params']['id']},'include':[{'model':db[_0x322a('0x58')],'as':_0x322a('0x59')}]})['then'](handleEntityNotFound(_0x28f467,null))[_0x322a('0x1c')](function(_0x56e09c){if(_0x56e09c){_0x4689eb=_0x56e09c;return db['CmContact'][_0x322a('0x21')];}})[_0x322a('0x1c')](function(_0x4bad40){if(_0x4bad40){var _0x4dc456={};var _0x51d905={};_0x51d905[_0x322a('0x22')]=_[_0x322a('0x5a')](_[_0x322a('0x23')](_0x4bad40),_['map'](_0x4689eb[_0x322a('0x59')],function(_0x262e15){return util['format'](_0x322a('0x5d'),_0x262e15['id']);}));_0x51d905[_0x322a('0x24')]=_[_0x322a('0x23')](_0xa25622[_0x322a('0x24')]);_0x51d905[_0x322a('0x27')]=_['intersection'](_0x51d905['model'],_0x51d905[_0x322a('0x24')]);_0x4dc456[_0x322a('0x2a')]=_[_0x322a('0x28')](_0x51d905[_0x322a('0x22')],qs['fields'](_0xa25622[_0x322a('0x24')][_0x322a('0x29')]));_0x4dc456[_0x322a('0x2a')]=_0x4dc456[_0x322a('0x2a')][_0x322a('0x2b')]?_0x4dc456[_0x322a('0x2a')]:_0x51d905[_0x322a('0x22')];if(!_0xa25622[_0x322a('0x24')][_0x322a('0x2c')](_0x322a('0x2d'))){_0x4dc456[_0x322a('0x16')]=qs[_0x322a('0x16')](_0xa25622[_0x322a('0x24')][_0x322a('0x16')]);_0x4dc456[_0x322a('0x15')]=qs[_0x322a('0x15')](_0xa25622['query']['offset']);}_0x4dc456[_0x322a('0x2e')]=qs[_0x322a('0x2f')](_0xa25622['query'][_0x322a('0x2f')]);_0x4dc456['where']=qs[_0x322a('0x27')](_[_0x322a('0x31')](_0xa25622[_0x322a('0x24')],_0x51d905[_0x322a('0x27')]));_0x4dc456[_0x322a('0x5c')]=!![];if(_0xa25622['query'][_0x322a('0x35')]){_0x4dc456[_0x322a('0x30')]=_['merge'](_0x4dc456[_0x322a('0x30')],{'$or':_[_0x322a('0x36')](_0x4dc456[_0x322a('0x2a')],function(_0x191551){var _0x46edec={};_0x46edec[_0x191551]={'$like':'%'+_0xa25622['query'][_0x322a('0x35')]+'%'};return _0x46edec;})});}_0x4dc456=_[_0x322a('0x34')]({},_0x4dc456,_0xa25622[_0x322a('0x37')]);return _0x4689eb[_0x322a('0x57')](_0x4dc456);}})[_0x322a('0x1c')](function(_0x5edd89){if(!_[_0x322a('0x5e')](_0x5edd89)){var _0x198168=toCsv(_0x5edd89);var _0x3e2d82=Date['now']();fs[_0x322a('0x5f')](util[_0x322a('0x5b')]('/tmp/list_%d_%s.csv',_0x4689eb['id'],_0x3e2d82),_0x198168);_0x28f467[_0x322a('0x60')](_0x322a('0x61'),_0x322a('0x62')+util['format'](_0x322a('0x63'),_0x4689eb['id'],_0x3e2d82));_0x28f467['setHeader']('Content-type',_0x322a('0x64'));return _0x28f467[_0x322a('0x65')](util[_0x322a('0x5b')](_0x322a('0x66'),_0x4689eb['id'],_0x3e2d82));}else{return _0x28f467['sendStatus'](0xcc);}})[_0x322a('0x3d')](handleError(_0x28f467,null));};exports['addCustomField']=function(_0x24c4a1,_0x585b0c,_0x1e35bb){var _0x4fb40f;delete _0x24c4a1['body']['id'];return db[_0x322a('0x20')][_0x322a('0x48')]({'where':{'id':_0x24c4a1[_0x322a('0x3f')]['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0x585b0c,null))[_0x322a('0x1c')](function(_0x19185c){if(_0x19185c){return db[_0x322a('0x67')][_0x322a('0x68')](function(_0x206f05){return db[_0x322a('0x58')]['create'](_0x24c4a1[_0x322a('0x40')],{'transaction':_0x206f05})['then'](function(_0x56b160){_0x4fb40f=_0x56b160;return _0x19185c[_0x322a('0x69')](_0x56b160,{'transaction':_0x206f05});})[_0x322a('0x1c')](function(){var _0x3aeec6={'type':db['Sequelize'][_0x322a('0x6a')],'transaction':_0x206f05};switch(_0x24c4a1[_0x322a('0x40')][_0x322a('0x6b')]){case _0x322a('0x6c'):_0x3aeec6[_0x322a('0x6b')]=db[_0x322a('0x6d')][_0x322a('0x6a')];break;case'number':_0x3aeec6[_0x322a('0x6b')]=db['Sequelize'][_0x322a('0x6e')];break;case _0x322a('0x6f'):_0x3aeec6['type']=db['Sequelize']['BOOLEAN'];_0x3aeec6[_0x322a('0x70')]=![];break;default:}return db[_0x322a('0x67')]['queryInterface']['addColumn'](_0x322a('0x71'),util[_0x322a('0x5b')](_0x322a('0x72'),_0x4fb40f['id']),_0x3aeec6);})[_0x322a('0x1c')](function(){return _0x4fb40f;});});}})['then'](respondWithResult(_0x585b0c,null))[_0x322a('0x3d')](handleError(_0x585b0c,null));};exports[_0x322a('0x73')]=function(_0x345630,_0x22be13,_0x295f5b){var _0x1115d5={};var _0x29ba5b={};var _0x71526b;var _0x47d9d2;return db[_0x322a('0x20')][_0x322a('0x48')]({'where':{'id':_0x345630[_0x322a('0x3f')]['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0x22be13,null))['then'](function(_0x52b3f9){if(_0x52b3f9){_0x71526b=_0x52b3f9;_0x29ba5b[_0x322a('0x22')]=_[_0x322a('0x23')](db[_0x322a('0x58')][_0x322a('0x21')]);_0x29ba5b[_0x322a('0x24')]=_[_0x322a('0x23')](_0x345630[_0x322a('0x24')]);_0x29ba5b[_0x322a('0x27')]=_[_0x322a('0x28')](_0x29ba5b[_0x322a('0x22')],_0x29ba5b['query']);_0x1115d5[_0x322a('0x2a')]=_['intersection'](_0x29ba5b[_0x322a('0x22')],qs[_0x322a('0x29')](_0x345630[_0x322a('0x24')][_0x322a('0x29')]));_0x1115d5[_0x322a('0x2a')]=_0x1115d5['attributes'][_0x322a('0x2b')]?_0x1115d5[_0x322a('0x2a')]:_0x29ba5b[_0x322a('0x22')];_0x1115d5[_0x322a('0x2e')]=qs[_0x322a('0x2f')](_0x345630[_0x322a('0x24')][_0x322a('0x2f')]);_0x1115d5[_0x322a('0x30')]=qs[_0x322a('0x27')](_[_0x322a('0x31')](_0x345630['query'],_0x29ba5b['filters']));_0x1115d5[_0x322a('0x30')]=_[_0x322a('0x34')](_0x1115d5[_0x322a('0x30')],{'$or':[{'ListId':_0x52b3f9['id']},{'ListId':null}]});if(_0x345630['query']['filter']){_0x1115d5[_0x322a('0x30')]=_[_0x322a('0x34')](_0x1115d5[_0x322a('0x30')],{'$or':_[_0x322a('0x36')](_0x1115d5[_0x322a('0x2a')],function(_0x4c4e02){var _0x22a300={};_0x22a300[_0x4c4e02]={'$like':'%'+_0x345630[_0x322a('0x24')][_0x322a('0x35')]+'%'};return _0x22a300;})});}_0x1115d5=_[_0x322a('0x34')]({},_0x1115d5,_0x345630[_0x322a('0x37')]);return db[_0x322a('0x58')]['findAndCountAll'](_0x1115d5);}})['then'](respondWithResult(_0x22be13,null))['catch'](handleError(_0x22be13,null));};exports[_0x322a('0x74')]=function(_0x5c04cf,_0x66714a,_0xc18733){return db['CmList']['find']({'where':{'id':_0x5c04cf[_0x322a('0x3f')]['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0x66714a,null))[_0x322a('0x1c')](function(_0x294851){if(_0x294851){return _0x294851[_0x322a('0x74')](_0x5c04cf[_0x322a('0x40')][_0x322a('0x4a')],_[_0x322a('0x75')](_0x5c04cf[_0x322a('0x40')],[_0x322a('0x4a'),'id'])||{})['spread'](function(_0x520686){for(var _0x5dbf93=0x0;_0x5dbf93<_0x5c04cf[_0x322a('0x40')][_0x322a('0x4a')][_0x322a('0x2b')];_0x5dbf93+=0x1){socket[_0x322a('0x76')](_0x322a('0x77'),{'UserId':_0x5c04cf[_0x322a('0x40')]['ids'][_0x5dbf93],'CmListId':_0x5c04cf[_0x322a('0x3f')]['id']});}return _0x520686;});}})[_0x322a('0x1c')](respondWithResult(_0x66714a,null))[_0x322a('0x3d')](handleError(_0x66714a,null));};exports[_0x322a('0x78')]=function(_0x4961f8,_0x825237,_0x13aeb6){var _0x269948;return db[_0x322a('0x20')]['find']({'where':{'id':_0x4961f8[_0x322a('0x3f')]['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0x825237,null))[_0x322a('0x1c')](function(_0x3c7e7f){if(_0x3c7e7f){return _0x3c7e7f[_0x322a('0x78')](_0x4961f8[_0x322a('0x24')][_0x322a('0x4a')])['then'](function(_0x27aa63){if(_[_0x322a('0x79')](_0x4961f8[_0x322a('0x24')][_0x322a('0x4a')])){for(var _0x2a466d=0x0;_0x2a466d<_0x4961f8[_0x322a('0x24')]['ids'][_0x322a('0x2b')];_0x2a466d+=0x1){socket[_0x322a('0x76')](_0x322a('0x7a'),{'UserId':_0x4961f8[_0x322a('0x24')][_0x322a('0x4a')][_0x2a466d],'CmListId':_0x4961f8[_0x322a('0x3f')]['id']});}}else{socket[_0x322a('0x76')](_0x322a('0x7a'),{'UserId':_0x4961f8[_0x322a('0x24')][_0x322a('0x4a')],'CmListId':_0x4961f8[_0x322a('0x3f')]['id']});}});}})[_0x322a('0x1c')](respondWithStatusCode(_0x825237,null))[_0x322a('0x3d')](handleError(_0x825237,null));};exports[_0x322a('0x7b')]=function(_0x39ac11,_0x3e7169,_0x21f4a9){var _0x3c1379={};var _0x421255={};var _0x5080c2;var _0x3a753d;return db[_0x322a('0x20')]['findOne']({'where':{'id':_0x39ac11[_0x322a('0x3f')]['id']}})[_0x322a('0x1c')](handleEntityNotFound(_0x3e7169,null))['then'](function(_0x280c8e){if(_0x280c8e){_0x5080c2=_0x280c8e;_0x421255[_0x322a('0x22')]=_['keys'](db['User']['rawAttributes']);_0x421255[_0x322a('0x24')]=_[_0x322a('0x23')](_0x39ac11[_0x322a('0x24')]);_0x421255[_0x322a('0x27')]=_[_0x322a('0x28')](_0x421255['model'],_0x421255['query']);_0x3c1379['attributes']=_[_0x322a('0x28')](_0x421255[_0x322a('0x22')],qs[_0x322a('0x29')](_0x39ac11['query'][_0x322a('0x29')]));_0x3c1379[_0x322a('0x2a')]=_0x3c1379['attributes'][_0x322a('0x2b')]?_0x3c1379[_0x322a('0x2a')]:_0x421255[_0x322a('0x22')];_0x3c1379[_0x322a('0x2e')]=qs[_0x322a('0x2f')](_0x39ac11[_0x322a('0x24')]['sort']);_0x3c1379['where']=qs[_0x322a('0x27')](_['pick'](_0x39ac11[_0x322a('0x24')],_0x421255['filters']));if(_0x39ac11[_0x322a('0x24')][_0x322a('0x35')]){_0x3c1379[_0x322a('0x30')]=_['merge'](_0x3c1379[_0x322a('0x30')],{'$or':_['map'](_0x3c1379['attributes'],function(_0x544aa5){var _0x4612db={};_0x4612db[_0x544aa5]={'$like':'%'+_0x39ac11['query']['filter']+'%'};return _0x4612db;})});}_0x3c1379=_['merge']({},_0x3c1379,_0x39ac11[_0x322a('0x37')]);return _0x5080c2[_0x322a('0x7b')](_0x3c1379);}})[_0x322a('0x1c')](function(_0x2de222){if(_0x2de222){_0x3a753d=_0x2de222[_0x322a('0x2b')];if(!_0x39ac11[_0x322a('0x24')]['hasOwnProperty']('nolimit')){_0x3c1379[_0x322a('0x16')]=qs[_0x322a('0x16')](_0x39ac11[_0x322a('0x24')][_0x322a('0x16')]);_0x3c1379['offset']=qs[_0x322a('0x15')](_0x39ac11[_0x322a('0x24')][_0x322a('0x15')]);}return _0x5080c2[_0x322a('0x7b')](_0x3c1379);}})['then'](function(_0x589a5e){if(_0x589a5e){return _0x589a5e?{'count':_0x3a753d,'rows':_0x589a5e}:null;}})[_0x322a('0x1c')](respondWithResult(_0x3e7169,null))['catch'](handleError(_0x3e7169,null));}; \ No newline at end of file +var _0xbff2=['attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','filter','map','options','CmList','includeAll','include','rows','catch','find','create','body','params','describe','addDisposition','ListId','Disposition','findOne','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','dataValues','errors','push','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','order','getContacts','getContactsCsv','concat','cf_%d','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','text/csv','download','transaction','addCustomFields','Sequelize','TEXT','type','text','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','localhost','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','dateEnd','dateStart','filters'];(function(_0x3e7952,_0x58aa90){var _0x1a4690=function(_0x1c24b9){while(--_0x1c24b9){_0x3e7952['push'](_0x3e7952['shift']());}};_0x1a4690(++_0x58aa90);}(_0xbff2,0x14d));var _0x2bff=function(_0x371bd7,_0x5692d9){_0x371bd7=_0x371bd7-0x0;var _0x5523a7=_0xbff2[_0x371bd7];return _0x5523a7;};'use strict';var jsonpatch=require(_0x2bff('0x0'));var rp=require(_0x2bff('0x1'));var moment=require(_0x2bff('0x2'));var BPromise=require(_0x2bff('0x3'));var Mustache=require(_0x2bff('0x4'));var util=require(_0x2bff('0x5'));var path=require(_0x2bff('0x6'));var sox=require(_0x2bff('0x7'));var csv=require(_0x2bff('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2bff('0x9'));var squel=require(_0x2bff('0xa'));var crypto=require(_0x2bff('0xb'));var jsforce=require(_0x2bff('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2bff('0x8'));var querystring=require('querystring');var Papa=require(_0x2bff('0xd'));var qs=require(_0x2bff('0xe'));var logger=require(_0x2bff('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x2bff('0x10'));var db=require(_0x2bff('0x11'))['db'];var socket=require(_0x2bff('0x12'))({'host':_0x2bff('0x13'),'port':0x18eb});require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x5771f1,_0x319f2f){_0x319f2f=_0x319f2f||0xcc;return function(_0x23e869){if(_0x23e869){return _0x5771f1[_0x2bff('0x14')](_0x319f2f);}return _0x5771f1[_0x2bff('0x15')](_0x319f2f)[_0x2bff('0x16')]();};}function respondWithResult(_0x5f5aae,_0x3b9788){_0x3b9788=_0x3b9788||0xc8;return function(_0x30107c){if(_0x30107c){return _0x5f5aae['status'](_0x3b9788)[_0x2bff('0x17')](_0x30107c);}};}function respondWithFilteredResult(_0x3326ea,_0x106c2d){return function(_0x1e53d8){if(_0x1e53d8){var _0x482eb6=_0x1e53d8[_0x2bff('0x18')],_0x2c1dfa=_0x106c2d[_0x2bff('0x19')],_0x2cd35b=_0x106c2d['offset']+_0x106c2d['limit'],_0x43cf56;if(_0x2cd35b>=_0x482eb6){_0x2cd35b=_0x482eb6;_0x43cf56=0xc8;}else{_0x43cf56=0xce;}_0x3326ea[_0x2bff('0x15')](_0x43cf56);return _0x3326ea[_0x2bff('0x1a')](_0x2bff('0x1b'),_0x2c1dfa+'-'+_0x2cd35b+'/'+_0x482eb6)[_0x2bff('0x17')](_0x1e53d8);}return null;};}function patchUpdates(_0x472c24){return function(_0x1dae85){try{jsonpatch['apply'](_0x1dae85,_0x472c24,!![]);}catch(_0xcaedff){return BPromise[_0x2bff('0x1c')](_0xcaedff);}return _0x1dae85[_0x2bff('0x1d')]();};}function saveUpdates(_0x440e51,_0x1b3985){return function(_0x3f13c9){if(_0x3f13c9){return _0x3f13c9[_0x2bff('0x1e')](_0x440e51)[_0x2bff('0x1f')](function(_0x248739){return _0x248739;});}return null;};}function removeEntity(_0x4f8177,_0x5d25ab){return function(_0x5c556a){if(_0x5c556a){return _0x5c556a[_0x2bff('0x20')]()['then'](function(){_0x4f8177['status'](0xcc)[_0x2bff('0x16')]();});}};}function handleEntityNotFound(_0x8c5d56,_0x26d311){return function(_0x3ae013){if(!_0x3ae013){_0x8c5d56[_0x2bff('0x14')](0x194);}return _0x3ae013;};}function handleError(_0x58818a,_0xbe52a1){_0xbe52a1=_0xbe52a1||0x1f4;return function(_0x3f347f){logger[_0x2bff('0x21')](_0x3f347f[_0x2bff('0x22')]);if(_0x3f347f['name']){delete _0x3f347f[_0x2bff('0x23')];}_0x58818a[_0x2bff('0x15')](_0xbe52a1)[_0x2bff('0x24')](_0x3f347f);};}exports[_0x2bff('0x25')]=function(_0xc7733d,_0x4c5020){var _0x51f5eb={},_0x10f1a8={},_0x1802fd={'count':0x0,'rows':[]};var _0x4a704c=db['CmList'][_0x2bff('0x26')];_0x10f1a8[_0x2bff('0x27')]=_[_0x2bff('0x28')](_0x4a704c);var _0x557153={'dateStart':_0xc7733d[_0x2bff('0x29')]['dateStart'],'dateEnd':_0xc7733d[_0x2bff('0x29')][_0x2bff('0x2a')]};delete _0xc7733d['query'][_0x2bff('0x2b')];delete _0xc7733d[_0x2bff('0x29')]['dateEnd'];_0x10f1a8[_0x2bff('0x29')]=_[_0x2bff('0x28')](_0xc7733d['query']);_0x10f1a8[_0x2bff('0x2c')]=_['intersection'](_0x10f1a8[_0x2bff('0x27')],_0x10f1a8[_0x2bff('0x29')]);_0x51f5eb[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x10f1a8[_0x2bff('0x27')],qs[_0x2bff('0x2f')](_0xc7733d[_0x2bff('0x29')]['fields']));_0x51f5eb[_0x2bff('0x2d')]=_0x51f5eb[_0x2bff('0x2d')][_0x2bff('0x30')]?_0x51f5eb[_0x2bff('0x2d')]:_0x10f1a8['model'];if(!_0xc7733d['query'][_0x2bff('0x31')](_0x2bff('0x32'))){_0x51f5eb[_0x2bff('0x33')]=qs[_0x2bff('0x33')](_0xc7733d['query'][_0x2bff('0x33')]);_0x51f5eb[_0x2bff('0x19')]=qs['offset'](_0xc7733d[_0x2bff('0x29')][_0x2bff('0x19')]);}_0x51f5eb['order']=qs[_0x2bff('0x34')](_0xc7733d[_0x2bff('0x29')][_0x2bff('0x34')]);_0x51f5eb[_0x2bff('0x35')]=qs[_0x2bff('0x2c')](_[_0x2bff('0x36')](_0xc7733d[_0x2bff('0x29')],_0x10f1a8[_0x2bff('0x2c')]));if(_0x557153[_0x2bff('0x2b')]){if(_0x557153[_0x2bff('0x2a')]){_0x557153[_0x2bff('0x2a')]=moment(_0x557153['dateEnd'])['add'](0x1,'day');}else{_0x557153[_0x2bff('0x2a')]=moment(_0x557153[_0x2bff('0x2b')])['add'](0x1,'day');}_[_0x2bff('0x37')](_0x51f5eb[_0x2bff('0x35')],{'createdAt':{'$gte':_0x557153[_0x2bff('0x2b')],'$lte':_0x557153[_0x2bff('0x2a')]}});}if(_0xc7733d[_0x2bff('0x29')][_0x2bff('0x38')]){_0x51f5eb[_0x2bff('0x35')]=_[_0x2bff('0x37')](_0x51f5eb[_0x2bff('0x35')],{'$or':_[_0x2bff('0x39')](_0x51f5eb[_0x2bff('0x2d')],function(_0x3be4d5){var _0x33929a={};_0x33929a[_0x3be4d5]={'$like':'%'+_0xc7733d[_0x2bff('0x29')][_0x2bff('0x38')]+'%'};return _0x33929a;})});}_0x51f5eb=_[_0x2bff('0x37')]({},_0x51f5eb,_0xc7733d[_0x2bff('0x3a')]);var _0x776d91={'where':_0x51f5eb[_0x2bff('0x35')]};return db[_0x2bff('0x3b')][_0x2bff('0x18')](_0x776d91)[_0x2bff('0x1f')](function(_0x39b176){_0x1802fd['count']=_0x39b176;if(_0xc7733d[_0x2bff('0x29')][_0x2bff('0x3c')]){_0x51f5eb[_0x2bff('0x3d')]=[{'all':!![]}];}return db[_0x2bff('0x3b')]['findAll'](_0x51f5eb);})[_0x2bff('0x1f')](function(_0x25f18f){_0x1802fd[_0x2bff('0x3e')]=_0x25f18f;return _0x1802fd;})[_0x2bff('0x1f')](respondWithFilteredResult(_0x4c5020,_0x51f5eb))[_0x2bff('0x3f')](handleError(_0x4c5020,null));};exports['show']=function(_0x480836,_0x3dd306){var _0x406065={'raw':![],'where':{'id':_0x480836['params']['id']}},_0x185e45={};_0x185e45[_0x2bff('0x27')]=_[_0x2bff('0x28')](db['CmList'][_0x2bff('0x26')]);_0x185e45[_0x2bff('0x29')]=_['keys'](_0x480836[_0x2bff('0x29')]);_0x185e45[_0x2bff('0x2c')]=_[_0x2bff('0x2e')](_0x185e45[_0x2bff('0x27')],_0x185e45[_0x2bff('0x29')]);_0x406065['attributes']=_['intersection'](_0x185e45['model'],qs['fields'](_0x480836[_0x2bff('0x29')][_0x2bff('0x2f')]));_0x406065['attributes']=_0x406065[_0x2bff('0x2d')][_0x2bff('0x30')]?_0x406065['attributes']:_0x185e45[_0x2bff('0x27')];if(_0x480836[_0x2bff('0x29')][_0x2bff('0x3c')]){_0x406065[_0x2bff('0x3d')]=[{'all':!![]}];}_0x406065=_[_0x2bff('0x37')]({},_0x406065,_0x480836['options']);return db[_0x2bff('0x3b')][_0x2bff('0x40')](_0x406065)[_0x2bff('0x1f')](handleEntityNotFound(_0x3dd306,null))[_0x2bff('0x1f')](respondWithResult(_0x3dd306,null))[_0x2bff('0x3f')](handleError(_0x3dd306,null));};exports['create']=function(_0x1a168c,_0x2d2668){return db[_0x2bff('0x3b')][_0x2bff('0x41')](_0x1a168c['body'],{})[_0x2bff('0x1f')](respondWithResult(_0x2d2668,0xc9))[_0x2bff('0x3f')](handleError(_0x2d2668,null));};exports[_0x2bff('0x1e')]=function(_0xcca2ff,_0x5e1f17){if(_0xcca2ff[_0x2bff('0x42')]['id']){delete _0xcca2ff[_0x2bff('0x42')]['id'];}return db[_0x2bff('0x3b')][_0x2bff('0x40')]({'where':{'id':_0xcca2ff[_0x2bff('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e1f17,null))['then'](saveUpdates(_0xcca2ff[_0x2bff('0x42')],null))[_0x2bff('0x1f')](respondWithResult(_0x5e1f17,null))[_0x2bff('0x3f')](handleError(_0x5e1f17,null));};exports[_0x2bff('0x20')]=function(_0x11b60b,_0x52ddf2){return db[_0x2bff('0x3b')][_0x2bff('0x40')]({'where':{'id':_0x11b60b[_0x2bff('0x43')]['id']}})[_0x2bff('0x1f')](handleEntityNotFound(_0x52ddf2,null))[_0x2bff('0x1f')](removeEntity(_0x52ddf2,null))['catch'](handleError(_0x52ddf2,null));};exports[_0x2bff('0x44')]=function(_0x4187c7,_0x45a6a5){return db[_0x2bff('0x3b')][_0x2bff('0x44')]()[_0x2bff('0x1f')](respondWithResult(_0x45a6a5,null))[_0x2bff('0x3f')](handleError(_0x45a6a5,null));};exports[_0x2bff('0x45')]=function(_0x21d354,_0x551c40,_0x1ac4a7){if(_0x21d354['body']['id']){delete _0x21d354[_0x2bff('0x42')]['id'];}return db[_0x2bff('0x3b')][_0x2bff('0x40')]({'where':{'id':_0x21d354[_0x2bff('0x43')]['id']}})['then'](handleEntityNotFound(_0x551c40,null))[_0x2bff('0x1f')](function(_0x11b32c){if(_0x11b32c){_0x21d354[_0x2bff('0x42')][_0x2bff('0x46')]=_0x11b32c['id'];return db[_0x2bff('0x47')][_0x2bff('0x41')](_0x21d354['body']);}})[_0x2bff('0x1f')](respondWithResult(_0x551c40,null))[_0x2bff('0x3f')](handleError(_0x551c40,null));};exports['getDispositions']=function(_0x5c67f2,_0x1b3547,_0x149ce8){var _0x3dcb51={'raw':![],'where':{}};var _0x437c06={};var _0x3d2447={'count':0x0,'rows':[]};return db[_0x2bff('0x3b')][_0x2bff('0x48')]({'where':{'id':_0x5c67f2['params']['id']}})['then'](handleEntityNotFound(_0x1b3547,null))[_0x2bff('0x1f')](function(_0x121ef7){if(_0x121ef7){_0x437c06[_0x2bff('0x27')]=_[_0x2bff('0x28')](db['Disposition']['rawAttributes']);_0x437c06[_0x2bff('0x29')]=_[_0x2bff('0x28')](_0x5c67f2['query']);_0x437c06[_0x2bff('0x2c')]=_['intersection'](_0x437c06[_0x2bff('0x27')],_0x437c06[_0x2bff('0x29')]);_0x3dcb51[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x437c06[_0x2bff('0x27')],qs[_0x2bff('0x2f')](_0x5c67f2[_0x2bff('0x29')]['fields']));_0x3dcb51[_0x2bff('0x2d')]=_0x3dcb51[_0x2bff('0x2d')]['length']?_0x3dcb51[_0x2bff('0x2d')]:_0x437c06[_0x2bff('0x27')];if(!_0x5c67f2['query'][_0x2bff('0x31')](_0x2bff('0x32'))){_0x3dcb51['limit']=qs[_0x2bff('0x33')](_0x5c67f2[_0x2bff('0x29')][_0x2bff('0x33')]);_0x3dcb51[_0x2bff('0x19')]=qs['offset'](_0x5c67f2['query']['offset']);}_0x3dcb51['order']=qs['sort'](_0x5c67f2[_0x2bff('0x29')][_0x2bff('0x34')]);_0x3dcb51['where']=qs[_0x2bff('0x2c')](_[_0x2bff('0x36')](_0x5c67f2[_0x2bff('0x29')],_0x437c06[_0x2bff('0x2c')]));_0x3dcb51[_0x2bff('0x35')]['ListId']=_0x121ef7['id'];if(_0x5c67f2['query'][_0x2bff('0x38')]){_0x3dcb51['where']=_[_0x2bff('0x37')](_0x3dcb51[_0x2bff('0x35')],{'$or':_[_0x2bff('0x39')](_0x3dcb51[_0x2bff('0x2d')],function(_0x401b57){var _0x3103e6={};_0x3103e6[_0x401b57]={'$like':'%'+_0x5c67f2['query'][_0x2bff('0x38')]+'%'};return _0x3103e6;})});}_0x3dcb51=_[_0x2bff('0x37')]({},_0x3dcb51,_0x5c67f2[_0x2bff('0x3a')]);return db[_0x2bff('0x47')]['count']({'where':_0x3dcb51[_0x2bff('0x35')]})['then'](function(_0x4d13bb){_0x3d2447[_0x2bff('0x18')]=_0x4d13bb;if(_0x5c67f2['query'][_0x2bff('0x3c')]){_0x3dcb51[_0x2bff('0x3d')]=[{'all':!![]}];}return db[_0x2bff('0x47')][_0x2bff('0x49')](_0x3dcb51);})[_0x2bff('0x1f')](function(_0x4c672c){_0x3d2447[_0x2bff('0x3e')]=_0x4c672c;return _0x3d2447;});}})[_0x2bff('0x1f')](respondWithFilteredResult(_0x1b3547,_0x3dcb51))[_0x2bff('0x3f')](handleError(_0x1b3547,null));};exports[_0x2bff('0x4a')]=function(_0x5c0fc8,_0x2e8c11,_0x5ca9b0){var _0x4251b5;return db['CmList'][_0x2bff('0x40')]({'where':{'id':_0x5c0fc8['params']['id']}})['then'](handleEntityNotFound(_0x2e8c11,null))[_0x2bff('0x1f')](function(_0x22876c){if(_0x22876c){return _0x22876c[_0x2bff('0x4a')](_0x5c0fc8[_0x2bff('0x29')][_0x2bff('0x4b')]);}})['then'](respondWithStatusCode(_0x2e8c11,null))[_0x2bff('0x3f')](handleError(_0x2e8c11,null));};exports[_0x2bff('0x4c')]=function(_0x18a104,_0x86b025,_0x2867a0){return db[_0x2bff('0x3b')][_0x2bff('0x40')]({'where':{'id':_0x18a104['params']['id']}})[_0x2bff('0x1f')](handleEntityNotFound(_0x86b025,null))['then'](function(_0x3d55fc){if(_0x3d55fc){var _0x2ef702=[];var _0x44ad39={'success':[],'errors':[]};return db[_0x2bff('0x4d')][_0x2bff('0x44')]()[_0x2bff('0x1f')](function(_0x4829d1){if(_0x18a104[_0x2bff('0x42')][_0x2bff('0x4e')]&&_[_0x2bff('0x4f')](_0x18a104[_0x2bff('0x42')][_0x2bff('0x4e')])){if(_0x18a104[_0x2bff('0x42')][_0x2bff('0x4e')]['length']){_0x18a104[_0x2bff('0x42')][_0x2bff('0x4e')]=_0x18a104['body'][_0x2bff('0x4e')][_0x2bff('0x50')](';')+';';}else{_0x18a104[_0x2bff('0x42')][_0x2bff('0x4e')]=null;}}else{_0x18a104['body'][_0x2bff('0x4e')]=null;}if(_0x18a104[_0x2bff('0x42')]&&_[_0x2bff('0x4f')](_0x18a104[_0x2bff('0x42')])){for(var _0xf8c8d2=0x0;_0xf8c8d2<_0x18a104[_0x2bff('0x42')][_0x2bff('0x30')];_0xf8c8d2+=0x1){_0x18a104[_0x2bff('0x42')][_0xf8c8d2][_0x2bff('0x46')]=_0x18a104['params']['id'];_0x2ef702['push'](_0x18a104[_0x2bff('0x42')][_0xf8c8d2]);}return BPromise[_0x2bff('0x51')](_0x2ef702,function(_0x6f4212){return db[_0x2bff('0x4d')]['create'](_[_0x2bff('0x52')](_0x6f4212,[_0x2bff('0x4b'),'id'])||{},{'fields':_['keys'](_0x4829d1),'raw':!![]})[_0x2bff('0x1f')](function(_0x301261){_0x44ad39[_0x2bff('0x53')]['push'](_0x301261[_0x2bff('0x54')]);})[_0x2bff('0x3f')](function(_0x136326){_0x44ad39[_0x2bff('0x55')][_0x2bff('0x56')]({'data':_0x6f4212,'error':_0x136326['message']});});})[_0x2bff('0x1f')](function(_0x21acdf){return _0x44ad39;})[_0x2bff('0x3f')](function(_0x289241){return _0x289241;});}else{_0x86b025['status'](0x190)[_0x2bff('0x17')]({'message':_0x2bff('0x57')});}});}})[_0x2bff('0x1f')](respondWithResult(_0x86b025,null))[_0x2bff('0x3f')](handleError(_0x86b025,null));};exports['getContacts']=function(_0x4983b7,_0x5557c,_0x30312f){var _0x303836;return db[_0x2bff('0x3b')][_0x2bff('0x40')]({'where':{'id':_0x4983b7['params']['id']},'include':[{'model':db[_0x2bff('0x58')],'as':'CustomFields'}]})[_0x2bff('0x1f')](handleEntityNotFound(_0x5557c,null))[_0x2bff('0x1f')](function(_0x1ef9ff){if(_0x1ef9ff){_0x303836=_0x1ef9ff;return db[_0x2bff('0x4d')][_0x2bff('0x26')];}})[_0x2bff('0x1f')](function(_0x5a7028){if(_0x5a7028){var _0x44044a={};var _0x2e5a73={};_0x2e5a73[_0x2bff('0x27')]=_['concat'](_[_0x2bff('0x28')](_0x5a7028),_[_0x2bff('0x39')](_0x303836[_0x2bff('0x59')],function(_0x5cfd2c){return util[_0x2bff('0x5a')]('cf_%d',_0x5cfd2c['id']);}));_0x2e5a73['query']=_[_0x2bff('0x28')](_0x4983b7['query']);_0x2e5a73[_0x2bff('0x2c')]=_[_0x2bff('0x2e')](_0x2e5a73['model'],_0x2e5a73['query']);_0x44044a['attributes']=_['intersection'](_0x2e5a73[_0x2bff('0x27')],qs[_0x2bff('0x2f')](_0x4983b7[_0x2bff('0x29')][_0x2bff('0x2f')]));_0x44044a[_0x2bff('0x2d')]=_0x44044a[_0x2bff('0x2d')][_0x2bff('0x30')]?_0x44044a[_0x2bff('0x2d')]:_0x2e5a73[_0x2bff('0x27')];if(!_0x4983b7[_0x2bff('0x29')][_0x2bff('0x31')]('nolimit')){_0x44044a[_0x2bff('0x33')]=qs[_0x2bff('0x33')](_0x4983b7[_0x2bff('0x29')][_0x2bff('0x33')]);_0x44044a['offset']=qs['offset'](_0x4983b7[_0x2bff('0x29')][_0x2bff('0x19')]);}_0x44044a[_0x2bff('0x5b')]=qs[_0x2bff('0x34')](_0x4983b7[_0x2bff('0x29')][_0x2bff('0x34')]);_0x44044a['where']=qs[_0x2bff('0x2c')](_['pick'](_0x4983b7[_0x2bff('0x29')],_0x2e5a73['filters']));_0x44044a['raw']=!![];if(_0x4983b7['query'][_0x2bff('0x38')]){_0x44044a['where']=_[_0x2bff('0x37')](_0x44044a['where'],{'$or':_['map'](_0x44044a[_0x2bff('0x2d')],function(_0x1e838c){var _0x1f4e96={};_0x1f4e96[_0x1e838c]={'$like':'%'+_0x4983b7[_0x2bff('0x29')][_0x2bff('0x38')]+'%'};return _0x1f4e96;})});}_0x44044a=_[_0x2bff('0x37')]({},_0x44044a,_0x4983b7['options']);return _0x303836[_0x2bff('0x5c')](_0x44044a);}})[_0x2bff('0x1f')](respondWithResult(_0x5557c,null))[_0x2bff('0x3f')](handleError(_0x5557c,null));};exports[_0x2bff('0x5d')]=function(_0x2718d1,_0x58943e,_0x242edd){var _0x5efd8f;return db['CmList'][_0x2bff('0x40')]({'where':{'id':_0x2718d1['params']['id']},'include':[{'model':db[_0x2bff('0x58')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x58943e,null))[_0x2bff('0x1f')](function(_0x412882){if(_0x412882){_0x5efd8f=_0x412882;return db[_0x2bff('0x4d')][_0x2bff('0x26')];}})['then'](function(_0x429232){if(_0x429232){var _0x5cc301={};var _0x2c4b4c={};_0x2c4b4c[_0x2bff('0x27')]=_[_0x2bff('0x5e')](_['keys'](_0x429232),_['map'](_0x5efd8f[_0x2bff('0x59')],function(_0x45d943){return util[_0x2bff('0x5a')](_0x2bff('0x5f'),_0x45d943['id']);}));_0x2c4b4c[_0x2bff('0x29')]=_[_0x2bff('0x28')](_0x2718d1[_0x2bff('0x29')]);_0x2c4b4c[_0x2bff('0x2c')]=_[_0x2bff('0x2e')](_0x2c4b4c[_0x2bff('0x27')],_0x2c4b4c[_0x2bff('0x29')]);_0x5cc301[_0x2bff('0x2d')]=_['intersection'](_0x2c4b4c['model'],qs[_0x2bff('0x2f')](_0x2718d1['query'][_0x2bff('0x2f')]));_0x5cc301['attributes']=_0x5cc301[_0x2bff('0x2d')][_0x2bff('0x30')]?_0x5cc301[_0x2bff('0x2d')]:_0x2c4b4c[_0x2bff('0x27')];if(!_0x2718d1[_0x2bff('0x29')][_0x2bff('0x31')](_0x2bff('0x32'))){_0x5cc301['limit']=qs[_0x2bff('0x33')](_0x2718d1[_0x2bff('0x29')][_0x2bff('0x33')]);_0x5cc301['offset']=qs[_0x2bff('0x19')](_0x2718d1[_0x2bff('0x29')]['offset']);}_0x5cc301['order']=qs[_0x2bff('0x34')](_0x2718d1['query'][_0x2bff('0x34')]);_0x5cc301[_0x2bff('0x35')]=qs[_0x2bff('0x2c')](_[_0x2bff('0x36')](_0x2718d1[_0x2bff('0x29')],_0x2c4b4c[_0x2bff('0x2c')]));_0x5cc301['raw']=!![];if(_0x2718d1[_0x2bff('0x29')]['filter']){_0x5cc301[_0x2bff('0x35')]=_[_0x2bff('0x37')](_0x5cc301[_0x2bff('0x35')],{'$or':_['map'](_0x5cc301[_0x2bff('0x2d')],function(_0xb571ef){var _0x2e5819={};_0x2e5819[_0xb571ef]={'$like':'%'+_0x2718d1[_0x2bff('0x29')]['filter']+'%'};return _0x2e5819;})});}_0x5cc301=_[_0x2bff('0x37')]({},_0x5cc301,_0x2718d1['options']);return _0x5efd8f['getContacts'](_0x5cc301);}})[_0x2bff('0x1f')](function(_0x5d2234){if(!_['isEmpty'](_0x5d2234)){var _0x17804e=toCsv(_0x5d2234);var _0x430aad=Date['now']();fs[_0x2bff('0x60')](util[_0x2bff('0x5a')](_0x2bff('0x61'),_0x5efd8f['id'],_0x430aad),_0x17804e);_0x58943e[_0x2bff('0x62')](_0x2bff('0x63'),'attachment;\x20filename='+util[_0x2bff('0x5a')](_0x2bff('0x64'),_0x5efd8f['id'],_0x430aad));_0x58943e['setHeader']('Content-type',_0x2bff('0x65'));return _0x58943e[_0x2bff('0x66')](util[_0x2bff('0x5a')](_0x2bff('0x61'),_0x5efd8f['id'],_0x430aad));}else{return _0x58943e['sendStatus'](0xcc);}})[_0x2bff('0x3f')](handleError(_0x58943e,null));};exports['addCustomField']=function(_0x445e2c,_0x1ea379,_0x25598a){var _0x53acd7;delete _0x445e2c[_0x2bff('0x42')]['id'];return db[_0x2bff('0x3b')][_0x2bff('0x48')]({'where':{'id':_0x445e2c[_0x2bff('0x43')]['id']}})[_0x2bff('0x1f')](handleEntityNotFound(_0x1ea379,null))[_0x2bff('0x1f')](function(_0x1a7f90){if(_0x1a7f90){return db['sequelize'][_0x2bff('0x67')](function(_0x541e55){return db[_0x2bff('0x58')][_0x2bff('0x41')](_0x445e2c[_0x2bff('0x42')],{'transaction':_0x541e55})[_0x2bff('0x1f')](function(_0x55b6f8){_0x53acd7=_0x55b6f8;return _0x1a7f90[_0x2bff('0x68')](_0x55b6f8,{'transaction':_0x541e55});})[_0x2bff('0x1f')](function(){var _0x3451f2={'type':db[_0x2bff('0x69')][_0x2bff('0x6a')],'transaction':_0x541e55};switch(_0x445e2c[_0x2bff('0x42')][_0x2bff('0x6b')]){case _0x2bff('0x6c'):_0x3451f2[_0x2bff('0x6b')]=db[_0x2bff('0x69')][_0x2bff('0x6a')];break;case'number':_0x3451f2[_0x2bff('0x6b')]=db[_0x2bff('0x69')][_0x2bff('0x6d')];break;case _0x2bff('0x6e'):_0x3451f2[_0x2bff('0x6b')]=db['Sequelize'][_0x2bff('0x6f')];_0x3451f2[_0x2bff('0x70')]=![];break;default:}return db[_0x2bff('0x71')]['queryInterface'][_0x2bff('0x72')](_0x2bff('0x73'),util[_0x2bff('0x5a')](_0x2bff('0x74'),_0x53acd7['id']),_0x3451f2);})[_0x2bff('0x1f')](function(){return _0x53acd7;});});}})[_0x2bff('0x1f')](respondWithResult(_0x1ea379,null))[_0x2bff('0x3f')](handleError(_0x1ea379,null));};exports[_0x2bff('0x75')]=function(_0x242f28,_0x4493d7,_0x3c848d){var _0x226272={};var _0xde1d8b={};var _0x398d83;var _0x347256;return db[_0x2bff('0x3b')][_0x2bff('0x48')]({'where':{'id':_0x242f28[_0x2bff('0x43')]['id']}})['then'](handleEntityNotFound(_0x4493d7,null))['then'](function(_0x475d3e){if(_0x475d3e){_0x398d83=_0x475d3e;_0xde1d8b[_0x2bff('0x27')]=_[_0x2bff('0x28')](db[_0x2bff('0x58')][_0x2bff('0x26')]);_0xde1d8b[_0x2bff('0x29')]=_[_0x2bff('0x28')](_0x242f28[_0x2bff('0x29')]);_0xde1d8b[_0x2bff('0x2c')]=_[_0x2bff('0x2e')](_0xde1d8b[_0x2bff('0x27')],_0xde1d8b['query']);_0x226272[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0xde1d8b[_0x2bff('0x27')],qs[_0x2bff('0x2f')](_0x242f28[_0x2bff('0x29')][_0x2bff('0x2f')]));_0x226272['attributes']=_0x226272['attributes'][_0x2bff('0x30')]?_0x226272['attributes']:_0xde1d8b['model'];_0x226272[_0x2bff('0x5b')]=qs[_0x2bff('0x34')](_0x242f28[_0x2bff('0x29')][_0x2bff('0x34')]);_0x226272[_0x2bff('0x35')]=qs[_0x2bff('0x2c')](_[_0x2bff('0x36')](_0x242f28[_0x2bff('0x29')],_0xde1d8b[_0x2bff('0x2c')]));_0x226272[_0x2bff('0x35')]=_[_0x2bff('0x37')](_0x226272[_0x2bff('0x35')],{'$or':[{'ListId':_0x475d3e['id']},{'ListId':null}]});if(_0x242f28['query'][_0x2bff('0x38')]){_0x226272[_0x2bff('0x35')]=_[_0x2bff('0x37')](_0x226272['where'],{'$or':_[_0x2bff('0x39')](_0x226272['attributes'],function(_0x18103f){var _0x5b3ca5={};_0x5b3ca5[_0x18103f]={'$like':'%'+_0x242f28[_0x2bff('0x29')][_0x2bff('0x38')]+'%'};return _0x5b3ca5;})});}_0x226272=_[_0x2bff('0x37')]({},_0x226272,_0x242f28[_0x2bff('0x3a')]);return db[_0x2bff('0x58')][_0x2bff('0x76')](_0x226272);}})['then'](respondWithResult(_0x4493d7,null))[_0x2bff('0x3f')](handleError(_0x4493d7,null));};exports['addAgents']=function(_0x803777,_0x365f79,_0x2d50f4){return db[_0x2bff('0x3b')]['find']({'where':{'id':_0x803777[_0x2bff('0x43')]['id']}})[_0x2bff('0x1f')](handleEntityNotFound(_0x365f79,null))[_0x2bff('0x1f')](function(_0x382e0c){if(_0x382e0c){return _0x382e0c[_0x2bff('0x77')](_0x803777[_0x2bff('0x42')][_0x2bff('0x4b')],_['omit'](_0x803777[_0x2bff('0x42')],[_0x2bff('0x4b'),'id'])||{})[_0x2bff('0x78')](function(_0x2b29e4){for(var _0x383d3f=0x0;_0x383d3f<_0x803777[_0x2bff('0x42')][_0x2bff('0x4b')]['length'];_0x383d3f+=0x1){socket[_0x2bff('0x79')]('userCmList:save',{'UserId':_0x803777[_0x2bff('0x42')][_0x2bff('0x4b')][_0x383d3f],'CmListId':_0x803777[_0x2bff('0x43')]['id']});}return _0x2b29e4;});}})[_0x2bff('0x1f')](respondWithResult(_0x365f79,null))[_0x2bff('0x3f')](handleError(_0x365f79,null));};exports[_0x2bff('0x7a')]=function(_0x378186,_0x405c91,_0x565686){var _0x1ea155;return db['CmList']['find']({'where':{'id':_0x378186[_0x2bff('0x43')]['id']}})['then'](handleEntityNotFound(_0x405c91,null))['then'](function(_0x27ed6b){if(_0x27ed6b){return _0x27ed6b[_0x2bff('0x7a')](_0x378186[_0x2bff('0x29')][_0x2bff('0x4b')])[_0x2bff('0x1f')](function(_0x457adc){if(_['isArray'](_0x378186[_0x2bff('0x29')][_0x2bff('0x4b')])){for(var _0x179466=0x0;_0x179466<_0x378186[_0x2bff('0x29')][_0x2bff('0x4b')][_0x2bff('0x30')];_0x179466+=0x1){socket[_0x2bff('0x79')](_0x2bff('0x7b'),{'UserId':_0x378186['query'][_0x2bff('0x4b')][_0x179466],'CmListId':_0x378186[_0x2bff('0x43')]['id']});}}else{socket['emit'](_0x2bff('0x7b'),{'UserId':_0x378186[_0x2bff('0x29')]['ids'],'CmListId':_0x378186[_0x2bff('0x43')]['id']});}});}})[_0x2bff('0x1f')](respondWithStatusCode(_0x405c91,null))[_0x2bff('0x3f')](handleError(_0x405c91,null));};exports[_0x2bff('0x7c')]=function(_0x1eeb53,_0x458983,_0x46edb9){var _0x488731={};var _0x11860b={};var _0x2ec0b4;var _0x501237;return db[_0x2bff('0x3b')][_0x2bff('0x48')]({'where':{'id':_0x1eeb53['params']['id']}})[_0x2bff('0x1f')](handleEntityNotFound(_0x458983,null))[_0x2bff('0x1f')](function(_0x3ccf99){if(_0x3ccf99){_0x2ec0b4=_0x3ccf99;_0x11860b[_0x2bff('0x27')]=_['keys'](db[_0x2bff('0x7d')][_0x2bff('0x26')]);_0x11860b[_0x2bff('0x29')]=_['keys'](_0x1eeb53[_0x2bff('0x29')]);_0x11860b[_0x2bff('0x2c')]=_[_0x2bff('0x2e')](_0x11860b[_0x2bff('0x27')],_0x11860b['query']);_0x488731[_0x2bff('0x2d')]=_['intersection'](_0x11860b[_0x2bff('0x27')],qs[_0x2bff('0x2f')](_0x1eeb53[_0x2bff('0x29')][_0x2bff('0x2f')]));_0x488731[_0x2bff('0x2d')]=_0x488731['attributes']['length']?_0x488731['attributes']:_0x11860b[_0x2bff('0x27')];_0x488731[_0x2bff('0x5b')]=qs['sort'](_0x1eeb53['query']['sort']);_0x488731[_0x2bff('0x35')]=qs['filters'](_[_0x2bff('0x36')](_0x1eeb53[_0x2bff('0x29')],_0x11860b[_0x2bff('0x2c')]));if(_0x1eeb53['query'][_0x2bff('0x38')]){_0x488731[_0x2bff('0x35')]=_[_0x2bff('0x37')](_0x488731['where'],{'$or':_['map'](_0x488731['attributes'],function(_0x2d70d4){var _0x87bc45={};_0x87bc45[_0x2d70d4]={'$like':'%'+_0x1eeb53['query'][_0x2bff('0x38')]+'%'};return _0x87bc45;})});}_0x488731=_[_0x2bff('0x37')]({},_0x488731,_0x1eeb53[_0x2bff('0x3a')]);return _0x2ec0b4[_0x2bff('0x7c')](_0x488731);}})[_0x2bff('0x1f')](function(_0x40e86f){if(_0x40e86f){_0x501237=_0x40e86f[_0x2bff('0x30')];if(!_0x1eeb53[_0x2bff('0x29')][_0x2bff('0x31')]('nolimit')){_0x488731[_0x2bff('0x33')]=qs[_0x2bff('0x33')](_0x1eeb53[_0x2bff('0x29')][_0x2bff('0x33')]);_0x488731[_0x2bff('0x19')]=qs[_0x2bff('0x19')](_0x1eeb53[_0x2bff('0x29')][_0x2bff('0x19')]);}return _0x2ec0b4[_0x2bff('0x7c')](_0x488731);}})[_0x2bff('0x1f')](function(_0x26f3a6){if(_0x26f3a6){return _0x26f3a6?{'count':_0x501237,'rows':_0x26f3a6}:null;}})[_0x2bff('0x1f')](respondWithResult(_0x458983,null))[_0x2bff('0x3f')](handleError(_0x458983,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b2c3663..d09239c 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 _0xae4d=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1d4eae,_0x4d730b){var _0x475403=function(_0xc91788){while(--_0xc91788){_0x1d4eae['push'](_0x1d4eae['shift']());}};_0x475403(++_0x4d730b);}(_0xae4d,0x65));var _0xdae4=function(_0x2acf9e,_0x33d1a2){_0x2acf9e=_0x2acf9e-0x0;var _0x4c3c04=_0xae4d[_0x2acf9e];return _0x4c3c04;};'use strict';var EventEmitter=require(_0xdae4('0x0'));var CmList=require(_0xdae4('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xdae4('0x2')](0x0);var events={'afterCreate':_0xdae4('0x3'),'afterUpdate':_0xdae4('0x4'),'afterDestroy':_0xdae4('0x5')};function emitEvent(_0x2100d3){return function(_0x5cdb5f,_0x54affd,_0x32a26b){CmListEvents[_0xdae4('0x6')](_0x2100d3+':'+_0x5cdb5f['id'],_0x5cdb5f);CmListEvents[_0xdae4('0x6')](_0x2100d3,_0x5cdb5f);_0x32a26b(null);};}for(var e in events){if(events[_0xdae4('0x7')](e)){var event=events[e];CmList[_0xdae4('0x8')](e,emitEvent(event));}}module[_0xdae4('0x9')]=CmListEvents; \ No newline at end of file +var _0xf73a=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','CmList','save'];(function(_0x37862a,_0x2bc98e){var _0x5b0104=function(_0x391413){while(--_0x391413){_0x37862a['push'](_0x37862a['shift']());}};_0x5b0104(++_0x2bc98e);}(_0xf73a,0x8c));var _0xaf73=function(_0x4c5ad8,_0x19184d){_0x4c5ad8=_0x4c5ad8-0x0;var _0x339d50=_0xf73a[_0x4c5ad8];return _0x339d50;};'use strict';var EventEmitter=require(_0xaf73('0x0'));var CmList=require(_0xaf73('0x1'))['db'][_0xaf73('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf73('0x3'),'afterUpdate':_0xaf73('0x4'),'afterDestroy':_0xaf73('0x5')};function emitEvent(_0x4f3bfd){return function(_0x234eb8,_0x2e509c,_0x3b3556){CmListEvents['emit'](_0x4f3bfd+':'+_0x234eb8['id'],_0x234eb8);CmListEvents[_0xaf73('0x6')](_0x4f3bfd,_0x234eb8);_0x3b3556(null);};}for(var e in events){if(events[_0xaf73('0x7')](e)){var event=events[e];CmList[_0xaf73('0x8')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index d5fbb5b..8b9e88f 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 _0xd8e8=['moment','bluebird','request-promise','./cmList.attributes','exports','define','CmList','cm_lists','util','api'];(function(_0xad5cc4,_0x215162){var _0x30ff06=function(_0x22f220){while(--_0x22f220){_0xad5cc4['push'](_0xad5cc4['shift']());}};_0x30ff06(++_0x215162);}(_0xd8e8,0x6c));var _0x8d8e=function(_0x2d602b,_0x157479){_0x2d602b=_0x2d602b-0x0;var _0x2e503b=_0xd8e8[_0x2d602b];return _0x2e503b;};'use strict';var _=require('lodash');var util=require(_0x8d8e('0x0'));var logger=require('../../config/logger')(_0x8d8e('0x1'));var moment=require(_0x8d8e('0x2'));var BPromise=require(_0x8d8e('0x3'));var rp=require(_0x8d8e('0x4'));var attributes=require(_0x8d8e('0x5'));module[_0x8d8e('0x6')]=function(_0x1b81df,_0x208a94){return _0x1b81df[_0x8d8e('0x7')](_0x8d8e('0x8'),attributes,{'tableName':_0x8d8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaef3=['define','lodash','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x2e6ab8,_0x4ea85c){var _0x16cba0=function(_0x4b3776){while(--_0x4b3776){_0x2e6ab8['push'](_0x2e6ab8['shift']());}};_0x16cba0(++_0x4ea85c);}(_0xaef3,0x89));var _0x3aef=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xaef3[_0x163742];return _0x1152ac;};'use strict';var _=require(_0x3aef('0x0'));var util=require('util');var logger=require(_0x3aef('0x1'))(_0x3aef('0x2'));var moment=require(_0x3aef('0x3'));var BPromise=require(_0x3aef('0x4'));var rp=require(_0x3aef('0x5'));var attributes=require('./cmList.attributes');module[_0x3aef('0x6')]=function(_0x273f97,_0x62328d){return _0x273f97[_0x3aef('0x7')]('CmList',attributes,{'tableName':'cm_lists','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 128eb3d..fbd519a 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 _0x77d6=['stringify','error','message','request\x20sent','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','./cmList.socket','request','info','CmList,\x20%s,\x20%s','debug'];(function(_0x24fd2f,_0x3e82b5){var _0x58e378=function(_0x890e82){while(--_0x890e82){_0x24fd2f['push'](_0x24fd2f['shift']());}};_0x58e378(++_0x3e82b5);}(_0x77d6,0x17f));var _0x677d=function(_0x49c640,_0x548ccf){_0x49c640=_0x49c640-0x0;var _0xb21b73=_0x77d6[_0x49c640];return _0xb21b73;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x677d('0x0'));var BPromise=require(_0x677d('0x1'));var rs=require(_0x677d('0x2'));var fs=require('fs');var db=require(_0x677d('0x3'))['db'];var utils=require(_0x677d('0x4'));var logger=require(_0x677d('0x5'))('rpc');var config=require(_0x677d('0x6'));var jayson=require(_0x677d('0x7'));var client=jayson[_0x677d('0x8')][_0x677d('0x9')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x677d('0xa'),'port':0x18eb});require(_0x677d('0xb'))['register'](socket);function respondWithRpcPromise(_0x11bdf3,_0x1d73d9,_0x3cb919){return new BPromise(function(_0x2c311c,_0x5b42b5){return client[_0x677d('0xc')](_0x11bdf3,_0x3cb919)['then'](function(_0x331638){logger[_0x677d('0xd')](_0x677d('0xe'),_0x1d73d9,'request\x20sent');logger[_0x677d('0xf')]('CmList,\x20%s,\x20%s,\x20%s',_0x1d73d9,'request\x20sent',JSON[_0x677d('0x10')](_0x331638));if(_0x331638[_0x677d('0x11')]){if(_0x331638[_0x677d('0x11')]['code']===0x1f4){logger[_0x677d('0x11')](_0x677d('0xe'),_0x1d73d9,_0x331638[_0x677d('0x11')]['message']);return _0x5b42b5(_0x331638['error'][_0x677d('0x12')]);}logger['error']('CmList,\x20%s,\x20%s',_0x1d73d9,_0x331638[_0x677d('0x11')][_0x677d('0x12')]);return _0x2c311c(_0x331638[_0x677d('0x11')][_0x677d('0x12')]);}else{logger['info'](_0x677d('0xe'),_0x1d73d9,_0x677d('0x13'));_0x2c311c(_0x331638[_0x677d('0x14')][_0x677d('0x12')]);}})['catch'](function(_0x13e70f){logger[_0x677d('0x11')](_0x677d('0xe'),_0x1d73d9,_0x13e70f);_0x5b42b5(_0x13e70f);});});} \ No newline at end of file +var _0x6d6c=['then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','localhost','./cmList.socket','register','request'];(function(_0x4717b8,_0x331c49){var _0x42a536=function(_0x580b33){while(--_0x580b33){_0x4717b8['push'](_0x4717b8['shift']());}};_0x42a536(++_0x331c49);}(_0x6d6c,0xe3));var _0xc6d6=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0x6d6c[_0x318dda];return _0x3f97ca;};'use strict';var _=require(_0xc6d6('0x0'));var util=require('util');var moment=require(_0xc6d6('0x1'));var BPromise=require(_0xc6d6('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xc6d6('0x3'))['db'];var utils=require(_0xc6d6('0x4'));var logger=require(_0xc6d6('0x5'))(_0xc6d6('0x6'));var config=require(_0xc6d6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc6d6('0x8')]['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xc6d6('0x9'),'port':0x18eb});require(_0xc6d6('0xa'))[_0xc6d6('0xb')](socket);function respondWithRpcPromise(_0x49eb2e,_0x1e9eb2,_0x4afc6e){return new BPromise(function(_0x371426,_0x1741a0){return client[_0xc6d6('0xc')](_0x49eb2e,_0x4afc6e)[_0xc6d6('0xd')](function(_0x534784){logger[_0xc6d6('0xe')](_0xc6d6('0xf'),_0x1e9eb2,_0xc6d6('0x10'));logger[_0xc6d6('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x1e9eb2,'request\x20sent',JSON[_0xc6d6('0x12')](_0x534784));if(_0x534784['error']){if(_0x534784[_0xc6d6('0x13')][_0xc6d6('0x14')]===0x1f4){logger[_0xc6d6('0x13')]('CmList,\x20%s,\x20%s',_0x1e9eb2,_0x534784[_0xc6d6('0x13')][_0xc6d6('0x15')]);return _0x1741a0(_0x534784['error'][_0xc6d6('0x15')]);}logger[_0xc6d6('0x13')](_0xc6d6('0xf'),_0x1e9eb2,_0x534784[_0xc6d6('0x13')][_0xc6d6('0x15')]);return _0x371426(_0x534784[_0xc6d6('0x13')]['message']);}else{logger['info'](_0xc6d6('0xf'),_0x1e9eb2,'request\x20sent');_0x371426(_0x534784[_0xc6d6('0x16')]['message']);}})[_0xc6d6('0x17')](function(_0x4ba55a){logger[_0xc6d6('0x13')](_0xc6d6('0xf'),_0x1e9eb2,_0x4ba55a);_0x1741a0(_0x4ba55a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4e5d306..4cd888b 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 _0x4278=['remove','update','removeListener','length','cmList:','./cmList.events','save'];(function(_0x139922,_0x483bcb){var _0x3b7166=function(_0x15c952){while(--_0x15c952){_0x139922['push'](_0x139922['shift']());}};_0x3b7166(++_0x483bcb);}(_0x4278,0xe5));var _0x8427=function(_0x653338,_0x389ffd){_0x653338=_0x653338-0x0;var _0x48671b=_0x4278[_0x653338];return _0x48671b;};'use strict';var CmListEvents=require(_0x8427('0x0'));var events=[_0x8427('0x1'),_0x8427('0x2'),_0x8427('0x3')];function createListener(_0x31fb95,_0x129e45){return function(_0x22a6ac){_0x129e45['emit'](_0x31fb95,_0x22a6ac);};}function removeListener(_0x1d27e6,_0x2c6c15){return function(){CmListEvents[_0x8427('0x4')](_0x1d27e6,_0x2c6c15);};}exports['register']=function(_0x5c71e0){for(var _0x503cc7=0x0,_0x31fe10=events[_0x8427('0x5')];_0x503cc7<_0x31fe10;_0x503cc7++){var _0x211a1=events[_0x503cc7];var _0x1c5c88=createListener(_0x8427('0x6')+_0x211a1,_0x5c71e0);CmListEvents['on'](_0x211a1,_0x1c5c88);}}; \ No newline at end of file +var _0x5916=['save','remove','removeListener','register','length','cmList:'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0x5916,0x1ce));var _0x6591=function(_0x4d8725,_0x1bb49c){_0x4d8725=_0x4d8725-0x0;var _0x4dc450=_0x5916[_0x4d8725];return _0x4dc450;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x6591('0x0'),_0x6591('0x1'),'update'];function createListener(_0x71a78f,_0x3477a5){return function(_0x226d70){_0x3477a5['emit'](_0x71a78f,_0x226d70);};}function removeListener(_0x1b3e6b,_0x6981aa){return function(){CmListEvents[_0x6591('0x2')](_0x1b3e6b,_0x6981aa);};}exports[_0x6591('0x3')]=function(_0x203559){for(var _0x5ada09=0x0,_0x943ae8=events[_0x6591('0x4')];_0x5ada09<_0x943ae8;_0x5ada09++){var _0x5dead1=events[_0x5ada09];var _0x2e4c3c=createListener(_0x6591('0x5')+_0x5dead1,_0x203559);CmListEvents['on'](_0x5dead1,_0x2e4c3c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d403f80..552fe1a 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 _0x6c99=['delete','removeDispositions','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addCustomField','addAgents','put','update'];(function(_0x1b4ed4,_0x1e1527){var _0x494ff4=function(_0x4afc18){while(--_0x4afc18){_0x1b4ed4['push'](_0x1b4ed4['shift']());}};_0x494ff4(++_0x1e1527);}(_0x6c99,0x1e3));var _0x96c9=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x6c99[_0x549278];return _0x1ea9a1;};'use strict';var multer=require(_0x96c9('0x0'));var util=require(_0x96c9('0x1'));var path=require(_0x96c9('0x2'));var express=require(_0x96c9('0x3'));var router=express[_0x96c9('0x4')]();var auth=require(_0x96c9('0x5'));var interaction=require(_0x96c9('0x6'));var config=require(_0x96c9('0x7'));var controller=require('./cmList.controller');router['get']('/',auth[_0x96c9('0x8')](),controller[_0x96c9('0x9')]);router[_0x96c9('0xa')](_0x96c9('0xb'),auth['isAuthenticated'](),controller[_0x96c9('0xc')]);router[_0x96c9('0xa')](_0x96c9('0xd'),auth[_0x96c9('0x8')](),controller[_0x96c9('0xe')]);router['get']('/:id/dispositions',auth[_0x96c9('0x8')](),controller[_0x96c9('0xf')]);router[_0x96c9('0xa')](_0x96c9('0x10'),auth[_0x96c9('0x8')](),controller[_0x96c9('0x11')]);router[_0x96c9('0xa')](_0x96c9('0x12'),auth[_0x96c9('0x8')](),controller['getContactsCsv']);router[_0x96c9('0xa')](_0x96c9('0x13'),auth[_0x96c9('0x8')](),controller['getCustomFields']);router[_0x96c9('0xa')](_0x96c9('0x14'),auth['isAuthenticated'](),controller[_0x96c9('0x15')]);router['post']('/',auth[_0x96c9('0x8')](),controller['create']);router['post'](_0x96c9('0x16'),auth[_0x96c9('0x8')](),controller[_0x96c9('0x17')]);router[_0x96c9('0x18')](_0x96c9('0x10'),auth[_0x96c9('0x8')](),controller['addContacts']);router[_0x96c9('0x18')](_0x96c9('0x13'),auth['isAuthenticated'](),controller[_0x96c9('0x19')]);router[_0x96c9('0x18')](_0x96c9('0x14'),auth[_0x96c9('0x8')](),controller[_0x96c9('0x1a')]);router[_0x96c9('0x1b')]('/:id',auth[_0x96c9('0x8')](),controller[_0x96c9('0x1c')]);router[_0x96c9('0x1d')](_0x96c9('0xd'),auth[_0x96c9('0x8')](),controller['destroy']);router['delete'](_0x96c9('0x16'),auth['isAuthenticated'](),controller[_0x96c9('0x1e')]);router[_0x96c9('0x1d')]('/:id/users',auth[_0x96c9('0x8')](),controller['removeAgents']);module[_0x96c9('0x1f')]=router; \ No newline at end of file +var _0x01ae=['describe','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','/:id','delete','destroy','removeDispositions','removeAgents','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','get','/describe'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x01ae,0xf5));var _0xe01a=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x01ae[_0x55821d];return _0x58ea8a;};'use strict';var multer=require(_0xe01a('0x0'));var util=require('util');var path=require(_0xe01a('0x1'));var express=require(_0xe01a('0x2'));var router=express[_0xe01a('0x3')]();var auth=require(_0xe01a('0x4'));var interaction=require(_0xe01a('0x5'));var config=require(_0xe01a('0x6'));var controller=require(_0xe01a('0x7'));router['get']('/',auth[_0xe01a('0x8')](),controller['index']);router[_0xe01a('0x9')](_0xe01a('0xa'),auth[_0xe01a('0x8')](),controller[_0xe01a('0xb')]);router[_0xe01a('0x9')]('/:id',auth[_0xe01a('0x8')](),controller['show']);router[_0xe01a('0x9')](_0xe01a('0xc'),auth[_0xe01a('0x8')](),controller[_0xe01a('0xd')]);router[_0xe01a('0x9')](_0xe01a('0xe'),auth[_0xe01a('0x8')](),controller[_0xe01a('0xf')]);router['get'](_0xe01a('0x10'),auth[_0xe01a('0x8')](),controller['getContactsCsv']);router[_0xe01a('0x9')]('/:id/fields',auth[_0xe01a('0x8')](),controller[_0xe01a('0x11')]);router[_0xe01a('0x9')](_0xe01a('0x12'),auth[_0xe01a('0x8')](),controller[_0xe01a('0x13')]);router[_0xe01a('0x14')]('/',auth[_0xe01a('0x8')](),controller['create']);router[_0xe01a('0x14')](_0xe01a('0xc'),auth['isAuthenticated'](),controller[_0xe01a('0x15')]);router[_0xe01a('0x14')](_0xe01a('0xe'),auth['isAuthenticated'](),controller[_0xe01a('0x16')]);router[_0xe01a('0x14')](_0xe01a('0x17'),auth['isAuthenticated'](),controller[_0xe01a('0x18')]);router[_0xe01a('0x14')](_0xe01a('0x12'),auth[_0xe01a('0x8')](),controller[_0xe01a('0x19')]);router[_0xe01a('0x1a')](_0xe01a('0x1b'),auth['isAuthenticated'](),controller['update']);router[_0xe01a('0x1c')](_0xe01a('0x1b'),auth[_0xe01a('0x8')](),controller[_0xe01a('0x1d')]);router[_0xe01a('0x1c')](_0xe01a('0xc'),auth[_0xe01a('0x8')](),controller[_0xe01a('0x1e')]);router[_0xe01a('0x1c')](_0xe01a('0x12'),auth[_0xe01a('0x8')](),controller[_0xe01a('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 5061987..a6e6f71 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 _0xeebb=['STRING','sequelize','getDataValue','field'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xeebb,0x111));var _0xbeeb=function(_0x13d62a,_0x410f80){_0x13d62a=_0x13d62a-0x0;var _0x8c7185=_0xeebb[_0x13d62a];return _0x8c7185;};'use strict';var Sequelize=require(_0xbeeb('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x558ce9){return this[_0xbeeb('0x1')](_0xbeeb('0x2'));}},'field':{'type':Sequelize[_0xbeeb('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xbeeb('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xbeeb('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xde02=['VIRTUAL','field','STRING','sequelize','exports'];(function(_0xe1dfd8,_0xa67b9d){var _0x5af3db=function(_0x112833){while(--_0x112833){_0xe1dfd8['push'](_0xe1dfd8['shift']());}};_0x5af3db(++_0xa67b9d);}(_0xde02,0xd5));var _0x2de0=function(_0x13a7eb,_0xa0e4c9){_0x13a7eb=_0x13a7eb-0x0;var _0x35ef26=_0xde02[_0x13a7eb];return _0x35ef26;};'use strict';var Sequelize=require(_0x2de0('0x0'));module[_0x2de0('0x1')]={'name':{'type':Sequelize[_0x2de0('0x2')],'get':function(_0x58d278){return this['getDataValue'](_0x2de0('0x3'));}},'field':{'type':Sequelize[_0x2de0('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x2de0('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 85a0405..ce4243f 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 _0x34e8=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','stack','name','send','body','find','catch','destroy','params','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x308a02,_0x4a27f3){var _0xd7a34c=function(_0x72cd76){while(--_0x72cd76){_0x308a02['push'](_0x308a02['shift']());}};_0xd7a34c(++_0x4a27f3);}(_0x34e8,0x12c));var _0x834e=function(_0x3c075c,_0x2fbda7){_0x3c075c=_0x3c075c-0x0;var _0x5e05be=_0x34e8[_0x3c075c];return _0x5e05be;};'use strict';var jsonpatch=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var Mustache=require('mustache');var util=require(_0x834e('0x4'));var path=require(_0x834e('0x5'));var sox=require(_0x834e('0x6'));var csv=require(_0x834e('0x7'));var ejs=require(_0x834e('0x8'));var fs=require('fs');var _=require(_0x834e('0x9'));var squel=require(_0x834e('0xa'));var crypto=require('crypto');var jsforce=require(_0x834e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x834e('0x7'));var querystring=require(_0x834e('0xc'));var Papa=require(_0x834e('0xd'));var qs=require(_0x834e('0xe'));var logger=require(_0x834e('0xf'))(_0x834e('0x10'));var utils=require(_0x834e('0x11'));var config=require(_0x834e('0x12'));var db=require(_0x834e('0x13'))['db'];function respondWithStatusCode(_0x186b3b,_0x1e41fe){_0x1e41fe=_0x1e41fe||0xcc;return function(_0x36e124){if(_0x36e124){return _0x186b3b[_0x834e('0x14')](_0x1e41fe);}return _0x186b3b[_0x834e('0x15')](_0x1e41fe)[_0x834e('0x16')]();};}function respondWithResult(_0x1e00de,_0x2fd95c){_0x2fd95c=_0x2fd95c||0xc8;return function(_0x538bb3){if(_0x538bb3){return _0x1e00de[_0x834e('0x15')](_0x2fd95c)[_0x834e('0x17')](_0x538bb3);}};}function respondWithFilteredResult(_0x58a27e,_0x23848e){return function(_0x2d95f2){if(_0x2d95f2){var _0x28e659=_0x2d95f2[_0x834e('0x18')],_0x21cc0a=_0x23848e['offset'],_0x50e860=_0x23848e[_0x834e('0x19')]+_0x23848e['limit'],_0x43156c;if(_0x50e860>=_0x28e659){_0x50e860=_0x28e659;_0x43156c=0xc8;}else{_0x43156c=0xce;}_0x58a27e[_0x834e('0x15')](_0x43156c);return _0x58a27e[_0x834e('0x1a')]('Content-Range',_0x21cc0a+'-'+_0x50e860+'/'+_0x28e659)[_0x834e('0x17')](_0x2d95f2);}return null;};}function patchUpdates(_0x22106e){return function(_0x370fb5){try{jsonpatch['apply'](_0x370fb5,_0x22106e,!![]);}catch(_0x283e56){return BPromise[_0x834e('0x1b')](_0x283e56);}return _0x370fb5[_0x834e('0x1c')]();};}function saveUpdates(_0xb993a1,_0x237947){return function(_0x254677){if(_0x254677){return _0x254677[_0x834e('0x1d')](_0xb993a1)['then'](function(_0x2545b4){return _0x2545b4;});}return null;};}function removeEntity(_0x1fd2c6,_0x113ff4){return function(_0x325a99){if(_0x325a99){return _0x325a99['destroy']()[_0x834e('0x1e')](function(){_0x1fd2c6[_0x834e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b4bdf,_0x28d687){return function(_0x8d406e){if(!_0x8d406e){_0x1b4bdf['sendStatus'](0x194);}return _0x8d406e;};}function handleError(_0x4e3f48,_0x231619){_0x231619=_0x231619||0x1f4;return function(_0x34563b){logger['error'](_0x34563b[_0x834e('0x1f')]);if(_0x34563b[_0x834e('0x20')]){delete _0x34563b['name'];}_0x4e3f48[_0x834e('0x15')](_0x231619)[_0x834e('0x21')](_0x34563b);};}exports[_0x834e('0x1d')]=function(_0x561cd2,_0x24fcf7){if(_0x561cd2[_0x834e('0x22')]['id']){delete _0x561cd2['body']['id'];}return db['Condition'][_0x834e('0x23')]({'where':{'id':_0x561cd2['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x24fcf7,null))[_0x834e('0x1e')](saveUpdates(_0x561cd2[_0x834e('0x22')],null))[_0x834e('0x1e')](respondWithResult(_0x24fcf7,null))[_0x834e('0x24')](handleError(_0x24fcf7,null));};exports[_0x834e('0x25')]=function(_0x491919,_0x510780){return db['Condition']['find']({'where':{'id':_0x491919[_0x834e('0x26')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x510780,null))[_0x834e('0x1e')](removeEntity(_0x510780,null))['catch'](handleError(_0x510780,null));}; \ No newline at end of file +var _0x70e0=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','find','params','catch','destroy','Condition','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','querystring','papaparse'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x70e0,0x17b));var _0x070e=function(_0xe9fc59,_0x1a0ed3){_0xe9fc59=_0xe9fc59-0x0;var _0x544874=_0x70e0[_0xe9fc59];return _0x544874;};'use strict';var jsonpatch=require(_0x070e('0x0'));var rp=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x070e('0x3'));var path=require(_0x070e('0x4'));var sox=require(_0x070e('0x5'));var csv=require(_0x070e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x070e('0x7'));var squel=require('squel');var crypto=require(_0x070e('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x070e('0x9'));var Papa=require(_0x070e('0xa'));var qs=require(_0x070e('0xb'));var logger=require(_0x070e('0xc'))(_0x070e('0xd'));var utils=require(_0x070e('0xe'));var config=require(_0x070e('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49b2fb,_0x50f4eb){_0x50f4eb=_0x50f4eb||0xcc;return function(_0x2e3e5e){if(_0x2e3e5e){return _0x49b2fb[_0x070e('0x10')](_0x50f4eb);}return _0x49b2fb[_0x070e('0x11')](_0x50f4eb)[_0x070e('0x12')]();};}function respondWithResult(_0xffcdd6,_0x25cfe1){_0x25cfe1=_0x25cfe1||0xc8;return function(_0x1baa12){if(_0x1baa12){return _0xffcdd6[_0x070e('0x11')](_0x25cfe1)[_0x070e('0x13')](_0x1baa12);}};}function respondWithFilteredResult(_0x2930b8,_0x52da3b){return function(_0x5dca0f){if(_0x5dca0f){var _0x24baba=_0x5dca0f[_0x070e('0x14')],_0x56c7ba=_0x52da3b[_0x070e('0x15')],_0x4a33d2=_0x52da3b['offset']+_0x52da3b['limit'],_0x5bae0f;if(_0x4a33d2>=_0x24baba){_0x4a33d2=_0x24baba;_0x5bae0f=0xc8;}else{_0x5bae0f=0xce;}_0x2930b8[_0x070e('0x11')](_0x5bae0f);return _0x2930b8[_0x070e('0x16')](_0x070e('0x17'),_0x56c7ba+'-'+_0x4a33d2+'/'+_0x24baba)[_0x070e('0x13')](_0x5dca0f);}return null;};}function patchUpdates(_0x5bc71e){return function(_0x49861b){try{jsonpatch[_0x070e('0x18')](_0x49861b,_0x5bc71e,!![]);}catch(_0x2bd937){return BPromise[_0x070e('0x19')](_0x2bd937);}return _0x49861b[_0x070e('0x1a')]();};}function saveUpdates(_0x364b3f,_0x5037eb){return function(_0x3938b5){if(_0x3938b5){return _0x3938b5[_0x070e('0x1b')](_0x364b3f)[_0x070e('0x1c')](function(_0x3ea105){return _0x3ea105;});}return null;};}function removeEntity(_0x259893,_0x5c16fd){return function(_0x5b2f48){if(_0x5b2f48){return _0x5b2f48['destroy']()[_0x070e('0x1c')](function(){_0x259893[_0x070e('0x11')](0xcc)[_0x070e('0x12')]();});}};}function handleEntityNotFound(_0x4be0d7,_0x5b184){return function(_0x5dc5d2){if(!_0x5dc5d2){_0x4be0d7[_0x070e('0x10')](0x194);}return _0x5dc5d2;};}function handleError(_0x3f6985,_0x27a01e){_0x27a01e=_0x27a01e||0x1f4;return function(_0x33e8c6){logger[_0x070e('0x1d')](_0x33e8c6[_0x070e('0x1e')]);if(_0x33e8c6[_0x070e('0x1f')]){delete _0x33e8c6[_0x070e('0x1f')];}_0x3f6985['status'](_0x27a01e)[_0x070e('0x20')](_0x33e8c6);};}exports[_0x070e('0x1b')]=function(_0x4790eb,_0x503f4d){if(_0x4790eb[_0x070e('0x21')]['id']){delete _0x4790eb['body']['id'];}return db['Condition'][_0x070e('0x22')]({'where':{'id':_0x4790eb[_0x070e('0x23')]['id']}})[_0x070e('0x1c')](handleEntityNotFound(_0x503f4d,null))[_0x070e('0x1c')](saveUpdates(_0x4790eb[_0x070e('0x21')],null))['then'](respondWithResult(_0x503f4d,null))[_0x070e('0x24')](handleError(_0x503f4d,null));};exports[_0x070e('0x25')]=function(_0x1d72d6,_0x1d2a34){return db[_0x070e('0x26')][_0x070e('0x22')]({'where':{'id':_0x1d72d6[_0x070e('0x23')]['id']}})[_0x070e('0x1c')](handleEntityNotFound(_0x1d2a34,null))['then'](removeEntity(_0x1d2a34,null))[_0x070e('0x24')](handleError(_0x1d2a34,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 29fcd74..d9ea320 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 _0x4add=['api','moment','bluebird','request-promise','exports','define','Condition','tools_conditions','util'];(function(_0x440644,_0x4d3b6b){var _0x5d4ff9=function(_0x11ae0e){while(--_0x11ae0e){_0x440644['push'](_0x440644['shift']());}};_0x5d4ff9(++_0x4d3b6b);}(_0x4add,0xfb));var _0xd4ad=function(_0x4cdaf0,_0x290a1b){_0x4cdaf0=_0x4cdaf0-0x0;var _0x3fce42=_0x4add[_0x4cdaf0];return _0x3fce42;};'use strict';var _=require('lodash');var util=require(_0xd4ad('0x0'));var logger=require('../../config/logger')(_0xd4ad('0x1'));var moment=require(_0xd4ad('0x2'));var BPromise=require(_0xd4ad('0x3'));var rp=require(_0xd4ad('0x4'));var attributes=require('./condition.attributes');module[_0xd4ad('0x5')]=function(_0x2f9a39,_0x282ab6){return _0x2f9a39[_0xd4ad('0x6')](_0xd4ad('0x7'),attributes,{'tableName':_0xd4ad('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00fc=['exports','Condition','lodash','util','../../config/logger','api','./condition.attributes'];(function(_0x3be0ca,_0x3813b9){var _0x125efa=function(_0x26d10c){while(--_0x26d10c){_0x3be0ca['push'](_0x3be0ca['shift']());}};_0x125efa(++_0x3813b9);}(_0x00fc,0x160));var _0xc00f=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x00fc[_0x365be9];return _0x185c12;};'use strict';var _=require(_0xc00f('0x0'));var util=require(_0xc00f('0x1'));var logger=require(_0xc00f('0x2'))(_0xc00f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xc00f('0x4'));module[_0xc00f('0x5')]=function(_0x4a517a,_0x1ed36e){return _0x4a517a['define'](_0xc00f('0x6'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 3f09d84..1d5cdd9 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 _0x271d=['request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x16aa2c,_0x310432){var _0x5d0cf9=function(_0x4d86d6){while(--_0x4d86d6){_0x16aa2c['push'](_0x16aa2c['shift']());}};_0x5d0cf9(++_0x310432);}(_0x271d,0xc4));var _0xd271=function(_0x2a7321,_0x11f950){_0x2a7321=_0x2a7321-0x0;var _0x27d2ef=_0x271d[_0x2a7321];return _0x27d2ef;};'use strict';var _=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var moment=require('moment');var BPromise=require(_0xd271('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xd271('0x3'))['db'];var utils=require(_0xd271('0x4'));var logger=require(_0xd271('0x5'))(_0xd271('0x6'));var config=require(_0xd271('0x7'));var jayson=require(_0xd271('0x8'));var client=jayson[_0xd271('0x9')][_0xd271('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdcd18c,_0x9a32d7,_0x2d40ff){return new BPromise(function(_0x1820c0,_0x5bdca5){return client[_0xd271('0xb')](_0xdcd18c,_0x2d40ff)[_0xd271('0xc')](function(_0x263dbb){logger[_0xd271('0xd')](_0xd271('0xe'),_0x9a32d7,'request\x20sent');logger[_0xd271('0xf')](_0xd271('0x10'),_0x9a32d7,_0xd271('0x11'),JSON['stringify'](_0x263dbb));if(_0x263dbb[_0xd271('0x12')]){if(_0x263dbb[_0xd271('0x12')][_0xd271('0x13')]===0x1f4){logger['error'](_0xd271('0xe'),_0x9a32d7,_0x263dbb[_0xd271('0x12')][_0xd271('0x14')]);return _0x5bdca5(_0x263dbb[_0xd271('0x12')][_0xd271('0x14')]);}logger[_0xd271('0x12')](_0xd271('0xe'),_0x9a32d7,_0x263dbb['error'][_0xd271('0x14')]);return _0x1820c0(_0x263dbb['error'][_0xd271('0x14')]);}else{logger[_0xd271('0xd')](_0xd271('0xe'),_0x9a32d7,_0xd271('0x11'));_0x1820c0(_0x263dbb[_0xd271('0x15')][_0xd271('0x14')]);}})[_0xd271('0x16')](function(_0x52a219){logger['error'](_0xd271('0xe'),_0x9a32d7,_0x52a219);_0x5bdca5(_0x52a219);});});} \ No newline at end of file +var _0xc1b7=['rpc','jayson/promise','client','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','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xc1b7,0x68));var _0x7c1b=function(_0x1c443f,_0x51319d){_0x1c443f=_0x1c443f-0x0;var _0x4a4a71=_0xc1b7[_0x1c443f];return _0x4a4a71;};'use strict';var _=require(_0x7c1b('0x0'));var util=require(_0x7c1b('0x1'));var moment=require(_0x7c1b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x7c1b('0x3'))['db'];var utils=require(_0x7c1b('0x4'));var logger=require(_0x7c1b('0x5'))(_0x7c1b('0x6'));var config=require('../../config/environment');var jayson=require(_0x7c1b('0x7'));var client=jayson[_0x7c1b('0x8')][_0x7c1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a1299,_0xe6a2e2,_0xa13f3b){return new BPromise(function(_0x169c1e,_0x408e1a){return client[_0x7c1b('0xa')](_0x1a1299,_0xa13f3b)[_0x7c1b('0xb')](function(_0x5a6d85){logger[_0x7c1b('0xc')](_0x7c1b('0xd'),_0xe6a2e2,_0x7c1b('0xe'));logger[_0x7c1b('0xf')](_0x7c1b('0x10'),_0xe6a2e2,_0x7c1b('0xe'),JSON[_0x7c1b('0x11')](_0x5a6d85));if(_0x5a6d85[_0x7c1b('0x12')]){if(_0x5a6d85[_0x7c1b('0x12')][_0x7c1b('0x13')]===0x1f4){logger[_0x7c1b('0x12')](_0x7c1b('0xd'),_0xe6a2e2,_0x5a6d85[_0x7c1b('0x12')][_0x7c1b('0x14')]);return _0x408e1a(_0x5a6d85[_0x7c1b('0x12')]['message']);}logger[_0x7c1b('0x12')]('Condition,\x20%s,\x20%s',_0xe6a2e2,_0x5a6d85['error']['message']);return _0x169c1e(_0x5a6d85[_0x7c1b('0x12')][_0x7c1b('0x14')]);}else{logger[_0x7c1b('0xc')](_0x7c1b('0xd'),_0xe6a2e2,_0x7c1b('0xe'));_0x169c1e(_0x5a6d85['result'][_0x7c1b('0x14')]);}})[_0x7c1b('0x15')](function(_0x599444){logger['error'](_0x7c1b('0xd'),_0xe6a2e2,_0x599444);_0x408e1a(_0x599444);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 99a274f..6e42fda 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 _0x66c8=['multer','util','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','/:id','update','delete','isAuthenticated','destroy'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0x66c8,0xcc));var _0x866c=function(_0x43e0f5,_0x228352){_0x43e0f5=_0x43e0f5-0x0;var _0x2a6001=_0x66c8[_0x43e0f5];return _0x2a6001;};'use strict';var multer=require(_0x866c('0x0'));var util=require(_0x866c('0x1'));var path=require('path');var express=require(_0x866c('0x2'));var router=express[_0x866c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x866c('0x4'));var config=require(_0x866c('0x5'));var controller=require(_0x866c('0x6'));router['put'](_0x866c('0x7'),auth['isAuthenticated'](),controller[_0x866c('0x8')]);router[_0x866c('0x9')](_0x866c('0x7'),auth[_0x866c('0xa')](),controller[_0x866c('0xb')]);module['exports']=router; \ No newline at end of file +var _0x014a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','Router'];(function(_0x44f304,_0x33f99d){var _0x2f7aca=function(_0x58c73e){while(--_0x58c73e){_0x44f304['push'](_0x44f304['shift']());}};_0x2f7aca(++_0x33f99d);}(_0x014a,0x114));var _0xa014=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x014a[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0xa014('0x0'));var util=require(_0xa014('0x1'));var path=require(_0xa014('0x2'));var express=require('express');var router=express[_0xa014('0x3')]();var auth=require(_0xa014('0x4'));var interaction=require(_0xa014('0x5'));var config=require(_0xa014('0x6'));var controller=require(_0xa014('0x7'));router[_0xa014('0x8')](_0xa014('0x9'),auth[_0xa014('0xa')](),controller[_0xa014('0xb')]);router[_0xa014('0xc')](_0xa014('0x9'),auth[_0xa014('0xa')](),controller['destroy']);module[_0xa014('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c52b7eb..9c6564f 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 _0x433d=['sequelize','STRING'];(function(_0x31dd7e,_0x72d5da){var _0x2a6bfd=function(_0x34a241){while(--_0x34a241){_0x31dd7e['push'](_0x31dd7e['shift']());}};_0x2a6bfd(++_0x72d5da);}(_0x433d,0x1a6));var _0xd433=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x433d[_0x5c1345];return _0x1c070d;};'use strict';var Sequelize=require(_0xd433('0x0'));module['exports']={'name':{'type':Sequelize[_0xd433('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xd433('0x1')]}}; \ No newline at end of file +var _0x4071=['sequelize','STRING'];(function(_0x25bda6,_0x3d8fb2){var _0xcb2607=function(_0x3f0ce6){while(--_0x3f0ce6){_0x25bda6['push'](_0x25bda6['shift']());}};_0xcb2607(++_0x3d8fb2);}(_0x4071,0x106));var _0x1407=function(_0x334091,_0x3d5229){_0x334091=_0x334091-0x0;var _0x2c2e67=_0x4071[_0x334091];return _0x2c2e67;};'use strict';var Sequelize=require(_0x1407('0x0'));module['exports']={'name':{'type':Sequelize[_0x1407('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x1407('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 2623ee7..54d4ce5 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 _0xe92e=['attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','create','findOne','DashboardItem','filter','getItems','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','map','options','Dashboard','includeAll','include','findAll','rows','show','params','find','body','catch','clone','omit','createdAt','updatedAt','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe92e,0xdb));var _0xee92=function(_0xe06603,_0x4d5d06){_0xe06603=_0xe06603-0x0;var _0x1d41e4=_0xe92e[_0xe06603];return _0x1d41e4;};'use strict';var jsonpatch=require(_0xee92('0x0'));var rp=require(_0xee92('0x1'));var moment=require(_0xee92('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee92('0x3'));var path=require('path');var sox=require(_0xee92('0x4'));var csv=require(_0xee92('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee92('0x6'));var squel=require('squel');var crypto=require(_0xee92('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xee92('0x8'));var toCsv=require(_0xee92('0x5'));var querystring=require(_0xee92('0x9'));var Papa=require(_0xee92('0xa'));var qs=require(_0xee92('0xb'));var logger=require(_0xee92('0xc'))(_0xee92('0xd'));var utils=require(_0xee92('0xe'));var config=require('../../config/environment');var db=require(_0xee92('0xf'))['db'];var socket=require(_0xee92('0x10'))({'host':_0xee92('0x11'),'port':0x18eb});require('./dashboard.socket')[_0xee92('0x12')](socket);function respondWithStatusCode(_0x1e5d84,_0x3e9c54){_0x3e9c54=_0x3e9c54||0xcc;return function(_0x29d8e2){if(_0x29d8e2){return _0x1e5d84[_0xee92('0x13')](_0x3e9c54);}return _0x1e5d84['status'](_0x3e9c54)[_0xee92('0x14')]();};}function respondWithResult(_0x21b057,_0x104047){_0x104047=_0x104047||0xc8;return function(_0x33335d){if(_0x33335d){return _0x21b057[_0xee92('0x15')](_0x104047)[_0xee92('0x16')](_0x33335d);}};}function respondWithFilteredResult(_0x1c5a64,_0x32b235){return function(_0x3e8c68){if(_0x3e8c68){var _0xad4c86=_0x3e8c68[_0xee92('0x17')],_0x188c79=_0x32b235[_0xee92('0x18')],_0x2124fd=_0x32b235['offset']+_0x32b235[_0xee92('0x19')],_0x592b9c;if(_0x2124fd>=_0xad4c86){_0x2124fd=_0xad4c86;_0x592b9c=0xc8;}else{_0x592b9c=0xce;}_0x1c5a64[_0xee92('0x15')](_0x592b9c);return _0x1c5a64['set']('Content-Range',_0x188c79+'-'+_0x2124fd+'/'+_0xad4c86)[_0xee92('0x16')](_0x3e8c68);}return null;};}function patchUpdates(_0x4fb49d){return function(_0x533b3a){try{jsonpatch[_0xee92('0x1a')](_0x533b3a,_0x4fb49d,!![]);}catch(_0x242f75){return BPromise[_0xee92('0x1b')](_0x242f75);}return _0x533b3a[_0xee92('0x1c')]();};}function saveUpdates(_0x462ceb,_0x17dad2){return function(_0x157d07){if(_0x157d07){return _0x157d07[_0xee92('0x1d')](_0x462ceb)[_0xee92('0x1e')](function(_0x10a988){return _0x10a988;});}return null;};}function removeEntity(_0x577c90,_0x4b568c){return function(_0xff1ccb){if(_0xff1ccb){return _0xff1ccb[_0xee92('0x1f')]()['then'](function(){_0x577c90[_0xee92('0x15')](0xcc)[_0xee92('0x14')]();});}};}function handleEntityNotFound(_0x18d6a5,_0x324048){return function(_0x430038){if(!_0x430038){_0x18d6a5[_0xee92('0x13')](0x194);}return _0x430038;};}function handleError(_0x47ee08,_0x5d1dc8){_0x5d1dc8=_0x5d1dc8||0x1f4;return function(_0x473708){logger[_0xee92('0x20')](_0x473708[_0xee92('0x21')]);if(_0x473708[_0xee92('0x22')]){delete _0x473708['name'];}_0x47ee08[_0xee92('0x15')](_0x5d1dc8)[_0xee92('0x23')](_0x473708);};}exports['index']=function(_0x4b42ec,_0x4152b9){var _0x347d78={},_0x4d81f5={},_0x5d238d={'count':0x0,'rows':[]};var _0x398184=db['Dashboard'][_0xee92('0x24')];_0x4d81f5[_0xee92('0x25')]=_[_0xee92('0x26')](_0x398184);var _0x2bffdc={'dateStart':_0x4b42ec[_0xee92('0x27')]['dateStart'],'dateEnd':_0x4b42ec[_0xee92('0x27')][_0xee92('0x28')]};delete _0x4b42ec['query'][_0xee92('0x29')];delete _0x4b42ec['query'][_0xee92('0x28')];_0x4d81f5['query']=_['keys'](_0x4b42ec[_0xee92('0x27')]);_0x4d81f5[_0xee92('0x2a')]=_[_0xee92('0x2b')](_0x4d81f5['model'],_0x4d81f5[_0xee92('0x27')]);_0x347d78[_0xee92('0x2c')]=_[_0xee92('0x2b')](_0x4d81f5[_0xee92('0x25')],qs[_0xee92('0x2d')](_0x4b42ec[_0xee92('0x27')]['fields']));_0x347d78[_0xee92('0x2c')]=_0x347d78[_0xee92('0x2c')][_0xee92('0x2e')]?_0x347d78[_0xee92('0x2c')]:_0x4d81f5[_0xee92('0x25')];if(!_0x4b42ec[_0xee92('0x27')][_0xee92('0x2f')](_0xee92('0x30'))){_0x347d78[_0xee92('0x19')]=qs[_0xee92('0x19')](_0x4b42ec[_0xee92('0x27')][_0xee92('0x19')]);_0x347d78[_0xee92('0x18')]=qs[_0xee92('0x18')](_0x4b42ec[_0xee92('0x27')]['offset']);}_0x347d78[_0xee92('0x31')]=qs[_0xee92('0x32')](_0x4b42ec[_0xee92('0x27')][_0xee92('0x32')]);_0x347d78[_0xee92('0x33')]=qs[_0xee92('0x2a')](_[_0xee92('0x34')](_0x4b42ec[_0xee92('0x27')],_0x4d81f5[_0xee92('0x2a')]));if(_0x2bffdc['dateStart']){if(_0x2bffdc[_0xee92('0x28')]){_0x2bffdc[_0xee92('0x28')]=moment(_0x2bffdc[_0xee92('0x28')])[_0xee92('0x35')](0x1,_0xee92('0x36'));}else{_0x2bffdc[_0xee92('0x28')]=moment(_0x2bffdc['dateStart'])[_0xee92('0x35')](0x1,'day');}_[_0xee92('0x37')](_0x347d78[_0xee92('0x33')],{'createdAt':{'$gte':_0x2bffdc['dateStart'],'$lte':_0x2bffdc[_0xee92('0x28')]}});}if(_0x4b42ec['query']['filter']){_0x347d78[_0xee92('0x33')]=_[_0xee92('0x37')](_0x347d78[_0xee92('0x33')],{'$or':_[_0xee92('0x38')](_0x347d78[_0xee92('0x2c')],function(_0x37ef12){var _0x103866={};_0x103866[_0x37ef12]={'$like':'%'+_0x4b42ec[_0xee92('0x27')]['filter']+'%'};return _0x103866;})});}_0x347d78=_[_0xee92('0x37')]({},_0x347d78,_0x4b42ec[_0xee92('0x39')]);var _0x3522da={'where':_0x347d78[_0xee92('0x33')]};return db[_0xee92('0x3a')][_0xee92('0x17')](_0x3522da)[_0xee92('0x1e')](function(_0x301602){_0x5d238d[_0xee92('0x17')]=_0x301602;if(_0x4b42ec[_0xee92('0x27')][_0xee92('0x3b')]){_0x347d78[_0xee92('0x3c')]=[{'all':!![]}];}return db[_0xee92('0x3a')][_0xee92('0x3d')](_0x347d78);})[_0xee92('0x1e')](function(_0x35e2f8){_0x5d238d[_0xee92('0x3e')]=_0x35e2f8;return _0x5d238d;})[_0xee92('0x1e')](respondWithFilteredResult(_0x4152b9,_0x347d78))['catch'](handleError(_0x4152b9,null));};exports[_0xee92('0x3f')]=function(_0x220e38,_0x39b596){var _0x165005={'raw':![],'where':{'id':_0x220e38[_0xee92('0x40')]['id']}},_0x4619cc={};_0x4619cc[_0xee92('0x25')]=_[_0xee92('0x26')](db[_0xee92('0x3a')][_0xee92('0x24')]);_0x4619cc[_0xee92('0x27')]=_[_0xee92('0x26')](_0x220e38['query']);_0x4619cc['filters']=_[_0xee92('0x2b')](_0x4619cc[_0xee92('0x25')],_0x4619cc['query']);_0x165005[_0xee92('0x2c')]=_[_0xee92('0x2b')](_0x4619cc['model'],qs[_0xee92('0x2d')](_0x220e38[_0xee92('0x27')][_0xee92('0x2d')]));_0x165005[_0xee92('0x2c')]=_0x165005[_0xee92('0x2c')][_0xee92('0x2e')]?_0x165005[_0xee92('0x2c')]:_0x4619cc[_0xee92('0x25')];if(_0x220e38[_0xee92('0x27')][_0xee92('0x3b')]){_0x165005[_0xee92('0x3c')]=[{'all':!![]}];}_0x165005=_[_0xee92('0x37')]({},_0x165005,_0x220e38[_0xee92('0x39')]);return db[_0xee92('0x3a')][_0xee92('0x41')](_0x165005)[_0xee92('0x1e')](handleEntityNotFound(_0x39b596,null))[_0xee92('0x1e')](respondWithResult(_0x39b596,null))['catch'](handleError(_0x39b596,null));};exports['create']=function(_0xdc8865,_0x1f99d6){return db[_0xee92('0x3a')]['create'](_0xdc8865[_0xee92('0x42')],{})[_0xee92('0x1e')](respondWithResult(_0x1f99d6,0xc9))[_0xee92('0x43')](handleError(_0x1f99d6,null));};exports[_0xee92('0x44')]=function(_0xd0f080,_0x679e53){var _0x10ced1={'raw':![],'where':{'id':_0xd0f080[_0xee92('0x40')]['id']}},_0x58a11a={};_0x58a11a[_0xee92('0x25')]=_[_0xee92('0x26')](db[_0xee92('0x3a')]['rawAttributes']);_0x10ced1[_0xee92('0x2c')]=_[_0xee92('0x2b')](_0x58a11a[_0xee92('0x25')],qs[_0xee92('0x2d')](_0xd0f080[_0xee92('0x27')][_0xee92('0x2d')]));_0x10ced1[_0xee92('0x2c')]=_0x10ced1[_0xee92('0x2c')][_0xee92('0x2e')]?_0x10ced1[_0xee92('0x2c')]:_0x58a11a[_0xee92('0x25')];if(_0xd0f080[_0xee92('0x27')][_0xee92('0x3b')]){_0x10ced1['include']=[{'all':!![]}];}_0x10ced1=_[_0xee92('0x37')]({},_0x10ced1,_0xd0f080[_0xee92('0x39')]);return db[_0xee92('0x3a')][_0xee92('0x41')](_0x10ced1)[_0xee92('0x1e')](handleEntityNotFound(_0x679e53,null))['then'](function(_0x7a4fb){if(_0x7a4fb){var _0x148d46=_0x7a4fb['get']({'plain':!![]});_0x148d46=qs[_0xee92('0x45')](_0x148d46,['id',_0xee92('0x46'),_0xee92('0x47')]);_0xd0f080['body']=_['omit'](_0xd0f080[_0xee92('0x42')],['id',_0xee92('0x46'),_0xee92('0x47')]);return db[_0xee92('0x3a')]['create'](_[_0xee92('0x37')](_0x148d46,_0xd0f080['body']),{'include':_0xd0f080[_0xee92('0x27')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xee92('0x1e')](respondWithResult(_0x679e53,0xc9))['catch'](handleError(_0x679e53,null));};exports[_0xee92('0x1d')]=function(_0x2b079f,_0x51a05a){if(_0x2b079f[_0xee92('0x42')]['id']){delete _0x2b079f[_0xee92('0x42')]['id'];}return db['Dashboard'][_0xee92('0x41')]({'where':{'id':_0x2b079f[_0xee92('0x40')]['id']}})[_0xee92('0x1e')](handleEntityNotFound(_0x51a05a,null))[_0xee92('0x1e')](saveUpdates(_0x2b079f[_0xee92('0x42')],null))[_0xee92('0x1e')](respondWithResult(_0x51a05a,null))[_0xee92('0x43')](handleError(_0x51a05a,null));};exports[_0xee92('0x1f')]=function(_0x103476,_0x5777d9){return db[_0xee92('0x3a')][_0xee92('0x41')]({'where':{'id':_0x103476['params']['id']}})[_0xee92('0x1e')](handleEntityNotFound(_0x5777d9,null))[_0xee92('0x1e')](removeEntity(_0x5777d9,null))[_0xee92('0x43')](handleError(_0x5777d9,null));};function widgetAttributes(_0x2c0440){try{switch(_0x2c0440['type']){case _0xee92('0x48'):return[{'name':_0xee92('0x49'),'value':_0x2c0440[_0xee92('0x49')]||(_0x2c0440['attrs']&&_0x2c0440[_0xee92('0x4a')][0x0]?_0x2c0440[_0xee92('0x4a')][0x0]['value']:undefined)||'https://'}];case _0xee92('0x4b'):return[{'name':_0xee92('0x4c'),'value':_0x2c0440[_0xee92('0x4c')]||(_0x2c0440['attrs']&&_0x2c0440['attrs'][0x0]?_0x2c0440[_0xee92('0x4a')][0x0][_0xee92('0x4d')]:undefined)||''}];case _0xee92('0x4e'):return[{'name':_0xee92('0x4f'),'value':_0x2c0440[_0xee92('0x4f')]||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440[_0xee92('0x4a')][0x0]?_0x2c0440[_0xee92('0x4a')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2c0440[_0xee92('0x50')]||(_0x2c0440['attrs']&&_0x2c0440[_0xee92('0x4a')][0x1]?_0x2c0440[_0xee92('0x4a')][0x1][_0xee92('0x4d')]:undefined)||_0xee92('0x51')},{'name':_0xee92('0x52'),'value':_0x2c0440[_0xee92('0x52')]||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440['attrs'][0x2]?_0x2c0440[_0xee92('0x4a')][0x2]['value']:undefined)||0xc}];case _0xee92('0x53'):return[{'name':_0xee92('0x54'),'value':_0x2c0440[_0xee92('0x54')]||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440['attrs'][0x0]?_0x2c0440[_0xee92('0x4a')][0x0][_0xee92('0x4d')]:undefined)||_0xee92('0x55')},{'name':_0xee92('0x56'),'value':_0x2c0440[_0xee92('0x56')]||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440['attrs'][0x1]?_0x2c0440[_0xee92('0x4a')][0x1]['value']:undefined)||[]},{'name':_0xee92('0x52'),'value':_0x2c0440[_0xee92('0x52')]||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440['attrs'][0x2]?_0x2c0440[_0xee92('0x4a')][0x2][_0xee92('0x4d')]:undefined)||0x14}];case _0xee92('0x57'):case _0xee92('0x58'):return[{'name':_0xee92('0x59'),'value':_0x2c0440[_0xee92('0x59')]||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440['attrs'][0x0]?_0x2c0440[_0xee92('0x4a')][0x0][_0xee92('0x4d')]:undefined)||_0xee92('0x55')},{'name':'attrSerie2','value':_0x2c0440[_0xee92('0x5a')]||(_0x2c0440['attrs']&&_0x2c0440[_0xee92('0x4a')][0x1]?_0x2c0440[_0xee92('0x4a')][0x1][_0xee92('0x4d')]:undefined)||null},{'name':_0xee92('0x5b'),'value':_0x2c0440['attrSerie3']||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440[_0xee92('0x4a')][0x2]?_0x2c0440['attrs'][0x2]['value']:undefined)||null},{'name':_0xee92('0x56'),'value':_0x2c0440['attrVoiceQueues']||(_0x2c0440['attrs']&&_0x2c0440[_0xee92('0x4a')][0x3]?_0x2c0440[_0xee92('0x4a')][0x3][_0xee92('0x4d')]:undefined)||[]}];case _0xee92('0x5c'):return[{'name':_0xee92('0x5d'),'value':_0x2c0440[_0xee92('0x5d')]||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440[_0xee92('0x4a')][0x0]?_0x2c0440[_0xee92('0x4a')][0x0]['value']:undefined)||null},{'name':_0xee92('0x5e'),'value':_0x2c0440[_0xee92('0x5e')]||(_0x2c0440[_0xee92('0x4a')]&&_0x2c0440['attrs'][0x1]?_0x2c0440[_0xee92('0x4a')][0x1][_0xee92('0x4d')]:undefined)||0x0}];default:return[];}}catch(_0x49f889){logger[_0xee92('0x20')](_0xee92('0x5f'),JSON[_0xee92('0x60')](_0x49f889));return[];}}exports[_0xee92('0x61')]=function(_0x101576,_0xc59eb2,_0xa83350){if(_0x101576[_0xee92('0x42')]['id']){delete _0x101576[_0xee92('0x42')]['id'];}return db[_0xee92('0x3a')][_0xee92('0x41')]({'where':{'id':_0x101576[_0xee92('0x40')]['id']}})['then'](handleEntityNotFound(_0xc59eb2,null))[_0xee92('0x1e')](function(_0x303a41){if(_0x303a41){_0x101576[_0xee92('0x42')]['DashboardId']=_0x303a41['id'];_0x101576[_0xee92('0x42')]['attrs']=widgetAttributes(_0x101576[_0xee92('0x42')]);return db['DashboardItem'][_0xee92('0x62')](_0x101576[_0xee92('0x42')]);}})[_0xee92('0x1e')](respondWithResult(_0xc59eb2,null))['catch'](handleError(_0xc59eb2,null));};exports['getItems']=function(_0x34cd83,_0x7f6a9a,_0x5bbb43){var _0xe946ae={};var _0x1bb99a={};var _0xb7d7d8;var _0x2d5b67;return db[_0xee92('0x3a')][_0xee92('0x63')]({'where':{'id':_0x34cd83['params']['id']}})[_0xee92('0x1e')](handleEntityNotFound(_0x7f6a9a,null))['then'](function(_0x38a1d4){if(_0x38a1d4){_0xb7d7d8=_0x38a1d4;_0x1bb99a[_0xee92('0x25')]=_[_0xee92('0x26')](db[_0xee92('0x64')]['rawAttributes']);_0x1bb99a[_0xee92('0x27')]=_[_0xee92('0x26')](_0x34cd83[_0xee92('0x27')]);_0x1bb99a[_0xee92('0x2a')]=_['intersection'](_0x1bb99a['model'],_0x1bb99a[_0xee92('0x27')]);_0xe946ae[_0xee92('0x2c')]=_['intersection'](_0x1bb99a[_0xee92('0x25')],qs[_0xee92('0x2d')](_0x34cd83[_0xee92('0x27')]['fields']));_0xe946ae[_0xee92('0x2c')]=_0xe946ae[_0xee92('0x2c')][_0xee92('0x2e')]?_0xe946ae[_0xee92('0x2c')]:_0x1bb99a[_0xee92('0x25')];_0xe946ae[_0xee92('0x31')]=qs[_0xee92('0x32')](_0x34cd83[_0xee92('0x27')][_0xee92('0x32')]);_0xe946ae['where']=qs[_0xee92('0x2a')](_[_0xee92('0x34')](_0x34cd83[_0xee92('0x27')],_0x1bb99a[_0xee92('0x2a')]));if(_0x34cd83['query'][_0xee92('0x65')]){_0xe946ae[_0xee92('0x33')]=_[_0xee92('0x37')](_0xe946ae['where'],{'$or':_[_0xee92('0x38')](_0xe946ae['attributes'],function(_0x4d29b6){var _0x3094a3={};_0x3094a3[_0x4d29b6]={'$like':'%'+_0x34cd83[_0xee92('0x27')][_0xee92('0x65')]+'%'};return _0x3094a3;})});}_0xe946ae=_[_0xee92('0x37')]({},_0xe946ae,_0x34cd83[_0xee92('0x39')]);return _0xb7d7d8['getItems'](_0xe946ae);}})[_0xee92('0x1e')](function(_0x2c9bd9){if(_0x2c9bd9){_0x2d5b67=_0x2c9bd9[_0xee92('0x2e')];if(!_0x34cd83['query'][_0xee92('0x2f')](_0xee92('0x30'))){_0xe946ae[_0xee92('0x19')]=qs['limit'](_0x34cd83[_0xee92('0x27')]['limit']);_0xe946ae[_0xee92('0x18')]=qs[_0xee92('0x18')](_0x34cd83[_0xee92('0x27')][_0xee92('0x18')]);}return _0xb7d7d8[_0xee92('0x66')](_0xe946ae);}})[_0xee92('0x1e')](function(_0x3b10fc){if(_0x3b10fc){return _0x3b10fc?{'count':_0x2d5b67,'rows':_0x3b10fc}:null;}})[_0xee92('0x1e')](respondWithResult(_0x7f6a9a,null))[_0xee92('0x43')](handleError(_0x7f6a9a,null));}; \ No newline at end of file +var _0xce0b=['../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','end','json','count','offset','limit','status','set','apply','update','then','destroy','error','stack','name','send','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','add','day','merge','where','filter','options','Dashboard','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','clone','get','omit','createdAt','updatedAt','body','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','map','hasOwnProperty','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xce0b,0x191));var _0xbce0=function(_0x13dafe,_0x3d3eba){_0x13dafe=_0x13dafe-0x0;var _0x597317=_0xce0b[_0x13dafe];return _0x597317;};'use strict';var jsonpatch=require(_0xbce0('0x0'));var rp=require(_0xbce0('0x1'));var moment=require(_0xbce0('0x2'));var BPromise=require(_0xbce0('0x3'));var Mustache=require(_0xbce0('0x4'));var util=require(_0xbce0('0x5'));var path=require(_0xbce0('0x6'));var sox=require('sox');var csv=require(_0xbce0('0x7'));var ejs=require(_0xbce0('0x8'));var fs=require('fs');var _=require(_0xbce0('0x9'));var squel=require(_0xbce0('0xa'));var crypto=require(_0xbce0('0xb'));var jsforce=require(_0xbce0('0xc'));var deskjs=require(_0xbce0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xbce0('0xe'));var logger=require(_0xbce0('0xf'))(_0xbce0('0x10'));var utils=require('../../config/utils');var config=require(_0xbce0('0x11'));var db=require(_0xbce0('0x12'))['db'];var socket=require(_0xbce0('0x13'))({'host':_0xbce0('0x14'),'port':0x18eb});require('./dashboard.socket')[_0xbce0('0x15')](socket);function respondWithStatusCode(_0x18cb54,_0x1116b0){_0x1116b0=_0x1116b0||0xcc;return function(_0x39a7f4){if(_0x39a7f4){return _0x18cb54[_0xbce0('0x16')](_0x1116b0);}return _0x18cb54['status'](_0x1116b0)[_0xbce0('0x17')]();};}function respondWithResult(_0x188a04,_0x4742c5){_0x4742c5=_0x4742c5||0xc8;return function(_0x4f9061){if(_0x4f9061){return _0x188a04['status'](_0x4742c5)[_0xbce0('0x18')](_0x4f9061);}};}function respondWithFilteredResult(_0x485a4a,_0xf46561){return function(_0x44f500){if(_0x44f500){var _0x323bc2=_0x44f500[_0xbce0('0x19')],_0x3c6145=_0xf46561[_0xbce0('0x1a')],_0x4dc20e=_0xf46561[_0xbce0('0x1a')]+_0xf46561[_0xbce0('0x1b')],_0x34e6ad;if(_0x4dc20e>=_0x323bc2){_0x4dc20e=_0x323bc2;_0x34e6ad=0xc8;}else{_0x34e6ad=0xce;}_0x485a4a[_0xbce0('0x1c')](_0x34e6ad);return _0x485a4a[_0xbce0('0x1d')]('Content-Range',_0x3c6145+'-'+_0x4dc20e+'/'+_0x323bc2)[_0xbce0('0x18')](_0x44f500);}return null;};}function patchUpdates(_0xd44966){return function(_0x15905e){try{jsonpatch[_0xbce0('0x1e')](_0x15905e,_0xd44966,!![]);}catch(_0x5d629b){return BPromise['reject'](_0x5d629b);}return _0x15905e['save']();};}function saveUpdates(_0x530457,_0x2a5eaa){return function(_0x16d6bb){if(_0x16d6bb){return _0x16d6bb[_0xbce0('0x1f')](_0x530457)[_0xbce0('0x20')](function(_0x4a3635){return _0x4a3635;});}return null;};}function removeEntity(_0x4642f1,_0x33b143){return function(_0x58f3e1){if(_0x58f3e1){return _0x58f3e1[_0xbce0('0x21')]()[_0xbce0('0x20')](function(){_0x4642f1[_0xbce0('0x1c')](0xcc)[_0xbce0('0x17')]();});}};}function handleEntityNotFound(_0x499b48,_0xc7504e){return function(_0x4e8f1b){if(!_0x4e8f1b){_0x499b48[_0xbce0('0x16')](0x194);}return _0x4e8f1b;};}function handleError(_0x4df82d,_0x38e045){_0x38e045=_0x38e045||0x1f4;return function(_0x3dd67a){logger[_0xbce0('0x22')](_0x3dd67a[_0xbce0('0x23')]);if(_0x3dd67a[_0xbce0('0x24')]){delete _0x3dd67a[_0xbce0('0x24')];}_0x4df82d[_0xbce0('0x1c')](_0x38e045)[_0xbce0('0x25')](_0x3dd67a);};}exports['index']=function(_0x36d2dd,_0x1a62f9){var _0x5b9b66={},_0x2db934={},_0x665d83={'count':0x0,'rows':[]};var _0x1205d5=db['Dashboard']['rawAttributes'];_0x2db934[_0xbce0('0x26')]=_[_0xbce0('0x27')](_0x1205d5);var _0x9f2ac2={'dateStart':_0x36d2dd[_0xbce0('0x28')][_0xbce0('0x29')],'dateEnd':_0x36d2dd[_0xbce0('0x28')][_0xbce0('0x2a')]};delete _0x36d2dd[_0xbce0('0x28')][_0xbce0('0x29')];delete _0x36d2dd[_0xbce0('0x28')]['dateEnd'];_0x2db934[_0xbce0('0x28')]=_[_0xbce0('0x27')](_0x36d2dd[_0xbce0('0x28')]);_0x2db934['filters']=_[_0xbce0('0x2b')](_0x2db934[_0xbce0('0x26')],_0x2db934[_0xbce0('0x28')]);_0x5b9b66[_0xbce0('0x2c')]=_[_0xbce0('0x2b')](_0x2db934[_0xbce0('0x26')],qs['fields'](_0x36d2dd[_0xbce0('0x28')][_0xbce0('0x2d')]));_0x5b9b66['attributes']=_0x5b9b66['attributes'][_0xbce0('0x2e')]?_0x5b9b66[_0xbce0('0x2c')]:_0x2db934[_0xbce0('0x26')];if(!_0x36d2dd[_0xbce0('0x28')]['hasOwnProperty'](_0xbce0('0x2f'))){_0x5b9b66['limit']=qs[_0xbce0('0x1b')](_0x36d2dd[_0xbce0('0x28')]['limit']);_0x5b9b66[_0xbce0('0x1a')]=qs['offset'](_0x36d2dd[_0xbce0('0x28')][_0xbce0('0x1a')]);}_0x5b9b66[_0xbce0('0x30')]=qs[_0xbce0('0x31')](_0x36d2dd[_0xbce0('0x28')]['sort']);_0x5b9b66['where']=qs['filters'](_[_0xbce0('0x32')](_0x36d2dd[_0xbce0('0x28')],_0x2db934[_0xbce0('0x33')]));if(_0x9f2ac2[_0xbce0('0x29')]){if(_0x9f2ac2['dateEnd']){_0x9f2ac2[_0xbce0('0x2a')]=moment(_0x9f2ac2[_0xbce0('0x2a')])['add'](0x1,'day');}else{_0x9f2ac2[_0xbce0('0x2a')]=moment(_0x9f2ac2[_0xbce0('0x29')])[_0xbce0('0x34')](0x1,_0xbce0('0x35'));}_[_0xbce0('0x36')](_0x5b9b66[_0xbce0('0x37')],{'createdAt':{'$gte':_0x9f2ac2[_0xbce0('0x29')],'$lte':_0x9f2ac2[_0xbce0('0x2a')]}});}if(_0x36d2dd['query'][_0xbce0('0x38')]){_0x5b9b66[_0xbce0('0x37')]=_[_0xbce0('0x36')](_0x5b9b66[_0xbce0('0x37')],{'$or':_['map'](_0x5b9b66[_0xbce0('0x2c')],function(_0x1cec43){var _0x15fed6={};_0x15fed6[_0x1cec43]={'$like':'%'+_0x36d2dd[_0xbce0('0x28')][_0xbce0('0x38')]+'%'};return _0x15fed6;})});}_0x5b9b66=_[_0xbce0('0x36')]({},_0x5b9b66,_0x36d2dd[_0xbce0('0x39')]);var _0x503071={'where':_0x5b9b66[_0xbce0('0x37')]};return db[_0xbce0('0x3a')][_0xbce0('0x19')](_0x503071)['then'](function(_0x463547){_0x665d83[_0xbce0('0x19')]=_0x463547;if(_0x36d2dd[_0xbce0('0x28')][_0xbce0('0x3b')]){_0x5b9b66[_0xbce0('0x3c')]=[{'all':!![]}];}return db[_0xbce0('0x3a')][_0xbce0('0x3d')](_0x5b9b66);})[_0xbce0('0x20')](function(_0x12f819){_0x665d83['rows']=_0x12f819;return _0x665d83;})[_0xbce0('0x20')](respondWithFilteredResult(_0x1a62f9,_0x5b9b66))[_0xbce0('0x3e')](handleError(_0x1a62f9,null));};exports[_0xbce0('0x3f')]=function(_0x5df0e2,_0x5f1081){var _0x51427d={'raw':![],'where':{'id':_0x5df0e2[_0xbce0('0x40')]['id']}},_0x480cd8={};_0x480cd8[_0xbce0('0x26')]=_[_0xbce0('0x27')](db[_0xbce0('0x3a')][_0xbce0('0x41')]);_0x480cd8['query']=_[_0xbce0('0x27')](_0x5df0e2['query']);_0x480cd8['filters']=_['intersection'](_0x480cd8['model'],_0x480cd8[_0xbce0('0x28')]);_0x51427d[_0xbce0('0x2c')]=_['intersection'](_0x480cd8[_0xbce0('0x26')],qs[_0xbce0('0x2d')](_0x5df0e2['query']['fields']));_0x51427d[_0xbce0('0x2c')]=_0x51427d[_0xbce0('0x2c')][_0xbce0('0x2e')]?_0x51427d[_0xbce0('0x2c')]:_0x480cd8[_0xbce0('0x26')];if(_0x5df0e2[_0xbce0('0x28')][_0xbce0('0x3b')]){_0x51427d[_0xbce0('0x3c')]=[{'all':!![]}];}_0x51427d=_[_0xbce0('0x36')]({},_0x51427d,_0x5df0e2[_0xbce0('0x39')]);return db['Dashboard'][_0xbce0('0x42')](_0x51427d)[_0xbce0('0x20')](handleEntityNotFound(_0x5f1081,null))[_0xbce0('0x20')](respondWithResult(_0x5f1081,null))[_0xbce0('0x3e')](handleError(_0x5f1081,null));};exports[_0xbce0('0x43')]=function(_0x332c80,_0xaa12b7){return db[_0xbce0('0x3a')][_0xbce0('0x43')](_0x332c80['body'],{})[_0xbce0('0x20')](respondWithResult(_0xaa12b7,0xc9))[_0xbce0('0x3e')](handleError(_0xaa12b7,null));};exports[_0xbce0('0x44')]=function(_0x3bc583,_0x16b366){var _0x5b0909={'raw':![],'where':{'id':_0x3bc583[_0xbce0('0x40')]['id']}},_0x392e43={};_0x392e43[_0xbce0('0x26')]=_[_0xbce0('0x27')](db[_0xbce0('0x3a')][_0xbce0('0x41')]);_0x5b0909['attributes']=_[_0xbce0('0x2b')](_0x392e43[_0xbce0('0x26')],qs[_0xbce0('0x2d')](_0x3bc583[_0xbce0('0x28')][_0xbce0('0x2d')]));_0x5b0909[_0xbce0('0x2c')]=_0x5b0909['attributes']['length']?_0x5b0909[_0xbce0('0x2c')]:_0x392e43[_0xbce0('0x26')];if(_0x3bc583[_0xbce0('0x28')][_0xbce0('0x3b')]){_0x5b0909[_0xbce0('0x3c')]=[{'all':!![]}];}_0x5b0909=_[_0xbce0('0x36')]({},_0x5b0909,_0x3bc583[_0xbce0('0x39')]);return db[_0xbce0('0x3a')][_0xbce0('0x42')](_0x5b0909)['then'](handleEntityNotFound(_0x16b366,null))[_0xbce0('0x20')](function(_0x1bf874){if(_0x1bf874){var _0x5e6803=_0x1bf874[_0xbce0('0x45')]({'plain':!![]});_0x5e6803=qs[_0xbce0('0x46')](_0x5e6803,['id',_0xbce0('0x47'),_0xbce0('0x48')]);_0x3bc583['body']=_['omit'](_0x3bc583['body'],['id',_0xbce0('0x47'),_0xbce0('0x48')]);return db['Dashboard'][_0xbce0('0x43')](_[_0xbce0('0x36')](_0x5e6803,_0x3bc583[_0xbce0('0x49')]),{'include':_0x3bc583[_0xbce0('0x28')][_0xbce0('0x3b')]?[{'all':!![]}]:undefined});}})[_0xbce0('0x20')](respondWithResult(_0x16b366,0xc9))[_0xbce0('0x3e')](handleError(_0x16b366,null));};exports['update']=function(_0x2b664e,_0x304b76){if(_0x2b664e[_0xbce0('0x49')]['id']){delete _0x2b664e[_0xbce0('0x49')]['id'];}return db[_0xbce0('0x3a')][_0xbce0('0x42')]({'where':{'id':_0x2b664e[_0xbce0('0x40')]['id']}})[_0xbce0('0x20')](handleEntityNotFound(_0x304b76,null))[_0xbce0('0x20')](saveUpdates(_0x2b664e[_0xbce0('0x49')],null))['then'](respondWithResult(_0x304b76,null))[_0xbce0('0x3e')](handleError(_0x304b76,null));};exports[_0xbce0('0x21')]=function(_0x5f38c0,_0x4e62b0){return db[_0xbce0('0x3a')]['find']({'where':{'id':_0x5f38c0[_0xbce0('0x40')]['id']}})[_0xbce0('0x20')](handleEntityNotFound(_0x4e62b0,null))['then'](removeEntity(_0x4e62b0,null))['catch'](handleError(_0x4e62b0,null));};function widgetAttributes(_0x7789c6){try{switch(_0x7789c6[_0xbce0('0x4a')]){case _0xbce0('0x4b'):return[{'name':'attrUrl','value':_0x7789c6[_0xbce0('0x4c')]||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6['attrs'][0x0]?_0x7789c6[_0xbce0('0x4d')][0x0][_0xbce0('0x4e')]:undefined)||'https://'}];case _0xbce0('0x4f'):return[{'name':_0xbce0('0x50'),'value':_0x7789c6[_0xbce0('0x50')]||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6['attrs'][0x0]?_0x7789c6[_0xbce0('0x4d')][0x0]['value']:undefined)||''}];case _0xbce0('0x51'):return[{'name':_0xbce0('0x52'),'value':_0x7789c6['attrHourFormat']||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6[_0xbce0('0x4d')][0x0]?_0x7789c6[_0xbce0('0x4d')][0x0][_0xbce0('0x4e')]:undefined)||_0xbce0('0x53')},{'name':_0xbce0('0x54'),'value':_0x7789c6[_0xbce0('0x54')]||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6['attrs'][0x1]?_0x7789c6[_0xbce0('0x4d')][0x1][_0xbce0('0x4e')]:undefined)||_0xbce0('0x55')},{'name':'attrFontSize','value':_0x7789c6[_0xbce0('0x56')]||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6[_0xbce0('0x4d')][0x2]?_0x7789c6[_0xbce0('0x4d')][0x2]['value']:undefined)||0xc}];case _0xbce0('0x57'):return[{'name':_0xbce0('0x58'),'value':_0x7789c6[_0xbce0('0x58')]||(_0x7789c6['attrs']&&_0x7789c6[_0xbce0('0x4d')][0x0]?_0x7789c6[_0xbce0('0x4d')][0x0][_0xbce0('0x4e')]:undefined)||_0xbce0('0x59')},{'name':_0xbce0('0x5a'),'value':_0x7789c6['attrVoiceQueues']||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6['attrs'][0x1]?_0x7789c6[_0xbce0('0x4d')][0x1]['value']:undefined)||[]},{'name':_0xbce0('0x56'),'value':_0x7789c6['attrFontSize']||(_0x7789c6['attrs']&&_0x7789c6['attrs'][0x2]?_0x7789c6[_0xbce0('0x4d')][0x2][_0xbce0('0x4e')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xbce0('0x5b'),'value':_0x7789c6[_0xbce0('0x5b')]||(_0x7789c6['attrs']&&_0x7789c6[_0xbce0('0x4d')][0x0]?_0x7789c6[_0xbce0('0x4d')][0x0]['value']:undefined)||'total'},{'name':_0xbce0('0x5c'),'value':_0x7789c6[_0xbce0('0x5c')]||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6[_0xbce0('0x4d')][0x1]?_0x7789c6[_0xbce0('0x4d')][0x1]['value']:undefined)||null},{'name':_0xbce0('0x5d'),'value':_0x7789c6[_0xbce0('0x5d')]||(_0x7789c6['attrs']&&_0x7789c6[_0xbce0('0x4d')][0x2]?_0x7789c6[_0xbce0('0x4d')][0x2][_0xbce0('0x4e')]:undefined)||null},{'name':_0xbce0('0x5a'),'value':_0x7789c6[_0xbce0('0x5a')]||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6[_0xbce0('0x4d')][0x3]?_0x7789c6[_0xbce0('0x4d')][0x3][_0xbce0('0x4e')]:undefined)||[]}];case'web-report':return[{'name':_0xbce0('0x5e'),'value':_0x7789c6['attrReport']||(_0x7789c6['attrs']&&_0x7789c6['attrs'][0x0]?_0x7789c6[_0xbce0('0x4d')][0x0][_0xbce0('0x4e')]:undefined)||null},{'name':_0xbce0('0x5f'),'value':_0x7789c6['attrRefresh']||(_0x7789c6[_0xbce0('0x4d')]&&_0x7789c6[_0xbce0('0x4d')][0x1]?_0x7789c6[_0xbce0('0x4d')][0x1][_0xbce0('0x4e')]:undefined)||0x0}];default:return[];}}catch(_0x14853b){logger[_0xbce0('0x22')](_0xbce0('0x60'),JSON[_0xbce0('0x61')](_0x14853b));return[];}}exports[_0xbce0('0x62')]=function(_0x596336,_0x51ee0f,_0x575227){if(_0x596336[_0xbce0('0x49')]['id']){delete _0x596336[_0xbce0('0x49')]['id'];}return db[_0xbce0('0x3a')][_0xbce0('0x42')]({'where':{'id':_0x596336[_0xbce0('0x40')]['id']}})['then'](handleEntityNotFound(_0x51ee0f,null))[_0xbce0('0x20')](function(_0x58c00e){if(_0x58c00e){_0x596336[_0xbce0('0x49')]['DashboardId']=_0x58c00e['id'];_0x596336['body']['attrs']=widgetAttributes(_0x596336[_0xbce0('0x49')]);return db[_0xbce0('0x63')]['create'](_0x596336[_0xbce0('0x49')]);}})['then'](respondWithResult(_0x51ee0f,null))[_0xbce0('0x3e')](handleError(_0x51ee0f,null));};exports[_0xbce0('0x64')]=function(_0x43c0dc,_0x28d018,_0xfbecdc){var _0x264e63={};var _0x2a80ad={};var _0x4f6479;var _0x56a20e;return db['Dashboard'][_0xbce0('0x65')]({'where':{'id':_0x43c0dc['params']['id']}})[_0xbce0('0x20')](handleEntityNotFound(_0x28d018,null))[_0xbce0('0x20')](function(_0x384dd0){if(_0x384dd0){_0x4f6479=_0x384dd0;_0x2a80ad[_0xbce0('0x26')]=_[_0xbce0('0x27')](db[_0xbce0('0x63')][_0xbce0('0x41')]);_0x2a80ad[_0xbce0('0x28')]=_[_0xbce0('0x27')](_0x43c0dc['query']);_0x2a80ad[_0xbce0('0x33')]=_['intersection'](_0x2a80ad[_0xbce0('0x26')],_0x2a80ad['query']);_0x264e63['attributes']=_[_0xbce0('0x2b')](_0x2a80ad['model'],qs[_0xbce0('0x2d')](_0x43c0dc[_0xbce0('0x28')]['fields']));_0x264e63['attributes']=_0x264e63[_0xbce0('0x2c')][_0xbce0('0x2e')]?_0x264e63[_0xbce0('0x2c')]:_0x2a80ad[_0xbce0('0x26')];_0x264e63[_0xbce0('0x30')]=qs[_0xbce0('0x31')](_0x43c0dc[_0xbce0('0x28')][_0xbce0('0x31')]);_0x264e63['where']=qs[_0xbce0('0x33')](_[_0xbce0('0x32')](_0x43c0dc[_0xbce0('0x28')],_0x2a80ad[_0xbce0('0x33')]));if(_0x43c0dc[_0xbce0('0x28')]['filter']){_0x264e63['where']=_[_0xbce0('0x36')](_0x264e63['where'],{'$or':_[_0xbce0('0x66')](_0x264e63['attributes'],function(_0x37426d){var _0x1e1336={};_0x1e1336[_0x37426d]={'$like':'%'+_0x43c0dc[_0xbce0('0x28')][_0xbce0('0x38')]+'%'};return _0x1e1336;})});}_0x264e63=_[_0xbce0('0x36')]({},_0x264e63,_0x43c0dc[_0xbce0('0x39')]);return _0x4f6479[_0xbce0('0x64')](_0x264e63);}})[_0xbce0('0x20')](function(_0x1d58ba){if(_0x1d58ba){_0x56a20e=_0x1d58ba[_0xbce0('0x2e')];if(!_0x43c0dc['query'][_0xbce0('0x67')](_0xbce0('0x2f'))){_0x264e63[_0xbce0('0x1b')]=qs['limit'](_0x43c0dc[_0xbce0('0x28')][_0xbce0('0x1b')]);_0x264e63[_0xbce0('0x1a')]=qs['offset'](_0x43c0dc[_0xbce0('0x28')][_0xbce0('0x1a')]);}return _0x4f6479['getItems'](_0x264e63);}})[_0xbce0('0x20')](function(_0x25745b){if(_0x25745b){return _0x25745b?{'count':_0x56a20e,'rows':_0x25745b}:null;}})['then'](respondWithResult(_0x28d018,null))[_0xbce0('0x3e')](handleError(_0x28d018,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 3ea2107..2a24317 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 _0x50db=['hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','update','remove','emit'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x50db,0x12b));var _0xb50d=function(_0x3f71e9,_0x12c512){_0x3f71e9=_0x3f71e9-0x0;var _0x272afd=_0x50db[_0x3f71e9];return _0x272afd;};'use strict';var EventEmitter=require(_0xb50d('0x0'));var Dashboard=require(_0xb50d('0x1'))['db'][_0xb50d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb50d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb50d('0x4'),'afterDestroy':_0xb50d('0x5')};function emitEvent(_0x1a1e5c){return function(_0x41c955,_0x219e52,_0x2396ce){DashboardEvents[_0xb50d('0x6')](_0x1a1e5c+':'+_0x41c955['id'],_0x41c955);DashboardEvents[_0xb50d('0x6')](_0x1a1e5c,_0x41c955);_0x2396ce(null);};}for(var e in events){if(events[_0xb50d('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xb50d('0x8')]=DashboardEvents; \ No newline at end of file +var _0x87ae=['remove','hook','exports','Dashboard','setMaxListeners','save','update'];(function(_0xe4f20c,_0x5ac9c3){var _0x8f1a7a=function(_0x1ed241){while(--_0x1ed241){_0xe4f20c['push'](_0xe4f20c['shift']());}};_0x8f1a7a(++_0x5ac9c3);}(_0x87ae,0x176));var _0xe87a=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x87ae[_0x6cf19c];return _0xce14f3;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0xe87a('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xe87a('0x1')](0x0);var events={'afterCreate':_0xe87a('0x2'),'afterUpdate':_0xe87a('0x3'),'afterDestroy':_0xe87a('0x4')};function emitEvent(_0x19aee5){return function(_0x42050e,_0x36a352,_0x44b3ea){DashboardEvents['emit'](_0x19aee5+':'+_0x42050e['id'],_0x42050e);DashboardEvents['emit'](_0x19aee5,_0x42050e);_0x44b3ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xe87a('0x5')](e,emitEvent(event));}}module[_0xe87a('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2ba4571..2746ebf 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 _0xf960=['define','Dashboard','dashboards','lodash','../../config/logger','moment','bluebird','./dashboard.attributes'];(function(_0x146fc2,_0x4beccc){var _0x3600ee=function(_0x38bae8){while(--_0x38bae8){_0x146fc2['push'](_0x146fc2['shift']());}};_0x3600ee(++_0x4beccc);}(_0xf960,0x193));var _0x0f96=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0xf960[_0x5db657];return _0x2d6e70;};'use strict';var _=require(_0x0f96('0x0'));var util=require('util');var logger=require(_0x0f96('0x1'))('api');var moment=require(_0x0f96('0x2'));var BPromise=require(_0x0f96('0x3'));var rp=require('request-promise');var attributes=require(_0x0f96('0x4'));module['exports']=function(_0x4ed973,_0x125f4b){return _0x4ed973[_0x0f96('0x5')](_0x0f96('0x6'),attributes,{'tableName':_0x0f96('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91a=['moment','request-promise','./dashboard.attributes','Dashboard','dashboards','util','../../config/logger','api'];(function(_0x492ad3,_0x56d43c){var _0x3e6187=function(_0x25c254){while(--_0x25c254){_0x492ad3['push'](_0x492ad3['shift']());}};_0x3e6187(++_0x56d43c);}(_0xb91a,0xe5));var _0xab91=function(_0x3c7d09,_0x590837){_0x3c7d09=_0x3c7d09-0x0;var _0x310d46=_0xb91a[_0x3c7d09];return _0x310d46;};'use strict';var _=require('lodash');var util=require(_0xab91('0x0'));var logger=require(_0xab91('0x1'))(_0xab91('0x2'));var moment=require(_0xab91('0x3'));var BPromise=require('bluebird');var rp=require(_0xab91('0x4'));var attributes=require(_0xab91('0x5'));module['exports']=function(_0x2b8873,_0x4ec84d){return _0x2b8873['define'](_0xab91('0x6'),attributes,{'tableName':_0xab91('0x7'),'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 6c494eb..553bb9a 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 _0xaab8=['stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xaab8,0x1e6));var _0x8aab=function(_0x15f7e5,_0x235182){_0x15f7e5=_0x15f7e5-0x0;var _0x541f2f=_0xaab8[_0x15f7e5];return _0x541f2f;};'use strict';var _=require(_0x8aab('0x0'));var util=require('util');var moment=require(_0x8aab('0x1'));var BPromise=require('bluebird');var rs=require(_0x8aab('0x2'));var fs=require('fs');var db=require(_0x8aab('0x3'))['db'];var utils=require(_0x8aab('0x4'));var logger=require(_0x8aab('0x5'))(_0x8aab('0x6'));var config=require('../../config/environment');var jayson=require(_0x8aab('0x7'));var client=jayson[_0x8aab('0x8')]['http']({'port':0x232a});var socket=require(_0x8aab('0x9'))({'host':'localhost','port':0x18eb});require(_0x8aab('0xa'))[_0x8aab('0xb')](socket);function respondWithRpcPromise(_0xb9d287,_0x355443,_0x4e54f7){return new BPromise(function(_0x3e8013,_0x57df9e){return client[_0x8aab('0xc')](_0xb9d287,_0x4e54f7)[_0x8aab('0xd')](function(_0x446f64){logger['info'](_0x8aab('0xe'),_0x355443,_0x8aab('0xf'));logger[_0x8aab('0x10')](_0x8aab('0x11'),_0x355443,_0x8aab('0xf'),JSON[_0x8aab('0x12')](_0x446f64));if(_0x446f64[_0x8aab('0x13')]){if(_0x446f64[_0x8aab('0x13')][_0x8aab('0x14')]===0x1f4){logger[_0x8aab('0x13')](_0x8aab('0xe'),_0x355443,_0x446f64[_0x8aab('0x13')]['message']);return _0x57df9e(_0x446f64[_0x8aab('0x13')][_0x8aab('0x15')]);}logger[_0x8aab('0x13')](_0x8aab('0xe'),_0x355443,_0x446f64[_0x8aab('0x13')][_0x8aab('0x15')]);return _0x3e8013(_0x446f64['error'][_0x8aab('0x15')]);}else{logger['info'](_0x8aab('0xe'),_0x355443,_0x8aab('0xf'));_0x3e8013(_0x446f64[_0x8aab('0x16')][_0x8aab('0x15')]);}})[_0x8aab('0x17')](function(_0x4a6ba6){logger[_0x8aab('0x13')]('Dashboard,\x20%s,\x20%s',_0x355443,_0x4a6ba6);_0x57df9e(_0x4a6ba6);});});} \ No newline at end of file +var _0x90e2=['request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','localhost','./dashboard.socket','register'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0x90e2,0x15b));var _0x290e=function(_0x20fe50,_0x33517c){_0x20fe50=_0x20fe50-0x0;var _0x4e630a=_0x90e2[_0x20fe50];return _0x4e630a;};'use strict';var _=require('lodash');var util=require(_0x290e('0x0'));var moment=require(_0x290e('0x1'));var BPromise=require(_0x290e('0x2'));var rs=require(_0x290e('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x290e('0x4'))(_0x290e('0x5'));var config=require(_0x290e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x290e('0x7')][_0x290e('0x8')]({'port':0x232a});var socket=require(_0x290e('0x9'))({'host':_0x290e('0xa'),'port':0x18eb});require(_0x290e('0xb'))[_0x290e('0xc')](socket);function respondWithRpcPromise(_0x5b7e27,_0xe6e469,_0x4ebc0a){return new BPromise(function(_0xb5cc8f,_0x596866){return client[_0x290e('0xd')](_0x5b7e27,_0x4ebc0a)['then'](function(_0x3c4da4){logger[_0x290e('0xe')](_0x290e('0xf'),_0xe6e469,_0x290e('0x10'));logger[_0x290e('0x11')](_0x290e('0x12'),_0xe6e469,_0x290e('0x10'),JSON[_0x290e('0x13')](_0x3c4da4));if(_0x3c4da4[_0x290e('0x14')]){if(_0x3c4da4[_0x290e('0x14')]['code']===0x1f4){logger[_0x290e('0x14')](_0x290e('0xf'),_0xe6e469,_0x3c4da4[_0x290e('0x14')]['message']);return _0x596866(_0x3c4da4[_0x290e('0x14')][_0x290e('0x15')]);}logger[_0x290e('0x14')](_0x290e('0xf'),_0xe6e469,_0x3c4da4[_0x290e('0x14')][_0x290e('0x15')]);return _0xb5cc8f(_0x3c4da4['error'][_0x290e('0x15')]);}else{logger[_0x290e('0xe')](_0x290e('0xf'),_0xe6e469,'request\x20sent');_0xb5cc8f(_0x3c4da4[_0x290e('0x16')][_0x290e('0x15')]);}})[_0x290e('0x17')](function(_0x1cebe2){logger[_0x290e('0x14')]('Dashboard,\x20%s,\x20%s',_0xe6e469,_0x1cebe2);_0x596866(_0x1cebe2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index cceaa42..80076f9 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 _0x0d62=['removeListener','register','dashboard:','./dashboard.events','save','remove','emit'];(function(_0x37c0b0,_0x572bff){var _0x5c7347=function(_0x140e85){while(--_0x140e85){_0x37c0b0['push'](_0x37c0b0['shift']());}};_0x5c7347(++_0x572bff);}(_0x0d62,0xf8));var _0x20d6=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x0d62[_0x5b8310];return _0xd3ebc1;};'use strict';var DashboardEvents=require(_0x20d6('0x0'));var events=[_0x20d6('0x1'),_0x20d6('0x2'),'update'];function createListener(_0x19b6cb,_0x905682){return function(_0x2b7774){_0x905682[_0x20d6('0x3')](_0x19b6cb,_0x2b7774);};}function removeListener(_0x1d6b86,_0x3eb2ef){return function(){DashboardEvents[_0x20d6('0x4')](_0x1d6b86,_0x3eb2ef);};}exports[_0x20d6('0x5')]=function(_0x202287){for(var _0x4db7c4=0x0,_0x2d763d=events['length'];_0x4db7c4<_0x2d763d;_0x4db7c4++){var _0x10185a=events[_0x4db7c4];var _0x4218e9=createListener(_0x20d6('0x6')+_0x10185a,_0x202287);DashboardEvents['on'](_0x10185a,_0x4218e9);}}; \ No newline at end of file +var _0x1ac8=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0xd371ce,_0xdcfbd){var _0x5614ef=function(_0x2fd311){while(--_0x2fd311){_0xd371ce['push'](_0xd371ce['shift']());}};_0x5614ef(++_0xdcfbd);}(_0x1ac8,0xd5));var _0x81ac=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1ac8[_0x2c91e9];return _0x13f0ff;};'use strict';var DashboardEvents=require(_0x81ac('0x0'));var events=[_0x81ac('0x1'),_0x81ac('0x2'),_0x81ac('0x3')];function createListener(_0xe94e27,_0x2e8676){return function(_0x108b1b){_0x2e8676[_0x81ac('0x4')](_0xe94e27,_0x108b1b);};}function removeListener(_0x5af545,_0x53552d){return function(){DashboardEvents[_0x81ac('0x5')](_0x5af545,_0x53552d);};}exports[_0x81ac('0x6')]=function(_0x4ad824){for(var _0x1da030=0x0,_0x20db5a=events[_0x81ac('0x7')];_0x1da030<_0x20db5a;_0x1da030++){var _0x5a34b3=events[_0x1da030];var _0x19af59=createListener(_0x81ac('0x8')+_0x5a34b3,_0x4ad824);DashboardEvents['on'](_0x5a34b3,_0x19af59);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5e8a05b..06badbb 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 _0x0131=['multer','util','express','Router','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','create','post','clone','addItem','put','update','exports'];(function(_0x339307,_0x4ce7a0){var _0x4bf6b4=function(_0x1f1445){while(--_0x1f1445){_0x339307['push'](_0x339307['shift']());}};_0x4bf6b4(++_0x4ce7a0);}(_0x0131,0x1c2));var _0x1013=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0x0131[_0x112fe3];return _0x1ec903;};'use strict';var multer=require(_0x1013('0x0'));var util=require(_0x1013('0x1'));var path=require('path');var express=require(_0x1013('0x2'));var router=express[_0x1013('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1013('0x4'));var controller=require(_0x1013('0x5'));router[_0x1013('0x6')]('/',auth['isAuthenticated'](),controller[_0x1013('0x7')]);router[_0x1013('0x6')](_0x1013('0x8'),auth[_0x1013('0x9')](),controller[_0x1013('0xa')]);router[_0x1013('0x6')]('/:id/items',auth[_0x1013('0x9')](),controller['getItems']);router['post']('/',auth[_0x1013('0x9')](),controller[_0x1013('0xb')]);router[_0x1013('0xc')]('/:id/clone',auth[_0x1013('0x9')](),controller[_0x1013('0xd')]);router[_0x1013('0xc')]('/:id/items',auth['isAuthenticated'](),controller[_0x1013('0xe')]);router[_0x1013('0xf')](_0x1013('0x8'),auth[_0x1013('0x9')](),controller[_0x1013('0x10')]);router['delete']('/:id',auth[_0x1013('0x9')](),controller['destroy']);module[_0x1013('0x11')]=router; \ No newline at end of file +var _0xf148=['get','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x5d245c,_0x858414){var _0x2cfacd=function(_0x3c3f56){while(--_0x3c3f56){_0x5d245c['push'](_0x5d245c['shift']());}};_0x2cfacd(++_0x858414);}(_0xf148,0xf4));var _0x8f14=function(_0xf15ed6,_0x28bcbf){_0xf15ed6=_0xf15ed6-0x0;var _0x11ab6d=_0xf148[_0xf15ed6];return _0x11ab6d;};'use strict';var multer=require(_0x8f14('0x0'));var util=require('util');var path=require(_0x8f14('0x1'));var express=require(_0x8f14('0x2'));var router=express[_0x8f14('0x3')]();var auth=require(_0x8f14('0x4'));var interaction=require(_0x8f14('0x5'));var config=require(_0x8f14('0x6'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x8f14('0x7')](),controller['index']);router[_0x8f14('0x8')](_0x8f14('0x9'),auth[_0x8f14('0x7')](),controller[_0x8f14('0xa')]);router[_0x8f14('0x8')](_0x8f14('0xb'),auth[_0x8f14('0x7')](),controller[_0x8f14('0xc')]);router[_0x8f14('0xd')]('/',auth[_0x8f14('0x7')](),controller[_0x8f14('0xe')]);router['post'](_0x8f14('0xf'),auth[_0x8f14('0x7')](),controller[_0x8f14('0x10')]);router[_0x8f14('0xd')](_0x8f14('0xb'),auth[_0x8f14('0x7')](),controller['addItem']);router[_0x8f14('0x11')](_0x8f14('0x9'),auth[_0x8f14('0x7')](),controller[_0x8f14('0x12')]);router[_0x8f14('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8f14('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 3ea06ae..5f5d856 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 _0x20df=['STRING','parse','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','squel','exports'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x20df,0x76));var _0xf20d=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x20df[_0x1e05c1];return _0x15f1ca;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xf20d('0x0'));var _=require('lodash');module[_0xf20d('0x1')]={'title':{'type':Sequelize[_0xf20d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf20d('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0xf20d('0x3')](this['getDataValue']('attrs'));}catch(_0xf2e209){return[];}},'set':function(_0x47fa16){try{this['setDataValue'](_0xf20d('0x4'),JSON[_0xf20d('0x5')](_0x47fa16));}catch(_0x22ffa9){this[_0xf20d('0x6')](_0xf20d('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf20d('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf20d('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xf20d('0x2')],'allowNull':![],'defaultValue':_0xf20d('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf20d('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf20d('0x2')]}}; \ No newline at end of file +var _0x2e52=['exports','STRING','TEXT','getDataValue','attrs','stringify','setDataValue','INTEGER','sequelize','squel','lodash'];(function(_0x5942b8,_0x400cba){var _0x38b23c=function(_0x3ebf65){while(--_0x3ebf65){_0x5942b8['push'](_0x5942b8['shift']());}};_0x38b23c(++_0x400cba);}(_0x2e52,0xe4));var _0x22e5=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x2e52[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x22e5('0x0'));var squel=require(_0x22e5('0x1'));var _=require(_0x22e5('0x2'));module[_0x22e5('0x3')]={'title':{'type':Sequelize[_0x22e5('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x22e5('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22e5('0x5')]('long'),'get':function(){try{return JSON['parse'](this[_0x22e5('0x6')]('attrs'));}catch(_0x23ad2f){return[];}},'set':function(_0x4954f3){try{this['setDataValue'](_0x22e5('0x7'),JSON[_0x22e5('0x8')](_0x4954f3));}catch(_0x277120){this[_0x22e5('0x9')]('attrs',JSON[_0x22e5('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x22e5('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22e5('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22e5('0xa')]},'col':{'type':Sequelize[_0x22e5('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x22e5('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x22e5('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 4b6440f..469c8bf 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 _0x6e3d=['attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./dashboardItem.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','DashboardItem','find','catch','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1'];(function(_0x22db6f,_0xa45e8){var _0x4bb6f0=function(_0x589176){while(--_0x589176){_0x22db6f['push'](_0x22db6f['shift']());}};_0x4bb6f0(++_0xa45e8);}(_0x6e3d,0x150));var _0xd6e3=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x6e3d[_0x548627];return _0x844a84;};'use strict';var jsonpatch=require(_0xd6e3('0x0'));var rp=require(_0xd6e3('0x1'));var moment=require(_0xd6e3('0x2'));var BPromise=require(_0xd6e3('0x3'));var Mustache=require('mustache');var util=require(_0xd6e3('0x4'));var path=require(_0xd6e3('0x5'));var sox=require(_0xd6e3('0x6'));var csv=require(_0xd6e3('0x7'));var ejs=require(_0xd6e3('0x8'));var fs=require('fs');var _=require(_0xd6e3('0x9'));var squel=require('squel');var crypto=require(_0xd6e3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd6e3('0xb'));var toCsv=require(_0xd6e3('0x7'));var querystring=require(_0xd6e3('0xc'));var Papa=require(_0xd6e3('0xd'));var qs=require(_0xd6e3('0xe'));var logger=require(_0xd6e3('0xf'))(_0xd6e3('0x10'));var utils=require(_0xd6e3('0x11'));var config=require(_0xd6e3('0x12'));var db=require(_0xd6e3('0x13'))['db'];var socket=require(_0xd6e3('0x14'))({'host':_0xd6e3('0x15'),'port':0x18eb});require(_0xd6e3('0x16'))['register'](socket);function respondWithStatusCode(_0x3b91ea,_0x22b2b8){_0x22b2b8=_0x22b2b8||0xcc;return function(_0x1f319c){if(_0x1f319c){return _0x3b91ea[_0xd6e3('0x17')](_0x22b2b8);}return _0x3b91ea[_0xd6e3('0x18')](_0x22b2b8)[_0xd6e3('0x19')]();};}function respondWithResult(_0x5e489c,_0x3f5076){_0x3f5076=_0x3f5076||0xc8;return function(_0x36d433){if(_0x36d433){return _0x5e489c[_0xd6e3('0x18')](_0x3f5076)[_0xd6e3('0x1a')](_0x36d433);}};}function respondWithFilteredResult(_0x57c808,_0x1b13e7){return function(_0x25f042){if(_0x25f042){var _0x45a651=_0x25f042[_0xd6e3('0x1b')],_0x356b74=_0x1b13e7[_0xd6e3('0x1c')],_0x51c0cc=_0x1b13e7[_0xd6e3('0x1c')]+_0x1b13e7[_0xd6e3('0x1d')],_0x5425f7;if(_0x51c0cc>=_0x45a651){_0x51c0cc=_0x45a651;_0x5425f7=0xc8;}else{_0x5425f7=0xce;}_0x57c808[_0xd6e3('0x18')](_0x5425f7);return _0x57c808[_0xd6e3('0x1e')](_0xd6e3('0x1f'),_0x356b74+'-'+_0x51c0cc+'/'+_0x45a651)[_0xd6e3('0x1a')](_0x25f042);}return null;};}function patchUpdates(_0xcb261e){return function(_0x6e8b05){try{jsonpatch[_0xd6e3('0x20')](_0x6e8b05,_0xcb261e,!![]);}catch(_0x3663da){return BPromise[_0xd6e3('0x21')](_0x3663da);}return _0x6e8b05['save']();};}function saveUpdates(_0x1eb134,_0x54194b){return function(_0x10a4dd){if(_0x10a4dd){return _0x10a4dd[_0xd6e3('0x22')](_0x1eb134)[_0xd6e3('0x23')](function(_0x573e7d){return _0x573e7d;});}return null;};}function removeEntity(_0x2fe5c5,_0x1b13d2){return function(_0x5b37a5){if(_0x5b37a5){return _0x5b37a5[_0xd6e3('0x24')]()['then'](function(){_0x2fe5c5[_0xd6e3('0x18')](0xcc)[_0xd6e3('0x19')]();});}};}function handleEntityNotFound(_0x39b532,_0x52e56e){return function(_0x27cac2){if(!_0x27cac2){_0x39b532[_0xd6e3('0x17')](0x194);}return _0x27cac2;};}function handleError(_0x263ed1,_0x374796){_0x374796=_0x374796||0x1f4;return function(_0x5582ef){logger[_0xd6e3('0x25')](_0x5582ef['stack']);if(_0x5582ef[_0xd6e3('0x26')]){delete _0x5582ef[_0xd6e3('0x26')];}_0x263ed1[_0xd6e3('0x18')](_0x374796)[_0xd6e3('0x27')](_0x5582ef);};}exports['show']=function(_0x5ca768,_0x32f59a){var _0x246766={'raw':![],'where':{'id':_0x5ca768[_0xd6e3('0x28')]['id']}},_0x1a9cbf={};_0x1a9cbf[_0xd6e3('0x29')]=_[_0xd6e3('0x2a')](db['DashboardItem'][_0xd6e3('0x2b')]);_0x1a9cbf['query']=_['keys'](_0x5ca768[_0xd6e3('0x2c')]);_0x1a9cbf[_0xd6e3('0x2d')]=_[_0xd6e3('0x2e')](_0x1a9cbf[_0xd6e3('0x29')],_0x1a9cbf['query']);_0x246766[_0xd6e3('0x2f')]=_[_0xd6e3('0x2e')](_0x1a9cbf['model'],qs[_0xd6e3('0x30')](_0x5ca768[_0xd6e3('0x2c')][_0xd6e3('0x30')]));_0x246766[_0xd6e3('0x2f')]=_0x246766[_0xd6e3('0x2f')][_0xd6e3('0x31')]?_0x246766[_0xd6e3('0x2f')]:_0x1a9cbf[_0xd6e3('0x29')];if(_0x5ca768[_0xd6e3('0x2c')]['includeAll']){_0x246766[_0xd6e3('0x32')]=[{'all':!![]}];}_0x246766=_[_0xd6e3('0x33')]({},_0x246766,_0x5ca768[_0xd6e3('0x34')]);return db[_0xd6e3('0x35')][_0xd6e3('0x36')](_0x246766)[_0xd6e3('0x23')](handleEntityNotFound(_0x32f59a,null))['then'](respondWithResult(_0x32f59a,null))[_0xd6e3('0x37')](handleError(_0x32f59a,null));};exports[_0xd6e3('0x24')]=function(_0x3447c6,_0x4065dc){return db['DashboardItem'][_0xd6e3('0x36')]({'where':{'id':_0x3447c6[_0xd6e3('0x28')]['id']}})[_0xd6e3('0x23')](handleEntityNotFound(_0x4065dc,null))[_0xd6e3('0x23')](removeEntity(_0x4065dc,null))[_0xd6e3('0x37')](handleError(_0x4065dc,null));};function widgetAttributes(_0x4c2199){try{switch(_0x4c2199['type']){case _0xd6e3('0x38'):return[{'name':_0xd6e3('0x39'),'value':_0x4c2199[_0xd6e3('0x39')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x0]?_0x4c2199[_0xd6e3('0x3a')][0x0][_0xd6e3('0x3b')]:undefined)||'https://'}];case _0xd6e3('0x3c'):return[{'name':_0xd6e3('0x3d'),'value':_0x4c2199['attrPath']||(_0x4c2199['attrs']&&_0x4c2199[_0xd6e3('0x3a')][0x0]?_0x4c2199[_0xd6e3('0x3a')][0x0]['value']:undefined)||''}];case _0xd6e3('0x3e'):return[{'name':_0xd6e3('0x3f'),'value':_0x4c2199[_0xd6e3('0x3f')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x0]?_0x4c2199[_0xd6e3('0x3a')][0x0][_0xd6e3('0x3b')]:undefined)||_0xd6e3('0x40')},{'name':_0xd6e3('0x41'),'value':_0x4c2199['attrTimezone']||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x1]?_0x4c2199[_0xd6e3('0x3a')][0x1]['value']:undefined)||_0xd6e3('0x42')},{'name':_0xd6e3('0x43'),'value':_0x4c2199[_0xd6e3('0x43')]||(_0x4c2199['attrs']&&_0x4c2199[_0xd6e3('0x3a')][0x2]?_0x4c2199[_0xd6e3('0x3a')][0x2][_0xd6e3('0x3b')]:undefined)||0xc}];case _0xd6e3('0x44'):return[{'name':_0xd6e3('0x45'),'value':_0x4c2199[_0xd6e3('0x45')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x0]?_0x4c2199[_0xd6e3('0x3a')][0x0][_0xd6e3('0x3b')]:undefined)||_0xd6e3('0x46')},{'name':'attrVoiceQueues','value':_0x4c2199[_0xd6e3('0x47')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x1]?_0x4c2199['attrs'][0x1][_0xd6e3('0x3b')]:undefined)||[]},{'name':'attrFontSize','value':_0x4c2199[_0xd6e3('0x43')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x2]?_0x4c2199[_0xd6e3('0x3a')][0x2][_0xd6e3('0x3b')]:undefined)||0x14}];case _0xd6e3('0x48'):case'pie-chart':return[{'name':'attrSerie1','value':_0x4c2199[_0xd6e3('0x49')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x0]?_0x4c2199[_0xd6e3('0x3a')][0x0][_0xd6e3('0x3b')]:undefined)||_0xd6e3('0x46')},{'name':_0xd6e3('0x4a'),'value':_0x4c2199[_0xd6e3('0x4a')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x1]?_0x4c2199['attrs'][0x1][_0xd6e3('0x3b')]:undefined)||null},{'name':_0xd6e3('0x4b'),'value':_0x4c2199[_0xd6e3('0x4b')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x2]?_0x4c2199['attrs'][0x2][_0xd6e3('0x3b')]:undefined)||null},{'name':_0xd6e3('0x47'),'value':_0x4c2199[_0xd6e3('0x47')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x3]?_0x4c2199[_0xd6e3('0x3a')][0x3][_0xd6e3('0x3b')]:undefined)||[]}];case'web-report':return[{'name':_0xd6e3('0x4c'),'value':_0x4c2199[_0xd6e3('0x4c')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x0]?_0x4c2199[_0xd6e3('0x3a')][0x0][_0xd6e3('0x3b')]:undefined)||null},{'name':_0xd6e3('0x4d'),'value':_0x4c2199[_0xd6e3('0x4d')]||(_0x4c2199[_0xd6e3('0x3a')]&&_0x4c2199[_0xd6e3('0x3a')][0x1]?_0x4c2199['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x28b0c4){logger[_0xd6e3('0x25')](_0xd6e3('0x4e'),JSON[_0xd6e3('0x4f')](_0x28b0c4));return[];}}exports[_0xd6e3('0x50')]=function(_0x151d65,_0x594cf9){if(_0x151d65[_0xd6e3('0x51')]){_0x151d65['body'][_0xd6e3('0x3a')]=widgetAttributes(_0x151d65['body']);}return db[_0xd6e3('0x35')][_0xd6e3('0x50')](_0x151d65[_0xd6e3('0x51')],{})[_0xd6e3('0x23')](respondWithResult(_0x594cf9,0xc9))[_0xd6e3('0x37')](handleError(_0x594cf9,null));};exports[_0xd6e3('0x22')]=function(_0x4b36f7,_0x50b233){if(_0x4b36f7['body']['id']){delete _0x4b36f7[_0xd6e3('0x51')]['id'];}_0x4b36f7[_0xd6e3('0x51')][_0xd6e3('0x3a')]=widgetAttributes(_0x4b36f7[_0xd6e3('0x51')]);return db[_0xd6e3('0x35')][_0xd6e3('0x36')]({'where':{'id':_0x4b36f7[_0xd6e3('0x28')]['id']}})['then'](handleEntityNotFound(_0x50b233,null))[_0xd6e3('0x23')](saveUpdates(_0x4b36f7[_0xd6e3('0x51')],null))[_0xd6e3('0x23')](respondWithResult(_0x50b233,null))['catch'](handleError(_0x50b233,null));}; \ No newline at end of file +var _0x32d2=['bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/environment','localhost','./dashboardItem.socket','register','status','count','offset','set','json','apply','save','update','then','destroy','sendStatus','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','params','catch','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','fast-json-patch','request-promise','moment'];(function(_0x2e5eec,_0x43844f){var _0x571f3f=function(_0x11b16d){while(--_0x11b16d){_0x2e5eec['push'](_0x2e5eec['shift']());}};_0x571f3f(++_0x43844f);}(_0x32d2,0x165));var _0x232d=function(_0x195cd1,_0x54ec93){_0x195cd1=_0x195cd1-0x0;var _0x4b6af2=_0x32d2[_0x195cd1];return _0x4b6af2;};'use strict';var jsonpatch=require(_0x232d('0x0'));var rp=require(_0x232d('0x1'));var moment=require(_0x232d('0x2'));var BPromise=require(_0x232d('0x3'));var Mustache=require(_0x232d('0x4'));var util=require(_0x232d('0x5'));var path=require('path');var sox=require(_0x232d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x232d('0x7'));var squel=require('squel');var crypto=require(_0x232d('0x8'));var jsforce=require(_0x232d('0x9'));var deskjs=require(_0x232d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x232d('0xb'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x232d('0xc'))(_0x232d('0xd'));var utils=require('../../config/utils');var config=require(_0x232d('0xe'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':_0x232d('0xf'),'port':0x18eb});require(_0x232d('0x10'))[_0x232d('0x11')](socket);function respondWithStatusCode(_0x15c8f4,_0x974817){_0x974817=_0x974817||0xcc;return function(_0x5d3a0a){if(_0x5d3a0a){return _0x15c8f4['sendStatus'](_0x974817);}return _0x15c8f4[_0x232d('0x12')](_0x974817)['end']();};}function respondWithResult(_0x6000ad,_0xce4acc){_0xce4acc=_0xce4acc||0xc8;return function(_0x988be0){if(_0x988be0){return _0x6000ad[_0x232d('0x12')](_0xce4acc)['json'](_0x988be0);}};}function respondWithFilteredResult(_0x5a3303,_0x2c3845){return function(_0x2085e1){if(_0x2085e1){var _0x3275db=_0x2085e1[_0x232d('0x13')],_0x4e948e=_0x2c3845[_0x232d('0x14')],_0x5cbba6=_0x2c3845['offset']+_0x2c3845['limit'],_0x5611b2;if(_0x5cbba6>=_0x3275db){_0x5cbba6=_0x3275db;_0x5611b2=0xc8;}else{_0x5611b2=0xce;}_0x5a3303[_0x232d('0x12')](_0x5611b2);return _0x5a3303[_0x232d('0x15')]('Content-Range',_0x4e948e+'-'+_0x5cbba6+'/'+_0x3275db)[_0x232d('0x16')](_0x2085e1);}return null;};}function patchUpdates(_0x32fa6c){return function(_0x578ddb){try{jsonpatch[_0x232d('0x17')](_0x578ddb,_0x32fa6c,!![]);}catch(_0x4d84e6){return BPromise['reject'](_0x4d84e6);}return _0x578ddb[_0x232d('0x18')]();};}function saveUpdates(_0x3cca69,_0xae5c5a){return function(_0x13a464){if(_0x13a464){return _0x13a464[_0x232d('0x19')](_0x3cca69)[_0x232d('0x1a')](function(_0xc95382){return _0xc95382;});}return null;};}function removeEntity(_0x251f17,_0x504dda){return function(_0x5009d4){if(_0x5009d4){return _0x5009d4[_0x232d('0x1b')]()[_0x232d('0x1a')](function(){_0x251f17['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fdad7,_0x366597){return function(_0x109575){if(!_0x109575){_0x2fdad7[_0x232d('0x1c')](0x194);}return _0x109575;};}function handleError(_0x4a9e78,_0x48a43a){_0x48a43a=_0x48a43a||0x1f4;return function(_0x29da09){logger['error'](_0x29da09['stack']);if(_0x29da09[_0x232d('0x1d')]){delete _0x29da09[_0x232d('0x1d')];}_0x4a9e78[_0x232d('0x12')](_0x48a43a)[_0x232d('0x1e')](_0x29da09);};}exports[_0x232d('0x1f')]=function(_0x56dce1,_0x688ef0){var _0x5848bc={'raw':![],'where':{'id':_0x56dce1['params']['id']}},_0x19b3e7={};_0x19b3e7[_0x232d('0x20')]=_[_0x232d('0x21')](db[_0x232d('0x22')][_0x232d('0x23')]);_0x19b3e7[_0x232d('0x24')]=_[_0x232d('0x21')](_0x56dce1['query']);_0x19b3e7[_0x232d('0x25')]=_[_0x232d('0x26')](_0x19b3e7[_0x232d('0x20')],_0x19b3e7[_0x232d('0x24')]);_0x5848bc[_0x232d('0x27')]=_[_0x232d('0x26')](_0x19b3e7['model'],qs[_0x232d('0x28')](_0x56dce1[_0x232d('0x24')][_0x232d('0x28')]));_0x5848bc[_0x232d('0x27')]=_0x5848bc[_0x232d('0x27')]['length']?_0x5848bc[_0x232d('0x27')]:_0x19b3e7[_0x232d('0x20')];if(_0x56dce1['query'][_0x232d('0x29')]){_0x5848bc[_0x232d('0x2a')]=[{'all':!![]}];}_0x5848bc=_[_0x232d('0x2b')]({},_0x5848bc,_0x56dce1[_0x232d('0x2c')]);return db[_0x232d('0x22')][_0x232d('0x2d')](_0x5848bc)[_0x232d('0x1a')](handleEntityNotFound(_0x688ef0,null))[_0x232d('0x1a')](respondWithResult(_0x688ef0,null))['catch'](handleError(_0x688ef0,null));};exports[_0x232d('0x1b')]=function(_0x40f326,_0x6a0aa3){return db[_0x232d('0x22')][_0x232d('0x2d')]({'where':{'id':_0x40f326[_0x232d('0x2e')]['id']}})['then'](handleEntityNotFound(_0x6a0aa3,null))[_0x232d('0x1a')](removeEntity(_0x6a0aa3,null))[_0x232d('0x2f')](handleError(_0x6a0aa3,null));};function widgetAttributes(_0x23eab8){try{switch(_0x23eab8[_0x232d('0x30')]){case _0x232d('0x31'):return[{'name':_0x232d('0x32'),'value':_0x23eab8[_0x232d('0x32')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x0]?_0x23eab8[_0x232d('0x33')][0x0][_0x232d('0x34')]:undefined)||'https://'}];case'custom':return[{'name':_0x232d('0x35'),'value':_0x23eab8[_0x232d('0x35')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x0]?_0x23eab8[_0x232d('0x33')][0x0][_0x232d('0x34')]:undefined)||''}];case _0x232d('0x36'):return[{'name':_0x232d('0x37'),'value':_0x23eab8[_0x232d('0x37')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x0]?_0x23eab8['attrs'][0x0]['value']:undefined)||_0x232d('0x38')},{'name':_0x232d('0x39'),'value':_0x23eab8[_0x232d('0x39')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x1]?_0x23eab8[_0x232d('0x33')][0x1][_0x232d('0x34')]:undefined)||'0.00'},{'name':_0x232d('0x3a'),'value':_0x23eab8[_0x232d('0x3a')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x2]?_0x23eab8['attrs'][0x2][_0x232d('0x34')]:undefined)||0xc}];case'counter':return[{'name':_0x232d('0x3b'),'value':_0x23eab8['attrMetric']||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x0]?_0x23eab8['attrs'][0x0][_0x232d('0x34')]:undefined)||_0x232d('0x3c')},{'name':_0x232d('0x3d'),'value':_0x23eab8[_0x232d('0x3d')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x1]?_0x23eab8[_0x232d('0x33')][0x1]['value']:undefined)||[]},{'name':_0x232d('0x3a'),'value':_0x23eab8[_0x232d('0x3a')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x2]?_0x23eab8[_0x232d('0x33')][0x2]['value']:undefined)||0x14}];case _0x232d('0x3e'):case'pie-chart':return[{'name':'attrSerie1','value':_0x23eab8[_0x232d('0x3f')]||(_0x23eab8['attrs']&&_0x23eab8[_0x232d('0x33')][0x0]?_0x23eab8[_0x232d('0x33')][0x0][_0x232d('0x34')]:undefined)||_0x232d('0x3c')},{'name':_0x232d('0x40'),'value':_0x23eab8[_0x232d('0x40')]||(_0x23eab8['attrs']&&_0x23eab8[_0x232d('0x33')][0x1]?_0x23eab8[_0x232d('0x33')][0x1][_0x232d('0x34')]:undefined)||null},{'name':_0x232d('0x41'),'value':_0x23eab8[_0x232d('0x41')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x2]?_0x23eab8['attrs'][0x2][_0x232d('0x34')]:undefined)||null},{'name':_0x232d('0x3d'),'value':_0x23eab8['attrVoiceQueues']||(_0x23eab8['attrs']&&_0x23eab8[_0x232d('0x33')][0x3]?_0x23eab8[_0x232d('0x33')][0x3][_0x232d('0x34')]:undefined)||[]}];case'web-report':return[{'name':_0x232d('0x42'),'value':_0x23eab8[_0x232d('0x42')]||(_0x23eab8[_0x232d('0x33')]&&_0x23eab8[_0x232d('0x33')][0x0]?_0x23eab8[_0x232d('0x33')][0x0][_0x232d('0x34')]:undefined)||null},{'name':_0x232d('0x43'),'value':_0x23eab8[_0x232d('0x43')]||(_0x23eab8['attrs']&&_0x23eab8[_0x232d('0x33')][0x1]?_0x23eab8[_0x232d('0x33')][0x1][_0x232d('0x34')]:undefined)||0x0}];default:return[];}}catch(_0x3e46b7){logger['error'](_0x232d('0x44'),JSON[_0x232d('0x45')](_0x3e46b7));return[];}}exports[_0x232d('0x46')]=function(_0xd48a1,_0x559727){if(_0xd48a1['body']){_0xd48a1[_0x232d('0x47')][_0x232d('0x33')]=widgetAttributes(_0xd48a1['body']);}return db[_0x232d('0x22')]['create'](_0xd48a1[_0x232d('0x47')],{})[_0x232d('0x1a')](respondWithResult(_0x559727,0xc9))[_0x232d('0x2f')](handleError(_0x559727,null));};exports[_0x232d('0x19')]=function(_0x52968e,_0x204f22){if(_0x52968e[_0x232d('0x47')]['id']){delete _0x52968e[_0x232d('0x47')]['id'];}_0x52968e[_0x232d('0x47')][_0x232d('0x33')]=widgetAttributes(_0x52968e[_0x232d('0x47')]);return db[_0x232d('0x22')][_0x232d('0x2d')]({'where':{'id':_0x52968e[_0x232d('0x2e')]['id']}})[_0x232d('0x1a')](handleEntityNotFound(_0x204f22,null))[_0x232d('0x1a')](saveUpdates(_0x52968e[_0x232d('0x47')],null))[_0x232d('0x1a')](respondWithResult(_0x204f22,null))[_0x232d('0x2f')](handleError(_0x204f22,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 48eb713..fca671f 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 _0x735f=['setMaxListeners','save','remove','emit','exports','events','../../mysqldb','DashboardItem'];(function(_0x5020e4,_0x2b2454){var _0x2dc190=function(_0xf7563e){while(--_0xf7563e){_0x5020e4['push'](_0x5020e4['shift']());}};_0x2dc190(++_0x2b2454);}(_0x735f,0x175));var _0xf735=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x735f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf735('0x0'));var DashboardItem=require(_0xf735('0x1'))['db'][_0xf735('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf735('0x3')](0x0);var events={'afterCreate':_0xf735('0x4'),'afterUpdate':'update','afterDestroy':_0xf735('0x5')};function emitEvent(_0x351d09){return function(_0x2b198d,_0x27940f,_0x3c7ee9){DashboardItemEvents[_0xf735('0x6')](_0x351d09+':'+_0x2b198d['id'],_0x2b198d);DashboardItemEvents['emit'](_0x351d09,_0x2b198d);_0x3c7ee9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xf735('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xd085=['hook','exports','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2168ab,_0x1421d6){var _0x284692=function(_0x5bf509){while(--_0x5bf509){_0x2168ab['push'](_0x2168ab['shift']());}};_0x284692(++_0x1421d6);}(_0xd085,0x1bb));var _0x5d08=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xd085[_0x2307fa];return _0x496486;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x5d08('0x0'))['db'][_0x5d08('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5d08('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d08('0x3'),'afterDestroy':_0x5d08('0x4')};function emitEvent(_0x1de659){return function(_0x2913b9,_0x273d65,_0x263025){DashboardItemEvents[_0x5d08('0x5')](_0x1de659+':'+_0x2913b9['id'],_0x2913b9);DashboardItemEvents[_0x5d08('0x5')](_0x1de659,_0x2913b9);_0x263025(null);};}for(var e in events){if(events[_0x5d08('0x6')](e)){var event=events[e];DashboardItem[_0x5d08('0x7')](e,emitEvent(event));}}module[_0x5d08('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 8b0ce80..a95b2ae 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(_0x4d4696,_0x1ab3a2){var _0x455048=function(_0x1548d4){while(--_0x1548d4){_0x4d4696['push'](_0x4d4696['shift']());}};_0x455048(++_0x1ab3a2);}(_0x7a54,0x106));var _0x47a5=function(_0x26a7ce,_0x329f90){_0x26a7ce=_0x26a7ce-0x0;var _0x398f87=_0x7a54[_0x26a7ce];return _0x398f87;};'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(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0x7a54,0x106));var _0x47a5=function(_0x2c9a29,_0x31f89a){_0x2c9a29=_0x2c9a29-0x0;var _0x9970a3=_0x7a54[_0x2c9a29];return _0x9970a3;};'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 ccbb245..319df65 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 _0xa9e0=['client','socket.io-emitter','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5cf90e,_0x5df405){var _0xae958d=function(_0x52c27c){while(--_0x52c27c){_0x5cf90e['push'](_0x5cf90e['shift']());}};_0xae958d(++_0x5df405);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});var socket=require(_0x0a9e('0x9'))({'host':_0x0a9e('0xa'),'port':0x18eb});require(_0x0a9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x503809,_0xe42b77,_0x56465b){return new BPromise(function(_0x52cace,_0x39753a){return client[_0x0a9e('0xc')](_0x503809,_0x56465b)[_0x0a9e('0xd')](function(_0x3ab53f){logger[_0x0a9e('0xe')](_0x0a9e('0xf'),_0xe42b77,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0xe42b77,'request\x20sent',JSON[_0x0a9e('0x10')](_0x3ab53f));if(_0x3ab53f[_0x0a9e('0x11')]){if(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x12')]===0x1f4){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f['error'][_0x0a9e('0x13')]);return _0x39753a(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x13')]);}logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f[_0x0a9e('0x11')]['message']);return _0x52cace(_0x3ab53f[_0x0a9e('0x11')]['message']);}else{logger[_0x0a9e('0xe')]('DashboardItem,\x20%s,\x20%s',_0xe42b77,_0x0a9e('0x14'));_0x52cace(_0x3ab53f[_0x0a9e('0x15')]['message']);}})[_0x0a9e('0x16')](function(_0x5a0a06){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x5a0a06);_0x39753a(_0x5a0a06);});});} \ No newline at end of file +var _0xa9e0=['client','socket.io-emitter','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});var socket=require(_0x0a9e('0x9'))({'host':_0x0a9e('0xa'),'port':0x18eb});require(_0x0a9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x503809,_0xe42b77,_0x56465b){return new BPromise(function(_0x52cace,_0x39753a){return client[_0x0a9e('0xc')](_0x503809,_0x56465b)[_0x0a9e('0xd')](function(_0x3ab53f){logger[_0x0a9e('0xe')](_0x0a9e('0xf'),_0xe42b77,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0xe42b77,'request\x20sent',JSON[_0x0a9e('0x10')](_0x3ab53f));if(_0x3ab53f[_0x0a9e('0x11')]){if(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x12')]===0x1f4){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f['error'][_0x0a9e('0x13')]);return _0x39753a(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x13')]);}logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f[_0x0a9e('0x11')]['message']);return _0x52cace(_0x3ab53f[_0x0a9e('0x11')]['message']);}else{logger[_0x0a9e('0xe')]('DashboardItem,\x20%s,\x20%s',_0xe42b77,_0x0a9e('0x14'));_0x52cace(_0x3ab53f[_0x0a9e('0x15')]['message']);}})[_0x0a9e('0x16')](function(_0x5a0a06){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x5a0a06);_0x39753a(_0x5a0a06);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6ac62d4..3e9f0e4 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(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0x34e8,0x12c));var _0x834e=function(_0x2933ef,_0x4bde23){_0x2933ef=_0x2933ef-0x0;var _0x49d8d8=_0x34e8[_0x2933ef];return _0x49d8d8;};'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 _0x7217=['dashboardItem:','./dashboardItem.events','remove','update','removeListener','register','length'];(function(_0x280405,_0x274b31){var _0x2db04d=function(_0x376a49){while(--_0x376a49){_0x280405['push'](_0x280405['shift']());}};_0x2db04d(++_0x274b31);}(_0x7217,0x19e));var _0x7721=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x7217[_0x3e112d];return _0x531c31;};'use strict';var DashboardItemEvents=require(_0x7721('0x0'));var events=['save',_0x7721('0x1'),_0x7721('0x2')];function createListener(_0x1de988,_0x2a78d8){return function(_0x115ab3){_0x2a78d8['emit'](_0x1de988,_0x115ab3);};}function removeListener(_0x5bf160,_0x472a96){return function(){DashboardItemEvents[_0x7721('0x3')](_0x5bf160,_0x472a96);};}exports[_0x7721('0x4')]=function(_0x3fe47c){for(var _0xb239e0=0x0,_0xf7ff37=events[_0x7721('0x5')];_0xb239e0<_0xf7ff37;_0xb239e0++){var _0x21f680=events[_0xb239e0];var _0x225610=createListener(_0x7721('0x6')+_0x21f680,_0x3fe47c);DashboardItemEvents['on'](_0x21f680,_0x225610);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e914d42..136fad0 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 _0xe2c9=['update','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x2e0490,_0x5873cf){var _0x2b9a24=function(_0x1a5652){while(--_0x1a5652){_0x2e0490['push'](_0x2e0490['shift']());}};_0x2b9a24(++_0x5873cf);}(_0xe2c9,0x102));var _0x9e2c=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xe2c9[_0x2576d7];return _0x16a08c;};'use strict';var multer=require('multer');var util=require(_0x9e2c('0x0'));var path=require(_0x9e2c('0x1'));var express=require('express');var router=express[_0x9e2c('0x2')]();var auth=require(_0x9e2c('0x3'));var interaction=require(_0x9e2c('0x4'));var config=require(_0x9e2c('0x5'));var controller=require(_0x9e2c('0x6'));router[_0x9e2c('0x7')]('/:id',auth[_0x9e2c('0x8')](),controller[_0x9e2c('0x9')]);router[_0x9e2c('0xa')]('/',auth['isAuthenticated'](),controller[_0x9e2c('0xb')]);router[_0x9e2c('0xc')](_0x9e2c('0xd'),auth['isAuthenticated'](),controller[_0x9e2c('0xe')]);router['delete']('/:id',auth[_0x9e2c('0x8')](),controller['destroy']);module[_0x9e2c('0xf')]=router; \ No newline at end of file +var _0xdc45=['get','/:id','show','post','isAuthenticated','create','put','delete','destroy','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xdc45,0x1cb));var _0x5dc4=function(_0x8b1f1a,_0x11f641){_0x8b1f1a=_0x8b1f1a-0x0;var _0x362089=_0xdc45[_0x8b1f1a];return _0x362089;};'use strict';var multer=require(_0x5dc4('0x0'));var util=require(_0x5dc4('0x1'));var path=require(_0x5dc4('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5dc4('0x3'));var interaction=require(_0x5dc4('0x4'));var config=require(_0x5dc4('0x5'));var controller=require('./dashboardItem.controller');router[_0x5dc4('0x6')](_0x5dc4('0x7'),auth['isAuthenticated'](),controller[_0x5dc4('0x8')]);router[_0x5dc4('0x9')]('/',auth[_0x5dc4('0xa')](),controller[_0x5dc4('0xb')]);router[_0x5dc4('0xc')](_0x5dc4('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x5dc4('0xd')]('/:id',auth[_0x5dc4('0xa')](),controller[_0x5dc4('0xe')]);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 8c2bfde..0c67a72 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 _0x603d=['exports','STRING','sequelize'];(function(_0x49fdf5,_0xddd504){var _0x55a674=function(_0x3b41ad){while(--_0x3b41ad){_0x49fdf5['push'](_0x49fdf5['shift']());}};_0x55a674(++_0xddd504);}(_0x603d,0xce));var _0xd603=function(_0xf6ad0,_0x44c790){_0xf6ad0=_0xf6ad0-0x0;var _0x25cb31=_0x603d[_0xf6ad0];return _0x25cb31;};'use strict';var Sequelize=require(_0xd603('0x0'));module[_0xd603('0x1')]={'name':{'type':Sequelize[_0xd603('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x928d=['exports','STRING','sequelize'];(function(_0x54e333,_0x4ba478){var _0x47279e=function(_0x8e4f0b){while(--_0x8e4f0b){_0x54e333['push'](_0x54e333['shift']());}};_0x47279e(++_0x4ba478);}(_0x928d,0x149));var _0xd928=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x928d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd928('0x0'));module[_0xd928('0x1')]={'name':{'type':Sequelize[_0xd928('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f8a5538..829c294 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 _0xa9e0=['update','then','destroy','end','error','name','send','index','Disposition','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','body','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save'];(function(_0x3813dc,_0x5a0165){var _0x34f9f8=function(_0x15f48d){while(--_0x15f48d){_0x3813dc['push'](_0x3813dc['shift']());}};_0x34f9f8(++_0x5a0165);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];function respondWithStatusCode(_0x3ab53f,_0xfeb75b){_0xfeb75b=_0xfeb75b||0xcc;return function(_0xbd1168){if(_0xbd1168){return _0x3ab53f['sendStatus'](_0xfeb75b);}return _0x3ab53f['status'](_0xfeb75b)['end']();};}function respondWithResult(_0x4cfe67,_0x273d4d){_0x273d4d=_0x273d4d||0xc8;return function(_0x36471c){if(_0x36471c){return _0x4cfe67[_0x0a9e('0xf')](_0x273d4d)[_0x0a9e('0x10')](_0x36471c);}};}function respondWithFilteredResult(_0x32d742,_0x69aeb7){return function(_0x5db4b0){if(_0x5db4b0){var _0x4283ce=_0x5db4b0[_0x0a9e('0x11')],_0x239b12=_0x69aeb7[_0x0a9e('0x12')],_0x2b4227=_0x69aeb7['offset']+_0x69aeb7[_0x0a9e('0x13')],_0x281129;if(_0x2b4227>=_0x4283ce){_0x2b4227=_0x4283ce;_0x281129=0xc8;}else{_0x281129=0xce;}_0x32d742['status'](_0x281129);return _0x32d742[_0x0a9e('0x14')]('Content-Range',_0x239b12+'-'+_0x2b4227+'/'+_0x4283ce)[_0x0a9e('0x10')](_0x5db4b0);}return null;};}function patchUpdates(_0x12066b){return function(_0x48f32d){try{jsonpatch[_0x0a9e('0x15')](_0x48f32d,_0x12066b,!![]);}catch(_0x5a0a06){return BPromise[_0x0a9e('0x16')](_0x5a0a06);}return _0x48f32d[_0x0a9e('0x17')]();};}function saveUpdates(_0x106033,_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x18')](_0x106033)[_0x0a9e('0x19')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae,_0x112016){return function(_0x1c696a){if(_0x1c696a){return _0x1c696a[_0x0a9e('0x1a')]()['then'](function(){_0x1314ae[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x53682f,_0x20f109){return function(_0x5a09ef){if(!_0x5a09ef){_0x53682f['sendStatus'](0x194);}return _0x5a09ef;};}function handleError(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0x1f4;return function(_0x38e7c4){logger[_0x0a9e('0x1c')](_0x38e7c4['stack']);if(_0x38e7c4[_0x0a9e('0x1d')]){delete _0x38e7c4[_0x0a9e('0x1d')];}_0x3a02e1[_0x0a9e('0xf')](_0x432e56)[_0x0a9e('0x1e')](_0x38e7c4);};}exports[_0x0a9e('0x1f')]=function(_0x42ac8f,_0x16b1ca){var _0x5ea472={},_0x59181e={},_0x197ec0={'count':0x0,'rows':[]};var _0x3a8e58=db[_0x0a9e('0x20')][_0x0a9e('0x21')];_0x59181e['model']=_[_0x0a9e('0x22')](_0x3a8e58);var _0x479bc4={'dateStart':_0x42ac8f[_0x0a9e('0x23')]['dateStart'],'dateEnd':_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')]};delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x25')];delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')];_0x59181e[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x42ac8f['query']);_0x59181e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],_0x59181e[_0x0a9e('0x23')]);_0x5ea472['attributes']=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x5ea472[_0x0a9e('0x2a')]=_0x5ea472[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x5ea472[_0x0a9e('0x2a')]:_0x59181e['model'];if(!_0x42ac8f[_0x0a9e('0x23')]['hasOwnProperty'](_0x0a9e('0x2c'))){_0x5ea472[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x5ea472['offset']=qs[_0x0a9e('0x12')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x12')]);}_0x5ea472[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x2e')]);_0x5ea472[_0x0a9e('0x2f')]=qs['filters'](_[_0x0a9e('0x30')](_0x42ac8f['query'],_0x59181e[_0x0a9e('0x26')]));if(_0x479bc4[_0x0a9e('0x25')]){if(_0x479bc4[_0x0a9e('0x24')]){_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4['dateEnd'])[_0x0a9e('0x31')](0x1,_0x0a9e('0x32'));}else{_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4[_0x0a9e('0x25')])['add'](0x1,'day');}_[_0x0a9e('0x33')](_0x5ea472['where'],{'createdAt':{'$gte':_0x479bc4[_0x0a9e('0x25')],'$lte':_0x479bc4[_0x0a9e('0x24')]}});}if(_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x5ea472['where']=_[_0x0a9e('0x33')](_0x5ea472[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x5ea472['attributes'],function(_0x1dbf74){var _0x1a180b={};_0x1a180b[_0x1dbf74]={'$like':'%'+_0x42ac8f[_0x0a9e('0x23')]['filter']+'%'};return _0x1a180b;})});}_0x5ea472=_['merge']({},_0x5ea472,_0x42ac8f[_0x0a9e('0x36')]);var _0x40d766={'where':_0x5ea472['where']};return db[_0x0a9e('0x20')][_0x0a9e('0x11')](_0x40d766)[_0x0a9e('0x19')](function(_0x148f55){_0x197ec0['count']=_0x148f55;if(_0x42ac8f['query'][_0x0a9e('0x37')]){_0x5ea472[_0x0a9e('0x38')]=[{'all':!![]}];}return db['Disposition'][_0x0a9e('0x39')](_0x5ea472);})[_0x0a9e('0x19')](function(_0x1459bb){_0x197ec0['rows']=_0x1459bb;return _0x197ec0;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x16b1ca,_0x5ea472))[_0x0a9e('0x3a')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x3b')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':!![],'where':{'id':_0x43dd5b[_0x0a9e('0x3c')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x20')][_0x0a9e('0x21')]);_0x2881b3[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x43dd5b[_0x0a9e('0x23')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x28')],_0x2881b3[_0x0a9e('0x23')]);_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x2881b3[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0xeaa5e5[_0x0a9e('0x2a')]=_0xeaa5e5[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0xeaa5e5[_0x0a9e('0x2a')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x37')]){_0xeaa5e5[_0x0a9e('0x38')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x33')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x36')]);return db[_0x0a9e('0x20')][_0x0a9e('0x3d')](_0xeaa5e5)[_0x0a9e('0x19')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x3a')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x20')]['create'](_0x473dc8[_0x0a9e('0x3e')],{})[_0x0a9e('0x19')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x3a')](handleError(_0x476688,null));};exports[_0x0a9e('0x18')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x3e')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0x45c845[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x19')](saveUpdates(_0x45c845[_0x0a9e('0x3e')],null))[_0x0a9e('0x19')](respondWithResult(_0x37be73,null))[_0x0a9e('0x3a')](handleError(_0x37be73,null));};exports[_0x0a9e('0x1a')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x20')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x19')](removeEntity(_0xe401a,null))[_0x0a9e('0x3a')](handleError(_0xe401a,null));}; \ No newline at end of file +var _0xb10b=['include','rows','show','params','rawAttributes','length','find','catch','create','body','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','Disposition','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','add','day','where','merge','filter','options','includeAll'];(function(_0x405ab9,_0x4066e5){var _0x1245ab=function(_0x1fafc2){while(--_0x1fafc2){_0x405ab9['push'](_0x405ab9['shift']());}};_0x1245ab(++_0x4066e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c082a,_0x19ac27){_0x5c082a=_0x5c082a-0x0;var _0x3b60ac=_0xb10b[_0x5c082a];return _0x3b60ac;};'use strict';var jsonpatch=require(_0xbb10('0x0'));var rp=require('request-promise');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var Mustache=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var sox=require(_0xbb10('0x5'));var csv=require(_0xbb10('0x6'));var ejs=require(_0xbb10('0x7'));var fs=require('fs');var _=require(_0xbb10('0x8'));var squel=require(_0xbb10('0x9'));var crypto=require('crypto');var jsforce=require(_0xbb10('0xa'));var deskjs=require(_0xbb10('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbb10('0xc'));var Papa=require(_0xbb10('0xd'));var qs=require(_0xbb10('0xe'));var logger=require(_0xbb10('0xf'))(_0xbb10('0x10'));var utils=require(_0xbb10('0x11'));var config=require(_0xbb10('0x12'));var db=require(_0xbb10('0x13'))['db'];function respondWithStatusCode(_0x5ab04a,_0x4e47f8){_0x4e47f8=_0x4e47f8||0xcc;return function(_0x20bd61){if(_0x20bd61){return _0x5ab04a[_0xbb10('0x14')](_0x4e47f8);}return _0x5ab04a[_0xbb10('0x15')](_0x4e47f8)['end']();};}function respondWithResult(_0x408248,_0x5be7e0){_0x5be7e0=_0x5be7e0||0xc8;return function(_0x44fb19){if(_0x44fb19){return _0x408248[_0xbb10('0x15')](_0x5be7e0)[_0xbb10('0x16')](_0x44fb19);}};}function respondWithFilteredResult(_0x193a27,_0x442548){return function(_0x147230){if(_0x147230){var _0x58a612=_0x147230[_0xbb10('0x17')],_0x26e021=_0x442548[_0xbb10('0x18')],_0x42d7e4=_0x442548[_0xbb10('0x18')]+_0x442548[_0xbb10('0x19')],_0x45b9d6;if(_0x42d7e4>=_0x58a612){_0x42d7e4=_0x58a612;_0x45b9d6=0xc8;}else{_0x45b9d6=0xce;}_0x193a27[_0xbb10('0x15')](_0x45b9d6);return _0x193a27[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x26e021+'-'+_0x42d7e4+'/'+_0x58a612)['json'](_0x147230);}return null;};}function patchUpdates(_0x2eca0f){return function(_0x1145f1){try{jsonpatch[_0xbb10('0x1c')](_0x1145f1,_0x2eca0f,!![]);}catch(_0x42db98){return BPromise[_0xbb10('0x1d')](_0x42db98);}return _0x1145f1[_0xbb10('0x1e')]();};}function saveUpdates(_0x575cca,_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1f')](_0x575cca)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d,_0x388fab){return function(_0x109908){if(_0x109908){return _0x109908[_0xbb10('0x20')]()[_0xbb10('0x21')](function(){_0x19f48d['status'](0xcc)[_0xbb10('0x22')]();});}};}function handleEntityNotFound(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(!_0x4c4b0d){_0x12ef77[_0xbb10('0x14')](0x194);}return _0x4c4b0d;};}function handleError(_0x311abe,_0x2e911d){_0x2e911d=_0x2e911d||0x1f4;return function(_0x317da4){logger[_0xbb10('0x23')](_0x317da4[_0xbb10('0x24')]);if(_0x317da4[_0xbb10('0x25')]){delete _0x317da4[_0xbb10('0x25')];}_0x311abe[_0xbb10('0x15')](_0x2e911d)[_0xbb10('0x26')](_0x317da4);};}exports[_0xbb10('0x27')]=function(_0x26ad93,_0x537898){var _0x4fedac={},_0x4fb5e0={},_0xc93a04={'count':0x0,'rows':[]};var _0x3c5ae7=db[_0xbb10('0x28')]['rawAttributes'];_0x4fb5e0[_0xbb10('0x29')]=_[_0xbb10('0x2a')](_0x3c5ae7);var _0x6ed43b={'dateStart':_0x26ad93[_0xbb10('0x2b')][_0xbb10('0x2c')],'dateEnd':_0x26ad93[_0xbb10('0x2b')][_0xbb10('0x2d')]};delete _0x26ad93['query'][_0xbb10('0x2c')];delete _0x26ad93[_0xbb10('0x2b')][_0xbb10('0x2d')];_0x4fb5e0[_0xbb10('0x2b')]=_[_0xbb10('0x2a')](_0x26ad93[_0xbb10('0x2b')]);_0x4fb5e0['filters']=_[_0xbb10('0x2e')](_0x4fb5e0['model'],_0x4fb5e0[_0xbb10('0x2b')]);_0x4fedac['attributes']=_[_0xbb10('0x2e')](_0x4fb5e0[_0xbb10('0x29')],qs[_0xbb10('0x2f')](_0x26ad93['query']['fields']));_0x4fedac[_0xbb10('0x30')]=_0x4fedac[_0xbb10('0x30')]['length']?_0x4fedac[_0xbb10('0x30')]:_0x4fb5e0[_0xbb10('0x29')];if(!_0x26ad93[_0xbb10('0x2b')][_0xbb10('0x31')](_0xbb10('0x32'))){_0x4fedac[_0xbb10('0x19')]=qs[_0xbb10('0x19')](_0x26ad93['query'][_0xbb10('0x19')]);_0x4fedac[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x26ad93[_0xbb10('0x2b')][_0xbb10('0x18')]);}_0x4fedac[_0xbb10('0x33')]=qs[_0xbb10('0x34')](_0x26ad93[_0xbb10('0x2b')][_0xbb10('0x34')]);_0x4fedac['where']=qs[_0xbb10('0x35')](_[_0xbb10('0x36')](_0x26ad93[_0xbb10('0x2b')],_0x4fb5e0[_0xbb10('0x35')]));if(_0x6ed43b['dateStart']){if(_0x6ed43b[_0xbb10('0x2d')]){_0x6ed43b['dateEnd']=moment(_0x6ed43b['dateEnd'])[_0xbb10('0x37')](0x1,_0xbb10('0x38'));}else{_0x6ed43b[_0xbb10('0x2d')]=moment(_0x6ed43b[_0xbb10('0x2c')])[_0xbb10('0x37')](0x1,_0xbb10('0x38'));}_['merge'](_0x4fedac[_0xbb10('0x39')],{'createdAt':{'$gte':_0x6ed43b[_0xbb10('0x2c')],'$lte':_0x6ed43b['dateEnd']}});}if(_0x26ad93['query']['filter']){_0x4fedac[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x4fedac[_0xbb10('0x39')],{'$or':_['map'](_0x4fedac[_0xbb10('0x30')],function(_0x3e8538){var _0x4345f3={};_0x4345f3[_0x3e8538]={'$like':'%'+_0x26ad93['query'][_0xbb10('0x3b')]+'%'};return _0x4345f3;})});}_0x4fedac=_[_0xbb10('0x3a')]({},_0x4fedac,_0x26ad93[_0xbb10('0x3c')]);var _0x446f49={'where':_0x4fedac['where']};return db[_0xbb10('0x28')][_0xbb10('0x17')](_0x446f49)['then'](function(_0xe2040f){_0xc93a04[_0xbb10('0x17')]=_0xe2040f;if(_0x26ad93[_0xbb10('0x2b')][_0xbb10('0x3d')]){_0x4fedac[_0xbb10('0x3e')]=[{'all':!![]}];}return db[_0xbb10('0x28')]['findAll'](_0x4fedac);})[_0xbb10('0x21')](function(_0x1c7fae){_0xc93a04[_0xbb10('0x3f')]=_0x1c7fae;return _0xc93a04;})[_0xbb10('0x21')](respondWithFilteredResult(_0x537898,_0x4fedac))['catch'](handleError(_0x537898,null));};exports[_0xbb10('0x40')]=function(_0x331751,_0x23dc18){var _0x403beb={'raw':!![],'where':{'id':_0x331751[_0xbb10('0x41')]['id']}},_0x5e2cfa={};_0x5e2cfa[_0xbb10('0x29')]=_['keys'](db['Disposition'][_0xbb10('0x42')]);_0x5e2cfa['query']=_[_0xbb10('0x2a')](_0x331751[_0xbb10('0x2b')]);_0x5e2cfa['filters']=_[_0xbb10('0x2e')](_0x5e2cfa[_0xbb10('0x29')],_0x5e2cfa[_0xbb10('0x2b')]);_0x403beb['attributes']=_[_0xbb10('0x2e')](_0x5e2cfa[_0xbb10('0x29')],qs[_0xbb10('0x2f')](_0x331751[_0xbb10('0x2b')][_0xbb10('0x2f')]));_0x403beb[_0xbb10('0x30')]=_0x403beb[_0xbb10('0x30')][_0xbb10('0x43')]?_0x403beb[_0xbb10('0x30')]:_0x5e2cfa[_0xbb10('0x29')];if(_0x331751[_0xbb10('0x2b')][_0xbb10('0x3d')]){_0x403beb['include']=[{'all':!![]}];}_0x403beb=_[_0xbb10('0x3a')]({},_0x403beb,_0x331751[_0xbb10('0x3c')]);return db['Disposition'][_0xbb10('0x44')](_0x403beb)[_0xbb10('0x21')](handleEntityNotFound(_0x23dc18,null))[_0xbb10('0x21')](respondWithResult(_0x23dc18,null))[_0xbb10('0x45')](handleError(_0x23dc18,null));};exports[_0xbb10('0x46')]=function(_0x39f0de,_0x3e06b0){return db['Disposition']['create'](_0x39f0de[_0xbb10('0x47')],{})[_0xbb10('0x21')](respondWithResult(_0x3e06b0,0xc9))[_0xbb10('0x45')](handleError(_0x3e06b0,null));};exports['update']=function(_0x5f0c12,_0x3cd6f3){if(_0x5f0c12[_0xbb10('0x47')]['id']){delete _0x5f0c12[_0xbb10('0x47')]['id'];}return db[_0xbb10('0x28')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x21')](saveUpdates(_0x5f0c12[_0xbb10('0x47')],null))[_0xbb10('0x21')](respondWithResult(_0x3cd6f3,null))['catch'](handleError(_0x3cd6f3,null));};exports['destroy']=function(_0x412e13,_0x467dba){return db[_0xbb10('0x28')][_0xbb10('0x44')]({'where':{'id':_0x412e13[_0xbb10('0x41')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x467dba,null))[_0xbb10('0x21')](removeEntity(_0x467dba,null))[_0xbb10('0x45')](handleError(_0x467dba,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 6d048dd..363e11b 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 _0x1a85=['ListId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','../../config/logger','api','moment','./disposition.attributes','exports','define','tools_dispositions','name'];(function(_0x2cac5a,_0x5df517){var _0x2b9323=function(_0x1a6936){while(--_0x1a6936){_0x2cac5a['push'](_0x2cac5a['shift']());}};_0x2b9323(++_0x5df517);}(_0x1a85,0x178));var _0x51a8=function(_0x399e4b,_0x18206b){_0x399e4b=_0x399e4b-0x0;var _0x62d5ab=_0x1a85[_0x399e4b];return _0x62d5ab;};'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')]('Disposition',attributes,{'tableName':_0x51a8('0x6'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x51a8('0x7'),_0x51a8('0x8')]},{'unique':!![],'name':'name_chat','fields':[_0x51a8('0x7'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x51a8('0x7'),_0x51a8('0x9')]},{'unique':!![],'name':_0x51a8('0xa'),'fields':[_0x51a8('0x7'),_0x51a8('0xb')]},{'unique':!![],'name':_0x51a8('0xc'),'fields':[_0x51a8('0x7'),_0x51a8('0xd')]},{'unique':!![],'name':_0x51a8('0xe'),'fields':[_0x51a8('0x7'),_0x51a8('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda2d=['name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','util','../../config/logger','api','moment','bluebird','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0x1a7321,_0x1cc6ca){var _0x4e2846=function(_0x30f61c){while(--_0x30f61c){_0x1a7321['push'](_0x1a7321['shift']());}};_0x4e2846(++_0x1cc6ca);}(_0xda2d,0x102));var _0xdda2=function(_0x5c9c58,_0x253e54){_0x5c9c58=_0x5c9c58-0x0;var _0x3c3dd3=_0xda2d[_0x5c9c58];return _0x3c3dd3;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var attributes=require('./disposition.attributes');module['exports']=function(_0x357e97,_0x319129){return _0x357e97[_0xdda2('0x5')](_0xdda2('0x6'),attributes,{'tableName':_0xdda2('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xdda2('0x8'),'fields':[_0xdda2('0x9'),_0xdda2('0xa')]},{'unique':!![],'name':_0xdda2('0xb'),'fields':[_0xdda2('0x9'),'ChatWebsiteId']},{'unique':!![],'name':_0xdda2('0xc'),'fields':[_0xdda2('0x9'),'MailAccountId']},{'unique':!![],'name':_0xdda2('0xd'),'fields':[_0xdda2('0x9'),_0xdda2('0xe')]},{'unique':!![],'name':_0xdda2('0xf'),'fields':[_0xdda2('0x9'),_0xdda2('0x10')]},{'unique':!![],'name':_0xdda2('0x11'),'fields':[_0xdda2('0x9'),'OpenchannelAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b5c8afe..bb71daa 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 _0x065e=['stringify','error','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x065e,0x1a7));var _0xe065=function(_0x3b6a74,_0x511aa6){_0x3b6a74=_0x3b6a74-0x0;var _0x464569=_0x065e[_0x3b6a74];return _0x464569;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var db=require(_0xe065('0x2'))['db'];var utils=require(_0xe065('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xe065('0x4'));var jayson=require(_0xe065('0x5'));var client=jayson['client'][_0xe065('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1e7e69,_0x189d72,_0x52403a){return new BPromise(function(_0x267122,_0x5afbd4){return client[_0xe065('0x7')](_0x1e7e69,_0x52403a)[_0xe065('0x8')](function(_0x3bacf3){logger[_0xe065('0x9')](_0xe065('0xa'),_0x189d72,'request\x20sent');logger[_0xe065('0xb')](_0xe065('0xc'),_0x189d72,_0xe065('0xd'),JSON[_0xe065('0xe')](_0x3bacf3));if(_0x3bacf3[_0xe065('0xf')]){if(_0x3bacf3[_0xe065('0xf')]['code']===0x1f4){logger['error'](_0xe065('0xa'),_0x189d72,_0x3bacf3[_0xe065('0xf')][_0xe065('0x10')]);return _0x5afbd4(_0x3bacf3['error'][_0xe065('0x10')]);}logger[_0xe065('0xf')](_0xe065('0xa'),_0x189d72,_0x3bacf3[_0xe065('0xf')][_0xe065('0x10')]);return _0x267122(_0x3bacf3['error'][_0xe065('0x10')]);}else{logger[_0xe065('0x9')](_0xe065('0xa'),_0x189d72,_0xe065('0xd'));_0x267122(_0x3bacf3[_0xe065('0x11')][_0xe065('0x10')]);}})[_0xe065('0x12')](function(_0x545100){logger[_0xe065('0xf')](_0xe065('0xa'),_0x189d72,_0x545100);_0x5afbd4(_0x545100);});});} \ No newline at end of file +var _0x0972=['../../config/environment','jayson/promise','client','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x3d61c6,_0x4571e6){var _0x47e0df=function(_0x25adfd){while(--_0x25adfd){_0x3d61c6['push'](_0x3d61c6['shift']());}};_0x47e0df(++_0x4571e6);}(_0x0972,0x64));var _0x2097=function(_0x50d19f,_0x270f72){_0x50d19f=_0x50d19f-0x0;var _0x204cca=_0x0972[_0x50d19f];return _0x204cca;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x2097('0x2'))['db'];var utils=require(_0x2097('0x3'));var logger=require('../../config/logger')(_0x2097('0x4'));var config=require(_0x2097('0x5'));var jayson=require(_0x2097('0x6'));var client=jayson[_0x2097('0x7')][_0x2097('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11ed13,_0x2b4f21,_0x59739f){return new BPromise(function(_0x332aac,_0x1e661a){return client[_0x2097('0x9')](_0x11ed13,_0x59739f)[_0x2097('0xa')](function(_0x3b8fac){logger['info'](_0x2097('0xb'),_0x2b4f21,_0x2097('0xc'));logger[_0x2097('0xd')](_0x2097('0xe'),_0x2b4f21,_0x2097('0xc'),JSON[_0x2097('0xf')](_0x3b8fac));if(_0x3b8fac[_0x2097('0x10')]){if(_0x3b8fac[_0x2097('0x10')][_0x2097('0x11')]===0x1f4){logger[_0x2097('0x10')](_0x2097('0xb'),_0x2b4f21,_0x3b8fac[_0x2097('0x10')][_0x2097('0x12')]);return _0x1e661a(_0x3b8fac[_0x2097('0x10')][_0x2097('0x12')]);}logger[_0x2097('0x10')](_0x2097('0xb'),_0x2b4f21,_0x3b8fac[_0x2097('0x10')][_0x2097('0x12')]);return _0x332aac(_0x3b8fac[_0x2097('0x10')]['message']);}else{logger[_0x2097('0x13')](_0x2097('0xb'),_0x2b4f21,'request\x20sent');_0x332aac(_0x3b8fac['result']['message']);}})[_0x2097('0x14')](function(_0x588396){logger[_0x2097('0x10')](_0x2097('0xb'),_0x2b4f21,_0x588396);_0x1e661a(_0x588396);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 31a7986..e616d4a 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 _0xa3b9=['index','show','post','create','put','/:id','update','delete','exports','multer','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x5e3cef,_0x3c57f5){var _0x34c370=function(_0x4bc3e4){while(--_0x4bc3e4){_0x5e3cef['push'](_0x5e3cef['shift']());}};_0x34c370(++_0x3c57f5);}(_0xa3b9,0x80));var _0x9a3b=function(_0x1a701f,_0x5208b3){_0x1a701f=_0x1a701f-0x0;var _0x3da9e1=_0xa3b9[_0x1a701f];return _0x3da9e1;};'use strict';var multer=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var path=require(_0x9a3b('0x2'));var express=require(_0x9a3b('0x3'));var router=express['Router']();var auth=require(_0x9a3b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9a3b('0x5'));var controller=require('./disposition.controller');router[_0x9a3b('0x6')]('/',auth[_0x9a3b('0x7')](),controller[_0x9a3b('0x8')]);router[_0x9a3b('0x6')]('/:id',auth[_0x9a3b('0x7')](),controller[_0x9a3b('0x9')]);router[_0x9a3b('0xa')]('/',auth[_0x9a3b('0x7')](),controller[_0x9a3b('0xb')]);router[_0x9a3b('0xc')](_0x9a3b('0xd'),auth[_0x9a3b('0x7')](),controller[_0x9a3b('0xe')]);router[_0x9a3b('0xf')](_0x9a3b('0xd'),auth[_0x9a3b('0x7')](),controller['destroy']);module[_0x9a3b('0x10')]=router; \ No newline at end of file +var _0x1ab2=['create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x1ab2,0x101));var _0x21ab=function(_0x4ec9ee,_0x4cb99b){_0x4ec9ee=_0x4ec9ee-0x0;var _0x5b22d4=_0x1ab2[_0x4ec9ee];return _0x5b22d4;};'use strict';var multer=require(_0x21ab('0x0'));var util=require(_0x21ab('0x1'));var path=require('path');var express=require(_0x21ab('0x2'));var router=express[_0x21ab('0x3')]();var auth=require(_0x21ab('0x4'));var interaction=require(_0x21ab('0x5'));var config=require('../../config/environment');var controller=require(_0x21ab('0x6'));router[_0x21ab('0x7')]('/',auth[_0x21ab('0x8')](),controller[_0x21ab('0x9')]);router[_0x21ab('0x7')](_0x21ab('0xa'),auth[_0x21ab('0x8')](),controller[_0x21ab('0xb')]);router[_0x21ab('0xc')]('/',auth['isAuthenticated'](),controller[_0x21ab('0xd')]);router[_0x21ab('0xe')](_0x21ab('0xa'),auth[_0x21ab('0x8')](),controller[_0x21ab('0xf')]);router[_0x21ab('0x10')](_0x21ab('0xa'),auth[_0x21ab('0x8')](),controller['destroy']);module[_0x21ab('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 2c110f7..7fe2859 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 _0x2720=['14400','2400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','exports','STRING','ENUM','yes','localstationid','4800','7200','9600','12000'];(function(_0x1ec178,_0x8556c5){var _0x39b2a5=function(_0x2c7f47){while(--_0x2c7f47){_0x1ec178['push'](_0x1ec178['shift']());}};_0x39b2a5(++_0x8556c5);}(_0x2720,0x13a));var _0x0272=function(_0x1601fd,_0x5116da){_0x1601fd=_0x1601fd-0x0;var _0xa108fa=_0x2720[_0x1601fd];return _0xa108fa;};'use strict';var Sequelize=require('sequelize');module[_0x0272('0x0')]={'name':{'type':Sequelize[_0x0272('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0272('0x1')]},'ecm':{'type':Sequelize[_0x0272('0x2')]('yes','no'),'defaultValue':_0x0272('0x3')},'headerinfo':{'type':Sequelize[_0x0272('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x0272('0x1')],'unique':_0x0272('0x4')},'minrate':{'type':Sequelize[_0x0272('0x2')]('2400',_0x0272('0x5'),_0x0272('0x6'),_0x0272('0x7'),_0x0272('0x8'),_0x0272('0x9')),'defaultValue':_0x0272('0x5')},'maxrate':{'type':Sequelize[_0x0272('0x2')](_0x0272('0xa'),_0x0272('0x5'),'7200',_0x0272('0x7'),_0x0272('0x8'),_0x0272('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x0272('0x1')],'defaultValue':_0x0272('0xb')},'gateway':{'type':Sequelize[_0x0272('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0272('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0272('0x2')](_0x0272('0xd'),_0x0272('0xe'),_0x0272('0xf'),_0x0272('0x10')),'defaultValue':_0x0272('0xd')},'key':{'type':Sequelize[_0x0272('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0272('0x11');}},'notificationSound':{'type':Sequelize[_0x0272('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0272('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0272('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0272('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0272('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0xcdad=['localstationid','4800','9600','12000','14400','2400','v17,v27,v29','DADHI','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','sequelize','exports','STRING','ENUM','yes'];(function(_0x3c4322,_0x145a37){var _0x225310=function(_0x51a0a2){while(--_0x51a0a2){_0x3c4322['push'](_0x3c4322['shift']());}};_0x225310(++_0x145a37);}(_0xcdad,0x175));var _0xdcda=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0xcdad[_0x429948];return _0x35d5d1;};'use strict';var Sequelize=require(_0xdcda('0x0'));module[_0xdcda('0x1')]={'name':{'type':Sequelize[_0xdcda('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdcda('0x2')]},'ecm':{'type':Sequelize[_0xdcda('0x3')](_0xdcda('0x4'),'no'),'defaultValue':_0xdcda('0x4')},'headerinfo':{'type':Sequelize[_0xdcda('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xdcda('0x2')],'unique':_0xdcda('0x5')},'minrate':{'type':Sequelize['ENUM']('2400',_0xdcda('0x6'),'7200',_0xdcda('0x7'),_0xdcda('0x8'),_0xdcda('0x9')),'defaultValue':_0xdcda('0x6')},'maxrate':{'type':Sequelize[_0xdcda('0x3')](_0xdcda('0xa'),_0xdcda('0x6'),'7200','9600','12000',_0xdcda('0x9')),'defaultValue':_0xdcda('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xdcda('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdcda('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdcda('0x3')]('SIP','IAX',_0xdcda('0xc'),_0xdcda('0xd')),'defaultValue':_0xdcda('0xe')},'key':{'type':Sequelize[_0xdcda('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdcda('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdcda('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdcda('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdcda('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdcda('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdcda('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdcda('0x11')],'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 f7c05b0..3bba76a 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 _0x9dd2=['squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./faxAccount.socket','register','http','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','FaxAccount','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','addAnswer','getAnswers','findOne','CannedAnswer','ids','addInteraction','FaxInteraction','omit','Contact','User','Owner','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','get','VoiceExtension','tech','key','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','List\x20not\x20found','Send\x20Fax\x20failed','user','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash'];(function(_0x497642,_0x55c481){var _0x351a14=function(_0xcc4e3b){while(--_0xcc4e3b){_0x497642['push'](_0x497642['shift']());}};_0x351a14(++_0x55c481);}(_0x9dd2,0xad));var _0x29dd=function(_0x29cc56,_0x572e53){_0x29cc56=_0x29cc56-0x0;var _0x816a75=_0x9dd2[_0x29cc56];return _0x816a75;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x29dd('0x0'));var moment=require(_0x29dd('0x1'));var BPromise=require(_0x29dd('0x2'));var Mustache=require(_0x29dd('0x3'));var util=require(_0x29dd('0x4'));var path=require(_0x29dd('0x5'));var sox=require(_0x29dd('0x6'));var csv=require(_0x29dd('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x29dd('0x8'));var squel=require(_0x29dd('0x9'));var crypto=require('crypto');var jsforce=require(_0x29dd('0xa'));var deskjs=require(_0x29dd('0xb'));var toCsv=require(_0x29dd('0x7'));var querystring=require(_0x29dd('0xc'));var Papa=require(_0x29dd('0xd'));var qs=require(_0x29dd('0xe'));var logger=require(_0x29dd('0xf'))(_0x29dd('0x10'));var utils=require('../../config/utils');var config=require(_0x29dd('0x11'));var db=require(_0x29dd('0x12'))['db'];var socket=require(_0x29dd('0x13'))({'host':_0x29dd('0x14'),'port':0x18eb});require(_0x29dd('0x15'))[_0x29dd('0x16')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x29dd('0x17')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x593deb,_0x5d8346,_0x7c4bd,_0x51d490){return new BPromise(function(_0x2e76b4,_0x4559fb){var _0x51245b=_0x51d490||client;return _0x51245b['request'](_0x593deb,_0x7c4bd)['then'](function(_0x1591ca){logger[_0x29dd('0x18')]('FaxAccount,\x20%s,\x20%s',_0x5d8346,_0x29dd('0x19'));logger[_0x29dd('0x1a')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5d8346,_0x29dd('0x19'),JSON[_0x29dd('0x1b')](_0x1591ca));if(_0x1591ca[_0x29dd('0x1c')]){if(_0x1591ca[_0x29dd('0x1c')][_0x29dd('0x1d')]===0x1f4){logger[_0x29dd('0x1c')](_0x29dd('0x1e'),_0x5d8346,_0x1591ca[_0x29dd('0x1c')][_0x29dd('0x1f')]);return _0x4559fb(_0x1591ca[_0x29dd('0x1c')][_0x29dd('0x1f')]);}logger[_0x29dd('0x1c')]('FaxAccount,\x20%s,\x20%s',_0x5d8346,_0x1591ca['error'][_0x29dd('0x1f')]);return _0x2e76b4(_0x1591ca[_0x29dd('0x1c')][_0x29dd('0x1f')]);}else{logger[_0x29dd('0x18')](_0x29dd('0x1e'),_0x5d8346,_0x29dd('0x19'));_0x2e76b4(_0x1591ca[_0x29dd('0x20')][_0x29dd('0x1f')]);}})[_0x29dd('0x21')](function(_0x3dd089){logger[_0x29dd('0x1c')](_0x29dd('0x1e'),_0x5d8346,_0x3dd089);_0x4559fb(_0x3dd089);});});}function respondWithStatusCode(_0x49238f,_0xd8ffa){_0xd8ffa=_0xd8ffa||0xcc;return function(_0x2eb8e7){if(_0x2eb8e7){return _0x49238f[_0x29dd('0x22')](_0xd8ffa);}return _0x49238f['status'](_0xd8ffa)[_0x29dd('0x23')]();};}function respondWithResult(_0xb04d09,_0x36da19){_0x36da19=_0x36da19||0xc8;return function(_0x19a7b5){if(_0x19a7b5){return _0xb04d09[_0x29dd('0x24')](_0x36da19)[_0x29dd('0x25')](_0x19a7b5);}};}function respondWithFilteredResult(_0x379da7,_0x3f5cfd){return function(_0x4dd17f){if(_0x4dd17f){var _0xe79788=_0x4dd17f[_0x29dd('0x26')],_0x3c98ce=_0x3f5cfd[_0x29dd('0x27')],_0x314d04=_0x3f5cfd[_0x29dd('0x27')]+_0x3f5cfd[_0x29dd('0x28')],_0x324801;if(_0x314d04>=_0xe79788){_0x314d04=_0xe79788;_0x324801=0xc8;}else{_0x324801=0xce;}_0x379da7[_0x29dd('0x24')](_0x324801);return _0x379da7[_0x29dd('0x29')](_0x29dd('0x2a'),_0x3c98ce+'-'+_0x314d04+'/'+_0xe79788)['json'](_0x4dd17f);}return null;};}function patchUpdates(_0x3fc276){return function(_0x4d61fe){try{jsonpatch[_0x29dd('0x2b')](_0x4d61fe,_0x3fc276,!![]);}catch(_0x25956c){return BPromise[_0x29dd('0x2c')](_0x25956c);}return _0x4d61fe['save']();};}function saveUpdates(_0x23a16b,_0x5197ff){return function(_0x402485){if(_0x402485){return _0x402485[_0x29dd('0x2d')](_0x23a16b)[_0x29dd('0x2e')](function(_0x5c23fb){return _0x5c23fb;});}return null;};}function removeEntity(_0xa7ced8,_0x4367aa){return function(_0x3bf389){if(_0x3bf389){return _0x3bf389[_0x29dd('0x2f')]()['then'](function(){_0xa7ced8[_0x29dd('0x24')](0xcc)[_0x29dd('0x23')]();});}};}function handleEntityNotFound(_0x879c47,_0x338bea){return function(_0x4dd1d9){if(!_0x4dd1d9){_0x879c47['sendStatus'](0x194);}return _0x4dd1d9;};}function handleError(_0x5b30eb,_0x59e8d1){_0x59e8d1=_0x59e8d1||0x1f4;return function(_0x3765a7){logger[_0x29dd('0x1c')](_0x3765a7[_0x29dd('0x30')]);if(_0x3765a7[_0x29dd('0x31')]){delete _0x3765a7[_0x29dd('0x31')];}_0x5b30eb['status'](_0x59e8d1)[_0x29dd('0x32')](_0x3765a7);};}exports[_0x29dd('0x33')]=function(_0x11becd,_0x4db644){var _0x27123c={},_0x137792={},_0x55bba4={'count':0x0,'rows':[]};var _0x23d7f3=db[_0x29dd('0x34')][_0x29dd('0x35')];_0x137792[_0x29dd('0x36')]=_['keys'](_0x23d7f3);var _0x3ff5fd={'dateStart':_0x11becd[_0x29dd('0x37')][_0x29dd('0x38')],'dateEnd':_0x11becd[_0x29dd('0x37')][_0x29dd('0x39')]};delete _0x11becd['query'][_0x29dd('0x38')];delete _0x11becd[_0x29dd('0x37')][_0x29dd('0x39')];_0x137792[_0x29dd('0x37')]=_[_0x29dd('0x3a')](_0x11becd[_0x29dd('0x37')]);_0x137792[_0x29dd('0x3b')]=_[_0x29dd('0x3c')](_0x137792[_0x29dd('0x36')],_0x137792['query']);_0x27123c[_0x29dd('0x3d')]=_[_0x29dd('0x3c')](_0x137792[_0x29dd('0x36')],qs[_0x29dd('0x3e')](_0x11becd[_0x29dd('0x37')][_0x29dd('0x3e')]));_0x27123c[_0x29dd('0x3d')]=_0x27123c[_0x29dd('0x3d')][_0x29dd('0x3f')]?_0x27123c[_0x29dd('0x3d')]:_0x137792[_0x29dd('0x36')];if(!_0x11becd[_0x29dd('0x37')][_0x29dd('0x40')](_0x29dd('0x41'))){_0x27123c[_0x29dd('0x28')]=qs[_0x29dd('0x28')](_0x11becd[_0x29dd('0x37')][_0x29dd('0x28')]);_0x27123c[_0x29dd('0x27')]=qs['offset'](_0x11becd[_0x29dd('0x37')]['offset']);}_0x27123c[_0x29dd('0x42')]=qs[_0x29dd('0x43')](_0x11becd[_0x29dd('0x37')][_0x29dd('0x43')]);_0x27123c[_0x29dd('0x44')]=qs[_0x29dd('0x3b')](_[_0x29dd('0x45')](_0x11becd[_0x29dd('0x37')],_0x137792[_0x29dd('0x3b')]));if(_0x3ff5fd[_0x29dd('0x38')]){if(_0x3ff5fd[_0x29dd('0x39')]){_0x3ff5fd[_0x29dd('0x39')]=moment(_0x3ff5fd[_0x29dd('0x39')])[_0x29dd('0x46')](0x1,_0x29dd('0x47'));}else{_0x3ff5fd[_0x29dd('0x39')]=moment(_0x3ff5fd[_0x29dd('0x38')])[_0x29dd('0x46')](0x1,_0x29dd('0x47'));}_[_0x29dd('0x48')](_0x27123c['where'],{'createdAt':{'$gte':_0x3ff5fd['dateStart'],'$lte':_0x3ff5fd[_0x29dd('0x39')]}});}if(_0x11becd['query'][_0x29dd('0x49')]){_0x27123c['where']=_[_0x29dd('0x48')](_0x27123c[_0x29dd('0x44')],{'$or':_[_0x29dd('0x4a')](_0x27123c[_0x29dd('0x3d')],function(_0x1bf6c6){var _0x275bf4={};_0x275bf4[_0x1bf6c6]={'$like':'%'+_0x11becd[_0x29dd('0x37')][_0x29dd('0x49')]+'%'};return _0x275bf4;})});}_0x27123c=_['merge']({},_0x27123c,_0x11becd[_0x29dd('0x4b')]);var _0x4c79a3={'where':_0x27123c[_0x29dd('0x44')]};return db['FaxAccount']['count'](_0x4c79a3)[_0x29dd('0x2e')](function(_0x1512e7){_0x55bba4[_0x29dd('0x26')]=_0x1512e7;if(_0x11becd['query'][_0x29dd('0x4c')]){_0x27123c[_0x29dd('0x4d')]=[{'all':!![]}];}return db['FaxAccount'][_0x29dd('0x4e')](_0x27123c);})['then'](function(_0x15626f){_0x55bba4[_0x29dd('0x4f')]=_0x15626f;return _0x55bba4;})[_0x29dd('0x2e')](respondWithFilteredResult(_0x4db644,_0x27123c))['catch'](handleError(_0x4db644,null));};exports[_0x29dd('0x50')]=function(_0x324a41,_0x332b4c){var _0x87b4bf={'raw':![],'where':{'id':_0x324a41[_0x29dd('0x51')]['id']}},_0x356ebe={};_0x356ebe[_0x29dd('0x36')]=_['keys'](db[_0x29dd('0x34')]['rawAttributes']);_0x356ebe['query']=_[_0x29dd('0x3a')](_0x324a41[_0x29dd('0x37')]);_0x356ebe['filters']=_[_0x29dd('0x3c')](_0x356ebe[_0x29dd('0x36')],_0x356ebe[_0x29dd('0x37')]);_0x87b4bf['attributes']=_[_0x29dd('0x3c')](_0x356ebe['model'],qs[_0x29dd('0x3e')](_0x324a41['query']['fields']));_0x87b4bf[_0x29dd('0x3d')]=_0x87b4bf[_0x29dd('0x3d')][_0x29dd('0x3f')]?_0x87b4bf[_0x29dd('0x3d')]:_0x356ebe['model'];if(_0x324a41[_0x29dd('0x37')][_0x29dd('0x4c')]){_0x87b4bf[_0x29dd('0x4d')]=[{'all':!![]}];}_0x87b4bf=_[_0x29dd('0x48')]({},_0x87b4bf,_0x324a41[_0x29dd('0x4b')]);return db[_0x29dd('0x34')][_0x29dd('0x52')](_0x87b4bf)[_0x29dd('0x2e')](handleEntityNotFound(_0x332b4c,null))[_0x29dd('0x2e')](respondWithResult(_0x332b4c,null))[_0x29dd('0x21')](handleError(_0x332b4c,null));};exports[_0x29dd('0x53')]=function(_0x23a249,_0x3b627c){return db[_0x29dd('0x34')][_0x29dd('0x53')](_0x23a249[_0x29dd('0x54')],{})['then'](respondWithResult(_0x3b627c,0xc9))[_0x29dd('0x21')](handleError(_0x3b627c,null));};exports['update']=function(_0x383944,_0x33f18d){if(_0x383944['body']['id']){delete _0x383944[_0x29dd('0x54')]['id'];}return db[_0x29dd('0x34')]['find']({'where':{'id':_0x383944[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x33f18d,null))[_0x29dd('0x2e')](saveUpdates(_0x383944[_0x29dd('0x54')],null))[_0x29dd('0x2e')](respondWithResult(_0x33f18d,null))[_0x29dd('0x21')](handleError(_0x33f18d,null));};exports[_0x29dd('0x2f')]=function(_0x429fe5,_0x5df505){return db['FaxAccount'][_0x29dd('0x52')]({'where':{'id':_0x429fe5[_0x29dd('0x51')]['id']}})['then'](handleEntityNotFound(_0x5df505,null))['then'](removeEntity(_0x5df505,null))[_0x29dd('0x21')](handleError(_0x5df505,null));};exports[_0x29dd('0x55')]=function(_0x57ea8b,_0x3af3d6){return db[_0x29dd('0x34')][_0x29dd('0x55')]()['then'](respondWithResult(_0x3af3d6,null))[_0x29dd('0x21')](handleError(_0x3af3d6,null));};exports[_0x29dd('0x56')]=function(_0xbec44f,_0x35c4a2,_0x310160){if(_0xbec44f[_0x29dd('0x54')]['id']){delete _0xbec44f['body']['id'];}return db[_0x29dd('0x34')][_0x29dd('0x52')]({'where':{'id':_0xbec44f[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x35c4a2,null))[_0x29dd('0x2e')](function(_0x59554f){if(_0x59554f){_0xbec44f[_0x29dd('0x54')][_0x29dd('0x57')]=_0x59554f['id'];return db[_0x29dd('0x58')][_0x29dd('0x53')](_0xbec44f[_0x29dd('0x54')]);}})[_0x29dd('0x2e')](respondWithResult(_0x35c4a2,null))[_0x29dd('0x21')](handleError(_0x35c4a2,null));};exports[_0x29dd('0x59')]=function(_0x32b0a9,_0x25fb26,_0x4b01e1){var _0x1b9fa9={'raw':![],'where':{}};var _0x403e99={};var _0x3d2c19={'count':0x0,'rows':[]};return db[_0x29dd('0x34')]['findOne']({'where':{'id':_0x32b0a9[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x25fb26,null))['then'](function(_0x267259){if(_0x267259){_0x403e99[_0x29dd('0x36')]=_[_0x29dd('0x3a')](db[_0x29dd('0x58')][_0x29dd('0x35')]);_0x403e99['query']=_[_0x29dd('0x3a')](_0x32b0a9['query']);_0x403e99[_0x29dd('0x3b')]=_['intersection'](_0x403e99[_0x29dd('0x36')],_0x403e99[_0x29dd('0x37')]);_0x1b9fa9[_0x29dd('0x3d')]=_[_0x29dd('0x3c')](_0x403e99['model'],qs[_0x29dd('0x3e')](_0x32b0a9[_0x29dd('0x37')][_0x29dd('0x3e')]));_0x1b9fa9[_0x29dd('0x3d')]=_0x1b9fa9[_0x29dd('0x3d')]['length']?_0x1b9fa9[_0x29dd('0x3d')]:_0x403e99[_0x29dd('0x36')];if(!_0x32b0a9[_0x29dd('0x37')][_0x29dd('0x40')]('nolimit')){_0x1b9fa9[_0x29dd('0x28')]=qs[_0x29dd('0x28')](_0x32b0a9[_0x29dd('0x37')][_0x29dd('0x28')]);_0x1b9fa9[_0x29dd('0x27')]=qs['offset'](_0x32b0a9[_0x29dd('0x37')][_0x29dd('0x27')]);}_0x1b9fa9[_0x29dd('0x42')]=qs[_0x29dd('0x43')](_0x32b0a9['query'][_0x29dd('0x43')]);_0x1b9fa9[_0x29dd('0x44')]=qs[_0x29dd('0x3b')](_['pick'](_0x32b0a9[_0x29dd('0x37')],_0x403e99[_0x29dd('0x3b')]));_0x1b9fa9['where'][_0x29dd('0x57')]=_0x267259['id'];if(_0x32b0a9[_0x29dd('0x37')][_0x29dd('0x49')]){_0x1b9fa9[_0x29dd('0x44')]=_['merge'](_0x1b9fa9[_0x29dd('0x44')],{'$or':_['map'](_0x1b9fa9['attributes'],function(_0x499300){var _0x3bb84e={};_0x3bb84e[_0x499300]={'$like':'%'+_0x32b0a9[_0x29dd('0x37')][_0x29dd('0x49')]+'%'};return _0x3bb84e;})});}_0x1b9fa9=_[_0x29dd('0x48')]({},_0x1b9fa9,_0x32b0a9[_0x29dd('0x4b')]);return db[_0x29dd('0x58')][_0x29dd('0x26')]({'where':_0x1b9fa9[_0x29dd('0x44')]})['then'](function(_0x1845dc){_0x3d2c19['count']=_0x1845dc;if(_0x32b0a9['query']['includeAll']){_0x1b9fa9[_0x29dd('0x4d')]=[{'all':!![]}];}return db[_0x29dd('0x58')]['findAll'](_0x1b9fa9);})['then'](function(_0x53aa91){_0x3d2c19[_0x29dd('0x4f')]=_0x53aa91;return _0x3d2c19;});}})['then'](respondWithFilteredResult(_0x25fb26,_0x1b9fa9))[_0x29dd('0x21')](handleError(_0x25fb26,null));};exports['removeDispositions']=function(_0x595205,_0x10f65f,_0x51796f){var _0x2dde00;return db[_0x29dd('0x34')][_0x29dd('0x52')]({'where':{'id':_0x595205[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x10f65f,null))['then'](function(_0x2d9d2b){if(_0x2d9d2b){return _0x2d9d2b['removeDispositions'](_0x595205[_0x29dd('0x37')]['ids']);}})[_0x29dd('0x2e')](respondWithStatusCode(_0x10f65f,null))[_0x29dd('0x21')](handleError(_0x10f65f,null));};exports[_0x29dd('0x5a')]=function(_0x4efe19,_0x2f7ac7,_0x8b1094){if(_0x4efe19['body']['id']){delete _0x4efe19[_0x29dd('0x54')]['id'];}return db[_0x29dd('0x34')]['find']({'where':{'id':_0x4efe19[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x2f7ac7,null))[_0x29dd('0x2e')](function(_0xb10677){if(_0xb10677){_0x4efe19['body'][_0x29dd('0x57')]=_0xb10677['id'];return db['CannedAnswer'][_0x29dd('0x53')](_0x4efe19[_0x29dd('0x54')]);}})['then'](respondWithResult(_0x2f7ac7,null))[_0x29dd('0x21')](handleError(_0x2f7ac7,null));};exports[_0x29dd('0x5b')]=function(_0x133834,_0x4ecd92,_0x382977){var _0x3db925={'raw':![],'where':{}};var _0x58826c={};var _0x3e67d1={'count':0x0,'rows':[]};return db[_0x29dd('0x34')][_0x29dd('0x5c')]({'where':{'id':_0x133834['params']['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x4ecd92,null))[_0x29dd('0x2e')](function(_0x321c3c){if(_0x321c3c){_0x58826c['model']=_[_0x29dd('0x3a')](db['CannedAnswer']['rawAttributes']);_0x58826c[_0x29dd('0x37')]=_[_0x29dd('0x3a')](_0x133834[_0x29dd('0x37')]);_0x58826c[_0x29dd('0x3b')]=_[_0x29dd('0x3c')](_0x58826c[_0x29dd('0x36')],_0x58826c[_0x29dd('0x37')]);_0x3db925[_0x29dd('0x3d')]=_[_0x29dd('0x3c')](_0x58826c['model'],qs[_0x29dd('0x3e')](_0x133834[_0x29dd('0x37')][_0x29dd('0x3e')]));_0x3db925[_0x29dd('0x3d')]=_0x3db925[_0x29dd('0x3d')][_0x29dd('0x3f')]?_0x3db925['attributes']:_0x58826c[_0x29dd('0x36')];if(!_0x133834[_0x29dd('0x37')][_0x29dd('0x40')]('nolimit')){_0x3db925[_0x29dd('0x28')]=qs[_0x29dd('0x28')](_0x133834[_0x29dd('0x37')][_0x29dd('0x28')]);_0x3db925[_0x29dd('0x27')]=qs['offset'](_0x133834[_0x29dd('0x37')][_0x29dd('0x27')]);}_0x3db925[_0x29dd('0x42')]=qs['sort'](_0x133834[_0x29dd('0x37')][_0x29dd('0x43')]);_0x3db925[_0x29dd('0x44')]=qs[_0x29dd('0x3b')](_[_0x29dd('0x45')](_0x133834[_0x29dd('0x37')],_0x58826c[_0x29dd('0x3b')]));_0x3db925['where'][_0x29dd('0x57')]=_0x321c3c['id'];if(_0x133834[_0x29dd('0x37')][_0x29dd('0x49')]){_0x3db925['where']=_[_0x29dd('0x48')](_0x3db925[_0x29dd('0x44')],{'$or':_[_0x29dd('0x4a')](_0x3db925[_0x29dd('0x3d')],function(_0x557a44){var _0x29657d={};_0x29657d[_0x557a44]={'$like':'%'+_0x133834[_0x29dd('0x37')][_0x29dd('0x49')]+'%'};return _0x29657d;})});}_0x3db925=_['merge']({},_0x3db925,_0x133834[_0x29dd('0x4b')]);return db['CannedAnswer'][_0x29dd('0x26')]({'where':_0x3db925[_0x29dd('0x44')]})[_0x29dd('0x2e')](function(_0x58c618){_0x3e67d1['count']=_0x58c618;if(_0x133834['query'][_0x29dd('0x4c')]){_0x3db925[_0x29dd('0x4d')]=[{'all':!![]}];}return db[_0x29dd('0x5d')][_0x29dd('0x4e')](_0x3db925);})['then'](function(_0x6e55fa){_0x3e67d1['rows']=_0x6e55fa;return _0x3e67d1;});}})[_0x29dd('0x2e')](respondWithFilteredResult(_0x4ecd92,_0x3db925))[_0x29dd('0x21')](handleError(_0x4ecd92,null));};exports['removeAnswers']=function(_0x45ac6a,_0xc63a7b,_0x5cd3ab){var _0xa8b22d;return db['FaxAccount'][_0x29dd('0x52')]({'where':{'id':_0x45ac6a['params']['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0xc63a7b,null))[_0x29dd('0x2e')](function(_0x89cdc4){if(_0x89cdc4){return _0x89cdc4['removeAnswers'](_0x45ac6a[_0x29dd('0x37')][_0x29dd('0x5e')]);}})[_0x29dd('0x2e')](respondWithStatusCode(_0xc63a7b,null))[_0x29dd('0x21')](handleError(_0xc63a7b,null));};exports[_0x29dd('0x5f')]=function(_0x4eff3c,_0x1dffc6,_0x335527){return db[_0x29dd('0x60')]['find']({'where':{'id':_0x4eff3c[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x1dffc6,null))[_0x29dd('0x2e')](function(_0x1136d4){if(_0x1136d4){return _0x1136d4['addInteraction'](_0x4eff3c[_0x29dd('0x54')][_0x29dd('0x5e')],_[_0x29dd('0x61')](_0x4eff3c['body'],[_0x29dd('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x1dffc6,null))['catch'](handleError(_0x1dffc6,null));};exports['getInteractions']=function(_0x5ddbf4,_0x4d1e46,_0x386e07){var _0x3239a5={'raw':![],'where':{}};var _0x19b33c={};var _0x440fb7={'count':0x0,'rows':[]};return db[_0x29dd('0x34')][_0x29dd('0x5c')]({'where':{'id':_0x5ddbf4[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x4d1e46,null))[_0x29dd('0x2e')](function(_0x333eef){if(_0x333eef){_0x19b33c[_0x29dd('0x36')]=_[_0x29dd('0x3a')](db[_0x29dd('0x60')][_0x29dd('0x35')]);_0x19b33c[_0x29dd('0x37')]=_[_0x29dd('0x3a')](_0x5ddbf4[_0x29dd('0x37')]);_0x19b33c['filters']=_[_0x29dd('0x3c')](_0x19b33c['model'],_0x19b33c[_0x29dd('0x37')]);_0x3239a5[_0x29dd('0x3d')]=_['intersection'](_0x19b33c['model'],qs[_0x29dd('0x3e')](_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x3e')]));_0x3239a5['attributes']=_0x3239a5[_0x29dd('0x3d')][_0x29dd('0x3f')]?_0x3239a5[_0x29dd('0x3d')]:_0x19b33c[_0x29dd('0x36')];if(!_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x40')]('nolimit')){_0x3239a5[_0x29dd('0x28')]=qs[_0x29dd('0x28')](_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x28')]);_0x3239a5['offset']=qs[_0x29dd('0x27')](_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x27')]);}_0x3239a5['order']=qs[_0x29dd('0x43')](_0x5ddbf4['query']['sort']);_0x3239a5[_0x29dd('0x44')]=qs[_0x29dd('0x3b')](_[_0x29dd('0x45')](_0x5ddbf4['query'],_0x19b33c[_0x29dd('0x3b')]));_0x3239a5[_0x29dd('0x44')]['FaxAccountId']=_0x333eef['id'];if(_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x49')]){_0x3239a5[_0x29dd('0x44')]=_['merge'](_0x3239a5[_0x29dd('0x44')],{'$or':_['map'](_0x3239a5[_0x29dd('0x3d')],function(_0x6d32e1){var _0x1d9662={};_0x1d9662[_0x6d32e1]={'$like':'%'+_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x49')]+'%'};return _0x1d9662;})});}_0x3239a5=_[_0x29dd('0x48')]({},_0x3239a5,_0x5ddbf4['options']);return db[_0x29dd('0x60')]['count']({'where':_0x3239a5[_0x29dd('0x44')]})[_0x29dd('0x2e')](function(_0x4b4f59){_0x440fb7[_0x29dd('0x26')]=_0x4b4f59;if(_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x4c')]){_0x3239a5[_0x29dd('0x4d')]=[{'model':db['CmContact'],'as':_0x29dd('0x62'),'required':![]},{'model':db[_0x29dd('0x63')],'as':_0x29dd('0x64'),'attributes':[_0x29dd('0x31'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x29dd('0x65'),'attributes':['id','name',_0x29dd('0x66')],'where':_0x5ddbf4[_0x29dd('0x37')]['tag']?{'id':_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x67')]}:undefined,'required':_0x5ddbf4[_0x29dd('0x37')][_0x29dd('0x67')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x3239a5);})[_0x29dd('0x2e')](function(_0x21996f){_0x440fb7['rows']=_0x21996f;return _0x440fb7;});}})[_0x29dd('0x2e')](respondWithFilteredResult(_0x4d1e46,_0x3239a5))['catch'](handleError(_0x4d1e46,null));};exports[_0x29dd('0x68')]=function(_0x3f539c,_0x3c632a,_0x32fcbd){return db[_0x29dd('0x34')][_0x29dd('0x5c')]({'where':{'id':_0x3f539c[_0x29dd('0x51')]['id']}})['then'](handleEntityNotFound(_0x3c632a,null))[_0x29dd('0x2e')](function(_0x4f2e7f){if(_0x4f2e7f){return db[_0x29dd('0x69')][_0x29dd('0x6a')](function(_0x472865){return db[_0x29dd('0x6b')][_0x29dd('0x2f')]({'where':{'FaxAccountId':_0x3f539c[_0x29dd('0x51')]['id']},'transaction':_0x472865})[_0x29dd('0x2e')](function(_0x572176){var _0x3051a5=_[_0x29dd('0x4a')](_0x3f539c[_0x29dd('0x54')],function(_0x63d417){_0x63d417[_0x29dd('0x57')]=_0x3f539c[_0x29dd('0x51')]['id'];return _0x63d417;});return db[_0x29dd('0x6b')][_0x29dd('0x6c')](_0x3051a5,{'transaction':_0x472865});});})['then'](function(){return db[_0x29dd('0x6b')][_0x29dd('0x6d')]({'where':{'FaxAccountId':_0x3f539c[_0x29dd('0x51')]['id']},'order':'priority'});});}})[_0x29dd('0x2e')](respondWithResult(_0x3c632a,null))['catch'](handleError(_0x3c632a,null));};exports[_0x29dd('0x6e')]=function(_0x3ef803,_0x4683f6,_0x1db310){var _0x21eac3={};var _0x7f9032={};var _0x4327cb;var _0xcc8eb1;return db[_0x29dd('0x34')][_0x29dd('0x5c')]({'where':{'id':_0x3ef803[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x4683f6,null))[_0x29dd('0x2e')](function(_0x23ab8f){if(_0x23ab8f){_0x4327cb=_0x23ab8f;_0x7f9032[_0x29dd('0x36')]=_[_0x29dd('0x3a')](db['FaxApplication'][_0x29dd('0x35')]);_0x7f9032[_0x29dd('0x37')]=_['keys'](_0x3ef803[_0x29dd('0x37')]);_0x7f9032['filters']=_[_0x29dd('0x3c')](_0x7f9032[_0x29dd('0x36')],_0x7f9032[_0x29dd('0x37')]);_0x21eac3[_0x29dd('0x3d')]=_[_0x29dd('0x3c')](_0x7f9032['model'],qs[_0x29dd('0x3e')](_0x3ef803[_0x29dd('0x37')][_0x29dd('0x3e')]));_0x21eac3[_0x29dd('0x3d')]=_0x21eac3['attributes'][_0x29dd('0x3f')]?_0x21eac3[_0x29dd('0x3d')]:_0x7f9032[_0x29dd('0x36')];_0x21eac3['order']=qs[_0x29dd('0x43')](_0x3ef803[_0x29dd('0x37')][_0x29dd('0x43')]);_0x21eac3[_0x29dd('0x44')]=qs[_0x29dd('0x3b')](_['pick'](_0x3ef803[_0x29dd('0x37')],_0x7f9032[_0x29dd('0x3b')]));if(_0x3ef803[_0x29dd('0x37')][_0x29dd('0x49')]){_0x21eac3[_0x29dd('0x44')]=_['merge'](_0x21eac3[_0x29dd('0x44')],{'$or':_[_0x29dd('0x4a')](_0x21eac3[_0x29dd('0x3d')],function(_0x2190f4){var _0x382e74={};_0x382e74[_0x2190f4]={'$like':'%'+_0x3ef803[_0x29dd('0x37')][_0x29dd('0x49')]+'%'};return _0x382e74;})});}_0x21eac3=_['merge']({},_0x21eac3,_0x3ef803[_0x29dd('0x4b')]);return _0x4327cb[_0x29dd('0x6e')](_0x21eac3);}})[_0x29dd('0x2e')](function(_0x320c0d){if(_0x320c0d){_0xcc8eb1=_0x320c0d[_0x29dd('0x3f')];if(!_0x3ef803[_0x29dd('0x37')][_0x29dd('0x40')](_0x29dd('0x41'))){_0x21eac3[_0x29dd('0x28')]=qs[_0x29dd('0x28')](_0x3ef803[_0x29dd('0x37')][_0x29dd('0x28')]);_0x21eac3[_0x29dd('0x27')]=qs[_0x29dd('0x27')](_0x3ef803[_0x29dd('0x37')]['offset']);}return _0x4327cb[_0x29dd('0x6e')](_0x21eac3);}})[_0x29dd('0x2e')](function(_0xec11da){if(_0xec11da){return _0xec11da?{'count':_0xcc8eb1,'rows':_0xec11da}:null;}})[_0x29dd('0x2e')](respondWithResult(_0x4683f6,null))[_0x29dd('0x21')](handleError(_0x4683f6,null));};function Extension(_0x2af4e5,_0x35debb,_0x3efd07,_0x142141){this[_0x29dd('0x6f')]=_0x29dd('0x70');this[_0x29dd('0x71')]=_0x2af4e5[_0x29dd('0x72')];this[_0x29dd('0x73')]=_0x142141;this[_0x29dd('0x74')]=_0x29dd('0x75');this[_0x29dd('0x76')]=_0x29dd('0x77');this['FaxAccountId']=_0x2af4e5['id'];this[_0x29dd('0x78')]=_0x35debb;this[_0x29dd('0x79')]=_0x3efd07;}function createExtensionsReciveFax(_0x3a3d0b){var _0x4f441a=0x1;var _0x491f96=[];_0x491f96[_0x29dd('0x7a')](new Extension(_0x3a3d0b,_0x4f441a,'',_0x29dd('0x7b')));_0x4f441a+=0x1;_0x491f96[_0x29dd('0x7a')](new Extension(_0x3a3d0b,_0x4f441a,_0x29dd('0x7c'),_0x29dd('0x7d')));_0x4f441a+=0x1;for(var _0x461ddd in _0x3a3d0b){if(_0x3a3d0b[_0x29dd('0x40')](_0x461ddd)&&(_0x461ddd===_0x29dd('0x7e')||_0x461ddd===_0x29dd('0x72')||_0x461ddd===_0x29dd('0x7f')||_0x461ddd===_0x29dd('0x80')||_0x461ddd===_0x29dd('0x81')||_0x461ddd===_0x29dd('0x82')||_0x461ddd===_0x29dd('0x83')||_0x461ddd===_0x29dd('0x84')||_0x461ddd===_0x29dd('0x85'))){_0x491f96[_0x29dd('0x7a')](new Extension(_0x3a3d0b,_0x4f441a,_0x29dd('0x86')+_0x461ddd+')='+_0x3a3d0b[_0x461ddd],'Set'));_0x4f441a+=0x1;}}_0x491f96[_0x29dd('0x7a')](new Extension(_0x3a3d0b,_0x4f441a,'6','Wait'));_0x4f441a+=0x1;_0x491f96[_0x29dd('0x7a')](new Extension(_0x3a3d0b,_0x4f441a,_0x29dd('0x87'),'ReceiveFax'));_0x4f441a=0x0;return _0x491f96;}exports[_0x29dd('0x88')]=function(_0x5553b8,_0x2d0c9a,_0x486e64){var _0x33b664;return db[_0x29dd('0x69')][_0x29dd('0x6a')](function(_0xc0a576){return db[_0x29dd('0x34')]['create'](_0x5553b8['body'],{'transaction':_0xc0a576})['then'](function(_0x241ebc){_0x33b664=_0x241ebc[_0x29dd('0x89')]({'plain':!![]});return db[_0x29dd('0x8a')][_0x29dd('0x6c')](createExtensionsReciveFax(_0x33b664),{'transaction':_0xc0a576});});})[_0x29dd('0x2e')](function(){return _0x33b664;})['then'](respondWithResult(_0x2d0c9a,null))['catch'](handleError(_0x2d0c9a,null));};exports['updateAccountApplications']=function(_0x5bd1f5,_0x22205c,_0x12d511){var _0x45578d;return db[_0x29dd('0x69')]['transaction'](function(_0x3e8e59){return db[_0x29dd('0x34')][_0x29dd('0x2d')](_0x5bd1f5['body'],{'where':{'id':_0x5bd1f5[_0x29dd('0x54')]['id']},'transaction':_0x3e8e59})['then'](function(_0x6474d3){return db[_0x29dd('0x8a')][_0x29dd('0x2f')]({'where':{'FaxAccountId':_0x5bd1f5['body']['id']},'transaction':_0x3e8e59})[_0x29dd('0x2e')](function(_0xe513a9){return db[_0x29dd('0x8a')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x5bd1f5[_0x29dd('0x54')],[_0x29dd('0x8b'),_0x29dd('0x8c'),'createdAt',_0x29dd('0x8d'),_0x29dd('0x8e'),_0x29dd('0x8f')])),{'transaction':_0x3e8e59});});});})[_0x29dd('0x2e')](function(){return db[_0x29dd('0x34')][_0x29dd('0x90')](_0x5bd1f5[_0x29dd('0x54')]['id']);})[_0x29dd('0x2e')](respondWithResult(_0x22205c,null))[_0x29dd('0x21')](handleError(_0x22205c,null));};exports[_0x29dd('0x91')]=function(_0xa220b3,_0x4eb980,_0x5180c0){var _0x3a80c5={'raw':!![],'where':{}};var _0x10231d={};var _0x5bd221={'count':0x0,'rows':[]};return db[_0x29dd('0x34')]['findOne']({'where':{'id':_0xa220b3[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x4eb980,null))[_0x29dd('0x2e')](function(_0x2eaf6d){if(_0x2eaf6d){_0x10231d[_0x29dd('0x36')]=_[_0x29dd('0x3a')](db[_0x29dd('0x92')][_0x29dd('0x35')]);_0x10231d[_0x29dd('0x37')]=_[_0x29dd('0x3a')](_0xa220b3[_0x29dd('0x37')]);_0x10231d['filters']=_[_0x29dd('0x3c')](_0x10231d[_0x29dd('0x36')],_0x10231d[_0x29dd('0x37')]);_0x3a80c5[_0x29dd('0x3d')]=_[_0x29dd('0x3c')](_0x10231d[_0x29dd('0x36')],qs[_0x29dd('0x3e')](_0xa220b3[_0x29dd('0x37')][_0x29dd('0x3e')]));_0x3a80c5[_0x29dd('0x3d')]=_0x3a80c5[_0x29dd('0x3d')][_0x29dd('0x3f')]?_0x3a80c5[_0x29dd('0x3d')]:_0x10231d['model'];if(!_0xa220b3[_0x29dd('0x37')][_0x29dd('0x40')]('nolimit')){_0x3a80c5[_0x29dd('0x28')]=qs[_0x29dd('0x28')](_0xa220b3['query']['limit']);_0x3a80c5[_0x29dd('0x27')]=qs[_0x29dd('0x27')](_0xa220b3['query'][_0x29dd('0x27')]);}_0x3a80c5[_0x29dd('0x42')]=qs['sort'](_0xa220b3[_0x29dd('0x37')]['sort']);_0x3a80c5[_0x29dd('0x44')]=qs[_0x29dd('0x3b')](_[_0x29dd('0x45')](_0xa220b3[_0x29dd('0x37')],_0x10231d[_0x29dd('0x3b')]));_0x3a80c5['where'][_0x29dd('0x57')]=_0x2eaf6d['id'];if(_0xa220b3[_0x29dd('0x37')]['filter']){_0x3a80c5[_0x29dd('0x44')]=_[_0x29dd('0x48')](_0x3a80c5[_0x29dd('0x44')],{'$or':_[_0x29dd('0x4a')](_0x3a80c5['attributes'],function(_0x572b90){var _0x28680f={};_0x28680f[_0x572b90]={'$like':'%'+_0xa220b3[_0x29dd('0x37')][_0x29dd('0x49')]+'%'};return _0x28680f;})});}if(_0xa220b3['query'][_0x29dd('0x93')]){var _0x4dc9de=_0xa220b3[_0x29dd('0x37')]['$gte'][_0x29dd('0x94')](',');var _0x15f56e={};_0x15f56e[_0x4dc9de[0x0]]={'$gte':moment(_0x4dc9de[0x1])[_0x29dd('0x95')](_0x29dd('0x96'))};_0x3a80c5[_0x29dd('0x44')]=_[_0x29dd('0x48')](_0x3a80c5[_0x29dd('0x44')],_0x15f56e);}_0x3a80c5=_[_0x29dd('0x48')]({},_0x3a80c5,_0xa220b3[_0x29dd('0x4b')]);return db[_0x29dd('0x92')][_0x29dd('0x26')]({'where':_0x3a80c5[_0x29dd('0x44')]})['then'](function(_0x37804d){_0x5bd221['count']=_0x37804d;if(_0xa220b3[_0x29dd('0x37')]['includeAll']){_0x3a80c5[_0x29dd('0x4d')]=[{'all':!![]}];}return db[_0x29dd('0x92')][_0x29dd('0x4e')](_0x3a80c5);})[_0x29dd('0x2e')](function(_0x4b8afa){_0x5bd221[_0x29dd('0x4f')]=_0x4b8afa;return _0x5bd221;});}})[_0x29dd('0x2e')](respondWithFilteredResult(_0x4eb980,_0x3a80c5))['catch'](handleError(_0x4eb980,null));};exports[_0x29dd('0x32')]=function(_0x18dee8,_0xc349fd,_0x3cd477){var _0x54cfa3,_0x423c9a={},_0x5d4c8b;if(_0x18dee8[_0x29dd('0x54')]['to']){_0x5d4c8b=_0x18dee8[_0x29dd('0x54')]['to'][0x0];}return db[_0x29dd('0x34')][_0x29dd('0x52')]({'where':{'id':_0x18dee8[_0x29dd('0x51')]['id']},'include':[{'model':db[_0x29dd('0x97')],'as':_0x29dd('0x98'),'include':[{'model':db[_0x29dd('0x99')],'as':_0x29dd('0x9a'),'where':{'fax':_0x5d4c8b},'limit':0x1,'order':[[_0x29dd('0x8d'),_0x29dd('0x9b')]]}]}]})['then'](handleEntityNotFound(_0xc349fd,null))[_0x29dd('0x2e')](function(_0x35859f){_0x54cfa3=_0x35859f;if(_0x18dee8[_0x29dd('0x54')]['attachments']&&_0x18dee8[_0x29dd('0x54')][_0x29dd('0x9c')][_0x29dd('0x3f')]){for(var _0x2136e4=0x0;_0x2136e4<_0x18dee8[_0x29dd('0x54')][_0x29dd('0x9c')]['length'];_0x2136e4+=0x1){_0x18dee8['body'][_0x29dd('0x9c')][_0x2136e4]={'filename':_0x18dee8[_0x29dd('0x54')][_0x29dd('0x9c')][_0x2136e4][_0x29dd('0x31')],'id':_0x18dee8[_0x29dd('0x54')][_0x29dd('0x9c')][_0x2136e4]['id'],'path':path[_0x29dd('0x9d')](config[_0x29dd('0x9e')],_0x29dd('0x9f'),_0x18dee8[_0x29dd('0x54')]['attachments'][_0x2136e4]['basename'])};}}return respondWithRpcPromise(_0x29dd('0xa0'),_0x29dd('0xa0'),{'FaxAccountId':_[_0x29dd('0xa1')](_0x18dee8[_0x29dd('0x51')]['id'])?undefined:_0x18dee8[_0x29dd('0x51')]['id'],'path':_[_0x29dd('0xa1')](_0x18dee8[_0x29dd('0x54')]['attachments'][0x0][_0x29dd('0x5')])?undefined:_0x18dee8[_0x29dd('0x54')]['attachments'][0x0]['path'],'fax':_[_0x29dd('0xa1')](_0x18dee8[_0x29dd('0x54')]['to'][0x0])?undefined:_0x18dee8[_0x29dd('0x54')]['to'][0x0]},client9002);})[_0x29dd('0x2e')](function(){if(_0x54cfa3){if(_[_0x29dd('0xa1')](_0x18dee8[_0x29dd('0x54')]['from'])){_0x18dee8['body'][_0x29dd('0xa2')]=util['format'](_0x29dd('0xa3'),_0x54cfa3[_0x29dd('0x31')],_0x54cfa3['fax']);}if(_0x54cfa3[_0x29dd('0x98')]){if(_0x54cfa3[_0x29dd('0x98')][_0x29dd('0x9a')][_0x29dd('0x3f')]){return _0x54cfa3[_0x29dd('0x98')][_0x29dd('0x9a')][0x0];}else{return db[_0x29dd('0x99')]['create'](_[_0x29dd('0xa4')](_0x18dee8[_0x29dd('0x54')],{'firstName':_0x18dee8['body']['to'][0x0],'phone':_0x18dee8[_0x29dd('0x54')]['to'][0x0],'fax':_0x18dee8[_0x29dd('0x54')]['to'][0x0],'ListId':_0x54cfa3[_0x29dd('0x8f')]}));}}else{throw new Error(_0x29dd('0xa5'));}}else{throw new Error(_0x29dd('0xa6'));}})[_0x29dd('0x2e')](function(_0x7ac9f4){if(_0x7ac9f4){return db[_0x29dd('0x60')][_0x29dd('0x52')]({'where':{'ContactId':_0x7ac9f4['id'],'closed':![],'FaxAccountId':_0x54cfa3['id']}})[_0x29dd('0x2e')](function(_0x54fd3b){if(_0x54fd3b){return[_0x54fd3b,![]];}return db[_0x29dd('0x60')]['create']({'UserId':_0x18dee8[_0x29dd('0xa7')]['id'],'ContactId':_0x7ac9f4['id'],'FaxAccountId':_0x54cfa3['id'],'fax':_0x18dee8[_0x29dd('0x54')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x29dd('0x48')](_0x18dee8['body'],{'read':![],'body':_0x18dee8['body'][_0x29dd('0x9c')][0x0][_0x29dd('0xa8')],'FaxAccountId':_0x54cfa3['id'],'UserId':_0x18dee8[_0x29dd('0xa7')]['id'],'ContactId':_0x7ac9f4['id'],'AttachmentId':_0x18dee8['body'][_0x29dd('0x9c')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x29dd('0xa9')}]})['then'](function(_0x20a11e){return[_0x20a11e,!![]];});});}else{throw new Error(_0x29dd('0xaa'));}})[_0x29dd('0xab')](function(_0x32b56b,_0x10597a){if(_0x10597a){return _0x32b56b;}return db[_0x29dd('0x92')]['create']({'direction':_0x29dd('0xac'),'read':![],'body':_0x18dee8[_0x29dd('0x54')][_0x29dd('0x9c')][0x0][_0x29dd('0xa8')],'FaxAccountId':_0x54cfa3['id'],'FaxInteractionId':_0x32b56b['id'],'UserId':_0x18dee8[_0x29dd('0xa7')]['id'],'ContactId':_0x32b56b[_0x29dd('0xad')],'AttachmentId':_0x18dee8[_0x29dd('0x54')]['attachments'][0x0]['id']})[_0x29dd('0x2e')](function(_0x5e5d19){_0x32b56b['dataValues'][_0x29dd('0xa9')]=[];_0x32b56b['dataValues']['Messages']['push'](_0x5e5d19[_0x29dd('0xae')]);return _0x32b56b;});})['then'](function(_0x470058){respondWithRpcPromise('SendFax',_0x29dd('0xaf'),{'FaxAccountId':_[_0x29dd('0xa1')](_0x18dee8['params']['id'])?undefined:_0x18dee8[_0x29dd('0x51')]['id'],'path':_[_0x29dd('0xa1')](_0x18dee8[_0x29dd('0x54')][_0x29dd('0x9c')][0x0][_0x29dd('0x5')])?undefined:_0x18dee8[_0x29dd('0x54')][_0x29dd('0x9c')][0x0][_0x29dd('0x5')],'fax':_[_0x29dd('0xa1')](_0x18dee8[_0x29dd('0x54')]['to'][0x0])?undefined:_0x18dee8[_0x29dd('0x54')]['to'][0x0],'AttachmentId':_0x18dee8[_0x29dd('0x54')][_0x29dd('0x9c')][0x0]['id']},client9002)[_0x29dd('0x2e')](function(_0xe4da34){logger['info'](_0x29dd('0xb0'),_0xe4da34);})[_0x29dd('0x21')](function(_0x332eed){logger[_0x29dd('0x18')](_0x29dd('0xb0'),_0x332eed);});return _0x470058;})['then'](respondWithResult(_0xc349fd,null))[_0x29dd('0x21')](handleError(_0xc349fd,null));};exports['addAgents']=function(_0x5a766c,_0x41fc36,_0x4059c9){return db['FaxAccount'][_0x29dd('0x52')]({'where':{'id':_0x5a766c[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x41fc36,null))['then'](function(_0x2545bd){if(_0x2545bd){return _0x2545bd[_0x29dd('0xb1')](_0x5a766c['body'][_0x29dd('0x5e')],_[_0x29dd('0x61')](_0x5a766c[_0x29dd('0x54')],[_0x29dd('0x5e'),'id'])||{})[_0x29dd('0xab')](function(_0x42e2f8){for(var _0x5a015c=0x0;_0x5a015c<_0x5a766c[_0x29dd('0x54')][_0x29dd('0x5e')]['length'];_0x5a015c+=0x1){socket[_0x29dd('0xb2')]('userFaxAccount:save',{'UserId':_0x5a766c[_0x29dd('0x54')][_0x29dd('0x5e')][_0x5a015c],'FaxAccountId':_0x5a766c['params']['id']});}return _0x42e2f8;});}})[_0x29dd('0x2e')](respondWithResult(_0x41fc36,null))[_0x29dd('0x21')](handleError(_0x41fc36,null));};exports[_0x29dd('0xb3')]=function(_0x168471,_0x30897d,_0x5e690c){var _0x1a8d2f;return db[_0x29dd('0x34')][_0x29dd('0x52')]({'where':{'id':_0x168471[_0x29dd('0x51')]['id']}})['then'](handleEntityNotFound(_0x30897d,null))['then'](function(_0xe02dd6){if(_0xe02dd6){return _0xe02dd6[_0x29dd('0xb3')](_0x168471[_0x29dd('0x37')][_0x29dd('0x5e')])[_0x29dd('0x2e')](function(_0x4f2827){if(_['isArray'](_0x168471[_0x29dd('0x37')][_0x29dd('0x5e')])){for(var _0x246634=0x0;_0x246634<_0x168471[_0x29dd('0x37')][_0x29dd('0x5e')][_0x29dd('0x3f')];_0x246634+=0x1){socket[_0x29dd('0xb2')]('userFaxAccount:remove',{'UserId':_0x168471[_0x29dd('0x37')][_0x29dd('0x5e')][_0x246634],'FaxAccountId':_0x168471[_0x29dd('0x51')]['id']});}}else{socket[_0x29dd('0xb2')](_0x29dd('0xb4'),{'UserId':_0x168471[_0x29dd('0x37')]['ids'],'FaxAccountId':_0x168471[_0x29dd('0x51')]['id']});}});}})[_0x29dd('0x2e')](respondWithStatusCode(_0x30897d,null))[_0x29dd('0x21')](handleError(_0x30897d,null));};exports[_0x29dd('0xb5')]=function(_0x4cc805,_0x18d2fd,_0x48efe5){var _0x24e9da={};var _0x3788d9={};var _0x436e17;var _0x39f2f1;return db[_0x29dd('0x34')][_0x29dd('0x5c')]({'where':{'id':_0x4cc805[_0x29dd('0x51')]['id']}})[_0x29dd('0x2e')](handleEntityNotFound(_0x18d2fd,null))['then'](function(_0x47dbcf){if(_0x47dbcf){_0x436e17=_0x47dbcf;_0x3788d9['model']=_[_0x29dd('0x3a')](db[_0x29dd('0x63')][_0x29dd('0x35')]);_0x3788d9[_0x29dd('0x37')]=_[_0x29dd('0x3a')](_0x4cc805[_0x29dd('0x37')]);_0x3788d9[_0x29dd('0x3b')]=_[_0x29dd('0x3c')](_0x3788d9['model'],_0x3788d9[_0x29dd('0x37')]);_0x24e9da['attributes']=_[_0x29dd('0x3c')](_0x3788d9[_0x29dd('0x36')],qs[_0x29dd('0x3e')](_0x4cc805[_0x29dd('0x37')]['fields']));_0x24e9da[_0x29dd('0x3d')]=_0x24e9da[_0x29dd('0x3d')][_0x29dd('0x3f')]?_0x24e9da['attributes']:_0x3788d9['model'];_0x24e9da[_0x29dd('0x42')]=qs[_0x29dd('0x43')](_0x4cc805[_0x29dd('0x37')][_0x29dd('0x43')]);_0x24e9da[_0x29dd('0x44')]=qs[_0x29dd('0x3b')](_[_0x29dd('0x45')](_0x4cc805['query'],_0x3788d9[_0x29dd('0x3b')]));if(_0x4cc805[_0x29dd('0x37')][_0x29dd('0x49')]){_0x24e9da[_0x29dd('0x44')]=_[_0x29dd('0x48')](_0x24e9da[_0x29dd('0x44')],{'$or':_[_0x29dd('0x4a')](_0x24e9da[_0x29dd('0x3d')],function(_0x13f76f){var _0x50b2ce={};_0x50b2ce[_0x13f76f]={'$like':'%'+_0x4cc805[_0x29dd('0x37')]['filter']+'%'};return _0x50b2ce;})});}_0x24e9da=_['merge']({},_0x24e9da,_0x4cc805['options']);return _0x436e17['getAgents'](_0x24e9da);}})[_0x29dd('0x2e')](function(_0x50d7ef){if(_0x50d7ef){_0x39f2f1=_0x50d7ef[_0x29dd('0x3f')];if(!_0x4cc805['query'][_0x29dd('0x40')](_0x29dd('0x41'))){_0x24e9da[_0x29dd('0x28')]=qs[_0x29dd('0x28')](_0x4cc805['query']['limit']);_0x24e9da['offset']=qs['offset'](_0x4cc805[_0x29dd('0x37')][_0x29dd('0x27')]);}return _0x436e17[_0x29dd('0xb5')](_0x24e9da);}})[_0x29dd('0x2e')](function(_0x46e5d3){if(_0x46e5d3){return _0x46e5d3?{'count':_0x39f2f1,'rows':_0x46e5d3}:null;}})[_0x29dd('0x2e')](respondWithResult(_0x18d2fd,null))[_0x29dd('0x21')](handleError(_0x18d2fd,null));}; \ No newline at end of file +var _0xd97a=['format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','Send\x20Fax\x20failed','user','out','filename','FaxMessage','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','socket.io-emitter','register','http','client','request','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','stack','name','index','FaxAccount','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','add','day','merge','filter','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','destroy','describe','addDisposition','FaxAccountId','Disposition','getDispositions','sort','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','map','removeAnswers','ids','addInteraction','omit','getInteractions','findOne','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Wait','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','$gte'];(function(_0x410905,_0x92da09){var _0x4bd189=function(_0x5f3071){while(--_0x5f3071){_0x410905['push'](_0x410905['shift']());}};_0x4bd189(++_0x92da09);}(_0xd97a,0x188));var _0xad97=function(_0x1883bc,_0x5b9680){_0x1883bc=_0x1883bc-0x0;var _0x50ff73=_0xd97a[_0x1883bc];return _0x50ff73;};'use strict';var jsonpatch=require(_0xad97('0x0'));var rp=require(_0xad97('0x1'));var moment=require(_0xad97('0x2'));var BPromise=require(_0xad97('0x3'));var Mustache=require(_0xad97('0x4'));var util=require(_0xad97('0x5'));var path=require(_0xad97('0x6'));var sox=require(_0xad97('0x7'));var csv=require(_0xad97('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xad97('0x9'));var squel=require('squel');var crypto=require(_0xad97('0xa'));var jsforce=require(_0xad97('0xb'));var deskjs=require(_0xad97('0xc'));var toCsv=require('to-csv');var querystring=require(_0xad97('0xd'));var Papa=require('papaparse');var qs=require(_0xad97('0xe'));var logger=require(_0xad97('0xf'))('api');var utils=require(_0xad97('0x10'));var config=require('../../config/environment');var db=require(_0xad97('0x11'))['db'];var socket=require(_0xad97('0x12'))({'host':'localhost','port':0x18eb});require('./faxAccount.socket')[_0xad97('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xad97('0x14')]({'port':0x232c});var client9002=jayson[_0xad97('0x15')][_0xad97('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x28aad1,_0x3985e3,_0x1b95e8,_0x3300e5){return new BPromise(function(_0x504ab1,_0x2507b0){var _0x526fb7=_0x3300e5||client;return _0x526fb7[_0xad97('0x16')](_0x28aad1,_0x1b95e8)[_0xad97('0x17')](function(_0x445e94){logger[_0xad97('0x18')]('FaxAccount,\x20%s,\x20%s',_0x3985e3,'request\x20sent');logger['debug'](_0xad97('0x19'),_0x3985e3,_0xad97('0x1a'),JSON[_0xad97('0x1b')](_0x445e94));if(_0x445e94[_0xad97('0x1c')]){if(_0x445e94[_0xad97('0x1c')][_0xad97('0x1d')]===0x1f4){logger[_0xad97('0x1c')]('FaxAccount,\x20%s,\x20%s',_0x3985e3,_0x445e94[_0xad97('0x1c')][_0xad97('0x1e')]);return _0x2507b0(_0x445e94['error'][_0xad97('0x1e')]);}logger[_0xad97('0x1c')]('FaxAccount,\x20%s,\x20%s',_0x3985e3,_0x445e94[_0xad97('0x1c')][_0xad97('0x1e')]);return _0x504ab1(_0x445e94['error']['message']);}else{logger[_0xad97('0x18')](_0xad97('0x1f'),_0x3985e3,'request\x20sent');_0x504ab1(_0x445e94[_0xad97('0x20')][_0xad97('0x1e')]);}})['catch'](function(_0x1f0e83){logger[_0xad97('0x1c')](_0xad97('0x1f'),_0x3985e3,_0x1f0e83);_0x2507b0(_0x1f0e83);});});}function respondWithStatusCode(_0x435991,_0x2bc8a0){_0x2bc8a0=_0x2bc8a0||0xcc;return function(_0x21a826){if(_0x21a826){return _0x435991[_0xad97('0x21')](_0x2bc8a0);}return _0x435991[_0xad97('0x22')](_0x2bc8a0)['end']();};}function respondWithResult(_0x293a5f,_0x227bb6){_0x227bb6=_0x227bb6||0xc8;return function(_0x1d9f6b){if(_0x1d9f6b){return _0x293a5f[_0xad97('0x22')](_0x227bb6)['json'](_0x1d9f6b);}};}function respondWithFilteredResult(_0x97d3e6,_0x2d117c){return function(_0x270c17){if(_0x270c17){var _0xa575ef=_0x270c17[_0xad97('0x23')],_0x2e9243=_0x2d117c['offset'],_0x33bdb8=_0x2d117c[_0xad97('0x24')]+_0x2d117c['limit'],_0x5d9073;if(_0x33bdb8>=_0xa575ef){_0x33bdb8=_0xa575ef;_0x5d9073=0xc8;}else{_0x5d9073=0xce;}_0x97d3e6[_0xad97('0x22')](_0x5d9073);return _0x97d3e6[_0xad97('0x25')](_0xad97('0x26'),_0x2e9243+'-'+_0x33bdb8+'/'+_0xa575ef)[_0xad97('0x27')](_0x270c17);}return null;};}function patchUpdates(_0x5c04d7){return function(_0x35d25b){try{jsonpatch[_0xad97('0x28')](_0x35d25b,_0x5c04d7,!![]);}catch(_0x2db9fe){return BPromise[_0xad97('0x29')](_0x2db9fe);}return _0x35d25b[_0xad97('0x2a')]();};}function saveUpdates(_0x2ae299,_0x11ea85){return function(_0x11fa49){if(_0x11fa49){return _0x11fa49[_0xad97('0x2b')](_0x2ae299)['then'](function(_0x25b2ef){return _0x25b2ef;});}return null;};}function removeEntity(_0x3a9ca4,_0x2f0d37){return function(_0x5eb4bd){if(_0x5eb4bd){return _0x5eb4bd['destroy']()[_0xad97('0x17')](function(){_0x3a9ca4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f24c,_0x2a9b2a){return function(_0x3156ea){if(!_0x3156ea){_0x43f24c['sendStatus'](0x194);}return _0x3156ea;};}function handleError(_0x353138,_0x403555){_0x403555=_0x403555||0x1f4;return function(_0x1c2832){logger[_0xad97('0x1c')](_0x1c2832[_0xad97('0x2c')]);if(_0x1c2832[_0xad97('0x2d')]){delete _0x1c2832[_0xad97('0x2d')];}_0x353138[_0xad97('0x22')](_0x403555)['send'](_0x1c2832);};}exports[_0xad97('0x2e')]=function(_0x13b239,_0x577236){var _0x2b5e5a={},_0x9d3fd4={},_0x18741e={'count':0x0,'rows':[]};var _0x262477=db[_0xad97('0x2f')][_0xad97('0x30')];_0x9d3fd4[_0xad97('0x31')]=_[_0xad97('0x32')](_0x262477);var _0x4b9911={'dateStart':_0x13b239['query'][_0xad97('0x33')],'dateEnd':_0x13b239[_0xad97('0x34')]['dateEnd']};delete _0x13b239[_0xad97('0x34')][_0xad97('0x33')];delete _0x13b239[_0xad97('0x34')][_0xad97('0x35')];_0x9d3fd4[_0xad97('0x34')]=_[_0xad97('0x32')](_0x13b239[_0xad97('0x34')]);_0x9d3fd4[_0xad97('0x36')]=_[_0xad97('0x37')](_0x9d3fd4[_0xad97('0x31')],_0x9d3fd4[_0xad97('0x34')]);_0x2b5e5a[_0xad97('0x38')]=_[_0xad97('0x37')](_0x9d3fd4['model'],qs[_0xad97('0x39')](_0x13b239[_0xad97('0x34')][_0xad97('0x39')]));_0x2b5e5a[_0xad97('0x38')]=_0x2b5e5a['attributes']['length']?_0x2b5e5a[_0xad97('0x38')]:_0x9d3fd4[_0xad97('0x31')];if(!_0x13b239[_0xad97('0x34')][_0xad97('0x3a')](_0xad97('0x3b'))){_0x2b5e5a[_0xad97('0x3c')]=qs[_0xad97('0x3c')](_0x13b239[_0xad97('0x34')]['limit']);_0x2b5e5a[_0xad97('0x24')]=qs['offset'](_0x13b239[_0xad97('0x34')][_0xad97('0x24')]);}_0x2b5e5a[_0xad97('0x3d')]=qs['sort'](_0x13b239[_0xad97('0x34')]['sort']);_0x2b5e5a[_0xad97('0x3e')]=qs[_0xad97('0x36')](_['pick'](_0x13b239[_0xad97('0x34')],_0x9d3fd4['filters']));if(_0x4b9911['dateStart']){if(_0x4b9911['dateEnd']){_0x4b9911[_0xad97('0x35')]=moment(_0x4b9911[_0xad97('0x35')])[_0xad97('0x3f')](0x1,_0xad97('0x40'));}else{_0x4b9911[_0xad97('0x35')]=moment(_0x4b9911['dateStart'])['add'](0x1,_0xad97('0x40'));}_[_0xad97('0x41')](_0x2b5e5a['where'],{'createdAt':{'$gte':_0x4b9911['dateStart'],'$lte':_0x4b9911[_0xad97('0x35')]}});}if(_0x13b239[_0xad97('0x34')]['filter']){_0x2b5e5a[_0xad97('0x3e')]=_[_0xad97('0x41')](_0x2b5e5a[_0xad97('0x3e')],{'$or':_['map'](_0x2b5e5a[_0xad97('0x38')],function(_0x34d5f5){var _0x102201={};_0x102201[_0x34d5f5]={'$like':'%'+_0x13b239['query'][_0xad97('0x42')]+'%'};return _0x102201;})});}_0x2b5e5a=_[_0xad97('0x41')]({},_0x2b5e5a,_0x13b239[_0xad97('0x43')]);var _0xa1e1e2={'where':_0x2b5e5a['where']};return db['FaxAccount'][_0xad97('0x23')](_0xa1e1e2)[_0xad97('0x17')](function(_0x34b3f5){_0x18741e[_0xad97('0x23')]=_0x34b3f5;if(_0x13b239[_0xad97('0x34')][_0xad97('0x44')]){_0x2b5e5a['include']=[{'all':!![]}];}return db[_0xad97('0x2f')][_0xad97('0x45')](_0x2b5e5a);})[_0xad97('0x17')](function(_0x1d97fa){_0x18741e[_0xad97('0x46')]=_0x1d97fa;return _0x18741e;})[_0xad97('0x17')](respondWithFilteredResult(_0x577236,_0x2b5e5a))[_0xad97('0x47')](handleError(_0x577236,null));};exports['show']=function(_0x503be6,_0x35812b){var _0x48cbcc={'raw':![],'where':{'id':_0x503be6[_0xad97('0x48')]['id']}},_0x33e0eb={};_0x33e0eb['model']=_['keys'](db[_0xad97('0x2f')][_0xad97('0x30')]);_0x33e0eb[_0xad97('0x34')]=_[_0xad97('0x32')](_0x503be6[_0xad97('0x34')]);_0x33e0eb['filters']=_[_0xad97('0x37')](_0x33e0eb['model'],_0x33e0eb['query']);_0x48cbcc[_0xad97('0x38')]=_[_0xad97('0x37')](_0x33e0eb['model'],qs[_0xad97('0x39')](_0x503be6[_0xad97('0x34')][_0xad97('0x39')]));_0x48cbcc[_0xad97('0x38')]=_0x48cbcc[_0xad97('0x38')][_0xad97('0x49')]?_0x48cbcc[_0xad97('0x38')]:_0x33e0eb[_0xad97('0x31')];if(_0x503be6[_0xad97('0x34')]['includeAll']){_0x48cbcc[_0xad97('0x4a')]=[{'all':!![]}];}_0x48cbcc=_[_0xad97('0x41')]({},_0x48cbcc,_0x503be6[_0xad97('0x43')]);return db[_0xad97('0x2f')][_0xad97('0x4b')](_0x48cbcc)['then'](handleEntityNotFound(_0x35812b,null))['then'](respondWithResult(_0x35812b,null))[_0xad97('0x47')](handleError(_0x35812b,null));};exports['create']=function(_0x251e84,_0x65288c){return db[_0xad97('0x2f')][_0xad97('0x4c')](_0x251e84[_0xad97('0x4d')],{})[_0xad97('0x17')](respondWithResult(_0x65288c,0xc9))[_0xad97('0x47')](handleError(_0x65288c,null));};exports[_0xad97('0x2b')]=function(_0x43c9aa,_0xe6002e){if(_0x43c9aa[_0xad97('0x4d')]['id']){delete _0x43c9aa[_0xad97('0x4d')]['id'];}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x43c9aa['params']['id']}})[_0xad97('0x17')](handleEntityNotFound(_0xe6002e,null))['then'](saveUpdates(_0x43c9aa[_0xad97('0x4d')],null))['then'](respondWithResult(_0xe6002e,null))[_0xad97('0x47')](handleError(_0xe6002e,null));};exports[_0xad97('0x4e')]=function(_0x2f62ec,_0x6f5b7a){return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x2f62ec[_0xad97('0x48')]['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x6f5b7a,null))['then'](removeEntity(_0x6f5b7a,null))[_0xad97('0x47')](handleError(_0x6f5b7a,null));};exports[_0xad97('0x4f')]=function(_0x528a6e,_0x5b1471){return db['FaxAccount'][_0xad97('0x4f')]()['then'](respondWithResult(_0x5b1471,null))['catch'](handleError(_0x5b1471,null));};exports[_0xad97('0x50')]=function(_0x470493,_0xea1d26,_0x5cec19){if(_0x470493[_0xad97('0x4d')]['id']){delete _0x470493['body']['id'];}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x470493[_0xad97('0x48')]['id']}})[_0xad97('0x17')](handleEntityNotFound(_0xea1d26,null))['then'](function(_0x5d815a){if(_0x5d815a){_0x470493[_0xad97('0x4d')][_0xad97('0x51')]=_0x5d815a['id'];return db[_0xad97('0x52')][_0xad97('0x4c')](_0x470493[_0xad97('0x4d')]);}})[_0xad97('0x17')](respondWithResult(_0xea1d26,null))['catch'](handleError(_0xea1d26,null));};exports[_0xad97('0x53')]=function(_0x76f13e,_0x41bff6,_0x3f87b4){var _0x45e4d8={'raw':![],'where':{}};var _0x190ea6={};var _0x20f28c={'count':0x0,'rows':[]};return db[_0xad97('0x2f')]['findOne']({'where':{'id':_0x76f13e[_0xad97('0x48')]['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x41bff6,null))[_0xad97('0x17')](function(_0x420e14){if(_0x420e14){_0x190ea6['model']=_[_0xad97('0x32')](db['Disposition'][_0xad97('0x30')]);_0x190ea6[_0xad97('0x34')]=_[_0xad97('0x32')](_0x76f13e[_0xad97('0x34')]);_0x190ea6[_0xad97('0x36')]=_[_0xad97('0x37')](_0x190ea6[_0xad97('0x31')],_0x190ea6[_0xad97('0x34')]);_0x45e4d8[_0xad97('0x38')]=_[_0xad97('0x37')](_0x190ea6['model'],qs['fields'](_0x76f13e[_0xad97('0x34')][_0xad97('0x39')]));_0x45e4d8['attributes']=_0x45e4d8['attributes']['length']?_0x45e4d8[_0xad97('0x38')]:_0x190ea6[_0xad97('0x31')];if(!_0x76f13e[_0xad97('0x34')][_0xad97('0x3a')]('nolimit')){_0x45e4d8['limit']=qs[_0xad97('0x3c')](_0x76f13e['query'][_0xad97('0x3c')]);_0x45e4d8[_0xad97('0x24')]=qs[_0xad97('0x24')](_0x76f13e['query'][_0xad97('0x24')]);}_0x45e4d8['order']=qs[_0xad97('0x54')](_0x76f13e[_0xad97('0x34')][_0xad97('0x54')]);_0x45e4d8[_0xad97('0x3e')]=qs['filters'](_[_0xad97('0x55')](_0x76f13e[_0xad97('0x34')],_0x190ea6['filters']));_0x45e4d8['where']['FaxAccountId']=_0x420e14['id'];if(_0x76f13e['query'][_0xad97('0x42')]){_0x45e4d8[_0xad97('0x3e')]=_['merge'](_0x45e4d8[_0xad97('0x3e')],{'$or':_['map'](_0x45e4d8[_0xad97('0x38')],function(_0x352b03){var _0x166439={};_0x166439[_0x352b03]={'$like':'%'+_0x76f13e['query'][_0xad97('0x42')]+'%'};return _0x166439;})});}_0x45e4d8=_[_0xad97('0x41')]({},_0x45e4d8,_0x76f13e[_0xad97('0x43')]);return db[_0xad97('0x52')][_0xad97('0x23')]({'where':_0x45e4d8['where']})[_0xad97('0x17')](function(_0x27a5e2){_0x20f28c[_0xad97('0x23')]=_0x27a5e2;if(_0x76f13e[_0xad97('0x34')][_0xad97('0x44')]){_0x45e4d8[_0xad97('0x4a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x45e4d8);})[_0xad97('0x17')](function(_0x3c1da){_0x20f28c[_0xad97('0x46')]=_0x3c1da;return _0x20f28c;});}})['then'](respondWithFilteredResult(_0x41bff6,_0x45e4d8))[_0xad97('0x47')](handleError(_0x41bff6,null));};exports[_0xad97('0x56')]=function(_0x49d94f,_0x3a758b,_0x79f129){var _0x25fae0;return db[_0xad97('0x2f')]['find']({'where':{'id':_0x49d94f['params']['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x3a758b,null))[_0xad97('0x17')](function(_0x200cf7){if(_0x200cf7){return _0x200cf7[_0xad97('0x56')](_0x49d94f[_0xad97('0x34')]['ids']);}})[_0xad97('0x17')](respondWithStatusCode(_0x3a758b,null))[_0xad97('0x47')](handleError(_0x3a758b,null));};exports[_0xad97('0x57')]=function(_0x297497,_0x55ba6d,_0x4ac418){if(_0x297497[_0xad97('0x4d')]['id']){delete _0x297497[_0xad97('0x4d')]['id'];}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x297497['params']['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x55ba6d,null))[_0xad97('0x17')](function(_0x203173){if(_0x203173){_0x297497[_0xad97('0x4d')]['FaxAccountId']=_0x203173['id'];return db[_0xad97('0x58')]['create'](_0x297497['body']);}})[_0xad97('0x17')](respondWithResult(_0x55ba6d,null))[_0xad97('0x47')](handleError(_0x55ba6d,null));};exports[_0xad97('0x59')]=function(_0x14d1ea,_0x2e11d4,_0x5bf7e8){var _0x1487ef={'raw':![],'where':{}};var _0x3902f0={};var _0x365ddb={'count':0x0,'rows':[]};return db[_0xad97('0x2f')]['findOne']({'where':{'id':_0x14d1ea['params']['id']}})['then'](handleEntityNotFound(_0x2e11d4,null))['then'](function(_0x2b18e6){if(_0x2b18e6){_0x3902f0[_0xad97('0x31')]=_[_0xad97('0x32')](db['CannedAnswer'][_0xad97('0x30')]);_0x3902f0[_0xad97('0x34')]=_[_0xad97('0x32')](_0x14d1ea['query']);_0x3902f0[_0xad97('0x36')]=_[_0xad97('0x37')](_0x3902f0[_0xad97('0x31')],_0x3902f0['query']);_0x1487ef[_0xad97('0x38')]=_[_0xad97('0x37')](_0x3902f0['model'],qs['fields'](_0x14d1ea['query']['fields']));_0x1487ef[_0xad97('0x38')]=_0x1487ef[_0xad97('0x38')][_0xad97('0x49')]?_0x1487ef['attributes']:_0x3902f0[_0xad97('0x31')];if(!_0x14d1ea[_0xad97('0x34')]['hasOwnProperty'](_0xad97('0x3b'))){_0x1487ef[_0xad97('0x3c')]=qs['limit'](_0x14d1ea[_0xad97('0x34')][_0xad97('0x3c')]);_0x1487ef['offset']=qs[_0xad97('0x24')](_0x14d1ea[_0xad97('0x34')][_0xad97('0x24')]);}_0x1487ef[_0xad97('0x3d')]=qs[_0xad97('0x54')](_0x14d1ea[_0xad97('0x34')][_0xad97('0x54')]);_0x1487ef[_0xad97('0x3e')]=qs[_0xad97('0x36')](_['pick'](_0x14d1ea[_0xad97('0x34')],_0x3902f0[_0xad97('0x36')]));_0x1487ef[_0xad97('0x3e')][_0xad97('0x51')]=_0x2b18e6['id'];if(_0x14d1ea['query'][_0xad97('0x42')]){_0x1487ef[_0xad97('0x3e')]=_[_0xad97('0x41')](_0x1487ef[_0xad97('0x3e')],{'$or':_[_0xad97('0x5a')](_0x1487ef[_0xad97('0x38')],function(_0xeba42f){var _0x17454f={};_0x17454f[_0xeba42f]={'$like':'%'+_0x14d1ea[_0xad97('0x34')][_0xad97('0x42')]+'%'};return _0x17454f;})});}_0x1487ef=_['merge']({},_0x1487ef,_0x14d1ea[_0xad97('0x43')]);return db[_0xad97('0x58')]['count']({'where':_0x1487ef[_0xad97('0x3e')]})['then'](function(_0x152a57){_0x365ddb[_0xad97('0x23')]=_0x152a57;if(_0x14d1ea[_0xad97('0x34')][_0xad97('0x44')]){_0x1487ef[_0xad97('0x4a')]=[{'all':!![]}];}return db[_0xad97('0x58')][_0xad97('0x45')](_0x1487ef);})['then'](function(_0x54230f){_0x365ddb[_0xad97('0x46')]=_0x54230f;return _0x365ddb;});}})[_0xad97('0x17')](respondWithFilteredResult(_0x2e11d4,_0x1487ef))[_0xad97('0x47')](handleError(_0x2e11d4,null));};exports[_0xad97('0x5b')]=function(_0x2a1a05,_0x5d2577,_0x250861){var _0x1f1ed6;return db['FaxAccount'][_0xad97('0x4b')]({'where':{'id':_0x2a1a05[_0xad97('0x48')]['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x5d2577,null))[_0xad97('0x17')](function(_0x2c6e6f){if(_0x2c6e6f){return _0x2c6e6f[_0xad97('0x5b')](_0x2a1a05[_0xad97('0x34')][_0xad97('0x5c')]);}})[_0xad97('0x17')](respondWithStatusCode(_0x5d2577,null))[_0xad97('0x47')](handleError(_0x5d2577,null));};exports[_0xad97('0x5d')]=function(_0x5b8b6d,_0x1a63d3,_0x1425b5){return db['FaxInteraction'][_0xad97('0x4b')]({'where':{'id':_0x5b8b6d[_0xad97('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a63d3,null))['then'](function(_0x21bc7c){if(_0x21bc7c){return _0x21bc7c['addInteraction'](_0x5b8b6d['body']['ids'],_[_0xad97('0x5e')](_0x5b8b6d[_0xad97('0x4d')],[_0xad97('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x1a63d3,null))['catch'](handleError(_0x1a63d3,null));};exports[_0xad97('0x5f')]=function(_0x134d84,_0x3b725a,_0x17d0dd){var _0x4dcdce={'raw':![],'where':{}};var _0xe41264={};var _0x57b3a3={'count':0x0,'rows':[]};return db[_0xad97('0x2f')][_0xad97('0x60')]({'where':{'id':_0x134d84[_0xad97('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b725a,null))['then'](function(_0x3985fc){if(_0x3985fc){_0xe41264[_0xad97('0x31')]=_['keys'](db[_0xad97('0x61')][_0xad97('0x30')]);_0xe41264[_0xad97('0x34')]=_[_0xad97('0x32')](_0x134d84[_0xad97('0x34')]);_0xe41264[_0xad97('0x36')]=_[_0xad97('0x37')](_0xe41264[_0xad97('0x31')],_0xe41264[_0xad97('0x34')]);_0x4dcdce[_0xad97('0x38')]=_[_0xad97('0x37')](_0xe41264['model'],qs[_0xad97('0x39')](_0x134d84[_0xad97('0x34')][_0xad97('0x39')]));_0x4dcdce[_0xad97('0x38')]=_0x4dcdce[_0xad97('0x38')][_0xad97('0x49')]?_0x4dcdce['attributes']:_0xe41264[_0xad97('0x31')];if(!_0x134d84[_0xad97('0x34')][_0xad97('0x3a')]('nolimit')){_0x4dcdce[_0xad97('0x3c')]=qs[_0xad97('0x3c')](_0x134d84[_0xad97('0x34')][_0xad97('0x3c')]);_0x4dcdce[_0xad97('0x24')]=qs[_0xad97('0x24')](_0x134d84[_0xad97('0x34')][_0xad97('0x24')]);}_0x4dcdce[_0xad97('0x3d')]=qs[_0xad97('0x54')](_0x134d84[_0xad97('0x34')][_0xad97('0x54')]);_0x4dcdce[_0xad97('0x3e')]=qs[_0xad97('0x36')](_['pick'](_0x134d84[_0xad97('0x34')],_0xe41264[_0xad97('0x36')]));_0x4dcdce[_0xad97('0x3e')]['FaxAccountId']=_0x3985fc['id'];if(_0x134d84[_0xad97('0x34')][_0xad97('0x42')]){_0x4dcdce[_0xad97('0x3e')]=_[_0xad97('0x41')](_0x4dcdce[_0xad97('0x3e')],{'$or':_[_0xad97('0x5a')](_0x4dcdce[_0xad97('0x38')],function(_0x284a35){var _0x5df1aa={};_0x5df1aa[_0x284a35]={'$like':'%'+_0x134d84[_0xad97('0x34')]['filter']+'%'};return _0x5df1aa;})});}_0x4dcdce=_[_0xad97('0x41')]({},_0x4dcdce,_0x134d84[_0xad97('0x43')]);return db[_0xad97('0x61')][_0xad97('0x23')]({'where':_0x4dcdce[_0xad97('0x3e')]})[_0xad97('0x17')](function(_0x4899a9){_0x57b3a3[_0xad97('0x23')]=_0x4899a9;if(_0x134d84[_0xad97('0x34')][_0xad97('0x44')]){_0x4dcdce[_0xad97('0x4a')]=[{'model':db[_0xad97('0x62')],'as':_0xad97('0x63'),'required':![]},{'model':db[_0xad97('0x64')],'as':_0xad97('0x65'),'attributes':[_0xad97('0x2d'),_0xad97('0x66'),_0xad97('0x67')],'required':![]},{'model':db[_0xad97('0x68')],'as':'Tags','attributes':['id',_0xad97('0x2d'),_0xad97('0x69')],'where':_0x134d84[_0xad97('0x34')][_0xad97('0x6a')]?{'id':_0x134d84[_0xad97('0x34')][_0xad97('0x6a')]}:undefined,'required':_0x134d84[_0xad97('0x34')][_0xad97('0x6a')]?!![]:![]}];}return db['FaxInteraction'][_0xad97('0x45')](_0x4dcdce);})[_0xad97('0x17')](function(_0x394792){_0x57b3a3[_0xad97('0x46')]=_0x394792;return _0x57b3a3;});}})[_0xad97('0x17')](respondWithFilteredResult(_0x3b725a,_0x4dcdce))[_0xad97('0x47')](handleError(_0x3b725a,null));};exports[_0xad97('0x6b')]=function(_0x495eb5,_0x33b736,_0xc9a307){return db['FaxAccount'][_0xad97('0x60')]({'where':{'id':_0x495eb5[_0xad97('0x48')]['id']}})['then'](handleEntityNotFound(_0x33b736,null))[_0xad97('0x17')](function(_0x4cc54b){if(_0x4cc54b){return db[_0xad97('0x6c')][_0xad97('0x6d')](function(_0x30f906){return db['FaxApplication'][_0xad97('0x4e')]({'where':{'FaxAccountId':_0x495eb5['params']['id']},'transaction':_0x30f906})['then'](function(_0x1a6977){var _0x160889=_[_0xad97('0x5a')](_0x495eb5['body'],function(_0x235744){_0x235744[_0xad97('0x51')]=_0x495eb5['params']['id'];return _0x235744;});return db[_0xad97('0x6e')][_0xad97('0x6f')](_0x160889,{'transaction':_0x30f906});});})['then'](function(){return db[_0xad97('0x6e')]['findAndCountAll']({'where':{'FaxAccountId':_0x495eb5[_0xad97('0x48')]['id']},'order':_0xad97('0x70')});});}})[_0xad97('0x17')](respondWithResult(_0x33b736,null))[_0xad97('0x47')](handleError(_0x33b736,null));};exports[_0xad97('0x71')]=function(_0x2e64d7,_0x5d7279,_0x17592d){var _0x5893b9={};var _0x2ec962={};var _0x281633;var _0x31a5da;return db[_0xad97('0x2f')][_0xad97('0x60')]({'where':{'id':_0x2e64d7[_0xad97('0x48')]['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x5d7279,null))[_0xad97('0x17')](function(_0x31d678){if(_0x31d678){_0x281633=_0x31d678;_0x2ec962[_0xad97('0x31')]=_[_0xad97('0x32')](db[_0xad97('0x6e')][_0xad97('0x30')]);_0x2ec962['query']=_['keys'](_0x2e64d7['query']);_0x2ec962[_0xad97('0x36')]=_['intersection'](_0x2ec962[_0xad97('0x31')],_0x2ec962[_0xad97('0x34')]);_0x5893b9[_0xad97('0x38')]=_[_0xad97('0x37')](_0x2ec962[_0xad97('0x31')],qs[_0xad97('0x39')](_0x2e64d7[_0xad97('0x34')][_0xad97('0x39')]));_0x5893b9[_0xad97('0x38')]=_0x5893b9[_0xad97('0x38')][_0xad97('0x49')]?_0x5893b9[_0xad97('0x38')]:_0x2ec962[_0xad97('0x31')];_0x5893b9[_0xad97('0x3d')]=qs[_0xad97('0x54')](_0x2e64d7[_0xad97('0x34')][_0xad97('0x54')]);_0x5893b9[_0xad97('0x3e')]=qs[_0xad97('0x36')](_['pick'](_0x2e64d7[_0xad97('0x34')],_0x2ec962[_0xad97('0x36')]));if(_0x2e64d7['query'][_0xad97('0x42')]){_0x5893b9['where']=_[_0xad97('0x41')](_0x5893b9['where'],{'$or':_[_0xad97('0x5a')](_0x5893b9['attributes'],function(_0x15eb3d){var _0x5d1a6a={};_0x5d1a6a[_0x15eb3d]={'$like':'%'+_0x2e64d7['query'][_0xad97('0x42')]+'%'};return _0x5d1a6a;})});}_0x5893b9=_[_0xad97('0x41')]({},_0x5893b9,_0x2e64d7[_0xad97('0x43')]);return _0x281633[_0xad97('0x71')](_0x5893b9);}})[_0xad97('0x17')](function(_0x2c2987){if(_0x2c2987){_0x31a5da=_0x2c2987['length'];if(!_0x2e64d7[_0xad97('0x34')][_0xad97('0x3a')](_0xad97('0x3b'))){_0x5893b9[_0xad97('0x3c')]=qs[_0xad97('0x3c')](_0x2e64d7[_0xad97('0x34')][_0xad97('0x3c')]);_0x5893b9[_0xad97('0x24')]=qs[_0xad97('0x24')](_0x2e64d7[_0xad97('0x34')][_0xad97('0x24')]);}return _0x281633[_0xad97('0x71')](_0x5893b9);}})[_0xad97('0x17')](function(_0x3c66f4){if(_0x3c66f4){return _0x3c66f4?{'count':_0x31a5da,'rows':_0x3c66f4}:null;}})[_0xad97('0x17')](respondWithResult(_0x5d7279,null))[_0xad97('0x47')](handleError(_0x5d7279,null));};function Extension(_0x40e88f,_0x361be2,_0x18e62e,_0x51a87c){this[_0xad97('0x72')]=_0xad97('0x73');this[_0xad97('0x74')]=_0x40e88f[_0xad97('0x75')];this[_0xad97('0x76')]=_0x51a87c;this['type']=_0xad97('0x77');this[_0xad97('0x78')]='Fax\x20Extension';this[_0xad97('0x51')]=_0x40e88f['id'];this[_0xad97('0x70')]=_0x361be2;this['appdata']=_0x18e62e;}function createExtensionsReciveFax(_0x4a8168){var _0x20a19b=0x1;var _0x465181=[];_0x465181[_0xad97('0x79')](new Extension(_0x4a8168,_0x20a19b,'',_0xad97('0x7a')));_0x20a19b+=0x1;_0x465181['push'](new Extension(_0x4a8168,_0x20a19b,'CDR(type)=inbound-fax',_0xad97('0x7b')));_0x20a19b+=0x1;for(var _0x30690f in _0x4a8168){if(_0x4a8168[_0xad97('0x3a')](_0x30690f)&&(_0x30690f===_0xad97('0x7c')||_0x30690f===_0xad97('0x75')||_0x30690f===_0xad97('0x7d')||_0x30690f===_0xad97('0x7e')||_0x30690f===_0xad97('0x7f')||_0x30690f==='maxrate'||_0x30690f===_0xad97('0x80')||_0x30690f==='modem'||_0x30690f===_0xad97('0x81'))){_0x465181[_0xad97('0x79')](new Extension(_0x4a8168,_0x20a19b,_0xad97('0x82')+_0x30690f+')='+_0x4a8168[_0x30690f],_0xad97('0x7b')));_0x20a19b+=0x1;}}_0x465181['push'](new Extension(_0x4a8168,_0x20a19b,'6',_0xad97('0x83')));_0x20a19b+=0x1;_0x465181['push'](new Extension(_0x4a8168,_0x20a19b,'/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'));_0x20a19b=0x0;return _0x465181;}exports['addAccountApplications']=function(_0x291b30,_0x149ae7,_0x18e183){var _0x23890a;return db[_0xad97('0x6c')][_0xad97('0x6d')](function(_0xb4d023){return db['FaxAccount']['create'](_0x291b30[_0xad97('0x4d')],{'transaction':_0xb4d023})[_0xad97('0x17')](function(_0x2fbaad){_0x23890a=_0x2fbaad['get']({'plain':!![]});return db[_0xad97('0x84')]['bulkCreate'](createExtensionsReciveFax(_0x23890a),{'transaction':_0xb4d023});});})['then'](function(){return _0x23890a;})[_0xad97('0x17')](respondWithResult(_0x149ae7,null))[_0xad97('0x47')](handleError(_0x149ae7,null));};exports[_0xad97('0x85')]=function(_0x4358cd,_0x109955,_0x244493){var _0x54e896;return db[_0xad97('0x6c')]['transaction'](function(_0x356667){return db[_0xad97('0x2f')][_0xad97('0x2b')](_0x4358cd[_0xad97('0x4d')],{'where':{'id':_0x4358cd[_0xad97('0x4d')]['id']},'transaction':_0x356667})[_0xad97('0x17')](function(_0x418115){return db[_0xad97('0x84')][_0xad97('0x4e')]({'where':{'FaxAccountId':_0x4358cd[_0xad97('0x4d')]['id']},'transaction':_0x356667})[_0xad97('0x17')](function(_0xb2af33){return db[_0xad97('0x84')][_0xad97('0x6f')](createExtensionsReciveFax(_['omit'](_0x4358cd[_0xad97('0x4d')],[_0xad97('0x86'),_0xad97('0x87'),_0xad97('0x88'),_0xad97('0x89'),_0xad97('0x8a'),_0xad97('0x8b')])),{'transaction':_0x356667});});});})[_0xad97('0x17')](function(){return db[_0xad97('0x2f')][_0xad97('0x8c')](_0x4358cd[_0xad97('0x4d')]['id']);})['then'](respondWithResult(_0x109955,null))[_0xad97('0x47')](handleError(_0x109955,null));};exports['getMessages']=function(_0x3b0786,_0x298253,_0x5c03d8){var _0x53addb={'raw':!![],'where':{}};var _0x3e9e80={};var _0x186864={'count':0x0,'rows':[]};return db[_0xad97('0x2f')]['findOne']({'where':{'id':_0x3b0786[_0xad97('0x48')]['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x298253,null))[_0xad97('0x17')](function(_0x1bea2a){if(_0x1bea2a){_0x3e9e80[_0xad97('0x31')]=_[_0xad97('0x32')](db['FaxMessage'][_0xad97('0x30')]);_0x3e9e80['query']=_[_0xad97('0x32')](_0x3b0786[_0xad97('0x34')]);_0x3e9e80[_0xad97('0x36')]=_[_0xad97('0x37')](_0x3e9e80[_0xad97('0x31')],_0x3e9e80['query']);_0x53addb[_0xad97('0x38')]=_['intersection'](_0x3e9e80[_0xad97('0x31')],qs['fields'](_0x3b0786[_0xad97('0x34')]['fields']));_0x53addb[_0xad97('0x38')]=_0x53addb[_0xad97('0x38')][_0xad97('0x49')]?_0x53addb[_0xad97('0x38')]:_0x3e9e80['model'];if(!_0x3b0786[_0xad97('0x34')][_0xad97('0x3a')](_0xad97('0x3b'))){_0x53addb[_0xad97('0x3c')]=qs['limit'](_0x3b0786[_0xad97('0x34')][_0xad97('0x3c')]);_0x53addb[_0xad97('0x24')]=qs['offset'](_0x3b0786[_0xad97('0x34')][_0xad97('0x24')]);}_0x53addb['order']=qs[_0xad97('0x54')](_0x3b0786[_0xad97('0x34')][_0xad97('0x54')]);_0x53addb[_0xad97('0x3e')]=qs[_0xad97('0x36')](_[_0xad97('0x55')](_0x3b0786[_0xad97('0x34')],_0x3e9e80[_0xad97('0x36')]));_0x53addb[_0xad97('0x3e')][_0xad97('0x51')]=_0x1bea2a['id'];if(_0x3b0786[_0xad97('0x34')][_0xad97('0x42')]){_0x53addb[_0xad97('0x3e')]=_[_0xad97('0x41')](_0x53addb[_0xad97('0x3e')],{'$or':_[_0xad97('0x5a')](_0x53addb[_0xad97('0x38')],function(_0x465bcc){var _0xe2ed93={};_0xe2ed93[_0x465bcc]={'$like':'%'+_0x3b0786[_0xad97('0x34')][_0xad97('0x42')]+'%'};return _0xe2ed93;})});}if(_0x3b0786[_0xad97('0x34')][_0xad97('0x8d')]){var _0x3b3585=_0x3b0786['query'][_0xad97('0x8d')]['split'](',');var _0x5ecb93={};_0x5ecb93[_0x3b3585[0x0]]={'$gte':moment(_0x3b3585[0x1])[_0xad97('0x8e')](_0xad97('0x8f'))};_0x53addb['where']=_[_0xad97('0x41')](_0x53addb[_0xad97('0x3e')],_0x5ecb93);}_0x53addb=_[_0xad97('0x41')]({},_0x53addb,_0x3b0786[_0xad97('0x43')]);return db['FaxMessage'][_0xad97('0x23')]({'where':_0x53addb[_0xad97('0x3e')]})[_0xad97('0x17')](function(_0x31c55c){_0x186864[_0xad97('0x23')]=_0x31c55c;if(_0x3b0786[_0xad97('0x34')][_0xad97('0x44')]){_0x53addb[_0xad97('0x4a')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x53addb);})[_0xad97('0x17')](function(_0x5e8a93){_0x186864[_0xad97('0x46')]=_0x5e8a93;return _0x186864;});}})['then'](respondWithFilteredResult(_0x298253,_0x53addb))[_0xad97('0x47')](handleError(_0x298253,null));};exports[_0xad97('0x90')]=function(_0x4c34e2,_0x240d5c,_0x5c7a87){var _0x1a7a62,_0xb95d52={},_0x212810;if(_0x4c34e2[_0xad97('0x4d')]['to']){_0x212810=_0x4c34e2[_0xad97('0x4d')]['to'][0x0];}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x4c34e2[_0xad97('0x48')]['id']},'include':[{'model':db[_0xad97('0x91')],'as':_0xad97('0x92'),'include':[{'model':db[_0xad97('0x62')],'as':_0xad97('0x93'),'where':{'fax':_0x212810},'limit':0x1,'order':[[_0xad97('0x89'),_0xad97('0x94')]]}]}]})[_0xad97('0x17')](handleEntityNotFound(_0x240d5c,null))['then'](function(_0x51c24a){_0x1a7a62=_0x51c24a;if(_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')]&&_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][_0xad97('0x49')]){for(var _0x513e50=0x0;_0x513e50<_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][_0xad97('0x49')];_0x513e50+=0x1){_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][_0x513e50]={'filename':_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][_0x513e50][_0xad97('0x2d')],'id':_0x4c34e2[_0xad97('0x4d')]['attachments'][_0x513e50]['id'],'path':path[_0xad97('0x96')](config[_0xad97('0x97')],_0xad97('0x98'),_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][_0x513e50][_0xad97('0x99')])};}}return respondWithRpcPromise(_0xad97('0x9a'),_0xad97('0x9a'),{'FaxAccountId':_['isNil'](_0x4c34e2['params']['id'])?undefined:_0x4c34e2[_0xad97('0x48')]['id'],'path':_[_0xad97('0x9b')](_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][0x0][_0xad97('0x6')])?undefined:_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][0x0][_0xad97('0x6')],'fax':_['isNil'](_0x4c34e2[_0xad97('0x4d')]['to'][0x0])?undefined:_0x4c34e2[_0xad97('0x4d')]['to'][0x0]},client9002);})[_0xad97('0x17')](function(){if(_0x1a7a62){if(_['isNil'](_0x4c34e2[_0xad97('0x4d')][_0xad97('0x9c')])){_0x4c34e2['body'][_0xad97('0x9c')]=util[_0xad97('0x8e')](_0xad97('0x9d'),_0x1a7a62['name'],_0x1a7a62[_0xad97('0x9e')]);}if(_0x1a7a62[_0xad97('0x92')]){if(_0x1a7a62[_0xad97('0x92')][_0xad97('0x93')][_0xad97('0x49')]){return _0x1a7a62[_0xad97('0x92')][_0xad97('0x93')][0x0];}else{return db[_0xad97('0x62')]['create'](_[_0xad97('0x9f')](_0x4c34e2[_0xad97('0x4d')],{'firstName':_0x4c34e2[_0xad97('0x4d')]['to'][0x0],'phone':_0x4c34e2[_0xad97('0x4d')]['to'][0x0],'fax':_0x4c34e2[_0xad97('0x4d')]['to'][0x0],'ListId':_0x1a7a62[_0xad97('0x8b')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xad97('0xa0'));}})['then'](function(_0x28966a){if(_0x28966a){return db[_0xad97('0x61')]['find']({'where':{'ContactId':_0x28966a['id'],'closed':![],'FaxAccountId':_0x1a7a62['id']}})[_0xad97('0x17')](function(_0x4d6dac){if(_0x4d6dac){return[_0x4d6dac,![]];}return db[_0xad97('0x61')]['create']({'UserId':_0x4c34e2[_0xad97('0xa1')]['id'],'ContactId':_0x28966a['id'],'FaxAccountId':_0x1a7a62['id'],'fax':_0x4c34e2[_0xad97('0x4d')]['to'][0x0],'firstMsgDirection':_0xad97('0xa2'),'Messages':[_[_0xad97('0x41')](_0x4c34e2['body'],{'read':![],'body':_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][0x0][_0xad97('0xa3')],'FaxAccountId':_0x1a7a62['id'],'UserId':_0x4c34e2[_0xad97('0xa1')]['id'],'ContactId':_0x28966a['id'],'AttachmentId':_0x4c34e2[_0xad97('0x4d')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xad97('0xa4')],'as':_0xad97('0xa5')}]})[_0xad97('0x17')](function(_0x3e254a){return[_0x3e254a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xad97('0xa6')](function(_0x1fa537,_0x11b8d4){if(_0x11b8d4){return _0x1fa537;}return db[_0xad97('0xa4')][_0xad97('0x4c')]({'direction':_0xad97('0xa2'),'read':![],'body':_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][0x0][_0xad97('0xa3')],'FaxAccountId':_0x1a7a62['id'],'FaxInteractionId':_0x1fa537['id'],'UserId':_0x4c34e2[_0xad97('0xa1')]['id'],'ContactId':_0x1fa537[_0xad97('0xa7')],'AttachmentId':_0x4c34e2['body']['attachments'][0x0]['id']})[_0xad97('0x17')](function(_0x104c1e){_0x1fa537[_0xad97('0xa8')][_0xad97('0xa5')]=[];_0x1fa537[_0xad97('0xa8')][_0xad97('0xa5')][_0xad97('0x79')](_0x104c1e['dataValues']);return _0x1fa537;});})[_0xad97('0x17')](function(_0x56a253){respondWithRpcPromise(_0xad97('0xa9'),_0xad97('0xa9'),{'FaxAccountId':_['isNil'](_0x4c34e2['params']['id'])?undefined:_0x4c34e2[_0xad97('0x48')]['id'],'path':_[_0xad97('0x9b')](_0x4c34e2[_0xad97('0x4d')]['attachments'][0x0][_0xad97('0x6')])?undefined:_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][0x0]['path'],'fax':_[_0xad97('0x9b')](_0x4c34e2[_0xad97('0x4d')]['to'][0x0])?undefined:_0x4c34e2[_0xad97('0x4d')]['to'][0x0],'AttachmentId':_0x4c34e2[_0xad97('0x4d')][_0xad97('0x95')][0x0]['id']},client9002)[_0xad97('0x17')](function(_0x10362f){logger['info'](_0xad97('0xaa'),_0x10362f);})[_0xad97('0x47')](function(_0x24ca44){logger['info']('SendFaxRpc,\x20%s',_0x24ca44);});return _0x56a253;})[_0xad97('0x17')](respondWithResult(_0x240d5c,null))[_0xad97('0x47')](handleError(_0x240d5c,null));};exports[_0xad97('0xab')]=function(_0xed6b91,_0x4ee419,_0x19eab5){return db[_0xad97('0x2f')]['find']({'where':{'id':_0xed6b91['params']['id']}})['then'](handleEntityNotFound(_0x4ee419,null))[_0xad97('0x17')](function(_0x9e11f3){if(_0x9e11f3){return _0x9e11f3['addAgents'](_0xed6b91[_0xad97('0x4d')][_0xad97('0x5c')],_[_0xad97('0x5e')](_0xed6b91[_0xad97('0x4d')],[_0xad97('0x5c'),'id'])||{})[_0xad97('0xa6')](function(_0xacd1eb){for(var _0x11a10b=0x0;_0x11a10b<_0xed6b91[_0xad97('0x4d')]['ids'][_0xad97('0x49')];_0x11a10b+=0x1){socket[_0xad97('0xac')](_0xad97('0xad'),{'UserId':_0xed6b91[_0xad97('0x4d')][_0xad97('0x5c')][_0x11a10b],'FaxAccountId':_0xed6b91[_0xad97('0x48')]['id']});}return _0xacd1eb;});}})['then'](respondWithResult(_0x4ee419,null))[_0xad97('0x47')](handleError(_0x4ee419,null));};exports[_0xad97('0xae')]=function(_0x2fc268,_0x101585,_0x29109e){var _0x5ee176;return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x2fc268['params']['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x101585,null))[_0xad97('0x17')](function(_0x3a350a){if(_0x3a350a){return _0x3a350a['removeAgents'](_0x2fc268[_0xad97('0x34')][_0xad97('0x5c')])[_0xad97('0x17')](function(_0x491492){if(_[_0xad97('0xaf')](_0x2fc268['query'][_0xad97('0x5c')])){for(var _0x1849e3=0x0;_0x1849e3<_0x2fc268['query'][_0xad97('0x5c')][_0xad97('0x49')];_0x1849e3+=0x1){socket[_0xad97('0xac')]('userFaxAccount:remove',{'UserId':_0x2fc268['query'][_0xad97('0x5c')][_0x1849e3],'FaxAccountId':_0x2fc268[_0xad97('0x48')]['id']});}}else{socket[_0xad97('0xac')](_0xad97('0xb0'),{'UserId':_0x2fc268[_0xad97('0x34')][_0xad97('0x5c')],'FaxAccountId':_0x2fc268[_0xad97('0x48')]['id']});}});}})[_0xad97('0x17')](respondWithStatusCode(_0x101585,null))['catch'](handleError(_0x101585,null));};exports[_0xad97('0xb1')]=function(_0x41ef70,_0x4a5cba,_0x285a64){var _0x55c1fa={};var _0x5e1b05={};var _0x2547f6;var _0x17418d;return db[_0xad97('0x2f')][_0xad97('0x60')]({'where':{'id':_0x41ef70[_0xad97('0x48')]['id']}})[_0xad97('0x17')](handleEntityNotFound(_0x4a5cba,null))['then'](function(_0x11e817){if(_0x11e817){_0x2547f6=_0x11e817;_0x5e1b05[_0xad97('0x31')]=_[_0xad97('0x32')](db['User'][_0xad97('0x30')]);_0x5e1b05[_0xad97('0x34')]=_['keys'](_0x41ef70[_0xad97('0x34')]);_0x5e1b05[_0xad97('0x36')]=_[_0xad97('0x37')](_0x5e1b05[_0xad97('0x31')],_0x5e1b05[_0xad97('0x34')]);_0x55c1fa['attributes']=_[_0xad97('0x37')](_0x5e1b05['model'],qs['fields'](_0x41ef70['query'][_0xad97('0x39')]));_0x55c1fa['attributes']=_0x55c1fa[_0xad97('0x38')][_0xad97('0x49')]?_0x55c1fa[_0xad97('0x38')]:_0x5e1b05[_0xad97('0x31')];_0x55c1fa[_0xad97('0x3d')]=qs[_0xad97('0x54')](_0x41ef70[_0xad97('0x34')]['sort']);_0x55c1fa[_0xad97('0x3e')]=qs[_0xad97('0x36')](_['pick'](_0x41ef70[_0xad97('0x34')],_0x5e1b05[_0xad97('0x36')]));if(_0x41ef70[_0xad97('0x34')][_0xad97('0x42')]){_0x55c1fa[_0xad97('0x3e')]=_[_0xad97('0x41')](_0x55c1fa[_0xad97('0x3e')],{'$or':_['map'](_0x55c1fa[_0xad97('0x38')],function(_0x1fdfbb){var _0x160972={};_0x160972[_0x1fdfbb]={'$like':'%'+_0x41ef70['query'][_0xad97('0x42')]+'%'};return _0x160972;})});}_0x55c1fa=_[_0xad97('0x41')]({},_0x55c1fa,_0x41ef70[_0xad97('0x43')]);return _0x2547f6[_0xad97('0xb1')](_0x55c1fa);}})[_0xad97('0x17')](function(_0x29a2cb){if(_0x29a2cb){_0x17418d=_0x29a2cb[_0xad97('0x49')];if(!_0x41ef70[_0xad97('0x34')][_0xad97('0x3a')](_0xad97('0x3b'))){_0x55c1fa[_0xad97('0x3c')]=qs[_0xad97('0x3c')](_0x41ef70[_0xad97('0x34')]['limit']);_0x55c1fa[_0xad97('0x24')]=qs[_0xad97('0x24')](_0x41ef70['query'][_0xad97('0x24')]);}return _0x2547f6[_0xad97('0xb1')](_0x55c1fa);}})['then'](function(_0x1297be){if(_0x1297be){return _0x1297be?{'count':_0x17418d,'rows':_0x1297be}:null;}})[_0xad97('0x17')](respondWithResult(_0x4a5cba,null))[_0xad97('0x47')](handleError(_0x4a5cba,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 67db125..7b05b45 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 _0x68db=['setMaxListeners','emit','hook','exports','events','FaxAccount'];(function(_0x3af68e,_0x384315){var _0x3e6d5b=function(_0x21e40c){while(--_0x21e40c){_0x3af68e['push'](_0x3af68e['shift']());}};_0x3e6d5b(++_0x384315);}(_0x68db,0x148));var _0xb68d=function(_0x93b72,_0x334405){_0x93b72=_0x93b72-0x0;var _0x3910c1=_0x68db[_0x93b72];return _0x3910c1;};'use strict';var EventEmitter=require(_0xb68d('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xb68d('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb68d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xdb53e5){return function(_0x2626b7,_0x23d8c8,_0x15368e){FaxAccountEvents[_0xb68d('0x3')](_0xdb53e5+':'+_0x2626b7['id'],_0x2626b7);FaxAccountEvents[_0xb68d('0x3')](_0xdb53e5,_0x2626b7);_0x15368e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xb68d('0x4')](e,emitEvent(event));}}module[_0xb68d('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0xc1c2=['remove','emit','hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners','update'];(function(_0x18607e,_0x534857){var _0x15ebab=function(_0x4ee1dc){while(--_0x4ee1dc){_0x18607e['push'](_0x18607e['shift']());}};_0x15ebab(++_0x534857);}(_0xc1c2,0x15b));var _0x2c1c=function(_0x4d4384,_0x5b8874){_0x4d4384=_0x4d4384-0x0;var _0xa0fef2=_0xc1c2[_0x4d4384];return _0xa0fef2;};'use strict';var EventEmitter=require(_0x2c1c('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x2c1c('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2c1c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c1c('0x3'),'afterDestroy':_0x2c1c('0x4')};function emitEvent(_0x1709e4){return function(_0x4f13b3,_0x577d95,_0x654cfa){FaxAccountEvents[_0x2c1c('0x5')](_0x1709e4+':'+_0x4f13b3['id'],_0x4f13b3);FaxAccountEvents[_0x2c1c('0x5')](_0x1709e4,_0x4f13b3);_0x654cfa(null);};}for(var e in events){if(events[_0x2c1c('0x6')](e)){var event=events[e];FaxAccount[_0x2c1c('0x7')](e,emitEvent(event));}}module[_0x2c1c('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 6c0ab61..b72d3ea 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 _0x59c7=['api','moment','bluebird','request-promise','./faxAccount.attributes','FaxAccount','fax_accounts','lodash','util','../../config/logger'];(function(_0xa4484e,_0x557073){var _0x1b8ad1=function(_0x13b053){while(--_0x13b053){_0xa4484e['push'](_0xa4484e['shift']());}};_0x1b8ad1(++_0x557073);}(_0x59c7,0x1e7));var _0x759c=function(_0x349fe,_0x129e42){_0x349fe=_0x349fe-0x0;var _0x34be13=_0x59c7[_0x349fe];return _0x34be13;};'use strict';var _=require(_0x759c('0x0'));var util=require(_0x759c('0x1'));var logger=require(_0x759c('0x2'))(_0x759c('0x3'));var moment=require(_0x759c('0x4'));var BPromise=require(_0x759c('0x5'));var rp=require(_0x759c('0x6'));var attributes=require(_0x759c('0x7'));module['exports']=function(_0x3ad5e2,_0x150aaf){return _0x3ad5e2['define'](_0x759c('0x8'),attributes,{'tableName':_0x759c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1903=['bluebird','request-promise','fax_accounts','util','../../config/logger','api','moment'];(function(_0x324bcd,_0x347993){var _0x2a864d=function(_0x42e12f){while(--_0x42e12f){_0x324bcd['push'](_0x324bcd['shift']());}};_0x2a864d(++_0x347993);}(_0x1903,0x7a));var _0x3190=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1903[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x3190('0x0'));var logger=require(_0x3190('0x1'))(_0x3190('0x2'));var moment=require(_0x3190('0x3'));var BPromise=require(_0x3190('0x4'));var rp=require(_0x3190('0x5'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x3cd272,_0x27a762){return _0x3cd272['define']('FaxAccount',attributes,{'tableName':_0x3190('0x6'),'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 db4e164..bfd23db 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 _0x5db0=['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','CmList','List','Contacts','DESC','Applications','applications','list','priority','asc','length','defaults','ListId','contact','create','Contact\x20not\x20found','spread','get','push','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','find','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','localhost','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','code','error','message','result','catch','GetFaxAccount','FaxAccount','options','where','attributes','include','map','model','stringify','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','body','isNil','from\x20is\x20mandatory'];(function(_0x551ed2,_0x197d2d){var _0x4bb9d1=function(_0x5b49f6){while(--_0x5b49f6){_0x551ed2['push'](_0x551ed2['shift']());}};_0x4bb9d1(++_0x197d2d);}(_0x5db0,0x75));var _0x05db=function(_0x45039e,_0x276da8){_0x45039e=_0x45039e-0x0;var _0x389836=_0x5db0[_0x45039e];return _0x389836;};'use strict';var _=require(_0x05db('0x0'));var util=require(_0x05db('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x05db('0x2'));var fs=require('fs');var db=require(_0x05db('0x3'))['db'];var utils=require(_0x05db('0x4'));var logger=require(_0x05db('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x05db('0x6'));var client=jayson['client']['http']({'port':0x232c});var socket=require('socket.io-emitter')({'host':_0x05db('0x7'),'port':0x18eb});require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x113f59,_0x4ebf67,_0x273d1b){return new BPromise(function(_0x5568ba,_0x45e0f8){return client[_0x05db('0x8')](_0x113f59,_0x273d1b)[_0x05db('0x9')](function(_0x1f5c96){logger[_0x05db('0xa')](_0x05db('0xb'),_0x4ebf67,'request\x20sent');logger[_0x05db('0xc')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4ebf67,_0x05db('0xd'),JSON['stringify'](_0x1f5c96));if(_0x1f5c96['error']){if(_0x1f5c96['error'][_0x05db('0xe')]===0x1f4){logger[_0x05db('0xf')]('FaxAccount,\x20%s,\x20%s',_0x4ebf67,_0x1f5c96[_0x05db('0xf')]['message']);return _0x45e0f8(_0x1f5c96[_0x05db('0xf')][_0x05db('0x10')]);}logger[_0x05db('0xf')](_0x05db('0xb'),_0x4ebf67,_0x1f5c96[_0x05db('0xf')][_0x05db('0x10')]);return _0x5568ba(_0x1f5c96[_0x05db('0xf')][_0x05db('0x10')]);}else{logger[_0x05db('0xa')](_0x05db('0xb'),_0x4ebf67,'request\x20sent');_0x5568ba(_0x1f5c96[_0x05db('0x11')][_0x05db('0x10')]);}})[_0x05db('0x12')](function(_0x116a43){logger['error']('FaxAccount,\x20%s,\x20%s',_0x4ebf67,_0x116a43);_0x45e0f8(_0x116a43);});});}exports[_0x05db('0x13')]=function(_0x4e33a9){var _0x2fa923=this;return new Promise(function(_0x467bb8,_0x1c656c){return db[_0x05db('0x14')]['findAll']({'raw':_0x4e33a9[_0x05db('0x15')]?_0x4e33a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e33a9[_0x05db('0x15')]?_0x4e33a9[_0x05db('0x15')][_0x05db('0x16')]||null:null,'attributes':_0x4e33a9['options']?_0x4e33a9[_0x05db('0x15')][_0x05db('0x17')]||null:null,'limit':_0x4e33a9[_0x05db('0x15')]?_0x4e33a9[_0x05db('0x15')]['limit']||null:null,'include':_0x4e33a9['options']?_0x4e33a9[_0x05db('0x15')][_0x05db('0x18')]?_[_0x05db('0x19')](_0x4e33a9['options'][_0x05db('0x18')],function(_0x22786b){return{'model':db[_0x22786b[_0x05db('0x1a')]],'as':_0x22786b['as'],'attributes':_0x22786b['attributes'],'include':_0x22786b[_0x05db('0x18')]?_[_0x05db('0x19')](_0x22786b[_0x05db('0x18')],function(_0x591527){return{'model':db[_0x591527[_0x05db('0x1a')]],'as':_0x591527['as'],'attributes':_0x591527[_0x05db('0x17')],'include':_0x591527['include']?_[_0x05db('0x19')](_0x591527[_0x05db('0x18')],function(_0x26f58d){return{'model':db[_0x26f58d[_0x05db('0x1a')]],'as':_0x26f58d['as'],'attributes':_0x26f58d[_0x05db('0x17')]};}):[]};}):[]};}):[]:[]})[_0x05db('0x9')](function(_0x1e1582){logger['info']('GetFaxAccount',_0x4e33a9);logger['debug'](_0x05db('0x13'),_0x4e33a9,JSON[_0x05db('0x1b')](_0x1e1582));_0x467bb8(_0x1e1582);})['catch'](function(_0x2eeeeb){logger[_0x05db('0xf')]('GetFaxAccount',_0x2eeeeb[_0x05db('0x10')],_0x4e33a9);_0x1c656c(_0x2fa923[_0x05db('0xf')](0x1f4,_0x2eeeeb['message']));});});};exports[_0x05db('0x1c')]=function(_0x1f2eb3,_0x26bc6f,_0x5ee378){var _0x33b9f6=this;return new Promise(function(_0x2c9b35,_0x114448){var _0x55e16d={'body':_0x1f2eb3['body'],'channel':'fax'};var _0x33a06b=[];var _0x8087f7=[];var _0x2db83a={};return db[_0x05db('0x1d')][_0x05db('0x1e')]()['then'](function(_0x282cdd){if(!_0x282cdd){throw new db[(_0x05db('0x1f'))][(_0x05db('0x20'))](_0x05db('0x21'));}_0x33a06b=_[_0x05db('0x22')](_[_0x05db('0x23')](_0x282cdd),['createdAt','updatedAt']);_0x8087f7=_[_0x05db('0x22')](_[_0x05db('0x23')](_0x282cdd),[_0x05db('0x24'),_0x05db('0x25'),'CompanyId','ListId']);if(_0x1f2eb3[_0x05db('0x26')]['id']){delete _0x1f2eb3[_0x05db('0x26')]['id'];}if(_[_0x05db('0x27')](_0x1f2eb3[_0x05db('0x26')]['from'])){throw new db['Sequelize']['ValidationError'](_0x05db('0x28'));}if(_[_0x05db('0x27')](_0x1f2eb3[_0x05db('0x26')]['body'])||_0x1f2eb3[_0x05db('0x26')][_0x05db('0x26')]===''){throw new db[(_0x05db('0x1f'))][(_0x05db('0x20'))](_0x05db('0x29'));}if(_['isNil'](_0x1f2eb3['body']['mapKey'])){throw new db[(_0x05db('0x1f'))]['ValidationError'](_0x05db('0x2a')+_0x8087f7);}if(!_[_0x05db('0x2b')](_0x8087f7,_0x1f2eb3['body'][_0x05db('0x2c')])){throw new db[(_0x05db('0x1f'))][(_0x05db('0x20'))](_0x05db('0x2d')+_0x8087f7);}_0x2db83a[_0x1f2eb3[_0x05db('0x26')][_0x05db('0x2c')]]=_0x1f2eb3[_0x05db('0x26')]['from'];})[_0x05db('0x9')](function(){return db[_0x05db('0x14')]['find']({'where':{'id':_0x1f2eb3[_0x05db('0x2e')]['id']},'include':[{'model':db[_0x05db('0x2f')],'as':_0x05db('0x30'),'include':[{'model':db[_0x05db('0x1d')],'as':_0x05db('0x31'),'where':_0x2db83a,'limit':0x1,'order':[[_0x05db('0x25'),_0x05db('0x32')]]}]},{'model':db['FaxApplication'],'as':_0x05db('0x33')}]});})[_0x05db('0x9')](function(_0x480c12){if(_0x480c12&&_0x480c12[_0x05db('0x30')]){var _0xc1d5bd=_0x480c12['get']({'plain':!![]});_0x55e16d[_0x05db('0x2e')]=_0xc1d5bd;_0x55e16d[_0x05db('0x34')]=_0xc1d5bd[_0x05db('0x33')];_0x55e16d[_0x05db('0x35')]=_0xc1d5bd[_0x05db('0x30')];_0x55e16d['applications']=_['orderBy'](_0x55e16d[_0x05db('0x34')],[_0x05db('0x36')],[_0x05db('0x37')]);if(_0x55e16d['account'][_0x05db('0x33')]){delete _0x55e16d[_0x05db('0x2e')][_0x05db('0x33')];}if(_0x55e16d['account'][_0x05db('0x30')]&&_0x55e16d[_0x05db('0x2e')][_0x05db('0x30')][_0x05db('0x31')][_0x05db('0x38')]){return _0x55e16d[_0x05db('0x2e')][_0x05db('0x30')][_0x05db('0x31')][0x0];}var _0x9efabf=_[_0x05db('0x39')](_0x1f2eb3[_0x05db('0x26')],{'firstName':_0x1f2eb3['body']['from'],'ListId':_0xc1d5bd[_0x05db('0x3a')]});_0x9efabf[_0x1f2eb3[_0x05db('0x26')][_0x05db('0x2c')]]=_0x1f2eb3['body']['from'];return db['CmContact']['create'](_0x9efabf,{'fields':_0x33a06b,'raw':!![]});}})[_0x05db('0x9')](function(_0x249220){_0x55e16d[_0x05db('0x3b')]=_0x249220;if(_0x249220){var _0x34eda1={'ContactId':_0x249220['id'],'FaxAccountId':_0x1f2eb3[_0x05db('0x2e')]['id'],'fax':_0x249220['fax']};return db['FaxInteraction']['find']({'where':{'ContactId':_0x249220['id'],'closed':![],'FaxAccountId':_0x1f2eb3[_0x05db('0x2e')]['id']}})[_0x05db('0x9')](function(_0x39c76b){if(_0x39c76b){return[_0x39c76b,![]];}return db['FaxInteraction'][_0x05db('0x3c')](_0x34eda1)[_0x05db('0x9')](function(_0x4526f4){return[_0x4526f4,!![]];});});}else{throw new Error(_0x05db('0x3d'));}})[_0x05db('0x3e')](function(_0x53c31b,_0x337100){var _0x4b8021=_0x53c31b[_0x05db('0x3f')]({'plain':!![]});if(_0x337100){if(_0x55e16d['account']['autoclose']){_0x55e16d['applications'][_0x05db('0x40')]({'id':0x0,'priority':_0x55e16d[_0x05db('0x34')][_0x05db('0x38')]+0x1,'app':'close','appdata':_0x05db('0x41'),'interval':_0x05db('0x42')});}_0x4b8021[_0x05db('0x43')]=!![];}else{_0x4b8021[_0x05db('0x43')]=![];}_0x55e16d[_0x05db('0x44')]=_0x4b8021;return db['FaxMessage'][_0x05db('0x3c')]({'body':_0x1f2eb3['body'][_0x05db('0x26')],'FaxAccountId':_0x1f2eb3['account']['id'],'FaxInteractionId':_0x53c31b['id'],'direction':'in','ContactId':_0x53c31b[_0x05db('0x45')],'AttachmentId':_0x1f2eb3['body'][_0x05db('0x46')]});})[_0x05db('0x9')](function(_0x5b3632){_0x55e16d['message']=_0x5b3632;if(_0x55e16d[_0x05db('0x44')][_0x05db('0x47')]){return db[_0x05db('0x48')][_0x05db('0x49')]({'attributes':['id',_0x05db('0x4a')],'where':{'id':_0x55e16d[_0x05db('0x44')]['UserId']}})['then'](function(_0x3d42fa){if(_0x3d42fa){_0x55e16d['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x05db('0x4b'),'appdata':_0x3d42fa[_0x05db('0x4a')]+','+(_0x55e16d[_0x05db('0x2e')][_0x05db('0x4c')]||0xa),'interval':_0x05db('0x42')});}return respondWithRpcPromise(_0x05db('0x4d'),_0x05db('0x4e'),_0x55e16d);});}return respondWithRpcPromise(_0x05db('0x4d'),_0x05db('0x4e'),_0x55e16d);})[_0x05db('0x9')](function(_0x23a423){_0x2c9b35(_0x23a423);})[_0x05db('0x12')](function(_0x395771){_0x114448(_0x33b9f6[_0x05db('0xf')](0x1f4,_0x395771['message']));});});}; \ No newline at end of file +var _0x0787=['request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','then','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','createdAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','defaults','create','contact','FaxInteraction','spread','autoclose','*,*,*,*','created','interaction','FaxMessage','AttachmentId','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','socket.io-emitter','localhost'];(function(_0x93cf39,_0x2088b0){var _0x2f8368=function(_0x194c24){while(--_0x194c24){_0x93cf39['push'](_0x93cf39['shift']());}};_0x2f8368(++_0x2088b0);}(_0x0787,0x142));var _0x7078=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0x0787[_0x5de1bc];return _0x19f4b8;};'use strict';var _=require(_0x7078('0x0'));var util=require(_0x7078('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7078('0x2'));var fs=require('fs');var db=require(_0x7078('0x3'))['db'];var utils=require(_0x7078('0x4'));var logger=require('../../config/logger')(_0x7078('0x5'));var config=require('../../config/environment');var jayson=require(_0x7078('0x6'));var client=jayson['client'][_0x7078('0x7')]({'port':0x232c});var socket=require(_0x7078('0x8'))({'host':_0x7078('0x9'),'port':0x18eb});require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3004fa,_0x28b7aa,_0x311086){return new BPromise(function(_0x375707,_0x42807c){return client[_0x7078('0xa')](_0x3004fa,_0x311086)['then'](function(_0x3e97cb){logger[_0x7078('0xb')]('FaxAccount,\x20%s,\x20%s',_0x28b7aa,_0x7078('0xc'));logger[_0x7078('0xd')](_0x7078('0xe'),_0x28b7aa,_0x7078('0xc'),JSON[_0x7078('0xf')](_0x3e97cb));if(_0x3e97cb[_0x7078('0x10')]){if(_0x3e97cb['error'][_0x7078('0x11')]===0x1f4){logger[_0x7078('0x10')](_0x7078('0x12'),_0x28b7aa,_0x3e97cb[_0x7078('0x10')][_0x7078('0x13')]);return _0x42807c(_0x3e97cb[_0x7078('0x10')][_0x7078('0x13')]);}logger[_0x7078('0x10')]('FaxAccount,\x20%s,\x20%s',_0x28b7aa,_0x3e97cb[_0x7078('0x10')][_0x7078('0x13')]);return _0x375707(_0x3e97cb[_0x7078('0x10')][_0x7078('0x13')]);}else{logger[_0x7078('0xb')](_0x7078('0x12'),_0x28b7aa,_0x7078('0xc'));_0x375707(_0x3e97cb['result'][_0x7078('0x13')]);}})[_0x7078('0x14')](function(_0x484f13){logger[_0x7078('0x10')](_0x7078('0x12'),_0x28b7aa,_0x484f13);_0x42807c(_0x484f13);});});}exports[_0x7078('0x15')]=function(_0x1c9d10){var _0x5bf99d=this;return new Promise(function(_0x3bf017,_0x302886){return db[_0x7078('0x16')]['findAll']({'raw':_0x1c9d10[_0x7078('0x17')]?_0x1c9d10[_0x7078('0x17')][_0x7078('0x18')]===undefined?!![]:![]:!![],'where':_0x1c9d10['options']?_0x1c9d10[_0x7078('0x17')][_0x7078('0x19')]||null:null,'attributes':_0x1c9d10[_0x7078('0x17')]?_0x1c9d10[_0x7078('0x17')][_0x7078('0x1a')]||null:null,'limit':_0x1c9d10[_0x7078('0x17')]?_0x1c9d10[_0x7078('0x17')][_0x7078('0x1b')]||null:null,'include':_0x1c9d10['options']?_0x1c9d10[_0x7078('0x17')][_0x7078('0x1c')]?_['map'](_0x1c9d10[_0x7078('0x17')][_0x7078('0x1c')],function(_0x1aa7cd){return{'model':db[_0x1aa7cd['model']],'as':_0x1aa7cd['as'],'attributes':_0x1aa7cd[_0x7078('0x1a')],'include':_0x1aa7cd[_0x7078('0x1c')]?_[_0x7078('0x1d')](_0x1aa7cd[_0x7078('0x1c')],function(_0x1b0006){return{'model':db[_0x1b0006[_0x7078('0x1e')]],'as':_0x1b0006['as'],'attributes':_0x1b0006[_0x7078('0x1a')],'include':_0x1b0006[_0x7078('0x1c')]?_[_0x7078('0x1d')](_0x1b0006['include'],function(_0x1bdc13){return{'model':db[_0x1bdc13[_0x7078('0x1e')]],'as':_0x1bdc13['as'],'attributes':_0x1bdc13[_0x7078('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f7e99){logger[_0x7078('0xb')](_0x7078('0x15'),_0x1c9d10);logger[_0x7078('0xd')](_0x7078('0x15'),_0x1c9d10,JSON['stringify'](_0x4f7e99));_0x3bf017(_0x4f7e99);})[_0x7078('0x14')](function(_0x48b352){logger[_0x7078('0x10')](_0x7078('0x15'),_0x48b352[_0x7078('0x13')],_0x1c9d10);_0x302886(_0x5bf99d[_0x7078('0x10')](0x1f4,_0x48b352[_0x7078('0x13')]));});});};exports[_0x7078('0x1f')]=function(_0x214791,_0x5775be,_0x546b7c){var _0x43809d=this;return new Promise(function(_0x3bc12e,_0xa9c7cd){var _0xefc2d4={'body':_0x214791[_0x7078('0x20')],'channel':_0x7078('0x21')};var _0x26ac26=[];var _0x40df94=[];var _0x2682a3={};return db[_0x7078('0x22')]['describe']()[_0x7078('0x23')](function(_0x1e5ebd){if(!_0x1e5ebd){throw new db['Sequelize'][(_0x7078('0x24'))](_0x7078('0x25'));}_0x26ac26=_['difference'](_[_0x7078('0x26')](_0x1e5ebd),['createdAt',_0x7078('0x27')]);_0x40df94=_[_0x7078('0x28')](_[_0x7078('0x26')](_0x1e5ebd),[_0x7078('0x29'),'updatedAt',_0x7078('0x2a'),_0x7078('0x2b')]);if(_0x214791['body']['id']){delete _0x214791[_0x7078('0x20')]['id'];}if(_[_0x7078('0x2c')](_0x214791[_0x7078('0x20')][_0x7078('0x2d')])){throw new db[(_0x7078('0x2e'))][(_0x7078('0x24'))](_0x7078('0x2f'));}if(_[_0x7078('0x2c')](_0x214791['body'][_0x7078('0x20')])||_0x214791[_0x7078('0x20')][_0x7078('0x20')]===''){throw new db[(_0x7078('0x2e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7078('0x2c')](_0x214791[_0x7078('0x20')][_0x7078('0x30')])){throw new db[(_0x7078('0x2e'))][(_0x7078('0x24'))](_0x7078('0x31')+_0x40df94);}if(!_[_0x7078('0x32')](_0x40df94,_0x214791['body'][_0x7078('0x30')])){throw new db['Sequelize']['ValidationError'](_0x7078('0x33')+_0x40df94);}_0x2682a3[_0x214791[_0x7078('0x20')][_0x7078('0x30')]]=_0x214791[_0x7078('0x20')][_0x7078('0x2d')];})['then'](function(){return db[_0x7078('0x16')][_0x7078('0x34')]({'where':{'id':_0x214791[_0x7078('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x7078('0x36'),'include':[{'model':db[_0x7078('0x22')],'as':_0x7078('0x37'),'where':_0x2682a3,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x7078('0x38')],'as':_0x7078('0x39')}]});})['then'](function(_0x180278){if(_0x180278&&_0x180278[_0x7078('0x36')]){var _0x2f3ac7=_0x180278[_0x7078('0x3a')]({'plain':!![]});_0xefc2d4['account']=_0x2f3ac7;_0xefc2d4[_0x7078('0x3b')]=_0x2f3ac7[_0x7078('0x39')];_0xefc2d4[_0x7078('0x3c')]=_0x2f3ac7[_0x7078('0x36')];_0xefc2d4['applications']=_[_0x7078('0x3d')](_0xefc2d4[_0x7078('0x3b')],[_0x7078('0x3e')],[_0x7078('0x3f')]);if(_0xefc2d4['account'][_0x7078('0x39')]){delete _0xefc2d4[_0x7078('0x35')][_0x7078('0x39')];}if(_0xefc2d4['account'][_0x7078('0x36')]&&_0xefc2d4[_0x7078('0x35')][_0x7078('0x36')][_0x7078('0x37')][_0x7078('0x40')]){return _0xefc2d4[_0x7078('0x35')][_0x7078('0x36')][_0x7078('0x37')][0x0];}var _0x1d7cfb=_[_0x7078('0x41')](_0x214791[_0x7078('0x20')],{'firstName':_0x214791[_0x7078('0x20')][_0x7078('0x2d')],'ListId':_0x2f3ac7['ListId']});_0x1d7cfb[_0x214791[_0x7078('0x20')][_0x7078('0x30')]]=_0x214791[_0x7078('0x20')][_0x7078('0x2d')];return db[_0x7078('0x22')][_0x7078('0x42')](_0x1d7cfb,{'fields':_0x26ac26,'raw':!![]});}})[_0x7078('0x23')](function(_0x307989){_0xefc2d4[_0x7078('0x43')]=_0x307989;if(_0x307989){var _0x44ed6e={'ContactId':_0x307989['id'],'FaxAccountId':_0x214791[_0x7078('0x35')]['id'],'fax':_0x307989[_0x7078('0x21')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x307989['id'],'closed':![],'FaxAccountId':_0x214791['account']['id']}})[_0x7078('0x23')](function(_0x4319e2){if(_0x4319e2){return[_0x4319e2,![]];}return db[_0x7078('0x44')][_0x7078('0x42')](_0x44ed6e)[_0x7078('0x23')](function(_0x115669){return[_0x115669,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7078('0x45')](function(_0xe372a2,_0x497767){var _0x2bcfbc=_0xe372a2[_0x7078('0x3a')]({'plain':!![]});if(_0x497767){if(_0xefc2d4[_0x7078('0x35')][_0x7078('0x46')]){_0xefc2d4[_0x7078('0x3b')]['push']({'id':0x0,'priority':_0xefc2d4['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x7078('0x47')});}_0x2bcfbc[_0x7078('0x48')]=!![];}else{_0x2bcfbc[_0x7078('0x48')]=![];}_0xefc2d4[_0x7078('0x49')]=_0x2bcfbc;return db[_0x7078('0x4a')][_0x7078('0x42')]({'body':_0x214791['body'][_0x7078('0x20')],'FaxAccountId':_0x214791[_0x7078('0x35')]['id'],'FaxInteractionId':_0xe372a2['id'],'direction':'in','ContactId':_0xe372a2['ContactId'],'AttachmentId':_0x214791[_0x7078('0x20')][_0x7078('0x4b')]});})[_0x7078('0x23')](function(_0x4b8795){_0xefc2d4[_0x7078('0x13')]=_0x4b8795;if(_0xefc2d4[_0x7078('0x49')]['UserId']){return db['User'][_0x7078('0x34')]({'attributes':['id',_0x7078('0x4c')],'where':{'id':_0xefc2d4[_0x7078('0x49')][_0x7078('0x4d')]}})['then'](function(_0x5aa4c7){if(_0x5aa4c7){_0xefc2d4[_0x7078('0x3b')][_0x7078('0x4e')]({'id':0x0,'priority':0x0,'app':_0x7078('0x4f'),'appdata':_0x5aa4c7[_0x7078('0x4c')]+','+(_0xefc2d4[_0x7078('0x35')][_0x7078('0x50')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7078('0x51'),_0x7078('0x52'),_0xefc2d4);});}return respondWithRpcPromise(_0x7078('0x51'),_0x7078('0x52'),_0xefc2d4);})[_0x7078('0x23')](function(_0x277986){_0x3bc12e(_0x277986);})[_0x7078('0x14')](function(_0x10479d){_0xa9c7cd(_0x43809d[_0x7078('0x10')](0x1f4,_0x10479d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 47d087d..54e355b 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 _0x2271=['save','remove','update','emit','register','faxAccount:'];(function(_0x1848b5,_0x3e81d9){var _0x455dc1=function(_0x30c989){while(--_0x30c989){_0x1848b5['push'](_0x1848b5['shift']());}};_0x455dc1(++_0x3e81d9);}(_0x2271,0x1e0));var _0x1227=function(_0x508ad6,_0x20341f){_0x508ad6=_0x508ad6-0x0;var _0x2b5f47=_0x2271[_0x508ad6];return _0x2b5f47;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x1227('0x0'),_0x1227('0x1'),_0x1227('0x2')];function createListener(_0x125419,_0x5a3430){return function(_0x596a54){_0x5a3430[_0x1227('0x3')](_0x125419,_0x596a54);};}function removeListener(_0x5937ff,_0x4981f1){return function(){FaxAccountEvents['removeListener'](_0x5937ff,_0x4981f1);};}exports[_0x1227('0x4')]=function(_0xa40446){for(var _0x311273=0x0,_0x4e8519=events['length'];_0x311273<_0x4e8519;_0x311273++){var _0x299841=events[_0x311273];var _0x3f6ad8=createListener(_0x1227('0x5')+_0x299841,_0xa40446);FaxAccountEvents['on'](_0x299841,_0x3f6ad8);}}; \ No newline at end of file +var _0x1a37=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x1a37,0x127));var _0x71a3=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x1a37[_0x1f36bb];return _0xaf97fa;};'use strict';var FaxAccountEvents=require(_0x71a3('0x0'));var events=[_0x71a3('0x1'),_0x71a3('0x2'),_0x71a3('0x3')];function createListener(_0x8f792,_0x20ec9){return function(_0x2c5d83){_0x20ec9[_0x71a3('0x4')](_0x8f792,_0x2c5d83);};}function removeListener(_0x43317b,_0x441e1){return function(){FaxAccountEvents[_0x71a3('0x5')](_0x43317b,_0x441e1);};}exports[_0x71a3('0x6')]=function(_0x333414){for(var _0x2fd7e0=0x0,_0x287e01=events[_0x71a3('0x7')];_0x2fd7e0<_0x287e01;_0x2fd7e0++){var _0x2e46bd=events[_0x2fd7e0];var _0x3fcfa7=createListener(_0x71a3('0x8')+_0x2e46bd,_0x333414);FaxAccountEvents['on'](_0x2e46bd,_0x3fcfa7);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 953bd21..8001dc3 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 _0x1822=['util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','getDispositions','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0xce2d46,_0x3be00c){var _0xa284d1=function(_0x1bcef5){while(--_0x1bcef5){_0xce2d46['push'](_0xce2d46['shift']());}};_0xa284d1(++_0x3be00c);}(_0x1822,0x140));var _0x2182=function(_0x3e8472,_0x284842){_0x3e8472=_0x3e8472-0x0;var _0x2f8ad8=_0x1822[_0x3e8472];return _0x2f8ad8;};'use strict';var multer=require('multer');var util=require(_0x2182('0x0'));var path=require(_0x2182('0x1'));var express=require(_0x2182('0x2'));var router=express['Router']();var auth=require(_0x2182('0x3'));var interaction=require(_0x2182('0x4'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x2182('0x5')]('/',auth[_0x2182('0x6')](),controller[_0x2182('0x7')]);router[_0x2182('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2182('0x5')](_0x2182('0x8'),auth[_0x2182('0x6')](),controller['show']);router[_0x2182('0x5')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2182('0x9')]);router[_0x2182('0x5')]('/:id/canned_answers',auth[_0x2182('0x6')](),controller['getAnswers']);router['get'](_0x2182('0xa'),auth[_0x2182('0x6')](),controller[_0x2182('0xb')]);router[_0x2182('0x5')](_0x2182('0xc'),auth['isAuthenticated'](),controller[_0x2182('0xd')]);router['get'](_0x2182('0xe'),auth['isAuthenticated'](),controller[_0x2182('0xf')]);router[_0x2182('0x5')](_0x2182('0x10'),auth[_0x2182('0x6')](),controller[_0x2182('0x11')]);router[_0x2182('0x12')]('/',auth[_0x2182('0x6')](),controller[_0x2182('0x13')]);router[_0x2182('0x12')]('/:id/dispositions',auth[_0x2182('0x6')](),controller[_0x2182('0x14')]);router[_0x2182('0x12')](_0x2182('0x15'),auth[_0x2182('0x6')](),controller[_0x2182('0x16')]);router[_0x2182('0x12')](_0x2182('0xa'),auth[_0x2182('0x6')](),controller[_0x2182('0x17')]);router[_0x2182('0x12')](_0x2182('0xc'),auth[_0x2182('0x6')](),controller[_0x2182('0x18')]);router[_0x2182('0x12')](_0x2182('0x19'),auth[_0x2182('0x6')](),controller[_0x2182('0x1a')]);router[_0x2182('0x12')](_0x2182('0x1b'),auth[_0x2182('0x6')](),controller['updateAccountApplications']);router[_0x2182('0x12')](_0x2182('0x1c'),auth[_0x2182('0x6')](),controller[_0x2182('0x1d')]);router[_0x2182('0x12')](_0x2182('0x10'),auth[_0x2182('0x6')](),controller[_0x2182('0x1e')]);router[_0x2182('0x1f')]('/:id',auth[_0x2182('0x6')](),controller[_0x2182('0x20')]);router[_0x2182('0x21')](_0x2182('0x8'),auth['isAuthenticated'](),controller[_0x2182('0x22')]);router[_0x2182('0x21')](_0x2182('0x23'),auth[_0x2182('0x6')](),controller[_0x2182('0x24')]);router[_0x2182('0x21')](_0x2182('0x15'),auth[_0x2182('0x6')](),controller[_0x2182('0x25')]);router['delete'](_0x2182('0x10'),auth[_0x2182('0x6')](),controller[_0x2182('0x26')]);module[_0x2182('0x27')]=router; \ No newline at end of file +var _0xdf0e=['/:id/users','getAgents','post','addDisposition','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','multer','path','express','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0xdf0e,0xa4));var _0xedf0=function(_0x11f345,_0x3d1ac3){_0x11f345=_0x11f345-0x0;var _0x5d66c9=_0xdf0e[_0x11f345];return _0x5d66c9;};'use strict';var multer=require(_0xedf0('0x0'));var util=require('util');var path=require(_0xedf0('0x1'));var express=require(_0xedf0('0x2'));var router=express[_0xedf0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xedf0('0x4'));var config=require(_0xedf0('0x5'));var controller=require(_0xedf0('0x6'));router[_0xedf0('0x7')]('/',auth[_0xedf0('0x8')](),controller['index']);router[_0xedf0('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xedf0('0x9')]);router['get'](_0xedf0('0xa'),auth[_0xedf0('0x8')](),controller['show']);router[_0xedf0('0x7')](_0xedf0('0xb'),auth['isAuthenticated'](),controller[_0xedf0('0xc')]);router['get'](_0xedf0('0xd'),auth['isAuthenticated'](),controller[_0xedf0('0xe')]);router[_0xedf0('0x7')](_0xedf0('0xf'),auth[_0xedf0('0x8')](),controller[_0xedf0('0x10')]);router[_0xedf0('0x7')](_0xedf0('0x11'),auth[_0xedf0('0x8')](),controller[_0xedf0('0x12')]);router[_0xedf0('0x7')](_0xedf0('0x13'),auth['isAuthenticated'](),controller[_0xedf0('0x14')]);router['get'](_0xedf0('0x15'),auth['isAuthenticated'](),controller[_0xedf0('0x16')]);router[_0xedf0('0x17')]('/',auth[_0xedf0('0x8')](),controller['create']);router[_0xedf0('0x17')](_0xedf0('0xb'),auth[_0xedf0('0x8')](),controller[_0xedf0('0x18')]);router[_0xedf0('0x17')](_0xedf0('0xd'),auth[_0xedf0('0x8')](),controller['addAnswer']);router[_0xedf0('0x17')](_0xedf0('0xf'),auth['isAuthenticated'](),controller[_0xedf0('0x19')]);router[_0xedf0('0x17')](_0xedf0('0x11'),auth[_0xedf0('0x8')](),controller[_0xedf0('0x1a')]);router[_0xedf0('0x17')](_0xedf0('0x1b'),auth['isAuthenticated'](),controller['addAccountApplications']);router['post'](_0xedf0('0x1c'),auth[_0xedf0('0x8')](),controller[_0xedf0('0x1d')]);router[_0xedf0('0x17')](_0xedf0('0x1e'),auth['isAuthenticated'](),controller['send']);router[_0xedf0('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xedf0('0x1f')]);router[_0xedf0('0x20')]('/:id',auth[_0xedf0('0x8')](),controller[_0xedf0('0x21')]);router[_0xedf0('0x22')](_0xedf0('0xa'),auth[_0xedf0('0x8')](),controller['destroy']);router[_0xedf0('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xedf0('0x23')]);router[_0xedf0('0x22')](_0xedf0('0xd'),auth[_0xedf0('0x8')](),controller[_0xedf0('0x24')]);router[_0xedf0('0x22')](_0xedf0('0x15'),auth[_0xedf0('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f9bd2ea..f026059 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 _0xc098=['exports','INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xc098,0x153));var _0x8c09=function(_0x2eea68,_0x1bfb6f){_0x2eea68=_0x2eea68-0x0;var _0x2346ad=_0xc098[_0x2eea68];return _0x2346ad;};'use strict';var Sequelize=require(_0x8c09('0x0'));module[_0x8c09('0x1')]={'priority':{'type':Sequelize[_0x8c09('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8c09('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x8c09('0x3')]},'interval':{'type':Sequelize[_0x8c09('0x3')],'defaultValue':_0x8c09('0x4')}}; \ No newline at end of file +var _0xe5e8=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0xed359f,_0x3bed52){var _0x647105=function(_0x4d69cf){while(--_0x4d69cf){_0xed359f['push'](_0xed359f['shift']());}};_0x647105(++_0x3bed52);}(_0xe5e8,0x94));var _0x8e5e=function(_0x345a09,_0x2d6ba7){_0x345a09=_0x345a09-0x0;var _0x17866a=_0xe5e8[_0x345a09];return _0x17866a;};'use strict';var Sequelize=require(_0x8e5e('0x0'));module[_0x8e5e('0x1')]={'priority':{'type':Sequelize[_0x8e5e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8e5e('0x3')],'allowNull':![],'defaultValue':_0x8e5e('0x4')},'appdata':{'type':Sequelize[_0x8e5e('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8e5e('0x3')],'defaultValue':_0x8e5e('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7433418..4035515 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 _0x5bc8=['../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','Content-Range','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','add','day','merge','filter','where','options','FaxApplication','includeAll','findAll','rows','show','length','include','find','catch','create','body','params','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','crypto','desk.js','querystring','papaparse'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x5bc8,0xb8));var _0x85bc=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x5bc8[_0xdea41a];return _0x15d0d8;};'use strict';var jsonpatch=require(_0x85bc('0x0'));var rp=require(_0x85bc('0x1'));var moment=require(_0x85bc('0x2'));var BPromise=require(_0x85bc('0x3'));var Mustache=require('mustache');var util=require(_0x85bc('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x85bc('0x5'));var ejs=require(_0x85bc('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x85bc('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x85bc('0x8'));var toCsv=require(_0x85bc('0x5'));var querystring=require(_0x85bc('0x9'));var Papa=require(_0x85bc('0xa'));var qs=require(_0x85bc('0xb'));var logger=require('../../config/logger')(_0x85bc('0xc'));var utils=require(_0x85bc('0xd'));var config=require(_0x85bc('0xe'));var db=require(_0x85bc('0xf'))['db'];function respondWithStatusCode(_0x3fa0e5,_0x4017da){_0x4017da=_0x4017da||0xcc;return function(_0xf6f983){if(_0xf6f983){return _0x3fa0e5[_0x85bc('0x10')](_0x4017da);}return _0x3fa0e5[_0x85bc('0x11')](_0x4017da)['end']();};}function respondWithResult(_0x14343e,_0x474743){_0x474743=_0x474743||0xc8;return function(_0x3123b2){if(_0x3123b2){return _0x14343e[_0x85bc('0x11')](_0x474743)[_0x85bc('0x12')](_0x3123b2);}};}function respondWithFilteredResult(_0x2a6d6f,_0x14f330){return function(_0x1caf61){if(_0x1caf61){var _0x5bd60a=_0x1caf61[_0x85bc('0x13')],_0x2ced10=_0x14f330['offset'],_0x2692ba=_0x14f330['offset']+_0x14f330[_0x85bc('0x14')],_0x81844a;if(_0x2692ba>=_0x5bd60a){_0x2692ba=_0x5bd60a;_0x81844a=0xc8;}else{_0x81844a=0xce;}_0x2a6d6f[_0x85bc('0x11')](_0x81844a);return _0x2a6d6f['set'](_0x85bc('0x15'),_0x2ced10+'-'+_0x2692ba+'/'+_0x5bd60a)[_0x85bc('0x12')](_0x1caf61);}return null;};}function patchUpdates(_0xfb804e){return function(_0x3f7471){try{jsonpatch[_0x85bc('0x16')](_0x3f7471,_0xfb804e,!![]);}catch(_0x4377f8){return BPromise[_0x85bc('0x17')](_0x4377f8);}return _0x3f7471['save']();};}function saveUpdates(_0x5cadf2,_0x501a0d){return function(_0x51ab2c){if(_0x51ab2c){return _0x51ab2c[_0x85bc('0x18')](_0x5cadf2)[_0x85bc('0x19')](function(_0x481bb7){return _0x481bb7;});}return null;};}function removeEntity(_0x39a5b1,_0x1ec085){return function(_0x3a1347){if(_0x3a1347){return _0x3a1347[_0x85bc('0x1a')]()[_0x85bc('0x19')](function(){_0x39a5b1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e381e,_0x574f11){return function(_0x3c01be){if(!_0x3c01be){_0x4e381e[_0x85bc('0x10')](0x194);}return _0x3c01be;};}function handleError(_0x355a1c,_0x889a2f){_0x889a2f=_0x889a2f||0x1f4;return function(_0x51f458){logger[_0x85bc('0x1b')](_0x51f458['stack']);if(_0x51f458[_0x85bc('0x1c')]){delete _0x51f458[_0x85bc('0x1c')];}_0x355a1c[_0x85bc('0x11')](_0x889a2f)[_0x85bc('0x1d')](_0x51f458);};}exports[_0x85bc('0x1e')]=function(_0x450a95,_0x2fdece){var _0x4bef67={},_0xebe06c={},_0x3adcd1={'count':0x0,'rows':[]};var _0x3f98cf=db['FaxApplication'][_0x85bc('0x1f')];_0xebe06c[_0x85bc('0x20')]=_[_0x85bc('0x21')](_0x3f98cf);var _0x2d774d={'dateStart':_0x450a95['query'][_0x85bc('0x22')],'dateEnd':_0x450a95[_0x85bc('0x23')][_0x85bc('0x24')]};delete _0x450a95[_0x85bc('0x23')]['dateStart'];delete _0x450a95[_0x85bc('0x23')][_0x85bc('0x24')];_0xebe06c['query']=_[_0x85bc('0x21')](_0x450a95[_0x85bc('0x23')]);_0xebe06c[_0x85bc('0x25')]=_[_0x85bc('0x26')](_0xebe06c[_0x85bc('0x20')],_0xebe06c[_0x85bc('0x23')]);_0x4bef67[_0x85bc('0x27')]=_[_0x85bc('0x26')](_0xebe06c[_0x85bc('0x20')],qs[_0x85bc('0x28')](_0x450a95['query']['fields']));_0x4bef67['attributes']=_0x4bef67[_0x85bc('0x27')]['length']?_0x4bef67[_0x85bc('0x27')]:_0xebe06c['model'];if(!_0x450a95[_0x85bc('0x23')][_0x85bc('0x29')](_0x85bc('0x2a'))){_0x4bef67[_0x85bc('0x14')]=qs[_0x85bc('0x14')](_0x450a95[_0x85bc('0x23')][_0x85bc('0x14')]);_0x4bef67[_0x85bc('0x2b')]=qs[_0x85bc('0x2b')](_0x450a95[_0x85bc('0x23')]['offset']);}_0x4bef67[_0x85bc('0x2c')]=qs[_0x85bc('0x2d')](_0x450a95[_0x85bc('0x23')]['sort']);_0x4bef67['where']=qs['filters'](_[_0x85bc('0x2e')](_0x450a95[_0x85bc('0x23')],_0xebe06c[_0x85bc('0x25')]));if(_0x2d774d['dateStart']){if(_0x2d774d['dateEnd']){_0x2d774d[_0x85bc('0x24')]=moment(_0x2d774d[_0x85bc('0x24')])[_0x85bc('0x2f')](0x1,_0x85bc('0x30'));}else{_0x2d774d['dateEnd']=moment(_0x2d774d[_0x85bc('0x22')])[_0x85bc('0x2f')](0x1,_0x85bc('0x30'));}_[_0x85bc('0x31')](_0x4bef67['where'],{'createdAt':{'$gte':_0x2d774d['dateStart'],'$lte':_0x2d774d['dateEnd']}});}if(_0x450a95[_0x85bc('0x23')][_0x85bc('0x32')]){_0x4bef67['where']=_['merge'](_0x4bef67[_0x85bc('0x33')],{'$or':_['map'](_0x4bef67[_0x85bc('0x27')],function(_0x53a77a){var _0x3ee176={};_0x3ee176[_0x53a77a]={'$like':'%'+_0x450a95[_0x85bc('0x23')]['filter']+'%'};return _0x3ee176;})});}_0x4bef67=_[_0x85bc('0x31')]({},_0x4bef67,_0x450a95[_0x85bc('0x34')]);var _0x107c76={'where':_0x4bef67[_0x85bc('0x33')]};return db[_0x85bc('0x35')][_0x85bc('0x13')](_0x107c76)[_0x85bc('0x19')](function(_0x312ef9){_0x3adcd1[_0x85bc('0x13')]=_0x312ef9;if(_0x450a95[_0x85bc('0x23')][_0x85bc('0x36')]){_0x4bef67['include']=[{'all':!![]}];}return db[_0x85bc('0x35')][_0x85bc('0x37')](_0x4bef67);})[_0x85bc('0x19')](function(_0x386483){_0x3adcd1[_0x85bc('0x38')]=_0x386483;return _0x3adcd1;})['then'](respondWithFilteredResult(_0x2fdece,_0x4bef67))['catch'](handleError(_0x2fdece,null));};exports[_0x85bc('0x39')]=function(_0x37e966,_0x30cc5c){var _0x42920e={'raw':!![],'where':{'id':_0x37e966['params']['id']}},_0x3d572a={};_0x3d572a['model']=_[_0x85bc('0x21')](db[_0x85bc('0x35')][_0x85bc('0x1f')]);_0x3d572a[_0x85bc('0x23')]=_['keys'](_0x37e966[_0x85bc('0x23')]);_0x3d572a['filters']=_['intersection'](_0x3d572a['model'],_0x3d572a[_0x85bc('0x23')]);_0x42920e[_0x85bc('0x27')]=_[_0x85bc('0x26')](_0x3d572a[_0x85bc('0x20')],qs[_0x85bc('0x28')](_0x37e966[_0x85bc('0x23')]['fields']));_0x42920e[_0x85bc('0x27')]=_0x42920e[_0x85bc('0x27')][_0x85bc('0x3a')]?_0x42920e['attributes']:_0x3d572a['model'];if(_0x37e966['query'][_0x85bc('0x36')]){_0x42920e[_0x85bc('0x3b')]=[{'all':!![]}];}_0x42920e=_[_0x85bc('0x31')]({},_0x42920e,_0x37e966[_0x85bc('0x34')]);return db[_0x85bc('0x35')][_0x85bc('0x3c')](_0x42920e)[_0x85bc('0x19')](handleEntityNotFound(_0x30cc5c,null))[_0x85bc('0x19')](respondWithResult(_0x30cc5c,null))[_0x85bc('0x3d')](handleError(_0x30cc5c,null));};exports[_0x85bc('0x3e')]=function(_0xfb8b,_0xf8e0c2){return db[_0x85bc('0x35')][_0x85bc('0x3e')](_0xfb8b[_0x85bc('0x3f')],{})[_0x85bc('0x19')](respondWithResult(_0xf8e0c2,0xc9))['catch'](handleError(_0xf8e0c2,null));};exports[_0x85bc('0x18')]=function(_0x1be82f,_0x819a72){if(_0x1be82f[_0x85bc('0x3f')]['id']){delete _0x1be82f[_0x85bc('0x3f')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x1be82f[_0x85bc('0x40')]['id']}})[_0x85bc('0x19')](handleEntityNotFound(_0x819a72,null))[_0x85bc('0x19')](saveUpdates(_0x1be82f[_0x85bc('0x3f')],null))[_0x85bc('0x19')](respondWithResult(_0x819a72,null))[_0x85bc('0x3d')](handleError(_0x819a72,null));};exports[_0x85bc('0x1a')]=function(_0x31724d,_0x5c6d33){return db[_0x85bc('0x35')][_0x85bc('0x3c')]({'where':{'id':_0x31724d[_0x85bc('0x40')]['id']}})[_0x85bc('0x19')](handleEntityNotFound(_0x5c6d33,null))[_0x85bc('0x19')](removeEntity(_0x5c6d33,null))[_0x85bc('0x3d')](handleError(_0x5c6d33,null));}; \ No newline at end of file +var _0x0673=['save','update','destroy','error','stack','index','FaxApplication','rawAttributes','keys','query','dateStart','dateEnd','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','filter','merge','map','options','then','includeAll','findAll','rows','catch','include','find','create','body','params','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x27015a,_0xfd3d86){var _0x527894=function(_0x4b92ab){while(--_0x4b92ab){_0x27015a['push'](_0x27015a['shift']());}};_0x527894(++_0xfd3d86);}(_0x0673,0x144));var _0x3067=function(_0x22c023,_0xb6dc66){_0x22c023=_0x22c023-0x0;var _0x3774cc=_0x0673[_0x22c023];return _0x3774cc;};'use strict';var jsonpatch=require(_0x3067('0x0'));var rp=require(_0x3067('0x1'));var moment=require('moment');var BPromise=require(_0x3067('0x2'));var Mustache=require(_0x3067('0x3'));var util=require(_0x3067('0x4'));var path=require(_0x3067('0x5'));var sox=require(_0x3067('0x6'));var csv=require(_0x3067('0x7'));var ejs=require(_0x3067('0x8'));var fs=require('fs');var _=require(_0x3067('0x9'));var squel=require(_0x3067('0xa'));var crypto=require('crypto');var jsforce=require(_0x3067('0xb'));var deskjs=require(_0x3067('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3067('0xd'));var Papa=require(_0x3067('0xe'));var qs=require(_0x3067('0xf'));var logger=require(_0x3067('0x10'))(_0x3067('0x11'));var utils=require(_0x3067('0x12'));var config=require(_0x3067('0x13'));var db=require(_0x3067('0x14'))['db'];function respondWithStatusCode(_0x5592ed,_0x5c90c5){_0x5c90c5=_0x5c90c5||0xcc;return function(_0x42bcae){if(_0x42bcae){return _0x5592ed[_0x3067('0x15')](_0x5c90c5);}return _0x5592ed[_0x3067('0x16')](_0x5c90c5)[_0x3067('0x17')]();};}function respondWithResult(_0x1fbe58,_0x4035fe){_0x4035fe=_0x4035fe||0xc8;return function(_0x5e4946){if(_0x5e4946){return _0x1fbe58[_0x3067('0x16')](_0x4035fe)[_0x3067('0x18')](_0x5e4946);}};}function respondWithFilteredResult(_0x11e25b,_0x4581fa){return function(_0x5ee2ce){if(_0x5ee2ce){var _0x44667a=_0x5ee2ce[_0x3067('0x19')],_0x3a1604=_0x4581fa['offset'],_0xcda27f=_0x4581fa[_0x3067('0x1a')]+_0x4581fa[_0x3067('0x1b')],_0x25570d;if(_0xcda27f>=_0x44667a){_0xcda27f=_0x44667a;_0x25570d=0xc8;}else{_0x25570d=0xce;}_0x11e25b['status'](_0x25570d);return _0x11e25b['set'](_0x3067('0x1c'),_0x3a1604+'-'+_0xcda27f+'/'+_0x44667a)[_0x3067('0x18')](_0x5ee2ce);}return null;};}function patchUpdates(_0x10361a){return function(_0x18ccea){try{jsonpatch[_0x3067('0x1d')](_0x18ccea,_0x10361a,!![]);}catch(_0x36010c){return BPromise[_0x3067('0x1e')](_0x36010c);}return _0x18ccea[_0x3067('0x1f')]();};}function saveUpdates(_0x5a51d2,_0x340b75){return function(_0x6ad2e2){if(_0x6ad2e2){return _0x6ad2e2[_0x3067('0x20')](_0x5a51d2)['then'](function(_0x2b6921){return _0x2b6921;});}return null;};}function removeEntity(_0xe66336,_0x16293b){return function(_0x5799d5){if(_0x5799d5){return _0x5799d5[_0x3067('0x21')]()['then'](function(){_0xe66336['status'](0xcc)[_0x3067('0x17')]();});}};}function handleEntityNotFound(_0x4cdc02,_0x2d1a10){return function(_0x5c6ae2){if(!_0x5c6ae2){_0x4cdc02[_0x3067('0x15')](0x194);}return _0x5c6ae2;};}function handleError(_0x3c644a,_0x48cbb8){_0x48cbb8=_0x48cbb8||0x1f4;return function(_0x447075){logger[_0x3067('0x22')](_0x447075[_0x3067('0x23')]);if(_0x447075['name']){delete _0x447075['name'];}_0x3c644a['status'](_0x48cbb8)['send'](_0x447075);};}exports[_0x3067('0x24')]=function(_0x49c482,_0x3f78b2){var _0x3f40d1={},_0x21f1f0={},_0x3023a5={'count':0x0,'rows':[]};var _0x1c1f25=db[_0x3067('0x25')][_0x3067('0x26')];_0x21f1f0['model']=_[_0x3067('0x27')](_0x1c1f25);var _0x1c5031={'dateStart':_0x49c482[_0x3067('0x28')][_0x3067('0x29')],'dateEnd':_0x49c482[_0x3067('0x28')][_0x3067('0x2a')]};delete _0x49c482[_0x3067('0x28')][_0x3067('0x29')];delete _0x49c482[_0x3067('0x28')][_0x3067('0x2a')];_0x21f1f0['query']=_[_0x3067('0x27')](_0x49c482[_0x3067('0x28')]);_0x21f1f0['filters']=_[_0x3067('0x2b')](_0x21f1f0['model'],_0x21f1f0[_0x3067('0x28')]);_0x3f40d1[_0x3067('0x2c')]=_[_0x3067('0x2b')](_0x21f1f0[_0x3067('0x2d')],qs[_0x3067('0x2e')](_0x49c482['query'][_0x3067('0x2e')]));_0x3f40d1[_0x3067('0x2c')]=_0x3f40d1[_0x3067('0x2c')][_0x3067('0x2f')]?_0x3f40d1[_0x3067('0x2c')]:_0x21f1f0[_0x3067('0x2d')];if(!_0x49c482[_0x3067('0x28')][_0x3067('0x30')](_0x3067('0x31'))){_0x3f40d1[_0x3067('0x1b')]=qs[_0x3067('0x1b')](_0x49c482[_0x3067('0x28')]['limit']);_0x3f40d1[_0x3067('0x1a')]=qs[_0x3067('0x1a')](_0x49c482[_0x3067('0x28')][_0x3067('0x1a')]);}_0x3f40d1[_0x3067('0x32')]=qs[_0x3067('0x33')](_0x49c482[_0x3067('0x28')][_0x3067('0x33')]);_0x3f40d1[_0x3067('0x34')]=qs[_0x3067('0x35')](_[_0x3067('0x36')](_0x49c482['query'],_0x21f1f0[_0x3067('0x35')]));if(_0x1c5031[_0x3067('0x29')]){if(_0x1c5031[_0x3067('0x2a')]){_0x1c5031[_0x3067('0x2a')]=moment(_0x1c5031[_0x3067('0x2a')])[_0x3067('0x37')](0x1,'day');}else{_0x1c5031[_0x3067('0x2a')]=moment(_0x1c5031[_0x3067('0x29')])[_0x3067('0x37')](0x1,_0x3067('0x38'));}_['merge'](_0x3f40d1[_0x3067('0x34')],{'createdAt':{'$gte':_0x1c5031[_0x3067('0x29')],'$lte':_0x1c5031[_0x3067('0x2a')]}});}if(_0x49c482['query'][_0x3067('0x39')]){_0x3f40d1[_0x3067('0x34')]=_[_0x3067('0x3a')](_0x3f40d1['where'],{'$or':_[_0x3067('0x3b')](_0x3f40d1[_0x3067('0x2c')],function(_0x281096){var _0x534007={};_0x534007[_0x281096]={'$like':'%'+_0x49c482['query'][_0x3067('0x39')]+'%'};return _0x534007;})});}_0x3f40d1=_['merge']({},_0x3f40d1,_0x49c482[_0x3067('0x3c')]);var _0x50ea57={'where':_0x3f40d1[_0x3067('0x34')]};return db[_0x3067('0x25')][_0x3067('0x19')](_0x50ea57)[_0x3067('0x3d')](function(_0x548a46){_0x3023a5[_0x3067('0x19')]=_0x548a46;if(_0x49c482[_0x3067('0x28')][_0x3067('0x3e')]){_0x3f40d1['include']=[{'all':!![]}];}return db[_0x3067('0x25')][_0x3067('0x3f')](_0x3f40d1);})[_0x3067('0x3d')](function(_0x99a5d7){_0x3023a5[_0x3067('0x40')]=_0x99a5d7;return _0x3023a5;})[_0x3067('0x3d')](respondWithFilteredResult(_0x3f78b2,_0x3f40d1))[_0x3067('0x41')](handleError(_0x3f78b2,null));};exports['show']=function(_0x3a195e,_0xe52977){var _0x285598={'raw':!![],'where':{'id':_0x3a195e['params']['id']}},_0x1f3ec8={};_0x1f3ec8[_0x3067('0x2d')]=_['keys'](db[_0x3067('0x25')]['rawAttributes']);_0x1f3ec8[_0x3067('0x28')]=_['keys'](_0x3a195e[_0x3067('0x28')]);_0x1f3ec8['filters']=_['intersection'](_0x1f3ec8[_0x3067('0x2d')],_0x1f3ec8['query']);_0x285598[_0x3067('0x2c')]=_[_0x3067('0x2b')](_0x1f3ec8[_0x3067('0x2d')],qs[_0x3067('0x2e')](_0x3a195e[_0x3067('0x28')]['fields']));_0x285598[_0x3067('0x2c')]=_0x285598[_0x3067('0x2c')][_0x3067('0x2f')]?_0x285598['attributes']:_0x1f3ec8[_0x3067('0x2d')];if(_0x3a195e[_0x3067('0x28')][_0x3067('0x3e')]){_0x285598[_0x3067('0x42')]=[{'all':!![]}];}_0x285598=_['merge']({},_0x285598,_0x3a195e[_0x3067('0x3c')]);return db[_0x3067('0x25')][_0x3067('0x43')](_0x285598)[_0x3067('0x3d')](handleEntityNotFound(_0xe52977,null))[_0x3067('0x3d')](respondWithResult(_0xe52977,null))['catch'](handleError(_0xe52977,null));};exports['create']=function(_0x29327f,_0x2fcf8b){return db[_0x3067('0x25')][_0x3067('0x44')](_0x29327f['body'],{})[_0x3067('0x3d')](respondWithResult(_0x2fcf8b,0xc9))[_0x3067('0x41')](handleError(_0x2fcf8b,null));};exports['update']=function(_0x3b46ed,_0x5f56be){if(_0x3b46ed[_0x3067('0x45')]['id']){delete _0x3b46ed[_0x3067('0x45')]['id'];}return db[_0x3067('0x25')][_0x3067('0x43')]({'where':{'id':_0x3b46ed[_0x3067('0x46')]['id']}})[_0x3067('0x3d')](handleEntityNotFound(_0x5f56be,null))[_0x3067('0x3d')](saveUpdates(_0x3b46ed[_0x3067('0x45')],null))['then'](respondWithResult(_0x5f56be,null))[_0x3067('0x41')](handleError(_0x5f56be,null));};exports[_0x3067('0x21')]=function(_0x31b8de,_0x45cc45){return db[_0x3067('0x25')][_0x3067('0x43')]({'where':{'id':_0x31b8de[_0x3067('0x46')]['id']}})[_0x3067('0x3d')](handleEntityNotFound(_0x45cc45,null))[_0x3067('0x3d')](removeEntity(_0x45cc45,null))[_0x3067('0x41')](handleError(_0x45cc45,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 82f2628..e11170c 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 _0x8036=['bluebird','request-promise','./faxApplication.attributes','exports','FaxApplication','fax_applications','util','../../config/logger','moment'];(function(_0x44031d,_0x387eeb){var _0x254a1e=function(_0x1c2198){while(--_0x1c2198){_0x44031d['push'](_0x44031d['shift']());}};_0x254a1e(++_0x387eeb);}(_0x8036,0x102));var _0x6803=function(_0x345e55,_0x2b768d){_0x345e55=_0x345e55-0x0;var _0x1722ba=_0x8036[_0x345e55];return _0x1722ba;};'use strict';var _=require('lodash');var util=require(_0x6803('0x0'));var logger=require(_0x6803('0x1'))('api');var moment=require(_0x6803('0x2'));var BPromise=require(_0x6803('0x3'));var rp=require(_0x6803('0x4'));var attributes=require(_0x6803('0x5'));module[_0x6803('0x6')]=function(_0x2dd56c,_0x16d201){return _0x2dd56c['define'](_0x6803('0x7'),attributes,{'tableName':_0x6803('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaea=['moment','bluebird','request-promise','./faxApplication.attributes','exports','define','FaxApplication','lodash','util','../../config/logger'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xeaea,0x11f));var _0xaeae=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xeaea[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0xaeae('0x0'));var util=require(_0xaeae('0x1'));var logger=require(_0xaeae('0x2'))('api');var moment=require(_0xaeae('0x3'));var BPromise=require(_0xaeae('0x4'));var rp=require(_0xaeae('0x5'));var attributes=require(_0xaeae('0x6'));module[_0xaeae('0x7')]=function(_0x29cc17,_0x5c2b2b){return _0x29cc17[_0xaeae('0x8')](_0xaeae('0x9'),attributes,{'tableName':'fax_applications','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 52b8e9a..d8bf551 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 _0x9957=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','result','UpdateFaxApplication','body','raw','options','where','attributes','limit','then','stringify','catch','lodash','util','moment'];(function(_0xd228b6,_0x105df1){var _0x334783=function(_0x321dcc){while(--_0x321dcc){_0xd228b6['push'](_0xd228b6['shift']());}};_0x334783(++_0x105df1);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x7995('0x4'))['db'];var utils=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var jayson=require(_0x7995('0x8'));var client=jayson[_0x7995('0x9')][_0x7995('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219534,_0xbda126,_0x326741){return new BPromise(function(_0x4996ca,_0x465276){return client[_0x7995('0xb')](_0x219534,_0x326741)['then'](function(_0xa2e5f0){logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));logger[_0x7995('0xf')](_0x7995('0x10'),_0xbda126,_0x7995('0xe'),JSON['stringify'](_0xa2e5f0));if(_0xa2e5f0[_0x7995('0x11')]){if(_0xa2e5f0[_0x7995('0x11')]['code']===0x1f4){logger[_0x7995('0x11')](_0x7995('0xd'),_0xbda126,_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);return _0x465276(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}logger[_0x7995('0x11')]('FaxApplication,\x20%s,\x20%s',_0xbda126,_0xa2e5f0['error'][_0x7995('0x12')]);return _0x4996ca(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}else{logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));_0x4996ca(_0xa2e5f0[_0x7995('0x13')][_0x7995('0x12')]);}})['catch'](function(_0x2eeacc){logger['error'](_0x7995('0xd'),_0xbda126,_0x2eeacc);_0x465276(_0x2eeacc);});});}exports[_0x7995('0x14')]=function(_0x43d4b8){var _0x291317=this;return new Promise(function(_0x1e1415,_0x37a7d4){return db['FaxApplication']['update'](_0x43d4b8[_0x7995('0x15')],{'raw':_0x43d4b8['options']?_0x43d4b8['options'][_0x7995('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43d4b8[_0x7995('0x17')]?_0x43d4b8['options'][_0x7995('0x18')]||null:null,'attributes':_0x43d4b8['options']?_0x43d4b8['options'][_0x7995('0x19')]||null:null,'limit':_0x43d4b8[_0x7995('0x17')]?_0x43d4b8[_0x7995('0x17')][_0x7995('0x1a')]||null:null})[_0x7995('0x1b')](function(_0x1c278a){logger['info'](_0x7995('0x14'),_0x43d4b8);logger[_0x7995('0xf')](_0x7995('0x14'),_0x43d4b8,JSON[_0x7995('0x1c')](_0x1c278a));_0x1e1415(_0x1c278a);})[_0x7995('0x1d')](function(_0x13bc35){logger[_0x7995('0x11')](_0x7995('0x14'),_0x13bc35['message'],_0x43d4b8);_0x37a7d4(_0x291317[_0x7995('0x11')](0x1f4,_0x13bc35[_0x7995('0x12')]));});});}; \ No newline at end of file +var _0xcee8=['message','result','catch','FaxApplication','update','body','options','raw','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','FaxApplication,\x20%s,\x20%s'];(function(_0x3faf65,_0x70b5c3){var _0x5d66f3=function(_0x33e42d){while(--_0x33e42d){_0x3faf65['push'](_0x3faf65['shift']());}};_0x5d66f3(++_0x70b5c3);}(_0xcee8,0xb1));var _0x8cee=function(_0x842601,_0x25e9f0){_0x842601=_0x842601-0x0;var _0x3f877a=_0xcee8[_0x842601];return _0x3f877a;};'use strict';var _=require(_0x8cee('0x0'));var util=require(_0x8cee('0x1'));var moment=require(_0x8cee('0x2'));var BPromise=require(_0x8cee('0x3'));var rs=require(_0x8cee('0x4'));var fs=require('fs');var db=require(_0x8cee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cee('0x6'))(_0x8cee('0x7'));var config=require(_0x8cee('0x8'));var jayson=require(_0x8cee('0x9'));var client=jayson['client'][_0x8cee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfea4e3,_0x4f57f1,_0x538c89){return new BPromise(function(_0x341c63,_0x49a070){return client[_0x8cee('0xb')](_0xfea4e3,_0x538c89)[_0x8cee('0xc')](function(_0x21a6c8){logger[_0x8cee('0xd')]('FaxApplication,\x20%s,\x20%s',_0x4f57f1,_0x8cee('0xe'));logger[_0x8cee('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4f57f1,_0x8cee('0xe'),JSON[_0x8cee('0x10')](_0x21a6c8));if(_0x21a6c8['error']){if(_0x21a6c8[_0x8cee('0x11')]['code']===0x1f4){logger[_0x8cee('0x11')](_0x8cee('0x12'),_0x4f57f1,_0x21a6c8[_0x8cee('0x11')][_0x8cee('0x13')]);return _0x49a070(_0x21a6c8['error']['message']);}logger[_0x8cee('0x11')](_0x8cee('0x12'),_0x4f57f1,_0x21a6c8[_0x8cee('0x11')][_0x8cee('0x13')]);return _0x341c63(_0x21a6c8[_0x8cee('0x11')][_0x8cee('0x13')]);}else{logger[_0x8cee('0xd')](_0x8cee('0x12'),_0x4f57f1,_0x8cee('0xe'));_0x341c63(_0x21a6c8[_0x8cee('0x14')][_0x8cee('0x13')]);}})[_0x8cee('0x15')](function(_0x41d5e2){logger[_0x8cee('0x11')](_0x8cee('0x12'),_0x4f57f1,_0x41d5e2);_0x49a070(_0x41d5e2);});});}exports['UpdateFaxApplication']=function(_0x3015bf){var _0x581ce9=this;return new Promise(function(_0x4a3556,_0x8e242b){return db[_0x8cee('0x16')][_0x8cee('0x17')](_0x3015bf[_0x8cee('0x18')],{'raw':_0x3015bf[_0x8cee('0x19')]?_0x3015bf['options'][_0x8cee('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3015bf[_0x8cee('0x19')]?_0x3015bf[_0x8cee('0x19')]['where']||null:null,'attributes':_0x3015bf[_0x8cee('0x19')]?_0x3015bf[_0x8cee('0x19')]['attributes']||null:null,'limit':_0x3015bf['options']?_0x3015bf[_0x8cee('0x19')]['limit']||null:null})['then'](function(_0x51a93f){logger['info'](_0x8cee('0x1b'),_0x3015bf);logger['debug'](_0x8cee('0x1b'),_0x3015bf,JSON['stringify'](_0x51a93f));_0x4a3556(_0x51a93f);})[_0x8cee('0x15')](function(_0x27e8fb){logger[_0x8cee('0x11')](_0x8cee('0x1b'),_0x27e8fb[_0x8cee('0x13')],_0x3015bf);_0x8e242b(_0x581ce9[_0x8cee('0x11')](0x1f4,_0x27e8fb[_0x8cee('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c7f13ba..5eddea2 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 _0x33af=['../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','/:id','show','post','create','update','delete','util','express','Router','../../components/auth/service'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x33af,0xec));var _0xf33a=function(_0x208c54,_0x120a70){_0x208c54=_0x208c54-0x0;var _0x4b0116=_0x33af[_0x208c54];return _0x4b0116;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var express=require(_0xf33a('0x1'));var router=express[_0xf33a('0x2')]();var auth=require(_0xf33a('0x3'));var interaction=require(_0xf33a('0x4'));var config=require(_0xf33a('0x5'));var controller=require(_0xf33a('0x6'));router['get']('/',auth[_0xf33a('0x7')](),controller[_0xf33a('0x8')]);router['get'](_0xf33a('0x9'),auth[_0xf33a('0x7')](),controller[_0xf33a('0xa')]);router[_0xf33a('0xb')]('/',auth[_0xf33a('0x7')](),controller[_0xf33a('0xc')]);router['put'](_0xf33a('0x9'),auth[_0xf33a('0x7')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')](_0xf33a('0x9'),auth[_0xf33a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xabce=['delete','destroy','exports','multer','util','path','express','Router','../../config/environment','./faxApplication.controller','get','isAuthenticated','post','create','/:id','update'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xabce,0x103));var _0xeabc=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xabce[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var express=require(_0xeabc('0x3'));var router=express[_0xeabc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeabc('0x5'));var controller=require(_0xeabc('0x6'));router[_0xeabc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeabc('0x7')]('/:id',auth[_0xeabc('0x8')](),controller['show']);router[_0xeabc('0x9')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router['put'](_0xeabc('0xb'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xc')]);router[_0xeabc('0xd')](_0xeabc('0xb'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xe')]);module[_0xeabc('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b14ff1d..0582d19 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 _0xd96b=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x31db80,_0x20ce1e){var _0x55fa57=function(_0x1e2827){while(--_0x1e2827){_0x31db80['push'](_0x31db80['shift']());}};_0x55fa57(++_0x20ce1e);}(_0xd96b,0x109));var _0xbd96=function(_0x27e88c,_0xc5f235){_0x27e88c=_0x27e88c-0x0;var _0x34c0c7=_0xd96b[_0x27e88c];return _0x34c0c7;};'use strict';var Sequelize=require(_0xbd96('0x0'));module[_0xbd96('0x1')]={'closed':{'type':Sequelize[_0xbd96('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbd96('0x3')]},'note':{'type':Sequelize[_0xbd96('0x3')]},'read1stAt':{'type':Sequelize[_0xbd96('0x4')]},'fax':{'type':Sequelize[_0xbd96('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbd96('0x5')]('in',_0xbd96('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbd96('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xbd96('0x5')]('in',_0xbd96('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd7d1=['out','sequelize','BOOLEAN','STRING','ENUM'];(function(_0x2d1c0a,_0x3fb983){var _0x2e7f31=function(_0x25b045){while(--_0x25b045){_0x2d1c0a['push'](_0x2d1c0a['shift']());}};_0x2e7f31(++_0x3fb983);}(_0xd7d1,0x132));var _0x1d7d=function(_0x19d509,_0x143696){_0x19d509=_0x19d509-0x0;var _0x5111f5=_0xd7d1[_0x19d509];return _0x5111f5;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1d7d('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1d7d('0x2')]},'note':{'type':Sequelize[_0x1d7d('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x1d7d('0x3')]('in',_0x1d7d('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1d7d('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9d4247a..ceae919 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 _0xcdec=['merge','filter','options','include','tag','push','Tag','Tags','read','FaxMessage','Messages','direction','createdAt','distinct','FaxInteraction','Users','fullname','CmContact','internal','FaxAccount','key','color','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','describe','addMessage','ids','omit','getMessages','hasOwnProperty','sort','FaxInteractionId','map','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','emit','faxInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','socket.io-emitter','localhost','./faxInteraction.socket','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','stack','name','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','fields','length','nolimit','limit','order','where','pick','add','day'];(function(_0x156c19,_0x1bf0c4){var _0x136238=function(_0x45347f){while(--_0x45347f){_0x156c19['push'](_0x156c19['shift']());}};_0x136238(++_0x1bf0c4);}(_0xcdec,0xfd));var _0xccde=function(_0x3eebd8,_0xc2bc8b){_0x3eebd8=_0x3eebd8-0x0;var _0x310092=_0xcdec[_0x3eebd8];return _0x310092;};'use strict';var jsonpatch=require(_0xccde('0x0'));var rp=require(_0xccde('0x1'));var moment=require(_0xccde('0x2'));var BPromise=require(_0xccde('0x3'));var Mustache=require(_0xccde('0x4'));var util=require('util');var path=require(_0xccde('0x5'));var sox=require(_0xccde('0x6'));var csv=require(_0xccde('0x7'));var ejs=require(_0xccde('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xccde('0x9'));var jsforce=require(_0xccde('0xa'));var deskjs=require(_0xccde('0xb'));var toCsv=require(_0xccde('0x7'));var querystring=require(_0xccde('0xc'));var Papa=require(_0xccde('0xd'));var qs=require(_0xccde('0xe'));var logger=require(_0xccde('0xf'))(_0xccde('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xccde('0x11'))['db'];var socket=require(_0xccde('0x12'))({'host':_0xccde('0x13'),'port':0x18eb});require(_0xccde('0x14'))['register'](socket);function respondWithStatusCode(_0x1c296a,_0x12f502){_0x12f502=_0x12f502||0xcc;return function(_0x5c4408){if(_0x5c4408){return _0x1c296a[_0xccde('0x15')](_0x12f502);}return _0x1c296a[_0xccde('0x16')](_0x12f502)[_0xccde('0x17')]();};}function respondWithResult(_0xa5f1f,_0x41d643){_0x41d643=_0x41d643||0xc8;return function(_0x45e6cb){if(_0x45e6cb){return _0xa5f1f['status'](_0x41d643)[_0xccde('0x18')](_0x45e6cb);}};}function respondWithFilteredResult(_0x41eaab,_0x194f7){return function(_0xbc49c0){if(_0xbc49c0){var _0x427745=_0xbc49c0[_0xccde('0x19')],_0x45aa70=_0x194f7[_0xccde('0x1a')],_0x493d6e=_0x194f7[_0xccde('0x1a')]+_0x194f7['limit'],_0x31b88b;if(_0x493d6e>=_0x427745){_0x493d6e=_0x427745;_0x31b88b=0xc8;}else{_0x31b88b=0xce;}_0x41eaab[_0xccde('0x16')](_0x31b88b);return _0x41eaab[_0xccde('0x1b')]('Content-Range',_0x45aa70+'-'+_0x493d6e+'/'+_0x427745)[_0xccde('0x18')](_0xbc49c0);}return null;};}function patchUpdates(_0x2de264){return function(_0xaeee2d){try{jsonpatch[_0xccde('0x1c')](_0xaeee2d,_0x2de264,!![]);}catch(_0x2e8e72){return BPromise['reject'](_0x2e8e72);}return _0xaeee2d[_0xccde('0x1d')]();};}function saveUpdates(_0x5f2e8b,_0x2da5e3){return function(_0x4455ee){if(_0x4455ee){return _0x4455ee[_0xccde('0x1e')](_0x5f2e8b)[_0xccde('0x1f')](function(_0x42a493){return _0x42a493;});}return null;};}function removeEntity(_0x29b80e,_0x590150){return function(_0x4badba){if(_0x4badba){return _0x4badba[_0xccde('0x20')]()[_0xccde('0x1f')](function(){_0x29b80e[_0xccde('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2180ac,_0x20c137){return function(_0x7d3fb7){if(!_0x7d3fb7){_0x2180ac[_0xccde('0x15')](0x194);}return _0x7d3fb7;};}function handleError(_0x5c8525,_0x1f6346){_0x1f6346=_0x1f6346||0x1f4;return function(_0x3b494b){logger['error'](_0x3b494b[_0xccde('0x21')]);if(_0x3b494b[_0xccde('0x22')]){delete _0x3b494b['name'];}_0x5c8525[_0xccde('0x16')](_0x1f6346)['send'](_0x3b494b);};}exports[_0xccde('0x23')]=function(_0x5a81fc,_0x1eb9f0){var _0x33a977={},_0x16b359={},_0x38bad4={'count':0x0,'rows':[]};var _0xf1c499=db['FaxInteraction'][_0xccde('0x24')];_0x16b359[_0xccde('0x25')]=_['keys'](_0xf1c499);var _0x5b2799={'dateStart':_0x5a81fc[_0xccde('0x26')][_0xccde('0x27')],'dateEnd':_0x5a81fc[_0xccde('0x26')][_0xccde('0x28')]};delete _0x5a81fc[_0xccde('0x26')][_0xccde('0x27')];delete _0x5a81fc['query'][_0xccde('0x28')];_0x16b359[_0xccde('0x26')]=_[_0xccde('0x29')](_0x5a81fc[_0xccde('0x26')]);_0x16b359[_0xccde('0x2a')]=_['intersection'](_0x16b359[_0xccde('0x25')],_0x16b359[_0xccde('0x26')]);_0x33a977[_0xccde('0x2b')]=_['intersection'](_0x16b359[_0xccde('0x25')],qs[_0xccde('0x2c')](_0x5a81fc[_0xccde('0x26')][_0xccde('0x2c')]));_0x33a977[_0xccde('0x2b')]=_0x33a977['attributes'][_0xccde('0x2d')]?_0x33a977[_0xccde('0x2b')]:_0x16b359[_0xccde('0x25')];if(!_0x5a81fc[_0xccde('0x26')]['hasOwnProperty'](_0xccde('0x2e'))){_0x33a977[_0xccde('0x2f')]=qs[_0xccde('0x2f')](_0x5a81fc[_0xccde('0x26')]['limit']);_0x33a977['offset']=qs['offset'](_0x5a81fc['query'][_0xccde('0x1a')]);}_0x33a977[_0xccde('0x30')]=qs['sort'](_0x5a81fc[_0xccde('0x26')]['sort']);_0x33a977[_0xccde('0x31')]=qs[_0xccde('0x2a')](_[_0xccde('0x32')](_0x5a81fc[_0xccde('0x26')],_0x16b359[_0xccde('0x2a')]));if(_0x5b2799['dateStart']){if(_0x5b2799[_0xccde('0x28')]){_0x5b2799['dateEnd']=moment(_0x5b2799[_0xccde('0x28')])[_0xccde('0x33')](0x1,'day');}else{_0x5b2799[_0xccde('0x28')]=moment(_0x5b2799[_0xccde('0x27')])[_0xccde('0x33')](0x1,_0xccde('0x34'));}_[_0xccde('0x35')](_0x33a977[_0xccde('0x31')],{'createdAt':{'$gte':_0x5b2799['dateStart'],'$lte':_0x5b2799[_0xccde('0x28')]}});}if(_0x5a81fc[_0xccde('0x26')]['filter']){_0x33a977[_0xccde('0x31')]=_['merge'](_0x33a977[_0xccde('0x31')],{'$or':_['map'](_0x33a977[_0xccde('0x2b')],function(_0x1a685d){var _0x5e4f5a={};_0x5e4f5a[_0x1a685d]={'$like':'%'+_0x5a81fc[_0xccde('0x26')][_0xccde('0x36')]+'%'};return _0x5e4f5a;})});}_0x33a977=_[_0xccde('0x35')]({},_0x33a977,_0x5a81fc[_0xccde('0x37')]);var _0x4a630a={'where':_0x33a977[_0xccde('0x31')]};_0x4a630a[_0xccde('0x38')]=[];if(_0x5a81fc[_0xccde('0x26')][_0xccde('0x39')]){_0x4a630a[_0xccde('0x38')][_0xccde('0x3a')]({'model':db[_0xccde('0x3b')],'as':_0xccde('0x3c'),'attributes':['id'],'where':{'id':_0x5a81fc['query'][_0xccde('0x39')]},'required':!![]});_0x4a630a['distinct']=!![];}if(_0x5a81fc[_0xccde('0x26')][_0xccde('0x3d')]){_0x4a630a['include']['push']({'model':db[_0xccde('0x3e')],'as':_0xccde('0x3f'),'attributes':['id',_0xccde('0x40'),_0xccde('0x41'),_0xccde('0x3d')],'where':{'direction':'in','read':_0x5a81fc[_0xccde('0x26')][_0xccde('0x3d')]||![]},'required':!![]});_0x4a630a[_0xccde('0x42')]=!![];}return db[_0xccde('0x43')]['count'](_0x4a630a)[_0xccde('0x1f')](function(_0x1f1586){_0x38bad4[_0xccde('0x19')]=_0x1f1586;if(_0x5a81fc[_0xccde('0x26')]['includeAll']){_0x33a977[_0xccde('0x38')]=[{'model':db['User'],'as':_0xccde('0x44'),'required':![],'attributes':['id',_0xccde('0x22'),_0xccde('0x45')]},{'model':db[_0xccde('0x46')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xccde('0x22'),'fullname',_0xccde('0x47')],'required':![]},{'model':db[_0xccde('0x48')],'as':'Account','attributes':[_0xccde('0x22'),_0xccde('0x49')],'required':![]},{'model':db[_0xccde('0x3e')],'as':_0xccde('0x3f'),'attributes':['id',_0xccde('0x40'),_0xccde('0x41'),_0xccde('0x3d')],'where':{'direction':'in','read':_0x5a81fc[_0xccde('0x26')][_0xccde('0x3d')]||![]},'required':_0x5a81fc['query'][_0xccde('0x3d')]||![]},{'model':db[_0xccde('0x3b')],'as':'Tags','attributes':['id',_0xccde('0x22'),_0xccde('0x4a')],'required':_0x5a81fc[_0xccde('0x26')]['tag']?!![]:![]},{'model':db[_0xccde('0x3b')],'as':'ThroughTags','attributes':['id','name',_0xccde('0x4a')],'through':_0x5a81fc[_0xccde('0x26')][_0xccde('0x39')]?{'attributes':[],'where':{'TagId':_0x5a81fc[_0xccde('0x26')]['tag']||undefined}}:{},'required':_0x5a81fc['query'][_0xccde('0x39')]?!![]:![]}];}return db[_0xccde('0x43')][_0xccde('0x4b')](_0x33a977);})[_0xccde('0x1f')](function(_0x7fe9da){_0x38bad4[_0xccde('0x4c')]=_0x7fe9da;return _0x38bad4;})['then'](respondWithFilteredResult(_0x1eb9f0,_0x33a977))[_0xccde('0x4d')](handleError(_0x1eb9f0,null));};exports[_0xccde('0x4e')]=function(_0x27bd27,_0x126448){var _0x41206d={'raw':![],'where':{'id':_0x27bd27[_0xccde('0x4f')]['id']}},_0x466a51={};_0x466a51[_0xccde('0x25')]=_[_0xccde('0x29')](db[_0xccde('0x43')][_0xccde('0x24')]);_0x466a51[_0xccde('0x26')]=_[_0xccde('0x29')](_0x27bd27[_0xccde('0x26')]);_0x466a51[_0xccde('0x2a')]=_[_0xccde('0x50')](_0x466a51[_0xccde('0x25')],_0x466a51[_0xccde('0x26')]);_0x41206d[_0xccde('0x2b')]=_['intersection'](_0x466a51[_0xccde('0x25')],qs[_0xccde('0x2c')](_0x27bd27[_0xccde('0x26')]['fields']));_0x41206d[_0xccde('0x2b')]=_0x41206d[_0xccde('0x2b')]['length']?_0x41206d[_0xccde('0x2b')]:_0x466a51['model'];if(_0x27bd27['query'][_0xccde('0x51')]){_0x41206d[_0xccde('0x38')]=[{'all':!![]}];}_0x41206d=_[_0xccde('0x35')]({},_0x41206d,_0x27bd27[_0xccde('0x37')]);return db[_0xccde('0x43')][_0xccde('0x52')](_0x41206d)[_0xccde('0x1f')](handleEntityNotFound(_0x126448,null))[_0xccde('0x1f')](respondWithResult(_0x126448,null))[_0xccde('0x4d')](handleError(_0x126448,null));};exports[_0xccde('0x53')]=function(_0x258f64,_0x177e3e){return db[_0xccde('0x43')][_0xccde('0x53')](_0x258f64['body'],{})[_0xccde('0x1f')](respondWithResult(_0x177e3e,0xc9))[_0xccde('0x4d')](handleError(_0x177e3e,null));};exports[_0xccde('0x1e')]=function(_0x2bc854,_0x4910a6){if(_0x2bc854[_0xccde('0x54')]['id']){delete _0x2bc854[_0xccde('0x54')]['id'];}return db['FaxInteraction'][_0xccde('0x52')]({'where':{'id':_0x2bc854[_0xccde('0x4f')]['id']}})[_0xccde('0x1f')](handleEntityNotFound(_0x4910a6,null))[_0xccde('0x1f')](saveUpdates(_0x2bc854['body'],null))['then'](respondWithResult(_0x4910a6,null))['catch'](handleError(_0x4910a6,null));};exports['destroy']=function(_0xd55347,_0x542945){return db['FaxInteraction'][_0xccde('0x52')]({'where':{'id':_0xd55347[_0xccde('0x4f')]['id']}})['then'](handleEntityNotFound(_0x542945,null))['then'](removeEntity(_0x542945,null))[_0xccde('0x4d')](handleError(_0x542945,null));};exports['describe']=function(_0x5f1c8e,_0x34344b){return db['FaxInteraction'][_0xccde('0x55')]()[_0xccde('0x1f')](respondWithResult(_0x34344b,null))['catch'](handleError(_0x34344b,null));};exports[_0xccde('0x56')]=function(_0x1b6b58,_0x39da65,_0x3f25c4){return db[_0xccde('0x3e')][_0xccde('0x52')]({'where':{'id':_0x1b6b58['params']['id']}})[_0xccde('0x1f')](handleEntityNotFound(_0x39da65,null))['then'](function(_0x5ec8e4){if(_0x5ec8e4){return _0x5ec8e4[_0xccde('0x56')](_0x1b6b58['body'][_0xccde('0x57')],_[_0xccde('0x58')](_0x1b6b58[_0xccde('0x54')],[_0xccde('0x57'),'id'])||{});}})[_0xccde('0x1f')](respondWithResult(_0x39da65,null))[_0xccde('0x4d')](handleError(_0x39da65,null));};exports[_0xccde('0x59')]=function(_0x19e4b9,_0x41710c,_0x55969f){var _0x277c10={'raw':![],'where':{}};var _0x19c090={};var _0x2fe01d={'count':0x0,'rows':[]};return db[_0xccde('0x43')]['findOne']({'where':{'id':_0x19e4b9['params']['id']}})['then'](handleEntityNotFound(_0x41710c,null))[_0xccde('0x1f')](function(_0x84c6ef){if(_0x84c6ef){_0x19c090[_0xccde('0x25')]=_[_0xccde('0x29')](db[_0xccde('0x3e')]['rawAttributes']);_0x19c090[_0xccde('0x26')]=_[_0xccde('0x29')](_0x19e4b9[_0xccde('0x26')]);_0x19c090[_0xccde('0x2a')]=_[_0xccde('0x50')](_0x19c090[_0xccde('0x25')],_0x19c090['query']);_0x277c10[_0xccde('0x2b')]=_[_0xccde('0x50')](_0x19c090[_0xccde('0x25')],qs[_0xccde('0x2c')](_0x19e4b9[_0xccde('0x26')][_0xccde('0x2c')]));_0x277c10[_0xccde('0x2b')]=_0x277c10[_0xccde('0x2b')]['length']?_0x277c10[_0xccde('0x2b')]:_0x19c090['model'];if(!_0x19e4b9['query'][_0xccde('0x5a')]('nolimit')){_0x277c10[_0xccde('0x2f')]=qs['limit'](_0x19e4b9[_0xccde('0x26')][_0xccde('0x2f')]);_0x277c10[_0xccde('0x1a')]=qs[_0xccde('0x1a')](_0x19e4b9[_0xccde('0x26')]['offset']);}_0x277c10['order']=qs[_0xccde('0x5b')](_0x19e4b9['query'][_0xccde('0x5b')]);_0x277c10[_0xccde('0x31')]=qs[_0xccde('0x2a')](_[_0xccde('0x32')](_0x19e4b9[_0xccde('0x26')],_0x19c090[_0xccde('0x2a')]));_0x277c10['where'][_0xccde('0x5c')]=_0x84c6ef['id'];if(_0x19e4b9[_0xccde('0x26')][_0xccde('0x36')]){_0x277c10[_0xccde('0x31')]=_[_0xccde('0x35')](_0x277c10['where'],{'$or':_[_0xccde('0x5d')](_0x277c10[_0xccde('0x2b')],function(_0x95540f){var _0x4476f7={};_0x4476f7[_0x95540f]={'$like':'%'+_0x19e4b9[_0xccde('0x26')]['filter']+'%'};return _0x4476f7;})});}if(_0x19e4b9[_0xccde('0x26')]['$gte']){var _0xfbd4ff=_0x19e4b9[_0xccde('0x26')]['$gte'][_0xccde('0x5e')](',');var _0x17d76a={};_0x17d76a[_0xfbd4ff[0x0]]={'$gte':moment(_0xfbd4ff[0x1])[_0xccde('0x5f')](_0xccde('0x60'))};_0x277c10[_0xccde('0x31')]=_[_0xccde('0x35')](_0x277c10[_0xccde('0x31')],_0x17d76a);}_0x277c10=_['merge']({},_0x277c10,_0x19e4b9['options']);return db[_0xccde('0x3e')][_0xccde('0x19')]({'where':_0x277c10['where']})['then'](function(_0x3af736){_0x2fe01d[_0xccde('0x19')]=_0x3af736;if(_0x19e4b9['query'][_0xccde('0x51')]){_0x277c10[_0xccde('0x38')]=[{'all':!![]}];}return db[_0xccde('0x3e')][_0xccde('0x4b')](_0x277c10);})[_0xccde('0x1f')](function(_0x52b221){_0x2fe01d[_0xccde('0x4c')]=_0x52b221;return _0x2fe01d;});}})[_0xccde('0x1f')](respondWithFilteredResult(_0x41710c,_0x277c10))[_0xccde('0x4d')](handleError(_0x41710c,null));};exports[_0xccde('0x61')]=function(_0x59785c,_0x16c874,_0x4bae3){return db['FaxInteraction']['find']({'where':{'id':_0x59785c['params']['id']}})['then'](handleEntityNotFound(_0x16c874,null))[_0xccde('0x1f')](function(_0x41a011){if(_0x41a011){return _0x41a011['setTags'](_0x59785c[_0xccde('0x54')]['ids'],_['omit'](_0x59785c['body'],[_0xccde('0x57'),'id'])||{})[_0xccde('0x62')](function(){return db[_0xccde('0x3b')][_0xccde('0x4b')]({'attributes':['id','name','color'],'where':{'id':_0x59785c[_0xccde('0x54')][_0xccde('0x57')]}});})[_0xccde('0x1f')](function(_0x470986){socket[_0xccde('0x63')](_0xccde('0x64'),{'id':Number(_0x59785c[_0xccde('0x4f')]['id']),'tags':_0x470986||[]});return{'id':Number(_0x59785c['params']['id']),'tags':_0x470986||[]};});}})[_0xccde('0x1f')](respondWithResult(_0x16c874,null))[_0xccde('0x4d')](handleError(_0x16c874,null));};exports[_0xccde('0x65')]=function(_0x2ac6ac,_0x13c2f1,_0x42de24){var _0x884a8e;return db[_0xccde('0x43')][_0xccde('0x52')]({'where':{'id':_0x2ac6ac['params']['id']}})[_0xccde('0x1f')](handleEntityNotFound(_0x13c2f1,null))[_0xccde('0x1f')](function(_0x1a185c){if(_0x1a185c){return _0x1a185c[_0xccde('0x65')](_0x2ac6ac[_0xccde('0x26')][_0xccde('0x57')]);}})[_0xccde('0x1f')](respondWithStatusCode(_0x13c2f1,null))['catch'](handleError(_0x13c2f1,null));}; \ No newline at end of file +var _0x41e2=['set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FaxInteraction','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','options','include','Tag','Tags','distinct','read','push','FaxMessage','Messages','direction','createdAt','includeAll','Users','fullname','CmContact','User','FaxAccount','Account','tag','ThroughTags','color','findAll','rows','catch','show','length','find','create','body','params','describe','addMessage','omit','ids','getMessages','findOne','pick','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','addTags','spread','emit','removeTags','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','../../config/utils','../../mysqldb','socket.io-emitter','localhost','register','status','end','json','offset','limit'];(function(_0x4792cc,_0x38717b){var _0xeb2b04=function(_0x4316c4){while(--_0x4316c4){_0x4792cc['push'](_0x4792cc['shift']());}};_0xeb2b04(++_0x38717b);}(_0x41e2,0x18f));var _0x241e=function(_0x510d50,_0x284a40){_0x510d50=_0x510d50-0x0;var _0x5eead6=_0x41e2[_0x510d50];return _0x5eead6;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x241e('0x0'));var Mustache=require(_0x241e('0x1'));var util=require(_0x241e('0x2'));var path=require(_0x241e('0x3'));var sox=require(_0x241e('0x4'));var csv=require('to-csv');var ejs=require(_0x241e('0x5'));var fs=require('fs');var _=require(_0x241e('0x6'));var squel=require(_0x241e('0x7'));var crypto=require(_0x241e('0x8'));var jsforce=require(_0x241e('0x9'));var deskjs=require(_0x241e('0xa'));var toCsv=require(_0x241e('0xb'));var querystring=require(_0x241e('0xc'));var Papa=require(_0x241e('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x241e('0xe'))('api');var utils=require(_0x241e('0xf'));var config=require('../../config/environment');var db=require(_0x241e('0x10'))['db'];var socket=require(_0x241e('0x11'))({'host':_0x241e('0x12'),'port':0x18eb});require('./faxInteraction.socket')[_0x241e('0x13')](socket);function respondWithStatusCode(_0x4c5e09,_0x5e53c8){_0x5e53c8=_0x5e53c8||0xcc;return function(_0x4b429d){if(_0x4b429d){return _0x4c5e09['sendStatus'](_0x5e53c8);}return _0x4c5e09[_0x241e('0x14')](_0x5e53c8)[_0x241e('0x15')]();};}function respondWithResult(_0x1d9b85,_0x1c5fc7){_0x1c5fc7=_0x1c5fc7||0xc8;return function(_0x43438c){if(_0x43438c){return _0x1d9b85[_0x241e('0x14')](_0x1c5fc7)[_0x241e('0x16')](_0x43438c);}};}function respondWithFilteredResult(_0x4ac6c8,_0x335176){return function(_0x38d373){if(_0x38d373){var _0x137a8f=_0x38d373['count'],_0x150172=_0x335176[_0x241e('0x17')],_0x3620bb=_0x335176[_0x241e('0x17')]+_0x335176[_0x241e('0x18')],_0xaf6e36;if(_0x3620bb>=_0x137a8f){_0x3620bb=_0x137a8f;_0xaf6e36=0xc8;}else{_0xaf6e36=0xce;}_0x4ac6c8[_0x241e('0x14')](_0xaf6e36);return _0x4ac6c8[_0x241e('0x19')](_0x241e('0x1a'),_0x150172+'-'+_0x3620bb+'/'+_0x137a8f)[_0x241e('0x16')](_0x38d373);}return null;};}function patchUpdates(_0x49ad67){return function(_0xf6910a){try{jsonpatch['apply'](_0xf6910a,_0x49ad67,!![]);}catch(_0x17db22){return BPromise[_0x241e('0x1b')](_0x17db22);}return _0xf6910a[_0x241e('0x1c')]();};}function saveUpdates(_0x3c267b,_0x292396){return function(_0x4a5ca5){if(_0x4a5ca5){return _0x4a5ca5[_0x241e('0x1d')](_0x3c267b)[_0x241e('0x1e')](function(_0x273248){return _0x273248;});}return null;};}function removeEntity(_0x2b582f,_0x368726){return function(_0x14153f){if(_0x14153f){return _0x14153f[_0x241e('0x1f')]()[_0x241e('0x1e')](function(){_0x2b582f[_0x241e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ebc9f,_0x5704e9){return function(_0x34322c){if(!_0x34322c){_0x4ebc9f[_0x241e('0x20')](0x194);}return _0x34322c;};}function handleError(_0x4f76a3,_0x55a4bf){_0x55a4bf=_0x55a4bf||0x1f4;return function(_0x15e468){logger[_0x241e('0x21')](_0x15e468[_0x241e('0x22')]);if(_0x15e468[_0x241e('0x23')]){delete _0x15e468['name'];}_0x4f76a3[_0x241e('0x14')](_0x55a4bf)[_0x241e('0x24')](_0x15e468);};}exports[_0x241e('0x25')]=function(_0xb13752,_0xc437cb){var _0x5c8962={},_0x4728d0={},_0x585fa9={'count':0x0,'rows':[]};var _0x4d1ecc=db[_0x241e('0x26')][_0x241e('0x27')];_0x4728d0[_0x241e('0x28')]=_[_0x241e('0x29')](_0x4d1ecc);var _0x35992c={'dateStart':_0xb13752['query'][_0x241e('0x2a')],'dateEnd':_0xb13752['query']['dateEnd']};delete _0xb13752['query'][_0x241e('0x2a')];delete _0xb13752[_0x241e('0x2b')][_0x241e('0x2c')];_0x4728d0['query']=_[_0x241e('0x29')](_0xb13752['query']);_0x4728d0[_0x241e('0x2d')]=_[_0x241e('0x2e')](_0x4728d0[_0x241e('0x28')],_0x4728d0[_0x241e('0x2b')]);_0x5c8962['attributes']=_[_0x241e('0x2e')](_0x4728d0[_0x241e('0x28')],qs[_0x241e('0x2f')](_0xb13752['query']['fields']));_0x5c8962[_0x241e('0x30')]=_0x5c8962[_0x241e('0x30')]['length']?_0x5c8962[_0x241e('0x30')]:_0x4728d0[_0x241e('0x28')];if(!_0xb13752[_0x241e('0x2b')][_0x241e('0x31')](_0x241e('0x32'))){_0x5c8962['limit']=qs[_0x241e('0x18')](_0xb13752[_0x241e('0x2b')]['limit']);_0x5c8962[_0x241e('0x17')]=qs['offset'](_0xb13752['query'][_0x241e('0x17')]);}_0x5c8962[_0x241e('0x33')]=qs[_0x241e('0x34')](_0xb13752['query'][_0x241e('0x34')]);_0x5c8962['where']=qs[_0x241e('0x2d')](_['pick'](_0xb13752[_0x241e('0x2b')],_0x4728d0[_0x241e('0x2d')]));if(_0x35992c[_0x241e('0x2a')]){if(_0x35992c[_0x241e('0x2c')]){_0x35992c[_0x241e('0x2c')]=moment(_0x35992c[_0x241e('0x2c')])['add'](0x1,'day');}else{_0x35992c[_0x241e('0x2c')]=moment(_0x35992c[_0x241e('0x2a')])[_0x241e('0x35')](0x1,_0x241e('0x36'));}_[_0x241e('0x37')](_0x5c8962[_0x241e('0x38')],{'createdAt':{'$gte':_0x35992c[_0x241e('0x2a')],'$lte':_0x35992c[_0x241e('0x2c')]}});}if(_0xb13752[_0x241e('0x2b')][_0x241e('0x39')]){_0x5c8962['where']=_[_0x241e('0x37')](_0x5c8962[_0x241e('0x38')],{'$or':_[_0x241e('0x3a')](_0x5c8962['attributes'],function(_0x5a707a){var _0x3799e2={};_0x3799e2[_0x5a707a]={'$like':'%'+_0xb13752[_0x241e('0x2b')][_0x241e('0x39')]+'%'};return _0x3799e2;})});}_0x5c8962=_[_0x241e('0x37')]({},_0x5c8962,_0xb13752[_0x241e('0x3b')]);var _0x5f63fa={'where':_0x5c8962[_0x241e('0x38')]};_0x5f63fa['include']=[];if(_0xb13752['query']['tag']){_0x5f63fa[_0x241e('0x3c')]['push']({'model':db[_0x241e('0x3d')],'as':_0x241e('0x3e'),'attributes':['id'],'where':{'id':_0xb13752['query']['tag']},'required':!![]});_0x5f63fa[_0x241e('0x3f')]=!![];}if(_0xb13752[_0x241e('0x2b')][_0x241e('0x40')]){_0x5f63fa[_0x241e('0x3c')][_0x241e('0x41')]({'model':db[_0x241e('0x42')],'as':_0x241e('0x43'),'attributes':['id',_0x241e('0x44'),_0x241e('0x45'),_0x241e('0x40')],'where':{'direction':'in','read':_0xb13752[_0x241e('0x2b')][_0x241e('0x40')]||![]},'required':!![]});_0x5f63fa['distinct']=!![];}return db[_0x241e('0x26')]['count'](_0x5f63fa)[_0x241e('0x1e')](function(_0x52fe69){_0x585fa9['count']=_0x52fe69;if(_0xb13752[_0x241e('0x2b')][_0x241e('0x46')]){_0x5c8962['include']=[{'model':db['User'],'as':_0x241e('0x47'),'required':![],'attributes':['id','name',_0x241e('0x48')]},{'model':db[_0x241e('0x49')],'as':'Contact','required':![]},{'model':db[_0x241e('0x4a')],'as':'Owner','attributes':[_0x241e('0x23'),'fullname','internal'],'required':![]},{'model':db[_0x241e('0x4b')],'as':_0x241e('0x4c'),'attributes':[_0x241e('0x23'),'key'],'required':![]},{'model':db[_0x241e('0x42')],'as':_0x241e('0x43'),'attributes':['id',_0x241e('0x44'),_0x241e('0x45'),_0x241e('0x40')],'where':{'direction':'in','read':_0xb13752[_0x241e('0x2b')][_0x241e('0x40')]||![]},'required':_0xb13752['query'][_0x241e('0x40')]||![]},{'model':db['Tag'],'as':_0x241e('0x3e'),'attributes':['id',_0x241e('0x23'),'color'],'required':_0xb13752[_0x241e('0x2b')][_0x241e('0x4d')]?!![]:![]},{'model':db[_0x241e('0x3d')],'as':_0x241e('0x4e'),'attributes':['id','name',_0x241e('0x4f')],'through':_0xb13752[_0x241e('0x2b')][_0x241e('0x4d')]?{'attributes':[],'where':{'TagId':_0xb13752[_0x241e('0x2b')]['tag']||undefined}}:{},'required':_0xb13752[_0x241e('0x2b')][_0x241e('0x4d')]?!![]:![]}];}return db[_0x241e('0x26')][_0x241e('0x50')](_0x5c8962);})[_0x241e('0x1e')](function(_0x37ba72){_0x585fa9[_0x241e('0x51')]=_0x37ba72;return _0x585fa9;})[_0x241e('0x1e')](respondWithFilteredResult(_0xc437cb,_0x5c8962))[_0x241e('0x52')](handleError(_0xc437cb,null));};exports[_0x241e('0x53')]=function(_0x47e89a,_0x193f5c){var _0x33803e={'raw':![],'where':{'id':_0x47e89a['params']['id']}},_0x4c065b={};_0x4c065b[_0x241e('0x28')]=_['keys'](db[_0x241e('0x26')][_0x241e('0x27')]);_0x4c065b['query']=_['keys'](_0x47e89a[_0x241e('0x2b')]);_0x4c065b[_0x241e('0x2d')]=_[_0x241e('0x2e')](_0x4c065b[_0x241e('0x28')],_0x4c065b[_0x241e('0x2b')]);_0x33803e['attributes']=_['intersection'](_0x4c065b['model'],qs[_0x241e('0x2f')](_0x47e89a[_0x241e('0x2b')][_0x241e('0x2f')]));_0x33803e['attributes']=_0x33803e[_0x241e('0x30')][_0x241e('0x54')]?_0x33803e[_0x241e('0x30')]:_0x4c065b['model'];if(_0x47e89a['query'][_0x241e('0x46')]){_0x33803e[_0x241e('0x3c')]=[{'all':!![]}];}_0x33803e=_[_0x241e('0x37')]({},_0x33803e,_0x47e89a['options']);return db['FaxInteraction'][_0x241e('0x55')](_0x33803e)['then'](handleEntityNotFound(_0x193f5c,null))['then'](respondWithResult(_0x193f5c,null))[_0x241e('0x52')](handleError(_0x193f5c,null));};exports[_0x241e('0x56')]=function(_0x25c0ea,_0x10265d){return db['FaxInteraction'][_0x241e('0x56')](_0x25c0ea['body'],{})[_0x241e('0x1e')](respondWithResult(_0x10265d,0xc9))[_0x241e('0x52')](handleError(_0x10265d,null));};exports[_0x241e('0x1d')]=function(_0x2a182f,_0x12b745){if(_0x2a182f[_0x241e('0x57')]['id']){delete _0x2a182f[_0x241e('0x57')]['id'];}return db[_0x241e('0x26')][_0x241e('0x55')]({'where':{'id':_0x2a182f['params']['id']}})['then'](handleEntityNotFound(_0x12b745,null))['then'](saveUpdates(_0x2a182f['body'],null))[_0x241e('0x1e')](respondWithResult(_0x12b745,null))[_0x241e('0x52')](handleError(_0x12b745,null));};exports[_0x241e('0x1f')]=function(_0x13c426,_0x4eb697){return db[_0x241e('0x26')][_0x241e('0x55')]({'where':{'id':_0x13c426[_0x241e('0x58')]['id']}})[_0x241e('0x1e')](handleEntityNotFound(_0x4eb697,null))[_0x241e('0x1e')](removeEntity(_0x4eb697,null))[_0x241e('0x52')](handleError(_0x4eb697,null));};exports[_0x241e('0x59')]=function(_0x464396,_0x397eab){return db[_0x241e('0x26')][_0x241e('0x59')]()['then'](respondWithResult(_0x397eab,null))['catch'](handleError(_0x397eab,null));};exports[_0x241e('0x5a')]=function(_0x30a0cf,_0x28f599,_0x39bc21){return db[_0x241e('0x42')][_0x241e('0x55')]({'where':{'id':_0x30a0cf[_0x241e('0x58')]['id']}})[_0x241e('0x1e')](handleEntityNotFound(_0x28f599,null))[_0x241e('0x1e')](function(_0x3bad36){if(_0x3bad36){return _0x3bad36[_0x241e('0x5a')](_0x30a0cf['body']['ids'],_[_0x241e('0x5b')](_0x30a0cf['body'],[_0x241e('0x5c'),'id'])||{});}})[_0x241e('0x1e')](respondWithResult(_0x28f599,null))[_0x241e('0x52')](handleError(_0x28f599,null));};exports[_0x241e('0x5d')]=function(_0x19b8c1,_0x451733,_0x5d8b5b){var _0x57f911={'raw':![],'where':{}};var _0x597727={};var _0x550b14={'count':0x0,'rows':[]};return db[_0x241e('0x26')][_0x241e('0x5e')]({'where':{'id':_0x19b8c1[_0x241e('0x58')]['id']}})[_0x241e('0x1e')](handleEntityNotFound(_0x451733,null))[_0x241e('0x1e')](function(_0x406473){if(_0x406473){_0x597727[_0x241e('0x28')]=_[_0x241e('0x29')](db['FaxMessage'][_0x241e('0x27')]);_0x597727['query']=_[_0x241e('0x29')](_0x19b8c1[_0x241e('0x2b')]);_0x597727[_0x241e('0x2d')]=_[_0x241e('0x2e')](_0x597727[_0x241e('0x28')],_0x597727[_0x241e('0x2b')]);_0x57f911[_0x241e('0x30')]=_[_0x241e('0x2e')](_0x597727[_0x241e('0x28')],qs[_0x241e('0x2f')](_0x19b8c1[_0x241e('0x2b')][_0x241e('0x2f')]));_0x57f911[_0x241e('0x30')]=_0x57f911[_0x241e('0x30')][_0x241e('0x54')]?_0x57f911[_0x241e('0x30')]:_0x597727[_0x241e('0x28')];if(!_0x19b8c1[_0x241e('0x2b')]['hasOwnProperty'](_0x241e('0x32'))){_0x57f911[_0x241e('0x18')]=qs['limit'](_0x19b8c1[_0x241e('0x2b')]['limit']);_0x57f911[_0x241e('0x17')]=qs['offset'](_0x19b8c1['query'][_0x241e('0x17')]);}_0x57f911[_0x241e('0x33')]=qs[_0x241e('0x34')](_0x19b8c1[_0x241e('0x2b')]['sort']);_0x57f911[_0x241e('0x38')]=qs[_0x241e('0x2d')](_[_0x241e('0x5f')](_0x19b8c1['query'],_0x597727[_0x241e('0x2d')]));_0x57f911['where'][_0x241e('0x60')]=_0x406473['id'];if(_0x19b8c1['query'][_0x241e('0x39')]){_0x57f911[_0x241e('0x38')]=_[_0x241e('0x37')](_0x57f911['where'],{'$or':_[_0x241e('0x3a')](_0x57f911[_0x241e('0x30')],function(_0x25e0e2){var _0x52c30e={};_0x52c30e[_0x25e0e2]={'$like':'%'+_0x19b8c1[_0x241e('0x2b')][_0x241e('0x39')]+'%'};return _0x52c30e;})});}if(_0x19b8c1['query'][_0x241e('0x61')]){var _0x317ea6=_0x19b8c1[_0x241e('0x2b')]['$gte'][_0x241e('0x62')](',');var _0x4ce2fa={};_0x4ce2fa[_0x317ea6[0x0]]={'$gte':moment(_0x317ea6[0x1])[_0x241e('0x63')](_0x241e('0x64'))};_0x57f911[_0x241e('0x38')]=_[_0x241e('0x37')](_0x57f911[_0x241e('0x38')],_0x4ce2fa);}_0x57f911=_['merge']({},_0x57f911,_0x19b8c1[_0x241e('0x3b')]);return db[_0x241e('0x42')][_0x241e('0x65')]({'where':_0x57f911[_0x241e('0x38')]})[_0x241e('0x1e')](function(_0x55c27e){_0x550b14[_0x241e('0x65')]=_0x55c27e;if(_0x19b8c1[_0x241e('0x2b')][_0x241e('0x46')]){_0x57f911[_0x241e('0x3c')]=[{'all':!![]}];}return db[_0x241e('0x42')]['findAll'](_0x57f911);})[_0x241e('0x1e')](function(_0x108617){_0x550b14[_0x241e('0x51')]=_0x108617;return _0x550b14;});}})['then'](respondWithFilteredResult(_0x451733,_0x57f911))[_0x241e('0x52')](handleError(_0x451733,null));};exports[_0x241e('0x66')]=function(_0x461e0a,_0x4aaf9f,_0x46363a){return db['FaxInteraction']['find']({'where':{'id':_0x461e0a[_0x241e('0x58')]['id']}})[_0x241e('0x1e')](handleEntityNotFound(_0x4aaf9f,null))[_0x241e('0x1e')](function(_0xaea878){if(_0xaea878){return _0xaea878['setTags'](_0x461e0a[_0x241e('0x57')][_0x241e('0x5c')],_['omit'](_0x461e0a['body'],['ids','id'])||{})[_0x241e('0x67')](function(){return db['Tag'][_0x241e('0x50')]({'attributes':['id',_0x241e('0x23'),_0x241e('0x4f')],'where':{'id':_0x461e0a[_0x241e('0x57')][_0x241e('0x5c')]}});})[_0x241e('0x1e')](function(_0x31dd59){socket[_0x241e('0x68')]('faxInteractionTags:save',{'id':Number(_0x461e0a['params']['id']),'tags':_0x31dd59||[]});return{'id':Number(_0x461e0a[_0x241e('0x58')]['id']),'tags':_0x31dd59||[]};});}})[_0x241e('0x1e')](respondWithResult(_0x4aaf9f,null))[_0x241e('0x52')](handleError(_0x4aaf9f,null));};exports['removeTags']=function(_0x38b3c6,_0x233a26,_0x2008f9){var _0x2c5c0a;return db['FaxInteraction']['find']({'where':{'id':_0x38b3c6[_0x241e('0x58')]['id']}})[_0x241e('0x1e')](handleEntityNotFound(_0x233a26,null))[_0x241e('0x1e')](function(_0x1eab48){if(_0x1eab48){return _0x1eab48[_0x241e('0x69')](_0x38b3c6['query'][_0x241e('0x5c')]);}})[_0x241e('0x1e')](respondWithStatusCode(_0x233a26,null))[_0x241e('0x52')](handleError(_0x233a26,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3dc398d..4e5a1a9 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 _0x63a5=['FaxInteraction','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x50f5eb,_0x529aed){var _0x4db4c7=function(_0x15cd08){while(--_0x15cd08){_0x50f5eb['push'](_0x50f5eb['shift']());}};_0x4db4c7(++_0x529aed);}(_0x63a5,0x18e));var _0x563a=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x63a5[_0x17406a];return _0x1501ff;};'use strict';var EventEmitter=require(_0x563a('0x0'));var FaxInteraction=require(_0x563a('0x1'))['db'][_0x563a('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x563a('0x3'),'afterUpdate':'update','afterDestroy':_0x563a('0x4')};function emitEvent(_0x13195e){return function(_0x386400,_0x37e617,_0x5c2a8d){FaxInteractionEvents['emit'](_0x13195e+':'+_0x386400['id'],_0x386400);FaxInteractionEvents[_0x563a('0x5')](_0x13195e,_0x386400);_0x5c2a8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x563a('0x6')](e,emitEvent(event));}}module[_0x563a('0x7')]=FaxInteractionEvents; \ No newline at end of file +var _0x6582=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','remove'];(function(_0xf651fb,_0x3d2287){var _0x3ea3fb=function(_0x53ab67){while(--_0x53ab67){_0xf651fb['push'](_0xf651fb['shift']());}};_0x3ea3fb(++_0x3d2287);}(_0x6582,0x108));var _0x2658=function(_0x2b3100,_0x345565){_0x2b3100=_0x2b3100-0x0;var _0x59bb19=_0x6582[_0x2b3100];return _0x59bb19;};'use strict';var EventEmitter=require(_0x2658('0x0'));var FaxInteraction=require(_0x2658('0x1'))['db'][_0x2658('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2658('0x3')](0x0);var events={'afterCreate':_0x2658('0x4'),'afterUpdate':'update','afterDestroy':_0x2658('0x5')};function emitEvent(_0x304ec5){return function(_0xd13472,_0x5b50cb,_0x4bf3c5){FaxInteractionEvents['emit'](_0x304ec5+':'+_0xd13472['id'],_0xd13472);FaxInteractionEvents[_0x2658('0x6')](_0x304ec5,_0xd13472);_0x4bf3c5(null);};}for(var e in events){if(events[_0x2658('0x7')](e)){var event=events[e];FaxInteraction[_0x2658('0x8')](e,emitEvent(event));}}module[_0x2658('0x9')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6deabfc..17f3390 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 _0xd889=['./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','lodash','util','../../config/logger','api'];(function(_0x41be83,_0x3c5bee){var _0xa03fbe=function(_0x1eba1e){while(--_0x1eba1e){_0x41be83['push'](_0x41be83['shift']());}};_0xa03fbe(++_0x3c5bee);}(_0xd889,0x191));var _0x9d88=function(_0x26a783,_0x485b22){_0x26a783=_0x26a783-0x0;var _0x4f08ec=_0xd889[_0x26a783];return _0x4f08ec;};'use strict';var _=require(_0x9d88('0x0'));var util=require(_0x9d88('0x1'));var logger=require(_0x9d88('0x2'))(_0x9d88('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x9d88('0x4'));module[_0x9d88('0x5')]=function(_0x12d9e8,_0x234714){return _0x12d9e8[_0x9d88('0x6')](_0x9d88('0x7'),attributes,{'tableName':_0x9d88('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac8e=['moment','bluebird','request-promise','exports','FaxInteraction','lodash','api'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xac8e,0x17f));var _0xeac8=function(_0x19e51f,_0x2cc647){_0x19e51f=_0x19e51f-0x0;var _0x27b8ab=_0xac8e[_0x19e51f];return _0x27b8ab;};'use strict';var _=require(_0xeac8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeac8('0x1'));var moment=require(_0xeac8('0x2'));var BPromise=require(_0xeac8('0x3'));var rp=require(_0xeac8('0x4'));var attributes=require('./faxInteraction.attributes');module[_0xeac8('0x5')]=function(_0x5b072d,_0x6a3e01){return _0x5b072d['define'](_0xeac8('0x6'),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 c50904e..cbc0f58 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 _0x61ac=['request','then','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxInteraction,\x20%s,\x20%s','info','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','limit','debug','AddTagsToFaxInteraction','ids','omit','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./faxInteraction.socket','register'];(function(_0x1986b8,_0x5ee78b){var _0x2dfe44=function(_0x29032b){while(--_0x29032b){_0x1986b8['push'](_0x1986b8['shift']());}};_0x2dfe44(++_0x5ee78b);}(_0x61ac,0x112));var _0xc61a=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x61ac[_0x21aec3];return _0x288bbc;};'use strict';var _=require('lodash');var util=require(_0xc61a('0x0'));var moment=require(_0xc61a('0x1'));var BPromise=require(_0xc61a('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xc61a('0x3'))['db'];var utils=require(_0xc61a('0x4'));var logger=require(_0xc61a('0x5'))(_0xc61a('0x6'));var config=require(_0xc61a('0x7'));var jayson=require(_0xc61a('0x8'));var client=jayson[_0xc61a('0x9')]['http']({'port':0x232a});var socket=require(_0xc61a('0xa'))({'host':_0xc61a('0xb'),'port':0x18eb});require(_0xc61a('0xc'))[_0xc61a('0xd')](socket);function respondWithRpcPromise(_0x2a897f,_0x5528c0,_0x4c2420){return new BPromise(function(_0x452987,_0xa8a8f){return client[_0xc61a('0xe')](_0x2a897f,_0x4c2420)[_0xc61a('0xf')](function(_0x226f6d){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5528c0,_0xc61a('0x10'));logger['debug'](_0xc61a('0x11'),_0x5528c0,_0xc61a('0x10'),JSON[_0xc61a('0x12')](_0x226f6d));if(_0x226f6d[_0xc61a('0x13')]){if(_0x226f6d[_0xc61a('0x13')]['code']===0x1f4){logger[_0xc61a('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5528c0,_0x226f6d[_0xc61a('0x13')]['message']);return _0xa8a8f(_0x226f6d['error'][_0xc61a('0x14')]);}logger[_0xc61a('0x13')](_0xc61a('0x15'),_0x5528c0,_0x226f6d[_0xc61a('0x13')][_0xc61a('0x14')]);return _0x452987(_0x226f6d[_0xc61a('0x13')][_0xc61a('0x14')]);}else{logger[_0xc61a('0x16')](_0xc61a('0x15'),_0x5528c0,_0xc61a('0x10'));_0x452987(_0x226f6d['result']['message']);}})[_0xc61a('0x17')](function(_0x1f6210){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x5528c0,_0x1f6210);_0xa8a8f(_0x1f6210);});});}exports[_0xc61a('0x18')]=function(_0x371627){var _0x17e9da=this;return new Promise(function(_0xc31ab9,_0x4e5e9e){return db[_0xc61a('0x19')]['update'](_0x371627[_0xc61a('0x1a')],{'raw':_0x371627['options']?_0x371627[_0xc61a('0x1b')][_0xc61a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x371627['options']?_0x371627[_0xc61a('0x1b')][_0xc61a('0x1d')]||null:null,'attributes':_0x371627[_0xc61a('0x1b')]?_0x371627[_0xc61a('0x1b')]['attributes']||null:null,'limit':_0x371627[_0xc61a('0x1b')]?_0x371627['options'][_0xc61a('0x1e')]||null:null})[_0xc61a('0xf')](function(_0x43c3fc){logger[_0xc61a('0x16')]('UpdateFaxInteraction',_0x371627);logger[_0xc61a('0x1f')](_0xc61a('0x18'),_0x371627,JSON['stringify'](_0x43c3fc));_0xc31ab9(_0x43c3fc);})[_0xc61a('0x17')](function(_0x58ba2e){logger[_0xc61a('0x13')](_0xc61a('0x18'),_0x58ba2e[_0xc61a('0x14')],_0x371627);_0x4e5e9e(_0x17e9da[_0xc61a('0x13')](0x1f4,_0x58ba2e[_0xc61a('0x14')]));});});};exports[_0xc61a('0x20')]=function(_0x562cb9){return new Promise(function(_0x3127b8,_0x7a7b9a){return db[_0xc61a('0x19')]['find']({'where':_0x562cb9[_0xc61a('0x1b')]?_0x562cb9[_0xc61a('0x1b')][_0xc61a('0x1d')]||null:null})[_0xc61a('0xf')](function(_0x307835){if(_0x307835){return _0x307835['addTags'](_0x562cb9[_0xc61a('0x1a')][_0xc61a('0x21')],_[_0xc61a('0x22')](_0x562cb9['body'],[_0xc61a('0x21'),'id'])||{});}})['spread'](function(_0x192607){logger['info'](_0xc61a('0x23'),_0x562cb9);logger['debug'](_0xc61a('0x23'),_0x562cb9,JSON[_0xc61a('0x12')](_0x192607));_0x3127b8(_0x192607);})[_0xc61a('0x17')](function(_0x415f3b){logger[_0xc61a('0x13')](_0xc61a('0x23'),_0x415f3b['message'],_0x562cb9);_0x7a7b9a(_this[_0xc61a('0x13')](0x1f4,_0x415f3b[_0xc61a('0x14')]));});});}; \ No newline at end of file +var _0x87cb=['then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','where','attributes','limit','debug','stringify','AddTagsToFaxInteraction','find','addTags','omit','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','socket.io-emitter','localhost','./faxInteraction.socket','register'];(function(_0x27e1aa,_0x3c1e61){var _0x3f0e45=function(_0x19ca3c){while(--_0x19ca3c){_0x27e1aa['push'](_0x27e1aa['shift']());}};_0x3f0e45(++_0x3c1e61);}(_0x87cb,0x1ee));var _0xb87c=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x87cb[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xb87c('0x0'));var util=require('util');var moment=require(_0xb87c('0x1'));var BPromise=require(_0xb87c('0x2'));var rs=require(_0xb87c('0x3'));var fs=require('fs');var db=require(_0xb87c('0x4'))['db'];var utils=require(_0xb87c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb87c('0x6'));var client=jayson[_0xb87c('0x7')][_0xb87c('0x8')]({'port':0x232a});var socket=require(_0xb87c('0x9'))({'host':_0xb87c('0xa'),'port':0x18eb});require(_0xb87c('0xb'))[_0xb87c('0xc')](socket);function respondWithRpcPromise(_0x32cf50,_0x438ca1,_0x3809d9){return new BPromise(function(_0x57d57e,_0x20ce04){return client['request'](_0x32cf50,_0x3809d9)[_0xb87c('0xd')](function(_0x448328){logger[_0xb87c('0xe')](_0xb87c('0xf'),_0x438ca1,'request\x20sent');logger['debug'](_0xb87c('0x10'),_0x438ca1,_0xb87c('0x11'),JSON['stringify'](_0x448328));if(_0x448328[_0xb87c('0x12')]){if(_0x448328[_0xb87c('0x12')][_0xb87c('0x13')]===0x1f4){logger[_0xb87c('0x12')](_0xb87c('0xf'),_0x438ca1,_0x448328['error'][_0xb87c('0x14')]);return _0x20ce04(_0x448328[_0xb87c('0x12')][_0xb87c('0x14')]);}logger[_0xb87c('0x12')](_0xb87c('0xf'),_0x438ca1,_0x448328[_0xb87c('0x12')][_0xb87c('0x14')]);return _0x57d57e(_0x448328['error']['message']);}else{logger[_0xb87c('0xe')](_0xb87c('0xf'),_0x438ca1,_0xb87c('0x11'));_0x57d57e(_0x448328['result']['message']);}})[_0xb87c('0x15')](function(_0x5ebd1a){logger[_0xb87c('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x438ca1,_0x5ebd1a);_0x20ce04(_0x5ebd1a);});});}exports[_0xb87c('0x16')]=function(_0x4de570){var _0x58e8e5=this;return new Promise(function(_0x2bad28,_0x31ed31){return db[_0xb87c('0x17')][_0xb87c('0x18')](_0x4de570['body'],{'raw':_0x4de570['options']?_0x4de570[_0xb87c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de570[_0xb87c('0x19')]?_0x4de570[_0xb87c('0x19')][_0xb87c('0x1a')]||null:null,'attributes':_0x4de570[_0xb87c('0x19')]?_0x4de570[_0xb87c('0x19')][_0xb87c('0x1b')]||null:null,'limit':_0x4de570['options']?_0x4de570['options'][_0xb87c('0x1c')]||null:null})[_0xb87c('0xd')](function(_0x21096c){logger[_0xb87c('0xe')]('UpdateFaxInteraction',_0x4de570);logger[_0xb87c('0x1d')](_0xb87c('0x16'),_0x4de570,JSON[_0xb87c('0x1e')](_0x21096c));_0x2bad28(_0x21096c);})['catch'](function(_0x89d1d4){logger['error'](_0xb87c('0x16'),_0x89d1d4[_0xb87c('0x14')],_0x4de570);_0x31ed31(_0x58e8e5[_0xb87c('0x12')](0x1f4,_0x89d1d4[_0xb87c('0x14')]));});});};exports[_0xb87c('0x1f')]=function(_0x22e887){return new Promise(function(_0x35243a,_0x1099c3){return db[_0xb87c('0x17')][_0xb87c('0x20')]({'where':_0x22e887['options']?_0x22e887[_0xb87c('0x19')]['where']||null:null})[_0xb87c('0xd')](function(_0x2720e1){if(_0x2720e1){return _0x2720e1[_0xb87c('0x21')](_0x22e887['body']['ids'],_[_0xb87c('0x22')](_0x22e887[_0xb87c('0x23')],[_0xb87c('0x24'),'id'])||{});}})[_0xb87c('0x25')](function(_0x9a2f9e){logger[_0xb87c('0xe')]('AddTags',_0x22e887);logger[_0xb87c('0x1d')](_0xb87c('0x26'),_0x22e887,JSON['stringify'](_0x9a2f9e));_0x35243a(_0x9a2f9e);})[_0xb87c('0x15')](function(_0x51a4ab){logger[_0xb87c('0x12')](_0xb87c('0x26'),_0x51a4ab[_0xb87c('0x14')],_0x22e887);_0x1099c3(_this[_0xb87c('0x12')](0x1f4,_0x51a4ab['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b67113e..df115f2 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 _0x5253=['length','faxInteraction:','save','remove','emit','register'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x5253,0x104));var _0x3525=function(_0x2216eb,_0x5f0938){_0x2216eb=_0x2216eb-0x0;var _0x3761a2=_0x5253[_0x2216eb];return _0x3761a2;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x3525('0x0'),_0x3525('0x1'),'update'];function createListener(_0x259f19,_0x1e3d04){return function(_0x41166c){_0x1e3d04[_0x3525('0x2')](_0x259f19,_0x41166c);};}function removeListener(_0x89343,_0x5a7e92){return function(){FaxInteractionEvents['removeListener'](_0x89343,_0x5a7e92);};}exports[_0x3525('0x3')]=function(_0x3190f8){for(var _0x44e1cf=0x0,_0x474d78=events[_0x3525('0x4')];_0x44e1cf<_0x474d78;_0x44e1cf++){var _0x3a2aed=events[_0x44e1cf];var _0x45e5de=createListener(_0x3525('0x5')+_0x3a2aed,_0x3190f8);FaxInteractionEvents['on'](_0x3a2aed,_0x45e5de);}}; \ No newline at end of file +var _0x6bf6=['length','faxInteraction:','update','emit','removeListener','register'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6bf6,0x164));var _0x66bf=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x6bf6[_0x46f1a6];return _0x38429a;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save','remove',_0x66bf('0x0')];function createListener(_0x4391c5,_0x3ec956){return function(_0x3ebef3){_0x3ec956[_0x66bf('0x1')](_0x4391c5,_0x3ebef3);};}function removeListener(_0x5343ff,_0x87d0ff){return function(){FaxInteractionEvents[_0x66bf('0x2')](_0x5343ff,_0x87d0ff);};}exports[_0x66bf('0x3')]=function(_0x5e4a30){for(var _0x199967=0x0,_0x1b0c6b=events[_0x66bf('0x4')];_0x199967<_0x1b0c6b;_0x199967++){var _0x4973d7=events[_0x199967];var _0xcf8fa0=createListener(_0x66bf('0x5')+_0x4973d7,_0x5e4a30);FaxInteractionEvents['on'](_0x4973d7,_0xcf8fa0);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 94e7405..bdc66f0 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 _0x4c59=['faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','addMessage','tracked','fax'];(function(_0x10d256,_0x540738){var _0x22d088=function(_0xe0facf){while(--_0xe0facf){_0x10d256['push'](_0x10d256['shift']());}};_0x22d088(++_0x540738);}(_0x4c59,0x1eb));var _0x94c5=function(_0x48fb10,_0xa50a89){_0x48fb10=_0x48fb10-0x0;var _0x534251=_0x4c59[_0x48fb10];return _0x534251;};'use strict';var multer=require(_0x94c5('0x0'));var util=require(_0x94c5('0x1'));var path=require(_0x94c5('0x2'));var express=require(_0x94c5('0x3'));var router=express[_0x94c5('0x4')]();var auth=require(_0x94c5('0x5'));var interaction=require(_0x94c5('0x6'));var config=require(_0x94c5('0x7'));var controller=require(_0x94c5('0x8'));router[_0x94c5('0x9')]('/',auth[_0x94c5('0xa')](),controller[_0x94c5('0xb')]);router[_0x94c5('0x9')](_0x94c5('0xc'),auth[_0x94c5('0xa')](),controller[_0x94c5('0xd')]);router[_0x94c5('0x9')](_0x94c5('0xe'),auth['isAuthenticated'](),controller[_0x94c5('0xf')]);router['get']('/:id/messages',auth[_0x94c5('0xa')](),controller['getMessages']);router[_0x94c5('0x10')]('/',auth['isAuthenticated'](),controller[_0x94c5('0x11')]);router[_0x94c5('0x10')]('/:id/messages',auth[_0x94c5('0xa')](),controller[_0x94c5('0x12')]);router[_0x94c5('0x10')]('/:id/tags',auth[_0x94c5('0xa')](),interaction[_0x94c5('0x13')](_0x94c5('0x14'),_0x94c5('0x15')),controller[_0x94c5('0x16')]);router[_0x94c5('0x17')](_0x94c5('0xe'),auth['isAuthenticated'](),interaction[_0x94c5('0x13')](_0x94c5('0x14'),_0x94c5('0x18')),controller[_0x94c5('0x19')]);router[_0x94c5('0x1a')](_0x94c5('0xe'),auth[_0x94c5('0xa')](),interaction[_0x94c5('0x13')](_0x94c5('0x14'),_0x94c5('0x1b')),controller[_0x94c5('0x1c')]);router[_0x94c5('0x1a')](_0x94c5('0x1d'),auth[_0x94c5('0xa')](),controller[_0x94c5('0x1e')]);module[_0x94c5('0x1f')]=router; \ No newline at end of file +var _0xbe04=['util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x30413b,_0x2ababe){var _0x5978fc=function(_0x3cbaf3){while(--_0x3cbaf3){_0x30413b['push'](_0x30413b['shift']());}};_0x5978fc(++_0x2ababe);}(_0xbe04,0x14f));var _0x4be0=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0xbe04[_0x810e4d];return _0x13f01c;};'use strict';var multer=require(_0x4be0('0x0'));var util=require(_0x4be0('0x1'));var path=require(_0x4be0('0x2'));var express=require(_0x4be0('0x3'));var router=express[_0x4be0('0x4')]();var auth=require(_0x4be0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4be0('0x6'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x4be0('0x7')](),controller['index']);router[_0x4be0('0x8')](_0x4be0('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x4be0('0x8')](_0x4be0('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4be0('0x8')](_0x4be0('0xb'),auth[_0x4be0('0x7')](),controller[_0x4be0('0xc')]);router[_0x4be0('0xd')]('/',auth[_0x4be0('0x7')](),controller[_0x4be0('0xe')]);router[_0x4be0('0xd')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4be0('0xf')]);router[_0x4be0('0xd')](_0x4be0('0x10'),auth[_0x4be0('0x7')](),interaction[_0x4be0('0x11')](_0x4be0('0x12'),_0x4be0('0x13')),controller[_0x4be0('0x14')]);router[_0x4be0('0x15')](_0x4be0('0xa'),auth['isAuthenticated'](),interaction[_0x4be0('0x11')](_0x4be0('0x12'),_0x4be0('0x16')),controller['update']);router[_0x4be0('0x17')](_0x4be0('0xa'),auth[_0x4be0('0x7')](),interaction[_0x4be0('0x11')](_0x4be0('0x12'),_0x4be0('0x18')),controller[_0x4be0('0x19')]);router[_0x4be0('0x17')](_0x4be0('0x10'),auth['isAuthenticated'](),controller[_0x4be0('0x1a')]);module[_0x4be0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 4ab0f0f..3f89f43 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 _0x4c03=['DATE','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x4ca029,_0x3d6328){var _0x3787af=function(_0x3f233e){while(--_0x3f233e){_0x4ca029['push'](_0x4ca029['shift']());}};_0x3787af(++_0x3d6328);}(_0x4c03,0x189));var _0x34c0=function(_0x2e0ac0,_0x2ebc56){_0x2e0ac0=_0x2e0ac0-0x0;var _0x4a66eb=_0x4c03[_0x2e0ac0];return _0x4a66eb;};'use strict';var Sequelize=require('sequelize');module[_0x34c0('0x0')]={'body':{'type':Sequelize['TEXT'](_0x34c0('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x34c0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x34c0('0x3')]('in',_0x34c0('0x4')),'defaultValue':_0x34c0('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x34c0('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x34c0('0x6')]}}; \ No newline at end of file +var _0xb5b0=['TEXT','DATE','exports','medium','ENUM','out'];(function(_0x19f670,_0x36d23f){var _0x3ffd49=function(_0x5d9e05){while(--_0x5d9e05){_0x19f670['push'](_0x19f670['shift']());}};_0x3ffd49(++_0x36d23f);}(_0xb5b0,0x1e8));var _0x0b5b=function(_0x23beb5,_0x114e5c){_0x23beb5=_0x23beb5-0x0;var _0x12583f=_0xb5b0[_0x23beb5];return _0x12583f;};'use strict';var Sequelize=require('sequelize');module[_0x0b5b('0x0')]={'body':{'type':Sequelize['TEXT'](_0x0b5b('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0b5b('0x2')]('in','out'),'defaultValue':_0x0b5b('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0b5b('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0b5b('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index ea99096..02e6429 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 _0xeda7=['attributes','length','hasOwnProperty','order','sort','pick','dateEnd','add','day','where','filter','merge','map','FaxMessage','includeAll','include','findAll','rows','catch','params','options','find','body','describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','FaxInteraction','isNil','read1stAt','interaction','user','role','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','create','CmContact','findOne','ContactId','AttachmentId','SendFax','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','../../config/utils','socket.io-emitter','localhost','./faxMessage.socket','register','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','stack','name','send','index','rawAttributes','model','query','dateStart','keys','filters','intersection','fields'];(function(_0x20139d,_0xca29b4){var _0x4a8094=function(_0x27e90f){while(--_0x27e90f){_0x20139d['push'](_0x20139d['shift']());}};_0x4a8094(++_0xca29b4);}(_0xeda7,0x196));var _0x7eda=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xeda7[_0x10004e];return _0x5af990;};'use strict';var jsonpatch=require(_0x7eda('0x0'));var rp=require(_0x7eda('0x1'));var moment=require(_0x7eda('0x2'));var BPromise=require(_0x7eda('0x3'));var Mustache=require(_0x7eda('0x4'));var util=require(_0x7eda('0x5'));var path=require(_0x7eda('0x6'));var sox=require(_0x7eda('0x7'));var csv=require(_0x7eda('0x8'));var ejs=require(_0x7eda('0x9'));var fs=require('fs');var _=require(_0x7eda('0xa'));var squel=require(_0x7eda('0xb'));var crypto=require(_0x7eda('0xc'));var jsforce=require(_0x7eda('0xd'));var deskjs=require(_0x7eda('0xe'));var toCsv=require(_0x7eda('0x8'));var querystring=require(_0x7eda('0xf'));var Papa=require(_0x7eda('0x10'));var qs=require(_0x7eda('0x11'));var logger=require(_0x7eda('0x12'))('api');var utils=require(_0x7eda('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x7eda('0x14'))({'host':_0x7eda('0x15'),'port':0x18eb});require(_0x7eda('0x16'))[_0x7eda('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7eda('0x18')]({'port':0x232c});var client9002=jayson[_0x7eda('0x19')][_0x7eda('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x165fce,_0x5cd373,_0x1e7404,_0x503738){return new BPromise(function(_0x28023a,_0x406ee0){var _0x1353e7=_0x503738||client;return _0x1353e7[_0x7eda('0x1a')](_0x165fce,_0x1e7404)[_0x7eda('0x1b')](function(_0x192ab2){logger[_0x7eda('0x1c')](_0x7eda('0x1d'),_0x5cd373,_0x7eda('0x1e'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5cd373,_0x7eda('0x1e'),JSON['stringify'](_0x192ab2));if(_0x192ab2['error']){if(_0x192ab2[_0x7eda('0x1f')][_0x7eda('0x20')]===0x1f4){logger[_0x7eda('0x1f')](_0x7eda('0x1d'),_0x5cd373,_0x192ab2[_0x7eda('0x1f')]['message']);return _0x406ee0(_0x192ab2['error']['message']);}logger[_0x7eda('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x5cd373,_0x192ab2[_0x7eda('0x1f')][_0x7eda('0x21')]);return _0x28023a(_0x192ab2[_0x7eda('0x1f')][_0x7eda('0x21')]);}else{logger['info'](_0x7eda('0x1d'),_0x5cd373,_0x7eda('0x1e'));_0x28023a(_0x192ab2[_0x7eda('0x22')][_0x7eda('0x21')]);}})['catch'](function(_0x5f0965){logger[_0x7eda('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x5cd373,_0x5f0965);_0x406ee0(_0x5f0965);});});}function respondWithStatusCode(_0x3a1ef8,_0x3deb5a){_0x3deb5a=_0x3deb5a||0xcc;return function(_0x557fec){if(_0x557fec){return _0x3a1ef8[_0x7eda('0x23')](_0x3deb5a);}return _0x3a1ef8[_0x7eda('0x24')](_0x3deb5a)[_0x7eda('0x25')]();};}function respondWithResult(_0x331b5f,_0x40dc99){_0x40dc99=_0x40dc99||0xc8;return function(_0x58869c){if(_0x58869c){return _0x331b5f[_0x7eda('0x24')](_0x40dc99)[_0x7eda('0x26')](_0x58869c);}};}function respondWithFilteredResult(_0x1a4950,_0x5ae8ff){return function(_0x30fc8e){if(_0x30fc8e){var _0xd23184=_0x30fc8e[_0x7eda('0x27')],_0xefbea1=_0x5ae8ff[_0x7eda('0x28')],_0x76f1b2=_0x5ae8ff[_0x7eda('0x28')]+_0x5ae8ff[_0x7eda('0x29')],_0x3fa613;if(_0x76f1b2>=_0xd23184){_0x76f1b2=_0xd23184;_0x3fa613=0xc8;}else{_0x3fa613=0xce;}_0x1a4950[_0x7eda('0x24')](_0x3fa613);return _0x1a4950['set'](_0x7eda('0x2a'),_0xefbea1+'-'+_0x76f1b2+'/'+_0xd23184)[_0x7eda('0x26')](_0x30fc8e);}return null;};}function patchUpdates(_0x300e20){return function(_0x2c5af0){try{jsonpatch['apply'](_0x2c5af0,_0x300e20,!![]);}catch(_0x28aa9f){return BPromise[_0x7eda('0x2b')](_0x28aa9f);}return _0x2c5af0['save']();};}function saveUpdates(_0x1bef90,_0x4655a9){return function(_0x4adb03){if(_0x4adb03){return _0x4adb03[_0x7eda('0x2c')](_0x1bef90)[_0x7eda('0x1b')](function(_0x4206d6){return _0x4206d6;});}return null;};}function removeEntity(_0x2f31d7,_0x25c956){return function(_0x6a95e7){if(_0x6a95e7){return _0x6a95e7[_0x7eda('0x2d')]()[_0x7eda('0x1b')](function(){_0x2f31d7[_0x7eda('0x24')](0xcc)[_0x7eda('0x25')]();});}};}function handleEntityNotFound(_0x516b44,_0x15eff9){return function(_0x497baa){if(!_0x497baa){_0x516b44[_0x7eda('0x23')](0x194);}return _0x497baa;};}function handleError(_0xce5037,_0x15a2d4){_0x15a2d4=_0x15a2d4||0x1f4;return function(_0x7505b6){logger['error'](_0x7505b6[_0x7eda('0x2e')]);if(_0x7505b6[_0x7eda('0x2f')]){delete _0x7505b6[_0x7eda('0x2f')];}_0xce5037['status'](_0x15a2d4)[_0x7eda('0x30')](_0x7505b6);};}exports[_0x7eda('0x31')]=function(_0xa1e9c,_0x5e050f){var _0x339b41={},_0x39c23e={},_0x398c29={'count':0x0,'rows':[]};var _0x186acf=db['FaxMessage'][_0x7eda('0x32')];_0x39c23e[_0x7eda('0x33')]=_['keys'](_0x186acf);var _0x95f882={'dateStart':_0xa1e9c[_0x7eda('0x34')][_0x7eda('0x35')],'dateEnd':_0xa1e9c[_0x7eda('0x34')]['dateEnd']};delete _0xa1e9c[_0x7eda('0x34')][_0x7eda('0x35')];delete _0xa1e9c['query']['dateEnd'];_0x39c23e[_0x7eda('0x34')]=_[_0x7eda('0x36')](_0xa1e9c['query']);_0x39c23e[_0x7eda('0x37')]=_[_0x7eda('0x38')](_0x39c23e[_0x7eda('0x33')],_0x39c23e[_0x7eda('0x34')]);_0x339b41['attributes']=_['intersection'](_0x39c23e[_0x7eda('0x33')],qs[_0x7eda('0x39')](_0xa1e9c[_0x7eda('0x34')][_0x7eda('0x39')]));_0x339b41['attributes']=_0x339b41[_0x7eda('0x3a')][_0x7eda('0x3b')]?_0x339b41[_0x7eda('0x3a')]:_0x39c23e[_0x7eda('0x33')];if(!_0xa1e9c[_0x7eda('0x34')][_0x7eda('0x3c')]('nolimit')){_0x339b41[_0x7eda('0x29')]=qs[_0x7eda('0x29')](_0xa1e9c[_0x7eda('0x34')]['limit']);_0x339b41[_0x7eda('0x28')]=qs[_0x7eda('0x28')](_0xa1e9c[_0x7eda('0x34')][_0x7eda('0x28')]);}_0x339b41[_0x7eda('0x3d')]=qs[_0x7eda('0x3e')](_0xa1e9c[_0x7eda('0x34')]['sort']);_0x339b41['where']=qs[_0x7eda('0x37')](_[_0x7eda('0x3f')](_0xa1e9c[_0x7eda('0x34')],_0x39c23e[_0x7eda('0x37')]));if(_0x95f882[_0x7eda('0x35')]){if(_0x95f882[_0x7eda('0x40')]){_0x95f882[_0x7eda('0x40')]=moment(_0x95f882[_0x7eda('0x40')])[_0x7eda('0x41')](0x1,_0x7eda('0x42'));}else{_0x95f882[_0x7eda('0x40')]=moment(_0x95f882[_0x7eda('0x35')])[_0x7eda('0x41')](0x1,_0x7eda('0x42'));}_['merge'](_0x339b41[_0x7eda('0x43')],{'createdAt':{'$gte':_0x95f882[_0x7eda('0x35')],'$lte':_0x95f882[_0x7eda('0x40')]}});}if(_0xa1e9c['query'][_0x7eda('0x44')]){_0x339b41['where']=_[_0x7eda('0x45')](_0x339b41[_0x7eda('0x43')],{'$or':_[_0x7eda('0x46')](_0x339b41[_0x7eda('0x3a')],function(_0x48a77e){var _0x144388={};_0x144388[_0x48a77e]={'$like':'%'+_0xa1e9c[_0x7eda('0x34')]['filter']+'%'};return _0x144388;})});}_0x339b41=_[_0x7eda('0x45')]({},_0x339b41,_0xa1e9c['options']);var _0x315cf2={'where':_0x339b41[_0x7eda('0x43')]};return db[_0x7eda('0x47')][_0x7eda('0x27')](_0x315cf2)['then'](function(_0x486dcf){_0x398c29[_0x7eda('0x27')]=_0x486dcf;if(_0xa1e9c[_0x7eda('0x34')][_0x7eda('0x48')]){_0x339b41[_0x7eda('0x49')]=[{'all':!![]}];}return db[_0x7eda('0x47')][_0x7eda('0x4a')](_0x339b41);})[_0x7eda('0x1b')](function(_0x3e645f){_0x398c29[_0x7eda('0x4b')]=_0x3e645f;return _0x398c29;})[_0x7eda('0x1b')](respondWithFilteredResult(_0x5e050f,_0x339b41))[_0x7eda('0x4c')](handleError(_0x5e050f,null));};exports['show']=function(_0x1dd73a,_0x335a3){var _0x239399={'raw':!![],'where':{'id':_0x1dd73a[_0x7eda('0x4d')]['id']}},_0x459ba3={};_0x459ba3[_0x7eda('0x33')]=_['keys'](db[_0x7eda('0x47')][_0x7eda('0x32')]);_0x459ba3['query']=_[_0x7eda('0x36')](_0x1dd73a[_0x7eda('0x34')]);_0x459ba3[_0x7eda('0x37')]=_['intersection'](_0x459ba3[_0x7eda('0x33')],_0x459ba3['query']);_0x239399[_0x7eda('0x3a')]=_['intersection'](_0x459ba3[_0x7eda('0x33')],qs[_0x7eda('0x39')](_0x1dd73a['query'][_0x7eda('0x39')]));_0x239399[_0x7eda('0x3a')]=_0x239399['attributes'][_0x7eda('0x3b')]?_0x239399[_0x7eda('0x3a')]:_0x459ba3[_0x7eda('0x33')];if(_0x1dd73a[_0x7eda('0x34')][_0x7eda('0x48')]){_0x239399[_0x7eda('0x49')]=[{'all':!![]}];}_0x239399=_[_0x7eda('0x45')]({},_0x239399,_0x1dd73a[_0x7eda('0x4e')]);return db[_0x7eda('0x47')][_0x7eda('0x4f')](_0x239399)[_0x7eda('0x1b')](handleEntityNotFound(_0x335a3,null))[_0x7eda('0x1b')](respondWithResult(_0x335a3,null))['catch'](handleError(_0x335a3,null));};exports[_0x7eda('0x2c')]=function(_0x5c9a63,_0x4f7d8f){if(_0x5c9a63[_0x7eda('0x50')]['id']){delete _0x5c9a63[_0x7eda('0x50')]['id'];}return db[_0x7eda('0x47')][_0x7eda('0x4f')]({'where':{'id':_0x5c9a63['params']['id']}})[_0x7eda('0x1b')](handleEntityNotFound(_0x4f7d8f,null))[_0x7eda('0x1b')](saveUpdates(_0x5c9a63[_0x7eda('0x50')],null))[_0x7eda('0x1b')](respondWithResult(_0x4f7d8f,null))[_0x7eda('0x4c')](handleError(_0x4f7d8f,null));};exports['destroy']=function(_0x82c6fa,_0x1c3673){return db[_0x7eda('0x47')][_0x7eda('0x4f')]({'where':{'id':_0x82c6fa[_0x7eda('0x4d')]['id']}})[_0x7eda('0x1b')](handleEntityNotFound(_0x1c3673,null))['then'](removeEntity(_0x1c3673,null))[_0x7eda('0x4c')](handleError(_0x1c3673,null));};exports[_0x7eda('0x51')]=function(_0x41d536,_0x1db30a){return db[_0x7eda('0x47')][_0x7eda('0x51')]()[_0x7eda('0x1b')](respondWithResult(_0x1db30a,null))['catch'](handleError(_0x1db30a,null));};var interaction_log=require(_0x7eda('0x12'))(_0x7eda('0x52'));exports[_0x7eda('0x53')]=function(_0x2509f7,_0x2f00e9,_0x1aea6f){var _0x226bf4={'channel':_0x7eda('0x54')};if(_0x2509f7[_0x7eda('0x50')]['id']){delete _0x2509f7[_0x7eda('0x50')]['id'];}_0x2509f7[_0x7eda('0x50')]['read']=!![];_0x2509f7['body']['readAt']=moment()[_0x7eda('0x55')](_0x7eda('0x56'));_0x2509f7[_0x7eda('0x50')][_0x7eda('0x57')]=_0x2509f7[_0x7eda('0x50')][_0x7eda('0x57')]||_0x2509f7['user']['id'];return db[_0x7eda('0x47')][_0x7eda('0x4f')]({'where':{'id':_0x2509f7['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7eda('0x58')}]})[_0x7eda('0x1b')](handleEntityNotFound(_0x2f00e9,null))['then'](saveUpdates(_0x2509f7['body'],null))[_0x7eda('0x1b')](function(_0x22a708){if(_0x22a708){_0x226bf4['message']=_0x22a708[_0x7eda('0x59')]({'plain':!![]});return db[_0x7eda('0x5a')][_0x7eda('0x4f')]({'where':{'id':_0x22a708['FaxInteractionId']}});}return null;})[_0x7eda('0x1b')](handleEntityNotFound(_0x2f00e9,null))[_0x7eda('0x1b')](function(_0xce46bc){if(_0xce46bc){return _0xce46bc[_0x7eda('0x2c')]({'UserId':_0x2509f7[_0x7eda('0x50')][_0x7eda('0x57')],'read1stAt':_[_0x7eda('0x5b')](_0xce46bc[_0x7eda('0x5c')])?moment()[_0x7eda('0x55')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7eda('0x1b')](function(_0x2e2c91){if(_0x2e2c91){_0x226bf4[_0x7eda('0x5d')]=_0x2e2c91[_0x7eda('0x59')]({'plain':!![]});interaction_log[_0x7eda('0x1c')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2509f7[_0x7eda('0x5e')]['id'],_0x2509f7[_0x7eda('0x5e')][_0x7eda('0x2f')],_0x2509f7[_0x7eda('0x5e')][_0x7eda('0x5f')],_0x226bf4['interaction']['id'],_0x2509f7[_0x7eda('0x50')]?JSON['stringify'](_0x2509f7['body']):_0x7eda('0x60'));return respondWithRpcPromise('AcceptMessage',_0x7eda('0x61'),_0x226bf4);}return null;})[_0x7eda('0x1b')](function(_0xf705a2){if(_0xf705a2){if(_0x2509f7[_0x7eda('0x50')][_0x7eda('0x62')]){_0x226bf4[_0x7eda('0x21')]['interface']=util[_0x7eda('0x55')](_0x7eda('0x63'),_0x2509f7[_0x7eda('0x5e')]['name']);_0x226bf4['message'][_0x7eda('0x64')]=_0x226bf4[_0x7eda('0x64')];_0x226bf4['message'][_0x7eda('0x65')]=_0x7eda('0x53');return respondWithRpcPromise(_0x7eda('0x66'),_0x7eda('0x66'),{'event':_0x7eda('0x67'),'message':_0x226bf4[_0x7eda('0x21')]},client9002)[_0x7eda('0x1b')](function(){return _0x226bf4;});}return _0x226bf4;}return null;})[_0x7eda('0x1b')](respondWithResult(_0x2f00e9,null))[_0x7eda('0x4c')](handleError(_0x2f00e9,null));};var interaction_log=require(_0x7eda('0x12'))('fax-interactions');exports['reject']=function(_0x3c44e6,_0x3a845c,_0x479761){var _0x4bcb49={'agent':{},'channel':_0x7eda('0x54')};if(_0x3c44e6[_0x7eda('0x50')]['id']){delete _0x3c44e6['body']['id'];}_0x3c44e6['body'][_0x7eda('0x57')]=_0x3c44e6[_0x7eda('0x50')]['UserId']||_0x3c44e6['user']['id'];_0x4bcb49['agent']['id']=_0x3c44e6[_0x7eda('0x50')][_0x7eda('0x57')];return db[_0x7eda('0x47')][_0x7eda('0x4f')]({'where':{'id':_0x3c44e6[_0x7eda('0x4d')]['id'],'UserId':null}})[_0x7eda('0x1b')](handleEntityNotFound(_0x3a845c,null))[_0x7eda('0x1b')](function(_0x1ceaba){if(_0x1ceaba){_0x4bcb49[_0x7eda('0x21')]=_0x1ceaba[_0x7eda('0x59')]({'plain':!![]});return db[_0x7eda('0x5a')][_0x7eda('0x4f')]({'where':{'id':_0x1ceaba[_0x7eda('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x3a845c,null))[_0x7eda('0x1b')](function(_0x41dfc6){if(_0x41dfc6){_0x4bcb49[_0x7eda('0x5d')]=_0x41dfc6['get']({'plain':!![]});interaction_log[_0x7eda('0x1c')](_0x7eda('0x69'),_0x3c44e6[_0x7eda('0x5e')]['id'],_0x3c44e6[_0x7eda('0x5e')][_0x7eda('0x2f')],_0x3c44e6[_0x7eda('0x5e')]['role'],_0x4bcb49[_0x7eda('0x5d')]['id'],_0x3c44e6[_0x7eda('0x50')]?JSON['stringify'](_0x3c44e6[_0x7eda('0x50')]):_0x7eda('0x60'));return respondWithRpcPromise(_0x7eda('0x6a'),_0x7eda('0x6b'),_0x4bcb49);}return null;})[_0x7eda('0x1b')](function(_0x556528){if(_0x556528){_0x556528[_0x7eda('0x21')][_0x7eda('0x6c')]=util[_0x7eda('0x55')](_0x7eda('0x63'),_0x3c44e6['user']['name']);_0x556528['message'][_0x7eda('0x64')]=_0x4bcb49['channel'];_0x556528[_0x7eda('0x21')]['event']=_0x7eda('0x2b');respondWithRpcPromise('EventManager',_0x7eda('0x66'),{'event':_0x7eda('0x6d'),'message':_0x556528[_0x7eda('0x21')]},client9002);return _0x4bcb49;}return null;})[_0x7eda('0x1b')](respondWithResult(_0x3a845c,null))[_0x7eda('0x4c')](handleError(_0x3a845c,null));};exports[_0x7eda('0x6e')]=function(_0xd02f66,_0x42427b){var _0x239dbd;return db[_0x7eda('0x47')][_0x7eda('0x6e')](_0xd02f66['body'],{})['then'](function(_0x29f480){_0x239dbd=_0x29f480;return db[_0x7eda('0x6f')][_0x7eda('0x70')]({'where':{'id':_0x239dbd[_0x7eda('0x71')]}});})['then'](function(_0xd77858){if(_[_0x7eda('0x5b')](_0xd77858)){return;}else{_0x239dbd[_0x7eda('0x54')]=_0xd77858[_0x7eda('0x54')];return db['Attachment'][_0x7eda('0x70')]({'where':{'id':_0x239dbd[_0x7eda('0x72')]}});}})['then'](function(_0x3b3c82){return respondWithRpcPromise('SendFax',_0x7eda('0x73'),{'FaxAccountId':_[_0x7eda('0x5b')](_0xd02f66['body'])?undefined:_0xd02f66[_0x7eda('0x50')]['FaxAccountId'],'path':_[_0x7eda('0x5b')](_0x3b3c82)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x3b3c82['basename']),'fax':_['isNil'](_0x239dbd[_0x7eda('0x54')])?undefined:_0x239dbd[_0x7eda('0x54')],'AttachmentId':_0x239dbd[_0x7eda('0x72')]},client9002);})[_0x7eda('0x1b')](respondWithResult(_0x42427b,0xc9))[_0x7eda('0x4c')](handleError(_0x42427b,null));}; \ No newline at end of file +var _0x2d07=['destroy','end','stack','name','send','index','FaxMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','count','includeAll','include','findAll','rows','show','params','length','find','body','describe','../../config/logger','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','event','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/environment','../../mysqldb','socket.io-emitter','localhost','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0xd67126,_0x4f240c){var _0x446ff3=function(_0xe7ce82){while(--_0xe7ce82){_0xd67126['push'](_0xd67126['shift']());}};_0x446ff3(++_0x4f240c);}(_0x2d07,0x13a));var _0x72d0=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0x2d07[_0x567bcb];return _0x4eebc2;};'use strict';var jsonpatch=require(_0x72d0('0x0'));var rp=require(_0x72d0('0x1'));var moment=require('moment');var BPromise=require(_0x72d0('0x2'));var Mustache=require(_0x72d0('0x3'));var util=require('util');var path=require(_0x72d0('0x4'));var sox=require(_0x72d0('0x5'));var csv=require(_0x72d0('0x6'));var ejs=require(_0x72d0('0x7'));var fs=require('fs');var _=require(_0x72d0('0x8'));var squel=require(_0x72d0('0x9'));var crypto=require('crypto');var jsforce=require(_0x72d0('0xa'));var deskjs=require(_0x72d0('0xb'));var toCsv=require(_0x72d0('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x72d0('0xc'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x72d0('0xd'));var db=require(_0x72d0('0xe'))['db'];var socket=require(_0x72d0('0xf'))({'host':_0x72d0('0x10'),'port':0x18eb});require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x72d0('0x11')][_0x72d0('0x12')]({'port':0x232c});var client9002=jayson[_0x72d0('0x11')][_0x72d0('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x262274,_0x4fdaf7,_0x23edb6,_0x12fe3d){return new BPromise(function(_0x2721eb,_0x4f2343){var _0x183dc7=_0x12fe3d||client;return _0x183dc7[_0x72d0('0x13')](_0x262274,_0x23edb6)[_0x72d0('0x14')](function(_0x167cb5){logger[_0x72d0('0x15')](_0x72d0('0x16'),_0x4fdaf7,'request\x20sent');logger[_0x72d0('0x17')](_0x72d0('0x18'),_0x4fdaf7,_0x72d0('0x19'),JSON[_0x72d0('0x1a')](_0x167cb5));if(_0x167cb5[_0x72d0('0x1b')]){if(_0x167cb5[_0x72d0('0x1b')][_0x72d0('0x1c')]===0x1f4){logger[_0x72d0('0x1b')](_0x72d0('0x16'),_0x4fdaf7,_0x167cb5['error'][_0x72d0('0x1d')]);return _0x4f2343(_0x167cb5[_0x72d0('0x1b')][_0x72d0('0x1d')]);}logger[_0x72d0('0x1b')](_0x72d0('0x16'),_0x4fdaf7,_0x167cb5[_0x72d0('0x1b')]['message']);return _0x2721eb(_0x167cb5[_0x72d0('0x1b')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x4fdaf7,_0x72d0('0x19'));_0x2721eb(_0x167cb5[_0x72d0('0x1e')]['message']);}})[_0x72d0('0x1f')](function(_0x30cb19){logger['error'](_0x72d0('0x16'),_0x4fdaf7,_0x30cb19);_0x4f2343(_0x30cb19);});});}function respondWithStatusCode(_0x208ab1,_0x5173ce){_0x5173ce=_0x5173ce||0xcc;return function(_0xb4be9d){if(_0xb4be9d){return _0x208ab1[_0x72d0('0x20')](_0x5173ce);}return _0x208ab1[_0x72d0('0x21')](_0x5173ce)['end']();};}function respondWithResult(_0x31f6de,_0x50f263){_0x50f263=_0x50f263||0xc8;return function(_0x37634e){if(_0x37634e){return _0x31f6de[_0x72d0('0x21')](_0x50f263)['json'](_0x37634e);}};}function respondWithFilteredResult(_0x30a509,_0x136d5e){return function(_0x1a11a1){if(_0x1a11a1){var _0x1c7627=_0x1a11a1['count'],_0x160e8f=_0x136d5e[_0x72d0('0x22')],_0x7f45=_0x136d5e['offset']+_0x136d5e[_0x72d0('0x23')],_0x10d27e;if(_0x7f45>=_0x1c7627){_0x7f45=_0x1c7627;_0x10d27e=0xc8;}else{_0x10d27e=0xce;}_0x30a509[_0x72d0('0x21')](_0x10d27e);return _0x30a509[_0x72d0('0x24')](_0x72d0('0x25'),_0x160e8f+'-'+_0x7f45+'/'+_0x1c7627)[_0x72d0('0x26')](_0x1a11a1);}return null;};}function patchUpdates(_0x4d4790){return function(_0x12a92b){try{jsonpatch[_0x72d0('0x27')](_0x12a92b,_0x4d4790,!![]);}catch(_0x51947c){return BPromise[_0x72d0('0x28')](_0x51947c);}return _0x12a92b[_0x72d0('0x29')]();};}function saveUpdates(_0x21e265,_0x480fbe){return function(_0x3471e1){if(_0x3471e1){return _0x3471e1[_0x72d0('0x2a')](_0x21e265)['then'](function(_0x13892a){return _0x13892a;});}return null;};}function removeEntity(_0x5a2fb1,_0x31e9da){return function(_0x2b2eb6){if(_0x2b2eb6){return _0x2b2eb6[_0x72d0('0x2b')]()[_0x72d0('0x14')](function(){_0x5a2fb1[_0x72d0('0x21')](0xcc)[_0x72d0('0x2c')]();});}};}function handleEntityNotFound(_0x3b4459,_0x3021a7){return function(_0xee2823){if(!_0xee2823){_0x3b4459[_0x72d0('0x20')](0x194);}return _0xee2823;};}function handleError(_0x175401,_0x266769){_0x266769=_0x266769||0x1f4;return function(_0x4d6b63){logger[_0x72d0('0x1b')](_0x4d6b63[_0x72d0('0x2d')]);if(_0x4d6b63[_0x72d0('0x2e')]){delete _0x4d6b63[_0x72d0('0x2e')];}_0x175401[_0x72d0('0x21')](_0x266769)[_0x72d0('0x2f')](_0x4d6b63);};}exports[_0x72d0('0x30')]=function(_0x129735,_0x485a10){var _0x353a09={},_0x192ffb={},_0x509aab={'count':0x0,'rows':[]};var _0x4f8185=db[_0x72d0('0x31')][_0x72d0('0x32')];_0x192ffb[_0x72d0('0x33')]=_[_0x72d0('0x34')](_0x4f8185);var _0x1ffd9a={'dateStart':_0x129735[_0x72d0('0x35')][_0x72d0('0x36')],'dateEnd':_0x129735[_0x72d0('0x35')][_0x72d0('0x37')]};delete _0x129735[_0x72d0('0x35')][_0x72d0('0x36')];delete _0x129735[_0x72d0('0x35')][_0x72d0('0x37')];_0x192ffb[_0x72d0('0x35')]=_['keys'](_0x129735['query']);_0x192ffb[_0x72d0('0x38')]=_[_0x72d0('0x39')](_0x192ffb['model'],_0x192ffb[_0x72d0('0x35')]);_0x353a09[_0x72d0('0x3a')]=_['intersection'](_0x192ffb[_0x72d0('0x33')],qs[_0x72d0('0x3b')](_0x129735[_0x72d0('0x35')]['fields']));_0x353a09[_0x72d0('0x3a')]=_0x353a09['attributes']['length']?_0x353a09[_0x72d0('0x3a')]:_0x192ffb['model'];if(!_0x129735[_0x72d0('0x35')][_0x72d0('0x3c')](_0x72d0('0x3d'))){_0x353a09[_0x72d0('0x23')]=qs[_0x72d0('0x23')](_0x129735['query'][_0x72d0('0x23')]);_0x353a09['offset']=qs[_0x72d0('0x22')](_0x129735[_0x72d0('0x35')][_0x72d0('0x22')]);}_0x353a09[_0x72d0('0x3e')]=qs['sort'](_0x129735[_0x72d0('0x35')][_0x72d0('0x3f')]);_0x353a09[_0x72d0('0x40')]=qs[_0x72d0('0x38')](_[_0x72d0('0x41')](_0x129735['query'],_0x192ffb['filters']));if(_0x1ffd9a[_0x72d0('0x36')]){if(_0x1ffd9a[_0x72d0('0x37')]){_0x1ffd9a['dateEnd']=moment(_0x1ffd9a[_0x72d0('0x37')])[_0x72d0('0x42')](0x1,'day');}else{_0x1ffd9a[_0x72d0('0x37')]=moment(_0x1ffd9a[_0x72d0('0x36')])[_0x72d0('0x42')](0x1,_0x72d0('0x43'));}_[_0x72d0('0x44')](_0x353a09[_0x72d0('0x40')],{'createdAt':{'$gte':_0x1ffd9a[_0x72d0('0x36')],'$lte':_0x1ffd9a[_0x72d0('0x37')]}});}if(_0x129735[_0x72d0('0x35')][_0x72d0('0x45')]){_0x353a09['where']=_['merge'](_0x353a09[_0x72d0('0x40')],{'$or':_['map'](_0x353a09['attributes'],function(_0x1763f4){var _0x3dc0be={};_0x3dc0be[_0x1763f4]={'$like':'%'+_0x129735['query'][_0x72d0('0x45')]+'%'};return _0x3dc0be;})});}_0x353a09=_[_0x72d0('0x44')]({},_0x353a09,_0x129735[_0x72d0('0x46')]);var _0x4bb465={'where':_0x353a09['where']};return db[_0x72d0('0x31')]['count'](_0x4bb465)[_0x72d0('0x14')](function(_0x5d9f68){_0x509aab[_0x72d0('0x47')]=_0x5d9f68;if(_0x129735[_0x72d0('0x35')][_0x72d0('0x48')]){_0x353a09[_0x72d0('0x49')]=[{'all':!![]}];}return db[_0x72d0('0x31')][_0x72d0('0x4a')](_0x353a09);})[_0x72d0('0x14')](function(_0x197455){_0x509aab[_0x72d0('0x4b')]=_0x197455;return _0x509aab;})[_0x72d0('0x14')](respondWithFilteredResult(_0x485a10,_0x353a09))['catch'](handleError(_0x485a10,null));};exports[_0x72d0('0x4c')]=function(_0x45008b,_0x5749fb){var _0x4315ac={'raw':!![],'where':{'id':_0x45008b[_0x72d0('0x4d')]['id']}},_0x4ab2bd={};_0x4ab2bd['model']=_['keys'](db[_0x72d0('0x31')][_0x72d0('0x32')]);_0x4ab2bd[_0x72d0('0x35')]=_['keys'](_0x45008b[_0x72d0('0x35')]);_0x4ab2bd[_0x72d0('0x38')]=_['intersection'](_0x4ab2bd[_0x72d0('0x33')],_0x4ab2bd[_0x72d0('0x35')]);_0x4315ac[_0x72d0('0x3a')]=_[_0x72d0('0x39')](_0x4ab2bd[_0x72d0('0x33')],qs[_0x72d0('0x3b')](_0x45008b[_0x72d0('0x35')][_0x72d0('0x3b')]));_0x4315ac[_0x72d0('0x3a')]=_0x4315ac['attributes'][_0x72d0('0x4e')]?_0x4315ac['attributes']:_0x4ab2bd['model'];if(_0x45008b[_0x72d0('0x35')][_0x72d0('0x48')]){_0x4315ac[_0x72d0('0x49')]=[{'all':!![]}];}_0x4315ac=_['merge']({},_0x4315ac,_0x45008b[_0x72d0('0x46')]);return db[_0x72d0('0x31')][_0x72d0('0x4f')](_0x4315ac)[_0x72d0('0x14')](handleEntityNotFound(_0x5749fb,null))[_0x72d0('0x14')](respondWithResult(_0x5749fb,null))[_0x72d0('0x1f')](handleError(_0x5749fb,null));};exports[_0x72d0('0x2a')]=function(_0x359ae2,_0x25131e){if(_0x359ae2[_0x72d0('0x50')]['id']){delete _0x359ae2[_0x72d0('0x50')]['id'];}return db[_0x72d0('0x31')][_0x72d0('0x4f')]({'where':{'id':_0x359ae2[_0x72d0('0x4d')]['id']}})[_0x72d0('0x14')](handleEntityNotFound(_0x25131e,null))['then'](saveUpdates(_0x359ae2[_0x72d0('0x50')],null))[_0x72d0('0x14')](respondWithResult(_0x25131e,null))[_0x72d0('0x1f')](handleError(_0x25131e,null));};exports[_0x72d0('0x2b')]=function(_0x3c4cec,_0x437cd7){return db[_0x72d0('0x31')][_0x72d0('0x4f')]({'where':{'id':_0x3c4cec[_0x72d0('0x4d')]['id']}})[_0x72d0('0x14')](handleEntityNotFound(_0x437cd7,null))[_0x72d0('0x14')](removeEntity(_0x437cd7,null))['catch'](handleError(_0x437cd7,null));};exports[_0x72d0('0x51')]=function(_0x60f554,_0x4db7d5){return db[_0x72d0('0x31')][_0x72d0('0x51')]()['then'](respondWithResult(_0x4db7d5,null))['catch'](handleError(_0x4db7d5,null));};var interaction_log=require(_0x72d0('0x52'))('fax-interactions');exports[_0x72d0('0x53')]=function(_0x2eefeb,_0x3811aa,_0x10c1be){var _0x31d74e={'channel':_0x72d0('0x54')};if(_0x2eefeb[_0x72d0('0x50')]['id']){delete _0x2eefeb[_0x72d0('0x50')]['id'];}_0x2eefeb[_0x72d0('0x50')][_0x72d0('0x55')]=!![];_0x2eefeb[_0x72d0('0x50')]['readAt']=moment()[_0x72d0('0x56')](_0x72d0('0x57'));_0x2eefeb[_0x72d0('0x50')][_0x72d0('0x58')]=_0x2eefeb[_0x72d0('0x50')][_0x72d0('0x58')]||_0x2eefeb['user']['id'];return db[_0x72d0('0x31')][_0x72d0('0x4f')]({'where':{'id':_0x2eefeb[_0x72d0('0x4d')]['id'],'UserId':null},'include':[{'model':db[_0x72d0('0x59')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3811aa,null))[_0x72d0('0x14')](saveUpdates(_0x2eefeb[_0x72d0('0x50')],null))[_0x72d0('0x14')](function(_0x51ac7a){if(_0x51ac7a){_0x31d74e[_0x72d0('0x1d')]=_0x51ac7a[_0x72d0('0x5a')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x51ac7a['FaxInteractionId']}});}return null;})[_0x72d0('0x14')](handleEntityNotFound(_0x3811aa,null))[_0x72d0('0x14')](function(_0x536dad){if(_0x536dad){return _0x536dad[_0x72d0('0x2a')]({'UserId':_0x2eefeb[_0x72d0('0x50')][_0x72d0('0x58')],'read1stAt':_[_0x72d0('0x5b')](_0x536dad[_0x72d0('0x5c')])?moment()[_0x72d0('0x56')](_0x72d0('0x57')):undefined});}return null;})[_0x72d0('0x14')](function(_0x3df1fc){if(_0x3df1fc){_0x31d74e['interaction']=_0x3df1fc['get']({'plain':!![]});interaction_log['info'](_0x72d0('0x5d'),_0x2eefeb[_0x72d0('0x5e')]['id'],_0x2eefeb[_0x72d0('0x5e')][_0x72d0('0x2e')],_0x2eefeb['user']['role'],_0x31d74e['interaction']['id'],_0x2eefeb[_0x72d0('0x50')]?JSON[_0x72d0('0x1a')](_0x2eefeb[_0x72d0('0x50')]):_0x72d0('0x5f'));return respondWithRpcPromise(_0x72d0('0x60'),'acceptMessage',_0x31d74e);}return null;})[_0x72d0('0x14')](function(_0x282781){if(_0x282781){if(_0x2eefeb['body'][_0x72d0('0x61')]){_0x31d74e['message'][_0x72d0('0x62')]=util['format'](_0x72d0('0x63'),_0x2eefeb[_0x72d0('0x5e')][_0x72d0('0x2e')]);_0x31d74e[_0x72d0('0x1d')][_0x72d0('0x64')]=_0x31d74e[_0x72d0('0x64')];_0x31d74e[_0x72d0('0x1d')]['event']='accept';return respondWithRpcPromise(_0x72d0('0x65'),_0x72d0('0x65'),{'event':_0x72d0('0x66'),'message':_0x31d74e[_0x72d0('0x1d')]},client9002)[_0x72d0('0x14')](function(){return _0x31d74e;});}return _0x31d74e;}return null;})[_0x72d0('0x14')](respondWithResult(_0x3811aa,null))[_0x72d0('0x1f')](handleError(_0x3811aa,null));};var interaction_log=require(_0x72d0('0x52'))('fax-interactions');exports[_0x72d0('0x28')]=function(_0x561989,_0x1b6b66,_0x218cec){var _0x58e31a={'agent':{},'channel':_0x72d0('0x54')};if(_0x561989['body']['id']){delete _0x561989[_0x72d0('0x50')]['id'];}_0x561989['body'][_0x72d0('0x58')]=_0x561989[_0x72d0('0x50')]['UserId']||_0x561989[_0x72d0('0x5e')]['id'];_0x58e31a[_0x72d0('0x67')]['id']=_0x561989['body'][_0x72d0('0x58')];return db[_0x72d0('0x31')][_0x72d0('0x4f')]({'where':{'id':_0x561989['params']['id'],'UserId':null}})[_0x72d0('0x14')](handleEntityNotFound(_0x1b6b66,null))[_0x72d0('0x14')](function(_0x4b3cd7){if(_0x4b3cd7){_0x58e31a[_0x72d0('0x1d')]=_0x4b3cd7['get']({'plain':!![]});return db['FaxInteraction'][_0x72d0('0x4f')]({'where':{'id':_0x4b3cd7[_0x72d0('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1b6b66,null))[_0x72d0('0x14')](function(_0x21e7dd){if(_0x21e7dd){_0x58e31a[_0x72d0('0x69')]=_0x21e7dd['get']({'plain':!![]});interaction_log[_0x72d0('0x15')](_0x72d0('0x6a'),_0x561989[_0x72d0('0x5e')]['id'],_0x561989[_0x72d0('0x5e')][_0x72d0('0x2e')],_0x561989['user'][_0x72d0('0x6b')],_0x58e31a[_0x72d0('0x69')]['id'],_0x561989[_0x72d0('0x50')]?JSON['stringify'](_0x561989[_0x72d0('0x50')]):_0x72d0('0x5f'));return respondWithRpcPromise(_0x72d0('0x6c'),_0x72d0('0x6d'),_0x58e31a);}return null;})['then'](function(_0x550265){if(_0x550265){_0x550265[_0x72d0('0x1d')][_0x72d0('0x62')]=util[_0x72d0('0x56')]('SIP/%s',_0x561989[_0x72d0('0x5e')][_0x72d0('0x2e')]);_0x550265[_0x72d0('0x1d')][_0x72d0('0x64')]=_0x58e31a[_0x72d0('0x64')];_0x550265[_0x72d0('0x1d')][_0x72d0('0x6e')]=_0x72d0('0x28');respondWithRpcPromise('EventManager',_0x72d0('0x65'),{'event':_0x72d0('0x6f'),'message':_0x550265[_0x72d0('0x1d')]},client9002);return _0x58e31a;}return null;})['then'](respondWithResult(_0x1b6b66,null))['catch'](handleError(_0x1b6b66,null));};exports['create']=function(_0x1993a2,_0x19cc23){var _0x36d307;return db[_0x72d0('0x31')][_0x72d0('0x70')](_0x1993a2[_0x72d0('0x50')],{})[_0x72d0('0x14')](function(_0x6803e7){_0x36d307=_0x6803e7;return db[_0x72d0('0x59')][_0x72d0('0x71')]({'where':{'id':_0x36d307['ContactId']}});})['then'](function(_0x1faf7a){if(_[_0x72d0('0x5b')](_0x1faf7a)){return;}else{_0x36d307[_0x72d0('0x54')]=_0x1faf7a[_0x72d0('0x54')];return db[_0x72d0('0x72')][_0x72d0('0x71')]({'where':{'id':_0x36d307[_0x72d0('0x73')]}});}})[_0x72d0('0x14')](function(_0x3fd2c9){return respondWithRpcPromise('SendFax',_0x72d0('0x74'),{'FaxAccountId':_[_0x72d0('0x5b')](_0x1993a2['body'])?undefined:_0x1993a2[_0x72d0('0x50')][_0x72d0('0x75')],'path':_[_0x72d0('0x5b')](_0x3fd2c9)?undefined:util[_0x72d0('0x56')](_0x72d0('0x76'),_0x3fd2c9['basename']),'fax':_[_0x72d0('0x5b')](_0x36d307[_0x72d0('0x54')])?undefined:_0x36d307['fax'],'AttachmentId':_0x36d307[_0x72d0('0x73')]},client9002);})['then'](respondWithResult(_0x19cc23,0xc9))[_0x72d0('0x1f')](handleError(_0x19cc23,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 41238d4..faf79a3 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 _0x9552=['events','../../mysqldb','FaxMessage','save','update','remove','emit','hook','exports'];(function(_0x196050,_0x338be0){var _0x5722b5=function(_0x27a1e3){while(--_0x27a1e3){_0x196050['push'](_0x196050['shift']());}};_0x5722b5(++_0x338be0);}(_0x9552,0xea));var _0x2955=function(_0x3f3e50,_0x26d460){_0x3f3e50=_0x3f3e50-0x0;var _0x23b0a4=_0x9552[_0x3f3e50];return _0x23b0a4;};'use strict';var EventEmitter=require(_0x2955('0x0'));var FaxMessage=require(_0x2955('0x1'))['db'][_0x2955('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2955('0x3'),'afterUpdate':_0x2955('0x4'),'afterDestroy':_0x2955('0x5')};function emitEvent(_0x29604f){return function(_0x16b951,_0x147065,_0x337048){FaxMessageEvents[_0x2955('0x6')](_0x29604f+':'+_0x16b951['id'],_0x16b951);FaxMessageEvents[_0x2955('0x6')](_0x29604f,_0x16b951);_0x337048(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x2955('0x7')](e,emitEvent(event));}}module[_0x2955('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xf5b1=['hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','emit'];(function(_0x51d907,_0x40c9f6){var _0x4595d8=function(_0x745767){while(--_0x745767){_0x51d907['push'](_0x51d907['shift']());}};_0x4595d8(++_0x40c9f6);}(_0xf5b1,0xec));var _0x1f5b=function(_0x1218e0,_0x2106eb){_0x1218e0=_0x1218e0-0x0;var _0x2e5538=_0xf5b1[_0x1218e0];return _0x2e5538;};'use strict';var EventEmitter=require(_0x1f5b('0x0'));var FaxMessage=require(_0x1f5b('0x1'))['db'][_0x1f5b('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f5b('0x3'),'afterUpdate':_0x1f5b('0x4'),'afterDestroy':_0x1f5b('0x5')};function emitEvent(_0x50d127){return function(_0x25536b,_0x8aeec6,_0x17732c){FaxMessageEvents[_0x1f5b('0x6')](_0x50d127+':'+_0x25536b['id'],_0x25536b);FaxMessageEvents[_0x1f5b('0x6')](_0x50d127,_0x25536b);_0x17732c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x1f5b('0x7')](e,emitEvent(event));}}module[_0x1f5b('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c8a75ef..965d668 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 _0x74d6=['secret','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','body','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','./faxMessage.attributes','exports','FaxMessage','models','get','direction','toLowerCase','out'];(function(_0x15901c,_0x2802fa){var _0xb59ac0=function(_0x4b16cb){while(--_0x4b16cb){_0x15901c['push'](_0x15901c['shift']());}};_0xb59ac0(++_0x2802fa);}(_0x74d6,0xf7));var _0x674d=function(_0x2ff8c1,_0x1e1512){_0x2ff8c1=_0x2ff8c1-0x0;var _0x2652e9=_0x74d6[_0x2ff8c1];return _0x2652e9;};'use strict';var _=require('lodash');var util=require(_0x674d('0x0'));var logger=require('../../config/logger')(_0x674d('0x1'));var moment=require(_0x674d('0x2'));var BPromise=require(_0x674d('0x3'));var rp=require(_0x674d('0x4'));var attributes=require(_0x674d('0x5'));module[_0x674d('0x6')]=function(_0x3fa0ce,_0x5cdc9d){return _0x3fa0ce['define'](_0x674d('0x7'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3106d1,_0x226dd4,_0x4eb2f9){var _0x1a8d29=_0x3fa0ce[_0x674d('0x8')];var _0x3b4ad0=_0x3106d1[_0x674d('0x9')]({'plain':!![]});if(_0x3b4ad0[_0x674d('0xa')]['toLowerCase']()==='in'||_0x3b4ad0['direction'][_0x674d('0xb')]()===_0x674d('0xc')&&!_0x3b4ad0[_0x674d('0xd')]&&!_[_0x674d('0xe')](_0x3b4ad0[_0x674d('0xf')])){_0x1a8d29['FaxInteraction'][_0x674d('0x10')]({'where':{'id':_0x3b4ad0[_0x674d('0x11')]}})[_0x674d('0x12')](function(_0x4d2cf3){if(_0x4d2cf3){_0x4d2cf3[_0x674d('0x13')]({'lastMsgAt':_0x3b4ad0[_0x674d('0x14')],'lastMsgDirection':_0x3b4ad0[_0x674d('0xa')][_0x674d('0xb')](),'lastMsgBody':_0x3b4ad0[_0x674d('0x15')]});}})[_0x674d('0x16')](function(_0x1d019f){console[_0x674d('0x17')](_0x1d019f);});}_0x4eb2f9();}},'charset':_0x674d('0x18'),'collate':_0x674d('0x19')});}; \ No newline at end of file +var _0x263c=['bluebird','request-promise','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','update','createdAt','body','catch','error','utf8mb4','util','api','moment'];(function(_0x374954,_0x18dc36){var _0x42073e=function(_0x1cb45f){while(--_0x1cb45f){_0x374954['push'](_0x374954['shift']());}};_0x42073e(++_0x18dc36);}(_0x263c,0x14d));var _0xc263=function(_0x1761f0,_0x27fe8b){_0x1761f0=_0x1761f0-0x0;var _0x371d9f=_0x263c[_0x1761f0];return _0x371d9f;};'use strict';var _=require('lodash');var util=require(_0xc263('0x0'));var logger=require('../../config/logger')(_0xc263('0x1'));var moment=require(_0xc263('0x2'));var BPromise=require(_0xc263('0x3'));var rp=require(_0xc263('0x4'));var attributes=require(_0xc263('0x5'));module[_0xc263('0x6')]=function(_0xac3567,_0x3f580c){return _0xac3567[_0xc263('0x7')](_0xc263('0x8'),attributes,{'tableName':_0xc263('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b32b9,_0x1f9666,_0x8c142f){var _0x608c3c=_0xac3567['models'];var _0x5789ef=_0x2b32b9['get']({'plain':!![]});if(_0x5789ef[_0xc263('0xa')][_0xc263('0xb')]()==='in'||_0x5789ef['direction'][_0xc263('0xb')]()===_0xc263('0xc')&&!_0x5789ef[_0xc263('0xd')]&&!_[_0xc263('0xe')](_0x5789ef['UserId'])){_0x608c3c[_0xc263('0xf')][_0xc263('0x10')]({'where':{'id':_0x5789ef[_0xc263('0x11')]}})['then'](function(_0xaefdde){if(_0xaefdde){_0xaefdde[_0xc263('0x12')]({'lastMsgAt':_0x5789ef[_0xc263('0x13')],'lastMsgDirection':_0x5789ef[_0xc263('0xa')][_0xc263('0xb')](),'lastMsgBody':_0x5789ef[_0xc263('0x14')]});}})[_0xc263('0x15')](function(_0x2f9eed){console[_0xc263('0x16')](_0x2f9eed);});}_0x8c142f();}},'charset':_0xc263('0x17'),'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 ca637ab..a1edccd 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 _0x95cc=['error','message','result','catch','create','body','options','raw','debug','CreateFaxMessage','stringify','update','where','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4375ae,_0x110bee){var _0x151837=function(_0x26e25f){while(--_0x26e25f){_0x4375ae['push'](_0x4375ae['shift']());}};_0x151837(++_0x110bee);}(_0x95cc,0x7c));var _0xc95c=function(_0x241099,_0x2997a9){_0x241099=_0x241099-0x0;var _0x164e96=_0x95cc[_0x241099];return _0x164e96;};'use strict';var _=require(_0xc95c('0x0'));var util=require('util');var moment=require(_0xc95c('0x1'));var BPromise=require(_0xc95c('0x2'));var rs=require(_0xc95c('0x3'));var fs=require('fs');var db=require(_0xc95c('0x4'))['db'];var utils=require(_0xc95c('0x5'));var logger=require(_0xc95c('0x6'))(_0xc95c('0x7'));var config=require(_0xc95c('0x8'));var jayson=require(_0xc95c('0x9'));var client=jayson[_0xc95c('0xa')][_0xc95c('0xb')]({'port':0x232a});var socket=require(_0xc95c('0xc'))({'host':_0xc95c('0xd'),'port':0x18eb});require(_0xc95c('0xe'))[_0xc95c('0xf')](socket);function respondWithRpcPromise(_0x319924,_0x1d1c1b,_0x20bd5b){return new BPromise(function(_0x44cdde,_0x265c28){return client['request'](_0x319924,_0x20bd5b)['then'](function(_0x427be5){logger[_0xc95c('0x10')](_0xc95c('0x11'),_0x1d1c1b,_0xc95c('0x12'));logger['debug'](_0xc95c('0x13'),_0x1d1c1b,'request\x20sent',JSON['stringify'](_0x427be5));if(_0x427be5[_0xc95c('0x14')]){if(_0x427be5['error']['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1d1c1b,_0x427be5[_0xc95c('0x14')][_0xc95c('0x15')]);return _0x265c28(_0x427be5[_0xc95c('0x14')][_0xc95c('0x15')]);}logger[_0xc95c('0x14')](_0xc95c('0x11'),_0x1d1c1b,_0x427be5[_0xc95c('0x14')][_0xc95c('0x15')]);return _0x44cdde(_0x427be5[_0xc95c('0x14')]['message']);}else{logger[_0xc95c('0x10')]('FaxMessage,\x20%s,\x20%s',_0x1d1c1b,'request\x20sent');_0x44cdde(_0x427be5[_0xc95c('0x16')][_0xc95c('0x15')]);}})[_0xc95c('0x17')](function(_0x608862){logger[_0xc95c('0x14')](_0xc95c('0x11'),_0x1d1c1b,_0x608862);_0x265c28(_0x608862);});});}exports['CreateFaxMessage']=function(_0x2363c9){var _0x167f52=this;return new Promise(function(_0x62952b,_0x387757){return db['FaxMessage'][_0xc95c('0x18')](_0x2363c9[_0xc95c('0x19')],{'raw':_0x2363c9[_0xc95c('0x1a')]?_0x2363c9['options'][_0xc95c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x30f77c){logger[_0xc95c('0x10')]('CreateFaxMessage',_0x2363c9);logger[_0xc95c('0x1c')](_0xc95c('0x1d'),_0x2363c9,JSON[_0xc95c('0x1e')](_0x30f77c));_0x62952b(_0x30f77c);})[_0xc95c('0x17')](function(_0x1dd0db){logger[_0xc95c('0x14')]('CreateFaxMessage',_0x1dd0db[_0xc95c('0x15')],_0x2363c9);_0x387757(_0x167f52[_0xc95c('0x14')](0x1f4,_0x1dd0db['message']));});});};exports['UpdateFaxMessage']=function(_0x53e4e2){var _0x37bdfb=this;return new Promise(function(_0x32b859,_0x18763e){return db['FaxMessage'][_0xc95c('0x1f')](_0x53e4e2[_0xc95c('0x19')],{'raw':_0x53e4e2['options']?_0x53e4e2['options'][_0xc95c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53e4e2[_0xc95c('0x1a')]?_0x53e4e2['options'][_0xc95c('0x20')]||null:null,'attributes':_0x53e4e2[_0xc95c('0x1a')]?_0x53e4e2['options'][_0xc95c('0x21')]||null:null,'limit':_0x53e4e2['options']?_0x53e4e2[_0xc95c('0x1a')][_0xc95c('0x22')]||null:null})['then'](function(_0x2a83cc){logger[_0xc95c('0x10')](_0xc95c('0x23'),_0x53e4e2);logger['debug'](_0xc95c('0x23'),_0x53e4e2,JSON['stringify'](_0x2a83cc));_0x32b859(_0x2a83cc);})[_0xc95c('0x17')](function(_0x1ec4d6){logger[_0xc95c('0x14')](_0xc95c('0x23'),_0x1ec4d6[_0xc95c('0x15')],_0x53e4e2);_0x18763e(_0x37bdfb['error'](0x1f4,_0x1ec4d6[_0xc95c('0x15')]));});});}; \ No newline at end of file +var _0x9219=['rpc','../../config/environment','jayson/promise','client','http','./faxMessage.socket','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxMessage','FaxMessage','create','raw','UpdateFaxMessage','body','options','where','attributes','bluebird','randomstring','../../config/utils'];(function(_0x5e21c6,_0x4937a5){var _0x5e1922=function(_0xbf973c){while(--_0xbf973c){_0x5e21c6['push'](_0x5e21c6['shift']());}};_0x5e1922(++_0x4937a5);}(_0x9219,0x1a1));var _0x9921=function(_0x47eccf,_0x4997cd){_0x47eccf=_0x47eccf-0x0;var _0x373eb1=_0x9219[_0x47eccf];return _0x373eb1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9921('0x0'));var rs=require(_0x9921('0x1'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x9921('0x2'));var logger=require('../../config/logger')(_0x9921('0x3'));var config=require(_0x9921('0x4'));var jayson=require(_0x9921('0x5'));var client=jayson[_0x9921('0x6')][_0x9921('0x7')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x9921('0x8'))[_0x9921('0x9')](socket);function respondWithRpcPromise(_0x3a8701,_0x527b13,_0x58627d){return new BPromise(function(_0x50435b,_0x19796b){return client['request'](_0x3a8701,_0x58627d)[_0x9921('0xa')](function(_0x4537a1){logger[_0x9921('0xb')](_0x9921('0xc'),_0x527b13,_0x9921('0xd'));logger[_0x9921('0xe')](_0x9921('0xf'),_0x527b13,_0x9921('0xd'),JSON[_0x9921('0x10')](_0x4537a1));if(_0x4537a1['error']){if(_0x4537a1[_0x9921('0x11')]['code']===0x1f4){logger[_0x9921('0x11')](_0x9921('0xc'),_0x527b13,_0x4537a1[_0x9921('0x11')]['message']);return _0x19796b(_0x4537a1[_0x9921('0x11')][_0x9921('0x12')]);}logger[_0x9921('0x11')](_0x9921('0xc'),_0x527b13,_0x4537a1[_0x9921('0x11')][_0x9921('0x12')]);return _0x50435b(_0x4537a1[_0x9921('0x11')][_0x9921('0x12')]);}else{logger['info'](_0x9921('0xc'),_0x527b13,_0x9921('0xd'));_0x50435b(_0x4537a1[_0x9921('0x13')][_0x9921('0x12')]);}})[_0x9921('0x14')](function(_0x4c00b7){logger[_0x9921('0x11')](_0x9921('0xc'),_0x527b13,_0x4c00b7);_0x19796b(_0x4c00b7);});});}exports[_0x9921('0x15')]=function(_0x5c3fc2){var _0xc7cbe5=this;return new Promise(function(_0x5d605a,_0x481093){return db[_0x9921('0x16')][_0x9921('0x17')](_0x5c3fc2['body'],{'raw':_0x5c3fc2['options']?_0x5c3fc2['options'][_0x9921('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x47e2a7){logger[_0x9921('0xb')]('CreateFaxMessage',_0x5c3fc2);logger[_0x9921('0xe')]('CreateFaxMessage',_0x5c3fc2,JSON[_0x9921('0x10')](_0x47e2a7));_0x5d605a(_0x47e2a7);})[_0x9921('0x14')](function(_0xe51601){logger[_0x9921('0x11')](_0x9921('0x15'),_0xe51601[_0x9921('0x12')],_0x5c3fc2);_0x481093(_0xc7cbe5[_0x9921('0x11')](0x1f4,_0xe51601['message']));});});};exports[_0x9921('0x19')]=function(_0x1b475b){var _0x1feecd=this;return new Promise(function(_0x24c341,_0x493d9a){return db[_0x9921('0x16')]['update'](_0x1b475b[_0x9921('0x1a')],{'raw':_0x1b475b[_0x9921('0x1b')]?_0x1b475b[_0x9921('0x1b')][_0x9921('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b475b['options']?_0x1b475b[_0x9921('0x1b')][_0x9921('0x1c')]||null:null,'attributes':_0x1b475b[_0x9921('0x1b')]?_0x1b475b[_0x9921('0x1b')][_0x9921('0x1d')]||null:null,'limit':_0x1b475b['options']?_0x1b475b[_0x9921('0x1b')]['limit']||null:null})[_0x9921('0xa')](function(_0x125c7f){logger[_0x9921('0xb')](_0x9921('0x19'),_0x1b475b);logger[_0x9921('0xe')](_0x9921('0x19'),_0x1b475b,JSON[_0x9921('0x10')](_0x125c7f));_0x24c341(_0x125c7f);})['catch'](function(_0x345ec4){logger[_0x9921('0x11')](_0x9921('0x19'),_0x345ec4[_0x9921('0x12')],_0x1b475b);_0x493d9a(_0x1feecd[_0x9921('0x11')](0x1f4,_0x345ec4[_0x9921('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c59a814..da8bd05 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 _0x66d9=['save','remove','update','emit','length','faxMessage:','./faxMessage.events'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x66d9,0x1e9));var _0x966d=function(_0x392a8d,_0x52411e){_0x392a8d=_0x392a8d-0x0;var _0x3b70b2=_0x66d9[_0x392a8d];return _0x3b70b2;};'use strict';var FaxMessageEvents=require(_0x966d('0x0'));var events=[_0x966d('0x1'),_0x966d('0x2'),_0x966d('0x3')];function createListener(_0x3d26ff,_0x48d248){return function(_0x5eb036){_0x48d248[_0x966d('0x4')](_0x3d26ff,_0x5eb036);};}function removeListener(_0x34a638,_0x4e120a){return function(){FaxMessageEvents['removeListener'](_0x34a638,_0x4e120a);};}exports['register']=function(_0x11538a){for(var _0x1aa2b7=0x0,_0x14fba3=events[_0x966d('0x5')];_0x1aa2b7<_0x14fba3;_0x1aa2b7++){var _0x59544a=events[_0x1aa2b7];var _0x3fbe0e=createListener(_0x966d('0x6')+_0x59544a,_0x11538a);FaxMessageEvents['on'](_0x59544a,_0x3fbe0e);}}; \ No newline at end of file +var _0xd0a4=['remove','update','./faxMessage.events','save'];(function(_0x4c3939,_0x517858){var _0x193f7b=function(_0x99c813){while(--_0x99c813){_0x4c3939['push'](_0x4c3939['shift']());}};_0x193f7b(++_0x517858);}(_0xd0a4,0x13e));var _0x4d0a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd0a4[_0x3bf83f];return _0x22c4a9;};'use strict';var FaxMessageEvents=require(_0x4d0a('0x0'));var events=[_0x4d0a('0x1'),_0x4d0a('0x2'),_0x4d0a('0x3')];function createListener(_0x34644b,_0x1d4d97){return function(_0xe486d0){_0x1d4d97['emit'](_0x34644b,_0xe486d0);};}function removeListener(_0x344180,_0x98ca03){return function(){FaxMessageEvents['removeListener'](_0x344180,_0x98ca03);};}exports['register']=function(_0x4dae1f){for(var _0x44c7a7=0x0,_0x5ebbb3=events['length'];_0x44c7a7<_0x5ebbb3;_0x44c7a7++){var _0x2491d0=events[_0x44c7a7];var _0x5b1797=createListener('faxMessage:'+_0x2491d0,_0x4dae1f);FaxMessageEvents['on'](_0x2491d0,_0x5b1797);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ba7068c..8e24b71 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 _0x58ed=['/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','path','express','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0x38493a,_0x4d36e1){var _0x51fb90=function(_0x37207d){while(--_0x37207d){_0x38493a['push'](_0x38493a['shift']());}};_0x51fb90(++_0x4d36e1);}(_0x58ed,0x147));var _0xd58e=function(_0x545d3e,_0x511dee){_0x545d3e=_0x545d3e-0x0;var _0x2303f7=_0x58ed[_0x545d3e];return _0x2303f7;};'use strict';var multer=require(_0xd58e('0x0'));var util=require('util');var path=require(_0xd58e('0x1'));var express=require(_0xd58e('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd58e('0x3'));var config=require('../../config/environment');var controller=require(_0xd58e('0x4'));router[_0xd58e('0x5')]('/',auth[_0xd58e('0x6')](),controller[_0xd58e('0x7')]);router[_0xd58e('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xd58e('0x8')]);router[_0xd58e('0x5')](_0xd58e('0x9'),auth[_0xd58e('0x6')](),controller[_0xd58e('0xa')]);router[_0xd58e('0xb')]('/',auth[_0xd58e('0x6')](),interaction[_0xd58e('0xc')](_0xd58e('0xd'),_0xd58e('0xe')),controller[_0xd58e('0xf')]);router[_0xd58e('0x10')](_0xd58e('0x9'),auth[_0xd58e('0x6')](),controller[_0xd58e('0x11')]);router[_0xd58e('0x10')](_0xd58e('0x12'),auth[_0xd58e('0x6')](),controller[_0xd58e('0x13')]);router[_0xd58e('0x10')](_0xd58e('0x14'),auth[_0xd58e('0x6')](),controller[_0xd58e('0x15')]);router['delete']('/:id',auth[_0xd58e('0x6')](),controller[_0xd58e('0x16')]);module[_0xd58e('0x17')]=router; \ No newline at end of file +var _0x7ccd=['multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','exports'];(function(_0x34d228,_0x614adc){var _0x1fe4d7=function(_0x3f1e73){while(--_0x3f1e73){_0x34d228['push'](_0x34d228['shift']());}};_0x1fe4d7(++_0x614adc);}(_0x7ccd,0x18c));var _0xd7cc=function(_0x3d737a,_0x19e90c){_0x3d737a=_0x3d737a-0x0;var _0x473a4a=_0x7ccd[_0x3d737a];return _0x473a4a;};'use strict';var multer=require(_0xd7cc('0x0'));var util=require(_0xd7cc('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0xd7cc('0x2'));var interaction=require(_0xd7cc('0x3'));var config=require(_0xd7cc('0x4'));var controller=require(_0xd7cc('0x5'));router['get']('/',auth[_0xd7cc('0x6')](),controller['index']);router[_0xd7cc('0x7')](_0xd7cc('0x8'),auth[_0xd7cc('0x6')](),controller[_0xd7cc('0x9')]);router[_0xd7cc('0x7')](_0xd7cc('0xa'),auth['isAuthenticated'](),controller[_0xd7cc('0xb')]);router['post']('/',auth[_0xd7cc('0x6')](),interaction[_0xd7cc('0xc')](_0xd7cc('0xd'),_0xd7cc('0xe')),controller[_0xd7cc('0xf')]);router[_0xd7cc('0x10')]('/:id',auth[_0xd7cc('0x6')](),controller[_0xd7cc('0x11')]);router[_0xd7cc('0x10')](_0xd7cc('0x12'),auth[_0xd7cc('0x6')](),controller['accept']);router['put'](_0xd7cc('0x13'),auth['isAuthenticated'](),controller[_0xd7cc('0x14')]);router['delete'](_0xd7cc('0xa'),auth[_0xd7cc('0x6')](),controller['destroy']);module[_0xd7cc('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index ac28a60..89ddc6c 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 _0x6cda=['INTEGER','sequelize','exports','STRING','rrmemory','beepall','roundrobin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cda,0x189));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa6cd('0x0'));module[_0xa6cd('0x1')]={'name':{'type':Sequelize[_0xa6cd('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa6cd('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa6cd('0x3'),_0xa6cd('0x4'),_0xa6cd('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa6cd('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x036f=['roundrobin','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4cfcbf,_0x7804a2){var _0x152d90=function(_0x17e3af){while(--_0x17e3af){_0x4cfcbf['push'](_0x4cfcbf['shift']());}};_0x152d90(++_0x7804a2);}(_0x036f,0xcc));var _0xf036=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x036f[_0x25df80];return _0x17b6d0;};'use strict';var Sequelize=require('sequelize');module[_0xf036('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf036('0x1')]},'timeout':{'type':Sequelize[_0xf036('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf036('0x3')](_0xf036('0x4'),_0xf036('0x5'),_0xf036('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xf036('0x2')],'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 808a13c..f3d531e 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 _0xce25=['Agents','addAgents','penalty','removeTeams','Team','union','removeAgents','omit','spread','emit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','moment','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./faxQueue.socket','register','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','FaxQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','limit','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','length','create','body','find','params','describe','hasOwnProperty','nolimit','pick','UserFaxQueue','User','UserId','agent','faxPause','updatedAt','format','%s/%s','createdAt','getTeams','findOne','addTeams','ids'];(function(_0x5ebf44,_0x4e543e){var _0x2fef12=function(_0x59d629){while(--_0x59d629){_0x5ebf44['push'](_0x5ebf44['shift']());}};_0x2fef12(++_0x4e543e);}(_0xce25,0x196));var _0x5ce2=function(_0x59e537,_0x139c12){_0x59e537=_0x59e537-0x0;var _0x3b9cc6=_0xce25[_0x59e537];return _0x3b9cc6;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ce2('0x0'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5ce2('0x1'));var sox=require(_0x5ce2('0x2'));var csv=require('to-csv');var ejs=require(_0x5ce2('0x3'));var fs=require('fs');var _=require(_0x5ce2('0x4'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ce2('0x5'));var deskjs=require(_0x5ce2('0x6'));var toCsv=require(_0x5ce2('0x7'));var querystring=require(_0x5ce2('0x8'));var Papa=require('papaparse');var qs=require(_0x5ce2('0x9'));var logger=require(_0x5ce2('0xa'))(_0x5ce2('0xb'));var utils=require('../../config/utils');var config=require(_0x5ce2('0xc'));var db=require(_0x5ce2('0xd'))['db'];var socket=require(_0x5ce2('0xe'))({'host':_0x5ce2('0xf'),'port':0x18eb});require(_0x5ce2('0x10'))[_0x5ce2('0x11')](socket);function respondWithStatusCode(_0x54241f,_0x270340){_0x270340=_0x270340||0xcc;return function(_0x4f7a36){if(_0x4f7a36){return _0x54241f[_0x5ce2('0x12')](_0x270340);}return _0x54241f[_0x5ce2('0x13')](_0x270340)['end']();};}function respondWithResult(_0x496c1e,_0x595d33){_0x595d33=_0x595d33||0xc8;return function(_0x550fb3){if(_0x550fb3){return _0x496c1e[_0x5ce2('0x13')](_0x595d33)['json'](_0x550fb3);}};}function respondWithFilteredResult(_0x5360b8,_0x3a69ec){return function(_0x56bd1b){if(_0x56bd1b){var _0x9316be=_0x56bd1b[_0x5ce2('0x14')],_0xb9aead=_0x3a69ec[_0x5ce2('0x15')],_0x24522c=_0x3a69ec[_0x5ce2('0x15')]+_0x3a69ec['limit'],_0x53e047;if(_0x24522c>=_0x9316be){_0x24522c=_0x9316be;_0x53e047=0xc8;}else{_0x53e047=0xce;}_0x5360b8['status'](_0x53e047);return _0x5360b8[_0x5ce2('0x16')](_0x5ce2('0x17'),_0xb9aead+'-'+_0x24522c+'/'+_0x9316be)[_0x5ce2('0x18')](_0x56bd1b);}return null;};}function patchUpdates(_0x5369e7){return function(_0x19915d){try{jsonpatch[_0x5ce2('0x19')](_0x19915d,_0x5369e7,!![]);}catch(_0x3dd57a){return BPromise[_0x5ce2('0x1a')](_0x3dd57a);}return _0x19915d[_0x5ce2('0x1b')]();};}function saveUpdates(_0x2f9013,_0x3b3eea){return function(_0x1e13be){if(_0x1e13be){return _0x1e13be[_0x5ce2('0x1c')](_0x2f9013)[_0x5ce2('0x1d')](function(_0x3519c4){return _0x3519c4;});}return null;};}function removeEntity(_0x2d32c9,_0xc9644){return function(_0x3cf781){if(_0x3cf781){return _0x3cf781[_0x5ce2('0x1e')]()[_0x5ce2('0x1d')](function(){_0x2d32c9[_0x5ce2('0x13')](0xcc)[_0x5ce2('0x1f')]();});}};}function handleEntityNotFound(_0x350fd9,_0x587abb){return function(_0x5e703f){if(!_0x5e703f){_0x350fd9[_0x5ce2('0x12')](0x194);}return _0x5e703f;};}function handleError(_0x2e9675,_0x3440b5){_0x3440b5=_0x3440b5||0x1f4;return function(_0x4f27aa){logger['error'](_0x4f27aa[_0x5ce2('0x20')]);if(_0x4f27aa[_0x5ce2('0x21')]){delete _0x4f27aa['name'];}_0x2e9675[_0x5ce2('0x13')](_0x3440b5)[_0x5ce2('0x22')](_0x4f27aa);};}exports[_0x5ce2('0x23')]=function(_0x2198aa,_0x44c692){var _0x208448={},_0x3a4bb9={},_0x19e637={'count':0x0,'rows':[]};var _0x41af3d=db[_0x5ce2('0x24')][_0x5ce2('0x25')];_0x3a4bb9[_0x5ce2('0x26')]=_[_0x5ce2('0x27')](_0x41af3d);var _0xff0a11={'dateStart':_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x29')],'dateEnd':_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x2a')]};delete _0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x29')];delete _0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x2a')];_0x3a4bb9[_0x5ce2('0x28')]=_[_0x5ce2('0x27')](_0x2198aa[_0x5ce2('0x28')]);_0x3a4bb9[_0x5ce2('0x2b')]=_[_0x5ce2('0x2c')](_0x3a4bb9[_0x5ce2('0x26')],_0x3a4bb9[_0x5ce2('0x28')]);_0x208448[_0x5ce2('0x2d')]=_[_0x5ce2('0x2c')](_0x3a4bb9[_0x5ce2('0x26')],qs['fields'](_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x2e')]));_0x208448[_0x5ce2('0x2d')]=_0x208448['attributes']['length']?_0x208448[_0x5ce2('0x2d')]:_0x3a4bb9[_0x5ce2('0x26')];if(!_0x2198aa[_0x5ce2('0x28')]['hasOwnProperty']('nolimit')){_0x208448[_0x5ce2('0x2f')]=qs[_0x5ce2('0x2f')](_0x2198aa['query'][_0x5ce2('0x2f')]);_0x208448[_0x5ce2('0x15')]=qs[_0x5ce2('0x15')](_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x15')]);}_0x208448[_0x5ce2('0x30')]=qs[_0x5ce2('0x31')](_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x31')]);_0x208448[_0x5ce2('0x32')]=qs[_0x5ce2('0x2b')](_['pick'](_0x2198aa['query'],_0x3a4bb9['filters']));if(_0xff0a11['dateStart']){if(_0xff0a11[_0x5ce2('0x2a')]){_0xff0a11[_0x5ce2('0x2a')]=moment(_0xff0a11[_0x5ce2('0x2a')])[_0x5ce2('0x33')](0x1,_0x5ce2('0x34'));}else{_0xff0a11[_0x5ce2('0x2a')]=moment(_0xff0a11[_0x5ce2('0x29')])[_0x5ce2('0x33')](0x1,_0x5ce2('0x34'));}_[_0x5ce2('0x35')](_0x208448[_0x5ce2('0x32')],{'createdAt':{'$gte':_0xff0a11[_0x5ce2('0x29')],'$lte':_0xff0a11['dateEnd']}});}if(_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x36')]){_0x208448['where']=_[_0x5ce2('0x35')](_0x208448[_0x5ce2('0x32')],{'$or':_[_0x5ce2('0x37')](_0x208448[_0x5ce2('0x2d')],function(_0x57dee1){var _0x234789={};_0x234789[_0x57dee1]={'$like':'%'+_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x36')]+'%'};return _0x234789;})});}_0x208448=_[_0x5ce2('0x35')]({},_0x208448,_0x2198aa[_0x5ce2('0x38')]);var _0x45d745={'where':_0x208448['where']};return db[_0x5ce2('0x24')][_0x5ce2('0x14')](_0x45d745)['then'](function(_0x361a90){_0x19e637[_0x5ce2('0x14')]=_0x361a90;if(_0x2198aa['query'][_0x5ce2('0x39')]){_0x208448[_0x5ce2('0x3a')]=[{'all':!![]}];}return db[_0x5ce2('0x24')][_0x5ce2('0x3b')](_0x208448);})[_0x5ce2('0x1d')](function(_0x24918f){_0x19e637[_0x5ce2('0x3c')]=_0x24918f;return _0x19e637;})[_0x5ce2('0x1d')](respondWithFilteredResult(_0x44c692,_0x208448))[_0x5ce2('0x3d')](handleError(_0x44c692,null));};exports['show']=function(_0xf652b4,_0x3b6b09){var _0x53ab87={'raw':!![],'where':{'id':_0xf652b4['params']['id']}},_0x44675f={};_0x44675f[_0x5ce2('0x26')]=_[_0x5ce2('0x27')](db[_0x5ce2('0x24')][_0x5ce2('0x25')]);_0x44675f[_0x5ce2('0x28')]=_[_0x5ce2('0x27')](_0xf652b4[_0x5ce2('0x28')]);_0x44675f['filters']=_[_0x5ce2('0x2c')](_0x44675f[_0x5ce2('0x26')],_0x44675f[_0x5ce2('0x28')]);_0x53ab87[_0x5ce2('0x2d')]=_['intersection'](_0x44675f[_0x5ce2('0x26')],qs[_0x5ce2('0x2e')](_0xf652b4[_0x5ce2('0x28')][_0x5ce2('0x2e')]));_0x53ab87['attributes']=_0x53ab87[_0x5ce2('0x2d')][_0x5ce2('0x3e')]?_0x53ab87[_0x5ce2('0x2d')]:_0x44675f[_0x5ce2('0x26')];if(_0xf652b4['query'][_0x5ce2('0x39')]){_0x53ab87[_0x5ce2('0x3a')]=[{'all':!![]}];}_0x53ab87=_[_0x5ce2('0x35')]({},_0x53ab87,_0xf652b4[_0x5ce2('0x38')]);return db[_0x5ce2('0x24')]['find'](_0x53ab87)[_0x5ce2('0x1d')](handleEntityNotFound(_0x3b6b09,null))[_0x5ce2('0x1d')](respondWithResult(_0x3b6b09,null))[_0x5ce2('0x3d')](handleError(_0x3b6b09,null));};exports[_0x5ce2('0x3f')]=function(_0x244eae,_0x1b8e53){return db[_0x5ce2('0x24')][_0x5ce2('0x3f')](_0x244eae[_0x5ce2('0x40')],{})[_0x5ce2('0x1d')](respondWithResult(_0x1b8e53,0xc9))['catch'](handleError(_0x1b8e53,null));};exports[_0x5ce2('0x1c')]=function(_0x1b354f,_0x1e5a07){if(_0x1b354f['body']['id']){delete _0x1b354f[_0x5ce2('0x40')]['id'];}return db['FaxQueue'][_0x5ce2('0x41')]({'where':{'id':_0x1b354f['params']['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x1e5a07,null))['then'](saveUpdates(_0x1b354f['body'],null))['then'](respondWithResult(_0x1e5a07,null))[_0x5ce2('0x3d')](handleError(_0x1e5a07,null));};exports[_0x5ce2('0x1e')]=function(_0x42af68,_0x3bbc28){return db[_0x5ce2('0x24')][_0x5ce2('0x41')]({'where':{'id':_0x42af68[_0x5ce2('0x42')]['id']}})['then'](handleEntityNotFound(_0x3bbc28,null))['then'](removeEntity(_0x3bbc28,null))['catch'](handleError(_0x3bbc28,null));};exports['describe']=function(_0x361867,_0x49f7e6){return db[_0x5ce2('0x24')][_0x5ce2('0x43')]()[_0x5ce2('0x1d')](respondWithResult(_0x49f7e6,null))[_0x5ce2('0x3d')](handleError(_0x49f7e6,null));};exports['getMembers']=function(_0x303e93,_0xd4abcc,_0x187b74){var _0x16d507={'raw':!![],'where':{}},_0x1252fb={},_0x2b5fc5;return db[_0x5ce2('0x24')]['findOne']({'where':{'id':_0x303e93[_0x5ce2('0x42')]['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0xd4abcc,null))[_0x5ce2('0x1d')](function(_0x3ddf21){if(_0x3ddf21){_0x2b5fc5=_0x3ddf21['get']({'plain':!![]});_0x1252fb[_0x5ce2('0x26')]=_[_0x5ce2('0x27')](db['UserFaxQueue'][_0x5ce2('0x25')]);_0x1252fb[_0x5ce2('0x28')]=_[_0x5ce2('0x27')](_0x303e93[_0x5ce2('0x28')]);_0x1252fb[_0x5ce2('0x2b')]=_[_0x5ce2('0x2c')](_0x1252fb[_0x5ce2('0x26')],_0x1252fb[_0x5ce2('0x28')]);_0x16d507[_0x5ce2('0x2d')]=_[_0x5ce2('0x2c')](_0x1252fb['model'],qs[_0x5ce2('0x2e')](_0x303e93['query'][_0x5ce2('0x2e')]));_0x16d507[_0x5ce2('0x2d')]=_0x16d507[_0x5ce2('0x2d')]['length']?_0x16d507[_0x5ce2('0x2d')]:_0x1252fb['model'];if(!_0x303e93['query'][_0x5ce2('0x44')](_0x5ce2('0x45'))){_0x16d507[_0x5ce2('0x2f')]=qs['limit'](_0x303e93[_0x5ce2('0x28')][_0x5ce2('0x2f')]);_0x16d507[_0x5ce2('0x15')]=qs[_0x5ce2('0x15')](_0x303e93[_0x5ce2('0x28')]['offset']);}_0x16d507[_0x5ce2('0x30')]=qs[_0x5ce2('0x31')](_0x303e93[_0x5ce2('0x28')][_0x5ce2('0x31')]);_0x16d507[_0x5ce2('0x32')]=qs[_0x5ce2('0x2b')](_[_0x5ce2('0x46')](_0x303e93[_0x5ce2('0x28')],_0x1252fb[_0x5ce2('0x2b')]));_0x16d507['where']['FaxQueueId']=_0x3ddf21['id'];if(_0x303e93[_0x5ce2('0x28')][_0x5ce2('0x36')]){_0x16d507['where']=_['merge'](_0x16d507[_0x5ce2('0x32')],{'$or':_[_0x5ce2('0x37')](_0x16d507[_0x5ce2('0x2d')],function(_0x58e990){var _0x490670={};_0x490670[_0x58e990]={'$like':'%'+_0x303e93[_0x5ce2('0x28')][_0x5ce2('0x36')]+'%'};return _0x490670;})});}_0x16d507=_[_0x5ce2('0x35')]({},_0x16d507,_0x303e93[_0x5ce2('0x38')]);return db[_0x5ce2('0x47')][_0x5ce2('0x3b')](_0x16d507);}})[_0x5ce2('0x1d')](function(_0x2ca8ed){if(_0x2ca8ed){return db[_0x5ce2('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x2ca8ed,_0x5ce2('0x49')),'role':_0x5ce2('0x4a')},'attributes':['id',_0x5ce2('0x21'),_0x5ce2('0x4b'),_0x5ce2('0x4c'),'createdAt']});}})[_0x5ce2('0x1d')](function(_0x2299a0){if(_0x2299a0){return{'count':_0x2299a0[_0x5ce2('0x14')],'rows':_[_0x5ce2('0x37')](_0x2299a0[_0x5ce2('0x3c')],function(_0x326046){return{'membername':_0x326046[_0x5ce2('0x21')],'UserId':_0x326046['id'],'queue_name':_0x2b5fc5['name'],'FaxQueueId':_0x2b5fc5['id'],'interface':util[_0x5ce2('0x4d')](_0x5ce2('0x4e'),'SIP',_0x326046[_0x5ce2('0x21')]),'penalty':0x0,'paused':_0x326046[_0x5ce2('0x4b')],'createdAt':_0x326046[_0x5ce2('0x4f')],'updatedAt':_0x326046[_0x5ce2('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5ce2('0x1d')](respondWithFilteredResult(_0xd4abcc,_0x16d507))['catch'](handleError(_0xd4abcc,null));};exports[_0x5ce2('0x50')]=function(_0x5f39ba,_0x5a4505,_0x39a5f7){var _0x151507={};var _0x46bd13={};var _0x1ae5ae;var _0xacc9b9;return db[_0x5ce2('0x24')][_0x5ce2('0x51')]({'where':{'id':_0x5f39ba[_0x5ce2('0x42')]['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x5a4505,null))[_0x5ce2('0x1d')](function(_0x5013eb){if(_0x5013eb){_0x1ae5ae=_0x5013eb;_0x46bd13[_0x5ce2('0x26')]=_[_0x5ce2('0x27')](db['Team'][_0x5ce2('0x25')]);_0x46bd13['query']=_[_0x5ce2('0x27')](_0x5f39ba[_0x5ce2('0x28')]);_0x46bd13[_0x5ce2('0x2b')]=_[_0x5ce2('0x2c')](_0x46bd13['model'],_0x46bd13['query']);_0x151507[_0x5ce2('0x2d')]=_['intersection'](_0x46bd13['model'],qs[_0x5ce2('0x2e')](_0x5f39ba[_0x5ce2('0x28')][_0x5ce2('0x2e')]));_0x151507[_0x5ce2('0x2d')]=_0x151507[_0x5ce2('0x2d')][_0x5ce2('0x3e')]?_0x151507['attributes']:_0x46bd13[_0x5ce2('0x26')];_0x151507[_0x5ce2('0x30')]=qs['sort'](_0x5f39ba[_0x5ce2('0x28')][_0x5ce2('0x31')]);_0x151507[_0x5ce2('0x32')]=qs['filters'](_[_0x5ce2('0x46')](_0x5f39ba[_0x5ce2('0x28')],_0x46bd13['filters']));if(_0x5f39ba['query']['filter']){_0x151507['where']=_[_0x5ce2('0x35')](_0x151507[_0x5ce2('0x32')],{'$or':_[_0x5ce2('0x37')](_0x151507[_0x5ce2('0x2d')],function(_0x14ab0c){var _0x2af55d={};_0x2af55d[_0x14ab0c]={'$like':'%'+_0x5f39ba['query'][_0x5ce2('0x36')]+'%'};return _0x2af55d;})});}_0x151507=_['merge']({},_0x151507,_0x5f39ba[_0x5ce2('0x38')]);return _0x1ae5ae[_0x5ce2('0x50')](_0x151507);}})[_0x5ce2('0x1d')](function(_0x353468){if(_0x353468){_0xacc9b9=_0x353468['length'];if(!_0x5f39ba[_0x5ce2('0x28')][_0x5ce2('0x44')]('nolimit')){_0x151507[_0x5ce2('0x2f')]=qs['limit'](_0x5f39ba[_0x5ce2('0x28')]['limit']);_0x151507[_0x5ce2('0x15')]=qs['offset'](_0x5f39ba[_0x5ce2('0x28')][_0x5ce2('0x15')]);}return _0x1ae5ae[_0x5ce2('0x50')](_0x151507);}})[_0x5ce2('0x1d')](function(_0x1e0f65){if(_0x1e0f65){return _0x1e0f65?{'count':_0xacc9b9,'rows':_0x1e0f65}:null;}})['then'](respondWithResult(_0x5a4505,null))[_0x5ce2('0x3d')](handleError(_0x5a4505,null));};exports[_0x5ce2('0x52')]=function(_0xc0bcdb,_0x60e3ea,_0x5ea5d1){var _0x334cd3=[];var _0x27c928;return db['Team'][_0x5ce2('0x3b')]({'where':{'id':_0xc0bcdb[_0x5ce2('0x40')][_0x5ce2('0x53')]},'attributes':['id'],'include':[{'model':db[_0x5ce2('0x48')],'as':_0x5ce2('0x54'),'attributes':['id'],'raw':!![]}]})[_0x5ce2('0x1d')](function(_0x76d122){if(_0x76d122){for(var _0x540bb5=0x0;_0x540bb5<_0x76d122[_0x5ce2('0x3e')];_0x540bb5+=0x1){for(var _0x21b784=0x0;_0x21b784<_0x76d122[_0x540bb5][_0x5ce2('0x54')][_0x5ce2('0x3e')];_0x21b784+=0x1){_0x334cd3=_['union'](_0x334cd3,[_0x76d122[_0x540bb5][_0x5ce2('0x54')][_0x21b784]['id']]);}}return _0x334cd3;}})[_0x5ce2('0x1d')](function(_0x4b505d){if(_0x4b505d){return db['FaxQueue'][_0x5ce2('0x41')]({'where':{'id':_0xc0bcdb['params']['id']}});}})[_0x5ce2('0x1d')](function(_0x16f4bd){if(_0x16f4bd){_0x27c928=_0x16f4bd;return _0x27c928[_0x5ce2('0x55')](_0x334cd3,{'penalty':_0xc0bcdb['body'][_0x5ce2('0x56')]});}})['then'](function(_0x1aa75a){if(_0x1aa75a){return _0x27c928[_0x5ce2('0x52')](_0xc0bcdb[_0x5ce2('0x40')][_0x5ce2('0x53')]);}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x60e3ea,null))[_0x5ce2('0x1d')](respondWithStatusCode(_0x60e3ea,null))['catch'](handleError(_0x60e3ea,null));};exports[_0x5ce2('0x57')]=function(_0x130bda,_0x430924,_0x57b032){var _0x9c87fe=[];var _0x1b8dc2;return db[_0x5ce2('0x58')][_0x5ce2('0x3b')]({'where':{'id':_0x130bda[_0x5ce2('0x28')][_0x5ce2('0x53')]},'attributes':['id'],'include':[{'model':db[_0x5ce2('0x48')],'as':_0x5ce2('0x54'),'attributes':['id'],'raw':!![]}]})[_0x5ce2('0x1d')](function(_0x129975){if(_0x129975){for(var _0xea1014=0x0;_0xea1014<_0x129975[_0x5ce2('0x3e')];_0xea1014+=0x1){for(var _0x57333f=0x0;_0x57333f<_0x129975[_0xea1014][_0x5ce2('0x54')][_0x5ce2('0x3e')];_0x57333f+=0x1){_0x9c87fe=_[_0x5ce2('0x59')](_0x9c87fe,[_0x129975[_0xea1014][_0x5ce2('0x54')][_0x57333f]['id']]);}}return _0x9c87fe;}})[_0x5ce2('0x1d')](function(_0x275f65){if(_0x275f65){return db['FaxQueue']['find']({'where':{'id':_0x130bda[_0x5ce2('0x42')]['id']}});}})['then'](function(_0x4e63af){if(_0x4e63af){_0x1b8dc2=_0x4e63af;return _0x1b8dc2[_0x5ce2('0x5a')](_0x9c87fe);}})['then'](function(_0x557f8f){if(_0x1b8dc2){return _0x1b8dc2[_0x5ce2('0x57')](_0x130bda[_0x5ce2('0x28')][_0x5ce2('0x53')]);}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x430924,null))[_0x5ce2('0x1d')](respondWithStatusCode(_0x430924,null))['catch'](handleError(_0x430924,null));};exports[_0x5ce2('0x55')]=function(_0x5b991e,_0x4e7a33,_0x5def15){return db[_0x5ce2('0x24')]['find']({'where':{'id':_0x5b991e[_0x5ce2('0x42')]['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x4e7a33,null))[_0x5ce2('0x1d')](function(_0x3e9318){if(_0x3e9318){return _0x3e9318['addAgents'](_0x5b991e[_0x5ce2('0x40')][_0x5ce2('0x53')],_[_0x5ce2('0x5b')](_0x5b991e[_0x5ce2('0x40')],[_0x5ce2('0x53'),'id'])||{})[_0x5ce2('0x5c')](function(_0x194c98){for(var _0x4f9f03=0x0;_0x4f9f03<_0x5b991e[_0x5ce2('0x40')][_0x5ce2('0x53')][_0x5ce2('0x3e')];_0x4f9f03+=0x1){socket[_0x5ce2('0x5d')](_0x5ce2('0x5e'),{'UserId':_0x5b991e[_0x5ce2('0x40')][_0x5ce2('0x53')][_0x4f9f03],'FaxQueueId':_0x5b991e[_0x5ce2('0x42')]['id']});}return _0x194c98;});}})[_0x5ce2('0x1d')](respondWithResult(_0x4e7a33,null))[_0x5ce2('0x3d')](handleError(_0x4e7a33,null));};exports[_0x5ce2('0x5a')]=function(_0xcab632,_0x135fc9,_0x248122){var _0x15cdaf;return db[_0x5ce2('0x24')][_0x5ce2('0x41')]({'where':{'id':_0xcab632['params']['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x135fc9,null))[_0x5ce2('0x1d')](function(_0x3aaf13){if(_0x3aaf13){return _0x3aaf13[_0x5ce2('0x5a')](_0xcab632[_0x5ce2('0x28')][_0x5ce2('0x53')])[_0x5ce2('0x1d')](function(_0x14b408){if(_[_0x5ce2('0x5f')](_0xcab632[_0x5ce2('0x28')][_0x5ce2('0x53')])){for(var _0x4773fb=0x0;_0x4773fb<_0xcab632[_0x5ce2('0x28')]['ids'][_0x5ce2('0x3e')];_0x4773fb+=0x1){socket[_0x5ce2('0x5d')](_0x5ce2('0x60'),{'UserId':_0xcab632['query'][_0x5ce2('0x53')][_0x4773fb],'FaxQueueId':_0xcab632[_0x5ce2('0x42')]['id']});}}else{socket['emit'](_0x5ce2('0x60'),{'UserId':_0xcab632[_0x5ce2('0x28')]['ids'],'FaxQueueId':_0xcab632[_0x5ce2('0x42')]['id']});}});}})[_0x5ce2('0x1d')](respondWithStatusCode(_0x135fc9,null))['catch'](handleError(_0x135fc9,null));};exports[_0x5ce2('0x61')]=function(_0x359d39,_0x10470e,_0x239884){var _0xf613ba={};var _0x4b0cb9={};var _0x928d3;var _0x23e76d;return db['FaxQueue'][_0x5ce2('0x51')]({'where':{'id':_0x359d39[_0x5ce2('0x42')]['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x10470e,null))[_0x5ce2('0x1d')](function(_0x184153){if(_0x184153){_0x928d3=_0x184153;_0x4b0cb9['model']=_[_0x5ce2('0x27')](db[_0x5ce2('0x48')][_0x5ce2('0x25')]);_0x4b0cb9[_0x5ce2('0x28')]=_['keys'](_0x359d39[_0x5ce2('0x28')]);_0x4b0cb9[_0x5ce2('0x2b')]=_[_0x5ce2('0x2c')](_0x4b0cb9['model'],_0x4b0cb9[_0x5ce2('0x28')]);_0xf613ba[_0x5ce2('0x2d')]=_['intersection'](_0x4b0cb9[_0x5ce2('0x26')],qs['fields'](_0x359d39[_0x5ce2('0x28')]['fields']));_0xf613ba[_0x5ce2('0x2d')]=_0xf613ba[_0x5ce2('0x2d')][_0x5ce2('0x3e')]?_0xf613ba['attributes']:_0x4b0cb9[_0x5ce2('0x26')];_0xf613ba[_0x5ce2('0x30')]=qs[_0x5ce2('0x31')](_0x359d39[_0x5ce2('0x28')][_0x5ce2('0x31')]);_0xf613ba[_0x5ce2('0x32')]=qs['filters'](_['pick'](_0x359d39[_0x5ce2('0x28')],_0x4b0cb9[_0x5ce2('0x2b')]));if(_0x359d39[_0x5ce2('0x28')]['filter']){_0xf613ba[_0x5ce2('0x32')]=_[_0x5ce2('0x35')](_0xf613ba['where'],{'$or':_[_0x5ce2('0x37')](_0xf613ba[_0x5ce2('0x2d')],function(_0x197016){var _0x21c4da={};_0x21c4da[_0x197016]={'$like':'%'+_0x359d39['query'][_0x5ce2('0x36')]+'%'};return _0x21c4da;})});}_0xf613ba=_[_0x5ce2('0x35')]({},_0xf613ba,_0x359d39[_0x5ce2('0x38')]);return _0x928d3[_0x5ce2('0x61')](_0xf613ba);}})[_0x5ce2('0x1d')](function(_0x5483ce){if(_0x5483ce){_0x23e76d=_0x5483ce[_0x5ce2('0x3e')];if(!_0x359d39[_0x5ce2('0x28')][_0x5ce2('0x44')]('nolimit')){_0xf613ba[_0x5ce2('0x2f')]=qs[_0x5ce2('0x2f')](_0x359d39[_0x5ce2('0x28')][_0x5ce2('0x2f')]);_0xf613ba[_0x5ce2('0x15')]=qs['offset'](_0x359d39[_0x5ce2('0x28')][_0x5ce2('0x15')]);}return _0x928d3[_0x5ce2('0x61')](_0xf613ba);}})['then'](function(_0x2d8c40){if(_0x2d8c40){return _0x2d8c40?{'count':_0x23e76d,'rows':_0x2d8c40}:null;}})['then'](respondWithResult(_0x10470e,null))[_0x5ce2('0x3d')](handleError(_0x10470e,null));}; \ No newline at end of file +var _0xd98a=['includeAll','create','params','body','find','describe','getMembers','get','UserFaxQueue','FaxQueueId','findAndCountAll','map','UserId','agent','updatedAt','format','%s/%s','createdAt','getTeams','findOne','addTeams','Team','User','Agents','union','addAgents','penalty','ids','removeTeams','removeAgents','omit','spread','emit','userFaxQueue:save','userFaxQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','localhost','./faxQueue.socket','status','end','json','count','offset','limit','set','apply','reject','destroy','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','day','add','filter','merge','options','FaxQueue','include','findAll','rows','catch','show','length'];(function(_0x35dcbc,_0x4834e9){var _0x3bfd51=function(_0x440ebd){while(--_0x440ebd){_0x35dcbc['push'](_0x35dcbc['shift']());}};_0x3bfd51(++_0x4834e9);}(_0xd98a,0x156));var _0xad98=function(_0x5a5276,_0x262d69){_0x5a5276=_0x5a5276-0x0;var _0x3e8ee2=_0xd98a[_0x5a5276];return _0x3e8ee2;};'use strict';var jsonpatch=require(_0xad98('0x0'));var rp=require(_0xad98('0x1'));var moment=require(_0xad98('0x2'));var BPromise=require(_0xad98('0x3'));var Mustache=require(_0xad98('0x4'));var util=require('util');var path=require(_0xad98('0x5'));var sox=require(_0xad98('0x6'));var csv=require('to-csv');var ejs=require(_0xad98('0x7'));var fs=require('fs');var _=require(_0xad98('0x8'));var squel=require(_0xad98('0x9'));var crypto=require(_0xad98('0xa'));var jsforce=require(_0xad98('0xb'));var deskjs=require(_0xad98('0xc'));var toCsv=require(_0xad98('0xd'));var querystring=require(_0xad98('0xe'));var Papa=require('papaparse');var qs=require(_0xad98('0xf'));var logger=require(_0xad98('0x10'))(_0xad98('0x11'));var utils=require(_0xad98('0x12'));var config=require('../../config/environment');var db=require(_0xad98('0x13'))['db'];var socket=require('socket.io-emitter')({'host':_0xad98('0x14'),'port':0x18eb});require(_0xad98('0x15'))['register'](socket);function respondWithStatusCode(_0x5854f3,_0x3ae229){_0x3ae229=_0x3ae229||0xcc;return function(_0x7ceb){if(_0x7ceb){return _0x5854f3['sendStatus'](_0x3ae229);}return _0x5854f3[_0xad98('0x16')](_0x3ae229)[_0xad98('0x17')]();};}function respondWithResult(_0x16683c,_0xcfb0da){_0xcfb0da=_0xcfb0da||0xc8;return function(_0x4c5dc8){if(_0x4c5dc8){return _0x16683c[_0xad98('0x16')](_0xcfb0da)[_0xad98('0x18')](_0x4c5dc8);}};}function respondWithFilteredResult(_0x2369d9,_0x2dd974){return function(_0x1e7c7c){if(_0x1e7c7c){var _0x5b548a=_0x1e7c7c[_0xad98('0x19')],_0x174947=_0x2dd974[_0xad98('0x1a')],_0x1054e4=_0x2dd974[_0xad98('0x1a')]+_0x2dd974[_0xad98('0x1b')],_0x3ce613;if(_0x1054e4>=_0x5b548a){_0x1054e4=_0x5b548a;_0x3ce613=0xc8;}else{_0x3ce613=0xce;}_0x2369d9[_0xad98('0x16')](_0x3ce613);return _0x2369d9[_0xad98('0x1c')]('Content-Range',_0x174947+'-'+_0x1054e4+'/'+_0x5b548a)['json'](_0x1e7c7c);}return null;};}function patchUpdates(_0x42f3ea){return function(_0x5d4893){try{jsonpatch[_0xad98('0x1d')](_0x5d4893,_0x42f3ea,!![]);}catch(_0x4f486b){return BPromise[_0xad98('0x1e')](_0x4f486b);}return _0x5d4893['save']();};}function saveUpdates(_0x20bf21,_0x2ed6ab){return function(_0x6fe929){if(_0x6fe929){return _0x6fe929['update'](_0x20bf21)['then'](function(_0x35a252){return _0x35a252;});}return null;};}function removeEntity(_0x173d16,_0x3d0dd9){return function(_0x25d531){if(_0x25d531){return _0x25d531[_0xad98('0x1f')]()[_0xad98('0x20')](function(){_0x173d16[_0xad98('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430564,_0xcabdda){return function(_0x50412b){if(!_0x50412b){_0x430564['sendStatus'](0x194);}return _0x50412b;};}function handleError(_0x52d7c7,_0x69bfeb){_0x69bfeb=_0x69bfeb||0x1f4;return function(_0x4ffb89){logger[_0xad98('0x21')](_0x4ffb89[_0xad98('0x22')]);if(_0x4ffb89[_0xad98('0x23')]){delete _0x4ffb89[_0xad98('0x23')];}_0x52d7c7[_0xad98('0x16')](_0x69bfeb)[_0xad98('0x24')](_0x4ffb89);};}exports[_0xad98('0x25')]=function(_0x2dec47,_0x22bcd9){var _0xf3e45f={},_0x437545={},_0x268d95={'count':0x0,'rows':[]};var _0x13ae43=db['FaxQueue'][_0xad98('0x26')];_0x437545[_0xad98('0x27')]=_[_0xad98('0x28')](_0x13ae43);var _0x4ed0f7={'dateStart':_0x2dec47[_0xad98('0x29')][_0xad98('0x2a')],'dateEnd':_0x2dec47[_0xad98('0x29')][_0xad98('0x2b')]};delete _0x2dec47[_0xad98('0x29')][_0xad98('0x2a')];delete _0x2dec47[_0xad98('0x29')][_0xad98('0x2b')];_0x437545[_0xad98('0x29')]=_[_0xad98('0x28')](_0x2dec47[_0xad98('0x29')]);_0x437545[_0xad98('0x2c')]=_[_0xad98('0x2d')](_0x437545[_0xad98('0x27')],_0x437545['query']);_0xf3e45f[_0xad98('0x2e')]=_[_0xad98('0x2d')](_0x437545[_0xad98('0x27')],qs[_0xad98('0x2f')](_0x2dec47[_0xad98('0x29')][_0xad98('0x2f')]));_0xf3e45f[_0xad98('0x2e')]=_0xf3e45f['attributes']['length']?_0xf3e45f[_0xad98('0x2e')]:_0x437545[_0xad98('0x27')];if(!_0x2dec47[_0xad98('0x29')][_0xad98('0x30')](_0xad98('0x31'))){_0xf3e45f['limit']=qs[_0xad98('0x1b')](_0x2dec47[_0xad98('0x29')][_0xad98('0x1b')]);_0xf3e45f['offset']=qs[_0xad98('0x1a')](_0x2dec47['query'][_0xad98('0x1a')]);}_0xf3e45f[_0xad98('0x32')]=qs[_0xad98('0x33')](_0x2dec47[_0xad98('0x29')][_0xad98('0x33')]);_0xf3e45f[_0xad98('0x34')]=qs['filters'](_[_0xad98('0x35')](_0x2dec47['query'],_0x437545[_0xad98('0x2c')]));if(_0x4ed0f7[_0xad98('0x2a')]){if(_0x4ed0f7['dateEnd']){_0x4ed0f7['dateEnd']=moment(_0x4ed0f7[_0xad98('0x2b')])['add'](0x1,_0xad98('0x36'));}else{_0x4ed0f7['dateEnd']=moment(_0x4ed0f7[_0xad98('0x2a')])[_0xad98('0x37')](0x1,_0xad98('0x36'));}_['merge'](_0xf3e45f[_0xad98('0x34')],{'createdAt':{'$gte':_0x4ed0f7[_0xad98('0x2a')],'$lte':_0x4ed0f7['dateEnd']}});}if(_0x2dec47[_0xad98('0x29')][_0xad98('0x38')]){_0xf3e45f[_0xad98('0x34')]=_[_0xad98('0x39')](_0xf3e45f['where'],{'$or':_['map'](_0xf3e45f['attributes'],function(_0xb17b45){var _0x5a8a17={};_0x5a8a17[_0xb17b45]={'$like':'%'+_0x2dec47[_0xad98('0x29')]['filter']+'%'};return _0x5a8a17;})});}_0xf3e45f=_[_0xad98('0x39')]({},_0xf3e45f,_0x2dec47[_0xad98('0x3a')]);var _0x789c21={'where':_0xf3e45f[_0xad98('0x34')]};return db[_0xad98('0x3b')][_0xad98('0x19')](_0x789c21)[_0xad98('0x20')](function(_0x1f0fdf){_0x268d95['count']=_0x1f0fdf;if(_0x2dec47[_0xad98('0x29')]['includeAll']){_0xf3e45f[_0xad98('0x3c')]=[{'all':!![]}];}return db[_0xad98('0x3b')][_0xad98('0x3d')](_0xf3e45f);})[_0xad98('0x20')](function(_0xdbf45d){_0x268d95[_0xad98('0x3e')]=_0xdbf45d;return _0x268d95;})[_0xad98('0x20')](respondWithFilteredResult(_0x22bcd9,_0xf3e45f))[_0xad98('0x3f')](handleError(_0x22bcd9,null));};exports[_0xad98('0x40')]=function(_0x1a2ccd,_0x54ecad){var _0x4a3c3b={'raw':!![],'where':{'id':_0x1a2ccd['params']['id']}},_0x22525f={};_0x22525f[_0xad98('0x27')]=_[_0xad98('0x28')](db['FaxQueue']['rawAttributes']);_0x22525f[_0xad98('0x29')]=_[_0xad98('0x28')](_0x1a2ccd[_0xad98('0x29')]);_0x22525f[_0xad98('0x2c')]=_[_0xad98('0x2d')](_0x22525f[_0xad98('0x27')],_0x22525f[_0xad98('0x29')]);_0x4a3c3b[_0xad98('0x2e')]=_['intersection'](_0x22525f[_0xad98('0x27')],qs['fields'](_0x1a2ccd[_0xad98('0x29')][_0xad98('0x2f')]));_0x4a3c3b[_0xad98('0x2e')]=_0x4a3c3b[_0xad98('0x2e')][_0xad98('0x41')]?_0x4a3c3b['attributes']:_0x22525f[_0xad98('0x27')];if(_0x1a2ccd[_0xad98('0x29')][_0xad98('0x42')]){_0x4a3c3b[_0xad98('0x3c')]=[{'all':!![]}];}_0x4a3c3b=_['merge']({},_0x4a3c3b,_0x1a2ccd[_0xad98('0x3a')]);return db[_0xad98('0x3b')]['find'](_0x4a3c3b)['then'](handleEntityNotFound(_0x54ecad,null))['then'](respondWithResult(_0x54ecad,null))['catch'](handleError(_0x54ecad,null));};exports[_0xad98('0x43')]=function(_0x2023e4,_0x441430){return db[_0xad98('0x3b')]['create'](_0x2023e4['body'],{})[_0xad98('0x20')](respondWithResult(_0x441430,0xc9))[_0xad98('0x3f')](handleError(_0x441430,null));};exports['update']=function(_0x34b644,_0x46863e){if(_0x34b644['body']['id']){delete _0x34b644['body']['id'];}return db[_0xad98('0x3b')]['find']({'where':{'id':_0x34b644[_0xad98('0x44')]['id']}})[_0xad98('0x20')](handleEntityNotFound(_0x46863e,null))[_0xad98('0x20')](saveUpdates(_0x34b644[_0xad98('0x45')],null))[_0xad98('0x20')](respondWithResult(_0x46863e,null))[_0xad98('0x3f')](handleError(_0x46863e,null));};exports[_0xad98('0x1f')]=function(_0x4f53dd,_0x5dc945){return db[_0xad98('0x3b')][_0xad98('0x46')]({'where':{'id':_0x4f53dd['params']['id']}})[_0xad98('0x20')](handleEntityNotFound(_0x5dc945,null))[_0xad98('0x20')](removeEntity(_0x5dc945,null))[_0xad98('0x3f')](handleError(_0x5dc945,null));};exports[_0xad98('0x47')]=function(_0x5803e6,_0xd6fc3d){return db[_0xad98('0x3b')]['describe']()[_0xad98('0x20')](respondWithResult(_0xd6fc3d,null))[_0xad98('0x3f')](handleError(_0xd6fc3d,null));};exports[_0xad98('0x48')]=function(_0x4905fd,_0xbe2fe8,_0x5168ba){var _0x437e22={'raw':!![],'where':{}},_0x14c115={},_0x1a1b54;return db['FaxQueue']['findOne']({'where':{'id':_0x4905fd['params']['id']}})[_0xad98('0x20')](handleEntityNotFound(_0xbe2fe8,null))[_0xad98('0x20')](function(_0x5f1f73){if(_0x5f1f73){_0x1a1b54=_0x5f1f73[_0xad98('0x49')]({'plain':!![]});_0x14c115[_0xad98('0x27')]=_[_0xad98('0x28')](db[_0xad98('0x4a')]['rawAttributes']);_0x14c115[_0xad98('0x29')]=_[_0xad98('0x28')](_0x4905fd['query']);_0x14c115['filters']=_['intersection'](_0x14c115[_0xad98('0x27')],_0x14c115['query']);_0x437e22[_0xad98('0x2e')]=_[_0xad98('0x2d')](_0x14c115[_0xad98('0x27')],qs['fields'](_0x4905fd[_0xad98('0x29')]['fields']));_0x437e22['attributes']=_0x437e22[_0xad98('0x2e')][_0xad98('0x41')]?_0x437e22['attributes']:_0x14c115['model'];if(!_0x4905fd[_0xad98('0x29')][_0xad98('0x30')]('nolimit')){_0x437e22[_0xad98('0x1b')]=qs['limit'](_0x4905fd['query'][_0xad98('0x1b')]);_0x437e22[_0xad98('0x1a')]=qs[_0xad98('0x1a')](_0x4905fd['query']['offset']);}_0x437e22[_0xad98('0x32')]=qs['sort'](_0x4905fd[_0xad98('0x29')][_0xad98('0x33')]);_0x437e22[_0xad98('0x34')]=qs[_0xad98('0x2c')](_['pick'](_0x4905fd[_0xad98('0x29')],_0x14c115[_0xad98('0x2c')]));_0x437e22[_0xad98('0x34')][_0xad98('0x4b')]=_0x5f1f73['id'];if(_0x4905fd[_0xad98('0x29')][_0xad98('0x38')]){_0x437e22[_0xad98('0x34')]=_[_0xad98('0x39')](_0x437e22[_0xad98('0x34')],{'$or':_['map'](_0x437e22[_0xad98('0x2e')],function(_0x27fbc9){var _0xdc8e46={};_0xdc8e46[_0x27fbc9]={'$like':'%'+_0x4905fd[_0xad98('0x29')][_0xad98('0x38')]+'%'};return _0xdc8e46;})});}_0x437e22=_[_0xad98('0x39')]({},_0x437e22,_0x4905fd[_0xad98('0x3a')]);return db[_0xad98('0x4a')][_0xad98('0x3d')](_0x437e22);}})['then'](function(_0x1fff64){if(_0x1fff64){return db['User'][_0xad98('0x4c')]({'where':{'id':_[_0xad98('0x4d')](_0x1fff64,_0xad98('0x4e')),'role':_0xad98('0x4f')},'attributes':['id',_0xad98('0x23'),'faxPause',_0xad98('0x50'),'createdAt']});}})[_0xad98('0x20')](function(_0x559688){if(_0x559688){return{'count':_0x559688[_0xad98('0x19')],'rows':_['map'](_0x559688['rows'],function(_0x55babb){return{'membername':_0x55babb[_0xad98('0x23')],'UserId':_0x55babb['id'],'queue_name':_0x1a1b54[_0xad98('0x23')],'FaxQueueId':_0x1a1b54['id'],'interface':util[_0xad98('0x51')](_0xad98('0x52'),'SIP',_0x55babb[_0xad98('0x23')]),'penalty':0x0,'paused':_0x55babb['faxPause'],'createdAt':_0x55babb[_0xad98('0x53')],'updatedAt':_0x55babb[_0xad98('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xad98('0x20')](respondWithFilteredResult(_0xbe2fe8,_0x437e22))['catch'](handleError(_0xbe2fe8,null));};exports[_0xad98('0x54')]=function(_0x54dff2,_0xe9bb9d,_0x549c97){var _0x22d1cf={};var _0x27e892={};var _0x222c93;var _0x464d6d;return db[_0xad98('0x3b')][_0xad98('0x55')]({'where':{'id':_0x54dff2[_0xad98('0x44')]['id']}})['then'](handleEntityNotFound(_0xe9bb9d,null))['then'](function(_0x3e5e5){if(_0x3e5e5){_0x222c93=_0x3e5e5;_0x27e892[_0xad98('0x27')]=_[_0xad98('0x28')](db['Team'][_0xad98('0x26')]);_0x27e892[_0xad98('0x29')]=_[_0xad98('0x28')](_0x54dff2[_0xad98('0x29')]);_0x27e892['filters']=_['intersection'](_0x27e892[_0xad98('0x27')],_0x27e892[_0xad98('0x29')]);_0x22d1cf[_0xad98('0x2e')]=_[_0xad98('0x2d')](_0x27e892['model'],qs[_0xad98('0x2f')](_0x54dff2[_0xad98('0x29')][_0xad98('0x2f')]));_0x22d1cf[_0xad98('0x2e')]=_0x22d1cf[_0xad98('0x2e')][_0xad98('0x41')]?_0x22d1cf[_0xad98('0x2e')]:_0x27e892[_0xad98('0x27')];_0x22d1cf[_0xad98('0x32')]=qs[_0xad98('0x33')](_0x54dff2[_0xad98('0x29')][_0xad98('0x33')]);_0x22d1cf[_0xad98('0x34')]=qs[_0xad98('0x2c')](_[_0xad98('0x35')](_0x54dff2[_0xad98('0x29')],_0x27e892[_0xad98('0x2c')]));if(_0x54dff2[_0xad98('0x29')][_0xad98('0x38')]){_0x22d1cf[_0xad98('0x34')]=_[_0xad98('0x39')](_0x22d1cf['where'],{'$or':_['map'](_0x22d1cf[_0xad98('0x2e')],function(_0x18240a){var _0x32aba3={};_0x32aba3[_0x18240a]={'$like':'%'+_0x54dff2[_0xad98('0x29')][_0xad98('0x38')]+'%'};return _0x32aba3;})});}_0x22d1cf=_[_0xad98('0x39')]({},_0x22d1cf,_0x54dff2['options']);return _0x222c93[_0xad98('0x54')](_0x22d1cf);}})[_0xad98('0x20')](function(_0x1011ca){if(_0x1011ca){_0x464d6d=_0x1011ca[_0xad98('0x41')];if(!_0x54dff2[_0xad98('0x29')][_0xad98('0x30')](_0xad98('0x31'))){_0x22d1cf[_0xad98('0x1b')]=qs['limit'](_0x54dff2[_0xad98('0x29')][_0xad98('0x1b')]);_0x22d1cf['offset']=qs['offset'](_0x54dff2[_0xad98('0x29')][_0xad98('0x1a')]);}return _0x222c93[_0xad98('0x54')](_0x22d1cf);}})[_0xad98('0x20')](function(_0x9a6d7b){if(_0x9a6d7b){return _0x9a6d7b?{'count':_0x464d6d,'rows':_0x9a6d7b}:null;}})['then'](respondWithResult(_0xe9bb9d,null))[_0xad98('0x3f')](handleError(_0xe9bb9d,null));};exports[_0xad98('0x56')]=function(_0x18c72e,_0x20e969,_0x1071d8){var _0x5ef41e=[];var _0x414ee6;return db[_0xad98('0x57')][_0xad98('0x3d')]({'where':{'id':_0x18c72e[_0xad98('0x45')]['ids']},'attributes':['id'],'include':[{'model':db[_0xad98('0x58')],'as':_0xad98('0x59'),'attributes':['id'],'raw':!![]}]})[_0xad98('0x20')](function(_0xc3412d){if(_0xc3412d){for(var _0x6d64=0x0;_0x6d64<_0xc3412d[_0xad98('0x41')];_0x6d64+=0x1){for(var _0x120bdc=0x0;_0x120bdc<_0xc3412d[_0x6d64]['Agents'][_0xad98('0x41')];_0x120bdc+=0x1){_0x5ef41e=_[_0xad98('0x5a')](_0x5ef41e,[_0xc3412d[_0x6d64]['Agents'][_0x120bdc]['id']]);}}return _0x5ef41e;}})[_0xad98('0x20')](function(_0x41e3b3){if(_0x41e3b3){return db['FaxQueue'][_0xad98('0x46')]({'where':{'id':_0x18c72e[_0xad98('0x44')]['id']}});}})[_0xad98('0x20')](function(_0x307b55){if(_0x307b55){_0x414ee6=_0x307b55;return _0x414ee6[_0xad98('0x5b')](_0x5ef41e,{'penalty':_0x18c72e[_0xad98('0x45')][_0xad98('0x5c')]});}})[_0xad98('0x20')](function(_0x1a1d52){if(_0x1a1d52){return _0x414ee6[_0xad98('0x56')](_0x18c72e[_0xad98('0x45')][_0xad98('0x5d')]);}})[_0xad98('0x20')](handleEntityNotFound(_0x20e969,null))['then'](respondWithStatusCode(_0x20e969,null))[_0xad98('0x3f')](handleError(_0x20e969,null));};exports[_0xad98('0x5e')]=function(_0x22c3d0,_0x4037ad,_0x4daa5f){var _0x370436=[];var _0x365209;return db[_0xad98('0x57')][_0xad98('0x3d')]({'where':{'id':_0x22c3d0[_0xad98('0x29')][_0xad98('0x5d')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xad98('0x20')](function(_0x3cadbe){if(_0x3cadbe){for(var _0x4c3bc7=0x0;_0x4c3bc7<_0x3cadbe['length'];_0x4c3bc7+=0x1){for(var _0xa00f0c=0x0;_0xa00f0c<_0x3cadbe[_0x4c3bc7][_0xad98('0x59')]['length'];_0xa00f0c+=0x1){_0x370436=_['union'](_0x370436,[_0x3cadbe[_0x4c3bc7]['Agents'][_0xa00f0c]['id']]);}}return _0x370436;}})[_0xad98('0x20')](function(_0x1b88e4){if(_0x1b88e4){return db['FaxQueue'][_0xad98('0x46')]({'where':{'id':_0x22c3d0[_0xad98('0x44')]['id']}});}})[_0xad98('0x20')](function(_0x579982){if(_0x579982){_0x365209=_0x579982;return _0x365209[_0xad98('0x5f')](_0x370436);}})[_0xad98('0x20')](function(_0x94079e){if(_0x365209){return _0x365209[_0xad98('0x5e')](_0x22c3d0['query'][_0xad98('0x5d')]);}})[_0xad98('0x20')](handleEntityNotFound(_0x4037ad,null))[_0xad98('0x20')](respondWithStatusCode(_0x4037ad,null))['catch'](handleError(_0x4037ad,null));};exports[_0xad98('0x5b')]=function(_0x41fa02,_0x125b55,_0xf40fb1){return db[_0xad98('0x3b')][_0xad98('0x46')]({'where':{'id':_0x41fa02['params']['id']}})[_0xad98('0x20')](handleEntityNotFound(_0x125b55,null))[_0xad98('0x20')](function(_0xe6eba5){if(_0xe6eba5){return _0xe6eba5[_0xad98('0x5b')](_0x41fa02[_0xad98('0x45')]['ids'],_[_0xad98('0x60')](_0x41fa02[_0xad98('0x45')],[_0xad98('0x5d'),'id'])||{})[_0xad98('0x61')](function(_0x11515a){for(var _0x1368d4=0x0;_0x1368d4<_0x41fa02[_0xad98('0x45')][_0xad98('0x5d')][_0xad98('0x41')];_0x1368d4+=0x1){socket[_0xad98('0x62')](_0xad98('0x63'),{'UserId':_0x41fa02['body'][_0xad98('0x5d')][_0x1368d4],'FaxQueueId':_0x41fa02[_0xad98('0x44')]['id']});}return _0x11515a;});}})['then'](respondWithResult(_0x125b55,null))[_0xad98('0x3f')](handleError(_0x125b55,null));};exports[_0xad98('0x5f')]=function(_0x3d475c,_0x2b7336,_0x4e06d0){var _0x10b1b0;return db[_0xad98('0x3b')][_0xad98('0x46')]({'where':{'id':_0x3d475c[_0xad98('0x44')]['id']}})[_0xad98('0x20')](handleEntityNotFound(_0x2b7336,null))['then'](function(_0x1acc16){if(_0x1acc16){return _0x1acc16['removeAgents'](_0x3d475c[_0xad98('0x29')][_0xad98('0x5d')])[_0xad98('0x20')](function(_0x512d84){if(_['isArray'](_0x3d475c[_0xad98('0x29')][_0xad98('0x5d')])){for(var _0x59f2ca=0x0;_0x59f2ca<_0x3d475c[_0xad98('0x29')][_0xad98('0x5d')][_0xad98('0x41')];_0x59f2ca+=0x1){socket[_0xad98('0x62')]('userFaxQueue:remove',{'UserId':_0x3d475c[_0xad98('0x29')][_0xad98('0x5d')][_0x59f2ca],'FaxQueueId':_0x3d475c[_0xad98('0x44')]['id']});}}else{socket['emit'](_0xad98('0x64'),{'UserId':_0x3d475c[_0xad98('0x29')][_0xad98('0x5d')],'FaxQueueId':_0x3d475c[_0xad98('0x44')]['id']});}});}})[_0xad98('0x20')](respondWithStatusCode(_0x2b7336,null))[_0xad98('0x3f')](handleError(_0x2b7336,null));};exports[_0xad98('0x65')]=function(_0x445604,_0x268cc5,_0x7631d){var _0x2d2c5f={};var _0x31be2e={};var _0x175703;var _0x1f99a7;return db[_0xad98('0x3b')][_0xad98('0x55')]({'where':{'id':_0x445604['params']['id']}})[_0xad98('0x20')](handleEntityNotFound(_0x268cc5,null))['then'](function(_0x5c1c01){if(_0x5c1c01){_0x175703=_0x5c1c01;_0x31be2e[_0xad98('0x27')]=_[_0xad98('0x28')](db['User'][_0xad98('0x26')]);_0x31be2e['query']=_['keys'](_0x445604[_0xad98('0x29')]);_0x31be2e[_0xad98('0x2c')]=_['intersection'](_0x31be2e[_0xad98('0x27')],_0x31be2e['query']);_0x2d2c5f['attributes']=_['intersection'](_0x31be2e[_0xad98('0x27')],qs[_0xad98('0x2f')](_0x445604[_0xad98('0x29')][_0xad98('0x2f')]));_0x2d2c5f[_0xad98('0x2e')]=_0x2d2c5f[_0xad98('0x2e')][_0xad98('0x41')]?_0x2d2c5f[_0xad98('0x2e')]:_0x31be2e['model'];_0x2d2c5f[_0xad98('0x32')]=qs[_0xad98('0x33')](_0x445604[_0xad98('0x29')][_0xad98('0x33')]);_0x2d2c5f[_0xad98('0x34')]=qs[_0xad98('0x2c')](_[_0xad98('0x35')](_0x445604['query'],_0x31be2e[_0xad98('0x2c')]));if(_0x445604[_0xad98('0x29')][_0xad98('0x38')]){_0x2d2c5f[_0xad98('0x34')]=_[_0xad98('0x39')](_0x2d2c5f[_0xad98('0x34')],{'$or':_['map'](_0x2d2c5f[_0xad98('0x2e')],function(_0xa6b1b0){var _0x438f96={};_0x438f96[_0xa6b1b0]={'$like':'%'+_0x445604[_0xad98('0x29')]['filter']+'%'};return _0x438f96;})});}_0x2d2c5f=_[_0xad98('0x39')]({},_0x2d2c5f,_0x445604['options']);return _0x175703[_0xad98('0x65')](_0x2d2c5f);}})[_0xad98('0x20')](function(_0x4b0c68){if(_0x4b0c68){_0x1f99a7=_0x4b0c68['length'];if(!_0x445604['query'][_0xad98('0x30')](_0xad98('0x31'))){_0x2d2c5f[_0xad98('0x1b')]=qs[_0xad98('0x1b')](_0x445604[_0xad98('0x29')][_0xad98('0x1b')]);_0x2d2c5f[_0xad98('0x1a')]=qs[_0xad98('0x1a')](_0x445604['query'][_0xad98('0x1a')]);}return _0x175703['getAgents'](_0x2d2c5f);}})['then'](function(_0x411cbf){if(_0x411cbf){return _0x411cbf?{'count':_0x1f99a7,'rows':_0x411cbf}:null;}})[_0xad98('0x20')](respondWithResult(_0x268cc5,null))[_0xad98('0x3f')](handleError(_0x268cc5,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ed3fd97..841dd53 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 _0x3435=['emit','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0xf6acac,_0x3e2182){var _0x339f10=function(_0x3dc572){while(--_0x3dc572){_0xf6acac['push'](_0xf6acac['shift']());}};_0x339f10(++_0x3e2182);}(_0x3435,0xfa));var _0x5343=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x3435[_0xd22d95];return _0x15d7a3;};'use strict';var EventEmitter=require(_0x5343('0x0'));var FaxQueue=require(_0x5343('0x1'))['db'][_0x5343('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5343('0x3')](0x0);var events={'afterCreate':_0x5343('0x4'),'afterUpdate':_0x5343('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3f1d67){return function(_0x3ae07e,_0x578a24,_0x4ca9ba){FaxQueueEvents[_0x5343('0x6')](_0x3f1d67+':'+_0x3ae07e['id'],_0x3ae07e);FaxQueueEvents[_0x5343('0x6')](_0x3f1d67,_0x3ae07e);_0x4ca9ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x5343('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x6aa7=['events','FaxQueue','setMaxListeners','save','update','emit','hook','exports'];(function(_0x394814,_0x136462){var _0x32c36c=function(_0x4a92c0){while(--_0x4a92c0){_0x394814['push'](_0x394814['shift']());}};_0x32c36c(++_0x136462);}(_0x6aa7,0x178));var _0x76aa=function(_0x4a4083,_0xf81ed4){_0x4a4083=_0x4a4083-0x0;var _0x4031ca=_0x6aa7[_0x4a4083];return _0x4031ca;};'use strict';var EventEmitter=require(_0x76aa('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x76aa('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x76aa('0x2')](0x0);var events={'afterCreate':_0x76aa('0x3'),'afterUpdate':_0x76aa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13f62b){return function(_0xef15ef,_0x1d6e04,_0x511588){FaxQueueEvents['emit'](_0x13f62b+':'+_0xef15ef['id'],_0xef15ef);FaxQueueEvents[_0x76aa('0x5')](_0x13f62b,_0xef15ef);_0x511588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x76aa('0x6')](e,emitEvent(event));}}module[_0x76aa('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 20f51dd..3f4a069 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 _0x41af=['lodash','util','moment','request-promise','FaxQueue','fax_queues'];(function(_0x33a9c1,_0x42bab9){var _0xe22166=function(_0x3aebe6){while(--_0x3aebe6){_0x33a9c1['push'](_0x33a9c1['shift']());}};_0xe22166(++_0x42bab9);}(_0x41af,0x1e0));var _0xf41a=function(_0x21ebf2,_0x1f5992){_0x21ebf2=_0x21ebf2-0x0;var _0x11f397=_0x41af[_0x21ebf2];return _0x11f397;};'use strict';var _=require(_0xf41a('0x0'));var util=require(_0xf41a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf41a('0x2'));var BPromise=require('bluebird');var rp=require(_0xf41a('0x3'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x588c48,_0x4a8c5d){return _0x588c48['define'](_0xf41a('0x4'),attributes,{'tableName':_0xf41a('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e40=['lodash','api','moment','bluebird','request-promise','./faxQueue.attributes','exports','define','fax_queues'];(function(_0x14284c,_0x2d4675){var _0x597c41=function(_0x1edae0){while(--_0x1edae0){_0x14284c['push'](_0x14284c['shift']());}};_0x597c41(++_0x2d4675);}(_0x0e40,0xcf));var _0x00e4=function(_0x16c4de,_0x328a83){_0x16c4de=_0x16c4de-0x0;var _0x3c6630=_0x0e40[_0x16c4de];return _0x3c6630;};'use strict';var _=require(_0x00e4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x00e4('0x1'));var moment=require(_0x00e4('0x2'));var BPromise=require(_0x00e4('0x3'));var rp=require(_0x00e4('0x4'));var attributes=require(_0x00e4('0x5'));module[_0x00e4('0x6')]=function(_0x43131d,_0x29831c){return _0x43131d[_0x00e4('0x7')]('FaxQueue',attributes,{'tableName':_0x00e4('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 688c076..f936cbb 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 _0x94a5=['where','attributes','limit','include','map','model','ShowFaxQueue','find','raw','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFaxQueue','FaxQueue','options'];(function(_0x158b47,_0x23fbeb){var _0x1a4a1a=function(_0x17b51e){while(--_0x17b51e){_0x158b47['push'](_0x158b47['shift']());}};_0x1a4a1a(++_0x23fbeb);}(_0x94a5,0x156));var _0x594a=function(_0x36f20a,_0x30ee3e){_0x36f20a=_0x36f20a-0x0;var _0x4f5b12=_0x94a5[_0x36f20a];return _0x4f5b12;};'use strict';var _=require(_0x594a('0x0'));var util=require('util');var moment=require(_0x594a('0x1'));var BPromise=require(_0x594a('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x594a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x594a('0x4'))(_0x594a('0x5'));var config=require(_0x594a('0x6'));var jayson=require(_0x594a('0x7'));var client=jayson[_0x594a('0x8')][_0x594a('0x9')]({'port':0x232a});var socket=require(_0x594a('0xa'))({'host':_0x594a('0xb'),'port':0x18eb});require(_0x594a('0xc'))['register'](socket);function respondWithRpcPromise(_0xd9a859,_0x4904c7,_0x4dc608){return new BPromise(function(_0x1e77b6,_0x16b2ba){return client[_0x594a('0xd')](_0xd9a859,_0x4dc608)[_0x594a('0xe')](function(_0x55977f){logger['info'](_0x594a('0xf'),_0x4904c7,_0x594a('0x10'));logger[_0x594a('0x11')](_0x594a('0x12'),_0x4904c7,_0x594a('0x10'),JSON[_0x594a('0x13')](_0x55977f));if(_0x55977f['error']){if(_0x55977f['error']['code']===0x1f4){logger[_0x594a('0x14')](_0x594a('0xf'),_0x4904c7,_0x55977f['error'][_0x594a('0x15')]);return _0x16b2ba(_0x55977f[_0x594a('0x14')][_0x594a('0x15')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x4904c7,_0x55977f[_0x594a('0x14')][_0x594a('0x15')]);return _0x1e77b6(_0x55977f[_0x594a('0x14')][_0x594a('0x15')]);}else{logger[_0x594a('0x16')](_0x594a('0xf'),_0x4904c7,_0x594a('0x10'));_0x1e77b6(_0x55977f[_0x594a('0x17')][_0x594a('0x15')]);}})[_0x594a('0x18')](function(_0x48e3c6){logger[_0x594a('0x14')]('FaxQueue,\x20%s,\x20%s',_0x4904c7,_0x48e3c6);_0x16b2ba(_0x48e3c6);});});}exports[_0x594a('0x19')]=function(_0x3580c9){var _0x5e85de=this;return new Promise(function(_0x335cf5,_0x122c2d){return db[_0x594a('0x1a')]['findAll']({'raw':_0x3580c9[_0x594a('0x1b')]?_0x3580c9[_0x594a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3580c9['options']?_0x3580c9[_0x594a('0x1b')][_0x594a('0x1c')]||null:null,'attributes':_0x3580c9[_0x594a('0x1b')]?_0x3580c9[_0x594a('0x1b')][_0x594a('0x1d')]||null:null,'limit':_0x3580c9[_0x594a('0x1b')]?_0x3580c9['options'][_0x594a('0x1e')]||null:null,'include':_0x3580c9['options']?_0x3580c9['options'][_0x594a('0x1f')]?_[_0x594a('0x20')](_0x3580c9['options'][_0x594a('0x1f')],function(_0x5430b3){return{'model':db[_0x5430b3[_0x594a('0x21')]],'as':_0x5430b3['as'],'attributes':_0x5430b3['attributes'],'include':_0x5430b3[_0x594a('0x1f')]?_[_0x594a('0x20')](_0x5430b3['include'],function(_0x4c0f99){return{'model':db[_0x4c0f99[_0x594a('0x21')]],'as':_0x4c0f99['as'],'attributes':_0x4c0f99['attributes'],'include':_0x4c0f99[_0x594a('0x1f')]?_[_0x594a('0x20')](_0x4c0f99[_0x594a('0x1f')],function(_0x365150){return{'model':db[_0x365150['model']],'as':_0x365150['as'],'attributes':_0x365150[_0x594a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x594a('0xe')](function(_0x315660){logger['info']('GetFaxQueue',_0x3580c9);logger[_0x594a('0x11')](_0x594a('0x19'),_0x3580c9,JSON[_0x594a('0x13')](_0x315660));_0x335cf5(_0x315660);})[_0x594a('0x18')](function(_0x3d9ef5){logger[_0x594a('0x14')](_0x594a('0x19'),_0x3d9ef5[_0x594a('0x15')],_0x3580c9);_0x122c2d(_0x5e85de[_0x594a('0x14')](0x1f4,_0x3d9ef5[_0x594a('0x15')]));});});};exports[_0x594a('0x22')]=function(_0x3ab323){var _0x566b95=this;return new Promise(function(_0x162a65,_0x392fd9){return db[_0x594a('0x1a')][_0x594a('0x23')]({'raw':_0x3ab323[_0x594a('0x1b')]?_0x3ab323[_0x594a('0x1b')][_0x594a('0x24')]===undefined?!![]:![]:!![],'where':_0x3ab323['options']?_0x3ab323[_0x594a('0x1b')][_0x594a('0x1c')]||null:null,'attributes':_0x3ab323[_0x594a('0x1b')]?_0x3ab323['options'][_0x594a('0x1d')]||null:null,'include':_0x3ab323[_0x594a('0x1b')]?_0x3ab323[_0x594a('0x1b')]['include']?_['map'](_0x3ab323[_0x594a('0x1b')][_0x594a('0x1f')],function(_0x3cd4f4){return{'model':db[_0x3cd4f4[_0x594a('0x21')]],'as':_0x3cd4f4['as'],'attributes':_0x3cd4f4[_0x594a('0x1d')],'include':_0x3cd4f4['include']?_[_0x594a('0x20')](_0x3cd4f4[_0x594a('0x1f')],function(_0x473fc6){return{'model':db[_0x473fc6[_0x594a('0x21')]],'as':_0x473fc6['as'],'attributes':_0x473fc6['attributes'],'include':_0x473fc6[_0x594a('0x1f')]?_[_0x594a('0x20')](_0x473fc6[_0x594a('0x1f')],function(_0x2964d6){return{'model':db[_0x2964d6[_0x594a('0x21')]],'as':_0x2964d6['as'],'attributes':_0x2964d6[_0x594a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x594a('0xe')](function(_0x227c44){logger[_0x594a('0x16')](_0x594a('0x22'),_0x3ab323);logger[_0x594a('0x11')](_0x594a('0x22'),_0x3ab323,JSON[_0x594a('0x13')](_0x227c44));_0x162a65(_0x227c44);})[_0x594a('0x18')](function(_0x4b3cfd){logger['error'](_0x594a('0x22'),_0x4b3cfd['message'],_0x3ab323);_0x392fd9(_0x566b95[_0x594a('0x14')](0x1f4,_0x4b3cfd[_0x594a('0x15')]));});});}; \ No newline at end of file +var _0xd2ba=['message','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFaxQueue','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x353332,_0xfa9f1c){var _0x278c39=function(_0x5d71d5){while(--_0x5d71d5){_0x353332['push'](_0x353332['shift']());}};_0x278c39(++_0xfa9f1c);}(_0xd2ba,0x19c));var _0xad2b=function(_0x1a662e,_0x4ee34b){_0x1a662e=_0x1a662e-0x0;var _0x58cd86=_0xd2ba[_0x1a662e];return _0x58cd86;};'use strict';var _=require(_0xad2b('0x0'));var util=require(_0xad2b('0x1'));var moment=require(_0xad2b('0x2'));var BPromise=require(_0xad2b('0x3'));var rs=require(_0xad2b('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xad2b('0x5'))('rpc');var config=require(_0xad2b('0x6'));var jayson=require(_0xad2b('0x7'));var client=jayson[_0xad2b('0x8')]['http']({'port':0x232a});var socket=require(_0xad2b('0x9'))({'host':_0xad2b('0xa'),'port':0x18eb});require(_0xad2b('0xb'))[_0xad2b('0xc')](socket);function respondWithRpcPromise(_0x5b5cd7,_0x56def5,_0x39375f){return new BPromise(function(_0x23424f,_0x5ba160){return client[_0xad2b('0xd')](_0x5b5cd7,_0x39375f)['then'](function(_0xb9c8cd){logger[_0xad2b('0xe')](_0xad2b('0xf'),_0x56def5,_0xad2b('0x10'));logger[_0xad2b('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x56def5,_0xad2b('0x10'),JSON[_0xad2b('0x12')](_0xb9c8cd));if(_0xb9c8cd[_0xad2b('0x13')]){if(_0xb9c8cd['error']['code']===0x1f4){logger['error'](_0xad2b('0xf'),_0x56def5,_0xb9c8cd[_0xad2b('0x13')][_0xad2b('0x14')]);return _0x5ba160(_0xb9c8cd[_0xad2b('0x13')][_0xad2b('0x14')]);}logger[_0xad2b('0x13')](_0xad2b('0xf'),_0x56def5,_0xb9c8cd['error'][_0xad2b('0x14')]);return _0x23424f(_0xb9c8cd['error'][_0xad2b('0x14')]);}else{logger['info'](_0xad2b('0xf'),_0x56def5,_0xad2b('0x10'));_0x23424f(_0xb9c8cd[_0xad2b('0x15')]['message']);}})[_0xad2b('0x16')](function(_0x599696){logger[_0xad2b('0x13')](_0xad2b('0xf'),_0x56def5,_0x599696);_0x5ba160(_0x599696);});});}exports['GetFaxQueue']=function(_0x501228){var _0x53601a=this;return new Promise(function(_0x521e88,_0x162c60){return db[_0xad2b('0x17')][_0xad2b('0x18')]({'raw':_0x501228[_0xad2b('0x19')]?_0x501228['options'][_0xad2b('0x1a')]===undefined?!![]:![]:!![],'where':_0x501228[_0xad2b('0x19')]?_0x501228[_0xad2b('0x19')][_0xad2b('0x1b')]||null:null,'attributes':_0x501228[_0xad2b('0x19')]?_0x501228['options'][_0xad2b('0x1c')]||null:null,'limit':_0x501228[_0xad2b('0x19')]?_0x501228[_0xad2b('0x19')][_0xad2b('0x1d')]||null:null,'include':_0x501228[_0xad2b('0x19')]?_0x501228[_0xad2b('0x19')][_0xad2b('0x1e')]?_[_0xad2b('0x1f')](_0x501228[_0xad2b('0x19')][_0xad2b('0x1e')],function(_0x349fe9){return{'model':db[_0x349fe9[_0xad2b('0x20')]],'as':_0x349fe9['as'],'attributes':_0x349fe9[_0xad2b('0x1c')],'include':_0x349fe9[_0xad2b('0x1e')]?_[_0xad2b('0x1f')](_0x349fe9[_0xad2b('0x1e')],function(_0x347f8f){return{'model':db[_0x347f8f['model']],'as':_0x347f8f['as'],'attributes':_0x347f8f['attributes'],'include':_0x347f8f[_0xad2b('0x1e')]?_[_0xad2b('0x1f')](_0x347f8f[_0xad2b('0x1e')],function(_0x1d8472){return{'model':db[_0x1d8472[_0xad2b('0x20')]],'as':_0x1d8472['as'],'attributes':_0x1d8472[_0xad2b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xad2b('0x21')](function(_0x4a9cf0){logger[_0xad2b('0xe')]('GetFaxQueue',_0x501228);logger[_0xad2b('0x11')](_0xad2b('0x22'),_0x501228,JSON[_0xad2b('0x12')](_0x4a9cf0));_0x521e88(_0x4a9cf0);})['catch'](function(_0xe72a95){logger[_0xad2b('0x13')]('GetFaxQueue',_0xe72a95[_0xad2b('0x14')],_0x501228);_0x162c60(_0x53601a[_0xad2b('0x13')](0x1f4,_0xe72a95[_0xad2b('0x14')]));});});};exports[_0xad2b('0x23')]=function(_0x5fdd7f){var _0x508d61=this;return new Promise(function(_0x9a45e3,_0x4c7393){return db[_0xad2b('0x17')]['find']({'raw':_0x5fdd7f[_0xad2b('0x19')]?_0x5fdd7f[_0xad2b('0x19')][_0xad2b('0x1a')]===undefined?!![]:![]:!![],'where':_0x5fdd7f[_0xad2b('0x19')]?_0x5fdd7f['options'][_0xad2b('0x1b')]||null:null,'attributes':_0x5fdd7f[_0xad2b('0x19')]?_0x5fdd7f['options']['attributes']||null:null,'include':_0x5fdd7f['options']?_0x5fdd7f[_0xad2b('0x19')][_0xad2b('0x1e')]?_[_0xad2b('0x1f')](_0x5fdd7f[_0xad2b('0x19')][_0xad2b('0x1e')],function(_0x10571d){return{'model':db[_0x10571d[_0xad2b('0x20')]],'as':_0x10571d['as'],'attributes':_0x10571d[_0xad2b('0x1c')],'include':_0x10571d[_0xad2b('0x1e')]?_[_0xad2b('0x1f')](_0x10571d[_0xad2b('0x1e')],function(_0x492ae5){return{'model':db[_0x492ae5[_0xad2b('0x20')]],'as':_0x492ae5['as'],'attributes':_0x492ae5[_0xad2b('0x1c')],'include':_0x492ae5[_0xad2b('0x1e')]?_['map'](_0x492ae5['include'],function(_0x19c739){return{'model':db[_0x19c739[_0xad2b('0x20')]],'as':_0x19c739['as'],'attributes':_0x19c739['attributes']};}):[]};}):[]};}):[]:[]})[_0xad2b('0x21')](function(_0x52eb1e){logger[_0xad2b('0xe')](_0xad2b('0x23'),_0x5fdd7f);logger['debug']('ShowFaxQueue',_0x5fdd7f,JSON[_0xad2b('0x12')](_0x52eb1e));_0x9a45e3(_0x52eb1e);})[_0xad2b('0x16')](function(_0x4e0938){logger[_0xad2b('0x13')](_0xad2b('0x23'),_0x4e0938['message'],_0x5fdd7f);_0x4c7393(_0x508d61[_0xad2b('0x13')](0x1f4,_0x4e0938['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b0bd41d..bea683c 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 _0xa2f5=['register','faxQueue:','save','update','emit'];(function(_0x11ce2f,_0x18a2a0){var _0x25fb22=function(_0x27b39b){while(--_0x27b39b){_0x11ce2f['push'](_0x11ce2f['shift']());}};_0x25fb22(++_0x18a2a0);}(_0xa2f5,0x1e2));var _0x5a2f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa2f5[_0x397e5f];return _0x5302b8;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5a2f('0x0'),'remove',_0x5a2f('0x1')];function createListener(_0x5f178c,_0x594c73){return function(_0x3e83d5){_0x594c73[_0x5a2f('0x2')](_0x5f178c,_0x3e83d5);};}function removeListener(_0x3cec43,_0x3a92e5){return function(){FaxQueueEvents['removeListener'](_0x3cec43,_0x3a92e5);};}exports[_0x5a2f('0x3')]=function(_0x161477){for(var _0x71c6b5=0x0,_0x55ba3f=events['length'];_0x71c6b5<_0x55ba3f;_0x71c6b5++){var _0x1def66=events[_0x71c6b5];var _0x28a3d1=createListener(_0x5a2f('0x4')+_0x1def66,_0x161477);FaxQueueEvents['on'](_0x1def66,_0x28a3d1);}}; \ No newline at end of file +var _0xd048=['emit','register','length','faxQueue:','./faxQueue.events','save','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd048,0x7b));var _0x8d04=function(_0x42cc51,_0x11a024){_0x42cc51=_0x42cc51-0x0;var _0x38180b=_0xd048[_0x42cc51];return _0x38180b;};'use strict';var FaxQueueEvents=require(_0x8d04('0x0'));var events=[_0x8d04('0x1'),'remove',_0x8d04('0x2')];function createListener(_0x4f5993,_0x3513ca){return function(_0x3f628a){_0x3513ca[_0x8d04('0x3')](_0x4f5993,_0x3f628a);};}function removeListener(_0x2e1eea,_0x12a65e){return function(){FaxQueueEvents['removeListener'](_0x2e1eea,_0x12a65e);};}exports[_0x8d04('0x4')]=function(_0x1dd469){for(var _0x4dae6c=0x0,_0x164ac3=events[_0x8d04('0x5')];_0x4dae6c<_0x164ac3;_0x4dae6c++){var _0x3bdf53=events[_0x4dae6c];var _0x2253a5=createListener(_0x8d04('0x6')+_0x3bdf53,_0x1dd469);FaxQueueEvents['on'](_0x3bdf53,_0x2253a5);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4ffee03..39de197 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 _0x4910=['update','delete','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put'];(function(_0x3ed8b4,_0x58407f){var _0x23fff3=function(_0x489076){while(--_0x489076){_0x3ed8b4['push'](_0x3ed8b4['shift']());}};_0x23fff3(++_0x58407f);}(_0x4910,0x1d9));var _0x0491=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4910[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x0491('0x0'));var util=require(_0x0491('0x1'));var path=require(_0x0491('0x2'));var express=require('express');var router=express[_0x0491('0x3')]();var auth=require(_0x0491('0x4'));var interaction=require(_0x0491('0x5'));var config=require(_0x0491('0x6'));var controller=require(_0x0491('0x7'));router['get']('/',auth[_0x0491('0x8')](),controller[_0x0491('0x9')]);router[_0x0491('0xa')](_0x0491('0xb'),auth[_0x0491('0x8')](),controller['describe']);router[_0x0491('0xa')](_0x0491('0xc'),auth[_0x0491('0x8')](),controller[_0x0491('0xd')]);router[_0x0491('0xa')]('/:id/members',auth[_0x0491('0x8')](),controller['getMembers']);router[_0x0491('0xa')](_0x0491('0xe'),auth[_0x0491('0x8')](),controller[_0x0491('0xf')]);router[_0x0491('0xa')](_0x0491('0x10'),auth[_0x0491('0x8')](),controller[_0x0491('0x11')]);router[_0x0491('0x12')]('/',auth[_0x0491('0x8')](),controller['create']);router[_0x0491('0x12')]('/:id/teams',auth[_0x0491('0x8')](),controller['addTeams']);router['post'](_0x0491('0x10'),auth[_0x0491('0x8')](),controller[_0x0491('0x13')]);router[_0x0491('0x14')](_0x0491('0xc'),auth[_0x0491('0x8')](),controller[_0x0491('0x15')]);router[_0x0491('0x16')](_0x0491('0xc'),auth[_0x0491('0x8')](),controller['destroy']);router[_0x0491('0x16')](_0x0491('0xe'),auth[_0x0491('0x8')](),controller[_0x0491('0x17')]);router[_0x0491('0x16')](_0x0491('0x10'),auth['isAuthenticated'](),controller[_0x0491('0x18')]);module[_0x0491('0x19')]=router; \ No newline at end of file +var _0x014c=['getMembers','/:id/teams','post','create','addTeams','put','update','delete','destroy','/:id/users','exports','util','express','Router','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members'];(function(_0x4e417b,_0x1071d2){var _0x2bef1e=function(_0x178bc8){while(--_0x178bc8){_0x4e417b['push'](_0x4e417b['shift']());}};_0x2bef1e(++_0x1071d2);}(_0x014c,0x17b));var _0xc014=function(_0x2967c1,_0x202a72){_0x2967c1=_0x2967c1-0x0;var _0x103397=_0x014c[_0x2967c1];return _0x103397;};'use strict';var multer=require('multer');var util=require(_0xc014('0x0'));var path=require('path');var express=require(_0xc014('0x1'));var router=express[_0xc014('0x2')]();var auth=require(_0xc014('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc014('0x4'));router[_0xc014('0x5')]('/',auth[_0xc014('0x6')](),controller[_0xc014('0x7')]);router[_0xc014('0x5')]('/describe',auth[_0xc014('0x6')](),controller[_0xc014('0x8')]);router['get'](_0xc014('0x9'),auth['isAuthenticated'](),controller[_0xc014('0xa')]);router[_0xc014('0x5')](_0xc014('0xb'),auth['isAuthenticated'](),controller[_0xc014('0xc')]);router[_0xc014('0x5')](_0xc014('0xd'),auth[_0xc014('0x6')](),controller['getTeams']);router[_0xc014('0x5')]('/:id/users',auth[_0xc014('0x6')](),controller['getAgents']);router[_0xc014('0xe')]('/',auth[_0xc014('0x6')](),controller[_0xc014('0xf')]);router[_0xc014('0xe')]('/:id/teams',auth[_0xc014('0x6')](),controller[_0xc014('0x10')]);router[_0xc014('0xe')]('/:id/users',auth[_0xc014('0x6')](),controller['addAgents']);router[_0xc014('0x11')](_0xc014('0x9'),auth[_0xc014('0x6')](),controller[_0xc014('0x12')]);router[_0xc014('0x13')](_0xc014('0x9'),auth['isAuthenticated'](),controller[_0xc014('0x14')]);router[_0xc014('0x13')](_0xc014('0xd'),auth[_0xc014('0x6')](),controller['removeTeams']);router['delete'](_0xc014('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc014('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1c61a47..d06645e 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 _0x2d6b=['moment','sequelize','exports','STRING','DATE'];(function(_0xadfd73,_0x2e7c94){var _0x3b14a1=function(_0x6d33aa){while(--_0x6d33aa){_0xadfd73['push'](_0xadfd73['shift']());}};_0x3b14a1(++_0x2e7c94);}(_0x2d6b,0x73));var _0xb2d6=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x2d6b[_0x1f36bb];return _0xaf97fa;};'use strict';var moment=require(_0xb2d6('0x0'));var Sequelize=require(_0xb2d6('0x1'));module[_0xb2d6('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb2d6('0x3')]},'joinAt':{'type':Sequelize[_0xb2d6('0x4')]},'leaveAt':{'type':Sequelize[_0xb2d6('0x4')]},'acceptAt':{'type':Sequelize[_0xb2d6('0x4')]},'exitAt':{'type':Sequelize[_0xb2d6('0x4')]},'reason':{'type':Sequelize[_0xb2d6('0x3')]}}; \ No newline at end of file +var _0xe060=['sequelize','exports','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe060,0xd6));var _0x0e06=function(_0x909f09,_0xc32308){_0x909f09=_0x909f09-0x0;var _0x792c65=_0xe060[_0x909f09];return _0x792c65;};'use strict';var moment=require(_0x0e06('0x0'));var Sequelize=require(_0x0e06('0x1'));module[_0x0e06('0x2')]={'uniqueid':{'type':Sequelize[_0x0e06('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0e06('0x3')]},'joinAt':{'type':Sequelize[_0x0e06('0x4')]},'leaveAt':{'type':Sequelize[_0x0e06('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0e06('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 155aefc..b81500a 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 _0xa8bb=['create','body','update','params','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','index','FaxQueueReport','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','add','day','merge','where','filter','include','show','length','includeAll','options','find','catch'];(function(_0x4b3300,_0x1137f1){var _0x2d26d3=function(_0x4678b5){while(--_0x4678b5){_0x4b3300['push'](_0x4b3300['shift']());}};_0x2d26d3(++_0x1137f1);}(_0xa8bb,0xda));var _0xba8b=function(_0x2f2e61,_0x4f877e){_0x2f2e61=_0x2f2e61-0x0;var _0x3d8a4d=_0xa8bb[_0x2f2e61];return _0x3d8a4d;};'use strict';var jsonpatch=require(_0xba8b('0x0'));var rp=require(_0xba8b('0x1'));var moment=require(_0xba8b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xba8b('0x3'));var util=require(_0xba8b('0x4'));var path=require(_0xba8b('0x5'));var sox=require(_0xba8b('0x6'));var csv=require(_0xba8b('0x7'));var ejs=require(_0xba8b('0x8'));var fs=require('fs');var _=require(_0xba8b('0x9'));var squel=require(_0xba8b('0xa'));var crypto=require(_0xba8b('0xb'));var jsforce=require(_0xba8b('0xc'));var deskjs=require(_0xba8b('0xd'));var toCsv=require(_0xba8b('0x7'));var querystring=require(_0xba8b('0xe'));var Papa=require(_0xba8b('0xf'));var qs=require(_0xba8b('0x10'));var logger=require(_0xba8b('0x11'))('api');var utils=require(_0xba8b('0x12'));var config=require(_0xba8b('0x13'));var db=require(_0xba8b('0x14'))['db'];function respondWithStatusCode(_0x33ce47,_0x1ec053){_0x1ec053=_0x1ec053||0xcc;return function(_0x397375){if(_0x397375){return _0x33ce47[_0xba8b('0x15')](_0x1ec053);}return _0x33ce47[_0xba8b('0x16')](_0x1ec053)[_0xba8b('0x17')]();};}function respondWithResult(_0x14efab,_0x4b3cf4){_0x4b3cf4=_0x4b3cf4||0xc8;return function(_0x36960e){if(_0x36960e){return _0x14efab['status'](_0x4b3cf4)['json'](_0x36960e);}};}function respondWithFilteredResult(_0x2db220,_0x2dab13){return function(_0x5c8a14){if(_0x5c8a14){var _0x2fe502=_0x5c8a14[_0xba8b('0x18')],_0x5f190d=_0x2dab13[_0xba8b('0x19')],_0x4b2aec=_0x2dab13['offset']+_0x2dab13[_0xba8b('0x1a')],_0x181c17;if(_0x4b2aec>=_0x2fe502){_0x4b2aec=_0x2fe502;_0x181c17=0xc8;}else{_0x181c17=0xce;}_0x2db220[_0xba8b('0x16')](_0x181c17);return _0x2db220[_0xba8b('0x1b')](_0xba8b('0x1c'),_0x5f190d+'-'+_0x4b2aec+'/'+_0x2fe502)[_0xba8b('0x1d')](_0x5c8a14);}return null;};}function patchUpdates(_0x215e5e){return function(_0x321308){try{jsonpatch[_0xba8b('0x1e')](_0x321308,_0x215e5e,!![]);}catch(_0x4706f8){return BPromise[_0xba8b('0x1f')](_0x4706f8);}return _0x321308['save']();};}function saveUpdates(_0x75049b,_0x14254d){return function(_0x4a1cf3){if(_0x4a1cf3){return _0x4a1cf3['update'](_0x75049b)['then'](function(_0x309947){return _0x309947;});}return null;};}function removeEntity(_0x4e2132,_0x3221c0){return function(_0x4319e5){if(_0x4319e5){return _0x4319e5[_0xba8b('0x20')]()[_0xba8b('0x21')](function(){_0x4e2132[_0xba8b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b892,_0x395cbb){return function(_0x3b548c){if(!_0x3b548c){_0x57b892['sendStatus'](0x194);}return _0x3b548c;};}function handleError(_0x50ad37,_0x51ac14){_0x51ac14=_0x51ac14||0x1f4;return function(_0x3625a8){logger[_0xba8b('0x22')](_0x3625a8[_0xba8b('0x23')]);if(_0x3625a8[_0xba8b('0x24')]){delete _0x3625a8['name'];}_0x50ad37[_0xba8b('0x16')](_0x51ac14)[_0xba8b('0x25')](_0x3625a8);};}exports[_0xba8b('0x26')]=function(_0x2e4885,_0x4430dc){var _0x33faa1={},_0x3b0352={},_0x5b3fee={'count':0x0,'rows':[]};var _0x59ec3e=db[_0xba8b('0x27')][_0xba8b('0x28')];_0x3b0352[_0xba8b('0x29')]=_['keys'](_0x59ec3e);var _0x1dd4db={'dateStart':_0x2e4885[_0xba8b('0x2a')][_0xba8b('0x2b')],'dateEnd':_0x2e4885[_0xba8b('0x2a')]['dateEnd']};delete _0x2e4885[_0xba8b('0x2a')][_0xba8b('0x2b')];delete _0x2e4885[_0xba8b('0x2a')][_0xba8b('0x2c')];_0x3b0352[_0xba8b('0x2a')]=_[_0xba8b('0x2d')](_0x2e4885[_0xba8b('0x2a')]);_0x3b0352['filters']=_[_0xba8b('0x2e')](_0x3b0352['model'],_0x3b0352[_0xba8b('0x2a')]);_0x33faa1[_0xba8b('0x2f')]=_[_0xba8b('0x2e')](_0x3b0352[_0xba8b('0x29')],qs[_0xba8b('0x30')](_0x2e4885['query'][_0xba8b('0x30')]));_0x33faa1['attributes']=_0x33faa1[_0xba8b('0x2f')]['length']?_0x33faa1['attributes']:_0x3b0352[_0xba8b('0x29')];if(!_0x2e4885['query'][_0xba8b('0x31')](_0xba8b('0x32'))){_0x33faa1[_0xba8b('0x1a')]=qs[_0xba8b('0x1a')](_0x2e4885[_0xba8b('0x2a')][_0xba8b('0x1a')]);_0x33faa1[_0xba8b('0x19')]=qs[_0xba8b('0x19')](_0x2e4885['query'][_0xba8b('0x19')]);}_0x33faa1[_0xba8b('0x33')]=qs[_0xba8b('0x34')](_0x2e4885[_0xba8b('0x2a')][_0xba8b('0x34')]);_0x33faa1['where']=qs[_0xba8b('0x35')](_['pick'](_0x2e4885[_0xba8b('0x2a')],_0x3b0352[_0xba8b('0x35')]));if(_0x1dd4db[_0xba8b('0x2b')]){if(_0x1dd4db[_0xba8b('0x2c')]){_0x1dd4db[_0xba8b('0x2c')]=moment(_0x1dd4db['dateEnd'])[_0xba8b('0x36')](0x1,_0xba8b('0x37'));}else{_0x1dd4db[_0xba8b('0x2c')]=moment(_0x1dd4db[_0xba8b('0x2b')])[_0xba8b('0x36')](0x1,_0xba8b('0x37'));}_[_0xba8b('0x38')](_0x33faa1[_0xba8b('0x39')],{'createdAt':{'$gte':_0x1dd4db[_0xba8b('0x2b')],'$lte':_0x1dd4db[_0xba8b('0x2c')]}});}if(_0x2e4885[_0xba8b('0x2a')][_0xba8b('0x3a')]){_0x33faa1[_0xba8b('0x39')]=_['merge'](_0x33faa1[_0xba8b('0x39')],{'$or':_['map'](_0x33faa1[_0xba8b('0x2f')],function(_0xb1e4b1){var _0xe677a7={};_0xe677a7[_0xb1e4b1]={'$like':'%'+_0x2e4885['query']['filter']+'%'};return _0xe677a7;})});}_0x33faa1=_['merge']({},_0x33faa1,_0x2e4885['options']);var _0x5c3356={'where':_0x33faa1[_0xba8b('0x39')]};return db[_0xba8b('0x27')][_0xba8b('0x18')](_0x5c3356)[_0xba8b('0x21')](function(_0x909a98){_0x5b3fee[_0xba8b('0x18')]=_0x909a98;if(_0x2e4885['query']['includeAll']){_0x33faa1[_0xba8b('0x3b')]=[{'all':!![]}];}return db[_0xba8b('0x27')]['findAll'](_0x33faa1);})[_0xba8b('0x21')](function(_0x59c807){_0x5b3fee['rows']=_0x59c807;return _0x5b3fee;})['then'](respondWithFilteredResult(_0x4430dc,_0x33faa1))['catch'](handleError(_0x4430dc,null));};exports[_0xba8b('0x3c')]=function(_0x5ea433,_0x14d2ac){var _0x291ad0={'raw':!![],'where':{'id':_0x5ea433['params']['id']}},_0x2d28bb={};_0x2d28bb[_0xba8b('0x29')]=_[_0xba8b('0x2d')](db['FaxQueueReport'][_0xba8b('0x28')]);_0x2d28bb['query']=_[_0xba8b('0x2d')](_0x5ea433[_0xba8b('0x2a')]);_0x2d28bb[_0xba8b('0x35')]=_['intersection'](_0x2d28bb[_0xba8b('0x29')],_0x2d28bb[_0xba8b('0x2a')]);_0x291ad0['attributes']=_[_0xba8b('0x2e')](_0x2d28bb[_0xba8b('0x29')],qs['fields'](_0x5ea433['query'][_0xba8b('0x30')]));_0x291ad0[_0xba8b('0x2f')]=_0x291ad0[_0xba8b('0x2f')][_0xba8b('0x3d')]?_0x291ad0[_0xba8b('0x2f')]:_0x2d28bb['model'];if(_0x5ea433[_0xba8b('0x2a')][_0xba8b('0x3e')]){_0x291ad0['include']=[{'all':!![]}];}_0x291ad0=_[_0xba8b('0x38')]({},_0x291ad0,_0x5ea433[_0xba8b('0x3f')]);return db[_0xba8b('0x27')][_0xba8b('0x40')](_0x291ad0)[_0xba8b('0x21')](handleEntityNotFound(_0x14d2ac,null))[_0xba8b('0x21')](respondWithResult(_0x14d2ac,null))[_0xba8b('0x41')](handleError(_0x14d2ac,null));};exports[_0xba8b('0x42')]=function(_0x36f890,_0x2418fe){return db[_0xba8b('0x27')][_0xba8b('0x42')](_0x36f890[_0xba8b('0x43')],{})[_0xba8b('0x21')](respondWithResult(_0x2418fe,0xc9))[_0xba8b('0x41')](handleError(_0x2418fe,null));};exports[_0xba8b('0x44')]=function(_0x620c96,_0x3cb9b4){if(_0x620c96[_0xba8b('0x43')]['id']){delete _0x620c96[_0xba8b('0x43')]['id'];}return db[_0xba8b('0x27')][_0xba8b('0x40')]({'where':{'id':_0x620c96['params']['id']}})[_0xba8b('0x21')](handleEntityNotFound(_0x3cb9b4,null))['then'](saveUpdates(_0x620c96[_0xba8b('0x43')],null))['then'](respondWithResult(_0x3cb9b4,null))[_0xba8b('0x41')](handleError(_0x3cb9b4,null));};exports['destroy']=function(_0x14a3cc,_0x30c18e){return db[_0xba8b('0x27')]['find']({'where':{'id':_0x14a3cc[_0xba8b('0x45')]['id']}})[_0xba8b('0x21')](handleEntityNotFound(_0x30c18e,null))[_0xba8b('0x21')](removeEntity(_0x30c18e,null))[_0xba8b('0x41')](handleError(_0x30c18e,null));};exports[_0xba8b('0x46')]=function(_0xea2732,_0x333de0){return db[_0xba8b('0x27')][_0xba8b('0x46')]()[_0xba8b('0x21')](respondWithResult(_0x333de0,null))[_0xba8b('0x41')](handleError(_0x333de0,null));}; \ No newline at end of file +var _0x15f7=['ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','FaxQueueReport','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','filter','where','map','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x15f7,0x1f2));var _0x715f=function(_0x5ea2f9,_0x320917){_0x5ea2f9=_0x5ea2f9-0x0;var _0x36e586=_0x15f7[_0x5ea2f9];return _0x36e586;};'use strict';var jsonpatch=require(_0x715f('0x0'));var rp=require(_0x715f('0x1'));var moment=require(_0x715f('0x2'));var BPromise=require(_0x715f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x715f('0x4'));var sox=require(_0x715f('0x5'));var csv=require('to-csv');var ejs=require(_0x715f('0x6'));var fs=require('fs');var _=require(_0x715f('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x715f('0x8'));var deskjs=require(_0x715f('0x9'));var toCsv=require(_0x715f('0xa'));var querystring=require(_0x715f('0xb'));var Papa=require(_0x715f('0xc'));var qs=require(_0x715f('0xd'));var logger=require(_0x715f('0xe'))(_0x715f('0xf'));var utils=require(_0x715f('0x10'));var config=require(_0x715f('0x11'));var db=require(_0x715f('0x12'))['db'];function respondWithStatusCode(_0x5c3ebb,_0x36e986){_0x36e986=_0x36e986||0xcc;return function(_0x134a32){if(_0x134a32){return _0x5c3ebb[_0x715f('0x13')](_0x36e986);}return _0x5c3ebb[_0x715f('0x14')](_0x36e986)[_0x715f('0x15')]();};}function respondWithResult(_0x348363,_0x84bc6){_0x84bc6=_0x84bc6||0xc8;return function(_0x30fb91){if(_0x30fb91){return _0x348363['status'](_0x84bc6)[_0x715f('0x16')](_0x30fb91);}};}function respondWithFilteredResult(_0x25468a,_0x593b00){return function(_0x32d090){if(_0x32d090){var _0x7708e0=_0x32d090[_0x715f('0x17')],_0x10502b=_0x593b00[_0x715f('0x18')],_0x52e64a=_0x593b00[_0x715f('0x18')]+_0x593b00[_0x715f('0x19')],_0x17dd91;if(_0x52e64a>=_0x7708e0){_0x52e64a=_0x7708e0;_0x17dd91=0xc8;}else{_0x17dd91=0xce;}_0x25468a[_0x715f('0x14')](_0x17dd91);return _0x25468a[_0x715f('0x1a')](_0x715f('0x1b'),_0x10502b+'-'+_0x52e64a+'/'+_0x7708e0)[_0x715f('0x16')](_0x32d090);}return null;};}function patchUpdates(_0x3bcc65){return function(_0x4954fa){try{jsonpatch[_0x715f('0x1c')](_0x4954fa,_0x3bcc65,!![]);}catch(_0x4d0464){return BPromise['reject'](_0x4d0464);}return _0x4954fa[_0x715f('0x1d')]();};}function saveUpdates(_0x6f656e,_0x25e105){return function(_0x106a3c){if(_0x106a3c){return _0x106a3c[_0x715f('0x1e')](_0x6f656e)[_0x715f('0x1f')](function(_0x3e2f3f){return _0x3e2f3f;});}return null;};}function removeEntity(_0x9aa6cf,_0x188540){return function(_0x350dc8){if(_0x350dc8){return _0x350dc8[_0x715f('0x20')]()[_0x715f('0x1f')](function(){_0x9aa6cf['status'](0xcc)[_0x715f('0x15')]();});}};}function handleEntityNotFound(_0x1dd831,_0x1a78f9){return function(_0xeea7f0){if(!_0xeea7f0){_0x1dd831['sendStatus'](0x194);}return _0xeea7f0;};}function handleError(_0x4ba7db,_0x58624e){_0x58624e=_0x58624e||0x1f4;return function(_0x3d41a3){logger['error'](_0x3d41a3[_0x715f('0x21')]);if(_0x3d41a3[_0x715f('0x22')]){delete _0x3d41a3[_0x715f('0x22')];}_0x4ba7db[_0x715f('0x14')](_0x58624e)[_0x715f('0x23')](_0x3d41a3);};}exports[_0x715f('0x24')]=function(_0x4c4e49,_0x8bf3ae){var _0x458b28={},_0x85fd8c={},_0x5ba1fc={'count':0x0,'rows':[]};var _0x210df3=db[_0x715f('0x25')][_0x715f('0x26')];_0x85fd8c['model']=_['keys'](_0x210df3);var _0xb51cad={'dateStart':_0x4c4e49[_0x715f('0x27')][_0x715f('0x28')],'dateEnd':_0x4c4e49['query'][_0x715f('0x29')]};delete _0x4c4e49[_0x715f('0x27')][_0x715f('0x28')];delete _0x4c4e49['query'][_0x715f('0x29')];_0x85fd8c[_0x715f('0x27')]=_[_0x715f('0x2a')](_0x4c4e49['query']);_0x85fd8c[_0x715f('0x2b')]=_[_0x715f('0x2c')](_0x85fd8c[_0x715f('0x2d')],_0x85fd8c[_0x715f('0x27')]);_0x458b28['attributes']=_[_0x715f('0x2c')](_0x85fd8c[_0x715f('0x2d')],qs[_0x715f('0x2e')](_0x4c4e49[_0x715f('0x27')]['fields']));_0x458b28['attributes']=_0x458b28[_0x715f('0x2f')]['length']?_0x458b28[_0x715f('0x2f')]:_0x85fd8c[_0x715f('0x2d')];if(!_0x4c4e49[_0x715f('0x27')][_0x715f('0x30')](_0x715f('0x31'))){_0x458b28[_0x715f('0x19')]=qs[_0x715f('0x19')](_0x4c4e49[_0x715f('0x27')][_0x715f('0x19')]);_0x458b28[_0x715f('0x18')]=qs[_0x715f('0x18')](_0x4c4e49[_0x715f('0x27')][_0x715f('0x18')]);}_0x458b28[_0x715f('0x32')]=qs[_0x715f('0x33')](_0x4c4e49['query']['sort']);_0x458b28['where']=qs[_0x715f('0x2b')](_[_0x715f('0x34')](_0x4c4e49['query'],_0x85fd8c[_0x715f('0x2b')]));if(_0xb51cad[_0x715f('0x28')]){if(_0xb51cad['dateEnd']){_0xb51cad[_0x715f('0x29')]=moment(_0xb51cad[_0x715f('0x29')])[_0x715f('0x35')](0x1,_0x715f('0x36'));}else{_0xb51cad[_0x715f('0x29')]=moment(_0xb51cad[_0x715f('0x28')])[_0x715f('0x35')](0x1,_0x715f('0x36'));}_[_0x715f('0x37')](_0x458b28['where'],{'createdAt':{'$gte':_0xb51cad[_0x715f('0x28')],'$lte':_0xb51cad['dateEnd']}});}if(_0x4c4e49[_0x715f('0x27')][_0x715f('0x38')]){_0x458b28[_0x715f('0x39')]=_[_0x715f('0x37')](_0x458b28[_0x715f('0x39')],{'$or':_[_0x715f('0x3a')](_0x458b28['attributes'],function(_0x39f547){var _0x1aa53d={};_0x1aa53d[_0x39f547]={'$like':'%'+_0x4c4e49['query']['filter']+'%'};return _0x1aa53d;})});}_0x458b28=_[_0x715f('0x37')]({},_0x458b28,_0x4c4e49[_0x715f('0x3b')]);var _0x34dbf9={'where':_0x458b28[_0x715f('0x39')]};return db[_0x715f('0x25')][_0x715f('0x17')](_0x34dbf9)[_0x715f('0x1f')](function(_0x2ff86e){_0x5ba1fc[_0x715f('0x17')]=_0x2ff86e;if(_0x4c4e49[_0x715f('0x27')][_0x715f('0x3c')]){_0x458b28[_0x715f('0x3d')]=[{'all':!![]}];}return db[_0x715f('0x25')][_0x715f('0x3e')](_0x458b28);})[_0x715f('0x1f')](function(_0x2b37a6){_0x5ba1fc[_0x715f('0x3f')]=_0x2b37a6;return _0x5ba1fc;})[_0x715f('0x1f')](respondWithFilteredResult(_0x8bf3ae,_0x458b28))['catch'](handleError(_0x8bf3ae,null));};exports[_0x715f('0x40')]=function(_0xfe848,_0x358dc3){var _0x5c4a9a={'raw':!![],'where':{'id':_0xfe848[_0x715f('0x41')]['id']}},_0x5dc9ca={};_0x5dc9ca[_0x715f('0x2d')]=_['keys'](db[_0x715f('0x25')]['rawAttributes']);_0x5dc9ca[_0x715f('0x27')]=_[_0x715f('0x2a')](_0xfe848['query']);_0x5dc9ca[_0x715f('0x2b')]=_[_0x715f('0x2c')](_0x5dc9ca[_0x715f('0x2d')],_0x5dc9ca[_0x715f('0x27')]);_0x5c4a9a['attributes']=_[_0x715f('0x2c')](_0x5dc9ca[_0x715f('0x2d')],qs[_0x715f('0x2e')](_0xfe848[_0x715f('0x27')]['fields']));_0x5c4a9a[_0x715f('0x2f')]=_0x5c4a9a['attributes'][_0x715f('0x42')]?_0x5c4a9a['attributes']:_0x5dc9ca[_0x715f('0x2d')];if(_0xfe848['query'][_0x715f('0x3c')]){_0x5c4a9a[_0x715f('0x3d')]=[{'all':!![]}];}_0x5c4a9a=_[_0x715f('0x37')]({},_0x5c4a9a,_0xfe848['options']);return db[_0x715f('0x25')][_0x715f('0x43')](_0x5c4a9a)[_0x715f('0x1f')](handleEntityNotFound(_0x358dc3,null))['then'](respondWithResult(_0x358dc3,null))[_0x715f('0x44')](handleError(_0x358dc3,null));};exports[_0x715f('0x45')]=function(_0x211625,_0x464fea){return db[_0x715f('0x25')][_0x715f('0x45')](_0x211625[_0x715f('0x46')],{})[_0x715f('0x1f')](respondWithResult(_0x464fea,0xc9))[_0x715f('0x44')](handleError(_0x464fea,null));};exports[_0x715f('0x1e')]=function(_0x1914ce,_0x39c892){if(_0x1914ce[_0x715f('0x46')]['id']){delete _0x1914ce['body']['id'];}return db[_0x715f('0x25')][_0x715f('0x43')]({'where':{'id':_0x1914ce[_0x715f('0x41')]['id']}})[_0x715f('0x1f')](handleEntityNotFound(_0x39c892,null))[_0x715f('0x1f')](saveUpdates(_0x1914ce[_0x715f('0x46')],null))['then'](respondWithResult(_0x39c892,null))[_0x715f('0x44')](handleError(_0x39c892,null));};exports[_0x715f('0x20')]=function(_0x5298ca,_0x3acb86){return db[_0x715f('0x25')][_0x715f('0x43')]({'where':{'id':_0x5298ca[_0x715f('0x41')]['id']}})[_0x715f('0x1f')](handleEntityNotFound(_0x3acb86,null))[_0x715f('0x1f')](removeEntity(_0x3acb86,null))[_0x715f('0x44')](handleError(_0x3acb86,null));};exports[_0x715f('0x47')]=function(_0x40daf3,_0x466398){return db[_0x715f('0x25')][_0x715f('0x47')]()[_0x715f('0x1f')](respondWithResult(_0x466398,null))[_0x715f('0x44')](handleError(_0x466398,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 7574257..d75e81a 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 _0x14f7=['lodash','moment','bluebird','request-promise','./faxQueueReport.attributes','define','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x17a599,_0x59d403){var _0x448c9d=function(_0x70f0b2){while(--_0x70f0b2){_0x17a599['push'](_0x17a599['shift']());}};_0x448c9d(++_0x59d403);}(_0x14f7,0x87));var _0x714f=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x14f7[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x714f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x714f('0x1'));var BPromise=require(_0x714f('0x2'));var rp=require(_0x714f('0x3'));var attributes=require(_0x714f('0x4'));module['exports']=function(_0x2b1bd3,_0x13d347){return _0x2b1bd3[_0x714f('0x5')](_0x714f('0x6'),attributes,{'tableName':_0x714f('0x7'),'paranoid':![],'indexes':[{'name':_0x714f('0x8'),'fields':[_0x714f('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6205=['request-promise','exports','define','report_fax_queue','uniqueid','lodash','util','api','bluebird'];(function(_0x2993e2,_0x2c5377){var _0x2a4680=function(_0x2f1e0b){while(--_0x2f1e0b){_0x2993e2['push'](_0x2993e2['shift']());}};_0x2a4680(++_0x2c5377);}(_0x6205,0x152));var _0x5620=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x6205[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x5620('0x0'));var util=require(_0x5620('0x1'));var logger=require('../../config/logger')(_0x5620('0x2'));var moment=require('moment');var BPromise=require(_0x5620('0x3'));var rp=require(_0x5620('0x4'));var attributes=require('./faxQueueReport.attributes');module[_0x5620('0x5')]=function(_0x7f0ad0,_0x37de20){return _0x7f0ad0[_0x5620('0x6')]('FaxQueueReport',attributes,{'tableName':_0x5620('0x7'),'paranoid':![],'indexes':[{'name':_0x5620('0x8'),'fields':[_0x5620('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e64ccb0..29270aa 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 _0x71a6=['create','body','options','raw','update','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport'];(function(_0xa44212,_0x1af18b){var _0x452d35=function(_0x17fe49){while(--_0x17fe49){_0xa44212['push'](_0xa44212['shift']());}};_0x452d35(++_0x1af18b);}(_0x71a6,0x108));var _0x671a=function(_0x5ec453,_0x30b0ba){_0x5ec453=_0x5ec453-0x0;var _0x25548f=_0x71a6[_0x5ec453];return _0x25548f;};'use strict';var _=require(_0x671a('0x0'));var util=require(_0x671a('0x1'));var moment=require(_0x671a('0x2'));var BPromise=require(_0x671a('0x3'));var rs=require(_0x671a('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x671a('0x5'));var logger=require(_0x671a('0x6'))(_0x671a('0x7'));var config=require(_0x671a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x671a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf21b0b,_0x354712,_0x5d1fb6){return new BPromise(function(_0x390638,_0x3690a6){return client[_0x671a('0xa')](_0xf21b0b,_0x5d1fb6)[_0x671a('0xb')](function(_0x339121){logger[_0x671a('0xc')](_0x671a('0xd'),_0x354712,_0x671a('0xe'));logger[_0x671a('0xf')](_0x671a('0x10'),_0x354712,_0x671a('0xe'),JSON[_0x671a('0x11')](_0x339121));if(_0x339121[_0x671a('0x12')]){if(_0x339121['error'][_0x671a('0x13')]===0x1f4){logger[_0x671a('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x354712,_0x339121[_0x671a('0x12')][_0x671a('0x14')]);return _0x3690a6(_0x339121['error'][_0x671a('0x14')]);}logger['error'](_0x671a('0xd'),_0x354712,_0x339121[_0x671a('0x12')]['message']);return _0x390638(_0x339121[_0x671a('0x12')][_0x671a('0x14')]);}else{logger['info'](_0x671a('0xd'),_0x354712,'request\x20sent');_0x390638(_0x339121['result'][_0x671a('0x14')]);}})[_0x671a('0x15')](function(_0x130cab){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x354712,_0x130cab);_0x3690a6(_0x130cab);});});}exports[_0x671a('0x16')]=function(_0x4ba604){var _0x364a06=this;return new Promise(function(_0x18579b,_0x35ef1f){return db[_0x671a('0x17')][_0x671a('0x18')](_0x4ba604[_0x671a('0x19')],{'raw':_0x4ba604[_0x671a('0x1a')]?_0x4ba604[_0x671a('0x1a')][_0x671a('0x1b')]===undefined?!![]:![]:!![]})[_0x671a('0xb')](function(_0x52374b){logger[_0x671a('0xc')](_0x671a('0x16'),_0x4ba604);logger[_0x671a('0xf')](_0x671a('0x16'),_0x4ba604,JSON[_0x671a('0x11')](_0x52374b));_0x18579b(_0x52374b);})['catch'](function(_0x259d7b){logger['error'](_0x671a('0x16'),_0x259d7b[_0x671a('0x14')],_0x4ba604);_0x35ef1f(_0x364a06[_0x671a('0x12')](0x1f4,_0x259d7b[_0x671a('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x50be23){var _0x5223d7=this;return new Promise(function(_0x220b37,_0x314121){return db[_0x671a('0x17')][_0x671a('0x1c')](_0x50be23[_0x671a('0x19')],{'raw':_0x50be23[_0x671a('0x1a')]?_0x50be23[_0x671a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50be23[_0x671a('0x1a')]?_0x50be23[_0x671a('0x1a')]['where']||null:null,'attributes':_0x50be23[_0x671a('0x1a')]?_0x50be23[_0x671a('0x1a')][_0x671a('0x1d')]||null:null,'limit':_0x50be23[_0x671a('0x1a')]?_0x50be23[_0x671a('0x1a')][_0x671a('0x1e')]||null:null})[_0x671a('0xb')](function(_0x5f3be5){logger[_0x671a('0xc')](_0x671a('0x1f'),_0x50be23);logger[_0x671a('0xf')]('UpdateFaxQueueReport',_0x50be23,JSON[_0x671a('0x11')](_0x5f3be5));_0x220b37(_0x5f3be5);})[_0x671a('0x15')](function(_0x518ecc){logger['error'](_0x671a('0x1f'),_0x518ecc['message'],_0x50be23);_0x314121(_0x5223d7[_0x671a('0x12')](0x1f4,_0x518ecc[_0x671a('0x14')]));});});}; \ No newline at end of file +var _0x204d=['request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','stringify','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s'];(function(_0x948e77,_0x10eb8c){var _0x379785=function(_0x4d6051){while(--_0x4d6051){_0x948e77['push'](_0x948e77['shift']());}};_0x379785(++_0x10eb8c);}(_0x204d,0x1f4));var _0xd204=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x204d[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0xd204('0x0'));var util=require(_0xd204('0x1'));var moment=require('moment');var BPromise=require(_0xd204('0x2'));var rs=require(_0xd204('0x3'));var fs=require('fs');var db=require(_0xd204('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd204('0x5'));var config=require(_0xd204('0x6'));var jayson=require(_0xd204('0x7'));var client=jayson[_0xd204('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x508f4c,_0x1661e5,_0x5ed5a2){return new BPromise(function(_0x26a10f,_0x5d8d8d){return client[_0xd204('0x9')](_0x508f4c,_0x5ed5a2)['then'](function(_0x2e363a){logger[_0xd204('0xa')](_0xd204('0xb'),_0x1661e5,_0xd204('0xc'));logger[_0xd204('0xd')](_0xd204('0xe'),_0x1661e5,'request\x20sent',JSON['stringify'](_0x2e363a));if(_0x2e363a[_0xd204('0xf')]){if(_0x2e363a['error']['code']===0x1f4){logger[_0xd204('0xf')](_0xd204('0xb'),_0x1661e5,_0x2e363a['error'][_0xd204('0x10')]);return _0x5d8d8d(_0x2e363a[_0xd204('0xf')]['message']);}logger[_0xd204('0xf')](_0xd204('0xb'),_0x1661e5,_0x2e363a[_0xd204('0xf')][_0xd204('0x10')]);return _0x26a10f(_0x2e363a['error']['message']);}else{logger[_0xd204('0xa')](_0xd204('0xb'),_0x1661e5,_0xd204('0xc'));_0x26a10f(_0x2e363a[_0xd204('0x11')][_0xd204('0x10')]);}})[_0xd204('0x12')](function(_0x1726bd){logger[_0xd204('0xf')](_0xd204('0xb'),_0x1661e5,_0x1726bd);_0x5d8d8d(_0x1726bd);});});}exports[_0xd204('0x13')]=function(_0x464619){var _0x451081=this;return new Promise(function(_0x282b25,_0xe7bdc9){return db[_0xd204('0x14')][_0xd204('0x15')](_0x464619[_0xd204('0x16')],{'raw':_0x464619['options']?_0x464619[_0xd204('0x17')][_0xd204('0x18')]===undefined?!![]:![]:!![]})[_0xd204('0x19')](function(_0x405e8b){logger['info'](_0xd204('0x13'),_0x464619);logger[_0xd204('0xd')](_0xd204('0x13'),_0x464619,JSON[_0xd204('0x1a')](_0x405e8b));_0x282b25(_0x405e8b);})['catch'](function(_0x2ec2e6){logger[_0xd204('0xf')](_0xd204('0x13'),_0x2ec2e6[_0xd204('0x10')],_0x464619);_0xe7bdc9(_0x451081[_0xd204('0xf')](0x1f4,_0x2ec2e6[_0xd204('0x10')]));});});};exports[_0xd204('0x1b')]=function(_0x3e7433){var _0x4d3405=this;return new Promise(function(_0x3ed2b5,_0xc9bf6){return db[_0xd204('0x14')][_0xd204('0x1c')](_0x3e7433[_0xd204('0x16')],{'raw':_0x3e7433[_0xd204('0x17')]?_0x3e7433[_0xd204('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e7433['options']?_0x3e7433[_0xd204('0x17')][_0xd204('0x1d')]||null:null,'attributes':_0x3e7433[_0xd204('0x17')]?_0x3e7433['options'][_0xd204('0x1e')]||null:null,'limit':_0x3e7433[_0xd204('0x17')]?_0x3e7433[_0xd204('0x17')][_0xd204('0x1f')]||null:null})[_0xd204('0x19')](function(_0xdc7038){logger['info'](_0xd204('0x1b'),_0x3e7433);logger['debug'](_0xd204('0x1b'),_0x3e7433,JSON[_0xd204('0x1a')](_0xdc7038));_0x3ed2b5(_0xdc7038);})['catch'](function(_0x3718f8){logger['error'](_0xd204('0x1b'),_0x3718f8[_0xd204('0x10')],_0x3e7433);_0xc9bf6(_0x4d3405['error'](0x1f4,_0x3718f8[_0xd204('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b71e43d..ed2cc6c 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 _0x32ce=['./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3fdcf6,_0x2fc65c){var _0x6348fd=function(_0x107b40){while(--_0x107b40){_0x3fdcf6['push'](_0x3fdcf6['shift']());}};_0x6348fd(++_0x2fc65c);}(_0x32ce,0xeb));var _0xe32c=function(_0x141dcc,_0x2e5d83){_0x141dcc=_0x141dcc-0x0;var _0x1bb3eb=_0x32ce[_0x141dcc];return _0x1bb3eb;};'use strict';var multer=require(_0xe32c('0x0'));var util=require('util');var path=require(_0xe32c('0x1'));var express=require(_0xe32c('0x2'));var router=express[_0xe32c('0x3')]();var auth=require(_0xe32c('0x4'));var interaction=require(_0xe32c('0x5'));var config=require(_0xe32c('0x6'));var controller=require(_0xe32c('0x7'));router[_0xe32c('0x8')]('/',auth['isAuthenticated'](),controller[_0xe32c('0x9')]);router['get'](_0xe32c('0xa'),auth[_0xe32c('0xb')](),controller[_0xe32c('0xc')]);router[_0xe32c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe32c('0xd')]);router[_0xe32c('0xe')]('/',auth[_0xe32c('0xb')](),controller[_0xe32c('0xf')]);router[_0xe32c('0x10')](_0xe32c('0x11'),auth[_0xe32c('0xb')](),controller[_0xe32c('0x12')]);router[_0xe32c('0x13')](_0xe32c('0x11'),auth[_0xe32c('0xb')](),controller[_0xe32c('0x14')]);module[_0xe32c('0x15')]=router; \ No newline at end of file +var _0x016d=['update','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x016d,0x12d));var _0xd016=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x016d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xd016('0x0'));var util=require('util');var path=require('path');var express=require(_0xd016('0x1'));var router=express['Router']();var auth=require(_0xd016('0x2'));var interaction=require(_0xd016('0x3'));var config=require(_0xd016('0x4'));var controller=require('./faxQueueReport.controller');router[_0xd016('0x5')]('/',auth[_0xd016('0x6')](),controller[_0xd016('0x7')]);router[_0xd016('0x5')](_0xd016('0x8'),auth[_0xd016('0x6')](),controller[_0xd016('0x9')]);router[_0xd016('0x5')](_0xd016('0xa'),auth[_0xd016('0x6')](),controller[_0xd016('0xb')]);router[_0xd016('0xc')]('/',auth[_0xd016('0x6')](),controller[_0xd016('0xd')]);router['put'](_0xd016('0xa'),auth[_0xd016('0x6')](),controller[_0xd016('0xe')]);router['delete'](_0xd016('0xa'),auth[_0xd016('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 96adfbc..83fd0ac 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 _0x7250=['account','queue','DATE','NOW','moment','exports','STRING'];(function(_0x2ffd94,_0x402a3e){var _0x939950=function(_0x3674ae){while(--_0x3674ae){_0x2ffd94['push'](_0x2ffd94['shift']());}};_0x939950(++_0x402a3e);}(_0x7250,0x89));var _0x0725=function(_0x12dc7e,_0x1428c6){_0x12dc7e=_0x12dc7e-0x0;var _0x513f17=_0x7250[_0x12dc7e];return _0x513f17;};'use strict';var moment=require(_0x0725('0x0'));var Sequelize=require('sequelize');module[_0x0725('0x1')]={'uniqueid':{'type':Sequelize[_0x0725('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0725('0x3'),'agent',_0x0725('0x4')),'allowNull':![],'defaultValue':_0x0725('0x4')},'transferredAt':{'type':Sequelize[_0x0725('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0725('0x6')]}}; \ No newline at end of file +var _0xb434=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x1f9afa,_0x210ff4){var _0x247ef0=function(_0x20841c){while(--_0x20841c){_0x1f9afa['push'](_0x1f9afa['shift']());}};_0x247ef0(++_0x210ff4);}(_0xb434,0x1b7));var _0x4b43=function(_0x564b0a,_0x4dd651){_0x564b0a=_0x564b0a-0x0;var _0x350a24=_0xb434[_0x564b0a];return _0x350a24;};'use strict';var moment=require(_0x4b43('0x0'));var Sequelize=require(_0x4b43('0x1'));module[_0x4b43('0x2')]={'uniqueid':{'type':Sequelize[_0x4b43('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4b43('0x4')](_0x4b43('0x5'),_0x4b43('0x6'),'queue'),'allowNull':![],'defaultValue':_0x4b43('0x7')},'transferredAt':{'type':Sequelize[_0x4b43('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x4b43('0x9')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 03f1ea5..c7015d4 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 _0x038f=['dateStart','dateEnd','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','add','day','filter','merge','map','FaxTransferReport','findAll','show','params','keys','includeAll','include','options','find','create','body','destroy','describe','catch','request-promise','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','rawAttributes','model','query'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x038f,0xe1));var _0xf038=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x038f[_0x65c50e];return _0x4573e7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xf038('0x0'));var moment=require(_0xf038('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf038('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0xf038('0x3'));var ejs=require(_0xf038('0x4'));var fs=require('fs');var _=require(_0xf038('0x5'));var squel=require(_0xf038('0x6'));var crypto=require(_0xf038('0x7'));var jsforce=require(_0xf038('0x8'));var deskjs=require(_0xf038('0x9'));var toCsv=require(_0xf038('0x3'));var querystring=require(_0xf038('0xa'));var Papa=require(_0xf038('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0xf038('0xc'))('api');var utils=require(_0xf038('0xd'));var config=require('../../config/environment');var db=require(_0xf038('0xe'))['db'];function respondWithStatusCode(_0x5bbbb8,_0x5bc82e){_0x5bc82e=_0x5bc82e||0xcc;return function(_0x42655b){if(_0x42655b){return _0x5bbbb8[_0xf038('0xf')](_0x5bc82e);}return _0x5bbbb8['status'](_0x5bc82e)[_0xf038('0x10')]();};}function respondWithResult(_0x2d0ad1,_0x2a2c01){_0x2a2c01=_0x2a2c01||0xc8;return function(_0x19fb5d){if(_0x19fb5d){return _0x2d0ad1[_0xf038('0x11')](_0x2a2c01)[_0xf038('0x12')](_0x19fb5d);}};}function respondWithFilteredResult(_0x44da91,_0x452966){return function(_0x351d29){if(_0x351d29){var _0x5d4abe=_0x351d29[_0xf038('0x13')],_0x548c4b=_0x452966[_0xf038('0x14')],_0x150a17=_0x452966[_0xf038('0x14')]+_0x452966[_0xf038('0x15')],_0x8de2a;if(_0x150a17>=_0x5d4abe){_0x150a17=_0x5d4abe;_0x8de2a=0xc8;}else{_0x8de2a=0xce;}_0x44da91[_0xf038('0x11')](_0x8de2a);return _0x44da91[_0xf038('0x16')](_0xf038('0x17'),_0x548c4b+'-'+_0x150a17+'/'+_0x5d4abe)[_0xf038('0x12')](_0x351d29);}return null;};}function patchUpdates(_0xd00508){return function(_0x3f771f){try{jsonpatch[_0xf038('0x18')](_0x3f771f,_0xd00508,!![]);}catch(_0x523377){return BPromise[_0xf038('0x19')](_0x523377);}return _0x3f771f['save']();};}function saveUpdates(_0x39255d,_0x50a737){return function(_0x8e55fd){if(_0x8e55fd){return _0x8e55fd[_0xf038('0x1a')](_0x39255d)['then'](function(_0x2a451b){return _0x2a451b;});}return null;};}function removeEntity(_0x265c47,_0x4bee53){return function(_0x1d10bd){if(_0x1d10bd){return _0x1d10bd['destroy']()[_0xf038('0x1b')](function(){_0x265c47[_0xf038('0x11')](0xcc)[_0xf038('0x10')]();});}};}function handleEntityNotFound(_0x4381d9,_0x5f59a8){return function(_0x923420){if(!_0x923420){_0x4381d9[_0xf038('0xf')](0x194);}return _0x923420;};}function handleError(_0x2d5f64,_0x361281){_0x361281=_0x361281||0x1f4;return function(_0x573e65){logger[_0xf038('0x1c')](_0x573e65[_0xf038('0x1d')]);if(_0x573e65[_0xf038('0x1e')]){delete _0x573e65[_0xf038('0x1e')];}_0x2d5f64[_0xf038('0x11')](_0x361281)[_0xf038('0x1f')](_0x573e65);};}exports['index']=function(_0x5b2f60,_0x5ee797){var _0x58782a={},_0x183cbc={},_0xf3df8f={'count':0x0,'rows':[]};var _0xf70b98=db['FaxTransferReport'][_0xf038('0x20')];_0x183cbc[_0xf038('0x21')]=_['keys'](_0xf70b98);var _0x16503e={'dateStart':_0x5b2f60[_0xf038('0x22')][_0xf038('0x23')],'dateEnd':_0x5b2f60[_0xf038('0x22')][_0xf038('0x24')]};delete _0x5b2f60[_0xf038('0x22')][_0xf038('0x23')];delete _0x5b2f60[_0xf038('0x22')][_0xf038('0x24')];_0x183cbc[_0xf038('0x22')]=_['keys'](_0x5b2f60[_0xf038('0x22')]);_0x183cbc['filters']=_[_0xf038('0x25')](_0x183cbc[_0xf038('0x21')],_0x183cbc[_0xf038('0x22')]);_0x58782a[_0xf038('0x26')]=_[_0xf038('0x25')](_0x183cbc[_0xf038('0x21')],qs[_0xf038('0x27')](_0x5b2f60[_0xf038('0x22')][_0xf038('0x27')]));_0x58782a[_0xf038('0x26')]=_0x58782a[_0xf038('0x26')][_0xf038('0x28')]?_0x58782a[_0xf038('0x26')]:_0x183cbc[_0xf038('0x21')];if(!_0x5b2f60[_0xf038('0x22')]['hasOwnProperty'](_0xf038('0x29'))){_0x58782a[_0xf038('0x15')]=qs[_0xf038('0x15')](_0x5b2f60[_0xf038('0x22')]['limit']);_0x58782a[_0xf038('0x14')]=qs[_0xf038('0x14')](_0x5b2f60[_0xf038('0x22')]['offset']);}_0x58782a['order']=qs[_0xf038('0x2a')](_0x5b2f60[_0xf038('0x22')][_0xf038('0x2a')]);_0x58782a[_0xf038('0x2b')]=qs[_0xf038('0x2c')](_[_0xf038('0x2d')](_0x5b2f60[_0xf038('0x22')],_0x183cbc[_0xf038('0x2c')]));if(_0x16503e[_0xf038('0x23')]){if(_0x16503e[_0xf038('0x24')]){_0x16503e['dateEnd']=moment(_0x16503e['dateEnd'])[_0xf038('0x2e')](0x1,_0xf038('0x2f'));}else{_0x16503e[_0xf038('0x24')]=moment(_0x16503e[_0xf038('0x23')])[_0xf038('0x2e')](0x1,'day');}_['merge'](_0x58782a['where'],{'createdAt':{'$gte':_0x16503e[_0xf038('0x23')],'$lte':_0x16503e[_0xf038('0x24')]}});}if(_0x5b2f60[_0xf038('0x22')][_0xf038('0x30')]){_0x58782a['where']=_[_0xf038('0x31')](_0x58782a[_0xf038('0x2b')],{'$or':_[_0xf038('0x32')](_0x58782a[_0xf038('0x26')],function(_0x2e6e8d){var _0x2c6b98={};_0x2c6b98[_0x2e6e8d]={'$like':'%'+_0x5b2f60['query'][_0xf038('0x30')]+'%'};return _0x2c6b98;})});}_0x58782a=_[_0xf038('0x31')]({},_0x58782a,_0x5b2f60['options']);var _0x6077db={'where':_0x58782a[_0xf038('0x2b')]};return db['FaxTransferReport']['count'](_0x6077db)[_0xf038('0x1b')](function(_0x33f701){_0xf3df8f['count']=_0x33f701;if(_0x5b2f60['query']['includeAll']){_0x58782a['include']=[{'all':!![]}];}return db[_0xf038('0x33')][_0xf038('0x34')](_0x58782a);})[_0xf038('0x1b')](function(_0x35f9a0){_0xf3df8f['rows']=_0x35f9a0;return _0xf3df8f;})[_0xf038('0x1b')](respondWithFilteredResult(_0x5ee797,_0x58782a))['catch'](handleError(_0x5ee797,null));};exports[_0xf038('0x35')]=function(_0x3098c0,_0x5ee626){var _0x2c29b0={'raw':!![],'where':{'id':_0x3098c0[_0xf038('0x36')]['id']}},_0x4c71fa={};_0x4c71fa[_0xf038('0x21')]=_['keys'](db[_0xf038('0x33')]['rawAttributes']);_0x4c71fa[_0xf038('0x22')]=_[_0xf038('0x37')](_0x3098c0[_0xf038('0x22')]);_0x4c71fa[_0xf038('0x2c')]=_[_0xf038('0x25')](_0x4c71fa[_0xf038('0x21')],_0x4c71fa[_0xf038('0x22')]);_0x2c29b0[_0xf038('0x26')]=_[_0xf038('0x25')](_0x4c71fa[_0xf038('0x21')],qs['fields'](_0x3098c0[_0xf038('0x22')]['fields']));_0x2c29b0['attributes']=_0x2c29b0[_0xf038('0x26')]['length']?_0x2c29b0[_0xf038('0x26')]:_0x4c71fa[_0xf038('0x21')];if(_0x3098c0['query'][_0xf038('0x38')]){_0x2c29b0[_0xf038('0x39')]=[{'all':!![]}];}_0x2c29b0=_[_0xf038('0x31')]({},_0x2c29b0,_0x3098c0[_0xf038('0x3a')]);return db['FaxTransferReport'][_0xf038('0x3b')](_0x2c29b0)[_0xf038('0x1b')](handleEntityNotFound(_0x5ee626,null))[_0xf038('0x1b')](respondWithResult(_0x5ee626,null))['catch'](handleError(_0x5ee626,null));};exports['create']=function(_0x54c1a5,_0x94e39d){return db[_0xf038('0x33')][_0xf038('0x3c')](_0x54c1a5[_0xf038('0x3d')],{})[_0xf038('0x1b')](respondWithResult(_0x94e39d,0xc9))['catch'](handleError(_0x94e39d,null));};exports[_0xf038('0x1a')]=function(_0x1c8213,_0x1fee06){if(_0x1c8213[_0xf038('0x3d')]['id']){delete _0x1c8213[_0xf038('0x3d')]['id'];}return db[_0xf038('0x33')][_0xf038('0x3b')]({'where':{'id':_0x1c8213[_0xf038('0x36')]['id']}})[_0xf038('0x1b')](handleEntityNotFound(_0x1fee06,null))[_0xf038('0x1b')](saveUpdates(_0x1c8213[_0xf038('0x3d')],null))[_0xf038('0x1b')](respondWithResult(_0x1fee06,null))['catch'](handleError(_0x1fee06,null));};exports[_0xf038('0x3e')]=function(_0x361530,_0x4506bd){return db[_0xf038('0x33')]['find']({'where':{'id':_0x361530['params']['id']}})[_0xf038('0x1b')](handleEntityNotFound(_0x4506bd,null))[_0xf038('0x1b')](removeEntity(_0x4506bd,null))['catch'](handleError(_0x4506bd,null));};exports[_0xf038('0x3f')]=function(_0x177fc1,_0x3906b3){return db[_0xf038('0x33')]['describe']()[_0xf038('0x1b')](respondWithResult(_0x3906b3,null))[_0xf038('0x40')](handleError(_0x3906b3,null));}; \ No newline at end of file +var _0xeb1c=['destroy','then','error','stack','name','index','FaxTransferReport','rawAttributes','model','keys','dateStart','dateEnd','query','filters','fields','attributes','length','nolimit','limit','order','sort','where','pick','add','day','merge','map','options','include','findAll','catch','show','intersection','includeAll','find','create','body','params','describe','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xeb1c,0x185));var _0xceb1=function(_0x4bd50f,_0x2c0078){_0x4bd50f=_0x4bd50f-0x0;var _0x572154=_0xeb1c[_0x4bd50f];return _0x572154;};'use strict';var jsonpatch=require(_0xceb1('0x0'));var rp=require(_0xceb1('0x1'));var moment=require(_0xceb1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xceb1('0x3'));var util=require('util');var path=require(_0xceb1('0x4'));var sox=require(_0xceb1('0x5'));var csv=require(_0xceb1('0x6'));var ejs=require(_0xceb1('0x7'));var fs=require('fs');var _=require(_0xceb1('0x8'));var squel=require('squel');var crypto=require(_0xceb1('0x9'));var jsforce=require(_0xceb1('0xa'));var deskjs=require(_0xceb1('0xb'));var toCsv=require(_0xceb1('0x6'));var querystring=require(_0xceb1('0xc'));var Papa=require(_0xceb1('0xd'));var qs=require(_0xceb1('0xe'));var logger=require('../../config/logger')(_0xceb1('0xf'));var utils=require(_0xceb1('0x10'));var config=require(_0xceb1('0x11'));var db=require(_0xceb1('0x12'))['db'];function respondWithStatusCode(_0x524010,_0x259a42){_0x259a42=_0x259a42||0xcc;return function(_0x2430df){if(_0x2430df){return _0x524010[_0xceb1('0x13')](_0x259a42);}return _0x524010[_0xceb1('0x14')](_0x259a42)[_0xceb1('0x15')]();};}function respondWithResult(_0x22345a,_0x414d2b){_0x414d2b=_0x414d2b||0xc8;return function(_0x2deb27){if(_0x2deb27){return _0x22345a['status'](_0x414d2b)[_0xceb1('0x16')](_0x2deb27);}};}function respondWithFilteredResult(_0x5cd337,_0x44b981){return function(_0x3d6475){if(_0x3d6475){var _0x279894=_0x3d6475[_0xceb1('0x17')],_0x3e536f=_0x44b981['offset'],_0x3568fe=_0x44b981[_0xceb1('0x18')]+_0x44b981['limit'],_0x525725;if(_0x3568fe>=_0x279894){_0x3568fe=_0x279894;_0x525725=0xc8;}else{_0x525725=0xce;}_0x5cd337[_0xceb1('0x14')](_0x525725);return _0x5cd337[_0xceb1('0x19')](_0xceb1('0x1a'),_0x3e536f+'-'+_0x3568fe+'/'+_0x279894)[_0xceb1('0x16')](_0x3d6475);}return null;};}function patchUpdates(_0xb4fe79){return function(_0x51778d){try{jsonpatch[_0xceb1('0x1b')](_0x51778d,_0xb4fe79,!![]);}catch(_0x1ff7a8){return BPromise[_0xceb1('0x1c')](_0x1ff7a8);}return _0x51778d[_0xceb1('0x1d')]();};}function saveUpdates(_0x3b250a,_0xf2300f){return function(_0x38c54e){if(_0x38c54e){return _0x38c54e[_0xceb1('0x1e')](_0x3b250a)['then'](function(_0x159c08){return _0x159c08;});}return null;};}function removeEntity(_0x12761b,_0x534813){return function(_0x5d0fa3){if(_0x5d0fa3){return _0x5d0fa3[_0xceb1('0x1f')]()[_0xceb1('0x20')](function(){_0x12761b[_0xceb1('0x14')](0xcc)[_0xceb1('0x15')]();});}};}function handleEntityNotFound(_0x1f1ee5,_0x5b0790){return function(_0xa24295){if(!_0xa24295){_0x1f1ee5[_0xceb1('0x13')](0x194);}return _0xa24295;};}function handleError(_0x36c5ac,_0x1e535a){_0x1e535a=_0x1e535a||0x1f4;return function(_0x538976){logger[_0xceb1('0x21')](_0x538976[_0xceb1('0x22')]);if(_0x538976['name']){delete _0x538976[_0xceb1('0x23')];}_0x36c5ac[_0xceb1('0x14')](_0x1e535a)['send'](_0x538976);};}exports[_0xceb1('0x24')]=function(_0x11735c,_0x590448){var _0x23a807={},_0x3ada0d={},_0x2f006f={'count':0x0,'rows':[]};var _0xe3d664=db[_0xceb1('0x25')][_0xceb1('0x26')];_0x3ada0d[_0xceb1('0x27')]=_[_0xceb1('0x28')](_0xe3d664);var _0x2d5d01={'dateStart':_0x11735c['query'][_0xceb1('0x29')],'dateEnd':_0x11735c['query'][_0xceb1('0x2a')]};delete _0x11735c[_0xceb1('0x2b')]['dateStart'];delete _0x11735c['query'][_0xceb1('0x2a')];_0x3ada0d[_0xceb1('0x2b')]=_[_0xceb1('0x28')](_0x11735c['query']);_0x3ada0d[_0xceb1('0x2c')]=_['intersection'](_0x3ada0d[_0xceb1('0x27')],_0x3ada0d[_0xceb1('0x2b')]);_0x23a807['attributes']=_['intersection'](_0x3ada0d[_0xceb1('0x27')],qs[_0xceb1('0x2d')](_0x11735c['query'][_0xceb1('0x2d')]));_0x23a807[_0xceb1('0x2e')]=_0x23a807['attributes'][_0xceb1('0x2f')]?_0x23a807[_0xceb1('0x2e')]:_0x3ada0d['model'];if(!_0x11735c[_0xceb1('0x2b')]['hasOwnProperty'](_0xceb1('0x30'))){_0x23a807[_0xceb1('0x31')]=qs['limit'](_0x11735c[_0xceb1('0x2b')][_0xceb1('0x31')]);_0x23a807[_0xceb1('0x18')]=qs['offset'](_0x11735c['query']['offset']);}_0x23a807[_0xceb1('0x32')]=qs[_0xceb1('0x33')](_0x11735c[_0xceb1('0x2b')][_0xceb1('0x33')]);_0x23a807[_0xceb1('0x34')]=qs[_0xceb1('0x2c')](_[_0xceb1('0x35')](_0x11735c['query'],_0x3ada0d[_0xceb1('0x2c')]));if(_0x2d5d01[_0xceb1('0x29')]){if(_0x2d5d01[_0xceb1('0x2a')]){_0x2d5d01[_0xceb1('0x2a')]=moment(_0x2d5d01[_0xceb1('0x2a')])[_0xceb1('0x36')](0x1,_0xceb1('0x37'));}else{_0x2d5d01[_0xceb1('0x2a')]=moment(_0x2d5d01[_0xceb1('0x29')])[_0xceb1('0x36')](0x1,_0xceb1('0x37'));}_[_0xceb1('0x38')](_0x23a807[_0xceb1('0x34')],{'createdAt':{'$gte':_0x2d5d01[_0xceb1('0x29')],'$lte':_0x2d5d01[_0xceb1('0x2a')]}});}if(_0x11735c['query']['filter']){_0x23a807[_0xceb1('0x34')]=_[_0xceb1('0x38')](_0x23a807[_0xceb1('0x34')],{'$or':_[_0xceb1('0x39')](_0x23a807[_0xceb1('0x2e')],function(_0x535f3e){var _0x327020={};_0x327020[_0x535f3e]={'$like':'%'+_0x11735c[_0xceb1('0x2b')]['filter']+'%'};return _0x327020;})});}_0x23a807=_[_0xceb1('0x38')]({},_0x23a807,_0x11735c[_0xceb1('0x3a')]);var _0x24e922={'where':_0x23a807[_0xceb1('0x34')]};return db[_0xceb1('0x25')][_0xceb1('0x17')](_0x24e922)[_0xceb1('0x20')](function(_0x42cbae){_0x2f006f[_0xceb1('0x17')]=_0x42cbae;if(_0x11735c[_0xceb1('0x2b')]['includeAll']){_0x23a807[_0xceb1('0x3b')]=[{'all':!![]}];}return db[_0xceb1('0x25')][_0xceb1('0x3c')](_0x23a807);})[_0xceb1('0x20')](function(_0x3efae5){_0x2f006f['rows']=_0x3efae5;return _0x2f006f;})[_0xceb1('0x20')](respondWithFilteredResult(_0x590448,_0x23a807))[_0xceb1('0x3d')](handleError(_0x590448,null));};exports[_0xceb1('0x3e')]=function(_0x382ac8,_0x30dda3){var _0x561808={'raw':!![],'where':{'id':_0x382ac8['params']['id']}},_0x5ed343={};_0x5ed343[_0xceb1('0x27')]=_['keys'](db['FaxTransferReport'][_0xceb1('0x26')]);_0x5ed343['query']=_[_0xceb1('0x28')](_0x382ac8[_0xceb1('0x2b')]);_0x5ed343[_0xceb1('0x2c')]=_[_0xceb1('0x3f')](_0x5ed343[_0xceb1('0x27')],_0x5ed343['query']);_0x561808['attributes']=_['intersection'](_0x5ed343[_0xceb1('0x27')],qs[_0xceb1('0x2d')](_0x382ac8[_0xceb1('0x2b')][_0xceb1('0x2d')]));_0x561808[_0xceb1('0x2e')]=_0x561808['attributes']['length']?_0x561808[_0xceb1('0x2e')]:_0x5ed343[_0xceb1('0x27')];if(_0x382ac8['query'][_0xceb1('0x40')]){_0x561808[_0xceb1('0x3b')]=[{'all':!![]}];}_0x561808=_[_0xceb1('0x38')]({},_0x561808,_0x382ac8[_0xceb1('0x3a')]);return db[_0xceb1('0x25')][_0xceb1('0x41')](_0x561808)['then'](handleEntityNotFound(_0x30dda3,null))[_0xceb1('0x20')](respondWithResult(_0x30dda3,null))['catch'](handleError(_0x30dda3,null));};exports[_0xceb1('0x42')]=function(_0x41f6c2,_0xc55583){return db[_0xceb1('0x25')][_0xceb1('0x42')](_0x41f6c2[_0xceb1('0x43')],{})['then'](respondWithResult(_0xc55583,0xc9))['catch'](handleError(_0xc55583,null));};exports['update']=function(_0x41546d,_0x28d486){if(_0x41546d[_0xceb1('0x43')]['id']){delete _0x41546d['body']['id'];}return db[_0xceb1('0x25')][_0xceb1('0x41')]({'where':{'id':_0x41546d[_0xceb1('0x44')]['id']}})['then'](handleEntityNotFound(_0x28d486,null))[_0xceb1('0x20')](saveUpdates(_0x41546d[_0xceb1('0x43')],null))['then'](respondWithResult(_0x28d486,null))[_0xceb1('0x3d')](handleError(_0x28d486,null));};exports[_0xceb1('0x1f')]=function(_0x513c5c,_0x49363b){return db[_0xceb1('0x25')][_0xceb1('0x41')]({'where':{'id':_0x513c5c[_0xceb1('0x44')]['id']}})[_0xceb1('0x20')](handleEntityNotFound(_0x49363b,null))[_0xceb1('0x20')](removeEntity(_0x49363b,null))['catch'](handleError(_0x49363b,null));};exports[_0xceb1('0x45')]=function(_0x444c78,_0x11c31f){return db['FaxTransferReport']['describe']()[_0xceb1('0x20')](respondWithResult(_0x11c31f,null))[_0xceb1('0x3d')](handleError(_0x11c31f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 909960b..dd8dbc4 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 _0xe3b7=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','request-promise','./faxTransferReport.attributes','exports','define'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe3b7,0x193));var _0x7e3b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xe3b7[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x7e3b('0x0'));var util=require('util');var logger=require(_0x7e3b('0x1'))(_0x7e3b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e3b('0x3'));var attributes=require(_0x7e3b('0x4'));module[_0x7e3b('0x5')]=function(_0x10cc6c,_0x44df04){return _0x10cc6c[_0x7e3b('0x6')](_0x7e3b('0x7'),attributes,{'tableName':_0x7e3b('0x8'),'paranoid':![],'indexes':[{'name':_0x7e3b('0x9'),'fields':[_0x7e3b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x741f=['define','FaxTransferReport','report_fax_transfer','lodash','util','moment','bluebird','request-promise'];(function(_0x57a35f,_0x3a8849){var _0x2a3cf1=function(_0x3f726f){while(--_0x3f726f){_0x57a35f['push'](_0x57a35f['shift']());}};_0x2a3cf1(++_0x3a8849);}(_0x741f,0x1c3));var _0xf741=function(_0x323c63,_0x4523b6){_0x323c63=_0x323c63-0x0;var _0x1033c2=_0x741f[_0x323c63];return _0x1033c2;};'use strict';var _=require(_0xf741('0x0'));var util=require(_0xf741('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf741('0x2'));var BPromise=require(_0xf741('0x3'));var rp=require(_0xf741('0x4'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x21ca50,_0x20a8e4){return _0x21ca50[_0xf741('0x5')](_0xf741('0x6'),attributes,{'tableName':_0xf741('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','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 50d7a4b..4cc6940 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 _0x92f4=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x28a744,_0x13f9fe){var _0x303542=function(_0x1b0754){while(--_0x1b0754){_0x28a744['push'](_0x28a744['shift']());}};_0x303542(++_0x13f9fe);}(_0x92f4,0x1ad));var _0x492f=function(_0x220a84,_0x506a90){_0x220a84=_0x220a84-0x0;var _0x5e207b=_0x92f4[_0x220a84];return _0x5e207b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x492f('0x0'));var BPromise=require(_0x492f('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x492f('0x2'));var logger=require(_0x492f('0x3'))(_0x492f('0x4'));var config=require(_0x492f('0x5'));var jayson=require(_0x492f('0x6'));var client=jayson['client'][_0x492f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x60cec4,_0x4cd718,_0x5892cd){return new BPromise(function(_0x335cca,_0x379b06){return client[_0x492f('0x8')](_0x60cec4,_0x5892cd)[_0x492f('0x9')](function(_0x10462b){logger[_0x492f('0xa')](_0x492f('0xb'),_0x4cd718,_0x492f('0xc'));logger[_0x492f('0xd')](_0x492f('0xe'),_0x4cd718,_0x492f('0xc'),JSON[_0x492f('0xf')](_0x10462b));if(_0x10462b[_0x492f('0x10')]){if(_0x10462b[_0x492f('0x10')][_0x492f('0x11')]===0x1f4){logger['error'](_0x492f('0xb'),_0x4cd718,_0x10462b[_0x492f('0x10')][_0x492f('0x12')]);return _0x379b06(_0x10462b['error'][_0x492f('0x12')]);}logger[_0x492f('0x10')](_0x492f('0xb'),_0x4cd718,_0x10462b[_0x492f('0x10')][_0x492f('0x12')]);return _0x335cca(_0x10462b[_0x492f('0x10')][_0x492f('0x12')]);}else{logger[_0x492f('0xa')](_0x492f('0xb'),_0x4cd718,_0x492f('0xc'));_0x335cca(_0x10462b['result']['message']);}})['catch'](function(_0x733622){logger[_0x492f('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x4cd718,_0x733622);_0x379b06(_0x733622);});});} \ No newline at end of file +var _0x1b05=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1b05,0x198));var _0x51b0=function(_0x67b653,_0x5b5bcf){_0x67b653=_0x67b653-0x0;var _0x18670a=_0x1b05[_0x67b653];return _0x18670a;};'use strict';var _=require(_0x51b0('0x0'));var util=require(_0x51b0('0x1'));var moment=require(_0x51b0('0x2'));var BPromise=require(_0x51b0('0x3'));var rs=require(_0x51b0('0x4'));var fs=require('fs');var db=require(_0x51b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x51b0('0x6'))(_0x51b0('0x7'));var config=require('../../config/environment');var jayson=require(_0x51b0('0x8'));var client=jayson['client'][_0x51b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x508beb,_0x24abc7,_0x31e9aa){return new BPromise(function(_0x5e62bc,_0x5f5888){return client[_0x51b0('0xa')](_0x508beb,_0x31e9aa)['then'](function(_0x5c4ef0){logger[_0x51b0('0xb')](_0x51b0('0xc'),_0x24abc7,_0x51b0('0xd'));logger[_0x51b0('0xe')](_0x51b0('0xf'),_0x24abc7,_0x51b0('0xd'),JSON['stringify'](_0x5c4ef0));if(_0x5c4ef0['error']){if(_0x5c4ef0['error'][_0x51b0('0x10')]===0x1f4){logger[_0x51b0('0x11')](_0x51b0('0xc'),_0x24abc7,_0x5c4ef0[_0x51b0('0x11')]['message']);return _0x5f5888(_0x5c4ef0[_0x51b0('0x11')][_0x51b0('0x12')]);}logger['error'](_0x51b0('0xc'),_0x24abc7,_0x5c4ef0['error']['message']);return _0x5e62bc(_0x5c4ef0['error'][_0x51b0('0x12')]);}else{logger[_0x51b0('0xb')](_0x51b0('0xc'),_0x24abc7,_0x51b0('0xd'));_0x5e62bc(_0x5c4ef0[_0x51b0('0x13')][_0x51b0('0x12')]);}})[_0x51b0('0x14')](function(_0x313885){logger[_0x51b0('0x11')](_0x51b0('0xc'),_0x24abc7,_0x313885);_0x5f5888(_0x313885);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e59a588..92ffb90 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 _0x8b7c=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy'];(function(_0x817faa,_0x361318){var _0x27452f=function(_0x3a0e60){while(--_0x3a0e60){_0x817faa['push'](_0x817faa['shift']());}};_0x27452f(++_0x361318);}(_0x8b7c,0x119));var _0xc8b7=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0x8b7c[_0x32a767];return _0x2b4e6d;};'use strict';var multer=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var path=require(_0xc8b7('0x2'));var express=require(_0xc8b7('0x3'));var router=express[_0xc8b7('0x4')]();var auth=require(_0xc8b7('0x5'));var interaction=require(_0xc8b7('0x6'));var config=require(_0xc8b7('0x7'));var controller=require('./faxTransferReport.controller');router[_0xc8b7('0x8')]('/',auth[_0xc8b7('0x9')](),controller[_0xc8b7('0xa')]);router['get'](_0xc8b7('0xb'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0xc')]);router[_0xc8b7('0x8')](_0xc8b7('0xd'),auth[_0xc8b7('0x9')](),controller['show']);router[_0xc8b7('0xe')]('/',auth['isAuthenticated'](),controller[_0xc8b7('0xf')]);router[_0xc8b7('0x10')](_0xc8b7('0xd'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc8b7('0x12')]);module[_0xc8b7('0x13')]=router; \ No newline at end of file +var _0x43f5=['isAuthenticated','index','/describe','/:id','show','post','create','multer','util','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x1483ca,_0x28a079){var _0x4b9088=function(_0x4a61d5){while(--_0x4a61d5){_0x1483ca['push'](_0x1483ca['shift']());}};_0x4b9088(++_0x28a079);}(_0x43f5,0x9d));var _0x543f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x43f5[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x543f('0x0'));var util=require(_0x543f('0x1'));var path=require('path');var express=require(_0x543f('0x2'));var router=express[_0x543f('0x3')]();var auth=require(_0x543f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x543f('0x5'));var controller=require(_0x543f('0x6'));router[_0x543f('0x7')]('/',auth[_0x543f('0x8')](),controller[_0x543f('0x9')]);router[_0x543f('0x7')](_0x543f('0xa'),auth[_0x543f('0x8')](),controller['describe']);router[_0x543f('0x7')](_0x543f('0xb'),auth[_0x543f('0x8')](),controller[_0x543f('0xc')]);router[_0x543f('0xd')]('/',auth['isAuthenticated'](),controller[_0x543f('0xe')]);router['put']('/:id',auth[_0x543f('0x8')](),controller['update']);router['delete'](_0x543f('0xb'),auth[_0x543f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 183cac4..4d1e252 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 _0xed1f=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','put','update'];(function(_0x451ea2,_0x1c3ce3){var _0x11cfb1=function(_0x103b48){while(--_0x103b48){_0x451ea2['push'](_0x451ea2['shift']());}};_0x11cfb1(++_0x1c3ce3);}(_0xed1f,0x6a));var _0xfed1=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xed1f[_0x26f702];return _0x11417d;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var express=require(_0xfed1('0x3'));var router=express[_0xfed1('0x4')]();var auth=require(_0xfed1('0x5'));var interaction=require(_0xfed1('0x6'));var config=require(_0xfed1('0x7'));var controller=require(_0xfed1('0x8'));router[_0xfed1('0x9')]('/',auth[_0xfed1('0xa')](),controller[_0xfed1('0xb')]);router[_0xfed1('0x9')](_0xfed1('0xc'),auth[_0xfed1('0xa')](),controller[_0xfed1('0xd')]);router[_0xfed1('0x9')](_0xfed1('0xe'),auth['isAuthenticated'](),controller[_0xfed1('0xf')]);router[_0xfed1('0x9')]('/:id/fields',auth[_0xfed1('0xa')](),controller[_0xfed1('0x10')]);router['post']('/',auth[_0xfed1('0xa')](),controller['create']);router[_0xfed1('0x11')](_0xfed1('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xfed1('0x12')](_0xfed1('0xc'),auth['isAuthenticated'](),controller[_0xfed1('0x13')]);router['delete']('/:id',auth[_0xfed1('0xa')](),controller[_0xfed1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9bde=['post','addConfiguration','put','update','destroy','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create'];(function(_0x24693e,_0x2ba888){var _0x53e672=function(_0x5f6cff){while(--_0x5f6cff){_0x24693e['push'](_0x24693e['shift']());}};_0x53e672(++_0x2ba888);}(_0x9bde,0xe1));var _0xe9bd=function(_0x27c356,_0x451252){_0x27c356=_0x27c356-0x0;var _0x59fddd=_0x9bde[_0x27c356];return _0x59fddd;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var express=require(_0xe9bd('0x1'));var router=express['Router']();var auth=require(_0xe9bd('0x2'));var interaction=require(_0xe9bd('0x3'));var config=require(_0xe9bd('0x4'));var controller=require(_0xe9bd('0x5'));router[_0xe9bd('0x6')]('/',auth[_0xe9bd('0x7')](),controller[_0xe9bd('0x8')]);router['get'](_0xe9bd('0x9'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x7')](),controller['getFields']);router['post']('/',auth[_0xe9bd('0x7')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/:id/configurations',auth[_0xe9bd('0x7')](),controller[_0xe9bd('0x10')]);router[_0xe9bd('0x11')](_0xe9bd('0x9'),auth['isAuthenticated'](),controller[_0xe9bd('0x12')]);router['delete'](_0xe9bd('0x9'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0x13')]);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 821bf61..2e67365 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 _0x72a2=['sequelize','exports','STRING','basic','ENUM','integrationTab'];(function(_0x1497b2,_0x22dff9){var _0x5046e6=function(_0x205776){while(--_0x205776){_0x1497b2['push'](_0x1497b2['shift']());}};_0x5046e6(++_0x22dff9);}(_0x72a2,0x10e));var _0x272a=function(_0x4c03c8,_0x233cf0){_0x4c03c8=_0x4c03c8-0x0;var _0x15f755=_0x72a2[_0x4c03c8];return _0x15f755;};'use strict';var Sequelize=require(_0x272a('0x0'));module[_0x272a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x272a('0x2')]},'username':{'type':Sequelize[_0x272a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x272a('0x3')),'defaultValue':_0x272a('0x3')},'password':{'type':Sequelize[_0x272a('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x272a('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x272a('0x2')]},'serverUrl':{'type':Sequelize[_0x272a('0x2')]},'type':{'type':Sequelize[_0x272a('0x4')](_0x272a('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4c70=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x26a503,_0xacc46){var _0x3ad3d3=function(_0x55d21a){while(--_0x55d21a){_0x26a503['push'](_0x26a503['shift']());}};_0x3ad3d3(++_0xacc46);}(_0x4c70,0x101));var _0x04c7=function(_0xbf8ec1,_0x9169c8){_0xbf8ec1=_0xbf8ec1-0x0;var _0xc84567=_0x4c70[_0xbf8ec1];return _0xc84567;};'use strict';var Sequelize=require(_0x04c7('0x0'));module[_0x04c7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x04c7('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x04c7('0x3')](_0x04c7('0x4')),'defaultValue':_0x04c7('0x4')},'password':{'type':Sequelize[_0x04c7('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x04c7('0x2')]},'tokenSecret':{'type':Sequelize[_0x04c7('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x04c7('0x5'),_0x04c7('0x6')),'defaultValue':_0x04c7('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1774fd8..a7db62a 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 _0xb972=['find','getConfigurations','findOne','DeskConfiguration','order','hasOwnProperty','AccountId','Subjects','getSubjects','channel','type','Descriptions','create','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','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','attributes','intersection','fields','length','nolimit','sort','where','pick','add','day','merge','filter','map','options','DeskAccount','includeAll','include','findAll','rows','show','params','body'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb972,0xa4));var _0x2b97=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0xb972[_0xf973b7];return _0x499087;};'use strict';var jsonpatch=require(_0x2b97('0x0'));var rp=require('request-promise');var moment=require(_0x2b97('0x1'));var BPromise=require(_0x2b97('0x2'));var Mustache=require(_0x2b97('0x3'));var util=require(_0x2b97('0x4'));var path=require(_0x2b97('0x5'));var sox=require(_0x2b97('0x6'));var csv=require(_0x2b97('0x7'));var ejs=require(_0x2b97('0x8'));var fs=require('fs');var _=require(_0x2b97('0x9'));var squel=require(_0x2b97('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2b97('0x7'));var querystring=require(_0x2b97('0xb'));var Papa=require(_0x2b97('0xc'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x2b97('0xd'));var config=require(_0x2b97('0xe'));var db=require(_0x2b97('0xf'))['db'];var integrations=require(_0x2b97('0x10'));var jayson=require(_0x2b97('0x11'));var client=jayson[_0x2b97('0x12')][_0x2b97('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x28223d,_0x599172,_0x4f0223,_0x1fb9db){return new BPromise(function(_0x5c92fd,_0x58a549){var _0x280390=_0x1fb9db||client;return _0x280390[_0x2b97('0x14')](_0x28223d,_0x4f0223)[_0x2b97('0x15')](function(_0x55353e){logger['info'](_0x2b97('0x16'),_0x599172,'request\x20sent');logger[_0x2b97('0x17')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x599172,_0x2b97('0x18'),JSON[_0x2b97('0x19')](_0x55353e));if(_0x55353e['error']){if(_0x55353e[_0x2b97('0x1a')]['code']===0x1f4){logger['error'](_0x2b97('0x16'),_0x599172,_0x55353e['error'][_0x2b97('0x1b')]);return _0x58a549(_0x55353e[_0x2b97('0x1a')]['message']);}logger[_0x2b97('0x1a')](_0x2b97('0x16'),_0x599172,_0x55353e['error'][_0x2b97('0x1b')]);return _0x5c92fd(_0x55353e[_0x2b97('0x1a')][_0x2b97('0x1b')]);}else{logger[_0x2b97('0x1c')](_0x2b97('0x16'),_0x599172,_0x2b97('0x18'));_0x5c92fd(_0x55353e[_0x2b97('0x1d')][_0x2b97('0x1b')]);}})[_0x2b97('0x1e')](function(_0x1f38b8){logger[_0x2b97('0x1a')](_0x2b97('0x16'),_0x599172,_0x1f38b8);_0x58a549(_0x1f38b8);});});}function respondWithStatusCode(_0x280371,_0xdb3a40){_0xdb3a40=_0xdb3a40||0xcc;return function(_0xa33251){if(_0xa33251){return _0x280371[_0x2b97('0x1f')](_0xdb3a40);}return _0x280371[_0x2b97('0x20')](_0xdb3a40)[_0x2b97('0x21')]();};}function respondWithResult(_0x464662,_0x5ce850){_0x5ce850=_0x5ce850||0xc8;return function(_0x40590d){if(_0x40590d){return _0x464662[_0x2b97('0x20')](_0x5ce850)[_0x2b97('0x22')](_0x40590d);}};}function respondWithFilteredResult(_0x5a63cf,_0x11c6dd){return function(_0x4bc699){if(_0x4bc699){var _0x2d3a2c=_0x4bc699[_0x2b97('0x23')],_0x3f84b4=_0x11c6dd[_0x2b97('0x24')],_0x1ddbc6=_0x11c6dd[_0x2b97('0x24')]+_0x11c6dd[_0x2b97('0x25')],_0x4de6f3;if(_0x1ddbc6>=_0x2d3a2c){_0x1ddbc6=_0x2d3a2c;_0x4de6f3=0xc8;}else{_0x4de6f3=0xce;}_0x5a63cf[_0x2b97('0x20')](_0x4de6f3);return _0x5a63cf[_0x2b97('0x26')](_0x2b97('0x27'),_0x3f84b4+'-'+_0x1ddbc6+'/'+_0x2d3a2c)[_0x2b97('0x22')](_0x4bc699);}return null;};}function patchUpdates(_0x1e5d7b){return function(_0x221cc4){try{jsonpatch[_0x2b97('0x28')](_0x221cc4,_0x1e5d7b,!![]);}catch(_0x26cea2){return BPromise[_0x2b97('0x29')](_0x26cea2);}return _0x221cc4[_0x2b97('0x2a')]();};}function saveUpdates(_0x4a0e85,_0x820f05){return function(_0x1d6e5f){if(_0x1d6e5f){return _0x1d6e5f[_0x2b97('0x2b')](_0x4a0e85)['then'](function(_0x43761a){return _0x43761a;});}return null;};}function removeEntity(_0x31bd38,_0x56740){return function(_0x559a9f){if(_0x559a9f){return _0x559a9f[_0x2b97('0x2c')]()[_0x2b97('0x15')](function(){_0x31bd38[_0x2b97('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x381b6c,_0x5bf888){return function(_0x52e5b7){if(!_0x52e5b7){_0x381b6c[_0x2b97('0x1f')](0x194);}return _0x52e5b7;};}function handleError(_0x4a3bbd,_0x52f010){_0x52f010=_0x52f010||0x1f4;return function(_0x55269b){logger[_0x2b97('0x1a')](_0x55269b[_0x2b97('0x2d')]);if(_0x55269b[_0x2b97('0x2e')]){delete _0x55269b['name'];}_0x4a3bbd[_0x2b97('0x20')](_0x52f010)[_0x2b97('0x2f')](_0x55269b);};}exports[_0x2b97('0x30')]=function(_0x393b61,_0xff5468){var _0x1ef585={},_0x41cbef={},_0xd42cd1={'count':0x0,'rows':[]};var _0xfc9240=db['DeskAccount'][_0x2b97('0x31')];_0x41cbef[_0x2b97('0x32')]=_[_0x2b97('0x33')](_0xfc9240);var _0x4c52a6={'dateStart':_0x393b61[_0x2b97('0x34')][_0x2b97('0x35')],'dateEnd':_0x393b61[_0x2b97('0x34')][_0x2b97('0x36')]};delete _0x393b61[_0x2b97('0x34')][_0x2b97('0x35')];delete _0x393b61['query']['dateEnd'];_0x41cbef[_0x2b97('0x34')]=_[_0x2b97('0x33')](_0x393b61[_0x2b97('0x34')]);_0x41cbef[_0x2b97('0x37')]=_['intersection'](_0x41cbef[_0x2b97('0x32')],_0x41cbef[_0x2b97('0x34')]);_0x1ef585[_0x2b97('0x38')]=_[_0x2b97('0x39')](_0x41cbef[_0x2b97('0x32')],qs[_0x2b97('0x3a')](_0x393b61[_0x2b97('0x34')]['fields']));_0x1ef585[_0x2b97('0x38')]=_0x1ef585[_0x2b97('0x38')][_0x2b97('0x3b')]?_0x1ef585[_0x2b97('0x38')]:_0x41cbef[_0x2b97('0x32')];if(!_0x393b61[_0x2b97('0x34')]['hasOwnProperty'](_0x2b97('0x3c'))){_0x1ef585[_0x2b97('0x25')]=qs[_0x2b97('0x25')](_0x393b61['query'][_0x2b97('0x25')]);_0x1ef585[_0x2b97('0x24')]=qs[_0x2b97('0x24')](_0x393b61[_0x2b97('0x34')][_0x2b97('0x24')]);}_0x1ef585['order']=qs[_0x2b97('0x3d')](_0x393b61[_0x2b97('0x34')][_0x2b97('0x3d')]);_0x1ef585[_0x2b97('0x3e')]=qs[_0x2b97('0x37')](_[_0x2b97('0x3f')](_0x393b61['query'],_0x41cbef['filters']));if(_0x4c52a6['dateStart']){if(_0x4c52a6['dateEnd']){_0x4c52a6[_0x2b97('0x36')]=moment(_0x4c52a6[_0x2b97('0x36')])[_0x2b97('0x40')](0x1,_0x2b97('0x41'));}else{_0x4c52a6['dateEnd']=moment(_0x4c52a6['dateStart'])[_0x2b97('0x40')](0x1,_0x2b97('0x41'));}_[_0x2b97('0x42')](_0x1ef585[_0x2b97('0x3e')],{'createdAt':{'$gte':_0x4c52a6[_0x2b97('0x35')],'$lte':_0x4c52a6['dateEnd']}});}if(_0x393b61[_0x2b97('0x34')][_0x2b97('0x43')]){_0x1ef585[_0x2b97('0x3e')]=_['merge'](_0x1ef585[_0x2b97('0x3e')],{'$or':_[_0x2b97('0x44')](_0x1ef585['attributes'],function(_0x441819){var _0x8c0497={};_0x8c0497[_0x441819]={'$like':'%'+_0x393b61[_0x2b97('0x34')][_0x2b97('0x43')]+'%'};return _0x8c0497;})});}_0x1ef585=_[_0x2b97('0x42')]({},_0x1ef585,_0x393b61[_0x2b97('0x45')]);var _0x35a755={'where':_0x1ef585[_0x2b97('0x3e')]};return db[_0x2b97('0x46')]['count'](_0x35a755)[_0x2b97('0x15')](function(_0x5342b7){_0xd42cd1[_0x2b97('0x23')]=_0x5342b7;if(_0x393b61[_0x2b97('0x34')][_0x2b97('0x47')]){_0x1ef585[_0x2b97('0x48')]=[{'all':!![]}];}return db['DeskAccount'][_0x2b97('0x49')](_0x1ef585);})[_0x2b97('0x15')](function(_0x508b2c){_0xd42cd1[_0x2b97('0x4a')]=_0x508b2c;return _0xd42cd1;})[_0x2b97('0x15')](respondWithFilteredResult(_0xff5468,_0x1ef585))[_0x2b97('0x1e')](handleError(_0xff5468,null));};exports[_0x2b97('0x4b')]=function(_0x1b5099,_0x5297a1){var _0xa112fc={'raw':![],'where':{'id':_0x1b5099[_0x2b97('0x4c')]['id']}},_0x2914fb={};_0x2914fb[_0x2b97('0x32')]=_[_0x2b97('0x33')](db[_0x2b97('0x46')][_0x2b97('0x31')]);_0x2914fb['query']=_['keys'](_0x1b5099[_0x2b97('0x34')]);_0x2914fb[_0x2b97('0x37')]=_[_0x2b97('0x39')](_0x2914fb['model'],_0x2914fb[_0x2b97('0x34')]);_0xa112fc['attributes']=_['intersection'](_0x2914fb[_0x2b97('0x32')],qs[_0x2b97('0x3a')](_0x1b5099[_0x2b97('0x34')][_0x2b97('0x3a')]));_0xa112fc[_0x2b97('0x38')]=_0xa112fc[_0x2b97('0x38')][_0x2b97('0x3b')]?_0xa112fc[_0x2b97('0x38')]:_0x2914fb[_0x2b97('0x32')];if(_0x1b5099['query']['includeAll']){_0xa112fc['include']=[{'all':!![]}];}_0xa112fc=_['merge']({},_0xa112fc,_0x1b5099[_0x2b97('0x45')]);return db[_0x2b97('0x46')]['find'](_0xa112fc)[_0x2b97('0x15')](handleEntityNotFound(_0x5297a1,null))[_0x2b97('0x15')](respondWithResult(_0x5297a1,null))[_0x2b97('0x1e')](handleError(_0x5297a1,null));};exports['create']=function(_0x482eaf,_0xdba26){return db[_0x2b97('0x46')]['create'](_0x482eaf[_0x2b97('0x4d')],{})['then'](respondWithResult(_0xdba26,0xc9))[_0x2b97('0x1e')](handleError(_0xdba26,null));};exports['update']=function(_0x34ae65,_0x21e565){if(_0x34ae65[_0x2b97('0x4d')]['id']){delete _0x34ae65[_0x2b97('0x4d')]['id'];}return db['DeskAccount'][_0x2b97('0x4e')]({'where':{'id':_0x34ae65[_0x2b97('0x4c')]['id']}})[_0x2b97('0x15')](handleEntityNotFound(_0x21e565,null))[_0x2b97('0x15')](saveUpdates(_0x34ae65[_0x2b97('0x4d')],null))[_0x2b97('0x15')](respondWithResult(_0x21e565,null))[_0x2b97('0x1e')](handleError(_0x21e565,null));};exports[_0x2b97('0x2c')]=function(_0x29a1be,_0x5babe8){return db[_0x2b97('0x46')]['find']({'where':{'id':_0x29a1be['params']['id']}})[_0x2b97('0x15')](handleEntityNotFound(_0x5babe8,null))[_0x2b97('0x15')](removeEntity(_0x5babe8,null))[_0x2b97('0x1e')](handleError(_0x5babe8,null));};exports[_0x2b97('0x4f')]=function(_0x411218,_0x372861,_0x3d8b0e){var _0xfbd8bf={};var _0x2467a2={};var _0x5c31b2;var _0x1a5b61;return db[_0x2b97('0x46')][_0x2b97('0x50')]({'where':{'id':_0x411218[_0x2b97('0x4c')]['id']}})[_0x2b97('0x15')](handleEntityNotFound(_0x372861,null))['then'](function(_0x88c5df){if(_0x88c5df){_0x5c31b2=_0x88c5df;_0x2467a2['model']=_[_0x2b97('0x33')](db[_0x2b97('0x51')][_0x2b97('0x31')]);_0x2467a2[_0x2b97('0x34')]=_[_0x2b97('0x33')](_0x411218[_0x2b97('0x34')]);_0x2467a2[_0x2b97('0x37')]=_[_0x2b97('0x39')](_0x2467a2['model'],_0x2467a2[_0x2b97('0x34')]);_0xfbd8bf[_0x2b97('0x38')]=_[_0x2b97('0x39')](_0x2467a2[_0x2b97('0x32')],qs[_0x2b97('0x3a')](_0x411218[_0x2b97('0x34')][_0x2b97('0x3a')]));_0xfbd8bf[_0x2b97('0x38')]=_0xfbd8bf[_0x2b97('0x38')]['length']?_0xfbd8bf[_0x2b97('0x38')]:_0x2467a2[_0x2b97('0x32')];_0xfbd8bf[_0x2b97('0x52')]=qs[_0x2b97('0x3d')](_0x411218[_0x2b97('0x34')][_0x2b97('0x3d')]);_0xfbd8bf[_0x2b97('0x3e')]=qs[_0x2b97('0x37')](_[_0x2b97('0x3f')](_0x411218[_0x2b97('0x34')],_0x2467a2[_0x2b97('0x37')]));if(_0x411218[_0x2b97('0x34')][_0x2b97('0x43')]){_0xfbd8bf[_0x2b97('0x3e')]=_[_0x2b97('0x42')](_0xfbd8bf[_0x2b97('0x3e')],{'$or':_['map'](_0xfbd8bf[_0x2b97('0x38')],function(_0x32ec65){var _0x46ee1c={};_0x46ee1c[_0x32ec65]={'$like':'%'+_0x411218[_0x2b97('0x34')][_0x2b97('0x43')]+'%'};return _0x46ee1c;})});}_0xfbd8bf=_[_0x2b97('0x42')]({},_0xfbd8bf,_0x411218[_0x2b97('0x45')]);return _0x5c31b2['getConfigurations'](_0xfbd8bf);}})['then'](function(_0x45db44){if(_0x45db44){_0x1a5b61=_0x45db44[_0x2b97('0x3b')];if(!_0x411218[_0x2b97('0x34')][_0x2b97('0x53')](_0x2b97('0x3c'))){_0xfbd8bf[_0x2b97('0x25')]=qs['limit'](_0x411218[_0x2b97('0x34')][_0x2b97('0x25')]);_0xfbd8bf[_0x2b97('0x24')]=qs[_0x2b97('0x24')](_0x411218[_0x2b97('0x34')][_0x2b97('0x24')]);}return _0x5c31b2[_0x2b97('0x4f')](_0xfbd8bf);}})[_0x2b97('0x15')](function(_0x5243c6){if(_0x5243c6){return _0x5243c6?{'count':_0x1a5b61,'rows':_0x5243c6}:null;}})[_0x2b97('0x15')](respondWithResult(_0x372861,null))[_0x2b97('0x1e')](handleError(_0x372861,null));};exports['addConfiguration']=function(_0x3399e4,_0x384b8e,_0x16fe32){if(_0x3399e4[_0x2b97('0x4d')]['id']){delete _0x3399e4[_0x2b97('0x4d')]['id'];}return db[_0x2b97('0x46')]['findOne']({'where':{'id':_0x3399e4[_0x2b97('0x4c')]['id']}})[_0x2b97('0x15')](handleEntityNotFound(_0x384b8e,null))[_0x2b97('0x15')](function(_0x3998f7){if(_0x3998f7){_0x3399e4['body'][_0x2b97('0x54')]=_0x3998f7['id'];_0x3399e4[_0x2b97('0x4d')][_0x2b97('0x55')]=integrations[_0x2b97('0x56')](_0x3399e4[_0x2b97('0x4d')][_0x2b97('0x57')],_0x3399e4[_0x2b97('0x4d')][_0x2b97('0x58')]);_0x3399e4['body'][_0x2b97('0x59')]=integrations['getDescriptions'](_0x3399e4[_0x2b97('0x4d')]['channel'],_0x3399e4[_0x2b97('0x4d')][_0x2b97('0x58')]);return db['DeskConfiguration'][_0x2b97('0x5a')](_0x3399e4[_0x2b97('0x4d')],{'include':[{'model':db[_0x2b97('0x5b')],'as':_0x2b97('0x55')},{'model':db[_0x2b97('0x5b')],'as':_0x2b97('0x59')}]});}return null;})[_0x2b97('0x15')](respondWithResult(_0x384b8e,null))[_0x2b97('0x1e')](handleError(_0x384b8e,null));};exports[_0x2b97('0x5c')]=function(_0x1fbd49,_0x52b0e0,_0x30fd21){var _0x4e6db1=[{'name':_0x2b97('0x5d'),'label':_0x2b97('0x5d'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];return db['DeskAccount'][_0x2b97('0x50')]({'where':{'id':_0x1fbd49[_0x2b97('0x4c')]['id']},'attributes':['id',_0x2b97('0x5e'),_0x2b97('0x5f'),_0x2b97('0x60'),_0x2b97('0x61'),'consumerKey',_0x2b97('0x62'),_0x2b97('0x63'),_0x2b97('0x64')]})[_0x2b97('0x15')](handleEntityNotFound(_0x52b0e0,null))['then'](function(_0x3b4bb4){if(_0x3b4bb4){var _0x18d536={'method':_0x2b97('0x65'),'uri':util[_0x2b97('0x66')](_0x2b97('0x67'),_0x3b4bb4[_0x2b97('0x5e')]),'headers':{'Content-Type':_0x2b97('0x68'),'Accept':_0x2b97('0x68')},'json':!![]};if(_0x3b4bb4['authType']===_0x2b97('0x69')){_0x18d536[_0x2b97('0x6a')][_0x2b97('0x6b')]=util['format'](_0x2b97('0x6c'),new Buffer(util['format'](_0x2b97('0x6d'),_0x3b4bb4[_0x2b97('0x60')],_0x3b4bb4[_0x2b97('0x61')]))[_0x2b97('0x6e')](_0x2b97('0x6f')));}return rp(_0x18d536)[_0x2b97('0x15')](function(_0x125d89){return _0x4e6db1[_0x2b97('0x70')](_[_0x2b97('0x44')](_0x125d89[_0x2b97('0x71')][_0x2b97('0x72')],function(_0x3f97b4){return{'id':_0x3f97b4[_0x2b97('0x2e')],'name':_0x3f97b4[_0x2b97('0x2e')],'type':_0x3f97b4[_0x2b97('0x58')],'active':_0x3f97b4[_0x2b97('0x73')],'label':_0x3f97b4[_0x2b97('0x74')],'custom':!![]};}));});}})[_0x2b97('0x15')](function(_0x319b7a){return{'count':_0x319b7a[_0x2b97('0x3b')],'rows':_0x319b7a};})[_0x2b97('0x15')](respondWithResult(_0x52b0e0,null))['catch'](function(_0x50e4d5){var _0x4e3a0d=_0x1fbd49[_0x2b97('0x34')]['test']?0x1f4:_0x50e4d5['statusCode']||0x1f4;logger[_0x2b97('0x1a')](_0x2b97('0x75'),'getFields',_0x4e3a0d,JSON[_0x2b97('0x19')](_0x50e4d5));delete _0x50e4d5[_0x2b97('0x2e')];if(_0x4e3a0d===0x191){_0x4e3a0d=0x190;}_0x52b0e0['status'](_0x4e3a0d)[_0x2b97('0x2f')](_0x1fbd49['query'][_0x2b97('0x76')]?{'message':_0x2b97('0x77'),'statusCode':_0x50e4d5[_0x2b97('0x78')]}:_0x50e4d5);});}; \ No newline at end of file +var _0x9904=['getDescriptions','create','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','GET','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','password','base64','concat','_embedded','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','name','index','DeskAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','nolimit','sort','where','pick','day','add','merge','filter','options','includeAll','include','findAll','rows','params','intersection','length','find','body','update','findOne','order','map','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','type'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x9904,0x105));var _0x4990=function(_0x2f3fd7,_0x10fcf7){_0x2f3fd7=_0x2f3fd7-0x0;var _0x526d8d=_0x9904[_0x2f3fd7];return _0x526d8d;};'use strict';var jsonpatch=require(_0x4990('0x0'));var rp=require(_0x4990('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4990('0x2'));var util=require('util');var path=require(_0x4990('0x3'));var sox=require(_0x4990('0x4'));var csv=require(_0x4990('0x5'));var ejs=require(_0x4990('0x6'));var fs=require('fs');var _=require(_0x4990('0x7'));var squel=require(_0x4990('0x8'));var crypto=require(_0x4990('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4990('0xa'));var toCsv=require(_0x4990('0x5'));var querystring=require(_0x4990('0xb'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4990('0xc'));var utils=require(_0x4990('0xd'));var config=require('../../config/environment');var db=require(_0x4990('0xe'))['db'];var integrations=require(_0x4990('0xf'));var jayson=require('jayson/promise');var client=jayson[_0x4990('0x10')][_0x4990('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x529a17,_0x5acd83,_0x281af2,_0x1b46c3){return new BPromise(function(_0x5e6edf,_0x3ea08f){var _0x428937=_0x1b46c3||client;return _0x428937[_0x4990('0x12')](_0x529a17,_0x281af2)['then'](function(_0x4e67ee){logger[_0x4990('0x13')]('DeskAccount,\x20%s,\x20%s',_0x5acd83,_0x4990('0x14'));logger[_0x4990('0x15')](_0x4990('0x16'),_0x5acd83,_0x4990('0x14'),JSON[_0x4990('0x17')](_0x4e67ee));if(_0x4e67ee[_0x4990('0x18')]){if(_0x4e67ee['error'][_0x4990('0x19')]===0x1f4){logger[_0x4990('0x18')](_0x4990('0x1a'),_0x5acd83,_0x4e67ee['error']['message']);return _0x3ea08f(_0x4e67ee[_0x4990('0x18')]['message']);}logger[_0x4990('0x18')](_0x4990('0x1a'),_0x5acd83,_0x4e67ee[_0x4990('0x18')][_0x4990('0x1b')]);return _0x5e6edf(_0x4e67ee[_0x4990('0x18')][_0x4990('0x1b')]);}else{logger[_0x4990('0x13')](_0x4990('0x1a'),_0x5acd83,'request\x20sent');_0x5e6edf(_0x4e67ee['result']['message']);}})[_0x4990('0x1c')](function(_0x3f4037){logger[_0x4990('0x18')](_0x4990('0x1a'),_0x5acd83,_0x3f4037);_0x3ea08f(_0x3f4037);});});}function respondWithStatusCode(_0x10bf73,_0x78d39e){_0x78d39e=_0x78d39e||0xcc;return function(_0x1619eb){if(_0x1619eb){return _0x10bf73[_0x4990('0x1d')](_0x78d39e);}return _0x10bf73[_0x4990('0x1e')](_0x78d39e)[_0x4990('0x1f')]();};}function respondWithResult(_0x42860f,_0xd6e2b1){_0xd6e2b1=_0xd6e2b1||0xc8;return function(_0xf2a4fe){if(_0xf2a4fe){return _0x42860f['status'](_0xd6e2b1)[_0x4990('0x20')](_0xf2a4fe);}};}function respondWithFilteredResult(_0x4af2a5,_0x1786c0){return function(_0x1f7d37){if(_0x1f7d37){var _0x578fe6=_0x1f7d37[_0x4990('0x21')],_0x234423=_0x1786c0[_0x4990('0x22')],_0x182730=_0x1786c0[_0x4990('0x22')]+_0x1786c0[_0x4990('0x23')],_0x2c01b8;if(_0x182730>=_0x578fe6){_0x182730=_0x578fe6;_0x2c01b8=0xc8;}else{_0x2c01b8=0xce;}_0x4af2a5[_0x4990('0x1e')](_0x2c01b8);return _0x4af2a5[_0x4990('0x24')](_0x4990('0x25'),_0x234423+'-'+_0x182730+'/'+_0x578fe6)['json'](_0x1f7d37);}return null;};}function patchUpdates(_0x1ffc73){return function(_0x3df088){try{jsonpatch[_0x4990('0x26')](_0x3df088,_0x1ffc73,!![]);}catch(_0x41c0c7){return BPromise[_0x4990('0x27')](_0x41c0c7);}return _0x3df088['save']();};}function saveUpdates(_0x303e3d,_0x29f6ec){return function(_0x36aee7){if(_0x36aee7){return _0x36aee7['update'](_0x303e3d)[_0x4990('0x28')](function(_0x1ca5f5){return _0x1ca5f5;});}return null;};}function removeEntity(_0x219d0c,_0x413e92){return function(_0x3aab61){if(_0x3aab61){return _0x3aab61[_0x4990('0x29')]()[_0x4990('0x28')](function(){_0x219d0c[_0x4990('0x1e')](0xcc)[_0x4990('0x1f')]();});}};}function handleEntityNotFound(_0x342471,_0x184921){return function(_0x4cfa75){if(!_0x4cfa75){_0x342471['sendStatus'](0x194);}return _0x4cfa75;};}function handleError(_0x52bbbd,_0x2893b9){_0x2893b9=_0x2893b9||0x1f4;return function(_0xc493e9){logger[_0x4990('0x18')](_0xc493e9['stack']);if(_0xc493e9[_0x4990('0x2a')]){delete _0xc493e9[_0x4990('0x2a')];}_0x52bbbd[_0x4990('0x1e')](_0x2893b9)['send'](_0xc493e9);};}exports[_0x4990('0x2b')]=function(_0x2ee5a7,_0x14dfb2){var _0x2d440f={},_0x441dff={},_0x93a83e={'count':0x0,'rows':[]};var _0x38fd8d=db[_0x4990('0x2c')][_0x4990('0x2d')];_0x441dff[_0x4990('0x2e')]=_[_0x4990('0x2f')](_0x38fd8d);var _0x13010f={'dateStart':_0x2ee5a7[_0x4990('0x30')]['dateStart'],'dateEnd':_0x2ee5a7[_0x4990('0x30')]['dateEnd']};delete _0x2ee5a7['query'][_0x4990('0x31')];delete _0x2ee5a7[_0x4990('0x30')][_0x4990('0x32')];_0x441dff[_0x4990('0x30')]=_['keys'](_0x2ee5a7[_0x4990('0x30')]);_0x441dff[_0x4990('0x33')]=_['intersection'](_0x441dff['model'],_0x441dff['query']);_0x2d440f[_0x4990('0x34')]=_['intersection'](_0x441dff[_0x4990('0x2e')],qs[_0x4990('0x35')](_0x2ee5a7[_0x4990('0x30')][_0x4990('0x35')]));_0x2d440f[_0x4990('0x34')]=_0x2d440f['attributes']['length']?_0x2d440f[_0x4990('0x34')]:_0x441dff[_0x4990('0x2e')];if(!_0x2ee5a7[_0x4990('0x30')]['hasOwnProperty'](_0x4990('0x36'))){_0x2d440f['limit']=qs[_0x4990('0x23')](_0x2ee5a7['query'][_0x4990('0x23')]);_0x2d440f[_0x4990('0x22')]=qs['offset'](_0x2ee5a7[_0x4990('0x30')][_0x4990('0x22')]);}_0x2d440f['order']=qs[_0x4990('0x37')](_0x2ee5a7[_0x4990('0x30')]['sort']);_0x2d440f[_0x4990('0x38')]=qs[_0x4990('0x33')](_[_0x4990('0x39')](_0x2ee5a7[_0x4990('0x30')],_0x441dff[_0x4990('0x33')]));if(_0x13010f[_0x4990('0x31')]){if(_0x13010f['dateEnd']){_0x13010f[_0x4990('0x32')]=moment(_0x13010f[_0x4990('0x32')])['add'](0x1,_0x4990('0x3a'));}else{_0x13010f['dateEnd']=moment(_0x13010f['dateStart'])[_0x4990('0x3b')](0x1,_0x4990('0x3a'));}_[_0x4990('0x3c')](_0x2d440f[_0x4990('0x38')],{'createdAt':{'$gte':_0x13010f[_0x4990('0x31')],'$lte':_0x13010f['dateEnd']}});}if(_0x2ee5a7[_0x4990('0x30')][_0x4990('0x3d')]){_0x2d440f[_0x4990('0x38')]=_[_0x4990('0x3c')](_0x2d440f[_0x4990('0x38')],{'$or':_['map'](_0x2d440f[_0x4990('0x34')],function(_0x5af544){var _0x3a9906={};_0x3a9906[_0x5af544]={'$like':'%'+_0x2ee5a7['query']['filter']+'%'};return _0x3a9906;})});}_0x2d440f=_[_0x4990('0x3c')]({},_0x2d440f,_0x2ee5a7[_0x4990('0x3e')]);var _0xfa7b3a={'where':_0x2d440f[_0x4990('0x38')]};return db[_0x4990('0x2c')]['count'](_0xfa7b3a)['then'](function(_0x243bfc){_0x93a83e[_0x4990('0x21')]=_0x243bfc;if(_0x2ee5a7[_0x4990('0x30')][_0x4990('0x3f')]){_0x2d440f[_0x4990('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x4990('0x41')](_0x2d440f);})[_0x4990('0x28')](function(_0x26b1d6){_0x93a83e[_0x4990('0x42')]=_0x26b1d6;return _0x93a83e;})[_0x4990('0x28')](respondWithFilteredResult(_0x14dfb2,_0x2d440f))[_0x4990('0x1c')](handleError(_0x14dfb2,null));};exports['show']=function(_0x34dedf,_0x218088){var _0x21a3d7={'raw':![],'where':{'id':_0x34dedf[_0x4990('0x43')]['id']}},_0x1b28c7={};_0x1b28c7[_0x4990('0x2e')]=_[_0x4990('0x2f')](db['DeskAccount'][_0x4990('0x2d')]);_0x1b28c7[_0x4990('0x30')]=_['keys'](_0x34dedf[_0x4990('0x30')]);_0x1b28c7['filters']=_['intersection'](_0x1b28c7[_0x4990('0x2e')],_0x1b28c7[_0x4990('0x30')]);_0x21a3d7['attributes']=_[_0x4990('0x44')](_0x1b28c7[_0x4990('0x2e')],qs[_0x4990('0x35')](_0x34dedf['query'][_0x4990('0x35')]));_0x21a3d7[_0x4990('0x34')]=_0x21a3d7['attributes'][_0x4990('0x45')]?_0x21a3d7['attributes']:_0x1b28c7['model'];if(_0x34dedf[_0x4990('0x30')][_0x4990('0x3f')]){_0x21a3d7[_0x4990('0x40')]=[{'all':!![]}];}_0x21a3d7=_[_0x4990('0x3c')]({},_0x21a3d7,_0x34dedf[_0x4990('0x3e')]);return db['DeskAccount'][_0x4990('0x46')](_0x21a3d7)[_0x4990('0x28')](handleEntityNotFound(_0x218088,null))[_0x4990('0x28')](respondWithResult(_0x218088,null))[_0x4990('0x1c')](handleError(_0x218088,null));};exports['create']=function(_0x58bbe4,_0x527001){return db['DeskAccount']['create'](_0x58bbe4[_0x4990('0x47')],{})['then'](respondWithResult(_0x527001,0xc9))[_0x4990('0x1c')](handleError(_0x527001,null));};exports[_0x4990('0x48')]=function(_0x526d9d,_0x11d313){if(_0x526d9d[_0x4990('0x47')]['id']){delete _0x526d9d[_0x4990('0x47')]['id'];}return db['DeskAccount'][_0x4990('0x46')]({'where':{'id':_0x526d9d['params']['id']}})[_0x4990('0x28')](handleEntityNotFound(_0x11d313,null))[_0x4990('0x28')](saveUpdates(_0x526d9d[_0x4990('0x47')],null))[_0x4990('0x28')](respondWithResult(_0x11d313,null))['catch'](handleError(_0x11d313,null));};exports[_0x4990('0x29')]=function(_0x1113f5,_0x3dc2e6){return db[_0x4990('0x2c')]['find']({'where':{'id':_0x1113f5[_0x4990('0x43')]['id']}})['then'](handleEntityNotFound(_0x3dc2e6,null))[_0x4990('0x28')](removeEntity(_0x3dc2e6,null))[_0x4990('0x1c')](handleError(_0x3dc2e6,null));};exports['getConfigurations']=function(_0x5ac205,_0x3043cb,_0xd37ae6){var _0x47dfab={};var _0x50e335={};var _0x37dd8d;var _0x13623d;return db['DeskAccount'][_0x4990('0x49')]({'where':{'id':_0x5ac205[_0x4990('0x43')]['id']}})[_0x4990('0x28')](handleEntityNotFound(_0x3043cb,null))['then'](function(_0x1a197e){if(_0x1a197e){_0x37dd8d=_0x1a197e;_0x50e335[_0x4990('0x2e')]=_[_0x4990('0x2f')](db['DeskConfiguration']['rawAttributes']);_0x50e335[_0x4990('0x30')]=_['keys'](_0x5ac205[_0x4990('0x30')]);_0x50e335[_0x4990('0x33')]=_[_0x4990('0x44')](_0x50e335[_0x4990('0x2e')],_0x50e335['query']);_0x47dfab[_0x4990('0x34')]=_[_0x4990('0x44')](_0x50e335[_0x4990('0x2e')],qs[_0x4990('0x35')](_0x5ac205[_0x4990('0x30')][_0x4990('0x35')]));_0x47dfab[_0x4990('0x34')]=_0x47dfab[_0x4990('0x34')][_0x4990('0x45')]?_0x47dfab[_0x4990('0x34')]:_0x50e335['model'];_0x47dfab[_0x4990('0x4a')]=qs[_0x4990('0x37')](_0x5ac205['query'][_0x4990('0x37')]);_0x47dfab['where']=qs[_0x4990('0x33')](_[_0x4990('0x39')](_0x5ac205[_0x4990('0x30')],_0x50e335[_0x4990('0x33')]));if(_0x5ac205[_0x4990('0x30')][_0x4990('0x3d')]){_0x47dfab[_0x4990('0x38')]=_['merge'](_0x47dfab[_0x4990('0x38')],{'$or':_[_0x4990('0x4b')](_0x47dfab[_0x4990('0x34')],function(_0x556cf4){var _0x2b26a2={};_0x2b26a2[_0x556cf4]={'$like':'%'+_0x5ac205['query']['filter']+'%'};return _0x2b26a2;})});}_0x47dfab=_[_0x4990('0x3c')]({},_0x47dfab,_0x5ac205[_0x4990('0x3e')]);return _0x37dd8d[_0x4990('0x4c')](_0x47dfab);}})[_0x4990('0x28')](function(_0x3d0560){if(_0x3d0560){_0x13623d=_0x3d0560[_0x4990('0x45')];if(!_0x5ac205[_0x4990('0x30')][_0x4990('0x4d')]('nolimit')){_0x47dfab['limit']=qs[_0x4990('0x23')](_0x5ac205[_0x4990('0x30')]['limit']);_0x47dfab[_0x4990('0x22')]=qs[_0x4990('0x22')](_0x5ac205[_0x4990('0x30')][_0x4990('0x22')]);}return _0x37dd8d[_0x4990('0x4c')](_0x47dfab);}})[_0x4990('0x28')](function(_0xfa673){if(_0xfa673){return _0xfa673?{'count':_0x13623d,'rows':_0xfa673}:null;}})[_0x4990('0x28')](respondWithResult(_0x3043cb,null))[_0x4990('0x1c')](handleError(_0x3043cb,null));};exports[_0x4990('0x4e')]=function(_0x346e56,_0x19f078,_0x2df683){if(_0x346e56[_0x4990('0x47')]['id']){delete _0x346e56['body']['id'];}return db[_0x4990('0x2c')][_0x4990('0x49')]({'where':{'id':_0x346e56['params']['id']}})[_0x4990('0x28')](handleEntityNotFound(_0x19f078,null))['then'](function(_0x48e60c){if(_0x48e60c){_0x346e56[_0x4990('0x47')][_0x4990('0x4f')]=_0x48e60c['id'];_0x346e56['body'][_0x4990('0x50')]=integrations[_0x4990('0x51')](_0x346e56[_0x4990('0x47')][_0x4990('0x52')],_0x346e56['body'][_0x4990('0x53')]);_0x346e56[_0x4990('0x47')]['Descriptions']=integrations[_0x4990('0x54')](_0x346e56['body'][_0x4990('0x52')],_0x346e56['body'][_0x4990('0x53')]);return db['DeskConfiguration'][_0x4990('0x55')](_0x346e56[_0x4990('0x47')],{'include':[{'model':db[_0x4990('0x56')],'as':_0x4990('0x50')},{'model':db[_0x4990('0x56')],'as':_0x4990('0x57')}]});}return null;})[_0x4990('0x28')](respondWithResult(_0x19f078,null))[_0x4990('0x1c')](handleError(_0x19f078,null));};exports[_0x4990('0x58')]=function(_0x42dc41,_0x29141a,_0x4ae5d3){var _0x2db396=[{'name':'priority','label':_0x4990('0x59'),'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[_0x4990('0x2c')][_0x4990('0x49')]({'where':{'id':_0x42dc41[_0x4990('0x43')]['id']},'attributes':['id',_0x4990('0x5a'),_0x4990('0x5b'),_0x4990('0x5c'),'password',_0x4990('0x5d'),_0x4990('0x5e'),_0x4990('0x5f'),_0x4990('0x60')]})[_0x4990('0x28')](handleEntityNotFound(_0x29141a,null))['then'](function(_0x155da2){if(_0x155da2){var _0x596fe6={'method':_0x4990('0x61'),'uri':util['format']('%s/custom_fields',_0x155da2[_0x4990('0x5a')]),'headers':{'Content-Type':_0x4990('0x62'),'Accept':_0x4990('0x62')},'json':!![]};if(_0x155da2[_0x4990('0x5b')]===_0x4990('0x63')){_0x596fe6[_0x4990('0x64')][_0x4990('0x65')]=util[_0x4990('0x66')](_0x4990('0x67'),new Buffer(util[_0x4990('0x66')](_0x4990('0x68'),_0x155da2['username'],_0x155da2[_0x4990('0x69')]))['toString'](_0x4990('0x6a')));}return rp(_0x596fe6)['then'](function(_0x50c59c){return _0x2db396[_0x4990('0x6b')](_[_0x4990('0x4b')](_0x50c59c[_0x4990('0x6c')]['entries'],function(_0x2d51bd){return{'id':_0x2d51bd[_0x4990('0x2a')],'name':_0x2d51bd[_0x4990('0x2a')],'type':_0x2d51bd[_0x4990('0x53')],'active':_0x2d51bd[_0x4990('0x6d')],'label':_0x2d51bd['label'],'custom':!![]};}));});}})[_0x4990('0x28')](function(_0x30ba1e){return{'count':_0x30ba1e['length'],'rows':_0x30ba1e};})['then'](respondWithResult(_0x29141a,null))['catch'](function(_0x5c4e2b){var _0x45ce9e=_0x42dc41['query'][_0x4990('0x6e')]?0x1f4:_0x5c4e2b[_0x4990('0x6f')]||0x1f4;logger['error'](_0x4990('0x70'),_0x4990('0x58'),_0x45ce9e,JSON[_0x4990('0x17')](_0x5c4e2b));delete _0x5c4e2b['name'];if(_0x45ce9e===0x191){_0x45ce9e=0x190;}_0x29141a['status'](_0x45ce9e)[_0x4990('0x71')](_0x42dc41[_0x4990('0x30')]['test']?{'message':_0x4990('0x72'),'statusCode':_0x5c4e2b[_0x4990('0x6f')]}:_0x5c4e2b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 51d65d1..da404e0 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 _0xa866=['moment','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa866,0x6a));var _0x6a86=function(_0x2ca5f6,_0x643c1f){_0x2ca5f6=_0x2ca5f6-0x0;var _0x2c5bd6=_0xa866[_0x2ca5f6];return _0x2c5bd6;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var logger=require(_0x6a86('0x2'))(_0x6a86('0x3'));var moment=require(_0x6a86('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a86('0x5'));var attributes=require(_0x6a86('0x6'));var integrations=require(_0x6a86('0x7'));module['exports']=function(_0x45b052,_0x31c80c){return _0x45b052[_0x6a86('0x8')]('DeskAccount',attributes,{'tableName':_0x6a86('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['bluebird','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','api'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x7096,0x10c));var _0x6709=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7096[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var attributes=require(_0x6709('0x4'));var integrations=require(_0x6709('0x5'));module[_0x6709('0x6')]=function(_0x3c8599,_0xb8fe6d){return _0x3c8599[_0x6709('0x7')](_0x6709('0x8'),attributes,{'tableName':_0x6709('0x9'),'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 7b40607..5439d7e 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 _0x7393=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','include','attributes','model','map','find','ShowDeskAccount','lodash','util','moment'];(function(_0x853b00,_0x981c49){var _0x5199dc=function(_0x505637){while(--_0x505637){_0x853b00['push'](_0x853b00['shift']());}};_0x5199dc(++_0x981c49);}(_0x7393,0xa2));var _0x3739=function(_0x52be1a,_0x343c2c){_0x52be1a=_0x52be1a-0x0;var _0x325d83=_0x7393[_0x52be1a];return _0x325d83;};'use strict';var _=require(_0x3739('0x0'));var util=require(_0x3739('0x1'));var moment=require(_0x3739('0x2'));var BPromise=require(_0x3739('0x3'));var rs=require(_0x3739('0x4'));var fs=require('fs');var db=require(_0x3739('0x5'))['db'];var utils=require(_0x3739('0x6'));var logger=require(_0x3739('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3739('0x8')][_0x3739('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48025d,_0x34e36c,_0x46238e){return new BPromise(function(_0x11d121,_0x42c929){return client[_0x3739('0xa')](_0x48025d,_0x46238e)[_0x3739('0xb')](function(_0x1f6fe6){logger[_0x3739('0xc')]('DeskAccount,\x20%s,\x20%s',_0x34e36c,_0x3739('0xd'));logger[_0x3739('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x34e36c,_0x3739('0xd'),JSON[_0x3739('0xf')](_0x1f6fe6));if(_0x1f6fe6[_0x3739('0x10')]){if(_0x1f6fe6[_0x3739('0x10')][_0x3739('0x11')]===0x1f4){logger[_0x3739('0x10')](_0x3739('0x12'),_0x34e36c,_0x1f6fe6['error'][_0x3739('0x13')]);return _0x42c929(_0x1f6fe6[_0x3739('0x10')][_0x3739('0x13')]);}logger['error'](_0x3739('0x12'),_0x34e36c,_0x1f6fe6['error']['message']);return _0x11d121(_0x1f6fe6['error']['message']);}else{logger[_0x3739('0xc')](_0x3739('0x12'),_0x34e36c,_0x3739('0xd'));_0x11d121(_0x1f6fe6[_0x3739('0x14')][_0x3739('0x13')]);}})[_0x3739('0x15')](function(_0x30b493){logger[_0x3739('0x10')](_0x3739('0x12'),_0x34e36c,_0x30b493);_0x42c929(_0x30b493);});});}exports[_0x3739('0x16')]=function(_0x5c202c){var _0x4eb90f=this;return new Promise(function(_0x4b577f,_0x53033b){return db[_0x3739('0x17')][_0x3739('0x18')]({'raw':_0x5c202c[_0x3739('0x19')]?_0x5c202c['options'][_0x3739('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c202c['options']?_0x5c202c['options']['where']||null:null,'attributes':_0x5c202c[_0x3739('0x19')]?_0x5c202c[_0x3739('0x19')]['attributes']||null:null,'limit':_0x5c202c[_0x3739('0x19')]?_0x5c202c[_0x3739('0x19')]['limit']||null:null,'include':_0x5c202c['options']?_0x5c202c['options']['include']?_['map'](_0x5c202c['options'][_0x3739('0x1b')],function(_0x26699a){return{'model':db[_0x26699a['model']],'as':_0x26699a['as'],'attributes':_0x26699a[_0x3739('0x1c')],'include':_0x26699a[_0x3739('0x1b')]?_['map'](_0x26699a['include'],function(_0x167ca6){return{'model':db[_0x167ca6[_0x3739('0x1d')]],'as':_0x167ca6['as'],'attributes':_0x167ca6[_0x3739('0x1c')],'include':_0x167ca6[_0x3739('0x1b')]?_[_0x3739('0x1e')](_0x167ca6[_0x3739('0x1b')],function(_0x24776d){return{'model':db[_0x24776d[_0x3739('0x1d')]],'as':_0x24776d['as'],'attributes':_0x24776d[_0x3739('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3739('0xb')](function(_0x249350){logger[_0x3739('0xc')](_0x3739('0x16'),_0x5c202c);logger['debug'](_0x3739('0x16'),_0x5c202c,JSON['stringify'](_0x249350));_0x4b577f(_0x249350);})[_0x3739('0x15')](function(_0x481f9a){logger[_0x3739('0x10')]('GetDeskAccount',_0x481f9a[_0x3739('0x13')],_0x5c202c);_0x53033b(_0x4eb90f[_0x3739('0x10')](0x1f4,_0x481f9a[_0x3739('0x13')]));});});};exports['ShowDeskAccount']=function(_0x234ffb){var _0xa21fbb=this;return new Promise(function(_0x538420,_0x4a38b9){return db['DeskAccount'][_0x3739('0x1f')]({'raw':_0x234ffb['options']?_0x234ffb[_0x3739('0x19')][_0x3739('0x1a')]===undefined?!![]:![]:!![],'where':_0x234ffb[_0x3739('0x19')]?_0x234ffb[_0x3739('0x19')]['where']||null:null,'attributes':_0x234ffb[_0x3739('0x19')]?_0x234ffb[_0x3739('0x19')]['attributes']||null:null,'include':_0x234ffb[_0x3739('0x19')]?_0x234ffb[_0x3739('0x19')][_0x3739('0x1b')]?_[_0x3739('0x1e')](_0x234ffb[_0x3739('0x19')][_0x3739('0x1b')],function(_0x4feb97){return{'model':db[_0x4feb97[_0x3739('0x1d')]],'as':_0x4feb97['as'],'attributes':_0x4feb97[_0x3739('0x1c')],'include':_0x4feb97[_0x3739('0x1b')]?_[_0x3739('0x1e')](_0x4feb97[_0x3739('0x1b')],function(_0x3ebb53){return{'model':db[_0x3ebb53[_0x3739('0x1d')]],'as':_0x3ebb53['as'],'attributes':_0x3ebb53[_0x3739('0x1c')],'include':_0x3ebb53['include']?_[_0x3739('0x1e')](_0x3ebb53[_0x3739('0x1b')],function(_0x4cd85a){return{'model':db[_0x4cd85a[_0x3739('0x1d')]],'as':_0x4cd85a['as'],'attributes':_0x4cd85a[_0x3739('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3739('0xb')](function(_0x345bec){logger[_0x3739('0xc')](_0x3739('0x20'),_0x234ffb);logger['debug'](_0x3739('0x20'),_0x234ffb,JSON['stringify'](_0x345bec));_0x538420(_0x345bec);})[_0x3739('0x15')](function(_0x26e20a){logger['error'](_0x3739('0x20'),_0x26e20a['message'],_0x234ffb);_0x4a38b9(_0xa21fbb[_0x3739('0x10')](0x1f4,_0x26e20a[_0x3739('0x13')]));});});}; \ No newline at end of file +var _0x9645=['code','message','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetDeskAccount','ShowDeskAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xac74a8,_0x49a7d4){var _0xb8c40d=function(_0x572452){while(--_0x572452){_0xac74a8['push'](_0xac74a8['shift']());}};_0xb8c40d(++_0x49a7d4);}(_0x9645,0xc2));var _0x5964=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0x9645[_0x4c3070];return _0x536a44;};'use strict';var _=require(_0x5964('0x0'));var util=require(_0x5964('0x1'));var moment=require(_0x5964('0x2'));var BPromise=require('bluebird');var rs=require(_0x5964('0x3'));var fs=require('fs');var db=require(_0x5964('0x4'))['db'];var utils=require(_0x5964('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5964('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45f607,_0x2eb448,_0x1d19a0){return new BPromise(function(_0x52304f,_0x4e7e2a){return client[_0x5964('0x7')](_0x45f607,_0x1d19a0)[_0x5964('0x8')](function(_0x1f6448){logger[_0x5964('0x9')](_0x5964('0xa'),_0x2eb448,_0x5964('0xb'));logger[_0x5964('0xc')](_0x5964('0xd'),_0x2eb448,_0x5964('0xb'),JSON[_0x5964('0xe')](_0x1f6448));if(_0x1f6448[_0x5964('0xf')]){if(_0x1f6448['error'][_0x5964('0x10')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2eb448,_0x1f6448[_0x5964('0xf')][_0x5964('0x11')]);return _0x4e7e2a(_0x1f6448['error'][_0x5964('0x11')]);}logger['error'](_0x5964('0xa'),_0x2eb448,_0x1f6448[_0x5964('0xf')]['message']);return _0x52304f(_0x1f6448['error'][_0x5964('0x11')]);}else{logger[_0x5964('0x9')](_0x5964('0xa'),_0x2eb448,_0x5964('0xb'));_0x52304f(_0x1f6448['result'][_0x5964('0x11')]);}})[_0x5964('0x12')](function(_0x5d10d8){logger[_0x5964('0xf')](_0x5964('0xa'),_0x2eb448,_0x5d10d8);_0x4e7e2a(_0x5d10d8);});});}exports['GetDeskAccount']=function(_0x1cb7e1){var _0x2afb77=this;return new Promise(function(_0x8690ec,_0x4394ed){return db['DeskAccount'][_0x5964('0x13')]({'raw':_0x1cb7e1[_0x5964('0x14')]?_0x1cb7e1[_0x5964('0x14')][_0x5964('0x15')]===undefined?!![]:![]:!![],'where':_0x1cb7e1['options']?_0x1cb7e1['options'][_0x5964('0x16')]||null:null,'attributes':_0x1cb7e1[_0x5964('0x14')]?_0x1cb7e1['options'][_0x5964('0x17')]||null:null,'limit':_0x1cb7e1[_0x5964('0x14')]?_0x1cb7e1['options'][_0x5964('0x18')]||null:null,'include':_0x1cb7e1['options']?_0x1cb7e1[_0x5964('0x14')][_0x5964('0x19')]?_['map'](_0x1cb7e1[_0x5964('0x14')][_0x5964('0x19')],function(_0x3b3c91){return{'model':db[_0x3b3c91[_0x5964('0x1a')]],'as':_0x3b3c91['as'],'attributes':_0x3b3c91[_0x5964('0x17')],'include':_0x3b3c91[_0x5964('0x19')]?_['map'](_0x3b3c91[_0x5964('0x19')],function(_0x151f76){return{'model':db[_0x151f76[_0x5964('0x1a')]],'as':_0x151f76['as'],'attributes':_0x151f76[_0x5964('0x17')],'include':_0x151f76['include']?_[_0x5964('0x1b')](_0x151f76[_0x5964('0x19')],function(_0x1f6567){return{'model':db[_0x1f6567[_0x5964('0x1a')]],'as':_0x1f6567['as'],'attributes':_0x1f6567[_0x5964('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5964('0x8')](function(_0x29189e){logger[_0x5964('0x9')](_0x5964('0x1c'),_0x1cb7e1);logger[_0x5964('0xc')]('GetDeskAccount',_0x1cb7e1,JSON[_0x5964('0xe')](_0x29189e));_0x8690ec(_0x29189e);})['catch'](function(_0x40f91e){logger['error']('GetDeskAccount',_0x40f91e[_0x5964('0x11')],_0x1cb7e1);_0x4394ed(_0x2afb77[_0x5964('0xf')](0x1f4,_0x40f91e[_0x5964('0x11')]));});});};exports[_0x5964('0x1d')]=function(_0x7be82a){var _0x5f4edf=this;return new Promise(function(_0x458f12,_0x4eacda){return db['DeskAccount']['find']({'raw':_0x7be82a[_0x5964('0x14')]?_0x7be82a['options']['raw']===undefined?!![]:![]:!![],'where':_0x7be82a['options']?_0x7be82a[_0x5964('0x14')][_0x5964('0x16')]||null:null,'attributes':_0x7be82a[_0x5964('0x14')]?_0x7be82a[_0x5964('0x14')][_0x5964('0x17')]||null:null,'include':_0x7be82a['options']?_0x7be82a['options'][_0x5964('0x19')]?_[_0x5964('0x1b')](_0x7be82a[_0x5964('0x14')][_0x5964('0x19')],function(_0x3a30c7){return{'model':db[_0x3a30c7[_0x5964('0x1a')]],'as':_0x3a30c7['as'],'attributes':_0x3a30c7[_0x5964('0x17')],'include':_0x3a30c7[_0x5964('0x19')]?_[_0x5964('0x1b')](_0x3a30c7[_0x5964('0x19')],function(_0xdaf716){return{'model':db[_0xdaf716[_0x5964('0x1a')]],'as':_0xdaf716['as'],'attributes':_0xdaf716[_0x5964('0x17')],'include':_0xdaf716[_0x5964('0x19')]?_['map'](_0xdaf716['include'],function(_0x2ce358){return{'model':db[_0x2ce358['model']],'as':_0x2ce358['as'],'attributes':_0x2ce358[_0x5964('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5964('0x8')](function(_0x2a2da4){logger[_0x5964('0x9')](_0x5964('0x1d'),_0x7be82a);logger[_0x5964('0xc')](_0x5964('0x1d'),_0x7be82a,JSON[_0x5964('0xe')](_0x2a2da4));_0x458f12(_0x2a2da4);})['catch'](function(_0x1740c2){logger[_0x5964('0xf')](_0x5964('0x1d'),_0x1740c2[_0x5964('0x11')],_0x7be82a);_0x4eacda(_0x5f4edf[_0x5964('0xf')](0x1f4,_0x1740c2['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 432d229..d3e25e5 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 _0xcb91=['post','setTags','put','update','delete','path','express','Router','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','/:id','get','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags'];(function(_0x5eb537,_0x135157){var _0x1dbe0a=function(_0x11a4ce){while(--_0x11a4ce){_0x5eb537['push'](_0x5eb537['shift']());}};_0x1dbe0a(++_0x135157);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xcb91[_0x287a47];return _0x3fb726;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var express=require(_0x1cb9('0x1'));var router=express[_0x1cb9('0x2')]();var auth=require(_0x1cb9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1cb9('0x4'));var controller=require(_0x1cb9('0x5'));router['get']('/',auth[_0x1cb9('0x6')](),controller[_0x1cb9('0x7')]);router['get'](_0x1cb9('0x8'),auth[_0x1cb9('0x6')](),controller['show']);router[_0x1cb9('0x9')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['get']('/:id/subjects',auth[_0x1cb9('0x6')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0x9')](_0x1cb9('0xd'),auth[_0x1cb9('0x6')](),controller['getDescriptions']);router[_0x1cb9('0x9')](_0x1cb9('0xe'),auth[_0x1cb9('0x6')](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x1cb9('0xe'),auth[_0x1cb9('0x6')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x12')]('/:id',auth[_0x1cb9('0x6')](),controller[_0x1cb9('0x13')]);router[_0x1cb9('0x14')](_0x1cb9('0x8'),auth[_0x1cb9('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9bde=['util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','exports'];(function(_0x1eedfd,_0x441fdd){var _0x8b4df3=function(_0x5d29cb){while(--_0x5d29cb){_0x1eedfd['push'](_0x1eedfd['shift']());}};_0x8b4df3(++_0x441fdd);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2a55db,_0x5739ae){_0x2a55db=_0x2a55db-0x0;var _0x41bd9b=_0x9bde[_0x2a55db];return _0x41bd9b;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var express=require(_0xe9bd('0x1'));var router=express['Router']();var auth=require(_0xe9bd('0x2'));var interaction=require(_0xe9bd('0x3'));var config=require(_0xe9bd('0x4'));var controller=require(_0xe9bd('0x5'));router[_0xe9bd('0x6')]('/',auth[_0xe9bd('0x7')](),controller[_0xe9bd('0x8')]);router['get'](_0xe9bd('0x9'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x7')](),controller['getSubjects']);router['get'](_0xe9bd('0xe'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0xf')]);router['get'](_0xe9bd('0x10'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0x11')]);router[_0xe9bd('0x12')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x13')]);router['post'](_0xe9bd('0x10'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0x14')]);router['put']('/:id',auth[_0xe9bd('0x7')](),controller[_0xe9bd('0x15')]);router[_0xe9bd('0x16')](_0xe9bd('0x9'),auth[_0xe9bd('0x7')](),controller[_0xe9bd('0x17')]);module[_0xe9bd('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 4c81305..9c0b2a2 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 _0x9b4b=['STRING','exports'];(function(_0x48f8d5,_0x34f897){var _0x47f9e5=function(_0x1b417f){while(--_0x1b417f){_0x48f8d5['push'](_0x48f8d5['shift']());}};_0x47f9e5(++_0x34f897);}(_0x9b4b,0xaf));var _0xb9b4=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0x9b4b[_0x38e177];return _0x1faf15;};'use strict';var Sequelize=require('sequelize');module[_0xb9b4('0x0')]={'name':{'type':Sequelize[_0xb9b4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda66=['STRING','sequelize'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xda66,0xdb));var _0x6da6=function(_0x35af6d,_0x48afc4){_0x35af6d=_0x35af6d-0x0;var _0x1fd188=_0xda66[_0x35af6d];return _0x1fd188;};'use strict';var Sequelize=require(_0x6da6('0x0'));module['exports']={'name':{'type':Sequelize[_0x6da6('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e9324cb..f2ef767 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 _0x74f8=['stringify','error','DeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','name','send','index','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','filter','map','merge','options','DeskConfiguration','includeAll','include','findAll','rows','show','params','create','body','find','destroy','getFields','findOne','DeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','info','request\x20sent'];(function(_0x4778e2,_0x4d616f){var _0x5d8c73=function(_0x3afafb){while(--_0x3afafb){_0x4778e2['push'](_0x4778e2['shift']());}};_0x5d8c73(++_0x4d616f);}(_0x74f8,0x1e1));var _0x874f=function(_0x4521c3,_0xcf814e){_0x4521c3=_0x4521c3-0x0;var _0x40b42b=_0x74f8[_0x4521c3];return _0x40b42b;};'use strict';var jsonpatch=require(_0x874f('0x0'));var rp=require(_0x874f('0x1'));var moment=require(_0x874f('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x874f('0x3'));var sox=require(_0x874f('0x4'));var csv=require(_0x874f('0x5'));var ejs=require(_0x874f('0x6'));var fs=require('fs');var _=require(_0x874f('0x7'));var squel=require('squel');var crypto=require(_0x874f('0x8'));var jsforce=require(_0x874f('0x9'));var deskjs=require(_0x874f('0xa'));var toCsv=require(_0x874f('0x5'));var querystring=require('querystring');var Papa=require(_0x874f('0xb'));var qs=require(_0x874f('0xc'));var logger=require(_0x874f('0xd'))(_0x874f('0xe'));var utils=require(_0x874f('0xf'));var config=require(_0x874f('0x10'));var db=require(_0x874f('0x11'))['db'];var jayson=require(_0x874f('0x12'));var client=jayson[_0x874f('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x240599,_0x2f4dab,_0x313fa3,_0x47e4cc){return new BPromise(function(_0x5b3141,_0x53507f){var _0x46d560=_0x47e4cc||client;return _0x46d560['request'](_0x240599,_0x313fa3)[_0x874f('0x14')](function(_0xa10845){logger[_0x874f('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x2f4dab,_0x874f('0x16'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2f4dab,_0x874f('0x16'),JSON[_0x874f('0x17')](_0xa10845));if(_0xa10845[_0x874f('0x18')]){if(_0xa10845[_0x874f('0x18')]['code']===0x1f4){logger[_0x874f('0x18')](_0x874f('0x19'),_0x2f4dab,_0xa10845['error'][_0x874f('0x1a')]);return _0x53507f(_0xa10845['error'][_0x874f('0x1a')]);}logger[_0x874f('0x18')]('DeskConfiguration,\x20%s,\x20%s',_0x2f4dab,_0xa10845[_0x874f('0x18')]['message']);return _0x5b3141(_0xa10845[_0x874f('0x18')][_0x874f('0x1a')]);}else{logger[_0x874f('0x15')](_0x874f('0x19'),_0x2f4dab,'request\x20sent');_0x5b3141(_0xa10845['result']['message']);}})[_0x874f('0x1b')](function(_0x586652){logger['error'](_0x874f('0x19'),_0x2f4dab,_0x586652);_0x53507f(_0x586652);});});}function respondWithStatusCode(_0x9633b5,_0x3d8cde){_0x3d8cde=_0x3d8cde||0xcc;return function(_0x1224b8){if(_0x1224b8){return _0x9633b5[_0x874f('0x1c')](_0x3d8cde);}return _0x9633b5[_0x874f('0x1d')](_0x3d8cde)[_0x874f('0x1e')]();};}function respondWithResult(_0x3b4ddd,_0x533445){_0x533445=_0x533445||0xc8;return function(_0x38074e){if(_0x38074e){return _0x3b4ddd['status'](_0x533445)[_0x874f('0x1f')](_0x38074e);}};}function respondWithFilteredResult(_0x4050ff,_0x48819b){return function(_0x173c20){if(_0x173c20){var _0x3e9d6a=_0x173c20[_0x874f('0x20')],_0x3b9a25=_0x48819b[_0x874f('0x21')],_0x2bc5b3=_0x48819b[_0x874f('0x21')]+_0x48819b[_0x874f('0x22')],_0x2f8030;if(_0x2bc5b3>=_0x3e9d6a){_0x2bc5b3=_0x3e9d6a;_0x2f8030=0xc8;}else{_0x2f8030=0xce;}_0x4050ff[_0x874f('0x1d')](_0x2f8030);return _0x4050ff[_0x874f('0x23')](_0x874f('0x24'),_0x3b9a25+'-'+_0x2bc5b3+'/'+_0x3e9d6a)[_0x874f('0x1f')](_0x173c20);}return null;};}function patchUpdates(_0x232036){return function(_0x372bf9){try{jsonpatch['apply'](_0x372bf9,_0x232036,!![]);}catch(_0x12a55d){return BPromise[_0x874f('0x25')](_0x12a55d);}return _0x372bf9[_0x874f('0x26')]();};}function saveUpdates(_0xd52bf3,_0x57dee0){return function(_0x2661df){if(_0x2661df){return _0x2661df[_0x874f('0x27')](_0xd52bf3)[_0x874f('0x14')](function(_0x441e0d){return _0x441e0d;});}return null;};}function removeEntity(_0x56a6c2,_0x721f81){return function(_0x35212e){if(_0x35212e){return _0x35212e['destroy']()[_0x874f('0x14')](function(){_0x56a6c2[_0x874f('0x1d')](0xcc)[_0x874f('0x1e')]();});}};}function handleEntityNotFound(_0x5bc0d8,_0x7b7483){return function(_0x172916){if(!_0x172916){_0x5bc0d8['sendStatus'](0x194);}return _0x172916;};}function handleError(_0x377077,_0x405442){_0x405442=_0x405442||0x1f4;return function(_0x5c1088){logger[_0x874f('0x18')](_0x5c1088['stack']);if(_0x5c1088[_0x874f('0x28')]){delete _0x5c1088[_0x874f('0x28')];}_0x377077[_0x874f('0x1d')](_0x405442)[_0x874f('0x29')](_0x5c1088);};}exports[_0x874f('0x2a')]=function(_0x5ec533,_0x49316f){var _0x405476={},_0x47358d={},_0x294a4f={'count':0x0,'rows':[]};var _0x1658f3=db['DeskConfiguration'][_0x874f('0x2b')];_0x47358d['model']=_['keys'](_0x1658f3);var _0x3c4d37={'dateStart':_0x5ec533[_0x874f('0x2c')][_0x874f('0x2d')],'dateEnd':_0x5ec533['query'][_0x874f('0x2e')]};delete _0x5ec533[_0x874f('0x2c')]['dateStart'];delete _0x5ec533[_0x874f('0x2c')][_0x874f('0x2e')];_0x47358d[_0x874f('0x2c')]=_[_0x874f('0x2f')](_0x5ec533[_0x874f('0x2c')]);_0x47358d[_0x874f('0x30')]=_[_0x874f('0x31')](_0x47358d['model'],_0x47358d[_0x874f('0x2c')]);_0x405476['attributes']=_[_0x874f('0x31')](_0x47358d[_0x874f('0x32')],qs[_0x874f('0x33')](_0x5ec533['query'][_0x874f('0x33')]));_0x405476[_0x874f('0x34')]=_0x405476[_0x874f('0x34')][_0x874f('0x35')]?_0x405476[_0x874f('0x34')]:_0x47358d[_0x874f('0x32')];if(!_0x5ec533[_0x874f('0x2c')]['hasOwnProperty'](_0x874f('0x36'))){_0x405476['limit']=qs[_0x874f('0x22')](_0x5ec533[_0x874f('0x2c')][_0x874f('0x22')]);_0x405476[_0x874f('0x21')]=qs[_0x874f('0x21')](_0x5ec533['query'][_0x874f('0x21')]);}_0x405476[_0x874f('0x37')]=qs['sort'](_0x5ec533[_0x874f('0x2c')][_0x874f('0x38')]);_0x405476[_0x874f('0x39')]=qs[_0x874f('0x30')](_[_0x874f('0x3a')](_0x5ec533[_0x874f('0x2c')],_0x47358d['filters']));if(_0x3c4d37[_0x874f('0x2d')]){if(_0x3c4d37[_0x874f('0x2e')]){_0x3c4d37[_0x874f('0x2e')]=moment(_0x3c4d37[_0x874f('0x2e')])[_0x874f('0x3b')](0x1,_0x874f('0x3c'));}else{_0x3c4d37[_0x874f('0x2e')]=moment(_0x3c4d37[_0x874f('0x2d')])[_0x874f('0x3b')](0x1,_0x874f('0x3c'));}_['merge'](_0x405476['where'],{'createdAt':{'$gte':_0x3c4d37[_0x874f('0x2d')],'$lte':_0x3c4d37[_0x874f('0x2e')]}});}if(_0x5ec533[_0x874f('0x2c')][_0x874f('0x3d')]){_0x405476[_0x874f('0x39')]=_['merge'](_0x405476[_0x874f('0x39')],{'$or':_[_0x874f('0x3e')](_0x405476[_0x874f('0x34')],function(_0x41d464){var _0x3b8eab={};_0x3b8eab[_0x41d464]={'$like':'%'+_0x5ec533[_0x874f('0x2c')][_0x874f('0x3d')]+'%'};return _0x3b8eab;})});}_0x405476=_[_0x874f('0x3f')]({},_0x405476,_0x5ec533[_0x874f('0x40')]);var _0x5cc938={'where':_0x405476[_0x874f('0x39')]};return db[_0x874f('0x41')][_0x874f('0x20')](_0x5cc938)[_0x874f('0x14')](function(_0xd368b1){_0x294a4f['count']=_0xd368b1;if(_0x5ec533['query'][_0x874f('0x42')]){_0x405476[_0x874f('0x43')]=[{'all':!![]}];}return db[_0x874f('0x41')][_0x874f('0x44')](_0x405476);})['then'](function(_0x374038){_0x294a4f[_0x874f('0x45')]=_0x374038;return _0x294a4f;})['then'](respondWithFilteredResult(_0x49316f,_0x405476))[_0x874f('0x1b')](handleError(_0x49316f,null));};exports[_0x874f('0x46')]=function(_0x113867,_0xf2ed42){var _0x45d262={'raw':![],'where':{'id':_0x113867[_0x874f('0x47')]['id']}},_0x4df667={};_0x4df667[_0x874f('0x32')]=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x4df667[_0x874f('0x2c')]=_[_0x874f('0x2f')](_0x113867[_0x874f('0x2c')]);_0x4df667[_0x874f('0x30')]=_[_0x874f('0x31')](_0x4df667['model'],_0x4df667[_0x874f('0x2c')]);_0x45d262[_0x874f('0x34')]=_[_0x874f('0x31')](_0x4df667['model'],qs[_0x874f('0x33')](_0x113867['query']['fields']));_0x45d262['attributes']=_0x45d262[_0x874f('0x34')][_0x874f('0x35')]?_0x45d262[_0x874f('0x34')]:_0x4df667[_0x874f('0x32')];if(_0x113867[_0x874f('0x2c')]['includeAll']){_0x45d262[_0x874f('0x43')]=[{'all':!![]}];}_0x45d262=_[_0x874f('0x3f')]({},_0x45d262,_0x113867[_0x874f('0x40')]);return db[_0x874f('0x41')]['find'](_0x45d262)['then'](handleEntityNotFound(_0xf2ed42,null))['then'](respondWithResult(_0xf2ed42,null))[_0x874f('0x1b')](handleError(_0xf2ed42,null));};exports[_0x874f('0x48')]=function(_0x17a480,_0x2bbfe5){return db[_0x874f('0x41')][_0x874f('0x48')](_0x17a480[_0x874f('0x49')],{})['then'](respondWithResult(_0x2bbfe5,0xc9))[_0x874f('0x1b')](handleError(_0x2bbfe5,null));};exports['update']=function(_0x4b38e1,_0x308e5a){if(_0x4b38e1[_0x874f('0x49')]['id']){delete _0x4b38e1['body']['id'];}return db['DeskConfiguration'][_0x874f('0x4a')]({'where':{'id':_0x4b38e1[_0x874f('0x47')]['id']}})['then'](handleEntityNotFound(_0x308e5a,null))[_0x874f('0x14')](saveUpdates(_0x4b38e1[_0x874f('0x49')],null))[_0x874f('0x14')](respondWithResult(_0x308e5a,null))[_0x874f('0x1b')](handleError(_0x308e5a,null));};exports[_0x874f('0x4b')]=function(_0x1bac21,_0x469508){return db[_0x874f('0x41')][_0x874f('0x4a')]({'where':{'id':_0x1bac21[_0x874f('0x47')]['id']}})[_0x874f('0x14')](handleEntityNotFound(_0x469508,null))[_0x874f('0x14')](removeEntity(_0x469508,null))[_0x874f('0x1b')](handleError(_0x469508,null));};exports['getFields']=function(_0x46c188,_0x35c6e0,_0x5ede7c){var _0x1bbab0={};var _0x50f3c6={};var _0x2a1d4c;var _0x3ecb8;return db[_0x874f('0x41')]['findOne']({'where':{'id':_0x46c188[_0x874f('0x47')]['id']}})[_0x874f('0x14')](handleEntityNotFound(_0x35c6e0,null))[_0x874f('0x14')](function(_0x90b3c){if(_0x90b3c){_0x2a1d4c=_0x90b3c;_0x50f3c6[_0x874f('0x32')]=_['keys'](db['DeskField'][_0x874f('0x2b')]);_0x50f3c6['query']=_[_0x874f('0x2f')](_0x46c188['query']);_0x50f3c6[_0x874f('0x30')]=_[_0x874f('0x31')](_0x50f3c6[_0x874f('0x32')],_0x50f3c6[_0x874f('0x2c')]);_0x1bbab0[_0x874f('0x34')]=_[_0x874f('0x31')](_0x50f3c6['model'],qs[_0x874f('0x33')](_0x46c188[_0x874f('0x2c')]['fields']));_0x1bbab0[_0x874f('0x34')]=_0x1bbab0[_0x874f('0x34')][_0x874f('0x35')]?_0x1bbab0['attributes']:_0x50f3c6[_0x874f('0x32')];_0x1bbab0[_0x874f('0x37')]=qs[_0x874f('0x38')](_0x46c188[_0x874f('0x2c')]['sort']);_0x1bbab0[_0x874f('0x39')]=qs[_0x874f('0x30')](_['pick'](_0x46c188['query'],_0x50f3c6[_0x874f('0x30')]));if(_0x46c188['query'][_0x874f('0x3d')]){_0x1bbab0[_0x874f('0x39')]=_[_0x874f('0x3f')](_0x1bbab0[_0x874f('0x39')],{'$or':_[_0x874f('0x3e')](_0x1bbab0[_0x874f('0x34')],function(_0x2da277){var _0x39666c={};_0x39666c[_0x2da277]={'$like':'%'+_0x46c188[_0x874f('0x2c')]['filter']+'%'};return _0x39666c;})});}_0x1bbab0=_[_0x874f('0x3f')]({},_0x1bbab0,_0x46c188[_0x874f('0x40')]);return _0x2a1d4c[_0x874f('0x4c')](_0x1bbab0);}})[_0x874f('0x14')](function(_0x320118){if(_0x320118){_0x3ecb8=_0x320118['length'];if(!_0x46c188['query']['hasOwnProperty'](_0x874f('0x36'))){_0x1bbab0['limit']=qs[_0x874f('0x22')](_0x46c188[_0x874f('0x2c')][_0x874f('0x22')]);_0x1bbab0[_0x874f('0x21')]=qs[_0x874f('0x21')](_0x46c188['query'][_0x874f('0x21')]);}return _0x2a1d4c[_0x874f('0x4c')](_0x1bbab0);}})[_0x874f('0x14')](function(_0x19da90){if(_0x19da90){return _0x19da90?{'count':_0x3ecb8,'rows':_0x19da90}:null;}})['then'](respondWithResult(_0x35c6e0,null))[_0x874f('0x1b')](handleError(_0x35c6e0,null));};exports['getSubjects']=function(_0x1e1782,_0x52dd23,_0x4a4cf0){var _0x4f7591={};var _0x175102={};var _0x19b3e6;var _0x1158c6;return db[_0x874f('0x41')][_0x874f('0x4d')]({'where':{'id':_0x1e1782[_0x874f('0x47')]['id']}})[_0x874f('0x14')](handleEntityNotFound(_0x52dd23,null))['then'](function(_0x378a8e){if(_0x378a8e){_0x19b3e6=_0x378a8e;_0x175102['model']=_['keys'](db[_0x874f('0x4e')][_0x874f('0x2b')]);_0x175102[_0x874f('0x2c')]=_[_0x874f('0x2f')](_0x1e1782[_0x874f('0x2c')]);_0x175102['filters']=_[_0x874f('0x31')](_0x175102[_0x874f('0x32')],_0x175102['query']);_0x4f7591[_0x874f('0x34')]=_[_0x874f('0x31')](_0x175102[_0x874f('0x32')],qs[_0x874f('0x33')](_0x1e1782[_0x874f('0x2c')][_0x874f('0x33')]));_0x4f7591[_0x874f('0x34')]=_0x4f7591['attributes'][_0x874f('0x35')]?_0x4f7591[_0x874f('0x34')]:_0x175102[_0x874f('0x32')];_0x4f7591['order']=qs['sort'](_0x1e1782[_0x874f('0x2c')][_0x874f('0x38')]);_0x4f7591['where']=qs['filters'](_[_0x874f('0x3a')](_0x1e1782[_0x874f('0x2c')],_0x175102[_0x874f('0x30')]));if(_0x1e1782['query'][_0x874f('0x3d')]){_0x4f7591[_0x874f('0x39')]=_[_0x874f('0x3f')](_0x4f7591['where'],{'$or':_[_0x874f('0x3e')](_0x4f7591[_0x874f('0x34')],function(_0x5d0f6b){var _0x20b12d={};_0x20b12d[_0x5d0f6b]={'$like':'%'+_0x1e1782[_0x874f('0x2c')][_0x874f('0x3d')]+'%'};return _0x20b12d;})});}_0x4f7591=_[_0x874f('0x3f')]({},_0x4f7591,_0x1e1782[_0x874f('0x40')]);return _0x19b3e6[_0x874f('0x4f')](_0x4f7591);}})['then'](function(_0x483de0){if(_0x483de0){_0x1158c6=_0x483de0[_0x874f('0x35')];if(!_0x1e1782['query'][_0x874f('0x50')](_0x874f('0x36'))){_0x4f7591[_0x874f('0x22')]=qs[_0x874f('0x22')](_0x1e1782[_0x874f('0x2c')][_0x874f('0x22')]);_0x4f7591['offset']=qs[_0x874f('0x21')](_0x1e1782['query'][_0x874f('0x21')]);}return _0x19b3e6[_0x874f('0x4f')](_0x4f7591);}})['then'](function(_0xcbbaee){if(_0xcbbaee){return _0xcbbaee?{'count':_0x1158c6,'rows':_0xcbbaee}:null;}})[_0x874f('0x14')](respondWithResult(_0x52dd23,null))['catch'](handleError(_0x52dd23,null));};exports[_0x874f('0x51')]=function(_0x3019e1,_0x411eef,_0x5099b3){var _0x48b649={};var _0x108a5e={};var _0x1e9906;var _0x26fd87;return db[_0x874f('0x41')][_0x874f('0x4d')]({'where':{'id':_0x3019e1[_0x874f('0x47')]['id']}})['then'](handleEntityNotFound(_0x411eef,null))['then'](function(_0x643e86){if(_0x643e86){_0x1e9906=_0x643e86;_0x108a5e[_0x874f('0x32')]=_['keys'](db['DeskField']['rawAttributes']);_0x108a5e[_0x874f('0x2c')]=_[_0x874f('0x2f')](_0x3019e1[_0x874f('0x2c')]);_0x108a5e[_0x874f('0x30')]=_[_0x874f('0x31')](_0x108a5e['model'],_0x108a5e[_0x874f('0x2c')]);_0x48b649[_0x874f('0x34')]=_['intersection'](_0x108a5e[_0x874f('0x32')],qs[_0x874f('0x33')](_0x3019e1[_0x874f('0x2c')][_0x874f('0x33')]));_0x48b649[_0x874f('0x34')]=_0x48b649[_0x874f('0x34')][_0x874f('0x35')]?_0x48b649['attributes']:_0x108a5e[_0x874f('0x32')];_0x48b649[_0x874f('0x37')]=qs[_0x874f('0x38')](_0x3019e1[_0x874f('0x2c')][_0x874f('0x38')]);_0x48b649['where']=qs[_0x874f('0x30')](_['pick'](_0x3019e1[_0x874f('0x2c')],_0x108a5e[_0x874f('0x30')]));if(_0x3019e1[_0x874f('0x2c')][_0x874f('0x3d')]){_0x48b649[_0x874f('0x39')]=_[_0x874f('0x3f')](_0x48b649['where'],{'$or':_['map'](_0x48b649[_0x874f('0x34')],function(_0x3d3185){var _0x401bd6={};_0x401bd6[_0x3d3185]={'$like':'%'+_0x3019e1['query']['filter']+'%'};return _0x401bd6;})});}_0x48b649=_['merge']({},_0x48b649,_0x3019e1[_0x874f('0x40')]);return _0x1e9906[_0x874f('0x51')](_0x48b649);}})[_0x874f('0x14')](function(_0x46551a){if(_0x46551a){_0x26fd87=_0x46551a[_0x874f('0x35')];if(!_0x3019e1[_0x874f('0x2c')][_0x874f('0x50')](_0x874f('0x36'))){_0x48b649[_0x874f('0x22')]=qs[_0x874f('0x22')](_0x3019e1[_0x874f('0x2c')]['limit']);_0x48b649[_0x874f('0x21')]=qs[_0x874f('0x21')](_0x3019e1[_0x874f('0x2c')][_0x874f('0x21')]);}return _0x1e9906[_0x874f('0x51')](_0x48b649);}})[_0x874f('0x14')](function(_0x30405d){if(_0x30405d){return _0x30405d?{'count':_0x26fd87,'rows':_0x30405d}:null;}})[_0x874f('0x14')](respondWithResult(_0x411eef,null))[_0x874f('0x1b')](handleError(_0x411eef,null));};exports['getTags']=function(_0x26b169,_0x5f0ac8,_0x30abcc){var _0x46024={};var _0xb499f4={};var _0x311bf3;var _0x5d4cb2;return db['DeskConfiguration']['findOne']({'where':{'id':_0x26b169[_0x874f('0x47')]['id']}})[_0x874f('0x14')](handleEntityNotFound(_0x5f0ac8,null))[_0x874f('0x14')](function(_0x44e619){if(_0x44e619){_0x311bf3=_0x44e619;_0xb499f4[_0x874f('0x32')]=_['keys'](db['Tag'][_0x874f('0x2b')]);_0xb499f4[_0x874f('0x2c')]=_[_0x874f('0x2f')](_0x26b169['query']);_0xb499f4['filters']=_[_0x874f('0x31')](_0xb499f4[_0x874f('0x32')],_0xb499f4[_0x874f('0x2c')]);_0x46024['attributes']=_['intersection'](_0xb499f4[_0x874f('0x32')],qs['fields'](_0x26b169[_0x874f('0x2c')][_0x874f('0x33')]));_0x46024[_0x874f('0x34')]=_0x46024[_0x874f('0x34')]['length']?_0x46024[_0x874f('0x34')]:_0xb499f4['model'];_0x46024[_0x874f('0x37')]=qs[_0x874f('0x38')](_0x26b169[_0x874f('0x2c')][_0x874f('0x38')]);_0x46024[_0x874f('0x39')]=qs[_0x874f('0x30')](_[_0x874f('0x3a')](_0x26b169[_0x874f('0x2c')],_0xb499f4[_0x874f('0x30')]));if(_0x26b169['query'][_0x874f('0x3d')]){_0x46024[_0x874f('0x39')]=_['merge'](_0x46024['where'],{'$or':_[_0x874f('0x3e')](_0x46024[_0x874f('0x34')],function(_0x308498){var _0x13146c={};_0x13146c[_0x308498]={'$like':'%'+_0x26b169[_0x874f('0x2c')][_0x874f('0x3d')]+'%'};return _0x13146c;})});}_0x46024=_[_0x874f('0x3f')]({},_0x46024,_0x26b169[_0x874f('0x40')]);return _0x311bf3[_0x874f('0x52')](_0x46024);}})['then'](function(_0x335cc0){if(_0x335cc0){_0x5d4cb2=_0x335cc0['length'];if(!_0x26b169['query'][_0x874f('0x50')]('nolimit')){_0x46024['limit']=qs[_0x874f('0x22')](_0x26b169[_0x874f('0x2c')]['limit']);_0x46024['offset']=qs['offset'](_0x26b169[_0x874f('0x2c')][_0x874f('0x21')]);}return _0x311bf3[_0x874f('0x52')](_0x46024);}})[_0x874f('0x14')](function(_0x41f2d7){if(_0x41f2d7){return _0x41f2d7?{'count':_0x5d4cb2,'rows':_0x41f2d7}:null;}})['then'](respondWithResult(_0x5f0ac8,null))[_0x874f('0x1b')](handleError(_0x5f0ac8,null));};exports[_0x874f('0x53')]=function(_0x4ea506,_0x55271a,_0x1e342a){if(_0x4ea506[_0x874f('0x49')]['id']){delete _0x4ea506[_0x874f('0x49')]['id'];}return db[_0x874f('0x41')][_0x874f('0x4d')]({'where':{'id':_0x4ea506['params']['id']}})[_0x874f('0x14')](handleEntityNotFound(_0x55271a,null))['then'](function(_0x57ea77){if(_0x57ea77){return _0x57ea77[_0x874f('0x53')](_0x4ea506[_0x874f('0x49')]['ids']||[]);}return null;})[_0x874f('0x14')](respondWithResult(_0x55271a,null))['catch'](handleError(_0x55271a,null));}; \ No newline at end of file +var _0xf87e=['filters','intersection','attributes','fields','length','order','sort','where','add','day','merge','filter','map','DeskConfiguration','includeAll','include','findAll','rows','show','options','find','create','body','params','getFields','findOne','DeskField','pick','nolimit','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','fast-json-patch','moment','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd'];(function(_0x3e70a9,_0x55bf56){var _0x6a1474=function(_0x100f04){while(--_0x100f04){_0x3e70a9['push'](_0x3e70a9['shift']());}};_0x6a1474(++_0x55bf56);}(_0xf87e,0x12c));var _0xef87=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xf87e[_0xc0a3d3];return _0x3386e8;};'use strict';var jsonpatch=require(_0xef87('0x0'));var rp=require('request-promise');var moment=require(_0xef87('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xef87('0x2'));var ejs=require(_0xef87('0x3'));var fs=require('fs');var _=require(_0xef87('0x4'));var squel=require('squel');var crypto=require(_0xef87('0x5'));var jsforce=require(_0xef87('0x6'));var deskjs=require(_0xef87('0x7'));var toCsv=require(_0xef87('0x2'));var querystring=require(_0xef87('0x8'));var Papa=require('papaparse');var qs=require(_0xef87('0x9'));var logger=require('../../config/logger')(_0xef87('0xa'));var utils=require(_0xef87('0xb'));var config=require('../../config/environment');var db=require(_0xef87('0xc'))['db'];var jayson=require(_0xef87('0xd'));var client=jayson[_0xef87('0xe')][_0xef87('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x5ee0ad,_0x1a6acf,_0xb0f8d4,_0x4d8057){return new BPromise(function(_0x2f8c66,_0x1cfdf8){var _0x455b18=_0x4d8057||client;return _0x455b18[_0xef87('0x10')](_0x5ee0ad,_0xb0f8d4)[_0xef87('0x11')](function(_0x2c2aff){logger[_0xef87('0x12')](_0xef87('0x13'),_0x1a6acf,_0xef87('0x14'));logger['debug'](_0xef87('0x15'),_0x1a6acf,_0xef87('0x14'),JSON[_0xef87('0x16')](_0x2c2aff));if(_0x2c2aff[_0xef87('0x17')]){if(_0x2c2aff['error'][_0xef87('0x18')]===0x1f4){logger[_0xef87('0x17')](_0xef87('0x13'),_0x1a6acf,_0x2c2aff[_0xef87('0x17')][_0xef87('0x19')]);return _0x1cfdf8(_0x2c2aff[_0xef87('0x17')][_0xef87('0x19')]);}logger['error'](_0xef87('0x13'),_0x1a6acf,_0x2c2aff[_0xef87('0x17')][_0xef87('0x19')]);return _0x2f8c66(_0x2c2aff[_0xef87('0x17')][_0xef87('0x19')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x1a6acf,_0xef87('0x14'));_0x2f8c66(_0x2c2aff[_0xef87('0x1a')]['message']);}})[_0xef87('0x1b')](function(_0x3d149a){logger[_0xef87('0x17')](_0xef87('0x13'),_0x1a6acf,_0x3d149a);_0x1cfdf8(_0x3d149a);});});}function respondWithStatusCode(_0x4564d1,_0x1669e5){_0x1669e5=_0x1669e5||0xcc;return function(_0x17edfa){if(_0x17edfa){return _0x4564d1[_0xef87('0x1c')](_0x1669e5);}return _0x4564d1[_0xef87('0x1d')](_0x1669e5)[_0xef87('0x1e')]();};}function respondWithResult(_0x59ea8c,_0x40a553){_0x40a553=_0x40a553||0xc8;return function(_0x22845e){if(_0x22845e){return _0x59ea8c[_0xef87('0x1d')](_0x40a553)[_0xef87('0x1f')](_0x22845e);}};}function respondWithFilteredResult(_0x1bad62,_0x346805){return function(_0x4f7f99){if(_0x4f7f99){var _0xc2dc06=_0x4f7f99[_0xef87('0x20')],_0x205e96=_0x346805[_0xef87('0x21')],_0x459b1f=_0x346805[_0xef87('0x21')]+_0x346805[_0xef87('0x22')],_0x4f3b77;if(_0x459b1f>=_0xc2dc06){_0x459b1f=_0xc2dc06;_0x4f3b77=0xc8;}else{_0x4f3b77=0xce;}_0x1bad62[_0xef87('0x1d')](_0x4f3b77);return _0x1bad62[_0xef87('0x23')](_0xef87('0x24'),_0x205e96+'-'+_0x459b1f+'/'+_0xc2dc06)[_0xef87('0x1f')](_0x4f7f99);}return null;};}function patchUpdates(_0x142f36){return function(_0x37e805){try{jsonpatch[_0xef87('0x25')](_0x37e805,_0x142f36,!![]);}catch(_0x354fa9){return BPromise[_0xef87('0x26')](_0x354fa9);}return _0x37e805[_0xef87('0x27')]();};}function saveUpdates(_0x4570f4,_0x4c7561){return function(_0x499b7b){if(_0x499b7b){return _0x499b7b[_0xef87('0x28')](_0x4570f4)[_0xef87('0x11')](function(_0x2dece3){return _0x2dece3;});}return null;};}function removeEntity(_0x593860,_0x501b80){return function(_0x4a975d){if(_0x4a975d){return _0x4a975d[_0xef87('0x29')]()['then'](function(){_0x593860[_0xef87('0x1d')](0xcc)[_0xef87('0x1e')]();});}};}function handleEntityNotFound(_0x3a1119,_0x1d1762){return function(_0x42b45f){if(!_0x42b45f){_0x3a1119[_0xef87('0x1c')](0x194);}return _0x42b45f;};}function handleError(_0x1c9b6d,_0x17f43d){_0x17f43d=_0x17f43d||0x1f4;return function(_0x5ddd0b){logger[_0xef87('0x17')](_0x5ddd0b[_0xef87('0x2a')]);if(_0x5ddd0b['name']){delete _0x5ddd0b[_0xef87('0x2b')];}_0x1c9b6d[_0xef87('0x1d')](_0x17f43d)[_0xef87('0x2c')](_0x5ddd0b);};}exports[_0xef87('0x2d')]=function(_0x276914,_0x5c5a2a){var _0x16dad8={},_0x21627a={},_0x45384c={'count':0x0,'rows':[]};var _0x20c77d=db['DeskConfiguration'][_0xef87('0x2e')];_0x21627a[_0xef87('0x2f')]=_[_0xef87('0x30')](_0x20c77d);var _0x3ba8c7={'dateStart':_0x276914[_0xef87('0x31')][_0xef87('0x32')],'dateEnd':_0x276914[_0xef87('0x31')][_0xef87('0x33')]};delete _0x276914[_0xef87('0x31')][_0xef87('0x32')];delete _0x276914['query'][_0xef87('0x33')];_0x21627a[_0xef87('0x31')]=_[_0xef87('0x30')](_0x276914[_0xef87('0x31')]);_0x21627a[_0xef87('0x34')]=_[_0xef87('0x35')](_0x21627a['model'],_0x21627a[_0xef87('0x31')]);_0x16dad8[_0xef87('0x36')]=_[_0xef87('0x35')](_0x21627a[_0xef87('0x2f')],qs['fields'](_0x276914[_0xef87('0x31')][_0xef87('0x37')]));_0x16dad8[_0xef87('0x36')]=_0x16dad8[_0xef87('0x36')][_0xef87('0x38')]?_0x16dad8['attributes']:_0x21627a[_0xef87('0x2f')];if(!_0x276914[_0xef87('0x31')]['hasOwnProperty']('nolimit')){_0x16dad8[_0xef87('0x22')]=qs[_0xef87('0x22')](_0x276914[_0xef87('0x31')]['limit']);_0x16dad8['offset']=qs[_0xef87('0x21')](_0x276914['query'][_0xef87('0x21')]);}_0x16dad8[_0xef87('0x39')]=qs[_0xef87('0x3a')](_0x276914[_0xef87('0x31')][_0xef87('0x3a')]);_0x16dad8[_0xef87('0x3b')]=qs[_0xef87('0x34')](_['pick'](_0x276914[_0xef87('0x31')],_0x21627a[_0xef87('0x34')]));if(_0x3ba8c7['dateStart']){if(_0x3ba8c7[_0xef87('0x33')]){_0x3ba8c7['dateEnd']=moment(_0x3ba8c7[_0xef87('0x33')])[_0xef87('0x3c')](0x1,_0xef87('0x3d'));}else{_0x3ba8c7[_0xef87('0x33')]=moment(_0x3ba8c7[_0xef87('0x32')])['add'](0x1,_0xef87('0x3d'));}_[_0xef87('0x3e')](_0x16dad8[_0xef87('0x3b')],{'createdAt':{'$gte':_0x3ba8c7[_0xef87('0x32')],'$lte':_0x3ba8c7[_0xef87('0x33')]}});}if(_0x276914['query'][_0xef87('0x3f')]){_0x16dad8[_0xef87('0x3b')]=_['merge'](_0x16dad8['where'],{'$or':_[_0xef87('0x40')](_0x16dad8[_0xef87('0x36')],function(_0x5a6f2b){var _0x40a692={};_0x40a692[_0x5a6f2b]={'$like':'%'+_0x276914['query']['filter']+'%'};return _0x40a692;})});}_0x16dad8=_[_0xef87('0x3e')]({},_0x16dad8,_0x276914['options']);var _0x1c307a={'where':_0x16dad8['where']};return db[_0xef87('0x41')]['count'](_0x1c307a)[_0xef87('0x11')](function(_0x1b9618){_0x45384c['count']=_0x1b9618;if(_0x276914[_0xef87('0x31')][_0xef87('0x42')]){_0x16dad8[_0xef87('0x43')]=[{'all':!![]}];}return db[_0xef87('0x41')][_0xef87('0x44')](_0x16dad8);})['then'](function(_0x1bfcf0){_0x45384c[_0xef87('0x45')]=_0x1bfcf0;return _0x45384c;})['then'](respondWithFilteredResult(_0x5c5a2a,_0x16dad8))[_0xef87('0x1b')](handleError(_0x5c5a2a,null));};exports[_0xef87('0x46')]=function(_0x392df,_0x51f027){var _0x35ceee={'raw':![],'where':{'id':_0x392df['params']['id']}},_0x2a909e={};_0x2a909e[_0xef87('0x2f')]=_[_0xef87('0x30')](db[_0xef87('0x41')][_0xef87('0x2e')]);_0x2a909e[_0xef87('0x31')]=_['keys'](_0x392df[_0xef87('0x31')]);_0x2a909e[_0xef87('0x34')]=_[_0xef87('0x35')](_0x2a909e['model'],_0x2a909e[_0xef87('0x31')]);_0x35ceee[_0xef87('0x36')]=_['intersection'](_0x2a909e['model'],qs['fields'](_0x392df['query'][_0xef87('0x37')]));_0x35ceee[_0xef87('0x36')]=_0x35ceee[_0xef87('0x36')][_0xef87('0x38')]?_0x35ceee[_0xef87('0x36')]:_0x2a909e[_0xef87('0x2f')];if(_0x392df['query']['includeAll']){_0x35ceee['include']=[{'all':!![]}];}_0x35ceee=_[_0xef87('0x3e')]({},_0x35ceee,_0x392df[_0xef87('0x47')]);return db['DeskConfiguration'][_0xef87('0x48')](_0x35ceee)[_0xef87('0x11')](handleEntityNotFound(_0x51f027,null))[_0xef87('0x11')](respondWithResult(_0x51f027,null))['catch'](handleError(_0x51f027,null));};exports[_0xef87('0x49')]=function(_0x146b84,_0x2f6483){return db[_0xef87('0x41')][_0xef87('0x49')](_0x146b84[_0xef87('0x4a')],{})[_0xef87('0x11')](respondWithResult(_0x2f6483,0xc9))[_0xef87('0x1b')](handleError(_0x2f6483,null));};exports['update']=function(_0x371039,_0xe28d38){if(_0x371039['body']['id']){delete _0x371039[_0xef87('0x4a')]['id'];}return db[_0xef87('0x41')]['find']({'where':{'id':_0x371039['params']['id']}})[_0xef87('0x11')](handleEntityNotFound(_0xe28d38,null))[_0xef87('0x11')](saveUpdates(_0x371039[_0xef87('0x4a')],null))['then'](respondWithResult(_0xe28d38,null))[_0xef87('0x1b')](handleError(_0xe28d38,null));};exports[_0xef87('0x29')]=function(_0x394a26,_0x51597c){return db[_0xef87('0x41')][_0xef87('0x48')]({'where':{'id':_0x394a26[_0xef87('0x4b')]['id']}})[_0xef87('0x11')](handleEntityNotFound(_0x51597c,null))[_0xef87('0x11')](removeEntity(_0x51597c,null))[_0xef87('0x1b')](handleError(_0x51597c,null));};exports[_0xef87('0x4c')]=function(_0x2dc895,_0x2b305d,_0x11c242){var _0x117d6c={};var _0x2dffbb={};var _0x36596a;var _0x5477f5;return db['DeskConfiguration'][_0xef87('0x4d')]({'where':{'id':_0x2dc895['params']['id']}})['then'](handleEntityNotFound(_0x2b305d,null))[_0xef87('0x11')](function(_0x2fb845){if(_0x2fb845){_0x36596a=_0x2fb845;_0x2dffbb[_0xef87('0x2f')]=_[_0xef87('0x30')](db[_0xef87('0x4e')][_0xef87('0x2e')]);_0x2dffbb['query']=_[_0xef87('0x30')](_0x2dc895[_0xef87('0x31')]);_0x2dffbb[_0xef87('0x34')]=_['intersection'](_0x2dffbb[_0xef87('0x2f')],_0x2dffbb[_0xef87('0x31')]);_0x117d6c[_0xef87('0x36')]=_[_0xef87('0x35')](_0x2dffbb[_0xef87('0x2f')],qs[_0xef87('0x37')](_0x2dc895['query'][_0xef87('0x37')]));_0x117d6c['attributes']=_0x117d6c['attributes'][_0xef87('0x38')]?_0x117d6c[_0xef87('0x36')]:_0x2dffbb[_0xef87('0x2f')];_0x117d6c[_0xef87('0x39')]=qs[_0xef87('0x3a')](_0x2dc895['query'][_0xef87('0x3a')]);_0x117d6c['where']=qs[_0xef87('0x34')](_[_0xef87('0x4f')](_0x2dc895[_0xef87('0x31')],_0x2dffbb[_0xef87('0x34')]));if(_0x2dc895[_0xef87('0x31')][_0xef87('0x3f')]){_0x117d6c[_0xef87('0x3b')]=_[_0xef87('0x3e')](_0x117d6c[_0xef87('0x3b')],{'$or':_[_0xef87('0x40')](_0x117d6c['attributes'],function(_0xe44c1a){var _0x59d666={};_0x59d666[_0xe44c1a]={'$like':'%'+_0x2dc895[_0xef87('0x31')][_0xef87('0x3f')]+'%'};return _0x59d666;})});}_0x117d6c=_[_0xef87('0x3e')]({},_0x117d6c,_0x2dc895[_0xef87('0x47')]);return _0x36596a[_0xef87('0x4c')](_0x117d6c);}})[_0xef87('0x11')](function(_0x5e977b){if(_0x5e977b){_0x5477f5=_0x5e977b['length'];if(!_0x2dc895['query']['hasOwnProperty'](_0xef87('0x50'))){_0x117d6c[_0xef87('0x22')]=qs[_0xef87('0x22')](_0x2dc895[_0xef87('0x31')][_0xef87('0x22')]);_0x117d6c[_0xef87('0x21')]=qs['offset'](_0x2dc895[_0xef87('0x31')][_0xef87('0x21')]);}return _0x36596a[_0xef87('0x4c')](_0x117d6c);}})[_0xef87('0x11')](function(_0x5b602c){if(_0x5b602c){return _0x5b602c?{'count':_0x5477f5,'rows':_0x5b602c}:null;}})[_0xef87('0x11')](respondWithResult(_0x2b305d,null))[_0xef87('0x1b')](handleError(_0x2b305d,null));};exports['getSubjects']=function(_0x26a777,_0xfaaff7,_0x23e828){var _0x1360d1={};var _0x4384d3={};var _0xb34221;var _0x516390;return db[_0xef87('0x41')][_0xef87('0x4d')]({'where':{'id':_0x26a777[_0xef87('0x4b')]['id']}})['then'](handleEntityNotFound(_0xfaaff7,null))[_0xef87('0x11')](function(_0x3beb77){if(_0x3beb77){_0xb34221=_0x3beb77;_0x4384d3[_0xef87('0x2f')]=_[_0xef87('0x30')](db[_0xef87('0x4e')][_0xef87('0x2e')]);_0x4384d3[_0xef87('0x31')]=_[_0xef87('0x30')](_0x26a777[_0xef87('0x31')]);_0x4384d3[_0xef87('0x34')]=_[_0xef87('0x35')](_0x4384d3[_0xef87('0x2f')],_0x4384d3[_0xef87('0x31')]);_0x1360d1[_0xef87('0x36')]=_[_0xef87('0x35')](_0x4384d3['model'],qs[_0xef87('0x37')](_0x26a777['query']['fields']));_0x1360d1[_0xef87('0x36')]=_0x1360d1[_0xef87('0x36')]['length']?_0x1360d1['attributes']:_0x4384d3[_0xef87('0x2f')];_0x1360d1[_0xef87('0x39')]=qs[_0xef87('0x3a')](_0x26a777[_0xef87('0x31')][_0xef87('0x3a')]);_0x1360d1['where']=qs[_0xef87('0x34')](_[_0xef87('0x4f')](_0x26a777[_0xef87('0x31')],_0x4384d3[_0xef87('0x34')]));if(_0x26a777[_0xef87('0x31')][_0xef87('0x3f')]){_0x1360d1[_0xef87('0x3b')]=_[_0xef87('0x3e')](_0x1360d1[_0xef87('0x3b')],{'$or':_[_0xef87('0x40')](_0x1360d1[_0xef87('0x36')],function(_0x5276c5){var _0x3a265c={};_0x3a265c[_0x5276c5]={'$like':'%'+_0x26a777[_0xef87('0x31')][_0xef87('0x3f')]+'%'};return _0x3a265c;})});}_0x1360d1=_[_0xef87('0x3e')]({},_0x1360d1,_0x26a777['options']);return _0xb34221[_0xef87('0x51')](_0x1360d1);}})[_0xef87('0x11')](function(_0x2d0e39){if(_0x2d0e39){_0x516390=_0x2d0e39['length'];if(!_0x26a777[_0xef87('0x31')][_0xef87('0x52')](_0xef87('0x50'))){_0x1360d1['limit']=qs[_0xef87('0x22')](_0x26a777[_0xef87('0x31')][_0xef87('0x22')]);_0x1360d1[_0xef87('0x21')]=qs[_0xef87('0x21')](_0x26a777[_0xef87('0x31')]['offset']);}return _0xb34221[_0xef87('0x51')](_0x1360d1);}})[_0xef87('0x11')](function(_0x369416){if(_0x369416){return _0x369416?{'count':_0x516390,'rows':_0x369416}:null;}})[_0xef87('0x11')](respondWithResult(_0xfaaff7,null))[_0xef87('0x1b')](handleError(_0xfaaff7,null));};exports[_0xef87('0x53')]=function(_0x4d571c,_0x2d1e8b,_0x18fbc9){var _0x174ee5={};var _0x393fc6={};var _0x4a6125;var _0xf39432;return db[_0xef87('0x41')]['findOne']({'where':{'id':_0x4d571c[_0xef87('0x4b')]['id']}})[_0xef87('0x11')](handleEntityNotFound(_0x2d1e8b,null))[_0xef87('0x11')](function(_0x488dff){if(_0x488dff){_0x4a6125=_0x488dff;_0x393fc6[_0xef87('0x2f')]=_['keys'](db[_0xef87('0x4e')][_0xef87('0x2e')]);_0x393fc6[_0xef87('0x31')]=_[_0xef87('0x30')](_0x4d571c[_0xef87('0x31')]);_0x393fc6[_0xef87('0x34')]=_[_0xef87('0x35')](_0x393fc6[_0xef87('0x2f')],_0x393fc6[_0xef87('0x31')]);_0x174ee5['attributes']=_[_0xef87('0x35')](_0x393fc6['model'],qs[_0xef87('0x37')](_0x4d571c[_0xef87('0x31')]['fields']));_0x174ee5['attributes']=_0x174ee5[_0xef87('0x36')][_0xef87('0x38')]?_0x174ee5[_0xef87('0x36')]:_0x393fc6[_0xef87('0x2f')];_0x174ee5[_0xef87('0x39')]=qs[_0xef87('0x3a')](_0x4d571c[_0xef87('0x31')][_0xef87('0x3a')]);_0x174ee5[_0xef87('0x3b')]=qs['filters'](_[_0xef87('0x4f')](_0x4d571c[_0xef87('0x31')],_0x393fc6[_0xef87('0x34')]));if(_0x4d571c['query'][_0xef87('0x3f')]){_0x174ee5[_0xef87('0x3b')]=_[_0xef87('0x3e')](_0x174ee5['where'],{'$or':_[_0xef87('0x40')](_0x174ee5['attributes'],function(_0x731937){var _0x2663a2={};_0x2663a2[_0x731937]={'$like':'%'+_0x4d571c[_0xef87('0x31')]['filter']+'%'};return _0x2663a2;})});}_0x174ee5=_[_0xef87('0x3e')]({},_0x174ee5,_0x4d571c[_0xef87('0x47')]);return _0x4a6125[_0xef87('0x53')](_0x174ee5);}})[_0xef87('0x11')](function(_0x19760a){if(_0x19760a){_0xf39432=_0x19760a['length'];if(!_0x4d571c[_0xef87('0x31')][_0xef87('0x52')](_0xef87('0x50'))){_0x174ee5[_0xef87('0x22')]=qs[_0xef87('0x22')](_0x4d571c[_0xef87('0x31')][_0xef87('0x22')]);_0x174ee5[_0xef87('0x21')]=qs['offset'](_0x4d571c[_0xef87('0x31')]['offset']);}return _0x4a6125[_0xef87('0x53')](_0x174ee5);}})[_0xef87('0x11')](function(_0x4a6608){if(_0x4a6608){return _0x4a6608?{'count':_0xf39432,'rows':_0x4a6608}:null;}})[_0xef87('0x11')](respondWithResult(_0x2d1e8b,null))[_0xef87('0x1b')](handleError(_0x2d1e8b,null));};exports[_0xef87('0x54')]=function(_0x57e35f,_0x3ec542,_0x31fb5a){var _0x88c0e4={};var _0x5ea8f1={};var _0x1ee747;var _0x3c635c;return db[_0xef87('0x41')][_0xef87('0x4d')]({'where':{'id':_0x57e35f[_0xef87('0x4b')]['id']}})[_0xef87('0x11')](handleEntityNotFound(_0x3ec542,null))[_0xef87('0x11')](function(_0x308b2b){if(_0x308b2b){_0x1ee747=_0x308b2b;_0x5ea8f1['model']=_[_0xef87('0x30')](db[_0xef87('0x55')][_0xef87('0x2e')]);_0x5ea8f1[_0xef87('0x31')]=_[_0xef87('0x30')](_0x57e35f[_0xef87('0x31')]);_0x5ea8f1[_0xef87('0x34')]=_[_0xef87('0x35')](_0x5ea8f1[_0xef87('0x2f')],_0x5ea8f1[_0xef87('0x31')]);_0x88c0e4[_0xef87('0x36')]=_[_0xef87('0x35')](_0x5ea8f1[_0xef87('0x2f')],qs['fields'](_0x57e35f[_0xef87('0x31')][_0xef87('0x37')]));_0x88c0e4[_0xef87('0x36')]=_0x88c0e4[_0xef87('0x36')][_0xef87('0x38')]?_0x88c0e4['attributes']:_0x5ea8f1['model'];_0x88c0e4[_0xef87('0x39')]=qs[_0xef87('0x3a')](_0x57e35f['query'][_0xef87('0x3a')]);_0x88c0e4[_0xef87('0x3b')]=qs['filters'](_[_0xef87('0x4f')](_0x57e35f[_0xef87('0x31')],_0x5ea8f1[_0xef87('0x34')]));if(_0x57e35f[_0xef87('0x31')]['filter']){_0x88c0e4['where']=_[_0xef87('0x3e')](_0x88c0e4[_0xef87('0x3b')],{'$or':_[_0xef87('0x40')](_0x88c0e4[_0xef87('0x36')],function(_0x2004aa){var _0x1b8d0d={};_0x1b8d0d[_0x2004aa]={'$like':'%'+_0x57e35f[_0xef87('0x31')][_0xef87('0x3f')]+'%'};return _0x1b8d0d;})});}_0x88c0e4=_[_0xef87('0x3e')]({},_0x88c0e4,_0x57e35f[_0xef87('0x47')]);return _0x1ee747[_0xef87('0x54')](_0x88c0e4);}})['then'](function(_0x2dba8b){if(_0x2dba8b){_0x3c635c=_0x2dba8b[_0xef87('0x38')];if(!_0x57e35f[_0xef87('0x31')][_0xef87('0x52')](_0xef87('0x50'))){_0x88c0e4[_0xef87('0x22')]=qs[_0xef87('0x22')](_0x57e35f[_0xef87('0x31')][_0xef87('0x22')]);_0x88c0e4[_0xef87('0x21')]=qs['offset'](_0x57e35f[_0xef87('0x31')][_0xef87('0x21')]);}return _0x1ee747[_0xef87('0x54')](_0x88c0e4);}})[_0xef87('0x11')](function(_0x4bb530){if(_0x4bb530){return _0x4bb530?{'count':_0x3c635c,'rows':_0x4bb530}:null;}})[_0xef87('0x11')](respondWithResult(_0x3ec542,null))['catch'](handleError(_0x3ec542,null));};exports[_0xef87('0x56')]=function(_0x31937e,_0x338f8e,_0x818466){if(_0x31937e[_0xef87('0x4a')]['id']){delete _0x31937e[_0xef87('0x4a')]['id'];}return db['DeskConfiguration'][_0xef87('0x4d')]({'where':{'id':_0x31937e[_0xef87('0x4b')]['id']}})[_0xef87('0x11')](handleEntityNotFound(_0x338f8e,null))[_0xef87('0x11')](function(_0x577893){if(_0x577893){return _0x577893['setTags'](_0x31937e['body'][_0xef87('0x57')]||[]);}return null;})['then'](respondWithResult(_0x338f8e,null))[_0xef87('0x1b')](handleError(_0x338f8e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 4188a54..c395dd4 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 _0xd943=['../../config/logger','api','bluebird','request-promise','./intDeskConfiguration.attributes','exports','DeskConfiguration','lodash','util'];(function(_0x2c665a,_0xf9e833){var _0x320bd0=function(_0xbe2bea){while(--_0xbe2bea){_0x2c665a['push'](_0x2c665a['shift']());}};_0x320bd0(++_0xf9e833);}(_0xd943,0x15d));var _0x3d94=function(_0x9ee7cd,_0x219dcd){_0x9ee7cd=_0x9ee7cd-0x0;var _0x52ac81=_0xd943[_0x9ee7cd];return _0x52ac81;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var attributes=require(_0x3d94('0x6'));module[_0x3d94('0x7')]=function(_0xaf8962,_0x5751f6){return _0xaf8962['define'](_0x3d94('0x8'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef0f=['lodash','../../config/logger','api','moment','request-promise','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x3ebf56,_0x40b5c5){var _0x1ff378=function(_0x1b48d3){while(--_0x1b48d3){_0x3ebf56['push'](_0x3ebf56['shift']());}};_0x1ff378(++_0x40b5c5);}(_0xef0f,0x168));var _0xfef0=function(_0x22419f,_0x1ea160){_0x22419f=_0x22419f-0x0;var _0x1e1b68=_0xef0f[_0x22419f];return _0x1e1b68;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var attributes=require(_0xfef0('0x5'));module[_0xfef0('0x6')]=function(_0x4e1af6,_0x2a6fcf){return _0x4e1af6[_0xfef0('0x7')](_0xfef0('0x8'),attributes,{'tableName':_0xfef0('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 604fbba..8602d7f 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 _0xbaf0=['http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3d96b7,_0x1183b7){var _0x53899c=function(_0x28be4b){while(--_0x28be4b){_0x3d96b7['push'](_0x3d96b7['shift']());}};_0x53899c(++_0x1183b7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var db=require(_0x0baf('0x4'))['db'];var utils=require(_0x0baf('0x5'));var logger=require('../../config/logger')(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var jayson=require(_0x0baf('0x8'));var client=jayson[_0x0baf('0x9')][_0x0baf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x335e24,_0x1a10b1,_0x2dcaac){return new BPromise(function(_0x1d0a0d,_0x5f5030){return client[_0x0baf('0xb')](_0x335e24,_0x2dcaac)['then'](function(_0x4605c3){logger[_0x0baf('0xc')](_0x0baf('0xd'),_0x1a10b1,_0x0baf('0xe'));logger[_0x0baf('0xf')](_0x0baf('0x10'),_0x1a10b1,_0x0baf('0xe'),JSON[_0x0baf('0x11')](_0x4605c3));if(_0x4605c3[_0x0baf('0x12')]){if(_0x4605c3[_0x0baf('0x12')][_0x0baf('0x13')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x1a10b1,_0x4605c3[_0x0baf('0x12')][_0x0baf('0x14')]);return _0x5f5030(_0x4605c3[_0x0baf('0x12')][_0x0baf('0x14')]);}logger['error'](_0x0baf('0xd'),_0x1a10b1,_0x4605c3['error'][_0x0baf('0x14')]);return _0x1d0a0d(_0x4605c3[_0x0baf('0x12')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xc')](_0x0baf('0xd'),_0x1a10b1,_0x0baf('0xe'));_0x1d0a0d(_0x4605c3['result']['message']);}})[_0x0baf('0x15')](function(_0x38395b){logger[_0x0baf('0x12')](_0x0baf('0xd'),_0x1a10b1,_0x38395b);_0x5f5030(_0x38395b);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x45181e,_0x3fb5da){var _0x510575=function(_0x3bc23e){while(--_0x3bc23e){_0x45181e['push'](_0x45181e['shift']());}};_0x510575(++_0x3fb5da);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1fde53,_0x4e8b6c){_0x1fde53=_0x1fde53-0x0;var _0x987cce=_0xbdb7[_0x1fde53];return _0x987cce;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var db=require(_0x7bdb('0x5'))['db'];var utils=require(_0x7bdb('0x6'));var logger=require(_0x7bdb('0x7'))(_0x7bdb('0x8'));var config=require('../../config/environment');var jayson=require(_0x7bdb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xffdc86,_0x1e23a3,_0x493bde){return new BPromise(function(_0x513cba,_0x468041){return client[_0x7bdb('0xa')](_0xffdc86,_0x493bde)['then'](function(_0x4a3116){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x1e23a3,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x1e23a3,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0x4a3116));if(_0x4a3116[_0x7bdb('0x11')]){if(_0x4a3116['error']['code']===0x1f4){logger['error'](_0x7bdb('0xc'),_0x1e23a3,_0x4a3116[_0x7bdb('0x11')]['message']);return _0x468041(_0x4a3116[_0x7bdb('0x11')]['message']);}logger['error'](_0x7bdb('0xc'),_0x1e23a3,_0x4a3116[_0x7bdb('0x11')]['message']);return _0x513cba(_0x4a3116['error']['message']);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x1e23a3,_0x7bdb('0xd'));_0x513cba(_0x4a3116[_0x7bdb('0x12')][_0x7bdb('0x13')]);}})[_0x7bdb('0x14')](function(_0x3e96ac){logger[_0x7bdb('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x1e23a3,_0x3e96ac);_0x468041(_0x3e96ac);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e7ca86d..3c0d6dd 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 _0xc367=['index','/:id','show','post','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated'];(function(_0x8269ae,_0xcd8119){var _0x1e733d=function(_0x1365df){while(--_0x1365df){_0x8269ae['push'](_0x8269ae['shift']());}};_0x1e733d(++_0xcd8119);}(_0xc367,0x14b));var _0x7c36=function(_0x56f215,_0x13d7d8){_0x56f215=_0x56f215-0x0;var _0x4e141e=_0xc367[_0x56f215];return _0x4e141e;};'use strict';var multer=require(_0x7c36('0x0'));var util=require(_0x7c36('0x1'));var path=require(_0x7c36('0x2'));var express=require(_0x7c36('0x3'));var router=express[_0x7c36('0x4')]();var auth=require(_0x7c36('0x5'));var interaction=require(_0x7c36('0x6'));var config=require(_0x7c36('0x7'));var controller=require(_0x7c36('0x8'));router[_0x7c36('0x9')]('/',auth[_0x7c36('0xa')](),controller[_0x7c36('0xb')]);router[_0x7c36('0x9')](_0x7c36('0xc'),auth[_0x7c36('0xa')](),controller[_0x7c36('0xd')]);router[_0x7c36('0xe')]('/',auth[_0x7c36('0xa')](),controller['create']);router[_0x7c36('0xf')](_0x7c36('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7c36('0xc'),auth['isAuthenticated'](),controller[_0x7c36('0x10')]);module[_0x7c36('0x11')]=router; \ No newline at end of file +var _0x19a2=['isAuthenticated','index','/:id','show','post','create','delete','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x19a2,0x124));var _0x219a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x19a2[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x219a('0x0'));var util=require('util');var path=require(_0x219a('0x1'));var express=require(_0x219a('0x2'));var router=express['Router']();var auth=require(_0x219a('0x3'));var interaction=require(_0x219a('0x4'));var config=require(_0x219a('0x5'));var controller=require(_0x219a('0x6'));router[_0x219a('0x7')]('/',auth[_0x219a('0x8')](),controller[_0x219a('0x9')]);router['get'](_0x219a('0xa'),auth[_0x219a('0x8')](),controller[_0x219a('0xb')]);router[_0x219a('0xc')]('/',auth['isAuthenticated'](),controller[_0x219a('0xd')]);router['put'](_0x219a('0xa'),auth[_0x219a('0x8')](),controller['update']);router[_0x219a('0xe')]('/:id',auth[_0x219a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index cbdb72c..fd86623 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 _0x0bb5=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x0bb5,0x148));var _0x50bb=function(_0x2d60aa,_0x4323c2){_0x2d60aa=_0x2d60aa-0x0;var _0x3512d3=_0x0bb5[_0x2d60aa];return _0x3512d3;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x50bb('0x2'),_0x50bb('0x3'),_0x50bb('0x4')),'defaultValue':_0x50bb('0x5')},'content':{'type':Sequelize[_0x50bb('0x6')]},'key':{'type':Sequelize[_0x50bb('0x6')]},'keyType':{'type':Sequelize[_0x50bb('0x7')](_0x50bb('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x50bb('0x6')]},'idField':{'type':Sequelize[_0x50bb('0x6')]},'nameField':{'type':Sequelize[_0x50bb('0x6')]},'customField':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x878f=['exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x22002f,_0x48489a){var _0x465db2=function(_0xfae14c){while(--_0xfae14c){_0x22002f['push'](_0x22002f['shift']());}};_0x465db2(++_0x48489a);}(_0x878f,0x173));var _0xf878=function(_0xb59e47,_0x15a94b){_0xb59e47=_0xb59e47-0x0;var _0x366b4c=_0x878f[_0xb59e47];return _0x366b4c;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'type':{'type':Sequelize[_0xf878('0x1')](_0xf878('0x2'),_0xf878('0x3'),_0xf878('0x4'),_0xf878('0x5')),'defaultValue':_0xf878('0x2')},'content':{'type':Sequelize[_0xf878('0x6')]},'key':{'type':Sequelize[_0xf878('0x6')]},'keyType':{'type':Sequelize[_0xf878('0x1')](_0xf878('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf878('0x6')]},'idField':{'type':Sequelize[_0xf878('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5fd8e24..b774931 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 _0x5a13=['include','find','create','body','params','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','error','name','DeskField','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','includeAll','findAll','rows','catch','show'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5a13,0x145));var _0x35a1=function(_0x455ba3,_0x46023e){_0x455ba3=_0x455ba3-0x0;var _0x4cbc86=_0x5a13[_0x455ba3];return _0x4cbc86;};'use strict';var jsonpatch=require(_0x35a1('0x0'));var rp=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var Mustache=require(_0x35a1('0x3'));var util=require(_0x35a1('0x4'));var path=require(_0x35a1('0x5'));var sox=require(_0x35a1('0x6'));var csv=require(_0x35a1('0x7'));var ejs=require(_0x35a1('0x8'));var fs=require('fs');var _=require(_0x35a1('0x9'));var squel=require(_0x35a1('0xa'));var crypto=require(_0x35a1('0xb'));var jsforce=require(_0x35a1('0xc'));var deskjs=require(_0x35a1('0xd'));var toCsv=require(_0x35a1('0x7'));var querystring=require(_0x35a1('0xe'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x35a1('0xf'));var utils=require(_0x35a1('0x10'));var config=require('../../config/environment');var db=require(_0x35a1('0x11'))['db'];function respondWithStatusCode(_0x2e20d3,_0x596669){_0x596669=_0x596669||0xcc;return function(_0x50c56e){if(_0x50c56e){return _0x2e20d3[_0x35a1('0x12')](_0x596669);}return _0x2e20d3[_0x35a1('0x13')](_0x596669)['end']();};}function respondWithResult(_0x51f03b,_0x25c630){_0x25c630=_0x25c630||0xc8;return function(_0x4df4be){if(_0x4df4be){return _0x51f03b[_0x35a1('0x13')](_0x25c630)['json'](_0x4df4be);}};}function respondWithFilteredResult(_0x21098a,_0x17be2a){return function(_0x395aef){if(_0x395aef){var _0x28a180=_0x395aef[_0x35a1('0x14')],_0x1f57bf=_0x17be2a[_0x35a1('0x15')],_0xa149d0=_0x17be2a[_0x35a1('0x15')]+_0x17be2a[_0x35a1('0x16')],_0x20d868;if(_0xa149d0>=_0x28a180){_0xa149d0=_0x28a180;_0x20d868=0xc8;}else{_0x20d868=0xce;}_0x21098a[_0x35a1('0x13')](_0x20d868);return _0x21098a[_0x35a1('0x17')](_0x35a1('0x18'),_0x1f57bf+'-'+_0xa149d0+'/'+_0x28a180)[_0x35a1('0x19')](_0x395aef);}return null;};}function patchUpdates(_0x251d32){return function(_0x9bdc){try{jsonpatch[_0x35a1('0x1a')](_0x9bdc,_0x251d32,!![]);}catch(_0x3e7b28){return BPromise[_0x35a1('0x1b')](_0x3e7b28);}return _0x9bdc['save']();};}function saveUpdates(_0x3b17dc,_0xbeb751){return function(_0x28bc31){if(_0x28bc31){return _0x28bc31[_0x35a1('0x1c')](_0x3b17dc)[_0x35a1('0x1d')](function(_0x4255ac){return _0x4255ac;});}return null;};}function removeEntity(_0x363f2d,_0x8bc1a2){return function(_0x4179a2){if(_0x4179a2){return _0x4179a2['destroy']()[_0x35a1('0x1d')](function(){_0x363f2d[_0x35a1('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfce076,_0x174ca0){return function(_0x5433d7){if(!_0x5433d7){_0xfce076[_0x35a1('0x12')](0x194);}return _0x5433d7;};}function handleError(_0x5a1742,_0x28af51){_0x28af51=_0x28af51||0x1f4;return function(_0x1bca05){logger[_0x35a1('0x1e')](_0x1bca05['stack']);if(_0x1bca05[_0x35a1('0x1f')]){delete _0x1bca05[_0x35a1('0x1f')];}_0x5a1742['status'](_0x28af51)['send'](_0x1bca05);};}exports['index']=function(_0x35ad8a,_0x51f5bd){var _0x5408a7={},_0x52d22b={},_0x2ee03c={'count':0x0,'rows':[]};var _0x288a0d=db[_0x35a1('0x20')][_0x35a1('0x21')];_0x52d22b['model']=_[_0x35a1('0x22')](_0x288a0d);var _0x34b3d8={'dateStart':_0x35ad8a[_0x35a1('0x23')][_0x35a1('0x24')],'dateEnd':_0x35ad8a[_0x35a1('0x23')][_0x35a1('0x25')]};delete _0x35ad8a[_0x35a1('0x23')][_0x35a1('0x24')];delete _0x35ad8a[_0x35a1('0x23')][_0x35a1('0x25')];_0x52d22b[_0x35a1('0x23')]=_[_0x35a1('0x22')](_0x35ad8a[_0x35a1('0x23')]);_0x52d22b[_0x35a1('0x26')]=_[_0x35a1('0x27')](_0x52d22b['model'],_0x52d22b[_0x35a1('0x23')]);_0x5408a7[_0x35a1('0x28')]=_[_0x35a1('0x27')](_0x52d22b[_0x35a1('0x29')],qs[_0x35a1('0x2a')](_0x35ad8a[_0x35a1('0x23')][_0x35a1('0x2a')]));_0x5408a7[_0x35a1('0x28')]=_0x5408a7[_0x35a1('0x28')][_0x35a1('0x2b')]?_0x5408a7[_0x35a1('0x28')]:_0x52d22b['model'];if(!_0x35ad8a['query'][_0x35a1('0x2c')]('nolimit')){_0x5408a7[_0x35a1('0x16')]=qs['limit'](_0x35ad8a[_0x35a1('0x23')][_0x35a1('0x16')]);_0x5408a7[_0x35a1('0x15')]=qs[_0x35a1('0x15')](_0x35ad8a[_0x35a1('0x23')][_0x35a1('0x15')]);}_0x5408a7[_0x35a1('0x2d')]=qs[_0x35a1('0x2e')](_0x35ad8a[_0x35a1('0x23')][_0x35a1('0x2e')]);_0x5408a7[_0x35a1('0x2f')]=qs['filters'](_[_0x35a1('0x30')](_0x35ad8a[_0x35a1('0x23')],_0x52d22b[_0x35a1('0x26')]));if(_0x34b3d8['dateStart']){if(_0x34b3d8['dateEnd']){_0x34b3d8['dateEnd']=moment(_0x34b3d8['dateEnd'])['add'](0x1,'day');}else{_0x34b3d8[_0x35a1('0x25')]=moment(_0x34b3d8[_0x35a1('0x24')])[_0x35a1('0x31')](0x1,_0x35a1('0x32'));}_[_0x35a1('0x33')](_0x5408a7[_0x35a1('0x2f')],{'createdAt':{'$gte':_0x34b3d8[_0x35a1('0x24')],'$lte':_0x34b3d8[_0x35a1('0x25')]}});}if(_0x35ad8a['query'][_0x35a1('0x34')]){_0x5408a7['where']=_[_0x35a1('0x33')](_0x5408a7[_0x35a1('0x2f')],{'$or':_[_0x35a1('0x35')](_0x5408a7[_0x35a1('0x28')],function(_0x25ed31){var _0x53d505={};_0x53d505[_0x25ed31]={'$like':'%'+_0x35ad8a[_0x35a1('0x23')][_0x35a1('0x34')]+'%'};return _0x53d505;})});}_0x5408a7=_[_0x35a1('0x33')]({},_0x5408a7,_0x35ad8a['options']);var _0x599295={'where':_0x5408a7[_0x35a1('0x2f')]};return db[_0x35a1('0x20')][_0x35a1('0x14')](_0x599295)[_0x35a1('0x1d')](function(_0x482ce7){_0x2ee03c[_0x35a1('0x14')]=_0x482ce7;if(_0x35ad8a['query'][_0x35a1('0x36')]){_0x5408a7['include']=[{'all':!![]}];}return db[_0x35a1('0x20')][_0x35a1('0x37')](_0x5408a7);})['then'](function(_0x51eaaf){_0x2ee03c[_0x35a1('0x38')]=_0x51eaaf;return _0x2ee03c;})['then'](respondWithFilteredResult(_0x51f5bd,_0x5408a7))[_0x35a1('0x39')](handleError(_0x51f5bd,null));};exports[_0x35a1('0x3a')]=function(_0x541d6a,_0x3522c3){var _0x502695={'raw':!![],'where':{'id':_0x541d6a['params']['id']}},_0xb1c14c={};_0xb1c14c[_0x35a1('0x29')]=_['keys'](db[_0x35a1('0x20')]['rawAttributes']);_0xb1c14c[_0x35a1('0x23')]=_['keys'](_0x541d6a[_0x35a1('0x23')]);_0xb1c14c[_0x35a1('0x26')]=_[_0x35a1('0x27')](_0xb1c14c[_0x35a1('0x29')],_0xb1c14c[_0x35a1('0x23')]);_0x502695[_0x35a1('0x28')]=_[_0x35a1('0x27')](_0xb1c14c['model'],qs[_0x35a1('0x2a')](_0x541d6a[_0x35a1('0x23')][_0x35a1('0x2a')]));_0x502695[_0x35a1('0x28')]=_0x502695[_0x35a1('0x28')][_0x35a1('0x2b')]?_0x502695['attributes']:_0xb1c14c[_0x35a1('0x29')];if(_0x541d6a[_0x35a1('0x23')][_0x35a1('0x36')]){_0x502695[_0x35a1('0x3b')]=[{'all':!![]}];}_0x502695=_[_0x35a1('0x33')]({},_0x502695,_0x541d6a['options']);return db[_0x35a1('0x20')][_0x35a1('0x3c')](_0x502695)[_0x35a1('0x1d')](handleEntityNotFound(_0x3522c3,null))[_0x35a1('0x1d')](respondWithResult(_0x3522c3,null))['catch'](handleError(_0x3522c3,null));};exports[_0x35a1('0x3d')]=function(_0xc0f5f2,_0x1c1e24){return db[_0x35a1('0x20')][_0x35a1('0x3d')](_0xc0f5f2[_0x35a1('0x3e')],{})[_0x35a1('0x1d')](respondWithResult(_0x1c1e24,0xc9))['catch'](handleError(_0x1c1e24,null));};exports['update']=function(_0x16092f,_0x34805f){if(_0x16092f[_0x35a1('0x3e')]['id']){delete _0x16092f[_0x35a1('0x3e')]['id'];}return db['DeskField']['find']({'where':{'id':_0x16092f[_0x35a1('0x3f')]['id']}})[_0x35a1('0x1d')](handleEntityNotFound(_0x34805f,null))[_0x35a1('0x1d')](saveUpdates(_0x16092f[_0x35a1('0x3e')],null))['then'](respondWithResult(_0x34805f,null))['catch'](handleError(_0x34805f,null));};exports['destroy']=function(_0x256d48,_0x5d7f55){return db[_0x35a1('0x20')][_0x35a1('0x3c')]({'where':{'id':_0x256d48[_0x35a1('0x3f')]['id']}})[_0x35a1('0x1d')](handleEntityNotFound(_0x5d7f55,null))[_0x35a1('0x1d')](removeEntity(_0x5d7f55,null))[_0x35a1('0x39')](handleError(_0x5d7f55,null));}; \ No newline at end of file +var _0xef4d=['desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','DeskField','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1a3e33,_0xe419f4){var _0x545085=function(_0x563f55){while(--_0x563f55){_0x1a3e33['push'](_0x1a3e33['shift']());}};_0x545085(++_0xe419f4);}(_0xef4d,0x165));var _0xdef4=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xef4d[_0x4d8ed9];return _0x1e2140;};'use strict';var jsonpatch=require(_0xdef4('0x0'));var rp=require(_0xdef4('0x1'));var moment=require(_0xdef4('0x2'));var BPromise=require(_0xdef4('0x3'));var Mustache=require(_0xdef4('0x4'));var util=require(_0xdef4('0x5'));var path=require(_0xdef4('0x6'));var sox=require(_0xdef4('0x7'));var csv=require(_0xdef4('0x8'));var ejs=require(_0xdef4('0x9'));var fs=require('fs');var _=require(_0xdef4('0xa'));var squel=require(_0xdef4('0xb'));var crypto=require(_0xdef4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdef4('0xd'));var toCsv=require(_0xdef4('0x8'));var querystring=require(_0xdef4('0xe'));var Papa=require(_0xdef4('0xf'));var qs=require(_0xdef4('0x10'));var logger=require(_0xdef4('0x11'))(_0xdef4('0x12'));var utils=require(_0xdef4('0x13'));var config=require(_0xdef4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xde54d0,_0x1a209a){_0x1a209a=_0x1a209a||0xcc;return function(_0x35c826){if(_0x35c826){return _0xde54d0[_0xdef4('0x15')](_0x1a209a);}return _0xde54d0[_0xdef4('0x16')](_0x1a209a)[_0xdef4('0x17')]();};}function respondWithResult(_0x10ed6b,_0x558c2d){_0x558c2d=_0x558c2d||0xc8;return function(_0x228b1b){if(_0x228b1b){return _0x10ed6b['status'](_0x558c2d)['json'](_0x228b1b);}};}function respondWithFilteredResult(_0x17db7a,_0x5e6afa){return function(_0x1a78a8){if(_0x1a78a8){var _0x4bb4f6=_0x1a78a8[_0xdef4('0x18')],_0x3133fb=_0x5e6afa['offset'],_0x41e6cf=_0x5e6afa[_0xdef4('0x19')]+_0x5e6afa['limit'],_0x20effa;if(_0x41e6cf>=_0x4bb4f6){_0x41e6cf=_0x4bb4f6;_0x20effa=0xc8;}else{_0x20effa=0xce;}_0x17db7a[_0xdef4('0x16')](_0x20effa);return _0x17db7a[_0xdef4('0x1a')]('Content-Range',_0x3133fb+'-'+_0x41e6cf+'/'+_0x4bb4f6)[_0xdef4('0x1b')](_0x1a78a8);}return null;};}function patchUpdates(_0x27463d){return function(_0xb62090){try{jsonpatch[_0xdef4('0x1c')](_0xb62090,_0x27463d,!![]);}catch(_0x5adef0){return BPromise[_0xdef4('0x1d')](_0x5adef0);}return _0xb62090[_0xdef4('0x1e')]();};}function saveUpdates(_0x469178,_0x18d3a0){return function(_0x246fc5){if(_0x246fc5){return _0x246fc5['update'](_0x469178)[_0xdef4('0x1f')](function(_0x3bf2ae){return _0x3bf2ae;});}return null;};}function removeEntity(_0x310626,_0x22fd9e){return function(_0x177fe2){if(_0x177fe2){return _0x177fe2[_0xdef4('0x20')]()['then'](function(){_0x310626[_0xdef4('0x16')](0xcc)[_0xdef4('0x17')]();});}};}function handleEntityNotFound(_0x382362,_0x22d263){return function(_0x1b668e){if(!_0x1b668e){_0x382362[_0xdef4('0x15')](0x194);}return _0x1b668e;};}function handleError(_0x4e65e6,_0x107fff){_0x107fff=_0x107fff||0x1f4;return function(_0x51fbf3){logger[_0xdef4('0x21')](_0x51fbf3[_0xdef4('0x22')]);if(_0x51fbf3[_0xdef4('0x23')]){delete _0x51fbf3[_0xdef4('0x23')];}_0x4e65e6['status'](_0x107fff)[_0xdef4('0x24')](_0x51fbf3);};}exports[_0xdef4('0x25')]=function(_0x46500d,_0xf43627){var _0x1dab9a={},_0x34ff25={},_0x38658e={'count':0x0,'rows':[]};var _0x91199e=db['DeskField'][_0xdef4('0x26')];_0x34ff25[_0xdef4('0x27')]=_['keys'](_0x91199e);var _0xa6a48f={'dateStart':_0x46500d[_0xdef4('0x28')][_0xdef4('0x29')],'dateEnd':_0x46500d[_0xdef4('0x28')][_0xdef4('0x2a')]};delete _0x46500d[_0xdef4('0x28')]['dateStart'];delete _0x46500d[_0xdef4('0x28')][_0xdef4('0x2a')];_0x34ff25['query']=_[_0xdef4('0x2b')](_0x46500d[_0xdef4('0x28')]);_0x34ff25[_0xdef4('0x2c')]=_[_0xdef4('0x2d')](_0x34ff25[_0xdef4('0x27')],_0x34ff25[_0xdef4('0x28')]);_0x1dab9a[_0xdef4('0x2e')]=_[_0xdef4('0x2d')](_0x34ff25[_0xdef4('0x27')],qs[_0xdef4('0x2f')](_0x46500d[_0xdef4('0x28')]['fields']));_0x1dab9a['attributes']=_0x1dab9a[_0xdef4('0x2e')][_0xdef4('0x30')]?_0x1dab9a[_0xdef4('0x2e')]:_0x34ff25['model'];if(!_0x46500d[_0xdef4('0x28')][_0xdef4('0x31')](_0xdef4('0x32'))){_0x1dab9a[_0xdef4('0x33')]=qs['limit'](_0x46500d['query']['limit']);_0x1dab9a[_0xdef4('0x19')]=qs[_0xdef4('0x19')](_0x46500d[_0xdef4('0x28')][_0xdef4('0x19')]);}_0x1dab9a[_0xdef4('0x34')]=qs['sort'](_0x46500d[_0xdef4('0x28')][_0xdef4('0x35')]);_0x1dab9a[_0xdef4('0x36')]=qs[_0xdef4('0x2c')](_[_0xdef4('0x37')](_0x46500d['query'],_0x34ff25[_0xdef4('0x2c')]));if(_0xa6a48f[_0xdef4('0x29')]){if(_0xa6a48f[_0xdef4('0x2a')]){_0xa6a48f['dateEnd']=moment(_0xa6a48f[_0xdef4('0x2a')])['add'](0x1,'day');}else{_0xa6a48f[_0xdef4('0x2a')]=moment(_0xa6a48f['dateStart'])[_0xdef4('0x38')](0x1,_0xdef4('0x39'));}_[_0xdef4('0x3a')](_0x1dab9a[_0xdef4('0x36')],{'createdAt':{'$gte':_0xa6a48f[_0xdef4('0x29')],'$lte':_0xa6a48f[_0xdef4('0x2a')]}});}if(_0x46500d[_0xdef4('0x28')][_0xdef4('0x3b')]){_0x1dab9a['where']=_['merge'](_0x1dab9a[_0xdef4('0x36')],{'$or':_[_0xdef4('0x3c')](_0x1dab9a['attributes'],function(_0x586ffc){var _0x2a80ec={};_0x2a80ec[_0x586ffc]={'$like':'%'+_0x46500d[_0xdef4('0x28')][_0xdef4('0x3b')]+'%'};return _0x2a80ec;})});}_0x1dab9a=_[_0xdef4('0x3a')]({},_0x1dab9a,_0x46500d[_0xdef4('0x3d')]);var _0xaa75d6={'where':_0x1dab9a[_0xdef4('0x36')]};return db[_0xdef4('0x3e')][_0xdef4('0x18')](_0xaa75d6)[_0xdef4('0x1f')](function(_0x26c14e){_0x38658e['count']=_0x26c14e;if(_0x46500d[_0xdef4('0x28')][_0xdef4('0x3f')]){_0x1dab9a[_0xdef4('0x40')]=[{'all':!![]}];}return db[_0xdef4('0x3e')][_0xdef4('0x41')](_0x1dab9a);})['then'](function(_0x5dfd15){_0x38658e[_0xdef4('0x42')]=_0x5dfd15;return _0x38658e;})[_0xdef4('0x1f')](respondWithFilteredResult(_0xf43627,_0x1dab9a))[_0xdef4('0x43')](handleError(_0xf43627,null));};exports[_0xdef4('0x44')]=function(_0x370cfe,_0x13f472){var _0x5a4d64={'raw':!![],'where':{'id':_0x370cfe[_0xdef4('0x45')]['id']}},_0xbdfd50={};_0xbdfd50[_0xdef4('0x27')]=_[_0xdef4('0x2b')](db['DeskField']['rawAttributes']);_0xbdfd50[_0xdef4('0x28')]=_['keys'](_0x370cfe[_0xdef4('0x28')]);_0xbdfd50[_0xdef4('0x2c')]=_['intersection'](_0xbdfd50[_0xdef4('0x27')],_0xbdfd50[_0xdef4('0x28')]);_0x5a4d64[_0xdef4('0x2e')]=_[_0xdef4('0x2d')](_0xbdfd50[_0xdef4('0x27')],qs['fields'](_0x370cfe[_0xdef4('0x28')][_0xdef4('0x2f')]));_0x5a4d64[_0xdef4('0x2e')]=_0x5a4d64[_0xdef4('0x2e')][_0xdef4('0x30')]?_0x5a4d64[_0xdef4('0x2e')]:_0xbdfd50[_0xdef4('0x27')];if(_0x370cfe[_0xdef4('0x28')][_0xdef4('0x3f')]){_0x5a4d64[_0xdef4('0x40')]=[{'all':!![]}];}_0x5a4d64=_[_0xdef4('0x3a')]({},_0x5a4d64,_0x370cfe['options']);return db['DeskField'][_0xdef4('0x46')](_0x5a4d64)[_0xdef4('0x1f')](handleEntityNotFound(_0x13f472,null))[_0xdef4('0x1f')](respondWithResult(_0x13f472,null))[_0xdef4('0x43')](handleError(_0x13f472,null));};exports[_0xdef4('0x47')]=function(_0x113e15,_0x6c0f3f){return db[_0xdef4('0x3e')]['create'](_0x113e15['body'],{})[_0xdef4('0x1f')](respondWithResult(_0x6c0f3f,0xc9))[_0xdef4('0x43')](handleError(_0x6c0f3f,null));};exports[_0xdef4('0x48')]=function(_0x250061,_0x3c2233){if(_0x250061[_0xdef4('0x49')]['id']){delete _0x250061[_0xdef4('0x49')]['id'];}return db[_0xdef4('0x3e')][_0xdef4('0x46')]({'where':{'id':_0x250061['params']['id']}})[_0xdef4('0x1f')](handleEntityNotFound(_0x3c2233,null))[_0xdef4('0x1f')](saveUpdates(_0x250061[_0xdef4('0x49')],null))['then'](respondWithResult(_0x3c2233,null))[_0xdef4('0x43')](handleError(_0x3c2233,null));};exports['destroy']=function(_0x227841,_0x1c579d){return db['DeskField']['find']({'where':{'id':_0x227841[_0xdef4('0x45')]['id']}})[_0xdef4('0x1f')](handleEntityNotFound(_0x1c579d,null))[_0xdef4('0x1f')](removeEntity(_0x1c579d,null))[_0xdef4('0x43')](handleError(_0x1c579d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d1608aa..e711b8b 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 _0xb332=['int_desk_fields','lodash','../../config/logger','api','bluebird','./intDeskField.attributes','define','DeskField'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xb332,0xd9));var _0x2b33=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0xb332[_0x7185f7];return _0x182e45;};'use strict';var _=require(_0x2b33('0x0'));var util=require('util');var logger=require(_0x2b33('0x1'))(_0x2b33('0x2'));var moment=require('moment');var BPromise=require(_0x2b33('0x3'));var rp=require('request-promise');var attributes=require(_0x2b33('0x4'));module['exports']=function(_0x34b111,_0x5e5e86){return _0x34b111[_0x2b33('0x5')](_0x2b33('0x6'),attributes,{'tableName':_0x2b33('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x425d=['bluebird','request-promise','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','lodash','../../config/logger','api','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x425d,0x1e0));var _0xd425=function(_0x13a102,_0x7f6c67){_0x13a102=_0x13a102-0x0;var _0x3a37d2=_0x425d[_0x13a102];return _0x3a37d2;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var attributes=require(_0xd425('0x6'));module[_0xd425('0x7')]=function(_0x596be7,_0x2987c5){return _0x596be7[_0xd425('0x8')](_0xd425('0x9'),attributes,{'tableName':_0xd425('0xa'),'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 4e092b8..b54bc87 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 _0x577d=['message','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3804ee,_0x5120c6){var _0x64110d=function(_0x4accef){while(--_0x4accef){_0x3804ee['push'](_0x3804ee['shift']());}};_0x64110d(++_0x5120c6);}(_0x577d,0x7a));var _0xd577=function(_0x2ac471,_0x51b49a){_0x2ac471=_0x2ac471-0x0;var _0x3e2d25=_0x577d[_0x2ac471];return _0x3e2d25;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd577('0x0'));var BPromise=require('bluebird');var rs=require(_0xd577('0x1'));var fs=require('fs');var db=require(_0xd577('0x2'))['db'];var utils=require(_0xd577('0x3'));var logger=require(_0xd577('0x4'))(_0xd577('0x5'));var config=require(_0xd577('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd577('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x345c2c,_0x328c61,_0x3b5055){return new BPromise(function(_0x199891,_0x5ddd0c){return client[_0xd577('0x8')](_0x345c2c,_0x3b5055)[_0xd577('0x9')](function(_0x5c842e){logger[_0xd577('0xa')](_0xd577('0xb'),_0x328c61,_0xd577('0xc'));logger[_0xd577('0xd')](_0xd577('0xe'),_0x328c61,_0xd577('0xc'),JSON[_0xd577('0xf')](_0x5c842e));if(_0x5c842e[_0xd577('0x10')]){if(_0x5c842e[_0xd577('0x10')][_0xd577('0x11')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x328c61,_0x5c842e['error'][_0xd577('0x12')]);return _0x5ddd0c(_0x5c842e['error'][_0xd577('0x12')]);}logger[_0xd577('0x10')](_0xd577('0xb'),_0x328c61,_0x5c842e[_0xd577('0x10')][_0xd577('0x12')]);return _0x199891(_0x5c842e[_0xd577('0x10')]['message']);}else{logger[_0xd577('0xa')](_0xd577('0xb'),_0x328c61,_0xd577('0xc'));_0x199891(_0x5c842e['result']['message']);}})[_0xd577('0x13')](function(_0x1bb2ad){logger[_0xd577('0x10')](_0xd577('0xb'),_0x328c61,_0x1bb2ad);_0x5ddd0c(_0x1bb2ad);});});} \ No newline at end of file +var _0x4bc8=['stringify','error','message','DeskField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x5bb86f,_0x13e6af){var _0x33d01e=function(_0xeac45c){while(--_0xeac45c){_0x5bb86f['push'](_0x5bb86f['shift']());}};_0x33d01e(++_0x13e6af);}(_0x4bc8,0xce));var _0x84bc=function(_0x4eb436,_0x4d82b2){_0x4eb436=_0x4eb436-0x0;var _0x25936a=_0x4bc8[_0x4eb436];return _0x25936a;};'use strict';var _=require(_0x84bc('0x0'));var util=require('util');var moment=require(_0x84bc('0x1'));var BPromise=require(_0x84bc('0x2'));var rs=require(_0x84bc('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x84bc('0x4'));var logger=require(_0x84bc('0x5'))('rpc');var config=require(_0x84bc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x84bc('0x7')][_0x84bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd2c6b8,_0x95de2c,_0x214c25){return new BPromise(function(_0x24cac6,_0x35d9f5){return client['request'](_0xd2c6b8,_0x214c25)[_0x84bc('0x9')](function(_0x5ef494){logger[_0x84bc('0xa')]('DeskField,\x20%s,\x20%s',_0x95de2c,_0x84bc('0xb'));logger[_0x84bc('0xc')](_0x84bc('0xd'),_0x95de2c,_0x84bc('0xb'),JSON[_0x84bc('0xe')](_0x5ef494));if(_0x5ef494[_0x84bc('0xf')]){if(_0x5ef494['error']['code']===0x1f4){logger[_0x84bc('0xf')]('DeskField,\x20%s,\x20%s',_0x95de2c,_0x5ef494[_0x84bc('0xf')][_0x84bc('0x10')]);return _0x35d9f5(_0x5ef494['error'][_0x84bc('0x10')]);}logger['error'](_0x84bc('0x11'),_0x95de2c,_0x5ef494['error'][_0x84bc('0x10')]);return _0x24cac6(_0x5ef494[_0x84bc('0xf')][_0x84bc('0x10')]);}else{logger['info'](_0x84bc('0x11'),_0x95de2c,_0x84bc('0xb'));_0x24cac6(_0x5ef494[_0x84bc('0x12')]['message']);}})[_0x84bc('0x13')](function(_0xa31ea2){logger[_0x84bc('0xf')](_0x84bc('0x11'),_0x95de2c,_0xa31ea2);_0x35d9f5(_0xa31ea2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a3c1af3..df79cfe 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 _0xf769=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy'];(function(_0x108b66,_0x46f926){var _0x3e3e81=function(_0x9387c){while(--_0x9387c){_0x108b66['push'](_0x108b66['shift']());}};_0x3e3e81(++_0x46f926);}(_0xf769,0x1cc));var _0x9f76=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xf769[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9f76('0x0'));var express=require(_0x9f76('0x1'));var router=express['Router']();var auth=require(_0x9f76('0x2'));var interaction=require(_0x9f76('0x3'));var config=require(_0x9f76('0x4'));var controller=require(_0x9f76('0x5'));router['get']('/',auth[_0x9f76('0x6')](),controller[_0x9f76('0x7')]);router[_0x9f76('0x8')](_0x9f76('0x9'),auth[_0x9f76('0x6')](),controller[_0x9f76('0xa')]);router[_0x9f76('0x8')]('/:id/configurations',auth[_0x9f76('0x6')](),controller[_0x9f76('0xb')]);router[_0x9f76('0x8')](_0x9f76('0xc'),auth['isAuthenticated'](),controller[_0x9f76('0xd')]);router[_0x9f76('0xe')]('/',auth[_0x9f76('0x6')](),controller[_0x9f76('0xf')]);router[_0x9f76('0xe')]('/:id/configurations',auth[_0x9f76('0x6')](),controller[_0x9f76('0x10')]);router['put'](_0x9f76('0x9'),auth['isAuthenticated'](),controller[_0x9f76('0x11')]);router[_0x9f76('0x12')](_0x9f76('0x9'),auth[_0x9f76('0x6')](),controller[_0x9f76('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbb98=['getConfigurations','/:id/fields','create','post','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x25b785,_0x45763d){var _0x41b9a4=function(_0x24a3fd){while(--_0x24a3fd){_0x25b785['push'](_0x25b785['shift']());}};_0x41b9a4(++_0x45763d);}(_0xbb98,0x1e8));var _0x8bb9=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0xbb98[_0x5756c6];return _0x4b5806;};'use strict';var multer=require(_0x8bb9('0x0'));var util=require(_0x8bb9('0x1'));var path=require(_0x8bb9('0x2'));var express=require(_0x8bb9('0x3'));var router=express[_0x8bb9('0x4')]();var auth=require(_0x8bb9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x8bb9('0x6')]('/',auth['isAuthenticated'](),controller[_0x8bb9('0x7')]);router[_0x8bb9('0x6')](_0x8bb9('0x8'),auth[_0x8bb9('0x9')](),controller[_0x8bb9('0xa')]);router[_0x8bb9('0x6')](_0x8bb9('0xb'),auth[_0x8bb9('0x9')](),controller[_0x8bb9('0xc')]);router[_0x8bb9('0x6')](_0x8bb9('0xd'),auth[_0x8bb9('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x8bb9('0xe')]);router[_0x8bb9('0xf')](_0x8bb9('0xb'),auth[_0x8bb9('0x9')](),controller['addConfiguration']);router[_0x8bb9('0x10')](_0x8bb9('0x8'),auth[_0x8bb9('0x9')](),controller[_0x8bb9('0x11')]);router['delete'](_0x8bb9('0x8'),auth['isAuthenticated'](),controller[_0x8bb9('0x12')]);module[_0x8bb9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 686ee3e..aff8b9b 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 _0xdd65=['sequelize','STRING','username','remoteUri'];(function(_0x28679e,_0x216dc5){var _0x28f7fd=function(_0x1aa567){while(--_0x1aa567){_0x28679e['push'](_0x28679e['shift']());}};_0x28f7fd(++_0x216dc5);}(_0xdd65,0x18c));var _0x5dd6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdd65[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x5dd6('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dd6('0x1')]},'description':{'type':Sequelize[_0x5dd6('0x1')]},'username':{'type':Sequelize[_0x5dd6('0x1')],'unique':_0x5dd6('0x2')},'apiKey':{'type':Sequelize[_0x5dd6('0x1')]},'remoteUri':{'type':Sequelize[_0x5dd6('0x1')],'unique':_0x5dd6('0x3')},'serverUrl':{'type':Sequelize[_0x5dd6('0x1')]}}; \ No newline at end of file +var _0xee73=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3d07be,_0x46360f){var _0x20ff90=function(_0x53d13a){while(--_0x53d13a){_0x3d07be['push'](_0x3d07be['shift']());}};_0x20ff90(++_0x46360f);}(_0xee73,0x196));var _0x3ee7=function(_0x22d53d,_0x339808){_0x22d53d=_0x22d53d-0x0;var _0x40dd91=_0xee73[_0x22d53d];return _0x40dd91;};'use strict';var Sequelize=require(_0x3ee7('0x0'));module[_0x3ee7('0x1')]={'name':{'type':Sequelize[_0x3ee7('0x2')]},'description':{'type':Sequelize[_0x3ee7('0x2')]},'username':{'type':Sequelize[_0x3ee7('0x2')],'unique':_0x3ee7('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3ee7('0x2')],'unique':_0x3ee7('0x4')},'serverUrl':{'type':Sequelize[_0x3ee7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index e7d364d..52f4465 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 _0x7e73=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','json','apply','reject','save','destroy','stack','name','send','index','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','add','day','merge','where','map','filter','FreshdeskAccount','count','includeAll','include','findAll','rows','show','options','find','create','body','update','params','getConfigurations','findOne','FreshdeskConfiguration','rawAttributes','order','nolimit','addConfiguration','Subjects','channel','type','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7e73,0x151));var _0x37e7=function(_0xd6b4bc,_0x3a9809){_0xd6b4bc=_0xd6b4bc-0x0;var _0x30a048=_0x7e73[_0xd6b4bc];return _0x30a048;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x37e7('0x0'));var moment=require(_0x37e7('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x37e7('0x2'));var util=require(_0x37e7('0x3'));var path=require(_0x37e7('0x4'));var sox=require(_0x37e7('0x5'));var csv=require(_0x37e7('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x37e7('0x7'));var squel=require(_0x37e7('0x8'));var crypto=require('crypto');var jsforce=require(_0x37e7('0x9'));var deskjs=require(_0x37e7('0xa'));var toCsv=require(_0x37e7('0x6'));var querystring=require('querystring');var Papa=require(_0x37e7('0xb'));var qs=require(_0x37e7('0xc'));var logger=require(_0x37e7('0xd'))(_0x37e7('0xe'));var utils=require(_0x37e7('0xf'));var config=require(_0x37e7('0x10'));var db=require(_0x37e7('0x11'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x37e7('0x12'));var client=jayson['client'][_0x37e7('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x5b1b91,_0xee7be9,_0x2090f6,_0x259cc2){return new BPromise(function(_0x328320,_0x41fddf){var _0x4fa29c=_0x259cc2||client;return _0x4fa29c['request'](_0x5b1b91,_0x2090f6)[_0x37e7('0x14')](function(_0x532e13){logger[_0x37e7('0x15')](_0x37e7('0x16'),_0xee7be9,_0x37e7('0x17'));logger[_0x37e7('0x18')](_0x37e7('0x19'),_0xee7be9,'request\x20sent',JSON[_0x37e7('0x1a')](_0x532e13));if(_0x532e13[_0x37e7('0x1b')]){if(_0x532e13['error'][_0x37e7('0x1c')]===0x1f4){logger['error'](_0x37e7('0x16'),_0xee7be9,_0x532e13[_0x37e7('0x1b')][_0x37e7('0x1d')]);return _0x41fddf(_0x532e13[_0x37e7('0x1b')][_0x37e7('0x1d')]);}logger['error'](_0x37e7('0x16'),_0xee7be9,_0x532e13['error'][_0x37e7('0x1d')]);return _0x328320(_0x532e13['error'][_0x37e7('0x1d')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xee7be9,_0x37e7('0x17'));_0x328320(_0x532e13[_0x37e7('0x1e')]['message']);}})[_0x37e7('0x1f')](function(_0x1cf24d){logger['error'](_0x37e7('0x16'),_0xee7be9,_0x1cf24d);_0x41fddf(_0x1cf24d);});});}function respondWithStatusCode(_0x22d16a,_0x3f5406){_0x3f5406=_0x3f5406||0xcc;return function(_0x4ca333){if(_0x4ca333){return _0x22d16a[_0x37e7('0x20')](_0x3f5406);}return _0x22d16a[_0x37e7('0x21')](_0x3f5406)[_0x37e7('0x22')]();};}function respondWithResult(_0x2eeb68,_0x1c4349){_0x1c4349=_0x1c4349||0xc8;return function(_0x1a22cb){if(_0x1a22cb){return _0x2eeb68[_0x37e7('0x21')](_0x1c4349)['json'](_0x1a22cb);}};}function respondWithFilteredResult(_0x1d1716,_0x599186){return function(_0x3c2bef){if(_0x3c2bef){var _0x29b500=_0x3c2bef['count'],_0x41eed1=_0x599186['offset'],_0x23abe9=_0x599186[_0x37e7('0x23')]+_0x599186['limit'],_0x18288f;if(_0x23abe9>=_0x29b500){_0x23abe9=_0x29b500;_0x18288f=0xc8;}else{_0x18288f=0xce;}_0x1d1716[_0x37e7('0x21')](_0x18288f);return _0x1d1716['set']('Content-Range',_0x41eed1+'-'+_0x23abe9+'/'+_0x29b500)[_0x37e7('0x24')](_0x3c2bef);}return null;};}function patchUpdates(_0x43ef81){return function(_0x6d3a2f){try{jsonpatch[_0x37e7('0x25')](_0x6d3a2f,_0x43ef81,!![]);}catch(_0x19ada1){return BPromise[_0x37e7('0x26')](_0x19ada1);}return _0x6d3a2f[_0x37e7('0x27')]();};}function saveUpdates(_0x16582e,_0x1ac14f){return function(_0x4a950c){if(_0x4a950c){return _0x4a950c['update'](_0x16582e)[_0x37e7('0x14')](function(_0x32a905){return _0x32a905;});}return null;};}function removeEntity(_0x5704e2,_0x41fbc6){return function(_0x1d127f){if(_0x1d127f){return _0x1d127f[_0x37e7('0x28')]()[_0x37e7('0x14')](function(){_0x5704e2[_0x37e7('0x21')](0xcc)[_0x37e7('0x22')]();});}};}function handleEntityNotFound(_0x5192e5,_0x2b8aa0){return function(_0x2931c7){if(!_0x2931c7){_0x5192e5[_0x37e7('0x20')](0x194);}return _0x2931c7;};}function handleError(_0x5afd59,_0x54eb2b){_0x54eb2b=_0x54eb2b||0x1f4;return function(_0x573327){logger[_0x37e7('0x1b')](_0x573327[_0x37e7('0x29')]);if(_0x573327[_0x37e7('0x2a')]){delete _0x573327['name'];}_0x5afd59[_0x37e7('0x21')](_0x54eb2b)[_0x37e7('0x2b')](_0x573327);};}exports[_0x37e7('0x2c')]=function(_0x4d4eb6,_0x1336cc){var _0x4bfaf6={},_0x364ff6={},_0x49e815={'count':0x0,'rows':[]};var _0x57a6f4=db['FreshdeskAccount']['rawAttributes'];_0x364ff6[_0x37e7('0x2d')]=_[_0x37e7('0x2e')](_0x57a6f4);var _0x5b3659={'dateStart':_0x4d4eb6[_0x37e7('0x2f')][_0x37e7('0x30')],'dateEnd':_0x4d4eb6[_0x37e7('0x2f')]['dateEnd']};delete _0x4d4eb6[_0x37e7('0x2f')][_0x37e7('0x30')];delete _0x4d4eb6[_0x37e7('0x2f')][_0x37e7('0x31')];_0x364ff6[_0x37e7('0x2f')]=_[_0x37e7('0x2e')](_0x4d4eb6[_0x37e7('0x2f')]);_0x364ff6[_0x37e7('0x32')]=_[_0x37e7('0x33')](_0x364ff6[_0x37e7('0x2d')],_0x364ff6['query']);_0x4bfaf6[_0x37e7('0x34')]=_[_0x37e7('0x33')](_0x364ff6[_0x37e7('0x2d')],qs['fields'](_0x4d4eb6[_0x37e7('0x2f')][_0x37e7('0x35')]));_0x4bfaf6[_0x37e7('0x34')]=_0x4bfaf6[_0x37e7('0x34')][_0x37e7('0x36')]?_0x4bfaf6['attributes']:_0x364ff6[_0x37e7('0x2d')];if(!_0x4d4eb6[_0x37e7('0x2f')][_0x37e7('0x37')]('nolimit')){_0x4bfaf6[_0x37e7('0x38')]=qs[_0x37e7('0x38')](_0x4d4eb6[_0x37e7('0x2f')]['limit']);_0x4bfaf6[_0x37e7('0x23')]=qs['offset'](_0x4d4eb6['query']['offset']);}_0x4bfaf6['order']=qs[_0x37e7('0x39')](_0x4d4eb6['query'][_0x37e7('0x39')]);_0x4bfaf6['where']=qs['filters'](_[_0x37e7('0x3a')](_0x4d4eb6[_0x37e7('0x2f')],_0x364ff6['filters']));if(_0x5b3659[_0x37e7('0x30')]){if(_0x5b3659[_0x37e7('0x31')]){_0x5b3659[_0x37e7('0x31')]=moment(_0x5b3659[_0x37e7('0x31')])[_0x37e7('0x3b')](0x1,_0x37e7('0x3c'));}else{_0x5b3659['dateEnd']=moment(_0x5b3659['dateStart'])[_0x37e7('0x3b')](0x1,_0x37e7('0x3c'));}_[_0x37e7('0x3d')](_0x4bfaf6['where'],{'createdAt':{'$gte':_0x5b3659['dateStart'],'$lte':_0x5b3659[_0x37e7('0x31')]}});}if(_0x4d4eb6[_0x37e7('0x2f')]['filter']){_0x4bfaf6['where']=_[_0x37e7('0x3d')](_0x4bfaf6[_0x37e7('0x3e')],{'$or':_[_0x37e7('0x3f')](_0x4bfaf6[_0x37e7('0x34')],function(_0x3f73ca){var _0x42f0c3={};_0x42f0c3[_0x3f73ca]={'$like':'%'+_0x4d4eb6[_0x37e7('0x2f')][_0x37e7('0x40')]+'%'};return _0x42f0c3;})});}_0x4bfaf6=_[_0x37e7('0x3d')]({},_0x4bfaf6,_0x4d4eb6['options']);var _0x59eb54={'where':_0x4bfaf6[_0x37e7('0x3e')]};return db[_0x37e7('0x41')][_0x37e7('0x42')](_0x59eb54)['then'](function(_0x52e8a8){_0x49e815['count']=_0x52e8a8;if(_0x4d4eb6[_0x37e7('0x2f')][_0x37e7('0x43')]){_0x4bfaf6[_0x37e7('0x44')]=[{'all':!![]}];}return db[_0x37e7('0x41')][_0x37e7('0x45')](_0x4bfaf6);})['then'](function(_0x40ed31){_0x49e815[_0x37e7('0x46')]=_0x40ed31;return _0x49e815;})['then'](respondWithFilteredResult(_0x1336cc,_0x4bfaf6))['catch'](handleError(_0x1336cc,null));};exports[_0x37e7('0x47')]=function(_0xca2639,_0x39b594){var _0x3472c3={'raw':![],'where':{'id':_0xca2639['params']['id']}},_0x1de17d={};_0x1de17d['model']=_[_0x37e7('0x2e')](db['FreshdeskAccount']['rawAttributes']);_0x1de17d[_0x37e7('0x2f')]=_[_0x37e7('0x2e')](_0xca2639[_0x37e7('0x2f')]);_0x1de17d[_0x37e7('0x32')]=_['intersection'](_0x1de17d['model'],_0x1de17d[_0x37e7('0x2f')]);_0x3472c3[_0x37e7('0x34')]=_[_0x37e7('0x33')](_0x1de17d[_0x37e7('0x2d')],qs[_0x37e7('0x35')](_0xca2639[_0x37e7('0x2f')]['fields']));_0x3472c3[_0x37e7('0x34')]=_0x3472c3['attributes'][_0x37e7('0x36')]?_0x3472c3[_0x37e7('0x34')]:_0x1de17d[_0x37e7('0x2d')];if(_0xca2639[_0x37e7('0x2f')][_0x37e7('0x43')]){_0x3472c3[_0x37e7('0x44')]=[{'all':!![]}];}_0x3472c3=_['merge']({},_0x3472c3,_0xca2639[_0x37e7('0x48')]);return db[_0x37e7('0x41')][_0x37e7('0x49')](_0x3472c3)[_0x37e7('0x14')](handleEntityNotFound(_0x39b594,null))[_0x37e7('0x14')](respondWithResult(_0x39b594,null))['catch'](handleError(_0x39b594,null));};exports[_0x37e7('0x4a')]=function(_0x2cadbb,_0x2ca3c5){return db[_0x37e7('0x41')]['create'](_0x2cadbb[_0x37e7('0x4b')],{})[_0x37e7('0x14')](respondWithResult(_0x2ca3c5,0xc9))[_0x37e7('0x1f')](handleError(_0x2ca3c5,null));};exports[_0x37e7('0x4c')]=function(_0x52297b,_0x19526c){if(_0x52297b['body']['id']){delete _0x52297b[_0x37e7('0x4b')]['id'];}return db[_0x37e7('0x41')][_0x37e7('0x49')]({'where':{'id':_0x52297b[_0x37e7('0x4d')]['id']}})[_0x37e7('0x14')](handleEntityNotFound(_0x19526c,null))['then'](saveUpdates(_0x52297b[_0x37e7('0x4b')],null))[_0x37e7('0x14')](respondWithResult(_0x19526c,null))[_0x37e7('0x1f')](handleError(_0x19526c,null));};exports[_0x37e7('0x28')]=function(_0x54e66e,_0x26bc7c){return db[_0x37e7('0x41')][_0x37e7('0x49')]({'where':{'id':_0x54e66e['params']['id']}})['then'](handleEntityNotFound(_0x26bc7c,null))[_0x37e7('0x14')](removeEntity(_0x26bc7c,null))[_0x37e7('0x1f')](handleError(_0x26bc7c,null));};exports[_0x37e7('0x4e')]=function(_0x3ce5b8,_0x7135af,_0x302ff9){var _0x208a14={};var _0x1845f4={};var _0x2a6b09;var _0x39b978;return db[_0x37e7('0x41')][_0x37e7('0x4f')]({'where':{'id':_0x3ce5b8['params']['id']}})[_0x37e7('0x14')](handleEntityNotFound(_0x7135af,null))[_0x37e7('0x14')](function(_0x197952){if(_0x197952){_0x2a6b09=_0x197952;_0x1845f4[_0x37e7('0x2d')]=_[_0x37e7('0x2e')](db[_0x37e7('0x50')][_0x37e7('0x51')]);_0x1845f4[_0x37e7('0x2f')]=_['keys'](_0x3ce5b8['query']);_0x1845f4[_0x37e7('0x32')]=_['intersection'](_0x1845f4['model'],_0x1845f4[_0x37e7('0x2f')]);_0x208a14[_0x37e7('0x34')]=_['intersection'](_0x1845f4[_0x37e7('0x2d')],qs['fields'](_0x3ce5b8[_0x37e7('0x2f')][_0x37e7('0x35')]));_0x208a14['attributes']=_0x208a14[_0x37e7('0x34')][_0x37e7('0x36')]?_0x208a14[_0x37e7('0x34')]:_0x1845f4[_0x37e7('0x2d')];_0x208a14[_0x37e7('0x52')]=qs[_0x37e7('0x39')](_0x3ce5b8['query'][_0x37e7('0x39')]);_0x208a14[_0x37e7('0x3e')]=qs[_0x37e7('0x32')](_[_0x37e7('0x3a')](_0x3ce5b8['query'],_0x1845f4[_0x37e7('0x32')]));if(_0x3ce5b8[_0x37e7('0x2f')][_0x37e7('0x40')]){_0x208a14[_0x37e7('0x3e')]=_[_0x37e7('0x3d')](_0x208a14[_0x37e7('0x3e')],{'$or':_[_0x37e7('0x3f')](_0x208a14[_0x37e7('0x34')],function(_0x1250ba){var _0x367d22={};_0x367d22[_0x1250ba]={'$like':'%'+_0x3ce5b8['query']['filter']+'%'};return _0x367d22;})});}_0x208a14=_[_0x37e7('0x3d')]({},_0x208a14,_0x3ce5b8['options']);return _0x2a6b09['getConfigurations'](_0x208a14);}})[_0x37e7('0x14')](function(_0xbc02ab){if(_0xbc02ab){_0x39b978=_0xbc02ab[_0x37e7('0x36')];if(!_0x3ce5b8[_0x37e7('0x2f')][_0x37e7('0x37')](_0x37e7('0x53'))){_0x208a14[_0x37e7('0x38')]=qs['limit'](_0x3ce5b8[_0x37e7('0x2f')][_0x37e7('0x38')]);_0x208a14[_0x37e7('0x23')]=qs[_0x37e7('0x23')](_0x3ce5b8[_0x37e7('0x2f')][_0x37e7('0x23')]);}return _0x2a6b09[_0x37e7('0x4e')](_0x208a14);}})[_0x37e7('0x14')](function(_0x38aa3f){if(_0x38aa3f){return _0x38aa3f?{'count':_0x39b978,'rows':_0x38aa3f}:null;}})[_0x37e7('0x14')](respondWithResult(_0x7135af,null))[_0x37e7('0x1f')](handleError(_0x7135af,null));};exports[_0x37e7('0x54')]=function(_0x46bfd2,_0xf2ff3a,_0x56d07c){if(_0x46bfd2[_0x37e7('0x4b')]['id']){delete _0x46bfd2[_0x37e7('0x4b')]['id'];}return db[_0x37e7('0x41')]['findOne']({'where':{'id':_0x46bfd2[_0x37e7('0x4d')]['id']}})[_0x37e7('0x14')](handleEntityNotFound(_0xf2ff3a,null))[_0x37e7('0x14')](function(_0x6c60f5){if(_0x6c60f5){_0x46bfd2['body']['AccountId']=_0x6c60f5['id'];_0x46bfd2['body'][_0x37e7('0x55')]=integrations['getSubjects'](_0x46bfd2[_0x37e7('0x4b')][_0x37e7('0x56')],_0x46bfd2[_0x37e7('0x4b')][_0x37e7('0x57')]);_0x46bfd2['body'][_0x37e7('0x58')]=integrations[_0x37e7('0x59')](_0x46bfd2[_0x37e7('0x4b')][_0x37e7('0x56')],_0x46bfd2['body'][_0x37e7('0x57')]);return db[_0x37e7('0x50')][_0x37e7('0x4a')](_0x46bfd2[_0x37e7('0x4b')],{'include':[{'model':db[_0x37e7('0x5a')],'as':_0x37e7('0x55')},{'model':db[_0x37e7('0x5a')],'as':_0x37e7('0x58')}]});}return null;})[_0x37e7('0x14')](respondWithResult(_0xf2ff3a,null))['catch'](handleError(_0xf2ff3a,null));};exports[_0x37e7('0x5b')]=function(_0x33294c,_0x20dd29,_0x43c343){return db['FreshdeskAccount'][_0x37e7('0x4f')]({'where':{'id':_0x33294c['params']['id']},'attributes':['id',_0x37e7('0x5c'),'apiKey']})[_0x37e7('0x14')](handleEntityNotFound(_0x20dd29,null))[_0x37e7('0x14')](function(_0x50dcdb){if(_0x50dcdb){return rp({'method':_0x37e7('0x5d'),'uri':util[_0x37e7('0x5e')]('%s%s',_0x50dcdb[_0x37e7('0x5c')],_0x37e7('0x5f')),'headers':{'Authorization':util[_0x37e7('0x5e')](_0x37e7('0x60'),new Buffer(util['format']('%s:X',_0x50dcdb['apiKey']))[_0x37e7('0x61')](_0x37e7('0x62')))},'json':!![]});}})['then'](function(_0x58ea3b){if(_0x58ea3b){var _0x5f0143=[_0x37e7('0x63'),'subject','agent',_0x37e7('0x64'),_0x37e7('0x21'),_0x37e7('0x65'),_0x37e7('0x66'),_0x37e7('0x67'),_0x37e7('0x68'),_0x37e7('0x66'),_0x37e7('0x69')];_[_0x37e7('0x6a')](_0x58ea3b,function(_0x1b6059){return _0x5f0143[_0x37e7('0x6b')](_0x1b6059['name'])||!_0x1b6059[_0x37e7('0x6c')]&&_0x1b6059[_0x37e7('0x57')]!==_0x37e7('0x6d');});return{'count':_0x58ea3b[_0x37e7('0x36')],'rows':_['map'](_0x58ea3b,function(_0x5b7c98){return{'id':_0x5b7c98['name'],'name':_0x5b7c98['label'],'custom':!_0x5b7c98[_0x37e7('0x6c')],'options':_0x5b7c98[_0x37e7('0x6e')]?_[_0x37e7('0x3f')](_0x5b7c98[_0x37e7('0x6e')],function(_0x210e89){return{'name':_[_0x37e7('0x6f')](_0x210e89),'value':_0x210e89};}):[]};})};}})[_0x37e7('0x14')](respondWithResult(_0x20dd29,null))[_0x37e7('0x1f')](function(_0x158b5b){var _0x1991f5=_0x33294c['query'][_0x37e7('0x70')]?0x1f4:_0x158b5b['statusCode']||0x1f4;logger[_0x37e7('0x1b')](_0x37e7('0x71'),_0x37e7('0x5b'),_0x1991f5,JSON['stringify'](_0x158b5b));delete _0x158b5b['name'];if(_0x1991f5===0x191){_0x1991f5=0x190;}_0x20dd29['status'](_0x1991f5)['send'](_0x33294c['query'][_0x37e7('0x70')]?{'message':_0x37e7('0x72'),'statusCode':_0x158b5b[_0x37e7('0x73')]}:_0x158b5b);});}; \ No newline at end of file +var _0x19a8=['api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','apply','reject','save','update','sendStatus','stack','name','index','FreshdeskAccount','rawAttributes','model','keys','query','dateEnd','dateStart','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','merge','filter','map','include','findAll','show','params','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','type','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','format','%s%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','includes','default','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs'];(function(_0x552fb5,_0x51fa13){var _0x10a203=function(_0x5979c2){while(--_0x5979c2){_0x552fb5['push'](_0x552fb5['shift']());}};_0x10a203(++_0x51fa13);}(_0x19a8,0x142));var _0x819a=function(_0x108a94,_0x1da642){_0x108a94=_0x108a94-0x0;var _0x234cb0=_0x19a8[_0x108a94];return _0x234cb0;};'use strict';var jsonpatch=require(_0x819a('0x0'));var rp=require(_0x819a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x819a('0x2'));var util=require(_0x819a('0x3'));var path=require(_0x819a('0x4'));var sox=require(_0x819a('0x5'));var csv=require(_0x819a('0x6'));var ejs=require(_0x819a('0x7'));var fs=require('fs');var _=require(_0x819a('0x8'));var squel=require(_0x819a('0x9'));var crypto=require(_0x819a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x819a('0xb'));var toCsv=require(_0x819a('0x6'));var querystring=require(_0x819a('0xc'));var Papa=require('papaparse');var qs=require(_0x819a('0xd'));var logger=require('../../config/logger')(_0x819a('0xe'));var utils=require('../../config/utils');var config=require(_0x819a('0xf'));var db=require(_0x819a('0x10'))['db'];var integrations=require(_0x819a('0x11'));var jayson=require(_0x819a('0x12'));var client=jayson['client'][_0x819a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x2989f1,_0xdb91ba,_0x3d46f5,_0x4d2ada){return new BPromise(function(_0x101182,_0x263872){var _0x3afb95=_0x4d2ada||client;return _0x3afb95[_0x819a('0x14')](_0x2989f1,_0x3d46f5)[_0x819a('0x15')](function(_0x25dafd){logger[_0x819a('0x16')](_0x819a('0x17'),_0xdb91ba,_0x819a('0x18'));logger[_0x819a('0x19')](_0x819a('0x1a'),_0xdb91ba,_0x819a('0x18'),JSON[_0x819a('0x1b')](_0x25dafd));if(_0x25dafd[_0x819a('0x1c')]){if(_0x25dafd[_0x819a('0x1c')][_0x819a('0x1d')]===0x1f4){logger[_0x819a('0x1c')](_0x819a('0x17'),_0xdb91ba,_0x25dafd[_0x819a('0x1c')][_0x819a('0x1e')]);return _0x263872(_0x25dafd[_0x819a('0x1c')]['message']);}logger[_0x819a('0x1c')](_0x819a('0x17'),_0xdb91ba,_0x25dafd[_0x819a('0x1c')][_0x819a('0x1e')]);return _0x101182(_0x25dafd['error'][_0x819a('0x1e')]);}else{logger[_0x819a('0x16')](_0x819a('0x17'),_0xdb91ba,_0x819a('0x18'));_0x101182(_0x25dafd[_0x819a('0x1f')][_0x819a('0x1e')]);}})[_0x819a('0x20')](function(_0x358d8a){logger[_0x819a('0x1c')](_0x819a('0x17'),_0xdb91ba,_0x358d8a);_0x263872(_0x358d8a);});});}function respondWithStatusCode(_0x3330b9,_0x5a56e3){_0x5a56e3=_0x5a56e3||0xcc;return function(_0x26c4b4){if(_0x26c4b4){return _0x3330b9['sendStatus'](_0x5a56e3);}return _0x3330b9[_0x819a('0x21')](_0x5a56e3)[_0x819a('0x22')]();};}function respondWithResult(_0x4caf7a,_0xf5bd0a){_0xf5bd0a=_0xf5bd0a||0xc8;return function(_0x526d47){if(_0x526d47){return _0x4caf7a[_0x819a('0x21')](_0xf5bd0a)[_0x819a('0x23')](_0x526d47);}};}function respondWithFilteredResult(_0xc1b1e9,_0x906067){return function(_0x3a599b){if(_0x3a599b){var _0x4bda75=_0x3a599b['count'],_0x119c98=_0x906067[_0x819a('0x24')],_0x1dba4f=_0x906067['offset']+_0x906067[_0x819a('0x25')],_0x5d174e;if(_0x1dba4f>=_0x4bda75){_0x1dba4f=_0x4bda75;_0x5d174e=0xc8;}else{_0x5d174e=0xce;}_0xc1b1e9[_0x819a('0x21')](_0x5d174e);return _0xc1b1e9[_0x819a('0x26')]('Content-Range',_0x119c98+'-'+_0x1dba4f+'/'+_0x4bda75)[_0x819a('0x23')](_0x3a599b);}return null;};}function patchUpdates(_0x141db6){return function(_0x3e5347){try{jsonpatch[_0x819a('0x27')](_0x3e5347,_0x141db6,!![]);}catch(_0x24d3ba){return BPromise[_0x819a('0x28')](_0x24d3ba);}return _0x3e5347[_0x819a('0x29')]();};}function saveUpdates(_0x16c278,_0x42dc75){return function(_0x5abdb4){if(_0x5abdb4){return _0x5abdb4[_0x819a('0x2a')](_0x16c278)[_0x819a('0x15')](function(_0x690852){return _0x690852;});}return null;};}function removeEntity(_0x133000,_0xdcb371){return function(_0x470b16){if(_0x470b16){return _0x470b16['destroy']()['then'](function(){_0x133000[_0x819a('0x21')](0xcc)[_0x819a('0x22')]();});}};}function handleEntityNotFound(_0x36b7fa,_0x494488){return function(_0x2c3dd8){if(!_0x2c3dd8){_0x36b7fa[_0x819a('0x2b')](0x194);}return _0x2c3dd8;};}function handleError(_0x120f60,_0x243eec){_0x243eec=_0x243eec||0x1f4;return function(_0x4aae63){logger['error'](_0x4aae63[_0x819a('0x2c')]);if(_0x4aae63['name']){delete _0x4aae63[_0x819a('0x2d')];}_0x120f60[_0x819a('0x21')](_0x243eec)['send'](_0x4aae63);};}exports[_0x819a('0x2e')]=function(_0x138b3f,_0x5cd736){var _0x27469e={},_0x29c57e={},_0x547393={'count':0x0,'rows':[]};var _0x54c0b9=db[_0x819a('0x2f')][_0x819a('0x30')];_0x29c57e[_0x819a('0x31')]=_[_0x819a('0x32')](_0x54c0b9);var _0x3e271d={'dateStart':_0x138b3f['query']['dateStart'],'dateEnd':_0x138b3f[_0x819a('0x33')][_0x819a('0x34')]};delete _0x138b3f['query'][_0x819a('0x35')];delete _0x138b3f[_0x819a('0x33')][_0x819a('0x34')];_0x29c57e[_0x819a('0x33')]=_[_0x819a('0x32')](_0x138b3f[_0x819a('0x33')]);_0x29c57e[_0x819a('0x36')]=_['intersection'](_0x29c57e[_0x819a('0x31')],_0x29c57e['query']);_0x27469e[_0x819a('0x37')]=_[_0x819a('0x38')](_0x29c57e[_0x819a('0x31')],qs[_0x819a('0x39')](_0x138b3f[_0x819a('0x33')][_0x819a('0x39')]));_0x27469e[_0x819a('0x37')]=_0x27469e[_0x819a('0x37')][_0x819a('0x3a')]?_0x27469e['attributes']:_0x29c57e[_0x819a('0x31')];if(!_0x138b3f[_0x819a('0x33')][_0x819a('0x3b')](_0x819a('0x3c'))){_0x27469e[_0x819a('0x25')]=qs[_0x819a('0x25')](_0x138b3f[_0x819a('0x33')][_0x819a('0x25')]);_0x27469e[_0x819a('0x24')]=qs[_0x819a('0x24')](_0x138b3f[_0x819a('0x33')][_0x819a('0x24')]);}_0x27469e[_0x819a('0x3d')]=qs[_0x819a('0x3e')](_0x138b3f['query']['sort']);_0x27469e[_0x819a('0x3f')]=qs[_0x819a('0x36')](_[_0x819a('0x40')](_0x138b3f[_0x819a('0x33')],_0x29c57e[_0x819a('0x36')]));if(_0x3e271d['dateStart']){if(_0x3e271d['dateEnd']){_0x3e271d[_0x819a('0x34')]=moment(_0x3e271d[_0x819a('0x34')])['add'](0x1,'day');}else{_0x3e271d[_0x819a('0x34')]=moment(_0x3e271d['dateStart'])[_0x819a('0x41')](0x1,'day');}_[_0x819a('0x42')](_0x27469e[_0x819a('0x3f')],{'createdAt':{'$gte':_0x3e271d[_0x819a('0x35')],'$lte':_0x3e271d[_0x819a('0x34')]}});}if(_0x138b3f[_0x819a('0x33')][_0x819a('0x43')]){_0x27469e[_0x819a('0x3f')]=_[_0x819a('0x42')](_0x27469e[_0x819a('0x3f')],{'$or':_[_0x819a('0x44')](_0x27469e[_0x819a('0x37')],function(_0x1c14d3){var _0x8d3092={};_0x8d3092[_0x1c14d3]={'$like':'%'+_0x138b3f[_0x819a('0x33')][_0x819a('0x43')]+'%'};return _0x8d3092;})});}_0x27469e=_[_0x819a('0x42')]({},_0x27469e,_0x138b3f['options']);var _0x27e19e={'where':_0x27469e[_0x819a('0x3f')]};return db[_0x819a('0x2f')]['count'](_0x27e19e)[_0x819a('0x15')](function(_0x48fc1d){_0x547393['count']=_0x48fc1d;if(_0x138b3f[_0x819a('0x33')]['includeAll']){_0x27469e[_0x819a('0x45')]=[{'all':!![]}];}return db[_0x819a('0x2f')][_0x819a('0x46')](_0x27469e);})[_0x819a('0x15')](function(_0xf5acd6){_0x547393['rows']=_0xf5acd6;return _0x547393;})[_0x819a('0x15')](respondWithFilteredResult(_0x5cd736,_0x27469e))[_0x819a('0x20')](handleError(_0x5cd736,null));};exports[_0x819a('0x47')]=function(_0x28a7b3,_0x417f69){var _0x2f4d59={'raw':![],'where':{'id':_0x28a7b3[_0x819a('0x48')]['id']}},_0x51ca90={};_0x51ca90[_0x819a('0x31')]=_[_0x819a('0x32')](db[_0x819a('0x2f')][_0x819a('0x30')]);_0x51ca90[_0x819a('0x33')]=_[_0x819a('0x32')](_0x28a7b3[_0x819a('0x33')]);_0x51ca90[_0x819a('0x36')]=_[_0x819a('0x38')](_0x51ca90[_0x819a('0x31')],_0x51ca90[_0x819a('0x33')]);_0x2f4d59[_0x819a('0x37')]=_[_0x819a('0x38')](_0x51ca90[_0x819a('0x31')],qs[_0x819a('0x39')](_0x28a7b3[_0x819a('0x33')]['fields']));_0x2f4d59[_0x819a('0x37')]=_0x2f4d59[_0x819a('0x37')][_0x819a('0x3a')]?_0x2f4d59['attributes']:_0x51ca90[_0x819a('0x31')];if(_0x28a7b3['query']['includeAll']){_0x2f4d59['include']=[{'all':!![]}];}_0x2f4d59=_[_0x819a('0x42')]({},_0x2f4d59,_0x28a7b3[_0x819a('0x49')]);return db[_0x819a('0x2f')][_0x819a('0x4a')](_0x2f4d59)[_0x819a('0x15')](handleEntityNotFound(_0x417f69,null))[_0x819a('0x15')](respondWithResult(_0x417f69,null))[_0x819a('0x20')](handleError(_0x417f69,null));};exports['create']=function(_0x11ff2e,_0x585216){return db['FreshdeskAccount'][_0x819a('0x4b')](_0x11ff2e['body'],{})['then'](respondWithResult(_0x585216,0xc9))[_0x819a('0x20')](handleError(_0x585216,null));};exports[_0x819a('0x2a')]=function(_0x512513,_0x2c2416){if(_0x512513[_0x819a('0x4c')]['id']){delete _0x512513[_0x819a('0x4c')]['id'];}return db[_0x819a('0x2f')][_0x819a('0x4a')]({'where':{'id':_0x512513[_0x819a('0x48')]['id']}})[_0x819a('0x15')](handleEntityNotFound(_0x2c2416,null))[_0x819a('0x15')](saveUpdates(_0x512513[_0x819a('0x4c')],null))[_0x819a('0x15')](respondWithResult(_0x2c2416,null))['catch'](handleError(_0x2c2416,null));};exports['destroy']=function(_0x334e93,_0x45dad4){return db['FreshdeskAccount'][_0x819a('0x4a')]({'where':{'id':_0x334e93['params']['id']}})[_0x819a('0x15')](handleEntityNotFound(_0x45dad4,null))[_0x819a('0x15')](removeEntity(_0x45dad4,null))[_0x819a('0x20')](handleError(_0x45dad4,null));};exports[_0x819a('0x4d')]=function(_0x54deae,_0x34f809,_0x4bce07){var _0x85a478={};var _0x3f85d9={};var _0xdc0a2a;var _0x3ccd72;return db[_0x819a('0x2f')][_0x819a('0x4e')]({'where':{'id':_0x54deae[_0x819a('0x48')]['id']}})['then'](handleEntityNotFound(_0x34f809,null))[_0x819a('0x15')](function(_0x49f49e){if(_0x49f49e){_0xdc0a2a=_0x49f49e;_0x3f85d9[_0x819a('0x31')]=_['keys'](db[_0x819a('0x4f')][_0x819a('0x30')]);_0x3f85d9['query']=_[_0x819a('0x32')](_0x54deae[_0x819a('0x33')]);_0x3f85d9[_0x819a('0x36')]=_[_0x819a('0x38')](_0x3f85d9[_0x819a('0x31')],_0x3f85d9[_0x819a('0x33')]);_0x85a478[_0x819a('0x37')]=_[_0x819a('0x38')](_0x3f85d9['model'],qs[_0x819a('0x39')](_0x54deae[_0x819a('0x33')][_0x819a('0x39')]));_0x85a478[_0x819a('0x37')]=_0x85a478['attributes'][_0x819a('0x3a')]?_0x85a478[_0x819a('0x37')]:_0x3f85d9[_0x819a('0x31')];_0x85a478[_0x819a('0x3d')]=qs[_0x819a('0x3e')](_0x54deae[_0x819a('0x33')][_0x819a('0x3e')]);_0x85a478['where']=qs['filters'](_[_0x819a('0x40')](_0x54deae[_0x819a('0x33')],_0x3f85d9[_0x819a('0x36')]));if(_0x54deae[_0x819a('0x33')][_0x819a('0x43')]){_0x85a478[_0x819a('0x3f')]=_[_0x819a('0x42')](_0x85a478['where'],{'$or':_[_0x819a('0x44')](_0x85a478['attributes'],function(_0x2d7e9e){var _0x4cf77d={};_0x4cf77d[_0x2d7e9e]={'$like':'%'+_0x54deae[_0x819a('0x33')][_0x819a('0x43')]+'%'};return _0x4cf77d;})});}_0x85a478=_['merge']({},_0x85a478,_0x54deae['options']);return _0xdc0a2a[_0x819a('0x4d')](_0x85a478);}})['then'](function(_0x17d906){if(_0x17d906){_0x3ccd72=_0x17d906[_0x819a('0x3a')];if(!_0x54deae[_0x819a('0x33')][_0x819a('0x3b')]('nolimit')){_0x85a478['limit']=qs[_0x819a('0x25')](_0x54deae['query'][_0x819a('0x25')]);_0x85a478[_0x819a('0x24')]=qs[_0x819a('0x24')](_0x54deae['query']['offset']);}return _0xdc0a2a[_0x819a('0x4d')](_0x85a478);}})[_0x819a('0x15')](function(_0x52bde4){if(_0x52bde4){return _0x52bde4?{'count':_0x3ccd72,'rows':_0x52bde4}:null;}})[_0x819a('0x15')](respondWithResult(_0x34f809,null))['catch'](handleError(_0x34f809,null));};exports[_0x819a('0x50')]=function(_0x236324,_0x3b48df,_0x5a9619){if(_0x236324[_0x819a('0x4c')]['id']){delete _0x236324[_0x819a('0x4c')]['id'];}return db[_0x819a('0x2f')]['findOne']({'where':{'id':_0x236324[_0x819a('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b48df,null))[_0x819a('0x15')](function(_0x127e35){if(_0x127e35){_0x236324[_0x819a('0x4c')][_0x819a('0x51')]=_0x127e35['id'];_0x236324['body'][_0x819a('0x52')]=integrations['getSubjects'](_0x236324[_0x819a('0x4c')][_0x819a('0x53')],_0x236324['body']['type']);_0x236324[_0x819a('0x4c')]['Descriptions']=integrations[_0x819a('0x54')](_0x236324[_0x819a('0x4c')]['channel'],_0x236324[_0x819a('0x4c')][_0x819a('0x55')]);return db['FreshdeskConfiguration'][_0x819a('0x4b')](_0x236324[_0x819a('0x4c')],{'include':[{'model':db[_0x819a('0x56')],'as':_0x819a('0x52')},{'model':db['FreshdeskField'],'as':_0x819a('0x57')}]});}return null;})[_0x819a('0x15')](respondWithResult(_0x3b48df,null))['catch'](handleError(_0x3b48df,null));};exports[_0x819a('0x58')]=function(_0x330008,_0x509bda,_0x184c36){return db[_0x819a('0x2f')]['findOne']({'where':{'id':_0x330008[_0x819a('0x48')]['id']},'attributes':['id',_0x819a('0x59'),_0x819a('0x5a')]})[_0x819a('0x15')](handleEntityNotFound(_0x509bda,null))[_0x819a('0x15')](function(_0x347158){if(_0x347158){return rp({'method':'GET','uri':util[_0x819a('0x5b')](_0x819a('0x5c'),_0x347158[_0x819a('0x59')],_0x819a('0x5d')),'headers':{'Authorization':util[_0x819a('0x5b')](_0x819a('0x5e'),new Buffer(util[_0x819a('0x5b')](_0x819a('0x5f'),_0x347158['apiKey']))[_0x819a('0x60')](_0x819a('0x61')))},'json':!![]});}})['then'](function(_0xe2e34a){if(_0xe2e34a){var _0x393725=[_0x819a('0x62'),_0x819a('0x63'),'agent',_0x819a('0x64'),_0x819a('0x21'),_0x819a('0x65'),_0x819a('0x66'),_0x819a('0x67'),'ticket_type',_0x819a('0x66'),'company'];_['remove'](_0xe2e34a,function(_0x2b510b){return _0x393725[_0x819a('0x68')](_0x2b510b['name'])||!_0x2b510b[_0x819a('0x69')]&&_0x2b510b[_0x819a('0x55')]!=='custom_text';});return{'count':_0xe2e34a['length'],'rows':_['map'](_0xe2e34a,function(_0x41ac53){return{'id':_0x41ac53[_0x819a('0x2d')],'name':_0x41ac53['label'],'custom':!_0x41ac53[_0x819a('0x69')],'options':_0x41ac53[_0x819a('0x6a')]?_[_0x819a('0x44')](_0x41ac53[_0x819a('0x6a')],function(_0x355af6){return{'name':_[_0x819a('0x6b')](_0x355af6),'value':_0x355af6};}):[]};})};}})[_0x819a('0x15')](respondWithResult(_0x509bda,null))[_0x819a('0x20')](function(_0xa6d110){var _0x33f92f=_0x330008[_0x819a('0x33')]['test']?0x1f4:_0xa6d110['statusCode']||0x1f4;logger['error'](_0x819a('0x6c'),_0x819a('0x58'),_0x33f92f,JSON[_0x819a('0x1b')](_0xa6d110));delete _0xa6d110[_0x819a('0x2d')];if(_0x33f92f===0x191){_0x33f92f=0x190;}_0x509bda[_0x819a('0x21')](_0x33f92f)[_0x819a('0x6d')](_0x330008[_0x819a('0x33')][_0x819a('0x6e')]?{'message':_0x819a('0x6f'),'statusCode':_0xa6d110['statusCode']}:_0xa6d110);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 839390e..1ced140 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 _0x4a47=['FreshdeskAccount','lodash','util','../../config/logger','api','moment','request-promise','../../components/integrations/configuration','exports','define'];(function(_0x306346,_0x25b23){var _0xb59b7a=function(_0x1f1b6d){while(--_0x1f1b6d){_0x306346['push'](_0x306346['shift']());}};_0xb59b7a(++_0x25b23);}(_0x4a47,0xb5));var _0x74a4=function(_0xc9671e,_0x5ae235){_0xc9671e=_0xc9671e-0x0;var _0x54957a=_0x4a47[_0xc9671e];return _0x54957a;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var logger=require(_0x74a4('0x2'))(_0x74a4('0x3'));var moment=require(_0x74a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x74a4('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x74a4('0x6'));module[_0x74a4('0x7')]=function(_0x5af655,_0x43080b){return _0x5af655[_0x74a4('0x8')](_0x74a4('0x9'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb16f=['./intFreshdeskAccount.attributes','exports','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x52d5a0,_0x560706){var _0xc28e44=function(_0x5969cc){while(--_0x5969cc){_0x52d5a0['push'](_0x52d5a0['shift']());}};_0xc28e44(++_0x560706);}(_0xb16f,0xf6));var _0xfb16=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xb16f[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xfb16('0x0'));var util=require(_0xfb16('0x1'));var logger=require(_0xfb16('0x2'))('api');var moment=require(_0xfb16('0x3'));var BPromise=require(_0xfb16('0x4'));var rp=require(_0xfb16('0x5'));var attributes=require(_0xfb16('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xfb16('0x7')]=function(_0x5317a0,_0x4dadf4){return _0x5317a0['define']('FreshdeskAccount',attributes,{'tableName':_0xfb16('0x8'),'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 7366009..e075d42 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 _0x7275=['jayson/promise','request','info','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','then','ShowFreshdeskAccount','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2af042,_0x5ae936){var _0x2e6645=function(_0x46c177){while(--_0x46c177){_0x2af042['push'](_0x2af042['shift']());}};_0x2e6645(++_0x5ae936);}(_0x7275,0x143));var _0x5727=function(_0x53293b,_0x32d9f2){_0x53293b=_0x53293b-0x0;var _0x48ee8b=_0x7275[_0x53293b];return _0x48ee8b;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var moment=require(_0x5727('0x2'));var BPromise=require('bluebird');var rs=require(_0x5727('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5727('0x4'));var logger=require(_0x5727('0x5'))('rpc');var config=require(_0x5727('0x6'));var jayson=require(_0x5727('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4872ba,_0x336262,_0x49184a){return new BPromise(function(_0x33a6fe,_0x4de37c){return client[_0x5727('0x8')](_0x4872ba,_0x49184a)['then'](function(_0x10973c){logger[_0x5727('0x9')]('FreshdeskAccount,\x20%s,\x20%s',_0x336262,_0x5727('0xa'));logger[_0x5727('0xb')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x336262,_0x5727('0xa'),JSON[_0x5727('0xc')](_0x10973c));if(_0x10973c['error']){if(_0x10973c[_0x5727('0xd')][_0x5727('0xe')]===0x1f4){logger[_0x5727('0xd')](_0x5727('0xf'),_0x336262,_0x10973c[_0x5727('0xd')][_0x5727('0x10')]);return _0x4de37c(_0x10973c['error'][_0x5727('0x10')]);}logger[_0x5727('0xd')](_0x5727('0xf'),_0x336262,_0x10973c[_0x5727('0xd')][_0x5727('0x10')]);return _0x33a6fe(_0x10973c[_0x5727('0xd')][_0x5727('0x10')]);}else{logger['info'](_0x5727('0xf'),_0x336262,_0x5727('0xa'));_0x33a6fe(_0x10973c[_0x5727('0x11')][_0x5727('0x10')]);}})[_0x5727('0x12')](function(_0x31b6c0){logger[_0x5727('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x336262,_0x31b6c0);_0x4de37c(_0x31b6c0);});});}exports[_0x5727('0x13')]=function(_0x4bd6d7){var _0x360be0=this;return new Promise(function(_0x1df6ae,_0x55fc33){return db[_0x5727('0x14')][_0x5727('0x15')]({'raw':_0x4bd6d7[_0x5727('0x16')]?_0x4bd6d7[_0x5727('0x16')][_0x5727('0x17')]===undefined?!![]:![]:!![],'where':_0x4bd6d7['options']?_0x4bd6d7['options'][_0x5727('0x18')]||null:null,'attributes':_0x4bd6d7[_0x5727('0x16')]?_0x4bd6d7[_0x5727('0x16')][_0x5727('0x19')]||null:null,'limit':_0x4bd6d7[_0x5727('0x16')]?_0x4bd6d7[_0x5727('0x16')][_0x5727('0x1a')]||null:null,'include':_0x4bd6d7['options']?_0x4bd6d7[_0x5727('0x16')][_0x5727('0x1b')]?_[_0x5727('0x1c')](_0x4bd6d7['options'][_0x5727('0x1b')],function(_0xb217a7){return{'model':db[_0xb217a7[_0x5727('0x1d')]],'as':_0xb217a7['as'],'attributes':_0xb217a7['attributes'],'include':_0xb217a7['include']?_[_0x5727('0x1c')](_0xb217a7[_0x5727('0x1b')],function(_0x5d33bb){return{'model':db[_0x5d33bb[_0x5727('0x1d')]],'as':_0x5d33bb['as'],'attributes':_0x5d33bb['attributes'],'include':_0x5d33bb[_0x5727('0x1b')]?_[_0x5727('0x1c')](_0x5d33bb['include'],function(_0x564779){return{'model':db[_0x564779[_0x5727('0x1d')]],'as':_0x564779['as'],'attributes':_0x564779['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd7d2){logger[_0x5727('0x9')](_0x5727('0x13'),_0x4bd6d7);logger[_0x5727('0xb')](_0x5727('0x13'),_0x4bd6d7,JSON['stringify'](_0x3dd7d2));_0x1df6ae(_0x3dd7d2);})['catch'](function(_0x1a6356){logger[_0x5727('0xd')](_0x5727('0x13'),_0x1a6356[_0x5727('0x10')],_0x4bd6d7);_0x55fc33(_0x360be0['error'](0x1f4,_0x1a6356[_0x5727('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0x1d81ab){var _0x4bdae7=this;return new Promise(function(_0x19636b,_0x5a6827){return db[_0x5727('0x14')][_0x5727('0x1e')]({'raw':_0x1d81ab[_0x5727('0x16')]?_0x1d81ab[_0x5727('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1d81ab[_0x5727('0x16')]?_0x1d81ab[_0x5727('0x16')]['where']||null:null,'attributes':_0x1d81ab['options']?_0x1d81ab[_0x5727('0x16')][_0x5727('0x19')]||null:null,'include':_0x1d81ab[_0x5727('0x16')]?_0x1d81ab[_0x5727('0x16')][_0x5727('0x1b')]?_['map'](_0x1d81ab[_0x5727('0x16')][_0x5727('0x1b')],function(_0x447940){return{'model':db[_0x447940[_0x5727('0x1d')]],'as':_0x447940['as'],'attributes':_0x447940[_0x5727('0x19')],'include':_0x447940[_0x5727('0x1b')]?_[_0x5727('0x1c')](_0x447940[_0x5727('0x1b')],function(_0x299a6e){return{'model':db[_0x299a6e[_0x5727('0x1d')]],'as':_0x299a6e['as'],'attributes':_0x299a6e[_0x5727('0x19')],'include':_0x299a6e[_0x5727('0x1b')]?_[_0x5727('0x1c')](_0x299a6e[_0x5727('0x1b')],function(_0x4c18cc){return{'model':db[_0x4c18cc[_0x5727('0x1d')]],'as':_0x4c18cc['as'],'attributes':_0x4c18cc[_0x5727('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5727('0x1f')](function(_0x1141e6){logger[_0x5727('0x9')]('ShowFreshdeskAccount',_0x1d81ab);logger[_0x5727('0xb')](_0x5727('0x20'),_0x1d81ab,JSON[_0x5727('0xc')](_0x1141e6));_0x19636b(_0x1141e6);})['catch'](function(_0x49e3f5){logger[_0x5727('0xd')]('ShowFreshdeskAccount',_0x49e3f5['message'],_0x1d81ab);_0x5a6827(_0x4bdae7['error'](0x1f4,_0x49e3f5['message']));});});}; \ No newline at end of file +var _0x93e9=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x93e9,0xcc));var _0x993e=function(_0x19aa32,_0x33381b){_0x19aa32=_0x19aa32-0x0;var _0x104dd6=_0x93e9[_0x19aa32];return _0x104dd6;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var db=require(_0x993e('0x5'))['db'];var utils=require(_0x993e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x993e('0x7'));var jayson=require(_0x993e('0x8'));var client=jayson[_0x993e('0x9')][_0x993e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1da414,_0x2366d9,_0x12ac94){return new BPromise(function(_0x1aef74,_0x53d0ce){return client[_0x993e('0xb')](_0x1da414,_0x12ac94)[_0x993e('0xc')](function(_0x15d774){logger[_0x993e('0xd')](_0x993e('0xe'),_0x2366d9,_0x993e('0xf'));logger[_0x993e('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2366d9,_0x993e('0xf'),JSON[_0x993e('0x11')](_0x15d774));if(_0x15d774['error']){if(_0x15d774['error'][_0x993e('0x12')]===0x1f4){logger['error'](_0x993e('0xe'),_0x2366d9,_0x15d774['error']['message']);return _0x53d0ce(_0x15d774[_0x993e('0x13')][_0x993e('0x14')]);}logger[_0x993e('0x13')](_0x993e('0xe'),_0x2366d9,_0x15d774[_0x993e('0x13')][_0x993e('0x14')]);return _0x1aef74(_0x15d774[_0x993e('0x13')][_0x993e('0x14')]);}else{logger[_0x993e('0xd')](_0x993e('0xe'),_0x2366d9,_0x993e('0xf'));_0x1aef74(_0x15d774[_0x993e('0x15')][_0x993e('0x14')]);}})[_0x993e('0x16')](function(_0x1f267f){logger[_0x993e('0x13')](_0x993e('0xe'),_0x2366d9,_0x1f267f);_0x53d0ce(_0x1f267f);});});}exports['GetFreshdeskAccount']=function(_0x22f7cc){var _0x1acd21=this;return new Promise(function(_0x3cc2b9,_0x3d6109){return db[_0x993e('0x17')][_0x993e('0x18')]({'raw':_0x22f7cc['options']?_0x22f7cc[_0x993e('0x19')][_0x993e('0x1a')]===undefined?!![]:![]:!![],'where':_0x22f7cc[_0x993e('0x19')]?_0x22f7cc[_0x993e('0x19')][_0x993e('0x1b')]||null:null,'attributes':_0x22f7cc[_0x993e('0x19')]?_0x22f7cc[_0x993e('0x19')][_0x993e('0x1c')]||null:null,'limit':_0x22f7cc['options']?_0x22f7cc[_0x993e('0x19')]['limit']||null:null,'include':_0x22f7cc[_0x993e('0x19')]?_0x22f7cc[_0x993e('0x19')][_0x993e('0x1d')]?_['map'](_0x22f7cc[_0x993e('0x19')][_0x993e('0x1d')],function(_0xfba00f){return{'model':db[_0xfba00f[_0x993e('0x1e')]],'as':_0xfba00f['as'],'attributes':_0xfba00f[_0x993e('0x1c')],'include':_0xfba00f[_0x993e('0x1d')]?_[_0x993e('0x1f')](_0xfba00f[_0x993e('0x1d')],function(_0x1312df){return{'model':db[_0x1312df[_0x993e('0x1e')]],'as':_0x1312df['as'],'attributes':_0x1312df[_0x993e('0x1c')],'include':_0x1312df[_0x993e('0x1d')]?_['map'](_0x1312df[_0x993e('0x1d')],function(_0x279bb8){return{'model':db[_0x279bb8['model']],'as':_0x279bb8['as'],'attributes':_0x279bb8[_0x993e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14a0c7){logger[_0x993e('0xd')](_0x993e('0x20'),_0x22f7cc);logger[_0x993e('0x10')]('GetFreshdeskAccount',_0x22f7cc,JSON['stringify'](_0x14a0c7));_0x3cc2b9(_0x14a0c7);})[_0x993e('0x16')](function(_0x466d63){logger['error'](_0x993e('0x20'),_0x466d63[_0x993e('0x14')],_0x22f7cc);_0x3d6109(_0x1acd21[_0x993e('0x13')](0x1f4,_0x466d63['message']));});});};exports[_0x993e('0x21')]=function(_0x9e0309){var _0x1f5d51=this;return new Promise(function(_0x1fa8a5,_0x2599ec){return db['FreshdeskAccount'][_0x993e('0x22')]({'raw':_0x9e0309['options']?_0x9e0309[_0x993e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x9e0309[_0x993e('0x19')]?_0x9e0309['options'][_0x993e('0x1b')]||null:null,'attributes':_0x9e0309[_0x993e('0x19')]?_0x9e0309[_0x993e('0x19')][_0x993e('0x1c')]||null:null,'include':_0x9e0309[_0x993e('0x19')]?_0x9e0309[_0x993e('0x19')]['include']?_[_0x993e('0x1f')](_0x9e0309['options']['include'],function(_0x997dea){return{'model':db[_0x997dea['model']],'as':_0x997dea['as'],'attributes':_0x997dea[_0x993e('0x1c')],'include':_0x997dea[_0x993e('0x1d')]?_[_0x993e('0x1f')](_0x997dea[_0x993e('0x1d')],function(_0x3fd06e){return{'model':db[_0x3fd06e[_0x993e('0x1e')]],'as':_0x3fd06e['as'],'attributes':_0x3fd06e[_0x993e('0x1c')],'include':_0x3fd06e[_0x993e('0x1d')]?_[_0x993e('0x1f')](_0x3fd06e[_0x993e('0x1d')],function(_0x248edf){return{'model':db[_0x248edf[_0x993e('0x1e')]],'as':_0x248edf['as'],'attributes':_0x248edf[_0x993e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x993e('0xc')](function(_0x3d86b6){logger['info'](_0x993e('0x21'),_0x9e0309);logger[_0x993e('0x10')](_0x993e('0x21'),_0x9e0309,JSON[_0x993e('0x11')](_0x3d86b6));_0x1fa8a5(_0x3d86b6);})[_0x993e('0x16')](function(_0x6f8808){logger[_0x993e('0x13')](_0x993e('0x21'),_0x6f8808[_0x993e('0x14')],_0x9e0309);_0x2599ec(_0x1f5d51['error'](0x1f4,_0x6f8808[_0x993e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ce21f5b..17277d7 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 _0xa9e0=['index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','exports','multer','util','path','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x3804c3,_0x3a7c96){var _0x44d776=function(_0x2bfeaf){while(--_0x2bfeaf){_0x3804c3['push'](_0x3804c3['shift']());}};_0x44d776(++_0x3a7c96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id/fields',auth[_0x0a9e('0x7')](),controller['getFields']);router['get'](_0x0a9e('0xb'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x7')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x7')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','exports','multer','util','path','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x46becf,_0x14443c){var _0x315605=function(_0x523cf8){while(--_0x523cf8){_0x46becf['push'](_0x46becf['shift']());}};_0x315605(++_0x14443c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id/fields',auth[_0x0a9e('0x7')](),controller['getFields']);router['get'](_0x0a9e('0xb'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x7')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x7')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d36c026..5e49719 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 _0x170f=['STRING','sequelize'];(function(_0x5d7c13,_0x3a77b0){var _0x11822b=function(_0x3f0dbb){while(--_0x3f0dbb){_0x5d7c13['push'](_0x5d7c13['shift']());}};_0x11822b(++_0x3a77b0);}(_0x170f,0x71));var _0xf170=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0x170f[_0x239dba];return _0x1ceb11;};'use strict';var Sequelize=require(_0xf170('0x0'));module['exports']={'name':{'type':Sequelize[_0xf170('0x1')]},'description':{'type':Sequelize[_0xf170('0x1')]}}; \ No newline at end of file +var _0xf4a4=['exports','STRING','sequelize'];(function(_0xa26a6e,_0x5365fc){var _0x4fa885=function(_0x3c0902){while(--_0x3c0902){_0xa26a6e['push'](_0xa26a6e['shift']());}};_0x4fa885(++_0x5365fc);}(_0xf4a4,0x164));var _0x4f4a=function(_0x9462bc,_0x80dc97){_0x9462bc=_0x9462bc-0x0;var _0x246734=_0xf4a4[_0x9462bc];return _0x246734;};'use strict';var Sequelize=require(_0x4f4a('0x0'));module[_0x4f4a('0x1')]={'name':{'type':Sequelize[_0x4f4a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 512e839..8f61d62 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 _0x9165=['set','Content-Range','apply','save','update','end','sendStatus','stack','send','index','FreshdeskConfiguration','model','keys','dateStart','dateEnd','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','day','add','merge','map','filter','include','findAll','rows','params','rawAttributes','length','includeAll','find','create','body','destroy','getFields','findOne','FreshdeskField','options','getSubjects','getDescriptions','getTags','pick','setTags','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','count','offset','limit'];(function(_0x5c06f5,_0x4f9be0){var _0x154a8d=function(_0x529727){while(--_0x529727){_0x5c06f5['push'](_0x5c06f5['shift']());}};_0x154a8d(++_0x4f9be0);}(_0x9165,0xe2));var _0x5916=function(_0x2ad809,_0x303b8e){_0x2ad809=_0x2ad809-0x0;var _0x451429=_0x9165[_0x2ad809];return _0x451429;};'use strict';var jsonpatch=require(_0x5916('0x0'));var rp=require(_0x5916('0x1'));var moment=require(_0x5916('0x2'));var BPromise=require(_0x5916('0x3'));var Mustache=require(_0x5916('0x4'));var util=require('util');var path=require(_0x5916('0x5'));var sox=require(_0x5916('0x6'));var csv=require(_0x5916('0x7'));var ejs=require(_0x5916('0x8'));var fs=require('fs');var _=require(_0x5916('0x9'));var squel=require(_0x5916('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5916('0xb'));var toCsv=require(_0x5916('0x7'));var querystring=require(_0x5916('0xc'));var Papa=require(_0x5916('0xd'));var qs=require(_0x5916('0xe'));var logger=require(_0x5916('0xf'))(_0x5916('0x10'));var utils=require('../../config/utils');var config=require(_0x5916('0x11'));var db=require(_0x5916('0x12'))['db'];var jayson=require(_0x5916('0x13'));var client=jayson[_0x5916('0x14')][_0x5916('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x154fb0,_0x55a1da,_0x1f3298,_0x3f0acd){return new BPromise(function(_0x3501da,_0x4d18f7){var _0x5c5225=_0x3f0acd||client;return _0x5c5225[_0x5916('0x16')](_0x154fb0,_0x1f3298)[_0x5916('0x17')](function(_0x5d979f){logger[_0x5916('0x18')](_0x5916('0x19'),_0x55a1da,_0x5916('0x1a'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x55a1da,_0x5916('0x1a'),JSON[_0x5916('0x1b')](_0x5d979f));if(_0x5d979f[_0x5916('0x1c')]){if(_0x5d979f[_0x5916('0x1c')][_0x5916('0x1d')]===0x1f4){logger[_0x5916('0x1c')](_0x5916('0x19'),_0x55a1da,_0x5d979f[_0x5916('0x1c')]['message']);return _0x4d18f7(_0x5d979f[_0x5916('0x1c')][_0x5916('0x1e')]);}logger[_0x5916('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x55a1da,_0x5d979f[_0x5916('0x1c')]['message']);return _0x3501da(_0x5d979f[_0x5916('0x1c')][_0x5916('0x1e')]);}else{logger[_0x5916('0x18')](_0x5916('0x19'),_0x55a1da,'request\x20sent');_0x3501da(_0x5d979f[_0x5916('0x1f')][_0x5916('0x1e')]);}})[_0x5916('0x20')](function(_0x3b9b54){logger['error'](_0x5916('0x19'),_0x55a1da,_0x3b9b54);_0x4d18f7(_0x3b9b54);});});}function respondWithStatusCode(_0x144843,_0x177ab0){_0x177ab0=_0x177ab0||0xcc;return function(_0xa52f6f){if(_0xa52f6f){return _0x144843['sendStatus'](_0x177ab0);}return _0x144843[_0x5916('0x21')](_0x177ab0)['end']();};}function respondWithResult(_0x41238f,_0x7c5ec6){_0x7c5ec6=_0x7c5ec6||0xc8;return function(_0x93d778){if(_0x93d778){return _0x41238f[_0x5916('0x21')](_0x7c5ec6)[_0x5916('0x22')](_0x93d778);}};}function respondWithFilteredResult(_0x14759a,_0x4dd685){return function(_0x5e3519){if(_0x5e3519){var _0x3d0c49=_0x5e3519[_0x5916('0x23')],_0x56adab=_0x4dd685[_0x5916('0x24')],_0x2bb41e=_0x4dd685[_0x5916('0x24')]+_0x4dd685[_0x5916('0x25')],_0x2f1ada;if(_0x2bb41e>=_0x3d0c49){_0x2bb41e=_0x3d0c49;_0x2f1ada=0xc8;}else{_0x2f1ada=0xce;}_0x14759a[_0x5916('0x21')](_0x2f1ada);return _0x14759a[_0x5916('0x26')](_0x5916('0x27'),_0x56adab+'-'+_0x2bb41e+'/'+_0x3d0c49)[_0x5916('0x22')](_0x5e3519);}return null;};}function patchUpdates(_0x44e1ec){return function(_0x5acc93){try{jsonpatch[_0x5916('0x28')](_0x5acc93,_0x44e1ec,!![]);}catch(_0x527e7b){return BPromise['reject'](_0x527e7b);}return _0x5acc93[_0x5916('0x29')]();};}function saveUpdates(_0x390c7f,_0x2716ac){return function(_0x525910){if(_0x525910){return _0x525910[_0x5916('0x2a')](_0x390c7f)[_0x5916('0x17')](function(_0x38823d){return _0x38823d;});}return null;};}function removeEntity(_0x393b25,_0x307075){return function(_0x572dbd){if(_0x572dbd){return _0x572dbd['destroy']()[_0x5916('0x17')](function(){_0x393b25[_0x5916('0x21')](0xcc)[_0x5916('0x2b')]();});}};}function handleEntityNotFound(_0x4880d2,_0x3f335e){return function(_0x4ebc59){if(!_0x4ebc59){_0x4880d2[_0x5916('0x2c')](0x194);}return _0x4ebc59;};}function handleError(_0x22cad1,_0x3ad132){_0x3ad132=_0x3ad132||0x1f4;return function(_0x5676d2){logger['error'](_0x5676d2[_0x5916('0x2d')]);if(_0x5676d2['name']){delete _0x5676d2['name'];}_0x22cad1[_0x5916('0x21')](_0x3ad132)[_0x5916('0x2e')](_0x5676d2);};}exports[_0x5916('0x2f')]=function(_0x24850d,_0x47a2ad){var _0x4aeff8={},_0x3fac82={},_0x2ee663={'count':0x0,'rows':[]};var _0x534281=db[_0x5916('0x30')]['rawAttributes'];_0x3fac82[_0x5916('0x31')]=_[_0x5916('0x32')](_0x534281);var _0x50c93e={'dateStart':_0x24850d['query'][_0x5916('0x33')],'dateEnd':_0x24850d['query'][_0x5916('0x34')]};delete _0x24850d[_0x5916('0x35')][_0x5916('0x33')];delete _0x24850d[_0x5916('0x35')][_0x5916('0x34')];_0x3fac82[_0x5916('0x35')]=_[_0x5916('0x32')](_0x24850d[_0x5916('0x35')]);_0x3fac82[_0x5916('0x36')]=_[_0x5916('0x37')](_0x3fac82[_0x5916('0x31')],_0x3fac82[_0x5916('0x35')]);_0x4aeff8['attributes']=_[_0x5916('0x37')](_0x3fac82[_0x5916('0x31')],qs['fields'](_0x24850d['query'][_0x5916('0x38')]));_0x4aeff8[_0x5916('0x39')]=_0x4aeff8[_0x5916('0x39')]['length']?_0x4aeff8[_0x5916('0x39')]:_0x3fac82[_0x5916('0x31')];if(!_0x24850d[_0x5916('0x35')][_0x5916('0x3a')](_0x5916('0x3b'))){_0x4aeff8[_0x5916('0x25')]=qs[_0x5916('0x25')](_0x24850d['query'][_0x5916('0x25')]);_0x4aeff8[_0x5916('0x24')]=qs[_0x5916('0x24')](_0x24850d[_0x5916('0x35')][_0x5916('0x24')]);}_0x4aeff8[_0x5916('0x3c')]=qs[_0x5916('0x3d')](_0x24850d['query']['sort']);_0x4aeff8[_0x5916('0x3e')]=qs[_0x5916('0x36')](_['pick'](_0x24850d[_0x5916('0x35')],_0x3fac82[_0x5916('0x36')]));if(_0x50c93e[_0x5916('0x33')]){if(_0x50c93e[_0x5916('0x34')]){_0x50c93e[_0x5916('0x34')]=moment(_0x50c93e[_0x5916('0x34')])['add'](0x1,_0x5916('0x3f'));}else{_0x50c93e[_0x5916('0x34')]=moment(_0x50c93e[_0x5916('0x33')])[_0x5916('0x40')](0x1,_0x5916('0x3f'));}_[_0x5916('0x41')](_0x4aeff8['where'],{'createdAt':{'$gte':_0x50c93e[_0x5916('0x33')],'$lte':_0x50c93e['dateEnd']}});}if(_0x24850d[_0x5916('0x35')]['filter']){_0x4aeff8[_0x5916('0x3e')]=_['merge'](_0x4aeff8['where'],{'$or':_[_0x5916('0x42')](_0x4aeff8[_0x5916('0x39')],function(_0x399f4c){var _0x136374={};_0x136374[_0x399f4c]={'$like':'%'+_0x24850d[_0x5916('0x35')][_0x5916('0x43')]+'%'};return _0x136374;})});}_0x4aeff8=_[_0x5916('0x41')]({},_0x4aeff8,_0x24850d['options']);var _0x5d1c7a={'where':_0x4aeff8[_0x5916('0x3e')]};return db[_0x5916('0x30')]['count'](_0x5d1c7a)['then'](function(_0x4db72a){_0x2ee663[_0x5916('0x23')]=_0x4db72a;if(_0x24850d['query']['includeAll']){_0x4aeff8[_0x5916('0x44')]=[{'all':!![]}];}return db[_0x5916('0x30')][_0x5916('0x45')](_0x4aeff8);})[_0x5916('0x17')](function(_0x3da5c2){_0x2ee663[_0x5916('0x46')]=_0x3da5c2;return _0x2ee663;})[_0x5916('0x17')](respondWithFilteredResult(_0x47a2ad,_0x4aeff8))[_0x5916('0x20')](handleError(_0x47a2ad,null));};exports['show']=function(_0x1eef16,_0x20f022){var _0x5e2c06={'raw':![],'where':{'id':_0x1eef16[_0x5916('0x47')]['id']}},_0x5bc7a7={};_0x5bc7a7['model']=_[_0x5916('0x32')](db[_0x5916('0x30')][_0x5916('0x48')]);_0x5bc7a7[_0x5916('0x35')]=_['keys'](_0x1eef16[_0x5916('0x35')]);_0x5bc7a7[_0x5916('0x36')]=_[_0x5916('0x37')](_0x5bc7a7[_0x5916('0x31')],_0x5bc7a7[_0x5916('0x35')]);_0x5e2c06[_0x5916('0x39')]=_[_0x5916('0x37')](_0x5bc7a7[_0x5916('0x31')],qs[_0x5916('0x38')](_0x1eef16[_0x5916('0x35')][_0x5916('0x38')]));_0x5e2c06[_0x5916('0x39')]=_0x5e2c06[_0x5916('0x39')][_0x5916('0x49')]?_0x5e2c06[_0x5916('0x39')]:_0x5bc7a7['model'];if(_0x1eef16[_0x5916('0x35')][_0x5916('0x4a')]){_0x5e2c06['include']=[{'all':!![]}];}_0x5e2c06=_[_0x5916('0x41')]({},_0x5e2c06,_0x1eef16['options']);return db[_0x5916('0x30')][_0x5916('0x4b')](_0x5e2c06)[_0x5916('0x17')](handleEntityNotFound(_0x20f022,null))[_0x5916('0x17')](respondWithResult(_0x20f022,null))[_0x5916('0x20')](handleError(_0x20f022,null));};exports[_0x5916('0x4c')]=function(_0x281d23,_0x8d95a4){return db[_0x5916('0x30')]['create'](_0x281d23[_0x5916('0x4d')],{})[_0x5916('0x17')](respondWithResult(_0x8d95a4,0xc9))['catch'](handleError(_0x8d95a4,null));};exports[_0x5916('0x2a')]=function(_0x8641c,_0x58eb95){if(_0x8641c[_0x5916('0x4d')]['id']){delete _0x8641c['body']['id'];}return db[_0x5916('0x30')][_0x5916('0x4b')]({'where':{'id':_0x8641c[_0x5916('0x47')]['id']}})[_0x5916('0x17')](handleEntityNotFound(_0x58eb95,null))[_0x5916('0x17')](saveUpdates(_0x8641c[_0x5916('0x4d')],null))[_0x5916('0x17')](respondWithResult(_0x58eb95,null))[_0x5916('0x20')](handleError(_0x58eb95,null));};exports[_0x5916('0x4e')]=function(_0x3620d9,_0x2c0b08){return db[_0x5916('0x30')][_0x5916('0x4b')]({'where':{'id':_0x3620d9[_0x5916('0x47')]['id']}})[_0x5916('0x17')](handleEntityNotFound(_0x2c0b08,null))[_0x5916('0x17')](removeEntity(_0x2c0b08,null))['catch'](handleError(_0x2c0b08,null));};exports[_0x5916('0x4f')]=function(_0x1b055a,_0x11aa18,_0x5d10ca){var _0x2c21ca={};var _0x1328fb={};var _0x2992ea;var _0x3c1ed9;return db[_0x5916('0x30')][_0x5916('0x50')]({'where':{'id':_0x1b055a[_0x5916('0x47')]['id']}})[_0x5916('0x17')](handleEntityNotFound(_0x11aa18,null))[_0x5916('0x17')](function(_0x26c697){if(_0x26c697){_0x2992ea=_0x26c697;_0x1328fb[_0x5916('0x31')]=_[_0x5916('0x32')](db[_0x5916('0x51')][_0x5916('0x48')]);_0x1328fb[_0x5916('0x35')]=_[_0x5916('0x32')](_0x1b055a['query']);_0x1328fb[_0x5916('0x36')]=_[_0x5916('0x37')](_0x1328fb['model'],_0x1328fb[_0x5916('0x35')]);_0x2c21ca['attributes']=_['intersection'](_0x1328fb[_0x5916('0x31')],qs[_0x5916('0x38')](_0x1b055a[_0x5916('0x35')]['fields']));_0x2c21ca[_0x5916('0x39')]=_0x2c21ca[_0x5916('0x39')][_0x5916('0x49')]?_0x2c21ca[_0x5916('0x39')]:_0x1328fb[_0x5916('0x31')];_0x2c21ca[_0x5916('0x3c')]=qs[_0x5916('0x3d')](_0x1b055a[_0x5916('0x35')][_0x5916('0x3d')]);_0x2c21ca[_0x5916('0x3e')]=qs['filters'](_['pick'](_0x1b055a['query'],_0x1328fb[_0x5916('0x36')]));if(_0x1b055a[_0x5916('0x35')]['filter']){_0x2c21ca[_0x5916('0x3e')]=_[_0x5916('0x41')](_0x2c21ca['where'],{'$or':_[_0x5916('0x42')](_0x2c21ca['attributes'],function(_0x51b140){var _0x41c87c={};_0x41c87c[_0x51b140]={'$like':'%'+_0x1b055a[_0x5916('0x35')][_0x5916('0x43')]+'%'};return _0x41c87c;})});}_0x2c21ca=_['merge']({},_0x2c21ca,_0x1b055a[_0x5916('0x52')]);return _0x2992ea[_0x5916('0x4f')](_0x2c21ca);}})[_0x5916('0x17')](function(_0x4e4a08){if(_0x4e4a08){_0x3c1ed9=_0x4e4a08[_0x5916('0x49')];if(!_0x1b055a[_0x5916('0x35')][_0x5916('0x3a')]('nolimit')){_0x2c21ca['limit']=qs[_0x5916('0x25')](_0x1b055a[_0x5916('0x35')]['limit']);_0x2c21ca['offset']=qs['offset'](_0x1b055a[_0x5916('0x35')][_0x5916('0x24')]);}return _0x2992ea[_0x5916('0x4f')](_0x2c21ca);}})[_0x5916('0x17')](function(_0x17afec){if(_0x17afec){return _0x17afec?{'count':_0x3c1ed9,'rows':_0x17afec}:null;}})['then'](respondWithResult(_0x11aa18,null))['catch'](handleError(_0x11aa18,null));};exports[_0x5916('0x53')]=function(_0x2859e2,_0x207af4,_0x237476){var _0x2b6362={};var _0x42c339={};var _0x3e8955;var _0x4a7f43;return db['FreshdeskConfiguration'][_0x5916('0x50')]({'where':{'id':_0x2859e2['params']['id']}})['then'](handleEntityNotFound(_0x207af4,null))[_0x5916('0x17')](function(_0x141aa7){if(_0x141aa7){_0x3e8955=_0x141aa7;_0x42c339[_0x5916('0x31')]=_[_0x5916('0x32')](db[_0x5916('0x51')][_0x5916('0x48')]);_0x42c339['query']=_[_0x5916('0x32')](_0x2859e2[_0x5916('0x35')]);_0x42c339['filters']=_['intersection'](_0x42c339[_0x5916('0x31')],_0x42c339['query']);_0x2b6362[_0x5916('0x39')]=_[_0x5916('0x37')](_0x42c339[_0x5916('0x31')],qs['fields'](_0x2859e2['query'][_0x5916('0x38')]));_0x2b6362[_0x5916('0x39')]=_0x2b6362[_0x5916('0x39')]['length']?_0x2b6362[_0x5916('0x39')]:_0x42c339[_0x5916('0x31')];_0x2b6362['order']=qs['sort'](_0x2859e2[_0x5916('0x35')][_0x5916('0x3d')]);_0x2b6362[_0x5916('0x3e')]=qs[_0x5916('0x36')](_['pick'](_0x2859e2['query'],_0x42c339['filters']));if(_0x2859e2[_0x5916('0x35')][_0x5916('0x43')]){_0x2b6362[_0x5916('0x3e')]=_[_0x5916('0x41')](_0x2b6362[_0x5916('0x3e')],{'$or':_[_0x5916('0x42')](_0x2b6362[_0x5916('0x39')],function(_0x371e43){var _0xee03dd={};_0xee03dd[_0x371e43]={'$like':'%'+_0x2859e2[_0x5916('0x35')][_0x5916('0x43')]+'%'};return _0xee03dd;})});}_0x2b6362=_['merge']({},_0x2b6362,_0x2859e2[_0x5916('0x52')]);return _0x3e8955[_0x5916('0x53')](_0x2b6362);}})['then'](function(_0x247709){if(_0x247709){_0x4a7f43=_0x247709['length'];if(!_0x2859e2[_0x5916('0x35')][_0x5916('0x3a')](_0x5916('0x3b'))){_0x2b6362[_0x5916('0x25')]=qs[_0x5916('0x25')](_0x2859e2[_0x5916('0x35')][_0x5916('0x25')]);_0x2b6362['offset']=qs[_0x5916('0x24')](_0x2859e2[_0x5916('0x35')]['offset']);}return _0x3e8955['getSubjects'](_0x2b6362);}})[_0x5916('0x17')](function(_0x45582e){if(_0x45582e){return _0x45582e?{'count':_0x4a7f43,'rows':_0x45582e}:null;}})['then'](respondWithResult(_0x207af4,null))[_0x5916('0x20')](handleError(_0x207af4,null));};exports[_0x5916('0x54')]=function(_0x1a432e,_0x1c9225,_0x13d3d9){var _0x171a1f={};var _0x32d2e2={};var _0x42f333;var _0x432001;return db[_0x5916('0x30')][_0x5916('0x50')]({'where':{'id':_0x1a432e[_0x5916('0x47')]['id']}})[_0x5916('0x17')](handleEntityNotFound(_0x1c9225,null))[_0x5916('0x17')](function(_0x4b7e03){if(_0x4b7e03){_0x42f333=_0x4b7e03;_0x32d2e2[_0x5916('0x31')]=_['keys'](db[_0x5916('0x51')]['rawAttributes']);_0x32d2e2[_0x5916('0x35')]=_[_0x5916('0x32')](_0x1a432e[_0x5916('0x35')]);_0x32d2e2[_0x5916('0x36')]=_[_0x5916('0x37')](_0x32d2e2['model'],_0x32d2e2[_0x5916('0x35')]);_0x171a1f[_0x5916('0x39')]=_[_0x5916('0x37')](_0x32d2e2[_0x5916('0x31')],qs[_0x5916('0x38')](_0x1a432e[_0x5916('0x35')][_0x5916('0x38')]));_0x171a1f[_0x5916('0x39')]=_0x171a1f['attributes']['length']?_0x171a1f[_0x5916('0x39')]:_0x32d2e2[_0x5916('0x31')];_0x171a1f[_0x5916('0x3c')]=qs[_0x5916('0x3d')](_0x1a432e['query'][_0x5916('0x3d')]);_0x171a1f[_0x5916('0x3e')]=qs[_0x5916('0x36')](_['pick'](_0x1a432e[_0x5916('0x35')],_0x32d2e2['filters']));if(_0x1a432e[_0x5916('0x35')][_0x5916('0x43')]){_0x171a1f['where']=_[_0x5916('0x41')](_0x171a1f[_0x5916('0x3e')],{'$or':_[_0x5916('0x42')](_0x171a1f[_0x5916('0x39')],function(_0x4d3c3b){var _0x31380a={};_0x31380a[_0x4d3c3b]={'$like':'%'+_0x1a432e[_0x5916('0x35')]['filter']+'%'};return _0x31380a;})});}_0x171a1f=_[_0x5916('0x41')]({},_0x171a1f,_0x1a432e[_0x5916('0x52')]);return _0x42f333[_0x5916('0x54')](_0x171a1f);}})[_0x5916('0x17')](function(_0x14ccdc){if(_0x14ccdc){_0x432001=_0x14ccdc['length'];if(!_0x1a432e[_0x5916('0x35')]['hasOwnProperty']('nolimit')){_0x171a1f['limit']=qs['limit'](_0x1a432e[_0x5916('0x35')][_0x5916('0x25')]);_0x171a1f['offset']=qs[_0x5916('0x24')](_0x1a432e[_0x5916('0x35')][_0x5916('0x24')]);}return _0x42f333[_0x5916('0x54')](_0x171a1f);}})[_0x5916('0x17')](function(_0x405669){if(_0x405669){return _0x405669?{'count':_0x432001,'rows':_0x405669}:null;}})[_0x5916('0x17')](respondWithResult(_0x1c9225,null))['catch'](handleError(_0x1c9225,null));};exports[_0x5916('0x55')]=function(_0x32be77,_0x356e55,_0x4a4565){var _0x5bb6c2={};var _0x2e2327={};var _0x3e5ad6;var _0x1c0bfc;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x32be77['params']['id']}})['then'](handleEntityNotFound(_0x356e55,null))[_0x5916('0x17')](function(_0x5e4cbb){if(_0x5e4cbb){_0x3e5ad6=_0x5e4cbb;_0x2e2327[_0x5916('0x31')]=_[_0x5916('0x32')](db['Tag']['rawAttributes']);_0x2e2327['query']=_[_0x5916('0x32')](_0x32be77[_0x5916('0x35')]);_0x2e2327['filters']=_[_0x5916('0x37')](_0x2e2327[_0x5916('0x31')],_0x2e2327['query']);_0x5bb6c2[_0x5916('0x39')]=_[_0x5916('0x37')](_0x2e2327['model'],qs[_0x5916('0x38')](_0x32be77[_0x5916('0x35')][_0x5916('0x38')]));_0x5bb6c2['attributes']=_0x5bb6c2[_0x5916('0x39')]['length']?_0x5bb6c2[_0x5916('0x39')]:_0x2e2327[_0x5916('0x31')];_0x5bb6c2[_0x5916('0x3c')]=qs[_0x5916('0x3d')](_0x32be77[_0x5916('0x35')][_0x5916('0x3d')]);_0x5bb6c2[_0x5916('0x3e')]=qs[_0x5916('0x36')](_[_0x5916('0x56')](_0x32be77[_0x5916('0x35')],_0x2e2327[_0x5916('0x36')]));if(_0x32be77[_0x5916('0x35')][_0x5916('0x43')]){_0x5bb6c2[_0x5916('0x3e')]=_[_0x5916('0x41')](_0x5bb6c2[_0x5916('0x3e')],{'$or':_[_0x5916('0x42')](_0x5bb6c2[_0x5916('0x39')],function(_0x258f1b){var _0x5586bd={};_0x5586bd[_0x258f1b]={'$like':'%'+_0x32be77[_0x5916('0x35')][_0x5916('0x43')]+'%'};return _0x5586bd;})});}_0x5bb6c2=_[_0x5916('0x41')]({},_0x5bb6c2,_0x32be77[_0x5916('0x52')]);return _0x3e5ad6[_0x5916('0x55')](_0x5bb6c2);}})['then'](function(_0x52c740){if(_0x52c740){_0x1c0bfc=_0x52c740[_0x5916('0x49')];if(!_0x32be77[_0x5916('0x35')][_0x5916('0x3a')](_0x5916('0x3b'))){_0x5bb6c2[_0x5916('0x25')]=qs[_0x5916('0x25')](_0x32be77[_0x5916('0x35')][_0x5916('0x25')]);_0x5bb6c2[_0x5916('0x24')]=qs[_0x5916('0x24')](_0x32be77[_0x5916('0x35')][_0x5916('0x24')]);}return _0x3e5ad6[_0x5916('0x55')](_0x5bb6c2);}})['then'](function(_0x5ec571){if(_0x5ec571){return _0x5ec571?{'count':_0x1c0bfc,'rows':_0x5ec571}:null;}})[_0x5916('0x17')](respondWithResult(_0x356e55,null))[_0x5916('0x20')](handleError(_0x356e55,null));};exports[_0x5916('0x57')]=function(_0x294c41,_0xf1bc10,_0x3d5080){if(_0x294c41[_0x5916('0x4d')]['id']){delete _0x294c41[_0x5916('0x4d')]['id'];}return db[_0x5916('0x30')][_0x5916('0x50')]({'where':{'id':_0x294c41[_0x5916('0x47')]['id']}})[_0x5916('0x17')](handleEntityNotFound(_0xf1bc10,null))[_0x5916('0x17')](function(_0x346858){if(_0x346858){return _0x346858[_0x5916('0x57')](_0x294c41[_0x5916('0x4d')]['ids']||[]);}return null;})[_0x5916('0x17')](respondWithResult(_0xf1bc10,null))[_0x5916('0x20')](handleError(_0xf1bc10,null));}; \ No newline at end of file +var _0xfb06=['attributes','fields','hasOwnProperty','nolimit','order','pick','add','day','filter','merge','options','where','includeAll','include','rows','show','params','length','create','body','getFields','findOne','FreshdeskField','sort','getSubjects','map','getDescriptions','getTags','setTags','ids','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','FreshdeskConfiguration','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model'];(function(_0x469afe,_0x3a764f){var _0x271481=function(_0x5e5b8a){while(--_0x5e5b8a){_0x469afe['push'](_0x469afe['shift']());}};_0x271481(++_0x3a764f);}(_0xfb06,0x74));var _0x6fb0=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0xfb06[_0x25d2fb];return _0x1ded53;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fb0('0x0'));var BPromise=require('bluebird');var Mustache=require(_0x6fb0('0x1'));var util=require(_0x6fb0('0x2'));var path=require(_0x6fb0('0x3'));var sox=require('sox');var csv=require(_0x6fb0('0x4'));var ejs=require(_0x6fb0('0x5'));var fs=require('fs');var _=require(_0x6fb0('0x6'));var squel=require(_0x6fb0('0x7'));var crypto=require(_0x6fb0('0x8'));var jsforce=require(_0x6fb0('0x9'));var deskjs=require(_0x6fb0('0xa'));var toCsv=require(_0x6fb0('0x4'));var querystring=require(_0x6fb0('0xb'));var Papa=require(_0x6fb0('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x6fb0('0xd'))(_0x6fb0('0xe'));var utils=require(_0x6fb0('0xf'));var config=require('../../config/environment');var db=require(_0x6fb0('0x10'))['db'];var jayson=require(_0x6fb0('0x11'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xea9ae0,_0x1a42e3,_0x1cbf43,_0x27924d){return new BPromise(function(_0x27900e,_0x2fe5df){var _0x3026e8=_0x27924d||client;return _0x3026e8['request'](_0xea9ae0,_0x1cbf43)['then'](function(_0x1b2775){logger[_0x6fb0('0x12')](_0x6fb0('0x13'),_0x1a42e3,_0x6fb0('0x14'));logger[_0x6fb0('0x15')](_0x6fb0('0x16'),_0x1a42e3,_0x6fb0('0x14'),JSON['stringify'](_0x1b2775));if(_0x1b2775['error']){if(_0x1b2775[_0x6fb0('0x17')][_0x6fb0('0x18')]===0x1f4){logger[_0x6fb0('0x17')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1a42e3,_0x1b2775[_0x6fb0('0x17')]['message']);return _0x2fe5df(_0x1b2775['error'][_0x6fb0('0x19')]);}logger[_0x6fb0('0x17')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1a42e3,_0x1b2775[_0x6fb0('0x17')][_0x6fb0('0x19')]);return _0x27900e(_0x1b2775['error'][_0x6fb0('0x19')]);}else{logger[_0x6fb0('0x12')](_0x6fb0('0x13'),_0x1a42e3,_0x6fb0('0x14'));_0x27900e(_0x1b2775[_0x6fb0('0x1a')][_0x6fb0('0x19')]);}})[_0x6fb0('0x1b')](function(_0x1d2210){logger['error'](_0x6fb0('0x13'),_0x1a42e3,_0x1d2210);_0x2fe5df(_0x1d2210);});});}function respondWithStatusCode(_0x46dd2e,_0x40d450){_0x40d450=_0x40d450||0xcc;return function(_0x1dbf83){if(_0x1dbf83){return _0x46dd2e[_0x6fb0('0x1c')](_0x40d450);}return _0x46dd2e[_0x6fb0('0x1d')](_0x40d450)[_0x6fb0('0x1e')]();};}function respondWithResult(_0x2acb6e,_0x4d9779){_0x4d9779=_0x4d9779||0xc8;return function(_0x2ab785){if(_0x2ab785){return _0x2acb6e[_0x6fb0('0x1d')](_0x4d9779)[_0x6fb0('0x1f')](_0x2ab785);}};}function respondWithFilteredResult(_0x1c37ca,_0x5a6c78){return function(_0xc5c03){if(_0xc5c03){var _0x126ee2=_0xc5c03[_0x6fb0('0x20')],_0x2f987a=_0x5a6c78[_0x6fb0('0x21')],_0x1b5a16=_0x5a6c78[_0x6fb0('0x21')]+_0x5a6c78[_0x6fb0('0x22')],_0x542b56;if(_0x1b5a16>=_0x126ee2){_0x1b5a16=_0x126ee2;_0x542b56=0xc8;}else{_0x542b56=0xce;}_0x1c37ca[_0x6fb0('0x1d')](_0x542b56);return _0x1c37ca[_0x6fb0('0x23')](_0x6fb0('0x24'),_0x2f987a+'-'+_0x1b5a16+'/'+_0x126ee2)[_0x6fb0('0x1f')](_0xc5c03);}return null;};}function patchUpdates(_0x238be2){return function(_0x1f3e7c){try{jsonpatch[_0x6fb0('0x25')](_0x1f3e7c,_0x238be2,!![]);}catch(_0x29c5e8){return BPromise[_0x6fb0('0x26')](_0x29c5e8);}return _0x1f3e7c[_0x6fb0('0x27')]();};}function saveUpdates(_0xaeffc2,_0x525a7f){return function(_0x19a4eb){if(_0x19a4eb){return _0x19a4eb[_0x6fb0('0x28')](_0xaeffc2)['then'](function(_0x156057){return _0x156057;});}return null;};}function removeEntity(_0x119ee6,_0x53282b){return function(_0x30ed5f){if(_0x30ed5f){return _0x30ed5f[_0x6fb0('0x29')]()[_0x6fb0('0x2a')](function(){_0x119ee6[_0x6fb0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a1650,_0x1a8a9c){return function(_0x4e051e){if(!_0x4e051e){_0x1a1650['sendStatus'](0x194);}return _0x4e051e;};}function handleError(_0x443bf5,_0xdcc54c){_0xdcc54c=_0xdcc54c||0x1f4;return function(_0x487598){logger[_0x6fb0('0x17')](_0x487598[_0x6fb0('0x2b')]);if(_0x487598[_0x6fb0('0x2c')]){delete _0x487598['name'];}_0x443bf5[_0x6fb0('0x1d')](_0xdcc54c)[_0x6fb0('0x2d')](_0x487598);};}exports[_0x6fb0('0x2e')]=function(_0x1b2cec,_0x458157){var _0x44798a={},_0xcb9469={},_0x93e06a={'count':0x0,'rows':[]};var _0x958ccd=db[_0x6fb0('0x2f')][_0x6fb0('0x30')];_0xcb9469['model']=_[_0x6fb0('0x31')](_0x958ccd);var _0x40cea6={'dateStart':_0x1b2cec[_0x6fb0('0x32')][_0x6fb0('0x33')],'dateEnd':_0x1b2cec['query']['dateEnd']};delete _0x1b2cec[_0x6fb0('0x32')]['dateStart'];delete _0x1b2cec['query'][_0x6fb0('0x34')];_0xcb9469[_0x6fb0('0x32')]=_[_0x6fb0('0x31')](_0x1b2cec[_0x6fb0('0x32')]);_0xcb9469[_0x6fb0('0x35')]=_[_0x6fb0('0x36')](_0xcb9469[_0x6fb0('0x37')],_0xcb9469[_0x6fb0('0x32')]);_0x44798a[_0x6fb0('0x38')]=_[_0x6fb0('0x36')](_0xcb9469[_0x6fb0('0x37')],qs[_0x6fb0('0x39')](_0x1b2cec[_0x6fb0('0x32')]['fields']));_0x44798a['attributes']=_0x44798a['attributes']['length']?_0x44798a[_0x6fb0('0x38')]:_0xcb9469[_0x6fb0('0x37')];if(!_0x1b2cec[_0x6fb0('0x32')][_0x6fb0('0x3a')](_0x6fb0('0x3b'))){_0x44798a[_0x6fb0('0x22')]=qs[_0x6fb0('0x22')](_0x1b2cec[_0x6fb0('0x32')][_0x6fb0('0x22')]);_0x44798a[_0x6fb0('0x21')]=qs[_0x6fb0('0x21')](_0x1b2cec['query'][_0x6fb0('0x21')]);}_0x44798a[_0x6fb0('0x3c')]=qs['sort'](_0x1b2cec[_0x6fb0('0x32')]['sort']);_0x44798a['where']=qs[_0x6fb0('0x35')](_[_0x6fb0('0x3d')](_0x1b2cec[_0x6fb0('0x32')],_0xcb9469[_0x6fb0('0x35')]));if(_0x40cea6[_0x6fb0('0x33')]){if(_0x40cea6['dateEnd']){_0x40cea6[_0x6fb0('0x34')]=moment(_0x40cea6[_0x6fb0('0x34')])[_0x6fb0('0x3e')](0x1,'day');}else{_0x40cea6[_0x6fb0('0x34')]=moment(_0x40cea6[_0x6fb0('0x33')])[_0x6fb0('0x3e')](0x1,_0x6fb0('0x3f'));}_['merge'](_0x44798a['where'],{'createdAt':{'$gte':_0x40cea6[_0x6fb0('0x33')],'$lte':_0x40cea6[_0x6fb0('0x34')]}});}if(_0x1b2cec[_0x6fb0('0x32')][_0x6fb0('0x40')]){_0x44798a['where']=_[_0x6fb0('0x41')](_0x44798a['where'],{'$or':_['map'](_0x44798a[_0x6fb0('0x38')],function(_0x59bd91){var _0x29440a={};_0x29440a[_0x59bd91]={'$like':'%'+_0x1b2cec[_0x6fb0('0x32')]['filter']+'%'};return _0x29440a;})});}_0x44798a=_[_0x6fb0('0x41')]({},_0x44798a,_0x1b2cec[_0x6fb0('0x42')]);var _0x51ebe3={'where':_0x44798a[_0x6fb0('0x43')]};return db['FreshdeskConfiguration'][_0x6fb0('0x20')](_0x51ebe3)[_0x6fb0('0x2a')](function(_0x3056b8){_0x93e06a['count']=_0x3056b8;if(_0x1b2cec[_0x6fb0('0x32')][_0x6fb0('0x44')]){_0x44798a[_0x6fb0('0x45')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x44798a);})[_0x6fb0('0x2a')](function(_0x1ee57b){_0x93e06a[_0x6fb0('0x46')]=_0x1ee57b;return _0x93e06a;})[_0x6fb0('0x2a')](respondWithFilteredResult(_0x458157,_0x44798a))['catch'](handleError(_0x458157,null));};exports[_0x6fb0('0x47')]=function(_0x44b38d,_0x2a4b42){var _0x36158e={'raw':![],'where':{'id':_0x44b38d[_0x6fb0('0x48')]['id']}},_0x1034a3={};_0x1034a3[_0x6fb0('0x37')]=_['keys'](db[_0x6fb0('0x2f')][_0x6fb0('0x30')]);_0x1034a3[_0x6fb0('0x32')]=_['keys'](_0x44b38d[_0x6fb0('0x32')]);_0x1034a3[_0x6fb0('0x35')]=_['intersection'](_0x1034a3[_0x6fb0('0x37')],_0x1034a3['query']);_0x36158e['attributes']=_['intersection'](_0x1034a3['model'],qs[_0x6fb0('0x39')](_0x44b38d[_0x6fb0('0x32')]['fields']));_0x36158e['attributes']=_0x36158e[_0x6fb0('0x38')][_0x6fb0('0x49')]?_0x36158e['attributes']:_0x1034a3[_0x6fb0('0x37')];if(_0x44b38d[_0x6fb0('0x32')][_0x6fb0('0x44')]){_0x36158e[_0x6fb0('0x45')]=[{'all':!![]}];}_0x36158e=_['merge']({},_0x36158e,_0x44b38d[_0x6fb0('0x42')]);return db['FreshdeskConfiguration']['find'](_0x36158e)[_0x6fb0('0x2a')](handleEntityNotFound(_0x2a4b42,null))[_0x6fb0('0x2a')](respondWithResult(_0x2a4b42,null))[_0x6fb0('0x1b')](handleError(_0x2a4b42,null));};exports[_0x6fb0('0x4a')]=function(_0x4f57da,_0x4a0efc){return db[_0x6fb0('0x2f')][_0x6fb0('0x4a')](_0x4f57da['body'],{})[_0x6fb0('0x2a')](respondWithResult(_0x4a0efc,0xc9))[_0x6fb0('0x1b')](handleError(_0x4a0efc,null));};exports[_0x6fb0('0x28')]=function(_0x1c18ad,_0x7816ac){if(_0x1c18ad['body']['id']){delete _0x1c18ad[_0x6fb0('0x4b')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1c18ad[_0x6fb0('0x48')]['id']}})['then'](handleEntityNotFound(_0x7816ac,null))[_0x6fb0('0x2a')](saveUpdates(_0x1c18ad[_0x6fb0('0x4b')],null))['then'](respondWithResult(_0x7816ac,null))[_0x6fb0('0x1b')](handleError(_0x7816ac,null));};exports[_0x6fb0('0x29')]=function(_0x263f7e,_0xdd3a3){return db[_0x6fb0('0x2f')]['find']({'where':{'id':_0x263f7e[_0x6fb0('0x48')]['id']}})[_0x6fb0('0x2a')](handleEntityNotFound(_0xdd3a3,null))[_0x6fb0('0x2a')](removeEntity(_0xdd3a3,null))[_0x6fb0('0x1b')](handleError(_0xdd3a3,null));};exports[_0x6fb0('0x4c')]=function(_0x23dc14,_0x546eb2,_0x3e5fa4){var _0xe470a7={};var _0x131064={};var _0x4b8300;var _0x32a055;return db[_0x6fb0('0x2f')][_0x6fb0('0x4d')]({'where':{'id':_0x23dc14[_0x6fb0('0x48')]['id']}})[_0x6fb0('0x2a')](handleEntityNotFound(_0x546eb2,null))[_0x6fb0('0x2a')](function(_0x5d6861){if(_0x5d6861){_0x4b8300=_0x5d6861;_0x131064[_0x6fb0('0x37')]=_[_0x6fb0('0x31')](db[_0x6fb0('0x4e')][_0x6fb0('0x30')]);_0x131064[_0x6fb0('0x32')]=_[_0x6fb0('0x31')](_0x23dc14[_0x6fb0('0x32')]);_0x131064[_0x6fb0('0x35')]=_[_0x6fb0('0x36')](_0x131064[_0x6fb0('0x37')],_0x131064[_0x6fb0('0x32')]);_0xe470a7['attributes']=_[_0x6fb0('0x36')](_0x131064[_0x6fb0('0x37')],qs[_0x6fb0('0x39')](_0x23dc14['query']['fields']));_0xe470a7[_0x6fb0('0x38')]=_0xe470a7[_0x6fb0('0x38')][_0x6fb0('0x49')]?_0xe470a7[_0x6fb0('0x38')]:_0x131064[_0x6fb0('0x37')];_0xe470a7['order']=qs[_0x6fb0('0x4f')](_0x23dc14[_0x6fb0('0x32')][_0x6fb0('0x4f')]);_0xe470a7[_0x6fb0('0x43')]=qs[_0x6fb0('0x35')](_[_0x6fb0('0x3d')](_0x23dc14[_0x6fb0('0x32')],_0x131064[_0x6fb0('0x35')]));if(_0x23dc14[_0x6fb0('0x32')][_0x6fb0('0x40')]){_0xe470a7[_0x6fb0('0x43')]=_[_0x6fb0('0x41')](_0xe470a7[_0x6fb0('0x43')],{'$or':_['map'](_0xe470a7[_0x6fb0('0x38')],function(_0x402250){var _0x3b5ce8={};_0x3b5ce8[_0x402250]={'$like':'%'+_0x23dc14[_0x6fb0('0x32')][_0x6fb0('0x40')]+'%'};return _0x3b5ce8;})});}_0xe470a7=_[_0x6fb0('0x41')]({},_0xe470a7,_0x23dc14[_0x6fb0('0x42')]);return _0x4b8300[_0x6fb0('0x4c')](_0xe470a7);}})[_0x6fb0('0x2a')](function(_0x28a57a){if(_0x28a57a){_0x32a055=_0x28a57a[_0x6fb0('0x49')];if(!_0x23dc14[_0x6fb0('0x32')][_0x6fb0('0x3a')](_0x6fb0('0x3b'))){_0xe470a7['limit']=qs[_0x6fb0('0x22')](_0x23dc14[_0x6fb0('0x32')][_0x6fb0('0x22')]);_0xe470a7[_0x6fb0('0x21')]=qs[_0x6fb0('0x21')](_0x23dc14['query']['offset']);}return _0x4b8300[_0x6fb0('0x4c')](_0xe470a7);}})[_0x6fb0('0x2a')](function(_0x5b3508){if(_0x5b3508){return _0x5b3508?{'count':_0x32a055,'rows':_0x5b3508}:null;}})[_0x6fb0('0x2a')](respondWithResult(_0x546eb2,null))[_0x6fb0('0x1b')](handleError(_0x546eb2,null));};exports[_0x6fb0('0x50')]=function(_0x51ad08,_0x52e4d5,_0x7fcf40){var _0x1ea9a0={};var _0x3e3e1f={};var _0x520579;var _0x10d874;return db[_0x6fb0('0x2f')][_0x6fb0('0x4d')]({'where':{'id':_0x51ad08[_0x6fb0('0x48')]['id']}})['then'](handleEntityNotFound(_0x52e4d5,null))[_0x6fb0('0x2a')](function(_0xae2b62){if(_0xae2b62){_0x520579=_0xae2b62;_0x3e3e1f[_0x6fb0('0x37')]=_[_0x6fb0('0x31')](db['FreshdeskField']['rawAttributes']);_0x3e3e1f[_0x6fb0('0x32')]=_[_0x6fb0('0x31')](_0x51ad08[_0x6fb0('0x32')]);_0x3e3e1f['filters']=_[_0x6fb0('0x36')](_0x3e3e1f['model'],_0x3e3e1f[_0x6fb0('0x32')]);_0x1ea9a0['attributes']=_[_0x6fb0('0x36')](_0x3e3e1f[_0x6fb0('0x37')],qs[_0x6fb0('0x39')](_0x51ad08[_0x6fb0('0x32')][_0x6fb0('0x39')]));_0x1ea9a0[_0x6fb0('0x38')]=_0x1ea9a0[_0x6fb0('0x38')]['length']?_0x1ea9a0[_0x6fb0('0x38')]:_0x3e3e1f['model'];_0x1ea9a0[_0x6fb0('0x3c')]=qs[_0x6fb0('0x4f')](_0x51ad08[_0x6fb0('0x32')][_0x6fb0('0x4f')]);_0x1ea9a0[_0x6fb0('0x43')]=qs[_0x6fb0('0x35')](_[_0x6fb0('0x3d')](_0x51ad08['query'],_0x3e3e1f[_0x6fb0('0x35')]));if(_0x51ad08[_0x6fb0('0x32')][_0x6fb0('0x40')]){_0x1ea9a0['where']=_[_0x6fb0('0x41')](_0x1ea9a0['where'],{'$or':_[_0x6fb0('0x51')](_0x1ea9a0[_0x6fb0('0x38')],function(_0x213431){var _0x41d001={};_0x41d001[_0x213431]={'$like':'%'+_0x51ad08[_0x6fb0('0x32')][_0x6fb0('0x40')]+'%'};return _0x41d001;})});}_0x1ea9a0=_['merge']({},_0x1ea9a0,_0x51ad08[_0x6fb0('0x42')]);return _0x520579[_0x6fb0('0x50')](_0x1ea9a0);}})[_0x6fb0('0x2a')](function(_0x2fb228){if(_0x2fb228){_0x10d874=_0x2fb228[_0x6fb0('0x49')];if(!_0x51ad08[_0x6fb0('0x32')][_0x6fb0('0x3a')]('nolimit')){_0x1ea9a0[_0x6fb0('0x22')]=qs['limit'](_0x51ad08['query']['limit']);_0x1ea9a0[_0x6fb0('0x21')]=qs[_0x6fb0('0x21')](_0x51ad08[_0x6fb0('0x32')]['offset']);}return _0x520579['getSubjects'](_0x1ea9a0);}})[_0x6fb0('0x2a')](function(_0x460309){if(_0x460309){return _0x460309?{'count':_0x10d874,'rows':_0x460309}:null;}})[_0x6fb0('0x2a')](respondWithResult(_0x52e4d5,null))[_0x6fb0('0x1b')](handleError(_0x52e4d5,null));};exports[_0x6fb0('0x52')]=function(_0x2d916c,_0x4de5df,_0x3b9f22){var _0x3b3f49={};var _0x24ee01={};var _0x3056be;var _0x25b4ea;return db[_0x6fb0('0x2f')][_0x6fb0('0x4d')]({'where':{'id':_0x2d916c[_0x6fb0('0x48')]['id']}})[_0x6fb0('0x2a')](handleEntityNotFound(_0x4de5df,null))['then'](function(_0x13ec03){if(_0x13ec03){_0x3056be=_0x13ec03;_0x24ee01['model']=_[_0x6fb0('0x31')](db['FreshdeskField']['rawAttributes']);_0x24ee01[_0x6fb0('0x32')]=_[_0x6fb0('0x31')](_0x2d916c[_0x6fb0('0x32')]);_0x24ee01['filters']=_[_0x6fb0('0x36')](_0x24ee01[_0x6fb0('0x37')],_0x24ee01[_0x6fb0('0x32')]);_0x3b3f49['attributes']=_[_0x6fb0('0x36')](_0x24ee01['model'],qs[_0x6fb0('0x39')](_0x2d916c[_0x6fb0('0x32')][_0x6fb0('0x39')]));_0x3b3f49[_0x6fb0('0x38')]=_0x3b3f49['attributes'][_0x6fb0('0x49')]?_0x3b3f49[_0x6fb0('0x38')]:_0x24ee01[_0x6fb0('0x37')];_0x3b3f49[_0x6fb0('0x3c')]=qs['sort'](_0x2d916c[_0x6fb0('0x32')][_0x6fb0('0x4f')]);_0x3b3f49[_0x6fb0('0x43')]=qs['filters'](_[_0x6fb0('0x3d')](_0x2d916c['query'],_0x24ee01[_0x6fb0('0x35')]));if(_0x2d916c[_0x6fb0('0x32')][_0x6fb0('0x40')]){_0x3b3f49[_0x6fb0('0x43')]=_[_0x6fb0('0x41')](_0x3b3f49[_0x6fb0('0x43')],{'$or':_[_0x6fb0('0x51')](_0x3b3f49['attributes'],function(_0x53e1ad){var _0x28afc6={};_0x28afc6[_0x53e1ad]={'$like':'%'+_0x2d916c['query'][_0x6fb0('0x40')]+'%'};return _0x28afc6;})});}_0x3b3f49=_[_0x6fb0('0x41')]({},_0x3b3f49,_0x2d916c[_0x6fb0('0x42')]);return _0x3056be['getDescriptions'](_0x3b3f49);}})[_0x6fb0('0x2a')](function(_0x27734b){if(_0x27734b){_0x25b4ea=_0x27734b[_0x6fb0('0x49')];if(!_0x2d916c[_0x6fb0('0x32')]['hasOwnProperty'](_0x6fb0('0x3b'))){_0x3b3f49[_0x6fb0('0x22')]=qs[_0x6fb0('0x22')](_0x2d916c[_0x6fb0('0x32')][_0x6fb0('0x22')]);_0x3b3f49['offset']=qs[_0x6fb0('0x21')](_0x2d916c['query'][_0x6fb0('0x21')]);}return _0x3056be['getDescriptions'](_0x3b3f49);}})[_0x6fb0('0x2a')](function(_0x8dd7c8){if(_0x8dd7c8){return _0x8dd7c8?{'count':_0x25b4ea,'rows':_0x8dd7c8}:null;}})[_0x6fb0('0x2a')](respondWithResult(_0x4de5df,null))[_0x6fb0('0x1b')](handleError(_0x4de5df,null));};exports['getTags']=function(_0x3457c2,_0x4ec56c,_0x3ebe43){var _0x43fffb={};var _0x4a43b4={};var _0x2f2440;var _0x3eee9f;return db[_0x6fb0('0x2f')][_0x6fb0('0x4d')]({'where':{'id':_0x3457c2[_0x6fb0('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ec56c,null))[_0x6fb0('0x2a')](function(_0x4fa946){if(_0x4fa946){_0x2f2440=_0x4fa946;_0x4a43b4[_0x6fb0('0x37')]=_[_0x6fb0('0x31')](db['Tag'][_0x6fb0('0x30')]);_0x4a43b4['query']=_[_0x6fb0('0x31')](_0x3457c2['query']);_0x4a43b4[_0x6fb0('0x35')]=_[_0x6fb0('0x36')](_0x4a43b4[_0x6fb0('0x37')],_0x4a43b4[_0x6fb0('0x32')]);_0x43fffb[_0x6fb0('0x38')]=_[_0x6fb0('0x36')](_0x4a43b4[_0x6fb0('0x37')],qs[_0x6fb0('0x39')](_0x3457c2[_0x6fb0('0x32')][_0x6fb0('0x39')]));_0x43fffb[_0x6fb0('0x38')]=_0x43fffb['attributes']['length']?_0x43fffb[_0x6fb0('0x38')]:_0x4a43b4[_0x6fb0('0x37')];_0x43fffb[_0x6fb0('0x3c')]=qs[_0x6fb0('0x4f')](_0x3457c2[_0x6fb0('0x32')][_0x6fb0('0x4f')]);_0x43fffb[_0x6fb0('0x43')]=qs[_0x6fb0('0x35')](_[_0x6fb0('0x3d')](_0x3457c2['query'],_0x4a43b4[_0x6fb0('0x35')]));if(_0x3457c2['query']['filter']){_0x43fffb[_0x6fb0('0x43')]=_[_0x6fb0('0x41')](_0x43fffb[_0x6fb0('0x43')],{'$or':_[_0x6fb0('0x51')](_0x43fffb[_0x6fb0('0x38')],function(_0x218885){var _0x1b4e4a={};_0x1b4e4a[_0x218885]={'$like':'%'+_0x3457c2[_0x6fb0('0x32')]['filter']+'%'};return _0x1b4e4a;})});}_0x43fffb=_['merge']({},_0x43fffb,_0x3457c2[_0x6fb0('0x42')]);return _0x2f2440[_0x6fb0('0x53')](_0x43fffb);}})[_0x6fb0('0x2a')](function(_0x1c8610){if(_0x1c8610){_0x3eee9f=_0x1c8610[_0x6fb0('0x49')];if(!_0x3457c2['query']['hasOwnProperty'](_0x6fb0('0x3b'))){_0x43fffb[_0x6fb0('0x22')]=qs[_0x6fb0('0x22')](_0x3457c2['query']['limit']);_0x43fffb['offset']=qs[_0x6fb0('0x21')](_0x3457c2[_0x6fb0('0x32')][_0x6fb0('0x21')]);}return _0x2f2440[_0x6fb0('0x53')](_0x43fffb);}})[_0x6fb0('0x2a')](function(_0x41fd3f){if(_0x41fd3f){return _0x41fd3f?{'count':_0x3eee9f,'rows':_0x41fd3f}:null;}})[_0x6fb0('0x2a')](respondWithResult(_0x4ec56c,null))[_0x6fb0('0x1b')](handleError(_0x4ec56c,null));};exports['setTags']=function(_0x4ea950,_0x1ff20b,_0x599310){if(_0x4ea950['body']['id']){delete _0x4ea950[_0x6fb0('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x6fb0('0x4d')]({'where':{'id':_0x4ea950[_0x6fb0('0x48')]['id']}})[_0x6fb0('0x2a')](handleEntityNotFound(_0x1ff20b,null))[_0x6fb0('0x2a')](function(_0x556537){if(_0x556537){return _0x556537[_0x6fb0('0x54')](_0x4ea950[_0x6fb0('0x4b')][_0x6fb0('0x55')]||[]);}return null;})[_0x6fb0('0x2a')](respondWithResult(_0x1ff20b,null))['catch'](handleError(_0x1ff20b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a0b32aa..ed10013 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 _0xc01b=['bluebird','request-promise','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x11d3cb,_0x54d244){var _0x45d539=function(_0x29c017){while(--_0x29c017){_0x11d3cb['push'](_0x11d3cb['shift']());}};_0x45d539(++_0x54d244);}(_0xc01b,0x74));var _0xbc01=function(_0x31d1d7,_0x54bc7c){_0x31d1d7=_0x31d1d7-0x0;var _0x328ad2=_0xc01b[_0x31d1d7];return _0x328ad2;};'use strict';var _=require(_0xbc01('0x0'));var util=require(_0xbc01('0x1'));var logger=require(_0xbc01('0x2'))(_0xbc01('0x3'));var moment=require(_0xbc01('0x4'));var BPromise=require(_0xbc01('0x5'));var rp=require(_0xbc01('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xbc01('0x7')]=function(_0x133078,_0x222fa3){return _0x133078[_0xbc01('0x8')](_0xbc01('0x9'),attributes,{'tableName':_0xbc01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3ea=['moment','request-promise','exports','define','FreshdeskConfiguration','lodash','util','../../config/logger'];(function(_0xeb879d,_0x4ba031){var _0x5704a0=function(_0x30f770){while(--_0x30f770){_0xeb879d['push'](_0xeb879d['shift']());}};_0x5704a0(++_0x4ba031);}(_0xb3ea,0x10d));var _0xab3e=function(_0x2fbb72,_0x5942e0){_0x2fbb72=_0x2fbb72-0x0;var _0x3fb4cc=_0xb3ea[_0x2fbb72];return _0x3fb4cc;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var logger=require(_0xab3e('0x2'))('api');var moment=require(_0xab3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xab3e('0x4'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xab3e('0x5')]=function(_0x196c45,_0x1f0c0f){return _0x196c45[_0xab3e('0x6')](_0xab3e('0x7'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 9e8c154..45804df 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 _0x472f=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x41b3ea,_0x5eef8c){var _0x4e0463=function(_0x42a7b2){while(--_0x42a7b2){_0x41b3ea['push'](_0x41b3ea['shift']());}};_0x4e0463(++_0x5eef8c);}(_0x472f,0x1a4));var _0xf472=function(_0x412d56,_0x40a53d){_0x412d56=_0x412d56-0x0;var _0x169195=_0x472f[_0x412d56];return _0x169195;};'use strict';var _=require(_0xf472('0x0'));var util=require(_0xf472('0x1'));var moment=require(_0xf472('0x2'));var BPromise=require('bluebird');var rs=require(_0xf472('0x3'));var fs=require('fs');var db=require(_0xf472('0x4'))['db'];var utils=require(_0xf472('0x5'));var logger=require(_0xf472('0x6'))(_0xf472('0x7'));var config=require(_0xf472('0x8'));var jayson=require(_0xf472('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x638fc,_0x2ddadf,_0x33542e){return new BPromise(function(_0x1bfc65,_0x1fca4b){return client[_0xf472('0xa')](_0x638fc,_0x33542e)['then'](function(_0x3bb48c){logger[_0xf472('0xb')](_0xf472('0xc'),_0x2ddadf,_0xf472('0xd'));logger[_0xf472('0xe')](_0xf472('0xf'),_0x2ddadf,'request\x20sent',JSON['stringify'](_0x3bb48c));if(_0x3bb48c['error']){if(_0x3bb48c[_0xf472('0x10')][_0xf472('0x11')]===0x1f4){logger[_0xf472('0x10')](_0xf472('0xc'),_0x2ddadf,_0x3bb48c[_0xf472('0x10')][_0xf472('0x12')]);return _0x1fca4b(_0x3bb48c[_0xf472('0x10')][_0xf472('0x12')]);}logger[_0xf472('0x10')](_0xf472('0xc'),_0x2ddadf,_0x3bb48c[_0xf472('0x10')][_0xf472('0x12')]);return _0x1bfc65(_0x3bb48c[_0xf472('0x10')]['message']);}else{logger[_0xf472('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ddadf,_0xf472('0xd'));_0x1bfc65(_0x3bb48c[_0xf472('0x13')]['message']);}})[_0xf472('0x14')](function(_0x2d4ff7){logger['error'](_0xf472('0xc'),_0x2ddadf,_0x2d4ff7);_0x1fca4b(_0x2d4ff7);});});} \ No newline at end of file +var _0x04d4=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x455555,_0x2147fd){var _0x3cb183=function(_0x516a72){while(--_0x516a72){_0x455555['push'](_0x455555['shift']());}};_0x3cb183(++_0x2147fd);}(_0x04d4,0x1d0));var _0x404d=function(_0x260b56,_0x5af868){_0x260b56=_0x260b56-0x0;var _0x1eb91f=_0x04d4[_0x260b56];return _0x1eb91f;};'use strict';var _=require(_0x404d('0x0'));var util=require(_0x404d('0x1'));var moment=require(_0x404d('0x2'));var BPromise=require('bluebird');var rs=require(_0x404d('0x3'));var fs=require('fs');var db=require(_0x404d('0x4'))['db'];var utils=require(_0x404d('0x5'));var logger=require(_0x404d('0x6'))(_0x404d('0x7'));var config=require(_0x404d('0x8'));var jayson=require(_0x404d('0x9'));var client=jayson['client'][_0x404d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2916b1,_0x31b72c,_0x408b8a){return new BPromise(function(_0xa3e827,_0x2bc906){return client[_0x404d('0xb')](_0x2916b1,_0x408b8a)[_0x404d('0xc')](function(_0x199d8f){logger[_0x404d('0xd')](_0x404d('0xe'),_0x31b72c,_0x404d('0xf'));logger[_0x404d('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x31b72c,'request\x20sent',JSON['stringify'](_0x199d8f));if(_0x199d8f['error']){if(_0x199d8f[_0x404d('0x11')][_0x404d('0x12')]===0x1f4){logger[_0x404d('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x31b72c,_0x199d8f[_0x404d('0x11')][_0x404d('0x13')]);return _0x2bc906(_0x199d8f[_0x404d('0x11')][_0x404d('0x13')]);}logger['error'](_0x404d('0xe'),_0x31b72c,_0x199d8f['error']['message']);return _0xa3e827(_0x199d8f[_0x404d('0x11')][_0x404d('0x13')]);}else{logger['info'](_0x404d('0xe'),_0x31b72c,_0x404d('0xf'));_0xa3e827(_0x199d8f[_0x404d('0x14')]['message']);}})[_0x404d('0x15')](function(_0xc09c1){logger[_0x404d('0x11')](_0x404d('0xe'),_0x31b72c,_0xc09c1);_0x2bc906(_0xc09c1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7c36167..9521789 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 _0x7e6a=['update','delete','destroy','multer','util','path','express','Router','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','create'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0x7e6a,0x1b6));var _0xa7e6=function(_0x5f4069,_0x182fe0){_0x5f4069=_0x5f4069-0x0;var _0x58e1bb=_0x7e6a[_0x5f4069];return _0x58e1bb;};'use strict';var multer=require(_0xa7e6('0x0'));var util=require(_0xa7e6('0x1'));var path=require(_0xa7e6('0x2'));var express=require(_0xa7e6('0x3'));var router=express[_0xa7e6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa7e6('0x5'));var controller=require(_0xa7e6('0x6'));router[_0xa7e6('0x7')]('/',auth[_0xa7e6('0x8')](),controller[_0xa7e6('0x9')]);router[_0xa7e6('0x7')](_0xa7e6('0xa'),auth[_0xa7e6('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa7e6('0xb')]);router['put'](_0xa7e6('0xa'),auth['isAuthenticated'](),controller[_0xa7e6('0xc')]);router[_0xa7e6('0xd')](_0xa7e6('0xa'),auth['isAuthenticated'](),controller[_0xa7e6('0xe')]);module['exports']=router; \ No newline at end of file +var _0x570f=['put','update','delete','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id','show','post','isAuthenticated','create'];(function(_0x2534a4,_0x25d002){var _0x3785f6=function(_0x4a2d22){while(--_0x4a2d22){_0x2534a4['push'](_0x2534a4['shift']());}};_0x3785f6(++_0x25d002);}(_0x570f,0xa5));var _0xf570=function(_0x175f1b,_0x1a7de0){_0x175f1b=_0x175f1b-0x0;var _0x2da79a=_0x570f[_0x175f1b];return _0x2da79a;};'use strict';var multer=require(_0xf570('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0xf570('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xf570('0x2'));var config=require(_0xf570('0x3'));var controller=require(_0xf570('0x4'));router[_0xf570('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf570('0x5')](_0xf570('0x6'),auth['isAuthenticated'](),controller[_0xf570('0x7')]);router[_0xf570('0x8')]('/',auth[_0xf570('0x9')](),controller[_0xf570('0xa')]);router[_0xf570('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf570('0xc')]);router[_0xf570('0xd')](_0xf570('0x6'),auth[_0xf570('0x9')](),controller[_0xf570('0xe')]);module[_0xf570('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0a02d9e..0904dfd 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 _0x668b=['keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x48261b,_0x29fc70){var _0x5c7dbd=function(_0x33c7a7){while(--_0x33c7a7){_0x48261b['push'](_0x48261b['shift']());}};_0x5c7dbd(++_0x29fc70);}(_0x668b,0x140));var _0xb668=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0x668b[_0x1dfa63];return _0x26f2a9;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb668('0x2'),_0xb668('0x3'),'customVariable',_0xb668('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb668('0x5')]},'key':{'type':Sequelize[_0xb668('0x5')]},'keyType':{'type':Sequelize[_0xb668('0x6')]('string',_0xb668('0x3'),_0xb668('0x7'))},'keyContent':{'type':Sequelize[_0xb668('0x5')]},'idField':{'type':Sequelize[_0xb668('0x5')]},'nameField':{'type':Sequelize[_0xb668('0x5')]},'customField':{'type':Sequelize[_0xb668('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5ff3=['STRING','ENUM','variable','exports','string','customVariable','keyValue'];(function(_0x491ded,_0x17abba){var _0x4ea2c9=function(_0x4013d3){while(--_0x4013d3){_0x491ded['push'](_0x491ded['shift']());}};_0x4ea2c9(++_0x17abba);}(_0x5ff3,0x17d));var _0x35ff=function(_0x53453e,_0x1bd48c){_0x53453e=_0x53453e-0x0;var _0x3bc357=_0x5ff3[_0x53453e];return _0x3bc357;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'type':{'type':Sequelize['ENUM'](_0x35ff('0x1'),'variable',_0x35ff('0x2'),_0x35ff('0x3')),'defaultValue':_0x35ff('0x1')},'content':{'type':Sequelize[_0x35ff('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x35ff('0x5')](_0x35ff('0x1'),_0x35ff('0x6'),_0x35ff('0x2'))},'keyContent':{'type':Sequelize[_0x35ff('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x35ff('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35ff('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a37bddf..ac61064 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 _0x4959=['sort','where','pick','dateEnd','day','merge','filter','map','options','includeAll','include','rows','catch','show','params','create','update','body','find','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','FreshdeskField','rawAttributes','model','query','dateStart','keys','filters','intersection','fields','attributes','length','order'];(function(_0x167b30,_0x584768){var _0x1b94ae=function(_0x212883){while(--_0x212883){_0x167b30['push'](_0x167b30['shift']());}};_0x1b94ae(++_0x584768);}(_0x4959,0x9b));var _0x9495=function(_0x458e98,_0x4e2fc4){_0x458e98=_0x458e98-0x0;var _0x42f438=_0x4959[_0x458e98];return _0x42f438;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9495('0x0'));var BPromise=require(_0x9495('0x1'));var Mustache=require(_0x9495('0x2'));var util=require('util');var path=require(_0x9495('0x3'));var sox=require(_0x9495('0x4'));var csv=require(_0x9495('0x5'));var ejs=require(_0x9495('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9495('0x7'));var crypto=require(_0x9495('0x8'));var jsforce=require(_0x9495('0x9'));var deskjs=require(_0x9495('0xa'));var toCsv=require(_0x9495('0x5'));var querystring=require(_0x9495('0xb'));var Papa=require(_0x9495('0xc'));var qs=require(_0x9495('0xd'));var logger=require(_0x9495('0xe'))(_0x9495('0xf'));var utils=require(_0x9495('0x10'));var config=require('../../config/environment');var db=require(_0x9495('0x11'))['db'];function respondWithStatusCode(_0x579a7e,_0x4b53aa){_0x4b53aa=_0x4b53aa||0xcc;return function(_0x4fb16d){if(_0x4fb16d){return _0x579a7e['sendStatus'](_0x4b53aa);}return _0x579a7e[_0x9495('0x12')](_0x4b53aa)[_0x9495('0x13')]();};}function respondWithResult(_0x3e4433,_0x18a26f){_0x18a26f=_0x18a26f||0xc8;return function(_0x27d334){if(_0x27d334){return _0x3e4433[_0x9495('0x12')](_0x18a26f)[_0x9495('0x14')](_0x27d334);}};}function respondWithFilteredResult(_0xcb593d,_0xa22215){return function(_0x424343){if(_0x424343){var _0x353718=_0x424343[_0x9495('0x15')],_0xa2a8e5=_0xa22215[_0x9495('0x16')],_0x3ab519=_0xa22215['offset']+_0xa22215[_0x9495('0x17')],_0xf7e975;if(_0x3ab519>=_0x353718){_0x3ab519=_0x353718;_0xf7e975=0xc8;}else{_0xf7e975=0xce;}_0xcb593d[_0x9495('0x12')](_0xf7e975);return _0xcb593d[_0x9495('0x18')](_0x9495('0x19'),_0xa2a8e5+'-'+_0x3ab519+'/'+_0x353718)[_0x9495('0x14')](_0x424343);}return null;};}function patchUpdates(_0x4c1d9d){return function(_0x45d5fd){try{jsonpatch[_0x9495('0x1a')](_0x45d5fd,_0x4c1d9d,!![]);}catch(_0x1efcc2){return BPromise[_0x9495('0x1b')](_0x1efcc2);}return _0x45d5fd[_0x9495('0x1c')]();};}function saveUpdates(_0x502562,_0x213bab){return function(_0x22e38d){if(_0x22e38d){return _0x22e38d['update'](_0x502562)['then'](function(_0x56be18){return _0x56be18;});}return null;};}function removeEntity(_0x4c0369,_0x3f67c1){return function(_0x185a86){if(_0x185a86){return _0x185a86[_0x9495('0x1d')]()[_0x9495('0x1e')](function(){_0x4c0369[_0x9495('0x12')](0xcc)[_0x9495('0x13')]();});}};}function handleEntityNotFound(_0x214747,_0x8a990e){return function(_0xe9d143){if(!_0xe9d143){_0x214747[_0x9495('0x1f')](0x194);}return _0xe9d143;};}function handleError(_0x4acbaa,_0x439715){_0x439715=_0x439715||0x1f4;return function(_0x45dedf){logger[_0x9495('0x20')](_0x45dedf[_0x9495('0x21')]);if(_0x45dedf[_0x9495('0x22')]){delete _0x45dedf[_0x9495('0x22')];}_0x4acbaa[_0x9495('0x12')](_0x439715)[_0x9495('0x23')](_0x45dedf);};}exports[_0x9495('0x24')]=function(_0x5751c4,_0x224e5e){var _0x195dc6={},_0x3d1ea7={},_0x1e200d={'count':0x0,'rows':[]};var _0x389a32=db[_0x9495('0x25')][_0x9495('0x26')];_0x3d1ea7[_0x9495('0x27')]=_['keys'](_0x389a32);var _0xea3162={'dateStart':_0x5751c4[_0x9495('0x28')][_0x9495('0x29')],'dateEnd':_0x5751c4[_0x9495('0x28')]['dateEnd']};delete _0x5751c4[_0x9495('0x28')][_0x9495('0x29')];delete _0x5751c4[_0x9495('0x28')]['dateEnd'];_0x3d1ea7[_0x9495('0x28')]=_[_0x9495('0x2a')](_0x5751c4[_0x9495('0x28')]);_0x3d1ea7[_0x9495('0x2b')]=_[_0x9495('0x2c')](_0x3d1ea7[_0x9495('0x27')],_0x3d1ea7[_0x9495('0x28')]);_0x195dc6['attributes']=_[_0x9495('0x2c')](_0x3d1ea7[_0x9495('0x27')],qs[_0x9495('0x2d')](_0x5751c4[_0x9495('0x28')][_0x9495('0x2d')]));_0x195dc6[_0x9495('0x2e')]=_0x195dc6[_0x9495('0x2e')][_0x9495('0x2f')]?_0x195dc6['attributes']:_0x3d1ea7[_0x9495('0x27')];if(!_0x5751c4['query']['hasOwnProperty']('nolimit')){_0x195dc6[_0x9495('0x17')]=qs[_0x9495('0x17')](_0x5751c4[_0x9495('0x28')][_0x9495('0x17')]);_0x195dc6[_0x9495('0x16')]=qs[_0x9495('0x16')](_0x5751c4[_0x9495('0x28')][_0x9495('0x16')]);}_0x195dc6[_0x9495('0x30')]=qs[_0x9495('0x31')](_0x5751c4[_0x9495('0x28')][_0x9495('0x31')]);_0x195dc6[_0x9495('0x32')]=qs['filters'](_[_0x9495('0x33')](_0x5751c4[_0x9495('0x28')],_0x3d1ea7[_0x9495('0x2b')]));if(_0xea3162[_0x9495('0x29')]){if(_0xea3162[_0x9495('0x34')]){_0xea3162[_0x9495('0x34')]=moment(_0xea3162[_0x9495('0x34')])['add'](0x1,'day');}else{_0xea3162[_0x9495('0x34')]=moment(_0xea3162[_0x9495('0x29')])['add'](0x1,_0x9495('0x35'));}_[_0x9495('0x36')](_0x195dc6['where'],{'createdAt':{'$gte':_0xea3162[_0x9495('0x29')],'$lte':_0xea3162[_0x9495('0x34')]}});}if(_0x5751c4['query'][_0x9495('0x37')]){_0x195dc6[_0x9495('0x32')]=_[_0x9495('0x36')](_0x195dc6['where'],{'$or':_[_0x9495('0x38')](_0x195dc6[_0x9495('0x2e')],function(_0x470d39){var _0xb867f4={};_0xb867f4[_0x470d39]={'$like':'%'+_0x5751c4[_0x9495('0x28')][_0x9495('0x37')]+'%'};return _0xb867f4;})});}_0x195dc6=_['merge']({},_0x195dc6,_0x5751c4[_0x9495('0x39')]);var _0x182495={'where':_0x195dc6[_0x9495('0x32')]};return db['FreshdeskField'][_0x9495('0x15')](_0x182495)[_0x9495('0x1e')](function(_0x152f88){_0x1e200d[_0x9495('0x15')]=_0x152f88;if(_0x5751c4[_0x9495('0x28')][_0x9495('0x3a')]){_0x195dc6[_0x9495('0x3b')]=[{'all':!![]}];}return db[_0x9495('0x25')]['findAll'](_0x195dc6);})[_0x9495('0x1e')](function(_0x2e525b){_0x1e200d[_0x9495('0x3c')]=_0x2e525b;return _0x1e200d;})['then'](respondWithFilteredResult(_0x224e5e,_0x195dc6))[_0x9495('0x3d')](handleError(_0x224e5e,null));};exports[_0x9495('0x3e')]=function(_0x3f3af7,_0x3e2312){var _0x49a9e9={'raw':!![],'where':{'id':_0x3f3af7[_0x9495('0x3f')]['id']}},_0x3fdf94={};_0x3fdf94[_0x9495('0x27')]=_[_0x9495('0x2a')](db[_0x9495('0x25')][_0x9495('0x26')]);_0x3fdf94[_0x9495('0x28')]=_[_0x9495('0x2a')](_0x3f3af7[_0x9495('0x28')]);_0x3fdf94[_0x9495('0x2b')]=_['intersection'](_0x3fdf94[_0x9495('0x27')],_0x3fdf94[_0x9495('0x28')]);_0x49a9e9[_0x9495('0x2e')]=_[_0x9495('0x2c')](_0x3fdf94[_0x9495('0x27')],qs['fields'](_0x3f3af7[_0x9495('0x28')][_0x9495('0x2d')]));_0x49a9e9[_0x9495('0x2e')]=_0x49a9e9[_0x9495('0x2e')][_0x9495('0x2f')]?_0x49a9e9['attributes']:_0x3fdf94[_0x9495('0x27')];if(_0x3f3af7[_0x9495('0x28')]['includeAll']){_0x49a9e9[_0x9495('0x3b')]=[{'all':!![]}];}_0x49a9e9=_[_0x9495('0x36')]({},_0x49a9e9,_0x3f3af7['options']);return db['FreshdeskField']['find'](_0x49a9e9)['then'](handleEntityNotFound(_0x3e2312,null))[_0x9495('0x1e')](respondWithResult(_0x3e2312,null))[_0x9495('0x3d')](handleError(_0x3e2312,null));};exports[_0x9495('0x40')]=function(_0x362e9e,_0x4442fb){return db[_0x9495('0x25')][_0x9495('0x40')](_0x362e9e['body'],{})[_0x9495('0x1e')](respondWithResult(_0x4442fb,0xc9))[_0x9495('0x3d')](handleError(_0x4442fb,null));};exports[_0x9495('0x41')]=function(_0x257cd1,_0x5ec40d){if(_0x257cd1[_0x9495('0x42')]['id']){delete _0x257cd1['body']['id'];}return db[_0x9495('0x25')][_0x9495('0x43')]({'where':{'id':_0x257cd1['params']['id']}})['then'](handleEntityNotFound(_0x5ec40d,null))[_0x9495('0x1e')](saveUpdates(_0x257cd1[_0x9495('0x42')],null))['then'](respondWithResult(_0x5ec40d,null))[_0x9495('0x3d')](handleError(_0x5ec40d,null));};exports[_0x9495('0x1d')]=function(_0x388ddb,_0x28bba3){return db['FreshdeskField']['find']({'where':{'id':_0x388ddb['params']['id']}})[_0x9495('0x1e')](handleEntityNotFound(_0x28bba3,null))[_0x9495('0x1e')](removeEntity(_0x28bba3,null))[_0x9495('0x3d')](handleError(_0x28bba3,null));}; \ No newline at end of file +var _0x4efb=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','FreshdeskField','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','includeAll','include','rows','show','options','find','create','body','params','catch','request-promise','moment','bluebird','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x4efb,0xfa));var _0xb4ef=function(_0x2f0288,_0x369625){_0x2f0288=_0x2f0288-0x0;var _0x18064c=_0x4efb[_0x2f0288];return _0x18064c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xb4ef('0x0'));var moment=require(_0xb4ef('0x1'));var BPromise=require(_0xb4ef('0x2'));var Mustache=require('mustache');var util=require(_0xb4ef('0x3'));var path=require('path');var sox=require(_0xb4ef('0x4'));var csv=require(_0xb4ef('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb4ef('0x6'));var squel=require('squel');var crypto=require(_0xb4ef('0x7'));var jsforce=require(_0xb4ef('0x8'));var deskjs=require(_0xb4ef('0x9'));var toCsv=require(_0xb4ef('0x5'));var querystring=require(_0xb4ef('0xa'));var Papa=require('papaparse');var qs=require(_0xb4ef('0xb'));var logger=require(_0xb4ef('0xc'))(_0xb4ef('0xd'));var utils=require(_0xb4ef('0xe'));var config=require(_0xb4ef('0xf'));var db=require(_0xb4ef('0x10'))['db'];function respondWithStatusCode(_0x4d5abf,_0x46676e){_0x46676e=_0x46676e||0xcc;return function(_0x4ae9c8){if(_0x4ae9c8){return _0x4d5abf[_0xb4ef('0x11')](_0x46676e);}return _0x4d5abf[_0xb4ef('0x12')](_0x46676e)[_0xb4ef('0x13')]();};}function respondWithResult(_0x47affc,_0x1e0c93){_0x1e0c93=_0x1e0c93||0xc8;return function(_0x3d1797){if(_0x3d1797){return _0x47affc[_0xb4ef('0x12')](_0x1e0c93)[_0xb4ef('0x14')](_0x3d1797);}};}function respondWithFilteredResult(_0x476240,_0x1bfc4c){return function(_0x581ec5){if(_0x581ec5){var _0x2f0f47=_0x581ec5[_0xb4ef('0x15')],_0x587c3a=_0x1bfc4c[_0xb4ef('0x16')],_0x3e82f5=_0x1bfc4c[_0xb4ef('0x16')]+_0x1bfc4c[_0xb4ef('0x17')],_0xd98297;if(_0x3e82f5>=_0x2f0f47){_0x3e82f5=_0x2f0f47;_0xd98297=0xc8;}else{_0xd98297=0xce;}_0x476240[_0xb4ef('0x12')](_0xd98297);return _0x476240['set'](_0xb4ef('0x18'),_0x587c3a+'-'+_0x3e82f5+'/'+_0x2f0f47)[_0xb4ef('0x14')](_0x581ec5);}return null;};}function patchUpdates(_0x3cb21e){return function(_0x2b9b20){try{jsonpatch[_0xb4ef('0x19')](_0x2b9b20,_0x3cb21e,!![]);}catch(_0x38bc34){return BPromise['reject'](_0x38bc34);}return _0x2b9b20[_0xb4ef('0x1a')]();};}function saveUpdates(_0x21e34e,_0x3806b7){return function(_0x443e8c){if(_0x443e8c){return _0x443e8c[_0xb4ef('0x1b')](_0x21e34e)[_0xb4ef('0x1c')](function(_0x13540e){return _0x13540e;});}return null;};}function removeEntity(_0x595aab,_0x311f00){return function(_0x52d6a0){if(_0x52d6a0){return _0x52d6a0[_0xb4ef('0x1d')]()[_0xb4ef('0x1c')](function(){_0x595aab[_0xb4ef('0x12')](0xcc)[_0xb4ef('0x13')]();});}};}function handleEntityNotFound(_0x3d6d59,_0x3bae87){return function(_0x34bdf4){if(!_0x34bdf4){_0x3d6d59[_0xb4ef('0x11')](0x194);}return _0x34bdf4;};}function handleError(_0xc146de,_0x245895){_0x245895=_0x245895||0x1f4;return function(_0x49abfe){logger[_0xb4ef('0x1e')](_0x49abfe[_0xb4ef('0x1f')]);if(_0x49abfe['name']){delete _0x49abfe[_0xb4ef('0x20')];}_0xc146de['status'](_0x245895)[_0xb4ef('0x21')](_0x49abfe);};}exports['index']=function(_0x2843d6,_0x4b702d){var _0x116043={},_0x84750e={},_0x50e25a={'count':0x0,'rows':[]};var _0x5e3a6b=db[_0xb4ef('0x22')][_0xb4ef('0x23')];_0x84750e[_0xb4ef('0x24')]=_[_0xb4ef('0x25')](_0x5e3a6b);var _0x3e0917={'dateStart':_0x2843d6['query'][_0xb4ef('0x26')],'dateEnd':_0x2843d6['query'][_0xb4ef('0x27')]};delete _0x2843d6[_0xb4ef('0x28')]['dateStart'];delete _0x2843d6[_0xb4ef('0x28')][_0xb4ef('0x27')];_0x84750e[_0xb4ef('0x28')]=_['keys'](_0x2843d6['query']);_0x84750e[_0xb4ef('0x29')]=_[_0xb4ef('0x2a')](_0x84750e[_0xb4ef('0x24')],_0x84750e['query']);_0x116043[_0xb4ef('0x2b')]=_[_0xb4ef('0x2a')](_0x84750e[_0xb4ef('0x24')],qs[_0xb4ef('0x2c')](_0x2843d6['query'][_0xb4ef('0x2c')]));_0x116043[_0xb4ef('0x2b')]=_0x116043['attributes'][_0xb4ef('0x2d')]?_0x116043['attributes']:_0x84750e[_0xb4ef('0x24')];if(!_0x2843d6[_0xb4ef('0x28')][_0xb4ef('0x2e')](_0xb4ef('0x2f'))){_0x116043[_0xb4ef('0x17')]=qs[_0xb4ef('0x17')](_0x2843d6['query'][_0xb4ef('0x17')]);_0x116043[_0xb4ef('0x16')]=qs[_0xb4ef('0x16')](_0x2843d6[_0xb4ef('0x28')]['offset']);}_0x116043[_0xb4ef('0x30')]=qs['sort'](_0x2843d6[_0xb4ef('0x28')][_0xb4ef('0x31')]);_0x116043[_0xb4ef('0x32')]=qs['filters'](_[_0xb4ef('0x33')](_0x2843d6[_0xb4ef('0x28')],_0x84750e[_0xb4ef('0x29')]));if(_0x3e0917[_0xb4ef('0x26')]){if(_0x3e0917['dateEnd']){_0x3e0917[_0xb4ef('0x27')]=moment(_0x3e0917[_0xb4ef('0x27')])[_0xb4ef('0x34')](0x1,_0xb4ef('0x35'));}else{_0x3e0917[_0xb4ef('0x27')]=moment(_0x3e0917['dateStart'])[_0xb4ef('0x34')](0x1,_0xb4ef('0x35'));}_[_0xb4ef('0x36')](_0x116043[_0xb4ef('0x32')],{'createdAt':{'$gte':_0x3e0917[_0xb4ef('0x26')],'$lte':_0x3e0917['dateEnd']}});}if(_0x2843d6['query']['filter']){_0x116043[_0xb4ef('0x32')]=_['merge'](_0x116043[_0xb4ef('0x32')],{'$or':_['map'](_0x116043['attributes'],function(_0x1e589e){var _0x804b71={};_0x804b71[_0x1e589e]={'$like':'%'+_0x2843d6[_0xb4ef('0x28')][_0xb4ef('0x37')]+'%'};return _0x804b71;})});}_0x116043=_[_0xb4ef('0x36')]({},_0x116043,_0x2843d6['options']);var _0x58cabe={'where':_0x116043[_0xb4ef('0x32')]};return db[_0xb4ef('0x22')][_0xb4ef('0x15')](_0x58cabe)[_0xb4ef('0x1c')](function(_0x37c80d){_0x50e25a[_0xb4ef('0x15')]=_0x37c80d;if(_0x2843d6['query'][_0xb4ef('0x38')]){_0x116043[_0xb4ef('0x39')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x116043);})[_0xb4ef('0x1c')](function(_0x499643){_0x50e25a[_0xb4ef('0x3a')]=_0x499643;return _0x50e25a;})[_0xb4ef('0x1c')](respondWithFilteredResult(_0x4b702d,_0x116043))['catch'](handleError(_0x4b702d,null));};exports[_0xb4ef('0x3b')]=function(_0x5e5f57,_0x317060){var _0x2b97c3={'raw':!![],'where':{'id':_0x5e5f57['params']['id']}},_0x1dea26={};_0x1dea26[_0xb4ef('0x24')]=_[_0xb4ef('0x25')](db['FreshdeskField']['rawAttributes']);_0x1dea26[_0xb4ef('0x28')]=_[_0xb4ef('0x25')](_0x5e5f57[_0xb4ef('0x28')]);_0x1dea26[_0xb4ef('0x29')]=_[_0xb4ef('0x2a')](_0x1dea26[_0xb4ef('0x24')],_0x1dea26[_0xb4ef('0x28')]);_0x2b97c3[_0xb4ef('0x2b')]=_[_0xb4ef('0x2a')](_0x1dea26[_0xb4ef('0x24')],qs['fields'](_0x5e5f57[_0xb4ef('0x28')]['fields']));_0x2b97c3['attributes']=_0x2b97c3['attributes']['length']?_0x2b97c3[_0xb4ef('0x2b')]:_0x1dea26[_0xb4ef('0x24')];if(_0x5e5f57[_0xb4ef('0x28')][_0xb4ef('0x38')]){_0x2b97c3['include']=[{'all':!![]}];}_0x2b97c3=_[_0xb4ef('0x36')]({},_0x2b97c3,_0x5e5f57[_0xb4ef('0x3c')]);return db[_0xb4ef('0x22')][_0xb4ef('0x3d')](_0x2b97c3)['then'](handleEntityNotFound(_0x317060,null))[_0xb4ef('0x1c')](respondWithResult(_0x317060,null))['catch'](handleError(_0x317060,null));};exports[_0xb4ef('0x3e')]=function(_0x58c58c,_0x212ff3){return db['FreshdeskField'][_0xb4ef('0x3e')](_0x58c58c['body'],{})[_0xb4ef('0x1c')](respondWithResult(_0x212ff3,0xc9))['catch'](handleError(_0x212ff3,null));};exports[_0xb4ef('0x1b')]=function(_0x55b938,_0x4b20fc){if(_0x55b938[_0xb4ef('0x3f')]['id']){delete _0x55b938['body']['id'];}return db[_0xb4ef('0x22')]['find']({'where':{'id':_0x55b938[_0xb4ef('0x40')]['id']}})[_0xb4ef('0x1c')](handleEntityNotFound(_0x4b20fc,null))[_0xb4ef('0x1c')](saveUpdates(_0x55b938['body'],null))[_0xb4ef('0x1c')](respondWithResult(_0x4b20fc,null))[_0xb4ef('0x41')](handleError(_0x4b20fc,null));};exports[_0xb4ef('0x1d')]=function(_0x92d540,_0x4a23fc){return db[_0xb4ef('0x22')]['find']({'where':{'id':_0x92d540['params']['id']}})[_0xb4ef('0x1c')](handleEntityNotFound(_0x4a23fc,null))[_0xb4ef('0x1c')](removeEntity(_0x4a23fc,null))[_0xb4ef('0x41')](handleError(_0x4a23fc,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index fc15e27..1f5e56c 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 _0xc7da=['FreshdeskField','int_freshdesk_fields','lodash','util','../../config/logger','moment','bluebird','./intFreshdeskField.attributes','exports','define'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xc7da,0xf2));var _0xac7d=function(_0x527a2c,_0x243185){_0x527a2c=_0x527a2c-0x0;var _0x4fa0ca=_0xc7da[_0x527a2c];return _0x4fa0ca;};'use strict';var _=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var logger=require(_0xac7d('0x2'))('api');var moment=require(_0xac7d('0x3'));var BPromise=require(_0xac7d('0x4'));var rp=require('request-promise');var attributes=require(_0xac7d('0x5'));module[_0xac7d('0x6')]=function(_0x5106c8,_0x27508d){return _0x5106c8[_0xac7d('0x7')](_0xac7d('0x8'),attributes,{'tableName':_0xac7d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa32b=['lodash','../../config/logger','bluebird','request-promise','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields'];(function(_0x46f897,_0x51fbe3){var _0x463147=function(_0x5b5bf2){while(--_0x5b5bf2){_0x46f897['push'](_0x46f897['shift']());}};_0x463147(++_0x51fbe3);}(_0xa32b,0x68));var _0xba32=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xa32b[_0x336264];return _0x53cf91;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var logger=require(_0xba32('0x1'))('api');var moment=require('moment');var BPromise=require(_0xba32('0x2'));var rp=require(_0xba32('0x3'));var attributes=require(_0xba32('0x4'));module['exports']=function(_0x10004d,_0x36c87d){return _0x10004d[_0xba32('0x5')](_0xba32('0x6'),attributes,{'tableName':_0xba32('0x7'),'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 71ee51c..78fac08 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 _0xe980=['jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x43bbe4,_0x2b28ac){var _0x38d670=function(_0x2da438){while(--_0x2da438){_0x43bbe4['push'](_0x43bbe4['shift']());}};_0x38d670(++_0x2b28ac);}(_0xe980,0xec));var _0x0e98=function(_0x2bf163,_0x55dc47){_0x2bf163=_0x2bf163-0x0;var _0x4d8521=_0xe980[_0x2bf163];return _0x4d8521;};'use strict';var _=require(_0x0e98('0x0'));var util=require(_0x0e98('0x1'));var moment=require('moment');var BPromise=require(_0x0e98('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x0e98('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0e98('0x4'));var client=jayson[_0x0e98('0x5')][_0x0e98('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x369ede,_0x422862,_0x3c1026){return new BPromise(function(_0x1fba9f,_0x4f0dbe){return client[_0x0e98('0x7')](_0x369ede,_0x3c1026)[_0x0e98('0x8')](function(_0xbb79cc){logger[_0x0e98('0x9')](_0x0e98('0xa'),_0x422862,_0x0e98('0xb'));logger[_0x0e98('0xc')](_0x0e98('0xd'),_0x422862,_0x0e98('0xb'),JSON[_0x0e98('0xe')](_0xbb79cc));if(_0xbb79cc[_0x0e98('0xf')]){if(_0xbb79cc[_0x0e98('0xf')][_0x0e98('0x10')]===0x1f4){logger[_0x0e98('0xf')](_0x0e98('0xa'),_0x422862,_0xbb79cc['error'][_0x0e98('0x11')]);return _0x4f0dbe(_0xbb79cc['error'][_0x0e98('0x11')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x422862,_0xbb79cc[_0x0e98('0xf')][_0x0e98('0x11')]);return _0x1fba9f(_0xbb79cc[_0x0e98('0xf')][_0x0e98('0x11')]);}else{logger[_0x0e98('0x9')](_0x0e98('0xa'),_0x422862,_0x0e98('0xb'));_0x1fba9f(_0xbb79cc[_0x0e98('0x12')][_0x0e98('0x11')]);}})[_0x0e98('0x13')](function(_0x51b362){logger[_0x0e98('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x422862,_0x51b362);_0x4f0dbe(_0x51b362);});});} \ No newline at end of file +var _0x9f01=['http','request','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','code','error','message','info','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x50ead3,_0x4731dd){var _0x13c40f=function(_0xdbbe37){while(--_0xdbbe37){_0x50ead3['push'](_0x50ead3['shift']());}};_0x13c40f(++_0x4731dd);}(_0x9f01,0xdc));var _0x19f0=function(_0x4a050e,_0xe372c){_0x4a050e=_0x4a050e-0x0;var _0x4b5fe8=_0x9f01[_0x4a050e];return _0x4b5fe8;};'use strict';var _=require(_0x19f0('0x0'));var util=require(_0x19f0('0x1'));var moment=require('moment');var BPromise=require(_0x19f0('0x2'));var rs=require(_0x19f0('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x19f0('0x4'));var logger=require(_0x19f0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x19f0('0x6'));var client=jayson[_0x19f0('0x7')][_0x19f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3cc762,_0x264bff,_0x4c8f05){return new BPromise(function(_0x3d3690,_0x1cc222){return client[_0x19f0('0x9')](_0x3cc762,_0x4c8f05)['then'](function(_0x7d4b1b){logger['info'](_0x19f0('0xa'),_0x264bff,_0x19f0('0xb'));logger[_0x19f0('0xc')](_0x19f0('0xd'),_0x264bff,'request\x20sent',JSON['stringify'](_0x7d4b1b));if(_0x7d4b1b['error']){if(_0x7d4b1b['error'][_0x19f0('0xe')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x264bff,_0x7d4b1b[_0x19f0('0xf')]['message']);return _0x1cc222(_0x7d4b1b[_0x19f0('0xf')][_0x19f0('0x10')]);}logger[_0x19f0('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x264bff,_0x7d4b1b[_0x19f0('0xf')][_0x19f0('0x10')]);return _0x3d3690(_0x7d4b1b['error'][_0x19f0('0x10')]);}else{logger[_0x19f0('0x11')](_0x19f0('0xa'),_0x264bff,'request\x20sent');_0x3d3690(_0x7d4b1b[_0x19f0('0x12')]['message']);}})['catch'](function(_0x485723){logger['error'](_0x19f0('0xa'),_0x264bff,_0x485723);_0x1cc222(_0x485723);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index fbd99ff..679baf1 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 _0x6370=['destroy','exports','multer','util','express','Router','../../components/interaction/service','./intSalesforceAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete'];(function(_0x84670f,_0x78aaf9){var _0x4fec06=function(_0x2eb3df){while(--_0x2eb3df){_0x84670f['push'](_0x84670f['shift']());}};_0x4fec06(++_0x78aaf9);}(_0x6370,0x113));var _0x0637=function(_0x149a41,_0x3cbb44){_0x149a41=_0x149a41-0x0;var _0x10132c=_0x6370[_0x149a41];return _0x10132c;};'use strict';var multer=require(_0x0637('0x0'));var util=require(_0x0637('0x1'));var path=require('path');var express=require(_0x0637('0x2'));var router=express[_0x0637('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0637('0x4'));var config=require('../../config/environment');var controller=require(_0x0637('0x5'));router[_0x0637('0x6')]('/',auth['isAuthenticated'](),controller[_0x0637('0x7')]);router['get'](_0x0637('0x8'),auth[_0x0637('0x9')](),controller[_0x0637('0xa')]);router[_0x0637('0x6')](_0x0637('0xb'),auth['isAuthenticated'](),controller[_0x0637('0xc')]);router[_0x0637('0x6')]('/:id/fields',auth[_0x0637('0x9')](),controller[_0x0637('0xd')]);router['post']('/',auth[_0x0637('0x9')](),controller['create']);router[_0x0637('0xe')](_0x0637('0xb'),auth[_0x0637('0x9')](),controller[_0x0637('0xf')]);router[_0x0637('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0637('0x11')]);router[_0x0637('0x12')](_0x0637('0x8'),auth['isAuthenticated'](),controller[_0x0637('0x13')]);module[_0x0637('0x14')]=router; \ No newline at end of file +var _0x95e0=['express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','exports','multer','util'];(function(_0x45a71e,_0x3722d0){var _0x58d90b=function(_0xd89f80){while(--_0xd89f80){_0x45a71e['push'](_0x45a71e['shift']());}};_0x58d90b(++_0x3722d0);}(_0x95e0,0x139));var _0x095e=function(_0x2ababe,_0x2a627b){_0x2ababe=_0x2ababe-0x0;var _0x5f5b88=_0x95e0[_0x2ababe];return _0x5f5b88;};'use strict';var multer=require(_0x095e('0x0'));var util=require(_0x095e('0x1'));var path=require('path');var express=require(_0x095e('0x2'));var router=express[_0x095e('0x3')]();var auth=require(_0x095e('0x4'));var interaction=require(_0x095e('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0x095e('0x6')](),controller[_0x095e('0x7')]);router['get']('/:id',auth[_0x095e('0x6')](),controller[_0x095e('0x8')]);router[_0x095e('0x9')](_0x095e('0xa'),auth[_0x095e('0x6')](),controller[_0x095e('0xb')]);router[_0x095e('0x9')](_0x095e('0xc'),auth[_0x095e('0x6')](),controller[_0x095e('0xd')]);router[_0x095e('0xe')]('/',auth[_0x095e('0x6')](),controller[_0x095e('0xf')]);router[_0x095e('0xe')](_0x095e('0xa'),auth['isAuthenticated'](),controller[_0x095e('0x10')]);router[_0x095e('0x11')](_0x095e('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x095e('0x13')]('/:id',auth[_0x095e('0x6')](),controller['destroy']);module[_0x095e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3e90099..da3572b 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 _0x74d2=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x49a754,_0x420325){var _0x17a63a=function(_0x2b8c56){while(--_0x2b8c56){_0x49a754['push'](_0x49a754['shift']());}};_0x17a63a(++_0x420325);}(_0x74d2,0x135));var _0x274d=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0x74d2[_0x5ac0f0];return _0x4aceec;};'use strict';var Sequelize=require(_0x274d('0x0'));module[_0x274d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x274d('0x2')]},'username':{'type':Sequelize[_0x274d('0x2')],'unique':_0x274d('0x3')},'remoteUri':{'type':Sequelize[_0x274d('0x2')]},'password':{'type':Sequelize[_0x274d('0x2')]},'clientId':{'type':Sequelize[_0x274d('0x2')]},'clientSecret':{'type':Sequelize[_0x274d('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x274d('0x2')]},'type':{'type':Sequelize[_0x274d('0x4')](_0x274d('0x5'),_0x274d('0x6')),'defaultValue':_0x274d('0x5')}}; \ No newline at end of file +var _0xcedb=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x2b62d7,_0x2d252f){var _0x6d84e8=function(_0x2c9f3b){while(--_0x2c9f3b){_0x2b62d7['push'](_0x2b62d7['shift']());}};_0x6d84e8(++_0x2d252f);}(_0xcedb,0x93));var _0xbced=function(_0xa1e9f2,_0x48aa1d){_0xa1e9f2=_0xa1e9f2-0x0;var _0x4ceafa=_0xcedb[_0xa1e9f2];return _0x4ceafa;};'use strict';var Sequelize=require(_0xbced('0x0'));module[_0xbced('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xbced('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbced('0x2')]},'clientSecret':{'type':Sequelize[_0xbced('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbced('0x2')]},'type':{'type':Sequelize[_0xbced('0x3')](_0xbced('0x4'),_0xbced('0x5')),'defaultValue':_0xbced('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 4e9bc27..92493a7 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 _0x2fc8=['request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','Content-Range','json','apply','reject','save','destroy','end','stack','name','send','SalesforceAccount','rawAttributes','model','keys','query','dateEnd','dateStart','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','merge','filter','map','count','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','update','findOne','SalesforceConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','SalesforceField','getFields','clientSecret','username','password','securityToken','clientId','concat','sobject','Task','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','remove','custom','includes','label','picklistValues','value','test','Wrong\x20credentials','statusCode','request-promise','moment','bluebird','mustache','util','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http'];(function(_0x2cfe5f,_0x4e69dc){var _0x4f2f34=function(_0x26e675){while(--_0x26e675){_0x2cfe5f['push'](_0x2cfe5f['shift']());}};_0x4f2f34(++_0x4e69dc);}(_0x2fc8,0x14a));var _0x82fc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2fc8[_0x3b380d];return _0x54502b;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x82fc('0x0'));var moment=require(_0x82fc('0x1'));var BPromise=require(_0x82fc('0x2'));var Mustache=require(_0x82fc('0x3'));var util=require(_0x82fc('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x82fc('0x5'));var fs=require('fs');var _=require(_0x82fc('0x6'));var squel=require('squel');var crypto=require(_0x82fc('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x82fc('0x8'));var toCsv=require(_0x82fc('0x9'));var querystring=require(_0x82fc('0xa'));var Papa=require(_0x82fc('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x82fc('0xc'))('api');var utils=require('../../config/utils');var config=require(_0x82fc('0xd'));var db=require('../../mysqldb')['db'];var integrations=require(_0x82fc('0xe'));var jayson=require(_0x82fc('0xf'));var client=jayson[_0x82fc('0x10')][_0x82fc('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x842d,_0x47f27d,_0x1046e3,_0x180d61){return new BPromise(function(_0x5270c6,_0x35c4f4){var _0x334b2c=_0x180d61||client;return _0x334b2c[_0x82fc('0x12')](_0x842d,_0x1046e3)[_0x82fc('0x13')](function(_0x4a3a4f){logger[_0x82fc('0x14')](_0x82fc('0x15'),_0x47f27d,_0x82fc('0x16'));logger[_0x82fc('0x17')](_0x82fc('0x18'),_0x47f27d,_0x82fc('0x16'),JSON[_0x82fc('0x19')](_0x4a3a4f));if(_0x4a3a4f['error']){if(_0x4a3a4f[_0x82fc('0x1a')][_0x82fc('0x1b')]===0x1f4){logger[_0x82fc('0x1a')](_0x82fc('0x15'),_0x47f27d,_0x4a3a4f[_0x82fc('0x1a')][_0x82fc('0x1c')]);return _0x35c4f4(_0x4a3a4f[_0x82fc('0x1a')][_0x82fc('0x1c')]);}logger[_0x82fc('0x1a')](_0x82fc('0x15'),_0x47f27d,_0x4a3a4f['error'][_0x82fc('0x1c')]);return _0x5270c6(_0x4a3a4f['error'][_0x82fc('0x1c')]);}else{logger[_0x82fc('0x14')](_0x82fc('0x15'),_0x47f27d,'request\x20sent');_0x5270c6(_0x4a3a4f[_0x82fc('0x1d')]['message']);}})['catch'](function(_0x252407){logger[_0x82fc('0x1a')](_0x82fc('0x15'),_0x47f27d,_0x252407);_0x35c4f4(_0x252407);});});}function respondWithStatusCode(_0x425d4b,_0x4485e0){_0x4485e0=_0x4485e0||0xcc;return function(_0x142211){if(_0x142211){return _0x425d4b[_0x82fc('0x1e')](_0x4485e0);}return _0x425d4b['status'](_0x4485e0)['end']();};}function respondWithResult(_0x6f973e,_0x40b36f){_0x40b36f=_0x40b36f||0xc8;return function(_0x15e67b){if(_0x15e67b){return _0x6f973e[_0x82fc('0x1f')](_0x40b36f)['json'](_0x15e67b);}};}function respondWithFilteredResult(_0x45fb9f,_0x339ae6){return function(_0x4e52bb){if(_0x4e52bb){var _0x307c79=_0x4e52bb['count'],_0x254092=_0x339ae6[_0x82fc('0x20')],_0x2f1226=_0x339ae6[_0x82fc('0x20')]+_0x339ae6['limit'],_0x5c4037;if(_0x2f1226>=_0x307c79){_0x2f1226=_0x307c79;_0x5c4037=0xc8;}else{_0x5c4037=0xce;}_0x45fb9f[_0x82fc('0x1f')](_0x5c4037);return _0x45fb9f['set'](_0x82fc('0x21'),_0x254092+'-'+_0x2f1226+'/'+_0x307c79)[_0x82fc('0x22')](_0x4e52bb);}return null;};}function patchUpdates(_0x522622){return function(_0x51327e){try{jsonpatch[_0x82fc('0x23')](_0x51327e,_0x522622,!![]);}catch(_0x7a9a6a){return BPromise[_0x82fc('0x24')](_0x7a9a6a);}return _0x51327e[_0x82fc('0x25')]();};}function saveUpdates(_0x5b0d61,_0x4c931f){return function(_0x1e3e9b){if(_0x1e3e9b){return _0x1e3e9b['update'](_0x5b0d61)[_0x82fc('0x13')](function(_0x32bb6f){return _0x32bb6f;});}return null;};}function removeEntity(_0x2d1fea,_0x526236){return function(_0x5a21d5){if(_0x5a21d5){return _0x5a21d5[_0x82fc('0x26')]()['then'](function(){_0x2d1fea['status'](0xcc)[_0x82fc('0x27')]();});}};}function handleEntityNotFound(_0x132aa9,_0x1975df){return function(_0x32f8f7){if(!_0x32f8f7){_0x132aa9[_0x82fc('0x1e')](0x194);}return _0x32f8f7;};}function handleError(_0x58f302,_0x5a6208){_0x5a6208=_0x5a6208||0x1f4;return function(_0x4aeeca){logger[_0x82fc('0x1a')](_0x4aeeca[_0x82fc('0x28')]);if(_0x4aeeca[_0x82fc('0x29')]){delete _0x4aeeca[_0x82fc('0x29')];}_0x58f302['status'](_0x5a6208)[_0x82fc('0x2a')](_0x4aeeca);};}exports['index']=function(_0x311bd4,_0x5bdda2){var _0x5bd509={},_0x4cd235={},_0x51b763={'count':0x0,'rows':[]};var _0x167283=db[_0x82fc('0x2b')][_0x82fc('0x2c')];_0x4cd235[_0x82fc('0x2d')]=_[_0x82fc('0x2e')](_0x167283);var _0x5863ae={'dateStart':_0x311bd4['query']['dateStart'],'dateEnd':_0x311bd4[_0x82fc('0x2f')][_0x82fc('0x30')]};delete _0x311bd4[_0x82fc('0x2f')][_0x82fc('0x31')];delete _0x311bd4[_0x82fc('0x2f')][_0x82fc('0x30')];_0x4cd235['query']=_[_0x82fc('0x2e')](_0x311bd4[_0x82fc('0x2f')]);_0x4cd235[_0x82fc('0x32')]=_['intersection'](_0x4cd235[_0x82fc('0x2d')],_0x4cd235[_0x82fc('0x2f')]);_0x5bd509[_0x82fc('0x33')]=_[_0x82fc('0x34')](_0x4cd235[_0x82fc('0x2d')],qs['fields'](_0x311bd4['query']['fields']));_0x5bd509[_0x82fc('0x33')]=_0x5bd509['attributes'][_0x82fc('0x35')]?_0x5bd509['attributes']:_0x4cd235['model'];if(!_0x311bd4['query'][_0x82fc('0x36')](_0x82fc('0x37'))){_0x5bd509[_0x82fc('0x38')]=qs[_0x82fc('0x38')](_0x311bd4[_0x82fc('0x2f')]['limit']);_0x5bd509[_0x82fc('0x20')]=qs[_0x82fc('0x20')](_0x311bd4[_0x82fc('0x2f')][_0x82fc('0x20')]);}_0x5bd509['order']=qs['sort'](_0x311bd4[_0x82fc('0x2f')][_0x82fc('0x39')]);_0x5bd509[_0x82fc('0x3a')]=qs['filters'](_[_0x82fc('0x3b')](_0x311bd4[_0x82fc('0x2f')],_0x4cd235[_0x82fc('0x32')]));if(_0x5863ae[_0x82fc('0x31')]){if(_0x5863ae['dateEnd']){_0x5863ae['dateEnd']=moment(_0x5863ae['dateEnd'])[_0x82fc('0x3c')](0x1,_0x82fc('0x3d'));}else{_0x5863ae['dateEnd']=moment(_0x5863ae[_0x82fc('0x31')])[_0x82fc('0x3c')](0x1,'day');}_[_0x82fc('0x3e')](_0x5bd509['where'],{'createdAt':{'$gte':_0x5863ae[_0x82fc('0x31')],'$lte':_0x5863ae[_0x82fc('0x30')]}});}if(_0x311bd4['query'][_0x82fc('0x3f')]){_0x5bd509[_0x82fc('0x3a')]=_['merge'](_0x5bd509['where'],{'$or':_[_0x82fc('0x40')](_0x5bd509[_0x82fc('0x33')],function(_0xb4d5f8){var _0xd1e285={};_0xd1e285[_0xb4d5f8]={'$like':'%'+_0x311bd4[_0x82fc('0x2f')][_0x82fc('0x3f')]+'%'};return _0xd1e285;})});}_0x5bd509=_[_0x82fc('0x3e')]({},_0x5bd509,_0x311bd4['options']);var _0xfb7904={'where':_0x5bd509[_0x82fc('0x3a')]};return db['SalesforceAccount']['count'](_0xfb7904)[_0x82fc('0x13')](function(_0x41adf7){_0x51b763[_0x82fc('0x41')]=_0x41adf7;if(_0x311bd4[_0x82fc('0x2f')][_0x82fc('0x42')]){_0x5bd509[_0x82fc('0x43')]=[{'all':!![]}];}return db[_0x82fc('0x2b')][_0x82fc('0x44')](_0x5bd509);})[_0x82fc('0x13')](function(_0x272b48){_0x51b763[_0x82fc('0x45')]=_0x272b48;return _0x51b763;})['then'](respondWithFilteredResult(_0x5bdda2,_0x5bd509))['catch'](handleError(_0x5bdda2,null));};exports[_0x82fc('0x46')]=function(_0x48a853,_0x328485){var _0xb2d848={'raw':![],'where':{'id':_0x48a853[_0x82fc('0x47')]['id']}},_0x5eade8={};_0x5eade8['model']=_[_0x82fc('0x2e')](db[_0x82fc('0x2b')][_0x82fc('0x2c')]);_0x5eade8['query']=_[_0x82fc('0x2e')](_0x48a853[_0x82fc('0x2f')]);_0x5eade8['filters']=_[_0x82fc('0x34')](_0x5eade8['model'],_0x5eade8[_0x82fc('0x2f')]);_0xb2d848[_0x82fc('0x33')]=_[_0x82fc('0x34')](_0x5eade8['model'],qs[_0x82fc('0x48')](_0x48a853[_0x82fc('0x2f')][_0x82fc('0x48')]));_0xb2d848['attributes']=_0xb2d848[_0x82fc('0x33')][_0x82fc('0x35')]?_0xb2d848[_0x82fc('0x33')]:_0x5eade8[_0x82fc('0x2d')];if(_0x48a853[_0x82fc('0x2f')][_0x82fc('0x42')]){_0xb2d848[_0x82fc('0x43')]=[{'all':!![]}];}_0xb2d848=_[_0x82fc('0x3e')]({},_0xb2d848,_0x48a853[_0x82fc('0x49')]);return db[_0x82fc('0x2b')][_0x82fc('0x4a')](_0xb2d848)[_0x82fc('0x13')](handleEntityNotFound(_0x328485,null))[_0x82fc('0x13')](respondWithResult(_0x328485,null))[_0x82fc('0x4b')](handleError(_0x328485,null));};exports['create']=function(_0x11769a,_0x43cb01){return db[_0x82fc('0x2b')][_0x82fc('0x4c')](_0x11769a[_0x82fc('0x4d')],{})[_0x82fc('0x13')](respondWithResult(_0x43cb01,0xc9))['catch'](handleError(_0x43cb01,null));};exports[_0x82fc('0x4e')]=function(_0x4cb291,_0x145b5b){if(_0x4cb291[_0x82fc('0x4d')]['id']){delete _0x4cb291[_0x82fc('0x4d')]['id'];}return db[_0x82fc('0x2b')][_0x82fc('0x4a')]({'where':{'id':_0x4cb291[_0x82fc('0x47')]['id']}})[_0x82fc('0x13')](handleEntityNotFound(_0x145b5b,null))[_0x82fc('0x13')](saveUpdates(_0x4cb291[_0x82fc('0x4d')],null))[_0x82fc('0x13')](respondWithResult(_0x145b5b,null))[_0x82fc('0x4b')](handleError(_0x145b5b,null));};exports[_0x82fc('0x26')]=function(_0x167ba3,_0x58e381){return db['SalesforceAccount']['find']({'where':{'id':_0x167ba3[_0x82fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x58e381,null))['then'](removeEntity(_0x58e381,null))[_0x82fc('0x4b')](handleError(_0x58e381,null));};exports['getConfigurations']=function(_0x39f7b7,_0x1325f8,_0x24917b){var _0x3145c3={};var _0x368653={};var _0x48340d;var _0x1388cc;return db[_0x82fc('0x2b')][_0x82fc('0x4f')]({'where':{'id':_0x39f7b7['params']['id']}})['then'](handleEntityNotFound(_0x1325f8,null))[_0x82fc('0x13')](function(_0x134f6b){if(_0x134f6b){_0x48340d=_0x134f6b;_0x368653[_0x82fc('0x2d')]=_[_0x82fc('0x2e')](db[_0x82fc('0x50')][_0x82fc('0x2c')]);_0x368653[_0x82fc('0x2f')]=_[_0x82fc('0x2e')](_0x39f7b7[_0x82fc('0x2f')]);_0x368653['filters']=_[_0x82fc('0x34')](_0x368653[_0x82fc('0x2d')],_0x368653['query']);_0x3145c3[_0x82fc('0x33')]=_['intersection'](_0x368653[_0x82fc('0x2d')],qs[_0x82fc('0x48')](_0x39f7b7[_0x82fc('0x2f')][_0x82fc('0x48')]));_0x3145c3[_0x82fc('0x33')]=_0x3145c3[_0x82fc('0x33')]['length']?_0x3145c3[_0x82fc('0x33')]:_0x368653[_0x82fc('0x2d')];_0x3145c3[_0x82fc('0x51')]=qs[_0x82fc('0x39')](_0x39f7b7['query'][_0x82fc('0x39')]);_0x3145c3['where']=qs['filters'](_['pick'](_0x39f7b7[_0x82fc('0x2f')],_0x368653[_0x82fc('0x32')]));if(_0x39f7b7[_0x82fc('0x2f')][_0x82fc('0x3f')]){_0x3145c3[_0x82fc('0x3a')]=_[_0x82fc('0x3e')](_0x3145c3['where'],{'$or':_['map'](_0x3145c3['attributes'],function(_0x17c194){var _0x57c733={};_0x57c733[_0x17c194]={'$like':'%'+_0x39f7b7['query']['filter']+'%'};return _0x57c733;})});}_0x3145c3=_[_0x82fc('0x3e')]({},_0x3145c3,_0x39f7b7['options']);return _0x48340d[_0x82fc('0x52')](_0x3145c3);}})[_0x82fc('0x13')](function(_0x52321d){if(_0x52321d){_0x1388cc=_0x52321d[_0x82fc('0x35')];if(!_0x39f7b7[_0x82fc('0x2f')][_0x82fc('0x36')](_0x82fc('0x37'))){_0x3145c3[_0x82fc('0x38')]=qs[_0x82fc('0x38')](_0x39f7b7[_0x82fc('0x2f')][_0x82fc('0x38')]);_0x3145c3[_0x82fc('0x20')]=qs[_0x82fc('0x20')](_0x39f7b7[_0x82fc('0x2f')][_0x82fc('0x20')]);}return _0x48340d['getConfigurations'](_0x3145c3);}})['then'](function(_0x2294e5){if(_0x2294e5){return _0x2294e5?{'count':_0x1388cc,'rows':_0x2294e5}:null;}})[_0x82fc('0x13')](respondWithResult(_0x1325f8,null))[_0x82fc('0x4b')](handleError(_0x1325f8,null));};exports[_0x82fc('0x53')]=function(_0x307734,_0x2482f9,_0x2e7ccb){if(_0x307734['body']['id']){delete _0x307734['body']['id'];}return db[_0x82fc('0x2b')][_0x82fc('0x4f')]({'where':{'id':_0x307734[_0x82fc('0x47')]['id']}})[_0x82fc('0x13')](handleEntityNotFound(_0x2482f9,null))['then'](function(_0xd150a0){if(_0xd150a0){_0x307734[_0x82fc('0x4d')][_0x82fc('0x54')]=_0xd150a0['id'];_0x307734['body'][_0x82fc('0x55')]=integrations[_0x82fc('0x56')](_0x307734[_0x82fc('0x4d')][_0x82fc('0x57')],_0x307734['body'][_0x82fc('0x58')]);_0x307734[_0x82fc('0x4d')][_0x82fc('0x59')]=integrations['getDescriptions'](_0x307734[_0x82fc('0x4d')][_0x82fc('0x57')],_0x307734['body'][_0x82fc('0x58')]);return db['SalesforceConfiguration'][_0x82fc('0x4c')](_0x307734[_0x82fc('0x4d')],{'include':[{'model':db[_0x82fc('0x5a')],'as':_0x82fc('0x55')},{'model':db[_0x82fc('0x5a')],'as':'Descriptions'}]});}return null;})[_0x82fc('0x13')](respondWithResult(_0x2482f9,null))[_0x82fc('0x4b')](handleError(_0x2482f9,null));};exports[_0x82fc('0x5b')]=function(_0x1bea03,_0x57b8ad,_0x11ccec){var _0x4dbb13;return db['SalesforceAccount'][_0x82fc('0x4f')]({'where':{'id':_0x1bea03[_0x82fc('0x47')]['id']},'attributes':['id','remoteUri','clientId',_0x82fc('0x5c'),_0x82fc('0x5d'),_0x82fc('0x5e'),_0x82fc('0x5f')]})[_0x82fc('0x13')](handleEntityNotFound(_0x57b8ad,null))[_0x82fc('0x13')](function(_0x650fa){if(_0x650fa){_0x4dbb13=new jsforce['Connection']({'oauth2':{'loginUrl':_0x650fa['remoteUri'],'clientId':_0x650fa[_0x82fc('0x60')],'clientSecret':_0x650fa['clientSecret']}});return _0x4dbb13['login'](_0x650fa[_0x82fc('0x5d')],_0x650fa['password'][_0x82fc('0x61')](_0x650fa[_0x82fc('0x5f')]));}})[_0x82fc('0x13')](function(_0x33ce56){if(_0x33ce56){return _0x4dbb13[_0x82fc('0x62')](_0x82fc('0x63'))[_0x82fc('0x64')]();}})[_0x82fc('0x13')](function(_0x78ad4c){var _0x1746cf=['CallDisposition',_0x82fc('0x65'),_0x82fc('0x66'),_0x82fc('0x67'),_0x82fc('0x68'),_0x82fc('0x69'),_0x82fc('0x6a'),'Type'];if(_0x78ad4c){_[_0x82fc('0x6b')](_0x78ad4c[_0x82fc('0x48')],function(_0x2e5e98){return _0x2e5e98[_0x82fc('0x6c')]===![]&&!_0x1746cf[_0x82fc('0x6d')](_0x2e5e98[_0x82fc('0x29')]);});return{'count':_0x78ad4c['fields'][_0x82fc('0x35')],'rows':_[_0x82fc('0x40')](_0x78ad4c['fields'],function(_0x212f2a){return{'id':_0x212f2a[_0x82fc('0x29')],'name':_0x212f2a[_0x82fc('0x6e')],'custom':_0x212f2a[_0x82fc('0x6c')],'options':_0x212f2a[_0x82fc('0x6f')]?_['map'](_0x212f2a[_0x82fc('0x6f')],function(_0x2de4eb){return{'name':_0x2de4eb[_0x82fc('0x6e')],'value':_0x2de4eb[_0x82fc('0x70')]};}):[]};})};}})[_0x82fc('0x13')](respondWithResult(_0x57b8ad,null))[_0x82fc('0x4b')](function(_0x244d0f){var _0x1441e4=_0x1bea03[_0x82fc('0x2f')]['test']?0x1f4:_0x244d0f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1441e4,JSON[_0x82fc('0x19')](_0x244d0f));delete _0x244d0f[_0x82fc('0x29')];if(_0x1441e4===0x191){_0x1441e4=0x190;}_0x57b8ad[_0x82fc('0x1f')](_0x1441e4)[_0x82fc('0x2a')](_0x1bea03[_0x82fc('0x2f')][_0x82fc('0x71')]?{'message':_0x82fc('0x72'),'statusCode':_0x244d0f[_0x82fc('0x73')]}:_0x244d0f);});}; \ No newline at end of file +var _0xa5cf=['remoteUri','clientId','clientSecret','username','login','password','concat','securityToken','sobject','Task','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Type','remove','custom','label','picklistValues','value','test','Wrong\x20credentials','statusCode','fast-json-patch','bluebird','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','json','reject','save','update','destroy','stack','name','send','index','SalesforceAccount','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','SalesforceConfiguration','rawAttributes','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','getFields','findOne'];(function(_0x2edec8,_0x4a36f6){var _0xc3dbd4=function(_0x13af55){while(--_0x13af55){_0x2edec8['push'](_0x2edec8['shift']());}};_0xc3dbd4(++_0x4a36f6);}(_0xa5cf,0x1e9));var _0xfa5c=function(_0x418554,_0x581e7d){_0x418554=_0x418554-0x0;var _0x281ece=_0xa5cf[_0x418554];return _0x281ece;};'use strict';var jsonpatch=require(_0xfa5c('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa5c('0x1'));var Mustache=require(_0xfa5c('0x2'));var util=require('util');var path=require(_0xfa5c('0x3'));var sox=require(_0xfa5c('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfa5c('0x5'));var squel=require(_0xfa5c('0x6'));var crypto=require('crypto');var jsforce=require(_0xfa5c('0x7'));var deskjs=require(_0xfa5c('0x8'));var toCsv=require(_0xfa5c('0x9'));var querystring=require('querystring');var Papa=require(_0xfa5c('0xa'));var qs=require(_0xfa5c('0xb'));var logger=require(_0xfa5c('0xc'))(_0xfa5c('0xd'));var utils=require('../../config/utils');var config=require(_0xfa5c('0xe'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfa5c('0xf'));var jayson=require(_0xfa5c('0x10'));var client=jayson['client'][_0xfa5c('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4c7f73,_0x27788b,_0x4daf46,_0x732d4b){return new BPromise(function(_0x59b4dd,_0x571cbc){var _0x56862b=_0x732d4b||client;return _0x56862b[_0xfa5c('0x12')](_0x4c7f73,_0x4daf46)[_0xfa5c('0x13')](function(_0x437c73){logger[_0xfa5c('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x27788b,_0xfa5c('0x15'));logger[_0xfa5c('0x16')](_0xfa5c('0x17'),_0x27788b,_0xfa5c('0x15'),JSON[_0xfa5c('0x18')](_0x437c73));if(_0x437c73[_0xfa5c('0x19')]){if(_0x437c73[_0xfa5c('0x19')][_0xfa5c('0x1a')]===0x1f4){logger[_0xfa5c('0x19')](_0xfa5c('0x1b'),_0x27788b,_0x437c73[_0xfa5c('0x19')][_0xfa5c('0x1c')]);return _0x571cbc(_0x437c73[_0xfa5c('0x19')][_0xfa5c('0x1c')]);}logger[_0xfa5c('0x19')]('SalesforceAccount,\x20%s,\x20%s',_0x27788b,_0x437c73[_0xfa5c('0x19')]['message']);return _0x59b4dd(_0x437c73['error'][_0xfa5c('0x1c')]);}else{logger[_0xfa5c('0x14')](_0xfa5c('0x1b'),_0x27788b,_0xfa5c('0x15'));_0x59b4dd(_0x437c73[_0xfa5c('0x1d')][_0xfa5c('0x1c')]);}})['catch'](function(_0x376ccb){logger[_0xfa5c('0x19')]('SalesforceAccount,\x20%s,\x20%s',_0x27788b,_0x376ccb);_0x571cbc(_0x376ccb);});});}function respondWithStatusCode(_0x2bde07,_0xa6cae7){_0xa6cae7=_0xa6cae7||0xcc;return function(_0x18f943){if(_0x18f943){return _0x2bde07[_0xfa5c('0x1e')](_0xa6cae7);}return _0x2bde07[_0xfa5c('0x1f')](_0xa6cae7)[_0xfa5c('0x20')]();};}function respondWithResult(_0x423238,_0x55e324){_0x55e324=_0x55e324||0xc8;return function(_0xfb8040){if(_0xfb8040){return _0x423238[_0xfa5c('0x1f')](_0x55e324)['json'](_0xfb8040);}};}function respondWithFilteredResult(_0x21f6a2,_0x1dd611){return function(_0x59f680){if(_0x59f680){var _0x2caa8b=_0x59f680[_0xfa5c('0x21')],_0x4a8ea5=_0x1dd611['offset'],_0x130755=_0x1dd611[_0xfa5c('0x22')]+_0x1dd611[_0xfa5c('0x23')],_0x4473ab;if(_0x130755>=_0x2caa8b){_0x130755=_0x2caa8b;_0x4473ab=0xc8;}else{_0x4473ab=0xce;}_0x21f6a2[_0xfa5c('0x1f')](_0x4473ab);return _0x21f6a2['set']('Content-Range',_0x4a8ea5+'-'+_0x130755+'/'+_0x2caa8b)[_0xfa5c('0x24')](_0x59f680);}return null;};}function patchUpdates(_0x1d0965){return function(_0xe4dde8){try{jsonpatch['apply'](_0xe4dde8,_0x1d0965,!![]);}catch(_0x203ef1){return BPromise[_0xfa5c('0x25')](_0x203ef1);}return _0xe4dde8[_0xfa5c('0x26')]();};}function saveUpdates(_0x451318,_0x48ae5d){return function(_0x55cbab){if(_0x55cbab){return _0x55cbab[_0xfa5c('0x27')](_0x451318)[_0xfa5c('0x13')](function(_0x520c8f){return _0x520c8f;});}return null;};}function removeEntity(_0x1ac504,_0x303abf){return function(_0x4449a4){if(_0x4449a4){return _0x4449a4[_0xfa5c('0x28')]()['then'](function(){_0x1ac504['status'](0xcc)[_0xfa5c('0x20')]();});}};}function handleEntityNotFound(_0x2415c3,_0x227e23){return function(_0x55ee70){if(!_0x55ee70){_0x2415c3['sendStatus'](0x194);}return _0x55ee70;};}function handleError(_0x5be290,_0x56bd2b){_0x56bd2b=_0x56bd2b||0x1f4;return function(_0x15c142){logger[_0xfa5c('0x19')](_0x15c142[_0xfa5c('0x29')]);if(_0x15c142[_0xfa5c('0x2a')]){delete _0x15c142['name'];}_0x5be290[_0xfa5c('0x1f')](_0x56bd2b)[_0xfa5c('0x2b')](_0x15c142);};}exports[_0xfa5c('0x2c')]=function(_0x2d7601,_0x50fa80){var _0x5787c3={},_0xbeedac={},_0xd714fc={'count':0x0,'rows':[]};var _0xe35ed4=db[_0xfa5c('0x2d')]['rawAttributes'];_0xbeedac[_0xfa5c('0x2e')]=_[_0xfa5c('0x2f')](_0xe35ed4);var _0x41cdeb={'dateStart':_0x2d7601['query'][_0xfa5c('0x30')],'dateEnd':_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x32')]};delete _0x2d7601[_0xfa5c('0x31')]['dateStart'];delete _0x2d7601[_0xfa5c('0x31')]['dateEnd'];_0xbeedac['query']=_['keys'](_0x2d7601[_0xfa5c('0x31')]);_0xbeedac['filters']=_[_0xfa5c('0x33')](_0xbeedac[_0xfa5c('0x2e')],_0xbeedac['query']);_0x5787c3[_0xfa5c('0x34')]=_[_0xfa5c('0x33')](_0xbeedac[_0xfa5c('0x2e')],qs['fields'](_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x35')]));_0x5787c3[_0xfa5c('0x34')]=_0x5787c3['attributes']['length']?_0x5787c3[_0xfa5c('0x34')]:_0xbeedac[_0xfa5c('0x2e')];if(!_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x36')](_0xfa5c('0x37'))){_0x5787c3[_0xfa5c('0x23')]=qs[_0xfa5c('0x23')](_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x23')]);_0x5787c3['offset']=qs[_0xfa5c('0x22')](_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x22')]);}_0x5787c3[_0xfa5c('0x38')]=qs[_0xfa5c('0x39')](_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x39')]);_0x5787c3[_0xfa5c('0x3a')]=qs[_0xfa5c('0x3b')](_[_0xfa5c('0x3c')](_0x2d7601[_0xfa5c('0x31')],_0xbeedac[_0xfa5c('0x3b')]));if(_0x41cdeb[_0xfa5c('0x30')]){if(_0x41cdeb[_0xfa5c('0x32')]){_0x41cdeb[_0xfa5c('0x32')]=moment(_0x41cdeb[_0xfa5c('0x32')])[_0xfa5c('0x3d')](0x1,_0xfa5c('0x3e'));}else{_0x41cdeb[_0xfa5c('0x32')]=moment(_0x41cdeb['dateStart'])['add'](0x1,_0xfa5c('0x3e'));}_[_0xfa5c('0x3f')](_0x5787c3['where'],{'createdAt':{'$gte':_0x41cdeb[_0xfa5c('0x30')],'$lte':_0x41cdeb[_0xfa5c('0x32')]}});}if(_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x40')]){_0x5787c3[_0xfa5c('0x3a')]=_[_0xfa5c('0x3f')](_0x5787c3[_0xfa5c('0x3a')],{'$or':_[_0xfa5c('0x41')](_0x5787c3[_0xfa5c('0x34')],function(_0x1407bc){var _0x4a0fa1={};_0x4a0fa1[_0x1407bc]={'$like':'%'+_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x40')]+'%'};return _0x4a0fa1;})});}_0x5787c3=_['merge']({},_0x5787c3,_0x2d7601[_0xfa5c('0x42')]);var _0x560c96={'where':_0x5787c3[_0xfa5c('0x3a')]};return db[_0xfa5c('0x2d')][_0xfa5c('0x21')](_0x560c96)[_0xfa5c('0x13')](function(_0xeb3af4){_0xd714fc[_0xfa5c('0x21')]=_0xeb3af4;if(_0x2d7601[_0xfa5c('0x31')][_0xfa5c('0x43')]){_0x5787c3[_0xfa5c('0x44')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xfa5c('0x45')](_0x5787c3);})[_0xfa5c('0x13')](function(_0xbbd34c){_0xd714fc[_0xfa5c('0x46')]=_0xbbd34c;return _0xd714fc;})[_0xfa5c('0x13')](respondWithFilteredResult(_0x50fa80,_0x5787c3))[_0xfa5c('0x47')](handleError(_0x50fa80,null));};exports[_0xfa5c('0x48')]=function(_0x1a1749,_0x64dc7f){var _0x5b81e3={'raw':![],'where':{'id':_0x1a1749[_0xfa5c('0x49')]['id']}},_0x4bb535={};_0x4bb535[_0xfa5c('0x2e')]=_[_0xfa5c('0x2f')](db[_0xfa5c('0x2d')]['rawAttributes']);_0x4bb535['query']=_[_0xfa5c('0x2f')](_0x1a1749[_0xfa5c('0x31')]);_0x4bb535[_0xfa5c('0x3b')]=_[_0xfa5c('0x33')](_0x4bb535[_0xfa5c('0x2e')],_0x4bb535['query']);_0x5b81e3[_0xfa5c('0x34')]=_['intersection'](_0x4bb535[_0xfa5c('0x2e')],qs[_0xfa5c('0x35')](_0x1a1749[_0xfa5c('0x31')][_0xfa5c('0x35')]));_0x5b81e3[_0xfa5c('0x34')]=_0x5b81e3['attributes'][_0xfa5c('0x4a')]?_0x5b81e3[_0xfa5c('0x34')]:_0x4bb535['model'];if(_0x1a1749[_0xfa5c('0x31')]['includeAll']){_0x5b81e3[_0xfa5c('0x44')]=[{'all':!![]}];}_0x5b81e3=_[_0xfa5c('0x3f')]({},_0x5b81e3,_0x1a1749[_0xfa5c('0x42')]);return db['SalesforceAccount'][_0xfa5c('0x4b')](_0x5b81e3)[_0xfa5c('0x13')](handleEntityNotFound(_0x64dc7f,null))[_0xfa5c('0x13')](respondWithResult(_0x64dc7f,null))[_0xfa5c('0x47')](handleError(_0x64dc7f,null));};exports[_0xfa5c('0x4c')]=function(_0x471b54,_0xeb04f9){return db[_0xfa5c('0x2d')][_0xfa5c('0x4c')](_0x471b54[_0xfa5c('0x4d')],{})['then'](respondWithResult(_0xeb04f9,0xc9))['catch'](handleError(_0xeb04f9,null));};exports[_0xfa5c('0x27')]=function(_0x140969,_0x57539b){if(_0x140969[_0xfa5c('0x4d')]['id']){delete _0x140969[_0xfa5c('0x4d')]['id'];}return db[_0xfa5c('0x2d')][_0xfa5c('0x4b')]({'where':{'id':_0x140969[_0xfa5c('0x49')]['id']}})['then'](handleEntityNotFound(_0x57539b,null))['then'](saveUpdates(_0x140969['body'],null))['then'](respondWithResult(_0x57539b,null))[_0xfa5c('0x47')](handleError(_0x57539b,null));};exports[_0xfa5c('0x28')]=function(_0xfec797,_0x2ae7d6){return db[_0xfa5c('0x2d')][_0xfa5c('0x4b')]({'where':{'id':_0xfec797[_0xfa5c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ae7d6,null))['then'](removeEntity(_0x2ae7d6,null))[_0xfa5c('0x47')](handleError(_0x2ae7d6,null));};exports[_0xfa5c('0x4e')]=function(_0x129a49,_0x411b7e,_0x1299de){var _0x5ea5bd={};var _0xdc42b5={};var _0x6ba4ce;var _0x3c76e3;return db['SalesforceAccount']['findOne']({'where':{'id':_0x129a49[_0xfa5c('0x49')]['id']}})[_0xfa5c('0x13')](handleEntityNotFound(_0x411b7e,null))['then'](function(_0x194a54){if(_0x194a54){_0x6ba4ce=_0x194a54;_0xdc42b5[_0xfa5c('0x2e')]=_[_0xfa5c('0x2f')](db[_0xfa5c('0x4f')][_0xfa5c('0x50')]);_0xdc42b5[_0xfa5c('0x31')]=_[_0xfa5c('0x2f')](_0x129a49[_0xfa5c('0x31')]);_0xdc42b5[_0xfa5c('0x3b')]=_[_0xfa5c('0x33')](_0xdc42b5[_0xfa5c('0x2e')],_0xdc42b5[_0xfa5c('0x31')]);_0x5ea5bd[_0xfa5c('0x34')]=_[_0xfa5c('0x33')](_0xdc42b5[_0xfa5c('0x2e')],qs[_0xfa5c('0x35')](_0x129a49[_0xfa5c('0x31')]['fields']));_0x5ea5bd[_0xfa5c('0x34')]=_0x5ea5bd[_0xfa5c('0x34')][_0xfa5c('0x4a')]?_0x5ea5bd[_0xfa5c('0x34')]:_0xdc42b5['model'];_0x5ea5bd[_0xfa5c('0x38')]=qs[_0xfa5c('0x39')](_0x129a49['query'][_0xfa5c('0x39')]);_0x5ea5bd[_0xfa5c('0x3a')]=qs[_0xfa5c('0x3b')](_['pick'](_0x129a49[_0xfa5c('0x31')],_0xdc42b5[_0xfa5c('0x3b')]));if(_0x129a49[_0xfa5c('0x31')][_0xfa5c('0x40')]){_0x5ea5bd['where']=_[_0xfa5c('0x3f')](_0x5ea5bd['where'],{'$or':_[_0xfa5c('0x41')](_0x5ea5bd[_0xfa5c('0x34')],function(_0x437b0b){var _0x43ed44={};_0x43ed44[_0x437b0b]={'$like':'%'+_0x129a49['query'][_0xfa5c('0x40')]+'%'};return _0x43ed44;})});}_0x5ea5bd=_[_0xfa5c('0x3f')]({},_0x5ea5bd,_0x129a49[_0xfa5c('0x42')]);return _0x6ba4ce['getConfigurations'](_0x5ea5bd);}})[_0xfa5c('0x13')](function(_0x3ade84){if(_0x3ade84){_0x3c76e3=_0x3ade84['length'];if(!_0x129a49['query'][_0xfa5c('0x36')](_0xfa5c('0x37'))){_0x5ea5bd[_0xfa5c('0x23')]=qs[_0xfa5c('0x23')](_0x129a49[_0xfa5c('0x31')][_0xfa5c('0x23')]);_0x5ea5bd[_0xfa5c('0x22')]=qs[_0xfa5c('0x22')](_0x129a49[_0xfa5c('0x31')][_0xfa5c('0x22')]);}return _0x6ba4ce[_0xfa5c('0x4e')](_0x5ea5bd);}})[_0xfa5c('0x13')](function(_0x3c47d2){if(_0x3c47d2){return _0x3c47d2?{'count':_0x3c76e3,'rows':_0x3c47d2}:null;}})[_0xfa5c('0x13')](respondWithResult(_0x411b7e,null))[_0xfa5c('0x47')](handleError(_0x411b7e,null));};exports[_0xfa5c('0x51')]=function(_0x39b4b6,_0x2160c0,_0x506006){if(_0x39b4b6[_0xfa5c('0x4d')]['id']){delete _0x39b4b6['body']['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x39b4b6[_0xfa5c('0x49')]['id']}})[_0xfa5c('0x13')](handleEntityNotFound(_0x2160c0,null))[_0xfa5c('0x13')](function(_0x38fa0b){if(_0x38fa0b){_0x39b4b6['body']['AccountId']=_0x38fa0b['id'];_0x39b4b6[_0xfa5c('0x4d')][_0xfa5c('0x52')]=integrations[_0xfa5c('0x53')](_0x39b4b6[_0xfa5c('0x4d')][_0xfa5c('0x54')],_0x39b4b6[_0xfa5c('0x4d')][_0xfa5c('0x55')]);_0x39b4b6[_0xfa5c('0x4d')][_0xfa5c('0x56')]=integrations[_0xfa5c('0x57')](_0x39b4b6['body'][_0xfa5c('0x54')],_0x39b4b6[_0xfa5c('0x4d')][_0xfa5c('0x55')]);return db[_0xfa5c('0x4f')]['create'](_0x39b4b6['body'],{'include':[{'model':db[_0xfa5c('0x58')],'as':_0xfa5c('0x52')},{'model':db['SalesforceField'],'as':_0xfa5c('0x56')}]});}return null;})['then'](respondWithResult(_0x2160c0,null))['catch'](handleError(_0x2160c0,null));};exports[_0xfa5c('0x59')]=function(_0x4b2a15,_0x1d5ce0,_0x500355){var _0x559c31;return db['SalesforceAccount'][_0xfa5c('0x5a')]({'where':{'id':_0x4b2a15[_0xfa5c('0x49')]['id']},'attributes':['id',_0xfa5c('0x5b'),_0xfa5c('0x5c'),_0xfa5c('0x5d'),_0xfa5c('0x5e'),'password','securityToken']})[_0xfa5c('0x13')](handleEntityNotFound(_0x1d5ce0,null))[_0xfa5c('0x13')](function(_0x4f0ea0){if(_0x4f0ea0){_0x559c31=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4f0ea0['remoteUri'],'clientId':_0x4f0ea0[_0xfa5c('0x5c')],'clientSecret':_0x4f0ea0['clientSecret']}});return _0x559c31[_0xfa5c('0x5f')](_0x4f0ea0['username'],_0x4f0ea0[_0xfa5c('0x60')][_0xfa5c('0x61')](_0x4f0ea0[_0xfa5c('0x62')]));}})['then'](function(_0x2b9e7f){if(_0x2b9e7f){return _0x559c31[_0xfa5c('0x63')](_0xfa5c('0x64'))['describe']();}})['then'](function(_0xcaeee3){var _0x3383c3=[_0xfa5c('0x65'),_0xfa5c('0x66'),_0xfa5c('0x67'),_0xfa5c('0x68'),_0xfa5c('0x69'),_0xfa5c('0x6a'),'Status',_0xfa5c('0x6b')];if(_0xcaeee3){_[_0xfa5c('0x6c')](_0xcaeee3[_0xfa5c('0x35')],function(_0x3f5e72){return _0x3f5e72[_0xfa5c('0x6d')]===![]&&!_0x3383c3['includes'](_0x3f5e72[_0xfa5c('0x2a')]);});return{'count':_0xcaeee3['fields'][_0xfa5c('0x4a')],'rows':_[_0xfa5c('0x41')](_0xcaeee3[_0xfa5c('0x35')],function(_0x177304){return{'id':_0x177304[_0xfa5c('0x2a')],'name':_0x177304[_0xfa5c('0x6e')],'custom':_0x177304['custom'],'options':_0x177304[_0xfa5c('0x6f')]?_[_0xfa5c('0x41')](_0x177304[_0xfa5c('0x6f')],function(_0x12343b){return{'name':_0x12343b['label'],'value':_0x12343b[_0xfa5c('0x70')]};}):[]};})};}})[_0xfa5c('0x13')](respondWithResult(_0x1d5ce0,null))[_0xfa5c('0x47')](function(_0x346ae3){var _0x3aaa4d=_0x4b2a15[_0xfa5c('0x31')][_0xfa5c('0x71')]?0x1f4:_0x346ae3['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfa5c('0x59'),_0x3aaa4d,JSON[_0xfa5c('0x18')](_0x346ae3));delete _0x346ae3[_0xfa5c('0x2a')];if(_0x3aaa4d===0x191){_0x3aaa4d=0x190;}_0x1d5ce0[_0xfa5c('0x1f')](_0x3aaa4d)[_0xfa5c('0x2b')](_0x4b2a15[_0xfa5c('0x31')][_0xfa5c('0x71')]?{'message':_0xfa5c('0x72'),'statusCode':_0x346ae3[_0xfa5c('0x73')]}:_0x346ae3);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index af072cb..89013ed 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 _0xb6f7=['int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount'];(function(_0xc0bf56,_0x476134){var _0x43ff64=function(_0x173815){while(--_0x173815){_0xc0bf56['push'](_0xc0bf56['shift']());}};_0x43ff64(++_0x476134);}(_0xb6f7,0x11f));var _0x7b6f=function(_0x3c3bba,_0x483428){_0x3c3bba=_0x3c3bba-0x0;var _0x57bd9f=_0xb6f7[_0x3c3bba];return _0x57bd9f;};'use strict';var _=require('lodash');var util=require(_0x7b6f('0x0'));var logger=require(_0x7b6f('0x1'))(_0x7b6f('0x2'));var moment=require(_0x7b6f('0x3'));var BPromise=require(_0x7b6f('0x4'));var rp=require(_0x7b6f('0x5'));var attributes=require(_0x7b6f('0x6'));var integrations=require(_0x7b6f('0x7'));module['exports']=function(_0x4995d6,_0xd459f4){return _0x4995d6[_0x7b6f('0x8')](_0x7b6f('0x9'),attributes,{'tableName':_0x7b6f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4f2=['int_salesforce_accounts','lodash','util','../../config/logger','api','moment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xc4f2,0x198));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c4f('0x0'));var util=require(_0x2c4f('0x1'));var logger=require(_0x2c4f('0x2'))(_0x2c4f('0x3'));var moment=require(_0x2c4f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x2c4f('0x5'));var integrations=require(_0x2c4f('0x6'));module[_0x2c4f('0x7')]=function(_0x324fd6,_0xee18bb){return _0x324fd6[_0x2c4f('0x8')](_0x2c4f('0x9'),attributes,{'tableName':_0x2c4f('0xa'),'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 117f405..5b926e6 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 _0x19ad=['util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','ShowSalesforceAccount','SalesforceAccount','find','stringify'];(function(_0x380a08,_0x303d62){var _0x48eb97=function(_0xc71adf){while(--_0xc71adf){_0x380a08['push'](_0x380a08['shift']());}};_0x48eb97(++_0x303d62);}(_0x19ad,0x180));var _0xd19a=function(_0x3ed4d7,_0x3783e0){_0x3ed4d7=_0x3ed4d7-0x0;var _0x2be1a4=_0x19ad[_0x3ed4d7];return _0x2be1a4;};'use strict';var _=require('lodash');var util=require(_0xd19a('0x0'));var moment=require(_0xd19a('0x1'));var BPromise=require(_0xd19a('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xd19a('0x3'))['db'];var utils=require(_0xd19a('0x4'));var logger=require('../../config/logger')(_0xd19a('0x5'));var config=require(_0xd19a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd19a('0x7')][_0xd19a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xad2ece,_0x155157,_0x576e3b){return new BPromise(function(_0x42a73b,_0x1a906e){return client[_0xd19a('0x9')](_0xad2ece,_0x576e3b)[_0xd19a('0xa')](function(_0x1f5a36){logger['info'](_0xd19a('0xb'),_0x155157,_0xd19a('0xc'));logger[_0xd19a('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x155157,_0xd19a('0xc'),JSON['stringify'](_0x1f5a36));if(_0x1f5a36[_0xd19a('0xe')]){if(_0x1f5a36[_0xd19a('0xe')][_0xd19a('0xf')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x155157,_0x1f5a36['error'][_0xd19a('0x10')]);return _0x1a906e(_0x1f5a36[_0xd19a('0xe')][_0xd19a('0x10')]);}logger[_0xd19a('0xe')](_0xd19a('0xb'),_0x155157,_0x1f5a36['error']['message']);return _0x42a73b(_0x1f5a36[_0xd19a('0xe')][_0xd19a('0x10')]);}else{logger[_0xd19a('0x11')](_0xd19a('0xb'),_0x155157,_0xd19a('0xc'));_0x42a73b(_0x1f5a36['result'][_0xd19a('0x10')]);}})[_0xd19a('0x12')](function(_0x4bc209){logger[_0xd19a('0xe')](_0xd19a('0xb'),_0x155157,_0x4bc209);_0x1a906e(_0x4bc209);});});}exports[_0xd19a('0x13')]=function(_0x57dd53){var _0x444af5=this;return new Promise(function(_0x420b30,_0x6acd71){return db['SalesforceAccount'][_0xd19a('0x14')]({'raw':_0x57dd53[_0xd19a('0x15')]?_0x57dd53[_0xd19a('0x15')][_0xd19a('0x16')]===undefined?!![]:![]:!![],'where':_0x57dd53[_0xd19a('0x15')]?_0x57dd53[_0xd19a('0x15')]['where']||null:null,'attributes':_0x57dd53[_0xd19a('0x15')]?_0x57dd53[_0xd19a('0x15')][_0xd19a('0x17')]||null:null,'limit':_0x57dd53[_0xd19a('0x15')]?_0x57dd53['options'][_0xd19a('0x18')]||null:null,'include':_0x57dd53['options']?_0x57dd53[_0xd19a('0x15')][_0xd19a('0x19')]?_['map'](_0x57dd53['options'][_0xd19a('0x19')],function(_0x11e577){return{'model':db[_0x11e577[_0xd19a('0x1a')]],'as':_0x11e577['as'],'attributes':_0x11e577[_0xd19a('0x17')],'include':_0x11e577[_0xd19a('0x19')]?_[_0xd19a('0x1b')](_0x11e577[_0xd19a('0x19')],function(_0x45a5e6){return{'model':db[_0x45a5e6[_0xd19a('0x1a')]],'as':_0x45a5e6['as'],'attributes':_0x45a5e6[_0xd19a('0x17')],'include':_0x45a5e6[_0xd19a('0x19')]?_[_0xd19a('0x1b')](_0x45a5e6[_0xd19a('0x19')],function(_0x34d59f){return{'model':db[_0x34d59f[_0xd19a('0x1a')]],'as':_0x34d59f['as'],'attributes':_0x34d59f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c5ccf){logger[_0xd19a('0x11')](_0xd19a('0x13'),_0x57dd53);logger['debug'](_0xd19a('0x13'),_0x57dd53,JSON['stringify'](_0x4c5ccf));_0x420b30(_0x4c5ccf);})[_0xd19a('0x12')](function(_0x12f06e){logger[_0xd19a('0xe')](_0xd19a('0x13'),_0x12f06e['message'],_0x57dd53);_0x6acd71(_0x444af5[_0xd19a('0xe')](0x1f4,_0x12f06e[_0xd19a('0x10')]));});});};exports[_0xd19a('0x1c')]=function(_0x28d4fa){var _0x4688e4=this;return new Promise(function(_0x16d986,_0x149e4a){return db[_0xd19a('0x1d')][_0xd19a('0x1e')]({'raw':_0x28d4fa[_0xd19a('0x15')]?_0x28d4fa[_0xd19a('0x15')][_0xd19a('0x16')]===undefined?!![]:![]:!![],'where':_0x28d4fa[_0xd19a('0x15')]?_0x28d4fa['options']['where']||null:null,'attributes':_0x28d4fa['options']?_0x28d4fa['options'][_0xd19a('0x17')]||null:null,'include':_0x28d4fa['options']?_0x28d4fa['options'][_0xd19a('0x19')]?_[_0xd19a('0x1b')](_0x28d4fa['options'][_0xd19a('0x19')],function(_0x15cba6){return{'model':db[_0x15cba6[_0xd19a('0x1a')]],'as':_0x15cba6['as'],'attributes':_0x15cba6[_0xd19a('0x17')],'include':_0x15cba6[_0xd19a('0x19')]?_['map'](_0x15cba6['include'],function(_0x2b6799){return{'model':db[_0x2b6799['model']],'as':_0x2b6799['as'],'attributes':_0x2b6799['attributes'],'include':_0x2b6799[_0xd19a('0x19')]?_['map'](_0x2b6799['include'],function(_0x66a3e1){return{'model':db[_0x66a3e1['model']],'as':_0x66a3e1['as'],'attributes':_0x66a3e1[_0xd19a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20e026){logger['info']('ShowSalesforceAccount',_0x28d4fa);logger[_0xd19a('0xd')](_0xd19a('0x1c'),_0x28d4fa,JSON[_0xd19a('0x1f')](_0x20e026));_0x16d986(_0x20e026);})['catch'](function(_0x305e1f){logger[_0xd19a('0xe')](_0xd19a('0x1c'),_0x305e1f[_0xd19a('0x10')],_0x28d4fa);_0x149e4a(_0x4688e4[_0xd19a('0xe')](0x1f4,_0x305e1f[_0xd19a('0x10')]));});});}; \ No newline at end of file +var _0xb419=['request\x20sent','debug','stringify','error','code','message','result','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s'];(function(_0xcfb466,_0x5c1223){var _0x23d5c5=function(_0x453adb){while(--_0x453adb){_0xcfb466['push'](_0xcfb466['shift']());}};_0x23d5c5(++_0x5c1223);}(_0xb419,0x1f3));var _0x9b41=function(_0x33d374,_0x2d30ed){_0x33d374=_0x33d374-0x0;var _0x256dbb=_0xb419[_0x33d374];return _0x256dbb;};'use strict';var _=require(_0x9b41('0x0'));var util=require(_0x9b41('0x1'));var moment=require(_0x9b41('0x2'));var BPromise=require(_0x9b41('0x3'));var rs=require(_0x9b41('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x9b41('0x5'));var logger=require(_0x9b41('0x6'))(_0x9b41('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b41('0x8'));var client=jayson[_0x9b41('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27a377,_0x48927a,_0x1c74ce){return new BPromise(function(_0x5e6b3c,_0x22b6cc){return client['request'](_0x27a377,_0x1c74ce)[_0x9b41('0xa')](function(_0xfba8d4){logger[_0x9b41('0xb')](_0x9b41('0xc'),_0x48927a,_0x9b41('0xd'));logger[_0x9b41('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x48927a,_0x9b41('0xd'),JSON[_0x9b41('0xf')](_0xfba8d4));if(_0xfba8d4['error']){if(_0xfba8d4[_0x9b41('0x10')][_0x9b41('0x11')]===0x1f4){logger[_0x9b41('0x10')](_0x9b41('0xc'),_0x48927a,_0xfba8d4[_0x9b41('0x10')][_0x9b41('0x12')]);return _0x22b6cc(_0xfba8d4[_0x9b41('0x10')][_0x9b41('0x12')]);}logger['error'](_0x9b41('0xc'),_0x48927a,_0xfba8d4['error'][_0x9b41('0x12')]);return _0x5e6b3c(_0xfba8d4[_0x9b41('0x10')][_0x9b41('0x12')]);}else{logger['info'](_0x9b41('0xc'),_0x48927a,'request\x20sent');_0x5e6b3c(_0xfba8d4[_0x9b41('0x13')]['message']);}})[_0x9b41('0x14')](function(_0x2892de){logger[_0x9b41('0x10')](_0x9b41('0xc'),_0x48927a,_0x2892de);_0x22b6cc(_0x2892de);});});}exports[_0x9b41('0x15')]=function(_0xda5c90){var _0x2d4a69=this;return new Promise(function(_0x672a69,_0x46bdf0){return db['SalesforceAccount']['findAll']({'raw':_0xda5c90[_0x9b41('0x16')]?_0xda5c90[_0x9b41('0x16')][_0x9b41('0x17')]===undefined?!![]:![]:!![],'where':_0xda5c90[_0x9b41('0x16')]?_0xda5c90[_0x9b41('0x16')][_0x9b41('0x18')]||null:null,'attributes':_0xda5c90[_0x9b41('0x16')]?_0xda5c90['options'][_0x9b41('0x19')]||null:null,'limit':_0xda5c90[_0x9b41('0x16')]?_0xda5c90['options'][_0x9b41('0x1a')]||null:null,'include':_0xda5c90['options']?_0xda5c90[_0x9b41('0x16')][_0x9b41('0x1b')]?_[_0x9b41('0x1c')](_0xda5c90[_0x9b41('0x16')][_0x9b41('0x1b')],function(_0x2ac637){return{'model':db[_0x2ac637[_0x9b41('0x1d')]],'as':_0x2ac637['as'],'attributes':_0x2ac637[_0x9b41('0x19')],'include':_0x2ac637[_0x9b41('0x1b')]?_[_0x9b41('0x1c')](_0x2ac637[_0x9b41('0x1b')],function(_0x447237){return{'model':db[_0x447237[_0x9b41('0x1d')]],'as':_0x447237['as'],'attributes':_0x447237[_0x9b41('0x19')],'include':_0x447237[_0x9b41('0x1b')]?_[_0x9b41('0x1c')](_0x447237[_0x9b41('0x1b')],function(_0x3981ef){return{'model':db[_0x3981ef[_0x9b41('0x1d')]],'as':_0x3981ef['as'],'attributes':_0x3981ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b41('0xa')](function(_0x2e0e9c){logger[_0x9b41('0xb')](_0x9b41('0x15'),_0xda5c90);logger[_0x9b41('0xe')]('GetSalesforceAccount',_0xda5c90,JSON[_0x9b41('0xf')](_0x2e0e9c));_0x672a69(_0x2e0e9c);})['catch'](function(_0x37d5d8){logger[_0x9b41('0x10')](_0x9b41('0x15'),_0x37d5d8['message'],_0xda5c90);_0x46bdf0(_0x2d4a69[_0x9b41('0x10')](0x1f4,_0x37d5d8[_0x9b41('0x12')]));});});};exports[_0x9b41('0x1e')]=function(_0x4f8ee3){var _0x2d0343=this;return new Promise(function(_0x22c520,_0x36bc6b){return db['SalesforceAccount'][_0x9b41('0x1f')]({'raw':_0x4f8ee3['options']?_0x4f8ee3[_0x9b41('0x16')][_0x9b41('0x17')]===undefined?!![]:![]:!![],'where':_0x4f8ee3[_0x9b41('0x16')]?_0x4f8ee3['options'][_0x9b41('0x18')]||null:null,'attributes':_0x4f8ee3['options']?_0x4f8ee3[_0x9b41('0x16')][_0x9b41('0x19')]||null:null,'include':_0x4f8ee3[_0x9b41('0x16')]?_0x4f8ee3[_0x9b41('0x16')][_0x9b41('0x1b')]?_[_0x9b41('0x1c')](_0x4f8ee3['options'][_0x9b41('0x1b')],function(_0x5550f0){return{'model':db[_0x5550f0[_0x9b41('0x1d')]],'as':_0x5550f0['as'],'attributes':_0x5550f0[_0x9b41('0x19')],'include':_0x5550f0[_0x9b41('0x1b')]?_[_0x9b41('0x1c')](_0x5550f0[_0x9b41('0x1b')],function(_0x2f0af8){return{'model':db[_0x2f0af8[_0x9b41('0x1d')]],'as':_0x2f0af8['as'],'attributes':_0x2f0af8[_0x9b41('0x19')],'include':_0x2f0af8['include']?_[_0x9b41('0x1c')](_0x2f0af8[_0x9b41('0x1b')],function(_0x2674ff){return{'model':db[_0x2674ff['model']],'as':_0x2674ff['as'],'attributes':_0x2674ff[_0x9b41('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x294253){logger['info'](_0x9b41('0x1e'),_0x4f8ee3);logger[_0x9b41('0xe')]('ShowSalesforceAccount',_0x4f8ee3,JSON[_0x9b41('0xf')](_0x294253));_0x22c520(_0x294253);})[_0x9b41('0x14')](function(_0x447e4c){logger[_0x9b41('0x10')](_0x9b41('0x1e'),_0x447e4c[_0x9b41('0x12')],_0x4f8ee3);_0x36bc6b(_0x2d0343[_0x9b41('0x10')](0x1f4,_0x447e4c[_0x9b41('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d40bca2..5659e60 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 _0x489d=['create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x2d94e3,_0x2ad351){var _0x20507c=function(_0x177546){while(--_0x177546){_0x2d94e3['push'](_0x2d94e3['shift']());}};_0x20507c(++_0x2ad351);}(_0x489d,0x127));var _0xd489=function(_0x2ab789,_0x50c088){_0x2ab789=_0x2ab789-0x0;var _0xe9bf33=_0x489d[_0x2ab789];return _0xe9bf33;};'use strict';var multer=require(_0xd489('0x0'));var util=require(_0xd489('0x1'));var path=require(_0xd489('0x2'));var express=require('express');var router=express[_0xd489('0x3')]();var auth=require(_0xd489('0x4'));var interaction=require(_0xd489('0x5'));var config=require(_0xd489('0x6'));var controller=require(_0xd489('0x7'));router[_0xd489('0x8')]('/',auth[_0xd489('0x9')](),controller[_0xd489('0xa')]);router[_0xd489('0x8')]('/:id',auth[_0xd489('0x9')](),controller['show']);router['get'](_0xd489('0xb'),auth[_0xd489('0x9')](),controller[_0xd489('0xc')]);router[_0xd489('0x8')](_0xd489('0xd'),auth[_0xd489('0x9')](),controller[_0xd489('0xe')]);router['get'](_0xd489('0xf'),auth[_0xd489('0x9')](),controller['getDescriptions']);router[_0xd489('0x10')]('/',auth['isAuthenticated'](),controller[_0xd489('0x11')]);router[_0xd489('0x12')](_0xd489('0x13'),auth[_0xd489('0x9')](),controller[_0xd489('0x14')]);router[_0xd489('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xd489('0x16')]);module[_0xd489('0x17')]=router; \ No newline at end of file +var _0x5236=['exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','delete','destroy'];(function(_0x29dc54,_0x2cc32e){var _0xaabea6=function(_0x172357){while(--_0x172357){_0x29dc54['push'](_0x29dc54['shift']());}};_0xaabea6(++_0x2cc32e);}(_0x5236,0x109));var _0x6523=function(_0x2ad11c,_0x1f6546){_0x2ad11c=_0x2ad11c-0x0;var _0x3c6c4c=_0x5236[_0x2ad11c];return _0x3c6c4c;};'use strict';var multer=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var path=require(_0x6523('0x2'));var express=require(_0x6523('0x3'));var router=express[_0x6523('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6523('0x5'));var config=require(_0x6523('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x6523('0x7')]('/',auth[_0x6523('0x8')](),controller[_0x6523('0x9')]);router[_0x6523('0x7')](_0x6523('0xa'),auth['isAuthenticated'](),controller[_0x6523('0xb')]);router[_0x6523('0x7')](_0x6523('0xc'),auth['isAuthenticated'](),controller[_0x6523('0xd')]);router[_0x6523('0x7')](_0x6523('0xe'),auth[_0x6523('0x8')](),controller[_0x6523('0xf')]);router[_0x6523('0x7')]('/:id/descriptions',auth[_0x6523('0x8')](),controller[_0x6523('0x10')]);router[_0x6523('0x11')]('/',auth[_0x6523('0x8')](),controller[_0x6523('0x12')]);router['put'](_0x6523('0xa'),auth[_0x6523('0x8')](),controller['update']);router[_0x6523('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6523('0x14')]);module[_0x6523('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f22faec..e072d41 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 _0x0c47=['lead','nothing','sequelize','STRING','ENUM','contact_lead','contact'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x0c47,0x14b));var _0x70c4=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x0c47[_0x3358ba];return _0x296e73;};'use strict';var Sequelize=require(_0x70c4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x70c4('0x1')]},'moduleSearch':{'type':Sequelize[_0x70c4('0x2')](_0x70c4('0x3'),_0x70c4('0x4'),_0x70c4('0x5')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x70c4('0x2')](_0x70c4('0x6'),_0x70c4('0x4'),_0x70c4('0x5')),'defaultValue':_0x70c4('0x5')}}; \ No newline at end of file +var _0x4e2e=['contact_lead','contact','lead','nothing','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e2e,0x193));var _0xe4e2=function(_0xf483b4,_0x2739b3){_0xf483b4=_0xf483b4-0x0;var _0xbf1f26=_0x4e2e[_0xf483b4];return _0xbf1f26;};'use strict';var Sequelize=require(_0xe4e2('0x0'));module[_0xe4e2('0x1')]={'name':{'type':Sequelize[_0xe4e2('0x2')]},'description':{'type':Sequelize[_0xe4e2('0x2')]},'moduleSearch':{'type':Sequelize['ENUM'](_0xe4e2('0x3'),_0xe4e2('0x4'),_0xe4e2('0x5')),'defaultValue':_0xe4e2('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0xe4e2('0x6'),_0xe4e2('0x4'),_0xe4e2('0x5')),'defaultValue':_0xe4e2('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 10b014e..011a8fe 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 _0xa9e0=['limit','status','Content-Range','apply','reject','save','update','sendStatus','name','send','index','SalesforceConfiguration','rawAttributes','model','dateStart','query','dateEnd','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','add','day','merge','filter','map','options','count','includeAll','rows','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','pick','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','json','offset'];(function(_0x4b6a4b,_0x271355){var _0xe002d1=function(_0x18882c){while(--_0x18882c){_0x4b6a4b['push'](_0x4b6a4b['shift']());}};_0xe002d1(++_0x271355);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];var jayson=require(_0x0a9e('0xf'));var client=jayson[_0x0a9e('0x10')][_0x0a9e('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4a4c56,_0x50dfb2,_0x527cdd,_0x4cfe67){return new BPromise(function(_0x273d4d,_0x36471c){var _0xd5b662=_0x4cfe67||client;return _0xd5b662[_0x0a9e('0x12')](_0x4a4c56,_0x527cdd)[_0x0a9e('0x13')](function(_0x69aeb7){logger['info'](_0x0a9e('0x14'),_0x50dfb2,_0x0a9e('0x15'));logger[_0x0a9e('0x16')](_0x0a9e('0x17'),_0x50dfb2,_0x0a9e('0x15'),JSON[_0x0a9e('0x18')](_0x69aeb7));if(_0x69aeb7['error']){if(_0x69aeb7[_0x0a9e('0x19')]['code']===0x1f4){logger[_0x0a9e('0x19')]('SalesforceConfiguration,\x20%s,\x20%s',_0x50dfb2,_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x36471c(_0x69aeb7['error'][_0x0a9e('0x1a')]);}logger['error'](_0x0a9e('0x14'),_0x50dfb2,_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x273d4d(_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}else{logger[_0x0a9e('0x1b')](_0x0a9e('0x14'),_0x50dfb2,_0x0a9e('0x15'));_0x273d4d(_0x69aeb7[_0x0a9e('0x1c')][_0x0a9e('0x1a')]);}})[_0x0a9e('0x1d')](function(_0x105080){logger['error'](_0x0a9e('0x14'),_0x50dfb2,_0x105080);_0x36471c(_0x105080);});});}function respondWithStatusCode(_0x155cce,_0x53682f){_0x53682f=_0x53682f||0xcc;return function(_0x20f109){if(_0x20f109){return _0x155cce['sendStatus'](_0x53682f);}return _0x155cce['status'](_0x53682f)[_0x0a9e('0x1e')]();};}function respondWithResult(_0x432e56,_0x38e7c4){_0x38e7c4=_0x38e7c4||0xc8;return function(_0x30bae6){if(_0x30bae6){return _0x432e56['status'](_0x38e7c4)[_0x0a9e('0x1f')](_0x30bae6);}};}function respondWithFilteredResult(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){var _0x370d86=_0x4d00e6['count'],_0x42ac8f=_0x3b45bc[_0x0a9e('0x20')],_0x16b1ca=_0x3b45bc[_0x0a9e('0x20')]+_0x3b45bc[_0x0a9e('0x21')],_0x5ea472;if(_0x16b1ca>=_0x370d86){_0x16b1ca=_0x370d86;_0x5ea472=0xc8;}else{_0x5ea472=0xce;}_0x2fb0e4[_0x0a9e('0x22')](_0x5ea472);return _0x2fb0e4['set'](_0x0a9e('0x23'),_0x42ac8f+'-'+_0x16b1ca+'/'+_0x370d86)['json'](_0x4d00e6);}return null;};}function patchUpdates(_0x45a1e7){return function(_0x5bfb33){try{jsonpatch[_0x0a9e('0x24')](_0x5bfb33,_0x45a1e7,!![]);}catch(_0x34dc65){return BPromise[_0x0a9e('0x25')](_0x34dc65);}return _0x5bfb33[_0x0a9e('0x26')]();};}function saveUpdates(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){return _0x11c3b6[_0x0a9e('0x27')](_0x140511)['then'](function(_0x3652a7){return _0x3652a7;});}return null;};}function removeEntity(_0x468813,_0x2b1f27){return function(_0x2ec755){if(_0x2ec755){return _0x2ec755['destroy']()[_0x0a9e('0x13')](function(){_0x468813[_0x0a9e('0x22')](0xcc)[_0x0a9e('0x1e')]();});}};}function handleEntityNotFound(_0x824a4f,_0x58b06f){return function(_0x563b45){if(!_0x563b45){_0x824a4f[_0x0a9e('0x28')](0x194);}return _0x563b45;};}function handleError(_0x2e8759,_0x1dbde2){_0x1dbde2=_0x1dbde2||0x1f4;return function(_0x540530){logger[_0x0a9e('0x19')](_0x540530['stack']);if(_0x540530[_0x0a9e('0x29')]){delete _0x540530[_0x0a9e('0x29')];}_0x2e8759[_0x0a9e('0x22')](_0x1dbde2)[_0x0a9e('0x2a')](_0x540530);};}exports[_0x0a9e('0x2b')]=function(_0x5180f1,_0x66c1d2){var _0x46f0a5={},_0x40cb85={},_0x2da5c0={'count':0x0,'rows':[]};var _0x2b45ea=db[_0x0a9e('0x2c')][_0x0a9e('0x2d')];_0x40cb85[_0x0a9e('0x2e')]=_['keys'](_0x2b45ea);var _0x44295a={'dateStart':_0x5180f1['query'][_0x0a9e('0x2f')],'dateEnd':_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x31')]};delete _0x5180f1[_0x0a9e('0x30')]['dateStart'];delete _0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x31')];_0x40cb85[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x5180f1['query']);_0x40cb85['filters']=_[_0x0a9e('0x33')](_0x40cb85['model'],_0x40cb85[_0x0a9e('0x30')]);_0x46f0a5[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x40cb85[_0x0a9e('0x2e')],qs['fields'](_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x46f0a5[_0x0a9e('0x34')]=_0x46f0a5['attributes'][_0x0a9e('0x36')]?_0x46f0a5[_0x0a9e('0x34')]:_0x40cb85[_0x0a9e('0x2e')];if(!_0x5180f1['query']['hasOwnProperty'](_0x0a9e('0x37'))){_0x46f0a5[_0x0a9e('0x21')]=qs['limit'](_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0x46f0a5[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5180f1['query']['offset']);}_0x46f0a5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5180f1['query'][_0x0a9e('0x39')]);_0x46f0a5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x5180f1[_0x0a9e('0x30')],_0x40cb85[_0x0a9e('0x3b')]));if(_0x44295a[_0x0a9e('0x2f')]){if(_0x44295a[_0x0a9e('0x31')]){_0x44295a[_0x0a9e('0x31')]=moment(_0x44295a[_0x0a9e('0x31')])[_0x0a9e('0x3c')](0x1,_0x0a9e('0x3d'));}else{_0x44295a[_0x0a9e('0x31')]=moment(_0x44295a[_0x0a9e('0x2f')])[_0x0a9e('0x3c')](0x1,_0x0a9e('0x3d'));}_[_0x0a9e('0x3e')](_0x46f0a5[_0x0a9e('0x3a')],{'createdAt':{'$gte':_0x44295a[_0x0a9e('0x2f')],'$lte':_0x44295a['dateEnd']}});}if(_0x5180f1['query'][_0x0a9e('0x3f')]){_0x46f0a5[_0x0a9e('0x3a')]=_[_0x0a9e('0x3e')](_0x46f0a5[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x46f0a5[_0x0a9e('0x34')],function(_0x10b040){var _0x445e25={};_0x445e25[_0x10b040]={'$like':'%'+_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0x445e25;})});}_0x46f0a5=_[_0x0a9e('0x3e')]({},_0x46f0a5,_0x5180f1[_0x0a9e('0x41')]);var _0x5026aa={'where':_0x46f0a5[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x42')](_0x5026aa)[_0x0a9e('0x13')](function(_0x2e8caf){_0x2da5c0[_0x0a9e('0x42')]=_0x2e8caf;if(_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x43')]){_0x46f0a5['include']=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x46f0a5);})[_0x0a9e('0x13')](function(_0x476688){_0x2da5c0[_0x0a9e('0x44')]=_0x476688;return _0x2da5c0;})['then'](respondWithFilteredResult(_0x66c1d2,_0x46f0a5))[_0x0a9e('0x1d')](handleError(_0x66c1d2,null));};exports[_0x0a9e('0x45')]=function(_0x4774f4,_0x34aa5a){var _0x45c845={'raw':![],'where':{'id':_0x4774f4[_0x0a9e('0x46')]['id']}},_0x37be73={};_0x37be73['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x37be73[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x4774f4[_0x0a9e('0x30')]);_0x37be73[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x37be73[_0x0a9e('0x2e')],_0x37be73['query']);_0x45c845[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x37be73['model'],qs['fields'](_0x4774f4['query'][_0x0a9e('0x35')]));_0x45c845[_0x0a9e('0x34')]=_0x45c845[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x45c845[_0x0a9e('0x34')]:_0x37be73[_0x0a9e('0x2e')];if(_0x4774f4[_0x0a9e('0x30')][_0x0a9e('0x43')]){_0x45c845['include']=[{'all':!![]}];}_0x45c845=_['merge']({},_0x45c845,_0x4774f4['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x47')](_0x45c845)[_0x0a9e('0x13')](handleEntityNotFound(_0x34aa5a,null))['then'](respondWithResult(_0x34aa5a,null))[_0x0a9e('0x1d')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x48')]=function(_0x53d113,_0x5a88da){return db[_0x0a9e('0x2c')]['create'](_0x53d113[_0x0a9e('0x49')],{})['then'](respondWithResult(_0x5a88da,0xc9))[_0x0a9e('0x1d')](handleError(_0x5a88da,null));};exports[_0x0a9e('0x27')]=function(_0x439340,_0x53613a){if(_0x439340[_0x0a9e('0x49')]['id']){delete _0x439340[_0x0a9e('0x49')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x439340[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x53613a,null))['then'](saveUpdates(_0x439340[_0x0a9e('0x49')],null))['then'](respondWithResult(_0x53613a,null))[_0x0a9e('0x1d')](handleError(_0x53613a,null));};exports['destroy']=function(_0xe22ccc,_0x4a6deb){return db['SalesforceConfiguration']['find']({'where':{'id':_0xe22ccc[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a6deb,null))[_0x0a9e('0x13')](removeEntity(_0x4a6deb,null))[_0x0a9e('0x1d')](handleError(_0x4a6deb,null));};exports[_0x0a9e('0x4a')]=function(_0x19b4df,_0x232830,_0x272738){var _0xd10662={};var _0x28d814={};var _0x4e67ab;var _0x1c693e;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x19b4df[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x13')](function(_0x5d86e9){if(_0x5d86e9){_0x4e67ab=_0x5d86e9;_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x32')](db['SalesforceField'][_0x0a9e('0x2d')]);_0x28d814['query']=_[_0x0a9e('0x32')](_0x19b4df['query']);_0x28d814['filters']=_['intersection'](_0x28d814[_0x0a9e('0x2e')],_0x28d814['query']);_0xd10662[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x28d814[_0x0a9e('0x2e')],qs[_0x0a9e('0x35')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0xd10662['attributes']=_0xd10662[_0x0a9e('0x34')]['length']?_0xd10662[_0x0a9e('0x34')]:_0x28d814[_0x0a9e('0x2e')];_0xd10662[_0x0a9e('0x38')]=qs['sort'](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0xd10662[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x19b4df[_0x0a9e('0x30')],_0x28d814[_0x0a9e('0x3b')]));if(_0x19b4df['query'][_0x0a9e('0x3f')]){_0xd10662[_0x0a9e('0x3a')]=_[_0x0a9e('0x3e')](_0xd10662[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0xd10662['attributes'],function(_0x176840){var _0x2937e0={};_0x2937e0[_0x176840]={'$like':'%'+_0x19b4df[_0x0a9e('0x30')]['filter']+'%'};return _0x2937e0;})});}_0xd10662=_[_0x0a9e('0x3e')]({},_0xd10662,_0x19b4df['options']);return _0x4e67ab['getFields'](_0xd10662);}})[_0x0a9e('0x13')](function(_0x4556c5){if(_0x4556c5){_0x1c693e=_0x4556c5[_0x0a9e('0x36')];if(!_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0xd10662[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0xd10662[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x20')]);}return _0x4e67ab[_0x0a9e('0x4a')](_0xd10662);}})[_0x0a9e('0x13')](function(_0x2a28c0){if(_0x2a28c0){return _0x2a28c0?{'count':_0x1c693e,'rows':_0x2a28c0}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x4d')]=function(_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={};var _0x4b341d;var _0x83f0b2;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x295763[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x243d12,null))['then'](function(_0x50cdce){if(_0x50cdce){_0x4b341d=_0x50cdce;_0x30944e['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x30944e[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x295763[_0x0a9e('0x30')]);_0x30944e[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x30944e['model'],_0x30944e[_0x0a9e('0x30')]);_0x1148a1[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x30944e['model'],qs[_0x0a9e('0x35')](_0x295763['query'][_0x0a9e('0x35')]));_0x1148a1[_0x0a9e('0x34')]=_0x1148a1['attributes'][_0x0a9e('0x36')]?_0x1148a1[_0x0a9e('0x34')]:_0x30944e[_0x0a9e('0x2e')];_0x1148a1[_0x0a9e('0x38')]=qs['sort'](_0x295763[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x1148a1[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x295763[_0x0a9e('0x30')],_0x30944e[_0x0a9e('0x3b')]));if(_0x295763[_0x0a9e('0x30')][_0x0a9e('0x3f')]){_0x1148a1['where']=_[_0x0a9e('0x3e')](_0x1148a1[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x1148a1[_0x0a9e('0x34')],function(_0x332367){var _0xdb98ca={};_0xdb98ca[_0x332367]={'$like':'%'+_0x295763[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0xdb98ca;})});}_0x1148a1=_[_0x0a9e('0x3e')]({},_0x1148a1,_0x295763[_0x0a9e('0x41')]);return _0x4b341d[_0x0a9e('0x4d')](_0x1148a1);}})[_0x0a9e('0x13')](function(_0x25744a){if(_0x25744a){_0x83f0b2=_0x25744a[_0x0a9e('0x36')];if(!_0x295763['query'][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0x1148a1[_0x0a9e('0x21')]=qs['limit'](_0x295763[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0x1148a1[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x295763['query']['offset']);}return _0x4b341d[_0x0a9e('0x4d')](_0x1148a1);}})[_0x0a9e('0x13')](function(_0x4c54fa){if(_0x4c54fa){return _0x4c54fa?{'count':_0x83f0b2,'rows':_0x4c54fa}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x243d12,null))['catch'](handleError(_0x243d12,null));};exports[_0x0a9e('0x4f')]=function(_0x8ebf02,_0x5637a1,_0x28a942){var _0x41cf12={};var _0x2d2286={};var _0x42b959;var _0x3755fe;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x8ebf02['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x5637a1,null))[_0x0a9e('0x13')](function(_0x45c109){if(_0x45c109){_0x42b959=_0x45c109;_0x2d2286[_0x0a9e('0x2e')]=_['keys'](db[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x2d2286['query']=_[_0x0a9e('0x32')](_0x8ebf02['query']);_0x2d2286[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x2d2286[_0x0a9e('0x2e')],_0x2d2286[_0x0a9e('0x30')]);_0x41cf12['attributes']=_['intersection'](_0x2d2286[_0x0a9e('0x2e')],qs[_0x0a9e('0x35')](_0x8ebf02[_0x0a9e('0x30')]['fields']));_0x41cf12[_0x0a9e('0x34')]=_0x41cf12[_0x0a9e('0x34')]['length']?_0x41cf12['attributes']:_0x2d2286[_0x0a9e('0x2e')];_0x41cf12['order']=qs['sort'](_0x8ebf02['query'][_0x0a9e('0x39')]);_0x41cf12[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x50')](_0x8ebf02[_0x0a9e('0x30')],_0x2d2286[_0x0a9e('0x3b')]));if(_0x8ebf02['query'][_0x0a9e('0x3f')]){_0x41cf12['where']=_[_0x0a9e('0x3e')](_0x41cf12[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x41cf12[_0x0a9e('0x34')],function(_0x50f8d7){var _0x46c9ac={};_0x46c9ac[_0x50f8d7]={'$like':'%'+_0x8ebf02[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0x46c9ac;})});}_0x41cf12=_['merge']({},_0x41cf12,_0x8ebf02[_0x0a9e('0x41')]);return _0x42b959[_0x0a9e('0x4f')](_0x41cf12);}})[_0x0a9e('0x13')](function(_0x22063c){if(_0x22063c){_0x3755fe=_0x22063c[_0x0a9e('0x36')];if(!_0x8ebf02[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0x41cf12['limit']=qs[_0x0a9e('0x21')](_0x8ebf02[_0x0a9e('0x30')]['limit']);_0x41cf12[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x8ebf02[_0x0a9e('0x30')]['offset']);}return _0x42b959[_0x0a9e('0x4f')](_0x41cf12);}})['then'](function(_0x8c8fbe){if(_0x8c8fbe){return _0x8c8fbe?{'count':_0x3755fe,'rows':_0x8c8fbe}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x5637a1,null))[_0x0a9e('0x1d')](handleError(_0x5637a1,null));}; \ No newline at end of file +var _0x9957=['request\x20sent','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','stack','name','SalesforceConfiguration','rawAttributes','model','query','dateEnd','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','dateStart','add','day','merge','where','filter','options','includeAll','include','findAll','rows','show','params','filters','find','create','body','catch','getFields','SalesforceField','length','map','getSubjects','findOne','order','getDescriptions','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var jsonpatch=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var Mustache=require('mustache');var util=require(_0x7995('0x4'));var path=require(_0x7995('0x5'));var sox=require(_0x7995('0x6'));var csv=require(_0x7995('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7995('0x8'));var squel=require(_0x7995('0x9'));var crypto=require(_0x7995('0xa'));var jsforce=require(_0x7995('0xb'));var deskjs=require(_0x7995('0xc'));var toCsv=require(_0x7995('0x7'));var querystring=require('querystring');var Papa=require(_0x7995('0xd'));var qs=require(_0x7995('0xe'));var logger=require('../../config/logger')(_0x7995('0xf'));var utils=require(_0x7995('0x10'));var config=require(_0x7995('0x11'));var db=require(_0x7995('0x12'))['db'];var jayson=require(_0x7995('0x13'));var client=jayson[_0x7995('0x14')][_0x7995('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x524f7b,_0x245143,_0x41c652,_0x581f22){return new BPromise(function(_0xb0c872,_0x2cb37a){var _0x19a27e=_0x581f22||client;return _0x19a27e[_0x7995('0x16')](_0x524f7b,_0x41c652)[_0x7995('0x17')](function(_0x23999f){logger[_0x7995('0x18')]('SalesforceConfiguration,\x20%s,\x20%s',_0x245143,'request\x20sent');logger[_0x7995('0x19')](_0x7995('0x1a'),_0x245143,_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x23999f));if(_0x23999f[_0x7995('0x1d')]){if(_0x23999f[_0x7995('0x1d')][_0x7995('0x1e')]===0x1f4){logger[_0x7995('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x245143,_0x23999f[_0x7995('0x1d')]['message']);return _0x2cb37a(_0x23999f[_0x7995('0x1d')][_0x7995('0x1f')]);}logger[_0x7995('0x1d')](_0x7995('0x20'),_0x245143,_0x23999f[_0x7995('0x1d')][_0x7995('0x1f')]);return _0xb0c872(_0x23999f['error']['message']);}else{logger[_0x7995('0x18')]('SalesforceConfiguration,\x20%s,\x20%s',_0x245143,'request\x20sent');_0xb0c872(_0x23999f[_0x7995('0x21')][_0x7995('0x1f')]);}})['catch'](function(_0x3a9b54){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x245143,_0x3a9b54);_0x2cb37a(_0x3a9b54);});});}function respondWithStatusCode(_0x3e4c54,_0x327b1f){_0x327b1f=_0x327b1f||0xcc;return function(_0x350fd9){if(_0x350fd9){return _0x3e4c54[_0x7995('0x22')](_0x327b1f);}return _0x3e4c54[_0x7995('0x23')](_0x327b1f)[_0x7995('0x24')]();};}function respondWithResult(_0x5d40ae,_0x32a09a){_0x32a09a=_0x32a09a||0xc8;return function(_0x46ee4b){if(_0x46ee4b){return _0x5d40ae[_0x7995('0x23')](_0x32a09a)[_0x7995('0x25')](_0x46ee4b);}};}function respondWithFilteredResult(_0x563799,_0x13bc35){return function(_0x475351){if(_0x475351){var _0x472195=_0x475351[_0x7995('0x26')],_0x59405a=_0x13bc35[_0x7995('0x27')],_0x39df42=_0x13bc35[_0x7995('0x27')]+_0x13bc35[_0x7995('0x28')],_0x34e70c;if(_0x39df42>=_0x472195){_0x39df42=_0x472195;_0x34e70c=0xc8;}else{_0x34e70c=0xce;}_0x563799['status'](_0x34e70c);return _0x563799[_0x7995('0x29')]('Content-Range',_0x59405a+'-'+_0x39df42+'/'+_0x472195)[_0x7995('0x25')](_0x475351);}return null;};}function patchUpdates(_0x49bc7e){return function(_0xf16cc2){try{jsonpatch[_0x7995('0x2a')](_0xf16cc2,_0x49bc7e,!![]);}catch(_0x11c1eb){return BPromise['reject'](_0x11c1eb);}return _0xf16cc2[_0x7995('0x2b')]();};}function saveUpdates(_0x514445,_0x456a28){return function(_0x3250e0){if(_0x3250e0){return _0x3250e0[_0x7995('0x2c')](_0x514445)['then'](function(_0x530611){return _0x530611;});}return null;};}function removeEntity(_0x48e573,_0x3573be){return function(_0xe6b0b3){if(_0xe6b0b3){return _0xe6b0b3[_0x7995('0x2d')]()[_0x7995('0x17')](function(){_0x48e573[_0x7995('0x23')](0xcc)[_0x7995('0x24')]();});}};}function handleEntityNotFound(_0x538841,_0x481c74){return function(_0xfa8f15){if(!_0xfa8f15){_0x538841['sendStatus'](0x194);}return _0xfa8f15;};}function handleError(_0x553671,_0x3eb566){_0x3eb566=_0x3eb566||0x1f4;return function(_0x29fac5){logger[_0x7995('0x1d')](_0x29fac5[_0x7995('0x2e')]);if(_0x29fac5['name']){delete _0x29fac5[_0x7995('0x2f')];}_0x553671[_0x7995('0x23')](_0x3eb566)['send'](_0x29fac5);};}exports['index']=function(_0x577412,_0x45bc5e){var _0x3acfc3={},_0x4a176f={},_0x3e7020={'count':0x0,'rows':[]};var _0x51b95d=db[_0x7995('0x30')][_0x7995('0x31')];_0x4a176f[_0x7995('0x32')]=_['keys'](_0x51b95d);var _0x52d76d={'dateStart':_0x577412[_0x7995('0x33')]['dateStart'],'dateEnd':_0x577412['query'][_0x7995('0x34')]};delete _0x577412[_0x7995('0x33')]['dateStart'];delete _0x577412[_0x7995('0x33')][_0x7995('0x34')];_0x4a176f[_0x7995('0x33')]=_[_0x7995('0x35')](_0x577412[_0x7995('0x33')]);_0x4a176f['filters']=_[_0x7995('0x36')](_0x4a176f[_0x7995('0x32')],_0x4a176f[_0x7995('0x33')]);_0x3acfc3[_0x7995('0x37')]=_['intersection'](_0x4a176f[_0x7995('0x32')],qs[_0x7995('0x38')](_0x577412[_0x7995('0x33')][_0x7995('0x38')]));_0x3acfc3[_0x7995('0x37')]=_0x3acfc3[_0x7995('0x37')]['length']?_0x3acfc3[_0x7995('0x37')]:_0x4a176f[_0x7995('0x32')];if(!_0x577412[_0x7995('0x33')][_0x7995('0x39')](_0x7995('0x3a'))){_0x3acfc3[_0x7995('0x28')]=qs[_0x7995('0x28')](_0x577412[_0x7995('0x33')][_0x7995('0x28')]);_0x3acfc3[_0x7995('0x27')]=qs[_0x7995('0x27')](_0x577412[_0x7995('0x33')][_0x7995('0x27')]);}_0x3acfc3['order']=qs['sort'](_0x577412[_0x7995('0x33')][_0x7995('0x3b')]);_0x3acfc3['where']=qs['filters'](_[_0x7995('0x3c')](_0x577412['query'],_0x4a176f['filters']));if(_0x52d76d[_0x7995('0x3d')]){if(_0x52d76d[_0x7995('0x34')]){_0x52d76d[_0x7995('0x34')]=moment(_0x52d76d['dateEnd'])[_0x7995('0x3e')](0x1,'day');}else{_0x52d76d[_0x7995('0x34')]=moment(_0x52d76d['dateStart'])['add'](0x1,_0x7995('0x3f'));}_[_0x7995('0x40')](_0x3acfc3[_0x7995('0x41')],{'createdAt':{'$gte':_0x52d76d[_0x7995('0x3d')],'$lte':_0x52d76d['dateEnd']}});}if(_0x577412[_0x7995('0x33')][_0x7995('0x42')]){_0x3acfc3[_0x7995('0x41')]=_[_0x7995('0x40')](_0x3acfc3['where'],{'$or':_['map'](_0x3acfc3[_0x7995('0x37')],function(_0x55791b){var _0x23c41d={};_0x23c41d[_0x55791b]={'$like':'%'+_0x577412['query'][_0x7995('0x42')]+'%'};return _0x23c41d;})});}_0x3acfc3=_['merge']({},_0x3acfc3,_0x577412[_0x7995('0x43')]);var _0x1b0373={'where':_0x3acfc3['where']};return db[_0x7995('0x30')][_0x7995('0x26')](_0x1b0373)[_0x7995('0x17')](function(_0xb70a51){_0x3e7020['count']=_0xb70a51;if(_0x577412[_0x7995('0x33')][_0x7995('0x44')]){_0x3acfc3[_0x7995('0x45')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7995('0x46')](_0x3acfc3);})[_0x7995('0x17')](function(_0x511567){_0x3e7020[_0x7995('0x47')]=_0x511567;return _0x3e7020;})[_0x7995('0x17')](respondWithFilteredResult(_0x45bc5e,_0x3acfc3))['catch'](handleError(_0x45bc5e,null));};exports[_0x7995('0x48')]=function(_0xfb72b2,_0x5921b9){var _0x3d1dbb={'raw':![],'where':{'id':_0xfb72b2[_0x7995('0x49')]['id']}},_0x5843ba={};_0x5843ba[_0x7995('0x32')]=_[_0x7995('0x35')](db[_0x7995('0x30')][_0x7995('0x31')]);_0x5843ba[_0x7995('0x33')]=_[_0x7995('0x35')](_0xfb72b2['query']);_0x5843ba[_0x7995('0x4a')]=_[_0x7995('0x36')](_0x5843ba[_0x7995('0x32')],_0x5843ba['query']);_0x3d1dbb[_0x7995('0x37')]=_[_0x7995('0x36')](_0x5843ba[_0x7995('0x32')],qs['fields'](_0xfb72b2['query']['fields']));_0x3d1dbb[_0x7995('0x37')]=_0x3d1dbb[_0x7995('0x37')]['length']?_0x3d1dbb[_0x7995('0x37')]:_0x5843ba[_0x7995('0x32')];if(_0xfb72b2[_0x7995('0x33')][_0x7995('0x44')]){_0x3d1dbb[_0x7995('0x45')]=[{'all':!![]}];}_0x3d1dbb=_['merge']({},_0x3d1dbb,_0xfb72b2[_0x7995('0x43')]);return db['SalesforceConfiguration'][_0x7995('0x4b')](_0x3d1dbb)[_0x7995('0x17')](handleEntityNotFound(_0x5921b9,null))[_0x7995('0x17')](respondWithResult(_0x5921b9,null))['catch'](handleError(_0x5921b9,null));};exports['create']=function(_0x54e2b1,_0x563f8e){return db[_0x7995('0x30')][_0x7995('0x4c')](_0x54e2b1[_0x7995('0x4d')],{})[_0x7995('0x17')](respondWithResult(_0x563f8e,0xc9))[_0x7995('0x4e')](handleError(_0x563f8e,null));};exports[_0x7995('0x2c')]=function(_0x1f4270,_0xda6ce8){if(_0x1f4270[_0x7995('0x4d')]['id']){delete _0x1f4270[_0x7995('0x4d')]['id'];}return db[_0x7995('0x30')][_0x7995('0x4b')]({'where':{'id':_0x1f4270[_0x7995('0x49')]['id']}})[_0x7995('0x17')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x17')](saveUpdates(_0x1f4270[_0x7995('0x4d')],null))[_0x7995('0x17')](respondWithResult(_0xda6ce8,null))[_0x7995('0x4e')](handleError(_0xda6ce8,null));};exports[_0x7995('0x2d')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x30')][_0x7995('0x4b')]({'where':{'id':_0x50b7c2[_0x7995('0x49')]['id']}})['then'](handleEntityNotFound(_0x56a374,null))['then'](removeEntity(_0x56a374,null))[_0x7995('0x4e')](handleError(_0x56a374,null));};exports[_0x7995('0x4f')]=function(_0x5b9467,_0x332a85,_0x51c50b){var _0x13cd7b={};var _0x74ff38={};var _0xef5044;var _0x33c49c;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x5b9467[_0x7995('0x49')]['id']}})[_0x7995('0x17')](handleEntityNotFound(_0x332a85,null))[_0x7995('0x17')](function(_0x1d69ce){if(_0x1d69ce){_0xef5044=_0x1d69ce;_0x74ff38[_0x7995('0x32')]=_[_0x7995('0x35')](db[_0x7995('0x50')][_0x7995('0x31')]);_0x74ff38[_0x7995('0x33')]=_['keys'](_0x5b9467[_0x7995('0x33')]);_0x74ff38[_0x7995('0x4a')]=_[_0x7995('0x36')](_0x74ff38[_0x7995('0x32')],_0x74ff38['query']);_0x13cd7b['attributes']=_[_0x7995('0x36')](_0x74ff38[_0x7995('0x32')],qs['fields'](_0x5b9467[_0x7995('0x33')][_0x7995('0x38')]));_0x13cd7b[_0x7995('0x37')]=_0x13cd7b[_0x7995('0x37')][_0x7995('0x51')]?_0x13cd7b['attributes']:_0x74ff38[_0x7995('0x32')];_0x13cd7b['order']=qs[_0x7995('0x3b')](_0x5b9467[_0x7995('0x33')][_0x7995('0x3b')]);_0x13cd7b[_0x7995('0x41')]=qs[_0x7995('0x4a')](_[_0x7995('0x3c')](_0x5b9467[_0x7995('0x33')],_0x74ff38[_0x7995('0x4a')]));if(_0x5b9467[_0x7995('0x33')][_0x7995('0x42')]){_0x13cd7b[_0x7995('0x41')]=_[_0x7995('0x40')](_0x13cd7b['where'],{'$or':_[_0x7995('0x52')](_0x13cd7b[_0x7995('0x37')],function(_0x293480){var _0xc2b660={};_0xc2b660[_0x293480]={'$like':'%'+_0x5b9467[_0x7995('0x33')]['filter']+'%'};return _0xc2b660;})});}_0x13cd7b=_['merge']({},_0x13cd7b,_0x5b9467[_0x7995('0x43')]);return _0xef5044[_0x7995('0x4f')](_0x13cd7b);}})[_0x7995('0x17')](function(_0xae6166){if(_0xae6166){_0x33c49c=_0xae6166['length'];if(!_0x5b9467[_0x7995('0x33')]['hasOwnProperty']('nolimit')){_0x13cd7b[_0x7995('0x28')]=qs[_0x7995('0x28')](_0x5b9467[_0x7995('0x33')][_0x7995('0x28')]);_0x13cd7b[_0x7995('0x27')]=qs[_0x7995('0x27')](_0x5b9467[_0x7995('0x33')][_0x7995('0x27')]);}return _0xef5044[_0x7995('0x4f')](_0x13cd7b);}})[_0x7995('0x17')](function(_0x560b0a){if(_0x560b0a){return _0x560b0a?{'count':_0x33c49c,'rows':_0x560b0a}:null;}})[_0x7995('0x17')](respondWithResult(_0x332a85,null))[_0x7995('0x4e')](handleError(_0x332a85,null));};exports[_0x7995('0x53')]=function(_0x4cc247,_0x1fe1cb,_0x1d2f9d){var _0x705f0={};var _0x3a7d9d={};var _0x3b0d30;var _0x51ab1e;return db[_0x7995('0x30')][_0x7995('0x54')]({'where':{'id':_0x4cc247[_0x7995('0x49')]['id']}})[_0x7995('0x17')](handleEntityNotFound(_0x1fe1cb,null))[_0x7995('0x17')](function(_0x535131){if(_0x535131){_0x3b0d30=_0x535131;_0x3a7d9d['model']=_[_0x7995('0x35')](db[_0x7995('0x50')][_0x7995('0x31')]);_0x3a7d9d[_0x7995('0x33')]=_['keys'](_0x4cc247[_0x7995('0x33')]);_0x3a7d9d[_0x7995('0x4a')]=_['intersection'](_0x3a7d9d['model'],_0x3a7d9d[_0x7995('0x33')]);_0x705f0[_0x7995('0x37')]=_['intersection'](_0x3a7d9d[_0x7995('0x32')],qs['fields'](_0x4cc247[_0x7995('0x33')][_0x7995('0x38')]));_0x705f0['attributes']=_0x705f0['attributes'][_0x7995('0x51')]?_0x705f0['attributes']:_0x3a7d9d[_0x7995('0x32')];_0x705f0[_0x7995('0x55')]=qs[_0x7995('0x3b')](_0x4cc247[_0x7995('0x33')][_0x7995('0x3b')]);_0x705f0[_0x7995('0x41')]=qs[_0x7995('0x4a')](_[_0x7995('0x3c')](_0x4cc247[_0x7995('0x33')],_0x3a7d9d[_0x7995('0x4a')]));if(_0x4cc247[_0x7995('0x33')][_0x7995('0x42')]){_0x705f0[_0x7995('0x41')]=_[_0x7995('0x40')](_0x705f0[_0x7995('0x41')],{'$or':_[_0x7995('0x52')](_0x705f0[_0x7995('0x37')],function(_0x251490){var _0x2ff7ba={};_0x2ff7ba[_0x251490]={'$like':'%'+_0x4cc247[_0x7995('0x33')][_0x7995('0x42')]+'%'};return _0x2ff7ba;})});}_0x705f0=_[_0x7995('0x40')]({},_0x705f0,_0x4cc247[_0x7995('0x43')]);return _0x3b0d30[_0x7995('0x53')](_0x705f0);}})[_0x7995('0x17')](function(_0x33479a){if(_0x33479a){_0x51ab1e=_0x33479a[_0x7995('0x51')];if(!_0x4cc247[_0x7995('0x33')]['hasOwnProperty'](_0x7995('0x3a'))){_0x705f0[_0x7995('0x28')]=qs['limit'](_0x4cc247['query'][_0x7995('0x28')]);_0x705f0[_0x7995('0x27')]=qs[_0x7995('0x27')](_0x4cc247[_0x7995('0x33')][_0x7995('0x27')]);}return _0x3b0d30[_0x7995('0x53')](_0x705f0);}})['then'](function(_0x2f8a2d){if(_0x2f8a2d){return _0x2f8a2d?{'count':_0x51ab1e,'rows':_0x2f8a2d}:null;}})[_0x7995('0x17')](respondWithResult(_0x1fe1cb,null))[_0x7995('0x4e')](handleError(_0x1fe1cb,null));};exports[_0x7995('0x56')]=function(_0x7d9c6e,_0x3f0bff,_0x151d99){var _0xc93dcb={};var _0x560095={};var _0x1c8e7d;var _0x2b8217;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x7d9c6e[_0x7995('0x49')]['id']}})[_0x7995('0x17')](handleEntityNotFound(_0x3f0bff,null))[_0x7995('0x17')](function(_0x3db7a9){if(_0x3db7a9){_0x1c8e7d=_0x3db7a9;_0x560095[_0x7995('0x32')]=_['keys'](db[_0x7995('0x50')][_0x7995('0x31')]);_0x560095['query']=_[_0x7995('0x35')](_0x7d9c6e[_0x7995('0x33')]);_0x560095['filters']=_[_0x7995('0x36')](_0x560095['model'],_0x560095[_0x7995('0x33')]);_0xc93dcb[_0x7995('0x37')]=_[_0x7995('0x36')](_0x560095[_0x7995('0x32')],qs[_0x7995('0x38')](_0x7d9c6e['query'][_0x7995('0x38')]));_0xc93dcb[_0x7995('0x37')]=_0xc93dcb[_0x7995('0x37')]['length']?_0xc93dcb[_0x7995('0x37')]:_0x560095[_0x7995('0x32')];_0xc93dcb[_0x7995('0x55')]=qs[_0x7995('0x3b')](_0x7d9c6e['query'][_0x7995('0x3b')]);_0xc93dcb[_0x7995('0x41')]=qs[_0x7995('0x4a')](_['pick'](_0x7d9c6e['query'],_0x560095[_0x7995('0x4a')]));if(_0x7d9c6e[_0x7995('0x33')]['filter']){_0xc93dcb['where']=_[_0x7995('0x40')](_0xc93dcb[_0x7995('0x41')],{'$or':_[_0x7995('0x52')](_0xc93dcb[_0x7995('0x37')],function(_0x2ba606){var _0x551b5e={};_0x551b5e[_0x2ba606]={'$like':'%'+_0x7d9c6e['query'][_0x7995('0x42')]+'%'};return _0x551b5e;})});}_0xc93dcb=_['merge']({},_0xc93dcb,_0x7d9c6e['options']);return _0x1c8e7d[_0x7995('0x56')](_0xc93dcb);}})[_0x7995('0x17')](function(_0x3192b8){if(_0x3192b8){_0x2b8217=_0x3192b8['length'];if(!_0x7d9c6e[_0x7995('0x33')][_0x7995('0x39')](_0x7995('0x3a'))){_0xc93dcb[_0x7995('0x28')]=qs[_0x7995('0x28')](_0x7d9c6e['query'][_0x7995('0x28')]);_0xc93dcb[_0x7995('0x27')]=qs[_0x7995('0x27')](_0x7d9c6e[_0x7995('0x33')]['offset']);}return _0x1c8e7d[_0x7995('0x56')](_0xc93dcb);}})[_0x7995('0x17')](function(_0x522110){if(_0x522110){return _0x522110?{'count':_0x2b8217,'rows':_0x522110}:null;}})[_0x7995('0x17')](respondWithResult(_0x3f0bff,null))[_0x7995('0x4e')](handleError(_0x3f0bff,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2448f39..b70dbc8 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 _0x4e39=['exports','define','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','./intSalesforceConfiguration.attributes'];(function(_0x17d006,_0x275702){var _0x2ea9e1=function(_0x31aa10){while(--_0x31aa10){_0x17d006['push'](_0x17d006['shift']());}};_0x2ea9e1(++_0x275702);}(_0x4e39,0x14d));var _0x94e3=function(_0x2a8d0f,_0x42983b){_0x2a8d0f=_0x2a8d0f-0x0;var _0xf4cc50=_0x4e39[_0x2a8d0f];return _0xf4cc50;};'use strict';var _=require(_0x94e3('0x0'));var util=require(_0x94e3('0x1'));var logger=require('../../config/logger')(_0x94e3('0x2'));var moment=require(_0x94e3('0x3'));var BPromise=require(_0x94e3('0x4'));var rp=require(_0x94e3('0x5'));var attributes=require(_0x94e3('0x6'));module[_0x94e3('0x7')]=function(_0x15bf6a,_0x5d347d){return _0x15bf6a[_0x94e3('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x94e3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6123=['define','SalesforceConfiguration','util','../../config/logger','moment','bluebird','./intSalesforceConfiguration.attributes','exports'];(function(_0x51cdbb,_0x157d62){var _0x3b3ade=function(_0x48f96b){while(--_0x48f96b){_0x51cdbb['push'](_0x51cdbb['shift']());}};_0x3b3ade(++_0x157d62);}(_0x6123,0x1e2));var _0x3612=function(_0x216bdd,_0x22e02b){_0x216bdd=_0x216bdd-0x0;var _0x3422b0=_0x6123[_0x216bdd];return _0x3422b0;};'use strict';var _=require('lodash');var util=require(_0x3612('0x0'));var logger=require(_0x3612('0x1'))('api');var moment=require(_0x3612('0x2'));var BPromise=require(_0x3612('0x3'));var rp=require('request-promise');var attributes=require(_0x3612('0x4'));module[_0x3612('0x5')]=function(_0x160267,_0x3e1579){return _0x160267[_0x3612('0x6')](_0x3612('0x7'),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 dcfdade..92d37fe 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 _0xe704=['rpc','../../config/environment','client','http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xe704,0x123));var _0x4e70=function(_0x1265e4,_0x29a8fc){_0x1265e4=_0x1265e4-0x0;var _0x34ec62=_0xe704[_0x1265e4];return _0x34ec62;};'use strict';var _=require(_0x4e70('0x0'));var util=require(_0x4e70('0x1'));var moment=require(_0x4e70('0x2'));var BPromise=require(_0x4e70('0x3'));var rs=require(_0x4e70('0x4'));var fs=require('fs');var db=require(_0x4e70('0x5'))['db'];var utils=require(_0x4e70('0x6'));var logger=require(_0x4e70('0x7'))(_0x4e70('0x8'));var config=require(_0x4e70('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4e70('0xa')][_0x4e70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x315c7c,_0x9b407c,_0x2c0ec7){return new BPromise(function(_0x14ba17,_0x39db85){return client['request'](_0x315c7c,_0x2c0ec7)[_0x4e70('0xc')](function(_0x323fa7){logger[_0x4e70('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x9b407c,_0x4e70('0xe'));logger[_0x4e70('0xf')](_0x4e70('0x10'),_0x9b407c,_0x4e70('0xe'),JSON[_0x4e70('0x11')](_0x323fa7));if(_0x323fa7[_0x4e70('0x12')]){if(_0x323fa7['error']['code']===0x1f4){logger[_0x4e70('0x12')](_0x4e70('0x13'),_0x9b407c,_0x323fa7[_0x4e70('0x12')][_0x4e70('0x14')]);return _0x39db85(_0x323fa7[_0x4e70('0x12')][_0x4e70('0x14')]);}logger[_0x4e70('0x12')](_0x4e70('0x13'),_0x9b407c,_0x323fa7['error'][_0x4e70('0x14')]);return _0x14ba17(_0x323fa7[_0x4e70('0x12')][_0x4e70('0x14')]);}else{logger[_0x4e70('0xd')](_0x4e70('0x13'),_0x9b407c,_0x4e70('0xe'));_0x14ba17(_0x323fa7[_0x4e70('0x15')]['message']);}})[_0x4e70('0x16')](function(_0x571c32){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x9b407c,_0x571c32);_0x39db85(_0x571c32);});});} \ No newline at end of file +var _0x0c38=['rpc','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','../../config/logger'];(function(_0x35bd79,_0x24a642){var _0x9857e9=function(_0x1ab311){while(--_0x1ab311){_0x35bd79['push'](_0x35bd79['shift']());}};_0x9857e9(++_0x24a642);}(_0x0c38,0xf7));var _0x80c3=function(_0x3365f2,_0xac9e6c){_0x3365f2=_0x3365f2-0x0;var _0x162976=_0x0c38[_0x3365f2];return _0x162976;};'use strict';var _=require('lodash');var util=require(_0x80c3('0x0'));var moment=require(_0x80c3('0x1'));var BPromise=require(_0x80c3('0x2'));var rs=require(_0x80c3('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x80c3('0x4'))(_0x80c3('0x5'));var config=require('../../config/environment');var jayson=require(_0x80c3('0x6'));var client=jayson['client'][_0x80c3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1961a1,_0x215859,_0x17e1b0){return new BPromise(function(_0x4785ce,_0x3bc2cf){return client[_0x80c3('0x8')](_0x1961a1,_0x17e1b0)[_0x80c3('0x9')](function(_0x391bc0){logger[_0x80c3('0xa')](_0x80c3('0xb'),_0x215859,'request\x20sent');logger[_0x80c3('0xc')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x215859,_0x80c3('0xd'),JSON[_0x80c3('0xe')](_0x391bc0));if(_0x391bc0[_0x80c3('0xf')]){if(_0x391bc0[_0x80c3('0xf')][_0x80c3('0x10')]===0x1f4){logger[_0x80c3('0xf')](_0x80c3('0xb'),_0x215859,_0x391bc0['error'][_0x80c3('0x11')]);return _0x3bc2cf(_0x391bc0[_0x80c3('0xf')][_0x80c3('0x11')]);}logger['error'](_0x80c3('0xb'),_0x215859,_0x391bc0[_0x80c3('0xf')][_0x80c3('0x11')]);return _0x4785ce(_0x391bc0[_0x80c3('0xf')]['message']);}else{logger[_0x80c3('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x215859,_0x80c3('0xd'));_0x4785ce(_0x391bc0['result'][_0x80c3('0x11')]);}})['catch'](function(_0xa8c3b2){logger[_0x80c3('0xf')](_0x80c3('0xb'),_0x215859,_0xa8c3b2);_0x3bc2cf(_0xa8c3b2);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c6d615d..6ddf991 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 _0x17da=['create','put','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','isAuthenticated'];(function(_0x4408a7,_0x27a8b5){var _0x32237f=function(_0x5a1675){while(--_0x5a1675){_0x4408a7['push'](_0x4408a7['shift']());}};_0x32237f(++_0x27a8b5);}(_0x17da,0x18a));var _0xa17d=function(_0x4393fc,_0x20e885){_0x4393fc=_0x4393fc-0x0;var _0x3ea3ba=_0x17da[_0x4393fc];return _0x3ea3ba;};'use strict';var multer=require(_0xa17d('0x0'));var util=require(_0xa17d('0x1'));var path=require(_0xa17d('0x2'));var express=require(_0xa17d('0x3'));var router=express[_0xa17d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa17d('0x5'));var config=require(_0xa17d('0x6'));var controller=require(_0xa17d('0x7'));router[_0xa17d('0x8')]('/',auth['isAuthenticated'](),controller[_0xa17d('0x9')]);router[_0xa17d('0x8')]('/:id',auth[_0xa17d('0xa')](),controller['show']);router['post']('/',auth[_0xa17d('0xa')](),controller[_0xa17d('0xb')]);router[_0xa17d('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa17d('0xd')]('/:id',auth[_0xa17d('0xa')](),controller[_0xa17d('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8afe=['exports','multer','path','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x46b579,_0x566d72){var _0x373a12=function(_0xe47070){while(--_0xe47070){_0x46b579['push'](_0x46b579['shift']());}};_0x373a12(++_0x566d72);}(_0x8afe,0xa1));var _0xe8af=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8afe[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xe8af('0x0'));var util=require('util');var path=require(_0xe8af('0x1'));var express=require(_0xe8af('0x2'));var router=express[_0xe8af('0x3')]();var auth=require(_0xe8af('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0xe8af('0x5')]('/',auth[_0xe8af('0x6')](),controller[_0xe8af('0x7')]);router[_0xe8af('0x5')](_0xe8af('0x8'),auth[_0xe8af('0x6')](),controller[_0xe8af('0x9')]);router[_0xe8af('0xa')]('/',auth[_0xe8af('0x6')](),controller[_0xe8af('0xb')]);router[_0xe8af('0xc')](_0xe8af('0x8'),auth[_0xe8af('0x6')](),controller[_0xe8af('0xd')]);router[_0xe8af('0xe')](_0xe8af('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xe8af('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index ee20dff..ea6b6c3 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 _0x7250=['exports','string','variable','customVariable','keyValue','STRING','ENUM','sequelize'];(function(_0x23c02b,_0x411b4d){var _0x25efc5=function(_0x50e9e4){while(--_0x50e9e4){_0x23c02b['push'](_0x23c02b['shift']());}};_0x25efc5(++_0x411b4d);}(_0x7250,0x13f));var _0x0725=function(_0x1d744c,_0x309efb){_0x1d744c=_0x1d744c-0x0;var _0x555675=_0x7250[_0x1d744c];return _0x555675;};'use strict';var Sequelize=require(_0x0725('0x0'));module[_0x0725('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0725('0x2'),_0x0725('0x3'),_0x0725('0x4'),_0x0725('0x5')),'defaultValue':_0x0725('0x2')},'content':{'type':Sequelize[_0x0725('0x6')]},'key':{'type':Sequelize[_0x0725('0x6')]},'keyType':{'type':Sequelize[_0x0725('0x7')](_0x0725('0x2'),_0x0725('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0725('0x6')]},'idField':{'type':Sequelize[_0x0725('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x429f=['ENUM','string','variable','STRING','customVariable','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x429f,0x7c));var _0xf429=function(_0x4f5c2a,_0x465535){_0x4f5c2a=_0x4f5c2a-0x0;var _0x1b2e6e=_0x429f[_0x4f5c2a];return _0x1b2e6e;};'use strict';var Sequelize=require(_0xf429('0x0'));module[_0xf429('0x1')]={'type':{'type':Sequelize[_0xf429('0x2')](_0xf429('0x3'),_0xf429('0x4'),'customVariable','keyValue'),'defaultValue':_0xf429('0x3')},'content':{'type':Sequelize[_0xf429('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf429('0x3'),_0xf429('0x4'),_0xf429('0x6'))},'keyContent':{'type':Sequelize[_0xf429('0x5')]},'idField':{'type':Sequelize[_0xf429('0x5')]},'variableName':{'type':Sequelize[_0xf429('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a0c2f3c..d90bc3d 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 _0x8c46=['destroy','end','error','stack','name','status','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','add','day','merge','map','filter','options','include','SalesforceField','rows','catch','includeAll','find','create','body','params','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','set','reject','save','update','then'];(function(_0x4b849a,_0x169e5c){var _0x345a02=function(_0x3c606f){while(--_0x3c606f){_0x4b849a['push'](_0x4b849a['shift']());}};_0x345a02(++_0x169e5c);}(_0x8c46,0x171));var _0x68c4=function(_0x497497,_0x4135a8){_0x497497=_0x497497-0x0;var _0x41eeff=_0x8c46[_0x497497];return _0x41eeff;};'use strict';var jsonpatch=require(_0x68c4('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68c4('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x68c4('0x2'));var sox=require(_0x68c4('0x3'));var csv=require(_0x68c4('0x4'));var ejs=require(_0x68c4('0x5'));var fs=require('fs');var _=require(_0x68c4('0x6'));var squel=require(_0x68c4('0x7'));var crypto=require(_0x68c4('0x8'));var jsforce=require(_0x68c4('0x9'));var deskjs=require(_0x68c4('0xa'));var toCsv=require(_0x68c4('0x4'));var querystring=require('querystring');var Papa=require(_0x68c4('0xb'));var qs=require(_0x68c4('0xc'));var logger=require(_0x68c4('0xd'))('api');var utils=require(_0x68c4('0xe'));var config=require(_0x68c4('0xf'));var db=require(_0x68c4('0x10'))['db'];function respondWithStatusCode(_0x5b5626,_0x50b0df){_0x50b0df=_0x50b0df||0xcc;return function(_0x3f44f0){if(_0x3f44f0){return _0x5b5626[_0x68c4('0x11')](_0x50b0df);}return _0x5b5626['status'](_0x50b0df)['end']();};}function respondWithResult(_0x872152,_0x1f7cb2){_0x1f7cb2=_0x1f7cb2||0xc8;return function(_0x2796c8){if(_0x2796c8){return _0x872152['status'](_0x1f7cb2)[_0x68c4('0x12')](_0x2796c8);}};}function respondWithFilteredResult(_0x1f5f42,_0x200623){return function(_0x56e361){if(_0x56e361){var _0x11eb66=_0x56e361[_0x68c4('0x13')],_0x14919c=_0x200623[_0x68c4('0x14')],_0x5e1341=_0x200623['offset']+_0x200623[_0x68c4('0x15')],_0x52f031;if(_0x5e1341>=_0x11eb66){_0x5e1341=_0x11eb66;_0x52f031=0xc8;}else{_0x52f031=0xce;}_0x1f5f42['status'](_0x52f031);return _0x1f5f42[_0x68c4('0x16')]('Content-Range',_0x14919c+'-'+_0x5e1341+'/'+_0x11eb66)['json'](_0x56e361);}return null;};}function patchUpdates(_0xc2ea2f){return function(_0x5cb05f){try{jsonpatch['apply'](_0x5cb05f,_0xc2ea2f,!![]);}catch(_0x2d6c1b){return BPromise[_0x68c4('0x17')](_0x2d6c1b);}return _0x5cb05f[_0x68c4('0x18')]();};}function saveUpdates(_0x33c5c5,_0x3a6300){return function(_0x10f0a7){if(_0x10f0a7){return _0x10f0a7[_0x68c4('0x19')](_0x33c5c5)[_0x68c4('0x1a')](function(_0x1ee182){return _0x1ee182;});}return null;};}function removeEntity(_0x3befda,_0x29cb55){return function(_0x58f87d){if(_0x58f87d){return _0x58f87d[_0x68c4('0x1b')]()['then'](function(){_0x3befda['status'](0xcc)[_0x68c4('0x1c')]();});}};}function handleEntityNotFound(_0x1355f1,_0x154897){return function(_0x42f0bc){if(!_0x42f0bc){_0x1355f1['sendStatus'](0x194);}return _0x42f0bc;};}function handleError(_0x35e865,_0x310bc6){_0x310bc6=_0x310bc6||0x1f4;return function(_0x582965){logger[_0x68c4('0x1d')](_0x582965[_0x68c4('0x1e')]);if(_0x582965[_0x68c4('0x1f')]){delete _0x582965[_0x68c4('0x1f')];}_0x35e865[_0x68c4('0x20')](_0x310bc6)[_0x68c4('0x21')](_0x582965);};}exports[_0x68c4('0x22')]=function(_0x505db4,_0x2ff4a5){var _0x55355d={},_0xf16a78={},_0x10c67e={'count':0x0,'rows':[]};var _0x57f32=db['SalesforceField'][_0x68c4('0x23')];_0xf16a78[_0x68c4('0x24')]=_[_0x68c4('0x25')](_0x57f32);var _0x31e177={'dateStart':_0x505db4[_0x68c4('0x26')][_0x68c4('0x27')],'dateEnd':_0x505db4[_0x68c4('0x26')]['dateEnd']};delete _0x505db4[_0x68c4('0x26')]['dateStart'];delete _0x505db4[_0x68c4('0x26')][_0x68c4('0x28')];_0xf16a78['query']=_[_0x68c4('0x25')](_0x505db4[_0x68c4('0x26')]);_0xf16a78['filters']=_[_0x68c4('0x29')](_0xf16a78[_0x68c4('0x24')],_0xf16a78[_0x68c4('0x26')]);_0x55355d[_0x68c4('0x2a')]=_[_0x68c4('0x29')](_0xf16a78[_0x68c4('0x24')],qs[_0x68c4('0x2b')](_0x505db4[_0x68c4('0x26')][_0x68c4('0x2b')]));_0x55355d[_0x68c4('0x2a')]=_0x55355d[_0x68c4('0x2a')][_0x68c4('0x2c')]?_0x55355d[_0x68c4('0x2a')]:_0xf16a78[_0x68c4('0x24')];if(!_0x505db4[_0x68c4('0x26')][_0x68c4('0x2d')](_0x68c4('0x2e'))){_0x55355d[_0x68c4('0x15')]=qs['limit'](_0x505db4[_0x68c4('0x26')][_0x68c4('0x15')]);_0x55355d[_0x68c4('0x14')]=qs[_0x68c4('0x14')](_0x505db4[_0x68c4('0x26')]['offset']);}_0x55355d[_0x68c4('0x2f')]=qs['sort'](_0x505db4['query']['sort']);_0x55355d[_0x68c4('0x30')]=qs[_0x68c4('0x31')](_[_0x68c4('0x32')](_0x505db4[_0x68c4('0x26')],_0xf16a78['filters']));if(_0x31e177[_0x68c4('0x27')]){if(_0x31e177[_0x68c4('0x28')]){_0x31e177[_0x68c4('0x28')]=moment(_0x31e177['dateEnd'])[_0x68c4('0x33')](0x1,_0x68c4('0x34'));}else{_0x31e177[_0x68c4('0x28')]=moment(_0x31e177[_0x68c4('0x27')])[_0x68c4('0x33')](0x1,_0x68c4('0x34'));}_[_0x68c4('0x35')](_0x55355d[_0x68c4('0x30')],{'createdAt':{'$gte':_0x31e177[_0x68c4('0x27')],'$lte':_0x31e177[_0x68c4('0x28')]}});}if(_0x505db4['query']['filter']){_0x55355d[_0x68c4('0x30')]=_[_0x68c4('0x35')](_0x55355d[_0x68c4('0x30')],{'$or':_[_0x68c4('0x36')](_0x55355d[_0x68c4('0x2a')],function(_0x13386d){var _0x49cc23={};_0x49cc23[_0x13386d]={'$like':'%'+_0x505db4[_0x68c4('0x26')][_0x68c4('0x37')]+'%'};return _0x49cc23;})});}_0x55355d=_[_0x68c4('0x35')]({},_0x55355d,_0x505db4[_0x68c4('0x38')]);var _0x30a1cd={'where':_0x55355d[_0x68c4('0x30')]};return db['SalesforceField']['count'](_0x30a1cd)[_0x68c4('0x1a')](function(_0x2785b4){_0x10c67e[_0x68c4('0x13')]=_0x2785b4;if(_0x505db4[_0x68c4('0x26')]['includeAll']){_0x55355d[_0x68c4('0x39')]=[{'all':!![]}];}return db[_0x68c4('0x3a')]['findAll'](_0x55355d);})['then'](function(_0x4c564a){_0x10c67e[_0x68c4('0x3b')]=_0x4c564a;return _0x10c67e;})['then'](respondWithFilteredResult(_0x2ff4a5,_0x55355d))[_0x68c4('0x3c')](handleError(_0x2ff4a5,null));};exports['show']=function(_0x18da6f,_0x2406b1){var _0xbd848f={'raw':!![],'where':{'id':_0x18da6f['params']['id']}},_0xefe68d={};_0xefe68d[_0x68c4('0x24')]=_[_0x68c4('0x25')](db[_0x68c4('0x3a')][_0x68c4('0x23')]);_0xefe68d['query']=_[_0x68c4('0x25')](_0x18da6f[_0x68c4('0x26')]);_0xefe68d[_0x68c4('0x31')]=_[_0x68c4('0x29')](_0xefe68d[_0x68c4('0x24')],_0xefe68d['query']);_0xbd848f['attributes']=_['intersection'](_0xefe68d[_0x68c4('0x24')],qs[_0x68c4('0x2b')](_0x18da6f[_0x68c4('0x26')][_0x68c4('0x2b')]));_0xbd848f['attributes']=_0xbd848f[_0x68c4('0x2a')][_0x68c4('0x2c')]?_0xbd848f[_0x68c4('0x2a')]:_0xefe68d[_0x68c4('0x24')];if(_0x18da6f[_0x68c4('0x26')][_0x68c4('0x3d')]){_0xbd848f[_0x68c4('0x39')]=[{'all':!![]}];}_0xbd848f=_[_0x68c4('0x35')]({},_0xbd848f,_0x18da6f[_0x68c4('0x38')]);return db[_0x68c4('0x3a')][_0x68c4('0x3e')](_0xbd848f)['then'](handleEntityNotFound(_0x2406b1,null))[_0x68c4('0x1a')](respondWithResult(_0x2406b1,null))['catch'](handleError(_0x2406b1,null));};exports[_0x68c4('0x3f')]=function(_0x44e3c9,_0x463a6b){return db[_0x68c4('0x3a')]['create'](_0x44e3c9[_0x68c4('0x40')],{})['then'](respondWithResult(_0x463a6b,0xc9))[_0x68c4('0x3c')](handleError(_0x463a6b,null));};exports[_0x68c4('0x19')]=function(_0x570e25,_0x250941){if(_0x570e25[_0x68c4('0x40')]['id']){delete _0x570e25[_0x68c4('0x40')]['id'];}return db[_0x68c4('0x3a')][_0x68c4('0x3e')]({'where':{'id':_0x570e25[_0x68c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x250941,null))[_0x68c4('0x1a')](saveUpdates(_0x570e25[_0x68c4('0x40')],null))[_0x68c4('0x1a')](respondWithResult(_0x250941,null))[_0x68c4('0x3c')](handleError(_0x250941,null));};exports['destroy']=function(_0x40ecf6,_0x19aec2){return db[_0x68c4('0x3a')][_0x68c4('0x3e')]({'where':{'id':_0x40ecf6[_0x68c4('0x41')]['id']}})[_0x68c4('0x1a')](handleEntityNotFound(_0x19aec2,null))['then'](removeEntity(_0x19aec2,null))[_0x68c4('0x3c')](handleError(_0x19aec2,null));}; \ No newline at end of file +var _0xae65=['keys','query','dateEnd','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','dateStart','day','add','merge','map','options','includeAll','include','findAll','rows','show','rawAttributes','length','create','body','catch','find','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','../../config/logger','status','end','count','offset','limit','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','SalesforceField','model'];(function(_0x43ce64,_0x54a536){var _0x1452f5=function(_0xea0d4){while(--_0xea0d4){_0x43ce64['push'](_0x43ce64['shift']());}};_0x1452f5(++_0x54a536);}(_0xae65,0x154));var _0x5ae6=function(_0x30ec48,_0xda08c2){_0x30ec48=_0x30ec48-0x0;var _0x5ad2e0=_0xae65[_0x30ec48];return _0x5ad2e0;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x5ae6('0x0'));var moment=require(_0x5ae6('0x1'));var BPromise=require(_0x5ae6('0x2'));var Mustache=require('mustache');var util=require(_0x5ae6('0x3'));var path=require(_0x5ae6('0x4'));var sox=require(_0x5ae6('0x5'));var csv=require('to-csv');var ejs=require(_0x5ae6('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5ae6('0x7'));var crypto=require('crypto');var jsforce=require(_0x5ae6('0x8'));var deskjs=require(_0x5ae6('0x9'));var toCsv=require(_0x5ae6('0xa'));var querystring=require(_0x5ae6('0xb'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x5ae6('0xc'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e1c55,_0x1f9816){_0x1f9816=_0x1f9816||0xcc;return function(_0x3d10a3){if(_0x3d10a3){return _0x3e1c55['sendStatus'](_0x1f9816);}return _0x3e1c55[_0x5ae6('0xd')](_0x1f9816)[_0x5ae6('0xe')]();};}function respondWithResult(_0x3654de,_0x524d5d){_0x524d5d=_0x524d5d||0xc8;return function(_0x1817ca){if(_0x1817ca){return _0x3654de[_0x5ae6('0xd')](_0x524d5d)['json'](_0x1817ca);}};}function respondWithFilteredResult(_0x5873c8,_0x1e3242){return function(_0x53d4a4){if(_0x53d4a4){var _0x22e3a4=_0x53d4a4[_0x5ae6('0xf')],_0x12529a=_0x1e3242[_0x5ae6('0x10')],_0x1fd389=_0x1e3242[_0x5ae6('0x10')]+_0x1e3242[_0x5ae6('0x11')],_0xbae22b;if(_0x1fd389>=_0x22e3a4){_0x1fd389=_0x22e3a4;_0xbae22b=0xc8;}else{_0xbae22b=0xce;}_0x5873c8['status'](_0xbae22b);return _0x5873c8['set']('Content-Range',_0x12529a+'-'+_0x1fd389+'/'+_0x22e3a4)[_0x5ae6('0x12')](_0x53d4a4);}return null;};}function patchUpdates(_0x54f8aa){return function(_0x1a53c9){try{jsonpatch[_0x5ae6('0x13')](_0x1a53c9,_0x54f8aa,!![]);}catch(_0x1ea952){return BPromise[_0x5ae6('0x14')](_0x1ea952);}return _0x1a53c9['save']();};}function saveUpdates(_0xe93b32,_0x421fe7){return function(_0x44b3f7){if(_0x44b3f7){return _0x44b3f7[_0x5ae6('0x15')](_0xe93b32)[_0x5ae6('0x16')](function(_0x435195){return _0x435195;});}return null;};}function removeEntity(_0x1aac3c,_0x156ead){return function(_0x3ff3cc){if(_0x3ff3cc){return _0x3ff3cc[_0x5ae6('0x17')]()['then'](function(){_0x1aac3c[_0x5ae6('0xd')](0xcc)[_0x5ae6('0xe')]();});}};}function handleEntityNotFound(_0x5ac59b,_0x128da7){return function(_0x421e8b){if(!_0x421e8b){_0x5ac59b[_0x5ae6('0x18')](0x194);}return _0x421e8b;};}function handleError(_0x3f0477,_0x2c88cc){_0x2c88cc=_0x2c88cc||0x1f4;return function(_0x1586f4){logger[_0x5ae6('0x19')](_0x1586f4[_0x5ae6('0x1a')]);if(_0x1586f4[_0x5ae6('0x1b')]){delete _0x1586f4[_0x5ae6('0x1b')];}_0x3f0477[_0x5ae6('0xd')](_0x2c88cc)[_0x5ae6('0x1c')](_0x1586f4);};}exports[_0x5ae6('0x1d')]=function(_0x387c60,_0x295517){var _0x4bccd7={},_0x38394e={},_0x1ba8cb={'count':0x0,'rows':[]};var _0x645b92=db[_0x5ae6('0x1e')]['rawAttributes'];_0x38394e[_0x5ae6('0x1f')]=_[_0x5ae6('0x20')](_0x645b92);var _0xb1c812={'dateStart':_0x387c60[_0x5ae6('0x21')]['dateStart'],'dateEnd':_0x387c60[_0x5ae6('0x21')][_0x5ae6('0x22')]};delete _0x387c60[_0x5ae6('0x21')]['dateStart'];delete _0x387c60[_0x5ae6('0x21')][_0x5ae6('0x22')];_0x38394e[_0x5ae6('0x21')]=_['keys'](_0x387c60[_0x5ae6('0x21')]);_0x38394e['filters']=_['intersection'](_0x38394e[_0x5ae6('0x1f')],_0x38394e[_0x5ae6('0x21')]);_0x4bccd7[_0x5ae6('0x23')]=_[_0x5ae6('0x24')](_0x38394e[_0x5ae6('0x1f')],qs[_0x5ae6('0x25')](_0x387c60[_0x5ae6('0x21')][_0x5ae6('0x25')]));_0x4bccd7['attributes']=_0x4bccd7['attributes']['length']?_0x4bccd7[_0x5ae6('0x23')]:_0x38394e[_0x5ae6('0x1f')];if(!_0x387c60['query'][_0x5ae6('0x26')](_0x5ae6('0x27'))){_0x4bccd7[_0x5ae6('0x11')]=qs[_0x5ae6('0x11')](_0x387c60[_0x5ae6('0x21')][_0x5ae6('0x11')]);_0x4bccd7[_0x5ae6('0x10')]=qs['offset'](_0x387c60[_0x5ae6('0x21')]['offset']);}_0x4bccd7[_0x5ae6('0x28')]=qs[_0x5ae6('0x29')](_0x387c60['query'][_0x5ae6('0x29')]);_0x4bccd7[_0x5ae6('0x2a')]=qs[_0x5ae6('0x2b')](_[_0x5ae6('0x2c')](_0x387c60[_0x5ae6('0x21')],_0x38394e['filters']));if(_0xb1c812[_0x5ae6('0x2d')]){if(_0xb1c812[_0x5ae6('0x22')]){_0xb1c812[_0x5ae6('0x22')]=moment(_0xb1c812[_0x5ae6('0x22')])['add'](0x1,_0x5ae6('0x2e'));}else{_0xb1c812['dateEnd']=moment(_0xb1c812[_0x5ae6('0x2d')])[_0x5ae6('0x2f')](0x1,_0x5ae6('0x2e'));}_[_0x5ae6('0x30')](_0x4bccd7[_0x5ae6('0x2a')],{'createdAt':{'$gte':_0xb1c812[_0x5ae6('0x2d')],'$lte':_0xb1c812[_0x5ae6('0x22')]}});}if(_0x387c60[_0x5ae6('0x21')]['filter']){_0x4bccd7[_0x5ae6('0x2a')]=_[_0x5ae6('0x30')](_0x4bccd7[_0x5ae6('0x2a')],{'$or':_[_0x5ae6('0x31')](_0x4bccd7[_0x5ae6('0x23')],function(_0x458845){var _0x5cdab5={};_0x5cdab5[_0x458845]={'$like':'%'+_0x387c60[_0x5ae6('0x21')]['filter']+'%'};return _0x5cdab5;})});}_0x4bccd7=_['merge']({},_0x4bccd7,_0x387c60[_0x5ae6('0x32')]);var _0xf6a9b4={'where':_0x4bccd7[_0x5ae6('0x2a')]};return db[_0x5ae6('0x1e')]['count'](_0xf6a9b4)['then'](function(_0xfc55e){_0x1ba8cb[_0x5ae6('0xf')]=_0xfc55e;if(_0x387c60[_0x5ae6('0x21')][_0x5ae6('0x33')]){_0x4bccd7[_0x5ae6('0x34')]=[{'all':!![]}];}return db[_0x5ae6('0x1e')][_0x5ae6('0x35')](_0x4bccd7);})[_0x5ae6('0x16')](function(_0x1e0bd5){_0x1ba8cb[_0x5ae6('0x36')]=_0x1e0bd5;return _0x1ba8cb;})[_0x5ae6('0x16')](respondWithFilteredResult(_0x295517,_0x4bccd7))['catch'](handleError(_0x295517,null));};exports[_0x5ae6('0x37')]=function(_0x42bec6,_0x5bc4c4){var _0x15ba6b={'raw':!![],'where':{'id':_0x42bec6['params']['id']}},_0xd014dc={};_0xd014dc[_0x5ae6('0x1f')]=_['keys'](db[_0x5ae6('0x1e')][_0x5ae6('0x38')]);_0xd014dc['query']=_[_0x5ae6('0x20')](_0x42bec6['query']);_0xd014dc['filters']=_[_0x5ae6('0x24')](_0xd014dc['model'],_0xd014dc[_0x5ae6('0x21')]);_0x15ba6b[_0x5ae6('0x23')]=_[_0x5ae6('0x24')](_0xd014dc[_0x5ae6('0x1f')],qs['fields'](_0x42bec6[_0x5ae6('0x21')]['fields']));_0x15ba6b['attributes']=_0x15ba6b[_0x5ae6('0x23')][_0x5ae6('0x39')]?_0x15ba6b['attributes']:_0xd014dc[_0x5ae6('0x1f')];if(_0x42bec6[_0x5ae6('0x21')][_0x5ae6('0x33')]){_0x15ba6b['include']=[{'all':!![]}];}_0x15ba6b=_[_0x5ae6('0x30')]({},_0x15ba6b,_0x42bec6[_0x5ae6('0x32')]);return db[_0x5ae6('0x1e')]['find'](_0x15ba6b)[_0x5ae6('0x16')](handleEntityNotFound(_0x5bc4c4,null))[_0x5ae6('0x16')](respondWithResult(_0x5bc4c4,null))['catch'](handleError(_0x5bc4c4,null));};exports[_0x5ae6('0x3a')]=function(_0x158088,_0xb15527){return db['SalesforceField'][_0x5ae6('0x3a')](_0x158088[_0x5ae6('0x3b')],{})[_0x5ae6('0x16')](respondWithResult(_0xb15527,0xc9))[_0x5ae6('0x3c')](handleError(_0xb15527,null));};exports['update']=function(_0x396e80,_0x12b9a4){if(_0x396e80[_0x5ae6('0x3b')]['id']){delete _0x396e80[_0x5ae6('0x3b')]['id'];}return db[_0x5ae6('0x1e')][_0x5ae6('0x3d')]({'where':{'id':_0x396e80['params']['id']}})[_0x5ae6('0x16')](handleEntityNotFound(_0x12b9a4,null))[_0x5ae6('0x16')](saveUpdates(_0x396e80[_0x5ae6('0x3b')],null))[_0x5ae6('0x16')](respondWithResult(_0x12b9a4,null))['catch'](handleError(_0x12b9a4,null));};exports[_0x5ae6('0x17')]=function(_0x120274,_0x1a76fb){return db[_0x5ae6('0x1e')][_0x5ae6('0x3d')]({'where':{'id':_0x120274['params']['id']}})[_0x5ae6('0x16')](handleEntityNotFound(_0x1a76fb,null))[_0x5ae6('0x16')](removeEntity(_0x1a76fb,null))[_0x5ae6('0x3c')](handleError(_0x1a76fb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 5740a92..3506582 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 _0x2af8=['util','api','moment','bluebird','./intSalesforceField.attributes','define','SalesforceField'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x2af8,0x1d5));var _0x82af=function(_0x284b9a,_0x5366ad){_0x284b9a=_0x284b9a-0x0;var _0x1cf10f=_0x2af8[_0x284b9a];return _0x1cf10f;};'use strict';var _=require('lodash');var util=require(_0x82af('0x0'));var logger=require('../../config/logger')(_0x82af('0x1'));var moment=require(_0x82af('0x2'));var BPromise=require(_0x82af('0x3'));var rp=require('request-promise');var attributes=require(_0x82af('0x4'));module['exports']=function(_0x3e40ee,_0xbe4b97){return _0x3e40ee[_0x82af('0x5')](_0x82af('0x6'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c48=['int_salesforce_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','SalesforceField'];(function(_0x4d72e1,_0x4c605b){var _0x3d92e7=function(_0x3e7e61){while(--_0x3e7e61){_0x4d72e1['push'](_0x4d72e1['shift']());}};_0x3d92e7(++_0x4c605b);}(_0x9c48,0xa1));var _0x89c4=function(_0x4b9add,_0x9b253e){_0x4b9add=_0x4b9add-0x0;var _0x1af6f5=_0x9c48[_0x4b9add];return _0x1af6f5;};'use strict';var _=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var logger=require(_0x89c4('0x2'))('api');var moment=require(_0x89c4('0x3'));var BPromise=require(_0x89c4('0x4'));var rp=require(_0x89c4('0x5'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x3da4d5,_0x83940c){return _0x3da4d5['define'](_0x89c4('0x6'),attributes,{'tableName':_0x89c4('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 e084f1a..b9d2812 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 _0x2419=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x1bbf60,_0x8e8d43){var _0x304c90=function(_0x2dde4d){while(--_0x2dde4d){_0x1bbf60['push'](_0x1bbf60['shift']());}};_0x304c90(++_0x8e8d43);}(_0x2419,0x132));var _0x9241=function(_0x30542f,_0x468961){_0x30542f=_0x30542f-0x0;var _0x4386c4=_0x2419[_0x30542f];return _0x4386c4;};'use strict';var _=require(_0x9241('0x0'));var util=require(_0x9241('0x1'));var moment=require(_0x9241('0x2'));var BPromise=require(_0x9241('0x3'));var rs=require(_0x9241('0x4'));var fs=require('fs');var db=require(_0x9241('0x5'))['db'];var utils=require(_0x9241('0x6'));var logger=require(_0x9241('0x7'))(_0x9241('0x8'));var config=require(_0x9241('0x9'));var jayson=require(_0x9241('0xa'));var client=jayson[_0x9241('0xb')][_0x9241('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3118fa,_0x41c502,_0x51f898){return new BPromise(function(_0x5073bd,_0x43a8e6){return client['request'](_0x3118fa,_0x51f898)[_0x9241('0xd')](function(_0x5c2c92){logger[_0x9241('0xe')](_0x9241('0xf'),_0x41c502,_0x9241('0x10'));logger[_0x9241('0x11')](_0x9241('0x12'),_0x41c502,_0x9241('0x10'),JSON[_0x9241('0x13')](_0x5c2c92));if(_0x5c2c92[_0x9241('0x14')]){if(_0x5c2c92[_0x9241('0x14')][_0x9241('0x15')]===0x1f4){logger[_0x9241('0x14')](_0x9241('0xf'),_0x41c502,_0x5c2c92['error']['message']);return _0x43a8e6(_0x5c2c92['error'][_0x9241('0x16')]);}logger[_0x9241('0x14')](_0x9241('0xf'),_0x41c502,_0x5c2c92[_0x9241('0x14')][_0x9241('0x16')]);return _0x5073bd(_0x5c2c92[_0x9241('0x14')][_0x9241('0x16')]);}else{logger[_0x9241('0xe')](_0x9241('0xf'),_0x41c502,_0x9241('0x10'));_0x5073bd(_0x5c2c92[_0x9241('0x17')][_0x9241('0x16')]);}})[_0x9241('0x18')](function(_0x566ef3){logger[_0x9241('0x14')](_0x9241('0xf'),_0x41c502,_0x566ef3);_0x43a8e6(_0x566ef3);});});} \ No newline at end of file +var _0x44ff=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x31688a,_0x588c7d){var _0xc7b088=function(_0x3ed4c8){while(--_0x3ed4c8){_0x31688a['push'](_0x31688a['shift']());}};_0xc7b088(++_0x588c7d);}(_0x44ff,0x158));var _0xf44f=function(_0x133db4,_0x221841){_0x133db4=_0x133db4-0x0;var _0x5d84bf=_0x44ff[_0x133db4];return _0x5d84bf;};'use strict';var _=require(_0xf44f('0x0'));var util=require(_0xf44f('0x1'));var moment=require('moment');var BPromise=require(_0xf44f('0x2'));var rs=require(_0xf44f('0x3'));var fs=require('fs');var db=require(_0xf44f('0x4'))['db'];var utils=require(_0xf44f('0x5'));var logger=require(_0xf44f('0x6'))(_0xf44f('0x7'));var config=require(_0xf44f('0x8'));var jayson=require(_0xf44f('0x9'));var client=jayson['client'][_0xf44f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d0859,_0x6d73e,_0x5a30fb){return new BPromise(function(_0xc4b46d,_0x1f4960){return client[_0xf44f('0xb')](_0x3d0859,_0x5a30fb)[_0xf44f('0xc')](function(_0x315993){logger['info'](_0xf44f('0xd'),_0x6d73e,'request\x20sent');logger[_0xf44f('0xe')](_0xf44f('0xf'),_0x6d73e,_0xf44f('0x10'),JSON[_0xf44f('0x11')](_0x315993));if(_0x315993[_0xf44f('0x12')]){if(_0x315993[_0xf44f('0x12')]['code']===0x1f4){logger[_0xf44f('0x12')]('SalesforceField,\x20%s,\x20%s',_0x6d73e,_0x315993['error'][_0xf44f('0x13')]);return _0x1f4960(_0x315993[_0xf44f('0x12')][_0xf44f('0x13')]);}logger['error'](_0xf44f('0xd'),_0x6d73e,_0x315993[_0xf44f('0x12')][_0xf44f('0x13')]);return _0xc4b46d(_0x315993[_0xf44f('0x12')][_0xf44f('0x13')]);}else{logger[_0xf44f('0x14')](_0xf44f('0xd'),_0x6d73e,'request\x20sent');_0xc4b46d(_0x315993[_0xf44f('0x15')][_0xf44f('0x13')]);}})[_0xf44f('0x16')](function(_0x138b6e){logger[_0xf44f('0x12')](_0xf44f('0xd'),_0x6d73e,_0x138b6e);_0x1f4960(_0x138b6e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index a43dc35..2646830 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 _0x1bd6=['express','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','path'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x1bd6,0x10f));var _0x61bd=function(_0x5a485c,_0x148d56){_0x5a485c=_0x5a485c-0x0;var _0xf9970e=_0x1bd6[_0x5a485c];return _0xf9970e;};'use strict';var multer=require(_0x61bd('0x0'));var util=require('util');var path=require(_0x61bd('0x1'));var express=require(_0x61bd('0x2'));var router=express['Router']();var auth=require(_0x61bd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x61bd('0x4'));var controller=require(_0x61bd('0x5'));router[_0x61bd('0x6')]('/',auth[_0x61bd('0x7')](),controller[_0x61bd('0x8')]);router[_0x61bd('0x6')]('/:id',auth[_0x61bd('0x7')](),controller[_0x61bd('0x9')]);router['get'](_0x61bd('0xa'),auth[_0x61bd('0x7')](),controller['getConfigurations']);router[_0x61bd('0x6')](_0x61bd('0xb'),auth[_0x61bd('0x7')](),controller[_0x61bd('0xc')]);router[_0x61bd('0xd')]('/',auth['isAuthenticated'](),controller[_0x61bd('0xe')]);router[_0x61bd('0xd')](_0x61bd('0xa'),auth[_0x61bd('0x7')](),controller[_0x61bd('0xf')]);router[_0x61bd('0x10')](_0x61bd('0x11'),auth[_0x61bd('0x7')](),controller[_0x61bd('0x12')]);router[_0x61bd('0x13')]('/:id',auth[_0x61bd('0x7')](),controller[_0x61bd('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf25f=['isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','get','index'];(function(_0x48bdc6,_0x34dc82){var _0x447c7b=function(_0x44522c){while(--_0x44522c){_0x48bdc6['push'](_0x48bdc6['shift']());}};_0x447c7b(++_0x34dc82);}(_0xf25f,0x71));var _0xff25=function(_0x197447,_0x1d8f52){_0x197447=_0x197447-0x0;var _0x409784=_0xf25f[_0x197447];return _0x409784;};'use strict';var multer=require(_0xff25('0x0'));var util=require(_0xff25('0x1'));var path=require('path');var express=require(_0xff25('0x2'));var router=express[_0xff25('0x3')]();var auth=require(_0xff25('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0xff25('0x5')]('/',auth['isAuthenticated'](),controller[_0xff25('0x6')]);router[_0xff25('0x5')]('/:id',auth[_0xff25('0x7')](),controller[_0xff25('0x8')]);router['get'](_0xff25('0x9'),auth['isAuthenticated'](),controller[_0xff25('0xa')]);router[_0xff25('0x5')]('/:id/fields',auth[_0xff25('0x7')](),controller[_0xff25('0xb')]);router[_0xff25('0xc')]('/',auth[_0xff25('0x7')](),controller[_0xff25('0xd')]);router[_0xff25('0xc')]('/:id/configurations',auth[_0xff25('0x7')](),controller['addConfiguration']);router[_0xff25('0xe')](_0xff25('0xf'),auth['isAuthenticated'](),controller[_0xff25('0x10')]);router[_0xff25('0x11')](_0xff25('0xf'),auth[_0xff25('0x7')](),controller[_0xff25('0x12')]);module[_0xff25('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 c1574cd..a37a02a 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 _0x3ce1=['username','remoteUri','sequelize','STRING'];(function(_0x343f08,_0x34b2ee){var _0x1aa260=function(_0x20f80b){while(--_0x20f80b){_0x343f08['push'](_0x343f08['shift']());}};_0x1aa260(++_0x34b2ee);}(_0x3ce1,0x152));var _0x13ce=function(_0x472882,_0x506ce2){_0x472882=_0x472882-0x0;var _0x2e8840=_0x3ce1[_0x472882];return _0x2e8840;};'use strict';var Sequelize=require(_0x13ce('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x13ce('0x1')]},'username':{'type':Sequelize[_0x13ce('0x1')],'unique':_0x13ce('0x2')},'password':{'type':Sequelize[_0x13ce('0x1')]},'remoteUri':{'type':Sequelize[_0x13ce('0x1')],'unique':_0x13ce('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x60c5=['sequelize','exports','STRING','username','remoteUri'];(function(_0x34ce72,_0x19ce31){var _0x4a3fe8=function(_0x510250){while(--_0x510250){_0x34ce72['push'](_0x34ce72['shift']());}};_0x4a3fe8(++_0x19ce31);}(_0x60c5,0x1c7));var _0x560c=function(_0x5a3642,_0x21be39){_0x5a3642=_0x5a3642-0x0;var _0xf56601=_0x60c5[_0x5a3642];return _0xf56601;};'use strict';var Sequelize=require(_0x560c('0x0'));module[_0x560c('0x1')]={'name':{'type':Sequelize[_0x560c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x560c('0x2')],'unique':_0x560c('0x3')},'password':{'type':Sequelize[_0x560c('0x2')]},'remoteUri':{'type':Sequelize[_0x560c('0x2')],'unique':_0x560c('0x4')},'serverUrl':{'type':Sequelize[_0x560c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 75910c6..79bbbaa 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 _0xb09e=['getConfigurations','SugarcrmConfiguration','order','options','findOne','AccountId','Subjects','type','Descriptions','channel','SugarcrmField','username','password','remoteUri','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','POST','format','get_module_fields','values','module_fields','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','statusCode','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','destroy','stack','name','index','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','add','day','where','filter','merge','map','SugarcrmAccount','count','includeAll','include','findAll','rows','show','params','fields','find','create','body'];(function(_0xeafe12,_0x5bb777){var _0x9f9f46=function(_0x420f30){while(--_0x420f30){_0xeafe12['push'](_0xeafe12['shift']());}};_0x9f9f46(++_0x5bb777);}(_0xb09e,0xf9));var _0xeb09=function(_0x580027,_0x5fa2dd){_0x580027=_0x580027-0x0;var _0x2f4af0=_0xb09e[_0x580027];return _0x2f4af0;};'use strict';var jsonpatch=require(_0xeb09('0x0'));var rp=require(_0xeb09('0x1'));var moment=require(_0xeb09('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb09('0x3'));var path=require('path');var sox=require(_0xeb09('0x4'));var csv=require(_0xeb09('0x5'));var ejs=require(_0xeb09('0x6'));var fs=require('fs');var _=require(_0xeb09('0x7'));var squel=require('squel');var crypto=require(_0xeb09('0x8'));var jsforce=require(_0xeb09('0x9'));var deskjs=require(_0xeb09('0xa'));var toCsv=require(_0xeb09('0x5'));var querystring=require('querystring');var Papa=require(_0xeb09('0xb'));var qs=require(_0xeb09('0xc'));var logger=require(_0xeb09('0xd'))(_0xeb09('0xe'));var utils=require('../../config/utils');var config=require(_0xeb09('0xf'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb09('0x10'));var jayson=require(_0xeb09('0x11'));var client=jayson['client'][_0xeb09('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x17a94d,_0x38edce,_0x4f5bd8,_0x35f8c8){return new BPromise(function(_0x2f3de3,_0x8148f7){var _0x14a964=_0x35f8c8||client;return _0x14a964[_0xeb09('0x13')](_0x17a94d,_0x4f5bd8)[_0xeb09('0x14')](function(_0x4156){logger[_0xeb09('0x15')](_0xeb09('0x16'),_0x38edce,'request\x20sent');logger[_0xeb09('0x17')](_0xeb09('0x18'),_0x38edce,_0xeb09('0x19'),JSON[_0xeb09('0x1a')](_0x4156));if(_0x4156['error']){if(_0x4156['error']['code']===0x1f4){logger['error'](_0xeb09('0x16'),_0x38edce,_0x4156['error']['message']);return _0x8148f7(_0x4156[_0xeb09('0x1b')][_0xeb09('0x1c')]);}logger['error'](_0xeb09('0x16'),_0x38edce,_0x4156['error'][_0xeb09('0x1c')]);return _0x2f3de3(_0x4156[_0xeb09('0x1b')][_0xeb09('0x1c')]);}else{logger[_0xeb09('0x15')](_0xeb09('0x16'),_0x38edce,_0xeb09('0x19'));_0x2f3de3(_0x4156[_0xeb09('0x1d')]['message']);}})[_0xeb09('0x1e')](function(_0x281260){logger[_0xeb09('0x1b')](_0xeb09('0x16'),_0x38edce,_0x281260);_0x8148f7(_0x281260);});});}function respondWithStatusCode(_0x44d581,_0x5efb24){_0x5efb24=_0x5efb24||0xcc;return function(_0x4016f6){if(_0x4016f6){return _0x44d581[_0xeb09('0x1f')](_0x5efb24);}return _0x44d581[_0xeb09('0x20')](_0x5efb24)[_0xeb09('0x21')]();};}function respondWithResult(_0x3be025,_0x20664f){_0x20664f=_0x20664f||0xc8;return function(_0x2bf831){if(_0x2bf831){return _0x3be025[_0xeb09('0x20')](_0x20664f)[_0xeb09('0x22')](_0x2bf831);}};}function respondWithFilteredResult(_0x1d6c62,_0x2dab56){return function(_0x1cc1e1){if(_0x1cc1e1){var _0x33ba03=_0x1cc1e1['count'],_0x3efed8=_0x2dab56[_0xeb09('0x23')],_0x3b2c9e=_0x2dab56[_0xeb09('0x23')]+_0x2dab56[_0xeb09('0x24')],_0x81f0b6;if(_0x3b2c9e>=_0x33ba03){_0x3b2c9e=_0x33ba03;_0x81f0b6=0xc8;}else{_0x81f0b6=0xce;}_0x1d6c62['status'](_0x81f0b6);return _0x1d6c62[_0xeb09('0x25')]('Content-Range',_0x3efed8+'-'+_0x3b2c9e+'/'+_0x33ba03)[_0xeb09('0x22')](_0x1cc1e1);}return null;};}function patchUpdates(_0x4b43ed){return function(_0x54e5a4){try{jsonpatch[_0xeb09('0x26')](_0x54e5a4,_0x4b43ed,!![]);}catch(_0x3fa31a){return BPromise['reject'](_0x3fa31a);}return _0x54e5a4['save']();};}function saveUpdates(_0xb33f01,_0x4d7129){return function(_0x1e604f){if(_0x1e604f){return _0x1e604f['update'](_0xb33f01)[_0xeb09('0x14')](function(_0x1a7b34){return _0x1a7b34;});}return null;};}function removeEntity(_0x312441,_0x52a50f){return function(_0x19e64a){if(_0x19e64a){return _0x19e64a[_0xeb09('0x27')]()['then'](function(){_0x312441['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c415,_0x3ba951){return function(_0x1b8220){if(!_0x1b8220){_0x46c415[_0xeb09('0x1f')](0x194);}return _0x1b8220;};}function handleError(_0x43d06f,_0x32ba15){_0x32ba15=_0x32ba15||0x1f4;return function(_0x3f30f6){logger['error'](_0x3f30f6[_0xeb09('0x28')]);if(_0x3f30f6[_0xeb09('0x29')]){delete _0x3f30f6[_0xeb09('0x29')];}_0x43d06f[_0xeb09('0x20')](_0x32ba15)['send'](_0x3f30f6);};}exports[_0xeb09('0x2a')]=function(_0x31ff0f,_0x2c570d){var _0x228e1b={},_0x4bff32={},_0x404667={'count':0x0,'rows':[]};var _0x1fdfe1=db['SugarcrmAccount'][_0xeb09('0x2b')];_0x4bff32['model']=_['keys'](_0x1fdfe1);var _0x2e953d={'dateStart':_0x31ff0f[_0xeb09('0x2c')][_0xeb09('0x2d')],'dateEnd':_0x31ff0f['query'][_0xeb09('0x2e')]};delete _0x31ff0f[_0xeb09('0x2c')]['dateStart'];delete _0x31ff0f['query'][_0xeb09('0x2e')];_0x4bff32[_0xeb09('0x2c')]=_[_0xeb09('0x2f')](_0x31ff0f[_0xeb09('0x2c')]);_0x4bff32[_0xeb09('0x30')]=_[_0xeb09('0x31')](_0x4bff32[_0xeb09('0x32')],_0x4bff32['query']);_0x228e1b[_0xeb09('0x33')]=_['intersection'](_0x4bff32[_0xeb09('0x32')],qs['fields'](_0x31ff0f[_0xeb09('0x2c')]['fields']));_0x228e1b[_0xeb09('0x33')]=_0x228e1b['attributes'][_0xeb09('0x34')]?_0x228e1b[_0xeb09('0x33')]:_0x4bff32[_0xeb09('0x32')];if(!_0x31ff0f[_0xeb09('0x2c')][_0xeb09('0x35')](_0xeb09('0x36'))){_0x228e1b[_0xeb09('0x24')]=qs[_0xeb09('0x24')](_0x31ff0f[_0xeb09('0x2c')][_0xeb09('0x24')]);_0x228e1b[_0xeb09('0x23')]=qs[_0xeb09('0x23')](_0x31ff0f[_0xeb09('0x2c')][_0xeb09('0x23')]);}_0x228e1b['order']=qs[_0xeb09('0x37')](_0x31ff0f['query']['sort']);_0x228e1b['where']=qs['filters'](_[_0xeb09('0x38')](_0x31ff0f[_0xeb09('0x2c')],_0x4bff32[_0xeb09('0x30')]));if(_0x2e953d[_0xeb09('0x2d')]){if(_0x2e953d[_0xeb09('0x2e')]){_0x2e953d[_0xeb09('0x2e')]=moment(_0x2e953d[_0xeb09('0x2e')])[_0xeb09('0x39')](0x1,_0xeb09('0x3a'));}else{_0x2e953d[_0xeb09('0x2e')]=moment(_0x2e953d[_0xeb09('0x2d')])[_0xeb09('0x39')](0x1,_0xeb09('0x3a'));}_['merge'](_0x228e1b[_0xeb09('0x3b')],{'createdAt':{'$gte':_0x2e953d[_0xeb09('0x2d')],'$lte':_0x2e953d[_0xeb09('0x2e')]}});}if(_0x31ff0f[_0xeb09('0x2c')][_0xeb09('0x3c')]){_0x228e1b['where']=_[_0xeb09('0x3d')](_0x228e1b[_0xeb09('0x3b')],{'$or':_[_0xeb09('0x3e')](_0x228e1b[_0xeb09('0x33')],function(_0x252864){var _0x44bce8={};_0x44bce8[_0x252864]={'$like':'%'+_0x31ff0f[_0xeb09('0x2c')][_0xeb09('0x3c')]+'%'};return _0x44bce8;})});}_0x228e1b=_[_0xeb09('0x3d')]({},_0x228e1b,_0x31ff0f['options']);var _0x3bbe79={'where':_0x228e1b[_0xeb09('0x3b')]};return db[_0xeb09('0x3f')][_0xeb09('0x40')](_0x3bbe79)[_0xeb09('0x14')](function(_0x1479cc){_0x404667['count']=_0x1479cc;if(_0x31ff0f['query'][_0xeb09('0x41')]){_0x228e1b[_0xeb09('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xeb09('0x43')](_0x228e1b);})['then'](function(_0x4f5457){_0x404667[_0xeb09('0x44')]=_0x4f5457;return _0x404667;})[_0xeb09('0x14')](respondWithFilteredResult(_0x2c570d,_0x228e1b))[_0xeb09('0x1e')](handleError(_0x2c570d,null));};exports[_0xeb09('0x45')]=function(_0x155691,_0x13d759){var _0x56ea6c={'raw':![],'where':{'id':_0x155691[_0xeb09('0x46')]['id']}},_0x334061={};_0x334061[_0xeb09('0x32')]=_[_0xeb09('0x2f')](db['SugarcrmAccount'][_0xeb09('0x2b')]);_0x334061['query']=_[_0xeb09('0x2f')](_0x155691[_0xeb09('0x2c')]);_0x334061[_0xeb09('0x30')]=_['intersection'](_0x334061[_0xeb09('0x32')],_0x334061['query']);_0x56ea6c[_0xeb09('0x33')]=_[_0xeb09('0x31')](_0x334061[_0xeb09('0x32')],qs['fields'](_0x155691[_0xeb09('0x2c')][_0xeb09('0x47')]));_0x56ea6c[_0xeb09('0x33')]=_0x56ea6c[_0xeb09('0x33')]['length']?_0x56ea6c['attributes']:_0x334061[_0xeb09('0x32')];if(_0x155691[_0xeb09('0x2c')][_0xeb09('0x41')]){_0x56ea6c[_0xeb09('0x42')]=[{'all':!![]}];}_0x56ea6c=_[_0xeb09('0x3d')]({},_0x56ea6c,_0x155691['options']);return db[_0xeb09('0x3f')][_0xeb09('0x48')](_0x56ea6c)[_0xeb09('0x14')](handleEntityNotFound(_0x13d759,null))['then'](respondWithResult(_0x13d759,null))[_0xeb09('0x1e')](handleError(_0x13d759,null));};exports[_0xeb09('0x49')]=function(_0x675784,_0x4dc132){return db['SugarcrmAccount'][_0xeb09('0x49')](_0x675784[_0xeb09('0x4a')],{})['then'](respondWithResult(_0x4dc132,0xc9))[_0xeb09('0x1e')](handleError(_0x4dc132,null));};exports['update']=function(_0x14370d,_0x2e8f74){if(_0x14370d[_0xeb09('0x4a')]['id']){delete _0x14370d[_0xeb09('0x4a')]['id'];}return db[_0xeb09('0x3f')][_0xeb09('0x48')]({'where':{'id':_0x14370d['params']['id']}})[_0xeb09('0x14')](handleEntityNotFound(_0x2e8f74,null))[_0xeb09('0x14')](saveUpdates(_0x14370d[_0xeb09('0x4a')],null))[_0xeb09('0x14')](respondWithResult(_0x2e8f74,null))[_0xeb09('0x1e')](handleError(_0x2e8f74,null));};exports['destroy']=function(_0x4e4ae7,_0xefb024){return db['SugarcrmAccount'][_0xeb09('0x48')]({'where':{'id':_0x4e4ae7[_0xeb09('0x46')]['id']}})['then'](handleEntityNotFound(_0xefb024,null))[_0xeb09('0x14')](removeEntity(_0xefb024,null))[_0xeb09('0x1e')](handleError(_0xefb024,null));};exports[_0xeb09('0x4b')]=function(_0x379aab,_0x53fc0f,_0x5cdc7a){var _0x3ce230={};var _0x5a30b6={};var _0x887805;var _0x169f2d;return db[_0xeb09('0x3f')]['findOne']({'where':{'id':_0x379aab[_0xeb09('0x46')]['id']}})['then'](handleEntityNotFound(_0x53fc0f,null))[_0xeb09('0x14')](function(_0x1cc794){if(_0x1cc794){_0x887805=_0x1cc794;_0x5a30b6['model']=_[_0xeb09('0x2f')](db[_0xeb09('0x4c')][_0xeb09('0x2b')]);_0x5a30b6[_0xeb09('0x2c')]=_[_0xeb09('0x2f')](_0x379aab[_0xeb09('0x2c')]);_0x5a30b6[_0xeb09('0x30')]=_[_0xeb09('0x31')](_0x5a30b6[_0xeb09('0x32')],_0x5a30b6[_0xeb09('0x2c')]);_0x3ce230['attributes']=_[_0xeb09('0x31')](_0x5a30b6[_0xeb09('0x32')],qs[_0xeb09('0x47')](_0x379aab[_0xeb09('0x2c')][_0xeb09('0x47')]));_0x3ce230[_0xeb09('0x33')]=_0x3ce230['attributes'][_0xeb09('0x34')]?_0x3ce230['attributes']:_0x5a30b6[_0xeb09('0x32')];_0x3ce230[_0xeb09('0x4d')]=qs[_0xeb09('0x37')](_0x379aab['query'][_0xeb09('0x37')]);_0x3ce230[_0xeb09('0x3b')]=qs[_0xeb09('0x30')](_[_0xeb09('0x38')](_0x379aab['query'],_0x5a30b6['filters']));if(_0x379aab[_0xeb09('0x2c')]['filter']){_0x3ce230[_0xeb09('0x3b')]=_[_0xeb09('0x3d')](_0x3ce230['where'],{'$or':_[_0xeb09('0x3e')](_0x3ce230['attributes'],function(_0x5e14b2){var _0x52d0a5={};_0x52d0a5[_0x5e14b2]={'$like':'%'+_0x379aab[_0xeb09('0x2c')]['filter']+'%'};return _0x52d0a5;})});}_0x3ce230=_['merge']({},_0x3ce230,_0x379aab[_0xeb09('0x4e')]);return _0x887805[_0xeb09('0x4b')](_0x3ce230);}})[_0xeb09('0x14')](function(_0x10896c){if(_0x10896c){_0x169f2d=_0x10896c[_0xeb09('0x34')];if(!_0x379aab['query'][_0xeb09('0x35')](_0xeb09('0x36'))){_0x3ce230[_0xeb09('0x24')]=qs['limit'](_0x379aab[_0xeb09('0x2c')][_0xeb09('0x24')]);_0x3ce230[_0xeb09('0x23')]=qs[_0xeb09('0x23')](_0x379aab[_0xeb09('0x2c')][_0xeb09('0x23')]);}return _0x887805[_0xeb09('0x4b')](_0x3ce230);}})[_0xeb09('0x14')](function(_0x45f526){if(_0x45f526){return _0x45f526?{'count':_0x169f2d,'rows':_0x45f526}:null;}})[_0xeb09('0x14')](respondWithResult(_0x53fc0f,null))[_0xeb09('0x1e')](handleError(_0x53fc0f,null));};exports['addConfiguration']=function(_0x36c405,_0x4ca0e1,_0x1f959d){if(_0x36c405['body']['id']){delete _0x36c405['body']['id'];}return db[_0xeb09('0x3f')][_0xeb09('0x4f')]({'where':{'id':_0x36c405[_0xeb09('0x46')]['id']}})[_0xeb09('0x14')](handleEntityNotFound(_0x4ca0e1,null))[_0xeb09('0x14')](function(_0x3e1b74){if(_0x3e1b74){_0x36c405[_0xeb09('0x4a')][_0xeb09('0x50')]=_0x3e1b74['id'];_0x36c405[_0xeb09('0x4a')][_0xeb09('0x51')]=integrations['getSubjects'](_0x36c405['body']['channel'],_0x36c405['body'][_0xeb09('0x52')]);_0x36c405[_0xeb09('0x4a')][_0xeb09('0x53')]=integrations['getDescriptions'](_0x36c405[_0xeb09('0x4a')][_0xeb09('0x54')],_0x36c405['body'][_0xeb09('0x52')]);return db[_0xeb09('0x4c')][_0xeb09('0x49')](_0x36c405['body'],{'include':[{'model':db[_0xeb09('0x55')],'as':_0xeb09('0x51')},{'model':db[_0xeb09('0x55')],'as':_0xeb09('0x53')}]});}return null;})['then'](respondWithResult(_0x4ca0e1,null))[_0xeb09('0x1e')](handleError(_0x4ca0e1,null));};exports['getFields']=function(_0x59b625,_0x47e7b2,_0x1defdd){var _0x3ae6c0;return db['SugarcrmAccount'][_0xeb09('0x4f')]({'where':{'id':_0x59b625[_0xeb09('0x46')]['id']},'attributes':['id',_0xeb09('0x56'),_0xeb09('0x57'),_0xeb09('0x58')]})['then'](handleEntityNotFound(_0x47e7b2,null))[_0xeb09('0x14')](function(_0x13101f){if(_0x13101f){_0x3ae6c0=_0x13101f['remoteUri'];return rp({'method':'POST','uri':util['format'](_0xeb09('0x59'),_0x3ae6c0,_0xeb09('0x5a')),'json':!![],'form':{'method':_0xeb09('0x5b'),'input_type':_0xeb09('0x5c'),'response_type':_0xeb09('0x5c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x13101f[_0xeb09('0x56')],'password':_0x13101f[_0xeb09('0x57')],'encryption':_0xeb09('0x5d')},'application':_0xeb09('0x5e')})}});}})[_0xeb09('0x14')](function(_0x27c925){if(_0x27c925){return rp({'method':_0xeb09('0x5f'),'uri':util[_0xeb09('0x60')]('%s%s',_0x3ae6c0,_0xeb09('0x5a')),'json':!![],'form':{'method':_0xeb09('0x61'),'input_type':'JSON','response_type':_0xeb09('0x5c'),'rest_data':JSON['stringify']({'session':_0x27c925['id'],'module_name':'Calls'})}});}})[_0xeb09('0x14')](function(_0x4e5f71){if(_0x4e5f71){var _0x436528=_[_0xeb09('0x62')](_0x4e5f71[_0xeb09('0x63')]);return{'count':_0x436528[_0xeb09('0x34')],'rows':_[_0xeb09('0x3e')](_0x436528,function(_0x1eecf5){return{'id':_0x1eecf5[_0xeb09('0x29')],'name':_0x1eecf5['label'],'custom':_[_0xeb09('0x64')](_0x1eecf5['name'],'_c')?!![]:![],'options':_0x1eecf5[_0xeb09('0x4e')]?_[_0xeb09('0x3e')](_[_0xeb09('0x62')](_0x1eecf5[_0xeb09('0x4e')]),function(_0x2746f8){return{'name':_0x2746f8[_0xeb09('0x65')],'value':_0x2746f8[_0xeb09('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x47e7b2,null))['catch'](function(_0x2d5e55){var _0x599222=_0x59b625[_0xeb09('0x2c')][_0xeb09('0x66')]?0x1f4:_0x2d5e55['statusCode']||0x1f4;logger['error'](_0xeb09('0x67'),_0xeb09('0x68'),_0x599222,JSON[_0xeb09('0x1a')](_0x2d5e55));delete _0x2d5e55['name'];if(_0x599222===0x191){_0x599222=0x190;}_0x47e7b2[_0xeb09('0x20')](_0x599222)[_0xeb09('0x69')](_0x59b625[_0xeb09('0x2c')][_0xeb09('0x66')]?{'message':_0xeb09('0x6a'),'statusCode':_0x2d5e55[_0xeb09('0x6b')]}:_0x2d5e55);});}; \ No newline at end of file +var _0xc2a1=['model','fields','attributes','order','sort','where','filters','day','add','merge','filter','options','include','findAll','rows','length','includeAll','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','pick','map','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','username','password','remoteUri','format','%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration','POST','values','label','endsWith','test','statusCode','Wrong\x20credentials','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','reject','save','update','destroy','stack','name','send','index','SugarcrmAccount','rawAttributes','keys','dateStart','query','dateEnd','intersection'];(function(_0x20d5e2,_0x5e3e11){var _0x2741dc=function(_0x489deb){while(--_0x489deb){_0x20d5e2['push'](_0x20d5e2['shift']());}};_0x2741dc(++_0x5e3e11);}(_0xc2a1,0x111));var _0x1c2a=function(_0x57e4aa,_0x482b33){_0x57e4aa=_0x57e4aa-0x0;var _0x203e32=_0xc2a1[_0x57e4aa];return _0x203e32;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x1c2a('0x0'));var moment=require(_0x1c2a('0x1'));var BPromise=require(_0x1c2a('0x2'));var Mustache=require(_0x1c2a('0x3'));var util=require(_0x1c2a('0x4'));var path=require(_0x1c2a('0x5'));var sox=require(_0x1c2a('0x6'));var csv=require(_0x1c2a('0x7'));var ejs=require(_0x1c2a('0x8'));var fs=require('fs');var _=require(_0x1c2a('0x9'));var squel=require(_0x1c2a('0xa'));var crypto=require(_0x1c2a('0xb'));var jsforce=require(_0x1c2a('0xc'));var deskjs=require(_0x1c2a('0xd'));var toCsv=require(_0x1c2a('0x7'));var querystring=require(_0x1c2a('0xe'));var Papa=require(_0x1c2a('0xf'));var qs=require(_0x1c2a('0x10'));var logger=require(_0x1c2a('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1c2a('0x12'))['db'];var integrations=require(_0x1c2a('0x13'));var jayson=require(_0x1c2a('0x14'));var client=jayson[_0x1c2a('0x15')][_0x1c2a('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xa0b6a,_0x3c5111,_0x5bcde9,_0x29d6e6){return new BPromise(function(_0x9617cc,_0x26cb40){var _0x41ee10=_0x29d6e6||client;return _0x41ee10[_0x1c2a('0x17')](_0xa0b6a,_0x5bcde9)[_0x1c2a('0x18')](function(_0x14aaa7){logger[_0x1c2a('0x19')](_0x1c2a('0x1a'),_0x3c5111,_0x1c2a('0x1b'));logger[_0x1c2a('0x1c')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3c5111,_0x1c2a('0x1b'),JSON[_0x1c2a('0x1d')](_0x14aaa7));if(_0x14aaa7[_0x1c2a('0x1e')]){if(_0x14aaa7[_0x1c2a('0x1e')][_0x1c2a('0x1f')]===0x1f4){logger[_0x1c2a('0x1e')](_0x1c2a('0x1a'),_0x3c5111,_0x14aaa7['error']['message']);return _0x26cb40(_0x14aaa7[_0x1c2a('0x1e')]['message']);}logger[_0x1c2a('0x1e')](_0x1c2a('0x1a'),_0x3c5111,_0x14aaa7[_0x1c2a('0x1e')]['message']);return _0x9617cc(_0x14aaa7[_0x1c2a('0x1e')][_0x1c2a('0x20')]);}else{logger[_0x1c2a('0x19')](_0x1c2a('0x1a'),_0x3c5111,'request\x20sent');_0x9617cc(_0x14aaa7[_0x1c2a('0x21')]['message']);}})[_0x1c2a('0x22')](function(_0x208c52){logger[_0x1c2a('0x1e')](_0x1c2a('0x1a'),_0x3c5111,_0x208c52);_0x26cb40(_0x208c52);});});}function respondWithStatusCode(_0x2f0a59,_0x43f1b2){_0x43f1b2=_0x43f1b2||0xcc;return function(_0x1ad5ad){if(_0x1ad5ad){return _0x2f0a59['sendStatus'](_0x43f1b2);}return _0x2f0a59[_0x1c2a('0x23')](_0x43f1b2)[_0x1c2a('0x24')]();};}function respondWithResult(_0x20051d,_0x588ce9){_0x588ce9=_0x588ce9||0xc8;return function(_0x35ea37){if(_0x35ea37){return _0x20051d[_0x1c2a('0x23')](_0x588ce9)[_0x1c2a('0x25')](_0x35ea37);}};}function respondWithFilteredResult(_0xfed181,_0x383454){return function(_0x58a194){if(_0x58a194){var _0x4f46a1=_0x58a194[_0x1c2a('0x26')],_0x1a2267=_0x383454['offset'],_0xe6de4d=_0x383454[_0x1c2a('0x27')]+_0x383454[_0x1c2a('0x28')],_0x3fa913;if(_0xe6de4d>=_0x4f46a1){_0xe6de4d=_0x4f46a1;_0x3fa913=0xc8;}else{_0x3fa913=0xce;}_0xfed181[_0x1c2a('0x23')](_0x3fa913);return _0xfed181[_0x1c2a('0x29')]('Content-Range',_0x1a2267+'-'+_0xe6de4d+'/'+_0x4f46a1)[_0x1c2a('0x25')](_0x58a194);}return null;};}function patchUpdates(_0x4e4000){return function(_0x4400e2){try{jsonpatch['apply'](_0x4400e2,_0x4e4000,!![]);}catch(_0x2992f8){return BPromise[_0x1c2a('0x2a')](_0x2992f8);}return _0x4400e2[_0x1c2a('0x2b')]();};}function saveUpdates(_0x1b1a73,_0x186c51){return function(_0x1cc95c){if(_0x1cc95c){return _0x1cc95c[_0x1c2a('0x2c')](_0x1b1a73)['then'](function(_0x4e4f41){return _0x4e4f41;});}return null;};}function removeEntity(_0x334c81,_0x5eb612){return function(_0x5bda48){if(_0x5bda48){return _0x5bda48[_0x1c2a('0x2d')]()[_0x1c2a('0x18')](function(){_0x334c81[_0x1c2a('0x23')](0xcc)[_0x1c2a('0x24')]();});}};}function handleEntityNotFound(_0x2b6365,_0x3ae65c){return function(_0x5ab1f7){if(!_0x5ab1f7){_0x2b6365['sendStatus'](0x194);}return _0x5ab1f7;};}function handleError(_0x45c2b3,_0x186d3a){_0x186d3a=_0x186d3a||0x1f4;return function(_0x50376e){logger['error'](_0x50376e[_0x1c2a('0x2e')]);if(_0x50376e[_0x1c2a('0x2f')]){delete _0x50376e[_0x1c2a('0x2f')];}_0x45c2b3['status'](_0x186d3a)[_0x1c2a('0x30')](_0x50376e);};}exports[_0x1c2a('0x31')]=function(_0x286ff0,_0x2f5633){var _0x2229f9={},_0x28ae15={},_0x8dfa22={'count':0x0,'rows':[]};var _0x3ddc05=db[_0x1c2a('0x32')][_0x1c2a('0x33')];_0x28ae15['model']=_[_0x1c2a('0x34')](_0x3ddc05);var _0x21d61a={'dateStart':_0x286ff0['query'][_0x1c2a('0x35')],'dateEnd':_0x286ff0[_0x1c2a('0x36')][_0x1c2a('0x37')]};delete _0x286ff0['query']['dateStart'];delete _0x286ff0['query'][_0x1c2a('0x37')];_0x28ae15[_0x1c2a('0x36')]=_[_0x1c2a('0x34')](_0x286ff0[_0x1c2a('0x36')]);_0x28ae15['filters']=_[_0x1c2a('0x38')](_0x28ae15[_0x1c2a('0x39')],_0x28ae15['query']);_0x2229f9['attributes']=_['intersection'](_0x28ae15['model'],qs[_0x1c2a('0x3a')](_0x286ff0[_0x1c2a('0x36')][_0x1c2a('0x3a')]));_0x2229f9[_0x1c2a('0x3b')]=_0x2229f9[_0x1c2a('0x3b')]['length']?_0x2229f9[_0x1c2a('0x3b')]:_0x28ae15['model'];if(!_0x286ff0['query']['hasOwnProperty']('nolimit')){_0x2229f9[_0x1c2a('0x28')]=qs[_0x1c2a('0x28')](_0x286ff0['query'][_0x1c2a('0x28')]);_0x2229f9['offset']=qs[_0x1c2a('0x27')](_0x286ff0[_0x1c2a('0x36')][_0x1c2a('0x27')]);}_0x2229f9[_0x1c2a('0x3c')]=qs[_0x1c2a('0x3d')](_0x286ff0['query'][_0x1c2a('0x3d')]);_0x2229f9[_0x1c2a('0x3e')]=qs[_0x1c2a('0x3f')](_['pick'](_0x286ff0[_0x1c2a('0x36')],_0x28ae15[_0x1c2a('0x3f')]));if(_0x21d61a[_0x1c2a('0x35')]){if(_0x21d61a[_0x1c2a('0x37')]){_0x21d61a['dateEnd']=moment(_0x21d61a['dateEnd'])['add'](0x1,_0x1c2a('0x40'));}else{_0x21d61a['dateEnd']=moment(_0x21d61a['dateStart'])[_0x1c2a('0x41')](0x1,_0x1c2a('0x40'));}_[_0x1c2a('0x42')](_0x2229f9['where'],{'createdAt':{'$gte':_0x21d61a[_0x1c2a('0x35')],'$lte':_0x21d61a['dateEnd']}});}if(_0x286ff0[_0x1c2a('0x36')][_0x1c2a('0x43')]){_0x2229f9[_0x1c2a('0x3e')]=_[_0x1c2a('0x42')](_0x2229f9[_0x1c2a('0x3e')],{'$or':_['map'](_0x2229f9[_0x1c2a('0x3b')],function(_0x24ce08){var _0x5d52ca={};_0x5d52ca[_0x24ce08]={'$like':'%'+_0x286ff0[_0x1c2a('0x36')]['filter']+'%'};return _0x5d52ca;})});}_0x2229f9=_[_0x1c2a('0x42')]({},_0x2229f9,_0x286ff0[_0x1c2a('0x44')]);var _0x46c211={'where':_0x2229f9[_0x1c2a('0x3e')]};return db['SugarcrmAccount'][_0x1c2a('0x26')](_0x46c211)[_0x1c2a('0x18')](function(_0x3e2ece){_0x8dfa22[_0x1c2a('0x26')]=_0x3e2ece;if(_0x286ff0[_0x1c2a('0x36')]['includeAll']){_0x2229f9[_0x1c2a('0x45')]=[{'all':!![]}];}return db[_0x1c2a('0x32')][_0x1c2a('0x46')](_0x2229f9);})[_0x1c2a('0x18')](function(_0x5bb584){_0x8dfa22[_0x1c2a('0x47')]=_0x5bb584;return _0x8dfa22;})['then'](respondWithFilteredResult(_0x2f5633,_0x2229f9))['catch'](handleError(_0x2f5633,null));};exports['show']=function(_0x51ee32,_0x170b20){var _0x54ed96={'raw':![],'where':{'id':_0x51ee32['params']['id']}},_0x5e436b={};_0x5e436b['model']=_['keys'](db['SugarcrmAccount'][_0x1c2a('0x33')]);_0x5e436b[_0x1c2a('0x36')]=_[_0x1c2a('0x34')](_0x51ee32['query']);_0x5e436b[_0x1c2a('0x3f')]=_[_0x1c2a('0x38')](_0x5e436b[_0x1c2a('0x39')],_0x5e436b[_0x1c2a('0x36')]);_0x54ed96[_0x1c2a('0x3b')]=_[_0x1c2a('0x38')](_0x5e436b[_0x1c2a('0x39')],qs[_0x1c2a('0x3a')](_0x51ee32[_0x1c2a('0x36')]['fields']));_0x54ed96[_0x1c2a('0x3b')]=_0x54ed96[_0x1c2a('0x3b')][_0x1c2a('0x48')]?_0x54ed96['attributes']:_0x5e436b[_0x1c2a('0x39')];if(_0x51ee32[_0x1c2a('0x36')][_0x1c2a('0x49')]){_0x54ed96[_0x1c2a('0x45')]=[{'all':!![]}];}_0x54ed96=_[_0x1c2a('0x42')]({},_0x54ed96,_0x51ee32[_0x1c2a('0x44')]);return db[_0x1c2a('0x32')][_0x1c2a('0x4a')](_0x54ed96)['then'](handleEntityNotFound(_0x170b20,null))['then'](respondWithResult(_0x170b20,null))[_0x1c2a('0x22')](handleError(_0x170b20,null));};exports['create']=function(_0x4c9f60,_0x44ebca){return db[_0x1c2a('0x32')][_0x1c2a('0x4b')](_0x4c9f60['body'],{})[_0x1c2a('0x18')](respondWithResult(_0x44ebca,0xc9))[_0x1c2a('0x22')](handleError(_0x44ebca,null));};exports[_0x1c2a('0x2c')]=function(_0x4b6d2d,_0x4d17b0){if(_0x4b6d2d[_0x1c2a('0x4c')]['id']){delete _0x4b6d2d[_0x1c2a('0x4c')]['id'];}return db[_0x1c2a('0x32')][_0x1c2a('0x4a')]({'where':{'id':_0x4b6d2d[_0x1c2a('0x4d')]['id']}})[_0x1c2a('0x18')](handleEntityNotFound(_0x4d17b0,null))[_0x1c2a('0x18')](saveUpdates(_0x4b6d2d[_0x1c2a('0x4c')],null))[_0x1c2a('0x18')](respondWithResult(_0x4d17b0,null))[_0x1c2a('0x22')](handleError(_0x4d17b0,null));};exports['destroy']=function(_0x2536b2,_0x5a7320){return db[_0x1c2a('0x32')]['find']({'where':{'id':_0x2536b2[_0x1c2a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a7320,null))['then'](removeEntity(_0x5a7320,null))['catch'](handleError(_0x5a7320,null));};exports[_0x1c2a('0x4e')]=function(_0x161f89,_0x4cfee6,_0x1a77a5){var _0x3d5e68={};var _0x8cd95c={};var _0x13810b;var _0x5371dc;return db[_0x1c2a('0x32')][_0x1c2a('0x4f')]({'where':{'id':_0x161f89[_0x1c2a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4cfee6,null))[_0x1c2a('0x18')](function(_0x1283d8){if(_0x1283d8){_0x13810b=_0x1283d8;_0x8cd95c[_0x1c2a('0x39')]=_[_0x1c2a('0x34')](db[_0x1c2a('0x50')][_0x1c2a('0x33')]);_0x8cd95c[_0x1c2a('0x36')]=_['keys'](_0x161f89['query']);_0x8cd95c[_0x1c2a('0x3f')]=_[_0x1c2a('0x38')](_0x8cd95c[_0x1c2a('0x39')],_0x8cd95c[_0x1c2a('0x36')]);_0x3d5e68[_0x1c2a('0x3b')]=_[_0x1c2a('0x38')](_0x8cd95c[_0x1c2a('0x39')],qs[_0x1c2a('0x3a')](_0x161f89[_0x1c2a('0x36')][_0x1c2a('0x3a')]));_0x3d5e68['attributes']=_0x3d5e68[_0x1c2a('0x3b')][_0x1c2a('0x48')]?_0x3d5e68[_0x1c2a('0x3b')]:_0x8cd95c['model'];_0x3d5e68[_0x1c2a('0x3c')]=qs[_0x1c2a('0x3d')](_0x161f89['query'][_0x1c2a('0x3d')]);_0x3d5e68[_0x1c2a('0x3e')]=qs[_0x1c2a('0x3f')](_[_0x1c2a('0x51')](_0x161f89[_0x1c2a('0x36')],_0x8cd95c[_0x1c2a('0x3f')]));if(_0x161f89[_0x1c2a('0x36')][_0x1c2a('0x43')]){_0x3d5e68[_0x1c2a('0x3e')]=_['merge'](_0x3d5e68[_0x1c2a('0x3e')],{'$or':_[_0x1c2a('0x52')](_0x3d5e68[_0x1c2a('0x3b')],function(_0x24aad0){var _0x5f59aa={};_0x5f59aa[_0x24aad0]={'$like':'%'+_0x161f89[_0x1c2a('0x36')][_0x1c2a('0x43')]+'%'};return _0x5f59aa;})});}_0x3d5e68=_[_0x1c2a('0x42')]({},_0x3d5e68,_0x161f89[_0x1c2a('0x44')]);return _0x13810b[_0x1c2a('0x4e')](_0x3d5e68);}})[_0x1c2a('0x18')](function(_0x47e3df){if(_0x47e3df){_0x5371dc=_0x47e3df['length'];if(!_0x161f89[_0x1c2a('0x36')][_0x1c2a('0x53')](_0x1c2a('0x54'))){_0x3d5e68[_0x1c2a('0x28')]=qs[_0x1c2a('0x28')](_0x161f89[_0x1c2a('0x36')]['limit']);_0x3d5e68[_0x1c2a('0x27')]=qs['offset'](_0x161f89[_0x1c2a('0x36')]['offset']);}return _0x13810b[_0x1c2a('0x4e')](_0x3d5e68);}})[_0x1c2a('0x18')](function(_0x378ede){if(_0x378ede){return _0x378ede?{'count':_0x5371dc,'rows':_0x378ede}:null;}})['then'](respondWithResult(_0x4cfee6,null))['catch'](handleError(_0x4cfee6,null));};exports[_0x1c2a('0x55')]=function(_0x129f3d,_0x1c1a49,_0x1e0960){if(_0x129f3d[_0x1c2a('0x4c')]['id']){delete _0x129f3d[_0x1c2a('0x4c')]['id'];}return db[_0x1c2a('0x32')]['findOne']({'where':{'id':_0x129f3d[_0x1c2a('0x4d')]['id']}})[_0x1c2a('0x18')](handleEntityNotFound(_0x1c1a49,null))[_0x1c2a('0x18')](function(_0x323b51){if(_0x323b51){_0x129f3d['body'][_0x1c2a('0x56')]=_0x323b51['id'];_0x129f3d[_0x1c2a('0x4c')]['Subjects']=integrations[_0x1c2a('0x57')](_0x129f3d['body'][_0x1c2a('0x58')],_0x129f3d[_0x1c2a('0x4c')][_0x1c2a('0x59')]);_0x129f3d[_0x1c2a('0x4c')][_0x1c2a('0x5a')]=integrations[_0x1c2a('0x5b')](_0x129f3d[_0x1c2a('0x4c')][_0x1c2a('0x58')],_0x129f3d[_0x1c2a('0x4c')][_0x1c2a('0x59')]);return db['SugarcrmConfiguration'][_0x1c2a('0x4b')](_0x129f3d[_0x1c2a('0x4c')],{'include':[{'model':db[_0x1c2a('0x5c')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x1c2a('0x5a')}]});}return null;})[_0x1c2a('0x18')](respondWithResult(_0x1c1a49,null))[_0x1c2a('0x22')](handleError(_0x1c1a49,null));};exports[_0x1c2a('0x5d')]=function(_0x2c12a5,_0x22dbdb,_0x5d935d){var _0x116451;return db[_0x1c2a('0x32')][_0x1c2a('0x4f')]({'where':{'id':_0x2c12a5[_0x1c2a('0x4d')]['id']},'attributes':['id',_0x1c2a('0x5e'),_0x1c2a('0x5f'),_0x1c2a('0x60')]})[_0x1c2a('0x18')](handleEntityNotFound(_0x22dbdb,null))[_0x1c2a('0x18')](function(_0x5901d2){if(_0x5901d2){_0x116451=_0x5901d2[_0x1c2a('0x60')];return rp({'method':'POST','uri':util[_0x1c2a('0x61')](_0x1c2a('0x62'),_0x116451,_0x1c2a('0x63')),'json':!![],'form':{'method':_0x1c2a('0x64'),'input_type':_0x1c2a('0x65'),'response_type':'JSON','rest_data':JSON[_0x1c2a('0x1d')]({'user_auth':{'user_name':_0x5901d2['username'],'password':_0x5901d2[_0x1c2a('0x5f')],'encryption':'PLAIN'},'application':_0x1c2a('0x66')})}});}})['then'](function(_0x3031e2){if(_0x3031e2){return rp({'method':_0x1c2a('0x67'),'uri':util[_0x1c2a('0x61')](_0x1c2a('0x62'),_0x116451,_0x1c2a('0x63')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x1c2a('0x65'),'response_type':_0x1c2a('0x65'),'rest_data':JSON['stringify']({'session':_0x3031e2['id'],'module_name':'Calls'})}});}})[_0x1c2a('0x18')](function(_0x16a360){if(_0x16a360){var _0x29d490=_[_0x1c2a('0x68')](_0x16a360['module_fields']);return{'count':_0x29d490[_0x1c2a('0x48')],'rows':_['map'](_0x29d490,function(_0x24633e){return{'id':_0x24633e[_0x1c2a('0x2f')],'name':_0x24633e[_0x1c2a('0x69')],'custom':_[_0x1c2a('0x6a')](_0x24633e[_0x1c2a('0x2f')],'_c')?!![]:![],'options':_0x24633e['options']?_[_0x1c2a('0x52')](_[_0x1c2a('0x68')](_0x24633e['options']),function(_0x323bb0){return{'name':_0x323bb0['value'],'value':_0x323bb0[_0x1c2a('0x2f')]};}):[]};})};}})[_0x1c2a('0x18')](respondWithResult(_0x22dbdb,null))[_0x1c2a('0x22')](function(_0x22ee3f){var _0x8e01cc=_0x2c12a5[_0x1c2a('0x36')][_0x1c2a('0x6b')]?0x1f4:_0x22ee3f[_0x1c2a('0x6c')]||0x1f4;logger[_0x1c2a('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0x1c2a('0x5d'),_0x8e01cc,JSON['stringify'](_0x22ee3f));delete _0x22ee3f[_0x1c2a('0x2f')];if(_0x8e01cc===0x191){_0x8e01cc=0x190;}_0x22dbdb['status'](_0x8e01cc)[_0x1c2a('0x30')](_0x2c12a5[_0x1c2a('0x36')][_0x1c2a('0x6b')]?{'message':_0x1c2a('0x6d'),'statusCode':_0x22ee3f[_0x1c2a('0x6c')]}:_0x22ee3f);});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 79d7ad3..6764f66 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 _0xfceb=['../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmAccount.attributes'];(function(_0x2def0c,_0x1468a0){var _0x5f29e1=function(_0x5ede0a){while(--_0x5ede0a){_0x2def0c['push'](_0x2def0c['shift']());}};_0x5f29e1(++_0x1468a0);}(_0xfceb,0xf5));var _0xbfce=function(_0x2923c6,_0x52a410){_0x2923c6=_0x2923c6-0x0;var _0x43162a=_0xfceb[_0x2923c6];return _0x43162a;};'use strict';var _=require(_0xbfce('0x0'));var util=require(_0xbfce('0x1'));var logger=require(_0xbfce('0x2'))(_0xbfce('0x3'));var moment=require(_0xbfce('0x4'));var BPromise=require(_0xbfce('0x5'));var rp=require(_0xbfce('0x6'));var attributes=require(_0xbfce('0x7'));var integrations=require(_0xbfce('0x8'));module[_0xbfce('0x9')]=function(_0x25b5d2,_0x2f0c98){return _0x25b5d2['define'](_0xbfce('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41b1=['request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','moment'];(function(_0x21a257,_0x2a305d){var _0x4cbbc2=function(_0x40542d){while(--_0x40542d){_0x21a257['push'](_0x21a257['shift']());}};_0x4cbbc2(++_0x2a305d);}(_0x41b1,0x1a5));var _0x141b=function(_0x1af1e1,_0x37bc24){_0x1af1e1=_0x1af1e1-0x0;var _0x5f3450=_0x41b1[_0x1af1e1];return _0x5f3450;};'use strict';var _=require('lodash');var util=require(_0x141b('0x0'));var logger=require(_0x141b('0x1'))('api');var moment=require(_0x141b('0x2'));var BPromise=require('bluebird');var rp=require(_0x141b('0x3'));var attributes=require(_0x141b('0x4'));var integrations=require(_0x141b('0x5'));module['exports']=function(_0xd4930d,_0xd2ec3d){return _0xd4930d['define'](_0x141b('0x6'),attributes,{'tableName':_0x141b('0x7'),'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 b94f058..c567272 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 _0xd02b=['http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','findAll','options','raw','attributes','include','map','model','GetSugarcrmAccount','debug','SugarcrmAccount','where','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1ba81c,_0x5f0372){var _0x287667=function(_0x5522ab){while(--_0x5522ab){_0x1ba81c['push'](_0x1ba81c['shift']());}};_0x287667(++_0x5f0372);}(_0xd02b,0x16d));var _0xbd02=function(_0x418e2a,_0x2de9ed){_0x418e2a=_0x418e2a-0x0;var _0x25f44f=_0xd02b[_0x418e2a];return _0x25f44f;};'use strict';var _=require(_0xbd02('0x0'));var util=require('util');var moment=require(_0xbd02('0x1'));var BPromise=require(_0xbd02('0x2'));var rs=require(_0xbd02('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xbd02('0x4'));var logger=require(_0xbd02('0x5'))(_0xbd02('0x6'));var config=require(_0xbd02('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbd02('0x8')][_0xbd02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be3c1,_0x3abbb0,_0x53afef){return new BPromise(function(_0x201fe2,_0x16a403){return client[_0xbd02('0xa')](_0x1be3c1,_0x53afef)[_0xbd02('0xb')](function(_0x39f1d8){logger[_0xbd02('0xc')](_0xbd02('0xd'),_0x3abbb0,'request\x20sent');logger['debug'](_0xbd02('0xe'),_0x3abbb0,'request\x20sent',JSON[_0xbd02('0xf')](_0x39f1d8));if(_0x39f1d8[_0xbd02('0x10')]){if(_0x39f1d8[_0xbd02('0x10')][_0xbd02('0x11')]===0x1f4){logger[_0xbd02('0x10')](_0xbd02('0xd'),_0x3abbb0,_0x39f1d8[_0xbd02('0x10')][_0xbd02('0x12')]);return _0x16a403(_0x39f1d8[_0xbd02('0x10')][_0xbd02('0x12')]);}logger[_0xbd02('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x3abbb0,_0x39f1d8[_0xbd02('0x10')][_0xbd02('0x12')]);return _0x201fe2(_0x39f1d8[_0xbd02('0x10')][_0xbd02('0x12')]);}else{logger['info'](_0xbd02('0xd'),_0x3abbb0,_0xbd02('0x13'));_0x201fe2(_0x39f1d8[_0xbd02('0x14')][_0xbd02('0x12')]);}})[_0xbd02('0x15')](function(_0xf6a33b){logger[_0xbd02('0x10')](_0xbd02('0xd'),_0x3abbb0,_0xf6a33b);_0x16a403(_0xf6a33b);});});}exports['GetSugarcrmAccount']=function(_0x40e976){var _0x3d9471=this;return new Promise(function(_0x4dfd14,_0xc84b1b){return db['SugarcrmAccount'][_0xbd02('0x16')]({'raw':_0x40e976[_0xbd02('0x17')]?_0x40e976[_0xbd02('0x17')][_0xbd02('0x18')]===undefined?!![]:![]:!![],'where':_0x40e976[_0xbd02('0x17')]?_0x40e976[_0xbd02('0x17')]['where']||null:null,'attributes':_0x40e976[_0xbd02('0x17')]?_0x40e976[_0xbd02('0x17')][_0xbd02('0x19')]||null:null,'limit':_0x40e976['options']?_0x40e976[_0xbd02('0x17')]['limit']||null:null,'include':_0x40e976[_0xbd02('0x17')]?_0x40e976[_0xbd02('0x17')][_0xbd02('0x1a')]?_[_0xbd02('0x1b')](_0x40e976[_0xbd02('0x17')][_0xbd02('0x1a')],function(_0x104c4a){return{'model':db[_0x104c4a[_0xbd02('0x1c')]],'as':_0x104c4a['as'],'attributes':_0x104c4a[_0xbd02('0x19')],'include':_0x104c4a['include']?_[_0xbd02('0x1b')](_0x104c4a[_0xbd02('0x1a')],function(_0x2954c6){return{'model':db[_0x2954c6[_0xbd02('0x1c')]],'as':_0x2954c6['as'],'attributes':_0x2954c6[_0xbd02('0x19')],'include':_0x2954c6[_0xbd02('0x1a')]?_['map'](_0x2954c6[_0xbd02('0x1a')],function(_0x1dab01){return{'model':db[_0x1dab01[_0xbd02('0x1c')]],'as':_0x1dab01['as'],'attributes':_0x1dab01[_0xbd02('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbd02('0xb')](function(_0x53acbf){logger[_0xbd02('0xc')](_0xbd02('0x1d'),_0x40e976);logger[_0xbd02('0x1e')]('GetSugarcrmAccount',_0x40e976,JSON['stringify'](_0x53acbf));_0x4dfd14(_0x53acbf);})[_0xbd02('0x15')](function(_0x40a6ef){logger[_0xbd02('0x10')]('GetSugarcrmAccount',_0x40a6ef['message'],_0x40e976);_0xc84b1b(_0x3d9471[_0xbd02('0x10')](0x1f4,_0x40a6ef[_0xbd02('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x1ae965){var _0x4da4e6=this;return new Promise(function(_0x24ac92,_0x160a14){return db[_0xbd02('0x1f')]['find']({'raw':_0x1ae965[_0xbd02('0x17')]?_0x1ae965['options'][_0xbd02('0x18')]===undefined?!![]:![]:!![],'where':_0x1ae965[_0xbd02('0x17')]?_0x1ae965['options'][_0xbd02('0x20')]||null:null,'attributes':_0x1ae965[_0xbd02('0x17')]?_0x1ae965[_0xbd02('0x17')][_0xbd02('0x19')]||null:null,'include':_0x1ae965[_0xbd02('0x17')]?_0x1ae965['options'][_0xbd02('0x1a')]?_[_0xbd02('0x1b')](_0x1ae965[_0xbd02('0x17')][_0xbd02('0x1a')],function(_0x4404e3){return{'model':db[_0x4404e3[_0xbd02('0x1c')]],'as':_0x4404e3['as'],'attributes':_0x4404e3[_0xbd02('0x19')],'include':_0x4404e3[_0xbd02('0x1a')]?_[_0xbd02('0x1b')](_0x4404e3['include'],function(_0x590669){return{'model':db[_0x590669['model']],'as':_0x590669['as'],'attributes':_0x590669[_0xbd02('0x19')],'include':_0x590669[_0xbd02('0x1a')]?_[_0xbd02('0x1b')](_0x590669[_0xbd02('0x1a')],function(_0x1d2121){return{'model':db[_0x1d2121[_0xbd02('0x1c')]],'as':_0x1d2121['as'],'attributes':_0x1d2121[_0xbd02('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbd02('0xb')](function(_0x3caf4c){logger[_0xbd02('0xc')]('ShowSugarcrmAccount',_0x1ae965);logger[_0xbd02('0x1e')]('ShowSugarcrmAccount',_0x1ae965,JSON[_0xbd02('0xf')](_0x3caf4c));_0x24ac92(_0x3caf4c);})['catch'](function(_0x496391){logger[_0xbd02('0x10')](_0xbd02('0x21'),_0x496391[_0xbd02('0x12')],_0x1ae965);_0x160a14(_0x4da4e6[_0xbd02('0x10')](0x1f4,_0x496391[_0xbd02('0x12')]));});});}; \ No newline at end of file +var _0x576a=['include','model','attributes','map','then','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit'];(function(_0xb22b57,_0xf7866){var _0x4a80b3=function(_0x4d3502){while(--_0x4d3502){_0xb22b57['push'](_0xb22b57['shift']());}};_0x4a80b3(++_0xf7866);}(_0x576a,0x17d));var _0xa576=function(_0x194b11,_0x1b5924){_0x194b11=_0x194b11-0x0;var _0x54a76d=_0x576a[_0x194b11];return _0x54a76d;};'use strict';var _=require(_0xa576('0x0'));var util=require('util');var moment=require(_0xa576('0x1'));var BPromise=require(_0xa576('0x2'));var rs=require(_0xa576('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xa576('0x4'));var logger=require('../../config/logger')(_0xa576('0x5'));var config=require('../../config/environment');var jayson=require(_0xa576('0x6'));var client=jayson[_0xa576('0x7')][_0xa576('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d15a5,_0x514434,_0x2dadb5){return new BPromise(function(_0x5ea494,_0x2aa20f){return client[_0xa576('0x9')](_0x2d15a5,_0x2dadb5)['then'](function(_0xd90c2a){logger[_0xa576('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x514434,'request\x20sent');logger[_0xa576('0xb')](_0xa576('0xc'),_0x514434,_0xa576('0xd'),JSON[_0xa576('0xe')](_0xd90c2a));if(_0xd90c2a['error']){if(_0xd90c2a[_0xa576('0xf')][_0xa576('0x10')]===0x1f4){logger[_0xa576('0xf')](_0xa576('0x11'),_0x514434,_0xd90c2a[_0xa576('0xf')][_0xa576('0x12')]);return _0x2aa20f(_0xd90c2a[_0xa576('0xf')][_0xa576('0x12')]);}logger[_0xa576('0xf')](_0xa576('0x11'),_0x514434,_0xd90c2a[_0xa576('0xf')]['message']);return _0x5ea494(_0xd90c2a['error'][_0xa576('0x12')]);}else{logger[_0xa576('0xa')](_0xa576('0x11'),_0x514434,'request\x20sent');_0x5ea494(_0xd90c2a['result'][_0xa576('0x12')]);}})[_0xa576('0x13')](function(_0x1b3c91){logger['error'](_0xa576('0x11'),_0x514434,_0x1b3c91);_0x2aa20f(_0x1b3c91);});});}exports[_0xa576('0x14')]=function(_0x1621da){var _0x45845c=this;return new Promise(function(_0x5672ff,_0x1cfe16){return db[_0xa576('0x15')][_0xa576('0x16')]({'raw':_0x1621da['options']?_0x1621da[_0xa576('0x17')][_0xa576('0x18')]===undefined?!![]:![]:!![],'where':_0x1621da['options']?_0x1621da[_0xa576('0x17')][_0xa576('0x19')]||null:null,'attributes':_0x1621da[_0xa576('0x17')]?_0x1621da['options']['attributes']||null:null,'limit':_0x1621da['options']?_0x1621da[_0xa576('0x17')][_0xa576('0x1a')]||null:null,'include':_0x1621da[_0xa576('0x17')]?_0x1621da[_0xa576('0x17')]['include']?_['map'](_0x1621da['options'][_0xa576('0x1b')],function(_0x33e1d5){return{'model':db[_0x33e1d5[_0xa576('0x1c')]],'as':_0x33e1d5['as'],'attributes':_0x33e1d5[_0xa576('0x1d')],'include':_0x33e1d5[_0xa576('0x1b')]?_[_0xa576('0x1e')](_0x33e1d5[_0xa576('0x1b')],function(_0xe1b352){return{'model':db[_0xe1b352[_0xa576('0x1c')]],'as':_0xe1b352['as'],'attributes':_0xe1b352[_0xa576('0x1d')],'include':_0xe1b352[_0xa576('0x1b')]?_[_0xa576('0x1e')](_0xe1b352[_0xa576('0x1b')],function(_0x57718d){return{'model':db[_0x57718d[_0xa576('0x1c')]],'as':_0x57718d['as'],'attributes':_0x57718d[_0xa576('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa576('0x1f')](function(_0x5d7082){logger[_0xa576('0xa')](_0xa576('0x14'),_0x1621da);logger[_0xa576('0xb')](_0xa576('0x14'),_0x1621da,JSON['stringify'](_0x5d7082));_0x5672ff(_0x5d7082);})[_0xa576('0x13')](function(_0x4008f5){logger[_0xa576('0xf')]('GetSugarcrmAccount',_0x4008f5[_0xa576('0x12')],_0x1621da);_0x1cfe16(_0x45845c[_0xa576('0xf')](0x1f4,_0x4008f5[_0xa576('0x12')]));});});};exports[_0xa576('0x20')]=function(_0x3ecbb2){var _0x35fa86=this;return new Promise(function(_0x320e70,_0x398bc2){return db[_0xa576('0x15')][_0xa576('0x21')]({'raw':_0x3ecbb2[_0xa576('0x17')]?_0x3ecbb2[_0xa576('0x17')][_0xa576('0x18')]===undefined?!![]:![]:!![],'where':_0x3ecbb2[_0xa576('0x17')]?_0x3ecbb2['options'][_0xa576('0x19')]||null:null,'attributes':_0x3ecbb2['options']?_0x3ecbb2[_0xa576('0x17')][_0xa576('0x1d')]||null:null,'include':_0x3ecbb2[_0xa576('0x17')]?_0x3ecbb2[_0xa576('0x17')][_0xa576('0x1b')]?_[_0xa576('0x1e')](_0x3ecbb2[_0xa576('0x17')][_0xa576('0x1b')],function(_0x492b9a){return{'model':db[_0x492b9a[_0xa576('0x1c')]],'as':_0x492b9a['as'],'attributes':_0x492b9a[_0xa576('0x1d')],'include':_0x492b9a[_0xa576('0x1b')]?_[_0xa576('0x1e')](_0x492b9a[_0xa576('0x1b')],function(_0x541b11){return{'model':db[_0x541b11['model']],'as':_0x541b11['as'],'attributes':_0x541b11[_0xa576('0x1d')],'include':_0x541b11[_0xa576('0x1b')]?_[_0xa576('0x1e')](_0x541b11[_0xa576('0x1b')],function(_0x5902aa){return{'model':db[_0x5902aa[_0xa576('0x1c')]],'as':_0x5902aa['as'],'attributes':_0x5902aa[_0xa576('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x498569){logger[_0xa576('0xa')](_0xa576('0x20'),_0x3ecbb2);logger[_0xa576('0xb')](_0xa576('0x20'),_0x3ecbb2,JSON[_0xa576('0xe')](_0x498569));_0x320e70(_0x498569);})[_0xa576('0x13')](function(_0x397c09){logger[_0xa576('0xf')](_0xa576('0x20'),_0x397c09[_0xa576('0x12')],_0x3ecbb2);_0x398bc2(_0x35fa86[_0xa576('0xf')](0x1f4,_0x397c09[_0xa576('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index aabc4a9..935c379 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 _0xb64c=['../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0xb64c,0xa3));var _0xcb64=function(_0xd97ecc,_0x5d6a2f){_0xd97ecc=_0xd97ecc-0x0;var _0xa70368=_0xb64c[_0xd97ecc];return _0xa70368;};'use strict';var multer=require(_0xcb64('0x0'));var util=require(_0xcb64('0x1'));var path=require('path');var express=require(_0xcb64('0x2'));var router=express[_0xcb64('0x3')]();var auth=require(_0xcb64('0x4'));var interaction=require(_0xcb64('0x5'));var config=require('../../config/environment');var controller=require(_0xcb64('0x6'));router[_0xcb64('0x7')]('/',auth[_0xcb64('0x8')](),controller['index']);router['get'](_0xcb64('0x9'),auth[_0xcb64('0x8')](),controller[_0xcb64('0xa')]);router['get'](_0xcb64('0xb'),auth[_0xcb64('0x8')](),controller['getFields']);router[_0xcb64('0x7')](_0xcb64('0xc'),auth[_0xcb64('0x8')](),controller[_0xcb64('0xd')]);router[_0xcb64('0x7')]('/:id/descriptions',auth[_0xcb64('0x8')](),controller[_0xcb64('0xe')]);router[_0xcb64('0xf')]('/',auth['isAuthenticated'](),controller[_0xcb64('0x10')]);router[_0xcb64('0x11')](_0xcb64('0x9'),auth[_0xcb64('0x8')](),controller[_0xcb64('0x12')]);router[_0xcb64('0x13')](_0xcb64('0x9'),auth[_0xcb64('0x8')](),controller['destroy']);module[_0xcb64('0x14')]=router; \ No newline at end of file +var _0xdec1=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','/:id/fields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdec1,0x11f));var _0x1dec=function(_0x5eb3c5,_0x3dbe39){_0x5eb3c5=_0x5eb3c5-0x0;var _0x3e9714=_0xdec1[_0x5eb3c5];return _0x3e9714;};'use strict';var multer=require(_0x1dec('0x0'));var util=require('util');var path=require(_0x1dec('0x1'));var express=require(_0x1dec('0x2'));var router=express[_0x1dec('0x3')]();var auth=require(_0x1dec('0x4'));var interaction=require(_0x1dec('0x5'));var config=require('../../config/environment');var controller=require(_0x1dec('0x6'));router['get']('/',auth[_0x1dec('0x7')](),controller[_0x1dec('0x8')]);router['get'](_0x1dec('0x9'),auth[_0x1dec('0x7')](),controller['show']);router['get'](_0x1dec('0xa'),auth[_0x1dec('0x7')](),controller['getFields']);router[_0x1dec('0xb')](_0x1dec('0xc'),auth['isAuthenticated'](),controller[_0x1dec('0xd')]);router['get'](_0x1dec('0xe'),auth[_0x1dec('0x7')](),controller[_0x1dec('0xf')]);router[_0x1dec('0x10')]('/',auth[_0x1dec('0x7')](),controller[_0x1dec('0x11')]);router[_0x1dec('0x12')](_0x1dec('0x9'),auth[_0x1dec('0x7')](),controller[_0x1dec('0x13')]);router[_0x1dec('0x14')](_0x1dec('0x9'),auth[_0x1dec('0x7')](),controller['destroy']);module[_0x1dec('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9f4d25d..5ae1151 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 _0x5637=['STRING','sequelize'];(function(_0x1096a8,_0x2976f9){var _0x692ce7=function(_0x4c0ce3){while(--_0x4c0ce3){_0x1096a8['push'](_0x1096a8['shift']());}};_0x692ce7(++_0x2976f9);}(_0x5637,0xd5));var _0x7563=function(_0x1b5f4d,_0xbd0969){_0x1b5f4d=_0x1b5f4d-0x0;var _0x3f89a5=_0x5637[_0x1b5f4d];return _0x3f89a5;};'use strict';var Sequelize=require(_0x7563('0x0'));module['exports']={'name':{'type':Sequelize[_0x7563('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0607=['STRING','sequelize','exports'];(function(_0x1260a5,_0x2768e5){var _0x482d3f=function(_0x4022e7){while(--_0x4022e7){_0x1260a5['push'](_0x1260a5['shift']());}};_0x482d3f(++_0x2768e5);}(_0x0607,0x1d5));var _0x7060=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0607[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x7060('0x0'));module[_0x7060('0x1')]={'name':{'type':Sequelize[_0x7060('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b40654d..39b02da 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 _0x5b12=['findAll','rows','show','params','length','create','body','find','findOne','order','map','hasOwnProperty','nolimit','SugarcrmField','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/environment','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','stack','name','index','SugarcrmConfiguration','rawAttributes','keys','query','dateEnd','filters','intersection','model','attributes','fields','sort','where','pick','add','day','merge','dateStart','filter','options','include'];(function(_0x12d8e3,_0x1927ca){var _0x34e617=function(_0x3d44c9){while(--_0x3d44c9){_0x12d8e3['push'](_0x12d8e3['shift']());}};_0x34e617(++_0x1927ca);}(_0x5b12,0x1a0));var _0x25b1=function(_0xdbb7d3,_0x3da6d6){_0xdbb7d3=_0xdbb7d3-0x0;var _0x4be253=_0x5b12[_0xdbb7d3];return _0x4be253;};'use strict';var jsonpatch=require(_0x25b1('0x0'));var rp=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require(_0x25b1('0x3'));var Mustache=require(_0x25b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x25b1('0x5'));var csv=require(_0x25b1('0x6'));var ejs=require(_0x25b1('0x7'));var fs=require('fs');var _=require(_0x25b1('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25b1('0x9'));var deskjs=require(_0x25b1('0xa'));var toCsv=require('to-csv');var querystring=require(_0x25b1('0xb'));var Papa=require(_0x25b1('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x25b1('0xd'))('api');var utils=require('../../config/utils');var config=require(_0x25b1('0xe'));var db=require('../../mysqldb')['db'];var jayson=require(_0x25b1('0xf'));var client=jayson[_0x25b1('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdf6bd8,_0x5ba14a,_0xae416f,_0x41cf65){return new BPromise(function(_0x100a0f,_0x2c144c){var _0x3aa1ee=_0x41cf65||client;return _0x3aa1ee[_0x25b1('0x11')](_0xdf6bd8,_0xae416f)['then'](function(_0x31a562){logger[_0x25b1('0x12')](_0x25b1('0x13'),_0x5ba14a,_0x25b1('0x14'));logger[_0x25b1('0x15')](_0x25b1('0x16'),_0x5ba14a,'request\x20sent',JSON[_0x25b1('0x17')](_0x31a562));if(_0x31a562[_0x25b1('0x18')]){if(_0x31a562[_0x25b1('0x18')][_0x25b1('0x19')]===0x1f4){logger['error'](_0x25b1('0x13'),_0x5ba14a,_0x31a562[_0x25b1('0x18')]['message']);return _0x2c144c(_0x31a562[_0x25b1('0x18')][_0x25b1('0x1a')]);}logger[_0x25b1('0x18')](_0x25b1('0x13'),_0x5ba14a,_0x31a562['error'][_0x25b1('0x1a')]);return _0x100a0f(_0x31a562[_0x25b1('0x18')][_0x25b1('0x1a')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5ba14a,_0x25b1('0x14'));_0x100a0f(_0x31a562['result'][_0x25b1('0x1a')]);}})[_0x25b1('0x1b')](function(_0x225bd4){logger[_0x25b1('0x18')](_0x25b1('0x13'),_0x5ba14a,_0x225bd4);_0x2c144c(_0x225bd4);});});}function respondWithStatusCode(_0x45fb9a,_0x304c33){_0x304c33=_0x304c33||0xcc;return function(_0x737e1b){if(_0x737e1b){return _0x45fb9a[_0x25b1('0x1c')](_0x304c33);}return _0x45fb9a[_0x25b1('0x1d')](_0x304c33)[_0x25b1('0x1e')]();};}function respondWithResult(_0x4b18b1,_0x18fe21){_0x18fe21=_0x18fe21||0xc8;return function(_0x13ded3){if(_0x13ded3){return _0x4b18b1['status'](_0x18fe21)[_0x25b1('0x1f')](_0x13ded3);}};}function respondWithFilteredResult(_0x5d446f,_0x5e6393){return function(_0x399544){if(_0x399544){var _0x172b52=_0x399544[_0x25b1('0x20')],_0x20931b=_0x5e6393[_0x25b1('0x21')],_0x1b2e63=_0x5e6393['offset']+_0x5e6393[_0x25b1('0x22')],_0x37d2b6;if(_0x1b2e63>=_0x172b52){_0x1b2e63=_0x172b52;_0x37d2b6=0xc8;}else{_0x37d2b6=0xce;}_0x5d446f['status'](_0x37d2b6);return _0x5d446f['set'](_0x25b1('0x23'),_0x20931b+'-'+_0x1b2e63+'/'+_0x172b52)[_0x25b1('0x1f')](_0x399544);}return null;};}function patchUpdates(_0x542e34){return function(_0x5114f1){try{jsonpatch['apply'](_0x5114f1,_0x542e34,!![]);}catch(_0x5d19fa){return BPromise[_0x25b1('0x24')](_0x5d19fa);}return _0x5114f1[_0x25b1('0x25')]();};}function saveUpdates(_0x2104a0,_0x3ce976){return function(_0x253239){if(_0x253239){return _0x253239[_0x25b1('0x26')](_0x2104a0)['then'](function(_0x46fdaa){return _0x46fdaa;});}return null;};}function removeEntity(_0x25fe5c,_0xb4371e){return function(_0xe0de08){if(_0xe0de08){return _0xe0de08[_0x25b1('0x27')]()[_0x25b1('0x28')](function(){_0x25fe5c[_0x25b1('0x1d')](0xcc)[_0x25b1('0x1e')]();});}};}function handleEntityNotFound(_0x5380a5,_0x964d9a){return function(_0x278b05){if(!_0x278b05){_0x5380a5['sendStatus'](0x194);}return _0x278b05;};}function handleError(_0x4e19fb,_0x34f197){_0x34f197=_0x34f197||0x1f4;return function(_0x111c15){logger[_0x25b1('0x18')](_0x111c15[_0x25b1('0x29')]);if(_0x111c15['name']){delete _0x111c15[_0x25b1('0x2a')];}_0x4e19fb['status'](_0x34f197)['send'](_0x111c15);};}exports[_0x25b1('0x2b')]=function(_0x5034bd,_0x200318){var _0x1f5b24={},_0x511e40={},_0x18f533={'count':0x0,'rows':[]};var _0x1182e9=db[_0x25b1('0x2c')][_0x25b1('0x2d')];_0x511e40['model']=_[_0x25b1('0x2e')](_0x1182e9);var _0x34b2ca={'dateStart':_0x5034bd['query']['dateStart'],'dateEnd':_0x5034bd['query']['dateEnd']};delete _0x5034bd[_0x25b1('0x2f')]['dateStart'];delete _0x5034bd['query'][_0x25b1('0x30')];_0x511e40[_0x25b1('0x2f')]=_[_0x25b1('0x2e')](_0x5034bd['query']);_0x511e40[_0x25b1('0x31')]=_[_0x25b1('0x32')](_0x511e40[_0x25b1('0x33')],_0x511e40[_0x25b1('0x2f')]);_0x1f5b24[_0x25b1('0x34')]=_[_0x25b1('0x32')](_0x511e40[_0x25b1('0x33')],qs[_0x25b1('0x35')](_0x5034bd[_0x25b1('0x2f')][_0x25b1('0x35')]));_0x1f5b24[_0x25b1('0x34')]=_0x1f5b24[_0x25b1('0x34')]['length']?_0x1f5b24[_0x25b1('0x34')]:_0x511e40[_0x25b1('0x33')];if(!_0x5034bd[_0x25b1('0x2f')]['hasOwnProperty']('nolimit')){_0x1f5b24[_0x25b1('0x22')]=qs['limit'](_0x5034bd[_0x25b1('0x2f')]['limit']);_0x1f5b24['offset']=qs[_0x25b1('0x21')](_0x5034bd[_0x25b1('0x2f')]['offset']);}_0x1f5b24['order']=qs[_0x25b1('0x36')](_0x5034bd[_0x25b1('0x2f')][_0x25b1('0x36')]);_0x1f5b24[_0x25b1('0x37')]=qs[_0x25b1('0x31')](_[_0x25b1('0x38')](_0x5034bd[_0x25b1('0x2f')],_0x511e40['filters']));if(_0x34b2ca['dateStart']){if(_0x34b2ca['dateEnd']){_0x34b2ca[_0x25b1('0x30')]=moment(_0x34b2ca[_0x25b1('0x30')])[_0x25b1('0x39')](0x1,_0x25b1('0x3a'));}else{_0x34b2ca[_0x25b1('0x30')]=moment(_0x34b2ca['dateStart'])[_0x25b1('0x39')](0x1,'day');}_[_0x25b1('0x3b')](_0x1f5b24[_0x25b1('0x37')],{'createdAt':{'$gte':_0x34b2ca[_0x25b1('0x3c')],'$lte':_0x34b2ca[_0x25b1('0x30')]}});}if(_0x5034bd[_0x25b1('0x2f')][_0x25b1('0x3d')]){_0x1f5b24[_0x25b1('0x37')]=_[_0x25b1('0x3b')](_0x1f5b24[_0x25b1('0x37')],{'$or':_['map'](_0x1f5b24[_0x25b1('0x34')],function(_0x33c05e){var _0x348c9d={};_0x348c9d[_0x33c05e]={'$like':'%'+_0x5034bd['query'][_0x25b1('0x3d')]+'%'};return _0x348c9d;})});}_0x1f5b24=_['merge']({},_0x1f5b24,_0x5034bd[_0x25b1('0x3e')]);var _0x1198b9={'where':_0x1f5b24[_0x25b1('0x37')]};return db[_0x25b1('0x2c')][_0x25b1('0x20')](_0x1198b9)[_0x25b1('0x28')](function(_0x2e4677){_0x18f533[_0x25b1('0x20')]=_0x2e4677;if(_0x5034bd[_0x25b1('0x2f')]['includeAll']){_0x1f5b24[_0x25b1('0x3f')]=[{'all':!![]}];}return db[_0x25b1('0x2c')][_0x25b1('0x40')](_0x1f5b24);})[_0x25b1('0x28')](function(_0x1057a4){_0x18f533[_0x25b1('0x41')]=_0x1057a4;return _0x18f533;})[_0x25b1('0x28')](respondWithFilteredResult(_0x200318,_0x1f5b24))[_0x25b1('0x1b')](handleError(_0x200318,null));};exports[_0x25b1('0x42')]=function(_0x56e1e3,_0x3e7492){var _0x3d0f3c={'raw':![],'where':{'id':_0x56e1e3[_0x25b1('0x43')]['id']}},_0x5c1188={};_0x5c1188['model']=_[_0x25b1('0x2e')](db[_0x25b1('0x2c')]['rawAttributes']);_0x5c1188[_0x25b1('0x2f')]=_[_0x25b1('0x2e')](_0x56e1e3[_0x25b1('0x2f')]);_0x5c1188[_0x25b1('0x31')]=_[_0x25b1('0x32')](_0x5c1188[_0x25b1('0x33')],_0x5c1188['query']);_0x3d0f3c[_0x25b1('0x34')]=_[_0x25b1('0x32')](_0x5c1188[_0x25b1('0x33')],qs[_0x25b1('0x35')](_0x56e1e3[_0x25b1('0x2f')][_0x25b1('0x35')]));_0x3d0f3c[_0x25b1('0x34')]=_0x3d0f3c['attributes'][_0x25b1('0x44')]?_0x3d0f3c[_0x25b1('0x34')]:_0x5c1188[_0x25b1('0x33')];if(_0x56e1e3[_0x25b1('0x2f')]['includeAll']){_0x3d0f3c[_0x25b1('0x3f')]=[{'all':!![]}];}_0x3d0f3c=_[_0x25b1('0x3b')]({},_0x3d0f3c,_0x56e1e3[_0x25b1('0x3e')]);return db[_0x25b1('0x2c')]['find'](_0x3d0f3c)[_0x25b1('0x28')](handleEntityNotFound(_0x3e7492,null))[_0x25b1('0x28')](respondWithResult(_0x3e7492,null))[_0x25b1('0x1b')](handleError(_0x3e7492,null));};exports[_0x25b1('0x45')]=function(_0x285305,_0x526a18){return db[_0x25b1('0x2c')][_0x25b1('0x45')](_0x285305[_0x25b1('0x46')],{})[_0x25b1('0x28')](respondWithResult(_0x526a18,0xc9))[_0x25b1('0x1b')](handleError(_0x526a18,null));};exports[_0x25b1('0x26')]=function(_0x27d788,_0x1c663f){if(_0x27d788[_0x25b1('0x46')]['id']){delete _0x27d788[_0x25b1('0x46')]['id'];}return db[_0x25b1('0x2c')][_0x25b1('0x47')]({'where':{'id':_0x27d788[_0x25b1('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c663f,null))['then'](saveUpdates(_0x27d788['body'],null))[_0x25b1('0x28')](respondWithResult(_0x1c663f,null))[_0x25b1('0x1b')](handleError(_0x1c663f,null));};exports[_0x25b1('0x27')]=function(_0x3ec666,_0x514e86){return db[_0x25b1('0x2c')][_0x25b1('0x47')]({'where':{'id':_0x3ec666[_0x25b1('0x43')]['id']}})[_0x25b1('0x28')](handleEntityNotFound(_0x514e86,null))['then'](removeEntity(_0x514e86,null))[_0x25b1('0x1b')](handleError(_0x514e86,null));};exports['getFields']=function(_0x5de930,_0x20df44,_0x54280c){var _0x8ed55f={};var _0x3f85ac={};var _0x126f5a;var _0x589396;return db[_0x25b1('0x2c')][_0x25b1('0x48')]({'where':{'id':_0x5de930[_0x25b1('0x43')]['id']}})['then'](handleEntityNotFound(_0x20df44,null))[_0x25b1('0x28')](function(_0x1e8864){if(_0x1e8864){_0x126f5a=_0x1e8864;_0x3f85ac[_0x25b1('0x33')]=_[_0x25b1('0x2e')](db['SugarcrmField'][_0x25b1('0x2d')]);_0x3f85ac[_0x25b1('0x2f')]=_[_0x25b1('0x2e')](_0x5de930[_0x25b1('0x2f')]);_0x3f85ac[_0x25b1('0x31')]=_[_0x25b1('0x32')](_0x3f85ac[_0x25b1('0x33')],_0x3f85ac[_0x25b1('0x2f')]);_0x8ed55f[_0x25b1('0x34')]=_[_0x25b1('0x32')](_0x3f85ac[_0x25b1('0x33')],qs[_0x25b1('0x35')](_0x5de930[_0x25b1('0x2f')]['fields']));_0x8ed55f[_0x25b1('0x34')]=_0x8ed55f[_0x25b1('0x34')][_0x25b1('0x44')]?_0x8ed55f['attributes']:_0x3f85ac[_0x25b1('0x33')];_0x8ed55f[_0x25b1('0x49')]=qs[_0x25b1('0x36')](_0x5de930[_0x25b1('0x2f')][_0x25b1('0x36')]);_0x8ed55f[_0x25b1('0x37')]=qs[_0x25b1('0x31')](_[_0x25b1('0x38')](_0x5de930[_0x25b1('0x2f')],_0x3f85ac['filters']));if(_0x5de930['query'][_0x25b1('0x3d')]){_0x8ed55f[_0x25b1('0x37')]=_['merge'](_0x8ed55f[_0x25b1('0x37')],{'$or':_[_0x25b1('0x4a')](_0x8ed55f['attributes'],function(_0x342de8){var _0x2b79f2={};_0x2b79f2[_0x342de8]={'$like':'%'+_0x5de930[_0x25b1('0x2f')][_0x25b1('0x3d')]+'%'};return _0x2b79f2;})});}_0x8ed55f=_['merge']({},_0x8ed55f,_0x5de930[_0x25b1('0x3e')]);return _0x126f5a['getFields'](_0x8ed55f);}})[_0x25b1('0x28')](function(_0x323b1c){if(_0x323b1c){_0x589396=_0x323b1c[_0x25b1('0x44')];if(!_0x5de930[_0x25b1('0x2f')][_0x25b1('0x4b')](_0x25b1('0x4c'))){_0x8ed55f['limit']=qs['limit'](_0x5de930[_0x25b1('0x2f')][_0x25b1('0x22')]);_0x8ed55f[_0x25b1('0x21')]=qs[_0x25b1('0x21')](_0x5de930[_0x25b1('0x2f')]['offset']);}return _0x126f5a['getFields'](_0x8ed55f);}})[_0x25b1('0x28')](function(_0x53d354){if(_0x53d354){return _0x53d354?{'count':_0x589396,'rows':_0x53d354}:null;}})['then'](respondWithResult(_0x20df44,null))[_0x25b1('0x1b')](handleError(_0x20df44,null));};exports['getSubjects']=function(_0x343f4b,_0x158aae,_0x14de6e){var _0xe4cc84={};var _0x1056b2={};var _0x20c04d;var _0x46f401;return db[_0x25b1('0x2c')][_0x25b1('0x48')]({'where':{'id':_0x343f4b[_0x25b1('0x43')]['id']}})[_0x25b1('0x28')](handleEntityNotFound(_0x158aae,null))['then'](function(_0x320d02){if(_0x320d02){_0x20c04d=_0x320d02;_0x1056b2[_0x25b1('0x33')]=_['keys'](db[_0x25b1('0x4d')]['rawAttributes']);_0x1056b2['query']=_[_0x25b1('0x2e')](_0x343f4b[_0x25b1('0x2f')]);_0x1056b2[_0x25b1('0x31')]=_['intersection'](_0x1056b2[_0x25b1('0x33')],_0x1056b2[_0x25b1('0x2f')]);_0xe4cc84[_0x25b1('0x34')]=_[_0x25b1('0x32')](_0x1056b2[_0x25b1('0x33')],qs[_0x25b1('0x35')](_0x343f4b['query'][_0x25b1('0x35')]));_0xe4cc84[_0x25b1('0x34')]=_0xe4cc84[_0x25b1('0x34')][_0x25b1('0x44')]?_0xe4cc84[_0x25b1('0x34')]:_0x1056b2[_0x25b1('0x33')];_0xe4cc84[_0x25b1('0x49')]=qs['sort'](_0x343f4b[_0x25b1('0x2f')][_0x25b1('0x36')]);_0xe4cc84[_0x25b1('0x37')]=qs[_0x25b1('0x31')](_[_0x25b1('0x38')](_0x343f4b[_0x25b1('0x2f')],_0x1056b2[_0x25b1('0x31')]));if(_0x343f4b['query'][_0x25b1('0x3d')]){_0xe4cc84['where']=_[_0x25b1('0x3b')](_0xe4cc84[_0x25b1('0x37')],{'$or':_['map'](_0xe4cc84[_0x25b1('0x34')],function(_0x424ced){var _0x2b89e3={};_0x2b89e3[_0x424ced]={'$like':'%'+_0x343f4b[_0x25b1('0x2f')][_0x25b1('0x3d')]+'%'};return _0x2b89e3;})});}_0xe4cc84=_[_0x25b1('0x3b')]({},_0xe4cc84,_0x343f4b[_0x25b1('0x3e')]);return _0x20c04d[_0x25b1('0x4e')](_0xe4cc84);}})['then'](function(_0x452195){if(_0x452195){_0x46f401=_0x452195[_0x25b1('0x44')];if(!_0x343f4b[_0x25b1('0x2f')][_0x25b1('0x4b')](_0x25b1('0x4c'))){_0xe4cc84[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x343f4b[_0x25b1('0x2f')][_0x25b1('0x22')]);_0xe4cc84[_0x25b1('0x21')]=qs['offset'](_0x343f4b[_0x25b1('0x2f')][_0x25b1('0x21')]);}return _0x20c04d['getSubjects'](_0xe4cc84);}})['then'](function(_0x335922){if(_0x335922){return _0x335922?{'count':_0x46f401,'rows':_0x335922}:null;}})[_0x25b1('0x28')](respondWithResult(_0x158aae,null))['catch'](handleError(_0x158aae,null));};exports[_0x25b1('0x4f')]=function(_0x5ab66c,_0x3448eb,_0x2e129b){var _0x13ca0a={};var _0x1fe7f2={};var _0x25573c;var _0xfdf968;return db[_0x25b1('0x2c')][_0x25b1('0x48')]({'where':{'id':_0x5ab66c[_0x25b1('0x43')]['id']}})[_0x25b1('0x28')](handleEntityNotFound(_0x3448eb,null))[_0x25b1('0x28')](function(_0x472d9c){if(_0x472d9c){_0x25573c=_0x472d9c;_0x1fe7f2[_0x25b1('0x33')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x1fe7f2[_0x25b1('0x2f')]=_[_0x25b1('0x2e')](_0x5ab66c[_0x25b1('0x2f')]);_0x1fe7f2[_0x25b1('0x31')]=_[_0x25b1('0x32')](_0x1fe7f2['model'],_0x1fe7f2[_0x25b1('0x2f')]);_0x13ca0a['attributes']=_[_0x25b1('0x32')](_0x1fe7f2['model'],qs[_0x25b1('0x35')](_0x5ab66c['query'][_0x25b1('0x35')]));_0x13ca0a[_0x25b1('0x34')]=_0x13ca0a[_0x25b1('0x34')][_0x25b1('0x44')]?_0x13ca0a['attributes']:_0x1fe7f2[_0x25b1('0x33')];_0x13ca0a['order']=qs[_0x25b1('0x36')](_0x5ab66c['query']['sort']);_0x13ca0a['where']=qs['filters'](_[_0x25b1('0x38')](_0x5ab66c['query'],_0x1fe7f2['filters']));if(_0x5ab66c[_0x25b1('0x2f')]['filter']){_0x13ca0a[_0x25b1('0x37')]=_[_0x25b1('0x3b')](_0x13ca0a[_0x25b1('0x37')],{'$or':_[_0x25b1('0x4a')](_0x13ca0a['attributes'],function(_0x537f66){var _0x5989b3={};_0x5989b3[_0x537f66]={'$like':'%'+_0x5ab66c[_0x25b1('0x2f')]['filter']+'%'};return _0x5989b3;})});}_0x13ca0a=_[_0x25b1('0x3b')]({},_0x13ca0a,_0x5ab66c[_0x25b1('0x3e')]);return _0x25573c[_0x25b1('0x4f')](_0x13ca0a);}})['then'](function(_0x1f2029){if(_0x1f2029){_0xfdf968=_0x1f2029[_0x25b1('0x44')];if(!_0x5ab66c[_0x25b1('0x2f')][_0x25b1('0x4b')]('nolimit')){_0x13ca0a['limit']=qs[_0x25b1('0x22')](_0x5ab66c[_0x25b1('0x2f')][_0x25b1('0x22')]);_0x13ca0a[_0x25b1('0x21')]=qs[_0x25b1('0x21')](_0x5ab66c[_0x25b1('0x2f')][_0x25b1('0x21')]);}return _0x25573c[_0x25b1('0x4f')](_0x13ca0a);}})[_0x25b1('0x28')](function(_0x51e85b){if(_0x51e85b){return _0x51e85b?{'count':_0xfdf968,'rows':_0x51e85b}:null;}})[_0x25b1('0x28')](respondWithResult(_0x3448eb,null))[_0x25b1('0x1b')](handleError(_0x3448eb,null));}; \ No newline at end of file +var _0xb3ed=['options','include','findAll','rows','params','intersection','create','body','find','destroy','getFields','findOne','SugarcrmField','pick','nolimit','getSubjects','map','getDescriptions','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','jayson/promise','client','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','apply','reject','save','update','end','sendStatus','name','send','index','SugarcrmConfiguration','rawAttributes','model','query','dateStart','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','dateEnd','add','day','filter','merge'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xb3ed,0x66));var _0xdb3e=function(_0x17bdec,_0x8f7851){_0x17bdec=_0x17bdec-0x0;var _0x324e0b=_0xb3ed[_0x17bdec];return _0x324e0b;};'use strict';var jsonpatch=require(_0xdb3e('0x0'));var rp=require('request-promise');var moment=require(_0xdb3e('0x1'));var BPromise=require(_0xdb3e('0x2'));var Mustache=require('mustache');var util=require(_0xdb3e('0x3'));var path=require(_0xdb3e('0x4'));var sox=require(_0xdb3e('0x5'));var csv=require(_0xdb3e('0x6'));var ejs=require(_0xdb3e('0x7'));var fs=require('fs');var _=require(_0xdb3e('0x8'));var squel=require(_0xdb3e('0x9'));var crypto=require(_0xdb3e('0xa'));var jsforce=require(_0xdb3e('0xb'));var deskjs=require(_0xdb3e('0xc'));var toCsv=require(_0xdb3e('0x6'));var querystring=require(_0xdb3e('0xd'));var Papa=require(_0xdb3e('0xe'));var qs=require(_0xdb3e('0xf'));var logger=require(_0xdb3e('0x10'))('api');var utils=require(_0xdb3e('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xdb3e('0x12'));var client=jayson[_0xdb3e('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369b47,_0xdd5c03,_0x49b2c9,_0x28c176){return new BPromise(function(_0x3517,_0x396822){var _0x24b5dc=_0x28c176||client;return _0x24b5dc['request'](_0x369b47,_0x49b2c9)[_0xdb3e('0x14')](function(_0x18cc5a){logger[_0xdb3e('0x15')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xdd5c03,_0xdb3e('0x16'));logger[_0xdb3e('0x17')](_0xdb3e('0x18'),_0xdd5c03,_0xdb3e('0x16'),JSON[_0xdb3e('0x19')](_0x18cc5a));if(_0x18cc5a[_0xdb3e('0x1a')]){if(_0x18cc5a[_0xdb3e('0x1a')][_0xdb3e('0x1b')]===0x1f4){logger[_0xdb3e('0x1a')](_0xdb3e('0x1c'),_0xdd5c03,_0x18cc5a[_0xdb3e('0x1a')][_0xdb3e('0x1d')]);return _0x396822(_0x18cc5a[_0xdb3e('0x1a')][_0xdb3e('0x1d')]);}logger['error'](_0xdb3e('0x1c'),_0xdd5c03,_0x18cc5a[_0xdb3e('0x1a')][_0xdb3e('0x1d')]);return _0x3517(_0x18cc5a[_0xdb3e('0x1a')][_0xdb3e('0x1d')]);}else{logger[_0xdb3e('0x15')](_0xdb3e('0x1c'),_0xdd5c03,_0xdb3e('0x16'));_0x3517(_0x18cc5a[_0xdb3e('0x1e')]['message']);}})[_0xdb3e('0x1f')](function(_0xd047ea){logger[_0xdb3e('0x1a')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xdd5c03,_0xd047ea);_0x396822(_0xd047ea);});});}function respondWithStatusCode(_0x35ddf5,_0x231909){_0x231909=_0x231909||0xcc;return function(_0x1d1fd4){if(_0x1d1fd4){return _0x35ddf5['sendStatus'](_0x231909);}return _0x35ddf5[_0xdb3e('0x20')](_0x231909)['end']();};}function respondWithResult(_0x567f4c,_0x2578a2){_0x2578a2=_0x2578a2||0xc8;return function(_0x2839c7){if(_0x2839c7){return _0x567f4c[_0xdb3e('0x20')](_0x2578a2)[_0xdb3e('0x21')](_0x2839c7);}};}function respondWithFilteredResult(_0x2633e5,_0x444d60){return function(_0x1ff8d6){if(_0x1ff8d6){var _0x464b9b=_0x1ff8d6[_0xdb3e('0x22')],_0x380631=_0x444d60[_0xdb3e('0x23')],_0x44cfc8=_0x444d60[_0xdb3e('0x23')]+_0x444d60[_0xdb3e('0x24')],_0x2a759d;if(_0x44cfc8>=_0x464b9b){_0x44cfc8=_0x464b9b;_0x2a759d=0xc8;}else{_0x2a759d=0xce;}_0x2633e5['status'](_0x2a759d);return _0x2633e5[_0xdb3e('0x25')]('Content-Range',_0x380631+'-'+_0x44cfc8+'/'+_0x464b9b)['json'](_0x1ff8d6);}return null;};}function patchUpdates(_0x525177){return function(_0x102f41){try{jsonpatch[_0xdb3e('0x26')](_0x102f41,_0x525177,!![]);}catch(_0x561466){return BPromise[_0xdb3e('0x27')](_0x561466);}return _0x102f41[_0xdb3e('0x28')]();};}function saveUpdates(_0x1ab7a2,_0x5d593b){return function(_0x12e0b0){if(_0x12e0b0){return _0x12e0b0[_0xdb3e('0x29')](_0x1ab7a2)[_0xdb3e('0x14')](function(_0x4f219d){return _0x4f219d;});}return null;};}function removeEntity(_0x1fb6c7,_0x281fbb){return function(_0x3d1452){if(_0x3d1452){return _0x3d1452['destroy']()['then'](function(){_0x1fb6c7['status'](0xcc)[_0xdb3e('0x2a')]();});}};}function handleEntityNotFound(_0x52c9ba,_0x1be426){return function(_0x5d224b){if(!_0x5d224b){_0x52c9ba[_0xdb3e('0x2b')](0x194);}return _0x5d224b;};}function handleError(_0x5ea290,_0x545d66){_0x545d66=_0x545d66||0x1f4;return function(_0x1bc740){logger['error'](_0x1bc740['stack']);if(_0x1bc740[_0xdb3e('0x2c')]){delete _0x1bc740['name'];}_0x5ea290[_0xdb3e('0x20')](_0x545d66)[_0xdb3e('0x2d')](_0x1bc740);};}exports[_0xdb3e('0x2e')]=function(_0x257551,_0x5b1fd2){var _0x21df76={},_0xe93f1f={},_0x15c146={'count':0x0,'rows':[]};var _0x2c09fb=db[_0xdb3e('0x2f')][_0xdb3e('0x30')];_0xe93f1f[_0xdb3e('0x31')]=_['keys'](_0x2c09fb);var _0x36b63f={'dateStart':_0x257551[_0xdb3e('0x32')][_0xdb3e('0x33')],'dateEnd':_0x257551[_0xdb3e('0x32')]['dateEnd']};delete _0x257551[_0xdb3e('0x32')][_0xdb3e('0x33')];delete _0x257551[_0xdb3e('0x32')]['dateEnd'];_0xe93f1f[_0xdb3e('0x32')]=_[_0xdb3e('0x34')](_0x257551['query']);_0xe93f1f[_0xdb3e('0x35')]=_['intersection'](_0xe93f1f['model'],_0xe93f1f['query']);_0x21df76['attributes']=_['intersection'](_0xe93f1f[_0xdb3e('0x31')],qs[_0xdb3e('0x36')](_0x257551[_0xdb3e('0x32')][_0xdb3e('0x36')]));_0x21df76[_0xdb3e('0x37')]=_0x21df76[_0xdb3e('0x37')][_0xdb3e('0x38')]?_0x21df76[_0xdb3e('0x37')]:_0xe93f1f[_0xdb3e('0x31')];if(!_0x257551[_0xdb3e('0x32')][_0xdb3e('0x39')]('nolimit')){_0x21df76[_0xdb3e('0x24')]=qs[_0xdb3e('0x24')](_0x257551[_0xdb3e('0x32')][_0xdb3e('0x24')]);_0x21df76[_0xdb3e('0x23')]=qs[_0xdb3e('0x23')](_0x257551[_0xdb3e('0x32')][_0xdb3e('0x23')]);}_0x21df76[_0xdb3e('0x3a')]=qs[_0xdb3e('0x3b')](_0x257551['query'][_0xdb3e('0x3b')]);_0x21df76[_0xdb3e('0x3c')]=qs[_0xdb3e('0x35')](_['pick'](_0x257551['query'],_0xe93f1f[_0xdb3e('0x35')]));if(_0x36b63f[_0xdb3e('0x33')]){if(_0x36b63f[_0xdb3e('0x3d')]){_0x36b63f[_0xdb3e('0x3d')]=moment(_0x36b63f[_0xdb3e('0x3d')])[_0xdb3e('0x3e')](0x1,_0xdb3e('0x3f'));}else{_0x36b63f[_0xdb3e('0x3d')]=moment(_0x36b63f[_0xdb3e('0x33')])[_0xdb3e('0x3e')](0x1,_0xdb3e('0x3f'));}_['merge'](_0x21df76['where'],{'createdAt':{'$gte':_0x36b63f[_0xdb3e('0x33')],'$lte':_0x36b63f[_0xdb3e('0x3d')]}});}if(_0x257551[_0xdb3e('0x32')][_0xdb3e('0x40')]){_0x21df76[_0xdb3e('0x3c')]=_[_0xdb3e('0x41')](_0x21df76[_0xdb3e('0x3c')],{'$or':_['map'](_0x21df76['attributes'],function(_0x2684ce){var _0x42cbf5={};_0x42cbf5[_0x2684ce]={'$like':'%'+_0x257551[_0xdb3e('0x32')][_0xdb3e('0x40')]+'%'};return _0x42cbf5;})});}_0x21df76=_[_0xdb3e('0x41')]({},_0x21df76,_0x257551[_0xdb3e('0x42')]);var _0x73c42e={'where':_0x21df76[_0xdb3e('0x3c')]};return db[_0xdb3e('0x2f')][_0xdb3e('0x22')](_0x73c42e)[_0xdb3e('0x14')](function(_0x3296ba){_0x15c146[_0xdb3e('0x22')]=_0x3296ba;if(_0x257551[_0xdb3e('0x32')]['includeAll']){_0x21df76[_0xdb3e('0x43')]=[{'all':!![]}];}return db[_0xdb3e('0x2f')][_0xdb3e('0x44')](_0x21df76);})['then'](function(_0x58b35d){_0x15c146[_0xdb3e('0x45')]=_0x58b35d;return _0x15c146;})[_0xdb3e('0x14')](respondWithFilteredResult(_0x5b1fd2,_0x21df76))['catch'](handleError(_0x5b1fd2,null));};exports['show']=function(_0x3acb8f,_0x57e312){var _0x26ff23={'raw':![],'where':{'id':_0x3acb8f[_0xdb3e('0x46')]['id']}},_0x4ff017={};_0x4ff017['model']=_[_0xdb3e('0x34')](db['SugarcrmConfiguration'][_0xdb3e('0x30')]);_0x4ff017[_0xdb3e('0x32')]=_[_0xdb3e('0x34')](_0x3acb8f[_0xdb3e('0x32')]);_0x4ff017['filters']=_[_0xdb3e('0x47')](_0x4ff017[_0xdb3e('0x31')],_0x4ff017[_0xdb3e('0x32')]);_0x26ff23[_0xdb3e('0x37')]=_[_0xdb3e('0x47')](_0x4ff017[_0xdb3e('0x31')],qs['fields'](_0x3acb8f[_0xdb3e('0x32')][_0xdb3e('0x36')]));_0x26ff23['attributes']=_0x26ff23['attributes'][_0xdb3e('0x38')]?_0x26ff23[_0xdb3e('0x37')]:_0x4ff017[_0xdb3e('0x31')];if(_0x3acb8f['query']['includeAll']){_0x26ff23['include']=[{'all':!![]}];}_0x26ff23=_[_0xdb3e('0x41')]({},_0x26ff23,_0x3acb8f[_0xdb3e('0x42')]);return db['SugarcrmConfiguration']['find'](_0x26ff23)['then'](handleEntityNotFound(_0x57e312,null))['then'](respondWithResult(_0x57e312,null))[_0xdb3e('0x1f')](handleError(_0x57e312,null));};exports[_0xdb3e('0x48')]=function(_0x32b3f6,_0x2800da){return db[_0xdb3e('0x2f')][_0xdb3e('0x48')](_0x32b3f6['body'],{})[_0xdb3e('0x14')](respondWithResult(_0x2800da,0xc9))[_0xdb3e('0x1f')](handleError(_0x2800da,null));};exports['update']=function(_0x890df3,_0x40d79d){if(_0x890df3[_0xdb3e('0x49')]['id']){delete _0x890df3[_0xdb3e('0x49')]['id'];}return db[_0xdb3e('0x2f')][_0xdb3e('0x4a')]({'where':{'id':_0x890df3[_0xdb3e('0x46')]['id']}})[_0xdb3e('0x14')](handleEntityNotFound(_0x40d79d,null))[_0xdb3e('0x14')](saveUpdates(_0x890df3[_0xdb3e('0x49')],null))['then'](respondWithResult(_0x40d79d,null))['catch'](handleError(_0x40d79d,null));};exports[_0xdb3e('0x4b')]=function(_0xf4fd6c,_0x53db53){return db[_0xdb3e('0x2f')]['find']({'where':{'id':_0xf4fd6c[_0xdb3e('0x46')]['id']}})[_0xdb3e('0x14')](handleEntityNotFound(_0x53db53,null))[_0xdb3e('0x14')](removeEntity(_0x53db53,null))[_0xdb3e('0x1f')](handleError(_0x53db53,null));};exports[_0xdb3e('0x4c')]=function(_0x502649,_0x1b51b0,_0x1d3d1f){var _0x1f6c38={};var _0x33f5a0={};var _0x21b8fb;var _0x56894a;return db[_0xdb3e('0x2f')][_0xdb3e('0x4d')]({'where':{'id':_0x502649['params']['id']}})[_0xdb3e('0x14')](handleEntityNotFound(_0x1b51b0,null))['then'](function(_0x1b3598){if(_0x1b3598){_0x21b8fb=_0x1b3598;_0x33f5a0[_0xdb3e('0x31')]=_[_0xdb3e('0x34')](db[_0xdb3e('0x4e')][_0xdb3e('0x30')]);_0x33f5a0['query']=_['keys'](_0x502649['query']);_0x33f5a0[_0xdb3e('0x35')]=_['intersection'](_0x33f5a0[_0xdb3e('0x31')],_0x33f5a0[_0xdb3e('0x32')]);_0x1f6c38['attributes']=_['intersection'](_0x33f5a0[_0xdb3e('0x31')],qs['fields'](_0x502649['query'][_0xdb3e('0x36')]));_0x1f6c38[_0xdb3e('0x37')]=_0x1f6c38[_0xdb3e('0x37')][_0xdb3e('0x38')]?_0x1f6c38[_0xdb3e('0x37')]:_0x33f5a0['model'];_0x1f6c38['order']=qs[_0xdb3e('0x3b')](_0x502649[_0xdb3e('0x32')][_0xdb3e('0x3b')]);_0x1f6c38[_0xdb3e('0x3c')]=qs[_0xdb3e('0x35')](_[_0xdb3e('0x4f')](_0x502649[_0xdb3e('0x32')],_0x33f5a0[_0xdb3e('0x35')]));if(_0x502649[_0xdb3e('0x32')][_0xdb3e('0x40')]){_0x1f6c38['where']=_['merge'](_0x1f6c38[_0xdb3e('0x3c')],{'$or':_['map'](_0x1f6c38[_0xdb3e('0x37')],function(_0x2037a5){var _0xd213f9={};_0xd213f9[_0x2037a5]={'$like':'%'+_0x502649[_0xdb3e('0x32')][_0xdb3e('0x40')]+'%'};return _0xd213f9;})});}_0x1f6c38=_['merge']({},_0x1f6c38,_0x502649[_0xdb3e('0x42')]);return _0x21b8fb['getFields'](_0x1f6c38);}})['then'](function(_0x25de66){if(_0x25de66){_0x56894a=_0x25de66['length'];if(!_0x502649[_0xdb3e('0x32')]['hasOwnProperty'](_0xdb3e('0x50'))){_0x1f6c38['limit']=qs[_0xdb3e('0x24')](_0x502649[_0xdb3e('0x32')][_0xdb3e('0x24')]);_0x1f6c38[_0xdb3e('0x23')]=qs[_0xdb3e('0x23')](_0x502649[_0xdb3e('0x32')]['offset']);}return _0x21b8fb[_0xdb3e('0x4c')](_0x1f6c38);}})[_0xdb3e('0x14')](function(_0x174ddf){if(_0x174ddf){return _0x174ddf?{'count':_0x56894a,'rows':_0x174ddf}:null;}})[_0xdb3e('0x14')](respondWithResult(_0x1b51b0,null))[_0xdb3e('0x1f')](handleError(_0x1b51b0,null));};exports[_0xdb3e('0x51')]=function(_0x38629d,_0x26cfd7,_0x22ce5b){var _0x2f86dc={};var _0x45f7c0={};var _0x5ba094;var _0x41ff8c;return db[_0xdb3e('0x2f')]['findOne']({'where':{'id':_0x38629d[_0xdb3e('0x46')]['id']}})[_0xdb3e('0x14')](handleEntityNotFound(_0x26cfd7,null))['then'](function(_0x158710){if(_0x158710){_0x5ba094=_0x158710;_0x45f7c0[_0xdb3e('0x31')]=_[_0xdb3e('0x34')](db[_0xdb3e('0x4e')][_0xdb3e('0x30')]);_0x45f7c0[_0xdb3e('0x32')]=_[_0xdb3e('0x34')](_0x38629d[_0xdb3e('0x32')]);_0x45f7c0[_0xdb3e('0x35')]=_[_0xdb3e('0x47')](_0x45f7c0[_0xdb3e('0x31')],_0x45f7c0[_0xdb3e('0x32')]);_0x2f86dc[_0xdb3e('0x37')]=_[_0xdb3e('0x47')](_0x45f7c0[_0xdb3e('0x31')],qs[_0xdb3e('0x36')](_0x38629d[_0xdb3e('0x32')][_0xdb3e('0x36')]));_0x2f86dc[_0xdb3e('0x37')]=_0x2f86dc[_0xdb3e('0x37')][_0xdb3e('0x38')]?_0x2f86dc[_0xdb3e('0x37')]:_0x45f7c0[_0xdb3e('0x31')];_0x2f86dc[_0xdb3e('0x3a')]=qs[_0xdb3e('0x3b')](_0x38629d[_0xdb3e('0x32')][_0xdb3e('0x3b')]);_0x2f86dc[_0xdb3e('0x3c')]=qs[_0xdb3e('0x35')](_[_0xdb3e('0x4f')](_0x38629d[_0xdb3e('0x32')],_0x45f7c0[_0xdb3e('0x35')]));if(_0x38629d[_0xdb3e('0x32')][_0xdb3e('0x40')]){_0x2f86dc[_0xdb3e('0x3c')]=_[_0xdb3e('0x41')](_0x2f86dc[_0xdb3e('0x3c')],{'$or':_[_0xdb3e('0x52')](_0x2f86dc[_0xdb3e('0x37')],function(_0x43b467){var _0x1452eb={};_0x1452eb[_0x43b467]={'$like':'%'+_0x38629d['query']['filter']+'%'};return _0x1452eb;})});}_0x2f86dc=_[_0xdb3e('0x41')]({},_0x2f86dc,_0x38629d[_0xdb3e('0x42')]);return _0x5ba094[_0xdb3e('0x51')](_0x2f86dc);}})['then'](function(_0x4989ec){if(_0x4989ec){_0x41ff8c=_0x4989ec[_0xdb3e('0x38')];if(!_0x38629d[_0xdb3e('0x32')]['hasOwnProperty'](_0xdb3e('0x50'))){_0x2f86dc['limit']=qs[_0xdb3e('0x24')](_0x38629d['query'][_0xdb3e('0x24')]);_0x2f86dc[_0xdb3e('0x23')]=qs[_0xdb3e('0x23')](_0x38629d[_0xdb3e('0x32')][_0xdb3e('0x23')]);}return _0x5ba094[_0xdb3e('0x51')](_0x2f86dc);}})[_0xdb3e('0x14')](function(_0x33e637){if(_0x33e637){return _0x33e637?{'count':_0x41ff8c,'rows':_0x33e637}:null;}})['then'](respondWithResult(_0x26cfd7,null))[_0xdb3e('0x1f')](handleError(_0x26cfd7,null));};exports[_0xdb3e('0x53')]=function(_0x2cf3fe,_0x6e31a3,_0x5dac50){var _0x60544f={};var _0x3be062={};var _0x1417c9;var _0x50a3a4;return db[_0xdb3e('0x2f')][_0xdb3e('0x4d')]({'where':{'id':_0x2cf3fe[_0xdb3e('0x46')]['id']}})[_0xdb3e('0x14')](handleEntityNotFound(_0x6e31a3,null))['then'](function(_0x4f9b20){if(_0x4f9b20){_0x1417c9=_0x4f9b20;_0x3be062[_0xdb3e('0x31')]=_[_0xdb3e('0x34')](db['SugarcrmField']['rawAttributes']);_0x3be062[_0xdb3e('0x32')]=_[_0xdb3e('0x34')](_0x2cf3fe[_0xdb3e('0x32')]);_0x3be062[_0xdb3e('0x35')]=_[_0xdb3e('0x47')](_0x3be062['model'],_0x3be062[_0xdb3e('0x32')]);_0x60544f[_0xdb3e('0x37')]=_['intersection'](_0x3be062[_0xdb3e('0x31')],qs[_0xdb3e('0x36')](_0x2cf3fe['query'][_0xdb3e('0x36')]));_0x60544f[_0xdb3e('0x37')]=_0x60544f[_0xdb3e('0x37')][_0xdb3e('0x38')]?_0x60544f[_0xdb3e('0x37')]:_0x3be062['model'];_0x60544f['order']=qs[_0xdb3e('0x3b')](_0x2cf3fe['query'][_0xdb3e('0x3b')]);_0x60544f[_0xdb3e('0x3c')]=qs[_0xdb3e('0x35')](_['pick'](_0x2cf3fe['query'],_0x3be062[_0xdb3e('0x35')]));if(_0x2cf3fe[_0xdb3e('0x32')]['filter']){_0x60544f[_0xdb3e('0x3c')]=_[_0xdb3e('0x41')](_0x60544f[_0xdb3e('0x3c')],{'$or':_[_0xdb3e('0x52')](_0x60544f['attributes'],function(_0x240982){var _0x2a3ef0={};_0x2a3ef0[_0x240982]={'$like':'%'+_0x2cf3fe[_0xdb3e('0x32')][_0xdb3e('0x40')]+'%'};return _0x2a3ef0;})});}_0x60544f=_[_0xdb3e('0x41')]({},_0x60544f,_0x2cf3fe[_0xdb3e('0x42')]);return _0x1417c9[_0xdb3e('0x53')](_0x60544f);}})[_0xdb3e('0x14')](function(_0x11ef48){if(_0x11ef48){_0x50a3a4=_0x11ef48[_0xdb3e('0x38')];if(!_0x2cf3fe[_0xdb3e('0x32')][_0xdb3e('0x39')](_0xdb3e('0x50'))){_0x60544f[_0xdb3e('0x24')]=qs[_0xdb3e('0x24')](_0x2cf3fe[_0xdb3e('0x32')][_0xdb3e('0x24')]);_0x60544f[_0xdb3e('0x23')]=qs[_0xdb3e('0x23')](_0x2cf3fe[_0xdb3e('0x32')][_0xdb3e('0x23')]);}return _0x1417c9[_0xdb3e('0x53')](_0x60544f);}})[_0xdb3e('0x14')](function(_0x245680){if(_0x245680){return _0x245680?{'count':_0x50a3a4,'rows':_0x245680}:null;}})[_0xdb3e('0x14')](respondWithResult(_0x6e31a3,null))[_0xdb3e('0x1f')](handleError(_0x6e31a3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index b5707ce..494231f 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 _0x8185=['api','moment','bluebird','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x8185,0x127));var _0x5818=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x8185[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var logger=require('../../config/logger')(_0x5818('0x2'));var moment=require(_0x5818('0x3'));var BPromise=require(_0x5818('0x4'));var rp=require('request-promise');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x5818('0x5')]=function(_0x45fa9d,_0x3b34d7){return _0x45fa9d[_0x5818('0x6')](_0x5818('0x7'),attributes,{'tableName':_0x5818('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x287f=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration'];(function(_0x1cff96,_0x2d9558){var _0x305c1d=function(_0x58836e){while(--_0x58836e){_0x1cff96['push'](_0x1cff96['shift']());}};_0x305c1d(++_0x2d9558);}(_0x287f,0xc7));var _0xf287=function(_0x1afe40,_0x824761){_0x1afe40=_0x1afe40-0x0;var _0x243412=_0x287f[_0x1afe40];return _0x243412;};'use strict';var _=require(_0xf287('0x0'));var util=require(_0xf287('0x1'));var logger=require(_0xf287('0x2'))(_0xf287('0x3'));var moment=require(_0xf287('0x4'));var BPromise=require(_0xf287('0x5'));var rp=require(_0xf287('0x6'));var attributes=require(_0xf287('0x7'));module['exports']=function(_0x227063,_0x33b68e){return _0x227063[_0xf287('0x8')](_0xf287('0x9'),attributes,{'tableName':_0xf287('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index b0d1253..344f5a3 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 _0xfd94=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1dbc00,_0x40f065){var _0x4dd6cd=function(_0x5df660){while(--_0x5df660){_0x1dbc00['push'](_0x1dbc00['shift']());}};_0x4dd6cd(++_0x40f065);}(_0xfd94,0x194));var _0x4fd9=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xfd94[_0x2d126e];return _0xcb04d3;};'use strict';var _=require(_0x4fd9('0x0'));var util=require(_0x4fd9('0x1'));var moment=require('moment');var BPromise=require(_0x4fd9('0x2'));var rs=require(_0x4fd9('0x3'));var fs=require('fs');var db=require(_0x4fd9('0x4'))['db'];var utils=require(_0x4fd9('0x5'));var logger=require(_0x4fd9('0x6'))(_0x4fd9('0x7'));var config=require('../../config/environment');var jayson=require(_0x4fd9('0x8'));var client=jayson[_0x4fd9('0x9')][_0x4fd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x366d7f,_0x36ad04,_0x1ed3e7){return new BPromise(function(_0x5def01,_0x1cd970){return client['request'](_0x366d7f,_0x1ed3e7)[_0x4fd9('0xb')](function(_0x2aeece){logger[_0x4fd9('0xc')](_0x4fd9('0xd'),_0x36ad04,_0x4fd9('0xe'));logger[_0x4fd9('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x36ad04,_0x4fd9('0xe'),JSON[_0x4fd9('0x10')](_0x2aeece));if(_0x2aeece[_0x4fd9('0x11')]){if(_0x2aeece['error'][_0x4fd9('0x12')]===0x1f4){logger['error'](_0x4fd9('0xd'),_0x36ad04,_0x2aeece[_0x4fd9('0x11')][_0x4fd9('0x13')]);return _0x1cd970(_0x2aeece['error'][_0x4fd9('0x13')]);}logger[_0x4fd9('0x11')](_0x4fd9('0xd'),_0x36ad04,_0x2aeece['error'][_0x4fd9('0x13')]);return _0x5def01(_0x2aeece[_0x4fd9('0x11')][_0x4fd9('0x13')]);}else{logger[_0x4fd9('0xc')](_0x4fd9('0xd'),_0x36ad04,_0x4fd9('0xe'));_0x5def01(_0x2aeece[_0x4fd9('0x14')][_0x4fd9('0x13')]);}})['catch'](function(_0x5dfd7e){logger['error'](_0x4fd9('0xd'),_0x36ad04,_0x5dfd7e);_0x1cd970(_0x5dfd7e);});});} \ No newline at end of file +var _0xbc22=['../../config/logger','rpc','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5a7f03,_0x3975c3){var _0x234e42=function(_0x5ed0a6){while(--_0x5ed0a6){_0x5a7f03['push'](_0x5a7f03['shift']());}};_0x234e42(++_0x3975c3);}(_0xbc22,0xd5));var _0x2bc2=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xbc22[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0x2bc2('0x0'));var util=require(_0x2bc2('0x1'));var moment=require(_0x2bc2('0x2'));var BPromise=require(_0x2bc2('0x3'));var rs=require(_0x2bc2('0x4'));var fs=require('fs');var db=require(_0x2bc2('0x5'))['db'];var utils=require(_0x2bc2('0x6'));var logger=require(_0x2bc2('0x7'))(_0x2bc2('0x8'));var config=require('../../config/environment');var jayson=require(_0x2bc2('0x9'));var client=jayson['client'][_0x2bc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22e328,_0x3db8b7,_0x2ee6b9){return new BPromise(function(_0xca6c20,_0x9c1019){return client[_0x2bc2('0xb')](_0x22e328,_0x2ee6b9)[_0x2bc2('0xc')](function(_0x783d1){logger['info'](_0x2bc2('0xd'),_0x3db8b7,_0x2bc2('0xe'));logger[_0x2bc2('0xf')](_0x2bc2('0x10'),_0x3db8b7,_0x2bc2('0xe'),JSON[_0x2bc2('0x11')](_0x783d1));if(_0x783d1['error']){if(_0x783d1[_0x2bc2('0x12')][_0x2bc2('0x13')]===0x1f4){logger[_0x2bc2('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3db8b7,_0x783d1[_0x2bc2('0x12')]['message']);return _0x9c1019(_0x783d1[_0x2bc2('0x12')][_0x2bc2('0x14')]);}logger[_0x2bc2('0x12')](_0x2bc2('0xd'),_0x3db8b7,_0x783d1[_0x2bc2('0x12')][_0x2bc2('0x14')]);return _0xca6c20(_0x783d1[_0x2bc2('0x12')]['message']);}else{logger['info'](_0x2bc2('0xd'),_0x3db8b7,_0x2bc2('0xe'));_0xca6c20(_0x783d1['result'][_0x2bc2('0x14')]);}})[_0x2bc2('0x15')](function(_0x26b1c4){logger[_0x2bc2('0x12')](_0x2bc2('0xd'),_0x3db8b7,_0x26b1c4);_0x9c1019(_0x26b1c4);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 8af3934..6b3b001 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 _0xe0ae=['post','create','update','delete','destroy','path','express','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','/:id','show'];(function(_0x5f580e,_0x30b652){var _0x3ae2e5=function(_0x557ae6){while(--_0x557ae6){_0x5f580e['push'](_0x5f580e['shift']());}};_0x3ae2e5(++_0x30b652);}(_0xe0ae,0xa1));var _0xee0a=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0xe0ae[_0x3ab928];return _0xf47692;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var express=require(_0xee0a('0x1'));var router=express['Router']();var auth=require(_0xee0a('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xee0a('0x3'));var controller=require(_0xee0a('0x4'));router['get']('/',auth[_0xee0a('0x5')](),controller['index']);router['get'](_0xee0a('0x6'),auth[_0xee0a('0x5')](),controller[_0xee0a('0x7')]);router[_0xee0a('0x8')]('/',auth['isAuthenticated'](),controller[_0xee0a('0x9')]);router['put']('/:id',auth[_0xee0a('0x5')](),controller[_0xee0a('0xa')]);router[_0xee0a('0xb')]('/:id',auth[_0xee0a('0x5')](),controller[_0xee0a('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8ef6=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x8ef6,0xf2));var _0x68ef=function(_0x392b2e,_0x400c61){_0x392b2e=_0x392b2e-0x0;var _0x2e98a2=_0x8ef6[_0x392b2e];return _0x2e98a2;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var express=require(_0x68ef('0x3'));var router=express[_0x68ef('0x4')]();var auth=require(_0x68ef('0x5'));var interaction=require(_0x68ef('0x6'));var config=require('../../config/environment');var controller=require(_0x68ef('0x7'));router[_0x68ef('0x8')]('/',auth[_0x68ef('0x9')](),controller[_0x68ef('0xa')]);router['get']('/:id',auth[_0x68ef('0x9')](),controller[_0x68ef('0xb')]);router[_0x68ef('0xc')]('/',auth['isAuthenticated'](),controller[_0x68ef('0xd')]);router[_0x68ef('0xe')](_0x68ef('0xf'),auth[_0x68ef('0x9')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xf'),auth[_0x68ef('0x9')](),controller[_0x68ef('0x12')]);module[_0x68ef('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8e69ce7..7427843 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 _0xb4e6=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xb4e6[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'type':{'type':Sequelize[_0x6b4e('0x1')](_0x6b4e('0x2'),_0x6b4e('0x3'),_0x6b4e('0x4'),_0x6b4e('0x5')),'defaultValue':_0x6b4e('0x2')},'content':{'type':Sequelize[_0x6b4e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6b4e('0x1')](_0x6b4e('0x2'),_0x6b4e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6b4e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6b4e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda3f=['keyValue','STRING','string','variable','BOOLEAN','exports','ENUM'];(function(_0xe50a56,_0x3fe8e8){var _0x51f953=function(_0x3dfc34){while(--_0x3dfc34){_0xe50a56['push'](_0xe50a56['shift']());}};_0x51f953(++_0x3fe8e8);}(_0xda3f,0xec));var _0xfda3=function(_0xf3d987,_0x9e6eed){_0xf3d987=_0xf3d987-0x0;var _0x4dedf8=_0xda3f[_0xf3d987];return _0x4dedf8;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'type':{'type':Sequelize[_0xfda3('0x1')]('string','variable','customVariable',_0xfda3('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfda3('0x3')]},'key':{'type':Sequelize[_0xfda3('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0xfda3('0x4'),_0xfda3('0x5'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfda3('0x3')]},'nameField':{'type':Sequelize[_0xfda3('0x3')]},'customField':{'type':Sequelize[_0xfda3('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfda3('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 7036a35..f16e24e 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 _0xf430=['add','day','merge','where','map','filter','options','SugarcrmField','then','count','includeAll','rows','catch','params','include','find','create','body','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','update','error','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf430,0xd5));var _0x0f43=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0xf430[_0x154940];return _0x401409;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0f43('0x0'));var BPromise=require(_0x0f43('0x1'));var Mustache=require('mustache');var util=require(_0x0f43('0x2'));var path=require(_0x0f43('0x3'));var sox=require(_0x0f43('0x4'));var csv=require(_0x0f43('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f43('0x6'));var squel=require(_0x0f43('0x7'));var crypto=require(_0x0f43('0x8'));var jsforce=require(_0x0f43('0x9'));var deskjs=require(_0x0f43('0xa'));var toCsv=require(_0x0f43('0x5'));var querystring=require(_0x0f43('0xb'));var Papa=require(_0x0f43('0xc'));var qs=require(_0x0f43('0xd'));var logger=require(_0x0f43('0xe'))(_0x0f43('0xf'));var utils=require(_0x0f43('0x10'));var config=require(_0x0f43('0x11'));var db=require(_0x0f43('0x12'))['db'];function respondWithStatusCode(_0x2c70fe,_0x4dd231){_0x4dd231=_0x4dd231||0xcc;return function(_0x2950af){if(_0x2950af){return _0x2c70fe[_0x0f43('0x13')](_0x4dd231);}return _0x2c70fe[_0x0f43('0x14')](_0x4dd231)[_0x0f43('0x15')]();};}function respondWithResult(_0x4c03da,_0x139d08){_0x139d08=_0x139d08||0xc8;return function(_0x2ad00b){if(_0x2ad00b){return _0x4c03da[_0x0f43('0x14')](_0x139d08)['json'](_0x2ad00b);}};}function respondWithFilteredResult(_0x30862a,_0x3eb561){return function(_0x475bf1){if(_0x475bf1){var _0x5cdd54=_0x475bf1['count'],_0x2f9255=_0x3eb561[_0x0f43('0x16')],_0x27a615=_0x3eb561[_0x0f43('0x16')]+_0x3eb561[_0x0f43('0x17')],_0x618d3;if(_0x27a615>=_0x5cdd54){_0x27a615=_0x5cdd54;_0x618d3=0xc8;}else{_0x618d3=0xce;}_0x30862a[_0x0f43('0x14')](_0x618d3);return _0x30862a[_0x0f43('0x18')](_0x0f43('0x19'),_0x2f9255+'-'+_0x27a615+'/'+_0x5cdd54)['json'](_0x475bf1);}return null;};}function patchUpdates(_0x28feb6){return function(_0x1e2e1e){try{jsonpatch[_0x0f43('0x1a')](_0x1e2e1e,_0x28feb6,!![]);}catch(_0x14ffc5){return BPromise[_0x0f43('0x1b')](_0x14ffc5);}return _0x1e2e1e['save']();};}function saveUpdates(_0x1910a9,_0x22967a){return function(_0x40b50f){if(_0x40b50f){return _0x40b50f[_0x0f43('0x1c')](_0x1910a9)['then'](function(_0x374620){return _0x374620;});}return null;};}function removeEntity(_0x361a0a,_0x61aec7){return function(_0x498a2a){if(_0x498a2a){return _0x498a2a['destroy']()['then'](function(){_0x361a0a[_0x0f43('0x14')](0xcc)[_0x0f43('0x15')]();});}};}function handleEntityNotFound(_0x51e6f1,_0x2d29d3){return function(_0x35f86c){if(!_0x35f86c){_0x51e6f1[_0x0f43('0x13')](0x194);}return _0x35f86c;};}function handleError(_0x4693af,_0x322afb){_0x322afb=_0x322afb||0x1f4;return function(_0x207a6d){logger[_0x0f43('0x1d')](_0x207a6d['stack']);if(_0x207a6d[_0x0f43('0x1e')]){delete _0x207a6d[_0x0f43('0x1e')];}_0x4693af[_0x0f43('0x14')](_0x322afb)[_0x0f43('0x1f')](_0x207a6d);};}exports['index']=function(_0x3150a8,_0x20d2ee){var _0x5c5b9a={},_0x5bb457={},_0x40c2a1={'count':0x0,'rows':[]};var _0x1c4711=db['SugarcrmField'][_0x0f43('0x20')];_0x5bb457[_0x0f43('0x21')]=_[_0x0f43('0x22')](_0x1c4711);var _0x2d74c2={'dateStart':_0x3150a8[_0x0f43('0x23')][_0x0f43('0x24')],'dateEnd':_0x3150a8[_0x0f43('0x23')][_0x0f43('0x25')]};delete _0x3150a8['query'][_0x0f43('0x24')];delete _0x3150a8['query']['dateEnd'];_0x5bb457[_0x0f43('0x23')]=_[_0x0f43('0x22')](_0x3150a8['query']);_0x5bb457[_0x0f43('0x26')]=_[_0x0f43('0x27')](_0x5bb457[_0x0f43('0x21')],_0x5bb457[_0x0f43('0x23')]);_0x5c5b9a[_0x0f43('0x28')]=_[_0x0f43('0x27')](_0x5bb457[_0x0f43('0x21')],qs[_0x0f43('0x29')](_0x3150a8[_0x0f43('0x23')][_0x0f43('0x29')]));_0x5c5b9a['attributes']=_0x5c5b9a[_0x0f43('0x28')][_0x0f43('0x2a')]?_0x5c5b9a[_0x0f43('0x28')]:_0x5bb457['model'];if(!_0x3150a8[_0x0f43('0x23')][_0x0f43('0x2b')](_0x0f43('0x2c'))){_0x5c5b9a[_0x0f43('0x17')]=qs[_0x0f43('0x17')](_0x3150a8['query'][_0x0f43('0x17')]);_0x5c5b9a[_0x0f43('0x16')]=qs[_0x0f43('0x16')](_0x3150a8[_0x0f43('0x23')][_0x0f43('0x16')]);}_0x5c5b9a['order']=qs[_0x0f43('0x2d')](_0x3150a8[_0x0f43('0x23')][_0x0f43('0x2d')]);_0x5c5b9a['where']=qs[_0x0f43('0x26')](_[_0x0f43('0x2e')](_0x3150a8['query'],_0x5bb457[_0x0f43('0x26')]));if(_0x2d74c2[_0x0f43('0x24')]){if(_0x2d74c2[_0x0f43('0x25')]){_0x2d74c2['dateEnd']=moment(_0x2d74c2[_0x0f43('0x25')])[_0x0f43('0x2f')](0x1,_0x0f43('0x30'));}else{_0x2d74c2[_0x0f43('0x25')]=moment(_0x2d74c2[_0x0f43('0x24')])[_0x0f43('0x2f')](0x1,_0x0f43('0x30'));}_[_0x0f43('0x31')](_0x5c5b9a[_0x0f43('0x32')],{'createdAt':{'$gte':_0x2d74c2[_0x0f43('0x24')],'$lte':_0x2d74c2['dateEnd']}});}if(_0x3150a8[_0x0f43('0x23')]['filter']){_0x5c5b9a[_0x0f43('0x32')]=_[_0x0f43('0x31')](_0x5c5b9a[_0x0f43('0x32')],{'$or':_[_0x0f43('0x33')](_0x5c5b9a[_0x0f43('0x28')],function(_0x20c955){var _0x33c3b8={};_0x33c3b8[_0x20c955]={'$like':'%'+_0x3150a8[_0x0f43('0x23')][_0x0f43('0x34')]+'%'};return _0x33c3b8;})});}_0x5c5b9a=_[_0x0f43('0x31')]({},_0x5c5b9a,_0x3150a8[_0x0f43('0x35')]);var _0x15173b={'where':_0x5c5b9a['where']};return db[_0x0f43('0x36')]['count'](_0x15173b)[_0x0f43('0x37')](function(_0x4762cb){_0x40c2a1[_0x0f43('0x38')]=_0x4762cb;if(_0x3150a8['query'][_0x0f43('0x39')]){_0x5c5b9a['include']=[{'all':!![]}];}return db[_0x0f43('0x36')]['findAll'](_0x5c5b9a);})[_0x0f43('0x37')](function(_0x29c86a){_0x40c2a1[_0x0f43('0x3a')]=_0x29c86a;return _0x40c2a1;})[_0x0f43('0x37')](respondWithFilteredResult(_0x20d2ee,_0x5c5b9a))[_0x0f43('0x3b')](handleError(_0x20d2ee,null));};exports['show']=function(_0x5edee0,_0x17f726){var _0x5bc9d0={'raw':!![],'where':{'id':_0x5edee0[_0x0f43('0x3c')]['id']}},_0x497b22={};_0x497b22['model']=_['keys'](db[_0x0f43('0x36')]['rawAttributes']);_0x497b22[_0x0f43('0x23')]=_['keys'](_0x5edee0[_0x0f43('0x23')]);_0x497b22[_0x0f43('0x26')]=_[_0x0f43('0x27')](_0x497b22[_0x0f43('0x21')],_0x497b22[_0x0f43('0x23')]);_0x5bc9d0[_0x0f43('0x28')]=_[_0x0f43('0x27')](_0x497b22[_0x0f43('0x21')],qs[_0x0f43('0x29')](_0x5edee0['query'][_0x0f43('0x29')]));_0x5bc9d0[_0x0f43('0x28')]=_0x5bc9d0[_0x0f43('0x28')][_0x0f43('0x2a')]?_0x5bc9d0[_0x0f43('0x28')]:_0x497b22[_0x0f43('0x21')];if(_0x5edee0['query'][_0x0f43('0x39')]){_0x5bc9d0[_0x0f43('0x3d')]=[{'all':!![]}];}_0x5bc9d0=_['merge']({},_0x5bc9d0,_0x5edee0[_0x0f43('0x35')]);return db['SugarcrmField'][_0x0f43('0x3e')](_0x5bc9d0)[_0x0f43('0x37')](handleEntityNotFound(_0x17f726,null))['then'](respondWithResult(_0x17f726,null))[_0x0f43('0x3b')](handleError(_0x17f726,null));};exports[_0x0f43('0x3f')]=function(_0x2a9aa7,_0x101e13){return db[_0x0f43('0x36')][_0x0f43('0x3f')](_0x2a9aa7['body'],{})[_0x0f43('0x37')](respondWithResult(_0x101e13,0xc9))[_0x0f43('0x3b')](handleError(_0x101e13,null));};exports[_0x0f43('0x1c')]=function(_0xf01e67,_0x2fa86c){if(_0xf01e67[_0x0f43('0x40')]['id']){delete _0xf01e67[_0x0f43('0x40')]['id'];}return db[_0x0f43('0x36')][_0x0f43('0x3e')]({'where':{'id':_0xf01e67[_0x0f43('0x3c')]['id']}})[_0x0f43('0x37')](handleEntityNotFound(_0x2fa86c,null))['then'](saveUpdates(_0xf01e67[_0x0f43('0x40')],null))[_0x0f43('0x37')](respondWithResult(_0x2fa86c,null))[_0x0f43('0x3b')](handleError(_0x2fa86c,null));};exports['destroy']=function(_0x4daf96,_0x143682){return db[_0x0f43('0x36')]['find']({'where':{'id':_0x4daf96[_0x0f43('0x3c')]['id']}})[_0x0f43('0x37')](handleEntityNotFound(_0x143682,null))[_0x0f43('0x37')](removeEntity(_0x143682,null))[_0x0f43('0x3b')](handleError(_0x143682,null));}; \ No newline at end of file +var _0xe2b9=['fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','error','name','send','index','rawAttributes','model','query','dateStart','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','dateEnd','day','add','merge','filter','SugarcrmField','includeAll','include','findAll','rows','params','options','find','catch','create','body','update'];(function(_0x1de841,_0x278c7c){var _0x19bce4=function(_0x573f8e){while(--_0x573f8e){_0x1de841['push'](_0x1de841['shift']());}};_0x19bce4(++_0x278c7c);}(_0xe2b9,0x140));var _0x9e2b=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0xe2b9[_0x5c4585];return _0x21dede;};'use strict';var jsonpatch=require(_0x9e2b('0x0'));var rp=require('request-promise');var moment=require(_0x9e2b('0x1'));var BPromise=require(_0x9e2b('0x2'));var Mustache=require(_0x9e2b('0x3'));var util=require('util');var path=require(_0x9e2b('0x4'));var sox=require(_0x9e2b('0x5'));var csv=require(_0x9e2b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9e2b('0x7'));var deskjs=require(_0x9e2b('0x8'));var toCsv=require('to-csv');var querystring=require(_0x9e2b('0x9'));var Papa=require(_0x9e2b('0xa'));var qs=require(_0x9e2b('0xb'));var logger=require(_0x9e2b('0xc'))(_0x9e2b('0xd'));var utils=require(_0x9e2b('0xe'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a4614,_0x3407fd){_0x3407fd=_0x3407fd||0xcc;return function(_0xc7937e){if(_0xc7937e){return _0x3a4614[_0x9e2b('0xf')](_0x3407fd);}return _0x3a4614[_0x9e2b('0x10')](_0x3407fd)[_0x9e2b('0x11')]();};}function respondWithResult(_0x21734e,_0x4f80f3){_0x4f80f3=_0x4f80f3||0xc8;return function(_0x3d5d52){if(_0x3d5d52){return _0x21734e['status'](_0x4f80f3)['json'](_0x3d5d52);}};}function respondWithFilteredResult(_0x286d01,_0x4df116){return function(_0x2b21e9){if(_0x2b21e9){var _0x377d14=_0x2b21e9[_0x9e2b('0x12')],_0x543457=_0x4df116['offset'],_0x1e0584=_0x4df116[_0x9e2b('0x13')]+_0x4df116[_0x9e2b('0x14')],_0x4c3758;if(_0x1e0584>=_0x377d14){_0x1e0584=_0x377d14;_0x4c3758=0xc8;}else{_0x4c3758=0xce;}_0x286d01[_0x9e2b('0x10')](_0x4c3758);return _0x286d01[_0x9e2b('0x15')]('Content-Range',_0x543457+'-'+_0x1e0584+'/'+_0x377d14)[_0x9e2b('0x16')](_0x2b21e9);}return null;};}function patchUpdates(_0x4897bc){return function(_0xd89c61){try{jsonpatch['apply'](_0xd89c61,_0x4897bc,!![]);}catch(_0x525bfd){return BPromise[_0x9e2b('0x17')](_0x525bfd);}return _0xd89c61[_0x9e2b('0x18')]();};}function saveUpdates(_0x186cf5,_0x29edfc){return function(_0x2eafbe){if(_0x2eafbe){return _0x2eafbe['update'](_0x186cf5)[_0x9e2b('0x19')](function(_0x5ef4d2){return _0x5ef4d2;});}return null;};}function removeEntity(_0x5d2268,_0x5892f6){return function(_0x35eb6d){if(_0x35eb6d){return _0x35eb6d[_0x9e2b('0x1a')]()[_0x9e2b('0x19')](function(){_0x5d2268['status'](0xcc)[_0x9e2b('0x11')]();});}};}function handleEntityNotFound(_0x4553c0,_0x3b6c97){return function(_0x53b6d1){if(!_0x53b6d1){_0x4553c0[_0x9e2b('0xf')](0x194);}return _0x53b6d1;};}function handleError(_0x2ec090,_0x215f96){_0x215f96=_0x215f96||0x1f4;return function(_0x2721ea){logger[_0x9e2b('0x1b')](_0x2721ea['stack']);if(_0x2721ea[_0x9e2b('0x1c')]){delete _0x2721ea[_0x9e2b('0x1c')];}_0x2ec090[_0x9e2b('0x10')](_0x215f96)[_0x9e2b('0x1d')](_0x2721ea);};}exports[_0x9e2b('0x1e')]=function(_0x59ab67,_0x26e5c3){var _0x176b0c={},_0x3642ec={},_0x1cbd7d={'count':0x0,'rows':[]};var _0x4248e8=db['SugarcrmField'][_0x9e2b('0x1f')];_0x3642ec[_0x9e2b('0x20')]=_['keys'](_0x4248e8);var _0x269d49={'dateStart':_0x59ab67[_0x9e2b('0x21')][_0x9e2b('0x22')],'dateEnd':_0x59ab67[_0x9e2b('0x21')]['dateEnd']};delete _0x59ab67['query'][_0x9e2b('0x22')];delete _0x59ab67[_0x9e2b('0x21')]['dateEnd'];_0x3642ec[_0x9e2b('0x21')]=_[_0x9e2b('0x23')](_0x59ab67[_0x9e2b('0x21')]);_0x3642ec['filters']=_[_0x9e2b('0x24')](_0x3642ec[_0x9e2b('0x20')],_0x3642ec['query']);_0x176b0c[_0x9e2b('0x25')]=_[_0x9e2b('0x24')](_0x3642ec['model'],qs[_0x9e2b('0x26')](_0x59ab67[_0x9e2b('0x21')][_0x9e2b('0x26')]));_0x176b0c[_0x9e2b('0x25')]=_0x176b0c[_0x9e2b('0x25')][_0x9e2b('0x27')]?_0x176b0c['attributes']:_0x3642ec[_0x9e2b('0x20')];if(!_0x59ab67[_0x9e2b('0x21')][_0x9e2b('0x28')](_0x9e2b('0x29'))){_0x176b0c['limit']=qs[_0x9e2b('0x14')](_0x59ab67[_0x9e2b('0x21')][_0x9e2b('0x14')]);_0x176b0c['offset']=qs[_0x9e2b('0x13')](_0x59ab67['query'][_0x9e2b('0x13')]);}_0x176b0c[_0x9e2b('0x2a')]=qs[_0x9e2b('0x2b')](_0x59ab67[_0x9e2b('0x21')]['sort']);_0x176b0c[_0x9e2b('0x2c')]=qs['filters'](_[_0x9e2b('0x2d')](_0x59ab67['query'],_0x3642ec[_0x9e2b('0x2e')]));if(_0x269d49[_0x9e2b('0x22')]){if(_0x269d49[_0x9e2b('0x2f')]){_0x269d49[_0x9e2b('0x2f')]=moment(_0x269d49[_0x9e2b('0x2f')])['add'](0x1,_0x9e2b('0x30'));}else{_0x269d49[_0x9e2b('0x2f')]=moment(_0x269d49[_0x9e2b('0x22')])[_0x9e2b('0x31')](0x1,'day');}_[_0x9e2b('0x32')](_0x176b0c['where'],{'createdAt':{'$gte':_0x269d49['dateStart'],'$lte':_0x269d49[_0x9e2b('0x2f')]}});}if(_0x59ab67[_0x9e2b('0x21')][_0x9e2b('0x33')]){_0x176b0c[_0x9e2b('0x2c')]=_[_0x9e2b('0x32')](_0x176b0c[_0x9e2b('0x2c')],{'$or':_['map'](_0x176b0c['attributes'],function(_0x305b86){var _0x3c6f0c={};_0x3c6f0c[_0x305b86]={'$like':'%'+_0x59ab67['query'][_0x9e2b('0x33')]+'%'};return _0x3c6f0c;})});}_0x176b0c=_[_0x9e2b('0x32')]({},_0x176b0c,_0x59ab67['options']);var _0x4ba4a8={'where':_0x176b0c[_0x9e2b('0x2c')]};return db[_0x9e2b('0x34')][_0x9e2b('0x12')](_0x4ba4a8)[_0x9e2b('0x19')](function(_0x2012ab){_0x1cbd7d['count']=_0x2012ab;if(_0x59ab67[_0x9e2b('0x21')][_0x9e2b('0x35')]){_0x176b0c[_0x9e2b('0x36')]=[{'all':!![]}];}return db[_0x9e2b('0x34')][_0x9e2b('0x37')](_0x176b0c);})['then'](function(_0x316f51){_0x1cbd7d[_0x9e2b('0x38')]=_0x316f51;return _0x1cbd7d;})[_0x9e2b('0x19')](respondWithFilteredResult(_0x26e5c3,_0x176b0c))['catch'](handleError(_0x26e5c3,null));};exports['show']=function(_0x493e0a,_0x53dfea){var _0xdff442={'raw':!![],'where':{'id':_0x493e0a[_0x9e2b('0x39')]['id']}},_0x23a7c1={};_0x23a7c1['model']=_[_0x9e2b('0x23')](db[_0x9e2b('0x34')][_0x9e2b('0x1f')]);_0x23a7c1[_0x9e2b('0x21')]=_[_0x9e2b('0x23')](_0x493e0a[_0x9e2b('0x21')]);_0x23a7c1['filters']=_[_0x9e2b('0x24')](_0x23a7c1['model'],_0x23a7c1[_0x9e2b('0x21')]);_0xdff442[_0x9e2b('0x25')]=_[_0x9e2b('0x24')](_0x23a7c1[_0x9e2b('0x20')],qs['fields'](_0x493e0a[_0x9e2b('0x21')][_0x9e2b('0x26')]));_0xdff442[_0x9e2b('0x25')]=_0xdff442[_0x9e2b('0x25')]['length']?_0xdff442[_0x9e2b('0x25')]:_0x23a7c1[_0x9e2b('0x20')];if(_0x493e0a['query'][_0x9e2b('0x35')]){_0xdff442[_0x9e2b('0x36')]=[{'all':!![]}];}_0xdff442=_[_0x9e2b('0x32')]({},_0xdff442,_0x493e0a[_0x9e2b('0x3a')]);return db[_0x9e2b('0x34')][_0x9e2b('0x3b')](_0xdff442)[_0x9e2b('0x19')](handleEntityNotFound(_0x53dfea,null))[_0x9e2b('0x19')](respondWithResult(_0x53dfea,null))[_0x9e2b('0x3c')](handleError(_0x53dfea,null));};exports[_0x9e2b('0x3d')]=function(_0x5c8f40,_0x5e5827){return db[_0x9e2b('0x34')][_0x9e2b('0x3d')](_0x5c8f40[_0x9e2b('0x3e')],{})['then'](respondWithResult(_0x5e5827,0xc9))[_0x9e2b('0x3c')](handleError(_0x5e5827,null));};exports[_0x9e2b('0x3f')]=function(_0x3017c7,_0x44135c){if(_0x3017c7['body']['id']){delete _0x3017c7[_0x9e2b('0x3e')]['id'];}return db['SugarcrmField'][_0x9e2b('0x3b')]({'where':{'id':_0x3017c7[_0x9e2b('0x39')]['id']}})['then'](handleEntityNotFound(_0x44135c,null))[_0x9e2b('0x19')](saveUpdates(_0x3017c7[_0x9e2b('0x3e')],null))[_0x9e2b('0x19')](respondWithResult(_0x44135c,null))[_0x9e2b('0x3c')](handleError(_0x44135c,null));};exports[_0x9e2b('0x1a')]=function(_0x575b7e,_0x513004){return db[_0x9e2b('0x34')]['find']({'where':{'id':_0x575b7e[_0x9e2b('0x39')]['id']}})[_0x9e2b('0x19')](handleEntityNotFound(_0x513004,null))['then'](removeEntity(_0x513004,null))[_0x9e2b('0x3c')](handleError(_0x513004,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index bcd9f9c..eb45596 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 _0x5ec4=['api','moment','bluebird','request-promise','./intSugarcrmField.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5ec4,0x93));var _0x45ec=function(_0x1fe21f,_0x5389af){_0x1fe21f=_0x1fe21f-0x0;var _0x1dd6e9=_0x5ec4[_0x1fe21f];return _0x1dd6e9;};'use strict';var _=require(_0x45ec('0x0'));var util=require(_0x45ec('0x1'));var logger=require(_0x45ec('0x2'))(_0x45ec('0x3'));var moment=require(_0x45ec('0x4'));var BPromise=require(_0x45ec('0x5'));var rp=require(_0x45ec('0x6'));var attributes=require(_0x45ec('0x7'));module[_0x45ec('0x8')]=function(_0x1f5cdc,_0x26ebdd){return _0x1f5cdc[_0x45ec('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe560=['lodash','util','../../config/logger','api','moment','request-promise','exports','define','int_sugarcrm_fields'];(function(_0x3e929b,_0x5ee20e){var _0x4ff3e8=function(_0x9a50b8){while(--_0x9a50b8){_0x3e929b['push'](_0x3e929b['shift']());}};_0x4ff3e8(++_0x5ee20e);}(_0xe560,0x168));var _0x0e56=function(_0x11746d,_0x9e53a6){_0x11746d=_0x11746d-0x0;var _0xc0044c=_0xe560[_0x11746d];return _0xc0044c;};'use strict';var _=require(_0x0e56('0x0'));var util=require(_0x0e56('0x1'));var logger=require(_0x0e56('0x2'))(_0x0e56('0x3'));var moment=require(_0x0e56('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e56('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x0e56('0x6')]=function(_0x3c5e7d,_0x2ff22b){return _0x3c5e7d[_0x0e56('0x7')]('SugarcrmField',attributes,{'tableName':_0x0e56('0x8'),'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 f073e06..c748f5c 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 _0x0568=['request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3a455b,_0x11ddb8){var _0xfb5c3a=function(_0x3a0df4){while(--_0x3a0df4){_0x3a455b['push'](_0x3a455b['shift']());}};_0xfb5c3a(++_0x11ddb8);}(_0x0568,0x1af));var _0x8056=function(_0x636c90,_0x343821){_0x636c90=_0x636c90-0x0;var _0x19b705=_0x0568[_0x636c90];return _0x19b705;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8056('0x0'));var BPromise=require(_0x8056('0x1'));var rs=require(_0x8056('0x2'));var fs=require('fs');var db=require(_0x8056('0x3'))['db'];var utils=require(_0x8056('0x4'));var logger=require(_0x8056('0x5'))(_0x8056('0x6'));var config=require(_0x8056('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8056('0x8')][_0x8056('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58a3a2,_0x429ab8,_0x362cf6){return new BPromise(function(_0x47ac97,_0x498ec6){return client[_0x8056('0xa')](_0x58a3a2,_0x362cf6)['then'](function(_0x17340a){logger[_0x8056('0xb')](_0x8056('0xc'),_0x429ab8,_0x8056('0xd'));logger['debug'](_0x8056('0xe'),_0x429ab8,_0x8056('0xd'),JSON[_0x8056('0xf')](_0x17340a));if(_0x17340a[_0x8056('0x10')]){if(_0x17340a[_0x8056('0x10')][_0x8056('0x11')]===0x1f4){logger[_0x8056('0x10')](_0x8056('0xc'),_0x429ab8,_0x17340a[_0x8056('0x10')][_0x8056('0x12')]);return _0x498ec6(_0x17340a[_0x8056('0x10')][_0x8056('0x12')]);}logger[_0x8056('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x429ab8,_0x17340a[_0x8056('0x10')][_0x8056('0x12')]);return _0x47ac97(_0x17340a[_0x8056('0x10')][_0x8056('0x12')]);}else{logger[_0x8056('0xb')](_0x8056('0xc'),_0x429ab8,_0x8056('0xd'));_0x47ac97(_0x17340a[_0x8056('0x13')]['message']);}})[_0x8056('0x14')](function(_0x2ecfb9){logger[_0x8056('0x10')](_0x8056('0xc'),_0x429ab8,_0x2ecfb9);_0x498ec6(_0x2ecfb9);});});} \ No newline at end of file +var _0x86ce=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util'];(function(_0x2c90a0,_0x231acd){var _0x16c1da=function(_0x251424){while(--_0x251424){_0x2c90a0['push'](_0x2c90a0['shift']());}};_0x16c1da(++_0x231acd);}(_0x86ce,0x174));var _0xe86c=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x86ce[_0x43b08];return _0x5e05f4;};'use strict';var _=require(_0xe86c('0x0'));var util=require(_0xe86c('0x1'));var moment=require('moment');var BPromise=require(_0xe86c('0x2'));var rs=require(_0xe86c('0x3'));var fs=require('fs');var db=require(_0xe86c('0x4'))['db'];var utils=require(_0xe86c('0x5'));var logger=require(_0xe86c('0x6'))('rpc');var config=require(_0xe86c('0x7'));var jayson=require(_0xe86c('0x8'));var client=jayson[_0xe86c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353259,_0x17894a,_0x56f38c){return new BPromise(function(_0xe77058,_0xb28485){return client[_0xe86c('0xa')](_0x353259,_0x56f38c)[_0xe86c('0xb')](function(_0x490871){logger['info'](_0xe86c('0xc'),_0x17894a,_0xe86c('0xd'));logger[_0xe86c('0xe')](_0xe86c('0xf'),_0x17894a,'request\x20sent',JSON[_0xe86c('0x10')](_0x490871));if(_0x490871[_0xe86c('0x11')]){if(_0x490871[_0xe86c('0x11')][_0xe86c('0x12')]===0x1f4){logger[_0xe86c('0x11')](_0xe86c('0xc'),_0x17894a,_0x490871[_0xe86c('0x11')][_0xe86c('0x13')]);return _0xb28485(_0x490871['error'][_0xe86c('0x13')]);}logger[_0xe86c('0x11')](_0xe86c('0xc'),_0x17894a,_0x490871[_0xe86c('0x11')][_0xe86c('0x13')]);return _0xe77058(_0x490871['error'][_0xe86c('0x13')]);}else{logger[_0xe86c('0x14')](_0xe86c('0xc'),_0x17894a,'request\x20sent');_0xe77058(_0x490871[_0xe86c('0x15')][_0xe86c('0x13')]);}})['catch'](function(_0x225205){logger['error'](_0xe86c('0xc'),_0x17894a,_0x225205);_0xb28485(_0x225205);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 10e46b3..070db2c 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 _0x7857=['index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports','util','Router','../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x7857,0x1af));var _0x7785=function(_0x10d3a2,_0x2c4cf2){_0x10d3a2=_0x10d3a2-0x0;var _0x4dd498=_0x7857[_0x10d3a2];return _0x4dd498;};'use strict';var multer=require('multer');var util=require(_0x7785('0x0'));var path=require('path');var express=require('express');var router=express[_0x7785('0x1')]();var auth=require(_0x7785('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7785('0x3'));router[_0x7785('0x4')]('/',auth[_0x7785('0x5')](),controller[_0x7785('0x6')]);router[_0x7785('0x4')](_0x7785('0x7'),auth[_0x7785('0x5')](),controller[_0x7785('0x8')]);router[_0x7785('0x4')]('/:id/configurations',auth[_0x7785('0x5')](),controller[_0x7785('0x9')]);router['get'](_0x7785('0xa'),auth[_0x7785('0x5')](),controller[_0x7785('0xb')]);router[_0x7785('0xc')]('/',auth['isAuthenticated'](),controller[_0x7785('0xd')]);router[_0x7785('0xc')](_0x7785('0xe'),auth[_0x7785('0x5')](),controller[_0x7785('0xf')]);router['put']('/:id',auth[_0x7785('0x5')](),controller[_0x7785('0x10')]);router['delete'](_0x7785('0x7'),auth['isAuthenticated'](),controller[_0x7785('0x11')]);module[_0x7785('0x12')]=router; \ No newline at end of file +var _0x0298=['update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','put'];(function(_0x345349,_0x1f8d20){var _0x2cc541=function(_0x50c630){while(--_0x50c630){_0x345349['push'](_0x345349['shift']());}};_0x2cc541(++_0x1f8d20);}(_0x0298,0x107));var _0x8029=function(_0x78a8f4,_0x259809){_0x78a8f4=_0x78a8f4-0x0;var _0x2b3291=_0x0298[_0x78a8f4];return _0x2b3291;};'use strict';var multer=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var path=require(_0x8029('0x2'));var express=require('express');var router=express[_0x8029('0x3')]();var auth=require(_0x8029('0x4'));var interaction=require(_0x8029('0x5'));var config=require(_0x8029('0x6'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x8029('0x7')](),controller[_0x8029('0x8')]);router[_0x8029('0x9')](_0x8029('0xa'),auth[_0x8029('0x7')](),controller[_0x8029('0xb')]);router[_0x8029('0x9')](_0x8029('0xc'),auth[_0x8029('0x7')](),controller['getConfigurations']);router[_0x8029('0x9')](_0x8029('0xd'),auth[_0x8029('0x7')](),controller[_0x8029('0xe')]);router[_0x8029('0xf')]('/',auth[_0x8029('0x7')](),controller['create']);router[_0x8029('0xf')](_0x8029('0xc'),auth[_0x8029('0x7')](),controller['addConfiguration']);router[_0x8029('0x10')](_0x8029('0xa'),auth[_0x8029('0x7')](),controller[_0x8029('0x11')]);router[_0x8029('0x12')](_0x8029('0xa'),auth[_0x8029('0x7')](),controller['destroy']);module[_0x8029('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c608ee4..6cfc4f1 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 _0xf37e=['exports','STRING','HelpDesk','sequelize'];(function(_0x2f2d88,_0x32815c){var _0x4742ee=function(_0x19b8ba){while(--_0x19b8ba){_0x2f2d88['push'](_0x2f2d88['shift']());}};_0x4742ee(++_0x32815c);}(_0xf37e,0x13f));var _0xef37=function(_0xf89d1c,_0xdda16d){_0xf89d1c=_0xf89d1c-0x0;var _0x35f3cd=_0xf37e[_0xf89d1c];return _0x35f3cd;};'use strict';var Sequelize=require(_0xef37('0x0'));module[_0xef37('0x1')]={'name':{'type':Sequelize[_0xef37('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xef37('0x2')]},'username':{'type':Sequelize[_0xef37('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xef37('0x3')},'remoteUri':{'type':Sequelize[_0xef37('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xef37('0x2')]},'accessKey':{'type':Sequelize[_0xef37('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbedc=['exports','STRING','HelpDesk','sequelize'];(function(_0x1dd695,_0x1bfdcf){var _0xad2e6d=function(_0x4f9ac4){while(--_0x4f9ac4){_0x1dd695['push'](_0x1dd695['shift']());}};_0xad2e6d(++_0x1bfdcf);}(_0xbedc,0xef));var _0xcbed=function(_0x23113b,_0x2ebab8){_0x23113b=_0x23113b-0x0;var _0x25c125=_0xbedc[_0x23113b];return _0x25c125;};'use strict';var Sequelize=require(_0xcbed('0x0'));module[_0xcbed('0x1')]={'name':{'type':Sequelize[_0xcbed('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcbed('0x2')]},'username':{'type':Sequelize[_0xcbed('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcbed('0x2')],'allowNull':![],'defaultValue':_0xcbed('0x3')},'remoteUri':{'type':Sequelize[_0xcbed('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xcbed('0x2')]},'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 4f699af..d42544b 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 _0x0e0f=['to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','then','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','status','offset','set','Content-Range','json','apply','reject','save','destroy','end','sendStatus','name','send','index','VtigerAccount','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','length','limit','order','sort','pick','day','add','where','merge','filter','options','count','include','show','params','find','create','body','update','getConfigurations','map','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','VtigerConfiguration','VtigerField','md5','findOne','username','description','serverUrl','accessKey','moduleName','format','%s/webservice.php','remoteUri','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x2cc752,_0x30cc55){var _0x3b665f=function(_0x267e1a){while(--_0x267e1a){_0x2cc752['push'](_0x2cc752['shift']());}};_0x3b665f(++_0x30cc55);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x32a210,_0x38f2db){_0x32a210=_0x32a210-0x0;var _0x42bb37=_0x0e0f[_0x32a210];return _0x42bb37;};'use strict';var jsonpatch=require(_0xf0e0('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0e0('0x1'));var Mustache=require(_0xf0e0('0x2'));var util=require(_0xf0e0('0x3'));var path=require(_0xf0e0('0x4'));var sox=require(_0xf0e0('0x5'));var csv=require('to-csv');var ejs=require(_0xf0e0('0x6'));var fs=require('fs');var _=require(_0xf0e0('0x7'));var squel=require('squel');var crypto=require(_0xf0e0('0x8'));var jsforce=require(_0xf0e0('0x9'));var deskjs=require(_0xf0e0('0xa'));var toCsv=require(_0xf0e0('0xb'));var querystring=require(_0xf0e0('0xc'));var Papa=require(_0xf0e0('0xd'));var qs=require(_0xf0e0('0xe'));var logger=require(_0xf0e0('0xf'))(_0xf0e0('0x10'));var utils=require('../../config/utils');var config=require(_0xf0e0('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf0e0('0x12'));var jayson=require(_0xf0e0('0x13'));var client=jayson[_0xf0e0('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b7b7,_0x533eeb,_0x4a01b3,_0x10e087){return new BPromise(function(_0x4931a8,_0x501c86){var _0x24d3a9=_0x10e087||client;return _0x24d3a9['request'](_0x59b7b7,_0x4a01b3)[_0xf0e0('0x15')](function(_0x1c62e0){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x533eeb,_0xf0e0('0x16'));logger['debug'](_0xf0e0('0x17'),_0x533eeb,'request\x20sent',JSON[_0xf0e0('0x18')](_0x1c62e0));if(_0x1c62e0['error']){if(_0x1c62e0[_0xf0e0('0x19')][_0xf0e0('0x1a')]===0x1f4){logger['error'](_0xf0e0('0x1b'),_0x533eeb,_0x1c62e0[_0xf0e0('0x19')][_0xf0e0('0x1c')]);return _0x501c86(_0x1c62e0[_0xf0e0('0x19')]['message']);}logger[_0xf0e0('0x19')](_0xf0e0('0x1b'),_0x533eeb,_0x1c62e0['error']['message']);return _0x4931a8(_0x1c62e0[_0xf0e0('0x19')][_0xf0e0('0x1c')]);}else{logger['info'](_0xf0e0('0x1b'),_0x533eeb,'request\x20sent');_0x4931a8(_0x1c62e0['result']['message']);}})[_0xf0e0('0x1d')](function(_0x3ed3f8){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x533eeb,_0x3ed3f8);_0x501c86(_0x3ed3f8);});});}function respondWithStatusCode(_0x59d95d,_0x165a32){_0x165a32=_0x165a32||0xcc;return function(_0x52e518){if(_0x52e518){return _0x59d95d['sendStatus'](_0x165a32);}return _0x59d95d['status'](_0x165a32)['end']();};}function respondWithResult(_0x4708a9,_0x357e3a){_0x357e3a=_0x357e3a||0xc8;return function(_0x1a1cdb){if(_0x1a1cdb){return _0x4708a9[_0xf0e0('0x1e')](_0x357e3a)['json'](_0x1a1cdb);}};}function respondWithFilteredResult(_0x112ca6,_0x3717fa){return function(_0x4b3d0a){if(_0x4b3d0a){var _0x92d59d=_0x4b3d0a['count'],_0x50cb6e=_0x3717fa[_0xf0e0('0x1f')],_0x379256=_0x3717fa[_0xf0e0('0x1f')]+_0x3717fa['limit'],_0x364675;if(_0x379256>=_0x92d59d){_0x379256=_0x92d59d;_0x364675=0xc8;}else{_0x364675=0xce;}_0x112ca6[_0xf0e0('0x1e')](_0x364675);return _0x112ca6[_0xf0e0('0x20')](_0xf0e0('0x21'),_0x50cb6e+'-'+_0x379256+'/'+_0x92d59d)[_0xf0e0('0x22')](_0x4b3d0a);}return null;};}function patchUpdates(_0x325c62){return function(_0x2ac9d3){try{jsonpatch[_0xf0e0('0x23')](_0x2ac9d3,_0x325c62,!![]);}catch(_0x3b4a3b){return BPromise[_0xf0e0('0x24')](_0x3b4a3b);}return _0x2ac9d3[_0xf0e0('0x25')]();};}function saveUpdates(_0x251a8b,_0x5934a9){return function(_0x19b1e5){if(_0x19b1e5){return _0x19b1e5['update'](_0x251a8b)[_0xf0e0('0x15')](function(_0x5c9850){return _0x5c9850;});}return null;};}function removeEntity(_0x22996c,_0x3d5330){return function(_0x2f6b9d){if(_0x2f6b9d){return _0x2f6b9d[_0xf0e0('0x26')]()['then'](function(){_0x22996c[_0xf0e0('0x1e')](0xcc)[_0xf0e0('0x27')]();});}};}function handleEntityNotFound(_0x45d005,_0x2ca25b){return function(_0x51f10b){if(!_0x51f10b){_0x45d005[_0xf0e0('0x28')](0x194);}return _0x51f10b;};}function handleError(_0x37fdec,_0x1929ac){_0x1929ac=_0x1929ac||0x1f4;return function(_0x37f66f){logger[_0xf0e0('0x19')](_0x37f66f['stack']);if(_0x37f66f[_0xf0e0('0x29')]){delete _0x37f66f[_0xf0e0('0x29')];}_0x37fdec[_0xf0e0('0x1e')](_0x1929ac)[_0xf0e0('0x2a')](_0x37f66f);};}exports[_0xf0e0('0x2b')]=function(_0x5eb031,_0x422d98){var _0x1766e0={},_0x579022={},_0x29183b={'count':0x0,'rows':[]};var _0xde8325=db[_0xf0e0('0x2c')][_0xf0e0('0x2d')];_0x579022[_0xf0e0('0x2e')]=_[_0xf0e0('0x2f')](_0xde8325);var _0x130622={'dateStart':_0x5eb031['query'][_0xf0e0('0x30')],'dateEnd':_0x5eb031[_0xf0e0('0x31')][_0xf0e0('0x32')]};delete _0x5eb031[_0xf0e0('0x31')][_0xf0e0('0x30')];delete _0x5eb031[_0xf0e0('0x31')]['dateEnd'];_0x579022['query']=_[_0xf0e0('0x2f')](_0x5eb031['query']);_0x579022[_0xf0e0('0x33')]=_[_0xf0e0('0x34')](_0x579022[_0xf0e0('0x2e')],_0x579022[_0xf0e0('0x31')]);_0x1766e0['attributes']=_['intersection'](_0x579022[_0xf0e0('0x2e')],qs[_0xf0e0('0x35')](_0x5eb031[_0xf0e0('0x31')][_0xf0e0('0x35')]));_0x1766e0[_0xf0e0('0x36')]=_0x1766e0[_0xf0e0('0x36')][_0xf0e0('0x37')]?_0x1766e0[_0xf0e0('0x36')]:_0x579022[_0xf0e0('0x2e')];if(!_0x5eb031[_0xf0e0('0x31')]['hasOwnProperty']('nolimit')){_0x1766e0[_0xf0e0('0x38')]=qs[_0xf0e0('0x38')](_0x5eb031[_0xf0e0('0x31')][_0xf0e0('0x38')]);_0x1766e0[_0xf0e0('0x1f')]=qs[_0xf0e0('0x1f')](_0x5eb031[_0xf0e0('0x31')][_0xf0e0('0x1f')]);}_0x1766e0[_0xf0e0('0x39')]=qs['sort'](_0x5eb031[_0xf0e0('0x31')][_0xf0e0('0x3a')]);_0x1766e0['where']=qs[_0xf0e0('0x33')](_[_0xf0e0('0x3b')](_0x5eb031[_0xf0e0('0x31')],_0x579022['filters']));if(_0x130622[_0xf0e0('0x30')]){if(_0x130622['dateEnd']){_0x130622['dateEnd']=moment(_0x130622['dateEnd'])['add'](0x1,_0xf0e0('0x3c'));}else{_0x130622['dateEnd']=moment(_0x130622[_0xf0e0('0x30')])[_0xf0e0('0x3d')](0x1,_0xf0e0('0x3c'));}_['merge'](_0x1766e0[_0xf0e0('0x3e')],{'createdAt':{'$gte':_0x130622['dateStart'],'$lte':_0x130622['dateEnd']}});}if(_0x5eb031[_0xf0e0('0x31')]['filter']){_0x1766e0['where']=_[_0xf0e0('0x3f')](_0x1766e0[_0xf0e0('0x3e')],{'$or':_['map'](_0x1766e0['attributes'],function(_0x4fbed0){var _0x3d9327={};_0x3d9327[_0x4fbed0]={'$like':'%'+_0x5eb031[_0xf0e0('0x31')][_0xf0e0('0x40')]+'%'};return _0x3d9327;})});}_0x1766e0=_[_0xf0e0('0x3f')]({},_0x1766e0,_0x5eb031[_0xf0e0('0x41')]);var _0xef0fa7={'where':_0x1766e0[_0xf0e0('0x3e')]};return db['VtigerAccount'][_0xf0e0('0x42')](_0xef0fa7)[_0xf0e0('0x15')](function(_0x258654){_0x29183b[_0xf0e0('0x42')]=_0x258654;if(_0x5eb031[_0xf0e0('0x31')]['includeAll']){_0x1766e0[_0xf0e0('0x43')]=[{'all':!![]}];}return db[_0xf0e0('0x2c')]['findAll'](_0x1766e0);})['then'](function(_0x3c2b45){_0x29183b['rows']=_0x3c2b45;return _0x29183b;})['then'](respondWithFilteredResult(_0x422d98,_0x1766e0))[_0xf0e0('0x1d')](handleError(_0x422d98,null));};exports[_0xf0e0('0x44')]=function(_0x4200a4,_0x47bc00){var _0xec7588={'raw':![],'where':{'id':_0x4200a4[_0xf0e0('0x45')]['id']}},_0x561029={};_0x561029['model']=_[_0xf0e0('0x2f')](db[_0xf0e0('0x2c')]['rawAttributes']);_0x561029['query']=_[_0xf0e0('0x2f')](_0x4200a4[_0xf0e0('0x31')]);_0x561029['filters']=_[_0xf0e0('0x34')](_0x561029[_0xf0e0('0x2e')],_0x561029[_0xf0e0('0x31')]);_0xec7588[_0xf0e0('0x36')]=_[_0xf0e0('0x34')](_0x561029['model'],qs[_0xf0e0('0x35')](_0x4200a4['query'][_0xf0e0('0x35')]));_0xec7588[_0xf0e0('0x36')]=_0xec7588[_0xf0e0('0x36')][_0xf0e0('0x37')]?_0xec7588['attributes']:_0x561029[_0xf0e0('0x2e')];if(_0x4200a4[_0xf0e0('0x31')]['includeAll']){_0xec7588[_0xf0e0('0x43')]=[{'all':!![]}];}_0xec7588=_[_0xf0e0('0x3f')]({},_0xec7588,_0x4200a4['options']);return db['VtigerAccount'][_0xf0e0('0x46')](_0xec7588)[_0xf0e0('0x15')](handleEntityNotFound(_0x47bc00,null))['then'](respondWithResult(_0x47bc00,null))[_0xf0e0('0x1d')](handleError(_0x47bc00,null));};exports[_0xf0e0('0x47')]=function(_0x5bf278,_0x32ed15){return db[_0xf0e0('0x2c')][_0xf0e0('0x47')](_0x5bf278[_0xf0e0('0x48')],{})[_0xf0e0('0x15')](respondWithResult(_0x32ed15,0xc9))[_0xf0e0('0x1d')](handleError(_0x32ed15,null));};exports[_0xf0e0('0x49')]=function(_0x1e6336,_0x7a3112){if(_0x1e6336['body']['id']){delete _0x1e6336[_0xf0e0('0x48')]['id'];}return db[_0xf0e0('0x2c')]['find']({'where':{'id':_0x1e6336[_0xf0e0('0x45')]['id']}})[_0xf0e0('0x15')](handleEntityNotFound(_0x7a3112,null))[_0xf0e0('0x15')](saveUpdates(_0x1e6336[_0xf0e0('0x48')],null))[_0xf0e0('0x15')](respondWithResult(_0x7a3112,null))['catch'](handleError(_0x7a3112,null));};exports[_0xf0e0('0x26')]=function(_0x11a173,_0x14aab1){return db[_0xf0e0('0x2c')][_0xf0e0('0x46')]({'where':{'id':_0x11a173['params']['id']}})[_0xf0e0('0x15')](handleEntityNotFound(_0x14aab1,null))[_0xf0e0('0x15')](removeEntity(_0x14aab1,null))['catch'](handleError(_0x14aab1,null));};exports[_0xf0e0('0x4a')]=function(_0x261d31,_0x2f6b71,_0x3ae7fd){var _0x24f7a2={};var _0x1839db={};var _0x146658;var _0x8dabee;return db[_0xf0e0('0x2c')]['findOne']({'where':{'id':_0x261d31['params']['id']}})[_0xf0e0('0x15')](handleEntityNotFound(_0x2f6b71,null))[_0xf0e0('0x15')](function(_0x4020bb){if(_0x4020bb){_0x146658=_0x4020bb;_0x1839db[_0xf0e0('0x2e')]=_[_0xf0e0('0x2f')](db['VtigerConfiguration'][_0xf0e0('0x2d')]);_0x1839db[_0xf0e0('0x31')]=_[_0xf0e0('0x2f')](_0x261d31[_0xf0e0('0x31')]);_0x1839db['filters']=_[_0xf0e0('0x34')](_0x1839db[_0xf0e0('0x2e')],_0x1839db[_0xf0e0('0x31')]);_0x24f7a2[_0xf0e0('0x36')]=_['intersection'](_0x1839db[_0xf0e0('0x2e')],qs[_0xf0e0('0x35')](_0x261d31[_0xf0e0('0x31')][_0xf0e0('0x35')]));_0x24f7a2['attributes']=_0x24f7a2[_0xf0e0('0x36')][_0xf0e0('0x37')]?_0x24f7a2['attributes']:_0x1839db[_0xf0e0('0x2e')];_0x24f7a2[_0xf0e0('0x39')]=qs[_0xf0e0('0x3a')](_0x261d31[_0xf0e0('0x31')][_0xf0e0('0x3a')]);_0x24f7a2['where']=qs[_0xf0e0('0x33')](_[_0xf0e0('0x3b')](_0x261d31[_0xf0e0('0x31')],_0x1839db['filters']));if(_0x261d31[_0xf0e0('0x31')]['filter']){_0x24f7a2[_0xf0e0('0x3e')]=_[_0xf0e0('0x3f')](_0x24f7a2[_0xf0e0('0x3e')],{'$or':_[_0xf0e0('0x4b')](_0x24f7a2[_0xf0e0('0x36')],function(_0x38ec39){var _0x540761={};_0x540761[_0x38ec39]={'$like':'%'+_0x261d31[_0xf0e0('0x31')][_0xf0e0('0x40')]+'%'};return _0x540761;})});}_0x24f7a2=_[_0xf0e0('0x3f')]({},_0x24f7a2,_0x261d31['options']);return _0x146658[_0xf0e0('0x4a')](_0x24f7a2);}})[_0xf0e0('0x15')](function(_0x47c8aa){if(_0x47c8aa){_0x8dabee=_0x47c8aa['length'];if(!_0x261d31['query']['hasOwnProperty'](_0xf0e0('0x4c'))){_0x24f7a2[_0xf0e0('0x38')]=qs['limit'](_0x261d31['query'][_0xf0e0('0x38')]);_0x24f7a2['offset']=qs[_0xf0e0('0x1f')](_0x261d31[_0xf0e0('0x31')][_0xf0e0('0x1f')]);}return _0x146658[_0xf0e0('0x4a')](_0x24f7a2);}})[_0xf0e0('0x15')](function(_0x5d9cbe){if(_0x5d9cbe){return _0x5d9cbe?{'count':_0x8dabee,'rows':_0x5d9cbe}:null;}})[_0xf0e0('0x15')](respondWithResult(_0x2f6b71,null))[_0xf0e0('0x1d')](handleError(_0x2f6b71,null));};exports[_0xf0e0('0x4d')]=function(_0x37f97f,_0x4a711b,_0x5f4c37){if(_0x37f97f[_0xf0e0('0x48')]['id']){delete _0x37f97f[_0xf0e0('0x48')]['id'];}return db[_0xf0e0('0x2c')]['findOne']({'where':{'id':_0x37f97f[_0xf0e0('0x45')]['id']}})[_0xf0e0('0x15')](handleEntityNotFound(_0x4a711b,null))[_0xf0e0('0x15')](function(_0x550086){if(_0x550086){_0x37f97f[_0xf0e0('0x48')]['AccountId']=_0x550086['id'];_0x37f97f[_0xf0e0('0x48')][_0xf0e0('0x4e')]=integrations[_0xf0e0('0x4f')](_0x37f97f[_0xf0e0('0x48')][_0xf0e0('0x50')],_0x37f97f[_0xf0e0('0x48')]['type']);_0x37f97f['body'][_0xf0e0('0x51')]=integrations[_0xf0e0('0x52')](_0x37f97f[_0xf0e0('0x48')][_0xf0e0('0x50')],_0x37f97f[_0xf0e0('0x48')][_0xf0e0('0x53')]);return db[_0xf0e0('0x54')][_0xf0e0('0x47')](_0x37f97f[_0xf0e0('0x48')],{'include':[{'model':db[_0xf0e0('0x55')],'as':_0xf0e0('0x4e')},{'model':db[_0xf0e0('0x55')],'as':'Descriptions'}]});}return null;})[_0xf0e0('0x15')](respondWithResult(_0x4a711b,null))[_0xf0e0('0x1d')](handleError(_0x4a711b,null));};var md5=require(_0xf0e0('0x56'));exports['getFields']=function(_0x3a8d91,_0x1eb17d,_0x17e109){var _0x49b69c=null;var _0x47a669=null;var _0x3da817=null;var _0x5b3a2c=null;return db[_0xf0e0('0x2c')][_0xf0e0('0x57')]({'where':{'id':_0x3a8d91[_0xf0e0('0x45')]['id']},'attributes':['id',_0xf0e0('0x29'),_0xf0e0('0x58'),_0xf0e0('0x59'),'moduleName','remoteUri',_0xf0e0('0x5a'),_0xf0e0('0x5b')]})[_0xf0e0('0x15')](handleEntityNotFound(_0x1eb17d,null))[_0xf0e0('0x15')](function(_0x303e40){if(_0x303e40){_0x49b69c=_0x303e40['username'];_0x47a669=_0x303e40[_0xf0e0('0x5b')];_0x3da817=_0x303e40[_0xf0e0('0x5c')];_0x5b3a2c=util[_0xf0e0('0x5d')](_0xf0e0('0x5e'),_0x303e40[_0xf0e0('0x5f')]);var _0x5376e6={'method':_0xf0e0('0x60'),'uri':_0x5b3a2c,'qs':{'operation':'getchallenge','username':_0x303e40[_0xf0e0('0x58')]},'json':!![]};return rp(_0x5376e6);}})[_0xf0e0('0x15')](function(_0x4aff7e){if(_0x4aff7e[_0xf0e0('0x61')]){var _0x30f330={'method':_0xf0e0('0x62'),'uri':_0x5b3a2c,'form':{'operation':_0xf0e0('0x63'),'username':_0x49b69c,'accessKey':md5(_0x4aff7e[_0xf0e0('0x64')][_0xf0e0('0x65')]+_0x47a669)},'json':!![]};return rp(_0x30f330);}})['then'](function(_0x4ae602){if(_0x4ae602['success']){var _0x32a7ce={'method':_0xf0e0('0x60'),'uri':_0x5b3a2c,'qs':{'operation':_0xf0e0('0x66'),'username':_0x49b69c,'sessionName':_0x4ae602[_0xf0e0('0x64')][_0xf0e0('0x67')],'elementType':_0x3da817},'json':!![]};return rp(_0x32a7ce);}})[_0xf0e0('0x15')](function(_0x751548){if(_0x751548[_0xf0e0('0x61')]){var _0xa1f5fb=[_0xf0e0('0x68'),_0xf0e0('0x69'),_0xf0e0('0x6a')];_[_0xf0e0('0x6b')](_0x751548[_0xf0e0('0x64')][_0xf0e0('0x35')],function(_0x1292e0){return _0xa1f5fb[_0xf0e0('0x6c')](_0x1292e0[_0xf0e0('0x53')][_0xf0e0('0x29')]);});_[_0xf0e0('0x6b')](_0x751548['result'][_0xf0e0('0x35')],function(_0x1a61ba){return _0x1a61ba[_0xf0e0('0x6d')]===_0xf0e0('0x6e');});return{'count':_0x751548[_0xf0e0('0x64')][_0xf0e0('0x35')][_0xf0e0('0x37')],'rows':_[_0xf0e0('0x4b')](_0x751548[_0xf0e0('0x64')][_0xf0e0('0x35')],function(_0x223af5){return{'id':_0x223af5[_0xf0e0('0x29')],'name':_0x223af5[_0xf0e0('0x6f')],'custom':_[_0xf0e0('0x70')](_0x223af5[_0xf0e0('0x29')],_0xf0e0('0x71'))?!![]:![],'options':_0x223af5[_0xf0e0('0x53')][_0xf0e0('0x29')]==='picklist'&&_0x223af5[_0xf0e0('0x53')][_0xf0e0('0x72')]['length']>0x0?_[_0xf0e0('0x4b')](_0x223af5[_0xf0e0('0x53')][_0xf0e0('0x72')],function(_0x3c4494){return{'name':_0x3c4494['label'],'value':_0x3c4494[_0xf0e0('0x73')]};}):[]};})};}})[_0xf0e0('0x15')](respondWithResult(_0x1eb17d,null))[_0xf0e0('0x1d')](function(_0x13df52){console[_0xf0e0('0x74')](_0xf0e0('0x75')+_0x13df52);var _0x143db5=_0x3a8d91[_0xf0e0('0x31')][_0xf0e0('0x76')]?0x1f4:_0x13df52[_0xf0e0('0x77')]||0x1f4;logger[_0xf0e0('0x19')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x143db5,JSON[_0xf0e0('0x18')](_0x13df52));delete _0x13df52['name'];if(_0x143db5===0x191){_0x143db5=0x190;}_0x1eb17d[_0xf0e0('0x1e')](_0x143db5)['send'](_0x3a8d91[_0xf0e0('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x13df52[_0xf0e0('0x77')]}:_0x13df52);});}; \ No newline at end of file +var _0x5fc7=['../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','count','offset','limit','json','apply','reject','save','update','then','destroy','stack','name','send','index','VtigerAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','includeAll','findAll','show','include','options','find','create','body','params','findOne','VtigerConfiguration','order','getConfigurations','addConfiguration','getSubjects','channel','type','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','%s/webservice.php','GET','getchallenge','success','login','describe','result','sessionName','autogenerated','reference','remove','editable','false','map','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api'];(function(_0x16eb81,_0x25e808){var _0x5a8b46=function(_0x454b9d){while(--_0x454b9d){_0x16eb81['push'](_0x16eb81['shift']());}};_0x5a8b46(++_0x25e808);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x5fc7[_0x235f49];return _0x551139;};'use strict';var jsonpatch=require(_0x75fc('0x0'));var rp=require(_0x75fc('0x1'));var moment=require(_0x75fc('0x2'));var BPromise=require(_0x75fc('0x3'));var Mustache=require(_0x75fc('0x4'));var util=require(_0x75fc('0x5'));var path=require(_0x75fc('0x6'));var sox=require(_0x75fc('0x7'));var csv=require(_0x75fc('0x8'));var ejs=require(_0x75fc('0x9'));var fs=require('fs');var _=require(_0x75fc('0xa'));var squel=require(_0x75fc('0xb'));var crypto=require('crypto');var jsforce=require(_0x75fc('0xc'));var deskjs=require(_0x75fc('0xd'));var toCsv=require(_0x75fc('0x8'));var querystring=require(_0x75fc('0xe'));var Papa=require(_0x75fc('0xf'));var qs=require(_0x75fc('0x10'));var logger=require(_0x75fc('0x11'))(_0x75fc('0x12'));var utils=require(_0x75fc('0x13'));var config=require(_0x75fc('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x75fc('0x15'));var jayson=require(_0x75fc('0x16'));var client=jayson[_0x75fc('0x17')][_0x75fc('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5e4cb9,_0x465668,_0x1dd5c6,_0x453bb3){return new BPromise(function(_0x2e029a,_0xf703a7){var _0x22bdb0=_0x453bb3||client;return _0x22bdb0[_0x75fc('0x19')](_0x5e4cb9,_0x1dd5c6)['then'](function(_0x50711e){logger['info'](_0x75fc('0x1a'),_0x465668,_0x75fc('0x1b'));logger[_0x75fc('0x1c')](_0x75fc('0x1d'),_0x465668,_0x75fc('0x1b'),JSON[_0x75fc('0x1e')](_0x50711e));if(_0x50711e[_0x75fc('0x1f')]){if(_0x50711e[_0x75fc('0x1f')]['code']===0x1f4){logger[_0x75fc('0x1f')](_0x75fc('0x1a'),_0x465668,_0x50711e['error'][_0x75fc('0x20')]);return _0xf703a7(_0x50711e[_0x75fc('0x1f')]['message']);}logger['error'](_0x75fc('0x1a'),_0x465668,_0x50711e[_0x75fc('0x1f')][_0x75fc('0x20')]);return _0x2e029a(_0x50711e[_0x75fc('0x1f')][_0x75fc('0x20')]);}else{logger[_0x75fc('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x465668,_0x75fc('0x1b'));_0x2e029a(_0x50711e['result'][_0x75fc('0x20')]);}})[_0x75fc('0x22')](function(_0x2780e3){logger[_0x75fc('0x1f')]('VtigerAccount,\x20%s,\x20%s',_0x465668,_0x2780e3);_0xf703a7(_0x2780e3);});});}function respondWithStatusCode(_0x34cf9c,_0x123bfb){_0x123bfb=_0x123bfb||0xcc;return function(_0x48f586){if(_0x48f586){return _0x34cf9c[_0x75fc('0x23')](_0x123bfb);}return _0x34cf9c[_0x75fc('0x24')](_0x123bfb)['end']();};}function respondWithResult(_0x425c66,_0x5a79e0){_0x5a79e0=_0x5a79e0||0xc8;return function(_0x14745f){if(_0x14745f){return _0x425c66[_0x75fc('0x24')](_0x5a79e0)['json'](_0x14745f);}};}function respondWithFilteredResult(_0xd8b8e1,_0x151046){return function(_0x5a62ef){if(_0x5a62ef){var _0x3a44d1=_0x5a62ef[_0x75fc('0x25')],_0x2418be=_0x151046['offset'],_0x53fcd2=_0x151046[_0x75fc('0x26')]+_0x151046[_0x75fc('0x27')],_0x5774bb;if(_0x53fcd2>=_0x3a44d1){_0x53fcd2=_0x3a44d1;_0x5774bb=0xc8;}else{_0x5774bb=0xce;}_0xd8b8e1['status'](_0x5774bb);return _0xd8b8e1['set']('Content-Range',_0x2418be+'-'+_0x53fcd2+'/'+_0x3a44d1)[_0x75fc('0x28')](_0x5a62ef);}return null;};}function patchUpdates(_0x3ceb61){return function(_0x219d0c){try{jsonpatch[_0x75fc('0x29')](_0x219d0c,_0x3ceb61,!![]);}catch(_0xe13951){return BPromise[_0x75fc('0x2a')](_0xe13951);}return _0x219d0c[_0x75fc('0x2b')]();};}function saveUpdates(_0x54bcd5,_0x23aa27){return function(_0x3e99d7){if(_0x3e99d7){return _0x3e99d7[_0x75fc('0x2c')](_0x54bcd5)[_0x75fc('0x2d')](function(_0x5c8adb){return _0x5c8adb;});}return null;};}function removeEntity(_0x214b30,_0x486e3f){return function(_0x12b8a1){if(_0x12b8a1){return _0x12b8a1[_0x75fc('0x2e')]()[_0x75fc('0x2d')](function(){_0x214b30[_0x75fc('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26fdf0,_0x4d5981){return function(_0xaddfc9){if(!_0xaddfc9){_0x26fdf0[_0x75fc('0x23')](0x194);}return _0xaddfc9;};}function handleError(_0x5e4cdb,_0x1131d5){_0x1131d5=_0x1131d5||0x1f4;return function(_0xb00b6e){logger['error'](_0xb00b6e[_0x75fc('0x2f')]);if(_0xb00b6e[_0x75fc('0x30')]){delete _0xb00b6e[_0x75fc('0x30')];}_0x5e4cdb[_0x75fc('0x24')](_0x1131d5)[_0x75fc('0x31')](_0xb00b6e);};}exports[_0x75fc('0x32')]=function(_0x287233,_0xed3b78){var _0x581475={},_0xeebc79={},_0x447c13={'count':0x0,'rows':[]};var _0x46dfa2=db[_0x75fc('0x33')][_0x75fc('0x34')];_0xeebc79[_0x75fc('0x35')]=_[_0x75fc('0x36')](_0x46dfa2);var _0x10ea7c={'dateStart':_0x287233[_0x75fc('0x37')][_0x75fc('0x38')],'dateEnd':_0x287233[_0x75fc('0x37')][_0x75fc('0x39')]};delete _0x287233[_0x75fc('0x37')]['dateStart'];delete _0x287233[_0x75fc('0x37')][_0x75fc('0x39')];_0xeebc79[_0x75fc('0x37')]=_[_0x75fc('0x36')](_0x287233['query']);_0xeebc79[_0x75fc('0x3a')]=_[_0x75fc('0x3b')](_0xeebc79[_0x75fc('0x35')],_0xeebc79[_0x75fc('0x37')]);_0x581475[_0x75fc('0x3c')]=_[_0x75fc('0x3b')](_0xeebc79[_0x75fc('0x35')],qs[_0x75fc('0x3d')](_0x287233['query'][_0x75fc('0x3d')]));_0x581475[_0x75fc('0x3c')]=_0x581475[_0x75fc('0x3c')][_0x75fc('0x3e')]?_0x581475[_0x75fc('0x3c')]:_0xeebc79[_0x75fc('0x35')];if(!_0x287233['query'][_0x75fc('0x3f')](_0x75fc('0x40'))){_0x581475['limit']=qs[_0x75fc('0x27')](_0x287233[_0x75fc('0x37')][_0x75fc('0x27')]);_0x581475[_0x75fc('0x26')]=qs[_0x75fc('0x26')](_0x287233['query'][_0x75fc('0x26')]);}_0x581475['order']=qs[_0x75fc('0x41')](_0x287233[_0x75fc('0x37')][_0x75fc('0x41')]);_0x581475[_0x75fc('0x42')]=qs[_0x75fc('0x3a')](_[_0x75fc('0x43')](_0x287233[_0x75fc('0x37')],_0xeebc79[_0x75fc('0x3a')]));if(_0x10ea7c[_0x75fc('0x38')]){if(_0x10ea7c['dateEnd']){_0x10ea7c[_0x75fc('0x39')]=moment(_0x10ea7c[_0x75fc('0x39')])[_0x75fc('0x44')](0x1,_0x75fc('0x45'));}else{_0x10ea7c[_0x75fc('0x39')]=moment(_0x10ea7c['dateStart'])[_0x75fc('0x44')](0x1,_0x75fc('0x45'));}_[_0x75fc('0x46')](_0x581475['where'],{'createdAt':{'$gte':_0x10ea7c[_0x75fc('0x38')],'$lte':_0x10ea7c[_0x75fc('0x39')]}});}if(_0x287233[_0x75fc('0x37')][_0x75fc('0x47')]){_0x581475[_0x75fc('0x42')]=_[_0x75fc('0x46')](_0x581475[_0x75fc('0x42')],{'$or':_['map'](_0x581475[_0x75fc('0x3c')],function(_0x1fe4ac){var _0x5ae30e={};_0x5ae30e[_0x1fe4ac]={'$like':'%'+_0x287233[_0x75fc('0x37')][_0x75fc('0x47')]+'%'};return _0x5ae30e;})});}_0x581475=_[_0x75fc('0x46')]({},_0x581475,_0x287233['options']);var _0x261113={'where':_0x581475['where']};return db['VtigerAccount']['count'](_0x261113)[_0x75fc('0x2d')](function(_0x28e43c){_0x447c13[_0x75fc('0x25')]=_0x28e43c;if(_0x287233['query'][_0x75fc('0x48')]){_0x581475['include']=[{'all':!![]}];}return db[_0x75fc('0x33')][_0x75fc('0x49')](_0x581475);})[_0x75fc('0x2d')](function(_0x947e85){_0x447c13['rows']=_0x947e85;return _0x447c13;})[_0x75fc('0x2d')](respondWithFilteredResult(_0xed3b78,_0x581475))[_0x75fc('0x22')](handleError(_0xed3b78,null));};exports[_0x75fc('0x4a')]=function(_0x18adf7,_0x464cde){var _0x887cd4={'raw':![],'where':{'id':_0x18adf7['params']['id']}},_0x31037c={};_0x31037c[_0x75fc('0x35')]=_['keys'](db[_0x75fc('0x33')][_0x75fc('0x34')]);_0x31037c[_0x75fc('0x37')]=_[_0x75fc('0x36')](_0x18adf7[_0x75fc('0x37')]);_0x31037c[_0x75fc('0x3a')]=_[_0x75fc('0x3b')](_0x31037c[_0x75fc('0x35')],_0x31037c[_0x75fc('0x37')]);_0x887cd4['attributes']=_[_0x75fc('0x3b')](_0x31037c[_0x75fc('0x35')],qs[_0x75fc('0x3d')](_0x18adf7[_0x75fc('0x37')]['fields']));_0x887cd4['attributes']=_0x887cd4[_0x75fc('0x3c')]['length']?_0x887cd4[_0x75fc('0x3c')]:_0x31037c[_0x75fc('0x35')];if(_0x18adf7[_0x75fc('0x37')][_0x75fc('0x48')]){_0x887cd4[_0x75fc('0x4b')]=[{'all':!![]}];}_0x887cd4=_[_0x75fc('0x46')]({},_0x887cd4,_0x18adf7[_0x75fc('0x4c')]);return db[_0x75fc('0x33')][_0x75fc('0x4d')](_0x887cd4)[_0x75fc('0x2d')](handleEntityNotFound(_0x464cde,null))['then'](respondWithResult(_0x464cde,null))[_0x75fc('0x22')](handleError(_0x464cde,null));};exports[_0x75fc('0x4e')]=function(_0x1518bf,_0x4dd0f3){return db['VtigerAccount'][_0x75fc('0x4e')](_0x1518bf[_0x75fc('0x4f')],{})[_0x75fc('0x2d')](respondWithResult(_0x4dd0f3,0xc9))[_0x75fc('0x22')](handleError(_0x4dd0f3,null));};exports['update']=function(_0x18fa7a,_0x47d7d8){if(_0x18fa7a['body']['id']){delete _0x18fa7a[_0x75fc('0x4f')]['id'];}return db['VtigerAccount'][_0x75fc('0x4d')]({'where':{'id':_0x18fa7a[_0x75fc('0x50')]['id']}})[_0x75fc('0x2d')](handleEntityNotFound(_0x47d7d8,null))['then'](saveUpdates(_0x18fa7a[_0x75fc('0x4f')],null))[_0x75fc('0x2d')](respondWithResult(_0x47d7d8,null))[_0x75fc('0x22')](handleError(_0x47d7d8,null));};exports[_0x75fc('0x2e')]=function(_0x45cd82,_0x3c14b8){return db[_0x75fc('0x33')][_0x75fc('0x4d')]({'where':{'id':_0x45cd82[_0x75fc('0x50')]['id']}})['then'](handleEntityNotFound(_0x3c14b8,null))['then'](removeEntity(_0x3c14b8,null))[_0x75fc('0x22')](handleError(_0x3c14b8,null));};exports['getConfigurations']=function(_0x372460,_0x43723b,_0x499385){var _0x179ac8={};var _0x3d2687={};var _0x5b749b;var _0x10fcb3;return db[_0x75fc('0x33')][_0x75fc('0x51')]({'where':{'id':_0x372460['params']['id']}})[_0x75fc('0x2d')](handleEntityNotFound(_0x43723b,null))[_0x75fc('0x2d')](function(_0x11ded3){if(_0x11ded3){_0x5b749b=_0x11ded3;_0x3d2687[_0x75fc('0x35')]=_[_0x75fc('0x36')](db[_0x75fc('0x52')][_0x75fc('0x34')]);_0x3d2687['query']=_[_0x75fc('0x36')](_0x372460['query']);_0x3d2687['filters']=_['intersection'](_0x3d2687[_0x75fc('0x35')],_0x3d2687[_0x75fc('0x37')]);_0x179ac8[_0x75fc('0x3c')]=_[_0x75fc('0x3b')](_0x3d2687['model'],qs[_0x75fc('0x3d')](_0x372460[_0x75fc('0x37')]['fields']));_0x179ac8[_0x75fc('0x3c')]=_0x179ac8[_0x75fc('0x3c')]['length']?_0x179ac8[_0x75fc('0x3c')]:_0x3d2687[_0x75fc('0x35')];_0x179ac8[_0x75fc('0x53')]=qs[_0x75fc('0x41')](_0x372460[_0x75fc('0x37')][_0x75fc('0x41')]);_0x179ac8[_0x75fc('0x42')]=qs[_0x75fc('0x3a')](_[_0x75fc('0x43')](_0x372460[_0x75fc('0x37')],_0x3d2687['filters']));if(_0x372460[_0x75fc('0x37')][_0x75fc('0x47')]){_0x179ac8[_0x75fc('0x42')]=_[_0x75fc('0x46')](_0x179ac8[_0x75fc('0x42')],{'$or':_['map'](_0x179ac8[_0x75fc('0x3c')],function(_0x2ed807){var _0x4c6140={};_0x4c6140[_0x2ed807]={'$like':'%'+_0x372460['query']['filter']+'%'};return _0x4c6140;})});}_0x179ac8=_[_0x75fc('0x46')]({},_0x179ac8,_0x372460[_0x75fc('0x4c')]);return _0x5b749b[_0x75fc('0x54')](_0x179ac8);}})[_0x75fc('0x2d')](function(_0x18c6bb){if(_0x18c6bb){_0x10fcb3=_0x18c6bb[_0x75fc('0x3e')];if(!_0x372460['query']['hasOwnProperty'](_0x75fc('0x40'))){_0x179ac8[_0x75fc('0x27')]=qs['limit'](_0x372460['query'][_0x75fc('0x27')]);_0x179ac8[_0x75fc('0x26')]=qs[_0x75fc('0x26')](_0x372460[_0x75fc('0x37')]['offset']);}return _0x5b749b['getConfigurations'](_0x179ac8);}})[_0x75fc('0x2d')](function(_0x5743a9){if(_0x5743a9){return _0x5743a9?{'count':_0x10fcb3,'rows':_0x5743a9}:null;}})[_0x75fc('0x2d')](respondWithResult(_0x43723b,null))[_0x75fc('0x22')](handleError(_0x43723b,null));};exports[_0x75fc('0x55')]=function(_0x4274a3,_0x4395b8,_0xb65700){if(_0x4274a3[_0x75fc('0x4f')]['id']){delete _0x4274a3[_0x75fc('0x4f')]['id'];}return db[_0x75fc('0x33')]['findOne']({'where':{'id':_0x4274a3[_0x75fc('0x50')]['id']}})[_0x75fc('0x2d')](handleEntityNotFound(_0x4395b8,null))[_0x75fc('0x2d')](function(_0x272780){if(_0x272780){_0x4274a3[_0x75fc('0x4f')]['AccountId']=_0x272780['id'];_0x4274a3[_0x75fc('0x4f')]['Subjects']=integrations[_0x75fc('0x56')](_0x4274a3[_0x75fc('0x4f')][_0x75fc('0x57')],_0x4274a3[_0x75fc('0x4f')][_0x75fc('0x58')]);_0x4274a3['body'][_0x75fc('0x59')]=integrations[_0x75fc('0x5a')](_0x4274a3[_0x75fc('0x4f')][_0x75fc('0x57')],_0x4274a3[_0x75fc('0x4f')]['type']);return db[_0x75fc('0x52')][_0x75fc('0x4e')](_0x4274a3[_0x75fc('0x4f')],{'include':[{'model':db[_0x75fc('0x5b')],'as':_0x75fc('0x5c')},{'model':db[_0x75fc('0x5b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4395b8,null))[_0x75fc('0x22')](handleError(_0x4395b8,null));};var md5=require(_0x75fc('0x5d'));exports[_0x75fc('0x5e')]=function(_0x31f451,_0x1b809e,_0x1a2594){var _0x4070a5=null;var _0x2020ba=null;var _0x2e7074=null;var _0x55ef22=null;return db[_0x75fc('0x33')][_0x75fc('0x51')]({'where':{'id':_0x31f451[_0x75fc('0x50')]['id']},'attributes':['id','name','username',_0x75fc('0x5f'),_0x75fc('0x60'),_0x75fc('0x61'),_0x75fc('0x62'),_0x75fc('0x63')]})[_0x75fc('0x2d')](handleEntityNotFound(_0x1b809e,null))['then'](function(_0x176ee8){if(_0x176ee8){_0x4070a5=_0x176ee8[_0x75fc('0x64')];_0x2020ba=_0x176ee8[_0x75fc('0x63')];_0x2e7074=_0x176ee8[_0x75fc('0x60')];_0x55ef22=util['format'](_0x75fc('0x65'),_0x176ee8[_0x75fc('0x61')]);var _0x493764={'method':_0x75fc('0x66'),'uri':_0x55ef22,'qs':{'operation':_0x75fc('0x67'),'username':_0x176ee8[_0x75fc('0x64')]},'json':!![]};return rp(_0x493764);}})[_0x75fc('0x2d')](function(_0xaee7eb){if(_0xaee7eb[_0x75fc('0x68')]){var _0x30dd19={'method':'POST','uri':_0x55ef22,'form':{'operation':_0x75fc('0x69'),'username':_0x4070a5,'accessKey':md5(_0xaee7eb['result']['token']+_0x2020ba)},'json':!![]};return rp(_0x30dd19);}})[_0x75fc('0x2d')](function(_0x5be292){if(_0x5be292[_0x75fc('0x68')]){var _0xeac7a1={'method':'GET','uri':_0x55ef22,'qs':{'operation':_0x75fc('0x6a'),'username':_0x4070a5,'sessionName':_0x5be292[_0x75fc('0x6b')][_0x75fc('0x6c')],'elementType':_0x2e7074},'json':!![]};return rp(_0xeac7a1);}})['then'](function(_0x3a27ac){if(_0x3a27ac[_0x75fc('0x68')]){var _0x45bb96=[_0x75fc('0x6d'),_0x75fc('0x6e'),'owner'];_['remove'](_0x3a27ac[_0x75fc('0x6b')]['fields'],function(_0x323f5c){return _0x45bb96['includes'](_0x323f5c[_0x75fc('0x58')][_0x75fc('0x30')]);});_[_0x75fc('0x6f')](_0x3a27ac['result'][_0x75fc('0x3d')],function(_0x2d4f7e){return _0x2d4f7e[_0x75fc('0x70')]===_0x75fc('0x71');});return{'count':_0x3a27ac[_0x75fc('0x6b')][_0x75fc('0x3d')][_0x75fc('0x3e')],'rows':_[_0x75fc('0x72')](_0x3a27ac[_0x75fc('0x6b')][_0x75fc('0x3d')],function(_0x31f6a7){return{'id':_0x31f6a7[_0x75fc('0x30')],'name':_0x31f6a7[_0x75fc('0x73')],'custom':_[_0x75fc('0x74')](_0x31f6a7[_0x75fc('0x30')],_0x75fc('0x75'))?!![]:![],'options':_0x31f6a7[_0x75fc('0x58')]['name']===_0x75fc('0x76')&&_0x31f6a7[_0x75fc('0x58')]['picklistValues']['length']>0x0?_[_0x75fc('0x72')](_0x31f6a7[_0x75fc('0x58')][_0x75fc('0x77')],function(_0x1267a2){return{'name':_0x1267a2[_0x75fc('0x73')],'value':_0x1267a2[_0x75fc('0x78')]};}):[]};})};}})[_0x75fc('0x2d')](respondWithResult(_0x1b809e,null))[_0x75fc('0x22')](function(_0x11e779){console[_0x75fc('0x79')](_0x75fc('0x7a')+_0x11e779);var _0x3d2f2e=_0x31f451[_0x75fc('0x37')]['test']?0x1f4:_0x11e779[_0x75fc('0x7b')]||0x1f4;logger[_0x75fc('0x1f')](_0x75fc('0x7c'),_0x75fc('0x5e'),_0x3d2f2e,JSON[_0x75fc('0x1e')](_0x11e779));delete _0x11e779['name'];if(_0x3d2f2e===0x191){_0x3d2f2e=0x190;}_0x1b809e[_0x75fc('0x24')](_0x3d2f2e)[_0x75fc('0x31')](_0x31f451[_0x75fc('0x37')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x11e779['statusCode']}:_0x11e779);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 26353cd..943518e 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 _0x9ec2=['lodash','util','moment','request-promise','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x1a133b,_0x62348b){var _0x132b03=function(_0x4a1290){while(--_0x4a1290){_0x1a133b['push'](_0x1a133b['shift']());}};_0x132b03(++_0x62348b);}(_0x9ec2,0x186));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x29ec('0x0'));var util=require(_0x29ec('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x29ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x29ec('0x3'));var attributes=require(_0x29ec('0x4'));var integrations=require(_0x29ec('0x5'));module[_0x29ec('0x6')]=function(_0x560d37,_0x3d6893){return _0x560d37[_0x29ec('0x7')](_0x29ec('0x8'),attributes,{'tableName':_0x29ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x940e=['api','moment','bluebird','request-promise','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger'];(function(_0x7a99ab,_0x53847f){var _0x3702f7=function(_0x90844a){while(--_0x90844a){_0x7a99ab['push'](_0x7a99ab['shift']());}};_0x3702f7(++_0x53847f);}(_0x940e,0xee));var _0xe940=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x940e[_0x13524d];return _0x9918b4;};'use strict';var _=require('lodash');var util=require(_0xe940('0x0'));var logger=require(_0xe940('0x1'))(_0xe940('0x2'));var moment=require(_0xe940('0x3'));var BPromise=require(_0xe940('0x4'));var rp=require(_0xe940('0x5'));var attributes=require(_0xe940('0x6'));var integrations=require(_0xe940('0x7'));module[_0xe940('0x8')]=function(_0x42e409,_0x31ba49){return _0x42e409[_0xe940('0x9')](_0xe940('0xa'),attributes,{'tableName':_0xe940('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 2446fc5..2f3e981 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 _0x4115=['ShowVtigerAccount','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','VtigerAccount'];(function(_0xbc49a1,_0x58cea7){var _0x3800a1=function(_0x5e0389){while(--_0x5e0389){_0xbc49a1['push'](_0xbc49a1['shift']());}};_0x3800a1(++_0x58cea7);}(_0x4115,0x141));var _0x5411=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x4115[_0x45d3f0];return _0x314b79;};'use strict';var _=require('lodash');var util=require(_0x5411('0x0'));var moment=require('moment');var BPromise=require(_0x5411('0x1'));var rs=require(_0x5411('0x2'));var fs=require('fs');var db=require(_0x5411('0x3'))['db'];var utils=require(_0x5411('0x4'));var logger=require('../../config/logger')(_0x5411('0x5'));var config=require('../../config/environment');var jayson=require(_0x5411('0x6'));var client=jayson[_0x5411('0x7')][_0x5411('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d4a56,_0x413df0,_0x185890){return new BPromise(function(_0x4e12f4,_0x40f659){return client['request'](_0x4d4a56,_0x185890)['then'](function(_0x18cd3d){logger[_0x5411('0x9')]('VtigerAccount,\x20%s,\x20%s',_0x413df0,_0x5411('0xa'));logger[_0x5411('0xb')](_0x5411('0xc'),_0x413df0,_0x5411('0xa'),JSON[_0x5411('0xd')](_0x18cd3d));if(_0x18cd3d['error']){if(_0x18cd3d['error']['code']===0x1f4){logger[_0x5411('0xe')](_0x5411('0xf'),_0x413df0,_0x18cd3d[_0x5411('0xe')][_0x5411('0x10')]);return _0x40f659(_0x18cd3d['error'][_0x5411('0x10')]);}logger[_0x5411('0xe')](_0x5411('0xf'),_0x413df0,_0x18cd3d['error']['message']);return _0x4e12f4(_0x18cd3d[_0x5411('0xe')][_0x5411('0x10')]);}else{logger[_0x5411('0x9')](_0x5411('0xf'),_0x413df0,_0x5411('0xa'));_0x4e12f4(_0x18cd3d[_0x5411('0x11')][_0x5411('0x10')]);}})[_0x5411('0x12')](function(_0x3769a7){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x413df0,_0x3769a7);_0x40f659(_0x3769a7);});});}exports[_0x5411('0x13')]=function(_0xef9b1d){var _0x16c922=this;return new Promise(function(_0x2bf482,_0x2c9f41){return db['VtigerAccount'][_0x5411('0x14')]({'raw':_0xef9b1d[_0x5411('0x15')]?_0xef9b1d[_0x5411('0x15')][_0x5411('0x16')]===undefined?!![]:![]:!![],'where':_0xef9b1d[_0x5411('0x15')]?_0xef9b1d[_0x5411('0x15')][_0x5411('0x17')]||null:null,'attributes':_0xef9b1d['options']?_0xef9b1d[_0x5411('0x15')]['attributes']||null:null,'limit':_0xef9b1d[_0x5411('0x15')]?_0xef9b1d[_0x5411('0x15')][_0x5411('0x18')]||null:null,'include':_0xef9b1d[_0x5411('0x15')]?_0xef9b1d[_0x5411('0x15')][_0x5411('0x19')]?_[_0x5411('0x1a')](_0xef9b1d[_0x5411('0x15')][_0x5411('0x19')],function(_0x4b20fb){return{'model':db[_0x4b20fb[_0x5411('0x1b')]],'as':_0x4b20fb['as'],'attributes':_0x4b20fb[_0x5411('0x1c')],'include':_0x4b20fb[_0x5411('0x19')]?_['map'](_0x4b20fb[_0x5411('0x19')],function(_0x4e923e){return{'model':db[_0x4e923e[_0x5411('0x1b')]],'as':_0x4e923e['as'],'attributes':_0x4e923e[_0x5411('0x1c')],'include':_0x4e923e[_0x5411('0x19')]?_[_0x5411('0x1a')](_0x4e923e['include'],function(_0x5b0488){return{'model':db[_0x5b0488[_0x5411('0x1b')]],'as':_0x5b0488['as'],'attributes':_0x5b0488[_0x5411('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5411('0x1d')](function(_0x55ea8c){logger[_0x5411('0x9')]('GetVtigerAccount',_0xef9b1d);logger[_0x5411('0xb')](_0x5411('0x13'),_0xef9b1d,JSON[_0x5411('0xd')](_0x55ea8c));_0x2bf482(_0x55ea8c);})[_0x5411('0x12')](function(_0x52fffb){logger['error'](_0x5411('0x13'),_0x52fffb[_0x5411('0x10')],_0xef9b1d);_0x2c9f41(_0x16c922[_0x5411('0xe')](0x1f4,_0x52fffb[_0x5411('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x39add0){var _0x5cc374=this;return new Promise(function(_0x2def27,_0x2227a0){return db[_0x5411('0x1e')]['find']({'raw':_0x39add0[_0x5411('0x15')]?_0x39add0['options']['raw']===undefined?!![]:![]:!![],'where':_0x39add0[_0x5411('0x15')]?_0x39add0['options'][_0x5411('0x17')]||null:null,'attributes':_0x39add0['options']?_0x39add0[_0x5411('0x15')][_0x5411('0x1c')]||null:null,'include':_0x39add0[_0x5411('0x15')]?_0x39add0[_0x5411('0x15')][_0x5411('0x19')]?_[_0x5411('0x1a')](_0x39add0[_0x5411('0x15')][_0x5411('0x19')],function(_0x29f0fb){return{'model':db[_0x29f0fb[_0x5411('0x1b')]],'as':_0x29f0fb['as'],'attributes':_0x29f0fb[_0x5411('0x1c')],'include':_0x29f0fb[_0x5411('0x19')]?_['map'](_0x29f0fb[_0x5411('0x19')],function(_0x124e57){return{'model':db[_0x124e57[_0x5411('0x1b')]],'as':_0x124e57['as'],'attributes':_0x124e57['attributes'],'include':_0x124e57[_0x5411('0x19')]?_[_0x5411('0x1a')](_0x124e57[_0x5411('0x19')],function(_0x3dd1ee){return{'model':db[_0x3dd1ee[_0x5411('0x1b')]],'as':_0x3dd1ee['as'],'attributes':_0x3dd1ee[_0x5411('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4461c2){logger[_0x5411('0x9')](_0x5411('0x1f'),_0x39add0);logger[_0x5411('0xb')](_0x5411('0x1f'),_0x39add0,JSON[_0x5411('0xd')](_0x4461c2));_0x2def27(_0x4461c2);})[_0x5411('0x12')](function(_0x5d4d6e){logger[_0x5411('0xe')](_0x5411('0x1f'),_0x5d4d6e[_0x5411('0x10')],_0x39add0);_0x2227a0(_0x5cc374['error'](0x1f4,_0x5d4d6e[_0x5411('0x10')]));});});}; \ No newline at end of file +var _0x139e=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','options','raw','attributes','limit','include','map','model','ShowVtigerAccount','find','where'];(function(_0x329485,_0x4f7e0d){var _0x3dd0bb=function(_0x2ec059){while(--_0x2ec059){_0x329485['push'](_0x329485['shift']());}};_0x3dd0bb(++_0x4f7e0d);}(_0x139e,0xaa));var _0xe139=function(_0x936a78,_0x2d84df){_0x936a78=_0x936a78-0x0;var _0x55f341=_0x139e[_0x936a78];return _0x55f341;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe139('0x0'));var BPromise=require(_0xe139('0x1'));var rs=require(_0xe139('0x2'));var fs=require('fs');var db=require(_0xe139('0x3'))['db'];var utils=require(_0xe139('0x4'));var logger=require(_0xe139('0x5'))(_0xe139('0x6'));var config=require(_0xe139('0x7'));var jayson=require(_0xe139('0x8'));var client=jayson[_0xe139('0x9')][_0xe139('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c05ed,_0x4157bb,_0x23d0c4){return new BPromise(function(_0x2e9510,_0xc07f27){return client[_0xe139('0xb')](_0x4c05ed,_0x23d0c4)[_0xe139('0xc')](function(_0xba4d4d){logger[_0xe139('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x4157bb,_0xe139('0xe'));logger[_0xe139('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4157bb,'request\x20sent',JSON[_0xe139('0x10')](_0xba4d4d));if(_0xba4d4d['error']){if(_0xba4d4d[_0xe139('0x11')][_0xe139('0x12')]===0x1f4){logger[_0xe139('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4157bb,_0xba4d4d[_0xe139('0x11')][_0xe139('0x13')]);return _0xc07f27(_0xba4d4d[_0xe139('0x11')]['message']);}logger[_0xe139('0x11')](_0xe139('0x14'),_0x4157bb,_0xba4d4d[_0xe139('0x11')][_0xe139('0x13')]);return _0x2e9510(_0xba4d4d['error']['message']);}else{logger[_0xe139('0xd')](_0xe139('0x14'),_0x4157bb,'request\x20sent');_0x2e9510(_0xba4d4d[_0xe139('0x15')][_0xe139('0x13')]);}})[_0xe139('0x16')](function(_0x51388c){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4157bb,_0x51388c);_0xc07f27(_0x51388c);});});}exports[_0xe139('0x17')]=function(_0x4ef349){var _0x27df37=this;return new Promise(function(_0x2ebee6,_0x37f2a0){return db['VtigerAccount']['findAll']({'raw':_0x4ef349['options']?_0x4ef349[_0xe139('0x18')][_0xe139('0x19')]===undefined?!![]:![]:!![],'where':_0x4ef349[_0xe139('0x18')]?_0x4ef349[_0xe139('0x18')]['where']||null:null,'attributes':_0x4ef349['options']?_0x4ef349[_0xe139('0x18')][_0xe139('0x1a')]||null:null,'limit':_0x4ef349['options']?_0x4ef349[_0xe139('0x18')][_0xe139('0x1b')]||null:null,'include':_0x4ef349[_0xe139('0x18')]?_0x4ef349[_0xe139('0x18')][_0xe139('0x1c')]?_[_0xe139('0x1d')](_0x4ef349[_0xe139('0x18')]['include'],function(_0x3c733c){return{'model':db[_0x3c733c[_0xe139('0x1e')]],'as':_0x3c733c['as'],'attributes':_0x3c733c[_0xe139('0x1a')],'include':_0x3c733c[_0xe139('0x1c')]?_[_0xe139('0x1d')](_0x3c733c[_0xe139('0x1c')],function(_0x16c160){return{'model':db[_0x16c160['model']],'as':_0x16c160['as'],'attributes':_0x16c160[_0xe139('0x1a')],'include':_0x16c160[_0xe139('0x1c')]?_[_0xe139('0x1d')](_0x16c160['include'],function(_0x4eed62){return{'model':db[_0x4eed62[_0xe139('0x1e')]],'as':_0x4eed62['as'],'attributes':_0x4eed62[_0xe139('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe139('0xc')](function(_0x119209){logger[_0xe139('0xd')]('GetVtigerAccount',_0x4ef349);logger[_0xe139('0xf')](_0xe139('0x17'),_0x4ef349,JSON[_0xe139('0x10')](_0x119209));_0x2ebee6(_0x119209);})[_0xe139('0x16')](function(_0x35565b){logger[_0xe139('0x11')]('GetVtigerAccount',_0x35565b[_0xe139('0x13')],_0x4ef349);_0x37f2a0(_0x27df37[_0xe139('0x11')](0x1f4,_0x35565b[_0xe139('0x13')]));});});};exports[_0xe139('0x1f')]=function(_0x55b93b){var _0x5e47d8=this;return new Promise(function(_0x50f2f6,_0x352369){return db['VtigerAccount'][_0xe139('0x20')]({'raw':_0x55b93b[_0xe139('0x18')]?_0x55b93b[_0xe139('0x18')][_0xe139('0x19')]===undefined?!![]:![]:!![],'where':_0x55b93b['options']?_0x55b93b[_0xe139('0x18')][_0xe139('0x21')]||null:null,'attributes':_0x55b93b[_0xe139('0x18')]?_0x55b93b[_0xe139('0x18')]['attributes']||null:null,'include':_0x55b93b[_0xe139('0x18')]?_0x55b93b[_0xe139('0x18')][_0xe139('0x1c')]?_[_0xe139('0x1d')](_0x55b93b[_0xe139('0x18')]['include'],function(_0x37bff7){return{'model':db[_0x37bff7[_0xe139('0x1e')]],'as':_0x37bff7['as'],'attributes':_0x37bff7['attributes'],'include':_0x37bff7[_0xe139('0x1c')]?_[_0xe139('0x1d')](_0x37bff7[_0xe139('0x1c')],function(_0x37d30d){return{'model':db[_0x37d30d['model']],'as':_0x37d30d['as'],'attributes':_0x37d30d[_0xe139('0x1a')],'include':_0x37d30d['include']?_['map'](_0x37d30d[_0xe139('0x1c')],function(_0x312270){return{'model':db[_0x312270[_0xe139('0x1e')]],'as':_0x312270['as'],'attributes':_0x312270[_0xe139('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe139('0xc')](function(_0x44cc10){logger['info'](_0xe139('0x1f'),_0x55b93b);logger[_0xe139('0xf')]('ShowVtigerAccount',_0x55b93b,JSON[_0xe139('0x10')](_0x44cc10));_0x50f2f6(_0x44cc10);})[_0xe139('0x16')](function(_0x36cf7c){logger[_0xe139('0x11')]('ShowVtigerAccount',_0x36cf7c['message'],_0x55b93b);_0x352369(_0x5e47d8[_0xe139('0x11')](0x1f4,_0x36cf7c[_0xe139('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index af752fa..329d89d 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 _0xb2d4=['create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xb2d4,0x16f));var _0x4b2d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb2d4[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0x4b2d('0x0'));var path=require(_0x4b2d('0x1'));var express=require(_0x4b2d('0x2'));var router=express[_0x4b2d('0x3')]();var auth=require(_0x4b2d('0x4'));var interaction=require(_0x4b2d('0x5'));var config=require('../../config/environment');var controller=require(_0x4b2d('0x6'));router[_0x4b2d('0x7')]('/',auth[_0x4b2d('0x8')](),controller[_0x4b2d('0x9')]);router[_0x4b2d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4b2d('0xa')]);router['get']('/:id/fields',auth[_0x4b2d('0x8')](),controller[_0x4b2d('0xb')]);router[_0x4b2d('0x7')](_0x4b2d('0xc'),auth['isAuthenticated'](),controller[_0x4b2d('0xd')]);router[_0x4b2d('0x7')](_0x4b2d('0xe'),auth[_0x4b2d('0x8')](),controller[_0x4b2d('0xf')]);router[_0x4b2d('0x10')]('/',auth[_0x4b2d('0x8')](),controller[_0x4b2d('0x11')]);router[_0x4b2d('0x12')](_0x4b2d('0x13'),auth['isAuthenticated'](),controller[_0x4b2d('0x14')]);router[_0x4b2d('0x15')](_0x4b2d('0x13'),auth[_0x4b2d('0x8')](),controller[_0x4b2d('0x16')]);module[_0x4b2d('0x17')]=router; \ No newline at end of file +var _0x5474=['get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getDescriptions','post','create','put','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x497d8c,_0x2904c9){var _0xeafed7=function(_0x3b51e8){while(--_0x3b51e8){_0x497d8c['push'](_0x497d8c['shift']());}};_0xeafed7(++_0x2904c9);}(_0x5474,0xb4));var _0x4547=function(_0x4108a2,_0x2d0568){_0x4108a2=_0x4108a2-0x0;var _0x2314d5=_0x5474[_0x4108a2];return _0x2314d5;};'use strict';var multer=require(_0x4547('0x0'));var util=require(_0x4547('0x1'));var path=require(_0x4547('0x2'));var express=require(_0x4547('0x3'));var router=express[_0x4547('0x4')]();var auth=require(_0x4547('0x5'));var interaction=require(_0x4547('0x6'));var config=require(_0x4547('0x7'));var controller=require(_0x4547('0x8'));router[_0x4547('0x9')]('/',auth[_0x4547('0xa')](),controller[_0x4547('0xb')]);router[_0x4547('0x9')](_0x4547('0xc'),auth['isAuthenticated'](),controller[_0x4547('0xd')]);router['get']('/:id/fields',auth[_0x4547('0xa')](),controller[_0x4547('0xe')]);router[_0x4547('0x9')](_0x4547('0xf'),auth[_0x4547('0xa')](),controller['getSubjects']);router[_0x4547('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4547('0x10')]);router[_0x4547('0x11')]('/',auth['isAuthenticated'](),controller[_0x4547('0x12')]);router[_0x4547('0x13')](_0x4547('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4547('0x14')](_0x4547('0xc'),auth[_0x4547('0xa')](),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 545e02d..5da6276 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 _0x73df=['sequelize','exports','STRING'];(function(_0x1db0ea,_0x16c0ac){var _0x5c59e1=function(_0x4f74a5){while(--_0x4f74a5){_0x1db0ea['push'](_0x1db0ea['shift']());}};_0x5c59e1(++_0x16c0ac);}(_0x73df,0x13e));var _0xf73d=function(_0xfc658f,_0x2e4c38){_0xfc658f=_0xfc658f-0x0;var _0xb665fa=_0x73df[_0xfc658f];return _0xb665fa;};'use strict';var Sequelize=require(_0xf73d('0x0'));module[_0xf73d('0x1')]={'name':{'type':Sequelize[_0xf73d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b49=['sequelize','exports','STRING'];(function(_0x4da4ae,_0x4e3e3f){var _0x453fa9=function(_0x4f3b08){while(--_0x4f3b08){_0x4da4ae['push'](_0x4da4ae['shift']());}};_0x453fa9(++_0x4e3e3f);}(_0x5b49,0x7b));var _0x95b4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x5b49[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x95b4('0x0'));module[_0x95b4('0x1')]={'name':{'type':Sequelize[_0x95b4('0x2')]},'description':{'type':Sequelize[_0x95b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c10a780..8e2a99a 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 _0xd64b=['query','dateEnd','dateStart','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','add','day','merge','where','filter','map','count','includeAll','findAll','rows','show','params','length','include','find','create','body','getFields','findOne','VtigerField','nolimit','options','getSubjects','getDescriptions','fast-json-patch','moment','mustache','util','path','sox','to-csv','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','limit','apply','reject','update','destroy','name','index','VtigerConfiguration','rawAttributes','model','keys'];(function(_0xfda644,_0x1c1705){var _0x26aed4=function(_0x454402){while(--_0x454402){_0xfda644['push'](_0xfda644['shift']());}};_0x26aed4(++_0x1c1705);}(_0xd64b,0xc1));var _0xbd64=function(_0x178f3e,_0x567056){_0x178f3e=_0x178f3e-0x0;var _0x2c73ab=_0xd64b[_0x178f3e];return _0x2c73ab;};'use strict';var jsonpatch=require(_0xbd64('0x0'));var rp=require('request-promise');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xbd64('0x2'));var util=require(_0xbd64('0x3'));var path=require(_0xbd64('0x4'));var sox=require(_0xbd64('0x5'));var csv=require(_0xbd64('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbd64('0x7'));var deskjs=require(_0xbd64('0x8'));var toCsv=require(_0xbd64('0x6'));var querystring=require(_0xbd64('0x9'));var Papa=require(_0xbd64('0xa'));var qs=require(_0xbd64('0xb'));var logger=require(_0xbd64('0xc'))('api');var utils=require('../../config/utils');var config=require(_0xbd64('0xd'));var db=require(_0xbd64('0xe'))['db'];var jayson=require(_0xbd64('0xf'));var client=jayson['client'][_0xbd64('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x3f908a,_0x2f8fad,_0x18bde8,_0x593c79){return new BPromise(function(_0x431b29,_0x5f2adf){var _0x136f60=_0x593c79||client;return _0x136f60[_0xbd64('0x11')](_0x3f908a,_0x18bde8)[_0xbd64('0x12')](function(_0x2183e2){logger[_0xbd64('0x13')](_0xbd64('0x14'),_0x2f8fad,_0xbd64('0x15'));logger[_0xbd64('0x16')](_0xbd64('0x17'),_0x2f8fad,'request\x20sent',JSON[_0xbd64('0x18')](_0x2183e2));if(_0x2183e2[_0xbd64('0x19')]){if(_0x2183e2[_0xbd64('0x19')][_0xbd64('0x1a')]===0x1f4){logger[_0xbd64('0x19')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f8fad,_0x2183e2[_0xbd64('0x19')]['message']);return _0x5f2adf(_0x2183e2[_0xbd64('0x19')][_0xbd64('0x1b')]);}logger[_0xbd64('0x19')](_0xbd64('0x14'),_0x2f8fad,_0x2183e2[_0xbd64('0x19')][_0xbd64('0x1b')]);return _0x431b29(_0x2183e2[_0xbd64('0x19')][_0xbd64('0x1b')]);}else{logger['info'](_0xbd64('0x14'),_0x2f8fad,_0xbd64('0x15'));_0x431b29(_0x2183e2['result']['message']);}})[_0xbd64('0x1c')](function(_0x42b328){logger[_0xbd64('0x19')](_0xbd64('0x14'),_0x2f8fad,_0x42b328);_0x5f2adf(_0x42b328);});});}function respondWithStatusCode(_0x2c5551,_0x816e00){_0x816e00=_0x816e00||0xcc;return function(_0x5dc2bd){if(_0x5dc2bd){return _0x2c5551['sendStatus'](_0x816e00);}return _0x2c5551[_0xbd64('0x1d')](_0x816e00)[_0xbd64('0x1e')]();};}function respondWithResult(_0x12f67b,_0x365d88){_0x365d88=_0x365d88||0xc8;return function(_0x55e74c){if(_0x55e74c){return _0x12f67b['status'](_0x365d88)[_0xbd64('0x1f')](_0x55e74c);}};}function respondWithFilteredResult(_0x4afaff,_0x46ab38){return function(_0x5b356b){if(_0x5b356b){var _0x33452d=_0x5b356b['count'],_0x946a62=_0x46ab38[_0xbd64('0x20')],_0x3d12a0=_0x46ab38[_0xbd64('0x20')]+_0x46ab38[_0xbd64('0x21')],_0x2d0993;if(_0x3d12a0>=_0x33452d){_0x3d12a0=_0x33452d;_0x2d0993=0xc8;}else{_0x2d0993=0xce;}_0x4afaff[_0xbd64('0x1d')](_0x2d0993);return _0x4afaff['set']('Content-Range',_0x946a62+'-'+_0x3d12a0+'/'+_0x33452d)[_0xbd64('0x1f')](_0x5b356b);}return null;};}function patchUpdates(_0x49eac5){return function(_0x53fe58){try{jsonpatch[_0xbd64('0x22')](_0x53fe58,_0x49eac5,!![]);}catch(_0x5aacdd){return BPromise[_0xbd64('0x23')](_0x5aacdd);}return _0x53fe58['save']();};}function saveUpdates(_0x28199c,_0x5d8c35){return function(_0x1db9f3){if(_0x1db9f3){return _0x1db9f3[_0xbd64('0x24')](_0x28199c)[_0xbd64('0x12')](function(_0x210fff){return _0x210fff;});}return null;};}function removeEntity(_0x306f19,_0x207ffc){return function(_0x4ed44a){if(_0x4ed44a){return _0x4ed44a[_0xbd64('0x25')]()[_0xbd64('0x12')](function(){_0x306f19[_0xbd64('0x1d')](0xcc)[_0xbd64('0x1e')]();});}};}function handleEntityNotFound(_0x14b2ad,_0x463ca4){return function(_0x5e70d3){if(!_0x5e70d3){_0x14b2ad['sendStatus'](0x194);}return _0x5e70d3;};}function handleError(_0x1e4593,_0x576604){_0x576604=_0x576604||0x1f4;return function(_0xebed78){logger[_0xbd64('0x19')](_0xebed78['stack']);if(_0xebed78['name']){delete _0xebed78[_0xbd64('0x26')];}_0x1e4593['status'](_0x576604)['send'](_0xebed78);};}exports[_0xbd64('0x27')]=function(_0x1e224e,_0x192ca3){var _0x50c58e={},_0x231c37={},_0x569cb6={'count':0x0,'rows':[]};var _0x1fc9cf=db[_0xbd64('0x28')][_0xbd64('0x29')];_0x231c37[_0xbd64('0x2a')]=_[_0xbd64('0x2b')](_0x1fc9cf);var _0x429aec={'dateStart':_0x1e224e['query']['dateStart'],'dateEnd':_0x1e224e[_0xbd64('0x2c')][_0xbd64('0x2d')]};delete _0x1e224e[_0xbd64('0x2c')][_0xbd64('0x2e')];delete _0x1e224e[_0xbd64('0x2c')][_0xbd64('0x2d')];_0x231c37['query']=_['keys'](_0x1e224e[_0xbd64('0x2c')]);_0x231c37[_0xbd64('0x2f')]=_[_0xbd64('0x30')](_0x231c37['model'],_0x231c37['query']);_0x50c58e[_0xbd64('0x31')]=_['intersection'](_0x231c37[_0xbd64('0x2a')],qs['fields'](_0x1e224e[_0xbd64('0x2c')][_0xbd64('0x32')]));_0x50c58e['attributes']=_0x50c58e[_0xbd64('0x31')]['length']?_0x50c58e['attributes']:_0x231c37[_0xbd64('0x2a')];if(!_0x1e224e[_0xbd64('0x2c')][_0xbd64('0x33')]('nolimit')){_0x50c58e['limit']=qs['limit'](_0x1e224e[_0xbd64('0x2c')][_0xbd64('0x21')]);_0x50c58e['offset']=qs[_0xbd64('0x20')](_0x1e224e[_0xbd64('0x2c')][_0xbd64('0x20')]);}_0x50c58e[_0xbd64('0x34')]=qs['sort'](_0x1e224e['query'][_0xbd64('0x35')]);_0x50c58e['where']=qs['filters'](_[_0xbd64('0x36')](_0x1e224e[_0xbd64('0x2c')],_0x231c37[_0xbd64('0x2f')]));if(_0x429aec[_0xbd64('0x2e')]){if(_0x429aec[_0xbd64('0x2d')]){_0x429aec[_0xbd64('0x2d')]=moment(_0x429aec[_0xbd64('0x2d')])[_0xbd64('0x37')](0x1,'day');}else{_0x429aec[_0xbd64('0x2d')]=moment(_0x429aec[_0xbd64('0x2e')])['add'](0x1,_0xbd64('0x38'));}_[_0xbd64('0x39')](_0x50c58e[_0xbd64('0x3a')],{'createdAt':{'$gte':_0x429aec[_0xbd64('0x2e')],'$lte':_0x429aec[_0xbd64('0x2d')]}});}if(_0x1e224e[_0xbd64('0x2c')][_0xbd64('0x3b')]){_0x50c58e['where']=_[_0xbd64('0x39')](_0x50c58e['where'],{'$or':_[_0xbd64('0x3c')](_0x50c58e['attributes'],function(_0x468e0b){var _0xe6f9f8={};_0xe6f9f8[_0x468e0b]={'$like':'%'+_0x1e224e[_0xbd64('0x2c')]['filter']+'%'};return _0xe6f9f8;})});}_0x50c58e=_[_0xbd64('0x39')]({},_0x50c58e,_0x1e224e['options']);var _0x526705={'where':_0x50c58e['where']};return db[_0xbd64('0x28')][_0xbd64('0x3d')](_0x526705)[_0xbd64('0x12')](function(_0x46c1d0){_0x569cb6[_0xbd64('0x3d')]=_0x46c1d0;if(_0x1e224e[_0xbd64('0x2c')][_0xbd64('0x3e')]){_0x50c58e['include']=[{'all':!![]}];}return db[_0xbd64('0x28')][_0xbd64('0x3f')](_0x50c58e);})[_0xbd64('0x12')](function(_0x4e5efe){_0x569cb6[_0xbd64('0x40')]=_0x4e5efe;return _0x569cb6;})[_0xbd64('0x12')](respondWithFilteredResult(_0x192ca3,_0x50c58e))[_0xbd64('0x1c')](handleError(_0x192ca3,null));};exports[_0xbd64('0x41')]=function(_0x40f1bd,_0x5a6b5e){var _0x283699={'raw':![],'where':{'id':_0x40f1bd[_0xbd64('0x42')]['id']}},_0x1a9ec8={};_0x1a9ec8[_0xbd64('0x2a')]=_['keys'](db['VtigerConfiguration'][_0xbd64('0x29')]);_0x1a9ec8[_0xbd64('0x2c')]=_[_0xbd64('0x2b')](_0x40f1bd[_0xbd64('0x2c')]);_0x1a9ec8[_0xbd64('0x2f')]=_[_0xbd64('0x30')](_0x1a9ec8[_0xbd64('0x2a')],_0x1a9ec8[_0xbd64('0x2c')]);_0x283699[_0xbd64('0x31')]=_[_0xbd64('0x30')](_0x1a9ec8[_0xbd64('0x2a')],qs[_0xbd64('0x32')](_0x40f1bd[_0xbd64('0x2c')][_0xbd64('0x32')]));_0x283699[_0xbd64('0x31')]=_0x283699['attributes'][_0xbd64('0x43')]?_0x283699['attributes']:_0x1a9ec8['model'];if(_0x40f1bd['query']['includeAll']){_0x283699[_0xbd64('0x44')]=[{'all':!![]}];}_0x283699=_[_0xbd64('0x39')]({},_0x283699,_0x40f1bd['options']);return db[_0xbd64('0x28')][_0xbd64('0x45')](_0x283699)[_0xbd64('0x12')](handleEntityNotFound(_0x5a6b5e,null))['then'](respondWithResult(_0x5a6b5e,null))[_0xbd64('0x1c')](handleError(_0x5a6b5e,null));};exports[_0xbd64('0x46')]=function(_0x44cd4f,_0x1db94c){return db[_0xbd64('0x28')][_0xbd64('0x46')](_0x44cd4f['body'],{})['then'](respondWithResult(_0x1db94c,0xc9))['catch'](handleError(_0x1db94c,null));};exports[_0xbd64('0x24')]=function(_0x15c0de,_0x3548fe){if(_0x15c0de[_0xbd64('0x47')]['id']){delete _0x15c0de['body']['id'];}return db[_0xbd64('0x28')][_0xbd64('0x45')]({'where':{'id':_0x15c0de[_0xbd64('0x42')]['id']}})[_0xbd64('0x12')](handleEntityNotFound(_0x3548fe,null))[_0xbd64('0x12')](saveUpdates(_0x15c0de[_0xbd64('0x47')],null))['then'](respondWithResult(_0x3548fe,null))[_0xbd64('0x1c')](handleError(_0x3548fe,null));};exports[_0xbd64('0x25')]=function(_0x15f1fc,_0x1fe3e5){return db[_0xbd64('0x28')][_0xbd64('0x45')]({'where':{'id':_0x15f1fc[_0xbd64('0x42')]['id']}})[_0xbd64('0x12')](handleEntityNotFound(_0x1fe3e5,null))[_0xbd64('0x12')](removeEntity(_0x1fe3e5,null))[_0xbd64('0x1c')](handleError(_0x1fe3e5,null));};exports[_0xbd64('0x48')]=function(_0xffda84,_0x4a1e21,_0x56c7d9){var _0x29c90a={};var _0x2bcf68={};var _0x5ab7b3;var _0x550f5f;return db[_0xbd64('0x28')][_0xbd64('0x49')]({'where':{'id':_0xffda84['params']['id']}})[_0xbd64('0x12')](handleEntityNotFound(_0x4a1e21,null))[_0xbd64('0x12')](function(_0x45573c){if(_0x45573c){_0x5ab7b3=_0x45573c;_0x2bcf68[_0xbd64('0x2a')]=_[_0xbd64('0x2b')](db[_0xbd64('0x4a')][_0xbd64('0x29')]);_0x2bcf68[_0xbd64('0x2c')]=_[_0xbd64('0x2b')](_0xffda84['query']);_0x2bcf68[_0xbd64('0x2f')]=_[_0xbd64('0x30')](_0x2bcf68[_0xbd64('0x2a')],_0x2bcf68['query']);_0x29c90a[_0xbd64('0x31')]=_[_0xbd64('0x30')](_0x2bcf68['model'],qs[_0xbd64('0x32')](_0xffda84[_0xbd64('0x2c')][_0xbd64('0x32')]));_0x29c90a[_0xbd64('0x31')]=_0x29c90a[_0xbd64('0x31')][_0xbd64('0x43')]?_0x29c90a['attributes']:_0x2bcf68[_0xbd64('0x2a')];_0x29c90a[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0xffda84[_0xbd64('0x2c')]['sort']);_0x29c90a[_0xbd64('0x3a')]=qs[_0xbd64('0x2f')](_['pick'](_0xffda84[_0xbd64('0x2c')],_0x2bcf68['filters']));if(_0xffda84[_0xbd64('0x2c')][_0xbd64('0x3b')]){_0x29c90a[_0xbd64('0x3a')]=_[_0xbd64('0x39')](_0x29c90a['where'],{'$or':_[_0xbd64('0x3c')](_0x29c90a[_0xbd64('0x31')],function(_0x30bdef){var _0x23925c={};_0x23925c[_0x30bdef]={'$like':'%'+_0xffda84[_0xbd64('0x2c')][_0xbd64('0x3b')]+'%'};return _0x23925c;})});}_0x29c90a=_['merge']({},_0x29c90a,_0xffda84['options']);return _0x5ab7b3['getFields'](_0x29c90a);}})[_0xbd64('0x12')](function(_0xd1b21f){if(_0xd1b21f){_0x550f5f=_0xd1b21f[_0xbd64('0x43')];if(!_0xffda84[_0xbd64('0x2c')][_0xbd64('0x33')](_0xbd64('0x4b'))){_0x29c90a['limit']=qs[_0xbd64('0x21')](_0xffda84[_0xbd64('0x2c')][_0xbd64('0x21')]);_0x29c90a[_0xbd64('0x20')]=qs[_0xbd64('0x20')](_0xffda84[_0xbd64('0x2c')][_0xbd64('0x20')]);}return _0x5ab7b3[_0xbd64('0x48')](_0x29c90a);}})[_0xbd64('0x12')](function(_0x18e724){if(_0x18e724){return _0x18e724?{'count':_0x550f5f,'rows':_0x18e724}:null;}})[_0xbd64('0x12')](respondWithResult(_0x4a1e21,null))[_0xbd64('0x1c')](handleError(_0x4a1e21,null));};exports['getSubjects']=function(_0x5f16fd,_0x7e5c1c,_0x363da8){var _0x2ec631={};var _0x4fc352={};var _0x9b99b3;var _0x4fccd9;return db[_0xbd64('0x28')][_0xbd64('0x49')]({'where':{'id':_0x5f16fd[_0xbd64('0x42')]['id']}})[_0xbd64('0x12')](handleEntityNotFound(_0x7e5c1c,null))['then'](function(_0x1f104b){if(_0x1f104b){_0x9b99b3=_0x1f104b;_0x4fc352['model']=_[_0xbd64('0x2b')](db[_0xbd64('0x4a')][_0xbd64('0x29')]);_0x4fc352[_0xbd64('0x2c')]=_[_0xbd64('0x2b')](_0x5f16fd['query']);_0x4fc352[_0xbd64('0x2f')]=_[_0xbd64('0x30')](_0x4fc352['model'],_0x4fc352[_0xbd64('0x2c')]);_0x2ec631[_0xbd64('0x31')]=_[_0xbd64('0x30')](_0x4fc352[_0xbd64('0x2a')],qs['fields'](_0x5f16fd[_0xbd64('0x2c')]['fields']));_0x2ec631[_0xbd64('0x31')]=_0x2ec631[_0xbd64('0x31')][_0xbd64('0x43')]?_0x2ec631['attributes']:_0x4fc352['model'];_0x2ec631['order']=qs['sort'](_0x5f16fd[_0xbd64('0x2c')][_0xbd64('0x35')]);_0x2ec631[_0xbd64('0x3a')]=qs[_0xbd64('0x2f')](_[_0xbd64('0x36')](_0x5f16fd['query'],_0x4fc352[_0xbd64('0x2f')]));if(_0x5f16fd[_0xbd64('0x2c')][_0xbd64('0x3b')]){_0x2ec631[_0xbd64('0x3a')]=_[_0xbd64('0x39')](_0x2ec631['where'],{'$or':_[_0xbd64('0x3c')](_0x2ec631[_0xbd64('0x31')],function(_0x2a434b){var _0x808467={};_0x808467[_0x2a434b]={'$like':'%'+_0x5f16fd['query']['filter']+'%'};return _0x808467;})});}_0x2ec631=_[_0xbd64('0x39')]({},_0x2ec631,_0x5f16fd[_0xbd64('0x4c')]);return _0x9b99b3[_0xbd64('0x4d')](_0x2ec631);}})[_0xbd64('0x12')](function(_0x18b0f0){if(_0x18b0f0){_0x4fccd9=_0x18b0f0[_0xbd64('0x43')];if(!_0x5f16fd[_0xbd64('0x2c')][_0xbd64('0x33')]('nolimit')){_0x2ec631[_0xbd64('0x21')]=qs['limit'](_0x5f16fd[_0xbd64('0x2c')][_0xbd64('0x21')]);_0x2ec631[_0xbd64('0x20')]=qs['offset'](_0x5f16fd[_0xbd64('0x2c')]['offset']);}return _0x9b99b3['getSubjects'](_0x2ec631);}})[_0xbd64('0x12')](function(_0x44d162){if(_0x44d162){return _0x44d162?{'count':_0x4fccd9,'rows':_0x44d162}:null;}})[_0xbd64('0x12')](respondWithResult(_0x7e5c1c,null))['catch'](handleError(_0x7e5c1c,null));};exports[_0xbd64('0x4e')]=function(_0x3a34b7,_0x8150bb,_0x35cf6a){var _0x5ae7cf={};var _0x17a4c4={};var _0x152a5e;var _0x355b87;return db[_0xbd64('0x28')][_0xbd64('0x49')]({'where':{'id':_0x3a34b7[_0xbd64('0x42')]['id']}})[_0xbd64('0x12')](handleEntityNotFound(_0x8150bb,null))[_0xbd64('0x12')](function(_0x8a6280){if(_0x8a6280){_0x152a5e=_0x8a6280;_0x17a4c4[_0xbd64('0x2a')]=_[_0xbd64('0x2b')](db[_0xbd64('0x4a')][_0xbd64('0x29')]);_0x17a4c4[_0xbd64('0x2c')]=_['keys'](_0x3a34b7['query']);_0x17a4c4[_0xbd64('0x2f')]=_[_0xbd64('0x30')](_0x17a4c4[_0xbd64('0x2a')],_0x17a4c4['query']);_0x5ae7cf[_0xbd64('0x31')]=_['intersection'](_0x17a4c4[_0xbd64('0x2a')],qs[_0xbd64('0x32')](_0x3a34b7[_0xbd64('0x2c')][_0xbd64('0x32')]));_0x5ae7cf['attributes']=_0x5ae7cf[_0xbd64('0x31')][_0xbd64('0x43')]?_0x5ae7cf['attributes']:_0x17a4c4[_0xbd64('0x2a')];_0x5ae7cf['order']=qs[_0xbd64('0x35')](_0x3a34b7[_0xbd64('0x2c')][_0xbd64('0x35')]);_0x5ae7cf[_0xbd64('0x3a')]=qs[_0xbd64('0x2f')](_[_0xbd64('0x36')](_0x3a34b7['query'],_0x17a4c4[_0xbd64('0x2f')]));if(_0x3a34b7['query'][_0xbd64('0x3b')]){_0x5ae7cf[_0xbd64('0x3a')]=_['merge'](_0x5ae7cf[_0xbd64('0x3a')],{'$or':_['map'](_0x5ae7cf[_0xbd64('0x31')],function(_0x2ac722){var _0x3ba513={};_0x3ba513[_0x2ac722]={'$like':'%'+_0x3a34b7['query'][_0xbd64('0x3b')]+'%'};return _0x3ba513;})});}_0x5ae7cf=_[_0xbd64('0x39')]({},_0x5ae7cf,_0x3a34b7[_0xbd64('0x4c')]);return _0x152a5e[_0xbd64('0x4e')](_0x5ae7cf);}})[_0xbd64('0x12')](function(_0x4e9a6b){if(_0x4e9a6b){_0x355b87=_0x4e9a6b['length'];if(!_0x3a34b7[_0xbd64('0x2c')][_0xbd64('0x33')](_0xbd64('0x4b'))){_0x5ae7cf[_0xbd64('0x21')]=qs[_0xbd64('0x21')](_0x3a34b7[_0xbd64('0x2c')][_0xbd64('0x21')]);_0x5ae7cf[_0xbd64('0x20')]=qs[_0xbd64('0x20')](_0x3a34b7[_0xbd64('0x2c')][_0xbd64('0x20')]);}return _0x152a5e[_0xbd64('0x4e')](_0x5ae7cf);}})[_0xbd64('0x12')](function(_0x4b1c1a){if(_0x4b1c1a){return _0x4b1c1a?{'count':_0x355b87,'rows':_0x4b1c1a}:null;}})[_0xbd64('0x12')](respondWithResult(_0x8150bb,null))[_0xbd64('0x1c')](handleError(_0x8150bb,null));}; \ No newline at end of file +var _0xa478=['info','result','catch','status','end','count','offset','limit','set','json','apply','reject','update','sendStatus','name','index','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','VtigerConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','destroy','getFields','findOne','VtigerField','length','map','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/utils','../../config/environment','jayson/promise','client','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa478,0x136));var _0x8a47=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xa478[_0xb7a459];return _0x104ab5;};'use strict';var jsonpatch=require(_0x8a47('0x0'));var rp=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var Mustache=require(_0x8a47('0x4'));var util=require(_0x8a47('0x5'));var path=require(_0x8a47('0x6'));var sox=require(_0x8a47('0x7'));var csv=require(_0x8a47('0x8'));var ejs=require(_0x8a47('0x9'));var fs=require('fs');var _=require(_0x8a47('0xa'));var squel=require(_0x8a47('0xb'));var crypto=require('crypto');var jsforce=require(_0x8a47('0xc'));var deskjs=require(_0x8a47('0xd'));var toCsv=require(_0x8a47('0x8'));var querystring=require(_0x8a47('0xe'));var Papa=require('papaparse');var qs=require(_0x8a47('0xf'));var logger=require('../../config/logger')(_0x8a47('0x10'));var utils=require(_0x8a47('0x11'));var config=require(_0x8a47('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8a47('0x13'));var client=jayson[_0x8a47('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc718bd,_0x4a7242,_0x39da50,_0x25b1a3){return new BPromise(function(_0x2b7640,_0x5c6356){var _0x5e3166=_0x25b1a3||client;return _0x5e3166['request'](_0xc718bd,_0x39da50)[_0x8a47('0x15')](function(_0x12539c){logger['info'](_0x8a47('0x16'),_0x4a7242,_0x8a47('0x17'));logger[_0x8a47('0x18')](_0x8a47('0x19'),_0x4a7242,_0x8a47('0x17'),JSON[_0x8a47('0x1a')](_0x12539c));if(_0x12539c[_0x8a47('0x1b')]){if(_0x12539c[_0x8a47('0x1b')][_0x8a47('0x1c')]===0x1f4){logger[_0x8a47('0x1b')](_0x8a47('0x16'),_0x4a7242,_0x12539c[_0x8a47('0x1b')][_0x8a47('0x1d')]);return _0x5c6356(_0x12539c['error'][_0x8a47('0x1d')]);}logger[_0x8a47('0x1b')](_0x8a47('0x16'),_0x4a7242,_0x12539c['error'][_0x8a47('0x1d')]);return _0x2b7640(_0x12539c['error']['message']);}else{logger[_0x8a47('0x1e')](_0x8a47('0x16'),_0x4a7242,_0x8a47('0x17'));_0x2b7640(_0x12539c[_0x8a47('0x1f')][_0x8a47('0x1d')]);}})[_0x8a47('0x20')](function(_0x44e119){logger[_0x8a47('0x1b')](_0x8a47('0x16'),_0x4a7242,_0x44e119);_0x5c6356(_0x44e119);});});}function respondWithStatusCode(_0xc2065a,_0x54ce6a){_0x54ce6a=_0x54ce6a||0xcc;return function(_0x20f8af){if(_0x20f8af){return _0xc2065a['sendStatus'](_0x54ce6a);}return _0xc2065a[_0x8a47('0x21')](_0x54ce6a)[_0x8a47('0x22')]();};}function respondWithResult(_0x36908d,_0x3658aa){_0x3658aa=_0x3658aa||0xc8;return function(_0x5d4b6c){if(_0x5d4b6c){return _0x36908d[_0x8a47('0x21')](_0x3658aa)['json'](_0x5d4b6c);}};}function respondWithFilteredResult(_0x50f6ba,_0x4d71f4){return function(_0x4cbd83){if(_0x4cbd83){var _0xf46d2c=_0x4cbd83[_0x8a47('0x23')],_0x15a812=_0x4d71f4[_0x8a47('0x24')],_0x5bed3e=_0x4d71f4[_0x8a47('0x24')]+_0x4d71f4[_0x8a47('0x25')],_0x2bb0d4;if(_0x5bed3e>=_0xf46d2c){_0x5bed3e=_0xf46d2c;_0x2bb0d4=0xc8;}else{_0x2bb0d4=0xce;}_0x50f6ba[_0x8a47('0x21')](_0x2bb0d4);return _0x50f6ba[_0x8a47('0x26')]('Content-Range',_0x15a812+'-'+_0x5bed3e+'/'+_0xf46d2c)[_0x8a47('0x27')](_0x4cbd83);}return null;};}function patchUpdates(_0x4a10c3){return function(_0x1a03df){try{jsonpatch[_0x8a47('0x28')](_0x1a03df,_0x4a10c3,!![]);}catch(_0x54d4b2){return BPromise[_0x8a47('0x29')](_0x54d4b2);}return _0x1a03df['save']();};}function saveUpdates(_0x4d5d32,_0x12470a){return function(_0x9b51b8){if(_0x9b51b8){return _0x9b51b8[_0x8a47('0x2a')](_0x4d5d32)[_0x8a47('0x15')](function(_0x117709){return _0x117709;});}return null;};}function removeEntity(_0x18bfd3,_0x58aa06){return function(_0x353576){if(_0x353576){return _0x353576['destroy']()['then'](function(){_0x18bfd3[_0x8a47('0x21')](0xcc)[_0x8a47('0x22')]();});}};}function handleEntityNotFound(_0x179077,_0x52dc7f){return function(_0x16e024){if(!_0x16e024){_0x179077[_0x8a47('0x2b')](0x194);}return _0x16e024;};}function handleError(_0x2901e1,_0x443184){_0x443184=_0x443184||0x1f4;return function(_0x7242e7){logger[_0x8a47('0x1b')](_0x7242e7['stack']);if(_0x7242e7[_0x8a47('0x2c')]){delete _0x7242e7[_0x8a47('0x2c')];}_0x2901e1[_0x8a47('0x21')](_0x443184)['send'](_0x7242e7);};}exports[_0x8a47('0x2d')]=function(_0x3a27f9,_0x57ad7a){var _0xa1a852={},_0x3f19ab={},_0xc7043={'count':0x0,'rows':[]};var _0x20551b=db['VtigerConfiguration']['rawAttributes'];_0x3f19ab[_0x8a47('0x2e')]=_[_0x8a47('0x2f')](_0x20551b);var _0x3cd597={'dateStart':_0x3a27f9[_0x8a47('0x30')][_0x8a47('0x31')],'dateEnd':_0x3a27f9[_0x8a47('0x30')][_0x8a47('0x32')]};delete _0x3a27f9['query']['dateStart'];delete _0x3a27f9[_0x8a47('0x30')][_0x8a47('0x32')];_0x3f19ab[_0x8a47('0x30')]=_[_0x8a47('0x2f')](_0x3a27f9[_0x8a47('0x30')]);_0x3f19ab[_0x8a47('0x33')]=_[_0x8a47('0x34')](_0x3f19ab[_0x8a47('0x2e')],_0x3f19ab[_0x8a47('0x30')]);_0xa1a852[_0x8a47('0x35')]=_[_0x8a47('0x34')](_0x3f19ab['model'],qs[_0x8a47('0x36')](_0x3a27f9['query']['fields']));_0xa1a852['attributes']=_0xa1a852['attributes']['length']?_0xa1a852[_0x8a47('0x35')]:_0x3f19ab[_0x8a47('0x2e')];if(!_0x3a27f9[_0x8a47('0x30')][_0x8a47('0x37')](_0x8a47('0x38'))){_0xa1a852[_0x8a47('0x25')]=qs[_0x8a47('0x25')](_0x3a27f9[_0x8a47('0x30')]['limit']);_0xa1a852['offset']=qs[_0x8a47('0x24')](_0x3a27f9[_0x8a47('0x30')][_0x8a47('0x24')]);}_0xa1a852[_0x8a47('0x39')]=qs['sort'](_0x3a27f9[_0x8a47('0x30')][_0x8a47('0x3a')]);_0xa1a852[_0x8a47('0x3b')]=qs[_0x8a47('0x33')](_[_0x8a47('0x3c')](_0x3a27f9['query'],_0x3f19ab[_0x8a47('0x33')]));if(_0x3cd597[_0x8a47('0x31')]){if(_0x3cd597[_0x8a47('0x32')]){_0x3cd597['dateEnd']=moment(_0x3cd597[_0x8a47('0x32')])[_0x8a47('0x3d')](0x1,_0x8a47('0x3e'));}else{_0x3cd597[_0x8a47('0x32')]=moment(_0x3cd597['dateStart'])[_0x8a47('0x3d')](0x1,_0x8a47('0x3e'));}_[_0x8a47('0x3f')](_0xa1a852[_0x8a47('0x3b')],{'createdAt':{'$gte':_0x3cd597[_0x8a47('0x31')],'$lte':_0x3cd597[_0x8a47('0x32')]}});}if(_0x3a27f9['query']['filter']){_0xa1a852[_0x8a47('0x3b')]=_[_0x8a47('0x3f')](_0xa1a852[_0x8a47('0x3b')],{'$or':_['map'](_0xa1a852[_0x8a47('0x35')],function(_0x33a1c8){var _0x51f37f={};_0x51f37f[_0x33a1c8]={'$like':'%'+_0x3a27f9['query'][_0x8a47('0x40')]+'%'};return _0x51f37f;})});}_0xa1a852=_['merge']({},_0xa1a852,_0x3a27f9[_0x8a47('0x41')]);var _0x114a23={'where':_0xa1a852[_0x8a47('0x3b')]};return db[_0x8a47('0x42')][_0x8a47('0x23')](_0x114a23)[_0x8a47('0x15')](function(_0x4ca38a){_0xc7043['count']=_0x4ca38a;if(_0x3a27f9[_0x8a47('0x30')][_0x8a47('0x43')]){_0xa1a852[_0x8a47('0x44')]=[{'all':!![]}];}return db[_0x8a47('0x42')][_0x8a47('0x45')](_0xa1a852);})['then'](function(_0x4898d0){_0xc7043[_0x8a47('0x46')]=_0x4898d0;return _0xc7043;})['then'](respondWithFilteredResult(_0x57ad7a,_0xa1a852))[_0x8a47('0x20')](handleError(_0x57ad7a,null));};exports[_0x8a47('0x47')]=function(_0x502baa,_0x1442a8){var _0x237ed1={'raw':![],'where':{'id':_0x502baa[_0x8a47('0x48')]['id']}},_0x14e22c={};_0x14e22c[_0x8a47('0x2e')]=_[_0x8a47('0x2f')](db[_0x8a47('0x42')][_0x8a47('0x49')]);_0x14e22c['query']=_[_0x8a47('0x2f')](_0x502baa[_0x8a47('0x30')]);_0x14e22c[_0x8a47('0x33')]=_[_0x8a47('0x34')](_0x14e22c['model'],_0x14e22c[_0x8a47('0x30')]);_0x237ed1[_0x8a47('0x35')]=_[_0x8a47('0x34')](_0x14e22c[_0x8a47('0x2e')],qs[_0x8a47('0x36')](_0x502baa[_0x8a47('0x30')]['fields']));_0x237ed1['attributes']=_0x237ed1[_0x8a47('0x35')]['length']?_0x237ed1[_0x8a47('0x35')]:_0x14e22c[_0x8a47('0x2e')];if(_0x502baa['query'][_0x8a47('0x43')]){_0x237ed1['include']=[{'all':!![]}];}_0x237ed1=_[_0x8a47('0x3f')]({},_0x237ed1,_0x502baa['options']);return db[_0x8a47('0x42')]['find'](_0x237ed1)[_0x8a47('0x15')](handleEntityNotFound(_0x1442a8,null))[_0x8a47('0x15')](respondWithResult(_0x1442a8,null))[_0x8a47('0x20')](handleError(_0x1442a8,null));};exports[_0x8a47('0x4a')]=function(_0x4590ae,_0xe5a10f){return db[_0x8a47('0x42')][_0x8a47('0x4a')](_0x4590ae[_0x8a47('0x4b')],{})[_0x8a47('0x15')](respondWithResult(_0xe5a10f,0xc9))[_0x8a47('0x20')](handleError(_0xe5a10f,null));};exports['update']=function(_0xd8a8bc,_0xc1af26){if(_0xd8a8bc['body']['id']){delete _0xd8a8bc[_0x8a47('0x4b')]['id'];}return db[_0x8a47('0x42')][_0x8a47('0x4c')]({'where':{'id':_0xd8a8bc[_0x8a47('0x48')]['id']}})[_0x8a47('0x15')](handleEntityNotFound(_0xc1af26,null))[_0x8a47('0x15')](saveUpdates(_0xd8a8bc[_0x8a47('0x4b')],null))[_0x8a47('0x15')](respondWithResult(_0xc1af26,null))[_0x8a47('0x20')](handleError(_0xc1af26,null));};exports[_0x8a47('0x4d')]=function(_0x2100cb,_0x385087){return db['VtigerConfiguration'][_0x8a47('0x4c')]({'where':{'id':_0x2100cb[_0x8a47('0x48')]['id']}})[_0x8a47('0x15')](handleEntityNotFound(_0x385087,null))[_0x8a47('0x15')](removeEntity(_0x385087,null))[_0x8a47('0x20')](handleError(_0x385087,null));};exports[_0x8a47('0x4e')]=function(_0x134fc5,_0x3242b7,_0x41cc36){var _0x290193={};var _0x3f4cce={};var _0x4659bf;var _0x31791a;return db[_0x8a47('0x42')][_0x8a47('0x4f')]({'where':{'id':_0x134fc5[_0x8a47('0x48')]['id']}})['then'](handleEntityNotFound(_0x3242b7,null))[_0x8a47('0x15')](function(_0x54ab7a){if(_0x54ab7a){_0x4659bf=_0x54ab7a;_0x3f4cce[_0x8a47('0x2e')]=_[_0x8a47('0x2f')](db[_0x8a47('0x50')][_0x8a47('0x49')]);_0x3f4cce[_0x8a47('0x30')]=_[_0x8a47('0x2f')](_0x134fc5['query']);_0x3f4cce[_0x8a47('0x33')]=_[_0x8a47('0x34')](_0x3f4cce[_0x8a47('0x2e')],_0x3f4cce['query']);_0x290193['attributes']=_[_0x8a47('0x34')](_0x3f4cce[_0x8a47('0x2e')],qs['fields'](_0x134fc5[_0x8a47('0x30')][_0x8a47('0x36')]));_0x290193[_0x8a47('0x35')]=_0x290193[_0x8a47('0x35')][_0x8a47('0x51')]?_0x290193[_0x8a47('0x35')]:_0x3f4cce[_0x8a47('0x2e')];_0x290193[_0x8a47('0x39')]=qs[_0x8a47('0x3a')](_0x134fc5[_0x8a47('0x30')][_0x8a47('0x3a')]);_0x290193[_0x8a47('0x3b')]=qs[_0x8a47('0x33')](_['pick'](_0x134fc5[_0x8a47('0x30')],_0x3f4cce[_0x8a47('0x33')]));if(_0x134fc5[_0x8a47('0x30')][_0x8a47('0x40')]){_0x290193[_0x8a47('0x3b')]=_[_0x8a47('0x3f')](_0x290193['where'],{'$or':_[_0x8a47('0x52')](_0x290193['attributes'],function(_0x513bf3){var _0x400c4e={};_0x400c4e[_0x513bf3]={'$like':'%'+_0x134fc5[_0x8a47('0x30')][_0x8a47('0x40')]+'%'};return _0x400c4e;})});}_0x290193=_[_0x8a47('0x3f')]({},_0x290193,_0x134fc5[_0x8a47('0x41')]);return _0x4659bf[_0x8a47('0x4e')](_0x290193);}})['then'](function(_0x581262){if(_0x581262){_0x31791a=_0x581262[_0x8a47('0x51')];if(!_0x134fc5['query'][_0x8a47('0x37')](_0x8a47('0x38'))){_0x290193[_0x8a47('0x25')]=qs[_0x8a47('0x25')](_0x134fc5[_0x8a47('0x30')][_0x8a47('0x25')]);_0x290193[_0x8a47('0x24')]=qs[_0x8a47('0x24')](_0x134fc5['query']['offset']);}return _0x4659bf[_0x8a47('0x4e')](_0x290193);}})[_0x8a47('0x15')](function(_0x2761bf){if(_0x2761bf){return _0x2761bf?{'count':_0x31791a,'rows':_0x2761bf}:null;}})['then'](respondWithResult(_0x3242b7,null))['catch'](handleError(_0x3242b7,null));};exports['getSubjects']=function(_0x26c85a,_0x5bb619,_0x217deb){var _0x301dc0={};var _0x96e293={};var _0x220f50;var _0x55ffcd;return db[_0x8a47('0x42')]['findOne']({'where':{'id':_0x26c85a[_0x8a47('0x48')]['id']}})[_0x8a47('0x15')](handleEntityNotFound(_0x5bb619,null))[_0x8a47('0x15')](function(_0x52b767){if(_0x52b767){_0x220f50=_0x52b767;_0x96e293[_0x8a47('0x2e')]=_[_0x8a47('0x2f')](db['VtigerField'][_0x8a47('0x49')]);_0x96e293[_0x8a47('0x30')]=_[_0x8a47('0x2f')](_0x26c85a[_0x8a47('0x30')]);_0x96e293[_0x8a47('0x33')]=_[_0x8a47('0x34')](_0x96e293[_0x8a47('0x2e')],_0x96e293[_0x8a47('0x30')]);_0x301dc0['attributes']=_[_0x8a47('0x34')](_0x96e293[_0x8a47('0x2e')],qs['fields'](_0x26c85a[_0x8a47('0x30')][_0x8a47('0x36')]));_0x301dc0['attributes']=_0x301dc0[_0x8a47('0x35')][_0x8a47('0x51')]?_0x301dc0[_0x8a47('0x35')]:_0x96e293[_0x8a47('0x2e')];_0x301dc0[_0x8a47('0x39')]=qs['sort'](_0x26c85a['query'][_0x8a47('0x3a')]);_0x301dc0[_0x8a47('0x3b')]=qs[_0x8a47('0x33')](_[_0x8a47('0x3c')](_0x26c85a[_0x8a47('0x30')],_0x96e293[_0x8a47('0x33')]));if(_0x26c85a[_0x8a47('0x30')]['filter']){_0x301dc0[_0x8a47('0x3b')]=_[_0x8a47('0x3f')](_0x301dc0[_0x8a47('0x3b')],{'$or':_['map'](_0x301dc0[_0x8a47('0x35')],function(_0x28466a){var _0xa2ea5c={};_0xa2ea5c[_0x28466a]={'$like':'%'+_0x26c85a[_0x8a47('0x30')][_0x8a47('0x40')]+'%'};return _0xa2ea5c;})});}_0x301dc0=_[_0x8a47('0x3f')]({},_0x301dc0,_0x26c85a[_0x8a47('0x41')]);return _0x220f50[_0x8a47('0x53')](_0x301dc0);}})['then'](function(_0x509e91){if(_0x509e91){_0x55ffcd=_0x509e91[_0x8a47('0x51')];if(!_0x26c85a[_0x8a47('0x30')][_0x8a47('0x37')]('nolimit')){_0x301dc0[_0x8a47('0x25')]=qs[_0x8a47('0x25')](_0x26c85a[_0x8a47('0x30')][_0x8a47('0x25')]);_0x301dc0[_0x8a47('0x24')]=qs[_0x8a47('0x24')](_0x26c85a[_0x8a47('0x30')][_0x8a47('0x24')]);}return _0x220f50[_0x8a47('0x53')](_0x301dc0);}})[_0x8a47('0x15')](function(_0x39df69){if(_0x39df69){return _0x39df69?{'count':_0x55ffcd,'rows':_0x39df69}:null;}})[_0x8a47('0x15')](respondWithResult(_0x5bb619,null))['catch'](handleError(_0x5bb619,null));};exports[_0x8a47('0x54')]=function(_0x21eb7b,_0x17d448,_0x406be8){var _0xd58437={};var _0x11efd9={};var _0xaa5dab;var _0x403213;return db[_0x8a47('0x42')][_0x8a47('0x4f')]({'where':{'id':_0x21eb7b[_0x8a47('0x48')]['id']}})['then'](handleEntityNotFound(_0x17d448,null))[_0x8a47('0x15')](function(_0x219b4a){if(_0x219b4a){_0xaa5dab=_0x219b4a;_0x11efd9[_0x8a47('0x2e')]=_[_0x8a47('0x2f')](db[_0x8a47('0x50')][_0x8a47('0x49')]);_0x11efd9[_0x8a47('0x30')]=_[_0x8a47('0x2f')](_0x21eb7b[_0x8a47('0x30')]);_0x11efd9['filters']=_[_0x8a47('0x34')](_0x11efd9['model'],_0x11efd9[_0x8a47('0x30')]);_0xd58437['attributes']=_[_0x8a47('0x34')](_0x11efd9[_0x8a47('0x2e')],qs['fields'](_0x21eb7b[_0x8a47('0x30')][_0x8a47('0x36')]));_0xd58437[_0x8a47('0x35')]=_0xd58437[_0x8a47('0x35')]['length']?_0xd58437[_0x8a47('0x35')]:_0x11efd9[_0x8a47('0x2e')];_0xd58437[_0x8a47('0x39')]=qs[_0x8a47('0x3a')](_0x21eb7b[_0x8a47('0x30')][_0x8a47('0x3a')]);_0xd58437[_0x8a47('0x3b')]=qs[_0x8a47('0x33')](_['pick'](_0x21eb7b[_0x8a47('0x30')],_0x11efd9[_0x8a47('0x33')]));if(_0x21eb7b['query'][_0x8a47('0x40')]){_0xd58437['where']=_['merge'](_0xd58437[_0x8a47('0x3b')],{'$or':_[_0x8a47('0x52')](_0xd58437[_0x8a47('0x35')],function(_0x506e24){var _0x5c922c={};_0x5c922c[_0x506e24]={'$like':'%'+_0x21eb7b[_0x8a47('0x30')]['filter']+'%'};return _0x5c922c;})});}_0xd58437=_[_0x8a47('0x3f')]({},_0xd58437,_0x21eb7b[_0x8a47('0x41')]);return _0xaa5dab[_0x8a47('0x54')](_0xd58437);}})['then'](function(_0x1c7cfd){if(_0x1c7cfd){_0x403213=_0x1c7cfd[_0x8a47('0x51')];if(!_0x21eb7b[_0x8a47('0x30')][_0x8a47('0x37')](_0x8a47('0x38'))){_0xd58437['limit']=qs[_0x8a47('0x25')](_0x21eb7b['query'][_0x8a47('0x25')]);_0xd58437[_0x8a47('0x24')]=qs[_0x8a47('0x24')](_0x21eb7b[_0x8a47('0x30')]['offset']);}return _0xaa5dab['getDescriptions'](_0xd58437);}})['then'](function(_0x20e0c4){if(_0x20e0c4){return _0x20e0c4?{'count':_0x403213,'rows':_0x20e0c4}:null;}})['then'](respondWithResult(_0x17d448,null))[_0x8a47('0x20')](handleError(_0x17d448,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2127d75..bd588cd 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 _0x8852=['bluebird','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment'];(function(_0xfb287e,_0x3d816d){var _0x124419=function(_0x3c0463){while(--_0x3c0463){_0xfb287e['push'](_0xfb287e['shift']());}};_0x124419(++_0x3d816d);}(_0x8852,0x146));var _0x2885=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8852[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x2885('0x0'));var logger=require(_0x2885('0x1'))(_0x2885('0x2'));var moment=require(_0x2885('0x3'));var BPromise=require(_0x2885('0x4'));var rp=require('request-promise');var attributes=require(_0x2885('0x5'));module[_0x2885('0x6')]=function(_0x259fd9,_0x380274){return _0x259fd9[_0x2885('0x7')](_0x2885('0x8'),attributes,{'tableName':_0x2885('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bf3=['api','moment','bluebird','request-promise','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x55248a,_0x3c90b9){var _0x138163=function(_0x35e94f){while(--_0x35e94f){_0x55248a['push'](_0x55248a['shift']());}};_0x138163(++_0x3c90b9);}(_0x4bf3,0x15b));var _0x34bf=function(_0x89bef8,_0x26744e){_0x89bef8=_0x89bef8-0x0;var _0x548e83=_0x4bf3[_0x89bef8];return _0x548e83;};'use strict';var _=require(_0x34bf('0x0'));var util=require(_0x34bf('0x1'));var logger=require(_0x34bf('0x2'))(_0x34bf('0x3'));var moment=require(_0x34bf('0x4'));var BPromise=require(_0x34bf('0x5'));var rp=require(_0x34bf('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x52a968,_0x51e4ce){return _0x52a968[_0x34bf('0x7')](_0x34bf('0x8'),attributes,{'tableName':_0x34bf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 35b254f..07804e7 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 _0x7109=['stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','request','request\x20sent','debug'];(function(_0x195f71,_0x40c2bd){var _0x3bb3bc=function(_0x4827fb){while(--_0x4827fb){_0x195f71['push'](_0x195f71['shift']());}};_0x3bb3bc(++_0x40c2bd);}(_0x7109,0xa0));var _0x9710=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0x7109[_0x256422];return _0x55dddc;};'use strict';var _=require(_0x9710('0x0'));var util=require(_0x9710('0x1'));var moment=require(_0x9710('0x2'));var BPromise=require('bluebird');var rs=require(_0x9710('0x3'));var fs=require('fs');var db=require(_0x9710('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9710('0x5'));var config=require(_0x9710('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9710('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337322,_0x23ff94,_0x189ea4){return new BPromise(function(_0x1ab7e1,_0x1b68fd){return client[_0x9710('0x8')](_0x337322,_0x189ea4)['then'](function(_0x22dd8b){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x23ff94,_0x9710('0x9'));logger[_0x9710('0xa')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x23ff94,'request\x20sent',JSON[_0x9710('0xb')](_0x22dd8b));if(_0x22dd8b['error']){if(_0x22dd8b[_0x9710('0xc')][_0x9710('0xd')]===0x1f4){logger[_0x9710('0xc')](_0x9710('0xe'),_0x23ff94,_0x22dd8b[_0x9710('0xc')]['message']);return _0x1b68fd(_0x22dd8b[_0x9710('0xc')][_0x9710('0xf')]);}logger[_0x9710('0xc')](_0x9710('0xe'),_0x23ff94,_0x22dd8b[_0x9710('0xc')]['message']);return _0x1ab7e1(_0x22dd8b[_0x9710('0xc')][_0x9710('0xf')]);}else{logger[_0x9710('0x10')](_0x9710('0xe'),_0x23ff94,'request\x20sent');_0x1ab7e1(_0x22dd8b[_0x9710('0x11')][_0x9710('0xf')]);}})[_0x9710('0x12')](function(_0xe317d7){logger[_0x9710('0xc')](_0x9710('0xe'),_0x23ff94,_0xe317d7);_0x1b68fd(_0xe317d7);});});} \ No newline at end of file +var _0xff39=['../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x14efff,_0x4b0148){var _0x3a1210=function(_0x18847d){while(--_0x18847d){_0x14efff['push'](_0x14efff['shift']());}};_0x3a1210(++_0x4b0148);}(_0xff39,0x1e2));var _0x9ff3=function(_0x15ee41,_0x9275d8){_0x15ee41=_0x15ee41-0x0;var _0x2b2846=_0xff39[_0x15ee41];return _0x2b2846;};'use strict';var _=require(_0x9ff3('0x0'));var util=require(_0x9ff3('0x1'));var moment=require('moment');var BPromise=require(_0x9ff3('0x2'));var rs=require(_0x9ff3('0x3'));var fs=require('fs');var db=require(_0x9ff3('0x4'))['db'];var utils=require(_0x9ff3('0x5'));var logger=require('../../config/logger')(_0x9ff3('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ff3('0x7'));var client=jayson['client'][_0x9ff3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x412254,_0x567672,_0x3cd9a4){return new BPromise(function(_0x251895,_0x3f3805){return client[_0x9ff3('0x9')](_0x412254,_0x3cd9a4)['then'](function(_0x3377e4){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x567672,'request\x20sent');logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x567672,_0x9ff3('0xa'),JSON[_0x9ff3('0xb')](_0x3377e4));if(_0x3377e4[_0x9ff3('0xc')]){if(_0x3377e4[_0x9ff3('0xc')][_0x9ff3('0xd')]===0x1f4){logger[_0x9ff3('0xc')](_0x9ff3('0xe'),_0x567672,_0x3377e4[_0x9ff3('0xc')][_0x9ff3('0xf')]);return _0x3f3805(_0x3377e4[_0x9ff3('0xc')]['message']);}logger[_0x9ff3('0xc')](_0x9ff3('0xe'),_0x567672,_0x3377e4['error'][_0x9ff3('0xf')]);return _0x251895(_0x3377e4[_0x9ff3('0xc')]['message']);}else{logger['info'](_0x9ff3('0xe'),_0x567672,_0x9ff3('0xa'));_0x251895(_0x3377e4[_0x9ff3('0x10')][_0x9ff3('0xf')]);}})[_0x9ff3('0x11')](function(_0x1c3dc2){logger[_0x9ff3('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x567672,_0x1c3dc2);_0x3f3805(_0x1c3dc2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6a9b5a7..d87d212 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 _0xc13c=['delete','destroy','exports','util','path','Router','../../components/interaction/service','./intVtigerField.controller','get','index','isAuthenticated','show','create','put','update'];(function(_0x4f039f,_0x54b30a){var _0x37be86=function(_0x53515f){while(--_0x53515f){_0x4f039f['push'](_0x4f039f['shift']());}};_0x37be86(++_0x54b30a);}(_0xc13c,0x15c));var _0xcc13=function(_0x20c8ea,_0x921c4e){_0x20c8ea=_0x20c8ea-0x0;var _0x419e2f=_0xc13c[_0x20c8ea];return _0x419e2f;};'use strict';var multer=require('multer');var util=require(_0xcc13('0x0'));var path=require(_0xcc13('0x1'));var express=require('express');var router=express[_0xcc13('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xcc13('0x3'));var config=require('../../config/environment');var controller=require(_0xcc13('0x4'));router[_0xcc13('0x5')]('/',auth['isAuthenticated'](),controller[_0xcc13('0x6')]);router[_0xcc13('0x5')]('/:id',auth[_0xcc13('0x7')](),controller[_0xcc13('0x8')]);router['post']('/',auth[_0xcc13('0x7')](),controller[_0xcc13('0x9')]);router[_0xcc13('0xa')]('/:id',auth[_0xcc13('0x7')](),controller[_0xcc13('0xb')]);router[_0xcc13('0xc')]('/:id',auth[_0xcc13('0x7')](),controller[_0xcc13('0xd')]);module[_0xcc13('0xe')]=router; \ No newline at end of file +var _0xb9a7=['index','/:id','show','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xb9a7,0x172));var _0x7b9a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xb9a7[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0x7b9a('0x0'));var util=require('util');var path=require(_0x7b9a('0x1'));var express=require(_0x7b9a('0x2'));var router=express[_0x7b9a('0x3')]();var auth=require(_0x7b9a('0x4'));var interaction=require(_0x7b9a('0x5'));var config=require(_0x7b9a('0x6'));var controller=require(_0x7b9a('0x7'));router[_0x7b9a('0x8')]('/',auth[_0x7b9a('0x9')](),controller[_0x7b9a('0xa')]);router[_0x7b9a('0x8')](_0x7b9a('0xb'),auth[_0x7b9a('0x9')](),controller[_0x7b9a('0xc')]);router[_0x7b9a('0xd')]('/',auth[_0x7b9a('0x9')](),controller['create']);router[_0x7b9a('0xe')](_0x7b9a('0xb'),auth[_0x7b9a('0x9')](),controller[_0x7b9a('0xf')]);router[_0x7b9a('0x10')](_0x7b9a('0xb'),auth[_0x7b9a('0x9')](),controller[_0x7b9a('0x11')]);module[_0x7b9a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 87d3592..209002b 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 _0xac4a=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x1c461e,_0x1b98ff){var _0x1dce4f=function(_0x5cbdf0){while(--_0x5cbdf0){_0x1c461e['push'](_0x1c461e['shift']());}};_0x1dce4f(++_0x1b98ff);}(_0xac4a,0x13f));var _0xaac4=function(_0x26669c,_0x373f1d){_0x26669c=_0x26669c-0x0;var _0x32a033=_0xac4a[_0x26669c];return _0x32a033;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'type':{'type':Sequelize[_0xaac4('0x2')](_0xaac4('0x3'),_0xaac4('0x4'),_0xaac4('0x5'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xaac4('0x6')]},'key':{'type':Sequelize[_0xaac4('0x6')]},'keyType':{'type':Sequelize[_0xaac4('0x2')]('string',_0xaac4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xaac4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaac4('0x6')]},'customField':{'type':Sequelize[_0xaac4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb43b=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','STRING'];(function(_0x20e5c3,_0x41470c){var _0x401520=function(_0x37f246){while(--_0x37f246){_0x20e5c3['push'](_0x20e5c3['shift']());}};_0x401520(++_0x41470c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1f7361,_0x350c44){_0x1f7361=_0x1f7361-0x0;var _0x1f1347=_0xb43b[_0x1f7361];return _0x1f1347;};'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 diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6a2e5d8..9e9449a 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 _0xc38b=['json','count','offset','limit','Content-Range','apply','save','update','then','error','send','index','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','add','day','where','merge','map','options','VtigerField','include','show','includeAll','find','catch','create','body','params','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x34bd11,_0x322433){var _0x2a4f5c=function(_0x3296e3){while(--_0x3296e3){_0x34bd11['push'](_0x34bd11['shift']());}};_0x2a4f5c(++_0x322433);}(_0xc38b,0xb4));var _0xbc38=function(_0x76d330,_0x2114a3){_0x76d330=_0x76d330-0x0;var _0xf50514=_0xc38b[_0x76d330];return _0xf50514;};'use strict';var jsonpatch=require(_0xbc38('0x0'));var rp=require(_0xbc38('0x1'));var moment=require(_0xbc38('0x2'));var BPromise=require(_0xbc38('0x3'));var Mustache=require(_0xbc38('0x4'));var util=require(_0xbc38('0x5'));var path=require(_0xbc38('0x6'));var sox=require(_0xbc38('0x7'));var csv=require('to-csv');var ejs=require(_0xbc38('0x8'));var fs=require('fs');var _=require(_0xbc38('0x9'));var squel=require(_0xbc38('0xa'));var crypto=require(_0xbc38('0xb'));var jsforce=require(_0xbc38('0xc'));var deskjs=require(_0xbc38('0xd'));var toCsv=require(_0xbc38('0xe'));var querystring=require(_0xbc38('0xf'));var Papa=require(_0xbc38('0x10'));var qs=require(_0xbc38('0x11'));var logger=require('../../config/logger')(_0xbc38('0x12'));var utils=require(_0xbc38('0x13'));var config=require(_0xbc38('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56bc4a,_0x391653){_0x391653=_0x391653||0xcc;return function(_0x5821bf){if(_0x5821bf){return _0x56bc4a[_0xbc38('0x15')](_0x391653);}return _0x56bc4a[_0xbc38('0x16')](_0x391653)[_0xbc38('0x17')]();};}function respondWithResult(_0x3bd8d5,_0x3cd11a){_0x3cd11a=_0x3cd11a||0xc8;return function(_0x333b89){if(_0x333b89){return _0x3bd8d5[_0xbc38('0x16')](_0x3cd11a)[_0xbc38('0x18')](_0x333b89);}};}function respondWithFilteredResult(_0x46c9f4,_0x16433f){return function(_0x846a27){if(_0x846a27){var _0xaf905f=_0x846a27[_0xbc38('0x19')],_0x453db3=_0x16433f[_0xbc38('0x1a')],_0x46ebaa=_0x16433f[_0xbc38('0x1a')]+_0x16433f[_0xbc38('0x1b')],_0x203ea7;if(_0x46ebaa>=_0xaf905f){_0x46ebaa=_0xaf905f;_0x203ea7=0xc8;}else{_0x203ea7=0xce;}_0x46c9f4[_0xbc38('0x16')](_0x203ea7);return _0x46c9f4['set'](_0xbc38('0x1c'),_0x453db3+'-'+_0x46ebaa+'/'+_0xaf905f)[_0xbc38('0x18')](_0x846a27);}return null;};}function patchUpdates(_0x27fb68){return function(_0x544806){try{jsonpatch[_0xbc38('0x1d')](_0x544806,_0x27fb68,!![]);}catch(_0x368ab0){return BPromise['reject'](_0x368ab0);}return _0x544806[_0xbc38('0x1e')]();};}function saveUpdates(_0x4c07a5,_0x370b19){return function(_0x110a4f){if(_0x110a4f){return _0x110a4f[_0xbc38('0x1f')](_0x4c07a5)['then'](function(_0x286450){return _0x286450;});}return null;};}function removeEntity(_0x3037d0,_0x1008a6){return function(_0x53586c){if(_0x53586c){return _0x53586c['destroy']()[_0xbc38('0x20')](function(){_0x3037d0[_0xbc38('0x16')](0xcc)[_0xbc38('0x17')]();});}};}function handleEntityNotFound(_0x332135,_0x5d150c){return function(_0x53fb70){if(!_0x53fb70){_0x332135[_0xbc38('0x15')](0x194);}return _0x53fb70;};}function handleError(_0x5400ec,_0x4c9426){_0x4c9426=_0x4c9426||0x1f4;return function(_0x5f5d50){logger[_0xbc38('0x21')](_0x5f5d50['stack']);if(_0x5f5d50['name']){delete _0x5f5d50['name'];}_0x5400ec[_0xbc38('0x16')](_0x4c9426)[_0xbc38('0x22')](_0x5f5d50);};}exports[_0xbc38('0x23')]=function(_0x4d0f25,_0x36f58c){var _0x53f94a={},_0x19b17b={},_0x3d72d5={'count':0x0,'rows':[]};var _0x4bc111=db['VtigerField'][_0xbc38('0x24')];_0x19b17b[_0xbc38('0x25')]=_[_0xbc38('0x26')](_0x4bc111);var _0xc6a1e1={'dateStart':_0x4d0f25['query'][_0xbc38('0x27')],'dateEnd':_0x4d0f25[_0xbc38('0x28')]['dateEnd']};delete _0x4d0f25[_0xbc38('0x28')][_0xbc38('0x27')];delete _0x4d0f25['query'][_0xbc38('0x29')];_0x19b17b['query']=_[_0xbc38('0x26')](_0x4d0f25[_0xbc38('0x28')]);_0x19b17b[_0xbc38('0x2a')]=_[_0xbc38('0x2b')](_0x19b17b['model'],_0x19b17b[_0xbc38('0x28')]);_0x53f94a['attributes']=_['intersection'](_0x19b17b[_0xbc38('0x25')],qs['fields'](_0x4d0f25[_0xbc38('0x28')][_0xbc38('0x2c')]));_0x53f94a['attributes']=_0x53f94a['attributes'][_0xbc38('0x2d')]?_0x53f94a[_0xbc38('0x2e')]:_0x19b17b[_0xbc38('0x25')];if(!_0x4d0f25[_0xbc38('0x28')][_0xbc38('0x2f')](_0xbc38('0x30'))){_0x53f94a['limit']=qs['limit'](_0x4d0f25[_0xbc38('0x28')][_0xbc38('0x1b')]);_0x53f94a[_0xbc38('0x1a')]=qs['offset'](_0x4d0f25[_0xbc38('0x28')][_0xbc38('0x1a')]);}_0x53f94a[_0xbc38('0x31')]=qs[_0xbc38('0x32')](_0x4d0f25['query'][_0xbc38('0x32')]);_0x53f94a['where']=qs[_0xbc38('0x2a')](_[_0xbc38('0x33')](_0x4d0f25[_0xbc38('0x28')],_0x19b17b[_0xbc38('0x2a')]));if(_0xc6a1e1['dateStart']){if(_0xc6a1e1['dateEnd']){_0xc6a1e1[_0xbc38('0x29')]=moment(_0xc6a1e1[_0xbc38('0x29')])[_0xbc38('0x34')](0x1,'day');}else{_0xc6a1e1[_0xbc38('0x29')]=moment(_0xc6a1e1['dateStart'])[_0xbc38('0x34')](0x1,_0xbc38('0x35'));}_['merge'](_0x53f94a['where'],{'createdAt':{'$gte':_0xc6a1e1[_0xbc38('0x27')],'$lte':_0xc6a1e1['dateEnd']}});}if(_0x4d0f25['query']['filter']){_0x53f94a[_0xbc38('0x36')]=_[_0xbc38('0x37')](_0x53f94a[_0xbc38('0x36')],{'$or':_[_0xbc38('0x38')](_0x53f94a[_0xbc38('0x2e')],function(_0x52948f){var _0x14b681={};_0x14b681[_0x52948f]={'$like':'%'+_0x4d0f25[_0xbc38('0x28')]['filter']+'%'};return _0x14b681;})});}_0x53f94a=_['merge']({},_0x53f94a,_0x4d0f25[_0xbc38('0x39')]);var _0x376c07={'where':_0x53f94a[_0xbc38('0x36')]};return db[_0xbc38('0x3a')][_0xbc38('0x19')](_0x376c07)[_0xbc38('0x20')](function(_0x5189df){_0x3d72d5[_0xbc38('0x19')]=_0x5189df;if(_0x4d0f25[_0xbc38('0x28')]['includeAll']){_0x53f94a[_0xbc38('0x3b')]=[{'all':!![]}];}return db[_0xbc38('0x3a')]['findAll'](_0x53f94a);})[_0xbc38('0x20')](function(_0x426320){_0x3d72d5['rows']=_0x426320;return _0x3d72d5;})[_0xbc38('0x20')](respondWithFilteredResult(_0x36f58c,_0x53f94a))['catch'](handleError(_0x36f58c,null));};exports[_0xbc38('0x3c')]=function(_0x238152,_0x1bbb0f){var _0x25dbb8={'raw':!![],'where':{'id':_0x238152['params']['id']}},_0x5187d3={};_0x5187d3[_0xbc38('0x25')]=_[_0xbc38('0x26')](db['VtigerField']['rawAttributes']);_0x5187d3['query']=_[_0xbc38('0x26')](_0x238152['query']);_0x5187d3[_0xbc38('0x2a')]=_[_0xbc38('0x2b')](_0x5187d3[_0xbc38('0x25')],_0x5187d3[_0xbc38('0x28')]);_0x25dbb8[_0xbc38('0x2e')]=_[_0xbc38('0x2b')](_0x5187d3[_0xbc38('0x25')],qs['fields'](_0x238152[_0xbc38('0x28')]['fields']));_0x25dbb8['attributes']=_0x25dbb8[_0xbc38('0x2e')][_0xbc38('0x2d')]?_0x25dbb8[_0xbc38('0x2e')]:_0x5187d3['model'];if(_0x238152[_0xbc38('0x28')][_0xbc38('0x3d')]){_0x25dbb8['include']=[{'all':!![]}];}_0x25dbb8=_[_0xbc38('0x37')]({},_0x25dbb8,_0x238152[_0xbc38('0x39')]);return db['VtigerField'][_0xbc38('0x3e')](_0x25dbb8)[_0xbc38('0x20')](handleEntityNotFound(_0x1bbb0f,null))[_0xbc38('0x20')](respondWithResult(_0x1bbb0f,null))[_0xbc38('0x3f')](handleError(_0x1bbb0f,null));};exports[_0xbc38('0x40')]=function(_0x176718,_0x4e776e){return db[_0xbc38('0x3a')]['create'](_0x176718[_0xbc38('0x41')],{})[_0xbc38('0x20')](respondWithResult(_0x4e776e,0xc9))['catch'](handleError(_0x4e776e,null));};exports[_0xbc38('0x1f')]=function(_0x5a332a,_0x2afdf8){if(_0x5a332a[_0xbc38('0x41')]['id']){delete _0x5a332a[_0xbc38('0x41')]['id'];}return db[_0xbc38('0x3a')][_0xbc38('0x3e')]({'where':{'id':_0x5a332a[_0xbc38('0x42')]['id']}})[_0xbc38('0x20')](handleEntityNotFound(_0x2afdf8,null))[_0xbc38('0x20')](saveUpdates(_0x5a332a[_0xbc38('0x41')],null))[_0xbc38('0x20')](respondWithResult(_0x2afdf8,null))[_0xbc38('0x3f')](handleError(_0x2afdf8,null));};exports[_0xbc38('0x43')]=function(_0x388a8b,_0x4a3488){return db[_0xbc38('0x3a')]['find']({'where':{'id':_0x388a8b['params']['id']}})[_0xbc38('0x20')](handleEntityNotFound(_0x4a3488,null))[_0xbc38('0x20')](removeEntity(_0x4a3488,null))[_0xbc38('0x3f')](handleError(_0x4a3488,null));}; \ No newline at end of file +var _0xe5b3=['squel','crypto','jsforce','desk.js','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','VtigerField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','update','body','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x18102f,_0x49edca){var _0x5b3f01=function(_0x6668f7){while(--_0x6668f7){_0x18102f['push'](_0x18102f['shift']());}};_0x5b3f01(++_0x49edca);}(_0xe5b3,0x156));var _0x3e5b=function(_0x2efda4,_0x86b53b){_0x2efda4=_0x2efda4-0x0;var _0x1b5c11=_0xe5b3[_0x2efda4];return _0x1b5c11;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x3e5b('0x0'));var moment=require('moment');var BPromise=require(_0x3e5b('0x1'));var Mustache=require(_0x3e5b('0x2'));var util=require('util');var path=require(_0x3e5b('0x3'));var sox=require(_0x3e5b('0x4'));var csv=require(_0x3e5b('0x5'));var ejs=require(_0x3e5b('0x6'));var fs=require('fs');var _=require(_0x3e5b('0x7'));var squel=require(_0x3e5b('0x8'));var crypto=require(_0x3e5b('0x9'));var jsforce=require(_0x3e5b('0xa'));var deskjs=require(_0x3e5b('0xb'));var toCsv=require(_0x3e5b('0x5'));var querystring=require('querystring');var Papa=require(_0x3e5b('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x3e5b('0xd'))('api');var utils=require(_0x3e5b('0xe'));var config=require(_0x3e5b('0xf'));var db=require(_0x3e5b('0x10'))['db'];function respondWithStatusCode(_0xaddeb7,_0x2c0a93){_0x2c0a93=_0x2c0a93||0xcc;return function(_0xecb9d7){if(_0xecb9d7){return _0xaddeb7[_0x3e5b('0x11')](_0x2c0a93);}return _0xaddeb7[_0x3e5b('0x12')](_0x2c0a93)[_0x3e5b('0x13')]();};}function respondWithResult(_0x2f027f,_0x98079e){_0x98079e=_0x98079e||0xc8;return function(_0x4374ea){if(_0x4374ea){return _0x2f027f[_0x3e5b('0x12')](_0x98079e)[_0x3e5b('0x14')](_0x4374ea);}};}function respondWithFilteredResult(_0x3551f6,_0x5be86f){return function(_0x15cc7c){if(_0x15cc7c){var _0x29afa2=_0x15cc7c[_0x3e5b('0x15')],_0x377544=_0x5be86f['offset'],_0x229064=_0x5be86f[_0x3e5b('0x16')]+_0x5be86f[_0x3e5b('0x17')],_0x196602;if(_0x229064>=_0x29afa2){_0x229064=_0x29afa2;_0x196602=0xc8;}else{_0x196602=0xce;}_0x3551f6[_0x3e5b('0x12')](_0x196602);return _0x3551f6[_0x3e5b('0x18')](_0x3e5b('0x19'),_0x377544+'-'+_0x229064+'/'+_0x29afa2)[_0x3e5b('0x14')](_0x15cc7c);}return null;};}function patchUpdates(_0x458561){return function(_0xbfab1){try{jsonpatch[_0x3e5b('0x1a')](_0xbfab1,_0x458561,!![]);}catch(_0x323bd4){return BPromise[_0x3e5b('0x1b')](_0x323bd4);}return _0xbfab1[_0x3e5b('0x1c')]();};}function saveUpdates(_0x199c60,_0x28d161){return function(_0xbd2601){if(_0xbd2601){return _0xbd2601['update'](_0x199c60)[_0x3e5b('0x1d')](function(_0x1171c7){return _0x1171c7;});}return null;};}function removeEntity(_0x304258,_0x30f928){return function(_0x10b7c0){if(_0x10b7c0){return _0x10b7c0[_0x3e5b('0x1e')]()[_0x3e5b('0x1d')](function(){_0x304258[_0x3e5b('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd179fc,_0x5cd205){return function(_0x3603cc){if(!_0x3603cc){_0xd179fc[_0x3e5b('0x11')](0x194);}return _0x3603cc;};}function handleError(_0x16528e,_0x1ef4e7){_0x1ef4e7=_0x1ef4e7||0x1f4;return function(_0x559ec0){logger[_0x3e5b('0x1f')](_0x559ec0[_0x3e5b('0x20')]);if(_0x559ec0[_0x3e5b('0x21')]){delete _0x559ec0[_0x3e5b('0x21')];}_0x16528e[_0x3e5b('0x12')](_0x1ef4e7)[_0x3e5b('0x22')](_0x559ec0);};}exports['index']=function(_0x249928,_0x4f179e){var _0x25d4d0={},_0x4a27e6={},_0x700967={'count':0x0,'rows':[]};var _0x501e31=db[_0x3e5b('0x23')][_0x3e5b('0x24')];_0x4a27e6[_0x3e5b('0x25')]=_[_0x3e5b('0x26')](_0x501e31);var _0x52c9cd={'dateStart':_0x249928[_0x3e5b('0x27')][_0x3e5b('0x28')],'dateEnd':_0x249928['query'][_0x3e5b('0x29')]};delete _0x249928[_0x3e5b('0x27')][_0x3e5b('0x28')];delete _0x249928['query'][_0x3e5b('0x29')];_0x4a27e6['query']=_[_0x3e5b('0x26')](_0x249928[_0x3e5b('0x27')]);_0x4a27e6[_0x3e5b('0x2a')]=_[_0x3e5b('0x2b')](_0x4a27e6[_0x3e5b('0x25')],_0x4a27e6[_0x3e5b('0x27')]);_0x25d4d0[_0x3e5b('0x2c')]=_[_0x3e5b('0x2b')](_0x4a27e6[_0x3e5b('0x25')],qs[_0x3e5b('0x2d')](_0x249928[_0x3e5b('0x27')][_0x3e5b('0x2d')]));_0x25d4d0[_0x3e5b('0x2c')]=_0x25d4d0[_0x3e5b('0x2c')]['length']?_0x25d4d0[_0x3e5b('0x2c')]:_0x4a27e6[_0x3e5b('0x25')];if(!_0x249928[_0x3e5b('0x27')][_0x3e5b('0x2e')](_0x3e5b('0x2f'))){_0x25d4d0[_0x3e5b('0x17')]=qs['limit'](_0x249928[_0x3e5b('0x27')][_0x3e5b('0x17')]);_0x25d4d0['offset']=qs[_0x3e5b('0x16')](_0x249928['query']['offset']);}_0x25d4d0[_0x3e5b('0x30')]=qs[_0x3e5b('0x31')](_0x249928[_0x3e5b('0x27')][_0x3e5b('0x31')]);_0x25d4d0[_0x3e5b('0x32')]=qs[_0x3e5b('0x2a')](_[_0x3e5b('0x33')](_0x249928[_0x3e5b('0x27')],_0x4a27e6[_0x3e5b('0x2a')]));if(_0x52c9cd[_0x3e5b('0x28')]){if(_0x52c9cd[_0x3e5b('0x29')]){_0x52c9cd[_0x3e5b('0x29')]=moment(_0x52c9cd[_0x3e5b('0x29')])[_0x3e5b('0x34')](0x1,_0x3e5b('0x35'));}else{_0x52c9cd[_0x3e5b('0x29')]=moment(_0x52c9cd['dateStart'])[_0x3e5b('0x34')](0x1,_0x3e5b('0x35'));}_[_0x3e5b('0x36')](_0x25d4d0[_0x3e5b('0x32')],{'createdAt':{'$gte':_0x52c9cd[_0x3e5b('0x28')],'$lte':_0x52c9cd[_0x3e5b('0x29')]}});}if(_0x249928['query'][_0x3e5b('0x37')]){_0x25d4d0['where']=_['merge'](_0x25d4d0[_0x3e5b('0x32')],{'$or':_[_0x3e5b('0x38')](_0x25d4d0[_0x3e5b('0x2c')],function(_0xc330de){var _0x4f000b={};_0x4f000b[_0xc330de]={'$like':'%'+_0x249928[_0x3e5b('0x27')]['filter']+'%'};return _0x4f000b;})});}_0x25d4d0=_[_0x3e5b('0x36')]({},_0x25d4d0,_0x249928['options']);var _0x48c57e={'where':_0x25d4d0['where']};return db['VtigerField'][_0x3e5b('0x15')](_0x48c57e)[_0x3e5b('0x1d')](function(_0xaa7edc){_0x700967['count']=_0xaa7edc;if(_0x249928[_0x3e5b('0x27')][_0x3e5b('0x39')]){_0x25d4d0['include']=[{'all':!![]}];}return db[_0x3e5b('0x23')][_0x3e5b('0x3a')](_0x25d4d0);})['then'](function(_0x102493){_0x700967[_0x3e5b('0x3b')]=_0x102493;return _0x700967;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x4f179e,_0x25d4d0))[_0x3e5b('0x3c')](handleError(_0x4f179e,null));};exports[_0x3e5b('0x3d')]=function(_0x295457,_0x5a4768){var _0x336478={'raw':!![],'where':{'id':_0x295457[_0x3e5b('0x3e')]['id']}},_0x4e68a4={};_0x4e68a4[_0x3e5b('0x25')]=_[_0x3e5b('0x26')](db[_0x3e5b('0x23')][_0x3e5b('0x24')]);_0x4e68a4[_0x3e5b('0x27')]=_[_0x3e5b('0x26')](_0x295457[_0x3e5b('0x27')]);_0x4e68a4['filters']=_['intersection'](_0x4e68a4[_0x3e5b('0x25')],_0x4e68a4[_0x3e5b('0x27')]);_0x336478['attributes']=_[_0x3e5b('0x2b')](_0x4e68a4[_0x3e5b('0x25')],qs['fields'](_0x295457[_0x3e5b('0x27')][_0x3e5b('0x2d')]));_0x336478[_0x3e5b('0x2c')]=_0x336478['attributes'][_0x3e5b('0x3f')]?_0x336478[_0x3e5b('0x2c')]:_0x4e68a4['model'];if(_0x295457[_0x3e5b('0x27')][_0x3e5b('0x39')]){_0x336478[_0x3e5b('0x40')]=[{'all':!![]}];}_0x336478=_[_0x3e5b('0x36')]({},_0x336478,_0x295457[_0x3e5b('0x41')]);return db[_0x3e5b('0x23')][_0x3e5b('0x42')](_0x336478)['then'](handleEntityNotFound(_0x5a4768,null))[_0x3e5b('0x1d')](respondWithResult(_0x5a4768,null))['catch'](handleError(_0x5a4768,null));};exports['create']=function(_0x2a2601,_0x3be2e7){return db[_0x3e5b('0x23')][_0x3e5b('0x43')](_0x2a2601['body'],{})[_0x3e5b('0x1d')](respondWithResult(_0x3be2e7,0xc9))['catch'](handleError(_0x3be2e7,null));};exports[_0x3e5b('0x44')]=function(_0x5bb0da,_0x1b71d7){if(_0x5bb0da[_0x3e5b('0x45')]['id']){delete _0x5bb0da[_0x3e5b('0x45')]['id'];}return db['VtigerField'][_0x3e5b('0x42')]({'where':{'id':_0x5bb0da[_0x3e5b('0x3e')]['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x1b71d7,null))['then'](saveUpdates(_0x5bb0da[_0x3e5b('0x45')],null))[_0x3e5b('0x1d')](respondWithResult(_0x1b71d7,null))[_0x3e5b('0x3c')](handleError(_0x1b71d7,null));};exports[_0x3e5b('0x1e')]=function(_0x5e720b,_0x215b9b){return db[_0x3e5b('0x23')][_0x3e5b('0x42')]({'where':{'id':_0x5e720b[_0x3e5b('0x3e')]['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x215b9b,null))[_0x3e5b('0x1d')](removeEntity(_0x215b9b,null))[_0x3e5b('0x3c')](handleError(_0x215b9b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5d64d9a..ffe13de 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 _0x6b92=['moment','request-promise','exports','define','VtigerField','lodash','api'];(function(_0x5095dc,_0x2a751c){var _0x275014=function(_0x35be4f){while(--_0x35be4f){_0x5095dc['push'](_0x5095dc['shift']());}};_0x275014(++_0x2a751c);}(_0x6b92,0x171));var _0x26b9=function(_0x4f2b48,_0x4ca75a){_0x4f2b48=_0x4f2b48-0x0;var _0x44015c=_0x6b92[_0x4f2b48];return _0x44015c;};'use strict';var _=require(_0x26b9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x26b9('0x1'));var moment=require(_0x26b9('0x2'));var BPromise=require('bluebird');var rp=require(_0x26b9('0x3'));var attributes=require('./intVtigerField.attributes');module[_0x26b9('0x4')]=function(_0x181592,_0x348b1b){return _0x181592[_0x26b9('0x5')](_0x26b9('0x6'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b6e=['../../config/logger','api','moment','bluebird','./intVtigerField.attributes','VtigerField','int_vtiger_fields','lodash','util'];(function(_0x4318ea,_0x3a37fd){var _0x5265cb=function(_0x151bcd){while(--_0x151bcd){_0x4318ea['push'](_0x4318ea['shift']());}};_0x5265cb(++_0x3a37fd);}(_0x1b6e,0x115));var _0xe1b6=function(_0xf244e0,_0x20556c){_0xf244e0=_0xf244e0-0x0;var _0xe94095=_0x1b6e[_0xf244e0];return _0xe94095;};'use strict';var _=require(_0xe1b6('0x0'));var util=require(_0xe1b6('0x1'));var logger=require(_0xe1b6('0x2'))(_0xe1b6('0x3'));var moment=require(_0xe1b6('0x4'));var BPromise=require(_0xe1b6('0x5'));var rp=require('request-promise');var attributes=require(_0xe1b6('0x6'));module['exports']=function(_0x4e466f,_0x14d85d){return _0x4e466f['define'](_0xe1b6('0x7'),attributes,{'tableName':_0xe1b6('0x8'),'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 3ff8755..7bfce1d 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 _0x8cb5=['http','request','info','request\x20sent','debug','stringify','error','VtigerField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2a1dc3,_0x2bcbcc){var _0x4f0d17=function(_0x4f44a7){while(--_0x4f44a7){_0x2a1dc3['push'](_0x2a1dc3['shift']());}};_0x4f0d17(++_0x2bcbcc);}(_0x8cb5,0x136));var _0x58cb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8cb5[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x58cb('0x0'));var util=require(_0x58cb('0x1'));var moment=require(_0x58cb('0x2'));var BPromise=require(_0x58cb('0x3'));var rs=require(_0x58cb('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x58cb('0x5'));var logger=require(_0x58cb('0x6'))(_0x58cb('0x7'));var config=require('../../config/environment');var jayson=require(_0x58cb('0x8'));var client=jayson[_0x58cb('0x9')][_0x58cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x440410,_0x4f1211,_0x3d104c){return new BPromise(function(_0x585cd1,_0x3a6e56){return client[_0x58cb('0xb')](_0x440410,_0x3d104c)['then'](function(_0x3f6de0){logger[_0x58cb('0xc')]('VtigerField,\x20%s,\x20%s',_0x4f1211,_0x58cb('0xd'));logger[_0x58cb('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4f1211,'request\x20sent',JSON[_0x58cb('0xf')](_0x3f6de0));if(_0x3f6de0[_0x58cb('0x10')]){if(_0x3f6de0[_0x58cb('0x10')]['code']===0x1f4){logger[_0x58cb('0x10')](_0x58cb('0x11'),_0x4f1211,_0x3f6de0['error']['message']);return _0x3a6e56(_0x3f6de0[_0x58cb('0x10')]['message']);}logger[_0x58cb('0x10')](_0x58cb('0x11'),_0x4f1211,_0x3f6de0['error'][_0x58cb('0x12')]);return _0x585cd1(_0x3f6de0[_0x58cb('0x10')]['message']);}else{logger['info'](_0x58cb('0x11'),_0x4f1211,_0x58cb('0xd'));_0x585cd1(_0x3f6de0[_0x58cb('0x13')]['message']);}})['catch'](function(_0x5cb5f5){logger[_0x58cb('0x10')](_0x58cb('0x11'),_0x4f1211,_0x5cb5f5);_0x3a6e56(_0x5cb5f5);});});} \ No newline at end of file +var _0x8f8f=['util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4b3300,_0x1137f1){var _0x2d26d3=function(_0x4678b5){while(--_0x4678b5){_0x4b3300['push'](_0x4b3300['shift']());}};_0x2d26d3(++_0x1137f1);}(_0x8f8f,0x1a1));var _0xf8f8=function(_0x553342,_0x50539d){_0x553342=_0x553342-0x0;var _0x4c225c=_0x8f8f[_0x553342];return _0x4c225c;};'use strict';var _=require(_0xf8f8('0x0'));var util=require(_0xf8f8('0x1'));var moment=require('moment');var BPromise=require(_0xf8f8('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xf8f8('0x3'));var logger=require(_0xf8f8('0x4'))('rpc');var config=require(_0xf8f8('0x5'));var jayson=require(_0xf8f8('0x6'));var client=jayson[_0xf8f8('0x7')][_0xf8f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x336df8,_0x264853,_0x511152){return new BPromise(function(_0x458748,_0x14316e){return client[_0xf8f8('0x9')](_0x336df8,_0x511152)[_0xf8f8('0xa')](function(_0x45f481){logger[_0xf8f8('0xb')]('VtigerField,\x20%s,\x20%s',_0x264853,_0xf8f8('0xc'));logger[_0xf8f8('0xd')](_0xf8f8('0xe'),_0x264853,'request\x20sent',JSON[_0xf8f8('0xf')](_0x45f481));if(_0x45f481[_0xf8f8('0x10')]){if(_0x45f481[_0xf8f8('0x10')][_0xf8f8('0x11')]===0x1f4){logger['error'](_0xf8f8('0x12'),_0x264853,_0x45f481['error'][_0xf8f8('0x13')]);return _0x14316e(_0x45f481[_0xf8f8('0x10')]['message']);}logger[_0xf8f8('0x10')](_0xf8f8('0x12'),_0x264853,_0x45f481[_0xf8f8('0x10')][_0xf8f8('0x13')]);return _0x458748(_0x45f481[_0xf8f8('0x10')][_0xf8f8('0x13')]);}else{logger[_0xf8f8('0xb')]('VtigerField,\x20%s,\x20%s',_0x264853,_0xf8f8('0xc'));_0x458748(_0x45f481[_0xf8f8('0x14')][_0xf8f8('0x13')]);}})[_0xf8f8('0x15')](function(_0x52c2d7){logger[_0xf8f8('0x10')](_0xf8f8('0x12'),_0x264853,_0x52c2d7);_0x14316e(_0x52c2d7);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2402eba..7f8ba5a 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 _0x6216=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x572aef,_0x57f596){var _0x64171=function(_0x421e90){while(--_0x421e90){_0x572aef['push'](_0x572aef['shift']());}};_0x64171(++_0x57f596);}(_0x6216,0x90));var _0x6621=function(_0x2bc400,_0x27208f){_0x2bc400=_0x2bc400-0x0;var _0x36ab53=_0x6216[_0x2bc400];return _0x36ab53;};'use strict';var multer=require(_0x6621('0x0'));var util=require(_0x6621('0x1'));var path=require(_0x6621('0x2'));var express=require(_0x6621('0x3'));var router=express[_0x6621('0x4')]();var auth=require(_0x6621('0x5'));var interaction=require(_0x6621('0x6'));var config=require(_0x6621('0x7'));var controller=require(_0x6621('0x8'));router[_0x6621('0x9')]('/',auth[_0x6621('0xa')](),controller[_0x6621('0xb')]);router[_0x6621('0x9')](_0x6621('0xc'),auth[_0x6621('0xa')](),controller[_0x6621('0xd')]);router[_0x6621('0x9')](_0x6621('0xe'),auth[_0x6621('0xa')](),controller[_0x6621('0xf')]);router['get'](_0x6621('0x10'),auth[_0x6621('0xa')](),controller[_0x6621('0x11')]);router[_0x6621('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6621('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x6621('0x13')]);router[_0x6621('0x14')]('/:id',auth[_0x6621('0xa')](),controller['update']);router['delete'](_0x6621('0xc'),auth['isAuthenticated'](),controller[_0x6621('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4b17=['path','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','delete','multer'];(function(_0x32d80b,_0x356f49){var _0x454a50=function(_0x696c9c){while(--_0x696c9c){_0x32d80b['push'](_0x32d80b['shift']());}};_0x454a50(++_0x356f49);}(_0x4b17,0x10f));var _0x74b1=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x4b17[_0x3c04ef];return _0x6a3a69;};'use strict';var multer=require(_0x74b1('0x0'));var util=require('util');var path=require(_0x74b1('0x1'));var express=require('express');var router=express[_0x74b1('0x2')]();var auth=require(_0x74b1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x74b1('0x4'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x74b1('0x5')](),controller[_0x74b1('0x6')]);router[_0x74b1('0x7')](_0x74b1('0x8'),auth[_0x74b1('0x5')](),controller[_0x74b1('0x9')]);router[_0x74b1('0x7')]('/:id/configurations',auth[_0x74b1('0x5')](),controller[_0x74b1('0xa')]);router[_0x74b1('0x7')](_0x74b1('0xb'),auth[_0x74b1('0x5')](),controller['getFields']);router[_0x74b1('0xc')]('/',auth[_0x74b1('0x5')](),controller['create']);router[_0x74b1('0xc')](_0x74b1('0xd'),auth[_0x74b1('0x5')](),controller[_0x74b1('0xe')]);router['put'](_0x74b1('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x74b1('0xf')](_0x74b1('0x8'),auth['isAuthenticated'](),controller['destroy']);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 a6c4da8..10c08ad 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 _0x8f69=['STRING','username','remoteUri','password','token','integrationTab','newTab','sequelize','exports'];(function(_0x1a4695,_0x594cfe){var _0x4d28a4=function(_0x80be5b){while(--_0x80be5b){_0x1a4695['push'](_0x1a4695['shift']());}};_0x4d28a4(++_0x594cfe);}(_0x8f69,0xfa));var _0x98f6=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x8f69[_0x479160];return _0x47ac6d;};'use strict';var Sequelize=require(_0x98f6('0x0'));module[_0x98f6('0x1')]={'name':{'type':Sequelize[_0x98f6('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x98f6('0x2')],'unique':_0x98f6('0x3')},'password':{'type':Sequelize[_0x98f6('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x98f6('0x4')},'authType':{'type':Sequelize['ENUM'](_0x98f6('0x5'),_0x98f6('0x6')),'defaultValue':_0x98f6('0x5')},'serverUrl':{'type':Sequelize[_0x98f6('0x2')]},'type':{'type':Sequelize['ENUM'](_0x98f6('0x7'),_0x98f6('0x8')),'defaultValue':_0x98f6('0x7')}}; \ No newline at end of file +var _0xa915=['username','remoteUri','password','token','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x4f0983,_0x3997ff){var _0x4b8ae7=function(_0x29c779){while(--_0x29c779){_0x4f0983['push'](_0x4f0983['shift']());}};_0x4b8ae7(++_0x3997ff);}(_0xa915,0x1ab));var _0x5a91=function(_0x33d6c9,_0x910170){_0x33d6c9=_0x33d6c9-0x0;var _0x4e9721=_0xa915[_0x33d6c9];return _0x4e9721;};'use strict';var Sequelize=require(_0x5a91('0x0'));module[_0x5a91('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5a91('0x2')]},'username':{'type':Sequelize[_0x5a91('0x2')],'unique':_0x5a91('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x5a91('0x2')]},'remoteUri':{'type':Sequelize[_0x5a91('0x2')],'unique':_0x5a91('0x4')},'authType':{'type':Sequelize['ENUM'](_0x5a91('0x5'),_0x5a91('0x6')),'defaultValue':_0x5a91('0x5')},'serverUrl':{'type':Sequelize[_0x5a91('0x2')]},'type':{'type':Sequelize[_0x5a91('0x7')](_0x5a91('0x8'),_0x5a91('0x9')),'defaultValue':_0x5a91('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3ac67db..e147838 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 _0xaeaa=['crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','ZendeskAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','day','add','merge','map','filter','options','count','findAll','rows','show','params','include','find','body','ZendeskConfiguration','pick','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','create','ZendeskField','getFields','username','password','token','remoteUri','%s%s','ticket_fields','headers','Basic\x20%s','format','%s:%s','toString','%s/token:%s','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','title','system_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x11e6dc,_0x35376c){var _0x4c1f66=function(_0x4dad45){while(--_0x4dad45){_0x11e6dc['push'](_0x11e6dc['shift']());}};_0x4c1f66(++_0x35376c);}(_0xaeaa,0xf3));var _0xaaea=function(_0x4873e5,_0x5ff785){_0x4873e5=_0x4873e5-0x0;var _0xe033c=_0xaeaa[_0x4873e5];return _0xe033c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xaaea('0x0'));var moment=require(_0xaaea('0x1'));var BPromise=require(_0xaaea('0x2'));var Mustache=require(_0xaaea('0x3'));var util=require(_0xaaea('0x4'));var path=require(_0xaaea('0x5'));var sox=require(_0xaaea('0x6'));var csv=require(_0xaaea('0x7'));var ejs=require(_0xaaea('0x8'));var fs=require('fs');var _=require(_0xaaea('0x9'));var squel=require(_0xaaea('0xa'));var crypto=require(_0xaaea('0xb'));var jsforce=require(_0xaaea('0xc'));var deskjs=require(_0xaaea('0xd'));var toCsv=require(_0xaaea('0x7'));var querystring=require(_0xaaea('0xe'));var Papa=require(_0xaaea('0xf'));var qs=require(_0xaaea('0x10'));var logger=require(_0xaaea('0x11'))(_0xaaea('0x12'));var utils=require(_0xaaea('0x13'));var config=require(_0xaaea('0x14'));var db=require(_0xaaea('0x15'))['db'];var integrations=require(_0xaaea('0x16'));var jayson=require(_0xaaea('0x17'));var client=jayson[_0xaaea('0x18')][_0xaaea('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x55a749,_0xd59785,_0x43acd6,_0x510967){return new BPromise(function(_0x3e3de7,_0x50b8cf){var _0x579697=_0x510967||client;return _0x579697[_0xaaea('0x1a')](_0x55a749,_0x43acd6)[_0xaaea('0x1b')](function(_0x2a8c3a){logger[_0xaaea('0x1c')]('ZendeskAccount,\x20%s,\x20%s',_0xd59785,_0xaaea('0x1d'));logger[_0xaaea('0x1e')](_0xaaea('0x1f'),_0xd59785,'request\x20sent',JSON['stringify'](_0x2a8c3a));if(_0x2a8c3a[_0xaaea('0x20')]){if(_0x2a8c3a[_0xaaea('0x20')][_0xaaea('0x21')]===0x1f4){logger['error'](_0xaaea('0x22'),_0xd59785,_0x2a8c3a[_0xaaea('0x20')][_0xaaea('0x23')]);return _0x50b8cf(_0x2a8c3a[_0xaaea('0x20')][_0xaaea('0x23')]);}logger[_0xaaea('0x20')](_0xaaea('0x22'),_0xd59785,_0x2a8c3a['error'][_0xaaea('0x23')]);return _0x3e3de7(_0x2a8c3a[_0xaaea('0x20')][_0xaaea('0x23')]);}else{logger[_0xaaea('0x1c')](_0xaaea('0x22'),_0xd59785,_0xaaea('0x1d'));_0x3e3de7(_0x2a8c3a[_0xaaea('0x24')][_0xaaea('0x23')]);}})[_0xaaea('0x25')](function(_0x43330a){logger['error'](_0xaaea('0x22'),_0xd59785,_0x43330a);_0x50b8cf(_0x43330a);});});}function respondWithStatusCode(_0x4fe416,_0x410431){_0x410431=_0x410431||0xcc;return function(_0x56e981){if(_0x56e981){return _0x4fe416[_0xaaea('0x26')](_0x410431);}return _0x4fe416[_0xaaea('0x27')](_0x410431)[_0xaaea('0x28')]();};}function respondWithResult(_0x489c71,_0x1cbdf7){_0x1cbdf7=_0x1cbdf7||0xc8;return function(_0x3f6694){if(_0x3f6694){return _0x489c71[_0xaaea('0x27')](_0x1cbdf7)[_0xaaea('0x29')](_0x3f6694);}};}function respondWithFilteredResult(_0x1160f4,_0x574ea4){return function(_0x489cec){if(_0x489cec){var _0x24a11d=_0x489cec['count'],_0x1280c0=_0x574ea4['offset'],_0x4b82b6=_0x574ea4['offset']+_0x574ea4['limit'],_0x70562d;if(_0x4b82b6>=_0x24a11d){_0x4b82b6=_0x24a11d;_0x70562d=0xc8;}else{_0x70562d=0xce;}_0x1160f4['status'](_0x70562d);return _0x1160f4[_0xaaea('0x2a')](_0xaaea('0x2b'),_0x1280c0+'-'+_0x4b82b6+'/'+_0x24a11d)['json'](_0x489cec);}return null;};}function patchUpdates(_0xa08dd5){return function(_0x4fb0d6){try{jsonpatch[_0xaaea('0x2c')](_0x4fb0d6,_0xa08dd5,!![]);}catch(_0xee326c){return BPromise[_0xaaea('0x2d')](_0xee326c);}return _0x4fb0d6[_0xaaea('0x2e')]();};}function saveUpdates(_0x40daac,_0x27e3ab){return function(_0x2eb82e){if(_0x2eb82e){return _0x2eb82e[_0xaaea('0x2f')](_0x40daac)['then'](function(_0x1ef3a9){return _0x1ef3a9;});}return null;};}function removeEntity(_0x209a38,_0x82ed20){return function(_0x3d7c36){if(_0x3d7c36){return _0x3d7c36[_0xaaea('0x30')]()['then'](function(){_0x209a38['status'](0xcc)[_0xaaea('0x28')]();});}};}function handleEntityNotFound(_0x3dd359,_0xb07545){return function(_0x60cf14){if(!_0x60cf14){_0x3dd359['sendStatus'](0x194);}return _0x60cf14;};}function handleError(_0x381bbe,_0x57c9a1){_0x57c9a1=_0x57c9a1||0x1f4;return function(_0x96814e){logger['error'](_0x96814e[_0xaaea('0x31')]);if(_0x96814e[_0xaaea('0x32')]){delete _0x96814e[_0xaaea('0x32')];}_0x381bbe[_0xaaea('0x27')](_0x57c9a1)[_0xaaea('0x33')](_0x96814e);};}exports['index']=function(_0x3c5ff4,_0x5999c9){var _0x33b6e4={},_0x44ed64={},_0x26fbf5={'count':0x0,'rows':[]};var _0x42e16b=db[_0xaaea('0x34')][_0xaaea('0x35')];_0x44ed64[_0xaaea('0x36')]=_[_0xaaea('0x37')](_0x42e16b);var _0x140b93={'dateStart':_0x3c5ff4[_0xaaea('0x38')][_0xaaea('0x39')],'dateEnd':_0x3c5ff4['query'][_0xaaea('0x3a')]};delete _0x3c5ff4[_0xaaea('0x38')]['dateStart'];delete _0x3c5ff4['query']['dateEnd'];_0x44ed64[_0xaaea('0x38')]=_['keys'](_0x3c5ff4[_0xaaea('0x38')]);_0x44ed64[_0xaaea('0x3b')]=_[_0xaaea('0x3c')](_0x44ed64[_0xaaea('0x36')],_0x44ed64[_0xaaea('0x38')]);_0x33b6e4[_0xaaea('0x3d')]=_['intersection'](_0x44ed64[_0xaaea('0x36')],qs[_0xaaea('0x3e')](_0x3c5ff4[_0xaaea('0x38')][_0xaaea('0x3e')]));_0x33b6e4[_0xaaea('0x3d')]=_0x33b6e4[_0xaaea('0x3d')][_0xaaea('0x3f')]?_0x33b6e4[_0xaaea('0x3d')]:_0x44ed64[_0xaaea('0x36')];if(!_0x3c5ff4[_0xaaea('0x38')]['hasOwnProperty'](_0xaaea('0x40'))){_0x33b6e4[_0xaaea('0x41')]=qs[_0xaaea('0x41')](_0x3c5ff4[_0xaaea('0x38')][_0xaaea('0x41')]);_0x33b6e4[_0xaaea('0x42')]=qs[_0xaaea('0x42')](_0x3c5ff4[_0xaaea('0x38')][_0xaaea('0x42')]);}_0x33b6e4[_0xaaea('0x43')]=qs['sort'](_0x3c5ff4['query'][_0xaaea('0x44')]);_0x33b6e4[_0xaaea('0x45')]=qs[_0xaaea('0x3b')](_['pick'](_0x3c5ff4[_0xaaea('0x38')],_0x44ed64['filters']));if(_0x140b93[_0xaaea('0x39')]){if(_0x140b93[_0xaaea('0x3a')]){_0x140b93['dateEnd']=moment(_0x140b93[_0xaaea('0x3a')])['add'](0x1,_0xaaea('0x46'));}else{_0x140b93[_0xaaea('0x3a')]=moment(_0x140b93[_0xaaea('0x39')])[_0xaaea('0x47')](0x1,_0xaaea('0x46'));}_[_0xaaea('0x48')](_0x33b6e4[_0xaaea('0x45')],{'createdAt':{'$gte':_0x140b93[_0xaaea('0x39')],'$lte':_0x140b93[_0xaaea('0x3a')]}});}if(_0x3c5ff4['query']['filter']){_0x33b6e4[_0xaaea('0x45')]=_['merge'](_0x33b6e4[_0xaaea('0x45')],{'$or':_[_0xaaea('0x49')](_0x33b6e4[_0xaaea('0x3d')],function(_0x97f52f){var _0x156ede={};_0x156ede[_0x97f52f]={'$like':'%'+_0x3c5ff4[_0xaaea('0x38')][_0xaaea('0x4a')]+'%'};return _0x156ede;})});}_0x33b6e4=_[_0xaaea('0x48')]({},_0x33b6e4,_0x3c5ff4[_0xaaea('0x4b')]);var _0x32b70c={'where':_0x33b6e4['where']};return db[_0xaaea('0x34')][_0xaaea('0x4c')](_0x32b70c)[_0xaaea('0x1b')](function(_0x365281){_0x26fbf5['count']=_0x365281;if(_0x3c5ff4[_0xaaea('0x38')]['includeAll']){_0x33b6e4['include']=[{'all':!![]}];}return db[_0xaaea('0x34')][_0xaaea('0x4d')](_0x33b6e4);})[_0xaaea('0x1b')](function(_0x2eac38){_0x26fbf5[_0xaaea('0x4e')]=_0x2eac38;return _0x26fbf5;})[_0xaaea('0x1b')](respondWithFilteredResult(_0x5999c9,_0x33b6e4))[_0xaaea('0x25')](handleError(_0x5999c9,null));};exports[_0xaaea('0x4f')]=function(_0x4d5741,_0x346e4e){var _0x4db73f={'raw':![],'where':{'id':_0x4d5741[_0xaaea('0x50')]['id']}},_0x47b5da={};_0x47b5da[_0xaaea('0x36')]=_['keys'](db[_0xaaea('0x34')][_0xaaea('0x35')]);_0x47b5da[_0xaaea('0x38')]=_[_0xaaea('0x37')](_0x4d5741[_0xaaea('0x38')]);_0x47b5da[_0xaaea('0x3b')]=_[_0xaaea('0x3c')](_0x47b5da[_0xaaea('0x36')],_0x47b5da['query']);_0x4db73f[_0xaaea('0x3d')]=_[_0xaaea('0x3c')](_0x47b5da[_0xaaea('0x36')],qs[_0xaaea('0x3e')](_0x4d5741[_0xaaea('0x38')][_0xaaea('0x3e')]));_0x4db73f[_0xaaea('0x3d')]=_0x4db73f[_0xaaea('0x3d')]['length']?_0x4db73f[_0xaaea('0x3d')]:_0x47b5da['model'];if(_0x4d5741[_0xaaea('0x38')]['includeAll']){_0x4db73f[_0xaaea('0x51')]=[{'all':!![]}];}_0x4db73f=_[_0xaaea('0x48')]({},_0x4db73f,_0x4d5741[_0xaaea('0x4b')]);return db[_0xaaea('0x34')][_0xaaea('0x52')](_0x4db73f)[_0xaaea('0x1b')](handleEntityNotFound(_0x346e4e,null))[_0xaaea('0x1b')](respondWithResult(_0x346e4e,null))[_0xaaea('0x25')](handleError(_0x346e4e,null));};exports['create']=function(_0x26da17,_0x43cd4e){return db[_0xaaea('0x34')]['create'](_0x26da17[_0xaaea('0x53')],{})['then'](respondWithResult(_0x43cd4e,0xc9))[_0xaaea('0x25')](handleError(_0x43cd4e,null));};exports['update']=function(_0x23341c,_0x45ae22){if(_0x23341c[_0xaaea('0x53')]['id']){delete _0x23341c[_0xaaea('0x53')]['id'];}return db[_0xaaea('0x34')][_0xaaea('0x52')]({'where':{'id':_0x23341c[_0xaaea('0x50')]['id']}})[_0xaaea('0x1b')](handleEntityNotFound(_0x45ae22,null))[_0xaaea('0x1b')](saveUpdates(_0x23341c[_0xaaea('0x53')],null))['then'](respondWithResult(_0x45ae22,null))['catch'](handleError(_0x45ae22,null));};exports[_0xaaea('0x30')]=function(_0x1f9a1e,_0x317183){return db[_0xaaea('0x34')][_0xaaea('0x52')]({'where':{'id':_0x1f9a1e['params']['id']}})[_0xaaea('0x1b')](handleEntityNotFound(_0x317183,null))['then'](removeEntity(_0x317183,null))[_0xaaea('0x25')](handleError(_0x317183,null));};exports['getConfigurations']=function(_0x34cdb4,_0x264a00,_0x224378){var _0x28227d={};var _0x478ef9={};var _0x159dbd;var _0x22fe3d;return db[_0xaaea('0x34')]['findOne']({'where':{'id':_0x34cdb4['params']['id']}})[_0xaaea('0x1b')](handleEntityNotFound(_0x264a00,null))[_0xaaea('0x1b')](function(_0x53c58a){if(_0x53c58a){_0x159dbd=_0x53c58a;_0x478ef9[_0xaaea('0x36')]=_[_0xaaea('0x37')](db[_0xaaea('0x54')][_0xaaea('0x35')]);_0x478ef9['query']=_['keys'](_0x34cdb4[_0xaaea('0x38')]);_0x478ef9['filters']=_[_0xaaea('0x3c')](_0x478ef9[_0xaaea('0x36')],_0x478ef9[_0xaaea('0x38')]);_0x28227d[_0xaaea('0x3d')]=_[_0xaaea('0x3c')](_0x478ef9['model'],qs[_0xaaea('0x3e')](_0x34cdb4['query'][_0xaaea('0x3e')]));_0x28227d[_0xaaea('0x3d')]=_0x28227d[_0xaaea('0x3d')]['length']?_0x28227d[_0xaaea('0x3d')]:_0x478ef9['model'];_0x28227d[_0xaaea('0x43')]=qs[_0xaaea('0x44')](_0x34cdb4[_0xaaea('0x38')][_0xaaea('0x44')]);_0x28227d[_0xaaea('0x45')]=qs[_0xaaea('0x3b')](_[_0xaaea('0x55')](_0x34cdb4[_0xaaea('0x38')],_0x478ef9['filters']));if(_0x34cdb4['query'][_0xaaea('0x4a')]){_0x28227d['where']=_[_0xaaea('0x48')](_0x28227d[_0xaaea('0x45')],{'$or':_['map'](_0x28227d[_0xaaea('0x3d')],function(_0x21f94b){var _0x38268c={};_0x38268c[_0x21f94b]={'$like':'%'+_0x34cdb4[_0xaaea('0x38')][_0xaaea('0x4a')]+'%'};return _0x38268c;})});}_0x28227d=_[_0xaaea('0x48')]({},_0x28227d,_0x34cdb4[_0xaaea('0x4b')]);return _0x159dbd[_0xaaea('0x56')](_0x28227d);}})[_0xaaea('0x1b')](function(_0xf17a8d){if(_0xf17a8d){_0x22fe3d=_0xf17a8d[_0xaaea('0x3f')];if(!_0x34cdb4[_0xaaea('0x38')][_0xaaea('0x57')]('nolimit')){_0x28227d[_0xaaea('0x41')]=qs[_0xaaea('0x41')](_0x34cdb4[_0xaaea('0x38')]['limit']);_0x28227d['offset']=qs[_0xaaea('0x42')](_0x34cdb4[_0xaaea('0x38')][_0xaaea('0x42')]);}return _0x159dbd['getConfigurations'](_0x28227d);}})[_0xaaea('0x1b')](function(_0x1fb80c){if(_0x1fb80c){return _0x1fb80c?{'count':_0x22fe3d,'rows':_0x1fb80c}:null;}})[_0xaaea('0x1b')](respondWithResult(_0x264a00,null))[_0xaaea('0x25')](handleError(_0x264a00,null));};exports['addConfiguration']=function(_0x47535a,_0x3a5eb4,_0x5053db){if(_0x47535a[_0xaaea('0x53')]['id']){delete _0x47535a[_0xaaea('0x53')]['id'];}return db[_0xaaea('0x34')][_0xaaea('0x58')]({'where':{'id':_0x47535a[_0xaaea('0x50')]['id']}})[_0xaaea('0x1b')](handleEntityNotFound(_0x3a5eb4,null))[_0xaaea('0x1b')](function(_0x5182b5){if(_0x5182b5){_0x47535a[_0xaaea('0x53')][_0xaaea('0x59')]=_0x5182b5['id'];_0x47535a[_0xaaea('0x53')][_0xaaea('0x5a')]=integrations[_0xaaea('0x5b')](_0x47535a[_0xaaea('0x53')][_0xaaea('0x5c')],_0x47535a[_0xaaea('0x53')]['type']);_0x47535a[_0xaaea('0x53')][_0xaaea('0x5d')]=integrations[_0xaaea('0x5e')](_0x47535a[_0xaaea('0x53')][_0xaaea('0x5c')],_0x47535a[_0xaaea('0x53')][_0xaaea('0x5f')]);return db[_0xaaea('0x54')][_0xaaea('0x60')](_0x47535a[_0xaaea('0x53')],{'include':[{'model':db[_0xaaea('0x61')],'as':_0xaaea('0x5a')},{'model':db[_0xaaea('0x61')],'as':'Descriptions'}]});}return null;})[_0xaaea('0x1b')](respondWithResult(_0x3a5eb4,null))[_0xaaea('0x25')](handleError(_0x3a5eb4,null));};exports[_0xaaea('0x62')]=function(_0x2ac886,_0x3740a0,_0x4fbbcc){return db['ZendeskAccount'][_0xaaea('0x58')]({'where':{'id':_0x2ac886['params']['id']},'attributes':['id',_0xaaea('0x63'),_0xaaea('0x64'),_0xaaea('0x65'),'authType',_0xaaea('0x66')]})[_0xaaea('0x1b')](handleEntityNotFound(_0x3740a0,null))[_0xaaea('0x1b')](function(_0x2d34b5){if(_0x2d34b5){var _0x228df4={'method':'GET','uri':util['format'](_0xaaea('0x67'),_0x2d34b5[_0xaaea('0x66')],_0xaaea('0x68')),'json':!![]};switch(_0x2d34b5['authType']){case'password':_0x228df4[_0xaaea('0x69')]={'Authorization':util['format'](_0xaaea('0x6a'),new Buffer(util[_0xaaea('0x6b')](_0xaaea('0x6c'),_0x2d34b5[_0xaaea('0x63')],_0x2d34b5[_0xaaea('0x64')]))[_0xaaea('0x6d')]('base64'))};break;case _0xaaea('0x65'):_0x228df4[_0xaaea('0x69')]={'Authorization':util[_0xaaea('0x6b')]('Basic\x20%s',new Buffer(util[_0xaaea('0x6b')](_0xaaea('0x6e'),_0x2d34b5[_0xaaea('0x63')],_0x2d34b5['token']))['toString'](_0xaaea('0x6f')))};break;default:throw new db[(_0xaaea('0x70'))]['ValidationError'](_0xaaea('0x71'));}return rp(_0x228df4);}})[_0xaaea('0x1b')](function(_0x478d03){if(_0x478d03){var _0x57dbbc=[_0xaaea('0x72'),_0xaaea('0x73'),_0xaaea('0x74'),_0xaaea('0x75')];_['remove'](_0x478d03[_0xaaea('0x68')],function(_0x1552d2){return _0x57dbbc[_0xaaea('0x76')](_0x1552d2['type']);});return{'count':_0x478d03[_0xaaea('0x68')]['length'],'rows':_[_0xaaea('0x49')](_0x478d03['ticket_fields'],function(_0x36a9ab){return{'id':_0x36a9ab['id'],'name':_0x36a9ab[_0xaaea('0x77')]>0x7?_0x36a9ab[_0xaaea('0x78')]:_0x36a9ab[_0xaaea('0x5f')],'custom':_0x36a9ab['position']>0x7?!![]:![],'options':_0x36a9ab[_0xaaea('0x79')]?_0x36a9ab[_0xaaea('0x79')]:[]};})};}})[_0xaaea('0x1b')](respondWithResult(_0x3740a0,null))[_0xaaea('0x25')](function(_0x9daff){var _0x6e59c3=_0x2ac886[_0xaaea('0x38')][_0xaaea('0x7a')]?0x1f4:_0x9daff['statusCode']||0x1f4;logger['error'](_0xaaea('0x7b'),_0xaaea('0x62'),_0x6e59c3,JSON[_0xaaea('0x7c')](_0x9daff));delete _0x9daff[_0xaaea('0x32')];if(_0x6e59c3===0x191){_0x6e59c3=0x190;}_0x3740a0[_0xaaea('0x27')](_0x6e59c3)[_0xaaea('0x33')](_0x2ac886[_0xaaea('0x38')][_0xaaea('0x7a')]?{'message':_0xaaea('0x7d'),'statusCode':_0x9daff[_0xaaea('0x7e')]}:_0x9daff);});}; \ No newline at end of file +var _0x8856=['to-csv','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','ZendeskAccount','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','day','add','merge','filter','map','include','findAll','rows','show','params','length','includeAll','options','find','body','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','create','ZendeskField','username','token','authType','remoteUri','GET','format','ticket_fields','password','headers','%s:%s','Basic\x20%s','%s/token:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','remove','includes','position','title','system_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','squel','crypto','desk.js'];(function(_0x31fc9b,_0x535337){var _0x3de986=function(_0x589c7f){while(--_0x589c7f){_0x31fc9b['push'](_0x31fc9b['shift']());}};_0x3de986(++_0x535337);}(_0x8856,0xe2));var _0x6885=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8856[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0x6885('0x0'));var rp=require(_0x6885('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6885('0x2'));var util=require(_0x6885('0x3'));var path=require(_0x6885('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6885('0x5'));var fs=require('fs');var _=require(_0x6885('0x6'));var squel=require(_0x6885('0x7'));var crypto=require(_0x6885('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6885('0x9'));var toCsv=require(_0x6885('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x6885('0xb'));var logger=require(_0x6885('0xc'))('api');var utils=require('../../config/utils');var config=require(_0x6885('0xd'));var db=require(_0x6885('0xe'))['db'];var integrations=require(_0x6885('0xf'));var jayson=require(_0x6885('0x10'));var client=jayson[_0x6885('0x11')][_0x6885('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x59a33a,_0x3a9203,_0x35d795,_0x52b619){return new BPromise(function(_0x67bcf5,_0x39755c){var _0x131f06=_0x52b619||client;return _0x131f06[_0x6885('0x13')](_0x59a33a,_0x35d795)['then'](function(_0x187cbd){logger[_0x6885('0x14')](_0x6885('0x15'),_0x3a9203,_0x6885('0x16'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3a9203,_0x6885('0x16'),JSON[_0x6885('0x17')](_0x187cbd));if(_0x187cbd[_0x6885('0x18')]){if(_0x187cbd[_0x6885('0x18')]['code']===0x1f4){logger[_0x6885('0x18')](_0x6885('0x15'),_0x3a9203,_0x187cbd[_0x6885('0x18')][_0x6885('0x19')]);return _0x39755c(_0x187cbd[_0x6885('0x18')]['message']);}logger[_0x6885('0x18')](_0x6885('0x15'),_0x3a9203,_0x187cbd['error'][_0x6885('0x19')]);return _0x67bcf5(_0x187cbd['error'][_0x6885('0x19')]);}else{logger[_0x6885('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x3a9203,'request\x20sent');_0x67bcf5(_0x187cbd[_0x6885('0x1a')]['message']);}})[_0x6885('0x1b')](function(_0x2e95d7){logger[_0x6885('0x18')](_0x6885('0x15'),_0x3a9203,_0x2e95d7);_0x39755c(_0x2e95d7);});});}function respondWithStatusCode(_0x53c991,_0x445984){_0x445984=_0x445984||0xcc;return function(_0x55cd94){if(_0x55cd94){return _0x53c991['sendStatus'](_0x445984);}return _0x53c991[_0x6885('0x1c')](_0x445984)[_0x6885('0x1d')]();};}function respondWithResult(_0xad8f0,_0x5cbe11){_0x5cbe11=_0x5cbe11||0xc8;return function(_0x41bebb){if(_0x41bebb){return _0xad8f0[_0x6885('0x1c')](_0x5cbe11)[_0x6885('0x1e')](_0x41bebb);}};}function respondWithFilteredResult(_0x4ad222,_0x291c5b){return function(_0x746410){if(_0x746410){var _0x408ae5=_0x746410[_0x6885('0x1f')],_0x3520d4=_0x291c5b[_0x6885('0x20')],_0x6b4a41=_0x291c5b['offset']+_0x291c5b['limit'],_0x10c936;if(_0x6b4a41>=_0x408ae5){_0x6b4a41=_0x408ae5;_0x10c936=0xc8;}else{_0x10c936=0xce;}_0x4ad222['status'](_0x10c936);return _0x4ad222[_0x6885('0x21')]('Content-Range',_0x3520d4+'-'+_0x6b4a41+'/'+_0x408ae5)[_0x6885('0x1e')](_0x746410);}return null;};}function patchUpdates(_0x6ce2b2){return function(_0x5392bd){try{jsonpatch[_0x6885('0x22')](_0x5392bd,_0x6ce2b2,!![]);}catch(_0xd8d363){return BPromise[_0x6885('0x23')](_0xd8d363);}return _0x5392bd[_0x6885('0x24')]();};}function saveUpdates(_0x3477a8,_0x2d628b){return function(_0x2dd00b){if(_0x2dd00b){return _0x2dd00b[_0x6885('0x25')](_0x3477a8)[_0x6885('0x26')](function(_0x321dc9){return _0x321dc9;});}return null;};}function removeEntity(_0x1f895c,_0x5a0b74){return function(_0x450379){if(_0x450379){return _0x450379[_0x6885('0x27')]()[_0x6885('0x26')](function(){_0x1f895c[_0x6885('0x1c')](0xcc)[_0x6885('0x1d')]();});}};}function handleEntityNotFound(_0x2f26ad,_0x443699){return function(_0x2d1b71){if(!_0x2d1b71){_0x2f26ad[_0x6885('0x28')](0x194);}return _0x2d1b71;};}function handleError(_0x27b7e4,_0x7b7d4b){_0x7b7d4b=_0x7b7d4b||0x1f4;return function(_0x227338){logger['error'](_0x227338[_0x6885('0x29')]);if(_0x227338[_0x6885('0x2a')]){delete _0x227338[_0x6885('0x2a')];}_0x27b7e4[_0x6885('0x1c')](_0x7b7d4b)[_0x6885('0x2b')](_0x227338);};}exports['index']=function(_0x5a8f54,_0x25e094){var _0x2c36ba={},_0x5746e1={},_0x1ec850={'count':0x0,'rows':[]};var _0x8dda0a=db[_0x6885('0x2c')][_0x6885('0x2d')];_0x5746e1[_0x6885('0x2e')]=_['keys'](_0x8dda0a);var _0x4b0382={'dateStart':_0x5a8f54[_0x6885('0x2f')][_0x6885('0x30')],'dateEnd':_0x5a8f54['query'][_0x6885('0x31')]};delete _0x5a8f54['query'][_0x6885('0x30')];delete _0x5a8f54[_0x6885('0x2f')][_0x6885('0x31')];_0x5746e1[_0x6885('0x2f')]=_[_0x6885('0x32')](_0x5a8f54[_0x6885('0x2f')]);_0x5746e1[_0x6885('0x33')]=_['intersection'](_0x5746e1[_0x6885('0x2e')],_0x5746e1[_0x6885('0x2f')]);_0x2c36ba[_0x6885('0x34')]=_[_0x6885('0x35')](_0x5746e1['model'],qs[_0x6885('0x36')](_0x5a8f54[_0x6885('0x2f')][_0x6885('0x36')]));_0x2c36ba[_0x6885('0x34')]=_0x2c36ba[_0x6885('0x34')]['length']?_0x2c36ba[_0x6885('0x34')]:_0x5746e1[_0x6885('0x2e')];if(!_0x5a8f54[_0x6885('0x2f')][_0x6885('0x37')](_0x6885('0x38'))){_0x2c36ba[_0x6885('0x39')]=qs[_0x6885('0x39')](_0x5a8f54[_0x6885('0x2f')]['limit']);_0x2c36ba[_0x6885('0x20')]=qs[_0x6885('0x20')](_0x5a8f54[_0x6885('0x2f')][_0x6885('0x20')]);}_0x2c36ba[_0x6885('0x3a')]=qs['sort'](_0x5a8f54[_0x6885('0x2f')][_0x6885('0x3b')]);_0x2c36ba[_0x6885('0x3c')]=qs[_0x6885('0x33')](_[_0x6885('0x3d')](_0x5a8f54[_0x6885('0x2f')],_0x5746e1[_0x6885('0x33')]));if(_0x4b0382[_0x6885('0x30')]){if(_0x4b0382[_0x6885('0x31')]){_0x4b0382[_0x6885('0x31')]=moment(_0x4b0382['dateEnd'])['add'](0x1,_0x6885('0x3e'));}else{_0x4b0382[_0x6885('0x31')]=moment(_0x4b0382[_0x6885('0x30')])[_0x6885('0x3f')](0x1,_0x6885('0x3e'));}_[_0x6885('0x40')](_0x2c36ba[_0x6885('0x3c')],{'createdAt':{'$gte':_0x4b0382['dateStart'],'$lte':_0x4b0382[_0x6885('0x31')]}});}if(_0x5a8f54[_0x6885('0x2f')][_0x6885('0x41')]){_0x2c36ba[_0x6885('0x3c')]=_[_0x6885('0x40')](_0x2c36ba['where'],{'$or':_[_0x6885('0x42')](_0x2c36ba[_0x6885('0x34')],function(_0x4c68f1){var _0x44f1b9={};_0x44f1b9[_0x4c68f1]={'$like':'%'+_0x5a8f54[_0x6885('0x2f')][_0x6885('0x41')]+'%'};return _0x44f1b9;})});}_0x2c36ba=_[_0x6885('0x40')]({},_0x2c36ba,_0x5a8f54['options']);var _0x59a438={'where':_0x2c36ba[_0x6885('0x3c')]};return db[_0x6885('0x2c')][_0x6885('0x1f')](_0x59a438)[_0x6885('0x26')](function(_0x12a3fc){_0x1ec850[_0x6885('0x1f')]=_0x12a3fc;if(_0x5a8f54[_0x6885('0x2f')]['includeAll']){_0x2c36ba[_0x6885('0x43')]=[{'all':!![]}];}return db[_0x6885('0x2c')][_0x6885('0x44')](_0x2c36ba);})[_0x6885('0x26')](function(_0x491d40){_0x1ec850[_0x6885('0x45')]=_0x491d40;return _0x1ec850;})[_0x6885('0x26')](respondWithFilteredResult(_0x25e094,_0x2c36ba))[_0x6885('0x1b')](handleError(_0x25e094,null));};exports[_0x6885('0x46')]=function(_0x1b89ba,_0x587c47){var _0x5136a1={'raw':![],'where':{'id':_0x1b89ba[_0x6885('0x47')]['id']}},_0x381446={};_0x381446[_0x6885('0x2e')]=_[_0x6885('0x32')](db[_0x6885('0x2c')][_0x6885('0x2d')]);_0x381446[_0x6885('0x2f')]=_[_0x6885('0x32')](_0x1b89ba[_0x6885('0x2f')]);_0x381446[_0x6885('0x33')]=_['intersection'](_0x381446[_0x6885('0x2e')],_0x381446[_0x6885('0x2f')]);_0x5136a1[_0x6885('0x34')]=_['intersection'](_0x381446[_0x6885('0x2e')],qs[_0x6885('0x36')](_0x1b89ba[_0x6885('0x2f')][_0x6885('0x36')]));_0x5136a1[_0x6885('0x34')]=_0x5136a1[_0x6885('0x34')][_0x6885('0x48')]?_0x5136a1['attributes']:_0x381446[_0x6885('0x2e')];if(_0x1b89ba[_0x6885('0x2f')][_0x6885('0x49')]){_0x5136a1[_0x6885('0x43')]=[{'all':!![]}];}_0x5136a1=_['merge']({},_0x5136a1,_0x1b89ba[_0x6885('0x4a')]);return db[_0x6885('0x2c')][_0x6885('0x4b')](_0x5136a1)[_0x6885('0x26')](handleEntityNotFound(_0x587c47,null))['then'](respondWithResult(_0x587c47,null))[_0x6885('0x1b')](handleError(_0x587c47,null));};exports['create']=function(_0x487c19,_0x4440ec){return db[_0x6885('0x2c')]['create'](_0x487c19[_0x6885('0x4c')],{})[_0x6885('0x26')](respondWithResult(_0x4440ec,0xc9))[_0x6885('0x1b')](handleError(_0x4440ec,null));};exports['update']=function(_0x5b5b23,_0x3853f8){if(_0x5b5b23[_0x6885('0x4c')]['id']){delete _0x5b5b23[_0x6885('0x4c')]['id'];}return db[_0x6885('0x2c')][_0x6885('0x4b')]({'where':{'id':_0x5b5b23['params']['id']}})[_0x6885('0x26')](handleEntityNotFound(_0x3853f8,null))[_0x6885('0x26')](saveUpdates(_0x5b5b23[_0x6885('0x4c')],null))[_0x6885('0x26')](respondWithResult(_0x3853f8,null))[_0x6885('0x1b')](handleError(_0x3853f8,null));};exports[_0x6885('0x27')]=function(_0x2f61d7,_0x1e2c43){return db[_0x6885('0x2c')][_0x6885('0x4b')]({'where':{'id':_0x2f61d7['params']['id']}})[_0x6885('0x26')](handleEntityNotFound(_0x1e2c43,null))[_0x6885('0x26')](removeEntity(_0x1e2c43,null))[_0x6885('0x1b')](handleError(_0x1e2c43,null));};exports[_0x6885('0x4d')]=function(_0x328cf6,_0x4639ab,_0x4167cc){var _0x54304f={};var _0x769ce8={};var _0x7bd0da;var _0x5ded6c;return db[_0x6885('0x2c')][_0x6885('0x4e')]({'where':{'id':_0x328cf6[_0x6885('0x47')]['id']}})[_0x6885('0x26')](handleEntityNotFound(_0x4639ab,null))[_0x6885('0x26')](function(_0x5e9501){if(_0x5e9501){_0x7bd0da=_0x5e9501;_0x769ce8['model']=_[_0x6885('0x32')](db[_0x6885('0x4f')][_0x6885('0x2d')]);_0x769ce8[_0x6885('0x2f')]=_[_0x6885('0x32')](_0x328cf6['query']);_0x769ce8[_0x6885('0x33')]=_['intersection'](_0x769ce8[_0x6885('0x2e')],_0x769ce8[_0x6885('0x2f')]);_0x54304f['attributes']=_[_0x6885('0x35')](_0x769ce8['model'],qs[_0x6885('0x36')](_0x328cf6['query'][_0x6885('0x36')]));_0x54304f[_0x6885('0x34')]=_0x54304f[_0x6885('0x34')][_0x6885('0x48')]?_0x54304f[_0x6885('0x34')]:_0x769ce8[_0x6885('0x2e')];_0x54304f[_0x6885('0x3a')]=qs['sort'](_0x328cf6[_0x6885('0x2f')][_0x6885('0x3b')]);_0x54304f[_0x6885('0x3c')]=qs[_0x6885('0x33')](_[_0x6885('0x3d')](_0x328cf6[_0x6885('0x2f')],_0x769ce8[_0x6885('0x33')]));if(_0x328cf6['query'][_0x6885('0x41')]){_0x54304f[_0x6885('0x3c')]=_[_0x6885('0x40')](_0x54304f['where'],{'$or':_[_0x6885('0x42')](_0x54304f[_0x6885('0x34')],function(_0x25f64b){var _0x4b4a93={};_0x4b4a93[_0x25f64b]={'$like':'%'+_0x328cf6[_0x6885('0x2f')][_0x6885('0x41')]+'%'};return _0x4b4a93;})});}_0x54304f=_[_0x6885('0x40')]({},_0x54304f,_0x328cf6[_0x6885('0x4a')]);return _0x7bd0da[_0x6885('0x4d')](_0x54304f);}})[_0x6885('0x26')](function(_0x3dad6e){if(_0x3dad6e){_0x5ded6c=_0x3dad6e[_0x6885('0x48')];if(!_0x328cf6['query']['hasOwnProperty'](_0x6885('0x38'))){_0x54304f[_0x6885('0x39')]=qs['limit'](_0x328cf6[_0x6885('0x2f')]['limit']);_0x54304f['offset']=qs[_0x6885('0x20')](_0x328cf6[_0x6885('0x2f')][_0x6885('0x20')]);}return _0x7bd0da['getConfigurations'](_0x54304f);}})['then'](function(_0x4a5a7e){if(_0x4a5a7e){return _0x4a5a7e?{'count':_0x5ded6c,'rows':_0x4a5a7e}:null;}})['then'](respondWithResult(_0x4639ab,null))['catch'](handleError(_0x4639ab,null));};exports['addConfiguration']=function(_0x12eba3,_0x306e6f,_0x3c180c){if(_0x12eba3[_0x6885('0x4c')]['id']){delete _0x12eba3[_0x6885('0x4c')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x12eba3[_0x6885('0x47')]['id']}})[_0x6885('0x26')](handleEntityNotFound(_0x306e6f,null))[_0x6885('0x26')](function(_0x43e262){if(_0x43e262){_0x12eba3[_0x6885('0x4c')][_0x6885('0x50')]=_0x43e262['id'];_0x12eba3[_0x6885('0x4c')][_0x6885('0x51')]=integrations[_0x6885('0x52')](_0x12eba3[_0x6885('0x4c')][_0x6885('0x53')],_0x12eba3[_0x6885('0x4c')][_0x6885('0x54')]);_0x12eba3[_0x6885('0x4c')][_0x6885('0x55')]=integrations[_0x6885('0x56')](_0x12eba3[_0x6885('0x4c')][_0x6885('0x53')],_0x12eba3[_0x6885('0x4c')][_0x6885('0x54')]);return db[_0x6885('0x4f')][_0x6885('0x57')](_0x12eba3['body'],{'include':[{'model':db[_0x6885('0x58')],'as':'Subjects'},{'model':db[_0x6885('0x58')],'as':_0x6885('0x55')}]});}return null;})[_0x6885('0x26')](respondWithResult(_0x306e6f,null))[_0x6885('0x1b')](handleError(_0x306e6f,null));};exports['getFields']=function(_0x5d60de,_0x764c79,_0x54dbb6){return db[_0x6885('0x2c')]['findOne']({'where':{'id':_0x5d60de[_0x6885('0x47')]['id']},'attributes':['id',_0x6885('0x59'),'password',_0x6885('0x5a'),_0x6885('0x5b'),_0x6885('0x5c')]})['then'](handleEntityNotFound(_0x764c79,null))[_0x6885('0x26')](function(_0x1a7861){if(_0x1a7861){var _0x49f2a2={'method':_0x6885('0x5d'),'uri':util[_0x6885('0x5e')]('%s%s',_0x1a7861[_0x6885('0x5c')],_0x6885('0x5f')),'json':!![]};switch(_0x1a7861[_0x6885('0x5b')]){case _0x6885('0x60'):_0x49f2a2[_0x6885('0x61')]={'Authorization':util[_0x6885('0x5e')]('Basic\x20%s',new Buffer(util[_0x6885('0x5e')](_0x6885('0x62'),_0x1a7861[_0x6885('0x59')],_0x1a7861[_0x6885('0x60')]))['toString']('base64'))};break;case'token':_0x49f2a2[_0x6885('0x61')]={'Authorization':util[_0x6885('0x5e')](_0x6885('0x63'),new Buffer(util[_0x6885('0x5e')](_0x6885('0x64'),_0x1a7861[_0x6885('0x59')],_0x1a7861[_0x6885('0x5a')]))[_0x6885('0x65')](_0x6885('0x66')))};break;default:throw new db[(_0x6885('0x67'))][(_0x6885('0x68'))](_0x6885('0x69'));}return rp(_0x49f2a2);}})[_0x6885('0x26')](function(_0xa2a2ca){if(_0xa2a2ca){var _0x2fb76f=['subject',_0x6885('0x6a'),_0x6885('0x6b'),'assignee'];_[_0x6885('0x6c')](_0xa2a2ca['ticket_fields'],function(_0x12a681){return _0x2fb76f[_0x6885('0x6d')](_0x12a681[_0x6885('0x54')]);});return{'count':_0xa2a2ca[_0x6885('0x5f')][_0x6885('0x48')],'rows':_[_0x6885('0x42')](_0xa2a2ca['ticket_fields'],function(_0xbece1c){return{'id':_0xbece1c['id'],'name':_0xbece1c[_0x6885('0x6e')]>0x7?_0xbece1c[_0x6885('0x6f')]:_0xbece1c['type'],'custom':_0xbece1c[_0x6885('0x6e')]>0x7?!![]:![],'options':_0xbece1c[_0x6885('0x70')]?_0xbece1c[_0x6885('0x70')]:[]};})};}})[_0x6885('0x26')](respondWithResult(_0x764c79,null))['catch'](function(_0xa81bb9){var _0xc1f16c=_0x5d60de[_0x6885('0x2f')]['test']?0x1f4:_0xa81bb9[_0x6885('0x71')]||0x1f4;logger[_0x6885('0x18')](_0x6885('0x72'),_0x6885('0x73'),_0xc1f16c,JSON['stringify'](_0xa81bb9));delete _0xa81bb9[_0x6885('0x2a')];if(_0xc1f16c===0x191){_0xc1f16c=0x190;}_0x764c79[_0x6885('0x1c')](_0xc1f16c)[_0x6885('0x2b')](_0x5d60de[_0x6885('0x2f')][_0x6885('0x74')]?{'message':_0x6885('0x75'),'statusCode':_0xa81bb9[_0x6885('0x71')]}:_0xa81bb9);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 94fb2e7..53e03b8 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 _0x998d=['lodash','api','moment','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts'];(function(_0x499546,_0x55011a){var _0x883eff=function(_0x2cffcf){while(--_0x2cffcf){_0x499546['push'](_0x499546['shift']());}};_0x883eff(++_0x55011a);}(_0x998d,0x118));var _0xd998=function(_0xff11c0,_0x56b955){_0xff11c0=_0xff11c0-0x0;var _0x64790d=_0x998d[_0xff11c0];return _0x64790d;};'use strict';var _=require(_0xd998('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd998('0x1'));var moment=require(_0xd998('0x2'));var BPromise=require('bluebird');var rp=require(_0xd998('0x3'));var attributes=require(_0xd998('0x4'));var integrations=require(_0xd998('0x5'));module['exports']=function(_0x24ede9,_0x37f147){return _0x24ede9['define'](_0xd998('0x6'),attributes,{'tableName':_0xd998('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3576=['moment','bluebird','request-promise','../../components/integrations/configuration','exports','define','ZendeskAccount','util','../../config/logger','api'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0x3576,0xc5));var _0x6357=function(_0xbd5908,_0x26b119){_0xbd5908=_0xbd5908-0x0;var _0x675bc2=_0x3576[_0xbd5908];return _0x675bc2;};'use strict';var _=require('lodash');var util=require(_0x6357('0x0'));var logger=require(_0x6357('0x1'))(_0x6357('0x2'));var moment=require(_0x6357('0x3'));var BPromise=require(_0x6357('0x4'));var rp=require(_0x6357('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x6357('0x6'));module[_0x6357('0x7')]=function(_0x59be2a,_0x41091c){return _0x59be2a[_0x6357('0x8')](_0x6357('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2c6d216..b943005 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 _0x13f1=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','include','map','model','attributes','debug','find','ShowZendeskAccount'];(function(_0x1b9fa,_0x119d71){var _0x4dffe7=function(_0x1fcdc6){while(--_0x1fcdc6){_0x1b9fa['push'](_0x1b9fa['shift']());}};_0x4dffe7(++_0x119d71);}(_0x13f1,0xfc));var _0x113f=function(_0x3301b7,_0x2d6d30){_0x3301b7=_0x3301b7-0x0;var _0x1c6245=_0x13f1[_0x3301b7];return _0x1c6245;};'use strict';var _=require('lodash');var util=require(_0x113f('0x0'));var moment=require(_0x113f('0x1'));var BPromise=require(_0x113f('0x2'));var rs=require(_0x113f('0x3'));var fs=require('fs');var db=require(_0x113f('0x4'))['db'];var utils=require(_0x113f('0x5'));var logger=require(_0x113f('0x6'))(_0x113f('0x7'));var config=require(_0x113f('0x8'));var jayson=require(_0x113f('0x9'));var client=jayson[_0x113f('0xa')][_0x113f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6122e2,_0x54825c,_0x57c642){return new BPromise(function(_0x42b0d8,_0x3c9720){return client[_0x113f('0xc')](_0x6122e2,_0x57c642)[_0x113f('0xd')](function(_0x33306d){logger[_0x113f('0xe')](_0x113f('0xf'),_0x54825c,'request\x20sent');logger['debug'](_0x113f('0x10'),_0x54825c,_0x113f('0x11'),JSON[_0x113f('0x12')](_0x33306d));if(_0x33306d['error']){if(_0x33306d['error'][_0x113f('0x13')]===0x1f4){logger[_0x113f('0x14')](_0x113f('0xf'),_0x54825c,_0x33306d[_0x113f('0x14')][_0x113f('0x15')]);return _0x3c9720(_0x33306d[_0x113f('0x14')][_0x113f('0x15')]);}logger['error'](_0x113f('0xf'),_0x54825c,_0x33306d[_0x113f('0x14')][_0x113f('0x15')]);return _0x42b0d8(_0x33306d['error'][_0x113f('0x15')]);}else{logger[_0x113f('0xe')](_0x113f('0xf'),_0x54825c,_0x113f('0x11'));_0x42b0d8(_0x33306d['result'][_0x113f('0x15')]);}})[_0x113f('0x16')](function(_0x39c276){logger[_0x113f('0x14')](_0x113f('0xf'),_0x54825c,_0x39c276);_0x3c9720(_0x39c276);});});}exports[_0x113f('0x17')]=function(_0x50678d){var _0x163859=this;return new Promise(function(_0x1863ef,_0x25ac31){return db[_0x113f('0x18')][_0x113f('0x19')]({'raw':_0x50678d[_0x113f('0x1a')]?_0x50678d[_0x113f('0x1a')][_0x113f('0x1b')]===undefined?!![]:![]:!![],'where':_0x50678d[_0x113f('0x1a')]?_0x50678d['options'][_0x113f('0x1c')]||null:null,'attributes':_0x50678d[_0x113f('0x1a')]?_0x50678d[_0x113f('0x1a')]['attributes']||null:null,'limit':_0x50678d[_0x113f('0x1a')]?_0x50678d[_0x113f('0x1a')]['limit']||null:null,'include':_0x50678d[_0x113f('0x1a')]?_0x50678d['options'][_0x113f('0x1d')]?_[_0x113f('0x1e')](_0x50678d['options'][_0x113f('0x1d')],function(_0x128ba7){return{'model':db[_0x128ba7[_0x113f('0x1f')]],'as':_0x128ba7['as'],'attributes':_0x128ba7[_0x113f('0x20')],'include':_0x128ba7[_0x113f('0x1d')]?_['map'](_0x128ba7[_0x113f('0x1d')],function(_0x5a0a62){return{'model':db[_0x5a0a62[_0x113f('0x1f')]],'as':_0x5a0a62['as'],'attributes':_0x5a0a62[_0x113f('0x20')],'include':_0x5a0a62['include']?_[_0x113f('0x1e')](_0x5a0a62[_0x113f('0x1d')],function(_0x1122cc){return{'model':db[_0x1122cc[_0x113f('0x1f')]],'as':_0x1122cc['as'],'attributes':_0x1122cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x113f('0xd')](function(_0x35e840){logger['info']('GetZendeskAccount',_0x50678d);logger[_0x113f('0x21')](_0x113f('0x17'),_0x50678d,JSON[_0x113f('0x12')](_0x35e840));_0x1863ef(_0x35e840);})['catch'](function(_0xaad28c){logger['error'](_0x113f('0x17'),_0xaad28c['message'],_0x50678d);_0x25ac31(_0x163859['error'](0x1f4,_0xaad28c[_0x113f('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x33f754){var _0x5361a6=this;return new Promise(function(_0x1b1ab9,_0x360220){return db[_0x113f('0x18')][_0x113f('0x22')]({'raw':_0x33f754[_0x113f('0x1a')]?_0x33f754[_0x113f('0x1a')][_0x113f('0x1b')]===undefined?!![]:![]:!![],'where':_0x33f754['options']?_0x33f754[_0x113f('0x1a')][_0x113f('0x1c')]||null:null,'attributes':_0x33f754[_0x113f('0x1a')]?_0x33f754['options'][_0x113f('0x20')]||null:null,'include':_0x33f754[_0x113f('0x1a')]?_0x33f754[_0x113f('0x1a')][_0x113f('0x1d')]?_['map'](_0x33f754[_0x113f('0x1a')][_0x113f('0x1d')],function(_0x59dd3d){return{'model':db[_0x59dd3d[_0x113f('0x1f')]],'as':_0x59dd3d['as'],'attributes':_0x59dd3d['attributes'],'include':_0x59dd3d[_0x113f('0x1d')]?_[_0x113f('0x1e')](_0x59dd3d[_0x113f('0x1d')],function(_0x6010c4){return{'model':db[_0x6010c4[_0x113f('0x1f')]],'as':_0x6010c4['as'],'attributes':_0x6010c4[_0x113f('0x20')],'include':_0x6010c4[_0x113f('0x1d')]?_['map'](_0x6010c4[_0x113f('0x1d')],function(_0x490fef){return{'model':db[_0x490fef['model']],'as':_0x490fef['as'],'attributes':_0x490fef[_0x113f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x113f('0xd')](function(_0x32247d){logger[_0x113f('0xe')](_0x113f('0x23'),_0x33f754);logger[_0x113f('0x21')](_0x113f('0x23'),_0x33f754,JSON[_0x113f('0x12')](_0x32247d));_0x1b1ab9(_0x32247d);})[_0x113f('0x16')](function(_0x2ba687){logger[_0x113f('0x14')](_0x113f('0x23'),_0x2ba687[_0x113f('0x15')],_0x33f754);_0x360220(_0x5361a6[_0x113f('0x14')](0x1f4,_0x2ba687[_0x113f('0x15')]));});});}; \ No newline at end of file +var _0xe085=['findAll','options','raw','where','limit','include','map','model','catch','ShowZendeskAccount','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetZendeskAccount','ZendeskAccount'];(function(_0x70ff7c,_0x5c92fc){var _0x4251a5=function(_0x14b536){while(--_0x14b536){_0x70ff7c['push'](_0x70ff7c['shift']());}};_0x4251a5(++_0x5c92fc);}(_0xe085,0xe3));var _0x5e08=function(_0x5e9d8a,_0x17ff4f){_0x5e9d8a=_0x5e9d8a-0x0;var _0xfbc8ef=_0xe085[_0x5e9d8a];return _0xfbc8ef;};'use strict';var _=require(_0x5e08('0x0'));var util=require(_0x5e08('0x1'));var moment=require(_0x5e08('0x2'));var BPromise=require(_0x5e08('0x3'));var rs=require(_0x5e08('0x4'));var fs=require('fs');var db=require(_0x5e08('0x5'))['db'];var utils=require(_0x5e08('0x6'));var logger=require(_0x5e08('0x7'))('rpc');var config=require(_0x5e08('0x8'));var jayson=require(_0x5e08('0x9'));var client=jayson[_0x5e08('0xa')][_0x5e08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57823e,_0x36a0df,_0x5d2be4){return new BPromise(function(_0x72e0f5,_0x3dd9ea){return client[_0x5e08('0xc')](_0x57823e,_0x5d2be4)[_0x5e08('0xd')](function(_0x4dd7a9){logger[_0x5e08('0xe')](_0x5e08('0xf'),_0x36a0df,_0x5e08('0x10'));logger[_0x5e08('0x11')](_0x5e08('0x12'),_0x36a0df,_0x5e08('0x10'),JSON[_0x5e08('0x13')](_0x4dd7a9));if(_0x4dd7a9[_0x5e08('0x14')]){if(_0x4dd7a9['error'][_0x5e08('0x15')]===0x1f4){logger[_0x5e08('0x14')](_0x5e08('0xf'),_0x36a0df,_0x4dd7a9['error'][_0x5e08('0x16')]);return _0x3dd9ea(_0x4dd7a9['error'][_0x5e08('0x16')]);}logger['error'](_0x5e08('0xf'),_0x36a0df,_0x4dd7a9[_0x5e08('0x14')]['message']);return _0x72e0f5(_0x4dd7a9[_0x5e08('0x14')]['message']);}else{logger[_0x5e08('0xe')](_0x5e08('0xf'),_0x36a0df,_0x5e08('0x10'));_0x72e0f5(_0x4dd7a9['result'][_0x5e08('0x16')]);}})['catch'](function(_0x245bcd){logger[_0x5e08('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x36a0df,_0x245bcd);_0x3dd9ea(_0x245bcd);});});}exports[_0x5e08('0x17')]=function(_0x34187e){var _0x40362d=this;return new Promise(function(_0x3894ef,_0x5d03be){return db[_0x5e08('0x18')][_0x5e08('0x19')]({'raw':_0x34187e[_0x5e08('0x1a')]?_0x34187e['options'][_0x5e08('0x1b')]===undefined?!![]:![]:!![],'where':_0x34187e[_0x5e08('0x1a')]?_0x34187e['options'][_0x5e08('0x1c')]||null:null,'attributes':_0x34187e[_0x5e08('0x1a')]?_0x34187e['options']['attributes']||null:null,'limit':_0x34187e['options']?_0x34187e[_0x5e08('0x1a')][_0x5e08('0x1d')]||null:null,'include':_0x34187e[_0x5e08('0x1a')]?_0x34187e[_0x5e08('0x1a')][_0x5e08('0x1e')]?_[_0x5e08('0x1f')](_0x34187e[_0x5e08('0x1a')]['include'],function(_0x4372f7){return{'model':db[_0x4372f7[_0x5e08('0x20')]],'as':_0x4372f7['as'],'attributes':_0x4372f7['attributes'],'include':_0x4372f7['include']?_[_0x5e08('0x1f')](_0x4372f7[_0x5e08('0x1e')],function(_0x60385f){return{'model':db[_0x60385f[_0x5e08('0x20')]],'as':_0x60385f['as'],'attributes':_0x60385f['attributes'],'include':_0x60385f['include']?_[_0x5e08('0x1f')](_0x60385f['include'],function(_0x587496){return{'model':db[_0x587496['model']],'as':_0x587496['as'],'attributes':_0x587496['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e08('0xd')](function(_0x4d5781){logger[_0x5e08('0xe')](_0x5e08('0x17'),_0x34187e);logger[_0x5e08('0x11')](_0x5e08('0x17'),_0x34187e,JSON[_0x5e08('0x13')](_0x4d5781));_0x3894ef(_0x4d5781);})[_0x5e08('0x21')](function(_0x5cde23){logger[_0x5e08('0x14')](_0x5e08('0x17'),_0x5cde23[_0x5e08('0x16')],_0x34187e);_0x5d03be(_0x40362d[_0x5e08('0x14')](0x1f4,_0x5cde23[_0x5e08('0x16')]));});});};exports[_0x5e08('0x22')]=function(_0x531af4){var _0xfb942e=this;return new Promise(function(_0x501a9d,_0x22cbd3){return db['ZendeskAccount']['find']({'raw':_0x531af4['options']?_0x531af4[_0x5e08('0x1a')][_0x5e08('0x1b')]===undefined?!![]:![]:!![],'where':_0x531af4[_0x5e08('0x1a')]?_0x531af4[_0x5e08('0x1a')][_0x5e08('0x1c')]||null:null,'attributes':_0x531af4[_0x5e08('0x1a')]?_0x531af4[_0x5e08('0x1a')][_0x5e08('0x23')]||null:null,'include':_0x531af4['options']?_0x531af4[_0x5e08('0x1a')]['include']?_[_0x5e08('0x1f')](_0x531af4[_0x5e08('0x1a')][_0x5e08('0x1e')],function(_0x3da240){return{'model':db[_0x3da240['model']],'as':_0x3da240['as'],'attributes':_0x3da240[_0x5e08('0x23')],'include':_0x3da240[_0x5e08('0x1e')]?_['map'](_0x3da240['include'],function(_0x5d7de8){return{'model':db[_0x5d7de8[_0x5e08('0x20')]],'as':_0x5d7de8['as'],'attributes':_0x5d7de8[_0x5e08('0x23')],'include':_0x5d7de8[_0x5e08('0x1e')]?_[_0x5e08('0x1f')](_0x5d7de8['include'],function(_0x39c9ee){return{'model':db[_0x39c9ee[_0x5e08('0x20')]],'as':_0x39c9ee['as'],'attributes':_0x39c9ee[_0x5e08('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5e08('0xd')](function(_0x3b44f4){logger['info'](_0x5e08('0x22'),_0x531af4);logger[_0x5e08('0x11')](_0x5e08('0x22'),_0x531af4,JSON[_0x5e08('0x13')](_0x3b44f4));_0x501a9d(_0x3b44f4);})['catch'](function(_0x5ce1c4){logger[_0x5e08('0x14')](_0x5e08('0x22'),_0x5ce1c4[_0x5e08('0x16')],_0x531af4);_0x22cbd3(_0xfb942e[_0x5e08('0x14')](0x1f4,_0x5ce1c4[_0x5e08('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d7a8eaa..a8aea33 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 _0x2fa0=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','delete','multer','util','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2fa0,0x19f));var _0x02fa=function(_0x1516c8,_0x7f0ae3){_0x1516c8=_0x1516c8-0x0;var _0x343829=_0x2fa0[_0x1516c8];return _0x343829;};'use strict';var multer=require(_0x02fa('0x0'));var util=require(_0x02fa('0x1'));var path=require(_0x02fa('0x2'));var express=require(_0x02fa('0x3'));var router=express[_0x02fa('0x4')]();var auth=require(_0x02fa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x02fa('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x02fa('0x7')]('/',auth[_0x02fa('0x8')](),controller[_0x02fa('0x9')]);router[_0x02fa('0x7')](_0x02fa('0xa'),auth[_0x02fa('0x8')](),controller[_0x02fa('0xb')]);router[_0x02fa('0x7')](_0x02fa('0xc'),auth[_0x02fa('0x8')](),controller[_0x02fa('0xd')]);router[_0x02fa('0x7')](_0x02fa('0xe'),auth['isAuthenticated'](),controller[_0x02fa('0xf')]);router[_0x02fa('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x02fa('0x10')]);router['get'](_0x02fa('0x11'),auth['isAuthenticated'](),controller[_0x02fa('0x12')]);router[_0x02fa('0x13')]('/',auth[_0x02fa('0x8')](),controller['create']);router[_0x02fa('0x13')](_0x02fa('0x11'),auth[_0x02fa('0x8')](),controller[_0x02fa('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x02fa('0x15')](_0x02fa('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb8a0=['getTags','create','post','setTags','put','delete','exports','path','express','../../components/auth/service','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x36bf1b,_0x1b8bc9){var _0x49c980=function(_0xd2122f){while(--_0xd2122f){_0x36bf1b['push'](_0x36bf1b['shift']());}};_0x49c980(++_0x1b8bc9);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x204ead,_0x320e6a){_0x204ead=_0x204ead-0x0;var _0x48532e=_0xb8a0[_0x204ead];return _0x48532e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b8a('0x0'));var express=require(_0x0b8a('0x1'));var router=express['Router']();var auth=require(_0x0b8a('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0b8a('0x3')](),controller[_0x0b8a('0x4')]);router[_0x0b8a('0x5')](_0x0b8a('0x6'),auth[_0x0b8a('0x3')](),controller[_0x0b8a('0x7')]);router[_0x0b8a('0x5')](_0x0b8a('0x8'),auth[_0x0b8a('0x3')](),controller[_0x0b8a('0x9')]);router[_0x0b8a('0x5')](_0x0b8a('0xa'),auth[_0x0b8a('0x3')](),controller[_0x0b8a('0xb')]);router[_0x0b8a('0x5')](_0x0b8a('0xc'),auth[_0x0b8a('0x3')](),controller[_0x0b8a('0xd')]);router[_0x0b8a('0x5')](_0x0b8a('0xe'),auth[_0x0b8a('0x3')](),controller[_0x0b8a('0xf')]);router['post']('/',auth[_0x0b8a('0x3')](),controller[_0x0b8a('0x10')]);router[_0x0b8a('0x11')](_0x0b8a('0xe'),auth[_0x0b8a('0x3')](),controller[_0x0b8a('0x12')]);router[_0x0b8a('0x13')](_0x0b8a('0x6'),auth[_0x0b8a('0x3')](),controller['update']);router[_0x0b8a('0x14')](_0x0b8a('0x6'),auth[_0x0b8a('0x3')](),controller['destroy']);module[_0x0b8a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 56ea835..e4a1d6d 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 _0xc986=['STRING'];(function(_0x3b69d0,_0x1d899b){var _0x2e7b0e=function(_0x3561ea){while(--_0x3561ea){_0x3b69d0['push'](_0x3b69d0['shift']());}};_0x2e7b0e(++_0x1d899b);}(_0xc986,0x11e));var _0x6c98=function(_0x462f62,_0x2280b1){_0x462f62=_0x462f62-0x0;var _0x214529=_0xc986[_0x462f62];return _0x214529;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6c98('0x0')]},'description':{'type':Sequelize[_0x6c98('0x0')]}}; \ No newline at end of file +var _0x3c21=['STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3c21,0x14b));var _0x13c2=function(_0x156b61,_0x277b89){_0x156b61=_0x156b61-0x0;var _0x3a4d4c=_0x3c21[_0x156b61];return _0x3a4d4c;};'use strict';var Sequelize=require(_0x13c2('0x0'));module[_0x13c2('0x1')]={'name':{'type':Sequelize[_0x13c2('0x2')]},'description':{'type':Sequelize[_0x13c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 79d5dc2..17a019b 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 _0xbdb7=['destroy','name','send','index','ZendeskConfiguration','keys','query','dateStart','dateEnd','filters','intersection','model','fields','length','hasOwnProperty','sort','where','pick','add','day','merge','filter','map','attributes','options','include','findAll','rows','show','rawAttributes','includeAll','body','find','params','ZendeskField','order','getFields','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x5bd5fc,_0x57597){var _0x420110=function(_0x3d99d8){while(--_0x3d99d8){_0x5bd5fc['push'](_0x5bd5fc['shift']());}};_0x420110(++_0x57597);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1238e0,_0x16bd9b){_0x1238e0=_0x1238e0-0x0;var _0x59dfc8=_0xbdb7[_0x1238e0];return _0x59dfc8;};'use strict';var jsonpatch=require(_0x7bdb('0x0'));var rp=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var Mustache=require(_0x7bdb('0x4'));var util=require(_0x7bdb('0x5'));var path=require(_0x7bdb('0x6'));var sox=require(_0x7bdb('0x7'));var csv=require(_0x7bdb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7bdb('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xa'));var deskjs=require(_0x7bdb('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xc'));var qs=require(_0x7bdb('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x7bdb('0xe'));var config=require(_0x7bdb('0xf'));var db=require(_0x7bdb('0x10'))['db'];var jayson=require(_0x7bdb('0x11'));var client=jayson[_0x7bdb('0x12')][_0x7bdb('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x297724,_0x258cc6,_0x5462da,_0x4e5b8e){return new BPromise(function(_0x52b9b9,_0x3053d0){var _0x25e3cb=_0x4e5b8e||client;return _0x25e3cb['request'](_0x297724,_0x5462da)[_0x7bdb('0x14')](function(_0x53021d){logger['info'](_0x7bdb('0x15'),_0x258cc6,_0x7bdb('0x16'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x258cc6,'request\x20sent',JSON[_0x7bdb('0x17')](_0x53021d));if(_0x53021d[_0x7bdb('0x18')]){if(_0x53021d[_0x7bdb('0x18')][_0x7bdb('0x19')]===0x1f4){logger[_0x7bdb('0x18')](_0x7bdb('0x15'),_0x258cc6,_0x53021d[_0x7bdb('0x18')][_0x7bdb('0x1a')]);return _0x3053d0(_0x53021d['error'][_0x7bdb('0x1a')]);}logger[_0x7bdb('0x18')](_0x7bdb('0x15'),_0x258cc6,_0x53021d[_0x7bdb('0x18')]['message']);return _0x52b9b9(_0x53021d[_0x7bdb('0x18')][_0x7bdb('0x1a')]);}else{logger['info'](_0x7bdb('0x15'),_0x258cc6,_0x7bdb('0x16'));_0x52b9b9(_0x53021d[_0x7bdb('0x1b')][_0x7bdb('0x1a')]);}})[_0x7bdb('0x1c')](function(_0x5bfc35){logger['error'](_0x7bdb('0x15'),_0x258cc6,_0x5bfc35);_0x3053d0(_0x5bfc35);});});}function respondWithStatusCode(_0xcb25f2,_0x5daea4){_0x5daea4=_0x5daea4||0xcc;return function(_0x341fe4){if(_0x341fe4){return _0xcb25f2[_0x7bdb('0x1d')](_0x5daea4);}return _0xcb25f2[_0x7bdb('0x1e')](_0x5daea4)[_0x7bdb('0x1f')]();};}function respondWithResult(_0x3a1d0f,_0x4d668e){_0x4d668e=_0x4d668e||0xc8;return function(_0x1d37ac){if(_0x1d37ac){return _0x3a1d0f[_0x7bdb('0x1e')](_0x4d668e)[_0x7bdb('0x20')](_0x1d37ac);}};}function respondWithFilteredResult(_0x3a456f,_0x481f4b){return function(_0x4d6e44){if(_0x4d6e44){var _0x3c423f=_0x4d6e44[_0x7bdb('0x21')],_0x5eface=_0x481f4b['offset'],_0x47abaf=_0x481f4b[_0x7bdb('0x22')]+_0x481f4b[_0x7bdb('0x23')],_0x4a9e02;if(_0x47abaf>=_0x3c423f){_0x47abaf=_0x3c423f;_0x4a9e02=0xc8;}else{_0x4a9e02=0xce;}_0x3a456f[_0x7bdb('0x1e')](_0x4a9e02);return _0x3a456f[_0x7bdb('0x24')](_0x7bdb('0x25'),_0x5eface+'-'+_0x47abaf+'/'+_0x3c423f)['json'](_0x4d6e44);}return null;};}function patchUpdates(_0x10e818){return function(_0x32242d){try{jsonpatch[_0x7bdb('0x26')](_0x32242d,_0x10e818,!![]);}catch(_0xe1141d){return BPromise[_0x7bdb('0x27')](_0xe1141d);}return _0x32242d[_0x7bdb('0x28')]();};}function saveUpdates(_0x1e9996,_0xd2d7be){return function(_0x25a1fe){if(_0x25a1fe){return _0x25a1fe[_0x7bdb('0x29')](_0x1e9996)[_0x7bdb('0x14')](function(_0x81ca6f){return _0x81ca6f;});}return null;};}function removeEntity(_0x5b386d,_0x388a45){return function(_0x23fc3a){if(_0x23fc3a){return _0x23fc3a[_0x7bdb('0x2a')]()[_0x7bdb('0x14')](function(){_0x5b386d[_0x7bdb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28aa2f,_0x43054c){return function(_0x9ac56){if(!_0x9ac56){_0x28aa2f[_0x7bdb('0x1d')](0x194);}return _0x9ac56;};}function handleError(_0x58c6b7,_0x4f43b9){_0x4f43b9=_0x4f43b9||0x1f4;return function(_0x58f45f){logger[_0x7bdb('0x18')](_0x58f45f['stack']);if(_0x58f45f[_0x7bdb('0x2b')]){delete _0x58f45f['name'];}_0x58c6b7[_0x7bdb('0x1e')](_0x4f43b9)[_0x7bdb('0x2c')](_0x58f45f);};}exports[_0x7bdb('0x2d')]=function(_0x4b40a3,_0x2ffdb5){var _0x514713={},_0x532206={},_0x136a02={'count':0x0,'rows':[]};var _0x5611f5=db[_0x7bdb('0x2e')]['rawAttributes'];_0x532206['model']=_[_0x7bdb('0x2f')](_0x5611f5);var _0x353b26={'dateStart':_0x4b40a3[_0x7bdb('0x30')][_0x7bdb('0x31')],'dateEnd':_0x4b40a3[_0x7bdb('0x30')][_0x7bdb('0x32')]};delete _0x4b40a3['query'][_0x7bdb('0x31')];delete _0x4b40a3[_0x7bdb('0x30')][_0x7bdb('0x32')];_0x532206[_0x7bdb('0x30')]=_[_0x7bdb('0x2f')](_0x4b40a3[_0x7bdb('0x30')]);_0x532206[_0x7bdb('0x33')]=_[_0x7bdb('0x34')](_0x532206[_0x7bdb('0x35')],_0x532206['query']);_0x514713['attributes']=_[_0x7bdb('0x34')](_0x532206[_0x7bdb('0x35')],qs[_0x7bdb('0x36')](_0x4b40a3[_0x7bdb('0x30')][_0x7bdb('0x36')]));_0x514713['attributes']=_0x514713['attributes'][_0x7bdb('0x37')]?_0x514713['attributes']:_0x532206[_0x7bdb('0x35')];if(!_0x4b40a3['query'][_0x7bdb('0x38')]('nolimit')){_0x514713['limit']=qs[_0x7bdb('0x23')](_0x4b40a3[_0x7bdb('0x30')][_0x7bdb('0x23')]);_0x514713[_0x7bdb('0x22')]=qs[_0x7bdb('0x22')](_0x4b40a3[_0x7bdb('0x30')][_0x7bdb('0x22')]);}_0x514713['order']=qs['sort'](_0x4b40a3[_0x7bdb('0x30')][_0x7bdb('0x39')]);_0x514713[_0x7bdb('0x3a')]=qs[_0x7bdb('0x33')](_[_0x7bdb('0x3b')](_0x4b40a3[_0x7bdb('0x30')],_0x532206[_0x7bdb('0x33')]));if(_0x353b26['dateStart']){if(_0x353b26['dateEnd']){_0x353b26[_0x7bdb('0x32')]=moment(_0x353b26[_0x7bdb('0x32')])[_0x7bdb('0x3c')](0x1,_0x7bdb('0x3d'));}else{_0x353b26['dateEnd']=moment(_0x353b26[_0x7bdb('0x31')])['add'](0x1,_0x7bdb('0x3d'));}_[_0x7bdb('0x3e')](_0x514713[_0x7bdb('0x3a')],{'createdAt':{'$gte':_0x353b26[_0x7bdb('0x31')],'$lte':_0x353b26[_0x7bdb('0x32')]}});}if(_0x4b40a3[_0x7bdb('0x30')][_0x7bdb('0x3f')]){_0x514713[_0x7bdb('0x3a')]=_[_0x7bdb('0x3e')](_0x514713['where'],{'$or':_[_0x7bdb('0x40')](_0x514713[_0x7bdb('0x41')],function(_0x4fd63c){var _0x7c784={};_0x7c784[_0x4fd63c]={'$like':'%'+_0x4b40a3['query'][_0x7bdb('0x3f')]+'%'};return _0x7c784;})});}_0x514713=_[_0x7bdb('0x3e')]({},_0x514713,_0x4b40a3[_0x7bdb('0x42')]);var _0x3a8415={'where':_0x514713[_0x7bdb('0x3a')]};return db['ZendeskConfiguration'][_0x7bdb('0x21')](_0x3a8415)[_0x7bdb('0x14')](function(_0x12d889){_0x136a02[_0x7bdb('0x21')]=_0x12d889;if(_0x4b40a3[_0x7bdb('0x30')]['includeAll']){_0x514713[_0x7bdb('0x43')]=[{'all':!![]}];}return db[_0x7bdb('0x2e')][_0x7bdb('0x44')](_0x514713);})[_0x7bdb('0x14')](function(_0x259007){_0x136a02[_0x7bdb('0x45')]=_0x259007;return _0x136a02;})[_0x7bdb('0x14')](respondWithFilteredResult(_0x2ffdb5,_0x514713))[_0x7bdb('0x1c')](handleError(_0x2ffdb5,null));};exports[_0x7bdb('0x46')]=function(_0x13b0fd,_0x58e21d){var _0x189cf8={'raw':![],'where':{'id':_0x13b0fd['params']['id']}},_0x58c4bc={};_0x58c4bc[_0x7bdb('0x35')]=_[_0x7bdb('0x2f')](db['ZendeskConfiguration'][_0x7bdb('0x47')]);_0x58c4bc[_0x7bdb('0x30')]=_['keys'](_0x13b0fd['query']);_0x58c4bc['filters']=_[_0x7bdb('0x34')](_0x58c4bc[_0x7bdb('0x35')],_0x58c4bc[_0x7bdb('0x30')]);_0x189cf8[_0x7bdb('0x41')]=_[_0x7bdb('0x34')](_0x58c4bc[_0x7bdb('0x35')],qs[_0x7bdb('0x36')](_0x13b0fd[_0x7bdb('0x30')][_0x7bdb('0x36')]));_0x189cf8[_0x7bdb('0x41')]=_0x189cf8['attributes'][_0x7bdb('0x37')]?_0x189cf8['attributes']:_0x58c4bc[_0x7bdb('0x35')];if(_0x13b0fd[_0x7bdb('0x30')][_0x7bdb('0x48')]){_0x189cf8[_0x7bdb('0x43')]=[{'all':!![]}];}_0x189cf8=_['merge']({},_0x189cf8,_0x13b0fd[_0x7bdb('0x42')]);return db['ZendeskConfiguration']['find'](_0x189cf8)[_0x7bdb('0x14')](handleEntityNotFound(_0x58e21d,null))[_0x7bdb('0x14')](respondWithResult(_0x58e21d,null))['catch'](handleError(_0x58e21d,null));};exports['create']=function(_0x49bb3f,_0x3e574e){return db['ZendeskConfiguration']['create'](_0x49bb3f[_0x7bdb('0x49')],{})[_0x7bdb('0x14')](respondWithResult(_0x3e574e,0xc9))[_0x7bdb('0x1c')](handleError(_0x3e574e,null));};exports[_0x7bdb('0x29')]=function(_0x49c313,_0x1d444c){if(_0x49c313['body']['id']){delete _0x49c313[_0x7bdb('0x49')]['id'];}return db[_0x7bdb('0x2e')][_0x7bdb('0x4a')]({'where':{'id':_0x49c313[_0x7bdb('0x4b')]['id']}})[_0x7bdb('0x14')](handleEntityNotFound(_0x1d444c,null))[_0x7bdb('0x14')](saveUpdates(_0x49c313['body'],null))[_0x7bdb('0x14')](respondWithResult(_0x1d444c,null))[_0x7bdb('0x1c')](handleError(_0x1d444c,null));};exports[_0x7bdb('0x2a')]=function(_0x58658e,_0x2b5493){return db[_0x7bdb('0x2e')]['find']({'where':{'id':_0x58658e[_0x7bdb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b5493,null))[_0x7bdb('0x14')](removeEntity(_0x2b5493,null))[_0x7bdb('0x1c')](handleError(_0x2b5493,null));};exports['getFields']=function(_0x478bbd,_0x21a54f,_0x2a6c5b){var _0x560f54={};var _0x2fa6bb={};var _0x567993;var _0x28eefe;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x478bbd[_0x7bdb('0x4b')]['id']}})[_0x7bdb('0x14')](handleEntityNotFound(_0x21a54f,null))[_0x7bdb('0x14')](function(_0x26f1f5){if(_0x26f1f5){_0x567993=_0x26f1f5;_0x2fa6bb[_0x7bdb('0x35')]=_[_0x7bdb('0x2f')](db[_0x7bdb('0x4c')][_0x7bdb('0x47')]);_0x2fa6bb[_0x7bdb('0x30')]=_[_0x7bdb('0x2f')](_0x478bbd[_0x7bdb('0x30')]);_0x2fa6bb[_0x7bdb('0x33')]=_['intersection'](_0x2fa6bb[_0x7bdb('0x35')],_0x2fa6bb[_0x7bdb('0x30')]);_0x560f54['attributes']=_[_0x7bdb('0x34')](_0x2fa6bb[_0x7bdb('0x35')],qs[_0x7bdb('0x36')](_0x478bbd[_0x7bdb('0x30')][_0x7bdb('0x36')]));_0x560f54['attributes']=_0x560f54[_0x7bdb('0x41')][_0x7bdb('0x37')]?_0x560f54[_0x7bdb('0x41')]:_0x2fa6bb['model'];_0x560f54[_0x7bdb('0x4d')]=qs[_0x7bdb('0x39')](_0x478bbd[_0x7bdb('0x30')][_0x7bdb('0x39')]);_0x560f54[_0x7bdb('0x3a')]=qs[_0x7bdb('0x33')](_[_0x7bdb('0x3b')](_0x478bbd[_0x7bdb('0x30')],_0x2fa6bb[_0x7bdb('0x33')]));if(_0x478bbd['query'][_0x7bdb('0x3f')]){_0x560f54[_0x7bdb('0x3a')]=_[_0x7bdb('0x3e')](_0x560f54[_0x7bdb('0x3a')],{'$or':_[_0x7bdb('0x40')](_0x560f54[_0x7bdb('0x41')],function(_0x22aa65){var _0x86c6ed={};_0x86c6ed[_0x22aa65]={'$like':'%'+_0x478bbd[_0x7bdb('0x30')][_0x7bdb('0x3f')]+'%'};return _0x86c6ed;})});}_0x560f54=_[_0x7bdb('0x3e')]({},_0x560f54,_0x478bbd[_0x7bdb('0x42')]);return _0x567993[_0x7bdb('0x4e')](_0x560f54);}})['then'](function(_0x519127){if(_0x519127){_0x28eefe=_0x519127['length'];if(!_0x478bbd[_0x7bdb('0x30')][_0x7bdb('0x38')](_0x7bdb('0x4f'))){_0x560f54['limit']=qs[_0x7bdb('0x23')](_0x478bbd[_0x7bdb('0x30')]['limit']);_0x560f54[_0x7bdb('0x22')]=qs[_0x7bdb('0x22')](_0x478bbd['query'][_0x7bdb('0x22')]);}return _0x567993[_0x7bdb('0x4e')](_0x560f54);}})['then'](function(_0x291fd3){if(_0x291fd3){return _0x291fd3?{'count':_0x28eefe,'rows':_0x291fd3}:null;}})[_0x7bdb('0x14')](respondWithResult(_0x21a54f,null))['catch'](handleError(_0x21a54f,null));};exports[_0x7bdb('0x50')]=function(_0x2b3f2a,_0x5cfbfb,_0x197682){var _0x5e8b59={};var _0x2935d6={};var _0x25136b;var _0x2ff95c;return db[_0x7bdb('0x2e')][_0x7bdb('0x51')]({'where':{'id':_0x2b3f2a['params']['id']}})['then'](handleEntityNotFound(_0x5cfbfb,null))['then'](function(_0x2a795f){if(_0x2a795f){_0x25136b=_0x2a795f;_0x2935d6['model']=_[_0x7bdb('0x2f')](db[_0x7bdb('0x4c')][_0x7bdb('0x47')]);_0x2935d6['query']=_['keys'](_0x2b3f2a[_0x7bdb('0x30')]);_0x2935d6[_0x7bdb('0x33')]=_[_0x7bdb('0x34')](_0x2935d6[_0x7bdb('0x35')],_0x2935d6['query']);_0x5e8b59[_0x7bdb('0x41')]=_[_0x7bdb('0x34')](_0x2935d6[_0x7bdb('0x35')],qs[_0x7bdb('0x36')](_0x2b3f2a[_0x7bdb('0x30')][_0x7bdb('0x36')]));_0x5e8b59['attributes']=_0x5e8b59[_0x7bdb('0x41')]['length']?_0x5e8b59[_0x7bdb('0x41')]:_0x2935d6['model'];_0x5e8b59[_0x7bdb('0x4d')]=qs[_0x7bdb('0x39')](_0x2b3f2a[_0x7bdb('0x30')][_0x7bdb('0x39')]);_0x5e8b59[_0x7bdb('0x3a')]=qs['filters'](_['pick'](_0x2b3f2a[_0x7bdb('0x30')],_0x2935d6[_0x7bdb('0x33')]));if(_0x2b3f2a['query'][_0x7bdb('0x3f')]){_0x5e8b59[_0x7bdb('0x3a')]=_['merge'](_0x5e8b59[_0x7bdb('0x3a')],{'$or':_[_0x7bdb('0x40')](_0x5e8b59['attributes'],function(_0x40f635){var _0x493c69={};_0x493c69[_0x40f635]={'$like':'%'+_0x2b3f2a['query'][_0x7bdb('0x3f')]+'%'};return _0x493c69;})});}_0x5e8b59=_[_0x7bdb('0x3e')]({},_0x5e8b59,_0x2b3f2a['options']);return _0x25136b['getSubjects'](_0x5e8b59);}})[_0x7bdb('0x14')](function(_0x566a9e){if(_0x566a9e){_0x2ff95c=_0x566a9e[_0x7bdb('0x37')];if(!_0x2b3f2a['query'][_0x7bdb('0x38')](_0x7bdb('0x4f'))){_0x5e8b59[_0x7bdb('0x23')]=qs[_0x7bdb('0x23')](_0x2b3f2a['query'][_0x7bdb('0x23')]);_0x5e8b59[_0x7bdb('0x22')]=qs['offset'](_0x2b3f2a[_0x7bdb('0x30')][_0x7bdb('0x22')]);}return _0x25136b['getSubjects'](_0x5e8b59);}})[_0x7bdb('0x14')](function(_0x19e6c4){if(_0x19e6c4){return _0x19e6c4?{'count':_0x2ff95c,'rows':_0x19e6c4}:null;}})[_0x7bdb('0x14')](respondWithResult(_0x5cfbfb,null))[_0x7bdb('0x1c')](handleError(_0x5cfbfb,null));};exports['getDescriptions']=function(_0x324285,_0x5af736,_0x13f48d){var _0x3b4583={};var _0x3dd0b0={};var _0x4fc2d0;var _0xdd73f5;return db[_0x7bdb('0x2e')][_0x7bdb('0x51')]({'where':{'id':_0x324285[_0x7bdb('0x4b')]['id']}})[_0x7bdb('0x14')](handleEntityNotFound(_0x5af736,null))[_0x7bdb('0x14')](function(_0x40084d){if(_0x40084d){_0x4fc2d0=_0x40084d;_0x3dd0b0[_0x7bdb('0x35')]=_[_0x7bdb('0x2f')](db[_0x7bdb('0x4c')][_0x7bdb('0x47')]);_0x3dd0b0[_0x7bdb('0x30')]=_[_0x7bdb('0x2f')](_0x324285[_0x7bdb('0x30')]);_0x3dd0b0[_0x7bdb('0x33')]=_[_0x7bdb('0x34')](_0x3dd0b0[_0x7bdb('0x35')],_0x3dd0b0[_0x7bdb('0x30')]);_0x3b4583['attributes']=_[_0x7bdb('0x34')](_0x3dd0b0[_0x7bdb('0x35')],qs[_0x7bdb('0x36')](_0x324285[_0x7bdb('0x30')][_0x7bdb('0x36')]));_0x3b4583[_0x7bdb('0x41')]=_0x3b4583[_0x7bdb('0x41')][_0x7bdb('0x37')]?_0x3b4583[_0x7bdb('0x41')]:_0x3dd0b0[_0x7bdb('0x35')];_0x3b4583[_0x7bdb('0x4d')]=qs['sort'](_0x324285['query']['sort']);_0x3b4583[_0x7bdb('0x3a')]=qs[_0x7bdb('0x33')](_['pick'](_0x324285[_0x7bdb('0x30')],_0x3dd0b0[_0x7bdb('0x33')]));if(_0x324285['query']['filter']){_0x3b4583['where']=_[_0x7bdb('0x3e')](_0x3b4583['where'],{'$or':_['map'](_0x3b4583['attributes'],function(_0x407b7b){var _0x32419c={};_0x32419c[_0x407b7b]={'$like':'%'+_0x324285[_0x7bdb('0x30')]['filter']+'%'};return _0x32419c;})});}_0x3b4583=_[_0x7bdb('0x3e')]({},_0x3b4583,_0x324285[_0x7bdb('0x42')]);return _0x4fc2d0[_0x7bdb('0x52')](_0x3b4583);}})[_0x7bdb('0x14')](function(_0x4b3258){if(_0x4b3258){_0xdd73f5=_0x4b3258[_0x7bdb('0x37')];if(!_0x324285['query'][_0x7bdb('0x38')](_0x7bdb('0x4f'))){_0x3b4583[_0x7bdb('0x23')]=qs['limit'](_0x324285[_0x7bdb('0x30')][_0x7bdb('0x23')]);_0x3b4583[_0x7bdb('0x22')]=qs['offset'](_0x324285[_0x7bdb('0x30')][_0x7bdb('0x22')]);}return _0x4fc2d0['getDescriptions'](_0x3b4583);}})[_0x7bdb('0x14')](function(_0x1d8199){if(_0x1d8199){return _0x1d8199?{'count':_0xdd73f5,'rows':_0x1d8199}:null;}})['then'](respondWithResult(_0x5af736,null))[_0x7bdb('0x1c')](handleError(_0x5af736,null));};exports[_0x7bdb('0x53')]=function(_0x5d6ca3,_0x1fef3e,_0x1054f1){var _0x4ce4d8={};var _0x3f3336={};var _0x4dcc3e;var _0x31b62e;return db[_0x7bdb('0x2e')][_0x7bdb('0x51')]({'where':{'id':_0x5d6ca3['params']['id']}})[_0x7bdb('0x14')](handleEntityNotFound(_0x1fef3e,null))['then'](function(_0x3427c4){if(_0x3427c4){_0x4dcc3e=_0x3427c4;_0x3f3336['model']=_[_0x7bdb('0x2f')](db[_0x7bdb('0x54')][_0x7bdb('0x47')]);_0x3f3336[_0x7bdb('0x30')]=_[_0x7bdb('0x2f')](_0x5d6ca3['query']);_0x3f3336['filters']=_[_0x7bdb('0x34')](_0x3f3336[_0x7bdb('0x35')],_0x3f3336[_0x7bdb('0x30')]);_0x4ce4d8[_0x7bdb('0x41')]=_['intersection'](_0x3f3336[_0x7bdb('0x35')],qs[_0x7bdb('0x36')](_0x5d6ca3['query'][_0x7bdb('0x36')]));_0x4ce4d8[_0x7bdb('0x41')]=_0x4ce4d8['attributes'][_0x7bdb('0x37')]?_0x4ce4d8[_0x7bdb('0x41')]:_0x3f3336[_0x7bdb('0x35')];_0x4ce4d8[_0x7bdb('0x4d')]=qs[_0x7bdb('0x39')](_0x5d6ca3[_0x7bdb('0x30')][_0x7bdb('0x39')]);_0x4ce4d8[_0x7bdb('0x3a')]=qs['filters'](_['pick'](_0x5d6ca3[_0x7bdb('0x30')],_0x3f3336[_0x7bdb('0x33')]));if(_0x5d6ca3[_0x7bdb('0x30')][_0x7bdb('0x3f')]){_0x4ce4d8[_0x7bdb('0x3a')]=_[_0x7bdb('0x3e')](_0x4ce4d8['where'],{'$or':_[_0x7bdb('0x40')](_0x4ce4d8[_0x7bdb('0x41')],function(_0x2f30f7){var _0x120d36={};_0x120d36[_0x2f30f7]={'$like':'%'+_0x5d6ca3['query'][_0x7bdb('0x3f')]+'%'};return _0x120d36;})});}_0x4ce4d8=_[_0x7bdb('0x3e')]({},_0x4ce4d8,_0x5d6ca3['options']);return _0x4dcc3e[_0x7bdb('0x53')](_0x4ce4d8);}})[_0x7bdb('0x14')](function(_0x24b701){if(_0x24b701){_0x31b62e=_0x24b701['length'];if(!_0x5d6ca3['query'][_0x7bdb('0x38')]('nolimit')){_0x4ce4d8['limit']=qs[_0x7bdb('0x23')](_0x5d6ca3['query'][_0x7bdb('0x23')]);_0x4ce4d8['offset']=qs['offset'](_0x5d6ca3[_0x7bdb('0x30')]['offset']);}return _0x4dcc3e[_0x7bdb('0x53')](_0x4ce4d8);}})[_0x7bdb('0x14')](function(_0x55805d){if(_0x55805d){return _0x55805d?{'count':_0x31b62e,'rows':_0x55805d}:null;}})[_0x7bdb('0x14')](respondWithResult(_0x1fef3e,null))[_0x7bdb('0x1c')](handleError(_0x1fef3e,null));};exports[_0x7bdb('0x55')]=function(_0x3edace,_0x489a79,_0x1a263d){if(_0x3edace['body']['id']){delete _0x3edace[_0x7bdb('0x49')]['id'];}return db[_0x7bdb('0x2e')][_0x7bdb('0x51')]({'where':{'id':_0x3edace[_0x7bdb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x489a79,null))['then'](function(_0x200386){if(_0x200386){return _0x200386[_0x7bdb('0x55')](_0x3edace[_0x7bdb('0x49')]['ids']||[]);}return null;})[_0x7bdb('0x14')](respondWithResult(_0x489a79,null))[_0x7bdb('0x1c')](handleError(_0x489a79,null));}; \ No newline at end of file +var _0xe511=['find','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','index','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','add','day','merge','map','filter','options','ZendeskConfiguration','count','include','findAll','rows','show','params','includeAll','create','body'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xe511,0x16f));var _0x1e51=function(_0x4c88f2,_0x1a907a){_0x4c88f2=_0x4c88f2-0x0;var _0x21998c=_0xe511[_0x4c88f2];return _0x21998c;};'use strict';var jsonpatch=require(_0x1e51('0x0'));var rp=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var Mustache=require('mustache');var util=require(_0x1e51('0x3'));var path=require(_0x1e51('0x4'));var sox=require('sox');var csv=require(_0x1e51('0x5'));var ejs=require(_0x1e51('0x6'));var fs=require('fs');var _=require(_0x1e51('0x7'));var squel=require(_0x1e51('0x8'));var crypto=require('crypto');var jsforce=require(_0x1e51('0x9'));var deskjs=require(_0x1e51('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xb'));var qs=require(_0x1e51('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x1e51('0xd'));var config=require(_0x1e51('0xe'));var db=require(_0x1e51('0xf'))['db'];var jayson=require(_0x1e51('0x10'));var client=jayson[_0x1e51('0x11')][_0x1e51('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x4dc7f1,_0x25437c,_0xcdfa5d,_0x3350bb){return new BPromise(function(_0x2ea35d,_0x34ad70){var _0x3c5330=_0x3350bb||client;return _0x3c5330['request'](_0x4dc7f1,_0xcdfa5d)[_0x1e51('0x13')](function(_0x102f01){logger[_0x1e51('0x14')](_0x1e51('0x15'),_0x25437c,_0x1e51('0x16'));logger[_0x1e51('0x17')](_0x1e51('0x18'),_0x25437c,_0x1e51('0x16'),JSON[_0x1e51('0x19')](_0x102f01));if(_0x102f01[_0x1e51('0x1a')]){if(_0x102f01['error'][_0x1e51('0x1b')]===0x1f4){logger[_0x1e51('0x1a')](_0x1e51('0x15'),_0x25437c,_0x102f01['error'][_0x1e51('0x1c')]);return _0x34ad70(_0x102f01['error']['message']);}logger[_0x1e51('0x1a')](_0x1e51('0x15'),_0x25437c,_0x102f01[_0x1e51('0x1a')][_0x1e51('0x1c')]);return _0x2ea35d(_0x102f01[_0x1e51('0x1a')][_0x1e51('0x1c')]);}else{logger['info'](_0x1e51('0x15'),_0x25437c,'request\x20sent');_0x2ea35d(_0x102f01[_0x1e51('0x1d')][_0x1e51('0x1c')]);}})[_0x1e51('0x1e')](function(_0x183a95){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x25437c,_0x183a95);_0x34ad70(_0x183a95);});});}function respondWithStatusCode(_0x4e6a49,_0x548c32){_0x548c32=_0x548c32||0xcc;return function(_0x1aec4f){if(_0x1aec4f){return _0x4e6a49['sendStatus'](_0x548c32);}return _0x4e6a49[_0x1e51('0x1f')](_0x548c32)[_0x1e51('0x20')]();};}function respondWithResult(_0x415154,_0x13240f){_0x13240f=_0x13240f||0xc8;return function(_0x23c85a){if(_0x23c85a){return _0x415154[_0x1e51('0x1f')](_0x13240f)[_0x1e51('0x21')](_0x23c85a);}};}function respondWithFilteredResult(_0x461d3d,_0x4bcdd3){return function(_0x4d04c0){if(_0x4d04c0){var _0x43f5c5=_0x4d04c0['count'],_0xdf6c02=_0x4bcdd3['offset'],_0x2e42b1=_0x4bcdd3['offset']+_0x4bcdd3[_0x1e51('0x22')],_0x1386db;if(_0x2e42b1>=_0x43f5c5){_0x2e42b1=_0x43f5c5;_0x1386db=0xc8;}else{_0x1386db=0xce;}_0x461d3d[_0x1e51('0x1f')](_0x1386db);return _0x461d3d[_0x1e51('0x23')]('Content-Range',_0xdf6c02+'-'+_0x2e42b1+'/'+_0x43f5c5)[_0x1e51('0x21')](_0x4d04c0);}return null;};}function patchUpdates(_0x49c507){return function(_0x5eccee){try{jsonpatch[_0x1e51('0x24')](_0x5eccee,_0x49c507,!![]);}catch(_0x5c5bbd){return BPromise[_0x1e51('0x25')](_0x5c5bbd);}return _0x5eccee[_0x1e51('0x26')]();};}function saveUpdates(_0x56722f,_0x3e6ef2){return function(_0x10ee23){if(_0x10ee23){return _0x10ee23[_0x1e51('0x27')](_0x56722f)[_0x1e51('0x13')](function(_0x52538c){return _0x52538c;});}return null;};}function removeEntity(_0x4cf046,_0x4f67d3){return function(_0x20eb9b){if(_0x20eb9b){return _0x20eb9b[_0x1e51('0x28')]()[_0x1e51('0x13')](function(){_0x4cf046[_0x1e51('0x1f')](0xcc)[_0x1e51('0x20')]();});}};}function handleEntityNotFound(_0x27d9a2,_0x378206){return function(_0x34701c){if(!_0x34701c){_0x27d9a2[_0x1e51('0x29')](0x194);}return _0x34701c;};}function handleError(_0x3167b6,_0x27b550){_0x27b550=_0x27b550||0x1f4;return function(_0x54c84e){logger[_0x1e51('0x1a')](_0x54c84e[_0x1e51('0x2a')]);if(_0x54c84e[_0x1e51('0x2b')]){delete _0x54c84e[_0x1e51('0x2b')];}_0x3167b6[_0x1e51('0x1f')](_0x27b550)['send'](_0x54c84e);};}exports[_0x1e51('0x2c')]=function(_0x5647c0,_0x2a7b70){var _0x3fb57e={},_0x1fbd06={},_0x59f405={'count':0x0,'rows':[]};var _0x3e3742=db['ZendeskConfiguration'][_0x1e51('0x2d')];_0x1fbd06['model']=_['keys'](_0x3e3742);var _0x463afa={'dateStart':_0x5647c0[_0x1e51('0x2e')][_0x1e51('0x2f')],'dateEnd':_0x5647c0['query'][_0x1e51('0x30')]};delete _0x5647c0['query'][_0x1e51('0x2f')];delete _0x5647c0[_0x1e51('0x2e')]['dateEnd'];_0x1fbd06[_0x1e51('0x2e')]=_[_0x1e51('0x31')](_0x5647c0[_0x1e51('0x2e')]);_0x1fbd06[_0x1e51('0x32')]=_[_0x1e51('0x33')](_0x1fbd06[_0x1e51('0x34')],_0x1fbd06['query']);_0x3fb57e['attributes']=_[_0x1e51('0x33')](_0x1fbd06['model'],qs[_0x1e51('0x35')](_0x5647c0[_0x1e51('0x2e')][_0x1e51('0x35')]));_0x3fb57e[_0x1e51('0x36')]=_0x3fb57e[_0x1e51('0x36')][_0x1e51('0x37')]?_0x3fb57e[_0x1e51('0x36')]:_0x1fbd06[_0x1e51('0x34')];if(!_0x5647c0[_0x1e51('0x2e')][_0x1e51('0x38')](_0x1e51('0x39'))){_0x3fb57e['limit']=qs[_0x1e51('0x22')](_0x5647c0['query'][_0x1e51('0x22')]);_0x3fb57e[_0x1e51('0x3a')]=qs[_0x1e51('0x3a')](_0x5647c0[_0x1e51('0x2e')][_0x1e51('0x3a')]);}_0x3fb57e[_0x1e51('0x3b')]=qs[_0x1e51('0x3c')](_0x5647c0[_0x1e51('0x2e')][_0x1e51('0x3c')]);_0x3fb57e[_0x1e51('0x3d')]=qs[_0x1e51('0x32')](_['pick'](_0x5647c0['query'],_0x1fbd06[_0x1e51('0x32')]));if(_0x463afa[_0x1e51('0x2f')]){if(_0x463afa[_0x1e51('0x30')]){_0x463afa[_0x1e51('0x30')]=moment(_0x463afa[_0x1e51('0x30')])[_0x1e51('0x3e')](0x1,_0x1e51('0x3f'));}else{_0x463afa[_0x1e51('0x30')]=moment(_0x463afa['dateStart'])[_0x1e51('0x3e')](0x1,_0x1e51('0x3f'));}_[_0x1e51('0x40')](_0x3fb57e[_0x1e51('0x3d')],{'createdAt':{'$gte':_0x463afa[_0x1e51('0x2f')],'$lte':_0x463afa[_0x1e51('0x30')]}});}if(_0x5647c0[_0x1e51('0x2e')]['filter']){_0x3fb57e[_0x1e51('0x3d')]=_[_0x1e51('0x40')](_0x3fb57e['where'],{'$or':_[_0x1e51('0x41')](_0x3fb57e[_0x1e51('0x36')],function(_0x2b7a25){var _0x507d0c={};_0x507d0c[_0x2b7a25]={'$like':'%'+_0x5647c0[_0x1e51('0x2e')][_0x1e51('0x42')]+'%'};return _0x507d0c;})});}_0x3fb57e=_[_0x1e51('0x40')]({},_0x3fb57e,_0x5647c0[_0x1e51('0x43')]);var _0x3c96a5={'where':_0x3fb57e[_0x1e51('0x3d')]};return db[_0x1e51('0x44')][_0x1e51('0x45')](_0x3c96a5)[_0x1e51('0x13')](function(_0x551ca4){_0x59f405[_0x1e51('0x45')]=_0x551ca4;if(_0x5647c0[_0x1e51('0x2e')]['includeAll']){_0x3fb57e[_0x1e51('0x46')]=[{'all':!![]}];}return db[_0x1e51('0x44')][_0x1e51('0x47')](_0x3fb57e);})['then'](function(_0x44468a){_0x59f405[_0x1e51('0x48')]=_0x44468a;return _0x59f405;})[_0x1e51('0x13')](respondWithFilteredResult(_0x2a7b70,_0x3fb57e))['catch'](handleError(_0x2a7b70,null));};exports[_0x1e51('0x49')]=function(_0x52e7da,_0x581f7a){var _0x54688b={'raw':![],'where':{'id':_0x52e7da[_0x1e51('0x4a')]['id']}},_0x169e6c={};_0x169e6c['model']=_['keys'](db[_0x1e51('0x44')][_0x1e51('0x2d')]);_0x169e6c[_0x1e51('0x2e')]=_[_0x1e51('0x31')](_0x52e7da[_0x1e51('0x2e')]);_0x169e6c[_0x1e51('0x32')]=_['intersection'](_0x169e6c[_0x1e51('0x34')],_0x169e6c['query']);_0x54688b[_0x1e51('0x36')]=_[_0x1e51('0x33')](_0x169e6c['model'],qs['fields'](_0x52e7da['query'][_0x1e51('0x35')]));_0x54688b[_0x1e51('0x36')]=_0x54688b[_0x1e51('0x36')]['length']?_0x54688b[_0x1e51('0x36')]:_0x169e6c[_0x1e51('0x34')];if(_0x52e7da[_0x1e51('0x2e')][_0x1e51('0x4b')]){_0x54688b[_0x1e51('0x46')]=[{'all':!![]}];}_0x54688b=_[_0x1e51('0x40')]({},_0x54688b,_0x52e7da[_0x1e51('0x43')]);return db[_0x1e51('0x44')]['find'](_0x54688b)[_0x1e51('0x13')](handleEntityNotFound(_0x581f7a,null))[_0x1e51('0x13')](respondWithResult(_0x581f7a,null))[_0x1e51('0x1e')](handleError(_0x581f7a,null));};exports[_0x1e51('0x4c')]=function(_0x177b63,_0x2a88db){return db['ZendeskConfiguration'][_0x1e51('0x4c')](_0x177b63['body'],{})['then'](respondWithResult(_0x2a88db,0xc9))['catch'](handleError(_0x2a88db,null));};exports[_0x1e51('0x27')]=function(_0xfbc40f,_0x4b2046){if(_0xfbc40f['body']['id']){delete _0xfbc40f[_0x1e51('0x4d')]['id'];}return db[_0x1e51('0x44')][_0x1e51('0x4e')]({'where':{'id':_0xfbc40f['params']['id']}})[_0x1e51('0x13')](handleEntityNotFound(_0x4b2046,null))[_0x1e51('0x13')](saveUpdates(_0xfbc40f[_0x1e51('0x4d')],null))['then'](respondWithResult(_0x4b2046,null))[_0x1e51('0x1e')](handleError(_0x4b2046,null));};exports[_0x1e51('0x28')]=function(_0x175aa0,_0x30ee67){return db[_0x1e51('0x44')][_0x1e51('0x4e')]({'where':{'id':_0x175aa0[_0x1e51('0x4a')]['id']}})[_0x1e51('0x13')](handleEntityNotFound(_0x30ee67,null))['then'](removeEntity(_0x30ee67,null))[_0x1e51('0x1e')](handleError(_0x30ee67,null));};exports[_0x1e51('0x4f')]=function(_0x48848f,_0x5a9d2a,_0x577b19){var _0xa39f42={};var _0x686433={};var _0x2ffd82;var _0x3bdf55;return db[_0x1e51('0x44')][_0x1e51('0x50')]({'where':{'id':_0x48848f[_0x1e51('0x4a')]['id']}})[_0x1e51('0x13')](handleEntityNotFound(_0x5a9d2a,null))[_0x1e51('0x13')](function(_0x47a961){if(_0x47a961){_0x2ffd82=_0x47a961;_0x686433['model']=_['keys'](db[_0x1e51('0x51')][_0x1e51('0x2d')]);_0x686433['query']=_['keys'](_0x48848f[_0x1e51('0x2e')]);_0x686433[_0x1e51('0x32')]=_['intersection'](_0x686433[_0x1e51('0x34')],_0x686433[_0x1e51('0x2e')]);_0xa39f42[_0x1e51('0x36')]=_[_0x1e51('0x33')](_0x686433[_0x1e51('0x34')],qs[_0x1e51('0x35')](_0x48848f[_0x1e51('0x2e')][_0x1e51('0x35')]));_0xa39f42[_0x1e51('0x36')]=_0xa39f42[_0x1e51('0x36')]['length']?_0xa39f42[_0x1e51('0x36')]:_0x686433[_0x1e51('0x34')];_0xa39f42[_0x1e51('0x3b')]=qs[_0x1e51('0x3c')](_0x48848f[_0x1e51('0x2e')][_0x1e51('0x3c')]);_0xa39f42['where']=qs['filters'](_[_0x1e51('0x52')](_0x48848f[_0x1e51('0x2e')],_0x686433[_0x1e51('0x32')]));if(_0x48848f[_0x1e51('0x2e')]['filter']){_0xa39f42['where']=_['merge'](_0xa39f42[_0x1e51('0x3d')],{'$or':_[_0x1e51('0x41')](_0xa39f42[_0x1e51('0x36')],function(_0x6a91b9){var _0x184665={};_0x184665[_0x6a91b9]={'$like':'%'+_0x48848f['query'][_0x1e51('0x42')]+'%'};return _0x184665;})});}_0xa39f42=_[_0x1e51('0x40')]({},_0xa39f42,_0x48848f[_0x1e51('0x43')]);return _0x2ffd82['getFields'](_0xa39f42);}})[_0x1e51('0x13')](function(_0x77f0c1){if(_0x77f0c1){_0x3bdf55=_0x77f0c1[_0x1e51('0x37')];if(!_0x48848f['query'][_0x1e51('0x38')](_0x1e51('0x39'))){_0xa39f42['limit']=qs['limit'](_0x48848f[_0x1e51('0x2e')]['limit']);_0xa39f42[_0x1e51('0x3a')]=qs['offset'](_0x48848f[_0x1e51('0x2e')][_0x1e51('0x3a')]);}return _0x2ffd82[_0x1e51('0x4f')](_0xa39f42);}})[_0x1e51('0x13')](function(_0x5142ed){if(_0x5142ed){return _0x5142ed?{'count':_0x3bdf55,'rows':_0x5142ed}:null;}})[_0x1e51('0x13')](respondWithResult(_0x5a9d2a,null))['catch'](handleError(_0x5a9d2a,null));};exports['getSubjects']=function(_0xa31c12,_0x34ae65,_0x4aa76d){var _0x4e69b5={};var _0x1fc580={};var _0x25ce1d;var _0x15f15b;return db[_0x1e51('0x44')]['findOne']({'where':{'id':_0xa31c12[_0x1e51('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34ae65,null))['then'](function(_0x281e2e){if(_0x281e2e){_0x25ce1d=_0x281e2e;_0x1fc580['model']=_[_0x1e51('0x31')](db['ZendeskField'][_0x1e51('0x2d')]);_0x1fc580['query']=_[_0x1e51('0x31')](_0xa31c12[_0x1e51('0x2e')]);_0x1fc580['filters']=_[_0x1e51('0x33')](_0x1fc580['model'],_0x1fc580[_0x1e51('0x2e')]);_0x4e69b5[_0x1e51('0x36')]=_[_0x1e51('0x33')](_0x1fc580[_0x1e51('0x34')],qs[_0x1e51('0x35')](_0xa31c12[_0x1e51('0x2e')]['fields']));_0x4e69b5[_0x1e51('0x36')]=_0x4e69b5['attributes']['length']?_0x4e69b5[_0x1e51('0x36')]:_0x1fc580[_0x1e51('0x34')];_0x4e69b5[_0x1e51('0x3b')]=qs[_0x1e51('0x3c')](_0xa31c12[_0x1e51('0x2e')][_0x1e51('0x3c')]);_0x4e69b5[_0x1e51('0x3d')]=qs['filters'](_[_0x1e51('0x52')](_0xa31c12[_0x1e51('0x2e')],_0x1fc580[_0x1e51('0x32')]));if(_0xa31c12['query']['filter']){_0x4e69b5[_0x1e51('0x3d')]=_[_0x1e51('0x40')](_0x4e69b5['where'],{'$or':_[_0x1e51('0x41')](_0x4e69b5[_0x1e51('0x36')],function(_0x5e11f8){var _0x5eb939={};_0x5eb939[_0x5e11f8]={'$like':'%'+_0xa31c12[_0x1e51('0x2e')][_0x1e51('0x42')]+'%'};return _0x5eb939;})});}_0x4e69b5=_[_0x1e51('0x40')]({},_0x4e69b5,_0xa31c12[_0x1e51('0x43')]);return _0x25ce1d[_0x1e51('0x53')](_0x4e69b5);}})[_0x1e51('0x13')](function(_0x3718d9){if(_0x3718d9){_0x15f15b=_0x3718d9['length'];if(!_0xa31c12['query'][_0x1e51('0x38')](_0x1e51('0x39'))){_0x4e69b5['limit']=qs[_0x1e51('0x22')](_0xa31c12[_0x1e51('0x2e')]['limit']);_0x4e69b5[_0x1e51('0x3a')]=qs['offset'](_0xa31c12[_0x1e51('0x2e')]['offset']);}return _0x25ce1d['getSubjects'](_0x4e69b5);}})['then'](function(_0x4c4902){if(_0x4c4902){return _0x4c4902?{'count':_0x15f15b,'rows':_0x4c4902}:null;}})['then'](respondWithResult(_0x34ae65,null))['catch'](handleError(_0x34ae65,null));};exports[_0x1e51('0x54')]=function(_0x5aa741,_0xd05f32,_0x5682a6){var _0x45d3b1={};var _0x2ff3e5={};var _0xbb6872;var _0x52d0ca;return db[_0x1e51('0x44')][_0x1e51('0x50')]({'where':{'id':_0x5aa741['params']['id']}})[_0x1e51('0x13')](handleEntityNotFound(_0xd05f32,null))['then'](function(_0x101bb9){if(_0x101bb9){_0xbb6872=_0x101bb9;_0x2ff3e5['model']=_[_0x1e51('0x31')](db[_0x1e51('0x51')][_0x1e51('0x2d')]);_0x2ff3e5[_0x1e51('0x2e')]=_[_0x1e51('0x31')](_0x5aa741[_0x1e51('0x2e')]);_0x2ff3e5['filters']=_[_0x1e51('0x33')](_0x2ff3e5['model'],_0x2ff3e5[_0x1e51('0x2e')]);_0x45d3b1[_0x1e51('0x36')]=_[_0x1e51('0x33')](_0x2ff3e5[_0x1e51('0x34')],qs['fields'](_0x5aa741['query']['fields']));_0x45d3b1[_0x1e51('0x36')]=_0x45d3b1[_0x1e51('0x36')][_0x1e51('0x37')]?_0x45d3b1[_0x1e51('0x36')]:_0x2ff3e5['model'];_0x45d3b1[_0x1e51('0x3b')]=qs['sort'](_0x5aa741[_0x1e51('0x2e')]['sort']);_0x45d3b1['where']=qs[_0x1e51('0x32')](_[_0x1e51('0x52')](_0x5aa741['query'],_0x2ff3e5[_0x1e51('0x32')]));if(_0x5aa741['query'][_0x1e51('0x42')]){_0x45d3b1['where']=_[_0x1e51('0x40')](_0x45d3b1[_0x1e51('0x3d')],{'$or':_['map'](_0x45d3b1[_0x1e51('0x36')],function(_0x58688d){var _0x284348={};_0x284348[_0x58688d]={'$like':'%'+_0x5aa741[_0x1e51('0x2e')][_0x1e51('0x42')]+'%'};return _0x284348;})});}_0x45d3b1=_[_0x1e51('0x40')]({},_0x45d3b1,_0x5aa741['options']);return _0xbb6872[_0x1e51('0x54')](_0x45d3b1);}})[_0x1e51('0x13')](function(_0x4698b1){if(_0x4698b1){_0x52d0ca=_0x4698b1['length'];if(!_0x5aa741['query'][_0x1e51('0x38')](_0x1e51('0x39'))){_0x45d3b1[_0x1e51('0x22')]=qs['limit'](_0x5aa741['query']['limit']);_0x45d3b1[_0x1e51('0x3a')]=qs[_0x1e51('0x3a')](_0x5aa741[_0x1e51('0x2e')]['offset']);}return _0xbb6872[_0x1e51('0x54')](_0x45d3b1);}})[_0x1e51('0x13')](function(_0x5be760){if(_0x5be760){return _0x5be760?{'count':_0x52d0ca,'rows':_0x5be760}:null;}})[_0x1e51('0x13')](respondWithResult(_0xd05f32,null))[_0x1e51('0x1e')](handleError(_0xd05f32,null));};exports[_0x1e51('0x55')]=function(_0x4af474,_0x2c17fb,_0x5d1484){var _0x2fb48b={};var _0x2c84a3={};var _0x3525dc;var _0x471b01;return db[_0x1e51('0x44')][_0x1e51('0x50')]({'where':{'id':_0x4af474[_0x1e51('0x4a')]['id']}})[_0x1e51('0x13')](handleEntityNotFound(_0x2c17fb,null))[_0x1e51('0x13')](function(_0x5a6e2f){if(_0x5a6e2f){_0x3525dc=_0x5a6e2f;_0x2c84a3[_0x1e51('0x34')]=_['keys'](db[_0x1e51('0x56')]['rawAttributes']);_0x2c84a3[_0x1e51('0x2e')]=_[_0x1e51('0x31')](_0x4af474[_0x1e51('0x2e')]);_0x2c84a3[_0x1e51('0x32')]=_[_0x1e51('0x33')](_0x2c84a3[_0x1e51('0x34')],_0x2c84a3[_0x1e51('0x2e')]);_0x2fb48b[_0x1e51('0x36')]=_[_0x1e51('0x33')](_0x2c84a3['model'],qs[_0x1e51('0x35')](_0x4af474[_0x1e51('0x2e')][_0x1e51('0x35')]));_0x2fb48b['attributes']=_0x2fb48b[_0x1e51('0x36')][_0x1e51('0x37')]?_0x2fb48b[_0x1e51('0x36')]:_0x2c84a3['model'];_0x2fb48b[_0x1e51('0x3b')]=qs[_0x1e51('0x3c')](_0x4af474[_0x1e51('0x2e')][_0x1e51('0x3c')]);_0x2fb48b[_0x1e51('0x3d')]=qs['filters'](_['pick'](_0x4af474[_0x1e51('0x2e')],_0x2c84a3['filters']));if(_0x4af474['query'][_0x1e51('0x42')]){_0x2fb48b[_0x1e51('0x3d')]=_[_0x1e51('0x40')](_0x2fb48b[_0x1e51('0x3d')],{'$or':_[_0x1e51('0x41')](_0x2fb48b[_0x1e51('0x36')],function(_0x2a8842){var _0x38b0bd={};_0x38b0bd[_0x2a8842]={'$like':'%'+_0x4af474[_0x1e51('0x2e')]['filter']+'%'};return _0x38b0bd;})});}_0x2fb48b=_[_0x1e51('0x40')]({},_0x2fb48b,_0x4af474[_0x1e51('0x43')]);return _0x3525dc[_0x1e51('0x55')](_0x2fb48b);}})['then'](function(_0x5e3a9a){if(_0x5e3a9a){_0x471b01=_0x5e3a9a[_0x1e51('0x37')];if(!_0x4af474[_0x1e51('0x2e')]['hasOwnProperty'](_0x1e51('0x39'))){_0x2fb48b[_0x1e51('0x22')]=qs['limit'](_0x4af474[_0x1e51('0x2e')][_0x1e51('0x22')]);_0x2fb48b[_0x1e51('0x3a')]=qs['offset'](_0x4af474[_0x1e51('0x2e')][_0x1e51('0x3a')]);}return _0x3525dc[_0x1e51('0x55')](_0x2fb48b);}})[_0x1e51('0x13')](function(_0x37a434){if(_0x37a434){return _0x37a434?{'count':_0x471b01,'rows':_0x37a434}:null;}})[_0x1e51('0x13')](respondWithResult(_0x2c17fb,null))[_0x1e51('0x1e')](handleError(_0x2c17fb,null));};exports[_0x1e51('0x57')]=function(_0x1a8903,_0x401702,_0x5002e6){if(_0x1a8903['body']['id']){delete _0x1a8903[_0x1e51('0x4d')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1a8903['params']['id']}})[_0x1e51('0x13')](handleEntityNotFound(_0x401702,null))['then'](function(_0x159c58){if(_0x159c58){return _0x159c58['setTags'](_0x1a8903[_0x1e51('0x4d')][_0x1e51('0x58')]||[]);}return null;})['then'](respondWithResult(_0x401702,null))[_0x1e51('0x1e')](handleError(_0x401702,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 449d8d9..2e32ffa 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 _0x380b=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZendeskConfiguration.attributes','define'];(function(_0x5e54b5,_0x3d8a50){var _0x345d1d=function(_0xe23b4){while(--_0xe23b4){_0x5e54b5['push'](_0x5e54b5['shift']());}};_0x345d1d(++_0x3d8a50);}(_0x380b,0xde));var _0xb380=function(_0x354eb9,_0x2c9574){_0x354eb9=_0x354eb9-0x0;var _0x1fb5c1=_0x380b[_0x354eb9];return _0x1fb5c1;};'use strict';var _=require(_0xb380('0x0'));var util=require(_0xb380('0x1'));var logger=require(_0xb380('0x2'))(_0xb380('0x3'));var moment=require(_0xb380('0x4'));var BPromise=require(_0xb380('0x5'));var rp=require(_0xb380('0x6'));var attributes=require(_0xb380('0x7'));module['exports']=function(_0x40c3e5,_0x35c68a){return _0x40c3e5[_0xb380('0x8')](_0xb380('0x9'),attributes,{'tableName':_0xb380('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x395e=['int_zendesk_configurations','../../config/logger','moment','exports','ZendeskConfiguration'];(function(_0x7c417,_0x2a72f8){var _0x13e01e=function(_0x4cb32b){while(--_0x4cb32b){_0x7c417['push'](_0x7c417['shift']());}};_0x13e01e(++_0x2a72f8);}(_0x395e,0xe2));var _0xe395=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x395e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe395('0x0'))('api');var moment=require(_0xe395('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./intZendeskConfiguration.attributes');module[_0xe395('0x2')]=function(_0x5dce3b,_0x450ff4){return _0x5dce3b['define'](_0xe395('0x3'),attributes,{'tableName':_0xe395('0x4'),'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 76a2c95..b15197d 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 _0x6e85=['code','message','info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x398a66,_0x532839){var _0x239b77=function(_0x5433aa){while(--_0x5433aa){_0x398a66['push'](_0x398a66['shift']());}};_0x239b77(++_0x532839);}(_0x6e85,0xd3));var _0x56e8=function(_0x2b66ce,_0x10c961){_0x2b66ce=_0x2b66ce-0x0;var _0x463ee2=_0x6e85[_0x2b66ce];return _0x463ee2;};'use strict';var _=require(_0x56e8('0x0'));var util=require('util');var moment=require(_0x56e8('0x1'));var BPromise=require(_0x56e8('0x2'));var rs=require(_0x56e8('0x3'));var fs=require('fs');var db=require(_0x56e8('0x4'))['db'];var utils=require(_0x56e8('0x5'));var logger=require(_0x56e8('0x6'))(_0x56e8('0x7'));var config=require(_0x56e8('0x8'));var jayson=require(_0x56e8('0x9'));var client=jayson[_0x56e8('0xa')][_0x56e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f34eb,_0x1c78c8,_0x134915){return new BPromise(function(_0x1a5110,_0x29ec6d){return client[_0x56e8('0xc')](_0x4f34eb,_0x134915)[_0x56e8('0xd')](function(_0x274d85){logger['info'](_0x56e8('0xe'),_0x1c78c8,_0x56e8('0xf'));logger['debug'](_0x56e8('0x10'),_0x1c78c8,'request\x20sent',JSON[_0x56e8('0x11')](_0x274d85));if(_0x274d85[_0x56e8('0x12')]){if(_0x274d85['error'][_0x56e8('0x13')]===0x1f4){logger[_0x56e8('0x12')](_0x56e8('0xe'),_0x1c78c8,_0x274d85[_0x56e8('0x12')]['message']);return _0x29ec6d(_0x274d85[_0x56e8('0x12')][_0x56e8('0x14')]);}logger['error'](_0x56e8('0xe'),_0x1c78c8,_0x274d85[_0x56e8('0x12')][_0x56e8('0x14')]);return _0x1a5110(_0x274d85[_0x56e8('0x12')][_0x56e8('0x14')]);}else{logger[_0x56e8('0x15')](_0x56e8('0xe'),_0x1c78c8,_0x56e8('0xf'));_0x1a5110(_0x274d85[_0x56e8('0x16')][_0x56e8('0x14')]);}})['catch'](function(_0x217b2f){logger[_0x56e8('0x12')](_0x56e8('0xe'),_0x1c78c8,_0x217b2f);_0x29ec6d(_0x217b2f);});});} \ No newline at end of file +var _0x099f=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then'];(function(_0x41dde1,_0x454119){var _0x59bf87=function(_0x3758a8){while(--_0x3758a8){_0x41dde1['push'](_0x41dde1['shift']());}};_0x59bf87(++_0x454119);}(_0x099f,0x180));var _0xf099=function(_0x8c39e8,_0x52668a){_0x8c39e8=_0x8c39e8-0x0;var _0x3e2c2a=_0x099f[_0x8c39e8];return _0x3e2c2a;};'use strict';var _=require(_0xf099('0x0'));var util=require(_0xf099('0x1'));var moment=require(_0xf099('0x2'));var BPromise=require(_0xf099('0x3'));var rs=require(_0xf099('0x4'));var fs=require('fs');var db=require(_0xf099('0x5'))['db'];var utils=require(_0xf099('0x6'));var logger=require(_0xf099('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf099('0x8'));var client=jayson[_0xf099('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f04e2,_0x20bf97,_0x8258c2){return new BPromise(function(_0x5bc3f9,_0x165246){return client[_0xf099('0xa')](_0x2f04e2,_0x8258c2)[_0xf099('0xb')](function(_0x389dcf){logger['info'](_0xf099('0xc'),_0x20bf97,_0xf099('0xd'));logger['debug'](_0xf099('0xe'),_0x20bf97,_0xf099('0xd'),JSON[_0xf099('0xf')](_0x389dcf));if(_0x389dcf[_0xf099('0x10')]){if(_0x389dcf[_0xf099('0x10')][_0xf099('0x11')]===0x1f4){logger[_0xf099('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x20bf97,_0x389dcf[_0xf099('0x10')]['message']);return _0x165246(_0x389dcf[_0xf099('0x10')][_0xf099('0x12')]);}logger[_0xf099('0x10')](_0xf099('0xc'),_0x20bf97,_0x389dcf[_0xf099('0x10')]['message']);return _0x5bc3f9(_0x389dcf[_0xf099('0x10')][_0xf099('0x12')]);}else{logger[_0xf099('0x13')](_0xf099('0xc'),_0x20bf97,_0xf099('0xd'));_0x5bc3f9(_0x389dcf[_0xf099('0x14')][_0xf099('0x12')]);}})[_0xf099('0x15')](function(_0x1a09ca){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x20bf97,_0x1a09ca);_0x165246(_0x1a09ca);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7fd6f49..e31ff98 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 _0x9eb3=['index','get','/:id','isAuthenticated','show','create','put','update','delete','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x4e1c75,_0x22cede){var _0x5d103e=function(_0x3a9880){while(--_0x3a9880){_0x4e1c75['push'](_0x4e1c75['shift']());}};_0x5d103e(++_0x22cede);}(_0x9eb3,0x90));var _0x39eb=function(_0x1297ff,_0x40e6c9){_0x1297ff=_0x1297ff-0x0;var _0x349ac6=_0x9eb3[_0x1297ff];return _0x349ac6;};'use strict';var multer=require('multer');var util=require(_0x39eb('0x0'));var path=require('path');var express=require('express');var router=express[_0x39eb('0x1')]();var auth=require(_0x39eb('0x2'));var interaction=require(_0x39eb('0x3'));var config=require(_0x39eb('0x4'));var controller=require(_0x39eb('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x39eb('0x6')]);router[_0x39eb('0x7')](_0x39eb('0x8'),auth[_0x39eb('0x9')](),controller[_0x39eb('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x39eb('0xb')]);router[_0x39eb('0xc')](_0x39eb('0x8'),auth[_0x39eb('0x9')](),controller[_0x39eb('0xd')]);router[_0x39eb('0xe')]('/:id',auth[_0x39eb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6bcb=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','express','../../components/auth/service'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x6bcb,0xea));var _0xb6bc=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0x6bcb[_0x10dc64];return _0x9cf98d;};'use strict';var multer=require(_0xb6bc('0x0'));var util=require(_0xb6bc('0x1'));var path=require('path');var express=require(_0xb6bc('0x2'));var router=express['Router']();var auth=require(_0xb6bc('0x3'));var interaction=require(_0xb6bc('0x4'));var config=require(_0xb6bc('0x5'));var controller=require('./intZendeskField.controller');router[_0xb6bc('0x6')]('/',auth['isAuthenticated'](),controller[_0xb6bc('0x7')]);router[_0xb6bc('0x6')](_0xb6bc('0x8'),auth[_0xb6bc('0x9')](),controller[_0xb6bc('0xa')]);router[_0xb6bc('0xb')]('/',auth[_0xb6bc('0x9')](),controller[_0xb6bc('0xc')]);router[_0xb6bc('0xd')](_0xb6bc('0x8'),auth[_0xb6bc('0x9')](),controller[_0xb6bc('0xe')]);router[_0xb6bc('0xf')](_0xb6bc('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xb6bc('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 db2b500..f1a1a2f 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 _0x0bb5=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x0bb5,0x148));var _0x50bb=function(_0x32001e,_0x129ed2){_0x32001e=_0x32001e-0x0;var _0x5e774b=_0x0bb5[_0x32001e];return _0x5e774b;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x50bb('0x2'),_0x50bb('0x3'),_0x50bb('0x4')),'defaultValue':_0x50bb('0x5')},'content':{'type':Sequelize[_0x50bb('0x6')]},'key':{'type':Sequelize[_0x50bb('0x6')]},'keyType':{'type':Sequelize[_0x50bb('0x7')](_0x50bb('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x50bb('0x6')]},'idField':{'type':Sequelize[_0x50bb('0x6')]},'nameField':{'type':Sequelize[_0x50bb('0x6')]},'customField':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x153f=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x153f,0x15b));var _0xf153=function(_0x3c4689,_0x5ea2f1){_0x3c4689=_0x3c4689-0x0;var _0x23c94e=_0x153f[_0x3c4689];return _0x23c94e;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'type':{'type':Sequelize[_0xf153('0x2')](_0xf153('0x3'),_0xf153('0x4'),_0xf153('0x5'),_0xf153('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf153('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf153('0x2')](_0xf153('0x3'),_0xf153('0x4'),_0xf153('0x5'))},'keyContent':{'type':Sequelize[_0xf153('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf153('0x7')]},'customField':{'type':Sequelize[_0xf153('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf153('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 9f11fc6..3d2bc1b 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 _0x4991=['dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskField','rawAttributes','model','keys','query','dateStart'];(function(_0x337e1b,_0x34e77f){var _0x1de6fb=function(_0x70eda3){while(--_0x70eda3){_0x337e1b['push'](_0x337e1b['shift']());}};_0x1de6fb(++_0x34e77f);}(_0x4991,0xf7));var _0x1499=function(_0x2f205c,_0x1f201f){_0x2f205c=_0x2f205c-0x0;var _0xd3c8d6=_0x4991[_0x2f205c];return _0xd3c8d6;};'use strict';var jsonpatch=require(_0x1499('0x0'));var rp=require('request-promise');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1499('0x2'));var util=require(_0x1499('0x3'));var path=require(_0x1499('0x4'));var sox=require(_0x1499('0x5'));var csv=require(_0x1499('0x6'));var ejs=require(_0x1499('0x7'));var fs=require('fs');var _=require(_0x1499('0x8'));var squel=require(_0x1499('0x9'));var crypto=require('crypto');var jsforce=require(_0x1499('0xa'));var deskjs=require(_0x1499('0xb'));var toCsv=require(_0x1499('0x6'));var querystring=require(_0x1499('0xc'));var Papa=require(_0x1499('0xd'));var qs=require(_0x1499('0xe'));var logger=require(_0x1499('0xf'))(_0x1499('0x10'));var utils=require('../../config/utils');var config=require(_0x1499('0x11'));var db=require(_0x1499('0x12'))['db'];function respondWithStatusCode(_0x575251,_0x2a4816){_0x2a4816=_0x2a4816||0xcc;return function(_0x352180){if(_0x352180){return _0x575251['sendStatus'](_0x2a4816);}return _0x575251[_0x1499('0x13')](_0x2a4816)[_0x1499('0x14')]();};}function respondWithResult(_0x5de9a2,_0x4ab173){_0x4ab173=_0x4ab173||0xc8;return function(_0x4dd594){if(_0x4dd594){return _0x5de9a2[_0x1499('0x13')](_0x4ab173)[_0x1499('0x15')](_0x4dd594);}};}function respondWithFilteredResult(_0x34a928,_0x334d7e){return function(_0x2b95a5){if(_0x2b95a5){var _0x57a0a2=_0x2b95a5[_0x1499('0x16')],_0x5f34f2=_0x334d7e[_0x1499('0x17')],_0x308177=_0x334d7e[_0x1499('0x17')]+_0x334d7e[_0x1499('0x18')],_0x4e5195;if(_0x308177>=_0x57a0a2){_0x308177=_0x57a0a2;_0x4e5195=0xc8;}else{_0x4e5195=0xce;}_0x34a928['status'](_0x4e5195);return _0x34a928[_0x1499('0x19')](_0x1499('0x1a'),_0x5f34f2+'-'+_0x308177+'/'+_0x57a0a2)['json'](_0x2b95a5);}return null;};}function patchUpdates(_0x25164c){return function(_0x2d405f){try{jsonpatch[_0x1499('0x1b')](_0x2d405f,_0x25164c,!![]);}catch(_0xc92272){return BPromise[_0x1499('0x1c')](_0xc92272);}return _0x2d405f[_0x1499('0x1d')]();};}function saveUpdates(_0x5b9859,_0x541477){return function(_0x5bcb5f){if(_0x5bcb5f){return _0x5bcb5f[_0x1499('0x1e')](_0x5b9859)[_0x1499('0x1f')](function(_0x4a4e28){return _0x4a4e28;});}return null;};}function removeEntity(_0x351da9,_0x3c13a1){return function(_0x28dff3){if(_0x28dff3){return _0x28dff3[_0x1499('0x20')]()[_0x1499('0x1f')](function(){_0x351da9[_0x1499('0x13')](0xcc)[_0x1499('0x14')]();});}};}function handleEntityNotFound(_0x253439,_0xf8003e){return function(_0x15bcd4){if(!_0x15bcd4){_0x253439[_0x1499('0x21')](0x194);}return _0x15bcd4;};}function handleError(_0x836081,_0x223f4c){_0x223f4c=_0x223f4c||0x1f4;return function(_0x3b73f6){logger[_0x1499('0x22')](_0x3b73f6[_0x1499('0x23')]);if(_0x3b73f6[_0x1499('0x24')]){delete _0x3b73f6['name'];}_0x836081[_0x1499('0x13')](_0x223f4c)[_0x1499('0x25')](_0x3b73f6);};}exports[_0x1499('0x26')]=function(_0x3d10f3,_0x3968e0){var _0x16d036={},_0x54f3c2={},_0x501c0d={'count':0x0,'rows':[]};var _0x12739b=db[_0x1499('0x27')][_0x1499('0x28')];_0x54f3c2[_0x1499('0x29')]=_[_0x1499('0x2a')](_0x12739b);var _0x525d6f={'dateStart':_0x3d10f3[_0x1499('0x2b')]['dateStart'],'dateEnd':_0x3d10f3['query']['dateEnd']};delete _0x3d10f3[_0x1499('0x2b')][_0x1499('0x2c')];delete _0x3d10f3[_0x1499('0x2b')][_0x1499('0x2d')];_0x54f3c2[_0x1499('0x2b')]=_[_0x1499('0x2a')](_0x3d10f3[_0x1499('0x2b')]);_0x54f3c2['filters']=_[_0x1499('0x2e')](_0x54f3c2[_0x1499('0x29')],_0x54f3c2[_0x1499('0x2b')]);_0x16d036['attributes']=_[_0x1499('0x2e')](_0x54f3c2[_0x1499('0x29')],qs['fields'](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x2f')]));_0x16d036['attributes']=_0x16d036[_0x1499('0x30')][_0x1499('0x31')]?_0x16d036[_0x1499('0x30')]:_0x54f3c2[_0x1499('0x29')];if(!_0x3d10f3[_0x1499('0x2b')][_0x1499('0x32')](_0x1499('0x33'))){_0x16d036[_0x1499('0x18')]=qs[_0x1499('0x18')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x18')]);_0x16d036[_0x1499('0x17')]=qs[_0x1499('0x17')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x17')]);}_0x16d036[_0x1499('0x34')]=qs[_0x1499('0x35')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x35')]);_0x16d036[_0x1499('0x36')]=qs['filters'](_[_0x1499('0x37')](_0x3d10f3[_0x1499('0x2b')],_0x54f3c2[_0x1499('0x38')]));if(_0x525d6f[_0x1499('0x2c')]){if(_0x525d6f[_0x1499('0x2d')]){_0x525d6f[_0x1499('0x2d')]=moment(_0x525d6f[_0x1499('0x2d')])[_0x1499('0x39')](0x1,_0x1499('0x3a'));}else{_0x525d6f[_0x1499('0x2d')]=moment(_0x525d6f[_0x1499('0x2c')])['add'](0x1,'day');}_[_0x1499('0x3b')](_0x16d036['where'],{'createdAt':{'$gte':_0x525d6f[_0x1499('0x2c')],'$lte':_0x525d6f['dateEnd']}});}if(_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3c')]){_0x16d036[_0x1499('0x36')]=_[_0x1499('0x3b')](_0x16d036['where'],{'$or':_[_0x1499('0x3d')](_0x16d036['attributes'],function(_0x2f9c59){var _0x3d518d={};_0x3d518d[_0x2f9c59]={'$like':'%'+_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3c')]+'%'};return _0x3d518d;})});}_0x16d036=_['merge']({},_0x16d036,_0x3d10f3[_0x1499('0x3e')]);var _0x815a99={'where':_0x16d036[_0x1499('0x36')]};return db[_0x1499('0x27')]['count'](_0x815a99)[_0x1499('0x1f')](function(_0x4cc411){_0x501c0d[_0x1499('0x16')]=_0x4cc411;if(_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3f')]){_0x16d036[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x27')][_0x1499('0x41')](_0x16d036);})[_0x1499('0x1f')](function(_0xcb85eb){_0x501c0d[_0x1499('0x42')]=_0xcb85eb;return _0x501c0d;})[_0x1499('0x1f')](respondWithFilteredResult(_0x3968e0,_0x16d036))['catch'](handleError(_0x3968e0,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':!![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x29')]=_[_0x1499('0x2a')](db[_0x1499('0x27')][_0x1499('0x28')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2b')]);_0x5646cf[_0x1499('0x38')]=_['intersection'](_0x5646cf[_0x1499('0x29')],_0x5646cf[_0x1499('0x2b')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x29')],qs[_0x1499('0x2f')](_0x5dd36c[_0x1499('0x2b')]['fields']));_0x1af1a1[_0x1499('0x30')]=_0x1af1a1[_0x1499('0x30')][_0x1499('0x31')]?_0x1af1a1[_0x1499('0x30')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2b')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3b')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x27')][_0x1499('0x45')](_0x1af1a1)[_0x1499('0x1f')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x46')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x27')][_0x1499('0x46')](_0x491777[_0x1499('0x47')],{})[_0x1499('0x1f')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x48')](handleError(_0x7fa101,null));};exports[_0x1499('0x1e')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x47')]['id'];}return db[_0x1499('0x27')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x1f')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x1f')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x1f')](respondWithResult(_0x420d16,null))[_0x1499('0x48')](handleError(_0x420d16,null));};exports[_0x1499('0x20')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x27')][_0x1499('0x45')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x1f')](handleEntityNotFound(_0x305599,null))[_0x1499('0x1f')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file +var _0x0120=['reject','save','update','then','destroy','sendStatus','stack','name','send','index','ZendeskField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','filter','map','options','includeAll','include','catch','show','params','find','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x0120,0x6f));var _0x0012=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x0120[_0x31e29a];return _0x32d892;};'use strict';var jsonpatch=require(_0x0012('0x0'));var rp=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var Mustache=require(_0x0012('0x4'));var util=require(_0x0012('0x5'));var path=require(_0x0012('0x6'));var sox=require(_0x0012('0x7'));var csv=require(_0x0012('0x8'));var ejs=require(_0x0012('0x9'));var fs=require('fs');var _=require(_0x0012('0xa'));var squel=require(_0x0012('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0012('0x8'));var querystring=require(_0x0012('0xc'));var Papa=require(_0x0012('0xd'));var qs=require(_0x0012('0xe'));var logger=require(_0x0012('0xf'))('api');var utils=require(_0x0012('0x10'));var config=require(_0x0012('0x11'));var db=require(_0x0012('0x12'))['db'];function respondWithStatusCode(_0x323282,_0x520171){_0x520171=_0x520171||0xcc;return function(_0x2d4674){if(_0x2d4674){return _0x323282['sendStatus'](_0x520171);}return _0x323282[_0x0012('0x13')](_0x520171)[_0x0012('0x14')]();};}function respondWithResult(_0x455f69,_0x38a933){_0x38a933=_0x38a933||0xc8;return function(_0x2451b5){if(_0x2451b5){return _0x455f69['status'](_0x38a933)[_0x0012('0x15')](_0x2451b5);}};}function respondWithFilteredResult(_0x4f0ee1,_0x5bbd04){return function(_0x5d845a){if(_0x5d845a){var _0x5563fc=_0x5d845a[_0x0012('0x16')],_0x3a7d50=_0x5bbd04['offset'],_0x496a2b=_0x5bbd04[_0x0012('0x17')]+_0x5bbd04[_0x0012('0x18')],_0x3995fd;if(_0x496a2b>=_0x5563fc){_0x496a2b=_0x5563fc;_0x3995fd=0xc8;}else{_0x3995fd=0xce;}_0x4f0ee1[_0x0012('0x13')](_0x3995fd);return _0x4f0ee1[_0x0012('0x19')]('Content-Range',_0x3a7d50+'-'+_0x496a2b+'/'+_0x5563fc)['json'](_0x5d845a);}return null;};}function patchUpdates(_0x1e7fbe){return function(_0x20d7de){try{jsonpatch[_0x0012('0x1a')](_0x20d7de,_0x1e7fbe,!![]);}catch(_0x2e88a8){return BPromise[_0x0012('0x1b')](_0x2e88a8);}return _0x20d7de[_0x0012('0x1c')]();};}function saveUpdates(_0x1e78ee,_0x2eb3fa){return function(_0x5b236f){if(_0x5b236f){return _0x5b236f[_0x0012('0x1d')](_0x1e78ee)[_0x0012('0x1e')](function(_0x5797dd){return _0x5797dd;});}return null;};}function removeEntity(_0x45d00b,_0x1f54fc){return function(_0xa2e623){if(_0xa2e623){return _0xa2e623[_0x0012('0x1f')]()['then'](function(){_0x45d00b['status'](0xcc)[_0x0012('0x14')]();});}};}function handleEntityNotFound(_0x1c6583,_0x35f9ee){return function(_0x7177bc){if(!_0x7177bc){_0x1c6583[_0x0012('0x20')](0x194);}return _0x7177bc;};}function handleError(_0x2e6a2c,_0x2c9a96){_0x2c9a96=_0x2c9a96||0x1f4;return function(_0x108b65){logger['error'](_0x108b65[_0x0012('0x21')]);if(_0x108b65[_0x0012('0x22')]){delete _0x108b65['name'];}_0x2e6a2c[_0x0012('0x13')](_0x2c9a96)[_0x0012('0x23')](_0x108b65);};}exports[_0x0012('0x24')]=function(_0x46c260,_0x42bcd7){var _0x5e820b={},_0x351ffd={},_0x18b0a7={'count':0x0,'rows':[]};var _0xbb5b55=db[_0x0012('0x25')][_0x0012('0x26')];_0x351ffd[_0x0012('0x27')]=_[_0x0012('0x28')](_0xbb5b55);var _0xf3781e={'dateStart':_0x46c260[_0x0012('0x29')][_0x0012('0x2a')],'dateEnd':_0x46c260[_0x0012('0x29')][_0x0012('0x2b')]};delete _0x46c260[_0x0012('0x29')][_0x0012('0x2a')];delete _0x46c260[_0x0012('0x29')][_0x0012('0x2b')];_0x351ffd[_0x0012('0x29')]=_[_0x0012('0x28')](_0x46c260[_0x0012('0x29')]);_0x351ffd[_0x0012('0x2c')]=_[_0x0012('0x2d')](_0x351ffd['model'],_0x351ffd[_0x0012('0x29')]);_0x5e820b[_0x0012('0x2e')]=_['intersection'](_0x351ffd[_0x0012('0x27')],qs[_0x0012('0x2f')](_0x46c260[_0x0012('0x29')][_0x0012('0x2f')]));_0x5e820b[_0x0012('0x2e')]=_0x5e820b['attributes'][_0x0012('0x30')]?_0x5e820b[_0x0012('0x2e')]:_0x351ffd[_0x0012('0x27')];if(!_0x46c260['query'][_0x0012('0x31')](_0x0012('0x32'))){_0x5e820b[_0x0012('0x18')]=qs[_0x0012('0x18')](_0x46c260[_0x0012('0x29')][_0x0012('0x18')]);_0x5e820b['offset']=qs[_0x0012('0x17')](_0x46c260[_0x0012('0x29')][_0x0012('0x17')]);}_0x5e820b[_0x0012('0x33')]=qs['sort'](_0x46c260['query'][_0x0012('0x34')]);_0x5e820b[_0x0012('0x35')]=qs[_0x0012('0x2c')](_[_0x0012('0x36')](_0x46c260[_0x0012('0x29')],_0x351ffd[_0x0012('0x2c')]));if(_0xf3781e[_0x0012('0x2a')]){if(_0xf3781e['dateEnd']){_0xf3781e[_0x0012('0x2b')]=moment(_0xf3781e[_0x0012('0x2b')])['add'](0x1,_0x0012('0x37'));}else{_0xf3781e[_0x0012('0x2b')]=moment(_0xf3781e[_0x0012('0x2a')])[_0x0012('0x38')](0x1,_0x0012('0x37'));}_[_0x0012('0x39')](_0x5e820b[_0x0012('0x35')],{'createdAt':{'$gte':_0xf3781e['dateStart'],'$lte':_0xf3781e[_0x0012('0x2b')]}});}if(_0x46c260['query'][_0x0012('0x3a')]){_0x5e820b['where']=_['merge'](_0x5e820b[_0x0012('0x35')],{'$or':_[_0x0012('0x3b')](_0x5e820b[_0x0012('0x2e')],function(_0x4e4424){var _0x44dda2={};_0x44dda2[_0x4e4424]={'$like':'%'+_0x46c260[_0x0012('0x29')][_0x0012('0x3a')]+'%'};return _0x44dda2;})});}_0x5e820b=_[_0x0012('0x39')]({},_0x5e820b,_0x46c260[_0x0012('0x3c')]);var _0x379780={'where':_0x5e820b[_0x0012('0x35')]};return db[_0x0012('0x25')]['count'](_0x379780)[_0x0012('0x1e')](function(_0x25aff1){_0x18b0a7[_0x0012('0x16')]=_0x25aff1;if(_0x46c260[_0x0012('0x29')][_0x0012('0x3d')]){_0x5e820b[_0x0012('0x3e')]=[{'all':!![]}];}return db[_0x0012('0x25')]['findAll'](_0x5e820b);})['then'](function(_0x1c54de){_0x18b0a7['rows']=_0x1c54de;return _0x18b0a7;})[_0x0012('0x1e')](respondWithFilteredResult(_0x42bcd7,_0x5e820b))[_0x0012('0x3f')](handleError(_0x42bcd7,null));};exports[_0x0012('0x40')]=function(_0x40f80d,_0x32c1f9){var _0x5348a2={'raw':!![],'where':{'id':_0x40f80d[_0x0012('0x41')]['id']}},_0x1bd93a={};_0x1bd93a['model']=_[_0x0012('0x28')](db[_0x0012('0x25')][_0x0012('0x26')]);_0x1bd93a[_0x0012('0x29')]=_['keys'](_0x40f80d['query']);_0x1bd93a[_0x0012('0x2c')]=_['intersection'](_0x1bd93a[_0x0012('0x27')],_0x1bd93a['query']);_0x5348a2[_0x0012('0x2e')]=_[_0x0012('0x2d')](_0x1bd93a[_0x0012('0x27')],qs[_0x0012('0x2f')](_0x40f80d['query'][_0x0012('0x2f')]));_0x5348a2['attributes']=_0x5348a2[_0x0012('0x2e')][_0x0012('0x30')]?_0x5348a2[_0x0012('0x2e')]:_0x1bd93a[_0x0012('0x27')];if(_0x40f80d[_0x0012('0x29')][_0x0012('0x3d')]){_0x5348a2[_0x0012('0x3e')]=[{'all':!![]}];}_0x5348a2=_['merge']({},_0x5348a2,_0x40f80d[_0x0012('0x3c')]);return db[_0x0012('0x25')][_0x0012('0x42')](_0x5348a2)[_0x0012('0x1e')](handleEntityNotFound(_0x32c1f9,null))[_0x0012('0x1e')](respondWithResult(_0x32c1f9,null))[_0x0012('0x3f')](handleError(_0x32c1f9,null));};exports['create']=function(_0x5894ee,_0x48de64){return db['ZendeskField'][_0x0012('0x43')](_0x5894ee[_0x0012('0x44')],{})[_0x0012('0x1e')](respondWithResult(_0x48de64,0xc9))[_0x0012('0x3f')](handleError(_0x48de64,null));};exports[_0x0012('0x1d')]=function(_0x53d552,_0x44ffaf){if(_0x53d552[_0x0012('0x44')]['id']){delete _0x53d552[_0x0012('0x44')]['id'];}return db[_0x0012('0x25')][_0x0012('0x42')]({'where':{'id':_0x53d552[_0x0012('0x41')]['id']}})[_0x0012('0x1e')](handleEntityNotFound(_0x44ffaf,null))[_0x0012('0x1e')](saveUpdates(_0x53d552[_0x0012('0x44')],null))[_0x0012('0x1e')](respondWithResult(_0x44ffaf,null))[_0x0012('0x3f')](handleError(_0x44ffaf,null));};exports['destroy']=function(_0x2389cd,_0x12cb8f){return db[_0x0012('0x25')]['find']({'where':{'id':_0x2389cd[_0x0012('0x41')]['id']}})[_0x0012('0x1e')](handleEntityNotFound(_0x12cb8f,null))[_0x0012('0x1e')](removeEntity(_0x12cb8f,null))[_0x0012('0x3f')](handleError(_0x12cb8f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 01038b0..c968709 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 _0xbda8=['util','../../config/logger','api','bluebird','request-promise','./intZendeskField.attributes','define','int_zendesk_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbda8,0x128));var _0x8bda=function(_0x144e76,_0xc7e4d1){_0x144e76=_0x144e76-0x0;var _0x327274=_0xbda8[_0x144e76];return _0x327274;};'use strict';var _=require('lodash');var util=require(_0x8bda('0x0'));var logger=require(_0x8bda('0x1'))(_0x8bda('0x2'));var moment=require('moment');var BPromise=require(_0x8bda('0x3'));var rp=require(_0x8bda('0x4'));var attributes=require(_0x8bda('0x5'));module['exports']=function(_0x23466d,_0x2a0442){return _0x23466d[_0x8bda('0x6')]('ZendeskField',attributes,{'tableName':_0x8bda('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7016=['api','moment','bluebird','request-promise','ZendeskField','int_zendesk_fields','lodash','util','../../config/logger'];(function(_0x2ec986,_0x449d58){var _0x40ad4d=function(_0x591bab){while(--_0x591bab){_0x2ec986['push'](_0x2ec986['shift']());}};_0x40ad4d(++_0x449d58);}(_0x7016,0xe7));var _0x6701=function(_0x2429cf,_0x4b5446){_0x2429cf=_0x2429cf-0x0;var _0x55dd7d=_0x7016[_0x2429cf];return _0x55dd7d;};'use strict';var _=require(_0x6701('0x0'));var util=require(_0x6701('0x1'));var logger=require(_0x6701('0x2'))(_0x6701('0x3'));var moment=require(_0x6701('0x4'));var BPromise=require(_0x6701('0x5'));var rp=require(_0x6701('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x5c7f20,_0x2785c3){return _0x5c7f20['define'](_0x6701('0x7'),attributes,{'tableName':_0x6701('0x8'),'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 9640d90..3ab825c 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 _0xa1cd=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request\x20sent','error','code','ZendeskField,\x20%s,\x20%s','message','info','result','catch','bluebird'];(function(_0x15abb8,_0x426ba5){var _0x39b878=function(_0x1d6a33){while(--_0x1d6a33){_0x15abb8['push'](_0x15abb8['shift']());}};_0x39b878(++_0x426ba5);}(_0xa1cd,0x110));var _0xda1c=function(_0x16983a,_0x15b799){_0x16983a=_0x16983a-0x0;var _0x22b401=_0xa1cd[_0x16983a];return _0x22b401;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xda1c('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xda1c('0x1'));var logger=require(_0xda1c('0x2'))('rpc');var config=require(_0xda1c('0x3'));var jayson=require(_0xda1c('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c7bc8,_0x4006aa,_0x4f5cb9){return new BPromise(function(_0x2ca8f5,_0x11bd1c){return client['request'](_0x1c7bc8,_0x4f5cb9)['then'](function(_0x4740fc){logger['info']('ZendeskField,\x20%s,\x20%s',_0x4006aa,'request\x20sent');logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4006aa,_0xda1c('0x5'),JSON['stringify'](_0x4740fc));if(_0x4740fc[_0xda1c('0x6')]){if(_0x4740fc['error'][_0xda1c('0x7')]===0x1f4){logger[_0xda1c('0x6')](_0xda1c('0x8'),_0x4006aa,_0x4740fc[_0xda1c('0x6')]['message']);return _0x11bd1c(_0x4740fc['error'][_0xda1c('0x9')]);}logger[_0xda1c('0x6')](_0xda1c('0x8'),_0x4006aa,_0x4740fc[_0xda1c('0x6')][_0xda1c('0x9')]);return _0x2ca8f5(_0x4740fc[_0xda1c('0x6')][_0xda1c('0x9')]);}else{logger[_0xda1c('0xa')](_0xda1c('0x8'),_0x4006aa,_0xda1c('0x5'));_0x2ca8f5(_0x4740fc[_0xda1c('0xb')]['message']);}})[_0xda1c('0xc')](function(_0x3cd30b){logger[_0xda1c('0x6')](_0xda1c('0x8'),_0x4006aa,_0x3cd30b);_0x11bd1c(_0x3cd30b);});});} \ No newline at end of file +var _0x0c61=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0xc4f39f,_0xa5296b){var _0x30d690=function(_0x48491d){while(--_0x48491d){_0xc4f39f['push'](_0xc4f39f['shift']());}};_0x30d690(++_0xa5296b);}(_0x0c61,0x90));var _0x10c6=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x0c61[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x10c6('0x0'));var rs=require(_0x10c6('0x1'));var fs=require('fs');var db=require(_0x10c6('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x10c6('0x3'));var jayson=require(_0x10c6('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49a95c,_0x2e7fea,_0x422e02){return new BPromise(function(_0x33c591,_0x11d98b){return client[_0x10c6('0x5')](_0x49a95c,_0x422e02)['then'](function(_0x36e2a8){logger[_0x10c6('0x6')](_0x10c6('0x7'),_0x2e7fea,_0x10c6('0x8'));logger[_0x10c6('0x9')](_0x10c6('0xa'),_0x2e7fea,_0x10c6('0x8'),JSON[_0x10c6('0xb')](_0x36e2a8));if(_0x36e2a8[_0x10c6('0xc')]){if(_0x36e2a8['error'][_0x10c6('0xd')]===0x1f4){logger[_0x10c6('0xc')](_0x10c6('0x7'),_0x2e7fea,_0x36e2a8[_0x10c6('0xc')][_0x10c6('0xe')]);return _0x11d98b(_0x36e2a8[_0x10c6('0xc')]['message']);}logger[_0x10c6('0xc')](_0x10c6('0x7'),_0x2e7fea,_0x36e2a8[_0x10c6('0xc')][_0x10c6('0xe')]);return _0x33c591(_0x36e2a8[_0x10c6('0xc')][_0x10c6('0xe')]);}else{logger[_0x10c6('0x6')](_0x10c6('0x7'),_0x2e7fea,'request\x20sent');_0x33c591(_0x36e2a8[_0x10c6('0xf')][_0x10c6('0xe')]);}})[_0x10c6('0x10')](function(_0x3d668e){logger[_0x10c6('0xc')](_0x10c6('0x7'),_0x2e7fea,_0x3d668e);_0x11d98b(_0x3d668e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ded50fb..6a87850 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 _0x490e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports'];(function(_0x55b461,_0x19645e){var _0x2e4377=function(_0x3a4891){while(--_0x3a4891){_0x55b461['push'](_0x55b461['shift']());}};_0x2e4377(++_0x19645e);}(_0x490e,0x1a2));var _0xe490=function(_0x59b2a1,_0x1f631f){_0x59b2a1=_0x59b2a1-0x0;var _0x4908d1=_0x490e[_0x59b2a1];return _0x4908d1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe490('0x0'));var express=require(_0xe490('0x1'));var router=express[_0xe490('0x2')]();var auth=require(_0xe490('0x3'));var interaction=require(_0xe490('0x4'));var config=require(_0xe490('0x5'));var controller=require(_0xe490('0x6'));router[_0xe490('0x7')]('/',auth['isAuthenticated'](),controller[_0xe490('0x8')]);router[_0xe490('0x7')](_0xe490('0x9'),auth[_0xe490('0xa')](),controller[_0xe490('0xb')]);router['get'](_0xe490('0xc'),auth['isAuthenticated'](),controller[_0xe490('0xd')]);router[_0xe490('0x7')](_0xe490('0xe'),auth[_0xe490('0xa')](),controller['getFields']);router[_0xe490('0xf')]('/',auth[_0xe490('0xa')](),controller[_0xe490('0x10')]);router[_0xe490('0xf')](_0xe490('0xc'),auth[_0xe490('0xa')](),controller['addConfiguration']);router[_0xe490('0x11')](_0xe490('0x9'),auth[_0xe490('0xa')](),controller[_0xe490('0x12')]);router[_0xe490('0x13')](_0xe490('0x9'),auth[_0xe490('0xa')](),controller[_0xe490('0x14')]);module[_0xe490('0x15')]=router; \ No newline at end of file +var _0x70d2=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x35b79,_0x2738a5){var _0x1bffb4=function(_0x4723d1){while(--_0x4723d1){_0x35b79['push'](_0x35b79['shift']());}};_0x1bffb4(++_0x2738a5);}(_0x70d2,0x1dc));var _0x270d=function(_0x1d51b8,_0x127f1c){_0x1d51b8=_0x1d51b8-0x0;var _0x5819fa=_0x70d2[_0x1d51b8];return _0x5819fa;};'use strict';var multer=require('multer');var util=require(_0x270d('0x0'));var path=require(_0x270d('0x1'));var express=require(_0x270d('0x2'));var router=express[_0x270d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x270d('0x4'));var config=require(_0x270d('0x5'));var controller=require(_0x270d('0x6'));router['get']('/',auth[_0x270d('0x7')](),controller[_0x270d('0x8')]);router[_0x270d('0x9')](_0x270d('0xa'),auth['isAuthenticated'](),controller[_0x270d('0xb')]);router[_0x270d('0x9')]('/:id/configurations',auth[_0x270d('0x7')](),controller[_0x270d('0xc')]);router[_0x270d('0x9')](_0x270d('0xd'),auth['isAuthenticated'](),controller[_0x270d('0xe')]);router[_0x270d('0xf')]('/',auth[_0x270d('0x7')](),controller[_0x270d('0x10')]);router[_0x270d('0xf')](_0x270d('0x11'),auth[_0x270d('0x7')](),controller[_0x270d('0x12')]);router[_0x270d('0x13')](_0x270d('0xa'),auth[_0x270d('0x7')](),controller[_0x270d('0x14')]);router[_0x270d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x270d('0x16')]);module[_0x270d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 9f89f6c..431f585 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 _0x9eec=['STRING','sequelize'];(function(_0x2c11eb,_0x2a68b1){var _0x467d26=function(_0x123032){while(--_0x123032){_0x2c11eb['push'](_0x2c11eb['shift']());}};_0x467d26(++_0x2a68b1);}(_0x9eec,0x1ad));var _0xc9ee=function(_0x24ba37,_0x47853b){_0x24ba37=_0x24ba37-0x0;var _0x44f1e5=_0x9eec[_0x24ba37];return _0x44f1e5;};'use strict';var Sequelize=require(_0xc9ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9ee('0x1')]},'description':{'type':Sequelize[_0xc9ee('0x1')]},'authToken':{'type':Sequelize[_0xc9ee('0x1')]},'host':{'type':Sequelize[_0xc9ee('0x1')]},'serverUrl':{'type':Sequelize[_0xc9ee('0x1')]}}; \ No newline at end of file +var _0xc981=['exports','STRING'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0xc981,0x15a));var _0x1c98=function(_0x222984,_0x5a4b63){_0x222984=_0x222984-0x0;var _0x138e33=_0xc981[_0x222984];return _0x138e33;};'use strict';var Sequelize=require('sequelize');module[_0x1c98('0x0')]={'name':{'type':Sequelize[_0x1c98('0x1')]},'description':{'type':Sequelize[_0x1c98('0x1')]},'authToken':{'type':Sequelize[_0x1c98('0x1')]},'host':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1c98('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 535e7cc..a507c73 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 _0x675f=['stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','ZohoAccount','rawAttributes','model','query','dateStart','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','add','day','merge','filter','map','options','count','includeAll','findAll','rows','show','params','keys','include','find','create','body','findOne','ZohoConfiguration','length','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','type','Subjects','ZohoField','getFields','host','authToken','GET','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response','Calls','Call\x20Purpose','section','push','label','Pick\x20List','val','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5df59f,_0xf11a72){var _0x190e3b=function(_0x2b983e){while(--_0x2b983e){_0x5df59f['push'](_0x5df59f['shift']());}};_0x190e3b(++_0xf11a72);}(_0x675f,0x19c));var _0xf675=function(_0x27b275,_0xe24053){_0x27b275=_0x27b275-0x0;var _0x58bc95=_0x675f[_0x27b275];return _0x58bc95;};'use strict';var jsonpatch=require(_0xf675('0x0'));var rp=require(_0xf675('0x1'));var moment=require('moment');var BPromise=require(_0xf675('0x2'));var Mustache=require(_0xf675('0x3'));var util=require(_0xf675('0x4'));var path=require(_0xf675('0x5'));var sox=require('sox');var csv=require(_0xf675('0x6'));var ejs=require(_0xf675('0x7'));var fs=require('fs');var _=require(_0xf675('0x8'));var squel=require(_0xf675('0x9'));var crypto=require(_0xf675('0xa'));var jsforce=require(_0xf675('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf675('0xc'));var Papa=require(_0xf675('0xd'));var qs=require(_0xf675('0xe'));var logger=require(_0xf675('0xf'))('api');var utils=require(_0xf675('0x10'));var config=require('../../config/environment');var db=require(_0xf675('0x11'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1acab7,_0x254b72,_0x24c63a,_0x5a7965){return new BPromise(function(_0x5d8703,_0x593470){var _0x21f328=_0x5a7965||client;return _0x21f328['request'](_0x1acab7,_0x24c63a)[_0xf675('0x12')](function(_0x354c36){logger[_0xf675('0x13')](_0xf675('0x14'),_0x254b72,_0xf675('0x15'));logger[_0xf675('0x16')](_0xf675('0x17'),_0x254b72,_0xf675('0x15'),JSON[_0xf675('0x18')](_0x354c36));if(_0x354c36['error']){if(_0x354c36[_0xf675('0x19')][_0xf675('0x1a')]===0x1f4){logger[_0xf675('0x19')]('ZohoAccount,\x20%s,\x20%s',_0x254b72,_0x354c36[_0xf675('0x19')]['message']);return _0x593470(_0x354c36[_0xf675('0x19')][_0xf675('0x1b')]);}logger[_0xf675('0x19')](_0xf675('0x14'),_0x254b72,_0x354c36[_0xf675('0x19')][_0xf675('0x1b')]);return _0x5d8703(_0x354c36[_0xf675('0x19')][_0xf675('0x1b')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x254b72,_0xf675('0x15'));_0x5d8703(_0x354c36[_0xf675('0x1c')][_0xf675('0x1b')]);}})[_0xf675('0x1d')](function(_0x5ceafd){logger['error'](_0xf675('0x14'),_0x254b72,_0x5ceafd);_0x593470(_0x5ceafd);});});}function respondWithStatusCode(_0x281cd2,_0x18de64){_0x18de64=_0x18de64||0xcc;return function(_0x3083c8){if(_0x3083c8){return _0x281cd2['sendStatus'](_0x18de64);}return _0x281cd2[_0xf675('0x1e')](_0x18de64)[_0xf675('0x1f')]();};}function respondWithResult(_0x299b18,_0x2e200a){_0x2e200a=_0x2e200a||0xc8;return function(_0xde649f){if(_0xde649f){return _0x299b18[_0xf675('0x1e')](_0x2e200a)[_0xf675('0x20')](_0xde649f);}};}function respondWithFilteredResult(_0x1c98d8,_0x30593c){return function(_0x3b3cbb){if(_0x3b3cbb){var _0x49597d=_0x3b3cbb['count'],_0x32f510=_0x30593c['offset'],_0x3632b2=_0x30593c[_0xf675('0x21')]+_0x30593c[_0xf675('0x22')],_0x3536fa;if(_0x3632b2>=_0x49597d){_0x3632b2=_0x49597d;_0x3536fa=0xc8;}else{_0x3536fa=0xce;}_0x1c98d8[_0xf675('0x1e')](_0x3536fa);return _0x1c98d8[_0xf675('0x23')](_0xf675('0x24'),_0x32f510+'-'+_0x3632b2+'/'+_0x49597d)[_0xf675('0x20')](_0x3b3cbb);}return null;};}function patchUpdates(_0xa53c55){return function(_0x1ad696){try{jsonpatch[_0xf675('0x25')](_0x1ad696,_0xa53c55,!![]);}catch(_0x5c20aa){return BPromise[_0xf675('0x26')](_0x5c20aa);}return _0x1ad696[_0xf675('0x27')]();};}function saveUpdates(_0x344edf,_0x13ba73){return function(_0x240393){if(_0x240393){return _0x240393[_0xf675('0x28')](_0x344edf)[_0xf675('0x12')](function(_0x2c8d7d){return _0x2c8d7d;});}return null;};}function removeEntity(_0x4a47a7,_0x1487d9){return function(_0x21b720){if(_0x21b720){return _0x21b720[_0xf675('0x29')]()['then'](function(){_0x4a47a7[_0xf675('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x212618,_0x1b00e4){return function(_0x28fe2a){if(!_0x28fe2a){_0x212618[_0xf675('0x2a')](0x194);}return _0x28fe2a;};}function handleError(_0x1cbfbd,_0x5e93de){_0x5e93de=_0x5e93de||0x1f4;return function(_0x22935f){logger['error'](_0x22935f[_0xf675('0x2b')]);if(_0x22935f[_0xf675('0x2c')]){delete _0x22935f[_0xf675('0x2c')];}_0x1cbfbd[_0xf675('0x1e')](_0x5e93de)['send'](_0x22935f);};}exports[_0xf675('0x2d')]=function(_0x8f9bf1,_0x4aa86a){var _0xa88b0a={},_0x27deb4={},_0x2b8968={'count':0x0,'rows':[]};var _0x156964=db[_0xf675('0x2e')][_0xf675('0x2f')];_0x27deb4[_0xf675('0x30')]=_['keys'](_0x156964);var _0x59c800={'dateStart':_0x8f9bf1[_0xf675('0x31')][_0xf675('0x32')],'dateEnd':_0x8f9bf1['query'][_0xf675('0x33')]};delete _0x8f9bf1[_0xf675('0x31')][_0xf675('0x32')];delete _0x8f9bf1[_0xf675('0x31')][_0xf675('0x33')];_0x27deb4['query']=_['keys'](_0x8f9bf1[_0xf675('0x31')]);_0x27deb4['filters']=_['intersection'](_0x27deb4['model'],_0x27deb4[_0xf675('0x31')]);_0xa88b0a['attributes']=_[_0xf675('0x34')](_0x27deb4['model'],qs[_0xf675('0x35')](_0x8f9bf1[_0xf675('0x31')][_0xf675('0x35')]));_0xa88b0a[_0xf675('0x36')]=_0xa88b0a[_0xf675('0x36')]['length']?_0xa88b0a[_0xf675('0x36')]:_0x27deb4['model'];if(!_0x8f9bf1['query'][_0xf675('0x37')](_0xf675('0x38'))){_0xa88b0a[_0xf675('0x22')]=qs[_0xf675('0x22')](_0x8f9bf1[_0xf675('0x31')][_0xf675('0x22')]);_0xa88b0a[_0xf675('0x21')]=qs[_0xf675('0x21')](_0x8f9bf1[_0xf675('0x31')][_0xf675('0x21')]);}_0xa88b0a[_0xf675('0x39')]=qs[_0xf675('0x3a')](_0x8f9bf1['query'][_0xf675('0x3a')]);_0xa88b0a[_0xf675('0x3b')]=qs[_0xf675('0x3c')](_['pick'](_0x8f9bf1['query'],_0x27deb4[_0xf675('0x3c')]));if(_0x59c800[_0xf675('0x32')]){if(_0x59c800[_0xf675('0x33')]){_0x59c800[_0xf675('0x33')]=moment(_0x59c800['dateEnd'])[_0xf675('0x3d')](0x1,'day');}else{_0x59c800[_0xf675('0x33')]=moment(_0x59c800['dateStart'])[_0xf675('0x3d')](0x1,_0xf675('0x3e'));}_[_0xf675('0x3f')](_0xa88b0a['where'],{'createdAt':{'$gte':_0x59c800[_0xf675('0x32')],'$lte':_0x59c800['dateEnd']}});}if(_0x8f9bf1[_0xf675('0x31')][_0xf675('0x40')]){_0xa88b0a[_0xf675('0x3b')]=_[_0xf675('0x3f')](_0xa88b0a[_0xf675('0x3b')],{'$or':_[_0xf675('0x41')](_0xa88b0a[_0xf675('0x36')],function(_0x1e426a){var _0x5bd56e={};_0x5bd56e[_0x1e426a]={'$like':'%'+_0x8f9bf1[_0xf675('0x31')][_0xf675('0x40')]+'%'};return _0x5bd56e;})});}_0xa88b0a=_[_0xf675('0x3f')]({},_0xa88b0a,_0x8f9bf1[_0xf675('0x42')]);var _0x1647df={'where':_0xa88b0a[_0xf675('0x3b')]};return db['ZohoAccount']['count'](_0x1647df)['then'](function(_0x5c4ba1){_0x2b8968[_0xf675('0x43')]=_0x5c4ba1;if(_0x8f9bf1[_0xf675('0x31')][_0xf675('0x44')]){_0xa88b0a['include']=[{'all':!![]}];}return db[_0xf675('0x2e')][_0xf675('0x45')](_0xa88b0a);})[_0xf675('0x12')](function(_0xa95463){_0x2b8968[_0xf675('0x46')]=_0xa95463;return _0x2b8968;})[_0xf675('0x12')](respondWithFilteredResult(_0x4aa86a,_0xa88b0a))[_0xf675('0x1d')](handleError(_0x4aa86a,null));};exports[_0xf675('0x47')]=function(_0x15fdf2,_0x27b8fb){var _0x469ff7={'raw':![],'where':{'id':_0x15fdf2[_0xf675('0x48')]['id']}},_0x1d3ef5={};_0x1d3ef5[_0xf675('0x30')]=_[_0xf675('0x49')](db[_0xf675('0x2e')][_0xf675('0x2f')]);_0x1d3ef5[_0xf675('0x31')]=_[_0xf675('0x49')](_0x15fdf2[_0xf675('0x31')]);_0x1d3ef5[_0xf675('0x3c')]=_['intersection'](_0x1d3ef5[_0xf675('0x30')],_0x1d3ef5[_0xf675('0x31')]);_0x469ff7[_0xf675('0x36')]=_[_0xf675('0x34')](_0x1d3ef5[_0xf675('0x30')],qs[_0xf675('0x35')](_0x15fdf2['query'][_0xf675('0x35')]));_0x469ff7['attributes']=_0x469ff7[_0xf675('0x36')]['length']?_0x469ff7[_0xf675('0x36')]:_0x1d3ef5[_0xf675('0x30')];if(_0x15fdf2[_0xf675('0x31')][_0xf675('0x44')]){_0x469ff7[_0xf675('0x4a')]=[{'all':!![]}];}_0x469ff7=_[_0xf675('0x3f')]({},_0x469ff7,_0x15fdf2['options']);return db[_0xf675('0x2e')][_0xf675('0x4b')](_0x469ff7)[_0xf675('0x12')](handleEntityNotFound(_0x27b8fb,null))[_0xf675('0x12')](respondWithResult(_0x27b8fb,null))[_0xf675('0x1d')](handleError(_0x27b8fb,null));};exports[_0xf675('0x4c')]=function(_0x503fe7,_0x2a5f36){return db[_0xf675('0x2e')][_0xf675('0x4c')](_0x503fe7[_0xf675('0x4d')],{})['then'](respondWithResult(_0x2a5f36,0xc9))['catch'](handleError(_0x2a5f36,null));};exports[_0xf675('0x28')]=function(_0x220314,_0x34a2f1){if(_0x220314[_0xf675('0x4d')]['id']){delete _0x220314[_0xf675('0x4d')]['id'];}return db[_0xf675('0x2e')]['find']({'where':{'id':_0x220314[_0xf675('0x48')]['id']}})[_0xf675('0x12')](handleEntityNotFound(_0x34a2f1,null))[_0xf675('0x12')](saveUpdates(_0x220314[_0xf675('0x4d')],null))[_0xf675('0x12')](respondWithResult(_0x34a2f1,null))['catch'](handleError(_0x34a2f1,null));};exports[_0xf675('0x29')]=function(_0x423bdd,_0x2d96f4){return db[_0xf675('0x2e')][_0xf675('0x4b')]({'where':{'id':_0x423bdd[_0xf675('0x48')]['id']}})[_0xf675('0x12')](handleEntityNotFound(_0x2d96f4,null))[_0xf675('0x12')](removeEntity(_0x2d96f4,null))[_0xf675('0x1d')](handleError(_0x2d96f4,null));};exports['getConfigurations']=function(_0x5f5520,_0x34191a,_0x5f2da1){var _0x524c8d={};var _0x299f0d={};var _0x2cb9a5;var _0x2c8235;return db[_0xf675('0x2e')][_0xf675('0x4e')]({'where':{'id':_0x5f5520[_0xf675('0x48')]['id']}})['then'](handleEntityNotFound(_0x34191a,null))['then'](function(_0x12ce21){if(_0x12ce21){_0x2cb9a5=_0x12ce21;_0x299f0d[_0xf675('0x30')]=_['keys'](db[_0xf675('0x4f')][_0xf675('0x2f')]);_0x299f0d[_0xf675('0x31')]=_[_0xf675('0x49')](_0x5f5520['query']);_0x299f0d[_0xf675('0x3c')]=_[_0xf675('0x34')](_0x299f0d[_0xf675('0x30')],_0x299f0d[_0xf675('0x31')]);_0x524c8d[_0xf675('0x36')]=_[_0xf675('0x34')](_0x299f0d[_0xf675('0x30')],qs[_0xf675('0x35')](_0x5f5520[_0xf675('0x31')][_0xf675('0x35')]));_0x524c8d[_0xf675('0x36')]=_0x524c8d[_0xf675('0x36')]['length']?_0x524c8d['attributes']:_0x299f0d[_0xf675('0x30')];_0x524c8d[_0xf675('0x39')]=qs['sort'](_0x5f5520['query'][_0xf675('0x3a')]);_0x524c8d['where']=qs['filters'](_['pick'](_0x5f5520[_0xf675('0x31')],_0x299f0d[_0xf675('0x3c')]));if(_0x5f5520[_0xf675('0x31')]['filter']){_0x524c8d[_0xf675('0x3b')]=_[_0xf675('0x3f')](_0x524c8d['where'],{'$or':_['map'](_0x524c8d[_0xf675('0x36')],function(_0x43b165){var _0x4e2526={};_0x4e2526[_0x43b165]={'$like':'%'+_0x5f5520[_0xf675('0x31')]['filter']+'%'};return _0x4e2526;})});}_0x524c8d=_[_0xf675('0x3f')]({},_0x524c8d,_0x5f5520[_0xf675('0x42')]);return _0x2cb9a5['getConfigurations'](_0x524c8d);}})[_0xf675('0x12')](function(_0x5c7ef5){if(_0x5c7ef5){_0x2c8235=_0x5c7ef5[_0xf675('0x50')];if(!_0x5f5520['query']['hasOwnProperty'](_0xf675('0x38'))){_0x524c8d[_0xf675('0x22')]=qs[_0xf675('0x22')](_0x5f5520[_0xf675('0x31')]['limit']);_0x524c8d[_0xf675('0x21')]=qs[_0xf675('0x21')](_0x5f5520[_0xf675('0x31')][_0xf675('0x21')]);}return _0x2cb9a5[_0xf675('0x51')](_0x524c8d);}})[_0xf675('0x12')](function(_0x2c5638){if(_0x2c5638){return _0x2c5638?{'count':_0x2c8235,'rows':_0x2c5638}:null;}})['then'](respondWithResult(_0x34191a,null))[_0xf675('0x1d')](handleError(_0x34191a,null));};exports[_0xf675('0x52')]=function(_0x4b5747,_0xb4eaf0,_0xceec9a){if(_0x4b5747['body']['id']){delete _0x4b5747['body']['id'];}return db[_0xf675('0x2e')]['findOne']({'where':{'id':_0x4b5747[_0xf675('0x48')]['id']}})['then'](handleEntityNotFound(_0xb4eaf0,null))[_0xf675('0x12')](function(_0x3d2355){if(_0x3d2355){_0x4b5747[_0xf675('0x4d')][_0xf675('0x53')]=_0x3d2355['id'];_0x4b5747[_0xf675('0x4d')]['Subjects']=integrations[_0xf675('0x54')](_0x4b5747[_0xf675('0x4d')][_0xf675('0x55')],_0x4b5747[_0xf675('0x4d')]['type']);_0x4b5747[_0xf675('0x4d')][_0xf675('0x56')]=integrations['getDescriptions'](_0x4b5747[_0xf675('0x4d')][_0xf675('0x55')],_0x4b5747[_0xf675('0x4d')][_0xf675('0x57')]);return db[_0xf675('0x4f')][_0xf675('0x4c')](_0x4b5747[_0xf675('0x4d')],{'include':[{'model':db['ZohoField'],'as':_0xf675('0x58')},{'model':db[_0xf675('0x59')],'as':_0xf675('0x56')}]});}return null;})[_0xf675('0x12')](respondWithResult(_0xb4eaf0,null))['catch'](handleError(_0xb4eaf0,null));};exports[_0xf675('0x5a')]=function(_0x4f5665,_0x2b67a0,_0x40c8e0){return db['ZohoAccount'][_0xf675('0x4e')]({'where':{'id':_0x4f5665[_0xf675('0x48')]['id']},'attributes':['id',_0xf675('0x5b'),_0xf675('0x5c')]})['then'](handleEntityNotFound(_0x2b67a0,null))[_0xf675('0x12')](function(_0x2abed1){if(_0x2abed1){return rp({'method':_0xf675('0x5d'),'uri':util[_0xf675('0x5e')](_0xf675('0x5f'),_0x2abed1['host']),'qs':{'authtoken':_0x2abed1[_0xf675('0x5c')],'scope':_0xf675('0x60')},'json':!![]});}})[_0xf675('0x12')](function(_0x4854d5){if(_0x4854d5){if(_0x4854d5[_0xf675('0x61')]&&_0x4854d5['response']['error']){throw new Error(_0x4854d5['response'][_0xf675('0x19')][_0xf675('0x1b')]);}var _0x54de31=[];if(_0x4854d5[_0xf675('0x62')]&&_0x4854d5[_0xf675('0x62')]['section']){if(_0x4854d5[_0xf675('0x62')]['section']['FL']){var _0x418f5c=[_0xf675('0x63')];for(var _0x5d7cbd=0x0,_0x33edc6=_0x4854d5[_0xf675('0x62')][_0xf675('0x64')]['FL'][_0xf675('0x50')];_0x5d7cbd<_0x33edc6;_0x5d7cbd++){if(_['includes'](_0x418f5c,_0x4854d5['Calls']['section']['FL'][_0x5d7cbd]['dv'])){_0x54de31[_0xf675('0x65')]({'id':_0x4854d5[_0xf675('0x62')]['section']['FL'][_0x5d7cbd]['dv'],'name':_0x4854d5['Calls'][_0xf675('0x64')]['FL'][_0x5d7cbd][_0xf675('0x66')],'custom':_0x4854d5[_0xf675('0x62')][_0xf675('0x64')]['FL'][_0x5d7cbd]['customfield']==='true'?!![]:![],'options':_0x4854d5[_0xf675('0x62')][_0xf675('0x64')]['FL'][_0x5d7cbd][_0xf675('0x57')]===_0xf675('0x67')&&_0x4854d5['Calls'][_0xf675('0x64')]['FL'][_0x5d7cbd]['val']?_[_0xf675('0x41')](_0x4854d5['Calls'][_0xf675('0x64')]['FL'][_0x5d7cbd][_0xf675('0x68')],function(_0x1ab091){return{'name':_0x1ab091,'value':_0x1ab091};}):[]});}}}}return{'count':_0x54de31[_0xf675('0x50')],'rows':_0x54de31};}})[_0xf675('0x12')](respondWithResult(_0x2b67a0,null))[_0xf675('0x1d')](function(_0x4247c0){var _0x218663=_0x4f5665[_0xf675('0x31')]['test']?0x1f4:_0x4247c0[_0xf675('0x69')]||0x1f4;logger[_0xf675('0x19')](_0xf675('0x6a'),_0xf675('0x5a'),_0x218663,JSON[_0xf675('0x18')](_0x4247c0));delete _0x4247c0[_0xf675('0x2c')];if(_0x218663===0x191){_0x218663=0x190;}_0x2b67a0[_0xf675('0x1e')](_0x218663)[_0xf675('0x6b')](_0x4f5665[_0xf675('0x31')][_0xf675('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x4247c0[_0xf675('0x69')]}:_0x4247c0);});}; \ No newline at end of file +var _0x8caa=['query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','merge','filter','map','includeAll','include','rows','show','params','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','getFields','host','authToken','format','https://crm.%s/crm/private/json/Calls/getFields','response','Calls','section','Call\x20Purpose','push','customfield','true','Pick\x20List','val','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','moment','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','ZohoAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','ZohoAccount','rawAttributes','model','keys'];(function(_0x198eb2,_0x546341){var _0x345c8e=function(_0x1ad595){while(--_0x1ad595){_0x198eb2['push'](_0x198eb2['shift']());}};_0x345c8e(++_0x546341);}(_0x8caa,0xa1));var _0xa8ca=function(_0x3d8995,_0x5f4f4b){_0x3d8995=_0x3d8995-0x0;var _0x5dd8ed=_0x8caa[_0x3d8995];return _0x5dd8ed;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa8ca('0x0'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa8ca('0x1'));var path=require(_0xa8ca('0x2'));var sox=require(_0xa8ca('0x3'));var csv=require(_0xa8ca('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa8ca('0x5'));var squel=require(_0xa8ca('0x6'));var crypto=require(_0xa8ca('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xa8ca('0x8'));var toCsv=require(_0xa8ca('0x4'));var querystring=require(_0xa8ca('0x9'));var Papa=require(_0xa8ca('0xa'));var qs=require(_0xa8ca('0xb'));var logger=require(_0xa8ca('0xc'))(_0xa8ca('0xd'));var utils=require(_0xa8ca('0xe'));var config=require(_0xa8ca('0xf'));var db=require(_0xa8ca('0x10'))['db'];var integrations=require(_0xa8ca('0x11'));var jayson=require(_0xa8ca('0x12'));var client=jayson[_0xa8ca('0x13')][_0xa8ca('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4f00d4,_0x33d4be,_0x523a8f,_0x3830f8){return new BPromise(function(_0x5bb062,_0x373ad7){var _0xbb3938=_0x3830f8||client;return _0xbb3938[_0xa8ca('0x15')](_0x4f00d4,_0x523a8f)[_0xa8ca('0x16')](function(_0x36dcdf){logger[_0xa8ca('0x17')]('ZohoAccount,\x20%s,\x20%s',_0x33d4be,_0xa8ca('0x18'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x33d4be,_0xa8ca('0x18'),JSON[_0xa8ca('0x19')](_0x36dcdf));if(_0x36dcdf['error']){if(_0x36dcdf[_0xa8ca('0x1a')]['code']===0x1f4){logger[_0xa8ca('0x1a')](_0xa8ca('0x1b'),_0x33d4be,_0x36dcdf[_0xa8ca('0x1a')][_0xa8ca('0x1c')]);return _0x373ad7(_0x36dcdf[_0xa8ca('0x1a')][_0xa8ca('0x1c')]);}logger[_0xa8ca('0x1a')](_0xa8ca('0x1b'),_0x33d4be,_0x36dcdf[_0xa8ca('0x1a')][_0xa8ca('0x1c')]);return _0x5bb062(_0x36dcdf[_0xa8ca('0x1a')][_0xa8ca('0x1c')]);}else{logger[_0xa8ca('0x17')]('ZohoAccount,\x20%s,\x20%s',_0x33d4be,_0xa8ca('0x18'));_0x5bb062(_0x36dcdf['result'][_0xa8ca('0x1c')]);}})[_0xa8ca('0x1d')](function(_0x2ea46e){logger[_0xa8ca('0x1a')](_0xa8ca('0x1b'),_0x33d4be,_0x2ea46e);_0x373ad7(_0x2ea46e);});});}function respondWithStatusCode(_0x3a1db5,_0x53eb5e){_0x53eb5e=_0x53eb5e||0xcc;return function(_0x5b3eab){if(_0x5b3eab){return _0x3a1db5[_0xa8ca('0x1e')](_0x53eb5e);}return _0x3a1db5[_0xa8ca('0x1f')](_0x53eb5e)['end']();};}function respondWithResult(_0x3c9939,_0x5bf269){_0x5bf269=_0x5bf269||0xc8;return function(_0xd59b85){if(_0xd59b85){return _0x3c9939['status'](_0x5bf269)[_0xa8ca('0x20')](_0xd59b85);}};}function respondWithFilteredResult(_0xef9554,_0x4dd789){return function(_0x1ced27){if(_0x1ced27){var _0x589f3b=_0x1ced27[_0xa8ca('0x21')],_0x8374f0=_0x4dd789[_0xa8ca('0x22')],_0x3da9d4=_0x4dd789[_0xa8ca('0x22')]+_0x4dd789[_0xa8ca('0x23')],_0x494579;if(_0x3da9d4>=_0x589f3b){_0x3da9d4=_0x589f3b;_0x494579=0xc8;}else{_0x494579=0xce;}_0xef9554['status'](_0x494579);return _0xef9554[_0xa8ca('0x24')](_0xa8ca('0x25'),_0x8374f0+'-'+_0x3da9d4+'/'+_0x589f3b)[_0xa8ca('0x20')](_0x1ced27);}return null;};}function patchUpdates(_0x5c8bc9){return function(_0x32e441){try{jsonpatch[_0xa8ca('0x26')](_0x32e441,_0x5c8bc9,!![]);}catch(_0x3d9b39){return BPromise[_0xa8ca('0x27')](_0x3d9b39);}return _0x32e441[_0xa8ca('0x28')]();};}function saveUpdates(_0x59d699,_0x17de8d){return function(_0xc0d223){if(_0xc0d223){return _0xc0d223[_0xa8ca('0x29')](_0x59d699)[_0xa8ca('0x16')](function(_0x2351fd){return _0x2351fd;});}return null;};}function removeEntity(_0x3ba7be,_0x32f425){return function(_0x2385ca){if(_0x2385ca){return _0x2385ca[_0xa8ca('0x2a')]()[_0xa8ca('0x16')](function(){_0x3ba7be[_0xa8ca('0x1f')](0xcc)[_0xa8ca('0x2b')]();});}};}function handleEntityNotFound(_0x3ffa95,_0xc77bcf){return function(_0x6b44a8){if(!_0x6b44a8){_0x3ffa95['sendStatus'](0x194);}return _0x6b44a8;};}function handleError(_0x143a8e,_0x1c9fe9){_0x1c9fe9=_0x1c9fe9||0x1f4;return function(_0x406bc9){logger[_0xa8ca('0x1a')](_0x406bc9[_0xa8ca('0x2c')]);if(_0x406bc9[_0xa8ca('0x2d')]){delete _0x406bc9[_0xa8ca('0x2d')];}_0x143a8e[_0xa8ca('0x1f')](_0x1c9fe9)[_0xa8ca('0x2e')](_0x406bc9);};}exports['index']=function(_0x4f4f76,_0x17b2bc){var _0x2b925d={},_0x5d88fd={},_0x271de1={'count':0x0,'rows':[]};var _0x50e6b1=db[_0xa8ca('0x2f')][_0xa8ca('0x30')];_0x5d88fd[_0xa8ca('0x31')]=_[_0xa8ca('0x32')](_0x50e6b1);var _0x2cf4f2={'dateStart':_0x4f4f76['query']['dateStart'],'dateEnd':_0x4f4f76[_0xa8ca('0x33')][_0xa8ca('0x34')]};delete _0x4f4f76['query'][_0xa8ca('0x35')];delete _0x4f4f76[_0xa8ca('0x33')][_0xa8ca('0x34')];_0x5d88fd[_0xa8ca('0x33')]=_[_0xa8ca('0x32')](_0x4f4f76[_0xa8ca('0x33')]);_0x5d88fd[_0xa8ca('0x36')]=_[_0xa8ca('0x37')](_0x5d88fd[_0xa8ca('0x31')],_0x5d88fd[_0xa8ca('0x33')]);_0x2b925d[_0xa8ca('0x38')]=_[_0xa8ca('0x37')](_0x5d88fd[_0xa8ca('0x31')],qs[_0xa8ca('0x39')](_0x4f4f76[_0xa8ca('0x33')]['fields']));_0x2b925d[_0xa8ca('0x38')]=_0x2b925d['attributes'][_0xa8ca('0x3a')]?_0x2b925d[_0xa8ca('0x38')]:_0x5d88fd[_0xa8ca('0x31')];if(!_0x4f4f76[_0xa8ca('0x33')][_0xa8ca('0x3b')]('nolimit')){_0x2b925d['limit']=qs['limit'](_0x4f4f76[_0xa8ca('0x33')][_0xa8ca('0x23')]);_0x2b925d[_0xa8ca('0x22')]=qs[_0xa8ca('0x22')](_0x4f4f76['query']['offset']);}_0x2b925d[_0xa8ca('0x3c')]=qs[_0xa8ca('0x3d')](_0x4f4f76[_0xa8ca('0x33')][_0xa8ca('0x3d')]);_0x2b925d[_0xa8ca('0x3e')]=qs['filters'](_[_0xa8ca('0x3f')](_0x4f4f76[_0xa8ca('0x33')],_0x5d88fd[_0xa8ca('0x36')]));if(_0x2cf4f2['dateStart']){if(_0x2cf4f2[_0xa8ca('0x34')]){_0x2cf4f2[_0xa8ca('0x34')]=moment(_0x2cf4f2[_0xa8ca('0x34')])[_0xa8ca('0x40')](0x1,'day');}else{_0x2cf4f2[_0xa8ca('0x34')]=moment(_0x2cf4f2[_0xa8ca('0x35')])['add'](0x1,'day');}_[_0xa8ca('0x41')](_0x2b925d[_0xa8ca('0x3e')],{'createdAt':{'$gte':_0x2cf4f2[_0xa8ca('0x35')],'$lte':_0x2cf4f2[_0xa8ca('0x34')]}});}if(_0x4f4f76[_0xa8ca('0x33')][_0xa8ca('0x42')]){_0x2b925d[_0xa8ca('0x3e')]=_[_0xa8ca('0x41')](_0x2b925d[_0xa8ca('0x3e')],{'$or':_[_0xa8ca('0x43')](_0x2b925d[_0xa8ca('0x38')],function(_0x1de7e1){var _0x358a5c={};_0x358a5c[_0x1de7e1]={'$like':'%'+_0x4f4f76[_0xa8ca('0x33')]['filter']+'%'};return _0x358a5c;})});}_0x2b925d=_[_0xa8ca('0x41')]({},_0x2b925d,_0x4f4f76['options']);var _0x29dcd6={'where':_0x2b925d[_0xa8ca('0x3e')]};return db[_0xa8ca('0x2f')][_0xa8ca('0x21')](_0x29dcd6)['then'](function(_0x2bb500){_0x271de1[_0xa8ca('0x21')]=_0x2bb500;if(_0x4f4f76[_0xa8ca('0x33')][_0xa8ca('0x44')]){_0x2b925d[_0xa8ca('0x45')]=[{'all':!![]}];}return db[_0xa8ca('0x2f')]['findAll'](_0x2b925d);})[_0xa8ca('0x16')](function(_0x42fcfc){_0x271de1[_0xa8ca('0x46')]=_0x42fcfc;return _0x271de1;})[_0xa8ca('0x16')](respondWithFilteredResult(_0x17b2bc,_0x2b925d))[_0xa8ca('0x1d')](handleError(_0x17b2bc,null));};exports[_0xa8ca('0x47')]=function(_0x191da0,_0x52af74){var _0x5b4a22={'raw':![],'where':{'id':_0x191da0[_0xa8ca('0x48')]['id']}},_0x2e1cc5={};_0x2e1cc5['model']=_[_0xa8ca('0x32')](db[_0xa8ca('0x2f')][_0xa8ca('0x30')]);_0x2e1cc5[_0xa8ca('0x33')]=_[_0xa8ca('0x32')](_0x191da0[_0xa8ca('0x33')]);_0x2e1cc5[_0xa8ca('0x36')]=_[_0xa8ca('0x37')](_0x2e1cc5[_0xa8ca('0x31')],_0x2e1cc5[_0xa8ca('0x33')]);_0x5b4a22[_0xa8ca('0x38')]=_[_0xa8ca('0x37')](_0x2e1cc5[_0xa8ca('0x31')],qs[_0xa8ca('0x39')](_0x191da0[_0xa8ca('0x33')][_0xa8ca('0x39')]));_0x5b4a22[_0xa8ca('0x38')]=_0x5b4a22['attributes'][_0xa8ca('0x3a')]?_0x5b4a22[_0xa8ca('0x38')]:_0x2e1cc5['model'];if(_0x191da0[_0xa8ca('0x33')]['includeAll']){_0x5b4a22['include']=[{'all':!![]}];}_0x5b4a22=_[_0xa8ca('0x41')]({},_0x5b4a22,_0x191da0[_0xa8ca('0x49')]);return db['ZohoAccount'][_0xa8ca('0x4a')](_0x5b4a22)[_0xa8ca('0x16')](handleEntityNotFound(_0x52af74,null))[_0xa8ca('0x16')](respondWithResult(_0x52af74,null))[_0xa8ca('0x1d')](handleError(_0x52af74,null));};exports[_0xa8ca('0x4b')]=function(_0x4c0c43,_0x4b8e2c){return db[_0xa8ca('0x2f')][_0xa8ca('0x4b')](_0x4c0c43[_0xa8ca('0x4c')],{})[_0xa8ca('0x16')](respondWithResult(_0x4b8e2c,0xc9))[_0xa8ca('0x1d')](handleError(_0x4b8e2c,null));};exports[_0xa8ca('0x29')]=function(_0x304979,_0x49b698){if(_0x304979[_0xa8ca('0x4c')]['id']){delete _0x304979[_0xa8ca('0x4c')]['id'];}return db[_0xa8ca('0x2f')]['find']({'where':{'id':_0x304979['params']['id']}})[_0xa8ca('0x16')](handleEntityNotFound(_0x49b698,null))['then'](saveUpdates(_0x304979[_0xa8ca('0x4c')],null))[_0xa8ca('0x16')](respondWithResult(_0x49b698,null))[_0xa8ca('0x1d')](handleError(_0x49b698,null));};exports['destroy']=function(_0x50ed2d,_0x401345){return db[_0xa8ca('0x2f')][_0xa8ca('0x4a')]({'where':{'id':_0x50ed2d['params']['id']}})[_0xa8ca('0x16')](handleEntityNotFound(_0x401345,null))[_0xa8ca('0x16')](removeEntity(_0x401345,null))[_0xa8ca('0x1d')](handleError(_0x401345,null));};exports[_0xa8ca('0x4d')]=function(_0x1bb1de,_0x5ef7ec,_0x563d5b){var _0x1e3846={};var _0x202f9d={};var _0x3b1eda;var _0xfa3aed;return db[_0xa8ca('0x2f')][_0xa8ca('0x4e')]({'where':{'id':_0x1bb1de[_0xa8ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ef7ec,null))['then'](function(_0xf08a0d){if(_0xf08a0d){_0x3b1eda=_0xf08a0d;_0x202f9d['model']=_[_0xa8ca('0x32')](db[_0xa8ca('0x4f')]['rawAttributes']);_0x202f9d['query']=_[_0xa8ca('0x32')](_0x1bb1de['query']);_0x202f9d[_0xa8ca('0x36')]=_[_0xa8ca('0x37')](_0x202f9d[_0xa8ca('0x31')],_0x202f9d['query']);_0x1e3846[_0xa8ca('0x38')]=_[_0xa8ca('0x37')](_0x202f9d[_0xa8ca('0x31')],qs[_0xa8ca('0x39')](_0x1bb1de[_0xa8ca('0x33')][_0xa8ca('0x39')]));_0x1e3846[_0xa8ca('0x38')]=_0x1e3846[_0xa8ca('0x38')][_0xa8ca('0x3a')]?_0x1e3846[_0xa8ca('0x38')]:_0x202f9d[_0xa8ca('0x31')];_0x1e3846[_0xa8ca('0x3c')]=qs['sort'](_0x1bb1de[_0xa8ca('0x33')]['sort']);_0x1e3846['where']=qs[_0xa8ca('0x36')](_['pick'](_0x1bb1de[_0xa8ca('0x33')],_0x202f9d[_0xa8ca('0x36')]));if(_0x1bb1de[_0xa8ca('0x33')][_0xa8ca('0x42')]){_0x1e3846['where']=_[_0xa8ca('0x41')](_0x1e3846[_0xa8ca('0x3e')],{'$or':_[_0xa8ca('0x43')](_0x1e3846[_0xa8ca('0x38')],function(_0x2bd36e){var _0x46ee8a={};_0x46ee8a[_0x2bd36e]={'$like':'%'+_0x1bb1de[_0xa8ca('0x33')][_0xa8ca('0x42')]+'%'};return _0x46ee8a;})});}_0x1e3846=_[_0xa8ca('0x41')]({},_0x1e3846,_0x1bb1de['options']);return _0x3b1eda[_0xa8ca('0x4d')](_0x1e3846);}})[_0xa8ca('0x16')](function(_0x2b8bbf){if(_0x2b8bbf){_0xfa3aed=_0x2b8bbf[_0xa8ca('0x3a')];if(!_0x1bb1de[_0xa8ca('0x33')][_0xa8ca('0x3b')](_0xa8ca('0x50'))){_0x1e3846[_0xa8ca('0x23')]=qs[_0xa8ca('0x23')](_0x1bb1de[_0xa8ca('0x33')][_0xa8ca('0x23')]);_0x1e3846[_0xa8ca('0x22')]=qs[_0xa8ca('0x22')](_0x1bb1de['query'][_0xa8ca('0x22')]);}return _0x3b1eda[_0xa8ca('0x4d')](_0x1e3846);}})[_0xa8ca('0x16')](function(_0x40e064){if(_0x40e064){return _0x40e064?{'count':_0xfa3aed,'rows':_0x40e064}:null;}})[_0xa8ca('0x16')](respondWithResult(_0x5ef7ec,null))['catch'](handleError(_0x5ef7ec,null));};exports[_0xa8ca('0x51')]=function(_0xe61296,_0x593b99,_0x4ff78b){if(_0xe61296['body']['id']){delete _0xe61296[_0xa8ca('0x4c')]['id'];}return db[_0xa8ca('0x2f')][_0xa8ca('0x4e')]({'where':{'id':_0xe61296[_0xa8ca('0x48')]['id']}})[_0xa8ca('0x16')](handleEntityNotFound(_0x593b99,null))[_0xa8ca('0x16')](function(_0x2592b1){if(_0x2592b1){_0xe61296['body'][_0xa8ca('0x52')]=_0x2592b1['id'];_0xe61296[_0xa8ca('0x4c')][_0xa8ca('0x53')]=integrations[_0xa8ca('0x54')](_0xe61296[_0xa8ca('0x4c')][_0xa8ca('0x55')],_0xe61296[_0xa8ca('0x4c')][_0xa8ca('0x56')]);_0xe61296[_0xa8ca('0x4c')][_0xa8ca('0x57')]=integrations[_0xa8ca('0x58')](_0xe61296[_0xa8ca('0x4c')][_0xa8ca('0x55')],_0xe61296['body'][_0xa8ca('0x56')]);return db[_0xa8ca('0x4f')]['create'](_0xe61296[_0xa8ca('0x4c')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xa8ca('0x57')}]});}return null;})[_0xa8ca('0x16')](respondWithResult(_0x593b99,null))[_0xa8ca('0x1d')](handleError(_0x593b99,null));};exports[_0xa8ca('0x59')]=function(_0x1e9eb9,_0x1352f5,_0x2c8161){return db[_0xa8ca('0x2f')][_0xa8ca('0x4e')]({'where':{'id':_0x1e9eb9[_0xa8ca('0x48')]['id']},'attributes':['id',_0xa8ca('0x5a'),_0xa8ca('0x5b')]})[_0xa8ca('0x16')](handleEntityNotFound(_0x1352f5,null))[_0xa8ca('0x16')](function(_0x1f062d){if(_0x1f062d){return rp({'method':'GET','uri':util[_0xa8ca('0x5c')](_0xa8ca('0x5d'),_0x1f062d[_0xa8ca('0x5a')]),'qs':{'authtoken':_0x1f062d[_0xa8ca('0x5b')],'scope':'crmapi'},'json':!![]});}})[_0xa8ca('0x16')](function(_0x166421){if(_0x166421){if(_0x166421[_0xa8ca('0x5e')]&&_0x166421[_0xa8ca('0x5e')][_0xa8ca('0x1a')]){throw new Error(_0x166421[_0xa8ca('0x5e')][_0xa8ca('0x1a')]['message']);}var _0x32613f=[];if(_0x166421[_0xa8ca('0x5f')]&&_0x166421['Calls']['section']){if(_0x166421[_0xa8ca('0x5f')][_0xa8ca('0x60')]['FL']){var _0x3b5c91=[_0xa8ca('0x61')];for(var _0x3ca579=0x0,_0x448ab1=_0x166421[_0xa8ca('0x5f')][_0xa8ca('0x60')]['FL']['length'];_0x3ca579<_0x448ab1;_0x3ca579++){if(_['includes'](_0x3b5c91,_0x166421[_0xa8ca('0x5f')]['section']['FL'][_0x3ca579]['dv'])){_0x32613f[_0xa8ca('0x62')]({'id':_0x166421['Calls'][_0xa8ca('0x60')]['FL'][_0x3ca579]['dv'],'name':_0x166421['Calls'][_0xa8ca('0x60')]['FL'][_0x3ca579]['label'],'custom':_0x166421[_0xa8ca('0x5f')][_0xa8ca('0x60')]['FL'][_0x3ca579][_0xa8ca('0x63')]===_0xa8ca('0x64')?!![]:![],'options':_0x166421[_0xa8ca('0x5f')][_0xa8ca('0x60')]['FL'][_0x3ca579][_0xa8ca('0x56')]===_0xa8ca('0x65')&&_0x166421[_0xa8ca('0x5f')][_0xa8ca('0x60')]['FL'][_0x3ca579][_0xa8ca('0x66')]?_[_0xa8ca('0x43')](_0x166421[_0xa8ca('0x5f')][_0xa8ca('0x60')]['FL'][_0x3ca579][_0xa8ca('0x66')],function(_0x31adfe){return{'name':_0x31adfe,'value':_0x31adfe};}):[]});}}}}return{'count':_0x32613f['length'],'rows':_0x32613f};}})[_0xa8ca('0x16')](respondWithResult(_0x1352f5,null))[_0xa8ca('0x1d')](function(_0x5f49e4){var _0x3c3fb0=_0x1e9eb9[_0xa8ca('0x33')][_0xa8ca('0x67')]?0x1f4:_0x5f49e4[_0xa8ca('0x68')]||0x1f4;logger[_0xa8ca('0x1a')](_0xa8ca('0x69'),_0xa8ca('0x59'),_0x3c3fb0,JSON['stringify'](_0x5f49e4));delete _0x5f49e4['name'];if(_0x3c3fb0===0x191){_0x3c3fb0=0x190;}_0x1352f5[_0xa8ca('0x1f')](_0x3c3fb0)['send'](_0x1e9eb9[_0xa8ca('0x33')][_0xa8ca('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x5f49e4[_0xa8ca('0x68')]}:_0x5f49e4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b5e9cf3..1f26e48 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 _0x9e82=['../../config/logger','api','moment','bluebird','request-promise','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e82,0x18a));var _0x29e8=function(_0x5b9a03,_0x12cc1b){_0x5b9a03=_0x5b9a03-0x0;var _0x263565=_0x9e82[_0x5b9a03];return _0x263565;};'use strict';var _=require(_0x29e8('0x0'));var util=require(_0x29e8('0x1'));var logger=require(_0x29e8('0x2'))(_0x29e8('0x3'));var moment=require(_0x29e8('0x4'));var BPromise=require(_0x29e8('0x5'));var rp=require(_0x29e8('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x29e8('0x7'));module['exports']=function(_0x5d006f,_0x2e39e5){return _0x5d006f[_0x29e8('0x8')](_0x29e8('0x9'),attributes,{'tableName':_0x29e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccdc=['int_zoho_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2432a0,_0x2fe095){var _0x37b4fa=function(_0xf67f14){while(--_0xf67f14){_0x2432a0['push'](_0x2432a0['shift']());}};_0x37b4fa(++_0x2fe095);}(_0xccdc,0xe7));var _0xcccd=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xccdc[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var logger=require(_0xcccd('0x2'))(_0xcccd('0x3'));var moment=require('moment');var BPromise=require(_0xcccd('0x4'));var rp=require(_0xcccd('0x5'));var attributes=require(_0xcccd('0x6'));var integrations=require(_0xcccd('0x7'));module[_0xcccd('0x8')]=function(_0x3ad9c6,_0x50ac3b){return _0x3ad9c6['define']('ZohoAccount',attributes,{'tableName':_0xcccd('0x9'),'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 2d973a2..f5cbbba 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 _0x7bc9=['message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','then','find','ShowZohoAccount','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc1ef62,_0x11f897){var _0x5af121=function(_0xa46d8e){while(--_0xa46d8e){_0xc1ef62['push'](_0xc1ef62['shift']());}};_0x5af121(++_0x11f897);}(_0x7bc9,0x128));var _0x97bc=function(_0x3f2df6,_0x1c6a9c){_0x3f2df6=_0x3f2df6-0x0;var _0x483997=_0x7bc9[_0x3f2df6];return _0x483997;};'use strict';var _=require('lodash');var util=require(_0x97bc('0x0'));var moment=require('moment');var BPromise=require(_0x97bc('0x1'));var rs=require(_0x97bc('0x2'));var fs=require('fs');var db=require(_0x97bc('0x3'))['db'];var utils=require(_0x97bc('0x4'));var logger=require(_0x97bc('0x5'))('rpc');var config=require(_0x97bc('0x6'));var jayson=require(_0x97bc('0x7'));var client=jayson[_0x97bc('0x8')][_0x97bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ed0e,_0x18be89,_0x437f44){return new BPromise(function(_0x4799e6,_0x26f851){return client[_0x97bc('0xa')](_0x23ed0e,_0x437f44)['then'](function(_0x26d787){logger[_0x97bc('0xb')](_0x97bc('0xc'),_0x18be89,_0x97bc('0xd'));logger[_0x97bc('0xe')](_0x97bc('0xf'),_0x18be89,'request\x20sent',JSON[_0x97bc('0x10')](_0x26d787));if(_0x26d787[_0x97bc('0x11')]){if(_0x26d787[_0x97bc('0x11')][_0x97bc('0x12')]===0x1f4){logger[_0x97bc('0x11')](_0x97bc('0xc'),_0x18be89,_0x26d787[_0x97bc('0x11')]['message']);return _0x26f851(_0x26d787[_0x97bc('0x11')][_0x97bc('0x13')]);}logger[_0x97bc('0x11')](_0x97bc('0xc'),_0x18be89,_0x26d787['error'][_0x97bc('0x13')]);return _0x4799e6(_0x26d787[_0x97bc('0x11')][_0x97bc('0x13')]);}else{logger[_0x97bc('0xb')](_0x97bc('0xc'),_0x18be89,_0x97bc('0xd'));_0x4799e6(_0x26d787[_0x97bc('0x14')]['message']);}})[_0x97bc('0x15')](function(_0x2f06ca){logger[_0x97bc('0x11')](_0x97bc('0xc'),_0x18be89,_0x2f06ca);_0x26f851(_0x2f06ca);});});}exports[_0x97bc('0x16')]=function(_0x40809b){var _0x33a2fe=this;return new Promise(function(_0x48a9d2,_0x2b1de1){return db[_0x97bc('0x17')][_0x97bc('0x18')]({'raw':_0x40809b[_0x97bc('0x19')]?_0x40809b['options'][_0x97bc('0x1a')]===undefined?!![]:![]:!![],'where':_0x40809b[_0x97bc('0x19')]?_0x40809b['options'][_0x97bc('0x1b')]||null:null,'attributes':_0x40809b['options']?_0x40809b[_0x97bc('0x19')][_0x97bc('0x1c')]||null:null,'limit':_0x40809b[_0x97bc('0x19')]?_0x40809b[_0x97bc('0x19')]['limit']||null:null,'include':_0x40809b[_0x97bc('0x19')]?_0x40809b[_0x97bc('0x19')][_0x97bc('0x1d')]?_[_0x97bc('0x1e')](_0x40809b[_0x97bc('0x19')][_0x97bc('0x1d')],function(_0x13ee0d){return{'model':db[_0x13ee0d[_0x97bc('0x1f')]],'as':_0x13ee0d['as'],'attributes':_0x13ee0d['attributes'],'include':_0x13ee0d['include']?_['map'](_0x13ee0d[_0x97bc('0x1d')],function(_0x157cf8){return{'model':db[_0x157cf8['model']],'as':_0x157cf8['as'],'attributes':_0x157cf8[_0x97bc('0x1c')],'include':_0x157cf8[_0x97bc('0x1d')]?_[_0x97bc('0x1e')](_0x157cf8[_0x97bc('0x1d')],function(_0x3b74df){return{'model':db[_0x3b74df[_0x97bc('0x1f')]],'as':_0x3b74df['as'],'attributes':_0x3b74df[_0x97bc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x97bc('0x20')](function(_0x6d3d11){logger['info'](_0x97bc('0x16'),_0x40809b);logger[_0x97bc('0xe')](_0x97bc('0x16'),_0x40809b,JSON[_0x97bc('0x10')](_0x6d3d11));_0x48a9d2(_0x6d3d11);})[_0x97bc('0x15')](function(_0x5a7b0d){logger['error'](_0x97bc('0x16'),_0x5a7b0d['message'],_0x40809b);_0x2b1de1(_0x33a2fe[_0x97bc('0x11')](0x1f4,_0x5a7b0d[_0x97bc('0x13')]));});});};exports['ShowZohoAccount']=function(_0x2a0e25){var _0x23832b=this;return new Promise(function(_0x45826e,_0x9877f8){return db[_0x97bc('0x17')][_0x97bc('0x21')]({'raw':_0x2a0e25['options']?_0x2a0e25[_0x97bc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2a0e25['options']?_0x2a0e25[_0x97bc('0x19')][_0x97bc('0x1b')]||null:null,'attributes':_0x2a0e25[_0x97bc('0x19')]?_0x2a0e25[_0x97bc('0x19')][_0x97bc('0x1c')]||null:null,'include':_0x2a0e25[_0x97bc('0x19')]?_0x2a0e25['options'][_0x97bc('0x1d')]?_[_0x97bc('0x1e')](_0x2a0e25[_0x97bc('0x19')]['include'],function(_0x2b61c0){return{'model':db[_0x2b61c0['model']],'as':_0x2b61c0['as'],'attributes':_0x2b61c0[_0x97bc('0x1c')],'include':_0x2b61c0['include']?_[_0x97bc('0x1e')](_0x2b61c0[_0x97bc('0x1d')],function(_0xe3ff20){return{'model':db[_0xe3ff20[_0x97bc('0x1f')]],'as':_0xe3ff20['as'],'attributes':_0xe3ff20[_0x97bc('0x1c')],'include':_0xe3ff20[_0x97bc('0x1d')]?_[_0x97bc('0x1e')](_0xe3ff20[_0x97bc('0x1d')],function(_0x54c3c0){return{'model':db[_0x54c3c0[_0x97bc('0x1f')]],'as':_0x54c3c0['as'],'attributes':_0x54c3c0[_0x97bc('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50a963){logger['info'](_0x97bc('0x22'),_0x2a0e25);logger[_0x97bc('0xe')](_0x97bc('0x22'),_0x2a0e25,JSON[_0x97bc('0x10')](_0x50a963));_0x45826e(_0x50a963);})['catch'](function(_0x163ba2){logger[_0x97bc('0x11')](_0x97bc('0x22'),_0x163ba2[_0x97bc('0x13')],_0x2a0e25);_0x9877f8(_0x23832b[_0x97bc('0x11')](0x1f4,_0x163ba2['message']));});});}; \ No newline at end of file +var _0xceda=['request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowZohoAccount','find','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0xceda,0x1c4));var _0xaced=function(_0x53e1e2,_0x298b2f){_0x53e1e2=_0x53e1e2-0x0;var _0x33af8c=_0xceda[_0x53e1e2];return _0x33af8c;};'use strict';var _=require(_0xaced('0x0'));var util=require(_0xaced('0x1'));var moment=require(_0xaced('0x2'));var BPromise=require(_0xaced('0x3'));var rs=require(_0xaced('0x4'));var fs=require('fs');var db=require(_0xaced('0x5'))['db'];var utils=require(_0xaced('0x6'));var logger=require(_0xaced('0x7'))(_0xaced('0x8'));var config=require(_0xaced('0x9'));var jayson=require(_0xaced('0xa'));var client=jayson[_0xaced('0xb')][_0xaced('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4bd96d,_0x42f97f,_0x50b9e8){return new BPromise(function(_0x5ef911,_0x4818a3){return client[_0xaced('0xd')](_0x4bd96d,_0x50b9e8)['then'](function(_0x12d8e8){logger[_0xaced('0xe')](_0xaced('0xf'),_0x42f97f,_0xaced('0x10'));logger['debug'](_0xaced('0x11'),_0x42f97f,_0xaced('0x10'),JSON[_0xaced('0x12')](_0x12d8e8));if(_0x12d8e8[_0xaced('0x13')]){if(_0x12d8e8[_0xaced('0x13')][_0xaced('0x14')]===0x1f4){logger[_0xaced('0x13')](_0xaced('0xf'),_0x42f97f,_0x12d8e8[_0xaced('0x13')][_0xaced('0x15')]);return _0x4818a3(_0x12d8e8['error'][_0xaced('0x15')]);}logger[_0xaced('0x13')](_0xaced('0xf'),_0x42f97f,_0x12d8e8[_0xaced('0x13')][_0xaced('0x15')]);return _0x5ef911(_0x12d8e8[_0xaced('0x13')][_0xaced('0x15')]);}else{logger[_0xaced('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x42f97f,'request\x20sent');_0x5ef911(_0x12d8e8[_0xaced('0x16')][_0xaced('0x15')]);}})[_0xaced('0x17')](function(_0x3c155f){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x42f97f,_0x3c155f);_0x4818a3(_0x3c155f);});});}exports[_0xaced('0x18')]=function(_0x54574d){var _0x3853d3=this;return new Promise(function(_0x58200e,_0x212789){return db[_0xaced('0x19')][_0xaced('0x1a')]({'raw':_0x54574d['options']?_0x54574d[_0xaced('0x1b')][_0xaced('0x1c')]===undefined?!![]:![]:!![],'where':_0x54574d[_0xaced('0x1b')]?_0x54574d[_0xaced('0x1b')][_0xaced('0x1d')]||null:null,'attributes':_0x54574d['options']?_0x54574d[_0xaced('0x1b')][_0xaced('0x1e')]||null:null,'limit':_0x54574d[_0xaced('0x1b')]?_0x54574d[_0xaced('0x1b')][_0xaced('0x1f')]||null:null,'include':_0x54574d[_0xaced('0x1b')]?_0x54574d[_0xaced('0x1b')][_0xaced('0x20')]?_['map'](_0x54574d[_0xaced('0x1b')][_0xaced('0x20')],function(_0x88fa05){return{'model':db[_0x88fa05[_0xaced('0x21')]],'as':_0x88fa05['as'],'attributes':_0x88fa05[_0xaced('0x1e')],'include':_0x88fa05[_0xaced('0x20')]?_[_0xaced('0x22')](_0x88fa05[_0xaced('0x20')],function(_0x53a50a){return{'model':db[_0x53a50a[_0xaced('0x21')]],'as':_0x53a50a['as'],'attributes':_0x53a50a[_0xaced('0x1e')],'include':_0x53a50a[_0xaced('0x20')]?_[_0xaced('0x22')](_0x53a50a[_0xaced('0x20')],function(_0x4ce695){return{'model':db[_0x4ce695[_0xaced('0x21')]],'as':_0x4ce695['as'],'attributes':_0x4ce695[_0xaced('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaced('0x23')](function(_0x2d0853){logger[_0xaced('0xe')](_0xaced('0x18'),_0x54574d);logger['debug'](_0xaced('0x18'),_0x54574d,JSON[_0xaced('0x12')](_0x2d0853));_0x58200e(_0x2d0853);})[_0xaced('0x17')](function(_0x3a7fb9){logger[_0xaced('0x13')](_0xaced('0x18'),_0x3a7fb9[_0xaced('0x15')],_0x54574d);_0x212789(_0x3853d3[_0xaced('0x13')](0x1f4,_0x3a7fb9[_0xaced('0x15')]));});});};exports[_0xaced('0x24')]=function(_0x4449a3){var _0x165636=this;return new Promise(function(_0xf3b73b,_0x25c1fe){return db['ZohoAccount'][_0xaced('0x25')]({'raw':_0x4449a3['options']?_0x4449a3['options'][_0xaced('0x1c')]===undefined?!![]:![]:!![],'where':_0x4449a3['options']?_0x4449a3[_0xaced('0x1b')][_0xaced('0x1d')]||null:null,'attributes':_0x4449a3[_0xaced('0x1b')]?_0x4449a3[_0xaced('0x1b')][_0xaced('0x1e')]||null:null,'include':_0x4449a3['options']?_0x4449a3[_0xaced('0x1b')]['include']?_[_0xaced('0x22')](_0x4449a3['options'][_0xaced('0x20')],function(_0x3b6ea3){return{'model':db[_0x3b6ea3[_0xaced('0x21')]],'as':_0x3b6ea3['as'],'attributes':_0x3b6ea3[_0xaced('0x1e')],'include':_0x3b6ea3[_0xaced('0x20')]?_[_0xaced('0x22')](_0x3b6ea3[_0xaced('0x20')],function(_0x3c2a20){return{'model':db[_0x3c2a20[_0xaced('0x21')]],'as':_0x3c2a20['as'],'attributes':_0x3c2a20[_0xaced('0x1e')],'include':_0x3c2a20['include']?_['map'](_0x3c2a20[_0xaced('0x20')],function(_0x2d07ef){return{'model':db[_0x2d07ef['model']],'as':_0x2d07ef['as'],'attributes':_0x2d07ef[_0xaced('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ca3d0){logger['info'](_0xaced('0x24'),_0x4449a3);logger[_0xaced('0x26')]('ShowZohoAccount',_0x4449a3,JSON[_0xaced('0x12')](_0x3ca3d0));_0xf3b73b(_0x3ca3d0);})[_0xaced('0x17')](function(_0x27ec9e){logger['error'](_0xaced('0x24'),_0x27ec9e['message'],_0x4449a3);_0x25c1fe(_0x165636[_0xaced('0x13')](0x1f4,_0x27ec9e[_0xaced('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 67fdab1..04bb61c 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 _0x6037=['getSubjects','/:id/descriptions','getDescriptions','post','create','delete','/:id','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x6037,0x1c0));var _0x7603=function(_0x1c16d6,_0x588043){_0x1c16d6=_0x1c16d6-0x0;var _0x159be4=_0x6037[_0x1c16d6];return _0x159be4;};'use strict';var multer=require(_0x7603('0x0'));var util=require(_0x7603('0x1'));var path=require(_0x7603('0x2'));var express=require(_0x7603('0x3'));var router=express[_0x7603('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7603('0x5'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x7603('0x6')]('/',auth[_0x7603('0x7')](),controller[_0x7603('0x8')]);router[_0x7603('0x6')]('/:id',auth[_0x7603('0x7')](),controller[_0x7603('0x9')]);router['get'](_0x7603('0xa'),auth[_0x7603('0x7')](),controller[_0x7603('0xb')]);router['get']('/:id/subjects',auth[_0x7603('0x7')](),controller[_0x7603('0xc')]);router[_0x7603('0x6')](_0x7603('0xd'),auth[_0x7603('0x7')](),controller[_0x7603('0xe')]);router[_0x7603('0xf')]('/',auth[_0x7603('0x7')](),controller[_0x7603('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7603('0x11')](_0x7603('0x12'),auth[_0x7603('0x7')](),controller['destroy']);module[_0x7603('0x13')]=router; \ No newline at end of file +var _0x6bfe=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bfe,0x1a1));var _0xe6bf=function(_0x12a1ae,_0x1c7883){_0x12a1ae=_0x12a1ae-0x0;var _0x368190=_0x6bfe[_0x12a1ae];return _0x368190;};'use strict';var multer=require('multer');var util=require(_0xe6bf('0x0'));var path=require(_0xe6bf('0x1'));var express=require(_0xe6bf('0x2'));var router=express[_0xe6bf('0x3')]();var auth=require(_0xe6bf('0x4'));var interaction=require(_0xe6bf('0x5'));var config=require(_0xe6bf('0x6'));var controller=require(_0xe6bf('0x7'));router[_0xe6bf('0x8')]('/',auth[_0xe6bf('0x9')](),controller[_0xe6bf('0xa')]);router['get'](_0xe6bf('0xb'),auth['isAuthenticated'](),controller[_0xe6bf('0xc')]);router[_0xe6bf('0x8')]('/:id/fields',auth[_0xe6bf('0x9')](),controller['getFields']);router[_0xe6bf('0x8')](_0xe6bf('0xd'),auth[_0xe6bf('0x9')](),controller['getSubjects']);router['get'](_0xe6bf('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xe6bf('0xf')]('/',auth[_0xe6bf('0x9')](),controller[_0xe6bf('0x10')]);router[_0xe6bf('0x11')](_0xe6bf('0xb'),auth[_0xe6bf('0x9')](),controller[_0xe6bf('0x12')]);router[_0xe6bf('0x13')]('/:id',auth[_0xe6bf('0x9')](),controller[_0xe6bf('0x14')]);module[_0xe6bf('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6a12410..faf87bd 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 _0x87a9=['sequelize','exports','STRING'];(function(_0xb564dc,_0x4802fe){var _0x38e7df=function(_0x10b0dd){while(--_0x10b0dd){_0xb564dc['push'](_0xb564dc['shift']());}};_0x38e7df(++_0x4802fe);}(_0x87a9,0x1a4));var _0x987a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x87a9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x987a('0x0'));module[_0x987a('0x1')]={'name':{'type':Sequelize[_0x987a('0x2')]},'description':{'type':Sequelize[_0x987a('0x2')]}}; \ No newline at end of file +var _0x6fbe=['sequelize','exports','STRING'];(function(_0x1960c5,_0x5ceb7b){var _0x2b0622=function(_0x3aa738){while(--_0x3aa738){_0x1960c5['push'](_0x1960c5['shift']());}};_0x2b0622(++_0x5ceb7b);}(_0x6fbe,0x120));var _0xe6fb=function(_0x1a46e8,_0x36dea6){_0x1a46e8=_0x1a46e8-0x0;var _0x41806f=_0x6fbe[_0x1a46e8];return _0x41806f;};'use strict';var Sequelize=require(_0xe6fb('0x0'));module[_0xe6fb('0x1')]={'name':{'type':Sequelize[_0xe6fb('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index ac4c39b..4332934 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 _0xb10b=['save','update','sendStatus','stack','name','index','ZohoConfiguration','rawAttributes','keys','query','dateStart','dateEnd','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','day','filter','map','merge','options','includeAll','include','findAll','show','params','intersection','find','create','body','destroy','getFields','ZohoField','getSubjects','findOne','getDescriptions','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x4940a0,_0x3f9be1){var _0x556f14=function(_0x119685){while(--_0x119685){_0x4940a0['push'](_0x4940a0['shift']());}};_0x556f14(++_0x3f9be1);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c16c4,_0x1f4fb2){_0x4c16c4=_0x4c16c4-0x0;var _0x2d2ddf=_0xb10b[_0x4c16c4];return _0x2d2ddf;};'use strict';var jsonpatch=require(_0xbb10('0x0'));var rp=require('request-promise');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var Mustache=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var sox=require(_0xbb10('0x5'));var csv=require(_0xbb10('0x6'));var ejs=require(_0xbb10('0x7'));var fs=require('fs');var _=require(_0xbb10('0x8'));var squel=require(_0xbb10('0x9'));var crypto=require('crypto');var jsforce=require(_0xbb10('0xa'));var deskjs=require(_0xbb10('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbb10('0xc'));var Papa=require(_0xbb10('0xd'));var qs=require(_0xbb10('0xe'));var logger=require(_0xbb10('0xf'))(_0xbb10('0x10'));var utils=require(_0xbb10('0x11'));var config=require(_0xbb10('0x12'));var db=require(_0xbb10('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xbb10('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x118a74,_0xce64f3,_0x5e136d,_0x408248){return new BPromise(function(_0x5be7e0,_0x44fb19){var _0x916a32=_0x408248||client;return _0x916a32[_0xbb10('0x15')](_0x118a74,_0x5e136d)[_0xbb10('0x16')](function(_0x442548){logger[_0xbb10('0x17')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xbb10('0x18'));logger[_0xbb10('0x19')](_0xbb10('0x1a'),_0xce64f3,_0xbb10('0x18'),JSON[_0xbb10('0x1b')](_0x442548));if(_0x442548[_0xbb10('0x1c')]){if(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1d')]===0x1f4){logger[_0xbb10('0x1c')](_0xbb10('0x1e'),_0xce64f3,_0x442548['error'][_0xbb10('0x1f')]);return _0x44fb19(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);}logger[_0xbb10('0x1c')](_0xbb10('0x1e'),_0xce64f3,_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);return _0x5be7e0(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);}else{logger[_0xbb10('0x17')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xbb10('0x18'));_0x5be7e0(_0x442548[_0xbb10('0x20')][_0xbb10('0x1f')]);}})[_0xbb10('0x21')](function(_0xdf237d){logger[_0xbb10('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xdf237d);_0x44fb19(_0xdf237d);});});}function respondWithStatusCode(_0x12f888,_0x12ef77){_0x12ef77=_0x12ef77||0xcc;return function(_0x50aea1){if(_0x50aea1){return _0x12f888['sendStatus'](_0x12ef77);}return _0x12f888[_0xbb10('0x22')](_0x12ef77)[_0xbb10('0x23')]();};}function respondWithResult(_0x2e911d,_0x317da4){_0x317da4=_0x317da4||0xc8;return function(_0x445761){if(_0x445761){return _0x2e911d[_0xbb10('0x22')](_0x317da4)[_0xbb10('0x24')](_0x445761);}};}function respondWithFilteredResult(_0x436104,_0x7f2377){return function(_0x395404){if(_0x395404){var _0x3ba6cd=_0x395404['count'],_0x26ad93=_0x7f2377[_0xbb10('0x25')],_0x537898=_0x7f2377[_0xbb10('0x25')]+_0x7f2377[_0xbb10('0x26')],_0x4fedac;if(_0x537898>=_0x3ba6cd){_0x537898=_0x3ba6cd;_0x4fedac=0xc8;}else{_0x4fedac=0xce;}_0x436104['status'](_0x4fedac);return _0x436104[_0xbb10('0x27')](_0xbb10('0x28'),_0x26ad93+'-'+_0x537898+'/'+_0x3ba6cd)[_0xbb10('0x24')](_0x395404);}return null;};}function patchUpdates(_0x1d5e95){return function(_0x1acce9){try{jsonpatch[_0xbb10('0x29')](_0x1acce9,_0x1d5e95,!![]);}catch(_0x2a0e8b){return BPromise['reject'](_0x2a0e8b);}return _0x1acce9[_0xbb10('0x2a')]();};}function saveUpdates(_0x21ac54,_0xfc3595){return function(_0x2e0249){if(_0x2e0249){return _0x2e0249[_0xbb10('0x2b')](_0x21ac54)[_0xbb10('0x16')](function(_0x5d5c80){return _0x5d5c80;});}return null;};}function removeEntity(_0x221624,_0x4ee02e){return function(_0x448d5c){if(_0x448d5c){return _0x448d5c['destroy']()[_0xbb10('0x16')](function(){_0x221624[_0xbb10('0x22')](0xcc)[_0xbb10('0x23')]();});}};}function handleEntityNotFound(_0x491db4,_0x518d47){return function(_0x4c3744){if(!_0x4c3744){_0x491db4[_0xbb10('0x2c')](0x194);}return _0x4c3744;};}function handleError(_0x4f590d,_0x359ad4){_0x359ad4=_0x359ad4||0x1f4;return function(_0x37dde7){logger[_0xbb10('0x1c')](_0x37dde7[_0xbb10('0x2d')]);if(_0x37dde7[_0xbb10('0x2e')]){delete _0x37dde7[_0xbb10('0x2e')];}_0x4f590d[_0xbb10('0x22')](_0x359ad4)['send'](_0x37dde7);};}exports[_0xbb10('0x2f')]=function(_0x1da9c9,_0x441d15){var _0x8c1ce6={},_0xfb2c5e={},_0x9de708={'count':0x0,'rows':[]};var _0x188cbd=db[_0xbb10('0x30')][_0xbb10('0x31')];_0xfb2c5e['model']=_[_0xbb10('0x32')](_0x188cbd);var _0x150107={'dateStart':_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x34')],'dateEnd':_0x1da9c9['query'][_0xbb10('0x35')]};delete _0x1da9c9['query']['dateStart'];delete _0x1da9c9[_0xbb10('0x33')][_0xbb10('0x35')];_0xfb2c5e[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x1da9c9[_0xbb10('0x33')]);_0xfb2c5e[_0xbb10('0x36')]=_['intersection'](_0xfb2c5e[_0xbb10('0x37')],_0xfb2c5e[_0xbb10('0x33')]);_0x8c1ce6['attributes']=_['intersection'](_0xfb2c5e['model'],qs[_0xbb10('0x38')](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x38')]));_0x8c1ce6['attributes']=_0x8c1ce6[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x8c1ce6[_0xbb10('0x39')]:_0xfb2c5e['model'];if(!_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x8c1ce6[_0xbb10('0x26')]=qs['limit'](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x26')]);_0x8c1ce6['offset']=qs[_0xbb10('0x25')](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x25')]);}_0x8c1ce6[_0xbb10('0x3d')]=qs[_0xbb10('0x3e')](_0x1da9c9[_0xbb10('0x33')]['sort']);_0x8c1ce6[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x1da9c9[_0xbb10('0x33')],_0xfb2c5e['filters']));if(_0x150107[_0xbb10('0x34')]){if(_0x150107[_0xbb10('0x35')]){_0x150107[_0xbb10('0x35')]=moment(_0x150107[_0xbb10('0x35')])['add'](0x1,_0xbb10('0x41'));}else{_0x150107[_0xbb10('0x35')]=moment(_0x150107['dateStart'])['add'](0x1,_0xbb10('0x41'));}_['merge'](_0x8c1ce6[_0xbb10('0x3f')],{'createdAt':{'$gte':_0x150107[_0xbb10('0x34')],'$lte':_0x150107['dateEnd']}});}if(_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x42')]){_0x8c1ce6[_0xbb10('0x3f')]=_['merge'](_0x8c1ce6[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x8c1ce6[_0xbb10('0x39')],function(_0x32b729){var _0x36e1fa={};_0x36e1fa[_0x32b729]={'$like':'%'+_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x42')]+'%'};return _0x36e1fa;})});}_0x8c1ce6=_[_0xbb10('0x44')]({},_0x8c1ce6,_0x1da9c9[_0xbb10('0x45')]);var _0x43b948={'where':_0x8c1ce6[_0xbb10('0x3f')]};return db[_0xbb10('0x30')]['count'](_0x43b948)[_0xbb10('0x16')](function(_0x41bbf8){_0x9de708['count']=_0x41bbf8;if(_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x46')]){_0x8c1ce6[_0xbb10('0x47')]=[{'all':!![]}];}return db[_0xbb10('0x30')][_0xbb10('0x48')](_0x8c1ce6);})[_0xbb10('0x16')](function(_0x3e06b0){_0x9de708['rows']=_0x3e06b0;return _0x9de708;})['then'](respondWithFilteredResult(_0x441d15,_0x8c1ce6))[_0xbb10('0x21')](handleError(_0x441d15,null));};exports[_0xbb10('0x49')]=function(_0x2b12bd,_0x57d2c0){var _0x5f0c12={'raw':![],'where':{'id':_0x2b12bd[_0xbb10('0x4a')]['id']}},_0x3cd6f3={};_0x3cd6f3[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x30')][_0xbb10('0x31')]);_0x3cd6f3[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x2b12bd[_0xbb10('0x33')]);_0x3cd6f3[_0xbb10('0x36')]=_['intersection'](_0x3cd6f3['model'],_0x3cd6f3[_0xbb10('0x33')]);_0x5f0c12[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x3cd6f3[_0xbb10('0x37')],qs[_0xbb10('0x38')](_0x2b12bd[_0xbb10('0x33')][_0xbb10('0x38')]));_0x5f0c12[_0xbb10('0x39')]=_0x5f0c12[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x5f0c12[_0xbb10('0x39')]:_0x3cd6f3[_0xbb10('0x37')];if(_0x2b12bd[_0xbb10('0x33')][_0xbb10('0x46')]){_0x5f0c12[_0xbb10('0x47')]=[{'all':!![]}];}_0x5f0c12=_['merge']({},_0x5f0c12,_0x2b12bd[_0xbb10('0x45')]);return db['ZohoConfiguration'][_0xbb10('0x4c')](_0x5f0c12)[_0xbb10('0x16')](handleEntityNotFound(_0x57d2c0,null))[_0xbb10('0x16')](respondWithResult(_0x57d2c0,null))[_0xbb10('0x21')](handleError(_0x57d2c0,null));};exports[_0xbb10('0x4d')]=function(_0x32d8e9,_0x2e3326){return db[_0xbb10('0x30')][_0xbb10('0x4d')](_0x32d8e9[_0xbb10('0x4e')],{})[_0xbb10('0x16')](respondWithResult(_0x2e3326,0xc9))[_0xbb10('0x21')](handleError(_0x2e3326,null));};exports[_0xbb10('0x2b')]=function(_0x3d7e17,_0x4475e1){if(_0x3d7e17['body']['id']){delete _0x3d7e17[_0xbb10('0x4e')]['id'];}return db[_0xbb10('0x30')][_0xbb10('0x4c')]({'where':{'id':_0x3d7e17[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x4475e1,null))[_0xbb10('0x16')](saveUpdates(_0x3d7e17['body'],null))[_0xbb10('0x16')](respondWithResult(_0x4475e1,null))[_0xbb10('0x21')](handleError(_0x4475e1,null));};exports[_0xbb10('0x4f')]=function(_0x14fed3,_0x432728){return db[_0xbb10('0x30')][_0xbb10('0x4c')]({'where':{'id':_0x14fed3[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x432728,null))[_0xbb10('0x16')](removeEntity(_0x432728,null))[_0xbb10('0x21')](handleError(_0x432728,null));};exports[_0xbb10('0x50')]=function(_0x16932f,_0x4e7fac,_0x4ea1a6){var _0x16272d={};var _0x3e6338={};var _0x3d0cb7;var _0x8b0a7d;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x16932f[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x4e7fac,null))[_0xbb10('0x16')](function(_0x2dd150){if(_0x2dd150){_0x3d0cb7=_0x2dd150;_0x3e6338[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x51')]['rawAttributes']);_0x3e6338[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x16932f['query']);_0x3e6338['filters']=_['intersection'](_0x3e6338[_0xbb10('0x37')],_0x3e6338[_0xbb10('0x33')]);_0x16272d[_0xbb10('0x39')]=_['intersection'](_0x3e6338['model'],qs['fields'](_0x16932f[_0xbb10('0x33')][_0xbb10('0x38')]));_0x16272d[_0xbb10('0x39')]=_0x16272d['attributes'][_0xbb10('0x3a')]?_0x16272d[_0xbb10('0x39')]:_0x3e6338['model'];_0x16272d['order']=qs[_0xbb10('0x3e')](_0x16932f[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x16272d[_0xbb10('0x3f')]=qs['filters'](_[_0xbb10('0x40')](_0x16932f[_0xbb10('0x33')],_0x3e6338[_0xbb10('0x36')]));if(_0x16932f['query'][_0xbb10('0x42')]){_0x16272d[_0xbb10('0x3f')]=_[_0xbb10('0x44')](_0x16272d['where'],{'$or':_[_0xbb10('0x43')](_0x16272d[_0xbb10('0x39')],function(_0x3b0f08){var _0x37b65f={};_0x37b65f[_0x3b0f08]={'$like':'%'+_0x16932f['query'][_0xbb10('0x42')]+'%'};return _0x37b65f;})});}_0x16272d=_[_0xbb10('0x44')]({},_0x16272d,_0x16932f[_0xbb10('0x45')]);return _0x3d0cb7[_0xbb10('0x50')](_0x16272d);}})['then'](function(_0x354ea7){if(_0x354ea7){_0x8b0a7d=_0x354ea7[_0xbb10('0x3a')];if(!_0x16932f[_0xbb10('0x33')][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x16272d[_0xbb10('0x26')]=qs[_0xbb10('0x26')](_0x16932f['query']['limit']);_0x16272d['offset']=qs[_0xbb10('0x25')](_0x16932f[_0xbb10('0x33')][_0xbb10('0x25')]);}return _0x3d0cb7['getFields'](_0x16272d);}})['then'](function(_0x46f462){if(_0x46f462){return _0x46f462?{'count':_0x8b0a7d,'rows':_0x46f462}:null;}})[_0xbb10('0x16')](respondWithResult(_0x4e7fac,null))[_0xbb10('0x21')](handleError(_0x4e7fac,null));};exports[_0xbb10('0x52')]=function(_0x260e06,_0x1ad2ed,_0x4cf2f3){var _0x1a5ca5={};var _0x15fae2={};var _0x270fdb;var _0x14f16b;return db[_0xbb10('0x30')]['findOne']({'where':{'id':_0x260e06['params']['id']}})['then'](handleEntityNotFound(_0x1ad2ed,null))[_0xbb10('0x16')](function(_0x1e0569){if(_0x1e0569){_0x270fdb=_0x1e0569;_0x15fae2[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x51')][_0xbb10('0x31')]);_0x15fae2['query']=_[_0xbb10('0x32')](_0x260e06['query']);_0x15fae2['filters']=_['intersection'](_0x15fae2[_0xbb10('0x37')],_0x15fae2[_0xbb10('0x33')]);_0x1a5ca5[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x15fae2['model'],qs[_0xbb10('0x38')](_0x260e06['query']['fields']));_0x1a5ca5[_0xbb10('0x39')]=_0x1a5ca5[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x1a5ca5[_0xbb10('0x39')]:_0x15fae2[_0xbb10('0x37')];_0x1a5ca5['order']=qs[_0xbb10('0x3e')](_0x260e06[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x1a5ca5[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x260e06[_0xbb10('0x33')],_0x15fae2['filters']));if(_0x260e06[_0xbb10('0x33')][_0xbb10('0x42')]){_0x1a5ca5[_0xbb10('0x3f')]=_[_0xbb10('0x44')](_0x1a5ca5[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x1a5ca5[_0xbb10('0x39')],function(_0x312a08){var _0x5a4429={};_0x5a4429[_0x312a08]={'$like':'%'+_0x260e06[_0xbb10('0x33')][_0xbb10('0x42')]+'%'};return _0x5a4429;})});}_0x1a5ca5=_[_0xbb10('0x44')]({},_0x1a5ca5,_0x260e06['options']);return _0x270fdb['getSubjects'](_0x1a5ca5);}})['then'](function(_0x23286d){if(_0x23286d){_0x14f16b=_0x23286d['length'];if(!_0x260e06['query'][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x1a5ca5[_0xbb10('0x26')]=qs[_0xbb10('0x26')](_0x260e06[_0xbb10('0x33')][_0xbb10('0x26')]);_0x1a5ca5[_0xbb10('0x25')]=qs[_0xbb10('0x25')](_0x260e06[_0xbb10('0x33')]['offset']);}return _0x270fdb[_0xbb10('0x52')](_0x1a5ca5);}})[_0xbb10('0x16')](function(_0x46b6d2){if(_0x46b6d2){return _0x46b6d2?{'count':_0x14f16b,'rows':_0x46b6d2}:null;}})[_0xbb10('0x16')](respondWithResult(_0x1ad2ed,null))['catch'](handleError(_0x1ad2ed,null));};exports['getDescriptions']=function(_0x3547a3,_0x2280bd,_0x30f0a4){var _0x32bb25={};var _0x5ee705={};var _0x17d596;var _0x275bce;return db[_0xbb10('0x30')][_0xbb10('0x53')]({'where':{'id':_0x3547a3[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2280bd,null))['then'](function(_0x372636){if(_0x372636){_0x17d596=_0x372636;_0x5ee705[_0xbb10('0x37')]=_[_0xbb10('0x32')](db['ZohoField'][_0xbb10('0x31')]);_0x5ee705[_0xbb10('0x33')]=_['keys'](_0x3547a3['query']);_0x5ee705[_0xbb10('0x36')]=_[_0xbb10('0x4b')](_0x5ee705[_0xbb10('0x37')],_0x5ee705['query']);_0x32bb25[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x5ee705[_0xbb10('0x37')],qs[_0xbb10('0x38')](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x38')]));_0x32bb25[_0xbb10('0x39')]=_0x32bb25[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x32bb25['attributes']:_0x5ee705[_0xbb10('0x37')];_0x32bb25[_0xbb10('0x3d')]=qs[_0xbb10('0x3e')](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x32bb25[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x3547a3[_0xbb10('0x33')],_0x5ee705[_0xbb10('0x36')]));if(_0x3547a3[_0xbb10('0x33')][_0xbb10('0x42')]){_0x32bb25['where']=_['merge'](_0x32bb25[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x32bb25[_0xbb10('0x39')],function(_0x3fd367){var _0x238c7a={};_0x238c7a[_0x3fd367]={'$like':'%'+_0x3547a3['query'][_0xbb10('0x42')]+'%'};return _0x238c7a;})});}_0x32bb25=_[_0xbb10('0x44')]({},_0x32bb25,_0x3547a3[_0xbb10('0x45')]);return _0x17d596[_0xbb10('0x54')](_0x32bb25);}})[_0xbb10('0x16')](function(_0x379d49){if(_0x379d49){_0x275bce=_0x379d49['length'];if(!_0x3547a3[_0xbb10('0x33')][_0xbb10('0x3b')]('nolimit')){_0x32bb25[_0xbb10('0x26')]=qs['limit'](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x26')]);_0x32bb25[_0xbb10('0x25')]=qs[_0xbb10('0x25')](_0x3547a3[_0xbb10('0x33')]['offset']);}return _0x17d596[_0xbb10('0x54')](_0x32bb25);}})['then'](function(_0x3fcc55){if(_0x3fcc55){return _0x3fcc55?{'count':_0x275bce,'rows':_0x3fcc55}:null;}})[_0xbb10('0x16')](respondWithResult(_0x2280bd,null))['catch'](handleError(_0x2280bd,null));}; \ No newline at end of file +var _0xa9e0=['limit','status','Content-Range','apply','reject','save','update','sendStatus','name','send','index','ZohoConfiguration','rawAttributes','model','dateStart','query','dateEnd','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','add','day','merge','filter','map','options','count','includeAll','rows','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','ZohoField','getDescriptions','pick','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','json','offset'];(function(_0x32c979,_0x31cf07){var _0x34ccbc=function(_0x2418e3){while(--_0x2418e3){_0x32c979['push'](_0x32c979['shift']());}};_0x34ccbc(++_0x31cf07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];var jayson=require(_0x0a9e('0xf'));var client=jayson[_0x0a9e('0x10')][_0x0a9e('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4a4c56,_0x50dfb2,_0x527cdd,_0x4cfe67){return new BPromise(function(_0x273d4d,_0x36471c){var _0xd5b662=_0x4cfe67||client;return _0xd5b662[_0x0a9e('0x12')](_0x4a4c56,_0x527cdd)[_0x0a9e('0x13')](function(_0x69aeb7){logger['info'](_0x0a9e('0x14'),_0x50dfb2,_0x0a9e('0x15'));logger[_0x0a9e('0x16')](_0x0a9e('0x17'),_0x50dfb2,_0x0a9e('0x15'),JSON[_0x0a9e('0x18')](_0x69aeb7));if(_0x69aeb7['error']){if(_0x69aeb7[_0x0a9e('0x19')]['code']===0x1f4){logger[_0x0a9e('0x19')]('ZohoConfiguration,\x20%s,\x20%s',_0x50dfb2,_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x36471c(_0x69aeb7['error'][_0x0a9e('0x1a')]);}logger['error'](_0x0a9e('0x14'),_0x50dfb2,_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x273d4d(_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}else{logger[_0x0a9e('0x1b')](_0x0a9e('0x14'),_0x50dfb2,_0x0a9e('0x15'));_0x273d4d(_0x69aeb7[_0x0a9e('0x1c')][_0x0a9e('0x1a')]);}})[_0x0a9e('0x1d')](function(_0x105080){logger['error'](_0x0a9e('0x14'),_0x50dfb2,_0x105080);_0x36471c(_0x105080);});});}function respondWithStatusCode(_0x155cce,_0x53682f){_0x53682f=_0x53682f||0xcc;return function(_0x20f109){if(_0x20f109){return _0x155cce['sendStatus'](_0x53682f);}return _0x155cce['status'](_0x53682f)[_0x0a9e('0x1e')]();};}function respondWithResult(_0x432e56,_0x38e7c4){_0x38e7c4=_0x38e7c4||0xc8;return function(_0x30bae6){if(_0x30bae6){return _0x432e56['status'](_0x38e7c4)[_0x0a9e('0x1f')](_0x30bae6);}};}function respondWithFilteredResult(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){var _0x370d86=_0x4d00e6['count'],_0x42ac8f=_0x3b45bc[_0x0a9e('0x20')],_0x16b1ca=_0x3b45bc[_0x0a9e('0x20')]+_0x3b45bc[_0x0a9e('0x21')],_0x5ea472;if(_0x16b1ca>=_0x370d86){_0x16b1ca=_0x370d86;_0x5ea472=0xc8;}else{_0x5ea472=0xce;}_0x2fb0e4[_0x0a9e('0x22')](_0x5ea472);return _0x2fb0e4['set'](_0x0a9e('0x23'),_0x42ac8f+'-'+_0x16b1ca+'/'+_0x370d86)['json'](_0x4d00e6);}return null;};}function patchUpdates(_0x45a1e7){return function(_0x5bfb33){try{jsonpatch[_0x0a9e('0x24')](_0x5bfb33,_0x45a1e7,!![]);}catch(_0x34dc65){return BPromise[_0x0a9e('0x25')](_0x34dc65);}return _0x5bfb33[_0x0a9e('0x26')]();};}function saveUpdates(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){return _0x11c3b6[_0x0a9e('0x27')](_0x140511)['then'](function(_0x3652a7){return _0x3652a7;});}return null;};}function removeEntity(_0x468813,_0x2b1f27){return function(_0x2ec755){if(_0x2ec755){return _0x2ec755['destroy']()[_0x0a9e('0x13')](function(){_0x468813[_0x0a9e('0x22')](0xcc)[_0x0a9e('0x1e')]();});}};}function handleEntityNotFound(_0x824a4f,_0x58b06f){return function(_0x563b45){if(!_0x563b45){_0x824a4f[_0x0a9e('0x28')](0x194);}return _0x563b45;};}function handleError(_0x2e8759,_0x1dbde2){_0x1dbde2=_0x1dbde2||0x1f4;return function(_0x540530){logger[_0x0a9e('0x19')](_0x540530['stack']);if(_0x540530[_0x0a9e('0x29')]){delete _0x540530[_0x0a9e('0x29')];}_0x2e8759[_0x0a9e('0x22')](_0x1dbde2)[_0x0a9e('0x2a')](_0x540530);};}exports[_0x0a9e('0x2b')]=function(_0x5180f1,_0x66c1d2){var _0x46f0a5={},_0x40cb85={},_0x2da5c0={'count':0x0,'rows':[]};var _0x2b45ea=db[_0x0a9e('0x2c')][_0x0a9e('0x2d')];_0x40cb85[_0x0a9e('0x2e')]=_['keys'](_0x2b45ea);var _0x44295a={'dateStart':_0x5180f1['query'][_0x0a9e('0x2f')],'dateEnd':_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x31')]};delete _0x5180f1[_0x0a9e('0x30')]['dateStart'];delete _0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x31')];_0x40cb85[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x5180f1['query']);_0x40cb85['filters']=_[_0x0a9e('0x33')](_0x40cb85['model'],_0x40cb85[_0x0a9e('0x30')]);_0x46f0a5[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x40cb85[_0x0a9e('0x2e')],qs['fields'](_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x46f0a5[_0x0a9e('0x34')]=_0x46f0a5['attributes'][_0x0a9e('0x36')]?_0x46f0a5[_0x0a9e('0x34')]:_0x40cb85[_0x0a9e('0x2e')];if(!_0x5180f1['query']['hasOwnProperty'](_0x0a9e('0x37'))){_0x46f0a5[_0x0a9e('0x21')]=qs['limit'](_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0x46f0a5[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5180f1['query']['offset']);}_0x46f0a5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5180f1['query'][_0x0a9e('0x39')]);_0x46f0a5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x5180f1[_0x0a9e('0x30')],_0x40cb85[_0x0a9e('0x3b')]));if(_0x44295a[_0x0a9e('0x2f')]){if(_0x44295a[_0x0a9e('0x31')]){_0x44295a[_0x0a9e('0x31')]=moment(_0x44295a[_0x0a9e('0x31')])[_0x0a9e('0x3c')](0x1,_0x0a9e('0x3d'));}else{_0x44295a[_0x0a9e('0x31')]=moment(_0x44295a[_0x0a9e('0x2f')])[_0x0a9e('0x3c')](0x1,_0x0a9e('0x3d'));}_[_0x0a9e('0x3e')](_0x46f0a5[_0x0a9e('0x3a')],{'createdAt':{'$gte':_0x44295a[_0x0a9e('0x2f')],'$lte':_0x44295a['dateEnd']}});}if(_0x5180f1['query'][_0x0a9e('0x3f')]){_0x46f0a5[_0x0a9e('0x3a')]=_[_0x0a9e('0x3e')](_0x46f0a5[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x46f0a5[_0x0a9e('0x34')],function(_0x10b040){var _0x445e25={};_0x445e25[_0x10b040]={'$like':'%'+_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0x445e25;})});}_0x46f0a5=_[_0x0a9e('0x3e')]({},_0x46f0a5,_0x5180f1[_0x0a9e('0x41')]);var _0x5026aa={'where':_0x46f0a5[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x42')](_0x5026aa)[_0x0a9e('0x13')](function(_0x2e8caf){_0x2da5c0[_0x0a9e('0x42')]=_0x2e8caf;if(_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x43')]){_0x46f0a5['include']=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x46f0a5);})[_0x0a9e('0x13')](function(_0x476688){_0x2da5c0[_0x0a9e('0x44')]=_0x476688;return _0x2da5c0;})['then'](respondWithFilteredResult(_0x66c1d2,_0x46f0a5))[_0x0a9e('0x1d')](handleError(_0x66c1d2,null));};exports[_0x0a9e('0x45')]=function(_0x4774f4,_0x34aa5a){var _0x45c845={'raw':![],'where':{'id':_0x4774f4[_0x0a9e('0x46')]['id']}},_0x37be73={};_0x37be73['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x37be73[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x4774f4[_0x0a9e('0x30')]);_0x37be73[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x37be73[_0x0a9e('0x2e')],_0x37be73['query']);_0x45c845[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x37be73['model'],qs['fields'](_0x4774f4['query'][_0x0a9e('0x35')]));_0x45c845[_0x0a9e('0x34')]=_0x45c845[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x45c845[_0x0a9e('0x34')]:_0x37be73[_0x0a9e('0x2e')];if(_0x4774f4[_0x0a9e('0x30')][_0x0a9e('0x43')]){_0x45c845['include']=[{'all':!![]}];}_0x45c845=_['merge']({},_0x45c845,_0x4774f4['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x47')](_0x45c845)[_0x0a9e('0x13')](handleEntityNotFound(_0x34aa5a,null))['then'](respondWithResult(_0x34aa5a,null))[_0x0a9e('0x1d')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x48')]=function(_0x53d113,_0x5a88da){return db[_0x0a9e('0x2c')]['create'](_0x53d113[_0x0a9e('0x49')],{})['then'](respondWithResult(_0x5a88da,0xc9))[_0x0a9e('0x1d')](handleError(_0x5a88da,null));};exports[_0x0a9e('0x27')]=function(_0x439340,_0x53613a){if(_0x439340[_0x0a9e('0x49')]['id']){delete _0x439340[_0x0a9e('0x49')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x439340[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x53613a,null))['then'](saveUpdates(_0x439340[_0x0a9e('0x49')],null))['then'](respondWithResult(_0x53613a,null))[_0x0a9e('0x1d')](handleError(_0x53613a,null));};exports['destroy']=function(_0xe22ccc,_0x4a6deb){return db['ZohoConfiguration']['find']({'where':{'id':_0xe22ccc[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a6deb,null))[_0x0a9e('0x13')](removeEntity(_0x4a6deb,null))[_0x0a9e('0x1d')](handleError(_0x4a6deb,null));};exports[_0x0a9e('0x4a')]=function(_0x19b4df,_0x232830,_0x272738){var _0xd10662={};var _0x28d814={};var _0x4e67ab;var _0x1c693e;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x19b4df[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x13')](function(_0x5d86e9){if(_0x5d86e9){_0x4e67ab=_0x5d86e9;_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x32')](db['ZohoField'][_0x0a9e('0x2d')]);_0x28d814['query']=_[_0x0a9e('0x32')](_0x19b4df['query']);_0x28d814['filters']=_['intersection'](_0x28d814[_0x0a9e('0x2e')],_0x28d814['query']);_0xd10662[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x28d814[_0x0a9e('0x2e')],qs[_0x0a9e('0x35')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0xd10662['attributes']=_0xd10662[_0x0a9e('0x34')]['length']?_0xd10662[_0x0a9e('0x34')]:_0x28d814[_0x0a9e('0x2e')];_0xd10662[_0x0a9e('0x38')]=qs['sort'](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0xd10662[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x19b4df[_0x0a9e('0x30')],_0x28d814[_0x0a9e('0x3b')]));if(_0x19b4df['query'][_0x0a9e('0x3f')]){_0xd10662[_0x0a9e('0x3a')]=_[_0x0a9e('0x3e')](_0xd10662[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0xd10662['attributes'],function(_0x176840){var _0x2937e0={};_0x2937e0[_0x176840]={'$like':'%'+_0x19b4df[_0x0a9e('0x30')]['filter']+'%'};return _0x2937e0;})});}_0xd10662=_[_0x0a9e('0x3e')]({},_0xd10662,_0x19b4df['options']);return _0x4e67ab['getFields'](_0xd10662);}})[_0x0a9e('0x13')](function(_0x4556c5){if(_0x4556c5){_0x1c693e=_0x4556c5[_0x0a9e('0x36')];if(!_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0xd10662[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0xd10662[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x20')]);}return _0x4e67ab[_0x0a9e('0x4a')](_0xd10662);}})[_0x0a9e('0x13')](function(_0x2a28c0){if(_0x2a28c0){return _0x2a28c0?{'count':_0x1c693e,'rows':_0x2a28c0}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x4d')]=function(_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={};var _0x4b341d;var _0x83f0b2;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x295763[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x243d12,null))['then'](function(_0x50cdce){if(_0x50cdce){_0x4b341d=_0x50cdce;_0x30944e['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x30944e[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x295763[_0x0a9e('0x30')]);_0x30944e[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x30944e['model'],_0x30944e[_0x0a9e('0x30')]);_0x1148a1[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x30944e['model'],qs[_0x0a9e('0x35')](_0x295763['query'][_0x0a9e('0x35')]));_0x1148a1[_0x0a9e('0x34')]=_0x1148a1['attributes'][_0x0a9e('0x36')]?_0x1148a1[_0x0a9e('0x34')]:_0x30944e[_0x0a9e('0x2e')];_0x1148a1[_0x0a9e('0x38')]=qs['sort'](_0x295763[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x1148a1[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x295763[_0x0a9e('0x30')],_0x30944e[_0x0a9e('0x3b')]));if(_0x295763[_0x0a9e('0x30')][_0x0a9e('0x3f')]){_0x1148a1['where']=_[_0x0a9e('0x3e')](_0x1148a1[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x1148a1[_0x0a9e('0x34')],function(_0x332367){var _0xdb98ca={};_0xdb98ca[_0x332367]={'$like':'%'+_0x295763[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0xdb98ca;})});}_0x1148a1=_[_0x0a9e('0x3e')]({},_0x1148a1,_0x295763[_0x0a9e('0x41')]);return _0x4b341d[_0x0a9e('0x4d')](_0x1148a1);}})[_0x0a9e('0x13')](function(_0x25744a){if(_0x25744a){_0x83f0b2=_0x25744a[_0x0a9e('0x36')];if(!_0x295763['query'][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0x1148a1[_0x0a9e('0x21')]=qs['limit'](_0x295763[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0x1148a1[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x295763['query']['offset']);}return _0x4b341d[_0x0a9e('0x4d')](_0x1148a1);}})[_0x0a9e('0x13')](function(_0x4c54fa){if(_0x4c54fa){return _0x4c54fa?{'count':_0x83f0b2,'rows':_0x4c54fa}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x243d12,null))['catch'](handleError(_0x243d12,null));};exports[_0x0a9e('0x4f')]=function(_0x8ebf02,_0x5637a1,_0x28a942){var _0x41cf12={};var _0x2d2286={};var _0x42b959;var _0x3755fe;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x8ebf02['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x5637a1,null))[_0x0a9e('0x13')](function(_0x45c109){if(_0x45c109){_0x42b959=_0x45c109;_0x2d2286[_0x0a9e('0x2e')]=_['keys'](db[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x2d2286['query']=_[_0x0a9e('0x32')](_0x8ebf02['query']);_0x2d2286[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x2d2286[_0x0a9e('0x2e')],_0x2d2286[_0x0a9e('0x30')]);_0x41cf12['attributes']=_['intersection'](_0x2d2286[_0x0a9e('0x2e')],qs[_0x0a9e('0x35')](_0x8ebf02[_0x0a9e('0x30')]['fields']));_0x41cf12[_0x0a9e('0x34')]=_0x41cf12[_0x0a9e('0x34')]['length']?_0x41cf12['attributes']:_0x2d2286[_0x0a9e('0x2e')];_0x41cf12['order']=qs['sort'](_0x8ebf02['query'][_0x0a9e('0x39')]);_0x41cf12[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x50')](_0x8ebf02[_0x0a9e('0x30')],_0x2d2286[_0x0a9e('0x3b')]));if(_0x8ebf02['query'][_0x0a9e('0x3f')]){_0x41cf12['where']=_[_0x0a9e('0x3e')](_0x41cf12[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x41cf12[_0x0a9e('0x34')],function(_0x50f8d7){var _0x46c9ac={};_0x46c9ac[_0x50f8d7]={'$like':'%'+_0x8ebf02[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0x46c9ac;})});}_0x41cf12=_['merge']({},_0x41cf12,_0x8ebf02[_0x0a9e('0x41')]);return _0x42b959[_0x0a9e('0x4f')](_0x41cf12);}})[_0x0a9e('0x13')](function(_0x22063c){if(_0x22063c){_0x3755fe=_0x22063c[_0x0a9e('0x36')];if(!_0x8ebf02[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0x41cf12['limit']=qs[_0x0a9e('0x21')](_0x8ebf02[_0x0a9e('0x30')]['limit']);_0x41cf12[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x8ebf02[_0x0a9e('0x30')]['offset']);}return _0x42b959[_0x0a9e('0x4f')](_0x41cf12);}})['then'](function(_0x8c8fbe){if(_0x8c8fbe){return _0x8c8fbe?{'count':_0x3755fe,'rows':_0x8c8fbe}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x5637a1,null))[_0x0a9e('0x1d')](handleError(_0x5637a1,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index deba221..d71db11 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 _0xa276=['int_zoho_configurations','util','../../config/logger','moment','bluebird','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x189a28,_0x496b3b){var _0x3fc4f0=function(_0x49e497){while(--_0x49e497){_0x189a28['push'](_0x189a28['shift']());}};_0x3fc4f0(++_0x496b3b);}(_0xa276,0x9a));var _0x6a27=function(_0x563973,_0x48b9f6){_0x563973=_0x563973-0x0;var _0x21b5ab=_0xa276[_0x563973];return _0x21b5ab;};'use strict';var _=require('lodash');var util=require(_0x6a27('0x0'));var logger=require(_0x6a27('0x1'))('api');var moment=require(_0x6a27('0x2'));var BPromise=require(_0x6a27('0x3'));var rp=require('request-promise');var attributes=require(_0x6a27('0x4'));module[_0x6a27('0x5')]=function(_0x18289f,_0x5c9089){return _0x18289f[_0x6a27('0x6')](_0x6a27('0x7'),attributes,{'tableName':_0x6a27('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32ff=['ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZohoConfiguration.attributes','exports','define'];(function(_0x13c8be,_0x38d136){var _0x1766be=function(_0x266def){while(--_0x266def){_0x13c8be['push'](_0x13c8be['shift']());}};_0x1766be(++_0x38d136);}(_0x32ff,0xc7));var _0xf32f=function(_0x44373f,_0x3076fd){_0x44373f=_0x44373f-0x0;var _0x17fbd2=_0x32ff[_0x44373f];return _0x17fbd2;};'use strict';var _=require(_0xf32f('0x0'));var util=require(_0xf32f('0x1'));var logger=require(_0xf32f('0x2'))(_0xf32f('0x3'));var moment=require(_0xf32f('0x4'));var BPromise=require(_0xf32f('0x5'));var rp=require(_0xf32f('0x6'));var attributes=require(_0xf32f('0x7'));module[_0xf32f('0x8')]=function(_0x397240,_0x1f6ca4){return _0x397240[_0xf32f('0x9')](_0xf32f('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 71317f8..6e5702f 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 _0x5f66=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','ZohoConfiguration,\x20%s,\x20%s','info','result','util','bluebird'];(function(_0x3045d2,_0x32717e){var _0x3f9b70=function(_0x15e759){while(--_0x15e759){_0x3045d2['push'](_0x3045d2['shift']());}};_0x3f9b70(++_0x32717e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var db=require(_0x65f6('0x3'))['db'];var utils=require(_0x65f6('0x4'));var logger=require(_0x65f6('0x5'))('rpc');var config=require(_0x65f6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65f6('0x7')][_0x65f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ec221,_0x4ed98f,_0x1c0e12){return new BPromise(function(_0x2c6571,_0x112079){return client[_0x65f6('0x9')](_0x4ec221,_0x1c0e12)[_0x65f6('0xa')](function(_0x14f4c7){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x4ed98f,_0x65f6('0xb'));logger[_0x65f6('0xc')](_0x65f6('0xd'),_0x4ed98f,_0x65f6('0xb'),JSON['stringify'](_0x14f4c7));if(_0x14f4c7[_0x65f6('0xe')]){if(_0x14f4c7['error']['code']===0x1f4){logger[_0x65f6('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x4ed98f,_0x14f4c7[_0x65f6('0xe')]['message']);return _0x112079(_0x14f4c7[_0x65f6('0xe')][_0x65f6('0xf')]);}logger[_0x65f6('0xe')](_0x65f6('0x10'),_0x4ed98f,_0x14f4c7[_0x65f6('0xe')][_0x65f6('0xf')]);return _0x2c6571(_0x14f4c7[_0x65f6('0xe')][_0x65f6('0xf')]);}else{logger[_0x65f6('0x11')](_0x65f6('0x10'),_0x4ed98f,'request\x20sent');_0x2c6571(_0x14f4c7[_0x65f6('0x12')]['message']);}})['catch'](function(_0x1693e6){logger[_0x65f6('0xe')](_0x65f6('0x10'),_0x4ed98f,_0x1693e6);_0x112079(_0x1693e6);});});} \ No newline at end of file +var _0xb10b=['code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xb10b,0x12a));var _0xbb10=function(_0x555479,_0x3aa2b4){_0x555479=_0x555479-0x0;var _0x560c8e=_0xb10b[_0x555479];return _0x560c8e;};'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 db=require('../../mysqldb')['db'];var utils=require(_0xbb10('0x4'));var logger=require(_0xbb10('0x5'))(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var jayson=require(_0xbb10('0x8'));var client=jayson[_0xbb10('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x328583,_0x3cdd53,_0x513741){return new BPromise(function(_0x1b9e94,_0x3fb675){return client[_0xbb10('0xa')](_0x328583,_0x513741)[_0xbb10('0xb')](function(_0x2353ef){logger[_0xbb10('0xc')](_0xbb10('0xd'),_0x3cdd53,_0xbb10('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3cdd53,_0xbb10('0xe'),JSON[_0xbb10('0xf')](_0x2353ef));if(_0x2353ef[_0xbb10('0x10')]){if(_0x2353ef['error'][_0xbb10('0x11')]===0x1f4){logger['error'](_0xbb10('0xd'),_0x3cdd53,_0x2353ef[_0xbb10('0x10')][_0xbb10('0x12')]);return _0x3fb675(_0x2353ef[_0xbb10('0x10')][_0xbb10('0x12')]);}logger[_0xbb10('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3cdd53,_0x2353ef[_0xbb10('0x10')][_0xbb10('0x12')]);return _0x1b9e94(_0x2353ef[_0xbb10('0x10')][_0xbb10('0x12')]);}else{logger[_0xbb10('0xc')](_0xbb10('0xd'),_0x3cdd53,_0xbb10('0xe'));_0x1b9e94(_0x2353ef[_0xbb10('0x13')][_0xbb10('0x12')]);}})[_0xbb10('0x14')](function(_0x4a2bfc){logger[_0xbb10('0x10')](_0xbb10('0xd'),_0x3cdd53,_0x4a2bfc);_0x3fb675(_0x4a2bfc);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 331baf4..4077015 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 _0x1666=['delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x550395,_0x474d30){var _0x3cec0=function(_0x1bdf7c){while(--_0x1bdf7c){_0x550395['push'](_0x550395['shift']());}};_0x3cec0(++_0x474d30);}(_0x1666,0x1c4));var _0x6166=function(_0x1682eb,_0x1b1c09){_0x1682eb=_0x1682eb-0x0;var _0x5bdf3b=_0x1666[_0x1682eb];return _0x5bdf3b;};'use strict';var multer=require(_0x6166('0x0'));var util=require('util');var path=require(_0x6166('0x1'));var express=require(_0x6166('0x2'));var router=express['Router']();var auth=require(_0x6166('0x3'));var interaction=require(_0x6166('0x4'));var config=require(_0x6166('0x5'));var controller=require(_0x6166('0x6'));router[_0x6166('0x7')]('/',auth[_0x6166('0x8')](),controller[_0x6166('0x9')]);router[_0x6166('0x7')](_0x6166('0xa'),auth[_0x6166('0x8')](),controller[_0x6166('0xb')]);router[_0x6166('0xc')]('/',auth[_0x6166('0x8')](),controller[_0x6166('0xd')]);router[_0x6166('0xe')](_0x6166('0xa'),auth['isAuthenticated'](),controller[_0x6166('0xf')]);router[_0x6166('0x10')](_0x6166('0xa'),auth[_0x6166('0x8')](),controller['destroy']);module[_0x6166('0x11')]=router; \ No newline at end of file +var _0xc948=['express','Router','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','/:id','show','create','delete','destroy','exports','multer','util','path'];(function(_0x2b5c54,_0xd1be91){var _0x443e70=function(_0xf8d3ef){while(--_0xf8d3ef){_0x2b5c54['push'](_0x2b5c54['shift']());}};_0x443e70(++_0xd1be91);}(_0xc948,0x129));var _0x8c94=function(_0x12d7f7,_0xdb0956){_0x12d7f7=_0x12d7f7-0x0;var _0x449f2d=_0xc948[_0x12d7f7];return _0x449f2d;};'use strict';var multer=require(_0x8c94('0x0'));var util=require(_0x8c94('0x1'));var path=require(_0x8c94('0x2'));var express=require(_0x8c94('0x3'));var router=express[_0x8c94('0x4')]();var auth=require(_0x8c94('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c94('0x6'));router[_0x8c94('0x7')]('/',auth[_0x8c94('0x8')](),controller['index']);router['get'](_0x8c94('0x9'),auth[_0x8c94('0x8')](),controller[_0x8c94('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8c94('0xb')]);router['put']('/:id',auth[_0x8c94('0x8')](),controller['update']);router[_0x8c94('0xc')]('/:id',auth[_0x8c94('0x8')](),controller[_0x8c94('0xd')]);module[_0x8c94('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 7695219..8b5f560 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 _0x70e0=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0x2b828b,_0x34fb4f){var _0x4bcc51=function(_0x7f4d15){while(--_0x7f4d15){_0x2b828b['push'](_0x2b828b['shift']());}};_0x4bcc51(++_0x34fb4f);}(_0x70e0,0x17b));var _0x070e=function(_0x4156b6,_0x220fed){_0x4156b6=_0x4156b6-0x0;var _0x359fa1=_0x70e0[_0x4156b6];return _0x359fa1;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'type':{'type':Sequelize[_0x070e('0x2')]('string','variable',_0x070e('0x3'),_0x070e('0x4')),'defaultValue':_0x070e('0x5')},'content':{'type':Sequelize[_0x070e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x070e('0x2')]('string',_0x070e('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x070e('0x6')]},'customField':{'type':Sequelize[_0x070e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf109=['ENUM','keyValue','string','STRING','variable','customVariable','sequelize','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf109,0xce));var _0x9f10=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xf109[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'type':{'type':Sequelize[_0x9f10('0x2')]('string','variable','customVariable',_0x9f10('0x3')),'defaultValue':_0x9f10('0x4')},'content':{'type':Sequelize[_0x9f10('0x5')]},'key':{'type':Sequelize[_0x9f10('0x5')]},'keyType':{'type':Sequelize[_0x9f10('0x2')](_0x9f10('0x4'),_0x9f10('0x6'),_0x9f10('0x7'))},'keyContent':{'type':Sequelize[_0x9f10('0x5')]},'idField':{'type':Sequelize[_0x9f10('0x5')]},'nameField':{'type':Sequelize[_0x9f10('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f10('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index de1acbc..df553a4 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 _0x1f50=['mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','index','ZohoField','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','day','add','merge','filter','map','options','includeAll','include','rows','catch','show','params','create','body','find','fast-json-patch','request-promise','moment','bluebird'];(function(_0x32d832,_0x581e07){var _0x23e3b0=function(_0x4cc1ac){while(--_0x4cc1ac){_0x32d832['push'](_0x32d832['shift']());}};_0x23e3b0(++_0x581e07);}(_0x1f50,0x110));var _0x01f5=function(_0x47fb25,_0x3e7cff){_0x47fb25=_0x47fb25-0x0;var _0x2d63fc=_0x1f50[_0x47fb25];return _0x2d63fc;};'use strict';var jsonpatch=require(_0x01f5('0x0'));var rp=require(_0x01f5('0x1'));var moment=require(_0x01f5('0x2'));var BPromise=require(_0x01f5('0x3'));var Mustache=require(_0x01f5('0x4'));var util=require('util');var path=require(_0x01f5('0x5'));var sox=require(_0x01f5('0x6'));var csv=require(_0x01f5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x01f5('0x8'));var squel=require(_0x01f5('0x9'));var crypto=require(_0x01f5('0xa'));var jsforce=require(_0x01f5('0xb'));var deskjs=require(_0x01f5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x01f5('0xd'));var qs=require(_0x01f5('0xe'));var logger=require(_0x01f5('0xf'))(_0x01f5('0x10'));var utils=require(_0x01f5('0x11'));var config=require(_0x01f5('0x12'));var db=require(_0x01f5('0x13'))['db'];function respondWithStatusCode(_0x1d50ed,_0x1647ef){_0x1647ef=_0x1647ef||0xcc;return function(_0x4c43fd){if(_0x4c43fd){return _0x1d50ed[_0x01f5('0x14')](_0x1647ef);}return _0x1d50ed[_0x01f5('0x15')](_0x1647ef)['end']();};}function respondWithResult(_0x163bb4,_0x2e2590){_0x2e2590=_0x2e2590||0xc8;return function(_0x4e3feb){if(_0x4e3feb){return _0x163bb4[_0x01f5('0x15')](_0x2e2590)[_0x01f5('0x16')](_0x4e3feb);}};}function respondWithFilteredResult(_0x50bfe8,_0x4c3e03){return function(_0x12e4bc){if(_0x12e4bc){var _0x28ba75=_0x12e4bc[_0x01f5('0x17')],_0x3f5dea=_0x4c3e03[_0x01f5('0x18')],_0x1f5c1a=_0x4c3e03[_0x01f5('0x18')]+_0x4c3e03[_0x01f5('0x19')],_0x7e8f62;if(_0x1f5c1a>=_0x28ba75){_0x1f5c1a=_0x28ba75;_0x7e8f62=0xc8;}else{_0x7e8f62=0xce;}_0x50bfe8[_0x01f5('0x15')](_0x7e8f62);return _0x50bfe8[_0x01f5('0x1a')]('Content-Range',_0x3f5dea+'-'+_0x1f5c1a+'/'+_0x28ba75)[_0x01f5('0x16')](_0x12e4bc);}return null;};}function patchUpdates(_0x34fa46){return function(_0x13db73){try{jsonpatch[_0x01f5('0x1b')](_0x13db73,_0x34fa46,!![]);}catch(_0x44b10b){return BPromise[_0x01f5('0x1c')](_0x44b10b);}return _0x13db73[_0x01f5('0x1d')]();};}function saveUpdates(_0x1f7381,_0x4615eb){return function(_0x31d682){if(_0x31d682){return _0x31d682[_0x01f5('0x1e')](_0x1f7381)[_0x01f5('0x1f')](function(_0x3be70e){return _0x3be70e;});}return null;};}function removeEntity(_0x123130,_0x254c34){return function(_0x46c4f3){if(_0x46c4f3){return _0x46c4f3[_0x01f5('0x20')]()[_0x01f5('0x1f')](function(){_0x123130[_0x01f5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589301,_0x5d5d7a){return function(_0x6da8be){if(!_0x6da8be){_0x589301[_0x01f5('0x14')](0x194);}return _0x6da8be;};}function handleError(_0x1d25c7,_0x5099bf){_0x5099bf=_0x5099bf||0x1f4;return function(_0x48cd85){logger['error'](_0x48cd85[_0x01f5('0x21')]);if(_0x48cd85[_0x01f5('0x22')]){delete _0x48cd85[_0x01f5('0x22')];}_0x1d25c7[_0x01f5('0x15')](_0x5099bf)['send'](_0x48cd85);};}exports[_0x01f5('0x23')]=function(_0x1b6a7c,_0x4870e4){var _0x51c1c5={},_0xa42459={},_0xc1da6d={'count':0x0,'rows':[]};var _0x1cde20=db[_0x01f5('0x24')][_0x01f5('0x25')];_0xa42459[_0x01f5('0x26')]=_[_0x01f5('0x27')](_0x1cde20);var _0x1765ca={'dateStart':_0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x29')],'dateEnd':_0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x2a')]};delete _0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x29')];delete _0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x2a')];_0xa42459['query']=_['keys'](_0x1b6a7c['query']);_0xa42459['filters']=_[_0x01f5('0x2b')](_0xa42459[_0x01f5('0x26')],_0xa42459[_0x01f5('0x28')]);_0x51c1c5[_0x01f5('0x2c')]=_[_0x01f5('0x2b')](_0xa42459['model'],qs[_0x01f5('0x2d')](_0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x2d')]));_0x51c1c5[_0x01f5('0x2c')]=_0x51c1c5[_0x01f5('0x2c')][_0x01f5('0x2e')]?_0x51c1c5[_0x01f5('0x2c')]:_0xa42459['model'];if(!_0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x2f')](_0x01f5('0x30'))){_0x51c1c5[_0x01f5('0x19')]=qs['limit'](_0x1b6a7c[_0x01f5('0x28')]['limit']);_0x51c1c5[_0x01f5('0x18')]=qs[_0x01f5('0x18')](_0x1b6a7c['query'][_0x01f5('0x18')]);}_0x51c1c5[_0x01f5('0x31')]=qs['sort'](_0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x32')]);_0x51c1c5[_0x01f5('0x33')]=qs[_0x01f5('0x34')](_[_0x01f5('0x35')](_0x1b6a7c[_0x01f5('0x28')],_0xa42459[_0x01f5('0x34')]));if(_0x1765ca[_0x01f5('0x29')]){if(_0x1765ca[_0x01f5('0x2a')]){_0x1765ca[_0x01f5('0x2a')]=moment(_0x1765ca[_0x01f5('0x2a')])['add'](0x1,_0x01f5('0x36'));}else{_0x1765ca[_0x01f5('0x2a')]=moment(_0x1765ca['dateStart'])[_0x01f5('0x37')](0x1,_0x01f5('0x36'));}_[_0x01f5('0x38')](_0x51c1c5[_0x01f5('0x33')],{'createdAt':{'$gte':_0x1765ca['dateStart'],'$lte':_0x1765ca['dateEnd']}});}if(_0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x39')]){_0x51c1c5[_0x01f5('0x33')]=_['merge'](_0x51c1c5[_0x01f5('0x33')],{'$or':_[_0x01f5('0x3a')](_0x51c1c5[_0x01f5('0x2c')],function(_0x55dfb4){var _0x35310f={};_0x35310f[_0x55dfb4]={'$like':'%'+_0x1b6a7c[_0x01f5('0x28')]['filter']+'%'};return _0x35310f;})});}_0x51c1c5=_['merge']({},_0x51c1c5,_0x1b6a7c[_0x01f5('0x3b')]);var _0x2f79b3={'where':_0x51c1c5[_0x01f5('0x33')]};return db[_0x01f5('0x24')][_0x01f5('0x17')](_0x2f79b3)[_0x01f5('0x1f')](function(_0x1f7f3d){_0xc1da6d[_0x01f5('0x17')]=_0x1f7f3d;if(_0x1b6a7c[_0x01f5('0x28')][_0x01f5('0x3c')]){_0x51c1c5[_0x01f5('0x3d')]=[{'all':!![]}];}return db[_0x01f5('0x24')]['findAll'](_0x51c1c5);})[_0x01f5('0x1f')](function(_0x31cdcf){_0xc1da6d[_0x01f5('0x3e')]=_0x31cdcf;return _0xc1da6d;})[_0x01f5('0x1f')](respondWithFilteredResult(_0x4870e4,_0x51c1c5))[_0x01f5('0x3f')](handleError(_0x4870e4,null));};exports[_0x01f5('0x40')]=function(_0x112c30,_0x1aa32f){var _0x1b34c1={'raw':!![],'where':{'id':_0x112c30[_0x01f5('0x41')]['id']}},_0x1da3cc={};_0x1da3cc[_0x01f5('0x26')]=_[_0x01f5('0x27')](db[_0x01f5('0x24')][_0x01f5('0x25')]);_0x1da3cc[_0x01f5('0x28')]=_[_0x01f5('0x27')](_0x112c30[_0x01f5('0x28')]);_0x1da3cc['filters']=_[_0x01f5('0x2b')](_0x1da3cc[_0x01f5('0x26')],_0x1da3cc['query']);_0x1b34c1['attributes']=_['intersection'](_0x1da3cc[_0x01f5('0x26')],qs[_0x01f5('0x2d')](_0x112c30['query'][_0x01f5('0x2d')]));_0x1b34c1[_0x01f5('0x2c')]=_0x1b34c1[_0x01f5('0x2c')][_0x01f5('0x2e')]?_0x1b34c1[_0x01f5('0x2c')]:_0x1da3cc[_0x01f5('0x26')];if(_0x112c30['query'][_0x01f5('0x3c')]){_0x1b34c1[_0x01f5('0x3d')]=[{'all':!![]}];}_0x1b34c1=_[_0x01f5('0x38')]({},_0x1b34c1,_0x112c30['options']);return db[_0x01f5('0x24')]['find'](_0x1b34c1)[_0x01f5('0x1f')](handleEntityNotFound(_0x1aa32f,null))[_0x01f5('0x1f')](respondWithResult(_0x1aa32f,null))[_0x01f5('0x3f')](handleError(_0x1aa32f,null));};exports[_0x01f5('0x42')]=function(_0x2b35ca,_0x5e7c7a){return db[_0x01f5('0x24')][_0x01f5('0x42')](_0x2b35ca[_0x01f5('0x43')],{})['then'](respondWithResult(_0x5e7c7a,0xc9))[_0x01f5('0x3f')](handleError(_0x5e7c7a,null));};exports['update']=function(_0x213897,_0x7e608){if(_0x213897[_0x01f5('0x43')]['id']){delete _0x213897[_0x01f5('0x43')]['id'];}return db[_0x01f5('0x24')][_0x01f5('0x44')]({'where':{'id':_0x213897[_0x01f5('0x41')]['id']}})[_0x01f5('0x1f')](handleEntityNotFound(_0x7e608,null))[_0x01f5('0x1f')](saveUpdates(_0x213897[_0x01f5('0x43')],null))[_0x01f5('0x1f')](respondWithResult(_0x7e608,null))[_0x01f5('0x3f')](handleError(_0x7e608,null));};exports[_0x01f5('0x20')]=function(_0xbe81c2,_0x5a14d5){return db['ZohoField']['find']({'where':{'id':_0xbe81c2['params']['id']}})[_0x01f5('0x1f')](handleEntityNotFound(_0x5a14d5,null))[_0x01f5('0x1f')](removeEntity(_0x5a14d5,null))['catch'](handleError(_0x5a14d5,null));}; \ No newline at end of file +var _0x0182=['fast-json-patch','request-promise','bluebird','mustache','ejs','lodash','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','reject','save','then','error','stack','name','index','ZohoField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy'];(function(_0x1fe033,_0x4422a3){var _0x27ca0b=function(_0x32b639){while(--_0x32b639){_0x1fe033['push'](_0x1fe033['shift']());}};_0x27ca0b(++_0x4422a3);}(_0x0182,0x180));var _0x2018=function(_0x1ca93c,_0x3271ab){_0x1ca93c=_0x1ca93c-0x0;var _0x185169=_0x0182[_0x1ca93c];return _0x185169;};'use strict';var jsonpatch=require(_0x2018('0x0'));var rp=require(_0x2018('0x1'));var moment=require('moment');var BPromise=require(_0x2018('0x2'));var Mustache=require(_0x2018('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2018('0x4'));var fs=require('fs');var _=require(_0x2018('0x5'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2018('0x6'));var toCsv=require(_0x2018('0x7'));var querystring=require(_0x2018('0x8'));var Papa=require(_0x2018('0x9'));var qs=require(_0x2018('0xa'));var logger=require(_0x2018('0xb'))(_0x2018('0xc'));var utils=require(_0x2018('0xd'));var config=require(_0x2018('0xe'));var db=require(_0x2018('0xf'))['db'];function respondWithStatusCode(_0x4e05b8,_0x509bfb){_0x509bfb=_0x509bfb||0xcc;return function(_0xe31e49){if(_0xe31e49){return _0x4e05b8['sendStatus'](_0x509bfb);}return _0x4e05b8[_0x2018('0x10')](_0x509bfb)[_0x2018('0x11')]();};}function respondWithResult(_0xdab9f3,_0xf496bd){_0xf496bd=_0xf496bd||0xc8;return function(_0x2af75d){if(_0x2af75d){return _0xdab9f3[_0x2018('0x10')](_0xf496bd)['json'](_0x2af75d);}};}function respondWithFilteredResult(_0x37a2fa,_0xa230a4){return function(_0x146efd){if(_0x146efd){var _0x599130=_0x146efd[_0x2018('0x12')],_0x597bc9=_0xa230a4[_0x2018('0x13')],_0x5678a1=_0xa230a4[_0x2018('0x13')]+_0xa230a4[_0x2018('0x14')],_0x1ac508;if(_0x5678a1>=_0x599130){_0x5678a1=_0x599130;_0x1ac508=0xc8;}else{_0x1ac508=0xce;}_0x37a2fa[_0x2018('0x10')](_0x1ac508);return _0x37a2fa['set'](_0x2018('0x15'),_0x597bc9+'-'+_0x5678a1+'/'+_0x599130)[_0x2018('0x16')](_0x146efd);}return null;};}function patchUpdates(_0x59dafe){return function(_0x40cbce){try{jsonpatch['apply'](_0x40cbce,_0x59dafe,!![]);}catch(_0x1eafbb){return BPromise[_0x2018('0x17')](_0x1eafbb);}return _0x40cbce[_0x2018('0x18')]();};}function saveUpdates(_0x5cbfa0,_0x30311d){return function(_0x2c250c){if(_0x2c250c){return _0x2c250c['update'](_0x5cbfa0)['then'](function(_0x1fb52c){return _0x1fb52c;});}return null;};}function removeEntity(_0x31acf6,_0x1ebe0){return function(_0x2eeb70){if(_0x2eeb70){return _0x2eeb70['destroy']()[_0x2018('0x19')](function(){_0x31acf6[_0x2018('0x10')](0xcc)[_0x2018('0x11')]();});}};}function handleEntityNotFound(_0x55d0bd,_0x521760){return function(_0x29dd6f){if(!_0x29dd6f){_0x55d0bd['sendStatus'](0x194);}return _0x29dd6f;};}function handleError(_0x4b4ae4,_0x206c27){_0x206c27=_0x206c27||0x1f4;return function(_0x23c4bc){logger[_0x2018('0x1a')](_0x23c4bc[_0x2018('0x1b')]);if(_0x23c4bc[_0x2018('0x1c')]){delete _0x23c4bc[_0x2018('0x1c')];}_0x4b4ae4[_0x2018('0x10')](_0x206c27)['send'](_0x23c4bc);};}exports[_0x2018('0x1d')]=function(_0x3a85ac,_0x307c72){var _0x1d9e6e={},_0x5e4d87={},_0x5a19d3={'count':0x0,'rows':[]};var _0x4c13f2=db[_0x2018('0x1e')][_0x2018('0x1f')];_0x5e4d87[_0x2018('0x20')]=_[_0x2018('0x21')](_0x4c13f2);var _0x3a381c={'dateStart':_0x3a85ac[_0x2018('0x22')][_0x2018('0x23')],'dateEnd':_0x3a85ac[_0x2018('0x22')][_0x2018('0x24')]};delete _0x3a85ac[_0x2018('0x22')]['dateStart'];delete _0x3a85ac['query'][_0x2018('0x24')];_0x5e4d87[_0x2018('0x22')]=_[_0x2018('0x21')](_0x3a85ac[_0x2018('0x22')]);_0x5e4d87[_0x2018('0x25')]=_['intersection'](_0x5e4d87[_0x2018('0x20')],_0x5e4d87['query']);_0x1d9e6e[_0x2018('0x26')]=_[_0x2018('0x27')](_0x5e4d87[_0x2018('0x20')],qs[_0x2018('0x28')](_0x3a85ac[_0x2018('0x22')][_0x2018('0x28')]));_0x1d9e6e['attributes']=_0x1d9e6e[_0x2018('0x26')][_0x2018('0x29')]?_0x1d9e6e['attributes']:_0x5e4d87[_0x2018('0x20')];if(!_0x3a85ac['query'][_0x2018('0x2a')]('nolimit')){_0x1d9e6e[_0x2018('0x14')]=qs[_0x2018('0x14')](_0x3a85ac[_0x2018('0x22')][_0x2018('0x14')]);_0x1d9e6e[_0x2018('0x13')]=qs[_0x2018('0x13')](_0x3a85ac[_0x2018('0x22')][_0x2018('0x13')]);}_0x1d9e6e[_0x2018('0x2b')]=qs['sort'](_0x3a85ac['query'][_0x2018('0x2c')]);_0x1d9e6e[_0x2018('0x2d')]=qs[_0x2018('0x25')](_[_0x2018('0x2e')](_0x3a85ac[_0x2018('0x22')],_0x5e4d87['filters']));if(_0x3a381c[_0x2018('0x23')]){if(_0x3a381c[_0x2018('0x24')]){_0x3a381c[_0x2018('0x24')]=moment(_0x3a381c['dateEnd'])[_0x2018('0x2f')](0x1,_0x2018('0x30'));}else{_0x3a381c[_0x2018('0x24')]=moment(_0x3a381c[_0x2018('0x23')])['add'](0x1,_0x2018('0x30'));}_[_0x2018('0x31')](_0x1d9e6e['where'],{'createdAt':{'$gte':_0x3a381c['dateStart'],'$lte':_0x3a381c[_0x2018('0x24')]}});}if(_0x3a85ac[_0x2018('0x22')][_0x2018('0x32')]){_0x1d9e6e[_0x2018('0x2d')]=_[_0x2018('0x31')](_0x1d9e6e['where'],{'$or':_[_0x2018('0x33')](_0x1d9e6e[_0x2018('0x26')],function(_0x39e97e){var _0x4b3f99={};_0x4b3f99[_0x39e97e]={'$like':'%'+_0x3a85ac['query'][_0x2018('0x32')]+'%'};return _0x4b3f99;})});}_0x1d9e6e=_[_0x2018('0x31')]({},_0x1d9e6e,_0x3a85ac[_0x2018('0x34')]);var _0x315d53={'where':_0x1d9e6e[_0x2018('0x2d')]};return db[_0x2018('0x1e')][_0x2018('0x12')](_0x315d53)[_0x2018('0x19')](function(_0x5396a5){_0x5a19d3[_0x2018('0x12')]=_0x5396a5;if(_0x3a85ac[_0x2018('0x22')][_0x2018('0x35')]){_0x1d9e6e['include']=[{'all':!![]}];}return db[_0x2018('0x1e')][_0x2018('0x36')](_0x1d9e6e);})[_0x2018('0x19')](function(_0x21a19c){_0x5a19d3[_0x2018('0x37')]=_0x21a19c;return _0x5a19d3;})[_0x2018('0x19')](respondWithFilteredResult(_0x307c72,_0x1d9e6e))[_0x2018('0x38')](handleError(_0x307c72,null));};exports[_0x2018('0x39')]=function(_0x5b1fe2,_0x299f04){var _0x8c00f3={'raw':!![],'where':{'id':_0x5b1fe2[_0x2018('0x3a')]['id']}},_0x4c818c={};_0x4c818c[_0x2018('0x20')]=_['keys'](db[_0x2018('0x1e')][_0x2018('0x1f')]);_0x4c818c[_0x2018('0x22')]=_[_0x2018('0x21')](_0x5b1fe2[_0x2018('0x22')]);_0x4c818c[_0x2018('0x25')]=_[_0x2018('0x27')](_0x4c818c[_0x2018('0x20')],_0x4c818c[_0x2018('0x22')]);_0x8c00f3['attributes']=_[_0x2018('0x27')](_0x4c818c[_0x2018('0x20')],qs['fields'](_0x5b1fe2['query'][_0x2018('0x28')]));_0x8c00f3[_0x2018('0x26')]=_0x8c00f3['attributes']['length']?_0x8c00f3[_0x2018('0x26')]:_0x4c818c[_0x2018('0x20')];if(_0x5b1fe2[_0x2018('0x22')][_0x2018('0x35')]){_0x8c00f3[_0x2018('0x3b')]=[{'all':!![]}];}_0x8c00f3=_[_0x2018('0x31')]({},_0x8c00f3,_0x5b1fe2[_0x2018('0x34')]);return db[_0x2018('0x1e')][_0x2018('0x3c')](_0x8c00f3)['then'](handleEntityNotFound(_0x299f04,null))[_0x2018('0x19')](respondWithResult(_0x299f04,null))[_0x2018('0x38')](handleError(_0x299f04,null));};exports[_0x2018('0x3d')]=function(_0xcaee22,_0x5010e4){return db['ZohoField'][_0x2018('0x3d')](_0xcaee22[_0x2018('0x3e')],{})['then'](respondWithResult(_0x5010e4,0xc9))[_0x2018('0x38')](handleError(_0x5010e4,null));};exports['update']=function(_0x341060,_0x3679e8){if(_0x341060[_0x2018('0x3e')]['id']){delete _0x341060[_0x2018('0x3e')]['id'];}return db['ZohoField'][_0x2018('0x3c')]({'where':{'id':_0x341060[_0x2018('0x3a')]['id']}})[_0x2018('0x19')](handleEntityNotFound(_0x3679e8,null))[_0x2018('0x19')](saveUpdates(_0x341060['body'],null))['then'](respondWithResult(_0x3679e8,null))['catch'](handleError(_0x3679e8,null));};exports[_0x2018('0x3f')]=function(_0x2dabd,_0x3c62f8){return db[_0x2018('0x1e')][_0x2018('0x3c')]({'where':{'id':_0x2dabd['params']['id']}})[_0x2018('0x19')](handleEntityNotFound(_0x3c62f8,null))['then'](removeEntity(_0x3c62f8,null))[_0x2018('0x38')](handleError(_0x3c62f8,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a04e565..d6a1846 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 _0x9c42=['define','ZohoField','int_zoho_fields','lodash','util','api','bluebird','request-promise','./intZohoField.attributes'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x9c42,0x11a));var _0x29c4=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x9c42[_0x130705];return _0x1fa991;};'use strict';var _=require(_0x29c4('0x0'));var util=require(_0x29c4('0x1'));var logger=require('../../config/logger')(_0x29c4('0x2'));var moment=require('moment');var BPromise=require(_0x29c4('0x3'));var rp=require(_0x29c4('0x4'));var attributes=require(_0x29c4('0x5'));module['exports']=function(_0x126073,_0x35ccd0){return _0x126073[_0x29c4('0x6')](_0x29c4('0x7'),attributes,{'tableName':_0x29c4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7b9=['request-promise','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','util','api','moment'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xd7b9,0x138));var _0x9d7b=function(_0x240d8c,_0x979f5){_0x240d8c=_0x240d8c-0x0;var _0x4e0720=_0xd7b9[_0x240d8c];return _0x4e0720;};'use strict';var _=require('lodash');var util=require(_0x9d7b('0x0'));var logger=require('../../config/logger')(_0x9d7b('0x1'));var moment=require(_0x9d7b('0x2'));var BPromise=require('bluebird');var rp=require(_0x9d7b('0x3'));var attributes=require(_0x9d7b('0x4'));module[_0x9d7b('0x5')]=function(_0x2b03ab,_0x1ccb97){return _0x2b03ab[_0x9d7b('0x6')](_0x9d7b('0x7'),attributes,{'tableName':_0x9d7b('0x8'),'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 c51f992..e97c3ab 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 _0x2e88=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x2e88,0x95));var _0x82e8=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x2e88[_0x207811];return _0x170d56;};'use strict';var _=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var moment=require(_0x82e8('0x2'));var BPromise=require(_0x82e8('0x3'));var rs=require(_0x82e8('0x4'));var fs=require('fs');var db=require(_0x82e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x82e8('0x6'))(_0x82e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x82e8('0x8'));var client=jayson[_0x82e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3162d1,_0x1e2496,_0x3db496){return new BPromise(function(_0x27df44,_0x393c2c){return client[_0x82e8('0xa')](_0x3162d1,_0x3db496)[_0x82e8('0xb')](function(_0x23d5ef){logger[_0x82e8('0xc')](_0x82e8('0xd'),_0x1e2496,_0x82e8('0xe'));logger['debug'](_0x82e8('0xf'),_0x1e2496,_0x82e8('0xe'),JSON[_0x82e8('0x10')](_0x23d5ef));if(_0x23d5ef[_0x82e8('0x11')]){if(_0x23d5ef[_0x82e8('0x11')][_0x82e8('0x12')]===0x1f4){logger[_0x82e8('0x11')]('ZohoField,\x20%s,\x20%s',_0x1e2496,_0x23d5ef[_0x82e8('0x11')][_0x82e8('0x13')]);return _0x393c2c(_0x23d5ef[_0x82e8('0x11')][_0x82e8('0x13')]);}logger[_0x82e8('0x11')]('ZohoField,\x20%s,\x20%s',_0x1e2496,_0x23d5ef[_0x82e8('0x11')][_0x82e8('0x13')]);return _0x27df44(_0x23d5ef[_0x82e8('0x11')][_0x82e8('0x13')]);}else{logger['info'](_0x82e8('0xd'),_0x1e2496,_0x82e8('0xe'));_0x27df44(_0x23d5ef[_0x82e8('0x14')][_0x82e8('0x13')]);}})[_0x82e8('0x15')](function(_0x541c58){logger[_0x82e8('0x11')](_0x82e8('0xd'),_0x1e2496,_0x541c58);_0x393c2c(_0x541c58);});});} \ No newline at end of file +var _0x20de=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3a4203,_0xa6ff2e){var _0x1a5661=function(_0x584f45){while(--_0x584f45){_0x3a4203['push'](_0x3a4203['shift']());}};_0x1a5661(++_0xa6ff2e);}(_0x20de,0x134));var _0xe20d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x20de[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe20d('0x0'));var util=require('util');var moment=require(_0xe20d('0x1'));var BPromise=require(_0xe20d('0x2'));var rs=require(_0xe20d('0x3'));var fs=require('fs');var db=require(_0xe20d('0x4'))['db'];var utils=require(_0xe20d('0x5'));var logger=require(_0xe20d('0x6'))(_0xe20d('0x7'));var config=require(_0xe20d('0x8'));var jayson=require(_0xe20d('0x9'));var client=jayson[_0xe20d('0xa')][_0xe20d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a8622,_0x374faa,_0x5a5ac2){return new BPromise(function(_0x4e1fb9,_0x4909c9){return client[_0xe20d('0xc')](_0x5a8622,_0x5a5ac2)[_0xe20d('0xd')](function(_0x366c47){logger['info'](_0xe20d('0xe'),_0x374faa,_0xe20d('0xf'));logger['debug'](_0xe20d('0x10'),_0x374faa,_0xe20d('0xf'),JSON['stringify'](_0x366c47));if(_0x366c47[_0xe20d('0x11')]){if(_0x366c47[_0xe20d('0x11')][_0xe20d('0x12')]===0x1f4){logger[_0xe20d('0x11')]('ZohoField,\x20%s,\x20%s',_0x374faa,_0x366c47['error'][_0xe20d('0x13')]);return _0x4909c9(_0x366c47[_0xe20d('0x11')][_0xe20d('0x13')]);}logger[_0xe20d('0x11')](_0xe20d('0xe'),_0x374faa,_0x366c47[_0xe20d('0x11')][_0xe20d('0x13')]);return _0x4e1fb9(_0x366c47[_0xe20d('0x11')][_0xe20d('0x13')]);}else{logger['info'](_0xe20d('0xe'),_0x374faa,'request\x20sent');_0x4e1fb9(_0x366c47[_0xe20d('0x14')][_0xe20d('0x13')]);}})[_0xe20d('0x15')](function(_0x53f8c3){logger[_0xe20d('0x11')]('ZohoField,\x20%s,\x20%s',_0x374faa,_0x53f8c3);_0x4909c9(_0x53f8c3);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 6a3d5a2..eeee709 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 _0xe606=['util','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xe606,0xa7));var _0x6e60=function(_0x119ead,_0x3353f8){_0x119ead=_0x119ead-0x0;var _0x18ae57=_0xe606[_0x119ead];return _0x18ae57;};'use strict';var multer=require(_0x6e60('0x0'));var util=require(_0x6e60('0x1'));var path=require('path');var express=require('express');var router=express[_0x6e60('0x2')]();var auth=require(_0x6e60('0x3'));var interaction=require(_0x6e60('0x4'));var config=require('../../config/environment');module[_0x6e60('0x5')]=router; \ No newline at end of file +var _0xf427=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x4b253e,_0x225087){var _0xe8800=function(_0xed82f1){while(--_0xed82f1){_0x4b253e['push'](_0x4b253e['shift']());}};_0xe8800(++_0x225087);}(_0xf427,0x107));var _0x7f42=function(_0xf526f0,_0x213255){_0xf526f0=_0xf526f0-0x0;var _0x42a1ad=_0xf427[_0xf526f0];return _0x42a1ad;};'use strict';var multer=require(_0x7f42('0x0'));var util=require(_0x7f42('0x1'));var path=require(_0x7f42('0x2'));var express=require(_0x7f42('0x3'));var router=express['Router']();var auth=require(_0x7f42('0x4'));var interaction=require(_0x7f42('0x5'));var config=require(_0x7f42('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index fc06564..c2d059a 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 _0x16f9=['app.js','INTEGER','BOOLEAN','sequelize','exports','STRING','unique_name_and_version'];(function(_0x7629e,_0x40c972){var _0x19569b=function(_0xa62841){while(--_0xa62841){_0x7629e['push'](_0x7629e['shift']());}};_0x19569b(++_0x40c972);}(_0x16f9,0x10d));var _0x916f=function(_0x318f83,_0x2e0e2e){_0x318f83=_0x318f83-0x0;var _0xb12a17=_0x16f9[_0x318f83];return _0xb12a17;};'use strict';var Sequelize=require(_0x916f('0x0'));module[_0x916f('0x1')]={'name':{'type':Sequelize[_0x916f('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x916f('0x2')],'allowNull':![],'unique':_0x916f('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x916f('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x916f('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x916f('0x5')]},'active':{'type':Sequelize[_0x916f('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x916f('0x2')]},'logo':{'type':Sequelize[_0x916f('0x2')]},'state':{'type':Sequelize[_0x916f('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x916f('0x2')]},'title':{'type':Sequelize[_0x916f('0x2')]},'remoteUri':{'type':Sequelize[_0x916f('0x2')]},'link':{'type':Sequelize[_0x916f('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9b0c=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize'];(function(_0x114996,_0x68852b){var _0xbc71f5=function(_0x1c7a08){while(--_0x1c7a08){_0x114996['push'](_0x114996['shift']());}};_0xbc71f5(++_0x68852b);}(_0x9b0c,0x179));var _0xc9b0=function(_0x37b02a,_0x234149){_0x37b02a=_0x37b02a-0x0;var _0x15332f=_0x9b0c[_0x37b02a];return _0x15332f;};'use strict';var Sequelize=require(_0xc9b0('0x0'));module[_0xc9b0('0x1')]={'name':{'type':Sequelize[_0xc9b0('0x2')],'allowNull':![],'unique':_0xc9b0('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc9b0('0x3')},'main':{'type':Sequelize[_0xc9b0('0x2')],'defaultValue':_0xc9b0('0x4')},'filename':{'type':Sequelize[_0xc9b0('0x2')]},'path':{'type':Sequelize[_0xc9b0('0x2')]},'type':{'type':Sequelize[_0xc9b0('0x2')]},'size':{'type':Sequelize[_0xc9b0('0x5')]},'active':{'type':Sequelize[_0xc9b0('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xc9b0('0x2')]},'logo':{'type':Sequelize[_0xc9b0('0x2')]},'state':{'type':Sequelize[_0xc9b0('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xc9b0('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc9b0('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index af184c8..5c79aea 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 _0x4c32=['add','day','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','offset','limit','status','set','Content-Range','json','apply','reject','then','error','name','send','index','Integration','rawAttributes','model','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','order','where'];(function(_0x3c6ff6,_0x4e136a){var _0x4ac5ba=function(_0x1da29e){while(--_0x1da29e){_0x3c6ff6['push'](_0x3c6ff6['shift']());}};_0x4ac5ba(++_0x4e136a);}(_0x4c32,0x1e8));var _0x24c3=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x4c32[_0x8ba19a];return _0x2bd8b4;};'use strict';var jsonpatch=require(_0x24c3('0x0'));var rp=require(_0x24c3('0x1'));var moment=require(_0x24c3('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x24c3('0x3'));var path=require(_0x24c3('0x4'));var sox=require(_0x24c3('0x5'));var csv=require(_0x24c3('0x6'));var ejs=require(_0x24c3('0x7'));var fs=require('fs');var _=require(_0x24c3('0x8'));var squel=require(_0x24c3('0x9'));var crypto=require('crypto');var jsforce=require(_0x24c3('0xa'));var deskjs=require(_0x24c3('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x24c3('0xc'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x24c3('0xd'));var db=require(_0x24c3('0xe'))['db'];function respondWithStatusCode(_0x552088,_0x3e77a){_0x3e77a=_0x3e77a||0xcc;return function(_0x3003a8){if(_0x3003a8){return _0x552088[_0x24c3('0xf')](_0x3e77a);}return _0x552088['status'](_0x3e77a)['end']();};}function respondWithResult(_0x5bf26c,_0x164002){_0x164002=_0x164002||0xc8;return function(_0x11785b){if(_0x11785b){return _0x5bf26c['status'](_0x164002)['json'](_0x11785b);}};}function respondWithFilteredResult(_0x2ad7c8,_0x392f1d){return function(_0x58b60e){if(_0x58b60e){var _0x23c29e=_0x58b60e['count'],_0x3d9069=_0x392f1d[_0x24c3('0x10')],_0x3f666a=_0x392f1d[_0x24c3('0x10')]+_0x392f1d[_0x24c3('0x11')],_0x274d8f;if(_0x3f666a>=_0x23c29e){_0x3f666a=_0x23c29e;_0x274d8f=0xc8;}else{_0x274d8f=0xce;}_0x2ad7c8[_0x24c3('0x12')](_0x274d8f);return _0x2ad7c8[_0x24c3('0x13')](_0x24c3('0x14'),_0x3d9069+'-'+_0x3f666a+'/'+_0x23c29e)[_0x24c3('0x15')](_0x58b60e);}return null;};}function patchUpdates(_0x5f59a7){return function(_0x49bca0){try{jsonpatch[_0x24c3('0x16')](_0x49bca0,_0x5f59a7,!![]);}catch(_0x3480cf){return BPromise[_0x24c3('0x17')](_0x3480cf);}return _0x49bca0['save']();};}function saveUpdates(_0x34bf3d,_0x346534){return function(_0x5a1160){if(_0x5a1160){return _0x5a1160['update'](_0x34bf3d)[_0x24c3('0x18')](function(_0x5f3efd){return _0x5f3efd;});}return null;};}function removeEntity(_0x1538aa,_0xf40668){return function(_0x2b8c71){if(_0x2b8c71){return _0x2b8c71['destroy']()[_0x24c3('0x18')](function(){_0x1538aa[_0x24c3('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x215184,_0x1b2db8){return function(_0xc06e89){if(!_0xc06e89){_0x215184[_0x24c3('0xf')](0x194);}return _0xc06e89;};}function handleError(_0x567bbf,_0x1659aa){_0x1659aa=_0x1659aa||0x1f4;return function(_0x1d2e4b){logger[_0x24c3('0x19')](_0x1d2e4b['stack']);if(_0x1d2e4b[_0x24c3('0x1a')]){delete _0x1d2e4b[_0x24c3('0x1a')];}_0x567bbf[_0x24c3('0x12')](_0x1659aa)[_0x24c3('0x1b')](_0x1d2e4b);};}exports[_0x24c3('0x1c')]=function(_0x55d64b,_0x19e9eb){var _0x4bf988={},_0x1c8fc7={},_0x18495c={'count':0x0,'rows':[]};var _0x5101ea=db[_0x24c3('0x1d')][_0x24c3('0x1e')];_0x1c8fc7[_0x24c3('0x1f')]=_['keys'](_0x5101ea);var _0x2f30bf={'dateStart':_0x55d64b[_0x24c3('0x20')]['dateStart'],'dateEnd':_0x55d64b[_0x24c3('0x20')][_0x24c3('0x21')]};delete _0x55d64b[_0x24c3('0x20')][_0x24c3('0x22')];delete _0x55d64b[_0x24c3('0x20')]['dateEnd'];_0x1c8fc7[_0x24c3('0x20')]=_['keys'](_0x55d64b['query']);_0x1c8fc7[_0x24c3('0x23')]=_[_0x24c3('0x24')](_0x1c8fc7[_0x24c3('0x1f')],_0x1c8fc7[_0x24c3('0x20')]);_0x4bf988[_0x24c3('0x25')]=_[_0x24c3('0x24')](_0x1c8fc7[_0x24c3('0x1f')],qs['fields'](_0x55d64b['query'][_0x24c3('0x26')]));_0x4bf988['attributes']=_0x4bf988['attributes'][_0x24c3('0x27')]?_0x4bf988['attributes']:_0x1c8fc7[_0x24c3('0x1f')];if(!_0x55d64b[_0x24c3('0x20')][_0x24c3('0x28')]('nolimit')){_0x4bf988[_0x24c3('0x11')]=qs[_0x24c3('0x11')](_0x55d64b[_0x24c3('0x20')][_0x24c3('0x11')]);_0x4bf988[_0x24c3('0x10')]=qs[_0x24c3('0x10')](_0x55d64b['query'][_0x24c3('0x10')]);}_0x4bf988[_0x24c3('0x29')]=qs['sort'](_0x55d64b[_0x24c3('0x20')]['sort']);_0x4bf988[_0x24c3('0x2a')]=qs[_0x24c3('0x23')](_['pick'](_0x55d64b[_0x24c3('0x20')],_0x1c8fc7[_0x24c3('0x23')]));if(_0x2f30bf['dateStart']){if(_0x2f30bf['dateEnd']){_0x2f30bf[_0x24c3('0x21')]=moment(_0x2f30bf['dateEnd'])[_0x24c3('0x2b')](0x1,_0x24c3('0x2c'));}else{_0x2f30bf[_0x24c3('0x21')]=moment(_0x2f30bf[_0x24c3('0x22')])[_0x24c3('0x2b')](0x1,_0x24c3('0x2c'));}_['merge'](_0x4bf988['where'],{'createdAt':{'$gte':_0x2f30bf[_0x24c3('0x22')],'$lte':_0x2f30bf[_0x24c3('0x21')]}});}if(_0x55d64b[_0x24c3('0x20')][_0x24c3('0x2d')]){_0x4bf988[_0x24c3('0x2a')]=_[_0x24c3('0x2e')](_0x4bf988['where'],{'$or':_['map'](_0x4bf988[_0x24c3('0x25')],function(_0x52877f){var _0x474190={};_0x474190[_0x52877f]={'$like':'%'+_0x55d64b[_0x24c3('0x20')][_0x24c3('0x2d')]+'%'};return _0x474190;})});}_0x4bf988=_[_0x24c3('0x2e')]({},_0x4bf988,_0x55d64b['options']);var _0x5dbb91={'where':_0x4bf988[_0x24c3('0x2a')]};return db[_0x24c3('0x1d')]['count'](_0x5dbb91)['then'](function(_0x1febcf){_0x18495c['count']=_0x1febcf;if(_0x55d64b['query'][_0x24c3('0x2f')]){_0x4bf988[_0x24c3('0x30')]=[{'all':!![]}];}return db['Integration'][_0x24c3('0x31')](_0x4bf988);})[_0x24c3('0x18')](function(_0xac0c31){_0x18495c[_0x24c3('0x32')]=_0xac0c31;return _0x18495c;})[_0x24c3('0x18')](respondWithFilteredResult(_0x19e9eb,_0x4bf988))[_0x24c3('0x33')](handleError(_0x19e9eb,null));};exports[_0x24c3('0x34')]=function(_0x17e932,_0x3a216c){var _0x1ef0f1={'raw':![],'where':{'id':_0x17e932[_0x24c3('0x35')]['id']}},_0x4faf8c={};_0x4faf8c[_0x24c3('0x1f')]=_[_0x24c3('0x36')](db['Integration'][_0x24c3('0x1e')]);_0x4faf8c[_0x24c3('0x20')]=_['keys'](_0x17e932['query']);_0x4faf8c[_0x24c3('0x23')]=_[_0x24c3('0x24')](_0x4faf8c[_0x24c3('0x1f')],_0x4faf8c[_0x24c3('0x20')]);_0x1ef0f1['attributes']=_[_0x24c3('0x24')](_0x4faf8c['model'],qs[_0x24c3('0x26')](_0x17e932['query'][_0x24c3('0x26')]));_0x1ef0f1[_0x24c3('0x25')]=_0x1ef0f1[_0x24c3('0x25')]['length']?_0x1ef0f1['attributes']:_0x4faf8c['model'];if(_0x17e932[_0x24c3('0x20')]['includeAll']){_0x1ef0f1[_0x24c3('0x30')]=[{'all':!![]}];}_0x1ef0f1=_[_0x24c3('0x2e')]({},_0x1ef0f1,_0x17e932['options']);return db['Integration'][_0x24c3('0x37')](_0x1ef0f1)[_0x24c3('0x18')](handleEntityNotFound(_0x3a216c,null))[_0x24c3('0x18')](respondWithResult(_0x3a216c,null))[_0x24c3('0x33')](handleError(_0x3a216c,null));};exports[_0x24c3('0x38')]=function(_0xdfe36d,_0x243732){return db[_0x24c3('0x1d')][_0x24c3('0x38')](_0xdfe36d[_0x24c3('0x39')],{})[_0x24c3('0x18')](respondWithResult(_0x243732,0xc9))[_0x24c3('0x33')](handleError(_0x243732,null));};exports['update']=function(_0x37720f,_0x3dfb36){if(_0x37720f[_0x24c3('0x39')]['id']){delete _0x37720f['body']['id'];}return db[_0x24c3('0x1d')]['find']({'where':{'id':_0x37720f[_0x24c3('0x35')]['id']}})[_0x24c3('0x18')](handleEntityNotFound(_0x3dfb36,null))[_0x24c3('0x18')](saveUpdates(_0x37720f['body'],null))['then'](respondWithResult(_0x3dfb36,null))['catch'](handleError(_0x3dfb36,null));};exports[_0x24c3('0x3a')]=function(_0x53213e,_0x39584f){return db['Integration'][_0x24c3('0x37')]({'where':{'id':_0x53213e[_0x24c3('0x35')]['id']}})['then'](handleEntityNotFound(_0x39584f,null))['then'](removeEntity(_0x39584f,null))['catch'](handleError(_0x39584f,null));}; \ No newline at end of file +var _0x1c2f=['Integration','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','add','day','merge','where','filter','map','options','includeAll','include','findAll','rows','find','create','body','catch','params','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index'];(function(_0x1a3984,_0x492a1d){var _0x386311=function(_0x124884){while(--_0x124884){_0x1a3984['push'](_0x1a3984['shift']());}};_0x386311(++_0x492a1d);}(_0x1c2f,0x1b7));var _0xf1c2=function(_0x331d03,_0x3eacf3){_0x331d03=_0x331d03-0x0;var _0x58f66c=_0x1c2f[_0x331d03];return _0x58f66c;};'use strict';var jsonpatch=require(_0xf1c2('0x0'));var rp=require(_0xf1c2('0x1'));var moment=require(_0xf1c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf1c2('0x3'));var util=require(_0xf1c2('0x4'));var path=require('path');var sox=require(_0xf1c2('0x5'));var csv=require(_0xf1c2('0x6'));var ejs=require(_0xf1c2('0x7'));var fs=require('fs');var _=require(_0xf1c2('0x8'));var squel=require(_0xf1c2('0x9'));var crypto=require(_0xf1c2('0xa'));var jsforce=require(_0xf1c2('0xb'));var deskjs=require(_0xf1c2('0xc'));var toCsv=require(_0xf1c2('0x6'));var querystring=require(_0xf1c2('0xd'));var Papa=require(_0xf1c2('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xf1c2('0xf'))(_0xf1c2('0x10'));var utils=require('../../config/utils');var config=require(_0xf1c2('0x11'));var db=require(_0xf1c2('0x12'))['db'];function respondWithStatusCode(_0x45bbfa,_0xd30cae){_0xd30cae=_0xd30cae||0xcc;return function(_0x8f9ec6){if(_0x8f9ec6){return _0x45bbfa[_0xf1c2('0x13')](_0xd30cae);}return _0x45bbfa[_0xf1c2('0x14')](_0xd30cae)[_0xf1c2('0x15')]();};}function respondWithResult(_0x4bb2a8,_0xb9944e){_0xb9944e=_0xb9944e||0xc8;return function(_0x246007){if(_0x246007){return _0x4bb2a8[_0xf1c2('0x14')](_0xb9944e)[_0xf1c2('0x16')](_0x246007);}};}function respondWithFilteredResult(_0x487a3f,_0x3f75a2){return function(_0x201606){if(_0x201606){var _0x246411=_0x201606[_0xf1c2('0x17')],_0x96f458=_0x3f75a2[_0xf1c2('0x18')],_0xde2392=_0x3f75a2[_0xf1c2('0x18')]+_0x3f75a2[_0xf1c2('0x19')],_0x4e107d;if(_0xde2392>=_0x246411){_0xde2392=_0x246411;_0x4e107d=0xc8;}else{_0x4e107d=0xce;}_0x487a3f['status'](_0x4e107d);return _0x487a3f[_0xf1c2('0x1a')](_0xf1c2('0x1b'),_0x96f458+'-'+_0xde2392+'/'+_0x246411)[_0xf1c2('0x16')](_0x201606);}return null;};}function patchUpdates(_0x5962e8){return function(_0x3bcbb9){try{jsonpatch[_0xf1c2('0x1c')](_0x3bcbb9,_0x5962e8,!![]);}catch(_0xc66f5){return BPromise[_0xf1c2('0x1d')](_0xc66f5);}return _0x3bcbb9['save']();};}function saveUpdates(_0x279cb7,_0x4bf33d){return function(_0x1bd386){if(_0x1bd386){return _0x1bd386[_0xf1c2('0x1e')](_0x279cb7)[_0xf1c2('0x1f')](function(_0x1686c7){return _0x1686c7;});}return null;};}function removeEntity(_0x338de8,_0x184fc2){return function(_0x543b1f){if(_0x543b1f){return _0x543b1f[_0xf1c2('0x20')]()[_0xf1c2('0x1f')](function(){_0x338de8['status'](0xcc)[_0xf1c2('0x15')]();});}};}function handleEntityNotFound(_0x3f0d86,_0x5c7eac){return function(_0x2a5c4f){if(!_0x2a5c4f){_0x3f0d86[_0xf1c2('0x13')](0x194);}return _0x2a5c4f;};}function handleError(_0x582121,_0x51fc01){_0x51fc01=_0x51fc01||0x1f4;return function(_0x1bf1f8){logger[_0xf1c2('0x21')](_0x1bf1f8['stack']);if(_0x1bf1f8[_0xf1c2('0x22')]){delete _0x1bf1f8[_0xf1c2('0x22')];}_0x582121[_0xf1c2('0x14')](_0x51fc01)[_0xf1c2('0x23')](_0x1bf1f8);};}exports[_0xf1c2('0x24')]=function(_0x23e91a,_0x20cf30){var _0x5c2473={},_0x21b2ec={},_0x2cb0bd={'count':0x0,'rows':[]};var _0x41ca7c=db[_0xf1c2('0x25')][_0xf1c2('0x26')];_0x21b2ec['model']=_[_0xf1c2('0x27')](_0x41ca7c);var _0x163a0c={'dateStart':_0x23e91a[_0xf1c2('0x28')]['dateStart'],'dateEnd':_0x23e91a['query'][_0xf1c2('0x29')]};delete _0x23e91a['query'][_0xf1c2('0x2a')];delete _0x23e91a[_0xf1c2('0x28')][_0xf1c2('0x29')];_0x21b2ec[_0xf1c2('0x28')]=_[_0xf1c2('0x27')](_0x23e91a[_0xf1c2('0x28')]);_0x21b2ec[_0xf1c2('0x2b')]=_[_0xf1c2('0x2c')](_0x21b2ec[_0xf1c2('0x2d')],_0x21b2ec['query']);_0x5c2473[_0xf1c2('0x2e')]=_[_0xf1c2('0x2c')](_0x21b2ec[_0xf1c2('0x2d')],qs[_0xf1c2('0x2f')](_0x23e91a[_0xf1c2('0x28')][_0xf1c2('0x2f')]));_0x5c2473[_0xf1c2('0x2e')]=_0x5c2473[_0xf1c2('0x2e')][_0xf1c2('0x30')]?_0x5c2473[_0xf1c2('0x2e')]:_0x21b2ec[_0xf1c2('0x2d')];if(!_0x23e91a[_0xf1c2('0x28')][_0xf1c2('0x31')]('nolimit')){_0x5c2473[_0xf1c2('0x19')]=qs[_0xf1c2('0x19')](_0x23e91a[_0xf1c2('0x28')]['limit']);_0x5c2473[_0xf1c2('0x18')]=qs[_0xf1c2('0x18')](_0x23e91a['query']['offset']);}_0x5c2473[_0xf1c2('0x32')]=qs[_0xf1c2('0x33')](_0x23e91a[_0xf1c2('0x28')][_0xf1c2('0x33')]);_0x5c2473['where']=qs[_0xf1c2('0x2b')](_['pick'](_0x23e91a['query'],_0x21b2ec[_0xf1c2('0x2b')]));if(_0x163a0c['dateStart']){if(_0x163a0c['dateEnd']){_0x163a0c[_0xf1c2('0x29')]=moment(_0x163a0c[_0xf1c2('0x29')])[_0xf1c2('0x34')](0x1,_0xf1c2('0x35'));}else{_0x163a0c[_0xf1c2('0x29')]=moment(_0x163a0c[_0xf1c2('0x2a')])[_0xf1c2('0x34')](0x1,_0xf1c2('0x35'));}_[_0xf1c2('0x36')](_0x5c2473[_0xf1c2('0x37')],{'createdAt':{'$gte':_0x163a0c['dateStart'],'$lte':_0x163a0c[_0xf1c2('0x29')]}});}if(_0x23e91a[_0xf1c2('0x28')][_0xf1c2('0x38')]){_0x5c2473[_0xf1c2('0x37')]=_[_0xf1c2('0x36')](_0x5c2473[_0xf1c2('0x37')],{'$or':_[_0xf1c2('0x39')](_0x5c2473['attributes'],function(_0x57a436){var _0x38a166={};_0x38a166[_0x57a436]={'$like':'%'+_0x23e91a[_0xf1c2('0x28')][_0xf1c2('0x38')]+'%'};return _0x38a166;})});}_0x5c2473=_[_0xf1c2('0x36')]({},_0x5c2473,_0x23e91a[_0xf1c2('0x3a')]);var _0x290201={'where':_0x5c2473[_0xf1c2('0x37')]};return db[_0xf1c2('0x25')][_0xf1c2('0x17')](_0x290201)[_0xf1c2('0x1f')](function(_0x114daf){_0x2cb0bd[_0xf1c2('0x17')]=_0x114daf;if(_0x23e91a[_0xf1c2('0x28')][_0xf1c2('0x3b')]){_0x5c2473[_0xf1c2('0x3c')]=[{'all':!![]}];}return db[_0xf1c2('0x25')][_0xf1c2('0x3d')](_0x5c2473);})['then'](function(_0x2938c7){_0x2cb0bd[_0xf1c2('0x3e')]=_0x2938c7;return _0x2cb0bd;})[_0xf1c2('0x1f')](respondWithFilteredResult(_0x20cf30,_0x5c2473))['catch'](handleError(_0x20cf30,null));};exports['show']=function(_0x190a76,_0x10029f){var _0x248a2a={'raw':![],'where':{'id':_0x190a76['params']['id']}},_0x3a9fad={};_0x3a9fad[_0xf1c2('0x2d')]=_[_0xf1c2('0x27')](db[_0xf1c2('0x25')]['rawAttributes']);_0x3a9fad[_0xf1c2('0x28')]=_['keys'](_0x190a76['query']);_0x3a9fad[_0xf1c2('0x2b')]=_[_0xf1c2('0x2c')](_0x3a9fad['model'],_0x3a9fad[_0xf1c2('0x28')]);_0x248a2a[_0xf1c2('0x2e')]=_[_0xf1c2('0x2c')](_0x3a9fad['model'],qs[_0xf1c2('0x2f')](_0x190a76['query'][_0xf1c2('0x2f')]));_0x248a2a[_0xf1c2('0x2e')]=_0x248a2a[_0xf1c2('0x2e')][_0xf1c2('0x30')]?_0x248a2a[_0xf1c2('0x2e')]:_0x3a9fad['model'];if(_0x190a76['query']['includeAll']){_0x248a2a[_0xf1c2('0x3c')]=[{'all':!![]}];}_0x248a2a=_[_0xf1c2('0x36')]({},_0x248a2a,_0x190a76[_0xf1c2('0x3a')]);return db['Integration'][_0xf1c2('0x3f')](_0x248a2a)['then'](handleEntityNotFound(_0x10029f,null))[_0xf1c2('0x1f')](respondWithResult(_0x10029f,null))['catch'](handleError(_0x10029f,null));};exports['create']=function(_0x4783a9,_0x33affa){return db[_0xf1c2('0x25')][_0xf1c2('0x40')](_0x4783a9[_0xf1c2('0x41')],{})[_0xf1c2('0x1f')](respondWithResult(_0x33affa,0xc9))[_0xf1c2('0x42')](handleError(_0x33affa,null));};exports[_0xf1c2('0x1e')]=function(_0x40b82a,_0x3009e9){if(_0x40b82a[_0xf1c2('0x41')]['id']){delete _0x40b82a['body']['id'];}return db[_0xf1c2('0x25')][_0xf1c2('0x3f')]({'where':{'id':_0x40b82a[_0xf1c2('0x43')]['id']}})[_0xf1c2('0x1f')](handleEntityNotFound(_0x3009e9,null))[_0xf1c2('0x1f')](saveUpdates(_0x40b82a[_0xf1c2('0x41')],null))[_0xf1c2('0x1f')](respondWithResult(_0x3009e9,null))['catch'](handleError(_0x3009e9,null));};exports[_0xf1c2('0x20')]=function(_0x4cc719,_0x302caa){return db[_0xf1c2('0x25')][_0xf1c2('0x3f')]({'where':{'id':_0x4cc719[_0xf1c2('0x43')]['id']}})[_0xf1c2('0x1f')](handleEntityNotFound(_0x302caa,null))[_0xf1c2('0x1f')](removeEntity(_0x302caa,null))['catch'](handleError(_0x302caa,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 675007c..8124821 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 _0xc6ac=['util','../../config/logger','api','moment','bluebird','request-promise','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x484e26,_0x202641){_0x484e26=_0x484e26-0x0;var _0x4c16f2=_0xc6ac[_0x484e26];return _0x4c16f2;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var attributes=require(_0xcc6a('0x7'));module[_0xcc6a('0x8')]=function(_0x22ee99,_0x2f26ab){return _0x22ee99[_0xcc6a('0x9')](_0xcc6a('0xa'),attributes,{'tableName':_0xcc6a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['api','moment','bluebird','./integration.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x3cd17d,_0x5704f3){var _0x137bca=function(_0x3a61df){while(--_0x3a61df){_0x3cd17d['push'](_0x3cd17d['shift']());}};_0x137bca(++_0x5704f3);}(_0x2ef3,0xba));var _0x32ef=function(_0x141f0b,_0x459dc2){_0x141f0b=_0x141f0b-0x0;var _0x10b073=_0x2ef3[_0x141f0b];return _0x10b073;};'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')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index e3bc153..6d0e423 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 _0xb145=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x15bbae,_0x5ab778){var _0x2c99b6=function(_0xedf623){while(--_0xedf623){_0x15bbae['push'](_0x15bbae['shift']());}};_0x2c99b6(++_0x5ab778);}(_0xb145,0xa3));var _0x5b14=function(_0x1692de,_0x5f57ab){_0x1692de=_0x1692de-0x0;var _0x2fd70b=_0xb145[_0x1692de];return _0x2fd70b;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var db=require(_0x5b14('0x4'))['db'];var utils=require(_0x5b14('0x5'));var logger=require(_0x5b14('0x6'))(_0x5b14('0x7'));var config=require('../../config/environment');var jayson=require(_0x5b14('0x8'));var client=jayson[_0x5b14('0x9')][_0x5b14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d82ad,_0x50fd91,_0x1d12ed){return new BPromise(function(_0x2a3921,_0x34530a){return client[_0x5b14('0xb')](_0x4d82ad,_0x1d12ed)[_0x5b14('0xc')](function(_0x5f084f){logger[_0x5b14('0xd')](_0x5b14('0xe'),_0x50fd91,'request\x20sent');logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x50fd91,_0x5b14('0x11'),JSON[_0x5b14('0x12')](_0x5f084f));if(_0x5f084f[_0x5b14('0x13')]){if(_0x5f084f['error'][_0x5b14('0x14')]===0x1f4){logger['error'](_0x5b14('0xe'),_0x50fd91,_0x5f084f[_0x5b14('0x13')][_0x5b14('0x15')]);return _0x34530a(_0x5f084f[_0x5b14('0x13')][_0x5b14('0x15')]);}logger[_0x5b14('0x13')]('Integration,\x20%s,\x20%s',_0x50fd91,_0x5f084f[_0x5b14('0x13')][_0x5b14('0x15')]);return _0x2a3921(_0x5f084f[_0x5b14('0x13')][_0x5b14('0x15')]);}else{logger[_0x5b14('0xd')](_0x5b14('0xe'),_0x50fd91,_0x5b14('0x11'));_0x2a3921(_0x5f084f[_0x5b14('0x16')][_0x5b14('0x15')]);}})[_0x5b14('0x17')](function(_0x221344){logger[_0x5b14('0x13')]('Integration,\x20%s,\x20%s',_0x50fd91,_0x221344);_0x34530a(_0x221344);});});} \ No newline at end of file +var _0x5ba3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','../../mysqldb'];(function(_0x5d9ce1,_0x28058e){var _0x280593=function(_0x2c46dd){while(--_0x2c46dd){_0x5d9ce1['push'](_0x5d9ce1['shift']());}};_0x280593(++_0x28058e);}(_0x5ba3,0x140));var _0x35ba=function(_0x261284,_0x2192fb){_0x261284=_0x261284-0x0;var _0x5a90da=_0x5ba3[_0x261284];return _0x5a90da;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var moment=require(_0x35ba('0x1'));var BPromise=require(_0x35ba('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x35ba('0x3'))['db'];var utils=require(_0x35ba('0x4'));var logger=require(_0x35ba('0x5'))('rpc');var config=require(_0x35ba('0x6'));var jayson=require(_0x35ba('0x7'));var client=jayson[_0x35ba('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54c722,_0x20cd5f,_0x3264d3){return new BPromise(function(_0x380ffb,_0x4c55f3){return client[_0x35ba('0x9')](_0x54c722,_0x3264d3)['then'](function(_0x14cd6b){logger[_0x35ba('0xa')](_0x35ba('0xb'),_0x20cd5f,_0x35ba('0xc'));logger['debug'](_0x35ba('0xd'),_0x20cd5f,'request\x20sent',JSON['stringify'](_0x14cd6b));if(_0x14cd6b['error']){if(_0x14cd6b[_0x35ba('0xe')][_0x35ba('0xf')]===0x1f4){logger[_0x35ba('0xe')](_0x35ba('0xb'),_0x20cd5f,_0x14cd6b[_0x35ba('0xe')][_0x35ba('0x10')]);return _0x4c55f3(_0x14cd6b[_0x35ba('0xe')][_0x35ba('0x10')]);}logger['error'](_0x35ba('0xb'),_0x20cd5f,_0x14cd6b[_0x35ba('0xe')][_0x35ba('0x10')]);return _0x380ffb(_0x14cd6b[_0x35ba('0xe')]['message']);}else{logger[_0x35ba('0xa')]('Integration,\x20%s,\x20%s',_0x20cd5f,'request\x20sent');_0x380ffb(_0x14cd6b[_0x35ba('0x11')][_0x35ba('0x10')]);}})['catch'](function(_0x165531){logger[_0x35ba('0xe')](_0x35ba('0xb'),_0x20cd5f,_0x165531);_0x4c55f3(_0x165531);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 09251fc..bab0de2 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 _0xa597=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','update','delete','exports'];(function(_0x18e183,_0x4cc929){var _0x66b747=function(_0x5225b9){while(--_0x5225b9){_0x18e183['push'](_0x18e183['shift']());}};_0x66b747(++_0x4cc929);}(_0xa597,0xab));var _0x7a59=function(_0x1f75c5,_0x37dbdb){_0x1f75c5=_0x1f75c5-0x0;var _0x58278f=_0xa597[_0x1f75c5];return _0x58278f;};'use strict';var multer=require(_0x7a59('0x0'));var util=require(_0x7a59('0x1'));var path=require('path');var express=require(_0x7a59('0x2'));var router=express[_0x7a59('0x3')]();var auth=require(_0x7a59('0x4'));var interaction=require(_0x7a59('0x5'));var config=require(_0x7a59('0x6'));var controller=require(_0x7a59('0x7'));router['get']('/',auth[_0x7a59('0x8')](),controller[_0x7a59('0x9')]);router[_0x7a59('0xa')](_0x7a59('0xb'),auth['isAuthenticated'](),controller[_0x7a59('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7a59('0xd')]);router[_0x7a59('0xe')]('/',auth[_0x7a59('0x8')](),controller[_0x7a59('0xf')]);router['put']('/:id',auth[_0x7a59('0x8')](),controller[_0x7a59('0x10')]);router[_0x7a59('0x11')]('/:id',auth[_0x7a59('0x8')](),controller['destroy']);module[_0x7a59('0x12')]=router; \ No newline at end of file +var _0xb110=['path','express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x35360b,_0x34b82e){var _0x5402f9=function(_0x2a9fe6){while(--_0x2a9fe6){_0x35360b['push'](_0x35360b['shift']());}};_0x5402f9(++_0x34b82e);}(_0xb110,0x1df));var _0x0b11=function(_0x1ce890,_0x138b7e){_0x1ce890=_0x1ce890-0x0;var _0x490b11=_0xb110[_0x1ce890];return _0x490b11;};'use strict';var multer=require('multer');var util=require(_0x0b11('0x0'));var path=require(_0x0b11('0x1'));var express=require(_0x0b11('0x2'));var router=express[_0x0b11('0x3')]();var auth=require(_0x0b11('0x4'));var interaction=require(_0x0b11('0x5'));var config=require('../../config/environment');var controller=require(_0x0b11('0x6'));router[_0x0b11('0x7')]('/',auth[_0x0b11('0x8')](),controller[_0x0b11('0x9')]);router['get'](_0x0b11('0xa'),auth[_0x0b11('0x8')](),controller[_0x0b11('0xb')]);router[_0x0b11('0x7')]('/:id',auth[_0x0b11('0x8')](),controller[_0x0b11('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0b11('0xd')]);router[_0x0b11('0xe')](_0x0b11('0xf'),auth[_0x0b11('0x8')](),controller[_0x0b11('0x10')]);router[_0x0b11('0x11')](_0x0b11('0xf'),auth[_0x0b11('0x8')](),controller[_0x0b11('0x12')]);module[_0x0b11('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6963be0..fa88573 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 _0xf734=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','STRING'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0xf734,0x184));var _0x4f73=function(_0x18a24b,_0x1a0f36){_0x18a24b=_0x18a24b-0x0;var _0x3a034e=_0xf734[_0x18a24b];return _0x3a034e;};'use strict';var Sequelize=require(_0x4f73('0x0'));module['exports']={'integration':{'type':Sequelize[_0x4f73('0x1')]},'eventChannel':{'type':Sequelize[_0x4f73('0x1')]},'exitStatus':{'type':Sequelize[_0x4f73('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x4f73('0x2')]},'contacts':{'type':Sequelize[_0x4f73('0x1')]},'uniqueid':{'type':Sequelize[_0x4f73('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4f73('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4f73('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4f73('0x3')]},'talktime':{'type':Sequelize[_0x4f73('0x2')]},'agentacw':{'type':Sequelize[_0x4f73('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4f73('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4f73('0x3')]},'agentdump':{'type':Sequelize[_0x4f73('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4f73('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4f73('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x4f73('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4f73('0x1')]},'connectedlinename':{'type':Sequelize[_0x4f73('0x1')]},'language':{'type':Sequelize[_0x4f73('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4f73('0x1')]},'exten':{'type':Sequelize[_0x4f73('0x1')]},'priority':{'type':Sequelize[_0x4f73('0x1')]},'destchannel':{'type':Sequelize[_0x4f73('0x1')]},'destchannelstate':{'type':Sequelize[_0x4f73('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4f73('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4f73('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4f73('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4f73('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4f73('0x1')]},'destcontext':{'type':Sequelize[_0x4f73('0x1')]},'destexten':{'type':Sequelize[_0x4f73('0x1')]},'destpriority':{'type':Sequelize[_0x4f73('0x1')]},'destuniqueid':{'type':Sequelize[_0x4f73('0x1')]},'messageId':{'type':Sequelize[_0x4f73('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x4f73('0x1')]},'from':{'type':Sequelize[_0x4f73('0x1')]},'to':{'type':Sequelize[_0x4f73('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x4f73('0x5')]},'text':{'type':Sequelize[_0x4f73('0x5')]},'status':{'type':Sequelize[_0x4f73('0x6')]('SENT',_0x4f73('0x7'),_0x4f73('0x8'),_0x4f73('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4f73('0x1')]},'appdata':{'type':Sequelize[_0x4f73('0x1')]},'projectId':{'type':Sequelize[_0x4f73('0x2')]}}; \ No newline at end of file +var _0x3136=['FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','RECEIVED'];(function(_0x3f81cd,_0x3326a1){var _0x48e8b4=function(_0x51aa38){while(--_0x51aa38){_0x3f81cd['push'](_0x3f81cd['shift']());}};_0x48e8b4(++_0x3326a1);}(_0x3136,0x173));var _0x6313=function(_0x1a18a7,_0x5c6c56){_0x1a18a7=_0x1a18a7-0x0;var _0x4f0758=_0x3136[_0x1a18a7];return _0x4f0758;};'use strict';var Sequelize=require(_0x6313('0x0'));module[_0x6313('0x1')]={'integration':{'type':Sequelize[_0x6313('0x2')]},'eventChannel':{'type':Sequelize[_0x6313('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x6313('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x6313('0x2')]},'uniqueid':{'type':Sequelize[_0x6313('0x2')]},'calleridnum':{'type':Sequelize[_0x6313('0x2')]},'calleridname':{'type':Sequelize[_0x6313('0x2')]},'queue':{'type':Sequelize[_0x6313('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6313('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6313('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6313('0x3')]},'talktime':{'type':Sequelize[_0x6313('0x4')]},'agentacw':{'type':Sequelize[_0x6313('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6313('0x4')]},'reason':{'type':Sequelize[_0x6313('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x6313('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6313('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6313('0x2')]},'channelstate':{'type':Sequelize[_0x6313('0x4')]},'channelstatedesc':{'type':Sequelize[_0x6313('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6313('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6313('0x2')]},'context':{'type':Sequelize[_0x6313('0x2')]},'exten':{'type':Sequelize[_0x6313('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x6313('0x2')]},'destchannelstate':{'type':Sequelize[_0x6313('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x6313('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6313('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6313('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6313('0x2')]},'destlanguage':{'type':Sequelize[_0x6313('0x2')]},'destaccountcode':{'type':Sequelize[_0x6313('0x2')]},'destcontext':{'type':Sequelize[_0x6313('0x2')]},'destexten':{'type':Sequelize[_0x6313('0x2')]},'destpriority':{'type':Sequelize[_0x6313('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x6313('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x6313('0x2')]},'from':{'type':Sequelize[_0x6313('0x2')]},'to':{'type':Sequelize[_0x6313('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x6313('0x6')]},'html':{'type':Sequelize[_0x6313('0x6')]},'text':{'type':Sequelize[_0x6313('0x6')]},'status':{'type':Sequelize[_0x6313('0x7')]('SENT','SENDING',_0x6313('0x8'),_0x6313('0x9'))},'url':{'type':Sequelize[_0x6313('0x2')]},'app':{'type':Sequelize[_0x6313('0x2')]},'appdata':{'type':Sequelize[_0x6313('0x2')]},'projectId':{'type':Sequelize[_0x6313('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c065d83..8750c45 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 _0xb1ce=['nolimit','sort','pick','add','day','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','index','IntegrationReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length'];(function(_0x32e39f,_0x4d6c6c){var _0x579277=function(_0x19d3f0){while(--_0x19d3f0){_0x32e39f['push'](_0x32e39f['shift']());}};_0x579277(++_0x4d6c6c);}(_0xb1ce,0x125));var _0xeb1c=function(_0xbc2d9e,_0x40ef4f){_0xbc2d9e=_0xbc2d9e-0x0;var _0x2e315c=_0xb1ce[_0xbc2d9e];return _0x2e315c;};'use strict';var jsonpatch=require(_0xeb1c('0x0'));var rp=require('request-promise');var moment=require(_0xeb1c('0x1'));var BPromise=require(_0xeb1c('0x2'));var Mustache=require(_0xeb1c('0x3'));var util=require(_0xeb1c('0x4'));var path=require(_0xeb1c('0x5'));var sox=require(_0xeb1c('0x6'));var csv=require(_0xeb1c('0x7'));var ejs=require(_0xeb1c('0x8'));var fs=require('fs');var _=require(_0xeb1c('0x9'));var squel=require(_0xeb1c('0xa'));var crypto=require('crypto');var jsforce=require(_0xeb1c('0xb'));var deskjs=require(_0xeb1c('0xc'));var toCsv=require(_0xeb1c('0x7'));var querystring=require(_0xeb1c('0xd'));var Papa=require(_0xeb1c('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xeb1c('0xf'))(_0xeb1c('0x10'));var utils=require(_0xeb1c('0x11'));var config=require('../../config/environment');var db=require(_0xeb1c('0x12'))['db'];function respondWithStatusCode(_0xb043ae,_0x2ebe1f){_0x2ebe1f=_0x2ebe1f||0xcc;return function(_0x2a8753){if(_0x2a8753){return _0xb043ae[_0xeb1c('0x13')](_0x2ebe1f);}return _0xb043ae[_0xeb1c('0x14')](_0x2ebe1f)[_0xeb1c('0x15')]();};}function respondWithResult(_0x193383,_0x26a5a6){_0x26a5a6=_0x26a5a6||0xc8;return function(_0x51a321){if(_0x51a321){return _0x193383[_0xeb1c('0x14')](_0x26a5a6)[_0xeb1c('0x16')](_0x51a321);}};}function respondWithFilteredResult(_0x1a7653,_0x4640dd){return function(_0x4679ab){if(_0x4679ab){var _0x54d5c2=_0x4679ab[_0xeb1c('0x17')],_0x50a376=_0x4640dd[_0xeb1c('0x18')],_0x5049a2=_0x4640dd[_0xeb1c('0x18')]+_0x4640dd[_0xeb1c('0x19')],_0x5d928f;if(_0x5049a2>=_0x54d5c2){_0x5049a2=_0x54d5c2;_0x5d928f=0xc8;}else{_0x5d928f=0xce;}_0x1a7653[_0xeb1c('0x14')](_0x5d928f);return _0x1a7653[_0xeb1c('0x1a')](_0xeb1c('0x1b'),_0x50a376+'-'+_0x5049a2+'/'+_0x54d5c2)[_0xeb1c('0x16')](_0x4679ab);}return null;};}function patchUpdates(_0x31db98){return function(_0x52b30e){try{jsonpatch[_0xeb1c('0x1c')](_0x52b30e,_0x31db98,!![]);}catch(_0x6d684c){return BPromise['reject'](_0x6d684c);}return _0x52b30e['save']();};}function saveUpdates(_0x3872bb,_0x26a0e8){return function(_0x468cab){if(_0x468cab){return _0x468cab[_0xeb1c('0x1d')](_0x3872bb)[_0xeb1c('0x1e')](function(_0x46e325){return _0x46e325;});}return null;};}function removeEntity(_0x339277,_0x34f84c){return function(_0x432c44){if(_0x432c44){return _0x432c44[_0xeb1c('0x1f')]()['then'](function(){_0x339277['status'](0xcc)[_0xeb1c('0x15')]();});}};}function handleEntityNotFound(_0x1855ae,_0x27e155){return function(_0x287a2d){if(!_0x287a2d){_0x1855ae[_0xeb1c('0x13')](0x194);}return _0x287a2d;};}function handleError(_0x42cec8,_0x3eb4d4){_0x3eb4d4=_0x3eb4d4||0x1f4;return function(_0xe575a7){logger['error'](_0xe575a7[_0xeb1c('0x20')]);if(_0xe575a7[_0xeb1c('0x21')]){delete _0xe575a7['name'];}_0x42cec8[_0xeb1c('0x14')](_0x3eb4d4)['send'](_0xe575a7);};}exports[_0xeb1c('0x22')]=function(_0xd8da22,_0x4b4571){var _0x25bfd7={},_0x3f9d69={},_0x4ddcad={'count':0x0,'rows':[]};var _0x49fcfc=db[_0xeb1c('0x23')][_0xeb1c('0x24')];_0x3f9d69[_0xeb1c('0x25')]=_[_0xeb1c('0x26')](_0x49fcfc);var _0x519a40={'dateStart':_0xd8da22[_0xeb1c('0x27')][_0xeb1c('0x28')],'dateEnd':_0xd8da22['query'][_0xeb1c('0x29')]};delete _0xd8da22[_0xeb1c('0x27')][_0xeb1c('0x28')];delete _0xd8da22[_0xeb1c('0x27')][_0xeb1c('0x29')];_0x3f9d69['query']=_[_0xeb1c('0x26')](_0xd8da22['query']);_0x3f9d69[_0xeb1c('0x2a')]=_[_0xeb1c('0x2b')](_0x3f9d69[_0xeb1c('0x25')],_0x3f9d69[_0xeb1c('0x27')]);_0x25bfd7[_0xeb1c('0x2c')]=_['intersection'](_0x3f9d69['model'],qs['fields'](_0xd8da22[_0xeb1c('0x27')][_0xeb1c('0x2d')]));_0x25bfd7['attributes']=_0x25bfd7[_0xeb1c('0x2c')][_0xeb1c('0x2e')]?_0x25bfd7[_0xeb1c('0x2c')]:_0x3f9d69[_0xeb1c('0x25')];if(!_0xd8da22[_0xeb1c('0x27')]['hasOwnProperty'](_0xeb1c('0x2f'))){_0x25bfd7[_0xeb1c('0x19')]=qs[_0xeb1c('0x19')](_0xd8da22[_0xeb1c('0x27')][_0xeb1c('0x19')]);_0x25bfd7[_0xeb1c('0x18')]=qs['offset'](_0xd8da22['query'][_0xeb1c('0x18')]);}_0x25bfd7['order']=qs[_0xeb1c('0x30')](_0xd8da22[_0xeb1c('0x27')]['sort']);_0x25bfd7['where']=qs[_0xeb1c('0x2a')](_[_0xeb1c('0x31')](_0xd8da22[_0xeb1c('0x27')],_0x3f9d69[_0xeb1c('0x2a')]));if(_0x519a40[_0xeb1c('0x28')]){if(_0x519a40['dateEnd']){_0x519a40[_0xeb1c('0x29')]=moment(_0x519a40['dateEnd'])[_0xeb1c('0x32')](0x1,_0xeb1c('0x33'));}else{_0x519a40[_0xeb1c('0x29')]=moment(_0x519a40['dateStart'])[_0xeb1c('0x32')](0x1,_0xeb1c('0x33'));}_['merge'](_0x25bfd7[_0xeb1c('0x34')],{'createdAt':{'$gte':_0x519a40['dateStart'],'$lte':_0x519a40[_0xeb1c('0x29')]}});}if(_0xd8da22['query'][_0xeb1c('0x35')]){_0x25bfd7['where']=_[_0xeb1c('0x36')](_0x25bfd7[_0xeb1c('0x34')],{'$or':_[_0xeb1c('0x37')](_0x25bfd7[_0xeb1c('0x2c')],function(_0x3a6ba0){var _0x5b3415={};_0x5b3415[_0x3a6ba0]={'$like':'%'+_0xd8da22[_0xeb1c('0x27')]['filter']+'%'};return _0x5b3415;})});}_0x25bfd7=_[_0xeb1c('0x36')]({},_0x25bfd7,_0xd8da22[_0xeb1c('0x38')]);var _0x27cc85={'where':_0x25bfd7[_0xeb1c('0x34')]};return db[_0xeb1c('0x23')]['count'](_0x27cc85)[_0xeb1c('0x1e')](function(_0xb61037){_0x4ddcad[_0xeb1c('0x17')]=_0xb61037;if(_0xd8da22['query'][_0xeb1c('0x39')]){_0x25bfd7[_0xeb1c('0x3a')]=[{'all':!![]}];}return db['IntegrationReport'][_0xeb1c('0x3b')](_0x25bfd7);})[_0xeb1c('0x1e')](function(_0x3bcf25){_0x4ddcad[_0xeb1c('0x3c')]=_0x3bcf25;return _0x4ddcad;})[_0xeb1c('0x1e')](respondWithFilteredResult(_0x4b4571,_0x25bfd7))[_0xeb1c('0x3d')](handleError(_0x4b4571,null));};exports[_0xeb1c('0x3e')]=function(_0x4ec09e,_0x1fa9f4){var _0xd5fc83={'raw':![],'where':{'id':_0x4ec09e['params']['id']}},_0x5e37e4={};_0x5e37e4[_0xeb1c('0x25')]=_[_0xeb1c('0x26')](db[_0xeb1c('0x23')]['rawAttributes']);_0x5e37e4[_0xeb1c('0x27')]=_['keys'](_0x4ec09e['query']);_0x5e37e4[_0xeb1c('0x2a')]=_['intersection'](_0x5e37e4[_0xeb1c('0x25')],_0x5e37e4['query']);_0xd5fc83[_0xeb1c('0x2c')]=_['intersection'](_0x5e37e4[_0xeb1c('0x25')],qs[_0xeb1c('0x2d')](_0x4ec09e['query']['fields']));_0xd5fc83[_0xeb1c('0x2c')]=_0xd5fc83['attributes']['length']?_0xd5fc83['attributes']:_0x5e37e4[_0xeb1c('0x25')];if(_0x4ec09e[_0xeb1c('0x27')]['includeAll']){_0xd5fc83[_0xeb1c('0x3a')]=[{'all':!![]}];}_0xd5fc83=_[_0xeb1c('0x36')]({},_0xd5fc83,_0x4ec09e[_0xeb1c('0x38')]);return db[_0xeb1c('0x23')][_0xeb1c('0x3f')](_0xd5fc83)[_0xeb1c('0x1e')](handleEntityNotFound(_0x1fa9f4,null))[_0xeb1c('0x1e')](respondWithResult(_0x1fa9f4,null))[_0xeb1c('0x3d')](handleError(_0x1fa9f4,null));};exports[_0xeb1c('0x40')]=function(_0x5027c3,_0xfa6fd0){return db['IntegrationReport'][_0xeb1c('0x40')](_0x5027c3['body'],{})['then'](respondWithResult(_0xfa6fd0,0xc9))[_0xeb1c('0x3d')](handleError(_0xfa6fd0,null));};exports[_0xeb1c('0x1d')]=function(_0x1ec5ca,_0x3d89cf){if(_0x1ec5ca[_0xeb1c('0x41')]['id']){delete _0x1ec5ca[_0xeb1c('0x41')]['id'];}return db[_0xeb1c('0x23')][_0xeb1c('0x3f')]({'where':{'id':_0x1ec5ca[_0xeb1c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d89cf,null))[_0xeb1c('0x1e')](saveUpdates(_0x1ec5ca[_0xeb1c('0x41')],null))['then'](respondWithResult(_0x3d89cf,null))[_0xeb1c('0x3d')](handleError(_0x3d89cf,null));};exports[_0xeb1c('0x1f')]=function(_0x3bfdc0,_0x5041c5){return db[_0xeb1c('0x23')][_0xeb1c('0x3f')]({'where':{'id':_0x3bfdc0[_0xeb1c('0x42')]['id']}})[_0xeb1c('0x1e')](handleEntityNotFound(_0x5041c5,null))['then'](removeEntity(_0x5041c5,null))[_0xeb1c('0x3d')](handleError(_0x5041c5,null));};exports['describe']=function(_0x47c201,_0x329eef){return db['IntegrationReport'][_0xeb1c('0x43')]()['then'](respondWithResult(_0x329eef,null))[_0xeb1c('0x3d')](handleError(_0x329eef,null));}; \ No newline at end of file +var _0x54f8=['query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','IntegrationReport','rawAttributes','model','keys'];(function(_0x1e7a37,_0x4dc386){var _0x164bcf=function(_0x539875){while(--_0x539875){_0x1e7a37['push'](_0x1e7a37['shift']());}};_0x164bcf(++_0x4dc386);}(_0x54f8,0x182));var _0x854f=function(_0x1a3449,_0xcc0fa4){_0x1a3449=_0x1a3449-0x0;var _0xd0a572=_0x54f8[_0x1a3449];return _0xd0a572;};'use strict';var jsonpatch=require(_0x854f('0x0'));var rp=require('request-promise');var moment=require(_0x854f('0x1'));var BPromise=require(_0x854f('0x2'));var Mustache=require(_0x854f('0x3'));var util=require(_0x854f('0x4'));var path=require('path');var sox=require(_0x854f('0x5'));var csv=require(_0x854f('0x6'));var ejs=require(_0x854f('0x7'));var fs=require('fs');var _=require(_0x854f('0x8'));var squel=require('squel');var crypto=require(_0x854f('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x854f('0x6'));var querystring=require(_0x854f('0xa'));var Papa=require(_0x854f('0xb'));var qs=require(_0x854f('0xc'));var logger=require('../../config/logger')(_0x854f('0xd'));var utils=require(_0x854f('0xe'));var config=require(_0x854f('0xf'));var db=require(_0x854f('0x10'))['db'];function respondWithStatusCode(_0x141441,_0x2b2877){_0x2b2877=_0x2b2877||0xcc;return function(_0x1a2c2a){if(_0x1a2c2a){return _0x141441[_0x854f('0x11')](_0x2b2877);}return _0x141441[_0x854f('0x12')](_0x2b2877)['end']();};}function respondWithResult(_0x548ecf,_0x2736bd){_0x2736bd=_0x2736bd||0xc8;return function(_0x53b8fd){if(_0x53b8fd){return _0x548ecf[_0x854f('0x12')](_0x2736bd)[_0x854f('0x13')](_0x53b8fd);}};}function respondWithFilteredResult(_0x219309,_0x28ae11){return function(_0x1abae6){if(_0x1abae6){var _0xd4319b=_0x1abae6[_0x854f('0x14')],_0xfd8a95=_0x28ae11['offset'],_0x5199fd=_0x28ae11[_0x854f('0x15')]+_0x28ae11['limit'],_0x45721c;if(_0x5199fd>=_0xd4319b){_0x5199fd=_0xd4319b;_0x45721c=0xc8;}else{_0x45721c=0xce;}_0x219309[_0x854f('0x12')](_0x45721c);return _0x219309[_0x854f('0x16')](_0x854f('0x17'),_0xfd8a95+'-'+_0x5199fd+'/'+_0xd4319b)[_0x854f('0x13')](_0x1abae6);}return null;};}function patchUpdates(_0x20c7b0){return function(_0x20aedb){try{jsonpatch[_0x854f('0x18')](_0x20aedb,_0x20c7b0,!![]);}catch(_0x3bcdab){return BPromise[_0x854f('0x19')](_0x3bcdab);}return _0x20aedb[_0x854f('0x1a')]();};}function saveUpdates(_0x4ac641,_0x13b5c7){return function(_0x34aa7f){if(_0x34aa7f){return _0x34aa7f[_0x854f('0x1b')](_0x4ac641)[_0x854f('0x1c')](function(_0x2806f7){return _0x2806f7;});}return null;};}function removeEntity(_0x3b4334,_0x18248f){return function(_0x49c5f1){if(_0x49c5f1){return _0x49c5f1[_0x854f('0x1d')]()[_0x854f('0x1c')](function(){_0x3b4334['status'](0xcc)[_0x854f('0x1e')]();});}};}function handleEntityNotFound(_0x1f6029,_0x43da95){return function(_0x3ffff0){if(!_0x3ffff0){_0x1f6029['sendStatus'](0x194);}return _0x3ffff0;};}function handleError(_0x10b814,_0x4f6322){_0x4f6322=_0x4f6322||0x1f4;return function(_0x539aa9){logger[_0x854f('0x1f')](_0x539aa9[_0x854f('0x20')]);if(_0x539aa9['name']){delete _0x539aa9[_0x854f('0x21')];}_0x10b814[_0x854f('0x12')](_0x4f6322)[_0x854f('0x22')](_0x539aa9);};}exports[_0x854f('0x23')]=function(_0x333986,_0x1811a3){var _0x1874a1={},_0x41b010={},_0x38abcc={'count':0x0,'rows':[]};var _0x6b9b18=db[_0x854f('0x24')][_0x854f('0x25')];_0x41b010[_0x854f('0x26')]=_[_0x854f('0x27')](_0x6b9b18);var _0x5eebbc={'dateStart':_0x333986[_0x854f('0x28')][_0x854f('0x29')],'dateEnd':_0x333986[_0x854f('0x28')][_0x854f('0x2a')]};delete _0x333986[_0x854f('0x28')][_0x854f('0x29')];delete _0x333986[_0x854f('0x28')]['dateEnd'];_0x41b010[_0x854f('0x28')]=_[_0x854f('0x27')](_0x333986[_0x854f('0x28')]);_0x41b010[_0x854f('0x2b')]=_[_0x854f('0x2c')](_0x41b010[_0x854f('0x26')],_0x41b010[_0x854f('0x28')]);_0x1874a1[_0x854f('0x2d')]=_[_0x854f('0x2c')](_0x41b010[_0x854f('0x26')],qs[_0x854f('0x2e')](_0x333986[_0x854f('0x28')][_0x854f('0x2e')]));_0x1874a1[_0x854f('0x2d')]=_0x1874a1[_0x854f('0x2d')][_0x854f('0x2f')]?_0x1874a1[_0x854f('0x2d')]:_0x41b010[_0x854f('0x26')];if(!_0x333986[_0x854f('0x28')][_0x854f('0x30')](_0x854f('0x31'))){_0x1874a1[_0x854f('0x32')]=qs[_0x854f('0x32')](_0x333986[_0x854f('0x28')][_0x854f('0x32')]);_0x1874a1['offset']=qs['offset'](_0x333986['query'][_0x854f('0x15')]);}_0x1874a1['order']=qs[_0x854f('0x33')](_0x333986['query'][_0x854f('0x33')]);_0x1874a1[_0x854f('0x34')]=qs[_0x854f('0x2b')](_[_0x854f('0x35')](_0x333986[_0x854f('0x28')],_0x41b010[_0x854f('0x2b')]));if(_0x5eebbc[_0x854f('0x29')]){if(_0x5eebbc[_0x854f('0x2a')]){_0x5eebbc[_0x854f('0x2a')]=moment(_0x5eebbc[_0x854f('0x2a')])[_0x854f('0x36')](0x1,_0x854f('0x37'));}else{_0x5eebbc[_0x854f('0x2a')]=moment(_0x5eebbc['dateStart'])['add'](0x1,'day');}_['merge'](_0x1874a1['where'],{'createdAt':{'$gte':_0x5eebbc[_0x854f('0x29')],'$lte':_0x5eebbc[_0x854f('0x2a')]}});}if(_0x333986[_0x854f('0x28')]['filter']){_0x1874a1['where']=_[_0x854f('0x38')](_0x1874a1[_0x854f('0x34')],{'$or':_[_0x854f('0x39')](_0x1874a1['attributes'],function(_0x53f9e3){var _0x454962={};_0x454962[_0x53f9e3]={'$like':'%'+_0x333986[_0x854f('0x28')][_0x854f('0x3a')]+'%'};return _0x454962;})});}_0x1874a1=_[_0x854f('0x38')]({},_0x1874a1,_0x333986[_0x854f('0x3b')]);var _0x417ad2={'where':_0x1874a1['where']};return db[_0x854f('0x24')][_0x854f('0x14')](_0x417ad2)[_0x854f('0x1c')](function(_0xd7e3c4){_0x38abcc[_0x854f('0x14')]=_0xd7e3c4;if(_0x333986[_0x854f('0x28')][_0x854f('0x3c')]){_0x1874a1[_0x854f('0x3d')]=[{'all':!![]}];}return db[_0x854f('0x24')][_0x854f('0x3e')](_0x1874a1);})['then'](function(_0x45e99a){_0x38abcc[_0x854f('0x3f')]=_0x45e99a;return _0x38abcc;})[_0x854f('0x1c')](respondWithFilteredResult(_0x1811a3,_0x1874a1))[_0x854f('0x40')](handleError(_0x1811a3,null));};exports[_0x854f('0x41')]=function(_0x14b509,_0x31cb7c){var _0x3a29fd={'raw':![],'where':{'id':_0x14b509['params']['id']}},_0x18ea6b={};_0x18ea6b[_0x854f('0x26')]=_[_0x854f('0x27')](db[_0x854f('0x24')][_0x854f('0x25')]);_0x18ea6b[_0x854f('0x28')]=_[_0x854f('0x27')](_0x14b509['query']);_0x18ea6b[_0x854f('0x2b')]=_['intersection'](_0x18ea6b[_0x854f('0x26')],_0x18ea6b[_0x854f('0x28')]);_0x3a29fd[_0x854f('0x2d')]=_[_0x854f('0x2c')](_0x18ea6b[_0x854f('0x26')],qs[_0x854f('0x2e')](_0x14b509['query'][_0x854f('0x2e')]));_0x3a29fd['attributes']=_0x3a29fd['attributes']['length']?_0x3a29fd[_0x854f('0x2d')]:_0x18ea6b[_0x854f('0x26')];if(_0x14b509['query'][_0x854f('0x3c')]){_0x3a29fd[_0x854f('0x3d')]=[{'all':!![]}];}_0x3a29fd=_[_0x854f('0x38')]({},_0x3a29fd,_0x14b509[_0x854f('0x3b')]);return db[_0x854f('0x24')][_0x854f('0x42')](_0x3a29fd)['then'](handleEntityNotFound(_0x31cb7c,null))[_0x854f('0x1c')](respondWithResult(_0x31cb7c,null))[_0x854f('0x40')](handleError(_0x31cb7c,null));};exports[_0x854f('0x43')]=function(_0xa64dfc,_0x4e887d){return db[_0x854f('0x24')][_0x854f('0x43')](_0xa64dfc[_0x854f('0x44')],{})['then'](respondWithResult(_0x4e887d,0xc9))[_0x854f('0x40')](handleError(_0x4e887d,null));};exports['update']=function(_0x3ce994,_0x2a8651){if(_0x3ce994[_0x854f('0x44')]['id']){delete _0x3ce994[_0x854f('0x44')]['id'];}return db['IntegrationReport'][_0x854f('0x42')]({'where':{'id':_0x3ce994[_0x854f('0x45')]['id']}})[_0x854f('0x1c')](handleEntityNotFound(_0x2a8651,null))['then'](saveUpdates(_0x3ce994[_0x854f('0x44')],null))[_0x854f('0x1c')](respondWithResult(_0x2a8651,null))['catch'](handleError(_0x2a8651,null));};exports[_0x854f('0x1d')]=function(_0x43a2ff,_0x2edf1b){return db[_0x854f('0x24')][_0x854f('0x42')]({'where':{'id':_0x43a2ff[_0x854f('0x45')]['id']}})[_0x854f('0x1c')](handleEntityNotFound(_0x2edf1b,null))[_0x854f('0x1c')](removeEntity(_0x2edf1b,null))[_0x854f('0x40')](handleError(_0x2edf1b,null));};exports[_0x854f('0x46')]=function(_0x187398,_0xdcdd97){return db['IntegrationReport'][_0x854f('0x46')]()[_0x854f('0x1c')](respondWithResult(_0xdcdd97,null))[_0x854f('0x40')](handleError(_0xdcdd97,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0f6bd6b..94f3b19 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 _0x53ec=['./integrationReport.attributes','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x7ef63f,_0x23b315){var _0x200fae=function(_0x53a6fb){while(--_0x53a6fb){_0x7ef63f['push'](_0x7ef63f['shift']());}};_0x200fae(++_0x23b315);}(_0x53ec,0x192));var _0xc53e=function(_0x9a138c,_0x2607f8){_0x9a138c=_0x9a138c-0x0;var _0x3771a3=_0x53ec[_0x9a138c];return _0x3771a3;};'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':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb9=['request-promise','./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0xafb9,0x68));var _0x9afb=function(_0x5c9077,_0x2855bb){_0x5c9077=_0x5c9077-0x0;var _0x2a1fa8=_0xafb9[_0x5c9077];return _0x2a1fa8;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var attributes=require(_0x9afb('0x7'));module[_0x9afb('0x8')]=function(_0x4e983d,_0x498463){return _0x4e983d[_0x9afb('0x9')]('IntegrationReport',attributes,{'tableName':_0x9afb('0xa'),'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 f096ef5..2b53a00 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 _0xf390=['jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e3c62,_0x25dd61){var _0x3cd32e=function(_0x575416){while(--_0x575416){_0x1e3c62['push'](_0x1e3c62['shift']());}};_0x3cd32e(++_0x25dd61);}(_0xf390,0x12c));var _0x0f39=function(_0x11db9c,_0x5b6919){_0x11db9c=_0x11db9c-0x0;var _0x4a6303=_0xf390[_0x11db9c];return _0x4a6303;};'use strict';var _=require(_0x0f39('0x0'));var util=require('util');var moment=require(_0x0f39('0x1'));var BPromise=require(_0x0f39('0x2'));var rs=require(_0x0f39('0x3'));var fs=require('fs');var db=require(_0x0f39('0x4'))['db'];var utils=require(_0x0f39('0x5'));var logger=require(_0x0f39('0x6'))(_0x0f39('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f39('0x8'));var client=jayson[_0x0f39('0x9')][_0x0f39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x273fd8,_0x542547,_0x20fe04){return new BPromise(function(_0x40b682,_0x58ccde){return client[_0x0f39('0xb')](_0x273fd8,_0x20fe04)[_0x0f39('0xc')](function(_0x33a22a){logger['info'](_0x0f39('0xd'),_0x542547,'request\x20sent');logger['debug'](_0x0f39('0xe'),_0x542547,_0x0f39('0xf'),JSON[_0x0f39('0x10')](_0x33a22a));if(_0x33a22a[_0x0f39('0x11')]){if(_0x33a22a[_0x0f39('0x11')]['code']===0x1f4){logger[_0x0f39('0x11')](_0x0f39('0xd'),_0x542547,_0x33a22a['error'][_0x0f39('0x12')]);return _0x58ccde(_0x33a22a[_0x0f39('0x11')][_0x0f39('0x12')]);}logger[_0x0f39('0x11')](_0x0f39('0xd'),_0x542547,_0x33a22a[_0x0f39('0x11')]['message']);return _0x40b682(_0x33a22a[_0x0f39('0x11')][_0x0f39('0x12')]);}else{logger[_0x0f39('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x542547,_0x0f39('0xf'));_0x40b682(_0x33a22a[_0x0f39('0x14')][_0x0f39('0x12')]);}})[_0x0f39('0x15')](function(_0x360266){logger[_0x0f39('0x11')](_0x0f39('0xd'),_0x542547,_0x360266);_0x58ccde(_0x360266);});});} \ No newline at end of file +var _0xfc4c=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xda6f41,_0xe46e43){var _0x8aa017=function(_0x1f9742){while(--_0x1f9742){_0xda6f41['push'](_0xda6f41['shift']());}};_0x8aa017(++_0xe46e43);}(_0xfc4c,0x1d2));var _0xcfc4=function(_0x1ef9f2,_0x55e760){_0x1ef9f2=_0x1ef9f2-0x0;var _0x2e433f=_0xfc4c[_0x1ef9f2];return _0x2e433f;};'use strict';var _=require(_0xcfc4('0x0'));var util=require(_0xcfc4('0x1'));var moment=require(_0xcfc4('0x2'));var BPromise=require(_0xcfc4('0x3'));var rs=require(_0xcfc4('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xcfc4('0x5'));var logger=require(_0xcfc4('0x6'))(_0xcfc4('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfc4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c0adc,_0x1e3523,_0x2017b5){return new BPromise(function(_0x1d30ec,_0x264c8f){return client['request'](_0x3c0adc,_0x2017b5)[_0xcfc4('0x9')](function(_0x3e08ee){logger[_0xcfc4('0xa')](_0xcfc4('0xb'),_0x1e3523,_0xcfc4('0xc'));logger['debug'](_0xcfc4('0xd'),_0x1e3523,_0xcfc4('0xc'),JSON[_0xcfc4('0xe')](_0x3e08ee));if(_0x3e08ee[_0xcfc4('0xf')]){if(_0x3e08ee[_0xcfc4('0xf')][_0xcfc4('0x10')]===0x1f4){logger[_0xcfc4('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x1e3523,_0x3e08ee[_0xcfc4('0xf')][_0xcfc4('0x11')]);return _0x264c8f(_0x3e08ee[_0xcfc4('0xf')][_0xcfc4('0x11')]);}logger[_0xcfc4('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x1e3523,_0x3e08ee[_0xcfc4('0xf')][_0xcfc4('0x11')]);return _0x1d30ec(_0x3e08ee['error'][_0xcfc4('0x11')]);}else{logger[_0xcfc4('0xa')]('IntegrationReport,\x20%s,\x20%s',_0x1e3523,'request\x20sent');_0x1d30ec(_0x3e08ee[_0xcfc4('0x12')][_0xcfc4('0x11')]);}})['catch'](function(_0x3a7966){logger[_0xcfc4('0xf')](_0xcfc4('0xb'),_0x1e3523,_0x3a7966);_0x264c8f(_0x3a7966);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4911aa6..576efc5 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 _0x6fa7=['delete','destroy','multer','util','express','../../components/auth/service','../../config/environment','./interval.controller','get','index','isAuthenticated','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','/:id','update'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x6fa7,0x1d0));var _0x76fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fa7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x76fa('0x0'));var util=require(_0x76fa('0x1'));var path=require('path');var express=require(_0x76fa('0x2'));var router=express['Router']();var auth=require(_0x76fa('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76fa('0x4'));var controller=require(_0x76fa('0x5'));router[_0x76fa('0x6')]('/',auth['isAuthenticated'](),controller[_0x76fa('0x7')]);router[_0x76fa('0x6')]('/:id',auth[_0x76fa('0x8')](),controller[_0x76fa('0x9')]);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x76fa('0xa')]);router[_0x76fa('0xb')]('/',auth[_0x76fa('0x8')](),controller[_0x76fa('0xc')]);router['post'](_0x76fa('0xd'),auth[_0x76fa('0x8')](),controller[_0x76fa('0xe')]);router[_0x76fa('0xb')](_0x76fa('0xf'),auth[_0x76fa('0x8')](),controller['addIntervals']);router[_0x76fa('0x10')](_0x76fa('0x11'),auth[_0x76fa('0x8')](),controller[_0x76fa('0x12')]);router[_0x76fa('0x13')]('/:id',auth[_0x76fa('0x8')](),controller[_0x76fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x80c0=['/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','/:id'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x80c0,0x82));var _0x080c=function(_0x10a16a,_0xa6c9f2){_0x10a16a=_0x10a16a-0x0;var _0x673350=_0x80c0[_0x10a16a];return _0x673350;};'use strict';var multer=require(_0x080c('0x0'));var util=require(_0x080c('0x1'));var path=require(_0x080c('0x2'));var express=require(_0x080c('0x3'));var router=express['Router']();var auth=require(_0x080c('0x4'));var interaction=require(_0x080c('0x5'));var config=require('../../config/environment');var controller=require(_0x080c('0x6'));router[_0x080c('0x7')]('/',auth[_0x080c('0x8')](),controller['index']);router[_0x080c('0x7')](_0x080c('0x9'),auth[_0x080c('0x8')](),controller['show']);router[_0x080c('0x7')](_0x080c('0xa'),auth[_0x080c('0x8')](),controller[_0x080c('0xb')]);router['post']('/',auth[_0x080c('0x8')](),controller['create']);router[_0x080c('0xc')]('/:id/sub_intervals',auth['isAuthenticated'](),controller['addInterval']);router[_0x080c('0xc')](_0x080c('0xd'),auth[_0x080c('0x8')](),controller[_0x080c('0xe')]);router[_0x080c('0xf')](_0x080c('0x9'),auth[_0x080c('0x8')](),controller[_0x080c('0x10')]);router[_0x080c('0x11')](_0x080c('0x9'),auth['isAuthenticated'](),controller[_0x080c('0x12')]);module[_0x080c('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f9a86ab..d184258 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 _0xc748=['exports','STRING'];(function(_0xba12e8,_0x1dcca2){var _0x25c446=function(_0x6a8c82){while(--_0x6a8c82){_0xba12e8['push'](_0xba12e8['shift']());}};_0x25c446(++_0x1dcca2);}(_0xc748,0x13a));var _0x8c74=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xc748[_0x5311a1];return _0x2acb9f;};'use strict';var Sequelize=require('sequelize');module[_0x8c74('0x0')]={'name':{'type':Sequelize[_0x8c74('0x1')]},'description':{'type':Sequelize[_0x8c74('0x1')]},'interval':{'type':Sequelize[_0x8c74('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8107=['STRING','exports'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x8107,0x1f1));var _0x7810=function(_0x551906,_0x569941){_0x551906=_0x551906-0x0;var _0x58bfb6=_0x8107[_0x551906];return _0x58bfb6;};'use strict';var Sequelize=require('sequelize');module[_0x7810('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7810('0x1')]},'interval':{'type':Sequelize[_0x7810('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index da42cc2..d190c34 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 _0xd23a=['IntervalId','getIntervals','findOne','sort','pick','sequelize','transaction','bulkCreate','findAll','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','Interval','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','add','day','merge','filter','rows','catch','show','includeAll','options','find','create','body','update','params'];(function(_0x14b170,_0x1339ad){var _0x1be761=function(_0x4026f3){while(--_0x4026f3){_0x14b170['push'](_0x14b170['shift']());}};_0x1be761(++_0x1339ad);}(_0xd23a,0xe7));var _0xad23=function(_0x1e6622,_0x102bc4){_0x1e6622=_0x1e6622-0x0;var _0x20c415=_0xd23a[_0x1e6622];return _0x20c415;};'use strict';var jsonpatch=require(_0xad23('0x0'));var rp=require('request-promise');var moment=require(_0xad23('0x1'));var BPromise=require(_0xad23('0x2'));var Mustache=require(_0xad23('0x3'));var util=require(_0xad23('0x4'));var path=require(_0xad23('0x5'));var sox=require('sox');var csv=require(_0xad23('0x6'));var ejs=require(_0xad23('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xad23('0x8'));var crypto=require(_0xad23('0x9'));var jsforce=require(_0xad23('0xa'));var deskjs=require(_0xad23('0xb'));var toCsv=require('to-csv');var querystring=require(_0xad23('0xc'));var Papa=require(_0xad23('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xad23('0xe'))(_0xad23('0xf'));var utils=require(_0xad23('0x10'));var config=require(_0xad23('0x11'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3f3954,_0x25a158){_0x25a158=_0x25a158||0xcc;return function(_0x3da922){if(_0x3da922){return _0x3f3954[_0xad23('0x12')](_0x25a158);}return _0x3f3954['status'](_0x25a158)[_0xad23('0x13')]();};}function respondWithResult(_0x20a019,_0x7d1145){_0x7d1145=_0x7d1145||0xc8;return function(_0x380815){if(_0x380815){return _0x20a019[_0xad23('0x14')](_0x7d1145)[_0xad23('0x15')](_0x380815);}};}function respondWithFilteredResult(_0x17c0b6,_0x474922){return function(_0x2ab8ee){if(_0x2ab8ee){var _0x410a8f=_0x2ab8ee[_0xad23('0x16')],_0x13cd75=_0x474922[_0xad23('0x17')],_0x5a2fb7=_0x474922[_0xad23('0x17')]+_0x474922[_0xad23('0x18')],_0x471267;if(_0x5a2fb7>=_0x410a8f){_0x5a2fb7=_0x410a8f;_0x471267=0xc8;}else{_0x471267=0xce;}_0x17c0b6[_0xad23('0x14')](_0x471267);return _0x17c0b6[_0xad23('0x19')](_0xad23('0x1a'),_0x13cd75+'-'+_0x5a2fb7+'/'+_0x410a8f)[_0xad23('0x15')](_0x2ab8ee);}return null;};}function patchUpdates(_0x3a6e59){return function(_0x54d1e3){try{jsonpatch[_0xad23('0x1b')](_0x54d1e3,_0x3a6e59,!![]);}catch(_0x2ce2ec){return BPromise[_0xad23('0x1c')](_0x2ce2ec);}return _0x54d1e3[_0xad23('0x1d')]();};}function saveUpdates(_0x2f0da8,_0x1f1972){return function(_0x25f8a8){if(_0x25f8a8){return _0x25f8a8['update'](_0x2f0da8)['then'](function(_0x444426){return _0x444426;});}return null;};}function removeEntity(_0x5e3119,_0x15eb54){return function(_0x5d49f2){if(_0x5d49f2){return _0x5d49f2[_0xad23('0x1e')]()[_0xad23('0x1f')](function(){_0x5e3119[_0xad23('0x14')](0xcc)[_0xad23('0x13')]();});}};}function handleEntityNotFound(_0x559981,_0x197dd1){return function(_0x47c461){if(!_0x47c461){_0x559981[_0xad23('0x12')](0x194);}return _0x47c461;};}function handleError(_0x368fde,_0x2be90a){_0x2be90a=_0x2be90a||0x1f4;return function(_0x204e6b){logger[_0xad23('0x20')](_0x204e6b['stack']);if(_0x204e6b[_0xad23('0x21')]){delete _0x204e6b[_0xad23('0x21')];}_0x368fde[_0xad23('0x14')](_0x2be90a)[_0xad23('0x22')](_0x204e6b);};}exports[_0xad23('0x23')]=function(_0x1114c8,_0x62e1fc){var _0x324256={},_0x5e3816={},_0x52afd6={'count':0x0,'rows':[]};var _0x304b14=db[_0xad23('0x24')][_0xad23('0x25')];_0x5e3816['model']=_[_0xad23('0x26')](_0x304b14);var _0x5c1af1={'dateStart':_0x1114c8['query']['dateStart'],'dateEnd':_0x1114c8[_0xad23('0x27')][_0xad23('0x28')]};delete _0x1114c8['query'][_0xad23('0x29')];delete _0x1114c8[_0xad23('0x27')][_0xad23('0x28')];_0x5e3816[_0xad23('0x27')]=_[_0xad23('0x26')](_0x1114c8[_0xad23('0x27')]);_0x5e3816[_0xad23('0x2a')]=_[_0xad23('0x2b')](_0x5e3816[_0xad23('0x2c')],_0x5e3816[_0xad23('0x27')]);_0x324256[_0xad23('0x2d')]=_[_0xad23('0x2b')](_0x5e3816[_0xad23('0x2c')],qs[_0xad23('0x2e')](_0x1114c8[_0xad23('0x27')]['fields']));_0x324256[_0xad23('0x2d')]=_0x324256[_0xad23('0x2d')][_0xad23('0x2f')]?_0x324256[_0xad23('0x2d')]:_0x5e3816[_0xad23('0x2c')];if(!_0x1114c8[_0xad23('0x27')][_0xad23('0x30')](_0xad23('0x31'))){_0x324256[_0xad23('0x18')]=qs[_0xad23('0x18')](_0x1114c8[_0xad23('0x27')]['limit']);_0x324256[_0xad23('0x17')]=qs['offset'](_0x1114c8[_0xad23('0x27')][_0xad23('0x17')]);}_0x324256['order']=qs['sort'](_0x1114c8[_0xad23('0x27')]['sort']);_0x324256[_0xad23('0x32')]=qs[_0xad23('0x2a')](_['pick'](_0x1114c8['query'],_0x5e3816[_0xad23('0x2a')]));if(_0x5c1af1[_0xad23('0x29')]){if(_0x5c1af1[_0xad23('0x28')]){_0x5c1af1[_0xad23('0x28')]=moment(_0x5c1af1[_0xad23('0x28')])[_0xad23('0x33')](0x1,'day');}else{_0x5c1af1[_0xad23('0x28')]=moment(_0x5c1af1[_0xad23('0x29')])[_0xad23('0x33')](0x1,_0xad23('0x34'));}_[_0xad23('0x35')](_0x324256[_0xad23('0x32')],{'createdAt':{'$gte':_0x5c1af1['dateStart'],'$lte':_0x5c1af1[_0xad23('0x28')]}});}if(_0x1114c8[_0xad23('0x27')][_0xad23('0x36')]){_0x324256[_0xad23('0x32')]=_[_0xad23('0x35')](_0x324256[_0xad23('0x32')],{'$or':_['map'](_0x324256[_0xad23('0x2d')],function(_0x51ab2d){var _0x517223={};_0x517223[_0x51ab2d]={'$like':'%'+_0x1114c8[_0xad23('0x27')][_0xad23('0x36')]+'%'};return _0x517223;})});}_0x324256=_[_0xad23('0x35')]({},_0x324256,_0x1114c8['options']);var _0x38a393={'where':_0x324256[_0xad23('0x32')]};return db[_0xad23('0x24')][_0xad23('0x16')](_0x38a393)[_0xad23('0x1f')](function(_0x5278ac){_0x52afd6[_0xad23('0x16')]=_0x5278ac;if(_0x1114c8[_0xad23('0x27')]['includeAll']){_0x324256['include']=[{'all':!![]}];}return db[_0xad23('0x24')]['findAll'](_0x324256);})[_0xad23('0x1f')](function(_0x2ca4e7){_0x52afd6[_0xad23('0x37')]=_0x2ca4e7;return _0x52afd6;})[_0xad23('0x1f')](respondWithFilteredResult(_0x62e1fc,_0x324256))[_0xad23('0x38')](handleError(_0x62e1fc,null));};exports[_0xad23('0x39')]=function(_0x48c58,_0x53a0a6){var _0x293a1f={'raw':!![],'where':{'id':_0x48c58['params']['id']}},_0x18f134={};_0x18f134[_0xad23('0x2c')]=_[_0xad23('0x26')](db['Interval'][_0xad23('0x25')]);_0x18f134[_0xad23('0x27')]=_[_0xad23('0x26')](_0x48c58[_0xad23('0x27')]);_0x18f134[_0xad23('0x2a')]=_[_0xad23('0x2b')](_0x18f134['model'],_0x18f134[_0xad23('0x27')]);_0x293a1f[_0xad23('0x2d')]=_['intersection'](_0x18f134[_0xad23('0x2c')],qs[_0xad23('0x2e')](_0x48c58[_0xad23('0x27')][_0xad23('0x2e')]));_0x293a1f[_0xad23('0x2d')]=_0x293a1f[_0xad23('0x2d')]['length']?_0x293a1f[_0xad23('0x2d')]:_0x18f134['model'];if(_0x48c58[_0xad23('0x27')][_0xad23('0x3a')]){_0x293a1f['include']=[{'all':!![]}];}_0x293a1f=_[_0xad23('0x35')]({},_0x293a1f,_0x48c58[_0xad23('0x3b')]);return db[_0xad23('0x24')][_0xad23('0x3c')](_0x293a1f)[_0xad23('0x1f')](handleEntityNotFound(_0x53a0a6,null))[_0xad23('0x1f')](respondWithResult(_0x53a0a6,null))[_0xad23('0x38')](handleError(_0x53a0a6,null));};exports[_0xad23('0x3d')]=function(_0x41c981,_0x359679){return db['Interval']['create'](_0x41c981[_0xad23('0x3e')],{})['then'](respondWithResult(_0x359679,0xc9))['catch'](handleError(_0x359679,null));};exports[_0xad23('0x3f')]=function(_0x35f671,_0x1f5e16){if(_0x35f671[_0xad23('0x3e')]['id']){delete _0x35f671[_0xad23('0x3e')]['id'];}return db[_0xad23('0x24')][_0xad23('0x3c')]({'where':{'id':_0x35f671[_0xad23('0x40')]['id']}})['then'](handleEntityNotFound(_0x1f5e16,null))[_0xad23('0x1f')](saveUpdates(_0x35f671[_0xad23('0x3e')],null))[_0xad23('0x1f')](respondWithResult(_0x1f5e16,null))['catch'](handleError(_0x1f5e16,null));};exports[_0xad23('0x1e')]=function(_0x682c42,_0x4c26f1){return db[_0xad23('0x24')][_0xad23('0x3c')]({'where':{'id':_0x682c42['params']['id']}})[_0xad23('0x1f')](handleEntityNotFound(_0x4c26f1,null))['then'](removeEntity(_0x4c26f1,null))['catch'](handleError(_0x4c26f1,null));};exports['addInterval']=function(_0x459825,_0x51bdec,_0x4ba54f){if(_0x459825['body']['id']){delete _0x459825['body']['id'];}return db[_0xad23('0x24')]['find']({'where':{'id':_0x459825[_0xad23('0x40')]['id']}})[_0xad23('0x1f')](handleEntityNotFound(_0x51bdec,null))[_0xad23('0x1f')](function(_0x53499d){if(_0x53499d){_0x459825['body'][_0xad23('0x41')]=_0x53499d['id'];return db[_0xad23('0x24')]['create'](_0x459825[_0xad23('0x3e')]);}})['then'](respondWithResult(_0x51bdec,null))[_0xad23('0x38')](handleError(_0x51bdec,null));};exports[_0xad23('0x42')]=function(_0x342ad6,_0x1aa3eb,_0x4c493b){var _0xbab8d2={};var _0x5f1306={};var _0x8fca67;var _0x46c57f;return db[_0xad23('0x24')][_0xad23('0x43')]({'where':{'id':_0x342ad6[_0xad23('0x40')]['id']}})[_0xad23('0x1f')](handleEntityNotFound(_0x1aa3eb,null))[_0xad23('0x1f')](function(_0x8edbb8){if(_0x8edbb8){_0x8fca67=_0x8edbb8;_0x5f1306[_0xad23('0x2c')]=_[_0xad23('0x26')](db[_0xad23('0x24')][_0xad23('0x25')]);_0x5f1306['query']=_[_0xad23('0x26')](_0x342ad6[_0xad23('0x27')]);_0x5f1306['filters']=_[_0xad23('0x2b')](_0x5f1306[_0xad23('0x2c')],_0x5f1306[_0xad23('0x27')]);_0xbab8d2['attributes']=_[_0xad23('0x2b')](_0x5f1306[_0xad23('0x2c')],qs['fields'](_0x342ad6['query']['fields']));_0xbab8d2['attributes']=_0xbab8d2['attributes'][_0xad23('0x2f')]?_0xbab8d2['attributes']:_0x5f1306[_0xad23('0x2c')];_0xbab8d2['order']=qs[_0xad23('0x44')](_0x342ad6[_0xad23('0x27')][_0xad23('0x44')]);_0xbab8d2[_0xad23('0x32')]=qs[_0xad23('0x2a')](_[_0xad23('0x45')](_0x342ad6['query'],_0x5f1306['filters']));if(_0x342ad6[_0xad23('0x27')][_0xad23('0x36')]){_0xbab8d2[_0xad23('0x32')]=_[_0xad23('0x35')](_0xbab8d2[_0xad23('0x32')],{'$or':_['map'](_0xbab8d2[_0xad23('0x2d')],function(_0x2d6af6){var _0x3bc5e8={};_0x3bc5e8[_0x2d6af6]={'$like':'%'+_0x342ad6[_0xad23('0x27')][_0xad23('0x36')]+'%'};return _0x3bc5e8;})});}_0xbab8d2=_[_0xad23('0x35')]({},_0xbab8d2,_0x342ad6[_0xad23('0x3b')]);return _0x8fca67[_0xad23('0x42')](_0xbab8d2);}})['then'](function(_0x57f27d){if(_0x57f27d){_0x46c57f=_0x57f27d[_0xad23('0x2f')];if(!_0x342ad6[_0xad23('0x27')][_0xad23('0x30')](_0xad23('0x31'))){_0xbab8d2['limit']=qs[_0xad23('0x18')](_0x342ad6[_0xad23('0x27')][_0xad23('0x18')]);_0xbab8d2[_0xad23('0x17')]=qs[_0xad23('0x17')](_0x342ad6[_0xad23('0x27')]['offset']);}return _0x8fca67[_0xad23('0x42')](_0xbab8d2);}})[_0xad23('0x1f')](function(_0x47fd50){if(_0x47fd50){return _0x47fd50?{'count':_0x46c57f,'rows':_0x47fd50}:null;}})[_0xad23('0x1f')](respondWithResult(_0x1aa3eb,null))['catch'](handleError(_0x1aa3eb,null));};exports['addIntervals']=function(_0x350c81,_0xb783fd,_0x4c52e3){return db[_0xad23('0x24')]['findOne']({'where':{'id':_0x350c81['params']['id']}})[_0xad23('0x1f')](handleEntityNotFound(_0xb783fd,null))['then'](function(_0x70d896){if(_0x70d896){return db[_0xad23('0x46')][_0xad23('0x47')](function(_0x81d57d){return db['Interval'][_0xad23('0x1e')]({'where':{'IntervalId':_0x350c81[_0xad23('0x40')]['id']},'transaction':_0x81d57d})['then'](function(_0xd3e036){var _0x4028df=_['map'](_0x350c81[_0xad23('0x3e')],function(_0x56fa6f){delete _0x56fa6f['id'];_0x56fa6f[_0xad23('0x41')]=_0x350c81[_0xad23('0x40')]['id'];return _0x56fa6f;});return db['Interval'][_0xad23('0x48')](_0x4028df,{'transaction':_0x81d57d});});})[_0xad23('0x1f')](function(){return db[_0xad23('0x24')][_0xad23('0x49')]({'where':{'IntervalId':_0x350c81[_0xad23('0x40')]['id']}});});}})[_0xad23('0x1f')](respondWithResult(_0xb783fd,null))[_0xad23('0x38')](handleError(_0xb783fd,null));}; \ No newline at end of file +var _0x6cf9=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','filter','merge','map','options','includeAll','include','findAll','catch','show','params','find','create','body','addInterval','getIntervals','findOne','nolimit','addIntervals','transaction','IntervalId','bulkCreate','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','error','name','send','index','Interval','rawAttributes','model','keys','query','dateEnd','dateStart','filters'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x6cf9,0xb2));var _0x96cf=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x6cf9[_0x2932cf];return _0x1711dd;};'use strict';var jsonpatch=require(_0x96cf('0x0'));var rp=require(_0x96cf('0x1'));var moment=require(_0x96cf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x96cf('0x3'));var util=require(_0x96cf('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x96cf('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x96cf('0x6'));var squel=require(_0x96cf('0x7'));var crypto=require(_0x96cf('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x96cf('0x9'));var toCsv=require(_0x96cf('0x5'));var querystring=require(_0x96cf('0xa'));var Papa=require(_0x96cf('0xb'));var qs=require(_0x96cf('0xc'));var logger=require(_0x96cf('0xd'))('api');var utils=require('../../config/utils');var config=require(_0x96cf('0xe'));var db=require(_0x96cf('0xf'))['db'];var extensions=require(_0x96cf('0x10'));function respondWithStatusCode(_0x331c14,_0x18b53e){_0x18b53e=_0x18b53e||0xcc;return function(_0x57b865){if(_0x57b865){return _0x331c14[_0x96cf('0x11')](_0x18b53e);}return _0x331c14[_0x96cf('0x12')](_0x18b53e)[_0x96cf('0x13')]();};}function respondWithResult(_0x3c1cca,_0x5be54b){_0x5be54b=_0x5be54b||0xc8;return function(_0xbf8728){if(_0xbf8728){return _0x3c1cca[_0x96cf('0x12')](_0x5be54b)[_0x96cf('0x14')](_0xbf8728);}};}function respondWithFilteredResult(_0x380b89,_0x38f373){return function(_0x5d8aa6){if(_0x5d8aa6){var _0x3bedb6=_0x5d8aa6[_0x96cf('0x15')],_0x2a755f=_0x38f373[_0x96cf('0x16')],_0x394a02=_0x38f373[_0x96cf('0x16')]+_0x38f373[_0x96cf('0x17')],_0x4a4825;if(_0x394a02>=_0x3bedb6){_0x394a02=_0x3bedb6;_0x4a4825=0xc8;}else{_0x4a4825=0xce;}_0x380b89[_0x96cf('0x12')](_0x4a4825);return _0x380b89['set'](_0x96cf('0x18'),_0x2a755f+'-'+_0x394a02+'/'+_0x3bedb6)['json'](_0x5d8aa6);}return null;};}function patchUpdates(_0x532728){return function(_0x556c4c){try{jsonpatch['apply'](_0x556c4c,_0x532728,!![]);}catch(_0x178739){return BPromise['reject'](_0x178739);}return _0x556c4c[_0x96cf('0x19')]();};}function saveUpdates(_0x2f78fc,_0x4582fa){return function(_0x20e1e7){if(_0x20e1e7){return _0x20e1e7[_0x96cf('0x1a')](_0x2f78fc)[_0x96cf('0x1b')](function(_0x130dfa){return _0x130dfa;});}return null;};}function removeEntity(_0x9a8e5f,_0x58f280){return function(_0x5a587b){if(_0x5a587b){return _0x5a587b[_0x96cf('0x1c')]()[_0x96cf('0x1b')](function(){_0x9a8e5f[_0x96cf('0x12')](0xcc)[_0x96cf('0x13')]();});}};}function handleEntityNotFound(_0x24118b,_0x231482){return function(_0x532cc5){if(!_0x532cc5){_0x24118b[_0x96cf('0x11')](0x194);}return _0x532cc5;};}function handleError(_0x52da5a,_0x390cfd){_0x390cfd=_0x390cfd||0x1f4;return function(_0x40f5df){logger[_0x96cf('0x1d')](_0x40f5df['stack']);if(_0x40f5df[_0x96cf('0x1e')]){delete _0x40f5df[_0x96cf('0x1e')];}_0x52da5a[_0x96cf('0x12')](_0x390cfd)[_0x96cf('0x1f')](_0x40f5df);};}exports[_0x96cf('0x20')]=function(_0x24a2f5,_0x4680f1){var _0x314ef2={},_0x5dacc8={},_0xec8ffa={'count':0x0,'rows':[]};var _0x2d28f8=db[_0x96cf('0x21')][_0x96cf('0x22')];_0x5dacc8[_0x96cf('0x23')]=_[_0x96cf('0x24')](_0x2d28f8);var _0x2b81d0={'dateStart':_0x24a2f5['query']['dateStart'],'dateEnd':_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x26')]};delete _0x24a2f5[_0x96cf('0x25')][_0x96cf('0x27')];delete _0x24a2f5[_0x96cf('0x25')][_0x96cf('0x26')];_0x5dacc8['query']=_[_0x96cf('0x24')](_0x24a2f5[_0x96cf('0x25')]);_0x5dacc8[_0x96cf('0x28')]=_[_0x96cf('0x29')](_0x5dacc8[_0x96cf('0x23')],_0x5dacc8[_0x96cf('0x25')]);_0x314ef2[_0x96cf('0x2a')]=_[_0x96cf('0x29')](_0x5dacc8['model'],qs[_0x96cf('0x2b')](_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x2b')]));_0x314ef2[_0x96cf('0x2a')]=_0x314ef2['attributes'][_0x96cf('0x2c')]?_0x314ef2[_0x96cf('0x2a')]:_0x5dacc8[_0x96cf('0x23')];if(!_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x2d')]('nolimit')){_0x314ef2[_0x96cf('0x17')]=qs['limit'](_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x17')]);_0x314ef2[_0x96cf('0x16')]=qs[_0x96cf('0x16')](_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x16')]);}_0x314ef2[_0x96cf('0x2e')]=qs[_0x96cf('0x2f')](_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x2f')]);_0x314ef2[_0x96cf('0x30')]=qs[_0x96cf('0x28')](_[_0x96cf('0x31')](_0x24a2f5[_0x96cf('0x25')],_0x5dacc8[_0x96cf('0x28')]));if(_0x2b81d0['dateStart']){if(_0x2b81d0[_0x96cf('0x26')]){_0x2b81d0[_0x96cf('0x26')]=moment(_0x2b81d0[_0x96cf('0x26')])[_0x96cf('0x32')](0x1,_0x96cf('0x33'));}else{_0x2b81d0['dateEnd']=moment(_0x2b81d0[_0x96cf('0x27')])['add'](0x1,_0x96cf('0x33'));}_['merge'](_0x314ef2[_0x96cf('0x30')],{'createdAt':{'$gte':_0x2b81d0[_0x96cf('0x27')],'$lte':_0x2b81d0[_0x96cf('0x26')]}});}if(_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x34')]){_0x314ef2[_0x96cf('0x30')]=_[_0x96cf('0x35')](_0x314ef2[_0x96cf('0x30')],{'$or':_[_0x96cf('0x36')](_0x314ef2['attributes'],function(_0xc71be){var _0x459325={};_0x459325[_0xc71be]={'$like':'%'+_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x34')]+'%'};return _0x459325;})});}_0x314ef2=_[_0x96cf('0x35')]({},_0x314ef2,_0x24a2f5[_0x96cf('0x37')]);var _0x5bba9a={'where':_0x314ef2[_0x96cf('0x30')]};return db[_0x96cf('0x21')][_0x96cf('0x15')](_0x5bba9a)[_0x96cf('0x1b')](function(_0xfd9461){_0xec8ffa[_0x96cf('0x15')]=_0xfd9461;if(_0x24a2f5[_0x96cf('0x25')][_0x96cf('0x38')]){_0x314ef2[_0x96cf('0x39')]=[{'all':!![]}];}return db[_0x96cf('0x21')][_0x96cf('0x3a')](_0x314ef2);})[_0x96cf('0x1b')](function(_0x26892f){_0xec8ffa['rows']=_0x26892f;return _0xec8ffa;})[_0x96cf('0x1b')](respondWithFilteredResult(_0x4680f1,_0x314ef2))[_0x96cf('0x3b')](handleError(_0x4680f1,null));};exports[_0x96cf('0x3c')]=function(_0xe04a8d,_0x3d3ac3){var _0x325fb3={'raw':!![],'where':{'id':_0xe04a8d[_0x96cf('0x3d')]['id']}},_0x5cefaf={};_0x5cefaf[_0x96cf('0x23')]=_[_0x96cf('0x24')](db[_0x96cf('0x21')]['rawAttributes']);_0x5cefaf[_0x96cf('0x25')]=_[_0x96cf('0x24')](_0xe04a8d['query']);_0x5cefaf[_0x96cf('0x28')]=_['intersection'](_0x5cefaf[_0x96cf('0x23')],_0x5cefaf['query']);_0x325fb3[_0x96cf('0x2a')]=_[_0x96cf('0x29')](_0x5cefaf[_0x96cf('0x23')],qs[_0x96cf('0x2b')](_0xe04a8d[_0x96cf('0x25')]['fields']));_0x325fb3[_0x96cf('0x2a')]=_0x325fb3['attributes']['length']?_0x325fb3[_0x96cf('0x2a')]:_0x5cefaf[_0x96cf('0x23')];if(_0xe04a8d[_0x96cf('0x25')][_0x96cf('0x38')]){_0x325fb3[_0x96cf('0x39')]=[{'all':!![]}];}_0x325fb3=_['merge']({},_0x325fb3,_0xe04a8d['options']);return db[_0x96cf('0x21')][_0x96cf('0x3e')](_0x325fb3)['then'](handleEntityNotFound(_0x3d3ac3,null))[_0x96cf('0x1b')](respondWithResult(_0x3d3ac3,null))['catch'](handleError(_0x3d3ac3,null));};exports[_0x96cf('0x3f')]=function(_0x4a5587,_0x10700f){return db[_0x96cf('0x21')][_0x96cf('0x3f')](_0x4a5587[_0x96cf('0x40')],{})['then'](respondWithResult(_0x10700f,0xc9))[_0x96cf('0x3b')](handleError(_0x10700f,null));};exports[_0x96cf('0x1a')]=function(_0x50463f,_0x57f6a1){if(_0x50463f[_0x96cf('0x40')]['id']){delete _0x50463f[_0x96cf('0x40')]['id'];}return db[_0x96cf('0x21')]['find']({'where':{'id':_0x50463f[_0x96cf('0x3d')]['id']}})[_0x96cf('0x1b')](handleEntityNotFound(_0x57f6a1,null))[_0x96cf('0x1b')](saveUpdates(_0x50463f['body'],null))[_0x96cf('0x1b')](respondWithResult(_0x57f6a1,null))[_0x96cf('0x3b')](handleError(_0x57f6a1,null));};exports['destroy']=function(_0x17676a,_0x39d04e){return db[_0x96cf('0x21')][_0x96cf('0x3e')]({'where':{'id':_0x17676a[_0x96cf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x39d04e,null))[_0x96cf('0x1b')](removeEntity(_0x39d04e,null))[_0x96cf('0x3b')](handleError(_0x39d04e,null));};exports[_0x96cf('0x41')]=function(_0x25ab29,_0x55cb87,_0x5a3c5f){if(_0x25ab29[_0x96cf('0x40')]['id']){delete _0x25ab29[_0x96cf('0x40')]['id'];}return db[_0x96cf('0x21')]['find']({'where':{'id':_0x25ab29[_0x96cf('0x3d')]['id']}})[_0x96cf('0x1b')](handleEntityNotFound(_0x55cb87,null))[_0x96cf('0x1b')](function(_0x3fd495){if(_0x3fd495){_0x25ab29[_0x96cf('0x40')]['IntervalId']=_0x3fd495['id'];return db[_0x96cf('0x21')]['create'](_0x25ab29['body']);}})[_0x96cf('0x1b')](respondWithResult(_0x55cb87,null))[_0x96cf('0x3b')](handleError(_0x55cb87,null));};exports[_0x96cf('0x42')]=function(_0x1fd4b5,_0x15f198,_0x2dbebf){var _0x519067={};var _0x5d36fd={};var _0xfe1941;var _0x16314b;return db['Interval'][_0x96cf('0x43')]({'where':{'id':_0x1fd4b5[_0x96cf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x15f198,null))[_0x96cf('0x1b')](function(_0x3c731f){if(_0x3c731f){_0xfe1941=_0x3c731f;_0x5d36fd['model']=_[_0x96cf('0x24')](db['Interval']['rawAttributes']);_0x5d36fd[_0x96cf('0x25')]=_[_0x96cf('0x24')](_0x1fd4b5[_0x96cf('0x25')]);_0x5d36fd[_0x96cf('0x28')]=_['intersection'](_0x5d36fd['model'],_0x5d36fd[_0x96cf('0x25')]);_0x519067['attributes']=_[_0x96cf('0x29')](_0x5d36fd[_0x96cf('0x23')],qs[_0x96cf('0x2b')](_0x1fd4b5['query'][_0x96cf('0x2b')]));_0x519067['attributes']=_0x519067[_0x96cf('0x2a')]['length']?_0x519067[_0x96cf('0x2a')]:_0x5d36fd['model'];_0x519067[_0x96cf('0x2e')]=qs[_0x96cf('0x2f')](_0x1fd4b5['query'][_0x96cf('0x2f')]);_0x519067['where']=qs[_0x96cf('0x28')](_[_0x96cf('0x31')](_0x1fd4b5[_0x96cf('0x25')],_0x5d36fd['filters']));if(_0x1fd4b5[_0x96cf('0x25')]['filter']){_0x519067[_0x96cf('0x30')]=_[_0x96cf('0x35')](_0x519067[_0x96cf('0x30')],{'$or':_['map'](_0x519067[_0x96cf('0x2a')],function(_0x30bf33){var _0x4e2475={};_0x4e2475[_0x30bf33]={'$like':'%'+_0x1fd4b5[_0x96cf('0x25')][_0x96cf('0x34')]+'%'};return _0x4e2475;})});}_0x519067=_['merge']({},_0x519067,_0x1fd4b5[_0x96cf('0x37')]);return _0xfe1941[_0x96cf('0x42')](_0x519067);}})[_0x96cf('0x1b')](function(_0x20e7d1){if(_0x20e7d1){_0x16314b=_0x20e7d1[_0x96cf('0x2c')];if(!_0x1fd4b5[_0x96cf('0x25')]['hasOwnProperty'](_0x96cf('0x44'))){_0x519067[_0x96cf('0x17')]=qs[_0x96cf('0x17')](_0x1fd4b5['query'][_0x96cf('0x17')]);_0x519067[_0x96cf('0x16')]=qs[_0x96cf('0x16')](_0x1fd4b5['query'][_0x96cf('0x16')]);}return _0xfe1941[_0x96cf('0x42')](_0x519067);}})['then'](function(_0x5ae572){if(_0x5ae572){return _0x5ae572?{'count':_0x16314b,'rows':_0x5ae572}:null;}})['then'](respondWithResult(_0x15f198,null))[_0x96cf('0x3b')](handleError(_0x15f198,null));};exports[_0x96cf('0x45')]=function(_0x43aa06,_0x4f702a,_0x47a8c4){return db[_0x96cf('0x21')][_0x96cf('0x43')]({'where':{'id':_0x43aa06[_0x96cf('0x3d')]['id']}})[_0x96cf('0x1b')](handleEntityNotFound(_0x4f702a,null))['then'](function(_0x26a92d){if(_0x26a92d){return db['sequelize'][_0x96cf('0x46')](function(_0x46144e){return db[_0x96cf('0x21')][_0x96cf('0x1c')]({'where':{'IntervalId':_0x43aa06[_0x96cf('0x3d')]['id']},'transaction':_0x46144e})[_0x96cf('0x1b')](function(_0x416534){var _0x322c2d=_[_0x96cf('0x36')](_0x43aa06['body'],function(_0x220a97){delete _0x220a97['id'];_0x220a97[_0x96cf('0x47')]=_0x43aa06[_0x96cf('0x3d')]['id'];return _0x220a97;});return db[_0x96cf('0x21')][_0x96cf('0x48')](_0x322c2d,{'transaction':_0x46144e});});})[_0x96cf('0x1b')](function(){return db[_0x96cf('0x21')][_0x96cf('0x3a')]({'where':{'IntervalId':_0x43aa06[_0x96cf('0x3d')]['id']}});});}})[_0x96cf('0x1b')](respondWithResult(_0x4f702a,null))[_0x96cf('0x3b')](handleError(_0x4f702a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2bfc0cc..1cd9ed7 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 _0x9051=['Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../components/extensions/rewrite'];(function(_0x24356e,_0x569e7a){var _0x1820a6=function(_0x2c561d){while(--_0x2c561d){_0x24356e['push'](_0x24356e['shift']());}};_0x1820a6(++_0x569e7a);}(_0x9051,0xdf));var _0x1905=function(_0xdf35c2,_0x50452c){_0xdf35c2=_0xdf35c2-0x0;var _0x8817f2=_0x9051[_0xdf35c2];return _0x8817f2;};'use strict';var _=require(_0x1905('0x0'));var util=require(_0x1905('0x1'));var logger=require(_0x1905('0x2'))(_0x1905('0x3'));var moment=require(_0x1905('0x4'));var BPromise=require(_0x1905('0x5'));var rp=require(_0x1905('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0x1905('0x7'));module['exports']=function(_0x4b3107,_0x472c17){return _0x4b3107['define'](_0x1905('0x8'),attributes,{'tableName':_0x1905('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x36f534,_0x7546ac){extensions[_0x1905('0xa')](_0x4b3107,_0x36f534);},'afterBulkCreate':function(_0x1b7f45,_0x2e4323,_0x2e9cf7){_0x2e9cf7();extensions[_0x1905('0xa')](_0x4b3107,_0x1b7f45[0x0]);},'afterUpdate':function(_0x48fa26,_0x2bfef2){extensions[_0x1905('0xa')](_0x4b3107,_0x48fa26);},'afterDestroy':function(_0x53697e,_0x48e3f4){extensions[_0x1905('0xa')](_0x4b3107,_0x53697e);}}});}; \ No newline at end of file +var _0xc7fd=['../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','api','bluebird','request-promise','./interval.attributes'];(function(_0x12adfa,_0x3d9ff6){var _0x1285ad=function(_0x5477b5){while(--_0x5477b5){_0x12adfa['push'](_0x12adfa['shift']());}};_0x1285ad(++_0x3d9ff6);}(_0xc7fd,0x1c8));var _0xdc7f=function(_0x4ba90e,_0xa9542c){_0x4ba90e=_0x4ba90e-0x0;var _0x47a86d=_0xc7fd[_0x4ba90e];return _0x47a86d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdc7f('0x0'));var moment=require('moment');var BPromise=require(_0xdc7f('0x1'));var rp=require(_0xdc7f('0x2'));var attributes=require(_0xdc7f('0x3'));var extensions=require(_0xdc7f('0x4'));module[_0xdc7f('0x5')]=function(_0x55dbf8,_0x19684e){return _0x55dbf8[_0xdc7f('0x6')](_0xdc7f('0x7'),attributes,{'tableName':_0xdc7f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x19fcda,_0x1049b7){extensions[_0xdc7f('0x9')](_0x55dbf8,_0x19fcda);},'afterBulkCreate':function(_0x21f6cb,_0x52e0cd,_0x2518ed){_0x2518ed();extensions['rewrite'](_0x55dbf8,_0x21f6cb[0x0]);},'afterUpdate':function(_0x324343,_0x351867){extensions[_0xdc7f('0x9')](_0x55dbf8,_0x324343);},'afterDestroy':function(_0x483172,_0x22840e){extensions[_0xdc7f('0x9')](_0x55dbf8,_0x483172);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index de50123..7a1ac9d 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 _0x5695=['info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','Interval','findAll','options','raw','attributes','limit','include','map','model','GetInterval','catch','find','ShowInterval','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x5e7b41,_0x16156b){var _0x444981=function(_0x1e9076){while(--_0x1e9076){_0x5e7b41['push'](_0x5e7b41['shift']());}};_0x444981(++_0x16156b);}(_0x5695,0xbc));var _0x5569=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0x5695[_0x26393b];return _0x57230a;};'use strict';var _=require(_0x5569('0x0'));var util=require(_0x5569('0x1'));var moment=require(_0x5569('0x2'));var BPromise=require(_0x5569('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5569('0x4'));var logger=require(_0x5569('0x5'))('rpc');var config=require(_0x5569('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5569('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dacc,_0x26ee7b,_0x3572be){return new BPromise(function(_0x8afe66,_0x23b422){return client[_0x5569('0x8')](_0x32dacc,_0x3572be)[_0x5569('0x9')](function(_0x57e42b){logger[_0x5569('0xa')](_0x5569('0xb'),_0x26ee7b,_0x5569('0xc'));logger[_0x5569('0xd')](_0x5569('0xe'),_0x26ee7b,_0x5569('0xc'),JSON[_0x5569('0xf')](_0x57e42b));if(_0x57e42b['error']){if(_0x57e42b['error'][_0x5569('0x10')]===0x1f4){logger[_0x5569('0x11')](_0x5569('0xb'),_0x26ee7b,_0x57e42b['error'][_0x5569('0x12')]);return _0x23b422(_0x57e42b['error'][_0x5569('0x12')]);}logger[_0x5569('0x11')](_0x5569('0xb'),_0x26ee7b,_0x57e42b[_0x5569('0x11')]['message']);return _0x8afe66(_0x57e42b['error']['message']);}else{logger[_0x5569('0xa')](_0x5569('0xb'),_0x26ee7b,_0x5569('0xc'));_0x8afe66(_0x57e42b[_0x5569('0x13')][_0x5569('0x12')]);}})['catch'](function(_0x5b3b03){logger[_0x5569('0x11')]('Interval,\x20%s,\x20%s',_0x26ee7b,_0x5b3b03);_0x23b422(_0x5b3b03);});});}exports['GetInterval']=function(_0x41bbf3){var _0x2f04d3=this;return new Promise(function(_0x23e8f4,_0x2081c5){return db[_0x5569('0x14')][_0x5569('0x15')]({'raw':_0x41bbf3['options']?_0x41bbf3[_0x5569('0x16')][_0x5569('0x17')]===undefined?!![]:![]:!![],'where':_0x41bbf3[_0x5569('0x16')]?_0x41bbf3[_0x5569('0x16')]['where']||null:null,'attributes':_0x41bbf3[_0x5569('0x16')]?_0x41bbf3['options'][_0x5569('0x18')]||null:null,'limit':_0x41bbf3[_0x5569('0x16')]?_0x41bbf3[_0x5569('0x16')][_0x5569('0x19')]||null:null,'include':_0x41bbf3[_0x5569('0x16')]?_0x41bbf3[_0x5569('0x16')][_0x5569('0x1a')]?_[_0x5569('0x1b')](_0x41bbf3[_0x5569('0x16')][_0x5569('0x1a')],function(_0x1ae742){return{'model':db[_0x1ae742[_0x5569('0x1c')]],'as':_0x1ae742['as'],'attributes':_0x1ae742[_0x5569('0x18')],'include':_0x1ae742[_0x5569('0x1a')]?_[_0x5569('0x1b')](_0x1ae742['include'],function(_0x5246b5){return{'model':db[_0x5246b5[_0x5569('0x1c')]],'as':_0x5246b5['as'],'attributes':_0x5246b5[_0x5569('0x18')],'include':_0x5246b5[_0x5569('0x1a')]?_[_0x5569('0x1b')](_0x5246b5[_0x5569('0x1a')],function(_0x166d08){return{'model':db[_0x166d08[_0x5569('0x1c')]],'as':_0x166d08['as'],'attributes':_0x166d08[_0x5569('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5569('0x9')](function(_0x4e98c3){logger['info'](_0x5569('0x1d'),_0x41bbf3);logger[_0x5569('0xd')](_0x5569('0x1d'),_0x41bbf3,JSON[_0x5569('0xf')](_0x4e98c3));_0x23e8f4(_0x4e98c3);})[_0x5569('0x1e')](function(_0x474c1a){logger[_0x5569('0x11')](_0x5569('0x1d'),_0x474c1a[_0x5569('0x12')],_0x41bbf3);_0x2081c5(_0x2f04d3[_0x5569('0x11')](0x1f4,_0x474c1a[_0x5569('0x12')]));});});};exports['ShowInterval']=function(_0x17c1f4){var _0x1f6f43=this;return new Promise(function(_0x267c98,_0x5a821a){return db[_0x5569('0x14')][_0x5569('0x1f')]({'raw':_0x17c1f4['options']?_0x17c1f4[_0x5569('0x16')][_0x5569('0x17')]===undefined?!![]:![]:!![],'where':_0x17c1f4['options']?_0x17c1f4['options']['where']||null:null,'attributes':_0x17c1f4[_0x5569('0x16')]?_0x17c1f4[_0x5569('0x16')][_0x5569('0x18')]||null:null,'include':_0x17c1f4[_0x5569('0x16')]?_0x17c1f4['options'][_0x5569('0x1a')]?_[_0x5569('0x1b')](_0x17c1f4[_0x5569('0x16')]['include'],function(_0x5815f4){return{'model':db[_0x5815f4[_0x5569('0x1c')]],'as':_0x5815f4['as'],'attributes':_0x5815f4['attributes'],'include':_0x5815f4[_0x5569('0x1a')]?_[_0x5569('0x1b')](_0x5815f4[_0x5569('0x1a')],function(_0x4ca1b7){return{'model':db[_0x4ca1b7[_0x5569('0x1c')]],'as':_0x4ca1b7['as'],'attributes':_0x4ca1b7['attributes'],'include':_0x4ca1b7['include']?_[_0x5569('0x1b')](_0x4ca1b7[_0x5569('0x1a')],function(_0x25fb69){return{'model':db[_0x25fb69[_0x5569('0x1c')]],'as':_0x25fb69['as'],'attributes':_0x25fb69[_0x5569('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5569('0x9')](function(_0x22e19b){logger[_0x5569('0xa')](_0x5569('0x20'),_0x17c1f4);logger[_0x5569('0xd')](_0x5569('0x20'),_0x17c1f4,JSON[_0x5569('0xf')](_0x22e19b));_0x267c98(_0x22e19b);})[_0x5569('0x1e')](function(_0x17aed2){logger[_0x5569('0x11')](_0x5569('0x20'),_0x17aed2[_0x5569('0x12')],_0x17c1f4);_0x5a821a(_0x1f6f43[_0x5569('0x11')](0x1f4,_0x17aed2[_0x5569('0x12')]));});});}; \ No newline at end of file +var _0x6184=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','raw','where','map','include','model','attributes','ShowInterval'];(function(_0x24f01e,_0xed9104){var _0x21a7c0=function(_0x9a693c){while(--_0x9a693c){_0x24f01e['push'](_0x24f01e['shift']());}};_0x21a7c0(++_0xed9104);}(_0x6184,0x15e));var _0x4618=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0x6184[_0x4a8418];return _0x390174;};'use strict';var _=require(_0x4618('0x0'));var util=require(_0x4618('0x1'));var moment=require(_0x4618('0x2'));var BPromise=require(_0x4618('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x4618('0x4'))['db'];var utils=require(_0x4618('0x5'));var logger=require(_0x4618('0x6'))(_0x4618('0x7'));var config=require(_0x4618('0x8'));var jayson=require(_0x4618('0x9'));var client=jayson[_0x4618('0xa')][_0x4618('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1af9b9,_0x289474,_0x853ed0){return new BPromise(function(_0x3ee284,_0x4f0a6c){return client[_0x4618('0xc')](_0x1af9b9,_0x853ed0)[_0x4618('0xd')](function(_0x3a8fba){logger[_0x4618('0xe')](_0x4618('0xf'),_0x289474,_0x4618('0x10'));logger[_0x4618('0x11')]('Interval,\x20%s,\x20%s,\x20%s',_0x289474,'request\x20sent',JSON[_0x4618('0x12')](_0x3a8fba));if(_0x3a8fba['error']){if(_0x3a8fba[_0x4618('0x13')][_0x4618('0x14')]===0x1f4){logger['error'](_0x4618('0xf'),_0x289474,_0x3a8fba[_0x4618('0x13')][_0x4618('0x15')]);return _0x4f0a6c(_0x3a8fba['error']['message']);}logger[_0x4618('0x13')](_0x4618('0xf'),_0x289474,_0x3a8fba[_0x4618('0x13')][_0x4618('0x15')]);return _0x3ee284(_0x3a8fba[_0x4618('0x13')][_0x4618('0x15')]);}else{logger[_0x4618('0xe')]('Interval,\x20%s,\x20%s',_0x289474,_0x4618('0x10'));_0x3ee284(_0x3a8fba[_0x4618('0x16')][_0x4618('0x15')]);}})[_0x4618('0x17')](function(_0x4ea567){logger[_0x4618('0x13')](_0x4618('0xf'),_0x289474,_0x4ea567);_0x4f0a6c(_0x4ea567);});});}exports[_0x4618('0x18')]=function(_0x592e79){var _0x509231=this;return new Promise(function(_0x5cf200,_0x37355c){return db[_0x4618('0x19')][_0x4618('0x1a')]({'raw':_0x592e79[_0x4618('0x1b')]?_0x592e79[_0x4618('0x1b')][_0x4618('0x1c')]===undefined?!![]:![]:!![],'where':_0x592e79[_0x4618('0x1b')]?_0x592e79['options'][_0x4618('0x1d')]||null:null,'attributes':_0x592e79[_0x4618('0x1b')]?_0x592e79[_0x4618('0x1b')]['attributes']||null:null,'limit':_0x592e79[_0x4618('0x1b')]?_0x592e79[_0x4618('0x1b')]['limit']||null:null,'include':_0x592e79[_0x4618('0x1b')]?_0x592e79[_0x4618('0x1b')]['include']?_[_0x4618('0x1e')](_0x592e79['options'][_0x4618('0x1f')],function(_0x240f78){return{'model':db[_0x240f78[_0x4618('0x20')]],'as':_0x240f78['as'],'attributes':_0x240f78[_0x4618('0x21')],'include':_0x240f78[_0x4618('0x1f')]?_[_0x4618('0x1e')](_0x240f78[_0x4618('0x1f')],function(_0x3b847e){return{'model':db[_0x3b847e[_0x4618('0x20')]],'as':_0x3b847e['as'],'attributes':_0x3b847e[_0x4618('0x21')],'include':_0x3b847e[_0x4618('0x1f')]?_['map'](_0x3b847e[_0x4618('0x1f')],function(_0x2df1f4){return{'model':db[_0x2df1f4[_0x4618('0x20')]],'as':_0x2df1f4['as'],'attributes':_0x2df1f4[_0x4618('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b2c66){logger['info'](_0x4618('0x18'),_0x592e79);logger['debug']('GetInterval',_0x592e79,JSON[_0x4618('0x12')](_0x1b2c66));_0x5cf200(_0x1b2c66);})[_0x4618('0x17')](function(_0x877c0e){logger['error'](_0x4618('0x18'),_0x877c0e[_0x4618('0x15')],_0x592e79);_0x37355c(_0x509231[_0x4618('0x13')](0x1f4,_0x877c0e['message']));});});};exports[_0x4618('0x22')]=function(_0x28eb55){var _0x5bb101=this;return new Promise(function(_0x2ce4cc,_0x325550){return db[_0x4618('0x19')]['find']({'raw':_0x28eb55[_0x4618('0x1b')]?_0x28eb55[_0x4618('0x1b')][_0x4618('0x1c')]===undefined?!![]:![]:!![],'where':_0x28eb55['options']?_0x28eb55[_0x4618('0x1b')][_0x4618('0x1d')]||null:null,'attributes':_0x28eb55[_0x4618('0x1b')]?_0x28eb55[_0x4618('0x1b')]['attributes']||null:null,'include':_0x28eb55['options']?_0x28eb55[_0x4618('0x1b')][_0x4618('0x1f')]?_[_0x4618('0x1e')](_0x28eb55[_0x4618('0x1b')]['include'],function(_0x20bfea){return{'model':db[_0x20bfea[_0x4618('0x20')]],'as':_0x20bfea['as'],'attributes':_0x20bfea[_0x4618('0x21')],'include':_0x20bfea[_0x4618('0x1f')]?_[_0x4618('0x1e')](_0x20bfea[_0x4618('0x1f')],function(_0x5f2f09){return{'model':db[_0x5f2f09[_0x4618('0x20')]],'as':_0x5f2f09['as'],'attributes':_0x5f2f09[_0x4618('0x21')],'include':_0x5f2f09['include']?_[_0x4618('0x1e')](_0x5f2f09[_0x4618('0x1f')],function(_0x9666fa){return{'model':db[_0x9666fa['model']],'as':_0x9666fa['as'],'attributes':_0x9666fa[_0x4618('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24e0ee){logger[_0x4618('0xe')](_0x4618('0x22'),_0x28eb55);logger[_0x4618('0x11')](_0x4618('0x22'),_0x28eb55,JSON[_0x4618('0x12')](_0x24e0ee));_0x2ce4cc(_0x24e0ee);})[_0x4618('0x17')](function(_0x31bbb4){logger[_0x4618('0x13')](_0x4618('0x22'),_0x31bbb4[_0x4618('0x15')],_0x28eb55);_0x325550(_0x5bb101[_0x4618('0x13')](0x1f4,_0x31bbb4[_0x4618('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d36bece..cc849fa 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x58ba53,_0x57dba6){var _0x4f0785=function(_0x5c363f){while(--_0x5c363f){_0x58ba53['push'](_0x58ba53['shift']());}};_0x4f0785(++_0x57dba6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a40df,_0x5a9916){_0x5a40df=_0x5a40df-0x0;var _0x364cb9=_0x5f2f[_0x5a40df];return _0x364cb9;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x37703d,_0x54a611){var _0x2a12d9=function(_0x317c2e){while(--_0x317c2e){_0x37703d['push'](_0x37703d['shift']());}};_0x2a12d9(++_0x54a611);}(_0x2ef3,0xba));var _0x32ef=function(_0x1e30e9,_0x443f3c){_0x1e30e9=_0x1e30e9-0x0;var _0x3d887b=_0x2ef3[_0x1e30e9];return _0x3d887b;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 79f3503..a7c1013 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 _0xd8b0=['fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','remoteAddress','socket','connection','bluebird','https','3eAmWpBVP0','key','Report','\x20from\x20','description','issuetype','Bug','customfield_11500','email'];(function(_0x532807,_0x92d7fd){var _0x40b83f=function(_0x1c312c){while(--_0x1c312c){_0x532807['push'](_0x532807['shift']());}};_0x40b83f(++_0x92d7fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var https=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x0d8b('0x2');function openIssue(_0x5b9b89,_0x43bca1){var _0x364286={'fields':{'project':{'key':_0x5b9b89[_0x0d8b('0x3')]||'MOTGUI'},'summary':(_0x5b9b89['summary']||_0x0d8b('0x4'))+_0x0d8b('0x5')+_0x5b9b89['ip'],'description':_0x5b9b89[_0x0d8b('0x6')]||JSON['stringify'](_0x5b9b89),'issuetype':{'name':_0x5b9b89[_0x0d8b('0x7')]||_0x0d8b('0x8')}}};_0x364286['fields'][_0x0d8b('0x9')]=_0x5b9b89[_0x0d8b('0xa')];_0x364286[_0x0d8b('0xb')][_0x0d8b('0xc')]=_0x5b9b89[_0x0d8b('0xd')];_0x364286[_0x0d8b('0xb')][_0x0d8b('0xe')]=_0x5b9b89[_0x0d8b('0xf')];_0x364286['fields'][_0x0d8b('0x10')]=_0x5b9b89['name'];_0x364286[_0x0d8b('0xb')][_0x0d8b('0x11')]=_0x5b9b89[_0x0d8b('0x12')];_0x364286[_0x0d8b('0xb')][_0x0d8b('0x13')]=_0x5b9b89['ip'];var _0x32bb1a={'host':_0x0d8b('0x14'),'port':0x1bb,'path':_0x0d8b('0x15'),'method':_0x0d8b('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x0d8b('0x17'),'Authorization':_0x0d8b('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x0d8b('0x19')](_0x0d8b('0x1a'))}};var _0x2d4e1c=JSON['stringify'](_0x364286);var _0x23eb7b=https[_0x0d8b('0x1b')](_0x32bb1a,function(_0x17f7df){_0x17f7df[_0x0d8b('0x1c')](_0x0d8b('0x1d'));var _0x5cd485='';_0x17f7df['on'](_0x0d8b('0x1e'),function(_0x4586c2){_0x5cd485+=_0x4586c2;});_0x17f7df['on'](_0x0d8b('0x1f'),function(){if(_0x43bca1){return _0x43bca1[_0x0d8b('0x20')](_0x17f7df[_0x0d8b('0x21')])[_0x0d8b('0x22')](JSON[_0x0d8b('0x23')](_0x5cd485));}});});_0x23eb7b['on'](_0x0d8b('0x24'),function(_0x4a15bf){if(_0x43bca1){return _0x43bca1[_0x0d8b('0x20')](0x1f4)[_0x0d8b('0x22')]({'errors':[{'message':_0x0d8b('0x25'),'type':_0x0d8b('0x26')}]});}});_0x23eb7b[_0x0d8b('0x27')](_0x2d4e1c);_0x23eb7b[_0x0d8b('0x1f')]();}exports[_0x0d8b('0x28')]=openIssue;exports[_0x0d8b('0x29')]=function(_0x50ec1e,_0x4f0a1a){_0x50ec1e[_0x0d8b('0x2a')]['ip']=_0x50ec1e['headers']['x-forwarded-for']||_0x50ec1e['connection'][_0x0d8b('0x2b')]||_0x50ec1e[_0x0d8b('0x2c')][_0x0d8b('0x2b')]||_0x50ec1e[_0x0d8b('0x2d')][_0x0d8b('0x2c')][_0x0d8b('0x2b')];return openIssue(_0x50ec1e[_0x0d8b('0x2a')],_0x4f0a1a);}; \ No newline at end of file +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(_0x2a0bf0,_0x247ffd){var _0x104fd6=function(_0x555e9b){while(--_0x555e9b){_0x2a0bf0['push'](_0x2a0bf0['shift']());}};_0x104fd6(++_0x247ffd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 9d45332..c8cdc98 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 _0xe57d=['show','post','put','update','delete','multer','path','express','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','/:id'];(function(_0x9e55f6,_0x5df434){var _0x220e55=function(_0x1fd729){while(--_0x1fd729){_0x9e55f6['push'](_0x9e55f6['shift']());}};_0x220e55(++_0x5df434);}(_0xe57d,0xd7));var _0xde57=function(_0x1622a0,_0x2b55a9){_0x1622a0=_0x1622a0-0x0;var _0x2a2308=_0xe57d[_0x1622a0];return _0x2a2308;};'use strict';var multer=require(_0xde57('0x0'));var util=require('util');var path=require(_0xde57('0x1'));var express=require(_0xde57('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xde57('0x3'));var config=require(_0xde57('0x4'));var controller=require(_0xde57('0x5'));router['get']('/',auth[_0xde57('0x6')](),controller['index']);router[_0xde57('0x7')](_0xde57('0x8'),auth[_0xde57('0x6')](),controller['describe']);router['get'](_0xde57('0x9'),auth['isAuthenticated'](),controller[_0xde57('0xa')]);router[_0xde57('0xb')]('/',auth[_0xde57('0x6')](),controller['create']);router[_0xde57('0xc')]('/:id',auth[_0xde57('0x6')](),controller[_0xde57('0xd')]);router[_0xde57('0xe')](_0xde57('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3816=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x3816,0x113));var _0x6381=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x3816[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0x6381('0x0'));var util=require('util');var path=require(_0x6381('0x1'));var express=require(_0x6381('0x2'));var router=express[_0x6381('0x3')]();var auth=require(_0x6381('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6381('0x5'));var controller=require(_0x6381('0x6'));router['get']('/',auth[_0x6381('0x7')](),controller['index']);router[_0x6381('0x8')](_0x6381('0x9'),auth['isAuthenticated'](),controller[_0x6381('0xa')]);router[_0x6381('0x8')](_0x6381('0xb'),auth[_0x6381('0x7')](),controller[_0x6381('0xc')]);router[_0x6381('0xd')]('/',auth['isAuthenticated'](),controller[_0x6381('0xe')]);router['put']('/:id',auth[_0x6381('0x7')](),controller[_0x6381('0xf')]);router[_0x6381('0x10')](_0x6381('0xb'),auth[_0x6381('0x7')](),controller[_0x6381('0x11')]);module[_0x6381('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 3f5a1ae..28a039a 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 _0x49e9=['STRING','sequelize','exports','TEXT','long'];(function(_0x2d6a6b,_0x24f3fb){var _0x4ae3e=function(_0x5b386f){while(--_0x5b386f){_0x2d6a6b['push'](_0x2d6a6b['shift']());}};_0x4ae3e(++_0x24f3fb);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x949e('0x0'));module[_0x949e('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x949e('0x2')](_0x949e('0x3'))},'membername':{'type':Sequelize[_0x949e('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x949e('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x949e('0x4')]},'questionId':{'type':Sequelize[_0x949e('0x4')]}}; \ No newline at end of file +var _0xf6fb=['TEXT','STRING'];(function(_0x35a5c6,_0xbe5708){var _0x1fb998=function(_0xe28965){while(--_0xe28965){_0x35a5c6['push'](_0x35a5c6['shift']());}};_0x1fb998(++_0xbe5708);}(_0xf6fb,0x111));var _0xbf6f=function(_0x5b7b8e,_0x25e8b5){_0x5b7b8e=_0x5b7b8e-0x0;var _0x179029=_0xf6fb[_0x5b7b8e];return _0x179029;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0xbf6f('0x0')]},'answer':{'type':Sequelize[_0xbf6f('0x1')]('long')},'membername':{'type':Sequelize[_0xbf6f('0x0')]},'projectname':{'type':Sequelize[_0xbf6f('0x0')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbf6f('0x0')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbf6f('0x0')]},'questionId':{'type':Sequelize[_0xbf6f('0x0')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index cf0feae..31e70b2 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 _0x5858=['../../config/environment','../../mysqldb','sendStatus','status','count','offset','reject','save','then','end','error','stack','name','index','JscriptyAnswerReport','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','limit','order','sort','where','dateStart','add','day','merge','filter','map','options','findAll','catch','params','include','create','body','update','find','destroy','describe','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils'];(function(_0x37f02c,_0x16cada){var _0x449f3a=function(_0x23eeed){while(--_0x23eeed){_0x37f02c['push'](_0x37f02c['shift']());}};_0x449f3a(++_0x16cada);}(_0x5858,0x1a2));var _0x8585=function(_0x18b0fd,_0x41c950){_0x18b0fd=_0x18b0fd-0x0;var _0x40efd5=_0x5858[_0x18b0fd];return _0x40efd5;};'use strict';var jsonpatch=require(_0x8585('0x0'));var rp=require(_0x8585('0x1'));var moment=require(_0x8585('0x2'));var BPromise=require(_0x8585('0x3'));var Mustache=require('mustache');var util=require(_0x8585('0x4'));var path=require(_0x8585('0x5'));var sox=require('sox');var csv=require(_0x8585('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8585('0x7'));var squel=require(_0x8585('0x8'));var crypto=require('crypto');var jsforce=require(_0x8585('0x9'));var deskjs=require(_0x8585('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8585('0xb'));var Papa=require(_0x8585('0xc'));var qs=require(_0x8585('0xd'));var logger=require('../../config/logger')(_0x8585('0xe'));var utils=require(_0x8585('0xf'));var config=require(_0x8585('0x10'));var db=require(_0x8585('0x11'))['db'];function respondWithStatusCode(_0x17c13a,_0x35d11d){_0x35d11d=_0x35d11d||0xcc;return function(_0x497a94){if(_0x497a94){return _0x17c13a[_0x8585('0x12')](_0x35d11d);}return _0x17c13a[_0x8585('0x13')](_0x35d11d)['end']();};}function respondWithResult(_0x51f958,_0x1183e7){_0x1183e7=_0x1183e7||0xc8;return function(_0x2fb8fe){if(_0x2fb8fe){return _0x51f958[_0x8585('0x13')](_0x1183e7)['json'](_0x2fb8fe);}};}function respondWithFilteredResult(_0x450aca,_0x120b4a){return function(_0x5b1872){if(_0x5b1872){var _0x26a3ee=_0x5b1872[_0x8585('0x14')],_0x5758c9=_0x120b4a[_0x8585('0x15')],_0x1646cc=_0x120b4a['offset']+_0x120b4a['limit'],_0x3b834d;if(_0x1646cc>=_0x26a3ee){_0x1646cc=_0x26a3ee;_0x3b834d=0xc8;}else{_0x3b834d=0xce;}_0x450aca[_0x8585('0x13')](_0x3b834d);return _0x450aca['set']('Content-Range',_0x5758c9+'-'+_0x1646cc+'/'+_0x26a3ee)['json'](_0x5b1872);}return null;};}function patchUpdates(_0x1a44cc){return function(_0x15cdc){try{jsonpatch['apply'](_0x15cdc,_0x1a44cc,!![]);}catch(_0xcf0b96){return BPromise[_0x8585('0x16')](_0xcf0b96);}return _0x15cdc[_0x8585('0x17')]();};}function saveUpdates(_0x4e8603,_0x188c41){return function(_0x3f37da){if(_0x3f37da){return _0x3f37da['update'](_0x4e8603)[_0x8585('0x18')](function(_0x4ff35b){return _0x4ff35b;});}return null;};}function removeEntity(_0x6ed871,_0xf947e6){return function(_0x5311c6){if(_0x5311c6){return _0x5311c6['destroy']()['then'](function(){_0x6ed871[_0x8585('0x13')](0xcc)[_0x8585('0x19')]();});}};}function handleEntityNotFound(_0x111ac1,_0x108d93){return function(_0x416dae){if(!_0x416dae){_0x111ac1[_0x8585('0x12')](0x194);}return _0x416dae;};}function handleError(_0x276891,_0x1fd890){_0x1fd890=_0x1fd890||0x1f4;return function(_0x1980b3){logger[_0x8585('0x1a')](_0x1980b3[_0x8585('0x1b')]);if(_0x1980b3[_0x8585('0x1c')]){delete _0x1980b3[_0x8585('0x1c')];}_0x276891['status'](_0x1fd890)['send'](_0x1980b3);};}exports[_0x8585('0x1d')]=function(_0x2f3598,_0x258645){var _0x4b4b59={},_0x5a36f3={},_0x193b1e={'count':0x0,'rows':[]};var _0x2c5be9=db[_0x8585('0x1e')][_0x8585('0x1f')];_0x5a36f3[_0x8585('0x20')]=_[_0x8585('0x21')](_0x2c5be9);var _0x4c1ffe={'dateStart':_0x2f3598[_0x8585('0x22')]['dateStart'],'dateEnd':_0x2f3598['query'][_0x8585('0x23')]};delete _0x2f3598[_0x8585('0x22')]['dateStart'];delete _0x2f3598[_0x8585('0x22')][_0x8585('0x23')];_0x5a36f3[_0x8585('0x22')]=_['keys'](_0x2f3598[_0x8585('0x22')]);_0x5a36f3[_0x8585('0x24')]=_[_0x8585('0x25')](_0x5a36f3[_0x8585('0x20')],_0x5a36f3[_0x8585('0x22')]);_0x4b4b59[_0x8585('0x26')]=_[_0x8585('0x25')](_0x5a36f3['model'],qs[_0x8585('0x27')](_0x2f3598[_0x8585('0x22')][_0x8585('0x27')]));_0x4b4b59[_0x8585('0x26')]=_0x4b4b59[_0x8585('0x26')][_0x8585('0x28')]?_0x4b4b59[_0x8585('0x26')]:_0x5a36f3[_0x8585('0x20')];if(!_0x2f3598[_0x8585('0x22')]['hasOwnProperty']('nolimit')){_0x4b4b59[_0x8585('0x29')]=qs[_0x8585('0x29')](_0x2f3598[_0x8585('0x22')][_0x8585('0x29')]);_0x4b4b59[_0x8585('0x15')]=qs[_0x8585('0x15')](_0x2f3598['query']['offset']);}_0x4b4b59[_0x8585('0x2a')]=qs['sort'](_0x2f3598[_0x8585('0x22')][_0x8585('0x2b')]);_0x4b4b59[_0x8585('0x2c')]=qs[_0x8585('0x24')](_['pick'](_0x2f3598[_0x8585('0x22')],_0x5a36f3[_0x8585('0x24')]));if(_0x4c1ffe[_0x8585('0x2d')]){if(_0x4c1ffe[_0x8585('0x23')]){_0x4c1ffe[_0x8585('0x23')]=moment(_0x4c1ffe[_0x8585('0x23')])[_0x8585('0x2e')](0x1,_0x8585('0x2f'));}else{_0x4c1ffe[_0x8585('0x23')]=moment(_0x4c1ffe['dateStart'])[_0x8585('0x2e')](0x1,_0x8585('0x2f'));}_[_0x8585('0x30')](_0x4b4b59['where'],{'createdAt':{'$gte':_0x4c1ffe[_0x8585('0x2d')],'$lte':_0x4c1ffe[_0x8585('0x23')]}});}if(_0x2f3598[_0x8585('0x22')][_0x8585('0x31')]){_0x4b4b59['where']=_['merge'](_0x4b4b59[_0x8585('0x2c')],{'$or':_[_0x8585('0x32')](_0x4b4b59[_0x8585('0x26')],function(_0x3ff99d){var _0x2f8731={};_0x2f8731[_0x3ff99d]={'$like':'%'+_0x2f3598[_0x8585('0x22')][_0x8585('0x31')]+'%'};return _0x2f8731;})});}_0x4b4b59=_[_0x8585('0x30')]({},_0x4b4b59,_0x2f3598[_0x8585('0x33')]);var _0x3e6665={'where':_0x4b4b59['where']};return db['JscriptyAnswerReport'][_0x8585('0x14')](_0x3e6665)[_0x8585('0x18')](function(_0x3cdcfc){_0x193b1e[_0x8585('0x14')]=_0x3cdcfc;if(_0x2f3598[_0x8585('0x22')]['includeAll']){_0x4b4b59['include']=[{'all':!![]}];}return db[_0x8585('0x1e')][_0x8585('0x34')](_0x4b4b59);})['then'](function(_0x309ff7){_0x193b1e['rows']=_0x309ff7;return _0x193b1e;})[_0x8585('0x18')](respondWithFilteredResult(_0x258645,_0x4b4b59))[_0x8585('0x35')](handleError(_0x258645,null));};exports['show']=function(_0x22d26c,_0x16b850){var _0x4f095c={'raw':!![],'where':{'id':_0x22d26c[_0x8585('0x36')]['id']}},_0x21eefd={};_0x21eefd[_0x8585('0x20')]=_[_0x8585('0x21')](db[_0x8585('0x1e')][_0x8585('0x1f')]);_0x21eefd[_0x8585('0x22')]=_[_0x8585('0x21')](_0x22d26c[_0x8585('0x22')]);_0x21eefd[_0x8585('0x24')]=_[_0x8585('0x25')](_0x21eefd[_0x8585('0x20')],_0x21eefd[_0x8585('0x22')]);_0x4f095c[_0x8585('0x26')]=_['intersection'](_0x21eefd[_0x8585('0x20')],qs[_0x8585('0x27')](_0x22d26c['query'][_0x8585('0x27')]));_0x4f095c[_0x8585('0x26')]=_0x4f095c['attributes']['length']?_0x4f095c[_0x8585('0x26')]:_0x21eefd[_0x8585('0x20')];if(_0x22d26c[_0x8585('0x22')]['includeAll']){_0x4f095c[_0x8585('0x37')]=[{'all':!![]}];}_0x4f095c=_['merge']({},_0x4f095c,_0x22d26c[_0x8585('0x33')]);return db[_0x8585('0x1e')]['find'](_0x4f095c)[_0x8585('0x18')](handleEntityNotFound(_0x16b850,null))['then'](respondWithResult(_0x16b850,null))[_0x8585('0x35')](handleError(_0x16b850,null));};exports[_0x8585('0x38')]=function(_0x5f12b7,_0x17bee3){return db[_0x8585('0x1e')][_0x8585('0x38')](_0x5f12b7[_0x8585('0x39')],{})[_0x8585('0x18')](respondWithResult(_0x17bee3,0xc9))['catch'](handleError(_0x17bee3,null));};exports[_0x8585('0x3a')]=function(_0x54be3a,_0x446d7d){if(_0x54be3a[_0x8585('0x39')]['id']){delete _0x54be3a[_0x8585('0x39')]['id'];}return db[_0x8585('0x1e')][_0x8585('0x3b')]({'where':{'id':_0x54be3a[_0x8585('0x36')]['id']}})[_0x8585('0x18')](handleEntityNotFound(_0x446d7d,null))[_0x8585('0x18')](saveUpdates(_0x54be3a['body'],null))[_0x8585('0x18')](respondWithResult(_0x446d7d,null))[_0x8585('0x35')](handleError(_0x446d7d,null));};exports[_0x8585('0x3c')]=function(_0x3c5155,_0x20761e){return db[_0x8585('0x1e')]['find']({'where':{'id':_0x3c5155['params']['id']}})[_0x8585('0x18')](handleEntityNotFound(_0x20761e,null))[_0x8585('0x18')](removeEntity(_0x20761e,null))[_0x8585('0x35')](handleError(_0x20761e,null));};exports[_0x8585('0x3d')]=function(_0x412949,_0x289a1e){return db['JscriptyAnswerReport'][_0x8585('0x3d')]()[_0x8585('0x18')](respondWithResult(_0x289a1e,null))[_0x8585('0x35')](handleError(_0x289a1e,null));}; \ No newline at end of file +var _0xf410=['jsforce','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','add','filter','merge','map','options','include','rows','catch','show','includeAll','find','create','body','params','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf410,0x81));var _0x0f41=function(_0x433ffd,_0x320f74){_0x433ffd=_0x433ffd-0x0;var _0xb2d592=_0xf410[_0x433ffd];return _0xb2d592;};'use strict';var jsonpatch=require(_0x0f41('0x0'));var rp=require(_0x0f41('0x1'));var moment=require(_0x0f41('0x2'));var BPromise=require(_0x0f41('0x3'));var Mustache=require(_0x0f41('0x4'));var util=require(_0x0f41('0x5'));var path=require(_0x0f41('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0f41('0x7'));var fs=require('fs');var _=require(_0x0f41('0x8'));var squel=require(_0x0f41('0x9'));var crypto=require(_0x0f41('0xa'));var jsforce=require(_0x0f41('0xb'));var deskjs=require(_0x0f41('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0f41('0xd'));var logger=require(_0x0f41('0xe'))(_0x0f41('0xf'));var utils=require(_0x0f41('0x10'));var config=require(_0x0f41('0x11'));var db=require(_0x0f41('0x12'))['db'];function respondWithStatusCode(_0x162e21,_0x1acdbe){_0x1acdbe=_0x1acdbe||0xcc;return function(_0x1c246c){if(_0x1c246c){return _0x162e21[_0x0f41('0x13')](_0x1acdbe);}return _0x162e21[_0x0f41('0x14')](_0x1acdbe)[_0x0f41('0x15')]();};}function respondWithResult(_0x4e3f04,_0x445f44){_0x445f44=_0x445f44||0xc8;return function(_0xb5f3b1){if(_0xb5f3b1){return _0x4e3f04[_0x0f41('0x14')](_0x445f44)['json'](_0xb5f3b1);}};}function respondWithFilteredResult(_0x566556,_0x5dd800){return function(_0x1567cf){if(_0x1567cf){var _0x2e91df=_0x1567cf[_0x0f41('0x16')],_0x5415fd=_0x5dd800[_0x0f41('0x17')],_0x4adbad=_0x5dd800['offset']+_0x5dd800['limit'],_0x578d3b;if(_0x4adbad>=_0x2e91df){_0x4adbad=_0x2e91df;_0x578d3b=0xc8;}else{_0x578d3b=0xce;}_0x566556[_0x0f41('0x14')](_0x578d3b);return _0x566556[_0x0f41('0x18')](_0x0f41('0x19'),_0x5415fd+'-'+_0x4adbad+'/'+_0x2e91df)[_0x0f41('0x1a')](_0x1567cf);}return null;};}function patchUpdates(_0x3b0010){return function(_0xf4eb47){try{jsonpatch['apply'](_0xf4eb47,_0x3b0010,!![]);}catch(_0x269f96){return BPromise[_0x0f41('0x1b')](_0x269f96);}return _0xf4eb47[_0x0f41('0x1c')]();};}function saveUpdates(_0x5108d7,_0x107136){return function(_0x211656){if(_0x211656){return _0x211656[_0x0f41('0x1d')](_0x5108d7)[_0x0f41('0x1e')](function(_0xe1d9b4){return _0xe1d9b4;});}return null;};}function removeEntity(_0x2abe5c,_0x450287){return function(_0x526e3d){if(_0x526e3d){return _0x526e3d[_0x0f41('0x1f')]()[_0x0f41('0x1e')](function(){_0x2abe5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3122a7,_0xde8db3){return function(_0x4063d5){if(!_0x4063d5){_0x3122a7[_0x0f41('0x13')](0x194);}return _0x4063d5;};}function handleError(_0x28b647,_0x49924d){_0x49924d=_0x49924d||0x1f4;return function(_0x3006e1){logger[_0x0f41('0x20')](_0x3006e1[_0x0f41('0x21')]);if(_0x3006e1[_0x0f41('0x22')]){delete _0x3006e1[_0x0f41('0x22')];}_0x28b647[_0x0f41('0x14')](_0x49924d)[_0x0f41('0x23')](_0x3006e1);};}exports[_0x0f41('0x24')]=function(_0x3cba07,_0x42de26){var _0xb8f77c={},_0x54f3f3={},_0x261f86={'count':0x0,'rows':[]};var _0x1774e6=db[_0x0f41('0x25')][_0x0f41('0x26')];_0x54f3f3[_0x0f41('0x27')]=_[_0x0f41('0x28')](_0x1774e6);var _0x522c6f={'dateStart':_0x3cba07[_0x0f41('0x29')]['dateStart'],'dateEnd':_0x3cba07['query'][_0x0f41('0x2a')]};delete _0x3cba07['query'][_0x0f41('0x2b')];delete _0x3cba07['query']['dateEnd'];_0x54f3f3[_0x0f41('0x29')]=_[_0x0f41('0x28')](_0x3cba07[_0x0f41('0x29')]);_0x54f3f3[_0x0f41('0x2c')]=_[_0x0f41('0x2d')](_0x54f3f3['model'],_0x54f3f3[_0x0f41('0x29')]);_0xb8f77c[_0x0f41('0x2e')]=_[_0x0f41('0x2d')](_0x54f3f3[_0x0f41('0x27')],qs[_0x0f41('0x2f')](_0x3cba07[_0x0f41('0x29')][_0x0f41('0x2f')]));_0xb8f77c[_0x0f41('0x2e')]=_0xb8f77c[_0x0f41('0x2e')][_0x0f41('0x30')]?_0xb8f77c['attributes']:_0x54f3f3[_0x0f41('0x27')];if(!_0x3cba07[_0x0f41('0x29')][_0x0f41('0x31')]('nolimit')){_0xb8f77c['limit']=qs['limit'](_0x3cba07[_0x0f41('0x29')][_0x0f41('0x32')]);_0xb8f77c[_0x0f41('0x17')]=qs[_0x0f41('0x17')](_0x3cba07[_0x0f41('0x29')][_0x0f41('0x17')]);}_0xb8f77c[_0x0f41('0x33')]=qs[_0x0f41('0x34')](_0x3cba07['query'][_0x0f41('0x34')]);_0xb8f77c[_0x0f41('0x35')]=qs[_0x0f41('0x2c')](_[_0x0f41('0x36')](_0x3cba07[_0x0f41('0x29')],_0x54f3f3[_0x0f41('0x2c')]));if(_0x522c6f['dateStart']){if(_0x522c6f['dateEnd']){_0x522c6f[_0x0f41('0x2a')]=moment(_0x522c6f[_0x0f41('0x2a')])[_0x0f41('0x37')](0x1,'day');}else{_0x522c6f[_0x0f41('0x2a')]=moment(_0x522c6f[_0x0f41('0x2b')])['add'](0x1,'day');}_['merge'](_0xb8f77c['where'],{'createdAt':{'$gte':_0x522c6f[_0x0f41('0x2b')],'$lte':_0x522c6f[_0x0f41('0x2a')]}});}if(_0x3cba07['query'][_0x0f41('0x38')]){_0xb8f77c[_0x0f41('0x35')]=_[_0x0f41('0x39')](_0xb8f77c[_0x0f41('0x35')],{'$or':_[_0x0f41('0x3a')](_0xb8f77c[_0x0f41('0x2e')],function(_0x5c3c3c){var _0x503811={};_0x503811[_0x5c3c3c]={'$like':'%'+_0x3cba07[_0x0f41('0x29')][_0x0f41('0x38')]+'%'};return _0x503811;})});}_0xb8f77c=_[_0x0f41('0x39')]({},_0xb8f77c,_0x3cba07[_0x0f41('0x3b')]);var _0x585829={'where':_0xb8f77c[_0x0f41('0x35')]};return db[_0x0f41('0x25')][_0x0f41('0x16')](_0x585829)[_0x0f41('0x1e')](function(_0xc1cb54){_0x261f86[_0x0f41('0x16')]=_0xc1cb54;if(_0x3cba07[_0x0f41('0x29')]['includeAll']){_0xb8f77c[_0x0f41('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0xb8f77c);})['then'](function(_0x3d524c){_0x261f86[_0x0f41('0x3d')]=_0x3d524c;return _0x261f86;})[_0x0f41('0x1e')](respondWithFilteredResult(_0x42de26,_0xb8f77c))[_0x0f41('0x3e')](handleError(_0x42de26,null));};exports[_0x0f41('0x3f')]=function(_0x57f154,_0x306c7b){var _0x122204={'raw':!![],'where':{'id':_0x57f154['params']['id']}},_0x423feb={};_0x423feb[_0x0f41('0x27')]=_[_0x0f41('0x28')](db[_0x0f41('0x25')]['rawAttributes']);_0x423feb[_0x0f41('0x29')]=_[_0x0f41('0x28')](_0x57f154['query']);_0x423feb[_0x0f41('0x2c')]=_[_0x0f41('0x2d')](_0x423feb[_0x0f41('0x27')],_0x423feb[_0x0f41('0x29')]);_0x122204[_0x0f41('0x2e')]=_['intersection'](_0x423feb[_0x0f41('0x27')],qs['fields'](_0x57f154[_0x0f41('0x29')][_0x0f41('0x2f')]));_0x122204[_0x0f41('0x2e')]=_0x122204[_0x0f41('0x2e')][_0x0f41('0x30')]?_0x122204[_0x0f41('0x2e')]:_0x423feb[_0x0f41('0x27')];if(_0x57f154['query'][_0x0f41('0x40')]){_0x122204[_0x0f41('0x3c')]=[{'all':!![]}];}_0x122204=_[_0x0f41('0x39')]({},_0x122204,_0x57f154[_0x0f41('0x3b')]);return db[_0x0f41('0x25')][_0x0f41('0x41')](_0x122204)[_0x0f41('0x1e')](handleEntityNotFound(_0x306c7b,null))[_0x0f41('0x1e')](respondWithResult(_0x306c7b,null))[_0x0f41('0x3e')](handleError(_0x306c7b,null));};exports[_0x0f41('0x42')]=function(_0x3f6462,_0x515f65){return db[_0x0f41('0x25')][_0x0f41('0x42')](_0x3f6462[_0x0f41('0x43')],{})[_0x0f41('0x1e')](respondWithResult(_0x515f65,0xc9))[_0x0f41('0x3e')](handleError(_0x515f65,null));};exports[_0x0f41('0x1d')]=function(_0xbb5055,_0x5999cc){if(_0xbb5055[_0x0f41('0x43')]['id']){delete _0xbb5055[_0x0f41('0x43')]['id'];}return db[_0x0f41('0x25')]['find']({'where':{'id':_0xbb5055[_0x0f41('0x44')]['id']}})[_0x0f41('0x1e')](handleEntityNotFound(_0x5999cc,null))[_0x0f41('0x1e')](saveUpdates(_0xbb5055[_0x0f41('0x43')],null))[_0x0f41('0x1e')](respondWithResult(_0x5999cc,null))[_0x0f41('0x3e')](handleError(_0x5999cc,null));};exports['destroy']=function(_0x2c0c81,_0x1aacef){return db[_0x0f41('0x25')]['find']({'where':{'id':_0x2c0c81['params']['id']}})['then'](handleEntityNotFound(_0x1aacef,null))['then'](removeEntity(_0x1aacef,null))[_0x0f41('0x3e')](handleError(_0x1aacef,null));};exports[_0x0f41('0x45')]=function(_0x7ad7cd,_0x10b34a){return db[_0x0f41('0x25')]['describe']()[_0x0f41('0x1e')](respondWithResult(_0x10b34a,null))['catch'](handleError(_0x10b34a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ad17b3c..edcfcf7 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 _0x31c4=['lodash','util','../../config/logger','api','bluebird','request-promise','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x1cb22c,_0x23a93d){var _0x38a1f5=function(_0x17d417){while(--_0x17d417){_0x1cb22c['push'](_0x1cb22c['shift']());}};_0x38a1f5(++_0x23a93d);}(_0x31c4,0x129));var _0x431c=function(_0x3b3b28,_0x55f49e){_0x3b3b28=_0x3b3b28-0x0;var _0xae7f20=_0x31c4[_0x3b3b28];return _0xae7f20;};'use strict';var _=require(_0x431c('0x0'));var util=require(_0x431c('0x1'));var logger=require(_0x431c('0x2'))(_0x431c('0x3'));var moment=require('moment');var BPromise=require(_0x431c('0x4'));var rp=require(_0x431c('0x5'));var attributes=require(_0x431c('0x6'));module[_0x431c('0x7')]=function(_0x4c883e,_0x2d0413){return _0x4c883e[_0x431c('0x8')](_0x431c('0x9'),attributes,{'tableName':_0x431c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8f1=['lodash','util','api','./jscriptyAnswerReport.attributes','define'];(function(_0x207d39,_0x44ca92){var _0x2a9d64=function(_0x49d5f3){while(--_0x49d5f3){_0x207d39['push'](_0x207d39['shift']());}};_0x2a9d64(++_0x44ca92);}(_0xd8f1,0x19f));var _0x1d8f=function(_0x52ef44,_0x3ad069){_0x52ef44=_0x52ef44-0x0;var _0x212f9d=_0xd8f1[_0x52ef44];return _0x212f9d;};'use strict';var _=require(_0x1d8f('0x0'));var util=require(_0x1d8f('0x1'));var logger=require('../../config/logger')(_0x1d8f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x1d8f('0x3'));module['exports']=function(_0x30fcec,_0x50490e){return _0x30fcec[_0x1d8f('0x4')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ed881c0..d76898a 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 _0x820a=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3a56d7,_0x411b14){var _0xbe9c7c=function(_0x2b8c4b){while(--_0x2b8c4b){_0x3a56d7['push'](_0x3a56d7['shift']());}};_0xbe9c7c(++_0x411b14);}(_0x820a,0xfe));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa820('0x0'));var util=require(_0xa820('0x1'));var moment=require(_0xa820('0x2'));var BPromise=require(_0xa820('0x3'));var rs=require(_0xa820('0x4'));var fs=require('fs');var db=require(_0xa820('0x5'))['db'];var utils=require(_0xa820('0x6'));var logger=require(_0xa820('0x7'))(_0xa820('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa820('0x9')][_0xa820('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce746,_0x1502fa,_0x1171dc){return new BPromise(function(_0x5bfa61,_0x367eb2){return client[_0xa820('0xb')](_0x2ce746,_0x1171dc)['then'](function(_0x1a096f){logger[_0xa820('0xc')](_0xa820('0xd'),_0x1502fa,_0xa820('0xe'));logger[_0xa820('0xf')](_0xa820('0x10'),_0x1502fa,_0xa820('0xe'),JSON[_0xa820('0x11')](_0x1a096f));if(_0x1a096f['error']){if(_0x1a096f[_0xa820('0x12')][_0xa820('0x13')]===0x1f4){logger[_0xa820('0x12')](_0xa820('0xd'),_0x1502fa,_0x1a096f[_0xa820('0x12')][_0xa820('0x14')]);return _0x367eb2(_0x1a096f[_0xa820('0x12')][_0xa820('0x14')]);}logger[_0xa820('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1502fa,_0x1a096f[_0xa820('0x12')][_0xa820('0x14')]);return _0x5bfa61(_0x1a096f[_0xa820('0x12')][_0xa820('0x14')]);}else{logger[_0xa820('0xc')](_0xa820('0xd'),_0x1502fa,_0xa820('0xe'));_0x5bfa61(_0x1a096f[_0xa820('0x15')][_0xa820('0x14')]);}})[_0xa820('0x16')](function(_0x4cf57c){logger['error'](_0xa820('0xd'),_0x1502fa,_0x4cf57c);_0x367eb2(_0x4cf57c);});});} \ No newline at end of file +var _0x9891=['request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x558e3f,_0x40a0de){var _0x3d6dc9=function(_0x345239){while(--_0x345239){_0x558e3f['push'](_0x558e3f['shift']());}};_0x3d6dc9(++_0x40a0de);}(_0x9891,0x8f));var _0x1989=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x9891[_0x8afdd0];return _0x3de7ac;};'use strict';var _=require(_0x1989('0x0'));var util=require(_0x1989('0x1'));var moment=require(_0x1989('0x2'));var BPromise=require(_0x1989('0x3'));var rs=require(_0x1989('0x4'));var fs=require('fs');var db=require(_0x1989('0x5'))['db'];var utils=require(_0x1989('0x6'));var logger=require('../../config/logger')(_0x1989('0x7'));var config=require(_0x1989('0x8'));var jayson=require(_0x1989('0x9'));var client=jayson['client'][_0x1989('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43dafe,_0x312d78,_0x51ca7f){return new BPromise(function(_0x56c734,_0x140900){return client[_0x1989('0xb')](_0x43dafe,_0x51ca7f)[_0x1989('0xc')](function(_0x3be816){logger['info'](_0x1989('0xd'),_0x312d78,_0x1989('0xe'));logger[_0x1989('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x312d78,_0x1989('0xe'),JSON['stringify'](_0x3be816));if(_0x3be816[_0x1989('0x10')]){if(_0x3be816[_0x1989('0x10')][_0x1989('0x11')]===0x1f4){logger[_0x1989('0x10')](_0x1989('0xd'),_0x312d78,_0x3be816[_0x1989('0x10')][_0x1989('0x12')]);return _0x140900(_0x3be816[_0x1989('0x10')][_0x1989('0x12')]);}logger[_0x1989('0x10')](_0x1989('0xd'),_0x312d78,_0x3be816[_0x1989('0x10')][_0x1989('0x12')]);return _0x56c734(_0x3be816[_0x1989('0x10')][_0x1989('0x12')]);}else{logger[_0x1989('0x13')](_0x1989('0xd'),_0x312d78,_0x1989('0xe'));_0x56c734(_0x3be816[_0x1989('0x14')][_0x1989('0x12')]);}})[_0x1989('0x15')](function(_0x636076){logger['error'](_0x1989('0xd'),_0x312d78,_0x636076);_0x140900(_0x636076);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 27636ab..9b15eac 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 _0x5fab=['/:id/summary','getSummary','post','create','/:id/clone','clone','put','delete','/:id','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers'];(function(_0x3bff96,_0x5c063b){var _0x3af2e9=function(_0x1c3cd9){while(--_0x1c3cd9){_0x3bff96['push'](_0x3bff96['shift']());}};_0x3af2e9(++_0x5c063b);}(_0x5fab,0x177));var _0xb5fa=function(_0xac21df,_0x4f3ba2){_0xac21df=_0xac21df-0x0;var _0x1faa60=_0x5fab[_0xac21df];return _0x1faa60;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var express=require(_0xb5fa('0x2'));var router=express[_0xb5fa('0x3')]();var auth=require(_0xb5fa('0x4'));var interaction=require(_0xb5fa('0x5'));var config=require(_0xb5fa('0x6'));var controller=require(_0xb5fa('0x7'));router[_0xb5fa('0x8')]('/',auth[_0xb5fa('0x9')](),controller[_0xb5fa('0xa')]);router[_0xb5fa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb5fa('0xb')]);router[_0xb5fa('0x8')](_0xb5fa('0xc'),auth['isAuthenticated'](),controller[_0xb5fa('0xd')]);router[_0xb5fa('0x8')](_0xb5fa('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xb5fa('0x8')](_0xb5fa('0xf'),auth[_0xb5fa('0x9')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')]('/',auth[_0xb5fa('0x9')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x11')](_0xb5fa('0x13'),auth['isAuthenticated'](),controller[_0xb5fa('0x14')]);router[_0xb5fa('0x15')]('/:id',auth[_0xb5fa('0x9')](),controller['update']);router[_0xb5fa('0x16')](_0xb5fa('0x17'),auth[_0xb5fa('0x9')](),controller[_0xb5fa('0x18')]);module[_0xb5fa('0x19')]=router; \ No newline at end of file +var _0x46ed=['index','get','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','put','delete','destroy','multer','util','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','isAuthenticated'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x46ed,0x168));var _0xd46e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x46ed[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var express=require(_0xd46e('0x2'));var router=express[_0xd46e('0x3')]();var auth=require(_0xd46e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd46e('0x5'));var controller=require(_0xd46e('0x6'));router['get']('/',auth[_0xd46e('0x7')](),controller[_0xd46e('0x8')]);router[_0xd46e('0x9')](_0xd46e('0xa'),auth[_0xd46e('0x7')](),controller[_0xd46e('0xb')]);router[_0xd46e('0x9')](_0xd46e('0xc'),auth[_0xd46e('0x7')](),controller[_0xd46e('0xd')]);router[_0xd46e('0x9')]('/:id/answers',auth[_0xd46e('0x7')](),controller[_0xd46e('0xe')]);router['get'](_0xd46e('0xf'),auth[_0xd46e('0x7')](),controller[_0xd46e('0x10')]);router[_0xd46e('0x11')]('/',auth[_0xd46e('0x7')](),controller[_0xd46e('0x12')]);router['post'](_0xd46e('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0xd46e('0x14')](_0xd46e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xd46e('0x15')](_0xd46e('0xa'),auth[_0xd46e('0x7')](),controller[_0xd46e('0x16')]);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 6c7b5bb..eaebc74 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 _0x68ff=['description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x68ff,0x152));var _0xf68f=function(_0xebf8dd,_0x2f4a6f){_0xebf8dd=_0xebf8dd-0x0;var _0x4caca8=_0x68ff[_0xebf8dd];return _0x4caca8;};'use strict';var Sequelize=require(_0xf68f('0x0'));var _=require('lodash');var util=require(_0xf68f('0x1'));module[_0xf68f('0x2')]={'name':{'type':Sequelize[_0xf68f('0x3')],'unique':_0xf68f('0x4')},'description':{'type':Sequelize[_0xf68f('0x3')]},'formData':{'type':Sequelize[_0xf68f('0x5')](_0xf68f('0x6')),'set':function(_0x30629f){if(_[_0xf68f('0x7')](_0x30629f)){this['setDataValue']('formData',JSON['stringify'](_0x30629f));}else if(_[_0xf68f('0x8')](_0x30629f)){this[_0xf68f('0x9')](_0xf68f('0xa'),_0x30629f);}else{this['setDataValue'](_0xf68f('0xa'),util[_0xf68f('0xb')](_0xf68f('0xc'),this[_0xf68f('0xd')](_0xf68f('0x4'))||'',this[_0xf68f('0xd')](_0xf68f('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf68f('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa169=['getDataValue','description','BOOLEAN','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0xa169,0x199));var _0x9a16=function(_0x13b3a8,_0x3e073d){_0x13b3a8=_0x13b3a8-0x0;var _0x58acfa=_0xa169[_0x13b3a8];return _0x58acfa;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x9a16('0x0'));module[_0x9a16('0x1')]={'name':{'type':Sequelize[_0x9a16('0x2')],'unique':_0x9a16('0x3')},'description':{'type':Sequelize[_0x9a16('0x2')]},'formData':{'type':Sequelize[_0x9a16('0x4')](_0x9a16('0x5')),'set':function(_0xc773c2){if(_[_0x9a16('0x6')](_0xc773c2)){this[_0x9a16('0x7')](_0x9a16('0x8'),JSON['stringify'](_0xc773c2));}else if(_[_0x9a16('0x9')](_0xc773c2)){this[_0x9a16('0x7')](_0x9a16('0x8'),_0xc773c2);}else{this[_0x9a16('0x7')](_0x9a16('0x8'),util['format'](_0x9a16('0xa'),this[_0x9a16('0xb')](_0x9a16('0x3'))||'',this[_0x9a16('0xb')](_0x9a16('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9a16('0xd')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 1e82c00..64e65c1 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 _0x0d37=['include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','clone','get','omit','updatedAt','body','createdAt','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','request-promise','moment','mustache','util','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','JscriptyProject'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0d37,0x150));var _0x70d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d37[_0x321bb2];return _0x9c12ed;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x70d3('0x0'));var moment=require(_0x70d3('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x70d3('0x2'));var util=require(_0x70d3('0x3'));var path=require('path');var sox=require(_0x70d3('0x4'));var csv=require(_0x70d3('0x5'));var ejs=require(_0x70d3('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x70d3('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x70d3('0x8'));var toCsv=require(_0x70d3('0x5'));var querystring=require(_0x70d3('0x9'));var Papa=require(_0x70d3('0xa'));var qs=require(_0x70d3('0xb'));var logger=require(_0x70d3('0xc'))(_0x70d3('0xd'));var utils=require(_0x70d3('0xe'));var config=require(_0x70d3('0xf'));var db=require(_0x70d3('0x10'))['db'];function respondWithStatusCode(_0xf40c71,_0x8baeb7){_0x8baeb7=_0x8baeb7||0xcc;return function(_0x46feae){if(_0x46feae){return _0xf40c71[_0x70d3('0x11')](_0x8baeb7);}return _0xf40c71['status'](_0x8baeb7)[_0x70d3('0x12')]();};}function respondWithResult(_0x4509a5,_0x590ce9){_0x590ce9=_0x590ce9||0xc8;return function(_0x54d3eb){if(_0x54d3eb){return _0x4509a5[_0x70d3('0x13')](_0x590ce9)[_0x70d3('0x14')](_0x54d3eb);}};}function respondWithFilteredResult(_0x273ef3,_0x5096e0){return function(_0x4792be){if(_0x4792be){var _0x153bf4=_0x4792be[_0x70d3('0x15')],_0x14f1ae=_0x5096e0['offset'],_0x3357a4=_0x5096e0[_0x70d3('0x16')]+_0x5096e0[_0x70d3('0x17')],_0x1ed5c9;if(_0x3357a4>=_0x153bf4){_0x3357a4=_0x153bf4;_0x1ed5c9=0xc8;}else{_0x1ed5c9=0xce;}_0x273ef3[_0x70d3('0x13')](_0x1ed5c9);return _0x273ef3['set'](_0x70d3('0x18'),_0x14f1ae+'-'+_0x3357a4+'/'+_0x153bf4)[_0x70d3('0x14')](_0x4792be);}return null;};}function patchUpdates(_0x35183a){return function(_0x302ed9){try{jsonpatch[_0x70d3('0x19')](_0x302ed9,_0x35183a,!![]);}catch(_0x1760c9){return BPromise['reject'](_0x1760c9);}return _0x302ed9[_0x70d3('0x1a')]();};}function saveUpdates(_0x385f25,_0x365851){return function(_0x298c64){if(_0x298c64){return _0x298c64[_0x70d3('0x1b')](_0x385f25)['then'](function(_0x161424){return _0x161424;});}return null;};}function removeEntity(_0x1bee13,_0x4c644f){return function(_0x23ca88){if(_0x23ca88){return _0x23ca88['destroy']()[_0x70d3('0x1c')](function(){_0x1bee13[_0x70d3('0x13')](0xcc)[_0x70d3('0x12')]();});}};}function handleEntityNotFound(_0x15bf75,_0x206501){return function(_0x22b1ba){if(!_0x22b1ba){_0x15bf75[_0x70d3('0x11')](0x194);}return _0x22b1ba;};}function handleError(_0x1c83ee,_0x41041b){_0x41041b=_0x41041b||0x1f4;return function(_0x182e81){logger[_0x70d3('0x1d')](_0x182e81[_0x70d3('0x1e')]);if(_0x182e81[_0x70d3('0x1f')]){delete _0x182e81[_0x70d3('0x1f')];}_0x1c83ee['status'](_0x41041b)[_0x70d3('0x20')](_0x182e81);};}exports['index']=function(_0x9347de,_0x1b1045){var _0x234079={},_0x376cf5={},_0x2ff380={'count':0x0,'rows':[]};var _0x4820f1=db['JscriptyProject']['rawAttributes'];_0x376cf5[_0x70d3('0x21')]=_[_0x70d3('0x22')](_0x4820f1);var _0x510aa3={'dateStart':_0x9347de[_0x70d3('0x23')][_0x70d3('0x24')],'dateEnd':_0x9347de[_0x70d3('0x23')][_0x70d3('0x25')]};delete _0x9347de[_0x70d3('0x23')]['dateStart'];delete _0x9347de[_0x70d3('0x23')][_0x70d3('0x25')];_0x376cf5['query']=_[_0x70d3('0x22')](_0x9347de[_0x70d3('0x23')]);_0x376cf5[_0x70d3('0x26')]=_[_0x70d3('0x27')](_0x376cf5[_0x70d3('0x21')],_0x376cf5[_0x70d3('0x23')]);_0x234079[_0x70d3('0x28')]=_[_0x70d3('0x27')](_0x376cf5[_0x70d3('0x21')],qs[_0x70d3('0x29')](_0x9347de[_0x70d3('0x23')]['fields']));_0x234079[_0x70d3('0x28')]=_0x234079[_0x70d3('0x28')][_0x70d3('0x2a')]?_0x234079[_0x70d3('0x28')]:_0x376cf5[_0x70d3('0x21')];if(!_0x9347de['query'][_0x70d3('0x2b')](_0x70d3('0x2c'))){_0x234079[_0x70d3('0x17')]=qs[_0x70d3('0x17')](_0x9347de[_0x70d3('0x23')][_0x70d3('0x17')]);_0x234079[_0x70d3('0x16')]=qs['offset'](_0x9347de[_0x70d3('0x23')][_0x70d3('0x16')]);}_0x234079[_0x70d3('0x2d')]=qs[_0x70d3('0x2e')](_0x9347de['query'][_0x70d3('0x2e')]);_0x234079[_0x70d3('0x2f')]=qs[_0x70d3('0x26')](_[_0x70d3('0x30')](_0x9347de['query'],_0x376cf5[_0x70d3('0x26')]));if(_0x510aa3[_0x70d3('0x24')]){if(_0x510aa3['dateEnd']){_0x510aa3[_0x70d3('0x25')]=moment(_0x510aa3[_0x70d3('0x25')])[_0x70d3('0x31')](0x1,_0x70d3('0x32'));}else{_0x510aa3['dateEnd']=moment(_0x510aa3[_0x70d3('0x24')])['add'](0x1,_0x70d3('0x32'));}_[_0x70d3('0x33')](_0x234079[_0x70d3('0x2f')],{'createdAt':{'$gte':_0x510aa3[_0x70d3('0x24')],'$lte':_0x510aa3[_0x70d3('0x25')]}});}if(_0x9347de[_0x70d3('0x23')][_0x70d3('0x34')]){_0x234079['where']=_['merge'](_0x234079[_0x70d3('0x2f')],{'$or':_[_0x70d3('0x35')](_0x234079[_0x70d3('0x28')],function(_0x7721df){var _0x44b7fe={};_0x44b7fe[_0x7721df]={'$like':'%'+_0x9347de['query'][_0x70d3('0x34')]+'%'};return _0x44b7fe;})});}_0x234079=_[_0x70d3('0x33')]({},_0x234079,_0x9347de[_0x70d3('0x36')]);var _0x13bb12={'where':_0x234079[_0x70d3('0x2f')]};return db[_0x70d3('0x37')][_0x70d3('0x15')](_0x13bb12)['then'](function(_0x5864da){_0x2ff380[_0x70d3('0x15')]=_0x5864da;if(_0x9347de[_0x70d3('0x23')]['includeAll']){_0x234079[_0x70d3('0x38')]=[{'all':!![]}];}return db[_0x70d3('0x37')][_0x70d3('0x39')](_0x234079);})[_0x70d3('0x1c')](function(_0x83c21f){_0x2ff380[_0x70d3('0x3a')]=_0x83c21f;return _0x2ff380;})[_0x70d3('0x1c')](respondWithFilteredResult(_0x1b1045,_0x234079))[_0x70d3('0x3b')](handleError(_0x1b1045,null));};exports[_0x70d3('0x3c')]=function(_0x512e8e,_0x519fd0){var _0x315485={'raw':![],'where':{'id':_0x512e8e[_0x70d3('0x3d')]['id']}},_0x35a1de={};_0x35a1de[_0x70d3('0x21')]=_[_0x70d3('0x22')](db[_0x70d3('0x37')][_0x70d3('0x3e')]);_0x35a1de[_0x70d3('0x23')]=_['keys'](_0x512e8e[_0x70d3('0x23')]);_0x35a1de[_0x70d3('0x26')]=_[_0x70d3('0x27')](_0x35a1de[_0x70d3('0x21')],_0x35a1de['query']);_0x315485[_0x70d3('0x28')]=_[_0x70d3('0x27')](_0x35a1de[_0x70d3('0x21')],qs[_0x70d3('0x29')](_0x512e8e['query'][_0x70d3('0x29')]));_0x315485[_0x70d3('0x28')]=_0x315485[_0x70d3('0x28')][_0x70d3('0x2a')]?_0x315485[_0x70d3('0x28')]:_0x35a1de['model'];if(_0x512e8e[_0x70d3('0x23')][_0x70d3('0x3f')]){_0x315485[_0x70d3('0x38')]=[{'all':!![]}];}_0x315485=_[_0x70d3('0x33')]({},_0x315485,_0x512e8e[_0x70d3('0x36')]);return db[_0x70d3('0x37')][_0x70d3('0x40')](_0x315485)[_0x70d3('0x1c')](handleEntityNotFound(_0x519fd0,null))[_0x70d3('0x1c')](respondWithResult(_0x519fd0,null))[_0x70d3('0x3b')](handleError(_0x519fd0,null));};exports['create']=function(_0x2635b3,_0x2620f3){return db[_0x70d3('0x37')]['create'](_0x2635b3['body'],{})[_0x70d3('0x1c')](respondWithResult(_0x2620f3,0xc9))[_0x70d3('0x3b')](handleError(_0x2620f3,null));};exports[_0x70d3('0x41')]=function(_0x55b910,_0x21e247){var _0x43600={'raw':![],'where':{'id':_0x55b910['params']['id']}},_0x28f696={};_0x28f696[_0x70d3('0x21')]=_[_0x70d3('0x22')](db[_0x70d3('0x37')][_0x70d3('0x3e')]);_0x43600[_0x70d3('0x28')]=_[_0x70d3('0x27')](_0x28f696[_0x70d3('0x21')],qs[_0x70d3('0x29')](_0x55b910[_0x70d3('0x23')][_0x70d3('0x29')]));_0x43600['attributes']=_0x43600[_0x70d3('0x28')][_0x70d3('0x2a')]?_0x43600[_0x70d3('0x28')]:_0x28f696[_0x70d3('0x21')];if(_0x55b910[_0x70d3('0x23')][_0x70d3('0x3f')]){_0x43600[_0x70d3('0x38')]=[{'all':!![]}];}_0x43600=_['merge']({},_0x43600,_0x55b910['options']);return db[_0x70d3('0x37')]['find'](_0x43600)[_0x70d3('0x1c')](handleEntityNotFound(_0x21e247,null))['then'](function(_0x471bd8){if(_0x471bd8){var _0x3f2af7=_0x471bd8[_0x70d3('0x42')]({'plain':!![]});_0x3f2af7=qs[_0x70d3('0x43')](_0x3f2af7,['id','createdAt',_0x70d3('0x44')]);_0x55b910[_0x70d3('0x45')]=_[_0x70d3('0x43')](_0x55b910[_0x70d3('0x45')],['id',_0x70d3('0x46'),'updatedAt']);return db[_0x70d3('0x37')]['create'](_['merge'](_0x3f2af7,_0x55b910['body']),{'include':_0x55b910[_0x70d3('0x23')][_0x70d3('0x3f')]?[{'all':!![]}]:undefined});}})[_0x70d3('0x1c')](respondWithResult(_0x21e247,0xc9))['catch'](handleError(_0x21e247,null));};exports[_0x70d3('0x1b')]=function(_0x5656f7,_0x490c7c){if(_0x5656f7[_0x70d3('0x45')]['id']){delete _0x5656f7['body']['id'];}return db['JscriptyProject'][_0x70d3('0x40')]({'where':{'id':_0x5656f7[_0x70d3('0x3d')]['id']}})['then'](handleEntityNotFound(_0x490c7c,null))[_0x70d3('0x1c')](saveUpdates(_0x5656f7[_0x70d3('0x45')],null))[_0x70d3('0x1c')](respondWithResult(_0x490c7c,null))['catch'](handleError(_0x490c7c,null));};exports['destroy']=function(_0x4f4ce3,_0x418984){return db[_0x70d3('0x37')]['find']({'where':{'id':_0x4f4ce3[_0x70d3('0x3d')]['id']}})[_0x70d3('0x1c')](handleEntityNotFound(_0x418984,null))['then'](removeEntity(_0x418984,null))[_0x70d3('0x3b')](handleError(_0x418984,null));};exports[_0x70d3('0x47')]=function(_0x6d3762,_0x1b56e2,_0x22fef7){var _0x5bb7e7={'raw':!![],'where':{}};var _0x2509ea={};var _0x38560a={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x6d3762[_0x70d3('0x3d')]['id']}})[_0x70d3('0x1c')](handleEntityNotFound(_0x1b56e2,null))[_0x70d3('0x1c')](function(_0x5951d2){if(_0x5951d2){_0x2509ea[_0x70d3('0x21')]=_[_0x70d3('0x22')](db[_0x70d3('0x48')]['rawAttributes']);_0x2509ea[_0x70d3('0x23')]=_[_0x70d3('0x22')](_0x6d3762[_0x70d3('0x23')]);_0x2509ea[_0x70d3('0x26')]=_[_0x70d3('0x27')](_0x2509ea[_0x70d3('0x21')],_0x2509ea['query']);_0x5bb7e7[_0x70d3('0x28')]=_['intersection'](_0x2509ea[_0x70d3('0x21')],qs[_0x70d3('0x29')](_0x6d3762[_0x70d3('0x23')]['fields']));_0x5bb7e7[_0x70d3('0x28')]=_0x5bb7e7[_0x70d3('0x28')]['length']?_0x5bb7e7[_0x70d3('0x28')]:_0x2509ea[_0x70d3('0x21')];if(!_0x6d3762['query'][_0x70d3('0x2b')](_0x70d3('0x2c'))){_0x5bb7e7['limit']=qs[_0x70d3('0x17')](_0x6d3762[_0x70d3('0x23')]['limit']);_0x5bb7e7['offset']=qs[_0x70d3('0x16')](_0x6d3762[_0x70d3('0x23')]['offset']);}_0x5bb7e7[_0x70d3('0x2d')]=qs[_0x70d3('0x2e')](_0x6d3762[_0x70d3('0x23')][_0x70d3('0x2e')]);_0x5bb7e7[_0x70d3('0x2f')]=qs['filters'](_[_0x70d3('0x30')](_0x6d3762[_0x70d3('0x23')],_0x2509ea['filters']));_0x5bb7e7[_0x70d3('0x2f')][_0x70d3('0x49')]=_0x5951d2['id'];if(_0x6d3762[_0x70d3('0x23')][_0x70d3('0x34')]){_0x5bb7e7['where']=_['merge'](_0x5bb7e7[_0x70d3('0x2f')],{'$or':_[_0x70d3('0x35')](_0x5bb7e7[_0x70d3('0x28')],function(_0x3a71d5){var _0x51b5ce={};_0x51b5ce[_0x3a71d5]={'$like':'%'+_0x6d3762['query'][_0x70d3('0x34')]+'%'};return _0x51b5ce;})});}_0x5bb7e7=_[_0x70d3('0x33')]({},_0x5bb7e7,_0x6d3762[_0x70d3('0x36')]);return db[_0x70d3('0x48')]['count']({'where':_0x5bb7e7['where']})[_0x70d3('0x1c')](function(_0x1f5068){_0x38560a[_0x70d3('0x15')]=_0x1f5068;if(_0x6d3762[_0x70d3('0x23')]['includeAll']){_0x5bb7e7[_0x70d3('0x38')]=[{'all':!![]}];}return db[_0x70d3('0x48')][_0x70d3('0x39')](_0x5bb7e7);})['then'](function(_0x536ebe){_0x38560a['rows']=_0x536ebe;return _0x38560a;});}})[_0x70d3('0x1c')](respondWithFilteredResult(_0x1b56e2,_0x5bb7e7))[_0x70d3('0x3b')](handleError(_0x1b56e2,null));};exports[_0x70d3('0x4a')]=function(_0xf3c5bd,_0xaa7a3b,_0x5eb040){var _0x2a4469={'raw':!![],'where':{}};var _0x48f292={};var _0x5b5966={'count':0x0,'rows':[]};var _0x18f6fc={'dateStart':_0xf3c5bd[_0x70d3('0x23')]['dateStart'],'dateEnd':_0xf3c5bd[_0x70d3('0x23')]['dateEnd']};delete _0xf3c5bd[_0x70d3('0x23')][_0x70d3('0x24')];delete _0xf3c5bd['query'][_0x70d3('0x25')];return db['JscriptyProject'][_0x70d3('0x4b')]({'where':{'id':_0xf3c5bd[_0x70d3('0x3d')]['id']}})[_0x70d3('0x1c')](handleEntityNotFound(_0xaa7a3b,null))[_0x70d3('0x1c')](function(_0x529caa){if(_0x529caa){_0x48f292[_0x70d3('0x21')]=_[_0x70d3('0x22')](db[_0x70d3('0x4c')][_0x70d3('0x3e')]);_0x48f292['query']=_[_0x70d3('0x22')](_0xf3c5bd[_0x70d3('0x23')]);_0x48f292[_0x70d3('0x26')]=_[_0x70d3('0x27')](_0x48f292[_0x70d3('0x21')],_0x48f292[_0x70d3('0x23')]);_0x2a4469[_0x70d3('0x28')]=_[_0x70d3('0x27')](_0x48f292[_0x70d3('0x21')],qs[_0x70d3('0x29')](_0xf3c5bd['query'][_0x70d3('0x29')]));_0x2a4469[_0x70d3('0x28')]=_0x2a4469[_0x70d3('0x28')][_0x70d3('0x2a')]?_0x2a4469['attributes']:_0x48f292['model'];if(!_0xf3c5bd['query'][_0x70d3('0x2b')](_0x70d3('0x2c'))){_0x2a4469[_0x70d3('0x17')]=qs[_0x70d3('0x17')](_0xf3c5bd[_0x70d3('0x23')]['limit']);_0x2a4469[_0x70d3('0x16')]=qs['offset'](_0xf3c5bd[_0x70d3('0x23')][_0x70d3('0x16')]);}_0x2a4469[_0x70d3('0x2d')]=qs[_0x70d3('0x2e')](_0xf3c5bd[_0x70d3('0x23')][_0x70d3('0x2e')]);_0x2a4469['where']=qs[_0x70d3('0x26')](_[_0x70d3('0x30')](_0xf3c5bd[_0x70d3('0x23')],_0x48f292[_0x70d3('0x26')]));_0x2a4469[_0x70d3('0x2f')]['ProjectId']=_0x529caa['id'];if(_0x18f6fc['dateStart']){if(_0x18f6fc[_0x70d3('0x25')]){_0x18f6fc[_0x70d3('0x25')]=moment(_0x18f6fc['dateEnd'])[_0x70d3('0x31')](0x1,_0x70d3('0x32'));}else{_0x18f6fc[_0x70d3('0x25')]=moment(_0x18f6fc[_0x70d3('0x24')])[_0x70d3('0x31')](0x1,_0x70d3('0x32'));}_['merge'](_0x2a4469[_0x70d3('0x2f')],{'createdAt':{'$gte':_0x18f6fc[_0x70d3('0x24')],'$lte':_0x18f6fc[_0x70d3('0x25')]}});}if(_0xf3c5bd[_0x70d3('0x23')][_0x70d3('0x34')]){_0x2a4469[_0x70d3('0x2f')]=_[_0x70d3('0x33')](_0x2a4469['where'],{'$or':_[_0x70d3('0x35')](_0x2a4469[_0x70d3('0x28')],function(_0x4d6676){var _0x75d4c9={};_0x75d4c9[_0x4d6676]={'$like':'%'+_0xf3c5bd[_0x70d3('0x23')][_0x70d3('0x34')]+'%'};return _0x75d4c9;})});}_0x2a4469=_[_0x70d3('0x33')]({},_0x2a4469,_0xf3c5bd['options']);return db[_0x70d3('0x4c')][_0x70d3('0x15')]({'where':_0x2a4469[_0x70d3('0x2f')]})['then'](function(_0x5bab45){_0x5b5966[_0x70d3('0x15')]=_0x5bab45;if(_0xf3c5bd[_0x70d3('0x23')]['includeAll']){_0x2a4469[_0x70d3('0x38')]=[{'all':!![]}];}return db[_0x70d3('0x4c')][_0x70d3('0x39')](_0x2a4469);})[_0x70d3('0x1c')](function(_0x48247f){_0x5b5966['rows']=_0x48247f;return _0x5b5966;});}})['then'](respondWithFilteredResult(_0xaa7a3b,_0x2a4469))[_0x70d3('0x3b')](handleError(_0xaa7a3b,null));};function char(_0x5d835e){return _0x70d3('0x4d')===typeof _0x5d835e?String['fromCharCode'][_0x70d3('0x19')](null,arguments):_0x5d835e;}function needsEncapsulation(_0x405d98){return!!_0x405d98&&(_0x405d98[_0x70d3('0x4e')]()['indexOf'](char(0xd))>=0x0||_0x405d98[_0x70d3('0x4e')]()[_0x70d3('0x4f')](char(0xa))>=0x0||_0x405d98['toString']()[_0x70d3('0x4f')](char(0x2c))>=0x0||_0x405d98[_0x70d3('0x4e')]()[_0x70d3('0x4f')](char(0x22))>=0x0);}function encapsulate(_0x8da378){var _0x574de0=char(0x22),_0x421208='\x5c'+char(0x22),_0xbc6961=_0x8da378[_0x70d3('0x4e')]()[_0x70d3('0x50')](new RegExp(_0x574de0,'g'),_0x421208);return _0x574de0+_0xbc6961+_0x574de0;}exports[_0x70d3('0x51')]=function(_0x316ea2,_0x2793aa,_0x1afced){var _0x46cda3,_0x5ca618;var _0x340360={'dateStart':_0x316ea2[_0x70d3('0x23')][_0x70d3('0x24')],'dateEnd':_0x316ea2['query'][_0x70d3('0x25')]};delete _0x316ea2[_0x70d3('0x23')][_0x70d3('0x24')];delete _0x316ea2[_0x70d3('0x23')]['dateEnd'];if(_0x340360[_0x70d3('0x24')]){if(_0x340360[_0x70d3('0x25')]){_0x340360[_0x70d3('0x25')]=moment(_0x340360[_0x70d3('0x25')])[_0x70d3('0x31')](0x1,'day');}else{_0x340360[_0x70d3('0x25')]=moment(_0x340360[_0x70d3('0x24')])[_0x70d3('0x31')](0x1,'day');}}return db['JscriptySessionReport']['findAll']({'where':{'ProjectId':_0x316ea2[_0x70d3('0x3d')]['id'],'starttime':{'$gte':_0x340360[_0x70d3('0x24')],'$lte':_0x340360['dateEnd']}}})[_0x70d3('0x1c')](handleEntityNotFound(_0x2793aa,null))[_0x70d3('0x1c')](function(_0x39523a){if(_0x39523a){_0x46cda3=_0x39523a;return db['JscriptyQuestionReport'][_0x70d3('0x39')]({'where':{'SessionId':{'$in':_[_0x70d3('0x35')](_0x46cda3,'id')},'ProjectId':_0x316ea2['params']['id']},'order':_0x70d3('0x52')});}})[_0x70d3('0x1c')](handleEntityNotFound(_0x2793aa,null))[_0x70d3('0x1c')](function(_0x36ccc9){if(_0x36ccc9){_0x5ca618=_0x36ccc9;var _0x20e789={};for(var _0x58b2e0=0x0,_0x5d36ea=_0x5ca618[_0x70d3('0x2a')];_0x58b2e0<_0x5d36ea;_0x58b2e0++){if(!_0x20e789[_0x70d3('0x2b')](_0x5ca618[_0x58b2e0][_0x70d3('0x53')])){_0x20e789[_0x5ca618[_0x58b2e0][_0x70d3('0x53')]]=needsEncapsulation(_0x5ca618[_0x58b2e0]['question'])?encapsulate(_0x5ca618[_0x58b2e0][_0x70d3('0x54')]):_0x5ca618[_0x58b2e0][_0x70d3('0x54')];}}var _0x482d55=[],_0x390825={};for(var _0xa01aa1=0x0,_0x18a1d0=_0x46cda3[_0x70d3('0x2a')];_0xa01aa1<_0x18a1d0;_0xa01aa1++){_0x390825={'ProjectId':_0x316ea2[_0x70d3('0x3d')]['id'],'SessionId':_0x46cda3[_0xa01aa1]['id'],'StartTime':moment(_0x46cda3[_0xa01aa1][_0x70d3('0x55')])[_0x70d3('0x56')](_0x70d3('0x57'))};for(var _0x502357=0x0,_0x1dee27=_0x5ca618[_0x70d3('0x2a')];_0x502357<_0x1dee27;_0x502357++){if(_0x5ca618[_0x502357][_0x70d3('0x58')]==_0x46cda3[_0xa01aa1]['id']&&_0x20e789['hasOwnProperty'](_0x5ca618[_0x502357][_0x70d3('0x53')])){_0x390825[_0x20e789[_0x5ca618[_0x502357][_0x70d3('0x53')]]]=_0x5ca618[_0x502357]['answer'];}}for(var _0x404998 in _0x20e789){if(!_0x390825[_0x70d3('0x2b')](_0x20e789[_0x404998])){_0x390825[_0x20e789[_0x404998]]=null;}}_0x482d55[_0x70d3('0x59')](_0x390825);}return _0x482d55;}})[_0x70d3('0x1c')](function(_0x21a7d6){if(!_[_0x70d3('0x5a')](_0x21a7d6)){var _0x2fd2ef=toCsv(_0x21a7d6);var _0x1a3298=Date[_0x70d3('0x5b')]();fs[_0x70d3('0x5c')](util['format'](_0x70d3('0x5d'),_0x316ea2['params']['id'],_0x1a3298),_0x2fd2ef);_0x2793aa[_0x70d3('0x5e')](_0x70d3('0x5f'),'attachment;\x20filename='+util['format'](_0x70d3('0x60'),_0x316ea2[_0x70d3('0x3d')]['id'],_0x1a3298));_0x2793aa['setHeader']('Content-type',_0x70d3('0x61'));return _0x2793aa['download'](util[_0x70d3('0x56')](_0x70d3('0x5d'),_0x316ea2[_0x70d3('0x3d')]['id'],_0x1a3298));}else{return _0x2793aa['sendStatus'](0xcc);}})[_0x70d3('0x3b')](handleError(_0x2793aa,null));}; \ No newline at end of file +var _0x13b2=['JscriptyProject','rawAttributes','keys','dateStart','query','dateEnd','intersection','model','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','add','day','merge','filter','map','options','count','includeAll','include','rows','catch','params','fields','length','find','create','body','clone','get','createdAt','updatedAt','omit','destroy','getSessions','findOne','ProjectId','JscriptySessionReport','pick','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','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','end','status','json','limit','set','Content-Range','apply','save','update','then','sendStatus','error','send','index'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x13b2,0x187));var _0x213b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x13b2[_0x2641f9];return _0x585741;};'use strict';var jsonpatch=require(_0x213b('0x0'));var rp=require(_0x213b('0x1'));var moment=require(_0x213b('0x2'));var BPromise=require(_0x213b('0x3'));var Mustache=require(_0x213b('0x4'));var util=require(_0x213b('0x5'));var path=require(_0x213b('0x6'));var sox=require(_0x213b('0x7'));var csv=require(_0x213b('0x8'));var ejs=require(_0x213b('0x9'));var fs=require('fs');var _=require(_0x213b('0xa'));var squel=require(_0x213b('0xb'));var crypto=require(_0x213b('0xc'));var jsforce=require(_0x213b('0xd'));var deskjs=require(_0x213b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x213b('0xf'));var Papa=require(_0x213b('0x10'));var qs=require(_0x213b('0x11'));var logger=require(_0x213b('0x12'))(_0x213b('0x13'));var utils=require(_0x213b('0x14'));var config=require(_0x213b('0x15'));var db=require(_0x213b('0x16'))['db'];function respondWithStatusCode(_0x2bb8e5,_0x19606b){_0x19606b=_0x19606b||0xcc;return function(_0xcf511a){if(_0xcf511a){return _0x2bb8e5['sendStatus'](_0x19606b);}return _0x2bb8e5['status'](_0x19606b)[_0x213b('0x17')]();};}function respondWithResult(_0x307a7d,_0x33b2ee){_0x33b2ee=_0x33b2ee||0xc8;return function(_0xb30095){if(_0xb30095){return _0x307a7d[_0x213b('0x18')](_0x33b2ee)[_0x213b('0x19')](_0xb30095);}};}function respondWithFilteredResult(_0x269732,_0x109315){return function(_0x593b5c){if(_0x593b5c){var _0x973cbc=_0x593b5c['count'],_0x257bff=_0x109315['offset'],_0x23ff5a=_0x109315['offset']+_0x109315[_0x213b('0x1a')],_0x2c8564;if(_0x23ff5a>=_0x973cbc){_0x23ff5a=_0x973cbc;_0x2c8564=0xc8;}else{_0x2c8564=0xce;}_0x269732[_0x213b('0x18')](_0x2c8564);return _0x269732[_0x213b('0x1b')](_0x213b('0x1c'),_0x257bff+'-'+_0x23ff5a+'/'+_0x973cbc)[_0x213b('0x19')](_0x593b5c);}return null;};}function patchUpdates(_0xe62509){return function(_0x13bea4){try{jsonpatch[_0x213b('0x1d')](_0x13bea4,_0xe62509,!![]);}catch(_0x1f03d1){return BPromise['reject'](_0x1f03d1);}return _0x13bea4[_0x213b('0x1e')]();};}function saveUpdates(_0x50ff84,_0x1c7df2){return function(_0x5b45c6){if(_0x5b45c6){return _0x5b45c6[_0x213b('0x1f')](_0x50ff84)[_0x213b('0x20')](function(_0x21712d){return _0x21712d;});}return null;};}function removeEntity(_0x5aba9a,_0x20750f){return function(_0x412b7b){if(_0x412b7b){return _0x412b7b['destroy']()[_0x213b('0x20')](function(){_0x5aba9a[_0x213b('0x18')](0xcc)[_0x213b('0x17')]();});}};}function handleEntityNotFound(_0x3d42bf,_0x124ed1){return function(_0xbb8516){if(!_0xbb8516){_0x3d42bf[_0x213b('0x21')](0x194);}return _0xbb8516;};}function handleError(_0x1f715e,_0x5950ed){_0x5950ed=_0x5950ed||0x1f4;return function(_0xd5e63a){logger[_0x213b('0x22')](_0xd5e63a['stack']);if(_0xd5e63a['name']){delete _0xd5e63a['name'];}_0x1f715e['status'](_0x5950ed)[_0x213b('0x23')](_0xd5e63a);};}exports[_0x213b('0x24')]=function(_0x43418e,_0x157527){var _0x63f868={},_0x10aeb4={},_0x1c25f0={'count':0x0,'rows':[]};var _0x38021d=db[_0x213b('0x25')][_0x213b('0x26')];_0x10aeb4['model']=_[_0x213b('0x27')](_0x38021d);var _0x1bf3a6={'dateStart':_0x43418e['query'][_0x213b('0x28')],'dateEnd':_0x43418e[_0x213b('0x29')]['dateEnd']};delete _0x43418e[_0x213b('0x29')][_0x213b('0x28')];delete _0x43418e[_0x213b('0x29')][_0x213b('0x2a')];_0x10aeb4['query']=_['keys'](_0x43418e[_0x213b('0x29')]);_0x10aeb4['filters']=_[_0x213b('0x2b')](_0x10aeb4[_0x213b('0x2c')],_0x10aeb4[_0x213b('0x29')]);_0x63f868[_0x213b('0x2d')]=_[_0x213b('0x2b')](_0x10aeb4[_0x213b('0x2c')],qs['fields'](_0x43418e[_0x213b('0x29')]['fields']));_0x63f868['attributes']=_0x63f868[_0x213b('0x2d')]['length']?_0x63f868[_0x213b('0x2d')]:_0x10aeb4[_0x213b('0x2c')];if(!_0x43418e[_0x213b('0x29')][_0x213b('0x2e')](_0x213b('0x2f'))){_0x63f868[_0x213b('0x1a')]=qs['limit'](_0x43418e[_0x213b('0x29')][_0x213b('0x1a')]);_0x63f868[_0x213b('0x30')]=qs[_0x213b('0x30')](_0x43418e[_0x213b('0x29')]['offset']);}_0x63f868[_0x213b('0x31')]=qs['sort'](_0x43418e[_0x213b('0x29')][_0x213b('0x32')]);_0x63f868[_0x213b('0x33')]=qs[_0x213b('0x34')](_['pick'](_0x43418e['query'],_0x10aeb4[_0x213b('0x34')]));if(_0x1bf3a6[_0x213b('0x28')]){if(_0x1bf3a6['dateEnd']){_0x1bf3a6[_0x213b('0x2a')]=moment(_0x1bf3a6[_0x213b('0x2a')])[_0x213b('0x35')](0x1,_0x213b('0x36'));}else{_0x1bf3a6[_0x213b('0x2a')]=moment(_0x1bf3a6[_0x213b('0x28')])[_0x213b('0x35')](0x1,_0x213b('0x36'));}_[_0x213b('0x37')](_0x63f868[_0x213b('0x33')],{'createdAt':{'$gte':_0x1bf3a6[_0x213b('0x28')],'$lte':_0x1bf3a6[_0x213b('0x2a')]}});}if(_0x43418e[_0x213b('0x29')][_0x213b('0x38')]){_0x63f868[_0x213b('0x33')]=_[_0x213b('0x37')](_0x63f868[_0x213b('0x33')],{'$or':_[_0x213b('0x39')](_0x63f868[_0x213b('0x2d')],function(_0x100d68){var _0x151575={};_0x151575[_0x100d68]={'$like':'%'+_0x43418e[_0x213b('0x29')][_0x213b('0x38')]+'%'};return _0x151575;})});}_0x63f868=_[_0x213b('0x37')]({},_0x63f868,_0x43418e[_0x213b('0x3a')]);var _0x54f7d3={'where':_0x63f868[_0x213b('0x33')]};return db[_0x213b('0x25')][_0x213b('0x3b')](_0x54f7d3)[_0x213b('0x20')](function(_0x43794b){_0x1c25f0[_0x213b('0x3b')]=_0x43794b;if(_0x43418e[_0x213b('0x29')][_0x213b('0x3c')]){_0x63f868[_0x213b('0x3d')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x63f868);})[_0x213b('0x20')](function(_0x17f6ce){_0x1c25f0[_0x213b('0x3e')]=_0x17f6ce;return _0x1c25f0;})[_0x213b('0x20')](respondWithFilteredResult(_0x157527,_0x63f868))[_0x213b('0x3f')](handleError(_0x157527,null));};exports['show']=function(_0x370937,_0xc5bcd1){var _0x512661={'raw':![],'where':{'id':_0x370937[_0x213b('0x40')]['id']}},_0x5f39d7={};_0x5f39d7[_0x213b('0x2c')]=_[_0x213b('0x27')](db[_0x213b('0x25')][_0x213b('0x26')]);_0x5f39d7[_0x213b('0x29')]=_[_0x213b('0x27')](_0x370937[_0x213b('0x29')]);_0x5f39d7[_0x213b('0x34')]=_[_0x213b('0x2b')](_0x5f39d7['model'],_0x5f39d7['query']);_0x512661['attributes']=_[_0x213b('0x2b')](_0x5f39d7[_0x213b('0x2c')],qs[_0x213b('0x41')](_0x370937[_0x213b('0x29')][_0x213b('0x41')]));_0x512661[_0x213b('0x2d')]=_0x512661[_0x213b('0x2d')][_0x213b('0x42')]?_0x512661[_0x213b('0x2d')]:_0x5f39d7[_0x213b('0x2c')];if(_0x370937[_0x213b('0x29')][_0x213b('0x3c')]){_0x512661[_0x213b('0x3d')]=[{'all':!![]}];}_0x512661=_[_0x213b('0x37')]({},_0x512661,_0x370937[_0x213b('0x3a')]);return db['JscriptyProject'][_0x213b('0x43')](_0x512661)['then'](handleEntityNotFound(_0xc5bcd1,null))[_0x213b('0x20')](respondWithResult(_0xc5bcd1,null))[_0x213b('0x3f')](handleError(_0xc5bcd1,null));};exports[_0x213b('0x44')]=function(_0x264b5c,_0x268656){return db[_0x213b('0x25')][_0x213b('0x44')](_0x264b5c[_0x213b('0x45')],{})['then'](respondWithResult(_0x268656,0xc9))[_0x213b('0x3f')](handleError(_0x268656,null));};exports[_0x213b('0x46')]=function(_0x27de8e,_0x4680ff){var _0x2592fa={'raw':![],'where':{'id':_0x27de8e[_0x213b('0x40')]['id']}},_0x357784={};_0x357784[_0x213b('0x2c')]=_[_0x213b('0x27')](db['JscriptyProject'][_0x213b('0x26')]);_0x2592fa['attributes']=_[_0x213b('0x2b')](_0x357784[_0x213b('0x2c')],qs['fields'](_0x27de8e[_0x213b('0x29')][_0x213b('0x41')]));_0x2592fa[_0x213b('0x2d')]=_0x2592fa['attributes'][_0x213b('0x42')]?_0x2592fa[_0x213b('0x2d')]:_0x357784[_0x213b('0x2c')];if(_0x27de8e[_0x213b('0x29')]['includeAll']){_0x2592fa['include']=[{'all':!![]}];}_0x2592fa=_[_0x213b('0x37')]({},_0x2592fa,_0x27de8e['options']);return db[_0x213b('0x25')][_0x213b('0x43')](_0x2592fa)[_0x213b('0x20')](handleEntityNotFound(_0x4680ff,null))[_0x213b('0x20')](function(_0xcffe21){if(_0xcffe21){var _0x14ff9f=_0xcffe21[_0x213b('0x47')]({'plain':!![]});_0x14ff9f=qs['omit'](_0x14ff9f,['id',_0x213b('0x48'),_0x213b('0x49')]);_0x27de8e[_0x213b('0x45')]=_[_0x213b('0x4a')](_0x27de8e['body'],['id',_0x213b('0x48'),_0x213b('0x49')]);return db[_0x213b('0x25')][_0x213b('0x44')](_[_0x213b('0x37')](_0x14ff9f,_0x27de8e[_0x213b('0x45')]),{'include':_0x27de8e['query'][_0x213b('0x3c')]?[{'all':!![]}]:undefined});}})[_0x213b('0x20')](respondWithResult(_0x4680ff,0xc9))['catch'](handleError(_0x4680ff,null));};exports[_0x213b('0x1f')]=function(_0x21a26b,_0x5ef419){if(_0x21a26b['body']['id']){delete _0x21a26b['body']['id'];}return db[_0x213b('0x25')][_0x213b('0x43')]({'where':{'id':_0x21a26b[_0x213b('0x40')]['id']}})['then'](handleEntityNotFound(_0x5ef419,null))[_0x213b('0x20')](saveUpdates(_0x21a26b[_0x213b('0x45')],null))[_0x213b('0x20')](respondWithResult(_0x5ef419,null))['catch'](handleError(_0x5ef419,null));};exports[_0x213b('0x4b')]=function(_0x1b9033,_0x1a5eaf){return db[_0x213b('0x25')][_0x213b('0x43')]({'where':{'id':_0x1b9033[_0x213b('0x40')]['id']}})['then'](handleEntityNotFound(_0x1a5eaf,null))[_0x213b('0x20')](removeEntity(_0x1a5eaf,null))[_0x213b('0x3f')](handleError(_0x1a5eaf,null));};exports[_0x213b('0x4c')]=function(_0x4a2ac9,_0x2ec751,_0x2d6112){var _0x3ca248={'raw':!![],'where':{}};var _0x131c99={};var _0x59dfe6={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x213b('0x4d')]({'where':{'id':_0x4a2ac9[_0x213b('0x40')]['id']}})[_0x213b('0x20')](handleEntityNotFound(_0x2ec751,null))[_0x213b('0x20')](function(_0x85d790){if(_0x85d790){_0x131c99[_0x213b('0x2c')]=_[_0x213b('0x27')](db['JscriptySessionReport'][_0x213b('0x26')]);_0x131c99[_0x213b('0x29')]=_[_0x213b('0x27')](_0x4a2ac9['query']);_0x131c99['filters']=_['intersection'](_0x131c99[_0x213b('0x2c')],_0x131c99[_0x213b('0x29')]);_0x3ca248['attributes']=_[_0x213b('0x2b')](_0x131c99[_0x213b('0x2c')],qs[_0x213b('0x41')](_0x4a2ac9[_0x213b('0x29')][_0x213b('0x41')]));_0x3ca248['attributes']=_0x3ca248[_0x213b('0x2d')][_0x213b('0x42')]?_0x3ca248[_0x213b('0x2d')]:_0x131c99['model'];if(!_0x4a2ac9[_0x213b('0x29')][_0x213b('0x2e')](_0x213b('0x2f'))){_0x3ca248['limit']=qs[_0x213b('0x1a')](_0x4a2ac9['query'][_0x213b('0x1a')]);_0x3ca248[_0x213b('0x30')]=qs['offset'](_0x4a2ac9[_0x213b('0x29')]['offset']);}_0x3ca248[_0x213b('0x31')]=qs[_0x213b('0x32')](_0x4a2ac9[_0x213b('0x29')][_0x213b('0x32')]);_0x3ca248[_0x213b('0x33')]=qs[_0x213b('0x34')](_['pick'](_0x4a2ac9[_0x213b('0x29')],_0x131c99[_0x213b('0x34')]));_0x3ca248['where'][_0x213b('0x4e')]=_0x85d790['id'];if(_0x4a2ac9[_0x213b('0x29')][_0x213b('0x38')]){_0x3ca248['where']=_[_0x213b('0x37')](_0x3ca248['where'],{'$or':_[_0x213b('0x39')](_0x3ca248['attributes'],function(_0x5793b0){var _0x2f7b61={};_0x2f7b61[_0x5793b0]={'$like':'%'+_0x4a2ac9[_0x213b('0x29')][_0x213b('0x38')]+'%'};return _0x2f7b61;})});}_0x3ca248=_[_0x213b('0x37')]({},_0x3ca248,_0x4a2ac9['options']);return db[_0x213b('0x4f')][_0x213b('0x3b')]({'where':_0x3ca248[_0x213b('0x33')]})[_0x213b('0x20')](function(_0x58b3e6){_0x59dfe6['count']=_0x58b3e6;if(_0x4a2ac9[_0x213b('0x29')][_0x213b('0x3c')]){_0x3ca248[_0x213b('0x3d')]=[{'all':!![]}];}return db[_0x213b('0x4f')]['findAll'](_0x3ca248);})[_0x213b('0x20')](function(_0x337111){_0x59dfe6[_0x213b('0x3e')]=_0x337111;return _0x59dfe6;});}})['then'](respondWithFilteredResult(_0x2ec751,_0x3ca248))[_0x213b('0x3f')](handleError(_0x2ec751,null));};exports['getAnswers']=function(_0x3c1b94,_0x5421ef,_0x560ae7){var _0x3bc71e={'raw':!![],'where':{}};var _0x2719e0={};var _0x579c34={'count':0x0,'rows':[]};var _0x1131b4={'dateStart':_0x3c1b94[_0x213b('0x29')][_0x213b('0x28')],'dateEnd':_0x3c1b94[_0x213b('0x29')]['dateEnd']};delete _0x3c1b94[_0x213b('0x29')][_0x213b('0x28')];delete _0x3c1b94[_0x213b('0x29')]['dateEnd'];return db[_0x213b('0x25')][_0x213b('0x4d')]({'where':{'id':_0x3c1b94[_0x213b('0x40')]['id']}})[_0x213b('0x20')](handleEntityNotFound(_0x5421ef,null))['then'](function(_0x238784){if(_0x238784){_0x2719e0[_0x213b('0x2c')]=_[_0x213b('0x27')](db['JscriptyAnswerReport'][_0x213b('0x26')]);_0x2719e0[_0x213b('0x29')]=_[_0x213b('0x27')](_0x3c1b94[_0x213b('0x29')]);_0x2719e0['filters']=_[_0x213b('0x2b')](_0x2719e0[_0x213b('0x2c')],_0x2719e0[_0x213b('0x29')]);_0x3bc71e[_0x213b('0x2d')]=_[_0x213b('0x2b')](_0x2719e0[_0x213b('0x2c')],qs[_0x213b('0x41')](_0x3c1b94['query'][_0x213b('0x41')]));_0x3bc71e[_0x213b('0x2d')]=_0x3bc71e[_0x213b('0x2d')][_0x213b('0x42')]?_0x3bc71e['attributes']:_0x2719e0[_0x213b('0x2c')];if(!_0x3c1b94[_0x213b('0x29')][_0x213b('0x2e')](_0x213b('0x2f'))){_0x3bc71e[_0x213b('0x1a')]=qs[_0x213b('0x1a')](_0x3c1b94['query']['limit']);_0x3bc71e[_0x213b('0x30')]=qs['offset'](_0x3c1b94[_0x213b('0x29')][_0x213b('0x30')]);}_0x3bc71e[_0x213b('0x31')]=qs['sort'](_0x3c1b94[_0x213b('0x29')][_0x213b('0x32')]);_0x3bc71e['where']=qs['filters'](_[_0x213b('0x50')](_0x3c1b94[_0x213b('0x29')],_0x2719e0[_0x213b('0x34')]));_0x3bc71e[_0x213b('0x33')][_0x213b('0x4e')]=_0x238784['id'];if(_0x1131b4['dateStart']){if(_0x1131b4['dateEnd']){_0x1131b4[_0x213b('0x2a')]=moment(_0x1131b4[_0x213b('0x2a')])[_0x213b('0x35')](0x1,_0x213b('0x36'));}else{_0x1131b4[_0x213b('0x2a')]=moment(_0x1131b4[_0x213b('0x28')])['add'](0x1,_0x213b('0x36'));}_[_0x213b('0x37')](_0x3bc71e[_0x213b('0x33')],{'createdAt':{'$gte':_0x1131b4[_0x213b('0x28')],'$lte':_0x1131b4[_0x213b('0x2a')]}});}if(_0x3c1b94[_0x213b('0x29')]['filter']){_0x3bc71e[_0x213b('0x33')]=_['merge'](_0x3bc71e[_0x213b('0x33')],{'$or':_[_0x213b('0x39')](_0x3bc71e[_0x213b('0x2d')],function(_0x5ac300){var _0x34ef89={};_0x34ef89[_0x5ac300]={'$like':'%'+_0x3c1b94[_0x213b('0x29')][_0x213b('0x38')]+'%'};return _0x34ef89;})});}_0x3bc71e=_['merge']({},_0x3bc71e,_0x3c1b94[_0x213b('0x3a')]);return db[_0x213b('0x51')][_0x213b('0x3b')]({'where':_0x3bc71e[_0x213b('0x33')]})['then'](function(_0x225f7f){_0x579c34['count']=_0x225f7f;if(_0x3c1b94['query'][_0x213b('0x3c')]){_0x3bc71e[_0x213b('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x213b('0x52')](_0x3bc71e);})[_0x213b('0x20')](function(_0x272095){_0x579c34['rows']=_0x272095;return _0x579c34;});}})['then'](respondWithFilteredResult(_0x5421ef,_0x3bc71e))[_0x213b('0x3f')](handleError(_0x5421ef,null));};function char(_0x1a0080){return _0x213b('0x53')===typeof _0x1a0080?String[_0x213b('0x54')][_0x213b('0x1d')](null,arguments):_0x1a0080;}function needsEncapsulation(_0x71505f){return!!_0x71505f&&(_0x71505f[_0x213b('0x55')]()['indexOf'](char(0xd))>=0x0||_0x71505f[_0x213b('0x55')]()[_0x213b('0x56')](char(0xa))>=0x0||_0x71505f[_0x213b('0x55')]()[_0x213b('0x56')](char(0x2c))>=0x0||_0x71505f[_0x213b('0x55')]()[_0x213b('0x56')](char(0x22))>=0x0);}function encapsulate(_0x24a0e7){var _0x9160ac=char(0x22),_0x3411a4='\x5c'+char(0x22),_0x39950c=_0x24a0e7[_0x213b('0x55')]()[_0x213b('0x57')](new RegExp(_0x9160ac,'g'),_0x3411a4);return _0x9160ac+_0x39950c+_0x9160ac;}exports[_0x213b('0x58')]=function(_0x3bc4e8,_0x2a28ee,_0x11ebf1){var _0x1a73d8,_0x4d113d;var _0x533d09={'dateStart':_0x3bc4e8[_0x213b('0x29')][_0x213b('0x28')],'dateEnd':_0x3bc4e8[_0x213b('0x29')][_0x213b('0x2a')]};delete _0x3bc4e8[_0x213b('0x29')][_0x213b('0x28')];delete _0x3bc4e8[_0x213b('0x29')][_0x213b('0x2a')];if(_0x533d09['dateStart']){if(_0x533d09[_0x213b('0x2a')]){_0x533d09[_0x213b('0x2a')]=moment(_0x533d09['dateEnd'])[_0x213b('0x35')](0x1,_0x213b('0x36'));}else{_0x533d09[_0x213b('0x2a')]=moment(_0x533d09[_0x213b('0x28')])[_0x213b('0x35')](0x1,_0x213b('0x36'));}}return db[_0x213b('0x4f')][_0x213b('0x52')]({'where':{'ProjectId':_0x3bc4e8['params']['id'],'starttime':{'$gte':_0x533d09[_0x213b('0x28')],'$lte':_0x533d09['dateEnd']}}})[_0x213b('0x20')](handleEntityNotFound(_0x2a28ee,null))[_0x213b('0x20')](function(_0x3420b8){if(_0x3420b8){_0x1a73d8=_0x3420b8;return db[_0x213b('0x59')]['findAll']({'where':{'SessionId':{'$in':_[_0x213b('0x39')](_0x1a73d8,'id')},'ProjectId':_0x3bc4e8['params']['id']},'order':_0x213b('0x5a')});}})['then'](handleEntityNotFound(_0x2a28ee,null))[_0x213b('0x20')](function(_0x5e2640){if(_0x5e2640){_0x4d113d=_0x5e2640;var _0x3315e8={};for(var _0x4c1a1c=0x0,_0x98beed=_0x4d113d[_0x213b('0x42')];_0x4c1a1c<_0x98beed;_0x4c1a1c++){if(!_0x3315e8[_0x213b('0x2e')](_0x4d113d[_0x4c1a1c][_0x213b('0x5b')])){_0x3315e8[_0x4d113d[_0x4c1a1c][_0x213b('0x5b')]]=needsEncapsulation(_0x4d113d[_0x4c1a1c][_0x213b('0x5c')])?encapsulate(_0x4d113d[_0x4c1a1c][_0x213b('0x5c')]):_0x4d113d[_0x4c1a1c]['question'];}}var _0x1c7e28=[],_0x1a8a49={};for(var _0x4b29bf=0x0,_0x38ab77=_0x1a73d8['length'];_0x4b29bf<_0x38ab77;_0x4b29bf++){_0x1a8a49={'ProjectId':_0x3bc4e8['params']['id'],'SessionId':_0x1a73d8[_0x4b29bf]['id'],'StartTime':moment(_0x1a73d8[_0x4b29bf][_0x213b('0x5d')])[_0x213b('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2ca20d=0x0,_0x154e8b=_0x4d113d[_0x213b('0x42')];_0x2ca20d<_0x154e8b;_0x2ca20d++){if(_0x4d113d[_0x2ca20d][_0x213b('0x5f')]==_0x1a73d8[_0x4b29bf]['id']&&_0x3315e8[_0x213b('0x2e')](_0x4d113d[_0x2ca20d][_0x213b('0x5b')])){_0x1a8a49[_0x3315e8[_0x4d113d[_0x2ca20d][_0x213b('0x5b')]]]=_0x4d113d[_0x2ca20d][_0x213b('0x60')];}}for(var _0x5b85e2 in _0x3315e8){if(!_0x1a8a49['hasOwnProperty'](_0x3315e8[_0x5b85e2])){_0x1a8a49[_0x3315e8[_0x5b85e2]]=null;}}_0x1c7e28[_0x213b('0x61')](_0x1a8a49);}return _0x1c7e28;}})[_0x213b('0x20')](function(_0x5d8744){if(!_[_0x213b('0x62')](_0x5d8744)){var _0x428164=toCsv(_0x5d8744);var _0x35fc51=Date[_0x213b('0x63')]();fs[_0x213b('0x64')](util[_0x213b('0x5e')](_0x213b('0x65'),_0x3bc4e8['params']['id'],_0x35fc51),_0x428164);_0x2a28ee[_0x213b('0x66')](_0x213b('0x67'),_0x213b('0x68')+util['format'](_0x213b('0x69'),_0x3bc4e8[_0x213b('0x40')]['id'],_0x35fc51));_0x2a28ee[_0x213b('0x66')]('Content-type',_0x213b('0x6a'));return _0x2a28ee['download'](util[_0x213b('0x5e')](_0x213b('0x65'),_0x3bc4e8[_0x213b('0x40')]['id'],_0x35fc51));}else{return _0x2a28ee[_0x213b('0x21')](0xcc);}})[_0x213b('0x3f')](handleError(_0x2a28ee,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 202fda4..d4c8b2d 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 _0x5060=['util','../../config/logger','api','moment','bluebird','request-promise','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x2438b6,_0x842fd7){var _0x30bc8d=function(_0x522ac5){while(--_0x522ac5){_0x2438b6['push'](_0x2438b6['shift']());}};_0x30bc8d(++_0x842fd7);}(_0x5060,0x13f));var _0x0506=function(_0x5a2f4b,_0x425b95){_0x5a2f4b=_0x5a2f4b-0x0;var _0x169410=_0x5060[_0x5a2f4b];return _0x169410;};'use strict';var _=require(_0x0506('0x0'));var util=require(_0x0506('0x1'));var logger=require(_0x0506('0x2'))(_0x0506('0x3'));var moment=require(_0x0506('0x4'));var BPromise=require(_0x0506('0x5'));var rp=require(_0x0506('0x6'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x558fda,_0x4c852d){return _0x558fda[_0x0506('0x7')](_0x0506('0x8'),attributes,{'tableName':_0x0506('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86d9=['lodash','../../config/logger','bluebird','request-promise','exports','JscriptyProject','jscripty_projects'];(function(_0x1338dc,_0x54f3b6){var _0x343339=function(_0x425bcb){while(--_0x425bcb){_0x1338dc['push'](_0x1338dc['shift']());}};_0x343339(++_0x54f3b6);}(_0x86d9,0x1ab));var _0x986d=function(_0x2c5312,_0x47ca29){_0x2c5312=_0x2c5312-0x0;var _0x5762ab=_0x86d9[_0x2c5312];return _0x5762ab;};'use strict';var _=require(_0x986d('0x0'));var util=require('util');var logger=require(_0x986d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x986d('0x2'));var rp=require(_0x986d('0x3'));var attributes=require('./jscriptyProject.attributes');module[_0x986d('0x4')]=function(_0x4f3134,_0x23fb56){return _0x4f3134['define'](_0x986d('0x5'),attributes,{'tableName':_0x986d('0x6'),'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 2e018d8..59c9bdb 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 _0xff35=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xff35,0x6f));var _0x5ff3=function(_0x1e6bdf,_0x377d56){_0x1e6bdf=_0x1e6bdf-0x0;var _0xf1d42f=_0xff35[_0x1e6bdf];return _0xf1d42f;};'use strict';var _=require('lodash');var util=require(_0x5ff3('0x0'));var moment=require(_0x5ff3('0x1'));var BPromise=require(_0x5ff3('0x2'));var rs=require(_0x5ff3('0x3'));var fs=require('fs');var db=require(_0x5ff3('0x4'))['db'];var utils=require(_0x5ff3('0x5'));var logger=require(_0x5ff3('0x6'))(_0x5ff3('0x7'));var config=require(_0x5ff3('0x8'));var jayson=require(_0x5ff3('0x9'));var client=jayson[_0x5ff3('0xa')][_0x5ff3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e7e0a,_0x3ccf25,_0x3546d4){return new BPromise(function(_0x4c6d7f,_0x581024){return client[_0x5ff3('0xc')](_0x4e7e0a,_0x3546d4)['then'](function(_0x3e2c61){logger[_0x5ff3('0xd')](_0x5ff3('0xe'),_0x3ccf25,_0x5ff3('0xf'));logger['debug'](_0x5ff3('0x10'),_0x3ccf25,_0x5ff3('0xf'),JSON['stringify'](_0x3e2c61));if(_0x3e2c61['error']){if(_0x3e2c61[_0x5ff3('0x11')][_0x5ff3('0x12')]===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x3ccf25,_0x3e2c61[_0x5ff3('0x11')][_0x5ff3('0x13')]);return _0x581024(_0x3e2c61['error'][_0x5ff3('0x13')]);}logger['error'](_0x5ff3('0xe'),_0x3ccf25,_0x3e2c61[_0x5ff3('0x11')]['message']);return _0x4c6d7f(_0x3e2c61['error'][_0x5ff3('0x13')]);}else{logger[_0x5ff3('0xd')](_0x5ff3('0xe'),_0x3ccf25,_0x5ff3('0xf'));_0x4c6d7f(_0x3e2c61[_0x5ff3('0x14')]['message']);}})[_0x5ff3('0x15')](function(_0x112c3f){logger['error'](_0x5ff3('0xe'),_0x3ccf25,_0x112c3f);_0x581024(_0x112c3f);});});} \ No newline at end of file +var _0xe6c4=['request\x20sent','stringify','code','error','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x2ed0c0,_0x27823f){var _0x4f1e3a=function(_0x15c7ee){while(--_0x15c7ee){_0x2ed0c0['push'](_0x2ed0c0['shift']());}};_0x4f1e3a(++_0x27823f);}(_0xe6c4,0x156));var _0x4e6c=function(_0x2682dd,_0x2aa36c){_0x2682dd=_0x2682dd-0x0;var _0x288410=_0xe6c4[_0x2682dd];return _0x288410;};'use strict';var _=require(_0x4e6c('0x0'));var util=require(_0x4e6c('0x1'));var moment=require('moment');var BPromise=require(_0x4e6c('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x4e6c('0x3'))['db'];var utils=require(_0x4e6c('0x4'));var logger=require(_0x4e6c('0x5'))(_0x4e6c('0x6'));var config=require('../../config/environment');var jayson=require(_0x4e6c('0x7'));var client=jayson[_0x4e6c('0x8')][_0x4e6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35d93f,_0x275c97,_0x24b741){return new BPromise(function(_0x20d078,_0x5c3155){return client[_0x4e6c('0xa')](_0x35d93f,_0x24b741)[_0x4e6c('0xb')](function(_0x463aac){logger[_0x4e6c('0xc')](_0x4e6c('0xd'),_0x275c97,'request\x20sent');logger['debug'](_0x4e6c('0xe'),_0x275c97,_0x4e6c('0xf'),JSON[_0x4e6c('0x10')](_0x463aac));if(_0x463aac['error']){if(_0x463aac['error'][_0x4e6c('0x11')]===0x1f4){logger[_0x4e6c('0x12')](_0x4e6c('0xd'),_0x275c97,_0x463aac[_0x4e6c('0x12')][_0x4e6c('0x13')]);return _0x5c3155(_0x463aac['error'][_0x4e6c('0x13')]);}logger[_0x4e6c('0x12')](_0x4e6c('0xd'),_0x275c97,_0x463aac[_0x4e6c('0x12')][_0x4e6c('0x13')]);return _0x20d078(_0x463aac[_0x4e6c('0x12')][_0x4e6c('0x13')]);}else{logger[_0x4e6c('0xc')](_0x4e6c('0xd'),_0x275c97,'request\x20sent');_0x20d078(_0x463aac['result'][_0x4e6c('0x13')]);}})[_0x4e6c('0x14')](function(_0x5f0f18){logger[_0x4e6c('0x12')](_0x4e6c('0xd'),_0x275c97,_0x5f0f18);_0x5c3155(_0x5f0f18);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 36f2668..657fe9d 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 _0x5cfe=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','describe','get','/:id','show','create','update','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5cfe,0x1b0));var _0xe5cf=function(_0x4387e9,_0x9765db){_0x4387e9=_0x4387e9-0x0;var _0x368592=_0x5cfe[_0x4387e9];return _0x368592;};'use strict';var multer=require(_0xe5cf('0x0'));var util=require(_0xe5cf('0x1'));var path=require(_0xe5cf('0x2'));var express=require(_0xe5cf('0x3'));var router=express[_0xe5cf('0x4')]();var auth=require(_0xe5cf('0x5'));var interaction=require(_0xe5cf('0x6'));var config=require(_0xe5cf('0x7'));var controller=require(_0xe5cf('0x8'));router['get']('/',auth[_0xe5cf('0x9')](),controller[_0xe5cf('0xa')]);router['get']('/describe',auth[_0xe5cf('0x9')](),controller[_0xe5cf('0xb')]);router[_0xe5cf('0xc')](_0xe5cf('0xd'),auth[_0xe5cf('0x9')](),controller[_0xe5cf('0xe')]);router['post']('/',auth[_0xe5cf('0x9')](),controller[_0xe5cf('0xf')]);router['put']('/:id',auth[_0xe5cf('0x9')](),controller[_0xe5cf('0x10')]);router['delete'](_0xe5cf('0xd'),auth[_0xe5cf('0x9')](),controller[_0xe5cf('0x11')]);module['exports']=router; \ No newline at end of file +var _0xadab=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xadab,0x1ca));var _0xbada=function(_0x40fbee,_0x268f74){_0x40fbee=_0x40fbee-0x0;var _0x1d93e8=_0xadab[_0x40fbee];return _0x1d93e8;};'use strict';var multer=require(_0xbada('0x0'));var util=require(_0xbada('0x1'));var path=require(_0xbada('0x2'));var express=require(_0xbada('0x3'));var router=express['Router']();var auth=require(_0xbada('0x4'));var interaction=require(_0xbada('0x5'));var config=require(_0xbada('0x6'));var controller=require(_0xbada('0x7'));router[_0xbada('0x8')]('/',auth[_0xbada('0x9')](),controller[_0xbada('0xa')]);router['get'](_0xbada('0xb'),auth[_0xbada('0x9')](),controller[_0xbada('0xc')]);router[_0xbada('0x8')](_0xbada('0xd'),auth[_0xbada('0x9')](),controller[_0xbada('0xe')]);router[_0xbada('0xf')]('/',auth['isAuthenticated'](),controller[_0xbada('0x10')]);router[_0xbada('0x11')]('/:id',auth[_0xbada('0x9')](),controller[_0xbada('0x12')]);router[_0xbada('0x13')](_0xbada('0xd'),auth[_0xbada('0x9')](),controller[_0xbada('0x14')]);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 579d0dd..6bc96f8 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 _0xe3ee=['STRING','TEXT'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xe3ee,0x116));var _0xee3e=function(_0x1b7ddf,_0x4e7611){_0x1b7ddf=_0x1b7ddf-0x0;var _0x3cd73d=_0xe3ee[_0x1b7ddf];return _0x3cd73d;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0xee3e('0x0')]},'answer':{'type':Sequelize[_0xee3e('0x1')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xee3e('0x0')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xee3e('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xee3e('0x0')]}}; \ No newline at end of file +var _0x9173=['sequelize','exports','TEXT','long','STRING'];(function(_0x3ecdce,_0x34a388){var _0x1cc2d5=function(_0x27156d){while(--_0x27156d){_0x3ecdce['push'](_0x3ecdce['shift']());}};_0x1cc2d5(++_0x34a388);}(_0x9173,0xb4));var _0x3917=function(_0x4c3ec8,_0x33eef9){_0x4c3ec8=_0x4c3ec8-0x0;var _0x5427be=_0x9173[_0x4c3ec8];return _0x5427be;};'use strict';var Sequelize=require(_0x3917('0x0'));module[_0x3917('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x3917('0x2')](_0x3917('0x3'))},'membername':{'type':Sequelize[_0x3917('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3917('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3917('0x4')]},'calleridnum':{'type':Sequelize[_0x3917('0x4')]},'questionId':{'type':Sequelize[_0x3917('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 093d112..74e7595 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 _0xb02e=['filters','intersection','attributes','model','fields','limit','order','sort','where','pick','add','day','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','length','merge','find','body','describe','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','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','JscriptyQuestionReport','keys','query','dateStart','dateEnd'];(function(_0x4c2048,_0xb965ec){var _0x44e267=function(_0x51b0eb){while(--_0x51b0eb){_0x4c2048['push'](_0x4c2048['shift']());}};_0x44e267(++_0xb965ec);}(_0xb02e,0x1ee));var _0xeb02=function(_0x582858,_0x57804c){_0x582858=_0x582858-0x0;var _0x142f1a=_0xb02e[_0x582858];return _0x142f1a;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb02('0x0'));var BPromise=require(_0xeb02('0x1'));var Mustache=require(_0xeb02('0x2'));var util=require(_0xeb02('0x3'));var path=require(_0xeb02('0x4'));var sox=require(_0xeb02('0x5'));var csv=require(_0xeb02('0x6'));var ejs=require(_0xeb02('0x7'));var fs=require('fs');var _=require(_0xeb02('0x8'));var squel=require(_0xeb02('0x9'));var crypto=require(_0xeb02('0xa'));var jsforce=require(_0xeb02('0xb'));var deskjs=require(_0xeb02('0xc'));var toCsv=require(_0xeb02('0x6'));var querystring=require(_0xeb02('0xd'));var Papa=require(_0xeb02('0xe'));var qs=require(_0xeb02('0xf'));var logger=require(_0xeb02('0x10'))(_0xeb02('0x11'));var utils=require('../../config/utils');var config=require(_0xeb02('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55ab32,_0x4a4d87){_0x4a4d87=_0x4a4d87||0xcc;return function(_0x8d8137){if(_0x8d8137){return _0x55ab32[_0xeb02('0x13')](_0x4a4d87);}return _0x55ab32[_0xeb02('0x14')](_0x4a4d87)['end']();};}function respondWithResult(_0x479e2b,_0x2cf211){_0x2cf211=_0x2cf211||0xc8;return function(_0x39bfa0){if(_0x39bfa0){return _0x479e2b['status'](_0x2cf211)[_0xeb02('0x15')](_0x39bfa0);}};}function respondWithFilteredResult(_0x2c2356,_0x31fff8){return function(_0x40dd21){if(_0x40dd21){var _0x70198d=_0x40dd21[_0xeb02('0x16')],_0x5deb08=_0x31fff8[_0xeb02('0x17')],_0x40b20d=_0x31fff8[_0xeb02('0x17')]+_0x31fff8['limit'],_0x3aed18;if(_0x40b20d>=_0x70198d){_0x40b20d=_0x70198d;_0x3aed18=0xc8;}else{_0x3aed18=0xce;}_0x2c2356['status'](_0x3aed18);return _0x2c2356[_0xeb02('0x18')](_0xeb02('0x19'),_0x5deb08+'-'+_0x40b20d+'/'+_0x70198d)[_0xeb02('0x15')](_0x40dd21);}return null;};}function patchUpdates(_0x2866c4){return function(_0x49a342){try{jsonpatch[_0xeb02('0x1a')](_0x49a342,_0x2866c4,!![]);}catch(_0x5a56e4){return BPromise[_0xeb02('0x1b')](_0x5a56e4);}return _0x49a342[_0xeb02('0x1c')]();};}function saveUpdates(_0x505692,_0x4c3ad4){return function(_0x5a7e92){if(_0x5a7e92){return _0x5a7e92[_0xeb02('0x1d')](_0x505692)[_0xeb02('0x1e')](function(_0x3075a4){return _0x3075a4;});}return null;};}function removeEntity(_0x2c4435,_0x166c8e){return function(_0x3dd5c1){if(_0x3dd5c1){return _0x3dd5c1[_0xeb02('0x1f')]()[_0xeb02('0x1e')](function(){_0x2c4435[_0xeb02('0x14')](0xcc)[_0xeb02('0x20')]();});}};}function handleEntityNotFound(_0x3fdc25,_0x3fbc16){return function(_0x165b98){if(!_0x165b98){_0x3fdc25[_0xeb02('0x13')](0x194);}return _0x165b98;};}function handleError(_0x51800b,_0x3350ce){_0x3350ce=_0x3350ce||0x1f4;return function(_0x452a19){logger[_0xeb02('0x21')](_0x452a19[_0xeb02('0x22')]);if(_0x452a19[_0xeb02('0x23')]){delete _0x452a19[_0xeb02('0x23')];}_0x51800b['status'](_0x3350ce)['send'](_0x452a19);};}exports[_0xeb02('0x24')]=function(_0x5b0dda,_0x356b2d){var _0x48902e={},_0x56ed94={},_0x4bf486={'count':0x0,'rows':[]};var _0xd3f5f5=db[_0xeb02('0x25')]['rawAttributes'];_0x56ed94['model']=_[_0xeb02('0x26')](_0xd3f5f5);var _0x209c5b={'dateStart':_0x5b0dda[_0xeb02('0x27')][_0xeb02('0x28')],'dateEnd':_0x5b0dda[_0xeb02('0x27')][_0xeb02('0x29')]};delete _0x5b0dda[_0xeb02('0x27')][_0xeb02('0x28')];delete _0x5b0dda[_0xeb02('0x27')][_0xeb02('0x29')];_0x56ed94[_0xeb02('0x27')]=_['keys'](_0x5b0dda[_0xeb02('0x27')]);_0x56ed94[_0xeb02('0x2a')]=_[_0xeb02('0x2b')](_0x56ed94['model'],_0x56ed94[_0xeb02('0x27')]);_0x48902e[_0xeb02('0x2c')]=_[_0xeb02('0x2b')](_0x56ed94[_0xeb02('0x2d')],qs[_0xeb02('0x2e')](_0x5b0dda[_0xeb02('0x27')][_0xeb02('0x2e')]));_0x48902e[_0xeb02('0x2c')]=_0x48902e[_0xeb02('0x2c')]['length']?_0x48902e[_0xeb02('0x2c')]:_0x56ed94[_0xeb02('0x2d')];if(!_0x5b0dda[_0xeb02('0x27')]['hasOwnProperty']('nolimit')){_0x48902e['limit']=qs[_0xeb02('0x2f')](_0x5b0dda[_0xeb02('0x27')]['limit']);_0x48902e[_0xeb02('0x17')]=qs[_0xeb02('0x17')](_0x5b0dda[_0xeb02('0x27')]['offset']);}_0x48902e[_0xeb02('0x30')]=qs[_0xeb02('0x31')](_0x5b0dda['query']['sort']);_0x48902e[_0xeb02('0x32')]=qs[_0xeb02('0x2a')](_[_0xeb02('0x33')](_0x5b0dda[_0xeb02('0x27')],_0x56ed94[_0xeb02('0x2a')]));if(_0x209c5b[_0xeb02('0x28')]){if(_0x209c5b[_0xeb02('0x29')]){_0x209c5b[_0xeb02('0x29')]=moment(_0x209c5b[_0xeb02('0x29')])[_0xeb02('0x34')](0x1,_0xeb02('0x35'));}else{_0x209c5b[_0xeb02('0x29')]=moment(_0x209c5b[_0xeb02('0x28')])['add'](0x1,_0xeb02('0x35'));}_['merge'](_0x48902e['where'],{'createdAt':{'$gte':_0x209c5b[_0xeb02('0x28')],'$lte':_0x209c5b[_0xeb02('0x29')]}});}if(_0x5b0dda[_0xeb02('0x27')]['filter']){_0x48902e[_0xeb02('0x32')]=_['merge'](_0x48902e[_0xeb02('0x32')],{'$or':_['map'](_0x48902e[_0xeb02('0x2c')],function(_0x2df733){var _0x125000={};_0x125000[_0x2df733]={'$like':'%'+_0x5b0dda['query'][_0xeb02('0x36')]+'%'};return _0x125000;})});}_0x48902e=_['merge']({},_0x48902e,_0x5b0dda[_0xeb02('0x37')]);var _0x4b17d1={'where':_0x48902e[_0xeb02('0x32')]};return db[_0xeb02('0x25')][_0xeb02('0x16')](_0x4b17d1)[_0xeb02('0x1e')](function(_0x4c31e7){_0x4bf486[_0xeb02('0x16')]=_0x4c31e7;if(_0x5b0dda[_0xeb02('0x27')][_0xeb02('0x38')]){_0x48902e['include']=[{'all':!![]}];}return db[_0xeb02('0x25')][_0xeb02('0x39')](_0x48902e);})['then'](function(_0x2668d7){_0x4bf486[_0xeb02('0x3a')]=_0x2668d7;return _0x4bf486;})[_0xeb02('0x1e')](respondWithFilteredResult(_0x356b2d,_0x48902e))[_0xeb02('0x3b')](handleError(_0x356b2d,null));};exports['show']=function(_0x2412d9,_0x85f883){var _0x4d3aba={'raw':!![],'where':{'id':_0x2412d9[_0xeb02('0x3c')]['id']}},_0x2b913a={};_0x2b913a[_0xeb02('0x2d')]=_['keys'](db[_0xeb02('0x25')][_0xeb02('0x3d')]);_0x2b913a['query']=_['keys'](_0x2412d9[_0xeb02('0x27')]);_0x2b913a[_0xeb02('0x2a')]=_['intersection'](_0x2b913a[_0xeb02('0x2d')],_0x2b913a[_0xeb02('0x27')]);_0x4d3aba[_0xeb02('0x2c')]=_['intersection'](_0x2b913a[_0xeb02('0x2d')],qs[_0xeb02('0x2e')](_0x2412d9['query'][_0xeb02('0x2e')]));_0x4d3aba[_0xeb02('0x2c')]=_0x4d3aba[_0xeb02('0x2c')][_0xeb02('0x3e')]?_0x4d3aba[_0xeb02('0x2c')]:_0x2b913a[_0xeb02('0x2d')];if(_0x2412d9[_0xeb02('0x27')][_0xeb02('0x38')]){_0x4d3aba['include']=[{'all':!![]}];}_0x4d3aba=_[_0xeb02('0x3f')]({},_0x4d3aba,_0x2412d9['options']);return db[_0xeb02('0x25')][_0xeb02('0x40')](_0x4d3aba)['then'](handleEntityNotFound(_0x85f883,null))[_0xeb02('0x1e')](respondWithResult(_0x85f883,null))[_0xeb02('0x3b')](handleError(_0x85f883,null));};exports['create']=function(_0x341d7d,_0x74f69f){return db['JscriptyQuestionReport']['create'](_0x341d7d['body'],{})[_0xeb02('0x1e')](respondWithResult(_0x74f69f,0xc9))[_0xeb02('0x3b')](handleError(_0x74f69f,null));};exports['update']=function(_0x257c3d,_0x44b730){if(_0x257c3d[_0xeb02('0x41')]['id']){delete _0x257c3d[_0xeb02('0x41')]['id'];}return db[_0xeb02('0x25')][_0xeb02('0x40')]({'where':{'id':_0x257c3d[_0xeb02('0x3c')]['id']}})[_0xeb02('0x1e')](handleEntityNotFound(_0x44b730,null))[_0xeb02('0x1e')](saveUpdates(_0x257c3d[_0xeb02('0x41')],null))[_0xeb02('0x1e')](respondWithResult(_0x44b730,null))[_0xeb02('0x3b')](handleError(_0x44b730,null));};exports[_0xeb02('0x1f')]=function(_0x2583f5,_0x24722d){return db[_0xeb02('0x25')]['find']({'where':{'id':_0x2583f5[_0xeb02('0x3c')]['id']}})['then'](handleEntityNotFound(_0x24722d,null))[_0xeb02('0x1e')](removeEntity(_0x24722d,null))[_0xeb02('0x3b')](handleError(_0x24722d,null));};exports[_0xeb02('0x42')]=function(_0x2a9af4,_0x5a367b){return db[_0xeb02('0x25')]['describe']()[_0xeb02('0x1e')](respondWithResult(_0x5a367b,null))[_0xeb02('0x3b')](handleError(_0x5a367b,null));}; \ No newline at end of file +var _0x983d=['includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/environment','end','json','count','offset','limit','set','reject','save','update','then','destroy','status','sendStatus','error','name','send','index','JscriptyQuestionReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','options'];(function(_0xcf0913,_0x4f03bf){var _0x57e864=function(_0x1730ee){while(--_0x1730ee){_0xcf0913['push'](_0xcf0913['shift']());}};_0x57e864(++_0x4f03bf);}(_0x983d,0x1d9));var _0xd983=function(_0x27e3fa,_0x370e4a){_0x27e3fa=_0x27e3fa-0x0;var _0x3ba61b=_0x983d[_0x27e3fa];return _0x3ba61b;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xd983('0x0'));var moment=require(_0xd983('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd983('0x2'));var util=require(_0xd983('0x3'));var path=require(_0xd983('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd983('0x5'));var fs=require('fs');var _=require(_0xd983('0x6'));var squel=require(_0xd983('0x7'));var crypto=require(_0xd983('0x8'));var jsforce=require(_0xd983('0x9'));var deskjs=require(_0xd983('0xa'));var toCsv=require(_0xd983('0xb'));var querystring=require(_0xd983('0xc'));var Papa=require('papaparse');var qs=require(_0xd983('0xd'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd983('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59d9b1,_0x5ca311){_0x5ca311=_0x5ca311||0xcc;return function(_0x369197){if(_0x369197){return _0x59d9b1['sendStatus'](_0x5ca311);}return _0x59d9b1['status'](_0x5ca311)[_0xd983('0xf')]();};}function respondWithResult(_0x34e381,_0x1ad450){_0x1ad450=_0x1ad450||0xc8;return function(_0xb7adc0){if(_0xb7adc0){return _0x34e381['status'](_0x1ad450)[_0xd983('0x10')](_0xb7adc0);}};}function respondWithFilteredResult(_0x198ffd,_0x531941){return function(_0x370548){if(_0x370548){var _0x12d1ef=_0x370548[_0xd983('0x11')],_0x4e0856=_0x531941[_0xd983('0x12')],_0x297d0a=_0x531941[_0xd983('0x12')]+_0x531941[_0xd983('0x13')],_0x11035a;if(_0x297d0a>=_0x12d1ef){_0x297d0a=_0x12d1ef;_0x11035a=0xc8;}else{_0x11035a=0xce;}_0x198ffd['status'](_0x11035a);return _0x198ffd[_0xd983('0x14')]('Content-Range',_0x4e0856+'-'+_0x297d0a+'/'+_0x12d1ef)[_0xd983('0x10')](_0x370548);}return null;};}function patchUpdates(_0x3e137c){return function(_0x373ae){try{jsonpatch['apply'](_0x373ae,_0x3e137c,!![]);}catch(_0x3b99df){return BPromise[_0xd983('0x15')](_0x3b99df);}return _0x373ae[_0xd983('0x16')]();};}function saveUpdates(_0x3c614a,_0x342e90){return function(_0x1bc0d6){if(_0x1bc0d6){return _0x1bc0d6[_0xd983('0x17')](_0x3c614a)[_0xd983('0x18')](function(_0x16fad2){return _0x16fad2;});}return null;};}function removeEntity(_0xd40d43,_0x3dbfa5){return function(_0x262bf1){if(_0x262bf1){return _0x262bf1[_0xd983('0x19')]()[_0xd983('0x18')](function(){_0xd40d43[_0xd983('0x1a')](0xcc)[_0xd983('0xf')]();});}};}function handleEntityNotFound(_0x3dec66,_0xd33eba){return function(_0x427b27){if(!_0x427b27){_0x3dec66[_0xd983('0x1b')](0x194);}return _0x427b27;};}function handleError(_0x3069eb,_0x74e2cd){_0x74e2cd=_0x74e2cd||0x1f4;return function(_0x3d0d59){logger[_0xd983('0x1c')](_0x3d0d59['stack']);if(_0x3d0d59[_0xd983('0x1d')]){delete _0x3d0d59[_0xd983('0x1d')];}_0x3069eb[_0xd983('0x1a')](_0x74e2cd)[_0xd983('0x1e')](_0x3d0d59);};}exports[_0xd983('0x1f')]=function(_0x2b7dcc,_0xd5faf4){var _0x126e19={},_0x105188={},_0x4b1044={'count':0x0,'rows':[]};var _0x361c44=db[_0xd983('0x20')][_0xd983('0x21')];_0x105188[_0xd983('0x22')]=_[_0xd983('0x23')](_0x361c44);var _0x56faa6={'dateStart':_0x2b7dcc['query'][_0xd983('0x24')],'dateEnd':_0x2b7dcc[_0xd983('0x25')]['dateEnd']};delete _0x2b7dcc[_0xd983('0x25')]['dateStart'];delete _0x2b7dcc[_0xd983('0x25')][_0xd983('0x26')];_0x105188[_0xd983('0x25')]=_[_0xd983('0x23')](_0x2b7dcc[_0xd983('0x25')]);_0x105188[_0xd983('0x27')]=_[_0xd983('0x28')](_0x105188[_0xd983('0x22')],_0x105188[_0xd983('0x25')]);_0x126e19[_0xd983('0x29')]=_['intersection'](_0x105188[_0xd983('0x22')],qs[_0xd983('0x2a')](_0x2b7dcc[_0xd983('0x25')][_0xd983('0x2a')]));_0x126e19[_0xd983('0x29')]=_0x126e19[_0xd983('0x29')][_0xd983('0x2b')]?_0x126e19[_0xd983('0x29')]:_0x105188[_0xd983('0x22')];if(!_0x2b7dcc['query'][_0xd983('0x2c')]('nolimit')){_0x126e19[_0xd983('0x13')]=qs[_0xd983('0x13')](_0x2b7dcc[_0xd983('0x25')]['limit']);_0x126e19['offset']=qs[_0xd983('0x12')](_0x2b7dcc['query']['offset']);}_0x126e19[_0xd983('0x2d')]=qs[_0xd983('0x2e')](_0x2b7dcc[_0xd983('0x25')]['sort']);_0x126e19[_0xd983('0x2f')]=qs[_0xd983('0x27')](_[_0xd983('0x30')](_0x2b7dcc[_0xd983('0x25')],_0x105188[_0xd983('0x27')]));if(_0x56faa6['dateStart']){if(_0x56faa6[_0xd983('0x26')]){_0x56faa6['dateEnd']=moment(_0x56faa6[_0xd983('0x26')])[_0xd983('0x31')](0x1,'day');}else{_0x56faa6[_0xd983('0x26')]=moment(_0x56faa6['dateStart'])[_0xd983('0x31')](0x1,_0xd983('0x32'));}_[_0xd983('0x33')](_0x126e19[_0xd983('0x2f')],{'createdAt':{'$gte':_0x56faa6[_0xd983('0x24')],'$lte':_0x56faa6[_0xd983('0x26')]}});}if(_0x2b7dcc[_0xd983('0x25')][_0xd983('0x34')]){_0x126e19['where']=_['merge'](_0x126e19['where'],{'$or':_[_0xd983('0x35')](_0x126e19[_0xd983('0x29')],function(_0x235b8f){var _0x31e36e={};_0x31e36e[_0x235b8f]={'$like':'%'+_0x2b7dcc['query'][_0xd983('0x34')]+'%'};return _0x31e36e;})});}_0x126e19=_[_0xd983('0x33')]({},_0x126e19,_0x2b7dcc[_0xd983('0x36')]);var _0x102e86={'where':_0x126e19['where']};return db[_0xd983('0x20')][_0xd983('0x11')](_0x102e86)[_0xd983('0x18')](function(_0x37cc03){_0x4b1044['count']=_0x37cc03;if(_0x2b7dcc['query'][_0xd983('0x37')]){_0x126e19[_0xd983('0x38')]=[{'all':!![]}];}return db[_0xd983('0x20')][_0xd983('0x39')](_0x126e19);})[_0xd983('0x18')](function(_0x2636c4){_0x4b1044[_0xd983('0x3a')]=_0x2636c4;return _0x4b1044;})[_0xd983('0x18')](respondWithFilteredResult(_0xd5faf4,_0x126e19))[_0xd983('0x3b')](handleError(_0xd5faf4,null));};exports[_0xd983('0x3c')]=function(_0x4e7858,_0x51443b){var _0x1e4b1b={'raw':!![],'where':{'id':_0x4e7858['params']['id']}},_0x421953={};_0x421953[_0xd983('0x22')]=_[_0xd983('0x23')](db[_0xd983('0x20')][_0xd983('0x21')]);_0x421953[_0xd983('0x25')]=_[_0xd983('0x23')](_0x4e7858['query']);_0x421953[_0xd983('0x27')]=_['intersection'](_0x421953[_0xd983('0x22')],_0x421953[_0xd983('0x25')]);_0x1e4b1b['attributes']=_['intersection'](_0x421953['model'],qs[_0xd983('0x2a')](_0x4e7858[_0xd983('0x25')][_0xd983('0x2a')]));_0x1e4b1b['attributes']=_0x1e4b1b[_0xd983('0x29')]['length']?_0x1e4b1b[_0xd983('0x29')]:_0x421953[_0xd983('0x22')];if(_0x4e7858[_0xd983('0x25')][_0xd983('0x37')]){_0x1e4b1b[_0xd983('0x38')]=[{'all':!![]}];}_0x1e4b1b=_[_0xd983('0x33')]({},_0x1e4b1b,_0x4e7858['options']);return db[_0xd983('0x20')][_0xd983('0x3d')](_0x1e4b1b)[_0xd983('0x18')](handleEntityNotFound(_0x51443b,null))['then'](respondWithResult(_0x51443b,null))['catch'](handleError(_0x51443b,null));};exports[_0xd983('0x3e')]=function(_0x584632,_0x2677b4){return db[_0xd983('0x20')][_0xd983('0x3e')](_0x584632[_0xd983('0x3f')],{})[_0xd983('0x18')](respondWithResult(_0x2677b4,0xc9))[_0xd983('0x3b')](handleError(_0x2677b4,null));};exports['update']=function(_0x3178a6,_0x3a1c22){if(_0x3178a6[_0xd983('0x3f')]['id']){delete _0x3178a6[_0xd983('0x3f')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x3178a6[_0xd983('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a1c22,null))[_0xd983('0x18')](saveUpdates(_0x3178a6[_0xd983('0x3f')],null))['then'](respondWithResult(_0x3a1c22,null))[_0xd983('0x3b')](handleError(_0x3a1c22,null));};exports[_0xd983('0x19')]=function(_0x5e7b83,_0xee20e){return db[_0xd983('0x20')][_0xd983('0x3d')]({'where':{'id':_0x5e7b83[_0xd983('0x40')]['id']}})[_0xd983('0x18')](handleEntityNotFound(_0xee20e,null))[_0xd983('0x18')](removeEntity(_0xee20e,null))['catch'](handleError(_0xee20e,null));};exports[_0xd983('0x41')]=function(_0x4080a0,_0x4d32ea){return db['JscriptyQuestionReport']['describe']()[_0xd983('0x18')](respondWithResult(_0x4d32ea,null))['catch'](handleError(_0x4d32ea,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a115ad5..0a99cb9 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 _0x4c5a=['lodash','util','api','moment','request-promise','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x2b1ed5,_0x3933ba){var _0x3bcbbe=function(_0x1bbdb2){while(--_0x1bbdb2){_0x2b1ed5['push'](_0x2b1ed5['shift']());}};_0x3bcbbe(++_0x3933ba);}(_0x4c5a,0x1c0));var _0xa4c5=function(_0x5d115e,_0x35ce96){_0x5d115e=_0x5d115e-0x0;var _0x420939=_0x4c5a[_0x5d115e];return _0x420939;};'use strict';var _=require(_0xa4c5('0x0'));var util=require(_0xa4c5('0x1'));var logger=require('../../config/logger')(_0xa4c5('0x2'));var moment=require(_0xa4c5('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4c5('0x4'));var attributes=require(_0xa4c5('0x5'));module['exports']=function(_0x34c8b6,_0x50e1f7){return _0x34c8b6['define'](_0xa4c5('0x6'),attributes,{'tableName':_0xa4c5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0276=['api','moment','bluebird','request-promise','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0276,0x15c));var _0x6027=function(_0x3ad6bd,_0x4aef2c){_0x3ad6bd=_0x3ad6bd-0x0;var _0x27f188=_0x0276[_0x3ad6bd];return _0x27f188;};'use strict';var _=require(_0x6027('0x0'));var util=require('util');var logger=require(_0x6027('0x1'))(_0x6027('0x2'));var moment=require(_0x6027('0x3'));var BPromise=require(_0x6027('0x4'));var rp=require(_0x6027('0x5'));var attributes=require(_0x6027('0x6'));module[_0x6027('0x7')]=function(_0x457a9b,_0x53f7a9){return _0x457a9b[_0x6027('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0x6027('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 969c16d..5ebc7fc 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 _0x7e94=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x51bfa7,_0x51c8e0){var _0x1cf7ae=function(_0x5e5625){while(--_0x5e5625){_0x51bfa7['push'](_0x51bfa7['shift']());}};_0x1cf7ae(++_0x51c8e0);}(_0x7e94,0x72));var _0x47e9=function(_0x17d7ef,_0x5ee51b){_0x17d7ef=_0x17d7ef-0x0;var _0x238160=_0x7e94[_0x17d7ef];return _0x238160;};'use strict';var _=require(_0x47e9('0x0'));var util=require(_0x47e9('0x1'));var moment=require(_0x47e9('0x2'));var BPromise=require(_0x47e9('0x3'));var rs=require(_0x47e9('0x4'));var fs=require('fs');var db=require(_0x47e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47e9('0x6'))(_0x47e9('0x7'));var config=require(_0x47e9('0x8'));var jayson=require(_0x47e9('0x9'));var client=jayson[_0x47e9('0xa')][_0x47e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x455375,_0x38e5ec,_0x4670c9){return new BPromise(function(_0x1404c1,_0x257afc){return client['request'](_0x455375,_0x4670c9)['then'](function(_0x228482){logger[_0x47e9('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x38e5ec,'request\x20sent');logger[_0x47e9('0xd')](_0x47e9('0xe'),_0x38e5ec,_0x47e9('0xf'),JSON[_0x47e9('0x10')](_0x228482));if(_0x228482['error']){if(_0x228482[_0x47e9('0x11')][_0x47e9('0x12')]===0x1f4){logger[_0x47e9('0x11')](_0x47e9('0x13'),_0x38e5ec,_0x228482[_0x47e9('0x11')]['message']);return _0x257afc(_0x228482[_0x47e9('0x11')][_0x47e9('0x14')]);}logger[_0x47e9('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x38e5ec,_0x228482[_0x47e9('0x11')][_0x47e9('0x14')]);return _0x1404c1(_0x228482[_0x47e9('0x11')][_0x47e9('0x14')]);}else{logger['info'](_0x47e9('0x13'),_0x38e5ec,_0x47e9('0xf'));_0x1404c1(_0x228482[_0x47e9('0x15')][_0x47e9('0x14')]);}})[_0x47e9('0x16')](function(_0x555157){logger[_0x47e9('0x11')](_0x47e9('0x13'),_0x38e5ec,_0x555157);_0x257afc(_0x555157);});});} \ No newline at end of file +var _0x6169=['http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x416bdd,_0x446ba1){var _0x14873e=function(_0x5c09a1){while(--_0x5c09a1){_0x416bdd['push'](_0x416bdd['shift']());}};_0x14873e(++_0x446ba1);}(_0x6169,0xb4));var _0x9616=function(_0x224f10,_0xc63f79){_0x224f10=_0x224f10-0x0;var _0x472951=_0x6169[_0x224f10];return _0x472951;};'use strict';var _=require(_0x9616('0x0'));var util=require(_0x9616('0x1'));var moment=require(_0x9616('0x2'));var BPromise=require(_0x9616('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x9616('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9616('0x5'))(_0x9616('0x6'));var config=require(_0x9616('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9616('0x8')][_0x9616('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47ddb5,_0x3e0026,_0x29aa2b){return new BPromise(function(_0x25395c,_0x9fcfcd){return client['request'](_0x47ddb5,_0x29aa2b)[_0x9616('0xa')](function(_0x2a7373){logger[_0x9616('0xb')](_0x9616('0xc'),_0x3e0026,_0x9616('0xd'));logger[_0x9616('0xe')](_0x9616('0xf'),_0x3e0026,_0x9616('0xd'),JSON[_0x9616('0x10')](_0x2a7373));if(_0x2a7373[_0x9616('0x11')]){if(_0x2a7373[_0x9616('0x11')][_0x9616('0x12')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3e0026,_0x2a7373['error'][_0x9616('0x13')]);return _0x9fcfcd(_0x2a7373[_0x9616('0x11')][_0x9616('0x13')]);}logger[_0x9616('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3e0026,_0x2a7373[_0x9616('0x11')][_0x9616('0x13')]);return _0x25395c(_0x2a7373['error']['message']);}else{logger['info'](_0x9616('0xc'),_0x3e0026,'request\x20sent');_0x25395c(_0x2a7373['result'][_0x9616('0x13')]);}})[_0x9616('0x14')](function(_0x3571fb){logger[_0x9616('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3e0026,_0x3571fb);_0x9fcfcd(_0x3571fb);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9df2d26..1811108 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 _0x6949=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','getQuestions','post','put','update','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6949,0x18e));var _0x9694=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x6949[_0x55c485];return _0x6bb521;};'use strict';var multer=require(_0x9694('0x0'));var util=require(_0x9694('0x1'));var path=require(_0x9694('0x2'));var express=require(_0x9694('0x3'));var router=express[_0x9694('0x4')]();var auth=require(_0x9694('0x5'));var interaction=require(_0x9694('0x6'));var config=require(_0x9694('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x9694('0x8')]('/',auth[_0x9694('0x9')](),controller[_0x9694('0xa')]);router[_0x9694('0x8')](_0x9694('0xb'),auth[_0x9694('0x9')](),controller['describe']);router[_0x9694('0x8')](_0x9694('0xc'),auth[_0x9694('0x9')](),controller[_0x9694('0xd')]);router['get'](_0x9694('0xe'),auth['isAuthenticated'](),controller[_0x9694('0xf')]);router[_0x9694('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9694('0x11')](_0x9694('0xc'),auth[_0x9694('0x9')](),controller[_0x9694('0x12')]);router[_0x9694('0x13')](_0x9694('0xc'),auth[_0x9694('0x9')](),controller[_0x9694('0x14')]);module[_0x9694('0x15')]=router; \ No newline at end of file +var _0xf46d=['put','update','delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions','post'];(function(_0x53f581,_0x4319b4){var _0x49c7eb=function(_0x10e4f7){while(--_0x10e4f7){_0x53f581['push'](_0x53f581['shift']());}};_0x49c7eb(++_0x4319b4);}(_0xf46d,0xb7));var _0xdf46=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xf46d[_0x35f7f5];return _0x5567a4;};'use strict';var multer=require(_0xdf46('0x0'));var util=require(_0xdf46('0x1'));var path=require('path');var express=require(_0xdf46('0x2'));var router=express[_0xdf46('0x3')]();var auth=require(_0xdf46('0x4'));var interaction=require(_0xdf46('0x5'));var config=require(_0xdf46('0x6'));var controller=require(_0xdf46('0x7'));router[_0xdf46('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf46('0x9')]);router[_0xdf46('0x8')](_0xdf46('0xa'),auth[_0xdf46('0xb')](),controller[_0xdf46('0xc')]);router[_0xdf46('0x8')](_0xdf46('0xd'),auth[_0xdf46('0xb')](),controller[_0xdf46('0xe')]);router[_0xdf46('0x8')](_0xdf46('0xf'),auth['isAuthenticated'](),controller['getQuestions']);router[_0xdf46('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdf46('0x11')](_0xdf46('0xd'),auth[_0xdf46('0xb')](),controller[_0xdf46('0x12')]);router[_0xdf46('0x13')]('/:id',auth[_0xdf46('0xb')](),controller['destroy']);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 8eb3ef5..08ab438 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 _0x5293=['DATE','STRING','BOOLEAN','moment','exports','setDataValue','starttime','endtime','format'];(function(_0x43b20e,_0x2d421a){var _0x4a308d=function(_0x46f2b5){while(--_0x46f2b5){_0x43b20e['push'](_0x43b20e['shift']());}};_0x4a308d(++_0x2d421a);}(_0x5293,0xb7));var _0x3529=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x5293[_0xb0f7c3];return _0x28ea68;};'use strict';var moment=require(_0x3529('0x0'));var Sequelize=require('sequelize');module[_0x3529('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0xba8c0){this[_0x3529('0x2')](_0x3529('0x3'),_0xba8c0);this[_0x3529('0x2')](_0x3529('0x4'),moment()[_0x3529('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x3529('0x6')]},'membername':{'type':Sequelize[_0x3529('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3529('0x7')]},'uniqueid':{'type':Sequelize[_0x3529('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x3529('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xc75f=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','setDataValue','starttime','endtime','format'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xc75f,0xf6));var _0xfc75=function(_0x31ca97,_0x19165d){_0x31ca97=_0x31ca97-0x0;var _0x433fee=_0xc75f[_0x31ca97];return _0x433fee;};'use strict';var moment=require(_0xfc75('0x0'));var Sequelize=require(_0xfc75('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x288745){this[_0xfc75('0x2')](_0xfc75('0x3'),_0x288745);this[_0xfc75('0x2')](_0xfc75('0x4'),moment()[_0xfc75('0x5')](_0xfc75('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xfc75('0x7')]},'projectname':{'type':Sequelize[_0xfc75('0x7')]},'queue':{'type':Sequelize[_0xfc75('0x7')]},'uniqueid':{'type':Sequelize[_0xfc75('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xfc75('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 fd8c2ce..ec0a65d 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 _0xfdd9=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','JscriptySessionReport','includeAll','include','rows','catch','params','find','create','body','describe','findOne','JscriptyQuestionReport','findAll','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','keys','query','dateStart','dateEnd'];(function(_0x3935d6,_0x536f0d){var _0x3e35aa=function(_0x2a6b6d){while(--_0x2a6b6d){_0x3935d6['push'](_0x3935d6['shift']());}};_0x3e35aa(++_0x536f0d);}(_0xfdd9,0xf7));var _0x9fdd=function(_0x2ed357,_0x55dc3f){_0x2ed357=_0x2ed357-0x0;var _0x557338=_0xfdd9[_0x2ed357];return _0x557338;};'use strict';var jsonpatch=require(_0x9fdd('0x0'));var rp=require(_0x9fdd('0x1'));var moment=require('moment');var BPromise=require(_0x9fdd('0x2'));var Mustache=require(_0x9fdd('0x3'));var util=require('util');var path=require(_0x9fdd('0x4'));var sox=require(_0x9fdd('0x5'));var csv=require('to-csv');var ejs=require(_0x9fdd('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9fdd('0x7'));var jsforce=require(_0x9fdd('0x8'));var deskjs=require(_0x9fdd('0x9'));var toCsv=require('to-csv');var querystring=require(_0x9fdd('0xa'));var Papa=require(_0x9fdd('0xb'));var qs=require(_0x9fdd('0xc'));var logger=require('../../config/logger')(_0x9fdd('0xd'));var utils=require(_0x9fdd('0xe'));var config=require(_0x9fdd('0xf'));var db=require(_0x9fdd('0x10'))['db'];function respondWithStatusCode(_0x221a04,_0x43fa86){_0x43fa86=_0x43fa86||0xcc;return function(_0x4b6d43){if(_0x4b6d43){return _0x221a04[_0x9fdd('0x11')](_0x43fa86);}return _0x221a04['status'](_0x43fa86)[_0x9fdd('0x12')]();};}function respondWithResult(_0x4035cd,_0x4a1d3d){_0x4a1d3d=_0x4a1d3d||0xc8;return function(_0x1dbedd){if(_0x1dbedd){return _0x4035cd['status'](_0x4a1d3d)[_0x9fdd('0x13')](_0x1dbedd);}};}function respondWithFilteredResult(_0x5c9677,_0x4f48a9){return function(_0x2f6c1a){if(_0x2f6c1a){var _0x4e15fa=_0x2f6c1a[_0x9fdd('0x14')],_0x498102=_0x4f48a9[_0x9fdd('0x15')],_0xf465e4=_0x4f48a9[_0x9fdd('0x15')]+_0x4f48a9[_0x9fdd('0x16')],_0x341894;if(_0xf465e4>=_0x4e15fa){_0xf465e4=_0x4e15fa;_0x341894=0xc8;}else{_0x341894=0xce;}_0x5c9677[_0x9fdd('0x17')](_0x341894);return _0x5c9677['set'](_0x9fdd('0x18'),_0x498102+'-'+_0xf465e4+'/'+_0x4e15fa)[_0x9fdd('0x13')](_0x2f6c1a);}return null;};}function patchUpdates(_0x3d23e7){return function(_0x39474c){try{jsonpatch[_0x9fdd('0x19')](_0x39474c,_0x3d23e7,!![]);}catch(_0x97c88b){return BPromise[_0x9fdd('0x1a')](_0x97c88b);}return _0x39474c[_0x9fdd('0x1b')]();};}function saveUpdates(_0x466a41,_0x11216b){return function(_0x14dc66){if(_0x14dc66){return _0x14dc66[_0x9fdd('0x1c')](_0x466a41)[_0x9fdd('0x1d')](function(_0x2b308f){return _0x2b308f;});}return null;};}function removeEntity(_0x51d86f,_0xf2648b){return function(_0x4a4e34){if(_0x4a4e34){return _0x4a4e34[_0x9fdd('0x1e')]()['then'](function(){_0x51d86f[_0x9fdd('0x17')](0xcc)[_0x9fdd('0x12')]();});}};}function handleEntityNotFound(_0x47a373,_0x5de70e){return function(_0xf1dea8){if(!_0xf1dea8){_0x47a373[_0x9fdd('0x11')](0x194);}return _0xf1dea8;};}function handleError(_0x846c6d,_0x5a393e){_0x5a393e=_0x5a393e||0x1f4;return function(_0x53a32b){logger[_0x9fdd('0x1f')](_0x53a32b[_0x9fdd('0x20')]);if(_0x53a32b[_0x9fdd('0x21')]){delete _0x53a32b[_0x9fdd('0x21')];}_0x846c6d[_0x9fdd('0x17')](_0x5a393e)[_0x9fdd('0x22')](_0x53a32b);};}exports[_0x9fdd('0x23')]=function(_0x557445,_0x4a504d){var _0x49b24b={},_0x4694ca={},_0x5eec0a={'count':0x0,'rows':[]};var _0x45f4ba=db['JscriptySessionReport'][_0x9fdd('0x24')];_0x4694ca['model']=_[_0x9fdd('0x25')](_0x45f4ba);var _0x4730f1={'dateStart':_0x557445[_0x9fdd('0x26')][_0x9fdd('0x27')],'dateEnd':_0x557445[_0x9fdd('0x26')][_0x9fdd('0x28')]};delete _0x557445[_0x9fdd('0x26')]['dateStart'];delete _0x557445[_0x9fdd('0x26')][_0x9fdd('0x28')];_0x4694ca[_0x9fdd('0x26')]=_['keys'](_0x557445[_0x9fdd('0x26')]);_0x4694ca[_0x9fdd('0x29')]=_[_0x9fdd('0x2a')](_0x4694ca[_0x9fdd('0x2b')],_0x4694ca['query']);_0x49b24b[_0x9fdd('0x2c')]=_['intersection'](_0x4694ca[_0x9fdd('0x2b')],qs[_0x9fdd('0x2d')](_0x557445[_0x9fdd('0x26')][_0x9fdd('0x2d')]));_0x49b24b[_0x9fdd('0x2c')]=_0x49b24b['attributes'][_0x9fdd('0x2e')]?_0x49b24b[_0x9fdd('0x2c')]:_0x4694ca[_0x9fdd('0x2b')];if(!_0x557445[_0x9fdd('0x26')][_0x9fdd('0x2f')](_0x9fdd('0x30'))){_0x49b24b[_0x9fdd('0x16')]=qs['limit'](_0x557445[_0x9fdd('0x26')]['limit']);_0x49b24b[_0x9fdd('0x15')]=qs[_0x9fdd('0x15')](_0x557445[_0x9fdd('0x26')][_0x9fdd('0x15')]);}_0x49b24b[_0x9fdd('0x31')]=qs['sort'](_0x557445[_0x9fdd('0x26')][_0x9fdd('0x32')]);_0x49b24b[_0x9fdd('0x33')]=qs[_0x9fdd('0x29')](_[_0x9fdd('0x34')](_0x557445[_0x9fdd('0x26')],_0x4694ca[_0x9fdd('0x29')]));if(_0x4730f1['dateStart']){if(_0x4730f1[_0x9fdd('0x28')]){_0x4730f1[_0x9fdd('0x28')]=moment(_0x4730f1[_0x9fdd('0x28')])['add'](0x1,'day');}else{_0x4730f1[_0x9fdd('0x28')]=moment(_0x4730f1[_0x9fdd('0x27')])[_0x9fdd('0x35')](0x1,_0x9fdd('0x36'));}_[_0x9fdd('0x37')](_0x49b24b['where'],{'createdAt':{'$gte':_0x4730f1['dateStart'],'$lte':_0x4730f1[_0x9fdd('0x28')]}});}if(_0x557445[_0x9fdd('0x26')][_0x9fdd('0x38')]){_0x49b24b[_0x9fdd('0x33')]=_['merge'](_0x49b24b[_0x9fdd('0x33')],{'$or':_[_0x9fdd('0x39')](_0x49b24b[_0x9fdd('0x2c')],function(_0x1530b8){var _0x39eff0={};_0x39eff0[_0x1530b8]={'$like':'%'+_0x557445[_0x9fdd('0x26')][_0x9fdd('0x38')]+'%'};return _0x39eff0;})});}_0x49b24b=_[_0x9fdd('0x37')]({},_0x49b24b,_0x557445[_0x9fdd('0x3a')]);var _0x5ae1d9={'where':_0x49b24b['where']};return db[_0x9fdd('0x3b')][_0x9fdd('0x14')](_0x5ae1d9)[_0x9fdd('0x1d')](function(_0x406271){_0x5eec0a['count']=_0x406271;if(_0x557445[_0x9fdd('0x26')][_0x9fdd('0x3c')]){_0x49b24b[_0x9fdd('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x49b24b);})[_0x9fdd('0x1d')](function(_0x3588c5){_0x5eec0a[_0x9fdd('0x3e')]=_0x3588c5;return _0x5eec0a;})['then'](respondWithFilteredResult(_0x4a504d,_0x49b24b))[_0x9fdd('0x3f')](handleError(_0x4a504d,null));};exports['show']=function(_0x269f4c,_0x11f803){var _0x206088={'raw':!![],'where':{'id':_0x269f4c[_0x9fdd('0x40')]['id']}},_0x3f8dbd={};_0x3f8dbd['model']=_[_0x9fdd('0x25')](db['JscriptySessionReport'][_0x9fdd('0x24')]);_0x3f8dbd[_0x9fdd('0x26')]=_[_0x9fdd('0x25')](_0x269f4c[_0x9fdd('0x26')]);_0x3f8dbd[_0x9fdd('0x29')]=_[_0x9fdd('0x2a')](_0x3f8dbd['model'],_0x3f8dbd['query']);_0x206088[_0x9fdd('0x2c')]=_['intersection'](_0x3f8dbd[_0x9fdd('0x2b')],qs[_0x9fdd('0x2d')](_0x269f4c[_0x9fdd('0x26')][_0x9fdd('0x2d')]));_0x206088[_0x9fdd('0x2c')]=_0x206088[_0x9fdd('0x2c')][_0x9fdd('0x2e')]?_0x206088[_0x9fdd('0x2c')]:_0x3f8dbd[_0x9fdd('0x2b')];if(_0x269f4c[_0x9fdd('0x26')][_0x9fdd('0x3c')]){_0x206088['include']=[{'all':!![]}];}_0x206088=_[_0x9fdd('0x37')]({},_0x206088,_0x269f4c[_0x9fdd('0x3a')]);return db['JscriptySessionReport'][_0x9fdd('0x41')](_0x206088)['then'](handleEntityNotFound(_0x11f803,null))[_0x9fdd('0x1d')](respondWithResult(_0x11f803,null))[_0x9fdd('0x3f')](handleError(_0x11f803,null));};exports['create']=function(_0x3cd23f,_0x8f7cb8){return db['JscriptySessionReport'][_0x9fdd('0x42')](_0x3cd23f[_0x9fdd('0x43')],{})[_0x9fdd('0x1d')](respondWithResult(_0x8f7cb8,0xc9))['catch'](handleError(_0x8f7cb8,null));};exports[_0x9fdd('0x1c')]=function(_0x5170ed,_0x137700){if(_0x5170ed[_0x9fdd('0x43')]['id']){delete _0x5170ed[_0x9fdd('0x43')]['id'];}return db[_0x9fdd('0x3b')][_0x9fdd('0x41')]({'where':{'id':_0x5170ed[_0x9fdd('0x40')]['id']}})[_0x9fdd('0x1d')](handleEntityNotFound(_0x137700,null))[_0x9fdd('0x1d')](saveUpdates(_0x5170ed[_0x9fdd('0x43')],null))[_0x9fdd('0x1d')](respondWithResult(_0x137700,null))[_0x9fdd('0x3f')](handleError(_0x137700,null));};exports[_0x9fdd('0x1e')]=function(_0x1a2d4a,_0x410ced){return db['JscriptySessionReport'][_0x9fdd('0x41')]({'where':{'id':_0x1a2d4a[_0x9fdd('0x40')]['id']}})[_0x9fdd('0x1d')](handleEntityNotFound(_0x410ced,null))[_0x9fdd('0x1d')](removeEntity(_0x410ced,null))[_0x9fdd('0x3f')](handleError(_0x410ced,null));};exports[_0x9fdd('0x44')]=function(_0x206b17,_0x484452){return db[_0x9fdd('0x3b')][_0x9fdd('0x44')]()[_0x9fdd('0x1d')](respondWithResult(_0x484452,null))[_0x9fdd('0x3f')](handleError(_0x484452,null));};exports['getQuestions']=function(_0x416be9,_0x4d6845,_0x33baf0){var _0x135970={'raw':!![],'where':{}};var _0x25f60c={};var _0x7045e2={'count':0x0,'rows':[]};return db[_0x9fdd('0x3b')][_0x9fdd('0x45')]({'where':{'id':_0x416be9[_0x9fdd('0x40')]['id']}})[_0x9fdd('0x1d')](handleEntityNotFound(_0x4d6845,null))[_0x9fdd('0x1d')](function(_0x1031b2){if(_0x1031b2){_0x25f60c[_0x9fdd('0x2b')]=_['keys'](db['JscriptyQuestionReport'][_0x9fdd('0x24')]);_0x25f60c['query']=_[_0x9fdd('0x25')](_0x416be9['query']);_0x25f60c[_0x9fdd('0x29')]=_[_0x9fdd('0x2a')](_0x25f60c[_0x9fdd('0x2b')],_0x25f60c[_0x9fdd('0x26')]);_0x135970['attributes']=_[_0x9fdd('0x2a')](_0x25f60c[_0x9fdd('0x2b')],qs[_0x9fdd('0x2d')](_0x416be9[_0x9fdd('0x26')][_0x9fdd('0x2d')]));_0x135970[_0x9fdd('0x2c')]=_0x135970[_0x9fdd('0x2c')]['length']?_0x135970[_0x9fdd('0x2c')]:_0x25f60c['model'];if(!_0x416be9[_0x9fdd('0x26')][_0x9fdd('0x2f')](_0x9fdd('0x30'))){_0x135970[_0x9fdd('0x16')]=qs[_0x9fdd('0x16')](_0x416be9[_0x9fdd('0x26')]['limit']);_0x135970[_0x9fdd('0x15')]=qs[_0x9fdd('0x15')](_0x416be9[_0x9fdd('0x26')][_0x9fdd('0x15')]);}_0x135970['order']=qs[_0x9fdd('0x32')](_0x416be9[_0x9fdd('0x26')][_0x9fdd('0x32')]);_0x135970[_0x9fdd('0x33')]=qs[_0x9fdd('0x29')](_['pick'](_0x416be9[_0x9fdd('0x26')],_0x25f60c[_0x9fdd('0x29')]));_0x135970[_0x9fdd('0x33')]['SessionId']=_0x1031b2['id'];if(_0x416be9[_0x9fdd('0x26')][_0x9fdd('0x38')]){_0x135970[_0x9fdd('0x33')]=_[_0x9fdd('0x37')](_0x135970[_0x9fdd('0x33')],{'$or':_['map'](_0x135970[_0x9fdd('0x2c')],function(_0x177ff4){var _0x44e22c={};_0x44e22c[_0x177ff4]={'$like':'%'+_0x416be9[_0x9fdd('0x26')]['filter']+'%'};return _0x44e22c;})});}_0x135970=_[_0x9fdd('0x37')]({},_0x135970,_0x416be9[_0x9fdd('0x3a')]);return db[_0x9fdd('0x46')][_0x9fdd('0x14')]({'where':_0x135970[_0x9fdd('0x33')]})['then'](function(_0xc05122){_0x7045e2[_0x9fdd('0x14')]=_0xc05122;if(_0x416be9[_0x9fdd('0x26')][_0x9fdd('0x3c')]){_0x135970[_0x9fdd('0x3d')]=[{'all':!![]}];}return db[_0x9fdd('0x46')][_0x9fdd('0x47')](_0x135970);})[_0x9fdd('0x1d')](function(_0x3e130e){_0x7045e2[_0x9fdd('0x3e')]=_0x3e130e;return _0x7045e2;});}})[_0x9fdd('0x1d')](respondWithFilteredResult(_0x4d6845,_0x135970))[_0x9fdd('0x3f')](handleError(_0x4d6845,null));}; \ No newline at end of file +var _0xa55f=['nolimit','order','sort','day','merge','where','filter','map','options','includeAll','include','rows','catch','show','params','create','body','find','describe','getQuestions','findOne','pick','SessionId','findAll','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','JscriptySessionReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2f0fbd,_0x82827e){var _0x326f34=function(_0x3b3578){while(--_0x3b3578){_0x2f0fbd['push'](_0x2f0fbd['shift']());}};_0x326f34(++_0x82827e);}(_0xa55f,0x134));var _0xfa55=function(_0x4f144e,_0x75ab72){_0x4f144e=_0x4f144e-0x0;var _0x7735e8=_0xa55f[_0x4f144e];return _0x7735e8;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xfa55('0x0'));var moment=require(_0xfa55('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xfa55('0x2'));var util=require(_0xfa55('0x3'));var path=require('path');var sox=require(_0xfa55('0x4'));var csv=require(_0xfa55('0x5'));var ejs=require(_0xfa55('0x6'));var fs=require('fs');var _=require(_0xfa55('0x7'));var squel=require('squel');var crypto=require(_0xfa55('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa55('0x5'));var querystring=require(_0xfa55('0x9'));var Papa=require('papaparse');var qs=require(_0xfa55('0xa'));var logger=require(_0xfa55('0xb'))(_0xfa55('0xc'));var utils=require(_0xfa55('0xd'));var config=require(_0xfa55('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd40038,_0x5caedb){_0x5caedb=_0x5caedb||0xcc;return function(_0x429162){if(_0x429162){return _0xd40038[_0xfa55('0xf')](_0x5caedb);}return _0xd40038['status'](_0x5caedb)['end']();};}function respondWithResult(_0x535b41,_0x4ee337){_0x4ee337=_0x4ee337||0xc8;return function(_0x1ab700){if(_0x1ab700){return _0x535b41['status'](_0x4ee337)['json'](_0x1ab700);}};}function respondWithFilteredResult(_0x40d8fd,_0x168389){return function(_0x54ce2d){if(_0x54ce2d){var _0x6c015c=_0x54ce2d[_0xfa55('0x10')],_0x243da8=_0x168389[_0xfa55('0x11')],_0x99dc11=_0x168389['offset']+_0x168389[_0xfa55('0x12')],_0x37e022;if(_0x99dc11>=_0x6c015c){_0x99dc11=_0x6c015c;_0x37e022=0xc8;}else{_0x37e022=0xce;}_0x40d8fd[_0xfa55('0x13')](_0x37e022);return _0x40d8fd[_0xfa55('0x14')](_0xfa55('0x15'),_0x243da8+'-'+_0x99dc11+'/'+_0x6c015c)[_0xfa55('0x16')](_0x54ce2d);}return null;};}function patchUpdates(_0x5c22db){return function(_0x59a505){try{jsonpatch['apply'](_0x59a505,_0x5c22db,!![]);}catch(_0x5bc50d){return BPromise[_0xfa55('0x17')](_0x5bc50d);}return _0x59a505[_0xfa55('0x18')]();};}function saveUpdates(_0x4394fb,_0x3c14cb){return function(_0x2ebc0d){if(_0x2ebc0d){return _0x2ebc0d[_0xfa55('0x19')](_0x4394fb)[_0xfa55('0x1a')](function(_0x437d56){return _0x437d56;});}return null;};}function removeEntity(_0xc37bbb,_0x73799f){return function(_0x32f770){if(_0x32f770){return _0x32f770[_0xfa55('0x1b')]()[_0xfa55('0x1a')](function(){_0xc37bbb[_0xfa55('0x13')](0xcc)[_0xfa55('0x1c')]();});}};}function handleEntityNotFound(_0x9998d2,_0x18f325){return function(_0x1537e8){if(!_0x1537e8){_0x9998d2[_0xfa55('0xf')](0x194);}return _0x1537e8;};}function handleError(_0x185529,_0x2a9531){_0x2a9531=_0x2a9531||0x1f4;return function(_0x429b0b){logger[_0xfa55('0x1d')](_0x429b0b[_0xfa55('0x1e')]);if(_0x429b0b[_0xfa55('0x1f')]){delete _0x429b0b[_0xfa55('0x1f')];}_0x185529['status'](_0x2a9531)[_0xfa55('0x20')](_0x429b0b);};}exports[_0xfa55('0x21')]=function(_0x38c89b,_0x32ba79){var _0x19f498={},_0x31d6dd={},_0x4f1e05={'count':0x0,'rows':[]};var _0x377979=db[_0xfa55('0x22')][_0xfa55('0x23')];_0x31d6dd[_0xfa55('0x24')]=_[_0xfa55('0x25')](_0x377979);var _0x4acf6b={'dateStart':_0x38c89b[_0xfa55('0x26')][_0xfa55('0x27')],'dateEnd':_0x38c89b[_0xfa55('0x26')][_0xfa55('0x28')]};delete _0x38c89b[_0xfa55('0x26')][_0xfa55('0x27')];delete _0x38c89b[_0xfa55('0x26')][_0xfa55('0x28')];_0x31d6dd[_0xfa55('0x26')]=_[_0xfa55('0x25')](_0x38c89b[_0xfa55('0x26')]);_0x31d6dd[_0xfa55('0x29')]=_[_0xfa55('0x2a')](_0x31d6dd[_0xfa55('0x24')],_0x31d6dd[_0xfa55('0x26')]);_0x19f498[_0xfa55('0x2b')]=_[_0xfa55('0x2a')](_0x31d6dd['model'],qs[_0xfa55('0x2c')](_0x38c89b[_0xfa55('0x26')][_0xfa55('0x2c')]));_0x19f498[_0xfa55('0x2b')]=_0x19f498['attributes'][_0xfa55('0x2d')]?_0x19f498[_0xfa55('0x2b')]:_0x31d6dd[_0xfa55('0x24')];if(!_0x38c89b['query'][_0xfa55('0x2e')](_0xfa55('0x2f'))){_0x19f498[_0xfa55('0x12')]=qs[_0xfa55('0x12')](_0x38c89b[_0xfa55('0x26')][_0xfa55('0x12')]);_0x19f498['offset']=qs[_0xfa55('0x11')](_0x38c89b[_0xfa55('0x26')][_0xfa55('0x11')]);}_0x19f498[_0xfa55('0x30')]=qs[_0xfa55('0x31')](_0x38c89b['query']['sort']);_0x19f498['where']=qs[_0xfa55('0x29')](_['pick'](_0x38c89b['query'],_0x31d6dd[_0xfa55('0x29')]));if(_0x4acf6b['dateStart']){if(_0x4acf6b[_0xfa55('0x28')]){_0x4acf6b[_0xfa55('0x28')]=moment(_0x4acf6b['dateEnd'])['add'](0x1,_0xfa55('0x32'));}else{_0x4acf6b[_0xfa55('0x28')]=moment(_0x4acf6b[_0xfa55('0x27')])['add'](0x1,_0xfa55('0x32'));}_[_0xfa55('0x33')](_0x19f498[_0xfa55('0x34')],{'createdAt':{'$gte':_0x4acf6b[_0xfa55('0x27')],'$lte':_0x4acf6b[_0xfa55('0x28')]}});}if(_0x38c89b[_0xfa55('0x26')][_0xfa55('0x35')]){_0x19f498['where']=_[_0xfa55('0x33')](_0x19f498[_0xfa55('0x34')],{'$or':_[_0xfa55('0x36')](_0x19f498[_0xfa55('0x2b')],function(_0x34403a){var _0x3c5f50={};_0x3c5f50[_0x34403a]={'$like':'%'+_0x38c89b['query'][_0xfa55('0x35')]+'%'};return _0x3c5f50;})});}_0x19f498=_[_0xfa55('0x33')]({},_0x19f498,_0x38c89b[_0xfa55('0x37')]);var _0x29c17c={'where':_0x19f498[_0xfa55('0x34')]};return db[_0xfa55('0x22')][_0xfa55('0x10')](_0x29c17c)[_0xfa55('0x1a')](function(_0xc90c78){_0x4f1e05[_0xfa55('0x10')]=_0xc90c78;if(_0x38c89b['query'][_0xfa55('0x38')]){_0x19f498[_0xfa55('0x39')]=[{'all':!![]}];}return db[_0xfa55('0x22')]['findAll'](_0x19f498);})[_0xfa55('0x1a')](function(_0xef7fcb){_0x4f1e05[_0xfa55('0x3a')]=_0xef7fcb;return _0x4f1e05;})['then'](respondWithFilteredResult(_0x32ba79,_0x19f498))[_0xfa55('0x3b')](handleError(_0x32ba79,null));};exports[_0xfa55('0x3c')]=function(_0x54e76a,_0x41c03a){var _0xd15af2={'raw':!![],'where':{'id':_0x54e76a[_0xfa55('0x3d')]['id']}},_0x5baf70={};_0x5baf70['model']=_[_0xfa55('0x25')](db[_0xfa55('0x22')][_0xfa55('0x23')]);_0x5baf70['query']=_[_0xfa55('0x25')](_0x54e76a['query']);_0x5baf70[_0xfa55('0x29')]=_[_0xfa55('0x2a')](_0x5baf70['model'],_0x5baf70['query']);_0xd15af2[_0xfa55('0x2b')]=_[_0xfa55('0x2a')](_0x5baf70[_0xfa55('0x24')],qs[_0xfa55('0x2c')](_0x54e76a[_0xfa55('0x26')][_0xfa55('0x2c')]));_0xd15af2[_0xfa55('0x2b')]=_0xd15af2['attributes'][_0xfa55('0x2d')]?_0xd15af2[_0xfa55('0x2b')]:_0x5baf70[_0xfa55('0x24')];if(_0x54e76a['query']['includeAll']){_0xd15af2['include']=[{'all':!![]}];}_0xd15af2=_[_0xfa55('0x33')]({},_0xd15af2,_0x54e76a[_0xfa55('0x37')]);return db[_0xfa55('0x22')]['find'](_0xd15af2)[_0xfa55('0x1a')](handleEntityNotFound(_0x41c03a,null))['then'](respondWithResult(_0x41c03a,null))[_0xfa55('0x3b')](handleError(_0x41c03a,null));};exports['create']=function(_0x1d4992,_0xe1918e){return db[_0xfa55('0x22')][_0xfa55('0x3e')](_0x1d4992[_0xfa55('0x3f')],{})[_0xfa55('0x1a')](respondWithResult(_0xe1918e,0xc9))[_0xfa55('0x3b')](handleError(_0xe1918e,null));};exports['update']=function(_0x105e35,_0x45b0f0){if(_0x105e35['body']['id']){delete _0x105e35[_0xfa55('0x3f')]['id'];}return db[_0xfa55('0x22')][_0xfa55('0x40')]({'where':{'id':_0x105e35[_0xfa55('0x3d')]['id']}})[_0xfa55('0x1a')](handleEntityNotFound(_0x45b0f0,null))[_0xfa55('0x1a')](saveUpdates(_0x105e35[_0xfa55('0x3f')],null))[_0xfa55('0x1a')](respondWithResult(_0x45b0f0,null))[_0xfa55('0x3b')](handleError(_0x45b0f0,null));};exports[_0xfa55('0x1b')]=function(_0x5f1d2a,_0x624b3c){return db[_0xfa55('0x22')][_0xfa55('0x40')]({'where':{'id':_0x5f1d2a['params']['id']}})[_0xfa55('0x1a')](handleEntityNotFound(_0x624b3c,null))[_0xfa55('0x1a')](removeEntity(_0x624b3c,null))[_0xfa55('0x3b')](handleError(_0x624b3c,null));};exports[_0xfa55('0x41')]=function(_0x1f3bb1,_0x4b29c0){return db['JscriptySessionReport']['describe']()[_0xfa55('0x1a')](respondWithResult(_0x4b29c0,null))[_0xfa55('0x3b')](handleError(_0x4b29c0,null));};exports[_0xfa55('0x42')]=function(_0x18fdd3,_0x5150c8,_0x31b24e){var _0x17ef74={'raw':!![],'where':{}};var _0x54c112={};var _0x539d74={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xfa55('0x43')]({'where':{'id':_0x18fdd3[_0xfa55('0x3d')]['id']}})[_0xfa55('0x1a')](handleEntityNotFound(_0x5150c8,null))['then'](function(_0x1e4b4d){if(_0x1e4b4d){_0x54c112[_0xfa55('0x24')]=_['keys'](db['JscriptyQuestionReport'][_0xfa55('0x23')]);_0x54c112[_0xfa55('0x26')]=_[_0xfa55('0x25')](_0x18fdd3[_0xfa55('0x26')]);_0x54c112[_0xfa55('0x29')]=_[_0xfa55('0x2a')](_0x54c112[_0xfa55('0x24')],_0x54c112[_0xfa55('0x26')]);_0x17ef74[_0xfa55('0x2b')]=_[_0xfa55('0x2a')](_0x54c112[_0xfa55('0x24')],qs['fields'](_0x18fdd3[_0xfa55('0x26')][_0xfa55('0x2c')]));_0x17ef74['attributes']=_0x17ef74[_0xfa55('0x2b')][_0xfa55('0x2d')]?_0x17ef74[_0xfa55('0x2b')]:_0x54c112['model'];if(!_0x18fdd3[_0xfa55('0x26')][_0xfa55('0x2e')]('nolimit')){_0x17ef74[_0xfa55('0x12')]=qs[_0xfa55('0x12')](_0x18fdd3['query']['limit']);_0x17ef74['offset']=qs[_0xfa55('0x11')](_0x18fdd3[_0xfa55('0x26')]['offset']);}_0x17ef74[_0xfa55('0x30')]=qs[_0xfa55('0x31')](_0x18fdd3[_0xfa55('0x26')][_0xfa55('0x31')]);_0x17ef74['where']=qs[_0xfa55('0x29')](_[_0xfa55('0x44')](_0x18fdd3[_0xfa55('0x26')],_0x54c112[_0xfa55('0x29')]));_0x17ef74[_0xfa55('0x34')][_0xfa55('0x45')]=_0x1e4b4d['id'];if(_0x18fdd3[_0xfa55('0x26')][_0xfa55('0x35')]){_0x17ef74['where']=_[_0xfa55('0x33')](_0x17ef74[_0xfa55('0x34')],{'$or':_[_0xfa55('0x36')](_0x17ef74[_0xfa55('0x2b')],function(_0x433f1d){var _0x4f9a9e={};_0x4f9a9e[_0x433f1d]={'$like':'%'+_0x18fdd3[_0xfa55('0x26')]['filter']+'%'};return _0x4f9a9e;})});}_0x17ef74=_['merge']({},_0x17ef74,_0x18fdd3[_0xfa55('0x37')]);return db['JscriptyQuestionReport'][_0xfa55('0x10')]({'where':_0x17ef74[_0xfa55('0x34')]})[_0xfa55('0x1a')](function(_0x560f15){_0x539d74[_0xfa55('0x10')]=_0x560f15;if(_0x18fdd3['query']['includeAll']){_0x17ef74[_0xfa55('0x39')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xfa55('0x46')](_0x17ef74);})[_0xfa55('0x1a')](function(_0x71bff){_0x539d74[_0xfa55('0x3a')]=_0x71bff;return _0x539d74;});}})[_0xfa55('0x1a')](respondWithFilteredResult(_0x5150c8,_0x17ef74))['catch'](handleError(_0x5150c8,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7d17e49..c25cd11 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 _0xe6f7=['../../config/logger','api','request-promise','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe6f7,0xa8));var _0x7e6f=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0xe6f7[_0x55d58f];return _0x1ad6e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7e6f('0x0'))(_0x7e6f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e6f('0x2'));var attributes=require(_0x7e6f('0x3'));module[_0x7e6f('0x4')]=function(_0x28a667,_0x2fbacb){return _0x28a667[_0x7e6f('0x5')](_0x7e6f('0x6'),attributes,{'tableName':_0x7e6f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd13=['request-promise','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdd13,0x15d));var _0x3dd1=function(_0x295c11,_0x54b9e0){_0x295c11=_0x295c11-0x0;var _0xe56efc=_0xdd13[_0x295c11];return _0xe56efc;};'use strict';var _=require(_0x3dd1('0x0'));var util=require(_0x3dd1('0x1'));var logger=require('../../config/logger')(_0x3dd1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3dd1('0x3'));var attributes=require(_0x3dd1('0x4'));module['exports']=function(_0x21e8e7,_0x3bc3a3){return _0x21e8e7[_0x3dd1('0x5')](_0x3dd1('0x6'),attributes,{'tableName':_0x3dd1('0x7'),'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 4986719..1c68420 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 _0xaa1c=['message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1edc55,_0x31a585){var _0x2b7355=function(_0x503901){while(--_0x503901){_0x1edc55['push'](_0x1edc55['shift']());}};_0x2b7355(++_0x31a585);}(_0xaa1c,0xac));var _0xcaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xcaa1('0x0'));var util=require(_0xcaa1('0x1'));var moment=require(_0xcaa1('0x2'));var BPromise=require(_0xcaa1('0x3'));var rs=require(_0xcaa1('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcaa1('0x5'));var config=require(_0xcaa1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcaa1('0x7')][_0xcaa1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a4ab6,_0x2e87d6,_0x53f11c){return new BPromise(function(_0x266886,_0x119388){return client[_0xcaa1('0x9')](_0x3a4ab6,_0x53f11c)[_0xcaa1('0xa')](function(_0x21d46f){logger['info'](_0xcaa1('0xb'),_0x2e87d6,'request\x20sent');logger[_0xcaa1('0xc')](_0xcaa1('0xd'),_0x2e87d6,'request\x20sent',JSON[_0xcaa1('0xe')](_0x21d46f));if(_0x21d46f[_0xcaa1('0xf')]){if(_0x21d46f['error'][_0xcaa1('0x10')]===0x1f4){logger[_0xcaa1('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e87d6,_0x21d46f[_0xcaa1('0xf')]['message']);return _0x119388(_0x21d46f['error']['message']);}logger[_0xcaa1('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e87d6,_0x21d46f[_0xcaa1('0xf')][_0xcaa1('0x11')]);return _0x266886(_0x21d46f[_0xcaa1('0xf')][_0xcaa1('0x11')]);}else{logger[_0xcaa1('0x12')](_0xcaa1('0xb'),_0x2e87d6,_0xcaa1('0x13'));_0x266886(_0x21d46f[_0xcaa1('0x14')][_0xcaa1('0x11')]);}})['catch'](function(_0x5b6cc5){logger[_0xcaa1('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e87d6,_0x5b6cc5);_0x119388(_0x5b6cc5);});});} \ No newline at end of file +var _0xee38=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x542eec,_0x4c4356){var _0x188407=function(_0x203a5b){while(--_0x203a5b){_0x542eec['push'](_0x542eec['shift']());}};_0x188407(++_0x4c4356);}(_0xee38,0x11e));var _0x8ee3=function(_0x2ac3a0,_0x266a41){_0x2ac3a0=_0x2ac3a0-0x0;var _0x34d964=_0xee38[_0x2ac3a0];return _0x34d964;};'use strict';var _=require('lodash');var util=require(_0x8ee3('0x0'));var moment=require(_0x8ee3('0x1'));var BPromise=require(_0x8ee3('0x2'));var rs=require(_0x8ee3('0x3'));var fs=require('fs');var db=require(_0x8ee3('0x4'))['db'];var utils=require(_0x8ee3('0x5'));var logger=require(_0x8ee3('0x6'))(_0x8ee3('0x7'));var config=require(_0x8ee3('0x8'));var jayson=require(_0x8ee3('0x9'));var client=jayson[_0x8ee3('0xa')][_0x8ee3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x484e07,_0x2e3509,_0x24c4e9){return new BPromise(function(_0x4dc7a9,_0x3e2ec){return client[_0x8ee3('0xc')](_0x484e07,_0x24c4e9)[_0x8ee3('0xd')](function(_0x5aaba3){logger[_0x8ee3('0xe')](_0x8ee3('0xf'),_0x2e3509,_0x8ee3('0x10'));logger['debug'](_0x8ee3('0x11'),_0x2e3509,_0x8ee3('0x10'),JSON[_0x8ee3('0x12')](_0x5aaba3));if(_0x5aaba3[_0x8ee3('0x13')]){if(_0x5aaba3[_0x8ee3('0x13')]['code']===0x1f4){logger[_0x8ee3('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e3509,_0x5aaba3['error'][_0x8ee3('0x14')]);return _0x3e2ec(_0x5aaba3['error'][_0x8ee3('0x14')]);}logger[_0x8ee3('0x13')](_0x8ee3('0xf'),_0x2e3509,_0x5aaba3[_0x8ee3('0x13')][_0x8ee3('0x14')]);return _0x4dc7a9(_0x5aaba3[_0x8ee3('0x13')][_0x8ee3('0x14')]);}else{logger[_0x8ee3('0xe')](_0x8ee3('0xf'),_0x2e3509,_0x8ee3('0x10'));_0x4dc7a9(_0x5aaba3['result'][_0x8ee3('0x14')]);}})[_0x8ee3('0x15')](function(_0x2180ff){logger[_0x8ee3('0x13')](_0x8ee3('0xf'),_0x2e3509,_0x2180ff);_0x3e2ec(_0x2180ff);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 38009de..f0979b1 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 _0x120a=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','exports','multer'];(function(_0x4bf43e,_0x475adc){var _0x6a8f80=function(_0x17d6c8){while(--_0x17d6c8){_0x4bf43e['push'](_0x4bf43e['shift']());}};_0x6a8f80(++_0x475adc);}(_0x120a,0x6f));var _0xa120=function(_0x3108d9,_0xf08d6){_0x3108d9=_0x3108d9-0x0;var _0x1455e6=_0x120a[_0x3108d9];return _0x1455e6;};'use strict';var multer=require(_0xa120('0x0'));var util=require(_0xa120('0x1'));var path=require('path');var express=require(_0xa120('0x2'));var router=express[_0xa120('0x3')]();var auth=require(_0xa120('0x4'));var interaction=require(_0xa120('0x5'));var config=require(_0xa120('0x6'));var controller=require(_0xa120('0x7'));router[_0xa120('0x8')]('/',controller[_0xa120('0x9')]);router['put'](_0xa120('0xa'),auth[_0xa120('0xb')](),controller[_0xa120('0xc')]);module[_0xa120('0xd')]=router; \ No newline at end of file +var _0xf94d=['../../config/environment','index','/:id','isAuthenticated','update','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2cca89,_0x296e86){var _0x149dfa=function(_0x66048a){while(--_0x66048a){_0x2cca89['push'](_0x2cca89['shift']());}};_0x149dfa(++_0x296e86);}(_0xf94d,0xab));var _0xdf94=function(_0x472163,_0x389596){_0x472163=_0x472163-0x0;var _0x2e397=_0xf94d[_0x472163];return _0x2e397;};'use strict';var multer=require(_0xdf94('0x0'));var util=require(_0xdf94('0x1'));var path=require('path');var express=require('express');var router=express[_0xdf94('0x2')]();var auth=require(_0xdf94('0x3'));var interaction=require(_0xdf94('0x4'));var config=require(_0xdf94('0x5'));var controller=require('./license.controller');router['get']('/',controller[_0xdf94('0x6')]);router['put'](_0xdf94('0x7'),auth[_0xdf94('0x8')](),controller[_0xdf94('0x9')]);module[_0xdf94('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 33739d0..c1fc5d9 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 _0x50d7=['STRING','TEXT'];(function(_0x217a6f,_0x514d40){var _0x31a72f=function(_0x5c00b6){while(--_0x5c00b6){_0x217a6f['push'](_0x217a6f['shift']());}};_0x31a72f(++_0x514d40);}(_0x50d7,0x69));var _0x750d=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x50d7[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x750d('0x0')]},'data1':{'type':Sequelize[_0x750d('0x1')]},'data2':{'type':Sequelize[_0x750d('0x1')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x37e0=['exports','TEXT','STRING','INTEGER'];(function(_0x430f45,_0x281f21){var _0x10fb03=function(_0x4f4f66){while(--_0x4f4f66){_0x430f45['push'](_0x430f45['shift']());}};_0x10fb03(++_0x281f21);}(_0x37e0,0x1f0));var _0x037e=function(_0x315602,_0x5d5fa3){_0x315602=_0x315602-0x0;var _0x3747d0=_0x37e0[_0x315602];return _0x3747d0;};'use strict';var Sequelize=require('sequelize');module[_0x037e('0x0')]={'license':{'type':Sequelize[_0x037e('0x1')]},'data1':{'type':Sequelize[_0x037e('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x037e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index b6784ca..14a77ad 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 _0xf193=['request-promise','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','sendStatus','status','count','offset','set','Content-Range','json','save','update','then','destroy','end','error','name','send','../../config/license/util','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','key','demo','fast-json-patch'];(function(_0xb7f071,_0x34134a){var _0xdc2c6d=function(_0x58cdff){while(--_0x58cdff){_0xb7f071['push'](_0xb7f071['shift']());}};_0xdc2c6d(++_0x34134a);}(_0xf193,0x103));var _0x3f19=function(_0x2b012b,_0x463e28){_0x2b012b=_0x2b012b-0x0;var _0x32c4cf=_0xf193[_0x2b012b];return _0x32c4cf;};'use strict';var jsonpatch=require(_0x3f19('0x0'));var rp=require(_0x3f19('0x1'));var moment=require('moment');var BPromise=require(_0x3f19('0x2'));var Mustache=require('mustache');var util=require(_0x3f19('0x3'));var path=require(_0x3f19('0x4'));var sox=require('sox');var csv=require(_0x3f19('0x5'));var ejs=require(_0x3f19('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f19('0x7'));var crypto=require(_0x3f19('0x8'));var jsforce=require(_0x3f19('0x9'));var deskjs=require(_0x3f19('0xa'));var toCsv=require(_0x3f19('0x5'));var querystring=require(_0x3f19('0xb'));var Papa=require(_0x3f19('0xc'));var qs=require(_0x3f19('0xd'));var logger=require(_0x3f19('0xe'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12f44c,_0x1ef3d0){_0x1ef3d0=_0x1ef3d0||0xcc;return function(_0x2b474d){if(_0x2b474d){return _0x12f44c[_0x3f19('0xf')](_0x1ef3d0);}return _0x12f44c[_0x3f19('0x10')](_0x1ef3d0)['end']();};}function respondWithResult(_0x1aa373,_0x1230ff){_0x1230ff=_0x1230ff||0xc8;return function(_0x2a7dc7){if(_0x2a7dc7){return _0x1aa373[_0x3f19('0x10')](_0x1230ff)['json'](_0x2a7dc7);}};}function respondWithFilteredResult(_0x20fd2f,_0x228281){return function(_0x38c53e){if(_0x38c53e){var _0x35a588=_0x38c53e[_0x3f19('0x11')],_0x4025e4=_0x228281[_0x3f19('0x12')],_0x272ac2=_0x228281['offset']+_0x228281['limit'],_0x59b0f7;if(_0x272ac2>=_0x35a588){_0x272ac2=_0x35a588;_0x59b0f7=0xc8;}else{_0x59b0f7=0xce;}_0x20fd2f[_0x3f19('0x10')](_0x59b0f7);return _0x20fd2f[_0x3f19('0x13')](_0x3f19('0x14'),_0x4025e4+'-'+_0x272ac2+'/'+_0x35a588)[_0x3f19('0x15')](_0x38c53e);}return null;};}function patchUpdates(_0x41c836){return function(_0x35a7c9){try{jsonpatch['apply'](_0x35a7c9,_0x41c836,!![]);}catch(_0x51cf9d){return BPromise['reject'](_0x51cf9d);}return _0x35a7c9[_0x3f19('0x16')]();};}function saveUpdates(_0x424814,_0x50df16){return function(_0x51dc0c){if(_0x51dc0c){return _0x51dc0c[_0x3f19('0x17')](_0x424814)[_0x3f19('0x18')](function(_0x232d50){return _0x232d50;});}return null;};}function removeEntity(_0x2c18e9,_0x4fc69a){return function(_0x7c93f1){if(_0x7c93f1){return _0x7c93f1[_0x3f19('0x19')]()[_0x3f19('0x18')](function(){_0x2c18e9[_0x3f19('0x10')](0xcc)[_0x3f19('0x1a')]();});}};}function handleEntityNotFound(_0x47451c,_0x343222){return function(_0x439fdd){if(!_0x439fdd){_0x47451c[_0x3f19('0xf')](0x194);}return _0x439fdd;};}function handleError(_0x2cb707,_0x4833d3){_0x4833d3=_0x4833d3||0x1f4;return function(_0x28cc18){logger[_0x3f19('0x1b')](_0x28cc18['stack']);if(_0x28cc18[_0x3f19('0x1c')]){delete _0x28cc18[_0x3f19('0x1c')];}_0x2cb707['status'](_0x4833d3)[_0x3f19('0x1d')](_0x28cc18);};}var utilLicense=require(_0x3f19('0x1e'));exports['index']=function(_0x6e0414,_0x5ce0de){var _0x3f1182={'raw':!![],'where':{'id':0x1}},_0x15ebd9={};_0x15ebd9[_0x3f19('0x1f')]=_[_0x3f19('0x20')](db['License'][_0x3f19('0x21')]);_0x15ebd9[_0x3f19('0x22')]=_[_0x3f19('0x20')](_0x6e0414['query']);_0x15ebd9[_0x3f19('0x23')]=_['intersection'](_0x15ebd9[_0x3f19('0x1f')],_0x15ebd9[_0x3f19('0x22')]);_0x3f1182['attributes']=_[_0x3f19('0x24')](_0x15ebd9[_0x3f19('0x1f')],qs[_0x3f19('0x25')](_0x6e0414[_0x3f19('0x22')][_0x3f19('0x25')]));_0x3f1182[_0x3f19('0x26')]=_0x3f1182[_0x3f19('0x26')][_0x3f19('0x27')]?_0x3f1182[_0x3f19('0x26')]:_0x15ebd9[_0x3f19('0x1f')];_0x3f1182=_[_0x3f19('0x28')]({},_0x3f1182,_0x6e0414[_0x3f19('0x29')]);return utilLicense[_0x3f19('0x2a')](_0x3f1182)['then'](respondWithResult(_0x5ce0de,null))[_0x3f19('0x2b')](handleError(_0x5ce0de,null));};exports[_0x3f19('0x17')]=function(_0x248f5f,_0x2ac32f){if(_0x248f5f[_0x3f19('0x2c')]['id']){delete _0x248f5f[_0x3f19('0x2c')]['id'];}return db[_0x3f19('0x2d')][_0x3f19('0x2e')]({'where':{'id':_0x248f5f[_0x3f19('0x2f')]['id']}})[_0x3f19('0x18')](handleEntityNotFound(_0x2ac32f,null))[_0x3f19('0x18')](function(_0x2dfbd5){var _0x29b808=_0x2dfbd5[_0x3f19('0x30')]({'plain':!![]});return utilLicense[_0x3f19('0x31')](_0x29b808,_0x248f5f[_0x3f19('0x2c')][_0x3f19('0x32')]);})['then'](function(_0x2ceb4d){if(!_0x2ceb4d[_0x3f19('0x33')]){return saveUpdates(_0x248f5f[_0x3f19('0x2c')],null);}return _0x2ceb4d;})[_0x3f19('0x18')](respondWithResult(_0x2ac32f,null))[_0x3f19('0x2b')](handleError(_0x2ac32f,null));}; \ No newline at end of file +var _0x89c3=['offset','limit','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','merge','options','getLicense','update','body','License','params','get','key','demo','catch','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','json'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x89c3,0x12b));var _0x389c=function(_0x344acc,_0x3eeccf){_0x344acc=_0x344acc-0x0;var _0xe5be7e=_0x89c3[_0x344acc];return _0xe5be7e;};'use strict';var jsonpatch=require(_0x389c('0x0'));var rp=require(_0x389c('0x1'));var moment=require('moment');var BPromise=require(_0x389c('0x2'));var Mustache=require(_0x389c('0x3'));var util=require(_0x389c('0x4'));var path=require(_0x389c('0x5'));var sox=require(_0x389c('0x6'));var csv=require('to-csv');var ejs=require(_0x389c('0x7'));var fs=require('fs');var _=require(_0x389c('0x8'));var squel=require('squel');var crypto=require(_0x389c('0x9'));var jsforce=require(_0x389c('0xa'));var deskjs=require(_0x389c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x389c('0xc'));var Papa=require('papaparse');var qs=require(_0x389c('0xd'));var logger=require('../../config/logger')(_0x389c('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x389c('0xf'))['db'];function respondWithStatusCode(_0x5d2f27,_0x1c522b){_0x1c522b=_0x1c522b||0xcc;return function(_0x4c8396){if(_0x4c8396){return _0x5d2f27[_0x389c('0x10')](_0x1c522b);}return _0x5d2f27[_0x389c('0x11')](_0x1c522b)['end']();};}function respondWithResult(_0x4e07e5,_0x421249){_0x421249=_0x421249||0xc8;return function(_0x37429e){if(_0x37429e){return _0x4e07e5[_0x389c('0x11')](_0x421249)[_0x389c('0x12')](_0x37429e);}};}function respondWithFilteredResult(_0x2587ec,_0x1e8f50){return function(_0x23af83){if(_0x23af83){var _0x55ed2b=_0x23af83['count'],_0xec9e08=_0x1e8f50[_0x389c('0x13')],_0x149d72=_0x1e8f50[_0x389c('0x13')]+_0x1e8f50[_0x389c('0x14')],_0x38a625;if(_0x149d72>=_0x55ed2b){_0x149d72=_0x55ed2b;_0x38a625=0xc8;}else{_0x38a625=0xce;}_0x2587ec[_0x389c('0x11')](_0x38a625);return _0x2587ec[_0x389c('0x15')](_0x389c('0x16'),_0xec9e08+'-'+_0x149d72+'/'+_0x55ed2b)[_0x389c('0x12')](_0x23af83);}return null;};}function patchUpdates(_0x194440){return function(_0x33b093){try{jsonpatch[_0x389c('0x17')](_0x33b093,_0x194440,!![]);}catch(_0x1f5ddb){return BPromise['reject'](_0x1f5ddb);}return _0x33b093[_0x389c('0x18')]();};}function saveUpdates(_0x417a40,_0x95e986){return function(_0x5aeed0){if(_0x5aeed0){return _0x5aeed0['update'](_0x417a40)[_0x389c('0x19')](function(_0x592027){return _0x592027;});}return null;};}function removeEntity(_0x23154c,_0x4a4f32){return function(_0x4ab86c){if(_0x4ab86c){return _0x4ab86c[_0x389c('0x1a')]()[_0x389c('0x19')](function(){_0x23154c[_0x389c('0x11')](0xcc)[_0x389c('0x1b')]();});}};}function handleEntityNotFound(_0x439022,_0x53fcfb){return function(_0x5803ae){if(!_0x5803ae){_0x439022[_0x389c('0x10')](0x194);}return _0x5803ae;};}function handleError(_0xea3d88,_0x2bb9c5){_0x2bb9c5=_0x2bb9c5||0x1f4;return function(_0x1c8db6){logger[_0x389c('0x1c')](_0x1c8db6[_0x389c('0x1d')]);if(_0x1c8db6[_0x389c('0x1e')]){delete _0x1c8db6['name'];}_0xea3d88[_0x389c('0x11')](_0x2bb9c5)[_0x389c('0x1f')](_0x1c8db6);};}var utilLicense=require('../../config/license/util');exports[_0x389c('0x20')]=function(_0x15b3fa,_0x68e078){var _0x53ecfc={'raw':!![],'where':{'id':0x1}},_0x2213c1={};_0x2213c1['model']=_[_0x389c('0x21')](db['License'][_0x389c('0x22')]);_0x2213c1['query']=_[_0x389c('0x21')](_0x15b3fa[_0x389c('0x23')]);_0x2213c1[_0x389c('0x24')]=_['intersection'](_0x2213c1[_0x389c('0x25')],_0x2213c1[_0x389c('0x23')]);_0x53ecfc[_0x389c('0x26')]=_[_0x389c('0x27')](_0x2213c1[_0x389c('0x25')],qs['fields'](_0x15b3fa[_0x389c('0x23')][_0x389c('0x28')]));_0x53ecfc[_0x389c('0x26')]=_0x53ecfc[_0x389c('0x26')][_0x389c('0x29')]?_0x53ecfc[_0x389c('0x26')]:_0x2213c1[_0x389c('0x25')];_0x53ecfc=_[_0x389c('0x2a')]({},_0x53ecfc,_0x15b3fa[_0x389c('0x2b')]);return utilLicense[_0x389c('0x2c')](_0x53ecfc)[_0x389c('0x19')](respondWithResult(_0x68e078,null))['catch'](handleError(_0x68e078,null));};exports[_0x389c('0x2d')]=function(_0x2db149,_0x123e4b){if(_0x2db149[_0x389c('0x2e')]['id']){delete _0x2db149['body']['id'];}return db[_0x389c('0x2f')]['find']({'where':{'id':_0x2db149[_0x389c('0x30')]['id']}})[_0x389c('0x19')](handleEntityNotFound(_0x123e4b,null))[_0x389c('0x19')](function(_0x1516ba){var _0x4d1435=_0x1516ba[_0x389c('0x31')]({'plain':!![]});return utilLicense['checkLicense'](_0x4d1435,_0x2db149['body'][_0x389c('0x32')]);})[_0x389c('0x19')](function(_0x392ac9){if(!_0x392ac9[_0x389c('0x33')]){return saveUpdates(_0x2db149[_0x389c('0x2e')],null);}return _0x392ac9;})[_0x389c('0x19')](respondWithResult(_0x123e4b,null))[_0x389c('0x34')](handleError(_0x123e4b,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index a11f8f9..8b56cbc 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 _0x257e=['./license.attributes','exports','define','License','util','../../config/logger','moment','request-promise'];(function(_0x50a787,_0x1a64bf){var _0xe9a5b1=function(_0x34ee87){while(--_0x34ee87){_0x50a787['push'](_0x50a787['shift']());}};_0xe9a5b1(++_0x1a64bf);}(_0x257e,0x1dc));var _0xe257=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x257e[_0x2a18b7];return _0x45e74e;};'use strict';var _=require('lodash');var util=require(_0xe257('0x0'));var logger=require(_0xe257('0x1'))('api');var moment=require(_0xe257('0x2'));var BPromise=require('bluebird');var rp=require(_0xe257('0x3'));var attributes=require(_0xe257('0x4'));module[_0xe257('0x5')]=function(_0x3d250c,_0x56abfa){return _0x3d250c[_0xe257('0x6')](_0xe257('0x7'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x765b=['api','bluebird','./license.attributes','exports'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0x765b,0x18c));var _0xb765=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x765b[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb765('0x0'));var moment=require('moment');var BPromise=require(_0xb765('0x1'));var rp=require('request-promise');var attributes=require(_0xb765('0x2'));module[_0xb765('0x3')]=function(_0x358e6e,_0x57021a){return _0x358e6e['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 7dc5228..35fdfdd 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 _0x1f80=['lodash','util','bluebird','../../config/logger','rpc','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x9b3789,_0x4c43aa){var _0xe18ac8=function(_0xcac52d){while(--_0xcac52d){_0x9b3789['push'](_0x9b3789['shift']());}};_0xe18ac8(++_0x4c43aa);}(_0x1f80,0x168));var _0x01f8=function(_0x456fa5,_0x3332cc){_0x456fa5=_0x456fa5-0x0;var _0x8086b1=_0x1f80[_0x456fa5];return _0x8086b1;};'use strict';var _=require(_0x01f8('0x0'));var util=require(_0x01f8('0x1'));var moment=require('moment');var BPromise=require(_0x01f8('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x01f8('0x3'))(_0x01f8('0x4'));var config=require(_0x01f8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x01f8('0x6')][_0x01f8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5fb815,_0x33e2b4,_0x5b28b0){return new BPromise(function(_0x779178,_0x161434){return client[_0x01f8('0x8')](_0x5fb815,_0x5b28b0)[_0x01f8('0x9')](function(_0x9b7ede){logger['info'](_0x01f8('0xa'),_0x33e2b4,_0x01f8('0xb'));logger[_0x01f8('0xc')](_0x01f8('0xd'),_0x33e2b4,'request\x20sent',JSON[_0x01f8('0xe')](_0x9b7ede));if(_0x9b7ede[_0x01f8('0xf')]){if(_0x9b7ede[_0x01f8('0xf')][_0x01f8('0x10')]===0x1f4){logger[_0x01f8('0xf')]('License,\x20%s,\x20%s',_0x33e2b4,_0x9b7ede['error'][_0x01f8('0x11')]);return _0x161434(_0x9b7ede[_0x01f8('0xf')][_0x01f8('0x11')]);}logger[_0x01f8('0xf')](_0x01f8('0xa'),_0x33e2b4,_0x9b7ede[_0x01f8('0xf')]['message']);return _0x779178(_0x9b7ede[_0x01f8('0xf')][_0x01f8('0x11')]);}else{logger[_0x01f8('0x12')](_0x01f8('0xa'),_0x33e2b4,_0x01f8('0xb'));_0x779178(_0x9b7ede[_0x01f8('0x13')][_0x01f8('0x11')]);}})['catch'](function(_0x3fdca7){logger['error'](_0x01f8('0xa'),_0x33e2b4,_0x3fdca7);_0x161434(_0x3fdca7);});});} \ No newline at end of file +var _0xe3fa=['License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2407c9,_0x4e7281){var _0x532928=function(_0x10c650){while(--_0x10c650){_0x2407c9['push'](_0x2407c9['shift']());}};_0x532928(++_0x4e7281);}(_0xe3fa,0xaa));var _0xae3f=function(_0x4148fa,_0x1eb905){_0x4148fa=_0x4148fa-0x0;var _0x390cb4=_0xe3fa[_0x4148fa];return _0x390cb4;};'use strict';var _=require(_0xae3f('0x0'));var util=require(_0xae3f('0x1'));var moment=require(_0xae3f('0x2'));var BPromise=require(_0xae3f('0x3'));var rs=require(_0xae3f('0x4'));var fs=require('fs');var db=require(_0xae3f('0x5'))['db'];var utils=require(_0xae3f('0x6'));var logger=require('../../config/logger')(_0xae3f('0x7'));var config=require(_0xae3f('0x8'));var jayson=require(_0xae3f('0x9'));var client=jayson[_0xae3f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2428ac,_0x541ba1,_0x26108d){return new BPromise(function(_0x4fc8b5,_0x28b059){return client[_0xae3f('0xb')](_0x2428ac,_0x26108d)[_0xae3f('0xc')](function(_0x5b7d02){logger[_0xae3f('0xd')](_0xae3f('0xe'),_0x541ba1,'request\x20sent');logger[_0xae3f('0xf')](_0xae3f('0x10'),_0x541ba1,_0xae3f('0x11'),JSON[_0xae3f('0x12')](_0x5b7d02));if(_0x5b7d02[_0xae3f('0x13')]){if(_0x5b7d02[_0xae3f('0x13')]['code']===0x1f4){logger[_0xae3f('0x13')](_0xae3f('0xe'),_0x541ba1,_0x5b7d02[_0xae3f('0x13')][_0xae3f('0x14')]);return _0x28b059(_0x5b7d02[_0xae3f('0x13')][_0xae3f('0x14')]);}logger['error'](_0xae3f('0xe'),_0x541ba1,_0x5b7d02[_0xae3f('0x13')][_0xae3f('0x14')]);return _0x4fc8b5(_0x5b7d02[_0xae3f('0x13')][_0xae3f('0x14')]);}else{logger['info'](_0xae3f('0xe'),_0x541ba1,_0xae3f('0x11'));_0x4fc8b5(_0x5b7d02[_0xae3f('0x15')][_0xae3f('0x14')]);}})[_0xae3f('0x16')](function(_0x17a175){logger[_0xae3f('0x13')]('License,\x20%s,\x20%s',_0x541ba1,_0x17a175);_0x28b059(_0x17a175);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 48eabde..5fc719a 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 _0x27a3=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeAgents','exports','util','path','express','../../components/interaction/service','../../config/environment'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x27a3,0xe1));var _0x327a=function(_0x549f84,_0xa3c79f){_0x549f84=_0x549f84-0x0;var _0x521424=_0x27a3[_0x549f84];return _0x521424;};'use strict';var multer=require('multer');var util=require(_0x327a('0x0'));var path=require(_0x327a('0x1'));var express=require(_0x327a('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x327a('0x3'));var config=require(_0x327a('0x4'));var controller=require('./mailAccount.controller');router[_0x327a('0x5')]('/',auth[_0x327a('0x6')](),controller[_0x327a('0x7')]);router[_0x327a('0x5')](_0x327a('0x8'),auth['isAuthenticated'](),controller[_0x327a('0x9')]);router[_0x327a('0x5')](_0x327a('0xa'),auth[_0x327a('0x6')](),controller[_0x327a('0xb')]);router[_0x327a('0x5')](_0x327a('0xc'),auth[_0x327a('0x6')](),controller['getDispositions']);router[_0x327a('0x5')](_0x327a('0xd'),auth[_0x327a('0x6')](),controller['getAnswers']);router[_0x327a('0x5')](_0x327a('0xe'),auth['isAuthenticated'](),controller[_0x327a('0xf')]);router['get'](_0x327a('0x10'),auth[_0x327a('0x6')](),controller[_0x327a('0x11')]);router[_0x327a('0x5')](_0x327a('0x12'),auth[_0x327a('0x6')](),controller[_0x327a('0x13')]);router[_0x327a('0x5')](_0x327a('0x14'),auth['isAuthenticated'](),controller[_0x327a('0x15')]);router[_0x327a('0x5')](_0x327a('0x16'),auth[_0x327a('0x6')](),controller[_0x327a('0x17')]);router[_0x327a('0x5')](_0x327a('0x18'),auth['isAuthenticated'](),controller[_0x327a('0x19')]);router[_0x327a('0x5')]('/:id/users',auth['isAuthenticated'](),controller[_0x327a('0x1a')]);router[_0x327a('0x1b')](_0x327a('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x327a('0x1b')](_0x327a('0xd'),auth[_0x327a('0x6')](),controller[_0x327a('0x1c')]);router[_0x327a('0x1b')]('/',auth['isAuthenticated'](),controller[_0x327a('0x1d')]);router[_0x327a('0x1b')](_0x327a('0xe'),auth[_0x327a('0x6')](),controller[_0x327a('0x1e')]);router[_0x327a('0x1b')](_0x327a('0x10'),auth[_0x327a('0x6')](),controller[_0x327a('0x1f')]);router[_0x327a('0x1b')](_0x327a('0x12'),auth['isAuthenticated'](),controller[_0x327a('0x20')]);router[_0x327a('0x1b')](_0x327a('0x14'),auth[_0x327a('0x6')](),controller[_0x327a('0x21')]);router[_0x327a('0x1b')](_0x327a('0x22'),auth[_0x327a('0x6')](),controller[_0x327a('0x23')]);router[_0x327a('0x1b')](_0x327a('0x24'),auth[_0x327a('0x6')](),controller[_0x327a('0x25')]);router[_0x327a('0x26')](_0x327a('0xa'),auth[_0x327a('0x6')](),controller[_0x327a('0x27')]);router[_0x327a('0x28')](_0x327a('0xc'),auth[_0x327a('0x6')](),controller[_0x327a('0x29')]);router['delete'](_0x327a('0xd'),auth[_0x327a('0x6')](),controller[_0x327a('0x2a')]);router[_0x327a('0x28')](_0x327a('0xe'),auth[_0x327a('0x6')](),controller[_0x327a('0x2b')]);router[_0x327a('0x28')]('/:id/out_servers',auth[_0x327a('0x6')](),controller['removeSmtp']);router[_0x327a('0x28')](_0x327a('0xa'),auth[_0x327a('0x6')](),controller['destroy']);router[_0x327a('0x28')]('/:id/users',auth['isAuthenticated'](),controller[_0x327a('0x2c')]);module[_0x327a('0x2d')]=router; \ No newline at end of file +var _0x5df3=['send','addAgents','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send'];(function(_0x1684cc,_0x56778a){var _0xaf302c=function(_0x1d73a5){while(--_0x1d73a5){_0x1684cc['push'](_0x1684cc['shift']());}};_0xaf302c(++_0x56778a);}(_0x5df3,0x15f));var _0x35df=function(_0x1e7382,_0x44937e){_0x1e7382=_0x1e7382-0x0;var _0x16debf=_0x5df3[_0x1e7382];return _0x16debf;};'use strict';var multer=require(_0x35df('0x0'));var util=require('util');var path=require('path');var express=require(_0x35df('0x1'));var router=express[_0x35df('0x2')]();var auth=require(_0x35df('0x3'));var interaction=require(_0x35df('0x4'));var config=require(_0x35df('0x5'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x35df('0x6')](),controller[_0x35df('0x7')]);router[_0x35df('0x8')]('/describe',auth[_0x35df('0x6')](),controller[_0x35df('0x9')]);router[_0x35df('0x8')](_0x35df('0xa'),auth[_0x35df('0x6')](),controller[_0x35df('0xb')]);router[_0x35df('0x8')](_0x35df('0xc'),auth[_0x35df('0x6')](),controller[_0x35df('0xd')]);router[_0x35df('0x8')](_0x35df('0xe'),auth['isAuthenticated'](),controller[_0x35df('0xf')]);router[_0x35df('0x8')](_0x35df('0x10'),auth[_0x35df('0x6')](),controller[_0x35df('0x11')]);router['get'](_0x35df('0x12'),auth[_0x35df('0x6')](),controller[_0x35df('0x13')]);router[_0x35df('0x8')](_0x35df('0x14'),auth[_0x35df('0x6')](),controller[_0x35df('0x15')]);router[_0x35df('0x8')]('/:id/applications',auth[_0x35df('0x6')](),controller[_0x35df('0x16')]);router[_0x35df('0x8')](_0x35df('0x17'),auth['isAuthenticated'](),controller['getMessages']);router[_0x35df('0x8')](_0x35df('0x18'),auth[_0x35df('0x6')](),controller[_0x35df('0x19')]);router[_0x35df('0x8')](_0x35df('0x1a'),auth[_0x35df('0x6')](),controller[_0x35df('0x1b')]);router[_0x35df('0x1c')](_0x35df('0xc'),auth[_0x35df('0x6')](),controller[_0x35df('0x1d')]);router[_0x35df('0x1c')]('/:id/canned_answers',auth[_0x35df('0x6')](),controller['addAnswer']);router['post']('/',auth[_0x35df('0x6')](),controller['create']);router['post'](_0x35df('0x10'),auth[_0x35df('0x6')](),controller[_0x35df('0x1e')]);router[_0x35df('0x1c')]('/:id/out_servers',auth[_0x35df('0x6')](),controller[_0x35df('0x1f')]);router['post'](_0x35df('0x14'),auth[_0x35df('0x6')](),controller[_0x35df('0x20')]);router[_0x35df('0x1c')](_0x35df('0x21'),auth[_0x35df('0x6')](),controller[_0x35df('0x22')]);router[_0x35df('0x1c')](_0x35df('0x23'),auth[_0x35df('0x6')](),controller[_0x35df('0x24')]);router[_0x35df('0x1c')](_0x35df('0x1a'),auth[_0x35df('0x6')](),controller[_0x35df('0x25')]);router[_0x35df('0x26')]('/:id',auth[_0x35df('0x6')](),controller[_0x35df('0x27')]);router[_0x35df('0x28')]('/:id/dispositions',auth[_0x35df('0x6')](),controller['removeDispositions']);router[_0x35df('0x28')](_0x35df('0xe'),auth[_0x35df('0x6')](),controller['removeAnswers']);router[_0x35df('0x28')](_0x35df('0x10'),auth[_0x35df('0x6')](),controller['removeImap']);router[_0x35df('0x28')](_0x35df('0x12'),auth[_0x35df('0x6')](),controller['removeSmtp']);router[_0x35df('0x28')](_0x35df('0xa'),auth[_0x35df('0x6')](),controller[_0x35df('0x29')]);router[_0x35df('0x28')]('/:id/users',auth[_0x35df('0x6')](),controller['removeAgents']);module[_0x35df('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4cff848..51c8dfa 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 _0x0eaa=['STRING','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x511bf0,_0x193086){var _0x53513c=function(_0x356eb2){while(--_0x356eb2){_0x511bf0['push'](_0x511bf0['shift']());}};_0x53513c(++_0x193086);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x19f53c,_0x5cee32){_0x19f53c=_0x19f53c-0x0;var _0x262271=_0x0eaa[_0x19f53c];return _0x262271;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module[_0xa0ea('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xa0ea('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa0ea('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xa0ea('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0xa0ea('0x4')]},'markAsUnread':{'type':Sequelize[_0xa0ea('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa0ea('0x3')],'allowNull':![],'defaultValue':_0xa0ea('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xa0ea('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0xa0ea('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa0ea('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa0ea('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa0ea('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa0ea('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x7b05=['INTEGER','sequelize','exports','STRING','TEXT','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x344bab,_0x1082a1){var _0x413ccb=function(_0x14b207){while(--_0x14b207){_0x344bab['push'](_0x344bab['shift']());}};_0x413ccb(++_0x1082a1);}(_0x7b05,0x91));var _0x57b0=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0x7b05[_0x56daff];return _0x132c82;};'use strict';var Sequelize=require(_0x57b0('0x0'));module[_0x57b0('0x1')]={'description':{'type':Sequelize[_0x57b0('0x2')]},'name':{'type':Sequelize[_0x57b0('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x57b0('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x57b0('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x57b0('0x3')]},'markAsUnread':{'type':Sequelize[_0x57b0('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x57b0('0x2')],'allowNull':![],'defaultValue':_0x57b0('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x57b0('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x57b0('0x7');}},'notificationSound':{'type':Sequelize[_0x57b0('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x57b0('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x57b0('0x8')],'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 64881ac..e1f13ef 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 _0xc4aa=['find','update','body','describe','MailAccountId','Disposition','create','getDispositions','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','isNil','active','description','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','findOne','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Owner','fullname','Tag','Tags','tag','findAll','addApplications','sequelize','transaction','MailApplication','destroy','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','MailMessage','CmList','List','Contacts','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','defaults','ListId','List\x20not\x20found','messageId','subject','YYYY-MM-DD\x20HH:mm:ss','verifySmtp','VerifySmtp','ValidationError','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','register','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','stack','name','send','index','MailServerIn','Imap','MailAccount','rawAttributes','model','query','dateEnd','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','dateStart','day','add','merge','filter','map','rows','show','params','MailServerOut','Smtp','keys','intersection','includeAll','options'];(function(_0x22287e,_0x30e3f6){var _0x345da0=function(_0x5eccb1){while(--_0x5eccb1){_0x22287e['push'](_0x22287e['shift']());}};_0x345da0(++_0x30e3f6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var jsonpatch=require(_0xac4a('0x0'));var rp=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var Mustache=require(_0xac4a('0x4'));var util=require(_0xac4a('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xac4a('0x6'));var fs=require('fs');var _=require(_0xac4a('0x7'));var squel=require(_0xac4a('0x8'));var crypto=require(_0xac4a('0x9'));var jsforce=require(_0xac4a('0xa'));var deskjs=require(_0xac4a('0xb'));var toCsv=require(_0xac4a('0xc'));var querystring=require(_0xac4a('0xd'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xac4a('0xe'))(_0xac4a('0xf'));var utils=require(_0xac4a('0x10'));var config=require('../../config/environment');var db=require(_0xac4a('0x11'))['db'];var socket=require(_0xac4a('0x12'))({'host':_0xac4a('0x13'),'port':0x18eb});require('./mailAccount.socket')[_0xac4a('0x14')](socket);var jayson=require('jayson/promise');var client=jayson[_0xac4a('0x15')]['http']({'port':0x232b});function respondWithRpcPromise(_0x333ca5,_0x2a0776,_0x24291d,_0x5e16aa){return new BPromise(function(_0x21a79,_0x68424a){var _0x247b78=_0x5e16aa||client;return _0x247b78[_0xac4a('0x16')](_0x333ca5,_0x24291d)[_0xac4a('0x17')](function(_0x3b71c0){logger[_0xac4a('0x18')](_0xac4a('0x19'),_0x2a0776,_0xac4a('0x1a'));logger[_0xac4a('0x1b')](_0xac4a('0x1c'),_0x2a0776,_0xac4a('0x1a'),JSON['stringify'](_0x3b71c0));if(_0x3b71c0[_0xac4a('0x1d')]){if(_0x3b71c0[_0xac4a('0x1d')][_0xac4a('0x1e')]===0x1f4){logger[_0xac4a('0x1d')](_0xac4a('0x19'),_0x2a0776,_0x3b71c0[_0xac4a('0x1d')][_0xac4a('0x1f')]);return _0x68424a(_0x3b71c0[_0xac4a('0x1d')]['message']);}logger['error'](_0xac4a('0x19'),_0x2a0776,_0x3b71c0[_0xac4a('0x1d')][_0xac4a('0x1f')]);return _0x21a79(_0x3b71c0['error'][_0xac4a('0x1f')]);}else{logger[_0xac4a('0x18')](_0xac4a('0x19'),_0x2a0776,_0xac4a('0x1a'));_0x21a79(_0x3b71c0[_0xac4a('0x20')][_0xac4a('0x1f')]);}})[_0xac4a('0x21')](function(_0x3ca790){logger['error'](_0xac4a('0x19'),_0x2a0776,_0x3ca790);_0x68424a(_0x3ca790);});});}function respondWithStatusCode(_0x3204ad,_0x599787){_0x599787=_0x599787||0xcc;return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3204ad[_0xac4a('0x22')](_0x599787);}return _0x3204ad[_0xac4a('0x23')](_0x599787)[_0xac4a('0x24')]();};}function respondWithResult(_0x4d2d6c,_0x1b7998){_0x1b7998=_0x1b7998||0xc8;return function(_0x2503d8){if(_0x2503d8){return _0x4d2d6c[_0xac4a('0x23')](_0x1b7998)[_0xac4a('0x25')](_0x2503d8);}};}function respondWithFilteredResult(_0x594f36,_0x2b0dc2){return function(_0x222507){if(_0x222507){var _0x36054a=_0x222507[_0xac4a('0x26')],_0x3e2c69=_0x2b0dc2[_0xac4a('0x27')],_0x3bc318=_0x2b0dc2[_0xac4a('0x27')]+_0x2b0dc2[_0xac4a('0x28')],_0x1d0539;if(_0x3bc318>=_0x36054a){_0x3bc318=_0x36054a;_0x1d0539=0xc8;}else{_0x1d0539=0xce;}_0x594f36[_0xac4a('0x23')](_0x1d0539);return _0x594f36['set'](_0xac4a('0x29'),_0x3e2c69+'-'+_0x3bc318+'/'+_0x36054a)[_0xac4a('0x25')](_0x222507);}return null;};}function patchUpdates(_0x42a33c){return function(_0x2772fe){try{jsonpatch[_0xac4a('0x2a')](_0x2772fe,_0x42a33c,!![]);}catch(_0x4a5a9e){return BPromise['reject'](_0x4a5a9e);}return _0x2772fe[_0xac4a('0x2b')]();};}function saveUpdates(_0x7a948b,_0x1f12d5){return function(_0x546b65){if(_0x546b65){return _0x546b65['update'](_0x7a948b)[_0xac4a('0x17')](function(_0x2896bc){return _0x2896bc;});}return null;};}function removeEntity(_0x228629,_0x432066){return function(_0x17118e){if(_0x17118e){return _0x17118e['destroy']()[_0xac4a('0x17')](function(){_0x228629['status'](0xcc)[_0xac4a('0x24')]();});}};}function handleEntityNotFound(_0x57adcf,_0x17e6de){return function(_0xfbe355){if(!_0xfbe355){_0x57adcf[_0xac4a('0x22')](0x194);}return _0xfbe355;};}function handleError(_0x228aa7,_0x34577f){_0x34577f=_0x34577f||0x1f4;return function(_0x61e552){logger[_0xac4a('0x1d')](_0x61e552[_0xac4a('0x2c')]);if(_0x61e552[_0xac4a('0x2d')]){delete _0x61e552[_0xac4a('0x2d')];}_0x228aa7[_0xac4a('0x23')](_0x34577f)[_0xac4a('0x2e')](_0x61e552);};}exports[_0xac4a('0x2f')]=function(_0x1a9d4e,_0x5634e2){var _0x30442d={'include':[{'model':db[_0xac4a('0x30')],'as':_0xac4a('0x31')},{'model':db['MailServerOut'],'as':'Smtp'}]},_0x1c41fb={},_0x5a4e2b={'count':0x0,'rows':[]};var _0x11f0be=db[_0xac4a('0x32')][_0xac4a('0x33')];_0x1c41fb[_0xac4a('0x34')]=_['keys'](_0x11f0be);var _0x453d02={'dateStart':_0x1a9d4e[_0xac4a('0x35')]['dateStart'],'dateEnd':_0x1a9d4e[_0xac4a('0x35')][_0xac4a('0x36')]};delete _0x1a9d4e[_0xac4a('0x35')]['dateStart'];delete _0x1a9d4e[_0xac4a('0x35')][_0xac4a('0x36')];_0x1c41fb[_0xac4a('0x35')]=_['keys'](_0x1a9d4e[_0xac4a('0x35')]);_0x1c41fb[_0xac4a('0x37')]=_['intersection'](_0x1c41fb['model'],_0x1c41fb[_0xac4a('0x35')]);_0x30442d['attributes']=_['intersection'](_0x1c41fb['model'],qs['fields'](_0x1a9d4e[_0xac4a('0x35')][_0xac4a('0x38')]));_0x30442d[_0xac4a('0x39')]=_0x30442d[_0xac4a('0x39')][_0xac4a('0x3a')]?_0x30442d[_0xac4a('0x39')]:_0x1c41fb[_0xac4a('0x34')];if(!_0x1a9d4e[_0xac4a('0x35')][_0xac4a('0x3b')](_0xac4a('0x3c'))){_0x30442d[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x1a9d4e['query']['limit']);_0x30442d['offset']=qs[_0xac4a('0x27')](_0x1a9d4e[_0xac4a('0x35')][_0xac4a('0x27')]);}_0x30442d[_0xac4a('0x3d')]=qs[_0xac4a('0x3e')](_0x1a9d4e[_0xac4a('0x35')][_0xac4a('0x3e')]);_0x30442d[_0xac4a('0x3f')]=qs[_0xac4a('0x37')](_[_0xac4a('0x40')](_0x1a9d4e['query'],_0x1c41fb[_0xac4a('0x37')]));if(_0x453d02[_0xac4a('0x41')]){if(_0x453d02[_0xac4a('0x36')]){_0x453d02[_0xac4a('0x36')]=moment(_0x453d02[_0xac4a('0x36')])['add'](0x1,_0xac4a('0x42'));}else{_0x453d02[_0xac4a('0x36')]=moment(_0x453d02['dateStart'])[_0xac4a('0x43')](0x1,'day');}_[_0xac4a('0x44')](_0x30442d[_0xac4a('0x3f')],{'createdAt':{'$gte':_0x453d02[_0xac4a('0x41')],'$lte':_0x453d02[_0xac4a('0x36')]}});}if(_0x1a9d4e[_0xac4a('0x35')][_0xac4a('0x45')]){_0x30442d[_0xac4a('0x3f')]=_[_0xac4a('0x44')](_0x30442d[_0xac4a('0x3f')],{'$or':_[_0xac4a('0x46')](_0x30442d[_0xac4a('0x39')],function(_0x3b68b3){var _0x569812={};_0x569812[_0x3b68b3]={'$like':'%'+_0x1a9d4e[_0xac4a('0x35')][_0xac4a('0x45')]+'%'};return _0x569812;})});}_0x30442d=_[_0xac4a('0x44')]({},_0x30442d,_0x1a9d4e['options']);var _0x1764bf={'where':_0x30442d[_0xac4a('0x3f')]};return db['MailAccount'][_0xac4a('0x26')](_0x1764bf)['then'](function(_0x244950){_0x5a4e2b[_0xac4a('0x26')]=_0x244950;if(_0x1a9d4e[_0xac4a('0x35')]['includeAll']){_0x30442d['include']=[{'all':!![]}];}return db[_0xac4a('0x32')]['findAll'](_0x30442d);})[_0xac4a('0x17')](function(_0x566258){_0x5a4e2b[_0xac4a('0x47')]=_0x566258;return _0x5a4e2b;})['then'](respondWithFilteredResult(_0x5634e2,_0x30442d))[_0xac4a('0x21')](handleError(_0x5634e2,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){var _0x54782f={'raw':![],'where':{'id':_0x424f9b[_0xac4a('0x49')]['id']},'include':[{'model':db[_0xac4a('0x30')],'as':_0xac4a('0x31')},{'model':db[_0xac4a('0x4a')],'as':_0xac4a('0x4b')}]},_0x31c794={};_0x31c794[_0xac4a('0x34')]=_['keys'](db[_0xac4a('0x32')][_0xac4a('0x33')]);_0x31c794['query']=_[_0xac4a('0x4c')](_0x424f9b[_0xac4a('0x35')]);_0x31c794[_0xac4a('0x37')]=_[_0xac4a('0x4d')](_0x31c794['model'],_0x31c794[_0xac4a('0x35')]);_0x54782f[_0xac4a('0x39')]=_[_0xac4a('0x4d')](_0x31c794[_0xac4a('0x34')],qs[_0xac4a('0x38')](_0x424f9b['query'][_0xac4a('0x38')]));_0x54782f['attributes']=_0x54782f[_0xac4a('0x39')][_0xac4a('0x3a')]?_0x54782f['attributes']:_0x31c794['model'];if(_0x424f9b[_0xac4a('0x35')][_0xac4a('0x4e')]){_0x54782f['include']=[{'all':!![]}];}_0x54782f=_[_0xac4a('0x44')]({},_0x54782f,_0x424f9b[_0xac4a('0x4f')]);return db[_0xac4a('0x32')][_0xac4a('0x50')](_0x54782f)['then'](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x17')](respondWithResult(_0x1c8c39,null))[_0xac4a('0x21')](handleError(_0x1c8c39,null));};exports[_0xac4a('0x51')]=function(_0xb5897b,_0xdc80e3){if(_0xb5897b[_0xac4a('0x52')]['id']){delete _0xb5897b[_0xac4a('0x52')]['id'];}return db['MailAccount'][_0xac4a('0x50')]({'where':{'id':_0xb5897b[_0xac4a('0x49')]['id']},'include':[{'model':db[_0xac4a('0x30')],'as':_0xac4a('0x31')},{'model':db[_0xac4a('0x4a')],'as':_0xac4a('0x4b')}]})[_0xac4a('0x17')](handleEntityNotFound(_0xdc80e3,null))[_0xac4a('0x17')](saveUpdates(_0xb5897b[_0xac4a('0x52')],null))[_0xac4a('0x17')](function(_0x3b175a){if(_0x3b175a&&_0xb5897b[_0xac4a('0x52')][_0xac4a('0x31')]){return db[_0xac4a('0x30')][_0xac4a('0x51')](_0xb5897b[_0xac4a('0x52')]['Imap'],{'where':{'MailAccountId':_0x3b175a['id']}})[_0xac4a('0x17')](function(){return _0x3b175a;});}return _0x3b175a;})['then'](function(_0x2d598e){if(_0x2d598e&&_0xb5897b['body'][_0xac4a('0x4b')]){return db['MailServerOut'][_0xac4a('0x51')](_0xb5897b['body']['Smtp'],{'where':{'MailAccountId':_0x2d598e['id']}})[_0xac4a('0x17')](function(){return _0x2d598e;});}return _0x2d598e;})[_0xac4a('0x17')](respondWithResult(_0xdc80e3,null))[_0xac4a('0x21')](handleError(_0xdc80e3,null));};exports[_0xac4a('0x53')]=function(_0x2f9940,_0xb7b884){return db['MailAccount'][_0xac4a('0x53')]()['then'](respondWithResult(_0xb7b884,null))[_0xac4a('0x21')](handleError(_0xb7b884,null));};exports['addDisposition']=function(_0x347880,_0x19ce2c,_0x3da7e7){if(_0x347880[_0xac4a('0x52')]['id']){delete _0x347880[_0xac4a('0x52')]['id'];}return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x347880[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x19ce2c,null))[_0xac4a('0x17')](function(_0x42e503){if(_0x42e503){_0x347880[_0xac4a('0x52')][_0xac4a('0x54')]=_0x42e503['id'];return db[_0xac4a('0x55')][_0xac4a('0x56')](_0x347880[_0xac4a('0x52')]);}})[_0xac4a('0x17')](respondWithResult(_0x19ce2c,null))['catch'](handleError(_0x19ce2c,null));};exports[_0xac4a('0x57')]=function(_0x1672c0,_0x4fb812,_0x3c3576){var _0x34bd1c={'raw':![],'where':{}};var _0x2d24c7={};var _0x2b8562={'count':0x0,'rows':[]};return db[_0xac4a('0x32')]['findOne']({'where':{'id':_0x1672c0['params']['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x4fb812,null))[_0xac4a('0x17')](function(_0x158223){if(_0x158223){_0x2d24c7[_0xac4a('0x34')]=_[_0xac4a('0x4c')](db[_0xac4a('0x55')][_0xac4a('0x33')]);_0x2d24c7[_0xac4a('0x35')]=_[_0xac4a('0x4c')](_0x1672c0[_0xac4a('0x35')]);_0x2d24c7[_0xac4a('0x37')]=_['intersection'](_0x2d24c7['model'],_0x2d24c7[_0xac4a('0x35')]);_0x34bd1c[_0xac4a('0x39')]=_[_0xac4a('0x4d')](_0x2d24c7[_0xac4a('0x34')],qs[_0xac4a('0x38')](_0x1672c0[_0xac4a('0x35')][_0xac4a('0x38')]));_0x34bd1c[_0xac4a('0x39')]=_0x34bd1c[_0xac4a('0x39')][_0xac4a('0x3a')]?_0x34bd1c[_0xac4a('0x39')]:_0x2d24c7[_0xac4a('0x34')];if(!_0x1672c0['query'][_0xac4a('0x3b')](_0xac4a('0x3c'))){_0x34bd1c[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x1672c0['query'][_0xac4a('0x28')]);_0x34bd1c['offset']=qs[_0xac4a('0x27')](_0x1672c0[_0xac4a('0x35')]['offset']);}_0x34bd1c['order']=qs[_0xac4a('0x3e')](_0x1672c0[_0xac4a('0x35')][_0xac4a('0x3e')]);_0x34bd1c['where']=qs[_0xac4a('0x37')](_['pick'](_0x1672c0[_0xac4a('0x35')],_0x2d24c7['filters']));_0x34bd1c['where'][_0xac4a('0x54')]=_0x158223['id'];if(_0x1672c0['query'][_0xac4a('0x45')]){_0x34bd1c['where']=_[_0xac4a('0x44')](_0x34bd1c[_0xac4a('0x3f')],{'$or':_['map'](_0x34bd1c[_0xac4a('0x39')],function(_0x54fa7a){var _0x36a21d={};_0x36a21d[_0x54fa7a]={'$like':'%'+_0x1672c0[_0xac4a('0x35')]['filter']+'%'};return _0x36a21d;})});}_0x34bd1c=_[_0xac4a('0x44')]({},_0x34bd1c,_0x1672c0['options']);return db['Disposition'][_0xac4a('0x26')]({'where':_0x34bd1c['where']})[_0xac4a('0x17')](function(_0x558c43){_0x2b8562['count']=_0x558c43;if(_0x1672c0[_0xac4a('0x35')][_0xac4a('0x4e')]){_0x34bd1c[_0xac4a('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x34bd1c);})[_0xac4a('0x17')](function(_0x9c0fa1){_0x2b8562['rows']=_0x9c0fa1;return _0x2b8562;});}})['then'](respondWithFilteredResult(_0x4fb812,_0x34bd1c))[_0xac4a('0x21')](handleError(_0x4fb812,null));};exports[_0xac4a('0x59')]=function(_0x347c73,_0x36df3d,_0x1810f7){var _0x38ac74;return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x347c73[_0xac4a('0x49')]['id']}})['then'](handleEntityNotFound(_0x36df3d,null))[_0xac4a('0x17')](function(_0x440dc4){if(_0x440dc4){return _0x440dc4[_0xac4a('0x59')](_0x347c73['query'][_0xac4a('0x5a')]);}})[_0xac4a('0x17')](respondWithStatusCode(_0x36df3d,null))[_0xac4a('0x21')](handleError(_0x36df3d,null));};exports[_0xac4a('0x5b')]=function(_0x3d2b5c,_0x5daf44,_0x290a73){if(_0x3d2b5c[_0xac4a('0x52')]['id']){delete _0x3d2b5c[_0xac4a('0x52')]['id'];}return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x3d2b5c[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x5daf44,null))['then'](function(_0x2e3bb7){if(_0x2e3bb7){_0x3d2b5c[_0xac4a('0x52')][_0xac4a('0x54')]=_0x2e3bb7['id'];return db[_0xac4a('0x5c')][_0xac4a('0x56')](_0x3d2b5c[_0xac4a('0x52')]);}})['then'](respondWithResult(_0x5daf44,null))[_0xac4a('0x21')](handleError(_0x5daf44,null));};exports[_0xac4a('0x5d')]=function(_0x1b9a33,_0x284bbf,_0x5bb389){var _0x21a384={'raw':![],'where':{}};var _0x56a934={};var _0x4447b5={'count':0x0,'rows':[]};return db[_0xac4a('0x32')]['findOne']({'where':{'id':_0x1b9a33['params']['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x284bbf,null))[_0xac4a('0x17')](function(_0x1fe86a){if(_0x1fe86a){_0x56a934['model']=_[_0xac4a('0x4c')](db['CannedAnswer'][_0xac4a('0x33')]);_0x56a934[_0xac4a('0x35')]=_[_0xac4a('0x4c')](_0x1b9a33[_0xac4a('0x35')]);_0x56a934[_0xac4a('0x37')]=_['intersection'](_0x56a934['model'],_0x56a934[_0xac4a('0x35')]);_0x21a384[_0xac4a('0x39')]=_[_0xac4a('0x4d')](_0x56a934[_0xac4a('0x34')],qs[_0xac4a('0x38')](_0x1b9a33[_0xac4a('0x35')][_0xac4a('0x38')]));_0x21a384[_0xac4a('0x39')]=_0x21a384['attributes']['length']?_0x21a384[_0xac4a('0x39')]:_0x56a934[_0xac4a('0x34')];if(!_0x1b9a33[_0xac4a('0x35')][_0xac4a('0x3b')](_0xac4a('0x3c'))){_0x21a384[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x1b9a33[_0xac4a('0x35')]['limit']);_0x21a384['offset']=qs[_0xac4a('0x27')](_0x1b9a33[_0xac4a('0x35')][_0xac4a('0x27')]);}_0x21a384[_0xac4a('0x3d')]=qs[_0xac4a('0x3e')](_0x1b9a33[_0xac4a('0x35')][_0xac4a('0x3e')]);_0x21a384['where']=qs[_0xac4a('0x37')](_[_0xac4a('0x40')](_0x1b9a33[_0xac4a('0x35')],_0x56a934['filters']));_0x21a384[_0xac4a('0x3f')][_0xac4a('0x54')]=_0x1fe86a['id'];if(_0x1b9a33[_0xac4a('0x35')][_0xac4a('0x45')]){_0x21a384[_0xac4a('0x3f')]=_[_0xac4a('0x44')](_0x21a384[_0xac4a('0x3f')],{'$or':_[_0xac4a('0x46')](_0x21a384[_0xac4a('0x39')],function(_0x5f0adc){var _0x32bd79={};_0x32bd79[_0x5f0adc]={'$like':'%'+_0x1b9a33['query'][_0xac4a('0x45')]+'%'};return _0x32bd79;})});}_0x21a384=_[_0xac4a('0x44')]({},_0x21a384,_0x1b9a33[_0xac4a('0x4f')]);return db[_0xac4a('0x5c')][_0xac4a('0x26')]({'where':_0x21a384[_0xac4a('0x3f')]})[_0xac4a('0x17')](function(_0x5266d3){_0x4447b5[_0xac4a('0x26')]=_0x5266d3;if(_0x1b9a33[_0xac4a('0x35')][_0xac4a('0x4e')]){_0x21a384[_0xac4a('0x58')]=[{'all':!![]}];}return db[_0xac4a('0x5c')]['findAll'](_0x21a384);})[_0xac4a('0x17')](function(_0x360d4f){_0x4447b5['rows']=_0x360d4f;return _0x4447b5;});}})['then'](respondWithFilteredResult(_0x284bbf,_0x21a384))[_0xac4a('0x21')](handleError(_0x284bbf,null));};exports[_0xac4a('0x5e')]=function(_0x59afa0,_0x24d36d,_0x217d8b){var _0x6afaba;return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x59afa0[_0xac4a('0x49')]['id']}})['then'](handleEntityNotFound(_0x24d36d,null))[_0xac4a('0x17')](function(_0x1eddc1){if(_0x1eddc1){return _0x1eddc1[_0xac4a('0x5e')](_0x59afa0['query'][_0xac4a('0x5a')]);}})[_0xac4a('0x17')](respondWithStatusCode(_0x24d36d,null))[_0xac4a('0x21')](handleError(_0x24d36d,null));};exports[_0xac4a('0x56')]=function(_0x380c90,_0x23d635){var _0x5d6ef3={'name':_0x380c90[_0xac4a('0x52')][_0xac4a('0x2d')],'key':_0x380c90['body'][_0xac4a('0x5f')],'email':_0x380c90['body'][_0xac4a('0x60')],'ListId':_0x380c90[_0xac4a('0x52')]['ListId'],'active':!_[_0xac4a('0x61')](_0x380c90['body'][_0xac4a('0x62')])?_0x380c90['body'][_0xac4a('0x62')]:!![],'description':_0x380c90[_0xac4a('0x52')][_0xac4a('0x63')]||null,'Imap':{},'Smtp':{}};if(_[_0xac4a('0x61')](_0x380c90[_0xac4a('0x52')][_0xac4a('0x64')])){if(_0x380c90[_0xac4a('0x52')][_0xac4a('0x65')]){_0x5d6ef3[_0xac4a('0x31')][_0xac4a('0x66')]=_0x5d6ef3[_0xac4a('0x4b')][_0xac4a('0x66')]=_0x380c90[_0xac4a('0x52')][_0xac4a('0x67')];_0x5d6ef3['Imap'][_0xac4a('0x68')]=_0x5d6ef3[_0xac4a('0x4b')]['pass']=_0x380c90[_0xac4a('0x52')][_0xac4a('0x69')];}else{_0x5d6ef3[_0xac4a('0x31')][_0xac4a('0x6a')]=_0x5d6ef3[_0xac4a('0x4b')]['authentication']=![];}_0x5d6ef3[_0xac4a('0x31')]['host']=_0x380c90[_0xac4a('0x52')][_0xac4a('0x31')][_0xac4a('0x6b')];_0x5d6ef3[_0xac4a('0x31')]['port']=_0x380c90[_0xac4a('0x52')]['Imap'][_0xac4a('0x6c')];_0x5d6ef3[_0xac4a('0x4b')][_0xac4a('0x6b')]=_0x380c90['body'][_0xac4a('0x4b')][_0xac4a('0x6b')];_0x5d6ef3[_0xac4a('0x4b')]['port']=_0x380c90[_0xac4a('0x52')][_0xac4a('0x4b')][_0xac4a('0x6c')];}else{_0x5d6ef3[_0xac4a('0x31')][_0xac4a('0x6d')]=_0x5d6ef3[_0xac4a('0x4b')][_0xac4a('0x6d')]=_0x380c90[_0xac4a('0x52')]['cservice'];_0x5d6ef3[_0xac4a('0x31')]['user']=_0x5d6ef3['Smtp']['user']=_0x380c90['body']['cuser'];_0x5d6ef3[_0xac4a('0x31')][_0xac4a('0x68')]=_0x5d6ef3[_0xac4a('0x4b')][_0xac4a('0x6e')]=_0x380c90[_0xac4a('0x52')]['cpassword'];}return db[_0xac4a('0x32')][_0xac4a('0x56')](_0x5d6ef3,{'include':[{'model':db[_0xac4a('0x4a')],'as':_0xac4a('0x4b')},{'model':db[_0xac4a('0x30')],'as':_0xac4a('0x31')}]})[_0xac4a('0x17')](respondWithResult(_0x23d635,0xc9))[_0xac4a('0x21')](handleError(_0x23d635,null));};exports['getImap']=function(_0x2cb596,_0x871c77,_0x2df41d){return db[_0xac4a('0x32')][_0xac4a('0x6f')]({'where':{'id':_0x2cb596[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x871c77,null))['then'](function(_0x5c823e){if(_0x5c823e){return _0x5c823e[_0xac4a('0x70')]();}return null;})[_0xac4a('0x17')](respondWithResult(_0x871c77,null))['catch'](handleError(_0x871c77,null));};exports[_0xac4a('0x71')]=function(_0x366f5a,_0x503880,_0x5bd013){if(_0x366f5a[_0xac4a('0x52')]['id']){delete _0x366f5a[_0xac4a('0x52')]['id'];}return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x366f5a[_0xac4a('0x49')]['id']}})['then'](handleEntityNotFound(_0x503880,null))[_0xac4a('0x17')](function(_0x5e9cb2){if(_0x5e9cb2){_0x366f5a['body']['MailAccountId']=_0x5e9cb2['id'];return db[_0xac4a('0x30')][_0xac4a('0x56')](_0x366f5a[_0xac4a('0x52')]);}})[_0xac4a('0x17')](respondWithResult(_0x503880,null))[_0xac4a('0x21')](handleError(_0x503880,null));};exports[_0xac4a('0x72')]=function(_0xcad25d,_0x43f82b,_0x5250e9){return db['MailAccount']['findOne']({'where':{'id':_0xcad25d[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x43f82b,null))[_0xac4a('0x17')](function(_0x3f0801){if(_0x3f0801){return _0x3f0801[_0xac4a('0x73')](null);}return null;})[_0xac4a('0x17')](respondWithStatusCode(_0x43f82b,null))[_0xac4a('0x21')](handleError(_0x43f82b,null));};exports[_0xac4a('0x74')]=function(_0x45b3d3,_0x131bc6,_0x1d5d71){return db[_0xac4a('0x32')][_0xac4a('0x6f')]({'where':{'id':_0x45b3d3[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x131bc6,null))[_0xac4a('0x17')](function(_0x23bbc5){if(_0x23bbc5){return _0x23bbc5[_0xac4a('0x74')]();}return null;})[_0xac4a('0x17')](respondWithResult(_0x131bc6,null))[_0xac4a('0x21')](handleError(_0x131bc6,null));};exports[_0xac4a('0x75')]=function(_0x17a1d8,_0x3e2575,_0x4cc581){if(_0x17a1d8[_0xac4a('0x52')]['id']){delete _0x17a1d8[_0xac4a('0x52')]['id'];}return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x17a1d8[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x3e2575,null))[_0xac4a('0x17')](function(_0x2f108d){if(_0x2f108d){_0x17a1d8['body']['MailAccountId']=_0x2f108d['id'];return db[_0xac4a('0x4a')][_0xac4a('0x56')](_0x17a1d8[_0xac4a('0x52')]);}})['then'](respondWithResult(_0x3e2575,null))['catch'](handleError(_0x3e2575,null));};exports['removeSmtp']=function(_0x2b6773,_0x52df82,_0x59e82c){return db[_0xac4a('0x32')]['findOne']({'where':{'id':_0x2b6773[_0xac4a('0x49')]['id']}})['then'](handleEntityNotFound(_0x52df82,null))[_0xac4a('0x17')](function(_0x2b4f28){if(_0x2b4f28){return _0x2b4f28[_0xac4a('0x76')](null);}return null;})[_0xac4a('0x17')](respondWithStatusCode(_0x52df82,null))[_0xac4a('0x21')](handleError(_0x52df82,null));};exports[_0xac4a('0x77')]=function(_0x5e0602,_0x25bf23,_0x34b6d7){return db[_0xac4a('0x78')]['find']({'where':{'id':_0x5e0602[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x25bf23,null))[_0xac4a('0x17')](function(_0x247856){if(_0x247856){return _0x247856['addInteraction'](_0x5e0602[_0xac4a('0x52')][_0xac4a('0x5a')],_[_0xac4a('0x79')](_0x5e0602[_0xac4a('0x52')],[_0xac4a('0x5a'),'id'])||{});}})[_0xac4a('0x17')](respondWithResult(_0x25bf23,null))['catch'](handleError(_0x25bf23,null));};exports['getInteractions']=function(_0x175f73,_0x388567,_0x2a6292){var _0x25c2ab={'raw':![],'where':{}};var _0x2c594b={};var _0x1a12a2={'count':0x0,'rows':[]};return db['MailAccount'][_0xac4a('0x6f')]({'where':{'id':_0x175f73['params']['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x388567,null))['then'](function(_0xa1df14){if(_0xa1df14){_0x2c594b[_0xac4a('0x34')]=_[_0xac4a('0x4c')](db[_0xac4a('0x78')]['rawAttributes']);_0x2c594b[_0xac4a('0x35')]=_[_0xac4a('0x4c')](_0x175f73[_0xac4a('0x35')]);_0x2c594b[_0xac4a('0x37')]=_[_0xac4a('0x4d')](_0x2c594b['model'],_0x2c594b[_0xac4a('0x35')]);_0x25c2ab[_0xac4a('0x39')]=_[_0xac4a('0x4d')](_0x2c594b[_0xac4a('0x34')],qs[_0xac4a('0x38')](_0x175f73['query'][_0xac4a('0x38')]));_0x25c2ab[_0xac4a('0x39')]=_0x25c2ab[_0xac4a('0x39')][_0xac4a('0x3a')]?_0x25c2ab[_0xac4a('0x39')]:_0x2c594b['model'];if(!_0x175f73['query']['hasOwnProperty']('nolimit')){_0x25c2ab[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x175f73[_0xac4a('0x35')][_0xac4a('0x28')]);_0x25c2ab[_0xac4a('0x27')]=qs['offset'](_0x175f73[_0xac4a('0x35')][_0xac4a('0x27')]);}_0x25c2ab['order']=qs[_0xac4a('0x3e')](_0x175f73[_0xac4a('0x35')][_0xac4a('0x3e')]);_0x25c2ab['where']=qs[_0xac4a('0x37')](_[_0xac4a('0x40')](_0x175f73[_0xac4a('0x35')],_0x2c594b[_0xac4a('0x37')]));_0x25c2ab[_0xac4a('0x3f')][_0xac4a('0x54')]=_0xa1df14['id'];if(_0x175f73[_0xac4a('0x35')][_0xac4a('0x45')]){_0x25c2ab[_0xac4a('0x3f')]=_['merge'](_0x25c2ab[_0xac4a('0x3f')],{'$or':_[_0xac4a('0x46')](_0x25c2ab['attributes'],function(_0x11faad){var _0x4fbde6={};_0x4fbde6[_0x11faad]={'$like':'%'+_0x175f73[_0xac4a('0x35')][_0xac4a('0x45')]+'%'};return _0x4fbde6;})});}_0x25c2ab=_['merge']({},_0x25c2ab,_0x175f73[_0xac4a('0x4f')]);return db[_0xac4a('0x78')][_0xac4a('0x26')]({'where':_0x25c2ab[_0xac4a('0x3f')]})[_0xac4a('0x17')](function(_0x39c439){_0x1a12a2[_0xac4a('0x26')]=_0x39c439;if(_0x175f73[_0xac4a('0x35')]['includeAll']){_0x25c2ab['include']=[{'model':db[_0xac4a('0x7a')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xac4a('0x7b'),'attributes':[_0xac4a('0x2d'),_0xac4a('0x7c'),'internal'],'required':![]},{'model':db[_0xac4a('0x7d')],'as':_0xac4a('0x7e'),'attributes':['id','name','color'],'where':_0x175f73[_0xac4a('0x35')][_0xac4a('0x7f')]?{'id':_0x175f73[_0xac4a('0x35')][_0xac4a('0x7f')]}:undefined,'required':_0x175f73['query'][_0xac4a('0x7f')]?!![]:![]}];}return db[_0xac4a('0x78')][_0xac4a('0x80')](_0x25c2ab);})['then'](function(_0x3d9ddc){_0x1a12a2[_0xac4a('0x47')]=_0x3d9ddc;return _0x1a12a2;});}})[_0xac4a('0x17')](respondWithFilteredResult(_0x388567,_0x25c2ab))[_0xac4a('0x21')](handleError(_0x388567,null));};exports[_0xac4a('0x81')]=function(_0x5882b4,_0x4a5ae0,_0x9051e7){return db[_0xac4a('0x32')][_0xac4a('0x6f')]({'where':{'id':_0x5882b4[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x4a5ae0,null))[_0xac4a('0x17')](function(_0xdafc8c){if(_0xdafc8c){return db[_0xac4a('0x82')][_0xac4a('0x83')](function(_0x1c3f91){return db[_0xac4a('0x84')][_0xac4a('0x85')]({'where':{'MailAccountId':_0x5882b4[_0xac4a('0x49')]['id']},'transaction':_0x1c3f91})['then'](function(_0x3ef9b2){var _0x509e31=_['map'](_0x5882b4[_0xac4a('0x52')],function(_0x27833a){_0x27833a[_0xac4a('0x54')]=_0x5882b4[_0xac4a('0x49')]['id'];return _0x27833a;});return db[_0xac4a('0x84')][_0xac4a('0x86')](_0x509e31,{'transaction':_0x1c3f91});});})[_0xac4a('0x17')](function(){return db[_0xac4a('0x84')][_0xac4a('0x87')]({'where':{'MailAccountId':_0x5882b4['params']['id']},'order':_0xac4a('0x88')});});}})[_0xac4a('0x17')](respondWithResult(_0x4a5ae0,null))[_0xac4a('0x21')](handleError(_0x4a5ae0,null));};exports[_0xac4a('0x89')]=function(_0x5c0bb8,_0x5b1934,_0xf95ce1){var _0x1da257={};var _0x20da5e={};var _0x1064ea;var _0x8c1fa5;return db[_0xac4a('0x32')][_0xac4a('0x6f')]({'where':{'id':_0x5c0bb8[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x5b1934,null))['then'](function(_0xb07a2f){if(_0xb07a2f){_0x1064ea=_0xb07a2f;_0x20da5e[_0xac4a('0x34')]=_[_0xac4a('0x4c')](db[_0xac4a('0x84')][_0xac4a('0x33')]);_0x20da5e[_0xac4a('0x35')]=_['keys'](_0x5c0bb8['query']);_0x20da5e['filters']=_[_0xac4a('0x4d')](_0x20da5e[_0xac4a('0x34')],_0x20da5e['query']);_0x1da257['attributes']=_[_0xac4a('0x4d')](_0x20da5e['model'],qs[_0xac4a('0x38')](_0x5c0bb8['query'][_0xac4a('0x38')]));_0x1da257[_0xac4a('0x39')]=_0x1da257[_0xac4a('0x39')]['length']?_0x1da257[_0xac4a('0x39')]:_0x20da5e[_0xac4a('0x34')];_0x1da257['order']=qs[_0xac4a('0x3e')](_0x5c0bb8[_0xac4a('0x35')]['sort']);_0x1da257['where']=qs[_0xac4a('0x37')](_[_0xac4a('0x40')](_0x5c0bb8[_0xac4a('0x35')],_0x20da5e[_0xac4a('0x37')]));if(_0x5c0bb8[_0xac4a('0x35')][_0xac4a('0x45')]){_0x1da257[_0xac4a('0x3f')]=_[_0xac4a('0x44')](_0x1da257[_0xac4a('0x3f')],{'$or':_[_0xac4a('0x46')](_0x1da257[_0xac4a('0x39')],function(_0x122241){var _0x2d755c={};_0x2d755c[_0x122241]={'$like':'%'+_0x5c0bb8[_0xac4a('0x35')][_0xac4a('0x45')]+'%'};return _0x2d755c;})});}_0x1da257=_[_0xac4a('0x44')]({},_0x1da257,_0x5c0bb8[_0xac4a('0x4f')]);return _0x1064ea['getApplications'](_0x1da257);}})[_0xac4a('0x17')](function(_0x5f2b3d){if(_0x5f2b3d){_0x8c1fa5=_0x5f2b3d[_0xac4a('0x3a')];if(!_0x5c0bb8[_0xac4a('0x35')][_0xac4a('0x3b')](_0xac4a('0x3c'))){_0x1da257[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x5c0bb8[_0xac4a('0x35')]['limit']);_0x1da257[_0xac4a('0x27')]=qs['offset'](_0x5c0bb8[_0xac4a('0x35')][_0xac4a('0x27')]);}return _0x1064ea[_0xac4a('0x89')](_0x1da257);}})[_0xac4a('0x17')](function(_0x1a06be){if(_0x1a06be){return _0x1a06be?{'count':_0x8c1fa5,'rows':_0x1a06be}:null;}})[_0xac4a('0x17')](respondWithResult(_0x5b1934,null))[_0xac4a('0x21')](handleError(_0x5b1934,null));};exports[_0xac4a('0x8a')]=function(_0x54240d,_0xd2c48d,_0x489208){var _0x13323c={'raw':!![],'where':{}};var _0x154b0f={};var _0x53179d={'count':0x0,'rows':[]};return db[_0xac4a('0x32')][_0xac4a('0x6f')]({'where':{'id':_0x54240d[_0xac4a('0x49')]['id']}})['then'](handleEntityNotFound(_0xd2c48d,null))['then'](function(_0x40c49b){if(_0x40c49b){_0x154b0f['model']=_[_0xac4a('0x4c')](db['MailMessage']['rawAttributes']);_0x154b0f[_0xac4a('0x35')]=_[_0xac4a('0x4c')](_0x54240d[_0xac4a('0x35')]);_0x154b0f['filters']=_[_0xac4a('0x4d')](_0x154b0f[_0xac4a('0x34')],_0x154b0f['query']);_0x13323c[_0xac4a('0x39')]=_[_0xac4a('0x4d')](_0x154b0f['model'],qs[_0xac4a('0x38')](_0x54240d[_0xac4a('0x35')][_0xac4a('0x38')]));_0x13323c[_0xac4a('0x39')]=_0x13323c[_0xac4a('0x39')][_0xac4a('0x3a')]?_0x13323c[_0xac4a('0x39')]:_0x154b0f[_0xac4a('0x34')];if(!_0x54240d['query'][_0xac4a('0x3b')]('nolimit')){_0x13323c[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x54240d[_0xac4a('0x35')][_0xac4a('0x28')]);_0x13323c[_0xac4a('0x27')]=qs[_0xac4a('0x27')](_0x54240d['query'][_0xac4a('0x27')]);}_0x13323c[_0xac4a('0x3d')]=qs[_0xac4a('0x3e')](_0x54240d[_0xac4a('0x35')][_0xac4a('0x3e')]);_0x13323c[_0xac4a('0x3f')]=qs[_0xac4a('0x37')](_[_0xac4a('0x40')](_0x54240d['query'],_0x154b0f[_0xac4a('0x37')]));_0x13323c['where'][_0xac4a('0x54')]=_0x40c49b['id'];if(_0x54240d[_0xac4a('0x35')][_0xac4a('0x45')]){_0x13323c[_0xac4a('0x3f')]=_['merge'](_0x13323c['where'],{'$or':_[_0xac4a('0x46')](_0x13323c[_0xac4a('0x39')],function(_0x9d48b){var _0x362ce1={};_0x362ce1[_0x9d48b]={'$like':'%'+_0x54240d[_0xac4a('0x35')][_0xac4a('0x45')]+'%'};return _0x362ce1;})});}if(_0x54240d['query'][_0xac4a('0x8b')]){var _0x301d17=_0x54240d[_0xac4a('0x35')]['$gte'][_0xac4a('0x8c')](',');var _0x1aa170={};_0x1aa170[_0x301d17[0x0]]={'$gte':moment(_0x301d17[0x1])[_0xac4a('0x8d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13323c['where']=_[_0xac4a('0x44')](_0x13323c[_0xac4a('0x3f')],_0x1aa170);}_0x13323c=_[_0xac4a('0x44')]({},_0x13323c,_0x54240d[_0xac4a('0x4f')]);return db[_0xac4a('0x8e')][_0xac4a('0x26')]({'where':_0x13323c[_0xac4a('0x3f')]})[_0xac4a('0x17')](function(_0x394698){_0x53179d['count']=_0x394698;if(_0x54240d['query'][_0xac4a('0x4e')]){_0x13323c[_0xac4a('0x58')]=[{'all':!![]}];}return db[_0xac4a('0x8e')]['findAll'](_0x13323c);})[_0xac4a('0x17')](function(_0x152dbc){_0x53179d[_0xac4a('0x47')]=_0x152dbc;return _0x53179d;});}})['then'](respondWithFilteredResult(_0xd2c48d,_0x13323c))['catch'](handleError(_0xd2c48d,null));};exports[_0xac4a('0x2e')]=function(_0x56e3c4,_0x12b470,_0x10da11){var _0x5a9872,_0x149121={},_0x1f55b9;if(_0x56e3c4['body']['to']){_0x1f55b9=_0x56e3c4[_0xac4a('0x52')]['to'][_0xac4a('0x8c')](',')[0x0];}return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x56e3c4[_0xac4a('0x49')]['id']},'include':[{'model':db[_0xac4a('0x8f')],'as':_0xac4a('0x90'),'include':[{'model':db[_0xac4a('0x7a')],'as':_0xac4a('0x91'),'where':{'email':_0x1f55b9},'limit':0x1,'order':[['updatedAt',_0xac4a('0x92')]]}]},{'model':db[_0xac4a('0x4a')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x12b470,null))['then'](function(_0x12fec5){if(_0x12fec5){_0x5a9872=_0x12fec5;if(_0x12fec5[_0xac4a('0x4b')]){if(_[_0xac4a('0x61')](_0x56e3c4[_0xac4a('0x52')][_0xac4a('0x93')])){_0x56e3c4[_0xac4a('0x52')][_0xac4a('0x93')]=util[_0xac4a('0x8d')]('%s\x20<%s>',_0x12fec5['name'],_0x12fec5['email']||_0x12fec5[_0xac4a('0x4b')]['user']);}if(_0x56e3c4['body'][_0xac4a('0x94')]&&_0x56e3c4['body']['attachments']['length']){for(var _0x1df306=0x0;_0x1df306<_0x56e3c4[_0xac4a('0x52')][_0xac4a('0x94')][_0xac4a('0x3a')];_0x1df306+=0x1){_0x56e3c4[_0xac4a('0x52')][_0xac4a('0x94')][_0x1df306]={'filename':_0x56e3c4[_0xac4a('0x52')][_0xac4a('0x94')][_0x1df306][_0xac4a('0x2d')],'path':path[_0xac4a('0x95')](config[_0xac4a('0x96')],_0xac4a('0x97'),_0x56e3c4[_0xac4a('0x52')]['attachments'][_0x1df306][_0xac4a('0x98')])};}}var _0x52b15d={'tls':{'rejectUnauthorized':![]}};if(_[_0xac4a('0x61')](_0x12fec5[_0xac4a('0x4b')][_0xac4a('0x6d')])){if(_0x12fec5[_0xac4a('0x4b')][_0xac4a('0x6a')]){_0x52b15d[_0xac4a('0x99')]={'user':_0x12fec5['Smtp'][_0xac4a('0x66')],'pass':_0x12fec5[_0xac4a('0x4b')][_0xac4a('0x6e')]};}_0x52b15d['host']=_0x12fec5[_0xac4a('0x4b')]['host'];_0x52b15d[_0xac4a('0x6c')]=_0x12fec5[_0xac4a('0x4b')][_0xac4a('0x6c')];_0x52b15d['secure']=_0x12fec5[_0xac4a('0x4b')][_0xac4a('0x9a')];}else{_0x52b15d['service']=_0x12fec5[_0xac4a('0x4b')][_0xac4a('0x6d')];_0x52b15d['auth']={'user':_0x12fec5[_0xac4a('0x4b')]['user'],'pass':_0x12fec5[_0xac4a('0x4b')][_0xac4a('0x6e')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x52b15d,'message':_0x56e3c4['body']});}else{throw new Error('List\x20not\x20found');}}})[_0xac4a('0x17')](function(_0x566369){if(_0x566369){_0x149121=_0x566369;if(_0x5a9872[_0xac4a('0x90')]){if(_0x5a9872[_0xac4a('0x90')][_0xac4a('0x91')]['length']){return _0x5a9872[_0xac4a('0x90')][_0xac4a('0x91')][0x0];}else{return db[_0xac4a('0x7a')]['create'](_[_0xac4a('0x9b')](_0x56e3c4['body'],{'firstName':_0x56e3c4[_0xac4a('0x52')]['to'],'email':_0x56e3c4[_0xac4a('0x52')]['to'],'phone':_0x56e3c4['body']['to'],'ListId':_0x5a9872[_0xac4a('0x9c')]}));}}else{throw new Error(_0xac4a('0x9d'));}}})[_0xac4a('0x17')](function(_0x2de603){if(_0x2de603){var _0x4f6540={'UserId':_0x56e3c4[_0xac4a('0x66')]['id'],'ContactId':_0x2de603['id'],'MailAccountId':_0x5a9872['id'],'inReplyTo':_0x149121[_0xac4a('0x9e')],'to':_0x56e3c4[_0xac4a('0x52')][_0xac4a('0x93')],'cc':_0x56e3c4[_0xac4a('0x52')]['cc'],'subject':_0x56e3c4[_0xac4a('0x52')][_0xac4a('0x9f')],'attach':_0x56e3c4['body']['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xac4a('0x8d')](_0xac4a('0xa0')),'lastMsgDirection':'out','lastMsgBody':_0x56e3c4[_0xac4a('0x52')][_0xac4a('0x52')],'Messages':[_[_0xac4a('0x44')](_0x56e3c4[_0xac4a('0x52')],{'messageId':_0x149121['messageId'],'sentAt':moment()[_0xac4a('0x8d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5a9872['id'],'UserId':_0x56e3c4[_0xac4a('0x66')]['id'],'ContactId':_0x2de603['id']})]};if(_0x56e3c4[_0xac4a('0x52')]['Interaction']){_0x4f6540=_[_0xac4a('0x44')](_0x4f6540,_0x56e3c4['body']['Interaction']);}return db['MailInteraction'][_0xac4a('0x56')](_0x4f6540,{'include':[{'model':db[_0xac4a('0x8e')],'as':'Messages'}]});}})[_0xac4a('0x17')](respondWithResult(_0x12b470,null))[_0xac4a('0x21')](handleError(_0x12b470,null));};exports[_0xac4a('0xa1')]=function(_0x209fa5,_0x280793,_0x2e982e){return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x209fa5[_0xac4a('0x49')]['id']},'include':[{'model':db[_0xac4a('0x4a')],'as':_0xac4a('0x4b'),'raw':!![]}]})[_0xac4a('0x17')](handleEntityNotFound(_0x280793,null))['then'](function(_0x4ee1d8){if(_0x4ee1d8&&_0x4ee1d8[_0xac4a('0x4b')]){var _0x1f29a4={'id':_0x4ee1d8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4ee1d8[_0xac4a('0x4b')][_0xac4a('0x6d')]){_0x1f29a4[_0xac4a('0x6d')]=_0x4ee1d8['Smtp'][_0xac4a('0x6d')];}else{_0x1f29a4['host']=_0x4ee1d8['Smtp']['host'];_0x1f29a4['port']=_0x4ee1d8[_0xac4a('0x4b')][_0xac4a('0x6c')];_0x1f29a4['secure']=_0x4ee1d8[_0xac4a('0x4b')]['secure'];}if(_0x4ee1d8[_0xac4a('0x4b')][_0xac4a('0x6a')]){_0x1f29a4[_0xac4a('0x99')]={'user':_0x4ee1d8['Smtp'][_0xac4a('0x66')],'pass':_0x4ee1d8[_0xac4a('0x4b')]['pass']};}return respondWithRpcPromise(_0xac4a('0xa2'),_0xac4a('0xa1'),{'account':_0x1f29a4});}})['then'](respondWithResult(_0x280793,null))[_0xac4a('0x21')](handleError(_0x280793,null));};exports[_0xac4a('0x85')]=function(_0x22a80e,_0x31ffc9){return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x22a80e['params']['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x31ffc9,null))[_0xac4a('0x17')](function(_0x335761){if(_0x335761&&_0x335761[_0xac4a('0x6d')]){throw new db['Sequelize'][(_0xac4a('0xa3'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x335761;})[_0xac4a('0x17')](removeEntity(_0x31ffc9,null))[_0xac4a('0x21')](handleError(_0x31ffc9,null));};exports[_0xac4a('0xa4')]=function(_0x3a313f,_0x2df560,_0x18377e){return db[_0xac4a('0x32')][_0xac4a('0x50')]({'where':{'id':_0x3a313f['params']['id']}})['then'](handleEntityNotFound(_0x2df560,null))[_0xac4a('0x17')](function(_0x33fddd){if(_0x33fddd){return _0x33fddd[_0xac4a('0xa4')](_0x3a313f[_0xac4a('0x52')]['ids'],_[_0xac4a('0x79')](_0x3a313f[_0xac4a('0x52')],[_0xac4a('0x5a'),'id'])||{})[_0xac4a('0xa5')](function(_0xd9e646){for(var _0x1d2662=0x0;_0x1d2662<_0x3a313f[_0xac4a('0x52')][_0xac4a('0x5a')][_0xac4a('0x3a')];_0x1d2662+=0x1){socket['emit'](_0xac4a('0xa6'),{'UserId':_0x3a313f['body'][_0xac4a('0x5a')][_0x1d2662],'MailAccountId':_0x3a313f[_0xac4a('0x49')]['id']});}return _0xd9e646;});}})[_0xac4a('0x17')](respondWithResult(_0x2df560,null))[_0xac4a('0x21')](handleError(_0x2df560,null));};exports[_0xac4a('0xa7')]=function(_0x4292e9,_0x3177a7,_0x4e7120){var _0x5a45bd;return db[_0xac4a('0x32')]['find']({'where':{'id':_0x4292e9[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x3177a7,null))[_0xac4a('0x17')](function(_0x36121d){if(_0x36121d){return _0x36121d[_0xac4a('0xa7')](_0x4292e9['query'][_0xac4a('0x5a')])[_0xac4a('0x17')](function(_0x1e7fd8){if(_[_0xac4a('0xa8')](_0x4292e9['query']['ids'])){for(var _0xba7953=0x0;_0xba7953<_0x4292e9['query'][_0xac4a('0x5a')][_0xac4a('0x3a')];_0xba7953+=0x1){socket[_0xac4a('0xa9')](_0xac4a('0xaa'),{'UserId':_0x4292e9[_0xac4a('0x35')][_0xac4a('0x5a')][_0xba7953],'MailAccountId':_0x4292e9[_0xac4a('0x49')]['id']});}}else{socket[_0xac4a('0xa9')](_0xac4a('0xaa'),{'UserId':_0x4292e9[_0xac4a('0x35')][_0xac4a('0x5a')],'MailAccountId':_0x4292e9['params']['id']});}});}})['then'](respondWithStatusCode(_0x3177a7,null))[_0xac4a('0x21')](handleError(_0x3177a7,null));};exports[_0xac4a('0xab')]=function(_0x21dda5,_0x482c0e,_0x548b76){var _0x1430aa={};var _0x6ee160={};var _0x5a93b1;var _0xec92e4;return db[_0xac4a('0x32')]['findOne']({'where':{'id':_0x21dda5[_0xac4a('0x49')]['id']}})[_0xac4a('0x17')](handleEntityNotFound(_0x482c0e,null))['then'](function(_0x4c05df){if(_0x4c05df){_0x5a93b1=_0x4c05df;_0x6ee160['model']=_[_0xac4a('0x4c')](db[_0xac4a('0xac')][_0xac4a('0x33')]);_0x6ee160['query']=_[_0xac4a('0x4c')](_0x21dda5[_0xac4a('0x35')]);_0x6ee160['filters']=_['intersection'](_0x6ee160[_0xac4a('0x34')],_0x6ee160[_0xac4a('0x35')]);_0x1430aa[_0xac4a('0x39')]=_['intersection'](_0x6ee160[_0xac4a('0x34')],qs[_0xac4a('0x38')](_0x21dda5[_0xac4a('0x35')][_0xac4a('0x38')]));_0x1430aa[_0xac4a('0x39')]=_0x1430aa[_0xac4a('0x39')][_0xac4a('0x3a')]?_0x1430aa[_0xac4a('0x39')]:_0x6ee160[_0xac4a('0x34')];_0x1430aa[_0xac4a('0x3d')]=qs[_0xac4a('0x3e')](_0x21dda5['query']['sort']);_0x1430aa['where']=qs[_0xac4a('0x37')](_[_0xac4a('0x40')](_0x21dda5[_0xac4a('0x35')],_0x6ee160[_0xac4a('0x37')]));if(_0x21dda5[_0xac4a('0x35')]['filter']){_0x1430aa[_0xac4a('0x3f')]=_['merge'](_0x1430aa[_0xac4a('0x3f')],{'$or':_[_0xac4a('0x46')](_0x1430aa['attributes'],function(_0x27a220){var _0x5f219a={};_0x5f219a[_0x27a220]={'$like':'%'+_0x21dda5[_0xac4a('0x35')][_0xac4a('0x45')]+'%'};return _0x5f219a;})});}_0x1430aa=_[_0xac4a('0x44')]({},_0x1430aa,_0x21dda5[_0xac4a('0x4f')]);return _0x5a93b1['getAgents'](_0x1430aa);}})[_0xac4a('0x17')](function(_0x3223e0){if(_0x3223e0){_0xec92e4=_0x3223e0['length'];if(!_0x21dda5[_0xac4a('0x35')]['hasOwnProperty'](_0xac4a('0x3c'))){_0x1430aa[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x21dda5['query'][_0xac4a('0x28')]);_0x1430aa[_0xac4a('0x27')]=qs[_0xac4a('0x27')](_0x21dda5['query'][_0xac4a('0x27')]);}return _0x5a93b1['getAgents'](_0x1430aa);}})[_0xac4a('0x17')](function(_0x1c74c9){if(_0x1c74c9){return _0x1c74c9?{'count':_0xec92e4,'rows':_0x1c74c9}:null;}})[_0xac4a('0x17')](respondWithResult(_0x482c0e,null))[_0xac4a('0x21')](handleError(_0x482c0e,null));}; \ No newline at end of file +var _0x814b=['getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','MailApplication','bulkCreate','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','updatedAt','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','pass','secure','SendMail','List\x20not\x20found','Contacts','defaults','messageId','subject','out','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailAccount.socket','register','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','destroy','stack','name','send','index','Imap','MailServerOut','Smtp','MailAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','add','day','merge','map','attributes','filter','options','includeAll','include','findAll','rows','params','MailServerIn','find','catch','body','update','describe','addDisposition','MailAccountId','Disposition','create','findOne','sort','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','key','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','authentication','host','port','service'];(function(_0x2f2861,_0x290553){var _0x1def4e=function(_0x4358cb){while(--_0x4358cb){_0x2f2861['push'](_0x2f2861['shift']());}};_0x1def4e(++_0x290553);}(_0x814b,0x1a2));var _0xb814=function(_0x4734d8,_0x479950){_0x4734d8=_0x4734d8-0x0;var _0x3b1120=_0x814b[_0x4734d8];return _0x3b1120;};'use strict';var jsonpatch=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var Mustache=require(_0xb814('0x4'));var util=require(_0xb814('0x5'));var path=require('path');var sox=require(_0xb814('0x6'));var csv=require(_0xb814('0x7'));var ejs=require(_0xb814('0x8'));var fs=require('fs');var _=require(_0xb814('0x9'));var squel=require(_0xb814('0xa'));var crypto=require(_0xb814('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb814('0xc'));var toCsv=require(_0xb814('0x7'));var querystring=require('querystring');var Papa=require(_0xb814('0xd'));var qs=require(_0xb814('0xe'));var logger=require(_0xb814('0xf'))(_0xb814('0x10'));var utils=require(_0xb814('0x11'));var config=require(_0xb814('0x12'));var db=require(_0xb814('0x13'))['db'];var socket=require(_0xb814('0x14'))({'host':_0xb814('0x15'),'port':0x18eb});require(_0xb814('0x16'))[_0xb814('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb814('0x18')]['http']({'port':0x232b});function respondWithRpcPromise(_0x26b35f,_0x15d6ef,_0x35b10d,_0x2cc46b){return new BPromise(function(_0x2ce718,_0x3bde14){var _0x1438e7=_0x2cc46b||client;return _0x1438e7[_0xb814('0x19')](_0x26b35f,_0x35b10d)[_0xb814('0x1a')](function(_0x2ab627){logger[_0xb814('0x1b')](_0xb814('0x1c'),_0x15d6ef,_0xb814('0x1d'));logger[_0xb814('0x1e')](_0xb814('0x1f'),_0x15d6ef,_0xb814('0x1d'),JSON[_0xb814('0x20')](_0x2ab627));if(_0x2ab627[_0xb814('0x21')]){if(_0x2ab627[_0xb814('0x21')][_0xb814('0x22')]===0x1f4){logger[_0xb814('0x21')]('MailAccount,\x20%s,\x20%s',_0x15d6ef,_0x2ab627[_0xb814('0x21')]['message']);return _0x3bde14(_0x2ab627[_0xb814('0x21')][_0xb814('0x23')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x15d6ef,_0x2ab627['error'][_0xb814('0x23')]);return _0x2ce718(_0x2ab627['error']['message']);}else{logger[_0xb814('0x1b')](_0xb814('0x1c'),_0x15d6ef,_0xb814('0x1d'));_0x2ce718(_0x2ab627['result'][_0xb814('0x23')]);}})['catch'](function(_0x1e6393){logger[_0xb814('0x21')](_0xb814('0x1c'),_0x15d6ef,_0x1e6393);_0x3bde14(_0x1e6393);});});}function respondWithStatusCode(_0x470e81,_0x27352e){_0x27352e=_0x27352e||0xcc;return function(_0x2bd039){if(_0x2bd039){return _0x470e81[_0xb814('0x24')](_0x27352e);}return _0x470e81['status'](_0x27352e)[_0xb814('0x25')]();};}function respondWithResult(_0x52b7a3,_0x3f81d0){_0x3f81d0=_0x3f81d0||0xc8;return function(_0x457dac){if(_0x457dac){return _0x52b7a3[_0xb814('0x26')](_0x3f81d0)[_0xb814('0x27')](_0x457dac);}};}function respondWithFilteredResult(_0x1c8a2e,_0xb9e57d){return function(_0x3d836c){if(_0x3d836c){var _0x5755ea=_0x3d836c[_0xb814('0x28')],_0x392222=_0xb9e57d[_0xb814('0x29')],_0xc0ef66=_0xb9e57d[_0xb814('0x29')]+_0xb9e57d[_0xb814('0x2a')],_0x1c2625;if(_0xc0ef66>=_0x5755ea){_0xc0ef66=_0x5755ea;_0x1c2625=0xc8;}else{_0x1c2625=0xce;}_0x1c8a2e[_0xb814('0x26')](_0x1c2625);return _0x1c8a2e['set'](_0xb814('0x2b'),_0x392222+'-'+_0xc0ef66+'/'+_0x5755ea)[_0xb814('0x27')](_0x3d836c);}return null;};}function patchUpdates(_0x52ed64){return function(_0x9008b2){try{jsonpatch[_0xb814('0x2c')](_0x9008b2,_0x52ed64,!![]);}catch(_0x530744){return BPromise['reject'](_0x530744);}return _0x9008b2[_0xb814('0x2d')]();};}function saveUpdates(_0x2051d0,_0x58c3ca){return function(_0x338a28){if(_0x338a28){return _0x338a28['update'](_0x2051d0)[_0xb814('0x1a')](function(_0x5f3e9b){return _0x5f3e9b;});}return null;};}function removeEntity(_0x4cfc58,_0x419cd9){return function(_0x4a4f27){if(_0x4a4f27){return _0x4a4f27[_0xb814('0x2e')]()[_0xb814('0x1a')](function(){_0x4cfc58[_0xb814('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d5ae,_0x26d3a9){return function(_0x336e2b){if(!_0x336e2b){_0x51d5ae['sendStatus'](0x194);}return _0x336e2b;};}function handleError(_0x2c8943,_0xe558d5){_0xe558d5=_0xe558d5||0x1f4;return function(_0x692c72){logger[_0xb814('0x21')](_0x692c72[_0xb814('0x2f')]);if(_0x692c72[_0xb814('0x30')]){delete _0x692c72[_0xb814('0x30')];}_0x2c8943['status'](_0xe558d5)[_0xb814('0x31')](_0x692c72);};}exports[_0xb814('0x32')]=function(_0x30de5a,_0x424e2b){var _0x14100d={'include':[{'model':db['MailServerIn'],'as':_0xb814('0x33')},{'model':db[_0xb814('0x34')],'as':_0xb814('0x35')}]},_0x4ff31a={},_0x16ef82={'count':0x0,'rows':[]};var _0x492d5e=db[_0xb814('0x36')][_0xb814('0x37')];_0x4ff31a['model']=_[_0xb814('0x38')](_0x492d5e);var _0x2d0e27={'dateStart':_0x30de5a[_0xb814('0x39')][_0xb814('0x3a')],'dateEnd':_0x30de5a[_0xb814('0x39')][_0xb814('0x3b')]};delete _0x30de5a['query'][_0xb814('0x3a')];delete _0x30de5a['query'][_0xb814('0x3b')];_0x4ff31a['query']=_[_0xb814('0x38')](_0x30de5a['query']);_0x4ff31a[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x4ff31a['model'],_0x4ff31a['query']);_0x14100d['attributes']=_['intersection'](_0x4ff31a[_0xb814('0x3e')],qs[_0xb814('0x3f')](_0x30de5a[_0xb814('0x39')][_0xb814('0x3f')]));_0x14100d['attributes']=_0x14100d['attributes'][_0xb814('0x40')]?_0x14100d['attributes']:_0x4ff31a[_0xb814('0x3e')];if(!_0x30de5a[_0xb814('0x39')][_0xb814('0x41')](_0xb814('0x42'))){_0x14100d[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x30de5a[_0xb814('0x39')][_0xb814('0x2a')]);_0x14100d[_0xb814('0x29')]=qs['offset'](_0x30de5a['query']['offset']);}_0x14100d[_0xb814('0x43')]=qs['sort'](_0x30de5a[_0xb814('0x39')]['sort']);_0x14100d[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x30de5a[_0xb814('0x39')],_0x4ff31a['filters']));if(_0x2d0e27[_0xb814('0x3a')]){if(_0x2d0e27[_0xb814('0x3b')]){_0x2d0e27[_0xb814('0x3b')]=moment(_0x2d0e27[_0xb814('0x3b')])[_0xb814('0x46')](0x1,_0xb814('0x47'));}else{_0x2d0e27['dateEnd']=moment(_0x2d0e27[_0xb814('0x3a')])[_0xb814('0x46')](0x1,_0xb814('0x47'));}_[_0xb814('0x48')](_0x14100d[_0xb814('0x44')],{'createdAt':{'$gte':_0x2d0e27[_0xb814('0x3a')],'$lte':_0x2d0e27[_0xb814('0x3b')]}});}if(_0x30de5a['query']['filter']){_0x14100d[_0xb814('0x44')]=_[_0xb814('0x48')](_0x14100d[_0xb814('0x44')],{'$or':_[_0xb814('0x49')](_0x14100d[_0xb814('0x4a')],function(_0x40e627){var _0x24b697={};_0x24b697[_0x40e627]={'$like':'%'+_0x30de5a[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x24b697;})});}_0x14100d=_[_0xb814('0x48')]({},_0x14100d,_0x30de5a[_0xb814('0x4c')]);var _0x5c7a49={'where':_0x14100d[_0xb814('0x44')]};return db[_0xb814('0x36')]['count'](_0x5c7a49)[_0xb814('0x1a')](function(_0x55234d){_0x16ef82[_0xb814('0x28')]=_0x55234d;if(_0x30de5a[_0xb814('0x39')][_0xb814('0x4d')]){_0x14100d[_0xb814('0x4e')]=[{'all':!![]}];}return db[_0xb814('0x36')][_0xb814('0x4f')](_0x14100d);})[_0xb814('0x1a')](function(_0x45480e){_0x16ef82[_0xb814('0x50')]=_0x45480e;return _0x16ef82;})[_0xb814('0x1a')](respondWithFilteredResult(_0x424e2b,_0x14100d))['catch'](handleError(_0x424e2b,null));};exports['show']=function(_0x32eca6,_0x30f07b){var _0x4156d8={'raw':![],'where':{'id':_0x32eca6[_0xb814('0x51')]['id']},'include':[{'model':db[_0xb814('0x52')],'as':_0xb814('0x33')},{'model':db['MailServerOut'],'as':_0xb814('0x35')}]},_0x3f8e29={};_0x3f8e29[_0xb814('0x3e')]=_[_0xb814('0x38')](db['MailAccount'][_0xb814('0x37')]);_0x3f8e29['query']=_[_0xb814('0x38')](_0x32eca6['query']);_0x3f8e29[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x3f8e29['model'],_0x3f8e29[_0xb814('0x39')]);_0x4156d8[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x3f8e29['model'],qs[_0xb814('0x3f')](_0x32eca6['query'][_0xb814('0x3f')]));_0x4156d8[_0xb814('0x4a')]=_0x4156d8['attributes'][_0xb814('0x40')]?_0x4156d8['attributes']:_0x3f8e29['model'];if(_0x32eca6[_0xb814('0x39')][_0xb814('0x4d')]){_0x4156d8[_0xb814('0x4e')]=[{'all':!![]}];}_0x4156d8=_['merge']({},_0x4156d8,_0x32eca6[_0xb814('0x4c')]);return db['MailAccount'][_0xb814('0x53')](_0x4156d8)[_0xb814('0x1a')](handleEntityNotFound(_0x30f07b,null))['then'](respondWithResult(_0x30f07b,null))[_0xb814('0x54')](handleError(_0x30f07b,null));};exports['update']=function(_0x25a607,_0x1656ed){if(_0x25a607[_0xb814('0x55')]['id']){delete _0x25a607[_0xb814('0x55')]['id'];}return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x25a607[_0xb814('0x51')]['id']},'include':[{'model':db[_0xb814('0x52')],'as':'Imap'},{'model':db[_0xb814('0x34')],'as':_0xb814('0x35')}]})['then'](handleEntityNotFound(_0x1656ed,null))[_0xb814('0x1a')](saveUpdates(_0x25a607[_0xb814('0x55')],null))['then'](function(_0x371000){if(_0x371000&&_0x25a607['body']['Imap']){return db[_0xb814('0x52')]['update'](_0x25a607[_0xb814('0x55')][_0xb814('0x33')],{'where':{'MailAccountId':_0x371000['id']}})[_0xb814('0x1a')](function(){return _0x371000;});}return _0x371000;})['then'](function(_0x1a0ef4){if(_0x1a0ef4&&_0x25a607['body'][_0xb814('0x35')]){return db[_0xb814('0x34')][_0xb814('0x56')](_0x25a607[_0xb814('0x55')][_0xb814('0x35')],{'where':{'MailAccountId':_0x1a0ef4['id']}})[_0xb814('0x1a')](function(){return _0x1a0ef4;});}return _0x1a0ef4;})[_0xb814('0x1a')](respondWithResult(_0x1656ed,null))[_0xb814('0x54')](handleError(_0x1656ed,null));};exports[_0xb814('0x57')]=function(_0x4d611d,_0x211194){return db[_0xb814('0x36')][_0xb814('0x57')]()[_0xb814('0x1a')](respondWithResult(_0x211194,null))[_0xb814('0x54')](handleError(_0x211194,null));};exports[_0xb814('0x58')]=function(_0x52edfa,_0x135e13,_0x4ccd94){if(_0x52edfa[_0xb814('0x55')]['id']){delete _0x52edfa[_0xb814('0x55')]['id'];}return db[_0xb814('0x36')]['find']({'where':{'id':_0x52edfa[_0xb814('0x51')]['id']}})['then'](handleEntityNotFound(_0x135e13,null))[_0xb814('0x1a')](function(_0x4a65d0){if(_0x4a65d0){_0x52edfa[_0xb814('0x55')][_0xb814('0x59')]=_0x4a65d0['id'];return db[_0xb814('0x5a')][_0xb814('0x5b')](_0x52edfa[_0xb814('0x55')]);}})[_0xb814('0x1a')](respondWithResult(_0x135e13,null))[_0xb814('0x54')](handleError(_0x135e13,null));};exports['getDispositions']=function(_0x44088d,_0x51ca51,_0x255047){var _0x22c73f={'raw':![],'where':{}};var _0x1b989d={};var _0x3dcaeb={'count':0x0,'rows':[]};return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x44088d['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x51ca51,null))[_0xb814('0x1a')](function(_0x4a49ba){if(_0x4a49ba){_0x1b989d[_0xb814('0x3e')]=_[_0xb814('0x38')](db[_0xb814('0x5a')][_0xb814('0x37')]);_0x1b989d[_0xb814('0x39')]=_['keys'](_0x44088d[_0xb814('0x39')]);_0x1b989d['filters']=_[_0xb814('0x3d')](_0x1b989d[_0xb814('0x3e')],_0x1b989d[_0xb814('0x39')]);_0x22c73f[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x1b989d[_0xb814('0x3e')],qs['fields'](_0x44088d['query']['fields']));_0x22c73f[_0xb814('0x4a')]=_0x22c73f['attributes'][_0xb814('0x40')]?_0x22c73f[_0xb814('0x4a')]:_0x1b989d[_0xb814('0x3e')];if(!_0x44088d['query'][_0xb814('0x41')](_0xb814('0x42'))){_0x22c73f[_0xb814('0x2a')]=qs['limit'](_0x44088d[_0xb814('0x39')][_0xb814('0x2a')]);_0x22c73f[_0xb814('0x29')]=qs[_0xb814('0x29')](_0x44088d['query']['offset']);}_0x22c73f[_0xb814('0x43')]=qs[_0xb814('0x5d')](_0x44088d[_0xb814('0x39')][_0xb814('0x5d')]);_0x22c73f[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x44088d[_0xb814('0x39')],_0x1b989d[_0xb814('0x3c')]));_0x22c73f[_0xb814('0x44')][_0xb814('0x59')]=_0x4a49ba['id'];if(_0x44088d[_0xb814('0x39')][_0xb814('0x4b')]){_0x22c73f[_0xb814('0x44')]=_[_0xb814('0x48')](_0x22c73f['where'],{'$or':_[_0xb814('0x49')](_0x22c73f[_0xb814('0x4a')],function(_0xfc9a65){var _0x357b90={};_0x357b90[_0xfc9a65]={'$like':'%'+_0x44088d[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x357b90;})});}_0x22c73f=_['merge']({},_0x22c73f,_0x44088d[_0xb814('0x4c')]);return db['Disposition'][_0xb814('0x28')]({'where':_0x22c73f[_0xb814('0x44')]})[_0xb814('0x1a')](function(_0x2292e6){_0x3dcaeb[_0xb814('0x28')]=_0x2292e6;if(_0x44088d['query']['includeAll']){_0x22c73f[_0xb814('0x4e')]=[{'all':!![]}];}return db[_0xb814('0x5a')][_0xb814('0x4f')](_0x22c73f);})[_0xb814('0x1a')](function(_0x488ef2){_0x3dcaeb[_0xb814('0x50')]=_0x488ef2;return _0x3dcaeb;});}})['then'](respondWithFilteredResult(_0x51ca51,_0x22c73f))[_0xb814('0x54')](handleError(_0x51ca51,null));};exports[_0xb814('0x5e')]=function(_0x488314,_0x58b016,_0x2fa6b7){var _0x52e17a;return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x488314[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x58b016,null))[_0xb814('0x1a')](function(_0x420bde){if(_0x420bde){return _0x420bde[_0xb814('0x5e')](_0x488314['query'][_0xb814('0x5f')]);}})['then'](respondWithStatusCode(_0x58b016,null))[_0xb814('0x54')](handleError(_0x58b016,null));};exports['addAnswer']=function(_0x2838cb,_0x43ee60,_0x58d56c){if(_0x2838cb[_0xb814('0x55')]['id']){delete _0x2838cb['body']['id'];}return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x2838cb['params']['id']}})['then'](handleEntityNotFound(_0x43ee60,null))[_0xb814('0x1a')](function(_0x25d976){if(_0x25d976){_0x2838cb[_0xb814('0x55')][_0xb814('0x59')]=_0x25d976['id'];return db[_0xb814('0x60')][_0xb814('0x5b')](_0x2838cb[_0xb814('0x55')]);}})[_0xb814('0x1a')](respondWithResult(_0x43ee60,null))[_0xb814('0x54')](handleError(_0x43ee60,null));};exports[_0xb814('0x61')]=function(_0x53e705,_0x5b0fcd,_0x5bee4d){var _0x5470e4={'raw':![],'where':{}};var _0x52b6da={};var _0x45a202={'count':0x0,'rows':[]};return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x53e705['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x5b0fcd,null))[_0xb814('0x1a')](function(_0x31c072){if(_0x31c072){_0x52b6da[_0xb814('0x3e')]=_[_0xb814('0x38')](db[_0xb814('0x60')][_0xb814('0x37')]);_0x52b6da[_0xb814('0x39')]=_['keys'](_0x53e705[_0xb814('0x39')]);_0x52b6da[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x52b6da[_0xb814('0x3e')],_0x52b6da['query']);_0x5470e4[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x52b6da[_0xb814('0x3e')],qs[_0xb814('0x3f')](_0x53e705[_0xb814('0x39')]['fields']));_0x5470e4['attributes']=_0x5470e4[_0xb814('0x4a')]['length']?_0x5470e4[_0xb814('0x4a')]:_0x52b6da[_0xb814('0x3e')];if(!_0x53e705['query'][_0xb814('0x41')]('nolimit')){_0x5470e4[_0xb814('0x2a')]=qs['limit'](_0x53e705[_0xb814('0x39')][_0xb814('0x2a')]);_0x5470e4[_0xb814('0x29')]=qs[_0xb814('0x29')](_0x53e705[_0xb814('0x39')][_0xb814('0x29')]);}_0x5470e4[_0xb814('0x43')]=qs['sort'](_0x53e705['query'][_0xb814('0x5d')]);_0x5470e4['where']=qs['filters'](_[_0xb814('0x45')](_0x53e705[_0xb814('0x39')],_0x52b6da[_0xb814('0x3c')]));_0x5470e4['where'][_0xb814('0x59')]=_0x31c072['id'];if(_0x53e705['query'][_0xb814('0x4b')]){_0x5470e4[_0xb814('0x44')]=_[_0xb814('0x48')](_0x5470e4[_0xb814('0x44')],{'$or':_['map'](_0x5470e4[_0xb814('0x4a')],function(_0xc0ff3c){var _0x23ce94={};_0x23ce94[_0xc0ff3c]={'$like':'%'+_0x53e705['query'][_0xb814('0x4b')]+'%'};return _0x23ce94;})});}_0x5470e4=_[_0xb814('0x48')]({},_0x5470e4,_0x53e705[_0xb814('0x4c')]);return db['CannedAnswer'][_0xb814('0x28')]({'where':_0x5470e4[_0xb814('0x44')]})[_0xb814('0x1a')](function(_0x216d67){_0x45a202[_0xb814('0x28')]=_0x216d67;if(_0x53e705[_0xb814('0x39')][_0xb814('0x4d')]){_0x5470e4[_0xb814('0x4e')]=[{'all':!![]}];}return db[_0xb814('0x60')][_0xb814('0x4f')](_0x5470e4);})[_0xb814('0x1a')](function(_0x2569a5){_0x45a202[_0xb814('0x50')]=_0x2569a5;return _0x45a202;});}})['then'](respondWithFilteredResult(_0x5b0fcd,_0x5470e4))['catch'](handleError(_0x5b0fcd,null));};exports[_0xb814('0x62')]=function(_0x50697f,_0x320296,_0x3949fd){var _0x43ab12;return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x50697f[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x320296,null))['then'](function(_0x4a460a){if(_0x4a460a){return _0x4a460a[_0xb814('0x62')](_0x50697f['query'][_0xb814('0x5f')]);}})[_0xb814('0x1a')](respondWithStatusCode(_0x320296,null))[_0xb814('0x54')](handleError(_0x320296,null));};exports['create']=function(_0x342f2b,_0x28c358){var _0x35c60f={'name':_0x342f2b[_0xb814('0x55')][_0xb814('0x30')],'key':_0x342f2b['body'][_0xb814('0x63')],'email':_0x342f2b[_0xb814('0x55')]['email'],'ListId':_0x342f2b[_0xb814('0x55')][_0xb814('0x64')],'active':!_[_0xb814('0x65')](_0x342f2b['body'][_0xb814('0x66')])?_0x342f2b[_0xb814('0x55')]['active']:!![],'description':_0x342f2b[_0xb814('0x55')][_0xb814('0x67')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x342f2b[_0xb814('0x55')][_0xb814('0x68')])){if(_0x342f2b[_0xb814('0x55')][_0xb814('0x69')]){_0x35c60f[_0xb814('0x33')][_0xb814('0x6a')]=_0x35c60f[_0xb814('0x35')][_0xb814('0x6a')]=_0x342f2b[_0xb814('0x55')][_0xb814('0x6b')];_0x35c60f[_0xb814('0x33')][_0xb814('0x6c')]=_0x35c60f['Smtp']['pass']=_0x342f2b[_0xb814('0x55')]['cpassword'];}else{_0x35c60f['Imap'][_0xb814('0x6d')]=_0x35c60f['Smtp']['authentication']=![];}_0x35c60f['Imap'][_0xb814('0x6e')]=_0x342f2b[_0xb814('0x55')][_0xb814('0x33')]['host'];_0x35c60f[_0xb814('0x33')]['port']=_0x342f2b[_0xb814('0x55')][_0xb814('0x33')]['port'];_0x35c60f[_0xb814('0x35')]['host']=_0x342f2b[_0xb814('0x55')][_0xb814('0x35')][_0xb814('0x6e')];_0x35c60f[_0xb814('0x35')][_0xb814('0x6f')]=_0x342f2b[_0xb814('0x55')][_0xb814('0x35')][_0xb814('0x6f')];}else{_0x35c60f[_0xb814('0x33')][_0xb814('0x70')]=_0x35c60f[_0xb814('0x35')][_0xb814('0x70')]=_0x342f2b[_0xb814('0x55')][_0xb814('0x68')];_0x35c60f[_0xb814('0x33')]['user']=_0x35c60f[_0xb814('0x35')][_0xb814('0x6a')]=_0x342f2b['body'][_0xb814('0x6b')];_0x35c60f[_0xb814('0x33')][_0xb814('0x6c')]=_0x35c60f['Smtp']['pass']=_0x342f2b[_0xb814('0x55')]['cpassword'];}return db[_0xb814('0x36')]['create'](_0x35c60f,{'include':[{'model':db[_0xb814('0x34')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xb814('0x33')}]})[_0xb814('0x1a')](respondWithResult(_0x28c358,0xc9))[_0xb814('0x54')](handleError(_0x28c358,null));};exports[_0xb814('0x71')]=function(_0x396d76,_0x4339a2,_0x2101b5){return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x396d76[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x4339a2,null))['then'](function(_0x5bd85){if(_0x5bd85){return _0x5bd85['getImap']();}return null;})[_0xb814('0x1a')](respondWithResult(_0x4339a2,null))[_0xb814('0x54')](handleError(_0x4339a2,null));};exports[_0xb814('0x72')]=function(_0x4fde6a,_0x6e5486,_0x18fb74){if(_0x4fde6a[_0xb814('0x55')]['id']){delete _0x4fde6a[_0xb814('0x55')]['id'];}return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x4fde6a[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x6e5486,null))[_0xb814('0x1a')](function(_0x11d14f){if(_0x11d14f){_0x4fde6a[_0xb814('0x55')][_0xb814('0x59')]=_0x11d14f['id'];return db[_0xb814('0x52')][_0xb814('0x5b')](_0x4fde6a[_0xb814('0x55')]);}})['then'](respondWithResult(_0x6e5486,null))[_0xb814('0x54')](handleError(_0x6e5486,null));};exports[_0xb814('0x73')]=function(_0x3e61eb,_0x5200ec,_0x5d8ad5){return db[_0xb814('0x36')]['findOne']({'where':{'id':_0x3e61eb['params']['id']}})['then'](handleEntityNotFound(_0x5200ec,null))['then'](function(_0xaf75b7){if(_0xaf75b7){return _0xaf75b7[_0xb814('0x74')](null);}return null;})['then'](respondWithStatusCode(_0x5200ec,null))[_0xb814('0x54')](handleError(_0x5200ec,null));};exports[_0xb814('0x75')]=function(_0x21485c,_0x3d24c3,_0x277b9a){return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x21485c[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x3d24c3,null))[_0xb814('0x1a')](function(_0x2b82c6){if(_0x2b82c6){return _0x2b82c6['getSmtp']();}return null;})[_0xb814('0x1a')](respondWithResult(_0x3d24c3,null))['catch'](handleError(_0x3d24c3,null));};exports[_0xb814('0x76')]=function(_0x8c4544,_0x35e8f7,_0xa7ff62){if(_0x8c4544[_0xb814('0x55')]['id']){delete _0x8c4544[_0xb814('0x55')]['id'];}return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x8c4544['params']['id']}})['then'](handleEntityNotFound(_0x35e8f7,null))['then'](function(_0xfe3ae4){if(_0xfe3ae4){_0x8c4544[_0xb814('0x55')][_0xb814('0x59')]=_0xfe3ae4['id'];return db[_0xb814('0x34')][_0xb814('0x5b')](_0x8c4544[_0xb814('0x55')]);}})[_0xb814('0x1a')](respondWithResult(_0x35e8f7,null))[_0xb814('0x54')](handleError(_0x35e8f7,null));};exports[_0xb814('0x77')]=function(_0x1a5685,_0x51313d,_0x5c989a){return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x1a5685[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x51313d,null))[_0xb814('0x1a')](function(_0x2642ab){if(_0x2642ab){return _0x2642ab['setSmtp'](null);}return null;})[_0xb814('0x1a')](respondWithStatusCode(_0x51313d,null))['catch'](handleError(_0x51313d,null));};exports[_0xb814('0x78')]=function(_0x27b898,_0x205c6c,_0x94aa05){return db[_0xb814('0x79')][_0xb814('0x53')]({'where':{'id':_0x27b898[_0xb814('0x51')]['id']}})['then'](handleEntityNotFound(_0x205c6c,null))[_0xb814('0x1a')](function(_0x217fbd){if(_0x217fbd){return _0x217fbd[_0xb814('0x78')](_0x27b898[_0xb814('0x55')]['ids'],_[_0xb814('0x7a')](_0x27b898[_0xb814('0x55')],[_0xb814('0x5f'),'id'])||{});}})[_0xb814('0x1a')](respondWithResult(_0x205c6c,null))[_0xb814('0x54')](handleError(_0x205c6c,null));};exports['getInteractions']=function(_0x3812d1,_0x477511,_0x2406c1){var _0x561fcc={'raw':![],'where':{}};var _0x406fb8={};var _0x52ef26={'count':0x0,'rows':[]};return db[_0xb814('0x36')]['findOne']({'where':{'id':_0x3812d1[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x477511,null))[_0xb814('0x1a')](function(_0x2b4601){if(_0x2b4601){_0x406fb8['model']=_[_0xb814('0x38')](db[_0xb814('0x79')][_0xb814('0x37')]);_0x406fb8[_0xb814('0x39')]=_[_0xb814('0x38')](_0x3812d1[_0xb814('0x39')]);_0x406fb8[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x406fb8[_0xb814('0x3e')],_0x406fb8[_0xb814('0x39')]);_0x561fcc[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x406fb8[_0xb814('0x3e')],qs[_0xb814('0x3f')](_0x3812d1[_0xb814('0x39')]['fields']));_0x561fcc[_0xb814('0x4a')]=_0x561fcc[_0xb814('0x4a')][_0xb814('0x40')]?_0x561fcc[_0xb814('0x4a')]:_0x406fb8[_0xb814('0x3e')];if(!_0x3812d1[_0xb814('0x39')]['hasOwnProperty'](_0xb814('0x42'))){_0x561fcc[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x3812d1[_0xb814('0x39')]['limit']);_0x561fcc['offset']=qs[_0xb814('0x29')](_0x3812d1[_0xb814('0x39')][_0xb814('0x29')]);}_0x561fcc[_0xb814('0x43')]=qs[_0xb814('0x5d')](_0x3812d1[_0xb814('0x39')]['sort']);_0x561fcc[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x3812d1[_0xb814('0x39')],_0x406fb8['filters']));_0x561fcc[_0xb814('0x44')][_0xb814('0x59')]=_0x2b4601['id'];if(_0x3812d1[_0xb814('0x39')][_0xb814('0x4b')]){_0x561fcc[_0xb814('0x44')]=_['merge'](_0x561fcc[_0xb814('0x44')],{'$or':_[_0xb814('0x49')](_0x561fcc[_0xb814('0x4a')],function(_0x2ba1e6){var _0x21981d={};_0x21981d[_0x2ba1e6]={'$like':'%'+_0x3812d1[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x21981d;})});}_0x561fcc=_[_0xb814('0x48')]({},_0x561fcc,_0x3812d1[_0xb814('0x4c')]);return db[_0xb814('0x79')][_0xb814('0x28')]({'where':_0x561fcc[_0xb814('0x44')]})[_0xb814('0x1a')](function(_0x4adfe9){_0x52ef26['count']=_0x4adfe9;if(_0x3812d1[_0xb814('0x39')][_0xb814('0x4d')]){_0x561fcc[_0xb814('0x4e')]=[{'model':db['CmContact'],'as':_0xb814('0x7b'),'required':![]},{'model':db[_0xb814('0x7c')],'as':_0xb814('0x7d'),'attributes':['name',_0xb814('0x7e'),_0xb814('0x7f')],'required':![]},{'model':db[_0xb814('0x80')],'as':_0xb814('0x81'),'attributes':['id',_0xb814('0x30'),_0xb814('0x82')],'where':_0x3812d1['query'][_0xb814('0x83')]?{'id':_0x3812d1['query'][_0xb814('0x83')]}:undefined,'required':_0x3812d1['query'][_0xb814('0x83')]?!![]:![]}];}return db[_0xb814('0x79')][_0xb814('0x4f')](_0x561fcc);})['then'](function(_0x197413){_0x52ef26[_0xb814('0x50')]=_0x197413;return _0x52ef26;});}})[_0xb814('0x1a')](respondWithFilteredResult(_0x477511,_0x561fcc))['catch'](handleError(_0x477511,null));};exports[_0xb814('0x84')]=function(_0x5d28cd,_0x47336c,_0x296dc9){return db[_0xb814('0x36')]['findOne']({'where':{'id':_0x5d28cd[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x47336c,null))[_0xb814('0x1a')](function(_0xadf11b){if(_0xadf11b){return db['sequelize'][_0xb814('0x85')](function(_0x2ce263){return db[_0xb814('0x86')][_0xb814('0x2e')]({'where':{'MailAccountId':_0x5d28cd[_0xb814('0x51')]['id']},'transaction':_0x2ce263})[_0xb814('0x1a')](function(_0x8d77cd){var _0xa579c5=_[_0xb814('0x49')](_0x5d28cd['body'],function(_0x2fe47b){_0x2fe47b[_0xb814('0x59')]=_0x5d28cd[_0xb814('0x51')]['id'];return _0x2fe47b;});return db['MailApplication'][_0xb814('0x87')](_0xa579c5,{'transaction':_0x2ce263});});})['then'](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x5d28cd[_0xb814('0x51')]['id']},'order':'priority'});});}})[_0xb814('0x1a')](respondWithResult(_0x47336c,null))[_0xb814('0x54')](handleError(_0x47336c,null));};exports['getApplications']=function(_0x5b6325,_0x40e5ca,_0x5634b5){var _0x35e464={};var _0x50f72a={};var _0x335b58;var _0x3e5b4d;return db[_0xb814('0x36')]['findOne']({'where':{'id':_0x5b6325['params']['id']}})['then'](handleEntityNotFound(_0x40e5ca,null))[_0xb814('0x1a')](function(_0x5018ea){if(_0x5018ea){_0x335b58=_0x5018ea;_0x50f72a['model']=_[_0xb814('0x38')](db['MailApplication']['rawAttributes']);_0x50f72a['query']=_[_0xb814('0x38')](_0x5b6325[_0xb814('0x39')]);_0x50f72a[_0xb814('0x3c')]=_['intersection'](_0x50f72a[_0xb814('0x3e')],_0x50f72a[_0xb814('0x39')]);_0x35e464[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x50f72a[_0xb814('0x3e')],qs[_0xb814('0x3f')](_0x5b6325['query'][_0xb814('0x3f')]));_0x35e464[_0xb814('0x4a')]=_0x35e464[_0xb814('0x4a')][_0xb814('0x40')]?_0x35e464['attributes']:_0x50f72a[_0xb814('0x3e')];_0x35e464[_0xb814('0x43')]=qs[_0xb814('0x5d')](_0x5b6325[_0xb814('0x39')][_0xb814('0x5d')]);_0x35e464[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x5b6325[_0xb814('0x39')],_0x50f72a[_0xb814('0x3c')]));if(_0x5b6325['query'][_0xb814('0x4b')]){_0x35e464[_0xb814('0x44')]=_['merge'](_0x35e464[_0xb814('0x44')],{'$or':_['map'](_0x35e464[_0xb814('0x4a')],function(_0x2c702d){var _0x5e2273={};_0x5e2273[_0x2c702d]={'$like':'%'+_0x5b6325[_0xb814('0x39')]['filter']+'%'};return _0x5e2273;})});}_0x35e464=_[_0xb814('0x48')]({},_0x35e464,_0x5b6325[_0xb814('0x4c')]);return _0x335b58[_0xb814('0x88')](_0x35e464);}})[_0xb814('0x1a')](function(_0x218de8){if(_0x218de8){_0x3e5b4d=_0x218de8['length'];if(!_0x5b6325[_0xb814('0x39')]['hasOwnProperty'](_0xb814('0x42'))){_0x35e464[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x5b6325[_0xb814('0x39')][_0xb814('0x2a')]);_0x35e464[_0xb814('0x29')]=qs[_0xb814('0x29')](_0x5b6325[_0xb814('0x39')][_0xb814('0x29')]);}return _0x335b58['getApplications'](_0x35e464);}})[_0xb814('0x1a')](function(_0x261d02){if(_0x261d02){return _0x261d02?{'count':_0x3e5b4d,'rows':_0x261d02}:null;}})[_0xb814('0x1a')](respondWithResult(_0x40e5ca,null))[_0xb814('0x54')](handleError(_0x40e5ca,null));};exports['getMessages']=function(_0x328c09,_0x345fea,_0x4e9063){var _0x3364d1={'raw':!![],'where':{}};var _0x51a22c={};var _0x4f1deb={'count':0x0,'rows':[]};return db['MailAccount'][_0xb814('0x5c')]({'where':{'id':_0x328c09[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x345fea,null))[_0xb814('0x1a')](function(_0x2581b0){if(_0x2581b0){_0x51a22c['model']=_[_0xb814('0x38')](db[_0xb814('0x89')]['rawAttributes']);_0x51a22c[_0xb814('0x39')]=_['keys'](_0x328c09[_0xb814('0x39')]);_0x51a22c[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x51a22c[_0xb814('0x3e')],_0x51a22c[_0xb814('0x39')]);_0x3364d1[_0xb814('0x4a')]=_['intersection'](_0x51a22c['model'],qs[_0xb814('0x3f')](_0x328c09['query'][_0xb814('0x3f')]));_0x3364d1['attributes']=_0x3364d1[_0xb814('0x4a')][_0xb814('0x40')]?_0x3364d1[_0xb814('0x4a')]:_0x51a22c[_0xb814('0x3e')];if(!_0x328c09['query'][_0xb814('0x41')]('nolimit')){_0x3364d1['limit']=qs[_0xb814('0x2a')](_0x328c09[_0xb814('0x39')]['limit']);_0x3364d1[_0xb814('0x29')]=qs[_0xb814('0x29')](_0x328c09[_0xb814('0x39')][_0xb814('0x29')]);}_0x3364d1['order']=qs[_0xb814('0x5d')](_0x328c09[_0xb814('0x39')][_0xb814('0x5d')]);_0x3364d1[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x328c09[_0xb814('0x39')],_0x51a22c[_0xb814('0x3c')]));_0x3364d1[_0xb814('0x44')][_0xb814('0x59')]=_0x2581b0['id'];if(_0x328c09[_0xb814('0x39')][_0xb814('0x4b')]){_0x3364d1[_0xb814('0x44')]=_['merge'](_0x3364d1[_0xb814('0x44')],{'$or':_[_0xb814('0x49')](_0x3364d1[_0xb814('0x4a')],function(_0x158904){var _0x1a065b={};_0x1a065b[_0x158904]={'$like':'%'+_0x328c09[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x1a065b;})});}if(_0x328c09[_0xb814('0x39')]['$gte']){var _0x400dc9=_0x328c09[_0xb814('0x39')][_0xb814('0x8a')][_0xb814('0x8b')](',');var _0x3ec548={};_0x3ec548[_0x400dc9[0x0]]={'$gte':moment(_0x400dc9[0x1])[_0xb814('0x8c')](_0xb814('0x8d'))};_0x3364d1[_0xb814('0x44')]=_['merge'](_0x3364d1[_0xb814('0x44')],_0x3ec548);}_0x3364d1=_['merge']({},_0x3364d1,_0x328c09['options']);return db[_0xb814('0x89')]['count']({'where':_0x3364d1[_0xb814('0x44')]})[_0xb814('0x1a')](function(_0x2daa63){_0x4f1deb['count']=_0x2daa63;if(_0x328c09[_0xb814('0x39')][_0xb814('0x4d')]){_0x3364d1[_0xb814('0x4e')]=[{'all':!![]}];}return db[_0xb814('0x89')][_0xb814('0x4f')](_0x3364d1);})['then'](function(_0x1dafa9){_0x4f1deb[_0xb814('0x50')]=_0x1dafa9;return _0x4f1deb;});}})[_0xb814('0x1a')](respondWithFilteredResult(_0x345fea,_0x3364d1))['catch'](handleError(_0x345fea,null));};exports[_0xb814('0x31')]=function(_0x26f149,_0x3fc239,_0x3c79c5){var _0x1f0823,_0x1271ce={},_0x4c1805;if(_0x26f149[_0xb814('0x55')]['to']){_0x4c1805=_0x26f149[_0xb814('0x55')]['to'][_0xb814('0x8b')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x26f149[_0xb814('0x51')]['id']},'include':[{'model':db[_0xb814('0x8e')],'as':_0xb814('0x8f'),'include':[{'model':db[_0xb814('0x90')],'as':'Contacts','where':{'email':_0x4c1805},'limit':0x1,'order':[[_0xb814('0x91'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xb814('0x1a')](handleEntityNotFound(_0x3fc239,null))[_0xb814('0x1a')](function(_0xdcb11d){if(_0xdcb11d){_0x1f0823=_0xdcb11d;if(_0xdcb11d[_0xb814('0x35')]){if(_[_0xb814('0x65')](_0x26f149['body'][_0xb814('0x92')])){_0x26f149[_0xb814('0x55')][_0xb814('0x92')]=util[_0xb814('0x8c')](_0xb814('0x93'),_0xdcb11d[_0xb814('0x30')],_0xdcb11d[_0xb814('0x94')]||_0xdcb11d['Smtp']['user']);}if(_0x26f149['body'][_0xb814('0x95')]&&_0x26f149['body'][_0xb814('0x95')][_0xb814('0x40')]){for(var _0x2a1d69=0x0;_0x2a1d69<_0x26f149['body'][_0xb814('0x95')][_0xb814('0x40')];_0x2a1d69+=0x1){_0x26f149['body'][_0xb814('0x95')][_0x2a1d69]={'filename':_0x26f149[_0xb814('0x55')][_0xb814('0x95')][_0x2a1d69][_0xb814('0x30')],'path':path[_0xb814('0x96')](config[_0xb814('0x97')],_0xb814('0x98'),_0x26f149[_0xb814('0x55')][_0xb814('0x95')][_0x2a1d69][_0xb814('0x99')])};}}var _0x5ba901={'tls':{'rejectUnauthorized':![]}};if(_[_0xb814('0x65')](_0xdcb11d['Smtp'][_0xb814('0x70')])){if(_0xdcb11d[_0xb814('0x35')][_0xb814('0x6d')]){_0x5ba901[_0xb814('0x9a')]={'user':_0xdcb11d[_0xb814('0x35')]['user'],'pass':_0xdcb11d[_0xb814('0x35')][_0xb814('0x9b')]};}_0x5ba901[_0xb814('0x6e')]=_0xdcb11d[_0xb814('0x35')][_0xb814('0x6e')];_0x5ba901[_0xb814('0x6f')]=_0xdcb11d[_0xb814('0x35')][_0xb814('0x6f')];_0x5ba901[_0xb814('0x9c')]=_0xdcb11d[_0xb814('0x35')][_0xb814('0x9c')];}else{_0x5ba901[_0xb814('0x70')]=_0xdcb11d[_0xb814('0x35')][_0xb814('0x70')];_0x5ba901[_0xb814('0x9a')]={'user':_0xdcb11d[_0xb814('0x35')][_0xb814('0x6a')],'pass':_0xdcb11d[_0xb814('0x35')][_0xb814('0x9b')]};}return respondWithRpcPromise(_0xb814('0x9d'),'sendMail',{'account':_0x5ba901,'message':_0x26f149[_0xb814('0x55')]});}else{throw new Error(_0xb814('0x9e'));}}})[_0xb814('0x1a')](function(_0x39f158){if(_0x39f158){_0x1271ce=_0x39f158;if(_0x1f0823[_0xb814('0x8f')]){if(_0x1f0823[_0xb814('0x8f')]['Contacts'][_0xb814('0x40')]){return _0x1f0823[_0xb814('0x8f')][_0xb814('0x9f')][0x0];}else{return db[_0xb814('0x90')][_0xb814('0x5b')](_[_0xb814('0xa0')](_0x26f149[_0xb814('0x55')],{'firstName':_0x26f149[_0xb814('0x55')]['to'],'email':_0x26f149[_0xb814('0x55')]['to'],'phone':_0x26f149[_0xb814('0x55')]['to'],'ListId':_0x1f0823[_0xb814('0x64')]}));}}else{throw new Error(_0xb814('0x9e'));}}})[_0xb814('0x1a')](function(_0x347191){if(_0x347191){var _0x5b59cb={'UserId':_0x26f149[_0xb814('0x6a')]['id'],'ContactId':_0x347191['id'],'MailAccountId':_0x1f0823['id'],'inReplyTo':_0x1271ce[_0xb814('0xa1')],'to':_0x26f149[_0xb814('0x55')][_0xb814('0x92')],'cc':_0x26f149[_0xb814('0x55')]['cc'],'subject':_0x26f149[_0xb814('0x55')][_0xb814('0xa2')],'attach':_0x26f149[_0xb814('0x55')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb814('0x8c')](_0xb814('0x8d')),'lastMsgDirection':_0xb814('0xa3'),'lastMsgBody':_0x26f149[_0xb814('0x55')][_0xb814('0x55')],'Messages':[_['merge'](_0x26f149[_0xb814('0x55')],{'messageId':_0x1271ce[_0xb814('0xa1')],'sentAt':moment()[_0xb814('0x8c')](_0xb814('0x8d')),'read':!![],'MailAccountId':_0x1f0823['id'],'UserId':_0x26f149['user']['id'],'ContactId':_0x347191['id']})]};if(_0x26f149['body'][_0xb814('0xa4')]){_0x5b59cb=_[_0xb814('0x48')](_0x5b59cb,_0x26f149[_0xb814('0x55')]['Interaction']);}return db[_0xb814('0x79')][_0xb814('0x5b')](_0x5b59cb,{'include':[{'model':db[_0xb814('0x89')],'as':_0xb814('0xa5')}]});}})['then'](respondWithResult(_0x3fc239,null))['catch'](handleError(_0x3fc239,null));};exports[_0xb814('0xa6')]=function(_0x400e18,_0x34950f,_0x54cc97){return db['MailAccount']['find']({'where':{'id':_0x400e18['params']['id']},'include':[{'model':db[_0xb814('0x34')],'as':_0xb814('0x35'),'raw':!![]}]})['then'](handleEntityNotFound(_0x34950f,null))[_0xb814('0x1a')](function(_0xe11205){if(_0xe11205&&_0xe11205[_0xb814('0x35')]){var _0x39e6ae={'id':_0xe11205['id'],'tls':{'rejectUnauthorized':![]}};if(_0xe11205[_0xb814('0x35')][_0xb814('0x70')]){_0x39e6ae[_0xb814('0x70')]=_0xe11205['Smtp'][_0xb814('0x70')];}else{_0x39e6ae[_0xb814('0x6e')]=_0xe11205[_0xb814('0x35')][_0xb814('0x6e')];_0x39e6ae[_0xb814('0x6f')]=_0xe11205[_0xb814('0x35')][_0xb814('0x6f')];_0x39e6ae[_0xb814('0x9c')]=_0xe11205[_0xb814('0x35')][_0xb814('0x9c')];}if(_0xe11205['Smtp'][_0xb814('0x6d')]){_0x39e6ae['auth']={'user':_0xe11205[_0xb814('0x35')]['user'],'pass':_0xe11205['Smtp'][_0xb814('0x9b')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x39e6ae});}})[_0xb814('0x1a')](respondWithResult(_0x34950f,null))[_0xb814('0x54')](handleError(_0x34950f,null));};exports[_0xb814('0x2e')]=function(_0x4bc8aa,_0x58f887){return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x4bc8aa['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x58f887,null))[_0xb814('0x1a')](function(_0xae733a){if(_0xae733a&&_0xae733a[_0xb814('0x70')]){throw new db[(_0xb814('0xa7'))]['ValidationError'](_0xb814('0xa8'));}return _0xae733a;})['then'](removeEntity(_0x58f887,null))[_0xb814('0x54')](handleError(_0x58f887,null));};exports[_0xb814('0xa9')]=function(_0x19ad31,_0x30c1b6,_0xe64c48){return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x19ad31[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x30c1b6,null))[_0xb814('0x1a')](function(_0x433cb0){if(_0x433cb0){return _0x433cb0['addAgents'](_0x19ad31[_0xb814('0x55')][_0xb814('0x5f')],_[_0xb814('0x7a')](_0x19ad31[_0xb814('0x55')],[_0xb814('0x5f'),'id'])||{})[_0xb814('0xaa')](function(_0x5411f7){for(var _0x44b006=0x0;_0x44b006<_0x19ad31['body'][_0xb814('0x5f')][_0xb814('0x40')];_0x44b006+=0x1){socket[_0xb814('0xab')](_0xb814('0xac'),{'UserId':_0x19ad31[_0xb814('0x55')][_0xb814('0x5f')][_0x44b006],'MailAccountId':_0x19ad31['params']['id']});}return _0x5411f7;});}})['then'](respondWithResult(_0x30c1b6,null))[_0xb814('0x54')](handleError(_0x30c1b6,null));};exports[_0xb814('0xad')]=function(_0x500277,_0x392380,_0x9b96a3){var _0x5bd99c;return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x500277['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x392380,null))[_0xb814('0x1a')](function(_0x3e4250){if(_0x3e4250){return _0x3e4250[_0xb814('0xad')](_0x500277['query'][_0xb814('0x5f')])['then'](function(_0x54f37a){if(_[_0xb814('0xae')](_0x500277[_0xb814('0x39')][_0xb814('0x5f')])){for(var _0x55b2dc=0x0;_0x55b2dc<_0x500277[_0xb814('0x39')][_0xb814('0x5f')][_0xb814('0x40')];_0x55b2dc+=0x1){socket[_0xb814('0xab')](_0xb814('0xaf'),{'UserId':_0x500277['query'][_0xb814('0x5f')][_0x55b2dc],'MailAccountId':_0x500277['params']['id']});}}else{socket[_0xb814('0xab')](_0xb814('0xaf'),{'UserId':_0x500277['query'][_0xb814('0x5f')],'MailAccountId':_0x500277[_0xb814('0x51')]['id']});}});}})['then'](respondWithStatusCode(_0x392380,null))[_0xb814('0x54')](handleError(_0x392380,null));};exports['getAgents']=function(_0x3f2f27,_0x5de4ed,_0x588941){var _0x5e2e23={};var _0x60b176={};var _0x35ebde;var _0x43c470;return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x3f2f27['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x5de4ed,null))[_0xb814('0x1a')](function(_0xcec6da){if(_0xcec6da){_0x35ebde=_0xcec6da;_0x60b176['model']=_[_0xb814('0x38')](db[_0xb814('0x7c')]['rawAttributes']);_0x60b176['query']=_[_0xb814('0x38')](_0x3f2f27[_0xb814('0x39')]);_0x60b176[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x60b176[_0xb814('0x3e')],_0x60b176['query']);_0x5e2e23['attributes']=_[_0xb814('0x3d')](_0x60b176['model'],qs['fields'](_0x3f2f27[_0xb814('0x39')][_0xb814('0x3f')]));_0x5e2e23[_0xb814('0x4a')]=_0x5e2e23[_0xb814('0x4a')][_0xb814('0x40')]?_0x5e2e23['attributes']:_0x60b176[_0xb814('0x3e')];_0x5e2e23[_0xb814('0x43')]=qs[_0xb814('0x5d')](_0x3f2f27[_0xb814('0x39')][_0xb814('0x5d')]);_0x5e2e23[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x3f2f27[_0xb814('0x39')],_0x60b176['filters']));if(_0x3f2f27[_0xb814('0x39')][_0xb814('0x4b')]){_0x5e2e23[_0xb814('0x44')]=_['merge'](_0x5e2e23['where'],{'$or':_[_0xb814('0x49')](_0x5e2e23[_0xb814('0x4a')],function(_0x37b42c){var _0x58b74a={};_0x58b74a[_0x37b42c]={'$like':'%'+_0x3f2f27[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x58b74a;})});}_0x5e2e23=_[_0xb814('0x48')]({},_0x5e2e23,_0x3f2f27[_0xb814('0x4c')]);return _0x35ebde[_0xb814('0xb0')](_0x5e2e23);}})[_0xb814('0x1a')](function(_0x1eff0c){if(_0x1eff0c){_0x43c470=_0x1eff0c[_0xb814('0x40')];if(!_0x3f2f27['query'][_0xb814('0x41')](_0xb814('0x42'))){_0x5e2e23[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x3f2f27[_0xb814('0x39')][_0xb814('0x2a')]);_0x5e2e23[_0xb814('0x29')]=qs['offset'](_0x3f2f27[_0xb814('0x39')]['offset']);}return _0x35ebde[_0xb814('0xb0')](_0x5e2e23);}})[_0xb814('0x1a')](function(_0xb12802){if(_0xb12802){return _0xb12802?{'count':_0x43c470,'rows':_0xb12802}:null;}})[_0xb814('0x1a')](respondWithResult(_0x5de4ed,null))[_0xb814('0x54')](handleError(_0x5de4ed,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index be8eaba..caffbf9 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 _0xc0a9=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xc0a9,0x1bd));var _0x9c0a=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xc0a9[_0x2becba];return _0x90b5dd;};'use strict';var EventEmitter=require(_0x9c0a('0x0'));var MailAccount=require(_0x9c0a('0x1'))['db'][_0x9c0a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9c0a('0x3')](0x0);var events={'afterCreate':_0x9c0a('0x4'),'afterUpdate':_0x9c0a('0x5'),'afterDestroy':_0x9c0a('0x6')};function emitEvent(_0x46208e){return function(_0x24b98a,_0x42f08a,_0x528c94){MailAccountEvents[_0x9c0a('0x7')](_0x46208e+':'+_0x24b98a['id'],_0x24b98a);MailAccountEvents[_0x9c0a('0x7')](_0x46208e,_0x24b98a);_0x528c94(null);};}for(var e in events){if(events[_0x9c0a('0x8')](e)){var event=events[e];MailAccount[_0x9c0a('0x9')](e,emitEvent(event));}}module[_0x9c0a('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x6407=['../../mysqldb','MailAccount','save','update','remove','exports','events'];(function(_0x19f2b2,_0x2c3477){var _0x54d530=function(_0x1fe201){while(--_0x1fe201){_0x19f2b2['push'](_0x19f2b2['shift']());}};_0x54d530(++_0x2c3477);}(_0x6407,0x110));var _0x7640=function(_0x5b0208,_0x58666d){_0x5b0208=_0x5b0208-0x0;var _0x5800b4=_0x6407[_0x5b0208];return _0x5800b4;};'use strict';var EventEmitter=require(_0x7640('0x0'));var MailAccount=require(_0x7640('0x1'))['db'][_0x7640('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7640('0x3'),'afterUpdate':_0x7640('0x4'),'afterDestroy':_0x7640('0x5')};function emitEvent(_0x1edef9){return function(_0x4cd293,_0x5869d3,_0x4570d6){MailAccountEvents['emit'](_0x1edef9+':'+_0x4cd293['id'],_0x4cd293);MailAccountEvents['emit'](_0x1edef9,_0x4cd293);_0x4570d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x7640('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 37635af..69aafee 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 _0xbe49=['moment','bluebird','request-promise','exports','define','MailAccount','mail_accounts','lodash','../../config/logger','api'];(function(_0x173727,_0x30ab94){var _0x260a48=function(_0x43184f){while(--_0x43184f){_0x173727['push'](_0x173727['shift']());}};_0x260a48(++_0x30ab94);}(_0xbe49,0x75));var _0x9be4=function(_0x473ca6,_0x3cd45d){_0x473ca6=_0x473ca6-0x0;var _0x3eeba6=_0xbe49[_0x473ca6];return _0x3eeba6;};'use strict';var _=require(_0x9be4('0x0'));var util=require('util');var logger=require(_0x9be4('0x1'))(_0x9be4('0x2'));var moment=require(_0x9be4('0x3'));var BPromise=require(_0x9be4('0x4'));var rp=require(_0x9be4('0x5'));var attributes=require('./mailAccount.attributes');module[_0x9be4('0x6')]=function(_0x21a1ed,_0x398531){return _0x21a1ed[_0x9be4('0x7')](_0x9be4('0x8'),attributes,{'tableName':_0x9be4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9947=['util','../../config/logger','moment','bluebird','request-promise','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9947,0x104));var _0x7994=function(_0x21c23e,_0x1d33e3){_0x21c23e=_0x21c23e-0x0;var _0xa7b7e2=_0x9947[_0x21c23e];return _0xa7b7e2;};'use strict';var _=require('lodash');var util=require(_0x7994('0x0'));var logger=require(_0x7994('0x1'))('api');var moment=require(_0x7994('0x2'));var BPromise=require(_0x7994('0x3'));var rp=require(_0x7994('0x4'));var attributes=require(_0x7994('0x5'));module[_0x7994('0x6')]=function(_0x79586e,_0x457635){return _0x79586e[_0x7994('0x7')](_0x7994('0x8'),attributes,{'tableName':_0x7994('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 605bf15..c944669 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 _0xb193=['result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowMailAccount','find','where','NotifyMailAccount','body','mail','keys','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','CmContact','DESC','MailApplication','Applications','MailServerOut','Smtp','applications','list','orderBy','priority','autoclose','push','length','close','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','originCc','Attachment','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','socket.io-emitter','localhost','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x54a529,_0x14374b){var _0x2a9bb1=function(_0x2f21fa){while(--_0x2f21fa){_0x54a529['push'](_0x54a529['shift']());}};_0x2a9bb1(++_0x14374b);}(_0xb193,0xaf));var _0x3b19=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0xb193[_0x584291];return _0x4e7d08;};'use strict';var _=require(_0x3b19('0x0'));var util=require('util');var moment=require(_0x3b19('0x1'));var BPromise=require(_0x3b19('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x3b19('0x3'));var logger=require(_0x3b19('0x4'))(_0x3b19('0x5'));var config=require('../../config/environment');var jayson=require(_0x3b19('0x6'));var client=jayson[_0x3b19('0x7')]['http']({'port':0x232c});var socket=require(_0x3b19('0x8'))({'host':_0x3b19('0x9'),'port':0x18eb});require(_0x3b19('0xa'))['register'](socket);function respondWithRpcPromise(_0x8b7071,_0x486cf1,_0x36668a){return new BPromise(function(_0x36312b,_0xfea99f){return client[_0x3b19('0xb')](_0x8b7071,_0x36668a)[_0x3b19('0xc')](function(_0x5340ef){logger[_0x3b19('0xd')](_0x3b19('0xe'),_0x486cf1,_0x3b19('0xf'));logger[_0x3b19('0x10')](_0x3b19('0x11'),_0x486cf1,'request\x20sent',JSON['stringify'](_0x5340ef));if(_0x5340ef[_0x3b19('0x12')]){if(_0x5340ef['error'][_0x3b19('0x13')]===0x1f4){logger[_0x3b19('0x12')]('MailAccount,\x20%s,\x20%s',_0x486cf1,_0x5340ef[_0x3b19('0x12')][_0x3b19('0x14')]);return _0xfea99f(_0x5340ef[_0x3b19('0x12')][_0x3b19('0x14')]);}logger['error'](_0x3b19('0xe'),_0x486cf1,_0x5340ef['error'][_0x3b19('0x14')]);return _0x36312b(_0x5340ef[_0x3b19('0x12')][_0x3b19('0x14')]);}else{logger[_0x3b19('0xd')](_0x3b19('0xe'),_0x486cf1,_0x3b19('0xf'));_0x36312b(_0x5340ef[_0x3b19('0x15')][_0x3b19('0x14')]);}})[_0x3b19('0x16')](function(_0x3e90e2){logger[_0x3b19('0x12')](_0x3b19('0xe'),_0x486cf1,_0x3e90e2);_0xfea99f(_0x3e90e2);});});}exports[_0x3b19('0x17')]=function(_0xf7846a){var _0x5f2df8=this;return new Promise(function(_0x72b26d,_0x36fd92){return db[_0x3b19('0x18')][_0x3b19('0x19')]({'raw':_0xf7846a[_0x3b19('0x1a')]?_0xf7846a[_0x3b19('0x1a')][_0x3b19('0x1b')]===undefined?!![]:![]:!![],'where':_0xf7846a[_0x3b19('0x1a')]?_0xf7846a[_0x3b19('0x1a')]['where']||null:null,'attributes':_0xf7846a['options']?_0xf7846a['options'][_0x3b19('0x1c')]||null:null,'limit':_0xf7846a['options']?_0xf7846a[_0x3b19('0x1a')][_0x3b19('0x1d')]||null:null,'include':_0xf7846a[_0x3b19('0x1a')]?_0xf7846a[_0x3b19('0x1a')][_0x3b19('0x1e')]?_[_0x3b19('0x1f')](_0xf7846a[_0x3b19('0x1a')][_0x3b19('0x1e')],function(_0xda1948){return{'model':db[_0xda1948['model']],'as':_0xda1948['as'],'attributes':_0xda1948['attributes'],'include':_0xda1948[_0x3b19('0x1e')]?_['map'](_0xda1948[_0x3b19('0x1e')],function(_0x1b6d68){return{'model':db[_0x1b6d68['model']],'as':_0x1b6d68['as'],'attributes':_0x1b6d68[_0x3b19('0x1c')],'include':_0x1b6d68[_0x3b19('0x1e')]?_[_0x3b19('0x1f')](_0x1b6d68[_0x3b19('0x1e')],function(_0x5f2e68){return{'model':db[_0x5f2e68[_0x3b19('0x20')]],'as':_0x5f2e68['as'],'attributes':_0x5f2e68[_0x3b19('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3b19('0xc')](function(_0x303cd0){logger[_0x3b19('0xd')](_0x3b19('0x17'),_0xf7846a);logger['debug'](_0x3b19('0x17'),_0xf7846a,JSON[_0x3b19('0x21')](_0x303cd0));_0x72b26d(_0x303cd0);})['catch'](function(_0x4a118d){logger[_0x3b19('0x12')](_0x3b19('0x17'),_0x4a118d[_0x3b19('0x14')],_0xf7846a);_0x36fd92(_0x5f2df8[_0x3b19('0x12')](0x1f4,_0x4a118d[_0x3b19('0x14')]));});});};exports[_0x3b19('0x22')]=function(_0xb8570e){var _0x4f45ad=this;return new Promise(function(_0x102bec,_0x4a7303){return db['MailAccount'][_0x3b19('0x23')]({'raw':_0xb8570e[_0x3b19('0x1a')]?_0xb8570e['options'][_0x3b19('0x1b')]===undefined?!![]:![]:!![],'where':_0xb8570e[_0x3b19('0x1a')]?_0xb8570e[_0x3b19('0x1a')][_0x3b19('0x24')]||null:null,'attributes':_0xb8570e['options']?_0xb8570e['options']['attributes']||null:null,'include':_0xb8570e['options']?_0xb8570e[_0x3b19('0x1a')][_0x3b19('0x1e')]?_[_0x3b19('0x1f')](_0xb8570e[_0x3b19('0x1a')][_0x3b19('0x1e')],function(_0x3cfab0){return{'model':db[_0x3cfab0['model']],'as':_0x3cfab0['as'],'attributes':_0x3cfab0[_0x3b19('0x1c')],'include':_0x3cfab0[_0x3b19('0x1e')]?_[_0x3b19('0x1f')](_0x3cfab0[_0x3b19('0x1e')],function(_0x373eed){return{'model':db[_0x373eed[_0x3b19('0x20')]],'as':_0x373eed['as'],'attributes':_0x373eed['attributes'],'include':_0x373eed[_0x3b19('0x1e')]?_[_0x3b19('0x1f')](_0x373eed[_0x3b19('0x1e')],function(_0x5a757a){return{'model':db[_0x5a757a[_0x3b19('0x20')]],'as':_0x5a757a['as'],'attributes':_0x5a757a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b19('0xc')](function(_0x3eea9a){logger[_0x3b19('0xd')](_0x3b19('0x22'),_0xb8570e);logger['debug'](_0x3b19('0x22'),_0xb8570e,JSON['stringify'](_0x3eea9a));_0x102bec(_0x3eea9a);})['catch'](function(_0x1c9ab8){logger[_0x3b19('0x12')](_0x3b19('0x22'),_0x1c9ab8[_0x3b19('0x14')],_0xb8570e);_0x4a7303(_0x4f45ad[_0x3b19('0x12')](0x1f4,_0x1c9ab8[_0x3b19('0x14')]));});});};exports[_0x3b19('0x25')]=function(_0x54b240){var _0x25fa34=this;return new Promise(function(_0x182257,_0x5b4ff8){var _0x2bb3ba={'body':_0x54b240[_0x3b19('0x26')],'channel':_0x3b19('0x27')};var _0x4ec53c=_['difference'](_[_0x3b19('0x28')](db['CmContact'][_0x3b19('0x29')]),['createdAt',_0x3b19('0x2a'),_0x3b19('0x2b'),_0x3b19('0x2c')]);var _0x326b3b=![];if(_0x54b240[_0x3b19('0x26')]['id']){delete _0x54b240[_0x3b19('0x26')]['id'];}if(_[_0x3b19('0x2d')](_0x54b240['body'][_0x3b19('0x2e')])){return _0x5b4ff8(_0x25fa34[_0x3b19('0x12')](0x1f4,_0x3b19('0x2f')));}if(_['isNil'](_0x54b240[_0x3b19('0x26')]['body'])||_0x54b240[_0x3b19('0x26')]['body']===''){return _0x5b4ff8(_0x25fa34[_0x3b19('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x3b19('0x2d')](_0x54b240[_0x3b19('0x26')]['mapKey'])){return _0x5b4ff8(_0x25fa34[_0x3b19('0x12')](0x1f4,_0x3b19('0x30')+_0x4ec53c));}if(!_[_0x3b19('0x31')](_0x4ec53c,_0x54b240[_0x3b19('0x26')]['mapKey'])){return _0x5b4ff8(_0x25fa34[_0x3b19('0x12')](0x1f4,_0x3b19('0x32')+_0x4ec53c));}var _0x1bc6b2={};_0x1bc6b2[_0x54b240['body'][_0x3b19('0x33')]]=_0x54b240['body']['from'];return db[_0x3b19('0x18')][_0x3b19('0x23')]({'where':{'id':_0x54b240[_0x3b19('0x34')]['id']},'include':[{'model':db[_0x3b19('0x35')],'as':_0x3b19('0x36'),'include':[{'model':db[_0x3b19('0x37')],'as':'Contacts','where':_0x1bc6b2,'limit':0x1,'order':[[_0x3b19('0x2a'),_0x3b19('0x38')]]}]},{'model':db[_0x3b19('0x39')],'as':_0x3b19('0x3a')},{'model':db[_0x3b19('0x3b')],'as':_0x3b19('0x3c')}]})[_0x3b19('0xc')](function(_0x48f263){if(_0x48f263&&_0x48f263[_0x3b19('0x36')]){var _0xed6376=_0x48f263['get']({'plain':!![]});_0x2bb3ba['account']=_['omit'](_0xed6376,[_0x3b19('0x3a'),'List']);_0x2bb3ba[_0x3b19('0x3d')]=_0xed6376[_0x3b19('0x3a')];_0x2bb3ba[_0x3b19('0x3e')]=_0xed6376[_0x3b19('0x36')];_0x2bb3ba[_0x3b19('0x3d')]=_[_0x3b19('0x3f')](_0x2bb3ba[_0x3b19('0x3d')],[_0x3b19('0x40')],['asc']);if(_0x2bb3ba[_0x3b19('0x34')]&&_0x2bb3ba[_0x3b19('0x34')][_0x3b19('0x41')]){_0x2bb3ba['applications'][_0x3b19('0x42')]({'id':0x0,'priority':_0x2bb3ba['applications'][_0x3b19('0x43')]+0x1,'app':_0x3b19('0x44'),'appdata':_0x3b19('0x41'),'interval':'*,*,*,*'});}if(_0x2bb3ba['account']['Applications']){delete _0x2bb3ba[_0x3b19('0x34')][_0x3b19('0x3a')];}if(_0x2bb3ba[_0x3b19('0x34')][_0x3b19('0x36')]){delete _0x2bb3ba[_0x3b19('0x34')][_0x3b19('0x36')];}if(_0xed6376['List'][_0x3b19('0x45')][_0x3b19('0x43')]){return _0xed6376[_0x3b19('0x36')][_0x3b19('0x45')][0x0];}var _0x894f39=_['defaults'](_0x54b240['body'],{'firstName':_0x54b240['body']['from'],'ListId':_0xed6376[_0x3b19('0x2c')]});_0x894f39[_0x54b240[_0x3b19('0x26')][_0x3b19('0x33')]]=_0x54b240['body'][_0x3b19('0x2e')];return db[_0x3b19('0x37')][_0x3b19('0x46')](_0x894f39);}else{throw new Error(_0x3b19('0x47'));}})[_0x3b19('0xc')](function(_0x27c626){_0x2bb3ba[_0x3b19('0x48')]=_0x27c626;if(_0x27c626){if(!_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x49')]){_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x49')]=rs[_0x3b19('0x4a')]()+'\x20'+_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x2e')];}var _0x16ee2e={'ContactId':_0x27c626['id'],'MailAccountId':_0x54b240['account']['id'],'inReplyTo':_0x54b240[_0x3b19('0x26')]['message'][_0x3b19('0x49')],'to':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x2e')],'cc':_0x54b240[_0x3b19('0x26')]['message']['cc'],'subject':_0x54b240['body'][_0x3b19('0x14')][_0x3b19('0x4b')],'attach':_0x54b240['body']['message'][_0x3b19('0x4c')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x54b240['body'][_0x3b19('0x26')]};return db[_0x3b19('0x4d')][_0x3b19('0x23')]({'where':{'closed':![],'MailAccountId':_0x54b240['account']['id']},'include':[{'model':db[_0x3b19('0x4e')],'as':'Messages','attributes':[_0x3b19('0x49')],'where':{'messageId':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x4f')]}}]})['then'](function(_0x4fd82c){if(_0x4fd82c){return[_0x4fd82c,![]];}return db[_0x3b19('0x4d')][_0x3b19('0x46')](_0x16ee2e)[_0x3b19('0xc')](function(_0x53716e){return[_0x53716e,!![]];});});}else{throw new Error(_0x3b19('0x50'));}})[_0x3b19('0x51')](function(_0x24e371,_0x553318){if(_0x24e371){_0x326b3b=_0x553318;if(!_0x553318){return _0x24e371[_0x3b19('0x52')]({'inReplyTo':_0x54b240['body']['message'][_0x3b19('0x49')],'to':_0x54b240[_0x3b19('0x26')]['message'][_0x3b19('0x2e')],'cc':_0x54b240['body'][_0x3b19('0x14')]['cc'],'subject':_0x54b240['body'][_0x3b19('0x14')]['subject'],'attach':_0x24e371[_0x3b19('0x4c')]?_0x24e371[_0x3b19('0x4c')]:_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x4c')],'substatus':null,'substatusAt':moment()[_0x3b19('0x53')](_0x3b19('0x54')),'lastMsgAt':moment()['format'](_0x3b19('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x54b240[_0x3b19('0x26')][_0x3b19('0x26')]});}else{return _0x24e371;}}})['then'](function(_0xfc4aa9){_0x2bb3ba[_0x3b19('0x55')]=_0xfc4aa9['get']({'plain':!![]});_0x2bb3ba[_0x3b19('0x55')][_0x3b19('0x56')]=_0x326b3b;return db['MailMessage']['create']({'body':_0x54b240[_0x3b19('0x26')][_0x3b19('0x26')],'MailAccountId':_0x54b240['account']['id'],'MailInteractionId':_0xfc4aa9['id'],'direction':'in','ContactId':_0x2bb3ba[_0x3b19('0x48')]['id'],'messageId':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x49')],'from':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x2e')],'to':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')]['to'],'cc':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')]['cc'],'subject':_0x54b240['body'][_0x3b19('0x14')][_0x3b19('0x4b')],'attach':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')]['attach'],'Attachments':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')][_0x3b19('0x57')],'originTo':_0x54b240[_0x3b19('0x26')]['message'][_0x3b19('0x58')],'originCc':_0x54b240['body']['message'][_0x3b19('0x59')],'bcc':_0x54b240[_0x3b19('0x26')][_0x3b19('0x14')]['bcc']},{'include':[{'model':db[_0x3b19('0x5a')],'as':'Attachments'}]});})[_0x3b19('0xc')](function(_0x3a4d92){_0x2bb3ba['message']=_0x3a4d92;if(_0x2bb3ba[_0x3b19('0x55')][_0x3b19('0x5b')]){return db[_0x3b19('0x5c')]['find']({'attributes':['id',_0x3b19('0x5d')],'where':{'id':_0x2bb3ba[_0x3b19('0x55')][_0x3b19('0x5b')]}})[_0x3b19('0xc')](function(_0x343c8c){if(_0x343c8c){_0x2bb3ba[_0x3b19('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x343c8c[_0x3b19('0x5d')]+','+(_0x2bb3ba[_0x3b19('0x34')][_0x3b19('0x5e')]||0xa),'interval':_0x3b19('0x5f')});}return respondWithRpcPromise('Start',_0x3b19('0x60'),_0x2bb3ba);});}return respondWithRpcPromise(_0x3b19('0x61'),'startRouting',_0x2bb3ba);})[_0x3b19('0xc')](function(_0x5b8e18){_0x182257(_0x5b8e18);})[_0x3b19('0x16')](function(_0x140318){_0x5b4ff8(_0x25fa34[_0x3b19('0x12')](0x1f4,_0x140318[_0x3b19('0x14')]));});});}; \ No newline at end of file +var _0x612b=['created','MailMessage','create','attachments','originTo','originCc','Attachment','UserId','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','register','request','then','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailAccount,\x20%s,\x20%s','info','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','debug','ShowMailAccount','find','difference','keys','CmContact','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Applications','Smtp','omit','applications','list','orderBy','autoclose','length','close','defaults','contact','messageId','subject','format','Messages','inReplyTo','MailInteraction','spread','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','get'];(function(_0x39714b,_0x5e0b0e){var _0x45ed60=function(_0x3ce5c8){while(--_0x3ce5c8){_0x39714b['push'](_0x39714b['shift']());}};_0x45ed60(++_0x5e0b0e);}(_0x612b,0x66));var _0xb612=function(_0x386cf6,_0x125081){_0x386cf6=_0x386cf6-0x0;var _0x14aeb9=_0x612b[_0x386cf6];return _0x14aeb9;};'use strict';var _=require('lodash');var util=require(_0xb612('0x0'));var moment=require(_0xb612('0x1'));var BPromise=require(_0xb612('0x2'));var rs=require(_0xb612('0x3'));var fs=require('fs');var db=require(_0xb612('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb612('0x5'));var jayson=require(_0xb612('0x6'));var client=jayson['client'][_0xb612('0x7')]({'port':0x232c});var socket=require(_0xb612('0x8'))({'host':_0xb612('0x9'),'port':0x18eb});require('./mailAccount.socket')[_0xb612('0xa')](socket);function respondWithRpcPromise(_0x1aab26,_0x120b3c,_0x3bdd80){return new BPromise(function(_0x123b9b,_0x654c21){return client[_0xb612('0xb')](_0x1aab26,_0x3bdd80)[_0xb612('0xc')](function(_0x76856e){logger['info']('MailAccount,\x20%s,\x20%s',_0x120b3c,'request\x20sent');logger['debug'](_0xb612('0xd'),_0x120b3c,_0xb612('0xe'),JSON[_0xb612('0xf')](_0x76856e));if(_0x76856e[_0xb612('0x10')]){if(_0x76856e[_0xb612('0x10')][_0xb612('0x11')]===0x1f4){logger[_0xb612('0x10')]('MailAccount,\x20%s,\x20%s',_0x120b3c,_0x76856e['error'][_0xb612('0x12')]);return _0x654c21(_0x76856e[_0xb612('0x10')][_0xb612('0x12')]);}logger[_0xb612('0x10')](_0xb612('0x13'),_0x120b3c,_0x76856e[_0xb612('0x10')][_0xb612('0x12')]);return _0x123b9b(_0x76856e['error'][_0xb612('0x12')]);}else{logger[_0xb612('0x14')](_0xb612('0x13'),_0x120b3c,'request\x20sent');_0x123b9b(_0x76856e['result'][_0xb612('0x12')]);}})[_0xb612('0x15')](function(_0x1d4cb4){logger[_0xb612('0x10')](_0xb612('0x13'),_0x120b3c,_0x1d4cb4);_0x654c21(_0x1d4cb4);});});}exports[_0xb612('0x16')]=function(_0x115a3d){var _0x45feef=this;return new Promise(function(_0x49c60e,_0x25f5a4){return db[_0xb612('0x17')][_0xb612('0x18')]({'raw':_0x115a3d[_0xb612('0x19')]?_0x115a3d[_0xb612('0x19')][_0xb612('0x1a')]===undefined?!![]:![]:!![],'where':_0x115a3d[_0xb612('0x19')]?_0x115a3d['options'][_0xb612('0x1b')]||null:null,'attributes':_0x115a3d[_0xb612('0x19')]?_0x115a3d[_0xb612('0x19')][_0xb612('0x1c')]||null:null,'limit':_0x115a3d[_0xb612('0x19')]?_0x115a3d['options']['limit']||null:null,'include':_0x115a3d['options']?_0x115a3d['options'][_0xb612('0x1d')]?_[_0xb612('0x1e')](_0x115a3d[_0xb612('0x19')]['include'],function(_0x4a35fb){return{'model':db[_0x4a35fb[_0xb612('0x1f')]],'as':_0x4a35fb['as'],'attributes':_0x4a35fb[_0xb612('0x1c')],'include':_0x4a35fb[_0xb612('0x1d')]?_[_0xb612('0x1e')](_0x4a35fb[_0xb612('0x1d')],function(_0x288601){return{'model':db[_0x288601['model']],'as':_0x288601['as'],'attributes':_0x288601[_0xb612('0x1c')],'include':_0x288601[_0xb612('0x1d')]?_[_0xb612('0x1e')](_0x288601[_0xb612('0x1d')],function(_0x35598e){return{'model':db[_0x35598e[_0xb612('0x1f')]],'as':_0x35598e['as'],'attributes':_0x35598e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb612('0xc')](function(_0x5263b2){logger[_0xb612('0x14')]('GetMailAccount',_0x115a3d);logger[_0xb612('0x20')](_0xb612('0x16'),_0x115a3d,JSON['stringify'](_0x5263b2));_0x49c60e(_0x5263b2);})['catch'](function(_0x97e316){logger[_0xb612('0x10')](_0xb612('0x16'),_0x97e316['message'],_0x115a3d);_0x25f5a4(_0x45feef[_0xb612('0x10')](0x1f4,_0x97e316[_0xb612('0x12')]));});});};exports[_0xb612('0x21')]=function(_0x487169){var _0x4d5e3d=this;return new Promise(function(_0xede5f2,_0x42c78c){return db[_0xb612('0x17')][_0xb612('0x22')]({'raw':_0x487169['options']?_0x487169[_0xb612('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x487169[_0xb612('0x19')]?_0x487169['options']['where']||null:null,'attributes':_0x487169[_0xb612('0x19')]?_0x487169[_0xb612('0x19')][_0xb612('0x1c')]||null:null,'include':_0x487169['options']?_0x487169[_0xb612('0x19')][_0xb612('0x1d')]?_['map'](_0x487169['options'][_0xb612('0x1d')],function(_0x203f59){return{'model':db[_0x203f59[_0xb612('0x1f')]],'as':_0x203f59['as'],'attributes':_0x203f59[_0xb612('0x1c')],'include':_0x203f59['include']?_[_0xb612('0x1e')](_0x203f59[_0xb612('0x1d')],function(_0x45fb1a){return{'model':db[_0x45fb1a[_0xb612('0x1f')]],'as':_0x45fb1a['as'],'attributes':_0x45fb1a['attributes'],'include':_0x45fb1a['include']?_[_0xb612('0x1e')](_0x45fb1a[_0xb612('0x1d')],function(_0x25c878){return{'model':db[_0x25c878[_0xb612('0x1f')]],'as':_0x25c878['as'],'attributes':_0x25c878[_0xb612('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x62998b){logger['info'](_0xb612('0x21'),_0x487169);logger[_0xb612('0x20')](_0xb612('0x21'),_0x487169,JSON[_0xb612('0xf')](_0x62998b));_0xede5f2(_0x62998b);})[_0xb612('0x15')](function(_0x51274f){logger[_0xb612('0x10')](_0xb612('0x21'),_0x51274f['message'],_0x487169);_0x42c78c(_0x4d5e3d[_0xb612('0x10')](0x1f4,_0x51274f[_0xb612('0x12')]));});});};exports['NotifyMailAccount']=function(_0x316571){var _0x372515=this;return new Promise(function(_0xfb3d64,_0x3b92a7){var _0x2ae23e={'body':_0x316571['body'],'channel':'mail'};var _0x5c2230=_[_0xb612('0x23')](_[_0xb612('0x24')](db[_0xb612('0x25')]['rawAttributes']),['createdAt',_0xb612('0x26'),_0xb612('0x27'),_0xb612('0x28')]);var _0x24b1a6=![];if(_0x316571['body']['id']){delete _0x316571[_0xb612('0x29')]['id'];}if(_[_0xb612('0x2a')](_0x316571[_0xb612('0x29')][_0xb612('0x2b')])){return _0x3b92a7(_0x372515[_0xb612('0x10')](0x1f4,_0xb612('0x2c')));}if(_['isNil'](_0x316571['body']['body'])||_0x316571[_0xb612('0x29')][_0xb612('0x29')]===''){return _0x3b92a7(_0x372515[_0xb612('0x10')](0x1f4,_0xb612('0x2d')));}if(_['isNil'](_0x316571[_0xb612('0x29')][_0xb612('0x2e')])){return _0x3b92a7(_0x372515['error'](0x1f4,_0xb612('0x2f')+_0x5c2230));}if(!_[_0xb612('0x30')](_0x5c2230,_0x316571['body'][_0xb612('0x2e')])){return _0x3b92a7(_0x372515[_0xb612('0x10')](0x1f4,_0xb612('0x31')+_0x5c2230));}var _0x29f51d={};_0x29f51d[_0x316571['body'][_0xb612('0x2e')]]=_0x316571[_0xb612('0x29')]['from'];return db[_0xb612('0x17')][_0xb612('0x22')]({'where':{'id':_0x316571[_0xb612('0x32')]['id']},'include':[{'model':db['CmList'],'as':_0xb612('0x33'),'include':[{'model':db[_0xb612('0x25')],'as':'Contacts','where':_0x29f51d,'limit':0x1,'order':[[_0xb612('0x26'),'DESC']]}]},{'model':db['MailApplication'],'as':_0xb612('0x34')},{'model':db['MailServerOut'],'as':_0xb612('0x35')}]})['then'](function(_0x13f5c3){if(_0x13f5c3&&_0x13f5c3['List']){var _0x54c35f=_0x13f5c3['get']({'plain':!![]});_0x2ae23e[_0xb612('0x32')]=_[_0xb612('0x36')](_0x54c35f,[_0xb612('0x34'),_0xb612('0x33')]);_0x2ae23e[_0xb612('0x37')]=_0x54c35f[_0xb612('0x34')];_0x2ae23e[_0xb612('0x38')]=_0x54c35f[_0xb612('0x33')];_0x2ae23e[_0xb612('0x37')]=_[_0xb612('0x39')](_0x2ae23e[_0xb612('0x37')],['priority'],['asc']);if(_0x2ae23e[_0xb612('0x32')]&&_0x2ae23e['account'][_0xb612('0x3a')]){_0x2ae23e[_0xb612('0x37')]['push']({'id':0x0,'priority':_0x2ae23e['applications'][_0xb612('0x3b')]+0x1,'app':_0xb612('0x3c'),'appdata':_0xb612('0x3a'),'interval':'*,*,*,*'});}if(_0x2ae23e[_0xb612('0x32')]['Applications']){delete _0x2ae23e[_0xb612('0x32')]['Applications'];}if(_0x2ae23e[_0xb612('0x32')][_0xb612('0x33')]){delete _0x2ae23e[_0xb612('0x32')][_0xb612('0x33')];}if(_0x54c35f[_0xb612('0x33')]['Contacts'][_0xb612('0x3b')]){return _0x54c35f[_0xb612('0x33')]['Contacts'][0x0];}var _0x509996=_[_0xb612('0x3d')](_0x316571[_0xb612('0x29')],{'firstName':_0x316571[_0xb612('0x29')][_0xb612('0x2b')],'ListId':_0x54c35f['ListId']});_0x509996[_0x316571[_0xb612('0x29')][_0xb612('0x2e')]]=_0x316571['body'][_0xb612('0x2b')];return db[_0xb612('0x25')]['create'](_0x509996);}else{throw new Error('List\x20not\x20found');}})[_0xb612('0xc')](function(_0x2feed0){_0x2ae23e[_0xb612('0x3e')]=_0x2feed0;if(_0x2feed0){if(!_0x316571[_0xb612('0x29')][_0xb612('0x12')][_0xb612('0x3f')]){_0x316571[_0xb612('0x29')][_0xb612('0x12')][_0xb612('0x3f')]=rs['generate']()+'\x20'+_0x316571['body'][_0xb612('0x12')][_0xb612('0x2b')];}var _0x8882b2={'ContactId':_0x2feed0['id'],'MailAccountId':_0x316571[_0xb612('0x32')]['id'],'inReplyTo':_0x316571[_0xb612('0x29')][_0xb612('0x12')]['messageId'],'to':_0x316571[_0xb612('0x29')][_0xb612('0x12')][_0xb612('0x2b')],'cc':_0x316571[_0xb612('0x29')][_0xb612('0x12')]['cc'],'subject':_0x316571['body']['message'][_0xb612('0x40')],'attach':_0x316571[_0xb612('0x29')]['message']['attach'],'lastMsgAt':moment()[_0xb612('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x316571[_0xb612('0x29')][_0xb612('0x29')]};return db['MailInteraction'][_0xb612('0x22')]({'where':{'closed':![],'MailAccountId':_0x316571[_0xb612('0x32')]['id']},'include':[{'model':db['MailMessage'],'as':_0xb612('0x42'),'attributes':[_0xb612('0x3f')],'where':{'messageId':_0x316571[_0xb612('0x29')]['message'][_0xb612('0x43')]}}]})['then'](function(_0x5372ca){if(_0x5372ca){return[_0x5372ca,![]];}return db[_0xb612('0x44')]['create'](_0x8882b2)[_0xb612('0xc')](function(_0x21190c){return[_0x21190c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb612('0x45')](function(_0xa4b012,_0x1ac80f){if(_0xa4b012){_0x24b1a6=_0x1ac80f;if(!_0x1ac80f){return _0xa4b012['update']({'inReplyTo':_0x316571['body']['message'][_0xb612('0x3f')],'to':_0x316571[_0xb612('0x29')][_0xb612('0x12')][_0xb612('0x2b')],'cc':_0x316571[_0xb612('0x29')][_0xb612('0x12')]['cc'],'subject':_0x316571['body'][_0xb612('0x12')]['subject'],'attach':_0xa4b012[_0xb612('0x46')]?_0xa4b012[_0xb612('0x46')]:_0x316571[_0xb612('0x29')]['message'][_0xb612('0x46')],'substatus':null,'substatusAt':moment()[_0xb612('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xb612('0x41')](_0xb612('0x47')),'lastMsgDirection':'in','lastMsgBody':_0x316571[_0xb612('0x29')]['body']});}else{return _0xa4b012;}}})[_0xb612('0xc')](function(_0x276053){_0x2ae23e[_0xb612('0x48')]=_0x276053[_0xb612('0x49')]({'plain':!![]});_0x2ae23e[_0xb612('0x48')][_0xb612('0x4a')]=_0x24b1a6;return db[_0xb612('0x4b')][_0xb612('0x4c')]({'body':_0x316571[_0xb612('0x29')]['body'],'MailAccountId':_0x316571[_0xb612('0x32')]['id'],'MailInteractionId':_0x276053['id'],'direction':'in','ContactId':_0x2ae23e[_0xb612('0x3e')]['id'],'messageId':_0x316571[_0xb612('0x29')][_0xb612('0x12')]['messageId'],'from':_0x316571[_0xb612('0x29')]['message'][_0xb612('0x2b')],'to':_0x316571[_0xb612('0x29')][_0xb612('0x12')]['to'],'cc':_0x316571['body'][_0xb612('0x12')]['cc'],'subject':_0x316571[_0xb612('0x29')]['message'][_0xb612('0x40')],'attach':_0x316571[_0xb612('0x29')][_0xb612('0x12')][_0xb612('0x46')],'Attachments':_0x316571['body']['message'][_0xb612('0x4d')],'originTo':_0x316571[_0xb612('0x29')]['message'][_0xb612('0x4e')],'originCc':_0x316571['body']['message'][_0xb612('0x4f')],'bcc':_0x316571[_0xb612('0x29')][_0xb612('0x12')]['bcc']},{'include':[{'model':db[_0xb612('0x50')],'as':'Attachments'}]});})[_0xb612('0xc')](function(_0x2a14f7){_0x2ae23e[_0xb612('0x12')]=_0x2a14f7;if(_0x2ae23e['interaction'][_0xb612('0x51')]){return db['User'][_0xb612('0x22')]({'attributes':['id',_0xb612('0x52')],'where':{'id':_0x2ae23e[_0xb612('0x48')][_0xb612('0x51')]}})[_0xb612('0xc')](function(_0x5e5c80){if(_0x5e5c80){_0x2ae23e[_0xb612('0x37')][_0xb612('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5e5c80[_0xb612('0x52')]+','+(_0x2ae23e['account'][_0xb612('0x54')]||0xa),'interval':_0xb612('0x55')});}return respondWithRpcPromise(_0xb612('0x56'),'startRouting',_0x2ae23e);});}return respondWithRpcPromise('Start',_0xb612('0x57'),_0x2ae23e);})[_0xb612('0xc')](function(_0x43e864){_0xfb3d64(_0x43e864);})['catch'](function(_0x21f0fa){_0x3b92a7(_0x372515[_0xb612('0x10')](0x1f4,_0x21f0fa['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 560593d..130a770 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 _0xb23e=['removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0xb23e,0xd3));var _0xeb23=function(_0x519b2d,_0x2dacfc){_0x519b2d=_0x519b2d-0x0;var _0x3070be=_0xb23e[_0x519b2d];return _0x3070be;};'use strict';var MailAccountEvents=require(_0xeb23('0x0'));var events=[_0xeb23('0x1'),_0xeb23('0x2'),_0xeb23('0x3')];function createListener(_0x57df8d,_0x49eee7){return function(_0x229769){_0x49eee7[_0xeb23('0x4')](_0x57df8d,_0x229769);};}function removeListener(_0x5927bb,_0x3c2361){return function(){MailAccountEvents[_0xeb23('0x5')](_0x5927bb,_0x3c2361);};}exports[_0xeb23('0x6')]=function(_0x5a3fc3){for(var _0x29b6ff=0x0,_0x4e00dd=events[_0xeb23('0x7')];_0x29b6ff<_0x4e00dd;_0x29b6ff++){var _0x4dc4bf=events[_0x29b6ff];var _0x2ebe19=createListener(_0xeb23('0x8')+_0x4dc4bf,_0x5a3fc3);MailAccountEvents['on'](_0x4dc4bf,_0x2ebe19);}}; \ No newline at end of file +var _0x487d=['removeListener','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x487d,0x133));var _0xd487=function(_0x403282,_0x39ab19){_0x403282=_0x403282-0x0;var _0x41f290=_0x487d[_0x403282];return _0x41f290;};'use strict';var MailAccountEvents=require(_0xd487('0x0'));var events=[_0xd487('0x1'),_0xd487('0x2'),_0xd487('0x3')];function createListener(_0x48cd69,_0x3418b9){return function(_0x407948){_0x3418b9[_0xd487('0x4')](_0x48cd69,_0x407948);};}function removeListener(_0x25d30f,_0x3976f2){return function(){MailAccountEvents[_0xd487('0x5')](_0x25d30f,_0x3976f2);};}exports['register']=function(_0x4c491d){for(var _0x22fde4=0x0,_0x5c29d4=events[_0xd487('0x6')];_0x22fde4<_0x5c29d4;_0x22fde4++){var _0x402bd3=events[_0x22fde4];var _0x2e140e=createListener(_0xd487('0x7')+_0x402bd3,_0x4c491d);MailAccountEvents['on'](_0x402bd3,_0x2e140e);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a3b6660..023f93a 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 _0x840b=['put','isAuthenticated','update','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','show'];(function(_0x2965d6,_0x4f3c54){var _0x122ef7=function(_0x3f31a6){while(--_0x3f31a6){_0x2965d6['push'](_0x2965d6['shift']());}};_0x122ef7(++_0x4f3c54);}(_0x840b,0xd8));var _0xb840=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x840b[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require(_0xb840('0x0'));var path=require('path');var express=require(_0xb840('0x1'));var router=express[_0xb840('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb840('0x3'));var config=require(_0xb840('0x4'));var controller=require(_0xb840('0x5'));router['get'](_0xb840('0x6'),auth['isAuthenticated'](),controller[_0xb840('0x7')]);router[_0xb840('0x8')]('/:id',auth[_0xb840('0x9')](),controller[_0xb840('0xa')]);router[_0xb840('0xb')](_0xb840('0x6'),auth['isAuthenticated'](),controller[_0xb840('0xc')]);module[_0xb840('0xd')]=router; \ No newline at end of file +var _0xc8e0=['./mailApplication.controller','get','show','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x402db9,_0x5196d4){var _0x2f09e1=function(_0x3da330){while(--_0x3da330){_0x402db9['push'](_0x402db9['shift']());}};_0x2f09e1(++_0x5196d4);}(_0xc8e0,0x190));var _0x0c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0c8e('0x0'));var util=require(_0x0c8e('0x1'));var path=require(_0x0c8e('0x2'));var express=require(_0x0c8e('0x3'));var router=express[_0x0c8e('0x4')]();var auth=require(_0x0c8e('0x5'));var interaction=require(_0x0c8e('0x6'));var config=require(_0x0c8e('0x7'));var controller=require(_0x0c8e('0x8'));router[_0x0c8e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0c8e('0xa')]);router[_0x0c8e('0xb')](_0x0c8e('0xc'),auth[_0x0c8e('0xd')](),controller[_0x0c8e('0xe')]);router[_0x0c8e('0xf')](_0x0c8e('0xc'),auth[_0x0c8e('0xd')](),controller['destroy']);module[_0x0c8e('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 17f8c73..86d5f8c 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 _0xa057=['STRING','noop','*,*,*,*','sequelize','INTEGER'];(function(_0x3216bd,_0x249204){var _0xb9c3c5=function(_0x25093f){while(--_0x25093f){_0x3216bd['push'](_0x3216bd['shift']());}};_0xb9c3c5(++_0x249204);}(_0xa057,0x157));var _0x7a05=function(_0x31816a,_0x469052){_0x31816a=_0x31816a-0x0;var _0x498821=_0xa057[_0x31816a];return _0x498821;};'use strict';var Sequelize=require(_0x7a05('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7a05('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7a05('0x2')],'allowNull':![],'defaultValue':_0x7a05('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x7a05('0x2')]},'interval':{'type':Sequelize[_0x7a05('0x2')],'defaultValue':_0x7a05('0x4')}}; \ No newline at end of file +var _0x5b08=['sequelize','INTEGER','STRING','noop'];(function(_0x26bb3f,_0x25cd1f){var _0x2cbd3f=function(_0x297152){while(--_0x297152){_0x26bb3f['push'](_0x26bb3f['shift']());}};_0x2cbd3f(++_0x25cd1f);}(_0x5b08,0x1d0));var _0x85b0=function(_0x58c3ff,_0x124777){_0x58c3ff=_0x58c3ff-0x0;var _0x4e5a30=_0x5b08[_0x58c3ff];return _0x4e5a30;};'use strict';var Sequelize=require(_0x85b0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x85b0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x85b0('0x2')],'allowNull':![],'defaultValue':_0x85b0('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x85b0('0x2')]},'interval':{'type':Sequelize[_0x85b0('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 37ee3b8..767ea5f 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 _0x2785=['desk.js','querystring','papaparse','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','include','merge','options','find','catch','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x3d6a00,_0x41f7f6){var _0xaeb4d5=function(_0x4ef862){while(--_0x4ef862){_0x3d6a00['push'](_0x3d6a00['shift']());}};_0xaeb4d5(++_0x41f7f6);}(_0x2785,0x1be));var _0x5278=function(_0x40edbb,_0x4b8e85){_0x40edbb=_0x40edbb-0x0;var _0x1c34e1=_0x2785[_0x40edbb];return _0x1c34e1;};'use strict';var jsonpatch=require(_0x5278('0x0'));var rp=require(_0x5278('0x1'));var moment=require(_0x5278('0x2'));var BPromise=require(_0x5278('0x3'));var Mustache=require(_0x5278('0x4'));var util=require('util');var path=require(_0x5278('0x5'));var sox=require(_0x5278('0x6'));var csv=require(_0x5278('0x7'));var ejs=require(_0x5278('0x8'));var fs=require('fs');var _=require(_0x5278('0x9'));var squel=require(_0x5278('0xa'));var crypto=require(_0x5278('0xb'));var jsforce=require(_0x5278('0xc'));var deskjs=require(_0x5278('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5278('0xe'));var Papa=require(_0x5278('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x5278('0x10'))(_0x5278('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5278('0x12'))['db'];function respondWithStatusCode(_0x2c3c18,_0x21d748){_0x21d748=_0x21d748||0xcc;return function(_0x5861ff){if(_0x5861ff){return _0x2c3c18[_0x5278('0x13')](_0x21d748);}return _0x2c3c18[_0x5278('0x14')](_0x21d748)[_0x5278('0x15')]();};}function respondWithResult(_0x5a6461,_0xbf9304){_0xbf9304=_0xbf9304||0xc8;return function(_0x1ef4b3){if(_0x1ef4b3){return _0x5a6461[_0x5278('0x14')](_0xbf9304)[_0x5278('0x16')](_0x1ef4b3);}};}function respondWithFilteredResult(_0x401fc4,_0x3d5dfd){return function(_0x124e3c){if(_0x124e3c){var _0xb8c7a6=_0x124e3c['count'],_0x3dda1e=_0x3d5dfd[_0x5278('0x17')],_0x570c66=_0x3d5dfd[_0x5278('0x17')]+_0x3d5dfd[_0x5278('0x18')],_0x43c537;if(_0x570c66>=_0xb8c7a6){_0x570c66=_0xb8c7a6;_0x43c537=0xc8;}else{_0x43c537=0xce;}_0x401fc4[_0x5278('0x14')](_0x43c537);return _0x401fc4[_0x5278('0x19')](_0x5278('0x1a'),_0x3dda1e+'-'+_0x570c66+'/'+_0xb8c7a6)['json'](_0x124e3c);}return null;};}function patchUpdates(_0x56fc5e){return function(_0x23aa05){try{jsonpatch[_0x5278('0x1b')](_0x23aa05,_0x56fc5e,!![]);}catch(_0x5e4bbd){return BPromise['reject'](_0x5e4bbd);}return _0x23aa05['save']();};}function saveUpdates(_0x5d0eb9,_0x5b2638){return function(_0x5302bc){if(_0x5302bc){return _0x5302bc[_0x5278('0x1c')](_0x5d0eb9)[_0x5278('0x1d')](function(_0x1303c7){return _0x1303c7;});}return null;};}function removeEntity(_0x1365c1,_0x3133de){return function(_0x2de42d){if(_0x2de42d){return _0x2de42d[_0x5278('0x1e')]()[_0x5278('0x1d')](function(){_0x1365c1[_0x5278('0x14')](0xcc)[_0x5278('0x15')]();});}};}function handleEntityNotFound(_0x385bae,_0x5d8e75){return function(_0x316daf){if(!_0x316daf){_0x385bae['sendStatus'](0x194);}return _0x316daf;};}function handleError(_0x290968,_0xc5d392){_0xc5d392=_0xc5d392||0x1f4;return function(_0x591840){logger[_0x5278('0x1f')](_0x591840[_0x5278('0x20')]);if(_0x591840[_0x5278('0x21')]){delete _0x591840['name'];}_0x290968['status'](_0xc5d392)[_0x5278('0x22')](_0x591840);};}exports['show']=function(_0x4a2758,_0x110491){var _0x5d0cf4={'raw':!![],'where':{'id':_0x4a2758['params']['id']}},_0x2981c3={};_0x2981c3[_0x5278('0x23')]=_[_0x5278('0x24')](db[_0x5278('0x25')]['rawAttributes']);_0x2981c3[_0x5278('0x26')]=_[_0x5278('0x24')](_0x4a2758[_0x5278('0x26')]);_0x2981c3[_0x5278('0x27')]=_[_0x5278('0x28')](_0x2981c3[_0x5278('0x23')],_0x2981c3[_0x5278('0x26')]);_0x5d0cf4[_0x5278('0x29')]=_['intersection'](_0x2981c3['model'],qs['fields'](_0x4a2758[_0x5278('0x26')]['fields']));_0x5d0cf4['attributes']=_0x5d0cf4[_0x5278('0x29')][_0x5278('0x2a')]?_0x5d0cf4[_0x5278('0x29')]:_0x2981c3[_0x5278('0x23')];if(_0x4a2758[_0x5278('0x26')][_0x5278('0x2b')]){_0x5d0cf4[_0x5278('0x2c')]=[{'all':!![]}];}_0x5d0cf4=_[_0x5278('0x2d')]({},_0x5d0cf4,_0x4a2758[_0x5278('0x2e')]);return db[_0x5278('0x25')][_0x5278('0x2f')](_0x5d0cf4)[_0x5278('0x1d')](handleEntityNotFound(_0x110491,null))[_0x5278('0x1d')](respondWithResult(_0x110491,null))[_0x5278('0x30')](handleError(_0x110491,null));};exports['update']=function(_0x5e46bd,_0x585a4a){if(_0x5e46bd[_0x5278('0x31')]['id']){delete _0x5e46bd[_0x5278('0x31')]['id'];}return db[_0x5278('0x25')][_0x5278('0x2f')]({'where':{'id':_0x5e46bd['params']['id']}})[_0x5278('0x1d')](handleEntityNotFound(_0x585a4a,null))['then'](saveUpdates(_0x5e46bd[_0x5278('0x31')],null))[_0x5278('0x1d')](respondWithResult(_0x585a4a,null))[_0x5278('0x30')](handleError(_0x585a4a,null));};exports[_0x5278('0x1e')]=function(_0x247086,_0x1b5250){return db[_0x5278('0x25')][_0x5278('0x2f')]({'where':{'id':_0x247086[_0x5278('0x32')]['id']}})[_0x5278('0x1d')](handleEntityNotFound(_0x1b5250,null))[_0x5278('0x1d')](removeEntity(_0x1b5250,null))[_0x5278('0x30')](handleError(_0x1b5250,null));}; \ No newline at end of file +var _0x693f=['body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var jsonpatch=require(_0xf693('0x0'));var rp=require(_0xf693('0x1'));var moment=require(_0xf693('0x2'));var BPromise=require(_0xf693('0x3'));var Mustache=require('mustache');var util=require(_0xf693('0x4'));var path=require(_0xf693('0x5'));var sox=require(_0xf693('0x6'));var csv=require(_0xf693('0x7'));var ejs=require(_0xf693('0x8'));var fs=require('fs');var _=require(_0xf693('0x9'));var squel=require(_0xf693('0xa'));var crypto=require('crypto');var jsforce=require(_0xf693('0xb'));var deskjs=require(_0xf693('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf693('0xd'));var Papa=require('papaparse');var qs=require(_0xf693('0xe'));var logger=require('../../config/logger')(_0xf693('0xf'));var utils=require(_0xf693('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d9159,_0x38b847){_0x38b847=_0x38b847||0xcc;return function(_0x527cd9){if(_0x527cd9){return _0x5d9159[_0xf693('0x11')](_0x38b847);}return _0x5d9159[_0xf693('0x12')](_0x38b847)[_0xf693('0x13')]();};}function respondWithResult(_0x1dc0da,_0x1f9205){_0x1f9205=_0x1f9205||0xc8;return function(_0x5a5a35){if(_0x5a5a35){return _0x1dc0da['status'](_0x1f9205)[_0xf693('0x14')](_0x5a5a35);}};}function respondWithFilteredResult(_0x38bd65,_0x4c9ab7){return function(_0x25d3f6){if(_0x25d3f6){var _0x1bfd8d=_0x25d3f6[_0xf693('0x15')],_0x5a5f86=_0x4c9ab7[_0xf693('0x16')],_0x5c42f0=_0x4c9ab7[_0xf693('0x16')]+_0x4c9ab7[_0xf693('0x17')],_0x957c3f;if(_0x5c42f0>=_0x1bfd8d){_0x5c42f0=_0x1bfd8d;_0x957c3f=0xc8;}else{_0x957c3f=0xce;}_0x38bd65['status'](_0x957c3f);return _0x38bd65[_0xf693('0x18')](_0xf693('0x19'),_0x5a5f86+'-'+_0x5c42f0+'/'+_0x1bfd8d)[_0xf693('0x14')](_0x25d3f6);}return null;};}function patchUpdates(_0x2a5e1b){return function(_0x345539){try{jsonpatch[_0xf693('0x1a')](_0x345539,_0x2a5e1b,!![]);}catch(_0x49fbbb){return BPromise['reject'](_0x49fbbb);}return _0x345539['save']();};}function saveUpdates(_0x2474d4,_0xf4d20e){return function(_0x3f4d4d){if(_0x3f4d4d){return _0x3f4d4d[_0xf693('0x1b')](_0x2474d4)[_0xf693('0x1c')](function(_0x58f0f0){return _0x58f0f0;});}return null;};}function removeEntity(_0x403ae6,_0x439d77){return function(_0x5f89c8){if(_0x5f89c8){return _0x5f89c8[_0xf693('0x1d')]()[_0xf693('0x1c')](function(){_0x403ae6[_0xf693('0x12')](0xcc)[_0xf693('0x13')]();});}};}function handleEntityNotFound(_0x38f209,_0x50b20e){return function(_0x505ada){if(!_0x505ada){_0x38f209[_0xf693('0x11')](0x194);}return _0x505ada;};}function handleError(_0x2e022b,_0x260181){_0x260181=_0x260181||0x1f4;return function(_0x400398){logger[_0xf693('0x1e')](_0x400398[_0xf693('0x1f')]);if(_0x400398['name']){delete _0x400398[_0xf693('0x20')];}_0x2e022b[_0xf693('0x12')](_0x260181)[_0xf693('0x21')](_0x400398);};}exports[_0xf693('0x22')]=function(_0x4840e2,_0x950632){var _0x302e08={'raw':!![],'where':{'id':_0x4840e2[_0xf693('0x23')]['id']}},_0xe7a396={};_0xe7a396[_0xf693('0x24')]=_[_0xf693('0x25')](db[_0xf693('0x26')][_0xf693('0x27')]);_0xe7a396[_0xf693('0x28')]=_[_0xf693('0x25')](_0x4840e2['query']);_0xe7a396[_0xf693('0x29')]=_[_0xf693('0x2a')](_0xe7a396[_0xf693('0x24')],_0xe7a396[_0xf693('0x28')]);_0x302e08[_0xf693('0x2b')]=_[_0xf693('0x2a')](_0xe7a396[_0xf693('0x24')],qs[_0xf693('0x2c')](_0x4840e2['query'][_0xf693('0x2c')]));_0x302e08[_0xf693('0x2b')]=_0x302e08[_0xf693('0x2b')][_0xf693('0x2d')]?_0x302e08['attributes']:_0xe7a396['model'];if(_0x4840e2[_0xf693('0x28')][_0xf693('0x2e')]){_0x302e08['include']=[{'all':!![]}];}_0x302e08=_[_0xf693('0x2f')]({},_0x302e08,_0x4840e2[_0xf693('0x30')]);return db[_0xf693('0x26')][_0xf693('0x31')](_0x302e08)['then'](handleEntityNotFound(_0x950632,null))[_0xf693('0x1c')](respondWithResult(_0x950632,null))[_0xf693('0x32')](handleError(_0x950632,null));};exports[_0xf693('0x1b')]=function(_0x3a2ced,_0x25a1b2){if(_0x3a2ced[_0xf693('0x33')]['id']){delete _0x3a2ced[_0xf693('0x33')]['id'];}return db[_0xf693('0x26')]['find']({'where':{'id':_0x3a2ced[_0xf693('0x23')]['id']}})[_0xf693('0x1c')](handleEntityNotFound(_0x25a1b2,null))[_0xf693('0x1c')](saveUpdates(_0x3a2ced[_0xf693('0x33')],null))[_0xf693('0x1c')](respondWithResult(_0x25a1b2,null))[_0xf693('0x32')](handleError(_0x25a1b2,null));};exports['destroy']=function(_0x57ac5b,_0x2168e4){return db[_0xf693('0x26')][_0xf693('0x31')]({'where':{'id':_0x57ac5b['params']['id']}})[_0xf693('0x1c')](handleEntityNotFound(_0x2168e4,null))[_0xf693('0x1c')](removeEntity(_0x2168e4,null))[_0xf693('0x32')](handleError(_0x2168e4,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3e3c0d7..4f87d58 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 _0x41d7=['lodash','util','../../config/logger','api','moment','bluebird','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0x41d7,0x186));var _0x741d=function(_0xe60bb8,_0x3ed3b7){_0xe60bb8=_0xe60bb8-0x0;var _0x57e492=_0x41d7[_0xe60bb8];return _0x57e492;};'use strict';var _=require(_0x741d('0x0'));var util=require(_0x741d('0x1'));var logger=require(_0x741d('0x2'))(_0x741d('0x3'));var moment=require(_0x741d('0x4'));var BPromise=require(_0x741d('0x5'));var rp=require('request-promise');var attributes=require(_0x741d('0x6'));module[_0x741d('0x7')]=function(_0x44b68e,_0x28c899){return _0x44b68e['define'](_0x741d('0x8'),attributes,{'tableName':_0x741d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2d9=['exports','define','MailApplication','mail_applications','lodash','api','bluebird','request-promise','./mailApplication.attributes'];(function(_0x49fdc9,_0x429f86){var _0xc586fd=function(_0xd509a0){while(--_0xd509a0){_0x49fdc9['push'](_0x49fdc9['shift']());}};_0xc586fd(++_0x429f86);}(_0xd2d9,0x16c));var _0x9d2d=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0xd2d9[_0x21353c];return _0xa99120;};'use strict';var _=require(_0x9d2d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d2d('0x1'));var moment=require('moment');var BPromise=require(_0x9d2d('0x2'));var rp=require(_0x9d2d('0x3'));var attributes=require(_0x9d2d('0x4'));module[_0x9d2d('0x5')]=function(_0x4b4189,_0x9430a8){return _0x4b4189[_0x9d2d('0x6')](_0x9d2d('0x7'),attributes,{'tableName':_0x9d2d('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 8350e90..addc8b2 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 _0x5f41=['randomstring','../../config/utils','rpc','../../config/environment','client','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','MailApplication','update','body','options','raw','where','attributes','limit','catch','util','bluebird'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x5f41,0x19e));var _0x15f4=function(_0xd6d624,_0x3f9d6b){_0xd6d624=_0xd6d624-0x0;var _0x11f083=_0x5f41[_0xd6d624];return _0x11f083;};'use strict';var _=require('lodash');var util=require(_0x15f4('0x0'));var moment=require('moment');var BPromise=require(_0x15f4('0x1'));var rs=require(_0x15f4('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x15f4('0x3'));var logger=require('../../config/logger')(_0x15f4('0x4'));var config=require(_0x15f4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x15f4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e707a,_0x6bff2b,_0x1ad70a){return new BPromise(function(_0x2a80d9,_0x87dd85){return client[_0x15f4('0x7')](_0x3e707a,_0x1ad70a)[_0x15f4('0x8')](function(_0x2e66f3){logger[_0x15f4('0x9')](_0x15f4('0xa'),_0x6bff2b,'request\x20sent');logger[_0x15f4('0xb')](_0x15f4('0xc'),_0x6bff2b,_0x15f4('0xd'),JSON['stringify'](_0x2e66f3));if(_0x2e66f3[_0x15f4('0xe')]){if(_0x2e66f3['error'][_0x15f4('0xf')]===0x1f4){logger[_0x15f4('0xe')]('MailApplication,\x20%s,\x20%s',_0x6bff2b,_0x2e66f3[_0x15f4('0xe')][_0x15f4('0x10')]);return _0x87dd85(_0x2e66f3[_0x15f4('0xe')]['message']);}logger[_0x15f4('0xe')](_0x15f4('0xa'),_0x6bff2b,_0x2e66f3['error']['message']);return _0x2a80d9(_0x2e66f3['error'][_0x15f4('0x10')]);}else{logger['info'](_0x15f4('0xa'),_0x6bff2b,_0x15f4('0xd'));_0x2a80d9(_0x2e66f3['result'][_0x15f4('0x10')]);}})['catch'](function(_0x3a3d23){logger['error'](_0x15f4('0xa'),_0x6bff2b,_0x3a3d23);_0x87dd85(_0x3a3d23);});});}exports['UpdateMailApplication']=function(_0x2ced2e){var _0x1d89ca=this;return new Promise(function(_0x31ac8d,_0x4bda95){return db[_0x15f4('0x11')][_0x15f4('0x12')](_0x2ced2e[_0x15f4('0x13')],{'raw':_0x2ced2e[_0x15f4('0x14')]?_0x2ced2e['options'][_0x15f4('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ced2e[_0x15f4('0x14')]?_0x2ced2e['options'][_0x15f4('0x16')]||null:null,'attributes':_0x2ced2e[_0x15f4('0x14')]?_0x2ced2e[_0x15f4('0x14')][_0x15f4('0x17')]||null:null,'limit':_0x2ced2e['options']?_0x2ced2e['options'][_0x15f4('0x18')]||null:null})[_0x15f4('0x8')](function(_0x13bbb2){logger[_0x15f4('0x9')]('UpdateMailApplication',_0x2ced2e);logger['debug']('UpdateMailApplication',_0x2ced2e,JSON['stringify'](_0x13bbb2));_0x31ac8d(_0x13bbb2);})[_0x15f4('0x19')](function(_0x26c17d){logger[_0x15f4('0xe')]('UpdateMailApplication',_0x26c17d['message'],_0x2ced2e);_0x4bda95(_0x1d89ca[_0x15f4('0xe')](0x1f4,_0x26c17d[_0x15f4('0x10')]));});});}; \ No newline at end of file +var _0xaa8f=['body','options','raw','attributes','limit','then','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateMailApplication','update'];(function(_0xd83f3e,_0x3c909e){var _0x3afffc=function(_0x105730){while(--_0x105730){_0xd83f3e['push'](_0xd83f3e['shift']());}};_0x3afffc(++_0x3c909e);}(_0xaa8f,0x18d));var _0xfaa8=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0xaa8f[_0x95411e];return _0x2c8718;};'use strict';var _=require(_0xfaa8('0x0'));var util=require(_0xfaa8('0x1'));var moment=require(_0xfaa8('0x2'));var BPromise=require(_0xfaa8('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xfaa8('0x4'))['db'];var utils=require(_0xfaa8('0x5'));var logger=require(_0xfaa8('0x6'))(_0xfaa8('0x7'));var config=require('../../config/environment');var jayson=require(_0xfaa8('0x8'));var client=jayson[_0xfaa8('0x9')][_0xfaa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x574d9c,_0x25545d,_0x462d5d){return new BPromise(function(_0x4f8267,_0x21327d){return client[_0xfaa8('0xb')](_0x574d9c,_0x462d5d)['then'](function(_0x1d33e8){logger['info'](_0xfaa8('0xc'),_0x25545d,_0xfaa8('0xd'));logger[_0xfaa8('0xe')](_0xfaa8('0xf'),_0x25545d,_0xfaa8('0xd'),JSON['stringify'](_0x1d33e8));if(_0x1d33e8[_0xfaa8('0x10')]){if(_0x1d33e8[_0xfaa8('0x10')][_0xfaa8('0x11')]===0x1f4){logger['error'](_0xfaa8('0xc'),_0x25545d,_0x1d33e8[_0xfaa8('0x10')][_0xfaa8('0x12')]);return _0x21327d(_0x1d33e8['error'][_0xfaa8('0x12')]);}logger[_0xfaa8('0x10')](_0xfaa8('0xc'),_0x25545d,_0x1d33e8[_0xfaa8('0x10')][_0xfaa8('0x12')]);return _0x4f8267(_0x1d33e8[_0xfaa8('0x10')]['message']);}else{logger[_0xfaa8('0x13')](_0xfaa8('0xc'),_0x25545d,_0xfaa8('0xd'));_0x4f8267(_0x1d33e8['result'][_0xfaa8('0x12')]);}})[_0xfaa8('0x14')](function(_0xae8d26){logger['error'](_0xfaa8('0xc'),_0x25545d,_0xae8d26);_0x21327d(_0xae8d26);});});}exports[_0xfaa8('0x15')]=function(_0x5cf91d){var _0x31b26e=this;return new Promise(function(_0x1d382f,_0x45161b){return db['MailApplication'][_0xfaa8('0x16')](_0x5cf91d[_0xfaa8('0x17')],{'raw':_0x5cf91d[_0xfaa8('0x18')]?_0x5cf91d[_0xfaa8('0x18')][_0xfaa8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cf91d['options']?_0x5cf91d[_0xfaa8('0x18')]['where']||null:null,'attributes':_0x5cf91d[_0xfaa8('0x18')]?_0x5cf91d[_0xfaa8('0x18')][_0xfaa8('0x1a')]||null:null,'limit':_0x5cf91d[_0xfaa8('0x18')]?_0x5cf91d[_0xfaa8('0x18')][_0xfaa8('0x1b')]||null:null})[_0xfaa8('0x1c')](function(_0x142a24){logger[_0xfaa8('0x13')](_0xfaa8('0x15'),_0x5cf91d);logger[_0xfaa8('0xe')](_0xfaa8('0x15'),_0x5cf91d,JSON[_0xfaa8('0x1d')](_0x142a24));_0x1d382f(_0x142a24);})[_0xfaa8('0x14')](function(_0x14bb03){logger['error'](_0xfaa8('0x15'),_0x14bb03[_0xfaa8('0x12')],_0x5cf91d);_0x45161b(_0x31b26e['error'](0x1f4,_0x14bb03['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f71d019..170eece 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 _0x911d=['addMessage','/:id/tags','mail','mailinteraction:addtags','put','tracked','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','post','create'];(function(_0x100e96,_0x568af9){var _0x3e9ead=function(_0x2bffd0){while(--_0x2bffd0){_0x100e96['push'](_0x100e96['shift']());}};_0x3e9ead(++_0x568af9);}(_0x911d,0x192));var _0xd911=function(_0x1286d5,_0x5c2870){_0x1286d5=_0x1286d5-0x0;var _0x1e06b0=_0x911d[_0x1286d5];return _0x1e06b0;};'use strict';var multer=require(_0xd911('0x0'));var util=require(_0xd911('0x1'));var path=require(_0xd911('0x2'));var express=require(_0xd911('0x3'));var router=express[_0xd911('0x4')]();var auth=require(_0xd911('0x5'));var interaction=require(_0xd911('0x6'));var config=require('../../config/environment');var controller=require(_0xd911('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd911('0x8')]);router[_0xd911('0x9')](_0xd911('0xa'),auth[_0xd911('0xb')](),controller[_0xd911('0xc')]);router[_0xd911('0x9')](_0xd911('0xd'),auth[_0xd911('0xb')](),controller[_0xd911('0xe')]);router['get'](_0xd911('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xd911('0x10')]('/',auth[_0xd911('0xb')](),controller[_0xd911('0x11')]);router[_0xd911('0x10')](_0xd911('0xf'),auth[_0xd911('0xb')](),controller[_0xd911('0x12')]);router[_0xd911('0x10')](_0xd911('0x13'),auth[_0xd911('0xb')](),interaction['tracked'](_0xd911('0x14'),_0xd911('0x15')),controller['addTags']);router[_0xd911('0x16')](_0xd911('0xd'),auth['isAuthenticated'](),interaction[_0xd911('0x17')]('mail',_0xd911('0x18')),controller['update']);router[_0xd911('0x19')](_0xd911('0xd'),auth[_0xd911('0xb')](),interaction[_0xd911('0x17')](_0xd911('0x14'),_0xd911('0x1a')),controller[_0xd911('0x1b')]);router[_0xd911('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd911('0x1c')]);module[_0xd911('0x1d')]=router; \ No newline at end of file +var _0xab77=['mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','util','path','Router','../../config/environment','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put'];(function(_0x1890b1,_0x243c50){var _0xaab79a=function(_0x34ab8a){while(--_0x34ab8a){_0x1890b1['push'](_0x1890b1['shift']());}};_0xaab79a(++_0x243c50);}(_0xab77,0x1e3));var _0x7ab7=function(_0x12ef39,_0x18d320){_0x12ef39=_0x12ef39-0x0;var _0x47a734=_0xab77[_0x12ef39];return _0x47a734;};'use strict';var multer=require('multer');var util=require(_0x7ab7('0x0'));var path=require(_0x7ab7('0x1'));var express=require('express');var router=express[_0x7ab7('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7ab7('0x3'));var controller=require(_0x7ab7('0x4'));router[_0x7ab7('0x5')]('/',auth[_0x7ab7('0x6')](),controller['index']);router[_0x7ab7('0x5')](_0x7ab7('0x7'),auth[_0x7ab7('0x6')](),controller[_0x7ab7('0x8')]);router['get'](_0x7ab7('0x9'),auth[_0x7ab7('0x6')](),controller[_0x7ab7('0xa')]);router['get'](_0x7ab7('0xb'),auth[_0x7ab7('0x6')](),controller[_0x7ab7('0xc')]);router[_0x7ab7('0xd')]('/',auth[_0x7ab7('0x6')](),controller[_0x7ab7('0xe')]);router['post'](_0x7ab7('0xb'),auth[_0x7ab7('0x6')](),controller[_0x7ab7('0xf')]);router['post'](_0x7ab7('0x10'),auth[_0x7ab7('0x6')](),interaction[_0x7ab7('0x11')](_0x7ab7('0x12'),_0x7ab7('0x13')),controller['addTags']);router[_0x7ab7('0x14')](_0x7ab7('0x9'),auth['isAuthenticated'](),interaction[_0x7ab7('0x11')](_0x7ab7('0x12'),_0x7ab7('0x15')),controller[_0x7ab7('0x16')]);router[_0x7ab7('0x17')](_0x7ab7('0x9'),auth[_0x7ab7('0x6')](),interaction[_0x7ab7('0x11')]('mail',_0x7ab7('0x18')),controller[_0x7ab7('0x19')]);router['delete'](_0x7ab7('0x10'),auth[_0x7ab7('0x6')](),controller[_0x7ab7('0x1a')]);module[_0x7ab7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0d5216f..f062c8b 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 _0xa3df=['out','lastMsgBody','fromString','getDataValue','slice','join','html-to-text','iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'];(function(_0x316d5a,_0x2bb4e8){var _0x5f173e=function(_0x122545){while(--_0x122545){_0x316d5a['push'](_0x316d5a['shift']());}};_0x5f173e(++_0x2bb4e8);}(_0xa3df,0x114));var _0xfa3d=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xa3df[_0x1780f8];return _0x33a410;};'use strict';var Sequelize=require('sequelize');var htmlToText=require(_0xfa3d('0x0'));var iconv=require(_0xfa3d('0x1'));module[_0xfa3d('0x2')]={'closed':{'type':Sequelize[_0xfa3d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfa3d('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0xbe)},'to':{'type':Sequelize[_0xfa3d('0x5')]},'cc':{'type':Sequelize['TEXT'](_0xfa3d('0x6'))},'subject':{'type':Sequelize[_0xfa3d('0x7')]('')+_0xfa3d('0x8')},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfa3d('0x4')]},'substatus':{'type':Sequelize[_0xfa3d('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfa3d('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfa3d('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfa3d('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xfa3d('0x7')]('long')+'\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','get':function(){try{return this['getDataValue'](_0xfa3d('0xa'))?htmlToText[_0xfa3d('0xb')](this[_0xfa3d('0xc')](_0xfa3d('0xa')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})['split']('\x0a')[_0xfa3d('0xd')](0x0,0x6)[_0xfa3d('0xe')]('\x0a'):null;}catch(_0x8c661f){return null;}}}}; \ No newline at end of file +var _0x87b2=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','out','ENUM','getDataValue','split','slice','join','html-to-text'];(function(_0x47b2b0,_0x293376){var _0x378284=function(_0x4bc1e8){while(--_0x4bc1e8){_0x47b2b0['push'](_0x47b2b0['shift']());}};_0x378284(++_0x293376);}(_0x87b2,0xb3));var _0x287b=function(_0x4d06b1,_0x4dc5bf){_0x4d06b1=_0x4d06b1-0x0;var _0x41a729=_0x87b2[_0x4d06b1];return _0x41a729;};'use strict';var Sequelize=require('sequelize');var htmlToText=require(_0x287b('0x0'));var iconv=require(_0x287b('0x1'));module[_0x287b('0x2')]={'closed':{'type':Sequelize[_0x287b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x287b('0x4')]},'disposition':{'type':Sequelize[_0x287b('0x5')]},'note':{'type':Sequelize[_0x287b('0x5')]},'inReplyTo':{'type':Sequelize[_0x287b('0x5')](0xbe)},'to':{'type':Sequelize[_0x287b('0x5')]},'cc':{'type':Sequelize[_0x287b('0x6')](_0x287b('0x7'))},'subject':{'type':Sequelize[_0x287b('0x6')]('')+_0x287b('0x8')},'attach':{'type':Sequelize[_0x287b('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x287b('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x287b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x287b('0xa')]('in',_0x287b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT']('long')+_0x287b('0x8'),'get':function(){try{return this[_0x287b('0xb')]('lastMsgBody')?htmlToText['fromString'](this[_0x287b('0xb')]('lastMsgBody'),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x287b('0xc')]('\x0a')[_0x287b('0xd')](0x0,0x6)[_0x287b('0xe')]('\x0a'):null;}catch(_0x542c82){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 9d23edb..844ff13 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 _0xaf69=['apply','reject','save','update','then','destroy','error','stack','name','index','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','include','tag','push','Tag','read','MailMessage','Messages','direction','createdAt','distinct','MailInteraction','User','Users','fullname','CmContact','Contact','MailAccount','Account','email','Tags','color','ThroughTags','rows','catch','show','params','includeAll','options','find','body','describe','addMessage','ids','omit','order','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','request-promise','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailInteraction.socket','sendStatus','status','end','count','offset','limit','set','json'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0xaf69,0x11a));var _0x9af6=function(_0x5cc8b5,_0xcc5952){_0x5cc8b5=_0x5cc8b5-0x0;var _0x489b59=_0xaf69[_0x5cc8b5];return _0x489b59;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x9af6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9af6('0x1'));var path=require(_0x9af6('0x2'));var sox=require(_0x9af6('0x3'));var csv=require(_0x9af6('0x4'));var ejs=require(_0x9af6('0x5'));var fs=require('fs');var _=require(_0x9af6('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9af6('0x7'));var deskjs=require(_0x9af6('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9af6('0x9'));var qs=require(_0x9af6('0xa'));var logger=require(_0x9af6('0xb'))(_0x9af6('0xc'));var utils=require(_0x9af6('0xd'));var config=require(_0x9af6('0xe'));var db=require(_0x9af6('0xf'))['db'];var socket=require(_0x9af6('0x10'))({'host':_0x9af6('0x11'),'port':0x18eb});require(_0x9af6('0x12'))['register'](socket);function respondWithStatusCode(_0x47907f,_0x1cb99a){_0x1cb99a=_0x1cb99a||0xcc;return function(_0xe8c88f){if(_0xe8c88f){return _0x47907f[_0x9af6('0x13')](_0x1cb99a);}return _0x47907f[_0x9af6('0x14')](_0x1cb99a)[_0x9af6('0x15')]();};}function respondWithResult(_0x353969,_0x5cf84d){_0x5cf84d=_0x5cf84d||0xc8;return function(_0x4880f4){if(_0x4880f4){return _0x353969['status'](_0x5cf84d)['json'](_0x4880f4);}};}function respondWithFilteredResult(_0x546b39,_0x478363){return function(_0x33b66b){if(_0x33b66b){var _0x293c8c=_0x33b66b[_0x9af6('0x16')],_0x25ae6e=_0x478363[_0x9af6('0x17')],_0x4a145f=_0x478363['offset']+_0x478363[_0x9af6('0x18')],_0x167d81;if(_0x4a145f>=_0x293c8c){_0x4a145f=_0x293c8c;_0x167d81=0xc8;}else{_0x167d81=0xce;}_0x546b39[_0x9af6('0x14')](_0x167d81);return _0x546b39[_0x9af6('0x19')]('Content-Range',_0x25ae6e+'-'+_0x4a145f+'/'+_0x293c8c)[_0x9af6('0x1a')](_0x33b66b);}return null;};}function patchUpdates(_0x4e0bb5){return function(_0x4e2d3b){try{jsonpatch[_0x9af6('0x1b')](_0x4e2d3b,_0x4e0bb5,!![]);}catch(_0x2ee151){return BPromise[_0x9af6('0x1c')](_0x2ee151);}return _0x4e2d3b[_0x9af6('0x1d')]();};}function saveUpdates(_0xe708aa,_0xc4b91a){return function(_0x51cb5c){if(_0x51cb5c){return _0x51cb5c[_0x9af6('0x1e')](_0xe708aa)[_0x9af6('0x1f')](function(_0x26ab01){return _0x26ab01;});}return null;};}function removeEntity(_0x11e84f,_0x59fb35){return function(_0x113f7d){if(_0x113f7d){return _0x113f7d[_0x9af6('0x20')]()[_0x9af6('0x1f')](function(){_0x11e84f[_0x9af6('0x14')](0xcc)[_0x9af6('0x15')]();});}};}function handleEntityNotFound(_0x31657c,_0x4c780c){return function(_0x1918dc){if(!_0x1918dc){_0x31657c[_0x9af6('0x13')](0x194);}return _0x1918dc;};}function handleError(_0x41c13f,_0x19b830){_0x19b830=_0x19b830||0x1f4;return function(_0x1388d2){logger[_0x9af6('0x21')](_0x1388d2[_0x9af6('0x22')]);if(_0x1388d2[_0x9af6('0x23')]){delete _0x1388d2[_0x9af6('0x23')];}_0x41c13f[_0x9af6('0x14')](_0x19b830)['send'](_0x1388d2);};}exports[_0x9af6('0x24')]=function(_0x2b7279,_0x323199){var _0xc58e87={},_0x2c4b31={},_0x3627b0={'count':0x0,'rows':[]};var _0x4d8e7e=db['MailInteraction']['rawAttributes'];_0x2c4b31[_0x9af6('0x25')]=_[_0x9af6('0x26')](_0x4d8e7e);var _0x473032={'dateStart':_0x2b7279[_0x9af6('0x27')][_0x9af6('0x28')],'dateEnd':_0x2b7279[_0x9af6('0x27')][_0x9af6('0x29')]};delete _0x2b7279[_0x9af6('0x27')]['dateStart'];delete _0x2b7279[_0x9af6('0x27')][_0x9af6('0x29')];_0x2c4b31['query']=_['keys'](_0x2b7279[_0x9af6('0x27')]);_0x2c4b31[_0x9af6('0x2a')]=_[_0x9af6('0x2b')](_0x2c4b31[_0x9af6('0x25')],_0x2c4b31['query']);_0xc58e87[_0x9af6('0x2c')]=_[_0x9af6('0x2b')](_0x2c4b31[_0x9af6('0x25')],qs[_0x9af6('0x2d')](_0x2b7279[_0x9af6('0x27')][_0x9af6('0x2d')]));_0xc58e87[_0x9af6('0x2c')]=_0xc58e87['attributes'][_0x9af6('0x2e')]?_0xc58e87['attributes']:_0x2c4b31['model'];if(!_0x2b7279[_0x9af6('0x27')][_0x9af6('0x2f')](_0x9af6('0x30'))){_0xc58e87[_0x9af6('0x18')]=qs[_0x9af6('0x18')](_0x2b7279[_0x9af6('0x27')]['limit']);_0xc58e87[_0x9af6('0x17')]=qs[_0x9af6('0x17')](_0x2b7279['query']['offset']);}_0xc58e87['order']=qs[_0x9af6('0x31')](_0x2b7279['query'][_0x9af6('0x31')]);_0xc58e87[_0x9af6('0x32')]=qs['filters'](_[_0x9af6('0x33')](_0x2b7279[_0x9af6('0x27')],_0x2c4b31[_0x9af6('0x2a')]));if(_0x473032[_0x9af6('0x28')]){if(_0x473032['dateEnd']){_0x473032[_0x9af6('0x29')]=moment(_0x473032[_0x9af6('0x29')])[_0x9af6('0x34')](0x1,'day');}else{_0x473032[_0x9af6('0x29')]=moment(_0x473032[_0x9af6('0x28')])[_0x9af6('0x34')](0x1,_0x9af6('0x35'));}_[_0x9af6('0x36')](_0xc58e87[_0x9af6('0x32')],{'createdAt':{'$gte':_0x473032[_0x9af6('0x28')],'$lte':_0x473032[_0x9af6('0x29')]}});}if(_0x2b7279[_0x9af6('0x27')]['filter']){_0xc58e87[_0x9af6('0x32')]=_[_0x9af6('0x36')](_0xc58e87[_0x9af6('0x32')],{'$or':_['map'](_0xc58e87[_0x9af6('0x2c')],function(_0x344ff4){var _0x2a5e81={};_0x2a5e81[_0x344ff4]={'$like':'%'+_0x2b7279['query']['filter']+'%'};return _0x2a5e81;})});}_0xc58e87=_['merge']({},_0xc58e87,_0x2b7279['options']);var _0x226228={'where':_0xc58e87[_0x9af6('0x32')]};_0x226228[_0x9af6('0x37')]=[];if(_0x2b7279[_0x9af6('0x27')][_0x9af6('0x38')]){_0x226228[_0x9af6('0x37')][_0x9af6('0x39')]({'model':db[_0x9af6('0x3a')],'as':'Tags','attributes':['id'],'where':{'id':_0x2b7279[_0x9af6('0x27')][_0x9af6('0x38')]},'required':!![]});_0x226228['distinct']=!![];}if(_0x2b7279['query'][_0x9af6('0x3b')]){_0x226228[_0x9af6('0x37')][_0x9af6('0x39')]({'model':db[_0x9af6('0x3c')],'as':_0x9af6('0x3d'),'attributes':['id',_0x9af6('0x3e'),_0x9af6('0x3f'),'read'],'where':{'direction':'in','read':_0x2b7279[_0x9af6('0x27')][_0x9af6('0x3b')]||![]},'required':!![]});_0x226228[_0x9af6('0x40')]=!![];}return db[_0x9af6('0x41')][_0x9af6('0x16')](_0x226228)[_0x9af6('0x1f')](function(_0x5160e1){_0x3627b0[_0x9af6('0x16')]=_0x5160e1;if(_0x2b7279[_0x9af6('0x27')]['includeAll']){_0xc58e87[_0x9af6('0x37')]=[{'model':db[_0x9af6('0x42')],'as':_0x9af6('0x43'),'required':![],'attributes':['id',_0x9af6('0x23'),_0x9af6('0x44')]},{'model':db[_0x9af6('0x45')],'as':_0x9af6('0x46'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9af6('0x23'),'fullname','internal'],'required':![]},{'model':db[_0x9af6('0x47')],'as':_0x9af6('0x48'),'attributes':[_0x9af6('0x23'),'key',_0x9af6('0x49')],'required':![]},{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x9af6('0x3e'),_0x9af6('0x3f'),'read'],'where':{'direction':'in','read':_0x2b7279[_0x9af6('0x27')][_0x9af6('0x3b')]||![]},'required':_0x2b7279[_0x9af6('0x27')]['read']||![]},{'model':db[_0x9af6('0x3a')],'as':_0x9af6('0x4a'),'attributes':['id',_0x9af6('0x23'),_0x9af6('0x4b')],'required':_0x2b7279[_0x9af6('0x27')][_0x9af6('0x38')]?!![]:![]},{'model':db[_0x9af6('0x3a')],'as':_0x9af6('0x4c'),'attributes':['id','name','color'],'through':_0x2b7279[_0x9af6('0x27')][_0x9af6('0x38')]?{'attributes':[],'where':{'TagId':_0x2b7279[_0x9af6('0x27')][_0x9af6('0x38')]||undefined}}:{},'required':_0x2b7279['query'][_0x9af6('0x38')]?!![]:![]}];}return db[_0x9af6('0x41')]['findAll'](_0xc58e87);})[_0x9af6('0x1f')](function(_0x28277e){_0x3627b0[_0x9af6('0x4d')]=_0x28277e;return _0x3627b0;})['then'](respondWithFilteredResult(_0x323199,_0xc58e87))[_0x9af6('0x4e')](handleError(_0x323199,null));};exports[_0x9af6('0x4f')]=function(_0x17d86e,_0x3f7c1a){var _0x1cb7dd={'raw':![],'where':{'id':_0x17d86e[_0x9af6('0x50')]['id']}},_0x2e40fa={};_0x2e40fa[_0x9af6('0x25')]=_[_0x9af6('0x26')](db[_0x9af6('0x41')]['rawAttributes']);_0x2e40fa['query']=_['keys'](_0x17d86e[_0x9af6('0x27')]);_0x2e40fa[_0x9af6('0x2a')]=_[_0x9af6('0x2b')](_0x2e40fa['model'],_0x2e40fa[_0x9af6('0x27')]);_0x1cb7dd[_0x9af6('0x2c')]=_[_0x9af6('0x2b')](_0x2e40fa['model'],qs['fields'](_0x17d86e['query'][_0x9af6('0x2d')]));_0x1cb7dd['attributes']=_0x1cb7dd[_0x9af6('0x2c')]['length']?_0x1cb7dd[_0x9af6('0x2c')]:_0x2e40fa['model'];if(_0x17d86e['query'][_0x9af6('0x51')]){_0x1cb7dd['include']=[{'all':!![]}];}_0x1cb7dd=_['merge']({},_0x1cb7dd,_0x17d86e[_0x9af6('0x52')]);return db[_0x9af6('0x41')][_0x9af6('0x53')](_0x1cb7dd)[_0x9af6('0x1f')](handleEntityNotFound(_0x3f7c1a,null))['then'](respondWithResult(_0x3f7c1a,null))['catch'](handleError(_0x3f7c1a,null));};exports['create']=function(_0x28fee2,_0x15f3a8){return db['MailInteraction']['create'](_0x28fee2[_0x9af6('0x54')],{})[_0x9af6('0x1f')](respondWithResult(_0x15f3a8,0xc9))[_0x9af6('0x4e')](handleError(_0x15f3a8,null));};exports[_0x9af6('0x1e')]=function(_0x37573c,_0x21177f){if(_0x37573c['body']['id']){delete _0x37573c[_0x9af6('0x54')]['id'];}return db[_0x9af6('0x41')][_0x9af6('0x53')]({'where':{'id':_0x37573c[_0x9af6('0x50')]['id']}})[_0x9af6('0x1f')](handleEntityNotFound(_0x21177f,null))[_0x9af6('0x1f')](saveUpdates(_0x37573c[_0x9af6('0x54')],null))[_0x9af6('0x1f')](respondWithResult(_0x21177f,null))[_0x9af6('0x4e')](handleError(_0x21177f,null));};exports[_0x9af6('0x20')]=function(_0x28f0eb,_0x5f1eb4){return db['MailInteraction'][_0x9af6('0x53')]({'where':{'id':_0x28f0eb['params']['id']}})[_0x9af6('0x1f')](handleEntityNotFound(_0x5f1eb4,null))[_0x9af6('0x1f')](removeEntity(_0x5f1eb4,null))[_0x9af6('0x4e')](handleError(_0x5f1eb4,null));};exports[_0x9af6('0x55')]=function(_0x5e3674,_0x2835f4){return db['MailInteraction'][_0x9af6('0x55')]()[_0x9af6('0x1f')](respondWithResult(_0x2835f4,null))[_0x9af6('0x4e')](handleError(_0x2835f4,null));};exports['addMessage']=function(_0x39047a,_0x7ce320,_0x36c414){return db[_0x9af6('0x3c')][_0x9af6('0x53')]({'where':{'id':_0x39047a['params']['id']}})['then'](handleEntityNotFound(_0x7ce320,null))[_0x9af6('0x1f')](function(_0x4fcb13){if(_0x4fcb13){return _0x4fcb13[_0x9af6('0x56')](_0x39047a[_0x9af6('0x54')][_0x9af6('0x57')],_[_0x9af6('0x58')](_0x39047a['body'],[_0x9af6('0x57'),'id'])||{});}})['then'](respondWithResult(_0x7ce320,null))[_0x9af6('0x4e')](handleError(_0x7ce320,null));};exports['getMessages']=function(_0x3c929c,_0x5d4f2b,_0x250c7c){var _0xc89019={'raw':![],'where':{}};var _0x53af57={};var _0x9d558b={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x3c929c[_0x9af6('0x50')]['id']}})[_0x9af6('0x1f')](handleEntityNotFound(_0x5d4f2b,null))[_0x9af6('0x1f')](function(_0x4defb5){if(_0x4defb5){_0x53af57['model']=_[_0x9af6('0x26')](db[_0x9af6('0x3c')]['rawAttributes']);_0x53af57[_0x9af6('0x27')]=_[_0x9af6('0x26')](_0x3c929c[_0x9af6('0x27')]);_0x53af57['filters']=_[_0x9af6('0x2b')](_0x53af57['model'],_0x53af57[_0x9af6('0x27')]);_0xc89019[_0x9af6('0x2c')]=_[_0x9af6('0x2b')](_0x53af57[_0x9af6('0x25')],qs[_0x9af6('0x2d')](_0x3c929c[_0x9af6('0x27')][_0x9af6('0x2d')]));_0xc89019['attributes']=_0xc89019[_0x9af6('0x2c')][_0x9af6('0x2e')]?_0xc89019['attributes']:_0x53af57[_0x9af6('0x25')];if(!_0x3c929c[_0x9af6('0x27')][_0x9af6('0x2f')](_0x9af6('0x30'))){_0xc89019[_0x9af6('0x18')]=qs['limit'](_0x3c929c['query']['limit']);_0xc89019[_0x9af6('0x17')]=qs[_0x9af6('0x17')](_0x3c929c[_0x9af6('0x27')]['offset']);}_0xc89019[_0x9af6('0x59')]=qs['sort'](_0x3c929c[_0x9af6('0x27')]['sort']);_0xc89019[_0x9af6('0x32')]=qs[_0x9af6('0x2a')](_['pick'](_0x3c929c['query'],_0x53af57[_0x9af6('0x2a')]));_0xc89019['where']['MailInteractionId']=_0x4defb5['id'];if(_0x3c929c[_0x9af6('0x27')][_0x9af6('0x5a')]){_0xc89019[_0x9af6('0x32')]=_[_0x9af6('0x36')](_0xc89019[_0x9af6('0x32')],{'$or':_[_0x9af6('0x5b')](_0xc89019[_0x9af6('0x2c')],function(_0x12104b){var _0x1147e1={};_0x1147e1[_0x12104b]={'$like':'%'+_0x3c929c[_0x9af6('0x27')][_0x9af6('0x5a')]+'%'};return _0x1147e1;})});}if(_0x3c929c[_0x9af6('0x27')][_0x9af6('0x5c')]){var _0x119e10=_0x3c929c[_0x9af6('0x27')][_0x9af6('0x5c')][_0x9af6('0x5d')](',');var _0x4796ce={};_0x4796ce[_0x119e10[0x0]]={'$gte':moment(_0x119e10[0x1])[_0x9af6('0x5e')](_0x9af6('0x5f'))};_0xc89019[_0x9af6('0x32')]=_[_0x9af6('0x36')](_0xc89019[_0x9af6('0x32')],_0x4796ce);}_0xc89019=_[_0x9af6('0x36')]({},_0xc89019,_0x3c929c[_0x9af6('0x52')]);return db[_0x9af6('0x3c')]['count']({'where':_0xc89019[_0x9af6('0x32')]})[_0x9af6('0x1f')](function(_0xbe0505){_0x9d558b[_0x9af6('0x16')]=_0xbe0505;if(_0x3c929c['query'][_0x9af6('0x51')]){_0xc89019[_0x9af6('0x37')]=[{'all':!![]}];}return db['MailMessage'][_0x9af6('0x60')](_0xc89019);})[_0x9af6('0x1f')](function(_0x53e2d1){_0x9d558b[_0x9af6('0x4d')]=_0x53e2d1;return _0x9d558b;});}})['then'](respondWithFilteredResult(_0x5d4f2b,_0xc89019))[_0x9af6('0x4e')](handleError(_0x5d4f2b,null));};exports[_0x9af6('0x61')]=function(_0x266bee,_0x13244e,_0x134cbd){return db[_0x9af6('0x41')][_0x9af6('0x53')]({'where':{'id':_0x266bee['params']['id']}})[_0x9af6('0x1f')](handleEntityNotFound(_0x13244e,null))['then'](function(_0x5b5965){if(_0x5b5965){return _0x5b5965[_0x9af6('0x62')](_0x266bee[_0x9af6('0x54')][_0x9af6('0x57')],_[_0x9af6('0x58')](_0x266bee[_0x9af6('0x54')],[_0x9af6('0x57'),'id'])||{})[_0x9af6('0x63')](function(){return db['Tag']['findAll']({'attributes':['id',_0x9af6('0x23'),_0x9af6('0x4b')],'where':{'id':_0x266bee[_0x9af6('0x54')][_0x9af6('0x57')]}});})[_0x9af6('0x1f')](function(_0x13d25d){socket[_0x9af6('0x64')](_0x9af6('0x65'),{'id':Number(_0x266bee['params']['id']),'tags':_0x13d25d||[]});return{'id':Number(_0x266bee[_0x9af6('0x50')]['id']),'tags':_0x13d25d||[]};});}})[_0x9af6('0x1f')](respondWithResult(_0x13244e,null))[_0x9af6('0x4e')](handleError(_0x13244e,null));};exports[_0x9af6('0x66')]=function(_0x40b040,_0xee0f3a,_0xac3e96){var _0x1c559d;return db[_0x9af6('0x41')][_0x9af6('0x53')]({'where':{'id':_0x40b040[_0x9af6('0x50')]['id']}})['then'](handleEntityNotFound(_0xee0f3a,null))['then'](function(_0x3b1927){if(_0x3b1927){return _0x3b1927[_0x9af6('0x66')](_0x40b040[_0x9af6('0x27')][_0x9af6('0x57')]);}})['then'](respondWithStatusCode(_0xee0f3a,null))[_0x9af6('0x4e')](handleError(_0xee0f3a,null));}; \ No newline at end of file +var _0x1359=['findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','addMessage','omit','ids','getMessages','findOne','nolimit','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','emit','mailInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','send','index','MailInteraction','model','keys','dateStart','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','dateEnd','day','add','merge','filter','where','map','options','include','tag','Tag','Tags','distinct','push','MailMessage','Messages','createdAt','User','Users','name','fullname','Contact','Owner','internal','MailAccount','key','email','read'];(function(_0xfff7a4,_0xbfbb5e){var _0x52843e=function(_0xe41bfd){while(--_0xe41bfd){_0xfff7a4['push'](_0xfff7a4['shift']());}};_0x52843e(++_0xbfbb5e);}(_0x1359,0x81));var _0x9135=function(_0x2dd195,_0x4c1c1b){_0x2dd195=_0x2dd195-0x0;var _0x3358c8=_0x1359[_0x2dd195];return _0x3358c8;};'use strict';var jsonpatch=require(_0x9135('0x0'));var rp=require(_0x9135('0x1'));var moment=require(_0x9135('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9135('0x3'));var sox=require(_0x9135('0x4'));var csv=require('to-csv');var ejs=require(_0x9135('0x5'));var fs=require('fs');var _=require(_0x9135('0x6'));var squel=require(_0x9135('0x7'));var crypto=require(_0x9135('0x8'));var jsforce=require(_0x9135('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x9135('0xa'));var querystring=require(_0x9135('0xb'));var Papa=require(_0x9135('0xc'));var qs=require(_0x9135('0xd'));var logger=require(_0x9135('0xe'))('api');var utils=require('../../config/utils');var config=require(_0x9135('0xf'));var db=require(_0x9135('0x10'))['db'];var socket=require(_0x9135('0x11'))({'host':_0x9135('0x12'),'port':0x18eb});require(_0x9135('0x13'))[_0x9135('0x14')](socket);function respondWithStatusCode(_0x143148,_0x7b5bc8){_0x7b5bc8=_0x7b5bc8||0xcc;return function(_0x2a5678){if(_0x2a5678){return _0x143148['sendStatus'](_0x7b5bc8);}return _0x143148[_0x9135('0x15')](_0x7b5bc8)[_0x9135('0x16')]();};}function respondWithResult(_0x529839,_0xfa396a){_0xfa396a=_0xfa396a||0xc8;return function(_0x10fd68){if(_0x10fd68){return _0x529839[_0x9135('0x15')](_0xfa396a)[_0x9135('0x17')](_0x10fd68);}};}function respondWithFilteredResult(_0x3ab265,_0x13eb25){return function(_0x376ec9){if(_0x376ec9){var _0x52b0ab=_0x376ec9[_0x9135('0x18')],_0x4de298=_0x13eb25[_0x9135('0x19')],_0x46f29d=_0x13eb25[_0x9135('0x19')]+_0x13eb25[_0x9135('0x1a')],_0x2a1e3b;if(_0x46f29d>=_0x52b0ab){_0x46f29d=_0x52b0ab;_0x2a1e3b=0xc8;}else{_0x2a1e3b=0xce;}_0x3ab265[_0x9135('0x15')](_0x2a1e3b);return _0x3ab265[_0x9135('0x1b')](_0x9135('0x1c'),_0x4de298+'-'+_0x46f29d+'/'+_0x52b0ab)[_0x9135('0x17')](_0x376ec9);}return null;};}function patchUpdates(_0xb6ed24){return function(_0x1b3270){try{jsonpatch[_0x9135('0x1d')](_0x1b3270,_0xb6ed24,!![]);}catch(_0x28d7c){return BPromise['reject'](_0x28d7c);}return _0x1b3270[_0x9135('0x1e')]();};}function saveUpdates(_0x2f6a00,_0x41614c){return function(_0x79b91b){if(_0x79b91b){return _0x79b91b[_0x9135('0x1f')](_0x2f6a00)[_0x9135('0x20')](function(_0x323548){return _0x323548;});}return null;};}function removeEntity(_0x30a330,_0xaa7df8){return function(_0x5c5dd6){if(_0x5c5dd6){return _0x5c5dd6[_0x9135('0x21')]()[_0x9135('0x20')](function(){_0x30a330[_0x9135('0x15')](0xcc)[_0x9135('0x16')]();});}};}function handleEntityNotFound(_0xf6dae6,_0x3e260d){return function(_0x285fbc){if(!_0x285fbc){_0xf6dae6['sendStatus'](0x194);}return _0x285fbc;};}function handleError(_0x464eac,_0x22e0b6){_0x22e0b6=_0x22e0b6||0x1f4;return function(_0x46c47c){logger[_0x9135('0x22')](_0x46c47c['stack']);if(_0x46c47c['name']){delete _0x46c47c['name'];}_0x464eac[_0x9135('0x15')](_0x22e0b6)[_0x9135('0x23')](_0x46c47c);};}exports[_0x9135('0x24')]=function(_0x551b93,_0x4e9125){var _0x429db1={},_0xdd22a={},_0x4cff06={'count':0x0,'rows':[]};var _0x4de851=db[_0x9135('0x25')]['rawAttributes'];_0xdd22a[_0x9135('0x26')]=_[_0x9135('0x27')](_0x4de851);var _0x333e93={'dateStart':_0x551b93['query']['dateStart'],'dateEnd':_0x551b93['query']['dateEnd']};delete _0x551b93['query'][_0x9135('0x28')];delete _0x551b93['query']['dateEnd'];_0xdd22a[_0x9135('0x29')]=_[_0x9135('0x27')](_0x551b93[_0x9135('0x29')]);_0xdd22a[_0x9135('0x2a')]=_[_0x9135('0x2b')](_0xdd22a['model'],_0xdd22a[_0x9135('0x29')]);_0x429db1['attributes']=_[_0x9135('0x2b')](_0xdd22a[_0x9135('0x26')],qs[_0x9135('0x2c')](_0x551b93[_0x9135('0x29')][_0x9135('0x2c')]));_0x429db1[_0x9135('0x2d')]=_0x429db1['attributes'][_0x9135('0x2e')]?_0x429db1[_0x9135('0x2d')]:_0xdd22a[_0x9135('0x26')];if(!_0x551b93['query'][_0x9135('0x2f')]('nolimit')){_0x429db1[_0x9135('0x1a')]=qs[_0x9135('0x1a')](_0x551b93[_0x9135('0x29')][_0x9135('0x1a')]);_0x429db1[_0x9135('0x19')]=qs[_0x9135('0x19')](_0x551b93[_0x9135('0x29')][_0x9135('0x19')]);}_0x429db1[_0x9135('0x30')]=qs[_0x9135('0x31')](_0x551b93[_0x9135('0x29')]['sort']);_0x429db1['where']=qs[_0x9135('0x2a')](_[_0x9135('0x32')](_0x551b93[_0x9135('0x29')],_0xdd22a['filters']));if(_0x333e93['dateStart']){if(_0x333e93[_0x9135('0x33')]){_0x333e93[_0x9135('0x33')]=moment(_0x333e93[_0x9135('0x33')])['add'](0x1,_0x9135('0x34'));}else{_0x333e93[_0x9135('0x33')]=moment(_0x333e93[_0x9135('0x28')])[_0x9135('0x35')](0x1,_0x9135('0x34'));}_[_0x9135('0x36')](_0x429db1['where'],{'createdAt':{'$gte':_0x333e93[_0x9135('0x28')],'$lte':_0x333e93[_0x9135('0x33')]}});}if(_0x551b93[_0x9135('0x29')][_0x9135('0x37')]){_0x429db1['where']=_[_0x9135('0x36')](_0x429db1[_0x9135('0x38')],{'$or':_[_0x9135('0x39')](_0x429db1[_0x9135('0x2d')],function(_0x40194d){var _0x563e3b={};_0x563e3b[_0x40194d]={'$like':'%'+_0x551b93[_0x9135('0x29')][_0x9135('0x37')]+'%'};return _0x563e3b;})});}_0x429db1=_[_0x9135('0x36')]({},_0x429db1,_0x551b93[_0x9135('0x3a')]);var _0x488417={'where':_0x429db1[_0x9135('0x38')]};_0x488417[_0x9135('0x3b')]=[];if(_0x551b93[_0x9135('0x29')][_0x9135('0x3c')]){_0x488417['include']['push']({'model':db[_0x9135('0x3d')],'as':_0x9135('0x3e'),'attributes':['id'],'where':{'id':_0x551b93['query'][_0x9135('0x3c')]},'required':!![]});_0x488417[_0x9135('0x3f')]=!![];}if(_0x551b93['query']['read']){_0x488417[_0x9135('0x3b')][_0x9135('0x40')]({'model':db[_0x9135('0x41')],'as':_0x9135('0x42'),'attributes':['id','direction',_0x9135('0x43'),'read'],'where':{'direction':'in','read':_0x551b93[_0x9135('0x29')]['read']||![]},'required':!![]});_0x488417[_0x9135('0x3f')]=!![];}return db[_0x9135('0x25')][_0x9135('0x18')](_0x488417)[_0x9135('0x20')](function(_0x44bc50){_0x4cff06[_0x9135('0x18')]=_0x44bc50;if(_0x551b93[_0x9135('0x29')]['includeAll']){_0x429db1[_0x9135('0x3b')]=[{'model':db[_0x9135('0x44')],'as':_0x9135('0x45'),'required':![],'attributes':['id',_0x9135('0x46'),_0x9135('0x47')]},{'model':db['CmContact'],'as':_0x9135('0x48'),'required':![]},{'model':db['User'],'as':_0x9135('0x49'),'attributes':[_0x9135('0x46'),'fullname',_0x9135('0x4a')],'required':![]},{'model':db[_0x9135('0x4b')],'as':'Account','attributes':[_0x9135('0x46'),_0x9135('0x4c'),_0x9135('0x4d')],'required':![]},{'model':db[_0x9135('0x41')],'as':'Messages','attributes':['id','direction','createdAt',_0x9135('0x4e')],'where':{'direction':'in','read':_0x551b93['query']['read']||![]},'required':_0x551b93['query']['read']||![]},{'model':db[_0x9135('0x3d')],'as':_0x9135('0x3e'),'attributes':['id',_0x9135('0x46'),'color'],'required':_0x551b93[_0x9135('0x29')][_0x9135('0x3c')]?!![]:![]},{'model':db[_0x9135('0x3d')],'as':'ThroughTags','attributes':['id','name','color'],'through':_0x551b93[_0x9135('0x29')][_0x9135('0x3c')]?{'attributes':[],'where':{'TagId':_0x551b93[_0x9135('0x29')]['tag']||undefined}}:{},'required':_0x551b93['query'][_0x9135('0x3c')]?!![]:![]}];}return db[_0x9135('0x25')][_0x9135('0x4f')](_0x429db1);})[_0x9135('0x20')](function(_0x1aeebf){_0x4cff06[_0x9135('0x50')]=_0x1aeebf;return _0x4cff06;})[_0x9135('0x20')](respondWithFilteredResult(_0x4e9125,_0x429db1))[_0x9135('0x51')](handleError(_0x4e9125,null));};exports[_0x9135('0x52')]=function(_0x22473d,_0x55fdf2){var _0x45b5a4={'raw':![],'where':{'id':_0x22473d[_0x9135('0x53')]['id']}},_0x2d9286={};_0x2d9286[_0x9135('0x26')]=_[_0x9135('0x27')](db['MailInteraction'][_0x9135('0x54')]);_0x2d9286[_0x9135('0x29')]=_[_0x9135('0x27')](_0x22473d['query']);_0x2d9286['filters']=_[_0x9135('0x2b')](_0x2d9286[_0x9135('0x26')],_0x2d9286[_0x9135('0x29')]);_0x45b5a4['attributes']=_[_0x9135('0x2b')](_0x2d9286[_0x9135('0x26')],qs[_0x9135('0x2c')](_0x22473d[_0x9135('0x29')][_0x9135('0x2c')]));_0x45b5a4['attributes']=_0x45b5a4[_0x9135('0x2d')][_0x9135('0x2e')]?_0x45b5a4[_0x9135('0x2d')]:_0x2d9286[_0x9135('0x26')];if(_0x22473d[_0x9135('0x29')][_0x9135('0x55')]){_0x45b5a4[_0x9135('0x3b')]=[{'all':!![]}];}_0x45b5a4=_[_0x9135('0x36')]({},_0x45b5a4,_0x22473d['options']);return db[_0x9135('0x25')][_0x9135('0x56')](_0x45b5a4)[_0x9135('0x20')](handleEntityNotFound(_0x55fdf2,null))[_0x9135('0x20')](respondWithResult(_0x55fdf2,null))[_0x9135('0x51')](handleError(_0x55fdf2,null));};exports['create']=function(_0xc763df,_0x23db53){return db[_0x9135('0x25')][_0x9135('0x57')](_0xc763df[_0x9135('0x58')],{})[_0x9135('0x20')](respondWithResult(_0x23db53,0xc9))[_0x9135('0x51')](handleError(_0x23db53,null));};exports['update']=function(_0x51a28d,_0x4512ce){if(_0x51a28d[_0x9135('0x58')]['id']){delete _0x51a28d['body']['id'];}return db[_0x9135('0x25')]['find']({'where':{'id':_0x51a28d['params']['id']}})[_0x9135('0x20')](handleEntityNotFound(_0x4512ce,null))[_0x9135('0x20')](saveUpdates(_0x51a28d[_0x9135('0x58')],null))[_0x9135('0x20')](respondWithResult(_0x4512ce,null))[_0x9135('0x51')](handleError(_0x4512ce,null));};exports['destroy']=function(_0x3dec6f,_0x40dce0){return db[_0x9135('0x25')][_0x9135('0x56')]({'where':{'id':_0x3dec6f[_0x9135('0x53')]['id']}})[_0x9135('0x20')](handleEntityNotFound(_0x40dce0,null))[_0x9135('0x20')](removeEntity(_0x40dce0,null))['catch'](handleError(_0x40dce0,null));};exports[_0x9135('0x59')]=function(_0x27ff97,_0x4e0a06){return db[_0x9135('0x25')][_0x9135('0x59')]()[_0x9135('0x20')](respondWithResult(_0x4e0a06,null))['catch'](handleError(_0x4e0a06,null));};exports[_0x9135('0x5a')]=function(_0x446ccd,_0x31997c,_0x4f8252){return db[_0x9135('0x41')][_0x9135('0x56')]({'where':{'id':_0x446ccd[_0x9135('0x53')]['id']}})[_0x9135('0x20')](handleEntityNotFound(_0x31997c,null))[_0x9135('0x20')](function(_0x158b86){if(_0x158b86){return _0x158b86['addMessage'](_0x446ccd['body']['ids'],_[_0x9135('0x5b')](_0x446ccd['body'],[_0x9135('0x5c'),'id'])||{});}})[_0x9135('0x20')](respondWithResult(_0x31997c,null))[_0x9135('0x51')](handleError(_0x31997c,null));};exports[_0x9135('0x5d')]=function(_0x2cb6b2,_0x5e5a59,_0xd38a95){var _0x3465b6={'raw':![],'where':{}};var _0x183535={};var _0xd017e2={'count':0x0,'rows':[]};return db[_0x9135('0x25')][_0x9135('0x5e')]({'where':{'id':_0x2cb6b2['params']['id']}})[_0x9135('0x20')](handleEntityNotFound(_0x5e5a59,null))[_0x9135('0x20')](function(_0x12d672){if(_0x12d672){_0x183535[_0x9135('0x26')]=_[_0x9135('0x27')](db[_0x9135('0x41')]['rawAttributes']);_0x183535[_0x9135('0x29')]=_[_0x9135('0x27')](_0x2cb6b2[_0x9135('0x29')]);_0x183535[_0x9135('0x2a')]=_[_0x9135('0x2b')](_0x183535[_0x9135('0x26')],_0x183535[_0x9135('0x29')]);_0x3465b6['attributes']=_['intersection'](_0x183535[_0x9135('0x26')],qs[_0x9135('0x2c')](_0x2cb6b2['query'][_0x9135('0x2c')]));_0x3465b6[_0x9135('0x2d')]=_0x3465b6[_0x9135('0x2d')][_0x9135('0x2e')]?_0x3465b6[_0x9135('0x2d')]:_0x183535[_0x9135('0x26')];if(!_0x2cb6b2[_0x9135('0x29')][_0x9135('0x2f')](_0x9135('0x5f'))){_0x3465b6[_0x9135('0x1a')]=qs['limit'](_0x2cb6b2[_0x9135('0x29')][_0x9135('0x1a')]);_0x3465b6[_0x9135('0x19')]=qs[_0x9135('0x19')](_0x2cb6b2[_0x9135('0x29')][_0x9135('0x19')]);}_0x3465b6[_0x9135('0x30')]=qs[_0x9135('0x31')](_0x2cb6b2[_0x9135('0x29')]['sort']);_0x3465b6[_0x9135('0x38')]=qs[_0x9135('0x2a')](_[_0x9135('0x32')](_0x2cb6b2[_0x9135('0x29')],_0x183535[_0x9135('0x2a')]));_0x3465b6[_0x9135('0x38')][_0x9135('0x60')]=_0x12d672['id'];if(_0x2cb6b2['query'][_0x9135('0x37')]){_0x3465b6[_0x9135('0x38')]=_[_0x9135('0x36')](_0x3465b6['where'],{'$or':_['map'](_0x3465b6[_0x9135('0x2d')],function(_0x4f6ad8){var _0x2cd2e0={};_0x2cd2e0[_0x4f6ad8]={'$like':'%'+_0x2cb6b2['query'][_0x9135('0x37')]+'%'};return _0x2cd2e0;})});}if(_0x2cb6b2[_0x9135('0x29')][_0x9135('0x61')]){var _0x24afbf=_0x2cb6b2[_0x9135('0x29')]['$gte']['split'](',');var _0x5eec1a={};_0x5eec1a[_0x24afbf[0x0]]={'$gte':moment(_0x24afbf[0x1])[_0x9135('0x62')](_0x9135('0x63'))};_0x3465b6[_0x9135('0x38')]=_[_0x9135('0x36')](_0x3465b6[_0x9135('0x38')],_0x5eec1a);}_0x3465b6=_[_0x9135('0x36')]({},_0x3465b6,_0x2cb6b2[_0x9135('0x3a')]);return db[_0x9135('0x41')][_0x9135('0x18')]({'where':_0x3465b6['where']})['then'](function(_0x388ce6){_0xd017e2[_0x9135('0x18')]=_0x388ce6;if(_0x2cb6b2[_0x9135('0x29')][_0x9135('0x55')]){_0x3465b6[_0x9135('0x3b')]=[{'all':!![]}];}return db[_0x9135('0x41')][_0x9135('0x4f')](_0x3465b6);})[_0x9135('0x20')](function(_0x3aa82c){_0xd017e2['rows']=_0x3aa82c;return _0xd017e2;});}})[_0x9135('0x20')](respondWithFilteredResult(_0x5e5a59,_0x3465b6))[_0x9135('0x51')](handleError(_0x5e5a59,null));};exports['addTags']=function(_0x4682fa,_0x4ff35d,_0x52fd4e){return db[_0x9135('0x25')][_0x9135('0x56')]({'where':{'id':_0x4682fa[_0x9135('0x53')]['id']}})['then'](handleEntityNotFound(_0x4ff35d,null))[_0x9135('0x20')](function(_0x1cbe52){if(_0x1cbe52){return _0x1cbe52[_0x9135('0x64')](_0x4682fa['body'][_0x9135('0x5c')],_[_0x9135('0x5b')](_0x4682fa[_0x9135('0x58')],[_0x9135('0x5c'),'id'])||{})['spread'](function(){return db[_0x9135('0x3d')]['findAll']({'attributes':['id',_0x9135('0x46'),'color'],'where':{'id':_0x4682fa['body']['ids']}});})[_0x9135('0x20')](function(_0x2895b3){socket[_0x9135('0x65')](_0x9135('0x66'),{'id':Number(_0x4682fa[_0x9135('0x53')]['id']),'tags':_0x2895b3||[]});return{'id':Number(_0x4682fa[_0x9135('0x53')]['id']),'tags':_0x2895b3||[]};});}})['then'](respondWithResult(_0x4ff35d,null))[_0x9135('0x51')](handleError(_0x4ff35d,null));};exports[_0x9135('0x67')]=function(_0x5a1d34,_0x5480d0,_0x43ec72){var _0x250c5e;return db[_0x9135('0x25')]['find']({'where':{'id':_0x5a1d34[_0x9135('0x53')]['id']}})[_0x9135('0x20')](handleEntityNotFound(_0x5480d0,null))[_0x9135('0x20')](function(_0x2025af){if(_0x2025af){return _0x2025af['removeTags'](_0x5a1d34['query']['ids']);}})[_0x9135('0x20')](respondWithStatusCode(_0x5480d0,null))[_0x9135('0x51')](handleError(_0x5480d0,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e53853c..5abf160 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 _0x7889=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','MailInteraction'];(function(_0x7f4544,_0x12730f){var _0x181378=function(_0x51c9cd){while(--_0x51c9cd){_0x7f4544['push'](_0x7f4544['shift']());}};_0x181378(++_0x12730f);}(_0x7889,0xb1));var _0x9788=function(_0x211211,_0x2f1806){_0x211211=_0x211211-0x0;var _0x4f57a9=_0x7889[_0x211211];return _0x4f57a9;};'use strict';var EventEmitter=require(_0x9788('0x0'));var MailInteraction=require(_0x9788('0x1'))['db'][_0x9788('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9788('0x3')](0x0);var events={'afterCreate':_0x9788('0x4'),'afterUpdate':_0x9788('0x5'),'afterDestroy':_0x9788('0x6')};function emitEvent(_0x1f171b){return function(_0x49fcaf,_0x46c795,_0x49e1f4){MailInteractionEvents[_0x9788('0x7')](_0x1f171b+':'+_0x49fcaf['id'],_0x49fcaf);MailInteractionEvents['emit'](_0x1f171b,_0x49fcaf);_0x49e1f4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x9788('0x8')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x0258=['emit','hasOwnProperty','hook','exports','events','MailInteraction','setMaxListeners','save','remove'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x0258,0x1f3));var _0x8025=function(_0x2f4ee4,_0x3fd9a2){_0x2f4ee4=_0x2f4ee4-0x0;var _0x3f44d9=_0x0258[_0x2f4ee4];return _0x3f44d9;};'use strict';var EventEmitter=require(_0x8025('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x8025('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8025('0x2')](0x0);var events={'afterCreate':_0x8025('0x3'),'afterUpdate':'update','afterDestroy':_0x8025('0x4')};function emitEvent(_0x59ca10){return function(_0x313ec7,_0x415025,_0x33346c){MailInteractionEvents[_0x8025('0x5')](_0x59ca10+':'+_0x313ec7['id'],_0x313ec7);MailInteractionEvents['emit'](_0x59ca10,_0x313ec7);_0x33346c(null);};}for(var e in events){if(events[_0x8025('0x6')](e)){var event=events[e];MailInteraction[_0x8025('0x7')](e,emitEvent(event));}}module[_0x8025('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 87a8e45..f5de1ad 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 _0x6467=['MailInteraction','mail_interactions','lodash','util','../../config/logger','api','moment','./mailInteraction.attributes','exports','define'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x6467,0x110));var _0x7646=function(_0x36e094,_0x4bcbd9){_0x36e094=_0x36e094-0x0;var _0x457979=_0x6467[_0x36e094];return _0x457979;};'use strict';var _=require(_0x7646('0x0'));var util=require(_0x7646('0x1'));var logger=require(_0x7646('0x2'))(_0x7646('0x3'));var moment=require(_0x7646('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x7646('0x5'));module[_0x7646('0x6')]=function(_0x2c2328,_0x112e66){return _0x2c2328[_0x7646('0x7')](_0x7646('0x8'),attributes,{'tableName':_0x7646('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5395=['lodash','../../config/logger','bluebird','request-promise','./mailInteraction.attributes','define','MailInteraction','mail_interactions'];(function(_0x7cc351,_0x3e9d2f){var _0x1f35ce=function(_0x343e1c){while(--_0x343e1c){_0x7cc351['push'](_0x7cc351['shift']());}};_0x1f35ce(++_0x3e9d2f);}(_0x5395,0x150));var _0x5539=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5395[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x5539('0x0'));var util=require('util');var logger=require(_0x5539('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5539('0x2'));var rp=require(_0x5539('0x3'));var attributes=require(_0x5539('0x4'));module['exports']=function(_0x2b6f8b,_0x453ad5){return _0x2b6f8b[_0x5539('0x5')](_0x5539('0x6'),attributes,{'tableName':_0x5539('0x7'),'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 60b9059..eb6c45f 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 _0x2a1c=['AddTags','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body','options','where','limit','AddTagsToMailInteraction','find','addTags','ids'];(function(_0x479908,_0x5baec7){var _0x1e34af=function(_0x4fedba){while(--_0x4fedba){_0x479908['push'](_0x479908['shift']());}};_0x1e34af(++_0x5baec7);}(_0x2a1c,0x1b1));var _0xc2a1=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x2a1c[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xc2a1('0x0'));var util=require(_0xc2a1('0x1'));var moment=require('moment');var BPromise=require(_0xc2a1('0x2'));var rs=require(_0xc2a1('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc2a1('0x4'));var logger=require(_0xc2a1('0x5'))(_0xc2a1('0x6'));var config=require(_0xc2a1('0x7'));var jayson=require(_0xc2a1('0x8'));var client=jayson[_0xc2a1('0x9')][_0xc2a1('0xa')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xc2a1('0xb'),'port':0x18eb});require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x49d3ed,_0x40e7df,_0x36394d){return new BPromise(function(_0x19c6f1,_0x39da6d){return client[_0xc2a1('0xc')](_0x49d3ed,_0x36394d)[_0xc2a1('0xd')](function(_0x1f2d90){logger[_0xc2a1('0xe')](_0xc2a1('0xf'),_0x40e7df,_0xc2a1('0x10'));logger[_0xc2a1('0x11')](_0xc2a1('0x12'),_0x40e7df,_0xc2a1('0x10'),JSON[_0xc2a1('0x13')](_0x1f2d90));if(_0x1f2d90[_0xc2a1('0x14')]){if(_0x1f2d90['error'][_0xc2a1('0x15')]===0x1f4){logger[_0xc2a1('0x14')]('MailInteraction,\x20%s,\x20%s',_0x40e7df,_0x1f2d90[_0xc2a1('0x14')][_0xc2a1('0x16')]);return _0x39da6d(_0x1f2d90[_0xc2a1('0x14')][_0xc2a1('0x16')]);}logger[_0xc2a1('0x14')](_0xc2a1('0xf'),_0x40e7df,_0x1f2d90[_0xc2a1('0x14')]['message']);return _0x19c6f1(_0x1f2d90[_0xc2a1('0x14')][_0xc2a1('0x16')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x40e7df,_0xc2a1('0x10'));_0x19c6f1(_0x1f2d90[_0xc2a1('0x17')][_0xc2a1('0x16')]);}})[_0xc2a1('0x18')](function(_0x4fd59d){logger[_0xc2a1('0x14')](_0xc2a1('0xf'),_0x40e7df,_0x4fd59d);_0x39da6d(_0x4fd59d);});});}exports[_0xc2a1('0x19')]=function(_0x395750){var _0x2b1f1f=this;return new Promise(function(_0x25e67c,_0x4624bc){return db['MailInteraction'][_0xc2a1('0x1a')](_0x395750[_0xc2a1('0x1b')],{'raw':_0x395750[_0xc2a1('0x1c')]?_0x395750['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x395750['options']?_0x395750[_0xc2a1('0x1c')][_0xc2a1('0x1d')]||null:null,'attributes':_0x395750[_0xc2a1('0x1c')]?_0x395750[_0xc2a1('0x1c')]['attributes']||null:null,'limit':_0x395750[_0xc2a1('0x1c')]?_0x395750[_0xc2a1('0x1c')][_0xc2a1('0x1e')]||null:null})[_0xc2a1('0xd')](function(_0x1649cc){logger[_0xc2a1('0xe')](_0xc2a1('0x19'),_0x395750);logger[_0xc2a1('0x11')]('UpdateMailInteraction',_0x395750,JSON[_0xc2a1('0x13')](_0x1649cc));_0x25e67c(_0x1649cc);})['catch'](function(_0xeea420){logger[_0xc2a1('0x14')](_0xc2a1('0x19'),_0xeea420[_0xc2a1('0x16')],_0x395750);_0x4624bc(_0x2b1f1f['error'](0x1f4,_0xeea420[_0xc2a1('0x16')]));});});};exports[_0xc2a1('0x1f')]=function(_0x45b3a1){return new Promise(function(_0x4cb164,_0x10d615){return db['MailInteraction'][_0xc2a1('0x20')]({'where':_0x45b3a1[_0xc2a1('0x1c')]?_0x45b3a1[_0xc2a1('0x1c')][_0xc2a1('0x1d')]||null:null})[_0xc2a1('0xd')](function(_0x2ffa3f){if(_0x2ffa3f){return _0x2ffa3f[_0xc2a1('0x21')](_0x45b3a1['body'][_0xc2a1('0x22')],_['omit'](_0x45b3a1['body'],[_0xc2a1('0x22'),'id'])||{});}})['spread'](function(_0x3dc033){logger['info'](_0xc2a1('0x23'),_0x45b3a1);logger[_0xc2a1('0x11')](_0xc2a1('0x23'),_0x45b3a1,JSON[_0xc2a1('0x13')](_0x3dc033));_0x4cb164(_0x3dc033);})['catch'](function(_0x140193){logger['error'](_0xc2a1('0x23'),_0x140193[_0xc2a1('0x16')],_0x45b3a1);_0x10d615(_this[_0xc2a1('0x14')](0x1f4,_0x140193[_0xc2a1('0x16')]));});});}; \ No newline at end of file +var _0xd9a4=['addTags','ids','omit','spread','AddTags','moment','randomstring','../../config/utils','../../config/logger','rpc','client','http','socket.io-emitter','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','find'];(function(_0x288a8b,_0x2a60f5){var _0x52564d=function(_0x2acc66){while(--_0x2acc66){_0x288a8b['push'](_0x288a8b['shift']());}};_0x52564d(++_0x2a60f5);}(_0xd9a4,0x13d));var _0x4d9a=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xd9a4[_0x24061a];return _0x82054e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d9a('0x0'));var BPromise=require('bluebird');var rs=require(_0x4d9a('0x1'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x4d9a('0x2'));var logger=require(_0x4d9a('0x3'))(_0x4d9a('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d9a('0x5')][_0x4d9a('0x6')]({'port':0x232a});var socket=require(_0x4d9a('0x7'))({'host':_0x4d9a('0x8'),'port':0x18eb});require(_0x4d9a('0x9'))[_0x4d9a('0xa')](socket);function respondWithRpcPromise(_0x4dc53b,_0xf6b0ef,_0x473a8b){return new BPromise(function(_0x1b3a5a,_0x10727a){return client[_0x4d9a('0xb')](_0x4dc53b,_0x473a8b)[_0x4d9a('0xc')](function(_0x15f90d){logger[_0x4d9a('0xd')](_0x4d9a('0xe'),_0xf6b0ef,'request\x20sent');logger[_0x4d9a('0xf')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0xf6b0ef,'request\x20sent',JSON[_0x4d9a('0x10')](_0x15f90d));if(_0x15f90d[_0x4d9a('0x11')]){if(_0x15f90d[_0x4d9a('0x11')][_0x4d9a('0x12')]===0x1f4){logger[_0x4d9a('0x11')](_0x4d9a('0xe'),_0xf6b0ef,_0x15f90d[_0x4d9a('0x11')][_0x4d9a('0x13')]);return _0x10727a(_0x15f90d[_0x4d9a('0x11')][_0x4d9a('0x13')]);}logger[_0x4d9a('0x11')](_0x4d9a('0xe'),_0xf6b0ef,_0x15f90d['error'][_0x4d9a('0x13')]);return _0x1b3a5a(_0x15f90d['error'][_0x4d9a('0x13')]);}else{logger[_0x4d9a('0xd')](_0x4d9a('0xe'),_0xf6b0ef,_0x4d9a('0x14'));_0x1b3a5a(_0x15f90d[_0x4d9a('0x15')][_0x4d9a('0x13')]);}})['catch'](function(_0x313acd){logger['error'](_0x4d9a('0xe'),_0xf6b0ef,_0x313acd);_0x10727a(_0x313acd);});});}exports[_0x4d9a('0x16')]=function(_0x29eccc){var _0x173c59=this;return new Promise(function(_0x1f0563,_0x1208f9){return db[_0x4d9a('0x17')][_0x4d9a('0x18')](_0x29eccc[_0x4d9a('0x19')],{'raw':_0x29eccc['options']?_0x29eccc[_0x4d9a('0x1a')][_0x4d9a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29eccc[_0x4d9a('0x1a')]?_0x29eccc['options'][_0x4d9a('0x1c')]||null:null,'attributes':_0x29eccc[_0x4d9a('0x1a')]?_0x29eccc[_0x4d9a('0x1a')][_0x4d9a('0x1d')]||null:null,'limit':_0x29eccc[_0x4d9a('0x1a')]?_0x29eccc[_0x4d9a('0x1a')][_0x4d9a('0x1e')]||null:null})[_0x4d9a('0xc')](function(_0x39710c){logger['info'](_0x4d9a('0x16'),_0x29eccc);logger[_0x4d9a('0xf')](_0x4d9a('0x16'),_0x29eccc,JSON['stringify'](_0x39710c));_0x1f0563(_0x39710c);})[_0x4d9a('0x1f')](function(_0x1d41b7){logger[_0x4d9a('0x11')]('UpdateMailInteraction',_0x1d41b7[_0x4d9a('0x13')],_0x29eccc);_0x1208f9(_0x173c59[_0x4d9a('0x11')](0x1f4,_0x1d41b7[_0x4d9a('0x13')]));});});};exports[_0x4d9a('0x20')]=function(_0x6fab5e){return new Promise(function(_0x35f8fe,_0x166765){return db['MailInteraction'][_0x4d9a('0x21')]({'where':_0x6fab5e[_0x4d9a('0x1a')]?_0x6fab5e[_0x4d9a('0x1a')][_0x4d9a('0x1c')]||null:null})[_0x4d9a('0xc')](function(_0x3161be){if(_0x3161be){return _0x3161be[_0x4d9a('0x22')](_0x6fab5e[_0x4d9a('0x19')][_0x4d9a('0x23')],_[_0x4d9a('0x24')](_0x6fab5e[_0x4d9a('0x19')],['ids','id'])||{});}})[_0x4d9a('0x25')](function(_0x4d93e4){logger[_0x4d9a('0xd')](_0x4d9a('0x26'),_0x6fab5e);logger[_0x4d9a('0xf')]('AddTags',_0x6fab5e,JSON[_0x4d9a('0x10')](_0x4d93e4));_0x35f8fe(_0x4d93e4);})[_0x4d9a('0x1f')](function(_0x4bc8ee){logger[_0x4d9a('0x11')](_0x4d9a('0x26'),_0x4bc8ee[_0x4d9a('0x13')],_0x6fab5e);_0x166765(_this[_0x4d9a('0x11')](0x1f4,_0x4bc8ee[_0x4d9a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 54870e1..667a3db 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 _0x533a=['./mailInteraction.events','remove','update','removeListener','register','length'];(function(_0x5cf4f2,_0x1bb4ed){var _0x53fc54=function(_0xf9b968){while(--_0xf9b968){_0x5cf4f2['push'](_0x5cf4f2['shift']());}};_0x53fc54(++_0x1bb4ed);}(_0x533a,0xf0));var _0xa533=function(_0x24717a,_0x26f6dc){_0x24717a=_0x24717a-0x0;var _0x32cf54=_0x533a[_0x24717a];return _0x32cf54;};'use strict';var MailInteractionEvents=require(_0xa533('0x0'));var events=['save',_0xa533('0x1'),_0xa533('0x2')];function createListener(_0x297d2e,_0x271e45){return function(_0x4cc264){_0x271e45['emit'](_0x297d2e,_0x4cc264);};}function removeListener(_0x569473,_0x1c973b){return function(){MailInteractionEvents[_0xa533('0x3')](_0x569473,_0x1c973b);};}exports[_0xa533('0x4')]=function(_0x1c550b){for(var _0x56607a=0x0,_0x15c843=events[_0xa533('0x5')];_0x56607a<_0x15c843;_0x56607a++){var _0x5eef27=events[_0x56607a];var _0x7620af=createListener('mailInteraction:'+_0x5eef27,_0x1c550b);MailInteractionEvents['on'](_0x5eef27,_0x7620af);}}; \ No newline at end of file +var _0x0d97=['./mailInteraction.events','save','remove','update','emit','register'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0x0d97,0x10e));var _0x70d9=function(_0x4a56c5,_0x5af82d){_0x4a56c5=_0x4a56c5-0x0;var _0x2d0bd6=_0x0d97[_0x4a56c5];return _0x2d0bd6;};'use strict';var MailInteractionEvents=require(_0x70d9('0x0'));var events=[_0x70d9('0x1'),_0x70d9('0x2'),_0x70d9('0x3')];function createListener(_0x4e692a,_0x2284a6){return function(_0xa33bd7){_0x2284a6[_0x70d9('0x4')](_0x4e692a,_0xa33bd7);};}function removeListener(_0x3d2b4f,_0x4727f1){return function(){MailInteractionEvents['removeListener'](_0x3d2b4f,_0x4727f1);};}exports[_0x70d9('0x5')]=function(_0x1e6aec){for(var _0x473801=0x0,_0x5808c4=events['length'];_0x473801<_0x5808c4;_0x473801++){var _0x37d501=events[_0x473801];var _0x226415=createListener('mailInteraction:'+_0x37d501,_0x1e6aec);MailInteractionEvents['on'](_0x37d501,_0x226415);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e6736bc..0e81487 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 _0xabb3=['get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','mail','put','/:id/accept','accept','/:id/reject','reject','exports','util','path','express','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xabb3,0x94));var _0x3abb=function(_0x1749d9,_0x56c5ff){_0x1749d9=_0x1749d9-0x0;var _0x32a366=_0xabb3[_0x1749d9];return _0x32a366;};'use strict';var multer=require('multer');var util=require(_0x3abb('0x0'));var path=require(_0x3abb('0x1'));var express=require(_0x3abb('0x2'));var router=express['Router']();var auth=require(_0x3abb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3abb('0x4'));var controller=require(_0x3abb('0x5'));router[_0x3abb('0x6')]('/',auth[_0x3abb('0x7')](),controller[_0x3abb('0x8')]);router[_0x3abb('0x6')](_0x3abb('0x9'),auth[_0x3abb('0x7')](),controller[_0x3abb('0xa')]);router['get'](_0x3abb('0xb'),auth[_0x3abb('0x7')](),controller[_0x3abb('0xc')]);router[_0x3abb('0xd')]('/',auth['isAuthenticated'](),interaction[_0x3abb('0xe')](_0x3abb('0xf'),'mailmessage:create'),controller['create']);router[_0x3abb('0x10')](_0x3abb('0xb'),auth[_0x3abb('0x7')](),controller['update']);router['put'](_0x3abb('0x11'),auth[_0x3abb('0x7')](),controller[_0x3abb('0x12')]);router[_0x3abb('0x10')](_0x3abb('0x13'),auth[_0x3abb('0x7')](),controller[_0x3abb('0x14')]);router['delete']('/:id',auth[_0x3abb('0x7')](),controller['destroy']);module[_0x3abb('0x15')]=router; \ No newline at end of file +var _0xdb6e=['reject','exports','multer','util','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x460c4d,_0x11343f){var _0x2e8fbf=function(_0x3c159d){while(--_0x3c159d){_0x460c4d['push'](_0x460c4d['shift']());}};_0x2e8fbf(++_0x11343f);}(_0xdb6e,0x152));var _0xedb6=function(_0x3a9e6d,_0x29a891){_0x3a9e6d=_0x3a9e6d-0x0;var _0x4478c0=_0xdb6e[_0x3a9e6d];return _0x4478c0;};'use strict';var multer=require(_0xedb6('0x0'));var util=require(_0xedb6('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xedb6('0x2'));var controller=require(_0xedb6('0x3'));router[_0xedb6('0x4')]('/',auth[_0xedb6('0x5')](),controller['index']);router[_0xedb6('0x4')](_0xedb6('0x6'),auth[_0xedb6('0x5')](),controller[_0xedb6('0x7')]);router[_0xedb6('0x4')](_0xedb6('0x8'),auth['isAuthenticated'](),controller[_0xedb6('0x9')]);router['post']('/',auth[_0xedb6('0x5')](),interaction[_0xedb6('0xa')](_0xedb6('0xb'),_0xedb6('0xc')),controller[_0xedb6('0xd')]);router[_0xedb6('0xe')]('/:id',auth[_0xedb6('0x5')](),controller[_0xedb6('0xf')]);router['put'](_0xedb6('0x10'),auth['isAuthenticated'](),controller[_0xedb6('0x11')]);router[_0xedb6('0xe')](_0xedb6('0x12'),auth['isAuthenticated'](),controller[_0xedb6('0x13')]);router['delete'](_0xedb6('0x8'),auth[_0xedb6('0x5')](),controller['destroy']);module[_0xedb6('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 5a7383a..cc4e513 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 _0xe2cd=['INTEGER','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4fde0b,_0x4b4289){var _0x3f3b38=function(_0x5e4d17){while(--_0x5e4d17){_0x4fde0b['push'](_0x4fde0b['shift']());}};_0x3f3b38(++_0x4b4289);}(_0xe2cd,0x64));var _0xde2c=function(_0x951840,_0x38d821){_0x951840=_0x951840-0x0;var _0x25a5b2=_0xe2cd[_0x951840];return _0x25a5b2;};'use strict';var Sequelize=require(_0xde2c('0x0'));var _=require(_0xde2c('0x1'));module[_0xde2c('0x2')]={'body':{'type':Sequelize[_0xde2c('0x3')](_0xde2c('0x4')),'allowNull':![]},'read':{'type':Sequelize[_0xde2c('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xde2c('0x6')]('in','out'),'defaultValue':_0xde2c('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xde2c('0x8')](0xbe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xde2c('0x3')](_0xde2c('0x4'))},'cc':{'type':Sequelize[_0xde2c('0x3')](_0xde2c('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0xde2c('0x4'))},'subject':{'type':Sequelize[_0xde2c('0x3')]},'sentAt':{'type':Sequelize[_0xde2c('0x9')]},'attach':{'type':Sequelize[_0xde2c('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xde2c('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xde2c('0x9')]},'originTo':{'type':Sequelize[_0xde2c('0x3')]('long')},'originCc':{'type':Sequelize[_0xde2c('0x3')](_0xde2c('0x4'))}}; \ No newline at end of file +var _0x2933=['ENUM','out','STRING','long','TEXT','DATE','sequelize','lodash','exports','BOOLEAN'];(function(_0x327c92,_0xd59a2a){var _0x42bd4c=function(_0x128cce){while(--_0x128cce){_0x327c92['push'](_0x327c92['shift']());}};_0x42bd4c(++_0xd59a2a);}(_0x2933,0x1b4));var _0x3293=function(_0x23ea24,_0x3ff2a1){_0x23ea24=_0x23ea24-0x0;var _0x5d83a8=_0x2933[_0x23ea24];return _0x5d83a8;};'use strict';var Sequelize=require(_0x3293('0x0'));var _=require(_0x3293('0x1'));module[_0x3293('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'read':{'type':Sequelize[_0x3293('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3293('0x4')]('in','out'),'defaultValue':_0x3293('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'from':{'type':Sequelize[_0x3293('0x6')]},'to':{'type':Sequelize['TEXT'](_0x3293('0x7'))},'cc':{'type':Sequelize[_0x3293('0x8')](_0x3293('0x7'))},'bcc':{'type':Sequelize[_0x3293('0x8')](_0x3293('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x3293('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3293('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x3293('0x8')](_0x3293('0x7'))},'originCc':{'type':Sequelize[_0x3293('0x8')](_0x3293('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index aa45036..37e4f4a 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 _0x3fc6=['status','end','json','offset','Content-Range','apply','reject','update','destroy','stack','name','send','MailMessage','model','query','dateEnd','filters','fields','attributes','length','nolimit','limit','order','sort','where','pick','dateStart','add','day','merge','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','intersection','options','find','body','params','create','direction','out','secret','Smtp','isNil','host','port','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','CmContact','Contact','MailInteraction','MailInteractionId','interaction','get','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','mail-interactions','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SIP/%s','rejectmessage','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result'];(function(_0x4dff40,_0x543fe0){var _0x2fd999=function(_0x3330fa){while(--_0x3330fa){_0x4dff40['push'](_0x4dff40['shift']());}};_0x2fd999(++_0x543fe0);}(_0x3fc6,0x159));var _0x63fc=function(_0x483cde,_0x5adcb4){_0x483cde=_0x483cde-0x0;var _0x577fa7=_0x3fc6[_0x483cde];return _0x577fa7;};'use strict';var jsonpatch=require(_0x63fc('0x0'));var rp=require(_0x63fc('0x1'));var moment=require(_0x63fc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x63fc('0x3'));var util=require(_0x63fc('0x4'));var path=require(_0x63fc('0x5'));var sox=require(_0x63fc('0x6'));var csv=require(_0x63fc('0x7'));var ejs=require(_0x63fc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x63fc('0x9'));var jsforce=require(_0x63fc('0xa'));var deskjs=require(_0x63fc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x63fc('0xc'));var Papa=require(_0x63fc('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x63fc('0xe'))(_0x63fc('0xf'));var utils=require(_0x63fc('0x10'));var config=require(_0x63fc('0x11'));var db=require(_0x63fc('0x12'))['db'];var socket=require(_0x63fc('0x13'))({'host':_0x63fc('0x14'),'port':0x18eb});require(_0x63fc('0x15'))[_0x63fc('0x16')](socket);var jayson=require(_0x63fc('0x17'));var client=jayson['client'][_0x63fc('0x18')]({'port':0x232c});var client9003=jayson[_0x63fc('0x19')][_0x63fc('0x18')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x293c4c,_0xc6f4ef,_0x13083e,_0x13c445){return new BPromise(function(_0xed9cc1,_0x1bcf57){var _0x4ebbbf=_0x13c445||client;return _0x4ebbbf[_0x63fc('0x1a')](_0x293c4c,_0x13083e)[_0x63fc('0x1b')](function(_0x46926d){logger[_0x63fc('0x1c')]('MailMessage,\x20%s,\x20%s',_0xc6f4ef,_0x63fc('0x1d'));logger['debug'](_0x63fc('0x1e'),_0xc6f4ef,_0x63fc('0x1d'),JSON[_0x63fc('0x1f')](_0x46926d));if(_0x46926d[_0x63fc('0x20')]){if(_0x46926d[_0x63fc('0x20')]['code']===0x1f4){logger[_0x63fc('0x20')](_0x63fc('0x21'),_0xc6f4ef,_0x46926d[_0x63fc('0x20')]['message']);return _0x1bcf57(_0x46926d['error'][_0x63fc('0x22')]);}logger[_0x63fc('0x20')]('MailMessage,\x20%s,\x20%s',_0xc6f4ef,_0x46926d[_0x63fc('0x20')]['message']);return _0xed9cc1(_0x46926d[_0x63fc('0x20')][_0x63fc('0x22')]);}else{logger[_0x63fc('0x1c')](_0x63fc('0x21'),_0xc6f4ef,_0x63fc('0x1d'));_0xed9cc1(_0x46926d[_0x63fc('0x23')][_0x63fc('0x22')]);}})['catch'](function(_0x2e991e){logger[_0x63fc('0x20')](_0x63fc('0x21'),_0xc6f4ef,_0x2e991e);_0x1bcf57(_0x2e991e);});});}function respondWithStatusCode(_0x1dcec0,_0x2dd713){_0x2dd713=_0x2dd713||0xcc;return function(_0x561c9b){if(_0x561c9b){return _0x1dcec0['sendStatus'](_0x2dd713);}return _0x1dcec0[_0x63fc('0x24')](_0x2dd713)[_0x63fc('0x25')]();};}function respondWithResult(_0x1fb3fc,_0x3b6ac1){_0x3b6ac1=_0x3b6ac1||0xc8;return function(_0x59b130){if(_0x59b130){return _0x1fb3fc[_0x63fc('0x24')](_0x3b6ac1)[_0x63fc('0x26')](_0x59b130);}};}function respondWithFilteredResult(_0xb85fbf,_0x2d1dc3){return function(_0x3d7b61){if(_0x3d7b61){var _0x390f41=_0x3d7b61['count'],_0x542c2e=_0x2d1dc3[_0x63fc('0x27')],_0x2ea402=_0x2d1dc3[_0x63fc('0x27')]+_0x2d1dc3['limit'],_0x5da5bd;if(_0x2ea402>=_0x390f41){_0x2ea402=_0x390f41;_0x5da5bd=0xc8;}else{_0x5da5bd=0xce;}_0xb85fbf['status'](_0x5da5bd);return _0xb85fbf['set'](_0x63fc('0x28'),_0x542c2e+'-'+_0x2ea402+'/'+_0x390f41)[_0x63fc('0x26')](_0x3d7b61);}return null;};}function patchUpdates(_0x41deb6){return function(_0x365653){try{jsonpatch[_0x63fc('0x29')](_0x365653,_0x41deb6,!![]);}catch(_0x2b015b){return BPromise[_0x63fc('0x2a')](_0x2b015b);}return _0x365653['save']();};}function saveUpdates(_0x31da6b,_0x22a503){return function(_0x5e43db){if(_0x5e43db){return _0x5e43db[_0x63fc('0x2b')](_0x31da6b)[_0x63fc('0x1b')](function(_0x470b19){return _0x470b19;});}return null;};}function removeEntity(_0x4abd06,_0x291358){return function(_0x4a8fcf){if(_0x4a8fcf){return _0x4a8fcf[_0x63fc('0x2c')]()[_0x63fc('0x1b')](function(){_0x4abd06[_0x63fc('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x423fa6,_0x16d66f){return function(_0xd5d062){if(!_0xd5d062){_0x423fa6['sendStatus'](0x194);}return _0xd5d062;};}function handleError(_0x16e9ab,_0x50ba31){_0x50ba31=_0x50ba31||0x1f4;return function(_0x2aa634){logger[_0x63fc('0x20')](_0x2aa634[_0x63fc('0x2d')]);if(_0x2aa634['name']){delete _0x2aa634[_0x63fc('0x2e')];}_0x16e9ab[_0x63fc('0x24')](_0x50ba31)[_0x63fc('0x2f')](_0x2aa634);};}exports['index']=function(_0x232a92,_0x57df97){var _0x168d8d={},_0x18ebc2={},_0x4c3292={'count':0x0,'rows':[]};var _0x214e5c=db[_0x63fc('0x30')]['rawAttributes'];_0x18ebc2[_0x63fc('0x31')]=_['keys'](_0x214e5c);var _0x4de243={'dateStart':_0x232a92['query']['dateStart'],'dateEnd':_0x232a92[_0x63fc('0x32')][_0x63fc('0x33')]};delete _0x232a92[_0x63fc('0x32')]['dateStart'];delete _0x232a92[_0x63fc('0x32')][_0x63fc('0x33')];_0x18ebc2['query']=_['keys'](_0x232a92[_0x63fc('0x32')]);_0x18ebc2[_0x63fc('0x34')]=_['intersection'](_0x18ebc2[_0x63fc('0x31')],_0x18ebc2[_0x63fc('0x32')]);_0x168d8d['attributes']=_['intersection'](_0x18ebc2[_0x63fc('0x31')],qs[_0x63fc('0x35')](_0x232a92[_0x63fc('0x32')][_0x63fc('0x35')]));_0x168d8d[_0x63fc('0x36')]=_0x168d8d[_0x63fc('0x36')][_0x63fc('0x37')]?_0x168d8d[_0x63fc('0x36')]:_0x18ebc2[_0x63fc('0x31')];if(!_0x232a92[_0x63fc('0x32')]['hasOwnProperty'](_0x63fc('0x38'))){_0x168d8d[_0x63fc('0x39')]=qs[_0x63fc('0x39')](_0x232a92[_0x63fc('0x32')]['limit']);_0x168d8d[_0x63fc('0x27')]=qs[_0x63fc('0x27')](_0x232a92[_0x63fc('0x32')][_0x63fc('0x27')]);}_0x168d8d[_0x63fc('0x3a')]=qs[_0x63fc('0x3b')](_0x232a92['query'][_0x63fc('0x3b')]);_0x168d8d[_0x63fc('0x3c')]=qs[_0x63fc('0x34')](_[_0x63fc('0x3d')](_0x232a92[_0x63fc('0x32')],_0x18ebc2['filters']));if(_0x4de243[_0x63fc('0x3e')]){if(_0x4de243[_0x63fc('0x33')]){_0x4de243[_0x63fc('0x33')]=moment(_0x4de243[_0x63fc('0x33')])[_0x63fc('0x3f')](0x1,_0x63fc('0x40'));}else{_0x4de243[_0x63fc('0x33')]=moment(_0x4de243[_0x63fc('0x3e')])[_0x63fc('0x3f')](0x1,_0x63fc('0x40'));}_[_0x63fc('0x41')](_0x168d8d['where'],{'createdAt':{'$gte':_0x4de243[_0x63fc('0x3e')],'$lte':_0x4de243['dateEnd']}});}if(_0x232a92[_0x63fc('0x32')]['filter']){_0x168d8d[_0x63fc('0x3c')]=_['merge'](_0x168d8d['where'],{'$or':_['map'](_0x168d8d[_0x63fc('0x36')],function(_0x53fbc1){var _0x4c0091={};_0x4c0091[_0x53fbc1]={'$like':'%'+_0x232a92[_0x63fc('0x32')]['filter']+'%'};return _0x4c0091;})});}_0x168d8d=_['merge']({},_0x168d8d,_0x232a92['options']);var _0x72185={'where':_0x168d8d[_0x63fc('0x3c')]};return db['MailMessage'][_0x63fc('0x42')](_0x72185)['then'](function(_0x2cabf8){_0x4c3292['count']=_0x2cabf8;if(_0x232a92[_0x63fc('0x32')][_0x63fc('0x43')]){_0x168d8d[_0x63fc('0x44')]=[{'all':!![]}];}return db[_0x63fc('0x30')][_0x63fc('0x45')](_0x168d8d);})[_0x63fc('0x1b')](function(_0x5574e9){_0x4c3292[_0x63fc('0x46')]=_0x5574e9;return _0x4c3292;})[_0x63fc('0x1b')](respondWithFilteredResult(_0x57df97,_0x168d8d))[_0x63fc('0x47')](handleError(_0x57df97,null));};exports[_0x63fc('0x48')]=function(_0x4a35bf,_0x3347da){var _0x373ba1={'raw':!![],'where':{'id':_0x4a35bf['params']['id']}},_0x2b323c={};_0x2b323c[_0x63fc('0x31')]=_[_0x63fc('0x49')](db[_0x63fc('0x30')][_0x63fc('0x4a')]);_0x2b323c[_0x63fc('0x32')]=_[_0x63fc('0x49')](_0x4a35bf[_0x63fc('0x32')]);_0x2b323c[_0x63fc('0x34')]=_[_0x63fc('0x4b')](_0x2b323c[_0x63fc('0x31')],_0x2b323c[_0x63fc('0x32')]);_0x373ba1[_0x63fc('0x36')]=_[_0x63fc('0x4b')](_0x2b323c[_0x63fc('0x31')],qs['fields'](_0x4a35bf[_0x63fc('0x32')][_0x63fc('0x35')]));_0x373ba1[_0x63fc('0x36')]=_0x373ba1['attributes'][_0x63fc('0x37')]?_0x373ba1[_0x63fc('0x36')]:_0x2b323c[_0x63fc('0x31')];if(_0x4a35bf[_0x63fc('0x32')][_0x63fc('0x43')]){_0x373ba1[_0x63fc('0x44')]=[{'all':!![]}];}_0x373ba1=_[_0x63fc('0x41')]({},_0x373ba1,_0x4a35bf[_0x63fc('0x4c')]);return db[_0x63fc('0x30')][_0x63fc('0x4d')](_0x373ba1)['then'](handleEntityNotFound(_0x3347da,null))[_0x63fc('0x1b')](respondWithResult(_0x3347da,null))[_0x63fc('0x47')](handleError(_0x3347da,null));};exports[_0x63fc('0x2b')]=function(_0xc47725,_0x2f9cba){if(_0xc47725[_0x63fc('0x4e')]['id']){delete _0xc47725[_0x63fc('0x4e')]['id'];}return db[_0x63fc('0x30')][_0x63fc('0x4d')]({'where':{'id':_0xc47725[_0x63fc('0x4f')]['id']}})[_0x63fc('0x1b')](handleEntityNotFound(_0x2f9cba,null))[_0x63fc('0x1b')](saveUpdates(_0xc47725[_0x63fc('0x4e')],null))[_0x63fc('0x1b')](respondWithResult(_0x2f9cba,null))[_0x63fc('0x47')](handleError(_0x2f9cba,null));};exports[_0x63fc('0x2c')]=function(_0x54ac75,_0x29de1d){return db[_0x63fc('0x30')]['find']({'where':{'id':_0x54ac75['params']['id']}})['then'](handleEntityNotFound(_0x29de1d,null))['then'](removeEntity(_0x29de1d,null))[_0x63fc('0x47')](handleError(_0x29de1d,null));};exports['describe']=function(_0x31624c,_0xd3a018){return db[_0x63fc('0x30')]['describe']()[_0x63fc('0x1b')](respondWithResult(_0xd3a018,null))[_0x63fc('0x47')](handleError(_0xd3a018,null));};exports[_0x63fc('0x50')]=function(_0x13af0d,_0x6bc3a1){return db[_0x63fc('0x30')]['create'](_0x13af0d['body'])[_0x63fc('0x1b')](function(_0x165576){if(_0x165576){if(_0x165576[_0x63fc('0x51')]===_0x63fc('0x52')&&!_0x165576[_0x63fc('0x53')]){return db['MailAccount']['findOne']({'where':{'id':_0x165576['MailAccountId']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](function(_0x4fecfc){if(_0x4fecfc&&_0x4fecfc[_0x63fc('0x54')]){var _0x5df2ea={'tls':{'rejectUnauthorized':![]}};if(_[_0x63fc('0x55')](_0x4fecfc[_0x63fc('0x54')]['service'])){_0x5df2ea[_0x63fc('0x56')]=_0x4fecfc[_0x63fc('0x54')]['host'];_0x5df2ea[_0x63fc('0x57')]=_0x4fecfc[_0x63fc('0x54')][_0x63fc('0x57')];_0x5df2ea[_0x63fc('0x58')]=_0x4fecfc[_0x63fc('0x54')][_0x63fc('0x58')];if(_0x4fecfc['Smtp'][_0x63fc('0x59')]){_0x5df2ea[_0x63fc('0x5a')]={'user':_0x4fecfc[_0x63fc('0x54')][_0x63fc('0x5b')],'pass':_0x4fecfc[_0x63fc('0x54')]['pass']};}}else{_0x5df2ea['service']=_0x4fecfc[_0x63fc('0x54')]['service'];_0x5df2ea[_0x63fc('0x5a')]={'user':_0x4fecfc[_0x63fc('0x54')][_0x63fc('0x5b')],'pass':_0x4fecfc[_0x63fc('0x54')][_0x63fc('0x5c')]};_0x5df2ea['secure']=_0x4fecfc['Smtp'][_0x63fc('0x58')];}if(_0x13af0d[_0x63fc('0x4e')][_0x63fc('0x5d')]&&_0x13af0d[_0x63fc('0x4e')][_0x63fc('0x5d')][_0x63fc('0x37')]){for(var _0x38776d=0x0;_0x38776d<_0x13af0d[_0x63fc('0x4e')][_0x63fc('0x5d')][_0x63fc('0x37')];_0x38776d+=0x1){_0x13af0d[_0x63fc('0x4e')][_0x63fc('0x5d')][_0x38776d]={'filename':_0x13af0d[_0x63fc('0x4e')][_0x63fc('0x5d')][_0x38776d]['name'],'path':path['join'](config[_0x63fc('0x5e')],_0x63fc('0x5f'),_0x13af0d[_0x63fc('0x4e')][_0x63fc('0x5d')][_0x38776d][_0x63fc('0x60')])};}}return{'account':_0x5df2ea,'message':_0x13af0d['body']};}})[_0x63fc('0x1b')](function(_0x2c72a3){if(_0x2c72a3){return respondWithRpcPromise(_0x63fc('0x61'),_0x63fc('0x62'),_0x2c72a3,client9003)['then'](function(_0x1f199f){return _0x165576[_0x63fc('0x2b')]({'read':!![],'messageId':_0x1f199f[_0x63fc('0x63')],'sentAt':moment()[_0x63fc('0x64')](_0x63fc('0x65'))});})['catch'](function(_0x143d73){logger[_0x63fc('0x20')]('%s',JSON[_0x63fc('0x1f')](_0x143d73));return _0x165576;});}return _0x165576;});}return _0x165576;}})['then'](respondWithResult(_0x6bc3a1,0xc9))[_0x63fc('0x47')](handleError(_0x6bc3a1,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['accept']=function(_0x147ae6,_0x2a2770,_0xdf73c6){var _0x4b22bd={'channel':_0x63fc('0x66')};if(_0x147ae6[_0x63fc('0x4e')]['id']){delete _0x147ae6[_0x63fc('0x4e')]['id'];}_0x147ae6[_0x63fc('0x4e')][_0x63fc('0x67')]=!![];_0x147ae6['body'][_0x63fc('0x68')]=moment()[_0x63fc('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x147ae6[_0x63fc('0x4e')][_0x63fc('0x69')]=_0x147ae6['body'][_0x63fc('0x69')]||_0x147ae6[_0x63fc('0x5b')]['id'];return db[_0x63fc('0x30')][_0x63fc('0x4d')]({'where':{'id':_0x147ae6[_0x63fc('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x63fc('0x6a')],'as':_0x63fc('0x6b')}]})[_0x63fc('0x1b')](handleEntityNotFound(_0x2a2770,null))[_0x63fc('0x1b')](saveUpdates(_0x147ae6[_0x63fc('0x4e')],null))[_0x63fc('0x1b')](function(_0x1b8366){if(_0x1b8366){_0x4b22bd['message']=_0x1b8366['get']({'plain':!![]});return db[_0x63fc('0x6c')][_0x63fc('0x4d')]({'where':{'id':_0x1b8366[_0x63fc('0x6d')]}});}return null;})[_0x63fc('0x1b')](handleEntityNotFound(_0x2a2770,null))[_0x63fc('0x1b')](function(_0x43ffc5){if(_0x43ffc5){return _0x43ffc5['update']({'UserId':_0x147ae6[_0x63fc('0x4e')][_0x63fc('0x69')],'read1stAt':_[_0x63fc('0x55')](_0x43ffc5['read1stAt'])?moment()[_0x63fc('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x63fc('0x1b')](function(_0x46003d){if(_0x46003d){_0x4b22bd[_0x63fc('0x6e')]=_0x46003d[_0x63fc('0x6f')]({'plain':!![]});interaction_log[_0x63fc('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x147ae6[_0x63fc('0x5b')]['id'],_0x147ae6[_0x63fc('0x5b')]['name'],_0x147ae6[_0x63fc('0x5b')][_0x63fc('0x70')],_0x4b22bd[_0x63fc('0x6e')]['id'],_0x147ae6[_0x63fc('0x4e')]?JSON[_0x63fc('0x1f')](_0x147ae6[_0x63fc('0x4e')]):_0x63fc('0x71'));return respondWithRpcPromise(_0x63fc('0x72'),_0x63fc('0x73'),_0x4b22bd);}return null;})[_0x63fc('0x1b')](function(_0x3738b3){if(_0x3738b3){if(_0x147ae6[_0x63fc('0x4e')][_0x63fc('0x74')]){_0x4b22bd[_0x63fc('0x22')][_0x63fc('0x75')]=util['format']('SIP/%s',_0x147ae6[_0x63fc('0x5b')][_0x63fc('0x2e')]);_0x4b22bd[_0x63fc('0x22')][_0x63fc('0x76')]=_0x4b22bd[_0x63fc('0x76')];_0x4b22bd['message'][_0x63fc('0x77')]='accept';return respondWithRpcPromise('EventManager',_0x63fc('0x78'),{'event':_0x63fc('0x79'),'message':_0x4b22bd[_0x63fc('0x22')]},client9002)['then'](function(){return _0x4b22bd;});}return _0x4b22bd;}return null;})[_0x63fc('0x1b')](respondWithResult(_0x2a2770,null))['catch'](handleError(_0x2a2770,null));};var interaction_log=require('../../config/logger')(_0x63fc('0x7a'));exports['reject']=function(_0x440f33,_0x31eab9,_0x318dae){var _0x83984f={'agent':{},'channel':'mail'};if(_0x440f33[_0x63fc('0x4e')]['id']){delete _0x440f33[_0x63fc('0x4e')]['id'];}_0x440f33[_0x63fc('0x4e')][_0x63fc('0x69')]=_0x440f33[_0x63fc('0x4e')][_0x63fc('0x69')]||_0x440f33['user']['id'];_0x83984f[_0x63fc('0x7b')]['id']=_0x440f33['body'][_0x63fc('0x69')];return db[_0x63fc('0x30')]['find']({'where':{'id':_0x440f33[_0x63fc('0x4f')]['id'],'UserId':null}})[_0x63fc('0x1b')](handleEntityNotFound(_0x31eab9,null))[_0x63fc('0x1b')](function(_0x364fde){if(_0x364fde){_0x83984f[_0x63fc('0x22')]=_0x364fde[_0x63fc('0x6f')]({'plain':!![]});return db['MailInteraction'][_0x63fc('0x4d')]({'where':{'id':_0x364fde[_0x63fc('0x6d')]}});}return null;})[_0x63fc('0x1b')](handleEntityNotFound(_0x31eab9,null))[_0x63fc('0x1b')](function(_0x41cef6){if(_0x41cef6){_0x83984f[_0x63fc('0x6e')]=_0x41cef6['get']({'plain':!![]});interaction_log[_0x63fc('0x1c')](_0x63fc('0x7c'),_0x440f33[_0x63fc('0x5b')]['id'],_0x440f33[_0x63fc('0x5b')]['name'],_0x440f33[_0x63fc('0x5b')][_0x63fc('0x70')],_0x83984f[_0x63fc('0x6e')]['id'],_0x440f33[_0x63fc('0x4e')]?JSON['stringify'](_0x440f33['body']):_0x63fc('0x71'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x83984f);}return null;})[_0x63fc('0x1b')](function(_0x72990d){if(_0x72990d){_0x72990d[_0x63fc('0x22')]['interface']=util['format'](_0x63fc('0x7d'),_0x440f33[_0x63fc('0x5b')][_0x63fc('0x2e')]);_0x72990d['message'][_0x63fc('0x76')]=_0x83984f[_0x63fc('0x76')];_0x72990d[_0x63fc('0x22')]['event']=_0x63fc('0x2a');respondWithRpcPromise(_0x63fc('0x78'),_0x63fc('0x78'),{'event':_0x63fc('0x7e'),'message':_0x72990d['message']},client9002);return _0x83984f;}return null;})[_0x63fc('0x1b')](respondWithResult(_0x31eab9,null))[_0x63fc('0x47')](handleError(_0x31eab9,null));}; \ No newline at end of file +var _0xb0d9=['MailInteraction','null','RejectMessage','rejectMessage','interface','reject','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','./mailMessage.socket','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','save','update','then','destroy','stack','name','index','rawAttributes','model','query','dateEnd','dateStart','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','filter','map','options','MailMessage','includeAll','findAll','rows','show','params','keys','length','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','secure','auth','pass','attachments','root','server/files/attachments','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail-interactions','accept','mail','read','readAt','UserId','user','CmContact','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage'];(function(_0x5c950c,_0xd89946){var _0x5b6e8f=function(_0x442c69){while(--_0x442c69){_0x5c950c['push'](_0x5c950c['shift']());}};_0x5b6e8f(++_0xd89946);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x30195d,_0x20f6c5){_0x30195d=_0x30195d-0x0;var _0x59d129=_0xb0d9[_0x30195d];return _0x59d129;};'use strict';var jsonpatch=require(_0x9b0d('0x0'));var rp=require(_0x9b0d('0x1'));var moment=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var Mustache=require(_0x9b0d('0x4'));var util=require(_0x9b0d('0x5'));var path=require('path');var sox=require(_0x9b0d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9b0d('0x7'));var crypto=require(_0x9b0d('0x8'));var jsforce=require(_0x9b0d('0x9'));var deskjs=require(_0x9b0d('0xa'));var toCsv=require(_0x9b0d('0xb'));var querystring=require(_0x9b0d('0xc'));var Papa=require(_0x9b0d('0xd'));var qs=require(_0x9b0d('0xe'));var logger=require(_0x9b0d('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x9b0d('0x10'));var db=require(_0x9b0d('0x11'))['db'];var socket=require('socket.io-emitter')({'host':_0x9b0d('0x12'),'port':0x18eb});require(_0x9b0d('0x13'))['register'](socket);var jayson=require(_0x9b0d('0x14'));var client=jayson[_0x9b0d('0x15')]['http']({'port':0x232c});var client9003=jayson[_0x9b0d('0x15')]['http']({'port':0x232b});var client9002=jayson[_0x9b0d('0x15')][_0x9b0d('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x14d344,_0x550770,_0x3bd923,_0x551445){return new BPromise(function(_0x404f33,_0x1dfc28){var _0x55d560=_0x551445||client;return _0x55d560[_0x9b0d('0x17')](_0x14d344,_0x3bd923)['then'](function(_0x17c201){logger[_0x9b0d('0x18')](_0x9b0d('0x19'),_0x550770,'request\x20sent');logger[_0x9b0d('0x1a')](_0x9b0d('0x1b'),_0x550770,'request\x20sent',JSON['stringify'](_0x17c201));if(_0x17c201['error']){if(_0x17c201[_0x9b0d('0x1c')][_0x9b0d('0x1d')]===0x1f4){logger[_0x9b0d('0x1c')](_0x9b0d('0x19'),_0x550770,_0x17c201['error'][_0x9b0d('0x1e')]);return _0x1dfc28(_0x17c201[_0x9b0d('0x1c')][_0x9b0d('0x1e')]);}logger[_0x9b0d('0x1c')]('MailMessage,\x20%s,\x20%s',_0x550770,_0x17c201[_0x9b0d('0x1c')][_0x9b0d('0x1e')]);return _0x404f33(_0x17c201[_0x9b0d('0x1c')][_0x9b0d('0x1e')]);}else{logger[_0x9b0d('0x18')]('MailMessage,\x20%s,\x20%s',_0x550770,_0x9b0d('0x1f'));_0x404f33(_0x17c201[_0x9b0d('0x20')][_0x9b0d('0x1e')]);}})[_0x9b0d('0x21')](function(_0x74065a){logger[_0x9b0d('0x1c')](_0x9b0d('0x19'),_0x550770,_0x74065a);_0x1dfc28(_0x74065a);});});}function respondWithStatusCode(_0x25e969,_0xd31f44){_0xd31f44=_0xd31f44||0xcc;return function(_0x12e9c3){if(_0x12e9c3){return _0x25e969[_0x9b0d('0x22')](_0xd31f44);}return _0x25e969['status'](_0xd31f44)[_0x9b0d('0x23')]();};}function respondWithResult(_0x4f774c,_0x26ecfc){_0x26ecfc=_0x26ecfc||0xc8;return function(_0x2432c7){if(_0x2432c7){return _0x4f774c[_0x9b0d('0x24')](_0x26ecfc)[_0x9b0d('0x25')](_0x2432c7);}};}function respondWithFilteredResult(_0x213861,_0x1b6730){return function(_0xe6ad96){if(_0xe6ad96){var _0x1cac5a=_0xe6ad96[_0x9b0d('0x26')],_0x1192f7=_0x1b6730[_0x9b0d('0x27')],_0x5b31e4=_0x1b6730[_0x9b0d('0x27')]+_0x1b6730[_0x9b0d('0x28')],_0x18a29f;if(_0x5b31e4>=_0x1cac5a){_0x5b31e4=_0x1cac5a;_0x18a29f=0xc8;}else{_0x18a29f=0xce;}_0x213861[_0x9b0d('0x24')](_0x18a29f);return _0x213861['set'](_0x9b0d('0x29'),_0x1192f7+'-'+_0x5b31e4+'/'+_0x1cac5a)[_0x9b0d('0x25')](_0xe6ad96);}return null;};}function patchUpdates(_0x434a20){return function(_0x268e8f){try{jsonpatch['apply'](_0x268e8f,_0x434a20,!![]);}catch(_0x1a199d){return BPromise['reject'](_0x1a199d);}return _0x268e8f[_0x9b0d('0x2a')]();};}function saveUpdates(_0x561d9f,_0x30155d){return function(_0x4ff235){if(_0x4ff235){return _0x4ff235[_0x9b0d('0x2b')](_0x561d9f)[_0x9b0d('0x2c')](function(_0x5d9b7c){return _0x5d9b7c;});}return null;};}function removeEntity(_0xc8186c,_0x5366fd){return function(_0x47eae0){if(_0x47eae0){return _0x47eae0[_0x9b0d('0x2d')]()[_0x9b0d('0x2c')](function(){_0xc8186c[_0x9b0d('0x24')](0xcc)[_0x9b0d('0x23')]();});}};}function handleEntityNotFound(_0x1a0d61,_0x51e2cb){return function(_0x13221f){if(!_0x13221f){_0x1a0d61[_0x9b0d('0x22')](0x194);}return _0x13221f;};}function handleError(_0x1beacb,_0x2c0659){_0x2c0659=_0x2c0659||0x1f4;return function(_0x261f53){logger[_0x9b0d('0x1c')](_0x261f53[_0x9b0d('0x2e')]);if(_0x261f53[_0x9b0d('0x2f')]){delete _0x261f53[_0x9b0d('0x2f')];}_0x1beacb[_0x9b0d('0x24')](_0x2c0659)['send'](_0x261f53);};}exports[_0x9b0d('0x30')]=function(_0x194852,_0x14a01b){var _0x5633ec={},_0x524e8d={},_0xbe640={'count':0x0,'rows':[]};var _0x50ee8f=db['MailMessage'][_0x9b0d('0x31')];_0x524e8d[_0x9b0d('0x32')]=_['keys'](_0x50ee8f);var _0x14fec7={'dateStart':_0x194852[_0x9b0d('0x33')]['dateStart'],'dateEnd':_0x194852[_0x9b0d('0x33')][_0x9b0d('0x34')]};delete _0x194852[_0x9b0d('0x33')][_0x9b0d('0x35')];delete _0x194852[_0x9b0d('0x33')][_0x9b0d('0x34')];_0x524e8d[_0x9b0d('0x33')]=_['keys'](_0x194852['query']);_0x524e8d[_0x9b0d('0x36')]=_[_0x9b0d('0x37')](_0x524e8d[_0x9b0d('0x32')],_0x524e8d[_0x9b0d('0x33')]);_0x5633ec[_0x9b0d('0x38')]=_['intersection'](_0x524e8d[_0x9b0d('0x32')],qs[_0x9b0d('0x39')](_0x194852[_0x9b0d('0x33')][_0x9b0d('0x39')]));_0x5633ec[_0x9b0d('0x38')]=_0x5633ec[_0x9b0d('0x38')]['length']?_0x5633ec['attributes']:_0x524e8d[_0x9b0d('0x32')];if(!_0x194852[_0x9b0d('0x33')][_0x9b0d('0x3a')](_0x9b0d('0x3b'))){_0x5633ec[_0x9b0d('0x28')]=qs[_0x9b0d('0x28')](_0x194852[_0x9b0d('0x33')]['limit']);_0x5633ec[_0x9b0d('0x27')]=qs[_0x9b0d('0x27')](_0x194852[_0x9b0d('0x33')][_0x9b0d('0x27')]);}_0x5633ec[_0x9b0d('0x3c')]=qs[_0x9b0d('0x3d')](_0x194852[_0x9b0d('0x33')][_0x9b0d('0x3d')]);_0x5633ec['where']=qs['filters'](_[_0x9b0d('0x3e')](_0x194852[_0x9b0d('0x33')],_0x524e8d[_0x9b0d('0x36')]));if(_0x14fec7[_0x9b0d('0x35')]){if(_0x14fec7[_0x9b0d('0x34')]){_0x14fec7['dateEnd']=moment(_0x14fec7[_0x9b0d('0x34')])[_0x9b0d('0x3f')](0x1,_0x9b0d('0x40'));}else{_0x14fec7['dateEnd']=moment(_0x14fec7[_0x9b0d('0x35')])['add'](0x1,_0x9b0d('0x40'));}_[_0x9b0d('0x41')](_0x5633ec[_0x9b0d('0x42')],{'createdAt':{'$gte':_0x14fec7[_0x9b0d('0x35')],'$lte':_0x14fec7[_0x9b0d('0x34')]}});}if(_0x194852[_0x9b0d('0x33')][_0x9b0d('0x43')]){_0x5633ec[_0x9b0d('0x42')]=_['merge'](_0x5633ec[_0x9b0d('0x42')],{'$or':_[_0x9b0d('0x44')](_0x5633ec[_0x9b0d('0x38')],function(_0x35a09d){var _0x2be474={};_0x2be474[_0x35a09d]={'$like':'%'+_0x194852[_0x9b0d('0x33')][_0x9b0d('0x43')]+'%'};return _0x2be474;})});}_0x5633ec=_['merge']({},_0x5633ec,_0x194852[_0x9b0d('0x45')]);var _0x2bc22d={'where':_0x5633ec['where']};return db[_0x9b0d('0x46')]['count'](_0x2bc22d)['then'](function(_0x3c6d4e){_0xbe640[_0x9b0d('0x26')]=_0x3c6d4e;if(_0x194852[_0x9b0d('0x33')][_0x9b0d('0x47')]){_0x5633ec['include']=[{'all':!![]}];}return db['MailMessage'][_0x9b0d('0x48')](_0x5633ec);})[_0x9b0d('0x2c')](function(_0x16f2e9){_0xbe640[_0x9b0d('0x49')]=_0x16f2e9;return _0xbe640;})[_0x9b0d('0x2c')](respondWithFilteredResult(_0x14a01b,_0x5633ec))[_0x9b0d('0x21')](handleError(_0x14a01b,null));};exports[_0x9b0d('0x4a')]=function(_0x3a750e,_0x1568f4){var _0x6a7899={'raw':!![],'where':{'id':_0x3a750e[_0x9b0d('0x4b')]['id']}},_0x5b5cd6={};_0x5b5cd6['model']=_['keys'](db[_0x9b0d('0x46')][_0x9b0d('0x31')]);_0x5b5cd6[_0x9b0d('0x33')]=_[_0x9b0d('0x4c')](_0x3a750e[_0x9b0d('0x33')]);_0x5b5cd6[_0x9b0d('0x36')]=_[_0x9b0d('0x37')](_0x5b5cd6['model'],_0x5b5cd6[_0x9b0d('0x33')]);_0x6a7899['attributes']=_[_0x9b0d('0x37')](_0x5b5cd6['model'],qs['fields'](_0x3a750e[_0x9b0d('0x33')]['fields']));_0x6a7899[_0x9b0d('0x38')]=_0x6a7899[_0x9b0d('0x38')][_0x9b0d('0x4d')]?_0x6a7899['attributes']:_0x5b5cd6[_0x9b0d('0x32')];if(_0x3a750e[_0x9b0d('0x33')][_0x9b0d('0x47')]){_0x6a7899['include']=[{'all':!![]}];}_0x6a7899=_[_0x9b0d('0x41')]({},_0x6a7899,_0x3a750e[_0x9b0d('0x45')]);return db[_0x9b0d('0x46')][_0x9b0d('0x4e')](_0x6a7899)[_0x9b0d('0x2c')](handleEntityNotFound(_0x1568f4,null))[_0x9b0d('0x2c')](respondWithResult(_0x1568f4,null))[_0x9b0d('0x21')](handleError(_0x1568f4,null));};exports['update']=function(_0x293c0a,_0x1e6541){if(_0x293c0a[_0x9b0d('0x4f')]['id']){delete _0x293c0a[_0x9b0d('0x4f')]['id'];}return db[_0x9b0d('0x46')][_0x9b0d('0x4e')]({'where':{'id':_0x293c0a['params']['id']}})[_0x9b0d('0x2c')](handleEntityNotFound(_0x1e6541,null))[_0x9b0d('0x2c')](saveUpdates(_0x293c0a['body'],null))['then'](respondWithResult(_0x1e6541,null))['catch'](handleError(_0x1e6541,null));};exports[_0x9b0d('0x2d')]=function(_0x5525c8,_0x2a8606){return db[_0x9b0d('0x46')][_0x9b0d('0x4e')]({'where':{'id':_0x5525c8[_0x9b0d('0x4b')]['id']}})[_0x9b0d('0x2c')](handleEntityNotFound(_0x2a8606,null))[_0x9b0d('0x2c')](removeEntity(_0x2a8606,null))[_0x9b0d('0x21')](handleError(_0x2a8606,null));};exports[_0x9b0d('0x50')]=function(_0x14a74c,_0x261b35){return db[_0x9b0d('0x46')][_0x9b0d('0x50')]()[_0x9b0d('0x2c')](respondWithResult(_0x261b35,null))[_0x9b0d('0x21')](handleError(_0x261b35,null));};exports[_0x9b0d('0x51')]=function(_0x205a3e,_0x3c2405){return db[_0x9b0d('0x46')][_0x9b0d('0x51')](_0x205a3e[_0x9b0d('0x4f')])['then'](function(_0x5d1f1c){if(_0x5d1f1c){if(_0x5d1f1c[_0x9b0d('0x52')]===_0x9b0d('0x53')&&!_0x5d1f1c[_0x9b0d('0x54')]){return db[_0x9b0d('0x55')][_0x9b0d('0x56')]({'where':{'id':_0x5d1f1c[_0x9b0d('0x57')]},'include':[{'model':db[_0x9b0d('0x58')],'as':_0x9b0d('0x59'),'raw':!![]}]})[_0x9b0d('0x2c')](function(_0x45ec65){if(_0x45ec65&&_0x45ec65[_0x9b0d('0x59')]){var _0x4c1be3={'tls':{'rejectUnauthorized':![]}};if(_[_0x9b0d('0x5a')](_0x45ec65[_0x9b0d('0x59')][_0x9b0d('0x5b')])){_0x4c1be3[_0x9b0d('0x5c')]=_0x45ec65[_0x9b0d('0x59')]['host'];_0x4c1be3[_0x9b0d('0x5d')]=_0x45ec65[_0x9b0d('0x59')][_0x9b0d('0x5d')];_0x4c1be3[_0x9b0d('0x5e')]=_0x45ec65[_0x9b0d('0x59')][_0x9b0d('0x5e')];if(_0x45ec65['Smtp']['authentication']){_0x4c1be3[_0x9b0d('0x5f')]={'user':_0x45ec65[_0x9b0d('0x59')]['user'],'pass':_0x45ec65[_0x9b0d('0x59')]['pass']};}}else{_0x4c1be3[_0x9b0d('0x5b')]=_0x45ec65[_0x9b0d('0x59')][_0x9b0d('0x5b')];_0x4c1be3[_0x9b0d('0x5f')]={'user':_0x45ec65[_0x9b0d('0x59')]['user'],'pass':_0x45ec65[_0x9b0d('0x59')][_0x9b0d('0x60')]};_0x4c1be3[_0x9b0d('0x5e')]=_0x45ec65[_0x9b0d('0x59')][_0x9b0d('0x5e')];}if(_0x205a3e[_0x9b0d('0x4f')][_0x9b0d('0x61')]&&_0x205a3e['body'][_0x9b0d('0x61')][_0x9b0d('0x4d')]){for(var _0x3be952=0x0;_0x3be952<_0x205a3e[_0x9b0d('0x4f')][_0x9b0d('0x61')]['length'];_0x3be952+=0x1){_0x205a3e['body'][_0x9b0d('0x61')][_0x3be952]={'filename':_0x205a3e['body'][_0x9b0d('0x61')][_0x3be952]['name'],'path':path['join'](config[_0x9b0d('0x62')],_0x9b0d('0x63'),_0x205a3e[_0x9b0d('0x4f')][_0x9b0d('0x61')][_0x3be952]['basename'])};}}return{'account':_0x4c1be3,'message':_0x205a3e[_0x9b0d('0x4f')]};}})[_0x9b0d('0x2c')](function(_0x1eb2f5){if(_0x1eb2f5){return respondWithRpcPromise(_0x9b0d('0x64'),_0x9b0d('0x65'),_0x1eb2f5,client9003)['then'](function(_0x1ea665){return _0x5d1f1c[_0x9b0d('0x2b')]({'read':!![],'messageId':_0x1ea665[_0x9b0d('0x66')],'sentAt':moment()[_0x9b0d('0x67')](_0x9b0d('0x68'))});})[_0x9b0d('0x21')](function(_0x43854e){logger[_0x9b0d('0x1c')]('%s',JSON[_0x9b0d('0x69')](_0x43854e));return _0x5d1f1c;});}return _0x5d1f1c;});}return _0x5d1f1c;}})['then'](respondWithResult(_0x3c2405,0xc9))[_0x9b0d('0x21')](handleError(_0x3c2405,null));};var interaction_log=require(_0x9b0d('0xf'))(_0x9b0d('0x6a'));exports[_0x9b0d('0x6b')]=function(_0x749461,_0xa78f8d,_0x2152aa){var _0x5a262e={'channel':_0x9b0d('0x6c')};if(_0x749461[_0x9b0d('0x4f')]['id']){delete _0x749461['body']['id'];}_0x749461['body'][_0x9b0d('0x6d')]=!![];_0x749461[_0x9b0d('0x4f')][_0x9b0d('0x6e')]=moment()[_0x9b0d('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x749461[_0x9b0d('0x4f')]['UserId']=_0x749461[_0x9b0d('0x4f')][_0x9b0d('0x6f')]||_0x749461[_0x9b0d('0x70')]['id'];return db[_0x9b0d('0x46')][_0x9b0d('0x4e')]({'where':{'id':_0x749461[_0x9b0d('0x4b')]['id'],'UserId':null},'include':[{'model':db[_0x9b0d('0x71')],'as':'Contact'}]})['then'](handleEntityNotFound(_0xa78f8d,null))[_0x9b0d('0x2c')](saveUpdates(_0x749461[_0x9b0d('0x4f')],null))[_0x9b0d('0x2c')](function(_0xfb93e0){if(_0xfb93e0){_0x5a262e[_0x9b0d('0x1e')]=_0xfb93e0['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0xfb93e0['MailInteractionId']}});}return null;})[_0x9b0d('0x2c')](handleEntityNotFound(_0xa78f8d,null))[_0x9b0d('0x2c')](function(_0x5e57f6){if(_0x5e57f6){return _0x5e57f6[_0x9b0d('0x2b')]({'UserId':_0x749461['body'][_0x9b0d('0x6f')],'read1stAt':_[_0x9b0d('0x5a')](_0x5e57f6['read1stAt'])?moment()[_0x9b0d('0x67')](_0x9b0d('0x68')):undefined});}return null;})[_0x9b0d('0x2c')](function(_0x1025cd){if(_0x1025cd){_0x5a262e[_0x9b0d('0x72')]=_0x1025cd[_0x9b0d('0x73')]({'plain':!![]});interaction_log[_0x9b0d('0x18')](_0x9b0d('0x74'),_0x749461[_0x9b0d('0x70')]['id'],_0x749461[_0x9b0d('0x70')]['name'],_0x749461['user'][_0x9b0d('0x75')],_0x5a262e[_0x9b0d('0x72')]['id'],_0x749461[_0x9b0d('0x4f')]?JSON[_0x9b0d('0x69')](_0x749461[_0x9b0d('0x4f')]):'null');return respondWithRpcPromise(_0x9b0d('0x76'),'acceptMessage',_0x5a262e);}return null;})[_0x9b0d('0x2c')](function(_0xdad2ed){if(_0xdad2ed){if(_0x749461[_0x9b0d('0x4f')][_0x9b0d('0x77')]){_0x5a262e['message']['interface']=util['format'](_0x9b0d('0x78'),_0x749461['user']['name']);_0x5a262e[_0x9b0d('0x1e')][_0x9b0d('0x79')]=_0x5a262e[_0x9b0d('0x79')];_0x5a262e[_0x9b0d('0x1e')][_0x9b0d('0x7a')]=_0x9b0d('0x6b');return respondWithRpcPromise(_0x9b0d('0x7b'),'EventManager',{'event':_0x9b0d('0x7c'),'message':_0x5a262e[_0x9b0d('0x1e')]},client9002)['then'](function(){return _0x5a262e;});}return _0x5a262e;}return null;})['then'](respondWithResult(_0xa78f8d,null))['catch'](handleError(_0xa78f8d,null));};var interaction_log=require(_0x9b0d('0xf'))('mail-interactions');exports['reject']=function(_0x519ada,_0x38be1b,_0x3100ce){var _0x37a452={'agent':{},'channel':_0x9b0d('0x6c')};if(_0x519ada[_0x9b0d('0x4f')]['id']){delete _0x519ada[_0x9b0d('0x4f')]['id'];}_0x519ada[_0x9b0d('0x4f')][_0x9b0d('0x6f')]=_0x519ada[_0x9b0d('0x4f')][_0x9b0d('0x6f')]||_0x519ada[_0x9b0d('0x70')]['id'];_0x37a452['agent']['id']=_0x519ada['body']['UserId'];return db[_0x9b0d('0x46')][_0x9b0d('0x4e')]({'where':{'id':_0x519ada[_0x9b0d('0x4b')]['id'],'UserId':null}})[_0x9b0d('0x2c')](handleEntityNotFound(_0x38be1b,null))['then'](function(_0x5a7f04){if(_0x5a7f04){_0x37a452[_0x9b0d('0x1e')]=_0x5a7f04[_0x9b0d('0x73')]({'plain':!![]});return db[_0x9b0d('0x7d')][_0x9b0d('0x4e')]({'where':{'id':_0x5a7f04['MailInteractionId']}});}return null;})[_0x9b0d('0x2c')](handleEntityNotFound(_0x38be1b,null))[_0x9b0d('0x2c')](function(_0x2d7cdf){if(_0x2d7cdf){_0x37a452[_0x9b0d('0x72')]=_0x2d7cdf[_0x9b0d('0x73')]({'plain':!![]});interaction_log[_0x9b0d('0x18')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x519ada[_0x9b0d('0x70')]['id'],_0x519ada['user'][_0x9b0d('0x2f')],_0x519ada[_0x9b0d('0x70')]['role'],_0x37a452[_0x9b0d('0x72')]['id'],_0x519ada[_0x9b0d('0x4f')]?JSON[_0x9b0d('0x69')](_0x519ada[_0x9b0d('0x4f')]):_0x9b0d('0x7e'));return respondWithRpcPromise(_0x9b0d('0x7f'),_0x9b0d('0x80'),_0x37a452);}return null;})[_0x9b0d('0x2c')](function(_0x4ae002){if(_0x4ae002){_0x4ae002[_0x9b0d('0x1e')][_0x9b0d('0x81')]=util[_0x9b0d('0x67')](_0x9b0d('0x78'),_0x519ada[_0x9b0d('0x70')][_0x9b0d('0x2f')]);_0x4ae002['message']['channel']=_0x37a452[_0x9b0d('0x79')];_0x4ae002['message'][_0x9b0d('0x7a')]=_0x9b0d('0x82');respondWithRpcPromise(_0x9b0d('0x7b'),_0x9b0d('0x7b'),{'event':'rejectmessage','message':_0x4ae002['message']},client9002);return _0x37a452;}return null;})[_0x9b0d('0x2c')](respondWithResult(_0x38be1b,null))[_0x9b0d('0x21')](handleError(_0x38be1b,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 16bb39d..3a24cb9 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 _0x5581=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','MailMessage'];(function(_0x19094d,_0x219eab){var _0x2f61e7=function(_0x4c3f25){while(--_0x4c3f25){_0x19094d['push'](_0x19094d['shift']());}};_0x2f61e7(++_0x219eab);}(_0x5581,0x115));var _0x1558=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x5581[_0x2283dc];return _0x16db90;};'use strict';var EventEmitter=require(_0x1558('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x1558('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1558('0x2')](0x0);var events={'afterCreate':_0x1558('0x3'),'afterUpdate':_0x1558('0x4'),'afterDestroy':_0x1558('0x5')};function emitEvent(_0x325c21){return function(_0x48c6fa,_0x113434,_0xa09e11){MailMessageEvents['emit'](_0x325c21+':'+_0x48c6fa['id'],_0x48c6fa);MailMessageEvents[_0x1558('0x6')](_0x325c21,_0x48c6fa);_0xa09e11(null);};}for(var e in events){if(events[_0x1558('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x1558('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x6eed=['emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','remove'];(function(_0x3062f0,_0x487847){var _0x5277fd=function(_0x150098){while(--_0x150098){_0x3062f0['push'](_0x3062f0['shift']());}};_0x5277fd(++_0x487847);}(_0x6eed,0xff));var _0xd6ee=function(_0x255442,_0x4bba27){_0x255442=_0x255442-0x0;var _0x3089a6=_0x6eed[_0x255442];return _0x3089a6;};'use strict';var EventEmitter=require(_0xd6ee('0x0'));var MailMessage=require(_0xd6ee('0x1'))['db'][_0xd6ee('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd6ee('0x3')](0x0);var events={'afterCreate':_0xd6ee('0x4'),'afterUpdate':'update','afterDestroy':_0xd6ee('0x5')};function emitEvent(_0x315fdb){return function(_0x588715,_0x53cce9,_0x1d3312){MailMessageEvents[_0xd6ee('0x6')](_0x315fdb+':'+_0x588715['id'],_0x588715);MailMessageEvents[_0xd6ee('0x6')](_0x315fdb,_0x588715);_0x1d3312(null);};}for(var e in events){if(events[_0xd6ee('0x7')](e)){var event=events[e];MailMessage[_0xd6ee('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 3f88c59..5f5d46c 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 _0xf5c4=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','./mailMessage.attributes','define','MailMessage','messageId'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xf5c4,0x1ae));var _0x4f5c=function(_0x411e5d,_0x450c00){_0x411e5d=_0x411e5d-0x0;var _0x58298=_0xf5c4[_0x411e5d];return _0x58298;};'use strict';var _=require(_0x4f5c('0x0'));var util=require(_0x4f5c('0x1'));var logger=require(_0x4f5c('0x2'))(_0x4f5c('0x3'));var moment=require(_0x4f5c('0x4'));var BPromise=require(_0x4f5c('0x5'));var rp=require('request-promise');var attributes=require(_0x4f5c('0x6'));module['exports']=function(_0x49be48,_0x170250){return _0x49be48[_0x4f5c('0x7')](_0x4f5c('0x8'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x4f5c('0x9'),'fields':[_0x4f5c('0x9')]}],'timestamps':!![],'charset':'utf8mb4','collate':_0x4f5c('0xa')});}; \ No newline at end of file +var _0x4fce=['../../config/logger','api','moment','bluebird','request-promise','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','utf8mb4_unicode_ci','lodash','util'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x4fce,0xfa));var _0xe4fc=function(_0x564215,_0x1effd0){_0x564215=_0x564215-0x0;var _0x181952=_0x4fce[_0x564215];return _0x181952;};'use strict';var _=require(_0xe4fc('0x0'));var util=require(_0xe4fc('0x1'));var logger=require(_0xe4fc('0x2'))(_0xe4fc('0x3'));var moment=require(_0xe4fc('0x4'));var BPromise=require(_0xe4fc('0x5'));var rp=require(_0xe4fc('0x6'));var attributes=require(_0xe4fc('0x7'));module[_0xe4fc('0x8')]=function(_0x50f614,_0x59050b){return _0x50f614[_0xe4fc('0x9')](_0xe4fc('0xa'),attributes,{'tableName':_0xe4fc('0xb'),'paranoid':![],'indexes':[{'name':_0xe4fc('0xc'),'fields':['messageId']}],'timestamps':!![],'charset':'utf8mb4','collate':_0xe4fc('0xd')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b73f3c2..fa8bb57 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 _0xe4ed=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','create','body','options','lodash','util'];(function(_0x174d81,_0x441548){var _0xd21bec=function(_0x12d22a){while(--_0x12d22a){_0x174d81['push'](_0x174d81['shift']());}};_0xd21bec(++_0x441548);}(_0xe4ed,0x94));var _0xde4e=function(_0x4e7e2c,_0x44ec66){_0x4e7e2c=_0x4e7e2c-0x0;var _0x160310=_0xe4ed[_0x4e7e2c];return _0x160310;};'use strict';var _=require(_0xde4e('0x0'));var util=require(_0xde4e('0x1'));var moment=require(_0xde4e('0x2'));var BPromise=require('bluebird');var rs=require(_0xde4e('0x3'));var fs=require('fs');var db=require(_0xde4e('0x4'))['db'];var utils=require(_0xde4e('0x5'));var logger=require(_0xde4e('0x6'))(_0xde4e('0x7'));var config=require(_0xde4e('0x8'));var jayson=require(_0xde4e('0x9'));var client=jayson[_0xde4e('0xa')][_0xde4e('0xb')]({'port':0x232a});var socket=require(_0xde4e('0xc'))({'host':'localhost','port':0x18eb});require(_0xde4e('0xd'))[_0xde4e('0xe')](socket);function respondWithRpcPromise(_0x3de0c6,_0x3b4ff5,_0x379e5c){return new BPromise(function(_0x216fc8,_0x2c16b6){return client['request'](_0x3de0c6,_0x379e5c)[_0xde4e('0xf')](function(_0x41b9e7){logger[_0xde4e('0x10')]('MailMessage,\x20%s,\x20%s',_0x3b4ff5,_0xde4e('0x11'));logger[_0xde4e('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3b4ff5,_0xde4e('0x11'),JSON[_0xde4e('0x13')](_0x41b9e7));if(_0x41b9e7[_0xde4e('0x14')]){if(_0x41b9e7['error'][_0xde4e('0x15')]===0x1f4){logger[_0xde4e('0x14')](_0xde4e('0x16'),_0x3b4ff5,_0x41b9e7[_0xde4e('0x14')]['message']);return _0x2c16b6(_0x41b9e7[_0xde4e('0x14')][_0xde4e('0x17')]);}logger[_0xde4e('0x14')](_0xde4e('0x16'),_0x3b4ff5,_0x41b9e7[_0xde4e('0x14')]['message']);return _0x216fc8(_0x41b9e7[_0xde4e('0x14')][_0xde4e('0x17')]);}else{logger['info'](_0xde4e('0x16'),_0x3b4ff5,'request\x20sent');_0x216fc8(_0x41b9e7[_0xde4e('0x18')][_0xde4e('0x17')]);}})['catch'](function(_0x82b7f){logger[_0xde4e('0x14')](_0xde4e('0x16'),_0x3b4ff5,_0x82b7f);_0x2c16b6(_0x82b7f);});});}exports[_0xde4e('0x19')]=function(_0x4e55e6){var _0x60b142=this;return new Promise(function(_0x245f5f,_0x5971f2){return db[_0xde4e('0x1a')][_0xde4e('0x1b')](_0x4e55e6[_0xde4e('0x1c')],{'raw':_0x4e55e6[_0xde4e('0x1d')]?_0x4e55e6['options']['raw']===undefined?!![]:![]:!![]})[_0xde4e('0xf')](function(_0x3a6c85){logger[_0xde4e('0x10')](_0xde4e('0x19'),_0x4e55e6);logger[_0xde4e('0x12')](_0xde4e('0x19'),_0x4e55e6,JSON['stringify'](_0x3a6c85));_0x245f5f(_0x3a6c85);})['catch'](function(_0x34e057){logger['error'](_0xde4e('0x19'),_0x34e057[_0xde4e('0x17')],_0x4e55e6);_0x5971f2(_0x60b142[_0xde4e('0x14')](0x1f4,_0x34e057[_0xde4e('0x17')]));});});}; \ No newline at end of file +var _0x6ccf=['util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','localhost','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch','body','options','then','CreateMailMessage'];(function(_0x1e93fa,_0x210f48){var _0xd4e1e6=function(_0x3149da){while(--_0x3149da){_0x1e93fa['push'](_0x1e93fa['shift']());}};_0xd4e1e6(++_0x210f48);}(_0x6ccf,0xa8));var _0xf6cc=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x6ccf[_0x218972];return _0x1bb1a8;};'use strict';var _=require('lodash');var util=require(_0xf6cc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf6cc('0x1'));var fs=require('fs');var db=require(_0xf6cc('0x2'))['db'];var utils=require(_0xf6cc('0x3'));var logger=require(_0xf6cc('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf6cc('0x5'));var client=jayson[_0xf6cc('0x6')]['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xf6cc('0x7'),'port':0x18eb});require('./mailMessage.socket')[_0xf6cc('0x8')](socket);function respondWithRpcPromise(_0x579bbe,_0x23fbef,_0x3123f6){return new BPromise(function(_0x5940b3,_0x294a88){return client[_0xf6cc('0x9')](_0x579bbe,_0x3123f6)['then'](function(_0x38d68b){logger[_0xf6cc('0xa')](_0xf6cc('0xb'),_0x23fbef,_0xf6cc('0xc'));logger[_0xf6cc('0xd')](_0xf6cc('0xe'),_0x23fbef,_0xf6cc('0xc'),JSON[_0xf6cc('0xf')](_0x38d68b));if(_0x38d68b[_0xf6cc('0x10')]){if(_0x38d68b[_0xf6cc('0x10')]['code']===0x1f4){logger[_0xf6cc('0x10')](_0xf6cc('0xb'),_0x23fbef,_0x38d68b[_0xf6cc('0x10')]['message']);return _0x294a88(_0x38d68b['error']['message']);}logger[_0xf6cc('0x10')]('MailMessage,\x20%s,\x20%s',_0x23fbef,_0x38d68b[_0xf6cc('0x10')]['message']);return _0x5940b3(_0x38d68b['error']['message']);}else{logger[_0xf6cc('0xa')](_0xf6cc('0xb'),_0x23fbef,_0xf6cc('0xc'));_0x5940b3(_0x38d68b[_0xf6cc('0x11')][_0xf6cc('0x12')]);}})[_0xf6cc('0x13')](function(_0x35099e){logger['error'](_0xf6cc('0xb'),_0x23fbef,_0x35099e);_0x294a88(_0x35099e);});});}exports['CreateMailMessage']=function(_0x5bcbd4){var _0x8e7af8=this;return new Promise(function(_0x385b41,_0x2225f6){return db['MailMessage']['create'](_0x5bcbd4[_0xf6cc('0x14')],{'raw':_0x5bcbd4['options']?_0x5bcbd4[_0xf6cc('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xf6cc('0x16')](function(_0x5e3c28){logger['info'](_0xf6cc('0x17'),_0x5bcbd4);logger[_0xf6cc('0xd')](_0xf6cc('0x17'),_0x5bcbd4,JSON[_0xf6cc('0xf')](_0x5e3c28));_0x385b41(_0x5e3c28);})[_0xf6cc('0x13')](function(_0x260565){logger[_0xf6cc('0x10')](_0xf6cc('0x17'),_0x260565['message'],_0x5bcbd4);_0x2225f6(_0x8e7af8[_0xf6cc('0x10')](0x1f4,_0x260565[_0xf6cc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9a05665..18423dc 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 _0x1e4c=['register','length','mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x52acf9,_0x57eb0d){var _0x208226=function(_0x2c8e53){while(--_0x2c8e53){_0x52acf9['push'](_0x52acf9['shift']());}};_0x208226(++_0x57eb0d);}(_0x1e4c,0x1bc));var _0xc1e4=function(_0x187125,_0x9aee01){_0x187125=_0x187125-0x0;var _0x3cf146=_0x1e4c[_0x187125];return _0x3cf146;};'use strict';var MailMessageEvents=require(_0xc1e4('0x0'));var events=[_0xc1e4('0x1'),_0xc1e4('0x2'),'update'];function createListener(_0x39684e,_0x5c53f4){return function(_0x5bb46c){_0x5c53f4[_0xc1e4('0x3')](_0x39684e,_0x5bb46c);};}function removeListener(_0xc7626b,_0x40d6fe){return function(){MailMessageEvents['removeListener'](_0xc7626b,_0x40d6fe);};}exports[_0xc1e4('0x4')]=function(_0x1473e8){for(var _0x19acea=0x0,_0x209a2e=events[_0xc1e4('0x5')];_0x19acea<_0x209a2e;_0x19acea++){var _0x4bf7d0=events[_0x19acea];var _0x3a5ec4=createListener(_0xc1e4('0x6')+_0x4bf7d0,_0x1473e8);MailMessageEvents['on'](_0x4bf7d0,_0x3a5ec4);}}; \ No newline at end of file +var _0xc2bb=['mailMessage:','./mailMessage.events','remove','emit','removeListener'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xc2bb,0x137));var _0xbc2b=function(_0x5826da,_0x4ffb7f){_0x5826da=_0x5826da-0x0;var _0x127236=_0xc2bb[_0x5826da];return _0x127236;};'use strict';var MailMessageEvents=require(_0xbc2b('0x0'));var events=['save',_0xbc2b('0x1'),'update'];function createListener(_0x2d4f04,_0x13f88a){return function(_0x5e27a8){_0x13f88a[_0xbc2b('0x2')](_0x2d4f04,_0x5e27a8);};}function removeListener(_0x1d6a10,_0x4f4a6b){return function(){MailMessageEvents[_0xbc2b('0x3')](_0x1d6a10,_0x4f4a6b);};}exports['register']=function(_0x507b5b){for(var _0x37b777=0x0,_0x2fbf10=events['length'];_0x37b777<_0x2fbf10;_0x37b777++){var _0x334820=events[_0x37b777];var _0x446583=createListener(_0xbc2b('0x4')+_0x334820,_0x507b5b);MailMessageEvents['on'](_0x334820,_0x446583);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ea5bedc..7c90cc3 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 _0x2b70=['describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','/:id','destroy','delete','removeTeams','removeAgents','exports','util','express','Router','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get'];(function(_0x45381a,_0x919a91){var _0x2ef7dd=function(_0x3ec8ec){while(--_0x3ec8ec){_0x45381a['push'](_0x45381a['shift']());}};_0x2ef7dd(++_0x919a91);}(_0x2b70,0xc0));var _0x02b7=function(_0x543429,_0x140390){_0x543429=_0x543429-0x0;var _0x112a46=_0x2b70[_0x543429];return _0x112a46;};'use strict';var multer=require('multer');var util=require(_0x02b7('0x0'));var path=require('path');var express=require(_0x02b7('0x1'));var router=express[_0x02b7('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x02b7('0x3'));var config=require('../../config/environment');var controller=require(_0x02b7('0x4'));router['get']('/',auth[_0x02b7('0x5')](),controller[_0x02b7('0x6')]);router[_0x02b7('0x7')]('/describe',auth[_0x02b7('0x5')](),controller[_0x02b7('0x8')]);router[_0x02b7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x02b7('0x9')]);router[_0x02b7('0x7')](_0x02b7('0xa'),auth[_0x02b7('0x5')](),controller[_0x02b7('0xb')]);router[_0x02b7('0x7')](_0x02b7('0xc'),auth['isAuthenticated'](),controller[_0x02b7('0xd')]);router[_0x02b7('0x7')]('/:id/users',auth[_0x02b7('0x5')](),controller[_0x02b7('0xe')]);router['post']('/',auth[_0x02b7('0x5')](),controller[_0x02b7('0xf')]);router[_0x02b7('0x10')](_0x02b7('0xc'),auth['isAuthenticated'](),controller[_0x02b7('0x11')]);router['post'](_0x02b7('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x02b7('0x13'),auth[_0x02b7('0x5')](),controller['update']);router['delete'](_0x02b7('0x13'),auth[_0x02b7('0x5')](),controller[_0x02b7('0x14')]);router[_0x02b7('0x15')](_0x02b7('0xc'),auth[_0x02b7('0x5')](),controller[_0x02b7('0x16')]);router[_0x02b7('0x15')](_0x02b7('0x12'),auth[_0x02b7('0x5')](),controller[_0x02b7('0x17')]);module[_0x02b7('0x18')]=router; \ No newline at end of file +var _0x61e2=['./mailQueue.controller','get','index','isAuthenticated','/:id','getMembers','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeAgents','exports','multer','util','path','../../components/auth/service','../../components/interaction/service'];(function(_0x50a674,_0x4af4d1){var _0x497f7a=function(_0x1927bb){while(--_0x1927bb){_0x50a674['push'](_0x50a674['shift']());}};_0x497f7a(++_0x4af4d1);}(_0x61e2,0xeb));var _0x261e=function(_0x44a905,_0x5e7c9a){_0x44a905=_0x44a905-0x0;var _0x2671fd=_0x61e2[_0x44a905];return _0x2671fd;};'use strict';var multer=require(_0x261e('0x0'));var util=require(_0x261e('0x1'));var path=require(_0x261e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x261e('0x3'));var interaction=require(_0x261e('0x4'));var config=require('../../config/environment');var controller=require(_0x261e('0x5'));router[_0x261e('0x6')]('/',auth['isAuthenticated'](),controller[_0x261e('0x7')]);router[_0x261e('0x6')]('/describe',auth[_0x261e('0x8')](),controller['describe']);router[_0x261e('0x6')](_0x261e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x261e('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0x261e('0xa')]);router['get']('/:id/teams',auth[_0x261e('0x8')](),controller[_0x261e('0xb')]);router['get'](_0x261e('0xc'),auth[_0x261e('0x8')](),controller['getAgents']);router[_0x261e('0xd')]('/',auth[_0x261e('0x8')](),controller[_0x261e('0xe')]);router[_0x261e('0xd')]('/:id/teams',auth[_0x261e('0x8')](),controller[_0x261e('0xf')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x261e('0x10')]);router[_0x261e('0x11')]('/:id',auth[_0x261e('0x8')](),controller[_0x261e('0x12')]);router[_0x261e('0x13')]('/:id',auth[_0x261e('0x8')](),controller[_0x261e('0x14')]);router[_0x261e('0x13')](_0x261e('0x15'),auth[_0x261e('0x8')](),controller['removeTeams']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x261e('0x16')]);module[_0x261e('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 3362c7d..6c14090 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 _0xf668=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x16895b,_0x14f953){var _0x20da1a=function(_0x4479fa){while(--_0x4479fa){_0x16895b['push'](_0x16895b['shift']());}};_0x20da1a(++_0x14f953);}(_0xf668,0x1bb));var _0x8f66=function(_0x51ba61,_0xeb329e){_0x51ba61=_0x51ba61-0x0;var _0x3246e4=_0xf668[_0x51ba61];return _0x3246e4;};'use strict';var Sequelize=require(_0x8f66('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f66('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8f66('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f66('0x3')](_0x8f66('0x4'),'beepall',_0x8f66('0x5'))}}; \ No newline at end of file +var _0x757c=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x492445,_0x1454f9){var _0x34ca20=function(_0x33e606){while(--_0x33e606){_0x492445['push'](_0x492445['shift']());}};_0x34ca20(++_0x1454f9);}(_0x757c,0x194));var _0xc757=function(_0x371dd5,_0x4b2377){_0x371dd5=_0x371dd5-0x0;var _0x2a9ec1=_0x757c[_0x371dd5];return _0x2a9ec1;};'use strict';var Sequelize=require(_0xc757('0x0'));module[_0xc757('0x1')]={'name':{'type':Sequelize[_0xc757('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc757('0x2')]},'timeout':{'type':Sequelize[_0xc757('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc757('0x4')](_0xc757('0x5'),'beepall',_0xc757('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 51e0d90..f6265ab 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 _0xda4e=['length','map','User','agent','mailPause','updatedAt','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','Agents','union','penalty','removeTeams','removeAgents','addAgents','spread','emit','isArray','userMailQueue:remove','getAgents','request-promise','bluebird','mustache','util','to-csv','lodash','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','./mailQueue.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','add','day','filter','merge','options','MailQueue','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','findOne','UserMailQueue'];(function(_0x3d395d,_0x13e7e3){var _0x43a280=function(_0x23f897){while(--_0x23f897){_0x3d395d['push'](_0x3d395d['shift']());}};_0x43a280(++_0x13e7e3);}(_0xda4e,0x76));var _0xeda4=function(_0x4873e7,_0xadd09b){_0x4873e7=_0x4873e7-0x0;var _0x589ef4=_0xda4e[_0x4873e7];return _0x589ef4;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xeda4('0x0'));var moment=require('moment');var BPromise=require(_0xeda4('0x1'));var Mustache=require(_0xeda4('0x2'));var util=require(_0xeda4('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xeda4('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeda4('0x5'));var squel=require('squel');var crypto=require(_0xeda4('0x6'));var jsforce=require('jsforce');var deskjs=require(_0xeda4('0x7'));var toCsv=require(_0xeda4('0x4'));var querystring=require('querystring');var Papa=require(_0xeda4('0x8'));var qs=require(_0xeda4('0x9'));var logger=require(_0xeda4('0xa'))(_0xeda4('0xb'));var utils=require(_0xeda4('0xc'));var config=require(_0xeda4('0xd'));var db=require(_0xeda4('0xe'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xeda4('0xf'))[_0xeda4('0x10')](socket);function respondWithStatusCode(_0x53065b,_0x125f34){_0x125f34=_0x125f34||0xcc;return function(_0x249bd3){if(_0x249bd3){return _0x53065b[_0xeda4('0x11')](_0x125f34);}return _0x53065b['status'](_0x125f34)['end']();};}function respondWithResult(_0x263def,_0x21f5f8){_0x21f5f8=_0x21f5f8||0xc8;return function(_0x4d4ea7){if(_0x4d4ea7){return _0x263def[_0xeda4('0x12')](_0x21f5f8)[_0xeda4('0x13')](_0x4d4ea7);}};}function respondWithFilteredResult(_0x5c80e2,_0x341d87){return function(_0x369a2d){if(_0x369a2d){var _0x2550d4=_0x369a2d[_0xeda4('0x14')],_0x43d41b=_0x341d87[_0xeda4('0x15')],_0xa75bb1=_0x341d87[_0xeda4('0x15')]+_0x341d87['limit'],_0xd93777;if(_0xa75bb1>=_0x2550d4){_0xa75bb1=_0x2550d4;_0xd93777=0xc8;}else{_0xd93777=0xce;}_0x5c80e2[_0xeda4('0x12')](_0xd93777);return _0x5c80e2[_0xeda4('0x16')](_0xeda4('0x17'),_0x43d41b+'-'+_0xa75bb1+'/'+_0x2550d4)[_0xeda4('0x13')](_0x369a2d);}return null;};}function patchUpdates(_0x586351){return function(_0x45f69d){try{jsonpatch[_0xeda4('0x18')](_0x45f69d,_0x586351,!![]);}catch(_0x14e036){return BPromise[_0xeda4('0x19')](_0x14e036);}return _0x45f69d['save']();};}function saveUpdates(_0x136509,_0x19f68b){return function(_0x1b09dc){if(_0x1b09dc){return _0x1b09dc[_0xeda4('0x1a')](_0x136509)[_0xeda4('0x1b')](function(_0x40d048){return _0x40d048;});}return null;};}function removeEntity(_0x31e914,_0x47627){return function(_0x45380e){if(_0x45380e){return _0x45380e[_0xeda4('0x1c')]()['then'](function(){_0x31e914[_0xeda4('0x12')](0xcc)[_0xeda4('0x1d')]();});}};}function handleEntityNotFound(_0x3885a2,_0x1b2b63){return function(_0x5d746f){if(!_0x5d746f){_0x3885a2['sendStatus'](0x194);}return _0x5d746f;};}function handleError(_0x6d4ff5,_0x38f79a){_0x38f79a=_0x38f79a||0x1f4;return function(_0x2d7a38){logger['error'](_0x2d7a38[_0xeda4('0x1e')]);if(_0x2d7a38['name']){delete _0x2d7a38[_0xeda4('0x1f')];}_0x6d4ff5['status'](_0x38f79a)[_0xeda4('0x20')](_0x2d7a38);};}exports[_0xeda4('0x21')]=function(_0x17c679,_0x2aab55){var _0x136955={},_0x4f5245={},_0x3c4252={'count':0x0,'rows':[]};var _0x4916b6=db['MailQueue'][_0xeda4('0x22')];_0x4f5245[_0xeda4('0x23')]=_[_0xeda4('0x24')](_0x4916b6);var _0x5895d2={'dateStart':_0x17c679[_0xeda4('0x25')][_0xeda4('0x26')],'dateEnd':_0x17c679[_0xeda4('0x25')][_0xeda4('0x27')]};delete _0x17c679['query'][_0xeda4('0x26')];delete _0x17c679[_0xeda4('0x25')][_0xeda4('0x27')];_0x4f5245[_0xeda4('0x25')]=_[_0xeda4('0x24')](_0x17c679[_0xeda4('0x25')]);_0x4f5245['filters']=_[_0xeda4('0x28')](_0x4f5245[_0xeda4('0x23')],_0x4f5245['query']);_0x136955[_0xeda4('0x29')]=_['intersection'](_0x4f5245[_0xeda4('0x23')],qs['fields'](_0x17c679['query'][_0xeda4('0x2a')]));_0x136955[_0xeda4('0x29')]=_0x136955['attributes']['length']?_0x136955[_0xeda4('0x29')]:_0x4f5245['model'];if(!_0x17c679[_0xeda4('0x25')][_0xeda4('0x2b')](_0xeda4('0x2c'))){_0x136955[_0xeda4('0x2d')]=qs[_0xeda4('0x2d')](_0x17c679[_0xeda4('0x25')][_0xeda4('0x2d')]);_0x136955[_0xeda4('0x15')]=qs[_0xeda4('0x15')](_0x17c679[_0xeda4('0x25')][_0xeda4('0x15')]);}_0x136955[_0xeda4('0x2e')]=qs['sort'](_0x17c679[_0xeda4('0x25')][_0xeda4('0x2f')]);_0x136955[_0xeda4('0x30')]=qs[_0xeda4('0x31')](_[_0xeda4('0x32')](_0x17c679[_0xeda4('0x25')],_0x4f5245[_0xeda4('0x31')]));if(_0x5895d2[_0xeda4('0x26')]){if(_0x5895d2[_0xeda4('0x27')]){_0x5895d2[_0xeda4('0x27')]=moment(_0x5895d2['dateEnd'])[_0xeda4('0x33')](0x1,'day');}else{_0x5895d2['dateEnd']=moment(_0x5895d2[_0xeda4('0x26')])[_0xeda4('0x33')](0x1,_0xeda4('0x34'));}_['merge'](_0x136955[_0xeda4('0x30')],{'createdAt':{'$gte':_0x5895d2[_0xeda4('0x26')],'$lte':_0x5895d2[_0xeda4('0x27')]}});}if(_0x17c679[_0xeda4('0x25')][_0xeda4('0x35')]){_0x136955[_0xeda4('0x30')]=_[_0xeda4('0x36')](_0x136955['where'],{'$or':_['map'](_0x136955[_0xeda4('0x29')],function(_0x2608b6){var _0x787f50={};_0x787f50[_0x2608b6]={'$like':'%'+_0x17c679[_0xeda4('0x25')][_0xeda4('0x35')]+'%'};return _0x787f50;})});}_0x136955=_[_0xeda4('0x36')]({},_0x136955,_0x17c679[_0xeda4('0x37')]);var _0x2e9bfe={'where':_0x136955[_0xeda4('0x30')]};return db[_0xeda4('0x38')][_0xeda4('0x14')](_0x2e9bfe)[_0xeda4('0x1b')](function(_0x18dfad){_0x3c4252[_0xeda4('0x14')]=_0x18dfad;if(_0x17c679['query'][_0xeda4('0x39')]){_0x136955[_0xeda4('0x3a')]=[{'all':!![]}];}return db[_0xeda4('0x38')][_0xeda4('0x3b')](_0x136955);})['then'](function(_0x36c220){_0x3c4252[_0xeda4('0x3c')]=_0x36c220;return _0x3c4252;})[_0xeda4('0x1b')](respondWithFilteredResult(_0x2aab55,_0x136955))[_0xeda4('0x3d')](handleError(_0x2aab55,null));};exports[_0xeda4('0x3e')]=function(_0x1b42c6,_0x464286){var _0x1a7b6d={'raw':!![],'where':{'id':_0x1b42c6[_0xeda4('0x3f')]['id']}},_0x16b7c2={};_0x16b7c2[_0xeda4('0x23')]=_[_0xeda4('0x24')](db[_0xeda4('0x38')][_0xeda4('0x22')]);_0x16b7c2[_0xeda4('0x25')]=_[_0xeda4('0x24')](_0x1b42c6[_0xeda4('0x25')]);_0x16b7c2[_0xeda4('0x31')]=_[_0xeda4('0x28')](_0x16b7c2[_0xeda4('0x23')],_0x16b7c2[_0xeda4('0x25')]);_0x1a7b6d['attributes']=_[_0xeda4('0x28')](_0x16b7c2[_0xeda4('0x23')],qs[_0xeda4('0x2a')](_0x1b42c6[_0xeda4('0x25')][_0xeda4('0x2a')]));_0x1a7b6d[_0xeda4('0x29')]=_0x1a7b6d['attributes']['length']?_0x1a7b6d[_0xeda4('0x29')]:_0x16b7c2[_0xeda4('0x23')];if(_0x1b42c6[_0xeda4('0x25')][_0xeda4('0x39')]){_0x1a7b6d[_0xeda4('0x3a')]=[{'all':!![]}];}_0x1a7b6d=_[_0xeda4('0x36')]({},_0x1a7b6d,_0x1b42c6[_0xeda4('0x37')]);return db[_0xeda4('0x38')][_0xeda4('0x40')](_0x1a7b6d)[_0xeda4('0x1b')](handleEntityNotFound(_0x464286,null))[_0xeda4('0x1b')](respondWithResult(_0x464286,null))[_0xeda4('0x3d')](handleError(_0x464286,null));};exports[_0xeda4('0x41')]=function(_0xdaecdf,_0x939a5f){return db[_0xeda4('0x38')][_0xeda4('0x41')](_0xdaecdf['body'],{})[_0xeda4('0x1b')](respondWithResult(_0x939a5f,0xc9))[_0xeda4('0x3d')](handleError(_0x939a5f,null));};exports[_0xeda4('0x1a')]=function(_0x4cb27b,_0x49e5f6){if(_0x4cb27b[_0xeda4('0x42')]['id']){delete _0x4cb27b[_0xeda4('0x42')]['id'];}return db['MailQueue'][_0xeda4('0x40')]({'where':{'id':_0x4cb27b[_0xeda4('0x3f')]['id']}})[_0xeda4('0x1b')](handleEntityNotFound(_0x49e5f6,null))[_0xeda4('0x1b')](saveUpdates(_0x4cb27b['body'],null))[_0xeda4('0x1b')](respondWithResult(_0x49e5f6,null))['catch'](handleError(_0x49e5f6,null));};exports[_0xeda4('0x1c')]=function(_0x104e95,_0xebec15){return db[_0xeda4('0x38')][_0xeda4('0x40')]({'where':{'id':_0x104e95[_0xeda4('0x3f')]['id']}})['then'](handleEntityNotFound(_0xebec15,null))[_0xeda4('0x1b')](removeEntity(_0xebec15,null))[_0xeda4('0x3d')](handleError(_0xebec15,null));};exports[_0xeda4('0x43')]=function(_0x5e08bd,_0x57d6c3){return db[_0xeda4('0x38')]['describe']()[_0xeda4('0x1b')](respondWithResult(_0x57d6c3,null))[_0xeda4('0x3d')](handleError(_0x57d6c3,null));};exports['getMembers']=function(_0x5de2a1,_0x159c38,_0x2dae44){var _0x1d4466={'raw':!![],'where':{}},_0x5e1d2a={},_0x31705;return db[_0xeda4('0x38')][_0xeda4('0x44')]({'where':{'id':_0x5de2a1[_0xeda4('0x3f')]['id']}})[_0xeda4('0x1b')](handleEntityNotFound(_0x159c38,null))['then'](function(_0x4948d0){if(_0x4948d0){_0x31705=_0x4948d0['get']({'plain':!![]});_0x5e1d2a[_0xeda4('0x23')]=_['keys'](db[_0xeda4('0x45')][_0xeda4('0x22')]);_0x5e1d2a[_0xeda4('0x25')]=_['keys'](_0x5de2a1[_0xeda4('0x25')]);_0x5e1d2a[_0xeda4('0x31')]=_[_0xeda4('0x28')](_0x5e1d2a[_0xeda4('0x23')],_0x5e1d2a[_0xeda4('0x25')]);_0x1d4466[_0xeda4('0x29')]=_[_0xeda4('0x28')](_0x5e1d2a[_0xeda4('0x23')],qs['fields'](_0x5de2a1[_0xeda4('0x25')]['fields']));_0x1d4466[_0xeda4('0x29')]=_0x1d4466[_0xeda4('0x29')][_0xeda4('0x46')]?_0x1d4466[_0xeda4('0x29')]:_0x5e1d2a[_0xeda4('0x23')];if(!_0x5de2a1[_0xeda4('0x25')]['hasOwnProperty'](_0xeda4('0x2c'))){_0x1d4466[_0xeda4('0x2d')]=qs[_0xeda4('0x2d')](_0x5de2a1[_0xeda4('0x25')][_0xeda4('0x2d')]);_0x1d4466['offset']=qs[_0xeda4('0x15')](_0x5de2a1[_0xeda4('0x25')]['offset']);}_0x1d4466[_0xeda4('0x2e')]=qs['sort'](_0x5de2a1[_0xeda4('0x25')][_0xeda4('0x2f')]);_0x1d4466[_0xeda4('0x30')]=qs[_0xeda4('0x31')](_[_0xeda4('0x32')](_0x5de2a1[_0xeda4('0x25')],_0x5e1d2a[_0xeda4('0x31')]));_0x1d4466['where']['MailQueueId']=_0x4948d0['id'];if(_0x5de2a1[_0xeda4('0x25')][_0xeda4('0x35')]){_0x1d4466[_0xeda4('0x30')]=_[_0xeda4('0x36')](_0x1d4466['where'],{'$or':_[_0xeda4('0x47')](_0x1d4466[_0xeda4('0x29')],function(_0x71b7f0){var _0x1b472c={};_0x1b472c[_0x71b7f0]={'$like':'%'+_0x5de2a1[_0xeda4('0x25')]['filter']+'%'};return _0x1b472c;})});}_0x1d4466=_[_0xeda4('0x36')]({},_0x1d4466,_0x5de2a1[_0xeda4('0x37')]);return db['UserMailQueue']['findAll'](_0x1d4466);}})[_0xeda4('0x1b')](function(_0x1b5f92){if(_0x1b5f92){return db[_0xeda4('0x48')]['findAndCountAll']({'where':{'id':_[_0xeda4('0x47')](_0x1b5f92,'UserId'),'role':_0xeda4('0x49')},'attributes':['id',_0xeda4('0x1f'),_0xeda4('0x4a'),_0xeda4('0x4b'),'createdAt']});}})[_0xeda4('0x1b')](function(_0x29f60c){if(_0x29f60c){return{'count':_0x29f60c[_0xeda4('0x14')],'rows':_[_0xeda4('0x47')](_0x29f60c[_0xeda4('0x3c')],function(_0x2d931d){return{'membername':_0x2d931d[_0xeda4('0x1f')],'UserId':_0x2d931d['id'],'queue_name':_0x31705[_0xeda4('0x1f')],'MailQueueId':_0x31705['id'],'interface':util['format'](_0xeda4('0x4c'),_0xeda4('0x4d'),_0x2d931d['name']),'penalty':0x0,'paused':_0x2d931d[_0xeda4('0x4a')],'createdAt':_0x2d931d[_0xeda4('0x4e')],'updatedAt':_0x2d931d[_0xeda4('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xeda4('0x1b')](respondWithFilteredResult(_0x159c38,_0x1d4466))[_0xeda4('0x3d')](handleError(_0x159c38,null));};exports['getTeams']=function(_0x143a5a,_0x35dd23,_0x212a4e){var _0x4bf449={};var _0x261b2c={};var _0x352912;var _0x558979;return db[_0xeda4('0x38')][_0xeda4('0x44')]({'where':{'id':_0x143a5a['params']['id']}})[_0xeda4('0x1b')](handleEntityNotFound(_0x35dd23,null))[_0xeda4('0x1b')](function(_0x50028e){if(_0x50028e){_0x352912=_0x50028e;_0x261b2c[_0xeda4('0x23')]=_[_0xeda4('0x24')](db[_0xeda4('0x4f')]['rawAttributes']);_0x261b2c[_0xeda4('0x25')]=_['keys'](_0x143a5a[_0xeda4('0x25')]);_0x261b2c[_0xeda4('0x31')]=_[_0xeda4('0x28')](_0x261b2c[_0xeda4('0x23')],_0x261b2c[_0xeda4('0x25')]);_0x4bf449[_0xeda4('0x29')]=_[_0xeda4('0x28')](_0x261b2c['model'],qs[_0xeda4('0x2a')](_0x143a5a[_0xeda4('0x25')]['fields']));_0x4bf449[_0xeda4('0x29')]=_0x4bf449['attributes'][_0xeda4('0x46')]?_0x4bf449[_0xeda4('0x29')]:_0x261b2c[_0xeda4('0x23')];_0x4bf449[_0xeda4('0x2e')]=qs[_0xeda4('0x2f')](_0x143a5a['query']['sort']);_0x4bf449[_0xeda4('0x30')]=qs[_0xeda4('0x31')](_['pick'](_0x143a5a['query'],_0x261b2c[_0xeda4('0x31')]));if(_0x143a5a[_0xeda4('0x25')]['filter']){_0x4bf449[_0xeda4('0x30')]=_[_0xeda4('0x36')](_0x4bf449[_0xeda4('0x30')],{'$or':_['map'](_0x4bf449[_0xeda4('0x29')],function(_0x3c5a53){var _0x20c6f9={};_0x20c6f9[_0x3c5a53]={'$like':'%'+_0x143a5a[_0xeda4('0x25')][_0xeda4('0x35')]+'%'};return _0x20c6f9;})});}_0x4bf449=_[_0xeda4('0x36')]({},_0x4bf449,_0x143a5a[_0xeda4('0x37')]);return _0x352912[_0xeda4('0x50')](_0x4bf449);}})[_0xeda4('0x1b')](function(_0x2ee597){if(_0x2ee597){_0x558979=_0x2ee597[_0xeda4('0x46')];if(!_0x143a5a['query'][_0xeda4('0x2b')](_0xeda4('0x2c'))){_0x4bf449[_0xeda4('0x2d')]=qs[_0xeda4('0x2d')](_0x143a5a[_0xeda4('0x25')][_0xeda4('0x2d')]);_0x4bf449[_0xeda4('0x15')]=qs[_0xeda4('0x15')](_0x143a5a['query'][_0xeda4('0x15')]);}return _0x352912[_0xeda4('0x50')](_0x4bf449);}})[_0xeda4('0x1b')](function(_0x3a5ee4){if(_0x3a5ee4){return _0x3a5ee4?{'count':_0x558979,'rows':_0x3a5ee4}:null;}})['then'](respondWithResult(_0x35dd23,null))['catch'](handleError(_0x35dd23,null));};exports[_0xeda4('0x51')]=function(_0x5b66b3,_0x4e98a9,_0x491cc4){var _0x1a30cf=[];var _0x2fbcfe;return db[_0xeda4('0x4f')][_0xeda4('0x3b')]({'where':{'id':_0x5b66b3['body'][_0xeda4('0x52')]},'attributes':['id'],'include':[{'model':db[_0xeda4('0x48')],'as':_0xeda4('0x53'),'attributes':['id'],'raw':!![]}]})[_0xeda4('0x1b')](function(_0x34b81c){if(_0x34b81c){for(var _0x46c9df=0x0;_0x46c9df<_0x34b81c['length'];_0x46c9df+=0x1){for(var _0x5187d2=0x0;_0x5187d2<_0x34b81c[_0x46c9df][_0xeda4('0x53')][_0xeda4('0x46')];_0x5187d2+=0x1){_0x1a30cf=_[_0xeda4('0x54')](_0x1a30cf,[_0x34b81c[_0x46c9df][_0xeda4('0x53')][_0x5187d2]['id']]);}}return _0x1a30cf;}})[_0xeda4('0x1b')](function(_0x409346){if(_0x409346){return db[_0xeda4('0x38')]['find']({'where':{'id':_0x5b66b3[_0xeda4('0x3f')]['id']}});}})[_0xeda4('0x1b')](function(_0x48e75f){if(_0x48e75f){_0x2fbcfe=_0x48e75f;return _0x2fbcfe['addAgents'](_0x1a30cf,{'penalty':_0x5b66b3[_0xeda4('0x42')][_0xeda4('0x55')]});}})['then'](function(_0x57e628){if(_0x57e628){return _0x2fbcfe[_0xeda4('0x51')](_0x5b66b3[_0xeda4('0x42')]['ids']);}})['then'](handleEntityNotFound(_0x4e98a9,null))['then'](respondWithStatusCode(_0x4e98a9,null))['catch'](handleError(_0x4e98a9,null));};exports[_0xeda4('0x56')]=function(_0x32a459,_0x1f7da6,_0x2d2587){var _0x8dc37a=[];var _0xd5fee5;return db[_0xeda4('0x4f')]['findAll']({'where':{'id':_0x32a459[_0xeda4('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeda4('0x48')],'as':_0xeda4('0x53'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x529f53){if(_0x529f53){for(var _0x3f781c=0x0;_0x3f781c<_0x529f53[_0xeda4('0x46')];_0x3f781c+=0x1){for(var _0x45a0f4=0x0;_0x45a0f4<_0x529f53[_0x3f781c][_0xeda4('0x53')]['length'];_0x45a0f4+=0x1){_0x8dc37a=_['union'](_0x8dc37a,[_0x529f53[_0x3f781c][_0xeda4('0x53')][_0x45a0f4]['id']]);}}return _0x8dc37a;}})['then'](function(_0x4ce5fc){if(_0x4ce5fc){return db['MailQueue']['find']({'where':{'id':_0x32a459['params']['id']}});}})[_0xeda4('0x1b')](function(_0xd65b08){if(_0xd65b08){_0xd5fee5=_0xd65b08;return _0xd5fee5[_0xeda4('0x57')](_0x8dc37a);}})[_0xeda4('0x1b')](function(_0x5a4d16){if(_0xd5fee5){return _0xd5fee5[_0xeda4('0x56')](_0x32a459['query'][_0xeda4('0x52')]);}})['then'](handleEntityNotFound(_0x1f7da6,null))['then'](respondWithStatusCode(_0x1f7da6,null))[_0xeda4('0x3d')](handleError(_0x1f7da6,null));};exports[_0xeda4('0x58')]=function(_0x1f7085,_0x199042,_0x21d14d){return db[_0xeda4('0x38')][_0xeda4('0x40')]({'where':{'id':_0x1f7085['params']['id']}})['then'](handleEntityNotFound(_0x199042,null))[_0xeda4('0x1b')](function(_0x32781e){if(_0x32781e){return _0x32781e['addAgents'](_0x1f7085['body'][_0xeda4('0x52')],_['omit'](_0x1f7085[_0xeda4('0x42')],['ids','id'])||{})[_0xeda4('0x59')](function(_0x571966){for(var _0xf965=0x0;_0xf965<_0x1f7085[_0xeda4('0x42')][_0xeda4('0x52')][_0xeda4('0x46')];_0xf965+=0x1){socket[_0xeda4('0x5a')]('userMailQueue:save',{'UserId':_0x1f7085[_0xeda4('0x42')][_0xeda4('0x52')][_0xf965],'MailQueueId':_0x1f7085[_0xeda4('0x3f')]['id']});}return _0x571966;});}})[_0xeda4('0x1b')](respondWithResult(_0x199042,null))[_0xeda4('0x3d')](handleError(_0x199042,null));};exports['removeAgents']=function(_0x65a797,_0x190ba4,_0x73212e){var _0x15f981;return db[_0xeda4('0x38')][_0xeda4('0x40')]({'where':{'id':_0x65a797[_0xeda4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x190ba4,null))[_0xeda4('0x1b')](function(_0x447199){if(_0x447199){return _0x447199[_0xeda4('0x57')](_0x65a797[_0xeda4('0x25')]['ids'])[_0xeda4('0x1b')](function(_0x177c31){if(_[_0xeda4('0x5b')](_0x65a797[_0xeda4('0x25')][_0xeda4('0x52')])){for(var _0x46b743=0x0;_0x46b743<_0x65a797['query']['ids'][_0xeda4('0x46')];_0x46b743+=0x1){socket[_0xeda4('0x5a')]('userMailQueue:remove',{'UserId':_0x65a797[_0xeda4('0x25')][_0xeda4('0x52')][_0x46b743],'MailQueueId':_0x65a797[_0xeda4('0x3f')]['id']});}}else{socket[_0xeda4('0x5a')](_0xeda4('0x5c'),{'UserId':_0x65a797['query'][_0xeda4('0x52')],'MailQueueId':_0x65a797['params']['id']});}});}})[_0xeda4('0x1b')](respondWithStatusCode(_0x190ba4,null))['catch'](handleError(_0x190ba4,null));};exports['getAgents']=function(_0x314bea,_0x25f17f,_0x1d24dd){var _0x3caa4f={};var _0x35937c={};var _0x3a3935;var _0x536b6c;return db[_0xeda4('0x38')]['findOne']({'where':{'id':_0x314bea['params']['id']}})[_0xeda4('0x1b')](handleEntityNotFound(_0x25f17f,null))['then'](function(_0x40df4e){if(_0x40df4e){_0x3a3935=_0x40df4e;_0x35937c[_0xeda4('0x23')]=_[_0xeda4('0x24')](db[_0xeda4('0x48')][_0xeda4('0x22')]);_0x35937c['query']=_[_0xeda4('0x24')](_0x314bea['query']);_0x35937c['filters']=_[_0xeda4('0x28')](_0x35937c[_0xeda4('0x23')],_0x35937c[_0xeda4('0x25')]);_0x3caa4f['attributes']=_[_0xeda4('0x28')](_0x35937c[_0xeda4('0x23')],qs[_0xeda4('0x2a')](_0x314bea[_0xeda4('0x25')]['fields']));_0x3caa4f[_0xeda4('0x29')]=_0x3caa4f['attributes'][_0xeda4('0x46')]?_0x3caa4f['attributes']:_0x35937c[_0xeda4('0x23')];_0x3caa4f[_0xeda4('0x2e')]=qs[_0xeda4('0x2f')](_0x314bea[_0xeda4('0x25')]['sort']);_0x3caa4f[_0xeda4('0x30')]=qs['filters'](_[_0xeda4('0x32')](_0x314bea[_0xeda4('0x25')],_0x35937c[_0xeda4('0x31')]));if(_0x314bea[_0xeda4('0x25')][_0xeda4('0x35')]){_0x3caa4f[_0xeda4('0x30')]=_[_0xeda4('0x36')](_0x3caa4f[_0xeda4('0x30')],{'$or':_[_0xeda4('0x47')](_0x3caa4f[_0xeda4('0x29')],function(_0x1dcb91){var _0x5b75ba={};_0x5b75ba[_0x1dcb91]={'$like':'%'+_0x314bea['query']['filter']+'%'};return _0x5b75ba;})});}_0x3caa4f=_[_0xeda4('0x36')]({},_0x3caa4f,_0x314bea[_0xeda4('0x37')]);return _0x3a3935[_0xeda4('0x5d')](_0x3caa4f);}})[_0xeda4('0x1b')](function(_0x4274a5){if(_0x4274a5){_0x536b6c=_0x4274a5[_0xeda4('0x46')];if(!_0x314bea[_0xeda4('0x25')][_0xeda4('0x2b')](_0xeda4('0x2c'))){_0x3caa4f[_0xeda4('0x2d')]=qs['limit'](_0x314bea[_0xeda4('0x25')][_0xeda4('0x2d')]);_0x3caa4f[_0xeda4('0x15')]=qs[_0xeda4('0x15')](_0x314bea[_0xeda4('0x25')][_0xeda4('0x15')]);}return _0x3a3935['getAgents'](_0x3caa4f);}})[_0xeda4('0x1b')](function(_0x43336a){if(_0x43336a){return _0x43336a?{'count':_0x536b6c,'rows':_0x43336a}:null;}})[_0xeda4('0x1b')](respondWithResult(_0x25f17f,null))['catch'](handleError(_0x25f17f,null));}; \ No newline at end of file +var _0x12f4=['body','find','describe','findOne','get','UserMailQueue','MailQueueId','filter','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','User','Agents','union','penalty','removeAgents','ids','addAgents','omit','spread','userMailQueue:save','isArray','userMailQueue:remove','emit','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','map','options','MailQueue','count','includeAll','include','findAll','rows','catch','show','params','create'];(function(_0x166e5a,_0x8b0f57){var _0x5335cf=function(_0x2c87ea){while(--_0x2c87ea){_0x166e5a['push'](_0x166e5a['shift']());}};_0x5335cf(++_0x8b0f57);}(_0x12f4,0x15e));var _0x412f=function(_0xe85e0d,_0x4ba62a){_0xe85e0d=_0xe85e0d-0x0;var _0xa6258f=_0x12f4[_0xe85e0d];return _0xa6258f;};'use strict';var jsonpatch=require(_0x412f('0x0'));var rp=require(_0x412f('0x1'));var moment=require(_0x412f('0x2'));var BPromise=require(_0x412f('0x3'));var Mustache=require(_0x412f('0x4'));var util=require(_0x412f('0x5'));var path=require(_0x412f('0x6'));var sox=require(_0x412f('0x7'));var csv=require(_0x412f('0x8'));var ejs=require(_0x412f('0x9'));var fs=require('fs');var _=require(_0x412f('0xa'));var squel=require(_0x412f('0xb'));var crypto=require(_0x412f('0xc'));var jsforce=require(_0x412f('0xd'));var deskjs=require(_0x412f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x412f('0xf'));var qs=require(_0x412f('0x10'));var logger=require(_0x412f('0x11'))(_0x412f('0x12'));var utils=require(_0x412f('0x13'));var config=require(_0x412f('0x14'));var db=require(_0x412f('0x15'))['db'];var socket=require(_0x412f('0x16'))({'host':_0x412f('0x17'),'port':0x18eb});require('./mailQueue.socket')[_0x412f('0x18')](socket);function respondWithStatusCode(_0x2d614f,_0x16fc99){_0x16fc99=_0x16fc99||0xcc;return function(_0x1f9041){if(_0x1f9041){return _0x2d614f[_0x412f('0x19')](_0x16fc99);}return _0x2d614f[_0x412f('0x1a')](_0x16fc99)[_0x412f('0x1b')]();};}function respondWithResult(_0x35e066,_0x1cc4e1){_0x1cc4e1=_0x1cc4e1||0xc8;return function(_0xd1f388){if(_0xd1f388){return _0x35e066[_0x412f('0x1a')](_0x1cc4e1)['json'](_0xd1f388);}};}function respondWithFilteredResult(_0x4aa4c9,_0x51557c){return function(_0x3e5a8a){if(_0x3e5a8a){var _0x50f85d=_0x3e5a8a['count'],_0x3f3eb6=_0x51557c['offset'],_0x4b50d4=_0x51557c[_0x412f('0x1c')]+_0x51557c[_0x412f('0x1d')],_0x43aa3b;if(_0x4b50d4>=_0x50f85d){_0x4b50d4=_0x50f85d;_0x43aa3b=0xc8;}else{_0x43aa3b=0xce;}_0x4aa4c9[_0x412f('0x1a')](_0x43aa3b);return _0x4aa4c9[_0x412f('0x1e')](_0x412f('0x1f'),_0x3f3eb6+'-'+_0x4b50d4+'/'+_0x50f85d)[_0x412f('0x20')](_0x3e5a8a);}return null;};}function patchUpdates(_0x39c036){return function(_0xe5388c){try{jsonpatch[_0x412f('0x21')](_0xe5388c,_0x39c036,!![]);}catch(_0x1fac75){return BPromise[_0x412f('0x22')](_0x1fac75);}return _0xe5388c[_0x412f('0x23')]();};}function saveUpdates(_0xbf053,_0x4cf4ed){return function(_0x5266c2){if(_0x5266c2){return _0x5266c2[_0x412f('0x24')](_0xbf053)[_0x412f('0x25')](function(_0x245709){return _0x245709;});}return null;};}function removeEntity(_0x40b28a,_0x1bb9d8){return function(_0x1814a4){if(_0x1814a4){return _0x1814a4['destroy']()[_0x412f('0x25')](function(){_0x40b28a[_0x412f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4335a1,_0x2439d4){return function(_0x510bc7){if(!_0x510bc7){_0x4335a1[_0x412f('0x19')](0x194);}return _0x510bc7;};}function handleError(_0x4edbb7,_0x55e967){_0x55e967=_0x55e967||0x1f4;return function(_0x232922){logger[_0x412f('0x26')](_0x232922['stack']);if(_0x232922['name']){delete _0x232922[_0x412f('0x27')];}_0x4edbb7[_0x412f('0x1a')](_0x55e967)[_0x412f('0x28')](_0x232922);};}exports[_0x412f('0x29')]=function(_0x11f396,_0x51fcc8){var _0xb7af2e={},_0x224a0c={},_0x30d4bc={'count':0x0,'rows':[]};var _0x1f568f=db['MailQueue'][_0x412f('0x2a')];_0x224a0c['model']=_[_0x412f('0x2b')](_0x1f568f);var _0x40ab21={'dateStart':_0x11f396[_0x412f('0x2c')][_0x412f('0x2d')],'dateEnd':_0x11f396[_0x412f('0x2c')][_0x412f('0x2e')]};delete _0x11f396['query']['dateStart'];delete _0x11f396['query'][_0x412f('0x2e')];_0x224a0c[_0x412f('0x2c')]=_[_0x412f('0x2b')](_0x11f396[_0x412f('0x2c')]);_0x224a0c[_0x412f('0x2f')]=_[_0x412f('0x30')](_0x224a0c[_0x412f('0x31')],_0x224a0c[_0x412f('0x2c')]);_0xb7af2e[_0x412f('0x32')]=_[_0x412f('0x30')](_0x224a0c[_0x412f('0x31')],qs[_0x412f('0x33')](_0x11f396[_0x412f('0x2c')][_0x412f('0x33')]));_0xb7af2e[_0x412f('0x32')]=_0xb7af2e[_0x412f('0x32')][_0x412f('0x34')]?_0xb7af2e[_0x412f('0x32')]:_0x224a0c['model'];if(!_0x11f396['query'][_0x412f('0x35')](_0x412f('0x36'))){_0xb7af2e['limit']=qs[_0x412f('0x1d')](_0x11f396[_0x412f('0x2c')]['limit']);_0xb7af2e[_0x412f('0x1c')]=qs['offset'](_0x11f396[_0x412f('0x2c')][_0x412f('0x1c')]);}_0xb7af2e[_0x412f('0x37')]=qs[_0x412f('0x38')](_0x11f396['query'][_0x412f('0x38')]);_0xb7af2e['where']=qs[_0x412f('0x2f')](_[_0x412f('0x39')](_0x11f396[_0x412f('0x2c')],_0x224a0c['filters']));if(_0x40ab21[_0x412f('0x2d')]){if(_0x40ab21['dateEnd']){_0x40ab21['dateEnd']=moment(_0x40ab21[_0x412f('0x2e')])[_0x412f('0x3a')](0x1,_0x412f('0x3b'));}else{_0x40ab21['dateEnd']=moment(_0x40ab21['dateStart'])[_0x412f('0x3a')](0x1,_0x412f('0x3b'));}_[_0x412f('0x3c')](_0xb7af2e['where'],{'createdAt':{'$gte':_0x40ab21[_0x412f('0x2d')],'$lte':_0x40ab21[_0x412f('0x2e')]}});}if(_0x11f396[_0x412f('0x2c')]['filter']){_0xb7af2e['where']=_[_0x412f('0x3c')](_0xb7af2e[_0x412f('0x3d')],{'$or':_[_0x412f('0x3e')](_0xb7af2e[_0x412f('0x32')],function(_0x23ae09){var _0x7b76ec={};_0x7b76ec[_0x23ae09]={'$like':'%'+_0x11f396[_0x412f('0x2c')]['filter']+'%'};return _0x7b76ec;})});}_0xb7af2e=_[_0x412f('0x3c')]({},_0xb7af2e,_0x11f396[_0x412f('0x3f')]);var _0x322b48={'where':_0xb7af2e['where']};return db[_0x412f('0x40')][_0x412f('0x41')](_0x322b48)[_0x412f('0x25')](function(_0x53e787){_0x30d4bc[_0x412f('0x41')]=_0x53e787;if(_0x11f396['query'][_0x412f('0x42')]){_0xb7af2e[_0x412f('0x43')]=[{'all':!![]}];}return db[_0x412f('0x40')][_0x412f('0x44')](_0xb7af2e);})[_0x412f('0x25')](function(_0x42416a){_0x30d4bc[_0x412f('0x45')]=_0x42416a;return _0x30d4bc;})[_0x412f('0x25')](respondWithFilteredResult(_0x51fcc8,_0xb7af2e))[_0x412f('0x46')](handleError(_0x51fcc8,null));};exports[_0x412f('0x47')]=function(_0x1182be,_0x980101){var _0x230c05={'raw':!![],'where':{'id':_0x1182be[_0x412f('0x48')]['id']}},_0x5c7a53={};_0x5c7a53[_0x412f('0x31')]=_[_0x412f('0x2b')](db[_0x412f('0x40')][_0x412f('0x2a')]);_0x5c7a53[_0x412f('0x2c')]=_[_0x412f('0x2b')](_0x1182be['query']);_0x5c7a53['filters']=_['intersection'](_0x5c7a53['model'],_0x5c7a53[_0x412f('0x2c')]);_0x230c05[_0x412f('0x32')]=_['intersection'](_0x5c7a53[_0x412f('0x31')],qs[_0x412f('0x33')](_0x1182be[_0x412f('0x2c')][_0x412f('0x33')]));_0x230c05[_0x412f('0x32')]=_0x230c05[_0x412f('0x32')][_0x412f('0x34')]?_0x230c05['attributes']:_0x5c7a53[_0x412f('0x31')];if(_0x1182be[_0x412f('0x2c')][_0x412f('0x42')]){_0x230c05[_0x412f('0x43')]=[{'all':!![]}];}_0x230c05=_[_0x412f('0x3c')]({},_0x230c05,_0x1182be[_0x412f('0x3f')]);return db[_0x412f('0x40')]['find'](_0x230c05)[_0x412f('0x25')](handleEntityNotFound(_0x980101,null))[_0x412f('0x25')](respondWithResult(_0x980101,null))[_0x412f('0x46')](handleError(_0x980101,null));};exports[_0x412f('0x49')]=function(_0x264c99,_0x5291a5){return db[_0x412f('0x40')][_0x412f('0x49')](_0x264c99[_0x412f('0x4a')],{})[_0x412f('0x25')](respondWithResult(_0x5291a5,0xc9))[_0x412f('0x46')](handleError(_0x5291a5,null));};exports[_0x412f('0x24')]=function(_0x21ee93,_0x16ed49){if(_0x21ee93[_0x412f('0x4a')]['id']){delete _0x21ee93[_0x412f('0x4a')]['id'];}return db['MailQueue'][_0x412f('0x4b')]({'where':{'id':_0x21ee93[_0x412f('0x48')]['id']}})[_0x412f('0x25')](handleEntityNotFound(_0x16ed49,null))['then'](saveUpdates(_0x21ee93[_0x412f('0x4a')],null))[_0x412f('0x25')](respondWithResult(_0x16ed49,null))[_0x412f('0x46')](handleError(_0x16ed49,null));};exports['destroy']=function(_0x79b54a,_0x5aa3d8){return db[_0x412f('0x40')][_0x412f('0x4b')]({'where':{'id':_0x79b54a[_0x412f('0x48')]['id']}})[_0x412f('0x25')](handleEntityNotFound(_0x5aa3d8,null))[_0x412f('0x25')](removeEntity(_0x5aa3d8,null))[_0x412f('0x46')](handleError(_0x5aa3d8,null));};exports['describe']=function(_0x473cbb,_0x255164){return db['MailQueue'][_0x412f('0x4c')]()[_0x412f('0x25')](respondWithResult(_0x255164,null))['catch'](handleError(_0x255164,null));};exports['getMembers']=function(_0x5b5a9b,_0x24e494,_0x4497c8){var _0x2f4368={'raw':!![],'where':{}},_0x4c78cf={},_0xbd1b88;return db['MailQueue'][_0x412f('0x4d')]({'where':{'id':_0x5b5a9b[_0x412f('0x48')]['id']}})[_0x412f('0x25')](handleEntityNotFound(_0x24e494,null))[_0x412f('0x25')](function(_0x58adf1){if(_0x58adf1){_0xbd1b88=_0x58adf1[_0x412f('0x4e')]({'plain':!![]});_0x4c78cf[_0x412f('0x31')]=_[_0x412f('0x2b')](db[_0x412f('0x4f')][_0x412f('0x2a')]);_0x4c78cf[_0x412f('0x2c')]=_[_0x412f('0x2b')](_0x5b5a9b[_0x412f('0x2c')]);_0x4c78cf[_0x412f('0x2f')]=_[_0x412f('0x30')](_0x4c78cf[_0x412f('0x31')],_0x4c78cf[_0x412f('0x2c')]);_0x2f4368[_0x412f('0x32')]=_[_0x412f('0x30')](_0x4c78cf[_0x412f('0x31')],qs[_0x412f('0x33')](_0x5b5a9b[_0x412f('0x2c')][_0x412f('0x33')]));_0x2f4368['attributes']=_0x2f4368[_0x412f('0x32')][_0x412f('0x34')]?_0x2f4368[_0x412f('0x32')]:_0x4c78cf[_0x412f('0x31')];if(!_0x5b5a9b[_0x412f('0x2c')]['hasOwnProperty'](_0x412f('0x36'))){_0x2f4368[_0x412f('0x1d')]=qs[_0x412f('0x1d')](_0x5b5a9b[_0x412f('0x2c')][_0x412f('0x1d')]);_0x2f4368[_0x412f('0x1c')]=qs['offset'](_0x5b5a9b['query'][_0x412f('0x1c')]);}_0x2f4368[_0x412f('0x37')]=qs[_0x412f('0x38')](_0x5b5a9b[_0x412f('0x2c')]['sort']);_0x2f4368['where']=qs[_0x412f('0x2f')](_[_0x412f('0x39')](_0x5b5a9b[_0x412f('0x2c')],_0x4c78cf[_0x412f('0x2f')]));_0x2f4368[_0x412f('0x3d')][_0x412f('0x50')]=_0x58adf1['id'];if(_0x5b5a9b['query'][_0x412f('0x51')]){_0x2f4368['where']=_[_0x412f('0x3c')](_0x2f4368[_0x412f('0x3d')],{'$or':_[_0x412f('0x3e')](_0x2f4368[_0x412f('0x32')],function(_0x54dc5b){var _0x17c43d={};_0x17c43d[_0x54dc5b]={'$like':'%'+_0x5b5a9b[_0x412f('0x2c')][_0x412f('0x51')]+'%'};return _0x17c43d;})});}_0x2f4368=_[_0x412f('0x3c')]({},_0x2f4368,_0x5b5a9b[_0x412f('0x3f')]);return db['UserMailQueue'][_0x412f('0x44')](_0x2f4368);}})[_0x412f('0x25')](function(_0x2d3075){if(_0x2d3075){return db['User'][_0x412f('0x52')]({'where':{'id':_['map'](_0x2d3075,_0x412f('0x53')),'role':_0x412f('0x54')},'attributes':['id',_0x412f('0x27'),'mailPause',_0x412f('0x55'),_0x412f('0x56')]});}})[_0x412f('0x25')](function(_0xedd539){if(_0xedd539){return{'count':_0xedd539[_0x412f('0x41')],'rows':_[_0x412f('0x3e')](_0xedd539[_0x412f('0x45')],function(_0x2aac71){return{'membername':_0x2aac71[_0x412f('0x27')],'UserId':_0x2aac71['id'],'queue_name':_0xbd1b88[_0x412f('0x27')],'MailQueueId':_0xbd1b88['id'],'interface':util[_0x412f('0x57')](_0x412f('0x58'),'SIP',_0x2aac71[_0x412f('0x27')]),'penalty':0x0,'paused':_0x2aac71['mailPause'],'createdAt':_0x2aac71[_0x412f('0x56')],'updatedAt':_0x2aac71[_0x412f('0x55')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x412f('0x25')](respondWithFilteredResult(_0x24e494,_0x2f4368))['catch'](handleError(_0x24e494,null));};exports[_0x412f('0x59')]=function(_0xb99129,_0x2ca812,_0x53d132){var _0x1729d3={};var _0x535d51={};var _0x409fbf;var _0x2d1c8d;return db[_0x412f('0x40')]['findOne']({'where':{'id':_0xb99129[_0x412f('0x48')]['id']}})[_0x412f('0x25')](handleEntityNotFound(_0x2ca812,null))[_0x412f('0x25')](function(_0xa3a59b){if(_0xa3a59b){_0x409fbf=_0xa3a59b;_0x535d51[_0x412f('0x31')]=_[_0x412f('0x2b')](db[_0x412f('0x5a')][_0x412f('0x2a')]);_0x535d51[_0x412f('0x2c')]=_[_0x412f('0x2b')](_0xb99129[_0x412f('0x2c')]);_0x535d51[_0x412f('0x2f')]=_[_0x412f('0x30')](_0x535d51[_0x412f('0x31')],_0x535d51[_0x412f('0x2c')]);_0x1729d3[_0x412f('0x32')]=_[_0x412f('0x30')](_0x535d51[_0x412f('0x31')],qs[_0x412f('0x33')](_0xb99129[_0x412f('0x2c')][_0x412f('0x33')]));_0x1729d3[_0x412f('0x32')]=_0x1729d3[_0x412f('0x32')][_0x412f('0x34')]?_0x1729d3[_0x412f('0x32')]:_0x535d51[_0x412f('0x31')];_0x1729d3[_0x412f('0x37')]=qs[_0x412f('0x38')](_0xb99129[_0x412f('0x2c')][_0x412f('0x38')]);_0x1729d3[_0x412f('0x3d')]=qs[_0x412f('0x2f')](_[_0x412f('0x39')](_0xb99129[_0x412f('0x2c')],_0x535d51[_0x412f('0x2f')]));if(_0xb99129['query'][_0x412f('0x51')]){_0x1729d3['where']=_['merge'](_0x1729d3[_0x412f('0x3d')],{'$or':_['map'](_0x1729d3[_0x412f('0x32')],function(_0x246421){var _0x134668={};_0x134668[_0x246421]={'$like':'%'+_0xb99129[_0x412f('0x2c')][_0x412f('0x51')]+'%'};return _0x134668;})});}_0x1729d3=_[_0x412f('0x3c')]({},_0x1729d3,_0xb99129['options']);return _0x409fbf[_0x412f('0x59')](_0x1729d3);}})[_0x412f('0x25')](function(_0x633af1){if(_0x633af1){_0x2d1c8d=_0x633af1[_0x412f('0x34')];if(!_0xb99129[_0x412f('0x2c')]['hasOwnProperty'](_0x412f('0x36'))){_0x1729d3[_0x412f('0x1d')]=qs[_0x412f('0x1d')](_0xb99129['query']['limit']);_0x1729d3[_0x412f('0x1c')]=qs[_0x412f('0x1c')](_0xb99129[_0x412f('0x2c')][_0x412f('0x1c')]);}return _0x409fbf['getTeams'](_0x1729d3);}})[_0x412f('0x25')](function(_0x440f2c){if(_0x440f2c){return _0x440f2c?{'count':_0x2d1c8d,'rows':_0x440f2c}:null;}})[_0x412f('0x25')](respondWithResult(_0x2ca812,null))[_0x412f('0x46')](handleError(_0x2ca812,null));};exports[_0x412f('0x5b')]=function(_0x390805,_0x3239ec,_0x4070ee){var _0x4663a6=[];var _0x50be13;return db[_0x412f('0x5a')][_0x412f('0x44')]({'where':{'id':_0x390805['body']['ids']},'attributes':['id'],'include':[{'model':db[_0x412f('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x412f('0x25')](function(_0x224b2b){if(_0x224b2b){for(var _0x257d43=0x0;_0x257d43<_0x224b2b[_0x412f('0x34')];_0x257d43+=0x1){for(var _0x2f2e16=0x0;_0x2f2e16<_0x224b2b[_0x257d43][_0x412f('0x5d')]['length'];_0x2f2e16+=0x1){_0x4663a6=_[_0x412f('0x5e')](_0x4663a6,[_0x224b2b[_0x257d43]['Agents'][_0x2f2e16]['id']]);}}return _0x4663a6;}})[_0x412f('0x25')](function(_0x173bb6){if(_0x173bb6){return db['MailQueue']['find']({'where':{'id':_0x390805[_0x412f('0x48')]['id']}});}})[_0x412f('0x25')](function(_0x52a498){if(_0x52a498){_0x50be13=_0x52a498;return _0x50be13['addAgents'](_0x4663a6,{'penalty':_0x390805[_0x412f('0x4a')][_0x412f('0x5f')]});}})[_0x412f('0x25')](function(_0x21f84b){if(_0x21f84b){return _0x50be13[_0x412f('0x5b')](_0x390805[_0x412f('0x4a')]['ids']);}})[_0x412f('0x25')](handleEntityNotFound(_0x3239ec,null))[_0x412f('0x25')](respondWithStatusCode(_0x3239ec,null))[_0x412f('0x46')](handleError(_0x3239ec,null));};exports['removeTeams']=function(_0x52edd5,_0x22c6ce,_0x5b1f06){var _0x28499b=[];var _0x3fbce2;return db[_0x412f('0x5a')][_0x412f('0x44')]({'where':{'id':_0x52edd5[_0x412f('0x2c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x412f('0x5c')],'as':_0x412f('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x412f('0x25')](function(_0x325407){if(_0x325407){for(var _0x32e361=0x0;_0x32e361<_0x325407['length'];_0x32e361+=0x1){for(var _0x1a7950=0x0;_0x1a7950<_0x325407[_0x32e361][_0x412f('0x5d')][_0x412f('0x34')];_0x1a7950+=0x1){_0x28499b=_['union'](_0x28499b,[_0x325407[_0x32e361][_0x412f('0x5d')][_0x1a7950]['id']]);}}return _0x28499b;}})[_0x412f('0x25')](function(_0x53c071){if(_0x53c071){return db[_0x412f('0x40')][_0x412f('0x4b')]({'where':{'id':_0x52edd5[_0x412f('0x48')]['id']}});}})[_0x412f('0x25')](function(_0x24be67){if(_0x24be67){_0x3fbce2=_0x24be67;return _0x3fbce2[_0x412f('0x60')](_0x28499b);}})[_0x412f('0x25')](function(_0x1aa393){if(_0x3fbce2){return _0x3fbce2['removeTeams'](_0x52edd5[_0x412f('0x2c')][_0x412f('0x61')]);}})[_0x412f('0x25')](handleEntityNotFound(_0x22c6ce,null))['then'](respondWithStatusCode(_0x22c6ce,null))['catch'](handleError(_0x22c6ce,null));};exports[_0x412f('0x62')]=function(_0x40ffe2,_0x161f4b,_0x1537ce){return db[_0x412f('0x40')]['find']({'where':{'id':_0x40ffe2[_0x412f('0x48')]['id']}})[_0x412f('0x25')](handleEntityNotFound(_0x161f4b,null))[_0x412f('0x25')](function(_0xae22f8){if(_0xae22f8){return _0xae22f8[_0x412f('0x62')](_0x40ffe2[_0x412f('0x4a')][_0x412f('0x61')],_[_0x412f('0x63')](_0x40ffe2[_0x412f('0x4a')],[_0x412f('0x61'),'id'])||{})[_0x412f('0x64')](function(_0x42282a){for(var _0x21fea7=0x0;_0x21fea7<_0x40ffe2['body'][_0x412f('0x61')][_0x412f('0x34')];_0x21fea7+=0x1){socket['emit'](_0x412f('0x65'),{'UserId':_0x40ffe2[_0x412f('0x4a')]['ids'][_0x21fea7],'MailQueueId':_0x40ffe2[_0x412f('0x48')]['id']});}return _0x42282a;});}})['then'](respondWithResult(_0x161f4b,null))[_0x412f('0x46')](handleError(_0x161f4b,null));};exports[_0x412f('0x60')]=function(_0x48aa49,_0x54d009,_0x1cdbab){var _0x2ac7fa;return db[_0x412f('0x40')][_0x412f('0x4b')]({'where':{'id':_0x48aa49[_0x412f('0x48')]['id']}})[_0x412f('0x25')](handleEntityNotFound(_0x54d009,null))[_0x412f('0x25')](function(_0x2b959e){if(_0x2b959e){return _0x2b959e[_0x412f('0x60')](_0x48aa49['query'][_0x412f('0x61')])[_0x412f('0x25')](function(_0x231158){if(_[_0x412f('0x66')](_0x48aa49[_0x412f('0x2c')][_0x412f('0x61')])){for(var _0x11fdc7=0x0;_0x11fdc7<_0x48aa49[_0x412f('0x2c')][_0x412f('0x61')]['length'];_0x11fdc7+=0x1){socket['emit'](_0x412f('0x67'),{'UserId':_0x48aa49[_0x412f('0x2c')][_0x412f('0x61')][_0x11fdc7],'MailQueueId':_0x48aa49[_0x412f('0x48')]['id']});}}else{socket[_0x412f('0x68')](_0x412f('0x67'),{'UserId':_0x48aa49['query'][_0x412f('0x61')],'MailQueueId':_0x48aa49[_0x412f('0x48')]['id']});}});}})['then'](respondWithStatusCode(_0x54d009,null))[_0x412f('0x46')](handleError(_0x54d009,null));};exports[_0x412f('0x69')]=function(_0xeedd67,_0x15d22b,_0x22c4a7){var _0x2b6a19={};var _0x3ced1b={};var _0x299935;var _0x591250;return db[_0x412f('0x40')][_0x412f('0x4d')]({'where':{'id':_0xeedd67[_0x412f('0x48')]['id']}})['then'](handleEntityNotFound(_0x15d22b,null))[_0x412f('0x25')](function(_0x26c84b){if(_0x26c84b){_0x299935=_0x26c84b;_0x3ced1b[_0x412f('0x31')]=_['keys'](db[_0x412f('0x5c')][_0x412f('0x2a')]);_0x3ced1b[_0x412f('0x2c')]=_[_0x412f('0x2b')](_0xeedd67[_0x412f('0x2c')]);_0x3ced1b[_0x412f('0x2f')]=_[_0x412f('0x30')](_0x3ced1b['model'],_0x3ced1b[_0x412f('0x2c')]);_0x2b6a19[_0x412f('0x32')]=_[_0x412f('0x30')](_0x3ced1b[_0x412f('0x31')],qs[_0x412f('0x33')](_0xeedd67[_0x412f('0x2c')][_0x412f('0x33')]));_0x2b6a19['attributes']=_0x2b6a19[_0x412f('0x32')][_0x412f('0x34')]?_0x2b6a19[_0x412f('0x32')]:_0x3ced1b[_0x412f('0x31')];_0x2b6a19['order']=qs['sort'](_0xeedd67[_0x412f('0x2c')][_0x412f('0x38')]);_0x2b6a19[_0x412f('0x3d')]=qs[_0x412f('0x2f')](_['pick'](_0xeedd67[_0x412f('0x2c')],_0x3ced1b[_0x412f('0x2f')]));if(_0xeedd67['query'][_0x412f('0x51')]){_0x2b6a19[_0x412f('0x3d')]=_[_0x412f('0x3c')](_0x2b6a19[_0x412f('0x3d')],{'$or':_[_0x412f('0x3e')](_0x2b6a19[_0x412f('0x32')],function(_0x7cfb7a){var _0x4485bd={};_0x4485bd[_0x7cfb7a]={'$like':'%'+_0xeedd67['query'][_0x412f('0x51')]+'%'};return _0x4485bd;})});}_0x2b6a19=_['merge']({},_0x2b6a19,_0xeedd67[_0x412f('0x3f')]);return _0x299935[_0x412f('0x69')](_0x2b6a19);}})['then'](function(_0x304da6){if(_0x304da6){_0x591250=_0x304da6[_0x412f('0x34')];if(!_0xeedd67[_0x412f('0x2c')][_0x412f('0x35')]('nolimit')){_0x2b6a19['limit']=qs[_0x412f('0x1d')](_0xeedd67['query'][_0x412f('0x1d')]);_0x2b6a19['offset']=qs[_0x412f('0x1c')](_0xeedd67[_0x412f('0x2c')][_0x412f('0x1c')]);}return _0x299935[_0x412f('0x69')](_0x2b6a19);}})[_0x412f('0x25')](function(_0x5177e1){if(_0x5177e1){return _0x5177e1?{'count':_0x591250,'rows':_0x5177e1}:null;}})[_0x412f('0x25')](respondWithResult(_0x15d22b,null))[_0x412f('0x46')](handleError(_0x15d22b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3c517f4..02e8625 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 _0xebcb=['save','hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0xebcb,0xe1));var _0xbebc=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xebcb[_0x2576d7];return _0x16a08c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xbebc('0x0'))['db'][_0xbebc('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbebc('0x2')](0x0);var events={'afterCreate':_0xbebc('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5ccf3c){return function(_0x1e9643,_0x5d3eac,_0x222b52){MailQueueEvents['emit'](_0x5ccf3c+':'+_0x1e9643['id'],_0x1e9643);MailQueueEvents['emit'](_0x5ccf3c,_0x1e9643);_0x222b52(null);};}for(var e in events){if(events[_0xbebc('0x4')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xbebc('0x5')]=MailQueueEvents; \ No newline at end of file +var _0x67bf=['events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x67bf,0xf8));var _0xf67b=function(_0x333f04,_0x35a1f4){_0x333f04=_0x333f04-0x0;var _0x24b6eb=_0x67bf[_0x333f04];return _0x24b6eb;};'use strict';var EventEmitter=require(_0xf67b('0x0'));var MailQueue=require(_0xf67b('0x1'))['db'][_0xf67b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf67b('0x3')](0x0);var events={'afterCreate':_0xf67b('0x4'),'afterUpdate':'update','afterDestroy':_0xf67b('0x5')};function emitEvent(_0x3e4ebd){return function(_0x3303c1,_0x610635,_0x587c2d){MailQueueEvents[_0xf67b('0x6')](_0x3e4ebd+':'+_0x3303c1['id'],_0x3303c1);MailQueueEvents[_0xf67b('0x6')](_0x3e4ebd,_0x3303c1);_0x587c2d(null);};}for(var e in events){if(events[_0xf67b('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index db0ca5d..57f2365 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 _0x8447=['util','api','moment','bluebird','request-promise','exports','define','MailQueue','mail_queues','lodash'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x8447,0x18f));var _0x7844=function(_0x2c57d7,_0x83fcdc){_0x2c57d7=_0x2c57d7-0x0;var _0x4e4ec0=_0x8447[_0x2c57d7];return _0x4e4ec0;};'use strict';var _=require(_0x7844('0x0'));var util=require(_0x7844('0x1'));var logger=require('../../config/logger')(_0x7844('0x2'));var moment=require(_0x7844('0x3'));var BPromise=require(_0x7844('0x4'));var rp=require(_0x7844('0x5'));var attributes=require('./mailQueue.attributes');module[_0x7844('0x6')]=function(_0x377c2d,_0x270711){return _0x377c2d[_0x7844('0x7')](_0x7844('0x8'),attributes,{'tableName':_0x7844('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0cb=['api','request-promise','./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger'];(function(_0x4a5bf6,_0x458d59){var _0x21c9a8=function(_0x17dd1a){while(--_0x17dd1a){_0x4a5bf6['push'](_0x4a5bf6['shift']());}};_0x21c9a8(++_0x458d59);}(_0xd0cb,0xde));var _0xbd0c=function(_0x7c0a96,_0x10ee59){_0x7c0a96=_0x7c0a96-0x0;var _0x353ac2=_0xd0cb[_0x7c0a96];return _0x353ac2;};'use strict';var _=require(_0xbd0c('0x0'));var util=require(_0xbd0c('0x1'));var logger=require(_0xbd0c('0x2'))(_0xbd0c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd0c('0x4'));var attributes=require(_0xbd0c('0x5'));module[_0xbd0c('0x6')]=function(_0x268c52,_0x260ec9){return _0x268c52[_0xbd0c('0x7')]('MailQueue',attributes,{'tableName':_0xbd0c('0x8'),'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 0bfe896..046b8f3 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 _0xfa75=['findAll','options','where','limit','include','model','map','then','GetMailQueue','catch','ShowMailQueue','find','raw','attributes','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','socket.io-emitter','./mailQueue.socket','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','MailQueue'];(function(_0x128ee7,_0xbfbe00){var _0x38450a=function(_0x570931){while(--_0x570931){_0x128ee7['push'](_0x128ee7['shift']());}};_0x38450a(++_0xbfbe00);}(_0xfa75,0x1ef));var _0x5fa7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa75[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5fa7('0x0'));var util=require(_0x5fa7('0x1'));var moment=require(_0x5fa7('0x2'));var BPromise=require('bluebird');var rs=require(_0x5fa7('0x3'));var fs=require('fs');var db=require(_0x5fa7('0x4'))['db'];var utils=require(_0x5fa7('0x5'));var logger=require(_0x5fa7('0x6'))('rpc');var config=require(_0x5fa7('0x7'));var jayson=require(_0x5fa7('0x8'));var client=jayson[_0x5fa7('0x9')][_0x5fa7('0xa')]({'port':0x232a});var socket=require(_0x5fa7('0xb'))({'host':'localhost','port':0x18eb});require(_0x5fa7('0xc'))['register'](socket);function respondWithRpcPromise(_0x9543ee,_0x2df4b8,_0x2d5024){return new BPromise(function(_0x27492d,_0x29b8d0){return client['request'](_0x9543ee,_0x2d5024)['then'](function(_0x3be490){logger['info'](_0x5fa7('0xd'),_0x2df4b8,'request\x20sent');logger[_0x5fa7('0xe')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2df4b8,_0x5fa7('0xf'),JSON[_0x5fa7('0x10')](_0x3be490));if(_0x3be490['error']){if(_0x3be490[_0x5fa7('0x11')][_0x5fa7('0x12')]===0x1f4){logger[_0x5fa7('0x11')](_0x5fa7('0xd'),_0x2df4b8,_0x3be490[_0x5fa7('0x11')][_0x5fa7('0x13')]);return _0x29b8d0(_0x3be490[_0x5fa7('0x11')][_0x5fa7('0x13')]);}logger[_0x5fa7('0x11')](_0x5fa7('0xd'),_0x2df4b8,_0x3be490[_0x5fa7('0x11')][_0x5fa7('0x13')]);return _0x27492d(_0x3be490['error']['message']);}else{logger[_0x5fa7('0x14')](_0x5fa7('0xd'),_0x2df4b8,_0x5fa7('0xf'));_0x27492d(_0x3be490[_0x5fa7('0x15')]['message']);}})['catch'](function(_0x1669b1){logger[_0x5fa7('0x11')](_0x5fa7('0xd'),_0x2df4b8,_0x1669b1);_0x29b8d0(_0x1669b1);});});}exports['GetMailQueue']=function(_0xdbc522){var _0x3243d2=this;return new Promise(function(_0x22c7fe,_0x522caa){return db[_0x5fa7('0x16')][_0x5fa7('0x17')]({'raw':_0xdbc522[_0x5fa7('0x18')]?_0xdbc522['options']['raw']===undefined?!![]:![]:!![],'where':_0xdbc522[_0x5fa7('0x18')]?_0xdbc522[_0x5fa7('0x18')][_0x5fa7('0x19')]||null:null,'attributes':_0xdbc522[_0x5fa7('0x18')]?_0xdbc522[_0x5fa7('0x18')]['attributes']||null:null,'limit':_0xdbc522['options']?_0xdbc522[_0x5fa7('0x18')][_0x5fa7('0x1a')]||null:null,'include':_0xdbc522[_0x5fa7('0x18')]?_0xdbc522[_0x5fa7('0x18')][_0x5fa7('0x1b')]?_['map'](_0xdbc522['options'][_0x5fa7('0x1b')],function(_0x2385bb){return{'model':db[_0x2385bb[_0x5fa7('0x1c')]],'as':_0x2385bb['as'],'attributes':_0x2385bb['attributes'],'include':_0x2385bb[_0x5fa7('0x1b')]?_['map'](_0x2385bb[_0x5fa7('0x1b')],function(_0x14203b){return{'model':db[_0x14203b[_0x5fa7('0x1c')]],'as':_0x14203b['as'],'attributes':_0x14203b['attributes'],'include':_0x14203b[_0x5fa7('0x1b')]?_[_0x5fa7('0x1d')](_0x14203b[_0x5fa7('0x1b')],function(_0x15111e){return{'model':db[_0x15111e[_0x5fa7('0x1c')]],'as':_0x15111e['as'],'attributes':_0x15111e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5fa7('0x1e')](function(_0x5e4ca7){logger[_0x5fa7('0x14')](_0x5fa7('0x1f'),_0xdbc522);logger[_0x5fa7('0xe')](_0x5fa7('0x1f'),_0xdbc522,JSON[_0x5fa7('0x10')](_0x5e4ca7));_0x22c7fe(_0x5e4ca7);})[_0x5fa7('0x20')](function(_0x1bc135){logger[_0x5fa7('0x11')](_0x5fa7('0x1f'),_0x1bc135[_0x5fa7('0x13')],_0xdbc522);_0x522caa(_0x3243d2[_0x5fa7('0x11')](0x1f4,_0x1bc135[_0x5fa7('0x13')]));});});};exports[_0x5fa7('0x21')]=function(_0x500280){var _0x129a50=this;return new Promise(function(_0x2e9d4b,_0x5b9441){return db[_0x5fa7('0x16')][_0x5fa7('0x22')]({'raw':_0x500280['options']?_0x500280[_0x5fa7('0x18')][_0x5fa7('0x23')]===undefined?!![]:![]:!![],'where':_0x500280[_0x5fa7('0x18')]?_0x500280[_0x5fa7('0x18')][_0x5fa7('0x19')]||null:null,'attributes':_0x500280[_0x5fa7('0x18')]?_0x500280[_0x5fa7('0x18')][_0x5fa7('0x24')]||null:null,'include':_0x500280[_0x5fa7('0x18')]?_0x500280[_0x5fa7('0x18')]['include']?_['map'](_0x500280['options'][_0x5fa7('0x1b')],function(_0x5d180f){return{'model':db[_0x5d180f['model']],'as':_0x5d180f['as'],'attributes':_0x5d180f['attributes'],'include':_0x5d180f[_0x5fa7('0x1b')]?_[_0x5fa7('0x1d')](_0x5d180f[_0x5fa7('0x1b')],function(_0x5a6f03){return{'model':db[_0x5a6f03[_0x5fa7('0x1c')]],'as':_0x5a6f03['as'],'attributes':_0x5a6f03[_0x5fa7('0x24')],'include':_0x5a6f03[_0x5fa7('0x1b')]?_[_0x5fa7('0x1d')](_0x5a6f03['include'],function(_0x3b8e87){return{'model':db[_0x3b8e87[_0x5fa7('0x1c')]],'as':_0x3b8e87['as'],'attributes':_0x3b8e87[_0x5fa7('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d2689){logger[_0x5fa7('0x14')](_0x5fa7('0x21'),_0x500280);logger['debug'](_0x5fa7('0x21'),_0x500280,JSON[_0x5fa7('0x10')](_0x1d2689));_0x2e9d4b(_0x1d2689);})[_0x5fa7('0x20')](function(_0x377ea4){logger[_0x5fa7('0x11')]('ShowMailQueue',_0x377ea4[_0x5fa7('0x13')],_0x500280);_0x5b9441(_0x129a50[_0x5fa7('0x11')](0x1f4,_0x377ea4[_0x5fa7('0x13')]));});});}; \ No newline at end of file +var _0xd117=['localhost','./mailQueue.socket','request','then','info','debug','stringify','error','code','MailQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','findAll','options','raw','where','attributes','include','map','model','GetMailQueue','MailQueue','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xd117,0x182));var _0x7d11=function(_0x4b935a,_0x327ee3){_0x4b935a=_0x4b935a-0x0;var _0xa298f0=_0xd117[_0x4b935a];return _0xa298f0;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var db=require(_0x7d11('0x5'))['db'];var utils=require(_0x7d11('0x6'));var logger=require(_0x7d11('0x7'))(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var jayson=require(_0x7d11('0xa'));var client=jayson[_0x7d11('0xb')][_0x7d11('0xc')]({'port':0x232a});var socket=require(_0x7d11('0xd'))({'host':_0x7d11('0xe'),'port':0x18eb});require(_0x7d11('0xf'))['register'](socket);function respondWithRpcPromise(_0x3803b5,_0xffd020,_0x2007c1){return new BPromise(function(_0x5bdf01,_0x305eef){return client[_0x7d11('0x10')](_0x3803b5,_0x2007c1)[_0x7d11('0x11')](function(_0x4ed7ae){logger[_0x7d11('0x12')]('MailQueue,\x20%s,\x20%s',_0xffd020,'request\x20sent');logger[_0x7d11('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0xffd020,'request\x20sent',JSON[_0x7d11('0x14')](_0x4ed7ae));if(_0x4ed7ae['error']){if(_0x4ed7ae[_0x7d11('0x15')][_0x7d11('0x16')]===0x1f4){logger['error'](_0x7d11('0x17'),_0xffd020,_0x4ed7ae[_0x7d11('0x15')]['message']);return _0x305eef(_0x4ed7ae[_0x7d11('0x15')][_0x7d11('0x18')]);}logger[_0x7d11('0x15')](_0x7d11('0x17'),_0xffd020,_0x4ed7ae[_0x7d11('0x15')][_0x7d11('0x18')]);return _0x5bdf01(_0x4ed7ae[_0x7d11('0x15')][_0x7d11('0x18')]);}else{logger['info'](_0x7d11('0x17'),_0xffd020,_0x7d11('0x19'));_0x5bdf01(_0x4ed7ae[_0x7d11('0x1a')][_0x7d11('0x18')]);}})[_0x7d11('0x1b')](function(_0x528fdc){logger[_0x7d11('0x15')](_0x7d11('0x17'),_0xffd020,_0x528fdc);_0x305eef(_0x528fdc);});});}exports['GetMailQueue']=function(_0x5459df){var _0x2ca3a2=this;return new Promise(function(_0x52a6ae,_0x1f9990){return db['MailQueue'][_0x7d11('0x1c')]({'raw':_0x5459df[_0x7d11('0x1d')]?_0x5459df[_0x7d11('0x1d')][_0x7d11('0x1e')]===undefined?!![]:![]:!![],'where':_0x5459df[_0x7d11('0x1d')]?_0x5459df[_0x7d11('0x1d')][_0x7d11('0x1f')]||null:null,'attributes':_0x5459df[_0x7d11('0x1d')]?_0x5459df['options'][_0x7d11('0x20')]||null:null,'limit':_0x5459df['options']?_0x5459df['options']['limit']||null:null,'include':_0x5459df[_0x7d11('0x1d')]?_0x5459df[_0x7d11('0x1d')][_0x7d11('0x21')]?_[_0x7d11('0x22')](_0x5459df[_0x7d11('0x1d')][_0x7d11('0x21')],function(_0x282e5c){return{'model':db[_0x282e5c[_0x7d11('0x23')]],'as':_0x282e5c['as'],'attributes':_0x282e5c['attributes'],'include':_0x282e5c[_0x7d11('0x21')]?_['map'](_0x282e5c['include'],function(_0x5126cf){return{'model':db[_0x5126cf[_0x7d11('0x23')]],'as':_0x5126cf['as'],'attributes':_0x5126cf['attributes'],'include':_0x5126cf[_0x7d11('0x21')]?_[_0x7d11('0x22')](_0x5126cf[_0x7d11('0x21')],function(_0x47c794){return{'model':db[_0x47c794[_0x7d11('0x23')]],'as':_0x47c794['as'],'attributes':_0x47c794[_0x7d11('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7d11('0x11')](function(_0x5d38dd){logger[_0x7d11('0x12')](_0x7d11('0x24'),_0x5459df);logger[_0x7d11('0x13')](_0x7d11('0x24'),_0x5459df,JSON['stringify'](_0x5d38dd));_0x52a6ae(_0x5d38dd);})[_0x7d11('0x1b')](function(_0x512f7f){logger[_0x7d11('0x15')]('GetMailQueue',_0x512f7f[_0x7d11('0x18')],_0x5459df);_0x1f9990(_0x2ca3a2[_0x7d11('0x15')](0x1f4,_0x512f7f[_0x7d11('0x18')]));});});};exports['ShowMailQueue']=function(_0x5e721f){var _0x8e0a53=this;return new Promise(function(_0x1ed210,_0x5d540e){return db[_0x7d11('0x25')][_0x7d11('0x26')]({'raw':_0x5e721f[_0x7d11('0x1d')]?_0x5e721f['options'][_0x7d11('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e721f['options']?_0x5e721f['options'][_0x7d11('0x1f')]||null:null,'attributes':_0x5e721f['options']?_0x5e721f[_0x7d11('0x1d')][_0x7d11('0x20')]||null:null,'include':_0x5e721f[_0x7d11('0x1d')]?_0x5e721f[_0x7d11('0x1d')]['include']?_[_0x7d11('0x22')](_0x5e721f[_0x7d11('0x1d')]['include'],function(_0x57aa8a){return{'model':db[_0x57aa8a[_0x7d11('0x23')]],'as':_0x57aa8a['as'],'attributes':_0x57aa8a[_0x7d11('0x20')],'include':_0x57aa8a['include']?_[_0x7d11('0x22')](_0x57aa8a['include'],function(_0x5c0113){return{'model':db[_0x5c0113[_0x7d11('0x23')]],'as':_0x5c0113['as'],'attributes':_0x5c0113['attributes'],'include':_0x5c0113['include']?_[_0x7d11('0x22')](_0x5c0113[_0x7d11('0x21')],function(_0x1b96d8){return{'model':db[_0x1b96d8[_0x7d11('0x23')]],'as':_0x1b96d8['as'],'attributes':_0x1b96d8[_0x7d11('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7d11('0x11')](function(_0x7c9516){logger[_0x7d11('0x12')](_0x7d11('0x27'),_0x5e721f);logger[_0x7d11('0x13')](_0x7d11('0x27'),_0x5e721f,JSON[_0x7d11('0x14')](_0x7c9516));_0x1ed210(_0x7c9516);})['catch'](function(_0x157731){logger['error'](_0x7d11('0x27'),_0x157731[_0x7d11('0x18')],_0x5e721f);_0x5d540e(_0x8e0a53[_0x7d11('0x15')](0x1f4,_0x157731[_0x7d11('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4a6ec59..40342bb 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 _0xf3b3=['mailQueue:','save','update','emit','register','length'];(function(_0xed8b5a,_0x3ef779){var _0x263834=function(_0x1d2379){while(--_0x1d2379){_0xed8b5a['push'](_0xed8b5a['shift']());}};_0x263834(++_0x3ef779);}(_0xf3b3,0x97));var _0x3f3b=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xf3b3[_0x4dc7b9];return _0x3ab114;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x3f3b('0x0'),'remove',_0x3f3b('0x1')];function createListener(_0x3392c1,_0x295fb7){return function(_0x59f8c5){_0x295fb7[_0x3f3b('0x2')](_0x3392c1,_0x59f8c5);};}function removeListener(_0x3b893e,_0x517d1b){return function(){MailQueueEvents['removeListener'](_0x3b893e,_0x517d1b);};}exports[_0x3f3b('0x3')]=function(_0x228e10){for(var _0x140511=0x0,_0xe53057=events[_0x3f3b('0x4')];_0x140511<_0xe53057;_0x140511++){var _0x269345=events[_0x140511];var _0x131888=createListener(_0x3f3b('0x5')+_0x269345,_0x228e10);MailQueueEvents['on'](_0x269345,_0x131888);}}; \ No newline at end of file +var _0x1900=['register','mailQueue:','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1900,0x105));var _0x0190=function(_0x14d750,_0x143c06){_0x14d750=_0x14d750-0x0;var _0x43a1bd=_0x1900[_0x14d750];return _0x43a1bd;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x0190('0x0'),_0x0190('0x1'),_0x0190('0x2')];function createListener(_0x8a4f39,_0x75756e){return function(_0x177adb){_0x75756e[_0x0190('0x3')](_0x8a4f39,_0x177adb);};}function removeListener(_0x37daf4,_0x64e763){return function(){MailQueueEvents[_0x0190('0x4')](_0x37daf4,_0x64e763);};}exports[_0x0190('0x5')]=function(_0x262678){for(var _0x19da8f=0x0,_0x1f18c7=events['length'];_0x19da8f<_0x1f18c7;_0x19da8f++){var _0x58562e=events[_0x19da8f];var _0x40a5f8=createListener(_0x0190('0x6')+_0x58562e,_0x262678);MailQueueEvents['on'](_0x58562e,_0x40a5f8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 32b2967..3fef701 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 _0xfe79=['/:id','show','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x37c84b,_0x1c2722){var _0xbb603a=function(_0x41e4be){while(--_0x41e4be){_0x37c84b['push'](_0x37c84b['shift']());}};_0xbb603a(++_0x1c2722);}(_0xfe79,0x1e8));var _0x9fe7=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0xfe79[_0x23c73d];return _0x36ba47;};'use strict';var multer=require(_0x9fe7('0x0'));var util=require(_0x9fe7('0x1'));var path=require('path');var express=require(_0x9fe7('0x2'));var router=express[_0x9fe7('0x3')]();var auth=require(_0x9fe7('0x4'));var interaction=require(_0x9fe7('0x5'));var config=require(_0x9fe7('0x6'));var controller=require('./mailQueueReport.controller');router[_0x9fe7('0x7')]('/',auth[_0x9fe7('0x8')](),controller[_0x9fe7('0x9')]);router[_0x9fe7('0x7')](_0x9fe7('0xa'),auth['isAuthenticated'](),controller[_0x9fe7('0xb')]);router[_0x9fe7('0x7')](_0x9fe7('0xc'),auth[_0x9fe7('0x8')](),controller[_0x9fe7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9fe7('0xe')]);router[_0x9fe7('0xf')](_0x9fe7('0xc'),auth[_0x9fe7('0x8')](),controller[_0x9fe7('0x10')]);router[_0x9fe7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9fe7('0x12')]);module[_0x9fe7('0x13')]=router; \ No newline at end of file +var _0x9982=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','describe','/:id','post','isAuthenticated','create','update','delete','multer','path','express'];(function(_0x24b0ab,_0x19de60){var _0x12112c=function(_0x3977d9){while(--_0x3977d9){_0x24b0ab['push'](_0x24b0ab['shift']());}};_0x12112c(++_0x19de60);}(_0x9982,0x1ec));var _0x2998=function(_0x48f62a,_0x1b3782){_0x48f62a=_0x48f62a-0x0;var _0x4ebe15=_0x9982[_0x48f62a];return _0x4ebe15;};'use strict';var multer=require(_0x2998('0x0'));var util=require('util');var path=require(_0x2998('0x1'));var express=require(_0x2998('0x2'));var router=express['Router']();var auth=require(_0x2998('0x3'));var interaction=require(_0x2998('0x4'));var config=require(_0x2998('0x5'));var controller=require(_0x2998('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2998('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x2998('0x8')]);router[_0x2998('0x7')](_0x2998('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2998('0xa')]('/',auth[_0x2998('0xb')](),controller[_0x2998('0xc')]);router['put'](_0x2998('0x9'),auth['isAuthenticated'](),controller[_0x2998('0xd')]);router[_0x2998('0xe')](_0x2998('0x9'),auth[_0x2998('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 16dcaaa..ea4ecc7 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 _0x4d8c=['DATE','exports','STRING'];(function(_0x546fff,_0x128cc0){var _0x4e2d3a=function(_0x253bec){while(--_0x253bec){_0x546fff['push'](_0x546fff['shift']());}};_0x4e2d3a(++_0x128cc0);}(_0x4d8c,0x1b4));var _0xc4d8=function(_0x27dfaa,_0x58d8e){_0x27dfaa=_0x27dfaa-0x0;var _0x184d67=_0x4d8c[_0x27dfaa];return _0x184d67;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xc4d8('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc4d8('0x1')]},'joinAt':{'type':Sequelize[_0xc4d8('0x2')]},'leaveAt':{'type':Sequelize[_0xc4d8('0x2')]},'acceptAt':{'type':Sequelize[_0xc4d8('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc4d8('0x1')]}}; \ No newline at end of file +var _0x2a1c=['moment','exports','STRING','DATE'];(function(_0x3f8fab,_0x1c2c5b){var _0x249a46=function(_0x281882){while(--_0x281882){_0x3f8fab['push'](_0x3f8fab['shift']());}};_0x249a46(++_0x1c2c5b);}(_0x2a1c,0x144));var _0xc2a1=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2a1c[_0x110c3d];return _0x226d67;};'use strict';var moment=require(_0xc2a1('0x0'));var Sequelize=require('sequelize');module[_0xc2a1('0x1')]={'uniqueid':{'type':Sequelize[_0xc2a1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc2a1('0x2')]},'joinAt':{'type':Sequelize[_0xc2a1('0x3')]},'leaveAt':{'type':Sequelize[_0xc2a1('0x3')]},'acceptAt':{'type':Sequelize[_0xc2a1('0x3')]},'exitAt':{'type':Sequelize[_0xc2a1('0x3')]},'reason':{'type':Sequelize[_0xc2a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 9fefb64..9a6f76d 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 _0xd28a=['dateStart','dateEnd','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','add','day','where','merge','map','filter','includeAll','include','catch','show','params','options','find','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird','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','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','MailQueueReport','rawAttributes','keys','query'];(function(_0x47e6bc,_0x59f031){var _0x5afda6=function(_0x410277){while(--_0x410277){_0x47e6bc['push'](_0x47e6bc['shift']());}};_0x5afda6(++_0x59f031);}(_0xd28a,0xae));var _0xad28=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xd28a[_0x50007c];return _0x5c1ec7;};'use strict';var jsonpatch=require(_0xad28('0x0'));var rp=require(_0xad28('0x1'));var moment=require(_0xad28('0x2'));var BPromise=require(_0xad28('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xad28('0x4'));var sox=require(_0xad28('0x5'));var csv=require(_0xad28('0x6'));var ejs=require(_0xad28('0x7'));var fs=require('fs');var _=require(_0xad28('0x8'));var squel=require(_0xad28('0x9'));var crypto=require(_0xad28('0xa'));var jsforce=require(_0xad28('0xb'));var deskjs=require(_0xad28('0xc'));var toCsv=require(_0xad28('0x6'));var querystring=require(_0xad28('0xd'));var Papa=require(_0xad28('0xe'));var qs=require(_0xad28('0xf'));var logger=require(_0xad28('0x10'))(_0xad28('0x11'));var utils=require(_0xad28('0x12'));var config=require(_0xad28('0x13'));var db=require(_0xad28('0x14'))['db'];function respondWithStatusCode(_0x2076d8,_0x21f21f){_0x21f21f=_0x21f21f||0xcc;return function(_0x4cf895){if(_0x4cf895){return _0x2076d8[_0xad28('0x15')](_0x21f21f);}return _0x2076d8['status'](_0x21f21f)[_0xad28('0x16')]();};}function respondWithResult(_0x4acd92,_0x321a4b){_0x321a4b=_0x321a4b||0xc8;return function(_0x4c8afa){if(_0x4c8afa){return _0x4acd92[_0xad28('0x17')](_0x321a4b)[_0xad28('0x18')](_0x4c8afa);}};}function respondWithFilteredResult(_0x54f92f,_0x42cfd3){return function(_0x2b68db){if(_0x2b68db){var _0x3fb0de=_0x2b68db[_0xad28('0x19')],_0xdb1f6=_0x42cfd3[_0xad28('0x1a')],_0x32c498=_0x42cfd3[_0xad28('0x1a')]+_0x42cfd3[_0xad28('0x1b')],_0x55b8f7;if(_0x32c498>=_0x3fb0de){_0x32c498=_0x3fb0de;_0x55b8f7=0xc8;}else{_0x55b8f7=0xce;}_0x54f92f[_0xad28('0x17')](_0x55b8f7);return _0x54f92f[_0xad28('0x1c')](_0xad28('0x1d'),_0xdb1f6+'-'+_0x32c498+'/'+_0x3fb0de)[_0xad28('0x18')](_0x2b68db);}return null;};}function patchUpdates(_0x1612a4){return function(_0x4f8791){try{jsonpatch[_0xad28('0x1e')](_0x4f8791,_0x1612a4,!![]);}catch(_0x53f11a){return BPromise[_0xad28('0x1f')](_0x53f11a);}return _0x4f8791[_0xad28('0x20')]();};}function saveUpdates(_0x205a43,_0x29df1a){return function(_0x48bcad){if(_0x48bcad){return _0x48bcad[_0xad28('0x21')](_0x205a43)[_0xad28('0x22')](function(_0x46f4eb){return _0x46f4eb;});}return null;};}function removeEntity(_0x3e660f,_0x511c6f){return function(_0x5014ee){if(_0x5014ee){return _0x5014ee['destroy']()[_0xad28('0x22')](function(){_0x3e660f[_0xad28('0x17')](0xcc)[_0xad28('0x16')]();});}};}function handleEntityNotFound(_0xba9a93,_0x5409bf){return function(_0x476ee7){if(!_0x476ee7){_0xba9a93[_0xad28('0x15')](0x194);}return _0x476ee7;};}function handleError(_0x503d17,_0x17744a){_0x17744a=_0x17744a||0x1f4;return function(_0x56c912){logger[_0xad28('0x23')](_0x56c912['stack']);if(_0x56c912[_0xad28('0x24')]){delete _0x56c912['name'];}_0x503d17['status'](_0x17744a)['send'](_0x56c912);};}exports[_0xad28('0x25')]=function(_0x5c8f89,_0x3ae439){var _0x530c16={},_0xaeb738={},_0xbeb115={'count':0x0,'rows':[]};var _0xa925c8=db[_0xad28('0x26')][_0xad28('0x27')];_0xaeb738['model']=_[_0xad28('0x28')](_0xa925c8);var _0x3b8d92={'dateStart':_0x5c8f89[_0xad28('0x29')]['dateStart'],'dateEnd':_0x5c8f89[_0xad28('0x29')]['dateEnd']};delete _0x5c8f89[_0xad28('0x29')][_0xad28('0x2a')];delete _0x5c8f89[_0xad28('0x29')][_0xad28('0x2b')];_0xaeb738[_0xad28('0x29')]=_[_0xad28('0x28')](_0x5c8f89[_0xad28('0x29')]);_0xaeb738[_0xad28('0x2c')]=_['intersection'](_0xaeb738[_0xad28('0x2d')],_0xaeb738[_0xad28('0x29')]);_0x530c16['attributes']=_[_0xad28('0x2e')](_0xaeb738[_0xad28('0x2d')],qs[_0xad28('0x2f')](_0x5c8f89[_0xad28('0x29')][_0xad28('0x2f')]));_0x530c16[_0xad28('0x30')]=_0x530c16['attributes'][_0xad28('0x31')]?_0x530c16[_0xad28('0x30')]:_0xaeb738[_0xad28('0x2d')];if(!_0x5c8f89['query'][_0xad28('0x32')](_0xad28('0x33'))){_0x530c16[_0xad28('0x1b')]=qs[_0xad28('0x1b')](_0x5c8f89[_0xad28('0x29')][_0xad28('0x1b')]);_0x530c16[_0xad28('0x1a')]=qs[_0xad28('0x1a')](_0x5c8f89[_0xad28('0x29')][_0xad28('0x1a')]);}_0x530c16[_0xad28('0x34')]=qs['sort'](_0x5c8f89['query'][_0xad28('0x35')]);_0x530c16['where']=qs['filters'](_[_0xad28('0x36')](_0x5c8f89[_0xad28('0x29')],_0xaeb738[_0xad28('0x2c')]));if(_0x3b8d92['dateStart']){if(_0x3b8d92[_0xad28('0x2b')]){_0x3b8d92['dateEnd']=moment(_0x3b8d92['dateEnd'])[_0xad28('0x37')](0x1,_0xad28('0x38'));}else{_0x3b8d92['dateEnd']=moment(_0x3b8d92[_0xad28('0x2a')])[_0xad28('0x37')](0x1,_0xad28('0x38'));}_['merge'](_0x530c16[_0xad28('0x39')],{'createdAt':{'$gte':_0x3b8d92['dateStart'],'$lte':_0x3b8d92['dateEnd']}});}if(_0x5c8f89[_0xad28('0x29')]['filter']){_0x530c16[_0xad28('0x39')]=_[_0xad28('0x3a')](_0x530c16[_0xad28('0x39')],{'$or':_[_0xad28('0x3b')](_0x530c16[_0xad28('0x30')],function(_0x40d226){var _0x31500f={};_0x31500f[_0x40d226]={'$like':'%'+_0x5c8f89['query'][_0xad28('0x3c')]+'%'};return _0x31500f;})});}_0x530c16=_[_0xad28('0x3a')]({},_0x530c16,_0x5c8f89['options']);var _0x139fcb={'where':_0x530c16['where']};return db['MailQueueReport']['count'](_0x139fcb)['then'](function(_0x13f844){_0xbeb115[_0xad28('0x19')]=_0x13f844;if(_0x5c8f89['query'][_0xad28('0x3d')]){_0x530c16[_0xad28('0x3e')]=[{'all':!![]}];}return db[_0xad28('0x26')]['findAll'](_0x530c16);})[_0xad28('0x22')](function(_0xef7b4c){_0xbeb115['rows']=_0xef7b4c;return _0xbeb115;})[_0xad28('0x22')](respondWithFilteredResult(_0x3ae439,_0x530c16))[_0xad28('0x3f')](handleError(_0x3ae439,null));};exports[_0xad28('0x40')]=function(_0x5830a2,_0x56853d){var _0x39366f={'raw':!![],'where':{'id':_0x5830a2[_0xad28('0x41')]['id']}},_0x36ad68={};_0x36ad68[_0xad28('0x2d')]=_[_0xad28('0x28')](db[_0xad28('0x26')]['rawAttributes']);_0x36ad68[_0xad28('0x29')]=_[_0xad28('0x28')](_0x5830a2[_0xad28('0x29')]);_0x36ad68[_0xad28('0x2c')]=_[_0xad28('0x2e')](_0x36ad68[_0xad28('0x2d')],_0x36ad68['query']);_0x39366f[_0xad28('0x30')]=_[_0xad28('0x2e')](_0x36ad68[_0xad28('0x2d')],qs[_0xad28('0x2f')](_0x5830a2[_0xad28('0x29')][_0xad28('0x2f')]));_0x39366f[_0xad28('0x30')]=_0x39366f[_0xad28('0x30')][_0xad28('0x31')]?_0x39366f[_0xad28('0x30')]:_0x36ad68[_0xad28('0x2d')];if(_0x5830a2[_0xad28('0x29')][_0xad28('0x3d')]){_0x39366f[_0xad28('0x3e')]=[{'all':!![]}];}_0x39366f=_[_0xad28('0x3a')]({},_0x39366f,_0x5830a2[_0xad28('0x42')]);return db['MailQueueReport'][_0xad28('0x43')](_0x39366f)[_0xad28('0x22')](handleEntityNotFound(_0x56853d,null))[_0xad28('0x22')](respondWithResult(_0x56853d,null))['catch'](handleError(_0x56853d,null));};exports[_0xad28('0x44')]=function(_0x529603,_0x3cd1cd){return db[_0xad28('0x26')][_0xad28('0x44')](_0x529603[_0xad28('0x45')],{})[_0xad28('0x22')](respondWithResult(_0x3cd1cd,0xc9))[_0xad28('0x3f')](handleError(_0x3cd1cd,null));};exports[_0xad28('0x21')]=function(_0xfe82fe,_0x4073c8){if(_0xfe82fe['body']['id']){delete _0xfe82fe[_0xad28('0x45')]['id'];}return db[_0xad28('0x26')][_0xad28('0x43')]({'where':{'id':_0xfe82fe[_0xad28('0x41')]['id']}})['then'](handleEntityNotFound(_0x4073c8,null))[_0xad28('0x22')](saveUpdates(_0xfe82fe[_0xad28('0x45')],null))[_0xad28('0x22')](respondWithResult(_0x4073c8,null))[_0xad28('0x3f')](handleError(_0x4073c8,null));};exports[_0xad28('0x46')]=function(_0x597aae,_0x2fc573){return db['MailQueueReport'][_0xad28('0x43')]({'where':{'id':_0x597aae[_0xad28('0x41')]['id']}})['then'](handleEntityNotFound(_0x2fc573,null))[_0xad28('0x22')](removeEntity(_0x2fc573,null))[_0xad28('0x3f')](handleError(_0x2fc573,null));};exports[_0xad28('0x47')]=function(_0x55d977,_0x2f468d){return db[_0xad28('0x26')][_0xad28('0x47')]()[_0xad28('0x22')](respondWithResult(_0x2f468d,null))[_0xad28('0x3f')](handleError(_0x2f468d,null));}; \ No newline at end of file +var _0xf960=['sort','where','add','day','merge','filter','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','describe','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','json','count','offset','limit','status','Content-Range','apply','reject','save','then','end','error','name','send','index','MailQueueReport','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf960,0x8e));var _0x0f96=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xf960[_0x3de873];return _0x380b8c;};'use strict';var jsonpatch=require(_0x0f96('0x0'));var rp=require('request-promise');var moment=require(_0x0f96('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x0f96('0x2'));var util=require('util');var path=require(_0x0f96('0x3'));var sox=require(_0x0f96('0x4'));var csv=require(_0x0f96('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f96('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0f96('0x7'));var deskjs=require(_0x0f96('0x8'));var toCsv=require(_0x0f96('0x5'));var querystring=require(_0x0f96('0x9'));var Papa=require(_0x0f96('0xa'));var qs=require(_0x0f96('0xb'));var logger=require(_0x0f96('0xc'))('api');var utils=require(_0x0f96('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x778b1e,_0x4aa0db){_0x4aa0db=_0x4aa0db||0xcc;return function(_0x1bf49c){if(_0x1bf49c){return _0x778b1e[_0x0f96('0xe')](_0x4aa0db);}return _0x778b1e['status'](_0x4aa0db)['end']();};}function respondWithResult(_0x2d7995,_0x4c7672){_0x4c7672=_0x4c7672||0xc8;return function(_0x29aa18){if(_0x29aa18){return _0x2d7995['status'](_0x4c7672)[_0x0f96('0xf')](_0x29aa18);}};}function respondWithFilteredResult(_0x249893,_0x5e2ed4){return function(_0x7bf6d4){if(_0x7bf6d4){var _0x3f37f5=_0x7bf6d4[_0x0f96('0x10')],_0x2af0e3=_0x5e2ed4[_0x0f96('0x11')],_0x6e4239=_0x5e2ed4[_0x0f96('0x11')]+_0x5e2ed4[_0x0f96('0x12')],_0x582d09;if(_0x6e4239>=_0x3f37f5){_0x6e4239=_0x3f37f5;_0x582d09=0xc8;}else{_0x582d09=0xce;}_0x249893[_0x0f96('0x13')](_0x582d09);return _0x249893['set'](_0x0f96('0x14'),_0x2af0e3+'-'+_0x6e4239+'/'+_0x3f37f5)[_0x0f96('0xf')](_0x7bf6d4);}return null;};}function patchUpdates(_0x50e0a4){return function(_0x1f2770){try{jsonpatch[_0x0f96('0x15')](_0x1f2770,_0x50e0a4,!![]);}catch(_0x2463c1){return BPromise[_0x0f96('0x16')](_0x2463c1);}return _0x1f2770[_0x0f96('0x17')]();};}function saveUpdates(_0x43e99d,_0xd0edef){return function(_0x4d6f4c){if(_0x4d6f4c){return _0x4d6f4c['update'](_0x43e99d)[_0x0f96('0x18')](function(_0x39891b){return _0x39891b;});}return null;};}function removeEntity(_0x126da6,_0x4b1ec8){return function(_0x325c9b){if(_0x325c9b){return _0x325c9b['destroy']()[_0x0f96('0x18')](function(){_0x126da6[_0x0f96('0x13')](0xcc)[_0x0f96('0x19')]();});}};}function handleEntityNotFound(_0x72bbbb,_0x3b4a91){return function(_0x1af5f4){if(!_0x1af5f4){_0x72bbbb[_0x0f96('0xe')](0x194);}return _0x1af5f4;};}function handleError(_0xce6e76,_0x2e2351){_0x2e2351=_0x2e2351||0x1f4;return function(_0x2c77b2){logger[_0x0f96('0x1a')](_0x2c77b2['stack']);if(_0x2c77b2['name']){delete _0x2c77b2[_0x0f96('0x1b')];}_0xce6e76['status'](_0x2e2351)[_0x0f96('0x1c')](_0x2c77b2);};}exports[_0x0f96('0x1d')]=function(_0x3822ec,_0x2a6a78){var _0x19fff9={},_0x516df0={},_0x11d4d4={'count':0x0,'rows':[]};var _0x4a6627=db[_0x0f96('0x1e')]['rawAttributes'];_0x516df0[_0x0f96('0x1f')]=_['keys'](_0x4a6627);var _0x3f4576={'dateStart':_0x3822ec[_0x0f96('0x20')][_0x0f96('0x21')],'dateEnd':_0x3822ec[_0x0f96('0x20')]['dateEnd']};delete _0x3822ec[_0x0f96('0x20')][_0x0f96('0x21')];delete _0x3822ec['query'][_0x0f96('0x22')];_0x516df0[_0x0f96('0x20')]=_[_0x0f96('0x23')](_0x3822ec[_0x0f96('0x20')]);_0x516df0[_0x0f96('0x24')]=_[_0x0f96('0x25')](_0x516df0[_0x0f96('0x1f')],_0x516df0[_0x0f96('0x20')]);_0x19fff9[_0x0f96('0x26')]=_[_0x0f96('0x25')](_0x516df0[_0x0f96('0x1f')],qs[_0x0f96('0x27')](_0x3822ec[_0x0f96('0x20')][_0x0f96('0x27')]));_0x19fff9[_0x0f96('0x26')]=_0x19fff9[_0x0f96('0x26')][_0x0f96('0x28')]?_0x19fff9['attributes']:_0x516df0[_0x0f96('0x1f')];if(!_0x3822ec[_0x0f96('0x20')][_0x0f96('0x29')](_0x0f96('0x2a'))){_0x19fff9[_0x0f96('0x12')]=qs[_0x0f96('0x12')](_0x3822ec[_0x0f96('0x20')][_0x0f96('0x12')]);_0x19fff9[_0x0f96('0x11')]=qs['offset'](_0x3822ec[_0x0f96('0x20')][_0x0f96('0x11')]);}_0x19fff9[_0x0f96('0x2b')]=qs[_0x0f96('0x2c')](_0x3822ec[_0x0f96('0x20')][_0x0f96('0x2c')]);_0x19fff9[_0x0f96('0x2d')]=qs['filters'](_['pick'](_0x3822ec[_0x0f96('0x20')],_0x516df0[_0x0f96('0x24')]));if(_0x3f4576[_0x0f96('0x21')]){if(_0x3f4576[_0x0f96('0x22')]){_0x3f4576[_0x0f96('0x22')]=moment(_0x3f4576[_0x0f96('0x22')])[_0x0f96('0x2e')](0x1,'day');}else{_0x3f4576[_0x0f96('0x22')]=moment(_0x3f4576['dateStart'])[_0x0f96('0x2e')](0x1,_0x0f96('0x2f'));}_[_0x0f96('0x30')](_0x19fff9[_0x0f96('0x2d')],{'createdAt':{'$gte':_0x3f4576['dateStart'],'$lte':_0x3f4576[_0x0f96('0x22')]}});}if(_0x3822ec[_0x0f96('0x20')][_0x0f96('0x31')]){_0x19fff9[_0x0f96('0x2d')]=_[_0x0f96('0x30')](_0x19fff9[_0x0f96('0x2d')],{'$or':_['map'](_0x19fff9['attributes'],function(_0x23bc77){var _0x2d9ce7={};_0x2d9ce7[_0x23bc77]={'$like':'%'+_0x3822ec[_0x0f96('0x20')][_0x0f96('0x31')]+'%'};return _0x2d9ce7;})});}_0x19fff9=_[_0x0f96('0x30')]({},_0x19fff9,_0x3822ec[_0x0f96('0x32')]);var _0x64187f={'where':_0x19fff9['where']};return db[_0x0f96('0x1e')][_0x0f96('0x10')](_0x64187f)[_0x0f96('0x18')](function(_0x4f6404){_0x11d4d4[_0x0f96('0x10')]=_0x4f6404;if(_0x3822ec['query']['includeAll']){_0x19fff9[_0x0f96('0x33')]=[{'all':!![]}];}return db[_0x0f96('0x1e')][_0x0f96('0x34')](_0x19fff9);})[_0x0f96('0x18')](function(_0x2f6372){_0x11d4d4['rows']=_0x2f6372;return _0x11d4d4;})['then'](respondWithFilteredResult(_0x2a6a78,_0x19fff9))[_0x0f96('0x35')](handleError(_0x2a6a78,null));};exports[_0x0f96('0x36')]=function(_0x1c18cf,_0x36a47e){var _0x38310e={'raw':!![],'where':{'id':_0x1c18cf[_0x0f96('0x37')]['id']}},_0x2fdba6={};_0x2fdba6[_0x0f96('0x1f')]=_[_0x0f96('0x23')](db[_0x0f96('0x1e')][_0x0f96('0x38')]);_0x2fdba6[_0x0f96('0x20')]=_[_0x0f96('0x23')](_0x1c18cf[_0x0f96('0x20')]);_0x2fdba6[_0x0f96('0x24')]=_[_0x0f96('0x25')](_0x2fdba6[_0x0f96('0x1f')],_0x2fdba6['query']);_0x38310e[_0x0f96('0x26')]=_[_0x0f96('0x25')](_0x2fdba6[_0x0f96('0x1f')],qs[_0x0f96('0x27')](_0x1c18cf[_0x0f96('0x20')]['fields']));_0x38310e[_0x0f96('0x26')]=_0x38310e[_0x0f96('0x26')][_0x0f96('0x28')]?_0x38310e[_0x0f96('0x26')]:_0x2fdba6['model'];if(_0x1c18cf[_0x0f96('0x20')][_0x0f96('0x39')]){_0x38310e['include']=[{'all':!![]}];}_0x38310e=_[_0x0f96('0x30')]({},_0x38310e,_0x1c18cf[_0x0f96('0x32')]);return db[_0x0f96('0x1e')][_0x0f96('0x3a')](_0x38310e)[_0x0f96('0x18')](handleEntityNotFound(_0x36a47e,null))[_0x0f96('0x18')](respondWithResult(_0x36a47e,null))['catch'](handleError(_0x36a47e,null));};exports[_0x0f96('0x3b')]=function(_0xac41b5,_0x590bc7){return db['MailQueueReport'][_0x0f96('0x3b')](_0xac41b5[_0x0f96('0x3c')],{})[_0x0f96('0x18')](respondWithResult(_0x590bc7,0xc9))[_0x0f96('0x35')](handleError(_0x590bc7,null));};exports['update']=function(_0x26a6cd,_0x417a06){if(_0x26a6cd[_0x0f96('0x3c')]['id']){delete _0x26a6cd['body']['id'];}return db[_0x0f96('0x1e')]['find']({'where':{'id':_0x26a6cd[_0x0f96('0x37')]['id']}})[_0x0f96('0x18')](handleEntityNotFound(_0x417a06,null))[_0x0f96('0x18')](saveUpdates(_0x26a6cd[_0x0f96('0x3c')],null))[_0x0f96('0x18')](respondWithResult(_0x417a06,null))[_0x0f96('0x35')](handleError(_0x417a06,null));};exports['destroy']=function(_0x33b95c,_0x36241b){return db[_0x0f96('0x1e')][_0x0f96('0x3a')]({'where':{'id':_0x33b95c[_0x0f96('0x37')]['id']}})[_0x0f96('0x18')](handleEntityNotFound(_0x36241b,null))[_0x0f96('0x18')](removeEntity(_0x36241b,null))[_0x0f96('0x35')](handleError(_0x36241b,null));};exports[_0x0f96('0x3d')]=function(_0xb6b25f,_0xf6a980){return db[_0x0f96('0x1e')][_0x0f96('0x3d')]()['then'](respondWithResult(_0xf6a980,null))[_0x0f96('0x35')](handleError(_0xf6a980,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c81221f..f35e060 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 _0xf3e3=['api','bluebird','request-promise','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0xa6263f,_0x48e143){var _0x22fb0e=function(_0x2db8c8){while(--_0x2db8c8){_0xa6263f['push'](_0xa6263f['shift']());}};_0x22fb0e(++_0x48e143);}(_0xf3e3,0xad));var _0x3f3e=function(_0x3e59ed,_0x3b6d3b){_0x3e59ed=_0x3e59ed-0x0;var _0x300cfe=_0xf3e3[_0x3e59ed];return _0x300cfe;};'use strict';var _=require(_0x3f3e('0x0'));var util=require(_0x3f3e('0x1'));var logger=require(_0x3f3e('0x2'))(_0x3f3e('0x3'));var moment=require('moment');var BPromise=require(_0x3f3e('0x4'));var rp=require(_0x3f3e('0x5'));var attributes=require(_0x3f3e('0x6'));module[_0x3f3e('0x7')]=function(_0x54555c,_0x2c800d){return _0x54555c['define'](_0x3f3e('0x8'),attributes,{'tableName':_0x3f3e('0x9'),'paranoid':![],'indexes':[{'name':_0x3f3e('0xa'),'fields':[_0x3f3e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x283a=['define','MailQueueReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x1fdbcd,_0x3fd614){var _0x47e588=function(_0x24ff91){while(--_0x24ff91){_0x1fdbcd['push'](_0x1fdbcd['shift']());}};_0x47e588(++_0x3fd614);}(_0x283a,0x12f));var _0xa283=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x283a[_0x195577];return _0x13c367;};'use strict';var _=require(_0xa283('0x0'));var util=require('util');var logger=require(_0xa283('0x1'))(_0xa283('0x2'));var moment=require(_0xa283('0x3'));var BPromise=require(_0xa283('0x4'));var rp=require(_0xa283('0x5'));var attributes=require('./mailQueueReport.attributes');module[_0xa283('0x6')]=function(_0x2f1a6d,_0x494fb5){return _0x2f1a6d[_0xa283('0x7')](_0xa283('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xa283('0x9'),'fields':[_0xa283('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 5417527..3b75450 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 _0x2cd0=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x20be28,_0x24b925){var _0x8ab067=function(_0x314de9){while(--_0x314de9){_0x20be28['push'](_0x20be28['shift']());}};_0x8ab067(++_0x24b925);}(_0x2cd0,0xb8));var _0x02cd=function(_0x4287bd,_0x4b6c73){_0x4287bd=_0x4287bd-0x0;var _0x7a7d4b=_0x2cd0[_0x4287bd];return _0x7a7d4b;};'use strict';var _=require('lodash');var util=require(_0x02cd('0x0'));var moment=require(_0x02cd('0x1'));var BPromise=require(_0x02cd('0x2'));var rs=require(_0x02cd('0x3'));var fs=require('fs');var db=require(_0x02cd('0x4'))['db'];var utils=require(_0x02cd('0x5'));var logger=require(_0x02cd('0x6'))(_0x02cd('0x7'));var config=require(_0x02cd('0x8'));var jayson=require(_0x02cd('0x9'));var client=jayson[_0x02cd('0xa')][_0x02cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39df45,_0x2741da,_0x38309e){return new BPromise(function(_0x78a3a0,_0x3ff29a){return client[_0x02cd('0xc')](_0x39df45,_0x38309e)[_0x02cd('0xd')](function(_0x293bf9){logger[_0x02cd('0xe')](_0x02cd('0xf'),_0x2741da,_0x02cd('0x10'));logger[_0x02cd('0x11')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x2741da,'request\x20sent',JSON[_0x02cd('0x12')](_0x293bf9));if(_0x293bf9[_0x02cd('0x13')]){if(_0x293bf9[_0x02cd('0x13')][_0x02cd('0x14')]===0x1f4){logger[_0x02cd('0x13')](_0x02cd('0xf'),_0x2741da,_0x293bf9[_0x02cd('0x13')]['message']);return _0x3ff29a(_0x293bf9[_0x02cd('0x13')][_0x02cd('0x15')]);}logger[_0x02cd('0x13')](_0x02cd('0xf'),_0x2741da,_0x293bf9[_0x02cd('0x13')][_0x02cd('0x15')]);return _0x78a3a0(_0x293bf9[_0x02cd('0x13')]['message']);}else{logger[_0x02cd('0xe')](_0x02cd('0xf'),_0x2741da,_0x02cd('0x10'));_0x78a3a0(_0x293bf9[_0x02cd('0x16')]['message']);}})[_0x02cd('0x17')](function(_0x20a6a3){logger[_0x02cd('0x13')](_0x02cd('0xf'),_0x2741da,_0x20a6a3);_0x3ff29a(_0x20a6a3);});});}exports[_0x02cd('0x18')]=function(_0x4da693){var _0x538f80=this;return new Promise(function(_0x389ff8,_0x2b42a6){return db[_0x02cd('0x19')][_0x02cd('0x1a')](_0x4da693[_0x02cd('0x1b')],{'raw':_0x4da693[_0x02cd('0x1c')]?_0x4da693[_0x02cd('0x1c')][_0x02cd('0x1d')]===undefined?!![]:![]:!![]})[_0x02cd('0xd')](function(_0x59d325){logger[_0x02cd('0xe')]('CreateMailQueueReport',_0x4da693);logger['debug'](_0x02cd('0x18'),_0x4da693,JSON[_0x02cd('0x12')](_0x59d325));_0x389ff8(_0x59d325);})[_0x02cd('0x17')](function(_0x35306e){logger[_0x02cd('0x13')]('CreateMailQueueReport',_0x35306e[_0x02cd('0x15')],_0x4da693);_0x2b42a6(_0x538f80[_0x02cd('0x13')](0x1f4,_0x35306e[_0x02cd('0x15')]));});});};exports['UpdateMailQueueReport']=function(_0x552303){var _0x333bcf=this;return new Promise(function(_0x5cc55d,_0x3c01d9){return db['MailQueueReport'][_0x02cd('0x1e')](_0x552303[_0x02cd('0x1b')],{'raw':_0x552303[_0x02cd('0x1c')]?_0x552303[_0x02cd('0x1c')][_0x02cd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x552303[_0x02cd('0x1c')]?_0x552303['options'][_0x02cd('0x1f')]||null:null,'attributes':_0x552303[_0x02cd('0x1c')]?_0x552303[_0x02cd('0x1c')][_0x02cd('0x20')]||null:null,'limit':_0x552303[_0x02cd('0x1c')]?_0x552303[_0x02cd('0x1c')][_0x02cd('0x21')]||null:null})[_0x02cd('0xd')](function(_0x4d5514){logger[_0x02cd('0xe')](_0x02cd('0x22'),_0x552303);logger[_0x02cd('0x11')](_0x02cd('0x22'),_0x552303,JSON[_0x02cd('0x12')](_0x4d5514));_0x5cc55d(_0x4d5514);})[_0x02cd('0x17')](function(_0x361c31){logger['error']('UpdateMailQueueReport',_0x361c31['message'],_0x552303);_0x3c01d9(_0x333bcf[_0x02cd('0x13')](0x1f4,_0x361c31['message']));});});}; \ No newline at end of file +var _0x7005=['request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateMailQueueReport','MailQueueReport','body','options','debug','UpdateMailQueueReport','update','raw','attributes','limit','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s'];(function(_0x4ade2d,_0x25bd85){var _0x281be3=function(_0x40b9e1){while(--_0x40b9e1){_0x4ade2d['push'](_0x4ade2d['shift']());}};_0x281be3(++_0x25bd85);}(_0x7005,0x109));var _0x5700=function(_0x5cc391,_0x575e63){_0x5cc391=_0x5cc391-0x0;var _0xf8cd65=_0x7005[_0x5cc391];return _0xf8cd65;};'use strict';var _=require(_0x5700('0x0'));var util=require(_0x5700('0x1'));var moment=require('moment');var BPromise=require(_0x5700('0x2'));var rs=require(_0x5700('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5700('0x4'));var logger=require(_0x5700('0x5'))(_0x5700('0x6'));var config=require(_0x5700('0x7'));var jayson=require(_0x5700('0x8'));var client=jayson[_0x5700('0x9')][_0x5700('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159736,_0x2e14ee,_0x1a595d){return new BPromise(function(_0x258fe9,_0x207328){return client[_0x5700('0xb')](_0x159736,_0x1a595d)[_0x5700('0xc')](function(_0x43f842){logger['info'](_0x5700('0xd'),_0x2e14ee,_0x5700('0xe'));logger['debug'](_0x5700('0xf'),_0x2e14ee,_0x5700('0xe'),JSON[_0x5700('0x10')](_0x43f842));if(_0x43f842['error']){if(_0x43f842[_0x5700('0x11')]['code']===0x1f4){logger[_0x5700('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x2e14ee,_0x43f842[_0x5700('0x11')]['message']);return _0x207328(_0x43f842[_0x5700('0x11')][_0x5700('0x12')]);}logger[_0x5700('0x11')](_0x5700('0xd'),_0x2e14ee,_0x43f842['error']['message']);return _0x258fe9(_0x43f842[_0x5700('0x11')][_0x5700('0x12')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x2e14ee,_0x5700('0xe'));_0x258fe9(_0x43f842['result']['message']);}})[_0x5700('0x13')](function(_0x423df5){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x2e14ee,_0x423df5);_0x207328(_0x423df5);});});}exports[_0x5700('0x14')]=function(_0x36eba0){var _0x5c98d3=this;return new Promise(function(_0x194ed4,_0x534a15){return db[_0x5700('0x15')]['create'](_0x36eba0[_0x5700('0x16')],{'raw':_0x36eba0[_0x5700('0x17')]?_0x36eba0[_0x5700('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xd4e09b){logger['info'](_0x5700('0x14'),_0x36eba0);logger[_0x5700('0x18')](_0x5700('0x14'),_0x36eba0,JSON[_0x5700('0x10')](_0xd4e09b));_0x194ed4(_0xd4e09b);})[_0x5700('0x13')](function(_0x32ae30){logger[_0x5700('0x11')](_0x5700('0x14'),_0x32ae30[_0x5700('0x12')],_0x36eba0);_0x534a15(_0x5c98d3[_0x5700('0x11')](0x1f4,_0x32ae30[_0x5700('0x12')]));});});};exports[_0x5700('0x19')]=function(_0xfb604b){var _0x5ef306=this;return new Promise(function(_0x7c4262,_0x3d5311){return db[_0x5700('0x15')][_0x5700('0x1a')](_0xfb604b[_0x5700('0x16')],{'raw':_0xfb604b[_0x5700('0x17')]?_0xfb604b['options'][_0x5700('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfb604b['options']?_0xfb604b[_0x5700('0x17')]['where']||null:null,'attributes':_0xfb604b[_0x5700('0x17')]?_0xfb604b[_0x5700('0x17')][_0x5700('0x1c')]||null:null,'limit':_0xfb604b[_0x5700('0x17')]?_0xfb604b[_0x5700('0x17')][_0x5700('0x1d')]||null:null})[_0x5700('0xc')](function(_0xf55bdc){logger[_0x5700('0x1e')](_0x5700('0x19'),_0xfb604b);logger[_0x5700('0x18')]('UpdateMailQueueReport',_0xfb604b,JSON[_0x5700('0x10')](_0xf55bdc));_0x7c4262(_0xf55bdc);})[_0x5700('0x13')](function(_0x4ee719){logger[_0x5700('0x11')](_0x5700('0x19'),_0x4ee719['message'],_0xfb604b);_0x3d5311(_0x5ef306[_0x5700('0x11')](0x1f4,_0x4ee719[_0x5700('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 9b939dc..d1ff8be 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 _0xcf52=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x2d50ba,_0xb664b8){var _0x31c5bc=function(_0x336d27){while(--_0x336d27){_0x2d50ba['push'](_0x2d50ba['shift']());}};_0x31c5bc(++_0xb664b8);}(_0xcf52,0x74));var _0x2cf5=function(_0x2743ea,_0x4652ef){_0x2743ea=_0x2743ea-0x0;var _0x164090=_0xcf52[_0x2743ea];return _0x164090;};'use strict';var multer=require(_0x2cf5('0x0'));var util=require(_0x2cf5('0x1'));var path=require(_0x2cf5('0x2'));var express=require(_0x2cf5('0x3'));var router=express[_0x2cf5('0x4')]();var auth=require(_0x2cf5('0x5'));var interaction=require(_0x2cf5('0x6'));var config=require(_0x2cf5('0x7'));module[_0x2cf5('0x8')]=router; \ No newline at end of file +var _0xf684=['express','../../components/auth/service','../../config/environment','exports','multer','util','path'];(function(_0x194d61,_0x2a1696){var _0x16c05b=function(_0x4ac7ec){while(--_0x4ac7ec){_0x194d61['push'](_0x194d61['shift']());}};_0x16c05b(++_0x2a1696);}(_0xf684,0xdd));var _0x4f68=function(_0x1768ab,_0x19371c){_0x1768ab=_0x1768ab-0x0;var _0x52b160=_0xf684[_0x1768ab];return _0x52b160;};'use strict';var multer=require(_0x4f68('0x0'));var util=require(_0x4f68('0x1'));var path=require(_0x4f68('0x2'));var express=require(_0x4f68('0x3'));var router=express['Router']();var auth=require(_0x4f68('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4f68('0x5'));module[_0x4f68('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 9a93eee..9373179 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 _0x57f8=['exports','STRING','BOOLEAN','username','INTEGER','INBOX'];(function(_0x38a162,_0x5b6cfe){var _0x5c5810=function(_0x458844){while(--_0x458844){_0x38a162['push'](_0x38a162['shift']());}};_0x5c5810(++_0x5b6cfe);}(_0x57f8,0x198));var _0x857f=function(_0x4e7551,_0x398ee5){_0x4e7551=_0x4e7551-0x0;var _0x2c2ae8=_0x57f8[_0x4e7551];return _0x2c2ae8;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'description':{'type':Sequelize[_0x857f('0x1')]},'host':{'type':Sequelize[_0x857f('0x1')]},'authentication':{'type':Sequelize[_0x857f('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x857f('0x1')],'unique':_0x857f('0x3')},'password':{'type':Sequelize[_0x857f('0x1')]},'port':{'type':Sequelize[_0x857f('0x4')]},'tls':{'type':Sequelize[_0x857f('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x857f('0x1')],'defaultValue':_0x857f('0x5')},'connTimeout':{'type':Sequelize[_0x857f('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x857f('0x1')]}}; \ No newline at end of file +var _0xd404=['BOOLEAN','username','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x1863fb,_0x3304d3){var _0x3c7735=function(_0x4fc0bb){while(--_0x4fc0bb){_0x1863fb['push'](_0x1863fb['shift']());}};_0x3c7735(++_0x3304d3);}(_0xd404,0x15b));var _0x4d40=function(_0x19977c,_0x42c3df){_0x19977c=_0x19977c-0x0;var _0x28ef04=_0xd404[_0x19977c];return _0x28ef04;};'use strict';var Sequelize=require(_0x4d40('0x0'));module[_0x4d40('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4d40('0x2')]},'authentication':{'type':Sequelize[_0x4d40('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x4d40('0x4')},'password':{'type':Sequelize[_0x4d40('0x2')]},'port':{'type':Sequelize[_0x4d40('0x5')]},'tls':{'type':Sequelize[_0x4d40('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4d40('0x2')],'defaultValue':_0x4d40('0x6')},'connTimeout':{'type':Sequelize[_0x4d40('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4d40('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4d40('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5ec29aa..76c060e 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 _0x2c54=['request-promise','./mailServerIn.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5bf21f,_0x556655){var _0x5c09b1=function(_0xeecb8f){while(--_0xeecb8f){_0x5bf21f['push'](_0x5bf21f['shift']());}};_0x5c09b1(++_0x556655);}(_0x2c54,0x136));var _0x42c5=function(_0x5e2955,_0x58152b){_0x5e2955=_0x5e2955-0x0;var _0x5ae032=_0x2c54[_0x5e2955];return _0x5ae032;};'use strict';var _=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var logger=require(_0x42c5('0x2'))('api');var moment=require(_0x42c5('0x3'));var BPromise=require(_0x42c5('0x4'));var rp=require(_0x42c5('0x5'));var attributes=require(_0x42c5('0x6'));module[_0x42c5('0x7')]=function(_0x17924f,_0x5bb3d8){return _0x17924f[_0x42c5('0x8')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5127=['define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','request-promise','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5127,0x18f));var _0x7512=function(_0x2d96f1,_0xa647e4){_0x2d96f1=_0x2d96f1-0x0;var _0x41a5b0=_0x5127[_0x2d96f1];return _0x41a5b0;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7512('0x4'));var attributes=require('./mailServerIn.attributes');module[_0x7512('0x5')]=function(_0x2768d5,_0x3659a2){return _0x2768d5[_0x7512('0x6')](_0x7512('0x7'),attributes,{'tableName':_0x7512('0x8'),'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 311c731..ae995c8 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 _0xeea4=['MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','debug'];(function(_0x36bc9a,_0x352b6f){var _0x4f508=function(_0x29a715){while(--_0x29a715){_0x36bc9a['push'](_0x36bc9a['shift']());}};_0x4f508(++_0x352b6f);}(_0xeea4,0x19e));var _0x4eea=function(_0x4f2422,_0x16b08a){_0x4f2422=_0x4f2422-0x0;var _0x4fb6f0=_0xeea4[_0x4f2422];return _0x4fb6f0;};'use strict';var _=require(_0x4eea('0x0'));var util=require(_0x4eea('0x1'));var moment=require(_0x4eea('0x2'));var BPromise=require(_0x4eea('0x3'));var rs=require(_0x4eea('0x4'));var fs=require('fs');var db=require(_0x4eea('0x5'))['db'];var utils=require(_0x4eea('0x6'));var logger=require(_0x4eea('0x7'))(_0x4eea('0x8'));var config=require('../../config/environment');var jayson=require(_0x4eea('0x9'));var client=jayson['client'][_0x4eea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x383566,_0x3d5aa8,_0x48538e){return new BPromise(function(_0x1a2e5e,_0x44116a){return client['request'](_0x383566,_0x48538e)[_0x4eea('0xb')](function(_0x3e2b87){logger[_0x4eea('0xc')](_0x4eea('0xd'),_0x3d5aa8,'request\x20sent');logger[_0x4eea('0xe')](_0x4eea('0xf'),_0x3d5aa8,_0x4eea('0x10'),JSON[_0x4eea('0x11')](_0x3e2b87));if(_0x3e2b87[_0x4eea('0x12')]){if(_0x3e2b87[_0x4eea('0x12')][_0x4eea('0x13')]===0x1f4){logger[_0x4eea('0x12')](_0x4eea('0xd'),_0x3d5aa8,_0x3e2b87[_0x4eea('0x12')]['message']);return _0x44116a(_0x3e2b87['error'][_0x4eea('0x14')]);}logger[_0x4eea('0x12')](_0x4eea('0xd'),_0x3d5aa8,_0x3e2b87[_0x4eea('0x12')][_0x4eea('0x14')]);return _0x1a2e5e(_0x3e2b87[_0x4eea('0x12')][_0x4eea('0x14')]);}else{logger[_0x4eea('0xc')]('MailServerIn,\x20%s,\x20%s',_0x3d5aa8,_0x4eea('0x10'));_0x1a2e5e(_0x3e2b87[_0x4eea('0x15')][_0x4eea('0x14')]);}})[_0x4eea('0x16')](function(_0x518329){logger[_0x4eea('0x12')](_0x4eea('0xd'),_0x3d5aa8,_0x518329);_0x44116a(_0x518329);});});}exports[_0x4eea('0x17')]=function(_0x33cb40){var _0x27a227=this;return new Promise(function(_0x5bd90b,_0x1571f3){return db[_0x4eea('0x18')]['findAll']({'raw':_0x33cb40[_0x4eea('0x19')]?_0x33cb40[_0x4eea('0x19')][_0x4eea('0x1a')]===undefined?!![]:![]:!![],'where':_0x33cb40[_0x4eea('0x19')]?_0x33cb40[_0x4eea('0x19')][_0x4eea('0x1b')]||null:null,'attributes':_0x33cb40['options']?_0x33cb40[_0x4eea('0x19')][_0x4eea('0x1c')]||null:null,'limit':_0x33cb40[_0x4eea('0x19')]?_0x33cb40[_0x4eea('0x19')][_0x4eea('0x1d')]||null:null,'include':_0x33cb40['options']?_0x33cb40['options'][_0x4eea('0x1e')]?_['map'](_0x33cb40['options']['include'],function(_0x37f024){return{'model':db[_0x37f024[_0x4eea('0x1f')]],'as':_0x37f024['as'],'attributes':_0x37f024['attributes'],'include':_0x37f024[_0x4eea('0x1e')]?_['map'](_0x37f024[_0x4eea('0x1e')],function(_0x594e2d){return{'model':db[_0x594e2d[_0x4eea('0x1f')]],'as':_0x594e2d['as'],'attributes':_0x594e2d['attributes'],'include':_0x594e2d[_0x4eea('0x1e')]?_[_0x4eea('0x20')](_0x594e2d[_0x4eea('0x1e')],function(_0x430a46){return{'model':db[_0x430a46[_0x4eea('0x1f')]],'as':_0x430a46['as'],'attributes':_0x430a46[_0x4eea('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4eea('0xb')](function(_0x22939b){logger[_0x4eea('0xc')](_0x4eea('0x17'),_0x33cb40);logger[_0x4eea('0xe')]('GetMailServerIn',_0x33cb40,JSON['stringify'](_0x22939b));_0x5bd90b(_0x22939b);})[_0x4eea('0x16')](function(_0x3eeb41){logger['error']('GetMailServerIn',_0x3eeb41['message'],_0x33cb40);_0x1571f3(_0x27a227[_0x4eea('0x12')](0x1f4,_0x3eeb41['message']));});});}; \ No newline at end of file +var _0x4b07=['where','limit','include','map','model','attributes','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','raw','options'];(function(_0x581bc7,_0x2ce3c5){var _0x2d951d=function(_0x263479){while(--_0x263479){_0x581bc7['push'](_0x581bc7['shift']());}};_0x2d951d(++_0x2ce3c5);}(_0x4b07,0x1d6));var _0x74b0=function(_0x1bd5f7,_0x3a3e1d){_0x1bd5f7=_0x1bd5f7-0x0;var _0x309d5b=_0x4b07[_0x1bd5f7];return _0x309d5b;};'use strict';var _=require('lodash');var util=require(_0x74b0('0x0'));var moment=require(_0x74b0('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b0('0x2'));var fs=require('fs');var db=require(_0x74b0('0x3'))['db'];var utils=require(_0x74b0('0x4'));var logger=require(_0x74b0('0x5'))('rpc');var config=require(_0x74b0('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42e551,_0x459c2d,_0x48ec87){return new BPromise(function(_0x5ea430,_0x45183d){return client['request'](_0x42e551,_0x48ec87)[_0x74b0('0x7')](function(_0x36bb9d){logger[_0x74b0('0x8')](_0x74b0('0x9'),_0x459c2d,_0x74b0('0xa'));logger[_0x74b0('0xb')](_0x74b0('0xc'),_0x459c2d,_0x74b0('0xa'),JSON[_0x74b0('0xd')](_0x36bb9d));if(_0x36bb9d[_0x74b0('0xe')]){if(_0x36bb9d[_0x74b0('0xe')][_0x74b0('0xf')]===0x1f4){logger[_0x74b0('0xe')](_0x74b0('0x9'),_0x459c2d,_0x36bb9d[_0x74b0('0xe')][_0x74b0('0x10')]);return _0x45183d(_0x36bb9d['error'][_0x74b0('0x10')]);}logger[_0x74b0('0xe')]('MailServerIn,\x20%s,\x20%s',_0x459c2d,_0x36bb9d[_0x74b0('0xe')]['message']);return _0x5ea430(_0x36bb9d[_0x74b0('0xe')][_0x74b0('0x10')]);}else{logger['info'](_0x74b0('0x9'),_0x459c2d,'request\x20sent');_0x5ea430(_0x36bb9d[_0x74b0('0x11')]['message']);}})[_0x74b0('0x12')](function(_0x547b94){logger[_0x74b0('0xe')](_0x74b0('0x9'),_0x459c2d,_0x547b94);_0x45183d(_0x547b94);});});}exports[_0x74b0('0x13')]=function(_0x6de971){var _0x26deb1=this;return new Promise(function(_0x1e39a4,_0x8425cc){return db[_0x74b0('0x14')]['findAll']({'raw':_0x6de971['options']?_0x6de971['options'][_0x74b0('0x15')]===undefined?!![]:![]:!![],'where':_0x6de971['options']?_0x6de971[_0x74b0('0x16')][_0x74b0('0x17')]||null:null,'attributes':_0x6de971[_0x74b0('0x16')]?_0x6de971[_0x74b0('0x16')]['attributes']||null:null,'limit':_0x6de971[_0x74b0('0x16')]?_0x6de971[_0x74b0('0x16')][_0x74b0('0x18')]||null:null,'include':_0x6de971[_0x74b0('0x16')]?_0x6de971['options'][_0x74b0('0x19')]?_[_0x74b0('0x1a')](_0x6de971[_0x74b0('0x16')][_0x74b0('0x19')],function(_0x3e70d5){return{'model':db[_0x3e70d5[_0x74b0('0x1b')]],'as':_0x3e70d5['as'],'attributes':_0x3e70d5[_0x74b0('0x1c')],'include':_0x3e70d5[_0x74b0('0x19')]?_[_0x74b0('0x1a')](_0x3e70d5['include'],function(_0x17bdf8){return{'model':db[_0x17bdf8['model']],'as':_0x17bdf8['as'],'attributes':_0x17bdf8['attributes'],'include':_0x17bdf8[_0x74b0('0x19')]?_[_0x74b0('0x1a')](_0x17bdf8[_0x74b0('0x19')],function(_0x4e78e1){return{'model':db[_0x4e78e1[_0x74b0('0x1b')]],'as':_0x4e78e1['as'],'attributes':_0x4e78e1[_0x74b0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x74b0('0x7')](function(_0x531fee){logger['info'](_0x74b0('0x13'),_0x6de971);logger[_0x74b0('0xb')](_0x74b0('0x13'),_0x6de971,JSON[_0x74b0('0xd')](_0x531fee));_0x1e39a4(_0x531fee);})[_0x74b0('0x12')](function(_0x1ab14d){logger['error'](_0x74b0('0x13'),_0x1ab14d['message'],_0x6de971);_0x8425cc(_0x26deb1[_0x74b0('0xe')](0x1f4,_0x1ab14d[_0x74b0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 01647d0..75be225 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 _0x814b=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x308f51,_0x32466e){var _0x8e1b3e=function(_0x1f00c9){while(--_0x1f00c9){_0x308f51['push'](_0x308f51['shift']());}};_0x8e1b3e(++_0x32466e);}(_0x814b,0x1a2));var _0xb814=function(_0x33314d,_0x499628){_0x33314d=_0x33314d-0x0;var _0x4ffe8e=_0x814b[_0x33314d];return _0x4ffe8e;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var express=require(_0xb814('0x3'));var router=express[_0xb814('0x4')]();var auth=require(_0xb814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb814('0x6'));var controller=require(_0xb814('0x7'));router[_0xb814('0x8')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xa')]);router[_0xb814('0x8')]('/:id',auth[_0xb814('0x9')](),controller[_0xb814('0xb')]);router['post']('/',auth[_0xb814('0x9')](),controller[_0xb814('0xc')]);router[_0xb814('0xd')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0x11')]);module[_0xb814('0x12')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x1de029,_0x3c3680){var _0x39fca0=function(_0x35e7e1){while(--_0x35e7e1){_0x1de029['push'](_0x1de029['shift']());}};_0x39fca0(++_0x3c3680);}(_0x814b,0x1a2));var _0xb814=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0x814b[_0x301dab];return _0x2500a2;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var express=require(_0xb814('0x3'));var router=express[_0xb814('0x4')]();var auth=require(_0xb814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb814('0x6'));var controller=require(_0xb814('0x7'));router[_0xb814('0x8')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xa')]);router[_0xb814('0x8')]('/:id',auth[_0xb814('0x9')](),controller[_0xb814('0xb')]);router['post']('/',auth[_0xb814('0x9')](),controller[_0xb814('0xc')]);router[_0xb814('0xd')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0x11')]);module[_0xb814('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ae7e85a..08269d3 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 _0xe64f=['STRING','BOOLEAN','sequelize'];(function(_0x14a4ef,_0x111959){var _0x1b0a90=function(_0x3eff87){while(--_0x3eff87){_0x14a4ef['push'](_0x14a4ef['shift']());}};_0x1b0a90(++_0x111959);}(_0xe64f,0x1d0));var _0xfe64=function(_0x30f9c1,_0x8d0c30){_0x30f9c1=_0x30f9c1-0x0;var _0x222043=_0xe64f[_0x30f9c1];return _0x222043;};'use strict';var Sequelize=require(_0xfe64('0x0'));module['exports']={'description':{'type':Sequelize[_0xfe64('0x1')]},'host':{'type':Sequelize[_0xfe64('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfe64('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xfe64('0x1')]},'authentication':{'type':Sequelize[_0xfe64('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc555=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0xbd1827,_0x4ca127){var _0x5c6141=function(_0x1cfeed){while(--_0x1cfeed){_0xbd1827['push'](_0xbd1827['shift']());}};_0x5c6141(++_0x4ca127);}(_0xc555,0xe4));var _0x5c55=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc555[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5c55('0x0'));module[_0x5c55('0x1')]={'description':{'type':Sequelize[_0x5c55('0x2')]},'host':{'type':Sequelize[_0x5c55('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5c55('0x3')]},'secure':{'type':Sequelize[_0x5c55('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'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 1e5ca0f..e352a7e 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 _0xcf8e=['util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','add','day','merge','filter','map','options','includeAll','findAll','rows','catch','show','params','keys','fields','find','create','body','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xcf8e,0x82));var _0xecf8=function(_0x4a8212,_0x845821){_0x4a8212=_0x4a8212-0x0;var _0x36a3c0=_0xcf8e[_0x4a8212];return _0x36a3c0;};'use strict';var jsonpatch=require(_0xecf8('0x0'));var rp=require(_0xecf8('0x1'));var moment=require('moment');var BPromise=require(_0xecf8('0x2'));var Mustache=require(_0xecf8('0x3'));var util=require(_0xecf8('0x4'));var path=require('path');var sox=require(_0xecf8('0x5'));var csv=require('to-csv');var ejs=require(_0xecf8('0x6'));var fs=require('fs');var _=require(_0xecf8('0x7'));var squel=require(_0xecf8('0x8'));var crypto=require('crypto');var jsforce=require(_0xecf8('0x9'));var deskjs=require(_0xecf8('0xa'));var toCsv=require(_0xecf8('0xb'));var querystring=require(_0xecf8('0xc'));var Papa=require(_0xecf8('0xd'));var qs=require(_0xecf8('0xe'));var logger=require(_0xecf8('0xf'))(_0xecf8('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xecf8('0x11'))['db'];function respondWithStatusCode(_0x3cc9fb,_0x430e57){_0x430e57=_0x430e57||0xcc;return function(_0x34a6eb){if(_0x34a6eb){return _0x3cc9fb[_0xecf8('0x12')](_0x430e57);}return _0x3cc9fb['status'](_0x430e57)[_0xecf8('0x13')]();};}function respondWithResult(_0x184be9,_0x507d8e){_0x507d8e=_0x507d8e||0xc8;return function(_0x1e7e4e){if(_0x1e7e4e){return _0x184be9['status'](_0x507d8e)[_0xecf8('0x14')](_0x1e7e4e);}};}function respondWithFilteredResult(_0x3a1571,_0x5887f3){return function(_0x3c38c8){if(_0x3c38c8){var _0x4d3ba4=_0x3c38c8[_0xecf8('0x15')],_0x7fbf58=_0x5887f3['offset'],_0x58967f=_0x5887f3[_0xecf8('0x16')]+_0x5887f3[_0xecf8('0x17')],_0x26663f;if(_0x58967f>=_0x4d3ba4){_0x58967f=_0x4d3ba4;_0x26663f=0xc8;}else{_0x26663f=0xce;}_0x3a1571[_0xecf8('0x18')](_0x26663f);return _0x3a1571[_0xecf8('0x19')](_0xecf8('0x1a'),_0x7fbf58+'-'+_0x58967f+'/'+_0x4d3ba4)[_0xecf8('0x14')](_0x3c38c8);}return null;};}function patchUpdates(_0x32e318){return function(_0xc2fbc8){try{jsonpatch['apply'](_0xc2fbc8,_0x32e318,!![]);}catch(_0xd70ba4){return BPromise['reject'](_0xd70ba4);}return _0xc2fbc8[_0xecf8('0x1b')]();};}function saveUpdates(_0x5978f3,_0x2cda08){return function(_0x33b040){if(_0x33b040){return _0x33b040[_0xecf8('0x1c')](_0x5978f3)[_0xecf8('0x1d')](function(_0x1b6210){return _0x1b6210;});}return null;};}function removeEntity(_0xd13b14,_0x576159){return function(_0x4107ea){if(_0x4107ea){return _0x4107ea[_0xecf8('0x1e')]()[_0xecf8('0x1d')](function(){_0xd13b14['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x467b2d,_0x256331){return function(_0x3dd316){if(!_0x3dd316){_0x467b2d['sendStatus'](0x194);}return _0x3dd316;};}function handleError(_0x430752,_0x39dd45){_0x39dd45=_0x39dd45||0x1f4;return function(_0x5a4ee4){logger[_0xecf8('0x1f')](_0x5a4ee4[_0xecf8('0x20')]);if(_0x5a4ee4[_0xecf8('0x21')]){delete _0x5a4ee4['name'];}_0x430752[_0xecf8('0x18')](_0x39dd45)[_0xecf8('0x22')](_0x5a4ee4);};}exports[_0xecf8('0x23')]=function(_0x28fc23,_0x461e8d){var _0x1014f5={},_0x3c1ccd={},_0x3fc61f={'count':0x0,'rows':[]};var _0x1fa9f5=db[_0xecf8('0x24')][_0xecf8('0x25')];_0x3c1ccd[_0xecf8('0x26')]=_['keys'](_0x1fa9f5);var _0x4ab97a={'dateStart':_0x28fc23[_0xecf8('0x27')][_0xecf8('0x28')],'dateEnd':_0x28fc23[_0xecf8('0x27')][_0xecf8('0x29')]};delete _0x28fc23[_0xecf8('0x27')][_0xecf8('0x28')];delete _0x28fc23['query']['dateEnd'];_0x3c1ccd[_0xecf8('0x27')]=_['keys'](_0x28fc23['query']);_0x3c1ccd[_0xecf8('0x2a')]=_[_0xecf8('0x2b')](_0x3c1ccd[_0xecf8('0x26')],_0x3c1ccd[_0xecf8('0x27')]);_0x1014f5[_0xecf8('0x2c')]=_[_0xecf8('0x2b')](_0x3c1ccd[_0xecf8('0x26')],qs['fields'](_0x28fc23[_0xecf8('0x27')]['fields']));_0x1014f5[_0xecf8('0x2c')]=_0x1014f5['attributes'][_0xecf8('0x2d')]?_0x1014f5[_0xecf8('0x2c')]:_0x3c1ccd[_0xecf8('0x26')];if(!_0x28fc23[_0xecf8('0x27')][_0xecf8('0x2e')](_0xecf8('0x2f'))){_0x1014f5[_0xecf8('0x17')]=qs[_0xecf8('0x17')](_0x28fc23[_0xecf8('0x27')]['limit']);_0x1014f5[_0xecf8('0x16')]=qs[_0xecf8('0x16')](_0x28fc23[_0xecf8('0x27')][_0xecf8('0x16')]);}_0x1014f5['order']=qs[_0xecf8('0x30')](_0x28fc23['query']['sort']);_0x1014f5[_0xecf8('0x31')]=qs[_0xecf8('0x2a')](_['pick'](_0x28fc23[_0xecf8('0x27')],_0x3c1ccd['filters']));if(_0x4ab97a[_0xecf8('0x28')]){if(_0x4ab97a['dateEnd']){_0x4ab97a['dateEnd']=moment(_0x4ab97a[_0xecf8('0x29')])[_0xecf8('0x32')](0x1,_0xecf8('0x33'));}else{_0x4ab97a[_0xecf8('0x29')]=moment(_0x4ab97a[_0xecf8('0x28')])['add'](0x1,'day');}_[_0xecf8('0x34')](_0x1014f5[_0xecf8('0x31')],{'createdAt':{'$gte':_0x4ab97a[_0xecf8('0x28')],'$lte':_0x4ab97a[_0xecf8('0x29')]}});}if(_0x28fc23[_0xecf8('0x27')][_0xecf8('0x35')]){_0x1014f5['where']=_[_0xecf8('0x34')](_0x1014f5[_0xecf8('0x31')],{'$or':_[_0xecf8('0x36')](_0x1014f5[_0xecf8('0x2c')],function(_0x4d4dd4){var _0x5ee742={};_0x5ee742[_0x4d4dd4]={'$like':'%'+_0x28fc23[_0xecf8('0x27')][_0xecf8('0x35')]+'%'};return _0x5ee742;})});}_0x1014f5=_['merge']({},_0x1014f5,_0x28fc23[_0xecf8('0x37')]);var _0x4f6329={'where':_0x1014f5[_0xecf8('0x31')]};return db[_0xecf8('0x24')][_0xecf8('0x15')](_0x4f6329)[_0xecf8('0x1d')](function(_0x47a620){_0x3fc61f[_0xecf8('0x15')]=_0x47a620;if(_0x28fc23['query'][_0xecf8('0x38')]){_0x1014f5['include']=[{'all':!![]}];}return db[_0xecf8('0x24')][_0xecf8('0x39')](_0x1014f5);})[_0xecf8('0x1d')](function(_0x40dc8a){_0x3fc61f[_0xecf8('0x3a')]=_0x40dc8a;return _0x3fc61f;})[_0xecf8('0x1d')](respondWithFilteredResult(_0x461e8d,_0x1014f5))[_0xecf8('0x3b')](handleError(_0x461e8d,null));};exports[_0xecf8('0x3c')]=function(_0x4fece8,_0x324ee6){var _0x1748ae={'raw':!![],'where':{'id':_0x4fece8[_0xecf8('0x3d')]['id']}},_0x42e581={};_0x42e581[_0xecf8('0x26')]=_['keys'](db['MailServerOut'][_0xecf8('0x25')]);_0x42e581[_0xecf8('0x27')]=_[_0xecf8('0x3e')](_0x4fece8[_0xecf8('0x27')]);_0x42e581['filters']=_[_0xecf8('0x2b')](_0x42e581[_0xecf8('0x26')],_0x42e581['query']);_0x1748ae[_0xecf8('0x2c')]=_[_0xecf8('0x2b')](_0x42e581[_0xecf8('0x26')],qs[_0xecf8('0x3f')](_0x4fece8[_0xecf8('0x27')][_0xecf8('0x3f')]));_0x1748ae[_0xecf8('0x2c')]=_0x1748ae['attributes'][_0xecf8('0x2d')]?_0x1748ae[_0xecf8('0x2c')]:_0x42e581[_0xecf8('0x26')];if(_0x4fece8['query'][_0xecf8('0x38')]){_0x1748ae['include']=[{'all':!![]}];}_0x1748ae=_[_0xecf8('0x34')]({},_0x1748ae,_0x4fece8[_0xecf8('0x37')]);return db['MailServerOut'][_0xecf8('0x40')](_0x1748ae)[_0xecf8('0x1d')](handleEntityNotFound(_0x324ee6,null))[_0xecf8('0x1d')](respondWithResult(_0x324ee6,null))[_0xecf8('0x3b')](handleError(_0x324ee6,null));};exports[_0xecf8('0x41')]=function(_0xbbb05,_0x41456f){return db[_0xecf8('0x24')]['create'](_0xbbb05[_0xecf8('0x42')],{})[_0xecf8('0x1d')](respondWithResult(_0x41456f,0xc9))['catch'](handleError(_0x41456f,null));};exports[_0xecf8('0x1c')]=function(_0x4d2074,_0x2ba3f5){if(_0x4d2074['body']['id']){delete _0x4d2074[_0xecf8('0x42')]['id'];}return db['MailServerOut'][_0xecf8('0x40')]({'where':{'id':_0x4d2074['params']['id']}})['then'](handleEntityNotFound(_0x2ba3f5,null))[_0xecf8('0x1d')](saveUpdates(_0x4d2074[_0xecf8('0x42')],null))['then'](respondWithResult(_0x2ba3f5,null))['catch'](handleError(_0x2ba3f5,null));};exports[_0xecf8('0x1e')]=function(_0x44e0d8,_0x377752){return db['MailServerOut'][_0xecf8('0x40')]({'where':{'id':_0x44e0d8[_0xecf8('0x3d')]['id']}})[_0xecf8('0x1d')](handleEntityNotFound(_0x377752,null))[_0xecf8('0x1d')](removeEntity(_0x377752,null))[_0xecf8('0x3b')](handleError(_0x377752,null));}; \ No newline at end of file +var _0xa9b8=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','dateStart','add','day','merge','map','filter','options','rows','show','includeAll','find','catch','create','body','update','destroy','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','then','error','stack','name','send','index','MailServerOut','rawAttributes','model','query','dateEnd'];(function(_0x16c004,_0x5851ef){var _0x97624=function(_0x29ff71){while(--_0x29ff71){_0x16c004['push'](_0x16c004['shift']());}};_0x97624(++_0x5851ef);}(_0xa9b8,0x160));var _0x8a9b=function(_0x4662d4,_0x3f7b2e){_0x4662d4=_0x4662d4-0x0;var _0x475030=_0xa9b8[_0x4662d4];return _0x475030;};'use strict';var jsonpatch=require(_0x8a9b('0x0'));var rp=require('request-promise');var moment=require(_0x8a9b('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8a9b('0x2'));var util=require(_0x8a9b('0x3'));var path=require('path');var sox=require(_0x8a9b('0x4'));var csv=require(_0x8a9b('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8a9b('0x6'));var squel=require(_0x8a9b('0x7'));var crypto=require(_0x8a9b('0x8'));var jsforce=require(_0x8a9b('0x9'));var deskjs=require(_0x8a9b('0xa'));var toCsv=require(_0x8a9b('0x5'));var querystring=require(_0x8a9b('0xb'));var Papa=require(_0x8a9b('0xc'));var qs=require(_0x8a9b('0xd'));var logger=require(_0x8a9b('0xe'))(_0x8a9b('0xf'));var utils=require(_0x8a9b('0x10'));var config=require('../../config/environment');var db=require(_0x8a9b('0x11'))['db'];function respondWithStatusCode(_0x56b796,_0x122dc7){_0x122dc7=_0x122dc7||0xcc;return function(_0x4ce9d5){if(_0x4ce9d5){return _0x56b796[_0x8a9b('0x12')](_0x122dc7);}return _0x56b796[_0x8a9b('0x13')](_0x122dc7)[_0x8a9b('0x14')]();};}function respondWithResult(_0x3f330e,_0x118a18){_0x118a18=_0x118a18||0xc8;return function(_0x26e5e1){if(_0x26e5e1){return _0x3f330e[_0x8a9b('0x13')](_0x118a18)[_0x8a9b('0x15')](_0x26e5e1);}};}function respondWithFilteredResult(_0x3cc223,_0x39e5ac){return function(_0x4fc23b){if(_0x4fc23b){var _0x14ab8f=_0x4fc23b[_0x8a9b('0x16')],_0x50fe20=_0x39e5ac[_0x8a9b('0x17')],_0x78305e=_0x39e5ac[_0x8a9b('0x17')]+_0x39e5ac[_0x8a9b('0x18')],_0x44f63e;if(_0x78305e>=_0x14ab8f){_0x78305e=_0x14ab8f;_0x44f63e=0xc8;}else{_0x44f63e=0xce;}_0x3cc223[_0x8a9b('0x13')](_0x44f63e);return _0x3cc223['set'](_0x8a9b('0x19'),_0x50fe20+'-'+_0x78305e+'/'+_0x14ab8f)[_0x8a9b('0x15')](_0x4fc23b);}return null;};}function patchUpdates(_0x2edaaa){return function(_0x280b46){try{jsonpatch[_0x8a9b('0x1a')](_0x280b46,_0x2edaaa,!![]);}catch(_0x47e7ac){return BPromise['reject'](_0x47e7ac);}return _0x280b46['save']();};}function saveUpdates(_0x589d37,_0x225efa){return function(_0x387a60){if(_0x387a60){return _0x387a60['update'](_0x589d37)[_0x8a9b('0x1b')](function(_0x44e5b2){return _0x44e5b2;});}return null;};}function removeEntity(_0x5391ca,_0x58a889){return function(_0x4718b4){if(_0x4718b4){return _0x4718b4['destroy']()[_0x8a9b('0x1b')](function(){_0x5391ca[_0x8a9b('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3fea0,_0x497d1a){return function(_0x5b485f){if(!_0x5b485f){_0xd3fea0['sendStatus'](0x194);}return _0x5b485f;};}function handleError(_0x35ef5a,_0xf7ce3b){_0xf7ce3b=_0xf7ce3b||0x1f4;return function(_0x13a8c8){logger[_0x8a9b('0x1c')](_0x13a8c8[_0x8a9b('0x1d')]);if(_0x13a8c8[_0x8a9b('0x1e')]){delete _0x13a8c8[_0x8a9b('0x1e')];}_0x35ef5a[_0x8a9b('0x13')](_0xf7ce3b)[_0x8a9b('0x1f')](_0x13a8c8);};}exports[_0x8a9b('0x20')]=function(_0x2273be,_0x5cfd8a){var _0x24d88c={},_0x514c3a={},_0x2771ba={'count':0x0,'rows':[]};var _0x2662b1=db[_0x8a9b('0x21')][_0x8a9b('0x22')];_0x514c3a[_0x8a9b('0x23')]=_['keys'](_0x2662b1);var _0x32717a={'dateStart':_0x2273be['query']['dateStart'],'dateEnd':_0x2273be[_0x8a9b('0x24')][_0x8a9b('0x25')]};delete _0x2273be[_0x8a9b('0x24')]['dateStart'];delete _0x2273be[_0x8a9b('0x24')][_0x8a9b('0x25')];_0x514c3a[_0x8a9b('0x24')]=_[_0x8a9b('0x26')](_0x2273be['query']);_0x514c3a[_0x8a9b('0x27')]=_[_0x8a9b('0x28')](_0x514c3a['model'],_0x514c3a[_0x8a9b('0x24')]);_0x24d88c[_0x8a9b('0x29')]=_[_0x8a9b('0x28')](_0x514c3a['model'],qs[_0x8a9b('0x2a')](_0x2273be[_0x8a9b('0x24')][_0x8a9b('0x2a')]));_0x24d88c[_0x8a9b('0x29')]=_0x24d88c[_0x8a9b('0x29')][_0x8a9b('0x2b')]?_0x24d88c[_0x8a9b('0x29')]:_0x514c3a[_0x8a9b('0x23')];if(!_0x2273be[_0x8a9b('0x24')][_0x8a9b('0x2c')](_0x8a9b('0x2d'))){_0x24d88c[_0x8a9b('0x18')]=qs['limit'](_0x2273be[_0x8a9b('0x24')][_0x8a9b('0x18')]);_0x24d88c[_0x8a9b('0x17')]=qs[_0x8a9b('0x17')](_0x2273be[_0x8a9b('0x24')][_0x8a9b('0x17')]);}_0x24d88c[_0x8a9b('0x2e')]=qs[_0x8a9b('0x2f')](_0x2273be[_0x8a9b('0x24')][_0x8a9b('0x2f')]);_0x24d88c[_0x8a9b('0x30')]=qs[_0x8a9b('0x27')](_['pick'](_0x2273be['query'],_0x514c3a[_0x8a9b('0x27')]));if(_0x32717a[_0x8a9b('0x31')]){if(_0x32717a[_0x8a9b('0x25')]){_0x32717a[_0x8a9b('0x25')]=moment(_0x32717a[_0x8a9b('0x25')])[_0x8a9b('0x32')](0x1,_0x8a9b('0x33'));}else{_0x32717a[_0x8a9b('0x25')]=moment(_0x32717a[_0x8a9b('0x31')])[_0x8a9b('0x32')](0x1,_0x8a9b('0x33'));}_[_0x8a9b('0x34')](_0x24d88c[_0x8a9b('0x30')],{'createdAt':{'$gte':_0x32717a[_0x8a9b('0x31')],'$lte':_0x32717a[_0x8a9b('0x25')]}});}if(_0x2273be[_0x8a9b('0x24')]['filter']){_0x24d88c['where']=_[_0x8a9b('0x34')](_0x24d88c[_0x8a9b('0x30')],{'$or':_[_0x8a9b('0x35')](_0x24d88c[_0x8a9b('0x29')],function(_0x34413d){var _0x589f16={};_0x589f16[_0x34413d]={'$like':'%'+_0x2273be[_0x8a9b('0x24')][_0x8a9b('0x36')]+'%'};return _0x589f16;})});}_0x24d88c=_[_0x8a9b('0x34')]({},_0x24d88c,_0x2273be[_0x8a9b('0x37')]);var _0x22ef5e={'where':_0x24d88c[_0x8a9b('0x30')]};return db[_0x8a9b('0x21')][_0x8a9b('0x16')](_0x22ef5e)[_0x8a9b('0x1b')](function(_0x49721c){_0x2771ba['count']=_0x49721c;if(_0x2273be[_0x8a9b('0x24')]['includeAll']){_0x24d88c['include']=[{'all':!![]}];}return db[_0x8a9b('0x21')]['findAll'](_0x24d88c);})[_0x8a9b('0x1b')](function(_0x207be1){_0x2771ba[_0x8a9b('0x38')]=_0x207be1;return _0x2771ba;})[_0x8a9b('0x1b')](respondWithFilteredResult(_0x5cfd8a,_0x24d88c))['catch'](handleError(_0x5cfd8a,null));};exports[_0x8a9b('0x39')]=function(_0x3e4a16,_0xffb326){var _0x59fb26={'raw':!![],'where':{'id':_0x3e4a16['params']['id']}},_0x37cde8={};_0x37cde8[_0x8a9b('0x23')]=_[_0x8a9b('0x26')](db[_0x8a9b('0x21')]['rawAttributes']);_0x37cde8[_0x8a9b('0x24')]=_[_0x8a9b('0x26')](_0x3e4a16['query']);_0x37cde8[_0x8a9b('0x27')]=_[_0x8a9b('0x28')](_0x37cde8[_0x8a9b('0x23')],_0x37cde8[_0x8a9b('0x24')]);_0x59fb26['attributes']=_[_0x8a9b('0x28')](_0x37cde8[_0x8a9b('0x23')],qs['fields'](_0x3e4a16[_0x8a9b('0x24')][_0x8a9b('0x2a')]));_0x59fb26[_0x8a9b('0x29')]=_0x59fb26[_0x8a9b('0x29')][_0x8a9b('0x2b')]?_0x59fb26[_0x8a9b('0x29')]:_0x37cde8['model'];if(_0x3e4a16['query'][_0x8a9b('0x3a')]){_0x59fb26['include']=[{'all':!![]}];}_0x59fb26=_[_0x8a9b('0x34')]({},_0x59fb26,_0x3e4a16['options']);return db[_0x8a9b('0x21')][_0x8a9b('0x3b')](_0x59fb26)[_0x8a9b('0x1b')](handleEntityNotFound(_0xffb326,null))[_0x8a9b('0x1b')](respondWithResult(_0xffb326,null))[_0x8a9b('0x3c')](handleError(_0xffb326,null));};exports[_0x8a9b('0x3d')]=function(_0xbe009,_0x60061e){return db[_0x8a9b('0x21')][_0x8a9b('0x3d')](_0xbe009[_0x8a9b('0x3e')],{})['then'](respondWithResult(_0x60061e,0xc9))[_0x8a9b('0x3c')](handleError(_0x60061e,null));};exports[_0x8a9b('0x3f')]=function(_0x33fd15,_0x58a084){if(_0x33fd15[_0x8a9b('0x3e')]['id']){delete _0x33fd15[_0x8a9b('0x3e')]['id'];}return db[_0x8a9b('0x21')][_0x8a9b('0x3b')]({'where':{'id':_0x33fd15['params']['id']}})[_0x8a9b('0x1b')](handleEntityNotFound(_0x58a084,null))[_0x8a9b('0x1b')](saveUpdates(_0x33fd15[_0x8a9b('0x3e')],null))[_0x8a9b('0x1b')](respondWithResult(_0x58a084,null))[_0x8a9b('0x3c')](handleError(_0x58a084,null));};exports[_0x8a9b('0x40')]=function(_0x1b73de,_0x380ec2){return db[_0x8a9b('0x21')][_0x8a9b('0x3b')]({'where':{'id':_0x1b73de['params']['id']}})[_0x8a9b('0x1b')](handleEntityNotFound(_0x380ec2,null))[_0x8a9b('0x1b')](removeEntity(_0x380ec2,null))['catch'](handleError(_0x380ec2,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index fdd56f9..e61e220 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 _0x7278=['exports','define','MailServerOut','lodash','util','../../config/logger','api','moment','request-promise','./mailServerOut.attributes'];(function(_0x4a9e0e,_0xaf5f09){var _0xd6ec40=function(_0x312cc3){while(--_0x312cc3){_0x4a9e0e['push'](_0x4a9e0e['shift']());}};_0xd6ec40(++_0xaf5f09);}(_0x7278,0x161));var _0x8727=function(_0x2b1592,_0xef7c74){_0x2b1592=_0x2b1592-0x0;var _0x5e3556=_0x7278[_0x2b1592];return _0x5e3556;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var attributes=require(_0x8727('0x6'));module[_0x8727('0x7')]=function(_0x221021,_0x2df052){return _0x221021[_0x8727('0x8')](_0x8727('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ec2=['lodash','util','../../config/logger','api','moment','bluebird','./mailServerOut.attributes','exports','define','mail_servers_out'];(function(_0x1b467d,_0x4be03d){var _0x486aa1=function(_0x59fc74){while(--_0x59fc74){_0x1b467d['push'](_0x1b467d['shift']());}};_0x486aa1(++_0x4be03d);}(_0x6ec2,0x78));var _0x26ec=function(_0x234775,_0x33ed07){_0x234775=_0x234775-0x0;var _0xb6bd02=_0x6ec2[_0x234775];return _0xb6bd02;};'use strict';var _=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var logger=require(_0x26ec('0x2'))(_0x26ec('0x3'));var moment=require(_0x26ec('0x4'));var BPromise=require(_0x26ec('0x5'));var rp=require('request-promise');var attributes=require(_0x26ec('0x6'));module[_0x26ec('0x7')]=function(_0x2b4225,_0x13f29c){return _0x2b4225[_0x26ec('0x8')]('MailServerOut',attributes,{'tableName':_0x26ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 717c82f..24ee34a 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 _0xdc3d=['client','then','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xdc3d,0x1ad));var _0xddc3=function(_0x2c717c,_0x58bfaa){_0x2c717c=_0x2c717c-0x0;var _0x5e0497=_0xdc3d[_0x2c717c];return _0x5e0497;};'use strict';var _=require(_0xddc3('0x0'));var util=require(_0xddc3('0x1'));var moment=require(_0xddc3('0x2'));var BPromise=require(_0xddc3('0x3'));var rs=require(_0xddc3('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xddc3('0x5'));var logger=require('../../config/logger')(_0xddc3('0x6'));var config=require('../../config/environment');var jayson=require(_0xddc3('0x7'));var client=jayson[_0xddc3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf0f73f,_0x6167cd,_0x15ddd9){return new BPromise(function(_0x451e28,_0x5aaef3){return client['request'](_0xf0f73f,_0x15ddd9)[_0xddc3('0x9')](function(_0x338469){logger['info'](_0xddc3('0xa'),_0x6167cd,'request\x20sent');logger[_0xddc3('0xb')](_0xddc3('0xc'),_0x6167cd,'request\x20sent',JSON['stringify'](_0x338469));if(_0x338469[_0xddc3('0xd')]){if(_0x338469[_0xddc3('0xd')][_0xddc3('0xe')]===0x1f4){logger[_0xddc3('0xd')](_0xddc3('0xa'),_0x6167cd,_0x338469[_0xddc3('0xd')][_0xddc3('0xf')]);return _0x5aaef3(_0x338469['error']['message']);}logger[_0xddc3('0xd')](_0xddc3('0xa'),_0x6167cd,_0x338469[_0xddc3('0xd')]['message']);return _0x451e28(_0x338469[_0xddc3('0xd')][_0xddc3('0xf')]);}else{logger[_0xddc3('0x10')](_0xddc3('0xa'),_0x6167cd,_0xddc3('0x11'));_0x451e28(_0x338469[_0xddc3('0x12')][_0xddc3('0xf')]);}})['catch'](function(_0x4d557c){logger[_0xddc3('0xd')](_0xddc3('0xa'),_0x6167cd,_0x4d557c);_0x5aaef3(_0x4d557c);});});} \ No newline at end of file +var _0xeb00=['code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xeb00,0x129));var _0x0eb0=function(_0x378748,_0x56c944){_0x378748=_0x378748-0x0;var _0x19b917=_0xeb00[_0x378748];return _0x19b917;};'use strict';var _=require(_0x0eb0('0x0'));var util=require('util');var moment=require(_0x0eb0('0x1'));var BPromise=require(_0x0eb0('0x2'));var rs=require(_0x0eb0('0x3'));var fs=require('fs');var db=require(_0x0eb0('0x4'))['db'];var utils=require(_0x0eb0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0eb0('0x6'));var jayson=require(_0x0eb0('0x7'));var client=jayson[_0x0eb0('0x8')][_0x0eb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dc8d3,_0x440e92,_0x44d592){return new BPromise(function(_0x247477,_0x25ad9e){return client[_0x0eb0('0xa')](_0x4dc8d3,_0x44d592)[_0x0eb0('0xb')](function(_0x12e761){logger[_0x0eb0('0xc')](_0x0eb0('0xd'),_0x440e92,_0x0eb0('0xe'));logger['debug'](_0x0eb0('0xf'),_0x440e92,_0x0eb0('0xe'),JSON[_0x0eb0('0x10')](_0x12e761));if(_0x12e761[_0x0eb0('0x11')]){if(_0x12e761['error'][_0x0eb0('0x12')]===0x1f4){logger[_0x0eb0('0x11')](_0x0eb0('0xd'),_0x440e92,_0x12e761['error']['message']);return _0x25ad9e(_0x12e761['error'][_0x0eb0('0x13')]);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x440e92,_0x12e761[_0x0eb0('0x11')][_0x0eb0('0x13')]);return _0x247477(_0x12e761['error'][_0x0eb0('0x13')]);}else{logger[_0x0eb0('0xc')](_0x0eb0('0xd'),_0x440e92,'request\x20sent');_0x247477(_0x12e761['result'][_0x0eb0('0x13')]);}})[_0x0eb0('0x14')](function(_0x55b788){logger[_0x0eb0('0x11')](_0x0eb0('0xd'),_0x440e92,_0x55b788);_0x25ad9e(_0x55b788);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f097c14..3139aa9 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 _0x8f59=['Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','multer','util','path','express'];(function(_0x87e75e,_0x5123ad){var _0x3bf753=function(_0xec14c6){while(--_0xec14c6){_0x87e75e['push'](_0x87e75e['shift']());}};_0x3bf753(++_0x5123ad);}(_0x8f59,0x11d));var _0x98f5=function(_0x355494,_0x592917){_0x355494=_0x355494-0x0;var _0x59d215=_0x8f59[_0x355494];return _0x59d215;};'use strict';var multer=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var path=require(_0x98f5('0x2'));var express=require(_0x98f5('0x3'));var router=express[_0x98f5('0x4')]();var auth=require(_0x98f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x98f5('0x6'));var controller=require(_0x98f5('0x7'));router[_0x98f5('0x8')]('/',auth[_0x98f5('0x9')](),controller['index']);router[_0x98f5('0x8')](_0x98f5('0xa'),auth[_0x98f5('0x9')](),controller['describe']);router['get'](_0x98f5('0xb'),auth[_0x98f5('0x9')](),controller[_0x98f5('0xc')]);router['post']('/',auth[_0x98f5('0x9')](),controller[_0x98f5('0xd')]);router[_0x98f5('0xe')](_0x98f5('0xb'),auth['isAuthenticated'](),controller[_0x98f5('0xf')]);router['delete']('/:id',auth[_0x98f5('0x9')](),controller[_0x98f5('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdac7=['/describe','describe','/:id','show','post','isAuthenticated','create','put','update','delete','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get'];(function(_0x73c130,_0x5f532f){var _0x3bd9b4=function(_0x56cac8){while(--_0x56cac8){_0x73c130['push'](_0x73c130['shift']());}};_0x3bd9b4(++_0x5f532f);}(_0xdac7,0x180));var _0x7dac=function(_0x8d7fe2,_0x4e6a69){_0x8d7fe2=_0x8d7fe2-0x0;var _0x525331=_0xdac7[_0x8d7fe2];return _0x525331;};'use strict';var multer=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x7dac('0x2'));var interaction=require(_0x7dac('0x3'));var config=require(_0x7dac('0x4'));var controller=require(_0x7dac('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7dac('0x6')](_0x7dac('0x7'),auth['isAuthenticated'](),controller[_0x7dac('0x8')]);router['get'](_0x7dac('0x9'),auth['isAuthenticated'](),controller[_0x7dac('0xa')]);router[_0x7dac('0xb')]('/',auth[_0x7dac('0xc')](),controller[_0x7dac('0xd')]);router[_0x7dac('0xe')](_0x7dac('0x9'),auth[_0x7dac('0xc')](),controller[_0x7dac('0xf')]);router[_0x7dac('0x10')](_0x7dac('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 2ccf926..a6bca3b 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 _0x5eb8=['STRING','name'];(function(_0x2d28ac,_0x3afe2a){var _0x219513=function(_0x396e20){while(--_0x396e20){_0x2d28ac['push'](_0x2d28ac['shift']());}};_0x219513(++_0x3afe2a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x5eb8[_0x52684f];return _0x4a55f0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file +var _0xdef9=['name','sequelize','exports','STRING'];(function(_0x321648,_0x2d0a58){var _0x124f43=function(_0x24c422){while(--_0x24c422){_0x321648['push'](_0x321648['shift']());}};_0x124f43(++_0x2d0a58);}(_0xdef9,0x1ed));var _0x9def=function(_0xa6d252,_0xf664a8){_0xa6d252=_0xa6d252-0x0;var _0x498d25=_0xdef9[_0xa6d252];return _0x498d25;};'use strict';var Sequelize=require(_0x9def('0x0'));module[_0x9def('0x1')]={'name':{'type':Sequelize[_0x9def('0x2')],'unique':_0x9def('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9def('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 70bd453..5dffbfc 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 _0x087e=['mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','MailSubstatus','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','filter','merge','map','includeAll','include','findAll','rows','catch','show','rawAttributes','options','create','body','find','params','describe','fast-json-patch','request-promise','bluebird'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x087e,0x1a1));var _0xe087=function(_0x14bea3,_0x436ec5){_0x14bea3=_0x14bea3-0x0;var _0x59bae7=_0x087e[_0x14bea3];return _0x59bae7;};'use strict';var jsonpatch=require(_0xe087('0x0'));var rp=require(_0xe087('0x1'));var moment=require('moment');var BPromise=require(_0xe087('0x2'));var Mustache=require(_0xe087('0x3'));var util=require(_0xe087('0x4'));var path=require(_0xe087('0x5'));var sox=require(_0xe087('0x6'));var csv=require(_0xe087('0x7'));var ejs=require(_0xe087('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe087('0x9'));var crypto=require(_0xe087('0xa'));var jsforce=require(_0xe087('0xb'));var deskjs=require(_0xe087('0xc'));var toCsv=require(_0xe087('0x7'));var querystring=require(_0xe087('0xd'));var Papa=require(_0xe087('0xe'));var qs=require(_0xe087('0xf'));var logger=require(_0xe087('0x10'))('api');var utils=require(_0xe087('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x83047b,_0x185b36){_0x185b36=_0x185b36||0xcc;return function(_0xcf2269){if(_0xcf2269){return _0x83047b[_0xe087('0x12')](_0x185b36);}return _0x83047b[_0xe087('0x13')](_0x185b36)[_0xe087('0x14')]();};}function respondWithResult(_0x3f38c7,_0x1e43d2){_0x1e43d2=_0x1e43d2||0xc8;return function(_0x521b7b){if(_0x521b7b){return _0x3f38c7[_0xe087('0x13')](_0x1e43d2)['json'](_0x521b7b);}};}function respondWithFilteredResult(_0x48bff4,_0x425b73){return function(_0x56f5e6){if(_0x56f5e6){var _0x475f09=_0x56f5e6[_0xe087('0x15')],_0x3db039=_0x425b73[_0xe087('0x16')],_0x42be14=_0x425b73['offset']+_0x425b73[_0xe087('0x17')],_0x273e58;if(_0x42be14>=_0x475f09){_0x42be14=_0x475f09;_0x273e58=0xc8;}else{_0x273e58=0xce;}_0x48bff4[_0xe087('0x13')](_0x273e58);return _0x48bff4['set'](_0xe087('0x18'),_0x3db039+'-'+_0x42be14+'/'+_0x475f09)[_0xe087('0x19')](_0x56f5e6);}return null;};}function patchUpdates(_0x5ac61b){return function(_0x37c674){try{jsonpatch[_0xe087('0x1a')](_0x37c674,_0x5ac61b,!![]);}catch(_0x47c055){return BPromise['reject'](_0x47c055);}return _0x37c674[_0xe087('0x1b')]();};}function saveUpdates(_0x1130fd,_0x249449){return function(_0x3a7463){if(_0x3a7463){return _0x3a7463[_0xe087('0x1c')](_0x1130fd)[_0xe087('0x1d')](function(_0x3169da){return _0x3169da;});}return null;};}function removeEntity(_0x9f468e,_0xa73637){return function(_0x34a4bc){if(_0x34a4bc){return _0x34a4bc[_0xe087('0x1e')]()['then'](function(){_0x9f468e['status'](0xcc)[_0xe087('0x14')]();});}};}function handleEntityNotFound(_0x44ef9d,_0x4095f3){return function(_0x52fa75){if(!_0x52fa75){_0x44ef9d[_0xe087('0x12')](0x194);}return _0x52fa75;};}function handleError(_0x3e52a1,_0x5cfdf4){_0x5cfdf4=_0x5cfdf4||0x1f4;return function(_0x43e6a2){logger[_0xe087('0x1f')](_0x43e6a2[_0xe087('0x20')]);if(_0x43e6a2[_0xe087('0x21')]){delete _0x43e6a2[_0xe087('0x21')];}_0x3e52a1[_0xe087('0x13')](_0x5cfdf4)[_0xe087('0x22')](_0x43e6a2);};}exports[_0xe087('0x23')]=function(_0x468a45,_0x282cee){var _0x11ca24={},_0x3d05a3={},_0x269f46={'count':0x0,'rows':[]};var _0x2c3615=db[_0xe087('0x24')]['rawAttributes'];_0x3d05a3[_0xe087('0x25')]=_[_0xe087('0x26')](_0x2c3615);var _0x54924f={'dateStart':_0x468a45[_0xe087('0x27')][_0xe087('0x28')],'dateEnd':_0x468a45[_0xe087('0x27')][_0xe087('0x29')]};delete _0x468a45['query']['dateStart'];delete _0x468a45['query'][_0xe087('0x29')];_0x3d05a3['query']=_['keys'](_0x468a45[_0xe087('0x27')]);_0x3d05a3['filters']=_[_0xe087('0x2a')](_0x3d05a3[_0xe087('0x25')],_0x3d05a3[_0xe087('0x27')]);_0x11ca24[_0xe087('0x2b')]=_[_0xe087('0x2a')](_0x3d05a3[_0xe087('0x25')],qs[_0xe087('0x2c')](_0x468a45['query']['fields']));_0x11ca24[_0xe087('0x2b')]=_0x11ca24[_0xe087('0x2b')][_0xe087('0x2d')]?_0x11ca24[_0xe087('0x2b')]:_0x3d05a3['model'];if(!_0x468a45[_0xe087('0x27')][_0xe087('0x2e')]('nolimit')){_0x11ca24[_0xe087('0x17')]=qs[_0xe087('0x17')](_0x468a45[_0xe087('0x27')][_0xe087('0x17')]);_0x11ca24[_0xe087('0x16')]=qs[_0xe087('0x16')](_0x468a45['query']['offset']);}_0x11ca24[_0xe087('0x2f')]=qs['sort'](_0x468a45[_0xe087('0x27')][_0xe087('0x30')]);_0x11ca24[_0xe087('0x31')]=qs[_0xe087('0x32')](_[_0xe087('0x33')](_0x468a45[_0xe087('0x27')],_0x3d05a3[_0xe087('0x32')]));if(_0x54924f['dateStart']){if(_0x54924f[_0xe087('0x29')]){_0x54924f['dateEnd']=moment(_0x54924f[_0xe087('0x29')])[_0xe087('0x34')](0x1,_0xe087('0x35'));}else{_0x54924f['dateEnd']=moment(_0x54924f['dateStart'])[_0xe087('0x34')](0x1,'day');}_['merge'](_0x11ca24[_0xe087('0x31')],{'createdAt':{'$gte':_0x54924f['dateStart'],'$lte':_0x54924f[_0xe087('0x29')]}});}if(_0x468a45['query'][_0xe087('0x36')]){_0x11ca24['where']=_[_0xe087('0x37')](_0x11ca24[_0xe087('0x31')],{'$or':_[_0xe087('0x38')](_0x11ca24[_0xe087('0x2b')],function(_0x46fcd4){var _0x37b518={};_0x37b518[_0x46fcd4]={'$like':'%'+_0x468a45[_0xe087('0x27')][_0xe087('0x36')]+'%'};return _0x37b518;})});}_0x11ca24=_[_0xe087('0x37')]({},_0x11ca24,_0x468a45['options']);var _0x319f68={'where':_0x11ca24[_0xe087('0x31')]};return db[_0xe087('0x24')][_0xe087('0x15')](_0x319f68)[_0xe087('0x1d')](function(_0x48ee95){_0x269f46['count']=_0x48ee95;if(_0x468a45[_0xe087('0x27')][_0xe087('0x39')]){_0x11ca24[_0xe087('0x3a')]=[{'all':!![]}];}return db[_0xe087('0x24')][_0xe087('0x3b')](_0x11ca24);})[_0xe087('0x1d')](function(_0x12a1b4){_0x269f46[_0xe087('0x3c')]=_0x12a1b4;return _0x269f46;})['then'](respondWithFilteredResult(_0x282cee,_0x11ca24))[_0xe087('0x3d')](handleError(_0x282cee,null));};exports[_0xe087('0x3e')]=function(_0x5542ee,_0x32e4a8){var _0x2d7b2d={'raw':!![],'where':{'id':_0x5542ee['params']['id']}},_0x596b8e={};_0x596b8e[_0xe087('0x25')]=_[_0xe087('0x26')](db[_0xe087('0x24')][_0xe087('0x3f')]);_0x596b8e['query']=_['keys'](_0x5542ee['query']);_0x596b8e[_0xe087('0x32')]=_['intersection'](_0x596b8e[_0xe087('0x25')],_0x596b8e[_0xe087('0x27')]);_0x2d7b2d[_0xe087('0x2b')]=_[_0xe087('0x2a')](_0x596b8e[_0xe087('0x25')],qs['fields'](_0x5542ee[_0xe087('0x27')]['fields']));_0x2d7b2d[_0xe087('0x2b')]=_0x2d7b2d[_0xe087('0x2b')]['length']?_0x2d7b2d[_0xe087('0x2b')]:_0x596b8e['model'];if(_0x5542ee[_0xe087('0x27')][_0xe087('0x39')]){_0x2d7b2d['include']=[{'all':!![]}];}_0x2d7b2d=_[_0xe087('0x37')]({},_0x2d7b2d,_0x5542ee[_0xe087('0x40')]);return db['MailSubstatus']['find'](_0x2d7b2d)[_0xe087('0x1d')](handleEntityNotFound(_0x32e4a8,null))[_0xe087('0x1d')](respondWithResult(_0x32e4a8,null))[_0xe087('0x3d')](handleError(_0x32e4a8,null));};exports[_0xe087('0x41')]=function(_0x496e1b,_0x48be32){return db[_0xe087('0x24')][_0xe087('0x41')](_0x496e1b[_0xe087('0x42')],{})['then'](respondWithResult(_0x48be32,0xc9))[_0xe087('0x3d')](handleError(_0x48be32,null));};exports[_0xe087('0x1c')]=function(_0x490938,_0x1c20e7){if(_0x490938[_0xe087('0x42')]['id']){delete _0x490938[_0xe087('0x42')]['id'];}return db['MailSubstatus'][_0xe087('0x43')]({'where':{'id':_0x490938[_0xe087('0x44')]['id']}})[_0xe087('0x1d')](handleEntityNotFound(_0x1c20e7,null))[_0xe087('0x1d')](saveUpdates(_0x490938['body'],null))[_0xe087('0x1d')](respondWithResult(_0x1c20e7,null))['catch'](handleError(_0x1c20e7,null));};exports[_0xe087('0x1e')]=function(_0x56f2e4,_0x2a2496){return db['MailSubstatus']['find']({'where':{'id':_0x56f2e4[_0xe087('0x44')]['id']}})[_0xe087('0x1d')](handleEntityNotFound(_0x2a2496,null))[_0xe087('0x1d')](removeEntity(_0x2a2496,null))[_0xe087('0x3d')](handleError(_0x2a2496,null));};exports[_0xe087('0x45')]=function(_0x120732,_0x570b00){return db[_0xe087('0x24')]['describe']()[_0xe087('0x1d')](respondWithResult(_0x570b00,null))[_0xe087('0x3d')](handleError(_0x570b00,null));}; \ No newline at end of file +var _0x5f8d=['papaparse','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','set','apply','update','then','error','stack','name','send','index','MailSubstatus','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','nolimit','sort','pick','dateEnd','add','day','merge','where','filter','map','options','includeAll','include','rows','catch','create','body','find','destroy','describe','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4dc575,_0x2cbfd6){var _0x3c0eb4=function(_0xc33cdd){while(--_0xc33cdd){_0x4dc575['push'](_0x4dc575['shift']());}};_0x3c0eb4(++_0x2cbfd6);}(_0x5f8d,0x1f2));var _0xd5f8=function(_0x199e50,_0x285f3f){_0x199e50=_0x199e50-0x0;var _0x16a565=_0x5f8d[_0x199e50];return _0x16a565;};'use strict';var jsonpatch=require(_0xd5f8('0x0'));var rp=require(_0xd5f8('0x1'));var moment=require(_0xd5f8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd5f8('0x3'));var util=require(_0xd5f8('0x4'));var path=require(_0xd5f8('0x5'));var sox=require('sox');var csv=require(_0xd5f8('0x6'));var ejs=require(_0xd5f8('0x7'));var fs=require('fs');var _=require(_0xd5f8('0x8'));var squel=require(_0xd5f8('0x9'));var crypto=require(_0xd5f8('0xa'));var jsforce=require(_0xd5f8('0xb'));var deskjs=require(_0xd5f8('0xc'));var toCsv=require(_0xd5f8('0x6'));var querystring=require(_0xd5f8('0xd'));var Papa=require(_0xd5f8('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xd5f8('0xf'))('api');var utils=require(_0xd5f8('0x10'));var config=require(_0xd5f8('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a9dfb,_0x41328d){_0x41328d=_0x41328d||0xcc;return function(_0x14776e){if(_0x14776e){return _0x3a9dfb[_0xd5f8('0x12')](_0x41328d);}return _0x3a9dfb['status'](_0x41328d)[_0xd5f8('0x13')]();};}function respondWithResult(_0x44affd,_0x2d655a){_0x2d655a=_0x2d655a||0xc8;return function(_0x52db09){if(_0x52db09){return _0x44affd[_0xd5f8('0x14')](_0x2d655a)[_0xd5f8('0x15')](_0x52db09);}};}function respondWithFilteredResult(_0x4e7425,_0x465699){return function(_0x5b0574){if(_0x5b0574){var _0x41ad33=_0x5b0574['count'],_0x1eb1a3=_0x465699[_0xd5f8('0x16')],_0xe3756d=_0x465699[_0xd5f8('0x16')]+_0x465699[_0xd5f8('0x17')],_0x4b06c0;if(_0xe3756d>=_0x41ad33){_0xe3756d=_0x41ad33;_0x4b06c0=0xc8;}else{_0x4b06c0=0xce;}_0x4e7425[_0xd5f8('0x14')](_0x4b06c0);return _0x4e7425[_0xd5f8('0x18')]('Content-Range',_0x1eb1a3+'-'+_0xe3756d+'/'+_0x41ad33)[_0xd5f8('0x15')](_0x5b0574);}return null;};}function patchUpdates(_0x44215b){return function(_0x55941f){try{jsonpatch[_0xd5f8('0x19')](_0x55941f,_0x44215b,!![]);}catch(_0x2c96ce){return BPromise['reject'](_0x2c96ce);}return _0x55941f['save']();};}function saveUpdates(_0x11f4eb,_0xbe47c0){return function(_0x95663a){if(_0x95663a){return _0x95663a[_0xd5f8('0x1a')](_0x11f4eb)[_0xd5f8('0x1b')](function(_0x8eca19){return _0x8eca19;});}return null;};}function removeEntity(_0x2b82ec,_0x4b904e){return function(_0x4d6d74){if(_0x4d6d74){return _0x4d6d74['destroy']()['then'](function(){_0x2b82ec[_0xd5f8('0x14')](0xcc)[_0xd5f8('0x13')]();});}};}function handleEntityNotFound(_0x364c39,_0x12ff3a){return function(_0x3e691d){if(!_0x3e691d){_0x364c39[_0xd5f8('0x12')](0x194);}return _0x3e691d;};}function handleError(_0xc6da47,_0x11692f){_0x11692f=_0x11692f||0x1f4;return function(_0x4544b5){logger[_0xd5f8('0x1c')](_0x4544b5[_0xd5f8('0x1d')]);if(_0x4544b5[_0xd5f8('0x1e')]){delete _0x4544b5[_0xd5f8('0x1e')];}_0xc6da47['status'](_0x11692f)[_0xd5f8('0x1f')](_0x4544b5);};}exports[_0xd5f8('0x20')]=function(_0x2f6e39,_0x33962f){var _0x5816d1={},_0x45d1ed={},_0x468442={'count':0x0,'rows':[]};var _0x3f2d16=db[_0xd5f8('0x21')][_0xd5f8('0x22')];_0x45d1ed[_0xd5f8('0x23')]=_[_0xd5f8('0x24')](_0x3f2d16);var _0x47afeb={'dateStart':_0x2f6e39[_0xd5f8('0x25')][_0xd5f8('0x26')],'dateEnd':_0x2f6e39['query']['dateEnd']};delete _0x2f6e39[_0xd5f8('0x25')]['dateStart'];delete _0x2f6e39[_0xd5f8('0x25')]['dateEnd'];_0x45d1ed[_0xd5f8('0x25')]=_[_0xd5f8('0x24')](_0x2f6e39[_0xd5f8('0x25')]);_0x45d1ed[_0xd5f8('0x27')]=_[_0xd5f8('0x28')](_0x45d1ed['model'],_0x45d1ed['query']);_0x5816d1[_0xd5f8('0x29')]=_[_0xd5f8('0x28')](_0x45d1ed['model'],qs['fields'](_0x2f6e39[_0xd5f8('0x25')][_0xd5f8('0x2a')]));_0x5816d1['attributes']=_0x5816d1[_0xd5f8('0x29')][_0xd5f8('0x2b')]?_0x5816d1[_0xd5f8('0x29')]:_0x45d1ed[_0xd5f8('0x23')];if(!_0x2f6e39[_0xd5f8('0x25')]['hasOwnProperty'](_0xd5f8('0x2c'))){_0x5816d1[_0xd5f8('0x17')]=qs[_0xd5f8('0x17')](_0x2f6e39[_0xd5f8('0x25')][_0xd5f8('0x17')]);_0x5816d1[_0xd5f8('0x16')]=qs[_0xd5f8('0x16')](_0x2f6e39[_0xd5f8('0x25')]['offset']);}_0x5816d1['order']=qs[_0xd5f8('0x2d')](_0x2f6e39['query'][_0xd5f8('0x2d')]);_0x5816d1['where']=qs['filters'](_[_0xd5f8('0x2e')](_0x2f6e39[_0xd5f8('0x25')],_0x45d1ed['filters']));if(_0x47afeb[_0xd5f8('0x26')]){if(_0x47afeb[_0xd5f8('0x2f')]){_0x47afeb['dateEnd']=moment(_0x47afeb['dateEnd'])[_0xd5f8('0x30')](0x1,'day');}else{_0x47afeb[_0xd5f8('0x2f')]=moment(_0x47afeb[_0xd5f8('0x26')])[_0xd5f8('0x30')](0x1,_0xd5f8('0x31'));}_[_0xd5f8('0x32')](_0x5816d1[_0xd5f8('0x33')],{'createdAt':{'$gte':_0x47afeb[_0xd5f8('0x26')],'$lte':_0x47afeb[_0xd5f8('0x2f')]}});}if(_0x2f6e39['query'][_0xd5f8('0x34')]){_0x5816d1[_0xd5f8('0x33')]=_[_0xd5f8('0x32')](_0x5816d1['where'],{'$or':_[_0xd5f8('0x35')](_0x5816d1[_0xd5f8('0x29')],function(_0x244077){var _0x43762c={};_0x43762c[_0x244077]={'$like':'%'+_0x2f6e39['query'][_0xd5f8('0x34')]+'%'};return _0x43762c;})});}_0x5816d1=_[_0xd5f8('0x32')]({},_0x5816d1,_0x2f6e39[_0xd5f8('0x36')]);var _0x16f320={'where':_0x5816d1[_0xd5f8('0x33')]};return db['MailSubstatus']['count'](_0x16f320)[_0xd5f8('0x1b')](function(_0x1308de){_0x468442['count']=_0x1308de;if(_0x2f6e39[_0xd5f8('0x25')][_0xd5f8('0x37')]){_0x5816d1[_0xd5f8('0x38')]=[{'all':!![]}];}return db[_0xd5f8('0x21')]['findAll'](_0x5816d1);})[_0xd5f8('0x1b')](function(_0x584f8a){_0x468442[_0xd5f8('0x39')]=_0x584f8a;return _0x468442;})[_0xd5f8('0x1b')](respondWithFilteredResult(_0x33962f,_0x5816d1))[_0xd5f8('0x3a')](handleError(_0x33962f,null));};exports['show']=function(_0x5346ec,_0x50c809){var _0x1d0488={'raw':!![],'where':{'id':_0x5346ec['params']['id']}},_0xc4a971={};_0xc4a971['model']=_['keys'](db[_0xd5f8('0x21')][_0xd5f8('0x22')]);_0xc4a971['query']=_[_0xd5f8('0x24')](_0x5346ec['query']);_0xc4a971[_0xd5f8('0x27')]=_['intersection'](_0xc4a971[_0xd5f8('0x23')],_0xc4a971['query']);_0x1d0488[_0xd5f8('0x29')]=_[_0xd5f8('0x28')](_0xc4a971[_0xd5f8('0x23')],qs[_0xd5f8('0x2a')](_0x5346ec[_0xd5f8('0x25')][_0xd5f8('0x2a')]));_0x1d0488['attributes']=_0x1d0488[_0xd5f8('0x29')][_0xd5f8('0x2b')]?_0x1d0488[_0xd5f8('0x29')]:_0xc4a971[_0xd5f8('0x23')];if(_0x5346ec[_0xd5f8('0x25')][_0xd5f8('0x37')]){_0x1d0488[_0xd5f8('0x38')]=[{'all':!![]}];}_0x1d0488=_[_0xd5f8('0x32')]({},_0x1d0488,_0x5346ec['options']);return db[_0xd5f8('0x21')]['find'](_0x1d0488)['then'](handleEntityNotFound(_0x50c809,null))['then'](respondWithResult(_0x50c809,null))[_0xd5f8('0x3a')](handleError(_0x50c809,null));};exports[_0xd5f8('0x3b')]=function(_0x448a9b,_0x9e5b50){return db[_0xd5f8('0x21')]['create'](_0x448a9b[_0xd5f8('0x3c')],{})[_0xd5f8('0x1b')](respondWithResult(_0x9e5b50,0xc9))['catch'](handleError(_0x9e5b50,null));};exports[_0xd5f8('0x1a')]=function(_0x52b797,_0x140d85){if(_0x52b797[_0xd5f8('0x3c')]['id']){delete _0x52b797[_0xd5f8('0x3c')]['id'];}return db[_0xd5f8('0x21')][_0xd5f8('0x3d')]({'where':{'id':_0x52b797['params']['id']}})['then'](handleEntityNotFound(_0x140d85,null))['then'](saveUpdates(_0x52b797[_0xd5f8('0x3c')],null))[_0xd5f8('0x1b')](respondWithResult(_0x140d85,null))[_0xd5f8('0x3a')](handleError(_0x140d85,null));};exports[_0xd5f8('0x3e')]=function(_0x3ec80d,_0xdce2c4){return db['MailSubstatus'][_0xd5f8('0x3d')]({'where':{'id':_0x3ec80d['params']['id']}})['then'](handleEntityNotFound(_0xdce2c4,null))[_0xd5f8('0x1b')](removeEntity(_0xdce2c4,null))['catch'](handleError(_0xdce2c4,null));};exports[_0xd5f8('0x3f')]=function(_0x22d2f6,_0x223d1b){return db[_0xd5f8('0x21')]['describe']()[_0xd5f8('0x1b')](respondWithResult(_0x223d1b,null))[_0xd5f8('0x3a')](handleError(_0x223d1b,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index e569e18..9ccbeae 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 _0xefae=['request-promise','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','../../config/logger','bluebird'];(function(_0x2bb6c5,_0x202c39){var _0x1fe18f=function(_0x53d684){while(--_0x53d684){_0x2bb6c5['push'](_0x2bb6c5['shift']());}};_0x1fe18f(++_0x202c39);}(_0xefae,0x153));var _0xeefa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeefa('0x0'));var util=require('util');var logger=require(_0xeefa('0x1'))('api');var moment=require('moment');var BPromise=require(_0xeefa('0x2'));var rp=require(_0xeefa('0x3'));var attributes=require(_0xeefa('0x4'));module[_0xeefa('0x5')]=function(_0x42fe8d,_0x4a81ad){return _0x42fe8d[_0xeefa('0x6')](_0xeefa('0x7'),attributes,{'tableName':_0xeefa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x373e=['MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','bluebird','request-promise','./mailSubstatus.attributes','exports','define'];(function(_0x5d3c40,_0xb81ff8){var _0x4a736f=function(_0x220bfa){while(--_0x220bfa){_0x5d3c40['push'](_0x5d3c40['shift']());}};_0x4a736f(++_0xb81ff8);}(_0x373e,0x7b));var _0xe373=function(_0x3128f2,_0x41dfd0){_0x3128f2=_0x3128f2-0x0;var _0x1cc147=_0x373e[_0x3128f2];return _0x1cc147;};'use strict';var _=require('lodash');var util=require(_0xe373('0x0'));var logger=require(_0xe373('0x1'))(_0xe373('0x2'));var moment=require(_0xe373('0x3'));var BPromise=require(_0xe373('0x4'));var rp=require(_0xe373('0x5'));var attributes=require(_0xe373('0x6'));module[_0xe373('0x7')]=function(_0x5d5dfb,_0x5ce9a8){return _0x5d5dfb[_0xe373('0x8')](_0xe373('0x9'),attributes,{'tableName':_0xe373('0xa'),'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 b31c3c9..b17cdbb 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 _0xc0b8=['client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x2a307c,_0x129ef0){var _0x5c79b7=function(_0xa1ce67){while(--_0xa1ce67){_0x2a307c['push'](_0x2a307c['shift']());}};_0x5c79b7(++_0x129ef0);}(_0xc0b8,0x123));var _0x8c0b=function(_0xf2c695,_0x1f1a06){_0xf2c695=_0xf2c695-0x0;var _0x4faeb4=_0xc0b8[_0xf2c695];return _0x4faeb4;};'use strict';var _=require('lodash');var util=require(_0x8c0b('0x0'));var moment=require(_0x8c0b('0x1'));var BPromise=require(_0x8c0b('0x2'));var rs=require(_0x8c0b('0x3'));var fs=require('fs');var db=require(_0x8c0b('0x4'))['db'];var utils=require(_0x8c0b('0x5'));var logger=require('../../config/logger')(_0x8c0b('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c0b('0x7'));var client=jayson[_0x8c0b('0x8')][_0x8c0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x469bd9,_0xdf26c3,_0x4f6582){return new BPromise(function(_0x564de4,_0x4f6dbe){return client[_0x8c0b('0xa')](_0x469bd9,_0x4f6582)[_0x8c0b('0xb')](function(_0x4c6165){logger[_0x8c0b('0xc')](_0x8c0b('0xd'),_0xdf26c3,_0x8c0b('0xe'));logger[_0x8c0b('0xf')](_0x8c0b('0x10'),_0xdf26c3,_0x8c0b('0xe'),JSON[_0x8c0b('0x11')](_0x4c6165));if(_0x4c6165[_0x8c0b('0x12')]){if(_0x4c6165['error'][_0x8c0b('0x13')]===0x1f4){logger[_0x8c0b('0x12')](_0x8c0b('0xd'),_0xdf26c3,_0x4c6165[_0x8c0b('0x12')][_0x8c0b('0x14')]);return _0x4f6dbe(_0x4c6165[_0x8c0b('0x12')][_0x8c0b('0x14')]);}logger[_0x8c0b('0x12')](_0x8c0b('0xd'),_0xdf26c3,_0x4c6165[_0x8c0b('0x12')][_0x8c0b('0x14')]);return _0x564de4(_0x4c6165[_0x8c0b('0x12')][_0x8c0b('0x14')]);}else{logger[_0x8c0b('0xc')](_0x8c0b('0xd'),_0xdf26c3,_0x8c0b('0xe'));_0x564de4(_0x4c6165[_0x8c0b('0x15')][_0x8c0b('0x14')]);}})[_0x8c0b('0x16')](function(_0x360813){logger[_0x8c0b('0x12')](_0x8c0b('0xd'),_0xdf26c3,_0x360813);_0x4f6dbe(_0x360813);});});} \ No newline at end of file +var _0x804e=['code','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x804e,0x6e));var _0xe804=function(_0x409ae2,_0x2e5422){_0x409ae2=_0x409ae2-0x0;var _0x48b427=_0x804e[_0x409ae2];return _0x48b427;};'use strict';var _=require(_0xe804('0x0'));var util=require(_0xe804('0x1'));var moment=require('moment');var BPromise=require(_0xe804('0x2'));var rs=require(_0xe804('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe804('0x4'))(_0xe804('0x5'));var config=require(_0xe804('0x6'));var jayson=require(_0xe804('0x7'));var client=jayson[_0xe804('0x8')][_0xe804('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32ba1f,_0x18df36,_0x30ffd8){return new BPromise(function(_0x3c19b3,_0x31c192){return client[_0xe804('0xa')](_0x32ba1f,_0x30ffd8)['then'](function(_0x49e045){logger[_0xe804('0xb')](_0xe804('0xc'),_0x18df36,_0xe804('0xd'));logger[_0xe804('0xe')](_0xe804('0xf'),_0x18df36,_0xe804('0xd'),JSON['stringify'](_0x49e045));if(_0x49e045['error']){if(_0x49e045['error'][_0xe804('0x10')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x18df36,_0x49e045['error']['message']);return _0x31c192(_0x49e045[_0xe804('0x11')][_0xe804('0x12')]);}logger[_0xe804('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x18df36,_0x49e045['error'][_0xe804('0x12')]);return _0x3c19b3(_0x49e045[_0xe804('0x11')][_0xe804('0x12')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x18df36,_0xe804('0xd'));_0x3c19b3(_0x49e045[_0xe804('0x13')]['message']);}})[_0xe804('0x14')](function(_0x11e908){logger[_0xe804('0x11')](_0xe804('0xc'),_0x18df36,_0x11e908);_0x31c192(_0x11e908);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f2a35be..5cef875 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 _0xeda0=['/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x45adaf,_0x21c3c1){var _0x15d189=function(_0x48dc43){while(--_0x48dc43){_0x45adaf['push'](_0x45adaf['shift']());}};_0x15d189(++_0x21c3c1);}(_0xeda0,0xb3));var _0x0eda=function(_0x546f0c,_0x2d6e5c){_0x546f0c=_0x546f0c-0x0;var _0x1823eb=_0xeda0[_0x546f0c];return _0x1823eb;};'use strict';var multer=require(_0x0eda('0x0'));var util=require(_0x0eda('0x1'));var path=require(_0x0eda('0x2'));var express=require(_0x0eda('0x3'));var router=express[_0x0eda('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0eda('0x5'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x0eda('0x6')]('/',auth[_0x0eda('0x7')](),controller['index']);router[_0x0eda('0x6')](_0x0eda('0x8'),auth[_0x0eda('0x7')](),controller['describe']);router[_0x0eda('0x6')](_0x0eda('0x9'),auth[_0x0eda('0x7')](),controller[_0x0eda('0xa')]);router['post']('/',auth[_0x0eda('0x7')](),controller[_0x0eda('0xb')]);router[_0x0eda('0xc')](_0x0eda('0x9'),auth[_0x0eda('0x7')](),controller[_0x0eda('0xd')]);router[_0x0eda('0xe')](_0x0eda('0x9'),auth[_0x0eda('0x7')](),controller[_0x0eda('0xf')]);module[_0x0eda('0x10')]=router; \ No newline at end of file +var _0xc274=['show','post','create','update','destroy','exports','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x5f4a33,_0x5a9b58){var _0x3f19b6=function(_0x4d637a){while(--_0x4d637a){_0x5f4a33['push'](_0x5f4a33['shift']());}};_0x3f19b6(++_0x5a9b58);}(_0xc274,0xe3));var _0x4c27=function(_0x23ab98,_0x29314d){_0x23ab98=_0x23ab98-0x0;var _0x1a68db=_0xc274[_0x23ab98];return _0x1a68db;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x4c27('0x0'));var router=express[_0x4c27('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x4c27('0x2'));var config=require(_0x4c27('0x3'));var controller=require(_0x4c27('0x4'));router[_0x4c27('0x5')]('/',auth['isAuthenticated'](),controller[_0x4c27('0x6')]);router['get'](_0x4c27('0x7'),auth[_0x4c27('0x8')](),controller[_0x4c27('0x9')]);router['get'](_0x4c27('0xa'),auth[_0x4c27('0x8')](),controller[_0x4c27('0xb')]);router[_0x4c27('0xc')]('/',auth[_0x4c27('0x8')](),controller[_0x4c27('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4c27('0xe')]);router['delete'](_0x4c27('0xa'),auth['isAuthenticated'](),controller[_0x4c27('0xf')]);module[_0x4c27('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 67ef7b6..7189bc6 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 _0x1c91=['STRING','ENUM','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x143ac4,_0x48caad){var _0x191d8e=function(_0x459c74){while(--_0x459c74){_0x143ac4['push'](_0x143ac4['shift']());}};_0x191d8e(++_0x48caad);}(_0x1c91,0x1bd));var _0x11c9=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1c91[_0x311c35];return _0x5cc50c;};'use strict';var moment=require(_0x11c9('0x0'));var Sequelize=require(_0x11c9('0x1'));module[_0x11c9('0x2')]={'uniqueid':{'type':Sequelize[_0x11c9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x11c9('0x4')]('account','agent',_0x11c9('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x11c9('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x11c9('0x7')]}}; \ No newline at end of file +var _0xe8b6=['STRING','account','agent','queue','DATE','NOW','moment'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xe8b6,0x12c));var _0x6e8b=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe8b6[_0x46e363];return _0x3fb059;};'use strict';var moment=require(_0x6e8b('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6e8b('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6e8b('0x2'),_0x6e8b('0x3'),_0x6e8b('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6e8b('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x6e8b('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f867373..7b2e698 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 _0xc9e1=['then','destroy','stack','name','send','index','MailTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../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'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xc9e1,0x72));var _0x1c9e=function(_0x18c89e,_0x4f20ef){_0x18c89e=_0x18c89e-0x0;var _0x35fc61=_0xc9e1[_0x18c89e];return _0x35fc61;};'use strict';var jsonpatch=require(_0x1c9e('0x0'));var rp=require(_0x1c9e('0x1'));var moment=require(_0x1c9e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1c9e('0x3'));var util=require(_0x1c9e('0x4'));var path=require(_0x1c9e('0x5'));var sox=require(_0x1c9e('0x6'));var csv=require(_0x1c9e('0x7'));var ejs=require(_0x1c9e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1c9e('0x9'));var jsforce=require(_0x1c9e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1c9e('0x7'));var querystring=require(_0x1c9e('0xb'));var Papa=require(_0x1c9e('0xc'));var qs=require(_0x1c9e('0xd'));var logger=require(_0x1c9e('0xe'))(_0x1c9e('0xf'));var utils=require(_0x1c9e('0x10'));var config=require(_0x1c9e('0x11'));var db=require(_0x1c9e('0x12'))['db'];function respondWithStatusCode(_0x43f733,_0x477429){_0x477429=_0x477429||0xcc;return function(_0x448fb0){if(_0x448fb0){return _0x43f733[_0x1c9e('0x13')](_0x477429);}return _0x43f733[_0x1c9e('0x14')](_0x477429)[_0x1c9e('0x15')]();};}function respondWithResult(_0x2ac05c,_0x38525c){_0x38525c=_0x38525c||0xc8;return function(_0x4edf2a){if(_0x4edf2a){return _0x2ac05c[_0x1c9e('0x14')](_0x38525c)[_0x1c9e('0x16')](_0x4edf2a);}};}function respondWithFilteredResult(_0x796f17,_0x2a1dfb){return function(_0x217dac){if(_0x217dac){var _0x4c305b=_0x217dac[_0x1c9e('0x17')],_0x356316=_0x2a1dfb[_0x1c9e('0x18')],_0x50fd6f=_0x2a1dfb[_0x1c9e('0x18')]+_0x2a1dfb[_0x1c9e('0x19')],_0x18fe46;if(_0x50fd6f>=_0x4c305b){_0x50fd6f=_0x4c305b;_0x18fe46=0xc8;}else{_0x18fe46=0xce;}_0x796f17[_0x1c9e('0x14')](_0x18fe46);return _0x796f17[_0x1c9e('0x1a')](_0x1c9e('0x1b'),_0x356316+'-'+_0x50fd6f+'/'+_0x4c305b)[_0x1c9e('0x16')](_0x217dac);}return null;};}function patchUpdates(_0x3f7b24){return function(_0x55d084){try{jsonpatch[_0x1c9e('0x1c')](_0x55d084,_0x3f7b24,!![]);}catch(_0x21f114){return BPromise[_0x1c9e('0x1d')](_0x21f114);}return _0x55d084[_0x1c9e('0x1e')]();};}function saveUpdates(_0x18566e,_0x3c22ed){return function(_0x18625f){if(_0x18625f){return _0x18625f[_0x1c9e('0x1f')](_0x18566e)[_0x1c9e('0x20')](function(_0x168eb7){return _0x168eb7;});}return null;};}function removeEntity(_0x17bcc5,_0x1a98d3){return function(_0x20ebcf){if(_0x20ebcf){return _0x20ebcf[_0x1c9e('0x21')]()['then'](function(){_0x17bcc5[_0x1c9e('0x14')](0xcc)[_0x1c9e('0x15')]();});}};}function handleEntityNotFound(_0xf41876,_0xd66d7f){return function(_0x408139){if(!_0x408139){_0xf41876[_0x1c9e('0x13')](0x194);}return _0x408139;};}function handleError(_0x9f23bf,_0x5ab7a6){_0x5ab7a6=_0x5ab7a6||0x1f4;return function(_0x423506){logger['error'](_0x423506[_0x1c9e('0x22')]);if(_0x423506[_0x1c9e('0x23')]){delete _0x423506[_0x1c9e('0x23')];}_0x9f23bf[_0x1c9e('0x14')](_0x5ab7a6)[_0x1c9e('0x24')](_0x423506);};}exports[_0x1c9e('0x25')]=function(_0x17da2d,_0x7141d4){var _0x50f212={},_0x4fb830={},_0x286170={'count':0x0,'rows':[]};var _0x106c7c=db[_0x1c9e('0x26')][_0x1c9e('0x27')];_0x4fb830[_0x1c9e('0x28')]=_[_0x1c9e('0x29')](_0x106c7c);var _0x419b6f={'dateStart':_0x17da2d[_0x1c9e('0x2a')][_0x1c9e('0x2b')],'dateEnd':_0x17da2d['query'][_0x1c9e('0x2c')]};delete _0x17da2d[_0x1c9e('0x2a')][_0x1c9e('0x2b')];delete _0x17da2d['query'][_0x1c9e('0x2c')];_0x4fb830[_0x1c9e('0x2a')]=_[_0x1c9e('0x29')](_0x17da2d['query']);_0x4fb830[_0x1c9e('0x2d')]=_['intersection'](_0x4fb830[_0x1c9e('0x28')],_0x4fb830[_0x1c9e('0x2a')]);_0x50f212[_0x1c9e('0x2e')]=_[_0x1c9e('0x2f')](_0x4fb830[_0x1c9e('0x28')],qs['fields'](_0x17da2d['query']['fields']));_0x50f212[_0x1c9e('0x2e')]=_0x50f212['attributes'][_0x1c9e('0x30')]?_0x50f212[_0x1c9e('0x2e')]:_0x4fb830[_0x1c9e('0x28')];if(!_0x17da2d['query'][_0x1c9e('0x31')](_0x1c9e('0x32'))){_0x50f212[_0x1c9e('0x19')]=qs[_0x1c9e('0x19')](_0x17da2d[_0x1c9e('0x2a')][_0x1c9e('0x19')]);_0x50f212[_0x1c9e('0x18')]=qs[_0x1c9e('0x18')](_0x17da2d['query']['offset']);}_0x50f212[_0x1c9e('0x33')]=qs[_0x1c9e('0x34')](_0x17da2d['query'][_0x1c9e('0x34')]);_0x50f212[_0x1c9e('0x35')]=qs[_0x1c9e('0x2d')](_[_0x1c9e('0x36')](_0x17da2d[_0x1c9e('0x2a')],_0x4fb830[_0x1c9e('0x2d')]));if(_0x419b6f[_0x1c9e('0x2b')]){if(_0x419b6f[_0x1c9e('0x2c')]){_0x419b6f[_0x1c9e('0x2c')]=moment(_0x419b6f[_0x1c9e('0x2c')])[_0x1c9e('0x37')](0x1,_0x1c9e('0x38'));}else{_0x419b6f[_0x1c9e('0x2c')]=moment(_0x419b6f['dateStart'])[_0x1c9e('0x37')](0x1,_0x1c9e('0x38'));}_[_0x1c9e('0x39')](_0x50f212[_0x1c9e('0x35')],{'createdAt':{'$gte':_0x419b6f['dateStart'],'$lte':_0x419b6f[_0x1c9e('0x2c')]}});}if(_0x17da2d[_0x1c9e('0x2a')]['filter']){_0x50f212['where']=_[_0x1c9e('0x39')](_0x50f212[_0x1c9e('0x35')],{'$or':_[_0x1c9e('0x3a')](_0x50f212[_0x1c9e('0x2e')],function(_0x2bda2f){var _0x587122={};_0x587122[_0x2bda2f]={'$like':'%'+_0x17da2d[_0x1c9e('0x2a')][_0x1c9e('0x3b')]+'%'};return _0x587122;})});}_0x50f212=_[_0x1c9e('0x39')]({},_0x50f212,_0x17da2d[_0x1c9e('0x3c')]);var _0x174a2b={'where':_0x50f212[_0x1c9e('0x35')]};return db['MailTransferReport'][_0x1c9e('0x17')](_0x174a2b)[_0x1c9e('0x20')](function(_0x547ac4){_0x286170[_0x1c9e('0x17')]=_0x547ac4;if(_0x17da2d[_0x1c9e('0x2a')][_0x1c9e('0x3d')]){_0x50f212[_0x1c9e('0x3e')]=[{'all':!![]}];}return db[_0x1c9e('0x26')][_0x1c9e('0x3f')](_0x50f212);})[_0x1c9e('0x20')](function(_0x3cc120){_0x286170[_0x1c9e('0x40')]=_0x3cc120;return _0x286170;})[_0x1c9e('0x20')](respondWithFilteredResult(_0x7141d4,_0x50f212))[_0x1c9e('0x41')](handleError(_0x7141d4,null));};exports[_0x1c9e('0x42')]=function(_0x36da7a,_0x34096b){var _0x14bad6={'raw':!![],'where':{'id':_0x36da7a[_0x1c9e('0x43')]['id']}},_0x21de20={};_0x21de20[_0x1c9e('0x28')]=_[_0x1c9e('0x29')](db[_0x1c9e('0x26')]['rawAttributes']);_0x21de20[_0x1c9e('0x2a')]=_['keys'](_0x36da7a[_0x1c9e('0x2a')]);_0x21de20['filters']=_['intersection'](_0x21de20['model'],_0x21de20[_0x1c9e('0x2a')]);_0x14bad6[_0x1c9e('0x2e')]=_[_0x1c9e('0x2f')](_0x21de20[_0x1c9e('0x28')],qs[_0x1c9e('0x44')](_0x36da7a[_0x1c9e('0x2a')][_0x1c9e('0x44')]));_0x14bad6[_0x1c9e('0x2e')]=_0x14bad6[_0x1c9e('0x2e')][_0x1c9e('0x30')]?_0x14bad6[_0x1c9e('0x2e')]:_0x21de20[_0x1c9e('0x28')];if(_0x36da7a[_0x1c9e('0x2a')][_0x1c9e('0x3d')]){_0x14bad6[_0x1c9e('0x3e')]=[{'all':!![]}];}_0x14bad6=_[_0x1c9e('0x39')]({},_0x14bad6,_0x36da7a[_0x1c9e('0x3c')]);return db[_0x1c9e('0x26')][_0x1c9e('0x45')](_0x14bad6)[_0x1c9e('0x20')](handleEntityNotFound(_0x34096b,null))[_0x1c9e('0x20')](respondWithResult(_0x34096b,null))[_0x1c9e('0x41')](handleError(_0x34096b,null));};exports[_0x1c9e('0x46')]=function(_0x5c06d0,_0x4bf3fd){return db[_0x1c9e('0x26')][_0x1c9e('0x46')](_0x5c06d0[_0x1c9e('0x47')],{})[_0x1c9e('0x20')](respondWithResult(_0x4bf3fd,0xc9))[_0x1c9e('0x41')](handleError(_0x4bf3fd,null));};exports[_0x1c9e('0x1f')]=function(_0x20c838,_0x52dc8b){if(_0x20c838[_0x1c9e('0x47')]['id']){delete _0x20c838[_0x1c9e('0x47')]['id'];}return db[_0x1c9e('0x26')][_0x1c9e('0x45')]({'where':{'id':_0x20c838[_0x1c9e('0x43')]['id']}})[_0x1c9e('0x20')](handleEntityNotFound(_0x52dc8b,null))['then'](saveUpdates(_0x20c838[_0x1c9e('0x47')],null))[_0x1c9e('0x20')](respondWithResult(_0x52dc8b,null))[_0x1c9e('0x41')](handleError(_0x52dc8b,null));};exports['destroy']=function(_0x3392e9,_0x39ef6a){return db['MailTransferReport'][_0x1c9e('0x45')]({'where':{'id':_0x3392e9[_0x1c9e('0x43')]['id']}})[_0x1c9e('0x20')](handleEntityNotFound(_0x39ef6a,null))['then'](removeEntity(_0x39ef6a,null))[_0x1c9e('0x41')](handleError(_0x39ef6a,null));};exports[_0x1c9e('0x48')]=function(_0x6dd03d,_0x2c3a90){return db[_0x1c9e('0x26')][_0x1c9e('0x48')]()[_0x1c9e('0x20')](respondWithResult(_0x2c3a90,null))[_0x1c9e('0x41')](handleError(_0x2c3a90,null));}; \ No newline at end of file +var _0xcc63=['querystring','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','MailTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','length','nolimit','order','sort','where','filters','pick','add','day','merge','map','options','count','includeAll','include','findAll','rows','catch','params','fields','find','create','body','describe','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xcc63,0x181));var _0x3cc6=function(_0x360245,_0x22f2b2){_0x360245=_0x360245-0x0;var _0x42906f=_0xcc63[_0x360245];return _0x42906f;};'use strict';var jsonpatch=require(_0x3cc6('0x0'));var rp=require(_0x3cc6('0x1'));var moment=require(_0x3cc6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3cc6('0x3'));var util=require('util');var path=require(_0x3cc6('0x4'));var sox=require(_0x3cc6('0x5'));var csv=require('to-csv');var ejs=require(_0x3cc6('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3cc6('0x7'));var crypto=require(_0x3cc6('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3cc6('0x9'));var toCsv=require(_0x3cc6('0xa'));var querystring=require(_0x3cc6('0xb'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x3cc6('0xc'))(_0x3cc6('0xd'));var utils=require(_0x3cc6('0xe'));var config=require('../../config/environment');var db=require(_0x3cc6('0xf'))['db'];function respondWithStatusCode(_0x135c04,_0x5b3d0a){_0x5b3d0a=_0x5b3d0a||0xcc;return function(_0x42c691){if(_0x42c691){return _0x135c04[_0x3cc6('0x10')](_0x5b3d0a);}return _0x135c04[_0x3cc6('0x11')](_0x5b3d0a)[_0x3cc6('0x12')]();};}function respondWithResult(_0xba4e92,_0x401695){_0x401695=_0x401695||0xc8;return function(_0x71b02e){if(_0x71b02e){return _0xba4e92[_0x3cc6('0x11')](_0x401695)[_0x3cc6('0x13')](_0x71b02e);}};}function respondWithFilteredResult(_0x10d01b,_0x4bfffc){return function(_0x2972ca){if(_0x2972ca){var _0x5368b5=_0x2972ca['count'],_0x5826dd=_0x4bfffc['offset'],_0x47f03f=_0x4bfffc[_0x3cc6('0x14')]+_0x4bfffc[_0x3cc6('0x15')],_0xc70339;if(_0x47f03f>=_0x5368b5){_0x47f03f=_0x5368b5;_0xc70339=0xc8;}else{_0xc70339=0xce;}_0x10d01b[_0x3cc6('0x11')](_0xc70339);return _0x10d01b[_0x3cc6('0x16')](_0x3cc6('0x17'),_0x5826dd+'-'+_0x47f03f+'/'+_0x5368b5)['json'](_0x2972ca);}return null;};}function patchUpdates(_0xe11e1a){return function(_0x221209){try{jsonpatch[_0x3cc6('0x18')](_0x221209,_0xe11e1a,!![]);}catch(_0x1d1fa5){return BPromise[_0x3cc6('0x19')](_0x1d1fa5);}return _0x221209[_0x3cc6('0x1a')]();};}function saveUpdates(_0x576892,_0xe871a3){return function(_0x425b71){if(_0x425b71){return _0x425b71[_0x3cc6('0x1b')](_0x576892)[_0x3cc6('0x1c')](function(_0x5fc77c){return _0x5fc77c;});}return null;};}function removeEntity(_0x5abe98,_0x4016f6){return function(_0x227046){if(_0x227046){return _0x227046[_0x3cc6('0x1d')]()[_0x3cc6('0x1c')](function(){_0x5abe98['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8ce7,_0x23e0cc){return function(_0x2bdbb9){if(!_0x2bdbb9){_0x3f8ce7[_0x3cc6('0x10')](0x194);}return _0x2bdbb9;};}function handleError(_0x25ad7e,_0x34e85a){_0x34e85a=_0x34e85a||0x1f4;return function(_0x3fae2e){logger['error'](_0x3fae2e[_0x3cc6('0x1e')]);if(_0x3fae2e[_0x3cc6('0x1f')]){delete _0x3fae2e['name'];}_0x25ad7e[_0x3cc6('0x11')](_0x34e85a)['send'](_0x3fae2e);};}exports[_0x3cc6('0x20')]=function(_0x2aaaab,_0x43bf77){var _0x1a179f={},_0x449b1d={},_0x2ff4d4={'count':0x0,'rows':[]};var _0x29cf61=db[_0x3cc6('0x21')][_0x3cc6('0x22')];_0x449b1d[_0x3cc6('0x23')]=_[_0x3cc6('0x24')](_0x29cf61);var _0x513ed2={'dateStart':_0x2aaaab[_0x3cc6('0x25')][_0x3cc6('0x26')],'dateEnd':_0x2aaaab[_0x3cc6('0x25')][_0x3cc6('0x27')]};delete _0x2aaaab[_0x3cc6('0x25')][_0x3cc6('0x26')];delete _0x2aaaab['query'][_0x3cc6('0x27')];_0x449b1d[_0x3cc6('0x25')]=_['keys'](_0x2aaaab['query']);_0x449b1d['filters']=_[_0x3cc6('0x28')](_0x449b1d[_0x3cc6('0x23')],_0x449b1d['query']);_0x1a179f[_0x3cc6('0x29')]=_['intersection'](_0x449b1d[_0x3cc6('0x23')],qs['fields'](_0x2aaaab[_0x3cc6('0x25')]['fields']));_0x1a179f['attributes']=_0x1a179f[_0x3cc6('0x29')][_0x3cc6('0x2a')]?_0x1a179f[_0x3cc6('0x29')]:_0x449b1d[_0x3cc6('0x23')];if(!_0x2aaaab[_0x3cc6('0x25')]['hasOwnProperty'](_0x3cc6('0x2b'))){_0x1a179f[_0x3cc6('0x15')]=qs[_0x3cc6('0x15')](_0x2aaaab[_0x3cc6('0x25')][_0x3cc6('0x15')]);_0x1a179f[_0x3cc6('0x14')]=qs[_0x3cc6('0x14')](_0x2aaaab[_0x3cc6('0x25')][_0x3cc6('0x14')]);}_0x1a179f[_0x3cc6('0x2c')]=qs['sort'](_0x2aaaab['query'][_0x3cc6('0x2d')]);_0x1a179f[_0x3cc6('0x2e')]=qs[_0x3cc6('0x2f')](_[_0x3cc6('0x30')](_0x2aaaab[_0x3cc6('0x25')],_0x449b1d[_0x3cc6('0x2f')]));if(_0x513ed2[_0x3cc6('0x26')]){if(_0x513ed2[_0x3cc6('0x27')]){_0x513ed2[_0x3cc6('0x27')]=moment(_0x513ed2[_0x3cc6('0x27')])[_0x3cc6('0x31')](0x1,_0x3cc6('0x32'));}else{_0x513ed2[_0x3cc6('0x27')]=moment(_0x513ed2[_0x3cc6('0x26')])[_0x3cc6('0x31')](0x1,_0x3cc6('0x32'));}_['merge'](_0x1a179f[_0x3cc6('0x2e')],{'createdAt':{'$gte':_0x513ed2[_0x3cc6('0x26')],'$lte':_0x513ed2['dateEnd']}});}if(_0x2aaaab['query']['filter']){_0x1a179f[_0x3cc6('0x2e')]=_[_0x3cc6('0x33')](_0x1a179f['where'],{'$or':_[_0x3cc6('0x34')](_0x1a179f[_0x3cc6('0x29')],function(_0x4e0f2f){var _0x2d2a85={};_0x2d2a85[_0x4e0f2f]={'$like':'%'+_0x2aaaab[_0x3cc6('0x25')]['filter']+'%'};return _0x2d2a85;})});}_0x1a179f=_[_0x3cc6('0x33')]({},_0x1a179f,_0x2aaaab[_0x3cc6('0x35')]);var _0x5793d9={'where':_0x1a179f[_0x3cc6('0x2e')]};return db[_0x3cc6('0x21')][_0x3cc6('0x36')](_0x5793d9)['then'](function(_0xbb3f9a){_0x2ff4d4['count']=_0xbb3f9a;if(_0x2aaaab[_0x3cc6('0x25')][_0x3cc6('0x37')]){_0x1a179f[_0x3cc6('0x38')]=[{'all':!![]}];}return db[_0x3cc6('0x21')][_0x3cc6('0x39')](_0x1a179f);})[_0x3cc6('0x1c')](function(_0x18439d){_0x2ff4d4[_0x3cc6('0x3a')]=_0x18439d;return _0x2ff4d4;})[_0x3cc6('0x1c')](respondWithFilteredResult(_0x43bf77,_0x1a179f))[_0x3cc6('0x3b')](handleError(_0x43bf77,null));};exports['show']=function(_0x292b8c,_0x56f2ee){var _0x34b5c5={'raw':!![],'where':{'id':_0x292b8c[_0x3cc6('0x3c')]['id']}},_0x279567={};_0x279567[_0x3cc6('0x23')]=_[_0x3cc6('0x24')](db[_0x3cc6('0x21')]['rawAttributes']);_0x279567[_0x3cc6('0x25')]=_['keys'](_0x292b8c[_0x3cc6('0x25')]);_0x279567['filters']=_[_0x3cc6('0x28')](_0x279567[_0x3cc6('0x23')],_0x279567[_0x3cc6('0x25')]);_0x34b5c5[_0x3cc6('0x29')]=_[_0x3cc6('0x28')](_0x279567[_0x3cc6('0x23')],qs[_0x3cc6('0x3d')](_0x292b8c['query'][_0x3cc6('0x3d')]));_0x34b5c5[_0x3cc6('0x29')]=_0x34b5c5[_0x3cc6('0x29')][_0x3cc6('0x2a')]?_0x34b5c5[_0x3cc6('0x29')]:_0x279567['model'];if(_0x292b8c[_0x3cc6('0x25')][_0x3cc6('0x37')]){_0x34b5c5['include']=[{'all':!![]}];}_0x34b5c5=_[_0x3cc6('0x33')]({},_0x34b5c5,_0x292b8c[_0x3cc6('0x35')]);return db[_0x3cc6('0x21')][_0x3cc6('0x3e')](_0x34b5c5)[_0x3cc6('0x1c')](handleEntityNotFound(_0x56f2ee,null))[_0x3cc6('0x1c')](respondWithResult(_0x56f2ee,null))[_0x3cc6('0x3b')](handleError(_0x56f2ee,null));};exports[_0x3cc6('0x3f')]=function(_0x58d00c,_0x1a9fe5){return db[_0x3cc6('0x21')][_0x3cc6('0x3f')](_0x58d00c[_0x3cc6('0x40')],{})['then'](respondWithResult(_0x1a9fe5,0xc9))['catch'](handleError(_0x1a9fe5,null));};exports[_0x3cc6('0x1b')]=function(_0x14ae29,_0x4038d5){if(_0x14ae29[_0x3cc6('0x40')]['id']){delete _0x14ae29['body']['id'];}return db[_0x3cc6('0x21')][_0x3cc6('0x3e')]({'where':{'id':_0x14ae29[_0x3cc6('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4038d5,null))[_0x3cc6('0x1c')](saveUpdates(_0x14ae29[_0x3cc6('0x40')],null))[_0x3cc6('0x1c')](respondWithResult(_0x4038d5,null))['catch'](handleError(_0x4038d5,null));};exports['destroy']=function(_0x346403,_0x1b55ba){return db['MailTransferReport']['find']({'where':{'id':_0x346403['params']['id']}})[_0x3cc6('0x1c')](handleEntityNotFound(_0x1b55ba,null))['then'](removeEntity(_0x1b55ba,null))['catch'](handleError(_0x1b55ba,null));};exports[_0x3cc6('0x41')]=function(_0x2ff768,_0x2a175c){return db[_0x3cc6('0x21')][_0x3cc6('0x41')]()[_0x3cc6('0x1c')](respondWithResult(_0x2a175c,null))[_0x3cc6('0x3b')](handleError(_0x2a175c,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 29d6081..0d211b2 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 _0x3bd1=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','./mailTransferReport.attributes','exports'];(function(_0x22be98,_0x135b05){var _0x40b994=function(_0x1e9fa0){while(--_0x1e9fa0){_0x22be98['push'](_0x22be98['shift']());}};_0x40b994(++_0x135b05);}(_0x3bd1,0x111));var _0x13bd=function(_0x499bea,_0x2043c7){_0x499bea=_0x499bea-0x0;var _0x308df1=_0x3bd1[_0x499bea];return _0x308df1;};'use strict';var _=require(_0x13bd('0x0'));var util=require('util');var logger=require(_0x13bd('0x1'))(_0x13bd('0x2'));var moment=require(_0x13bd('0x3'));var BPromise=require(_0x13bd('0x4'));var rp=require('request-promise');var attributes=require(_0x13bd('0x5'));module[_0x13bd('0x6')]=function(_0x33f1b9,_0xd74b0f){return _0x33f1b9['define'](_0x13bd('0x7'),attributes,{'tableName':_0x13bd('0x8'),'paranoid':![],'indexes':[{'name':_0x13bd('0x9'),'fields':[_0x13bd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x758a=['api','moment','bluebird','define','MailTransferReport','report_mail_transfer','lodash','util','../../config/logger'];(function(_0x480795,_0x5cb048){var _0x6f0cb1=function(_0x39bf19){while(--_0x39bf19){_0x480795['push'](_0x480795['shift']());}};_0x6f0cb1(++_0x5cb048);}(_0x758a,0x1d1));var _0xa758=function(_0xaaa543,_0x31e7b3){_0xaaa543=_0xaaa543-0x0;var _0x53ab85=_0x758a[_0xaaa543];return _0x53ab85;};'use strict';var _=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var logger=require(_0xa758('0x2'))(_0xa758('0x3'));var moment=require(_0xa758('0x4'));var BPromise=require(_0xa758('0x5'));var rp=require('request-promise');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x22bfa3,_0x4eb1e2){return _0x22bfa3[_0xa758('0x6')](_0xa758('0x7'),attributes,{'tableName':_0xa758('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 6f00eb9..44ff0f7 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 _0x3a6c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2ecad4,_0x8dca5a){var _0x5b4a47=function(_0x5e21cc){while(--_0x5e21cc){_0x2ecad4['push'](_0x2ecad4['shift']());}};_0x5b4a47(++_0x8dca5a);}(_0x3a6c,0x163));var _0xc3a6=function(_0x3698af,_0x462cff){_0x3698af=_0x3698af-0x0;var _0x320570=_0x3a6c[_0x3698af];return _0x320570;};'use strict';var _=require(_0xc3a6('0x0'));var util=require(_0xc3a6('0x1'));var moment=require(_0xc3a6('0x2'));var BPromise=require(_0xc3a6('0x3'));var rs=require(_0xc3a6('0x4'));var fs=require('fs');var db=require(_0xc3a6('0x5'))['db'];var utils=require(_0xc3a6('0x6'));var logger=require(_0xc3a6('0x7'))(_0xc3a6('0x8'));var config=require(_0xc3a6('0x9'));var jayson=require(_0xc3a6('0xa'));var client=jayson[_0xc3a6('0xb')][_0xc3a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ce0b7,_0x1a7451,_0x355d59){return new BPromise(function(_0x21b3c,_0xa2a7fa){return client[_0xc3a6('0xd')](_0x5ce0b7,_0x355d59)['then'](function(_0x25032b){logger[_0xc3a6('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1a7451,_0xc3a6('0xf'));logger[_0xc3a6('0x10')](_0xc3a6('0x11'),_0x1a7451,_0xc3a6('0xf'),JSON[_0xc3a6('0x12')](_0x25032b));if(_0x25032b[_0xc3a6('0x13')]){if(_0x25032b[_0xc3a6('0x13')][_0xc3a6('0x14')]===0x1f4){logger[_0xc3a6('0x13')](_0xc3a6('0x15'),_0x1a7451,_0x25032b[_0xc3a6('0x13')]['message']);return _0xa2a7fa(_0x25032b[_0xc3a6('0x13')]['message']);}logger[_0xc3a6('0x13')](_0xc3a6('0x15'),_0x1a7451,_0x25032b[_0xc3a6('0x13')]['message']);return _0x21b3c(_0x25032b[_0xc3a6('0x13')]['message']);}else{logger[_0xc3a6('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1a7451,_0xc3a6('0xf'));_0x21b3c(_0x25032b['result'][_0xc3a6('0x16')]);}})[_0xc3a6('0x17')](function(_0x648ab9){logger[_0xc3a6('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x1a7451,_0x648ab9);_0xa2a7fa(_0x648ab9);});});} \ No newline at end of file +var _0x735a=['info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa650fb,_0x104a00){var _0x99f4de=function(_0x5f4d31){while(--_0x5f4d31){_0xa650fb['push'](_0xa650fb['shift']());}};_0x99f4de(++_0x104a00);}(_0x735a,0xb3));var _0xa735=function(_0x1f113a,_0x494cf8){_0x1f113a=_0x1f113a-0x0;var _0x3ee007=_0x735a[_0x1f113a];return _0x3ee007;};'use strict';var _=require(_0xa735('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa735('0x1'));var rs=require(_0xa735('0x2'));var fs=require('fs');var db=require(_0xa735('0x3'))['db'];var utils=require(_0xa735('0x4'));var logger=require(_0xa735('0x5'))(_0xa735('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa735('0x7')][_0xa735('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12e9eb,_0x29de5d,_0x1c5201){return new BPromise(function(_0x3ceb6b,_0x1c154e){return client[_0xa735('0x9')](_0x12e9eb,_0x1c5201)[_0xa735('0xa')](function(_0x10017a){logger['info'](_0xa735('0xb'),_0x29de5d,_0xa735('0xc'));logger[_0xa735('0xd')](_0xa735('0xe'),_0x29de5d,_0xa735('0xc'),JSON[_0xa735('0xf')](_0x10017a));if(_0x10017a[_0xa735('0x10')]){if(_0x10017a[_0xa735('0x10')][_0xa735('0x11')]===0x1f4){logger['error'](_0xa735('0xb'),_0x29de5d,_0x10017a[_0xa735('0x10')][_0xa735('0x12')]);return _0x1c154e(_0x10017a['error'][_0xa735('0x12')]);}logger[_0xa735('0x10')](_0xa735('0xb'),_0x29de5d,_0x10017a[_0xa735('0x10')][_0xa735('0x12')]);return _0x3ceb6b(_0x10017a[_0xa735('0x10')]['message']);}else{logger[_0xa735('0x13')](_0xa735('0xb'),_0x29de5d,'request\x20sent');_0x3ceb6b(_0x10017a[_0xa735('0x14')][_0xa735('0x12')]);}})[_0xa735('0x15')](function(_0x1ab45c){logger[_0xa735('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x29de5d,_0x1ab45c);_0x1c154e(_0x1ab45c);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 3282459..c309118 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 _0xd62e=['isAuthenticated','index','describe','/:id','post','put','delete','exports','multer','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get'];(function(_0x2d6375,_0x149216){var _0x29186f=function(_0x31fc6f){while(--_0x31fc6f){_0x2d6375['push'](_0x2d6375['shift']());}};_0x29186f(++_0x149216);}(_0xd62e,0x1ac));var _0xed62=function(_0xceb9b8,_0x3ce78e){_0xceb9b8=_0xceb9b8-0x0;var _0x5a28e1=_0xd62e[_0xceb9b8];return _0x5a28e1;};'use strict';var multer=require(_0xed62('0x0'));var util=require('util');var path=require('path');var express=require(_0xed62('0x1'));var router=express[_0xed62('0x2')]();var auth=require(_0xed62('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xed62('0x4'));var controller=require(_0xed62('0x5'));router[_0xed62('0x6')]('/',auth[_0xed62('0x7')](),controller[_0xed62('0x8')]);router['get']('/describe',auth[_0xed62('0x7')](),controller[_0xed62('0x9')]);router['get'](_0xed62('0xa'),auth[_0xed62('0x7')](),controller['show']);router[_0xed62('0xb')]('/',auth[_0xed62('0x7')](),controller['create']);router[_0xed62('0xc')](_0xed62('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xed62('0xd')](_0xed62('0xa'),auth[_0xed62('0x7')](),controller['destroy']);module[_0xed62('0xe')]=router; \ No newline at end of file +var _0xdcb7=['multer','Router','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','delete','destroy','exports'];(function(_0x3ac9e0,_0xc426ed){var _0x8644bd=function(_0x4642ce){while(--_0x4642ce){_0x3ac9e0['push'](_0x3ac9e0['shift']());}};_0x8644bd(++_0xc426ed);}(_0xdcb7,0x100));var _0x7dcb=function(_0x10f275,_0x510225){_0x10f275=_0x10f275-0x0;var _0x4757e7=_0xdcb7[_0x10f275];return _0x4757e7;};'use strict';var multer=require(_0x7dcb('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0x7dcb('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x7dcb('0x2'));var config=require(_0x7dcb('0x3'));var controller=require(_0x7dcb('0x4'));router['get']('/',auth[_0x7dcb('0x5')](),controller['index']);router['get'](_0x7dcb('0x6'),auth['isAuthenticated'](),controller[_0x7dcb('0x7')]);router[_0x7dcb('0x8')](_0x7dcb('0x9'),auth[_0x7dcb('0x5')](),controller[_0x7dcb('0xa')]);router[_0x7dcb('0xb')]('/',auth[_0x7dcb('0x5')](),controller[_0x7dcb('0xc')]);router['put'](_0x7dcb('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x7dcb('0xd')](_0x7dcb('0x9'),auth[_0x7dcb('0x5')](),controller[_0x7dcb('0xe')]);module[_0x7dcb('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 28d1017..9cd890c 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 _0x4861=['talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]'];(function(_0x21c150,_0x435dff){var _0x2ee710=function(_0x4be161){while(--_0x4be161){_0x21c150['push'](_0x21c150['shift']());}};_0x2ee710(++_0x435dff);}(_0x4861,0x89));var _0x1486=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4861[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0x1486('0x0'));var moment=require(_0x1486('0x1'));module[_0x1486('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1486('0x3')]},'interface':{'type':Sequelize[_0x1486('0x3')]},'type':{'type':Sequelize[_0x1486('0x3')],'defaultValue':_0x1486('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x1486('0x5')]},'enterAt':{'type':Sequelize[_0x1486('0x6')]},'exitAt':{'type':Sequelize[_0x1486('0x6')],'set':function(_0x20c304){var _0x3945b8=moment(_0x20c304);var _0x10171f=moment(this[_0x1486('0x7')](_0x1486('0x8')));var _0x3f74a8=_0x3945b8[_0x1486('0x9')](_0x10171f,_0x1486('0xa'));this['setDataValue'](_0x1486('0xb'),_0x20c304);this[_0x1486('0xc')]('duration',_0x3f74a8||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x1486('0xd')},'data2':{'type':Sequelize[_0x1486('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x1486('0x3')],'comment':_0x1486('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0x1486('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x1486('0x10')},'role':{'type':Sequelize[_0x1486('0x3')]},'internal':{'type':Sequelize[_0x1486('0x5')]},'uniqueid':{'type':Sequelize[_0x1486('0x3')]}}; \ No newline at end of file +var _0x65f4=['talk:[queue]','INTEGER','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','diff','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]'];(function(_0x399095,_0x133dae){var _0x40a046=function(_0x1e6803){while(--_0x1e6803){_0x399095['push'](_0x399095['shift']());}};_0x40a046(++_0x133dae);}(_0x65f4,0x15b));var _0x465f=function(_0x47295e,_0x38a152){_0x47295e=_0x47295e-0x0;var _0x223906=_0x65f4[_0x47295e];return _0x223906;};'use strict';var Sequelize=require(_0x465f('0x0'));var moment=require('moment');module[_0x465f('0x1')]={'channel':{'type':Sequelize[_0x465f('0x2')]},'membername':{'type':Sequelize[_0x465f('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x465f('0x2')],'defaultValue':_0x465f('0x3'),'comment':_0x465f('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x465f('0x5')]},'exitAt':{'type':Sequelize[_0x465f('0x5')],'set':function(_0x30c4ea){var _0x169071=moment(_0x30c4ea);var _0x2280c7=moment(this['getDataValue'](_0x465f('0x6')));var _0x412b73=_0x169071[_0x465f('0x7')](_0x2280c7,'seconds');this['setDataValue'](_0x465f('0x8'),_0x30c4ea);this['setDataValue'](_0x465f('0x9'),_0x412b73||null);}},'data1':{'type':Sequelize[_0x465f('0x2')],'comment':_0x465f('0xa')},'data2':{'type':Sequelize[_0x465f('0x2')],'comment':_0x465f('0xb')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x465f('0xc')},'data5':{'type':Sequelize[_0x465f('0x2')],'comment':_0x465f('0xd')},'role':{'type':Sequelize[_0x465f('0x2')]},'internal':{'type':Sequelize[_0x465f('0xe')]},'uniqueid':{'type':Sequelize[_0x465f('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 7dd58ee..f91310b 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 _0xc74c=['show','params','fields','include','options','catch','create','body','update','find','describe','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','reject','save','then','destroy','end','error','stack','name','send','MemberReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','includeAll','findAll','rows'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xc74c,0x11b));var _0xcc74=function(_0x2b0b3b,_0x440f7d){_0x2b0b3b=_0x2b0b3b-0x0;var _0x10cb6b=_0xc74c[_0x2b0b3b];return _0x10cb6b;};'use strict';var jsonpatch=require(_0xcc74('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcc74('0x1'));var Mustache=require(_0xcc74('0x2'));var util=require(_0xcc74('0x3'));var path=require(_0xcc74('0x4'));var sox=require(_0xcc74('0x5'));var csv=require(_0xcc74('0x6'));var ejs=require(_0xcc74('0x7'));var fs=require('fs');var _=require(_0xcc74('0x8'));var squel=require(_0xcc74('0x9'));var crypto=require('crypto');var jsforce=require(_0xcc74('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xcc74('0x6'));var querystring=require(_0xcc74('0xb'));var Papa=require(_0xcc74('0xc'));var qs=require(_0xcc74('0xd'));var logger=require(_0xcc74('0xe'))(_0xcc74('0xf'));var utils=require('../../config/utils');var config=require(_0xcc74('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bd3df,_0x35961c){_0x35961c=_0x35961c||0xcc;return function(_0x44b3dd){if(_0x44b3dd){return _0x1bd3df[_0xcc74('0x11')](_0x35961c);}return _0x1bd3df[_0xcc74('0x12')](_0x35961c)['end']();};}function respondWithResult(_0x434102,_0x5b4e1c){_0x5b4e1c=_0x5b4e1c||0xc8;return function(_0x172569){if(_0x172569){return _0x434102[_0xcc74('0x12')](_0x5b4e1c)[_0xcc74('0x13')](_0x172569);}};}function respondWithFilteredResult(_0x5f5aaa,_0x410b52){return function(_0x2d9963){if(_0x2d9963){var _0x260e19=_0x2d9963[_0xcc74('0x14')],_0x4fc063=_0x410b52[_0xcc74('0x15')],_0x259d5d=_0x410b52['offset']+_0x410b52[_0xcc74('0x16')],_0x56ac15;if(_0x259d5d>=_0x260e19){_0x259d5d=_0x260e19;_0x56ac15=0xc8;}else{_0x56ac15=0xce;}_0x5f5aaa['status'](_0x56ac15);return _0x5f5aaa[_0xcc74('0x17')]('Content-Range',_0x4fc063+'-'+_0x259d5d+'/'+_0x260e19)[_0xcc74('0x13')](_0x2d9963);}return null;};}function patchUpdates(_0x4d403d){return function(_0x41f69a){try{jsonpatch['apply'](_0x41f69a,_0x4d403d,!![]);}catch(_0x5ed720){return BPromise[_0xcc74('0x18')](_0x5ed720);}return _0x41f69a[_0xcc74('0x19')]();};}function saveUpdates(_0x36d921,_0x2afd86){return function(_0x2d453d){if(_0x2d453d){return _0x2d453d['update'](_0x36d921)[_0xcc74('0x1a')](function(_0x3d9953){return _0x3d9953;});}return null;};}function removeEntity(_0x3b58ba,_0x34cae9){return function(_0x2f2ba8){if(_0x2f2ba8){return _0x2f2ba8[_0xcc74('0x1b')]()[_0xcc74('0x1a')](function(){_0x3b58ba[_0xcc74('0x12')](0xcc)[_0xcc74('0x1c')]();});}};}function handleEntityNotFound(_0x5a3359,_0x1e5e75){return function(_0x102ff6){if(!_0x102ff6){_0x5a3359['sendStatus'](0x194);}return _0x102ff6;};}function handleError(_0x1c96ba,_0x54396b){_0x54396b=_0x54396b||0x1f4;return function(_0x55945d){logger[_0xcc74('0x1d')](_0x55945d[_0xcc74('0x1e')]);if(_0x55945d[_0xcc74('0x1f')]){delete _0x55945d[_0xcc74('0x1f')];}_0x1c96ba['status'](_0x54396b)[_0xcc74('0x20')](_0x55945d);};}exports['index']=function(_0x5ca0fb,_0x2a91e6){var _0x2927b4={},_0x272dcf={},_0x533088={'count':0x0,'rows':[]};var _0x312776=db[_0xcc74('0x21')][_0xcc74('0x22')];_0x272dcf[_0xcc74('0x23')]=_[_0xcc74('0x24')](_0x312776);var _0x5a5662={'dateStart':_0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x26')],'dateEnd':_0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x27')]};delete _0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x26')];delete _0x5ca0fb['query'][_0xcc74('0x27')];_0x272dcf[_0xcc74('0x25')]=_[_0xcc74('0x24')](_0x5ca0fb[_0xcc74('0x25')]);_0x272dcf[_0xcc74('0x28')]=_[_0xcc74('0x29')](_0x272dcf[_0xcc74('0x23')],_0x272dcf['query']);_0x2927b4[_0xcc74('0x2a')]=_[_0xcc74('0x29')](_0x272dcf[_0xcc74('0x23')],qs['fields'](_0x5ca0fb['query']['fields']));_0x2927b4[_0xcc74('0x2a')]=_0x2927b4[_0xcc74('0x2a')][_0xcc74('0x2b')]?_0x2927b4[_0xcc74('0x2a')]:_0x272dcf[_0xcc74('0x23')];if(!_0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x2c')]('nolimit')){_0x2927b4['limit']=qs[_0xcc74('0x16')](_0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x16')]);_0x2927b4[_0xcc74('0x15')]=qs[_0xcc74('0x15')](_0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x15')]);}_0x2927b4[_0xcc74('0x2d')]=qs[_0xcc74('0x2e')](_0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x2e')]);_0x2927b4[_0xcc74('0x2f')]=qs[_0xcc74('0x28')](_[_0xcc74('0x30')](_0x5ca0fb[_0xcc74('0x25')],_0x272dcf['filters']));if(_0x5a5662[_0xcc74('0x26')]){if(_0x5a5662[_0xcc74('0x27')]){_0x5a5662[_0xcc74('0x27')]=moment(_0x5a5662['dateEnd'])[_0xcc74('0x31')](0x1,_0xcc74('0x32'));}else{_0x5a5662['dateEnd']=moment(_0x5a5662[_0xcc74('0x26')])['add'](0x1,_0xcc74('0x32'));}_[_0xcc74('0x33')](_0x2927b4['where'],{'createdAt':{'$gte':_0x5a5662['dateStart'],'$lte':_0x5a5662[_0xcc74('0x27')]}});}if(_0x5ca0fb['query'][_0xcc74('0x34')]){_0x2927b4['where']=_[_0xcc74('0x33')](_0x2927b4[_0xcc74('0x2f')],{'$or':_[_0xcc74('0x35')](_0x2927b4[_0xcc74('0x2a')],function(_0x391223){var _0x374341={};_0x374341[_0x391223]={'$like':'%'+_0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x34')]+'%'};return _0x374341;})});}_0x2927b4=_[_0xcc74('0x33')]({},_0x2927b4,_0x5ca0fb['options']);var _0x23996e={'where':_0x2927b4['where']};return db[_0xcc74('0x21')][_0xcc74('0x14')](_0x23996e)[_0xcc74('0x1a')](function(_0x60d7f){_0x533088[_0xcc74('0x14')]=_0x60d7f;if(_0x5ca0fb[_0xcc74('0x25')][_0xcc74('0x36')]){_0x2927b4['include']=[{'all':!![]}];}return db['MemberReport'][_0xcc74('0x37')](_0x2927b4);})[_0xcc74('0x1a')](function(_0x4fe278){_0x533088[_0xcc74('0x38')]=_0x4fe278;return _0x533088;})[_0xcc74('0x1a')](respondWithFilteredResult(_0x2a91e6,_0x2927b4))['catch'](handleError(_0x2a91e6,null));};exports[_0xcc74('0x39')]=function(_0x191236,_0x1df793){var _0x2a9d93={'raw':!![],'where':{'id':_0x191236[_0xcc74('0x3a')]['id']}},_0x24adbc={};_0x24adbc[_0xcc74('0x23')]=_[_0xcc74('0x24')](db['MemberReport']['rawAttributes']);_0x24adbc[_0xcc74('0x25')]=_[_0xcc74('0x24')](_0x191236[_0xcc74('0x25')]);_0x24adbc['filters']=_[_0xcc74('0x29')](_0x24adbc['model'],_0x24adbc[_0xcc74('0x25')]);_0x2a9d93[_0xcc74('0x2a')]=_['intersection'](_0x24adbc[_0xcc74('0x23')],qs[_0xcc74('0x3b')](_0x191236['query'][_0xcc74('0x3b')]));_0x2a9d93[_0xcc74('0x2a')]=_0x2a9d93['attributes'][_0xcc74('0x2b')]?_0x2a9d93[_0xcc74('0x2a')]:_0x24adbc['model'];if(_0x191236[_0xcc74('0x25')][_0xcc74('0x36')]){_0x2a9d93[_0xcc74('0x3c')]=[{'all':!![]}];}_0x2a9d93=_[_0xcc74('0x33')]({},_0x2a9d93,_0x191236[_0xcc74('0x3d')]);return db['MemberReport']['find'](_0x2a9d93)[_0xcc74('0x1a')](handleEntityNotFound(_0x1df793,null))[_0xcc74('0x1a')](respondWithResult(_0x1df793,null))[_0xcc74('0x3e')](handleError(_0x1df793,null));};exports['create']=function(_0x15047d,_0x3bc229){return db[_0xcc74('0x21')][_0xcc74('0x3f')](_0x15047d[_0xcc74('0x40')],{})[_0xcc74('0x1a')](respondWithResult(_0x3bc229,0xc9))[_0xcc74('0x3e')](handleError(_0x3bc229,null));};exports[_0xcc74('0x41')]=function(_0x3c52f1,_0x4e8498){if(_0x3c52f1[_0xcc74('0x40')]['id']){delete _0x3c52f1[_0xcc74('0x40')]['id'];}return db[_0xcc74('0x21')][_0xcc74('0x42')]({'where':{'id':_0x3c52f1[_0xcc74('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4e8498,null))[_0xcc74('0x1a')](saveUpdates(_0x3c52f1[_0xcc74('0x40')],null))[_0xcc74('0x1a')](respondWithResult(_0x4e8498,null))[_0xcc74('0x3e')](handleError(_0x4e8498,null));};exports[_0xcc74('0x1b')]=function(_0x5e4a28,_0x3ad1c2){return db[_0xcc74('0x21')][_0xcc74('0x42')]({'where':{'id':_0x5e4a28[_0xcc74('0x3a')]['id']}})[_0xcc74('0x1a')](handleEntityNotFound(_0x3ad1c2,null))[_0xcc74('0x1a')](removeEntity(_0x3ad1c2,null))['catch'](handleError(_0x3ad1c2,null));};exports[_0xcc74('0x43')]=function(_0x2f73ab,_0x59a7ac){return db['MemberReport'][_0xcc74('0x43')]()[_0xcc74('0x1a')](respondWithResult(_0x59a7ac,null))[_0xcc74('0x3e')](handleError(_0x59a7ac,null));}; \ No newline at end of file +var _0xf81c=['limit','set','Content-Range','apply','reject','update','destroy','then','name','send','index','MemberReport','model','query','dateEnd','dateStart','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','includeAll','include','rows','catch','params','length','find','create','body','describe','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset'];(function(_0xfba88d,_0x582a6a){var _0x4333a4=function(_0xaf1ed9){while(--_0xaf1ed9){_0xfba88d['push'](_0xfba88d['shift']());}};_0x4333a4(++_0x582a6a);}(_0xf81c,0x69));var _0xcf81=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0xf81c[_0x3b0d98];return _0x296885;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xcf81('0x0'));var moment=require(_0xcf81('0x1'));var BPromise=require(_0xcf81('0x2'));var Mustache=require(_0xcf81('0x3'));var util=require(_0xcf81('0x4'));var path=require(_0xcf81('0x5'));var sox=require(_0xcf81('0x6'));var csv=require(_0xcf81('0x7'));var ejs=require(_0xcf81('0x8'));var fs=require('fs');var _=require(_0xcf81('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcf81('0xa'));var toCsv=require(_0xcf81('0x7'));var querystring=require(_0xcf81('0xb'));var Papa=require(_0xcf81('0xc'));var qs=require(_0xcf81('0xd'));var logger=require(_0xcf81('0xe'))('api');var utils=require(_0xcf81('0xf'));var config=require(_0xcf81('0x10'));var db=require(_0xcf81('0x11'))['db'];function respondWithStatusCode(_0x2d017c,_0x3dac7f){_0x3dac7f=_0x3dac7f||0xcc;return function(_0x1728e3){if(_0x1728e3){return _0x2d017c[_0xcf81('0x12')](_0x3dac7f);}return _0x2d017c['status'](_0x3dac7f)[_0xcf81('0x13')]();};}function respondWithResult(_0xd1d9d4,_0x76bd67){_0x76bd67=_0x76bd67||0xc8;return function(_0x516556){if(_0x516556){return _0xd1d9d4[_0xcf81('0x14')](_0x76bd67)['json'](_0x516556);}};}function respondWithFilteredResult(_0x2b927e,_0x50d35d){return function(_0x72272){if(_0x72272){var _0x998b56=_0x72272[_0xcf81('0x15')],_0x1adef7=_0x50d35d['offset'],_0xa64306=_0x50d35d[_0xcf81('0x16')]+_0x50d35d[_0xcf81('0x17')],_0x1b4b56;if(_0xa64306>=_0x998b56){_0xa64306=_0x998b56;_0x1b4b56=0xc8;}else{_0x1b4b56=0xce;}_0x2b927e[_0xcf81('0x14')](_0x1b4b56);return _0x2b927e[_0xcf81('0x18')](_0xcf81('0x19'),_0x1adef7+'-'+_0xa64306+'/'+_0x998b56)['json'](_0x72272);}return null;};}function patchUpdates(_0x5bc265){return function(_0x24849c){try{jsonpatch[_0xcf81('0x1a')](_0x24849c,_0x5bc265,!![]);}catch(_0x17ea21){return BPromise[_0xcf81('0x1b')](_0x17ea21);}return _0x24849c['save']();};}function saveUpdates(_0x1d2140,_0xd9b8d7){return function(_0x3223c0){if(_0x3223c0){return _0x3223c0[_0xcf81('0x1c')](_0x1d2140)['then'](function(_0x4b5282){return _0x4b5282;});}return null;};}function removeEntity(_0x32f8d2,_0x429c75){return function(_0x45f61e){if(_0x45f61e){return _0x45f61e[_0xcf81('0x1d')]()[_0xcf81('0x1e')](function(){_0x32f8d2[_0xcf81('0x14')](0xcc)[_0xcf81('0x13')]();});}};}function handleEntityNotFound(_0x126e07,_0x31cde6){return function(_0x1749c1){if(!_0x1749c1){_0x126e07[_0xcf81('0x12')](0x194);}return _0x1749c1;};}function handleError(_0x147feb,_0x13619f){_0x13619f=_0x13619f||0x1f4;return function(_0x411014){logger['error'](_0x411014['stack']);if(_0x411014[_0xcf81('0x1f')]){delete _0x411014[_0xcf81('0x1f')];}_0x147feb[_0xcf81('0x14')](_0x13619f)[_0xcf81('0x20')](_0x411014);};}exports[_0xcf81('0x21')]=function(_0x48b389,_0x3a1781){var _0x176d70={},_0x12c379={},_0xb116a6={'count':0x0,'rows':[]};var _0xaa2eec=db[_0xcf81('0x22')]['rawAttributes'];_0x12c379[_0xcf81('0x23')]=_['keys'](_0xaa2eec);var _0x367478={'dateStart':_0x48b389[_0xcf81('0x24')]['dateStart'],'dateEnd':_0x48b389[_0xcf81('0x24')][_0xcf81('0x25')]};delete _0x48b389['query'][_0xcf81('0x26')];delete _0x48b389[_0xcf81('0x24')]['dateEnd'];_0x12c379[_0xcf81('0x24')]=_[_0xcf81('0x27')](_0x48b389[_0xcf81('0x24')]);_0x12c379[_0xcf81('0x28')]=_[_0xcf81('0x29')](_0x12c379[_0xcf81('0x23')],_0x12c379[_0xcf81('0x24')]);_0x176d70['attributes']=_['intersection'](_0x12c379['model'],qs[_0xcf81('0x2a')](_0x48b389[_0xcf81('0x24')][_0xcf81('0x2a')]));_0x176d70[_0xcf81('0x2b')]=_0x176d70['attributes']['length']?_0x176d70[_0xcf81('0x2b')]:_0x12c379[_0xcf81('0x23')];if(!_0x48b389[_0xcf81('0x24')][_0xcf81('0x2c')](_0xcf81('0x2d'))){_0x176d70[_0xcf81('0x17')]=qs[_0xcf81('0x17')](_0x48b389[_0xcf81('0x24')]['limit']);_0x176d70[_0xcf81('0x16')]=qs[_0xcf81('0x16')](_0x48b389['query'][_0xcf81('0x16')]);}_0x176d70[_0xcf81('0x2e')]=qs['sort'](_0x48b389[_0xcf81('0x24')][_0xcf81('0x2f')]);_0x176d70[_0xcf81('0x30')]=qs['filters'](_[_0xcf81('0x31')](_0x48b389[_0xcf81('0x24')],_0x12c379[_0xcf81('0x28')]));if(_0x367478[_0xcf81('0x26')]){if(_0x367478[_0xcf81('0x25')]){_0x367478['dateEnd']=moment(_0x367478['dateEnd'])[_0xcf81('0x32')](0x1,_0xcf81('0x33'));}else{_0x367478['dateEnd']=moment(_0x367478[_0xcf81('0x26')])[_0xcf81('0x32')](0x1,'day');}_[_0xcf81('0x34')](_0x176d70['where'],{'createdAt':{'$gte':_0x367478[_0xcf81('0x26')],'$lte':_0x367478[_0xcf81('0x25')]}});}if(_0x48b389[_0xcf81('0x24')]['filter']){_0x176d70[_0xcf81('0x30')]=_[_0xcf81('0x34')](_0x176d70['where'],{'$or':_['map'](_0x176d70[_0xcf81('0x2b')],function(_0x3ab936){var _0x3cbc8f={};_0x3cbc8f[_0x3ab936]={'$like':'%'+_0x48b389[_0xcf81('0x24')][_0xcf81('0x35')]+'%'};return _0x3cbc8f;})});}_0x176d70=_[_0xcf81('0x34')]({},_0x176d70,_0x48b389['options']);var _0x10122f={'where':_0x176d70[_0xcf81('0x30')]};return db[_0xcf81('0x22')][_0xcf81('0x15')](_0x10122f)[_0xcf81('0x1e')](function(_0x48bb37){_0xb116a6['count']=_0x48bb37;if(_0x48b389[_0xcf81('0x24')][_0xcf81('0x36')]){_0x176d70[_0xcf81('0x37')]=[{'all':!![]}];}return db[_0xcf81('0x22')]['findAll'](_0x176d70);})[_0xcf81('0x1e')](function(_0x5c5e75){_0xb116a6[_0xcf81('0x38')]=_0x5c5e75;return _0xb116a6;})[_0xcf81('0x1e')](respondWithFilteredResult(_0x3a1781,_0x176d70))[_0xcf81('0x39')](handleError(_0x3a1781,null));};exports['show']=function(_0x696615,_0x5f56e3){var _0x42acf2={'raw':!![],'where':{'id':_0x696615[_0xcf81('0x3a')]['id']}},_0x3ebfaa={};_0x3ebfaa[_0xcf81('0x23')]=_[_0xcf81('0x27')](db[_0xcf81('0x22')]['rawAttributes']);_0x3ebfaa[_0xcf81('0x24')]=_['keys'](_0x696615[_0xcf81('0x24')]);_0x3ebfaa[_0xcf81('0x28')]=_[_0xcf81('0x29')](_0x3ebfaa[_0xcf81('0x23')],_0x3ebfaa[_0xcf81('0x24')]);_0x42acf2[_0xcf81('0x2b')]=_[_0xcf81('0x29')](_0x3ebfaa[_0xcf81('0x23')],qs[_0xcf81('0x2a')](_0x696615[_0xcf81('0x24')][_0xcf81('0x2a')]));_0x42acf2[_0xcf81('0x2b')]=_0x42acf2[_0xcf81('0x2b')][_0xcf81('0x3b')]?_0x42acf2[_0xcf81('0x2b')]:_0x3ebfaa[_0xcf81('0x23')];if(_0x696615[_0xcf81('0x24')][_0xcf81('0x36')]){_0x42acf2[_0xcf81('0x37')]=[{'all':!![]}];}_0x42acf2=_['merge']({},_0x42acf2,_0x696615['options']);return db[_0xcf81('0x22')][_0xcf81('0x3c')](_0x42acf2)['then'](handleEntityNotFound(_0x5f56e3,null))[_0xcf81('0x1e')](respondWithResult(_0x5f56e3,null))['catch'](handleError(_0x5f56e3,null));};exports[_0xcf81('0x3d')]=function(_0x2ec882,_0x34a551){return db[_0xcf81('0x22')][_0xcf81('0x3d')](_0x2ec882[_0xcf81('0x3e')],{})[_0xcf81('0x1e')](respondWithResult(_0x34a551,0xc9))[_0xcf81('0x39')](handleError(_0x34a551,null));};exports['update']=function(_0x279b6d,_0x5698aa){if(_0x279b6d[_0xcf81('0x3e')]['id']){delete _0x279b6d[_0xcf81('0x3e')]['id'];}return db[_0xcf81('0x22')]['find']({'where':{'id':_0x279b6d[_0xcf81('0x3a')]['id']}})[_0xcf81('0x1e')](handleEntityNotFound(_0x5698aa,null))[_0xcf81('0x1e')](saveUpdates(_0x279b6d[_0xcf81('0x3e')],null))[_0xcf81('0x1e')](respondWithResult(_0x5698aa,null))[_0xcf81('0x39')](handleError(_0x5698aa,null));};exports[_0xcf81('0x1d')]=function(_0x32b0f5,_0x197899){return db[_0xcf81('0x22')][_0xcf81('0x3c')]({'where':{'id':_0x32b0f5[_0xcf81('0x3a')]['id']}})[_0xcf81('0x1e')](handleEntityNotFound(_0x197899,null))[_0xcf81('0x1e')](removeEntity(_0x197899,null))[_0xcf81('0x39')](handleError(_0x197899,null));};exports[_0xcf81('0x3f')]=function(_0x2488e9,_0x120908){return db[_0xcf81('0x22')]['describe']()[_0xcf81('0x1e')](respondWithResult(_0x120908,null))[_0xcf81('0x39')](handleError(_0x120908,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 759579b..60fc7a2 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 _0xed7e=['util','moment','./memberReport.attributes','exports','MemberReport','membername_interface','interface','lodash'];(function(_0x456cad,_0x3c37f0){var _0x1f2c6c=function(_0x3e8866){while(--_0x3e8866){_0x456cad['push'](_0x456cad['shift']());}};_0x1f2c6c(++_0x3c37f0);}(_0xed7e,0x8f));var _0xeed7=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xed7e[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xeed7('0x0'));var util=require(_0xeed7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeed7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xeed7('0x3'));module[_0xeed7('0x4')]=function(_0x2da2e8,_0x1dac52){return _0x2da2e8['define'](_0xeed7('0x5'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xeed7('0x6'),'fields':['membername',_0xeed7('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7821=['lodash','moment','bluebird','request-promise','MemberReport','membername'];(function(_0x42bd4a,_0x5a893b){var _0x4a95b6=function(_0x4b0fe1){while(--_0x4b0fe1){_0x42bd4a['push'](_0x42bd4a['shift']());}};_0x4a95b6(++_0x5a893b);}(_0x7821,0x162));var _0x1782=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x7821[_0x414655];return _0x237884;};'use strict';var _=require(_0x1782('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1782('0x1'));var BPromise=require(_0x1782('0x2'));var rp=require(_0x1782('0x3'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x44ecfb,_0x103008){return _0x44ecfb['define'](_0x1782('0x4'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x1782('0x5'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index c635c10..2db49b6 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 _0x3291=['body','UpdateMemberReport','update','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','map','model','catch','CreateMemberReport','create'];(function(_0x54ccd7,_0x3bc3ce){var _0x4e667b=function(_0xab8fea){while(--_0xab8fea){_0x54ccd7['push'](_0x54ccd7['shift']());}};_0x4e667b(++_0x3bc3ce);}(_0x3291,0x1cb));var _0x1329=function(_0x25a954,_0x5b9ca8){_0x25a954=_0x25a954-0x0;var _0x260e6e=_0x3291[_0x25a954];return _0x260e6e;};'use strict';var _=require(_0x1329('0x0'));var util=require(_0x1329('0x1'));var moment=require(_0x1329('0x2'));var BPromise=require('bluebird');var rs=require(_0x1329('0x3'));var fs=require('fs');var db=require(_0x1329('0x4'))['db'];var utils=require(_0x1329('0x5'));var logger=require(_0x1329('0x6'))(_0x1329('0x7'));var config=require(_0x1329('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1329('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44381f,_0x3904d0,_0x2ca3fc){return new BPromise(function(_0x3823ae,_0x429dd0){return client[_0x1329('0xa')](_0x44381f,_0x2ca3fc)[_0x1329('0xb')](function(_0x3ec7e4){logger[_0x1329('0xc')]('MemberReport,\x20%s,\x20%s',_0x3904d0,_0x1329('0xd'));logger[_0x1329('0xe')](_0x1329('0xf'),_0x3904d0,_0x1329('0xd'),JSON[_0x1329('0x10')](_0x3ec7e4));if(_0x3ec7e4[_0x1329('0x11')]){if(_0x3ec7e4['error'][_0x1329('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x3904d0,_0x3ec7e4[_0x1329('0x11')]['message']);return _0x429dd0(_0x3ec7e4[_0x1329('0x11')][_0x1329('0x13')]);}logger[_0x1329('0x11')]('MemberReport,\x20%s,\x20%s',_0x3904d0,_0x3ec7e4[_0x1329('0x11')][_0x1329('0x13')]);return _0x3823ae(_0x3ec7e4[_0x1329('0x11')][_0x1329('0x13')]);}else{logger[_0x1329('0xc')](_0x1329('0x14'),_0x3904d0,_0x1329('0xd'));_0x3823ae(_0x3ec7e4[_0x1329('0x15')][_0x1329('0x13')]);}})['catch'](function(_0x422c99){logger['error'](_0x1329('0x14'),_0x3904d0,_0x422c99);_0x429dd0(_0x422c99);});});}exports[_0x1329('0x16')]=function(_0x2a6abe){var _0x8ee5b4=this;return new Promise(function(_0x4ad417,_0x16afa2){return db[_0x1329('0x17')]['findAll']({'raw':_0x2a6abe[_0x1329('0x18')]?_0x2a6abe['options'][_0x1329('0x19')]===undefined?!![]:![]:!![],'where':_0x2a6abe['options']?_0x2a6abe[_0x1329('0x18')][_0x1329('0x1a')]||null:null,'attributes':_0x2a6abe[_0x1329('0x18')]?_0x2a6abe[_0x1329('0x18')][_0x1329('0x1b')]||null:null,'limit':_0x2a6abe[_0x1329('0x18')]?_0x2a6abe[_0x1329('0x18')][_0x1329('0x1c')]||null:null,'include':_0x2a6abe[_0x1329('0x18')]?_0x2a6abe['options'][_0x1329('0x1d')]?_[_0x1329('0x1e')](_0x2a6abe[_0x1329('0x18')]['include'],function(_0x3aa6af){return{'model':db[_0x3aa6af[_0x1329('0x1f')]],'as':_0x3aa6af['as'],'attributes':_0x3aa6af['attributes'],'include':_0x3aa6af[_0x1329('0x1d')]?_[_0x1329('0x1e')](_0x3aa6af['include'],function(_0x504b36){return{'model':db[_0x504b36[_0x1329('0x1f')]],'as':_0x504b36['as'],'attributes':_0x504b36[_0x1329('0x1b')],'include':_0x504b36[_0x1329('0x1d')]?_['map'](_0x504b36[_0x1329('0x1d')],function(_0x1b445b){return{'model':db[_0x1b445b[_0x1329('0x1f')]],'as':_0x1b445b['as'],'attributes':_0x1b445b[_0x1329('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1329('0xb')](function(_0x2ff0f8){logger[_0x1329('0xc')]('GetMemberReport',_0x2a6abe);logger[_0x1329('0xe')](_0x1329('0x16'),_0x2a6abe,JSON[_0x1329('0x10')](_0x2ff0f8));_0x4ad417(_0x2ff0f8);})[_0x1329('0x20')](function(_0x341856){logger['error'](_0x1329('0x16'),_0x341856['message'],_0x2a6abe);_0x16afa2(_0x8ee5b4[_0x1329('0x11')](0x1f4,_0x341856['message']));});});};exports[_0x1329('0x21')]=function(_0x354531){var _0x1993a8=this;return new Promise(function(_0x126328,_0x1178fb){return db['MemberReport'][_0x1329('0x22')](_0x354531[_0x1329('0x23')],{'raw':_0x354531[_0x1329('0x18')]?_0x354531['options'][_0x1329('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x360367){logger[_0x1329('0xc')](_0x1329('0x21'),_0x354531);logger[_0x1329('0xe')]('CreateMemberReport',_0x354531,JSON[_0x1329('0x10')](_0x360367));_0x126328(_0x360367);})[_0x1329('0x20')](function(_0x4314d9){logger['error'](_0x1329('0x21'),_0x4314d9[_0x1329('0x13')],_0x354531);_0x1178fb(_0x1993a8[_0x1329('0x11')](0x1f4,_0x4314d9[_0x1329('0x13')]));});});};exports[_0x1329('0x24')]=function(_0x460d61){var _0x44a85c=this;return new Promise(function(_0x2c702e,_0x511a8f){return db[_0x1329('0x17')][_0x1329('0x25')](_0x460d61[_0x1329('0x23')],{'raw':_0x460d61[_0x1329('0x18')]?_0x460d61[_0x1329('0x18')][_0x1329('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460d61[_0x1329('0x18')]?_0x460d61['options'][_0x1329('0x1a')]||null:null,'attributes':_0x460d61[_0x1329('0x18')]?_0x460d61['options'][_0x1329('0x1b')]||null:null,'limit':_0x460d61[_0x1329('0x18')]?_0x460d61[_0x1329('0x18')][_0x1329('0x1c')]||null:null})[_0x1329('0xb')](function(_0x9853f1){logger['info']('UpdateMemberReport',_0x460d61);logger[_0x1329('0xe')](_0x1329('0x24'),_0x460d61,JSON[_0x1329('0x10')](_0x9853f1));_0x2c702e(_0x9853f1);})[_0x1329('0x20')](function(_0x52f048){logger['error'](_0x1329('0x24'),_0x52f048[_0x1329('0x13')],_0x460d61);_0x511a8f(_0x44a85c[_0x1329('0x11')](0x1f4,_0x52f048['message']));});});}; \ No newline at end of file +var _0xbc19=['update','raw','UpdateMemberReport','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','options','where','limit','include','attributes','map','model','CreateMemberReport','MemberReport','body'];(function(_0x609b2a,_0x1fd23c){var _0x441402=function(_0x3b32fd){while(--_0x3b32fd){_0x609b2a['push'](_0x609b2a['shift']());}};_0x441402(++_0x1fd23c);}(_0xbc19,0x184));var _0x9bc1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbc19[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x9bc1('0x0'));var moment=require(_0x9bc1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x9bc1('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9bc1('0x3'))(_0x9bc1('0x4'));var config=require(_0x9bc1('0x5'));var jayson=require(_0x9bc1('0x6'));var client=jayson[_0x9bc1('0x7')][_0x9bc1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x358324,_0x37f071,_0x54b2ed){return new BPromise(function(_0x1b39f2,_0x45e14b){return client['request'](_0x358324,_0x54b2ed)[_0x9bc1('0x9')](function(_0x27d9a0){logger[_0x9bc1('0xa')](_0x9bc1('0xb'),_0x37f071,_0x9bc1('0xc'));logger[_0x9bc1('0xd')](_0x9bc1('0xe'),_0x37f071,'request\x20sent',JSON[_0x9bc1('0xf')](_0x27d9a0));if(_0x27d9a0[_0x9bc1('0x10')]){if(_0x27d9a0['error'][_0x9bc1('0x11')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x37f071,_0x27d9a0[_0x9bc1('0x10')][_0x9bc1('0x12')]);return _0x45e14b(_0x27d9a0[_0x9bc1('0x10')]['message']);}logger[_0x9bc1('0x10')](_0x9bc1('0xb'),_0x37f071,_0x27d9a0[_0x9bc1('0x10')][_0x9bc1('0x12')]);return _0x1b39f2(_0x27d9a0[_0x9bc1('0x10')][_0x9bc1('0x12')]);}else{logger[_0x9bc1('0xa')]('MemberReport,\x20%s,\x20%s',_0x37f071,_0x9bc1('0xc'));_0x1b39f2(_0x27d9a0[_0x9bc1('0x13')]['message']);}})[_0x9bc1('0x14')](function(_0x351f12){logger[_0x9bc1('0x10')](_0x9bc1('0xb'),_0x37f071,_0x351f12);_0x45e14b(_0x351f12);});});}exports[_0x9bc1('0x15')]=function(_0x44b128){var _0x85f8d0=this;return new Promise(function(_0x1a0611,_0x3c4f63){return db['MemberReport']['findAll']({'raw':_0x44b128[_0x9bc1('0x16')]?_0x44b128[_0x9bc1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x44b128[_0x9bc1('0x16')]?_0x44b128[_0x9bc1('0x16')][_0x9bc1('0x17')]||null:null,'attributes':_0x44b128[_0x9bc1('0x16')]?_0x44b128['options']['attributes']||null:null,'limit':_0x44b128[_0x9bc1('0x16')]?_0x44b128[_0x9bc1('0x16')][_0x9bc1('0x18')]||null:null,'include':_0x44b128['options']?_0x44b128[_0x9bc1('0x16')][_0x9bc1('0x19')]?_['map'](_0x44b128[_0x9bc1('0x16')][_0x9bc1('0x19')],function(_0xcd33e1){return{'model':db[_0xcd33e1['model']],'as':_0xcd33e1['as'],'attributes':_0xcd33e1[_0x9bc1('0x1a')],'include':_0xcd33e1[_0x9bc1('0x19')]?_[_0x9bc1('0x1b')](_0xcd33e1['include'],function(_0x4c96e4){return{'model':db[_0x4c96e4[_0x9bc1('0x1c')]],'as':_0x4c96e4['as'],'attributes':_0x4c96e4[_0x9bc1('0x1a')],'include':_0x4c96e4['include']?_['map'](_0x4c96e4['include'],function(_0x37f768){return{'model':db[_0x37f768[_0x9bc1('0x1c')]],'as':_0x37f768['as'],'attributes':_0x37f768[_0x9bc1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9bc1('0x9')](function(_0x439706){logger[_0x9bc1('0xa')](_0x9bc1('0x15'),_0x44b128);logger[_0x9bc1('0xd')](_0x9bc1('0x15'),_0x44b128,JSON[_0x9bc1('0xf')](_0x439706));_0x1a0611(_0x439706);})[_0x9bc1('0x14')](function(_0x24c219){logger['error'](_0x9bc1('0x15'),_0x24c219[_0x9bc1('0x12')],_0x44b128);_0x3c4f63(_0x85f8d0[_0x9bc1('0x10')](0x1f4,_0x24c219[_0x9bc1('0x12')]));});});};exports[_0x9bc1('0x1d')]=function(_0x248e39){var _0x5ae830=this;return new Promise(function(_0x2646f9,_0x427c44){return db[_0x9bc1('0x1e')]['create'](_0x248e39[_0x9bc1('0x1f')],{'raw':_0x248e39['options']?_0x248e39[_0x9bc1('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x9bc1('0x9')](function(_0x3ab179){logger['info'](_0x9bc1('0x1d'),_0x248e39);logger[_0x9bc1('0xd')](_0x9bc1('0x1d'),_0x248e39,JSON[_0x9bc1('0xf')](_0x3ab179));_0x2646f9(_0x3ab179);})[_0x9bc1('0x14')](function(_0x14050a){logger['error'](_0x9bc1('0x1d'),_0x14050a[_0x9bc1('0x12')],_0x248e39);_0x427c44(_0x5ae830[_0x9bc1('0x10')](0x1f4,_0x14050a[_0x9bc1('0x12')]));});});};exports['UpdateMemberReport']=function(_0x2cb0a4){var _0x30a944=this;return new Promise(function(_0x201fb1,_0x4c4c44){return db[_0x9bc1('0x1e')][_0x9bc1('0x20')](_0x2cb0a4[_0x9bc1('0x1f')],{'raw':_0x2cb0a4[_0x9bc1('0x16')]?_0x2cb0a4[_0x9bc1('0x16')][_0x9bc1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cb0a4['options']?_0x2cb0a4[_0x9bc1('0x16')][_0x9bc1('0x17')]||null:null,'attributes':_0x2cb0a4['options']?_0x2cb0a4['options'][_0x9bc1('0x1a')]||null:null,'limit':_0x2cb0a4[_0x9bc1('0x16')]?_0x2cb0a4['options'][_0x9bc1('0x18')]||null:null})['then'](function(_0x59bf12){logger[_0x9bc1('0xa')]('UpdateMemberReport',_0x2cb0a4);logger[_0x9bc1('0xd')](_0x9bc1('0x22'),_0x2cb0a4,JSON[_0x9bc1('0xf')](_0x59bf12));_0x201fb1(_0x59bf12);})['catch'](function(_0x15ce0e){logger[_0x9bc1('0x10')]('UpdateMemberReport',_0x15ce0e[_0x9bc1('0x12')],_0x2cb0a4);_0x4c4c44(_0x30a944[_0x9bc1('0x10')](0x1f4,_0x15ce0e['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1096098..5af14c1 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 _0xdabd=['index','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./migration.controller','get'];(function(_0x3de30d,_0x445535){var _0x13bf39=function(_0x11b628){while(--_0x11b628){_0x3de30d['push'](_0x3de30d['shift']());}};_0x13bf39(++_0x445535);}(_0xdabd,0x1c5));var _0xddab=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xdabd[_0x270adf];return _0x29eda9;};'use strict';var multer=require(_0xddab('0x0'));var util=require(_0xddab('0x1'));var path=require(_0xddab('0x2'));var express=require(_0xddab('0x3'));var router=express[_0xddab('0x4')]();var auth=require(_0xddab('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddab('0x6'));var controller=require(_0xddab('0x7'));router[_0xddab('0x8')]('/',controller[_0xddab('0x9')]);module[_0xddab('0xa')]=router; \ No newline at end of file +var _0x1fd4=['./migration.controller','get','index','exports','multer','util','path','express','../../components/interaction/service','../../config/environment'];(function(_0x29c6d6,_0x36a722){var _0x3d1922=function(_0x401172){while(--_0x401172){_0x29c6d6['push'](_0x29c6d6['shift']());}};_0x3d1922(++_0x36a722);}(_0x1fd4,0x18a));var _0x41fd=function(_0x1e76ca,_0x44517c){_0x1e76ca=_0x1e76ca-0x0;var _0x548150=_0x1fd4[_0x1e76ca];return _0x548150;};'use strict';var multer=require(_0x41fd('0x0'));var util=require(_0x41fd('0x1'));var path=require(_0x41fd('0x2'));var express=require(_0x41fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x41fd('0x4'));var config=require(_0x41fd('0x5'));var controller=require(_0x41fd('0x6'));router[_0x41fd('0x7')]('/',controller[_0x41fd('0x8')]);module[_0x41fd('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 62b4cdd..bba7f76 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 _0x9529=['exports','sequelize'];(function(_0x528743,_0x19f4ac){var _0x2d4015=function(_0x7985ed){while(--_0x7985ed){_0x528743['push'](_0x528743['shift']());}};_0x2d4015(++_0x19f4ac);}(_0x9529,0x1f1));var _0x9952=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9529[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x9952('0x0'));module[_0x9952('0x1')]={'version':{'type':Sequelize['STRING'],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file +var _0x8cb1=['STRING','sequelize','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8cb1,0xf4));var _0x18cb=function(_0x59c233,_0xe0627e){_0x59c233=_0x59c233-0x0;var _0x26e0ef=_0x8cb1[_0x59c233];return _0x26e0ef;};'use strict';var Sequelize=require(_0x18cb('0x0'));module[_0x18cb('0x1')]={'version':{'type':Sequelize[_0x18cb('0x2')],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 54edb1d..1a6521b 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 _0x0586=['where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../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','destroy','then','error','stack','name','index','Migration','model','dateStart','query','dateEnd','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0xdfe844,_0x4d8e7d){var _0x4bff26=function(_0x551372){while(--_0x551372){_0xdfe844['push'](_0xdfe844['shift']());}};_0x4bff26(++_0x4d8e7d);}(_0x0586,0x8d));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0x6058('0x0'));var rp=require(_0x6058('0x1'));var moment=require('moment');var BPromise=require(_0x6058('0x2'));var Mustache=require(_0x6058('0x3'));var util=require(_0x6058('0x4'));var path=require('path');var sox=require(_0x6058('0x5'));var csv=require(_0x6058('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6058('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6058('0x8'));var deskjs=require(_0x6058('0x9'));var toCsv=require('to-csv');var querystring=require(_0x6058('0xa'));var Papa=require(_0x6058('0xb'));var qs=require(_0x6058('0xc'));var logger=require(_0x6058('0xd'))(_0x6058('0xe'));var utils=require(_0x6058('0xf'));var config=require(_0x6058('0x10'));var db=require(_0x6058('0x11'))['db'];function respondWithStatusCode(_0x1da56d,_0x540922){_0x540922=_0x540922||0xcc;return function(_0x5d02a4){if(_0x5d02a4){return _0x1da56d[_0x6058('0x12')](_0x540922);}return _0x1da56d[_0x6058('0x13')](_0x540922)[_0x6058('0x14')]();};}function respondWithResult(_0x266980,_0x333394){_0x333394=_0x333394||0xc8;return function(_0x3db28d){if(_0x3db28d){return _0x266980[_0x6058('0x13')](_0x333394)[_0x6058('0x15')](_0x3db28d);}};}function respondWithFilteredResult(_0x43d44c,_0x30160d){return function(_0x508d43){if(_0x508d43){var _0x3e0e36=_0x508d43[_0x6058('0x16')],_0x488d15=_0x30160d['offset'],_0x4a8962=_0x30160d[_0x6058('0x17')]+_0x30160d[_0x6058('0x18')],_0x34fd1c;if(_0x4a8962>=_0x3e0e36){_0x4a8962=_0x3e0e36;_0x34fd1c=0xc8;}else{_0x34fd1c=0xce;}_0x43d44c[_0x6058('0x13')](_0x34fd1c);return _0x43d44c[_0x6058('0x19')](_0x6058('0x1a'),_0x488d15+'-'+_0x4a8962+'/'+_0x3e0e36)[_0x6058('0x15')](_0x508d43);}return null;};}function patchUpdates(_0x5f04a5){return function(_0x2fb1f2){try{jsonpatch[_0x6058('0x1b')](_0x2fb1f2,_0x5f04a5,!![]);}catch(_0x439b38){return BPromise[_0x6058('0x1c')](_0x439b38);}return _0x2fb1f2[_0x6058('0x1d')]();};}function saveUpdates(_0x2eaec7,_0x1eeeb7){return function(_0x9157ce){if(_0x9157ce){return _0x9157ce[_0x6058('0x1e')](_0x2eaec7)['then'](function(_0x3a3c74){return _0x3a3c74;});}return null;};}function removeEntity(_0x43b5a5,_0x129002){return function(_0x5283dc){if(_0x5283dc){return _0x5283dc[_0x6058('0x1f')]()[_0x6058('0x20')](function(){_0x43b5a5[_0x6058('0x13')](0xcc)[_0x6058('0x14')]();});}};}function handleEntityNotFound(_0x468ac9,_0x3dbf97){return function(_0x37d027){if(!_0x37d027){_0x468ac9[_0x6058('0x12')](0x194);}return _0x37d027;};}function handleError(_0x2e14c0,_0x45fcc2){_0x45fcc2=_0x45fcc2||0x1f4;return function(_0x1039f7){logger[_0x6058('0x21')](_0x1039f7[_0x6058('0x22')]);if(_0x1039f7['name']){delete _0x1039f7[_0x6058('0x23')];}_0x2e14c0['status'](_0x45fcc2)['send'](_0x1039f7);};}exports[_0x6058('0x24')]=function(_0x31da22,_0xcad1c){var _0x14c9f3={},_0xcf0c41={},_0x2a2498={'count':0x0,'rows':[]};var _0x420634=db[_0x6058('0x25')]['rawAttributes'];_0xcf0c41[_0x6058('0x26')]=_['keys'](_0x420634);var _0x2e61a3={'dateStart':_0x31da22['query'][_0x6058('0x27')],'dateEnd':_0x31da22[_0x6058('0x28')][_0x6058('0x29')]};delete _0x31da22[_0x6058('0x28')][_0x6058('0x27')];delete _0x31da22['query'][_0x6058('0x29')];_0xcf0c41['query']=_[_0x6058('0x2a')](_0x31da22[_0x6058('0x28')]);_0xcf0c41[_0x6058('0x2b')]=_[_0x6058('0x2c')](_0xcf0c41[_0x6058('0x26')],_0xcf0c41[_0x6058('0x28')]);_0x14c9f3['attributes']=_[_0x6058('0x2c')](_0xcf0c41[_0x6058('0x26')],qs['fields'](_0x31da22[_0x6058('0x28')][_0x6058('0x2d')]));_0x14c9f3[_0x6058('0x2e')]=_0x14c9f3[_0x6058('0x2e')][_0x6058('0x2f')]?_0x14c9f3[_0x6058('0x2e')]:_0xcf0c41[_0x6058('0x26')];if(!_0x31da22['query'][_0x6058('0x30')]('nolimit')){_0x14c9f3[_0x6058('0x18')]=qs['limit'](_0x31da22[_0x6058('0x28')][_0x6058('0x18')]);_0x14c9f3['offset']=qs[_0x6058('0x17')](_0x31da22[_0x6058('0x28')]['offset']);}_0x14c9f3[_0x6058('0x31')]=qs[_0x6058('0x32')](_0x31da22[_0x6058('0x28')][_0x6058('0x32')]);_0x14c9f3[_0x6058('0x33')]=qs['filters'](_[_0x6058('0x34')](_0x31da22['query'],_0xcf0c41[_0x6058('0x2b')]));if(_0x2e61a3[_0x6058('0x27')]){if(_0x2e61a3[_0x6058('0x29')]){_0x2e61a3[_0x6058('0x29')]=moment(_0x2e61a3[_0x6058('0x29')])[_0x6058('0x35')](0x1,_0x6058('0x36'));}else{_0x2e61a3[_0x6058('0x29')]=moment(_0x2e61a3[_0x6058('0x27')])['add'](0x1,_0x6058('0x36'));}_[_0x6058('0x37')](_0x14c9f3[_0x6058('0x33')],{'createdAt':{'$gte':_0x2e61a3[_0x6058('0x27')],'$lte':_0x2e61a3[_0x6058('0x29')]}});}if(_0x31da22[_0x6058('0x28')][_0x6058('0x38')]){_0x14c9f3['where']=_['merge'](_0x14c9f3[_0x6058('0x33')],{'$or':_[_0x6058('0x39')](_0x14c9f3[_0x6058('0x2e')],function(_0x36a75f){var _0x57c751={};_0x57c751[_0x36a75f]={'$like':'%'+_0x31da22['query'][_0x6058('0x38')]+'%'};return _0x57c751;})});}_0x14c9f3=_[_0x6058('0x37')]({},_0x14c9f3,_0x31da22[_0x6058('0x3a')]);var _0x500895={'where':_0x14c9f3[_0x6058('0x33')]};return db[_0x6058('0x25')][_0x6058('0x16')](_0x500895)['then'](function(_0x378aea){_0x2a2498[_0x6058('0x16')]=_0x378aea;if(_0x31da22[_0x6058('0x28')][_0x6058('0x3b')]){_0x14c9f3[_0x6058('0x3c')]=[{'all':!![]}];}return db['Migration'][_0x6058('0x3d')](_0x14c9f3);})[_0x6058('0x20')](function(_0x5175de){_0x2a2498[_0x6058('0x3e')]=_0x5175de;return _0x2a2498;})[_0x6058('0x20')](respondWithFilteredResult(_0xcad1c,_0x14c9f3))[_0x6058('0x3f')](handleError(_0xcad1c,null));}; \ No newline at end of file +var _0xea12=['sort','where','filters','add','day','filter','merge','map','options','count','includeAll','findAll','rows','catch','moment','mustache','util','sox','to-csv','ejs','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','index','Migration','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea12,0x196));var _0x2ea1=function(_0x5908cc,_0x5ee254){_0x5908cc=_0x5908cc-0x0;var _0x5809d1=_0xea12[_0x5908cc];return _0x5809d1;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2ea1('0x0'));var BPromise=require('bluebird');var Mustache=require(_0x2ea1('0x1'));var util=require(_0x2ea1('0x2'));var path=require('path');var sox=require(_0x2ea1('0x3'));var csv=require(_0x2ea1('0x4'));var ejs=require(_0x2ea1('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2ea1('0x6'));var toCsv=require(_0x2ea1('0x4'));var querystring=require(_0x2ea1('0x7'));var Papa=require(_0x2ea1('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x2ea1('0x9'))('api');var utils=require(_0x2ea1('0xa'));var config=require('../../config/environment');var db=require(_0x2ea1('0xb'))['db'];function respondWithStatusCode(_0x2dd98e,_0x2b3884){_0x2b3884=_0x2b3884||0xcc;return function(_0x3ecb94){if(_0x3ecb94){return _0x2dd98e['sendStatus'](_0x2b3884);}return _0x2dd98e['status'](_0x2b3884)[_0x2ea1('0xc')]();};}function respondWithResult(_0x76a81,_0x1e6a15){_0x1e6a15=_0x1e6a15||0xc8;return function(_0x2b4583){if(_0x2b4583){return _0x76a81[_0x2ea1('0xd')](_0x1e6a15)[_0x2ea1('0xe')](_0x2b4583);}};}function respondWithFilteredResult(_0x2e9143,_0x12e50e){return function(_0x9496a7){if(_0x9496a7){var _0xc1c59a=_0x9496a7['count'],_0x5e4a9=_0x12e50e[_0x2ea1('0xf')],_0xc73bf0=_0x12e50e[_0x2ea1('0xf')]+_0x12e50e[_0x2ea1('0x10')],_0x323349;if(_0xc73bf0>=_0xc1c59a){_0xc73bf0=_0xc1c59a;_0x323349=0xc8;}else{_0x323349=0xce;}_0x2e9143[_0x2ea1('0xd')](_0x323349);return _0x2e9143[_0x2ea1('0x11')](_0x2ea1('0x12'),_0x5e4a9+'-'+_0xc73bf0+'/'+_0xc1c59a)[_0x2ea1('0xe')](_0x9496a7);}return null;};}function patchUpdates(_0x33f49e){return function(_0x2653fd){try{jsonpatch[_0x2ea1('0x13')](_0x2653fd,_0x33f49e,!![]);}catch(_0x42a54b){return BPromise['reject'](_0x42a54b);}return _0x2653fd[_0x2ea1('0x14')]();};}function saveUpdates(_0x13b2aa,_0x4d6aa7){return function(_0x4bcb6c){if(_0x4bcb6c){return _0x4bcb6c[_0x2ea1('0x15')](_0x13b2aa)['then'](function(_0x3bc25c){return _0x3bc25c;});}return null;};}function removeEntity(_0x2ceeeb,_0x1e18a3){return function(_0x37b937){if(_0x37b937){return _0x37b937[_0x2ea1('0x16')]()[_0x2ea1('0x17')](function(){_0x2ceeeb[_0x2ea1('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b562,_0x339ca0){return function(_0x1a292d){if(!_0x1a292d){_0x20b562[_0x2ea1('0x18')](0x194);}return _0x1a292d;};}function handleError(_0xa14db5,_0x2f5952){_0x2f5952=_0x2f5952||0x1f4;return function(_0x422610){logger[_0x2ea1('0x19')](_0x422610['stack']);if(_0x422610[_0x2ea1('0x1a')]){delete _0x422610['name'];}_0xa14db5['status'](_0x2f5952)['send'](_0x422610);};}exports[_0x2ea1('0x1b')]=function(_0x1b49a5,_0x2e3ff0){var _0x46577f={},_0x6a3d7c={},_0x1ce9d1={'count':0x0,'rows':[]};var _0x3b05bb=db[_0x2ea1('0x1c')][_0x2ea1('0x1d')];_0x6a3d7c[_0x2ea1('0x1e')]=_[_0x2ea1('0x1f')](_0x3b05bb);var _0x21f66b={'dateStart':_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x21')],'dateEnd':_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x22')]};delete _0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x21')];delete _0x1b49a5[_0x2ea1('0x20')]['dateEnd'];_0x6a3d7c[_0x2ea1('0x20')]=_['keys'](_0x1b49a5['query']);_0x6a3d7c['filters']=_[_0x2ea1('0x23')](_0x6a3d7c[_0x2ea1('0x1e')],_0x6a3d7c['query']);_0x46577f[_0x2ea1('0x24')]=_['intersection'](_0x6a3d7c[_0x2ea1('0x1e')],qs[_0x2ea1('0x25')](_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x25')]));_0x46577f[_0x2ea1('0x24')]=_0x46577f['attributes'][_0x2ea1('0x26')]?_0x46577f[_0x2ea1('0x24')]:_0x6a3d7c[_0x2ea1('0x1e')];if(!_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x27')](_0x2ea1('0x28'))){_0x46577f['limit']=qs[_0x2ea1('0x10')](_0x1b49a5['query'][_0x2ea1('0x10')]);_0x46577f['offset']=qs[_0x2ea1('0xf')](_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0xf')]);}_0x46577f[_0x2ea1('0x29')]=qs[_0x2ea1('0x2a')](_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x2a')]);_0x46577f[_0x2ea1('0x2b')]=qs[_0x2ea1('0x2c')](_['pick'](_0x1b49a5[_0x2ea1('0x20')],_0x6a3d7c['filters']));if(_0x21f66b[_0x2ea1('0x21')]){if(_0x21f66b[_0x2ea1('0x22')]){_0x21f66b[_0x2ea1('0x22')]=moment(_0x21f66b[_0x2ea1('0x22')])[_0x2ea1('0x2d')](0x1,_0x2ea1('0x2e'));}else{_0x21f66b['dateEnd']=moment(_0x21f66b[_0x2ea1('0x21')])[_0x2ea1('0x2d')](0x1,_0x2ea1('0x2e'));}_['merge'](_0x46577f[_0x2ea1('0x2b')],{'createdAt':{'$gte':_0x21f66b[_0x2ea1('0x21')],'$lte':_0x21f66b[_0x2ea1('0x22')]}});}if(_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x2f')]){_0x46577f[_0x2ea1('0x2b')]=_[_0x2ea1('0x30')](_0x46577f[_0x2ea1('0x2b')],{'$or':_[_0x2ea1('0x31')](_0x46577f[_0x2ea1('0x24')],function(_0x51ec6c){var _0x4a5793={};_0x4a5793[_0x51ec6c]={'$like':'%'+_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x2f')]+'%'};return _0x4a5793;})});}_0x46577f=_[_0x2ea1('0x30')]({},_0x46577f,_0x1b49a5[_0x2ea1('0x32')]);var _0xf0c439={'where':_0x46577f[_0x2ea1('0x2b')]};return db['Migration']['count'](_0xf0c439)[_0x2ea1('0x17')](function(_0x228022){_0x1ce9d1[_0x2ea1('0x33')]=_0x228022;if(_0x1b49a5[_0x2ea1('0x20')][_0x2ea1('0x34')]){_0x46577f['include']=[{'all':!![]}];}return db['Migration'][_0x2ea1('0x35')](_0x46577f);})[_0x2ea1('0x17')](function(_0x36d5a1){_0x1ce9d1[_0x2ea1('0x36')]=_0x36d5a1;return _0x1ce9d1;})[_0x2ea1('0x17')](respondWithFilteredResult(_0x2e3ff0,_0x46577f))[_0x2ea1('0x37')](handleError(_0x2e3ff0,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ee02b86..7c3f341 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 _0xb1ad=['define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','./migration.attributes','exports'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xb1ad,0x184));var _0xdb1a=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xb1ad[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var logger=require(_0xdb1a('0x2'))(_0xdb1a('0x3'));var moment=require(_0xdb1a('0x4'));var BPromise=require(_0xdb1a('0x5'));var rp=require('request-promise');var attributes=require(_0xdb1a('0x6'));module[_0xdb1a('0x7')]=function(_0x24b01f,_0x10b9c1){return _0x24b01f[_0xdb1a('0x8')](_0xdb1a('0x9'),attributes,{'tableName':_0xdb1a('0xa'),'paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file +var _0xbf13=['migrations','lodash','util','../../config/logger','api','request-promise','./migration.attributes','define','Migration'];(function(_0x157ec4,_0x37992c){var _0x3bff0c=function(_0x239bd3){while(--_0x239bd3){_0x157ec4['push'](_0x157ec4['shift']());}};_0x3bff0c(++_0x37992c);}(_0xbf13,0xe2));var _0x3bf1=function(_0x199550,_0x329a62){_0x199550=_0x199550-0x0;var _0x2b9c75=_0xbf13[_0x199550];return _0x2b9c75;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var logger=require(_0x3bf1('0x2'))(_0x3bf1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3bf1('0x4'));var attributes=require(_0x3bf1('0x5'));module['exports']=function(_0x265e66,_0x31d511){return _0x265e66[_0x3bf1('0x6')](_0x3bf1('0x7'),attributes,{'tableName':_0x3bf1('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 4ebd478..7d4e407 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 _0xcdca=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x20a641,_0x36f2e8){var _0x458c3d=function(_0x2e420c){while(--_0x2e420c){_0x20a641['push'](_0x20a641['shift']());}};_0x458c3d(++_0x36f2e8);}(_0xcdca,0x1d2));var _0xacdc=function(_0xba5c15,_0x49e07b){_0xba5c15=_0xba5c15-0x0;var _0x2b497a=_0xcdca[_0xba5c15];return _0x2b497a;};'use strict';var _=require(_0xacdc('0x0'));var util=require(_0xacdc('0x1'));var moment=require('moment');var BPromise=require(_0xacdc('0x2'));var rs=require(_0xacdc('0x3'));var fs=require('fs');var db=require(_0xacdc('0x4'))['db'];var utils=require(_0xacdc('0x5'));var logger=require(_0xacdc('0x6'))(_0xacdc('0x7'));var config=require(_0xacdc('0x8'));var jayson=require(_0xacdc('0x9'));var client=jayson[_0xacdc('0xa')][_0xacdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c9890,_0x43a337,_0x203353){return new BPromise(function(_0x3ee9e3,_0x17c2f9){return client[_0xacdc('0xc')](_0x1c9890,_0x203353)[_0xacdc('0xd')](function(_0x5d1465){logger[_0xacdc('0xe')](_0xacdc('0xf'),_0x43a337,_0xacdc('0x10'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x43a337,_0xacdc('0x10'),JSON[_0xacdc('0x11')](_0x5d1465));if(_0x5d1465['error']){if(_0x5d1465[_0xacdc('0x12')][_0xacdc('0x13')]===0x1f4){logger[_0xacdc('0x12')](_0xacdc('0xf'),_0x43a337,_0x5d1465[_0xacdc('0x12')]['message']);return _0x17c2f9(_0x5d1465[_0xacdc('0x12')]['message']);}logger[_0xacdc('0x12')]('Migration,\x20%s,\x20%s',_0x43a337,_0x5d1465[_0xacdc('0x12')]['message']);return _0x3ee9e3(_0x5d1465[_0xacdc('0x12')][_0xacdc('0x14')]);}else{logger['info'](_0xacdc('0xf'),_0x43a337,_0xacdc('0x10'));_0x3ee9e3(_0x5d1465[_0xacdc('0x15')][_0xacdc('0x14')]);}})[_0xacdc('0x16')](function(_0x5793fa){logger['error'](_0xacdc('0xf'),_0x43a337,_0x5793fa);_0x17c2f9(_0x5793fa);});});} \ No newline at end of file +var _0xf843=['../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','util','bluebird','randomstring'];(function(_0x2e727d,_0x1a477b){var _0x41491d=function(_0xb085d2){while(--_0xb085d2){_0x2e727d['push'](_0x2e727d['shift']());}};_0x41491d(++_0x1a477b);}(_0xf843,0xb1));var _0x3f84=function(_0x13aed3,_0x566ad4){_0x13aed3=_0x13aed3-0x0;var _0x5332bf=_0xf843[_0x13aed3];return _0x5332bf;};'use strict';var _=require('lodash');var util=require(_0x3f84('0x0'));var moment=require('moment');var BPromise=require(_0x3f84('0x1'));var rs=require(_0x3f84('0x2'));var fs=require('fs');var db=require(_0x3f84('0x3'))['db'];var utils=require(_0x3f84('0x4'));var logger=require(_0x3f84('0x5'))(_0x3f84('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb31b0e,_0xbea8c8,_0x31a4e0){return new BPromise(function(_0x241d01,_0x51af34){return client[_0x3f84('0x7')](_0xb31b0e,_0x31a4e0)[_0x3f84('0x8')](function(_0x67ed8d){logger['info']('Migration,\x20%s,\x20%s',_0xbea8c8,_0x3f84('0x9'));logger[_0x3f84('0xa')](_0x3f84('0xb'),_0xbea8c8,_0x3f84('0x9'),JSON[_0x3f84('0xc')](_0x67ed8d));if(_0x67ed8d[_0x3f84('0xd')]){if(_0x67ed8d[_0x3f84('0xd')][_0x3f84('0xe')]===0x1f4){logger[_0x3f84('0xd')](_0x3f84('0xf'),_0xbea8c8,_0x67ed8d['error'][_0x3f84('0x10')]);return _0x51af34(_0x67ed8d[_0x3f84('0xd')][_0x3f84('0x10')]);}logger['error'](_0x3f84('0xf'),_0xbea8c8,_0x67ed8d[_0x3f84('0xd')][_0x3f84('0x10')]);return _0x241d01(_0x67ed8d[_0x3f84('0xd')][_0x3f84('0x10')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0xbea8c8,'request\x20sent');_0x241d01(_0x67ed8d[_0x3f84('0x11')][_0x3f84('0x10')]);}})['catch'](function(_0x226adb){logger['error']('Migration,\x20%s,\x20%s',_0xbea8c8,_0x226adb);_0x51af34(_0x226adb);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 37df92c..e846237 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 _0x814b=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x3a5934,_0x874734){var _0x32ad8d=function(_0x3eace5){while(--_0x3eace5){_0x3a5934['push'](_0x3a5934['shift']());}};_0x32ad8d(++_0x874734);}(_0x814b,0x1a2));var _0xb814=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x814b[_0x5beda8];return _0x2aa042;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var express=require(_0xb814('0x3'));var router=express[_0xb814('0x4')]();var auth=require(_0xb814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb814('0x6'));var controller=require(_0xb814('0x7'));router[_0xb814('0x8')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xa')]);router[_0xb814('0x8')]('/:id',auth[_0xb814('0x9')](),controller[_0xb814('0xb')]);router['post']('/',auth[_0xb814('0x9')](),controller[_0xb814('0xc')]);router[_0xb814('0xd')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0x11')]);module[_0xb814('0x12')]=router; \ No newline at end of file +var _0xdb28=['get','index','show','post','isAuthenticated','create','put','/:id','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x4c573b,_0x5c66f2){var _0x387788=function(_0x24e9dc){while(--_0x24e9dc){_0x4c573b['push'](_0x4c573b['shift']());}};_0x387788(++_0x5c66f2);}(_0xdb28,0x106));var _0x8db2=function(_0x16493b,_0x51e482){_0x16493b=_0x16493b-0x0;var _0x4bd900=_0xdb28[_0x16493b];return _0x4bd900;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var express=require(_0x8db2('0x3'));var router=express['Router']();var auth=require(_0x8db2('0x4'));var interaction=require(_0x8db2('0x5'));var config=require(_0x8db2('0x6'));var controller=require(_0x8db2('0x7'));router[_0x8db2('0x8')]('/',auth['isAuthenticated'](),controller[_0x8db2('0x9')]);router[_0x8db2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8db2('0xa')]);router[_0x8db2('0xb')]('/',auth[_0x8db2('0xc')](),controller[_0x8db2('0xd')]);router[_0x8db2('0xe')](_0x8db2('0xf'),auth[_0x8db2('0xc')](),controller['update']);router[_0x8db2('0x10')](_0x8db2('0xf'),auth[_0x8db2('0xc')](),controller['destroy']);module[_0x8db2('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 42601af..7f35e22 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 _0xa058=['ENUM','sequelize','exports'];(function(_0x325129,_0x4eefd8){var _0x759bed=function(_0x33097c){while(--_0x33097c){_0x325129['push'](_0x325129['shift']());}};_0x759bed(++_0x4eefd8);}(_0xa058,0x100));var _0x8a05=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa058[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x8a05('0x0'));module[_0x8a05('0x1')]={'type':{'type':Sequelize[_0x8a05('0x2')]('localnet','externip')},'value':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3dc8=['sequelize','exports','localnet','STRING'];(function(_0x578c0e,_0xff70fb){var _0x4db2c2=function(_0x44cc67){while(--_0x44cc67){_0x578c0e['push'](_0x578c0e['shift']());}};_0x4db2c2(++_0xff70fb);}(_0x3dc8,0x12c));var _0x83dc=function(_0x2b00d5,_0x10f0e8){_0x2b00d5=_0x2b00d5-0x0;var _0x255530=_0x3dc8[_0x2b00d5];return _0x255530;};'use strict';var Sequelize=require(_0x83dc('0x0'));module[_0x83dc('0x1')]={'type':{'type':Sequelize['ENUM'](_0x83dc('0x2'),'externip')},'value':{'type':Sequelize[_0x83dc('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index db33b67..eed51a5 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 _0x47c5=['request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','Network','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','where','add','day','merge','filter','map','options','count','includeAll','findAll','params','length','find','catch','create','transaction','body','type','readFileSync','root','server/files/templates/network.ejs','render','writeFileSync','format','toLowerCase','join','/etc/asterisk/sip_xcally_%s.conf','Reload','chan_sip.so','utf8','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http'];(function(_0x5241ba,_0x41a1d4){var _0x26e7c5=function(_0x2b85ec){while(--_0x2b85ec){_0x5241ba['push'](_0x5241ba['shift']());}};_0x26e7c5(++_0x41a1d4);}(_0x47c5,0x165));var _0x547c=function(_0x33d239,_0x24bb87){_0x33d239=_0x33d239-0x0;var _0x6784c2=_0x47c5[_0x33d239];return _0x6784c2;};'use strict';var jsonpatch=require(_0x547c('0x0'));var rp=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var Mustache=require(_0x547c('0x4'));var util=require(_0x547c('0x5'));var path=require('path');var sox=require(_0x547c('0x6'));var csv=require(_0x547c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x547c('0x8'));var squel=require(_0x547c('0x9'));var crypto=require('crypto');var jsforce=require(_0x547c('0xa'));var deskjs=require(_0x547c('0xb'));var toCsv=require(_0x547c('0x7'));var querystring=require(_0x547c('0xc'));var Papa=require(_0x547c('0xd'));var qs=require(_0x547c('0xe'));var logger=require(_0x547c('0xf'))(_0x547c('0x10'));var utils=require(_0x547c('0x11'));var config=require(_0x547c('0x12'));var db=require(_0x547c('0x13'))['db'];var jayson=require(_0x547c('0x14'));var client=jayson[_0x547c('0x15')][_0x547c('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x386e2c,_0x8addbe,_0x44ab17,_0x549bf0){return new BPromise(function(_0x13a103,_0x39dce7){var _0x5eea67=_0x549bf0||client;return _0x5eea67[_0x547c('0x17')](_0x386e2c,_0x44ab17)[_0x547c('0x18')](function(_0x171ae4){logger[_0x547c('0x19')](_0x547c('0x1a'),_0x8addbe,_0x547c('0x1b'));logger[_0x547c('0x1c')](_0x547c('0x1d'),_0x8addbe,_0x547c('0x1b'),JSON[_0x547c('0x1e')](_0x171ae4));if(_0x171ae4[_0x547c('0x1f')]){if(_0x171ae4[_0x547c('0x1f')][_0x547c('0x20')]===0x1f4){logger[_0x547c('0x1f')](_0x547c('0x1a'),_0x8addbe,_0x171ae4[_0x547c('0x1f')][_0x547c('0x21')]);return _0x39dce7(_0x171ae4[_0x547c('0x1f')]['message']);}logger['error'](_0x547c('0x1a'),_0x8addbe,_0x171ae4[_0x547c('0x1f')][_0x547c('0x21')]);return _0x13a103(_0x171ae4['error'][_0x547c('0x21')]);}else{logger[_0x547c('0x19')](_0x547c('0x1a'),_0x8addbe,'request\x20sent');_0x13a103(_0x171ae4[_0x547c('0x22')][_0x547c('0x21')]);}})['catch'](function(_0x5453f9){logger[_0x547c('0x1f')](_0x547c('0x1a'),_0x8addbe,_0x5453f9);_0x39dce7(_0x5453f9);});});}function respondWithStatusCode(_0x4f20c1,_0x11e709){_0x11e709=_0x11e709||0xcc;return function(_0x16a3a6){if(_0x16a3a6){return _0x4f20c1['sendStatus'](_0x11e709);}return _0x4f20c1[_0x547c('0x23')](_0x11e709)[_0x547c('0x24')]();};}function respondWithResult(_0x436e67,_0x4c718c){_0x4c718c=_0x4c718c||0xc8;return function(_0x3a55a0){if(_0x3a55a0){return _0x436e67[_0x547c('0x23')](_0x4c718c)[_0x547c('0x25')](_0x3a55a0);}};}function respondWithFilteredResult(_0x26823c,_0x1f3581){return function(_0x2663bc){if(_0x2663bc){var _0x2ab2cc=_0x2663bc['count'],_0x17fa33=_0x1f3581['offset'],_0x507895=_0x1f3581['offset']+_0x1f3581['limit'],_0x39c5f9;if(_0x507895>=_0x2ab2cc){_0x507895=_0x2ab2cc;_0x39c5f9=0xc8;}else{_0x39c5f9=0xce;}_0x26823c[_0x547c('0x23')](_0x39c5f9);return _0x26823c['set'](_0x547c('0x26'),_0x17fa33+'-'+_0x507895+'/'+_0x2ab2cc)['json'](_0x2663bc);}return null;};}function patchUpdates(_0x3ea493){return function(_0x486216){try{jsonpatch[_0x547c('0x27')](_0x486216,_0x3ea493,!![]);}catch(_0x1bb0a3){return BPromise[_0x547c('0x28')](_0x1bb0a3);}return _0x486216[_0x547c('0x29')]();};}function saveUpdates(_0x198afb,_0x569924){return function(_0x575c74){if(_0x575c74){return _0x575c74[_0x547c('0x2a')](_0x198afb)['then'](function(_0x303b57){return _0x303b57;});}return null;};}function removeEntity(_0xed2d39,_0x3e7652){return function(_0x1695be){if(_0x1695be){return _0x1695be[_0x547c('0x2b')]()[_0x547c('0x18')](function(){_0xed2d39[_0x547c('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f6a8,_0x41445b){return function(_0x422609){if(!_0x422609){_0x54f6a8[_0x547c('0x2c')](0x194);}return _0x422609;};}function handleError(_0x26850a,_0x1b8c17){_0x1b8c17=_0x1b8c17||0x1f4;return function(_0x18d7c1){logger[_0x547c('0x1f')](_0x18d7c1[_0x547c('0x2d')]);if(_0x18d7c1[_0x547c('0x2e')]){delete _0x18d7c1[_0x547c('0x2e')];}_0x26850a[_0x547c('0x23')](_0x1b8c17)[_0x547c('0x2f')](_0x18d7c1);};}exports[_0x547c('0x30')]=function(_0x385275,_0x5e44ba){var _0x3afc28={},_0x553dcf={},_0x4ad00e={'count':0x0,'rows':[]};var _0x5f37e7=db[_0x547c('0x31')][_0x547c('0x32')];_0x553dcf[_0x547c('0x33')]=_[_0x547c('0x34')](_0x5f37e7);var _0x14c50c={'dateStart':_0x385275[_0x547c('0x35')]['dateStart'],'dateEnd':_0x385275['query']['dateEnd']};delete _0x385275[_0x547c('0x35')][_0x547c('0x36')];delete _0x385275[_0x547c('0x35')][_0x547c('0x37')];_0x553dcf[_0x547c('0x35')]=_[_0x547c('0x34')](_0x385275['query']);_0x553dcf[_0x547c('0x38')]=_['intersection'](_0x553dcf[_0x547c('0x33')],_0x553dcf[_0x547c('0x35')]);_0x3afc28['attributes']=_[_0x547c('0x39')](_0x553dcf['model'],qs['fields'](_0x385275[_0x547c('0x35')][_0x547c('0x3a')]));_0x3afc28[_0x547c('0x3b')]=_0x3afc28[_0x547c('0x3b')]['length']?_0x3afc28['attributes']:_0x553dcf[_0x547c('0x33')];if(!_0x385275[_0x547c('0x35')][_0x547c('0x3c')]('nolimit')){_0x3afc28[_0x547c('0x3d')]=qs[_0x547c('0x3d')](_0x385275[_0x547c('0x35')]['limit']);_0x3afc28[_0x547c('0x3e')]=qs[_0x547c('0x3e')](_0x385275[_0x547c('0x35')]['offset']);}_0x3afc28[_0x547c('0x3f')]=qs[_0x547c('0x40')](_0x385275['query'][_0x547c('0x40')]);_0x3afc28[_0x547c('0x41')]=qs[_0x547c('0x38')](_['pick'](_0x385275[_0x547c('0x35')],_0x553dcf['filters']));if(_0x14c50c[_0x547c('0x36')]){if(_0x14c50c['dateEnd']){_0x14c50c[_0x547c('0x37')]=moment(_0x14c50c[_0x547c('0x37')])[_0x547c('0x42')](0x1,_0x547c('0x43'));}else{_0x14c50c[_0x547c('0x37')]=moment(_0x14c50c[_0x547c('0x36')])['add'](0x1,'day');}_[_0x547c('0x44')](_0x3afc28[_0x547c('0x41')],{'createdAt':{'$gte':_0x14c50c[_0x547c('0x36')],'$lte':_0x14c50c['dateEnd']}});}if(_0x385275[_0x547c('0x35')][_0x547c('0x45')]){_0x3afc28[_0x547c('0x41')]=_[_0x547c('0x44')](_0x3afc28[_0x547c('0x41')],{'$or':_[_0x547c('0x46')](_0x3afc28['attributes'],function(_0x6271e1){var _0x3ae2c2={};_0x3ae2c2[_0x6271e1]={'$like':'%'+_0x385275[_0x547c('0x35')]['filter']+'%'};return _0x3ae2c2;})});}_0x3afc28=_[_0x547c('0x44')]({},_0x3afc28,_0x385275[_0x547c('0x47')]);var _0xebf295={'where':_0x3afc28[_0x547c('0x41')]};return db['Network'][_0x547c('0x48')](_0xebf295)['then'](function(_0x15ffa6){_0x4ad00e['count']=_0x15ffa6;if(_0x385275[_0x547c('0x35')][_0x547c('0x49')]){_0x3afc28['include']=[{'all':!![]}];}return db[_0x547c('0x31')][_0x547c('0x4a')](_0x3afc28);})[_0x547c('0x18')](function(_0x1ddf30){_0x4ad00e['rows']=_0x1ddf30;return _0x4ad00e;})[_0x547c('0x18')](respondWithFilteredResult(_0x5e44ba,_0x3afc28))['catch'](handleError(_0x5e44ba,null));};exports['show']=function(_0x4d4a92,_0x91fa04){var _0x3e3f52={'raw':!![],'where':{'id':_0x4d4a92[_0x547c('0x4b')]['id']}},_0x11a878={};_0x11a878[_0x547c('0x33')]=_[_0x547c('0x34')](db[_0x547c('0x31')][_0x547c('0x32')]);_0x11a878[_0x547c('0x35')]=_[_0x547c('0x34')](_0x4d4a92[_0x547c('0x35')]);_0x11a878['filters']=_['intersection'](_0x11a878[_0x547c('0x33')],_0x11a878[_0x547c('0x35')]);_0x3e3f52['attributes']=_[_0x547c('0x39')](_0x11a878[_0x547c('0x33')],qs[_0x547c('0x3a')](_0x4d4a92[_0x547c('0x35')][_0x547c('0x3a')]));_0x3e3f52[_0x547c('0x3b')]=_0x3e3f52['attributes'][_0x547c('0x4c')]?_0x3e3f52['attributes']:_0x11a878[_0x547c('0x33')];if(_0x4d4a92[_0x547c('0x35')][_0x547c('0x49')]){_0x3e3f52['include']=[{'all':!![]}];}_0x3e3f52=_[_0x547c('0x44')]({},_0x3e3f52,_0x4d4a92['options']);return db[_0x547c('0x31')][_0x547c('0x4d')](_0x3e3f52)['then'](handleEntityNotFound(_0x91fa04,null))[_0x547c('0x18')](respondWithResult(_0x91fa04,null))[_0x547c('0x4e')](handleError(_0x91fa04,null));};exports[_0x547c('0x4f')]=function(_0x2654b8,_0x1bfedf,_0x3d6345){var _0x224040;return db['sequelize'][_0x547c('0x50')](function(_0x55dee9){return db[_0x547c('0x31')][_0x547c('0x4f')](_0x2654b8[_0x547c('0x51')],{'raw':!![]})[_0x547c('0x18')](function(_0x135d06){_0x224040=_0x135d06;return db['Network'][_0x547c('0x4a')]({'where':{'type':_0x2654b8['body'][_0x547c('0x52')]},'raw':!![]});})[_0x547c('0x18')](function(_0x202090){var _0x2b14e0=fs[_0x547c('0x53')](path['join'](config[_0x547c('0x54')],_0x547c('0x55')),'utf8');var _0xc6f645=ejs[_0x547c('0x56')](_0x2b14e0,{'networks':_0x202090||[]});fs[_0x547c('0x57')](util[_0x547c('0x58')]('/etc/asterisk/sip_xcally_%s.conf',_0x2654b8['body']['type'][_0x547c('0x59')]()),_0xc6f645);})[_0x547c('0x18')](function(){return respondWithRpcPromise('Reload',_0x547c('0x4f'),{'module':'chan_sip.so'});})[_0x547c('0x18')](function(){return _0x224040;});})[_0x547c('0x18')](respondWithResult(_0x1bfedf,0xc9))[_0x547c('0x4e')](handleError(_0x1bfedf,null));};exports[_0x547c('0x2a')]=function(_0x458325,_0x423889,_0xfffcae){var _0x5286da;return db['sequelize'][_0x547c('0x50')](function(_0x235fe8){return db[_0x547c('0x31')][_0x547c('0x4d')]({'where':{'id':_0x458325[_0x547c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x423889,null))['then'](saveUpdates(_0x458325['body'],null))['then'](function(_0x5d6c7f){if(_0x5d6c7f){_0x5286da=_0x5d6c7f;return db[_0x547c('0x31')][_0x547c('0x4a')]({'where':{'type':_0x5286da[_0x547c('0x52')]},'raw':!![]});}return null;})['then'](function(_0x4540a5){if(_0x4540a5){var _0x1f901b=fs[_0x547c('0x53')](path[_0x547c('0x5a')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0xa66eee=ejs[_0x547c('0x56')](_0x1f901b,{'networks':_0x4540a5||[]});fs[_0x547c('0x57')](util[_0x547c('0x58')](_0x547c('0x5b'),_0x5286da['type']['toLowerCase']()),_0xa66eee);return respondWithRpcPromise(_0x547c('0x5c'),_0x547c('0x2a'),{'module':_0x547c('0x5d')});}return null;})[_0x547c('0x18')](function(_0xa0fd35){if(_0xa0fd35){return _0x5286da;}return null;});})['then'](respondWithResult(_0x423889,null))['catch'](handleError(_0x423889,null));};exports['destroy']=function(_0x244e32,_0x48f519,_0x2fc17d){var _0x36e282;return db[_0x547c('0x31')]['find']({'where':{'id':_0x244e32['params']['id']}})[_0x547c('0x18')](function(_0x413040){_0x36e282=_0x413040;return _0x413040;})[_0x547c('0x18')](handleEntityNotFound(_0x48f519,null))[_0x547c('0x18')](removeEntity(_0x48f519,null))[_0x547c('0x18')](function(){if(_0x36e282){return db[_0x547c('0x31')][_0x547c('0x4a')]({'where':{'type':_0x36e282['type']},'raw':!![]});}})[_0x547c('0x18')](function(_0x233b3b){if(_0x233b3b){var _0x3277ba=fs[_0x547c('0x53')](path[_0x547c('0x5a')](config[_0x547c('0x54')],_0x547c('0x55')),_0x547c('0x5e'));var _0x49dc3c=ejs[_0x547c('0x56')](_0x3277ba,{'networks':_0x233b3b||[]});fs[_0x547c('0x57')](util[_0x547c('0x58')](_0x547c('0x5b'),_0x36e282['type'][_0x547c('0x59')]()),_0x49dc3c);return respondWithRpcPromise(_0x547c('0x5c'),_0x547c('0x2b'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x48f519,null));}; \ No newline at end of file +var _0x01d9=['transaction','body','type','readFileSync','join','root','server/files/templates/network.ejs','utf8','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','params','chan_sip.so','render','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','set','apply','reject','update','destroy','name','send','index','rawAttributes','keys','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','length','nolimit','sort','where','add','day','merge','filter','options','Network','count','includeAll','include','findAll','rows','catch','show','find','sequelize'];(function(_0x114ae1,_0x544dd0){var _0x2fde59=function(_0x574aa9){while(--_0x574aa9){_0x114ae1['push'](_0x114ae1['shift']());}};_0x2fde59(++_0x544dd0);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require(_0x901d('0x0'));var rp=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var Mustache=require('mustache');var util=require(_0x901d('0x4'));var path=require(_0x901d('0x5'));var sox=require(_0x901d('0x6'));var csv=require(_0x901d('0x7'));var ejs=require(_0x901d('0x8'));var fs=require('fs');var _=require(_0x901d('0x9'));var squel=require(_0x901d('0xa'));var crypto=require('crypto');var jsforce=require(_0x901d('0xb'));var deskjs=require(_0x901d('0xc'));var toCsv=require(_0x901d('0x7'));var querystring=require(_0x901d('0xd'));var Papa=require(_0x901d('0xe'));var qs=require(_0x901d('0xf'));var logger=require(_0x901d('0x10'))(_0x901d('0x11'));var utils=require(_0x901d('0x12'));var config=require(_0x901d('0x13'));var db=require(_0x901d('0x14'))['db'];var jayson=require(_0x901d('0x15'));var client=jayson[_0x901d('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x439f17,_0x5ba100,_0x220153,_0x1fd1de){return new BPromise(function(_0x3f2a0a,_0x42ce79){var _0x15ebaf=_0x1fd1de||client;return _0x15ebaf['request'](_0x439f17,_0x220153)[_0x901d('0x17')](function(_0x31cbbd){logger[_0x901d('0x18')](_0x901d('0x19'),_0x5ba100,_0x901d('0x1a'));logger[_0x901d('0x1b')]('Network,\x20%s,\x20%s,\x20%s',_0x5ba100,_0x901d('0x1a'),JSON[_0x901d('0x1c')](_0x31cbbd));if(_0x31cbbd[_0x901d('0x1d')]){if(_0x31cbbd[_0x901d('0x1d')][_0x901d('0x1e')]===0x1f4){logger[_0x901d('0x1d')](_0x901d('0x19'),_0x5ba100,_0x31cbbd[_0x901d('0x1d')][_0x901d('0x1f')]);return _0x42ce79(_0x31cbbd[_0x901d('0x1d')][_0x901d('0x1f')]);}logger[_0x901d('0x1d')](_0x901d('0x19'),_0x5ba100,_0x31cbbd[_0x901d('0x1d')][_0x901d('0x1f')]);return _0x3f2a0a(_0x31cbbd[_0x901d('0x1d')][_0x901d('0x1f')]);}else{logger[_0x901d('0x18')]('Network,\x20%s,\x20%s',_0x5ba100,_0x901d('0x1a'));_0x3f2a0a(_0x31cbbd[_0x901d('0x20')]['message']);}})['catch'](function(_0x496a06){logger['error'](_0x901d('0x19'),_0x5ba100,_0x496a06);_0x42ce79(_0x496a06);});});}function respondWithStatusCode(_0x44ea6f,_0x59289e){_0x59289e=_0x59289e||0xcc;return function(_0xd2e0ac){if(_0xd2e0ac){return _0x44ea6f[_0x901d('0x21')](_0x59289e);}return _0x44ea6f['status'](_0x59289e)[_0x901d('0x22')]();};}function respondWithResult(_0x53ee69,_0x2402de){_0x2402de=_0x2402de||0xc8;return function(_0x3f80b9){if(_0x3f80b9){return _0x53ee69[_0x901d('0x23')](_0x2402de)[_0x901d('0x24')](_0x3f80b9);}};}function respondWithFilteredResult(_0x46e5c6,_0x45b6a8){return function(_0x4c1318){if(_0x4c1318){var _0x196a76=_0x4c1318['count'],_0x445392=_0x45b6a8[_0x901d('0x25')],_0xbc89a5=_0x45b6a8[_0x901d('0x25')]+_0x45b6a8[_0x901d('0x26')],_0x1f0ee5;if(_0xbc89a5>=_0x196a76){_0xbc89a5=_0x196a76;_0x1f0ee5=0xc8;}else{_0x1f0ee5=0xce;}_0x46e5c6[_0x901d('0x23')](_0x1f0ee5);return _0x46e5c6[_0x901d('0x27')]('Content-Range',_0x445392+'-'+_0xbc89a5+'/'+_0x196a76)[_0x901d('0x24')](_0x4c1318);}return null;};}function patchUpdates(_0xc52d0f){return function(_0x14976e){try{jsonpatch[_0x901d('0x28')](_0x14976e,_0xc52d0f,!![]);}catch(_0x37158e){return BPromise[_0x901d('0x29')](_0x37158e);}return _0x14976e['save']();};}function saveUpdates(_0xae6dfe,_0x533038){return function(_0x128830){if(_0x128830){return _0x128830[_0x901d('0x2a')](_0xae6dfe)[_0x901d('0x17')](function(_0x287ff2){return _0x287ff2;});}return null;};}function removeEntity(_0x1b1c17,_0x20df02){return function(_0x4137b7){if(_0x4137b7){return _0x4137b7[_0x901d('0x2b')]()[_0x901d('0x17')](function(){_0x1b1c17[_0x901d('0x23')](0xcc)[_0x901d('0x22')]();});}};}function handleEntityNotFound(_0x1aa0b2,_0x47425c){return function(_0x44c881){if(!_0x44c881){_0x1aa0b2[_0x901d('0x21')](0x194);}return _0x44c881;};}function handleError(_0x5e6e42,_0x179149){_0x179149=_0x179149||0x1f4;return function(_0x1c280b){logger[_0x901d('0x1d')](_0x1c280b['stack']);if(_0x1c280b[_0x901d('0x2c')]){delete _0x1c280b[_0x901d('0x2c')];}_0x5e6e42[_0x901d('0x23')](_0x179149)[_0x901d('0x2d')](_0x1c280b);};}exports[_0x901d('0x2e')]=function(_0x3962c2,_0x41674c){var _0x1b8d3={},_0x3d8421={},_0x20a58d={'count':0x0,'rows':[]};var _0x4fcb4f=db['Network'][_0x901d('0x2f')];_0x3d8421['model']=_[_0x901d('0x30')](_0x4fcb4f);var _0x3d790d={'dateStart':_0x3962c2['query'][_0x901d('0x31')],'dateEnd':_0x3962c2[_0x901d('0x32')][_0x901d('0x33')]};delete _0x3962c2['query'][_0x901d('0x31')];delete _0x3962c2[_0x901d('0x32')][_0x901d('0x33')];_0x3d8421[_0x901d('0x32')]=_[_0x901d('0x30')](_0x3962c2[_0x901d('0x32')]);_0x3d8421[_0x901d('0x34')]=_[_0x901d('0x35')](_0x3d8421[_0x901d('0x36')],_0x3d8421[_0x901d('0x32')]);_0x1b8d3[_0x901d('0x37')]=_[_0x901d('0x35')](_0x3d8421[_0x901d('0x36')],qs[_0x901d('0x38')](_0x3962c2[_0x901d('0x32')][_0x901d('0x38')]));_0x1b8d3['attributes']=_0x1b8d3[_0x901d('0x37')][_0x901d('0x39')]?_0x1b8d3['attributes']:_0x3d8421['model'];if(!_0x3962c2[_0x901d('0x32')]['hasOwnProperty'](_0x901d('0x3a'))){_0x1b8d3[_0x901d('0x26')]=qs[_0x901d('0x26')](_0x3962c2[_0x901d('0x32')][_0x901d('0x26')]);_0x1b8d3[_0x901d('0x25')]=qs['offset'](_0x3962c2['query']['offset']);}_0x1b8d3['order']=qs[_0x901d('0x3b')](_0x3962c2[_0x901d('0x32')]['sort']);_0x1b8d3[_0x901d('0x3c')]=qs[_0x901d('0x34')](_['pick'](_0x3962c2[_0x901d('0x32')],_0x3d8421[_0x901d('0x34')]));if(_0x3d790d[_0x901d('0x31')]){if(_0x3d790d[_0x901d('0x33')]){_0x3d790d['dateEnd']=moment(_0x3d790d['dateEnd'])[_0x901d('0x3d')](0x1,_0x901d('0x3e'));}else{_0x3d790d[_0x901d('0x33')]=moment(_0x3d790d[_0x901d('0x31')])[_0x901d('0x3d')](0x1,_0x901d('0x3e'));}_[_0x901d('0x3f')](_0x1b8d3[_0x901d('0x3c')],{'createdAt':{'$gte':_0x3d790d[_0x901d('0x31')],'$lte':_0x3d790d[_0x901d('0x33')]}});}if(_0x3962c2[_0x901d('0x32')]['filter']){_0x1b8d3[_0x901d('0x3c')]=_['merge'](_0x1b8d3[_0x901d('0x3c')],{'$or':_['map'](_0x1b8d3[_0x901d('0x37')],function(_0x490360){var _0x85cf51={};_0x85cf51[_0x490360]={'$like':'%'+_0x3962c2[_0x901d('0x32')][_0x901d('0x40')]+'%'};return _0x85cf51;})});}_0x1b8d3=_[_0x901d('0x3f')]({},_0x1b8d3,_0x3962c2[_0x901d('0x41')]);var _0x2787ae={'where':_0x1b8d3[_0x901d('0x3c')]};return db[_0x901d('0x42')][_0x901d('0x43')](_0x2787ae)[_0x901d('0x17')](function(_0x1a27c0){_0x20a58d['count']=_0x1a27c0;if(_0x3962c2[_0x901d('0x32')][_0x901d('0x44')]){_0x1b8d3[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x42')][_0x901d('0x46')](_0x1b8d3);})[_0x901d('0x17')](function(_0x27459b){_0x20a58d[_0x901d('0x47')]=_0x27459b;return _0x20a58d;})[_0x901d('0x17')](respondWithFilteredResult(_0x41674c,_0x1b8d3))[_0x901d('0x48')](handleError(_0x41674c,null));};exports[_0x901d('0x49')]=function(_0x107017,_0x2cd965){var _0x23f2a9={'raw':!![],'where':{'id':_0x107017['params']['id']}},_0x4888e8={};_0x4888e8[_0x901d('0x36')]=_[_0x901d('0x30')](db[_0x901d('0x42')][_0x901d('0x2f')]);_0x4888e8[_0x901d('0x32')]=_['keys'](_0x107017['query']);_0x4888e8[_0x901d('0x34')]=_[_0x901d('0x35')](_0x4888e8['model'],_0x4888e8[_0x901d('0x32')]);_0x23f2a9[_0x901d('0x37')]=_['intersection'](_0x4888e8[_0x901d('0x36')],qs['fields'](_0x107017[_0x901d('0x32')][_0x901d('0x38')]));_0x23f2a9[_0x901d('0x37')]=_0x23f2a9[_0x901d('0x37')]['length']?_0x23f2a9[_0x901d('0x37')]:_0x4888e8[_0x901d('0x36')];if(_0x107017[_0x901d('0x32')][_0x901d('0x44')]){_0x23f2a9[_0x901d('0x45')]=[{'all':!![]}];}_0x23f2a9=_[_0x901d('0x3f')]({},_0x23f2a9,_0x107017[_0x901d('0x41')]);return db[_0x901d('0x42')][_0x901d('0x4a')](_0x23f2a9)[_0x901d('0x17')](handleEntityNotFound(_0x2cd965,null))['then'](respondWithResult(_0x2cd965,null))[_0x901d('0x48')](handleError(_0x2cd965,null));};exports['create']=function(_0xd7fbb3,_0x26e6a2,_0xaa7394){var _0x2aa9b4;return db[_0x901d('0x4b')][_0x901d('0x4c')](function(_0x45c730){return db[_0x901d('0x42')]['create'](_0xd7fbb3[_0x901d('0x4d')],{'raw':!![]})[_0x901d('0x17')](function(_0x226b81){_0x2aa9b4=_0x226b81;return db['Network'][_0x901d('0x46')]({'where':{'type':_0xd7fbb3['body'][_0x901d('0x4e')]},'raw':!![]});})[_0x901d('0x17')](function(_0x395c38){var _0x571209=fs[_0x901d('0x4f')](path[_0x901d('0x50')](config[_0x901d('0x51')],_0x901d('0x52')),_0x901d('0x53'));var _0x74cfc=ejs['render'](_0x571209,{'networks':_0x395c38||[]});fs[_0x901d('0x54')](util[_0x901d('0x55')](_0x901d('0x56'),_0xd7fbb3[_0x901d('0x4d')][_0x901d('0x4e')][_0x901d('0x57')]()),_0x74cfc);})['then'](function(){return respondWithRpcPromise(_0x901d('0x58'),'create',{'module':'chan_sip.so'});})['then'](function(){return _0x2aa9b4;});})['then'](respondWithResult(_0x26e6a2,0xc9))[_0x901d('0x48')](handleError(_0x26e6a2,null));};exports[_0x901d('0x2a')]=function(_0x1a5e3c,_0x55e745,_0x2508f7){var _0x584879;return db[_0x901d('0x4b')][_0x901d('0x4c')](function(_0xecc8f9){return db[_0x901d('0x42')][_0x901d('0x4a')]({'where':{'id':_0x1a5e3c[_0x901d('0x59')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x55e745,null))[_0x901d('0x17')](saveUpdates(_0x1a5e3c[_0x901d('0x4d')],null))[_0x901d('0x17')](function(_0x174b73){if(_0x174b73){_0x584879=_0x174b73;return db[_0x901d('0x42')][_0x901d('0x46')]({'where':{'type':_0x584879[_0x901d('0x4e')]},'raw':!![]});}return null;})['then'](function(_0x553dcf){if(_0x553dcf){var _0x1b4152=fs[_0x901d('0x4f')](path[_0x901d('0x50')](config[_0x901d('0x51')],_0x901d('0x52')),_0x901d('0x53'));var _0x2d6431=ejs['render'](_0x1b4152,{'networks':_0x553dcf||[]});fs['writeFileSync'](util['format'](_0x901d('0x56'),_0x584879[_0x901d('0x4e')][_0x901d('0x57')]()),_0x2d6431);return respondWithRpcPromise(_0x901d('0x58'),_0x901d('0x2a'),{'module':_0x901d('0x5a')});}return null;})[_0x901d('0x17')](function(_0x2aeeb9){if(_0x2aeeb9){return _0x584879;}return null;});})[_0x901d('0x17')](respondWithResult(_0x55e745,null))['catch'](handleError(_0x55e745,null));};exports['destroy']=function(_0x275af9,_0x2df0e2,_0x462059){var _0x112b31;return db[_0x901d('0x42')][_0x901d('0x4a')]({'where':{'id':_0x275af9[_0x901d('0x59')]['id']}})[_0x901d('0x17')](function(_0x249800){_0x112b31=_0x249800;return _0x249800;})[_0x901d('0x17')](handleEntityNotFound(_0x2df0e2,null))['then'](removeEntity(_0x2df0e2,null))[_0x901d('0x17')](function(){if(_0x112b31){return db[_0x901d('0x42')]['findAll']({'where':{'type':_0x112b31['type']},'raw':!![]});}})[_0x901d('0x17')](function(_0x3cfd0c){if(_0x3cfd0c){var _0x4b156c=fs[_0x901d('0x4f')](path[_0x901d('0x50')](config[_0x901d('0x51')],_0x901d('0x52')),'utf8');var _0x13bb54=ejs[_0x901d('0x5b')](_0x4b156c,{'networks':_0x3cfd0c||[]});fs[_0x901d('0x54')](util[_0x901d('0x55')](_0x901d('0x56'),_0x112b31[_0x901d('0x4e')]['toLowerCase']()),_0x13bb54);return respondWithRpcPromise(_0x901d('0x58'),_0x901d('0x2b'),{'module':_0x901d('0x5a')});}})['catch'](handleError(_0x2df0e2,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index eedc3f3..d91f8b1 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 _0xc46d=['moment','bluebird','request-promise','./network.attributes','define','Network'];(function(_0xecff3f,_0x13efca){var _0x3cfbbf=function(_0x37f835){while(--_0x37f835){_0xecff3f['push'](_0xecff3f['shift']());}};_0x3cfbbf(++_0x13efca);}(_0xc46d,0x180));var _0xdc46=function(_0x34f4c0,_0x54c5a1){_0x34f4c0=_0x34f4c0-0x0;var _0x39c60d=_0xc46d[_0x34f4c0];return _0x39c60d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdc46('0x0'));var BPromise=require(_0xdc46('0x1'));var rp=require(_0xdc46('0x2'));var attributes=require(_0xdc46('0x3'));module['exports']=function(_0x49ffb9,_0x2f6057){return _0x49ffb9[_0xdc46('0x4')](_0xdc46('0x5'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36e1=['define','Network','network','lodash','util','../../config/logger','moment','bluebird','request-promise','./network.attributes'];(function(_0x251432,_0x4b782d){var _0x18f268=function(_0x1fac8c){while(--_0x1fac8c){_0x251432['push'](_0x251432['shift']());}};_0x18f268(++_0x4b782d);}(_0x36e1,0x139));var _0x136e=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x36e1[_0x10b48a];return _0x2c4533;};'use strict';var _=require(_0x136e('0x0'));var util=require(_0x136e('0x1'));var logger=require(_0x136e('0x2'))('api');var moment=require(_0x136e('0x3'));var BPromise=require(_0x136e('0x4'));var rp=require(_0x136e('0x5'));var attributes=require(_0x136e('0x6'));module['exports']=function(_0x55a438,_0x2b5e6c){return _0x55a438[_0x136e('0x7')](_0x136e('0x8'),attributes,{'tableName':_0x136e('0x9'),'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 088a262..041ff3c 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 _0xf3f3=['info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x44101d,_0x2151a0){var _0x2cd5bf=function(_0x234abf){while(--_0x234abf){_0x44101d['push'](_0x44101d['shift']());}};_0x2cd5bf(++_0x2151a0);}(_0xf3f3,0x183));var _0x3f3f=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0xf3f3[_0x5f382f];return _0x3bb11b;};'use strict';var _=require(_0x3f3f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3f3f('0x1'));var rs=require(_0x3f3f('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x3f3f('0x3'));var logger=require(_0x3f3f('0x4'))(_0x3f3f('0x5'));var config=require(_0x3f3f('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5420aa,_0x1dcbdc,_0x37d22e){return new BPromise(function(_0x3d0c77,_0x128f8e){return client[_0x3f3f('0x7')](_0x5420aa,_0x37d22e)[_0x3f3f('0x8')](function(_0x53a4c2){logger[_0x3f3f('0x9')](_0x3f3f('0xa'),_0x1dcbdc,_0x3f3f('0xb'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x1dcbdc,_0x3f3f('0xb'),JSON[_0x3f3f('0xc')](_0x53a4c2));if(_0x53a4c2[_0x3f3f('0xd')]){if(_0x53a4c2[_0x3f3f('0xd')][_0x3f3f('0xe')]===0x1f4){logger['error'](_0x3f3f('0xa'),_0x1dcbdc,_0x53a4c2[_0x3f3f('0xd')][_0x3f3f('0xf')]);return _0x128f8e(_0x53a4c2[_0x3f3f('0xd')][_0x3f3f('0xf')]);}logger['error'](_0x3f3f('0xa'),_0x1dcbdc,_0x53a4c2[_0x3f3f('0xd')][_0x3f3f('0xf')]);return _0x3d0c77(_0x53a4c2[_0x3f3f('0xd')][_0x3f3f('0xf')]);}else{logger[_0x3f3f('0x9')](_0x3f3f('0xa'),_0x1dcbdc,'request\x20sent');_0x3d0c77(_0x53a4c2[_0x3f3f('0x10')][_0x3f3f('0xf')]);}})[_0x3f3f('0x11')](function(_0x2c7f85){logger[_0x3f3f('0xd')](_0x3f3f('0xa'),_0x1dcbdc,_0x2c7f85);_0x128f8e(_0x2c7f85);});});} \ No newline at end of file +var _0xf29d=['../../config/environment','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x1c730a,_0x495724){var _0x6be696=function(_0x1a6967){while(--_0x1a6967){_0x1c730a['push'](_0x1c730a['shift']());}};_0x6be696(++_0x495724);}(_0xf29d,0xd5));var _0xdf29=function(_0x188e18,_0xd3ff47){_0x188e18=_0x188e18-0x0;var _0x54f848=_0xf29d[_0x188e18];return _0x54f848;};'use strict';var _=require('lodash');var util=require(_0xdf29('0x0'));var moment=require(_0xdf29('0x1'));var BPromise=require(_0xdf29('0x2'));var rs=require(_0xdf29('0x3'));var fs=require('fs');var db=require(_0xdf29('0x4'))['db'];var utils=require(_0xdf29('0x5'));var logger=require('../../config/logger')(_0xdf29('0x6'));var config=require(_0xdf29('0x7'));var jayson=require(_0xdf29('0x8'));var client=jayson['client'][_0xdf29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ec486,_0x1c2572,_0x184c32){return new BPromise(function(_0x38833a,_0x5ec027){return client[_0xdf29('0xa')](_0x2ec486,_0x184c32)[_0xdf29('0xb')](function(_0x49c2bf){logger[_0xdf29('0xc')](_0xdf29('0xd'),_0x1c2572,'request\x20sent');logger[_0xdf29('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x1c2572,_0xdf29('0xf'),JSON['stringify'](_0x49c2bf));if(_0x49c2bf[_0xdf29('0x10')]){if(_0x49c2bf[_0xdf29('0x10')][_0xdf29('0x11')]===0x1f4){logger['error'](_0xdf29('0xd'),_0x1c2572,_0x49c2bf[_0xdf29('0x10')][_0xdf29('0x12')]);return _0x5ec027(_0x49c2bf[_0xdf29('0x10')][_0xdf29('0x12')]);}logger['error']('Network,\x20%s,\x20%s',_0x1c2572,_0x49c2bf[_0xdf29('0x10')]['message']);return _0x38833a(_0x49c2bf['error'][_0xdf29('0x12')]);}else{logger[_0xdf29('0xc')](_0xdf29('0xd'),_0x1c2572,'request\x20sent');_0x38833a(_0x49c2bf['result']['message']);}})[_0xdf29('0x13')](function(_0xc2a7c3){logger[_0xdf29('0x10')](_0xdf29('0xd'),_0x1c2572,_0xc2a7c3);_0x5ec027(_0xc2a7c3);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 411b2a6..24cf669 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 _0x6001=['addAnswer','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','destroy','delete','removeAnswers','removeAgents','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','post','create','/:id/dispositions','addDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6001,0x1ee));var _0x1600=function(_0x152341,_0x8f0c56){_0x152341=_0x152341-0x0;var _0x440e1b=_0x6001[_0x152341];return _0x440e1b;};'use strict';var multer=require('multer');var util=require(_0x1600('0x0'));var path=require(_0x1600('0x1'));var express=require(_0x1600('0x2'));var router=express[_0x1600('0x3')]();var auth=require(_0x1600('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1600('0x5'));var controller=require(_0x1600('0x6'));router[_0x1600('0x7')]('/',auth[_0x1600('0x8')](),controller[_0x1600('0x9')]);router[_0x1600('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x1600('0xa')]);router[_0x1600('0x7')](_0x1600('0xb'),auth['isAuthenticated'](),controller[_0x1600('0xc')]);router[_0x1600('0x7')]('/:id/dispositions',auth[_0x1600('0x8')](),controller[_0x1600('0xd')]);router['get'](_0x1600('0xe'),auth[_0x1600('0x8')](),controller[_0x1600('0xf')]);router['get'](_0x1600('0x10'),auth['isAuthenticated'](),controller[_0x1600('0x11')]);router[_0x1600('0x7')](_0x1600('0x12'),auth['isAuthenticated'](),controller[_0x1600('0x13')]);router[_0x1600('0x7')]('/:id/users',auth[_0x1600('0x8')](),controller['getAgents']);router[_0x1600('0x14')]('/',auth[_0x1600('0x8')](),controller[_0x1600('0x15')]);router[_0x1600('0x14')](_0x1600('0x16'),auth[_0x1600('0x8')](),controller[_0x1600('0x17')]);router[_0x1600('0x14')](_0x1600('0xe'),auth[_0x1600('0x8')](),controller[_0x1600('0x18')]);router['post']('/:id/notify',controller[_0x1600('0x19')]);router[_0x1600('0x14')](_0x1600('0x10'),auth[_0x1600('0x8')](),controller[_0x1600('0x1a')]);router[_0x1600('0x14')](_0x1600('0x1b'),auth[_0x1600('0x8')](),controller[_0x1600('0x1c')]);router[_0x1600('0x14')](_0x1600('0x1d'),auth[_0x1600('0x8')](),controller[_0x1600('0x1e')]);router[_0x1600('0x1f')]('/:id',auth[_0x1600('0x8')](),controller['update']);router['delete'](_0x1600('0xb'),auth[_0x1600('0x8')](),controller[_0x1600('0x20')]);router[_0x1600('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1600('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1600('0x22')]);router[_0x1600('0x21')]('/:id/users',auth[_0x1600('0x8')](),controller[_0x1600('0x23')]);module[_0x1600('0x24')]=router; \ No newline at end of file +var _0x42f7=['get','/describe','isAuthenticated','describe','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','addApplications','/:id/users','addAgents','/:id/send','send','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x46ee93,_0x56e249){var _0x5b9abf=function(_0x40f846){while(--_0x40f846){_0x46ee93['push'](_0x46ee93['shift']());}};_0x5b9abf(++_0x56e249);}(_0x42f7,0x137));var _0x742f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x42f7[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x742f('0x0'));var util=require(_0x742f('0x1'));var path=require(_0x742f('0x2'));var express=require(_0x742f('0x3'));var router=express[_0x742f('0x4')]();var auth=require(_0x742f('0x5'));var interaction=require(_0x742f('0x6'));var config=require(_0x742f('0x7'));var controller=require(_0x742f('0x8'));router[_0x742f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x742f('0x9')](_0x742f('0xa'),auth[_0x742f('0xb')](),controller[_0x742f('0xc')]);router[_0x742f('0x9')]('/:id',auth[_0x742f('0xb')](),controller['show']);router[_0x742f('0x9')](_0x742f('0xd'),auth['isAuthenticated'](),controller[_0x742f('0xe')]);router[_0x742f('0x9')]('/:id/canned_answers',auth[_0x742f('0xb')](),controller[_0x742f('0xf')]);router[_0x742f('0x9')](_0x742f('0x10'),auth[_0x742f('0xb')](),controller[_0x742f('0x11')]);router[_0x742f('0x9')](_0x742f('0x12'),auth[_0x742f('0xb')](),controller[_0x742f('0x13')]);router[_0x742f('0x9')]('/:id/users',auth[_0x742f('0xb')](),controller[_0x742f('0x14')]);router['post']('/',auth[_0x742f('0xb')](),controller[_0x742f('0x15')]);router[_0x742f('0x16')](_0x742f('0xd'),auth[_0x742f('0xb')](),controller[_0x742f('0x17')]);router[_0x742f('0x16')](_0x742f('0x18'),auth[_0x742f('0xb')](),controller[_0x742f('0x19')]);router['post'](_0x742f('0x1a'),controller['notify']);router['post'](_0x742f('0x10'),auth['isAuthenticated'](),controller[_0x742f('0x1b')]);router[_0x742f('0x16')](_0x742f('0x1c'),auth[_0x742f('0xb')](),controller[_0x742f('0x1d')]);router[_0x742f('0x16')](_0x742f('0x1e'),auth[_0x742f('0xb')](),controller[_0x742f('0x1f')]);router['put']('/:id',auth[_0x742f('0xb')](),controller[_0x742f('0x20')]);router[_0x742f('0x21')](_0x742f('0x22'),auth[_0x742f('0xb')](),controller[_0x742f('0x23')]);router[_0x742f('0x21')]('/:id/dispositions',auth[_0x742f('0xb')](),controller[_0x742f('0x24')]);router[_0x742f('0x21')](_0x742f('0x18'),auth[_0x742f('0xb')](),controller[_0x742f('0x25')]);router[_0x742f('0x21')](_0x742f('0x1c'),auth[_0x742f('0xb')](),controller[_0x742f('0x26')]);module[_0x742f('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 67c113e..dd19866 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 _0x55ca=['sequelize','randomstring','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x50a60b,_0x473993){var _0x3a1573=function(_0x57127e){while(--_0x57127e){_0x50a60b['push'](_0x50a60b['shift']());}};_0x3a1573(++_0x473993);}(_0x55ca,0x126));var _0xa55c=function(_0x447ce1,_0x11cf0b){_0x447ce1=_0x447ce1-0x0;var _0x4c1e7a=_0x55ca[_0x447ce1];return _0x4c1e7a;};'use strict';var Sequelize=require(_0xa55c('0x0'));var rs=require(_0xa55c('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa55c('0x2')]},'token':{'type':Sequelize[_0xa55c('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xa55c('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa55c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa55c('0x3')],'defaultValue':function(){return _0xa55c('0x4');}},'notificationSound':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa55c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa55c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa55c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0xedd9=['randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2349f4,_0x3296c6){var _0x511d1d=function(_0x362580){while(--_0x362580){_0x2349f4['push'](_0x2349f4['shift']());}};_0x511d1d(++_0x3296c6);}(_0xedd9,0xfc));var _0x9edd=function(_0x292969,_0x3e2e1f){_0x292969=_0x292969-0x0;var _0x1eab47=_0xedd9[_0x292969];return _0x1eab47;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'name':{'type':Sequelize[_0x9edd('0x2')],'unique':_0x9edd('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9edd('0x2')]},'token':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':function(){return rs[_0x9edd('0x4')]();}},'replyUri':{'type':Sequelize[_0x9edd('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9edd('0x5')],'defaultValue':function(){return _0x9edd('0x6');}},'notificationSound':{'type':Sequelize[_0x9edd('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9edd('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9edd('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9edd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9edd('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9edd('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 73d2c9d..a988292 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 _0xb7e7=['reject','save','update','destroy','end','stack','name','send','index','OpenchannelAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','map','options','count','include','findAll','rows','show','params','length','includeAll','find','body','describe','OpnechannelAccountId','Disposition','create','OpenchannelAccountId','filter','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','spread','interaction','get','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','notify','sequelize','transaction','getApplications','getInteractions','internal','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','user','Messages','dataValues','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','Content-Range','json'];(function(_0x107313,_0x8a055b){var _0x1fcd2e=function(_0x55ef17){while(--_0x55ef17){_0x107313['push'](_0x107313['shift']());}};_0x1fcd2e(++_0x8a055b);}(_0xb7e7,0x121));var _0x7b7e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb7e7[_0xaa0309];return _0x5de7ce;};'use strict';var jsonpatch=require(_0x7b7e('0x0'));var rp=require('request-promise');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x2'));var util=require('util');var path=require(_0x7b7e('0x3'));var sox=require('sox');var csv=require(_0x7b7e('0x4'));var ejs=require(_0x7b7e('0x5'));var fs=require('fs');var _=require(_0x7b7e('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b7e('0x7'));var deskjs=require(_0x7b7e('0x8'));var toCsv=require(_0x7b7e('0x4'));var querystring=require('querystring');var Papa=require(_0x7b7e('0x9'));var qs=require(_0x7b7e('0xa'));var logger=require(_0x7b7e('0xb'))(_0x7b7e('0xc'));var utils=require(_0x7b7e('0xd'));var config=require(_0x7b7e('0xe'));var db=require(_0x7b7e('0xf'))['db'];var socket=require('socket.io-emitter')({'host':_0x7b7e('0x10'),'port':0x18eb});require(_0x7b7e('0x11'))[_0x7b7e('0x12')](socket);var jayson=require(_0x7b7e('0x13'));var client=jayson[_0x7b7e('0x14')][_0x7b7e('0x15')]({'port':0x232c});var client9002=jayson[_0x7b7e('0x14')][_0x7b7e('0x15')]({'port':0x232a});function respondWithRpcPromise(_0xaadda,_0x54d8ce,_0x267446,_0x430eab){return new BPromise(function(_0x50d7d2,_0x422d3a){var _0x5976ac=_0x430eab||client;return _0x5976ac['request'](_0xaadda,_0x267446)[_0x7b7e('0x16')](function(_0xd304f5){logger[_0x7b7e('0x17')](_0x7b7e('0x18'),_0x54d8ce,_0x7b7e('0x19'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x54d8ce,_0x7b7e('0x19'),JSON[_0x7b7e('0x1a')](_0xd304f5));if(_0xd304f5[_0x7b7e('0x1b')]){if(_0xd304f5[_0x7b7e('0x1b')][_0x7b7e('0x1c')]===0x1f4){logger[_0x7b7e('0x1b')](_0x7b7e('0x18'),_0x54d8ce,_0xd304f5[_0x7b7e('0x1b')][_0x7b7e('0x1d')]);return _0x422d3a(_0xd304f5[_0x7b7e('0x1b')][_0x7b7e('0x1d')]);}logger[_0x7b7e('0x1b')](_0x7b7e('0x18'),_0x54d8ce,_0xd304f5[_0x7b7e('0x1b')][_0x7b7e('0x1d')]);return _0x50d7d2(_0xd304f5[_0x7b7e('0x1b')][_0x7b7e('0x1d')]);}else{logger['info'](_0x7b7e('0x18'),_0x54d8ce,_0x7b7e('0x19'));_0x50d7d2(_0xd304f5[_0x7b7e('0x1e')]['message']);}})[_0x7b7e('0x1f')](function(_0xbf0cb3){logger[_0x7b7e('0x1b')](_0x7b7e('0x18'),_0x54d8ce,_0xbf0cb3);_0x422d3a(_0xbf0cb3);});});}function respondWithStatusCode(_0x2b7211,_0x303d8c){_0x303d8c=_0x303d8c||0xcc;return function(_0x28bf43){if(_0x28bf43){return _0x2b7211[_0x7b7e('0x20')](_0x303d8c);}return _0x2b7211['status'](_0x303d8c)['end']();};}function respondWithResult(_0x4a836a,_0x26ee14){_0x26ee14=_0x26ee14||0xc8;return function(_0x22598e){if(_0x22598e){return _0x4a836a[_0x7b7e('0x21')](_0x26ee14)['json'](_0x22598e);}};}function respondWithFilteredResult(_0x51d3b1,_0x5dadbb){return function(_0x182245){if(_0x182245){var _0x3c8192=_0x182245['count'],_0x16a3c7=_0x5dadbb[_0x7b7e('0x22')],_0x7aa71=_0x5dadbb[_0x7b7e('0x22')]+_0x5dadbb['limit'],_0x3ceaf5;if(_0x7aa71>=_0x3c8192){_0x7aa71=_0x3c8192;_0x3ceaf5=0xc8;}else{_0x3ceaf5=0xce;}_0x51d3b1['status'](_0x3ceaf5);return _0x51d3b1['set'](_0x7b7e('0x23'),_0x16a3c7+'-'+_0x7aa71+'/'+_0x3c8192)[_0x7b7e('0x24')](_0x182245);}return null;};}function patchUpdates(_0x503625){return function(_0x3db8c4){try{jsonpatch['apply'](_0x3db8c4,_0x503625,!![]);}catch(_0x1b4341){return BPromise[_0x7b7e('0x25')](_0x1b4341);}return _0x3db8c4[_0x7b7e('0x26')]();};}function saveUpdates(_0x5515ca,_0x3960b8){return function(_0xe31336){if(_0xe31336){return _0xe31336[_0x7b7e('0x27')](_0x5515ca)[_0x7b7e('0x16')](function(_0x33f9a1){return _0x33f9a1;});}return null;};}function removeEntity(_0x5732ee,_0x41af57){return function(_0x51c010){if(_0x51c010){return _0x51c010[_0x7b7e('0x28')]()[_0x7b7e('0x16')](function(){_0x5732ee[_0x7b7e('0x21')](0xcc)[_0x7b7e('0x29')]();});}};}function handleEntityNotFound(_0x378faa,_0x247ea0){return function(_0x29cb58){if(!_0x29cb58){_0x378faa['sendStatus'](0x194);}return _0x29cb58;};}function handleError(_0x5227a7,_0xebcdbc){_0xebcdbc=_0xebcdbc||0x1f4;return function(_0x162b84){logger['error'](_0x162b84[_0x7b7e('0x2a')]);if(_0x162b84[_0x7b7e('0x2b')]){delete _0x162b84[_0x7b7e('0x2b')];}_0x5227a7['status'](_0xebcdbc)[_0x7b7e('0x2c')](_0x162b84);};}exports[_0x7b7e('0x2d')]=function(_0x187184,_0xf1225){var _0x31043a={},_0x2b09b8={},_0x3e8cf4={'count':0x0,'rows':[]};var _0x202f04=db[_0x7b7e('0x2e')][_0x7b7e('0x2f')];_0x2b09b8[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x202f04);var _0x442366={'dateStart':_0x187184[_0x7b7e('0x32')][_0x7b7e('0x33')],'dateEnd':_0x187184[_0x7b7e('0x32')]['dateEnd']};delete _0x187184[_0x7b7e('0x32')][_0x7b7e('0x33')];delete _0x187184[_0x7b7e('0x32')][_0x7b7e('0x34')];_0x2b09b8[_0x7b7e('0x32')]=_[_0x7b7e('0x31')](_0x187184[_0x7b7e('0x32')]);_0x2b09b8[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x2b09b8[_0x7b7e('0x30')],_0x2b09b8['query']);_0x31043a[_0x7b7e('0x37')]=_[_0x7b7e('0x36')](_0x2b09b8[_0x7b7e('0x30')],qs[_0x7b7e('0x38')](_0x187184['query'][_0x7b7e('0x38')]));_0x31043a[_0x7b7e('0x37')]=_0x31043a[_0x7b7e('0x37')]['length']?_0x31043a['attributes']:_0x2b09b8[_0x7b7e('0x30')];if(!_0x187184['query'][_0x7b7e('0x39')](_0x7b7e('0x3a'))){_0x31043a['limit']=qs[_0x7b7e('0x3b')](_0x187184[_0x7b7e('0x32')][_0x7b7e('0x3b')]);_0x31043a[_0x7b7e('0x22')]=qs[_0x7b7e('0x22')](_0x187184[_0x7b7e('0x32')][_0x7b7e('0x22')]);}_0x31043a[_0x7b7e('0x3c')]=qs[_0x7b7e('0x3d')](_0x187184['query']['sort']);_0x31043a[_0x7b7e('0x3e')]=qs['filters'](_[_0x7b7e('0x3f')](_0x187184['query'],_0x2b09b8['filters']));if(_0x442366[_0x7b7e('0x33')]){if(_0x442366['dateEnd']){_0x442366[_0x7b7e('0x34')]=moment(_0x442366['dateEnd'])[_0x7b7e('0x40')](0x1,_0x7b7e('0x41'));}else{_0x442366[_0x7b7e('0x34')]=moment(_0x442366[_0x7b7e('0x33')])['add'](0x1,_0x7b7e('0x41'));}_[_0x7b7e('0x42')](_0x31043a[_0x7b7e('0x3e')],{'createdAt':{'$gte':_0x442366[_0x7b7e('0x33')],'$lte':_0x442366[_0x7b7e('0x34')]}});}if(_0x187184[_0x7b7e('0x32')]['filter']){_0x31043a['where']=_['merge'](_0x31043a[_0x7b7e('0x3e')],{'$or':_[_0x7b7e('0x43')](_0x31043a[_0x7b7e('0x37')],function(_0x2cfe70){var _0x35ea02={};_0x35ea02[_0x2cfe70]={'$like':'%'+_0x187184[_0x7b7e('0x32')]['filter']+'%'};return _0x35ea02;})});}_0x31043a=_[_0x7b7e('0x42')]({},_0x31043a,_0x187184[_0x7b7e('0x44')]);var _0x5a0832={'where':_0x31043a['where']};return db[_0x7b7e('0x2e')][_0x7b7e('0x45')](_0x5a0832)[_0x7b7e('0x16')](function(_0x378a29){_0x3e8cf4[_0x7b7e('0x45')]=_0x378a29;if(_0x187184[_0x7b7e('0x32')]['includeAll']){_0x31043a[_0x7b7e('0x46')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x7b7e('0x47')](_0x31043a);})[_0x7b7e('0x16')](function(_0x2ea2b2){_0x3e8cf4[_0x7b7e('0x48')]=_0x2ea2b2;return _0x3e8cf4;})['then'](respondWithFilteredResult(_0xf1225,_0x31043a))[_0x7b7e('0x1f')](handleError(_0xf1225,null));};exports[_0x7b7e('0x49')]=function(_0x45e0cf,_0x334b8e){var _0x1f9d0f={'raw':![],'where':{'id':_0x45e0cf[_0x7b7e('0x4a')]['id']}},_0x5cce7c={};_0x5cce7c[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](db[_0x7b7e('0x2e')][_0x7b7e('0x2f')]);_0x5cce7c['query']=_[_0x7b7e('0x31')](_0x45e0cf[_0x7b7e('0x32')]);_0x5cce7c[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x5cce7c[_0x7b7e('0x30')],_0x5cce7c[_0x7b7e('0x32')]);_0x1f9d0f[_0x7b7e('0x37')]=_['intersection'](_0x5cce7c[_0x7b7e('0x30')],qs['fields'](_0x45e0cf[_0x7b7e('0x32')][_0x7b7e('0x38')]));_0x1f9d0f['attributes']=_0x1f9d0f[_0x7b7e('0x37')][_0x7b7e('0x4b')]?_0x1f9d0f[_0x7b7e('0x37')]:_0x5cce7c[_0x7b7e('0x30')];if(_0x45e0cf[_0x7b7e('0x32')][_0x7b7e('0x4c')]){_0x1f9d0f[_0x7b7e('0x46')]=[{'all':!![]}];}_0x1f9d0f=_['merge']({},_0x1f9d0f,_0x45e0cf[_0x7b7e('0x44')]);return db[_0x7b7e('0x2e')][_0x7b7e('0x4d')](_0x1f9d0f)[_0x7b7e('0x16')](handleEntityNotFound(_0x334b8e,null))['then'](respondWithResult(_0x334b8e,null))['catch'](handleError(_0x334b8e,null));};exports['create']=function(_0x2471ad,_0x41530f){return db[_0x7b7e('0x2e')]['create'](_0x2471ad['body'],{})[_0x7b7e('0x16')](respondWithResult(_0x41530f,0xc9))[_0x7b7e('0x1f')](handleError(_0x41530f,null));};exports['update']=function(_0xf54f87,_0xbe02ed){if(_0xf54f87[_0x7b7e('0x4e')]['id']){delete _0xf54f87['body']['id'];}return db[_0x7b7e('0x2e')][_0x7b7e('0x4d')]({'where':{'id':_0xf54f87['params']['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0xbe02ed,null))[_0x7b7e('0x16')](saveUpdates(_0xf54f87[_0x7b7e('0x4e')],null))[_0x7b7e('0x16')](respondWithResult(_0xbe02ed,null))[_0x7b7e('0x1f')](handleError(_0xbe02ed,null));};exports[_0x7b7e('0x28')]=function(_0x39eaf8,_0x2d1908){return db[_0x7b7e('0x2e')]['find']({'where':{'id':_0x39eaf8[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x2d1908,null))['then'](removeEntity(_0x2d1908,null))[_0x7b7e('0x1f')](handleError(_0x2d1908,null));};exports[_0x7b7e('0x4f')]=function(_0x3da726,_0x59f2df){return db[_0x7b7e('0x2e')]['describe']()[_0x7b7e('0x16')](respondWithResult(_0x59f2df,null))[_0x7b7e('0x1f')](handleError(_0x59f2df,null));};exports['addDisposition']=function(_0x2a17c7,_0x3b3168,_0x561158){if(_0x2a17c7[_0x7b7e('0x4e')]['id']){delete _0x2a17c7[_0x7b7e('0x4e')]['id'];}return db[_0x7b7e('0x2e')][_0x7b7e('0x4d')]({'where':{'id':_0x2a17c7['params']['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x3b3168,null))[_0x7b7e('0x16')](function(_0x2e11b1){if(_0x2e11b1){_0x2a17c7[_0x7b7e('0x4e')][_0x7b7e('0x50')]=_0x2e11b1['id'];return db[_0x7b7e('0x51')][_0x7b7e('0x52')](_0x2a17c7[_0x7b7e('0x4e')]);}})[_0x7b7e('0x16')](respondWithResult(_0x3b3168,null))[_0x7b7e('0x1f')](handleError(_0x3b3168,null));};exports['getDispositions']=function(_0x191179,_0x5dde68,_0x53e2f7){var _0x2b105a={'raw':![],'where':{}};var _0x7cbe6c={};var _0x1eb4b1={'count':0x0,'rows':[]};return db[_0x7b7e('0x2e')]['findOne']({'where':{'id':_0x191179[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x5dde68,null))[_0x7b7e('0x16')](function(_0x3d4b2d){if(_0x3d4b2d){_0x7cbe6c[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](db['Disposition'][_0x7b7e('0x2f')]);_0x7cbe6c['query']=_['keys'](_0x191179[_0x7b7e('0x32')]);_0x7cbe6c['filters']=_[_0x7b7e('0x36')](_0x7cbe6c['model'],_0x7cbe6c[_0x7b7e('0x32')]);_0x2b105a[_0x7b7e('0x37')]=_['intersection'](_0x7cbe6c[_0x7b7e('0x30')],qs[_0x7b7e('0x38')](_0x191179['query'][_0x7b7e('0x38')]));_0x2b105a[_0x7b7e('0x37')]=_0x2b105a[_0x7b7e('0x37')][_0x7b7e('0x4b')]?_0x2b105a[_0x7b7e('0x37')]:_0x7cbe6c[_0x7b7e('0x30')];if(!_0x191179[_0x7b7e('0x32')][_0x7b7e('0x39')](_0x7b7e('0x3a'))){_0x2b105a[_0x7b7e('0x3b')]=qs['limit'](_0x191179['query'][_0x7b7e('0x3b')]);_0x2b105a[_0x7b7e('0x22')]=qs[_0x7b7e('0x22')](_0x191179[_0x7b7e('0x32')][_0x7b7e('0x22')]);}_0x2b105a[_0x7b7e('0x3c')]=qs[_0x7b7e('0x3d')](_0x191179['query'][_0x7b7e('0x3d')]);_0x2b105a[_0x7b7e('0x3e')]=qs['filters'](_[_0x7b7e('0x3f')](_0x191179[_0x7b7e('0x32')],_0x7cbe6c[_0x7b7e('0x35')]));_0x2b105a[_0x7b7e('0x3e')][_0x7b7e('0x53')]=_0x3d4b2d['id'];if(_0x191179[_0x7b7e('0x32')][_0x7b7e('0x54')]){_0x2b105a[_0x7b7e('0x3e')]=_[_0x7b7e('0x42')](_0x2b105a[_0x7b7e('0x3e')],{'$or':_[_0x7b7e('0x43')](_0x2b105a['attributes'],function(_0xf25350){var _0x131ad5={};_0x131ad5[_0xf25350]={'$like':'%'+_0x191179[_0x7b7e('0x32')][_0x7b7e('0x54')]+'%'};return _0x131ad5;})});}_0x2b105a=_[_0x7b7e('0x42')]({},_0x2b105a,_0x191179[_0x7b7e('0x44')]);return db[_0x7b7e('0x51')]['count']({'where':_0x2b105a[_0x7b7e('0x3e')]})[_0x7b7e('0x16')](function(_0x1eb5ce){_0x1eb4b1['count']=_0x1eb5ce;if(_0x191179[_0x7b7e('0x32')][_0x7b7e('0x4c')]){_0x2b105a[_0x7b7e('0x46')]=[{'all':!![]}];}return db[_0x7b7e('0x51')][_0x7b7e('0x47')](_0x2b105a);})['then'](function(_0x4b2b79){_0x1eb4b1['rows']=_0x4b2b79;return _0x1eb4b1;});}})[_0x7b7e('0x16')](respondWithFilteredResult(_0x5dde68,_0x2b105a))[_0x7b7e('0x1f')](handleError(_0x5dde68,null));};exports[_0x7b7e('0x55')]=function(_0x518a97,_0x37714b,_0x23e2cc){var _0x19b821;return db['OpenchannelAccount'][_0x7b7e('0x4d')]({'where':{'id':_0x518a97[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x37714b,null))[_0x7b7e('0x16')](function(_0x538c5f){if(_0x538c5f){return _0x538c5f[_0x7b7e('0x55')](_0x518a97[_0x7b7e('0x32')][_0x7b7e('0x56')]);}})[_0x7b7e('0x16')](respondWithStatusCode(_0x37714b,null))['catch'](handleError(_0x37714b,null));};exports['addAnswer']=function(_0x2b5d20,_0x58a963,_0x1ecb55){if(_0x2b5d20[_0x7b7e('0x4e')]['id']){delete _0x2b5d20[_0x7b7e('0x4e')]['id'];}return db[_0x7b7e('0x2e')]['find']({'where':{'id':_0x2b5d20[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x58a963,null))[_0x7b7e('0x16')](function(_0x2c9acb){if(_0x2c9acb){_0x2b5d20[_0x7b7e('0x4e')][_0x7b7e('0x53')]=_0x2c9acb['id'];return db[_0x7b7e('0x57')][_0x7b7e('0x52')](_0x2b5d20[_0x7b7e('0x4e')]);}})[_0x7b7e('0x16')](respondWithResult(_0x58a963,null))[_0x7b7e('0x1f')](handleError(_0x58a963,null));};exports[_0x7b7e('0x58')]=function(_0xbdc4b9,_0x24189a,_0x391343){var _0x28e2e9={'raw':![],'where':{}};var _0x57d925={};var _0x3f4d00={'count':0x0,'rows':[]};return db[_0x7b7e('0x2e')][_0x7b7e('0x59')]({'where':{'id':_0xbdc4b9[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x24189a,null))[_0x7b7e('0x16')](function(_0x2bf2da){if(_0x2bf2da){_0x57d925['model']=_[_0x7b7e('0x31')](db[_0x7b7e('0x57')][_0x7b7e('0x2f')]);_0x57d925[_0x7b7e('0x32')]=_[_0x7b7e('0x31')](_0xbdc4b9['query']);_0x57d925['filters']=_[_0x7b7e('0x36')](_0x57d925[_0x7b7e('0x30')],_0x57d925[_0x7b7e('0x32')]);_0x28e2e9[_0x7b7e('0x37')]=_[_0x7b7e('0x36')](_0x57d925[_0x7b7e('0x30')],qs[_0x7b7e('0x38')](_0xbdc4b9[_0x7b7e('0x32')][_0x7b7e('0x38')]));_0x28e2e9[_0x7b7e('0x37')]=_0x28e2e9['attributes'][_0x7b7e('0x4b')]?_0x28e2e9[_0x7b7e('0x37')]:_0x57d925[_0x7b7e('0x30')];if(!_0xbdc4b9[_0x7b7e('0x32')][_0x7b7e('0x39')](_0x7b7e('0x3a'))){_0x28e2e9[_0x7b7e('0x3b')]=qs['limit'](_0xbdc4b9[_0x7b7e('0x32')]['limit']);_0x28e2e9[_0x7b7e('0x22')]=qs[_0x7b7e('0x22')](_0xbdc4b9['query'][_0x7b7e('0x22')]);}_0x28e2e9[_0x7b7e('0x3c')]=qs[_0x7b7e('0x3d')](_0xbdc4b9[_0x7b7e('0x32')][_0x7b7e('0x3d')]);_0x28e2e9['where']=qs[_0x7b7e('0x35')](_['pick'](_0xbdc4b9['query'],_0x57d925[_0x7b7e('0x35')]));_0x28e2e9[_0x7b7e('0x3e')][_0x7b7e('0x53')]=_0x2bf2da['id'];if(_0xbdc4b9[_0x7b7e('0x32')]['filter']){_0x28e2e9[_0x7b7e('0x3e')]=_['merge'](_0x28e2e9[_0x7b7e('0x3e')],{'$or':_[_0x7b7e('0x43')](_0x28e2e9[_0x7b7e('0x37')],function(_0x1e71ab){var _0x11d615={};_0x11d615[_0x1e71ab]={'$like':'%'+_0xbdc4b9[_0x7b7e('0x32')][_0x7b7e('0x54')]+'%'};return _0x11d615;})});}_0x28e2e9=_['merge']({},_0x28e2e9,_0xbdc4b9[_0x7b7e('0x44')]);return db[_0x7b7e('0x57')]['count']({'where':_0x28e2e9[_0x7b7e('0x3e')]})[_0x7b7e('0x16')](function(_0x102129){_0x3f4d00[_0x7b7e('0x45')]=_0x102129;if(_0xbdc4b9[_0x7b7e('0x32')][_0x7b7e('0x4c')]){_0x28e2e9[_0x7b7e('0x46')]=[{'all':!![]}];}return db[_0x7b7e('0x57')][_0x7b7e('0x47')](_0x28e2e9);})[_0x7b7e('0x16')](function(_0x4395c7){_0x3f4d00[_0x7b7e('0x48')]=_0x4395c7;return _0x3f4d00;});}})[_0x7b7e('0x16')](respondWithFilteredResult(_0x24189a,_0x28e2e9))[_0x7b7e('0x1f')](handleError(_0x24189a,null));};exports[_0x7b7e('0x5a')]=function(_0x1e2f9f,_0x11a814,_0x3a2413){var _0x45a690;return db[_0x7b7e('0x2e')][_0x7b7e('0x4d')]({'where':{'id':_0x1e2f9f[_0x7b7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x11a814,null))[_0x7b7e('0x16')](function(_0x97d43b){if(_0x97d43b){return _0x97d43b['removeAnswers'](_0x1e2f9f[_0x7b7e('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x11a814,null))[_0x7b7e('0x1f')](handleError(_0x11a814,null));};exports['notify']=function(_0x4d91c6,_0x8925c6,_0x3c0456){var _0x130c62={'body':_0x4d91c6['body'],'channel':_0x7b7e('0x5b')};var _0x5a3a14=[];var _0x2a6fdd=[];var _0x3b92e0={};var _0x1f2add=![];return db[_0x7b7e('0x5c')][_0x7b7e('0x4f')]()[_0x7b7e('0x16')](function(_0x4ba087){if(!_0x4ba087){throw new db['Sequelize'][(_0x7b7e('0x5d'))](_0x7b7e('0x5e'));}_0x5a3a14=_[_0x7b7e('0x5f')](_['keys'](_0x4ba087),[_0x7b7e('0x60'),_0x7b7e('0x61')]);_0x2a6fdd=_['difference'](_[_0x7b7e('0x31')](_0x4ba087),['createdAt','updatedAt',_0x7b7e('0x62'),_0x7b7e('0x63')]);if(_0x4d91c6['body']['id']){delete _0x4d91c6[_0x7b7e('0x4e')]['id'];}if(_['isNil'](_0x4d91c6['body'][_0x7b7e('0x64')])){throw new db[(_0x7b7e('0x65'))][(_0x7b7e('0x5d'))](_0x7b7e('0x66'));}if(_[_0x7b7e('0x67')](_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x4e')])||_0x4d91c6[_0x7b7e('0x4e')]['body']===''){throw new db[(_0x7b7e('0x65'))][(_0x7b7e('0x5d'))](_0x7b7e('0x68'));}if(_[_0x7b7e('0x67')](_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x69')])){throw new db[(_0x7b7e('0x65'))][(_0x7b7e('0x5d'))](_0x7b7e('0x6a')+_0x2a6fdd);}if(!_[_0x7b7e('0x6b')](_0x2a6fdd,_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x69')])){throw new db['Sequelize']['ValidationError'](_0x7b7e('0x6c')+_0x2a6fdd);}_0x3b92e0[_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x69')]]=_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x64')];})[_0x7b7e('0x16')](function(){return db[_0x7b7e('0x2e')][_0x7b7e('0x4d')]({'where':{'id':_0x4d91c6[_0x7b7e('0x4a')]['id']},'include':[{'model':db[_0x7b7e('0x6d')],'as':_0x7b7e('0x6e'),'include':[{'model':db[_0x7b7e('0x5c')],'as':'Contacts','where':_0x3b92e0,'limit':0x1,'order':[[_0x7b7e('0x61'),'DESC']]}]},{'model':db[_0x7b7e('0x6f')],'as':_0x7b7e('0x70')}]});})[_0x7b7e('0x16')](handleEntityNotFound(_0x8925c6,null))['then'](function(_0x592692){if(_0x592692&&_0x592692['List']){_0x130c62[_0x7b7e('0x71')]=_0x592692;_0x130c62[_0x7b7e('0x72')]=_0x592692[_0x7b7e('0x70')];_0x130c62[_0x7b7e('0x73')]=_0x592692[_0x7b7e('0x6e')];_0x130c62[_0x7b7e('0x72')]=_[_0x7b7e('0x74')](_0x130c62[_0x7b7e('0x72')],[_0x7b7e('0x75')],[_0x7b7e('0x76')]);if(_0x130c62[_0x7b7e('0x71')]['Applications']){delete _0x130c62[_0x7b7e('0x71')][_0x7b7e('0x70')];}if(_0x130c62[_0x7b7e('0x71')][_0x7b7e('0x6e')]&&_0x130c62['account'][_0x7b7e('0x6e')][_0x7b7e('0x77')][_0x7b7e('0x4b')]){return _0x130c62[_0x7b7e('0x71')][_0x7b7e('0x6e')][_0x7b7e('0x77')][0x0];}var _0x422917=_[_0x7b7e('0x78')](_0x4d91c6[_0x7b7e('0x4e')],{'firstName':_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x64')],'ListId':_0x592692[_0x7b7e('0x63')]});_0x422917[_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x69')]]=_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x64')];return db[_0x7b7e('0x5c')][_0x7b7e('0x52')](_0x422917,{'fields':_0x5a3a14,'raw':!![]});}})[_0x7b7e('0x16')](handleEntityNotFound(_0x8925c6,null))[_0x7b7e('0x16')](function(_0x32e2ee){_0x130c62[_0x7b7e('0x79')]=_0x32e2ee;if(_0x32e2ee){var _0x274c66={'ContactId':_0x32e2ee['id'],'OpenchannelAccountId':_0x4d91c6[_0x7b7e('0x4a')]['id'],'from':(_0x32e2ee[_0x7b7e('0x7a')]||'')+'\x20'+(_0x32e2ee[_0x7b7e('0x7b')]||'')};var _0x387eab={'OpenchannelAccountId':_0x4d91c6[_0x7b7e('0x4a')]['id'],'closed':![]};if(_0x4d91c6['body'][_0x7b7e('0x7c')]){_0x387eab['threadId']=_0x4d91c6['body']['threadId'];return db[_0x7b7e('0x7d')][_0x7b7e('0x4d')]({'where':_0x387eab})['then'](function(_0x4f9d6e){if(_0x4f9d6e){return[_0x4f9d6e,![]];}_0x274c66[_0x7b7e('0x7c')]=_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x7c')];_0x274c66['externalUrl']=_0x4d91c6[_0x7b7e('0x4e')]['externalUrl'];return db['OpenchannelInteraction'][_0x7b7e('0x52')](_0x274c66)['then'](function(_0x4deac2){return[_0x4deac2,!![]];});});}else{_0x387eab[_0x7b7e('0x7c')]=null;}_0x387eab[_0x7b7e('0x7e')]=_0x32e2ee['id'];return db[_0x7b7e('0x7d')]['find']({'where':_0x387eab})['then'](function(_0x44e155){if(_0x44e155){return[_0x44e155,![]];}return db[_0x7b7e('0x7d')][_0x7b7e('0x52')](_0x274c66)[_0x7b7e('0x16')](function(_0x14310d){return[_0x14310d,!![]];});});}})[_0x7b7e('0x7f')](function(_0x445479,_0x1b4600){if(_0x445479){_0x1f2add=_0x1b4600;if(!_0x1b4600){return _0x445479[_0x7b7e('0x27')]({'from':(_0x130c62['contact'][_0x7b7e('0x7a')]||'')+'\x20'+(_0x130c62['contact'][_0x7b7e('0x7b')]||'')});}else{return _0x445479;}}})[_0x7b7e('0x16')](function(_0x41568a){_0x130c62[_0x7b7e('0x80')]=_0x41568a[_0x7b7e('0x81')]({'plain':!![]});_0x130c62['interaction'][_0x7b7e('0x82')]=_0x1f2add;if(_0x130c62[_0x7b7e('0x80')][_0x7b7e('0x82')]){if(_0x130c62[_0x7b7e('0x71')]['autoclose']){_0x130c62[_0x7b7e('0x72')][_0x7b7e('0x83')]({'id':0x0,'priority':_0x130c62['applications'][_0x7b7e('0x4b')]+0x1,'app':_0x7b7e('0x84'),'appdata':_0x7b7e('0x85'),'interval':_0x7b7e('0x86')});}}return db[_0x7b7e('0x87')][_0x7b7e('0x52')]({'body':_0x4d91c6[_0x7b7e('0x4e')][_0x7b7e('0x4e')],'OpenchannelAccountId':_0x4d91c6[_0x7b7e('0x4a')]['id'],'OpenchannelInteractionId':_0x41568a['id'],'direction':'in','ContactId':_0x130c62[_0x7b7e('0x79')]['id'],'AttachmentId':_0x4d91c6[_0x7b7e('0x4e')]['AttachmentId']});})[_0x7b7e('0x16')](function(_0x711f2f){_0x130c62['message']=_0x711f2f;if(_0x130c62[_0x7b7e('0x80')]['UserId']){return db[_0x7b7e('0x88')][_0x7b7e('0x4d')]({'attributes':['id',_0x7b7e('0x2b')],'where':{'id':_0x130c62['interaction'][_0x7b7e('0x89')]}})[_0x7b7e('0x16')](function(_0x474f1c){if(_0x474f1c){_0x130c62[_0x7b7e('0x72')][_0x7b7e('0x8a')]({'id':0x0,'priority':0x0,'app':_0x7b7e('0x8b'),'appdata':_0x474f1c[_0x7b7e('0x2b')]+','+(_0x130c62[_0x7b7e('0x71')][_0x7b7e('0x8c')]||0xa),'interval':_0x7b7e('0x86')});_0x130c62['forcedOwnership']=![];}return respondWithRpcPromise(_0x7b7e('0x8d'),_0x7b7e('0x8e'),_0x130c62);});}return respondWithRpcPromise(_0x7b7e('0x8d'),'startRouting',_0x130c62);})['then'](function(_0xf6897f){respondWithRpcPromise('EventManager','EventManager',{'event':_0x7b7e('0x8f'),'message':_0xf6897f},client9002);return _0xf6897f;})[_0x7b7e('0x16')](respondWithResult(_0x8925c6,null))[_0x7b7e('0x1f')](handleError(_0x8925c6,null));};exports['addApplications']=function(_0x34f077,_0x33eba1,_0x26d962){return db[_0x7b7e('0x2e')][_0x7b7e('0x59')]({'where':{'id':_0x34f077['params']['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x33eba1,null))[_0x7b7e('0x16')](function(_0x293508){if(_0x293508){return db[_0x7b7e('0x90')][_0x7b7e('0x91')](function(_0x4299dd){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x34f077[_0x7b7e('0x4a')]['id']},'transaction':_0x4299dd})['then'](function(_0x1be318){var _0x60767f=_[_0x7b7e('0x43')](_0x34f077[_0x7b7e('0x4e')],function(_0x117c70){_0x117c70[_0x7b7e('0x53')]=_0x34f077[_0x7b7e('0x4a')]['id'];return _0x117c70;});return db['OpenchannelApplication']['bulkCreate'](_0x60767f,{'transaction':_0x4299dd});});})[_0x7b7e('0x16')](function(){return db[_0x7b7e('0x6f')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x34f077[_0x7b7e('0x4a')]['id']},'order':_0x7b7e('0x75')});});}})['then'](respondWithResult(_0x33eba1,null))['catch'](handleError(_0x33eba1,null));};exports[_0x7b7e('0x92')]=function(_0x2575f6,_0x1ac6ea,_0x5c8b43){var _0x3982b3={};var _0x2a5c8e={};var _0x111e07;var _0x23bcbc;return db[_0x7b7e('0x2e')][_0x7b7e('0x59')]({'where':{'id':_0x2575f6[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x1ac6ea,null))[_0x7b7e('0x16')](function(_0x5d5da2){if(_0x5d5da2){_0x111e07=_0x5d5da2;_0x2a5c8e['model']=_['keys'](db['OpenchannelApplication'][_0x7b7e('0x2f')]);_0x2a5c8e['query']=_[_0x7b7e('0x31')](_0x2575f6[_0x7b7e('0x32')]);_0x2a5c8e[_0x7b7e('0x35')]=_['intersection'](_0x2a5c8e[_0x7b7e('0x30')],_0x2a5c8e[_0x7b7e('0x32')]);_0x3982b3[_0x7b7e('0x37')]=_[_0x7b7e('0x36')](_0x2a5c8e[_0x7b7e('0x30')],qs[_0x7b7e('0x38')](_0x2575f6[_0x7b7e('0x32')]['fields']));_0x3982b3['attributes']=_0x3982b3['attributes'][_0x7b7e('0x4b')]?_0x3982b3[_0x7b7e('0x37')]:_0x2a5c8e[_0x7b7e('0x30')];_0x3982b3[_0x7b7e('0x3c')]=qs[_0x7b7e('0x3d')](_0x2575f6[_0x7b7e('0x32')][_0x7b7e('0x3d')]);_0x3982b3[_0x7b7e('0x3e')]=qs[_0x7b7e('0x35')](_['pick'](_0x2575f6[_0x7b7e('0x32')],_0x2a5c8e[_0x7b7e('0x35')]));if(_0x2575f6[_0x7b7e('0x32')]['filter']){_0x3982b3[_0x7b7e('0x3e')]=_['merge'](_0x3982b3[_0x7b7e('0x3e')],{'$or':_[_0x7b7e('0x43')](_0x3982b3[_0x7b7e('0x37')],function(_0x1e1a85){var _0x5f3cb8={};_0x5f3cb8[_0x1e1a85]={'$like':'%'+_0x2575f6[_0x7b7e('0x32')][_0x7b7e('0x54')]+'%'};return _0x5f3cb8;})});}_0x3982b3=_[_0x7b7e('0x42')]({},_0x3982b3,_0x2575f6[_0x7b7e('0x44')]);return _0x111e07[_0x7b7e('0x92')](_0x3982b3);}})['then'](function(_0x450e1d){if(_0x450e1d){_0x23bcbc=_0x450e1d[_0x7b7e('0x4b')];if(!_0x2575f6[_0x7b7e('0x32')][_0x7b7e('0x39')](_0x7b7e('0x3a'))){_0x3982b3[_0x7b7e('0x3b')]=qs[_0x7b7e('0x3b')](_0x2575f6[_0x7b7e('0x32')]['limit']);_0x3982b3[_0x7b7e('0x22')]=qs[_0x7b7e('0x22')](_0x2575f6[_0x7b7e('0x32')][_0x7b7e('0x22')]);}return _0x111e07[_0x7b7e('0x92')](_0x3982b3);}})['then'](function(_0xb3704a){if(_0xb3704a){return _0xb3704a?{'count':_0x23bcbc,'rows':_0xb3704a}:null;}})[_0x7b7e('0x16')](respondWithResult(_0x1ac6ea,null))[_0x7b7e('0x1f')](handleError(_0x1ac6ea,null));};exports[_0x7b7e('0x93')]=function(_0x3f886b,_0x7fe4fe,_0x3dbd7d){var _0x10795a={'raw':![],'where':{}};var _0x3cfe88={};var _0x368a2b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7b7e('0x59')]({'where':{'id':_0x3f886b['params']['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x7fe4fe,null))[_0x7b7e('0x16')](function(_0xdb9e8c){if(_0xdb9e8c){_0x3cfe88[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](db[_0x7b7e('0x7d')][_0x7b7e('0x2f')]);_0x3cfe88[_0x7b7e('0x32')]=_[_0x7b7e('0x31')](_0x3f886b[_0x7b7e('0x32')]);_0x3cfe88[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x3cfe88[_0x7b7e('0x30')],_0x3cfe88['query']);_0x10795a['attributes']=_[_0x7b7e('0x36')](_0x3cfe88['model'],qs[_0x7b7e('0x38')](_0x3f886b[_0x7b7e('0x32')][_0x7b7e('0x38')]));_0x10795a[_0x7b7e('0x37')]=_0x10795a[_0x7b7e('0x37')]['length']?_0x10795a[_0x7b7e('0x37')]:_0x3cfe88['model'];if(!_0x3f886b['query']['hasOwnProperty'](_0x7b7e('0x3a'))){_0x10795a[_0x7b7e('0x3b')]=qs[_0x7b7e('0x3b')](_0x3f886b[_0x7b7e('0x32')][_0x7b7e('0x3b')]);_0x10795a[_0x7b7e('0x22')]=qs[_0x7b7e('0x22')](_0x3f886b['query'][_0x7b7e('0x22')]);}_0x10795a[_0x7b7e('0x3c')]=qs[_0x7b7e('0x3d')](_0x3f886b[_0x7b7e('0x32')][_0x7b7e('0x3d')]);_0x10795a[_0x7b7e('0x3e')]=qs[_0x7b7e('0x35')](_[_0x7b7e('0x3f')](_0x3f886b[_0x7b7e('0x32')],_0x3cfe88[_0x7b7e('0x35')]));_0x10795a[_0x7b7e('0x3e')][_0x7b7e('0x53')]=_0xdb9e8c['id'];if(_0x3f886b[_0x7b7e('0x32')][_0x7b7e('0x54')]){_0x10795a['where']=_['merge'](_0x10795a[_0x7b7e('0x3e')],{'$or':_[_0x7b7e('0x43')](_0x10795a[_0x7b7e('0x37')],function(_0x49082e){var _0x2a60a8={};_0x2a60a8[_0x49082e]={'$like':'%'+_0x3f886b[_0x7b7e('0x32')][_0x7b7e('0x54')]+'%'};return _0x2a60a8;})});}_0x10795a=_[_0x7b7e('0x42')]({},_0x10795a,_0x3f886b[_0x7b7e('0x44')]);return db['OpenchannelInteraction']['count']({'where':_0x10795a['where']})[_0x7b7e('0x16')](function(_0xec692d){_0x368a2b[_0x7b7e('0x45')]=_0xec692d;if(_0x3f886b[_0x7b7e('0x32')][_0x7b7e('0x4c')]){_0x10795a['include']=[{'model':db[_0x7b7e('0x5c')],'as':'Contact','required':![]},{'model':db[_0x7b7e('0x88')],'as':'Owner','attributes':['name','fullname',_0x7b7e('0x94')],'required':![]},{'model':db[_0x7b7e('0x95')],'as':'Tags','attributes':['id',_0x7b7e('0x2b'),_0x7b7e('0x96')],'where':_0x3f886b[_0x7b7e('0x32')][_0x7b7e('0x97')]?{'id':_0x3f886b['query'][_0x7b7e('0x97')]}:undefined,'required':_0x3f886b[_0x7b7e('0x32')]['tag']?!![]:![]}];}return db[_0x7b7e('0x7d')][_0x7b7e('0x47')](_0x10795a);})[_0x7b7e('0x16')](function(_0x3876d9){_0x368a2b['rows']=_0x3876d9;return _0x368a2b;});}})[_0x7b7e('0x16')](respondWithFilteredResult(_0x7fe4fe,_0x10795a))[_0x7b7e('0x1f')](handleError(_0x7fe4fe,null));};exports['addAgents']=function(_0x1104d8,_0x1e6d66,_0x122180){return db[_0x7b7e('0x2e')][_0x7b7e('0x4d')]({'where':{'id':_0x1104d8[_0x7b7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e6d66,null))[_0x7b7e('0x16')](function(_0x5b08e7){if(_0x5b08e7){return _0x5b08e7[_0x7b7e('0x98')](_0x1104d8['body'][_0x7b7e('0x56')],_[_0x7b7e('0x99')](_0x1104d8['body'],['ids','id'])||{})['spread'](function(_0x1becb1){for(var _0x3db64a=0x0;_0x3db64a<_0x1104d8[_0x7b7e('0x4e')][_0x7b7e('0x56')][_0x7b7e('0x4b')];_0x3db64a+=0x1){socket[_0x7b7e('0x9a')]('userOpenchannelAccount:save',{'UserId':_0x1104d8[_0x7b7e('0x4e')][_0x7b7e('0x56')][_0x3db64a],'OpenchannelAccountId':_0x1104d8[_0x7b7e('0x4a')]['id']});}return _0x1becb1;});}})['then'](respondWithResult(_0x1e6d66,null))[_0x7b7e('0x1f')](handleError(_0x1e6d66,null));};exports[_0x7b7e('0x9b')]=function(_0x429352,_0x355938,_0x238b82){var _0x2622e3;return db[_0x7b7e('0x2e')][_0x7b7e('0x4d')]({'where':{'id':_0x429352[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x16')](handleEntityNotFound(_0x355938,null))[_0x7b7e('0x16')](function(_0x93e2b6){if(_0x93e2b6){return _0x93e2b6['removeAgents'](_0x429352[_0x7b7e('0x32')]['ids'])[_0x7b7e('0x16')](function(_0x57d650){if(_[_0x7b7e('0x9c')](_0x429352[_0x7b7e('0x32')]['ids'])){for(var _0x2457d5=0x0;_0x2457d5<_0x429352['query'][_0x7b7e('0x56')]['length'];_0x2457d5+=0x1){socket[_0x7b7e('0x9a')]('userOpenchannelAccount:remove',{'UserId':_0x429352[_0x7b7e('0x32')][_0x7b7e('0x56')][_0x2457d5],'OpenchannelAccountId':_0x429352[_0x7b7e('0x4a')]['id']});}}else{socket[_0x7b7e('0x9a')](_0x7b7e('0x9d'),{'UserId':_0x429352[_0x7b7e('0x32')][_0x7b7e('0x56')],'OpenchannelAccountId':_0x429352[_0x7b7e('0x4a')]['id']});}});}})[_0x7b7e('0x16')](respondWithStatusCode(_0x355938,null))[_0x7b7e('0x1f')](handleError(_0x355938,null));};exports[_0x7b7e('0x9e')]=function(_0x4d1f92,_0x5eae74,_0x4999af){var _0x4a193a={};var _0x55b604={};var _0x283d97;var _0x1586b9;return db[_0x7b7e('0x2e')][_0x7b7e('0x59')]({'where':{'id':_0x4d1f92[_0x7b7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5eae74,null))['then'](function(_0x265dfc){if(_0x265dfc){_0x283d97=_0x265dfc;_0x55b604['model']=_[_0x7b7e('0x31')](db[_0x7b7e('0x88')][_0x7b7e('0x2f')]);_0x55b604[_0x7b7e('0x32')]=_[_0x7b7e('0x31')](_0x4d1f92[_0x7b7e('0x32')]);_0x55b604[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x55b604['model'],_0x55b604[_0x7b7e('0x32')]);_0x4a193a['attributes']=_['intersection'](_0x55b604[_0x7b7e('0x30')],qs[_0x7b7e('0x38')](_0x4d1f92[_0x7b7e('0x32')][_0x7b7e('0x38')]));_0x4a193a[_0x7b7e('0x37')]=_0x4a193a[_0x7b7e('0x37')][_0x7b7e('0x4b')]?_0x4a193a[_0x7b7e('0x37')]:_0x55b604[_0x7b7e('0x30')];_0x4a193a[_0x7b7e('0x3c')]=qs[_0x7b7e('0x3d')](_0x4d1f92[_0x7b7e('0x32')][_0x7b7e('0x3d')]);_0x4a193a['where']=qs[_0x7b7e('0x35')](_[_0x7b7e('0x3f')](_0x4d1f92[_0x7b7e('0x32')],_0x55b604[_0x7b7e('0x35')]));if(_0x4d1f92[_0x7b7e('0x32')][_0x7b7e('0x54')]){_0x4a193a[_0x7b7e('0x3e')]=_[_0x7b7e('0x42')](_0x4a193a[_0x7b7e('0x3e')],{'$or':_['map'](_0x4a193a[_0x7b7e('0x37')],function(_0x2a1ebc){var _0x167228={};_0x167228[_0x2a1ebc]={'$like':'%'+_0x4d1f92[_0x7b7e('0x32')][_0x7b7e('0x54')]+'%'};return _0x167228;})});}_0x4a193a=_['merge']({},_0x4a193a,_0x4d1f92[_0x7b7e('0x44')]);return _0x283d97[_0x7b7e('0x9e')](_0x4a193a);}})[_0x7b7e('0x16')](function(_0x55ab1e){if(_0x55ab1e){_0x1586b9=_0x55ab1e[_0x7b7e('0x4b')];if(!_0x4d1f92[_0x7b7e('0x32')]['hasOwnProperty']('nolimit')){_0x4a193a[_0x7b7e('0x3b')]=qs[_0x7b7e('0x3b')](_0x4d1f92['query'][_0x7b7e('0x3b')]);_0x4a193a[_0x7b7e('0x22')]=qs[_0x7b7e('0x22')](_0x4d1f92[_0x7b7e('0x32')][_0x7b7e('0x22')]);}return _0x283d97['getAgents'](_0x4a193a);}})['then'](function(_0x2b6a54){if(_0x2b6a54){return _0x2b6a54?{'count':_0x1586b9,'rows':_0x2b6a54}:null;}})['then'](respondWithResult(_0x5eae74,null))[_0x7b7e('0x1f')](handleError(_0x5eae74,null));};exports['send']=function(_0x2128ed,_0x4d97f2,_0x2880a3){var _0x5e3108,_0x48b823,_0xd77fbd;if(_['isNil'](_0x2128ed['body'][_0x7b7e('0x4e')])||_0x2128ed[_0x7b7e('0x4e')]['body']===''){throw new db[(_0x7b7e('0x65'))][(_0x7b7e('0x5d'))](_0x7b7e('0x68'));}if(_[_0x7b7e('0x67')](_0x2128ed[_0x7b7e('0x4e')]['to'])){}_0x5e3108=_0x2128ed[_0x7b7e('0x4e')]['to'];return db[_0x7b7e('0x2e')][_0x7b7e('0x59')]({'where':{'id':_0x2128ed['params']['id']}})['then'](handleEntityNotFound(_0x4d97f2,null))[_0x7b7e('0x16')](function(_0x16d8b1){if(_0x16d8b1){return db[_0x7b7e('0x2e')][_0x7b7e('0x4d')]({'where':{'id':_0x16d8b1['id']},'include':[{'model':db[_0x7b7e('0x6d')],'as':_0x7b7e('0x6e'),'include':[{'model':db['CmContact'],'as':_0x7b7e('0x77'),'where':{[_0x16d8b1[_0x7b7e('0x69')]]:_0x5e3108},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x7b7e('0x16')](handleEntityNotFound(_0x4d97f2,null))['then'](function(_0x413680){if(_0x413680&&_0x413680[_0x7b7e('0x6e')]){_0x48b823=_0x413680[_0x7b7e('0x81')]({'plain':!![]});if(_0x48b823[_0x7b7e('0x6e')]&&_0x48b823[_0x7b7e('0x6e')]['Contacts'][_0x7b7e('0x4b')]){return _0x48b823['List'][_0x7b7e('0x77')][0x0];}return db[_0x7b7e('0x5c')][_0x7b7e('0x52')](_['defaults'](_0x2128ed[_0x7b7e('0x4e')],{'firstName':_0x5e3108,[_0x413680[_0x7b7e('0x69')]]:_0x5e3108,'phone':_0x5e3108,'ListId':_0x48b823['ListId']}));}})[_0x7b7e('0x16')](handleEntityNotFound(_0x4d97f2,null))[_0x7b7e('0x16')](function(_0x49f6cc){if(_0x49f6cc){_0xd77fbd=_0x49f6cc;return db[_0x7b7e('0x7d')][_0x7b7e('0x4d')]({'where':{'ContactId':_0xd77fbd['id'],'closed':![],'OpenchannelAccountId':_0x48b823['id']}})[_0x7b7e('0x16')](function(_0x1efbba){if(_0x1efbba){return[_0x1efbba,![]];}return db['OpenchannelInteraction'][_0x7b7e('0x52')]({'UserId':_0x2128ed['user']['id'],'ContactId':_0xd77fbd['id'],'OpenchannelAccountId':_0x48b823['id'],'lastMsgDirection':_0x7b7e('0x9f'),'Messages':[_['merge'](_0x2128ed[_0x7b7e('0x4e')],{'read':![],'body':_0x2128ed['body'][_0x7b7e('0x4e')],'OpenchannelAccountId':_0x48b823['id'],'UserId':_0x2128ed[_0x7b7e('0xa0')]['id'],'ContactId':_0xd77fbd['id']})]},{'include':[{'model':db[_0x7b7e('0x87')],'as':_0x7b7e('0xa1')}]})[_0x7b7e('0x16')](function(_0x4f07db){return[_0x4f07db,!![]];});});}})[_0x7b7e('0x7f')](function(_0x2e8c14,_0x41a635){if(_0x41a635){return _0x2e8c14;}return db['OpenchannelMessage']['create'](_[_0x7b7e('0x42')](_0x2128ed[_0x7b7e('0x4e')],{'read':![],'body':_0x2128ed[_0x7b7e('0x4e')][_0x7b7e('0x4e')],'OpenchannelAccountId':_0x48b823['id'],'OpenchannelInteractionId':_0x2e8c14['id'],'UserId':_0x2128ed['user']['id'],'ContactId':_0xd77fbd['id']}))[_0x7b7e('0x16')](function(_0x1dc9db){_0x2e8c14[_0x7b7e('0xa2')]['Messages']=[];_0x2e8c14[_0x7b7e('0xa2')][_0x7b7e('0xa1')][_0x7b7e('0x83')](_0x1dc9db['dataValues']);return _0x2e8c14;});});}})[_0x7b7e('0x16')](respondWithResult(_0x4d97f2,null))[_0x7b7e('0x1f')](handleError(_0x4d97f2,null));}; \ No newline at end of file +var _0x93e9=['forcedOwnership','startRouting','EventManager','transaction','OpenchannelApplication','destroy','bulkCreate','findAndCountAll','getApplications','order','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','Contacts','user','out','Messages','dataValues','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./openchannelAccount.socket','register','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','limit','apply','reject','update','name','send','index','OpenchannelAccount','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','add','day','merge','filter','map','options','count','include','findAll','rows','catch','params','find','create','body','describe','OpnechannelAccountId','Disposition','findOne','OpenchannelAccountId','includeAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','DESC','Applications','account','applications','list','priority','asc','defaults','contact','threadId','OpenchannelInteraction','externalUrl','spread','firstName','lastName','interaction','get','created','push','close','unmanaged','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent'];(function(_0x2ae024,_0x1beb8e){var _0x177eaa=function(_0x239923){while(--_0x239923){_0x2ae024['push'](_0x2ae024['shift']());}};_0x177eaa(++_0x1beb8e);}(_0x93e9,0xcc));var _0x993e=function(_0x39d260,_0x1b3420){_0x39d260=_0x39d260-0x0;var _0x26d031=_0x93e9[_0x39d260];return _0x26d031;};'use strict';var jsonpatch=require(_0x993e('0x0'));var rp=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var Mustache=require(_0x993e('0x4'));var util=require(_0x993e('0x5'));var path=require(_0x993e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x993e('0x7'));var fs=require('fs');var _=require(_0x993e('0x8'));var squel=require(_0x993e('0x9'));var crypto=require(_0x993e('0xa'));var jsforce=require(_0x993e('0xb'));var deskjs=require(_0x993e('0xc'));var toCsv=require(_0x993e('0xd'));var querystring=require(_0x993e('0xe'));var Papa=require('papaparse');var qs=require(_0x993e('0xf'));var logger=require(_0x993e('0x10'))(_0x993e('0x11'));var utils=require(_0x993e('0x12'));var config=require(_0x993e('0x13'));var db=require(_0x993e('0x14'))['db'];var socket=require(_0x993e('0x15'))({'host':'localhost','port':0x18eb});require(_0x993e('0x16'))[_0x993e('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x993e('0x18')]({'port':0x232c});var client9002=jayson['client'][_0x993e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5d5c0d,_0x4c2707,_0x31ece2,_0x2f7f7e){return new BPromise(function(_0x156bef,_0x267748){var _0x3e082b=_0x2f7f7e||client;return _0x3e082b[_0x993e('0x19')](_0x5d5c0d,_0x31ece2)[_0x993e('0x1a')](function(_0x20f32a){logger[_0x993e('0x1b')](_0x993e('0x1c'),_0x4c2707,_0x993e('0x1d'));logger[_0x993e('0x1e')](_0x993e('0x1f'),_0x4c2707,_0x993e('0x1d'),JSON[_0x993e('0x20')](_0x20f32a));if(_0x20f32a[_0x993e('0x21')]){if(_0x20f32a[_0x993e('0x21')]['code']===0x1f4){logger[_0x993e('0x21')](_0x993e('0x1c'),_0x4c2707,_0x20f32a[_0x993e('0x21')][_0x993e('0x22')]);return _0x267748(_0x20f32a[_0x993e('0x21')][_0x993e('0x22')]);}logger['error'](_0x993e('0x1c'),_0x4c2707,_0x20f32a[_0x993e('0x21')][_0x993e('0x22')]);return _0x156bef(_0x20f32a[_0x993e('0x21')][_0x993e('0x22')]);}else{logger[_0x993e('0x1b')](_0x993e('0x1c'),_0x4c2707,_0x993e('0x1d'));_0x156bef(_0x20f32a['result'][_0x993e('0x22')]);}})['catch'](function(_0x11f6f4){logger[_0x993e('0x21')](_0x993e('0x1c'),_0x4c2707,_0x11f6f4);_0x267748(_0x11f6f4);});});}function respondWithStatusCode(_0x5ba2a1,_0x2353d4){_0x2353d4=_0x2353d4||0xcc;return function(_0x13db4e){if(_0x13db4e){return _0x5ba2a1[_0x993e('0x23')](_0x2353d4);}return _0x5ba2a1[_0x993e('0x24')](_0x2353d4)[_0x993e('0x25')]();};}function respondWithResult(_0x328d22,_0xa1c83e){_0xa1c83e=_0xa1c83e||0xc8;return function(_0x3ad96f){if(_0x3ad96f){return _0x328d22[_0x993e('0x24')](_0xa1c83e)[_0x993e('0x26')](_0x3ad96f);}};}function respondWithFilteredResult(_0x3fe099,_0x3603fa){return function(_0x4fe471){if(_0x4fe471){var _0x2756a7=_0x4fe471['count'],_0x279bb8=_0x3603fa[_0x993e('0x27')],_0x52b727=_0x3603fa[_0x993e('0x27')]+_0x3603fa[_0x993e('0x28')],_0x27bbf7;if(_0x52b727>=_0x2756a7){_0x52b727=_0x2756a7;_0x27bbf7=0xc8;}else{_0x27bbf7=0xce;}_0x3fe099[_0x993e('0x24')](_0x27bbf7);return _0x3fe099['set']('Content-Range',_0x279bb8+'-'+_0x52b727+'/'+_0x2756a7)[_0x993e('0x26')](_0x4fe471);}return null;};}function patchUpdates(_0x466d63){return function(_0x4a4f00){try{jsonpatch[_0x993e('0x29')](_0x4a4f00,_0x466d63,!![]);}catch(_0x46670a){return BPromise[_0x993e('0x2a')](_0x46670a);}return _0x4a4f00['save']();};}function saveUpdates(_0x2495b7,_0x9e0309){return function(_0x1f5d51){if(_0x1f5d51){return _0x1f5d51[_0x993e('0x2b')](_0x2495b7)[_0x993e('0x1a')](function(_0x54da4e){return _0x54da4e;});}return null;};}function removeEntity(_0x29b3fc,_0x4d1379){return function(_0x782298){if(_0x782298){return _0x782298['destroy']()[_0x993e('0x1a')](function(){_0x29b3fc['status'](0xcc)[_0x993e('0x25')]();});}};}function handleEntityNotFound(_0x2ce5d5,_0x94a2fc){return function(_0x157ea4){if(!_0x157ea4){_0x2ce5d5[_0x993e('0x23')](0x194);}return _0x157ea4;};}function handleError(_0x360e2d,_0x5562f1){_0x5562f1=_0x5562f1||0x1f4;return function(_0x1920c6){logger['error'](_0x1920c6['stack']);if(_0x1920c6[_0x993e('0x2c')]){delete _0x1920c6['name'];}_0x360e2d[_0x993e('0x24')](_0x5562f1)[_0x993e('0x2d')](_0x1920c6);};}exports[_0x993e('0x2e')]=function(_0xf06b15,_0x3fd06e){var _0x339fb6={},_0x22a6bd={},_0x14424a={'count':0x0,'rows':[]};var _0x16c944=db[_0x993e('0x2f')][_0x993e('0x30')];_0x22a6bd[_0x993e('0x31')]=_[_0x993e('0x32')](_0x16c944);var _0x28a481={'dateStart':_0xf06b15[_0x993e('0x33')]['dateStart'],'dateEnd':_0xf06b15[_0x993e('0x33')][_0x993e('0x34')]};delete _0xf06b15[_0x993e('0x33')][_0x993e('0x35')];delete _0xf06b15[_0x993e('0x33')][_0x993e('0x34')];_0x22a6bd[_0x993e('0x33')]=_[_0x993e('0x32')](_0xf06b15[_0x993e('0x33')]);_0x22a6bd['filters']=_[_0x993e('0x36')](_0x22a6bd['model'],_0x22a6bd[_0x993e('0x33')]);_0x339fb6[_0x993e('0x37')]=_[_0x993e('0x36')](_0x22a6bd[_0x993e('0x31')],qs[_0x993e('0x38')](_0xf06b15[_0x993e('0x33')][_0x993e('0x38')]));_0x339fb6[_0x993e('0x37')]=_0x339fb6['attributes'][_0x993e('0x39')]?_0x339fb6['attributes']:_0x22a6bd[_0x993e('0x31')];if(!_0xf06b15['query'][_0x993e('0x3a')](_0x993e('0x3b'))){_0x339fb6[_0x993e('0x28')]=qs[_0x993e('0x28')](_0xf06b15[_0x993e('0x33')][_0x993e('0x28')]);_0x339fb6[_0x993e('0x27')]=qs[_0x993e('0x27')](_0xf06b15['query'][_0x993e('0x27')]);}_0x339fb6['order']=qs['sort'](_0xf06b15[_0x993e('0x33')][_0x993e('0x3c')]);_0x339fb6[_0x993e('0x3d')]=qs['filters'](_[_0x993e('0x3e')](_0xf06b15[_0x993e('0x33')],_0x22a6bd[_0x993e('0x3f')]));if(_0x28a481['dateStart']){if(_0x28a481['dateEnd']){_0x28a481['dateEnd']=moment(_0x28a481[_0x993e('0x34')])[_0x993e('0x40')](0x1,_0x993e('0x41'));}else{_0x28a481['dateEnd']=moment(_0x28a481[_0x993e('0x35')])[_0x993e('0x40')](0x1,'day');}_[_0x993e('0x42')](_0x339fb6[_0x993e('0x3d')],{'createdAt':{'$gte':_0x28a481['dateStart'],'$lte':_0x28a481[_0x993e('0x34')]}});}if(_0xf06b15[_0x993e('0x33')][_0x993e('0x43')]){_0x339fb6['where']=_['merge'](_0x339fb6['where'],{'$or':_[_0x993e('0x44')](_0x339fb6[_0x993e('0x37')],function(_0x1b6620){var _0x3c6457={};_0x3c6457[_0x1b6620]={'$like':'%'+_0xf06b15['query'][_0x993e('0x43')]+'%'};return _0x3c6457;})});}_0x339fb6=_[_0x993e('0x42')]({},_0x339fb6,_0xf06b15[_0x993e('0x45')]);var _0x29d09f={'where':_0x339fb6[_0x993e('0x3d')]};return db[_0x993e('0x2f')]['count'](_0x29d09f)['then'](function(_0x189a3b){_0x14424a[_0x993e('0x46')]=_0x189a3b;if(_0xf06b15['query']['includeAll']){_0x339fb6[_0x993e('0x47')]=[{'all':!![]}];}return db[_0x993e('0x2f')][_0x993e('0x48')](_0x339fb6);})[_0x993e('0x1a')](function(_0x1e6c4f){_0x14424a[_0x993e('0x49')]=_0x1e6c4f;return _0x14424a;})['then'](respondWithFilteredResult(_0x3fd06e,_0x339fb6))[_0x993e('0x4a')](handleError(_0x3fd06e,null));};exports['show']=function(_0xb8629f,_0x1f7425){var _0x28cf3b={'raw':![],'where':{'id':_0xb8629f[_0x993e('0x4b')]['id']}},_0x402e37={};_0x402e37[_0x993e('0x31')]=_[_0x993e('0x32')](db[_0x993e('0x2f')]['rawAttributes']);_0x402e37[_0x993e('0x33')]=_[_0x993e('0x32')](_0xb8629f[_0x993e('0x33')]);_0x402e37['filters']=_[_0x993e('0x36')](_0x402e37['model'],_0x402e37[_0x993e('0x33')]);_0x28cf3b[_0x993e('0x37')]=_['intersection'](_0x402e37[_0x993e('0x31')],qs[_0x993e('0x38')](_0xb8629f['query'][_0x993e('0x38')]));_0x28cf3b[_0x993e('0x37')]=_0x28cf3b[_0x993e('0x37')][_0x993e('0x39')]?_0x28cf3b[_0x993e('0x37')]:_0x402e37['model'];if(_0xb8629f['query']['includeAll']){_0x28cf3b[_0x993e('0x47')]=[{'all':!![]}];}_0x28cf3b=_[_0x993e('0x42')]({},_0x28cf3b,_0xb8629f[_0x993e('0x45')]);return db[_0x993e('0x2f')][_0x993e('0x4c')](_0x28cf3b)[_0x993e('0x1a')](handleEntityNotFound(_0x1f7425,null))['then'](respondWithResult(_0x1f7425,null))[_0x993e('0x4a')](handleError(_0x1f7425,null));};exports[_0x993e('0x4d')]=function(_0x15c8ed,_0x5224a7){return db[_0x993e('0x2f')]['create'](_0x15c8ed['body'],{})[_0x993e('0x1a')](respondWithResult(_0x5224a7,0xc9))[_0x993e('0x4a')](handleError(_0x5224a7,null));};exports['update']=function(_0x208e25,_0x4f9f58){if(_0x208e25[_0x993e('0x4e')]['id']){delete _0x208e25[_0x993e('0x4e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x208e25[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x4f9f58,null))[_0x993e('0x1a')](saveUpdates(_0x208e25[_0x993e('0x4e')],null))[_0x993e('0x1a')](respondWithResult(_0x4f9f58,null))[_0x993e('0x4a')](handleError(_0x4f9f58,null));};exports['destroy']=function(_0x23c2e2,_0x292e39){return db['OpenchannelAccount'][_0x993e('0x4c')]({'where':{'id':_0x23c2e2[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x292e39,null))['then'](removeEntity(_0x292e39,null))[_0x993e('0x4a')](handleError(_0x292e39,null));};exports[_0x993e('0x4f')]=function(_0x1425a2,_0x5049e9){return db[_0x993e('0x2f')][_0x993e('0x4f')]()[_0x993e('0x1a')](respondWithResult(_0x5049e9,null))['catch'](handleError(_0x5049e9,null));};exports['addDisposition']=function(_0x53c68a,_0x2534ca,_0x98d16c){if(_0x53c68a[_0x993e('0x4e')]['id']){delete _0x53c68a[_0x993e('0x4e')]['id'];}return db[_0x993e('0x2f')]['find']({'where':{'id':_0x53c68a[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x2534ca,null))[_0x993e('0x1a')](function(_0x522cb3){if(_0x522cb3){_0x53c68a[_0x993e('0x4e')][_0x993e('0x50')]=_0x522cb3['id'];return db[_0x993e('0x51')][_0x993e('0x4d')](_0x53c68a['body']);}})[_0x993e('0x1a')](respondWithResult(_0x2534ca,null))[_0x993e('0x4a')](handleError(_0x2534ca,null));};exports['getDispositions']=function(_0x53c1b5,_0x17c7f7,_0xe9d25c){var _0x213f06={'raw':![],'where':{}};var _0x424501={};var _0x22b434={'count':0x0,'rows':[]};return db[_0x993e('0x2f')][_0x993e('0x52')]({'where':{'id':_0x53c1b5[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x17c7f7,null))[_0x993e('0x1a')](function(_0x300a93){if(_0x300a93){_0x424501[_0x993e('0x31')]=_[_0x993e('0x32')](db[_0x993e('0x51')][_0x993e('0x30')]);_0x424501[_0x993e('0x33')]=_['keys'](_0x53c1b5[_0x993e('0x33')]);_0x424501[_0x993e('0x3f')]=_['intersection'](_0x424501[_0x993e('0x31')],_0x424501['query']);_0x213f06[_0x993e('0x37')]=_[_0x993e('0x36')](_0x424501[_0x993e('0x31')],qs['fields'](_0x53c1b5[_0x993e('0x33')]['fields']));_0x213f06['attributes']=_0x213f06[_0x993e('0x37')][_0x993e('0x39')]?_0x213f06[_0x993e('0x37')]:_0x424501[_0x993e('0x31')];if(!_0x53c1b5[_0x993e('0x33')]['hasOwnProperty'](_0x993e('0x3b'))){_0x213f06[_0x993e('0x28')]=qs[_0x993e('0x28')](_0x53c1b5['query'][_0x993e('0x28')]);_0x213f06['offset']=qs[_0x993e('0x27')](_0x53c1b5[_0x993e('0x33')][_0x993e('0x27')]);}_0x213f06['order']=qs[_0x993e('0x3c')](_0x53c1b5[_0x993e('0x33')][_0x993e('0x3c')]);_0x213f06[_0x993e('0x3d')]=qs[_0x993e('0x3f')](_[_0x993e('0x3e')](_0x53c1b5[_0x993e('0x33')],_0x424501[_0x993e('0x3f')]));_0x213f06[_0x993e('0x3d')][_0x993e('0x53')]=_0x300a93['id'];if(_0x53c1b5['query'][_0x993e('0x43')]){_0x213f06[_0x993e('0x3d')]=_[_0x993e('0x42')](_0x213f06[_0x993e('0x3d')],{'$or':_[_0x993e('0x44')](_0x213f06[_0x993e('0x37')],function(_0x282c53){var _0x19fb38={};_0x19fb38[_0x282c53]={'$like':'%'+_0x53c1b5['query']['filter']+'%'};return _0x19fb38;})});}_0x213f06=_[_0x993e('0x42')]({},_0x213f06,_0x53c1b5['options']);return db[_0x993e('0x51')][_0x993e('0x46')]({'where':_0x213f06[_0x993e('0x3d')]})['then'](function(_0x2bf739){_0x22b434['count']=_0x2bf739;if(_0x53c1b5[_0x993e('0x33')][_0x993e('0x54')]){_0x213f06[_0x993e('0x47')]=[{'all':!![]}];}return db[_0x993e('0x51')][_0x993e('0x48')](_0x213f06);})[_0x993e('0x1a')](function(_0x1b57b1){_0x22b434[_0x993e('0x49')]=_0x1b57b1;return _0x22b434;});}})['then'](respondWithFilteredResult(_0x17c7f7,_0x213f06))['catch'](handleError(_0x17c7f7,null));};exports[_0x993e('0x55')]=function(_0x5a70ff,_0x2fb182,_0x1f998d){var _0xcbaa98;return db[_0x993e('0x2f')][_0x993e('0x4c')]({'where':{'id':_0x5a70ff[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x2fb182,null))[_0x993e('0x1a')](function(_0x28c320){if(_0x28c320){return _0x28c320[_0x993e('0x55')](_0x5a70ff['query'][_0x993e('0x56')]);}})[_0x993e('0x1a')](respondWithStatusCode(_0x2fb182,null))['catch'](handleError(_0x2fb182,null));};exports[_0x993e('0x57')]=function(_0x431931,_0x404e39,_0xa143b){if(_0x431931[_0x993e('0x4e')]['id']){delete _0x431931[_0x993e('0x4e')]['id'];}return db[_0x993e('0x2f')][_0x993e('0x4c')]({'where':{'id':_0x431931[_0x993e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x404e39,null))[_0x993e('0x1a')](function(_0x1b9add){if(_0x1b9add){_0x431931[_0x993e('0x4e')][_0x993e('0x53')]=_0x1b9add['id'];return db['CannedAnswer']['create'](_0x431931[_0x993e('0x4e')]);}})['then'](respondWithResult(_0x404e39,null))[_0x993e('0x4a')](handleError(_0x404e39,null));};exports[_0x993e('0x58')]=function(_0x3fc725,_0x2a24aa,_0x46e47a){var _0x25ac79={'raw':![],'where':{}};var _0xf4e01f={};var _0x22dd6b={'count':0x0,'rows':[]};return db[_0x993e('0x2f')][_0x993e('0x52')]({'where':{'id':_0x3fc725['params']['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x2a24aa,null))[_0x993e('0x1a')](function(_0x3abd3a){if(_0x3abd3a){_0xf4e01f[_0x993e('0x31')]=_[_0x993e('0x32')](db[_0x993e('0x59')][_0x993e('0x30')]);_0xf4e01f['query']=_['keys'](_0x3fc725[_0x993e('0x33')]);_0xf4e01f[_0x993e('0x3f')]=_[_0x993e('0x36')](_0xf4e01f[_0x993e('0x31')],_0xf4e01f[_0x993e('0x33')]);_0x25ac79['attributes']=_['intersection'](_0xf4e01f['model'],qs[_0x993e('0x38')](_0x3fc725[_0x993e('0x33')][_0x993e('0x38')]));_0x25ac79[_0x993e('0x37')]=_0x25ac79[_0x993e('0x37')]['length']?_0x25ac79[_0x993e('0x37')]:_0xf4e01f[_0x993e('0x31')];if(!_0x3fc725[_0x993e('0x33')]['hasOwnProperty'](_0x993e('0x3b'))){_0x25ac79[_0x993e('0x28')]=qs[_0x993e('0x28')](_0x3fc725[_0x993e('0x33')][_0x993e('0x28')]);_0x25ac79[_0x993e('0x27')]=qs['offset'](_0x3fc725[_0x993e('0x33')]['offset']);}_0x25ac79['order']=qs['sort'](_0x3fc725['query'][_0x993e('0x3c')]);_0x25ac79[_0x993e('0x3d')]=qs[_0x993e('0x3f')](_[_0x993e('0x3e')](_0x3fc725[_0x993e('0x33')],_0xf4e01f[_0x993e('0x3f')]));_0x25ac79[_0x993e('0x3d')][_0x993e('0x53')]=_0x3abd3a['id'];if(_0x3fc725[_0x993e('0x33')]['filter']){_0x25ac79[_0x993e('0x3d')]=_['merge'](_0x25ac79[_0x993e('0x3d')],{'$or':_[_0x993e('0x44')](_0x25ac79[_0x993e('0x37')],function(_0x65c6f0){var _0x425358={};_0x425358[_0x65c6f0]={'$like':'%'+_0x3fc725[_0x993e('0x33')][_0x993e('0x43')]+'%'};return _0x425358;})});}_0x25ac79=_['merge']({},_0x25ac79,_0x3fc725[_0x993e('0x45')]);return db[_0x993e('0x59')][_0x993e('0x46')]({'where':_0x25ac79['where']})[_0x993e('0x1a')](function(_0x23d82e){_0x22dd6b[_0x993e('0x46')]=_0x23d82e;if(_0x3fc725['query'][_0x993e('0x54')]){_0x25ac79[_0x993e('0x47')]=[{'all':!![]}];}return db[_0x993e('0x59')][_0x993e('0x48')](_0x25ac79);})[_0x993e('0x1a')](function(_0x20ca03){_0x22dd6b[_0x993e('0x49')]=_0x20ca03;return _0x22dd6b;});}})[_0x993e('0x1a')](respondWithFilteredResult(_0x2a24aa,_0x25ac79))['catch'](handleError(_0x2a24aa,null));};exports[_0x993e('0x5a')]=function(_0x561589,_0x219b58,_0xc2ecae){var _0x4d6d94;return db['OpenchannelAccount']['find']({'where':{'id':_0x561589[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x219b58,null))[_0x993e('0x1a')](function(_0x4e1fcf){if(_0x4e1fcf){return _0x4e1fcf[_0x993e('0x5a')](_0x561589[_0x993e('0x33')][_0x993e('0x56')]);}})[_0x993e('0x1a')](respondWithStatusCode(_0x219b58,null))['catch'](handleError(_0x219b58,null));};exports[_0x993e('0x5b')]=function(_0x4e276c,_0x40dfde,_0x550f26){var _0x5cf119={'body':_0x4e276c[_0x993e('0x4e')],'channel':_0x993e('0x5c')};var _0x43c538=[];var _0x3526f1=[];var _0x5a0444={};var _0x5897ce=![];return db['CmContact'][_0x993e('0x4f')]()['then'](function(_0x3bce82){if(!_0x3bce82){throw new db[(_0x993e('0x5d'))][(_0x993e('0x5e'))](_0x993e('0x5f'));}_0x43c538=_[_0x993e('0x60')](_['keys'](_0x3bce82),[_0x993e('0x61'),_0x993e('0x62')]);_0x3526f1=_['difference'](_[_0x993e('0x32')](_0x3bce82),['createdAt',_0x993e('0x62'),_0x993e('0x63'),_0x993e('0x64')]);if(_0x4e276c[_0x993e('0x4e')]['id']){delete _0x4e276c[_0x993e('0x4e')]['id'];}if(_[_0x993e('0x65')](_0x4e276c[_0x993e('0x4e')][_0x993e('0x66')])){throw new db[(_0x993e('0x5d'))]['ValidationError'](_0x993e('0x67'));}if(_['isNil'](_0x4e276c[_0x993e('0x4e')][_0x993e('0x4e')])||_0x4e276c['body']['body']===''){throw new db[(_0x993e('0x5d'))][(_0x993e('0x5e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x993e('0x65')](_0x4e276c[_0x993e('0x4e')][_0x993e('0x68')])){throw new db[(_0x993e('0x5d'))]['ValidationError'](_0x993e('0x69')+_0x3526f1);}if(!_[_0x993e('0x6a')](_0x3526f1,_0x4e276c[_0x993e('0x4e')][_0x993e('0x68')])){throw new db[(_0x993e('0x5d'))]['ValidationError'](_0x993e('0x6b')+_0x3526f1);}_0x5a0444[_0x4e276c[_0x993e('0x4e')][_0x993e('0x68')]]=_0x4e276c[_0x993e('0x4e')][_0x993e('0x66')];})[_0x993e('0x1a')](function(){return db[_0x993e('0x2f')]['find']({'where':{'id':_0x4e276c[_0x993e('0x4b')]['id']},'include':[{'model':db['CmList'],'as':_0x993e('0x6c'),'include':[{'model':db[_0x993e('0x6d')],'as':'Contacts','where':_0x5a0444,'limit':0x1,'order':[[_0x993e('0x62'),_0x993e('0x6e')]]}]},{'model':db['OpenchannelApplication'],'as':_0x993e('0x6f')}]});})[_0x993e('0x1a')](handleEntityNotFound(_0x40dfde,null))['then'](function(_0x19d402){if(_0x19d402&&_0x19d402[_0x993e('0x6c')]){_0x5cf119[_0x993e('0x70')]=_0x19d402;_0x5cf119[_0x993e('0x71')]=_0x19d402['Applications'];_0x5cf119[_0x993e('0x72')]=_0x19d402['List'];_0x5cf119[_0x993e('0x71')]=_['orderBy'](_0x5cf119[_0x993e('0x71')],[_0x993e('0x73')],[_0x993e('0x74')]);if(_0x5cf119['account']['Applications']){delete _0x5cf119[_0x993e('0x70')][_0x993e('0x6f')];}if(_0x5cf119[_0x993e('0x70')][_0x993e('0x6c')]&&_0x5cf119['account'][_0x993e('0x6c')]['Contacts'][_0x993e('0x39')]){return _0x5cf119[_0x993e('0x70')][_0x993e('0x6c')]['Contacts'][0x0];}var _0x245c62=_[_0x993e('0x75')](_0x4e276c[_0x993e('0x4e')],{'firstName':_0x4e276c[_0x993e('0x4e')][_0x993e('0x66')],'ListId':_0x19d402[_0x993e('0x64')]});_0x245c62[_0x4e276c[_0x993e('0x4e')][_0x993e('0x68')]]=_0x4e276c[_0x993e('0x4e')]['from'];return db['CmContact']['create'](_0x245c62,{'fields':_0x43c538,'raw':!![]});}})[_0x993e('0x1a')](handleEntityNotFound(_0x40dfde,null))['then'](function(_0x1d855d){_0x5cf119[_0x993e('0x76')]=_0x1d855d;if(_0x1d855d){var _0x3e3cfd={'ContactId':_0x1d855d['id'],'OpenchannelAccountId':_0x4e276c[_0x993e('0x4b')]['id'],'from':(_0x1d855d['firstName']||'')+'\x20'+(_0x1d855d['lastName']||'')};var _0x123dcd={'OpenchannelAccountId':_0x4e276c['params']['id'],'closed':![]};if(_0x4e276c[_0x993e('0x4e')][_0x993e('0x77')]){_0x123dcd[_0x993e('0x77')]=_0x4e276c[_0x993e('0x4e')]['threadId'];return db[_0x993e('0x78')]['find']({'where':_0x123dcd})['then'](function(_0x242374){if(_0x242374){return[_0x242374,![]];}_0x3e3cfd[_0x993e('0x77')]=_0x4e276c[_0x993e('0x4e')][_0x993e('0x77')];_0x3e3cfd[_0x993e('0x79')]=_0x4e276c[_0x993e('0x4e')][_0x993e('0x79')];return db[_0x993e('0x78')][_0x993e('0x4d')](_0x3e3cfd)[_0x993e('0x1a')](function(_0x3ecbfd){return[_0x3ecbfd,!![]];});});}else{_0x123dcd[_0x993e('0x77')]=null;}_0x123dcd['ContactId']=_0x1d855d['id'];return db[_0x993e('0x78')][_0x993e('0x4c')]({'where':_0x123dcd})[_0x993e('0x1a')](function(_0x37c1c6){if(_0x37c1c6){return[_0x37c1c6,![]];}return db[_0x993e('0x78')][_0x993e('0x4d')](_0x3e3cfd)[_0x993e('0x1a')](function(_0x5303c9){return[_0x5303c9,!![]];});});}})[_0x993e('0x7a')](function(_0x58f129,_0x5d5dc8){if(_0x58f129){_0x5897ce=_0x5d5dc8;if(!_0x5d5dc8){return _0x58f129[_0x993e('0x2b')]({'from':(_0x5cf119[_0x993e('0x76')][_0x993e('0x7b')]||'')+'\x20'+(_0x5cf119['contact'][_0x993e('0x7c')]||'')});}else{return _0x58f129;}}})[_0x993e('0x1a')](function(_0x1d8fec){_0x5cf119[_0x993e('0x7d')]=_0x1d8fec[_0x993e('0x7e')]({'plain':!![]});_0x5cf119[_0x993e('0x7d')][_0x993e('0x7f')]=_0x5897ce;if(_0x5cf119['interaction'][_0x993e('0x7f')]){if(_0x5cf119[_0x993e('0x70')]['autoclose']){_0x5cf119['applications'][_0x993e('0x80')]({'id':0x0,'priority':_0x5cf119[_0x993e('0x71')][_0x993e('0x39')]+0x1,'app':_0x993e('0x81'),'appdata':_0x993e('0x82'),'interval':'*,*,*,*'});}}return db[_0x993e('0x83')][_0x993e('0x4d')]({'body':_0x4e276c['body'][_0x993e('0x4e')],'OpenchannelAccountId':_0x4e276c['params']['id'],'OpenchannelInteractionId':_0x1d8fec['id'],'direction':'in','ContactId':_0x5cf119[_0x993e('0x76')]['id'],'AttachmentId':_0x4e276c[_0x993e('0x4e')]['AttachmentId']});})[_0x993e('0x1a')](function(_0x5ee2e0){_0x5cf119[_0x993e('0x22')]=_0x5ee2e0;if(_0x5cf119[_0x993e('0x7d')][_0x993e('0x84')]){return db['User']['find']({'attributes':['id',_0x993e('0x2c')],'where':{'id':_0x5cf119[_0x993e('0x7d')][_0x993e('0x84')]}})[_0x993e('0x1a')](function(_0x424bda){if(_0x424bda){_0x5cf119[_0x993e('0x71')][_0x993e('0x85')]({'id':0x0,'priority':0x0,'app':_0x993e('0x86'),'appdata':_0x424bda[_0x993e('0x2c')]+','+(_0x5cf119['account'][_0x993e('0x87')]||0xa),'interval':'*,*,*,*'});_0x5cf119[_0x993e('0x88')]=![];}return respondWithRpcPromise('Start',_0x993e('0x89'),_0x5cf119);});}return respondWithRpcPromise('Start',_0x993e('0x89'),_0x5cf119);})[_0x993e('0x1a')](function(_0x10b988){respondWithRpcPromise(_0x993e('0x8a'),_0x993e('0x8a'),{'event':_0x993e('0x5b'),'message':_0x10b988},client9002);return _0x10b988;})['then'](respondWithResult(_0x40dfde,null))['catch'](handleError(_0x40dfde,null));};exports['addApplications']=function(_0x15fa62,_0x445530,_0x46d6e4){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x15fa62[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x445530,null))[_0x993e('0x1a')](function(_0x44ca9b){if(_0x44ca9b){return db['sequelize'][_0x993e('0x8b')](function(_0x536c36){return db[_0x993e('0x8c')][_0x993e('0x8d')]({'where':{'OpenchannelAccountId':_0x15fa62[_0x993e('0x4b')]['id']},'transaction':_0x536c36})[_0x993e('0x1a')](function(_0x35620a){var _0x5ddc51=_['map'](_0x15fa62[_0x993e('0x4e')],function(_0x56a861){_0x56a861[_0x993e('0x53')]=_0x15fa62[_0x993e('0x4b')]['id'];return _0x56a861;});return db[_0x993e('0x8c')][_0x993e('0x8e')](_0x5ddc51,{'transaction':_0x536c36});});})[_0x993e('0x1a')](function(){return db[_0x993e('0x8c')][_0x993e('0x8f')]({'where':{'OpenchannelAccountId':_0x15fa62[_0x993e('0x4b')]['id']},'order':_0x993e('0x73')});});}})[_0x993e('0x1a')](respondWithResult(_0x445530,null))[_0x993e('0x4a')](handleError(_0x445530,null));};exports[_0x993e('0x90')]=function(_0x5da16d,_0x57d3c4,_0x55665a){var _0x498571={};var _0x3e8b47={};var _0x39d08a;var _0x54632c;return db['OpenchannelAccount'][_0x993e('0x52')]({'where':{'id':_0x5da16d['params']['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x57d3c4,null))['then'](function(_0x33bcec){if(_0x33bcec){_0x39d08a=_0x33bcec;_0x3e8b47[_0x993e('0x31')]=_['keys'](db[_0x993e('0x8c')][_0x993e('0x30')]);_0x3e8b47['query']=_['keys'](_0x5da16d[_0x993e('0x33')]);_0x3e8b47[_0x993e('0x3f')]=_[_0x993e('0x36')](_0x3e8b47[_0x993e('0x31')],_0x3e8b47[_0x993e('0x33')]);_0x498571['attributes']=_['intersection'](_0x3e8b47['model'],qs[_0x993e('0x38')](_0x5da16d[_0x993e('0x33')][_0x993e('0x38')]));_0x498571[_0x993e('0x37')]=_0x498571['attributes'][_0x993e('0x39')]?_0x498571[_0x993e('0x37')]:_0x3e8b47['model'];_0x498571[_0x993e('0x91')]=qs[_0x993e('0x3c')](_0x5da16d[_0x993e('0x33')][_0x993e('0x3c')]);_0x498571['where']=qs[_0x993e('0x3f')](_[_0x993e('0x3e')](_0x5da16d[_0x993e('0x33')],_0x3e8b47[_0x993e('0x3f')]));if(_0x5da16d[_0x993e('0x33')][_0x993e('0x43')]){_0x498571[_0x993e('0x3d')]=_[_0x993e('0x42')](_0x498571[_0x993e('0x3d')],{'$or':_['map'](_0x498571[_0x993e('0x37')],function(_0x32642f){var _0x2ee472={};_0x2ee472[_0x32642f]={'$like':'%'+_0x5da16d[_0x993e('0x33')]['filter']+'%'};return _0x2ee472;})});}_0x498571=_[_0x993e('0x42')]({},_0x498571,_0x5da16d['options']);return _0x39d08a['getApplications'](_0x498571);}})[_0x993e('0x1a')](function(_0x356de2){if(_0x356de2){_0x54632c=_0x356de2[_0x993e('0x39')];if(!_0x5da16d[_0x993e('0x33')][_0x993e('0x3a')](_0x993e('0x3b'))){_0x498571['limit']=qs[_0x993e('0x28')](_0x5da16d['query']['limit']);_0x498571[_0x993e('0x27')]=qs['offset'](_0x5da16d[_0x993e('0x33')]['offset']);}return _0x39d08a['getApplications'](_0x498571);}})[_0x993e('0x1a')](function(_0x4a5477){if(_0x4a5477){return _0x4a5477?{'count':_0x54632c,'rows':_0x4a5477}:null;}})[_0x993e('0x1a')](respondWithResult(_0x57d3c4,null))[_0x993e('0x4a')](handleError(_0x57d3c4,null));};exports['getInteractions']=function(_0x410f50,_0x4007f7,_0x4943bb){var _0x537e2f={'raw':![],'where':{}};var _0x92c84c={};var _0x485d0c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x993e('0x52')]({'where':{'id':_0x410f50[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x4007f7,null))['then'](function(_0x2e067e){if(_0x2e067e){_0x92c84c[_0x993e('0x31')]=_['keys'](db[_0x993e('0x78')][_0x993e('0x30')]);_0x92c84c[_0x993e('0x33')]=_[_0x993e('0x32')](_0x410f50[_0x993e('0x33')]);_0x92c84c['filters']=_['intersection'](_0x92c84c['model'],_0x92c84c[_0x993e('0x33')]);_0x537e2f[_0x993e('0x37')]=_[_0x993e('0x36')](_0x92c84c['model'],qs[_0x993e('0x38')](_0x410f50[_0x993e('0x33')][_0x993e('0x38')]));_0x537e2f[_0x993e('0x37')]=_0x537e2f[_0x993e('0x37')][_0x993e('0x39')]?_0x537e2f[_0x993e('0x37')]:_0x92c84c[_0x993e('0x31')];if(!_0x410f50[_0x993e('0x33')]['hasOwnProperty'](_0x993e('0x3b'))){_0x537e2f[_0x993e('0x28')]=qs[_0x993e('0x28')](_0x410f50['query']['limit']);_0x537e2f[_0x993e('0x27')]=qs[_0x993e('0x27')](_0x410f50['query'][_0x993e('0x27')]);}_0x537e2f[_0x993e('0x91')]=qs['sort'](_0x410f50[_0x993e('0x33')][_0x993e('0x3c')]);_0x537e2f[_0x993e('0x3d')]=qs['filters'](_[_0x993e('0x3e')](_0x410f50[_0x993e('0x33')],_0x92c84c[_0x993e('0x3f')]));_0x537e2f['where'][_0x993e('0x53')]=_0x2e067e['id'];if(_0x410f50[_0x993e('0x33')][_0x993e('0x43')]){_0x537e2f[_0x993e('0x3d')]=_['merge'](_0x537e2f[_0x993e('0x3d')],{'$or':_['map'](_0x537e2f[_0x993e('0x37')],function(_0x3bbe18){var _0x34b606={};_0x34b606[_0x3bbe18]={'$like':'%'+_0x410f50[_0x993e('0x33')][_0x993e('0x43')]+'%'};return _0x34b606;})});}_0x537e2f=_[_0x993e('0x42')]({},_0x537e2f,_0x410f50[_0x993e('0x45')]);return db[_0x993e('0x78')][_0x993e('0x46')]({'where':_0x537e2f[_0x993e('0x3d')]})[_0x993e('0x1a')](function(_0x95ad02){_0x485d0c[_0x993e('0x46')]=_0x95ad02;if(_0x410f50[_0x993e('0x33')]['includeAll']){_0x537e2f[_0x993e('0x47')]=[{'model':db[_0x993e('0x6d')],'as':_0x993e('0x92'),'required':![]},{'model':db[_0x993e('0x93')],'as':_0x993e('0x94'),'attributes':[_0x993e('0x2c'),_0x993e('0x95'),_0x993e('0x96')],'required':![]},{'model':db[_0x993e('0x97')],'as':_0x993e('0x98'),'attributes':['id',_0x993e('0x2c'),_0x993e('0x99')],'where':_0x410f50[_0x993e('0x33')]['tag']?{'id':_0x410f50[_0x993e('0x33')][_0x993e('0x9a')]}:undefined,'required':_0x410f50[_0x993e('0x33')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x993e('0x48')](_0x537e2f);})['then'](function(_0x420e36){_0x485d0c['rows']=_0x420e36;return _0x485d0c;});}})[_0x993e('0x1a')](respondWithFilteredResult(_0x4007f7,_0x537e2f))[_0x993e('0x4a')](handleError(_0x4007f7,null));};exports[_0x993e('0x9b')]=function(_0x49edc7,_0x594989,_0xf63ed0){return db['OpenchannelAccount'][_0x993e('0x4c')]({'where':{'id':_0x49edc7[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x594989,null))[_0x993e('0x1a')](function(_0xd672d3){if(_0xd672d3){return _0xd672d3[_0x993e('0x9b')](_0x49edc7[_0x993e('0x4e')][_0x993e('0x56')],_[_0x993e('0x9c')](_0x49edc7['body'],[_0x993e('0x56'),'id'])||{})[_0x993e('0x7a')](function(_0x48e190){for(var _0xc0af00=0x0;_0xc0af00<_0x49edc7['body']['ids'][_0x993e('0x39')];_0xc0af00+=0x1){socket[_0x993e('0x9d')](_0x993e('0x9e'),{'UserId':_0x49edc7[_0x993e('0x4e')]['ids'][_0xc0af00],'OpenchannelAccountId':_0x49edc7[_0x993e('0x4b')]['id']});}return _0x48e190;});}})[_0x993e('0x1a')](respondWithResult(_0x594989,null))[_0x993e('0x4a')](handleError(_0x594989,null));};exports[_0x993e('0x9f')]=function(_0x5e31fd,_0x1cb2c1,_0x1ce494){var _0x27e46d;return db['OpenchannelAccount'][_0x993e('0x4c')]({'where':{'id':_0x5e31fd[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x1cb2c1,null))[_0x993e('0x1a')](function(_0x3f1cd3){if(_0x3f1cd3){return _0x3f1cd3['removeAgents'](_0x5e31fd['query'][_0x993e('0x56')])['then'](function(_0x54b554){if(_[_0x993e('0xa0')](_0x5e31fd[_0x993e('0x33')][_0x993e('0x56')])){for(var _0x443986=0x0;_0x443986<_0x5e31fd[_0x993e('0x33')][_0x993e('0x56')][_0x993e('0x39')];_0x443986+=0x1){socket[_0x993e('0x9d')]('userOpenchannelAccount:remove',{'UserId':_0x5e31fd[_0x993e('0x33')][_0x993e('0x56')][_0x443986],'OpenchannelAccountId':_0x5e31fd[_0x993e('0x4b')]['id']});}}else{socket['emit'](_0x993e('0xa1'),{'UserId':_0x5e31fd[_0x993e('0x33')][_0x993e('0x56')],'OpenchannelAccountId':_0x5e31fd[_0x993e('0x4b')]['id']});}});}})[_0x993e('0x1a')](respondWithStatusCode(_0x1cb2c1,null))[_0x993e('0x4a')](handleError(_0x1cb2c1,null));};exports[_0x993e('0xa2')]=function(_0x263562,_0x1591b6,_0x3913cd){var _0x422a3b={};var _0x59fcb0={};var _0x2c1c34;var _0x57b05b;return db[_0x993e('0x2f')][_0x993e('0x52')]({'where':{'id':_0x263562[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x1591b6,null))['then'](function(_0x99f730){if(_0x99f730){_0x2c1c34=_0x99f730;_0x59fcb0[_0x993e('0x31')]=_[_0x993e('0x32')](db[_0x993e('0x93')][_0x993e('0x30')]);_0x59fcb0['query']=_[_0x993e('0x32')](_0x263562[_0x993e('0x33')]);_0x59fcb0[_0x993e('0x3f')]=_[_0x993e('0x36')](_0x59fcb0[_0x993e('0x31')],_0x59fcb0['query']);_0x422a3b[_0x993e('0x37')]=_['intersection'](_0x59fcb0[_0x993e('0x31')],qs[_0x993e('0x38')](_0x263562[_0x993e('0x33')]['fields']));_0x422a3b[_0x993e('0x37')]=_0x422a3b['attributes'][_0x993e('0x39')]?_0x422a3b['attributes']:_0x59fcb0[_0x993e('0x31')];_0x422a3b[_0x993e('0x91')]=qs[_0x993e('0x3c')](_0x263562[_0x993e('0x33')][_0x993e('0x3c')]);_0x422a3b[_0x993e('0x3d')]=qs['filters'](_[_0x993e('0x3e')](_0x263562[_0x993e('0x33')],_0x59fcb0[_0x993e('0x3f')]));if(_0x263562[_0x993e('0x33')]['filter']){_0x422a3b[_0x993e('0x3d')]=_['merge'](_0x422a3b[_0x993e('0x3d')],{'$or':_[_0x993e('0x44')](_0x422a3b['attributes'],function(_0x4f3f5c){var _0x1059d6={};_0x1059d6[_0x4f3f5c]={'$like':'%'+_0x263562[_0x993e('0x33')][_0x993e('0x43')]+'%'};return _0x1059d6;})});}_0x422a3b=_[_0x993e('0x42')]({},_0x422a3b,_0x263562[_0x993e('0x45')]);return _0x2c1c34[_0x993e('0xa2')](_0x422a3b);}})[_0x993e('0x1a')](function(_0x5bd810){if(_0x5bd810){_0x57b05b=_0x5bd810[_0x993e('0x39')];if(!_0x263562[_0x993e('0x33')][_0x993e('0x3a')](_0x993e('0x3b'))){_0x422a3b[_0x993e('0x28')]=qs[_0x993e('0x28')](_0x263562[_0x993e('0x33')][_0x993e('0x28')]);_0x422a3b[_0x993e('0x27')]=qs[_0x993e('0x27')](_0x263562[_0x993e('0x33')][_0x993e('0x27')]);}return _0x2c1c34['getAgents'](_0x422a3b);}})[_0x993e('0x1a')](function(_0x41ae16){if(_0x41ae16){return _0x41ae16?{'count':_0x57b05b,'rows':_0x41ae16}:null;}})['then'](respondWithResult(_0x1591b6,null))['catch'](handleError(_0x1591b6,null));};exports[_0x993e('0x2d')]=function(_0x15b3b4,_0x1ef66f,_0x4680){var _0x340c02,_0x1458b6,_0x17dd7e;if(_[_0x993e('0x65')](_0x15b3b4[_0x993e('0x4e')][_0x993e('0x4e')])||_0x15b3b4[_0x993e('0x4e')][_0x993e('0x4e')]===''){throw new db[(_0x993e('0x5d'))]['ValidationError'](_0x993e('0xa3'));}if(_[_0x993e('0x65')](_0x15b3b4[_0x993e('0x4e')]['to'])){}_0x340c02=_0x15b3b4[_0x993e('0x4e')]['to'];return db[_0x993e('0x2f')][_0x993e('0x52')]({'where':{'id':_0x15b3b4[_0x993e('0x4b')]['id']}})[_0x993e('0x1a')](handleEntityNotFound(_0x1ef66f,null))[_0x993e('0x1a')](function(_0x2f4d08){if(_0x2f4d08){return db[_0x993e('0x2f')]['find']({'where':{'id':_0x2f4d08['id']},'include':[{'model':db[_0x993e('0xa4')],'as':_0x993e('0x6c'),'include':[{'model':db['CmContact'],'as':_0x993e('0xa5'),'where':{[_0x2f4d08[_0x993e('0x68')]]:_0x340c02},'limit':0x1,'order':[[_0x993e('0x62'),_0x993e('0x6e')]]}]}]})[_0x993e('0x1a')](handleEntityNotFound(_0x1ef66f,null))[_0x993e('0x1a')](function(_0x5789e9){if(_0x5789e9&&_0x5789e9['List']){_0x1458b6=_0x5789e9[_0x993e('0x7e')]({'plain':!![]});if(_0x1458b6[_0x993e('0x6c')]&&_0x1458b6[_0x993e('0x6c')][_0x993e('0xa5')][_0x993e('0x39')]){return _0x1458b6[_0x993e('0x6c')]['Contacts'][0x0];}return db[_0x993e('0x6d')]['create'](_[_0x993e('0x75')](_0x15b3b4[_0x993e('0x4e')],{'firstName':_0x340c02,[_0x5789e9['mapKey']]:_0x340c02,'phone':_0x340c02,'ListId':_0x1458b6[_0x993e('0x64')]}));}})[_0x993e('0x1a')](handleEntityNotFound(_0x1ef66f,null))[_0x993e('0x1a')](function(_0x23b6c7){if(_0x23b6c7){_0x17dd7e=_0x23b6c7;return db[_0x993e('0x78')][_0x993e('0x4c')]({'where':{'ContactId':_0x17dd7e['id'],'closed':![],'OpenchannelAccountId':_0x1458b6['id']}})[_0x993e('0x1a')](function(_0x9c6218){if(_0x9c6218){return[_0x9c6218,![]];}return db[_0x993e('0x78')][_0x993e('0x4d')]({'UserId':_0x15b3b4[_0x993e('0xa6')]['id'],'ContactId':_0x17dd7e['id'],'OpenchannelAccountId':_0x1458b6['id'],'lastMsgDirection':_0x993e('0xa7'),'Messages':[_[_0x993e('0x42')](_0x15b3b4[_0x993e('0x4e')],{'read':![],'body':_0x15b3b4[_0x993e('0x4e')]['body'],'OpenchannelAccountId':_0x1458b6['id'],'UserId':_0x15b3b4['user']['id'],'ContactId':_0x17dd7e['id']})]},{'include':[{'model':db[_0x993e('0x83')],'as':'Messages'}]})[_0x993e('0x1a')](function(_0x3bb3c9){return[_0x3bb3c9,!![]];});});}})[_0x993e('0x7a')](function(_0x94f59,_0x28ff19){if(_0x28ff19){return _0x94f59;}return db[_0x993e('0x83')][_0x993e('0x4d')](_[_0x993e('0x42')](_0x15b3b4[_0x993e('0x4e')],{'read':![],'body':_0x15b3b4['body'][_0x993e('0x4e')],'OpenchannelAccountId':_0x1458b6['id'],'OpenchannelInteractionId':_0x94f59['id'],'UserId':_0x15b3b4[_0x993e('0xa6')]['id'],'ContactId':_0x17dd7e['id']}))[_0x993e('0x1a')](function(_0x2be066){_0x94f59['dataValues'][_0x993e('0xa8')]=[];_0x94f59[_0x993e('0xa9')][_0x993e('0xa8')][_0x993e('0x80')](_0x2be066['dataValues']);return _0x94f59;});});}})['then'](respondWithResult(_0x1ef66f,null))[_0x993e('0x4a')](handleError(_0x1ef66f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0a901cd..24da9fe 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 _0xbb86=['hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x328dc0,_0x3743c8){var _0x30868c=function(_0x5d3bbc){while(--_0x5d3bbc){_0x328dc0['push'](_0x328dc0['shift']());}};_0x30868c(++_0x3743c8);}(_0xbb86,0xbe));var _0x6bb8=function(_0x602739,_0x12fc9d){_0x602739=_0x602739-0x0;var _0x584ef7=_0xbb86[_0x602739];return _0x584ef7;};'use strict';var EventEmitter=require(_0x6bb8('0x0'));var OpenchannelAccount=require(_0x6bb8('0x1'))['db'][_0x6bb8('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6bb8('0x3')](0x0);var events={'afterCreate':_0x6bb8('0x4'),'afterUpdate':'update','afterDestroy':_0x6bb8('0x5')};function emitEvent(_0x14dc8a){return function(_0x3f46f0,_0x419964,_0x4c3df1){OpenchannelAccountEvents[_0x6bb8('0x6')](_0x14dc8a+':'+_0x3f46f0['id'],_0x3f46f0);OpenchannelAccountEvents[_0x6bb8('0x6')](_0x14dc8a,_0x3f46f0);_0x4c3df1(null);};}for(var e in events){if(events[_0x6bb8('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6bb8('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xafb8=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xc77c2,_0x40bcc3){var _0x24a680=function(_0x582408){while(--_0x582408){_0xc77c2['push'](_0xc77c2['shift']());}};_0x24a680(++_0x40bcc3);}(_0xafb8,0x1d0));var _0x8afb=function(_0x4e8640,_0x17666a){_0x4e8640=_0x4e8640-0x0;var _0x191d5c=_0xafb8[_0x4e8640];return _0x191d5c;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8afb('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8afb('0x1')](0x0);var events={'afterCreate':_0x8afb('0x2'),'afterUpdate':_0x8afb('0x3'),'afterDestroy':_0x8afb('0x4')};function emitEvent(_0x172073){return function(_0x536c02,_0x47655e,_0x4cb0fc){OpenchannelAccountEvents['emit'](_0x172073+':'+_0x536c02['id'],_0x536c02);OpenchannelAccountEvents[_0x8afb('0x5')](_0x172073,_0x536c02);_0x4cb0fc(null);};}for(var e in events){if(events[_0x8afb('0x6')](e)){var event=events[e];OpenchannelAccount[_0x8afb('0x7')](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 25ad5eb..999336b 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 _0xbaf0=['api','moment','bluebird','request-promise','exports','define','OpenchannelAccount','openchannel_accounts','util','../../config/logger'];(function(_0x531383,_0x1a1058){var _0x1f3e67=function(_0x351b26){while(--_0x351b26){_0x531383['push'](_0x531383['shift']());}};_0x1f3e67(++_0x1a1058);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var attributes=require('./openchannelAccount.attributes');module[_0x0baf('0x6')]=function(_0x1c383e,_0x2d3fa5){return _0x1c383e[_0x0baf('0x7')](_0x0baf('0x8'),attributes,{'tableName':_0x0baf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['api','moment','bluebird','request-promise','exports','define','OpenchannelAccount','openchannel_accounts','util','../../config/logger'];(function(_0xfc92c0,_0x49c707){var _0x3b3818=function(_0x4e33f7){while(--_0x4e33f7){_0xfc92c0['push'](_0xfc92c0['shift']());}};_0x3b3818(++_0x49c707);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var attributes=require('./openchannelAccount.attributes');module[_0x0baf('0x6')]=function(_0x1c383e,_0x2d3fa5){return _0x1c383e[_0x0baf('0x7')](_0x0baf('0x8'),attributes,{'tableName':_0x0baf('0x9'),'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 d47dc39..e05e37e 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 _0xbeea=['jayson/promise','client','http','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x300340,_0x5c458a){var _0x52eb82=function(_0x1ce1bc){while(--_0x1ce1bc){_0x300340['push'](_0x300340['shift']());}};_0x52eb82(++_0x5c458a);}(_0xbeea,0xb1));var _0xabee=function(_0x29cc22,_0x5db461){_0x29cc22=_0x29cc22-0x0;var _0x2c76a5=_0xbeea[_0x29cc22];return _0x2c76a5;};'use strict';var _=require(_0xabee('0x0'));var util=require('util');var moment=require(_0xabee('0x1'));var BPromise=require(_0xabee('0x2'));var rs=require(_0xabee('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xabee('0x4'));var logger=require('../../config/logger')(_0xabee('0x5'));var config=require(_0xabee('0x6'));var jayson=require(_0xabee('0x7'));var client=jayson[_0xabee('0x8')][_0xabee('0x9')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xabee('0xa'))[_0xabee('0xb')](socket);function respondWithRpcPromise(_0x4a2999,_0x42d01c,_0x507deb){return new BPromise(function(_0x14a78d,_0x11da39){return client[_0xabee('0xc')](_0x4a2999,_0x507deb)[_0xabee('0xd')](function(_0x33a862){logger[_0xabee('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x42d01c,_0xabee('0xf'));logger[_0xabee('0x10')](_0xabee('0x11'),_0x42d01c,'request\x20sent',JSON[_0xabee('0x12')](_0x33a862));if(_0x33a862[_0xabee('0x13')]){if(_0x33a862[_0xabee('0x13')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x42d01c,_0x33a862['error']['message']);return _0x11da39(_0x33a862[_0xabee('0x13')][_0xabee('0x14')]);}logger[_0xabee('0x13')](_0xabee('0x15'),_0x42d01c,_0x33a862[_0xabee('0x13')]['message']);return _0x14a78d(_0x33a862[_0xabee('0x13')][_0xabee('0x14')]);}else{logger[_0xabee('0xe')](_0xabee('0x15'),_0x42d01c,_0xabee('0xf'));_0x14a78d(_0x33a862[_0xabee('0x16')][_0xabee('0x14')]);}})['catch'](function(_0x33e3c0){logger[_0xabee('0x13')](_0xabee('0x15'),_0x42d01c,_0x33e3c0);_0x11da39(_0x33e3c0);});});} \ No newline at end of file +var _0xa7e6=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./openchannelAccount.socket','register','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x19121b,_0x4cc56a){var _0x4485a0=function(_0x4be283){while(--_0x4be283){_0x19121b['push'](_0x19121b['shift']());}};_0x4485a0(++_0x4cc56a);}(_0xa7e6,0x74));var _0x6a7e=function(_0x2717f2,_0x2cc21e){_0x2717f2=_0x2717f2-0x0;var _0x47cbee=_0xa7e6[_0x2717f2];return _0x47cbee;};'use strict';var _=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var moment=require(_0x6a7e('0x2'));var BPromise=require(_0x6a7e('0x3'));var rs=require(_0x6a7e('0x4'));var fs=require('fs');var db=require(_0x6a7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a7e('0x6'))(_0x6a7e('0x7'));var config=require(_0x6a7e('0x8'));var jayson=require(_0x6a7e('0x9'));var client=jayson[_0x6a7e('0xa')]['http']({'port':0x232a});var socket=require(_0x6a7e('0xb'))({'host':_0x6a7e('0xc'),'port':0x18eb});require(_0x6a7e('0xd'))[_0x6a7e('0xe')](socket);function respondWithRpcPromise(_0x45e92e,_0x3f3f2f,_0x23b5d6){return new BPromise(function(_0x403962,_0xdaa33d){return client['request'](_0x45e92e,_0x23b5d6)['then'](function(_0x557627){logger['info'](_0x6a7e('0xf'),_0x3f3f2f,_0x6a7e('0x10'));logger[_0x6a7e('0x11')](_0x6a7e('0x12'),_0x3f3f2f,_0x6a7e('0x10'),JSON['stringify'](_0x557627));if(_0x557627[_0x6a7e('0x13')]){if(_0x557627[_0x6a7e('0x13')]['code']===0x1f4){logger['error'](_0x6a7e('0xf'),_0x3f3f2f,_0x557627[_0x6a7e('0x13')][_0x6a7e('0x14')]);return _0xdaa33d(_0x557627[_0x6a7e('0x13')]['message']);}logger[_0x6a7e('0x13')](_0x6a7e('0xf'),_0x3f3f2f,_0x557627[_0x6a7e('0x13')][_0x6a7e('0x14')]);return _0x403962(_0x557627[_0x6a7e('0x13')]['message']);}else{logger[_0x6a7e('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x3f3f2f,'request\x20sent');_0x403962(_0x557627[_0x6a7e('0x16')]['message']);}})[_0x6a7e('0x17')](function(_0x195761){logger[_0x6a7e('0x13')](_0x6a7e('0xf'),_0x3f3f2f,_0x195761);_0xdaa33d(_0x195761);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ec317ba..08fc1df 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 _0x1343=['emit','removeListener','register','length','openchannelAccount:','save','remove','update'];(function(_0x2fdc1a,_0x2a0a5a){var _0x51fb16=function(_0x26fc5f){while(--_0x26fc5f){_0x2fdc1a['push'](_0x2fdc1a['shift']());}};_0x51fb16(++_0x2a0a5a);}(_0x1343,0x1a5));var _0x3134=function(_0x145eae,_0x2fc6a5){_0x145eae=_0x145eae-0x0;var _0x4c6a1f=_0x1343[_0x145eae];return _0x4c6a1f;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x3134('0x0'),_0x3134('0x1'),_0x3134('0x2')];function createListener(_0xabfb4e,_0x2ad675){return function(_0x43fae1){_0x2ad675[_0x3134('0x3')](_0xabfb4e,_0x43fae1);};}function removeListener(_0x545e15,_0x4c4843){return function(){OpenchannelAccountEvents[_0x3134('0x4')](_0x545e15,_0x4c4843);};}exports[_0x3134('0x5')]=function(_0x2dfa38){for(var _0x42d27b=0x0,_0x3c6bb2=events[_0x3134('0x6')];_0x42d27b<_0x3c6bb2;_0x42d27b++){var _0x5e3224=events[_0x42d27b];var _0x571145=createListener(_0x3134('0x7')+_0x5e3224,_0x2dfa38);OpenchannelAccountEvents['on'](_0x5e3224,_0x571145);}}; \ No newline at end of file +var _0xc6d2=['register','length','./openchannelAccount.events','save','remove','update','removeListener'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xc6d2,0x79));var _0x2c6d=function(_0x4810aa,_0xa66047){_0x4810aa=_0x4810aa-0x0;var _0x4c977a=_0xc6d2[_0x4810aa];return _0x4c977a;};'use strict';var OpenchannelAccountEvents=require(_0x2c6d('0x0'));var events=[_0x2c6d('0x1'),_0x2c6d('0x2'),_0x2c6d('0x3')];function createListener(_0x2289b2,_0xf9d438){return function(_0x5c344a){_0xf9d438['emit'](_0x2289b2,_0x5c344a);};}function removeListener(_0x383506,_0xa333ef){return function(){OpenchannelAccountEvents[_0x2c6d('0x4')](_0x383506,_0xa333ef);};}exports[_0x2c6d('0x5')]=function(_0x244108){for(var _0x945f18=0x0,_0x144c5f=events[_0x2c6d('0x6')];_0x945f18<_0x144c5f;_0x945f18++){var _0x429195=events[_0x945f18];var _0x482c11=createListener('openchannelAccount:'+_0x429195,_0x244108);OpenchannelAccountEvents['on'](_0x429195,_0x482c11);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d7a07b8..a7cab1a 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 _0xbdb7=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','/:id','create','update','delete','destroy','exports','multer','util'];(function(_0x3240d2,_0x4cbaa7){var _0x373f04=function(_0x238306){while(--_0x238306){_0x3240d2['push'](_0x3240d2['shift']());}};_0x373f04(++_0x4cbaa7);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xb4710a,_0x585188){_0xb4710a=_0xb4710a-0x0;var _0x602935=_0xbdb7[_0xb4710a];return _0x602935;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var express=require(_0x7bdb('0x3'));var router=express[_0x7bdb('0x4')]();var auth=require(_0x7bdb('0x5'));var interaction=require(_0x7bdb('0x6'));var config=require(_0x7bdb('0x7'));var controller=require(_0x7bdb('0x8'));router['get']('/',auth[_0x7bdb('0x9')](),controller['index']);router['get'](_0x7bdb('0xa'),auth[_0x7bdb('0x9')](),controller['show']);router['post']('/',auth[_0x7bdb('0x9')](),controller[_0x7bdb('0xb')]);router['put']('/:id',auth[_0x7bdb('0x9')](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xd')](_0x7bdb('0xa'),auth[_0x7bdb('0x9')](),controller[_0x7bdb('0xe')]);module[_0x7bdb('0xf')]=router; \ No newline at end of file +var _0xb43b=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x487b09,_0x349b11){var _0x28830b=function(_0x51705f){while(--_0x51705f){_0x487b09['push'](_0x487b09['shift']());}};_0x28830b(++_0x349b11);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4524b1,_0x1446ff){_0x4524b1=_0x4524b1-0x0;var _0x13fee0=_0xb43b[_0x4524b1];return _0x13fee0;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var express=require(_0xbb43('0x2'));var router=express[_0xbb43('0x3')]();var auth=require(_0xbb43('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbb43('0x5'));var controller=require(_0xbb43('0x6'));router[_0xbb43('0x7')]('/',auth[_0xbb43('0x8')](),controller['index']);router['get'](_0xbb43('0x9'),auth['isAuthenticated'](),controller[_0xbb43('0xa')]);router[_0xbb43('0xb')]('/',auth[_0xbb43('0x8')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')]('/:id',auth[_0xbb43('0x8')](),controller[_0xbb43('0xe')]);router['delete'](_0xbb43('0x9'),auth[_0xbb43('0x8')](),controller[_0xbb43('0xf')]);module[_0xbb43('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ad05ee9..69b1877 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 _0x0909=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0909,0x133));var _0x9090=function(_0x4858fc,_0x197c3c){_0x4858fc=_0x4858fc-0x0;var _0x5d593b=_0x0909[_0x4858fc];return _0x5d593b;};'use strict';var Sequelize=require(_0x9090('0x0'));module[_0x9090('0x1')]={'priority':{'type':Sequelize[_0x9090('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9090('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9090('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x9090('0x3')]},'interval':{'type':Sequelize[_0x9090('0x3')],'defaultValue':_0x9090('0x4')}}; \ No newline at end of file +var _0xd159=['INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x44b40c,_0x3cc2ac){var _0x49e38f=function(_0x4cf6ba){while(--_0x4cf6ba){_0x44b40c['push'](_0x44b40c['shift']());}};_0x49e38f(++_0x3cc2ac);}(_0xd159,0x17b));var _0x9d15=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd159[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x9d15('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9d15('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9d15('0x2')},'appdata':{'type':Sequelize[_0x9d15('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x9d15('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9d15('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 77e7c1a..5e99c7d 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 _0x4ae9=['status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','name','send','OpenchannelApplication','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../mysqldb'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x4ae9,0xf3));var _0x94ae=function(_0x5effcf,_0x47af59){_0x5effcf=_0x5effcf-0x0;var _0x4d123c=_0x4ae9[_0x5effcf];return _0x4d123c;};'use strict';var jsonpatch=require(_0x94ae('0x0'));var rp=require('request-promise');var moment=require(_0x94ae('0x1'));var BPromise=require(_0x94ae('0x2'));var Mustache=require('mustache');var util=require(_0x94ae('0x3'));var path=require(_0x94ae('0x4'));var sox=require(_0x94ae('0x5'));var csv=require(_0x94ae('0x6'));var ejs=require(_0x94ae('0x7'));var fs=require('fs');var _=require(_0x94ae('0x8'));var squel=require(_0x94ae('0x9'));var crypto=require(_0x94ae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x94ae('0xb'));var toCsv=require(_0x94ae('0x6'));var querystring=require(_0x94ae('0xc'));var Papa=require(_0x94ae('0xd'));var qs=require(_0x94ae('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x94ae('0xf'));var config=require('../../config/environment');var db=require(_0x94ae('0x10'))['db'];function respondWithStatusCode(_0x146e80,_0x173ebb){_0x173ebb=_0x173ebb||0xcc;return function(_0x454423){if(_0x454423){return _0x146e80['sendStatus'](_0x173ebb);}return _0x146e80[_0x94ae('0x11')](_0x173ebb)[_0x94ae('0x12')]();};}function respondWithResult(_0x30e5c1,_0x42c5c0){_0x42c5c0=_0x42c5c0||0xc8;return function(_0x26d066){if(_0x26d066){return _0x30e5c1[_0x94ae('0x11')](_0x42c5c0)['json'](_0x26d066);}};}function respondWithFilteredResult(_0x46bc60,_0x3fff56){return function(_0x2ebcb7){if(_0x2ebcb7){var _0x45aa19=_0x2ebcb7[_0x94ae('0x13')],_0x1cd75a=_0x3fff56[_0x94ae('0x14')],_0x2c281d=_0x3fff56[_0x94ae('0x14')]+_0x3fff56[_0x94ae('0x15')],_0x3b6747;if(_0x2c281d>=_0x45aa19){_0x2c281d=_0x45aa19;_0x3b6747=0xc8;}else{_0x3b6747=0xce;}_0x46bc60['status'](_0x3b6747);return _0x46bc60[_0x94ae('0x16')](_0x94ae('0x17'),_0x1cd75a+'-'+_0x2c281d+'/'+_0x45aa19)[_0x94ae('0x18')](_0x2ebcb7);}return null;};}function patchUpdates(_0x12b7a5){return function(_0x494c29){try{jsonpatch[_0x94ae('0x19')](_0x494c29,_0x12b7a5,!![]);}catch(_0x443f11){return BPromise['reject'](_0x443f11);}return _0x494c29[_0x94ae('0x1a')]();};}function saveUpdates(_0x5009c5,_0x184484){return function(_0x43e2aa){if(_0x43e2aa){return _0x43e2aa[_0x94ae('0x1b')](_0x5009c5)[_0x94ae('0x1c')](function(_0x4d1d76){return _0x4d1d76;});}return null;};}function removeEntity(_0x437a3f,_0x5e903c){return function(_0x4f5b4d){if(_0x4f5b4d){return _0x4f5b4d[_0x94ae('0x1d')]()[_0x94ae('0x1c')](function(){_0x437a3f['status'](0xcc)[_0x94ae('0x12')]();});}};}function handleEntityNotFound(_0x41c66a,_0x36ebb9){return function(_0x564860){if(!_0x564860){_0x41c66a[_0x94ae('0x1e')](0x194);}return _0x564860;};}function handleError(_0x2afb72,_0x33a561){_0x33a561=_0x33a561||0x1f4;return function(_0x15fc4e){logger[_0x94ae('0x1f')](_0x15fc4e['stack']);if(_0x15fc4e[_0x94ae('0x20')]){delete _0x15fc4e['name'];}_0x2afb72['status'](_0x33a561)[_0x94ae('0x21')](_0x15fc4e);};}exports['index']=function(_0x14430b,_0x697493){var _0x1d9ab0={},_0x9e492d={},_0x4690dc={'count':0x0,'rows':[]};var _0x3aceb6=db[_0x94ae('0x22')]['rawAttributes'];_0x9e492d[_0x94ae('0x23')]=_[_0x94ae('0x24')](_0x3aceb6);var _0xef5eb1={'dateStart':_0x14430b[_0x94ae('0x25')][_0x94ae('0x26')],'dateEnd':_0x14430b[_0x94ae('0x25')]['dateEnd']};delete _0x14430b[_0x94ae('0x25')][_0x94ae('0x26')];delete _0x14430b[_0x94ae('0x25')]['dateEnd'];_0x9e492d['query']=_[_0x94ae('0x24')](_0x14430b[_0x94ae('0x25')]);_0x9e492d[_0x94ae('0x27')]=_[_0x94ae('0x28')](_0x9e492d[_0x94ae('0x23')],_0x9e492d['query']);_0x1d9ab0[_0x94ae('0x29')]=_[_0x94ae('0x28')](_0x9e492d[_0x94ae('0x23')],qs['fields'](_0x14430b[_0x94ae('0x25')][_0x94ae('0x2a')]));_0x1d9ab0['attributes']=_0x1d9ab0[_0x94ae('0x29')][_0x94ae('0x2b')]?_0x1d9ab0[_0x94ae('0x29')]:_0x9e492d['model'];if(!_0x14430b['query'][_0x94ae('0x2c')](_0x94ae('0x2d'))){_0x1d9ab0[_0x94ae('0x15')]=qs['limit'](_0x14430b[_0x94ae('0x25')][_0x94ae('0x15')]);_0x1d9ab0[_0x94ae('0x14')]=qs['offset'](_0x14430b['query'][_0x94ae('0x14')]);}_0x1d9ab0[_0x94ae('0x2e')]=qs['sort'](_0x14430b[_0x94ae('0x25')][_0x94ae('0x2f')]);_0x1d9ab0[_0x94ae('0x30')]=qs['filters'](_[_0x94ae('0x31')](_0x14430b['query'],_0x9e492d[_0x94ae('0x27')]));if(_0xef5eb1['dateStart']){if(_0xef5eb1['dateEnd']){_0xef5eb1[_0x94ae('0x32')]=moment(_0xef5eb1[_0x94ae('0x32')])[_0x94ae('0x33')](0x1,_0x94ae('0x34'));}else{_0xef5eb1['dateEnd']=moment(_0xef5eb1[_0x94ae('0x26')])[_0x94ae('0x33')](0x1,_0x94ae('0x34'));}_[_0x94ae('0x35')](_0x1d9ab0['where'],{'createdAt':{'$gte':_0xef5eb1[_0x94ae('0x26')],'$lte':_0xef5eb1[_0x94ae('0x32')]}});}if(_0x14430b[_0x94ae('0x25')]['filter']){_0x1d9ab0['where']=_[_0x94ae('0x35')](_0x1d9ab0[_0x94ae('0x30')],{'$or':_['map'](_0x1d9ab0['attributes'],function(_0x10b006){var _0x320793={};_0x320793[_0x10b006]={'$like':'%'+_0x14430b[_0x94ae('0x25')][_0x94ae('0x36')]+'%'};return _0x320793;})});}_0x1d9ab0=_['merge']({},_0x1d9ab0,_0x14430b[_0x94ae('0x37')]);var _0xa420fc={'where':_0x1d9ab0['where']};return db[_0x94ae('0x22')]['count'](_0xa420fc)[_0x94ae('0x1c')](function(_0x4894b5){_0x4690dc[_0x94ae('0x13')]=_0x4894b5;if(_0x14430b[_0x94ae('0x25')][_0x94ae('0x38')]){_0x1d9ab0[_0x94ae('0x39')]=[{'all':!![]}];}return db[_0x94ae('0x22')][_0x94ae('0x3a')](_0x1d9ab0);})[_0x94ae('0x1c')](function(_0x539ac1){_0x4690dc['rows']=_0x539ac1;return _0x4690dc;})[_0x94ae('0x1c')](respondWithFilteredResult(_0x697493,_0x1d9ab0))[_0x94ae('0x3b')](handleError(_0x697493,null));};exports['show']=function(_0x2e113a,_0x30e13a){var _0xef8323={'raw':!![],'where':{'id':_0x2e113a[_0x94ae('0x3c')]['id']}},_0x3d5391={};_0x3d5391[_0x94ae('0x23')]=_[_0x94ae('0x24')](db[_0x94ae('0x22')][_0x94ae('0x3d')]);_0x3d5391[_0x94ae('0x25')]=_['keys'](_0x2e113a['query']);_0x3d5391[_0x94ae('0x27')]=_[_0x94ae('0x28')](_0x3d5391[_0x94ae('0x23')],_0x3d5391[_0x94ae('0x25')]);_0xef8323[_0x94ae('0x29')]=_[_0x94ae('0x28')](_0x3d5391[_0x94ae('0x23')],qs[_0x94ae('0x2a')](_0x2e113a[_0x94ae('0x25')][_0x94ae('0x2a')]));_0xef8323['attributes']=_0xef8323['attributes'][_0x94ae('0x2b')]?_0xef8323[_0x94ae('0x29')]:_0x3d5391[_0x94ae('0x23')];if(_0x2e113a[_0x94ae('0x25')]['includeAll']){_0xef8323['include']=[{'all':!![]}];}_0xef8323=_['merge']({},_0xef8323,_0x2e113a['options']);return db['OpenchannelApplication'][_0x94ae('0x3e')](_0xef8323)[_0x94ae('0x1c')](handleEntityNotFound(_0x30e13a,null))[_0x94ae('0x1c')](respondWithResult(_0x30e13a,null))['catch'](handleError(_0x30e13a,null));};exports[_0x94ae('0x3f')]=function(_0x56ce7d,_0x541ecf){return db['OpenchannelApplication']['create'](_0x56ce7d['body'],{})[_0x94ae('0x1c')](respondWithResult(_0x541ecf,0xc9))['catch'](handleError(_0x541ecf,null));};exports[_0x94ae('0x1b')]=function(_0x2f3a7d,_0x109687){if(_0x2f3a7d[_0x94ae('0x40')]['id']){delete _0x2f3a7d[_0x94ae('0x40')]['id'];}return db[_0x94ae('0x22')][_0x94ae('0x3e')]({'where':{'id':_0x2f3a7d['params']['id']}})[_0x94ae('0x1c')](handleEntityNotFound(_0x109687,null))[_0x94ae('0x1c')](saveUpdates(_0x2f3a7d[_0x94ae('0x40')],null))['then'](respondWithResult(_0x109687,null))['catch'](handleError(_0x109687,null));};exports[_0x94ae('0x1d')]=function(_0xfc56f5,_0x5141a1){return db[_0x94ae('0x22')][_0x94ae('0x3e')]({'where':{'id':_0xfc56f5[_0x94ae('0x3c')]['id']}})[_0x94ae('0x1c')](handleEntityNotFound(_0x5141a1,null))[_0x94ae('0x1c')](removeEntity(_0x5141a1,null))[_0x94ae('0x3b')](handleError(_0x5141a1,null));}; \ No newline at end of file +var _0x0064=['OpenchannelApplication','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','nolimit','order','sort','pick','add','day','where','merge','filter','options','includeAll','findAll','rows','show','params','length','include','find','create','body','catch','update','destroy','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index'];(function(_0x38ed1e,_0x17c77a){var _0x1e660e=function(_0x38be62){while(--_0x38be62){_0x38ed1e['push'](_0x38ed1e['shift']());}};_0x1e660e(++_0x17c77a);}(_0x0064,0x1cc));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0x4006('0x0'));var rp=require('request-promise');var moment=require(_0x4006('0x1'));var BPromise=require(_0x4006('0x2'));var Mustache=require(_0x4006('0x3'));var util=require('util');var path=require(_0x4006('0x4'));var sox=require(_0x4006('0x5'));var csv=require(_0x4006('0x6'));var ejs=require(_0x4006('0x7'));var fs=require('fs');var _=require(_0x4006('0x8'));var squel=require(_0x4006('0x9'));var crypto=require(_0x4006('0xa'));var jsforce=require(_0x4006('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4006('0xc'));var Papa=require(_0x4006('0xd'));var qs=require(_0x4006('0xe'));var logger=require(_0x4006('0xf'))(_0x4006('0x10'));var utils=require(_0x4006('0x11'));var config=require('../../config/environment');var db=require(_0x4006('0x12'))['db'];function respondWithStatusCode(_0x435a23,_0xec2d25){_0xec2d25=_0xec2d25||0xcc;return function(_0x114f02){if(_0x114f02){return _0x435a23[_0x4006('0x13')](_0xec2d25);}return _0x435a23['status'](_0xec2d25)[_0x4006('0x14')]();};}function respondWithResult(_0x352638,_0x1656b1){_0x1656b1=_0x1656b1||0xc8;return function(_0x582eda){if(_0x582eda){return _0x352638[_0x4006('0x15')](_0x1656b1)[_0x4006('0x16')](_0x582eda);}};}function respondWithFilteredResult(_0x44af59,_0x34ac0e){return function(_0x5ef8b8){if(_0x5ef8b8){var _0x20289a=_0x5ef8b8[_0x4006('0x17')],_0x5ef0df=_0x34ac0e[_0x4006('0x18')],_0x4ec891=_0x34ac0e[_0x4006('0x18')]+_0x34ac0e[_0x4006('0x19')],_0x1b75dd;if(_0x4ec891>=_0x20289a){_0x4ec891=_0x20289a;_0x1b75dd=0xc8;}else{_0x1b75dd=0xce;}_0x44af59[_0x4006('0x15')](_0x1b75dd);return _0x44af59[_0x4006('0x1a')](_0x4006('0x1b'),_0x5ef0df+'-'+_0x4ec891+'/'+_0x20289a)[_0x4006('0x16')](_0x5ef8b8);}return null;};}function patchUpdates(_0x305ec0){return function(_0xf7d217){try{jsonpatch[_0x4006('0x1c')](_0xf7d217,_0x305ec0,!![]);}catch(_0x25a428){return BPromise[_0x4006('0x1d')](_0x25a428);}return _0xf7d217[_0x4006('0x1e')]();};}function saveUpdates(_0x5cb977,_0x24063c){return function(_0x4096f3){if(_0x4096f3){return _0x4096f3['update'](_0x5cb977)[_0x4006('0x1f')](function(_0x3634ff){return _0x3634ff;});}return null;};}function removeEntity(_0x71de4,_0x30f006){return function(_0x1d94a1){if(_0x1d94a1){return _0x1d94a1['destroy']()[_0x4006('0x1f')](function(){_0x71de4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40d4e9,_0x30a63c){return function(_0x1f92b7){if(!_0x1f92b7){_0x40d4e9['sendStatus'](0x194);}return _0x1f92b7;};}function handleError(_0x33ad68,_0x30e361){_0x30e361=_0x30e361||0x1f4;return function(_0x4180ea){logger[_0x4006('0x20')](_0x4180ea[_0x4006('0x21')]);if(_0x4180ea[_0x4006('0x22')]){delete _0x4180ea['name'];}_0x33ad68[_0x4006('0x15')](_0x30e361)[_0x4006('0x23')](_0x4180ea);};}exports[_0x4006('0x24')]=function(_0x1322a8,_0x47d408){var _0x1d9248={},_0x27d6dc={},_0x14037e={'count':0x0,'rows':[]};var _0x2d9987=db[_0x4006('0x25')][_0x4006('0x26')];_0x27d6dc[_0x4006('0x27')]=_[_0x4006('0x28')](_0x2d9987);var _0x4b900e={'dateStart':_0x1322a8[_0x4006('0x29')][_0x4006('0x2a')],'dateEnd':_0x1322a8[_0x4006('0x29')][_0x4006('0x2b')]};delete _0x1322a8[_0x4006('0x29')][_0x4006('0x2a')];delete _0x1322a8['query']['dateEnd'];_0x27d6dc[_0x4006('0x29')]=_[_0x4006('0x28')](_0x1322a8[_0x4006('0x29')]);_0x27d6dc[_0x4006('0x2c')]=_['intersection'](_0x27d6dc[_0x4006('0x27')],_0x27d6dc[_0x4006('0x29')]);_0x1d9248['attributes']=_[_0x4006('0x2d')](_0x27d6dc[_0x4006('0x27')],qs[_0x4006('0x2e')](_0x1322a8['query'][_0x4006('0x2e')]));_0x1d9248[_0x4006('0x2f')]=_0x1d9248[_0x4006('0x2f')]['length']?_0x1d9248[_0x4006('0x2f')]:_0x27d6dc[_0x4006('0x27')];if(!_0x1322a8[_0x4006('0x29')]['hasOwnProperty'](_0x4006('0x30'))){_0x1d9248[_0x4006('0x19')]=qs[_0x4006('0x19')](_0x1322a8[_0x4006('0x29')][_0x4006('0x19')]);_0x1d9248['offset']=qs[_0x4006('0x18')](_0x1322a8['query']['offset']);}_0x1d9248[_0x4006('0x31')]=qs[_0x4006('0x32')](_0x1322a8[_0x4006('0x29')]['sort']);_0x1d9248['where']=qs[_0x4006('0x2c')](_[_0x4006('0x33')](_0x1322a8[_0x4006('0x29')],_0x27d6dc[_0x4006('0x2c')]));if(_0x4b900e[_0x4006('0x2a')]){if(_0x4b900e[_0x4006('0x2b')]){_0x4b900e[_0x4006('0x2b')]=moment(_0x4b900e[_0x4006('0x2b')])[_0x4006('0x34')](0x1,'day');}else{_0x4b900e['dateEnd']=moment(_0x4b900e[_0x4006('0x2a')])[_0x4006('0x34')](0x1,_0x4006('0x35'));}_['merge'](_0x1d9248[_0x4006('0x36')],{'createdAt':{'$gte':_0x4b900e[_0x4006('0x2a')],'$lte':_0x4b900e[_0x4006('0x2b')]}});}if(_0x1322a8['query']['filter']){_0x1d9248['where']=_[_0x4006('0x37')](_0x1d9248[_0x4006('0x36')],{'$or':_['map'](_0x1d9248['attributes'],function(_0x2777f0){var _0x34e0cf={};_0x34e0cf[_0x2777f0]={'$like':'%'+_0x1322a8[_0x4006('0x29')][_0x4006('0x38')]+'%'};return _0x34e0cf;})});}_0x1d9248=_[_0x4006('0x37')]({},_0x1d9248,_0x1322a8[_0x4006('0x39')]);var _0x554d2a={'where':_0x1d9248['where']};return db[_0x4006('0x25')]['count'](_0x554d2a)[_0x4006('0x1f')](function(_0x57a86e){_0x14037e[_0x4006('0x17')]=_0x57a86e;if(_0x1322a8['query'][_0x4006('0x3a')]){_0x1d9248['include']=[{'all':!![]}];}return db[_0x4006('0x25')][_0x4006('0x3b')](_0x1d9248);})['then'](function(_0x340327){_0x14037e[_0x4006('0x3c')]=_0x340327;return _0x14037e;})[_0x4006('0x1f')](respondWithFilteredResult(_0x47d408,_0x1d9248))['catch'](handleError(_0x47d408,null));};exports[_0x4006('0x3d')]=function(_0xfc40d4,_0x5c1242){var _0x601474={'raw':!![],'where':{'id':_0xfc40d4[_0x4006('0x3e')]['id']}},_0x30ad56={};_0x30ad56['model']=_[_0x4006('0x28')](db[_0x4006('0x25')][_0x4006('0x26')]);_0x30ad56[_0x4006('0x29')]=_[_0x4006('0x28')](_0xfc40d4[_0x4006('0x29')]);_0x30ad56[_0x4006('0x2c')]=_['intersection'](_0x30ad56['model'],_0x30ad56['query']);_0x601474['attributes']=_[_0x4006('0x2d')](_0x30ad56[_0x4006('0x27')],qs['fields'](_0xfc40d4[_0x4006('0x29')][_0x4006('0x2e')]));_0x601474['attributes']=_0x601474['attributes'][_0x4006('0x3f')]?_0x601474[_0x4006('0x2f')]:_0x30ad56[_0x4006('0x27')];if(_0xfc40d4[_0x4006('0x29')][_0x4006('0x3a')]){_0x601474[_0x4006('0x40')]=[{'all':!![]}];}_0x601474=_[_0x4006('0x37')]({},_0x601474,_0xfc40d4['options']);return db[_0x4006('0x25')][_0x4006('0x41')](_0x601474)[_0x4006('0x1f')](handleEntityNotFound(_0x5c1242,null))['then'](respondWithResult(_0x5c1242,null))['catch'](handleError(_0x5c1242,null));};exports[_0x4006('0x42')]=function(_0x493a5c,_0x4c5559){return db[_0x4006('0x25')][_0x4006('0x42')](_0x493a5c[_0x4006('0x43')],{})[_0x4006('0x1f')](respondWithResult(_0x4c5559,0xc9))[_0x4006('0x44')](handleError(_0x4c5559,null));};exports[_0x4006('0x45')]=function(_0x27f215,_0x3d9ebf){if(_0x27f215[_0x4006('0x43')]['id']){delete _0x27f215[_0x4006('0x43')]['id'];}return db['OpenchannelApplication'][_0x4006('0x41')]({'where':{'id':_0x27f215[_0x4006('0x3e')]['id']}})[_0x4006('0x1f')](handleEntityNotFound(_0x3d9ebf,null))[_0x4006('0x1f')](saveUpdates(_0x27f215['body'],null))['then'](respondWithResult(_0x3d9ebf,null))[_0x4006('0x44')](handleError(_0x3d9ebf,null));};exports[_0x4006('0x46')]=function(_0x26cc7e,_0x31d33b){return db[_0x4006('0x25')][_0x4006('0x41')]({'where':{'id':_0x26cc7e[_0x4006('0x3e')]['id']}})[_0x4006('0x1f')](handleEntityNotFound(_0x31d33b,null))['then'](removeEntity(_0x31d33b,null))[_0x4006('0x44')](handleError(_0x31d33b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index baa0622..0a98acd 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 _0xd571=['openchannel_applications','lodash','util','../../config/logger','bluebird','request-promise','./openchannelApplication.attributes','exports','OpenchannelApplication'];(function(_0x43d153,_0x1dfeac){var _0x458ef6=function(_0x38e8e3){while(--_0x38e8e3){_0x43d153['push'](_0x43d153['shift']());}};_0x458ef6(++_0x1dfeac);}(_0xd571,0x64));var _0x1d57=function(_0x30ad87,_0x4ad37f){_0x30ad87=_0x30ad87-0x0;var _0x53144c=_0xd571[_0x30ad87];return _0x53144c;};'use strict';var _=require(_0x1d57('0x0'));var util=require(_0x1d57('0x1'));var logger=require(_0x1d57('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1d57('0x3'));var rp=require(_0x1d57('0x4'));var attributes=require(_0x1d57('0x5'));module[_0x1d57('0x6')]=function(_0x48680a,_0x360e87){return _0x48680a['define'](_0x1d57('0x7'),attributes,{'tableName':_0x1d57('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dac=['openchannel_applications','lodash','../../config/logger','bluebird','define','OpenchannelApplication'];(function(_0x2b9602,_0x3a1d03){var _0x9be5f2=function(_0xcf3486){while(--_0xcf3486){_0x2b9602['push'](_0x2b9602['shift']());}};_0x9be5f2(++_0x3a1d03);}(_0x0dac,0x73));var _0xc0da=function(_0x578418,_0x48a333){_0x578418=_0x578418-0x0;var _0x392bf5=_0x0dac[_0x578418];return _0x392bf5;};'use strict';var _=require(_0xc0da('0x0'));var util=require('util');var logger=require(_0xc0da('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc0da('0x2'));var rp=require('request-promise');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x1a5434,_0x54c75){return _0x1a5434[_0xc0da('0x3')](_0xc0da('0x4'),attributes,{'tableName':_0xc0da('0x5'),'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 5f8b700..043b3e7 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 _0xdbb1=['code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','attributes','limit','catch','lodash','randomstring','../../config/logger','../../config/environment','jayson/promise','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xdbb1,0x105));var _0x1dbb=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xdbb1[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x1dbb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1dbb('0x1'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1dbb('0x2'))('rpc');var config=require(_0x1dbb('0x3'));var jayson=require(_0x1dbb('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd43ce8,_0x38259d,_0x2070a8){return new BPromise(function(_0x7c2269,_0x5e622c){return client[_0x1dbb('0x5')](_0xd43ce8,_0x2070a8)[_0x1dbb('0x6')](function(_0x5d2d5c){logger[_0x1dbb('0x7')](_0x1dbb('0x8'),_0x38259d,_0x1dbb('0x9'));logger[_0x1dbb('0xa')](_0x1dbb('0xb'),_0x38259d,_0x1dbb('0x9'),JSON[_0x1dbb('0xc')](_0x5d2d5c));if(_0x5d2d5c[_0x1dbb('0xd')]){if(_0x5d2d5c[_0x1dbb('0xd')][_0x1dbb('0xe')]===0x1f4){logger[_0x1dbb('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x38259d,_0x5d2d5c[_0x1dbb('0xd')][_0x1dbb('0xf')]);return _0x5e622c(_0x5d2d5c[_0x1dbb('0xd')][_0x1dbb('0xf')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x38259d,_0x5d2d5c[_0x1dbb('0xd')][_0x1dbb('0xf')]);return _0x7c2269(_0x5d2d5c[_0x1dbb('0xd')][_0x1dbb('0xf')]);}else{logger[_0x1dbb('0x7')]('OpenchannelApplication,\x20%s,\x20%s',_0x38259d,_0x1dbb('0x9'));_0x7c2269(_0x5d2d5c[_0x1dbb('0x10')][_0x1dbb('0xf')]);}})['catch'](function(_0x5b6e42){logger[_0x1dbb('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x38259d,_0x5b6e42);_0x5e622c(_0x5b6e42);});});}exports[_0x1dbb('0x11')]=function(_0x376daa){var _0x98b8d2=this;return new Promise(function(_0x440c9f,_0xb21bc5){return db[_0x1dbb('0x12')][_0x1dbb('0x13')](_0x376daa[_0x1dbb('0x14')],{'raw':_0x376daa['options']?_0x376daa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x376daa[_0x1dbb('0x15')]?_0x376daa[_0x1dbb('0x15')]['where']||null:null,'attributes':_0x376daa[_0x1dbb('0x15')]?_0x376daa[_0x1dbb('0x15')][_0x1dbb('0x16')]||null:null,'limit':_0x376daa[_0x1dbb('0x15')]?_0x376daa[_0x1dbb('0x15')][_0x1dbb('0x17')]||null:null})[_0x1dbb('0x6')](function(_0x4b206d){logger[_0x1dbb('0x7')](_0x1dbb('0x11'),_0x376daa);logger[_0x1dbb('0xa')](_0x1dbb('0x11'),_0x376daa,JSON[_0x1dbb('0xc')](_0x4b206d));_0x440c9f(_0x4b206d);})[_0x1dbb('0x18')](function(_0x1e1918){logger[_0x1dbb('0xd')](_0x1dbb('0x11'),_0x1e1918[_0x1dbb('0xf')],_0x376daa);_0xb21bc5(_0x98b8d2[_0x1dbb('0xd')](0x1f4,_0x1e1918['message']));});});}; \ No newline at end of file +var _0x4006=['stringify','error','message','result','catch','OpenchannelApplication','update','options','raw','where','attributes','limit','UpdateOpenchannelApplication','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x5b81dd,_0x498482){var _0x8f7ca=function(_0x3171c7){while(--_0x3171c7){_0x5b81dd['push'](_0x5b81dd['shift']());}};_0x8f7ca(++_0x498482);}(_0x4006,0x1c7));var _0x6400=function(_0x210045,_0x2a9054){_0x210045=_0x210045-0x0;var _0x37177a=_0x4006[_0x210045];return _0x37177a;};'use strict';var _=require('lodash');var util=require(_0x6400('0x0'));var moment=require(_0x6400('0x1'));var BPromise=require(_0x6400('0x2'));var rs=require(_0x6400('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6400('0x4'))('rpc');var config=require(_0x6400('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6400('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x599e6f,_0x32c0db,_0x2d365b){return new BPromise(function(_0x2bf4f8,_0x250dba){return client['request'](_0x599e6f,_0x2d365b)[_0x6400('0x7')](function(_0x46819e){logger[_0x6400('0x8')](_0x6400('0x9'),_0x32c0db,_0x6400('0xa'));logger[_0x6400('0xb')](_0x6400('0xc'),_0x32c0db,_0x6400('0xa'),JSON[_0x6400('0xd')](_0x46819e));if(_0x46819e[_0x6400('0xe')]){if(_0x46819e[_0x6400('0xe')]['code']===0x1f4){logger[_0x6400('0xe')](_0x6400('0x9'),_0x32c0db,_0x46819e[_0x6400('0xe')][_0x6400('0xf')]);return _0x250dba(_0x46819e['error'][_0x6400('0xf')]);}logger[_0x6400('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x32c0db,_0x46819e['error']['message']);return _0x2bf4f8(_0x46819e[_0x6400('0xe')][_0x6400('0xf')]);}else{logger['info'](_0x6400('0x9'),_0x32c0db,'request\x20sent');_0x2bf4f8(_0x46819e[_0x6400('0x10')]['message']);}})[_0x6400('0x11')](function(_0x430cb4){logger[_0x6400('0xe')](_0x6400('0x9'),_0x32c0db,_0x430cb4);_0x250dba(_0x430cb4);});});}exports['UpdateOpenchannelApplication']=function(_0x444bce){var _0x14c036=this;return new Promise(function(_0xce9fd1,_0x50524f){return db[_0x6400('0x12')][_0x6400('0x13')](_0x444bce['body'],{'raw':_0x444bce[_0x6400('0x14')]?_0x444bce[_0x6400('0x14')][_0x6400('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x444bce['options']?_0x444bce[_0x6400('0x14')][_0x6400('0x16')]||null:null,'attributes':_0x444bce[_0x6400('0x14')]?_0x444bce[_0x6400('0x14')][_0x6400('0x17')]||null:null,'limit':_0x444bce[_0x6400('0x14')]?_0x444bce[_0x6400('0x14')][_0x6400('0x18')]||null:null})[_0x6400('0x7')](function(_0x212f0f){logger['info'](_0x6400('0x19'),_0x444bce);logger['debug']('UpdateOpenchannelApplication',_0x444bce,JSON[_0x6400('0xd')](_0x212f0f));_0xce9fd1(_0x212f0f);})[_0x6400('0x11')](function(_0x7c3948){logger[_0x6400('0xe')]('UpdateOpenchannelApplication',_0x7c3948[_0x6400('0xf')],_0x444bce);_0x50524f(_0x14c036['error'](0x1f4,_0x7c3948[_0x6400('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 65f4e73..6e9b538 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 _0x64db=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/:id','show','getMessages','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','openchannelinteraction:destroy','delete','removeTags','path','express','Router'];(function(_0x580565,_0x496d18){var _0x1eff90=function(_0x3eb16c){while(--_0x3eb16c){_0x580565['push'](_0x580565['shift']());}};_0x1eff90(++_0x496d18);}(_0x64db,0x1bf));var _0xb64d=function(_0x3e894f,_0x55abc5){_0x3e894f=_0x3e894f-0x0;var _0x434a99=_0x64db[_0x3e894f];return _0x434a99;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb64d('0x0'));var express=require(_0xb64d('0x1'));var router=express[_0xb64d('0x2')]();var auth=require(_0xb64d('0x3'));var interaction=require(_0xb64d('0x4'));var config=require(_0xb64d('0x5'));var controller=require(_0xb64d('0x6'));router[_0xb64d('0x7')]('/',auth[_0xb64d('0x8')](),controller['index']);router[_0xb64d('0x7')]('/describe',auth[_0xb64d('0x8')](),controller['describe']);router['get'](_0xb64d('0x9'),auth[_0xb64d('0x8')](),controller[_0xb64d('0xa')]);router[_0xb64d('0x7')]('/:id/messages',auth[_0xb64d('0x8')](),controller[_0xb64d('0xb')]);router[_0xb64d('0xc')]('/',auth[_0xb64d('0x8')](),controller[_0xb64d('0xd')]);router[_0xb64d('0xc')](_0xb64d('0xe'),auth[_0xb64d('0x8')](),controller[_0xb64d('0xf')]);router[_0xb64d('0xc')](_0xb64d('0x10'),auth[_0xb64d('0x8')](),interaction[_0xb64d('0x11')](_0xb64d('0x12'),_0xb64d('0x13')),controller['addTags']);router[_0xb64d('0x14')]('/:id',auth[_0xb64d('0x8')](),interaction[_0xb64d('0x11')]('openchannel',_0xb64d('0x15')),controller['update']);router['delete']('/:id',auth[_0xb64d('0x8')](),interaction[_0xb64d('0x11')](_0xb64d('0x12'),_0xb64d('0x16')),controller['destroy']);router[_0xb64d('0x17')](_0xb64d('0x10'),auth[_0xb64d('0x8')](),controller[_0xb64d('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1376=['put','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0x1376,0x6f));var _0x6137=function(_0x3eade6,_0x576b80){_0x3eade6=_0x3eade6-0x0;var _0x4ab86a=_0x1376[_0x3eade6];return _0x4ab86a;};'use strict';var multer=require('multer');var util=require(_0x6137('0x0'));var path=require(_0x6137('0x1'));var express=require(_0x6137('0x2'));var router=express[_0x6137('0x3')]();var auth=require(_0x6137('0x4'));var interaction=require(_0x6137('0x5'));var config=require(_0x6137('0x6'));var controller=require('./openchannelInteraction.controller');router[_0x6137('0x7')]('/',auth[_0x6137('0x8')](),controller['index']);router['get']('/describe',auth[_0x6137('0x8')](),controller[_0x6137('0x9')]);router[_0x6137('0x7')](_0x6137('0xa'),auth[_0x6137('0x8')](),controller[_0x6137('0xb')]);router['get'](_0x6137('0xc'),auth[_0x6137('0x8')](),controller[_0x6137('0xd')]);router[_0x6137('0xe')]('/',auth[_0x6137('0x8')](),controller['create']);router['post'](_0x6137('0xc'),auth[_0x6137('0x8')](),controller[_0x6137('0xf')]);router['post'](_0x6137('0x10'),auth[_0x6137('0x8')](),interaction[_0x6137('0x11')]('openchannel',_0x6137('0x12')),controller['addTags']);router[_0x6137('0x13')](_0x6137('0xa'),auth[_0x6137('0x8')](),interaction['tracked']('openchannel',_0x6137('0x14')),controller[_0x6137('0x15')]);router[_0x6137('0x16')]('/:id',auth[_0x6137('0x8')](),interaction[_0x6137('0x11')](_0x6137('0x17'),_0x6137('0x18')),controller['destroy']);router[_0x6137('0x16')](_0x6137('0x10'),auth[_0x6137('0x8')](),controller['removeTags']);module[_0x6137('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 80e5ad0..a910914 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 _0x47d6=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x25af10,_0x39e62c){var _0x1c5feb=function(_0x1e7ea8){while(--_0x1e7ea8){_0x25af10['push'](_0x25af10['shift']());}};_0x1c5feb(++_0x39e62c);}(_0x47d6,0x1de));var _0x647d=function(_0x5b932c,_0x551aac){_0x5b932c=_0x5b932c-0x0;var _0xf36630=_0x47d6[_0x5b932c];return _0xf36630;};'use strict';var Sequelize=require(_0x647d('0x0'));module[_0x647d('0x1')]={'closed':{'type':Sequelize[_0x647d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x647d('0x3')]},'read1stAt':{'type':Sequelize[_0x647d('0x4')]},'threadId':{'type':Sequelize[_0x647d('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x647d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x647d('0x5')]('in',_0x647d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1052=['BOOLEAN','DATE','STRING','out','sequelize','exports'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x1052,0xf4));var _0x2105=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0x1052[_0x32665e];return _0x10be45;};'use strict';var Sequelize=require(_0x2105('0x0'));module[_0x2105('0x1')]={'closed':{'type':Sequelize[_0x2105('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2105('0x3')]},'disposition':{'type':Sequelize[_0x2105('0x4')]},'note':{'type':Sequelize[_0x2105('0x4')]},'read1stAt':{'type':Sequelize[_0x2105('0x3')]},'threadId':{'type':Sequelize[_0x2105('0x4')]},'externalUrl':{'type':Sequelize[_0x2105('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2105('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 4f23631..ad6f16e 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 _0xc87b=['split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','openchannelInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./openchannelInteraction.socket','register','sendStatus','end','status','json','count','offset','apply','reject','update','then','error','name','send','index','OpenchannelInteraction','model','dateEnd','query','dateStart','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','filters','pick','add','day','merge','where','map','options','include','tag','push','Tag','Tags','distinct','Messages','direction','createdAt','read','User','Users','fullname','CmContact','Contact','Owner','OpenchannelAccount','Account','key','color','ThroughTags','findAll','rows','catch','show','params','rawAttributes','includeAll','body','find','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','order','sort','filter','$gte'];(function(_0x1a14cb,_0x2360da){var _0xa90a0c=function(_0xb99d1c){while(--_0xb99d1c){_0x1a14cb['push'](_0x1a14cb['shift']());}};_0xa90a0c(++_0x2360da);}(_0xc87b,0x13b));var _0xbc87=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xc87b[_0x4fde08];return _0x12e725;};'use strict';var jsonpatch=require(_0xbc87('0x0'));var rp=require(_0xbc87('0x1'));var moment=require(_0xbc87('0x2'));var BPromise=require(_0xbc87('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbc87('0x4'));var sox=require(_0xbc87('0x5'));var csv=require(_0xbc87('0x6'));var ejs=require(_0xbc87('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbc87('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc87('0x9'));var toCsv=require(_0xbc87('0x6'));var querystring=require(_0xbc87('0xa'));var Papa=require(_0xbc87('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0xbc87('0xc'))(_0xbc87('0xd'));var utils=require(_0xbc87('0xe'));var config=require(_0xbc87('0xf'));var db=require(_0xbc87('0x10'))['db'];var socket=require(_0xbc87('0x11'))({'host':_0xbc87('0x12'),'port':0x18eb});require(_0xbc87('0x13'))[_0xbc87('0x14')](socket);function respondWithStatusCode(_0xc275db,_0x342e30){_0x342e30=_0x342e30||0xcc;return function(_0x239bdc){if(_0x239bdc){return _0xc275db[_0xbc87('0x15')](_0x342e30);}return _0xc275db['status'](_0x342e30)[_0xbc87('0x16')]();};}function respondWithResult(_0x4dbc53,_0x3443d2){_0x3443d2=_0x3443d2||0xc8;return function(_0x32f3b9){if(_0x32f3b9){return _0x4dbc53[_0xbc87('0x17')](_0x3443d2)[_0xbc87('0x18')](_0x32f3b9);}};}function respondWithFilteredResult(_0x2f6c6e,_0x36497d){return function(_0x14414b){if(_0x14414b){var _0x106838=_0x14414b[_0xbc87('0x19')],_0x369c84=_0x36497d[_0xbc87('0x1a')],_0x43fde5=_0x36497d[_0xbc87('0x1a')]+_0x36497d['limit'],_0x29a18;if(_0x43fde5>=_0x106838){_0x43fde5=_0x106838;_0x29a18=0xc8;}else{_0x29a18=0xce;}_0x2f6c6e[_0xbc87('0x17')](_0x29a18);return _0x2f6c6e['set']('Content-Range',_0x369c84+'-'+_0x43fde5+'/'+_0x106838)['json'](_0x14414b);}return null;};}function patchUpdates(_0x33829){return function(_0x3de7e6){try{jsonpatch[_0xbc87('0x1b')](_0x3de7e6,_0x33829,!![]);}catch(_0x53933b){return BPromise[_0xbc87('0x1c')](_0x53933b);}return _0x3de7e6['save']();};}function saveUpdates(_0x589c07,_0x9882ee){return function(_0x3a76cf){if(_0x3a76cf){return _0x3a76cf[_0xbc87('0x1d')](_0x589c07)[_0xbc87('0x1e')](function(_0x5c047d){return _0x5c047d;});}return null;};}function removeEntity(_0x4d82f8,_0x20a1e9){return function(_0x39884d){if(_0x39884d){return _0x39884d['destroy']()[_0xbc87('0x1e')](function(){_0x4d82f8[_0xbc87('0x17')](0xcc)[_0xbc87('0x16')]();});}};}function handleEntityNotFound(_0x21e429,_0x47bc1f){return function(_0x2bd12b){if(!_0x2bd12b){_0x21e429[_0xbc87('0x15')](0x194);}return _0x2bd12b;};}function handleError(_0x168654,_0x48e60d){_0x48e60d=_0x48e60d||0x1f4;return function(_0x5314b4){logger[_0xbc87('0x1f')](_0x5314b4['stack']);if(_0x5314b4['name']){delete _0x5314b4[_0xbc87('0x20')];}_0x168654['status'](_0x48e60d)[_0xbc87('0x21')](_0x5314b4);};}exports[_0xbc87('0x22')]=function(_0x1d3463,_0x149966){var _0x1ead5b={},_0x4aa0e2={},_0x22edee={'count':0x0,'rows':[]};var _0x4302ef=db[_0xbc87('0x23')]['rawAttributes'];_0x4aa0e2[_0xbc87('0x24')]=_['keys'](_0x4302ef);var _0x171828={'dateStart':_0x1d3463['query']['dateStart'],'dateEnd':_0x1d3463['query'][_0xbc87('0x25')]};delete _0x1d3463[_0xbc87('0x26')][_0xbc87('0x27')];delete _0x1d3463[_0xbc87('0x26')][_0xbc87('0x25')];_0x4aa0e2[_0xbc87('0x26')]=_[_0xbc87('0x28')](_0x1d3463[_0xbc87('0x26')]);_0x4aa0e2['filters']=_[_0xbc87('0x29')](_0x4aa0e2['model'],_0x4aa0e2[_0xbc87('0x26')]);_0x1ead5b[_0xbc87('0x2a')]=_[_0xbc87('0x29')](_0x4aa0e2['model'],qs[_0xbc87('0x2b')](_0x1d3463[_0xbc87('0x26')]['fields']));_0x1ead5b['attributes']=_0x1ead5b[_0xbc87('0x2a')][_0xbc87('0x2c')]?_0x1ead5b[_0xbc87('0x2a')]:_0x4aa0e2[_0xbc87('0x24')];if(!_0x1d3463[_0xbc87('0x26')][_0xbc87('0x2d')](_0xbc87('0x2e'))){_0x1ead5b['limit']=qs[_0xbc87('0x2f')](_0x1d3463[_0xbc87('0x26')]['limit']);_0x1ead5b['offset']=qs['offset'](_0x1d3463['query'][_0xbc87('0x1a')]);}_0x1ead5b['order']=qs['sort'](_0x1d3463[_0xbc87('0x26')]['sort']);_0x1ead5b['where']=qs[_0xbc87('0x30')](_[_0xbc87('0x31')](_0x1d3463[_0xbc87('0x26')],_0x4aa0e2[_0xbc87('0x30')]));if(_0x171828[_0xbc87('0x27')]){if(_0x171828[_0xbc87('0x25')]){_0x171828[_0xbc87('0x25')]=moment(_0x171828['dateEnd'])[_0xbc87('0x32')](0x1,_0xbc87('0x33'));}else{_0x171828[_0xbc87('0x25')]=moment(_0x171828[_0xbc87('0x27')])['add'](0x1,_0xbc87('0x33'));}_[_0xbc87('0x34')](_0x1ead5b[_0xbc87('0x35')],{'createdAt':{'$gte':_0x171828['dateStart'],'$lte':_0x171828['dateEnd']}});}if(_0x1d3463[_0xbc87('0x26')]['filter']){_0x1ead5b[_0xbc87('0x35')]=_[_0xbc87('0x34')](_0x1ead5b[_0xbc87('0x35')],{'$or':_[_0xbc87('0x36')](_0x1ead5b[_0xbc87('0x2a')],function(_0x2b1cff){var _0xef450a={};_0xef450a[_0x2b1cff]={'$like':'%'+_0x1d3463['query']['filter']+'%'};return _0xef450a;})});}_0x1ead5b=_[_0xbc87('0x34')]({},_0x1ead5b,_0x1d3463[_0xbc87('0x37')]);var _0x27b7a0={'where':_0x1ead5b[_0xbc87('0x35')]};_0x27b7a0[_0xbc87('0x38')]=[];if(_0x1d3463[_0xbc87('0x26')][_0xbc87('0x39')]){_0x27b7a0['include'][_0xbc87('0x3a')]({'model':db[_0xbc87('0x3b')],'as':_0xbc87('0x3c'),'attributes':['id'],'where':{'id':_0x1d3463['query']['tag']},'required':!![]});_0x27b7a0[_0xbc87('0x3d')]=!![];}if(_0x1d3463[_0xbc87('0x26')]['read']){_0x27b7a0['include']['push']({'model':db['OpenchannelMessage'],'as':_0xbc87('0x3e'),'attributes':['id',_0xbc87('0x3f'),_0xbc87('0x40'),_0xbc87('0x41')],'where':{'direction':'in','read':_0x1d3463[_0xbc87('0x26')][_0xbc87('0x41')]||![]},'required':!![]});_0x27b7a0[_0xbc87('0x3d')]=!![];}return db['OpenchannelInteraction'][_0xbc87('0x19')](_0x27b7a0)['then'](function(_0x50ed75){_0x22edee[_0xbc87('0x19')]=_0x50ed75;if(_0x1d3463[_0xbc87('0x26')]['includeAll']){_0x1ead5b['include']=[{'model':db[_0xbc87('0x42')],'as':_0xbc87('0x43'),'required':![],'attributes':['id',_0xbc87('0x20'),_0xbc87('0x44')]},{'model':db[_0xbc87('0x45')],'as':_0xbc87('0x46'),'required':![]},{'model':db[_0xbc87('0x42')],'as':_0xbc87('0x47'),'attributes':[_0xbc87('0x20'),_0xbc87('0x44'),'internal'],'required':![]},{'model':db[_0xbc87('0x48')],'as':_0xbc87('0x49'),'attributes':[_0xbc87('0x20'),_0xbc87('0x4a')],'required':![]},{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0xbc87('0x3f'),'createdAt',_0xbc87('0x41')],'where':{'direction':'in','read':_0x1d3463['query'][_0xbc87('0x41')]||![]},'required':_0x1d3463[_0xbc87('0x26')][_0xbc87('0x41')]||![]},{'model':db[_0xbc87('0x3b')],'as':_0xbc87('0x3c'),'attributes':['id',_0xbc87('0x20'),_0xbc87('0x4b')],'required':_0x1d3463[_0xbc87('0x26')]['tag']?!![]:![]},{'model':db[_0xbc87('0x3b')],'as':_0xbc87('0x4c'),'attributes':['id',_0xbc87('0x20'),_0xbc87('0x4b')],'through':_0x1d3463['query'][_0xbc87('0x39')]?{'attributes':[],'where':{'TagId':_0x1d3463[_0xbc87('0x26')][_0xbc87('0x39')]||undefined}}:{},'required':_0x1d3463[_0xbc87('0x26')][_0xbc87('0x39')]?!![]:![]}];}return db[_0xbc87('0x23')][_0xbc87('0x4d')](_0x1ead5b);})[_0xbc87('0x1e')](function(_0x1a4690){_0x22edee[_0xbc87('0x4e')]=_0x1a4690;return _0x22edee;})[_0xbc87('0x1e')](respondWithFilteredResult(_0x149966,_0x1ead5b))[_0xbc87('0x4f')](handleError(_0x149966,null));};exports[_0xbc87('0x50')]=function(_0x238390,_0x19226d){var _0x29a14={'raw':![],'where':{'id':_0x238390[_0xbc87('0x51')]['id']}},_0x152645={};_0x152645[_0xbc87('0x24')]=_[_0xbc87('0x28')](db['OpenchannelInteraction'][_0xbc87('0x52')]);_0x152645[_0xbc87('0x26')]=_[_0xbc87('0x28')](_0x238390[_0xbc87('0x26')]);_0x152645[_0xbc87('0x30')]=_[_0xbc87('0x29')](_0x152645[_0xbc87('0x24')],_0x152645[_0xbc87('0x26')]);_0x29a14[_0xbc87('0x2a')]=_[_0xbc87('0x29')](_0x152645[_0xbc87('0x24')],qs['fields'](_0x238390[_0xbc87('0x26')][_0xbc87('0x2b')]));_0x29a14[_0xbc87('0x2a')]=_0x29a14[_0xbc87('0x2a')][_0xbc87('0x2c')]?_0x29a14[_0xbc87('0x2a')]:_0x152645[_0xbc87('0x24')];if(_0x238390[_0xbc87('0x26')][_0xbc87('0x53')]){_0x29a14[_0xbc87('0x38')]=[{'all':!![]}];}_0x29a14=_[_0xbc87('0x34')]({},_0x29a14,_0x238390[_0xbc87('0x37')]);return db[_0xbc87('0x23')]['find'](_0x29a14)['then'](handleEntityNotFound(_0x19226d,null))[_0xbc87('0x1e')](respondWithResult(_0x19226d,null))[_0xbc87('0x4f')](handleError(_0x19226d,null));};exports['create']=function(_0x5c46a9,_0x4e6366){return db[_0xbc87('0x23')]['create'](_0x5c46a9[_0xbc87('0x54')],{})['then'](respondWithResult(_0x4e6366,0xc9))[_0xbc87('0x4f')](handleError(_0x4e6366,null));};exports[_0xbc87('0x1d')]=function(_0x51c8f0,_0x4e5ed2){if(_0x51c8f0[_0xbc87('0x54')]['id']){delete _0x51c8f0[_0xbc87('0x54')]['id'];}return db[_0xbc87('0x23')][_0xbc87('0x55')]({'where':{'id':_0x51c8f0[_0xbc87('0x51')]['id']}})[_0xbc87('0x1e')](handleEntityNotFound(_0x4e5ed2,null))[_0xbc87('0x1e')](saveUpdates(_0x51c8f0[_0xbc87('0x54')],null))[_0xbc87('0x1e')](respondWithResult(_0x4e5ed2,null))[_0xbc87('0x4f')](handleError(_0x4e5ed2,null));};exports[_0xbc87('0x56')]=function(_0x2a11d4,_0x646dae){return db['OpenchannelInteraction'][_0xbc87('0x55')]({'where':{'id':_0x2a11d4[_0xbc87('0x51')]['id']}})[_0xbc87('0x1e')](handleEntityNotFound(_0x646dae,null))['then'](removeEntity(_0x646dae,null))[_0xbc87('0x4f')](handleError(_0x646dae,null));};exports[_0xbc87('0x57')]=function(_0x11916b,_0x11dc26){return db['OpenchannelInteraction']['describe']()[_0xbc87('0x1e')](respondWithResult(_0x11dc26,null))[_0xbc87('0x4f')](handleError(_0x11dc26,null));};exports[_0xbc87('0x58')]=function(_0x32de04,_0x540a25,_0x477ce5){return db[_0xbc87('0x59')][_0xbc87('0x55')]({'where':{'id':_0x32de04[_0xbc87('0x51')]['id']}})[_0xbc87('0x1e')](handleEntityNotFound(_0x540a25,null))[_0xbc87('0x1e')](function(_0x422e44){if(_0x422e44){return _0x422e44[_0xbc87('0x58')](_0x32de04[_0xbc87('0x54')][_0xbc87('0x5a')],_[_0xbc87('0x5b')](_0x32de04['body'],[_0xbc87('0x5a'),'id'])||{});}})[_0xbc87('0x1e')](respondWithResult(_0x540a25,null))[_0xbc87('0x4f')](handleError(_0x540a25,null));};exports[_0xbc87('0x5c')]=function(_0x561ce5,_0x545bb2,_0x3a1619){var _0x58c334={'raw':![],'where':{}};var _0x21e545={};var _0x3e0134={'count':0x0,'rows':[]};return db[_0xbc87('0x23')]['findOne']({'where':{'id':_0x561ce5[_0xbc87('0x51')]['id']}})['then'](handleEntityNotFound(_0x545bb2,null))['then'](function(_0x18841d){if(_0x18841d){_0x21e545[_0xbc87('0x24')]=_[_0xbc87('0x28')](db[_0xbc87('0x59')][_0xbc87('0x52')]);_0x21e545[_0xbc87('0x26')]=_['keys'](_0x561ce5['query']);_0x21e545[_0xbc87('0x30')]=_[_0xbc87('0x29')](_0x21e545[_0xbc87('0x24')],_0x21e545[_0xbc87('0x26')]);_0x58c334['attributes']=_[_0xbc87('0x29')](_0x21e545[_0xbc87('0x24')],qs[_0xbc87('0x2b')](_0x561ce5['query']['fields']));_0x58c334[_0xbc87('0x2a')]=_0x58c334[_0xbc87('0x2a')][_0xbc87('0x2c')]?_0x58c334[_0xbc87('0x2a')]:_0x21e545[_0xbc87('0x24')];if(!_0x561ce5['query'][_0xbc87('0x2d')](_0xbc87('0x2e'))){_0x58c334[_0xbc87('0x2f')]=qs['limit'](_0x561ce5['query'][_0xbc87('0x2f')]);_0x58c334[_0xbc87('0x1a')]=qs[_0xbc87('0x1a')](_0x561ce5[_0xbc87('0x26')][_0xbc87('0x1a')]);}_0x58c334[_0xbc87('0x5d')]=qs[_0xbc87('0x5e')](_0x561ce5['query'][_0xbc87('0x5e')]);_0x58c334[_0xbc87('0x35')]=qs['filters'](_['pick'](_0x561ce5[_0xbc87('0x26')],_0x21e545[_0xbc87('0x30')]));_0x58c334[_0xbc87('0x35')]['OpenchannelInteractionId']=_0x18841d['id'];if(_0x561ce5[_0xbc87('0x26')][_0xbc87('0x5f')]){_0x58c334[_0xbc87('0x35')]=_['merge'](_0x58c334[_0xbc87('0x35')],{'$or':_[_0xbc87('0x36')](_0x58c334[_0xbc87('0x2a')],function(_0x34f111){var _0x52e84f={};_0x52e84f[_0x34f111]={'$like':'%'+_0x561ce5[_0xbc87('0x26')][_0xbc87('0x5f')]+'%'};return _0x52e84f;})});}if(_0x561ce5[_0xbc87('0x26')][_0xbc87('0x60')]){var _0x1a65bb=_0x561ce5[_0xbc87('0x26')][_0xbc87('0x60')][_0xbc87('0x61')](',');var _0xb645d7={};_0xb645d7[_0x1a65bb[0x0]]={'$gte':moment(_0x1a65bb[0x1])['format'](_0xbc87('0x62'))};_0x58c334['where']=_[_0xbc87('0x34')](_0x58c334['where'],_0xb645d7);}_0x58c334=_[_0xbc87('0x34')]({},_0x58c334,_0x561ce5[_0xbc87('0x37')]);return db[_0xbc87('0x59')][_0xbc87('0x19')]({'where':_0x58c334[_0xbc87('0x35')]})[_0xbc87('0x1e')](function(_0x3306c8){_0x3e0134[_0xbc87('0x19')]=_0x3306c8;if(_0x561ce5['query']['includeAll']){_0x58c334['include']=[{'all':!![]}];}return db[_0xbc87('0x59')][_0xbc87('0x4d')](_0x58c334);})['then'](function(_0x58bb4c){_0x3e0134[_0xbc87('0x4e')]=_0x58bb4c;return _0x3e0134;});}})['then'](respondWithFilteredResult(_0x545bb2,_0x58c334))['catch'](handleError(_0x545bb2,null));};exports[_0xbc87('0x63')]=function(_0x102d25,_0x4d8992,_0x126046){return db[_0xbc87('0x23')]['find']({'where':{'id':_0x102d25[_0xbc87('0x51')]['id']}})[_0xbc87('0x1e')](handleEntityNotFound(_0x4d8992,null))['then'](function(_0x5ba135){if(_0x5ba135){return _0x5ba135[_0xbc87('0x64')](_0x102d25[_0xbc87('0x54')][_0xbc87('0x5a')],_[_0xbc87('0x5b')](_0x102d25[_0xbc87('0x54')],[_0xbc87('0x5a'),'id'])||{})['spread'](function(){return db[_0xbc87('0x3b')]['findAll']({'attributes':['id',_0xbc87('0x20'),'color'],'where':{'id':_0x102d25[_0xbc87('0x54')]['ids']}});})['then'](function(_0x59dcfc){socket['emit'](_0xbc87('0x65'),{'id':Number(_0x102d25[_0xbc87('0x51')]['id']),'tags':_0x59dcfc||[]});return{'id':Number(_0x102d25['params']['id']),'tags':_0x59dcfc||[]};});}})['then'](respondWithResult(_0x4d8992,null))[_0xbc87('0x4f')](handleError(_0x4d8992,null));};exports[_0xbc87('0x66')]=function(_0x1e875a,_0x34ac8c,_0x20b9b1){var _0x10e708;return db[_0xbc87('0x23')][_0xbc87('0x55')]({'where':{'id':_0x1e875a['params']['id']}})[_0xbc87('0x1e')](handleEntityNotFound(_0x34ac8c,null))['then'](function(_0x502685){if(_0x502685){return _0x502685[_0xbc87('0x66')](_0x1e875a[_0xbc87('0x26')][_0xbc87('0x5a')]);}})[_0xbc87('0x1e')](respondWithStatusCode(_0x34ac8c,null))[_0xbc87('0x4f')](handleError(_0x34ac8c,null));}; \ No newline at end of file +var _0x9d3e=['destroy','stack','name','send','index','OpenchannelInteraction','model','dateStart','dateEnd','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','add','day','merge','filter','map','options','include','tag','Tag','Tags','distinct','read','push','OpenchannelMessage','Messages','direction','createdAt','User','fullname','CmContact','Contact','Owner','internal','OpenchannelAccount','key','ThroughTags','color','findAll','rows','params','rawAttributes','includeAll','catch','create','body','update','find','describe','addMessage','omit','ids','getMessages','order','OpenchannelInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then'];(function(_0x36f72f,_0x4ffea3){var _0xea2851=function(_0x27ef35){while(--_0x27ef35){_0x36f72f['push'](_0x36f72f['shift']());}};_0xea2851(++_0x4ffea3);}(_0x9d3e,0x11e));var _0xe9d3=function(_0xf74558,_0x10a5cc){_0xf74558=_0xf74558-0x0;var _0xf58510=_0x9d3e[_0xf74558];return _0xf58510;};'use strict';var jsonpatch=require(_0xe9d3('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9d3('0x1'));var util=require('util');var path=require(_0xe9d3('0x2'));var sox=require(_0xe9d3('0x3'));var csv=require(_0xe9d3('0x4'));var ejs=require(_0xe9d3('0x5'));var fs=require('fs');var _=require(_0xe9d3('0x6'));var squel=require(_0xe9d3('0x7'));var crypto=require(_0xe9d3('0x8'));var jsforce=require(_0xe9d3('0x9'));var deskjs=require(_0xe9d3('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe9d3('0xb'));var Papa=require(_0xe9d3('0xc'));var qs=require(_0xe9d3('0xd'));var logger=require(_0xe9d3('0xe'))(_0xe9d3('0xf'));var utils=require(_0xe9d3('0x10'));var config=require(_0xe9d3('0x11'));var db=require(_0xe9d3('0x12'))['db'];var socket=require(_0xe9d3('0x13'))({'host':'localhost','port':0x18eb});require(_0xe9d3('0x14'))['register'](socket);function respondWithStatusCode(_0x248fa1,_0x75c336){_0x75c336=_0x75c336||0xcc;return function(_0x57fb5b){if(_0x57fb5b){return _0x248fa1[_0xe9d3('0x15')](_0x75c336);}return _0x248fa1[_0xe9d3('0x16')](_0x75c336)['end']();};}function respondWithResult(_0x527d1e,_0x4f8f3a){_0x4f8f3a=_0x4f8f3a||0xc8;return function(_0x2350f6){if(_0x2350f6){return _0x527d1e[_0xe9d3('0x16')](_0x4f8f3a)[_0xe9d3('0x17')](_0x2350f6);}};}function respondWithFilteredResult(_0x17bd4d,_0x2d5ea2){return function(_0xcdd915){if(_0xcdd915){var _0x30b07e=_0xcdd915[_0xe9d3('0x18')],_0x55dcc4=_0x2d5ea2[_0xe9d3('0x19')],_0x51bcd5=_0x2d5ea2[_0xe9d3('0x19')]+_0x2d5ea2[_0xe9d3('0x1a')],_0x5d86ed;if(_0x51bcd5>=_0x30b07e){_0x51bcd5=_0x30b07e;_0x5d86ed=0xc8;}else{_0x5d86ed=0xce;}_0x17bd4d[_0xe9d3('0x16')](_0x5d86ed);return _0x17bd4d[_0xe9d3('0x1b')]('Content-Range',_0x55dcc4+'-'+_0x51bcd5+'/'+_0x30b07e)['json'](_0xcdd915);}return null;};}function patchUpdates(_0x2450bc){return function(_0x2416cc){try{jsonpatch[_0xe9d3('0x1c')](_0x2416cc,_0x2450bc,!![]);}catch(_0x3c606c){return BPromise[_0xe9d3('0x1d')](_0x3c606c);}return _0x2416cc[_0xe9d3('0x1e')]();};}function saveUpdates(_0x34c030,_0xe8f151){return function(_0x1141ae){if(_0x1141ae){return _0x1141ae['update'](_0x34c030)[_0xe9d3('0x1f')](function(_0x3b4f18){return _0x3b4f18;});}return null;};}function removeEntity(_0x306f9f,_0x5130af){return function(_0x1afbc2){if(_0x1afbc2){return _0x1afbc2[_0xe9d3('0x20')]()[_0xe9d3('0x1f')](function(){_0x306f9f[_0xe9d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x297921,_0x1fa334){return function(_0x259b00){if(!_0x259b00){_0x297921[_0xe9d3('0x15')](0x194);}return _0x259b00;};}function handleError(_0xe51277,_0x42fab3){_0x42fab3=_0x42fab3||0x1f4;return function(_0x454cef){logger['error'](_0x454cef[_0xe9d3('0x21')]);if(_0x454cef[_0xe9d3('0x22')]){delete _0x454cef[_0xe9d3('0x22')];}_0xe51277[_0xe9d3('0x16')](_0x42fab3)[_0xe9d3('0x23')](_0x454cef);};}exports[_0xe9d3('0x24')]=function(_0x2e2bf5,_0x3dda78){var _0x1e5825={},_0xc2c21f={},_0x3715fc={'count':0x0,'rows':[]};var _0x22a30b=db[_0xe9d3('0x25')]['rawAttributes'];_0xc2c21f[_0xe9d3('0x26')]=_['keys'](_0x22a30b);var _0x14126b={'dateStart':_0x2e2bf5['query'][_0xe9d3('0x27')],'dateEnd':_0x2e2bf5['query'][_0xe9d3('0x28')]};delete _0x2e2bf5[_0xe9d3('0x29')][_0xe9d3('0x27')];delete _0x2e2bf5['query'][_0xe9d3('0x28')];_0xc2c21f[_0xe9d3('0x29')]=_[_0xe9d3('0x2a')](_0x2e2bf5[_0xe9d3('0x29')]);_0xc2c21f['filters']=_[_0xe9d3('0x2b')](_0xc2c21f['model'],_0xc2c21f[_0xe9d3('0x29')]);_0x1e5825['attributes']=_[_0xe9d3('0x2b')](_0xc2c21f[_0xe9d3('0x26')],qs[_0xe9d3('0x2c')](_0x2e2bf5[_0xe9d3('0x29')][_0xe9d3('0x2c')]));_0x1e5825['attributes']=_0x1e5825[_0xe9d3('0x2d')][_0xe9d3('0x2e')]?_0x1e5825[_0xe9d3('0x2d')]:_0xc2c21f['model'];if(!_0x2e2bf5['query'][_0xe9d3('0x2f')](_0xe9d3('0x30'))){_0x1e5825[_0xe9d3('0x1a')]=qs[_0xe9d3('0x1a')](_0x2e2bf5['query']['limit']);_0x1e5825[_0xe9d3('0x19')]=qs[_0xe9d3('0x19')](_0x2e2bf5['query'][_0xe9d3('0x19')]);}_0x1e5825['order']=qs[_0xe9d3('0x31')](_0x2e2bf5[_0xe9d3('0x29')][_0xe9d3('0x31')]);_0x1e5825[_0xe9d3('0x32')]=qs[_0xe9d3('0x33')](_[_0xe9d3('0x34')](_0x2e2bf5[_0xe9d3('0x29')],_0xc2c21f[_0xe9d3('0x33')]));if(_0x14126b[_0xe9d3('0x27')]){if(_0x14126b['dateEnd']){_0x14126b[_0xe9d3('0x28')]=moment(_0x14126b['dateEnd'])[_0xe9d3('0x35')](0x1,_0xe9d3('0x36'));}else{_0x14126b[_0xe9d3('0x28')]=moment(_0x14126b[_0xe9d3('0x27')])[_0xe9d3('0x35')](0x1,'day');}_[_0xe9d3('0x37')](_0x1e5825[_0xe9d3('0x32')],{'createdAt':{'$gte':_0x14126b[_0xe9d3('0x27')],'$lte':_0x14126b[_0xe9d3('0x28')]}});}if(_0x2e2bf5[_0xe9d3('0x29')][_0xe9d3('0x38')]){_0x1e5825['where']=_[_0xe9d3('0x37')](_0x1e5825[_0xe9d3('0x32')],{'$or':_[_0xe9d3('0x39')](_0x1e5825[_0xe9d3('0x2d')],function(_0x58df15){var _0xcb7c13={};_0xcb7c13[_0x58df15]={'$like':'%'+_0x2e2bf5['query'][_0xe9d3('0x38')]+'%'};return _0xcb7c13;})});}_0x1e5825=_[_0xe9d3('0x37')]({},_0x1e5825,_0x2e2bf5[_0xe9d3('0x3a')]);var _0x39f77c={'where':_0x1e5825[_0xe9d3('0x32')]};_0x39f77c[_0xe9d3('0x3b')]=[];if(_0x2e2bf5[_0xe9d3('0x29')][_0xe9d3('0x3c')]){_0x39f77c['include']['push']({'model':db[_0xe9d3('0x3d')],'as':_0xe9d3('0x3e'),'attributes':['id'],'where':{'id':_0x2e2bf5[_0xe9d3('0x29')]['tag']},'required':!![]});_0x39f77c[_0xe9d3('0x3f')]=!![];}if(_0x2e2bf5['query'][_0xe9d3('0x40')]){_0x39f77c['include'][_0xe9d3('0x41')]({'model':db[_0xe9d3('0x42')],'as':_0xe9d3('0x43'),'attributes':['id',_0xe9d3('0x44'),_0xe9d3('0x45'),'read'],'where':{'direction':'in','read':_0x2e2bf5['query'][_0xe9d3('0x40')]||![]},'required':!![]});_0x39f77c[_0xe9d3('0x3f')]=!![];}return db[_0xe9d3('0x25')][_0xe9d3('0x18')](_0x39f77c)['then'](function(_0x1a1fe4){_0x3715fc[_0xe9d3('0x18')]=_0x1a1fe4;if(_0x2e2bf5[_0xe9d3('0x29')]['includeAll']){_0x1e5825[_0xe9d3('0x3b')]=[{'model':db[_0xe9d3('0x46')],'as':'Users','required':![],'attributes':['id',_0xe9d3('0x22'),_0xe9d3('0x47')]},{'model':db[_0xe9d3('0x48')],'as':_0xe9d3('0x49'),'required':![]},{'model':db[_0xe9d3('0x46')],'as':_0xe9d3('0x4a'),'attributes':['name',_0xe9d3('0x47'),_0xe9d3('0x4b')],'required':![]},{'model':db[_0xe9d3('0x4c')],'as':'Account','attributes':[_0xe9d3('0x22'),_0xe9d3('0x4d')],'required':![]},{'model':db[_0xe9d3('0x42')],'as':'Messages','attributes':['id','direction',_0xe9d3('0x45'),'read'],'where':{'direction':'in','read':_0x2e2bf5[_0xe9d3('0x29')]['read']||![]},'required':_0x2e2bf5['query'][_0xe9d3('0x40')]||![]},{'model':db[_0xe9d3('0x3d')],'as':_0xe9d3('0x3e'),'attributes':['id',_0xe9d3('0x22'),'color'],'required':_0x2e2bf5['query'][_0xe9d3('0x3c')]?!![]:![]},{'model':db[_0xe9d3('0x3d')],'as':_0xe9d3('0x4e'),'attributes':['id',_0xe9d3('0x22'),_0xe9d3('0x4f')],'through':_0x2e2bf5[_0xe9d3('0x29')]['tag']?{'attributes':[],'where':{'TagId':_0x2e2bf5['query'][_0xe9d3('0x3c')]||undefined}}:{},'required':_0x2e2bf5[_0xe9d3('0x29')][_0xe9d3('0x3c')]?!![]:![]}];}return db[_0xe9d3('0x25')][_0xe9d3('0x50')](_0x1e5825);})[_0xe9d3('0x1f')](function(_0x1d4ca5){_0x3715fc[_0xe9d3('0x51')]=_0x1d4ca5;return _0x3715fc;})[_0xe9d3('0x1f')](respondWithFilteredResult(_0x3dda78,_0x1e5825))['catch'](handleError(_0x3dda78,null));};exports['show']=function(_0x5391c2,_0x5255f0){var _0x4ee79c={'raw':![],'where':{'id':_0x5391c2[_0xe9d3('0x52')]['id']}},_0x1a20b5={};_0x1a20b5[_0xe9d3('0x26')]=_[_0xe9d3('0x2a')](db[_0xe9d3('0x25')][_0xe9d3('0x53')]);_0x1a20b5[_0xe9d3('0x29')]=_[_0xe9d3('0x2a')](_0x5391c2['query']);_0x1a20b5[_0xe9d3('0x33')]=_[_0xe9d3('0x2b')](_0x1a20b5[_0xe9d3('0x26')],_0x1a20b5[_0xe9d3('0x29')]);_0x4ee79c['attributes']=_[_0xe9d3('0x2b')](_0x1a20b5[_0xe9d3('0x26')],qs[_0xe9d3('0x2c')](_0x5391c2[_0xe9d3('0x29')][_0xe9d3('0x2c')]));_0x4ee79c[_0xe9d3('0x2d')]=_0x4ee79c[_0xe9d3('0x2d')][_0xe9d3('0x2e')]?_0x4ee79c[_0xe9d3('0x2d')]:_0x1a20b5[_0xe9d3('0x26')];if(_0x5391c2[_0xe9d3('0x29')][_0xe9d3('0x54')]){_0x4ee79c[_0xe9d3('0x3b')]=[{'all':!![]}];}_0x4ee79c=_[_0xe9d3('0x37')]({},_0x4ee79c,_0x5391c2[_0xe9d3('0x3a')]);return db[_0xe9d3('0x25')]['find'](_0x4ee79c)[_0xe9d3('0x1f')](handleEntityNotFound(_0x5255f0,null))['then'](respondWithResult(_0x5255f0,null))[_0xe9d3('0x55')](handleError(_0x5255f0,null));};exports['create']=function(_0x254c5f,_0x435782){return db[_0xe9d3('0x25')][_0xe9d3('0x56')](_0x254c5f[_0xe9d3('0x57')],{})[_0xe9d3('0x1f')](respondWithResult(_0x435782,0xc9))[_0xe9d3('0x55')](handleError(_0x435782,null));};exports[_0xe9d3('0x58')]=function(_0x3c0b31,_0x109881){if(_0x3c0b31[_0xe9d3('0x57')]['id']){delete _0x3c0b31[_0xe9d3('0x57')]['id'];}return db[_0xe9d3('0x25')][_0xe9d3('0x59')]({'where':{'id':_0x3c0b31[_0xe9d3('0x52')]['id']}})[_0xe9d3('0x1f')](handleEntityNotFound(_0x109881,null))[_0xe9d3('0x1f')](saveUpdates(_0x3c0b31[_0xe9d3('0x57')],null))[_0xe9d3('0x1f')](respondWithResult(_0x109881,null))[_0xe9d3('0x55')](handleError(_0x109881,null));};exports[_0xe9d3('0x20')]=function(_0x475037,_0x24f6a9){return db['OpenchannelInteraction']['find']({'where':{'id':_0x475037[_0xe9d3('0x52')]['id']}})[_0xe9d3('0x1f')](handleEntityNotFound(_0x24f6a9,null))[_0xe9d3('0x1f')](removeEntity(_0x24f6a9,null))[_0xe9d3('0x55')](handleError(_0x24f6a9,null));};exports[_0xe9d3('0x5a')]=function(_0xabdb5b,_0x41f557){return db[_0xe9d3('0x25')][_0xe9d3('0x5a')]()['then'](respondWithResult(_0x41f557,null))[_0xe9d3('0x55')](handleError(_0x41f557,null));};exports[_0xe9d3('0x5b')]=function(_0x109f9b,_0x282f58,_0x354308){return db['OpenchannelMessage']['find']({'where':{'id':_0x109f9b[_0xe9d3('0x52')]['id']}})[_0xe9d3('0x1f')](handleEntityNotFound(_0x282f58,null))['then'](function(_0xe60158){if(_0xe60158){return _0xe60158[_0xe9d3('0x5b')](_0x109f9b[_0xe9d3('0x57')]['ids'],_[_0xe9d3('0x5c')](_0x109f9b[_0xe9d3('0x57')],[_0xe9d3('0x5d'),'id'])||{});}})[_0xe9d3('0x1f')](respondWithResult(_0x282f58,null))['catch'](handleError(_0x282f58,null));};exports[_0xe9d3('0x5e')]=function(_0x4c2838,_0x3c3a46,_0x1fb18d){var _0xf171eb={'raw':![],'where':{}};var _0x2a52d0={};var _0x131e80={'count':0x0,'rows':[]};return db[_0xe9d3('0x25')]['findOne']({'where':{'id':_0x4c2838[_0xe9d3('0x52')]['id']}})['then'](handleEntityNotFound(_0x3c3a46,null))['then'](function(_0x4889f4){if(_0x4889f4){_0x2a52d0[_0xe9d3('0x26')]=_[_0xe9d3('0x2a')](db[_0xe9d3('0x42')][_0xe9d3('0x53')]);_0x2a52d0['query']=_[_0xe9d3('0x2a')](_0x4c2838[_0xe9d3('0x29')]);_0x2a52d0[_0xe9d3('0x33')]=_['intersection'](_0x2a52d0[_0xe9d3('0x26')],_0x2a52d0[_0xe9d3('0x29')]);_0xf171eb[_0xe9d3('0x2d')]=_[_0xe9d3('0x2b')](_0x2a52d0[_0xe9d3('0x26')],qs[_0xe9d3('0x2c')](_0x4c2838[_0xe9d3('0x29')][_0xe9d3('0x2c')]));_0xf171eb[_0xe9d3('0x2d')]=_0xf171eb[_0xe9d3('0x2d')][_0xe9d3('0x2e')]?_0xf171eb[_0xe9d3('0x2d')]:_0x2a52d0['model'];if(!_0x4c2838[_0xe9d3('0x29')][_0xe9d3('0x2f')](_0xe9d3('0x30'))){_0xf171eb[_0xe9d3('0x1a')]=qs[_0xe9d3('0x1a')](_0x4c2838['query'][_0xe9d3('0x1a')]);_0xf171eb['offset']=qs[_0xe9d3('0x19')](_0x4c2838[_0xe9d3('0x29')][_0xe9d3('0x19')]);}_0xf171eb[_0xe9d3('0x5f')]=qs[_0xe9d3('0x31')](_0x4c2838[_0xe9d3('0x29')][_0xe9d3('0x31')]);_0xf171eb[_0xe9d3('0x32')]=qs[_0xe9d3('0x33')](_[_0xe9d3('0x34')](_0x4c2838[_0xe9d3('0x29')],_0x2a52d0[_0xe9d3('0x33')]));_0xf171eb[_0xe9d3('0x32')][_0xe9d3('0x60')]=_0x4889f4['id'];if(_0x4c2838[_0xe9d3('0x29')][_0xe9d3('0x38')]){_0xf171eb[_0xe9d3('0x32')]=_[_0xe9d3('0x37')](_0xf171eb['where'],{'$or':_[_0xe9d3('0x39')](_0xf171eb[_0xe9d3('0x2d')],function(_0x33414c){var _0x4e38b9={};_0x4e38b9[_0x33414c]={'$like':'%'+_0x4c2838[_0xe9d3('0x29')]['filter']+'%'};return _0x4e38b9;})});}if(_0x4c2838[_0xe9d3('0x29')][_0xe9d3('0x61')]){var _0x49f4be=_0x4c2838['query'][_0xe9d3('0x61')]['split'](',');var _0x5f29eb={};_0x5f29eb[_0x49f4be[0x0]]={'$gte':moment(_0x49f4be[0x1])[_0xe9d3('0x62')](_0xe9d3('0x63'))};_0xf171eb[_0xe9d3('0x32')]=_[_0xe9d3('0x37')](_0xf171eb[_0xe9d3('0x32')],_0x5f29eb);}_0xf171eb=_['merge']({},_0xf171eb,_0x4c2838[_0xe9d3('0x3a')]);return db['OpenchannelMessage'][_0xe9d3('0x18')]({'where':_0xf171eb['where']})[_0xe9d3('0x1f')](function(_0x25c337){_0x131e80[_0xe9d3('0x18')]=_0x25c337;if(_0x4c2838['query'][_0xe9d3('0x54')]){_0xf171eb[_0xe9d3('0x3b')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xe9d3('0x50')](_0xf171eb);})[_0xe9d3('0x1f')](function(_0x451df1){_0x131e80[_0xe9d3('0x51')]=_0x451df1;return _0x131e80;});}})[_0xe9d3('0x1f')](respondWithFilteredResult(_0x3c3a46,_0xf171eb))['catch'](handleError(_0x3c3a46,null));};exports[_0xe9d3('0x64')]=function(_0x446c37,_0xbff480,_0x1c0b1f){return db['OpenchannelInteraction'][_0xe9d3('0x59')]({'where':{'id':_0x446c37[_0xe9d3('0x52')]['id']}})['then'](handleEntityNotFound(_0xbff480,null))[_0xe9d3('0x1f')](function(_0x2ec7b5){if(_0x2ec7b5){return _0x2ec7b5[_0xe9d3('0x65')](_0x446c37[_0xe9d3('0x57')][_0xe9d3('0x5d')],_[_0xe9d3('0x5c')](_0x446c37[_0xe9d3('0x57')],[_0xe9d3('0x5d'),'id'])||{})[_0xe9d3('0x66')](function(){return db[_0xe9d3('0x3d')]['findAll']({'attributes':['id',_0xe9d3('0x22'),'color'],'where':{'id':_0x446c37[_0xe9d3('0x57')][_0xe9d3('0x5d')]}});})['then'](function(_0x4ad229){socket[_0xe9d3('0x67')](_0xe9d3('0x68'),{'id':Number(_0x446c37[_0xe9d3('0x52')]['id']),'tags':_0x4ad229||[]});return{'id':Number(_0x446c37['params']['id']),'tags':_0x4ad229||[]};});}})[_0xe9d3('0x1f')](respondWithResult(_0xbff480,null))[_0xe9d3('0x55')](handleError(_0xbff480,null));};exports[_0xe9d3('0x69')]=function(_0x2a1238,_0x30cee4,_0x599023){var _0x32ccb1;return db['OpenchannelInteraction'][_0xe9d3('0x59')]({'where':{'id':_0x2a1238[_0xe9d3('0x52')]['id']}})[_0xe9d3('0x1f')](handleEntityNotFound(_0x30cee4,null))[_0xe9d3('0x1f')](function(_0xc6636c){if(_0xc6636c){return _0xc6636c[_0xe9d3('0x69')](_0x2a1238[_0xe9d3('0x29')][_0xe9d3('0x5d')]);}})[_0xe9d3('0x1f')](respondWithStatusCode(_0x30cee4,null))[_0xe9d3('0x55')](handleError(_0x30cee4,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f5768bc..e2186eb 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 _0x648a=['remove','emit','hasOwnProperty','exports','events','setMaxListeners','update'];(function(_0x575eb4,_0x426565){var _0xfc4a8f=function(_0x226b6b){while(--_0x226b6b){_0x575eb4['push'](_0x575eb4['shift']());}};_0xfc4a8f(++_0x426565);}(_0x648a,0x1af));var _0xa648=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x648a[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0xa648('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa648('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa648('0x2'),'afterDestroy':_0xa648('0x3')};function emitEvent(_0x138fa1){return function(_0x59bee5,_0x2de888,_0x3f0c86){OpenchannelInteractionEvents[_0xa648('0x4')](_0x138fa1+':'+_0x59bee5['id'],_0x59bee5);OpenchannelInteractionEvents['emit'](_0x138fa1,_0x59bee5);_0x3f0c86(null);};}for(var e in events){if(events[_0xa648('0x5')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xa648('0x6')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6bf2=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','save'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x6bf2,0xc2));var _0x26bf=function(_0x535108,_0x3c7a19){_0x535108=_0x535108-0x0;var _0x27bb5c=_0x6bf2[_0x535108];return _0x27bb5c;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x26bf('0x0'))['db'][_0x26bf('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x26bf('0x2')](0x0);var events={'afterCreate':_0x26bf('0x3'),'afterUpdate':'update','afterDestroy':_0x26bf('0x4')};function emitEvent(_0x1bce5e){return function(_0x4c012d,_0x2e1604,_0x1f737c){OpenchannelInteractionEvents[_0x26bf('0x5')](_0x1bce5e+':'+_0x4c012d['id'],_0x4c012d);OpenchannelInteractionEvents[_0x26bf('0x5')](_0x1bce5e,_0x4c012d);_0x1f737c(null);};}for(var e in events){if(events[_0x26bf('0x6')](e)){var event=events[e];OpenchannelInteraction[_0x26bf('0x7')](e,emitEvent(event));}}module[_0x26bf('0x8')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index fa4c5ba..aa40091 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 _0x7e45=['OpenchannelInteraction','openchannel_interactions','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelInteraction.attributes'];(function(_0x2c5d4d,_0x1d4d5e){var _0x14dfe0=function(_0x47a9e4){while(--_0x47a9e4){_0x2c5d4d['push'](_0x2c5d4d['shift']());}};_0x14dfe0(++_0x1d4d5e);}(_0x7e45,0x1a9));var _0x57e4=function(_0x32d1a9,_0x1b470c){_0x32d1a9=_0x32d1a9-0x0;var _0x50eaf1=_0x7e45[_0x32d1a9];return _0x50eaf1;};'use strict';var _=require('lodash');var util=require(_0x57e4('0x0'));var logger=require(_0x57e4('0x1'))(_0x57e4('0x2'));var moment=require(_0x57e4('0x3'));var BPromise=require(_0x57e4('0x4'));var rp=require(_0x57e4('0x5'));var attributes=require(_0x57e4('0x6'));module['exports']=function(_0x2dc336,_0x7d05ff){return _0x2dc336['define'](_0x57e4('0x7'),attributes,{'tableName':_0x57e4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x660a=['define','OpenchannelInteraction','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4b10ca,_0x127f7d){var _0x5b6404=function(_0x167eca){while(--_0x167eca){_0x4b10ca['push'](_0x4b10ca['shift']());}};_0x5b6404(++_0x127f7d);}(_0x660a,0x191));var _0xa660=function(_0x202686,_0x5c3908){_0x202686=_0x202686-0x0;var _0x35ade5=_0x660a[_0x202686];return _0x35ade5;};'use strict';var _=require(_0xa660('0x0'));var util=require('util');var logger=require(_0xa660('0x1'))(_0xa660('0x2'));var moment=require(_0xa660('0x3'));var BPromise=require('bluebird');var rp=require(_0xa660('0x4'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x14ae76,_0x568ae3){return _0x14ae76[_0xa660('0x5')](_0xa660('0x6'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e61f139..bf7d740 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 _0x8164=['limit','stringify','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','error','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes'];(function(_0x102662,_0x355699){var _0x3b0762=function(_0x2040d0){while(--_0x2040d0){_0x102662['push'](_0x102662['shift']());}};_0x3b0762(++_0x355699);}(_0x8164,0x170));var _0x4816=function(_0xd6aad,_0x3fd78e){_0xd6aad=_0xd6aad-0x0;var _0x1109e6=_0x8164[_0xd6aad];return _0x1109e6;};'use strict';var _=require(_0x4816('0x0'));var util=require(_0x4816('0x1'));var moment=require(_0x4816('0x2'));var BPromise=require('bluebird');var rs=require(_0x4816('0x3'));var fs=require('fs');var db=require(_0x4816('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4816('0x5'))('rpc');var config=require(_0x4816('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4816('0x7')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x4816('0x8'))[_0x4816('0x9')](socket);function respondWithRpcPromise(_0x170e7a,_0x383974,_0x2421e1){return new BPromise(function(_0x39fbd9,_0x285cab){return client[_0x4816('0xa')](_0x170e7a,_0x2421e1)[_0x4816('0xb')](function(_0x520153){logger[_0x4816('0xc')]('OpenchannelInteraction,\x20%s,\x20%s',_0x383974,_0x4816('0xd'));logger[_0x4816('0xe')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x383974,_0x4816('0xd'),JSON['stringify'](_0x520153));if(_0x520153['error']){if(_0x520153[_0x4816('0xf')]['code']===0x1f4){logger['error'](_0x4816('0x10'),_0x383974,_0x520153['error'][_0x4816('0x11')]);return _0x285cab(_0x520153[_0x4816('0xf')][_0x4816('0x11')]);}logger[_0x4816('0xf')](_0x4816('0x10'),_0x383974,_0x520153[_0x4816('0xf')][_0x4816('0x11')]);return _0x39fbd9(_0x520153[_0x4816('0xf')][_0x4816('0x11')]);}else{logger[_0x4816('0xc')](_0x4816('0x10'),_0x383974,_0x4816('0xd'));_0x39fbd9(_0x520153[_0x4816('0x12')][_0x4816('0x11')]);}})[_0x4816('0x13')](function(_0x5c446b){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x383974,_0x5c446b);_0x285cab(_0x5c446b);});});}exports[_0x4816('0x14')]=function(_0x354fdd){var _0xb69bbb=this;return new Promise(function(_0x17b750,_0xc8ffd5){return db[_0x4816('0x15')][_0x4816('0x16')](_0x354fdd[_0x4816('0x17')],{'raw':_0x354fdd[_0x4816('0x18')]?_0x354fdd['options'][_0x4816('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354fdd['options']?_0x354fdd['options'][_0x4816('0x1a')]||null:null,'attributes':_0x354fdd[_0x4816('0x18')]?_0x354fdd['options'][_0x4816('0x1b')]||null:null,'limit':_0x354fdd['options']?_0x354fdd[_0x4816('0x18')][_0x4816('0x1c')]||null:null})['then'](function(_0x504851){logger[_0x4816('0xc')](_0x4816('0x14'),_0x354fdd);logger[_0x4816('0xe')]('UpdateOpenchannelInteraction',_0x354fdd,JSON[_0x4816('0x1d')](_0x504851));_0x17b750(_0x504851);})[_0x4816('0x13')](function(_0x126c60){logger[_0x4816('0xf')]('UpdateOpenchannelInteraction',_0x126c60['message'],_0x354fdd);_0xc8ffd5(_0xb69bbb[_0x4816('0xf')](0x1f4,_0x126c60[_0x4816('0x11')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x3c96ce){return new Promise(function(_0x4f9386,_0x551d15){return db[_0x4816('0x15')][_0x4816('0x1e')]({'where':_0x3c96ce[_0x4816('0x18')]?_0x3c96ce['options'][_0x4816('0x1a')]||null:null})['then'](function(_0x39ddbd){if(_0x39ddbd){return _0x39ddbd[_0x4816('0x1f')](_0x3c96ce['body'][_0x4816('0x20')],_[_0x4816('0x21')](_0x3c96ce[_0x4816('0x17')],[_0x4816('0x20'),'id'])||{});}})[_0x4816('0x22')](function(_0x332af7){logger[_0x4816('0xc')](_0x4816('0x23'),_0x3c96ce);logger[_0x4816('0xe')]('AddTags',_0x3c96ce,JSON[_0x4816('0x1d')](_0x332af7));_0x4f9386(_0x332af7);})[_0x4816('0x13')](function(_0x56ed76){logger['error'](_0x4816('0x23'),_0x56ed76[_0x4816('0x11')],_0x3c96ce);_0x551d15(_this[_0x4816('0xf')](0x1f4,_0x56ed76[_0x4816('0x11')]));});});}; \ No newline at end of file +var _0x1775=['spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit'];(function(_0x363b87,_0x21467d){var _0x288fee=function(_0x18b055){while(--_0x18b055){_0x363b87['push'](_0x363b87['shift']());}};_0x288fee(++_0x21467d);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var db=require(_0x5177('0x4'))['db'];var utils=require(_0x5177('0x5'));var logger=require(_0x5177('0x6'))(_0x5177('0x7'));var config=require(_0x5177('0x8'));var jayson=require(_0x5177('0x9'));var client=jayson[_0x5177('0xa')][_0x5177('0xb')]({'port':0x232a});var socket=require(_0x5177('0xc'))({'host':_0x5177('0xd'),'port':0x18eb});require(_0x5177('0xe'))[_0x5177('0xf')](socket);function respondWithRpcPromise(_0x363611,_0x3ce288,_0x16e7a7){return new BPromise(function(_0x2e5a3b,_0x2c23d8){return client[_0x5177('0x10')](_0x363611,_0x16e7a7)['then'](function(_0x4ae3d2){logger[_0x5177('0x11')](_0x5177('0x12'),_0x3ce288,_0x5177('0x13'));logger[_0x5177('0x14')](_0x5177('0x15'),_0x3ce288,'request\x20sent',JSON[_0x5177('0x16')](_0x4ae3d2));if(_0x4ae3d2[_0x5177('0x17')]){if(_0x4ae3d2[_0x5177('0x17')][_0x5177('0x18')]===0x1f4){logger[_0x5177('0x17')](_0x5177('0x12'),_0x3ce288,_0x4ae3d2[_0x5177('0x17')][_0x5177('0x19')]);return _0x2c23d8(_0x4ae3d2[_0x5177('0x17')][_0x5177('0x19')]);}logger[_0x5177('0x17')](_0x5177('0x12'),_0x3ce288,_0x4ae3d2[_0x5177('0x17')][_0x5177('0x19')]);return _0x2e5a3b(_0x4ae3d2[_0x5177('0x17')][_0x5177('0x19')]);}else{logger[_0x5177('0x11')](_0x5177('0x12'),_0x3ce288,_0x5177('0x13'));_0x2e5a3b(_0x4ae3d2['result'][_0x5177('0x19')]);}})[_0x5177('0x1a')](function(_0x3f5ab5){logger[_0x5177('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3ce288,_0x3f5ab5);_0x2c23d8(_0x3f5ab5);});});}exports[_0x5177('0x1b')]=function(_0x2ebf91){var _0x13d5d4=this;return new Promise(function(_0x5b5918,_0x86f5f8){return db['OpenchannelInteraction'][_0x5177('0x1c')](_0x2ebf91[_0x5177('0x1d')],{'raw':_0x2ebf91[_0x5177('0x1e')]?_0x2ebf91[_0x5177('0x1e')][_0x5177('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ebf91[_0x5177('0x1e')]?_0x2ebf91[_0x5177('0x1e')][_0x5177('0x20')]||null:null,'attributes':_0x2ebf91[_0x5177('0x1e')]?_0x2ebf91[_0x5177('0x1e')][_0x5177('0x21')]||null:null,'limit':_0x2ebf91[_0x5177('0x1e')]?_0x2ebf91['options'][_0x5177('0x22')]||null:null})['then'](function(_0x30b60f){logger[_0x5177('0x11')](_0x5177('0x1b'),_0x2ebf91);logger[_0x5177('0x14')]('UpdateOpenchannelInteraction',_0x2ebf91,JSON[_0x5177('0x16')](_0x30b60f));_0x5b5918(_0x30b60f);})['catch'](function(_0x564139){logger[_0x5177('0x17')](_0x5177('0x1b'),_0x564139['message'],_0x2ebf91);_0x86f5f8(_0x13d5d4[_0x5177('0x17')](0x1f4,_0x564139['message']));});});};exports[_0x5177('0x23')]=function(_0x1cbd29){return new Promise(function(_0x58846c,_0x3e021a){return db[_0x5177('0x24')][_0x5177('0x25')]({'where':_0x1cbd29[_0x5177('0x1e')]?_0x1cbd29[_0x5177('0x1e')][_0x5177('0x20')]||null:null})['then'](function(_0x498fcd){if(_0x498fcd){return _0x498fcd[_0x5177('0x26')](_0x1cbd29[_0x5177('0x1d')][_0x5177('0x27')],_[_0x5177('0x28')](_0x1cbd29[_0x5177('0x1d')],[_0x5177('0x27'),'id'])||{});}})[_0x5177('0x29')](function(_0x72dced){logger['info'](_0x5177('0x2a'),_0x1cbd29);logger[_0x5177('0x14')]('AddTags',_0x1cbd29,JSON[_0x5177('0x16')](_0x72dced));_0x58846c(_0x72dced);})['catch'](function(_0x172b36){logger[_0x5177('0x17')](_0x5177('0x2a'),_0x172b36['message'],_0x1cbd29);_0x3e021a(_this['error'](0x1f4,_0x172b36[_0x5177('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7aa425c..d4b1ecc 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 _0x4a84=['removeListener','length','openchannelInteraction:','save','emit'];(function(_0x56984b,_0x4bd909){var _0x42024b=function(_0x3532ca){while(--_0x3532ca){_0x56984b['push'](_0x56984b['shift']());}};_0x42024b(++_0x4bd909);}(_0x4a84,0xc6));var _0x44a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4a84[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x44a8('0x0'),'remove','update'];function createListener(_0x17d7d7,_0x80225e){return function(_0x3ae0dc){_0x80225e[_0x44a8('0x1')](_0x17d7d7,_0x3ae0dc);};}function removeListener(_0x4b5866,_0x5021c8){return function(){OpenchannelInteractionEvents[_0x44a8('0x2')](_0x4b5866,_0x5021c8);};}exports['register']=function(_0x1434db){for(var _0x52eb88=0x0,_0xa2f5a1=events[_0x44a8('0x3')];_0x52eb88<_0xa2f5a1;_0x52eb88++){var _0x57cbfb=events[_0x52eb88];var _0x42793c=createListener(_0x44a8('0x4')+_0x57cbfb,_0x1434db);OpenchannelInteractionEvents['on'](_0x57cbfb,_0x42793c);}}; \ No newline at end of file +var _0x6f84=['emit','register','length','remove','update'];(function(_0x2f5bed,_0x40820c){var _0x4706b5=function(_0xd25b00){while(--_0xd25b00){_0x2f5bed['push'](_0x2f5bed['shift']());}};_0x4706b5(++_0x40820c);}(_0x6f84,0x71));var _0x46f8=function(_0x174272,_0x12f501){_0x174272=_0x174272-0x0;var _0x589ed4=_0x6f84[_0x174272];return _0x589ed4;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x46f8('0x0'),_0x46f8('0x1')];function createListener(_0x470ee0,_0x18dbb6){return function(_0x13104e){_0x18dbb6[_0x46f8('0x2')](_0x470ee0,_0x13104e);};}function removeListener(_0x2b464c,_0x1665cd){return function(){OpenchannelInteractionEvents['removeListener'](_0x2b464c,_0x1665cd);};}exports[_0x46f8('0x3')]=function(_0xbd8373){for(var _0x3df14d=0x0,_0x21edee=events[_0x46f8('0x4')];_0x3df14d<_0x21edee;_0x3df14d++){var _0x294707=events[_0x3df14d];var _0x12122f=createListener('openchannelInteraction:'+_0x294707,_0xbd8373);OpenchannelInteractionEvents['on'](_0x294707,_0x12122f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b91d488..1561cc4 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 _0xf901=['openchannelmessage:create','create','update','put','/:id/accept','/:id/reject','reject','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','openchannel'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0xf901,0x135));var _0x1f90=function(_0xff10a,_0x416626){_0xff10a=_0xff10a-0x0;var _0x260a64=_0xf901[_0xff10a];return _0x260a64;};'use strict';var multer=require(_0x1f90('0x0'));var util=require('util');var path=require(_0x1f90('0x1'));var express=require(_0x1f90('0x2'));var router=express[_0x1f90('0x3')]();var auth=require(_0x1f90('0x4'));var interaction=require(_0x1f90('0x5'));var config=require('../../config/environment');var controller=require(_0x1f90('0x6'));router[_0x1f90('0x7')]('/',auth[_0x1f90('0x8')](),controller[_0x1f90('0x9')]);router[_0x1f90('0x7')](_0x1f90('0xa'),auth[_0x1f90('0x8')](),controller['describe']);router['get'](_0x1f90('0xb'),auth[_0x1f90('0x8')](),controller[_0x1f90('0xc')]);router[_0x1f90('0xd')]('/',auth[_0x1f90('0x8')](),interaction[_0x1f90('0xe')](_0x1f90('0xf'),_0x1f90('0x10')),controller[_0x1f90('0x11')]);router['put'](_0x1f90('0xb'),auth['isAuthenticated'](),controller[_0x1f90('0x12')]);router[_0x1f90('0x13')](_0x1f90('0x14'),auth[_0x1f90('0x8')](),controller['accept']);router[_0x1f90('0x13')](_0x1f90('0x15'),auth[_0x1f90('0x8')](),controller[_0x1f90('0x16')]);router[_0x1f90('0x17')](_0x1f90('0xb'),auth[_0x1f90('0x8')](),controller['destroy']);module[_0x1f90('0x18')]=router; \ No newline at end of file +var _0xb3d8=['describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','../../components/auth/service','get','index','isAuthenticated'];(function(_0x544e86,_0x45a270){var _0x359f2f=function(_0x374bda){while(--_0x374bda){_0x544e86['push'](_0x544e86['shift']());}};_0x359f2f(++_0x45a270);}(_0xb3d8,0xfd));var _0x8b3d=function(_0x763937,_0x4610d5){_0x763937=_0x763937-0x0;var _0x5e7889=_0xb3d8[_0x763937];return _0x5e7889;};'use strict';var multer=require(_0x8b3d('0x0'));var util=require(_0x8b3d('0x1'));var path=require(_0x8b3d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8b3d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelMessage.controller');router[_0x8b3d('0x4')]('/',auth['isAuthenticated'](),controller[_0x8b3d('0x5')]);router[_0x8b3d('0x4')]('/describe',auth[_0x8b3d('0x6')](),controller[_0x8b3d('0x7')]);router['get'](_0x8b3d('0x8'),auth[_0x8b3d('0x6')](),controller['show']);router[_0x8b3d('0x9')]('/',auth['isAuthenticated'](),interaction[_0x8b3d('0xa')](_0x8b3d('0xb'),'openchannelmessage:create'),controller[_0x8b3d('0xc')]);router[_0x8b3d('0xd')](_0x8b3d('0x8'),auth[_0x8b3d('0x6')](),controller[_0x8b3d('0xe')]);router[_0x8b3d('0xd')](_0x8b3d('0xf'),auth[_0x8b3d('0x6')](),controller['accept']);router[_0x8b3d('0xd')](_0x8b3d('0x10'),auth[_0x8b3d('0x6')](),controller[_0x8b3d('0x11')]);router['delete'](_0x8b3d('0x8'),auth[_0x8b3d('0x6')](),controller[_0x8b3d('0x12')]);module[_0x8b3d('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index fdb11ed..1b3efbf 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 _0xe3b5=['BOOLEAN','out','DATE','exports','TEXT','medium'];(function(_0x321c6e,_0x50db49){var _0x3a2d54=function(_0x1e9d63){while(--_0x1e9d63){_0x321c6e['push'](_0x321c6e['shift']());}};_0x3a2d54(++_0x50db49);}(_0xe3b5,0x1cb));var _0x5e3b=function(_0x2fc350,_0x37dcf1){_0x2fc350=_0x2fc350-0x0;var _0x2ab923=_0xe3b5[_0x2fc350];return _0x2ab923;};'use strict';var Sequelize=require('sequelize');module[_0x5e3b('0x0')]={'body':{'type':Sequelize[_0x5e3b('0x1')](_0x5e3b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5e3b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5e3b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5e3b('0x4')),'defaultValue':_0x5e3b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5e3b('0x5')]}}; \ No newline at end of file +var _0xf722=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x416b1e,_0x440638){var _0x542288=function(_0x2eb02c){while(--_0x2eb02c){_0x416b1e['push'](_0x416b1e['shift']());}};_0x542288(++_0x440638);}(_0xf722,0x12a));var _0x2f72=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf722[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x2f72('0x0'));module[_0x2f72('0x1')]={'body':{'type':Sequelize[_0x2f72('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2f72('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2f72('0x4')]('in',_0x2f72('0x5')),'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 e6e3c02..fd7ab2d 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 _0x8375=['merge','map','include','findAll','rows','params','includeAll','options','create','body','find','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','openchannel-interactions','reject','agent','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','RejectMessage','rejectMessage','event','rejectmessage','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./openchannelMessage.socket','jayson/promise','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','OpenchannelMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day'];(function(_0x17496a,_0x119801){var _0x17a248=function(_0x27abd1){while(--_0x27abd1){_0x17496a['push'](_0x17496a['shift']());}};_0x17a248(++_0x119801);}(_0x8375,0x9e));var _0x5837=function(_0x3daae6,_0x210a1d){_0x3daae6=_0x3daae6-0x0;var _0x78aa21=_0x8375[_0x3daae6];return _0x78aa21;};'use strict';var jsonpatch=require(_0x5837('0x0'));var rp=require(_0x5837('0x1'));var moment=require(_0x5837('0x2'));var BPromise=require(_0x5837('0x3'));var Mustache=require('mustache');var util=require(_0x5837('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x5837('0x5'));var ejs=require(_0x5837('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5837('0x7'));var crypto=require(_0x5837('0x8'));var jsforce=require(_0x5837('0x9'));var deskjs=require(_0x5837('0xa'));var toCsv=require(_0x5837('0x5'));var querystring=require(_0x5837('0xb'));var Papa=require(_0x5837('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x5837('0xd'))('api');var utils=require(_0x5837('0xe'));var config=require(_0x5837('0xf'));var db=require(_0x5837('0x10'))['db'];var socket=require(_0x5837('0x11'))({'host':_0x5837('0x12'),'port':0x18eb});require(_0x5837('0x13'))['register'](socket);var jayson=require(_0x5837('0x14'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x5837('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2c52,_0x1a873c,_0x5e0a12,_0xd6c55f){return new BPromise(function(_0x13bbbb,_0x46d91b){var _0x1088b3=_0xd6c55f||client;return _0x1088b3[_0x5837('0x16')](_0x3c2c52,_0x5e0a12)['then'](function(_0x4bde97){logger[_0x5837('0x17')](_0x5837('0x18'),_0x1a873c,_0x5837('0x19'));logger[_0x5837('0x1a')](_0x5837('0x1b'),_0x1a873c,_0x5837('0x19'),JSON['stringify'](_0x4bde97));if(_0x4bde97[_0x5837('0x1c')]){if(_0x4bde97[_0x5837('0x1c')]['code']===0x1f4){logger[_0x5837('0x1c')](_0x5837('0x18'),_0x1a873c,_0x4bde97[_0x5837('0x1c')][_0x5837('0x1d')]);return _0x46d91b(_0x4bde97[_0x5837('0x1c')][_0x5837('0x1d')]);}logger[_0x5837('0x1c')](_0x5837('0x18'),_0x1a873c,_0x4bde97[_0x5837('0x1c')]['message']);return _0x13bbbb(_0x4bde97[_0x5837('0x1c')][_0x5837('0x1d')]);}else{logger[_0x5837('0x17')](_0x5837('0x18'),_0x1a873c,_0x5837('0x19'));_0x13bbbb(_0x4bde97['result']['message']);}})[_0x5837('0x1e')](function(_0x40636e){logger[_0x5837('0x1c')](_0x5837('0x18'),_0x1a873c,_0x40636e);_0x46d91b(_0x40636e);});});}function respondWithStatusCode(_0xccfc08,_0x180e3f){_0x180e3f=_0x180e3f||0xcc;return function(_0x4a7bc1){if(_0x4a7bc1){return _0xccfc08[_0x5837('0x1f')](_0x180e3f);}return _0xccfc08[_0x5837('0x20')](_0x180e3f)['end']();};}function respondWithResult(_0xd187c,_0x1cce5d){_0x1cce5d=_0x1cce5d||0xc8;return function(_0x402564){if(_0x402564){return _0xd187c['status'](_0x1cce5d)[_0x5837('0x21')](_0x402564);}};}function respondWithFilteredResult(_0x1cbe86,_0x21dc64){return function(_0x2f2c8e){if(_0x2f2c8e){var _0x476c18=_0x2f2c8e[_0x5837('0x22')],_0x4767dd=_0x21dc64[_0x5837('0x23')],_0x1ecf82=_0x21dc64[_0x5837('0x23')]+_0x21dc64[_0x5837('0x24')],_0x418980;if(_0x1ecf82>=_0x476c18){_0x1ecf82=_0x476c18;_0x418980=0xc8;}else{_0x418980=0xce;}_0x1cbe86[_0x5837('0x20')](_0x418980);return _0x1cbe86[_0x5837('0x25')](_0x5837('0x26'),_0x4767dd+'-'+_0x1ecf82+'/'+_0x476c18)[_0x5837('0x21')](_0x2f2c8e);}return null;};}function patchUpdates(_0x5dc879){return function(_0x233ad9){try{jsonpatch[_0x5837('0x27')](_0x233ad9,_0x5dc879,!![]);}catch(_0x1c9138){return BPromise['reject'](_0x1c9138);}return _0x233ad9[_0x5837('0x28')]();};}function saveUpdates(_0x3f2069,_0x20afc6){return function(_0x4a7cb4){if(_0x4a7cb4){return _0x4a7cb4[_0x5837('0x29')](_0x3f2069)[_0x5837('0x2a')](function(_0x49c4be){return _0x49c4be;});}return null;};}function removeEntity(_0x2ececa,_0x5796a7){return function(_0x5096d5){if(_0x5096d5){return _0x5096d5[_0x5837('0x2b')]()[_0x5837('0x2a')](function(){_0x2ececa['status'](0xcc)[_0x5837('0x2c')]();});}};}function handleEntityNotFound(_0x55484a,_0x2effb7){return function(_0x47e715){if(!_0x47e715){_0x55484a['sendStatus'](0x194);}return _0x47e715;};}function handleError(_0x350fb8,_0x5c7658){_0x5c7658=_0x5c7658||0x1f4;return function(_0x5652da){logger[_0x5837('0x1c')](_0x5652da[_0x5837('0x2d')]);if(_0x5652da[_0x5837('0x2e')]){delete _0x5652da['name'];}_0x350fb8['status'](_0x5c7658)[_0x5837('0x2f')](_0x5652da);};}exports[_0x5837('0x30')]=function(_0x302e3d,_0x49f56e){var _0x489e6f={},_0x335d90={},_0x48211c={'count':0x0,'rows':[]};var _0x3e5c2b=db[_0x5837('0x31')][_0x5837('0x32')];_0x335d90[_0x5837('0x33')]=_[_0x5837('0x34')](_0x3e5c2b);var _0x2f76eb={'dateStart':_0x302e3d[_0x5837('0x35')][_0x5837('0x36')],'dateEnd':_0x302e3d['query'][_0x5837('0x37')]};delete _0x302e3d[_0x5837('0x35')][_0x5837('0x36')];delete _0x302e3d['query'][_0x5837('0x37')];_0x335d90['query']=_[_0x5837('0x34')](_0x302e3d[_0x5837('0x35')]);_0x335d90[_0x5837('0x38')]=_[_0x5837('0x39')](_0x335d90[_0x5837('0x33')],_0x335d90[_0x5837('0x35')]);_0x489e6f[_0x5837('0x3a')]=_[_0x5837('0x39')](_0x335d90[_0x5837('0x33')],qs[_0x5837('0x3b')](_0x302e3d[_0x5837('0x35')]['fields']));_0x489e6f['attributes']=_0x489e6f[_0x5837('0x3a')][_0x5837('0x3c')]?_0x489e6f[_0x5837('0x3a')]:_0x335d90[_0x5837('0x33')];if(!_0x302e3d[_0x5837('0x35')][_0x5837('0x3d')](_0x5837('0x3e'))){_0x489e6f[_0x5837('0x24')]=qs[_0x5837('0x24')](_0x302e3d[_0x5837('0x35')][_0x5837('0x24')]);_0x489e6f[_0x5837('0x23')]=qs[_0x5837('0x23')](_0x302e3d[_0x5837('0x35')][_0x5837('0x23')]);}_0x489e6f[_0x5837('0x3f')]=qs['sort'](_0x302e3d[_0x5837('0x35')][_0x5837('0x40')]);_0x489e6f[_0x5837('0x41')]=qs[_0x5837('0x38')](_['pick'](_0x302e3d[_0x5837('0x35')],_0x335d90[_0x5837('0x38')]));if(_0x2f76eb[_0x5837('0x36')]){if(_0x2f76eb[_0x5837('0x37')]){_0x2f76eb[_0x5837('0x37')]=moment(_0x2f76eb[_0x5837('0x37')])[_0x5837('0x42')](0x1,'day');}else{_0x2f76eb['dateEnd']=moment(_0x2f76eb[_0x5837('0x36')])[_0x5837('0x42')](0x1,_0x5837('0x43'));}_[_0x5837('0x44')](_0x489e6f[_0x5837('0x41')],{'createdAt':{'$gte':_0x2f76eb[_0x5837('0x36')],'$lte':_0x2f76eb['dateEnd']}});}if(_0x302e3d['query']['filter']){_0x489e6f[_0x5837('0x41')]=_[_0x5837('0x44')](_0x489e6f['where'],{'$or':_[_0x5837('0x45')](_0x489e6f['attributes'],function(_0x24f2e5){var _0x453708={};_0x453708[_0x24f2e5]={'$like':'%'+_0x302e3d[_0x5837('0x35')]['filter']+'%'};return _0x453708;})});}_0x489e6f=_['merge']({},_0x489e6f,_0x302e3d['options']);var _0x181822={'where':_0x489e6f[_0x5837('0x41')]};return db['OpenchannelMessage'][_0x5837('0x22')](_0x181822)[_0x5837('0x2a')](function(_0x2e4d41){_0x48211c[_0x5837('0x22')]=_0x2e4d41;if(_0x302e3d['query']['includeAll']){_0x489e6f[_0x5837('0x46')]=[{'all':!![]}];}return db[_0x5837('0x31')][_0x5837('0x47')](_0x489e6f);})[_0x5837('0x2a')](function(_0x256ab9){_0x48211c[_0x5837('0x48')]=_0x256ab9;return _0x48211c;})[_0x5837('0x2a')](respondWithFilteredResult(_0x49f56e,_0x489e6f))['catch'](handleError(_0x49f56e,null));};exports['show']=function(_0x57fd6f,_0x16187a){var _0x1c5682={'raw':!![],'where':{'id':_0x57fd6f[_0x5837('0x49')]['id']}},_0x174f8e={};_0x174f8e[_0x5837('0x33')]=_[_0x5837('0x34')](db[_0x5837('0x31')]['rawAttributes']);_0x174f8e[_0x5837('0x35')]=_[_0x5837('0x34')](_0x57fd6f[_0x5837('0x35')]);_0x174f8e['filters']=_[_0x5837('0x39')](_0x174f8e[_0x5837('0x33')],_0x174f8e[_0x5837('0x35')]);_0x1c5682['attributes']=_[_0x5837('0x39')](_0x174f8e[_0x5837('0x33')],qs[_0x5837('0x3b')](_0x57fd6f[_0x5837('0x35')]['fields']));_0x1c5682['attributes']=_0x1c5682[_0x5837('0x3a')][_0x5837('0x3c')]?_0x1c5682['attributes']:_0x174f8e['model'];if(_0x57fd6f[_0x5837('0x35')][_0x5837('0x4a')]){_0x1c5682[_0x5837('0x46')]=[{'all':!![]}];}_0x1c5682=_[_0x5837('0x44')]({},_0x1c5682,_0x57fd6f[_0x5837('0x4b')]);return db['OpenchannelMessage']['find'](_0x1c5682)[_0x5837('0x2a')](handleEntityNotFound(_0x16187a,null))[_0x5837('0x2a')](respondWithResult(_0x16187a,null))[_0x5837('0x1e')](handleError(_0x16187a,null));};exports[_0x5837('0x4c')]=function(_0x5c02ed,_0x5f0d72){return db['OpenchannelMessage'][_0x5837('0x4c')](_0x5c02ed[_0x5837('0x4d')],{})[_0x5837('0x2a')](respondWithResult(_0x5f0d72,0xc9))[_0x5837('0x1e')](handleError(_0x5f0d72,null));};exports[_0x5837('0x29')]=function(_0x57dcff,_0x4d7c36){if(_0x57dcff[_0x5837('0x4d')]['id']){delete _0x57dcff[_0x5837('0x4d')]['id'];}return db['OpenchannelMessage'][_0x5837('0x4e')]({'where':{'id':_0x57dcff[_0x5837('0x49')]['id']}})[_0x5837('0x2a')](handleEntityNotFound(_0x4d7c36,null))['then'](saveUpdates(_0x57dcff[_0x5837('0x4d')],null))[_0x5837('0x2a')](respondWithResult(_0x4d7c36,null))[_0x5837('0x1e')](handleError(_0x4d7c36,null));};exports[_0x5837('0x2b')]=function(_0x4baa7a,_0x8397f2){return db[_0x5837('0x31')][_0x5837('0x4e')]({'where':{'id':_0x4baa7a[_0x5837('0x49')]['id']}})[_0x5837('0x2a')](handleEntityNotFound(_0x8397f2,null))[_0x5837('0x2a')](removeEntity(_0x8397f2,null))[_0x5837('0x1e')](handleError(_0x8397f2,null));};exports[_0x5837('0x4f')]=function(_0x149ebb,_0x42a5ea){return db[_0x5837('0x31')]['describe']()['then'](respondWithResult(_0x42a5ea,null))['catch'](handleError(_0x42a5ea,null));};var interaction_log=require(_0x5837('0xd'))('openchannel-interactions');exports[_0x5837('0x50')]=function(_0x4cf907,_0xe231e7,_0x584978){var _0x2c7563={'channel':_0x5837('0x51')};if(_0x4cf907[_0x5837('0x4d')]['id']){delete _0x4cf907[_0x5837('0x4d')]['id'];}_0x4cf907[_0x5837('0x4d')][_0x5837('0x52')]=!![];_0x4cf907[_0x5837('0x4d')][_0x5837('0x53')]=moment()[_0x5837('0x54')](_0x5837('0x55'));_0x4cf907[_0x5837('0x4d')][_0x5837('0x56')]=_0x4cf907[_0x5837('0x4d')][_0x5837('0x56')]||_0x4cf907[_0x5837('0x57')]['id'];return db['OpenchannelMessage'][_0x5837('0x4e')]({'where':{'id':_0x4cf907[_0x5837('0x49')]['id'],'UserId':null},'include':[{'model':db[_0x5837('0x58')],'as':_0x5837('0x59')}]})[_0x5837('0x2a')](handleEntityNotFound(_0xe231e7,null))[_0x5837('0x2a')](saveUpdates(_0x4cf907['body'],null))['then'](function(_0x2ae3c1){if(_0x2ae3c1){_0x2c7563['message']=_0x2ae3c1[_0x5837('0x5a')]({'plain':!![]});return db[_0x5837('0x5b')][_0x5837('0x4e')]({'where':{'id':_0x2ae3c1[_0x5837('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0xe231e7,null))[_0x5837('0x2a')](function(_0x4ab4a7){if(_0x4ab4a7){return _0x4ab4a7[_0x5837('0x29')]({'UserId':_0x4cf907[_0x5837('0x4d')][_0x5837('0x56')],'read1stAt':_['isNil'](_0x4ab4a7['read1stAt'])?moment()['format'](_0x5837('0x55')):undefined});}return null;})['then'](function(_0x21c727){if(_0x21c727){_0x2c7563['interaction']=_0x21c727[_0x5837('0x5a')]({'plain':!![]});interaction_log[_0x5837('0x17')](_0x5837('0x5d'),_0x4cf907[_0x5837('0x57')]['id'],_0x4cf907[_0x5837('0x57')]['name'],_0x4cf907[_0x5837('0x57')][_0x5837('0x5e')],_0x2c7563['interaction']['id'],_0x4cf907[_0x5837('0x4d')]?JSON['stringify'](_0x4cf907['body']):'null');return respondWithRpcPromise(_0x5837('0x5f'),_0x5837('0x60'),_0x2c7563);}return null;})[_0x5837('0x2a')](function(_0x25769c){if(_0x25769c){if(_0x4cf907['body'][_0x5837('0x61')]){_0x2c7563['message'][_0x5837('0x62')]=util['format'](_0x5837('0x63'),_0x4cf907[_0x5837('0x57')][_0x5837('0x2e')]);_0x2c7563['message'][_0x5837('0x64')]=_0x2c7563[_0x5837('0x64')];_0x2c7563[_0x5837('0x1d')]['event']=_0x5837('0x50');return respondWithRpcPromise('EventManager',_0x5837('0x65'),{'event':'acceptmessage','message':_0x2c7563[_0x5837('0x1d')]},client9002)[_0x5837('0x2a')](function(){return _0x2c7563;});}return _0x2c7563;}return null;})[_0x5837('0x2a')](respondWithResult(_0xe231e7,null))[_0x5837('0x1e')](handleError(_0xe231e7,null));};var interaction_log=require(_0x5837('0xd'))(_0x5837('0x66'));exports[_0x5837('0x67')]=function(_0x14b10b,_0x1dadcf,_0x333d98){var _0x55370b={'agent':{},'channel':_0x5837('0x51')};if(_0x14b10b['body']['id']){delete _0x14b10b[_0x5837('0x4d')]['id'];}_0x14b10b[_0x5837('0x4d')][_0x5837('0x56')]=_0x14b10b[_0x5837('0x4d')][_0x5837('0x56')]||_0x14b10b[_0x5837('0x57')]['id'];_0x55370b[_0x5837('0x68')]['id']=_0x14b10b[_0x5837('0x4d')]['UserId'];return db[_0x5837('0x31')][_0x5837('0x4e')]({'where':{'id':_0x14b10b[_0x5837('0x49')]['id'],'UserId':null}})[_0x5837('0x2a')](handleEntityNotFound(_0x1dadcf,null))[_0x5837('0x2a')](function(_0x6f31a6){if(_0x6f31a6){_0x55370b[_0x5837('0x1d')]=_0x6f31a6['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x6f31a6[_0x5837('0x5c')]}});}return null;})[_0x5837('0x2a')](handleEntityNotFound(_0x1dadcf,null))[_0x5837('0x2a')](function(_0x7ca7cc){if(_0x7ca7cc){_0x55370b[_0x5837('0x69')]=_0x7ca7cc['get']({'plain':!![]});interaction_log[_0x5837('0x17')](_0x5837('0x6a'),_0x14b10b['user']['id'],_0x14b10b[_0x5837('0x57')]['name'],_0x14b10b[_0x5837('0x57')][_0x5837('0x5e')],_0x55370b[_0x5837('0x69')]['id'],_0x14b10b[_0x5837('0x4d')]?JSON[_0x5837('0x6b')](_0x14b10b[_0x5837('0x4d')]):_0x5837('0x6c'));return respondWithRpcPromise(_0x5837('0x6d'),_0x5837('0x6e'),_0x55370b);}return null;})['then'](function(_0x2590b9){if(_0x2590b9){_0x2590b9['message'][_0x5837('0x62')]=util[_0x5837('0x54')](_0x5837('0x63'),_0x14b10b['user'][_0x5837('0x2e')]);_0x2590b9[_0x5837('0x1d')][_0x5837('0x64')]=_0x55370b[_0x5837('0x64')];_0x2590b9['message'][_0x5837('0x6f')]=_0x5837('0x67');respondWithRpcPromise('EventManager',_0x5837('0x65'),{'event':_0x5837('0x70'),'message':_0x2590b9[_0x5837('0x1d')]},client9002);return _0x55370b;}return null;})[_0x5837('0x2a')](respondWithResult(_0x1dadcf,null))[_0x5837('0x1e')](handleError(_0x1dadcf,null));}; \ No newline at end of file +var _0x777f=['fields','hasOwnProperty','nolimit','order','sort','where','pick','day','merge','map','includeAll','include','rows','length','options','find','create','body','params','describe','openchannel-interactions','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','interface','channel','event','accept','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','SIP/%s','rejectmessage','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x777f,0x119));var _0xf777=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x777f[_0x43fdf8];return _0x1160c6;};'use strict';var jsonpatch=require(_0xf777('0x0'));var rp=require(_0xf777('0x1'));var moment=require(_0xf777('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf777('0x3'));var util=require(_0xf777('0x4'));var path=require(_0xf777('0x5'));var sox=require(_0xf777('0x6'));var csv=require(_0xf777('0x7'));var ejs=require(_0xf777('0x8'));var fs=require('fs');var _=require(_0xf777('0x9'));var squel=require(_0xf777('0xa'));var crypto=require(_0xf777('0xb'));var jsforce=require(_0xf777('0xc'));var deskjs=require(_0xf777('0xd'));var toCsv=require(_0xf777('0x7'));var querystring=require(_0xf777('0xe'));var Papa=require('papaparse');var qs=require(_0xf777('0xf'));var logger=require(_0xf777('0x10'))(_0xf777('0x11'));var utils=require(_0xf777('0x12'));var config=require('../../config/environment');var db=require(_0xf777('0x13'))['db'];var socket=require(_0xf777('0x14'))({'host':'localhost','port':0x18eb});require(_0xf777('0x15'))[_0xf777('0x16')](socket);var jayson=require(_0xf777('0x17'));var client=jayson[_0xf777('0x18')][_0xf777('0x19')]({'port':0x232c});var client9002=jayson['client'][_0xf777('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x594fb5,_0x3db194,_0x337521,_0x58ff22){return new BPromise(function(_0x49c63a,_0x361150){var _0x53e6d2=_0x58ff22||client;return _0x53e6d2[_0xf777('0x1a')](_0x594fb5,_0x337521)[_0xf777('0x1b')](function(_0x22256c){logger[_0xf777('0x1c')](_0xf777('0x1d'),_0x3db194,_0xf777('0x1e'));logger[_0xf777('0x1f')](_0xf777('0x20'),_0x3db194,_0xf777('0x1e'),JSON[_0xf777('0x21')](_0x22256c));if(_0x22256c[_0xf777('0x22')]){if(_0x22256c['error']['code']===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3db194,_0x22256c[_0xf777('0x22')][_0xf777('0x23')]);return _0x361150(_0x22256c[_0xf777('0x22')][_0xf777('0x23')]);}logger[_0xf777('0x22')](_0xf777('0x1d'),_0x3db194,_0x22256c[_0xf777('0x22')][_0xf777('0x23')]);return _0x49c63a(_0x22256c['error'][_0xf777('0x23')]);}else{logger[_0xf777('0x1c')](_0xf777('0x1d'),_0x3db194,_0xf777('0x1e'));_0x49c63a(_0x22256c['result'][_0xf777('0x23')]);}})[_0xf777('0x24')](function(_0x581b29){logger[_0xf777('0x22')](_0xf777('0x1d'),_0x3db194,_0x581b29);_0x361150(_0x581b29);});});}function respondWithStatusCode(_0x44d2b0,_0x203811){_0x203811=_0x203811||0xcc;return function(_0x27ebad){if(_0x27ebad){return _0x44d2b0['sendStatus'](_0x203811);}return _0x44d2b0[_0xf777('0x25')](_0x203811)[_0xf777('0x26')]();};}function respondWithResult(_0x371ae8,_0x4fa765){_0x4fa765=_0x4fa765||0xc8;return function(_0x5d919a){if(_0x5d919a){return _0x371ae8[_0xf777('0x25')](_0x4fa765)[_0xf777('0x27')](_0x5d919a);}};}function respondWithFilteredResult(_0x31aec2,_0x5ea701){return function(_0x13e981){if(_0x13e981){var _0x39de17=_0x13e981[_0xf777('0x28')],_0x3372e5=_0x5ea701[_0xf777('0x29')],_0x35c5f3=_0x5ea701[_0xf777('0x29')]+_0x5ea701[_0xf777('0x2a')],_0x985a5;if(_0x35c5f3>=_0x39de17){_0x35c5f3=_0x39de17;_0x985a5=0xc8;}else{_0x985a5=0xce;}_0x31aec2['status'](_0x985a5);return _0x31aec2[_0xf777('0x2b')](_0xf777('0x2c'),_0x3372e5+'-'+_0x35c5f3+'/'+_0x39de17)[_0xf777('0x27')](_0x13e981);}return null;};}function patchUpdates(_0x593660){return function(_0x29d41f){try{jsonpatch[_0xf777('0x2d')](_0x29d41f,_0x593660,!![]);}catch(_0x30a603){return BPromise[_0xf777('0x2e')](_0x30a603);}return _0x29d41f[_0xf777('0x2f')]();};}function saveUpdates(_0x1609d6,_0x2737a5){return function(_0x58a962){if(_0x58a962){return _0x58a962[_0xf777('0x30')](_0x1609d6)[_0xf777('0x1b')](function(_0x102058){return _0x102058;});}return null;};}function removeEntity(_0x4e8b22,_0xfe7c13){return function(_0x2086b4){if(_0x2086b4){return _0x2086b4[_0xf777('0x31')]()['then'](function(){_0x4e8b22[_0xf777('0x25')](0xcc)[_0xf777('0x26')]();});}};}function handleEntityNotFound(_0x3e3834,_0x2496c4){return function(_0x1e1bb3){if(!_0x1e1bb3){_0x3e3834['sendStatus'](0x194);}return _0x1e1bb3;};}function handleError(_0x3136cd,_0x3d2f47){_0x3d2f47=_0x3d2f47||0x1f4;return function(_0x1807f4){logger[_0xf777('0x22')](_0x1807f4[_0xf777('0x32')]);if(_0x1807f4[_0xf777('0x33')]){delete _0x1807f4['name'];}_0x3136cd['status'](_0x3d2f47)[_0xf777('0x34')](_0x1807f4);};}exports[_0xf777('0x35')]=function(_0x579e2c,_0x952344){var _0x18a620={},_0xd4d0fe={},_0x339e6e={'count':0x0,'rows':[]};var _0x24556c=db[_0xf777('0x36')][_0xf777('0x37')];_0xd4d0fe[_0xf777('0x38')]=_[_0xf777('0x39')](_0x24556c);var _0x500c07={'dateStart':_0x579e2c[_0xf777('0x3a')]['dateStart'],'dateEnd':_0x579e2c[_0xf777('0x3a')][_0xf777('0x3b')]};delete _0x579e2c[_0xf777('0x3a')][_0xf777('0x3c')];delete _0x579e2c[_0xf777('0x3a')][_0xf777('0x3b')];_0xd4d0fe['query']=_[_0xf777('0x39')](_0x579e2c[_0xf777('0x3a')]);_0xd4d0fe[_0xf777('0x3d')]=_[_0xf777('0x3e')](_0xd4d0fe[_0xf777('0x38')],_0xd4d0fe['query']);_0x18a620[_0xf777('0x3f')]=_[_0xf777('0x3e')](_0xd4d0fe[_0xf777('0x38')],qs[_0xf777('0x40')](_0x579e2c[_0xf777('0x3a')]['fields']));_0x18a620['attributes']=_0x18a620[_0xf777('0x3f')]['length']?_0x18a620[_0xf777('0x3f')]:_0xd4d0fe['model'];if(!_0x579e2c['query'][_0xf777('0x41')](_0xf777('0x42'))){_0x18a620[_0xf777('0x2a')]=qs[_0xf777('0x2a')](_0x579e2c['query'][_0xf777('0x2a')]);_0x18a620['offset']=qs[_0xf777('0x29')](_0x579e2c[_0xf777('0x3a')][_0xf777('0x29')]);}_0x18a620[_0xf777('0x43')]=qs[_0xf777('0x44')](_0x579e2c[_0xf777('0x3a')][_0xf777('0x44')]);_0x18a620[_0xf777('0x45')]=qs['filters'](_[_0xf777('0x46')](_0x579e2c[_0xf777('0x3a')],_0xd4d0fe[_0xf777('0x3d')]));if(_0x500c07['dateStart']){if(_0x500c07[_0xf777('0x3b')]){_0x500c07[_0xf777('0x3b')]=moment(_0x500c07[_0xf777('0x3b')])['add'](0x1,_0xf777('0x47'));}else{_0x500c07[_0xf777('0x3b')]=moment(_0x500c07[_0xf777('0x3c')])['add'](0x1,_0xf777('0x47'));}_['merge'](_0x18a620[_0xf777('0x45')],{'createdAt':{'$gte':_0x500c07[_0xf777('0x3c')],'$lte':_0x500c07['dateEnd']}});}if(_0x579e2c[_0xf777('0x3a')]['filter']){_0x18a620[_0xf777('0x45')]=_[_0xf777('0x48')](_0x18a620[_0xf777('0x45')],{'$or':_[_0xf777('0x49')](_0x18a620[_0xf777('0x3f')],function(_0x2a5b1e){var _0x10af52={};_0x10af52[_0x2a5b1e]={'$like':'%'+_0x579e2c['query']['filter']+'%'};return _0x10af52;})});}_0x18a620=_[_0xf777('0x48')]({},_0x18a620,_0x579e2c['options']);var _0x1bd627={'where':_0x18a620['where']};return db[_0xf777('0x36')][_0xf777('0x28')](_0x1bd627)[_0xf777('0x1b')](function(_0x3ce6ad){_0x339e6e[_0xf777('0x28')]=_0x3ce6ad;if(_0x579e2c[_0xf777('0x3a')][_0xf777('0x4a')]){_0x18a620[_0xf777('0x4b')]=[{'all':!![]}];}return db[_0xf777('0x36')]['findAll'](_0x18a620);})[_0xf777('0x1b')](function(_0x5cfa8d){_0x339e6e[_0xf777('0x4c')]=_0x5cfa8d;return _0x339e6e;})['then'](respondWithFilteredResult(_0x952344,_0x18a620))['catch'](handleError(_0x952344,null));};exports['show']=function(_0x594c49,_0x18298e){var _0x50a0b9={'raw':!![],'where':{'id':_0x594c49['params']['id']}},_0x39c750={};_0x39c750[_0xf777('0x38')]=_[_0xf777('0x39')](db[_0xf777('0x36')][_0xf777('0x37')]);_0x39c750[_0xf777('0x3a')]=_['keys'](_0x594c49[_0xf777('0x3a')]);_0x39c750[_0xf777('0x3d')]=_[_0xf777('0x3e')](_0x39c750[_0xf777('0x38')],_0x39c750[_0xf777('0x3a')]);_0x50a0b9[_0xf777('0x3f')]=_[_0xf777('0x3e')](_0x39c750[_0xf777('0x38')],qs[_0xf777('0x40')](_0x594c49['query'][_0xf777('0x40')]));_0x50a0b9['attributes']=_0x50a0b9['attributes'][_0xf777('0x4d')]?_0x50a0b9[_0xf777('0x3f')]:_0x39c750[_0xf777('0x38')];if(_0x594c49['query'][_0xf777('0x4a')]){_0x50a0b9[_0xf777('0x4b')]=[{'all':!![]}];}_0x50a0b9=_[_0xf777('0x48')]({},_0x50a0b9,_0x594c49[_0xf777('0x4e')]);return db[_0xf777('0x36')][_0xf777('0x4f')](_0x50a0b9)[_0xf777('0x1b')](handleEntityNotFound(_0x18298e,null))[_0xf777('0x1b')](respondWithResult(_0x18298e,null))['catch'](handleError(_0x18298e,null));};exports['create']=function(_0x14038e,_0x1737e4){return db[_0xf777('0x36')][_0xf777('0x50')](_0x14038e[_0xf777('0x51')],{})[_0xf777('0x1b')](respondWithResult(_0x1737e4,0xc9))['catch'](handleError(_0x1737e4,null));};exports[_0xf777('0x30')]=function(_0x1bf2f3,_0x35eb68){if(_0x1bf2f3[_0xf777('0x51')]['id']){delete _0x1bf2f3[_0xf777('0x51')]['id'];}return db[_0xf777('0x36')][_0xf777('0x4f')]({'where':{'id':_0x1bf2f3[_0xf777('0x52')]['id']}})[_0xf777('0x1b')](handleEntityNotFound(_0x35eb68,null))[_0xf777('0x1b')](saveUpdates(_0x1bf2f3[_0xf777('0x51')],null))[_0xf777('0x1b')](respondWithResult(_0x35eb68,null))[_0xf777('0x24')](handleError(_0x35eb68,null));};exports[_0xf777('0x31')]=function(_0x25d844,_0x529be0){return db[_0xf777('0x36')]['find']({'where':{'id':_0x25d844[_0xf777('0x52')]['id']}})[_0xf777('0x1b')](handleEntityNotFound(_0x529be0,null))[_0xf777('0x1b')](removeEntity(_0x529be0,null))['catch'](handleError(_0x529be0,null));};exports[_0xf777('0x53')]=function(_0x181312,_0x52904d){return db[_0xf777('0x36')][_0xf777('0x53')]()[_0xf777('0x1b')](respondWithResult(_0x52904d,null))[_0xf777('0x24')](handleError(_0x52904d,null));};var interaction_log=require(_0xf777('0x10'))(_0xf777('0x54'));exports['accept']=function(_0x4b9cc5,_0x7b866b,_0x4e43d3){var _0x5483b1={'channel':_0xf777('0x55')};if(_0x4b9cc5[_0xf777('0x51')]['id']){delete _0x4b9cc5[_0xf777('0x51')]['id'];}_0x4b9cc5[_0xf777('0x51')][_0xf777('0x56')]=!![];_0x4b9cc5[_0xf777('0x51')][_0xf777('0x57')]=moment()['format'](_0xf777('0x58'));_0x4b9cc5[_0xf777('0x51')][_0xf777('0x59')]=_0x4b9cc5[_0xf777('0x51')][_0xf777('0x59')]||_0x4b9cc5['user']['id'];return db['OpenchannelMessage'][_0xf777('0x4f')]({'where':{'id':_0x4b9cc5['params']['id'],'UserId':null},'include':[{'model':db[_0xf777('0x5a')],'as':_0xf777('0x5b')}]})[_0xf777('0x1b')](handleEntityNotFound(_0x7b866b,null))[_0xf777('0x1b')](saveUpdates(_0x4b9cc5[_0xf777('0x51')],null))[_0xf777('0x1b')](function(_0x4f8cbd){if(_0x4f8cbd){_0x5483b1[_0xf777('0x23')]=_0x4f8cbd[_0xf777('0x5c')]({'plain':!![]});return db[_0xf777('0x5d')]['find']({'where':{'id':_0x4f8cbd[_0xf777('0x5e')]}});}return null;})[_0xf777('0x1b')](handleEntityNotFound(_0x7b866b,null))['then'](function(_0x519bd6){if(_0x519bd6){return _0x519bd6[_0xf777('0x30')]({'UserId':_0x4b9cc5[_0xf777('0x51')][_0xf777('0x59')],'read1stAt':_[_0xf777('0x5f')](_0x519bd6['read1stAt'])?moment()[_0xf777('0x60')](_0xf777('0x58')):undefined});}return null;})['then'](function(_0xfcb2e9){if(_0xfcb2e9){_0x5483b1[_0xf777('0x61')]=_0xfcb2e9[_0xf777('0x5c')]({'plain':!![]});interaction_log[_0xf777('0x1c')](_0xf777('0x62'),_0x4b9cc5[_0xf777('0x63')]['id'],_0x4b9cc5['user']['name'],_0x4b9cc5[_0xf777('0x63')]['role'],_0x5483b1[_0xf777('0x61')]['id'],_0x4b9cc5['body']?JSON[_0xf777('0x21')](_0x4b9cc5['body']):'null');return respondWithRpcPromise(_0xf777('0x64'),_0xf777('0x65'),_0x5483b1);}return null;})[_0xf777('0x1b')](function(_0x487635){if(_0x487635){if(_0x4b9cc5[_0xf777('0x51')]['manual']){_0x5483b1[_0xf777('0x23')][_0xf777('0x66')]=util[_0xf777('0x60')]('SIP/%s',_0x4b9cc5[_0xf777('0x63')][_0xf777('0x33')]);_0x5483b1[_0xf777('0x23')][_0xf777('0x67')]=_0x5483b1['channel'];_0x5483b1[_0xf777('0x23')][_0xf777('0x68')]=_0xf777('0x69');return respondWithRpcPromise(_0xf777('0x6a'),_0xf777('0x6a'),{'event':_0xf777('0x6b'),'message':_0x5483b1[_0xf777('0x23')]},client9002)[_0xf777('0x1b')](function(){return _0x5483b1;});}return _0x5483b1;}return null;})[_0xf777('0x1b')](respondWithResult(_0x7b866b,null))['catch'](handleError(_0x7b866b,null));};var interaction_log=require(_0xf777('0x10'))('openchannel-interactions');exports['reject']=function(_0x54709b,_0x5d494e,_0x164453){var _0xe17566={'agent':{},'channel':_0xf777('0x55')};if(_0x54709b[_0xf777('0x51')]['id']){delete _0x54709b[_0xf777('0x51')]['id'];}_0x54709b[_0xf777('0x51')][_0xf777('0x59')]=_0x54709b[_0xf777('0x51')][_0xf777('0x59')]||_0x54709b[_0xf777('0x63')]['id'];_0xe17566[_0xf777('0x6c')]['id']=_0x54709b['body']['UserId'];return db[_0xf777('0x36')][_0xf777('0x4f')]({'where':{'id':_0x54709b[_0xf777('0x52')]['id'],'UserId':null}})[_0xf777('0x1b')](handleEntityNotFound(_0x5d494e,null))[_0xf777('0x1b')](function(_0x1974e1){if(_0x1974e1){_0xe17566[_0xf777('0x23')]=_0x1974e1[_0xf777('0x5c')]({'plain':!![]});return db[_0xf777('0x5d')][_0xf777('0x4f')]({'where':{'id':_0x1974e1[_0xf777('0x5e')]}});}return null;})[_0xf777('0x1b')](handleEntityNotFound(_0x5d494e,null))[_0xf777('0x1b')](function(_0x45fa60){if(_0x45fa60){_0xe17566['interaction']=_0x45fa60[_0xf777('0x5c')]({'plain':!![]});interaction_log[_0xf777('0x1c')](_0xf777('0x6d'),_0x54709b[_0xf777('0x63')]['id'],_0x54709b['user'][_0xf777('0x33')],_0x54709b[_0xf777('0x63')][_0xf777('0x6e')],_0xe17566[_0xf777('0x61')]['id'],_0x54709b[_0xf777('0x51')]?JSON['stringify'](_0x54709b['body']):_0xf777('0x6f'));return respondWithRpcPromise(_0xf777('0x70'),'rejectMessage',_0xe17566);}return null;})[_0xf777('0x1b')](function(_0x47de60){if(_0x47de60){_0x47de60[_0xf777('0x23')][_0xf777('0x66')]=util[_0xf777('0x60')](_0xf777('0x71'),_0x54709b[_0xf777('0x63')][_0xf777('0x33')]);_0x47de60['message'][_0xf777('0x67')]=_0xe17566[_0xf777('0x67')];_0x47de60[_0xf777('0x23')][_0xf777('0x68')]=_0xf777('0x2e');respondWithRpcPromise(_0xf777('0x6a'),_0xf777('0x6a'),{'event':_0xf777('0x72'),'message':_0x47de60[_0xf777('0x23')]},client9002);return _0xe17566;}return null;})['then'](respondWithResult(_0x5d494e,null))['catch'](handleError(_0x5d494e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 4e47fa2..6fc4114 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 _0x8d41=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x8d41,0x12c));var _0x18d4=function(_0x544463,_0x214963){_0x544463=_0x544463-0x0;var _0x1add2a=_0x8d41[_0x544463];return _0x1add2a;};'use strict';var EventEmitter=require(_0x18d4('0x0'));var OpenchannelMessage=require(_0x18d4('0x1'))['db'][_0x18d4('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x18d4('0x3')](0x0);var events={'afterCreate':_0x18d4('0x4'),'afterUpdate':_0x18d4('0x5'),'afterDestroy':_0x18d4('0x6')};function emitEvent(_0x64f09d){return function(_0x20c75,_0x14a477,_0x50b799){OpenchannelMessageEvents['emit'](_0x64f09d+':'+_0x20c75['id'],_0x20c75);OpenchannelMessageEvents[_0x18d4('0x7')](_0x64f09d,_0x20c75);_0x50b799(null);};}for(var e in events){if(events[_0x18d4('0x8')](e)){var event=events[e];OpenchannelMessage[_0x18d4('0x9')](e,emitEvent(event));}}module[_0x18d4('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xbaf3=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit'];(function(_0x10d7c5,_0x531390){var _0x5be489=function(_0x1fd393){while(--_0x1fd393){_0x10d7c5['push'](_0x10d7c5['shift']());}};_0x5be489(++_0x531390);}(_0xbaf3,0x1df));var _0x3baf=function(_0x1bcd8d,_0x21761c){_0x1bcd8d=_0x1bcd8d-0x0;var _0x6b9e62=_0xbaf3[_0x1bcd8d];return _0x6b9e62;};'use strict';var EventEmitter=require(_0x3baf('0x0'));var OpenchannelMessage=require(_0x3baf('0x1'))['db'][_0x3baf('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3baf('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3baf('0x4'),'afterDestroy':_0x3baf('0x5')};function emitEvent(_0x44c62c){return function(_0x59ffff,_0x13d0f8,_0x331ece){OpenchannelMessageEvents[_0x3baf('0x6')](_0x44c62c+':'+_0x59ffff['id'],_0x59ffff);OpenchannelMessageEvents[_0x3baf('0x6')](_0x44c62c,_0x59ffff);_0x331ece(null);};}for(var e in events){if(events[_0x3baf('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x3baf('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index d29baa0..cdb7d8c 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 _0x559a=['OpenchannelMessage','models','get','toLowerCase','direction','out','UserId','OpenchannelInteraction','OpenchannelInteractionId','createdAt','catch','secret','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','Contact','keys','then','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','POST','method','GET','body','info','format','Message\x20%d\x20forwarded\x20to\x20%s','update','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','./openchannelMessage.attributes','exports','define'];(function(_0x3fe97e,_0x48aba8){var _0x17a426=function(_0x2365fe){while(--_0x2365fe){_0x3fe97e['push'](_0x3fe97e['shift']());}};_0x17a426(++_0x48aba8);}(_0x559a,0xb3));var _0xa559=function(_0xc849f0,_0x15e3f2){_0xc849f0=_0xc849f0-0x0;var _0xc2dcd3=_0x559a[_0xc849f0];return _0xc2dcd3;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var logger=require('../../config/logger')(_0xa559('0x2'));var moment=require(_0xa559('0x3'));var BPromise=require(_0xa559('0x4'));var rp=require(_0xa559('0x5'));var attributes=require(_0xa559('0x6'));module[_0xa559('0x7')]=function(_0x4fac42,_0x5d85c7){return _0x4fac42[_0xa559('0x8')](_0xa559('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2edab4,_0x1a5cec,_0x4eada1){var _0xb8055=_0x4fac42[_0xa559('0xa')];var _0x15813d=_0x2edab4[_0xa559('0xb')]({'plain':!![]});if(_0x15813d['direction'][_0xa559('0xc')]()==='in'||_0x15813d[_0xa559('0xd')][_0xa559('0xc')]()===_0xa559('0xe')&&!_0x15813d['secret']&&!_['isNil'](_0x15813d[_0xa559('0xf')])){_0xb8055[_0xa559('0x10')]['findOne']({'where':{'id':_0x15813d[_0xa559('0x11')]}})['then'](function(_0x442e26){if(_0x442e26){_0x442e26['update']({'lastMsgAt':_0x15813d[_0xa559('0x12')],'lastMsgDirection':_0x15813d[_0xa559('0xd')][_0xa559('0xc')](),'lastMsgBody':_0x15813d['body']});}})[_0xa559('0x13')](function(_0x3853fd){console['error'](_0x3853fd);});}if(_0x15813d[_0xa559('0xd')]===_0xa559('0xe')&&!_0x15813d[_0xa559('0x14')]){var _0x1e48b3;_0xb8055['CmContact'][_0xa559('0x15')]()['then'](function(_0x461735){return _0xb8055[_0xa559('0x16')]['find']({'where':{'id':_0x15813d[_0xa559('0x17')]},'include':[{'model':_0xb8055[_0xa559('0x10')],'as':_0xa559('0x18'),'where':{'id':_0x15813d[_0xa559('0x11')]},'limit':0x1,'include':[{'model':_0xb8055[_0xa559('0x19')],'as':_0xa559('0x1a'),'attributes':_[_0xa559('0x1b')](_0x461735)}]}]});})[_0xa559('0x1c')](function(_0x329d59){_0x1e48b3=_0x329d59[_0xa559('0xb')]({'plain':!![]});if(_0x1e48b3&&_0x1e48b3['replyUri']){logger['info'](_0xa559('0x1d'),_0xa559('0x1e'),util['format'](_0xa559('0x1f'),_0x15813d['id'],_0x1e48b3[_0xa559('0x20')]));if(_0x1e48b3[_0xa559('0x18')]&&_0x1e48b3[_0xa559('0x18')][_0xa559('0x21')]){_0x15813d[_0xa559('0x22')]=_['omit'](_0x1e48b3[_0xa559('0x18')][0x0],'Contact');_0x15813d[_0xa559('0x1a')]=_0x1e48b3[_0xa559('0x18')][0x0][_0xa559('0x1a')];}var _0x1a5cec={'method':_0xa559('0x23'),'uri':encodeURI(_0x1e48b3['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1a5cec[_0xa559('0x24')]){case _0xa559('0x25'):_0x1a5cec['qs']=_0x15813d;break;case'POST':_0x1a5cec[_0xa559('0x26')]=_0x15813d;break;}return rp(_0x1a5cec)['then'](function(_0x4d41cf){logger[_0xa559('0x27')](_0xa559('0x1d'),_0xa559('0x1e'),util[_0xa559('0x28')](_0xa559('0x29'),_0x15813d['id'],_0x1e48b3[_0xa559('0x20')]));return _0x2edab4[_0xa559('0x2a')]({'read':!![]});})[_0xa559('0x13')](function(_0x48f385){logger[_0xa559('0x2b')](_0xa559('0x1d'),_0xa559('0x1e'),util[_0xa559('0x2c')](_0x48f385,{'showHidden':![],'depth':null}));_0x4eada1();});}else{_0x4eada1();}})['finally'](function(){_0x4eada1();});}else{_0x4eada1();}}},'charset':_0xa559('0x2d'),'collate':_0xa559('0x2e')});}; \ No newline at end of file +var _0x94b1=['out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','body','catch','error','CmContact','describe','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','inspect','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','models','get','direction','toLowerCase'];(function(_0xc968e5,_0x128efb){var _0x3c8278=function(_0xca3fe4){while(--_0xca3fe4){_0xc968e5['push'](_0xc968e5['shift']());}};_0x3c8278(++_0x128efb);}(_0x94b1,0x102));var _0x194b=function(_0x881c21,_0x22f1ce){_0x881c21=_0x881c21-0x0;var _0xcf0b84=_0x94b1[_0x881c21];return _0xcf0b84;};'use strict';var _=require('lodash');var util=require(_0x194b('0x0'));var logger=require('../../config/logger')(_0x194b('0x1'));var moment=require(_0x194b('0x2'));var BPromise=require(_0x194b('0x3'));var rp=require('request-promise');var attributes=require(_0x194b('0x4'));module[_0x194b('0x5')]=function(_0x32586a,_0x23ab83){return _0x32586a['define'](_0x194b('0x6'),attributes,{'tableName':_0x194b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5213ad,_0x3ec8c2,_0x4e82ac){var _0x24b450=_0x32586a[_0x194b('0x8')];var _0x20d6cd=_0x5213ad[_0x194b('0x9')]({'plain':!![]});if(_0x20d6cd[_0x194b('0xa')][_0x194b('0xb')]()==='in'||_0x20d6cd[_0x194b('0xa')]['toLowerCase']()===_0x194b('0xc')&&!_0x20d6cd[_0x194b('0xd')]&&!_[_0x194b('0xe')](_0x20d6cd['UserId'])){_0x24b450[_0x194b('0xf')][_0x194b('0x10')]({'where':{'id':_0x20d6cd[_0x194b('0x11')]}})[_0x194b('0x12')](function(_0x2f2dec){if(_0x2f2dec){_0x2f2dec[_0x194b('0x13')]({'lastMsgAt':_0x20d6cd[_0x194b('0x14')],'lastMsgDirection':_0x20d6cd[_0x194b('0xa')][_0x194b('0xb')](),'lastMsgBody':_0x20d6cd[_0x194b('0x15')]});}})[_0x194b('0x16')](function(_0xb5776f){console[_0x194b('0x17')](_0xb5776f);});}if(_0x20d6cd[_0x194b('0xa')]===_0x194b('0xc')&&!_0x20d6cd[_0x194b('0xd')]){var _0x1efd3f;_0x24b450[_0x194b('0x18')][_0x194b('0x19')]()[_0x194b('0x12')](function(_0x21649e){return _0x24b450['OpenchannelAccount']['find']({'where':{'id':_0x20d6cd[_0x194b('0x1a')]},'include':[{'model':_0x24b450[_0x194b('0xf')],'as':_0x194b('0x1b'),'where':{'id':_0x20d6cd[_0x194b('0x11')]},'limit':0x1,'include':[{'model':_0x24b450[_0x194b('0x18')],'as':_0x194b('0x1c'),'attributes':_[_0x194b('0x1d')](_0x21649e)}]}]});})[_0x194b('0x12')](function(_0x5e1464){_0x1efd3f=_0x5e1464[_0x194b('0x9')]({'plain':!![]});if(_0x1efd3f&&_0x1efd3f['replyUri']){logger[_0x194b('0x1e')](_0x194b('0x1f'),_0x194b('0x20'),util[_0x194b('0x21')](_0x194b('0x22'),_0x20d6cd['id'],_0x1efd3f[_0x194b('0x23')]));if(_0x1efd3f[_0x194b('0x1b')]&&_0x1efd3f['Interactions'][_0x194b('0x24')]){_0x20d6cd['Interaction']=_[_0x194b('0x25')](_0x1efd3f[_0x194b('0x1b')][0x0],_0x194b('0x1c'));_0x20d6cd[_0x194b('0x1c')]=_0x1efd3f[_0x194b('0x1b')][0x0][_0x194b('0x1c')];}var _0x3ec8c2={'method':'POST','uri':encodeURI(_0x1efd3f[_0x194b('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3ec8c2[_0x194b('0x26')]){case _0x194b('0x27'):_0x3ec8c2['qs']=_0x20d6cd;break;case _0x194b('0x28'):_0x3ec8c2[_0x194b('0x15')]=_0x20d6cd;break;}return rp(_0x3ec8c2)[_0x194b('0x12')](function(_0x9c08a7){logger[_0x194b('0x1e')](_0x194b('0x1f'),_0x194b('0x20'),util[_0x194b('0x21')](_0x194b('0x29'),_0x20d6cd['id'],_0x1efd3f[_0x194b('0x23')]));return _0x5213ad[_0x194b('0x13')]({'read':!![]});})[_0x194b('0x16')](function(_0x2a44c6){logger[_0x194b('0x17')](_0x194b('0x1f'),_0x194b('0x20'),util[_0x194b('0x2a')](_0x2a44c6,{'showHidden':![],'depth':null}));_0x4e82ac();});}else{_0x4e82ac();}})[_0x194b('0x2b')](function(){_0x4e82ac();});}else{_0x4e82ac();}}},'charset':'utf8mb4','collate':_0x194b('0x2c')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ee00cfb..5eaa501 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 _0x008c=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','register','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateOpenchannelMessage','options','debug','catch'];(function(_0x5437b5,_0x55cd61){var _0x2757ef=function(_0x56b39c){while(--_0x56b39c){_0x5437b5['push'](_0x5437b5['shift']());}};_0x2757ef(++_0x55cd61);}(_0x008c,0x188));var _0xc008=function(_0x3324d6,_0x156731){_0x3324d6=_0x3324d6-0x0;var _0x588698=_0x008c[_0x3324d6];return _0x588698;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var config=require(_0xc008('0x8'));var jayson=require(_0xc008('0x9'));var client=jayson[_0xc008('0xa')][_0xc008('0xb')]({'port':0x232a});var socket=require(_0xc008('0xc'))({'host':_0xc008('0xd'),'port':0x18eb});require('./openchannelMessage.socket')[_0xc008('0xe')](socket);function respondWithRpcPromise(_0x5aa09b,_0x30be38,_0x5b64f8){return new BPromise(function(_0x52041f,_0x27830d){return client[_0xc008('0xf')](_0x5aa09b,_0x5b64f8)['then'](function(_0x51ba7d){logger['info'](_0xc008('0x10'),_0x30be38,_0xc008('0x11'));logger['debug'](_0xc008('0x12'),_0x30be38,_0xc008('0x11'),JSON[_0xc008('0x13')](_0x51ba7d));if(_0x51ba7d[_0xc008('0x14')]){if(_0x51ba7d[_0xc008('0x14')][_0xc008('0x15')]===0x1f4){logger[_0xc008('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x30be38,_0x51ba7d['error'][_0xc008('0x16')]);return _0x27830d(_0x51ba7d['error'][_0xc008('0x16')]);}logger[_0xc008('0x14')](_0xc008('0x10'),_0x30be38,_0x51ba7d[_0xc008('0x14')][_0xc008('0x16')]);return _0x52041f(_0x51ba7d['error']['message']);}else{logger['info'](_0xc008('0x10'),_0x30be38,_0xc008('0x11'));_0x52041f(_0x51ba7d[_0xc008('0x17')][_0xc008('0x16')]);}})['catch'](function(_0x53b06e){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x30be38,_0x53b06e);_0x27830d(_0x53b06e);});});}exports[_0xc008('0x18')]=function(_0x462af5){var _0x501137=this;return new Promise(function(_0x813397,_0x5906e6){return db['OpenchannelMessage']['create'](_0x462af5['body'],{'raw':_0x462af5[_0xc008('0x19')]?_0x462af5['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a582d){logger['info'](_0xc008('0x18'),_0x462af5);logger[_0xc008('0x1a')](_0xc008('0x18'),_0x462af5,JSON[_0xc008('0x13')](_0x4a582d));_0x813397(_0x4a582d);})[_0xc008('0x1b')](function(_0x110128){logger['error'](_0xc008('0x18'),_0x110128['message'],_0x462af5);_0x5906e6(_0x501137['error'](0x1f4,_0x110128[_0xc008('0x16')]));});});}; \ No newline at end of file +var _0x55ca=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','options','raw','lodash','util','../../mysqldb'];(function(_0x20b376,_0x29ccf8){var _0x189c58=function(_0x36c1ab){while(--_0x36c1ab){_0x20b376['push'](_0x20b376['shift']());}};_0x189c58(++_0x29ccf8);}(_0x55ca,0x126));var _0xa55c=function(_0x20a822,_0x5dc295){_0x20a822=_0x20a822-0x0;var _0x3775d1=_0x55ca[_0x20a822];return _0x3775d1;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xa55c('0x2'))['db'];var utils=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var jayson=require(_0xa55c('0x6'));var client=jayson[_0xa55c('0x7')][_0xa55c('0x8')]({'port':0x232a});var socket=require(_0xa55c('0x9'))({'host':_0xa55c('0xa'),'port':0x18eb});require('./openchannelMessage.socket')[_0xa55c('0xb')](socket);function respondWithRpcPromise(_0x2537f0,_0x57e069,_0x291996){return new BPromise(function(_0x290d28,_0x52a3bc){return client['request'](_0x2537f0,_0x291996)[_0xa55c('0xc')](function(_0x20c76a){logger[_0xa55c('0xd')](_0xa55c('0xe'),_0x57e069,_0xa55c('0xf'));logger[_0xa55c('0x10')](_0xa55c('0x11'),_0x57e069,_0xa55c('0xf'),JSON[_0xa55c('0x12')](_0x20c76a));if(_0x20c76a[_0xa55c('0x13')]){if(_0x20c76a['error']['code']===0x1f4){logger[_0xa55c('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x57e069,_0x20c76a['error']['message']);return _0x52a3bc(_0x20c76a[_0xa55c('0x13')][_0xa55c('0x14')]);}logger[_0xa55c('0x13')](_0xa55c('0xe'),_0x57e069,_0x20c76a[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x290d28(_0x20c76a['error'][_0xa55c('0x14')]);}else{logger[_0xa55c('0xd')](_0xa55c('0xe'),_0x57e069,_0xa55c('0xf'));_0x290d28(_0x20c76a[_0xa55c('0x15')][_0xa55c('0x14')]);}})[_0xa55c('0x16')](function(_0x2d09d8){logger[_0xa55c('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x57e069,_0x2d09d8);_0x52a3bc(_0x2d09d8);});});}exports[_0xa55c('0x17')]=function(_0x104a99){var _0x461284=this;return new Promise(function(_0x358b61,_0x23a1ae){return db[_0xa55c('0x18')]['create'](_0x104a99['body'],{'raw':_0x104a99[_0xa55c('0x19')]?_0x104a99[_0xa55c('0x19')][_0xa55c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x383d92){logger[_0xa55c('0xd')]('CreateOpenchannelMessage',_0x104a99);logger[_0xa55c('0x10')](_0xa55c('0x17'),_0x104a99,JSON[_0xa55c('0x12')](_0x383d92));_0x358b61(_0x383d92);})[_0xa55c('0x16')](function(_0x234372){logger['error'](_0xa55c('0x17'),_0x234372['message'],_0x104a99);_0x23a1ae(_0x461284['error'](0x1f4,_0x234372['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 73ea16a..d26f88a 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 _0x44e8=['update','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x3af2cf,_0x88fd91){var _0x5c2a8f=function(_0x80fc9e){while(--_0x80fc9e){_0x3af2cf['push'](_0x3af2cf['shift']());}};_0x5c2a8f(++_0x88fd91);}(_0x44e8,0xd7));var _0x844e=function(_0x507091,_0x20ec76){_0x507091=_0x507091-0x0;var _0x4bab9e=_0x44e8[_0x507091];return _0x4bab9e;};'use strict';var OpenchannelMessageEvents=require(_0x844e('0x0'));var events=['save','remove',_0x844e('0x1')];function createListener(_0x21307e,_0x2afcef){return function(_0x164ecc){_0x2afcef['emit'](_0x21307e,_0x164ecc);};}function removeListener(_0x3a8b3c,_0x167368){return function(){OpenchannelMessageEvents[_0x844e('0x2')](_0x3a8b3c,_0x167368);};}exports[_0x844e('0x3')]=function(_0x5c8f67){for(var _0x2f6539=0x0,_0x238796=events[_0x844e('0x4')];_0x2f6539<_0x238796;_0x2f6539++){var _0x11cbd6=events[_0x2f6539];var _0x571b91=createListener(_0x844e('0x5')+_0x11cbd6,_0x5c8f67);OpenchannelMessageEvents['on'](_0x11cbd6,_0x571b91);}}; \ No newline at end of file +var _0xa7e6=['save','remove','update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x2d7e02,_0x24da3f){var _0x4f03ee=function(_0x10c6f1){while(--_0x10c6f1){_0x2d7e02['push'](_0x2d7e02['shift']());}};_0x4f03ee(++_0x24da3f);}(_0xa7e6,0x74));var _0x6a7e=function(_0x5001c4,_0x3b525c){_0x5001c4=_0x5001c4-0x0;var _0x3c558a=_0xa7e6[_0x5001c4];return _0x3c558a;};'use strict';var OpenchannelMessageEvents=require(_0x6a7e('0x0'));var events=[_0x6a7e('0x1'),_0x6a7e('0x2'),_0x6a7e('0x3')];function createListener(_0x67fa72,_0x21c1de){return function(_0x4c809c){_0x21c1de[_0x6a7e('0x4')](_0x67fa72,_0x4c809c);};}function removeListener(_0x8787b5,_0x1ea310){return function(){OpenchannelMessageEvents[_0x6a7e('0x5')](_0x8787b5,_0x1ea310);};}exports[_0x6a7e('0x6')]=function(_0x599006){for(var _0x79df6f=0x0,_0x16249d=events[_0x6a7e('0x7')];_0x79df6f<_0x16249d;_0x79df6f++){var _0x342c96=events[_0x79df6f];var _0x45e92e=createListener(_0x6a7e('0x8')+_0x342c96,_0x599006);OpenchannelMessageEvents['on'](_0x342c96,_0x45e92e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f8c5b17..a08f294 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 _0x9748=['/:id/teams','getTeams','getAgents','post','create','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9748,0x14c));var _0x8974=function(_0x50cb1a,_0x5ae7a6){_0x50cb1a=_0x50cb1a-0x0;var _0x3b04c2=_0x9748[_0x50cb1a];return _0x3b04c2;};'use strict';var multer=require(_0x8974('0x0'));var util=require(_0x8974('0x1'));var path=require(_0x8974('0x2'));var express=require(_0x8974('0x3'));var router=express[_0x8974('0x4')]();var auth=require(_0x8974('0x5'));var interaction=require(_0x8974('0x6'));var config=require(_0x8974('0x7'));var controller=require('./openchannelQueue.controller');router[_0x8974('0x8')]('/',auth[_0x8974('0x9')](),controller[_0x8974('0xa')]);router['get']('/describe',auth[_0x8974('0x9')](),controller[_0x8974('0xb')]);router['get'](_0x8974('0xc'),auth[_0x8974('0x9')](),controller[_0x8974('0xd')]);router[_0x8974('0x8')](_0x8974('0xe'),auth[_0x8974('0x9')](),controller[_0x8974('0xf')]);router[_0x8974('0x8')](_0x8974('0x10'),auth[_0x8974('0x9')](),controller[_0x8974('0x11')]);router[_0x8974('0x8')]('/:id/users',auth[_0x8974('0x9')](),controller[_0x8974('0x12')]);router[_0x8974('0x13')]('/',auth[_0x8974('0x9')](),controller[_0x8974('0x14')]);router[_0x8974('0x13')](_0x8974('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8974('0x13')](_0x8974('0x15'),auth[_0x8974('0x9')](),controller['addAgents']);router[_0x8974('0x16')](_0x8974('0xc'),auth[_0x8974('0x9')](),controller[_0x8974('0x17')]);router[_0x8974('0x18')](_0x8974('0xc'),auth[_0x8974('0x9')](),controller[_0x8974('0x19')]);router['delete']('/:id/teams',auth[_0x8974('0x9')](),controller[_0x8974('0x1a')]);router[_0x8974('0x18')](_0x8974('0x15'),auth[_0x8974('0x9')](),controller[_0x8974('0x1b')]);module[_0x8974('0x1c')]=router; \ No newline at end of file +var _0x211c=['getAgents','post','create','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x99f5e7,_0x3e6f9d){var _0x183688=function(_0x55e9ef){while(--_0x55e9ef){_0x99f5e7['push'](_0x99f5e7['shift']());}};_0x183688(++_0x3e6f9d);}(_0x211c,0xa7));var _0xc211=function(_0x4de460,_0x531bb1){_0x4de460=_0x4de460-0x0;var _0x23c8f6=_0x211c[_0x4de460];return _0x23c8f6;};'use strict';var multer=require('multer');var util=require(_0xc211('0x0'));var path=require(_0xc211('0x1'));var express=require('express');var router=express[_0xc211('0x2')]();var auth=require(_0xc211('0x3'));var interaction=require(_0xc211('0x4'));var config=require(_0xc211('0x5'));var controller=require(_0xc211('0x6'));router[_0xc211('0x7')]('/',auth[_0xc211('0x8')](),controller['index']);router['get'](_0xc211('0x9'),auth[_0xc211('0x8')](),controller['describe']);router[_0xc211('0x7')]('/:id',auth[_0xc211('0x8')](),controller[_0xc211('0xa')]);router[_0xc211('0x7')](_0xc211('0xb'),auth[_0xc211('0x8')](),controller[_0xc211('0xc')]);router['get'](_0xc211('0xd'),auth[_0xc211('0x8')](),controller['getTeams']);router['get'](_0xc211('0xe'),auth['isAuthenticated'](),controller[_0xc211('0xf')]);router[_0xc211('0x10')]('/',auth[_0xc211('0x8')](),controller[_0xc211('0x11')]);router['post'](_0xc211('0xd'),auth[_0xc211('0x8')](),controller['addTeams']);router[_0xc211('0x10')]('/:id/users',auth[_0xc211('0x8')](),controller[_0xc211('0x12')]);router[_0xc211('0x13')](_0xc211('0x14'),auth[_0xc211('0x8')](),controller['update']);router[_0xc211('0x15')](_0xc211('0x14'),auth[_0xc211('0x8')](),controller[_0xc211('0x16')]);router[_0xc211('0x15')](_0xc211('0xd'),auth[_0xc211('0x8')](),controller[_0xc211('0x17')]);router[_0xc211('0x15')](_0xc211('0xe'),auth[_0xc211('0x8')](),controller[_0xc211('0x18')]);module[_0xc211('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9b8e77c..90b41ab 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 _0x3a77=['beepall','roundrobin','STRING','name','INTEGER','ENUM'];(function(_0x7b2930,_0x22ce18){var _0xf0daef=function(_0x366101){while(--_0x366101){_0x7b2930['push'](_0x7b2930['shift']());}};_0xf0daef(++_0x22ce18);}(_0x3a77,0x1be));var _0x73a7=function(_0x115966,_0x47faf0){_0x115966=_0x115966-0x0;var _0x54b11b=_0x3a77[_0x115966];return _0x54b11b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x73a7('0x0')],'unique':_0x73a7('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x73a7('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x73a7('0x3')]('rrmemory',_0x73a7('0x4'),_0x73a7('0x5'))}}; \ No newline at end of file +var _0x84fb=['roundrobin','exports','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3241e6,_0x49b00a){var _0x46e2c6=function(_0xd05144){while(--_0xd05144){_0x3241e6['push'](_0x3241e6['shift']());}};_0x46e2c6(++_0x49b00a);}(_0x84fb,0x1a5));var _0xb84f=function(_0x28603e,_0xdd9c21){_0x28603e=_0x28603e-0x0;var _0x51f910=_0x84fb[_0x28603e];return _0x51f910;};'use strict';var Sequelize=require('sequelize');module[_0xb84f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb84f('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb84f('0x2')](_0xb84f('0x3'),_0xb84f('0x4'),_0xb84f('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4423a29..0712bb1 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 _0x4975=['pick','OpenchannelQueueId','findAndCountAll','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','User','Agents','penalty','removeTeams','union','removeAgents','addAgents','omit','spread','emit','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','socket.io-emitter','./openchannelQueue.socket','end','status','json','offset','limit','Content-Range','apply','save','then','sendStatus','stack','name','send','index','OpenchannelQueue','model','keys','query','dateEnd','dateStart','fields','attributes','hasOwnProperty','order','sort','where','filters','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','params','rawAttributes','intersection','length','create','body','catch','update','find','destroy','describe','findOne','UserOpenchannelQueue','nolimit'];(function(_0x58c6ac,_0x173cb6){var _0x208479=function(_0x20ac32){while(--_0x20ac32){_0x58c6ac['push'](_0x58c6ac['shift']());}};_0x208479(++_0x173cb6);}(_0x4975,0x140));var _0x5497=function(_0x4cbf0d,_0x4750bc){_0x4cbf0d=_0x4cbf0d-0x0;var _0x171635=_0x4975[_0x4cbf0d];return _0x171635;};'use strict';var jsonpatch=require(_0x5497('0x0'));var rp=require(_0x5497('0x1'));var moment=require(_0x5497('0x2'));var BPromise=require(_0x5497('0x3'));var Mustache=require(_0x5497('0x4'));var util=require(_0x5497('0x5'));var path=require(_0x5497('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5497('0x7'));var fs=require('fs');var _=require(_0x5497('0x8'));var squel=require(_0x5497('0x9'));var crypto=require(_0x5497('0xa'));var jsforce=require(_0x5497('0xb'));var deskjs=require(_0x5497('0xc'));var toCsv=require(_0x5497('0xd'));var querystring=require(_0x5497('0xe'));var Papa=require(_0x5497('0xf'));var qs=require(_0x5497('0x10'));var logger=require(_0x5497('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x5497('0x12'))({'host':'localhost','port':0x18eb});require(_0x5497('0x13'))['register'](socket);function respondWithStatusCode(_0x2c5b8b,_0x442668){_0x442668=_0x442668||0xcc;return function(_0x20a79c){if(_0x20a79c){return _0x2c5b8b['sendStatus'](_0x442668);}return _0x2c5b8b['status'](_0x442668)[_0x5497('0x14')]();};}function respondWithResult(_0x542aba,_0x2ed011){_0x2ed011=_0x2ed011||0xc8;return function(_0x572868){if(_0x572868){return _0x542aba[_0x5497('0x15')](_0x2ed011)[_0x5497('0x16')](_0x572868);}};}function respondWithFilteredResult(_0xb7c1f0,_0x9e4e22){return function(_0x3f67e2){if(_0x3f67e2){var _0x230778=_0x3f67e2['count'],_0x3f6e83=_0x9e4e22['offset'],_0x3e7dd1=_0x9e4e22[_0x5497('0x17')]+_0x9e4e22[_0x5497('0x18')],_0x11a98c;if(_0x3e7dd1>=_0x230778){_0x3e7dd1=_0x230778;_0x11a98c=0xc8;}else{_0x11a98c=0xce;}_0xb7c1f0[_0x5497('0x15')](_0x11a98c);return _0xb7c1f0['set'](_0x5497('0x19'),_0x3f6e83+'-'+_0x3e7dd1+'/'+_0x230778)[_0x5497('0x16')](_0x3f67e2);}return null;};}function patchUpdates(_0xeb3cfe){return function(_0x4b3092){try{jsonpatch[_0x5497('0x1a')](_0x4b3092,_0xeb3cfe,!![]);}catch(_0x1efab2){return BPromise['reject'](_0x1efab2);}return _0x4b3092[_0x5497('0x1b')]();};}function saveUpdates(_0x3ccdab,_0x2dbced){return function(_0x5d56d7){if(_0x5d56d7){return _0x5d56d7['update'](_0x3ccdab)[_0x5497('0x1c')](function(_0x1fc1f3){return _0x1fc1f3;});}return null;};}function removeEntity(_0x54c70d,_0x3a2181){return function(_0x41b7a0){if(_0x41b7a0){return _0x41b7a0['destroy']()[_0x5497('0x1c')](function(){_0x54c70d['status'](0xcc)[_0x5497('0x14')]();});}};}function handleEntityNotFound(_0x1d268d,_0x554971){return function(_0x31cebd){if(!_0x31cebd){_0x1d268d[_0x5497('0x1d')](0x194);}return _0x31cebd;};}function handleError(_0x3120b3,_0x45dd1f){_0x45dd1f=_0x45dd1f||0x1f4;return function(_0x16190d){logger['error'](_0x16190d[_0x5497('0x1e')]);if(_0x16190d[_0x5497('0x1f')]){delete _0x16190d['name'];}_0x3120b3[_0x5497('0x15')](_0x45dd1f)[_0x5497('0x20')](_0x16190d);};}exports[_0x5497('0x21')]=function(_0x2390a6,_0x32f679){var _0x4375f1={},_0x2617f0={},_0x9bed57={'count':0x0,'rows':[]};var _0x410ac1=db[_0x5497('0x22')]['rawAttributes'];_0x2617f0[_0x5497('0x23')]=_[_0x5497('0x24')](_0x410ac1);var _0x4fd60e={'dateStart':_0x2390a6[_0x5497('0x25')]['dateStart'],'dateEnd':_0x2390a6[_0x5497('0x25')][_0x5497('0x26')]};delete _0x2390a6[_0x5497('0x25')][_0x5497('0x27')];delete _0x2390a6[_0x5497('0x25')][_0x5497('0x26')];_0x2617f0[_0x5497('0x25')]=_[_0x5497('0x24')](_0x2390a6[_0x5497('0x25')]);_0x2617f0['filters']=_['intersection'](_0x2617f0[_0x5497('0x23')],_0x2617f0['query']);_0x4375f1['attributes']=_['intersection'](_0x2617f0['model'],qs[_0x5497('0x28')](_0x2390a6[_0x5497('0x25')][_0x5497('0x28')]));_0x4375f1[_0x5497('0x29')]=_0x4375f1[_0x5497('0x29')]['length']?_0x4375f1[_0x5497('0x29')]:_0x2617f0[_0x5497('0x23')];if(!_0x2390a6[_0x5497('0x25')][_0x5497('0x2a')]('nolimit')){_0x4375f1['limit']=qs['limit'](_0x2390a6[_0x5497('0x25')][_0x5497('0x18')]);_0x4375f1[_0x5497('0x17')]=qs[_0x5497('0x17')](_0x2390a6[_0x5497('0x25')][_0x5497('0x17')]);}_0x4375f1[_0x5497('0x2b')]=qs[_0x5497('0x2c')](_0x2390a6[_0x5497('0x25')][_0x5497('0x2c')]);_0x4375f1[_0x5497('0x2d')]=qs[_0x5497('0x2e')](_['pick'](_0x2390a6['query'],_0x2617f0['filters']));if(_0x4fd60e[_0x5497('0x27')]){if(_0x4fd60e[_0x5497('0x26')]){_0x4fd60e[_0x5497('0x26')]=moment(_0x4fd60e['dateEnd'])[_0x5497('0x2f')](0x1,_0x5497('0x30'));}else{_0x4fd60e['dateEnd']=moment(_0x4fd60e[_0x5497('0x27')])['add'](0x1,'day');}_[_0x5497('0x31')](_0x4375f1[_0x5497('0x2d')],{'createdAt':{'$gte':_0x4fd60e['dateStart'],'$lte':_0x4fd60e['dateEnd']}});}if(_0x2390a6[_0x5497('0x25')][_0x5497('0x32')]){_0x4375f1[_0x5497('0x2d')]=_[_0x5497('0x31')](_0x4375f1[_0x5497('0x2d')],{'$or':_[_0x5497('0x33')](_0x4375f1[_0x5497('0x29')],function(_0x2c1cfe){var _0x1e96c3={};_0x1e96c3[_0x2c1cfe]={'$like':'%'+_0x2390a6[_0x5497('0x25')]['filter']+'%'};return _0x1e96c3;})});}_0x4375f1=_[_0x5497('0x31')]({},_0x4375f1,_0x2390a6[_0x5497('0x34')]);var _0x4086d2={'where':_0x4375f1[_0x5497('0x2d')]};return db[_0x5497('0x22')][_0x5497('0x35')](_0x4086d2)['then'](function(_0xbcfa12){_0x9bed57[_0x5497('0x35')]=_0xbcfa12;if(_0x2390a6[_0x5497('0x25')][_0x5497('0x36')]){_0x4375f1[_0x5497('0x37')]=[{'all':!![]}];}return db[_0x5497('0x22')][_0x5497('0x38')](_0x4375f1);})[_0x5497('0x1c')](function(_0x348a51){_0x9bed57[_0x5497('0x39')]=_0x348a51;return _0x9bed57;})[_0x5497('0x1c')](respondWithFilteredResult(_0x32f679,_0x4375f1))['catch'](handleError(_0x32f679,null));};exports['show']=function(_0x5190b9,_0xe5935c){var _0x2eecc0={'raw':!![],'where':{'id':_0x5190b9[_0x5497('0x3a')]['id']}},_0x404095={};_0x404095[_0x5497('0x23')]=_[_0x5497('0x24')](db[_0x5497('0x22')][_0x5497('0x3b')]);_0x404095[_0x5497('0x25')]=_[_0x5497('0x24')](_0x5190b9[_0x5497('0x25')]);_0x404095[_0x5497('0x2e')]=_[_0x5497('0x3c')](_0x404095[_0x5497('0x23')],_0x404095[_0x5497('0x25')]);_0x2eecc0[_0x5497('0x29')]=_[_0x5497('0x3c')](_0x404095['model'],qs[_0x5497('0x28')](_0x5190b9[_0x5497('0x25')][_0x5497('0x28')]));_0x2eecc0[_0x5497('0x29')]=_0x2eecc0[_0x5497('0x29')][_0x5497('0x3d')]?_0x2eecc0[_0x5497('0x29')]:_0x404095[_0x5497('0x23')];if(_0x5190b9[_0x5497('0x25')][_0x5497('0x36')]){_0x2eecc0[_0x5497('0x37')]=[{'all':!![]}];}_0x2eecc0=_[_0x5497('0x31')]({},_0x2eecc0,_0x5190b9['options']);return db[_0x5497('0x22')]['find'](_0x2eecc0)[_0x5497('0x1c')](handleEntityNotFound(_0xe5935c,null))[_0x5497('0x1c')](respondWithResult(_0xe5935c,null))['catch'](handleError(_0xe5935c,null));};exports[_0x5497('0x3e')]=function(_0x4c3b7d,_0x295405){return db[_0x5497('0x22')][_0x5497('0x3e')](_0x4c3b7d[_0x5497('0x3f')],{})[_0x5497('0x1c')](respondWithResult(_0x295405,0xc9))[_0x5497('0x40')](handleError(_0x295405,null));};exports[_0x5497('0x41')]=function(_0x52f1ca,_0x12115b){if(_0x52f1ca[_0x5497('0x3f')]['id']){delete _0x52f1ca[_0x5497('0x3f')]['id'];}return db['OpenchannelQueue'][_0x5497('0x42')]({'where':{'id':_0x52f1ca[_0x5497('0x3a')]['id']}})[_0x5497('0x1c')](handleEntityNotFound(_0x12115b,null))[_0x5497('0x1c')](saveUpdates(_0x52f1ca[_0x5497('0x3f')],null))[_0x5497('0x1c')](respondWithResult(_0x12115b,null))[_0x5497('0x40')](handleError(_0x12115b,null));};exports[_0x5497('0x43')]=function(_0x50d46f,_0x23fc03){return db[_0x5497('0x22')][_0x5497('0x42')]({'where':{'id':_0x50d46f[_0x5497('0x3a')]['id']}})[_0x5497('0x1c')](handleEntityNotFound(_0x23fc03,null))[_0x5497('0x1c')](removeEntity(_0x23fc03,null))['catch'](handleError(_0x23fc03,null));};exports[_0x5497('0x44')]=function(_0x3893dd,_0x3281c6){return db[_0x5497('0x22')][_0x5497('0x44')]()[_0x5497('0x1c')](respondWithResult(_0x3281c6,null))[_0x5497('0x40')](handleError(_0x3281c6,null));};exports['getMembers']=function(_0x42c97f,_0x40ce2e,_0x3c0bbb){var _0x195763={'raw':!![],'where':{}},_0xab9a22={},_0x1a9f78;return db[_0x5497('0x22')][_0x5497('0x45')]({'where':{'id':_0x42c97f[_0x5497('0x3a')]['id']}})[_0x5497('0x1c')](handleEntityNotFound(_0x40ce2e,null))[_0x5497('0x1c')](function(_0x7f2e24){if(_0x7f2e24){_0x1a9f78=_0x7f2e24['get']({'plain':!![]});_0xab9a22[_0x5497('0x23')]=_['keys'](db[_0x5497('0x46')]['rawAttributes']);_0xab9a22[_0x5497('0x25')]=_[_0x5497('0x24')](_0x42c97f[_0x5497('0x25')]);_0xab9a22[_0x5497('0x2e')]=_['intersection'](_0xab9a22[_0x5497('0x23')],_0xab9a22[_0x5497('0x25')]);_0x195763[_0x5497('0x29')]=_[_0x5497('0x3c')](_0xab9a22[_0x5497('0x23')],qs[_0x5497('0x28')](_0x42c97f[_0x5497('0x25')][_0x5497('0x28')]));_0x195763[_0x5497('0x29')]=_0x195763[_0x5497('0x29')][_0x5497('0x3d')]?_0x195763[_0x5497('0x29')]:_0xab9a22[_0x5497('0x23')];if(!_0x42c97f['query'][_0x5497('0x2a')](_0x5497('0x47'))){_0x195763['limit']=qs[_0x5497('0x18')](_0x42c97f[_0x5497('0x25')]['limit']);_0x195763[_0x5497('0x17')]=qs[_0x5497('0x17')](_0x42c97f['query'][_0x5497('0x17')]);}_0x195763[_0x5497('0x2b')]=qs[_0x5497('0x2c')](_0x42c97f[_0x5497('0x25')][_0x5497('0x2c')]);_0x195763['where']=qs[_0x5497('0x2e')](_[_0x5497('0x48')](_0x42c97f[_0x5497('0x25')],_0xab9a22[_0x5497('0x2e')]));_0x195763[_0x5497('0x2d')][_0x5497('0x49')]=_0x7f2e24['id'];if(_0x42c97f[_0x5497('0x25')][_0x5497('0x32')]){_0x195763[_0x5497('0x2d')]=_[_0x5497('0x31')](_0x195763[_0x5497('0x2d')],{'$or':_[_0x5497('0x33')](_0x195763[_0x5497('0x29')],function(_0xc5d686){var _0x2fb187={};_0x2fb187[_0xc5d686]={'$like':'%'+_0x42c97f['query'][_0x5497('0x32')]+'%'};return _0x2fb187;})});}_0x195763=_['merge']({},_0x195763,_0x42c97f[_0x5497('0x34')]);return db[_0x5497('0x46')][_0x5497('0x38')](_0x195763);}})[_0x5497('0x1c')](function(_0x4a7502){if(_0x4a7502){return db['User'][_0x5497('0x4a')]({'where':{'id':_['map'](_0x4a7502,'UserId'),'role':'agent'},'attributes':['id',_0x5497('0x1f'),_0x5497('0x4b'),_0x5497('0x4c'),_0x5497('0x4d')]});}})['then'](function(_0x3be0ea){if(_0x3be0ea){return{'count':_0x3be0ea['count'],'rows':_[_0x5497('0x33')](_0x3be0ea[_0x5497('0x39')],function(_0x39865a){return{'membername':_0x39865a[_0x5497('0x1f')],'UserId':_0x39865a['id'],'queue_name':_0x1a9f78[_0x5497('0x1f')],'OpenchannelQueueId':_0x1a9f78['id'],'interface':util[_0x5497('0x4e')]('%s/%s',_0x5497('0x4f'),_0x39865a[_0x5497('0x1f')]),'penalty':0x0,'paused':_0x39865a[_0x5497('0x4b')],'createdAt':_0x39865a[_0x5497('0x4d')],'updatedAt':_0x39865a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5497('0x1c')](respondWithFilteredResult(_0x40ce2e,_0x195763))['catch'](handleError(_0x40ce2e,null));};exports[_0x5497('0x50')]=function(_0x45a326,_0x382a7b,_0x20342d){var _0x3011cb={};var _0xb9e7e3={};var _0x2d42fa;var _0x416c2e;return db[_0x5497('0x22')][_0x5497('0x45')]({'where':{'id':_0x45a326[_0x5497('0x3a')]['id']}})[_0x5497('0x1c')](handleEntityNotFound(_0x382a7b,null))[_0x5497('0x1c')](function(_0x2825fe){if(_0x2825fe){_0x2d42fa=_0x2825fe;_0xb9e7e3[_0x5497('0x23')]=_['keys'](db[_0x5497('0x51')][_0x5497('0x3b')]);_0xb9e7e3['query']=_[_0x5497('0x24')](_0x45a326[_0x5497('0x25')]);_0xb9e7e3[_0x5497('0x2e')]=_['intersection'](_0xb9e7e3[_0x5497('0x23')],_0xb9e7e3[_0x5497('0x25')]);_0x3011cb[_0x5497('0x29')]=_[_0x5497('0x3c')](_0xb9e7e3[_0x5497('0x23')],qs[_0x5497('0x28')](_0x45a326['query'][_0x5497('0x28')]));_0x3011cb['attributes']=_0x3011cb['attributes'][_0x5497('0x3d')]?_0x3011cb[_0x5497('0x29')]:_0xb9e7e3['model'];_0x3011cb[_0x5497('0x2b')]=qs['sort'](_0x45a326['query'][_0x5497('0x2c')]);_0x3011cb[_0x5497('0x2d')]=qs['filters'](_[_0x5497('0x48')](_0x45a326[_0x5497('0x25')],_0xb9e7e3[_0x5497('0x2e')]));if(_0x45a326['query'][_0x5497('0x32')]){_0x3011cb['where']=_[_0x5497('0x31')](_0x3011cb[_0x5497('0x2d')],{'$or':_[_0x5497('0x33')](_0x3011cb[_0x5497('0x29')],function(_0x12803f){var _0x4a60a6={};_0x4a60a6[_0x12803f]={'$like':'%'+_0x45a326['query'][_0x5497('0x32')]+'%'};return _0x4a60a6;})});}_0x3011cb=_[_0x5497('0x31')]({},_0x3011cb,_0x45a326[_0x5497('0x34')]);return _0x2d42fa[_0x5497('0x50')](_0x3011cb);}})[_0x5497('0x1c')](function(_0x5c56bb){if(_0x5c56bb){_0x416c2e=_0x5c56bb[_0x5497('0x3d')];if(!_0x45a326[_0x5497('0x25')][_0x5497('0x2a')](_0x5497('0x47'))){_0x3011cb['limit']=qs['limit'](_0x45a326[_0x5497('0x25')]['limit']);_0x3011cb[_0x5497('0x17')]=qs[_0x5497('0x17')](_0x45a326['query']['offset']);}return _0x2d42fa[_0x5497('0x50')](_0x3011cb);}})[_0x5497('0x1c')](function(_0x20590e){if(_0x20590e){return _0x20590e?{'count':_0x416c2e,'rows':_0x20590e}:null;}})['then'](respondWithResult(_0x382a7b,null))['catch'](handleError(_0x382a7b,null));};exports[_0x5497('0x52')]=function(_0x47c680,_0x33f204,_0x1b7a09){var _0xda4519=[];var _0x48b0e1;return db[_0x5497('0x51')][_0x5497('0x38')]({'where':{'id':_0x47c680[_0x5497('0x3f')][_0x5497('0x53')]},'attributes':['id'],'include':[{'model':db[_0x5497('0x54')],'as':_0x5497('0x55'),'attributes':['id'],'raw':!![]}]})[_0x5497('0x1c')](function(_0x3529e3){if(_0x3529e3){for(var _0x22ce3c=0x0;_0x22ce3c<_0x3529e3['length'];_0x22ce3c+=0x1){for(var _0x487b4f=0x0;_0x487b4f<_0x3529e3[_0x22ce3c][_0x5497('0x55')][_0x5497('0x3d')];_0x487b4f+=0x1){_0xda4519=_['union'](_0xda4519,[_0x3529e3[_0x22ce3c][_0x5497('0x55')][_0x487b4f]['id']]);}}return _0xda4519;}})['then'](function(_0x17a68a){if(_0x17a68a){return db['OpenchannelQueue'][_0x5497('0x42')]({'where':{'id':_0x47c680[_0x5497('0x3a')]['id']}});}})['then'](function(_0x5e7ec1){if(_0x5e7ec1){_0x48b0e1=_0x5e7ec1;return _0x48b0e1['addAgents'](_0xda4519,{'penalty':_0x47c680[_0x5497('0x3f')][_0x5497('0x56')]});}})[_0x5497('0x1c')](function(_0x19cb41){if(_0x19cb41){return _0x48b0e1['addTeams'](_0x47c680[_0x5497('0x3f')]['ids']);}})[_0x5497('0x1c')](handleEntityNotFound(_0x33f204,null))[_0x5497('0x1c')](respondWithStatusCode(_0x33f204,null))[_0x5497('0x40')](handleError(_0x33f204,null));};exports[_0x5497('0x57')]=function(_0x3aa912,_0x1a7e9e,_0x54ff54){var _0x1f6e0a=[];var _0xa12f76;return db['Team'][_0x5497('0x38')]({'where':{'id':_0x3aa912['query'][_0x5497('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5497('0x55'),'attributes':['id'],'raw':!![]}]})[_0x5497('0x1c')](function(_0x1123fa){if(_0x1123fa){for(var _0x1bcfc5=0x0;_0x1bcfc5<_0x1123fa[_0x5497('0x3d')];_0x1bcfc5+=0x1){for(var _0x6df796=0x0;_0x6df796<_0x1123fa[_0x1bcfc5][_0x5497('0x55')][_0x5497('0x3d')];_0x6df796+=0x1){_0x1f6e0a=_[_0x5497('0x58')](_0x1f6e0a,[_0x1123fa[_0x1bcfc5][_0x5497('0x55')][_0x6df796]['id']]);}}return _0x1f6e0a;}})[_0x5497('0x1c')](function(_0x1997ba){if(_0x1997ba){return db[_0x5497('0x22')]['find']({'where':{'id':_0x3aa912[_0x5497('0x3a')]['id']}});}})[_0x5497('0x1c')](function(_0x5ec33a){if(_0x5ec33a){_0xa12f76=_0x5ec33a;return _0xa12f76[_0x5497('0x59')](_0x1f6e0a);}})[_0x5497('0x1c')](function(_0x450c4e){if(_0xa12f76){return _0xa12f76[_0x5497('0x57')](_0x3aa912['query'][_0x5497('0x53')]);}})['then'](handleEntityNotFound(_0x1a7e9e,null))[_0x5497('0x1c')](respondWithStatusCode(_0x1a7e9e,null))['catch'](handleError(_0x1a7e9e,null));};exports[_0x5497('0x5a')]=function(_0x1a2645,_0x4af626,_0x1c0ede){return db['OpenchannelQueue'][_0x5497('0x42')]({'where':{'id':_0x1a2645[_0x5497('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4af626,null))[_0x5497('0x1c')](function(_0x1a03b0){if(_0x1a03b0){return _0x1a03b0['addAgents'](_0x1a2645[_0x5497('0x3f')][_0x5497('0x53')],_[_0x5497('0x5b')](_0x1a2645[_0x5497('0x3f')],[_0x5497('0x53'),'id'])||{})[_0x5497('0x5c')](function(_0x1817ac){for(var _0x40cca4=0x0;_0x40cca4<_0x1a2645[_0x5497('0x3f')][_0x5497('0x53')][_0x5497('0x3d')];_0x40cca4+=0x1){socket[_0x5497('0x5d')](_0x5497('0x5e'),{'UserId':_0x1a2645['body'][_0x5497('0x53')][_0x40cca4],'OpenchannelQueueId':_0x1a2645[_0x5497('0x3a')]['id']});}return _0x1817ac;});}})[_0x5497('0x1c')](respondWithResult(_0x4af626,null))[_0x5497('0x40')](handleError(_0x4af626,null));};exports[_0x5497('0x59')]=function(_0x20bf14,_0x269300,_0x1f1d2f){var _0x346207;return db[_0x5497('0x22')][_0x5497('0x42')]({'where':{'id':_0x20bf14['params']['id']}})['then'](handleEntityNotFound(_0x269300,null))[_0x5497('0x1c')](function(_0x153f9f){if(_0x153f9f){return _0x153f9f[_0x5497('0x59')](_0x20bf14[_0x5497('0x25')][_0x5497('0x53')])['then'](function(_0xd59902){if(_[_0x5497('0x5f')](_0x20bf14[_0x5497('0x25')][_0x5497('0x53')])){for(var _0x2ce0f4=0x0;_0x2ce0f4<_0x20bf14[_0x5497('0x25')][_0x5497('0x53')][_0x5497('0x3d')];_0x2ce0f4+=0x1){socket[_0x5497('0x5d')](_0x5497('0x60'),{'UserId':_0x20bf14[_0x5497('0x25')]['ids'][_0x2ce0f4],'OpenchannelQueueId':_0x20bf14[_0x5497('0x3a')]['id']});}}else{socket[_0x5497('0x5d')](_0x5497('0x60'),{'UserId':_0x20bf14['query'][_0x5497('0x53')],'OpenchannelQueueId':_0x20bf14[_0x5497('0x3a')]['id']});}});}})[_0x5497('0x1c')](respondWithStatusCode(_0x269300,null))[_0x5497('0x40')](handleError(_0x269300,null));};exports[_0x5497('0x61')]=function(_0x12dfd6,_0x2c4fb3,_0x596187){var _0x426c68={};var _0x3b5529={};var _0x90a89e;var _0x3f4280;return db[_0x5497('0x22')]['findOne']({'where':{'id':_0x12dfd6[_0x5497('0x3a')]['id']}})[_0x5497('0x1c')](handleEntityNotFound(_0x2c4fb3,null))[_0x5497('0x1c')](function(_0x14ef48){if(_0x14ef48){_0x90a89e=_0x14ef48;_0x3b5529[_0x5497('0x23')]=_[_0x5497('0x24')](db[_0x5497('0x54')][_0x5497('0x3b')]);_0x3b5529[_0x5497('0x25')]=_['keys'](_0x12dfd6['query']);_0x3b5529['filters']=_['intersection'](_0x3b5529[_0x5497('0x23')],_0x3b5529[_0x5497('0x25')]);_0x426c68[_0x5497('0x29')]=_[_0x5497('0x3c')](_0x3b5529[_0x5497('0x23')],qs[_0x5497('0x28')](_0x12dfd6['query']['fields']));_0x426c68[_0x5497('0x29')]=_0x426c68[_0x5497('0x29')][_0x5497('0x3d')]?_0x426c68[_0x5497('0x29')]:_0x3b5529[_0x5497('0x23')];_0x426c68[_0x5497('0x2b')]=qs[_0x5497('0x2c')](_0x12dfd6[_0x5497('0x25')][_0x5497('0x2c')]);_0x426c68['where']=qs[_0x5497('0x2e')](_[_0x5497('0x48')](_0x12dfd6[_0x5497('0x25')],_0x3b5529[_0x5497('0x2e')]));if(_0x12dfd6[_0x5497('0x25')]['filter']){_0x426c68['where']=_['merge'](_0x426c68[_0x5497('0x2d')],{'$or':_[_0x5497('0x33')](_0x426c68[_0x5497('0x29')],function(_0x46951f){var _0x2cf3bf={};_0x2cf3bf[_0x46951f]={'$like':'%'+_0x12dfd6[_0x5497('0x25')][_0x5497('0x32')]+'%'};return _0x2cf3bf;})});}_0x426c68=_[_0x5497('0x31')]({},_0x426c68,_0x12dfd6[_0x5497('0x34')]);return _0x90a89e[_0x5497('0x61')](_0x426c68);}})[_0x5497('0x1c')](function(_0x24c45c){if(_0x24c45c){_0x3f4280=_0x24c45c[_0x5497('0x3d')];if(!_0x12dfd6[_0x5497('0x25')][_0x5497('0x2a')](_0x5497('0x47'))){_0x426c68[_0x5497('0x18')]=qs[_0x5497('0x18')](_0x12dfd6[_0x5497('0x25')][_0x5497('0x18')]);_0x426c68[_0x5497('0x17')]=qs[_0x5497('0x17')](_0x12dfd6[_0x5497('0x25')][_0x5497('0x17')]);}return _0x90a89e[_0x5497('0x61')](_0x426c68);}})['then'](function(_0x37e0a1){if(_0x37e0a1){return _0x37e0a1?{'count':_0x3f4280,'rows':_0x37e0a1}:null;}})[_0x5497('0x1c')](respondWithResult(_0x2c4fb3,null))[_0x5497('0x40')](handleError(_0x2c4fb3,null));}; \ No newline at end of file +var _0x119c=['reject','save','update','destroy','then','error','stack','name','send','index','OpenchannelQueue','rawAttributes','model','keys','query','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','dateStart','add','day','merge','filter','where','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','map','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','addAgents','penalty','removeTeams','removeAgents','spread','emit','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x119c,0xb0));var _0xc119=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x119c[_0x4a9a17];return _0x30e831;};'use strict';var jsonpatch=require(_0xc119('0x0'));var rp=require(_0xc119('0x1'));var moment=require(_0xc119('0x2'));var BPromise=require(_0xc119('0x3'));var Mustache=require(_0xc119('0x4'));var util=require(_0xc119('0x5'));var path=require(_0xc119('0x6'));var sox=require(_0xc119('0x7'));var csv=require('to-csv');var ejs=require(_0xc119('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc119('0x9'));var jsforce=require(_0xc119('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc119('0xb'));var querystring=require(_0xc119('0xc'));var Papa=require('papaparse');var qs=require(_0xc119('0xd'));var logger=require(_0xc119('0xe'))(_0xc119('0xf'));var utils=require('../../config/utils');var config=require(_0xc119('0x10'));var db=require(_0xc119('0x11'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xc119('0x12'))[_0xc119('0x13')](socket);function respondWithStatusCode(_0x2298fd,_0x1bc372){_0x1bc372=_0x1bc372||0xcc;return function(_0xb554d){if(_0xb554d){return _0x2298fd[_0xc119('0x14')](_0x1bc372);}return _0x2298fd[_0xc119('0x15')](_0x1bc372)['end']();};}function respondWithResult(_0x4ae76a,_0x1d6e49){_0x1d6e49=_0x1d6e49||0xc8;return function(_0x40caeb){if(_0x40caeb){return _0x4ae76a[_0xc119('0x15')](_0x1d6e49)[_0xc119('0x16')](_0x40caeb);}};}function respondWithFilteredResult(_0x4d8b4c,_0x225a5a){return function(_0x57e64b){if(_0x57e64b){var _0x1d29d0=_0x57e64b[_0xc119('0x17')],_0x2868e2=_0x225a5a['offset'],_0x2d5e7a=_0x225a5a[_0xc119('0x18')]+_0x225a5a[_0xc119('0x19')],_0x720bab;if(_0x2d5e7a>=_0x1d29d0){_0x2d5e7a=_0x1d29d0;_0x720bab=0xc8;}else{_0x720bab=0xce;}_0x4d8b4c[_0xc119('0x15')](_0x720bab);return _0x4d8b4c[_0xc119('0x1a')](_0xc119('0x1b'),_0x2868e2+'-'+_0x2d5e7a+'/'+_0x1d29d0)[_0xc119('0x16')](_0x57e64b);}return null;};}function patchUpdates(_0x448998){return function(_0x285749){try{jsonpatch['apply'](_0x285749,_0x448998,!![]);}catch(_0x2593e3){return BPromise[_0xc119('0x1c')](_0x2593e3);}return _0x285749[_0xc119('0x1d')]();};}function saveUpdates(_0x5c5c67,_0x374af0){return function(_0x5e9778){if(_0x5e9778){return _0x5e9778[_0xc119('0x1e')](_0x5c5c67)['then'](function(_0x2ae5ad){return _0x2ae5ad;});}return null;};}function removeEntity(_0x29b3bf,_0x4a13da){return function(_0x5727d1){if(_0x5727d1){return _0x5727d1[_0xc119('0x1f')]()[_0xc119('0x20')](function(){_0x29b3bf[_0xc119('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f9e82,_0x1f6670){return function(_0x3f6552){if(!_0x3f6552){_0x4f9e82['sendStatus'](0x194);}return _0x3f6552;};}function handleError(_0x29189c,_0x60d163){_0x60d163=_0x60d163||0x1f4;return function(_0x53908d){logger[_0xc119('0x21')](_0x53908d[_0xc119('0x22')]);if(_0x53908d[_0xc119('0x23')]){delete _0x53908d[_0xc119('0x23')];}_0x29189c['status'](_0x60d163)[_0xc119('0x24')](_0x53908d);};}exports[_0xc119('0x25')]=function(_0x2caf9b,_0x4dd72a){var _0x24c989={},_0x1adec3={},_0x34d4e0={'count':0x0,'rows':[]};var _0x49aa6c=db[_0xc119('0x26')][_0xc119('0x27')];_0x1adec3[_0xc119('0x28')]=_[_0xc119('0x29')](_0x49aa6c);var _0x30fc5a={'dateStart':_0x2caf9b[_0xc119('0x2a')]['dateStart'],'dateEnd':_0x2caf9b['query']['dateEnd']};delete _0x2caf9b[_0xc119('0x2a')]['dateStart'];delete _0x2caf9b[_0xc119('0x2a')][_0xc119('0x2b')];_0x1adec3[_0xc119('0x2a')]=_[_0xc119('0x29')](_0x2caf9b['query']);_0x1adec3[_0xc119('0x2c')]=_['intersection'](_0x1adec3['model'],_0x1adec3[_0xc119('0x2a')]);_0x24c989['attributes']=_[_0xc119('0x2d')](_0x1adec3[_0xc119('0x28')],qs[_0xc119('0x2e')](_0x2caf9b[_0xc119('0x2a')][_0xc119('0x2e')]));_0x24c989[_0xc119('0x2f')]=_0x24c989[_0xc119('0x2f')][_0xc119('0x30')]?_0x24c989['attributes']:_0x1adec3[_0xc119('0x28')];if(!_0x2caf9b['query'][_0xc119('0x31')](_0xc119('0x32'))){_0x24c989[_0xc119('0x19')]=qs['limit'](_0x2caf9b[_0xc119('0x2a')][_0xc119('0x19')]);_0x24c989[_0xc119('0x18')]=qs[_0xc119('0x18')](_0x2caf9b['query'][_0xc119('0x18')]);}_0x24c989[_0xc119('0x33')]=qs[_0xc119('0x34')](_0x2caf9b[_0xc119('0x2a')][_0xc119('0x34')]);_0x24c989['where']=qs[_0xc119('0x2c')](_[_0xc119('0x35')](_0x2caf9b[_0xc119('0x2a')],_0x1adec3['filters']));if(_0x30fc5a[_0xc119('0x36')]){if(_0x30fc5a['dateEnd']){_0x30fc5a[_0xc119('0x2b')]=moment(_0x30fc5a[_0xc119('0x2b')])[_0xc119('0x37')](0x1,_0xc119('0x38'));}else{_0x30fc5a['dateEnd']=moment(_0x30fc5a[_0xc119('0x36')])['add'](0x1,_0xc119('0x38'));}_[_0xc119('0x39')](_0x24c989['where'],{'createdAt':{'$gte':_0x30fc5a[_0xc119('0x36')],'$lte':_0x30fc5a[_0xc119('0x2b')]}});}if(_0x2caf9b[_0xc119('0x2a')][_0xc119('0x3a')]){_0x24c989['where']=_[_0xc119('0x39')](_0x24c989[_0xc119('0x3b')],{'$or':_['map'](_0x24c989[_0xc119('0x2f')],function(_0x3a808f){var _0x58e337={};_0x58e337[_0x3a808f]={'$like':'%'+_0x2caf9b[_0xc119('0x2a')][_0xc119('0x3a')]+'%'};return _0x58e337;})});}_0x24c989=_[_0xc119('0x39')]({},_0x24c989,_0x2caf9b[_0xc119('0x3c')]);var _0x494c75={'where':_0x24c989['where']};return db[_0xc119('0x26')]['count'](_0x494c75)[_0xc119('0x20')](function(_0x2f08a1){_0x34d4e0['count']=_0x2f08a1;if(_0x2caf9b['query'][_0xc119('0x3d')]){_0x24c989['include']=[{'all':!![]}];}return db[_0xc119('0x26')][_0xc119('0x3e')](_0x24c989);})['then'](function(_0x367fcd){_0x34d4e0[_0xc119('0x3f')]=_0x367fcd;return _0x34d4e0;})['then'](respondWithFilteredResult(_0x4dd72a,_0x24c989))[_0xc119('0x40')](handleError(_0x4dd72a,null));};exports[_0xc119('0x41')]=function(_0x442f1c,_0x5028b2){var _0x2ff82a={'raw':!![],'where':{'id':_0x442f1c[_0xc119('0x42')]['id']}},_0x3630ed={};_0x3630ed[_0xc119('0x28')]=_[_0xc119('0x29')](db[_0xc119('0x26')][_0xc119('0x27')]);_0x3630ed[_0xc119('0x2a')]=_['keys'](_0x442f1c[_0xc119('0x2a')]);_0x3630ed[_0xc119('0x2c')]=_[_0xc119('0x2d')](_0x3630ed[_0xc119('0x28')],_0x3630ed[_0xc119('0x2a')]);_0x2ff82a[_0xc119('0x2f')]=_['intersection'](_0x3630ed['model'],qs['fields'](_0x442f1c[_0xc119('0x2a')][_0xc119('0x2e')]));_0x2ff82a[_0xc119('0x2f')]=_0x2ff82a[_0xc119('0x2f')][_0xc119('0x30')]?_0x2ff82a[_0xc119('0x2f')]:_0x3630ed['model'];if(_0x442f1c[_0xc119('0x2a')][_0xc119('0x3d')]){_0x2ff82a[_0xc119('0x43')]=[{'all':!![]}];}_0x2ff82a=_['merge']({},_0x2ff82a,_0x442f1c[_0xc119('0x3c')]);return db[_0xc119('0x26')][_0xc119('0x44')](_0x2ff82a)[_0xc119('0x20')](handleEntityNotFound(_0x5028b2,null))[_0xc119('0x20')](respondWithResult(_0x5028b2,null))['catch'](handleError(_0x5028b2,null));};exports[_0xc119('0x45')]=function(_0x5e8eb2,_0x28ef6b){return db[_0xc119('0x26')][_0xc119('0x45')](_0x5e8eb2['body'],{})[_0xc119('0x20')](respondWithResult(_0x28ef6b,0xc9))[_0xc119('0x40')](handleError(_0x28ef6b,null));};exports[_0xc119('0x1e')]=function(_0x149b16,_0x570c5c){if(_0x149b16[_0xc119('0x46')]['id']){delete _0x149b16['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x149b16[_0xc119('0x42')]['id']}})[_0xc119('0x20')](handleEntityNotFound(_0x570c5c,null))['then'](saveUpdates(_0x149b16[_0xc119('0x46')],null))[_0xc119('0x20')](respondWithResult(_0x570c5c,null))['catch'](handleError(_0x570c5c,null));};exports[_0xc119('0x1f')]=function(_0x13d7d1,_0x17c9fb){return db[_0xc119('0x26')]['find']({'where':{'id':_0x13d7d1[_0xc119('0x42')]['id']}})['then'](handleEntityNotFound(_0x17c9fb,null))[_0xc119('0x20')](removeEntity(_0x17c9fb,null))[_0xc119('0x40')](handleError(_0x17c9fb,null));};exports[_0xc119('0x47')]=function(_0x36760e,_0x3d3882){return db[_0xc119('0x26')][_0xc119('0x47')]()[_0xc119('0x20')](respondWithResult(_0x3d3882,null))[_0xc119('0x40')](handleError(_0x3d3882,null));};exports[_0xc119('0x48')]=function(_0x556273,_0x40592d,_0x3c2b41){var _0x52f337={'raw':!![],'where':{}},_0x290460={},_0x5f5cf9;return db[_0xc119('0x26')][_0xc119('0x49')]({'where':{'id':_0x556273[_0xc119('0x42')]['id']}})[_0xc119('0x20')](handleEntityNotFound(_0x40592d,null))[_0xc119('0x20')](function(_0x2c9c7e){if(_0x2c9c7e){_0x5f5cf9=_0x2c9c7e['get']({'plain':!![]});_0x290460[_0xc119('0x28')]=_[_0xc119('0x29')](db[_0xc119('0x4a')]['rawAttributes']);_0x290460[_0xc119('0x2a')]=_[_0xc119('0x29')](_0x556273[_0xc119('0x2a')]);_0x290460[_0xc119('0x2c')]=_[_0xc119('0x2d')](_0x290460[_0xc119('0x28')],_0x290460[_0xc119('0x2a')]);_0x52f337['attributes']=_[_0xc119('0x2d')](_0x290460[_0xc119('0x28')],qs[_0xc119('0x2e')](_0x556273['query'][_0xc119('0x2e')]));_0x52f337[_0xc119('0x2f')]=_0x52f337['attributes'][_0xc119('0x30')]?_0x52f337['attributes']:_0x290460[_0xc119('0x28')];if(!_0x556273['query'][_0xc119('0x31')](_0xc119('0x32'))){_0x52f337[_0xc119('0x19')]=qs[_0xc119('0x19')](_0x556273['query'][_0xc119('0x19')]);_0x52f337[_0xc119('0x18')]=qs[_0xc119('0x18')](_0x556273[_0xc119('0x2a')][_0xc119('0x18')]);}_0x52f337[_0xc119('0x33')]=qs[_0xc119('0x34')](_0x556273['query'][_0xc119('0x34')]);_0x52f337['where']=qs[_0xc119('0x2c')](_['pick'](_0x556273[_0xc119('0x2a')],_0x290460['filters']));_0x52f337[_0xc119('0x3b')][_0xc119('0x4b')]=_0x2c9c7e['id'];if(_0x556273['query'][_0xc119('0x3a')]){_0x52f337[_0xc119('0x3b')]=_['merge'](_0x52f337[_0xc119('0x3b')],{'$or':_[_0xc119('0x4c')](_0x52f337[_0xc119('0x2f')],function(_0x4b659f){var _0x1ecedf={};_0x1ecedf[_0x4b659f]={'$like':'%'+_0x556273[_0xc119('0x2a')][_0xc119('0x3a')]+'%'};return _0x1ecedf;})});}_0x52f337=_[_0xc119('0x39')]({},_0x52f337,_0x556273[_0xc119('0x3c')]);return db['UserOpenchannelQueue'][_0xc119('0x3e')](_0x52f337);}})[_0xc119('0x20')](function(_0x2efbdc){if(_0x2efbdc){return db[_0xc119('0x4d')][_0xc119('0x4e')]({'where':{'id':_['map'](_0x2efbdc,_0xc119('0x4f')),'role':_0xc119('0x50')},'attributes':['id',_0xc119('0x23'),_0xc119('0x51'),_0xc119('0x52'),_0xc119('0x53')]});}})[_0xc119('0x20')](function(_0x3ba17b){if(_0x3ba17b){return{'count':_0x3ba17b[_0xc119('0x17')],'rows':_['map'](_0x3ba17b[_0xc119('0x3f')],function(_0x29b5dc){return{'membername':_0x29b5dc[_0xc119('0x23')],'UserId':_0x29b5dc['id'],'queue_name':_0x5f5cf9[_0xc119('0x23')],'OpenchannelQueueId':_0x5f5cf9['id'],'interface':util[_0xc119('0x54')](_0xc119('0x55'),_0xc119('0x56'),_0x29b5dc[_0xc119('0x23')]),'penalty':0x0,'paused':_0x29b5dc[_0xc119('0x51')],'createdAt':_0x29b5dc[_0xc119('0x53')],'updatedAt':_0x29b5dc[_0xc119('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc119('0x20')](respondWithFilteredResult(_0x40592d,_0x52f337))[_0xc119('0x40')](handleError(_0x40592d,null));};exports[_0xc119('0x57')]=function(_0x5a5415,_0x2a8614,_0xad9dd9){var _0x349606={};var _0x46a2a9={};var _0x576e6a;var _0x515a53;return db[_0xc119('0x26')][_0xc119('0x49')]({'where':{'id':_0x5a5415[_0xc119('0x42')]['id']}})[_0xc119('0x20')](handleEntityNotFound(_0x2a8614,null))[_0xc119('0x20')](function(_0xea63f7){if(_0xea63f7){_0x576e6a=_0xea63f7;_0x46a2a9[_0xc119('0x28')]=_[_0xc119('0x29')](db[_0xc119('0x58')]['rawAttributes']);_0x46a2a9[_0xc119('0x2a')]=_['keys'](_0x5a5415['query']);_0x46a2a9['filters']=_[_0xc119('0x2d')](_0x46a2a9['model'],_0x46a2a9[_0xc119('0x2a')]);_0x349606['attributes']=_[_0xc119('0x2d')](_0x46a2a9[_0xc119('0x28')],qs[_0xc119('0x2e')](_0x5a5415['query'][_0xc119('0x2e')]));_0x349606['attributes']=_0x349606[_0xc119('0x2f')][_0xc119('0x30')]?_0x349606[_0xc119('0x2f')]:_0x46a2a9[_0xc119('0x28')];_0x349606['order']=qs['sort'](_0x5a5415['query']['sort']);_0x349606[_0xc119('0x3b')]=qs[_0xc119('0x2c')](_[_0xc119('0x35')](_0x5a5415[_0xc119('0x2a')],_0x46a2a9[_0xc119('0x2c')]));if(_0x5a5415['query'][_0xc119('0x3a')]){_0x349606[_0xc119('0x3b')]=_[_0xc119('0x39')](_0x349606[_0xc119('0x3b')],{'$or':_[_0xc119('0x4c')](_0x349606[_0xc119('0x2f')],function(_0x37757d){var _0x354f28={};_0x354f28[_0x37757d]={'$like':'%'+_0x5a5415['query'][_0xc119('0x3a')]+'%'};return _0x354f28;})});}_0x349606=_[_0xc119('0x39')]({},_0x349606,_0x5a5415['options']);return _0x576e6a[_0xc119('0x57')](_0x349606);}})[_0xc119('0x20')](function(_0x44e7fc){if(_0x44e7fc){_0x515a53=_0x44e7fc[_0xc119('0x30')];if(!_0x5a5415[_0xc119('0x2a')][_0xc119('0x31')]('nolimit')){_0x349606[_0xc119('0x19')]=qs[_0xc119('0x19')](_0x5a5415[_0xc119('0x2a')][_0xc119('0x19')]);_0x349606['offset']=qs['offset'](_0x5a5415[_0xc119('0x2a')][_0xc119('0x18')]);}return _0x576e6a[_0xc119('0x57')](_0x349606);}})[_0xc119('0x20')](function(_0x5bb49a){if(_0x5bb49a){return _0x5bb49a?{'count':_0x515a53,'rows':_0x5bb49a}:null;}})[_0xc119('0x20')](respondWithResult(_0x2a8614,null))[_0xc119('0x40')](handleError(_0x2a8614,null));};exports[_0xc119('0x59')]=function(_0x2589cc,_0x5061f5,_0x148977){var _0x5898c9=[];var _0x590873;return db[_0xc119('0x58')][_0xc119('0x3e')]({'where':{'id':_0x2589cc['body'][_0xc119('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc119('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x237034){if(_0x237034){for(var _0x469c2f=0x0;_0x469c2f<_0x237034[_0xc119('0x30')];_0x469c2f+=0x1){for(var _0x320286=0x0;_0x320286<_0x237034[_0x469c2f][_0xc119('0x5b')][_0xc119('0x30')];_0x320286+=0x1){_0x5898c9=_['union'](_0x5898c9,[_0x237034[_0x469c2f]['Agents'][_0x320286]['id']]);}}return _0x5898c9;}})[_0xc119('0x20')](function(_0x13bb31){if(_0x13bb31){return db[_0xc119('0x26')][_0xc119('0x44')]({'where':{'id':_0x2589cc[_0xc119('0x42')]['id']}});}})['then'](function(_0x3464f3){if(_0x3464f3){_0x590873=_0x3464f3;return _0x590873[_0xc119('0x5c')](_0x5898c9,{'penalty':_0x2589cc['body'][_0xc119('0x5d')]});}})['then'](function(_0x20e832){if(_0x20e832){return _0x590873[_0xc119('0x59')](_0x2589cc[_0xc119('0x46')][_0xc119('0x5a')]);}})['then'](handleEntityNotFound(_0x5061f5,null))[_0xc119('0x20')](respondWithStatusCode(_0x5061f5,null))[_0xc119('0x40')](handleError(_0x5061f5,null));};exports[_0xc119('0x5e')]=function(_0x27cb7b,_0x288c41,_0x1221a2){var _0x1f9cae=[];var _0x25b978;return db[_0xc119('0x58')][_0xc119('0x3e')]({'where':{'id':_0x27cb7b[_0xc119('0x2a')][_0xc119('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xc119('0x4d')],'as':_0xc119('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xc119('0x20')](function(_0x2b3048){if(_0x2b3048){for(var _0x375140=0x0;_0x375140<_0x2b3048[_0xc119('0x30')];_0x375140+=0x1){for(var _0x92bd20=0x0;_0x92bd20<_0x2b3048[_0x375140][_0xc119('0x5b')][_0xc119('0x30')];_0x92bd20+=0x1){_0x1f9cae=_['union'](_0x1f9cae,[_0x2b3048[_0x375140][_0xc119('0x5b')][_0x92bd20]['id']]);}}return _0x1f9cae;}})[_0xc119('0x20')](function(_0x150da9){if(_0x150da9){return db[_0xc119('0x26')]['find']({'where':{'id':_0x27cb7b[_0xc119('0x42')]['id']}});}})['then'](function(_0x21989b){if(_0x21989b){_0x25b978=_0x21989b;return _0x25b978[_0xc119('0x5f')](_0x1f9cae);}})[_0xc119('0x20')](function(_0x3a540f){if(_0x25b978){return _0x25b978[_0xc119('0x5e')](_0x27cb7b[_0xc119('0x2a')][_0xc119('0x5a')]);}})[_0xc119('0x20')](handleEntityNotFound(_0x288c41,null))['then'](respondWithStatusCode(_0x288c41,null))['catch'](handleError(_0x288c41,null));};exports[_0xc119('0x5c')]=function(_0x586c4d,_0xf62f34,_0x20db80){return db['OpenchannelQueue'][_0xc119('0x44')]({'where':{'id':_0x586c4d[_0xc119('0x42')]['id']}})[_0xc119('0x20')](handleEntityNotFound(_0xf62f34,null))[_0xc119('0x20')](function(_0x440c0a){if(_0x440c0a){return _0x440c0a['addAgents'](_0x586c4d[_0xc119('0x46')][_0xc119('0x5a')],_['omit'](_0x586c4d[_0xc119('0x46')],[_0xc119('0x5a'),'id'])||{})[_0xc119('0x60')](function(_0x219130){for(var _0x54d75c=0x0;_0x54d75c<_0x586c4d[_0xc119('0x46')][_0xc119('0x5a')]['length'];_0x54d75c+=0x1){socket[_0xc119('0x61')](_0xc119('0x62'),{'UserId':_0x586c4d[_0xc119('0x46')][_0xc119('0x5a')][_0x54d75c],'OpenchannelQueueId':_0x586c4d[_0xc119('0x42')]['id']});}return _0x219130;});}})['then'](respondWithResult(_0xf62f34,null))[_0xc119('0x40')](handleError(_0xf62f34,null));};exports['removeAgents']=function(_0x3678c9,_0x3f6261,_0x537265){var _0x4c185b;return db[_0xc119('0x26')][_0xc119('0x44')]({'where':{'id':_0x3678c9[_0xc119('0x42')]['id']}})[_0xc119('0x20')](handleEntityNotFound(_0x3f6261,null))[_0xc119('0x20')](function(_0x45a915){if(_0x45a915){return _0x45a915[_0xc119('0x5f')](_0x3678c9[_0xc119('0x2a')][_0xc119('0x5a')])['then'](function(_0x435947){if(_[_0xc119('0x63')](_0x3678c9[_0xc119('0x2a')][_0xc119('0x5a')])){for(var _0x52e99e=0x0;_0x52e99e<_0x3678c9[_0xc119('0x2a')]['ids'][_0xc119('0x30')];_0x52e99e+=0x1){socket[_0xc119('0x61')](_0xc119('0x64'),{'UserId':_0x3678c9['query'][_0xc119('0x5a')][_0x52e99e],'OpenchannelQueueId':_0x3678c9[_0xc119('0x42')]['id']});}}else{socket[_0xc119('0x61')](_0xc119('0x64'),{'UserId':_0x3678c9[_0xc119('0x2a')][_0xc119('0x5a')],'OpenchannelQueueId':_0x3678c9[_0xc119('0x42')]['id']});}});}})['then'](respondWithStatusCode(_0x3f6261,null))[_0xc119('0x40')](handleError(_0x3f6261,null));};exports[_0xc119('0x65')]=function(_0xf611b,_0x1bf62c,_0x2be8ab){var _0xe1672b={};var _0x6851a8={};var _0x58f7ce;var _0x4dcf20;return db[_0xc119('0x26')][_0xc119('0x49')]({'where':{'id':_0xf611b[_0xc119('0x42')]['id']}})['then'](handleEntityNotFound(_0x1bf62c,null))['then'](function(_0x57afdc){if(_0x57afdc){_0x58f7ce=_0x57afdc;_0x6851a8[_0xc119('0x28')]=_[_0xc119('0x29')](db[_0xc119('0x4d')][_0xc119('0x27')]);_0x6851a8['query']=_[_0xc119('0x29')](_0xf611b[_0xc119('0x2a')]);_0x6851a8[_0xc119('0x2c')]=_[_0xc119('0x2d')](_0x6851a8[_0xc119('0x28')],_0x6851a8[_0xc119('0x2a')]);_0xe1672b[_0xc119('0x2f')]=_[_0xc119('0x2d')](_0x6851a8[_0xc119('0x28')],qs[_0xc119('0x2e')](_0xf611b['query'][_0xc119('0x2e')]));_0xe1672b[_0xc119('0x2f')]=_0xe1672b[_0xc119('0x2f')][_0xc119('0x30')]?_0xe1672b['attributes']:_0x6851a8[_0xc119('0x28')];_0xe1672b[_0xc119('0x33')]=qs[_0xc119('0x34')](_0xf611b[_0xc119('0x2a')][_0xc119('0x34')]);_0xe1672b[_0xc119('0x3b')]=qs['filters'](_['pick'](_0xf611b[_0xc119('0x2a')],_0x6851a8[_0xc119('0x2c')]));if(_0xf611b[_0xc119('0x2a')][_0xc119('0x3a')]){_0xe1672b['where']=_['merge'](_0xe1672b[_0xc119('0x3b')],{'$or':_['map'](_0xe1672b[_0xc119('0x2f')],function(_0x2defe7){var _0x26ef39={};_0x26ef39[_0x2defe7]={'$like':'%'+_0xf611b[_0xc119('0x2a')][_0xc119('0x3a')]+'%'};return _0x26ef39;})});}_0xe1672b=_['merge']({},_0xe1672b,_0xf611b[_0xc119('0x3c')]);return _0x58f7ce[_0xc119('0x65')](_0xe1672b);}})['then'](function(_0x5acb94){if(_0x5acb94){_0x4dcf20=_0x5acb94[_0xc119('0x30')];if(!_0xf611b[_0xc119('0x2a')][_0xc119('0x31')](_0xc119('0x32'))){_0xe1672b['limit']=qs[_0xc119('0x19')](_0xf611b[_0xc119('0x2a')][_0xc119('0x19')]);_0xe1672b[_0xc119('0x18')]=qs[_0xc119('0x18')](_0xf611b[_0xc119('0x2a')][_0xc119('0x18')]);}return _0x58f7ce[_0xc119('0x65')](_0xe1672b);}})[_0xc119('0x20')](function(_0x3c2972){if(_0x3c2972){return _0x3c2972?{'count':_0x4dcf20,'rows':_0x3c2972}:null;}})[_0xc119('0x20')](respondWithResult(_0x1bf62c,null))[_0xc119('0x40')](handleError(_0x1bf62c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 24adf3b..ac96572 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 _0xfd70=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0xfd70,0x1a0));var _0x0fd7=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xfd70[_0x9fd887];return _0x1a54ab;};'use strict';var EventEmitter=require(_0x0fd7('0x0'));var OpenchannelQueue=require(_0x0fd7('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0fd7('0x2')](0x0);var events={'afterCreate':_0x0fd7('0x3'),'afterUpdate':_0x0fd7('0x4'),'afterDestroy':_0x0fd7('0x5')};function emitEvent(_0x33960d){return function(_0x3b9244,_0x13652b,_0x2ec163){OpenchannelQueueEvents[_0x0fd7('0x6')](_0x33960d+':'+_0x3b9244['id'],_0x3b9244);OpenchannelQueueEvents[_0x0fd7('0x6')](_0x33960d,_0x3b9244);_0x2ec163(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x0fd7('0x7')](e,emitEvent(event));}}module[_0x0fd7('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9f3f=['update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x2794f1,_0x59b2b3){var _0x68e816=function(_0xdb7086){while(--_0xdb7086){_0x2794f1['push'](_0x2794f1['shift']());}};_0x68e816(++_0x59b2b3);}(_0x9f3f,0x163));var _0xf9f3=function(_0x3625d6,_0x57f4c4){_0x3625d6=_0x3625d6-0x0;var _0x8df4d8=_0x9f3f[_0x3625d6];return _0x8df4d8;};'use strict';var EventEmitter=require(_0xf9f3('0x0'));var OpenchannelQueue=require(_0xf9f3('0x1'))['db'][_0xf9f3('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf9f3('0x3')](0x0);var events={'afterCreate':_0xf9f3('0x4'),'afterUpdate':_0xf9f3('0x5'),'afterDestroy':_0xf9f3('0x6')};function emitEvent(_0x1dfae7){return function(_0x23ed27,_0x5f01ea,_0x18820b){OpenchannelQueueEvents[_0xf9f3('0x7')](_0x1dfae7+':'+_0x23ed27['id'],_0x23ed27);OpenchannelQueueEvents[_0xf9f3('0x7')](_0x1dfae7,_0x23ed27);_0x18820b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xf9f3('0x8')](e,emitEvent(event));}}module[_0xf9f3('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index de7a5bd..77cbf1f 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 _0x4fdb=['moment','bluebird','request-promise','./openchannelQueue.attributes','exports','OpenchannelQueue','lodash','util','../../config/logger','api'];(function(_0x34f3d4,_0x5ae214){var _0x17f899=function(_0x14a5a2){while(--_0x14a5a2){_0x34f3d4['push'](_0x34f3d4['shift']());}};_0x17f899(++_0x5ae214);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x93e811,_0x385377){_0x93e811=_0x93e811-0x0;var _0x2a0461=_0x4fdb[_0x93e811];return _0x2a0461;};'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':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ded=['exports','define','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ded,0x116));var _0xd4de=function(_0x28e61c,_0x1d5fa8){_0x28e61c=_0x28e61c-0x0;var _0x503f60=_0x4ded[_0x28e61c];return _0x503f60;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var logger=require(_0xd4de('0x2'))(_0xd4de('0x3'));var moment=require(_0xd4de('0x4'));var BPromise=require(_0xd4de('0x5'));var rp=require(_0xd4de('0x6'));var attributes=require(_0xd4de('0x7'));module[_0xd4de('0x8')]=function(_0x36d4dd,_0x2e8d86){return _0x36d4dd[_0xd4de('0x9')]('OpenchannelQueue',attributes,{'tableName':_0xd4de('0xa'),'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 471c9f4..5fb156d 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 _0x299d=['code','result','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','then','info','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./openchannelQueue.socket','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x299d,0xa9));var _0xd299=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x299d[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xd299('0x0'));var util=require(_0xd299('0x1'));var moment=require(_0xd299('0x2'));var BPromise=require(_0xd299('0x3'));var rs=require(_0xd299('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xd299('0x5'));var logger=require(_0xd299('0x6'))(_0xd299('0x7'));var config=require(_0xd299('0x8'));var jayson=require(_0xd299('0x9'));var client=jayson[_0xd299('0xa')][_0xd299('0xb')]({'port':0x232a});var socket=require(_0xd299('0xc'))({'host':_0xd299('0xd'),'port':0x18eb});require(_0xd299('0xe'))['register'](socket);function respondWithRpcPromise(_0x22ccfa,_0x23574f,_0xf73fe1){return new BPromise(function(_0x9d6879,_0x1ff872){return client['request'](_0x22ccfa,_0xf73fe1)['then'](function(_0x439f07){logger['info'](_0xd299('0xf'),_0x23574f,'request\x20sent');logger[_0xd299('0x10')](_0xd299('0x11'),_0x23574f,_0xd299('0x12'),JSON[_0xd299('0x13')](_0x439f07));if(_0x439f07[_0xd299('0x14')]){if(_0x439f07[_0xd299('0x14')][_0xd299('0x15')]===0x1f4){logger[_0xd299('0x14')](_0xd299('0xf'),_0x23574f,_0x439f07[_0xd299('0x14')]['message']);return _0x1ff872(_0x439f07['error']['message']);}logger[_0xd299('0x14')](_0xd299('0xf'),_0x23574f,_0x439f07['error']['message']);return _0x9d6879(_0x439f07['error']['message']);}else{logger['info'](_0xd299('0xf'),_0x23574f,_0xd299('0x12'));_0x9d6879(_0x439f07[_0xd299('0x16')][_0xd299('0x17')]);}})[_0xd299('0x18')](function(_0x24d903){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x23574f,_0x24d903);_0x1ff872(_0x24d903);});});}exports[_0xd299('0x19')]=function(_0x68760d){var _0x176c0d=this;return new Promise(function(_0x23e8d0,_0x3fc48c){return db[_0xd299('0x1a')][_0xd299('0x1b')]({'raw':_0x68760d[_0xd299('0x1c')]?_0x68760d[_0xd299('0x1c')][_0xd299('0x1d')]===undefined?!![]:![]:!![],'where':_0x68760d[_0xd299('0x1c')]?_0x68760d[_0xd299('0x1c')][_0xd299('0x1e')]||null:null,'attributes':_0x68760d['options']?_0x68760d[_0xd299('0x1c')][_0xd299('0x1f')]||null:null,'limit':_0x68760d[_0xd299('0x1c')]?_0x68760d[_0xd299('0x1c')]['limit']||null:null,'include':_0x68760d['options']?_0x68760d[_0xd299('0x1c')][_0xd299('0x20')]?_[_0xd299('0x21')](_0x68760d[_0xd299('0x1c')][_0xd299('0x20')],function(_0x560d67){return{'model':db[_0x560d67[_0xd299('0x22')]],'as':_0x560d67['as'],'attributes':_0x560d67[_0xd299('0x1f')],'include':_0x560d67['include']?_[_0xd299('0x21')](_0x560d67['include'],function(_0x2d13a4){return{'model':db[_0x2d13a4['model']],'as':_0x2d13a4['as'],'attributes':_0x2d13a4[_0xd299('0x1f')],'include':_0x2d13a4['include']?_[_0xd299('0x21')](_0x2d13a4[_0xd299('0x20')],function(_0x2ecbc4){return{'model':db[_0x2ecbc4[_0xd299('0x22')]],'as':_0x2ecbc4['as'],'attributes':_0x2ecbc4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd299('0x23')](function(_0x590813){logger[_0xd299('0x24')]('GetOpenchannelQueue',_0x68760d);logger['debug'](_0xd299('0x19'),_0x68760d,JSON['stringify'](_0x590813));_0x23e8d0(_0x590813);})['catch'](function(_0x377bec){logger[_0xd299('0x14')]('GetOpenchannelQueue',_0x377bec['message'],_0x68760d);_0x3fc48c(_0x176c0d['error'](0x1f4,_0x377bec['message']));});});};exports[_0xd299('0x25')]=function(_0x1cb8dc){var _0x4c8f5f=this;return new Promise(function(_0x53e957,_0x25efe4){return db[_0xd299('0x1a')]['find']({'raw':_0x1cb8dc[_0xd299('0x1c')]?_0x1cb8dc['options'][_0xd299('0x1d')]===undefined?!![]:![]:!![],'where':_0x1cb8dc['options']?_0x1cb8dc[_0xd299('0x1c')]['where']||null:null,'attributes':_0x1cb8dc[_0xd299('0x1c')]?_0x1cb8dc[_0xd299('0x1c')][_0xd299('0x1f')]||null:null,'include':_0x1cb8dc['options']?_0x1cb8dc[_0xd299('0x1c')][_0xd299('0x20')]?_['map'](_0x1cb8dc['options'][_0xd299('0x20')],function(_0xcdfc19){return{'model':db[_0xcdfc19[_0xd299('0x22')]],'as':_0xcdfc19['as'],'attributes':_0xcdfc19[_0xd299('0x1f')],'include':_0xcdfc19[_0xd299('0x20')]?_[_0xd299('0x21')](_0xcdfc19[_0xd299('0x20')],function(_0x307847){return{'model':db[_0x307847[_0xd299('0x22')]],'as':_0x307847['as'],'attributes':_0x307847['attributes'],'include':_0x307847['include']?_['map'](_0x307847[_0xd299('0x20')],function(_0x41c230){return{'model':db[_0x41c230['model']],'as':_0x41c230['as'],'attributes':_0x41c230['attributes']};}):[]};}):[]};}):[]:[]})[_0xd299('0x23')](function(_0x51ea6d){logger[_0xd299('0x24')](_0xd299('0x25'),_0x1cb8dc);logger[_0xd299('0x10')](_0xd299('0x25'),_0x1cb8dc,JSON[_0xd299('0x13')](_0x51ea6d));_0x53e957(_0x51ea6d);})['catch'](function(_0xf69bbd){logger[_0xd299('0x14')]('ShowOpenchannelQueue',_0xf69bbd[_0xd299('0x17')],_0x1cb8dc);_0x25efe4(_0x4c8f5f[_0xd299('0x14')](0x1f4,_0xf69bbd[_0xd299('0x17')]));});});}; \ No newline at end of file +var _0xc548=['ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','socket.io-emitter','localhost','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','raw','where','attributes','map','include','model','GetOpenchannelQueue','debug'];(function(_0x266893,_0x5e5d6b){var _0x290e95=function(_0xd50137){while(--_0xd50137){_0x266893['push'](_0x266893['shift']());}};_0x290e95(++_0x5e5d6b);}(_0xc548,0x10d));var _0x8c54=function(_0x1a59b6,_0x5de843){_0x1a59b6=_0x1a59b6-0x0;var _0x189e2e=_0xc548[_0x1a59b6];return _0x189e2e;};'use strict';var _=require(_0x8c54('0x0'));var util=require(_0x8c54('0x1'));var moment=require(_0x8c54('0x2'));var BPromise=require(_0x8c54('0x3'));var rs=require(_0x8c54('0x4'));var fs=require('fs');var db=require(_0x8c54('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c54('0x6'))(_0x8c54('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8c54('0x8')][_0x8c54('0x9')]({'port':0x232a});var socket=require(_0x8c54('0xa'))({'host':_0x8c54('0xb'),'port':0x18eb});require('./openchannelQueue.socket')[_0x8c54('0xc')](socket);function respondWithRpcPromise(_0x1e7257,_0x30dd0b,_0x3921cb){return new BPromise(function(_0x1ce99d,_0x3554d6){return client[_0x8c54('0xd')](_0x1e7257,_0x3921cb)[_0x8c54('0xe')](function(_0x502bad){logger['info'](_0x8c54('0xf'),_0x30dd0b,_0x8c54('0x10'));logger['debug'](_0x8c54('0x11'),_0x30dd0b,_0x8c54('0x10'),JSON[_0x8c54('0x12')](_0x502bad));if(_0x502bad[_0x8c54('0x13')]){if(_0x502bad[_0x8c54('0x13')][_0x8c54('0x14')]===0x1f4){logger[_0x8c54('0x13')](_0x8c54('0xf'),_0x30dd0b,_0x502bad[_0x8c54('0x13')][_0x8c54('0x15')]);return _0x3554d6(_0x502bad['error'][_0x8c54('0x15')]);}logger[_0x8c54('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x30dd0b,_0x502bad[_0x8c54('0x13')][_0x8c54('0x15')]);return _0x1ce99d(_0x502bad[_0x8c54('0x13')][_0x8c54('0x15')]);}else{logger[_0x8c54('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x30dd0b,_0x8c54('0x10'));_0x1ce99d(_0x502bad[_0x8c54('0x17')][_0x8c54('0x15')]);}})[_0x8c54('0x18')](function(_0x526081){logger[_0x8c54('0x13')](_0x8c54('0xf'),_0x30dd0b,_0x526081);_0x3554d6(_0x526081);});});}exports['GetOpenchannelQueue']=function(_0x547ee4){var _0x561027=this;return new Promise(function(_0x35561e,_0xe458a7){return db['OpenchannelQueue'][_0x8c54('0x19')]({'raw':_0x547ee4[_0x8c54('0x1a')]?_0x547ee4[_0x8c54('0x1a')][_0x8c54('0x1b')]===undefined?!![]:![]:!![],'where':_0x547ee4[_0x8c54('0x1a')]?_0x547ee4[_0x8c54('0x1a')][_0x8c54('0x1c')]||null:null,'attributes':_0x547ee4['options']?_0x547ee4[_0x8c54('0x1a')][_0x8c54('0x1d')]||null:null,'limit':_0x547ee4[_0x8c54('0x1a')]?_0x547ee4[_0x8c54('0x1a')]['limit']||null:null,'include':_0x547ee4['options']?_0x547ee4[_0x8c54('0x1a')]['include']?_[_0x8c54('0x1e')](_0x547ee4['options'][_0x8c54('0x1f')],function(_0x32d001){return{'model':db[_0x32d001[_0x8c54('0x20')]],'as':_0x32d001['as'],'attributes':_0x32d001[_0x8c54('0x1d')],'include':_0x32d001[_0x8c54('0x1f')]?_['map'](_0x32d001[_0x8c54('0x1f')],function(_0x4df076){return{'model':db[_0x4df076[_0x8c54('0x20')]],'as':_0x4df076['as'],'attributes':_0x4df076[_0x8c54('0x1d')],'include':_0x4df076[_0x8c54('0x1f')]?_[_0x8c54('0x1e')](_0x4df076[_0x8c54('0x1f')],function(_0x348923){return{'model':db[_0x348923[_0x8c54('0x20')]],'as':_0x348923['as'],'attributes':_0x348923[_0x8c54('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8c54('0xe')](function(_0x2c65e8){logger[_0x8c54('0x16')](_0x8c54('0x21'),_0x547ee4);logger[_0x8c54('0x22')]('GetOpenchannelQueue',_0x547ee4,JSON[_0x8c54('0x12')](_0x2c65e8));_0x35561e(_0x2c65e8);})[_0x8c54('0x18')](function(_0x3c07d9){logger[_0x8c54('0x13')]('GetOpenchannelQueue',_0x3c07d9[_0x8c54('0x15')],_0x547ee4);_0xe458a7(_0x561027[_0x8c54('0x13')](0x1f4,_0x3c07d9['message']));});});};exports[_0x8c54('0x23')]=function(_0x47a764){var _0x2b2ba9=this;return new Promise(function(_0x5e0ba6,_0x1c7874){return db[_0x8c54('0x24')][_0x8c54('0x25')]({'raw':_0x47a764[_0x8c54('0x1a')]?_0x47a764[_0x8c54('0x1a')][_0x8c54('0x1b')]===undefined?!![]:![]:!![],'where':_0x47a764[_0x8c54('0x1a')]?_0x47a764[_0x8c54('0x1a')][_0x8c54('0x1c')]||null:null,'attributes':_0x47a764[_0x8c54('0x1a')]?_0x47a764[_0x8c54('0x1a')][_0x8c54('0x1d')]||null:null,'include':_0x47a764[_0x8c54('0x1a')]?_0x47a764[_0x8c54('0x1a')][_0x8c54('0x1f')]?_[_0x8c54('0x1e')](_0x47a764[_0x8c54('0x1a')][_0x8c54('0x1f')],function(_0x5b4b94){return{'model':db[_0x5b4b94[_0x8c54('0x20')]],'as':_0x5b4b94['as'],'attributes':_0x5b4b94[_0x8c54('0x1d')],'include':_0x5b4b94['include']?_[_0x8c54('0x1e')](_0x5b4b94[_0x8c54('0x1f')],function(_0x25be6b){return{'model':db[_0x25be6b[_0x8c54('0x20')]],'as':_0x25be6b['as'],'attributes':_0x25be6b[_0x8c54('0x1d')],'include':_0x25be6b[_0x8c54('0x1f')]?_[_0x8c54('0x1e')](_0x25be6b[_0x8c54('0x1f')],function(_0x49fa65){return{'model':db[_0x49fa65[_0x8c54('0x20')]],'as':_0x49fa65['as'],'attributes':_0x49fa65[_0x8c54('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8c54('0xe')](function(_0x1a7575){logger[_0x8c54('0x16')](_0x8c54('0x23'),_0x47a764);logger[_0x8c54('0x22')]('ShowOpenchannelQueue',_0x47a764,JSON['stringify'](_0x1a7575));_0x5e0ba6(_0x1a7575);})['catch'](function(_0x5b1ac7){logger['error']('ShowOpenchannelQueue',_0x5b1ac7[_0x8c54('0x15')],_0x47a764);_0x1c7874(_0x2b2ba9[_0x8c54('0x13')](0x1f4,_0x5b1ac7[_0x8c54('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6c1dc0b..8a5df9d 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 4583d10..7b7f2f5 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 _0xf255=['get','isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf255,0x1d8));var _0x5f25=function(_0xf2291a,_0x49ea64){_0xf2291a=_0xf2291a-0x0;var _0x50b46e=_0xf255[_0xf2291a];return _0x50b46e;};'use strict';var multer=require(_0x5f25('0x0'));var util=require(_0x5f25('0x1'));var path=require(_0x5f25('0x2'));var express=require(_0x5f25('0x3'));var router=express[_0x5f25('0x4')]();var auth=require(_0x5f25('0x5'));var interaction=require(_0x5f25('0x6'));var config=require('../../config/environment');var controller=require(_0x5f25('0x7'));router[_0x5f25('0x8')]('/',auth[_0x5f25('0x9')](),controller[_0x5f25('0xa')]);router[_0x5f25('0x8')](_0x5f25('0xb'),auth[_0x5f25('0x9')](),controller[_0x5f25('0xc')]);router[_0x5f25('0x8')]('/:id',auth[_0x5f25('0x9')](),controller[_0x5f25('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5f25('0xe')]);router[_0x5f25('0xf')](_0x5f25('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5f25('0x11')](_0x5f25('0x10'),auth[_0x5f25('0x9')](),controller[_0x5f25('0x12')]);module[_0x5f25('0x13')]=router; \ No newline at end of file +var _0xd575=['/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x20e51b,_0x3e9eb6){var _0x4e12a8=function(_0x271b0d){while(--_0x271b0d){_0x20e51b['push'](_0x20e51b['shift']());}};_0x4e12a8(++_0x3e9eb6);}(_0xd575,0xa7));var _0x5d57=function(_0x526074,_0x5e5d09){_0x526074=_0x526074-0x0;var _0x83c6c8=_0xd575[_0x526074];return _0x83c6c8;};'use strict';var multer=require(_0x5d57('0x0'));var util=require(_0x5d57('0x1'));var path=require(_0x5d57('0x2'));var express=require(_0x5d57('0x3'));var router=express[_0x5d57('0x4')]();var auth=require(_0x5d57('0x5'));var interaction=require(_0x5d57('0x6'));var config=require(_0x5d57('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x5d57('0x8')]('/',auth[_0x5d57('0x9')](),controller[_0x5d57('0xa')]);router[_0x5d57('0x8')](_0x5d57('0xb'),auth[_0x5d57('0x9')](),controller[_0x5d57('0xc')]);router['get'](_0x5d57('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5d57('0xe')]('/',auth[_0x5d57('0x9')](),controller['create']);router[_0x5d57('0xf')](_0x5d57('0xd'),auth[_0x5d57('0x9')](),controller[_0x5d57('0x10')]);router[_0x5d57('0x11')](_0x5d57('0xd'),auth[_0x5d57('0x9')](),controller[_0x5d57('0x12')]);module[_0x5d57('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0e1c4b6..2465a53 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 _0xf63e=['STRING','DATE','moment','sequelize','exports'];(function(_0x1e7594,_0x28ac09){var _0x2d7c01=function(_0x1830a3){while(--_0x1830a3){_0x1e7594['push'](_0x1e7594['shift']());}};_0x2d7c01(++_0x28ac09);}(_0xf63e,0xd4));var _0xef63=function(_0x4c27bd,_0xad16ef){_0x4c27bd=_0x4c27bd-0x0;var _0x4b830a=_0xf63e[_0x4c27bd];return _0x4b830a;};'use strict';var moment=require(_0xef63('0x0'));var Sequelize=require(_0xef63('0x1'));module[_0xef63('0x2')]={'uniqueid':{'type':Sequelize[_0xef63('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xef63('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xef63('0x4')]},'exitAt':{'type':Sequelize[_0xef63('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfe44=['STRING','moment','sequelize','DATE'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfe44,0xf1));var _0x4fe4=function(_0x50835d,_0x58667c){_0x50835d=_0x50835d-0x0;var _0x5c8273=_0xfe44[_0x50835d];return _0x5c8273;};'use strict';var moment=require(_0x4fe4('0x0'));var Sequelize=require(_0x4fe4('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4fe4('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4fe4('0x2')]},'exitAt':{'type':Sequelize[_0x4fe4('0x2')]},'reason':{'type':Sequelize[_0x4fe4('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 0b49bf7..a6a49b6 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 _0xef0f=['length','attributes','limit','offset','order','sort','where','pick','add','day','merge','filter','options','then','includeAll','include','findAll','rows','params','fields','find','create','body','catch','describe','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','OpenchannelQueueReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection'];(function(_0x538a98,_0x10d9b5){var _0x5f31db=function(_0x165998){while(--_0x165998){_0x538a98['push'](_0x538a98['shift']());}};_0x5f31db(++_0x10d9b5);}(_0xef0f,0x168));var _0xfef0=function(_0x107bfa,_0x5aae40){_0x107bfa=_0x107bfa-0x0;var _0xcd2c33=_0xef0f[_0x107bfa];return _0xcd2c33;};'use strict';var jsonpatch=require(_0xfef0('0x0'));var rp=require('request-promise');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var Mustache=require(_0xfef0('0x3'));var util=require('util');var path=require(_0xfef0('0x4'));var sox=require(_0xfef0('0x5'));var csv=require(_0xfef0('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfef0('0x7'));var squel=require(_0xfef0('0x8'));var crypto=require(_0xfef0('0x9'));var jsforce=require(_0xfef0('0xa'));var deskjs=require(_0xfef0('0xb'));var toCsv=require(_0xfef0('0x6'));var querystring=require('querystring');var Papa=require(_0xfef0('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xfef0('0xd'))(_0xfef0('0xe'));var utils=require(_0xfef0('0xf'));var config=require(_0xfef0('0x10'));var db=require(_0xfef0('0x11'))['db'];function respondWithStatusCode(_0x402dff,_0xc177db){_0xc177db=_0xc177db||0xcc;return function(_0x4bd6f2){if(_0x4bd6f2){return _0x402dff[_0xfef0('0x12')](_0xc177db);}return _0x402dff[_0xfef0('0x13')](_0xc177db)[_0xfef0('0x14')]();};}function respondWithResult(_0x356298,_0x87f32a){_0x87f32a=_0x87f32a||0xc8;return function(_0x1bdb7b){if(_0x1bdb7b){return _0x356298['status'](_0x87f32a)[_0xfef0('0x15')](_0x1bdb7b);}};}function respondWithFilteredResult(_0x2f4e23,_0x24bbab){return function(_0x30d61d){if(_0x30d61d){var _0xe9f78d=_0x30d61d[_0xfef0('0x16')],_0x45599a=_0x24bbab['offset'],_0xa9f040=_0x24bbab['offset']+_0x24bbab['limit'],_0x573ae7;if(_0xa9f040>=_0xe9f78d){_0xa9f040=_0xe9f78d;_0x573ae7=0xc8;}else{_0x573ae7=0xce;}_0x2f4e23[_0xfef0('0x13')](_0x573ae7);return _0x2f4e23[_0xfef0('0x17')](_0xfef0('0x18'),_0x45599a+'-'+_0xa9f040+'/'+_0xe9f78d)[_0xfef0('0x15')](_0x30d61d);}return null;};}function patchUpdates(_0x2a96d9){return function(_0x3f9a6c){try{jsonpatch[_0xfef0('0x19')](_0x3f9a6c,_0x2a96d9,!![]);}catch(_0x2887e6){return BPromise['reject'](_0x2887e6);}return _0x3f9a6c[_0xfef0('0x1a')]();};}function saveUpdates(_0x1642cd,_0x1577fa){return function(_0x39f9d3){if(_0x39f9d3){return _0x39f9d3[_0xfef0('0x1b')](_0x1642cd)['then'](function(_0x5283e1){return _0x5283e1;});}return null;};}function removeEntity(_0x4e24de,_0x20826b){return function(_0x1a0aa0){if(_0x1a0aa0){return _0x1a0aa0[_0xfef0('0x1c')]()['then'](function(){_0x4e24de[_0xfef0('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4074b7,_0x394fbc){return function(_0x52b93b){if(!_0x52b93b){_0x4074b7['sendStatus'](0x194);}return _0x52b93b;};}function handleError(_0x4b8b22,_0x19fde8){_0x19fde8=_0x19fde8||0x1f4;return function(_0x4faea8){logger[_0xfef0('0x1d')](_0x4faea8[_0xfef0('0x1e')]);if(_0x4faea8[_0xfef0('0x1f')]){delete _0x4faea8[_0xfef0('0x1f')];}_0x4b8b22[_0xfef0('0x13')](_0x19fde8)[_0xfef0('0x20')](_0x4faea8);};}exports['index']=function(_0x4ac8c5,_0x316e20){var _0x1ffaa4={},_0x924f6e={},_0x34ca65={'count':0x0,'rows':[]};var _0xab231c=db[_0xfef0('0x21')][_0xfef0('0x22')];_0x924f6e[_0xfef0('0x23')]=_[_0xfef0('0x24')](_0xab231c);var _0x529d86={'dateStart':_0x4ac8c5[_0xfef0('0x25')][_0xfef0('0x26')],'dateEnd':_0x4ac8c5[_0xfef0('0x25')][_0xfef0('0x27')]};delete _0x4ac8c5[_0xfef0('0x25')][_0xfef0('0x26')];delete _0x4ac8c5[_0xfef0('0x25')][_0xfef0('0x27')];_0x924f6e[_0xfef0('0x25')]=_[_0xfef0('0x24')](_0x4ac8c5[_0xfef0('0x25')]);_0x924f6e[_0xfef0('0x28')]=_['intersection'](_0x924f6e[_0xfef0('0x23')],_0x924f6e['query']);_0x1ffaa4['attributes']=_[_0xfef0('0x29')](_0x924f6e[_0xfef0('0x23')],qs['fields'](_0x4ac8c5['query']['fields']));_0x1ffaa4['attributes']=_0x1ffaa4['attributes'][_0xfef0('0x2a')]?_0x1ffaa4[_0xfef0('0x2b')]:_0x924f6e[_0xfef0('0x23')];if(!_0x4ac8c5['query']['hasOwnProperty']('nolimit')){_0x1ffaa4[_0xfef0('0x2c')]=qs['limit'](_0x4ac8c5[_0xfef0('0x25')][_0xfef0('0x2c')]);_0x1ffaa4[_0xfef0('0x2d')]=qs['offset'](_0x4ac8c5[_0xfef0('0x25')]['offset']);}_0x1ffaa4[_0xfef0('0x2e')]=qs[_0xfef0('0x2f')](_0x4ac8c5[_0xfef0('0x25')][_0xfef0('0x2f')]);_0x1ffaa4[_0xfef0('0x30')]=qs[_0xfef0('0x28')](_[_0xfef0('0x31')](_0x4ac8c5[_0xfef0('0x25')],_0x924f6e['filters']));if(_0x529d86[_0xfef0('0x26')]){if(_0x529d86[_0xfef0('0x27')]){_0x529d86[_0xfef0('0x27')]=moment(_0x529d86[_0xfef0('0x27')])[_0xfef0('0x32')](0x1,_0xfef0('0x33'));}else{_0x529d86[_0xfef0('0x27')]=moment(_0x529d86[_0xfef0('0x26')])[_0xfef0('0x32')](0x1,_0xfef0('0x33'));}_[_0xfef0('0x34')](_0x1ffaa4[_0xfef0('0x30')],{'createdAt':{'$gte':_0x529d86[_0xfef0('0x26')],'$lte':_0x529d86['dateEnd']}});}if(_0x4ac8c5[_0xfef0('0x25')]['filter']){_0x1ffaa4[_0xfef0('0x30')]=_[_0xfef0('0x34')](_0x1ffaa4[_0xfef0('0x30')],{'$or':_['map'](_0x1ffaa4[_0xfef0('0x2b')],function(_0x29469e){var _0x3f2753={};_0x3f2753[_0x29469e]={'$like':'%'+_0x4ac8c5['query'][_0xfef0('0x35')]+'%'};return _0x3f2753;})});}_0x1ffaa4=_[_0xfef0('0x34')]({},_0x1ffaa4,_0x4ac8c5[_0xfef0('0x36')]);var _0x5577f4={'where':_0x1ffaa4[_0xfef0('0x30')]};return db['OpenchannelQueueReport']['count'](_0x5577f4)[_0xfef0('0x37')](function(_0x547a5d){_0x34ca65['count']=_0x547a5d;if(_0x4ac8c5[_0xfef0('0x25')][_0xfef0('0x38')]){_0x1ffaa4[_0xfef0('0x39')]=[{'all':!![]}];}return db[_0xfef0('0x21')][_0xfef0('0x3a')](_0x1ffaa4);})[_0xfef0('0x37')](function(_0x4dd8f8){_0x34ca65[_0xfef0('0x3b')]=_0x4dd8f8;return _0x34ca65;})[_0xfef0('0x37')](respondWithFilteredResult(_0x316e20,_0x1ffaa4))['catch'](handleError(_0x316e20,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':!![],'where':{'id':_0x1d554e[_0xfef0('0x3c')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x23')]=_[_0xfef0('0x24')](db[_0xfef0('0x21')][_0xfef0('0x22')]);_0x22c940[_0xfef0('0x25')]=_['keys'](_0x1d554e[_0xfef0('0x25')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x23')],_0x22c940[_0xfef0('0x25')]);_0x1fc518['attributes']=_[_0xfef0('0x29')](_0x22c940['model'],qs[_0xfef0('0x3d')](_0x1d554e[_0xfef0('0x25')][_0xfef0('0x3d')]));_0x1fc518[_0xfef0('0x2b')]=_0x1fc518['attributes'][_0xfef0('0x2a')]?_0x1fc518[_0xfef0('0x2b')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x38')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x34')]({},_0x1fc518,_0x1d554e[_0xfef0('0x36')]);return db[_0xfef0('0x21')][_0xfef0('0x3e')](_0x1fc518)[_0xfef0('0x37')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x37')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x3f')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x21')][_0xfef0('0x3f')](_0x559a28[_0xfef0('0x40')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x41')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x40')]['id']){delete _0x5dd26b[_0xfef0('0x40')]['id'];}return db[_0xfef0('0x21')][_0xfef0('0x3e')]({'where':{'id':_0x5dd26b[_0xfef0('0x3c')]['id']}})[_0xfef0('0x37')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x37')](saveUpdates(_0x5dd26b[_0xfef0('0x40')],null))[_0xfef0('0x37')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x21')][_0xfef0('0x3e')]({'where':{'id':_0x2bebec[_0xfef0('0x3c')]['id']}})[_0xfef0('0x37')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x37')](removeEntity(_0x18e5ba,null))[_0xfef0('0x41')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x21')][_0xfef0('0x42')]()[_0xfef0('0x37')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file +var _0xe820=['findAll','rows','catch','show','length','find','body','params','describe','fast-json-patch','moment','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','Content-Range','apply','save','update','then','destroy','stack','name','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','filter','merge','map','options','OpenchannelQueueReport','count','includeAll','include'];(function(_0x1b7ba3,_0x13bee7){var _0x1dd4fc=function(_0x4ea262){while(--_0x4ea262){_0x1b7ba3['push'](_0x1b7ba3['shift']());}};_0x1dd4fc(++_0x13bee7);}(_0xe820,0xd2));var _0x0e82=function(_0x2c645c,_0x443e40){_0x2c645c=_0x2c645c-0x0;var _0x5d920c=_0xe820[_0x2c645c];return _0x5d920c;};'use strict';var jsonpatch=require(_0x0e82('0x0'));var rp=require('request-promise');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0e82('0x2'));var path=require(_0x0e82('0x3'));var sox=require(_0x0e82('0x4'));var csv=require('to-csv');var ejs=require(_0x0e82('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0e82('0x6'));var crypto=require(_0x0e82('0x7'));var jsforce=require(_0x0e82('0x8'));var deskjs=require(_0x0e82('0x9'));var toCsv=require(_0x0e82('0xa'));var querystring=require('querystring');var Papa=require(_0x0e82('0xb'));var qs=require(_0x0e82('0xc'));var logger=require(_0x0e82('0xd'))(_0x0e82('0xe'));var utils=require(_0x0e82('0xf'));var config=require('../../config/environment');var db=require(_0x0e82('0x10'))['db'];function respondWithStatusCode(_0x38b362,_0x2dfacf){_0x2dfacf=_0x2dfacf||0xcc;return function(_0x10b2e2){if(_0x10b2e2){return _0x38b362[_0x0e82('0x11')](_0x2dfacf);}return _0x38b362[_0x0e82('0x12')](_0x2dfacf)[_0x0e82('0x13')]();};}function respondWithResult(_0x588640,_0x44c7fd){_0x44c7fd=_0x44c7fd||0xc8;return function(_0xb42f45){if(_0xb42f45){return _0x588640[_0x0e82('0x12')](_0x44c7fd)[_0x0e82('0x14')](_0xb42f45);}};}function respondWithFilteredResult(_0x166dc2,_0x1f44d2){return function(_0x47b0ff){if(_0x47b0ff){var _0x49751=_0x47b0ff['count'],_0x5c161c=_0x1f44d2['offset'],_0x48d99b=_0x1f44d2['offset']+_0x1f44d2[_0x0e82('0x15')],_0x1e4ddb;if(_0x48d99b>=_0x49751){_0x48d99b=_0x49751;_0x1e4ddb=0xc8;}else{_0x1e4ddb=0xce;}_0x166dc2['status'](_0x1e4ddb);return _0x166dc2['set'](_0x0e82('0x16'),_0x5c161c+'-'+_0x48d99b+'/'+_0x49751)['json'](_0x47b0ff);}return null;};}function patchUpdates(_0x319303){return function(_0x39cf23){try{jsonpatch[_0x0e82('0x17')](_0x39cf23,_0x319303,!![]);}catch(_0x315ce4){return BPromise['reject'](_0x315ce4);}return _0x39cf23[_0x0e82('0x18')]();};}function saveUpdates(_0x310aac,_0x3a3ddf){return function(_0xc3d043){if(_0xc3d043){return _0xc3d043[_0x0e82('0x19')](_0x310aac)[_0x0e82('0x1a')](function(_0x278bcd){return _0x278bcd;});}return null;};}function removeEntity(_0x3735c0,_0xc9f7ac){return function(_0x224455){if(_0x224455){return _0x224455[_0x0e82('0x1b')]()['then'](function(){_0x3735c0['status'](0xcc)[_0x0e82('0x13')]();});}};}function handleEntityNotFound(_0x2781de,_0x13e8f8){return function(_0xb0a31){if(!_0xb0a31){_0x2781de[_0x0e82('0x11')](0x194);}return _0xb0a31;};}function handleError(_0x1bdad4,_0x39fcbe){_0x39fcbe=_0x39fcbe||0x1f4;return function(_0x2688f9){logger['error'](_0x2688f9[_0x0e82('0x1c')]);if(_0x2688f9[_0x0e82('0x1d')]){delete _0x2688f9[_0x0e82('0x1d')];}_0x1bdad4[_0x0e82('0x12')](_0x39fcbe)['send'](_0x2688f9);};}exports[_0x0e82('0x1e')]=function(_0x24e990,_0x7a9399){var _0x16e11c={},_0x4900d3={},_0x1ef751={'count':0x0,'rows':[]};var _0x51dbcd=db['OpenchannelQueueReport'][_0x0e82('0x1f')];_0x4900d3[_0x0e82('0x20')]=_['keys'](_0x51dbcd);var _0x19b96d={'dateStart':_0x24e990[_0x0e82('0x21')][_0x0e82('0x22')],'dateEnd':_0x24e990['query'][_0x0e82('0x23')]};delete _0x24e990[_0x0e82('0x21')]['dateStart'];delete _0x24e990[_0x0e82('0x21')]['dateEnd'];_0x4900d3[_0x0e82('0x21')]=_[_0x0e82('0x24')](_0x24e990['query']);_0x4900d3[_0x0e82('0x25')]=_[_0x0e82('0x26')](_0x4900d3[_0x0e82('0x20')],_0x4900d3['query']);_0x16e11c['attributes']=_[_0x0e82('0x26')](_0x4900d3['model'],qs[_0x0e82('0x27')](_0x24e990['query'][_0x0e82('0x27')]));_0x16e11c[_0x0e82('0x28')]=_0x16e11c[_0x0e82('0x28')]['length']?_0x16e11c[_0x0e82('0x28')]:_0x4900d3['model'];if(!_0x24e990[_0x0e82('0x21')][_0x0e82('0x29')](_0x0e82('0x2a'))){_0x16e11c[_0x0e82('0x15')]=qs[_0x0e82('0x15')](_0x24e990[_0x0e82('0x21')]['limit']);_0x16e11c[_0x0e82('0x2b')]=qs[_0x0e82('0x2b')](_0x24e990[_0x0e82('0x21')][_0x0e82('0x2b')]);}_0x16e11c[_0x0e82('0x2c')]=qs[_0x0e82('0x2d')](_0x24e990[_0x0e82('0x21')][_0x0e82('0x2d')]);_0x16e11c[_0x0e82('0x2e')]=qs[_0x0e82('0x25')](_[_0x0e82('0x2f')](_0x24e990[_0x0e82('0x21')],_0x4900d3[_0x0e82('0x25')]));if(_0x19b96d[_0x0e82('0x22')]){if(_0x19b96d[_0x0e82('0x23')]){_0x19b96d['dateEnd']=moment(_0x19b96d[_0x0e82('0x23')])[_0x0e82('0x30')](0x1,_0x0e82('0x31'));}else{_0x19b96d[_0x0e82('0x23')]=moment(_0x19b96d['dateStart'])[_0x0e82('0x30')](0x1,_0x0e82('0x31'));}_['merge'](_0x16e11c[_0x0e82('0x2e')],{'createdAt':{'$gte':_0x19b96d['dateStart'],'$lte':_0x19b96d['dateEnd']}});}if(_0x24e990[_0x0e82('0x21')][_0x0e82('0x32')]){_0x16e11c[_0x0e82('0x2e')]=_[_0x0e82('0x33')](_0x16e11c[_0x0e82('0x2e')],{'$or':_[_0x0e82('0x34')](_0x16e11c[_0x0e82('0x28')],function(_0x50fed8){var _0x538ddb={};_0x538ddb[_0x50fed8]={'$like':'%'+_0x24e990[_0x0e82('0x21')][_0x0e82('0x32')]+'%'};return _0x538ddb;})});}_0x16e11c=_[_0x0e82('0x33')]({},_0x16e11c,_0x24e990[_0x0e82('0x35')]);var _0x265872={'where':_0x16e11c[_0x0e82('0x2e')]};return db[_0x0e82('0x36')][_0x0e82('0x37')](_0x265872)['then'](function(_0x3ba181){_0x1ef751[_0x0e82('0x37')]=_0x3ba181;if(_0x24e990[_0x0e82('0x21')][_0x0e82('0x38')]){_0x16e11c[_0x0e82('0x39')]=[{'all':!![]}];}return db[_0x0e82('0x36')][_0x0e82('0x3a')](_0x16e11c);})['then'](function(_0x311cb8){_0x1ef751[_0x0e82('0x3b')]=_0x311cb8;return _0x1ef751;})[_0x0e82('0x1a')](respondWithFilteredResult(_0x7a9399,_0x16e11c))[_0x0e82('0x3c')](handleError(_0x7a9399,null));};exports[_0x0e82('0x3d')]=function(_0x423b14,_0x453cd3){var _0x50322b={'raw':!![],'where':{'id':_0x423b14['params']['id']}},_0x581764={};_0x581764['model']=_['keys'](db['OpenchannelQueueReport'][_0x0e82('0x1f')]);_0x581764[_0x0e82('0x21')]=_[_0x0e82('0x24')](_0x423b14[_0x0e82('0x21')]);_0x581764[_0x0e82('0x25')]=_[_0x0e82('0x26')](_0x581764[_0x0e82('0x20')],_0x581764[_0x0e82('0x21')]);_0x50322b['attributes']=_['intersection'](_0x581764[_0x0e82('0x20')],qs[_0x0e82('0x27')](_0x423b14[_0x0e82('0x21')][_0x0e82('0x27')]));_0x50322b[_0x0e82('0x28')]=_0x50322b[_0x0e82('0x28')][_0x0e82('0x3e')]?_0x50322b[_0x0e82('0x28')]:_0x581764['model'];if(_0x423b14[_0x0e82('0x21')]['includeAll']){_0x50322b[_0x0e82('0x39')]=[{'all':!![]}];}_0x50322b=_['merge']({},_0x50322b,_0x423b14[_0x0e82('0x35')]);return db['OpenchannelQueueReport'][_0x0e82('0x3f')](_0x50322b)[_0x0e82('0x1a')](handleEntityNotFound(_0x453cd3,null))[_0x0e82('0x1a')](respondWithResult(_0x453cd3,null))['catch'](handleError(_0x453cd3,null));};exports['create']=function(_0x331668,_0x132c45){return db[_0x0e82('0x36')]['create'](_0x331668[_0x0e82('0x40')],{})['then'](respondWithResult(_0x132c45,0xc9))[_0x0e82('0x3c')](handleError(_0x132c45,null));};exports[_0x0e82('0x19')]=function(_0x162890,_0x64406e){if(_0x162890[_0x0e82('0x40')]['id']){delete _0x162890[_0x0e82('0x40')]['id'];}return db[_0x0e82('0x36')][_0x0e82('0x3f')]({'where':{'id':_0x162890[_0x0e82('0x41')]['id']}})[_0x0e82('0x1a')](handleEntityNotFound(_0x64406e,null))[_0x0e82('0x1a')](saveUpdates(_0x162890[_0x0e82('0x40')],null))['then'](respondWithResult(_0x64406e,null))[_0x0e82('0x3c')](handleError(_0x64406e,null));};exports[_0x0e82('0x1b')]=function(_0x576726,_0x360858){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x576726[_0x0e82('0x41')]['id']}})['then'](handleEntityNotFound(_0x360858,null))[_0x0e82('0x1a')](removeEntity(_0x360858,null))[_0x0e82('0x3c')](handleError(_0x360858,null));};exports[_0x0e82('0x42')]=function(_0x149100,_0xdbb813){return db['OpenchannelQueueReport'][_0x0e82('0x42')]()['then'](respondWithResult(_0xdbb813,null))[_0x0e82('0x3c')](handleError(_0xdbb813,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 987ae8f..5782301 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 _0x3613=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x308f41,_0x5ddd2a){var _0x576d54=function(_0x439c98){while(--_0x439c98){_0x308f41['push'](_0x308f41['shift']());}};_0x576d54(++_0x5ddd2a);}(_0x3613,0x198));var _0x3361=function(_0xc9a63e,_0x40aaa8){_0xc9a63e=_0xc9a63e-0x0;var _0x717c71=_0x3613[_0xc9a63e];return _0x717c71;};'use strict';var _=require(_0x3361('0x0'));var util=require(_0x3361('0x1'));var logger=require(_0x3361('0x2'))(_0x3361('0x3'));var moment=require(_0x3361('0x4'));var BPromise=require(_0x3361('0x5'));var rp=require(_0x3361('0x6'));var attributes=require('./openchannelQueueReport.attributes');module[_0x3361('0x7')]=function(_0x585bf7,_0x21cd23){return _0x585bf7[_0x3361('0x8')](_0x3361('0x9'),attributes,{'tableName':_0x3361('0xa'),'paranoid':![],'indexes':[{'name':_0x3361('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x252f=['api','moment','bluebird','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger'];(function(_0xce9c13,_0x44939e){var _0x467ad9=function(_0x394187){while(--_0x394187){_0xce9c13['push'](_0xce9c13['shift']());}};_0x467ad9(++_0x44939e);}(_0x252f,0x1e2));var _0xf252=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x252f[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xf252('0x0'));var util=require('util');var logger=require(_0xf252('0x1'))(_0xf252('0x2'));var moment=require(_0xf252('0x3'));var BPromise=require(_0xf252('0x4'));var rp=require('request-promise');var attributes=require(_0xf252('0x5'));module[_0xf252('0x6')]=function(_0xa4c0d7,_0x124f62){return _0xa4c0d7[_0xf252('0x7')](_0xf252('0x8'),attributes,{'tableName':_0xf252('0x9'),'paranoid':![],'indexes':[{'name':_0xf252('0xa'),'fields':[_0xf252('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 9ec19be..2f20621 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 _0x67a6=['UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x67a6,0x137));var _0x667a=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x67a6[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x667a('0x0'));var util=require(_0x667a('0x1'));var moment=require(_0x667a('0x2'));var BPromise=require(_0x667a('0x3'));var rs=require(_0x667a('0x4'));var fs=require('fs');var db=require(_0x667a('0x5'))['db'];var utils=require(_0x667a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x667a('0x7'));var jayson=require(_0x667a('0x8'));var client=jayson[_0x667a('0x9')][_0x667a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dfbba,_0x69cd32,_0x439c0a){return new BPromise(function(_0x44f6fc,_0xfc9da4){return client[_0x667a('0xb')](_0x2dfbba,_0x439c0a)[_0x667a('0xc')](function(_0x2be1eb){logger[_0x667a('0xd')](_0x667a('0xe'),_0x69cd32,_0x667a('0xf'));logger[_0x667a('0x10')](_0x667a('0x11'),_0x69cd32,_0x667a('0xf'),JSON[_0x667a('0x12')](_0x2be1eb));if(_0x2be1eb[_0x667a('0x13')]){if(_0x2be1eb['error'][_0x667a('0x14')]===0x1f4){logger[_0x667a('0x13')](_0x667a('0xe'),_0x69cd32,_0x2be1eb[_0x667a('0x13')][_0x667a('0x15')]);return _0xfc9da4(_0x2be1eb[_0x667a('0x13')]['message']);}logger[_0x667a('0x13')](_0x667a('0xe'),_0x69cd32,_0x2be1eb[_0x667a('0x13')][_0x667a('0x15')]);return _0x44f6fc(_0x2be1eb['error'][_0x667a('0x15')]);}else{logger[_0x667a('0xd')](_0x667a('0xe'),_0x69cd32,_0x667a('0xf'));_0x44f6fc(_0x2be1eb[_0x667a('0x16')][_0x667a('0x15')]);}})[_0x667a('0x17')](function(_0x378f50){logger[_0x667a('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x69cd32,_0x378f50);_0xfc9da4(_0x378f50);});});}exports[_0x667a('0x18')]=function(_0x3b3014){var _0x299b98=this;return new Promise(function(_0x39be90,_0x1007ba){return db['OpenchannelQueueReport'][_0x667a('0x19')](_0x3b3014[_0x667a('0x1a')],{'raw':_0x3b3014[_0x667a('0x1b')]?_0x3b3014[_0x667a('0x1b')][_0x667a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1659c4){logger[_0x667a('0xd')](_0x667a('0x18'),_0x3b3014);logger[_0x667a('0x10')]('CreateOpenchannelQueueReport',_0x3b3014,JSON[_0x667a('0x12')](_0x1659c4));_0x39be90(_0x1659c4);})[_0x667a('0x17')](function(_0x517acd){logger[_0x667a('0x13')](_0x667a('0x18'),_0x517acd['message'],_0x3b3014);_0x1007ba(_0x299b98[_0x667a('0x13')](0x1f4,_0x517acd['message']));});});};exports[_0x667a('0x1d')]=function(_0x1b6254){var _0x417c7b=this;return new Promise(function(_0x15caac,_0xdbda3c){return db[_0x667a('0x1e')][_0x667a('0x1f')](_0x1b6254[_0x667a('0x1a')],{'raw':_0x1b6254[_0x667a('0x1b')]?_0x1b6254[_0x667a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b6254[_0x667a('0x1b')]?_0x1b6254[_0x667a('0x1b')][_0x667a('0x20')]||null:null,'attributes':_0x1b6254['options']?_0x1b6254[_0x667a('0x1b')]['attributes']||null:null,'limit':_0x1b6254[_0x667a('0x1b')]?_0x1b6254[_0x667a('0x1b')][_0x667a('0x21')]||null:null})[_0x667a('0xc')](function(_0x4b20ef){logger[_0x667a('0xd')]('UpdateOpenchannelQueueReport',_0x1b6254);logger[_0x667a('0x10')](_0x667a('0x1d'),_0x1b6254,JSON['stringify'](_0x4b20ef));_0x15caac(_0x4b20ef);})[_0x667a('0x17')](function(_0x2a2324){logger[_0x667a('0x13')](_0x667a('0x1d'),_0x2a2324[_0x667a('0x15')],_0x1b6254);_0xdbda3c(_0x417c7b[_0x667a('0x13')](0x1f4,_0x2a2324[_0x667a('0x15')]));});});}; \ No newline at end of file +var _0xb0cf=['body','raw','then','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','options','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateOpenchannelQueueReport','create'];(function(_0x4ebf87,_0x1c89c2){var _0x3c631a=function(_0x2c2181){while(--_0x2c2181){_0x4ebf87['push'](_0x4ebf87['shift']());}};_0x3c631a(++_0x1c89c2);}(_0xb0cf,0xc3));var _0xfb0c=function(_0x5a22bf,_0x3ede6a){_0x5a22bf=_0x5a22bf-0x0;var _0x1a7051=_0xb0cf[_0x5a22bf];return _0x1a7051;};'use strict';var _=require(_0xfb0c('0x0'));var util=require(_0xfb0c('0x1'));var moment=require(_0xfb0c('0x2'));var BPromise=require(_0xfb0c('0x3'));var rs=require(_0xfb0c('0x4'));var fs=require('fs');var db=require(_0xfb0c('0x5'))['db'];var utils=require(_0xfb0c('0x6'));var logger=require('../../config/logger')(_0xfb0c('0x7'));var config=require(_0xfb0c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53f161,_0x3742ef,_0x381120){return new BPromise(function(_0x130370,_0x974d28){return client[_0xfb0c('0xa')](_0x53f161,_0x381120)['then'](function(_0x137ed9){logger[_0xfb0c('0xb')](_0xfb0c('0xc'),_0x3742ef,_0xfb0c('0xd'));logger[_0xfb0c('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x3742ef,_0xfb0c('0xd'),JSON[_0xfb0c('0xf')](_0x137ed9));if(_0x137ed9[_0xfb0c('0x10')]){if(_0x137ed9['error']['code']===0x1f4){logger['error'](_0xfb0c('0xc'),_0x3742ef,_0x137ed9[_0xfb0c('0x10')][_0xfb0c('0x11')]);return _0x974d28(_0x137ed9['error'][_0xfb0c('0x11')]);}logger[_0xfb0c('0x10')](_0xfb0c('0xc'),_0x3742ef,_0x137ed9[_0xfb0c('0x10')][_0xfb0c('0x11')]);return _0x130370(_0x137ed9['error'][_0xfb0c('0x11')]);}else{logger['info'](_0xfb0c('0xc'),_0x3742ef,_0xfb0c('0xd'));_0x130370(_0x137ed9[_0xfb0c('0x12')][_0xfb0c('0x11')]);}})[_0xfb0c('0x13')](function(_0x282f4a){logger[_0xfb0c('0x10')](_0xfb0c('0xc'),_0x3742ef,_0x282f4a);_0x974d28(_0x282f4a);});});}exports[_0xfb0c('0x14')]=function(_0x1d6661){var _0x2c85cb=this;return new Promise(function(_0x2f9f1d,_0x1b66ed){return db['OpenchannelQueueReport'][_0xfb0c('0x15')](_0x1d6661[_0xfb0c('0x16')],{'raw':_0x1d6661['options']?_0x1d6661['options'][_0xfb0c('0x17')]===undefined?!![]:![]:!![]})[_0xfb0c('0x18')](function(_0x4206ea){logger[_0xfb0c('0xb')](_0xfb0c('0x14'),_0x1d6661);logger[_0xfb0c('0xe')](_0xfb0c('0x14'),_0x1d6661,JSON[_0xfb0c('0xf')](_0x4206ea));_0x2f9f1d(_0x4206ea);})[_0xfb0c('0x13')](function(_0x5ecd78){logger[_0xfb0c('0x10')](_0xfb0c('0x14'),_0x5ecd78[_0xfb0c('0x11')],_0x1d6661);_0x1b66ed(_0x2c85cb['error'](0x1f4,_0x5ecd78['message']));});});};exports[_0xfb0c('0x19')]=function(_0x13432b){var _0x153a24=this;return new Promise(function(_0x3536ec,_0x387ac6){return db[_0xfb0c('0x1a')][_0xfb0c('0x1b')](_0x13432b[_0xfb0c('0x16')],{'raw':_0x13432b[_0xfb0c('0x1c')]?_0x13432b[_0xfb0c('0x1c')][_0xfb0c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13432b[_0xfb0c('0x1c')]?_0x13432b[_0xfb0c('0x1c')]['where']||null:null,'attributes':_0x13432b[_0xfb0c('0x1c')]?_0x13432b[_0xfb0c('0x1c')][_0xfb0c('0x1d')]||null:null,'limit':_0x13432b[_0xfb0c('0x1c')]?_0x13432b[_0xfb0c('0x1c')][_0xfb0c('0x1e')]||null:null})['then'](function(_0x368e24){logger[_0xfb0c('0xb')]('UpdateOpenchannelQueueReport',_0x13432b);logger[_0xfb0c('0xe')](_0xfb0c('0x19'),_0x13432b,JSON[_0xfb0c('0xf')](_0x368e24));_0x3536ec(_0x368e24);})['catch'](function(_0x479a94){logger[_0xfb0c('0x10')](_0xfb0c('0x19'),_0x479a94[_0xfb0c('0x11')],_0x13432b);_0x387ac6(_0x153a24['error'](0x1f4,_0x479a94['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a1b1307..081ecad 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 _0x35f1=['../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x3c6946,_0x30845a){var _0x53324a=function(_0x24193c){while(--_0x24193c){_0x3c6946['push'](_0x3c6946['shift']());}};_0x53324a(++_0x30845a);}(_0x35f1,0x13f));var _0x135f=function(_0x3ba9ec,_0x49c244){_0x3ba9ec=_0x3ba9ec-0x0;var _0x39f681=_0x35f1[_0x3ba9ec];return _0x39f681;};'use strict';var multer=require(_0x135f('0x0'));var util=require(_0x135f('0x1'));var path=require(_0x135f('0x2'));var express=require('express');var router=express[_0x135f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x135f('0x4'));var config=require(_0x135f('0x5'));var controller=require(_0x135f('0x6'));router[_0x135f('0x7')]('/',auth[_0x135f('0x8')](),controller['index']);router[_0x135f('0x7')](_0x135f('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x135f('0x7')](_0x135f('0xa'),auth[_0x135f('0x8')](),controller[_0x135f('0xb')]);router[_0x135f('0xc')]('/',auth[_0x135f('0x8')](),controller[_0x135f('0xd')]);router[_0x135f('0xe')]('/:id',auth[_0x135f('0x8')](),controller[_0x135f('0xf')]);router[_0x135f('0x10')](_0x135f('0xa'),auth[_0x135f('0x8')](),controller[_0x135f('0x11')]);module[_0x135f('0x12')]=router; \ No newline at end of file +var _0xb755=['index','get','describe','/:id','show','post','update','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated'];(function(_0x32f422,_0x5ea70d){var _0x1deb69=function(_0xf71217){while(--_0xf71217){_0x32f422['push'](_0x32f422['shift']());}};_0x1deb69(++_0x5ea70d);}(_0xb755,0xe6));var _0x5b75=function(_0x266aa1,_0x3fcde1){_0x266aa1=_0x266aa1-0x0;var _0x3bf5a8=_0xb755[_0x266aa1];return _0x3bf5a8;};'use strict';var multer=require(_0x5b75('0x0'));var util=require('util');var path=require('path');var express=require(_0x5b75('0x1'));var router=express[_0x5b75('0x2')]();var auth=require(_0x5b75('0x3'));var interaction=require(_0x5b75('0x4'));var config=require(_0x5b75('0x5'));var controller=require(_0x5b75('0x6'));router['get']('/',auth[_0x5b75('0x7')](),controller[_0x5b75('0x8')]);router[_0x5b75('0x9')]('/describe',auth[_0x5b75('0x7')](),controller[_0x5b75('0xa')]);router[_0x5b75('0x9')](_0x5b75('0xb'),auth['isAuthenticated'](),controller[_0x5b75('0xc')]);router[_0x5b75('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5b75('0xb'),auth[_0x5b75('0x7')](),controller[_0x5b75('0xe')]);router['delete'](_0x5b75('0xb'),auth[_0x5b75('0x7')](),controller[_0x5b75('0xf')]);module[_0x5b75('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4ff2845..cc465c4 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 _0xead3=['agent','queue','DATE','moment','sequelize','exports','STRING','ENUM'];(function(_0x4bd708,_0xc866de){var _0x45c6bc=function(_0x37aef9){while(--_0x37aef9){_0x4bd708['push'](_0x4bd708['shift']());}};_0x45c6bc(++_0xc866de);}(_0xead3,0x14b));var _0x3ead=function(_0x345a1b,_0x189c9e){_0x345a1b=_0x345a1b-0x0;var _0x1b24ec=_0xead3[_0x345a1b];return _0x1b24ec;};'use strict';var moment=require(_0x3ead('0x0'));var Sequelize=require(_0x3ead('0x1'));module[_0x3ead('0x2')]={'uniqueid':{'type':Sequelize[_0x3ead('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3ead('0x4')]('account',_0x3ead('0x5'),'queue'),'allowNull':![],'defaultValue':_0x3ead('0x6')},'transferredAt':{'type':Sequelize[_0x3ead('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xfeff=['queue','NOW','exports','ENUM','account'];(function(_0x4e13b0,_0x1ca561){var _0x5c2a63=function(_0xc1d181){while(--_0xc1d181){_0x4e13b0['push'](_0x4e13b0['shift']());}};_0x5c2a63(++_0x1ca561);}(_0xfeff,0x89));var _0xffef=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfeff[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xffef('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xffef('0x1')](_0xffef('0x2'),'agent','queue'),'allowNull':![],'defaultValue':_0xffef('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xffef('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 453a8b5..507531a 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 _0x4a7e=['mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','rawAttributes','model','query','dateStart','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','map','filter','options','OpenchannelTransferReport','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','request-promise','moment','bluebird'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x4a7e,0x1a7));var _0xe4a7=function(_0x39c532,_0x463b51){_0x39c532=_0x39c532-0x0;var _0x231512=_0x4a7e[_0x39c532];return _0x231512;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xe4a7('0x0'));var moment=require(_0xe4a7('0x1'));var BPromise=require(_0xe4a7('0x2'));var Mustache=require(_0xe4a7('0x3'));var util=require(_0xe4a7('0x4'));var path=require(_0xe4a7('0x5'));var sox=require('sox');var csv=require(_0xe4a7('0x6'));var ejs=require(_0xe4a7('0x7'));var fs=require('fs');var _=require(_0xe4a7('0x8'));var squel=require(_0xe4a7('0x9'));var crypto=require(_0xe4a7('0xa'));var jsforce=require(_0xe4a7('0xb'));var deskjs=require(_0xe4a7('0xc'));var toCsv=require(_0xe4a7('0x6'));var querystring=require(_0xe4a7('0xd'));var Papa=require(_0xe4a7('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xe4a7('0xf'))('api');var utils=require(_0xe4a7('0x10'));var config=require(_0xe4a7('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x820f3e,_0x3aa19b){_0x3aa19b=_0x3aa19b||0xcc;return function(_0x3c7277){if(_0x3c7277){return _0x820f3e['sendStatus'](_0x3aa19b);}return _0x820f3e[_0xe4a7('0x12')](_0x3aa19b)[_0xe4a7('0x13')]();};}function respondWithResult(_0x3ebe21,_0x317f04){_0x317f04=_0x317f04||0xc8;return function(_0x5c2488){if(_0x5c2488){return _0x3ebe21[_0xe4a7('0x12')](_0x317f04)[_0xe4a7('0x14')](_0x5c2488);}};}function respondWithFilteredResult(_0x115497,_0x5a71b3){return function(_0x3e518e){if(_0x3e518e){var _0x59d9bc=_0x3e518e['count'],_0x2af656=_0x5a71b3['offset'],_0x1d134e=_0x5a71b3[_0xe4a7('0x15')]+_0x5a71b3[_0xe4a7('0x16')],_0x16582c;if(_0x1d134e>=_0x59d9bc){_0x1d134e=_0x59d9bc;_0x16582c=0xc8;}else{_0x16582c=0xce;}_0x115497[_0xe4a7('0x12')](_0x16582c);return _0x115497[_0xe4a7('0x17')](_0xe4a7('0x18'),_0x2af656+'-'+_0x1d134e+'/'+_0x59d9bc)[_0xe4a7('0x14')](_0x3e518e);}return null;};}function patchUpdates(_0x5285a2){return function(_0x595e25){try{jsonpatch[_0xe4a7('0x19')](_0x595e25,_0x5285a2,!![]);}catch(_0x11a3c4){return BPromise['reject'](_0x11a3c4);}return _0x595e25[_0xe4a7('0x1a')]();};}function saveUpdates(_0x1b8eca,_0x22e345){return function(_0x4ed4cb){if(_0x4ed4cb){return _0x4ed4cb['update'](_0x1b8eca)[_0xe4a7('0x1b')](function(_0x2af554){return _0x2af554;});}return null;};}function removeEntity(_0x403b50,_0x5ec61f){return function(_0x368bf2){if(_0x368bf2){return _0x368bf2['destroy']()['then'](function(){_0x403b50[_0xe4a7('0x12')](0xcc)[_0xe4a7('0x13')]();});}};}function handleEntityNotFound(_0x4473ec,_0x254603){return function(_0x4e1eea){if(!_0x4e1eea){_0x4473ec[_0xe4a7('0x1c')](0x194);}return _0x4e1eea;};}function handleError(_0x1a2b7e,_0x1b5bb9){_0x1b5bb9=_0x1b5bb9||0x1f4;return function(_0x3c7051){logger[_0xe4a7('0x1d')](_0x3c7051[_0xe4a7('0x1e')]);if(_0x3c7051[_0xe4a7('0x1f')]){delete _0x3c7051[_0xe4a7('0x1f')];}_0x1a2b7e['status'](_0x1b5bb9)[_0xe4a7('0x20')](_0x3c7051);};}exports['index']=function(_0x28590f,_0xc60e7f){var _0x425129={},_0xb6ac01={},_0x264f94={'count':0x0,'rows':[]};var _0x5e3a35=db['OpenchannelTransferReport'][_0xe4a7('0x21')];_0xb6ac01[_0xe4a7('0x22')]=_['keys'](_0x5e3a35);var _0x1af979={'dateStart':_0x28590f[_0xe4a7('0x23')][_0xe4a7('0x24')],'dateEnd':_0x28590f['query']['dateEnd']};delete _0x28590f[_0xe4a7('0x23')][_0xe4a7('0x24')];delete _0x28590f[_0xe4a7('0x23')]['dateEnd'];_0xb6ac01['query']=_[_0xe4a7('0x25')](_0x28590f[_0xe4a7('0x23')]);_0xb6ac01[_0xe4a7('0x26')]=_['intersection'](_0xb6ac01[_0xe4a7('0x22')],_0xb6ac01[_0xe4a7('0x23')]);_0x425129[_0xe4a7('0x27')]=_[_0xe4a7('0x28')](_0xb6ac01[_0xe4a7('0x22')],qs[_0xe4a7('0x29')](_0x28590f['query'][_0xe4a7('0x29')]));_0x425129[_0xe4a7('0x27')]=_0x425129['attributes'][_0xe4a7('0x2a')]?_0x425129[_0xe4a7('0x27')]:_0xb6ac01[_0xe4a7('0x22')];if(!_0x28590f['query'][_0xe4a7('0x2b')](_0xe4a7('0x2c'))){_0x425129[_0xe4a7('0x16')]=qs[_0xe4a7('0x16')](_0x28590f[_0xe4a7('0x23')]['limit']);_0x425129[_0xe4a7('0x15')]=qs[_0xe4a7('0x15')](_0x28590f[_0xe4a7('0x23')][_0xe4a7('0x15')]);}_0x425129[_0xe4a7('0x2d')]=qs[_0xe4a7('0x2e')](_0x28590f[_0xe4a7('0x23')][_0xe4a7('0x2e')]);_0x425129[_0xe4a7('0x2f')]=qs[_0xe4a7('0x26')](_[_0xe4a7('0x30')](_0x28590f['query'],_0xb6ac01[_0xe4a7('0x26')]));if(_0x1af979[_0xe4a7('0x24')]){if(_0x1af979[_0xe4a7('0x31')]){_0x1af979[_0xe4a7('0x31')]=moment(_0x1af979[_0xe4a7('0x31')])[_0xe4a7('0x32')](0x1,_0xe4a7('0x33'));}else{_0x1af979['dateEnd']=moment(_0x1af979[_0xe4a7('0x24')])[_0xe4a7('0x32')](0x1,_0xe4a7('0x33'));}_[_0xe4a7('0x34')](_0x425129[_0xe4a7('0x2f')],{'createdAt':{'$gte':_0x1af979[_0xe4a7('0x24')],'$lte':_0x1af979[_0xe4a7('0x31')]}});}if(_0x28590f[_0xe4a7('0x23')]['filter']){_0x425129['where']=_['merge'](_0x425129[_0xe4a7('0x2f')],{'$or':_[_0xe4a7('0x35')](_0x425129[_0xe4a7('0x27')],function(_0x282dfd){var _0xfff0df={};_0xfff0df[_0x282dfd]={'$like':'%'+_0x28590f[_0xe4a7('0x23')][_0xe4a7('0x36')]+'%'};return _0xfff0df;})});}_0x425129=_[_0xe4a7('0x34')]({},_0x425129,_0x28590f[_0xe4a7('0x37')]);var _0x1e644e={'where':_0x425129[_0xe4a7('0x2f')]};return db[_0xe4a7('0x38')][_0xe4a7('0x39')](_0x1e644e)[_0xe4a7('0x1b')](function(_0x10923d){_0x264f94[_0xe4a7('0x39')]=_0x10923d;if(_0x28590f['query'][_0xe4a7('0x3a')]){_0x425129[_0xe4a7('0x3b')]=[{'all':!![]}];}return db[_0xe4a7('0x38')][_0xe4a7('0x3c')](_0x425129);})[_0xe4a7('0x1b')](function(_0x5062a6){_0x264f94[_0xe4a7('0x3d')]=_0x5062a6;return _0x264f94;})[_0xe4a7('0x1b')](respondWithFilteredResult(_0xc60e7f,_0x425129))[_0xe4a7('0x3e')](handleError(_0xc60e7f,null));};exports[_0xe4a7('0x3f')]=function(_0x329d6e,_0xe22326){var _0x3b75e0={'raw':!![],'where':{'id':_0x329d6e[_0xe4a7('0x40')]['id']}},_0x403e41={};_0x403e41['model']=_[_0xe4a7('0x25')](db[_0xe4a7('0x38')][_0xe4a7('0x21')]);_0x403e41[_0xe4a7('0x23')]=_[_0xe4a7('0x25')](_0x329d6e[_0xe4a7('0x23')]);_0x403e41[_0xe4a7('0x26')]=_[_0xe4a7('0x28')](_0x403e41['model'],_0x403e41[_0xe4a7('0x23')]);_0x3b75e0[_0xe4a7('0x27')]=_[_0xe4a7('0x28')](_0x403e41[_0xe4a7('0x22')],qs[_0xe4a7('0x29')](_0x329d6e['query'][_0xe4a7('0x29')]));_0x3b75e0[_0xe4a7('0x27')]=_0x3b75e0[_0xe4a7('0x27')][_0xe4a7('0x2a')]?_0x3b75e0['attributes']:_0x403e41['model'];if(_0x329d6e[_0xe4a7('0x23')][_0xe4a7('0x3a')]){_0x3b75e0[_0xe4a7('0x3b')]=[{'all':!![]}];}_0x3b75e0=_['merge']({},_0x3b75e0,_0x329d6e[_0xe4a7('0x37')]);return db['OpenchannelTransferReport'][_0xe4a7('0x41')](_0x3b75e0)[_0xe4a7('0x1b')](handleEntityNotFound(_0xe22326,null))[_0xe4a7('0x1b')](respondWithResult(_0xe22326,null))[_0xe4a7('0x3e')](handleError(_0xe22326,null));};exports[_0xe4a7('0x42')]=function(_0x26a6c7,_0x410a51){return db[_0xe4a7('0x38')]['create'](_0x26a6c7[_0xe4a7('0x43')],{})[_0xe4a7('0x1b')](respondWithResult(_0x410a51,0xc9))[_0xe4a7('0x3e')](handleError(_0x410a51,null));};exports[_0xe4a7('0x44')]=function(_0x40bc48,_0x3ef4f6){if(_0x40bc48[_0xe4a7('0x43')]['id']){delete _0x40bc48['body']['id'];}return db[_0xe4a7('0x38')]['find']({'where':{'id':_0x40bc48[_0xe4a7('0x40')]['id']}})[_0xe4a7('0x1b')](handleEntityNotFound(_0x3ef4f6,null))[_0xe4a7('0x1b')](saveUpdates(_0x40bc48[_0xe4a7('0x43')],null))[_0xe4a7('0x1b')](respondWithResult(_0x3ef4f6,null))[_0xe4a7('0x3e')](handleError(_0x3ef4f6,null));};exports[_0xe4a7('0x45')]=function(_0x23239b,_0x4cca5e){return db[_0xe4a7('0x38')][_0xe4a7('0x41')]({'where':{'id':_0x23239b[_0xe4a7('0x40')]['id']}})[_0xe4a7('0x1b')](handleEntityNotFound(_0x4cca5e,null))['then'](removeEntity(_0x4cca5e,null))[_0xe4a7('0x3e')](handleError(_0x4cca5e,null));};exports[_0xe4a7('0x46')]=function(_0xcbf227,_0x3cda48){return db['OpenchannelTransferReport'][_0xe4a7('0x46')]()[_0xe4a7('0x1b')](respondWithResult(_0x3cda48,null))[_0xe4a7('0x3e')](handleError(_0x3cda48,null));}; \ No newline at end of file +var _0x3f99=['length','hasOwnProperty','nolimit','sort','pick','add','day','merge','where','filter','map','options','includeAll','include','findAll','show','params','catch','create','body','find','destroy','describe','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields'];(function(_0x35313e,_0x2a5769){var _0x375bdf=function(_0x5bc30d){while(--_0x5bc30d){_0x35313e['push'](_0x35313e['shift']());}};_0x375bdf(++_0x2a5769);}(_0x3f99,0x9f));var _0x93f9=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x3f99[_0xce93c];return _0x230720;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x93f9('0x0'));var moment=require(_0x93f9('0x1'));var BPromise=require(_0x93f9('0x2'));var Mustache=require(_0x93f9('0x3'));var util=require(_0x93f9('0x4'));var path=require('path');var sox=require(_0x93f9('0x5'));var csv=require(_0x93f9('0x6'));var ejs=require(_0x93f9('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x93f9('0x8'));var deskjs=require(_0x93f9('0x9'));var toCsv=require(_0x93f9('0x6'));var querystring=require(_0x93f9('0xa'));var Papa=require(_0x93f9('0xb'));var qs=require(_0x93f9('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x93f9('0xd'));var config=require('../../config/environment');var db=require(_0x93f9('0xe'))['db'];function respondWithStatusCode(_0x5009c5,_0x2b279a){_0x2b279a=_0x2b279a||0xcc;return function(_0x35afa2){if(_0x35afa2){return _0x5009c5[_0x93f9('0xf')](_0x2b279a);}return _0x5009c5[_0x93f9('0x10')](_0x2b279a)[_0x93f9('0x11')]();};}function respondWithResult(_0x1532bc,_0x1defc8){_0x1defc8=_0x1defc8||0xc8;return function(_0x558567){if(_0x558567){return _0x1532bc[_0x93f9('0x10')](_0x1defc8)[_0x93f9('0x12')](_0x558567);}};}function respondWithFilteredResult(_0x3dec73,_0x52b076){return function(_0x422f61){if(_0x422f61){var _0x22bd10=_0x422f61[_0x93f9('0x13')],_0x5ebb00=_0x52b076[_0x93f9('0x14')],_0x293acd=_0x52b076[_0x93f9('0x14')]+_0x52b076[_0x93f9('0x15')],_0xec93a7;if(_0x293acd>=_0x22bd10){_0x293acd=_0x22bd10;_0xec93a7=0xc8;}else{_0xec93a7=0xce;}_0x3dec73['status'](_0xec93a7);return _0x3dec73[_0x93f9('0x16')](_0x93f9('0x17'),_0x5ebb00+'-'+_0x293acd+'/'+_0x22bd10)['json'](_0x422f61);}return null;};}function patchUpdates(_0x495b9e){return function(_0x31a58c){try{jsonpatch[_0x93f9('0x18')](_0x31a58c,_0x495b9e,!![]);}catch(_0x290b6f){return BPromise[_0x93f9('0x19')](_0x290b6f);}return _0x31a58c[_0x93f9('0x1a')]();};}function saveUpdates(_0x47c860,_0x29beea){return function(_0x3c9085){if(_0x3c9085){return _0x3c9085[_0x93f9('0x1b')](_0x47c860)[_0x93f9('0x1c')](function(_0x1188c8){return _0x1188c8;});}return null;};}function removeEntity(_0x277728,_0x35367f){return function(_0x4fe4c4){if(_0x4fe4c4){return _0x4fe4c4['destroy']()[_0x93f9('0x1c')](function(){_0x277728['status'](0xcc)[_0x93f9('0x11')]();});}};}function handleEntityNotFound(_0x344b9b,_0x27a8b9){return function(_0x4403b4){if(!_0x4403b4){_0x344b9b[_0x93f9('0xf')](0x194);}return _0x4403b4;};}function handleError(_0x5a3d2e,_0x4d612){_0x4d612=_0x4d612||0x1f4;return function(_0x4f6077){logger[_0x93f9('0x1d')](_0x4f6077[_0x93f9('0x1e')]);if(_0x4f6077[_0x93f9('0x1f')]){delete _0x4f6077[_0x93f9('0x1f')];}_0x5a3d2e[_0x93f9('0x10')](_0x4d612)[_0x93f9('0x20')](_0x4f6077);};}exports[_0x93f9('0x21')]=function(_0xcbc639,_0x4803b4){var _0x2a45ec={},_0x419311={},_0x12c3fc={'count':0x0,'rows':[]};var _0x22c026=db[_0x93f9('0x22')][_0x93f9('0x23')];_0x419311[_0x93f9('0x24')]=_[_0x93f9('0x25')](_0x22c026);var _0xc11589={'dateStart':_0xcbc639['query']['dateStart'],'dateEnd':_0xcbc639[_0x93f9('0x26')][_0x93f9('0x27')]};delete _0xcbc639[_0x93f9('0x26')][_0x93f9('0x28')];delete _0xcbc639[_0x93f9('0x26')]['dateEnd'];_0x419311[_0x93f9('0x26')]=_['keys'](_0xcbc639[_0x93f9('0x26')]);_0x419311[_0x93f9('0x29')]=_[_0x93f9('0x2a')](_0x419311[_0x93f9('0x24')],_0x419311[_0x93f9('0x26')]);_0x2a45ec[_0x93f9('0x2b')]=_[_0x93f9('0x2a')](_0x419311[_0x93f9('0x24')],qs[_0x93f9('0x2c')](_0xcbc639[_0x93f9('0x26')][_0x93f9('0x2c')]));_0x2a45ec[_0x93f9('0x2b')]=_0x2a45ec[_0x93f9('0x2b')][_0x93f9('0x2d')]?_0x2a45ec[_0x93f9('0x2b')]:_0x419311['model'];if(!_0xcbc639[_0x93f9('0x26')][_0x93f9('0x2e')](_0x93f9('0x2f'))){_0x2a45ec[_0x93f9('0x15')]=qs[_0x93f9('0x15')](_0xcbc639[_0x93f9('0x26')][_0x93f9('0x15')]);_0x2a45ec['offset']=qs['offset'](_0xcbc639[_0x93f9('0x26')][_0x93f9('0x14')]);}_0x2a45ec['order']=qs[_0x93f9('0x30')](_0xcbc639['query'][_0x93f9('0x30')]);_0x2a45ec['where']=qs[_0x93f9('0x29')](_[_0x93f9('0x31')](_0xcbc639[_0x93f9('0x26')],_0x419311[_0x93f9('0x29')]));if(_0xc11589[_0x93f9('0x28')]){if(_0xc11589[_0x93f9('0x27')]){_0xc11589['dateEnd']=moment(_0xc11589[_0x93f9('0x27')])[_0x93f9('0x32')](0x1,_0x93f9('0x33'));}else{_0xc11589[_0x93f9('0x27')]=moment(_0xc11589[_0x93f9('0x28')])['add'](0x1,_0x93f9('0x33'));}_[_0x93f9('0x34')](_0x2a45ec[_0x93f9('0x35')],{'createdAt':{'$gte':_0xc11589[_0x93f9('0x28')],'$lte':_0xc11589[_0x93f9('0x27')]}});}if(_0xcbc639[_0x93f9('0x26')][_0x93f9('0x36')]){_0x2a45ec[_0x93f9('0x35')]=_[_0x93f9('0x34')](_0x2a45ec[_0x93f9('0x35')],{'$or':_[_0x93f9('0x37')](_0x2a45ec[_0x93f9('0x2b')],function(_0x39a1bb){var _0xf1b704={};_0xf1b704[_0x39a1bb]={'$like':'%'+_0xcbc639[_0x93f9('0x26')][_0x93f9('0x36')]+'%'};return _0xf1b704;})});}_0x2a45ec=_[_0x93f9('0x34')]({},_0x2a45ec,_0xcbc639[_0x93f9('0x38')]);var _0x177df9={'where':_0x2a45ec['where']};return db[_0x93f9('0x22')][_0x93f9('0x13')](_0x177df9)[_0x93f9('0x1c')](function(_0xf55ec){_0x12c3fc[_0x93f9('0x13')]=_0xf55ec;if(_0xcbc639[_0x93f9('0x26')][_0x93f9('0x39')]){_0x2a45ec[_0x93f9('0x3a')]=[{'all':!![]}];}return db[_0x93f9('0x22')][_0x93f9('0x3b')](_0x2a45ec);})[_0x93f9('0x1c')](function(_0x4cc7d1){_0x12c3fc['rows']=_0x4cc7d1;return _0x12c3fc;})[_0x93f9('0x1c')](respondWithFilteredResult(_0x4803b4,_0x2a45ec))['catch'](handleError(_0x4803b4,null));};exports[_0x93f9('0x3c')]=function(_0x3a47a7,_0x4ae54f){var _0xbf12ee={'raw':!![],'where':{'id':_0x3a47a7[_0x93f9('0x3d')]['id']}},_0xf9f0f0={};_0xf9f0f0[_0x93f9('0x24')]=_[_0x93f9('0x25')](db[_0x93f9('0x22')][_0x93f9('0x23')]);_0xf9f0f0[_0x93f9('0x26')]=_[_0x93f9('0x25')](_0x3a47a7[_0x93f9('0x26')]);_0xf9f0f0['filters']=_['intersection'](_0xf9f0f0['model'],_0xf9f0f0['query']);_0xbf12ee[_0x93f9('0x2b')]=_[_0x93f9('0x2a')](_0xf9f0f0[_0x93f9('0x24')],qs[_0x93f9('0x2c')](_0x3a47a7[_0x93f9('0x26')]['fields']));_0xbf12ee[_0x93f9('0x2b')]=_0xbf12ee['attributes']['length']?_0xbf12ee['attributes']:_0xf9f0f0['model'];if(_0x3a47a7['query']['includeAll']){_0xbf12ee[_0x93f9('0x3a')]=[{'all':!![]}];}_0xbf12ee=_['merge']({},_0xbf12ee,_0x3a47a7['options']);return db['OpenchannelTransferReport']['find'](_0xbf12ee)[_0x93f9('0x1c')](handleEntityNotFound(_0x4ae54f,null))[_0x93f9('0x1c')](respondWithResult(_0x4ae54f,null))[_0x93f9('0x3e')](handleError(_0x4ae54f,null));};exports['create']=function(_0xac8949,_0xd1e88b){return db['OpenchannelTransferReport'][_0x93f9('0x3f')](_0xac8949[_0x93f9('0x40')],{})[_0x93f9('0x1c')](respondWithResult(_0xd1e88b,0xc9))[_0x93f9('0x3e')](handleError(_0xd1e88b,null));};exports[_0x93f9('0x1b')]=function(_0x34be3c,_0x455e25){if(_0x34be3c[_0x93f9('0x40')]['id']){delete _0x34be3c[_0x93f9('0x40')]['id'];}return db[_0x93f9('0x22')][_0x93f9('0x41')]({'where':{'id':_0x34be3c['params']['id']}})[_0x93f9('0x1c')](handleEntityNotFound(_0x455e25,null))['then'](saveUpdates(_0x34be3c[_0x93f9('0x40')],null))[_0x93f9('0x1c')](respondWithResult(_0x455e25,null))[_0x93f9('0x3e')](handleError(_0x455e25,null));};exports[_0x93f9('0x42')]=function(_0x23dd91,_0x3cc25c){return db[_0x93f9('0x22')][_0x93f9('0x41')]({'where':{'id':_0x23dd91[_0x93f9('0x3d')]['id']}})[_0x93f9('0x1c')](handleEntityNotFound(_0x3cc25c,null))[_0x93f9('0x1c')](removeEntity(_0x3cc25c,null))[_0x93f9('0x3e')](handleError(_0x3cc25c,null));};exports[_0x93f9('0x43')]=function(_0x4b0fd6,_0x6296e9){return db['OpenchannelTransferReport']['describe']()['then'](respondWithResult(_0x6296e9,null))[_0x93f9('0x3e')](handleError(_0x6296e9,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0217127..817f1f0 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.model.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x479fb6,_0x28680a){var _0x200a41=function(_0x388880){while(--_0x388880){_0x479fb6['push'](_0x479fb6['shift']());}};_0x200a41(++_0x28680a);}(_0x7a54,0x106));var _0x47a5=function(_0x213778,_0xf381ab){_0x213778=_0x213778-0x0;var _0x39fa74=_0x7a54[_0x213778];return _0x39fa74;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x50b78c,_0x1208e1){var _0x4c2ec1=function(_0x57bbe6){while(--_0x57bbe6){_0x50b78c['push'](_0x50b78c['shift']());}};_0x4c2ec1(++_0x1208e1);}(_0x7a54,0x106));var _0x47a5=function(_0x33f60b,_0x1cb6c0){_0x33f60b=_0x33f60b-0x0;var _0x3d4e57=_0x7a54[_0x33f60b];return _0x3d4e57;};'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 2699c0d..9cbbc3f 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 _0xa2ea=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x37ddbe,_0x99848d){var _0x59da59=function(_0x585083){while(--_0x585083){_0x37ddbe['push'](_0x37ddbe['shift']());}};_0x59da59(++_0x99848d);}(_0xa2ea,0x180));var _0xaa2e=function(_0x4668a6,_0x4e8a1f){_0x4668a6=_0x4668a6-0x0;var _0x23215d=_0xa2ea[_0x4668a6];return _0x23215d;};'use strict';var _=require(_0xaa2e('0x0'));var util=require(_0xaa2e('0x1'));var moment=require(_0xaa2e('0x2'));var BPromise=require(_0xaa2e('0x3'));var rs=require(_0xaa2e('0x4'));var fs=require('fs');var db=require(_0xaa2e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa2e('0x6'))(_0xaa2e('0x7'));var config=require(_0xaa2e('0x8'));var jayson=require(_0xaa2e('0x9'));var client=jayson[_0xaa2e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d99e3,_0x2b4396,_0xa9d437){return new BPromise(function(_0x316150,_0x4bf06c){return client['request'](_0x1d99e3,_0xa9d437)[_0xaa2e('0xb')](function(_0x1f161e){logger[_0xaa2e('0xc')](_0xaa2e('0xd'),_0x2b4396,_0xaa2e('0xe'));logger[_0xaa2e('0xf')](_0xaa2e('0x10'),_0x2b4396,_0xaa2e('0xe'),JSON['stringify'](_0x1f161e));if(_0x1f161e['error']){if(_0x1f161e[_0xaa2e('0x11')]['code']===0x1f4){logger[_0xaa2e('0x11')](_0xaa2e('0xd'),_0x2b4396,_0x1f161e[_0xaa2e('0x11')][_0xaa2e('0x12')]);return _0x4bf06c(_0x1f161e[_0xaa2e('0x11')]['message']);}logger[_0xaa2e('0x11')](_0xaa2e('0xd'),_0x2b4396,_0x1f161e[_0xaa2e('0x11')][_0xaa2e('0x12')]);return _0x316150(_0x1f161e[_0xaa2e('0x11')][_0xaa2e('0x12')]);}else{logger['info'](_0xaa2e('0xd'),_0x2b4396,_0xaa2e('0xe'));_0x316150(_0x1f161e[_0xaa2e('0x13')][_0xaa2e('0x12')]);}})['catch'](function(_0x8704ab){logger[_0xaa2e('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2b4396,_0x8704ab);_0x4bf06c(_0x8704ab);});});} \ No newline at end of file +var _0x62ed=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','request\x20sent','result','message','util','moment'];(function(_0x350465,_0x18ed5d){var _0x4ae53d=function(_0x28aa44){while(--_0x28aa44){_0x350465['push'](_0x350465['shift']());}};_0x4ae53d(++_0x18ed5d);}(_0x62ed,0x18e));var _0xd62e=function(_0x37a02a,_0xf609e8){_0x37a02a=_0x37a02a-0x0;var _0x29f34f=_0x62ed[_0x37a02a];return _0x29f34f;};'use strict';var _=require('lodash');var util=require(_0xd62e('0x0'));var moment=require(_0xd62e('0x1'));var BPromise=require('bluebird');var rs=require(_0xd62e('0x2'));var fs=require('fs');var db=require(_0xd62e('0x3'))['db'];var utils=require(_0xd62e('0x4'));var logger=require(_0xd62e('0x5'))(_0xd62e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd62e('0x7')][_0xd62e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x80162e,_0xb590b7,_0x1dfe81){return new BPromise(function(_0x4f9b92,_0x54d69d){return client[_0xd62e('0x9')](_0x80162e,_0x1dfe81)[_0xd62e('0xa')](function(_0x3b2a03){logger['info'](_0xd62e('0xb'),_0xb590b7,'request\x20sent');logger[_0xd62e('0xc')](_0xd62e('0xd'),_0xb590b7,'request\x20sent',JSON[_0xd62e('0xe')](_0x3b2a03));if(_0x3b2a03[_0xd62e('0xf')]){if(_0x3b2a03['error'][_0xd62e('0x10')]===0x1f4){logger['error'](_0xd62e('0xb'),_0xb590b7,_0x3b2a03[_0xd62e('0xf')]['message']);return _0x54d69d(_0x3b2a03[_0xd62e('0xf')]['message']);}logger[_0xd62e('0xf')](_0xd62e('0xb'),_0xb590b7,_0x3b2a03['error']['message']);return _0x4f9b92(_0x3b2a03[_0xd62e('0xf')]['message']);}else{logger['info'](_0xd62e('0xb'),_0xb590b7,_0xd62e('0x11'));_0x4f9b92(_0x3b2a03[_0xd62e('0x12')][_0xd62e('0x13')]);}})['catch'](function(_0x4adec4){logger[_0xd62e('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xb590b7,_0x4adec4);_0x54d69d(_0x4adec4);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 934691c..e3a99ab 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 _0x90a4=['util','Router','../../config/environment','./pause.controller','get','isAuthenticated','show','post','/:id','delete','destroy','multer'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x90a4,0x77));var _0x490a=function(_0x120098,_0x287b95){_0x120098=_0x120098-0x0;var _0x6517a=_0x90a4[_0x120098];return _0x6517a;};'use strict';var multer=require(_0x490a('0x0'));var util=require(_0x490a('0x1'));var path=require('path');var express=require('express');var router=express[_0x490a('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x490a('0x3'));var controller=require(_0x490a('0x4'));router[_0x490a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x490a('0x5')]('/:id',auth[_0x490a('0x6')](),controller[_0x490a('0x7')]);router[_0x490a('0x8')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x490a('0x9'),auth[_0x490a('0x6')](),controller['update']);router[_0x490a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x490a('0xb')]);module['exports']=router; \ No newline at end of file +var _0xebe4=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','create','delete','exports','multer','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xebe4,0xb4));var _0x4ebe=function(_0x157200,_0x524da9){_0x157200=_0x157200-0x0;var _0x5e82f4=_0xebe4[_0x157200];return _0x5e82f4;};'use strict';var multer=require(_0x4ebe('0x0'));var util=require(_0x4ebe('0x1'));var path=require('path');var express=require(_0x4ebe('0x2'));var router=express[_0x4ebe('0x3')]();var auth=require(_0x4ebe('0x4'));var interaction=require(_0x4ebe('0x5'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x4ebe('0x6')]('/',auth['isAuthenticated'](),controller[_0x4ebe('0x7')]);router['get'](_0x4ebe('0x8'),auth[_0x4ebe('0x9')](),controller[_0x4ebe('0xa')]);router['post']('/',auth[_0x4ebe('0x9')](),controller[_0x4ebe('0xb')]);router['put'](_0x4ebe('0x8'),auth[_0x4ebe('0x9')](),controller['update']);router[_0x4ebe('0xc')](_0x4ebe('0x8'),auth[_0x4ebe('0x9')](),controller['destroy']);module[_0x4ebe('0xd')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 83ca555..e12e02f 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 _0x5548=['name','STRING','sequelize','exports'];(function(_0x4da7ca,_0x41433d){var _0x427306=function(_0x3963ed){while(--_0x3963ed){_0x4da7ca['push'](_0x4da7ca['shift']());}};_0x427306(++_0x41433d);}(_0x5548,0xb2));var _0x8554=function(_0x116379,_0x5262f7){_0x116379=_0x116379-0x0;var _0x285630=_0x5548[_0x116379];return _0x285630;};'use strict';var Sequelize=require(_0x8554('0x0'));module[_0x8554('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8554('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8554('0x3')]}}; \ No newline at end of file +var _0x5e56=['sequelize','STRING'];(function(_0x17562a,_0x303478){var _0x2518c5=function(_0x36bf06){while(--_0x36bf06){_0x17562a['push'](_0x17562a['shift']());}};_0x2518c5(++_0x303478);}(_0x5e56,0x1d2));var _0x65e5=function(_0x1479f1,_0x3fe214){_0x1479f1=_0x1479f1-0x0;var _0x45305d=_0x5e56[_0x1479f1];return _0x45305d;};'use strict';var Sequelize=require(_0x65e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x65e5('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x65e5('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d384f73..51e5239 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 _0x379e=['json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','add','day','merge','where','filter','map','options','count','includeAll','include','Pause','rows','show','length','find','create','body','catch','params','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x4a805,_0x227cb2){var _0x5b800d=function(_0x16dde0){while(--_0x16dde0){_0x4a805['push'](_0x4a805['shift']());}};_0x5b800d(++_0x227cb2);}(_0x379e,0x104));var _0xe379=function(_0x561fdb,_0x325100){_0x561fdb=_0x561fdb-0x0;var _0xd42a3e=_0x379e[_0x561fdb];return _0xd42a3e;};'use strict';var jsonpatch=require(_0xe379('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe379('0x1'));var util=require(_0xe379('0x2'));var path=require(_0xe379('0x3'));var sox=require(_0xe379('0x4'));var csv=require(_0xe379('0x5'));var ejs=require(_0xe379('0x6'));var fs=require('fs');var _=require(_0xe379('0x7'));var squel=require('squel');var crypto=require(_0xe379('0x8'));var jsforce=require(_0xe379('0x9'));var deskjs=require(_0xe379('0xa'));var toCsv=require(_0xe379('0x5'));var querystring=require(_0xe379('0xb'));var Papa=require('papaparse');var qs=require(_0xe379('0xc'));var logger=require(_0xe379('0xd'))(_0xe379('0xe'));var utils=require(_0xe379('0xf'));var config=require(_0xe379('0x10'));var db=require(_0xe379('0x11'))['db'];function respondWithStatusCode(_0x10c156,_0x8eb46c){_0x8eb46c=_0x8eb46c||0xcc;return function(_0x6c4f40){if(_0x6c4f40){return _0x10c156['sendStatus'](_0x8eb46c);}return _0x10c156[_0xe379('0x12')](_0x8eb46c)[_0xe379('0x13')]();};}function respondWithResult(_0x1ba1ef,_0x3c6971){_0x3c6971=_0x3c6971||0xc8;return function(_0x5a3e06){if(_0x5a3e06){return _0x1ba1ef['status'](_0x3c6971)[_0xe379('0x14')](_0x5a3e06);}};}function respondWithFilteredResult(_0x45cf1a,_0x128bce){return function(_0x2a1e96){if(_0x2a1e96){var _0x450f16=_0x2a1e96['count'],_0x1ee8e0=_0x128bce[_0xe379('0x15')],_0x2a5b60=_0x128bce[_0xe379('0x15')]+_0x128bce[_0xe379('0x16')],_0x70d82;if(_0x2a5b60>=_0x450f16){_0x2a5b60=_0x450f16;_0x70d82=0xc8;}else{_0x70d82=0xce;}_0x45cf1a[_0xe379('0x12')](_0x70d82);return _0x45cf1a[_0xe379('0x17')](_0xe379('0x18'),_0x1ee8e0+'-'+_0x2a5b60+'/'+_0x450f16)['json'](_0x2a1e96);}return null;};}function patchUpdates(_0x2615bd){return function(_0x5cb274){try{jsonpatch[_0xe379('0x19')](_0x5cb274,_0x2615bd,!![]);}catch(_0x56c11d){return BPromise[_0xe379('0x1a')](_0x56c11d);}return _0x5cb274[_0xe379('0x1b')]();};}function saveUpdates(_0xe4f3d1,_0x373f03){return function(_0x5e1882){if(_0x5e1882){return _0x5e1882[_0xe379('0x1c')](_0xe4f3d1)[_0xe379('0x1d')](function(_0x3df277){return _0x3df277;});}return null;};}function removeEntity(_0x2a86d9,_0x234e9){return function(_0x4c4417){if(_0x4c4417){return _0x4c4417[_0xe379('0x1e')]()[_0xe379('0x1d')](function(){_0x2a86d9['status'](0xcc)[_0xe379('0x13')]();});}};}function handleEntityNotFound(_0x1d5abf,_0x3de7de){return function(_0x2e946f){if(!_0x2e946f){_0x1d5abf[_0xe379('0x1f')](0x194);}return _0x2e946f;};}function handleError(_0x10b3c3,_0x59ceea){_0x59ceea=_0x59ceea||0x1f4;return function(_0x156f11){logger[_0xe379('0x20')](_0x156f11[_0xe379('0x21')]);if(_0x156f11['name']){delete _0x156f11[_0xe379('0x22')];}_0x10b3c3[_0xe379('0x12')](_0x59ceea)['send'](_0x156f11);};}exports[_0xe379('0x23')]=function(_0x28fa16,_0x4da256){var _0x544bf3={},_0x22f596={},_0x1ce0b9={'count':0x0,'rows':[]};var _0x26ba82=db['Pause'][_0xe379('0x24')];_0x22f596[_0xe379('0x25')]=_[_0xe379('0x26')](_0x26ba82);var _0x17debd={'dateStart':_0x28fa16['query'][_0xe379('0x27')],'dateEnd':_0x28fa16[_0xe379('0x28')][_0xe379('0x29')]};delete _0x28fa16['query'][_0xe379('0x27')];delete _0x28fa16[_0xe379('0x28')]['dateEnd'];_0x22f596[_0xe379('0x28')]=_['keys'](_0x28fa16[_0xe379('0x28')]);_0x22f596['filters']=_[_0xe379('0x2a')](_0x22f596[_0xe379('0x25')],_0x22f596[_0xe379('0x28')]);_0x544bf3[_0xe379('0x2b')]=_[_0xe379('0x2a')](_0x22f596[_0xe379('0x25')],qs[_0xe379('0x2c')](_0x28fa16['query'][_0xe379('0x2c')]));_0x544bf3[_0xe379('0x2b')]=_0x544bf3[_0xe379('0x2b')]['length']?_0x544bf3[_0xe379('0x2b')]:_0x22f596['model'];if(!_0x28fa16['query'][_0xe379('0x2d')](_0xe379('0x2e'))){_0x544bf3[_0xe379('0x16')]=qs[_0xe379('0x16')](_0x28fa16['query'][_0xe379('0x16')]);_0x544bf3[_0xe379('0x15')]=qs['offset'](_0x28fa16[_0xe379('0x28')][_0xe379('0x15')]);}_0x544bf3[_0xe379('0x2f')]=qs[_0xe379('0x30')](_0x28fa16['query'][_0xe379('0x30')]);_0x544bf3['where']=qs[_0xe379('0x31')](_[_0xe379('0x32')](_0x28fa16[_0xe379('0x28')],_0x22f596[_0xe379('0x31')]));if(_0x17debd[_0xe379('0x27')]){if(_0x17debd['dateEnd']){_0x17debd[_0xe379('0x29')]=moment(_0x17debd['dateEnd'])[_0xe379('0x33')](0x1,_0xe379('0x34'));}else{_0x17debd[_0xe379('0x29')]=moment(_0x17debd['dateStart'])[_0xe379('0x33')](0x1,_0xe379('0x34'));}_[_0xe379('0x35')](_0x544bf3[_0xe379('0x36')],{'createdAt':{'$gte':_0x17debd['dateStart'],'$lte':_0x17debd[_0xe379('0x29')]}});}if(_0x28fa16['query'][_0xe379('0x37')]){_0x544bf3[_0xe379('0x36')]=_[_0xe379('0x35')](_0x544bf3[_0xe379('0x36')],{'$or':_[_0xe379('0x38')](_0x544bf3[_0xe379('0x2b')],function(_0x56ebb7){var _0x17489b={};_0x17489b[_0x56ebb7]={'$like':'%'+_0x28fa16['query'][_0xe379('0x37')]+'%'};return _0x17489b;})});}_0x544bf3=_[_0xe379('0x35')]({},_0x544bf3,_0x28fa16[_0xe379('0x39')]);var _0x2e3eef={'where':_0x544bf3[_0xe379('0x36')]};return db['Pause'][_0xe379('0x3a')](_0x2e3eef)[_0xe379('0x1d')](function(_0x59ba54){_0x1ce0b9['count']=_0x59ba54;if(_0x28fa16['query'][_0xe379('0x3b')]){_0x544bf3[_0xe379('0x3c')]=[{'all':!![]}];}return db[_0xe379('0x3d')]['findAll'](_0x544bf3);})[_0xe379('0x1d')](function(_0x3089df){_0x1ce0b9[_0xe379('0x3e')]=_0x3089df;return _0x1ce0b9;})[_0xe379('0x1d')](respondWithFilteredResult(_0x4da256,_0x544bf3))['catch'](handleError(_0x4da256,null));};exports[_0xe379('0x3f')]=function(_0x36ce8e,_0x3c6f5d){var _0x32ecbe={'raw':!![],'where':{'id':_0x36ce8e['params']['id']}},_0x48f0cc={};_0x48f0cc[_0xe379('0x25')]=_[_0xe379('0x26')](db[_0xe379('0x3d')][_0xe379('0x24')]);_0x48f0cc[_0xe379('0x28')]=_[_0xe379('0x26')](_0x36ce8e['query']);_0x48f0cc[_0xe379('0x31')]=_['intersection'](_0x48f0cc[_0xe379('0x25')],_0x48f0cc[_0xe379('0x28')]);_0x32ecbe[_0xe379('0x2b')]=_[_0xe379('0x2a')](_0x48f0cc[_0xe379('0x25')],qs[_0xe379('0x2c')](_0x36ce8e[_0xe379('0x28')][_0xe379('0x2c')]));_0x32ecbe[_0xe379('0x2b')]=_0x32ecbe[_0xe379('0x2b')][_0xe379('0x40')]?_0x32ecbe[_0xe379('0x2b')]:_0x48f0cc[_0xe379('0x25')];if(_0x36ce8e[_0xe379('0x28')][_0xe379('0x3b')]){_0x32ecbe[_0xe379('0x3c')]=[{'all':!![]}];}_0x32ecbe=_[_0xe379('0x35')]({},_0x32ecbe,_0x36ce8e[_0xe379('0x39')]);return db[_0xe379('0x3d')][_0xe379('0x41')](_0x32ecbe)[_0xe379('0x1d')](handleEntityNotFound(_0x3c6f5d,null))[_0xe379('0x1d')](respondWithResult(_0x3c6f5d,null))['catch'](handleError(_0x3c6f5d,null));};exports[_0xe379('0x42')]=function(_0x266bfe,_0x42a378){return db[_0xe379('0x3d')][_0xe379('0x42')](_0x266bfe[_0xe379('0x43')],{})['then'](respondWithResult(_0x42a378,0xc9))['catch'](handleError(_0x42a378,null));};exports[_0xe379('0x1c')]=function(_0x5db39f,_0x55b27b){if(_0x5db39f[_0xe379('0x43')]['id']){delete _0x5db39f[_0xe379('0x43')]['id'];}return db[_0xe379('0x3d')][_0xe379('0x41')]({'where':{'id':_0x5db39f['params']['id']}})[_0xe379('0x1d')](handleEntityNotFound(_0x55b27b,null))[_0xe379('0x1d')](saveUpdates(_0x5db39f['body'],null))[_0xe379('0x1d')](respondWithResult(_0x55b27b,null))[_0xe379('0x44')](handleError(_0x55b27b,null));};exports['destroy']=function(_0x4ac3eb,_0x3af1be){return db[_0xe379('0x3d')]['find']({'where':{'id':_0x4ac3eb[_0xe379('0x45')]['id']}})[_0xe379('0x1d')](handleEntityNotFound(_0x3af1be,null))[_0xe379('0x1d')](removeEntity(_0x3af1be,null))[_0xe379('0x44')](handleError(_0x3af1be,null));}; \ No newline at end of file +var _0x6bac=['set','Content-Range','save','update','destroy','error','stack','name','send','rawAttributes','model','query','dateStart','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','Pause','then','includeAll','include','findAll','catch','params','keys','length','find','create','body','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','api','sendStatus','status','end','json','count','offset','limit'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6bac,0xa5));var _0xc6ba=function(_0x7e64ca,_0x4e4693){_0x7e64ca=_0x7e64ca-0x0;var _0x399dd2=_0x6bac[_0x7e64ca];return _0x399dd2;};'use strict';var jsonpatch=require(_0xc6ba('0x0'));var rp=require('request-promise');var moment=require(_0xc6ba('0x1'));var BPromise=require(_0xc6ba('0x2'));var Mustache=require(_0xc6ba('0x3'));var util=require(_0xc6ba('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc6ba('0x5'));var fs=require('fs');var _=require(_0xc6ba('0x6'));var squel=require('squel');var crypto=require(_0xc6ba('0x7'));var jsforce=require(_0xc6ba('0x8'));var deskjs=require(_0xc6ba('0x9'));var toCsv=require(_0xc6ba('0xa'));var querystring=require(_0xc6ba('0xb'));var Papa=require(_0xc6ba('0xc'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc6ba('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530397,_0x58adfc){_0x58adfc=_0x58adfc||0xcc;return function(_0x45d797){if(_0x45d797){return _0x530397[_0xc6ba('0xe')](_0x58adfc);}return _0x530397[_0xc6ba('0xf')](_0x58adfc)[_0xc6ba('0x10')]();};}function respondWithResult(_0x2e01ee,_0x526b8d){_0x526b8d=_0x526b8d||0xc8;return function(_0x5b8f57){if(_0x5b8f57){return _0x2e01ee[_0xc6ba('0xf')](_0x526b8d)[_0xc6ba('0x11')](_0x5b8f57);}};}function respondWithFilteredResult(_0x31def2,_0x27b00a){return function(_0x2c866f){if(_0x2c866f){var _0x4e022a=_0x2c866f[_0xc6ba('0x12')],_0x498aa1=_0x27b00a[_0xc6ba('0x13')],_0x595561=_0x27b00a[_0xc6ba('0x13')]+_0x27b00a[_0xc6ba('0x14')],_0x2f6e76;if(_0x595561>=_0x4e022a){_0x595561=_0x4e022a;_0x2f6e76=0xc8;}else{_0x2f6e76=0xce;}_0x31def2[_0xc6ba('0xf')](_0x2f6e76);return _0x31def2[_0xc6ba('0x15')](_0xc6ba('0x16'),_0x498aa1+'-'+_0x595561+'/'+_0x4e022a)['json'](_0x2c866f);}return null;};}function patchUpdates(_0x52c811){return function(_0x55af62){try{jsonpatch['apply'](_0x55af62,_0x52c811,!![]);}catch(_0x5bcead){return BPromise['reject'](_0x5bcead);}return _0x55af62[_0xc6ba('0x17')]();};}function saveUpdates(_0x15a135,_0x58f4c3){return function(_0x485086){if(_0x485086){return _0x485086[_0xc6ba('0x18')](_0x15a135)['then'](function(_0x125655){return _0x125655;});}return null;};}function removeEntity(_0x2b2a0f,_0x560c40){return function(_0x3936e2){if(_0x3936e2){return _0x3936e2[_0xc6ba('0x19')]()['then'](function(){_0x2b2a0f[_0xc6ba('0xf')](0xcc)[_0xc6ba('0x10')]();});}};}function handleEntityNotFound(_0x174d04,_0x38aa22){return function(_0x28f8ba){if(!_0x28f8ba){_0x174d04[_0xc6ba('0xe')](0x194);}return _0x28f8ba;};}function handleError(_0xc2de63,_0x6aefbe){_0x6aefbe=_0x6aefbe||0x1f4;return function(_0x2d52ea){logger[_0xc6ba('0x1a')](_0x2d52ea[_0xc6ba('0x1b')]);if(_0x2d52ea[_0xc6ba('0x1c')]){delete _0x2d52ea[_0xc6ba('0x1c')];}_0xc2de63[_0xc6ba('0xf')](_0x6aefbe)[_0xc6ba('0x1d')](_0x2d52ea);};}exports['index']=function(_0x19a9ad,_0x29a175){var _0x2946f0={},_0xcfb503={},_0x442b94={'count':0x0,'rows':[]};var _0x3b5ed7=db['Pause'][_0xc6ba('0x1e')];_0xcfb503[_0xc6ba('0x1f')]=_['keys'](_0x3b5ed7);var _0x1f2d1a={'dateStart':_0x19a9ad[_0xc6ba('0x20')]['dateStart'],'dateEnd':_0x19a9ad[_0xc6ba('0x20')]['dateEnd']};delete _0x19a9ad[_0xc6ba('0x20')][_0xc6ba('0x21')];delete _0x19a9ad[_0xc6ba('0x20')][_0xc6ba('0x22')];_0xcfb503['query']=_['keys'](_0x19a9ad[_0xc6ba('0x20')]);_0xcfb503['filters']=_[_0xc6ba('0x23')](_0xcfb503['model'],_0xcfb503[_0xc6ba('0x20')]);_0x2946f0[_0xc6ba('0x24')]=_['intersection'](_0xcfb503[_0xc6ba('0x1f')],qs[_0xc6ba('0x25')](_0x19a9ad[_0xc6ba('0x20')][_0xc6ba('0x25')]));_0x2946f0[_0xc6ba('0x24')]=_0x2946f0[_0xc6ba('0x24')]['length']?_0x2946f0[_0xc6ba('0x24')]:_0xcfb503[_0xc6ba('0x1f')];if(!_0x19a9ad['query'][_0xc6ba('0x26')](_0xc6ba('0x27'))){_0x2946f0['limit']=qs[_0xc6ba('0x14')](_0x19a9ad[_0xc6ba('0x20')]['limit']);_0x2946f0[_0xc6ba('0x13')]=qs[_0xc6ba('0x13')](_0x19a9ad[_0xc6ba('0x20')][_0xc6ba('0x13')]);}_0x2946f0[_0xc6ba('0x28')]=qs[_0xc6ba('0x29')](_0x19a9ad['query'][_0xc6ba('0x29')]);_0x2946f0[_0xc6ba('0x2a')]=qs[_0xc6ba('0x2b')](_[_0xc6ba('0x2c')](_0x19a9ad[_0xc6ba('0x20')],_0xcfb503[_0xc6ba('0x2b')]));if(_0x1f2d1a[_0xc6ba('0x21')]){if(_0x1f2d1a[_0xc6ba('0x22')]){_0x1f2d1a[_0xc6ba('0x22')]=moment(_0x1f2d1a[_0xc6ba('0x22')])[_0xc6ba('0x2d')](0x1,_0xc6ba('0x2e'));}else{_0x1f2d1a[_0xc6ba('0x22')]=moment(_0x1f2d1a[_0xc6ba('0x21')])['add'](0x1,_0xc6ba('0x2e'));}_[_0xc6ba('0x2f')](_0x2946f0[_0xc6ba('0x2a')],{'createdAt':{'$gte':_0x1f2d1a['dateStart'],'$lte':_0x1f2d1a[_0xc6ba('0x22')]}});}if(_0x19a9ad['query'][_0xc6ba('0x30')]){_0x2946f0['where']=_[_0xc6ba('0x2f')](_0x2946f0['where'],{'$or':_[_0xc6ba('0x31')](_0x2946f0['attributes'],function(_0x4d92cf){var _0x3892f5={};_0x3892f5[_0x4d92cf]={'$like':'%'+_0x19a9ad[_0xc6ba('0x20')][_0xc6ba('0x30')]+'%'};return _0x3892f5;})});}_0x2946f0=_[_0xc6ba('0x2f')]({},_0x2946f0,_0x19a9ad['options']);var _0x2f8c39={'where':_0x2946f0[_0xc6ba('0x2a')]};return db[_0xc6ba('0x32')][_0xc6ba('0x12')](_0x2f8c39)[_0xc6ba('0x33')](function(_0x3273f4){_0x442b94[_0xc6ba('0x12')]=_0x3273f4;if(_0x19a9ad['query'][_0xc6ba('0x34')]){_0x2946f0[_0xc6ba('0x35')]=[{'all':!![]}];}return db[_0xc6ba('0x32')][_0xc6ba('0x36')](_0x2946f0);})[_0xc6ba('0x33')](function(_0x4985f8){_0x442b94['rows']=_0x4985f8;return _0x442b94;})[_0xc6ba('0x33')](respondWithFilteredResult(_0x29a175,_0x2946f0))[_0xc6ba('0x37')](handleError(_0x29a175,null));};exports['show']=function(_0x2d3d5a,_0x23e2d1){var _0x35f1fc={'raw':!![],'where':{'id':_0x2d3d5a[_0xc6ba('0x38')]['id']}},_0x279d89={};_0x279d89[_0xc6ba('0x1f')]=_['keys'](db['Pause'][_0xc6ba('0x1e')]);_0x279d89[_0xc6ba('0x20')]=_[_0xc6ba('0x39')](_0x2d3d5a['query']);_0x279d89['filters']=_[_0xc6ba('0x23')](_0x279d89[_0xc6ba('0x1f')],_0x279d89[_0xc6ba('0x20')]);_0x35f1fc[_0xc6ba('0x24')]=_[_0xc6ba('0x23')](_0x279d89['model'],qs[_0xc6ba('0x25')](_0x2d3d5a[_0xc6ba('0x20')][_0xc6ba('0x25')]));_0x35f1fc[_0xc6ba('0x24')]=_0x35f1fc[_0xc6ba('0x24')][_0xc6ba('0x3a')]?_0x35f1fc[_0xc6ba('0x24')]:_0x279d89[_0xc6ba('0x1f')];if(_0x2d3d5a['query'][_0xc6ba('0x34')]){_0x35f1fc[_0xc6ba('0x35')]=[{'all':!![]}];}_0x35f1fc=_[_0xc6ba('0x2f')]({},_0x35f1fc,_0x2d3d5a['options']);return db[_0xc6ba('0x32')][_0xc6ba('0x3b')](_0x35f1fc)[_0xc6ba('0x33')](handleEntityNotFound(_0x23e2d1,null))['then'](respondWithResult(_0x23e2d1,null))['catch'](handleError(_0x23e2d1,null));};exports[_0xc6ba('0x3c')]=function(_0xe4747e,_0x56add1){return db[_0xc6ba('0x32')][_0xc6ba('0x3c')](_0xe4747e[_0xc6ba('0x3d')],{})[_0xc6ba('0x33')](respondWithResult(_0x56add1,0xc9))[_0xc6ba('0x37')](handleError(_0x56add1,null));};exports[_0xc6ba('0x18')]=function(_0x36e159,_0x283dac){if(_0x36e159['body']['id']){delete _0x36e159[_0xc6ba('0x3d')]['id'];}return db['Pause'][_0xc6ba('0x3b')]({'where':{'id':_0x36e159[_0xc6ba('0x38')]['id']}})[_0xc6ba('0x33')](handleEntityNotFound(_0x283dac,null))[_0xc6ba('0x33')](saveUpdates(_0x36e159[_0xc6ba('0x3d')],null))['then'](respondWithResult(_0x283dac,null))['catch'](handleError(_0x283dac,null));};exports['destroy']=function(_0x47a4ee,_0x2c71f7){return db['Pause'][_0xc6ba('0x3b')]({'where':{'id':_0x47a4ee[_0xc6ba('0x38')]['id']}})[_0xc6ba('0x33')](handleEntityNotFound(_0x2c71f7,null))[_0xc6ba('0x33')](removeEntity(_0x2c71f7,null))['catch'](handleError(_0x2c71f7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f9d468f..06792da 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 _0x837f=['define','Pause','lodash','util','../../config/logger','api','./pause.attributes'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x837f,0x1c9));var _0xf837=function(_0x528574,_0x374f9a){_0x528574=_0x528574-0x0;var _0x4ceefc=_0x837f[_0x528574];return _0x4ceefc;};'use strict';var _=require(_0xf837('0x0'));var util=require(_0xf837('0x1'));var logger=require(_0xf837('0x2'))(_0xf837('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xf837('0x4'));module['exports']=function(_0x40eca8,_0x2f1f25){return _0x40eca8[_0xf837('0x5')](_0xf837('0x6'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf764=['moment','request-promise','./pause.attributes','define','util','../../config/logger','api'];(function(_0x27ee0a,_0x11a527){var _0x7377aa=function(_0x42fa50){while(--_0x42fa50){_0x27ee0a['push'](_0x27ee0a['shift']());}};_0x7377aa(++_0x11a527);}(_0xf764,0x14d));var _0x4f76=function(_0x102ff2,_0x1b638d){_0x102ff2=_0x102ff2-0x0;var _0x18584b=_0xf764[_0x102ff2];return _0x18584b;};'use strict';var _=require('lodash');var util=require(_0x4f76('0x0'));var logger=require(_0x4f76('0x1'))(_0x4f76('0x2'));var moment=require(_0x4f76('0x3'));var BPromise=require('bluebird');var rp=require(_0x4f76('0x4'));var attributes=require(_0x4f76('0x5'));module['exports']=function(_0x4f8933,_0x49797c){return _0x4f8933[_0x4f76('0x6')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 85ef558..3c23a46 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 _0xde75=['include','model','map','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes'];(function(_0x337dd7,_0x2b4f7c){var _0x539e7d=function(_0x2d1ce4){while(--_0x2d1ce4){_0x337dd7['push'](_0x337dd7['shift']());}};_0x539e7d(++_0x2b4f7c);}(_0xde75,0x17d));var _0x5de7=function(_0x2fae21,_0x166c57){_0x2fae21=_0x2fae21-0x0;var _0x58bcb9=_0xde75[_0x2fae21];return _0x58bcb9;};'use strict';var _=require(_0x5de7('0x0'));var util=require(_0x5de7('0x1'));var moment=require(_0x5de7('0x2'));var BPromise=require('bluebird');var rs=require(_0x5de7('0x3'));var fs=require('fs');var db=require(_0x5de7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5de7('0x5'));var config=require('../../config/environment');var jayson=require(_0x5de7('0x6'));var client=jayson[_0x5de7('0x7')][_0x5de7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2919c7,_0x575882,_0x538efb){return new BPromise(function(_0x5c5a1c,_0xdb8117){return client['request'](_0x2919c7,_0x538efb)[_0x5de7('0x9')](function(_0x2ac49b){logger[_0x5de7('0xa')](_0x5de7('0xb'),_0x575882,_0x5de7('0xc'));logger[_0x5de7('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x575882,_0x5de7('0xc'),JSON[_0x5de7('0xe')](_0x2ac49b));if(_0x2ac49b[_0x5de7('0xf')]){if(_0x2ac49b[_0x5de7('0xf')]['code']===0x1f4){logger['error'](_0x5de7('0xb'),_0x575882,_0x2ac49b[_0x5de7('0xf')][_0x5de7('0x10')]);return _0xdb8117(_0x2ac49b['error'][_0x5de7('0x10')]);}logger[_0x5de7('0xf')]('Pause,\x20%s,\x20%s',_0x575882,_0x2ac49b[_0x5de7('0xf')][_0x5de7('0x10')]);return _0x5c5a1c(_0x2ac49b[_0x5de7('0xf')][_0x5de7('0x10')]);}else{logger['info'](_0x5de7('0xb'),_0x575882,_0x5de7('0xc'));_0x5c5a1c(_0x2ac49b[_0x5de7('0x11')]['message']);}})['catch'](function(_0x444066){logger[_0x5de7('0xf')](_0x5de7('0xb'),_0x575882,_0x444066);_0xdb8117(_0x444066);});});}exports[_0x5de7('0x12')]=function(_0x4ade45){var _0xc5f286=this;return new Promise(function(_0x17c64e,_0x3388a4){return db[_0x5de7('0x13')][_0x5de7('0x14')]({'raw':_0x4ade45[_0x5de7('0x15')]?_0x4ade45[_0x5de7('0x15')][_0x5de7('0x16')]===undefined?!![]:![]:!![],'where':_0x4ade45['options']?_0x4ade45[_0x5de7('0x15')][_0x5de7('0x17')]||null:null,'attributes':_0x4ade45[_0x5de7('0x15')]?_0x4ade45['options'][_0x5de7('0x18')]||null:null,'include':_0x4ade45[_0x5de7('0x15')]?_0x4ade45[_0x5de7('0x15')][_0x5de7('0x19')]?_['map'](_0x4ade45[_0x5de7('0x15')][_0x5de7('0x19')],function(_0x39e727){return{'model':db[_0x39e727[_0x5de7('0x1a')]],'as':_0x39e727['as'],'attributes':_0x39e727[_0x5de7('0x18')],'include':_0x39e727[_0x5de7('0x19')]?_['map'](_0x39e727[_0x5de7('0x19')],function(_0x3d5295){return{'model':db[_0x3d5295[_0x5de7('0x1a')]],'as':_0x3d5295['as'],'attributes':_0x3d5295[_0x5de7('0x18')],'include':_0x3d5295['include']?_[_0x5de7('0x1b')](_0x3d5295[_0x5de7('0x19')],function(_0x166dbb){return{'model':db[_0x166dbb['model']],'as':_0x166dbb['as'],'attributes':_0x166dbb[_0x5de7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5de7('0x9')](function(_0x1d2400){logger[_0x5de7('0xa')](_0x5de7('0x12'),_0x4ade45);logger[_0x5de7('0xd')](_0x5de7('0x12'),_0x4ade45,JSON[_0x5de7('0xe')](_0x1d2400));_0x17c64e(_0x1d2400);})[_0x5de7('0x1c')](function(_0x43e3bf){logger[_0x5de7('0xf')](_0x5de7('0x12'),_0x43e3bf[_0x5de7('0x10')],_0x4ade45);_0x3388a4(_0xc5f286[_0x5de7('0xf')](0x1f4,_0x43e3bf[_0x5de7('0x10')]));});});}; \ No newline at end of file +var _0xf746=['code','error','message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','debug','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0xf746,0x88));var _0x6f74=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xf746[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var util=require(_0x6f74('0x0'));var moment=require('moment');var BPromise=require(_0x6f74('0x1'));var rs=require(_0x6f74('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x6f74('0x3'));var logger=require(_0x6f74('0x4'))('rpc');var config=require(_0x6f74('0x5'));var jayson=require(_0x6f74('0x6'));var client=jayson[_0x6f74('0x7')][_0x6f74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x189d85,_0x451dc1,_0xc527bf){return new BPromise(function(_0x5db56f,_0xb2d78a){return client['request'](_0x189d85,_0xc527bf)[_0x6f74('0x9')](function(_0x31b036){logger[_0x6f74('0xa')](_0x6f74('0xb'),_0x451dc1,_0x6f74('0xc'));logger['debug']('Pause,\x20%s,\x20%s,\x20%s',_0x451dc1,_0x6f74('0xc'),JSON[_0x6f74('0xd')](_0x31b036));if(_0x31b036['error']){if(_0x31b036['error'][_0x6f74('0xe')]===0x1f4){logger['error']('Pause,\x20%s,\x20%s',_0x451dc1,_0x31b036[_0x6f74('0xf')][_0x6f74('0x10')]);return _0xb2d78a(_0x31b036[_0x6f74('0xf')][_0x6f74('0x10')]);}logger[_0x6f74('0xf')](_0x6f74('0xb'),_0x451dc1,_0x31b036['error'][_0x6f74('0x10')]);return _0x5db56f(_0x31b036[_0x6f74('0xf')][_0x6f74('0x10')]);}else{logger[_0x6f74('0xa')]('Pause,\x20%s,\x20%s',_0x451dc1,_0x6f74('0xc'));_0x5db56f(_0x31b036[_0x6f74('0x11')][_0x6f74('0x10')]);}})[_0x6f74('0x12')](function(_0x3654b8){logger[_0x6f74('0xf')](_0x6f74('0xb'),_0x451dc1,_0x3654b8);_0xb2d78a(_0x3654b8);});});}exports[_0x6f74('0x13')]=function(_0x4764be){var _0x3aa168=this;return new Promise(function(_0x392c8a,_0x5d8af6){return db[_0x6f74('0x14')][_0x6f74('0x15')]({'raw':_0x4764be[_0x6f74('0x16')]?_0x4764be['options'][_0x6f74('0x17')]===undefined?!![]:![]:!![],'where':_0x4764be[_0x6f74('0x16')]?_0x4764be[_0x6f74('0x16')][_0x6f74('0x18')]||null:null,'attributes':_0x4764be['options']?_0x4764be[_0x6f74('0x16')][_0x6f74('0x19')]||null:null,'include':_0x4764be['options']?_0x4764be[_0x6f74('0x16')][_0x6f74('0x1a')]?_[_0x6f74('0x1b')](_0x4764be[_0x6f74('0x16')][_0x6f74('0x1a')],function(_0x37631c){return{'model':db[_0x37631c[_0x6f74('0x1c')]],'as':_0x37631c['as'],'attributes':_0x37631c['attributes'],'include':_0x37631c['include']?_['map'](_0x37631c[_0x6f74('0x1a')],function(_0x58b88e){return{'model':db[_0x58b88e[_0x6f74('0x1c')]],'as':_0x58b88e['as'],'attributes':_0x58b88e[_0x6f74('0x19')],'include':_0x58b88e[_0x6f74('0x1a')]?_[_0x6f74('0x1b')](_0x58b88e['include'],function(_0x5a9c9c){return{'model':db[_0x5a9c9c[_0x6f74('0x1c')]],'as':_0x5a9c9c['as'],'attributes':_0x5a9c9c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f74('0x9')](function(_0x483afd){logger[_0x6f74('0xa')](_0x6f74('0x13'),_0x4764be);logger[_0x6f74('0x1d')](_0x6f74('0x13'),_0x4764be,JSON[_0x6f74('0xd')](_0x483afd));_0x392c8a(_0x483afd);})[_0x6f74('0x12')](function(_0xe0b96){logger[_0x6f74('0xf')](_0x6f74('0x13'),_0xe0b96['message'],_0x4764be);_0x5d8af6(_0x3aa168[_0x6f74('0xf')](0x1f4,_0xe0b96[_0x6f74('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index f397763..b838f05 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 _0x205e=['./plugin.controller','get','index','/webhook','/:id','/:id/download','isAuthenticated','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','multer','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x5a5dc6,_0x1ad6dd){var _0x4c47b9=function(_0x550e62){while(--_0x550e62){_0x5a5dc6['push'](_0x5a5dc6['shift']());}};_0x4c47b9(++_0x1ad6dd);}(_0x205e,0xc0));var _0xe205=function(_0x504d07,_0x13247f){_0x504d07=_0x504d07-0x0;var _0x2d3beb=_0x205e[_0x504d07];return _0x2d3beb;};'use strict';var multer=require(_0xe205('0x0'));var util=require(_0xe205('0x1'));var path=require('path');var express=require(_0xe205('0x2'));var router=express[_0xe205('0x3')]();var auth=require(_0xe205('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe205('0x5'));var controller=require(_0xe205('0x6'));router[_0xe205('0x7')]('/',auth['isAuthenticated'](),controller[_0xe205('0x8')]);router[_0xe205('0x7')](_0xe205('0x9'),controller['webhookGet']);router[_0xe205('0x7')](_0xe205('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xe205('0x7')](_0xe205('0xb'),auth[_0xe205('0xc')](),controller[_0xe205('0xd')]);var upload=multer({'storage':multer[_0xe205('0xe')]({'destination':function(_0x46a604,_0x23884e,_0x1f1b64){_0x1f1b64(null,path[_0xe205('0xf')](config[_0xe205('0x10')],_0xe205('0x11')));},'filename':function(_0x605c8a,_0x2ac5f8,_0x1fdbe2){_0x2ac5f8[_0xe205('0x12')]=_0x2ac5f8[_0xe205('0x12')][_0xe205('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1fdbe2(null,util[_0xe205('0x14')](_0xe205('0x15'),path[_0xe205('0x16')](_0x2ac5f8['originalname'],path[_0xe205('0x17')](_0x2ac5f8[_0xe205('0x12')])),Date[_0xe205('0x18')](),path[_0xe205('0x17')](_0x2ac5f8[_0xe205('0x12')])));}})});router['post']('/',upload[_0xe205('0x19')](_0xe205('0x1a')),controller[_0xe205('0x1b')]);router[_0xe205('0x1c')](_0xe205('0x9'),controller[_0xe205('0x1d')]);router[_0xe205('0x1e')](_0xe205('0xa'),auth[_0xe205('0xc')](),controller[_0xe205('0x1f')]);router[_0xe205('0x20')](_0xe205('0xa'),auth[_0xe205('0xc')](),controller[_0xe205('0x20')]);module['exports']=router; \ No newline at end of file +var _0xec5a=['/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0xec5a,0xc1));var _0xaec5=function(_0xaf9a79,_0x570377){_0xaf9a79=_0xaf9a79-0x0;var _0x1f62cf=_0xec5a[_0xaf9a79];return _0x1f62cf;};'use strict';var multer=require(_0xaec5('0x0'));var util=require(_0xaec5('0x1'));var path=require(_0xaec5('0x2'));var express=require('express');var router=express[_0xaec5('0x3')]();var auth=require(_0xaec5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaec5('0x5'));var controller=require(_0xaec5('0x6'));router[_0xaec5('0x7')]('/',auth[_0xaec5('0x8')](),controller['index']);router[_0xaec5('0x7')](_0xaec5('0x9'),controller[_0xaec5('0xa')]);router[_0xaec5('0x7')](_0xaec5('0xb'),auth[_0xaec5('0x8')](),controller[_0xaec5('0xc')]);router['get'](_0xaec5('0xd'),auth[_0xaec5('0x8')](),controller['download']);var upload=multer({'storage':multer[_0xaec5('0xe')]({'destination':function(_0x233dd5,_0x16a8a1,_0x56a0fe){_0x56a0fe(null,path[_0xaec5('0xf')](config[_0xaec5('0x10')],_0xaec5('0x11')));},'filename':function(_0x5ad256,_0xc235d8,_0x2a700b){_0xc235d8['originalname']=_0xc235d8[_0xaec5('0x12')][_0xaec5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2a700b(null,util[_0xaec5('0x14')](_0xaec5('0x15'),path[_0xaec5('0x16')](_0xc235d8[_0xaec5('0x12')],path[_0xaec5('0x17')](_0xc235d8['originalname'])),Date[_0xaec5('0x18')](),path[_0xaec5('0x17')](_0xc235d8[_0xaec5('0x12')])));}})});router[_0xaec5('0x19')]('/',upload[_0xaec5('0x1a')](_0xaec5('0x1b')),controller[_0xaec5('0x1c')]);router[_0xaec5('0x19')](_0xaec5('0x9'),controller[_0xaec5('0x1d')]);router[_0xaec5('0x1e')](_0xaec5('0xb'),auth[_0xaec5('0x8')](),controller[_0xaec5('0x1f')]);router[_0xaec5('0x20')](_0xaec5('0xb'),auth['isAuthenticated'](),controller['delete']);module[_0xaec5('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 933b5bd..53da33f 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 _0x70c8=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','never'];(function(_0x5b674c,_0xc560b){var _0x3da567=function(_0x495f29){while(--_0x495f29){_0x5b674c['push'](_0x5b674c['shift']());}};_0x3da567(++_0xc560b);}(_0x70c8,0xa9));var _0x870c=function(_0x25fa49,_0x386719){_0x25fa49=_0x25fa49-0x0;var _0x2cfdd6=_0x70c8[_0x25fa49];return _0x2cfdd6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x870c('0x0')]},'type':{'type':Sequelize['ENUM'](_0x870c('0x1'),_0x870c('0x2'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x870c('0x3')},'active':{'type':Sequelize[_0x870c('0x4')],'defaultValue':0x0,'comment':_0x870c('0x5')},'sidebar':{'type':Sequelize[_0x870c('0x6')](_0x870c('0x7'),_0x870c('0x8'),_0x870c('0x9'),_0x870c('0xa')),'defaultValue':_0x870c('0x9'),'comment':_0x870c('0xb')},'icon':{'type':Sequelize[_0x870c('0x0')]},'adminUrl':{'type':Sequelize[_0x870c('0x0')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x870c('0x0')]},'scriptPath':{'type':Sequelize[_0x870c('0x0')]}}; \ No newline at end of file +var _0xbe1c=['STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports'];(function(_0x59c0e5,_0x2099e5){var _0x4d6f8b=function(_0x24a1fc){while(--_0x24a1fc){_0x59c0e5['push'](_0x59c0e5['shift']());}};_0x4d6f8b(++_0x2099e5);}(_0xbe1c,0xbf));var _0xcbe1=function(_0x43fce7,_0xc8e0c1){_0x43fce7=_0x43fce7-0x0;var _0x1b8fc9=_0xbe1c[_0x43fce7];return _0x1b8fc9;};'use strict';var Sequelize=require('sequelize');module[_0xcbe1('0x0')]={'name':{'type':Sequelize[_0xcbe1('0x1')]},'type':{'type':Sequelize[_0xcbe1('0x2')](_0xcbe1('0x3'),'script')},'description':{'type':Sequelize[_0xcbe1('0x4')]},'version':{'type':Sequelize[_0xcbe1('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xcbe1('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xcbe1('0x6')},'sidebar':{'type':Sequelize[_0xcbe1('0x2')](_0xcbe1('0x7'),_0xcbe1('0x8'),_0xcbe1('0x9'),_0xcbe1('0xa')),'defaultValue':'always','comment':_0xcbe1('0xb')},'icon':{'type':Sequelize[_0xcbe1('0x1')]},'adminUrl':{'type':Sequelize[_0xcbe1('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xcbe1('0x1')]},'scriptPath':{'type':Sequelize[_0xcbe1('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d8ba9b1..e1f541d 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 _0x7b01=['upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','body','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','set','endsWith','statusCode','webhookPost','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','localhost','register','sendStatus','status','end','json','count','offset','limit','save','then','error','stack','name','index','model','dateStart','dateEnd','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','filter','map','options','Plugin','includeAll','include','rows','catch','show','rawAttributes','filters','length','download','find','params','root','server/files/plugins','format','basename','zip','warning','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','info'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7b01,0xdc));var _0x17b0=function(_0x262ea4,_0x246a04){_0x262ea4=_0x262ea4-0x0;var _0x121fe4=_0x7b01[_0x262ea4];return _0x121fe4;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x17b0('0x0'));var moment=require('moment');var BPromise=require(_0x17b0('0x1'));var Mustache=require(_0x17b0('0x2'));var util=require(_0x17b0('0x3'));var path=require(_0x17b0('0x4'));var sox=require(_0x17b0('0x5'));var csv=require(_0x17b0('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x17b0('0x7'));var squel=require(_0x17b0('0x8'));var crypto=require(_0x17b0('0x9'));var jsforce=require(_0x17b0('0xa'));var deskjs=require(_0x17b0('0xb'));var toCsv=require(_0x17b0('0x6'));var querystring=require(_0x17b0('0xc'));var Papa=require(_0x17b0('0xd'));var extract=require(_0x17b0('0xe'));var rimraf=require('rimraf');var archiver=require('archiver');var qs=require(_0x17b0('0xf'));var logger=require(_0x17b0('0x10'))(_0x17b0('0x11'));var utils=require(_0x17b0('0x12'));var config=require('../../config/environment');var db=require(_0x17b0('0x13'))['db'];var socket=require('socket.io-emitter')({'host':_0x17b0('0x14'),'port':0x18eb});require('./plugin.socket')[_0x17b0('0x15')](socket);function respondWithStatusCode(_0x4b4153,_0x464224){_0x464224=_0x464224||0xcc;return function(_0x25bd2f){if(_0x25bd2f){return _0x4b4153[_0x17b0('0x16')](_0x464224);}return _0x4b4153[_0x17b0('0x17')](_0x464224)[_0x17b0('0x18')]();};}function respondWithResult(_0x4dcaae,_0x5a8ab9){_0x5a8ab9=_0x5a8ab9||0xc8;return function(_0x566293){if(_0x566293){return _0x4dcaae['status'](_0x5a8ab9)[_0x17b0('0x19')](_0x566293);}};}function respondWithFilteredResult(_0x4c9836,_0x48e4df){return function(_0x56f4a4){if(_0x56f4a4){var _0x279c7f=_0x56f4a4[_0x17b0('0x1a')],_0x5791f6=_0x48e4df[_0x17b0('0x1b')],_0x2fe018=_0x48e4df['offset']+_0x48e4df[_0x17b0('0x1c')],_0x1c2dd7;if(_0x2fe018>=_0x279c7f){_0x2fe018=_0x279c7f;_0x1c2dd7=0xc8;}else{_0x1c2dd7=0xce;}_0x4c9836[_0x17b0('0x17')](_0x1c2dd7);return _0x4c9836['set']('Content-Range',_0x5791f6+'-'+_0x2fe018+'/'+_0x279c7f)['json'](_0x56f4a4);}return null;};}function patchUpdates(_0x561512){return function(_0x1e3fd8){try{jsonpatch['apply'](_0x1e3fd8,_0x561512,!![]);}catch(_0x2d348e){return BPromise['reject'](_0x2d348e);}return _0x1e3fd8[_0x17b0('0x1d')]();};}function saveUpdates(_0x258676,_0x25e5e6){return function(_0x516206){if(_0x516206){return _0x516206['update'](_0x258676)[_0x17b0('0x1e')](function(_0x155df1){return _0x155df1;});}return null;};}function removeEntity(_0x86ba5,_0xbee555){return function(_0x3f4f76){if(_0x3f4f76){return _0x3f4f76['destroy']()[_0x17b0('0x1e')](function(){_0x86ba5[_0x17b0('0x17')](0xcc)[_0x17b0('0x18')]();});}};}function handleEntityNotFound(_0xba24f6,_0x58190c){return function(_0x3597da){if(!_0x3597da){_0xba24f6['sendStatus'](0x194);}return _0x3597da;};}function handleError(_0x38daf4,_0x18b862){_0x18b862=_0x18b862||0x1f4;return function(_0x126032){logger[_0x17b0('0x1f')](_0x126032[_0x17b0('0x20')]);if(_0x126032[_0x17b0('0x21')]){delete _0x126032['name'];}_0x38daf4[_0x17b0('0x17')](_0x18b862)['send'](_0x126032);};}exports[_0x17b0('0x22')]=function(_0x5ae6a4,_0x25e7d3){var _0x50d751={},_0xcc5704={},_0x48337c={'count':0x0,'rows':[]};var _0x5875d7=db['Plugin']['rawAttributes'];_0xcc5704[_0x17b0('0x23')]=_['keys'](_0x5875d7);var _0x1a68c1={'dateStart':_0x5ae6a4['query'][_0x17b0('0x24')],'dateEnd':_0x5ae6a4['query'][_0x17b0('0x25')]};delete _0x5ae6a4[_0x17b0('0x26')]['dateStart'];delete _0x5ae6a4['query'][_0x17b0('0x25')];_0xcc5704[_0x17b0('0x26')]=_[_0x17b0('0x27')](_0x5ae6a4['query']);_0xcc5704['filters']=_[_0x17b0('0x28')](_0xcc5704[_0x17b0('0x23')],_0xcc5704['query']);_0x50d751[_0x17b0('0x29')]=_[_0x17b0('0x28')](_0xcc5704[_0x17b0('0x23')],qs[_0x17b0('0x2a')](_0x5ae6a4['query'][_0x17b0('0x2a')]));_0x50d751[_0x17b0('0x29')]=_0x50d751[_0x17b0('0x29')]['length']?_0x50d751[_0x17b0('0x29')]:_0xcc5704[_0x17b0('0x23')];if(!_0x5ae6a4[_0x17b0('0x26')][_0x17b0('0x2b')](_0x17b0('0x2c'))){_0x50d751[_0x17b0('0x1c')]=qs[_0x17b0('0x1c')](_0x5ae6a4[_0x17b0('0x26')][_0x17b0('0x1c')]);_0x50d751['offset']=qs[_0x17b0('0x1b')](_0x5ae6a4[_0x17b0('0x26')][_0x17b0('0x1b')]);}_0x50d751[_0x17b0('0x2d')]=qs[_0x17b0('0x2e')](_0x5ae6a4['query'][_0x17b0('0x2e')]);_0x50d751[_0x17b0('0x2f')]=qs['filters'](_[_0x17b0('0x30')](_0x5ae6a4[_0x17b0('0x26')],_0xcc5704['filters']));if(_0x1a68c1[_0x17b0('0x24')]){if(_0x1a68c1['dateEnd']){_0x1a68c1[_0x17b0('0x25')]=moment(_0x1a68c1['dateEnd'])['add'](0x1,_0x17b0('0x31'));}else{_0x1a68c1[_0x17b0('0x25')]=moment(_0x1a68c1['dateStart'])[_0x17b0('0x32')](0x1,'day');}_[_0x17b0('0x33')](_0x50d751[_0x17b0('0x2f')],{'createdAt':{'$gte':_0x1a68c1[_0x17b0('0x24')],'$lte':_0x1a68c1[_0x17b0('0x25')]}});}if(_0x5ae6a4[_0x17b0('0x26')][_0x17b0('0x34')]){_0x50d751[_0x17b0('0x2f')]=_[_0x17b0('0x33')](_0x50d751[_0x17b0('0x2f')],{'$or':_[_0x17b0('0x35')](_0x50d751[_0x17b0('0x29')],function(_0x1a12cb){var _0x18f324={};_0x18f324[_0x1a12cb]={'$like':'%'+_0x5ae6a4[_0x17b0('0x26')][_0x17b0('0x34')]+'%'};return _0x18f324;})});}_0x50d751=_['merge']({},_0x50d751,_0x5ae6a4[_0x17b0('0x36')]);var _0x8d2f5a={'where':_0x50d751['where']};return db[_0x17b0('0x37')][_0x17b0('0x1a')](_0x8d2f5a)[_0x17b0('0x1e')](function(_0x43f9b2){_0x48337c[_0x17b0('0x1a')]=_0x43f9b2;if(_0x5ae6a4[_0x17b0('0x26')][_0x17b0('0x38')]){_0x50d751[_0x17b0('0x39')]=[{'all':!![]}];}return db[_0x17b0('0x37')]['findAll'](_0x50d751);})[_0x17b0('0x1e')](function(_0x404fa5){_0x48337c[_0x17b0('0x3a')]=_0x404fa5;return _0x48337c;})[_0x17b0('0x1e')](respondWithFilteredResult(_0x25e7d3,_0x50d751))[_0x17b0('0x3b')](handleError(_0x25e7d3,null));};exports[_0x17b0('0x3c')]=function(_0x36bf54,_0x4bf7b8){var _0xf433ac={'raw':!![],'where':{'id':_0x36bf54['params']['id']}},_0x3dfe7b={};_0x3dfe7b[_0x17b0('0x23')]=_[_0x17b0('0x27')](db['Plugin'][_0x17b0('0x3d')]);_0x3dfe7b[_0x17b0('0x26')]=_[_0x17b0('0x27')](_0x36bf54[_0x17b0('0x26')]);_0x3dfe7b[_0x17b0('0x3e')]=_[_0x17b0('0x28')](_0x3dfe7b[_0x17b0('0x23')],_0x3dfe7b[_0x17b0('0x26')]);_0xf433ac['attributes']=_[_0x17b0('0x28')](_0x3dfe7b[_0x17b0('0x23')],qs[_0x17b0('0x2a')](_0x36bf54[_0x17b0('0x26')]['fields']));_0xf433ac[_0x17b0('0x29')]=_0xf433ac[_0x17b0('0x29')][_0x17b0('0x3f')]?_0xf433ac[_0x17b0('0x29')]:_0x3dfe7b[_0x17b0('0x23')];if(_0x36bf54[_0x17b0('0x26')][_0x17b0('0x38')]){_0xf433ac[_0x17b0('0x39')]=[{'all':!![]}];}_0xf433ac=_[_0x17b0('0x33')]({},_0xf433ac,_0x36bf54[_0x17b0('0x36')]);return db['Plugin']['find'](_0xf433ac)['then'](handleEntityNotFound(_0x4bf7b8,null))[_0x17b0('0x1e')](respondWithResult(_0x4bf7b8,null))[_0x17b0('0x3b')](handleError(_0x4bf7b8,null));};exports[_0x17b0('0x40')]=function(_0x2df7c8,_0x48a2a0,_0x15560e){return db[_0x17b0('0x37')][_0x17b0('0x41')]({'where':{'id':_0x2df7c8[_0x17b0('0x42')]['id']},'attributes':[_0x17b0('0x21'),_0x17b0('0x4')],'raw':!![]})[_0x17b0('0x1e')](handleEntityNotFound(_0x48a2a0,null))[_0x17b0('0x1e')](function(_0x2332e5){if(_0x2332e5){var _0x43c381=path['join'](config[_0x17b0('0x43')],_0x17b0('0x44'),util[_0x17b0('0x45')]('%s.zip',path[_0x17b0('0x46')](_0x2332e5[_0x17b0('0x4')])));var _0x418f15=fs['createWriteStream'](_0x43c381);var _0xd5e7e2=archiver(_0x17b0('0x47'),{'zlib':{'level':0x9}});_0xd5e7e2['on'](_0x17b0('0x48'),function(_0x550460){if(_0x550460['code']===_0x17b0('0x49')){logger[_0x17b0('0x1f')](_0x550460);}else{throw new db['Sequelize']['Error'](_0x17b0('0x4a'));}});_0xd5e7e2['on'](_0x17b0('0x1f'),function(_0xcaec22){throw new db['Sequelize'][(_0x17b0('0x4b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xd5e7e2['pipe'](_0x418f15);_0xd5e7e2[_0x17b0('0x4c')](_0x17b0('0x4d'),{'cwd':path[_0x17b0('0x4e')](config[_0x17b0('0x43')],'server/files/plugins',path[_0x17b0('0x4f')](_0x2332e5['path'])),'ignore':[path['join'](path[_0x17b0('0x46')](_0x2332e5[_0x17b0('0x4')]),_0x17b0('0x50')),path[_0x17b0('0x4e')](path[_0x17b0('0x46')](_0x2332e5['path']),_0x17b0('0x51'))],'nodir':!![]})[_0x17b0('0x52')]();_0x418f15['on'](_0x17b0('0x53'),function(){if(!fs[_0x17b0('0x54')](_0x43c381)){throw new db['Sequelize'][(_0x17b0('0x4b'))](_0x17b0('0x55'));}return _0x48a2a0[_0x17b0('0x40')](_0x43c381,util['format'](_0x17b0('0x56'),path[_0x17b0('0x46')](_0x2332e5[_0x17b0('0x4')])),function(_0x4eea86){if(_0x4eea86){throw new db[(_0x17b0('0x57'))][(_0x17b0('0x4b'))](_0x17b0('0x58'));}fs['unlinkSync'](_0x43c381);logger[_0x17b0('0x59')]('Download\x20completed');logger[_0x17b0('0x59')]('Temporary\x20file\x20removed');});});}return null;})[_0x17b0('0x3b')](handleError(_0x48a2a0,null));};exports[_0x17b0('0x5a')]=function(_0x20542a,_0x1231a7,_0x5aa397){var _0xa2354=path[_0x17b0('0x46')](_0x20542a[_0x17b0('0x5b')][_0x17b0('0x5c')],path[_0x17b0('0x5d')](_0x20542a[_0x17b0('0x5b')][_0x17b0('0x5c')]));var _0x1a82ea=path[_0x17b0('0x4e')](config['root'],_0x17b0('0x44'),_0x20542a['file'][_0x17b0('0x5c')]);var _0x337ee7=path[_0x17b0('0x4e')](config[_0x17b0('0x43')],'server/files/plugins',_0xa2354);logger[_0x17b0('0x59')]('Plugin\x20upload\x20filepath:\x20%s',_0x1a82ea);logger[_0x17b0('0x59')](_0x17b0('0x5e'),_0x337ee7);try{fs[_0x17b0('0x5f')](_0x1a82ea,parseInt(_0x17b0('0x60'),0x8));extract(_0x1a82ea,{'dir':_0x337ee7},function(_0x18f370){if(_0x18f370){logger[_0x17b0('0x1f')](_0x18f370);handleError(_0x18f370,!![]);};var _0x10b208=fs['readdirSync'](_0x337ee7);if(_0x10b208['length']>0x1){removeReferences(_0x1a82ea,_0x337ee7);logger[_0x17b0('0x1f')](_0x17b0('0x61'));return _0x5aa397(new Error('Invalid\x20plugin\x20structure'));}var _0x252e7d=fs[_0x17b0('0x62')](path['join'](_0x337ee7,_0x10b208[0x0]));if(_0x252e7d[_0x17b0('0x63')]()){removeReferences(_0x1a82ea,_0x337ee7);logger[_0x17b0('0x1f')](_0x17b0('0x61'));return _0x5aa397(new Error(_0x17b0('0x61')));}if(_0x252e7d[_0x17b0('0x64')]()){var _0x3b4a43=fs[_0x17b0('0x65')](path[_0x17b0('0x4e')](_0x337ee7,_0x10b208[0x0]));if(_0x3b4a43['length']===0x0){removeReferences(_0x1a82ea,_0x337ee7);logger['error'](_0x17b0('0x61'));return _0x5aa397(new Error(_0x17b0('0x61')));}var _0x28256f=_0x3b4a43[_0x17b0('0x66')](function(_0x4c5087){return _0x4c5087===_0x17b0('0x67');});if(!_0x28256f){return _0x5aa397(new Error(_0x17b0('0x68')));}var _0x231aea=fs[_0x17b0('0x69')](path[_0x17b0('0x4e')](_0x337ee7,_0x10b208[0x0],'manifest.json'));var _0x42a970=JSON[_0x17b0('0x6a')](_0x231aea);if(_0x17b0('0x6b')==typeof _0x42a970['name']){return _0x5aa397(new Error(_0x17b0('0x6c')));}if(_0x17b0('0x6b')==typeof _0x42a970[_0x17b0('0x6d')]){return _0x5aa397(new Error(_0x17b0('0x6e')));}if(_0x17b0('0x6b')==typeof _0x42a970['version']){return _0x5aa397(new Error(_0x17b0('0x6f')));}if(_0x17b0('0x6b')==typeof _0x42a970[_0x17b0('0x70')]){return _0x5aa397(new Error(_0x17b0('0x71')));}if(_0x42a970[_0x17b0('0x6d')]===_0x17b0('0x72')){if(_0x17b0('0x6b')==typeof _0x42a970[_0x17b0('0x70')][_0x17b0('0x73')]){return _0x5aa397(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x17b0('0x6b')==typeof _0x42a970[_0x17b0('0x70')][_0x17b0('0x73')][_0x17b0('0x74')]&&_0x17b0('0x6b')==typeof _0x42a970[_0x17b0('0x70')][_0x17b0('0x73')][_0x17b0('0x75')]){return _0x5aa397(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x42a970['type']===_0x17b0('0x76')){if('undefined'==typeof _0x42a970[_0x17b0('0x70')]['scriptName']){return _0x5aa397(new Error(_0x17b0('0x77')));}if(_0x17b0('0x6b')==typeof _0x42a970[_0x17b0('0x70')][_0x17b0('0x78')]){return _0x5aa397(new Error(_0x17b0('0x79')));}}else{return _0x5aa397(new Error(_0x17b0('0x7a')));}var _0x71cdd8=_0x42a970['name'];var _0x44c81f=_0x42a970[_0x17b0('0x7b')];var _0x52751b=_0x42a970['type'];var _0x2142d5=_0x42a970[_0x17b0('0x7c')]?_0x42a970['sidebar']:_0x17b0('0x7d');var _0x3317c5=_0x42a970[_0x17b0('0x7e')]?_0x42a970['icon']:_0x17b0('0x7f');var _0xc170ba='';var _0x332cae='';var _0x4847af='';var _0x3c43ba='';var _0x570566=_0x42a970[_0x17b0('0x80')];if(_0x52751b==='html'){if(_0x17b0('0x6b')!=typeof _0x42a970['parameters']['views'][_0x17b0('0x74')]){var _0x458759=_0x42a970[_0x17b0('0x70')][_0x17b0('0x73')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x17b0('0x81')](_0x458759)){_0xc170ba=path[_0x17b0('0x4e')](_0x17b0('0x82'),_0xa2354,_0x10b208[0x0],_0x458759);}else{_0xc170ba=_0x458759;}}else{logger[_0x17b0('0x59')](_0x17b0('0x83'));}if('undefined'!=typeof _0x42a970[_0x17b0('0x70')][_0x17b0('0x73')][_0x17b0('0x75')]){var _0x3ae6b7=_0x42a970['parameters'][_0x17b0('0x73')][_0x17b0('0x75')];if(!/^(f|ht)tps?:\/\//i[_0x17b0('0x81')](_0x3ae6b7)){_0x332cae=path[_0x17b0('0x4e')]('plugins',_0xa2354,_0x10b208[0x0],_0x3ae6b7);}else{_0x332cae=_0x3ae6b7;}}else{logger[_0x17b0('0x59')](_0x17b0('0x84'));}}else if(_0x52751b===_0x17b0('0x76')){_0x4847af=_0x42a970['parameters']['scriptName'];_0x3c43ba=_0x42a970[_0x17b0('0x70')]['scriptPath'];if('undefined'!=typeof _0x42a970[_0x17b0('0x70')][_0x17b0('0x73')]){if(_0x17b0('0x6b')!=typeof _0x42a970[_0x17b0('0x70')][_0x17b0('0x73')][_0x17b0('0x74')]){var _0x458759=_0x42a970['parameters'][_0x17b0('0x73')][_0x17b0('0x74')];if(!/^(f|ht)tps?:\/\//i[_0x17b0('0x81')](_0x458759)){_0xc170ba=path[_0x17b0('0x4e')]('plugins',_0xa2354,_0x10b208[0x0],_0x458759);}else{_0xc170ba=_0x458759;}}if(_0x17b0('0x6b')!=typeof _0x42a970[_0x17b0('0x70')][_0x17b0('0x73')][_0x17b0('0x75')]){var _0x3ae6b7=_0x42a970[_0x17b0('0x70')][_0x17b0('0x73')][_0x17b0('0x75')];if(!/^(f|ht)tps?:\/\//i[_0x17b0('0x81')](_0x3ae6b7)){_0x332cae=path['join'](_0x17b0('0x82'),_0xa2354,_0x10b208[0x0],_0x3ae6b7);}else{_0x332cae=_0x3ae6b7;}}}}var _0x380daf={'name':_0x71cdd8,'description':_0x44c81f,'path':path[_0x17b0('0x4e')](_0xa2354,_0x10b208[0x0]),'type':_0x52751b,'sidebar':_0x2142d5,'icon':_0x3317c5,'adminUrl':_0xc170ba,'agentUrl':_0x332cae,'scriptName':_0x4847af,'scriptPath':_0x3c43ba,'version':_0x570566};removeReferences(_0x1a82ea,null);return db[_0x17b0('0x37')][_0x17b0('0x85')](_0x380daf)[_0x17b0('0x1e')](respondWithResult(_0x1231a7,null))[_0x17b0('0x3b')](handleError(_0x1231a7,null));}});}catch(_0x347427){_0x1231a7[_0x17b0('0x17')](0x1f4)[_0x17b0('0x86')](_0x347427);}};function removeReferences(_0x6f13e,_0x4bf0d3){try{if(_0x6f13e){fs[_0x17b0('0x87')](_0x6f13e);logger[_0x17b0('0x59')](_0x17b0('0x88'));}if(_0x4bf0d3){rimraf(_0x4bf0d3,function(){});logger[_0x17b0('0x59')](_0x17b0('0x89'));}}catch(_0x156fd2){logger['error'](_0x156fd2);}}exports[_0x17b0('0x8a')]=function(_0x4768ce,_0x469fed,_0x4ec1dc){return db['Plugin']['find']({'where':{'id':_0x4768ce[_0x17b0('0x42')]['id']}})[_0x17b0('0x1e')](handleEntityNotFound(_0x469fed,null))['then'](saveUpdates(_0x4768ce[_0x17b0('0x8b')],null))['then'](respondWithResult(_0x469fed,null))['catch'](handleError(_0x469fed,null));};exports[_0x17b0('0x8c')]=function(_0x53a09c,_0x82b0be,_0xd1064a){return db[_0x17b0('0x37')]['find']({'where':{'id':_0x53a09c[_0x17b0('0x42')]['id']}})['then'](function(_0x357011){if(_0x357011){return _0x357011['destroy']();}})['then'](function(_0x487215){rimraf(path[_0x17b0('0x4e')](config[_0x17b0('0x43')],'server/files/plugins',path[_0x17b0('0x4f')](_0x487215[_0x17b0('0x4')])),function(){});return _0x487215;})[_0x17b0('0x1e')](handleEntityNotFound(_0x82b0be,null))['then'](respondWithStatusCode(_0x82b0be,null))[_0x17b0('0x3b')](handleError(_0x82b0be,null));};exports[_0x17b0('0x8d')]=function(_0x2049fb,_0x19f0bc,_0x3cdc53){return BPromise[_0x17b0('0x8e')]()['then'](function(){if(!_0x2049fb[_0x17b0('0x26')]['path']){throw new Error(_0x17b0('0x8f'));}if(!_0x2049fb[_0x17b0('0x26')][_0x17b0('0x90')]){throw new Error(_0x17b0('0x91'));}var _0x1903c1=_0x2049fb[_0x17b0('0x26')]['hostname']?_0x2049fb[_0x17b0('0x26')][_0x17b0('0x92')]+':'+_0x2049fb[_0x17b0('0x26')][_0x17b0('0x90')]:_0x17b0('0x93')+_0x2049fb['query']['port'];var _0x555c52=_0x2049fb[_0x17b0('0x26')][_0x17b0('0x19')]?_0x2049fb['query']['json']:!![];var _0x4e2088=_0x2049fb[_0x17b0('0x26')][_0x17b0('0x94')]?_0x2049fb[_0x17b0('0x26')][_0x17b0('0x94')]:null;var _0x51f2b2={'method':_0x2049fb['method'],'uri':util[_0x17b0('0x45')](_0x17b0('0x95'),_0x1903c1,_0x2049fb[_0x17b0('0x26')][_0x17b0('0x4')]),'json':_0x555c52,'resolveWithFullResponse':!![],'encoding':_0x4e2088,'qs':_0x2049fb[_0x17b0('0x26')]};if(_0x2049fb['query']['headers']){_0x51f2b2[_0x17b0('0x96')]=_0x2049fb[_0x17b0('0x96')];}return rp(_0x51f2b2);})['then'](function(_0x45e934){if(_0x45e934){_0x19f0bc[_0x17b0('0x97')](_0x45e934['headers']);logger['info'](_0x45e934['body']);if(_[_0x17b0('0x98')](_0x2049fb[_0x17b0('0x26')][_0x17b0('0x4')],_0x17b0('0x40'))&&_0x45e934[_0x17b0('0x99')]==0x1f4){return _0x19f0bc[_0x17b0('0x16')](_0x45e934[_0x17b0('0x99')]);}else{return _0x19f0bc[_0x17b0('0x17')](_0x45e934[_0x17b0('0x99')])[_0x17b0('0x86')](_0x45e934[_0x17b0('0x8b')]);}}else{return _0x19f0bc[_0x17b0('0x16')](0xc8);}})[_0x17b0('0x3b')](handleError(_0x19f0bc,null));};exports[_0x17b0('0x9a')]=function(_0x332819,_0x3cd7e8,_0x1a1fc0){return BPromise[_0x17b0('0x8e')]()['then'](function(){if(!_0x332819['query']['path']){throw new Error(_0x17b0('0x8f'));}if(!_0x332819[_0x17b0('0x26')][_0x17b0('0x90')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x59f443=_0x332819[_0x17b0('0x26')]['hostname']?_0x332819['query'][_0x17b0('0x92')]+':'+_0x332819[_0x17b0('0x26')][_0x17b0('0x90')]:'http://localhost:'+_0x332819['query']['port'];var _0x37055a=_0x332819[_0x17b0('0x26')][_0x17b0('0x19')]?_0x332819['query'][_0x17b0('0x19')]:!![];var _0x4d19dc=_0x332819['query'][_0x17b0('0x94')]?_0x332819[_0x17b0('0x26')]['encoding']:null;var _0x478e9b={'method':_0x332819['method'],'uri':util[_0x17b0('0x45')](_0x17b0('0x95'),_0x59f443,_0x332819[_0x17b0('0x26')][_0x17b0('0x4')]),'json':_0x37055a,'resolveWithFullResponse':!![],'encoding':_0x4d19dc,'body':_0x332819['body']};if(_0x332819[_0x17b0('0x26')][_0x17b0('0x96')]){_0x478e9b['headers']=_0x332819[_0x17b0('0x96')];}return rp(_0x478e9b);})[_0x17b0('0x1e')](function(_0x411ac1){if(_0x411ac1){_0x3cd7e8['set'](_0x411ac1[_0x17b0('0x96')]);logger[_0x17b0('0x59')](_0x411ac1[_0x17b0('0x8b')]);return _0x3cd7e8['status'](_0x411ac1['statusCode'])[_0x17b0('0x86')](_0x411ac1[_0x17b0('0x8b')]);}else{return _0x3cd7e8[_0x17b0('0x16')](0xc8);}})[_0x17b0('0x3b')](handleError(_0x3cd7e8,null));}; \ No newline at end of file +var _0x0c63=['isFile','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','undefined','version','Invalid\x20manifest:\x20parameters\x20missing','type','html','parameters','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','destroy','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','set','body','endsWith','download','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','api','../../config/utils','socket.io-emitter','localhost','./plugin.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','Plugin','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','add','day','merge','map','filter','options','includeAll','include','findAll','rows','catch','params','length','find','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','join','root','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync'];(function(_0x3f0e33,_0x1fb16b){var _0x340ac5=function(_0x243ae2){while(--_0x243ae2){_0x3f0e33['push'](_0x3f0e33['shift']());}};_0x340ac5(++_0x1fb16b);}(_0x0c63,0x169));var _0x30c6=function(_0x49d332,_0x2582f2){_0x49d332=_0x49d332-0x0;var _0x95f662=_0x0c63[_0x49d332];return _0x95f662;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x30c6('0x0'));var moment=require(_0x30c6('0x1'));var BPromise=require(_0x30c6('0x2'));var Mustache=require(_0x30c6('0x3'));var util=require(_0x30c6('0x4'));var path=require(_0x30c6('0x5'));var sox=require(_0x30c6('0x6'));var csv=require(_0x30c6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x30c6('0x8'));var squel=require(_0x30c6('0x9'));var crypto=require('crypto');var jsforce=require(_0x30c6('0xa'));var deskjs=require(_0x30c6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x30c6('0xc'));var Papa=require(_0x30c6('0xd'));var extract=require(_0x30c6('0xe'));var rimraf=require('rimraf');var archiver=require(_0x30c6('0xf'));var qs=require(_0x30c6('0x10'));var logger=require('../../config/logger')(_0x30c6('0x11'));var utils=require(_0x30c6('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x30c6('0x13'))({'host':_0x30c6('0x14'),'port':0x18eb});require(_0x30c6('0x15'))[_0x30c6('0x16')](socket);function respondWithStatusCode(_0x161116,_0x58c668){_0x58c668=_0x58c668||0xcc;return function(_0x29eada){if(_0x29eada){return _0x161116['sendStatus'](_0x58c668);}return _0x161116[_0x30c6('0x17')](_0x58c668)[_0x30c6('0x18')]();};}function respondWithResult(_0x292e7c,_0x423c74){_0x423c74=_0x423c74||0xc8;return function(_0x287998){if(_0x287998){return _0x292e7c[_0x30c6('0x17')](_0x423c74)[_0x30c6('0x19')](_0x287998);}};}function respondWithFilteredResult(_0x215400,_0x180ebd){return function(_0x307e85){if(_0x307e85){var _0x1d7e7a=_0x307e85[_0x30c6('0x1a')],_0x20be2c=_0x180ebd[_0x30c6('0x1b')],_0x2e3815=_0x180ebd[_0x30c6('0x1b')]+_0x180ebd[_0x30c6('0x1c')],_0x6f126;if(_0x2e3815>=_0x1d7e7a){_0x2e3815=_0x1d7e7a;_0x6f126=0xc8;}else{_0x6f126=0xce;}_0x215400['status'](_0x6f126);return _0x215400['set'](_0x30c6('0x1d'),_0x20be2c+'-'+_0x2e3815+'/'+_0x1d7e7a)[_0x30c6('0x19')](_0x307e85);}return null;};}function patchUpdates(_0x6b297c){return function(_0x3ef818){try{jsonpatch[_0x30c6('0x1e')](_0x3ef818,_0x6b297c,!![]);}catch(_0x69f606){return BPromise[_0x30c6('0x1f')](_0x69f606);}return _0x3ef818[_0x30c6('0x20')]();};}function saveUpdates(_0x2aa9c8,_0x242d1a){return function(_0x4b8295){if(_0x4b8295){return _0x4b8295[_0x30c6('0x21')](_0x2aa9c8)[_0x30c6('0x22')](function(_0x5573c5){return _0x5573c5;});}return null;};}function removeEntity(_0x1cc29d,_0x24dd85){return function(_0x1b42b3){if(_0x1b42b3){return _0x1b42b3['destroy']()[_0x30c6('0x22')](function(){_0x1cc29d[_0x30c6('0x17')](0xcc)[_0x30c6('0x18')]();});}};}function handleEntityNotFound(_0x39bd8e,_0x426c17){return function(_0x473ed9){if(!_0x473ed9){_0x39bd8e[_0x30c6('0x23')](0x194);}return _0x473ed9;};}function handleError(_0x158e39,_0x460df0){_0x460df0=_0x460df0||0x1f4;return function(_0x1c08b8){logger[_0x30c6('0x24')](_0x1c08b8[_0x30c6('0x25')]);if(_0x1c08b8['name']){delete _0x1c08b8[_0x30c6('0x26')];}_0x158e39['status'](_0x460df0)[_0x30c6('0x27')](_0x1c08b8);};}exports[_0x30c6('0x28')]=function(_0x53dfcb,_0x1304e8){var _0x47258e={},_0x9bcef3={},_0x4872f1={'count':0x0,'rows':[]};var _0x2c1890=db[_0x30c6('0x29')]['rawAttributes'];_0x9bcef3['model']=_['keys'](_0x2c1890);var _0x4343c5={'dateStart':_0x53dfcb['query'][_0x30c6('0x2a')],'dateEnd':_0x53dfcb[_0x30c6('0x2b')][_0x30c6('0x2c')]};delete _0x53dfcb['query']['dateStart'];delete _0x53dfcb[_0x30c6('0x2b')][_0x30c6('0x2c')];_0x9bcef3[_0x30c6('0x2b')]=_['keys'](_0x53dfcb['query']);_0x9bcef3[_0x30c6('0x2d')]=_[_0x30c6('0x2e')](_0x9bcef3[_0x30c6('0x2f')],_0x9bcef3[_0x30c6('0x2b')]);_0x47258e[_0x30c6('0x30')]=_[_0x30c6('0x2e')](_0x9bcef3[_0x30c6('0x2f')],qs[_0x30c6('0x31')](_0x53dfcb[_0x30c6('0x2b')][_0x30c6('0x31')]));_0x47258e[_0x30c6('0x30')]=_0x47258e['attributes']['length']?_0x47258e[_0x30c6('0x30')]:_0x9bcef3[_0x30c6('0x2f')];if(!_0x53dfcb[_0x30c6('0x2b')][_0x30c6('0x32')](_0x30c6('0x33'))){_0x47258e['limit']=qs[_0x30c6('0x1c')](_0x53dfcb[_0x30c6('0x2b')][_0x30c6('0x1c')]);_0x47258e[_0x30c6('0x1b')]=qs['offset'](_0x53dfcb[_0x30c6('0x2b')][_0x30c6('0x1b')]);}_0x47258e[_0x30c6('0x34')]=qs['sort'](_0x53dfcb[_0x30c6('0x2b')]['sort']);_0x47258e[_0x30c6('0x35')]=qs[_0x30c6('0x2d')](_[_0x30c6('0x36')](_0x53dfcb['query'],_0x9bcef3[_0x30c6('0x2d')]));if(_0x4343c5['dateStart']){if(_0x4343c5[_0x30c6('0x2c')]){_0x4343c5['dateEnd']=moment(_0x4343c5[_0x30c6('0x2c')])[_0x30c6('0x37')](0x1,_0x30c6('0x38'));}else{_0x4343c5[_0x30c6('0x2c')]=moment(_0x4343c5[_0x30c6('0x2a')])[_0x30c6('0x37')](0x1,_0x30c6('0x38'));}_[_0x30c6('0x39')](_0x47258e['where'],{'createdAt':{'$gte':_0x4343c5['dateStart'],'$lte':_0x4343c5[_0x30c6('0x2c')]}});}if(_0x53dfcb[_0x30c6('0x2b')]['filter']){_0x47258e[_0x30c6('0x35')]=_[_0x30c6('0x39')](_0x47258e[_0x30c6('0x35')],{'$or':_[_0x30c6('0x3a')](_0x47258e[_0x30c6('0x30')],function(_0x683b44){var _0x113baa={};_0x113baa[_0x683b44]={'$like':'%'+_0x53dfcb[_0x30c6('0x2b')][_0x30c6('0x3b')]+'%'};return _0x113baa;})});}_0x47258e=_[_0x30c6('0x39')]({},_0x47258e,_0x53dfcb[_0x30c6('0x3c')]);var _0x5b056a={'where':_0x47258e['where']};return db['Plugin'][_0x30c6('0x1a')](_0x5b056a)[_0x30c6('0x22')](function(_0x2bd79f){_0x4872f1[_0x30c6('0x1a')]=_0x2bd79f;if(_0x53dfcb[_0x30c6('0x2b')][_0x30c6('0x3d')]){_0x47258e[_0x30c6('0x3e')]=[{'all':!![]}];}return db['Plugin'][_0x30c6('0x3f')](_0x47258e);})[_0x30c6('0x22')](function(_0x4e7a88){_0x4872f1[_0x30c6('0x40')]=_0x4e7a88;return _0x4872f1;})[_0x30c6('0x22')](respondWithFilteredResult(_0x1304e8,_0x47258e))[_0x30c6('0x41')](handleError(_0x1304e8,null));};exports['show']=function(_0x1e75ac,_0x4d859e){var _0x344778={'raw':!![],'where':{'id':_0x1e75ac[_0x30c6('0x42')]['id']}},_0x78b9aa={};_0x78b9aa['model']=_['keys'](db['Plugin']['rawAttributes']);_0x78b9aa[_0x30c6('0x2b')]=_['keys'](_0x1e75ac[_0x30c6('0x2b')]);_0x78b9aa['filters']=_['intersection'](_0x78b9aa['model'],_0x78b9aa[_0x30c6('0x2b')]);_0x344778[_0x30c6('0x30')]=_[_0x30c6('0x2e')](_0x78b9aa['model'],qs[_0x30c6('0x31')](_0x1e75ac[_0x30c6('0x2b')][_0x30c6('0x31')]));_0x344778[_0x30c6('0x30')]=_0x344778[_0x30c6('0x30')][_0x30c6('0x43')]?_0x344778[_0x30c6('0x30')]:_0x78b9aa['model'];if(_0x1e75ac[_0x30c6('0x2b')][_0x30c6('0x3d')]){_0x344778[_0x30c6('0x3e')]=[{'all':!![]}];}_0x344778=_[_0x30c6('0x39')]({},_0x344778,_0x1e75ac['options']);return db[_0x30c6('0x29')]['find'](_0x344778)[_0x30c6('0x22')](handleEntityNotFound(_0x4d859e,null))['then'](respondWithResult(_0x4d859e,null))[_0x30c6('0x41')](handleError(_0x4d859e,null));};exports['download']=function(_0x48c412,_0x3835b3,_0x2680ad){return db[_0x30c6('0x29')][_0x30c6('0x44')]({'where':{'id':_0x48c412['params']['id']},'attributes':[_0x30c6('0x26'),'path'],'raw':!![]})[_0x30c6('0x22')](handleEntityNotFound(_0x3835b3,null))['then'](function(_0x11ac7e){if(_0x11ac7e){var _0x1ddff6=path['join'](config['root'],'server/files/plugins',util[_0x30c6('0x45')](_0x30c6('0x46'),path[_0x30c6('0x47')](_0x11ac7e['path'])));var _0x5cb31e=fs[_0x30c6('0x48')](_0x1ddff6);var _0xfe1c1f=archiver(_0x30c6('0x49'),{'zlib':{'level':0x9}});_0xfe1c1f['on'](_0x30c6('0x4a'),function(_0x16b55c){if(_0x16b55c[_0x30c6('0x4b')]===_0x30c6('0x4c')){logger[_0x30c6('0x24')](_0x16b55c);}else{throw new db[(_0x30c6('0x4d'))][(_0x30c6('0x4e'))](_0x30c6('0x4f'));}});_0xfe1c1f['on'](_0x30c6('0x24'),function(_0x3e8f20){throw new db[(_0x30c6('0x4d'))][(_0x30c6('0x4e'))](_0x30c6('0x4f'));});_0xfe1c1f[_0x30c6('0x50')](_0x5cb31e);_0xfe1c1f['glob']('**/*',{'cwd':path[_0x30c6('0x51')](config[_0x30c6('0x52')],'server/files/plugins',path['dirname'](_0x11ac7e[_0x30c6('0x5')])),'ignore':[path[_0x30c6('0x51')](path[_0x30c6('0x47')](_0x11ac7e[_0x30c6('0x5')]),_0x30c6('0x53')),path[_0x30c6('0x51')](path[_0x30c6('0x47')](_0x11ac7e[_0x30c6('0x5')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x5cb31e['on'](_0x30c6('0x54'),function(){if(!fs[_0x30c6('0x55')](_0x1ddff6)){throw new db[(_0x30c6('0x4d'))][(_0x30c6('0x4e'))](_0x30c6('0x56'));}return _0x3835b3['download'](_0x1ddff6,util[_0x30c6('0x45')]('%s.zip',path['basename'](_0x11ac7e[_0x30c6('0x5')])),function(_0xab7bc){if(_0xab7bc){throw new db['Sequelize']['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x30c6('0x57')](_0x1ddff6);logger[_0x30c6('0x58')](_0x30c6('0x59'));logger[_0x30c6('0x58')](_0x30c6('0x5a'));});});}return null;})['catch'](handleError(_0x3835b3,null));};exports[_0x30c6('0x5b')]=function(_0x13b02f,_0x47a080,_0x330b47){var _0x2898c7=path['basename'](_0x13b02f[_0x30c6('0x5c')][_0x30c6('0x5d')],path[_0x30c6('0x5e')](_0x13b02f[_0x30c6('0x5c')]['filename']));var _0x104b83=path[_0x30c6('0x51')](config[_0x30c6('0x52')],_0x30c6('0x5f'),_0x13b02f['file']['filename']);var _0x455e53=path[_0x30c6('0x51')](config[_0x30c6('0x52')],'server/files/plugins',_0x2898c7);logger[_0x30c6('0x58')](_0x30c6('0x60'),_0x104b83);logger[_0x30c6('0x58')]('Plugin\x20upload\x20destination:\x20%s',_0x455e53);try{fs[_0x30c6('0x61')](_0x104b83,parseInt(_0x30c6('0x62'),0x8));extract(_0x104b83,{'dir':_0x455e53},function(_0x3f388a){if(_0x3f388a){logger[_0x30c6('0x24')](_0x3f388a);handleError(_0x3f388a,!![]);};var _0x38fdae=fs['readdirSync'](_0x455e53);if(_0x38fdae[_0x30c6('0x43')]>0x1){removeReferences(_0x104b83,_0x455e53);logger[_0x30c6('0x24')](_0x30c6('0x63'));return _0x330b47(new Error('Invalid\x20plugin\x20structure'));}var _0x3bef59=fs[_0x30c6('0x64')](path['join'](_0x455e53,_0x38fdae[0x0]));if(_0x3bef59[_0x30c6('0x65')]()){removeReferences(_0x104b83,_0x455e53);logger[_0x30c6('0x24')](_0x30c6('0x63'));return _0x330b47(new Error(_0x30c6('0x63')));}if(_0x3bef59['isDirectory']()){var _0x115cf8=fs[_0x30c6('0x66')](path[_0x30c6('0x51')](_0x455e53,_0x38fdae[0x0]));if(_0x115cf8[_0x30c6('0x43')]===0x0){removeReferences(_0x104b83,_0x455e53);logger[_0x30c6('0x24')](_0x30c6('0x63'));return _0x330b47(new Error(_0x30c6('0x63')));}var _0x4b9643=_0x115cf8[_0x30c6('0x67')](function(_0x53f30a){return _0x53f30a==='manifest.json';});if(!_0x4b9643){return _0x330b47(new Error(_0x30c6('0x68')));}var _0x2a79f6=fs[_0x30c6('0x69')](path['join'](_0x455e53,_0x38fdae[0x0],_0x30c6('0x6a')));var _0x55a749=JSON[_0x30c6('0x6b')](_0x2a79f6);if('undefined'==typeof _0x55a749['name']){return _0x330b47(new Error(_0x30c6('0x6c')));}if('undefined'==typeof _0x55a749['type']){return _0x330b47(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x30c6('0x6d')==typeof _0x55a749[_0x30c6('0x6e')]){return _0x330b47(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x30c6('0x6d')==typeof _0x55a749['parameters']){return _0x330b47(new Error(_0x30c6('0x6f')));}if(_0x55a749[_0x30c6('0x70')]===_0x30c6('0x71')){if('undefined'==typeof _0x55a749[_0x30c6('0x72')][_0x30c6('0x73')]){return _0x330b47(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x30c6('0x6d')==typeof _0x55a749[_0x30c6('0x72')][_0x30c6('0x73')][_0x30c6('0x74')]&&_0x30c6('0x6d')==typeof _0x55a749[_0x30c6('0x72')][_0x30c6('0x73')]['agent']){return _0x330b47(new Error(_0x30c6('0x75')));}}else if(_0x55a749[_0x30c6('0x70')]==='script'){if(_0x30c6('0x6d')==typeof _0x55a749[_0x30c6('0x72')][_0x30c6('0x76')]){return _0x330b47(new Error(_0x30c6('0x77')));}if(_0x30c6('0x6d')==typeof _0x55a749[_0x30c6('0x72')]['scriptPath']){return _0x330b47(new Error(_0x30c6('0x78')));}}else{return _0x330b47(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1ac474=_0x55a749['name'];var _0x26de75=_0x55a749[_0x30c6('0x79')];var _0x159ba4=_0x55a749['type'];var _0x3faaa1=_0x55a749['sidebar']?_0x55a749[_0x30c6('0x7a')]:'always';var _0x5b257a=_0x55a749[_0x30c6('0x7b')]?_0x55a749[_0x30c6('0x7b')]:_0x30c6('0x7c');var _0x12f7db='';var _0x67eda4='';var _0x34ca91='';var _0x2e7915='';var _0x1ef721=_0x55a749[_0x30c6('0x6e')];if(_0x159ba4===_0x30c6('0x71')){if(_0x30c6('0x6d')!=typeof _0x55a749[_0x30c6('0x72')]['views'][_0x30c6('0x74')]){var _0x139563=_0x55a749[_0x30c6('0x72')][_0x30c6('0x73')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x30c6('0x7d')](_0x139563)){_0x12f7db=path['join'](_0x30c6('0x7e'),_0x2898c7,_0x38fdae[0x0],_0x139563);}else{_0x12f7db=_0x139563;}}else{logger[_0x30c6('0x58')](_0x30c6('0x7f'));}if(_0x30c6('0x6d')!=typeof _0x55a749[_0x30c6('0x72')][_0x30c6('0x73')][_0x30c6('0x80')]){var _0x109aae=_0x55a749[_0x30c6('0x72')][_0x30c6('0x73')][_0x30c6('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x30c6('0x7d')](_0x109aae)){_0x67eda4=path[_0x30c6('0x51')](_0x30c6('0x7e'),_0x2898c7,_0x38fdae[0x0],_0x109aae);}else{_0x67eda4=_0x109aae;}}else{logger[_0x30c6('0x58')](_0x30c6('0x81'));}}else if(_0x159ba4===_0x30c6('0x82')){_0x34ca91=_0x55a749['parameters'][_0x30c6('0x76')];_0x2e7915=_0x55a749[_0x30c6('0x72')][_0x30c6('0x83')];if('undefined'!=typeof _0x55a749[_0x30c6('0x72')][_0x30c6('0x73')]){if(_0x30c6('0x6d')!=typeof _0x55a749['parameters']['views'][_0x30c6('0x74')]){var _0x139563=_0x55a749[_0x30c6('0x72')][_0x30c6('0x73')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x30c6('0x7d')](_0x139563)){_0x12f7db=path[_0x30c6('0x51')](_0x30c6('0x7e'),_0x2898c7,_0x38fdae[0x0],_0x139563);}else{_0x12f7db=_0x139563;}}if(_0x30c6('0x6d')!=typeof _0x55a749[_0x30c6('0x72')]['views']['agent']){var _0x109aae=_0x55a749[_0x30c6('0x72')][_0x30c6('0x73')][_0x30c6('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x30c6('0x7d')](_0x109aae)){_0x67eda4=path['join'](_0x30c6('0x7e'),_0x2898c7,_0x38fdae[0x0],_0x109aae);}else{_0x67eda4=_0x109aae;}}}}var _0x465150={'name':_0x1ac474,'description':_0x26de75,'path':path[_0x30c6('0x51')](_0x2898c7,_0x38fdae[0x0]),'type':_0x159ba4,'sidebar':_0x3faaa1,'icon':_0x5b257a,'adminUrl':_0x12f7db,'agentUrl':_0x67eda4,'scriptName':_0x34ca91,'scriptPath':_0x2e7915,'version':_0x1ef721};removeReferences(_0x104b83,null);return db['Plugin'][_0x30c6('0x84')](_0x465150)[_0x30c6('0x22')](respondWithResult(_0x47a080,null))[_0x30c6('0x41')](handleError(_0x47a080,null));}});}catch(_0x18a3b5){_0x47a080['status'](0x1f4)['send'](_0x18a3b5);}};function removeReferences(_0x38dc09,_0x355688){try{if(_0x38dc09){fs['unlinkSync'](_0x38dc09);logger[_0x30c6('0x58')](_0x30c6('0x85'));}if(_0x355688){rimraf(_0x355688,function(){});logger[_0x30c6('0x58')](_0x30c6('0x86'));}}catch(_0x318d31){logger['error'](_0x318d31);}}exports[_0x30c6('0x21')]=function(_0x36b873,_0x2db0a0,_0x125e16){return db[_0x30c6('0x29')]['find']({'where':{'id':_0x36b873[_0x30c6('0x42')]['id']}})[_0x30c6('0x22')](handleEntityNotFound(_0x2db0a0,null))[_0x30c6('0x22')](saveUpdates(_0x36b873['body'],null))['then'](respondWithResult(_0x2db0a0,null))[_0x30c6('0x41')](handleError(_0x2db0a0,null));};exports['delete']=function(_0x443c8a,_0xd0e7df,_0x15a14d){return db[_0x30c6('0x29')][_0x30c6('0x44')]({'where':{'id':_0x443c8a[_0x30c6('0x42')]['id']}})['then'](function(_0xb77a9){if(_0xb77a9){return _0xb77a9[_0x30c6('0x87')]();}})[_0x30c6('0x22')](function(_0x3f0d39){rimraf(path[_0x30c6('0x51')](config[_0x30c6('0x52')],'server/files/plugins',path[_0x30c6('0x88')](_0x3f0d39[_0x30c6('0x5')])),function(){});return _0x3f0d39;})[_0x30c6('0x22')](handleEntityNotFound(_0xd0e7df,null))[_0x30c6('0x22')](respondWithStatusCode(_0xd0e7df,null))[_0x30c6('0x41')](handleError(_0xd0e7df,null));};exports[_0x30c6('0x89')]=function(_0x3248db,_0xae56d2,_0x16c08f){return BPromise['resolve']()[_0x30c6('0x22')](function(){if(!_0x3248db['query'][_0x30c6('0x5')]){throw new Error(_0x30c6('0x8a'));}if(!_0x3248db[_0x30c6('0x2b')][_0x30c6('0x8b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2932d1=_0x3248db[_0x30c6('0x2b')][_0x30c6('0x8c')]?_0x3248db[_0x30c6('0x2b')][_0x30c6('0x8c')]+':'+_0x3248db[_0x30c6('0x2b')][_0x30c6('0x8b')]:_0x30c6('0x8d')+_0x3248db[_0x30c6('0x2b')]['port'];var _0x19069a=_0x3248db[_0x30c6('0x2b')][_0x30c6('0x19')]?_0x3248db[_0x30c6('0x2b')][_0x30c6('0x19')]:!![];var _0x4bdb0b=_0x3248db['query']['encoding']?_0x3248db[_0x30c6('0x2b')][_0x30c6('0x8e')]:null;var _0x4691ef={'method':_0x3248db[_0x30c6('0x8f')],'uri':util['format'](_0x30c6('0x90'),_0x2932d1,_0x3248db[_0x30c6('0x2b')][_0x30c6('0x5')]),'json':_0x19069a,'resolveWithFullResponse':!![],'encoding':_0x4bdb0b,'qs':_0x3248db[_0x30c6('0x2b')]};if(_0x3248db[_0x30c6('0x2b')][_0x30c6('0x91')]){_0x4691ef[_0x30c6('0x91')]=_0x3248db['headers'];}return rp(_0x4691ef);})[_0x30c6('0x22')](function(_0x669772){if(_0x669772){_0xae56d2[_0x30c6('0x92')](_0x669772[_0x30c6('0x91')]);logger['info'](_0x669772[_0x30c6('0x93')]);if(_[_0x30c6('0x94')](_0x3248db[_0x30c6('0x2b')]['path'],_0x30c6('0x95'))&&_0x669772['statusCode']==0x1f4){return _0xae56d2[_0x30c6('0x23')](_0x669772[_0x30c6('0x96')]);}else{return _0xae56d2[_0x30c6('0x17')](_0x669772[_0x30c6('0x96')])['send'](_0x669772[_0x30c6('0x93')]);}}else{return _0xae56d2[_0x30c6('0x23')](0xc8);}})[_0x30c6('0x41')](handleError(_0xae56d2,null));};exports[_0x30c6('0x97')]=function(_0x20b9c2,_0xf7bf7b,_0x38e45a){return BPromise[_0x30c6('0x98')]()['then'](function(){if(!_0x20b9c2[_0x30c6('0x2b')][_0x30c6('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x20b9c2[_0x30c6('0x2b')][_0x30c6('0x8b')]){throw new Error(_0x30c6('0x99'));}var _0x2ed8e5=_0x20b9c2[_0x30c6('0x2b')]['hostname']?_0x20b9c2[_0x30c6('0x2b')][_0x30c6('0x8c')]+':'+_0x20b9c2['query']['port']:'http://localhost:'+_0x20b9c2[_0x30c6('0x2b')][_0x30c6('0x8b')];var _0x4818d6=_0x20b9c2['query'][_0x30c6('0x19')]?_0x20b9c2[_0x30c6('0x2b')]['json']:!![];var _0x2a5702=_0x20b9c2[_0x30c6('0x2b')][_0x30c6('0x8e')]?_0x20b9c2[_0x30c6('0x2b')][_0x30c6('0x8e')]:null;var _0x1dc5e2={'method':_0x20b9c2[_0x30c6('0x8f')],'uri':util[_0x30c6('0x45')](_0x30c6('0x90'),_0x2ed8e5,_0x20b9c2['query'][_0x30c6('0x5')]),'json':_0x4818d6,'resolveWithFullResponse':!![],'encoding':_0x2a5702,'body':_0x20b9c2[_0x30c6('0x93')]};if(_0x20b9c2['query'][_0x30c6('0x91')]){_0x1dc5e2[_0x30c6('0x91')]=_0x20b9c2[_0x30c6('0x91')];}return rp(_0x1dc5e2);})['then'](function(_0x5d4c57){if(_0x5d4c57){_0xf7bf7b[_0x30c6('0x92')](_0x5d4c57[_0x30c6('0x91')]);logger[_0x30c6('0x58')](_0x5d4c57['body']);return _0xf7bf7b[_0x30c6('0x17')](_0x5d4c57[_0x30c6('0x96')])['send'](_0x5d4c57[_0x30c6('0x93')]);}else{return _0xf7bf7b[_0x30c6('0x23')](0xc8);}})[_0x30c6('0x41')](handleError(_0xf7bf7b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a241235..873a283 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(_0x1a7d02,_0x15eb2f){var _0x41ca16=function(_0x32d819){while(--_0x32d819){_0x1a7d02['push'](_0x1a7d02['shift']());}};_0x41ca16(++_0x15eb2f);}(_0x7a54,0x106));var _0x47a5=function(_0x53bf04,_0x19b379){_0x53bf04=_0x53bf04-0x0;var _0x48cc3a=_0x7a54[_0x53bf04];return _0x48cc3a;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents; \ No newline at end of file +var _0x7a54=['Plugin','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x13cf9f,_0x274d86){var _0x2204f5=function(_0x2bfdca){while(--_0x2bfdca){_0x13cf9f['push'](_0x13cf9f['shift']());}};_0x2204f5(++_0x274d86);}(_0x7a54,0x106));var _0x47a5=function(_0x5eda33,_0x4d448b){_0x5eda33=_0x5eda33-0x0;var _0x56080e=_0x7a54[_0x5eda33];return _0x56080e;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index ca76f72..1a09bf6 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 _0xb722=['bluebird','request-promise','./plugin.attributes','define','Plugin','lodash','../../config/logger','moment'];(function(_0x517082,_0xc70ef9){var _0x560118=function(_0xff3513){while(--_0xff3513){_0x517082['push'](_0x517082['shift']());}};_0x560118(++_0xc70ef9);}(_0xb722,0x135));var _0x2b72=function(_0x5bdd71,_0xf55eaf){_0x5bdd71=_0x5bdd71-0x0;var _0x36c54c=_0xb722[_0x5bdd71];return _0x36c54c;};'use strict';var _=require(_0x2b72('0x0'));var util=require('util');var logger=require(_0x2b72('0x1'))('api');var moment=require(_0x2b72('0x2'));var BPromise=require(_0x2b72('0x3'));var rp=require(_0x2b72('0x4'));var attributes=require(_0x2b72('0x5'));module['exports']=function(_0x14335d,_0x4a6126){return _0x14335d[_0x2b72('0x6')](_0x2b72('0x7'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x073d=['plugins','lodash','util','../../config/logger','moment','request-promise','./plugin.attributes','exports','Plugin'];(function(_0xc00af1,_0x1c5ed4){var _0x269546=function(_0x3dbe5f){while(--_0x3dbe5f){_0xc00af1['push'](_0xc00af1['shift']());}};_0x269546(++_0x1c5ed4);}(_0x073d,0x1de));var _0xd073=function(_0x47e92b,_0x29e3b5){_0x47e92b=_0x47e92b-0x0;var _0x2da694=_0x073d[_0x47e92b];return _0x2da694;};'use strict';var _=require(_0xd073('0x0'));var util=require(_0xd073('0x1'));var logger=require(_0xd073('0x2'))('api');var moment=require(_0xd073('0x3'));var BPromise=require('bluebird');var rp=require(_0xd073('0x4'));var attributes=require(_0xd073('0x5'));module[_0xd073('0x6')]=function(_0x583706,_0xe21170){return _0x583706['define'](_0xd073('0x7'),attributes,{'tableName':_0xd073('0x8'),'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 2046aa0..9e0e8b9 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 _0x6299=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','result','CreatePlugin','Plugin','create','options','raw','info','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s'];(function(_0x556bd3,_0x2bf5f2){var _0x3f943b=function(_0x2729ff){while(--_0x2729ff){_0x556bd3['push'](_0x556bd3['shift']());}};_0x3f943b(++_0x2bf5f2);}(_0x6299,0x1ed));var _0x9629=function(_0x3dff35,_0x45b001){_0x3dff35=_0x3dff35-0x0;var _0x167b51=_0x6299[_0x3dff35];return _0x167b51;};'use strict';var _=require('lodash');var util=require(_0x9629('0x0'));var moment=require(_0x9629('0x1'));var BPromise=require(_0x9629('0x2'));var rs=require(_0x9629('0x3'));var fs=require('fs');var db=require(_0x9629('0x4'))['db'];var utils=require(_0x9629('0x5'));var logger=require(_0x9629('0x6'))(_0x9629('0x7'));var config=require(_0x9629('0x8'));var jayson=require(_0x9629('0x9'));var client=jayson[_0x9629('0xa')][_0x9629('0xb')]({'port':0x232a});var socket=require(_0x9629('0xc'))({'host':_0x9629('0xd'),'port':0x18eb});require(_0x9629('0xe'))[_0x9629('0xf')](socket);function respondWithRpcPromise(_0x2a49f8,_0x15a0ca,_0x588270){return new BPromise(function(_0xedb096,_0x20bbc3){return client[_0x9629('0x10')](_0x2a49f8,_0x588270)[_0x9629('0x11')](function(_0x201b66){logger['info'](_0x9629('0x12'),_0x15a0ca,_0x9629('0x13'));logger[_0x9629('0x14')](_0x9629('0x15'),_0x15a0ca,'request\x20sent',JSON['stringify'](_0x201b66));if(_0x201b66['error']){if(_0x201b66[_0x9629('0x16')]['code']===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x15a0ca,_0x201b66[_0x9629('0x16')]['message']);return _0x20bbc3(_0x201b66[_0x9629('0x16')][_0x9629('0x17')]);}logger[_0x9629('0x16')](_0x9629('0x12'),_0x15a0ca,_0x201b66['error'][_0x9629('0x17')]);return _0xedb096(_0x201b66[_0x9629('0x16')][_0x9629('0x17')]);}else{logger['info'](_0x9629('0x12'),_0x15a0ca,'request\x20sent');_0xedb096(_0x201b66[_0x9629('0x18')][_0x9629('0x17')]);}})['catch'](function(_0x34f310){logger[_0x9629('0x16')](_0x9629('0x12'),_0x15a0ca,_0x34f310);_0x20bbc3(_0x34f310);});});}exports[_0x9629('0x19')]=function(_0x54f260){var _0x50b035=this;return new Promise(function(_0x1a918a,_0x472873){return db[_0x9629('0x1a')][_0x9629('0x1b')](_0x54f260['body'],{'raw':_0x54f260['options']?_0x54f260[_0x9629('0x1c')][_0x9629('0x1d')]===undefined?!![]:![]:!![]})[_0x9629('0x11')](function(_0xc49902){logger[_0x9629('0x1e')]('CreatePlugin',_0x54f260);logger[_0x9629('0x14')](_0x9629('0x19'),_0x54f260,JSON[_0x9629('0x1f')](_0xc49902));_0x1a918a(_0xc49902);})['catch'](function(_0x529dab){logger['error']('CreatePlugin',_0x529dab['message'],_0x54f260);_0x472873(_0x50b035[_0x9629('0x16')](0x1f4,_0x529dab[_0x9629('0x17')]));});});}; \ No newline at end of file +var _0x2c7c=['CreatePlugin','Plugin','create','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2a3901,_0x210a28){var _0x1a70ef=function(_0x5cb70b){while(--_0x5cb70b){_0x2a3901['push'](_0x2a3901['shift']());}};_0x1a70ef(++_0x210a28);}(_0x2c7c,0x1e5));var _0xc2c7=function(_0x55604f,_0x2af047){_0x55604f=_0x55604f-0x0;var _0x3e7389=_0x2c7c[_0x55604f];return _0x3e7389;};'use strict';var _=require(_0xc2c7('0x0'));var util=require(_0xc2c7('0x1'));var moment=require(_0xc2c7('0x2'));var BPromise=require(_0xc2c7('0x3'));var rs=require(_0xc2c7('0x4'));var fs=require('fs');var db=require(_0xc2c7('0x5'))['db'];var utils=require(_0xc2c7('0x6'));var logger=require('../../config/logger')(_0xc2c7('0x7'));var config=require('../../config/environment');var jayson=require(_0xc2c7('0x8'));var client=jayson['client'][_0xc2c7('0x9')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xc2c7('0xa'))[_0xc2c7('0xb')](socket);function respondWithRpcPromise(_0x39a7c1,_0x969282,_0x5e1a99){return new BPromise(function(_0x29f19a,_0x5df2c4){return client[_0xc2c7('0xc')](_0x39a7c1,_0x5e1a99)[_0xc2c7('0xd')](function(_0x2f0970){logger[_0xc2c7('0xe')](_0xc2c7('0xf'),_0x969282,'request\x20sent');logger[_0xc2c7('0x10')](_0xc2c7('0x11'),_0x969282,_0xc2c7('0x12'),JSON[_0xc2c7('0x13')](_0x2f0970));if(_0x2f0970['error']){if(_0x2f0970[_0xc2c7('0x14')][_0xc2c7('0x15')]===0x1f4){logger[_0xc2c7('0x14')]('Plugin,\x20%s,\x20%s',_0x969282,_0x2f0970[_0xc2c7('0x14')][_0xc2c7('0x16')]);return _0x5df2c4(_0x2f0970[_0xc2c7('0x14')][_0xc2c7('0x16')]);}logger[_0xc2c7('0x14')]('Plugin,\x20%s,\x20%s',_0x969282,_0x2f0970[_0xc2c7('0x14')][_0xc2c7('0x16')]);return _0x29f19a(_0x2f0970[_0xc2c7('0x14')]['message']);}else{logger['info'](_0xc2c7('0xf'),_0x969282,_0xc2c7('0x12'));_0x29f19a(_0x2f0970[_0xc2c7('0x17')]['message']);}})[_0xc2c7('0x18')](function(_0x26cfb4){logger[_0xc2c7('0x14')](_0xc2c7('0xf'),_0x969282,_0x26cfb4);_0x5df2c4(_0x26cfb4);});});}exports[_0xc2c7('0x19')]=function(_0x3406a9){var _0x1802f7=this;return new Promise(function(_0xe4650f,_0x21679e){return db[_0xc2c7('0x1a')][_0xc2c7('0x1b')](_0x3406a9[_0xc2c7('0x1c')],{'raw':_0x3406a9[_0xc2c7('0x1d')]?_0x3406a9[_0xc2c7('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xc2c7('0xd')](function(_0x38e1f0){logger['info'](_0xc2c7('0x19'),_0x3406a9);logger['debug']('CreatePlugin',_0x3406a9,JSON['stringify'](_0x38e1f0));_0xe4650f(_0x38e1f0);})['catch'](function(_0x2f8b01){logger[_0xc2c7('0x14')](_0xc2c7('0x19'),_0x2f8b01[_0xc2c7('0x16')],_0x3406a9);_0x21679e(_0x1802f7[_0xc2c7('0x14')](0x1f4,_0x2f8b01['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index cf7ef64..f43d964 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 _0x5a8f=['emit','register','length','plugin:','remove','update'];(function(_0xd38836,_0x47d17b){var _0x196517=function(_0x17cd1f){while(--_0x17cd1f){_0xd38836['push'](_0xd38836['shift']());}};_0x196517(++_0x47d17b);}(_0x5a8f,0x1ae));var _0xf5a8=function(_0x1bbce7,_0x581b65){_0x1bbce7=_0x1bbce7-0x0;var _0xe3a3ef=_0x5a8f[_0x1bbce7];return _0xe3a3ef;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0xf5a8('0x0'),_0xf5a8('0x1')];function createListener(_0x29e4f9,_0x228c27){return function(_0x2f6795){_0x228c27[_0xf5a8('0x2')](_0x29e4f9,_0x2f6795);};}function removeListener(_0x54bde8,_0x36ad15){return function(){PluginEvents['removeListener'](_0x54bde8,_0x36ad15);};}exports[_0xf5a8('0x3')]=function(_0x471260){for(var _0x52ecbf=0x0,_0xff84bc=events[_0xf5a8('0x4')];_0x52ecbf<_0xff84bc;_0x52ecbf++){var _0x430786=events[_0x52ecbf];var _0x5375fd=createListener(_0xf5a8('0x5')+_0x430786,_0x471260);PluginEvents['on'](_0x430786,_0x5375fd);}}; \ No newline at end of file +var _0xc5e2=['removeListener','register','plugin:','./plugin.events','save'];(function(_0x5a9142,_0x1bc456){var _0x334687=function(_0x4b0ab1){while(--_0x4b0ab1){_0x5a9142['push'](_0x5a9142['shift']());}};_0x334687(++_0x1bc456);}(_0xc5e2,0x85));var _0x2c5e=function(_0x55fd06,_0x467458){_0x55fd06=_0x55fd06-0x0;var _0x125640=_0xc5e2[_0x55fd06];return _0x125640;};'use strict';var PluginEvents=require(_0x2c5e('0x0'));var events=[_0x2c5e('0x1'),'remove','update'];function createListener(_0x26d009,_0x9d8194){return function(_0x58205d){_0x9d8194['emit'](_0x26d009,_0x58205d);};}function removeListener(_0x1956bb,_0xe679ff){return function(){PluginEvents[_0x2c5e('0x2')](_0x1956bb,_0xe679ff);};}exports[_0x2c5e('0x3')]=function(_0x237e7e){for(var _0x414093=0x0,_0x34c6a1=events['length'];_0x414093<_0x34c6a1;_0x414093++){var _0x128901=events[_0x414093];var _0x1546b5=createListener(_0x2c5e('0x4')+_0x128901,_0x237e7e);PluginEvents['on'](_0x128901,_0x1546b5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 23607b9..ebe4bb8 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(_0x1867f5,_0x419bcb){var _0x1cb0a4=function(_0x15ff8b){while(--_0x15ff8b){_0x1867f5['push'](_0x1867f5['shift']());}};_0x1cb0a4(++_0x419bcb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0xbcf3a2,_0x21de74){var _0xdf34f9=function(_0x45c913){while(--_0x45c913){_0xbcf3a2['push'](_0xbcf3a2['shift']());}};_0xdf34f9(++_0x21de74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 40dd453..de9694a 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 _0x414f=['script','join','../../files/plugins','body','cwd','chdir','dump','catch','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','then','reject','express','motion2','length','show','describe','params'];(function(_0x506259,_0x190579){var _0x1201a9=function(_0x18b906){while(--_0x18b906){_0x506259['push'](_0x506259['shift']());}};_0x1201a9(++_0x190579);}(_0x414f,0x13f));var _0xf414=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0x414f[_0x114d1f];return _0x5b91d4;};'use strict';var _=require(_0xf414('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xf414('0x1'))(_0xf414('0x2'));var path=require('path');var exec=require(_0xf414('0x3'))[_0xf414('0x4')];var BPromise=require(_0xf414('0x5'));function handleEntityNotFound(_0x335d3e,_0x29b998){return function(_0x22e5aa){if(!_0x22e5aa){_0x335d3e[_0xf414('0x6')](0x194);;}return _0x22e5aa;};}function respondWithResult(_0x5dda1d,_0x3be83a){_0x3be83a=_0x3be83a||0xc8;return function(_0x4cdcdb){if(_0x4cdcdb){return _0x5dda1d[_0xf414('0x7')](_0x3be83a)[_0xf414('0x8')](_0x4cdcdb);}return null;};}function handleError(_0xad732,_0x5194e5){_0x5194e5=_0x5194e5||0x1f4;return function(_0x4e69bd){logger[_0xf414('0x9')](_0x4e69bd[_0xf414('0xa')]);if(_0x4e69bd[_0xf414('0xb')]){delete _0x4e69bd[_0xf414('0xb')];}_0xad732[_0xf414('0x7')](_0x5194e5)[_0xf414('0xc')](_0x4e69bd);};}function execChildProcess(){return new BPromise(function(_0x192c0a,_0x37edf9){exec('npm\x20install',function(_0x5d2ff0,_0xce51ad,_0x30eb79){logger[_0xf414('0xd')](_0xce51ad);logger[_0xf414('0xd')](_0x30eb79);if(_0x5d2ff0){logger[_0xf414('0x9')](_0x5d2ff0);return _0x37edf9(_0x5d2ff0);}return _0x192c0a(_0xce51ad);});});}exports['index']=function(_0x345485,_0x11a954){return pm2[_0xf414('0xe')]()[_0xf414('0xf')](function(_0x99bbd1){if(_0x99bbd1){var _0x5da0b7=_[_0xf414('0x10')](_0x99bbd1,function(_0x107a83){return _0x107a83[_0xf414('0xb')]===_0xf414('0x11')||_0x107a83[_0xf414('0xb')]===_0xf414('0x12');});return{'rows':_0x5da0b7,'count':_0x5da0b7[_0xf414('0x13')]};}return null;})[_0xf414('0xf')](respondWithResult(_0x11a954,null))['catch'](handleError(_0x11a954,null));};exports[_0xf414('0x14')]=function(_0x452904,_0x400210){return pm2[_0xf414('0x15')](_0x452904[_0xf414('0x16')]['id'])['then'](respondWithResult(_0x400210,null))[_0xf414('0xf')](handleEntityNotFound(_0x400210,null))['catch'](handleError(_0x400210,null));};exports['create']=function(_0x24b65e,_0x44b829){if(_0x24b65e['body']['name']&&_0x24b65e['body'][_0xf414('0x17')]){var _0x1ccfce=path[_0xf414('0x18')](__dirname,_0xf414('0x19'),_0x24b65e[_0xf414('0x1a')][_0xf414('0x17')]);var _0x3bbbe8=process[_0xf414('0x1b')]();process[_0xf414('0x1c')](path['dirname'](_0x1ccfce));return execChildProcess()[_0xf414('0xf')](function(_0x3ae2a0){process[_0xf414('0x1c')](_0x3bbbe8);return pm2['start']({'name':_0x24b65e[_0xf414('0x1a')][_0xf414('0xb')],'script':_0x1ccfce});})[_0xf414('0xf')](function(_0x40e93e){pm2[_0xf414('0x1d')]();return _0x40e93e[0x0];})[_0xf414('0xf')](respondWithResult(_0x44b829,0xc9))[_0xf414('0x1e')](handleError(_0x44b829,null));}else{return _0x44b829[_0xf414('0x7')](0x1f4)['send']({'message':_0xf414('0x1f')});}};exports['update']=function(_0x47e0a1,_0x2153a4){if(_0x47e0a1[_0xf414('0x1a')]['id']){delete _0x47e0a1[_0xf414('0x1a')]['id'];}var _0x3e443d={'online':_0xf414('0x20'),'stopped':_0xf414('0x21')};if(_0x3e443d['hasOwnProperty'](_0x47e0a1['body'][_0xf414('0x7')])){return pm2[_0x3e443d[_0x47e0a1[_0xf414('0x1a')][_0xf414('0x7')]]](_0x47e0a1['params']['id'])[_0xf414('0xf')](respondWithResult(_0x2153a4,0xc8))['catch'](handleError(_0x2153a4,null));}else{return _0x2153a4['status'](0x1f4)[_0xf414('0xc')]({'message':_0xf414('0x22')});}};exports[_0xf414('0x23')]=function(_0x4a1da9,_0x578019){if(_0x4a1da9[_0xf414('0x1a')]['id']){delete _0x4a1da9['body']['id'];}if(_0x4a1da9[_0xf414('0x16')]['id']){return pm2[_0xf414('0x24')](_0x4a1da9[_0xf414('0x16')]['id'])[_0xf414('0xf')](function(_0x5e66c0){pm2[_0xf414('0x1d')]();return _0x5e66c0[0x0];})['then'](respondWithResult(_0x578019,null))['catch'](handleError(_0x578019,null));}else{return _0x578019[_0xf414('0x7')](0x1f4)[_0xf414('0xc')]({'message':_0xf414('0x25')});}}; \ No newline at end of file +var _0x0760=['Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','length','catch','show','params','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump'];(function(_0x3e18bf,_0x387f5e){var _0x1022e5=function(_0x242ec4){while(--_0x242ec4){_0x3e18bf['push'](_0x3e18bf['shift']());}};_0x1022e5(++_0x387f5e);}(_0x0760,0xa9));var _0x0076=function(_0xe41a9c,_0x585510){_0xe41a9c=_0xe41a9c-0x0;var _0x5cf939=_0x0760[_0xe41a9c];return _0x5cf939;};'use strict';var _=require(_0x0076('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0076('0x1'))('api');var path=require('path');var exec=require('child_process')[_0x0076('0x2')];var BPromise=require(_0x0076('0x3'));function handleEntityNotFound(_0x2ae1d3,_0x156fa4){return function(_0x12533d){if(!_0x12533d){_0x2ae1d3['sendStatus'](0x194);;}return _0x12533d;};}function respondWithResult(_0x22bfc8,_0x3b0428){_0x3b0428=_0x3b0428||0xc8;return function(_0x1b7f29){if(_0x1b7f29){return _0x22bfc8[_0x0076('0x4')](_0x3b0428)[_0x0076('0x5')](_0x1b7f29);}return null;};}function handleError(_0x5b4c91,_0x411b4b){_0x411b4b=_0x411b4b||0x1f4;return function(_0x59ba96){logger[_0x0076('0x6')](_0x59ba96[_0x0076('0x7')]);if(_0x59ba96['name']){delete _0x59ba96[_0x0076('0x8')];}_0x5b4c91[_0x0076('0x4')](_0x411b4b)[_0x0076('0x9')](_0x59ba96);};}function execChildProcess(){return new BPromise(function(_0xce7b7e,_0x83a68a){exec(_0x0076('0xa'),function(_0x5045e5,_0x339f6b,_0x44eb53){logger[_0x0076('0xb')](_0x339f6b);logger[_0x0076('0xb')](_0x44eb53);if(_0x5045e5){logger[_0x0076('0x6')](_0x5045e5);return _0x83a68a(_0x5045e5);}return _0xce7b7e(_0x339f6b);});});}exports[_0x0076('0xc')]=function(_0x425843,_0xc9cde7){return pm2[_0x0076('0xd')]()[_0x0076('0xe')](function(_0x379136){if(_0x379136){var _0x5175c7=_[_0x0076('0xf')](_0x379136,function(_0x50a737){return _0x50a737['name']===_0x0076('0x10')||_0x50a737[_0x0076('0x8')]==='motion2';});return{'rows':_0x5175c7,'count':_0x5175c7[_0x0076('0x11')]};}return null;})['then'](respondWithResult(_0xc9cde7,null))[_0x0076('0x12')](handleError(_0xc9cde7,null));};exports[_0x0076('0x13')]=function(_0x5a5623,_0x540edf){return pm2['describe'](_0x5a5623[_0x0076('0x14')]['id'])[_0x0076('0xe')](respondWithResult(_0x540edf,null))[_0x0076('0xe')](handleEntityNotFound(_0x540edf,null))[_0x0076('0x12')](handleError(_0x540edf,null));};exports[_0x0076('0x15')]=function(_0x371498,_0x3b5ee2){if(_0x371498[_0x0076('0x16')][_0x0076('0x8')]&&_0x371498[_0x0076('0x16')][_0x0076('0x17')]){var _0x1507d4=path[_0x0076('0x18')](__dirname,_0x0076('0x19'),_0x371498['body'][_0x0076('0x17')]);var _0x2a5619=process[_0x0076('0x1a')]();process['chdir'](path[_0x0076('0x1b')](_0x1507d4));return execChildProcess()[_0x0076('0xe')](function(_0x2dd436){process[_0x0076('0x1c')](_0x2a5619);return pm2[_0x0076('0x1d')]({'name':_0x371498['body'][_0x0076('0x8')],'script':_0x1507d4});})[_0x0076('0xe')](function(_0x12cb86){pm2[_0x0076('0x1e')]();return _0x12cb86[0x0];})[_0x0076('0xe')](respondWithResult(_0x3b5ee2,0xc9))[_0x0076('0x12')](handleError(_0x3b5ee2,null));}else{return _0x3b5ee2['status'](0x1f4)[_0x0076('0x9')]({'message':_0x0076('0x1f')});}};exports[_0x0076('0x20')]=function(_0x187827,_0x2b3bb9){if(_0x187827['body']['id']){delete _0x187827[_0x0076('0x16')]['id'];}var _0x712db9={'online':_0x0076('0x21'),'stopped':_0x0076('0x22')};if(_0x712db9[_0x0076('0x23')](_0x187827[_0x0076('0x16')][_0x0076('0x4')])){return pm2[_0x712db9[_0x187827[_0x0076('0x16')][_0x0076('0x4')]]](_0x187827[_0x0076('0x14')]['id'])['then'](respondWithResult(_0x2b3bb9,0xc8))[_0x0076('0x12')](handleError(_0x2b3bb9,null));}else{return _0x2b3bb9[_0x0076('0x4')](0x1f4)[_0x0076('0x9')]({'message':_0x0076('0x24')});}};exports[_0x0076('0x25')]=function(_0x501b23,_0x522273){if(_0x501b23[_0x0076('0x16')]['id']){delete _0x501b23[_0x0076('0x16')]['id'];}if(_0x501b23[_0x0076('0x14')]['id']){return pm2[_0x0076('0x26')](_0x501b23['params']['id'])['then'](function(_0x42e3fa){pm2[_0x0076('0x1e')]();return _0x42e3fa[0x0];})[_0x0076('0xe')](respondWithResult(_0x522273,null))['catch'](handleError(_0x522273,null));}else{return _0x522273[_0x0076('0x4')](0x1f4)[_0x0076('0x9')]({'message':_0x0076('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e0ca8b8..f2f483e 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 _0x412c=['multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x412c,0x1da));var _0xc412=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x412c[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require(_0xc412('0x0'));var util=require('util');var path=require(_0xc412('0x1'));var express=require(_0xc412('0x2'));var router=express['Router']();var auth=require(_0xc412('0x3'));var interaction=require(_0xc412('0x4'));var config=require(_0xc412('0x5'));module['exports']=router; \ No newline at end of file +var _0xe916=['../../config/environment','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x55c99e,_0x46d478){var _0x5a89be=function(_0x481293){while(--_0x481293){_0x55c99e['push'](_0x55c99e['shift']());}};_0x5a89be(++_0x46d478);}(_0xe916,0xaa));var _0x6e91=function(_0xb30b43,_0x486414){_0xb30b43=_0xb30b43-0x0;var _0x46a71d=_0xe916[_0xb30b43];return _0x46a71d;};'use strict';var multer=require(_0x6e91('0x0'));var util=require('util');var path=require(_0x6e91('0x1'));var express=require(_0x6e91('0x2'));var router=express[_0x6e91('0x3')]();var auth=require(_0x6e91('0x4'));var interaction=require(_0x6e91('0x5'));var config=require(_0x6e91('0x6'));module[_0x6e91('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 1db647c..e34a1e8 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 _0xfd35=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x4742c0,_0x17407d){var _0x4377d0=function(_0x2eb302){while(--_0x2eb302){_0x4742c0['push'](_0x4742c0['shift']());}};_0x4377d0(++_0x17407d);}(_0xfd35,0x136));var _0x5fd3=function(_0x2226f6,_0x395823){_0x2226f6=_0x2226f6-0x0;var _0x687135=_0xfd35[_0x2226f6];return _0x687135;};'use strict';var Sequelize=require(_0x5fd3('0x0'));module[_0x5fd3('0x1')]={'state':{'type':Sequelize[_0x5fd3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5fd3('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x5fd3('0x3')]},'starttime':{'type':Sequelize[_0x5fd3('0x4')]},'responsetime':{'type':Sequelize[_0x5fd3('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5fd3('0x3')]},'campaigntype':{'type':Sequelize[_0x5fd3('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa741=['INTEGER','DATE','STRING','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa741,0x83));var _0x1a74=function(_0xdbd1cf,_0x8d319d){_0xdbd1cf=_0xdbd1cf-0x0;var _0x3668c4=_0xa741[_0xdbd1cf];return _0x3668c4;};'use strict';var Sequelize=require('sequelize');module[_0x1a74('0x0')]={'state':{'type':Sequelize[_0x1a74('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1a74('0x2')]},'uniqueid':{'type':Sequelize[_0x1a74('0x3')]},'starttime':{'type':Sequelize[_0x1a74('0x2')]},'responsetime':{'type':Sequelize[_0x1a74('0x2')]},'ringtime':{'type':Sequelize[_0x1a74('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1a74('0x3')]},'campaigntype':{'type':Sequelize[_0x1a74('0x3')]},'membername':{'type':Sequelize[_0x1a74('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index ccff5f7..dc91f83 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 _0x1c3b=['bluebird','request-promise','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0xb6c56,_0xc7b2db){var _0xfd6353=function(_0x5b67ba){while(--_0x5b67ba){_0xb6c56['push'](_0xb6c56['shift']());}};_0xfd6353(++_0xc7b2db);}(_0x1c3b,0xf0));var _0xb1c3=function(_0xe47eb1,_0x1ce7ca){_0xe47eb1=_0xe47eb1-0x0;var _0x206bb4=_0x1c3b[_0xe47eb1];return _0x206bb4;};'use strict';var _=require(_0xb1c3('0x0'));var util=require(_0xb1c3('0x1'));var logger=require(_0xb1c3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb1c3('0x3'));var rp=require(_0xb1c3('0x4'));var attributes=require('./reportAgentPreview.attributes');module[_0xb1c3('0x5')]=function(_0x3ee2a9,_0x7432e7){return _0x3ee2a9[_0xb1c3('0x6')](_0xb1c3('0x7'),attributes,{'tableName':_0xb1c3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f31=['../../config/logger','api','moment','bluebird','./reportAgentPreview.attributes','exports','report_agent_preview','util'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x1f31,0x1a7));var _0x11f3=function(_0x310eb9,_0x1aed15){_0x310eb9=_0x310eb9-0x0;var _0x28915c=_0x1f31[_0x310eb9];return _0x28915c;};'use strict';var _=require('lodash');var util=require(_0x11f3('0x0'));var logger=require(_0x11f3('0x1'))(_0x11f3('0x2'));var moment=require(_0x11f3('0x3'));var BPromise=require(_0x11f3('0x4'));var rp=require('request-promise');var attributes=require(_0x11f3('0x5'));module[_0x11f3('0x6')]=function(_0x4674d4,_0xfcc27a){return _0x4674d4['define']('ReportAgentPreview',attributes,{'tableName':_0x11f3('0x7'),'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 14ee641..ed36614 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 _0x7bae=['CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x587963,_0x193e71){var _0x23541b=function(_0x1e64c1){while(--_0x1e64c1){_0x587963['push'](_0x587963['shift']());}};_0x23541b(++_0x193e71);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x7bae[_0x3de8a4];return _0x4635cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xe7ba('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7ba('0x3'))(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var jayson=require(_0xe7ba('0x6'));var client=jayson[_0xe7ba('0x7')][_0xe7ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d31df,_0x3c5e59,_0x10b307){return new BPromise(function(_0x34fb18,_0x160565){return client[_0xe7ba('0x9')](_0x2d31df,_0x10b307)[_0xe7ba('0xa')](function(_0x1b2693){logger['info'](_0xe7ba('0xb'),_0x3c5e59,_0xe7ba('0xc'));logger[_0xe7ba('0xd')](_0xe7ba('0xe'),_0x3c5e59,_0xe7ba('0xc'),JSON[_0xe7ba('0xf')](_0x1b2693));if(_0x1b2693[_0xe7ba('0x10')]){if(_0x1b2693[_0xe7ba('0x10')][_0xe7ba('0x11')]===0x1f4){logger['error'](_0xe7ba('0xb'),_0x3c5e59,_0x1b2693['error'][_0xe7ba('0x12')]);return _0x160565(_0x1b2693[_0xe7ba('0x10')][_0xe7ba('0x12')]);}logger[_0xe7ba('0x10')](_0xe7ba('0xb'),_0x3c5e59,_0x1b2693[_0xe7ba('0x10')]['message']);return _0x34fb18(_0x1b2693['error'][_0xe7ba('0x12')]);}else{logger[_0xe7ba('0x13')](_0xe7ba('0xb'),_0x3c5e59,'request\x20sent');_0x34fb18(_0x1b2693[_0xe7ba('0x14')]['message']);}})['catch'](function(_0x5e9176){logger[_0xe7ba('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c5e59,_0x5e9176);_0x160565(_0x5e9176);});});}exports[_0xe7ba('0x15')]=function(_0x4888d9){var _0x4e3021=this;return new Promise(function(_0x5a82b5,_0x3f326a){return db[_0xe7ba('0x16')][_0xe7ba('0x17')](_0x4888d9[_0xe7ba('0x18')],{'raw':_0x4888d9[_0xe7ba('0x19')]?_0x4888d9['options'][_0xe7ba('0x1a')]===undefined?!![]:![]:!![]})[_0xe7ba('0xa')](function(_0x3b40fb){logger[_0xe7ba('0x13')]('CreateReportAgentPreview',_0x4888d9);logger[_0xe7ba('0xd')](_0xe7ba('0x15'),_0x4888d9,JSON['stringify'](_0x3b40fb));_0x5a82b5(_0x3b40fb);})[_0xe7ba('0x1b')](function(_0x4514e8){logger[_0xe7ba('0x10')](_0xe7ba('0x15'),_0x4514e8[_0xe7ba('0x12')],_0x4888d9);_0x3f326a(_0x4e3021[_0xe7ba('0x10')](0x1f4,_0x4514e8[_0xe7ba('0x12')]));});});}; \ No newline at end of file +var _0xdb94=['../../config/logger','rpc','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x389213,_0x14a50d){var _0x4ad6ca=function(_0x45203b){while(--_0x45203b){_0x389213['push'](_0x389213['shift']());}};_0x4ad6ca(++_0x14a50d);}(_0xdb94,0xe5));var _0x4db9=function(_0x37b736,_0x3d4be8){_0x37b736=_0x37b736-0x0;var _0x29eb91=_0xdb94[_0x37b736];return _0x29eb91;};'use strict';var _=require('lodash');var util=require(_0x4db9('0x0'));var moment=require(_0x4db9('0x1'));var BPromise=require('bluebird');var rs=require(_0x4db9('0x2'));var fs=require('fs');var db=require(_0x4db9('0x3'))['db'];var utils=require(_0x4db9('0x4'));var logger=require(_0x4db9('0x5'))(_0x4db9('0x6'));var config=require('../../config/environment');var jayson=require(_0x4db9('0x7'));var client=jayson['client'][_0x4db9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc76bc1,_0x1dddb9,_0x3404f6){return new BPromise(function(_0x42a857,_0x57c701){return client[_0x4db9('0x9')](_0xc76bc1,_0x3404f6)[_0x4db9('0xa')](function(_0x2d1d38){logger[_0x4db9('0xb')](_0x4db9('0xc'),_0x1dddb9,'request\x20sent');logger[_0x4db9('0xd')](_0x4db9('0xe'),_0x1dddb9,_0x4db9('0xf'),JSON[_0x4db9('0x10')](_0x2d1d38));if(_0x2d1d38[_0x4db9('0x11')]){if(_0x2d1d38[_0x4db9('0x11')]['code']===0x1f4){logger[_0x4db9('0x11')](_0x4db9('0xc'),_0x1dddb9,_0x2d1d38['error']['message']);return _0x57c701(_0x2d1d38[_0x4db9('0x11')][_0x4db9('0x12')]);}logger[_0x4db9('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x1dddb9,_0x2d1d38[_0x4db9('0x11')][_0x4db9('0x12')]);return _0x42a857(_0x2d1d38[_0x4db9('0x11')][_0x4db9('0x12')]);}else{logger[_0x4db9('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x1dddb9,_0x4db9('0xf'));_0x42a857(_0x2d1d38[_0x4db9('0x13')]['message']);}})[_0x4db9('0x14')](function(_0x7df575){logger[_0x4db9('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x1dddb9,_0x7df575);_0x57c701(_0x7df575);});});}exports[_0x4db9('0x15')]=function(_0x3b0863){var _0x4c5f4f=this;return new Promise(function(_0x50f685,_0x493923){return db[_0x4db9('0x16')][_0x4db9('0x17')](_0x3b0863['body'],{'raw':_0x3b0863[_0x4db9('0x18')]?_0x3b0863[_0x4db9('0x18')][_0x4db9('0x19')]===undefined?!![]:![]:!![]})[_0x4db9('0xa')](function(_0x439433){logger[_0x4db9('0xb')](_0x4db9('0x15'),_0x3b0863);logger[_0x4db9('0xd')](_0x4db9('0x15'),_0x3b0863,JSON[_0x4db9('0x10')](_0x439433));_0x50f685(_0x439433);})[_0x4db9('0x14')](function(_0x102402){logger['error'](_0x4db9('0x15'),_0x102402[_0x4db9('0x12')],_0x3b0863);_0x493923(_0x4c5f4f['error'](0x1f4,_0x102402[_0x4db9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 9304917..568bc71 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 _0x6333=['post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions'];(function(_0x3090e4,_0x1201d6){var _0x34a115=function(_0x228ec8){while(--_0x228ec8){_0x3090e4['push'](_0x3090e4['shift']());}};_0x34a115(++_0x1201d6);}(_0x6333,0x185));var _0x3633=function(_0x526c41,_0x162063){_0x526c41=_0x526c41-0x0;var _0x423944=_0x6333[_0x526c41];return _0x423944;};'use strict';var multer=require(_0x3633('0x0'));var util=require(_0x3633('0x1'));var path=require(_0x3633('0x2'));var express=require('express');var router=express[_0x3633('0x3')]();var auth=require(_0x3633('0x4'));var controller=require(_0x3633('0x5'));router[_0x3633('0x6')](_0x3633('0x7'),auth[_0x3633('0x8')](),controller[_0x3633('0x9')]);router[_0x3633('0x6')](_0x3633('0xa'),auth['isAuthenticated'](),controller[_0x3633('0xb')]);router[_0x3633('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x3633('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x3633('0x6')](_0x3633('0xc'),auth[_0x3633('0x8')](),controller[_0x3633('0xd')]);router['get'](_0x3633('0xe'),auth[_0x3633('0x8')](),controller[_0x3633('0xf')]);router['get'](_0x3633('0x10'),auth['isAuthenticated'](),controller[_0x3633('0x11')]);router[_0x3633('0x6')]('/mail/accounts',auth[_0x3633('0x8')](),controller[_0x3633('0x12')]);router[_0x3633('0x6')](_0x3633('0x13'),auth[_0x3633('0x8')](),controller[_0x3633('0x14')]);router[_0x3633('0x6')](_0x3633('0x15'),auth[_0x3633('0x8')](),controller[_0x3633('0x16')]);router[_0x3633('0x6')](_0x3633('0x17'),auth[_0x3633('0x8')](),controller[_0x3633('0x18')]);router[_0x3633('0x6')](_0x3633('0x19'),auth[_0x3633('0x8')](),controller[_0x3633('0x1a')]);router['get'](_0x3633('0x1b'),auth[_0x3633('0x8')](),controller[_0x3633('0x1c')]);router[_0x3633('0x6')](_0x3633('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x3633('0x6')](_0x3633('0x1e'),auth['isAuthenticated'](),controller[_0x3633('0x1f')]);router[_0x3633('0x6')](_0x3633('0x20'),auth[_0x3633('0x8')](),controller[_0x3633('0x21')]);router[_0x3633('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x3633('0x6')]('/outbound',auth['isAuthenticated'](),controller[_0x3633('0x22')]);router['get'](_0x3633('0x23'),auth[_0x3633('0x8')](),controller['outboundChannels']);router['get'](_0x3633('0x24'),auth[_0x3633('0x8')](),controller[_0x3633('0x25')]);router[_0x3633('0x26')](_0x3633('0x27'),auth['isAuthenticated'](),controller[_0x3633('0x28')]);router[_0x3633('0x6')](_0x3633('0x29'),auth[_0x3633('0x8')](),controller['telephones']);router[_0x3633('0x6')](_0x3633('0x2a'),auth[_0x3633('0x8')](),controller[_0x3633('0x2b')]);router['get'](_0x3633('0x2c'),auth[_0x3633('0x8')](),controller[_0x3633('0x2d')]);router[_0x3633('0x6')](_0x3633('0x2e'),auth['isAuthenticated'](),controller[_0x3633('0x2f')]);router[_0x3633('0x6')](_0x3633('0x30'),auth[_0x3633('0x8')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x3633('0x31'),auth['isAuthenticated'](),controller[_0x3633('0x32')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x3633('0x8')](),controller[_0x3633('0x33')]);router[_0x3633('0x6')]('/sms/queues/waitinginteractions',auth[_0x3633('0x8')](),controller[_0x3633('0x34')]);router[_0x3633('0x6')](_0x3633('0x35'),auth['isAuthenticated'](),controller[_0x3633('0x36')]);router[_0x3633('0x37')](_0x3633('0x38'),auth[_0x3633('0x8')](),controller[_0x3633('0x39')]('mail'));router[_0x3633('0x6')](_0x3633('0x3a'),auth[_0x3633('0x8')](),controller[_0x3633('0x3b')]);router[_0x3633('0x37')](_0x3633('0x3c'),auth[_0x3633('0x8')](),controller[_0x3633('0x39')](_0x3633('0x3d')));router[_0x3633('0x6')](_0x3633('0x3e'),auth[_0x3633('0x8')](),controller[_0x3633('0x3f')]);router['post'](_0x3633('0x40'),auth[_0x3633('0x8')](),controller[_0x3633('0x39')](_0x3633('0x41')));router[_0x3633('0x6')](_0x3633('0x42'),auth[_0x3633('0x8')](),controller['showFaxQueues']);router[_0x3633('0x37')](_0x3633('0x43'),auth[_0x3633('0x8')](),controller[_0x3633('0x39')](_0x3633('0x44')));router['get'](_0x3633('0x45'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post']('/sms/queues/:id/notify',auth[_0x3633('0x8')](),controller[_0x3633('0x39')]('sms'));router[_0x3633('0x6')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x3633('0x46')]);router[_0x3633('0x37')](_0x3633('0x47'),auth[_0x3633('0x8')](),controller[_0x3633('0x48')]);module[_0x3633('0x49')]=router; \ No newline at end of file +var _0xb5a8=['/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb5a8,0x81));var _0x8b5a=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb5a8[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x8b5a('0x0'));var util=require(_0x8b5a('0x1'));var path=require(_0x8b5a('0x2'));var express=require(_0x8b5a('0x3'));var router=express[_0x8b5a('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x8b5a('0x5'));router[_0x8b5a('0x6')](_0x8b5a('0x7'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x9')]);router[_0x8b5a('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x8b5a('0x8')](),controller[_0x8b5a('0xa')]);router['get'](_0x8b5a('0xb'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0xc')]);router[_0x8b5a('0x6')]('/voice/queues',auth[_0x8b5a('0x8')](),controller[_0x8b5a('0xd')]);router[_0x8b5a('0x6')](_0x8b5a('0xe'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0xf')]);router[_0x8b5a('0x6')]('/mail/queues',auth[_0x8b5a('0x8')](),controller['mailQueues']);router[_0x8b5a('0x6')](_0x8b5a('0x10'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x11')]);router['get']('/openchannel/queues',auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x12')]);router[_0x8b5a('0x6')](_0x8b5a('0x13'),auth['isAuthenticated'](),controller[_0x8b5a('0x14')]);router[_0x8b5a('0x6')](_0x8b5a('0x15'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x16')]);router[_0x8b5a('0x6')](_0x8b5a('0x17'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x18')]);router[_0x8b5a('0x6')](_0x8b5a('0x19'),auth[_0x8b5a('0x8')](),controller['voiceQueuesChannel']);router[_0x8b5a('0x6')](_0x8b5a('0x1a'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x1b')]);router[_0x8b5a('0x6')](_0x8b5a('0x1c'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x1d')]);router['get'](_0x8b5a('0x1e'),auth['isAuthenticated'](),controller[_0x8b5a('0x1f')]);router[_0x8b5a('0x6')](_0x8b5a('0x20'),auth[_0x8b5a('0x8')](),controller['outbound']);router['get'](_0x8b5a('0x21'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x22')]);router[_0x8b5a('0x6')]('/agents',auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x23')]);router['put'](_0x8b5a('0x24'),auth['isAuthenticated'](),controller[_0x8b5a('0x25')]);router[_0x8b5a('0x6')](_0x8b5a('0x26'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x27')]);router[_0x8b5a('0x6')](_0x8b5a('0x28'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x29')]);router[_0x8b5a('0x6')]('/campaigns',auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x2a')]);router[_0x8b5a('0x6')](_0x8b5a('0x2b'),auth[_0x8b5a('0x8')](),controller['faxAccounts']);router[_0x8b5a('0x6')](_0x8b5a('0x2c'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x2d')]);router[_0x8b5a('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x8b5a('0x2e')]);router[_0x8b5a('0x6')](_0x8b5a('0x2f'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x30')]);router[_0x8b5a('0x6')](_0x8b5a('0x31'),auth['isAuthenticated'](),controller[_0x8b5a('0x32')]);router['get'](_0x8b5a('0x33'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x34')]);router[_0x8b5a('0x35')](_0x8b5a('0x36'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x37')](_0x8b5a('0x38')));router[_0x8b5a('0x6')](_0x8b5a('0x39'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x3a')]);router[_0x8b5a('0x35')](_0x8b5a('0x3b'),auth[_0x8b5a('0x8')](),controller['queueNotify'](_0x8b5a('0x3c')));router[_0x8b5a('0x6')](_0x8b5a('0x3d'),auth['isAuthenticated'](),controller[_0x8b5a('0x3e')]);router['post'](_0x8b5a('0x3f'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x37')](_0x8b5a('0x40')));router[_0x8b5a('0x6')](_0x8b5a('0x41'),auth['isAuthenticated'](),controller[_0x8b5a('0x42')]);router['post'](_0x8b5a('0x43'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x37')](_0x8b5a('0x44')));router[_0x8b5a('0x6')]('/openchannel/queues/:id',auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x45')]);router[_0x8b5a('0x35')](_0x8b5a('0x46'),auth['isAuthenticated'](),controller[_0x8b5a('0x37')](_0x8b5a('0x47')));router['get'](_0x8b5a('0x48'),auth[_0x8b5a('0x8')](),controller[_0x8b5a('0x49')]);router[_0x8b5a('0x35')](_0x8b5a('0x4a'),auth['isAuthenticated'](),controller[_0x8b5a('0x4b')]);module[_0x8b5a('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 151a580..2f25ddc 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 _0x9f29=['TransferReport','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','chat','User','create','bluebird','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','message','catch','json','sendStatus','name','status','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','then','showVoiceQueues','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','SIP/','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Account','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId'];(function(_0x334699,_0xf3871e){var _0x308a5b=function(_0x2e2ad8){while(--_0x2e2ad8){_0x334699['push'](_0x334699['shift']());}};_0x308a5b(++_0xf3871e);}(_0x9f29,0xd8));var _0x99f2=function(_0x3f94f1,_0x20ae85){_0x3f94f1=_0x3f94f1-0x0;var _0x3cc724=_0x9f29[_0x3f94f1];return _0x3cc724;};'use strict';var BPromise=require(_0x99f2('0x0'));var moment=require(_0x99f2('0x1'));var _=require(_0x99f2('0x2'));var db=require(_0x99f2('0x3'))['db'];var logger=require(_0x99f2('0x4'))('api');var jayson=require(_0x99f2('0x5'));var amiClient=jayson[_0x99f2('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x99f2('0x6')][_0x99f2('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0x99f2('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1698ce,_0xab04c6,_0x2977f9){return new BPromise(function(_0x3a8ae2,_0xd7322c){var _0x4b406b=_0x2977f9?_0x2977f9:amiClient;return _0x4b406b[_0x99f2('0x8')](_0x1698ce,_0xab04c6)['then'](function(_0x102b73){if(_0x102b73[_0x99f2('0x9')]){if(_0x102b73['error']['code']===0x1f4){return _0xd7322c(_0x102b73[_0x99f2('0x9')][_0x99f2('0xa')]);}return _0x3a8ae2(_0x102b73[_0x99f2('0x9')][_0x99f2('0xa')]);}else{_0x3a8ae2(_0x102b73['result']);}})[_0x99f2('0xb')](function(_0x3ad729){_0xd7322c(_0x3ad729);});});}function respondWithResult(_0x10750f,_0x5ae68f){_0x5ae68f=_0x5ae68f||0xc8;return function(_0x4af184){if(_0x4af184){return _0x10750f['status'](_0x5ae68f)[_0x99f2('0xc')](_0x4af184);}return _0x10750f[_0x99f2('0xd')](0x194);};}function handleError(_0x18cef8,_0x25d124){_0x25d124=_0x25d124||0x1f4;return function(_0x58a7dd){logger[_0x99f2('0x9')](_0x58a7dd['stack']);if(_0x58a7dd[_0x99f2('0xe')]){delete _0x58a7dd[_0x99f2('0xe')];}_0x18cef8[_0x99f2('0xf')](_0x25d124)['send'](_0x58a7dd);};}function findById(_0x2fb3fe){return function(_0xf512df){if(!_[_0x99f2('0x10')](_0x2fb3fe)&&!_[_0x99f2('0x10')](_0xf512df)&&!_[_0x99f2('0x10')](_0xf512df[_0x99f2('0x11')])){return _['find'](_0xf512df[_0x99f2('0x11')],function(_0x54c4b5){return _0x54c4b5['id']==_0x2fb3fe;});}return null;};}exports[_0x99f2('0x12')]=function(_0x5153d7,_0x54282f){return respondWithRpcPromise(_0x99f2('0x13'),_0x5153d7[_0x99f2('0x14')])['then'](respondWithResult(_0x54282f,null))[_0x99f2('0xb')](handleError(_0x54282f,null));};exports[_0x99f2('0x15')]=function(_0x28b85b,_0x2e49bc){return respondWithRpcPromise(_0x99f2('0x16'),_[_0x99f2('0x17')](_0x28b85b[_0x99f2('0x14')],_0x28b85b[_0x99f2('0x18')]))['then'](respondWithResult(_0x2e49bc,null))['catch'](handleError(_0x2e49bc,null));};exports['voiceChannelStopMixMonitor']=function(_0x2892ac,_0x466ea9){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x99f2('0x17')](_0x2892ac[_0x99f2('0x14')],_0x2892ac[_0x99f2('0x18')]))[_0x99f2('0x19')](respondWithResult(_0x466ea9,null))[_0x99f2('0xb')](handleError(_0x466ea9,null));};exports['voiceQueues']=function(_0x16e988,_0x590d17){return respondWithRpcPromise('VoiceQueues',_0x16e988[_0x99f2('0x14')])[_0x99f2('0x19')](respondWithResult(_0x590d17,null))[_0x99f2('0xb')](handleError(_0x590d17,null));};exports[_0x99f2('0x1a')]=function(_0x300883,_0x22ac6e){return respondWithRpcPromise(_0x99f2('0x1b'),_0x300883[_0x99f2('0x14')])['then'](findById(_0x300883[_0x99f2('0x18')]['id']))[_0x99f2('0x19')](respondWithResult(_0x22ac6e,null))[_0x99f2('0xb')](handleError(_0x22ac6e,null));};exports[_0x99f2('0x1c')]=function(_0x4f9ca7,_0x48414e){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x99f2('0x17')](_0x4f9ca7[_0x99f2('0x14')],_0x4f9ca7[_0x99f2('0x18')]))[_0x99f2('0x19')](respondWithResult(_0x48414e,null))[_0x99f2('0xb')](handleError(_0x48414e,null));};exports[_0x99f2('0x1d')]=function(_0x572373,_0x5ce335){return respondWithRpcPromise(_0x99f2('0x1e'),_0x572373['query'])[_0x99f2('0x19')](respondWithResult(_0x5ce335,null))['catch'](handleError(_0x5ce335,null));};exports['voiceQueuesChannel']=function(_0x2b937a,_0x6edeb3){return respondWithRpcPromise(_0x99f2('0x1f'),_[_0x99f2('0x17')](_0x2b937a[_0x99f2('0x14')],_0x2b937a[_0x99f2('0x18')]))[_0x99f2('0x19')](respondWithResult(_0x6edeb3,null))[_0x99f2('0xb')](handleError(_0x6edeb3,null));};exports['voiceQueuesChannelHangup']=function(_0x216a49,_0x59b790){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x99f2('0x17')](_0x216a49[_0x99f2('0x14')],_0x216a49[_0x99f2('0x18')]))[_0x99f2('0x19')](respondWithResult(_0x59b790,null))['catch'](handleError(_0x59b790,null));};exports['voiceQueuesChannelRedirect']=function(_0x5529a9,_0x18be36){return respondWithRpcPromise(_0x99f2('0x20'),_['merge'](_0x5529a9[_0x99f2('0x14')],_0x5529a9[_0x99f2('0x18')]))['then'](respondWithResult(_0x18be36,null))[_0x99f2('0xb')](handleError(_0x18be36,null));};exports[_0x99f2('0x21')]=function(_0x34187f,_0x36ecd8){return respondWithRpcPromise(_0x99f2('0x22'),_0x34187f[_0x99f2('0x14')])[_0x99f2('0x19')](respondWithResult(_0x36ecd8,null))[_0x99f2('0xb')](handleError(_0x36ecd8,null));};exports[_0x99f2('0x23')]=function(_0x3de079,_0x559d16){return respondWithRpcPromise(_0x99f2('0x24'),_0x3de079[_0x99f2('0x14')])[_0x99f2('0x19')](respondWithResult(_0x559d16,null))[_0x99f2('0xb')](handleError(_0x559d16,null));};exports['agents']=function(_0x18489f,_0x55896a){var _0x428327;return respondWithRpcPromise(_0x99f2('0x25'),_0x18489f['query'])[_0x99f2('0x19')](function(_0x24e1b7){_0x428327=_0x24e1b7;return respondWithRpcPromise(_0x99f2('0x25'),_0x18489f[_0x99f2('0x14')],routingClient);})[_0x99f2('0x19')](function(_0x369640){return _[_0x99f2('0x17')]({},_0x369640,_0x428327);})[_0x99f2('0x19')](respondWithResult(_0x55896a,null))[_0x99f2('0xb')](handleError(_0x55896a,null));};exports[_0x99f2('0x26')]=function(_0x3a18d9,_0x4c4600){if(_0x3a18d9[_0x99f2('0x27')]&&_0x3a18d9[_0x99f2('0x27')][_0x99f2('0x28')]&&_0x3a18d9['user']&&_0x3a18d9[_0x99f2('0x29')]['name']){for(var _0x563a48 in _0x3a18d9[_0x99f2('0x27')][_0x99f2('0x28')]){if(_0x3a18d9[_0x99f2('0x27')][_0x99f2('0x28')]['hasOwnProperty'](_0x563a48)){db[_0x99f2('0x2a')][_0x99f2('0x2b')]({'where':{'channel':_0x563a48,'membername':_0x3a18d9['user'][_0x99f2('0xe')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3a18d9[_0x99f2('0x27')][_0x99f2('0x28')][_0x563a48]&&_0x3a18d9['body'][_0x99f2('0x28')][_0x563a48][_0x99f2('0x2c')]?{'$notIn':_0x3a18d9[_0x99f2('0x27')][_0x99f2('0x28')][_0x563a48]}:{'$ne':null}}})[_0x99f2('0x19')](function(_0x2e4a94){var _0x471dcf=moment()[_0x99f2('0x2d')](_0x99f2('0x2e'));for(var _0x13a763=0x0,_0x110572=_0x2e4a94['length'];_0x13a763<_0x110572;_0x13a763+=0x1){_0x2e4a94[_0x13a763][_0x99f2('0x2f')]({'exitAt':_0x471dcf});}});for(var _0x321ebf=0x0;_0x321ebf<_0x3a18d9[_0x99f2('0x27')][_0x99f2('0x28')][_0x563a48][_0x99f2('0x2c')];_0x321ebf+=0x1){db['MemberReport'][_0x99f2('0x30')]({'where':{'channel':_0x563a48,'membername':_0x3a18d9[_0x99f2('0x29')][_0x99f2('0xe')],'type':_0x99f2('0x31'),'uniqueid':_0x3a18d9[_0x99f2('0x27')][_0x99f2('0x28')][_0x563a48][_0x321ebf],'exitAt':null},'defaults':{'channel':_0x563a48,'membername':_0x3a18d9['user'][_0x99f2('0xe')],'interface':_0x99f2('0x32')+_0x3a18d9[_0x99f2('0x29')][_0x99f2('0xe')],'type':'INTERACTION','enterAt':moment()['format'](_0x99f2('0x2e')),'role':'agent','internal':_0x3a18d9[_0x99f2('0x29')]['internal'],'uniqueid':_0x3a18d9[_0x99f2('0x27')]['interaction'][_0x563a48][_0x321ebf]}});}}}}return respondWithRpcPromise(_0x99f2('0x33'),{'id':_0x3a18d9[_0x99f2('0x18')]['id'],'capacity':_0x3a18d9[_0x99f2('0x27')][_0x99f2('0x34')]},routingClient)[_0x99f2('0x19')](respondWithResult(_0x4c4600,null))[_0x99f2('0xb')](handleError(_0x4c4600,null));};exports[_0x99f2('0x35')]=function(_0x414b1d,_0x2530e1){return respondWithRpcPromise(_0x99f2('0x36'),_0x414b1d[_0x99f2('0x14')])[_0x99f2('0x19')](respondWithResult(_0x2530e1,null))[_0x99f2('0xb')](handleError(_0x2530e1,null));};exports[_0x99f2('0x37')]=function(_0xf9846d,_0x2d5c7f){return respondWithRpcPromise(_0x99f2('0x38'),_0xf9846d[_0x99f2('0x14')])['then'](respondWithResult(_0x2d5c7f,null))[_0x99f2('0xb')](handleError(_0x2d5c7f,null));};exports[_0x99f2('0x39')]=function(_0x4e143a,_0x58ac4c){return respondWithRpcPromise(_0x99f2('0x3a'),_0x4e143a[_0x99f2('0x14')])[_0x99f2('0x19')](respondWithResult(_0x58ac4c,null))[_0x99f2('0xb')](handleError(_0x58ac4c,null));};exports['chatQueues']=function(_0x142c97,_0xcc82dd){return respondWithRpcPromise(_0x99f2('0x3b'),_0x142c97['query'],routingClient)['then'](respondWithResult(_0xcc82dd,null))[_0x99f2('0xb')](handleError(_0xcc82dd,null));};exports[_0x99f2('0x3c')]=function(_0x51a55c,_0x486362){return respondWithRpcPromise('ChatQueues',_0x51a55c['query'],routingClient)['then'](findById(_0x51a55c['params']['id']))[_0x99f2('0x19')](respondWithResult(_0x486362,null))['catch'](handleError(_0x486362,null));};exports['mailQueues']=function(_0x5ad22e,_0x394162){return respondWithRpcPromise(_0x99f2('0x3d'),_0x5ad22e[_0x99f2('0x14')],routingClient)[_0x99f2('0x19')](respondWithResult(_0x394162,null))[_0x99f2('0xb')](handleError(_0x394162,null));};exports[_0x99f2('0x3e')]=function(_0x4a21aa,_0x4ea400){return respondWithRpcPromise(_0x99f2('0x3d'),_0x4a21aa['query'],routingClient)[_0x99f2('0x19')](findById(_0x4a21aa[_0x99f2('0x18')]['id']))[_0x99f2('0x19')](respondWithResult(_0x4ea400,null))['catch'](handleError(_0x4ea400,null));};exports[_0x99f2('0x3f')]=function(_0x50381a,_0x379f8b){return respondWithRpcPromise(_0x99f2('0x40'),_0x50381a[_0x99f2('0x14')],mailClient)[_0x99f2('0x19')](respondWithResult(_0x379f8b,null))['catch'](handleError(_0x379f8b,null));};exports[_0x99f2('0x41')]=function(_0x18eff4,_0x850926){return respondWithRpcPromise(_0x99f2('0x42'),_0x18eff4[_0x99f2('0x14')],routingClient)['then'](respondWithResult(_0x850926,null))[_0x99f2('0xb')](handleError(_0x850926,null));};exports[_0x99f2('0x43')]=function(_0x23149d,_0x387028){return respondWithRpcPromise('OpenchannelQueues',_0x23149d['query'],routingClient)[_0x99f2('0x19')](findById(_0x23149d[_0x99f2('0x18')]['id']))[_0x99f2('0x19')](respondWithResult(_0x387028,null))[_0x99f2('0xb')](handleError(_0x387028,null));};exports[_0x99f2('0x44')]=function(_0x22226b,_0x4b0509){return respondWithRpcPromise(_0x99f2('0x45'),_0x22226b[_0x99f2('0x14')],routingClient)[_0x99f2('0x19')](respondWithResult(_0x4b0509,null))[_0x99f2('0xb')](handleError(_0x4b0509,null));};exports[_0x99f2('0x46')]=function(_0x369d81,_0x39ee5e){return respondWithRpcPromise(_0x99f2('0x45'),_0x369d81[_0x99f2('0x14')],routingClient)['then'](findById(_0x369d81[_0x99f2('0x18')]['id']))['then'](respondWithResult(_0x39ee5e,null))[_0x99f2('0xb')](handleError(_0x39ee5e,null));};exports[_0x99f2('0x47')]=function(_0x1ddaf1,_0x85e03f){return respondWithRpcPromise(_0x99f2('0x48'),_0x1ddaf1[_0x99f2('0x14')],routingClient)[_0x99f2('0x19')](respondWithResult(_0x85e03f,null))['catch'](handleError(_0x85e03f,null));};exports[_0x99f2('0x49')]=function(_0x1cccce,_0x10da17){return respondWithRpcPromise(_0x99f2('0x48'),_0x1cccce[_0x99f2('0x14')],routingClient)['then'](findById(_0x1cccce[_0x99f2('0x18')]['id']))[_0x99f2('0x19')](respondWithResult(_0x10da17,null))[_0x99f2('0xb')](handleError(_0x10da17,null));};exports['faxAccounts']=function(_0x3b592a,_0x1ea1c7){return respondWithRpcPromise(_0x99f2('0x4a'),_0x3b592a[_0x99f2('0x14')])[_0x99f2('0x19')](respondWithResult(_0x1ea1c7,null))[_0x99f2('0xb')](handleError(_0x1ea1c7,null));};exports[_0x99f2('0x4b')]=function(_0x3843db,_0x45c59b){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3843db[_0x99f2('0x14')],routingClient)[_0x99f2('0x19')](respondWithResult(_0x45c59b,null))[_0x99f2('0xb')](handleError(_0x45c59b,null));};exports[_0x99f2('0x4c')]=function(_0x20cee6,_0x54e924){return respondWithRpcPromise(_0x99f2('0x4d'),_0x20cee6[_0x99f2('0x14')],routingClient)[_0x99f2('0x19')](respondWithResult(_0x54e924,null))['catch'](handleError(_0x54e924,null));};exports[_0x99f2('0x4e')]=function(_0x111701,_0x103eaf){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x111701[_0x99f2('0x14')],routingClient)['then'](respondWithResult(_0x103eaf,null))[_0x99f2('0xb')](handleError(_0x103eaf,null));};exports['smsQueuesWaitingInteractions']=function(_0x405cdd,_0x36df7b){return respondWithRpcPromise(_0x99f2('0x4f'),_0x405cdd[_0x99f2('0x14')],routingClient)['then'](respondWithResult(_0x36df7b,null))[_0x99f2('0xb')](handleError(_0x36df7b,null));};exports[_0x99f2('0x50')]=function(_0x50ebfa,_0xb654b){return respondWithRpcPromise(_0x99f2('0x51'),_0x50ebfa['query'],routingClient)['then'](respondWithResult(_0xb654b,null))[_0x99f2('0xb')](handleError(_0xb654b,null));};exports['queueNotify']=function(_0x13566a){return function(_0x5e6507,_0x4fe4a6){var _0x12703c,_0x498eec;var _0x138e2f=_[_0x99f2('0x52')](_0x13566a);var _0x1189a9=_0x13566a==='chat'?_0x99f2('0x53'):_0x99f2('0x54');return db[_0x138e2f+'Queue'][_0x99f2('0x55')]({'raw':!![],'where':{'id':_0x5e6507[_0x99f2('0x18')]['id']}})[_0x99f2('0x19')](function(_0x16a031){if(_[_0x99f2('0x10')](_0x16a031)){throw new Error(_0x138e2f+'\x20Queue\x20not\x20found');}_0x12703c=_0x16a031;return db[_0x138e2f+_0x99f2('0x56')][_0x99f2('0x55')]({'where':{'id':_0x5e6507['body'][_0x99f2('0x57')]},'include':[{'model':db[_0x138e2f+_0x99f2('0x58')],'as':_0x99f2('0x58')},{'model':db[_0x138e2f+_0x1189a9],'as':_0x99f2('0x54')}]});})[_0x99f2('0x19')](function(_0x29b1af){if(_[_0x99f2('0x10')](_0x29b1af)){throw new Error(_0x138e2f+_0x99f2('0x59'));}_0x498eec=_0x29b1af;return _0x29b1af[_0x99f2('0x5a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x99f2('0x19')](function(){var _0x5cfcaf={'uniqueid':_0x13566a+'.'+_0x498eec['id']+'.'+_0x498eec[_0x99f2('0x58')]['id'],'FromUserId':_0x5e6507['user']['id'],'type':_0x99f2('0x5b')};_0x5cfcaf[_0x138e2f+_0x99f2('0x5c')]=_0x498eec['id'];_0x5cfcaf[_0x138e2f+_0x99f2('0x5d')]=_0x498eec[_0x99f2('0x58')]['id'];_0x5cfcaf[_0x99f2('0x5e')+_0x138e2f+_0x1189a9+'Id']=_0x498eec[_0x99f2('0x54')]['id'];_0x5cfcaf['To'+_0x138e2f+_0x99f2('0x5f')]=_0x12703c['id'];return db[_0x138e2f+_0x99f2('0x60')]['create'](_0x5cfcaf);})[_0x99f2('0x19')](function(){return respondWithRpcPromise('Start',{'channel':_0x13566a,'interaction':_0x498eec[_0x99f2('0x58')],'message':_0x498eec,'account':_0x498eec[_0x99f2('0x54')],'applications':[{'id':0x0,'priority':0x1,'app':_0x99f2('0x5b'),'appdata':_0x12703c['name']+','+(_0x498eec[_0x99f2('0x54')][_0x99f2('0x61')]||0x12c),'interval':_0x99f2('0x62')}]},routingClient);})[_0x99f2('0x19')](respondWithResult(_0x4fe4a6,null))[_0x99f2('0xb')](handleError(_0x4fe4a6,null));};};exports['agentNotify']=function(_0x40bee6,_0x44d7d5){var _0x3b1b17,_0xe25f53;if(_['isNil'](_0x40bee6[_0x99f2('0x27')][_0x99f2('0x63')])){throw new Error(_0x99f2('0x64'));}var _0x26f6ca=_0x40bee6[_0x99f2('0x27')]['channel'];var _0x40faa7=_[_0x99f2('0x52')](_0x26f6ca);var _0x5bd3ca=_0x26f6ca===_0x99f2('0x65')?_0x99f2('0x53'):_0x99f2('0x54');return db[_0x99f2('0x66')][_0x99f2('0x55')]({'raw':!![],'where':{'id':_0x40bee6[_0x99f2('0x18')]['id'],'role':'agent'}})['then'](function(_0x4c569f){if(_['isNil'](_0x4c569f)){throw new Error('Agent\x20not\x20found');}_0x3b1b17=_0x4c569f;return db[_0x40faa7+_0x99f2('0x56')][_0x99f2('0x55')]({'where':{'id':_0x40bee6['body'][_0x99f2('0x57')]},'include':[{'model':db[_0x40faa7+_0x99f2('0x58')],'as':'Interaction'},{'model':db[_0x40faa7+_0x5bd3ca],'as':_0x99f2('0x54')}]});})[_0x99f2('0x19')](function(_0x3cc473){if(_[_0x99f2('0x10')](_0x3cc473)){throw new Error(_0x40faa7+_0x99f2('0x59'));}_0xe25f53=_0x3cc473;return _0x3cc473['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x99f2('0x19')](function(){var _0x2e6765={'uniqueid':_0x26f6ca+'.'+_0xe25f53['id']+'.'+_0xe25f53[_0x99f2('0x58')]['id'],'FromUserId':_0x40bee6[_0x99f2('0x29')]['id'],'type':_0x99f2('0x5b'),'ToUserId':_0x3b1b17['id']};_0x2e6765[_0x40faa7+_0x99f2('0x5c')]=_0xe25f53['id'];_0x2e6765[_0x40faa7+_0x99f2('0x5d')]=_0xe25f53['Interaction']['id'];_0x2e6765[_0x99f2('0x5e')+_0x40faa7+_0x5bd3ca+'Id']=_0xe25f53[_0x99f2('0x54')]['id'];return db[_0x40faa7+_0x99f2('0x60')][_0x99f2('0x67')](_0x2e6765);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x26f6ca,'interaction':_0xe25f53[_0x99f2('0x58')],'message':_0xe25f53,'account':_0xe25f53[_0x99f2('0x54')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3b1b17[_0x99f2('0xe')]+','+(_0xe25f53['Account']['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x99f2('0x19')](respondWithResult(_0x44d7d5,null))[_0x99f2('0xb')](handleError(_0x44d7d5,null));}; \ No newline at end of file +var _0x7cce=['smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','Message','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','create','Start','queueTransferTimeout','*,*,*,*','channel','User','Agent\x20not\x20found','messageId','TransferReport','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','agent','internal','AgentCapacity','telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues'];(function(_0x347d4b,_0x2e31c8){var _0x54b62a=function(_0x184ba5){while(--_0x184ba5){_0x347d4b['push'](_0x347d4b['shift']());}};_0x54b62a(++_0x2e31c8);}(_0x7cce,0x108));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xe7cc('0x0'));var moment=require(_0xe7cc('0x1'));var _=require(_0xe7cc('0x2'));var db=require(_0xe7cc('0x3'))['db'];var logger=require('../../config/logger')(_0xe7cc('0x4'));var jayson=require(_0xe7cc('0x5'));var amiClient=jayson['client'][_0xe7cc('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0xe7cc('0x6')]({'port':0x232b});var routingClient=jayson[_0xe7cc('0x7')][_0xe7cc('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x420736,_0xe26ebf,_0x1e6d1e){return new BPromise(function(_0x27078f,_0x48b22f){var _0x3f9c1a=_0x1e6d1e?_0x1e6d1e:amiClient;return _0x3f9c1a[_0xe7cc('0x8')](_0x420736,_0xe26ebf)[_0xe7cc('0x9')](function(_0x4ffd1b){if(_0x4ffd1b['error']){if(_0x4ffd1b[_0xe7cc('0xa')][_0xe7cc('0xb')]===0x1f4){return _0x48b22f(_0x4ffd1b[_0xe7cc('0xa')][_0xe7cc('0xc')]);}return _0x27078f(_0x4ffd1b[_0xe7cc('0xa')][_0xe7cc('0xc')]);}else{_0x27078f(_0x4ffd1b[_0xe7cc('0xd')]);}})[_0xe7cc('0xe')](function(_0x5549ed){_0x48b22f(_0x5549ed);});});}function respondWithResult(_0x8b0294,_0x5cbfd7){_0x5cbfd7=_0x5cbfd7||0xc8;return function(_0x723051){if(_0x723051){return _0x8b0294[_0xe7cc('0xf')](_0x5cbfd7)[_0xe7cc('0x10')](_0x723051);}return _0x8b0294[_0xe7cc('0x11')](0x194);};}function handleError(_0x595a01,_0x3639ea){_0x3639ea=_0x3639ea||0x1f4;return function(_0x1534a3){logger[_0xe7cc('0xa')](_0x1534a3[_0xe7cc('0x12')]);if(_0x1534a3[_0xe7cc('0x13')]){delete _0x1534a3[_0xe7cc('0x13')];}_0x595a01[_0xe7cc('0xf')](_0x3639ea)[_0xe7cc('0x14')](_0x1534a3);};}function findById(_0x4f0e96){return function(_0x19461f){if(!_[_0xe7cc('0x15')](_0x4f0e96)&&!_[_0xe7cc('0x15')](_0x19461f)&&!_[_0xe7cc('0x15')](_0x19461f['rows'])){return _[_0xe7cc('0x16')](_0x19461f[_0xe7cc('0x17')],function(_0x4b7ec1){return _0x4b7ec1['id']==_0x4f0e96;});}return null;};}exports['voiceChannels']=function(_0x7a180,_0x309d33){return respondWithRpcPromise(_0xe7cc('0x18'),_0x7a180[_0xe7cc('0x19')])[_0xe7cc('0x9')](respondWithResult(_0x309d33,null))[_0xe7cc('0xe')](handleError(_0x309d33,null));};exports[_0xe7cc('0x1a')]=function(_0x50bbc5,_0x2c88e5){return respondWithRpcPromise(_0xe7cc('0x1b'),_[_0xe7cc('0x1c')](_0x50bbc5[_0xe7cc('0x19')],_0x50bbc5[_0xe7cc('0x1d')]))[_0xe7cc('0x9')](respondWithResult(_0x2c88e5,null))[_0xe7cc('0xe')](handleError(_0x2c88e5,null));};exports[_0xe7cc('0x1e')]=function(_0x1226d3,_0x17bf76){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xe7cc('0x1c')](_0x1226d3[_0xe7cc('0x19')],_0x1226d3[_0xe7cc('0x1d')]))[_0xe7cc('0x9')](respondWithResult(_0x17bf76,null))[_0xe7cc('0xe')](handleError(_0x17bf76,null));};exports[_0xe7cc('0x1f')]=function(_0x20cfe6,_0x554502){return respondWithRpcPromise(_0xe7cc('0x20'),_0x20cfe6['query'])[_0xe7cc('0x9')](respondWithResult(_0x554502,null))['catch'](handleError(_0x554502,null));};exports[_0xe7cc('0x21')]=function(_0x4d337f,_0x22118f){return respondWithRpcPromise(_0xe7cc('0x20'),_0x4d337f[_0xe7cc('0x19')])[_0xe7cc('0x9')](findById(_0x4d337f['params']['id']))[_0xe7cc('0x9')](respondWithResult(_0x22118f,null))[_0xe7cc('0xe')](handleError(_0x22118f,null));};exports[_0xe7cc('0x22')]=function(_0xb3c4e3,_0x3a2db1){return respondWithRpcPromise(_0xe7cc('0x23'),_[_0xe7cc('0x1c')](_0xb3c4e3[_0xe7cc('0x19')],_0xb3c4e3[_0xe7cc('0x1d')]))['then'](respondWithResult(_0x3a2db1,null))['catch'](handleError(_0x3a2db1,null));};exports[_0xe7cc('0x24')]=function(_0x1c56ca,_0x2e9ab8){return respondWithRpcPromise(_0xe7cc('0x25'),_0x1c56ca[_0xe7cc('0x19')])[_0xe7cc('0x9')](respondWithResult(_0x2e9ab8,null))[_0xe7cc('0xe')](handleError(_0x2e9ab8,null));};exports[_0xe7cc('0x26')]=function(_0x5b6b50,_0x1213d0){return respondWithRpcPromise(_0xe7cc('0x27'),_[_0xe7cc('0x1c')](_0x5b6b50[_0xe7cc('0x19')],_0x5b6b50[_0xe7cc('0x1d')]))[_0xe7cc('0x9')](respondWithResult(_0x1213d0,null))[_0xe7cc('0xe')](handleError(_0x1213d0,null));};exports[_0xe7cc('0x28')]=function(_0xb40895,_0xd14cd2){return respondWithRpcPromise(_0xe7cc('0x29'),_['merge'](_0xb40895[_0xe7cc('0x19')],_0xb40895[_0xe7cc('0x1d')]))[_0xe7cc('0x9')](respondWithResult(_0xd14cd2,null))[_0xe7cc('0xe')](handleError(_0xd14cd2,null));};exports['voiceQueuesChannelRedirect']=function(_0x39ea76,_0x5d17d2){return respondWithRpcPromise(_0xe7cc('0x2a'),_[_0xe7cc('0x1c')](_0x39ea76['query'],_0x39ea76[_0xe7cc('0x1d')]))[_0xe7cc('0x9')](respondWithResult(_0x5d17d2,null))[_0xe7cc('0xe')](handleError(_0x5d17d2,null));};exports['outbound']=function(_0xa51ac5,_0x40c2e6){return respondWithRpcPromise(_0xe7cc('0x2b'),_0xa51ac5[_0xe7cc('0x19')])[_0xe7cc('0x9')](respondWithResult(_0x40c2e6,null))[_0xe7cc('0xe')](handleError(_0x40c2e6,null));};exports[_0xe7cc('0x2c')]=function(_0x423b67,_0x5e73f6){return respondWithRpcPromise(_0xe7cc('0x2d'),_0x423b67[_0xe7cc('0x19')])['then'](respondWithResult(_0x5e73f6,null))[_0xe7cc('0xe')](handleError(_0x5e73f6,null));};exports['agents']=function(_0x2f7271,_0x40ad2){var _0x27093e;return respondWithRpcPromise(_0xe7cc('0x2e'),_0x2f7271[_0xe7cc('0x19')])['then'](function(_0x5555cf){_0x27093e=_0x5555cf;return respondWithRpcPromise(_0xe7cc('0x2e'),_0x2f7271['query'],routingClient);})[_0xe7cc('0x9')](function(_0x7d169e){return _[_0xe7cc('0x1c')]({},_0x7d169e,_0x27093e);})[_0xe7cc('0x9')](respondWithResult(_0x40ad2,null))[_0xe7cc('0xe')](handleError(_0x40ad2,null));};exports[_0xe7cc('0x2f')]=function(_0xabef00,_0x31d684){if(_0xabef00[_0xe7cc('0x30')]&&_0xabef00[_0xe7cc('0x30')][_0xe7cc('0x31')]&&_0xabef00[_0xe7cc('0x32')]&&_0xabef00['user'][_0xe7cc('0x13')]){for(var _0x235022 in _0xabef00[_0xe7cc('0x30')][_0xe7cc('0x31')]){if(_0xabef00[_0xe7cc('0x30')]['interaction'][_0xe7cc('0x33')](_0x235022)){db[_0xe7cc('0x34')]['findAll']({'where':{'channel':_0x235022,'membername':_0xabef00[_0xe7cc('0x32')]['name'],'type':_0xe7cc('0x35'),'exitAt':null,'uniqueid':_0xabef00[_0xe7cc('0x30')][_0xe7cc('0x31')][_0x235022]&&_0xabef00[_0xe7cc('0x30')]['interaction'][_0x235022][_0xe7cc('0x36')]?{'$notIn':_0xabef00[_0xe7cc('0x30')][_0xe7cc('0x31')][_0x235022]}:{'$ne':null}}})[_0xe7cc('0x9')](function(_0x5d2560){var _0x4140cb=moment()[_0xe7cc('0x37')](_0xe7cc('0x38'));for(var _0x4a2166=0x0,_0x2fab9d=_0x5d2560[_0xe7cc('0x36')];_0x4a2166<_0x2fab9d;_0x4a2166+=0x1){_0x5d2560[_0x4a2166][_0xe7cc('0x39')]({'exitAt':_0x4140cb});}});for(var _0x4454be=0x0;_0x4454be<_0xabef00[_0xe7cc('0x30')][_0xe7cc('0x31')][_0x235022][_0xe7cc('0x36')];_0x4454be+=0x1){db[_0xe7cc('0x34')][_0xe7cc('0x3a')]({'where':{'channel':_0x235022,'membername':_0xabef00['user']['name'],'type':_0xe7cc('0x35'),'uniqueid':_0xabef00[_0xe7cc('0x30')][_0xe7cc('0x31')][_0x235022][_0x4454be],'exitAt':null},'defaults':{'channel':_0x235022,'membername':_0xabef00[_0xe7cc('0x32')][_0xe7cc('0x13')],'interface':'SIP/'+_0xabef00[_0xe7cc('0x32')]['name'],'type':_0xe7cc('0x35'),'enterAt':moment()[_0xe7cc('0x37')](_0xe7cc('0x38')),'role':_0xe7cc('0x3b'),'internal':_0xabef00['user'][_0xe7cc('0x3c')],'uniqueid':_0xabef00[_0xe7cc('0x30')][_0xe7cc('0x31')][_0x235022][_0x4454be]}});}}}}return respondWithRpcPromise(_0xe7cc('0x3d'),{'id':_0xabef00[_0xe7cc('0x1d')]['id'],'capacity':_0xabef00[_0xe7cc('0x30')]['capacity']},routingClient)[_0xe7cc('0x9')](respondWithResult(_0x31d684,null))['catch'](handleError(_0x31d684,null));};exports[_0xe7cc('0x3e')]=function(_0xd18feb,_0x571b57){return respondWithRpcPromise('Telephones',_0xd18feb[_0xe7cc('0x19')])[_0xe7cc('0x9')](respondWithResult(_0x571b57,null))['catch'](handleError(_0x571b57,null));};exports[_0xe7cc('0x3f')]=function(_0x40cc95,_0x5139ce){return respondWithRpcPromise(_0xe7cc('0x40'),_0x40cc95[_0xe7cc('0x19')])[_0xe7cc('0x9')](respondWithResult(_0x5139ce,null))[_0xe7cc('0xe')](handleError(_0x5139ce,null));};exports['campaigns']=function(_0x41aa2d,_0x4c84b7){return respondWithRpcPromise(_0xe7cc('0x41'),_0x41aa2d[_0xe7cc('0x19')])[_0xe7cc('0x9')](respondWithResult(_0x4c84b7,null))['catch'](handleError(_0x4c84b7,null));};exports[_0xe7cc('0x42')]=function(_0x2cb1f2,_0x59496e){return respondWithRpcPromise(_0xe7cc('0x43'),_0x2cb1f2[_0xe7cc('0x19')],routingClient)['then'](respondWithResult(_0x59496e,null))[_0xe7cc('0xe')](handleError(_0x59496e,null));};exports[_0xe7cc('0x44')]=function(_0x60458a,_0x3f2ade){return respondWithRpcPromise(_0xe7cc('0x43'),_0x60458a['query'],routingClient)['then'](findById(_0x60458a['params']['id']))[_0xe7cc('0x9')](respondWithResult(_0x3f2ade,null))['catch'](handleError(_0x3f2ade,null));};exports[_0xe7cc('0x45')]=function(_0x33a0f2,_0x252324){return respondWithRpcPromise(_0xe7cc('0x46'),_0x33a0f2[_0xe7cc('0x19')],routingClient)[_0xe7cc('0x9')](respondWithResult(_0x252324,null))[_0xe7cc('0xe')](handleError(_0x252324,null));};exports['showMailQueues']=function(_0x3a9860,_0x118938){return respondWithRpcPromise(_0xe7cc('0x46'),_0x3a9860[_0xe7cc('0x19')],routingClient)[_0xe7cc('0x9')](findById(_0x3a9860[_0xe7cc('0x1d')]['id']))[_0xe7cc('0x9')](respondWithResult(_0x118938,null))['catch'](handleError(_0x118938,null));};exports[_0xe7cc('0x47')]=function(_0x5f46d7,_0x201d7f){return respondWithRpcPromise('MailAccounts',_0x5f46d7[_0xe7cc('0x19')],mailClient)['then'](respondWithResult(_0x201d7f,null))[_0xe7cc('0xe')](handleError(_0x201d7f,null));};exports[_0xe7cc('0x48')]=function(_0x37d0ea,_0xadda1d){return respondWithRpcPromise('OpenchannelQueues',_0x37d0ea[_0xe7cc('0x19')],routingClient)[_0xe7cc('0x9')](respondWithResult(_0xadda1d,null))[_0xe7cc('0xe')](handleError(_0xadda1d,null));};exports[_0xe7cc('0x49')]=function(_0x6e6fea,_0x12bbf8){return respondWithRpcPromise(_0xe7cc('0x4a'),_0x6e6fea['query'],routingClient)[_0xe7cc('0x9')](findById(_0x6e6fea[_0xe7cc('0x1d')]['id']))[_0xe7cc('0x9')](respondWithResult(_0x12bbf8,null))['catch'](handleError(_0x12bbf8,null));};exports[_0xe7cc('0x4b')]=function(_0x1256ec,_0x119b89){return respondWithRpcPromise(_0xe7cc('0x4c'),_0x1256ec[_0xe7cc('0x19')],routingClient)[_0xe7cc('0x9')](respondWithResult(_0x119b89,null))[_0xe7cc('0xe')](handleError(_0x119b89,null));};exports[_0xe7cc('0x4d')]=function(_0x516cf3,_0xa5f536){return respondWithRpcPromise(_0xe7cc('0x4c'),_0x516cf3[_0xe7cc('0x19')],routingClient)['then'](findById(_0x516cf3[_0xe7cc('0x1d')]['id']))[_0xe7cc('0x9')](respondWithResult(_0xa5f536,null))[_0xe7cc('0xe')](handleError(_0xa5f536,null));};exports[_0xe7cc('0x4e')]=function(_0x1fd0ab,_0x1e1f89){return respondWithRpcPromise(_0xe7cc('0x4f'),_0x1fd0ab[_0xe7cc('0x19')],routingClient)[_0xe7cc('0x9')](respondWithResult(_0x1e1f89,null))[_0xe7cc('0xe')](handleError(_0x1e1f89,null));};exports[_0xe7cc('0x50')]=function(_0xb9474f,_0x5204e6){return respondWithRpcPromise(_0xe7cc('0x4f'),_0xb9474f['query'],routingClient)['then'](findById(_0xb9474f[_0xe7cc('0x1d')]['id']))[_0xe7cc('0x9')](respondWithResult(_0x5204e6,null))[_0xe7cc('0xe')](handleError(_0x5204e6,null));};exports['faxAccounts']=function(_0x339012,_0x53966c){return respondWithRpcPromise('FaxAccounts',_0x339012[_0xe7cc('0x19')])[_0xe7cc('0x9')](respondWithResult(_0x53966c,null))['catch'](handleError(_0x53966c,null));};exports['chatQueuesWaitingInteractions']=function(_0x1761f7,_0x13ba56){return respondWithRpcPromise(_0xe7cc('0x51'),_0x1761f7[_0xe7cc('0x19')],routingClient)['then'](respondWithResult(_0x13ba56,null))[_0xe7cc('0xe')](handleError(_0x13ba56,null));};exports[_0xe7cc('0x52')]=function(_0x950ecf,_0xc06181){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x950ecf[_0xe7cc('0x19')],routingClient)[_0xe7cc('0x9')](respondWithResult(_0xc06181,null))[_0xe7cc('0xe')](handleError(_0xc06181,null));};exports[_0xe7cc('0x53')]=function(_0x30ceb1,_0x11734e){return respondWithRpcPromise(_0xe7cc('0x54'),_0x30ceb1[_0xe7cc('0x19')],routingClient)[_0xe7cc('0x9')](respondWithResult(_0x11734e,null))[_0xe7cc('0xe')](handleError(_0x11734e,null));};exports[_0xe7cc('0x55')]=function(_0x4d522a,_0x4d2ab0){return respondWithRpcPromise(_0xe7cc('0x56'),_0x4d522a['query'],routingClient)[_0xe7cc('0x9')](respondWithResult(_0x4d2ab0,null))[_0xe7cc('0xe')](handleError(_0x4d2ab0,null));};exports[_0xe7cc('0x57')]=function(_0x21db0d,_0x5d8464){return respondWithRpcPromise(_0xe7cc('0x58'),_0x21db0d[_0xe7cc('0x19')],routingClient)[_0xe7cc('0x9')](respondWithResult(_0x5d8464,null))['catch'](handleError(_0x5d8464,null));};exports[_0xe7cc('0x59')]=function(_0x2b920b){return function(_0x2f2c3b,_0x8b7d2e){var _0x2ce524,_0x2571ce;var _0x4d0a67=_[_0xe7cc('0x5a')](_0x2b920b);var _0x5691a4=_0x2b920b===_0xe7cc('0x5b')?_0xe7cc('0x5c'):_0xe7cc('0x5d');return db[_0x4d0a67+_0xe7cc('0x5e')][_0xe7cc('0x5f')]({'raw':!![],'where':{'id':_0x2f2c3b[_0xe7cc('0x1d')]['id']}})[_0xe7cc('0x9')](function(_0x324214){if(_[_0xe7cc('0x15')](_0x324214)){throw new Error(_0x4d0a67+'\x20Queue\x20not\x20found');}_0x2ce524=_0x324214;return db[_0x4d0a67+_0xe7cc('0x60')][_0xe7cc('0x5f')]({'where':{'id':_0x2f2c3b['body']['messageId']},'include':[{'model':db[_0x4d0a67+_0xe7cc('0x61')],'as':_0xe7cc('0x61')},{'model':db[_0x4d0a67+_0x5691a4],'as':_0xe7cc('0x5d')}]});})[_0xe7cc('0x9')](function(_0x25a710){if(_[_0xe7cc('0x15')](_0x25a710)){throw new Error(_0x4d0a67+_0xe7cc('0x62'));}_0x2571ce=_0x25a710;return _0x25a710['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2ba009={'uniqueid':_0x2b920b+'.'+_0x2571ce['id']+'.'+_0x2571ce[_0xe7cc('0x61')]['id'],'FromUserId':_0x2f2c3b[_0xe7cc('0x32')]['id'],'type':_0xe7cc('0x63')};_0x2ba009[_0x4d0a67+_0xe7cc('0x64')]=_0x2571ce['id'];_0x2ba009[_0x4d0a67+_0xe7cc('0x65')]=_0x2571ce['Interaction']['id'];_0x2ba009[_0xe7cc('0x66')+_0x4d0a67+_0x5691a4+'Id']=_0x2571ce[_0xe7cc('0x5d')]['id'];_0x2ba009['To'+_0x4d0a67+'QueueId']=_0x2ce524['id'];return db[_0x4d0a67+'TransferReport'][_0xe7cc('0x67')](_0x2ba009);})[_0xe7cc('0x9')](function(){return respondWithRpcPromise(_0xe7cc('0x68'),{'channel':_0x2b920b,'interaction':_0x2571ce[_0xe7cc('0x61')],'message':_0x2571ce,'account':_0x2571ce[_0xe7cc('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7cc('0x63'),'appdata':_0x2ce524[_0xe7cc('0x13')]+','+(_0x2571ce['Account'][_0xe7cc('0x69')]||0x12c),'interval':_0xe7cc('0x6a')}]},routingClient);})['then'](respondWithResult(_0x8b7d2e,null))[_0xe7cc('0xe')](handleError(_0x8b7d2e,null));};};exports['agentNotify']=function(_0x577fd4,_0x173874){var _0x36291b,_0x43abec;if(_[_0xe7cc('0x15')](_0x577fd4[_0xe7cc('0x30')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4f650a=_0x577fd4[_0xe7cc('0x30')][_0xe7cc('0x6b')];var _0x2ed229=_[_0xe7cc('0x5a')](_0x4f650a);var _0x1ea86d=_0x4f650a===_0xe7cc('0x5b')?'Website':_0xe7cc('0x5d');return db[_0xe7cc('0x6c')][_0xe7cc('0x5f')]({'raw':!![],'where':{'id':_0x577fd4[_0xe7cc('0x1d')]['id'],'role':_0xe7cc('0x3b')}})[_0xe7cc('0x9')](function(_0x11f3d3){if(_['isNil'](_0x11f3d3)){throw new Error(_0xe7cc('0x6d'));}_0x36291b=_0x11f3d3;return db[_0x2ed229+_0xe7cc('0x60')][_0xe7cc('0x5f')]({'where':{'id':_0x577fd4[_0xe7cc('0x30')][_0xe7cc('0x6e')]},'include':[{'model':db[_0x2ed229+_0xe7cc('0x61')],'as':_0xe7cc('0x61')},{'model':db[_0x2ed229+_0x1ea86d],'as':_0xe7cc('0x5d')}]});})[_0xe7cc('0x9')](function(_0x48eb64){if(_[_0xe7cc('0x15')](_0x48eb64)){throw new Error(_0x2ed229+_0xe7cc('0x62'));}_0x43abec=_0x48eb64;return _0x48eb64['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xe7cc('0x9')](function(){var _0x14fd6d={'uniqueid':_0x4f650a+'.'+_0x43abec['id']+'.'+_0x43abec[_0xe7cc('0x61')]['id'],'FromUserId':_0x577fd4[_0xe7cc('0x32')]['id'],'type':_0xe7cc('0x63'),'ToUserId':_0x36291b['id']};_0x14fd6d[_0x2ed229+'MessageId']=_0x43abec['id'];_0x14fd6d[_0x2ed229+_0xe7cc('0x65')]=_0x43abec[_0xe7cc('0x61')]['id'];_0x14fd6d[_0xe7cc('0x66')+_0x2ed229+_0x1ea86d+'Id']=_0x43abec[_0xe7cc('0x5d')]['id'];return db[_0x2ed229+_0xe7cc('0x6f')][_0xe7cc('0x67')](_0x14fd6d);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x4f650a,'interaction':_0x43abec[_0xe7cc('0x61')],'message':_0x43abec,'account':_0x43abec['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7cc('0x3b'),'appdata':_0x36291b[_0xe7cc('0x13')]+','+(_0x43abec[_0xe7cc('0x5d')][_0xe7cc('0x70')]||0x12c),'interval':_0xe7cc('0x6a')}]},routingClient);})[_0xe7cc('0x9')](respondWithResult(_0x173874,null))[_0xe7cc('0xe')](handleError(_0x173874,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0c4b0ce..be0ed89 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 _0x47d6=['index','/:id','show','/:id/run','run','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x3b7924,_0x294bdc){var _0x428bdb=function(_0x259e8b){while(--_0x259e8b){_0x3b7924['push'](_0x3b7924['shift']());}};_0x428bdb(++_0x294bdc);}(_0x47d6,0x13f));var _0x647d=function(_0x2fa851,_0x14deb3){_0x2fa851=_0x2fa851-0x0;var _0x469a6e=_0x47d6[_0x2fa851];return _0x469a6e;};'use strict';var multer=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var path=require(_0x647d('0x2'));var express=require(_0x647d('0x3'));var router=express[_0x647d('0x4')]();var auth=require(_0x647d('0x5'));var interaction=require(_0x647d('0x6'));var config=require(_0x647d('0x7'));var controller=require(_0x647d('0x8'));router[_0x647d('0x9')]('/',auth[_0x647d('0xa')](),controller[_0x647d('0xb')]);router[_0x647d('0x9')](_0x647d('0xc'),auth[_0x647d('0xa')](),controller[_0x647d('0xd')]);router['get'](_0x647d('0xe'),auth[_0x647d('0xa')](),controller[_0x647d('0xf')]);router[_0x647d('0x10')]('/',auth[_0x647d('0xa')](),controller[_0x647d('0x11')]);router[_0x647d('0x12')](_0x647d('0xc'),auth[_0x647d('0xa')](),controller[_0x647d('0x13')]);router[_0x647d('0x14')](_0x647d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x647d('0x15')]=router; \ No newline at end of file +var _0x9918=['delete','destroy','exports','multer','express','Router','../../components/auth/service','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','create','update'];(function(_0x229df8,_0x1e289f){var _0x5bc62a=function(_0x1c42e6){while(--_0x1c42e6){_0x229df8['push'](_0x229df8['shift']());}};_0x5bc62a(++_0x1e289f);}(_0x9918,0x133));var _0x8991=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x9918[_0x311f44];return _0x46f1e6;};'use strict';var multer=require(_0x8991('0x0'));var util=require('util');var path=require('path');var express=require(_0x8991('0x1'));var router=express[_0x8991('0x2')]();var auth=require(_0x8991('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8991('0x4'));router[_0x8991('0x5')]('/',auth[_0x8991('0x6')](),controller[_0x8991('0x7')]);router[_0x8991('0x5')]('/:id',auth[_0x8991('0x6')](),controller[_0x8991('0x8')]);router[_0x8991('0x5')](_0x8991('0x9'),auth[_0x8991('0x6')](),controller[_0x8991('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8991('0xb')]);router['put']('/:id',auth[_0x8991('0x6')](),controller[_0x8991('0xc')]);router[_0x8991('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8991('0xe')]);module[_0x8991('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d0bedc0..022cd93 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 _0x4194=['STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','weeks','days','hours','minutes','xlsx','csv','custom','default','BOOLEAN','TEXT','sequelize'];(function(_0x15e6ff,_0x1a0188){var _0x3b0119=function(_0x4b44cd){while(--_0x4b44cd){_0x15e6ff['push'](_0x15e6ff['shift']());}};_0x3b0119(++_0x1a0188);}(_0x4194,0x65));var _0x4419=function(_0x1be9cd,_0x10ee46){_0x1be9cd=_0x1be9cd-0x0;var _0x1a4611=_0x4194[_0x1be9cd];return _0x1a4611;};'use strict';var Sequelize=require(_0x4419('0x0'));module['exports']={'name':{'type':Sequelize[_0x4419('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4419('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4419('0x2')},'startAt':{'type':Sequelize[_0x4419('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4419('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4419('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4419('0x5')](_0x4419('0x6'),'quarters','months',_0x4419('0x7'),_0x4419('0x8'),_0x4419('0x9'),_0x4419('0xa')),'allowNull':![],'defaultValue':_0x4419('0x8')},'output':{'type':Sequelize[_0x4419('0x5')]('csv','pdf',_0x4419('0xb')),'allowNull':![],'defaultValue':_0x4419('0xc')},'type':{'type':Sequelize[_0x4419('0x5')](_0x4419('0xd'),_0x4419('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x4419('0xf')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4419('0x10')]},'bcc':{'type':Sequelize[_0x4419('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xad05=['TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','months','weeks','days','minutes','csv','pdf','xlsx','default','custom'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xad05,0xb5));var _0x5ad0=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xad05[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x5ad0('0x0'));module[_0x5ad0('0x1')]={'name':{'type':Sequelize[_0x5ad0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5ad0('0x2')]},'active':{'type':Sequelize[_0x5ad0('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5ad0('0x2')],'allowNull':![],'defaultValue':_0x5ad0('0x4')},'startAt':{'type':Sequelize[_0x5ad0('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5ad0('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5ad0('0x6')]('years',_0x5ad0('0x7'),_0x5ad0('0x8'),_0x5ad0('0x9'),_0x5ad0('0xa'),'hours',_0x5ad0('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x5ad0('0x6')](_0x5ad0('0xc'),_0x5ad0('0xd'),_0x5ad0('0xe')),'allowNull':![],'defaultValue':_0x5ad0('0xc')},'type':{'type':Sequelize[_0x5ad0('0x6')]('custom',_0x5ad0('0xf')),'allowNull':![],'defaultValue':_0x5ad0('0x10')},'sendMail':{'type':Sequelize[_0x5ad0('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5ad0('0x2')]},'cc':{'type':Sequelize[_0x5ad0('0x11')]},'bcc':{'type':Sequelize[_0x5ad0('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x5ad0('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 1702a96..7875fc2 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 _0xa9e0=['keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','body','run','../../config/schedule','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','Schedule','rawAttributes'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];function respondWithStatusCode(_0x3ab53f,_0xfeb75b){_0xfeb75b=_0xfeb75b||0xcc;return function(_0xbd1168){if(_0xbd1168){return _0x3ab53f['sendStatus'](_0xfeb75b);}return _0x3ab53f['status'](_0xfeb75b)['end']();};}function respondWithResult(_0x4cfe67,_0x273d4d){_0x273d4d=_0x273d4d||0xc8;return function(_0x36471c){if(_0x36471c){return _0x4cfe67[_0x0a9e('0xf')](_0x273d4d)[_0x0a9e('0x10')](_0x36471c);}};}function respondWithFilteredResult(_0x32d742,_0x69aeb7){return function(_0x5db4b0){if(_0x5db4b0){var _0x4283ce=_0x5db4b0[_0x0a9e('0x11')],_0x239b12=_0x69aeb7[_0x0a9e('0x12')],_0x2b4227=_0x69aeb7['offset']+_0x69aeb7[_0x0a9e('0x13')],_0x281129;if(_0x2b4227>=_0x4283ce){_0x2b4227=_0x4283ce;_0x281129=0xc8;}else{_0x281129=0xce;}_0x32d742['status'](_0x281129);return _0x32d742[_0x0a9e('0x14')]('Content-Range',_0x239b12+'-'+_0x2b4227+'/'+_0x4283ce)[_0x0a9e('0x10')](_0x5db4b0);}return null;};}function patchUpdates(_0x12066b){return function(_0x48f32d){try{jsonpatch[_0x0a9e('0x15')](_0x48f32d,_0x12066b,!![]);}catch(_0x5a0a06){return BPromise[_0x0a9e('0x16')](_0x5a0a06);}return _0x48f32d[_0x0a9e('0x17')]();};}function saveUpdates(_0x106033,_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x18')](_0x106033)[_0x0a9e('0x19')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae,_0x112016){return function(_0x1c696a){if(_0x1c696a){return _0x1c696a[_0x0a9e('0x1a')]()['then'](function(){_0x1314ae[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x53682f,_0x20f109){return function(_0x5a09ef){if(!_0x5a09ef){_0x53682f['sendStatus'](0x194);}return _0x5a09ef;};}function handleError(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0x1f4;return function(_0x38e7c4){logger[_0x0a9e('0x1c')](_0x38e7c4['stack']);if(_0x38e7c4[_0x0a9e('0x1d')]){delete _0x38e7c4[_0x0a9e('0x1d')];}_0x3a02e1[_0x0a9e('0xf')](_0x432e56)[_0x0a9e('0x1e')](_0x38e7c4);};}exports[_0x0a9e('0x1f')]=function(_0x42ac8f,_0x16b1ca){var _0x5ea472={},_0x59181e={},_0x197ec0={'count':0x0,'rows':[]};var _0x3a8e58=db[_0x0a9e('0x20')][_0x0a9e('0x21')];_0x59181e['model']=_[_0x0a9e('0x22')](_0x3a8e58);var _0x479bc4={'dateStart':_0x42ac8f[_0x0a9e('0x23')]['dateStart'],'dateEnd':_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')]};delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x25')];delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')];_0x59181e[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x42ac8f['query']);_0x59181e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],_0x59181e[_0x0a9e('0x23')]);_0x5ea472['attributes']=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x5ea472[_0x0a9e('0x2a')]=_0x5ea472[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x5ea472[_0x0a9e('0x2a')]:_0x59181e['model'];if(!_0x42ac8f[_0x0a9e('0x23')]['hasOwnProperty'](_0x0a9e('0x2c'))){_0x5ea472[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x5ea472['offset']=qs[_0x0a9e('0x12')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x12')]);}_0x5ea472[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x2e')]);_0x5ea472[_0x0a9e('0x2f')]=qs['filters'](_[_0x0a9e('0x30')](_0x42ac8f['query'],_0x59181e[_0x0a9e('0x26')]));if(_0x479bc4[_0x0a9e('0x25')]){if(_0x479bc4[_0x0a9e('0x24')]){_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4['dateEnd'])[_0x0a9e('0x31')](0x1,_0x0a9e('0x32'));}else{_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4[_0x0a9e('0x25')])['add'](0x1,'day');}_[_0x0a9e('0x33')](_0x5ea472['where'],{'createdAt':{'$gte':_0x479bc4[_0x0a9e('0x25')],'$lte':_0x479bc4[_0x0a9e('0x24')]}});}if(_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x5ea472['where']=_[_0x0a9e('0x33')](_0x5ea472[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x5ea472['attributes'],function(_0x1dbf74){var _0x1a180b={};_0x1a180b[_0x1dbf74]={'$like':'%'+_0x42ac8f[_0x0a9e('0x23')]['filter']+'%'};return _0x1a180b;})});}_0x5ea472=_['merge']({},_0x5ea472,_0x42ac8f[_0x0a9e('0x36')]);var _0x40d766={'where':_0x5ea472['where']};return db[_0x0a9e('0x20')][_0x0a9e('0x11')](_0x40d766)[_0x0a9e('0x19')](function(_0x148f55){_0x197ec0['count']=_0x148f55;if(_0x42ac8f['query'][_0x0a9e('0x37')]){_0x5ea472[_0x0a9e('0x38')]=[{'all':!![]}];}return db['Schedule'][_0x0a9e('0x39')](_0x5ea472);})[_0x0a9e('0x19')](function(_0x1459bb){_0x197ec0['rows']=_0x1459bb;return _0x197ec0;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x16b1ca,_0x5ea472))[_0x0a9e('0x3a')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x3b')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x3c')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x20')][_0x0a9e('0x21')]);_0x2881b3[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x43dd5b[_0x0a9e('0x23')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x28')],_0x2881b3[_0x0a9e('0x23')]);_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x2881b3[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0xeaa5e5[_0x0a9e('0x2a')]=_0xeaa5e5[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0xeaa5e5[_0x0a9e('0x2a')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x37')]){_0xeaa5e5[_0x0a9e('0x38')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x33')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x36')]);return db[_0x0a9e('0x20')][_0x0a9e('0x3d')](_0xeaa5e5)[_0x0a9e('0x19')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x3a')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x20')]['create'](_0x473dc8[_0x0a9e('0x3e')],{})[_0x0a9e('0x19')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x3a')](handleError(_0x476688,null));};exports[_0x0a9e('0x18')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x3e')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0x45c845[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x19')](saveUpdates(_0x45c845[_0x0a9e('0x3e')],null))[_0x0a9e('0x19')](respondWithResult(_0x37be73,null))[_0x0a9e('0x3a')](handleError(_0x37be73,null));};exports[_0x0a9e('0x1a')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x20')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x19')](removeEntity(_0xe401a,null))[_0x0a9e('0x3a')](handleError(_0xe401a,null));};exports[_0x0a9e('0x3f')]=function(_0x11545a,_0x61bb17,_0x30decb){var _0x2e5165=require(_0x0a9e('0x40'));return db['Schedule']['find']({'where':{'id':_0x11545a['params']['id']},'raw':!![]})[_0x0a9e('0x19')](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x19')](function(){_0x2e5165[_0x0a9e('0x3f')](_0x11545a['params']['id']);})[_0x0a9e('0x19')](respondWithStatusCode(_0x61bb17,null))[_0x0a9e('0x3a')](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','body','run','../../config/schedule','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','Schedule','rawAttributes'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];function respondWithStatusCode(_0x3ab53f,_0xfeb75b){_0xfeb75b=_0xfeb75b||0xcc;return function(_0xbd1168){if(_0xbd1168){return _0x3ab53f['sendStatus'](_0xfeb75b);}return _0x3ab53f['status'](_0xfeb75b)['end']();};}function respondWithResult(_0x4cfe67,_0x273d4d){_0x273d4d=_0x273d4d||0xc8;return function(_0x36471c){if(_0x36471c){return _0x4cfe67[_0x0a9e('0xf')](_0x273d4d)[_0x0a9e('0x10')](_0x36471c);}};}function respondWithFilteredResult(_0x32d742,_0x69aeb7){return function(_0x5db4b0){if(_0x5db4b0){var _0x4283ce=_0x5db4b0[_0x0a9e('0x11')],_0x239b12=_0x69aeb7[_0x0a9e('0x12')],_0x2b4227=_0x69aeb7['offset']+_0x69aeb7[_0x0a9e('0x13')],_0x281129;if(_0x2b4227>=_0x4283ce){_0x2b4227=_0x4283ce;_0x281129=0xc8;}else{_0x281129=0xce;}_0x32d742['status'](_0x281129);return _0x32d742[_0x0a9e('0x14')]('Content-Range',_0x239b12+'-'+_0x2b4227+'/'+_0x4283ce)[_0x0a9e('0x10')](_0x5db4b0);}return null;};}function patchUpdates(_0x12066b){return function(_0x48f32d){try{jsonpatch[_0x0a9e('0x15')](_0x48f32d,_0x12066b,!![]);}catch(_0x5a0a06){return BPromise[_0x0a9e('0x16')](_0x5a0a06);}return _0x48f32d[_0x0a9e('0x17')]();};}function saveUpdates(_0x106033,_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x18')](_0x106033)[_0x0a9e('0x19')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae,_0x112016){return function(_0x1c696a){if(_0x1c696a){return _0x1c696a[_0x0a9e('0x1a')]()['then'](function(){_0x1314ae[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x53682f,_0x20f109){return function(_0x5a09ef){if(!_0x5a09ef){_0x53682f['sendStatus'](0x194);}return _0x5a09ef;};}function handleError(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0x1f4;return function(_0x38e7c4){logger[_0x0a9e('0x1c')](_0x38e7c4['stack']);if(_0x38e7c4[_0x0a9e('0x1d')]){delete _0x38e7c4[_0x0a9e('0x1d')];}_0x3a02e1[_0x0a9e('0xf')](_0x432e56)[_0x0a9e('0x1e')](_0x38e7c4);};}exports[_0x0a9e('0x1f')]=function(_0x42ac8f,_0x16b1ca){var _0x5ea472={},_0x59181e={},_0x197ec0={'count':0x0,'rows':[]};var _0x3a8e58=db[_0x0a9e('0x20')][_0x0a9e('0x21')];_0x59181e['model']=_[_0x0a9e('0x22')](_0x3a8e58);var _0x479bc4={'dateStart':_0x42ac8f[_0x0a9e('0x23')]['dateStart'],'dateEnd':_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')]};delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x25')];delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')];_0x59181e[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x42ac8f['query']);_0x59181e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],_0x59181e[_0x0a9e('0x23')]);_0x5ea472['attributes']=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x5ea472[_0x0a9e('0x2a')]=_0x5ea472[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x5ea472[_0x0a9e('0x2a')]:_0x59181e['model'];if(!_0x42ac8f[_0x0a9e('0x23')]['hasOwnProperty'](_0x0a9e('0x2c'))){_0x5ea472[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x5ea472['offset']=qs[_0x0a9e('0x12')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x12')]);}_0x5ea472[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x2e')]);_0x5ea472[_0x0a9e('0x2f')]=qs['filters'](_[_0x0a9e('0x30')](_0x42ac8f['query'],_0x59181e[_0x0a9e('0x26')]));if(_0x479bc4[_0x0a9e('0x25')]){if(_0x479bc4[_0x0a9e('0x24')]){_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4['dateEnd'])[_0x0a9e('0x31')](0x1,_0x0a9e('0x32'));}else{_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4[_0x0a9e('0x25')])['add'](0x1,'day');}_[_0x0a9e('0x33')](_0x5ea472['where'],{'createdAt':{'$gte':_0x479bc4[_0x0a9e('0x25')],'$lte':_0x479bc4[_0x0a9e('0x24')]}});}if(_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x5ea472['where']=_[_0x0a9e('0x33')](_0x5ea472[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x5ea472['attributes'],function(_0x1dbf74){var _0x1a180b={};_0x1a180b[_0x1dbf74]={'$like':'%'+_0x42ac8f[_0x0a9e('0x23')]['filter']+'%'};return _0x1a180b;})});}_0x5ea472=_['merge']({},_0x5ea472,_0x42ac8f[_0x0a9e('0x36')]);var _0x40d766={'where':_0x5ea472['where']};return db[_0x0a9e('0x20')][_0x0a9e('0x11')](_0x40d766)[_0x0a9e('0x19')](function(_0x148f55){_0x197ec0['count']=_0x148f55;if(_0x42ac8f['query'][_0x0a9e('0x37')]){_0x5ea472[_0x0a9e('0x38')]=[{'all':!![]}];}return db['Schedule'][_0x0a9e('0x39')](_0x5ea472);})[_0x0a9e('0x19')](function(_0x1459bb){_0x197ec0['rows']=_0x1459bb;return _0x197ec0;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x16b1ca,_0x5ea472))[_0x0a9e('0x3a')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x3b')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x3c')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x20')][_0x0a9e('0x21')]);_0x2881b3[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x43dd5b[_0x0a9e('0x23')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x28')],_0x2881b3[_0x0a9e('0x23')]);_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x2881b3[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0xeaa5e5[_0x0a9e('0x2a')]=_0xeaa5e5[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0xeaa5e5[_0x0a9e('0x2a')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x37')]){_0xeaa5e5[_0x0a9e('0x38')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x33')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x36')]);return db[_0x0a9e('0x20')][_0x0a9e('0x3d')](_0xeaa5e5)[_0x0a9e('0x19')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x3a')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x20')]['create'](_0x473dc8[_0x0a9e('0x3e')],{})[_0x0a9e('0x19')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x3a')](handleError(_0x476688,null));};exports[_0x0a9e('0x18')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x3e')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0x45c845[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x19')](saveUpdates(_0x45c845[_0x0a9e('0x3e')],null))[_0x0a9e('0x19')](respondWithResult(_0x37be73,null))[_0x0a9e('0x3a')](handleError(_0x37be73,null));};exports[_0x0a9e('0x1a')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x20')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x19')](removeEntity(_0xe401a,null))[_0x0a9e('0x3a')](handleError(_0xe401a,null));};exports[_0x0a9e('0x3f')]=function(_0x11545a,_0x61bb17,_0x30decb){var _0x2e5165=require(_0x0a9e('0x40'));return db['Schedule']['find']({'where':{'id':_0x11545a['params']['id']},'raw':!![]})[_0x0a9e('0x19')](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x19')](function(){_0x2e5165[_0x0a9e('0x3f')](_0x11545a['params']['id']);})[_0x0a9e('0x19')](respondWithStatusCode(_0x61bb17,null))[_0x0a9e('0x3a')](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 33bc0e4..c2871a7 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 _0x6c22=['exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2264ad,_0x877a92){var _0x1ec64c=function(_0x27822d){while(--_0x27822d){_0x2264ad['push'](_0x2264ad['shift']());}};_0x1ec64c(++_0x877a92);}(_0x6c22,0x130));var _0x26c2=function(_0x5d9ce1,_0x4a1556){_0x5d9ce1=_0x5d9ce1-0x0;var _0x1fd84e=_0x6c22[_0x5d9ce1];return _0x1fd84e;};'use strict';var _=require(_0x26c2('0x0'));var util=require(_0x26c2('0x1'));var logger=require(_0x26c2('0x2'))(_0x26c2('0x3'));var moment=require('moment');var BPromise=require(_0x26c2('0x4'));var rp=require(_0x26c2('0x5'));var attributes=require('./schedule.attributes');module[_0x26c2('0x6')]=function(_0x1ea23e,_0x3003db){return _0x1ea23e[_0x26c2('0x7')](_0x26c2('0x8'),attributes,{'tableName':_0x26c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcced=['request-promise','./schedule.attributes','exports','define','tools_schedules','lodash','util','moment','bluebird'];(function(_0x2140c7,_0x10f5a9){var _0x50e806=function(_0x334826){while(--_0x334826){_0x2140c7['push'](_0x2140c7['shift']());}};_0x50e806(++_0x10f5a9);}(_0xcced,0x95));var _0xdcce=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0xcced[_0x1c5142];return _0x1268cb;};'use strict';var _=require(_0xdcce('0x0'));var util=require(_0xdcce('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdcce('0x2'));var BPromise=require(_0xdcce('0x3'));var rp=require(_0xdcce('0x4'));var attributes=require(_0xdcce('0x5'));module[_0xdcce('0x6')]=function(_0x415654,_0x122f06){return _0x415654[_0xdcce('0x7')]('Schedule',attributes,{'tableName':_0xdcce('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 424ac49..cda513a 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 _0xfde1=['result','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s','message'];(function(_0x5a4015,_0x52ca81){var _0x287106=function(_0xb0e691){while(--_0xb0e691){_0x5a4015['push'](_0x5a4015['shift']());}};_0x287106(++_0x52ca81);}(_0xfde1,0x1d5));var _0x1fde=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfde1[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x1fde('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1fde('0x1'));var fs=require('fs');var db=require(_0x1fde('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fde('0x3'))(_0x1fde('0x4'));var config=require(_0x1fde('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1fde('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5b7acf,_0x4a9527,_0x976485){return new BPromise(function(_0x44aacf,_0x5489f9){return client[_0x1fde('0x7')](_0x5b7acf,_0x976485)[_0x1fde('0x8')](function(_0x491cee){logger[_0x1fde('0x9')]('Schedule,\x20%s,\x20%s',_0x4a9527,_0x1fde('0xa'));logger[_0x1fde('0xb')](_0x1fde('0xc'),_0x4a9527,_0x1fde('0xa'),JSON['stringify'](_0x491cee));if(_0x491cee[_0x1fde('0xd')]){if(_0x491cee['error'][_0x1fde('0xe')]===0x1f4){logger[_0x1fde('0xd')](_0x1fde('0xf'),_0x4a9527,_0x491cee[_0x1fde('0xd')][_0x1fde('0x10')]);return _0x5489f9(_0x491cee[_0x1fde('0xd')][_0x1fde('0x10')]);}logger[_0x1fde('0xd')]('Schedule,\x20%s,\x20%s',_0x4a9527,_0x491cee[_0x1fde('0xd')][_0x1fde('0x10')]);return _0x44aacf(_0x491cee[_0x1fde('0xd')][_0x1fde('0x10')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x4a9527,_0x1fde('0xa'));_0x44aacf(_0x491cee[_0x1fde('0x11')][_0x1fde('0x10')]);}})['catch'](function(_0x199f8e){logger[_0x1fde('0xd')](_0x1fde('0xf'),_0x4a9527,_0x199f8e);_0x5489f9(_0x199f8e);});});} \ No newline at end of file +var _0x9246=['result','catch','Schedule,\x20%s,\x20%s','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x59bc5c,_0x2193bf){var _0x51c52c=function(_0x4d55f5){while(--_0x4d55f5){_0x59bc5c['push'](_0x59bc5c['shift']());}};_0x51c52c(++_0x2193bf);}(_0x9246,0x6c));var _0x6924=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x9246[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x6924('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6924('0x1'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x6924('0x2'));var logger=require(_0x6924('0x3'))(_0x6924('0x4'));var config=require(_0x6924('0x5'));var jayson=require(_0x6924('0x6'));var client=jayson[_0x6924('0x7')][_0x6924('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a6eb5,_0x32a28a,_0x33943b){return new BPromise(function(_0x172eba,_0x53e446){return client[_0x6924('0x9')](_0x4a6eb5,_0x33943b)[_0x6924('0xa')](function(_0x205c3c){logger[_0x6924('0xb')]('Schedule,\x20%s,\x20%s',_0x32a28a,_0x6924('0xc'));logger['debug'](_0x6924('0xd'),_0x32a28a,_0x6924('0xc'),JSON[_0x6924('0xe')](_0x205c3c));if(_0x205c3c[_0x6924('0xf')]){if(_0x205c3c[_0x6924('0xf')][_0x6924('0x10')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x32a28a,_0x205c3c[_0x6924('0xf')]['message']);return _0x53e446(_0x205c3c['error'][_0x6924('0x11')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x32a28a,_0x205c3c[_0x6924('0xf')]['message']);return _0x172eba(_0x205c3c[_0x6924('0xf')][_0x6924('0x11')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x32a28a,_0x6924('0xc'));_0x172eba(_0x205c3c[_0x6924('0x12')][_0x6924('0x11')]);}})[_0x6924('0x13')](function(_0x1f6e23){logger[_0x6924('0xf')](_0x6924('0x14'),_0x32a28a,_0x1f6e23);_0x53e446(_0x1f6e23);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c98f829..fd1f8e7 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 _0xf4a7=['logologin','/:id/logo_login','addLogoLogin','put','isAuthenticated','update','exports','util','path','express','Router','./setting.controller','get','index','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo'];(function(_0x51b00d,_0xac4a95){var _0x725a96=function(_0x4c1dbb){while(--_0x4c1dbb){_0x51b00d['push'](_0x51b00d['shift']());}};_0x725a96(++_0xac4a95);}(_0xf4a7,0x117));var _0x7f4a=function(_0xfc0dc2,_0x52674d){_0xfc0dc2=_0xfc0dc2-0x0;var _0x50e15d=_0xf4a7[_0xfc0dc2];return _0x50e15d;};'use strict';var multer=require('multer');var util=require(_0x7f4a('0x0'));var path=require(_0x7f4a('0x1'));var express=require(_0x7f4a('0x2'));var router=express[_0x7f4a('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f4a('0x4'));router[_0x7f4a('0x5')]('/',auth['isAuthenticated'](),controller[_0x7f4a('0x6')]);router[_0x7f4a('0x5')](_0x7f4a('0x7'),controller[_0x7f4a('0x8')]);router['get'](_0x7f4a('0x9'),controller[_0x7f4a('0xa')]);router[_0x7f4a('0x5')]('/:id/logo_login',controller[_0x7f4a('0xb')]);router[_0x7f4a('0x5')](_0x7f4a('0xc'),controller[_0x7f4a('0xd')]);var upload=multer({'storage':multer[_0x7f4a('0xe')]({'destination':function(_0x33145a,_0x158a6a,_0x38215f){_0x38215f(null,path[_0x7f4a('0xf')](config[_0x7f4a('0x10')],_0x7f4a('0x11')));},'filename':function(_0x45689f,_0x36a59c,_0x2d7644){_0x2d7644(null,util[_0x7f4a('0x12')](_0x7f4a('0x13'),_0x7f4a('0x14'),path[_0x7f4a('0x15')](_0x36a59c[_0x7f4a('0x16')])));}})});router[_0x7f4a('0x17')](_0x7f4a('0x9'),upload[_0x7f4a('0x18')](_0x7f4a('0x19')),controller[_0x7f4a('0x1a')]);var upload=multer({'storage':multer[_0x7f4a('0xe')]({'destination':function(_0x29c0fd,_0x2daef7,_0x11e371){_0x11e371(null,path[_0x7f4a('0xf')](config[_0x7f4a('0x10')],_0x7f4a('0x11')));},'filename':function(_0xa28337,_0x374c48,_0x57ca87){_0x57ca87(null,util[_0x7f4a('0x12')]('%s%s',_0x7f4a('0x1b'),path[_0x7f4a('0x15')](_0x374c48[_0x7f4a('0x16')])));}})});router[_0x7f4a('0x17')](_0x7f4a('0x1c'),upload['single']('file'),controller[_0x7f4a('0x1d')]);router[_0x7f4a('0x1e')](_0x7f4a('0x7'),auth[_0x7f4a('0x1f')](),controller[_0x7f4a('0x20')]);module[_0x7f4a('0x21')]=router; \ No newline at end of file +var _0x40c2=['extname','originalname','post','file','put','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','join','root','server/files/images/logos/','logo','single','addLogo','diskStorage','format','%s%s','logologin'];(function(_0x1ff3ea,_0x5b351e){var _0x43e8a8=function(_0x4683f0){while(--_0x4683f0){_0x1ff3ea['push'](_0x1ff3ea['shift']());}};_0x43e8a8(++_0x5b351e);}(_0x40c2,0x1b8));var _0x240c=function(_0x18afaa,_0x2cb517){_0x18afaa=_0x18afaa-0x0;var _0x4a952d=_0x40c2[_0x18afaa];return _0x4a952d;};'use strict';var multer=require(_0x240c('0x0'));var util=require(_0x240c('0x1'));var path=require('path');var express=require(_0x240c('0x2'));var router=express[_0x240c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x240c('0x4'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x240c('0x5')]('/',auth[_0x240c('0x6')](),controller[_0x240c('0x7')]);router[_0x240c('0x5')](_0x240c('0x8'),controller['show']);router['get'](_0x240c('0x9'),controller[_0x240c('0xa')]);router['get'](_0x240c('0xb'),controller[_0x240c('0xc')]);router['get'](_0x240c('0xd'),controller[_0x240c('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3c72d2,_0x10e4a1,_0x3e9178){_0x3e9178(null,path[_0x240c('0xf')](config[_0x240c('0x10')],_0x240c('0x11')));},'filename':function(_0x5ba600,_0x4868db,_0x274887){_0x274887(null,util['format']('%s%s',_0x240c('0x12'),path['extname'](_0x4868db['originalname'])));}})});router['post'](_0x240c('0x9'),upload[_0x240c('0x13')]('file'),controller[_0x240c('0x14')]);var upload=multer({'storage':multer[_0x240c('0x15')]({'destination':function(_0x5677ba,_0x402406,_0xaa5dc){_0xaa5dc(null,path['join'](config['root'],_0x240c('0x11')));},'filename':function(_0x388dcd,_0x2e450f,_0x4bcd02){_0x4bcd02(null,util[_0x240c('0x16')](_0x240c('0x17'),_0x240c('0x18'),path[_0x240c('0x19')](_0x2e450f[_0x240c('0x1a')])));}})});router[_0x240c('0x1b')]('/:id/logo_login',upload['single'](_0x240c('0x1c')),controller['addLogoLogin']);router[_0x240c('0x1d')](_0x240c('0x8'),auth['isAuthenticated'](),controller['update']);module[_0x240c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index bf5b48e..cc6cb2f 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 _0xdfa8=['/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','INTEGER','min_internal','min_mailbox'];(function(_0x33296a,_0x591608){var _0x52efda=function(_0x3153d6){while(--_0x3153d6){_0x33296a['push'](_0x33296a['shift']());}};_0x52efda(++_0x591608);}(_0xdfa8,0x13f));var _0x8dfa=function(_0x155396,_0x18afd1){_0x155396=_0x155396-0x0;var _0x1225a6=_0xdfa8[_0x155396];return _0x1225a6;};'use strict';var Sequelize=require(_0x8dfa('0x0'));module[_0x8dfa('0x1')]={'min_internal':{'type':Sequelize[_0x8dfa('0x2')](0xb),'unique':_0x8dfa('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x8dfa('0x2')](0xb),'unique':_0x8dfa('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8dfa('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x8dfa('0x5')},'logo':{'type':Sequelize[_0x8dfa('0x6')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8dfa('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0x8dfa('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8dfa('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x8dfa('0x6')]},'turnpassword':{'type':Sequelize[_0x8dfa('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x8dfa('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8dfa('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x8dfa('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x8dfa('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x8dfa('0x8')},'enableEmailPreview':{'type':Sequelize[_0x8dfa('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8dfa('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8dfa('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x8dfa('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8dfa('0x6')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x8dfa('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x8dfa('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcecd=['exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x46c68b,_0x426796){var _0x212e3e=function(_0x1c6ce6){while(--_0x1c6ce6){_0x46c68b['push'](_0x46c68b['shift']());}};_0x212e3e(++_0x426796);}(_0xcecd,0x190));var _0xdcec=function(_0x26a862,_0x237264){_0x26a862=_0x26a862-0x0;var _0x5789a1=_0xcecd[_0x26a862];return _0x5789a1;};'use strict';var Sequelize=require('sequelize');module[_0xdcec('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xdcec('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xdcec('0x2')](0xb),'unique':_0xdcec('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xdcec('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xdcec('0x4')],'defaultValue':_0xdcec('0x5')},'logo':{'type':Sequelize[_0xdcec('0x4')]},'defaultLogo':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xdcec('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xdcec('0x4')]},'turnusername':{'type':Sequelize[_0xdcec('0x4')]},'turnpassword':{'type':Sequelize[_0xdcec('0x4')]},'pageTitle':{'type':Sequelize[_0xdcec('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xdcec('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xdcec('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xdcec('0x4')],'defaultValue':_0xdcec('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xdcec('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 753f4bf..9eef7db 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 _0x5640=['server/files/images/logos','getLicense','toLower','default_logo.png','default','custom','existsSync','Sequelize','ValidationError','Logo\x20not\x20found','download','../../config/license/util','getLogoLogin','defaultLogo','defaultLoginLogo','default_loginLogo.png','securePassword','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','sendStatus','send','Setting','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','params','find','get','readFileSync','join','root','server/files/templates/stun.ejs','utf8','server/files/templates/turn.ejs','render','/etc/asterisk/stun_xcally.conf','writeFileSync','update','res_rtp_asterisk.so','file','filename','body','logo','addLogoLogin','loginLogo','getLogo'];(function(_0x1f84c2,_0xb5da1f){var _0x30c2da=function(_0x34a422){while(--_0x34a422){_0x1f84c2['push'](_0x1f84c2['shift']());}};_0x30c2da(++_0xb5da1f);}(_0x5640,0x7f));var _0x0564=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5640[_0x502c7d];return _0x30b7ed;};'use strict';var jsonpatch=require(_0x0564('0x0'));var rp=require(_0x0564('0x1'));var moment=require(_0x0564('0x2'));var BPromise=require(_0x0564('0x3'));var Mustache=require(_0x0564('0x4'));var util=require(_0x0564('0x5'));var path=require(_0x0564('0x6'));var sox=require(_0x0564('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0564('0x8'));var squel=require('squel');var crypto=require(_0x0564('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0564('0xa'));var toCsv=require(_0x0564('0xb'));var querystring=require(_0x0564('0xc'));var Papa=require(_0x0564('0xd'));var qs=require(_0x0564('0xe'));var logger=require(_0x0564('0xf'))('api');var utils=require(_0x0564('0x10'));var config=require(_0x0564('0x11'));var db=require(_0x0564('0x12'))['db'];var jayson=require(_0x0564('0x13'));var client=jayson[_0x0564('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aedeb,_0xe6f836,_0x57cf95,_0x5948c8){return new BPromise(function(_0x58f9c8,_0x4dd797){var _0xc5d5a4=_0x5948c8||client;return _0xc5d5a4[_0x0564('0x15')](_0x1aedeb,_0x57cf95)[_0x0564('0x16')](function(_0x35b1f6){logger[_0x0564('0x17')](_0x0564('0x18'),_0xe6f836,'request\x20sent');logger[_0x0564('0x19')](_0x0564('0x1a'),_0xe6f836,_0x0564('0x1b'),JSON[_0x0564('0x1c')](_0x35b1f6));if(_0x35b1f6[_0x0564('0x1d')]){if(_0x35b1f6['error'][_0x0564('0x1e')]===0x1f4){logger[_0x0564('0x1d')](_0x0564('0x18'),_0xe6f836,_0x35b1f6[_0x0564('0x1d')][_0x0564('0x1f')]);return _0x4dd797(_0x35b1f6[_0x0564('0x1d')][_0x0564('0x1f')]);}logger['error'](_0x0564('0x18'),_0xe6f836,_0x35b1f6[_0x0564('0x1d')]['message']);return _0x58f9c8(_0x35b1f6[_0x0564('0x1d')]['message']);}else{logger['info'](_0x0564('0x18'),_0xe6f836,_0x0564('0x1b'));_0x58f9c8(_0x35b1f6[_0x0564('0x20')][_0x0564('0x1f')]);}})[_0x0564('0x21')](function(_0x529026){logger[_0x0564('0x1d')](_0x0564('0x18'),_0xe6f836,_0x529026);_0x4dd797(_0x529026);});});}function respondWithStatusCode(_0x1fb596,_0x476d44){_0x476d44=_0x476d44||0xcc;return function(_0x34032f){if(_0x34032f){return _0x1fb596['sendStatus'](_0x476d44);}return _0x1fb596[_0x0564('0x22')](_0x476d44)[_0x0564('0x23')]();};}function respondWithResult(_0x36b8c9,_0x3bb12a){_0x3bb12a=_0x3bb12a||0xc8;return function(_0x18ce83){if(_0x18ce83){return _0x36b8c9[_0x0564('0x22')](_0x3bb12a)[_0x0564('0x24')](_0x18ce83);}};}function respondWithFilteredResult(_0x251a0c,_0x266615){return function(_0x3419c3){if(_0x3419c3){var _0x4278d1=_0x3419c3[_0x0564('0x25')],_0x4c7486=_0x266615[_0x0564('0x26')],_0x48a6a1=_0x266615[_0x0564('0x26')]+_0x266615['limit'],_0x239c54;if(_0x48a6a1>=_0x4278d1){_0x48a6a1=_0x4278d1;_0x239c54=0xc8;}else{_0x239c54=0xce;}_0x251a0c[_0x0564('0x22')](_0x239c54);return _0x251a0c[_0x0564('0x27')](_0x0564('0x28'),_0x4c7486+'-'+_0x48a6a1+'/'+_0x4278d1)[_0x0564('0x24')](_0x3419c3);}return null;};}function patchUpdates(_0x3c1e8e){return function(_0x3f2040){try{jsonpatch[_0x0564('0x29')](_0x3f2040,_0x3c1e8e,!![]);}catch(_0x5000e7){return BPromise['reject'](_0x5000e7);}return _0x3f2040['save']();};}function saveUpdates(_0x340698,_0x4fc3a5){return function(_0x482cf1){if(_0x482cf1){return _0x482cf1['update'](_0x340698)[_0x0564('0x16')](function(_0x3b7a29){return _0x3b7a29;});}return null;};}function removeEntity(_0x1306a7,_0x170594){return function(_0x4688be){if(_0x4688be){return _0x4688be['destroy']()[_0x0564('0x16')](function(){_0x1306a7[_0x0564('0x22')](0xcc)[_0x0564('0x23')]();});}};}function handleEntityNotFound(_0x3bbcf8,_0x4ba300){return function(_0xc4035){if(!_0xc4035){_0x3bbcf8[_0x0564('0x2a')](0x194);}return _0xc4035;};}function handleError(_0x44e33f,_0x5c040b){_0x5c040b=_0x5c040b||0x1f4;return function(_0x4350e9){logger['error'](_0x4350e9['stack']);if(_0x4350e9['name']){delete _0x4350e9['name'];}_0x44e33f[_0x0564('0x22')](_0x5c040b)[_0x0564('0x2b')](_0x4350e9);};}exports['index']=function(_0x567a7f,_0x23ead4){var _0x3e37a3={},_0xa3bff6={},_0x2df99e={'count':0x0,'rows':[]};var _0x176098=db[_0x0564('0x2c')][_0x0564('0x2d')];_0xa3bff6['model']=_[_0x0564('0x2e')](_0x176098);var _0x54767a={'dateStart':_0x567a7f[_0x0564('0x2f')][_0x0564('0x30')],'dateEnd':_0x567a7f[_0x0564('0x2f')][_0x0564('0x31')]};delete _0x567a7f[_0x0564('0x2f')][_0x0564('0x30')];delete _0x567a7f[_0x0564('0x2f')][_0x0564('0x31')];_0xa3bff6[_0x0564('0x2f')]=_[_0x0564('0x2e')](_0x567a7f[_0x0564('0x2f')]);_0xa3bff6[_0x0564('0x32')]=_[_0x0564('0x33')](_0xa3bff6[_0x0564('0x34')],_0xa3bff6[_0x0564('0x2f')]);_0x3e37a3['attributes']=_[_0x0564('0x33')](_0xa3bff6[_0x0564('0x34')],qs[_0x0564('0x35')](_0x567a7f['query'][_0x0564('0x35')]));_0x3e37a3[_0x0564('0x36')]=_0x3e37a3['attributes'][_0x0564('0x37')]?_0x3e37a3['attributes']:_0xa3bff6[_0x0564('0x34')];if(!_0x567a7f[_0x0564('0x2f')][_0x0564('0x38')]('nolimit')){_0x3e37a3[_0x0564('0x39')]=qs[_0x0564('0x39')](_0x567a7f[_0x0564('0x2f')][_0x0564('0x39')]);_0x3e37a3['offset']=qs['offset'](_0x567a7f[_0x0564('0x2f')][_0x0564('0x26')]);}_0x3e37a3[_0x0564('0x3a')]=qs[_0x0564('0x3b')](_0x567a7f[_0x0564('0x2f')]['sort']);_0x3e37a3[_0x0564('0x3c')]=qs[_0x0564('0x32')](_[_0x0564('0x3d')](_0x567a7f['query'],_0xa3bff6[_0x0564('0x32')]));if(_0x54767a[_0x0564('0x30')]){if(_0x54767a[_0x0564('0x31')]){_0x54767a[_0x0564('0x31')]=moment(_0x54767a[_0x0564('0x31')])[_0x0564('0x3e')](0x1,_0x0564('0x3f'));}else{_0x54767a[_0x0564('0x31')]=moment(_0x54767a[_0x0564('0x30')])['add'](0x1,_0x0564('0x3f'));}_[_0x0564('0x40')](_0x3e37a3[_0x0564('0x3c')],{'createdAt':{'$gte':_0x54767a[_0x0564('0x30')],'$lte':_0x54767a[_0x0564('0x31')]}});}if(_0x567a7f['query'][_0x0564('0x41')]){_0x3e37a3['where']=_['merge'](_0x3e37a3[_0x0564('0x3c')],{'$or':_[_0x0564('0x42')](_0x3e37a3['attributes'],function(_0x36fa6e){var _0x1c9a2b={};_0x1c9a2b[_0x36fa6e]={'$like':'%'+_0x567a7f[_0x0564('0x2f')][_0x0564('0x41')]+'%'};return _0x1c9a2b;})});}_0x3e37a3=_[_0x0564('0x40')]({},_0x3e37a3,_0x567a7f[_0x0564('0x43')]);var _0x2c87f6={'where':_0x3e37a3[_0x0564('0x3c')]};return db[_0x0564('0x2c')][_0x0564('0x25')](_0x2c87f6)['then'](function(_0x5532dd){_0x2df99e['count']=_0x5532dd;if(_0x567a7f[_0x0564('0x2f')][_0x0564('0x44')]){_0x3e37a3[_0x0564('0x45')]=[{'all':!![]}];}return db['Setting'][_0x0564('0x46')](_0x3e37a3);})[_0x0564('0x16')](function(_0x255c62){_0x2df99e[_0x0564('0x47')]=_0x255c62;return _0x2df99e;})[_0x0564('0x16')](respondWithFilteredResult(_0x23ead4,_0x3e37a3))[_0x0564('0x21')](handleError(_0x23ead4,null));};exports['show']=function(_0x35a8fe,_0x1873c4){var _0x1a5bd8={'raw':![],'where':{'id':_0x35a8fe[_0x0564('0x48')]['id']}},_0x4afc20={};_0x4afc20['model']=_[_0x0564('0x2e')](db['Setting']['rawAttributes']);_0x4afc20['query']=_[_0x0564('0x2e')](_0x35a8fe[_0x0564('0x2f')]);_0x4afc20[_0x0564('0x32')]=_[_0x0564('0x33')](_0x4afc20[_0x0564('0x34')],_0x4afc20[_0x0564('0x2f')]);_0x1a5bd8[_0x0564('0x36')]=_[_0x0564('0x33')](_0x4afc20[_0x0564('0x34')],qs[_0x0564('0x35')](_0x35a8fe[_0x0564('0x2f')][_0x0564('0x35')]));_0x1a5bd8[_0x0564('0x36')]=_0x1a5bd8[_0x0564('0x36')][_0x0564('0x37')]?_0x1a5bd8[_0x0564('0x36')]:_0x4afc20[_0x0564('0x34')];if(_0x35a8fe['query'][_0x0564('0x44')]){_0x1a5bd8[_0x0564('0x45')]=[{'all':!![]}];}_0x1a5bd8=_[_0x0564('0x40')]({},_0x1a5bd8,_0x35a8fe[_0x0564('0x43')]);return db[_0x0564('0x2c')][_0x0564('0x49')](_0x1a5bd8)[_0x0564('0x16')](handleEntityNotFound(_0x1873c4,null))[_0x0564('0x16')](respondWithResult(_0x1873c4,null))[_0x0564('0x21')](handleError(_0x1873c4,null));};exports['update']=function(_0x39f92c,_0x39884a,_0x3f5b7e){var _0x3217e3;return db[_0x0564('0x2c')][_0x0564('0x49')]({'where':{'id':_0x39f92c[_0x0564('0x48')]['id']}})['then'](handleEntityNotFound(_0x39884a,null))[_0x0564('0x16')](saveUpdates(_0x39f92c['body'],null))[_0x0564('0x16')](function(_0x833e15){if(_0x833e15){_0x3217e3=_0x833e15[_0x0564('0x4a')]({'plain':!![]});var _0x3336b8=fs[_0x0564('0x4b')](path[_0x0564('0x4c')](config[_0x0564('0x4d')],_0x0564('0x4e')),_0x0564('0x4f'));var _0x28b93f=ejs['render'](_0x3336b8,_0x3217e3);var _0x19ebfa=fs[_0x0564('0x4b')](path['join'](config['root'],_0x0564('0x50')),_0x0564('0x4f'));var _0x540a25=ejs[_0x0564('0x51')](_0x19ebfa,_0x3217e3);fs['writeFileSync'](_0x0564('0x52'),_0x28b93f);fs[_0x0564('0x53')]('/etc/asterisk/turn_xcally.conf',_0x540a25);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}})[_0x0564('0x16')](function(){return respondWithRpcPromise('Reload',_0x0564('0x54'),{'module':_0x0564('0x55')});})[_0x0564('0x16')](function(){return _0x3217e3||null;})[_0x0564('0x16')](respondWithResult(_0x39884a,null))[_0x0564('0x21')](handleError(_0x39884a,null));};exports['addLogo']=function(_0x4ae237,_0x3dd2ec,_0x43316f){if(_0x4ae237[_0x0564('0x56')]&&_0x4ae237[_0x0564('0x56')][_0x0564('0x57')]){_0x4ae237[_0x0564('0x58')][_0x0564('0x59')]=_0x4ae237[_0x0564('0x56')][_0x0564('0x57')];}return db[_0x0564('0x2c')][_0x0564('0x49')]({'where':{'id':_0x4ae237[_0x0564('0x48')]['id']}})[_0x0564('0x16')](handleEntityNotFound(_0x3dd2ec,null))['then'](saveUpdates(_0x4ae237[_0x0564('0x58')],null))['then'](respondWithResult(_0x3dd2ec,null))['catch'](handleError(_0x3dd2ec,null));};exports[_0x0564('0x5a')]=function(_0xd43ff7,_0x414f49,_0x4d020d){if(_0xd43ff7[_0x0564('0x56')]&&_0xd43ff7[_0x0564('0x56')]['filename']){_0xd43ff7[_0x0564('0x58')][_0x0564('0x5b')]=_0xd43ff7[_0x0564('0x56')][_0x0564('0x57')];}return db['Setting']['find']({'where':{'id':_0xd43ff7[_0x0564('0x48')]['id']}})[_0x0564('0x16')](handleEntityNotFound(_0x414f49,null))[_0x0564('0x16')](saveUpdates(_0xd43ff7[_0x0564('0x58')],null))[_0x0564('0x16')](respondWithResult(_0x414f49,null))[_0x0564('0x21')](handleError(_0x414f49,null));};var utilLicense=require('../../config/license/util');exports[_0x0564('0x5c')]=function(_0x316bc7,_0x16d77a,_0x13e8a0){var _0x145a96=_0x0564('0x5d');var _0x2e3b75={'custom':![]};return utilLicense[_0x0564('0x5e')]()[_0x0564('0x16')](function(_0x38c4ad){if(_0x38c4ad){_0x2e3b75=_0x38c4ad;}return db[_0x0564('0x2c')][_0x0564('0x49')]({'where':{'id':_0x316bc7[_0x0564('0x48')]['id']},'attributes':['logo','loginLogo','defaultLogo','defaultLoginLogo'],'raw':!![]});})[_0x0564('0x16')](handleEntityNotFound(_0x16d77a,null))['then'](function(_0x448e3c){if(_0x448e3c){var _0x2d71e7=_0x448e3c['logo']&&fs['existsSync'](path[_0x0564('0x4c')](config[_0x0564('0x4d')],_0x145a96,_[_0x0564('0x5f')](_0x448e3c[_0x0564('0x59')])))?path['join'](config[_0x0564('0x4d')],_0x145a96,_[_0x0564('0x5f')](_0x448e3c[_0x0564('0x59')])):path[_0x0564('0x4c')](config[_0x0564('0x4d')],_0x145a96,_[_0x0564('0x5f')](_0x0564('0x60')));var _0xfcde72=_0x0564('0x61')+_['upperFirst'](_0x0564('0x59'));if(_0x448e3c[_0xfcde72]||!_0x2e3b75[_0x0564('0x62')]){_0x2d71e7=path[_0x0564('0x4c')](config[_0x0564('0x4d')],_0x145a96,_[_0x0564('0x5f')](_0x0564('0x60')));}if(!fs[_0x0564('0x63')](_0x2d71e7)){throw new db[(_0x0564('0x64'))][(_0x0564('0x65'))](_0x0564('0x66'));}return _0x16d77a[_0x0564('0x67')](_0x2d71e7);}})[_0x0564('0x21')](handleError(_0x16d77a,null));};var utilLicense=require(_0x0564('0x68'));exports[_0x0564('0x69')]=function(_0x5188d3,_0x144210,_0x1abd77){var _0x37c0ff='server/files/images/logos';var _0x29c54b={'custom':![]};return utilLicense[_0x0564('0x5e')]()[_0x0564('0x16')](function(_0x25495a){if(_0x25495a){_0x29c54b=_0x25495a;}return db[_0x0564('0x2c')]['find']({'where':{'id':_0x5188d3[_0x0564('0x48')]['id']},'attributes':[_0x0564('0x59'),'loginLogo',_0x0564('0x6a'),_0x0564('0x6b')],'raw':!![]});})[_0x0564('0x16')](handleEntityNotFound(_0x144210,null))[_0x0564('0x16')](function(_0x527285){if(_0x527285){var _0x55b7d2=_0x527285['loginLogo']&&fs[_0x0564('0x63')](path[_0x0564('0x4c')](config[_0x0564('0x4d')],_0x37c0ff,_['toLower'](_0x527285[_0x0564('0x5b')])))?path[_0x0564('0x4c')](config[_0x0564('0x4d')],_0x37c0ff,_[_0x0564('0x5f')](_0x527285[_0x0564('0x5b')])):path['join'](config['root'],_0x37c0ff,_[_0x0564('0x5f')]('default_loginLogo.png'));var _0x3719c8=_0x0564('0x61')+_['upperFirst'](_0x0564('0x5b'));if(_0x527285[_0x3719c8]||!_0x29c54b[_0x0564('0x62')]){_0x55b7d2=path[_0x0564('0x4c')](config['root'],_0x37c0ff,_[_0x0564('0x5f')](_0x0564('0x6c')));}if(!fs[_0x0564('0x63')](_0x55b7d2)){throw new db[(_0x0564('0x64'))][(_0x0564('0x65'))]('Logo\x20not\x20found');}return _0x144210['download'](_0x55b7d2);}})['catch'](handleError(_0x144210,null));};exports['gdpr']=function(_0x29e5be,_0x4f06bc){return db[_0x0564('0x2c')]['find']({'where':{'id':_0x29e5be[_0x0564('0x48')]['id']},'attributes':[_0x0564('0x6d')]})[_0x0564('0x16')](respondWithResult(_0x4f06bc,null))['catch'](handleError(_0x4f06bc,null));}; \ No newline at end of file +var _0x298c=['filter','map','options','then','includeAll','include','findAll','rows','params','update','find','body','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_rtp_asterisk.so','file','logo','filename','../../config/license/util','getLogo','getLicense','defaultLogo','defaultLoginLogo','toLower','default_logo.png','upperFirst','custom','Logo\x20not\x20found','getLogoLogin','server/files/images/logos','loginLogo','default_loginLogo.png','existsSync','ValidationError','download','gdpr','securePassword','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','info','request\x20sent','debug','error','code','Setting,\x20%s,\x20%s','message','result','catch','status','end','json','count','limit','set','Content-Range','apply','reject','save','sendStatus','stack','name','send','Setting','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','add','day','merge'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x298c,0x106));var _0xc298=function(_0x52f6ac,_0x32abd0){_0x52f6ac=_0x52f6ac-0x0;var _0x1f4ce5=_0x298c[_0x52f6ac];return _0x1f4ce5;};'use strict';var jsonpatch=require(_0xc298('0x0'));var rp=require(_0xc298('0x1'));var moment=require(_0xc298('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc298('0x3'));var util=require(_0xc298('0x4'));var path=require(_0xc298('0x5'));var sox=require(_0xc298('0x6'));var csv=require(_0xc298('0x7'));var ejs=require(_0xc298('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc298('0x9'));var crypto=require(_0xc298('0xa'));var jsforce=require(_0xc298('0xb'));var deskjs=require(_0xc298('0xc'));var toCsv=require(_0xc298('0x7'));var querystring=require(_0xc298('0xd'));var Papa=require('papaparse');var qs=require(_0xc298('0xe'));var logger=require(_0xc298('0xf'))(_0xc298('0x10'));var utils=require(_0xc298('0x11'));var config=require(_0xc298('0x12'));var db=require(_0xc298('0x13'))['db'];var jayson=require(_0xc298('0x14'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x472386,_0x2c2e2a,_0x382e7d,_0x1ad67b){return new BPromise(function(_0x370e33,_0x1933d9){var _0x2f777e=_0x1ad67b||client;return _0x2f777e['request'](_0x472386,_0x382e7d)['then'](function(_0x2843b4){logger[_0xc298('0x15')]('Setting,\x20%s,\x20%s',_0x2c2e2a,_0xc298('0x16'));logger[_0xc298('0x17')]('Setting,\x20%s,\x20%s,\x20%s',_0x2c2e2a,'request\x20sent',JSON['stringify'](_0x2843b4));if(_0x2843b4[_0xc298('0x18')]){if(_0x2843b4[_0xc298('0x18')][_0xc298('0x19')]===0x1f4){logger[_0xc298('0x18')](_0xc298('0x1a'),_0x2c2e2a,_0x2843b4[_0xc298('0x18')][_0xc298('0x1b')]);return _0x1933d9(_0x2843b4[_0xc298('0x18')][_0xc298('0x1b')]);}logger[_0xc298('0x18')](_0xc298('0x1a'),_0x2c2e2a,_0x2843b4[_0xc298('0x18')][_0xc298('0x1b')]);return _0x370e33(_0x2843b4[_0xc298('0x18')]['message']);}else{logger[_0xc298('0x15')](_0xc298('0x1a'),_0x2c2e2a,_0xc298('0x16'));_0x370e33(_0x2843b4[_0xc298('0x1c')][_0xc298('0x1b')]);}})[_0xc298('0x1d')](function(_0x12ba99){logger['error'](_0xc298('0x1a'),_0x2c2e2a,_0x12ba99);_0x1933d9(_0x12ba99);});});}function respondWithStatusCode(_0x425756,_0x47ea3f){_0x47ea3f=_0x47ea3f||0xcc;return function(_0x177db7){if(_0x177db7){return _0x425756['sendStatus'](_0x47ea3f);}return _0x425756[_0xc298('0x1e')](_0x47ea3f)[_0xc298('0x1f')]();};}function respondWithResult(_0x382c6c,_0x36b17b){_0x36b17b=_0x36b17b||0xc8;return function(_0xa986bc){if(_0xa986bc){return _0x382c6c[_0xc298('0x1e')](_0x36b17b)[_0xc298('0x20')](_0xa986bc);}};}function respondWithFilteredResult(_0x4a9585,_0x3ea396){return function(_0x395781){if(_0x395781){var _0x20769e=_0x395781[_0xc298('0x21')],_0x4123c8=_0x3ea396['offset'],_0x634498=_0x3ea396['offset']+_0x3ea396[_0xc298('0x22')],_0x173b03;if(_0x634498>=_0x20769e){_0x634498=_0x20769e;_0x173b03=0xc8;}else{_0x173b03=0xce;}_0x4a9585[_0xc298('0x1e')](_0x173b03);return _0x4a9585[_0xc298('0x23')](_0xc298('0x24'),_0x4123c8+'-'+_0x634498+'/'+_0x20769e)[_0xc298('0x20')](_0x395781);}return null;};}function patchUpdates(_0x44f50f){return function(_0x391864){try{jsonpatch[_0xc298('0x25')](_0x391864,_0x44f50f,!![]);}catch(_0x3d9ac){return BPromise[_0xc298('0x26')](_0x3d9ac);}return _0x391864[_0xc298('0x27')]();};}function saveUpdates(_0x2bd8cf,_0x58c7ab){return function(_0x4b9f38){if(_0x4b9f38){return _0x4b9f38['update'](_0x2bd8cf)['then'](function(_0x284bb4){return _0x284bb4;});}return null;};}function removeEntity(_0x3e5ffe,_0x517e14){return function(_0x187da1){if(_0x187da1){return _0x187da1['destroy']()['then'](function(){_0x3e5ffe[_0xc298('0x1e')](0xcc)[_0xc298('0x1f')]();});}};}function handleEntityNotFound(_0x55a440,_0x4a5143){return function(_0x39dfc7){if(!_0x39dfc7){_0x55a440[_0xc298('0x28')](0x194);}return _0x39dfc7;};}function handleError(_0x564ad2,_0x1e5677){_0x1e5677=_0x1e5677||0x1f4;return function(_0x44da91){logger[_0xc298('0x18')](_0x44da91[_0xc298('0x29')]);if(_0x44da91[_0xc298('0x2a')]){delete _0x44da91[_0xc298('0x2a')];}_0x564ad2[_0xc298('0x1e')](_0x1e5677)[_0xc298('0x2b')](_0x44da91);};}exports['index']=function(_0x5478fb,_0x2fafe2){var _0x3f83d6={},_0x3da204={},_0x4bfe80={'count':0x0,'rows':[]};var _0x5f3136=db[_0xc298('0x2c')][_0xc298('0x2d')];_0x3da204[_0xc298('0x2e')]=_['keys'](_0x5f3136);var _0x594633={'dateStart':_0x5478fb[_0xc298('0x2f')][_0xc298('0x30')],'dateEnd':_0x5478fb[_0xc298('0x2f')][_0xc298('0x31')]};delete _0x5478fb[_0xc298('0x2f')]['dateStart'];delete _0x5478fb[_0xc298('0x2f')][_0xc298('0x31')];_0x3da204['query']=_[_0xc298('0x32')](_0x5478fb[_0xc298('0x2f')]);_0x3da204[_0xc298('0x33')]=_[_0xc298('0x34')](_0x3da204[_0xc298('0x2e')],_0x3da204[_0xc298('0x2f')]);_0x3f83d6[_0xc298('0x35')]=_['intersection'](_0x3da204[_0xc298('0x2e')],qs[_0xc298('0x36')](_0x5478fb[_0xc298('0x2f')][_0xc298('0x36')]));_0x3f83d6[_0xc298('0x35')]=_0x3f83d6[_0xc298('0x35')][_0xc298('0x37')]?_0x3f83d6['attributes']:_0x3da204[_0xc298('0x2e')];if(!_0x5478fb['query'][_0xc298('0x38')]('nolimit')){_0x3f83d6[_0xc298('0x22')]=qs[_0xc298('0x22')](_0x5478fb[_0xc298('0x2f')][_0xc298('0x22')]);_0x3f83d6[_0xc298('0x39')]=qs[_0xc298('0x39')](_0x5478fb['query'][_0xc298('0x39')]);}_0x3f83d6[_0xc298('0x3a')]=qs['sort'](_0x5478fb[_0xc298('0x2f')][_0xc298('0x3b')]);_0x3f83d6[_0xc298('0x3c')]=qs[_0xc298('0x33')](_[_0xc298('0x3d')](_0x5478fb[_0xc298('0x2f')],_0x3da204['filters']));if(_0x594633[_0xc298('0x30')]){if(_0x594633[_0xc298('0x31')]){_0x594633[_0xc298('0x31')]=moment(_0x594633[_0xc298('0x31')])[_0xc298('0x3e')](0x1,_0xc298('0x3f'));}else{_0x594633[_0xc298('0x31')]=moment(_0x594633[_0xc298('0x30')])['add'](0x1,'day');}_[_0xc298('0x40')](_0x3f83d6[_0xc298('0x3c')],{'createdAt':{'$gte':_0x594633[_0xc298('0x30')],'$lte':_0x594633[_0xc298('0x31')]}});}if(_0x5478fb[_0xc298('0x2f')][_0xc298('0x41')]){_0x3f83d6[_0xc298('0x3c')]=_[_0xc298('0x40')](_0x3f83d6[_0xc298('0x3c')],{'$or':_[_0xc298('0x42')](_0x3f83d6[_0xc298('0x35')],function(_0x574d60){var _0x88bb47={};_0x88bb47[_0x574d60]={'$like':'%'+_0x5478fb[_0xc298('0x2f')][_0xc298('0x41')]+'%'};return _0x88bb47;})});}_0x3f83d6=_[_0xc298('0x40')]({},_0x3f83d6,_0x5478fb[_0xc298('0x43')]);var _0x19adef={'where':_0x3f83d6[_0xc298('0x3c')]};return db[_0xc298('0x2c')][_0xc298('0x21')](_0x19adef)[_0xc298('0x44')](function(_0x360ac1){_0x4bfe80['count']=_0x360ac1;if(_0x5478fb[_0xc298('0x2f')][_0xc298('0x45')]){_0x3f83d6[_0xc298('0x46')]=[{'all':!![]}];}return db['Setting'][_0xc298('0x47')](_0x3f83d6);})['then'](function(_0x19f2ce){_0x4bfe80[_0xc298('0x48')]=_0x19f2ce;return _0x4bfe80;})[_0xc298('0x44')](respondWithFilteredResult(_0x2fafe2,_0x3f83d6))[_0xc298('0x1d')](handleError(_0x2fafe2,null));};exports['show']=function(_0x46da82,_0x5c06ac){var _0x442eba={'raw':![],'where':{'id':_0x46da82[_0xc298('0x49')]['id']}},_0x3b3464={};_0x3b3464[_0xc298('0x2e')]=_['keys'](db['Setting'][_0xc298('0x2d')]);_0x3b3464['query']=_[_0xc298('0x32')](_0x46da82[_0xc298('0x2f')]);_0x3b3464[_0xc298('0x33')]=_[_0xc298('0x34')](_0x3b3464[_0xc298('0x2e')],_0x3b3464[_0xc298('0x2f')]);_0x442eba[_0xc298('0x35')]=_[_0xc298('0x34')](_0x3b3464['model'],qs[_0xc298('0x36')](_0x46da82[_0xc298('0x2f')]['fields']));_0x442eba[_0xc298('0x35')]=_0x442eba[_0xc298('0x35')][_0xc298('0x37')]?_0x442eba[_0xc298('0x35')]:_0x3b3464['model'];if(_0x46da82[_0xc298('0x2f')]['includeAll']){_0x442eba[_0xc298('0x46')]=[{'all':!![]}];}_0x442eba=_[_0xc298('0x40')]({},_0x442eba,_0x46da82[_0xc298('0x43')]);return db[_0xc298('0x2c')]['find'](_0x442eba)[_0xc298('0x44')](handleEntityNotFound(_0x5c06ac,null))[_0xc298('0x44')](respondWithResult(_0x5c06ac,null))['catch'](handleError(_0x5c06ac,null));};exports[_0xc298('0x4a')]=function(_0x24fd5e,_0x44e62d,_0xd2fc0f){var _0x1b6fad;return db[_0xc298('0x2c')][_0xc298('0x4b')]({'where':{'id':_0x24fd5e[_0xc298('0x49')]['id']}})[_0xc298('0x44')](handleEntityNotFound(_0x44e62d,null))[_0xc298('0x44')](saveUpdates(_0x24fd5e[_0xc298('0x4c')],null))[_0xc298('0x44')](function(_0x2c61c4){if(_0x2c61c4){_0x1b6fad=_0x2c61c4['get']({'plain':!![]});var _0x214741=fs[_0xc298('0x4d')](path[_0xc298('0x4e')](config[_0xc298('0x4f')],'server/files/templates/stun.ejs'),_0xc298('0x50'));var _0x274d56=ejs[_0xc298('0x51')](_0x214741,_0x1b6fad);var _0x87a164=fs[_0xc298('0x4d')](path['join'](config[_0xc298('0x4f')],'server/files/templates/turn.ejs'),_0xc298('0x50'));var _0x4e7e05=ejs[_0xc298('0x51')](_0x87a164,_0x1b6fad);fs[_0xc298('0x52')](_0xc298('0x53'),_0x274d56);fs['writeFileSync'](_0xc298('0x54'),_0x4e7e05);return respondWithRpcPromise('Reload',_0xc298('0x4a'),{'module':'res_stun_monitor.so'});}})[_0xc298('0x44')](function(){return respondWithRpcPromise(_0xc298('0x55'),_0xc298('0x4a'),{'module':_0xc298('0x56')});})[_0xc298('0x44')](function(){return _0x1b6fad||null;})['then'](respondWithResult(_0x44e62d,null))[_0xc298('0x1d')](handleError(_0x44e62d,null));};exports['addLogo']=function(_0x7abeca,_0x4838a2,_0x373b14){if(_0x7abeca[_0xc298('0x57')]&&_0x7abeca[_0xc298('0x57')]['filename']){_0x7abeca['body'][_0xc298('0x58')]=_0x7abeca['file'][_0xc298('0x59')];}return db[_0xc298('0x2c')][_0xc298('0x4b')]({'where':{'id':_0x7abeca['params']['id']}})[_0xc298('0x44')](handleEntityNotFound(_0x4838a2,null))[_0xc298('0x44')](saveUpdates(_0x7abeca[_0xc298('0x4c')],null))['then'](respondWithResult(_0x4838a2,null))[_0xc298('0x1d')](handleError(_0x4838a2,null));};exports['addLogoLogin']=function(_0x5ab2f5,_0x4fb572,_0x2336c0){if(_0x5ab2f5[_0xc298('0x57')]&&_0x5ab2f5[_0xc298('0x57')][_0xc298('0x59')]){_0x5ab2f5[_0xc298('0x4c')]['loginLogo']=_0x5ab2f5['file'][_0xc298('0x59')];}return db[_0xc298('0x2c')]['find']({'where':{'id':_0x5ab2f5[_0xc298('0x49')]['id']}})['then'](handleEntityNotFound(_0x4fb572,null))[_0xc298('0x44')](saveUpdates(_0x5ab2f5[_0xc298('0x4c')],null))['then'](respondWithResult(_0x4fb572,null))['catch'](handleError(_0x4fb572,null));};var utilLicense=require(_0xc298('0x5a'));exports[_0xc298('0x5b')]=function(_0x45b38f,_0x49b305,_0x52e3d5){var _0x2a2679='server/files/images/logos';var _0x5e2831={'custom':![]};return utilLicense[_0xc298('0x5c')]()[_0xc298('0x44')](function(_0x41bb2c){if(_0x41bb2c){_0x5e2831=_0x41bb2c;}return db['Setting'][_0xc298('0x4b')]({'where':{'id':_0x45b38f[_0xc298('0x49')]['id']},'attributes':[_0xc298('0x58'),'loginLogo',_0xc298('0x5d'),_0xc298('0x5e')],'raw':!![]});})[_0xc298('0x44')](handleEntityNotFound(_0x49b305,null))[_0xc298('0x44')](function(_0x54e022){if(_0x54e022){var _0x35248d=_0x54e022[_0xc298('0x58')]&&fs['existsSync'](path[_0xc298('0x4e')](config[_0xc298('0x4f')],_0x2a2679,_[_0xc298('0x5f')](_0x54e022['logo'])))?path[_0xc298('0x4e')](config[_0xc298('0x4f')],_0x2a2679,_[_0xc298('0x5f')](_0x54e022[_0xc298('0x58')])):path['join'](config[_0xc298('0x4f')],_0x2a2679,_[_0xc298('0x5f')](_0xc298('0x60')));var _0x5b8e7f='default'+_[_0xc298('0x61')]('logo');if(_0x54e022[_0x5b8e7f]||!_0x5e2831[_0xc298('0x62')]){_0x35248d=path[_0xc298('0x4e')](config[_0xc298('0x4f')],_0x2a2679,_['toLower'](_0xc298('0x60')));}if(!fs['existsSync'](_0x35248d)){throw new db['Sequelize']['ValidationError'](_0xc298('0x63'));}return _0x49b305['download'](_0x35248d);}})[_0xc298('0x1d')](handleError(_0x49b305,null));};var utilLicense=require(_0xc298('0x5a'));exports[_0xc298('0x64')]=function(_0x24a73f,_0x15e39d,_0x62ccf7){var _0x56e559=_0xc298('0x65');var _0x3dd45d={'custom':![]};return utilLicense['getLicense']()[_0xc298('0x44')](function(_0x47beaa){if(_0x47beaa){_0x3dd45d=_0x47beaa;}return db[_0xc298('0x2c')][_0xc298('0x4b')]({'where':{'id':_0x24a73f['params']['id']},'attributes':['logo','loginLogo',_0xc298('0x5d'),_0xc298('0x5e')],'raw':!![]});})[_0xc298('0x44')](handleEntityNotFound(_0x15e39d,null))['then'](function(_0x48857d){if(_0x48857d){var _0xc6f640=_0x48857d['loginLogo']&&fs['existsSync'](path['join'](config[_0xc298('0x4f')],_0x56e559,_['toLower'](_0x48857d['loginLogo'])))?path[_0xc298('0x4e')](config['root'],_0x56e559,_['toLower'](_0x48857d[_0xc298('0x66')])):path[_0xc298('0x4e')](config[_0xc298('0x4f')],_0x56e559,_[_0xc298('0x5f')](_0xc298('0x67')));var _0xead9fd='default'+_[_0xc298('0x61')]('loginLogo');if(_0x48857d[_0xead9fd]||!_0x3dd45d['custom']){_0xc6f640=path[_0xc298('0x4e')](config[_0xc298('0x4f')],_0x56e559,_[_0xc298('0x5f')]('default_loginLogo.png'));}if(!fs[_0xc298('0x68')](_0xc6f640)){throw new db['Sequelize'][(_0xc298('0x69'))](_0xc298('0x63'));}return _0x15e39d[_0xc298('0x6a')](_0xc6f640);}})[_0xc298('0x1d')](handleError(_0x15e39d,null));};exports[_0xc298('0x6b')]=function(_0x52b0a3,_0x6ad4a6){return db['Setting'][_0xc298('0x4b')]({'where':{'id':_0x52b0a3['params']['id']},'attributes':[_0xc298('0x6c')]})[_0xc298('0x44')](respondWithResult(_0x6ad4a6,null))[_0xc298('0x1d')](handleError(_0x6ad4a6,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9e07d24..f0552e3 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 _0xfc8c=['util','../../config/logger','api','moment','bluebird','./setting.attributes','exports','settings','lodash'];(function(_0x4ca295,_0x18d226){var _0x1c35e8=function(_0x266746){while(--_0x266746){_0x4ca295['push'](_0x4ca295['shift']());}};_0x1c35e8(++_0x18d226);}(_0xfc8c,0x6b));var _0xcfc8=function(_0x67b465,_0x255653){_0x67b465=_0x67b465-0x0;var _0x3ed15f=_0xfc8c[_0x67b465];return _0x3ed15f;};'use strict';var _=require(_0xcfc8('0x0'));var util=require(_0xcfc8('0x1'));var logger=require(_0xcfc8('0x2'))(_0xcfc8('0x3'));var moment=require(_0xcfc8('0x4'));var BPromise=require(_0xcfc8('0x5'));var rp=require('request-promise');var attributes=require(_0xcfc8('0x6'));module[_0xcfc8('0x7')]=function(_0x59e9c,_0x411628){return _0x59e9c['define']('Setting',attributes,{'tableName':_0xcfc8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58e0=['moment','bluebird','request-promise','./setting.attributes','exports','Setting','util','../../config/logger'];(function(_0x1958e3,_0x5d679f){var _0x35aa7f=function(_0x5723eb){while(--_0x5723eb){_0x1958e3['push'](_0x1958e3['shift']());}};_0x35aa7f(++_0x5d679f);}(_0x58e0,0xbe));var _0x058e=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x58e0[_0x556927];return _0x5f1235;};'use strict';var _=require('lodash');var util=require(_0x058e('0x0'));var logger=require(_0x058e('0x1'))('api');var moment=require(_0x058e('0x2'));var BPromise=require(_0x058e('0x3'));var rp=require(_0x058e('0x4'));var attributes=require(_0x058e('0x5'));module[_0x058e('0x6')]=function(_0x29271d,_0x3a450f){return _0x29271d['define'](_0x058e('0x7'),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 d1b6c41..cb5d0bc 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 _0x6cac=['debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','info','request\x20sent'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x6cac,0x1b8));var _0xc6ca=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6cac[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xc6ca('0x0'));var moment=require(_0xc6ca('0x1'));var BPromise=require(_0xc6ca('0x2'));var rs=require(_0xc6ca('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc6ca('0x4'));var logger=require(_0xc6ca('0x5'))(_0xc6ca('0x6'));var config=require('../../config/environment');var jayson=require(_0xc6ca('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1eae9d,_0x374600,_0x178321){return new BPromise(function(_0xe0aa00,_0x273193){return client['request'](_0x1eae9d,_0x178321)['then'](function(_0xe5e2e1){logger[_0xc6ca('0x8')]('Setting,\x20%s,\x20%s',_0x374600,_0xc6ca('0x9'));logger[_0xc6ca('0xa')](_0xc6ca('0xb'),_0x374600,_0xc6ca('0x9'),JSON['stringify'](_0xe5e2e1));if(_0xe5e2e1[_0xc6ca('0xc')]){if(_0xe5e2e1[_0xc6ca('0xc')][_0xc6ca('0xd')]===0x1f4){logger[_0xc6ca('0xc')](_0xc6ca('0xe'),_0x374600,_0xe5e2e1[_0xc6ca('0xc')][_0xc6ca('0xf')]);return _0x273193(_0xe5e2e1['error'][_0xc6ca('0xf')]);}logger[_0xc6ca('0xc')](_0xc6ca('0xe'),_0x374600,_0xe5e2e1[_0xc6ca('0xc')][_0xc6ca('0xf')]);return _0xe0aa00(_0xe5e2e1['error']['message']);}else{logger[_0xc6ca('0x8')](_0xc6ca('0xe'),_0x374600,_0xc6ca('0x9'));_0xe0aa00(_0xe5e2e1[_0xc6ca('0x10')][_0xc6ca('0xf')]);}})[_0xc6ca('0x11')](function(_0x49e747){logger[_0xc6ca('0xc')]('Setting,\x20%s,\x20%s',_0x374600,_0x49e747);_0x273193(_0x49e747);});});} \ No newline at end of file +var _0xa6d2=['client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x51124c,_0x194449){var _0x27b1da=function(_0x438b8a){while(--_0x438b8a){_0x51124c['push'](_0x51124c['shift']());}};_0x27b1da(++_0x194449);}(_0xa6d2,0x99));var _0x2a6d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa6d2[_0x432682];return _0x463d05;};'use strict';var _=require(_0x2a6d('0x0'));var util=require(_0x2a6d('0x1'));var moment=require(_0x2a6d('0x2'));var BPromise=require(_0x2a6d('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x2a6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a6d('0x5'))(_0x2a6d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a6d('0x7')][_0x2a6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x207931,_0x210377,_0x2bb017){return new BPromise(function(_0x50a7d6,_0x313a7b){return client[_0x2a6d('0x9')](_0x207931,_0x2bb017)[_0x2a6d('0xa')](function(_0x34cfce){logger[_0x2a6d('0xb')](_0x2a6d('0xc'),_0x210377,_0x2a6d('0xd'));logger[_0x2a6d('0xe')](_0x2a6d('0xf'),_0x210377,_0x2a6d('0xd'),JSON['stringify'](_0x34cfce));if(_0x34cfce[_0x2a6d('0x10')]){if(_0x34cfce[_0x2a6d('0x10')]['code']===0x1f4){logger[_0x2a6d('0x10')]('Setting,\x20%s,\x20%s',_0x210377,_0x34cfce['error']['message']);return _0x313a7b(_0x34cfce[_0x2a6d('0x10')][_0x2a6d('0x11')]);}logger[_0x2a6d('0x10')](_0x2a6d('0xc'),_0x210377,_0x34cfce['error'][_0x2a6d('0x11')]);return _0x50a7d6(_0x34cfce[_0x2a6d('0x10')][_0x2a6d('0x11')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x210377,_0x2a6d('0xd'));_0x50a7d6(_0x34cfce[_0x2a6d('0x12')][_0x2a6d('0x11')]);}})[_0x2a6d('0x13')](function(_0x42d521){logger[_0x2a6d('0x10')]('Setting,\x20%s,\x20%s',_0x210377,_0x42d521);_0x313a7b(_0x42d521);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 32447d8..36a2277 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 _0xb58b=['addDisposition','/:id/canned_answers','notify','/:id/send','send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4e44ed,_0x2cca5e){_0x4e44ed=_0x4e44ed-0x0;var _0x95afcf=_0xb58b[_0x4e44ed];return _0x95afcf;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var express=require(_0xbb58('0x2'));var router=express['Router']();var auth=require(_0xbb58('0x3'));var interaction=require(_0xbb58('0x4'));var config=require('../../config/environment');var controller=require(_0xbb58('0x5'));router['get']('/',auth[_0xbb58('0x6')](),controller[_0xbb58('0x7')]);router[_0xbb58('0x8')]('/describe',auth[_0xbb58('0x6')](),controller[_0xbb58('0x9')]);router[_0xbb58('0x8')](_0xbb58('0xa'),auth[_0xbb58('0x6')](),controller[_0xbb58('0xb')]);router[_0xbb58('0x8')](_0xbb58('0xc'),auth[_0xbb58('0x6')](),controller[_0xbb58('0xd')]);router[_0xbb58('0x8')]('/:id/canned_answers',auth[_0xbb58('0x6')](),controller['getAnswers']);router[_0xbb58('0x8')](_0xbb58('0xe'),auth[_0xbb58('0x6')](),controller[_0xbb58('0xf')]);router['get'](_0xbb58('0x10'),auth[_0xbb58('0x6')](),controller['getInteractions']);router[_0xbb58('0x8')](_0xbb58('0x11'),auth[_0xbb58('0x6')](),controller[_0xbb58('0x12')]);router[_0xbb58('0x13')]('/',auth['isAuthenticated'](),controller[_0xbb58('0x14')]);router[_0xbb58('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbb58('0x15')]);router[_0xbb58('0x13')](_0xbb58('0x16'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/:id/notify',controller[_0xbb58('0x17')]);router[_0xbb58('0x13')]('/:id/applications',auth[_0xbb58('0x6')](),controller['addApplications']);router[_0xbb58('0x13')](_0xbb58('0x18'),auth[_0xbb58('0x6')](),controller[_0xbb58('0x19')]);router[_0xbb58('0x13')](_0xbb58('0x1a'),controller[_0xbb58('0x1b')]);router['post'](_0xbb58('0x11'),auth[_0xbb58('0x6')](),controller[_0xbb58('0x1c')]);router[_0xbb58('0x1d')](_0xbb58('0xa'),auth[_0xbb58('0x6')](),controller[_0xbb58('0x1e')]);router[_0xbb58('0x1f')](_0xbb58('0xa'),auth['isAuthenticated'](),controller[_0xbb58('0x20')]);router['delete'](_0xbb58('0xc'),auth[_0xbb58('0x6')](),controller[_0xbb58('0x21')]);router[_0xbb58('0x1f')](_0xbb58('0x16'),auth[_0xbb58('0x6')](),controller[_0xbb58('0x22')]);router[_0xbb58('0x1f')]('/:id/users',auth[_0xbb58('0x6')](),controller[_0xbb58('0x23')]);module[_0xbb58('0x24')]=router; \ No newline at end of file +var _0x35a9=['send','status','addAgents','put','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','notify','/:id/applications','addApplications','/:id/send'];(function(_0x401743,_0x2c936f){var _0x19ea58=function(_0x71b0a2){while(--_0x71b0a2){_0x401743['push'](_0x401743['shift']());}};_0x19ea58(++_0x2c936f);}(_0x35a9,0x73));var _0x935a=function(_0x58e661,_0x4f339d){_0x58e661=_0x58e661-0x0;var _0x654c65=_0x35a9[_0x58e661];return _0x654c65;};'use strict';var multer=require('multer');var util=require(_0x935a('0x0'));var path=require(_0x935a('0x1'));var express=require(_0x935a('0x2'));var router=express[_0x935a('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x935a('0x4'));var controller=require('./smsAccount.controller');router[_0x935a('0x5')]('/',auth[_0x935a('0x6')](),controller[_0x935a('0x7')]);router[_0x935a('0x5')](_0x935a('0x8'),auth[_0x935a('0x6')](),controller[_0x935a('0x9')]);router[_0x935a('0x5')]('/:id',auth[_0x935a('0x6')](),controller[_0x935a('0xa')]);router[_0x935a('0x5')](_0x935a('0xb'),auth[_0x935a('0x6')](),controller['getDispositions']);router[_0x935a('0x5')](_0x935a('0xc'),auth[_0x935a('0x6')](),controller['getAnswers']);router[_0x935a('0x5')]('/:id/applications',auth['isAuthenticated'](),controller[_0x935a('0xd')]);router[_0x935a('0x5')](_0x935a('0xe'),auth[_0x935a('0x6')](),controller[_0x935a('0xf')]);router[_0x935a('0x5')](_0x935a('0x10'),auth[_0x935a('0x6')](),controller['getAgents']);router[_0x935a('0x11')]('/',auth[_0x935a('0x6')](),controller[_0x935a('0x12')]);router[_0x935a('0x11')](_0x935a('0xb'),auth[_0x935a('0x6')](),controller[_0x935a('0x13')]);router[_0x935a('0x11')](_0x935a('0xc'),auth[_0x935a('0x6')](),controller['addAnswer']);router[_0x935a('0x11')](_0x935a('0x14'),controller[_0x935a('0x15')]);router[_0x935a('0x11')](_0x935a('0x16'),auth[_0x935a('0x6')](),controller[_0x935a('0x17')]);router['post'](_0x935a('0x18'),auth[_0x935a('0x6')](),controller[_0x935a('0x19')]);router[_0x935a('0x11')]('/:id/status',controller[_0x935a('0x1a')]);router[_0x935a('0x11')]('/:id/users',auth[_0x935a('0x6')](),controller[_0x935a('0x1b')]);router[_0x935a('0x1c')](_0x935a('0x1d'),auth[_0x935a('0x6')](),controller['update']);router[_0x935a('0x1e')](_0x935a('0x1d'),auth[_0x935a('0x6')](),controller['destroy']);router[_0x935a('0x1e')](_0x935a('0xb'),auth[_0x935a('0x6')](),controller[_0x935a('0x1f')]);router['delete']('/:id/canned_answers',auth[_0x935a('0x6')](),controller[_0x935a('0x20')]);router['delete'](_0x935a('0x10'),auth[_0x935a('0x6')](),controller[_0x935a('0x21')]);module[_0x935a('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 e747235..7c24428 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 _0xc5cc=['randomstring','exports','STRING','name','generate','ENUM','twilio','clicksend','plivo','basic','classic','classic+','TEXT','BOOLEAN','INTEGER'];(function(_0x3e5436,_0x16e523){var _0x34dfc5=function(_0x1b7a0e){while(--_0x1b7a0e){_0x3e5436['push'](_0x3e5436['shift']());}};_0x34dfc5(++_0x16e523);}(_0xc5cc,0x96));var _0xcc5c=function(_0x1b6a9d,_0x335d32){_0x1b6a9d=_0x1b6a9d-0x0;var _0x1fc900=_0xc5cc[_0x1b6a9d];return _0x1fc900;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcc5c('0x0'));module[_0xcc5c('0x1')]={'name':{'type':Sequelize[_0xcc5c('0x2')],'unique':_0xcc5c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xcc5c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xcc5c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xcc5c('0x2')],'defaultValue':function(){return rs[_0xcc5c('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcc5c('0x5')](_0xcc5c('0x6'),'skebby','connectel',_0xcc5c('0x7'),_0xcc5c('0x8'))},'accountSid':{'type':Sequelize[_0xcc5c('0x2')]},'authId':{'type':Sequelize[_0xcc5c('0x2')]},'authToken':{'type':Sequelize[_0xcc5c('0x2')]},'smsMethod':{'type':Sequelize[_0xcc5c('0x5')](_0xcc5c('0x9'),_0xcc5c('0xa'),_0xcc5c('0xb'))},'username':{'type':Sequelize[_0xcc5c('0x2')]},'password':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xcc5c('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xcc5c('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xcc5c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcc5c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcc5c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcc5c('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcc5c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcc5c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0xdf4c=['classic','classic+','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo','basic'];(function(_0x6cd863,_0x459d21){var _0x1ce986=function(_0x1fd0b0){while(--_0x1fd0b0){_0x6cd863['push'](_0x6cd863['shift']());}};_0x1ce986(++_0x459d21);}(_0xdf4c,0x1b6));var _0xcdf4=function(_0xac72f7,_0x237a87){_0xac72f7=_0xac72f7-0x0;var _0x5b1c13=_0xdf4c[_0xac72f7];return _0x5b1c13;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xcdf4('0x0')]={'name':{'type':Sequelize[_0xcdf4('0x1')],'unique':_0xcdf4('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xcdf4('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xcdf4('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xcdf4('0x1')],'defaultValue':function(){return rs[_0xcdf4('0x3')]();}},'phone':{'type':Sequelize[_0xcdf4('0x1')]},'type':{'type':Sequelize[_0xcdf4('0x4')]('twilio',_0xcdf4('0x5'),_0xcdf4('0x6'),_0xcdf4('0x7'),_0xcdf4('0x8'))},'accountSid':{'type':Sequelize[_0xcdf4('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xcdf4('0x4')](_0xcdf4('0x9'),_0xcdf4('0xa'),_0xcdf4('0xb'))},'username':{'type':Sequelize[_0xcdf4('0x1')]},'password':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xcdf4('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xcdf4('0x1')]},'notificationTemplate':{'type':Sequelize[_0xcdf4('0xc')],'defaultValue':function(){return _0xcdf4('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcdf4('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcdf4('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcdf4('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcdf4('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c037ba8..42f3270 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 _0xb3c8=['jayson/promise','client','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','count','offset','apply','save','update','destroy','stack','name','send','index','SmsAccount','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','add','day','merge','where','map','filter','options','include','findAll','rows','show','rawAttributes','includeAll','find','create','body','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','type','from','From','sender','text','connectel','clicksend','messageId','message_id','Text','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','SmsInteraction','spread','interaction','created','autoclose','applications','*,*,*,*','SmsMessage','ContactId','UserId','unshift','agent','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','text/xml','sequelize','transaction','findAndCountAll','priority','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','get','user','Messages','dataValues','push','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','skebby','DELIVERED','inspect','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','socket.io-emitter','localhost'];(function(_0x955747,_0xd1ab29){var _0x3ff6d5=function(_0x56ef79){while(--_0x56ef79){_0x955747['push'](_0x955747['shift']());}};_0x3ff6d5(++_0xd1ab29);}(_0xb3c8,0xa4));var _0x8b3c=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb3c8[_0x16d10f];return _0x50c823;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b3c('0x0'));var BPromise=require(_0x8b3c('0x1'));var Mustache=require(_0x8b3c('0x2'));var util=require(_0x8b3c('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x8b3c('0x4'));var ejs=require(_0x8b3c('0x5'));var fs=require('fs');var _=require(_0x8b3c('0x6'));var squel=require('squel');var crypto=require(_0x8b3c('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x8b3c('0x8'));var toCsv=require('to-csv');var querystring=require(_0x8b3c('0x9'));var Papa=require(_0x8b3c('0xa'));var qs=require(_0x8b3c('0xb'));var logger=require(_0x8b3c('0xc'))(_0x8b3c('0xd'));var utils=require(_0x8b3c('0xe'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x8b3c('0xf'))({'host':_0x8b3c('0x10'),'port':0x18eb});require('./smsAccount.socket')['register'](socket);var jayson=require(_0x8b3c('0x11'));var client=jayson[_0x8b3c('0x12')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2654b3,_0x27770a,_0x1c81a6,_0x2accc9){return new BPromise(function(_0x4d846e,_0x3c99d6){var _0x3caa45=_0x2accc9||client;return _0x3caa45['request'](_0x2654b3,_0x1c81a6)[_0x8b3c('0x13')](function(_0x11001a){logger[_0x8b3c('0x14')]('SmsAccount,\x20%s,\x20%s',_0x27770a,_0x8b3c('0x15'));logger[_0x8b3c('0x16')](_0x8b3c('0x17'),_0x27770a,_0x8b3c('0x15'),JSON[_0x8b3c('0x18')](_0x11001a));if(_0x11001a['error']){if(_0x11001a[_0x8b3c('0x19')][_0x8b3c('0x1a')]===0x1f4){logger[_0x8b3c('0x19')](_0x8b3c('0x1b'),_0x27770a,_0x11001a['error']['message']);return _0x3c99d6(_0x11001a[_0x8b3c('0x19')][_0x8b3c('0x1c')]);}logger[_0x8b3c('0x19')](_0x8b3c('0x1b'),_0x27770a,_0x11001a[_0x8b3c('0x19')]['message']);return _0x4d846e(_0x11001a[_0x8b3c('0x19')][_0x8b3c('0x1c')]);}else{logger[_0x8b3c('0x14')](_0x8b3c('0x1b'),_0x27770a,_0x8b3c('0x15'));_0x4d846e(_0x11001a['result']['message']);}})[_0x8b3c('0x1d')](function(_0x24e6b9){logger[_0x8b3c('0x19')]('SmsAccount,\x20%s,\x20%s',_0x27770a,_0x24e6b9);_0x3c99d6(_0x24e6b9);});});}function respondWithStatusCode(_0x5acc34,_0x17f1ed){_0x17f1ed=_0x17f1ed||0xcc;return function(_0x5bbe2f){if(_0x5bbe2f){return _0x5acc34[_0x8b3c('0x1e')](_0x17f1ed);}return _0x5acc34['status'](_0x17f1ed)[_0x8b3c('0x1f')]();};}function respondWithResult(_0x36d753,_0x3bcf6c){_0x3bcf6c=_0x3bcf6c||0xc8;return function(_0x49aa5d){if(_0x49aa5d){return _0x36d753[_0x8b3c('0x20')](_0x3bcf6c)[_0x8b3c('0x21')](_0x49aa5d);}};}function respondWithFilteredResult(_0x159092,_0x26646e){return function(_0x30a846){if(_0x30a846){var _0x9eca05=_0x30a846[_0x8b3c('0x22')],_0x2fdfda=_0x26646e[_0x8b3c('0x23')],_0x4e4592=_0x26646e[_0x8b3c('0x23')]+_0x26646e['limit'],_0x85d6d8;if(_0x4e4592>=_0x9eca05){_0x4e4592=_0x9eca05;_0x85d6d8=0xc8;}else{_0x85d6d8=0xce;}_0x159092[_0x8b3c('0x20')](_0x85d6d8);return _0x159092['set']('Content-Range',_0x2fdfda+'-'+_0x4e4592+'/'+_0x9eca05)[_0x8b3c('0x21')](_0x30a846);}return null;};}function patchUpdates(_0xb01845){return function(_0x54a027){try{jsonpatch[_0x8b3c('0x24')](_0x54a027,_0xb01845,!![]);}catch(_0x4a229a){return BPromise['reject'](_0x4a229a);}return _0x54a027[_0x8b3c('0x25')]();};}function saveUpdates(_0x1698ca,_0x5b11fc){return function(_0x321bd8){if(_0x321bd8){return _0x321bd8[_0x8b3c('0x26')](_0x1698ca)[_0x8b3c('0x13')](function(_0x232022){return _0x232022;});}return null;};}function removeEntity(_0x415bf1,_0x11c925){return function(_0x535444){if(_0x535444){return _0x535444[_0x8b3c('0x27')]()[_0x8b3c('0x13')](function(){_0x415bf1[_0x8b3c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x172ef8,_0x244034){return function(_0x401029){if(!_0x401029){_0x172ef8[_0x8b3c('0x1e')](0x194);}return _0x401029;};}function handleError(_0x542f1c,_0x4b874a){_0x4b874a=_0x4b874a||0x1f4;return function(_0x785871){logger[_0x8b3c('0x19')](_0x785871[_0x8b3c('0x28')]);if(_0x785871['name']){delete _0x785871[_0x8b3c('0x29')];}_0x542f1c['status'](_0x4b874a)[_0x8b3c('0x2a')](_0x785871);};}exports[_0x8b3c('0x2b')]=function(_0x11e6a5,_0x2cd4d8){var _0x3d4d06={},_0xb7e018={},_0x48e067={'count':0x0,'rows':[]};var _0x179fbd=db[_0x8b3c('0x2c')]['rawAttributes'];_0xb7e018[_0x8b3c('0x2d')]=_[_0x8b3c('0x2e')](_0x179fbd);var _0x41db23={'dateStart':_0x11e6a5[_0x8b3c('0x2f')][_0x8b3c('0x30')],'dateEnd':_0x11e6a5['query'][_0x8b3c('0x31')]};delete _0x11e6a5[_0x8b3c('0x2f')][_0x8b3c('0x30')];delete _0x11e6a5[_0x8b3c('0x2f')][_0x8b3c('0x31')];_0xb7e018[_0x8b3c('0x2f')]=_['keys'](_0x11e6a5[_0x8b3c('0x2f')]);_0xb7e018[_0x8b3c('0x32')]=_[_0x8b3c('0x33')](_0xb7e018[_0x8b3c('0x2d')],_0xb7e018[_0x8b3c('0x2f')]);_0x3d4d06[_0x8b3c('0x34')]=_[_0x8b3c('0x33')](_0xb7e018[_0x8b3c('0x2d')],qs['fields'](_0x11e6a5[_0x8b3c('0x2f')][_0x8b3c('0x35')]));_0x3d4d06['attributes']=_0x3d4d06[_0x8b3c('0x34')][_0x8b3c('0x36')]?_0x3d4d06[_0x8b3c('0x34')]:_0xb7e018[_0x8b3c('0x2d')];if(!_0x11e6a5[_0x8b3c('0x2f')][_0x8b3c('0x37')](_0x8b3c('0x38'))){_0x3d4d06[_0x8b3c('0x39')]=qs[_0x8b3c('0x39')](_0x11e6a5[_0x8b3c('0x2f')][_0x8b3c('0x39')]);_0x3d4d06[_0x8b3c('0x23')]=qs[_0x8b3c('0x23')](_0x11e6a5['query'][_0x8b3c('0x23')]);}_0x3d4d06[_0x8b3c('0x3a')]=qs[_0x8b3c('0x3b')](_0x11e6a5[_0x8b3c('0x2f')]['sort']);_0x3d4d06['where']=qs[_0x8b3c('0x32')](_['pick'](_0x11e6a5[_0x8b3c('0x2f')],_0xb7e018[_0x8b3c('0x32')]));if(_0x41db23[_0x8b3c('0x30')]){if(_0x41db23[_0x8b3c('0x31')]){_0x41db23[_0x8b3c('0x31')]=moment(_0x41db23['dateEnd'])[_0x8b3c('0x3c')](0x1,_0x8b3c('0x3d'));}else{_0x41db23[_0x8b3c('0x31')]=moment(_0x41db23[_0x8b3c('0x30')])['add'](0x1,_0x8b3c('0x3d'));}_[_0x8b3c('0x3e')](_0x3d4d06[_0x8b3c('0x3f')],{'createdAt':{'$gte':_0x41db23[_0x8b3c('0x30')],'$lte':_0x41db23[_0x8b3c('0x31')]}});}if(_0x11e6a5[_0x8b3c('0x2f')]['filter']){_0x3d4d06[_0x8b3c('0x3f')]=_['merge'](_0x3d4d06[_0x8b3c('0x3f')],{'$or':_[_0x8b3c('0x40')](_0x3d4d06[_0x8b3c('0x34')],function(_0x2278a4){var _0x237047={};_0x237047[_0x2278a4]={'$like':'%'+_0x11e6a5[_0x8b3c('0x2f')][_0x8b3c('0x41')]+'%'};return _0x237047;})});}_0x3d4d06=_[_0x8b3c('0x3e')]({},_0x3d4d06,_0x11e6a5[_0x8b3c('0x42')]);var _0x2b9b4b={'where':_0x3d4d06[_0x8b3c('0x3f')]};return db['SmsAccount']['count'](_0x2b9b4b)[_0x8b3c('0x13')](function(_0x20ffcd){_0x48e067[_0x8b3c('0x22')]=_0x20ffcd;if(_0x11e6a5['query']['includeAll']){_0x3d4d06[_0x8b3c('0x43')]=[{'all':!![]}];}return db[_0x8b3c('0x2c')][_0x8b3c('0x44')](_0x3d4d06);})[_0x8b3c('0x13')](function(_0x31acd0){_0x48e067[_0x8b3c('0x45')]=_0x31acd0;return _0x48e067;})[_0x8b3c('0x13')](respondWithFilteredResult(_0x2cd4d8,_0x3d4d06))[_0x8b3c('0x1d')](handleError(_0x2cd4d8,null));};exports[_0x8b3c('0x46')]=function(_0x26f9c7,_0x26086d){var _0x4e3b06={'raw':![],'where':{'id':_0x26f9c7['params']['id']}},_0x28661d={};_0x28661d[_0x8b3c('0x2d')]=_[_0x8b3c('0x2e')](db['SmsAccount'][_0x8b3c('0x47')]);_0x28661d[_0x8b3c('0x2f')]=_[_0x8b3c('0x2e')](_0x26f9c7[_0x8b3c('0x2f')]);_0x28661d[_0x8b3c('0x32')]=_[_0x8b3c('0x33')](_0x28661d[_0x8b3c('0x2d')],_0x28661d[_0x8b3c('0x2f')]);_0x4e3b06['attributes']=_[_0x8b3c('0x33')](_0x28661d['model'],qs['fields'](_0x26f9c7[_0x8b3c('0x2f')]['fields']));_0x4e3b06[_0x8b3c('0x34')]=_0x4e3b06[_0x8b3c('0x34')][_0x8b3c('0x36')]?_0x4e3b06[_0x8b3c('0x34')]:_0x28661d[_0x8b3c('0x2d')];if(_0x26f9c7[_0x8b3c('0x2f')][_0x8b3c('0x48')]){_0x4e3b06['include']=[{'all':!![]}];}_0x4e3b06=_[_0x8b3c('0x3e')]({},_0x4e3b06,_0x26f9c7[_0x8b3c('0x42')]);return db['SmsAccount'][_0x8b3c('0x49')](_0x4e3b06)[_0x8b3c('0x13')](handleEntityNotFound(_0x26086d,null))['then'](respondWithResult(_0x26086d,null))['catch'](handleError(_0x26086d,null));};exports[_0x8b3c('0x4a')]=function(_0x15d9bb,_0x2ec5d0){return db[_0x8b3c('0x2c')][_0x8b3c('0x4a')](_0x15d9bb[_0x8b3c('0x4b')],{})[_0x8b3c('0x13')](respondWithResult(_0x2ec5d0,0xc9))[_0x8b3c('0x1d')](handleError(_0x2ec5d0,null));};exports[_0x8b3c('0x26')]=function(_0x500fa5,_0x325baa){if(_0x500fa5['body']['id']){delete _0x500fa5[_0x8b3c('0x4b')]['id'];}return db[_0x8b3c('0x2c')][_0x8b3c('0x49')]({'where':{'id':_0x500fa5['params']['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x325baa,null))['then'](saveUpdates(_0x500fa5[_0x8b3c('0x4b')],null))['then'](respondWithResult(_0x325baa,null))[_0x8b3c('0x1d')](handleError(_0x325baa,null));};exports[_0x8b3c('0x27')]=function(_0x2a4d02,_0x47cab9){return db[_0x8b3c('0x2c')][_0x8b3c('0x49')]({'where':{'id':_0x2a4d02[_0x8b3c('0x4c')]['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x47cab9,null))[_0x8b3c('0x13')](removeEntity(_0x47cab9,null))[_0x8b3c('0x1d')](handleError(_0x47cab9,null));};exports[_0x8b3c('0x4d')]=function(_0xbe2f1a,_0xaedf02){return db[_0x8b3c('0x2c')]['describe']()[_0x8b3c('0x13')](respondWithResult(_0xaedf02,null))['catch'](handleError(_0xaedf02,null));};exports[_0x8b3c('0x4e')]=function(_0x5e0cf1,_0x389cb0,_0x538a1d){if(_0x5e0cf1[_0x8b3c('0x4b')]['id']){delete _0x5e0cf1[_0x8b3c('0x4b')]['id'];}return db[_0x8b3c('0x2c')][_0x8b3c('0x49')]({'where':{'id':_0x5e0cf1['params']['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x389cb0,null))[_0x8b3c('0x13')](function(_0xf58d8a){if(_0xf58d8a){_0x5e0cf1[_0x8b3c('0x4b')][_0x8b3c('0x4f')]=_0xf58d8a['id'];return db[_0x8b3c('0x50')][_0x8b3c('0x4a')](_0x5e0cf1['body']);}})['then'](respondWithResult(_0x389cb0,null))[_0x8b3c('0x1d')](handleError(_0x389cb0,null));};exports[_0x8b3c('0x51')]=function(_0xdbd762,_0x1521ae,_0x6aa389){var _0x3762fe={'raw':![],'where':{}};var _0x37b291={};var _0x53bf8c={'count':0x0,'rows':[]};return db[_0x8b3c('0x2c')][_0x8b3c('0x52')]({'where':{'id':_0xdbd762[_0x8b3c('0x4c')]['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x1521ae,null))[_0x8b3c('0x13')](function(_0x44e722){if(_0x44e722){_0x37b291[_0x8b3c('0x2d')]=_['keys'](db[_0x8b3c('0x50')]['rawAttributes']);_0x37b291[_0x8b3c('0x2f')]=_['keys'](_0xdbd762[_0x8b3c('0x2f')]);_0x37b291[_0x8b3c('0x32')]=_['intersection'](_0x37b291[_0x8b3c('0x2d')],_0x37b291[_0x8b3c('0x2f')]);_0x3762fe[_0x8b3c('0x34')]=_[_0x8b3c('0x33')](_0x37b291['model'],qs['fields'](_0xdbd762[_0x8b3c('0x2f')][_0x8b3c('0x35')]));_0x3762fe[_0x8b3c('0x34')]=_0x3762fe[_0x8b3c('0x34')]['length']?_0x3762fe['attributes']:_0x37b291[_0x8b3c('0x2d')];if(!_0xdbd762['query'][_0x8b3c('0x37')](_0x8b3c('0x38'))){_0x3762fe['limit']=qs[_0x8b3c('0x39')](_0xdbd762[_0x8b3c('0x2f')]['limit']);_0x3762fe[_0x8b3c('0x23')]=qs[_0x8b3c('0x23')](_0xdbd762[_0x8b3c('0x2f')][_0x8b3c('0x23')]);}_0x3762fe[_0x8b3c('0x3a')]=qs[_0x8b3c('0x3b')](_0xdbd762[_0x8b3c('0x2f')][_0x8b3c('0x3b')]);_0x3762fe[_0x8b3c('0x3f')]=qs['filters'](_['pick'](_0xdbd762[_0x8b3c('0x2f')],_0x37b291[_0x8b3c('0x32')]));_0x3762fe['where']['SmsAccountId']=_0x44e722['id'];if(_0xdbd762['query']['filter']){_0x3762fe[_0x8b3c('0x3f')]=_['merge'](_0x3762fe['where'],{'$or':_['map'](_0x3762fe[_0x8b3c('0x34')],function(_0x2436c3){var _0xd71913={};_0xd71913[_0x2436c3]={'$like':'%'+_0xdbd762[_0x8b3c('0x2f')][_0x8b3c('0x41')]+'%'};return _0xd71913;})});}_0x3762fe=_['merge']({},_0x3762fe,_0xdbd762[_0x8b3c('0x42')]);return db[_0x8b3c('0x50')][_0x8b3c('0x22')]({'where':_0x3762fe[_0x8b3c('0x3f')]})['then'](function(_0x16f021){_0x53bf8c[_0x8b3c('0x22')]=_0x16f021;if(_0xdbd762['query'][_0x8b3c('0x48')]){_0x3762fe['include']=[{'all':!![]}];}return db[_0x8b3c('0x50')][_0x8b3c('0x44')](_0x3762fe);})[_0x8b3c('0x13')](function(_0x3f847d){_0x53bf8c[_0x8b3c('0x45')]=_0x3f847d;return _0x53bf8c;});}})[_0x8b3c('0x13')](respondWithFilteredResult(_0x1521ae,_0x3762fe))['catch'](handleError(_0x1521ae,null));};exports[_0x8b3c('0x53')]=function(_0x5a71b9,_0x54cd30,_0x429156){var _0x4f9b5b;return db[_0x8b3c('0x2c')]['find']({'where':{'id':_0x5a71b9[_0x8b3c('0x4c')]['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x54cd30,null))[_0x8b3c('0x13')](function(_0x4ebf84){if(_0x4ebf84){return _0x4ebf84[_0x8b3c('0x53')](_0x5a71b9[_0x8b3c('0x2f')]['ids']);}})['then'](respondWithStatusCode(_0x54cd30,null))['catch'](handleError(_0x54cd30,null));};exports[_0x8b3c('0x54')]=function(_0x1a7056,_0x5d9160,_0x135873){if(_0x1a7056[_0x8b3c('0x4b')]['id']){delete _0x1a7056[_0x8b3c('0x4b')]['id'];}return db[_0x8b3c('0x2c')]['find']({'where':{'id':_0x1a7056[_0x8b3c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d9160,null))['then'](function(_0x4c9c71){if(_0x4c9c71){_0x1a7056['body'][_0x8b3c('0x4f')]=_0x4c9c71['id'];return db[_0x8b3c('0x55')][_0x8b3c('0x4a')](_0x1a7056[_0x8b3c('0x4b')]);}})[_0x8b3c('0x13')](respondWithResult(_0x5d9160,null))[_0x8b3c('0x1d')](handleError(_0x5d9160,null));};exports[_0x8b3c('0x56')]=function(_0x55fdb1,_0xe444c3,_0x169736){var _0xf96e2f={'raw':![],'where':{}};var _0x5a424b={};var _0x3c22f8={'count':0x0,'rows':[]};return db[_0x8b3c('0x2c')]['findOne']({'where':{'id':_0x55fdb1[_0x8b3c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xe444c3,null))[_0x8b3c('0x13')](function(_0x4beafc){if(_0x4beafc){_0x5a424b['model']=_[_0x8b3c('0x2e')](db[_0x8b3c('0x55')][_0x8b3c('0x47')]);_0x5a424b[_0x8b3c('0x2f')]=_[_0x8b3c('0x2e')](_0x55fdb1[_0x8b3c('0x2f')]);_0x5a424b[_0x8b3c('0x32')]=_[_0x8b3c('0x33')](_0x5a424b[_0x8b3c('0x2d')],_0x5a424b[_0x8b3c('0x2f')]);_0xf96e2f['attributes']=_[_0x8b3c('0x33')](_0x5a424b['model'],qs[_0x8b3c('0x35')](_0x55fdb1[_0x8b3c('0x2f')]['fields']));_0xf96e2f[_0x8b3c('0x34')]=_0xf96e2f[_0x8b3c('0x34')][_0x8b3c('0x36')]?_0xf96e2f['attributes']:_0x5a424b[_0x8b3c('0x2d')];if(!_0x55fdb1[_0x8b3c('0x2f')][_0x8b3c('0x37')](_0x8b3c('0x38'))){_0xf96e2f[_0x8b3c('0x39')]=qs[_0x8b3c('0x39')](_0x55fdb1[_0x8b3c('0x2f')][_0x8b3c('0x39')]);_0xf96e2f[_0x8b3c('0x23')]=qs[_0x8b3c('0x23')](_0x55fdb1[_0x8b3c('0x2f')][_0x8b3c('0x23')]);}_0xf96e2f[_0x8b3c('0x3a')]=qs[_0x8b3c('0x3b')](_0x55fdb1[_0x8b3c('0x2f')][_0x8b3c('0x3b')]);_0xf96e2f['where']=qs['filters'](_[_0x8b3c('0x57')](_0x55fdb1[_0x8b3c('0x2f')],_0x5a424b[_0x8b3c('0x32')]));_0xf96e2f[_0x8b3c('0x3f')][_0x8b3c('0x4f')]=_0x4beafc['id'];if(_0x55fdb1[_0x8b3c('0x2f')][_0x8b3c('0x41')]){_0xf96e2f[_0x8b3c('0x3f')]=_[_0x8b3c('0x3e')](_0xf96e2f[_0x8b3c('0x3f')],{'$or':_[_0x8b3c('0x40')](_0xf96e2f[_0x8b3c('0x34')],function(_0x334fd6){var _0x237ba0={};_0x237ba0[_0x334fd6]={'$like':'%'+_0x55fdb1[_0x8b3c('0x2f')][_0x8b3c('0x41')]+'%'};return _0x237ba0;})});}_0xf96e2f=_[_0x8b3c('0x3e')]({},_0xf96e2f,_0x55fdb1[_0x8b3c('0x42')]);return db[_0x8b3c('0x55')][_0x8b3c('0x22')]({'where':_0xf96e2f[_0x8b3c('0x3f')]})['then'](function(_0x23a251){_0x3c22f8[_0x8b3c('0x22')]=_0x23a251;if(_0x55fdb1[_0x8b3c('0x2f')][_0x8b3c('0x48')]){_0xf96e2f[_0x8b3c('0x43')]=[{'all':!![]}];}return db[_0x8b3c('0x55')][_0x8b3c('0x44')](_0xf96e2f);})[_0x8b3c('0x13')](function(_0x1680d1){_0x3c22f8['rows']=_0x1680d1;return _0x3c22f8;});}})[_0x8b3c('0x13')](respondWithFilteredResult(_0xe444c3,_0xf96e2f))[_0x8b3c('0x1d')](handleError(_0xe444c3,null));};exports[_0x8b3c('0x58')]=function(_0x37520a,_0x5e8fe9,_0x156cee){var _0x2d6207;return db[_0x8b3c('0x2c')][_0x8b3c('0x49')]({'where':{'id':_0x37520a[_0x8b3c('0x4c')]['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x5e8fe9,null))['then'](function(_0x46c898){if(_0x46c898){return _0x46c898[_0x8b3c('0x58')](_0x37520a[_0x8b3c('0x2f')][_0x8b3c('0x59')]);}})[_0x8b3c('0x13')](respondWithStatusCode(_0x5e8fe9,null))[_0x8b3c('0x1d')](handleError(_0x5e8fe9,null));};exports[_0x8b3c('0x5a')]=function(_0x246f7d,_0x3049d9,_0x137b40){var _0x32e0b7={'channel':_0x8b3c('0x5b')};var _0xdc0ecd=[];var _0x20e495=[];var _0x444d6f={};return db[_0x8b3c('0x2c')][_0x8b3c('0x49')]({'where':{'id':_0x246f7d[_0x8b3c('0x4c')]['id']},'include':[{'model':db[_0x8b3c('0x5c')],'as':_0x8b3c('0x5d')}]})[_0x8b3c('0x13')](handleEntityNotFound(_0x3049d9,null))['then'](function(_0x4a0ce6){_0x32e0b7[_0x8b3c('0x5e')]=_0x4a0ce6;_0x32e0b7['applications']=_[_0x8b3c('0x5f')](_0x4a0ce6['Applications'],['priority'],[_0x8b3c('0x60')]);if(_0x32e0b7[_0x8b3c('0x5e')][_0x8b3c('0x5d')]){delete _0x32e0b7[_0x8b3c('0x5e')][_0x8b3c('0x5d')];}return db[_0x8b3c('0x61')][_0x8b3c('0x4d')]();})[_0x8b3c('0x13')](function(_0x4e5781){if(!_0x4e5781){throw new db[(_0x8b3c('0x62'))][(_0x8b3c('0x63'))](_0x8b3c('0x64'));}_0xdc0ecd=_['difference'](_[_0x8b3c('0x2e')](_0x4e5781),[_0x8b3c('0x65'),_0x8b3c('0x66')]);_0x20e495=_['difference'](_['keys'](_0x4e5781),['createdAt',_0x8b3c('0x66'),_0x8b3c('0x67'),_0x8b3c('0x68')]);_0x32e0b7['body']={'mapKey':_0x8b3c('0x69')};if(_0x32e0b7[_0x8b3c('0x5e')][_0x8b3c('0x6a')]){switch(_0x32e0b7[_0x8b3c('0x5e')]['type']){case'twilio':_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')]=_0x246f7d[_0x8b3c('0x4b')][_0x8b3c('0x6c')];_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x4b')]=_0x246f7d[_0x8b3c('0x4b')]['Body'];_0x32e0b7[_0x8b3c('0x4b')]['messageId']=_0x246f7d[_0x8b3c('0x4b')]['MessageSid'];break;case'skebby':_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')]=_0x246f7d[_0x8b3c('0x4b')][_0x8b3c('0x6d')];_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x4b')]=_0x246f7d['body'][_0x8b3c('0x6e')];break;case _0x8b3c('0x6f'):_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')]=_0x246f7d[_0x8b3c('0x4b')][_0x8b3c('0x6b')];_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x4b')]=_0x246f7d[_0x8b3c('0x4b')][_0x8b3c('0x1c')];break;case _0x8b3c('0x70'):_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')]=_0x246f7d[_0x8b3c('0x4b')][_0x8b3c('0x6b')];_0x32e0b7['body'][_0x8b3c('0x4b')]=_0x246f7d['body'][_0x8b3c('0x4b')];_0x32e0b7['body'][_0x8b3c('0x71')]=_0x246f7d['body'][_0x8b3c('0x72')];break;case'plivo':_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')]=_0x246f7d[_0x8b3c('0x4b')][_0x8b3c('0x6c')];_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x4b')]=_0x246f7d[_0x8b3c('0x4b')][_0x8b3c('0x73')];_0x32e0b7[_0x8b3c('0x4b')]['messageId']=_0x246f7d[_0x8b3c('0x4b')]['MessageUUID'];break;}}if(_0x32e0b7[_0x8b3c('0x4b')]['id']){delete _0x32e0b7[_0x8b3c('0x4b')]['id'];}if(_[_0x8b3c('0x74')](_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')])){throw new db[(_0x8b3c('0x62'))][(_0x8b3c('0x63'))](_0x8b3c('0x75'));}if(_[_0x8b3c('0x74')](_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x4b')])||_0x32e0b7['body'][_0x8b3c('0x4b')]===''){throw new db['Sequelize'][(_0x8b3c('0x63'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8b3c('0x74')](_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x76')])){throw new db[(_0x8b3c('0x62'))][(_0x8b3c('0x63'))](_0x8b3c('0x77')+_0x20e495);}if(!_['includes'](_0x20e495,_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x76')])){throw new db['Sequelize']['ValidationError'](_0x8b3c('0x78')+_0x20e495);}_0x444d6f[_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x76')]]=_0x32e0b7['body'][_0x8b3c('0x6b')];return db[_0x8b3c('0x79')][_0x8b3c('0x49')]({'where':{'id':_0x32e0b7[_0x8b3c('0x5e')][_0x8b3c('0x68')]},'include':[{'model':db[_0x8b3c('0x61')],'as':_0x8b3c('0x7a'),'where':_0x444d6f,'limit':0x1,'order':[[_0x8b3c('0x66'),_0x8b3c('0x7b')]]}]});})[_0x8b3c('0x13')](handleEntityNotFound(_0x3049d9,null))['then'](function(_0x50e73b){if(_0x50e73b){_0x32e0b7[_0x8b3c('0x7c')]=_[_0x8b3c('0x7d')](_0x50e73b,['Contacts']);if(_0x50e73b[_0x8b3c('0x7a')][_0x8b3c('0x36')]){return _0x50e73b[_0x8b3c('0x7a')][0x0];}var _0x3559e5=_[_0x8b3c('0x7e')](_0x32e0b7['body'],{'firstName':_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')],'ListId':_0x50e73b['id']});_0x3559e5[_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x76')]]=_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')];return db['CmContact']['create'](_0x3559e5,{'fields':_0xdc0ecd,'raw':!![]});}})[_0x8b3c('0x13')](handleEntityNotFound(_0x3049d9,null))[_0x8b3c('0x13')](function(_0x4b9574){if(_0x4b9574){_0x32e0b7['contact']=_0x4b9574;var _0x3db587={'ContactId':_0x4b9574['id'],'phone':_0x32e0b7['body'][_0x8b3c('0x6b')],'SmsAccountId':_0x246f7d[_0x8b3c('0x4c')]['id']};var _0x2f8163={'ContactId':_0x4b9574['id'],'SmsAccountId':_0x246f7d[_0x8b3c('0x4c')]['id'],'closed':![]};return db[_0x8b3c('0x7f')]['find']({'where':_0x2f8163})['then'](function(_0x33cc20){if(_0x33cc20){return[_0x33cc20,![]];}return db[_0x8b3c('0x7f')][_0x8b3c('0x4a')](_0x3db587)[_0x8b3c('0x13')](function(_0x35fdb1){return[_0x35fdb1,!![]];});});}})[_0x8b3c('0x80')](function(_0x3f77f6,_0x38b2e1){_0x32e0b7[_0x8b3c('0x81')]=_0x3f77f6['get']({'plain':!![]});_0x32e0b7[_0x8b3c('0x81')][_0x8b3c('0x82')]=![];if(_0x38b2e1){if(_0x32e0b7[_0x8b3c('0x5e')][_0x8b3c('0x83')]){_0x32e0b7[_0x8b3c('0x84')]['push']({'id':0x0,'priority':_0x32e0b7['applications'][_0x8b3c('0x36')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x8b3c('0x85')});}_0x32e0b7['interaction'][_0x8b3c('0x82')]=!![];}return db[_0x8b3c('0x86')][_0x8b3c('0x4a')]({'phone':_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x6b')],'messageId':_0x32e0b7[_0x8b3c('0x4b')][_0x8b3c('0x71')],'body':_0x32e0b7['body'][_0x8b3c('0x4b')],'SmsAccountId':_0x246f7d[_0x8b3c('0x4c')]['id'],'SmsInteractionId':_0x3f77f6['id'],'direction':'in','ContactId':_0x3f77f6[_0x8b3c('0x87')],'AttachmentId':_0x32e0b7[_0x8b3c('0x4b')]['AttachmentId']});})[_0x8b3c('0x13')](function(_0x4e936a){_0x32e0b7['message']=_0x4e936a;if(_0x32e0b7[_0x8b3c('0x81')]['UserId']){return db['User'][_0x8b3c('0x49')]({'attributes':['id',_0x8b3c('0x29')],'where':{'id':_0x32e0b7[_0x8b3c('0x81')][_0x8b3c('0x88')]}})['then'](function(_0x3e1636){if(_0x3e1636){_0x32e0b7['applications'][_0x8b3c('0x89')]({'id':0x0,'priority':0x0,'app':_0x8b3c('0x8a'),'appdata':_0x3e1636[_0x8b3c('0x29')]+','+(_0x32e0b7[_0x8b3c('0x5e')]['waitForTheAssignedAgent']||0xa),'interval':_0x8b3c('0x85')});}return respondWithRpcPromise('Start','startRouting',_0x32e0b7);});}return respondWithRpcPromise('Start',_0x8b3c('0x8b'),_0x32e0b7);})[_0x8b3c('0x13')](function(_0x28c887){if(_0x28c887){var _0x45002e=0xc8;var _0x1262a3=_0x8b3c('0x8c');logger[_0x8b3c('0x14')](_0x8b3c('0x17'),_0x1262a3,_0x45002e,'entity\x20found');logger[_0x8b3c('0x16')](_0x8b3c('0x8d'),_0x1262a3,_0x45002e,_0x8b3c('0x8e'),JSON[_0x8b3c('0x18')](_0x28c887));if(_0x32e0b7[_0x8b3c('0x5e')][_0x8b3c('0x6a')]==='twilio'){return _0x3049d9[_0x8b3c('0x20')](_0x45002e)[_0x8b3c('0x8f')]('Content-Type',_0x8b3c('0x90'))[_0x8b3c('0x2a')]('\x0a');}else{return _0x3049d9['status'](_0x45002e)[_0x8b3c('0x21')](_0x28c887);}}})[_0x8b3c('0x1d')](handleError(_0x3049d9,null));};exports['addApplications']=function(_0x1c575e,_0xe1dc3b,_0x3c83b4){return db['SmsAccount'][_0x8b3c('0x52')]({'where':{'id':_0x1c575e[_0x8b3c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xe1dc3b,null))[_0x8b3c('0x13')](function(_0xd68e02){if(_0xd68e02){return db[_0x8b3c('0x91')][_0x8b3c('0x92')](function(_0x5a5b28){return db[_0x8b3c('0x5c')][_0x8b3c('0x27')]({'where':{'SmsAccountId':_0x1c575e['params']['id']},'transaction':_0x5a5b28})[_0x8b3c('0x13')](function(_0x467784){var _0xdeb44=_[_0x8b3c('0x40')](_0x1c575e[_0x8b3c('0x4b')],function(_0x55f7b1){_0x55f7b1[_0x8b3c('0x4f')]=_0x1c575e[_0x8b3c('0x4c')]['id'];return _0x55f7b1;});return db[_0x8b3c('0x5c')]['bulkCreate'](_0xdeb44,{'transaction':_0x5a5b28});});})[_0x8b3c('0x13')](function(){return db[_0x8b3c('0x5c')][_0x8b3c('0x93')]({'where':{'SmsAccountId':_0x1c575e['params']['id']},'order':_0x8b3c('0x94')});});}})[_0x8b3c('0x13')](respondWithResult(_0xe1dc3b,null))[_0x8b3c('0x1d')](handleError(_0xe1dc3b,null));};exports[_0x8b3c('0x95')]=function(_0x370edf,_0x314a6f,_0x1a45f8){var _0x30e036={};var _0x5ac05a={};var _0xce19d8;var _0x151042;return db[_0x8b3c('0x2c')][_0x8b3c('0x52')]({'where':{'id':_0x370edf[_0x8b3c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x314a6f,null))[_0x8b3c('0x13')](function(_0x573ece){if(_0x573ece){_0xce19d8=_0x573ece;_0x5ac05a[_0x8b3c('0x2d')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x5ac05a[_0x8b3c('0x2f')]=_[_0x8b3c('0x2e')](_0x370edf['query']);_0x5ac05a['filters']=_['intersection'](_0x5ac05a[_0x8b3c('0x2d')],_0x5ac05a[_0x8b3c('0x2f')]);_0x30e036['attributes']=_[_0x8b3c('0x33')](_0x5ac05a[_0x8b3c('0x2d')],qs['fields'](_0x370edf[_0x8b3c('0x2f')]['fields']));_0x30e036['attributes']=_0x30e036[_0x8b3c('0x34')][_0x8b3c('0x36')]?_0x30e036[_0x8b3c('0x34')]:_0x5ac05a[_0x8b3c('0x2d')];_0x30e036['order']=qs[_0x8b3c('0x3b')](_0x370edf[_0x8b3c('0x2f')][_0x8b3c('0x3b')]);_0x30e036['where']=qs['filters'](_[_0x8b3c('0x57')](_0x370edf[_0x8b3c('0x2f')],_0x5ac05a['filters']));if(_0x370edf[_0x8b3c('0x2f')]['filter']){_0x30e036[_0x8b3c('0x3f')]=_[_0x8b3c('0x3e')](_0x30e036[_0x8b3c('0x3f')],{'$or':_['map'](_0x30e036['attributes'],function(_0x58b4d5){var _0x43d877={};_0x43d877[_0x58b4d5]={'$like':'%'+_0x370edf[_0x8b3c('0x2f')][_0x8b3c('0x41')]+'%'};return _0x43d877;})});}_0x30e036=_[_0x8b3c('0x3e')]({},_0x30e036,_0x370edf['options']);return _0xce19d8[_0x8b3c('0x95')](_0x30e036);}})[_0x8b3c('0x13')](function(_0x568953){if(_0x568953){_0x151042=_0x568953[_0x8b3c('0x36')];if(!_0x370edf[_0x8b3c('0x2f')][_0x8b3c('0x37')]('nolimit')){_0x30e036[_0x8b3c('0x39')]=qs['limit'](_0x370edf[_0x8b3c('0x2f')][_0x8b3c('0x39')]);_0x30e036[_0x8b3c('0x23')]=qs['offset'](_0x370edf['query']['offset']);}return _0xce19d8[_0x8b3c('0x95')](_0x30e036);}})[_0x8b3c('0x13')](function(_0x4302fd){if(_0x4302fd){return _0x4302fd?{'count':_0x151042,'rows':_0x4302fd}:null;}})['then'](respondWithResult(_0x314a6f,null))['catch'](handleError(_0x314a6f,null));};exports[_0x8b3c('0x96')]=function(_0x550b00,_0x4a044e,_0x3cf412){var _0x4d76fa={'raw':![],'where':{}};var _0xc7a092={};var _0xa83034={'count':0x0,'rows':[]};return db[_0x8b3c('0x2c')][_0x8b3c('0x52')]({'where':{'id':_0x550b00[_0x8b3c('0x4c')]['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x4a044e,null))[_0x8b3c('0x13')](function(_0x4b9e5d){if(_0x4b9e5d){_0xc7a092[_0x8b3c('0x2d')]=_[_0x8b3c('0x2e')](db[_0x8b3c('0x7f')][_0x8b3c('0x47')]);_0xc7a092[_0x8b3c('0x2f')]=_['keys'](_0x550b00[_0x8b3c('0x2f')]);_0xc7a092['filters']=_[_0x8b3c('0x33')](_0xc7a092[_0x8b3c('0x2d')],_0xc7a092[_0x8b3c('0x2f')]);_0x4d76fa[_0x8b3c('0x34')]=_[_0x8b3c('0x33')](_0xc7a092['model'],qs[_0x8b3c('0x35')](_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x35')]));_0x4d76fa[_0x8b3c('0x34')]=_0x4d76fa[_0x8b3c('0x34')][_0x8b3c('0x36')]?_0x4d76fa['attributes']:_0xc7a092[_0x8b3c('0x2d')];if(!_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x37')](_0x8b3c('0x38'))){_0x4d76fa[_0x8b3c('0x39')]=qs[_0x8b3c('0x39')](_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x39')]);_0x4d76fa['offset']=qs[_0x8b3c('0x23')](_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x23')]);}_0x4d76fa[_0x8b3c('0x3a')]=qs[_0x8b3c('0x3b')](_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x3b')]);_0x4d76fa[_0x8b3c('0x3f')]=qs['filters'](_[_0x8b3c('0x57')](_0x550b00[_0x8b3c('0x2f')],_0xc7a092['filters']));_0x4d76fa[_0x8b3c('0x3f')][_0x8b3c('0x4f')]=_0x4b9e5d['id'];if(_0x550b00['query'][_0x8b3c('0x41')]){_0x4d76fa[_0x8b3c('0x3f')]=_[_0x8b3c('0x3e')](_0x4d76fa['where'],{'$or':_['map'](_0x4d76fa[_0x8b3c('0x34')],function(_0x5a05e6){var _0xc9e94={};_0xc9e94[_0x5a05e6]={'$like':'%'+_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x41')]+'%'};return _0xc9e94;})});}_0x4d76fa=_[_0x8b3c('0x3e')]({},_0x4d76fa,_0x550b00['options']);return db[_0x8b3c('0x7f')][_0x8b3c('0x22')]({'where':_0x4d76fa[_0x8b3c('0x3f')]})[_0x8b3c('0x13')](function(_0x5aca45){_0xa83034[_0x8b3c('0x22')]=_0x5aca45;if(_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x48')]){_0x4d76fa[_0x8b3c('0x43')]=[{'model':db[_0x8b3c('0x61')],'as':_0x8b3c('0x97'),'required':![]},{'model':db[_0x8b3c('0x98')],'as':_0x8b3c('0x99'),'attributes':[_0x8b3c('0x29'),_0x8b3c('0x9a'),_0x8b3c('0x9b')],'required':![]},{'model':db[_0x8b3c('0x9c')],'as':_0x8b3c('0x9d'),'attributes':['id','name',_0x8b3c('0x9e')],'where':_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x9f')]?{'id':_0x550b00[_0x8b3c('0x2f')][_0x8b3c('0x9f')]}:undefined,'required':_0x550b00[_0x8b3c('0x2f')]['tag']?!![]:![]}];}return db[_0x8b3c('0x7f')]['findAll'](_0x4d76fa);})['then'](function(_0x4730a9){_0xa83034['rows']=_0x4730a9;return _0xa83034;});}})[_0x8b3c('0x13')](respondWithFilteredResult(_0x4a044e,_0x4d76fa))[_0x8b3c('0x1d')](handleError(_0x4a044e,null));};exports[_0x8b3c('0x2a')]=function(_0x3eae28,_0x2d624d,_0x429d9d){var _0xe72cab,_0x1fdfe5,_0x5a56e1;if(_['isNil'](_0x3eae28[_0x8b3c('0x4b')][_0x8b3c('0x4b')])||_0x3eae28[_0x8b3c('0x4b')][_0x8b3c('0x4b')]===''){throw new db[(_0x8b3c('0x62'))][(_0x8b3c('0x63'))](_0x8b3c('0xa0'));}if(_[_0x8b3c('0x74')](_0x3eae28[_0x8b3c('0x4b')]['to'])){throw new db[(_0x8b3c('0x62'))]['ValidationError']('to\x20is\x20mandatory');}_0xe72cab=_0x3eae28[_0x8b3c('0x4b')]['to'];return db['SmsAccount'][_0x8b3c('0x49')]({'where':{'id':_0x3eae28[_0x8b3c('0x4c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8b3c('0x61')],'as':_0x8b3c('0x7a'),'where':{'mobile':_0xe72cab},'limit':0x1,'order':[[_0x8b3c('0x66'),_0x8b3c('0x7b')]]}]}]})[_0x8b3c('0x13')](handleEntityNotFound(_0x2d624d,null))['then'](function(_0x1a4cfc){if(_0x1a4cfc&&_0x1a4cfc[_0x8b3c('0xa1')]){_0x1fdfe5=_0x1a4cfc[_0x8b3c('0xa2')]({'plain':!![]});if(_0x1fdfe5[_0x8b3c('0xa1')]&&_0x1fdfe5['List'][_0x8b3c('0x7a')][_0x8b3c('0x36')]){return _0x1fdfe5[_0x8b3c('0xa1')][_0x8b3c('0x7a')][0x0];}return db['CmContact'][_0x8b3c('0x4a')](_[_0x8b3c('0x7e')](_0x3eae28[_0x8b3c('0x4b')],{'firstName':_0xe72cab,'mobile':_0xe72cab,'phone':_0xe72cab,'ListId':_0x1fdfe5['ListId']}));}})[_0x8b3c('0x13')](handleEntityNotFound(_0x2d624d,null))[_0x8b3c('0x13')](function(_0x1e80fc){if(_0x1e80fc){_0x5a56e1=_0x1e80fc;return db[_0x8b3c('0x7f')][_0x8b3c('0x49')]({'where':{'ContactId':_0x5a56e1['id'],'closed':![],'SmsAccountId':_0x1fdfe5['id']}})['then'](function(_0x334bec){if(_0x334bec){return[_0x334bec,![]];}return db[_0x8b3c('0x7f')][_0x8b3c('0x4a')]({'UserId':_0x3eae28[_0x8b3c('0xa3')]['id'],'ContactId':_0x5a56e1['id'],'SmsAccountId':_0x1fdfe5['id'],'phone':_0xe72cab,'firstMsgDirection':'out','Messages':[_[_0x8b3c('0x3e')](_0x3eae28['body'],{'read':![],'body':_0x3eae28[_0x8b3c('0x4b')][_0x8b3c('0x4b')],'phone':_0xe72cab,'SmsAccountId':_0x1fdfe5['id'],'UserId':_0x3eae28[_0x8b3c('0xa3')]['id'],'ContactId':_0x5a56e1['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x8b3c('0xa4')}]})[_0x8b3c('0x13')](function(_0x5303be){return[_0x5303be,!![]];});});}})[_0x8b3c('0x80')](function(_0x1eae17,_0x3aea7f){if(_0x3aea7f){return _0x1eae17;}return db[_0x8b3c('0x86')][_0x8b3c('0x4a')](_[_0x8b3c('0x3e')](_0x3eae28[_0x8b3c('0x4b')],{'read':![],'body':_0x3eae28[_0x8b3c('0x4b')][_0x8b3c('0x4b')],'phone':_0xe72cab,'SmsAccountId':_0x1fdfe5['id'],'SmsInteractionId':_0x1eae17['id'],'UserId':_0x3eae28[_0x8b3c('0xa3')]['id'],'ContactId':_0x5a56e1['id']}))[_0x8b3c('0x13')](function(_0x3b04ec){_0x1eae17['dataValues'][_0x8b3c('0xa4')]=[];_0x1eae17[_0x8b3c('0xa5')][_0x8b3c('0xa4')][_0x8b3c('0xa6')](_0x3b04ec['dataValues']);return _0x1eae17;});})[_0x8b3c('0x13')](respondWithResult(_0x2d624d,null))[_0x8b3c('0x1d')](handleError(_0x2d624d,null));};exports[_0x8b3c('0x20')]=function(_0x4cf996,_0x25eecf,_0x1a7898){if(_0x4cf996[_0x8b3c('0x4b')]['id']){delete _0x4cf996[_0x8b3c('0x4b')]['id'];}var _0xacd66,_0x585972,_0x2a106c;return db[_0x8b3c('0x2c')][_0x8b3c('0x49')]({'where':{'id':_0x4cf996[_0x8b3c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25eecf,null))['then'](function(_0x2e2f32){if(_0x2e2f32){_0x2a106c=_0x2e2f32;logger[_0x8b3c('0x16')](_0x8b3c('0x17'),'status',_0x8b3c('0xa7'),_0x2e2f32[_0x8b3c('0x6a')],util['inspect'](_0x4cf996[_0x8b3c('0x4b')],{'showHidden':![],'depth':null}));switch(_0x2e2f32[_0x8b3c('0x6a')]){case'skebby':if(_0x4cf996['body'][_0x8b3c('0xa8')]&&_0x4cf996['body'][_0x8b3c('0x20')]){_0x585972=_0x4cf996[_0x8b3c('0x4b')][_0x8b3c('0x20')];return db[_0x8b3c('0x86')][_0x8b3c('0x49')]({'where':{'messageId':_0x4cf996[_0x8b3c('0x4b')][_0x8b3c('0xa8')]}});}break;case'connectel':if(_0x4cf996['body'][_0x8b3c('0xa9')]&&_0x4cf996[_0x8b3c('0x4b')]['statusInt']){_0x585972=_0x4cf996[_0x8b3c('0x4b')][_0x8b3c('0xaa')];return db[_0x8b3c('0x86')][_0x8b3c('0x49')]({'where':{'messageId':_0x4cf996['body']['requestid']}});}break;case _0x8b3c('0x70'):if(_0x4cf996[_0x8b3c('0x4b')][_0x8b3c('0x72')]&&_0x4cf996[_0x8b3c('0x4b')][_0x8b3c('0xab')]){_0x585972=_0x4cf996[_0x8b3c('0x4b')][_0x8b3c('0xab')];return db[_0x8b3c('0x86')][_0x8b3c('0x49')]({'where':{'messageId':_0x4cf996[_0x8b3c('0x4b')][_0x8b3c('0x72')]}});}break;}}})[_0x8b3c('0x13')](handleEntityNotFound(_0x25eecf,null))[_0x8b3c('0x13')](function(_0x2cdfb5){if(_0x2cdfb5){_0xacd66=_0x2cdfb5;switch(_0x2a106c['type']){case _0x8b3c('0xac'):if(_0x585972===_0x8b3c('0xad')){return _0xacd66[_0x8b3c('0x26')]({'read':!![]});}else{logger[_0x8b3c('0x19')](_0x8b3c('0x17'),'status','skebby',util['inspect'](_0x4cf996['body'],{'showHidden':![],'depth':null}));}break;case _0x8b3c('0x6f'):if(_0x585972==='1'){return _0xacd66[_0x8b3c('0x26')]({'read':!![]});}else{logger[_0x8b3c('0x19')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8b3c('0x20'),_0x8b3c('0xac'),util[_0x8b3c('0xae')](_0x4cf996['body'],{'showHidden':![],'depth':null}));}break;case _0x8b3c('0x70'):if(!_0x4cf996[_0x8b3c('0x4b')]['error_code']&&_0x585972>=0xc8&&_0x585972<=0xce){return _0xacd66['update']({'read':!![]});}else{logger[_0x8b3c('0x19')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8b3c('0x20'),_0x8b3c('0x70'),util[_0x8b3c('0xae')](_0x4cf996[_0x8b3c('0x4b')],{'showHidden':![],'depth':null}));}break;}return _0xacd66;}})['then'](respondWithResult(_0x25eecf,null))['catch'](handleError(_0x25eecf,null));};exports[_0x8b3c('0xaf')]=function(_0x49d6c4,_0x3bf6f5,_0x16e475){return db[_0x8b3c('0x2c')]['find']({'where':{'id':_0x49d6c4[_0x8b3c('0x4c')]['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x3bf6f5,null))['then'](function(_0x5761ef){if(_0x5761ef){return _0x5761ef[_0x8b3c('0xaf')](_0x49d6c4[_0x8b3c('0x4b')]['ids'],_[_0x8b3c('0x7d')](_0x49d6c4[_0x8b3c('0x4b')],[_0x8b3c('0x59'),'id'])||{})[_0x8b3c('0x80')](function(_0x5691c5){for(var _0x5597ec=0x0;_0x5597ec<_0x49d6c4[_0x8b3c('0x4b')][_0x8b3c('0x59')][_0x8b3c('0x36')];_0x5597ec+=0x1){socket[_0x8b3c('0xb0')]('userSmsAccount:save',{'UserId':_0x49d6c4[_0x8b3c('0x4b')][_0x8b3c('0x59')][_0x5597ec],'SmsAccountId':_0x49d6c4[_0x8b3c('0x4c')]['id']});}return _0x5691c5;});}})['then'](respondWithResult(_0x3bf6f5,null))[_0x8b3c('0x1d')](handleError(_0x3bf6f5,null));};exports[_0x8b3c('0xb1')]=function(_0x2f2ed6,_0x2917cf,_0x3b5dda){var _0x40a258;return db[_0x8b3c('0x2c')][_0x8b3c('0x49')]({'where':{'id':_0x2f2ed6[_0x8b3c('0x4c')]['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x2917cf,null))[_0x8b3c('0x13')](function(_0x2bbebd){if(_0x2bbebd){return _0x2bbebd[_0x8b3c('0xb1')](_0x2f2ed6[_0x8b3c('0x2f')][_0x8b3c('0x59')])[_0x8b3c('0x13')](function(_0x3b7881){if(_[_0x8b3c('0xb2')](_0x2f2ed6[_0x8b3c('0x2f')][_0x8b3c('0x59')])){for(var _0x7d50e0=0x0;_0x7d50e0<_0x2f2ed6['query']['ids'][_0x8b3c('0x36')];_0x7d50e0+=0x1){socket[_0x8b3c('0xb0')](_0x8b3c('0xb3'),{'UserId':_0x2f2ed6['query'][_0x8b3c('0x59')][_0x7d50e0],'SmsAccountId':_0x2f2ed6[_0x8b3c('0x4c')]['id']});}}else{socket[_0x8b3c('0xb0')](_0x8b3c('0xb3'),{'UserId':_0x2f2ed6[_0x8b3c('0x2f')]['ids'],'SmsAccountId':_0x2f2ed6['params']['id']});}});}})[_0x8b3c('0x13')](respondWithStatusCode(_0x2917cf,null))[_0x8b3c('0x1d')](handleError(_0x2917cf,null));};exports[_0x8b3c('0xb4')]=function(_0x361af0,_0x10486a,_0x3a6855){var _0xfbd2c7={};var _0x2c23f6={};var _0xd98236;var _0x1e59b6;return db['SmsAccount'][_0x8b3c('0x52')]({'where':{'id':_0x361af0[_0x8b3c('0x4c')]['id']}})[_0x8b3c('0x13')](handleEntityNotFound(_0x10486a,null))[_0x8b3c('0x13')](function(_0xa7f14f){if(_0xa7f14f){_0xd98236=_0xa7f14f;_0x2c23f6[_0x8b3c('0x2d')]=_[_0x8b3c('0x2e')](db['User']['rawAttributes']);_0x2c23f6[_0x8b3c('0x2f')]=_[_0x8b3c('0x2e')](_0x361af0[_0x8b3c('0x2f')]);_0x2c23f6[_0x8b3c('0x32')]=_['intersection'](_0x2c23f6[_0x8b3c('0x2d')],_0x2c23f6[_0x8b3c('0x2f')]);_0xfbd2c7['attributes']=_[_0x8b3c('0x33')](_0x2c23f6['model'],qs[_0x8b3c('0x35')](_0x361af0[_0x8b3c('0x2f')]['fields']));_0xfbd2c7['attributes']=_0xfbd2c7[_0x8b3c('0x34')][_0x8b3c('0x36')]?_0xfbd2c7[_0x8b3c('0x34')]:_0x2c23f6[_0x8b3c('0x2d')];_0xfbd2c7[_0x8b3c('0x3a')]=qs[_0x8b3c('0x3b')](_0x361af0[_0x8b3c('0x2f')][_0x8b3c('0x3b')]);_0xfbd2c7['where']=qs[_0x8b3c('0x32')](_[_0x8b3c('0x57')](_0x361af0[_0x8b3c('0x2f')],_0x2c23f6[_0x8b3c('0x32')]));if(_0x361af0[_0x8b3c('0x2f')]['filter']){_0xfbd2c7[_0x8b3c('0x3f')]=_[_0x8b3c('0x3e')](_0xfbd2c7[_0x8b3c('0x3f')],{'$or':_[_0x8b3c('0x40')](_0xfbd2c7['attributes'],function(_0x35452a){var _0x45c1b9={};_0x45c1b9[_0x35452a]={'$like':'%'+_0x361af0[_0x8b3c('0x2f')]['filter']+'%'};return _0x45c1b9;})});}_0xfbd2c7=_[_0x8b3c('0x3e')]({},_0xfbd2c7,_0x361af0[_0x8b3c('0x42')]);return _0xd98236[_0x8b3c('0xb4')](_0xfbd2c7);}})['then'](function(_0x4ce4bc){if(_0x4ce4bc){_0x1e59b6=_0x4ce4bc[_0x8b3c('0x36')];if(!_0x361af0['query'][_0x8b3c('0x37')]('nolimit')){_0xfbd2c7[_0x8b3c('0x39')]=qs[_0x8b3c('0x39')](_0x361af0[_0x8b3c('0x2f')][_0x8b3c('0x39')]);_0xfbd2c7[_0x8b3c('0x23')]=qs[_0x8b3c('0x23')](_0x361af0[_0x8b3c('0x2f')][_0x8b3c('0x23')]);}return _0xd98236[_0x8b3c('0xb4')](_0xfbd2c7);}})['then'](function(_0x59b2d){if(_0x59b2d){return _0x59b2d?{'count':_0x1e59b6,'rows':_0x59b2d}:null;}})[_0x8b3c('0x13')](respondWithResult(_0x10486a,null))[_0x8b3c('0x1d')](handleError(_0x10486a,null));}; \ No newline at end of file +var _0x7e96=['skebby','from','sender','text','connectel','message_id','plivo','Text','isNil','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','get','created','push','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','send','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','internal','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','user','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','clicksend','DELIVERED','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','stack','name','index','rawAttributes','query','dateStart','dateEnd','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','map','filter','options','SmsAccount','includeAll','include','findAll','catch','show','params','intersection','find','create','body','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','sms','SmsApplication','account','applications','orderBy','Applications','priority','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','Body','messageId','MessageSid'];(function(_0x2930f1,_0x33a7a2){var _0x12be73=function(_0x1ccbb7){while(--_0x1ccbb7){_0x2930f1['push'](_0x2930f1['shift']());}};_0x12be73(++_0x33a7a2);}(_0x7e96,0x1c5));var _0x67e9=function(_0x44c910,_0x426ef7){_0x44c910=_0x44c910-0x0;var _0x2388b1=_0x7e96[_0x44c910];return _0x2388b1;};'use strict';var jsonpatch=require(_0x67e9('0x0'));var rp=require('request-promise');var moment=require(_0x67e9('0x1'));var BPromise=require(_0x67e9('0x2'));var Mustache=require(_0x67e9('0x3'));var util=require(_0x67e9('0x4'));var path=require('path');var sox=require(_0x67e9('0x5'));var csv=require(_0x67e9('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x67e9('0x7'));var squel=require(_0x67e9('0x8'));var crypto=require(_0x67e9('0x9'));var jsforce=require(_0x67e9('0xa'));var deskjs=require(_0x67e9('0xb'));var toCsv=require('to-csv');var querystring=require(_0x67e9('0xc'));var Papa=require(_0x67e9('0xd'));var qs=require(_0x67e9('0xe'));var logger=require(_0x67e9('0xf'))(_0x67e9('0x10'));var utils=require('../../config/utils');var config=require(_0x67e9('0x11'));var db=require(_0x67e9('0x12'))['db'];var socket=require(_0x67e9('0x13'))({'host':_0x67e9('0x14'),'port':0x18eb});require(_0x67e9('0x15'))[_0x67e9('0x16')](socket);var jayson=require(_0x67e9('0x17'));var client=jayson[_0x67e9('0x18')][_0x67e9('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x426b8d,_0xac43b2,_0x38fd0f,_0x5335a8){return new BPromise(function(_0xae9ea2,_0x6b3ba3){var _0x3af8ff=_0x5335a8||client;return _0x3af8ff[_0x67e9('0x1a')](_0x426b8d,_0x38fd0f)[_0x67e9('0x1b')](function(_0x35e09c){logger['info'](_0x67e9('0x1c'),_0xac43b2,_0x67e9('0x1d'));logger[_0x67e9('0x1e')](_0x67e9('0x1f'),_0xac43b2,'request\x20sent',JSON[_0x67e9('0x20')](_0x35e09c));if(_0x35e09c['error']){if(_0x35e09c[_0x67e9('0x21')][_0x67e9('0x22')]===0x1f4){logger[_0x67e9('0x21')]('SmsAccount,\x20%s,\x20%s',_0xac43b2,_0x35e09c['error'][_0x67e9('0x23')]);return _0x6b3ba3(_0x35e09c[_0x67e9('0x21')][_0x67e9('0x23')]);}logger[_0x67e9('0x21')](_0x67e9('0x1c'),_0xac43b2,_0x35e09c[_0x67e9('0x21')]['message']);return _0xae9ea2(_0x35e09c[_0x67e9('0x21')][_0x67e9('0x23')]);}else{logger[_0x67e9('0x24')](_0x67e9('0x1c'),_0xac43b2,_0x67e9('0x1d'));_0xae9ea2(_0x35e09c['result'][_0x67e9('0x23')]);}})['catch'](function(_0x4d0dbc){logger[_0x67e9('0x21')](_0x67e9('0x1c'),_0xac43b2,_0x4d0dbc);_0x6b3ba3(_0x4d0dbc);});});}function respondWithStatusCode(_0x3d801a,_0x13fe5d){_0x13fe5d=_0x13fe5d||0xcc;return function(_0x3e09ed){if(_0x3e09ed){return _0x3d801a[_0x67e9('0x25')](_0x13fe5d);}return _0x3d801a[_0x67e9('0x26')](_0x13fe5d)[_0x67e9('0x27')]();};}function respondWithResult(_0x2575c9,_0x1903b3){_0x1903b3=_0x1903b3||0xc8;return function(_0x4fdd83){if(_0x4fdd83){return _0x2575c9[_0x67e9('0x26')](_0x1903b3)['json'](_0x4fdd83);}};}function respondWithFilteredResult(_0x1c1bc2,_0x4d050c){return function(_0x57c36b){if(_0x57c36b){var _0x24a9e6=_0x57c36b[_0x67e9('0x28')],_0x2ea47c=_0x4d050c[_0x67e9('0x29')],_0x4d3c1b=_0x4d050c[_0x67e9('0x29')]+_0x4d050c[_0x67e9('0x2a')],_0x263e67;if(_0x4d3c1b>=_0x24a9e6){_0x4d3c1b=_0x24a9e6;_0x263e67=0xc8;}else{_0x263e67=0xce;}_0x1c1bc2[_0x67e9('0x26')](_0x263e67);return _0x1c1bc2['set'](_0x67e9('0x2b'),_0x2ea47c+'-'+_0x4d3c1b+'/'+_0x24a9e6)[_0x67e9('0x2c')](_0x57c36b);}return null;};}function patchUpdates(_0x11a2bc){return function(_0x316d06){try{jsonpatch[_0x67e9('0x2d')](_0x316d06,_0x11a2bc,!![]);}catch(_0x152eff){return BPromise[_0x67e9('0x2e')](_0x152eff);}return _0x316d06[_0x67e9('0x2f')]();};}function saveUpdates(_0x15cfe0,_0x282fd1){return function(_0x93d29d){if(_0x93d29d){return _0x93d29d['update'](_0x15cfe0)[_0x67e9('0x1b')](function(_0x324db1){return _0x324db1;});}return null;};}function removeEntity(_0x3d1bbc,_0x2258d0){return function(_0x5bc1d7){if(_0x5bc1d7){return _0x5bc1d7[_0x67e9('0x30')]()['then'](function(){_0x3d1bbc[_0x67e9('0x26')](0xcc)[_0x67e9('0x27')]();});}};}function handleEntityNotFound(_0x4b6b00,_0x1c593f){return function(_0x5c36d6){if(!_0x5c36d6){_0x4b6b00['sendStatus'](0x194);}return _0x5c36d6;};}function handleError(_0x49f6a2,_0x1a92a2){_0x1a92a2=_0x1a92a2||0x1f4;return function(_0x101167){logger[_0x67e9('0x21')](_0x101167[_0x67e9('0x31')]);if(_0x101167[_0x67e9('0x32')]){delete _0x101167[_0x67e9('0x32')];}_0x49f6a2[_0x67e9('0x26')](_0x1a92a2)['send'](_0x101167);};}exports[_0x67e9('0x33')]=function(_0x1d4209,_0x539e72){var _0x19eef7={},_0xdd3887={},_0x4834bf={'count':0x0,'rows':[]};var _0x1d6ed4=db['SmsAccount'][_0x67e9('0x34')];_0xdd3887['model']=_['keys'](_0x1d6ed4);var _0x1b9694={'dateStart':_0x1d4209[_0x67e9('0x35')][_0x67e9('0x36')],'dateEnd':_0x1d4209[_0x67e9('0x35')][_0x67e9('0x37')]};delete _0x1d4209[_0x67e9('0x35')][_0x67e9('0x36')];delete _0x1d4209[_0x67e9('0x35')][_0x67e9('0x37')];_0xdd3887[_0x67e9('0x35')]=_[_0x67e9('0x38')](_0x1d4209[_0x67e9('0x35')]);_0xdd3887[_0x67e9('0x39')]=_['intersection'](_0xdd3887[_0x67e9('0x3a')],_0xdd3887[_0x67e9('0x35')]);_0x19eef7[_0x67e9('0x3b')]=_['intersection'](_0xdd3887[_0x67e9('0x3a')],qs[_0x67e9('0x3c')](_0x1d4209[_0x67e9('0x35')]['fields']));_0x19eef7['attributes']=_0x19eef7['attributes'][_0x67e9('0x3d')]?_0x19eef7[_0x67e9('0x3b')]:_0xdd3887[_0x67e9('0x3a')];if(!_0x1d4209[_0x67e9('0x35')][_0x67e9('0x3e')](_0x67e9('0x3f'))){_0x19eef7['limit']=qs[_0x67e9('0x2a')](_0x1d4209[_0x67e9('0x35')][_0x67e9('0x2a')]);_0x19eef7[_0x67e9('0x29')]=qs[_0x67e9('0x29')](_0x1d4209[_0x67e9('0x35')][_0x67e9('0x29')]);}_0x19eef7[_0x67e9('0x40')]=qs[_0x67e9('0x41')](_0x1d4209[_0x67e9('0x35')][_0x67e9('0x41')]);_0x19eef7[_0x67e9('0x42')]=qs[_0x67e9('0x39')](_[_0x67e9('0x43')](_0x1d4209[_0x67e9('0x35')],_0xdd3887['filters']));if(_0x1b9694[_0x67e9('0x36')]){if(_0x1b9694['dateEnd']){_0x1b9694['dateEnd']=moment(_0x1b9694['dateEnd'])['add'](0x1,_0x67e9('0x44'));}else{_0x1b9694['dateEnd']=moment(_0x1b9694['dateStart'])[_0x67e9('0x45')](0x1,_0x67e9('0x44'));}_[_0x67e9('0x46')](_0x19eef7[_0x67e9('0x42')],{'createdAt':{'$gte':_0x1b9694[_0x67e9('0x36')],'$lte':_0x1b9694[_0x67e9('0x37')]}});}if(_0x1d4209[_0x67e9('0x35')]['filter']){_0x19eef7['where']=_[_0x67e9('0x46')](_0x19eef7[_0x67e9('0x42')],{'$or':_[_0x67e9('0x47')](_0x19eef7[_0x67e9('0x3b')],function(_0x1f303f){var _0x17ab5c={};_0x17ab5c[_0x1f303f]={'$like':'%'+_0x1d4209[_0x67e9('0x35')][_0x67e9('0x48')]+'%'};return _0x17ab5c;})});}_0x19eef7=_['merge']({},_0x19eef7,_0x1d4209[_0x67e9('0x49')]);var _0x2831b9={'where':_0x19eef7['where']};return db[_0x67e9('0x4a')][_0x67e9('0x28')](_0x2831b9)['then'](function(_0x304582){_0x4834bf[_0x67e9('0x28')]=_0x304582;if(_0x1d4209[_0x67e9('0x35')][_0x67e9('0x4b')]){_0x19eef7[_0x67e9('0x4c')]=[{'all':!![]}];}return db[_0x67e9('0x4a')][_0x67e9('0x4d')](_0x19eef7);})[_0x67e9('0x1b')](function(_0x1b96ce){_0x4834bf['rows']=_0x1b96ce;return _0x4834bf;})['then'](respondWithFilteredResult(_0x539e72,_0x19eef7))[_0x67e9('0x4e')](handleError(_0x539e72,null));};exports[_0x67e9('0x4f')]=function(_0x42fba6,_0x37d08a){var _0x2db90e={'raw':![],'where':{'id':_0x42fba6[_0x67e9('0x50')]['id']}},_0x1a66f0={};_0x1a66f0[_0x67e9('0x3a')]=_[_0x67e9('0x38')](db[_0x67e9('0x4a')]['rawAttributes']);_0x1a66f0['query']=_[_0x67e9('0x38')](_0x42fba6[_0x67e9('0x35')]);_0x1a66f0[_0x67e9('0x39')]=_[_0x67e9('0x51')](_0x1a66f0[_0x67e9('0x3a')],_0x1a66f0['query']);_0x2db90e[_0x67e9('0x3b')]=_['intersection'](_0x1a66f0[_0x67e9('0x3a')],qs[_0x67e9('0x3c')](_0x42fba6[_0x67e9('0x35')][_0x67e9('0x3c')]));_0x2db90e['attributes']=_0x2db90e[_0x67e9('0x3b')][_0x67e9('0x3d')]?_0x2db90e[_0x67e9('0x3b')]:_0x1a66f0['model'];if(_0x42fba6[_0x67e9('0x35')]['includeAll']){_0x2db90e['include']=[{'all':!![]}];}_0x2db90e=_[_0x67e9('0x46')]({},_0x2db90e,_0x42fba6['options']);return db[_0x67e9('0x4a')][_0x67e9('0x52')](_0x2db90e)['then'](handleEntityNotFound(_0x37d08a,null))[_0x67e9('0x1b')](respondWithResult(_0x37d08a,null))[_0x67e9('0x4e')](handleError(_0x37d08a,null));};exports[_0x67e9('0x53')]=function(_0x337b99,_0x201c06){return db[_0x67e9('0x4a')][_0x67e9('0x53')](_0x337b99[_0x67e9('0x54')],{})[_0x67e9('0x1b')](respondWithResult(_0x201c06,0xc9))[_0x67e9('0x4e')](handleError(_0x201c06,null));};exports[_0x67e9('0x55')]=function(_0x5028ca,_0x5082be){if(_0x5028ca[_0x67e9('0x54')]['id']){delete _0x5028ca[_0x67e9('0x54')]['id'];}return db[_0x67e9('0x4a')][_0x67e9('0x52')]({'where':{'id':_0x5028ca[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x5082be,null))[_0x67e9('0x1b')](saveUpdates(_0x5028ca[_0x67e9('0x54')],null))[_0x67e9('0x1b')](respondWithResult(_0x5082be,null))[_0x67e9('0x4e')](handleError(_0x5082be,null));};exports['destroy']=function(_0xbee7d0,_0x4db094){return db['SmsAccount'][_0x67e9('0x52')]({'where':{'id':_0xbee7d0[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x4db094,null))[_0x67e9('0x1b')](removeEntity(_0x4db094,null))[_0x67e9('0x4e')](handleError(_0x4db094,null));};exports[_0x67e9('0x56')]=function(_0x2e7baa,_0x34486b){return db[_0x67e9('0x4a')][_0x67e9('0x56')]()['then'](respondWithResult(_0x34486b,null))[_0x67e9('0x4e')](handleError(_0x34486b,null));};exports[_0x67e9('0x57')]=function(_0x53fc90,_0x39efed,_0x3755d9){if(_0x53fc90[_0x67e9('0x54')]['id']){delete _0x53fc90[_0x67e9('0x54')]['id'];}return db['SmsAccount'][_0x67e9('0x52')]({'where':{'id':_0x53fc90[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x39efed,null))[_0x67e9('0x1b')](function(_0x230e1f){if(_0x230e1f){_0x53fc90[_0x67e9('0x54')][_0x67e9('0x58')]=_0x230e1f['id'];return db[_0x67e9('0x59')][_0x67e9('0x53')](_0x53fc90[_0x67e9('0x54')]);}})[_0x67e9('0x1b')](respondWithResult(_0x39efed,null))['catch'](handleError(_0x39efed,null));};exports[_0x67e9('0x5a')]=function(_0x474159,_0x1ccf36,_0x2d5005){var _0x1613d2={'raw':![],'where':{}};var _0x3cd2d7={};var _0x3ed44b={'count':0x0,'rows':[]};return db[_0x67e9('0x4a')][_0x67e9('0x5b')]({'where':{'id':_0x474159[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x1ccf36,null))[_0x67e9('0x1b')](function(_0x374322){if(_0x374322){_0x3cd2d7[_0x67e9('0x3a')]=_['keys'](db[_0x67e9('0x59')][_0x67e9('0x34')]);_0x3cd2d7['query']=_[_0x67e9('0x38')](_0x474159[_0x67e9('0x35')]);_0x3cd2d7['filters']=_[_0x67e9('0x51')](_0x3cd2d7['model'],_0x3cd2d7[_0x67e9('0x35')]);_0x1613d2[_0x67e9('0x3b')]=_[_0x67e9('0x51')](_0x3cd2d7['model'],qs[_0x67e9('0x3c')](_0x474159['query'][_0x67e9('0x3c')]));_0x1613d2[_0x67e9('0x3b')]=_0x1613d2[_0x67e9('0x3b')]['length']?_0x1613d2[_0x67e9('0x3b')]:_0x3cd2d7['model'];if(!_0x474159[_0x67e9('0x35')][_0x67e9('0x3e')](_0x67e9('0x3f'))){_0x1613d2[_0x67e9('0x2a')]=qs[_0x67e9('0x2a')](_0x474159[_0x67e9('0x35')][_0x67e9('0x2a')]);_0x1613d2[_0x67e9('0x29')]=qs[_0x67e9('0x29')](_0x474159[_0x67e9('0x35')][_0x67e9('0x29')]);}_0x1613d2[_0x67e9('0x40')]=qs['sort'](_0x474159[_0x67e9('0x35')][_0x67e9('0x41')]);_0x1613d2[_0x67e9('0x42')]=qs[_0x67e9('0x39')](_[_0x67e9('0x43')](_0x474159[_0x67e9('0x35')],_0x3cd2d7[_0x67e9('0x39')]));_0x1613d2[_0x67e9('0x42')]['SmsAccountId']=_0x374322['id'];if(_0x474159[_0x67e9('0x35')][_0x67e9('0x48')]){_0x1613d2[_0x67e9('0x42')]=_[_0x67e9('0x46')](_0x1613d2[_0x67e9('0x42')],{'$or':_['map'](_0x1613d2[_0x67e9('0x3b')],function(_0x231bb5){var _0x248248={};_0x248248[_0x231bb5]={'$like':'%'+_0x474159[_0x67e9('0x35')][_0x67e9('0x48')]+'%'};return _0x248248;})});}_0x1613d2=_['merge']({},_0x1613d2,_0x474159[_0x67e9('0x49')]);return db[_0x67e9('0x59')]['count']({'where':_0x1613d2[_0x67e9('0x42')]})['then'](function(_0x21f366){_0x3ed44b['count']=_0x21f366;if(_0x474159[_0x67e9('0x35')][_0x67e9('0x4b')]){_0x1613d2['include']=[{'all':!![]}];}return db[_0x67e9('0x59')][_0x67e9('0x4d')](_0x1613d2);})[_0x67e9('0x1b')](function(_0x31f4b3){_0x3ed44b[_0x67e9('0x5c')]=_0x31f4b3;return _0x3ed44b;});}})[_0x67e9('0x1b')](respondWithFilteredResult(_0x1ccf36,_0x1613d2))['catch'](handleError(_0x1ccf36,null));};exports[_0x67e9('0x5d')]=function(_0x4b4017,_0x41d25a,_0x2ca34c){var _0x33a76f;return db['SmsAccount']['find']({'where':{'id':_0x4b4017[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x41d25a,null))['then'](function(_0x297644){if(_0x297644){return _0x297644[_0x67e9('0x5d')](_0x4b4017[_0x67e9('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x41d25a,null))['catch'](handleError(_0x41d25a,null));};exports[_0x67e9('0x5e')]=function(_0x9e1bf0,_0x5f31de,_0xcc38f1){if(_0x9e1bf0[_0x67e9('0x54')]['id']){delete _0x9e1bf0[_0x67e9('0x54')]['id'];}return db[_0x67e9('0x4a')][_0x67e9('0x52')]({'where':{'id':_0x9e1bf0[_0x67e9('0x50')]['id']}})['then'](handleEntityNotFound(_0x5f31de,null))[_0x67e9('0x1b')](function(_0x188378){if(_0x188378){_0x9e1bf0[_0x67e9('0x54')][_0x67e9('0x58')]=_0x188378['id'];return db[_0x67e9('0x5f')][_0x67e9('0x53')](_0x9e1bf0[_0x67e9('0x54')]);}})[_0x67e9('0x1b')](respondWithResult(_0x5f31de,null))[_0x67e9('0x4e')](handleError(_0x5f31de,null));};exports[_0x67e9('0x60')]=function(_0x71b6ec,_0x6a652,_0x29aa69){var _0x5c7b5f={'raw':![],'where':{}};var _0x364bc2={};var _0x827056={'count':0x0,'rows':[]};return db[_0x67e9('0x4a')][_0x67e9('0x5b')]({'where':{'id':_0x71b6ec[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x6a652,null))[_0x67e9('0x1b')](function(_0x368dec){if(_0x368dec){_0x364bc2[_0x67e9('0x3a')]=_[_0x67e9('0x38')](db[_0x67e9('0x5f')][_0x67e9('0x34')]);_0x364bc2[_0x67e9('0x35')]=_['keys'](_0x71b6ec[_0x67e9('0x35')]);_0x364bc2[_0x67e9('0x39')]=_[_0x67e9('0x51')](_0x364bc2[_0x67e9('0x3a')],_0x364bc2[_0x67e9('0x35')]);_0x5c7b5f[_0x67e9('0x3b')]=_[_0x67e9('0x51')](_0x364bc2[_0x67e9('0x3a')],qs[_0x67e9('0x3c')](_0x71b6ec['query'][_0x67e9('0x3c')]));_0x5c7b5f[_0x67e9('0x3b')]=_0x5c7b5f['attributes'][_0x67e9('0x3d')]?_0x5c7b5f['attributes']:_0x364bc2['model'];if(!_0x71b6ec['query'][_0x67e9('0x3e')](_0x67e9('0x3f'))){_0x5c7b5f['limit']=qs[_0x67e9('0x2a')](_0x71b6ec[_0x67e9('0x35')][_0x67e9('0x2a')]);_0x5c7b5f['offset']=qs[_0x67e9('0x29')](_0x71b6ec[_0x67e9('0x35')][_0x67e9('0x29')]);}_0x5c7b5f['order']=qs['sort'](_0x71b6ec[_0x67e9('0x35')][_0x67e9('0x41')]);_0x5c7b5f[_0x67e9('0x42')]=qs['filters'](_['pick'](_0x71b6ec['query'],_0x364bc2[_0x67e9('0x39')]));_0x5c7b5f[_0x67e9('0x42')]['SmsAccountId']=_0x368dec['id'];if(_0x71b6ec[_0x67e9('0x35')][_0x67e9('0x48')]){_0x5c7b5f[_0x67e9('0x42')]=_[_0x67e9('0x46')](_0x5c7b5f[_0x67e9('0x42')],{'$or':_[_0x67e9('0x47')](_0x5c7b5f[_0x67e9('0x3b')],function(_0x50d7e4){var _0x5571b0={};_0x5571b0[_0x50d7e4]={'$like':'%'+_0x71b6ec[_0x67e9('0x35')][_0x67e9('0x48')]+'%'};return _0x5571b0;})});}_0x5c7b5f=_[_0x67e9('0x46')]({},_0x5c7b5f,_0x71b6ec[_0x67e9('0x49')]);return db[_0x67e9('0x5f')]['count']({'where':_0x5c7b5f[_0x67e9('0x42')]})[_0x67e9('0x1b')](function(_0x3c2118){_0x827056[_0x67e9('0x28')]=_0x3c2118;if(_0x71b6ec[_0x67e9('0x35')][_0x67e9('0x4b')]){_0x5c7b5f[_0x67e9('0x4c')]=[{'all':!![]}];}return db[_0x67e9('0x5f')][_0x67e9('0x4d')](_0x5c7b5f);})[_0x67e9('0x1b')](function(_0x4f86c5){_0x827056[_0x67e9('0x5c')]=_0x4f86c5;return _0x827056;});}})['then'](respondWithFilteredResult(_0x6a652,_0x5c7b5f))['catch'](handleError(_0x6a652,null));};exports['removeAnswers']=function(_0x38a7bb,_0x46282a,_0xb6ea01){var _0x3868bb;return db[_0x67e9('0x4a')][_0x67e9('0x52')]({'where':{'id':_0x38a7bb[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x46282a,null))[_0x67e9('0x1b')](function(_0x41b7a8){if(_0x41b7a8){return _0x41b7a8[_0x67e9('0x61')](_0x38a7bb[_0x67e9('0x35')][_0x67e9('0x62')]);}})[_0x67e9('0x1b')](respondWithStatusCode(_0x46282a,null))[_0x67e9('0x4e')](handleError(_0x46282a,null));};exports['notify']=function(_0x230ff9,_0x58f25f,_0x9aa501){var _0xb990b6={'channel':_0x67e9('0x63')};var _0x4c46f4=[];var _0x2cb284=[];var _0x5b74bb={};return db['SmsAccount'][_0x67e9('0x52')]({'where':{'id':_0x230ff9[_0x67e9('0x50')]['id']},'include':[{'model':db[_0x67e9('0x64')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x58f25f,null))[_0x67e9('0x1b')](function(_0x59ec55){_0xb990b6[_0x67e9('0x65')]=_0x59ec55;_0xb990b6[_0x67e9('0x66')]=_[_0x67e9('0x67')](_0x59ec55[_0x67e9('0x68')],[_0x67e9('0x69')],['asc']);if(_0xb990b6['account'][_0x67e9('0x68')]){delete _0xb990b6[_0x67e9('0x65')]['Applications'];}return db[_0x67e9('0x6a')][_0x67e9('0x56')]();})[_0x67e9('0x1b')](function(_0x4d80e8){if(!_0x4d80e8){throw new db['Sequelize'][(_0x67e9('0x6b'))](_0x67e9('0x6c'));}_0x4c46f4=_[_0x67e9('0x6d')](_[_0x67e9('0x38')](_0x4d80e8),[_0x67e9('0x6e'),_0x67e9('0x6f')]);_0x2cb284=_[_0x67e9('0x6d')](_[_0x67e9('0x38')](_0x4d80e8),[_0x67e9('0x6e'),_0x67e9('0x6f'),_0x67e9('0x70'),_0x67e9('0x71')]);_0xb990b6['body']={'mapKey':_0x67e9('0x72')};if(_0xb990b6[_0x67e9('0x65')][_0x67e9('0x73')]){switch(_0xb990b6['account'][_0x67e9('0x73')]){case _0x67e9('0x74'):_0xb990b6[_0x67e9('0x54')]['from']=_0x230ff9['body']['From'];_0xb990b6[_0x67e9('0x54')]['body']=_0x230ff9['body'][_0x67e9('0x75')];_0xb990b6[_0x67e9('0x54')][_0x67e9('0x76')]=_0x230ff9[_0x67e9('0x54')][_0x67e9('0x77')];break;case _0x67e9('0x78'):_0xb990b6['body'][_0x67e9('0x79')]=_0x230ff9[_0x67e9('0x54')][_0x67e9('0x7a')];_0xb990b6['body'][_0x67e9('0x54')]=_0x230ff9[_0x67e9('0x54')][_0x67e9('0x7b')];break;case _0x67e9('0x7c'):_0xb990b6[_0x67e9('0x54')][_0x67e9('0x79')]=_0x230ff9[_0x67e9('0x54')][_0x67e9('0x79')];_0xb990b6['body'][_0x67e9('0x54')]=_0x230ff9['body'][_0x67e9('0x23')];break;case'clicksend':_0xb990b6['body'][_0x67e9('0x79')]=_0x230ff9['body']['from'];_0xb990b6[_0x67e9('0x54')][_0x67e9('0x54')]=_0x230ff9[_0x67e9('0x54')][_0x67e9('0x54')];_0xb990b6[_0x67e9('0x54')][_0x67e9('0x76')]=_0x230ff9[_0x67e9('0x54')][_0x67e9('0x7d')];break;case _0x67e9('0x7e'):_0xb990b6[_0x67e9('0x54')][_0x67e9('0x79')]=_0x230ff9['body']['From'];_0xb990b6['body']['body']=_0x230ff9[_0x67e9('0x54')][_0x67e9('0x7f')];_0xb990b6[_0x67e9('0x54')]['messageId']=_0x230ff9[_0x67e9('0x54')]['MessageUUID'];break;}}if(_0xb990b6[_0x67e9('0x54')]['id']){delete _0xb990b6[_0x67e9('0x54')]['id'];}if(_[_0x67e9('0x80')](_0xb990b6[_0x67e9('0x54')]['from'])){throw new db['Sequelize'][(_0x67e9('0x6b'))]('from\x20is\x20mandatory');}if(_['isNil'](_0xb990b6[_0x67e9('0x54')][_0x67e9('0x54')])||_0xb990b6[_0x67e9('0x54')][_0x67e9('0x54')]===''){throw new db[(_0x67e9('0x81'))][(_0x67e9('0x6b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x67e9('0x80')](_0xb990b6['body']['mapKey'])){throw new db[(_0x67e9('0x81'))][(_0x67e9('0x6b'))](_0x67e9('0x82')+_0x2cb284);}if(!_['includes'](_0x2cb284,_0xb990b6[_0x67e9('0x54')][_0x67e9('0x83')])){throw new db[(_0x67e9('0x81'))][(_0x67e9('0x6b'))](_0x67e9('0x84')+_0x2cb284);}_0x5b74bb[_0xb990b6[_0x67e9('0x54')][_0x67e9('0x83')]]=_0xb990b6['body'][_0x67e9('0x79')];return db['CmList'][_0x67e9('0x52')]({'where':{'id':_0xb990b6[_0x67e9('0x65')][_0x67e9('0x71')]},'include':[{'model':db[_0x67e9('0x6a')],'as':_0x67e9('0x85'),'where':_0x5b74bb,'limit':0x1,'order':[[_0x67e9('0x6f'),_0x67e9('0x86')]]}]});})['then'](handleEntityNotFound(_0x58f25f,null))[_0x67e9('0x1b')](function(_0x1fcfef){if(_0x1fcfef){_0xb990b6[_0x67e9('0x87')]=_[_0x67e9('0x88')](_0x1fcfef,[_0x67e9('0x85')]);if(_0x1fcfef[_0x67e9('0x85')][_0x67e9('0x3d')]){return _0x1fcfef[_0x67e9('0x85')][0x0];}var _0x437da5=_[_0x67e9('0x89')](_0xb990b6['body'],{'firstName':_0xb990b6['body'][_0x67e9('0x79')],'ListId':_0x1fcfef['id']});_0x437da5[_0xb990b6[_0x67e9('0x54')][_0x67e9('0x83')]]=_0xb990b6[_0x67e9('0x54')][_0x67e9('0x79')];return db[_0x67e9('0x6a')][_0x67e9('0x53')](_0x437da5,{'fields':_0x4c46f4,'raw':!![]});}})[_0x67e9('0x1b')](handleEntityNotFound(_0x58f25f,null))[_0x67e9('0x1b')](function(_0x4d1a60){if(_0x4d1a60){_0xb990b6[_0x67e9('0x8a')]=_0x4d1a60;var _0x3a4ecf={'ContactId':_0x4d1a60['id'],'phone':_0xb990b6['body'][_0x67e9('0x79')],'SmsAccountId':_0x230ff9[_0x67e9('0x50')]['id']};var _0x34dbee={'ContactId':_0x4d1a60['id'],'SmsAccountId':_0x230ff9[_0x67e9('0x50')]['id'],'closed':![]};return db[_0x67e9('0x8b')][_0x67e9('0x52')]({'where':_0x34dbee})['then'](function(_0xdf9b7f){if(_0xdf9b7f){return[_0xdf9b7f,![]];}return db['SmsInteraction'][_0x67e9('0x53')](_0x3a4ecf)[_0x67e9('0x1b')](function(_0x1417f3){return[_0x1417f3,!![]];});});}})[_0x67e9('0x8c')](function(_0x4e95ad,_0x4160fc){_0xb990b6[_0x67e9('0x8d')]=_0x4e95ad[_0x67e9('0x8e')]({'plain':!![]});_0xb990b6['interaction'][_0x67e9('0x8f')]=![];if(_0x4160fc){if(_0xb990b6[_0x67e9('0x65')]['autoclose']){_0xb990b6[_0x67e9('0x66')][_0x67e9('0x90')]({'id':0x0,'priority':_0xb990b6[_0x67e9('0x66')][_0x67e9('0x3d')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x67e9('0x91')});}_0xb990b6[_0x67e9('0x8d')][_0x67e9('0x8f')]=!![];}return db['SmsMessage'][_0x67e9('0x53')]({'phone':_0xb990b6[_0x67e9('0x54')][_0x67e9('0x79')],'messageId':_0xb990b6[_0x67e9('0x54')][_0x67e9('0x76')],'body':_0xb990b6[_0x67e9('0x54')]['body'],'SmsAccountId':_0x230ff9[_0x67e9('0x50')]['id'],'SmsInteractionId':_0x4e95ad['id'],'direction':'in','ContactId':_0x4e95ad[_0x67e9('0x92')],'AttachmentId':_0xb990b6[_0x67e9('0x54')][_0x67e9('0x93')]});})['then'](function(_0x716f32){_0xb990b6[_0x67e9('0x23')]=_0x716f32;if(_0xb990b6[_0x67e9('0x8d')][_0x67e9('0x94')]){return db['User'][_0x67e9('0x52')]({'attributes':['id',_0x67e9('0x32')],'where':{'id':_0xb990b6[_0x67e9('0x8d')][_0x67e9('0x94')]}})[_0x67e9('0x1b')](function(_0x1af283){if(_0x1af283){_0xb990b6[_0x67e9('0x66')][_0x67e9('0x95')]({'id':0x0,'priority':0x0,'app':_0x67e9('0x96'),'appdata':_0x1af283[_0x67e9('0x32')]+','+(_0xb990b6['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x67e9('0x97'),_0xb990b6);});}return respondWithRpcPromise(_0x67e9('0x98'),_0x67e9('0x97'),_0xb990b6);})[_0x67e9('0x1b')](function(_0x25f48e){if(_0x25f48e){var _0x46cd6a=0xc8;var _0xbf8108=_0x67e9('0x99');logger[_0x67e9('0x24')](_0x67e9('0x1f'),_0xbf8108,_0x46cd6a,_0x67e9('0x9a'));logger[_0x67e9('0x1e')](_0x67e9('0x9b'),_0xbf8108,_0x46cd6a,_0x67e9('0x9a'),JSON[_0x67e9('0x20')](_0x25f48e));if(_0xb990b6[_0x67e9('0x65')][_0x67e9('0x73')]===_0x67e9('0x74')){return _0x58f25f['status'](_0x46cd6a)[_0x67e9('0x9c')](_0x67e9('0x9d'),_0x67e9('0x9e'))[_0x67e9('0x9f')]('\x0a');}else{return _0x58f25f[_0x67e9('0x26')](_0x46cd6a)[_0x67e9('0x2c')](_0x25f48e);}}})[_0x67e9('0x4e')](handleError(_0x58f25f,null));};exports['addApplications']=function(_0x370548,_0x18f903,_0x4cda58){return db['SmsAccount'][_0x67e9('0x5b')]({'where':{'id':_0x370548['params']['id']}})['then'](handleEntityNotFound(_0x18f903,null))[_0x67e9('0x1b')](function(_0xecae8e){if(_0xecae8e){return db['sequelize']['transaction'](function(_0xf1b5df){return db['SmsApplication'][_0x67e9('0x30')]({'where':{'SmsAccountId':_0x370548[_0x67e9('0x50')]['id']},'transaction':_0xf1b5df})[_0x67e9('0x1b')](function(_0x2d16aa){var _0x3a4f92=_['map'](_0x370548[_0x67e9('0x54')],function(_0x953ed9){_0x953ed9[_0x67e9('0x58')]=_0x370548[_0x67e9('0x50')]['id'];return _0x953ed9;});return db['SmsApplication'][_0x67e9('0xa0')](_0x3a4f92,{'transaction':_0xf1b5df});});})[_0x67e9('0x1b')](function(){return db[_0x67e9('0x64')][_0x67e9('0xa1')]({'where':{'SmsAccountId':_0x370548[_0x67e9('0x50')]['id']},'order':_0x67e9('0x69')});});}})[_0x67e9('0x1b')](respondWithResult(_0x18f903,null))['catch'](handleError(_0x18f903,null));};exports['getApplications']=function(_0xc96b08,_0x5b6cb2,_0x20124c){var _0x2c6589={};var _0x402cdf={};var _0x5cba7c;var _0x1bae22;return db['SmsAccount'][_0x67e9('0x5b')]({'where':{'id':_0xc96b08[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x5b6cb2,null))[_0x67e9('0x1b')](function(_0x5a623f){if(_0x5a623f){_0x5cba7c=_0x5a623f;_0x402cdf[_0x67e9('0x3a')]=_[_0x67e9('0x38')](db[_0x67e9('0x64')][_0x67e9('0x34')]);_0x402cdf[_0x67e9('0x35')]=_[_0x67e9('0x38')](_0xc96b08[_0x67e9('0x35')]);_0x402cdf['filters']=_[_0x67e9('0x51')](_0x402cdf[_0x67e9('0x3a')],_0x402cdf[_0x67e9('0x35')]);_0x2c6589['attributes']=_[_0x67e9('0x51')](_0x402cdf[_0x67e9('0x3a')],qs['fields'](_0xc96b08[_0x67e9('0x35')][_0x67e9('0x3c')]));_0x2c6589[_0x67e9('0x3b')]=_0x2c6589['attributes'][_0x67e9('0x3d')]?_0x2c6589[_0x67e9('0x3b')]:_0x402cdf[_0x67e9('0x3a')];_0x2c6589['order']=qs[_0x67e9('0x41')](_0xc96b08[_0x67e9('0x35')][_0x67e9('0x41')]);_0x2c6589[_0x67e9('0x42')]=qs[_0x67e9('0x39')](_[_0x67e9('0x43')](_0xc96b08[_0x67e9('0x35')],_0x402cdf['filters']));if(_0xc96b08[_0x67e9('0x35')]['filter']){_0x2c6589[_0x67e9('0x42')]=_[_0x67e9('0x46')](_0x2c6589['where'],{'$or':_[_0x67e9('0x47')](_0x2c6589[_0x67e9('0x3b')],function(_0x2f069b){var _0x24f366={};_0x24f366[_0x2f069b]={'$like':'%'+_0xc96b08['query'][_0x67e9('0x48')]+'%'};return _0x24f366;})});}_0x2c6589=_[_0x67e9('0x46')]({},_0x2c6589,_0xc96b08[_0x67e9('0x49')]);return _0x5cba7c[_0x67e9('0xa2')](_0x2c6589);}})['then'](function(_0x528204){if(_0x528204){_0x1bae22=_0x528204['length'];if(!_0xc96b08[_0x67e9('0x35')][_0x67e9('0x3e')](_0x67e9('0x3f'))){_0x2c6589[_0x67e9('0x2a')]=qs[_0x67e9('0x2a')](_0xc96b08[_0x67e9('0x35')][_0x67e9('0x2a')]);_0x2c6589[_0x67e9('0x29')]=qs[_0x67e9('0x29')](_0xc96b08[_0x67e9('0x35')][_0x67e9('0x29')]);}return _0x5cba7c[_0x67e9('0xa2')](_0x2c6589);}})[_0x67e9('0x1b')](function(_0x2ad3e6){if(_0x2ad3e6){return _0x2ad3e6?{'count':_0x1bae22,'rows':_0x2ad3e6}:null;}})[_0x67e9('0x1b')](respondWithResult(_0x5b6cb2,null))[_0x67e9('0x4e')](handleError(_0x5b6cb2,null));};exports[_0x67e9('0xa3')]=function(_0x16c7d9,_0x23a147,_0x341751){var _0x43c55b={'raw':![],'where':{}};var _0x245060={};var _0x55befd={'count':0x0,'rows':[]};return db[_0x67e9('0x4a')]['findOne']({'where':{'id':_0x16c7d9[_0x67e9('0x50')]['id']}})['then'](handleEntityNotFound(_0x23a147,null))[_0x67e9('0x1b')](function(_0x565e78){if(_0x565e78){_0x245060[_0x67e9('0x3a')]=_[_0x67e9('0x38')](db[_0x67e9('0x8b')][_0x67e9('0x34')]);_0x245060[_0x67e9('0x35')]=_[_0x67e9('0x38')](_0x16c7d9[_0x67e9('0x35')]);_0x245060[_0x67e9('0x39')]=_[_0x67e9('0x51')](_0x245060[_0x67e9('0x3a')],_0x245060[_0x67e9('0x35')]);_0x43c55b[_0x67e9('0x3b')]=_['intersection'](_0x245060[_0x67e9('0x3a')],qs[_0x67e9('0x3c')](_0x16c7d9['query'][_0x67e9('0x3c')]));_0x43c55b[_0x67e9('0x3b')]=_0x43c55b[_0x67e9('0x3b')][_0x67e9('0x3d')]?_0x43c55b[_0x67e9('0x3b')]:_0x245060[_0x67e9('0x3a')];if(!_0x16c7d9[_0x67e9('0x35')]['hasOwnProperty'](_0x67e9('0x3f'))){_0x43c55b[_0x67e9('0x2a')]=qs['limit'](_0x16c7d9[_0x67e9('0x35')][_0x67e9('0x2a')]);_0x43c55b[_0x67e9('0x29')]=qs[_0x67e9('0x29')](_0x16c7d9[_0x67e9('0x35')][_0x67e9('0x29')]);}_0x43c55b['order']=qs['sort'](_0x16c7d9[_0x67e9('0x35')][_0x67e9('0x41')]);_0x43c55b[_0x67e9('0x42')]=qs[_0x67e9('0x39')](_['pick'](_0x16c7d9[_0x67e9('0x35')],_0x245060['filters']));_0x43c55b[_0x67e9('0x42')][_0x67e9('0x58')]=_0x565e78['id'];if(_0x16c7d9[_0x67e9('0x35')][_0x67e9('0x48')]){_0x43c55b[_0x67e9('0x42')]=_[_0x67e9('0x46')](_0x43c55b[_0x67e9('0x42')],{'$or':_[_0x67e9('0x47')](_0x43c55b['attributes'],function(_0x36fe8e){var _0x32fe10={};_0x32fe10[_0x36fe8e]={'$like':'%'+_0x16c7d9[_0x67e9('0x35')][_0x67e9('0x48')]+'%'};return _0x32fe10;})});}_0x43c55b=_[_0x67e9('0x46')]({},_0x43c55b,_0x16c7d9[_0x67e9('0x49')]);return db[_0x67e9('0x8b')][_0x67e9('0x28')]({'where':_0x43c55b[_0x67e9('0x42')]})[_0x67e9('0x1b')](function(_0x4cea21){_0x55befd[_0x67e9('0x28')]=_0x4cea21;if(_0x16c7d9[_0x67e9('0x35')][_0x67e9('0x4b')]){_0x43c55b[_0x67e9('0x4c')]=[{'model':db['CmContact'],'as':_0x67e9('0xa4'),'required':![]},{'model':db[_0x67e9('0xa5')],'as':_0x67e9('0xa6'),'attributes':[_0x67e9('0x32'),'fullname',_0x67e9('0xa7')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x67e9('0xa8')],'where':_0x16c7d9[_0x67e9('0x35')][_0x67e9('0xa9')]?{'id':_0x16c7d9['query'][_0x67e9('0xa9')]}:undefined,'required':_0x16c7d9[_0x67e9('0x35')]['tag']?!![]:![]}];}return db[_0x67e9('0x8b')]['findAll'](_0x43c55b);})['then'](function(_0x21aeb9){_0x55befd[_0x67e9('0x5c')]=_0x21aeb9;return _0x55befd;});}})[_0x67e9('0x1b')](respondWithFilteredResult(_0x23a147,_0x43c55b))['catch'](handleError(_0x23a147,null));};exports[_0x67e9('0x9f')]=function(_0x5b7f52,_0x576d63,_0x479464){var _0x9293dd,_0x541c57,_0x5785bf;if(_[_0x67e9('0x80')](_0x5b7f52['body'][_0x67e9('0x54')])||_0x5b7f52['body'][_0x67e9('0x54')]===''){throw new db[(_0x67e9('0x81'))][(_0x67e9('0x6b'))](_0x67e9('0xaa'));}if(_['isNil'](_0x5b7f52[_0x67e9('0x54')]['to'])){throw new db[(_0x67e9('0x81'))][(_0x67e9('0x6b'))](_0x67e9('0xab'));}_0x9293dd=_0x5b7f52[_0x67e9('0x54')]['to'];return db['SmsAccount'][_0x67e9('0x52')]({'where':{'id':_0x5b7f52['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x67e9('0x85'),'where':{'mobile':_0x9293dd},'limit':0x1,'order':[[_0x67e9('0x6f'),_0x67e9('0x86')]]}]}]})[_0x67e9('0x1b')](handleEntityNotFound(_0x576d63,null))[_0x67e9('0x1b')](function(_0x30219c){if(_0x30219c&&_0x30219c[_0x67e9('0xac')]){_0x541c57=_0x30219c[_0x67e9('0x8e')]({'plain':!![]});if(_0x541c57[_0x67e9('0xac')]&&_0x541c57[_0x67e9('0xac')][_0x67e9('0x85')][_0x67e9('0x3d')]){return _0x541c57[_0x67e9('0xac')][_0x67e9('0x85')][0x0];}return db[_0x67e9('0x6a')][_0x67e9('0x53')](_[_0x67e9('0x89')](_0x5b7f52[_0x67e9('0x54')],{'firstName':_0x9293dd,'mobile':_0x9293dd,'phone':_0x9293dd,'ListId':_0x541c57[_0x67e9('0x71')]}));}})[_0x67e9('0x1b')](handleEntityNotFound(_0x576d63,null))[_0x67e9('0x1b')](function(_0x76914){if(_0x76914){_0x5785bf=_0x76914;return db[_0x67e9('0x8b')][_0x67e9('0x52')]({'where':{'ContactId':_0x5785bf['id'],'closed':![],'SmsAccountId':_0x541c57['id']}})[_0x67e9('0x1b')](function(_0x542862){if(_0x542862){return[_0x542862,![]];}return db['SmsInteraction']['create']({'UserId':_0x5b7f52['user']['id'],'ContactId':_0x5785bf['id'],'SmsAccountId':_0x541c57['id'],'phone':_0x9293dd,'firstMsgDirection':_0x67e9('0xad'),'Messages':[_[_0x67e9('0x46')](_0x5b7f52[_0x67e9('0x54')],{'read':![],'body':_0x5b7f52[_0x67e9('0x54')]['body'],'phone':_0x9293dd,'SmsAccountId':_0x541c57['id'],'UserId':_0x5b7f52['user']['id'],'ContactId':_0x5785bf['id']})]},{'include':[{'model':db[_0x67e9('0xae')],'as':'Messages'}]})[_0x67e9('0x1b')](function(_0x3b6495){return[_0x3b6495,!![]];});});}})[_0x67e9('0x8c')](function(_0x488f47,_0x4ab506){if(_0x4ab506){return _0x488f47;}return db[_0x67e9('0xae')][_0x67e9('0x53')](_[_0x67e9('0x46')](_0x5b7f52[_0x67e9('0x54')],{'read':![],'body':_0x5b7f52[_0x67e9('0x54')]['body'],'phone':_0x9293dd,'SmsAccountId':_0x541c57['id'],'SmsInteractionId':_0x488f47['id'],'UserId':_0x5b7f52[_0x67e9('0xaf')]['id'],'ContactId':_0x5785bf['id']}))[_0x67e9('0x1b')](function(_0x4e56ad){_0x488f47[_0x67e9('0xb0')][_0x67e9('0xb1')]=[];_0x488f47[_0x67e9('0xb0')][_0x67e9('0xb1')]['push'](_0x4e56ad['dataValues']);return _0x488f47;});})[_0x67e9('0x1b')](respondWithResult(_0x576d63,null))[_0x67e9('0x4e')](handleError(_0x576d63,null));};exports[_0x67e9('0x26')]=function(_0x2972da,_0x2d2ea8,_0x4322a9){if(_0x2972da[_0x67e9('0x54')]['id']){delete _0x2972da[_0x67e9('0x54')]['id'];}var _0x1ebe79,_0x1fce40,_0x1cc736;return db[_0x67e9('0x4a')]['find']({'where':{'id':_0x2972da[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x2d2ea8,null))['then'](function(_0x51c732){if(_0x51c732){_0x1cc736=_0x51c732;logger[_0x67e9('0x1e')](_0x67e9('0x1f'),_0x67e9('0x26'),_0x67e9('0xb2'),_0x51c732[_0x67e9('0x73')],util[_0x67e9('0xb3')](_0x2972da[_0x67e9('0x54')],{'showHidden':![],'depth':null}));switch(_0x51c732[_0x67e9('0x73')]){case _0x67e9('0x78'):if(_0x2972da[_0x67e9('0x54')][_0x67e9('0xb4')]&&_0x2972da[_0x67e9('0x54')][_0x67e9('0x26')]){_0x1fce40=_0x2972da[_0x67e9('0x54')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x2972da[_0x67e9('0x54')]['skebby_dispatch_id']}});}break;case _0x67e9('0x7c'):if(_0x2972da['body']['requestid']&&_0x2972da[_0x67e9('0x54')]['statusInt']){_0x1fce40=_0x2972da['body'][_0x67e9('0xb5')];return db[_0x67e9('0xae')][_0x67e9('0x52')]({'where':{'messageId':_0x2972da[_0x67e9('0x54')][_0x67e9('0xb6')]}});}break;case _0x67e9('0xb7'):if(_0x2972da[_0x67e9('0x54')][_0x67e9('0x7d')]&&_0x2972da[_0x67e9('0x54')]['status_code']){_0x1fce40=_0x2972da[_0x67e9('0x54')]['status_code'];return db[_0x67e9('0xae')]['find']({'where':{'messageId':_0x2972da['body'][_0x67e9('0x7d')]}});}break;}}})[_0x67e9('0x1b')](handleEntityNotFound(_0x2d2ea8,null))[_0x67e9('0x1b')](function(_0x1e6520){if(_0x1e6520){_0x1ebe79=_0x1e6520;switch(_0x1cc736[_0x67e9('0x73')]){case _0x67e9('0x78'):if(_0x1fce40===_0x67e9('0xb8')){return _0x1ebe79[_0x67e9('0x55')]({'read':!![]});}else{logger[_0x67e9('0x21')](_0x67e9('0x1f'),_0x67e9('0x26'),_0x67e9('0x78'),util[_0x67e9('0xb3')](_0x2972da['body'],{'showHidden':![],'depth':null}));}break;case _0x67e9('0x7c'):if(_0x1fce40==='1'){return _0x1ebe79[_0x67e9('0x55')]({'read':!![]});}else{logger[_0x67e9('0x21')](_0x67e9('0x1f'),_0x67e9('0x26'),'skebby',util['inspect'](_0x2972da[_0x67e9('0x54')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2972da['body']['error_code']&&_0x1fce40>=0xc8&&_0x1fce40<=0xce){return _0x1ebe79[_0x67e9('0x55')]({'read':!![]});}else{logger[_0x67e9('0x21')](_0x67e9('0x1f'),_0x67e9('0x26'),_0x67e9('0xb7'),util[_0x67e9('0xb3')](_0x2972da[_0x67e9('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1ebe79;}})[_0x67e9('0x1b')](respondWithResult(_0x2d2ea8,null))[_0x67e9('0x4e')](handleError(_0x2d2ea8,null));};exports[_0x67e9('0xb9')]=function(_0x20c3c1,_0x16f681,_0x370289){return db[_0x67e9('0x4a')][_0x67e9('0x52')]({'where':{'id':_0x20c3c1[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x16f681,null))['then'](function(_0x272f39){if(_0x272f39){return _0x272f39['addAgents'](_0x20c3c1['body'][_0x67e9('0x62')],_[_0x67e9('0x88')](_0x20c3c1[_0x67e9('0x54')],[_0x67e9('0x62'),'id'])||{})['spread'](function(_0x2764d5){for(var _0xacb364=0x0;_0xacb364<_0x20c3c1[_0x67e9('0x54')][_0x67e9('0x62')][_0x67e9('0x3d')];_0xacb364+=0x1){socket[_0x67e9('0xba')](_0x67e9('0xbb'),{'UserId':_0x20c3c1['body'][_0x67e9('0x62')][_0xacb364],'SmsAccountId':_0x20c3c1[_0x67e9('0x50')]['id']});}return _0x2764d5;});}})['then'](respondWithResult(_0x16f681,null))[_0x67e9('0x4e')](handleError(_0x16f681,null));};exports[_0x67e9('0xbc')]=function(_0x486405,_0x42d6a6,_0xf7ed60){var _0x529d26;return db['SmsAccount'][_0x67e9('0x52')]({'where':{'id':_0x486405['params']['id']}})['then'](handleEntityNotFound(_0x42d6a6,null))[_0x67e9('0x1b')](function(_0x1a7139){if(_0x1a7139){return _0x1a7139[_0x67e9('0xbc')](_0x486405[_0x67e9('0x35')]['ids'])[_0x67e9('0x1b')](function(_0x5c3e1c){if(_['isArray'](_0x486405[_0x67e9('0x35')][_0x67e9('0x62')])){for(var _0x54fe0f=0x0;_0x54fe0f<_0x486405[_0x67e9('0x35')][_0x67e9('0x62')][_0x67e9('0x3d')];_0x54fe0f+=0x1){socket[_0x67e9('0xba')](_0x67e9('0xbd'),{'UserId':_0x486405['query'][_0x67e9('0x62')][_0x54fe0f],'SmsAccountId':_0x486405[_0x67e9('0x50')]['id']});}}else{socket['emit'](_0x67e9('0xbd'),{'UserId':_0x486405[_0x67e9('0x35')][_0x67e9('0x62')],'SmsAccountId':_0x486405[_0x67e9('0x50')]['id']});}});}})['then'](respondWithStatusCode(_0x42d6a6,null))['catch'](handleError(_0x42d6a6,null));};exports[_0x67e9('0xbe')]=function(_0x2a81f3,_0x4323d3,_0x46ee05){var _0x2b3a1d={};var _0x7092f2={};var _0x54b106;var _0x1ef82e;return db[_0x67e9('0x4a')][_0x67e9('0x5b')]({'where':{'id':_0x2a81f3[_0x67e9('0x50')]['id']}})[_0x67e9('0x1b')](handleEntityNotFound(_0x4323d3,null))[_0x67e9('0x1b')](function(_0xbea0e8){if(_0xbea0e8){_0x54b106=_0xbea0e8;_0x7092f2[_0x67e9('0x3a')]=_[_0x67e9('0x38')](db[_0x67e9('0xa5')][_0x67e9('0x34')]);_0x7092f2[_0x67e9('0x35')]=_[_0x67e9('0x38')](_0x2a81f3[_0x67e9('0x35')]);_0x7092f2[_0x67e9('0x39')]=_[_0x67e9('0x51')](_0x7092f2[_0x67e9('0x3a')],_0x7092f2['query']);_0x2b3a1d[_0x67e9('0x3b')]=_['intersection'](_0x7092f2[_0x67e9('0x3a')],qs[_0x67e9('0x3c')](_0x2a81f3[_0x67e9('0x35')][_0x67e9('0x3c')]));_0x2b3a1d[_0x67e9('0x3b')]=_0x2b3a1d[_0x67e9('0x3b')]['length']?_0x2b3a1d['attributes']:_0x7092f2['model'];_0x2b3a1d[_0x67e9('0x40')]=qs['sort'](_0x2a81f3[_0x67e9('0x35')][_0x67e9('0x41')]);_0x2b3a1d[_0x67e9('0x42')]=qs[_0x67e9('0x39')](_[_0x67e9('0x43')](_0x2a81f3[_0x67e9('0x35')],_0x7092f2[_0x67e9('0x39')]));if(_0x2a81f3['query'][_0x67e9('0x48')]){_0x2b3a1d[_0x67e9('0x42')]=_[_0x67e9('0x46')](_0x2b3a1d[_0x67e9('0x42')],{'$or':_[_0x67e9('0x47')](_0x2b3a1d[_0x67e9('0x3b')],function(_0x30478d){var _0x59e99e={};_0x59e99e[_0x30478d]={'$like':'%'+_0x2a81f3[_0x67e9('0x35')][_0x67e9('0x48')]+'%'};return _0x59e99e;})});}_0x2b3a1d=_[_0x67e9('0x46')]({},_0x2b3a1d,_0x2a81f3['options']);return _0x54b106[_0x67e9('0xbe')](_0x2b3a1d);}})['then'](function(_0x47d4e4){if(_0x47d4e4){_0x1ef82e=_0x47d4e4[_0x67e9('0x3d')];if(!_0x2a81f3[_0x67e9('0x35')]['hasOwnProperty'](_0x67e9('0x3f'))){_0x2b3a1d[_0x67e9('0x2a')]=qs['limit'](_0x2a81f3[_0x67e9('0x35')][_0x67e9('0x2a')]);_0x2b3a1d[_0x67e9('0x29')]=qs['offset'](_0x2a81f3[_0x67e9('0x35')][_0x67e9('0x29')]);}return _0x54b106[_0x67e9('0xbe')](_0x2b3a1d);}})[_0x67e9('0x1b')](function(_0x290c7f){if(_0x290c7f){return _0x290c7f?{'count':_0x1ef82e,'rows':_0x290c7f}:null;}})['then'](respondWithResult(_0x4323d3,null))[_0x67e9('0x4e')](handleError(_0x4323d3,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index cfc7406..1e583fc 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 _0xa6d1=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x169fa3,_0x2b801b){var _0x434412=function(_0x2fa4b1){while(--_0x2fa4b1){_0x169fa3['push'](_0x169fa3['shift']());}};_0x434412(++_0x2b801b);}(_0xa6d1,0x98));var _0x1a6d=function(_0x18d479,_0x32bc04){_0x18d479=_0x18d479-0x0;var _0x26b12e=_0xa6d1[_0x18d479];return _0x26b12e;};'use strict';var EventEmitter=require(_0x1a6d('0x0'));var SmsAccount=require(_0x1a6d('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1a6d('0x2')](0x0);var events={'afterCreate':_0x1a6d('0x3'),'afterUpdate':_0x1a6d('0x4'),'afterDestroy':_0x1a6d('0x5')};function emitEvent(_0x287915){return function(_0x417a4e,_0x499ad6,_0xd548fb){SmsAccountEvents[_0x1a6d('0x6')](_0x287915+':'+_0x417a4e['id'],_0x417a4e);SmsAccountEvents['emit'](_0x287915,_0x417a4e);_0xd548fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x1a6d('0x7')](e,emitEvent(event));}}module[_0x1a6d('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x31e0=['events','SmsAccount','save','update','remove','emit','hook','exports'];(function(_0x3e6021,_0x4f53ff){var _0x65d662=function(_0x4f281e){while(--_0x4f281e){_0x3e6021['push'](_0x3e6021['shift']());}};_0x65d662(++_0x4f53ff);}(_0x31e0,0x80));var _0x031e=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x31e0[_0x11ce46];return _0x368a1e;};'use strict';var EventEmitter=require(_0x031e('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x031e('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x031e('0x2'),'afterUpdate':_0x031e('0x3'),'afterDestroy':_0x031e('0x4')};function emitEvent(_0x503889){return function(_0x11edf5,_0x138d11,_0x5dcddb){SmsAccountEvents[_0x031e('0x5')](_0x503889+':'+_0x11edf5['id'],_0x11edf5);SmsAccountEvents['emit'](_0x503889,_0x11edf5);_0x5dcddb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x031e('0x6')](e,emitEvent(event));}}module[_0x031e('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 7db6fc6..f059291 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 _0xf274=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','SmsAccount'];(function(_0x2cb0da,_0x53710d){var _0x56f3a9=function(_0x1f02c5){while(--_0x1f02c5){_0x2cb0da['push'](_0x2cb0da['shift']());}};_0x56f3a9(++_0x53710d);}(_0xf274,0x99));var _0x4f27=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xf274[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require(_0x4f27('0x0'));var logger=require(_0x4f27('0x1'))(_0x4f27('0x2'));var moment=require(_0x4f27('0x3'));var BPromise=require(_0x4f27('0x4'));var rp=require(_0x4f27('0x5'));var attributes=require('./smsAccount.attributes');module[_0x4f27('0x6')]=function(_0xfde9c5,_0x20192a){return _0xfde9c5[_0x4f27('0x7')](_0x4f27('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2746=['request-promise','./smsAccount.attributes','define','SmsAccount','../../config/logger','api','moment','bluebird'];(function(_0x8f3bed,_0x4ec037){var _0x403103=function(_0x35ddb0){while(--_0x35ddb0){_0x8f3bed['push'](_0x8f3bed['shift']());}};_0x403103(++_0x4ec037);}(_0x2746,0x19c));var _0x6274=function(_0x3fcc50,_0x32659e){_0x3fcc50=_0x3fcc50-0x0;var _0x129358=_0x2746[_0x3fcc50];return _0x129358;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6274('0x0'))(_0x6274('0x1'));var moment=require(_0x6274('0x2'));var BPromise=require(_0x6274('0x3'));var rp=require(_0x6274('0x4'));var attributes=require(_0x6274('0x5'));module['exports']=function(_0x52b270,_0x4492d3){return _0x52b270[_0x6274('0x6')](_0x6274('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index c3a1dfb..63d2e54 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 _0x1d19=['attributes','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','socket.io-emitter','./smsAccount.socket','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x1d19,0x124));var _0x91d1=function(_0x348dc3,_0x4993bd){_0x348dc3=_0x348dc3-0x0;var _0x2aed6c=_0x1d19[_0x348dc3];return _0x2aed6c;};'use strict';var _=require(_0x91d1('0x0'));var util=require(_0x91d1('0x1'));var moment=require(_0x91d1('0x2'));var BPromise=require(_0x91d1('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x91d1('0x4'))['db'];var utils=require(_0x91d1('0x5'));var logger=require(_0x91d1('0x6'))('rpc');var config=require(_0x91d1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x91d1('0x8')]['http']({'port':0x232a});var socket=require(_0x91d1('0x9'))({'host':'localhost','port':0x18eb});require(_0x91d1('0xa'))['register'](socket);function respondWithRpcPromise(_0x51b140,_0x426147,_0x35b06e){return new BPromise(function(_0xeead94,_0x50c468){return client['request'](_0x51b140,_0x35b06e)[_0x91d1('0xb')](function(_0x3bbf7f){logger[_0x91d1('0xc')](_0x91d1('0xd'),_0x426147,_0x91d1('0xe'));logger[_0x91d1('0xf')](_0x91d1('0x10'),_0x426147,_0x91d1('0xe'),JSON[_0x91d1('0x11')](_0x3bbf7f));if(_0x3bbf7f[_0x91d1('0x12')]){if(_0x3bbf7f[_0x91d1('0x12')][_0x91d1('0x13')]===0x1f4){logger['error'](_0x91d1('0xd'),_0x426147,_0x3bbf7f[_0x91d1('0x12')][_0x91d1('0x14')]);return _0x50c468(_0x3bbf7f[_0x91d1('0x12')][_0x91d1('0x14')]);}logger['error'](_0x91d1('0xd'),_0x426147,_0x3bbf7f[_0x91d1('0x12')]['message']);return _0xeead94(_0x3bbf7f[_0x91d1('0x12')][_0x91d1('0x14')]);}else{logger[_0x91d1('0xc')](_0x91d1('0xd'),_0x426147,_0x91d1('0xe'));_0xeead94(_0x3bbf7f[_0x91d1('0x15')][_0x91d1('0x14')]);}})[_0x91d1('0x16')](function(_0x19ccba){logger[_0x91d1('0x12')](_0x91d1('0xd'),_0x426147,_0x19ccba);_0x50c468(_0x19ccba);});});}exports[_0x91d1('0x17')]=function(_0x51b521){var _0x4152f6=this;return new Promise(function(_0xd128be,_0x5bb796){return db['SmsAccount'][_0x91d1('0x18')]({'raw':_0x51b521[_0x91d1('0x19')]?_0x51b521['options'][_0x91d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x51b521[_0x91d1('0x19')]?_0x51b521['options'][_0x91d1('0x1b')]||null:null,'attributes':_0x51b521[_0x91d1('0x19')]?_0x51b521[_0x91d1('0x19')][_0x91d1('0x1c')]||null:null,'include':_0x51b521['options']?_0x51b521[_0x91d1('0x19')][_0x91d1('0x1d')]?_[_0x91d1('0x1e')](_0x51b521['options'][_0x91d1('0x1d')],function(_0x1baaac){return{'model':db[_0x1baaac[_0x91d1('0x1f')]],'as':_0x1baaac['as'],'attributes':_0x1baaac[_0x91d1('0x1c')],'include':_0x1baaac[_0x91d1('0x1d')]?_['map'](_0x1baaac[_0x91d1('0x1d')],function(_0x333c65){return{'model':db[_0x333c65[_0x91d1('0x1f')]],'as':_0x333c65['as'],'attributes':_0x333c65[_0x91d1('0x1c')],'include':_0x333c65['include']?_[_0x91d1('0x1e')](_0x333c65['include'],function(_0x22e22d){return{'model':db[_0x22e22d[_0x91d1('0x1f')]],'as':_0x22e22d['as'],'attributes':_0x22e22d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x20d451){logger[_0x91d1('0xc')](_0x91d1('0x17'),_0x51b521);logger[_0x91d1('0xf')]('ShowSmsAccount',_0x51b521,JSON[_0x91d1('0x11')](_0x20d451));_0xd128be(_0x20d451);})[_0x91d1('0x16')](function(_0x14b27e){logger['error']('ShowSmsAccount',_0x14b27e[_0x91d1('0x14')],_0x51b521);_0x5bb796(_0x4152f6[_0x91d1('0x12')](0x1f4,_0x14b27e['message']));});});}; \ No newline at end of file +var _0x4f5d=['raw','where','attributes','map','model','include','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options'];(function(_0x5e1c6e,_0x5779ab){var _0x2e406c=function(_0x1305c0){while(--_0x1305c0){_0x5e1c6e['push'](_0x5e1c6e['shift']());}};_0x2e406c(++_0x5779ab);}(_0x4f5d,0x12f));var _0xd4f5=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4f5d[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var moment=require(_0xd4f5('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4f5('0x3'));var fs=require('fs');var db=require(_0xd4f5('0x4'))['db'];var utils=require(_0xd4f5('0x5'));var logger=require(_0xd4f5('0x6'))(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var jayson=require(_0xd4f5('0x9'));var client=jayson['client'][_0xd4f5('0xa')]({'port':0x232a});var socket=require(_0xd4f5('0xb'))({'host':_0xd4f5('0xc'),'port':0x18eb});require(_0xd4f5('0xd'))[_0xd4f5('0xe')](socket);function respondWithRpcPromise(_0x1cd72c,_0x4d593c,_0x56a034){return new BPromise(function(_0x5439b7,_0x5b0665){return client[_0xd4f5('0xf')](_0x1cd72c,_0x56a034)[_0xd4f5('0x10')](function(_0x4130fa){logger['info'](_0xd4f5('0x11'),_0x4d593c,_0xd4f5('0x12'));logger[_0xd4f5('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d593c,'request\x20sent',JSON['stringify'](_0x4130fa));if(_0x4130fa[_0xd4f5('0x14')]){if(_0x4130fa[_0xd4f5('0x14')][_0xd4f5('0x15')]===0x1f4){logger['error'](_0xd4f5('0x11'),_0x4d593c,_0x4130fa['error'][_0xd4f5('0x16')]);return _0x5b0665(_0x4130fa[_0xd4f5('0x14')]['message']);}logger['error'](_0xd4f5('0x11'),_0x4d593c,_0x4130fa[_0xd4f5('0x14')][_0xd4f5('0x16')]);return _0x5439b7(_0x4130fa[_0xd4f5('0x14')]['message']);}else{logger[_0xd4f5('0x17')](_0xd4f5('0x11'),_0x4d593c,_0xd4f5('0x12'));_0x5439b7(_0x4130fa[_0xd4f5('0x18')][_0xd4f5('0x16')]);}})[_0xd4f5('0x19')](function(_0x52921c){logger[_0xd4f5('0x14')](_0xd4f5('0x11'),_0x4d593c,_0x52921c);_0x5b0665(_0x52921c);});});}exports[_0xd4f5('0x1a')]=function(_0x47bce5){var _0x46600d=this;return new Promise(function(_0x5610e4,_0x24f5a8){return db[_0xd4f5('0x1b')][_0xd4f5('0x1c')]({'raw':_0x47bce5[_0xd4f5('0x1d')]?_0x47bce5[_0xd4f5('0x1d')][_0xd4f5('0x1e')]===undefined?!![]:![]:!![],'where':_0x47bce5[_0xd4f5('0x1d')]?_0x47bce5[_0xd4f5('0x1d')][_0xd4f5('0x1f')]||null:null,'attributes':_0x47bce5[_0xd4f5('0x1d')]?_0x47bce5[_0xd4f5('0x1d')][_0xd4f5('0x20')]||null:null,'include':_0x47bce5[_0xd4f5('0x1d')]?_0x47bce5[_0xd4f5('0x1d')]['include']?_[_0xd4f5('0x21')](_0x47bce5['options']['include'],function(_0x304be7){return{'model':db[_0x304be7[_0xd4f5('0x22')]],'as':_0x304be7['as'],'attributes':_0x304be7['attributes'],'include':_0x304be7['include']?_[_0xd4f5('0x21')](_0x304be7['include'],function(_0x42bf84){return{'model':db[_0x42bf84[_0xd4f5('0x22')]],'as':_0x42bf84['as'],'attributes':_0x42bf84['attributes'],'include':_0x42bf84[_0xd4f5('0x23')]?_['map'](_0x42bf84[_0xd4f5('0x23')],function(_0x36db28){return{'model':db[_0x36db28[_0xd4f5('0x22')]],'as':_0x36db28['as'],'attributes':_0x36db28[_0xd4f5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd4f5('0x10')](function(_0x2919b7){logger[_0xd4f5('0x17')](_0xd4f5('0x1a'),_0x47bce5);logger[_0xd4f5('0x13')](_0xd4f5('0x1a'),_0x47bce5,JSON[_0xd4f5('0x24')](_0x2919b7));_0x5610e4(_0x2919b7);})[_0xd4f5('0x19')](function(_0x40e403){logger['error']('ShowSmsAccount',_0x40e403[_0xd4f5('0x16')],_0x47bce5);_0x24f5a8(_0x46600d[_0xd4f5('0x14')](0x1f4,_0x40e403[_0xd4f5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 797911c..32209ef 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 _0x2767=['remove','update','emit','register','./smsAccount.events','save'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x2767,0xee));var _0x7276=function(_0x3b749e,_0x33ac6f){_0x3b749e=_0x3b749e-0x0;var _0x3fbd6b=_0x2767[_0x3b749e];return _0x3fbd6b;};'use strict';var SmsAccountEvents=require(_0x7276('0x0'));var events=[_0x7276('0x1'),_0x7276('0x2'),_0x7276('0x3')];function createListener(_0x3ed0f9,_0x419775){return function(_0x35dc08){_0x419775[_0x7276('0x4')](_0x3ed0f9,_0x35dc08);};}function removeListener(_0xaa601f,_0x4a62b8){return function(){SmsAccountEvents['removeListener'](_0xaa601f,_0x4a62b8);};}exports[_0x7276('0x5')]=function(_0x8215ca){for(var _0x483666=0x0,_0x2ae507=events['length'];_0x483666<_0x2ae507;_0x483666++){var _0x15a402=events[_0x483666];var _0x380a7a=createListener('smsAccount:'+_0x15a402,_0x8215ca);SmsAccountEvents['on'](_0x15a402,_0x380a7a);}}; \ No newline at end of file +var _0xf703=['save','remove','emit','removeListener','length','smsAccount:','./smsAccount.events'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf703,0x18e));var _0x3f70=function(_0x2f6523,_0x5c16ed){_0x2f6523=_0x2f6523-0x0;var _0xea9ea8=_0xf703[_0x2f6523];return _0xea9ea8;};'use strict';var SmsAccountEvents=require(_0x3f70('0x0'));var events=[_0x3f70('0x1'),_0x3f70('0x2'),'update'];function createListener(_0x5f3acb,_0x1fd12f){return function(_0xa84de2){_0x1fd12f[_0x3f70('0x3')](_0x5f3acb,_0xa84de2);};}function removeListener(_0x27f314,_0x229897){return function(){SmsAccountEvents[_0x3f70('0x4')](_0x27f314,_0x229897);};}exports['register']=function(_0x5f378c){for(var _0x56db6f=0x0,_0x54593a=events[_0x3f70('0x5')];_0x56db6f<_0x54593a;_0x56db6f++){var _0x1fad95=events[_0x56db6f];var _0x18020d=createListener(_0x3f70('0x6')+_0x1fad95,_0x5f378c);SmsAccountEvents['on'](_0x1fad95,_0x18020d);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index bf2853b..ec75ebe 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 _0x8590=['get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./smsApplication.controller'];(function(_0x4f29a5,_0x19a58a){var _0x329f2e=function(_0x5f43b0){while(--_0x5f43b0){_0x4f29a5['push'](_0x4f29a5['shift']());}};_0x329f2e(++_0x19a58a);}(_0x8590,0xfa));var _0x0859=function(_0x1e99c9,_0x745dce){_0x1e99c9=_0x1e99c9-0x0;var _0xa7d78a=_0x8590[_0x1e99c9];return _0xa7d78a;};'use strict';var multer=require('multer');var util=require(_0x0859('0x0'));var path=require(_0x0859('0x1'));var express=require(_0x0859('0x2'));var router=express['Router']();var auth=require(_0x0859('0x3'));var interaction=require(_0x0859('0x4'));var config=require('../../config/environment');var controller=require(_0x0859('0x5'));router[_0x0859('0x6')]('/',auth[_0x0859('0x7')](),controller[_0x0859('0x8')]);router[_0x0859('0x6')](_0x0859('0x9'),auth['isAuthenticated'](),controller[_0x0859('0xa')]);router[_0x0859('0xb')]('/',auth[_0x0859('0x7')](),controller['create']);router[_0x0859('0xc')](_0x0859('0x9'),auth[_0x0859('0x7')](),controller[_0x0859('0xd')]);router['delete']('/:id',auth[_0x0859('0x7')](),controller[_0x0859('0xe')]);module[_0x0859('0xf')]=router; \ No newline at end of file +var _0xdc9a=['index','/:id','show','post','create','update','multer','util','express','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated'];(function(_0x333f9d,_0xb77224){var _0x4bc853=function(_0x59f452){while(--_0x59f452){_0x333f9d['push'](_0x333f9d['shift']());}};_0x4bc853(++_0xb77224);}(_0xdc9a,0x148));var _0xadc9=function(_0x3e2599,_0x1c4d88){_0x3e2599=_0x3e2599-0x0;var _0x335f72=_0xdc9a[_0x3e2599];return _0x335f72;};'use strict';var multer=require(_0xadc9('0x0'));var util=require(_0xadc9('0x1'));var path=require('path');var express=require(_0xadc9('0x2'));var router=express[_0xadc9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xadc9('0x4'));var config=require(_0xadc9('0x5'));var controller=require(_0xadc9('0x6'));router['get']('/',auth[_0xadc9('0x7')](),controller[_0xadc9('0x8')]);router['get'](_0xadc9('0x9'),auth[_0xadc9('0x7')](),controller[_0xadc9('0xa')]);router[_0xadc9('0xb')]('/',auth[_0xadc9('0x7')](),controller[_0xadc9('0xc')]);router['put']('/:id',auth[_0xadc9('0x7')](),controller[_0xadc9('0xd')]);router['delete']('/:id',auth[_0xadc9('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1d837bf..571de7e 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 _0x476d=['sequelize','INTEGER','STRING','noop'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x476d,0x1b4));var _0xd476=function(_0x35c42f,_0x28c9d3){_0x35c42f=_0x35c42f-0x0;var _0x213291=_0x476d[_0x35c42f];return _0x213291;};'use strict';var Sequelize=require(_0xd476('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd476('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd476('0x2')],'allowNull':![],'defaultValue':_0xd476('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd476('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9f76=['*,*,*,*','sequelize','exports','noop','STRING'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9f76,0x1d7));var _0x69f7=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x9f76[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x69f7('0x0'));module[_0x69f7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x69f7('0x2')},'appdata':{'type':Sequelize[_0x69f7('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x69f7('0x3')]},'interval':{'type':Sequelize[_0x69f7('0x3')],'defaultValue':_0x69f7('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index ce17a7a..96f2879 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 _0x1bfd=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','save','update','then','destroy','error','stack','name','send','index','SmsApplication','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','add','day','where','merge','map','filter','options','include','findAll','catch','params','includeAll','find','create','body'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x1bfd,0x1dc));var _0xd1bf=function(_0x3bcb3c,_0x444c1d){_0x3bcb3c=_0x3bcb3c-0x0;var _0x1cff3f=_0x1bfd[_0x3bcb3c];return _0x1cff3f;};'use strict';var jsonpatch=require(_0xd1bf('0x0'));var rp=require(_0xd1bf('0x1'));var moment=require('moment');var BPromise=require(_0xd1bf('0x2'));var Mustache=require(_0xd1bf('0x3'));var util=require(_0xd1bf('0x4'));var path=require(_0xd1bf('0x5'));var sox=require(_0xd1bf('0x6'));var csv=require(_0xd1bf('0x7'));var ejs=require(_0xd1bf('0x8'));var fs=require('fs');var _=require(_0xd1bf('0x9'));var squel=require(_0xd1bf('0xa'));var crypto=require(_0xd1bf('0xb'));var jsforce=require(_0xd1bf('0xc'));var deskjs=require(_0xd1bf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd1bf('0xe'));var Papa=require(_0xd1bf('0xf'));var qs=require(_0xd1bf('0x10'));var logger=require(_0xd1bf('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd1bf('0x12'));var db=require(_0xd1bf('0x13'))['db'];function respondWithStatusCode(_0x5f4fb6,_0x5a041f){_0x5a041f=_0x5a041f||0xcc;return function(_0x182dc2){if(_0x182dc2){return _0x5f4fb6[_0xd1bf('0x14')](_0x5a041f);}return _0x5f4fb6[_0xd1bf('0x15')](_0x5a041f)['end']();};}function respondWithResult(_0x2e35af,_0x225068){_0x225068=_0x225068||0xc8;return function(_0xbe2063){if(_0xbe2063){return _0x2e35af[_0xd1bf('0x15')](_0x225068)['json'](_0xbe2063);}};}function respondWithFilteredResult(_0x211661,_0x144ba1){return function(_0x133062){if(_0x133062){var _0x6ae38d=_0x133062[_0xd1bf('0x16')],_0x575766=_0x144ba1['offset'],_0x3c227c=_0x144ba1[_0xd1bf('0x17')]+_0x144ba1[_0xd1bf('0x18')],_0x7e22a0;if(_0x3c227c>=_0x6ae38d){_0x3c227c=_0x6ae38d;_0x7e22a0=0xc8;}else{_0x7e22a0=0xce;}_0x211661[_0xd1bf('0x15')](_0x7e22a0);return _0x211661[_0xd1bf('0x19')]('Content-Range',_0x575766+'-'+_0x3c227c+'/'+_0x6ae38d)[_0xd1bf('0x1a')](_0x133062);}return null;};}function patchUpdates(_0x185cf5){return function(_0x1e4542){try{jsonpatch[_0xd1bf('0x1b')](_0x1e4542,_0x185cf5,!![]);}catch(_0x22bae3){return BPromise['reject'](_0x22bae3);}return _0x1e4542[_0xd1bf('0x1c')]();};}function saveUpdates(_0x33f2f6,_0x5f1c87){return function(_0x13d3e1){if(_0x13d3e1){return _0x13d3e1[_0xd1bf('0x1d')](_0x33f2f6)[_0xd1bf('0x1e')](function(_0x5d3635){return _0x5d3635;});}return null;};}function removeEntity(_0x2e6d0b,_0x402759){return function(_0x37536d){if(_0x37536d){return _0x37536d[_0xd1bf('0x1f')]()[_0xd1bf('0x1e')](function(){_0x2e6d0b[_0xd1bf('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab004,_0x49ad7c){return function(_0x2901d6){if(!_0x2901d6){_0x3ab004[_0xd1bf('0x14')](0x194);}return _0x2901d6;};}function handleError(_0x2e1aef,_0x354102){_0x354102=_0x354102||0x1f4;return function(_0x5bac4a){logger[_0xd1bf('0x20')](_0x5bac4a[_0xd1bf('0x21')]);if(_0x5bac4a[_0xd1bf('0x22')]){delete _0x5bac4a[_0xd1bf('0x22')];}_0x2e1aef['status'](_0x354102)[_0xd1bf('0x23')](_0x5bac4a);};}exports[_0xd1bf('0x24')]=function(_0x13d5ec,_0x1c0591){var _0x3761d3={},_0x11ecad={},_0x109ce8={'count':0x0,'rows':[]};var _0x27c3b9=db[_0xd1bf('0x25')][_0xd1bf('0x26')];_0x11ecad[_0xd1bf('0x27')]=_['keys'](_0x27c3b9);var _0x4fce7c={'dateStart':_0x13d5ec['query'][_0xd1bf('0x28')],'dateEnd':_0x13d5ec[_0xd1bf('0x29')]['dateEnd']};delete _0x13d5ec[_0xd1bf('0x29')][_0xd1bf('0x28')];delete _0x13d5ec['query'][_0xd1bf('0x2a')];_0x11ecad['query']=_[_0xd1bf('0x2b')](_0x13d5ec[_0xd1bf('0x29')]);_0x11ecad[_0xd1bf('0x2c')]=_[_0xd1bf('0x2d')](_0x11ecad[_0xd1bf('0x27')],_0x11ecad[_0xd1bf('0x29')]);_0x3761d3[_0xd1bf('0x2e')]=_['intersection'](_0x11ecad[_0xd1bf('0x27')],qs[_0xd1bf('0x2f')](_0x13d5ec['query']['fields']));_0x3761d3['attributes']=_0x3761d3['attributes'][_0xd1bf('0x30')]?_0x3761d3[_0xd1bf('0x2e')]:_0x11ecad[_0xd1bf('0x27')];if(!_0x13d5ec[_0xd1bf('0x29')][_0xd1bf('0x31')](_0xd1bf('0x32'))){_0x3761d3[_0xd1bf('0x18')]=qs['limit'](_0x13d5ec[_0xd1bf('0x29')][_0xd1bf('0x18')]);_0x3761d3[_0xd1bf('0x17')]=qs[_0xd1bf('0x17')](_0x13d5ec['query'][_0xd1bf('0x17')]);}_0x3761d3['order']=qs[_0xd1bf('0x33')](_0x13d5ec[_0xd1bf('0x29')][_0xd1bf('0x33')]);_0x3761d3['where']=qs[_0xd1bf('0x2c')](_[_0xd1bf('0x34')](_0x13d5ec['query'],_0x11ecad[_0xd1bf('0x2c')]));if(_0x4fce7c[_0xd1bf('0x28')]){if(_0x4fce7c['dateEnd']){_0x4fce7c[_0xd1bf('0x2a')]=moment(_0x4fce7c[_0xd1bf('0x2a')])[_0xd1bf('0x35')](0x1,_0xd1bf('0x36'));}else{_0x4fce7c[_0xd1bf('0x2a')]=moment(_0x4fce7c[_0xd1bf('0x28')])['add'](0x1,_0xd1bf('0x36'));}_['merge'](_0x3761d3['where'],{'createdAt':{'$gte':_0x4fce7c[_0xd1bf('0x28')],'$lte':_0x4fce7c[_0xd1bf('0x2a')]}});}if(_0x13d5ec['query']['filter']){_0x3761d3[_0xd1bf('0x37')]=_[_0xd1bf('0x38')](_0x3761d3[_0xd1bf('0x37')],{'$or':_[_0xd1bf('0x39')](_0x3761d3[_0xd1bf('0x2e')],function(_0x1b0a5c){var _0x546509={};_0x546509[_0x1b0a5c]={'$like':'%'+_0x13d5ec[_0xd1bf('0x29')][_0xd1bf('0x3a')]+'%'};return _0x546509;})});}_0x3761d3=_[_0xd1bf('0x38')]({},_0x3761d3,_0x13d5ec[_0xd1bf('0x3b')]);var _0x457e18={'where':_0x3761d3[_0xd1bf('0x37')]};return db[_0xd1bf('0x25')][_0xd1bf('0x16')](_0x457e18)[_0xd1bf('0x1e')](function(_0x28aef){_0x109ce8[_0xd1bf('0x16')]=_0x28aef;if(_0x13d5ec[_0xd1bf('0x29')]['includeAll']){_0x3761d3[_0xd1bf('0x3c')]=[{'all':!![]}];}return db['SmsApplication'][_0xd1bf('0x3d')](_0x3761d3);})[_0xd1bf('0x1e')](function(_0x723f93){_0x109ce8['rows']=_0x723f93;return _0x109ce8;})[_0xd1bf('0x1e')](respondWithFilteredResult(_0x1c0591,_0x3761d3))[_0xd1bf('0x3e')](handleError(_0x1c0591,null));};exports['show']=function(_0x428361,_0x4814a7){var _0x49df2e={'raw':!![],'where':{'id':_0x428361[_0xd1bf('0x3f')]['id']}},_0x138285={};_0x138285[_0xd1bf('0x27')]=_[_0xd1bf('0x2b')](db['SmsApplication'][_0xd1bf('0x26')]);_0x138285[_0xd1bf('0x29')]=_[_0xd1bf('0x2b')](_0x428361[_0xd1bf('0x29')]);_0x138285[_0xd1bf('0x2c')]=_['intersection'](_0x138285[_0xd1bf('0x27')],_0x138285[_0xd1bf('0x29')]);_0x49df2e[_0xd1bf('0x2e')]=_[_0xd1bf('0x2d')](_0x138285['model'],qs[_0xd1bf('0x2f')](_0x428361[_0xd1bf('0x29')][_0xd1bf('0x2f')]));_0x49df2e[_0xd1bf('0x2e')]=_0x49df2e[_0xd1bf('0x2e')]['length']?_0x49df2e[_0xd1bf('0x2e')]:_0x138285[_0xd1bf('0x27')];if(_0x428361['query'][_0xd1bf('0x40')]){_0x49df2e[_0xd1bf('0x3c')]=[{'all':!![]}];}_0x49df2e=_[_0xd1bf('0x38')]({},_0x49df2e,_0x428361[_0xd1bf('0x3b')]);return db[_0xd1bf('0x25')][_0xd1bf('0x41')](_0x49df2e)[_0xd1bf('0x1e')](handleEntityNotFound(_0x4814a7,null))[_0xd1bf('0x1e')](respondWithResult(_0x4814a7,null))['catch'](handleError(_0x4814a7,null));};exports[_0xd1bf('0x42')]=function(_0xea929c,_0x4e2fc5){return db[_0xd1bf('0x25')][_0xd1bf('0x42')](_0xea929c['body'],{})[_0xd1bf('0x1e')](respondWithResult(_0x4e2fc5,0xc9))['catch'](handleError(_0x4e2fc5,null));};exports[_0xd1bf('0x1d')]=function(_0x4a0e21,_0x45a8ca){if(_0x4a0e21[_0xd1bf('0x43')]['id']){delete _0x4a0e21['body']['id'];}return db['SmsApplication'][_0xd1bf('0x41')]({'where':{'id':_0x4a0e21[_0xd1bf('0x3f')]['id']}})[_0xd1bf('0x1e')](handleEntityNotFound(_0x45a8ca,null))[_0xd1bf('0x1e')](saveUpdates(_0x4a0e21[_0xd1bf('0x43')],null))[_0xd1bf('0x1e')](respondWithResult(_0x45a8ca,null))[_0xd1bf('0x3e')](handleError(_0x45a8ca,null));};exports[_0xd1bf('0x1f')]=function(_0x473944,_0x352360){return db['SmsApplication'][_0xd1bf('0x41')]({'where':{'id':_0x473944[_0xd1bf('0x3f')]['id']}})[_0xd1bf('0x1e')](handleEntityNotFound(_0x352360,null))[_0xd1bf('0x1e')](removeEntity(_0x352360,null))[_0xd1bf('0x3e')](handleError(_0x352360,null));}; \ No newline at end of file +var _0xd694=['include','findAll','rows','show','params','fields','length','find','catch','create','body','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','error','stack','name','send','index','SmsApplication','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','options','count','then','includeAll'];(function(_0x21f27d,_0x2305ba){var _0x504a7b=function(_0x1428f6){while(--_0x1428f6){_0x21f27d['push'](_0x21f27d['shift']());}};_0x504a7b(++_0x2305ba);}(_0xd694,0x11b));var _0x4d69=function(_0x46440c,_0x4da44f){_0x46440c=_0x46440c-0x0;var _0x1cb968=_0xd694[_0x46440c];return _0x1cb968;};'use strict';var jsonpatch=require(_0x4d69('0x0'));var rp=require('request-promise');var moment=require(_0x4d69('0x1'));var BPromise=require(_0x4d69('0x2'));var Mustache=require(_0x4d69('0x3'));var util=require(_0x4d69('0x4'));var path=require('path');var sox=require(_0x4d69('0x5'));var csv=require('to-csv');var ejs=require(_0x4d69('0x6'));var fs=require('fs');var _=require(_0x4d69('0x7'));var squel=require('squel');var crypto=require(_0x4d69('0x8'));var jsforce=require(_0x4d69('0x9'));var deskjs=require(_0x4d69('0xa'));var toCsv=require(_0x4d69('0xb'));var querystring=require('querystring');var Papa=require(_0x4d69('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x4d69('0xd'))(_0x4d69('0xe'));var utils=require(_0x4d69('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x471e7f,_0x3e5176){_0x3e5176=_0x3e5176||0xcc;return function(_0x1ea9bc){if(_0x1ea9bc){return _0x471e7f[_0x4d69('0x10')](_0x3e5176);}return _0x471e7f[_0x4d69('0x11')](_0x3e5176)[_0x4d69('0x12')]();};}function respondWithResult(_0x142d4f,_0x41823d){_0x41823d=_0x41823d||0xc8;return function(_0x35b06f){if(_0x35b06f){return _0x142d4f['status'](_0x41823d)[_0x4d69('0x13')](_0x35b06f);}};}function respondWithFilteredResult(_0x21683b,_0x8f33e6){return function(_0x39d13f){if(_0x39d13f){var _0x210a7b=_0x39d13f['count'],_0x43b4f0=_0x8f33e6[_0x4d69('0x14')],_0x52b4ea=_0x8f33e6[_0x4d69('0x14')]+_0x8f33e6[_0x4d69('0x15')],_0x1a338d;if(_0x52b4ea>=_0x210a7b){_0x52b4ea=_0x210a7b;_0x1a338d=0xc8;}else{_0x1a338d=0xce;}_0x21683b[_0x4d69('0x11')](_0x1a338d);return _0x21683b[_0x4d69('0x16')]('Content-Range',_0x43b4f0+'-'+_0x52b4ea+'/'+_0x210a7b)[_0x4d69('0x13')](_0x39d13f);}return null;};}function patchUpdates(_0x4428da){return function(_0x2fb862){try{jsonpatch[_0x4d69('0x17')](_0x2fb862,_0x4428da,!![]);}catch(_0x29bd12){return BPromise[_0x4d69('0x18')](_0x29bd12);}return _0x2fb862[_0x4d69('0x19')]();};}function saveUpdates(_0x438efb,_0xe8836){return function(_0x30a8ce){if(_0x30a8ce){return _0x30a8ce[_0x4d69('0x1a')](_0x438efb)['then'](function(_0x208a2e){return _0x208a2e;});}return null;};}function removeEntity(_0x322753,_0x49d83a){return function(_0x1ad94f){if(_0x1ad94f){return _0x1ad94f[_0x4d69('0x1b')]()['then'](function(){_0x322753[_0x4d69('0x11')](0xcc)[_0x4d69('0x12')]();});}};}function handleEntityNotFound(_0xc077bc,_0x544806){return function(_0x50d1dc){if(!_0x50d1dc){_0xc077bc['sendStatus'](0x194);}return _0x50d1dc;};}function handleError(_0x1ef8d8,_0x1b297f){_0x1b297f=_0x1b297f||0x1f4;return function(_0x4821ae){logger[_0x4d69('0x1c')](_0x4821ae[_0x4d69('0x1d')]);if(_0x4821ae[_0x4d69('0x1e')]){delete _0x4821ae[_0x4d69('0x1e')];}_0x1ef8d8[_0x4d69('0x11')](_0x1b297f)[_0x4d69('0x1f')](_0x4821ae);};}exports[_0x4d69('0x20')]=function(_0x22856e,_0x4b704e){var _0x2f384b={},_0x6cca72={},_0x2eb618={'count':0x0,'rows':[]};var _0x101749=db[_0x4d69('0x21')][_0x4d69('0x22')];_0x6cca72[_0x4d69('0x23')]=_[_0x4d69('0x24')](_0x101749);var _0x4ceb89={'dateStart':_0x22856e[_0x4d69('0x25')][_0x4d69('0x26')],'dateEnd':_0x22856e['query'][_0x4d69('0x27')]};delete _0x22856e[_0x4d69('0x25')][_0x4d69('0x26')];delete _0x22856e[_0x4d69('0x25')][_0x4d69('0x27')];_0x6cca72['query']=_[_0x4d69('0x24')](_0x22856e[_0x4d69('0x25')]);_0x6cca72[_0x4d69('0x28')]=_[_0x4d69('0x29')](_0x6cca72[_0x4d69('0x23')],_0x6cca72[_0x4d69('0x25')]);_0x2f384b[_0x4d69('0x2a')]=_[_0x4d69('0x29')](_0x6cca72[_0x4d69('0x23')],qs['fields'](_0x22856e[_0x4d69('0x25')]['fields']));_0x2f384b[_0x4d69('0x2a')]=_0x2f384b['attributes']['length']?_0x2f384b[_0x4d69('0x2a')]:_0x6cca72[_0x4d69('0x23')];if(!_0x22856e[_0x4d69('0x25')][_0x4d69('0x2b')]('nolimit')){_0x2f384b[_0x4d69('0x15')]=qs[_0x4d69('0x15')](_0x22856e[_0x4d69('0x25')][_0x4d69('0x15')]);_0x2f384b[_0x4d69('0x14')]=qs['offset'](_0x22856e[_0x4d69('0x25')][_0x4d69('0x14')]);}_0x2f384b[_0x4d69('0x2c')]=qs[_0x4d69('0x2d')](_0x22856e['query'][_0x4d69('0x2d')]);_0x2f384b[_0x4d69('0x2e')]=qs[_0x4d69('0x28')](_[_0x4d69('0x2f')](_0x22856e[_0x4d69('0x25')],_0x6cca72[_0x4d69('0x28')]));if(_0x4ceb89['dateStart']){if(_0x4ceb89[_0x4d69('0x27')]){_0x4ceb89[_0x4d69('0x27')]=moment(_0x4ceb89[_0x4d69('0x27')])[_0x4d69('0x30')](0x1,_0x4d69('0x31'));}else{_0x4ceb89[_0x4d69('0x27')]=moment(_0x4ceb89[_0x4d69('0x26')])[_0x4d69('0x30')](0x1,_0x4d69('0x31'));}_[_0x4d69('0x32')](_0x2f384b['where'],{'createdAt':{'$gte':_0x4ceb89['dateStart'],'$lte':_0x4ceb89[_0x4d69('0x27')]}});}if(_0x22856e['query'][_0x4d69('0x33')]){_0x2f384b[_0x4d69('0x2e')]=_[_0x4d69('0x32')](_0x2f384b['where'],{'$or':_[_0x4d69('0x34')](_0x2f384b[_0x4d69('0x2a')],function(_0x28a0b3){var _0x443e9d={};_0x443e9d[_0x28a0b3]={'$like':'%'+_0x22856e[_0x4d69('0x25')][_0x4d69('0x33')]+'%'};return _0x443e9d;})});}_0x2f384b=_[_0x4d69('0x32')]({},_0x2f384b,_0x22856e[_0x4d69('0x35')]);var _0x4b0d8b={'where':_0x2f384b[_0x4d69('0x2e')]};return db[_0x4d69('0x21')][_0x4d69('0x36')](_0x4b0d8b)[_0x4d69('0x37')](function(_0x4cc28e){_0x2eb618[_0x4d69('0x36')]=_0x4cc28e;if(_0x22856e[_0x4d69('0x25')][_0x4d69('0x38')]){_0x2f384b[_0x4d69('0x39')]=[{'all':!![]}];}return db[_0x4d69('0x21')][_0x4d69('0x3a')](_0x2f384b);})[_0x4d69('0x37')](function(_0x4976df){_0x2eb618[_0x4d69('0x3b')]=_0x4976df;return _0x2eb618;})[_0x4d69('0x37')](respondWithFilteredResult(_0x4b704e,_0x2f384b))['catch'](handleError(_0x4b704e,null));};exports[_0x4d69('0x3c')]=function(_0x28c73a,_0x2e29ba){var _0x41a387={'raw':!![],'where':{'id':_0x28c73a[_0x4d69('0x3d')]['id']}},_0x1b4382={};_0x1b4382[_0x4d69('0x23')]=_[_0x4d69('0x24')](db['SmsApplication']['rawAttributes']);_0x1b4382[_0x4d69('0x25')]=_[_0x4d69('0x24')](_0x28c73a['query']);_0x1b4382[_0x4d69('0x28')]=_[_0x4d69('0x29')](_0x1b4382[_0x4d69('0x23')],_0x1b4382[_0x4d69('0x25')]);_0x41a387[_0x4d69('0x2a')]=_['intersection'](_0x1b4382['model'],qs[_0x4d69('0x3e')](_0x28c73a[_0x4d69('0x25')]['fields']));_0x41a387[_0x4d69('0x2a')]=_0x41a387[_0x4d69('0x2a')][_0x4d69('0x3f')]?_0x41a387[_0x4d69('0x2a')]:_0x1b4382[_0x4d69('0x23')];if(_0x28c73a[_0x4d69('0x25')]['includeAll']){_0x41a387['include']=[{'all':!![]}];}_0x41a387=_[_0x4d69('0x32')]({},_0x41a387,_0x28c73a['options']);return db[_0x4d69('0x21')][_0x4d69('0x40')](_0x41a387)[_0x4d69('0x37')](handleEntityNotFound(_0x2e29ba,null))['then'](respondWithResult(_0x2e29ba,null))[_0x4d69('0x41')](handleError(_0x2e29ba,null));};exports[_0x4d69('0x42')]=function(_0x3626d1,_0x300a42){return db[_0x4d69('0x21')][_0x4d69('0x42')](_0x3626d1[_0x4d69('0x43')],{})[_0x4d69('0x37')](respondWithResult(_0x300a42,0xc9))[_0x4d69('0x41')](handleError(_0x300a42,null));};exports['update']=function(_0x38469b,_0x39af9f){if(_0x38469b[_0x4d69('0x43')]['id']){delete _0x38469b[_0x4d69('0x43')]['id'];}return db['SmsApplication'][_0x4d69('0x40')]({'where':{'id':_0x38469b['params']['id']}})['then'](handleEntityNotFound(_0x39af9f,null))[_0x4d69('0x37')](saveUpdates(_0x38469b[_0x4d69('0x43')],null))['then'](respondWithResult(_0x39af9f,null))[_0x4d69('0x41')](handleError(_0x39af9f,null));};exports[_0x4d69('0x1b')]=function(_0x560517,_0x2f8157){return db['SmsApplication'][_0x4d69('0x40')]({'where':{'id':_0x560517[_0x4d69('0x3d')]['id']}})[_0x4d69('0x37')](handleEntityNotFound(_0x2f8157,null))['then'](removeEntity(_0x2f8157,null))[_0x4d69('0x41')](handleError(_0x2f8157,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d9d76e8..18c0dd4 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 _0x56c0=['./smsApplication.attributes','exports','define','sms_applications','lodash','util','api','moment','bluebird','request-promise'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x56c0,0x7c));var _0x056c=function(_0x273505,_0x5a7f75){_0x273505=_0x273505-0x0;var _0x9d7ea0=_0x56c0[_0x273505];return _0x9d7ea0;};'use strict';var _=require(_0x056c('0x0'));var util=require(_0x056c('0x1'));var logger=require('../../config/logger')(_0x056c('0x2'));var moment=require(_0x056c('0x3'));var BPromise=require(_0x056c('0x4'));var rp=require(_0x056c('0x5'));var attributes=require(_0x056c('0x6'));module[_0x056c('0x7')]=function(_0x30914c,_0x1f5d0a){return _0x30914c[_0x056c('0x8')]('SmsApplication',attributes,{'tableName':_0x056c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cd=['bluebird','request-promise','./smsApplication.attributes','exports','sms_applications','lodash','util','../../config/logger','api','moment'];(function(_0x5a228f,_0x21e8f9){var _0x8103a7=function(_0x1f845a){while(--_0x1f845a){_0x5a228f['push'](_0x5a228f['shift']());}};_0x8103a7(++_0x21e8f9);}(_0xf2cd,0x127));var _0xdf2c=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0xf2cd[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require(_0xdf2c('0x0'));var util=require(_0xdf2c('0x1'));var logger=require(_0xdf2c('0x2'))(_0xdf2c('0x3'));var moment=require(_0xdf2c('0x4'));var BPromise=require(_0xdf2c('0x5'));var rp=require(_0xdf2c('0x6'));var attributes=require(_0xdf2c('0x7'));module[_0xdf2c('0x8')]=function(_0x75642e,_0x160d56){return _0x75642e['define']('SmsApplication',attributes,{'tableName':_0xdf2c('0x9'),'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 f55e528..4307b97 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 _0xb9ed=['message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1224ee,_0x344d57){var _0x435488=function(_0x3366f5){while(--_0x3366f5){_0x1224ee['push'](_0x1224ee['shift']());}};_0x435488(++_0x344d57);}(_0xb9ed,0x1bc));var _0xdb9e=function(_0x4a9718,_0x584c48){_0x4a9718=_0x4a9718-0x0;var _0x588de4=_0xb9ed[_0x4a9718];return _0x588de4;};'use strict';var _=require(_0xdb9e('0x0'));var util=require('util');var moment=require(_0xdb9e('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb9e('0x2'));var fs=require('fs');var db=require(_0xdb9e('0x3'))['db'];var utils=require(_0xdb9e('0x4'));var logger=require(_0xdb9e('0x5'))(_0xdb9e('0x6'));var config=require(_0xdb9e('0x7'));var jayson=require(_0xdb9e('0x8'));var client=jayson[_0xdb9e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ccecd,_0x53309a,_0x45e22b){return new BPromise(function(_0x57ab79,_0xd9de78){return client['request'](_0x1ccecd,_0x45e22b)[_0xdb9e('0xa')](function(_0x595282){logger[_0xdb9e('0xb')](_0xdb9e('0xc'),_0x53309a,'request\x20sent');logger['debug'](_0xdb9e('0xd'),_0x53309a,_0xdb9e('0xe'),JSON[_0xdb9e('0xf')](_0x595282));if(_0x595282[_0xdb9e('0x10')]){if(_0x595282[_0xdb9e('0x10')][_0xdb9e('0x11')]===0x1f4){logger[_0xdb9e('0x10')]('SmsApplication,\x20%s,\x20%s',_0x53309a,_0x595282['error'][_0xdb9e('0x12')]);return _0xd9de78(_0x595282[_0xdb9e('0x10')]['message']);}logger['error'](_0xdb9e('0xc'),_0x53309a,_0x595282[_0xdb9e('0x10')]['message']);return _0x57ab79(_0x595282[_0xdb9e('0x10')]['message']);}else{logger[_0xdb9e('0xb')](_0xdb9e('0xc'),_0x53309a,_0xdb9e('0xe'));_0x57ab79(_0x595282[_0xdb9e('0x13')][_0xdb9e('0x12')]);}})[_0xdb9e('0x14')](function(_0x5c9800){logger['error'](_0xdb9e('0xc'),_0x53309a,_0x5c9800);_0xd9de78(_0x5c9800);});});} \ No newline at end of file +var _0xf604=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x5c6c3a,_0x2062aa){var _0x3cfbc5=function(_0x2800a4){while(--_0x2800a4){_0x5c6c3a['push'](_0x5c6c3a['shift']());}};_0x3cfbc5(++_0x2062aa);}(_0xf604,0x1a4));var _0x4f60=function(_0x378d60,_0x39713d){_0x378d60=_0x378d60-0x0;var _0x137bff=_0xf604[_0x378d60];return _0x137bff;};'use strict';var _=require(_0x4f60('0x0'));var util=require(_0x4f60('0x1'));var moment=require(_0x4f60('0x2'));var BPromise=require(_0x4f60('0x3'));var rs=require(_0x4f60('0x4'));var fs=require('fs');var db=require(_0x4f60('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f60('0x6'));var config=require(_0x4f60('0x7'));var jayson=require(_0x4f60('0x8'));var client=jayson[_0x4f60('0x9')][_0x4f60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x375b4f,_0xf758bb,_0x48bf70){return new BPromise(function(_0x39e283,_0x3818d4){return client[_0x4f60('0xb')](_0x375b4f,_0x48bf70)['then'](function(_0x483cc7){logger['info'](_0x4f60('0xc'),_0xf758bb,'request\x20sent');logger[_0x4f60('0xd')](_0x4f60('0xe'),_0xf758bb,_0x4f60('0xf'),JSON[_0x4f60('0x10')](_0x483cc7));if(_0x483cc7['error']){if(_0x483cc7['error']['code']===0x1f4){logger[_0x4f60('0x11')](_0x4f60('0xc'),_0xf758bb,_0x483cc7[_0x4f60('0x11')][_0x4f60('0x12')]);return _0x3818d4(_0x483cc7['error'][_0x4f60('0x12')]);}logger[_0x4f60('0x11')]('SmsApplication,\x20%s,\x20%s',_0xf758bb,_0x483cc7[_0x4f60('0x11')][_0x4f60('0x12')]);return _0x39e283(_0x483cc7[_0x4f60('0x11')]['message']);}else{logger[_0x4f60('0x13')](_0x4f60('0xc'),_0xf758bb,'request\x20sent');_0x39e283(_0x483cc7[_0x4f60('0x14')][_0x4f60('0x12')]);}})[_0x4f60('0x15')](function(_0x45598f){logger['error'](_0x4f60('0xc'),_0xf758bb,_0x45598f);_0x3818d4(_0x45598f);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6a05e30..a03e1c1 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 _0x9c44=['/describe','describe','show','/:id/messages','post','/:id/tags','tracked','sms','addTags','put','/:id','smsinteraction:update','update','smsinteraction:destroy','delete','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x1ee7a7,_0x2478b0){var _0x291a52=function(_0x54718c){while(--_0x54718c){_0x1ee7a7['push'](_0x1ee7a7['shift']());}};_0x291a52(++_0x2478b0);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var express=require(_0x49c4('0x1'));var router=express[_0x49c4('0x2')]();var auth=require(_0x49c4('0x3'));var interaction=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x49c4('0x6')](),controller['index']);router[_0x49c4('0x7')](_0x49c4('0x8'),auth[_0x49c4('0x6')](),controller[_0x49c4('0x9')]);router[_0x49c4('0x7')]('/:id',auth[_0x49c4('0x6')](),controller[_0x49c4('0xa')]);router[_0x49c4('0x7')](_0x49c4('0xb'),auth['isAuthenticated'](),controller['getMessages']);router[_0x49c4('0xc')]('/',auth[_0x49c4('0x6')](),controller['create']);router[_0x49c4('0xc')](_0x49c4('0xb'),auth['isAuthenticated'](),controller['addMessage']);router[_0x49c4('0xc')](_0x49c4('0xd'),auth['isAuthenticated'](),interaction[_0x49c4('0xe')](_0x49c4('0xf'),'smsinteraction:addtags'),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')](_0x49c4('0x12'),auth[_0x49c4('0x6')](),interaction[_0x49c4('0xe')](_0x49c4('0xf'),_0x49c4('0x13')),controller[_0x49c4('0x14')]);router['delete'](_0x49c4('0x12'),auth[_0x49c4('0x6')](),interaction[_0x49c4('0xe')](_0x49c4('0xf'),_0x49c4('0x15')),controller['destroy']);router[_0x49c4('0x16')](_0x49c4('0xd'),auth['isAuthenticated'](),controller['removeTags']);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xc034=['isAuthenticated','index','describe','show','post','create','/:id/messages','/:id/tags','tracked','smsinteraction:addtags','addTags','put','/:id','sms','update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get'];(function(_0xadc6b0,_0x176639){var _0x25ce76=function(_0x54b799){while(--_0x54b799){_0xadc6b0['push'](_0xadc6b0['shift']());}};_0x25ce76(++_0x176639);}(_0xc034,0x170));var _0x4c03=function(_0x448640,_0x2cdf85){_0x448640=_0x448640-0x0;var _0x9e2cb4=_0xc034[_0x448640];return _0x9e2cb4;};'use strict';var multer=require(_0x4c03('0x0'));var util=require('util');var path=require(_0x4c03('0x1'));var express=require(_0x4c03('0x2'));var router=express[_0x4c03('0x3')]();var auth=require(_0x4c03('0x4'));var interaction=require(_0x4c03('0x5'));var config=require(_0x4c03('0x6'));var controller=require(_0x4c03('0x7'));router[_0x4c03('0x8')]('/',auth[_0x4c03('0x9')](),controller[_0x4c03('0xa')]);router[_0x4c03('0x8')]('/describe',auth[_0x4c03('0x9')](),controller[_0x4c03('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4c03('0xc')]);router[_0x4c03('0x8')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x4c03('0xd')]('/',auth[_0x4c03('0x9')](),controller[_0x4c03('0xe')]);router[_0x4c03('0xd')](_0x4c03('0xf'),auth[_0x4c03('0x9')](),controller['addMessage']);router[_0x4c03('0xd')](_0x4c03('0x10'),auth[_0x4c03('0x9')](),interaction[_0x4c03('0x11')]('sms',_0x4c03('0x12')),controller[_0x4c03('0x13')]);router[_0x4c03('0x14')](_0x4c03('0x15'),auth[_0x4c03('0x9')](),interaction[_0x4c03('0x11')](_0x4c03('0x16'),'smsinteraction:update'),controller[_0x4c03('0x17')]);router['delete'](_0x4c03('0x15'),auth[_0x4c03('0x9')](),interaction[_0x4c03('0x11')]('sms',_0x4c03('0x18')),controller[_0x4c03('0x19')]);router[_0x4c03('0x1a')](_0x4c03('0x10'),auth['isAuthenticated'](),controller[_0x4c03('0x1b')]);module[_0x4c03('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 5b85465..e7966ac 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 _0x591b=['out','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x591b,0x120));var _0xb591=function(_0x2572bc,_0x59e372){_0x2572bc=_0x2572bc-0x0;var _0x4bfa12=_0x591b[_0x2572bc];return _0x4bfa12;};'use strict';var Sequelize=require(_0xb591('0x0'));var moment=require(_0xb591('0x1'));module[_0xb591('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb591('0x3')]},'disposition':{'type':Sequelize[_0xb591('0x4')]},'note':{'type':Sequelize[_0xb591('0x4')]},'phone':{'type':Sequelize[_0xb591('0x4')]},'read1stAt':{'type':Sequelize[_0xb591('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb591('0x5')]('in',_0xb591('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb591('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb591('0x5')]('in',_0xb591('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x513e=['out','DATE','sequelize','exports','STRING','ENUM'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0x513e,0x128));var _0xe513=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x513e[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0xe513('0x0'));var moment=require('moment');module[_0xe513('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe513('0x2')]},'note':{'type':Sequelize[_0xe513('0x2')]},'phone':{'type':Sequelize[_0xe513('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe513('0x3')]('in',_0xe513('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe513('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe513('0x4')),'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 7020c78..19f1ab4 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 _0x32bd=['request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','localhost','./smsInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','index','SmsInteraction','rawAttributes','model','query','dateEnd','dateStart','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','add','day','merge','filter','map','options','tag','include','push','Tag','SmsMessage','Messages','direction','createdAt','read','fullname','Contact','User','Owner','internal','SmsAccount','Account','color','ThroughTags','findAll','catch','show','params','includeAll','body','find','destroy','describe','ids','omit','findOne','nolimit','SmsInteractionId','$gte','format','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags'];(function(_0x4e4bf5,_0xfaffdf){var _0x529e0f=function(_0x28b161){while(--_0x28b161){_0x4e4bf5['push'](_0x4e4bf5['shift']());}};_0x529e0f(++_0xfaffdf);}(_0x32bd,0xc6));var _0xd32b=function(_0x227148,_0x2af92d){_0x227148=_0x227148-0x0;var _0x3be280=_0x32bd[_0x227148];return _0x3be280;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xd32b('0x0'));var moment=require(_0xd32b('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd32b('0x2'));var util=require(_0xd32b('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xd32b('0x4'));var ejs=require(_0xd32b('0x5'));var fs=require('fs');var _=require(_0xd32b('0x6'));var squel=require(_0xd32b('0x7'));var crypto=require(_0xd32b('0x8'));var jsforce=require(_0xd32b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd32b('0x4'));var querystring=require(_0xd32b('0xa'));var Papa=require(_0xd32b('0xb'));var qs=require(_0xd32b('0xc'));var logger=require('../../config/logger')(_0xd32b('0xd'));var utils=require(_0xd32b('0xe'));var config=require(_0xd32b('0xf'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':_0xd32b('0x10'),'port':0x18eb});require(_0xd32b('0x11'))[_0xd32b('0x12')](socket);function respondWithStatusCode(_0x3ccdd4,_0x1b8219){_0x1b8219=_0x1b8219||0xcc;return function(_0x2e2942){if(_0x2e2942){return _0x3ccdd4[_0xd32b('0x13')](_0x1b8219);}return _0x3ccdd4['status'](_0x1b8219)['end']();};}function respondWithResult(_0x443085,_0x113e8a){_0x113e8a=_0x113e8a||0xc8;return function(_0x1c1303){if(_0x1c1303){return _0x443085[_0xd32b('0x14')](_0x113e8a)[_0xd32b('0x15')](_0x1c1303);}};}function respondWithFilteredResult(_0xe02205,_0x83f45b){return function(_0x4a73ca){if(_0x4a73ca){var _0x34b387=_0x4a73ca[_0xd32b('0x16')],_0x5d7b3e=_0x83f45b[_0xd32b('0x17')],_0x358be2=_0x83f45b[_0xd32b('0x17')]+_0x83f45b[_0xd32b('0x18')],_0x52a691;if(_0x358be2>=_0x34b387){_0x358be2=_0x34b387;_0x52a691=0xc8;}else{_0x52a691=0xce;}_0xe02205['status'](_0x52a691);return _0xe02205[_0xd32b('0x19')](_0xd32b('0x1a'),_0x5d7b3e+'-'+_0x358be2+'/'+_0x34b387)[_0xd32b('0x15')](_0x4a73ca);}return null;};}function patchUpdates(_0xccce4f){return function(_0x182a12){try{jsonpatch['apply'](_0x182a12,_0xccce4f,!![]);}catch(_0x3d09cb){return BPromise[_0xd32b('0x1b')](_0x3d09cb);}return _0x182a12[_0xd32b('0x1c')]();};}function saveUpdates(_0x2f2f99,_0x23b065){return function(_0x3caacd){if(_0x3caacd){return _0x3caacd[_0xd32b('0x1d')](_0x2f2f99)['then'](function(_0x1b6d85){return _0x1b6d85;});}return null;};}function removeEntity(_0x4da0e4,_0x5a3a46){return function(_0x2e5ce){if(_0x2e5ce){return _0x2e5ce['destroy']()[_0xd32b('0x1e')](function(){_0x4da0e4['status'](0xcc)[_0xd32b('0x1f')]();});}};}function handleEntityNotFound(_0x40be82,_0x3bfd2f){return function(_0xe2ba73){if(!_0xe2ba73){_0x40be82[_0xd32b('0x13')](0x194);}return _0xe2ba73;};}function handleError(_0x3f72d9,_0x34e7d7){_0x34e7d7=_0x34e7d7||0x1f4;return function(_0x2ccc2a){logger[_0xd32b('0x20')](_0x2ccc2a[_0xd32b('0x21')]);if(_0x2ccc2a[_0xd32b('0x22')]){delete _0x2ccc2a[_0xd32b('0x22')];}_0x3f72d9[_0xd32b('0x14')](_0x34e7d7)['send'](_0x2ccc2a);};}exports[_0xd32b('0x23')]=function(_0x321509,_0x220b45){var _0x2feb4e={},_0x3f2b10={},_0x9d40f={'count':0x0,'rows':[]};var _0x2cdf4e=db[_0xd32b('0x24')][_0xd32b('0x25')];_0x3f2b10[_0xd32b('0x26')]=_['keys'](_0x2cdf4e);var _0xa2874c={'dateStart':_0x321509[_0xd32b('0x27')]['dateStart'],'dateEnd':_0x321509[_0xd32b('0x27')][_0xd32b('0x28')]};delete _0x321509[_0xd32b('0x27')][_0xd32b('0x29')];delete _0x321509['query'][_0xd32b('0x28')];_0x3f2b10[_0xd32b('0x27')]=_[_0xd32b('0x2a')](_0x321509[_0xd32b('0x27')]);_0x3f2b10[_0xd32b('0x2b')]=_['intersection'](_0x3f2b10[_0xd32b('0x26')],_0x3f2b10['query']);_0x2feb4e[_0xd32b('0x2c')]=_[_0xd32b('0x2d')](_0x3f2b10['model'],qs[_0xd32b('0x2e')](_0x321509[_0xd32b('0x27')][_0xd32b('0x2e')]));_0x2feb4e[_0xd32b('0x2c')]=_0x2feb4e['attributes'][_0xd32b('0x2f')]?_0x2feb4e[_0xd32b('0x2c')]:_0x3f2b10['model'];if(!_0x321509[_0xd32b('0x27')][_0xd32b('0x30')]('nolimit')){_0x2feb4e[_0xd32b('0x18')]=qs[_0xd32b('0x18')](_0x321509['query'][_0xd32b('0x18')]);_0x2feb4e[_0xd32b('0x17')]=qs['offset'](_0x321509[_0xd32b('0x27')][_0xd32b('0x17')]);}_0x2feb4e['order']=qs[_0xd32b('0x31')](_0x321509[_0xd32b('0x27')][_0xd32b('0x31')]);_0x2feb4e[_0xd32b('0x32')]=qs['filters'](_[_0xd32b('0x33')](_0x321509[_0xd32b('0x27')],_0x3f2b10[_0xd32b('0x2b')]));if(_0xa2874c[_0xd32b('0x29')]){if(_0xa2874c['dateEnd']){_0xa2874c[_0xd32b('0x28')]=moment(_0xa2874c[_0xd32b('0x28')])[_0xd32b('0x34')](0x1,'day');}else{_0xa2874c[_0xd32b('0x28')]=moment(_0xa2874c[_0xd32b('0x29')])[_0xd32b('0x34')](0x1,_0xd32b('0x35'));}_[_0xd32b('0x36')](_0x2feb4e[_0xd32b('0x32')],{'createdAt':{'$gte':_0xa2874c[_0xd32b('0x29')],'$lte':_0xa2874c['dateEnd']}});}if(_0x321509['query'][_0xd32b('0x37')]){_0x2feb4e[_0xd32b('0x32')]=_['merge'](_0x2feb4e[_0xd32b('0x32')],{'$or':_[_0xd32b('0x38')](_0x2feb4e[_0xd32b('0x2c')],function(_0xb38c6){var _0x56ba3d={};_0x56ba3d[_0xb38c6]={'$like':'%'+_0x321509['query'][_0xd32b('0x37')]+'%'};return _0x56ba3d;})});}_0x2feb4e=_[_0xd32b('0x36')]({},_0x2feb4e,_0x321509[_0xd32b('0x39')]);var _0x436866={'where':_0x2feb4e[_0xd32b('0x32')]};_0x436866['include']=[];if(_0x321509[_0xd32b('0x27')][_0xd32b('0x3a')]){_0x436866[_0xd32b('0x3b')][_0xd32b('0x3c')]({'model':db[_0xd32b('0x3d')],'as':'Tags','attributes':['id'],'where':{'id':_0x321509[_0xd32b('0x27')][_0xd32b('0x3a')]},'required':!![]});_0x436866['distinct']=!![];}if(_0x321509[_0xd32b('0x27')]['read']){_0x436866['include'][_0xd32b('0x3c')]({'model':db[_0xd32b('0x3e')],'as':_0xd32b('0x3f'),'attributes':['id',_0xd32b('0x40'),_0xd32b('0x41'),_0xd32b('0x42')],'where':{'direction':'in','read':_0x321509[_0xd32b('0x27')]['read']||![]},'required':!![]});_0x436866['distinct']=!![];}return db[_0xd32b('0x24')][_0xd32b('0x16')](_0x436866)[_0xd32b('0x1e')](function(_0x3162cb){_0x9d40f[_0xd32b('0x16')]=_0x3162cb;if(_0x321509['query']['includeAll']){_0x2feb4e[_0xd32b('0x3b')]=[{'model':db['User'],'as':'Users','required':![],'attributes':['id',_0xd32b('0x22'),_0xd32b('0x43')]},{'model':db['CmContact'],'as':_0xd32b('0x44'),'required':![]},{'model':db[_0xd32b('0x45')],'as':_0xd32b('0x46'),'attributes':[_0xd32b('0x22'),_0xd32b('0x43'),_0xd32b('0x47')],'required':![]},{'model':db[_0xd32b('0x48')],'as':_0xd32b('0x49'),'attributes':[_0xd32b('0x22'),'key'],'required':![]},{'model':db[_0xd32b('0x3e')],'as':_0xd32b('0x3f'),'attributes':['id','direction',_0xd32b('0x41'),_0xd32b('0x42')],'where':{'direction':'in','read':_0x321509[_0xd32b('0x27')][_0xd32b('0x42')]||![]},'required':_0x321509['query'][_0xd32b('0x42')]||![]},{'model':db[_0xd32b('0x3d')],'as':'Tags','attributes':['id',_0xd32b('0x22'),_0xd32b('0x4a')],'required':_0x321509[_0xd32b('0x27')][_0xd32b('0x3a')]?!![]:![]},{'model':db[_0xd32b('0x3d')],'as':_0xd32b('0x4b'),'attributes':['id',_0xd32b('0x22'),_0xd32b('0x4a')],'through':_0x321509[_0xd32b('0x27')][_0xd32b('0x3a')]?{'attributes':[],'where':{'TagId':_0x321509['query'][_0xd32b('0x3a')]||undefined}}:{},'required':_0x321509[_0xd32b('0x27')][_0xd32b('0x3a')]?!![]:![]}];}return db[_0xd32b('0x24')][_0xd32b('0x4c')](_0x2feb4e);})[_0xd32b('0x1e')](function(_0x3e545d){_0x9d40f['rows']=_0x3e545d;return _0x9d40f;})['then'](respondWithFilteredResult(_0x220b45,_0x2feb4e))[_0xd32b('0x4d')](handleError(_0x220b45,null));};exports[_0xd32b('0x4e')]=function(_0x40027f,_0x336702){var _0xbd98ed={'raw':![],'where':{'id':_0x40027f[_0xd32b('0x4f')]['id']}},_0x315b56={};_0x315b56[_0xd32b('0x26')]=_[_0xd32b('0x2a')](db['SmsInteraction'][_0xd32b('0x25')]);_0x315b56[_0xd32b('0x27')]=_['keys'](_0x40027f[_0xd32b('0x27')]);_0x315b56['filters']=_['intersection'](_0x315b56[_0xd32b('0x26')],_0x315b56[_0xd32b('0x27')]);_0xbd98ed['attributes']=_[_0xd32b('0x2d')](_0x315b56[_0xd32b('0x26')],qs[_0xd32b('0x2e')](_0x40027f[_0xd32b('0x27')][_0xd32b('0x2e')]));_0xbd98ed[_0xd32b('0x2c')]=_0xbd98ed['attributes'][_0xd32b('0x2f')]?_0xbd98ed['attributes']:_0x315b56['model'];if(_0x40027f[_0xd32b('0x27')][_0xd32b('0x50')]){_0xbd98ed[_0xd32b('0x3b')]=[{'all':!![]}];}_0xbd98ed=_[_0xd32b('0x36')]({},_0xbd98ed,_0x40027f['options']);return db[_0xd32b('0x24')]['find'](_0xbd98ed)[_0xd32b('0x1e')](handleEntityNotFound(_0x336702,null))[_0xd32b('0x1e')](respondWithResult(_0x336702,null))[_0xd32b('0x4d')](handleError(_0x336702,null));};exports['create']=function(_0x518953,_0x59a2a2){return db[_0xd32b('0x24')]['create'](_0x518953[_0xd32b('0x51')],{})[_0xd32b('0x1e')](respondWithResult(_0x59a2a2,0xc9))[_0xd32b('0x4d')](handleError(_0x59a2a2,null));};exports[_0xd32b('0x1d')]=function(_0x1ada6b,_0x1b07c7){if(_0x1ada6b[_0xd32b('0x51')]['id']){delete _0x1ada6b[_0xd32b('0x51')]['id'];}return db['SmsInteraction'][_0xd32b('0x52')]({'where':{'id':_0x1ada6b[_0xd32b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1b07c7,null))[_0xd32b('0x1e')](saveUpdates(_0x1ada6b[_0xd32b('0x51')],null))[_0xd32b('0x1e')](respondWithResult(_0x1b07c7,null))[_0xd32b('0x4d')](handleError(_0x1b07c7,null));};exports[_0xd32b('0x53')]=function(_0x11094a,_0x3c6d04){return db[_0xd32b('0x24')]['find']({'where':{'id':_0x11094a[_0xd32b('0x4f')]['id']}})[_0xd32b('0x1e')](handleEntityNotFound(_0x3c6d04,null))[_0xd32b('0x1e')](removeEntity(_0x3c6d04,null))[_0xd32b('0x4d')](handleError(_0x3c6d04,null));};exports[_0xd32b('0x54')]=function(_0x4b1f0b,_0x2c9b95){return db['SmsInteraction'][_0xd32b('0x54')]()['then'](respondWithResult(_0x2c9b95,null))[_0xd32b('0x4d')](handleError(_0x2c9b95,null));};exports['addMessage']=function(_0x567db6,_0x35d010,_0x87c90e){return db[_0xd32b('0x3e')][_0xd32b('0x52')]({'where':{'id':_0x567db6['params']['id']}})['then'](handleEntityNotFound(_0x35d010,null))[_0xd32b('0x1e')](function(_0x2954e5){if(_0x2954e5){return _0x2954e5['addMessage'](_0x567db6['body'][_0xd32b('0x55')],_[_0xd32b('0x56')](_0x567db6[_0xd32b('0x51')],[_0xd32b('0x55'),'id'])||{});}})[_0xd32b('0x1e')](respondWithResult(_0x35d010,null))[_0xd32b('0x4d')](handleError(_0x35d010,null));};exports['getMessages']=function(_0x3b962f,_0x333e08,_0x137e1e){var _0x1904fc={'raw':![],'where':{}};var _0x239066={};var _0x5f0695={'count':0x0,'rows':[]};return db[_0xd32b('0x24')][_0xd32b('0x57')]({'where':{'id':_0x3b962f[_0xd32b('0x4f')]['id']}})[_0xd32b('0x1e')](handleEntityNotFound(_0x333e08,null))['then'](function(_0x339dad){if(_0x339dad){_0x239066[_0xd32b('0x26')]=_['keys'](db[_0xd32b('0x3e')][_0xd32b('0x25')]);_0x239066['query']=_[_0xd32b('0x2a')](_0x3b962f[_0xd32b('0x27')]);_0x239066[_0xd32b('0x2b')]=_[_0xd32b('0x2d')](_0x239066['model'],_0x239066[_0xd32b('0x27')]);_0x1904fc[_0xd32b('0x2c')]=_[_0xd32b('0x2d')](_0x239066[_0xd32b('0x26')],qs[_0xd32b('0x2e')](_0x3b962f[_0xd32b('0x27')][_0xd32b('0x2e')]));_0x1904fc[_0xd32b('0x2c')]=_0x1904fc['attributes'][_0xd32b('0x2f')]?_0x1904fc[_0xd32b('0x2c')]:_0x239066[_0xd32b('0x26')];if(!_0x3b962f[_0xd32b('0x27')][_0xd32b('0x30')](_0xd32b('0x58'))){_0x1904fc[_0xd32b('0x18')]=qs['limit'](_0x3b962f[_0xd32b('0x27')][_0xd32b('0x18')]);_0x1904fc[_0xd32b('0x17')]=qs[_0xd32b('0x17')](_0x3b962f[_0xd32b('0x27')]['offset']);}_0x1904fc['order']=qs[_0xd32b('0x31')](_0x3b962f[_0xd32b('0x27')][_0xd32b('0x31')]);_0x1904fc['where']=qs[_0xd32b('0x2b')](_[_0xd32b('0x33')](_0x3b962f['query'],_0x239066[_0xd32b('0x2b')]));_0x1904fc[_0xd32b('0x32')][_0xd32b('0x59')]=_0x339dad['id'];if(_0x3b962f['query'][_0xd32b('0x37')]){_0x1904fc['where']=_[_0xd32b('0x36')](_0x1904fc['where'],{'$or':_[_0xd32b('0x38')](_0x1904fc[_0xd32b('0x2c')],function(_0x401589){var _0x3cbf6c={};_0x3cbf6c[_0x401589]={'$like':'%'+_0x3b962f[_0xd32b('0x27')][_0xd32b('0x37')]+'%'};return _0x3cbf6c;})});}if(_0x3b962f['query'][_0xd32b('0x5a')]){var _0x4a143d=_0x3b962f[_0xd32b('0x27')][_0xd32b('0x5a')]['split'](',');var _0x68bd1e={};_0x68bd1e[_0x4a143d[0x0]]={'$gte':moment(_0x4a143d[0x1])[_0xd32b('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1904fc['where']=_[_0xd32b('0x36')](_0x1904fc[_0xd32b('0x32')],_0x68bd1e);}_0x1904fc=_[_0xd32b('0x36')]({},_0x1904fc,_0x3b962f[_0xd32b('0x39')]);return db[_0xd32b('0x3e')][_0xd32b('0x16')]({'where':_0x1904fc[_0xd32b('0x32')]})[_0xd32b('0x1e')](function(_0x2a4f01){_0x5f0695[_0xd32b('0x16')]=_0x2a4f01;if(_0x3b962f[_0xd32b('0x27')]['includeAll']){_0x1904fc['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x1904fc);})[_0xd32b('0x1e')](function(_0x13ae7d){_0x5f0695[_0xd32b('0x5c')]=_0x13ae7d;return _0x5f0695;});}})[_0xd32b('0x1e')](respondWithFilteredResult(_0x333e08,_0x1904fc))[_0xd32b('0x4d')](handleError(_0x333e08,null));};exports[_0xd32b('0x5d')]=function(_0x15b28b,_0x555a87,_0x3ec6e8){return db[_0xd32b('0x24')]['find']({'where':{'id':_0x15b28b[_0xd32b('0x4f')]['id']}})[_0xd32b('0x1e')](handleEntityNotFound(_0x555a87,null))[_0xd32b('0x1e')](function(_0x37ffc5){if(_0x37ffc5){return _0x37ffc5[_0xd32b('0x5e')](_0x15b28b[_0xd32b('0x51')]['ids'],_[_0xd32b('0x56')](_0x15b28b[_0xd32b('0x51')],[_0xd32b('0x55'),'id'])||{})[_0xd32b('0x5f')](function(){return db[_0xd32b('0x3d')][_0xd32b('0x4c')]({'attributes':['id','name','color'],'where':{'id':_0x15b28b['body'][_0xd32b('0x55')]}});})[_0xd32b('0x1e')](function(_0x4a5442){socket[_0xd32b('0x60')](_0xd32b('0x61'),{'id':Number(_0x15b28b[_0xd32b('0x4f')]['id']),'tags':_0x4a5442||[]});return{'id':Number(_0x15b28b[_0xd32b('0x4f')]['id']),'tags':_0x4a5442||[]};});}})[_0xd32b('0x1e')](respondWithResult(_0x555a87,null))[_0xd32b('0x4d')](handleError(_0x555a87,null));};exports[_0xd32b('0x62')]=function(_0x3ad13e,_0xb311a4,_0x554986){var _0x25ebbf;return db[_0xd32b('0x24')][_0xd32b('0x52')]({'where':{'id':_0x3ad13e['params']['id']}})['then'](handleEntityNotFound(_0xb311a4,null))[_0xd32b('0x1e')](function(_0x2bf3b4){if(_0x2bf3b4){return _0x2bf3b4['removeTags'](_0x3ad13e[_0xd32b('0x27')][_0xd32b('0x55')]);}})[_0xd32b('0x1e')](respondWithStatusCode(_0xb311a4,null))[_0xd32b('0x4d')](handleError(_0xb311a4,null));}; \ No newline at end of file +var _0xa4e4=['papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./smsInteraction.socket','register','status','end','json','count','offset','set','Content-Range','reject','update','then','destroy','sendStatus','stack','name','index','rawAttributes','keys','query','dateStart','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','dateEnd','add','day','merge','where','filter','map','options','tag','include','push','Tag','Tags','distinct','read','SmsMessage','Messages','direction','SmsInteraction','Users','fullname','CmContact','Contact','User','internal','SmsAccount','Account','key','color','ThroughTags','findAll','catch','params','find','create','body','describe','addMessage','ids','getMessages','findOne','SmsInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','fast-json-patch','mustache','util','path','sox','lodash','squel','jsforce','desk.js','querystring'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa4e4,0x12e));var _0x4a4e=function(_0x564bec,_0x4e98e2){_0x564bec=_0x564bec-0x0;var _0x8dc0f7=_0xa4e4[_0x564bec];return _0x8dc0f7;};'use strict';var jsonpatch=require(_0x4a4e('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4a4e('0x1'));var util=require(_0x4a4e('0x2'));var path=require(_0x4a4e('0x3'));var sox=require(_0x4a4e('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a4e('0x5'));var squel=require(_0x4a4e('0x6'));var crypto=require('crypto');var jsforce=require(_0x4a4e('0x7'));var deskjs=require(_0x4a4e('0x8'));var toCsv=require('to-csv');var querystring=require(_0x4a4e('0x9'));var Papa=require(_0x4a4e('0xa'));var qs=require(_0x4a4e('0xb'));var logger=require('../../config/logger')(_0x4a4e('0xc'));var utils=require(_0x4a4e('0xd'));var config=require('../../config/environment');var db=require(_0x4a4e('0xe'))['db'];var socket=require(_0x4a4e('0xf'))({'host':_0x4a4e('0x10'),'port':0x18eb});require(_0x4a4e('0x11'))[_0x4a4e('0x12')](socket);function respondWithStatusCode(_0x414d34,_0x179120){_0x179120=_0x179120||0xcc;return function(_0x3c775a){if(_0x3c775a){return _0x414d34['sendStatus'](_0x179120);}return _0x414d34[_0x4a4e('0x13')](_0x179120)[_0x4a4e('0x14')]();};}function respondWithResult(_0x5c47de,_0x376a30){_0x376a30=_0x376a30||0xc8;return function(_0x4d8788){if(_0x4d8788){return _0x5c47de[_0x4a4e('0x13')](_0x376a30)[_0x4a4e('0x15')](_0x4d8788);}};}function respondWithFilteredResult(_0x21a27a,_0x1c9bf1){return function(_0x5e0e2b){if(_0x5e0e2b){var _0x580e30=_0x5e0e2b[_0x4a4e('0x16')],_0x55804b=_0x1c9bf1['offset'],_0x20a8bc=_0x1c9bf1[_0x4a4e('0x17')]+_0x1c9bf1['limit'],_0x195ad8;if(_0x20a8bc>=_0x580e30){_0x20a8bc=_0x580e30;_0x195ad8=0xc8;}else{_0x195ad8=0xce;}_0x21a27a[_0x4a4e('0x13')](_0x195ad8);return _0x21a27a[_0x4a4e('0x18')](_0x4a4e('0x19'),_0x55804b+'-'+_0x20a8bc+'/'+_0x580e30)[_0x4a4e('0x15')](_0x5e0e2b);}return null;};}function patchUpdates(_0x5d2ce9){return function(_0x5a3bbf){try{jsonpatch['apply'](_0x5a3bbf,_0x5d2ce9,!![]);}catch(_0x4494df){return BPromise[_0x4a4e('0x1a')](_0x4494df);}return _0x5a3bbf['save']();};}function saveUpdates(_0x265eb4,_0x2119d9){return function(_0x4ddfe7){if(_0x4ddfe7){return _0x4ddfe7[_0x4a4e('0x1b')](_0x265eb4)[_0x4a4e('0x1c')](function(_0x11a737){return _0x11a737;});}return null;};}function removeEntity(_0x1446e9,_0x5dc35a){return function(_0x32cbab){if(_0x32cbab){return _0x32cbab[_0x4a4e('0x1d')]()[_0x4a4e('0x1c')](function(){_0x1446e9[_0x4a4e('0x13')](0xcc)[_0x4a4e('0x14')]();});}};}function handleEntityNotFound(_0x2c34d4,_0x406a21){return function(_0x50e50f){if(!_0x50e50f){_0x2c34d4[_0x4a4e('0x1e')](0x194);}return _0x50e50f;};}function handleError(_0x384ca1,_0x355c3f){_0x355c3f=_0x355c3f||0x1f4;return function(_0x2b6378){logger['error'](_0x2b6378[_0x4a4e('0x1f')]);if(_0x2b6378[_0x4a4e('0x20')]){delete _0x2b6378[_0x4a4e('0x20')];}_0x384ca1[_0x4a4e('0x13')](_0x355c3f)['send'](_0x2b6378);};}exports[_0x4a4e('0x21')]=function(_0x4f06b5,_0xca6bad){var _0x3af55f={},_0x2b4c4b={},_0x42934d={'count':0x0,'rows':[]};var _0x137989=db['SmsInteraction'][_0x4a4e('0x22')];_0x2b4c4b['model']=_[_0x4a4e('0x23')](_0x137989);var _0x5c5029={'dateStart':_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x25')],'dateEnd':_0x4f06b5['query']['dateEnd']};delete _0x4f06b5['query'][_0x4a4e('0x25')];delete _0x4f06b5[_0x4a4e('0x24')]['dateEnd'];_0x2b4c4b[_0x4a4e('0x24')]=_[_0x4a4e('0x23')](_0x4f06b5[_0x4a4e('0x24')]);_0x2b4c4b[_0x4a4e('0x26')]=_[_0x4a4e('0x27')](_0x2b4c4b[_0x4a4e('0x28')],_0x2b4c4b[_0x4a4e('0x24')]);_0x3af55f[_0x4a4e('0x29')]=_['intersection'](_0x2b4c4b['model'],qs[_0x4a4e('0x2a')](_0x4f06b5['query'][_0x4a4e('0x2a')]));_0x3af55f[_0x4a4e('0x29')]=_0x3af55f[_0x4a4e('0x29')][_0x4a4e('0x2b')]?_0x3af55f[_0x4a4e('0x29')]:_0x2b4c4b['model'];if(!_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x2c')](_0x4a4e('0x2d'))){_0x3af55f[_0x4a4e('0x2e')]=qs['limit'](_0x4f06b5['query'][_0x4a4e('0x2e')]);_0x3af55f['offset']=qs['offset'](_0x4f06b5[_0x4a4e('0x24')]['offset']);}_0x3af55f[_0x4a4e('0x2f')]=qs[_0x4a4e('0x30')](_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x30')]);_0x3af55f['where']=qs[_0x4a4e('0x26')](_[_0x4a4e('0x31')](_0x4f06b5[_0x4a4e('0x24')],_0x2b4c4b[_0x4a4e('0x26')]));if(_0x5c5029[_0x4a4e('0x25')]){if(_0x5c5029[_0x4a4e('0x32')]){_0x5c5029[_0x4a4e('0x32')]=moment(_0x5c5029['dateEnd'])[_0x4a4e('0x33')](0x1,_0x4a4e('0x34'));}else{_0x5c5029[_0x4a4e('0x32')]=moment(_0x5c5029['dateStart'])[_0x4a4e('0x33')](0x1,_0x4a4e('0x34'));}_[_0x4a4e('0x35')](_0x3af55f[_0x4a4e('0x36')],{'createdAt':{'$gte':_0x5c5029[_0x4a4e('0x25')],'$lte':_0x5c5029['dateEnd']}});}if(_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x37')]){_0x3af55f[_0x4a4e('0x36')]=_[_0x4a4e('0x35')](_0x3af55f[_0x4a4e('0x36')],{'$or':_[_0x4a4e('0x38')](_0x3af55f[_0x4a4e('0x29')],function(_0xc6d27f){var _0x5a78f3={};_0x5a78f3[_0xc6d27f]={'$like':'%'+_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x37')]+'%'};return _0x5a78f3;})});}_0x3af55f=_['merge']({},_0x3af55f,_0x4f06b5[_0x4a4e('0x39')]);var _0x2afba7={'where':_0x3af55f[_0x4a4e('0x36')]};_0x2afba7['include']=[];if(_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x3a')]){_0x2afba7[_0x4a4e('0x3b')][_0x4a4e('0x3c')]({'model':db[_0x4a4e('0x3d')],'as':_0x4a4e('0x3e'),'attributes':['id'],'where':{'id':_0x4f06b5['query'][_0x4a4e('0x3a')]},'required':!![]});_0x2afba7[_0x4a4e('0x3f')]=!![];}if(_0x4f06b5['query'][_0x4a4e('0x40')]){_0x2afba7[_0x4a4e('0x3b')][_0x4a4e('0x3c')]({'model':db[_0x4a4e('0x41')],'as':_0x4a4e('0x42'),'attributes':['id',_0x4a4e('0x43'),'createdAt','read'],'where':{'direction':'in','read':_0x4f06b5[_0x4a4e('0x24')]['read']||![]},'required':!![]});_0x2afba7[_0x4a4e('0x3f')]=!![];}return db[_0x4a4e('0x44')]['count'](_0x2afba7)[_0x4a4e('0x1c')](function(_0x1e2441){_0x42934d['count']=_0x1e2441;if(_0x4f06b5[_0x4a4e('0x24')]['includeAll']){_0x3af55f[_0x4a4e('0x3b')]=[{'model':db['User'],'as':_0x4a4e('0x45'),'required':![],'attributes':['id',_0x4a4e('0x20'),_0x4a4e('0x46')]},{'model':db[_0x4a4e('0x47')],'as':_0x4a4e('0x48'),'required':![]},{'model':db[_0x4a4e('0x49')],'as':'Owner','attributes':[_0x4a4e('0x20'),'fullname',_0x4a4e('0x4a')],'required':![]},{'model':db[_0x4a4e('0x4b')],'as':_0x4a4e('0x4c'),'attributes':[_0x4a4e('0x20'),_0x4a4e('0x4d')],'required':![]},{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x4a4e('0x43'),'createdAt','read'],'where':{'direction':'in','read':_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x40')]||![]},'required':_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x40')]||![]},{'model':db[_0x4a4e('0x3d')],'as':'Tags','attributes':['id',_0x4a4e('0x20'),_0x4a4e('0x4e')],'required':_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x3a')]?!![]:![]},{'model':db[_0x4a4e('0x3d')],'as':_0x4a4e('0x4f'),'attributes':['id','name',_0x4a4e('0x4e')],'through':_0x4f06b5['query'][_0x4a4e('0x3a')]?{'attributes':[],'where':{'TagId':_0x4f06b5[_0x4a4e('0x24')]['tag']||undefined}}:{},'required':_0x4f06b5[_0x4a4e('0x24')][_0x4a4e('0x3a')]?!![]:![]}];}return db[_0x4a4e('0x44')][_0x4a4e('0x50')](_0x3af55f);})[_0x4a4e('0x1c')](function(_0x6ca4de){_0x42934d['rows']=_0x6ca4de;return _0x42934d;})['then'](respondWithFilteredResult(_0xca6bad,_0x3af55f))[_0x4a4e('0x51')](handleError(_0xca6bad,null));};exports['show']=function(_0x2ddd0f,_0x49a079){var _0x13e953={'raw':![],'where':{'id':_0x2ddd0f[_0x4a4e('0x52')]['id']}},_0x4a6981={};_0x4a6981['model']=_['keys'](db[_0x4a4e('0x44')][_0x4a4e('0x22')]);_0x4a6981[_0x4a4e('0x24')]=_[_0x4a4e('0x23')](_0x2ddd0f['query']);_0x4a6981[_0x4a4e('0x26')]=_[_0x4a4e('0x27')](_0x4a6981['model'],_0x4a6981[_0x4a4e('0x24')]);_0x13e953['attributes']=_[_0x4a4e('0x27')](_0x4a6981[_0x4a4e('0x28')],qs['fields'](_0x2ddd0f[_0x4a4e('0x24')][_0x4a4e('0x2a')]));_0x13e953[_0x4a4e('0x29')]=_0x13e953[_0x4a4e('0x29')][_0x4a4e('0x2b')]?_0x13e953[_0x4a4e('0x29')]:_0x4a6981[_0x4a4e('0x28')];if(_0x2ddd0f[_0x4a4e('0x24')]['includeAll']){_0x13e953[_0x4a4e('0x3b')]=[{'all':!![]}];}_0x13e953=_[_0x4a4e('0x35')]({},_0x13e953,_0x2ddd0f['options']);return db[_0x4a4e('0x44')][_0x4a4e('0x53')](_0x13e953)[_0x4a4e('0x1c')](handleEntityNotFound(_0x49a079,null))[_0x4a4e('0x1c')](respondWithResult(_0x49a079,null))['catch'](handleError(_0x49a079,null));};exports[_0x4a4e('0x54')]=function(_0x26b212,_0x14a7e9){return db[_0x4a4e('0x44')][_0x4a4e('0x54')](_0x26b212[_0x4a4e('0x55')],{})[_0x4a4e('0x1c')](respondWithResult(_0x14a7e9,0xc9))[_0x4a4e('0x51')](handleError(_0x14a7e9,null));};exports[_0x4a4e('0x1b')]=function(_0x2cae6f,_0x292eb6){if(_0x2cae6f[_0x4a4e('0x55')]['id']){delete _0x2cae6f[_0x4a4e('0x55')]['id'];}return db[_0x4a4e('0x44')]['find']({'where':{'id':_0x2cae6f[_0x4a4e('0x52')]['id']}})[_0x4a4e('0x1c')](handleEntityNotFound(_0x292eb6,null))[_0x4a4e('0x1c')](saveUpdates(_0x2cae6f[_0x4a4e('0x55')],null))[_0x4a4e('0x1c')](respondWithResult(_0x292eb6,null))[_0x4a4e('0x51')](handleError(_0x292eb6,null));};exports[_0x4a4e('0x1d')]=function(_0xde6f78,_0x3f9bff){return db[_0x4a4e('0x44')][_0x4a4e('0x53')]({'where':{'id':_0xde6f78[_0x4a4e('0x52')]['id']}})['then'](handleEntityNotFound(_0x3f9bff,null))[_0x4a4e('0x1c')](removeEntity(_0x3f9bff,null))[_0x4a4e('0x51')](handleError(_0x3f9bff,null));};exports[_0x4a4e('0x56')]=function(_0x2fad34,_0x259e2f){return db[_0x4a4e('0x44')][_0x4a4e('0x56')]()[_0x4a4e('0x1c')](respondWithResult(_0x259e2f,null))['catch'](handleError(_0x259e2f,null));};exports[_0x4a4e('0x57')]=function(_0x821f4,_0x35d2ca,_0x136c45){return db['SmsMessage'][_0x4a4e('0x53')]({'where':{'id':_0x821f4[_0x4a4e('0x52')]['id']}})['then'](handleEntityNotFound(_0x35d2ca,null))[_0x4a4e('0x1c')](function(_0xe71821){if(_0xe71821){return _0xe71821['addMessage'](_0x821f4['body'][_0x4a4e('0x58')],_['omit'](_0x821f4[_0x4a4e('0x55')],[_0x4a4e('0x58'),'id'])||{});}})['then'](respondWithResult(_0x35d2ca,null))[_0x4a4e('0x51')](handleError(_0x35d2ca,null));};exports[_0x4a4e('0x59')]=function(_0x2427a2,_0x8316ab,_0x190548){var _0x3c56b3={'raw':![],'where':{}};var _0x23039d={};var _0x15dee5={'count':0x0,'rows':[]};return db[_0x4a4e('0x44')][_0x4a4e('0x5a')]({'where':{'id':_0x2427a2[_0x4a4e('0x52')]['id']}})[_0x4a4e('0x1c')](handleEntityNotFound(_0x8316ab,null))[_0x4a4e('0x1c')](function(_0x47552f){if(_0x47552f){_0x23039d[_0x4a4e('0x28')]=_['keys'](db['SmsMessage'][_0x4a4e('0x22')]);_0x23039d['query']=_[_0x4a4e('0x23')](_0x2427a2[_0x4a4e('0x24')]);_0x23039d[_0x4a4e('0x26')]=_[_0x4a4e('0x27')](_0x23039d[_0x4a4e('0x28')],_0x23039d['query']);_0x3c56b3[_0x4a4e('0x29')]=_[_0x4a4e('0x27')](_0x23039d['model'],qs[_0x4a4e('0x2a')](_0x2427a2[_0x4a4e('0x24')][_0x4a4e('0x2a')]));_0x3c56b3[_0x4a4e('0x29')]=_0x3c56b3['attributes'][_0x4a4e('0x2b')]?_0x3c56b3[_0x4a4e('0x29')]:_0x23039d[_0x4a4e('0x28')];if(!_0x2427a2[_0x4a4e('0x24')][_0x4a4e('0x2c')](_0x4a4e('0x2d'))){_0x3c56b3['limit']=qs[_0x4a4e('0x2e')](_0x2427a2[_0x4a4e('0x24')]['limit']);_0x3c56b3[_0x4a4e('0x17')]=qs[_0x4a4e('0x17')](_0x2427a2[_0x4a4e('0x24')]['offset']);}_0x3c56b3[_0x4a4e('0x2f')]=qs[_0x4a4e('0x30')](_0x2427a2[_0x4a4e('0x24')][_0x4a4e('0x30')]);_0x3c56b3[_0x4a4e('0x36')]=qs[_0x4a4e('0x26')](_['pick'](_0x2427a2[_0x4a4e('0x24')],_0x23039d[_0x4a4e('0x26')]));_0x3c56b3[_0x4a4e('0x36')][_0x4a4e('0x5b')]=_0x47552f['id'];if(_0x2427a2['query'][_0x4a4e('0x37')]){_0x3c56b3[_0x4a4e('0x36')]=_[_0x4a4e('0x35')](_0x3c56b3[_0x4a4e('0x36')],{'$or':_[_0x4a4e('0x38')](_0x3c56b3[_0x4a4e('0x29')],function(_0x4641b4){var _0x1f22d2={};_0x1f22d2[_0x4641b4]={'$like':'%'+_0x2427a2['query'][_0x4a4e('0x37')]+'%'};return _0x1f22d2;})});}if(_0x2427a2[_0x4a4e('0x24')][_0x4a4e('0x5c')]){var _0x1ef1ce=_0x2427a2['query']['$gte']['split'](',');var _0x48aba7={};_0x48aba7[_0x1ef1ce[0x0]]={'$gte':moment(_0x1ef1ce[0x1])[_0x4a4e('0x5d')](_0x4a4e('0x5e'))};_0x3c56b3[_0x4a4e('0x36')]=_['merge'](_0x3c56b3['where'],_0x48aba7);}_0x3c56b3=_[_0x4a4e('0x35')]({},_0x3c56b3,_0x2427a2[_0x4a4e('0x39')]);return db['SmsMessage'][_0x4a4e('0x16')]({'where':_0x3c56b3[_0x4a4e('0x36')]})[_0x4a4e('0x1c')](function(_0x180ca8){_0x15dee5[_0x4a4e('0x16')]=_0x180ca8;if(_0x2427a2[_0x4a4e('0x24')][_0x4a4e('0x5f')]){_0x3c56b3[_0x4a4e('0x3b')]=[{'all':!![]}];}return db[_0x4a4e('0x41')][_0x4a4e('0x50')](_0x3c56b3);})['then'](function(_0x320dae){_0x15dee5[_0x4a4e('0x60')]=_0x320dae;return _0x15dee5;});}})['then'](respondWithFilteredResult(_0x8316ab,_0x3c56b3))[_0x4a4e('0x51')](handleError(_0x8316ab,null));};exports[_0x4a4e('0x61')]=function(_0x50e0ed,_0x23e728,_0x484f6f){return db[_0x4a4e('0x44')][_0x4a4e('0x53')]({'where':{'id':_0x50e0ed[_0x4a4e('0x52')]['id']}})[_0x4a4e('0x1c')](handleEntityNotFound(_0x23e728,null))['then'](function(_0x7bf28c){if(_0x7bf28c){return _0x7bf28c[_0x4a4e('0x62')](_0x50e0ed[_0x4a4e('0x55')][_0x4a4e('0x58')],_[_0x4a4e('0x63')](_0x50e0ed['body'],[_0x4a4e('0x58'),'id'])||{})[_0x4a4e('0x64')](function(){return db[_0x4a4e('0x3d')][_0x4a4e('0x50')]({'attributes':['id',_0x4a4e('0x20'),'color'],'where':{'id':_0x50e0ed[_0x4a4e('0x55')][_0x4a4e('0x58')]}});})[_0x4a4e('0x1c')](function(_0xb45c96){socket[_0x4a4e('0x65')](_0x4a4e('0x66'),{'id':Number(_0x50e0ed[_0x4a4e('0x52')]['id']),'tags':_0xb45c96||[]});return{'id':Number(_0x50e0ed[_0x4a4e('0x52')]['id']),'tags':_0xb45c96||[]};});}})[_0x4a4e('0x1c')](respondWithResult(_0x23e728,null))[_0x4a4e('0x51')](handleError(_0x23e728,null));};exports['removeTags']=function(_0x3191b8,_0x539807,_0x732f8a){var _0x41f378;return db[_0x4a4e('0x44')][_0x4a4e('0x53')]({'where':{'id':_0x3191b8[_0x4a4e('0x52')]['id']}})[_0x4a4e('0x1c')](handleEntityNotFound(_0x539807,null))[_0x4a4e('0x1c')](function(_0x67fa2b){if(_0x67fa2b){return _0x67fa2b[_0x4a4e('0x67')](_0x3191b8[_0x4a4e('0x24')][_0x4a4e('0x58')]);}})[_0x4a4e('0x1c')](respondWithStatusCode(_0x539807,null))['catch'](handleError(_0x539807,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 02a4db6..db6fe9d 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 _0x0faf=['update','remove','emit','hasOwnProperty','hook','exports','events','SmsInteraction','setMaxListeners','save'];(function(_0x4f4ca7,_0x4c85fd){var _0x4fc7fc=function(_0x52bcbe){while(--_0x52bcbe){_0x4f4ca7['push'](_0x4f4ca7['shift']());}};_0x4fc7fc(++_0x4c85fd);}(_0x0faf,0x132));var _0xf0fa=function(_0x2a1e2d,_0x195473){_0x2a1e2d=_0x2a1e2d-0x0;var _0x32b8cc=_0x0faf[_0x2a1e2d];return _0x32b8cc;};'use strict';var EventEmitter=require(_0xf0fa('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xf0fa('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf0fa('0x2')](0x0);var events={'afterCreate':_0xf0fa('0x3'),'afterUpdate':_0xf0fa('0x4'),'afterDestroy':_0xf0fa('0x5')};function emitEvent(_0xdc9ce3){return function(_0x515b12,_0xc83253,_0x283f04){SmsInteractionEvents['emit'](_0xdc9ce3+':'+_0x515b12['id'],_0x515b12);SmsInteractionEvents[_0xf0fa('0x6')](_0xdc9ce3,_0x515b12);_0x283f04(null);};}for(var e in events){if(events[_0xf0fa('0x7')](e)){var event=events[e];SmsInteraction[_0xf0fa('0x8')](e,emitEvent(event));}}module[_0xf0fa('0x9')]=SmsInteractionEvents; \ No newline at end of file +var _0xd949=['hook','events','../../mysqldb','SmsInteraction','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x5ea088,_0x38e9cc){var _0x2929bf=function(_0x2a1826){while(--_0x2a1826){_0x5ea088['push'](_0x5ea088['shift']());}};_0x2929bf(++_0x38e9cc);}(_0xd949,0x181));var _0x9d94=function(_0x5109bd,_0x5e45e9){_0x5109bd=_0x5109bd-0x0;var _0x16a55d=_0xd949[_0x5109bd];return _0x16a55d;};'use strict';var EventEmitter=require(_0x9d94('0x0'));var SmsInteraction=require(_0x9d94('0x1'))['db'][_0x9d94('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9d94('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9d94('0x4'),'afterDestroy':'remove'};function emitEvent(_0x519952){return function(_0x32d7d4,_0x496755,_0x592d80){SmsInteractionEvents[_0x9d94('0x5')](_0x519952+':'+_0x32d7d4['id'],_0x32d7d4);SmsInteractionEvents[_0x9d94('0x5')](_0x519952,_0x32d7d4);_0x592d80(null);};}for(var e in events){if(events[_0x9d94('0x6')](e)){var event=events[e];SmsInteraction[_0x9d94('0x7')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a695681..cc67a9d 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 _0x8e3f=['define','SmsInteraction','sms_interactions','lodash','util','../../config/logger','moment','bluebird','request-promise','exports'];(function(_0x586cb6,_0x32d903){var _0x134b56=function(_0x13f96d){while(--_0x13f96d){_0x586cb6['push'](_0x586cb6['shift']());}};_0x134b56(++_0x32d903);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'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('./smsInteraction.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 +var _0xf347=['util','api','bluebird','request-promise','exports','define','SmsInteraction','sms_interactions','lodash'];(function(_0x35c4d6,_0x5e4cfc){var _0x3bc2b0=function(_0xdba67a){while(--_0xdba67a){_0x35c4d6['push'](_0x35c4d6['shift']());}};_0x3bc2b0(++_0x5e4cfc);}(_0xf347,0xa1));var _0x7f34=function(_0x6289b6,_0x239965){_0x6289b6=_0x6289b6-0x0;var _0x177ad2=_0xf347[_0x6289b6];return _0x177ad2;};'use strict';var _=require(_0x7f34('0x0'));var util=require(_0x7f34('0x1'));var logger=require('../../config/logger')(_0x7f34('0x2'));var moment=require('moment');var BPromise=require(_0x7f34('0x3'));var rp=require(_0x7f34('0x4'));var attributes=require('./smsInteraction.attributes');module[_0x7f34('0x5')]=function(_0x5ca986,_0x51fb57){return _0x5ca986[_0x7f34('0x6')](_0x7f34('0x7'),attributes,{'tableName':_0x7f34('0x8'),'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 98af931..0cb5aa1 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 _0x6f91=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','then','debug','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x2bac06,_0xe7cc4c){var _0xde9d11=function(_0x245088){while(--_0x245088){_0x2bac06['push'](_0x2bac06['shift']());}};_0xde9d11(++_0xe7cc4c);}(_0x6f91,0xc8));var _0x16f9=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x6f91[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require('lodash');var util=require(_0x16f9('0x0'));var moment=require(_0x16f9('0x1'));var BPromise=require(_0x16f9('0x2'));var rs=require(_0x16f9('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x16f9('0x4'));var logger=require(_0x16f9('0x5'))(_0x16f9('0x6'));var config=require(_0x16f9('0x7'));var jayson=require(_0x16f9('0x8'));var client=jayson[_0x16f9('0x9')][_0x16f9('0xa')]({'port':0x232a});var socket=require(_0x16f9('0xb'))({'host':_0x16f9('0xc'),'port':0x18eb});require('./smsInteraction.socket')[_0x16f9('0xd')](socket);function respondWithRpcPromise(_0x13f441,_0x5cd6e9,_0x400e3c){return new BPromise(function(_0xb66ac0,_0x4a2713){return client[_0x16f9('0xe')](_0x13f441,_0x400e3c)['then'](function(_0xbfeab){logger[_0x16f9('0xf')](_0x16f9('0x10'),_0x5cd6e9,_0x16f9('0x11'));logger['debug'](_0x16f9('0x12'),_0x5cd6e9,'request\x20sent',JSON['stringify'](_0xbfeab));if(_0xbfeab['error']){if(_0xbfeab[_0x16f9('0x13')]['code']===0x1f4){logger[_0x16f9('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x5cd6e9,_0xbfeab[_0x16f9('0x13')][_0x16f9('0x14')]);return _0x4a2713(_0xbfeab['error'][_0x16f9('0x14')]);}logger[_0x16f9('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x5cd6e9,_0xbfeab['error'][_0x16f9('0x14')]);return _0xb66ac0(_0xbfeab[_0x16f9('0x13')]['message']);}else{logger[_0x16f9('0xf')](_0x16f9('0x10'),_0x5cd6e9,_0x16f9('0x11'));_0xb66ac0(_0xbfeab['result'][_0x16f9('0x14')]);}})[_0x16f9('0x15')](function(_0x408a97){logger[_0x16f9('0x13')](_0x16f9('0x10'),_0x5cd6e9,_0x408a97);_0x4a2713(_0x408a97);});});}exports[_0x16f9('0x16')]=function(_0x326a45){var _0x20d197=this;return new Promise(function(_0x2c7299,_0x32d34c){return db[_0x16f9('0x17')][_0x16f9('0x18')](_0x326a45[_0x16f9('0x19')],{'raw':_0x326a45[_0x16f9('0x1a')]?_0x326a45[_0x16f9('0x1a')][_0x16f9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x326a45[_0x16f9('0x1a')]?_0x326a45[_0x16f9('0x1a')][_0x16f9('0x1c')]||null:null,'attributes':_0x326a45[_0x16f9('0x1a')]?_0x326a45[_0x16f9('0x1a')]['attributes']||null:null,'limit':_0x326a45[_0x16f9('0x1a')]?_0x326a45[_0x16f9('0x1a')][_0x16f9('0x1d')]||null:null})[_0x16f9('0x1e')](function(_0x37a2f6){logger[_0x16f9('0xf')](_0x16f9('0x16'),_0x326a45);logger[_0x16f9('0x1f')](_0x16f9('0x16'),_0x326a45,JSON[_0x16f9('0x20')](_0x37a2f6));_0x2c7299(_0x37a2f6);})[_0x16f9('0x15')](function(_0x2cc209){logger[_0x16f9('0x13')](_0x16f9('0x16'),_0x2cc209['message'],_0x326a45);_0x32d34c(_0x20d197[_0x16f9('0x13')](0x1f4,_0x2cc209[_0x16f9('0x14')]));});});};exports[_0x16f9('0x21')]=function(_0x4cef36){return new Promise(function(_0x17358d,_0x2b1fc2){return db['SmsInteraction'][_0x16f9('0x22')]({'where':_0x4cef36['options']?_0x4cef36['options'][_0x16f9('0x1c')]||null:null})[_0x16f9('0x1e')](function(_0x2f6944){if(_0x2f6944){return _0x2f6944[_0x16f9('0x23')](_0x4cef36[_0x16f9('0x19')][_0x16f9('0x24')],_[_0x16f9('0x25')](_0x4cef36[_0x16f9('0x19')],[_0x16f9('0x24'),'id'])||{});}})[_0x16f9('0x26')](function(_0x3183d8){logger['info'](_0x16f9('0x27'),_0x4cef36);logger[_0x16f9('0x1f')](_0x16f9('0x27'),_0x4cef36,JSON['stringify'](_0x3183d8));_0x17358d(_0x3183d8);})[_0x16f9('0x15')](function(_0x2b0972){logger[_0x16f9('0x13')](_0x16f9('0x27'),_0x2b0972[_0x16f9('0x14')],_0x4cef36);_0x2b1fc2(_this[_0x16f9('0x13')](0x1f4,_0x2b0972[_0x16f9('0x14')]));});});}; \ No newline at end of file +var _0x6452=['ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','body','options','attributes','catch','AddTagsToSmsInteraction','find','where'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6452,0x1a6));var _0x2645=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x6452[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0x2645('0x0'));var util=require(_0x2645('0x1'));var moment=require('moment');var BPromise=require(_0x2645('0x2'));var rs=require(_0x2645('0x3'));var fs=require('fs');var db=require(_0x2645('0x4'))['db'];var utils=require(_0x2645('0x5'));var logger=require(_0x2645('0x6'))('rpc');var config=require(_0x2645('0x7'));var jayson=require(_0x2645('0x8'));var client=jayson[_0x2645('0x9')][_0x2645('0xa')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x2645('0xb'),'port':0x18eb});require(_0x2645('0xc'))[_0x2645('0xd')](socket);function respondWithRpcPromise(_0x1474b5,_0x58015a,_0x19192b){return new BPromise(function(_0x34ea61,_0x551243){return client[_0x2645('0xe')](_0x1474b5,_0x19192b)[_0x2645('0xf')](function(_0x5c7265){logger[_0x2645('0x10')](_0x2645('0x11'),_0x58015a,_0x2645('0x12'));logger[_0x2645('0x13')](_0x2645('0x14'),_0x58015a,_0x2645('0x12'),JSON[_0x2645('0x15')](_0x5c7265));if(_0x5c7265[_0x2645('0x16')]){if(_0x5c7265[_0x2645('0x16')][_0x2645('0x17')]===0x1f4){logger[_0x2645('0x16')](_0x2645('0x11'),_0x58015a,_0x5c7265[_0x2645('0x16')][_0x2645('0x18')]);return _0x551243(_0x5c7265[_0x2645('0x16')][_0x2645('0x18')]);}logger['error'](_0x2645('0x11'),_0x58015a,_0x5c7265['error']['message']);return _0x34ea61(_0x5c7265['error'][_0x2645('0x18')]);}else{logger[_0x2645('0x10')](_0x2645('0x11'),_0x58015a,_0x2645('0x12'));_0x34ea61(_0x5c7265[_0x2645('0x19')]['message']);}})['catch'](function(_0x5aa3e1){logger[_0x2645('0x16')](_0x2645('0x11'),_0x58015a,_0x5aa3e1);_0x551243(_0x5aa3e1);});});}exports[_0x2645('0x1a')]=function(_0x4bb969){var _0x4613dd=this;return new Promise(function(_0x223fb3,_0x3471c0){return db['SmsInteraction']['update'](_0x4bb969[_0x2645('0x1b')],{'raw':_0x4bb969[_0x2645('0x1c')]?_0x4bb969[_0x2645('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb969[_0x2645('0x1c')]?_0x4bb969[_0x2645('0x1c')]['where']||null:null,'attributes':_0x4bb969[_0x2645('0x1c')]?_0x4bb969['options'][_0x2645('0x1d')]||null:null,'limit':_0x4bb969['options']?_0x4bb969['options']['limit']||null:null})[_0x2645('0xf')](function(_0x25c296){logger[_0x2645('0x10')](_0x2645('0x1a'),_0x4bb969);logger[_0x2645('0x13')]('UpdateSmsInteraction',_0x4bb969,JSON[_0x2645('0x15')](_0x25c296));_0x223fb3(_0x25c296);})[_0x2645('0x1e')](function(_0x6a0231){logger[_0x2645('0x16')](_0x2645('0x1a'),_0x6a0231[_0x2645('0x18')],_0x4bb969);_0x3471c0(_0x4613dd[_0x2645('0x16')](0x1f4,_0x6a0231['message']));});});};exports[_0x2645('0x1f')]=function(_0xecd601){return new Promise(function(_0x2e7b26,_0x160839){return db['SmsInteraction'][_0x2645('0x20')]({'where':_0xecd601['options']?_0xecd601[_0x2645('0x1c')][_0x2645('0x21')]||null:null})[_0x2645('0xf')](function(_0x57d2c6){if(_0x57d2c6){return _0x57d2c6['addTags'](_0xecd601[_0x2645('0x1b')][_0x2645('0x22')],_[_0x2645('0x23')](_0xecd601[_0x2645('0x1b')],['ids','id'])||{});}})[_0x2645('0x24')](function(_0xc3143d){logger['info']('AddTags',_0xecd601);logger[_0x2645('0x13')](_0x2645('0x25'),_0xecd601,JSON[_0x2645('0x15')](_0xc3143d));_0x2e7b26(_0xc3143d);})[_0x2645('0x1e')](function(_0x3461e3){logger[_0x2645('0x16')](_0x2645('0x25'),_0x3461e3[_0x2645('0x18')],_0xecd601);_0x160839(_this[_0x2645('0x16')](0x1f4,_0x3461e3[_0x2645('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b8744d8..857fc46 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 _0xf8fa=['update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf8fa,0x1ec));var _0xaf8f=function(_0x52e2f9,_0x5f4f9c){_0x52e2f9=_0x52e2f9-0x0;var _0x2ce1b8=_0xf8fa[_0x52e2f9];return _0x2ce1b8;};'use strict';var SmsInteractionEvents=require(_0xaf8f('0x0'));var events=[_0xaf8f('0x1'),_0xaf8f('0x2'),_0xaf8f('0x3')];function createListener(_0x2f1ed6,_0x5548c9){return function(_0x187eb7){_0x5548c9[_0xaf8f('0x4')](_0x2f1ed6,_0x187eb7);};}function removeListener(_0x2ac6ff,_0x34d773){return function(){SmsInteractionEvents[_0xaf8f('0x5')](_0x2ac6ff,_0x34d773);};}exports[_0xaf8f('0x6')]=function(_0x55cbf8){for(var _0x3be361=0x0,_0x5624af=events[_0xaf8f('0x7')];_0x3be361<_0x5624af;_0x3be361++){var _0x27cf9e=events[_0x3be361];var _0x70de36=createListener(_0xaf8f('0x8')+_0x27cf9e,_0x55cbf8);SmsInteractionEvents['on'](_0x27cf9e,_0x70de36);}}; \ No newline at end of file +var _0x3261=['remove','update','emit','removeListener','save'];(function(_0x487fd8,_0x187437){var _0x21f383=function(_0x3a461c){while(--_0x3a461c){_0x487fd8['push'](_0x487fd8['shift']());}};_0x21f383(++_0x187437);}(_0x3261,0x7c));var _0x1326=function(_0x1ea45c,_0x461e6e){_0x1ea45c=_0x1ea45c-0x0;var _0x355008=_0x3261[_0x1ea45c];return _0x355008;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x1326('0x0'),_0x1326('0x1'),_0x1326('0x2')];function createListener(_0x47df48,_0x4ea006){return function(_0x57c43d){_0x4ea006[_0x1326('0x3')](_0x47df48,_0x57c43d);};}function removeListener(_0x4adb14,_0x3600d6){return function(){SmsInteractionEvents[_0x1326('0x4')](_0x4adb14,_0x3600d6);};}exports['register']=function(_0x10daf6){for(var _0xb1268=0x0,_0x5f2d95=events['length'];_0xb1268<_0x5f2d95;_0xb1268++){var _0x5b3123=events[_0xb1268];var _0x4d6db8=createListener('smsInteraction:'+_0x5b3123,_0x10daf6);SmsInteractionEvents['on'](_0x5b3123,_0x4d6db8);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6400280..9279b77 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 _0xefae=['exports','multer','path','express','Router','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy'];(function(_0x117994,_0x46bbbb){var _0x40814a=function(_0x5e88ca){while(--_0x5e88ca){_0x117994['push'](_0x117994['shift']());}};_0x40814a(++_0x46bbbb);}(_0xefae,0xb7));var _0xeefa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xefae[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xeefa('0x0'));var util=require('util');var path=require(_0xeefa('0x1'));var express=require(_0xeefa('0x2'));var router=express[_0xeefa('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeefa('0x4'));var controller=require(_0xeefa('0x5'));router[_0xeefa('0x6')]('/',auth[_0xeefa('0x7')](),controller[_0xeefa('0x8')]);router[_0xeefa('0x6')](_0xeefa('0x9'),auth[_0xeefa('0x7')](),controller[_0xeefa('0xa')]);router[_0xeefa('0x6')](_0xeefa('0xb'),auth[_0xeefa('0x7')](),controller[_0xeefa('0xc')]);router[_0xeefa('0xd')]('/',auth[_0xeefa('0x7')](),interaction['tracked']('sms',_0xeefa('0xe')),controller[_0xeefa('0xf')]);router[_0xeefa('0xd')](_0xeefa('0x10'),controller[_0xeefa('0x11')]);router[_0xeefa('0x12')](_0xeefa('0xb'),auth[_0xeefa('0x7')](),controller[_0xeefa('0x13')]);router['put'](_0xeefa('0x14'),auth[_0xeefa('0x7')](),controller[_0xeefa('0x15')]);router['put'](_0xeefa('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0xeefa('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xeefa('0x18')]);module[_0xeefa('0x19')]=router; \ No newline at end of file +var _0xc825=['create','post','/:id/status','status','put','/:id/accept','accept','reject','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe','get','/:id','show','sms','smsmessage:create'];(function(_0x165fe8,_0x278953){var _0x31e03e=function(_0x5a456e){while(--_0x5a456e){_0x165fe8['push'](_0x165fe8['shift']());}};_0x31e03e(++_0x278953);}(_0xc825,0x159));var _0x5c82=function(_0x4b411a,_0x24e032){_0x4b411a=_0x4b411a-0x0;var _0x5b97c9=_0xc825[_0x4b411a];return _0x5b97c9;};'use strict';var multer=require(_0x5c82('0x0'));var util=require(_0x5c82('0x1'));var path=require(_0x5c82('0x2'));var express=require(_0x5c82('0x3'));var router=express['Router']();var auth=require(_0x5c82('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c82('0x5'));var controller=require(_0x5c82('0x6'));router['get']('/',auth[_0x5c82('0x7')](),controller[_0x5c82('0x8')]);router['get'](_0x5c82('0x9'),auth[_0x5c82('0x7')](),controller['describe']);router[_0x5c82('0xa')](_0x5c82('0xb'),auth['isAuthenticated'](),controller[_0x5c82('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x5c82('0xd'),_0x5c82('0xe')),controller[_0x5c82('0xf')]);router[_0x5c82('0x10')](_0x5c82('0x11'),controller[_0x5c82('0x12')]);router[_0x5c82('0x13')](_0x5c82('0xb'),auth[_0x5c82('0x7')](),controller['update']);router[_0x5c82('0x13')](_0x5c82('0x14'),auth[_0x5c82('0x7')](),controller[_0x5c82('0x15')]);router['put']('/:id/reject',auth[_0x5c82('0x7')](),controller[_0x5c82('0x16')]);router['delete'](_0x5c82('0xb'),auth[_0x5c82('0x7')](),controller['destroy']);module[_0x5c82('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index adc033d..739e31d 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 _0xc906=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','medium'];(function(_0x48ab04,_0x160f27){var _0x1904e4=function(_0x8bacd9){while(--_0x8bacd9){_0x48ab04['push'](_0x48ab04['shift']());}};_0x1904e4(++_0x160f27);}(_0xc906,0x1ad));var _0x6c90=function(_0x5af56b,_0x600e95){_0x5af56b=_0x5af56b-0x0;var _0x2ff80c=_0xc906[_0x5af56b];return _0x2ff80c;};'use strict';var Sequelize=require(_0x6c90('0x0'));module[_0x6c90('0x1')]={'body':{'type':Sequelize['TEXT'](_0x6c90('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6c90('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6c90('0x4')]('in','out'),'defaultValue':_0x6c90('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6c90('0x6')](0xbe)},'phone':{'type':Sequelize[_0x6c90('0x6')]},'readAt':{'type':Sequelize[_0x6c90('0x7')]},'secret':{'type':Sequelize[_0x6c90('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1dcc=['sequelize','exports','TEXT','medium','ENUM','out','STRING'];(function(_0x57f9f9,_0x4b299d){var _0x32ff85=function(_0x2d1280){while(--_0x2d1280){_0x57f9f9['push'](_0x57f9f9['shift']());}};_0x32ff85(++_0x4b299d);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x346193,_0x55c183){_0x346193=_0x346193-0x0;var _0x8eea1b=_0x1dcc[_0x346193];return _0x8eea1b;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'body':{'type':Sequelize[_0xc1dc('0x2')](_0xc1dc('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc1dc('0x4')]('in','out'),'defaultValue':_0xc1dc('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc1dc('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc1dc('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index cbd6acc..330798a 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 _0x434b=['RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','twilio','MessageSid','plivo','MessageUUID','indexOf','sent','Status','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','./smsMessage.socket','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','save','update','destroy','stack','name','send','index','SmsMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','filter','merge','map','options','count','includeAll','rows','params','include','find','create','body','describe','sms-interactions','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','reject','agent','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x30a706,_0x21ff9b){var _0xc64339=function(_0x5719b6){while(--_0x5719b6){_0x30a706['push'](_0x30a706['shift']());}};_0xc64339(++_0x21ff9b);}(_0x434b,0x17f));var _0xb434=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0x434b[_0x4ec13d];return _0x3c3fa7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb434('0x0'));var BPromise=require(_0xb434('0x1'));var Mustache=require('mustache');var util=require(_0xb434('0x2'));var path=require('path');var sox=require(_0xb434('0x3'));var csv=require(_0xb434('0x4'));var ejs=require(_0xb434('0x5'));var fs=require('fs');var _=require(_0xb434('0x6'));var squel=require(_0xb434('0x7'));var crypto=require(_0xb434('0x8'));var jsforce=require(_0xb434('0x9'));var deskjs=require(_0xb434('0xa'));var toCsv=require(_0xb434('0x4'));var querystring=require('querystring');var Papa=require(_0xb434('0xb'));var qs=require(_0xb434('0xc'));var logger=require(_0xb434('0xd'))(_0xb434('0xe'));var utils=require(_0xb434('0xf'));var config=require(_0xb434('0x10'));var db=require(_0xb434('0x11'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xb434('0x12'))[_0xb434('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb434('0x14')]({'port':0x232c});var client9002=jayson[_0xb434('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53690e,_0x427774,_0x5424a1,_0x51f45f){return new BPromise(function(_0x374943,_0x778b6b){var _0x414c36=_0x51f45f||client;return _0x414c36[_0xb434('0x16')](_0x53690e,_0x5424a1)[_0xb434('0x17')](function(_0x39a5a3){logger[_0xb434('0x18')](_0xb434('0x19'),_0x427774,'request\x20sent');logger[_0xb434('0x1a')](_0xb434('0x1b'),_0x427774,_0xb434('0x1c'),JSON[_0xb434('0x1d')](_0x39a5a3));if(_0x39a5a3[_0xb434('0x1e')]){if(_0x39a5a3[_0xb434('0x1e')][_0xb434('0x1f')]===0x1f4){logger[_0xb434('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x427774,_0x39a5a3['error']['message']);return _0x778b6b(_0x39a5a3['error'][_0xb434('0x20')]);}logger[_0xb434('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x427774,_0x39a5a3[_0xb434('0x1e')]['message']);return _0x374943(_0x39a5a3[_0xb434('0x1e')][_0xb434('0x20')]);}else{logger[_0xb434('0x18')](_0xb434('0x19'),_0x427774,_0xb434('0x1c'));_0x374943(_0x39a5a3[_0xb434('0x21')][_0xb434('0x20')]);}})[_0xb434('0x22')](function(_0x3572c6){logger[_0xb434('0x1e')](_0xb434('0x19'),_0x427774,_0x3572c6);_0x778b6b(_0x3572c6);});});}function respondWithStatusCode(_0x5bb2b1,_0xd030aa){_0xd030aa=_0xd030aa||0xcc;return function(_0x515921){if(_0x515921){return _0x5bb2b1[_0xb434('0x23')](_0xd030aa);}return _0x5bb2b1[_0xb434('0x24')](_0xd030aa)[_0xb434('0x25')]();};}function respondWithResult(_0x26f49c,_0x1a755d){_0x1a755d=_0x1a755d||0xc8;return function(_0x361236){if(_0x361236){return _0x26f49c[_0xb434('0x24')](_0x1a755d)[_0xb434('0x26')](_0x361236);}};}function respondWithFilteredResult(_0x169a6d,_0x576f0e){return function(_0x197e42){if(_0x197e42){var _0x2fea05=_0x197e42['count'],_0x47d51e=_0x576f0e[_0xb434('0x27')],_0x4937f8=_0x576f0e[_0xb434('0x27')]+_0x576f0e['limit'],_0x1217bf;if(_0x4937f8>=_0x2fea05){_0x4937f8=_0x2fea05;_0x1217bf=0xc8;}else{_0x1217bf=0xce;}_0x169a6d[_0xb434('0x24')](_0x1217bf);return _0x169a6d['set']('Content-Range',_0x47d51e+'-'+_0x4937f8+'/'+_0x2fea05)[_0xb434('0x26')](_0x197e42);}return null;};}function patchUpdates(_0x2790dd){return function(_0x296a66){try{jsonpatch['apply'](_0x296a66,_0x2790dd,!![]);}catch(_0xfd8355){return BPromise['reject'](_0xfd8355);}return _0x296a66[_0xb434('0x28')]();};}function saveUpdates(_0x36c2f2,_0x1b0e7f){return function(_0x24aa91){if(_0x24aa91){return _0x24aa91[_0xb434('0x29')](_0x36c2f2)['then'](function(_0x3f9c3c){return _0x3f9c3c;});}return null;};}function removeEntity(_0xae8aa9,_0x27f3dd){return function(_0x392833){if(_0x392833){return _0x392833[_0xb434('0x2a')]()['then'](function(){_0xae8aa9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ced5c,_0x20010e){return function(_0x5407ec){if(!_0x5407ec){_0x4ced5c[_0xb434('0x23')](0x194);}return _0x5407ec;};}function handleError(_0x262888,_0x354018){_0x354018=_0x354018||0x1f4;return function(_0x25a45b){logger[_0xb434('0x1e')](_0x25a45b[_0xb434('0x2b')]);if(_0x25a45b['name']){delete _0x25a45b[_0xb434('0x2c')];}_0x262888['status'](_0x354018)[_0xb434('0x2d')](_0x25a45b);};}exports[_0xb434('0x2e')]=function(_0x1eef55,_0x1515c7){var _0x177c47={},_0xb44eb9={},_0x33f91a={'count':0x0,'rows':[]};var _0x51c593=db[_0xb434('0x2f')][_0xb434('0x30')];_0xb44eb9[_0xb434('0x31')]=_[_0xb434('0x32')](_0x51c593);var _0x442c0c={'dateStart':_0x1eef55[_0xb434('0x33')][_0xb434('0x34')],'dateEnd':_0x1eef55['query'][_0xb434('0x35')]};delete _0x1eef55['query'][_0xb434('0x34')];delete _0x1eef55[_0xb434('0x33')]['dateEnd'];_0xb44eb9[_0xb434('0x33')]=_[_0xb434('0x32')](_0x1eef55[_0xb434('0x33')]);_0xb44eb9[_0xb434('0x36')]=_[_0xb434('0x37')](_0xb44eb9[_0xb434('0x31')],_0xb44eb9[_0xb434('0x33')]);_0x177c47[_0xb434('0x38')]=_[_0xb434('0x37')](_0xb44eb9[_0xb434('0x31')],qs[_0xb434('0x39')](_0x1eef55[_0xb434('0x33')][_0xb434('0x39')]));_0x177c47[_0xb434('0x38')]=_0x177c47[_0xb434('0x38')][_0xb434('0x3a')]?_0x177c47[_0xb434('0x38')]:_0xb44eb9[_0xb434('0x31')];if(!_0x1eef55[_0xb434('0x33')][_0xb434('0x3b')](_0xb434('0x3c'))){_0x177c47[_0xb434('0x3d')]=qs[_0xb434('0x3d')](_0x1eef55[_0xb434('0x33')]['limit']);_0x177c47[_0xb434('0x27')]=qs[_0xb434('0x27')](_0x1eef55[_0xb434('0x33')][_0xb434('0x27')]);}_0x177c47[_0xb434('0x3e')]=qs[_0xb434('0x3f')](_0x1eef55[_0xb434('0x33')]['sort']);_0x177c47[_0xb434('0x40')]=qs[_0xb434('0x36')](_[_0xb434('0x41')](_0x1eef55[_0xb434('0x33')],_0xb44eb9[_0xb434('0x36')]));if(_0x442c0c[_0xb434('0x34')]){if(_0x442c0c[_0xb434('0x35')]){_0x442c0c[_0xb434('0x35')]=moment(_0x442c0c[_0xb434('0x35')])[_0xb434('0x42')](0x1,_0xb434('0x43'));}else{_0x442c0c[_0xb434('0x35')]=moment(_0x442c0c[_0xb434('0x34')])['add'](0x1,_0xb434('0x43'));}_['merge'](_0x177c47[_0xb434('0x40')],{'createdAt':{'$gte':_0x442c0c['dateStart'],'$lte':_0x442c0c[_0xb434('0x35')]}});}if(_0x1eef55[_0xb434('0x33')][_0xb434('0x44')]){_0x177c47[_0xb434('0x40')]=_[_0xb434('0x45')](_0x177c47['where'],{'$or':_[_0xb434('0x46')](_0x177c47['attributes'],function(_0x462ec5){var _0x1340f3={};_0x1340f3[_0x462ec5]={'$like':'%'+_0x1eef55[_0xb434('0x33')][_0xb434('0x44')]+'%'};return _0x1340f3;})});}_0x177c47=_[_0xb434('0x45')]({},_0x177c47,_0x1eef55[_0xb434('0x47')]);var _0x135a0c={'where':_0x177c47[_0xb434('0x40')]};return db[_0xb434('0x2f')][_0xb434('0x48')](_0x135a0c)['then'](function(_0x172a65){_0x33f91a[_0xb434('0x48')]=_0x172a65;if(_0x1eef55[_0xb434('0x33')][_0xb434('0x49')]){_0x177c47['include']=[{'all':!![]}];}return db[_0xb434('0x2f')]['findAll'](_0x177c47);})[_0xb434('0x17')](function(_0x46f1b7){_0x33f91a[_0xb434('0x4a')]=_0x46f1b7;return _0x33f91a;})['then'](respondWithFilteredResult(_0x1515c7,_0x177c47))[_0xb434('0x22')](handleError(_0x1515c7,null));};exports['show']=function(_0x1e19ef,_0x55520e){var _0x39c448={'raw':!![],'where':{'id':_0x1e19ef[_0xb434('0x4b')]['id']}},_0x522bb0={};_0x522bb0[_0xb434('0x31')]=_[_0xb434('0x32')](db[_0xb434('0x2f')]['rawAttributes']);_0x522bb0['query']=_[_0xb434('0x32')](_0x1e19ef[_0xb434('0x33')]);_0x522bb0['filters']=_[_0xb434('0x37')](_0x522bb0['model'],_0x522bb0[_0xb434('0x33')]);_0x39c448[_0xb434('0x38')]=_[_0xb434('0x37')](_0x522bb0['model'],qs['fields'](_0x1e19ef[_0xb434('0x33')][_0xb434('0x39')]));_0x39c448['attributes']=_0x39c448['attributes'][_0xb434('0x3a')]?_0x39c448['attributes']:_0x522bb0['model'];if(_0x1e19ef[_0xb434('0x33')][_0xb434('0x49')]){_0x39c448[_0xb434('0x4c')]=[{'all':!![]}];}_0x39c448=_[_0xb434('0x45')]({},_0x39c448,_0x1e19ef[_0xb434('0x47')]);return db[_0xb434('0x2f')][_0xb434('0x4d')](_0x39c448)[_0xb434('0x17')](handleEntityNotFound(_0x55520e,null))[_0xb434('0x17')](respondWithResult(_0x55520e,null))[_0xb434('0x22')](handleError(_0x55520e,null));};exports[_0xb434('0x4e')]=function(_0x38c0f2,_0x535a05){return db[_0xb434('0x2f')][_0xb434('0x4e')](_0x38c0f2['body'],{})[_0xb434('0x17')](respondWithResult(_0x535a05,0xc9))[_0xb434('0x22')](handleError(_0x535a05,null));};exports[_0xb434('0x29')]=function(_0x10797c,_0xa4c8eb){if(_0x10797c[_0xb434('0x4f')]['id']){delete _0x10797c['body']['id'];}return db[_0xb434('0x2f')][_0xb434('0x4d')]({'where':{'id':_0x10797c[_0xb434('0x4b')]['id']}})['then'](handleEntityNotFound(_0xa4c8eb,null))[_0xb434('0x17')](saveUpdates(_0x10797c[_0xb434('0x4f')],null))[_0xb434('0x17')](respondWithResult(_0xa4c8eb,null))[_0xb434('0x22')](handleError(_0xa4c8eb,null));};exports[_0xb434('0x2a')]=function(_0x2f10f2,_0x474b46){return db[_0xb434('0x2f')][_0xb434('0x4d')]({'where':{'id':_0x2f10f2[_0xb434('0x4b')]['id']}})[_0xb434('0x17')](handleEntityNotFound(_0x474b46,null))[_0xb434('0x17')](removeEntity(_0x474b46,null))['catch'](handleError(_0x474b46,null));};exports['describe']=function(_0x2ef8be,_0x26cc69){return db['SmsMessage'][_0xb434('0x50')]()[_0xb434('0x17')](respondWithResult(_0x26cc69,null))['catch'](handleError(_0x26cc69,null));};var interaction_log=require(_0xb434('0xd'))(_0xb434('0x51'));exports['accept']=function(_0x4d9171,_0x5113ad,_0x344ca8){var _0x50853c={'channel':_0xb434('0x52')};if(_0x4d9171['body']['id']){delete _0x4d9171['body']['id'];}_0x4d9171['body']['read']=!![];_0x4d9171[_0xb434('0x4f')][_0xb434('0x53')]=moment()[_0xb434('0x54')](_0xb434('0x55'));_0x4d9171[_0xb434('0x4f')][_0xb434('0x56')]=_0x4d9171['body'][_0xb434('0x56')]||_0x4d9171[_0xb434('0x57')]['id'];return db[_0xb434('0x2f')][_0xb434('0x4d')]({'where':{'id':_0x4d9171[_0xb434('0x4b')]['id'],'UserId':null},'include':[{'model':db[_0xb434('0x58')],'as':_0xb434('0x59')}]})['then'](handleEntityNotFound(_0x5113ad,null))[_0xb434('0x17')](saveUpdates(_0x4d9171[_0xb434('0x4f')],null))[_0xb434('0x17')](function(_0x28c8ab){if(_0x28c8ab){_0x50853c[_0xb434('0x20')]=_0x28c8ab[_0xb434('0x5a')]({'plain':!![]});return db['SmsInteraction'][_0xb434('0x4d')]({'where':{'id':_0x28c8ab[_0xb434('0x5b')]}});}return null;})[_0xb434('0x17')](handleEntityNotFound(_0x5113ad,null))['then'](function(_0x2220c1){if(_0x2220c1){return _0x2220c1[_0xb434('0x29')]({'UserId':_0x4d9171[_0xb434('0x4f')][_0xb434('0x56')],'read1stAt':_[_0xb434('0x5c')](_0x2220c1['read1stAt'])?moment()[_0xb434('0x54')](_0xb434('0x55')):undefined});}return null;})[_0xb434('0x17')](function(_0x1eeb34){if(_0x1eeb34){_0x50853c[_0xb434('0x5d')]=_0x1eeb34['get']({'plain':!![]});interaction_log['info'](_0xb434('0x5e'),_0x4d9171['user']['id'],_0x4d9171['user']['name'],_0x4d9171[_0xb434('0x57')][_0xb434('0x5f')],_0x50853c[_0xb434('0x5d')]['id'],_0x4d9171['body']?JSON['stringify'](_0x4d9171['body']):_0xb434('0x60'));return respondWithRpcPromise(_0xb434('0x61'),_0xb434('0x62'),_0x50853c);}return null;})[_0xb434('0x17')](function(_0x488c58){if(_0x488c58){if(_0x4d9171['body'][_0xb434('0x63')]){_0x50853c['message'][_0xb434('0x64')]=util[_0xb434('0x54')](_0xb434('0x65'),_0x4d9171[_0xb434('0x57')][_0xb434('0x2c')]);_0x50853c[_0xb434('0x20')]['channel']=_0x50853c[_0xb434('0x66')];_0x50853c[_0xb434('0x20')]['event']=_0xb434('0x67');return respondWithRpcPromise(_0xb434('0x68'),_0xb434('0x68'),{'event':'acceptmessage','message':_0x50853c['message']},client9002)[_0xb434('0x17')](function(){return _0x50853c;});}return _0x50853c;}return null;})[_0xb434('0x17')](respondWithResult(_0x5113ad,null))[_0xb434('0x22')](handleError(_0x5113ad,null));};var interaction_log=require(_0xb434('0xd'))('sms-interactions');exports[_0xb434('0x69')]=function(_0x1bc682,_0x57617f,_0x5dc7df){var _0x268307={'agent':{},'channel':_0xb434('0x52')};if(_0x1bc682[_0xb434('0x4f')]['id']){delete _0x1bc682[_0xb434('0x4f')]['id'];}_0x1bc682['body'][_0xb434('0x56')]=_0x1bc682[_0xb434('0x4f')]['UserId']||_0x1bc682['user']['id'];_0x268307[_0xb434('0x6a')]['id']=_0x1bc682[_0xb434('0x4f')][_0xb434('0x56')];return db[_0xb434('0x2f')][_0xb434('0x4d')]({'where':{'id':_0x1bc682['params']['id'],'UserId':null}})[_0xb434('0x17')](handleEntityNotFound(_0x57617f,null))[_0xb434('0x17')](function(_0x4b4835){if(_0x4b4835){_0x268307[_0xb434('0x20')]=_0x4b4835[_0xb434('0x5a')]({'plain':!![]});return db[_0xb434('0x6b')][_0xb434('0x4d')]({'where':{'id':_0x4b4835[_0xb434('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x57617f,null))['then'](function(_0x28bf17){if(_0x28bf17){_0x268307[_0xb434('0x5d')]=_0x28bf17[_0xb434('0x5a')]({'plain':!![]});interaction_log['info'](_0xb434('0x6c'),_0x1bc682['user']['id'],_0x1bc682['user'][_0xb434('0x2c')],_0x1bc682[_0xb434('0x57')]['role'],_0x268307[_0xb434('0x5d')]['id'],_0x1bc682[_0xb434('0x4f')]?JSON[_0xb434('0x1d')](_0x1bc682[_0xb434('0x4f')]):_0xb434('0x60'));return respondWithRpcPromise(_0xb434('0x6d'),_0xb434('0x6e'),_0x268307);}return null;})['then'](function(_0x57a220){if(_0x57a220){_0x57a220['message'][_0xb434('0x64')]=util[_0xb434('0x54')](_0xb434('0x65'),_0x1bc682[_0xb434('0x57')]['name']);_0x57a220[_0xb434('0x20')][_0xb434('0x66')]=_0x268307[_0xb434('0x66')];_0x57a220[_0xb434('0x20')]['event']='reject';respondWithRpcPromise(_0xb434('0x68'),_0xb434('0x68'),{'event':_0xb434('0x6f'),'message':_0x57a220[_0xb434('0x20')]},client9002);return _0x268307;}return null;})['then'](respondWithResult(_0x57617f,null))[_0xb434('0x22')](handleError(_0x57617f,null));};exports[_0xb434('0x24')]=function(_0xad1ebc,_0x48069e,_0x256ddd){if(_0xad1ebc[_0xb434('0x4f')]['id']){delete _0xad1ebc[_0xb434('0x4f')]['id'];}var _0x4d7f2c;return db[_0xb434('0x2f')][_0xb434('0x4d')]({'where':{'id':_0xad1ebc[_0xb434('0x4b')]['id']}})[_0xb434('0x17')](handleEntityNotFound(_0x48069e,null))[_0xb434('0x17')](function(_0x1492db){if(_0x1492db){_0x4d7f2c=_0x1492db;return db[_0xb434('0x70')][_0xb434('0x4d')]({'where':{'id':_0x1492db[_0xb434('0x71')]}});}})[_0xb434('0x17')](handleEntityNotFound(_0x48069e,null))['then'](function(_0x4ae12e){if(_0x4ae12e){logger[_0xb434('0x1a')](_0xb434('0x1b'),_0xb434('0x24'),_0xb434('0x72'),_0x4ae12e[_0xb434('0x73')],util['inspect'](_0xad1ebc[_0xb434('0x4f')],{'showHidden':![],'depth':null}));switch(_0x4ae12e[_0xb434('0x73')]){case _0xb434('0x74'):if(_0xad1ebc['body'][_0xb434('0x75')]&&_0xad1ebc[_0xb434('0x4f')][_0xb434('0x75')]===_0x4d7f2c['messageId']){return _0x4d7f2c['update']({'read':!![]});}break;case _0xb434('0x76'):if(_0xad1ebc['body'][_0xb434('0x77')]&&_0xad1ebc[_0xb434('0x4f')][_0xb434('0x77')]===_0x4d7f2c['messageId']&&_[_0xb434('0x78')]([_0xb434('0x79'),'delivered'],_0xad1ebc[_0xb434('0x4f')][_0xb434('0x7a')])>=0x0){return _0x4d7f2c[_0xb434('0x29')]({'read':!![]});}break;}return _0x4d7f2c;}})[_0xb434('0x17')](respondWithResult(_0x48069e,null))['catch'](handleError(_0x48069e,null));}; \ No newline at end of file +var _0x9e6d=['end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','add','day','merge','filter','map','options','SmsMessage','include','findAll','rows','show','params','rawAttributes','includeAll','create','body','find','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','EventManager','acceptmessage','sms-interactions','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','channel','event','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','plivo','MessageUUID','sent','delivered','Status','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status'];(function(_0x7c3477,_0x5cc4f7){var _0x5366cb=function(_0x1c6d73){while(--_0x1c6d73){_0x7c3477['push'](_0x7c3477['shift']());}};_0x5366cb(++_0x5cc4f7);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x5a49f4,_0x166449){_0x5a49f4=_0x5a49f4-0x0;var _0x43569e=_0x9e6d[_0x5a49f4];return _0x43569e;};'use strict';var jsonpatch=require(_0xd9e6('0x0'));var rp=require('request-promise');var moment=require(_0xd9e6('0x1'));var BPromise=require(_0xd9e6('0x2'));var Mustache=require(_0xd9e6('0x3'));var util=require('util');var path=require(_0xd9e6('0x4'));var sox=require(_0xd9e6('0x5'));var csv=require(_0xd9e6('0x6'));var ejs=require(_0xd9e6('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd9e6('0x8'));var crypto=require(_0xd9e6('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd9e6('0x6'));var querystring=require(_0xd9e6('0xa'));var Papa=require(_0xd9e6('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0xd9e6('0xc'))(_0xd9e6('0xd'));var utils=require('../../config/utils');var config=require(_0xd9e6('0xe'));var db=require(_0xd9e6('0xf'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xd9e6('0x10'))[_0xd9e6('0x11')](socket);var jayson=require(_0xd9e6('0x12'));var client=jayson[_0xd9e6('0x13')][_0xd9e6('0x14')]({'port':0x232c});var client9002=jayson[_0xd9e6('0x13')][_0xd9e6('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x350b53,_0x3bb322,_0x590c7b,_0x259d29){return new BPromise(function(_0xe7615,_0x593da1){var _0x51e0b2=_0x259d29||client;return _0x51e0b2[_0xd9e6('0x15')](_0x350b53,_0x590c7b)['then'](function(_0x3c69bb){logger[_0xd9e6('0x16')](_0xd9e6('0x17'),_0x3bb322,_0xd9e6('0x18'));logger[_0xd9e6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3bb322,'request\x20sent',JSON[_0xd9e6('0x1a')](_0x3c69bb));if(_0x3c69bb['error']){if(_0x3c69bb[_0xd9e6('0x1b')][_0xd9e6('0x1c')]===0x1f4){logger[_0xd9e6('0x1b')](_0xd9e6('0x17'),_0x3bb322,_0x3c69bb[_0xd9e6('0x1b')][_0xd9e6('0x1d')]);return _0x593da1(_0x3c69bb[_0xd9e6('0x1b')][_0xd9e6('0x1d')]);}logger[_0xd9e6('0x1b')](_0xd9e6('0x17'),_0x3bb322,_0x3c69bb['error']['message']);return _0xe7615(_0x3c69bb[_0xd9e6('0x1b')][_0xd9e6('0x1d')]);}else{logger[_0xd9e6('0x16')]('SmsMessage,\x20%s,\x20%s',_0x3bb322,_0xd9e6('0x18'));_0xe7615(_0x3c69bb[_0xd9e6('0x1e')][_0xd9e6('0x1d')]);}})[_0xd9e6('0x1f')](function(_0x4f8db1){logger['error'](_0xd9e6('0x17'),_0x3bb322,_0x4f8db1);_0x593da1(_0x4f8db1);});});}function respondWithStatusCode(_0x3ada59,_0x4143c0){_0x4143c0=_0x4143c0||0xcc;return function(_0x5dc0bd){if(_0x5dc0bd){return _0x3ada59[_0xd9e6('0x20')](_0x4143c0);}return _0x3ada59[_0xd9e6('0x21')](_0x4143c0)[_0xd9e6('0x22')]();};}function respondWithResult(_0xdfd442,_0x1cebad){_0x1cebad=_0x1cebad||0xc8;return function(_0xdb616f){if(_0xdb616f){return _0xdfd442[_0xd9e6('0x21')](_0x1cebad)['json'](_0xdb616f);}};}function respondWithFilteredResult(_0x3a8c62,_0x3b17f9){return function(_0x33b7af){if(_0x33b7af){var _0x3ea715=_0x33b7af[_0xd9e6('0x23')],_0x147a4f=_0x3b17f9[_0xd9e6('0x24')],_0x3e8b29=_0x3b17f9[_0xd9e6('0x24')]+_0x3b17f9[_0xd9e6('0x25')],_0x582949;if(_0x3e8b29>=_0x3ea715){_0x3e8b29=_0x3ea715;_0x582949=0xc8;}else{_0x582949=0xce;}_0x3a8c62[_0xd9e6('0x21')](_0x582949);return _0x3a8c62[_0xd9e6('0x26')](_0xd9e6('0x27'),_0x147a4f+'-'+_0x3e8b29+'/'+_0x3ea715)[_0xd9e6('0x28')](_0x33b7af);}return null;};}function patchUpdates(_0x3e98d6){return function(_0x874243){try{jsonpatch[_0xd9e6('0x29')](_0x874243,_0x3e98d6,!![]);}catch(_0x3c4043){return BPromise[_0xd9e6('0x2a')](_0x3c4043);}return _0x874243[_0xd9e6('0x2b')]();};}function saveUpdates(_0x5367c9,_0x339d5f){return function(_0x138473){if(_0x138473){return _0x138473[_0xd9e6('0x2c')](_0x5367c9)[_0xd9e6('0x2d')](function(_0x436a48){return _0x436a48;});}return null;};}function removeEntity(_0x19816d,_0x3dd95c){return function(_0x1d988c){if(_0x1d988c){return _0x1d988c['destroy']()[_0xd9e6('0x2d')](function(){_0x19816d[_0xd9e6('0x21')](0xcc)[_0xd9e6('0x22')]();});}};}function handleEntityNotFound(_0x53345f,_0x1a0942){return function(_0x5741f6){if(!_0x5741f6){_0x53345f[_0xd9e6('0x20')](0x194);}return _0x5741f6;};}function handleError(_0x33ac4e,_0x543b45){_0x543b45=_0x543b45||0x1f4;return function(_0x547d0e){logger[_0xd9e6('0x1b')](_0x547d0e[_0xd9e6('0x2e')]);if(_0x547d0e['name']){delete _0x547d0e[_0xd9e6('0x2f')];}_0x33ac4e['status'](_0x543b45)[_0xd9e6('0x30')](_0x547d0e);};}exports[_0xd9e6('0x31')]=function(_0x213d56,_0x3b1f0a){var _0x2c8d4f={},_0x3ca8e5={},_0x163521={'count':0x0,'rows':[]};var _0x20494c=db['SmsMessage']['rawAttributes'];_0x3ca8e5[_0xd9e6('0x32')]=_[_0xd9e6('0x33')](_0x20494c);var _0x2b0bc6={'dateStart':_0x213d56[_0xd9e6('0x34')][_0xd9e6('0x35')],'dateEnd':_0x213d56[_0xd9e6('0x34')][_0xd9e6('0x36')]};delete _0x213d56[_0xd9e6('0x34')]['dateStart'];delete _0x213d56[_0xd9e6('0x34')][_0xd9e6('0x36')];_0x3ca8e5[_0xd9e6('0x34')]=_['keys'](_0x213d56[_0xd9e6('0x34')]);_0x3ca8e5[_0xd9e6('0x37')]=_[_0xd9e6('0x38')](_0x3ca8e5[_0xd9e6('0x32')],_0x3ca8e5[_0xd9e6('0x34')]);_0x2c8d4f[_0xd9e6('0x39')]=_[_0xd9e6('0x38')](_0x3ca8e5['model'],qs['fields'](_0x213d56['query'][_0xd9e6('0x3a')]));_0x2c8d4f['attributes']=_0x2c8d4f['attributes'][_0xd9e6('0x3b')]?_0x2c8d4f[_0xd9e6('0x39')]:_0x3ca8e5[_0xd9e6('0x32')];if(!_0x213d56['query'][_0xd9e6('0x3c')](_0xd9e6('0x3d'))){_0x2c8d4f[_0xd9e6('0x25')]=qs['limit'](_0x213d56[_0xd9e6('0x34')][_0xd9e6('0x25')]);_0x2c8d4f[_0xd9e6('0x24')]=qs[_0xd9e6('0x24')](_0x213d56[_0xd9e6('0x34')]['offset']);}_0x2c8d4f[_0xd9e6('0x3e')]=qs['sort'](_0x213d56['query']['sort']);_0x2c8d4f[_0xd9e6('0x3f')]=qs[_0xd9e6('0x37')](_['pick'](_0x213d56[_0xd9e6('0x34')],_0x3ca8e5[_0xd9e6('0x37')]));if(_0x2b0bc6[_0xd9e6('0x35')]){if(_0x2b0bc6[_0xd9e6('0x36')]){_0x2b0bc6[_0xd9e6('0x36')]=moment(_0x2b0bc6[_0xd9e6('0x36')])[_0xd9e6('0x40')](0x1,_0xd9e6('0x41'));}else{_0x2b0bc6['dateEnd']=moment(_0x2b0bc6[_0xd9e6('0x35')])[_0xd9e6('0x40')](0x1,_0xd9e6('0x41'));}_[_0xd9e6('0x42')](_0x2c8d4f[_0xd9e6('0x3f')],{'createdAt':{'$gte':_0x2b0bc6[_0xd9e6('0x35')],'$lte':_0x2b0bc6[_0xd9e6('0x36')]}});}if(_0x213d56[_0xd9e6('0x34')][_0xd9e6('0x43')]){_0x2c8d4f['where']=_[_0xd9e6('0x42')](_0x2c8d4f[_0xd9e6('0x3f')],{'$or':_[_0xd9e6('0x44')](_0x2c8d4f[_0xd9e6('0x39')],function(_0x232544){var _0x215fee={};_0x215fee[_0x232544]={'$like':'%'+_0x213d56[_0xd9e6('0x34')][_0xd9e6('0x43')]+'%'};return _0x215fee;})});}_0x2c8d4f=_['merge']({},_0x2c8d4f,_0x213d56[_0xd9e6('0x45')]);var _0x43ac5d={'where':_0x2c8d4f[_0xd9e6('0x3f')]};return db[_0xd9e6('0x46')][_0xd9e6('0x23')](_0x43ac5d)[_0xd9e6('0x2d')](function(_0xd22c56){_0x163521[_0xd9e6('0x23')]=_0xd22c56;if(_0x213d56[_0xd9e6('0x34')]['includeAll']){_0x2c8d4f[_0xd9e6('0x47')]=[{'all':!![]}];}return db[_0xd9e6('0x46')][_0xd9e6('0x48')](_0x2c8d4f);})['then'](function(_0x351002){_0x163521[_0xd9e6('0x49')]=_0x351002;return _0x163521;})[_0xd9e6('0x2d')](respondWithFilteredResult(_0x3b1f0a,_0x2c8d4f))[_0xd9e6('0x1f')](handleError(_0x3b1f0a,null));};exports[_0xd9e6('0x4a')]=function(_0x445a28,_0x1114f0){var _0xef0f65={'raw':!![],'where':{'id':_0x445a28[_0xd9e6('0x4b')]['id']}},_0x11d000={};_0x11d000[_0xd9e6('0x32')]=_['keys'](db['SmsMessage'][_0xd9e6('0x4c')]);_0x11d000[_0xd9e6('0x34')]=_[_0xd9e6('0x33')](_0x445a28[_0xd9e6('0x34')]);_0x11d000[_0xd9e6('0x37')]=_[_0xd9e6('0x38')](_0x11d000['model'],_0x11d000[_0xd9e6('0x34')]);_0xef0f65['attributes']=_[_0xd9e6('0x38')](_0x11d000[_0xd9e6('0x32')],qs[_0xd9e6('0x3a')](_0x445a28[_0xd9e6('0x34')][_0xd9e6('0x3a')]));_0xef0f65['attributes']=_0xef0f65['attributes'][_0xd9e6('0x3b')]?_0xef0f65[_0xd9e6('0x39')]:_0x11d000['model'];if(_0x445a28[_0xd9e6('0x34')][_0xd9e6('0x4d')]){_0xef0f65[_0xd9e6('0x47')]=[{'all':!![]}];}_0xef0f65=_[_0xd9e6('0x42')]({},_0xef0f65,_0x445a28['options']);return db[_0xd9e6('0x46')]['find'](_0xef0f65)[_0xd9e6('0x2d')](handleEntityNotFound(_0x1114f0,null))[_0xd9e6('0x2d')](respondWithResult(_0x1114f0,null))[_0xd9e6('0x1f')](handleError(_0x1114f0,null));};exports[_0xd9e6('0x4e')]=function(_0x41efd5,_0x13b13c){return db[_0xd9e6('0x46')][_0xd9e6('0x4e')](_0x41efd5[_0xd9e6('0x4f')],{})[_0xd9e6('0x2d')](respondWithResult(_0x13b13c,0xc9))[_0xd9e6('0x1f')](handleError(_0x13b13c,null));};exports[_0xd9e6('0x2c')]=function(_0x843af6,_0x47df54){if(_0x843af6[_0xd9e6('0x4f')]['id']){delete _0x843af6[_0xd9e6('0x4f')]['id'];}return db['SmsMessage'][_0xd9e6('0x50')]({'where':{'id':_0x843af6[_0xd9e6('0x4b')]['id']}})[_0xd9e6('0x2d')](handleEntityNotFound(_0x47df54,null))['then'](saveUpdates(_0x843af6[_0xd9e6('0x4f')],null))['then'](respondWithResult(_0x47df54,null))[_0xd9e6('0x1f')](handleError(_0x47df54,null));};exports['destroy']=function(_0x386634,_0x25dcc2){return db[_0xd9e6('0x46')]['find']({'where':{'id':_0x386634['params']['id']}})['then'](handleEntityNotFound(_0x25dcc2,null))['then'](removeEntity(_0x25dcc2,null))[_0xd9e6('0x1f')](handleError(_0x25dcc2,null));};exports[_0xd9e6('0x51')]=function(_0x5e3957,_0x4dfa7e){return db[_0xd9e6('0x46')][_0xd9e6('0x51')]()[_0xd9e6('0x2d')](respondWithResult(_0x4dfa7e,null))[_0xd9e6('0x1f')](handleError(_0x4dfa7e,null));};var interaction_log=require(_0xd9e6('0xc'))('sms-interactions');exports[_0xd9e6('0x52')]=function(_0xbca337,_0x18e1e1,_0x309785){var _0xee5fed={'channel':'sms'};if(_0xbca337['body']['id']){delete _0xbca337[_0xd9e6('0x4f')]['id'];}_0xbca337[_0xd9e6('0x4f')][_0xd9e6('0x53')]=!![];_0xbca337[_0xd9e6('0x4f')][_0xd9e6('0x54')]=moment()[_0xd9e6('0x55')](_0xd9e6('0x56'));_0xbca337[_0xd9e6('0x4f')][_0xd9e6('0x57')]=_0xbca337[_0xd9e6('0x4f')][_0xd9e6('0x57')]||_0xbca337[_0xd9e6('0x58')]['id'];return db['SmsMessage'][_0xd9e6('0x50')]({'where':{'id':_0xbca337[_0xd9e6('0x4b')]['id'],'UserId':null},'include':[{'model':db[_0xd9e6('0x59')],'as':_0xd9e6('0x5a')}]})[_0xd9e6('0x2d')](handleEntityNotFound(_0x18e1e1,null))[_0xd9e6('0x2d')](saveUpdates(_0xbca337[_0xd9e6('0x4f')],null))[_0xd9e6('0x2d')](function(_0x4a87f2){if(_0x4a87f2){_0xee5fed[_0xd9e6('0x1d')]=_0x4a87f2[_0xd9e6('0x5b')]({'plain':!![]});return db[_0xd9e6('0x5c')][_0xd9e6('0x50')]({'where':{'id':_0x4a87f2[_0xd9e6('0x5d')]}});}return null;})[_0xd9e6('0x2d')](handleEntityNotFound(_0x18e1e1,null))[_0xd9e6('0x2d')](function(_0x3d510e){if(_0x3d510e){return _0x3d510e[_0xd9e6('0x2c')]({'UserId':_0xbca337['body'][_0xd9e6('0x57')],'read1stAt':_[_0xd9e6('0x5e')](_0x3d510e[_0xd9e6('0x5f')])?moment()[_0xd9e6('0x55')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd9e6('0x2d')](function(_0x7c019b){if(_0x7c019b){_0xee5fed[_0xd9e6('0x60')]=_0x7c019b[_0xd9e6('0x5b')]({'plain':!![]});interaction_log['info'](_0xd9e6('0x61'),_0xbca337[_0xd9e6('0x58')]['id'],_0xbca337[_0xd9e6('0x58')][_0xd9e6('0x2f')],_0xbca337[_0xd9e6('0x58')]['role'],_0xee5fed[_0xd9e6('0x60')]['id'],_0xbca337[_0xd9e6('0x4f')]?JSON[_0xd9e6('0x1a')](_0xbca337[_0xd9e6('0x4f')]):_0xd9e6('0x62'));return respondWithRpcPromise(_0xd9e6('0x63'),_0xd9e6('0x64'),_0xee5fed);}return null;})[_0xd9e6('0x2d')](function(_0x12e086){if(_0x12e086){if(_0xbca337['body'][_0xd9e6('0x65')]){_0xee5fed[_0xd9e6('0x1d')][_0xd9e6('0x66')]=util[_0xd9e6('0x55')](_0xd9e6('0x67'),_0xbca337[_0xd9e6('0x58')][_0xd9e6('0x2f')]);_0xee5fed[_0xd9e6('0x1d')]['channel']=_0xee5fed['channel'];_0xee5fed[_0xd9e6('0x1d')]['event']='accept';return respondWithRpcPromise(_0xd9e6('0x68'),_0xd9e6('0x68'),{'event':_0xd9e6('0x69'),'message':_0xee5fed[_0xd9e6('0x1d')]},client9002)[_0xd9e6('0x2d')](function(){return _0xee5fed;});}return _0xee5fed;}return null;})['then'](respondWithResult(_0x18e1e1,null))[_0xd9e6('0x1f')](handleError(_0x18e1e1,null));};var interaction_log=require('../../config/logger')(_0xd9e6('0x6a'));exports[_0xd9e6('0x2a')]=function(_0x21dd82,_0x1b133c,_0x1424b4){var _0x4f11b4={'agent':{},'channel':_0xd9e6('0x6b')};if(_0x21dd82[_0xd9e6('0x4f')]['id']){delete _0x21dd82[_0xd9e6('0x4f')]['id'];}_0x21dd82[_0xd9e6('0x4f')][_0xd9e6('0x57')]=_0x21dd82[_0xd9e6('0x4f')][_0xd9e6('0x57')]||_0x21dd82[_0xd9e6('0x58')]['id'];_0x4f11b4['agent']['id']=_0x21dd82[_0xd9e6('0x4f')][_0xd9e6('0x57')];return db[_0xd9e6('0x46')][_0xd9e6('0x50')]({'where':{'id':_0x21dd82[_0xd9e6('0x4b')]['id'],'UserId':null}})[_0xd9e6('0x2d')](handleEntityNotFound(_0x1b133c,null))['then'](function(_0x384c26){if(_0x384c26){_0x4f11b4['message']=_0x384c26['get']({'plain':!![]});return db[_0xd9e6('0x5c')][_0xd9e6('0x50')]({'where':{'id':_0x384c26['SmsInteractionId']}});}return null;})[_0xd9e6('0x2d')](handleEntityNotFound(_0x1b133c,null))['then'](function(_0x1a4308){if(_0x1a4308){_0x4f11b4['interaction']=_0x1a4308[_0xd9e6('0x5b')]({'plain':!![]});interaction_log[_0xd9e6('0x16')](_0xd9e6('0x6c'),_0x21dd82[_0xd9e6('0x58')]['id'],_0x21dd82['user']['name'],_0x21dd82['user'][_0xd9e6('0x6d')],_0x4f11b4[_0xd9e6('0x60')]['id'],_0x21dd82[_0xd9e6('0x4f')]?JSON[_0xd9e6('0x1a')](_0x21dd82['body']):_0xd9e6('0x62'));return respondWithRpcPromise(_0xd9e6('0x6e'),_0xd9e6('0x6f'),_0x4f11b4);}return null;})['then'](function(_0x5648f8){if(_0x5648f8){_0x5648f8[_0xd9e6('0x1d')][_0xd9e6('0x66')]=util[_0xd9e6('0x55')](_0xd9e6('0x67'),_0x21dd82[_0xd9e6('0x58')]['name']);_0x5648f8[_0xd9e6('0x1d')][_0xd9e6('0x70')]=_0x4f11b4[_0xd9e6('0x70')];_0x5648f8[_0xd9e6('0x1d')][_0xd9e6('0x71')]=_0xd9e6('0x2a');respondWithRpcPromise(_0xd9e6('0x68'),'EventManager',{'event':_0xd9e6('0x72'),'message':_0x5648f8[_0xd9e6('0x1d')]},client9002);return _0x4f11b4;}return null;})[_0xd9e6('0x2d')](respondWithResult(_0x1b133c,null))['catch'](handleError(_0x1b133c,null));};exports['status']=function(_0x2f40ab,_0xd50cf3,_0x209e17){if(_0x2f40ab['body']['id']){delete _0x2f40ab[_0xd9e6('0x4f')]['id'];}var _0x1c44b6;return db[_0xd9e6('0x46')]['find']({'where':{'id':_0x2f40ab['params']['id']}})[_0xd9e6('0x2d')](handleEntityNotFound(_0xd50cf3,null))['then'](function(_0xef7370){if(_0xef7370){_0x1c44b6=_0xef7370;return db[_0xd9e6('0x73')]['find']({'where':{'id':_0xef7370['SmsAccountId']}});}})[_0xd9e6('0x2d')](handleEntityNotFound(_0xd50cf3,null))[_0xd9e6('0x2d')](function(_0x1243ac){if(_0x1243ac){logger[_0xd9e6('0x19')](_0xd9e6('0x74'),_0xd9e6('0x21'),'received\x20delivery\x20report\x20from',_0x1243ac['type'],util[_0xd9e6('0x75')](_0x2f40ab[_0xd9e6('0x4f')],{'showHidden':![],'depth':null}));switch(_0x1243ac['type']){case _0xd9e6('0x76'):if(_0x2f40ab[_0xd9e6('0x4f')][_0xd9e6('0x77')]&&_0x2f40ab[_0xd9e6('0x4f')][_0xd9e6('0x77')]===_0x1c44b6['messageId']){return _0x1c44b6[_0xd9e6('0x2c')]({'read':!![]});}break;case _0xd9e6('0x78'):if(_0x2f40ab[_0xd9e6('0x4f')][_0xd9e6('0x79')]&&_0x2f40ab['body'][_0xd9e6('0x79')]===_0x1c44b6['messageId']&&_['indexOf']([_0xd9e6('0x7a'),_0xd9e6('0x7b')],_0x2f40ab[_0xd9e6('0x4f')][_0xd9e6('0x7c')])>=0x0){return _0x1c44b6[_0xd9e6('0x2c')]({'read':!![]});}break;}return _0x1c44b6;}})['then'](respondWithResult(_0xd50cf3,null))[_0xd9e6('0x1f')](handleError(_0xd50cf3,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index dffb74b..de81a23 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 _0x7a92=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x2086e1,_0x871e5b){var _0x346d38=function(_0x23a688){while(--_0x23a688){_0x2086e1['push'](_0x2086e1['shift']());}};_0x346d38(++_0x871e5b);}(_0x7a92,0x1bc));var _0x27a9=function(_0x432c45,_0xb2a7f0){_0x432c45=_0x432c45-0x0;var _0x91e1e8=_0x7a92[_0x432c45];return _0x91e1e8;};'use strict';var EventEmitter=require(_0x27a9('0x0'));var SmsMessage=require(_0x27a9('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x27a9('0x2')](0x0);var events={'afterCreate':_0x27a9('0x3'),'afterUpdate':_0x27a9('0x4'),'afterDestroy':_0x27a9('0x5')};function emitEvent(_0x386ee5){return function(_0x338804,_0x3e694f,_0x3dd5b0){SmsMessageEvents[_0x27a9('0x6')](_0x386ee5+':'+_0x338804['id'],_0x338804);SmsMessageEvents[_0x27a9('0x6')](_0x386ee5,_0x338804);_0x3dd5b0(null);};}for(var e in events){if(events[_0x27a9('0x7')](e)){var event=events[e];SmsMessage[_0x27a9('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xdc3d=['hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save','update','remove','emit'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0xdc3d,0x92));var _0xddc3=function(_0x2d84af,_0x4728ea){_0x2d84af=_0x2d84af-0x0;var _0xa02349=_0xdc3d[_0x2d84af];return _0xa02349;};'use strict';var EventEmitter=require(_0xddc3('0x0'));var SmsMessage=require(_0xddc3('0x1'))['db'][_0xddc3('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xddc3('0x3'),'afterUpdate':_0xddc3('0x4'),'afterDestroy':_0xddc3('0x5')};function emitEvent(_0x48501b){return function(_0x3365c4,_0xdc3f95,_0x258fcf){SmsMessageEvents[_0xddc3('0x6')](_0x48501b+':'+_0x3365c4['id'],_0x3365c4);SmsMessageEvents[_0xddc3('0x6')](_0x48501b,_0x3365c4);_0x258fcf(null);};}for(var e in events){if(events[_0xddc3('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xddc3('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index efff993..64192c1 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 _0x47ac=['send_sms_classic','sender_number','senderString','sender_string','classic+','stringify','POST','https://gateway.skebby.it/api/send/smseasy/advanced/http.php','application/x-www-form-urlencoded','utf8','success','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','base64','http_code','data','queued_count','head','message_id','read','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','finally','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','models','get','direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','body','error','SmsAccountId','type','twilio','phone','accountSid','authToken','messages','create','remote','/status?token=','token','then','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','querystring','username','password','UTF-8','basic','send_sms_basic','method'];(function(_0x539b1f,_0x3f1b18){var _0xb22413=function(_0x36d03d){while(--_0x36d03d){_0x539b1f['push'](_0x539b1f['shift']());}};_0xb22413(++_0x3f1b18);}(_0x47ac,0x1d7));var _0xc47a=function(_0x4532b0,_0x27c4bf){_0x4532b0=_0x4532b0-0x0;var _0x179bff=_0x47ac[_0x4532b0];return _0x179bff;};'use strict';var _=require(_0xc47a('0x0'));var util=require('util');var logger=require(_0xc47a('0x1'))('api');var moment=require(_0xc47a('0x2'));var BPromise=require(_0xc47a('0x3'));var rp=require(_0xc47a('0x4'));var attributes=require(_0xc47a('0x5'));module[_0xc47a('0x6')]=function(_0x2faf4c,_0x40fc5b){return _0x2faf4c[_0xc47a('0x7')](_0xc47a('0x8'),attributes,{'tableName':_0xc47a('0x9'),'paranoid':![],'indexes':[{'name':_0xc47a('0xa'),'fields':[_0xc47a('0xa')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x505a4a,_0x4d502e,_0x2236a0){var _0x53ad20=_0x2faf4c[_0xc47a('0xb')];var _0x102a3f=_0x505a4a[_0xc47a('0xc')]({'plain':!![]});if(_0x102a3f[_0xc47a('0xd')]['toLowerCase']()==='in'||_0x102a3f[_0xc47a('0xd')]['toLowerCase']()===_0xc47a('0xe')&&!_0x102a3f[_0xc47a('0xf')]&&!_[_0xc47a('0x10')](_0x102a3f[_0xc47a('0x11')])){_0x53ad20[_0xc47a('0x12')][_0xc47a('0x13')]({'where':{'id':_0x102a3f[_0xc47a('0x14')]}})['then'](function(_0x33556d){if(_0x33556d){_0x33556d[_0xc47a('0x15')]({'lastMsgAt':_0x102a3f[_0xc47a('0x16')],'lastMsgDirection':_0x102a3f[_0xc47a('0xd')]['toLowerCase'](),'lastMsgBody':_0x102a3f[_0xc47a('0x17')]});}})['catch'](function(_0x29ab91){console[_0xc47a('0x18')](_0x29ab91);});}if(_0x102a3f['direction']===_0xc47a('0xe')&&!_0x102a3f['secret']){var _0x348126;_0x53ad20['SmsAccount']['find']({'where':{'id':_0x102a3f[_0xc47a('0x19')]},'raw':!![]})['then'](function(_0x388fe5){_0x348126=_0x388fe5;if(_0x348126&&_0x348126[_0xc47a('0x1a')]){switch(_0x348126[_0xc47a('0x1a')]){case'twilio':var _0x4525b9=require(_0xc47a('0x1b'));if(_0x348126['accountSid']&&_0x348126['authToken']&&_0x348126[_0xc47a('0x1c')]){var _0x2ba0ac=new _0x4525b9(_0x348126[_0xc47a('0x1d')],_0x348126[_0xc47a('0x1e')]);_0x2ba0ac[_0xc47a('0x1f')][_0xc47a('0x20')]({'body':_0x102a3f['body'],'to':_0x102a3f['phone'],'from':_0x348126[_0xc47a('0x1c')],'statusCallback':_0x348126[_0xc47a('0x21')]+'/api/sms/messages/'+_0x102a3f['id']+_0xc47a('0x22')+_0x348126[_0xc47a('0x23')]})[_0xc47a('0x24')](function(_0x271968){if(_0x271968[_0xc47a('0x25')]){return _0x505a4a['update']({'messageId':_0x271968[_0xc47a('0x25')]});}})[_0xc47a('0x26')](function(_0x35e3c7){logger[_0xc47a('0x18')](_0xc47a('0x27'),_0xc47a('0x28'),_0xc47a('0x1b'),util[_0xc47a('0x29')](_0x35e3c7,{'showHidden':![],'depth':null}));});}else{logger[_0xc47a('0x18')](_0xc47a('0x27'),'afterCreate',_0xc47a('0x1b'),_0xc47a('0x2a'));}break;case _0xc47a('0x2b'):var _0x4b80bf=require(_0xc47a('0x2c'));if(_0x348126[_0xc47a('0x2d')]&&_0x348126['password']){var _0x4ec625={'username':_0x348126[_0xc47a('0x2d')],'password':_0x348126[_0xc47a('0x2e')],'recipients[]':[_0x102a3f[_0xc47a('0x1c')]],'text':_0x102a3f['body'],'charset':_0xc47a('0x2f')};switch(_0x348126['smsMethod']){case _0xc47a('0x30'):_0x4ec625['method']=_0xc47a('0x31');break;case'classic':_0x4ec625[_0xc47a('0x32')]=_0xc47a('0x33');_0x4ec625[_0xc47a('0x34')]=_0x348126[_0xc47a('0x1c')];if(_0x348126[_0xc47a('0x35')]){_0x4ec625[_0xc47a('0x36')]=_0x348126[_0xc47a('0x35')];}else if(_0x348126[_0xc47a('0x1c')]){_0x4ec625[_0xc47a('0x34')]=_0x348126[_0xc47a('0x1c')];}break;case _0xc47a('0x37'):_0x4ec625['method']='send_sms_classic_report';_0x4ec625['sender_number']=_0x348126[_0xc47a('0x1c')];if(_0x348126[_0xc47a('0x35')]){_0x4ec625[_0xc47a('0x36')]=_0x348126[_0xc47a('0x35')];}else if(_0x348126[_0xc47a('0x1c')]){_0x4ec625[_0xc47a('0x34')]=_0x348126[_0xc47a('0x1c')];}break;}var _0x2bc344=_0x4b80bf[_0xc47a('0x38')](_0x4ec625);var _0x4d502e={'method':_0xc47a('0x39'),'uri':_0xc47a('0x3a'),'body':_0x2bc344,'headers':{'Content-Type':_0xc47a('0x3b'),'Content-Length':_0x2bc344['length'],'Content-Encoding':_0xc47a('0x3c')}};rp(_0x4d502e)[_0xc47a('0x24')](function(_0x2462f3){var _0xe94da1=_0x4b80bf['parse'](_0x2462f3);if(_0xe94da1['status']==_0xc47a('0x3d')){var _0xde2afc={'messageId':_0xe94da1['id']};if(_0x348126['smsMethod']!==_0xc47a('0x37')||!_0x348126['deliveryReport']){_0xde2afc['read']=!![];}return _0x505a4a[_0xc47a('0x15')](_0xde2afc);}else{logger[_0xc47a('0x18')](_0xc47a('0x27'),_0xc47a('0x28'),_0xc47a('0x2b'),util[_0xc47a('0x29')](_0xe94da1,{'showHidden':![],'depth':null}));}})['catch'](function(_0xe8df21){logger[_0xc47a('0x18')](_0xc47a('0x27'),_0xc47a('0x28'),_0xc47a('0x2b'),util[_0xc47a('0x29')](_0xe8df21,{'showHidden':![],'depth':null}));});}else{logger[_0xc47a('0x18')](_0xc47a('0x27'),'afterCreate','skebby',_0xc47a('0x3e'));}break;case _0xc47a('0x3f'):if(_0x348126[_0xc47a('0x1e')]){var _0x4ec625={'recipient':_0x102a3f[_0xc47a('0x1c')],'message':_0x102a3f[_0xc47a('0x17')],'sender':_0x348126[_0xc47a('0x35')]||_0x348126['phone'],'authorization':_0x348126[_0xc47a('0x1e')]};var _0x4d502e={'method':'POST','uri':_0xc47a('0x40'),'body':_0x4ec625,'json':!![]};rp(_0x4d502e)['then'](function(_0x4a228f){var _0x330f6f={'messageId':_0x4a228f[_0xc47a('0x41')]};if(!_0x348126[_0xc47a('0x42')]){_0x330f6f['read']=!![];}return _0x505a4a[_0xc47a('0x15')](_0x330f6f);})['catch'](function(_0x3ddf93){logger[_0xc47a('0x18')](_0xc47a('0x27'),'afterCreate',_0xc47a('0x3f'),util[_0xc47a('0x29')](_0x3ddf93,{'showHidden':![],'depth':null}));});}else{logger[_0xc47a('0x18')](_0xc47a('0x27'),_0xc47a('0x28'),_0xc47a('0x3f'),_0xc47a('0x43'));}break;case'clicksend':if(_0x348126['username']&&_0x348126[_0xc47a('0x2e')]){var _0x4ec625={'messages':[{'source':_0xc47a('0x44'),'to':_0x102a3f[_0xc47a('0x1c')],'body':_0x102a3f[_0xc47a('0x17')],'from':_0x348126['senderString']||_0x348126['phone']}]};var _0x54a880=util['format'](_0xc47a('0x45'),_0x348126[_0xc47a('0x2d')],_0x348126[_0xc47a('0x2e')]);var _0x4d502e={'method':_0xc47a('0x39'),'uri':_0xc47a('0x46'),'body':_0x4ec625,'headers':{'Authorization':util[_0xc47a('0x47')]('Basic\x20%s',new Buffer(_0x54a880)['toString'](_0xc47a('0x48')))},'json':!![]};rp(_0x4d502e)[_0xc47a('0x24')](function(_0x42e934){if(_0x42e934['http_code']>=0xc8&&_0x42e934[_0xc47a('0x49')]<=0xce){if(_0x42e934[_0xc47a('0x4a')]&&_0x42e934[_0xc47a('0x4a')][_0xc47a('0x4b')]>0x0){var _0x59d6b7=_[_0xc47a('0x4c')](_0x42e934[_0xc47a('0x4a')][_0xc47a('0x1f')]);var _0x5db714={'messageId':_0x59d6b7[_0xc47a('0x4d')]};if(!_0x348126['deliveryReport']){_0x5db714[_0xc47a('0x4e')]=!![];}return _0x505a4a[_0xc47a('0x15')](_0x5db714);}else{logger[_0xc47a('0x18')](_0xc47a('0x27'),_0xc47a('0x28'),_0xc47a('0x4f'),util[_0xc47a('0x29')](_0x42e934,{'showHidden':![],'depth':null}));}}else{logger[_0xc47a('0x18')](_0xc47a('0x27'),_0xc47a('0x28'),_0xc47a('0x4f'),util[_0xc47a('0x29')](_0x42e934,{'showHidden':![],'depth':null}));}})[_0xc47a('0x26')](function(_0x32fdbe){logger['error'](_0xc47a('0x27'),_0xc47a('0x28'),_0xc47a('0x4f'),util[_0xc47a('0x29')](_0x32fdbe,{'showHidden':![],'depth':null}));});}else{logger[_0xc47a('0x18')](_0xc47a('0x27'),'afterCreate',_0xc47a('0x4f'),_0xc47a('0x3e'));}break;case _0xc47a('0x50'):if(_0x348126[_0xc47a('0x51')]&&_0x348126[_0xc47a('0x1e')]){var _0x4ec625={'dst':_0x102a3f[_0xc47a('0x1c')],'text':_0x102a3f[_0xc47a('0x17')],'src':_0x348126['senderString']||_0x348126[_0xc47a('0x1c')],'url':_0x348126[_0xc47a('0x21')]+'/api/sms/messages/'+_0x102a3f['id']+_0xc47a('0x22')+_0x348126[_0xc47a('0x23')]};var _0x54a880=util[_0xc47a('0x47')](_0xc47a('0x45'),_0x348126[_0xc47a('0x51')],_0x348126['authToken']);var _0x4d502e={'method':_0xc47a('0x39'),'uri':util[_0xc47a('0x47')](_0xc47a('0x52'),_0x348126[_0xc47a('0x51')]),'body':_0x4ec625,'headers':{'Authorization':util[_0xc47a('0x47')](_0xc47a('0x53'),new Buffer(_0x54a880)[_0xc47a('0x54')]('base64'))},'json':!![]};rp(_0x4d502e)[_0xc47a('0x24')](function(_0x3c0003){var _0x130866={'messageId':_0x3c0003['message_uuid'][0x0]};return _0x505a4a[_0xc47a('0x15')](_0x130866);})[_0xc47a('0x26')](function(_0x4849c5){logger[_0xc47a('0x18')](_0xc47a('0x27'),_0xc47a('0x28'),_0xc47a('0x50'),util[_0xc47a('0x29')](_0x4849c5,{'showHidden':![],'depth':null}));});}else{logger[_0xc47a('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc47a('0x28'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;}}})[_0xc47a('0x55')](function(){_0x2236a0();});}else{_0x2236a0();}}},'charset':'utf8mb4','collate':_0xc47a('0x56')});}; \ No newline at end of file +var _0xa7a3=['format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','models','get','toLowerCase','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','body','catch','error','direction','SmsAccount','find','type','twilio','accountSid','authToken','messages','create','phone','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','querystring','username','password','UTF-8','basic','send_sms_basic','classic','method','send_sms_classic','sender_number','senderString','classic+','send_sms_classic_report','sender_string','stringify','POST','application/x-www-form-urlencoded','length','utf8','parse','status','success','smsMethod','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','clicksend'];(function(_0x1f3579,_0x275ae2){var _0x307378=function(_0x1c6929){while(--_0x1c6929){_0x1f3579['push'](_0x1f3579['shift']());}};_0x307378(++_0x275ae2);}(_0xa7a3,0x1ee));var _0x3a7a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xa7a3[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x3a7a('0x0'));var util=require(_0x3a7a('0x1'));var logger=require(_0x3a7a('0x2'))(_0x3a7a('0x3'));var moment=require('moment');var BPromise=require(_0x3a7a('0x4'));var rp=require('request-promise');var attributes=require(_0x3a7a('0x5'));module[_0x3a7a('0x6')]=function(_0x531fbd,_0x3968d8){return _0x531fbd[_0x3a7a('0x7')](_0x3a7a('0x8'),attributes,{'tableName':_0x3a7a('0x9'),'paranoid':![],'indexes':[{'name':_0x3a7a('0xa'),'fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x387b31,_0x4105bf,_0x17807d){var _0x5ab777=_0x531fbd[_0x3a7a('0xb')];var _0x4b4872=_0x387b31[_0x3a7a('0xc')]({'plain':!![]});if(_0x4b4872['direction']['toLowerCase']()==='in'||_0x4b4872['direction'][_0x3a7a('0xd')]()===_0x3a7a('0xe')&&!_0x4b4872[_0x3a7a('0xf')]&&!_[_0x3a7a('0x10')](_0x4b4872['UserId'])){_0x5ab777[_0x3a7a('0x11')][_0x3a7a('0x12')]({'where':{'id':_0x4b4872[_0x3a7a('0x13')]}})[_0x3a7a('0x14')](function(_0x6c5261){if(_0x6c5261){_0x6c5261[_0x3a7a('0x15')]({'lastMsgAt':_0x4b4872[_0x3a7a('0x16')],'lastMsgDirection':_0x4b4872['direction']['toLowerCase'](),'lastMsgBody':_0x4b4872[_0x3a7a('0x17')]});}})[_0x3a7a('0x18')](function(_0x2be75b){console[_0x3a7a('0x19')](_0x2be75b);});}if(_0x4b4872[_0x3a7a('0x1a')]==='out'&&!_0x4b4872[_0x3a7a('0xf')]){var _0x1f34b7;_0x5ab777[_0x3a7a('0x1b')][_0x3a7a('0x1c')]({'where':{'id':_0x4b4872['SmsAccountId']},'raw':!![]})[_0x3a7a('0x14')](function(_0x488e74){_0x1f34b7=_0x488e74;if(_0x1f34b7&&_0x1f34b7['type']){switch(_0x1f34b7[_0x3a7a('0x1d')]){case _0x3a7a('0x1e'):var _0x38f303=require('twilio');if(_0x1f34b7[_0x3a7a('0x1f')]&&_0x1f34b7[_0x3a7a('0x20')]&&_0x1f34b7['phone']){var _0x3875e8=new _0x38f303(_0x1f34b7[_0x3a7a('0x1f')],_0x1f34b7['authToken']);_0x3875e8[_0x3a7a('0x21')][_0x3a7a('0x22')]({'body':_0x4b4872[_0x3a7a('0x17')],'to':_0x4b4872[_0x3a7a('0x23')],'from':_0x1f34b7['phone'],'statusCallback':_0x1f34b7['remote']+_0x3a7a('0x24')+_0x4b4872['id']+_0x3a7a('0x25')+_0x1f34b7[_0x3a7a('0x26')]})['then'](function(_0x214051){if(_0x214051[_0x3a7a('0x27')]){return _0x387b31[_0x3a7a('0x15')]({'messageId':_0x214051[_0x3a7a('0x27')]});}})[_0x3a7a('0x18')](function(_0xe048ae){logger['error'](_0x3a7a('0x28'),_0x3a7a('0x29'),_0x3a7a('0x1e'),util[_0x3a7a('0x2a')](_0xe048ae,{'showHidden':![],'depth':null}));});}else{logger[_0x3a7a('0x19')](_0x3a7a('0x28'),'afterCreate',_0x3a7a('0x1e'),_0x3a7a('0x2b'));}break;case _0x3a7a('0x2c'):var _0x3e0389=require(_0x3a7a('0x2d'));if(_0x1f34b7[_0x3a7a('0x2e')]&&_0x1f34b7[_0x3a7a('0x2f')]){var _0x4e7ae8={'username':_0x1f34b7[_0x3a7a('0x2e')],'password':_0x1f34b7['password'],'recipients[]':[_0x4b4872[_0x3a7a('0x23')]],'text':_0x4b4872['body'],'charset':_0x3a7a('0x30')};switch(_0x1f34b7['smsMethod']){case _0x3a7a('0x31'):_0x4e7ae8['method']=_0x3a7a('0x32');break;case _0x3a7a('0x33'):_0x4e7ae8[_0x3a7a('0x34')]=_0x3a7a('0x35');_0x4e7ae8[_0x3a7a('0x36')]=_0x1f34b7['phone'];if(_0x1f34b7[_0x3a7a('0x37')]){_0x4e7ae8['sender_string']=_0x1f34b7[_0x3a7a('0x37')];}else if(_0x1f34b7[_0x3a7a('0x23')]){_0x4e7ae8[_0x3a7a('0x36')]=_0x1f34b7[_0x3a7a('0x23')];}break;case _0x3a7a('0x38'):_0x4e7ae8[_0x3a7a('0x34')]=_0x3a7a('0x39');_0x4e7ae8[_0x3a7a('0x36')]=_0x1f34b7[_0x3a7a('0x23')];if(_0x1f34b7[_0x3a7a('0x37')]){_0x4e7ae8[_0x3a7a('0x3a')]=_0x1f34b7['senderString'];}else if(_0x1f34b7[_0x3a7a('0x23')]){_0x4e7ae8['sender_number']=_0x1f34b7[_0x3a7a('0x23')];}break;}var _0x248631=_0x3e0389[_0x3a7a('0x3b')](_0x4e7ae8);var _0x4105bf={'method':_0x3a7a('0x3c'),'uri':'https://gateway.skebby.it/api/send/smseasy/advanced/http.php','body':_0x248631,'headers':{'Content-Type':_0x3a7a('0x3d'),'Content-Length':_0x248631[_0x3a7a('0x3e')],'Content-Encoding':_0x3a7a('0x3f')}};rp(_0x4105bf)[_0x3a7a('0x14')](function(_0x176ea5){var _0xfb44c5=_0x3e0389[_0x3a7a('0x40')](_0x176ea5);if(_0xfb44c5[_0x3a7a('0x41')]==_0x3a7a('0x42')){var _0x558fdf={'messageId':_0xfb44c5['id']};if(_0x1f34b7[_0x3a7a('0x43')]!=='classic+'||!_0x1f34b7[_0x3a7a('0x44')]){_0x558fdf[_0x3a7a('0x45')]=!![];}return _0x387b31[_0x3a7a('0x15')](_0x558fdf);}else{logger[_0x3a7a('0x19')](_0x3a7a('0x28'),_0x3a7a('0x29'),_0x3a7a('0x2c'),util[_0x3a7a('0x2a')](_0xfb44c5,{'showHidden':![],'depth':null}));}})[_0x3a7a('0x18')](function(_0x110d83){logger[_0x3a7a('0x19')](_0x3a7a('0x28'),_0x3a7a('0x29'),'skebby',util[_0x3a7a('0x2a')](_0x110d83,{'showHidden':![],'depth':null}));});}else{logger[_0x3a7a('0x19')](_0x3a7a('0x28'),_0x3a7a('0x29'),_0x3a7a('0x2c'),_0x3a7a('0x46'));}break;case _0x3a7a('0x47'):if(_0x1f34b7[_0x3a7a('0x20')]){var _0x4e7ae8={'recipient':_0x4b4872[_0x3a7a('0x23')],'message':_0x4b4872['body'],'sender':_0x1f34b7['senderString']||_0x1f34b7['phone'],'authorization':_0x1f34b7[_0x3a7a('0x20')]};var _0x4105bf={'method':'POST','uri':_0x3a7a('0x48'),'body':_0x4e7ae8,'json':!![]};rp(_0x4105bf)['then'](function(_0x2a437b){var _0x561acb={'messageId':_0x2a437b[_0x3a7a('0x49')]};if(!_0x1f34b7['deliveryReport']){_0x561acb['read']=!![];}return _0x387b31[_0x3a7a('0x15')](_0x561acb);})[_0x3a7a('0x18')](function(_0x52148e){logger[_0x3a7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3a7a('0x29'),'connectel',util['inspect'](_0x52148e,{'showHidden':![],'depth':null}));});}else{logger[_0x3a7a('0x19')](_0x3a7a('0x28'),_0x3a7a('0x29'),_0x3a7a('0x47'),_0x3a7a('0x4a'));}break;case _0x3a7a('0x4b'):if(_0x1f34b7[_0x3a7a('0x2e')]&&_0x1f34b7[_0x3a7a('0x2f')]){var _0x4e7ae8={'messages':[{'source':'xCALLY\x20Motion','to':_0x4b4872['phone'],'body':_0x4b4872[_0x3a7a('0x17')],'from':_0x1f34b7[_0x3a7a('0x37')]||_0x1f34b7[_0x3a7a('0x23')]}]};var _0x51b6d1=util[_0x3a7a('0x4c')](_0x3a7a('0x4d'),_0x1f34b7[_0x3a7a('0x2e')],_0x1f34b7[_0x3a7a('0x2f')]);var _0x4105bf={'method':'POST','uri':_0x3a7a('0x4e'),'body':_0x4e7ae8,'headers':{'Authorization':util[_0x3a7a('0x4c')](_0x3a7a('0x4f'),new Buffer(_0x51b6d1)[_0x3a7a('0x50')](_0x3a7a('0x51')))},'json':!![]};rp(_0x4105bf)[_0x3a7a('0x14')](function(_0x4d062c){if(_0x4d062c[_0x3a7a('0x52')]>=0xc8&&_0x4d062c[_0x3a7a('0x52')]<=0xce){if(_0x4d062c[_0x3a7a('0x53')]&&_0x4d062c['data']['queued_count']>0x0){var _0x49ebd2=_[_0x3a7a('0x54')](_0x4d062c[_0x3a7a('0x53')][_0x3a7a('0x21')]);var _0x21df4c={'messageId':_0x49ebd2[_0x3a7a('0x55')]};if(!_0x1f34b7['deliveryReport']){_0x21df4c[_0x3a7a('0x45')]=!![];}return _0x387b31[_0x3a7a('0x15')](_0x21df4c);}else{logger['error'](_0x3a7a('0x28'),_0x3a7a('0x29'),_0x3a7a('0x56'),util[_0x3a7a('0x2a')](_0x4d062c,{'showHidden':![],'depth':null}));}}else{logger[_0x3a7a('0x19')](_0x3a7a('0x28'),'afterCreate',_0x3a7a('0x56'),util['inspect'](_0x4d062c,{'showHidden':![],'depth':null}));}})[_0x3a7a('0x18')](function(_0x20ce0a){logger['error'](_0x3a7a('0x28'),_0x3a7a('0x29'),_0x3a7a('0x56'),util[_0x3a7a('0x2a')](_0x20ce0a,{'showHidden':![],'depth':null}));});}else{logger[_0x3a7a('0x19')](_0x3a7a('0x28'),_0x3a7a('0x29'),'clickSend',_0x3a7a('0x46'));}break;case _0x3a7a('0x57'):if(_0x1f34b7[_0x3a7a('0x58')]&&_0x1f34b7[_0x3a7a('0x20')]){var _0x4e7ae8={'dst':_0x4b4872['phone'],'text':_0x4b4872[_0x3a7a('0x17')],'src':_0x1f34b7[_0x3a7a('0x37')]||_0x1f34b7['phone'],'url':_0x1f34b7['remote']+_0x3a7a('0x24')+_0x4b4872['id']+_0x3a7a('0x25')+_0x1f34b7[_0x3a7a('0x26')]};var _0x51b6d1=util['format']('%s:%s',_0x1f34b7[_0x3a7a('0x58')],_0x1f34b7[_0x3a7a('0x20')]);var _0x4105bf={'method':_0x3a7a('0x3c'),'uri':util[_0x3a7a('0x4c')](_0x3a7a('0x59'),_0x1f34b7[_0x3a7a('0x58')]),'body':_0x4e7ae8,'headers':{'Authorization':util[_0x3a7a('0x4c')]('Basic\x20%s',new Buffer(_0x51b6d1)[_0x3a7a('0x50')](_0x3a7a('0x51')))},'json':!![]};rp(_0x4105bf)[_0x3a7a('0x14')](function(_0x581923){var _0x161e77={'messageId':_0x581923[_0x3a7a('0x5a')][0x0]};return _0x387b31[_0x3a7a('0x15')](_0x161e77);})['catch'](function(_0x4c7efb){logger['error'](_0x3a7a('0x28'),_0x3a7a('0x29'),_0x3a7a('0x57'),util[_0x3a7a('0x2a')](_0x4c7efb,{'showHidden':![],'depth':null}));});}else{logger[_0x3a7a('0x19')](_0x3a7a('0x28'),_0x3a7a('0x29'),_0x3a7a('0x57'),_0x3a7a('0x5b'));}break;}}})[_0x3a7a('0x5c')](function(){_0x17807d();});}else{_0x17807d();}}},'charset':_0x3a7a('0x5d'),'collate':_0x3a7a('0x5e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ecb4af7..ee6dfe1 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 _0xa093=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','socket.io-emitter','localhost','./smsMessage.socket','then','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','SmsMessage','body','raw','info','CreateSmsMessage','debug','lodash','util','moment'];(function(_0x599642,_0x54ae46){var _0xa7251e=function(_0x3ec181){while(--_0x3ec181){_0x599642['push'](_0x599642['shift']());}};_0xa7251e(++_0x54ae46);}(_0xa093,0x99));var _0x3a09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa093[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a09('0x0'));var util=require(_0x3a09('0x1'));var moment=require(_0x3a09('0x2'));var BPromise=require(_0x3a09('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x3a09('0x4'))['db'];var utils=require(_0x3a09('0x5'));var logger=require(_0x3a09('0x6'))(_0x3a09('0x7'));var config=require(_0x3a09('0x8'));var jayson=require(_0x3a09('0x9'));var client=jayson['client']['http']({'port':0x232a});var socket=require(_0x3a09('0xa'))({'host':_0x3a09('0xb'),'port':0x18eb});require(_0x3a09('0xc'))['register'](socket);function respondWithRpcPromise(_0x4be776,_0x5ffb86,_0x260a79){return new BPromise(function(_0x38eeb2,_0x23adda){return client['request'](_0x4be776,_0x260a79)[_0x3a09('0xd')](function(_0x4a4bcd){logger['info']('SmsMessage,\x20%s,\x20%s',_0x5ffb86,_0x3a09('0xe'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5ffb86,_0x3a09('0xe'),JSON[_0x3a09('0xf')](_0x4a4bcd));if(_0x4a4bcd['error']){if(_0x4a4bcd[_0x3a09('0x10')][_0x3a09('0x11')]===0x1f4){logger[_0x3a09('0x10')]('SmsMessage,\x20%s,\x20%s',_0x5ffb86,_0x4a4bcd[_0x3a09('0x10')]['message']);return _0x23adda(_0x4a4bcd['error'][_0x3a09('0x12')]);}logger[_0x3a09('0x10')](_0x3a09('0x13'),_0x5ffb86,_0x4a4bcd[_0x3a09('0x10')][_0x3a09('0x12')]);return _0x38eeb2(_0x4a4bcd[_0x3a09('0x10')][_0x3a09('0x12')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x5ffb86,_0x3a09('0xe'));_0x38eeb2(_0x4a4bcd['result'][_0x3a09('0x12')]);}})['catch'](function(_0xac5772){logger[_0x3a09('0x10')](_0x3a09('0x13'),_0x5ffb86,_0xac5772);_0x23adda(_0xac5772);});});}exports['CreateSmsMessage']=function(_0x3527e1){var _0x33b59e=this;return new Promise(function(_0x2b52c5,_0x12b15e){return db[_0x3a09('0x14')]['create'](_0x3527e1[_0x3a09('0x15')],{'raw':_0x3527e1['options']?_0x3527e1['options'][_0x3a09('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x160200){logger[_0x3a09('0x17')](_0x3a09('0x18'),_0x3527e1);logger[_0x3a09('0x19')](_0x3a09('0x18'),_0x3527e1,JSON[_0x3a09('0xf')](_0x160200));_0x2b52c5(_0x160200);})['catch'](function(_0x113892){logger[_0x3a09('0x10')](_0x3a09('0x18'),_0x113892[_0x3a09('0x12')],_0x3527e1);_0x12b15e(_0x33b59e[_0x3a09('0x10')](0x1f4,_0x113892[_0x3a09('0x12')]));});});}; \ No newline at end of file +var _0xe8b5=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateSmsMessage','SmsMessage','create','body','options','raw'];(function(_0x3e1fd2,_0x3b4092){var _0xb2958=function(_0x77aec9){while(--_0x77aec9){_0x3e1fd2['push'](_0x3e1fd2['shift']());}};_0xb2958(++_0x3b4092);}(_0xe8b5,0x1b3));var _0x5e8b=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0xe8b5[_0x470e67];return _0x28bbde;};'use strict';var _=require('lodash');var util=require(_0x5e8b('0x0'));var moment=require('moment');var BPromise=require(_0x5e8b('0x1'));var rs=require(_0x5e8b('0x2'));var fs=require('fs');var db=require(_0x5e8b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e8b('0x4'))(_0x5e8b('0x5'));var config=require('../../config/environment');var jayson=require(_0x5e8b('0x6'));var client=jayson[_0x5e8b('0x7')][_0x5e8b('0x8')]({'port':0x232a});var socket=require(_0x5e8b('0x9'))({'host':'localhost','port':0x18eb});require(_0x5e8b('0xa'))[_0x5e8b('0xb')](socket);function respondWithRpcPromise(_0x26b168,_0x3b3854,_0x148d89){return new BPromise(function(_0x465a5c,_0x3f79c2){return client[_0x5e8b('0xc')](_0x26b168,_0x148d89)[_0x5e8b('0xd')](function(_0x2d9893){logger['info'](_0x5e8b('0xe'),_0x3b3854,_0x5e8b('0xf'));logger[_0x5e8b('0x10')](_0x5e8b('0x11'),_0x3b3854,'request\x20sent',JSON[_0x5e8b('0x12')](_0x2d9893));if(_0x2d9893[_0x5e8b('0x13')]){if(_0x2d9893['error'][_0x5e8b('0x14')]===0x1f4){logger['error'](_0x5e8b('0xe'),_0x3b3854,_0x2d9893[_0x5e8b('0x13')]['message']);return _0x3f79c2(_0x2d9893[_0x5e8b('0x13')][_0x5e8b('0x15')]);}logger[_0x5e8b('0x13')](_0x5e8b('0xe'),_0x3b3854,_0x2d9893[_0x5e8b('0x13')][_0x5e8b('0x15')]);return _0x465a5c(_0x2d9893[_0x5e8b('0x13')][_0x5e8b('0x15')]);}else{logger[_0x5e8b('0x16')](_0x5e8b('0xe'),_0x3b3854,_0x5e8b('0xf'));_0x465a5c(_0x2d9893['result'][_0x5e8b('0x15')]);}})['catch'](function(_0x273cf1){logger['error'](_0x5e8b('0xe'),_0x3b3854,_0x273cf1);_0x3f79c2(_0x273cf1);});});}exports[_0x5e8b('0x17')]=function(_0x3bef87){var _0x416eda=this;return new Promise(function(_0xc2482f,_0x1bc4a9){return db[_0x5e8b('0x18')][_0x5e8b('0x19')](_0x3bef87[_0x5e8b('0x1a')],{'raw':_0x3bef87[_0x5e8b('0x1b')]?_0x3bef87['options'][_0x5e8b('0x1c')]===undefined?!![]:![]:!![]})[_0x5e8b('0xd')](function(_0x39c42a){logger[_0x5e8b('0x16')](_0x5e8b('0x17'),_0x3bef87);logger[_0x5e8b('0x10')]('CreateSmsMessage',_0x3bef87,JSON[_0x5e8b('0x12')](_0x39c42a));_0xc2482f(_0x39c42a);})['catch'](function(_0x78d83d){logger[_0x5e8b('0x13')](_0x5e8b('0x17'),_0x78d83d[_0x5e8b('0x15')],_0x3bef87);_0x1bc4a9(_0x416eda[_0x5e8b('0x13')](0x1f4,_0x78d83d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index da12c13..baddc16 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 _0x8ad5=['register','length','smsMessage:','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ad5,0x11b));var _0x58ad=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8ad5[_0x33032e];return _0x13316b;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x58ad('0x0'),_0x58ad('0x1'),'update'];function createListener(_0x503d6e,_0x39e68f){return function(_0x5ebba8){_0x39e68f[_0x58ad('0x2')](_0x503d6e,_0x5ebba8);};}function removeListener(_0x31cd3f,_0x3a6da6){return function(){SmsMessageEvents[_0x58ad('0x3')](_0x31cd3f,_0x3a6da6);};}exports[_0x58ad('0x4')]=function(_0x2ec258){for(var _0x289fc3=0x0,_0xe26fcd=events[_0x58ad('0x5')];_0x289fc3<_0xe26fcd;_0x289fc3++){var _0x51b9c0=events[_0x289fc3];var _0x12bb93=createListener(_0x58ad('0x6')+_0x51b9c0,_0x2ec258);SmsMessageEvents['on'](_0x51b9c0,_0x12bb93);}}; \ No newline at end of file +var _0xa1ab=['remove','update','emit','removeListener','register','smsMessage:','./smsMessage.events','save'];(function(_0x52e1ac,_0x128df9){var _0x258f06=function(_0x16eab8){while(--_0x16eab8){_0x52e1ac['push'](_0x52e1ac['shift']());}};_0x258f06(++_0x128df9);}(_0xa1ab,0x196));var _0xba1a=function(_0x30427a,_0x410c5b){_0x30427a=_0x30427a-0x0;var _0x37f4a1=_0xa1ab[_0x30427a];return _0x37f4a1;};'use strict';var SmsMessageEvents=require(_0xba1a('0x0'));var events=[_0xba1a('0x1'),_0xba1a('0x2'),_0xba1a('0x3')];function createListener(_0x524a27,_0x52eaad){return function(_0x651858){_0x52eaad[_0xba1a('0x4')](_0x524a27,_0x651858);};}function removeListener(_0x852c2c,_0x417e7a){return function(){SmsMessageEvents[_0xba1a('0x5')](_0x852c2c,_0x417e7a);};}exports[_0xba1a('0x6')]=function(_0x171bac){for(var _0xafb3c5=0x0,_0x201b54=events['length'];_0xafb3c5<_0x201b54;_0xafb3c5++){var _0x4b0bd6=events[_0xafb3c5];var _0x175b91=createListener(_0xba1a('0x7')+_0x4b0bd6,_0x171bac);SmsMessageEvents['on'](_0x4b0bd6,_0x175b91);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 43a4134..b745612 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 _0x111c=['util','express','Router','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete','destroy','exports','multer'];(function(_0x3468cf,_0x259dd0){var _0x259ffa=function(_0x3d0751){while(--_0x3d0751){_0x3468cf['push'](_0x3468cf['shift']());}};_0x259ffa(++_0x259dd0);}(_0x111c,0x137));var _0xc111=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x111c[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xc111('0x0'));var util=require(_0xc111('0x1'));var path=require('path');var express=require(_0xc111('0x2'));var router=express[_0xc111('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc111('0x4'));var config=require('../../config/environment');var controller=require(_0xc111('0x5'));router[_0xc111('0x6')]('/',auth[_0xc111('0x7')](),controller[_0xc111('0x8')]);router[_0xc111('0x6')](_0xc111('0x9'),auth[_0xc111('0x7')](),controller[_0xc111('0xa')]);router['get'](_0xc111('0xb'),auth[_0xc111('0x7')](),controller['show']);router[_0xc111('0x6')](_0xc111('0xc'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xc111('0xd'),auth[_0xc111('0x7')](),controller[_0xc111('0xe')]);router['get'](_0xc111('0xf'),auth[_0xc111('0x7')](),controller[_0xc111('0x10')]);router[_0xc111('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc111('0xd'),auth[_0xc111('0x7')](),controller[_0xc111('0x12')]);router['post']('/:id/users',auth[_0xc111('0x7')](),controller[_0xc111('0x13')]);router[_0xc111('0x14')](_0xc111('0xb'),auth[_0xc111('0x7')](),controller['update']);router[_0xc111('0x15')]('/:id',auth[_0xc111('0x7')](),controller[_0xc111('0x16')]);router['delete'](_0xc111('0xd'),auth[_0xc111('0x7')](),controller['removeTeams']);router[_0xc111('0x15')](_0xc111('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc111('0x17')]=router; \ No newline at end of file +var _0xd15c=['./smsQueue.controller','get','isAuthenticated','index','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd15c,0xc4));var _0xcd15=function(_0x42ad5b,_0x2ffe45){_0x42ad5b=_0x42ad5b-0x0;var _0x28810b=_0xd15c[_0x42ad5b];return _0x28810b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xcd15('0x0'));var router=express[_0xcd15('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd15('0x2'));var config=require(_0xcd15('0x3'));var controller=require(_0xcd15('0x4'));router[_0xcd15('0x5')]('/',auth[_0xcd15('0x6')](),controller[_0xcd15('0x7')]);router[_0xcd15('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xcd15('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcd15('0x5')](_0xcd15('0x8'),auth[_0xcd15('0x6')](),controller[_0xcd15('0x9')]);router['get'](_0xcd15('0xa'),auth['isAuthenticated'](),controller[_0xcd15('0xb')]);router[_0xcd15('0x5')](_0xcd15('0xc'),auth[_0xcd15('0x6')](),controller[_0xcd15('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd15('0xe')]);router[_0xcd15('0xf')](_0xcd15('0xa'),auth[_0xcd15('0x6')](),controller[_0xcd15('0x10')]);router[_0xcd15('0xf')]('/:id/users',auth[_0xcd15('0x6')](),controller[_0xcd15('0x11')]);router['put'](_0xcd15('0x12'),auth[_0xcd15('0x6')](),controller[_0xcd15('0x13')]);router[_0xcd15('0x14')](_0xcd15('0x12'),auth[_0xcd15('0x6')](),controller[_0xcd15('0x15')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xcd15('0x16')]);router['delete'](_0xcd15('0xc'),auth['isAuthenticated'](),controller[_0xcd15('0x17')]);module[_0xcd15('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 67a9beb..b71128d 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 _0x5112=['exports','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x54cc79,_0x51052f){var _0x15586f=function(_0x504626){while(--_0x504626){_0x54cc79['push'](_0x54cc79['shift']());}};_0x15586f(++_0x51052f);}(_0x5112,0x8b));var _0x2511=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x5112[_0x2a2166];return _0x3bcf50;};'use strict';var Sequelize=require(_0x2511('0x0'));module[_0x2511('0x1')]={'name':{'type':Sequelize[_0x2511('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2511('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2511('0x4')]('rrmemory',_0x2511('0x5'),_0x2511('0x6'))}}; \ No newline at end of file +var _0x0210=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x285f9b,_0xfcae6c){var _0x32dd58=function(_0x392920){while(--_0x392920){_0x285f9b['push'](_0x285f9b['shift']());}};_0x32dd58(++_0xfcae6c);}(_0x0210,0x98));var _0x0021=function(_0x39b2e1,_0x24823e){_0x39b2e1=_0x39b2e1-0x0;var _0x3912f7=_0x0210[_0x39b2e1];return _0x3912f7;};'use strict';var Sequelize=require(_0x0021('0x0'));module['exports']={'name':{'type':Sequelize[_0x0021('0x1')],'unique':_0x0021('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0021('0x1')]},'timeout':{'type':Sequelize[_0x0021('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0021('0x4')](_0x0021('0x5'),_0x0021('0x6'),_0x0021('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 735c16f..09a018c 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 _0xa6ff=['rawAttributes','nolimit','filter','findAll','UserId','agent','smsPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','User','Agents','addAgents','ids','removeTeams','union','removeAgents','spread','emit','userSmsQueue:save','userSmsQueue:remove','getAgents','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../mysqldb','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','SmsQueue','model','keys','query','dateEnd','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','dateStart','add','day','merge','map','options','include','rows','show','params','includeAll','catch','create','body','find','describe','getMembers','findOne','get','UserSmsQueue'];(function(_0x49be07,_0x295c5){var _0x550f42=function(_0x1b4546){while(--_0x1b4546){_0x49be07['push'](_0x49be07['shift']());}};_0x550f42(++_0x295c5);}(_0xa6ff,0x77));var _0xfa6f=function(_0x5af3f6,_0x181e7a){_0x5af3f6=_0x5af3f6-0x0;var _0x3881c9=_0xa6ff[_0x5af3f6];return _0x3881c9;};'use strict';var jsonpatch=require(_0xfa6f('0x0'));var rp=require(_0xfa6f('0x1'));var moment=require('moment');var BPromise=require(_0xfa6f('0x2'));var Mustache=require(_0xfa6f('0x3'));var util=require(_0xfa6f('0x4'));var path=require(_0xfa6f('0x5'));var sox=require(_0xfa6f('0x6'));var csv=require(_0xfa6f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfa6f('0x8'));var crypto=require(_0xfa6f('0x9'));var jsforce=require(_0xfa6f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfa6f('0x7'));var querystring=require(_0xfa6f('0xb'));var Papa=require(_0xfa6f('0xc'));var qs=require(_0xfa6f('0xd'));var logger=require('../../config/logger')(_0xfa6f('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfa6f('0xf'))['db'];var socket=require(_0xfa6f('0x10'))({'host':'localhost','port':0x18eb});require(_0xfa6f('0x11'))['register'](socket);function respondWithStatusCode(_0x13cb75,_0x28bf1a){_0x28bf1a=_0x28bf1a||0xcc;return function(_0x3df11c){if(_0x3df11c){return _0x13cb75[_0xfa6f('0x12')](_0x28bf1a);}return _0x13cb75[_0xfa6f('0x13')](_0x28bf1a)[_0xfa6f('0x14')]();};}function respondWithResult(_0x24ba0e,_0x17d1bb){_0x17d1bb=_0x17d1bb||0xc8;return function(_0x3f3adf){if(_0x3f3adf){return _0x24ba0e[_0xfa6f('0x13')](_0x17d1bb)['json'](_0x3f3adf);}};}function respondWithFilteredResult(_0x37a988,_0x5bb4c0){return function(_0x47ae83){if(_0x47ae83){var _0x457411=_0x47ae83[_0xfa6f('0x15')],_0x436572=_0x5bb4c0['offset'],_0x56d8eb=_0x5bb4c0[_0xfa6f('0x16')]+_0x5bb4c0['limit'],_0x59b69b;if(_0x56d8eb>=_0x457411){_0x56d8eb=_0x457411;_0x59b69b=0xc8;}else{_0x59b69b=0xce;}_0x37a988[_0xfa6f('0x13')](_0x59b69b);return _0x37a988['set'](_0xfa6f('0x17'),_0x436572+'-'+_0x56d8eb+'/'+_0x457411)[_0xfa6f('0x18')](_0x47ae83);}return null;};}function patchUpdates(_0xccb5a3){return function(_0x36b25b){try{jsonpatch[_0xfa6f('0x19')](_0x36b25b,_0xccb5a3,!![]);}catch(_0x1370dd){return BPromise[_0xfa6f('0x1a')](_0x1370dd);}return _0x36b25b['save']();};}function saveUpdates(_0x5c61e6,_0x241c0d){return function(_0x11e416){if(_0x11e416){return _0x11e416[_0xfa6f('0x1b')](_0x5c61e6)[_0xfa6f('0x1c')](function(_0x628123){return _0x628123;});}return null;};}function removeEntity(_0x500760,_0x3e29d1){return function(_0x2be848){if(_0x2be848){return _0x2be848[_0xfa6f('0x1d')]()[_0xfa6f('0x1c')](function(){_0x500760[_0xfa6f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe7de92,_0x92421d){return function(_0x575be2){if(!_0x575be2){_0xe7de92['sendStatus'](0x194);}return _0x575be2;};}function handleError(_0x122ad3,_0x103ccb){_0x103ccb=_0x103ccb||0x1f4;return function(_0x59dee4){logger['error'](_0x59dee4[_0xfa6f('0x1e')]);if(_0x59dee4[_0xfa6f('0x1f')]){delete _0x59dee4[_0xfa6f('0x1f')];}_0x122ad3[_0xfa6f('0x13')](_0x103ccb)[_0xfa6f('0x20')](_0x59dee4);};}exports['index']=function(_0x2560d4,_0x51efdb){var _0xa70ead={},_0x3e1c2a={},_0x207a5f={'count':0x0,'rows':[]};var _0x4e0993=db[_0xfa6f('0x21')]['rawAttributes'];_0x3e1c2a[_0xfa6f('0x22')]=_[_0xfa6f('0x23')](_0x4e0993);var _0x2c762a={'dateStart':_0x2560d4[_0xfa6f('0x24')]['dateStart'],'dateEnd':_0x2560d4[_0xfa6f('0x24')]['dateEnd']};delete _0x2560d4[_0xfa6f('0x24')]['dateStart'];delete _0x2560d4[_0xfa6f('0x24')][_0xfa6f('0x25')];_0x3e1c2a['query']=_[_0xfa6f('0x23')](_0x2560d4[_0xfa6f('0x24')]);_0x3e1c2a['filters']=_[_0xfa6f('0x26')](_0x3e1c2a[_0xfa6f('0x22')],_0x3e1c2a[_0xfa6f('0x24')]);_0xa70ead[_0xfa6f('0x27')]=_[_0xfa6f('0x26')](_0x3e1c2a[_0xfa6f('0x22')],qs[_0xfa6f('0x28')](_0x2560d4[_0xfa6f('0x24')][_0xfa6f('0x28')]));_0xa70ead[_0xfa6f('0x27')]=_0xa70ead['attributes'][_0xfa6f('0x29')]?_0xa70ead[_0xfa6f('0x27')]:_0x3e1c2a[_0xfa6f('0x22')];if(!_0x2560d4[_0xfa6f('0x24')][_0xfa6f('0x2a')]('nolimit')){_0xa70ead[_0xfa6f('0x2b')]=qs[_0xfa6f('0x2b')](_0x2560d4[_0xfa6f('0x24')][_0xfa6f('0x2b')]);_0xa70ead[_0xfa6f('0x16')]=qs[_0xfa6f('0x16')](_0x2560d4[_0xfa6f('0x24')][_0xfa6f('0x16')]);}_0xa70ead[_0xfa6f('0x2c')]=qs[_0xfa6f('0x2d')](_0x2560d4[_0xfa6f('0x24')]['sort']);_0xa70ead[_0xfa6f('0x2e')]=qs[_0xfa6f('0x2f')](_[_0xfa6f('0x30')](_0x2560d4['query'],_0x3e1c2a[_0xfa6f('0x2f')]));if(_0x2c762a[_0xfa6f('0x31')]){if(_0x2c762a['dateEnd']){_0x2c762a[_0xfa6f('0x25')]=moment(_0x2c762a['dateEnd'])[_0xfa6f('0x32')](0x1,_0xfa6f('0x33'));}else{_0x2c762a[_0xfa6f('0x25')]=moment(_0x2c762a['dateStart'])[_0xfa6f('0x32')](0x1,_0xfa6f('0x33'));}_[_0xfa6f('0x34')](_0xa70ead['where'],{'createdAt':{'$gte':_0x2c762a['dateStart'],'$lte':_0x2c762a[_0xfa6f('0x25')]}});}if(_0x2560d4[_0xfa6f('0x24')]['filter']){_0xa70ead['where']=_[_0xfa6f('0x34')](_0xa70ead[_0xfa6f('0x2e')],{'$or':_[_0xfa6f('0x35')](_0xa70ead[_0xfa6f('0x27')],function(_0x3595c6){var _0x9f11f7={};_0x9f11f7[_0x3595c6]={'$like':'%'+_0x2560d4[_0xfa6f('0x24')]['filter']+'%'};return _0x9f11f7;})});}_0xa70ead=_[_0xfa6f('0x34')]({},_0xa70ead,_0x2560d4[_0xfa6f('0x36')]);var _0x1fe06a={'where':_0xa70ead[_0xfa6f('0x2e')]};return db['SmsQueue'][_0xfa6f('0x15')](_0x1fe06a)[_0xfa6f('0x1c')](function(_0xc16781){_0x207a5f[_0xfa6f('0x15')]=_0xc16781;if(_0x2560d4[_0xfa6f('0x24')]['includeAll']){_0xa70ead[_0xfa6f('0x37')]=[{'all':!![]}];}return db[_0xfa6f('0x21')]['findAll'](_0xa70ead);})[_0xfa6f('0x1c')](function(_0x573180){_0x207a5f[_0xfa6f('0x38')]=_0x573180;return _0x207a5f;})['then'](respondWithFilteredResult(_0x51efdb,_0xa70ead))['catch'](handleError(_0x51efdb,null));};exports[_0xfa6f('0x39')]=function(_0x54a102,_0x225dad){var _0x2c9ce0={'raw':!![],'where':{'id':_0x54a102[_0xfa6f('0x3a')]['id']}},_0x399bbb={};_0x399bbb[_0xfa6f('0x22')]=_['keys'](db['SmsQueue']['rawAttributes']);_0x399bbb[_0xfa6f('0x24')]=_[_0xfa6f('0x23')](_0x54a102[_0xfa6f('0x24')]);_0x399bbb[_0xfa6f('0x2f')]=_[_0xfa6f('0x26')](_0x399bbb[_0xfa6f('0x22')],_0x399bbb[_0xfa6f('0x24')]);_0x2c9ce0[_0xfa6f('0x27')]=_[_0xfa6f('0x26')](_0x399bbb[_0xfa6f('0x22')],qs['fields'](_0x54a102[_0xfa6f('0x24')][_0xfa6f('0x28')]));_0x2c9ce0[_0xfa6f('0x27')]=_0x2c9ce0[_0xfa6f('0x27')][_0xfa6f('0x29')]?_0x2c9ce0[_0xfa6f('0x27')]:_0x399bbb['model'];if(_0x54a102['query'][_0xfa6f('0x3b')]){_0x2c9ce0[_0xfa6f('0x37')]=[{'all':!![]}];}_0x2c9ce0=_['merge']({},_0x2c9ce0,_0x54a102[_0xfa6f('0x36')]);return db[_0xfa6f('0x21')]['find'](_0x2c9ce0)[_0xfa6f('0x1c')](handleEntityNotFound(_0x225dad,null))[_0xfa6f('0x1c')](respondWithResult(_0x225dad,null))[_0xfa6f('0x3c')](handleError(_0x225dad,null));};exports[_0xfa6f('0x3d')]=function(_0x3328db,_0x1ae485){return db['SmsQueue'][_0xfa6f('0x3d')](_0x3328db[_0xfa6f('0x3e')],{})['then'](respondWithResult(_0x1ae485,0xc9))[_0xfa6f('0x3c')](handleError(_0x1ae485,null));};exports[_0xfa6f('0x1b')]=function(_0x70daf,_0xc239e5){if(_0x70daf['body']['id']){delete _0x70daf[_0xfa6f('0x3e')]['id'];}return db[_0xfa6f('0x21')][_0xfa6f('0x3f')]({'where':{'id':_0x70daf['params']['id']}})[_0xfa6f('0x1c')](handleEntityNotFound(_0xc239e5,null))[_0xfa6f('0x1c')](saveUpdates(_0x70daf['body'],null))['then'](respondWithResult(_0xc239e5,null))[_0xfa6f('0x3c')](handleError(_0xc239e5,null));};exports[_0xfa6f('0x1d')]=function(_0x123a23,_0x40fc89){return db[_0xfa6f('0x21')][_0xfa6f('0x3f')]({'where':{'id':_0x123a23[_0xfa6f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x40fc89,null))[_0xfa6f('0x1c')](removeEntity(_0x40fc89,null))[_0xfa6f('0x3c')](handleError(_0x40fc89,null));};exports[_0xfa6f('0x40')]=function(_0x57502a,_0x2d5083){return db[_0xfa6f('0x21')][_0xfa6f('0x40')]()[_0xfa6f('0x1c')](respondWithResult(_0x2d5083,null))[_0xfa6f('0x3c')](handleError(_0x2d5083,null));};exports[_0xfa6f('0x41')]=function(_0x1f2ef8,_0xe73ba8,_0x587547){var _0x4758a2={'raw':!![],'where':{}},_0x3ac653={},_0x2d25ea;return db['SmsQueue'][_0xfa6f('0x42')]({'where':{'id':_0x1f2ef8[_0xfa6f('0x3a')]['id']}})['then'](handleEntityNotFound(_0xe73ba8,null))['then'](function(_0x579dbf){if(_0x579dbf){_0x2d25ea=_0x579dbf[_0xfa6f('0x43')]({'plain':!![]});_0x3ac653[_0xfa6f('0x22')]=_[_0xfa6f('0x23')](db[_0xfa6f('0x44')][_0xfa6f('0x45')]);_0x3ac653[_0xfa6f('0x24')]=_[_0xfa6f('0x23')](_0x1f2ef8['query']);_0x3ac653['filters']=_[_0xfa6f('0x26')](_0x3ac653[_0xfa6f('0x22')],_0x3ac653['query']);_0x4758a2[_0xfa6f('0x27')]=_[_0xfa6f('0x26')](_0x3ac653['model'],qs[_0xfa6f('0x28')](_0x1f2ef8[_0xfa6f('0x24')][_0xfa6f('0x28')]));_0x4758a2['attributes']=_0x4758a2[_0xfa6f('0x27')][_0xfa6f('0x29')]?_0x4758a2[_0xfa6f('0x27')]:_0x3ac653[_0xfa6f('0x22')];if(!_0x1f2ef8[_0xfa6f('0x24')][_0xfa6f('0x2a')](_0xfa6f('0x46'))){_0x4758a2['limit']=qs[_0xfa6f('0x2b')](_0x1f2ef8['query'][_0xfa6f('0x2b')]);_0x4758a2['offset']=qs['offset'](_0x1f2ef8['query'][_0xfa6f('0x16')]);}_0x4758a2[_0xfa6f('0x2c')]=qs['sort'](_0x1f2ef8[_0xfa6f('0x24')][_0xfa6f('0x2d')]);_0x4758a2[_0xfa6f('0x2e')]=qs[_0xfa6f('0x2f')](_[_0xfa6f('0x30')](_0x1f2ef8[_0xfa6f('0x24')],_0x3ac653[_0xfa6f('0x2f')]));_0x4758a2[_0xfa6f('0x2e')]['SmsQueueId']=_0x579dbf['id'];if(_0x1f2ef8[_0xfa6f('0x24')][_0xfa6f('0x47')]){_0x4758a2[_0xfa6f('0x2e')]=_[_0xfa6f('0x34')](_0x4758a2[_0xfa6f('0x2e')],{'$or':_[_0xfa6f('0x35')](_0x4758a2[_0xfa6f('0x27')],function(_0x54e0b9){var _0x4e417f={};_0x4e417f[_0x54e0b9]={'$like':'%'+_0x1f2ef8[_0xfa6f('0x24')]['filter']+'%'};return _0x4e417f;})});}_0x4758a2=_[_0xfa6f('0x34')]({},_0x4758a2,_0x1f2ef8[_0xfa6f('0x36')]);return db[_0xfa6f('0x44')][_0xfa6f('0x48')](_0x4758a2);}})[_0xfa6f('0x1c')](function(_0x4f84b2){if(_0x4f84b2){return db['User']['findAndCountAll']({'where':{'id':_[_0xfa6f('0x35')](_0x4f84b2,_0xfa6f('0x49')),'role':_0xfa6f('0x4a')},'attributes':['id',_0xfa6f('0x1f'),_0xfa6f('0x4b'),_0xfa6f('0x4c'),_0xfa6f('0x4d')]});}})[_0xfa6f('0x1c')](function(_0x279249){if(_0x279249){return{'count':_0x279249[_0xfa6f('0x15')],'rows':_[_0xfa6f('0x35')](_0x279249[_0xfa6f('0x38')],function(_0x25ff0b){return{'membername':_0x25ff0b[_0xfa6f('0x1f')],'UserId':_0x25ff0b['id'],'queue_name':_0x2d25ea[_0xfa6f('0x1f')],'SmsQueueId':_0x2d25ea['id'],'interface':util['format']('%s/%s',_0xfa6f('0x4e'),_0x25ff0b[_0xfa6f('0x1f')]),'penalty':0x0,'paused':_0x25ff0b[_0xfa6f('0x4b')],'createdAt':_0x25ff0b[_0xfa6f('0x4d')],'updatedAt':_0x25ff0b[_0xfa6f('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa6f('0x1c')](respondWithFilteredResult(_0xe73ba8,_0x4758a2))[_0xfa6f('0x3c')](handleError(_0xe73ba8,null));};exports[_0xfa6f('0x4f')]=function(_0xaf5d64,_0x5aecc0,_0x293ffb){var _0x3d1352={};var _0x35d20d={};var _0x387b5d;var _0x5a8c8a;return db[_0xfa6f('0x21')]['findOne']({'where':{'id':_0xaf5d64[_0xfa6f('0x3a')]['id']}})[_0xfa6f('0x1c')](handleEntityNotFound(_0x5aecc0,null))[_0xfa6f('0x1c')](function(_0x553101){if(_0x553101){_0x387b5d=_0x553101;_0x35d20d['model']=_[_0xfa6f('0x23')](db[_0xfa6f('0x50')]['rawAttributes']);_0x35d20d[_0xfa6f('0x24')]=_[_0xfa6f('0x23')](_0xaf5d64[_0xfa6f('0x24')]);_0x35d20d[_0xfa6f('0x2f')]=_[_0xfa6f('0x26')](_0x35d20d[_0xfa6f('0x22')],_0x35d20d[_0xfa6f('0x24')]);_0x3d1352[_0xfa6f('0x27')]=_[_0xfa6f('0x26')](_0x35d20d[_0xfa6f('0x22')],qs[_0xfa6f('0x28')](_0xaf5d64['query'][_0xfa6f('0x28')]));_0x3d1352['attributes']=_0x3d1352[_0xfa6f('0x27')][_0xfa6f('0x29')]?_0x3d1352['attributes']:_0x35d20d['model'];_0x3d1352[_0xfa6f('0x2c')]=qs[_0xfa6f('0x2d')](_0xaf5d64[_0xfa6f('0x24')][_0xfa6f('0x2d')]);_0x3d1352[_0xfa6f('0x2e')]=qs[_0xfa6f('0x2f')](_[_0xfa6f('0x30')](_0xaf5d64[_0xfa6f('0x24')],_0x35d20d[_0xfa6f('0x2f')]));if(_0xaf5d64['query'][_0xfa6f('0x47')]){_0x3d1352[_0xfa6f('0x2e')]=_['merge'](_0x3d1352[_0xfa6f('0x2e')],{'$or':_['map'](_0x3d1352[_0xfa6f('0x27')],function(_0x1cc1da){var _0x418492={};_0x418492[_0x1cc1da]={'$like':'%'+_0xaf5d64[_0xfa6f('0x24')][_0xfa6f('0x47')]+'%'};return _0x418492;})});}_0x3d1352=_[_0xfa6f('0x34')]({},_0x3d1352,_0xaf5d64[_0xfa6f('0x36')]);return _0x387b5d[_0xfa6f('0x4f')](_0x3d1352);}})[_0xfa6f('0x1c')](function(_0x3f3668){if(_0x3f3668){_0x5a8c8a=_0x3f3668[_0xfa6f('0x29')];if(!_0xaf5d64[_0xfa6f('0x24')][_0xfa6f('0x2a')]('nolimit')){_0x3d1352[_0xfa6f('0x2b')]=qs['limit'](_0xaf5d64[_0xfa6f('0x24')][_0xfa6f('0x2b')]);_0x3d1352[_0xfa6f('0x16')]=qs[_0xfa6f('0x16')](_0xaf5d64[_0xfa6f('0x24')]['offset']);}return _0x387b5d[_0xfa6f('0x4f')](_0x3d1352);}})['then'](function(_0x58dcb3){if(_0x58dcb3){return _0x58dcb3?{'count':_0x5a8c8a,'rows':_0x58dcb3}:null;}})[_0xfa6f('0x1c')](respondWithResult(_0x5aecc0,null))['catch'](handleError(_0x5aecc0,null));};exports[_0xfa6f('0x51')]=function(_0x9b637c,_0x5339de,_0x256b7f){var _0x147733=[];var _0x7464d3;return db[_0xfa6f('0x50')][_0xfa6f('0x48')]({'where':{'id':_0x9b637c['body']['ids']},'attributes':['id'],'include':[{'model':db[_0xfa6f('0x52')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](function(_0x428e8e){if(_0x428e8e){for(var _0x3f1a31=0x0;_0x3f1a31<_0x428e8e['length'];_0x3f1a31+=0x1){for(var _0x47dcb5=0x0;_0x47dcb5<_0x428e8e[_0x3f1a31][_0xfa6f('0x53')][_0xfa6f('0x29')];_0x47dcb5+=0x1){_0x147733=_['union'](_0x147733,[_0x428e8e[_0x3f1a31][_0xfa6f('0x53')][_0x47dcb5]['id']]);}}return _0x147733;}})['then'](function(_0x66037){if(_0x66037){return db[_0xfa6f('0x21')][_0xfa6f('0x3f')]({'where':{'id':_0x9b637c[_0xfa6f('0x3a')]['id']}});}})['then'](function(_0x1ab5a6){if(_0x1ab5a6){_0x7464d3=_0x1ab5a6;return _0x7464d3[_0xfa6f('0x54')](_0x147733,{'penalty':_0x9b637c[_0xfa6f('0x3e')]['penalty']});}})[_0xfa6f('0x1c')](function(_0x430caf){if(_0x430caf){return _0x7464d3[_0xfa6f('0x51')](_0x9b637c[_0xfa6f('0x3e')][_0xfa6f('0x55')]);}})[_0xfa6f('0x1c')](handleEntityNotFound(_0x5339de,null))[_0xfa6f('0x1c')](respondWithStatusCode(_0x5339de,null))[_0xfa6f('0x3c')](handleError(_0x5339de,null));};exports[_0xfa6f('0x56')]=function(_0x330d54,_0x4418b1,_0xfa2846){var _0x5a10c0=[];var _0xbae887;return db[_0xfa6f('0x50')][_0xfa6f('0x48')]({'where':{'id':_0x330d54[_0xfa6f('0x24')][_0xfa6f('0x55')]},'attributes':['id'],'include':[{'model':db[_0xfa6f('0x52')],'as':_0xfa6f('0x53'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2e8edd){if(_0x2e8edd){for(var _0x3af710=0x0;_0x3af710<_0x2e8edd[_0xfa6f('0x29')];_0x3af710+=0x1){for(var _0x524eab=0x0;_0x524eab<_0x2e8edd[_0x3af710][_0xfa6f('0x53')][_0xfa6f('0x29')];_0x524eab+=0x1){_0x5a10c0=_[_0xfa6f('0x57')](_0x5a10c0,[_0x2e8edd[_0x3af710][_0xfa6f('0x53')][_0x524eab]['id']]);}}return _0x5a10c0;}})[_0xfa6f('0x1c')](function(_0x423713){if(_0x423713){return db['SmsQueue']['find']({'where':{'id':_0x330d54[_0xfa6f('0x3a')]['id']}});}})[_0xfa6f('0x1c')](function(_0x53f3dd){if(_0x53f3dd){_0xbae887=_0x53f3dd;return _0xbae887[_0xfa6f('0x58')](_0x5a10c0);}})[_0xfa6f('0x1c')](function(_0x1bc7d2){if(_0xbae887){return _0xbae887['removeTeams'](_0x330d54[_0xfa6f('0x24')][_0xfa6f('0x55')]);}})['then'](handleEntityNotFound(_0x4418b1,null))[_0xfa6f('0x1c')](respondWithStatusCode(_0x4418b1,null))[_0xfa6f('0x3c')](handleError(_0x4418b1,null));};exports[_0xfa6f('0x54')]=function(_0x45aca3,_0x4b1135,_0x2b914f){return db['SmsQueue'][_0xfa6f('0x3f')]({'where':{'id':_0x45aca3[_0xfa6f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4b1135,null))[_0xfa6f('0x1c')](function(_0xc84bc9){if(_0xc84bc9){return _0xc84bc9[_0xfa6f('0x54')](_0x45aca3['body'][_0xfa6f('0x55')],_['omit'](_0x45aca3[_0xfa6f('0x3e')],[_0xfa6f('0x55'),'id'])||{})[_0xfa6f('0x59')](function(_0xfe09f4){for(var _0x2494cf=0x0;_0x2494cf<_0x45aca3[_0xfa6f('0x3e')][_0xfa6f('0x55')][_0xfa6f('0x29')];_0x2494cf+=0x1){socket[_0xfa6f('0x5a')](_0xfa6f('0x5b'),{'UserId':_0x45aca3[_0xfa6f('0x3e')][_0xfa6f('0x55')][_0x2494cf],'SmsQueueId':_0x45aca3['params']['id']});}return _0xfe09f4;});}})[_0xfa6f('0x1c')](respondWithResult(_0x4b1135,null))[_0xfa6f('0x3c')](handleError(_0x4b1135,null));};exports['removeAgents']=function(_0x109e6c,_0x3171db,_0x1cf6eb){var _0xf3cb02;return db[_0xfa6f('0x21')]['find']({'where':{'id':_0x109e6c[_0xfa6f('0x3a')]['id']}})[_0xfa6f('0x1c')](handleEntityNotFound(_0x3171db,null))[_0xfa6f('0x1c')](function(_0x447a78){if(_0x447a78){return _0x447a78[_0xfa6f('0x58')](_0x109e6c[_0xfa6f('0x24')][_0xfa6f('0x55')])[_0xfa6f('0x1c')](function(_0x2df785){if(_['isArray'](_0x109e6c[_0xfa6f('0x24')][_0xfa6f('0x55')])){for(var _0x22689c=0x0;_0x22689c<_0x109e6c[_0xfa6f('0x24')][_0xfa6f('0x55')][_0xfa6f('0x29')];_0x22689c+=0x1){socket[_0xfa6f('0x5a')](_0xfa6f('0x5c'),{'UserId':_0x109e6c[_0xfa6f('0x24')][_0xfa6f('0x55')][_0x22689c],'SmsQueueId':_0x109e6c[_0xfa6f('0x3a')]['id']});}}else{socket['emit'](_0xfa6f('0x5c'),{'UserId':_0x109e6c[_0xfa6f('0x24')][_0xfa6f('0x55')],'SmsQueueId':_0x109e6c[_0xfa6f('0x3a')]['id']});}});}})[_0xfa6f('0x1c')](respondWithStatusCode(_0x3171db,null))[_0xfa6f('0x3c')](handleError(_0x3171db,null));};exports[_0xfa6f('0x5d')]=function(_0x32252,_0x4558b0,_0x15e626){var _0x58b844={};var _0x274bb3={};var _0x5a30b7;var _0x256904;return db[_0xfa6f('0x21')][_0xfa6f('0x42')]({'where':{'id':_0x32252['params']['id']}})['then'](handleEntityNotFound(_0x4558b0,null))[_0xfa6f('0x1c')](function(_0x367a66){if(_0x367a66){_0x5a30b7=_0x367a66;_0x274bb3['model']=_[_0xfa6f('0x23')](db['User'][_0xfa6f('0x45')]);_0x274bb3[_0xfa6f('0x24')]=_[_0xfa6f('0x23')](_0x32252[_0xfa6f('0x24')]);_0x274bb3[_0xfa6f('0x2f')]=_[_0xfa6f('0x26')](_0x274bb3[_0xfa6f('0x22')],_0x274bb3[_0xfa6f('0x24')]);_0x58b844['attributes']=_[_0xfa6f('0x26')](_0x274bb3[_0xfa6f('0x22')],qs['fields'](_0x32252[_0xfa6f('0x24')]['fields']));_0x58b844[_0xfa6f('0x27')]=_0x58b844[_0xfa6f('0x27')][_0xfa6f('0x29')]?_0x58b844[_0xfa6f('0x27')]:_0x274bb3[_0xfa6f('0x22')];_0x58b844[_0xfa6f('0x2c')]=qs['sort'](_0x32252['query'][_0xfa6f('0x2d')]);_0x58b844[_0xfa6f('0x2e')]=qs[_0xfa6f('0x2f')](_['pick'](_0x32252[_0xfa6f('0x24')],_0x274bb3[_0xfa6f('0x2f')]));if(_0x32252[_0xfa6f('0x24')][_0xfa6f('0x47')]){_0x58b844['where']=_[_0xfa6f('0x34')](_0x58b844[_0xfa6f('0x2e')],{'$or':_[_0xfa6f('0x35')](_0x58b844[_0xfa6f('0x27')],function(_0x33b589){var _0x157afa={};_0x157afa[_0x33b589]={'$like':'%'+_0x32252[_0xfa6f('0x24')]['filter']+'%'};return _0x157afa;})});}_0x58b844=_[_0xfa6f('0x34')]({},_0x58b844,_0x32252[_0xfa6f('0x36')]);return _0x5a30b7['getAgents'](_0x58b844);}})[_0xfa6f('0x1c')](function(_0x443eda){if(_0x443eda){_0x256904=_0x443eda[_0xfa6f('0x29')];if(!_0x32252[_0xfa6f('0x24')][_0xfa6f('0x2a')](_0xfa6f('0x46'))){_0x58b844[_0xfa6f('0x2b')]=qs['limit'](_0x32252[_0xfa6f('0x24')][_0xfa6f('0x2b')]);_0x58b844[_0xfa6f('0x16')]=qs['offset'](_0x32252[_0xfa6f('0x24')]['offset']);}return _0x5a30b7[_0xfa6f('0x5d')](_0x58b844);}})[_0xfa6f('0x1c')](function(_0x4b0a2f){if(_0x4b0a2f){return _0x4b0a2f?{'count':_0x256904,'rows':_0x4b0a2f}:null;}})[_0xfa6f('0x1c')](respondWithResult(_0x4558b0,null))[_0xfa6f('0x3c')](handleError(_0x4558b0,null));}; \ No newline at end of file +var _0x5685=['User','removeAgents','addAgents','omit','spread','emit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsQueue.socket','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','name','send','index','SmsQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','day','add','merge','filter','options','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','get','UserSmsQueue','hasOwnProperty','SmsQueueId','map','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','union','addTeams','removeTeams'];(function(_0x217483,_0x422422){var _0x37f8a4=function(_0x7639ac){while(--_0x7639ac){_0x217483['push'](_0x217483['shift']());}};_0x37f8a4(++_0x422422);}(_0x5685,0x1aa));var _0x5568=function(_0x3a7ab8,_0x35dbf3){_0x3a7ab8=_0x3a7ab8-0x0;var _0x2734fa=_0x5685[_0x3a7ab8];return _0x2734fa;};'use strict';var jsonpatch=require(_0x5568('0x0'));var rp=require(_0x5568('0x1'));var moment=require('moment');var BPromise=require(_0x5568('0x2'));var Mustache=require(_0x5568('0x3'));var util=require(_0x5568('0x4'));var path=require(_0x5568('0x5'));var sox=require('sox');var csv=require(_0x5568('0x6'));var ejs=require(_0x5568('0x7'));var fs=require('fs');var _=require(_0x5568('0x8'));var squel=require(_0x5568('0x9'));var crypto=require(_0x5568('0xa'));var jsforce=require(_0x5568('0xb'));var deskjs=require(_0x5568('0xc'));var toCsv=require(_0x5568('0x6'));var querystring=require(_0x5568('0xd'));var Papa=require(_0x5568('0xe'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5568('0xf'));var utils=require(_0x5568('0x10'));var config=require(_0x5568('0x11'));var db=require(_0x5568('0x12'))['db'];var socket=require(_0x5568('0x13'))({'host':_0x5568('0x14'),'port':0x18eb});require(_0x5568('0x15'))['register'](socket);function respondWithStatusCode(_0x3c708d,_0x42aaed){_0x42aaed=_0x42aaed||0xcc;return function(_0x1337aa){if(_0x1337aa){return _0x3c708d[_0x5568('0x16')](_0x42aaed);}return _0x3c708d[_0x5568('0x17')](_0x42aaed)['end']();};}function respondWithResult(_0x2ef275,_0x32ca83){_0x32ca83=_0x32ca83||0xc8;return function(_0x5315ca){if(_0x5315ca){return _0x2ef275[_0x5568('0x17')](_0x32ca83)['json'](_0x5315ca);}};}function respondWithFilteredResult(_0x3620d9,_0x521ccf){return function(_0xc86b6c){if(_0xc86b6c){var _0x2d8627=_0xc86b6c['count'],_0x2c34a5=_0x521ccf[_0x5568('0x18')],_0x148d6d=_0x521ccf['offset']+_0x521ccf[_0x5568('0x19')],_0x1300e8;if(_0x148d6d>=_0x2d8627){_0x148d6d=_0x2d8627;_0x1300e8=0xc8;}else{_0x1300e8=0xce;}_0x3620d9['status'](_0x1300e8);return _0x3620d9[_0x5568('0x1a')](_0x5568('0x1b'),_0x2c34a5+'-'+_0x148d6d+'/'+_0x2d8627)[_0x5568('0x1c')](_0xc86b6c);}return null;};}function patchUpdates(_0x1d8ebd){return function(_0x3afcd3){try{jsonpatch[_0x5568('0x1d')](_0x3afcd3,_0x1d8ebd,!![]);}catch(_0x28f687){return BPromise[_0x5568('0x1e')](_0x28f687);}return _0x3afcd3[_0x5568('0x1f')]();};}function saveUpdates(_0x11be06,_0x2b07b9){return function(_0x1474b2){if(_0x1474b2){return _0x1474b2['update'](_0x11be06)[_0x5568('0x20')](function(_0xac177e){return _0xac177e;});}return null;};}function removeEntity(_0x3c033d,_0x2cba79){return function(_0xaa646){if(_0xaa646){return _0xaa646[_0x5568('0x21')]()[_0x5568('0x20')](function(){_0x3c033d[_0x5568('0x17')](0xcc)[_0x5568('0x22')]();});}};}function handleEntityNotFound(_0xe4d50e,_0xeef770){return function(_0x3aa189){if(!_0x3aa189){_0xe4d50e['sendStatus'](0x194);}return _0x3aa189;};}function handleError(_0xc2f264,_0x5a0102){_0x5a0102=_0x5a0102||0x1f4;return function(_0x2734e1){logger[_0x5568('0x23')](_0x2734e1['stack']);if(_0x2734e1[_0x5568('0x24')]){delete _0x2734e1['name'];}_0xc2f264[_0x5568('0x17')](_0x5a0102)[_0x5568('0x25')](_0x2734e1);};}exports[_0x5568('0x26')]=function(_0x1fc04a,_0x13cb8a){var _0x1f1a23={},_0x2f7f06={},_0x3fde16={'count':0x0,'rows':[]};var _0x56a901=db[_0x5568('0x27')][_0x5568('0x28')];_0x2f7f06[_0x5568('0x29')]=_[_0x5568('0x2a')](_0x56a901);var _0x53bce0={'dateStart':_0x1fc04a[_0x5568('0x2b')][_0x5568('0x2c')],'dateEnd':_0x1fc04a[_0x5568('0x2b')][_0x5568('0x2d')]};delete _0x1fc04a[_0x5568('0x2b')][_0x5568('0x2c')];delete _0x1fc04a[_0x5568('0x2b')][_0x5568('0x2d')];_0x2f7f06[_0x5568('0x2b')]=_[_0x5568('0x2a')](_0x1fc04a['query']);_0x2f7f06[_0x5568('0x2e')]=_[_0x5568('0x2f')](_0x2f7f06['model'],_0x2f7f06['query']);_0x1f1a23[_0x5568('0x30')]=_[_0x5568('0x2f')](_0x2f7f06[_0x5568('0x29')],qs[_0x5568('0x31')](_0x1fc04a[_0x5568('0x2b')]['fields']));_0x1f1a23[_0x5568('0x30')]=_0x1f1a23[_0x5568('0x30')][_0x5568('0x32')]?_0x1f1a23[_0x5568('0x30')]:_0x2f7f06[_0x5568('0x29')];if(!_0x1fc04a['query']['hasOwnProperty'](_0x5568('0x33'))){_0x1f1a23[_0x5568('0x19')]=qs[_0x5568('0x19')](_0x1fc04a[_0x5568('0x2b')][_0x5568('0x19')]);_0x1f1a23[_0x5568('0x18')]=qs[_0x5568('0x18')](_0x1fc04a[_0x5568('0x2b')][_0x5568('0x18')]);}_0x1f1a23[_0x5568('0x34')]=qs['sort'](_0x1fc04a[_0x5568('0x2b')][_0x5568('0x35')]);_0x1f1a23[_0x5568('0x36')]=qs['filters'](_[_0x5568('0x37')](_0x1fc04a[_0x5568('0x2b')],_0x2f7f06[_0x5568('0x2e')]));if(_0x53bce0[_0x5568('0x2c')]){if(_0x53bce0[_0x5568('0x2d')]){_0x53bce0[_0x5568('0x2d')]=moment(_0x53bce0[_0x5568('0x2d')])['add'](0x1,_0x5568('0x38'));}else{_0x53bce0[_0x5568('0x2d')]=moment(_0x53bce0[_0x5568('0x2c')])[_0x5568('0x39')](0x1,_0x5568('0x38'));}_[_0x5568('0x3a')](_0x1f1a23[_0x5568('0x36')],{'createdAt':{'$gte':_0x53bce0[_0x5568('0x2c')],'$lte':_0x53bce0[_0x5568('0x2d')]}});}if(_0x1fc04a[_0x5568('0x2b')][_0x5568('0x3b')]){_0x1f1a23[_0x5568('0x36')]=_['merge'](_0x1f1a23[_0x5568('0x36')],{'$or':_['map'](_0x1f1a23[_0x5568('0x30')],function(_0x23f618){var _0x387b4f={};_0x387b4f[_0x23f618]={'$like':'%'+_0x1fc04a[_0x5568('0x2b')][_0x5568('0x3b')]+'%'};return _0x387b4f;})});}_0x1f1a23=_['merge']({},_0x1f1a23,_0x1fc04a[_0x5568('0x3c')]);var _0x26aedc={'where':_0x1f1a23['where']};return db['SmsQueue'][_0x5568('0x3d')](_0x26aedc)[_0x5568('0x20')](function(_0x4e6ca4){_0x3fde16[_0x5568('0x3d')]=_0x4e6ca4;if(_0x1fc04a[_0x5568('0x2b')][_0x5568('0x3e')]){_0x1f1a23[_0x5568('0x3f')]=[{'all':!![]}];}return db[_0x5568('0x27')][_0x5568('0x40')](_0x1f1a23);})[_0x5568('0x20')](function(_0x19179e){_0x3fde16[_0x5568('0x41')]=_0x19179e;return _0x3fde16;})[_0x5568('0x20')](respondWithFilteredResult(_0x13cb8a,_0x1f1a23))['catch'](handleError(_0x13cb8a,null));};exports[_0x5568('0x42')]=function(_0x561063,_0x4666a6){var _0xefdef1={'raw':!![],'where':{'id':_0x561063['params']['id']}},_0x36e553={};_0x36e553['model']=_[_0x5568('0x2a')](db[_0x5568('0x27')][_0x5568('0x28')]);_0x36e553[_0x5568('0x2b')]=_[_0x5568('0x2a')](_0x561063[_0x5568('0x2b')]);_0x36e553[_0x5568('0x2e')]=_['intersection'](_0x36e553[_0x5568('0x29')],_0x36e553['query']);_0xefdef1[_0x5568('0x30')]=_[_0x5568('0x2f')](_0x36e553[_0x5568('0x29')],qs['fields'](_0x561063[_0x5568('0x2b')][_0x5568('0x31')]));_0xefdef1[_0x5568('0x30')]=_0xefdef1['attributes'][_0x5568('0x32')]?_0xefdef1[_0x5568('0x30')]:_0x36e553[_0x5568('0x29')];if(_0x561063[_0x5568('0x2b')][_0x5568('0x3e')]){_0xefdef1[_0x5568('0x3f')]=[{'all':!![]}];}_0xefdef1=_[_0x5568('0x3a')]({},_0xefdef1,_0x561063[_0x5568('0x3c')]);return db['SmsQueue'][_0x5568('0x43')](_0xefdef1)[_0x5568('0x20')](handleEntityNotFound(_0x4666a6,null))['then'](respondWithResult(_0x4666a6,null))[_0x5568('0x44')](handleError(_0x4666a6,null));};exports[_0x5568('0x45')]=function(_0x48653,_0x37fcef){return db[_0x5568('0x27')][_0x5568('0x45')](_0x48653[_0x5568('0x46')],{})[_0x5568('0x20')](respondWithResult(_0x37fcef,0xc9))[_0x5568('0x44')](handleError(_0x37fcef,null));};exports[_0x5568('0x47')]=function(_0x1f8775,_0x2942a1){if(_0x1f8775['body']['id']){delete _0x1f8775['body']['id'];}return db[_0x5568('0x27')]['find']({'where':{'id':_0x1f8775['params']['id']}})[_0x5568('0x20')](handleEntityNotFound(_0x2942a1,null))[_0x5568('0x20')](saveUpdates(_0x1f8775[_0x5568('0x46')],null))['then'](respondWithResult(_0x2942a1,null))[_0x5568('0x44')](handleError(_0x2942a1,null));};exports['destroy']=function(_0xb5149d,_0x1059d4){return db[_0x5568('0x27')][_0x5568('0x43')]({'where':{'id':_0xb5149d[_0x5568('0x48')]['id']}})['then'](handleEntityNotFound(_0x1059d4,null))[_0x5568('0x20')](removeEntity(_0x1059d4,null))[_0x5568('0x44')](handleError(_0x1059d4,null));};exports[_0x5568('0x49')]=function(_0x2df022,_0x5eea2c){return db[_0x5568('0x27')][_0x5568('0x49')]()[_0x5568('0x20')](respondWithResult(_0x5eea2c,null))[_0x5568('0x44')](handleError(_0x5eea2c,null));};exports['getMembers']=function(_0x5a11a4,_0x42450c,_0x5c7c6c){var _0xf24b3e={'raw':!![],'where':{}},_0x33daa3={},_0x1d3903;return db[_0x5568('0x27')]['findOne']({'where':{'id':_0x5a11a4[_0x5568('0x48')]['id']}})[_0x5568('0x20')](handleEntityNotFound(_0x42450c,null))[_0x5568('0x20')](function(_0x2ab5df){if(_0x2ab5df){_0x1d3903=_0x2ab5df[_0x5568('0x4a')]({'plain':!![]});_0x33daa3[_0x5568('0x29')]=_[_0x5568('0x2a')](db[_0x5568('0x4b')][_0x5568('0x28')]);_0x33daa3['query']=_[_0x5568('0x2a')](_0x5a11a4[_0x5568('0x2b')]);_0x33daa3['filters']=_[_0x5568('0x2f')](_0x33daa3[_0x5568('0x29')],_0x33daa3[_0x5568('0x2b')]);_0xf24b3e[_0x5568('0x30')]=_[_0x5568('0x2f')](_0x33daa3['model'],qs[_0x5568('0x31')](_0x5a11a4[_0x5568('0x2b')][_0x5568('0x31')]));_0xf24b3e[_0x5568('0x30')]=_0xf24b3e[_0x5568('0x30')][_0x5568('0x32')]?_0xf24b3e[_0x5568('0x30')]:_0x33daa3[_0x5568('0x29')];if(!_0x5a11a4[_0x5568('0x2b')][_0x5568('0x4c')](_0x5568('0x33'))){_0xf24b3e['limit']=qs[_0x5568('0x19')](_0x5a11a4[_0x5568('0x2b')][_0x5568('0x19')]);_0xf24b3e[_0x5568('0x18')]=qs[_0x5568('0x18')](_0x5a11a4['query']['offset']);}_0xf24b3e['order']=qs[_0x5568('0x35')](_0x5a11a4[_0x5568('0x2b')][_0x5568('0x35')]);_0xf24b3e[_0x5568('0x36')]=qs[_0x5568('0x2e')](_[_0x5568('0x37')](_0x5a11a4[_0x5568('0x2b')],_0x33daa3[_0x5568('0x2e')]));_0xf24b3e[_0x5568('0x36')][_0x5568('0x4d')]=_0x2ab5df['id'];if(_0x5a11a4['query'][_0x5568('0x3b')]){_0xf24b3e[_0x5568('0x36')]=_[_0x5568('0x3a')](_0xf24b3e[_0x5568('0x36')],{'$or':_[_0x5568('0x4e')](_0xf24b3e[_0x5568('0x30')],function(_0x40430e){var _0x187b6e={};_0x187b6e[_0x40430e]={'$like':'%'+_0x5a11a4[_0x5568('0x2b')]['filter']+'%'};return _0x187b6e;})});}_0xf24b3e=_[_0x5568('0x3a')]({},_0xf24b3e,_0x5a11a4[_0x5568('0x3c')]);return db[_0x5568('0x4b')][_0x5568('0x40')](_0xf24b3e);}})['then'](function(_0x3758fe){if(_0x3758fe){return db['User'][_0x5568('0x4f')]({'where':{'id':_[_0x5568('0x4e')](_0x3758fe,'UserId'),'role':_0x5568('0x50')},'attributes':['id',_0x5568('0x24'),_0x5568('0x51'),_0x5568('0x52'),_0x5568('0x53')]});}})[_0x5568('0x20')](function(_0x19edbd){if(_0x19edbd){return{'count':_0x19edbd[_0x5568('0x3d')],'rows':_['map'](_0x19edbd['rows'],function(_0x2f03d5){return{'membername':_0x2f03d5[_0x5568('0x24')],'UserId':_0x2f03d5['id'],'queue_name':_0x1d3903[_0x5568('0x24')],'SmsQueueId':_0x1d3903['id'],'interface':util[_0x5568('0x54')](_0x5568('0x55'),_0x5568('0x56'),_0x2f03d5[_0x5568('0x24')]),'penalty':0x0,'paused':_0x2f03d5['smsPause'],'createdAt':_0x2f03d5[_0x5568('0x53')],'updatedAt':_0x2f03d5[_0x5568('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5568('0x20')](respondWithFilteredResult(_0x42450c,_0xf24b3e))[_0x5568('0x44')](handleError(_0x42450c,null));};exports[_0x5568('0x57')]=function(_0x4db441,_0x25e96a,_0x305457){var _0x447ebf={};var _0x303303={};var _0x35fe89;var _0x1e7632;return db[_0x5568('0x27')]['findOne']({'where':{'id':_0x4db441[_0x5568('0x48')]['id']}})['then'](handleEntityNotFound(_0x25e96a,null))[_0x5568('0x20')](function(_0x510a37){if(_0x510a37){_0x35fe89=_0x510a37;_0x303303['model']=_[_0x5568('0x2a')](db[_0x5568('0x58')]['rawAttributes']);_0x303303[_0x5568('0x2b')]=_[_0x5568('0x2a')](_0x4db441[_0x5568('0x2b')]);_0x303303[_0x5568('0x2e')]=_['intersection'](_0x303303[_0x5568('0x29')],_0x303303[_0x5568('0x2b')]);_0x447ebf[_0x5568('0x30')]=_[_0x5568('0x2f')](_0x303303['model'],qs['fields'](_0x4db441[_0x5568('0x2b')][_0x5568('0x31')]));_0x447ebf[_0x5568('0x30')]=_0x447ebf[_0x5568('0x30')][_0x5568('0x32')]?_0x447ebf[_0x5568('0x30')]:_0x303303[_0x5568('0x29')];_0x447ebf[_0x5568('0x34')]=qs['sort'](_0x4db441[_0x5568('0x2b')][_0x5568('0x35')]);_0x447ebf['where']=qs[_0x5568('0x2e')](_[_0x5568('0x37')](_0x4db441[_0x5568('0x2b')],_0x303303[_0x5568('0x2e')]));if(_0x4db441['query']['filter']){_0x447ebf[_0x5568('0x36')]=_[_0x5568('0x3a')](_0x447ebf[_0x5568('0x36')],{'$or':_['map'](_0x447ebf[_0x5568('0x30')],function(_0x1fd048){var _0x32b98d={};_0x32b98d[_0x1fd048]={'$like':'%'+_0x4db441[_0x5568('0x2b')][_0x5568('0x3b')]+'%'};return _0x32b98d;})});}_0x447ebf=_[_0x5568('0x3a')]({},_0x447ebf,_0x4db441[_0x5568('0x3c')]);return _0x35fe89[_0x5568('0x57')](_0x447ebf);}})['then'](function(_0x5b48fc){if(_0x5b48fc){_0x1e7632=_0x5b48fc[_0x5568('0x32')];if(!_0x4db441[_0x5568('0x2b')][_0x5568('0x4c')](_0x5568('0x33'))){_0x447ebf['limit']=qs[_0x5568('0x19')](_0x4db441[_0x5568('0x2b')][_0x5568('0x19')]);_0x447ebf['offset']=qs[_0x5568('0x18')](_0x4db441[_0x5568('0x2b')]['offset']);}return _0x35fe89[_0x5568('0x57')](_0x447ebf);}})[_0x5568('0x20')](function(_0x96a9f0){if(_0x96a9f0){return _0x96a9f0?{'count':_0x1e7632,'rows':_0x96a9f0}:null;}})[_0x5568('0x20')](respondWithResult(_0x25e96a,null))[_0x5568('0x44')](handleError(_0x25e96a,null));};exports['addTeams']=function(_0x286e66,_0x725aed,_0x6ce698){var _0x4463d0=[];var _0x3cb525;return db['Team'][_0x5568('0x40')]({'where':{'id':_0x286e66[_0x5568('0x46')][_0x5568('0x59')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5568('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5568('0x20')](function(_0x36c1fb){if(_0x36c1fb){for(var _0x52117a=0x0;_0x52117a<_0x36c1fb[_0x5568('0x32')];_0x52117a+=0x1){for(var _0x35ee08=0x0;_0x35ee08<_0x36c1fb[_0x52117a][_0x5568('0x5a')][_0x5568('0x32')];_0x35ee08+=0x1){_0x4463d0=_[_0x5568('0x5b')](_0x4463d0,[_0x36c1fb[_0x52117a][_0x5568('0x5a')][_0x35ee08]['id']]);}}return _0x4463d0;}})[_0x5568('0x20')](function(_0x1e75a3){if(_0x1e75a3){return db[_0x5568('0x27')]['find']({'where':{'id':_0x286e66[_0x5568('0x48')]['id']}});}})[_0x5568('0x20')](function(_0x13064a){if(_0x13064a){_0x3cb525=_0x13064a;return _0x3cb525['addAgents'](_0x4463d0,{'penalty':_0x286e66[_0x5568('0x46')]['penalty']});}})['then'](function(_0x2af086){if(_0x2af086){return _0x3cb525[_0x5568('0x5c')](_0x286e66[_0x5568('0x46')][_0x5568('0x59')]);}})['then'](handleEntityNotFound(_0x725aed,null))['then'](respondWithStatusCode(_0x725aed,null))['catch'](handleError(_0x725aed,null));};exports[_0x5568('0x5d')]=function(_0x5720fc,_0x357df0,_0x59aa0e){var _0x24bab3=[];var _0x8c9064;return db[_0x5568('0x58')][_0x5568('0x40')]({'where':{'id':_0x5720fc[_0x5568('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5568('0x5e')],'as':_0x5568('0x5a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xab8834){if(_0xab8834){for(var _0x501c45=0x0;_0x501c45<_0xab8834[_0x5568('0x32')];_0x501c45+=0x1){for(var _0x6037f0=0x0;_0x6037f0<_0xab8834[_0x501c45][_0x5568('0x5a')][_0x5568('0x32')];_0x6037f0+=0x1){_0x24bab3=_['union'](_0x24bab3,[_0xab8834[_0x501c45]['Agents'][_0x6037f0]['id']]);}}return _0x24bab3;}})[_0x5568('0x20')](function(_0x41ee84){if(_0x41ee84){return db[_0x5568('0x27')]['find']({'where':{'id':_0x5720fc['params']['id']}});}})['then'](function(_0x5cce7f){if(_0x5cce7f){_0x8c9064=_0x5cce7f;return _0x8c9064[_0x5568('0x5f')](_0x24bab3);}})[_0x5568('0x20')](function(_0x33b658){if(_0x8c9064){return _0x8c9064[_0x5568('0x5d')](_0x5720fc[_0x5568('0x2b')][_0x5568('0x59')]);}})['then'](handleEntityNotFound(_0x357df0,null))[_0x5568('0x20')](respondWithStatusCode(_0x357df0,null))[_0x5568('0x44')](handleError(_0x357df0,null));};exports[_0x5568('0x60')]=function(_0x1e3852,_0x442c40,_0x40bb32){return db[_0x5568('0x27')][_0x5568('0x43')]({'where':{'id':_0x1e3852[_0x5568('0x48')]['id']}})[_0x5568('0x20')](handleEntityNotFound(_0x442c40,null))[_0x5568('0x20')](function(_0x4d2986){if(_0x4d2986){return _0x4d2986[_0x5568('0x60')](_0x1e3852['body']['ids'],_[_0x5568('0x61')](_0x1e3852[_0x5568('0x46')],[_0x5568('0x59'),'id'])||{})[_0x5568('0x62')](function(_0x40ef2f){for(var _0x8cd620=0x0;_0x8cd620<_0x1e3852[_0x5568('0x46')]['ids'][_0x5568('0x32')];_0x8cd620+=0x1){socket[_0x5568('0x63')](_0x5568('0x64'),{'UserId':_0x1e3852[_0x5568('0x46')][_0x5568('0x59')][_0x8cd620],'SmsQueueId':_0x1e3852[_0x5568('0x48')]['id']});}return _0x40ef2f;});}})[_0x5568('0x20')](respondWithResult(_0x442c40,null))['catch'](handleError(_0x442c40,null));};exports[_0x5568('0x5f')]=function(_0x4e0871,_0x36fcb2,_0x101e2f){var _0x9229bb;return db['SmsQueue'][_0x5568('0x43')]({'where':{'id':_0x4e0871['params']['id']}})[_0x5568('0x20')](handleEntityNotFound(_0x36fcb2,null))[_0x5568('0x20')](function(_0x599aff){if(_0x599aff){return _0x599aff['removeAgents'](_0x4e0871[_0x5568('0x2b')][_0x5568('0x59')])[_0x5568('0x20')](function(_0x1c8763){if(_[_0x5568('0x65')](_0x4e0871[_0x5568('0x2b')][_0x5568('0x59')])){for(var _0x5eabcd=0x0;_0x5eabcd<_0x4e0871['query'][_0x5568('0x59')][_0x5568('0x32')];_0x5eabcd+=0x1){socket['emit'](_0x5568('0x66'),{'UserId':_0x4e0871['query'][_0x5568('0x59')][_0x5eabcd],'SmsQueueId':_0x4e0871['params']['id']});}}else{socket[_0x5568('0x63')](_0x5568('0x66'),{'UserId':_0x4e0871[_0x5568('0x2b')][_0x5568('0x59')],'SmsQueueId':_0x4e0871[_0x5568('0x48')]['id']});}});}})['then'](respondWithStatusCode(_0x36fcb2,null))['catch'](handleError(_0x36fcb2,null));};exports[_0x5568('0x67')]=function(_0x3ce28f,_0x48aa27,_0x1cefea){var _0x353359={};var _0x1cdbcf={};var _0x36951f;var _0x4d2115;return db['SmsQueue']['findOne']({'where':{'id':_0x3ce28f['params']['id']}})[_0x5568('0x20')](handleEntityNotFound(_0x48aa27,null))['then'](function(_0x11ab79){if(_0x11ab79){_0x36951f=_0x11ab79;_0x1cdbcf[_0x5568('0x29')]=_[_0x5568('0x2a')](db[_0x5568('0x5e')][_0x5568('0x28')]);_0x1cdbcf['query']=_['keys'](_0x3ce28f[_0x5568('0x2b')]);_0x1cdbcf[_0x5568('0x2e')]=_[_0x5568('0x2f')](_0x1cdbcf[_0x5568('0x29')],_0x1cdbcf['query']);_0x353359[_0x5568('0x30')]=_[_0x5568('0x2f')](_0x1cdbcf[_0x5568('0x29')],qs['fields'](_0x3ce28f[_0x5568('0x2b')][_0x5568('0x31')]));_0x353359[_0x5568('0x30')]=_0x353359[_0x5568('0x30')][_0x5568('0x32')]?_0x353359['attributes']:_0x1cdbcf[_0x5568('0x29')];_0x353359['order']=qs['sort'](_0x3ce28f[_0x5568('0x2b')]['sort']);_0x353359[_0x5568('0x36')]=qs[_0x5568('0x2e')](_[_0x5568('0x37')](_0x3ce28f[_0x5568('0x2b')],_0x1cdbcf[_0x5568('0x2e')]));if(_0x3ce28f['query'][_0x5568('0x3b')]){_0x353359['where']=_[_0x5568('0x3a')](_0x353359[_0x5568('0x36')],{'$or':_[_0x5568('0x4e')](_0x353359[_0x5568('0x30')],function(_0xd07ae3){var _0x370edd={};_0x370edd[_0xd07ae3]={'$like':'%'+_0x3ce28f['query'][_0x5568('0x3b')]+'%'};return _0x370edd;})});}_0x353359=_[_0x5568('0x3a')]({},_0x353359,_0x3ce28f[_0x5568('0x3c')]);return _0x36951f['getAgents'](_0x353359);}})[_0x5568('0x20')](function(_0x17d293){if(_0x17d293){_0x4d2115=_0x17d293[_0x5568('0x32')];if(!_0x3ce28f[_0x5568('0x2b')][_0x5568('0x4c')]('nolimit')){_0x353359[_0x5568('0x19')]=qs[_0x5568('0x19')](_0x3ce28f[_0x5568('0x2b')][_0x5568('0x19')]);_0x353359[_0x5568('0x18')]=qs[_0x5568('0x18')](_0x3ce28f[_0x5568('0x2b')][_0x5568('0x18')]);}return _0x36951f[_0x5568('0x67')](_0x353359);}})['then'](function(_0x358f57){if(_0x358f57){return _0x358f57?{'count':_0x4d2115,'rows':_0x358f57}:null;}})[_0x5568('0x20')](respondWithResult(_0x48aa27,null))[_0x5568('0x44')](handleError(_0x48aa27,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 42a6885..ff6e320 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 _0x0fcb=['save','update','remove','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x1fbce6,_0x1db371){var _0x3c1ad9=function(_0x3d9f28){while(--_0x3d9f28){_0x1fbce6['push'](_0x1fbce6['shift']());}};_0x3c1ad9(++_0x1db371);}(_0x0fcb,0x16d));var _0xb0fc=function(_0x18c4b8,_0x26b358){_0x18c4b8=_0x18c4b8-0x0;var _0x3940c9=_0x0fcb[_0x18c4b8];return _0x3940c9;};'use strict';var EventEmitter=require(_0xb0fc('0x0'));var SmsQueue=require(_0xb0fc('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb0fc('0x2')](0x0);var events={'afterCreate':_0xb0fc('0x3'),'afterUpdate':_0xb0fc('0x4'),'afterDestroy':_0xb0fc('0x5')};function emitEvent(_0x515af1){return function(_0xb92f20,_0x2d3024,_0x15335b){SmsQueueEvents[_0xb0fc('0x6')](_0x515af1+':'+_0xb92f20['id'],_0xb92f20);SmsQueueEvents[_0xb0fc('0x6')](_0x515af1,_0xb92f20);_0x15335b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xb0fc('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xbc08=['save','update','remove','emit','hasOwnProperty','events','SmsQueue'];(function(_0x5d11a5,_0x33ce3a){var _0x468588=function(_0x9d906){while(--_0x9d906){_0x5d11a5['push'](_0x5d11a5['shift']());}};_0x468588(++_0x33ce3a);}(_0xbc08,0x1e8));var _0x8bc0=function(_0x4ce02e,_0x4486a9){_0x4ce02e=_0x4ce02e-0x0;var _0x4aab50=_0xbc08[_0x4ce02e];return _0x4aab50;};'use strict';var EventEmitter=require(_0x8bc0('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x8bc0('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8bc0('0x2'),'afterUpdate':_0x8bc0('0x3'),'afterDestroy':_0x8bc0('0x4')};function emitEvent(_0x2de019){return function(_0x2bd7ac,_0x536688,_0x1e74b3){SmsQueueEvents[_0x8bc0('0x5')](_0x2de019+':'+_0x2bd7ac['id'],_0x2bd7ac);SmsQueueEvents[_0x8bc0('0x5')](_0x2de019,_0x2bd7ac);_0x1e74b3(null);};}for(var e in events){if(events[_0x8bc0('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index cf5866e..e4a20e8 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 _0xd28f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./smsQueue.attributes','exports','SmsQueue','sms_queues'];(function(_0xe2269e,_0xa632da){var _0x598a5a=function(_0x4e43a1){while(--_0x4e43a1){_0xe2269e['push'](_0xe2269e['shift']());}};_0x598a5a(++_0xa632da);}(_0xd28f,0x14a));var _0xfd28=function(_0x343daa,_0x846318){_0x343daa=_0x343daa-0x0;var _0x81cc64=_0xd28f[_0x343daa];return _0x81cc64;};'use strict';var _=require(_0xfd28('0x0'));var util=require(_0xfd28('0x1'));var logger=require(_0xfd28('0x2'))(_0xfd28('0x3'));var moment=require(_0xfd28('0x4'));var BPromise=require(_0xfd28('0x5'));var rp=require(_0xfd28('0x6'));var attributes=require(_0xfd28('0x7'));module[_0xfd28('0x8')]=function(_0x5de66b,_0x2f6ca4){return _0x5de66b['define'](_0xfd28('0x9'),attributes,{'tableName':_0xfd28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc26c=['../../config/logger','bluebird','request-promise','./smsQueue.attributes','exports','SmsQueue','lodash','util'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc26c,0xd6));var _0xcc26=function(_0x33435d,_0x2817c6){_0x33435d=_0x33435d-0x0;var _0x1e5573=_0xc26c[_0x33435d];return _0x1e5573;};'use strict';var _=require(_0xcc26('0x0'));var util=require(_0xcc26('0x1'));var logger=require(_0xcc26('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcc26('0x3'));var rp=require(_0xcc26('0x4'));var attributes=require(_0xcc26('0x5'));module[_0xcc26('0x6')]=function(_0x5dbe30,_0x1e3f74){return _0x5dbe30['define'](_0xcc26('0x7'),attributes,{'tableName':'sms_queues','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 78981b3..35f2430 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 _0x9174=['SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SmsQueue','options','raw','include','model','map','attributes','GetSmsQueue','debug','ShowSmsQueue','find','where','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','socket.io-emitter','localhost','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0x9174,0x112));var _0x4917=function(_0x99362b,_0x4425d3){_0x99362b=_0x99362b-0x0;var _0x4f6fe7=_0x9174[_0x99362b];return _0x4f6fe7;};'use strict';var _=require(_0x4917('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4917('0x1'));var fs=require('fs');var db=require(_0x4917('0x2'))['db'];var utils=require(_0x4917('0x3'));var logger=require(_0x4917('0x4'))(_0x4917('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4917('0x6')]['http']({'port':0x232a});var socket=require(_0x4917('0x7'))({'host':_0x4917('0x8'),'port':0x18eb});require(_0x4917('0x9'))[_0x4917('0xa')](socket);function respondWithRpcPromise(_0x4ad4cd,_0x1013c5,_0x4412cc){return new BPromise(function(_0x42e0e8,_0x1e05de){return client['request'](_0x4ad4cd,_0x4412cc)[_0x4917('0xb')](function(_0x4a32b7){logger[_0x4917('0xc')](_0x4917('0xd'),_0x1013c5,'request\x20sent');logger['debug'](_0x4917('0xe'),_0x1013c5,'request\x20sent',JSON[_0x4917('0xf')](_0x4a32b7));if(_0x4a32b7['error']){if(_0x4a32b7[_0x4917('0x10')]['code']===0x1f4){logger[_0x4917('0x10')]('SmsQueue,\x20%s,\x20%s',_0x1013c5,_0x4a32b7[_0x4917('0x10')]['message']);return _0x1e05de(_0x4a32b7[_0x4917('0x10')][_0x4917('0x11')]);}logger[_0x4917('0x10')](_0x4917('0xd'),_0x1013c5,_0x4a32b7[_0x4917('0x10')][_0x4917('0x11')]);return _0x42e0e8(_0x4a32b7[_0x4917('0x10')]['message']);}else{logger['info'](_0x4917('0xd'),_0x1013c5,'request\x20sent');_0x42e0e8(_0x4a32b7[_0x4917('0x12')][_0x4917('0x11')]);}})['catch'](function(_0x5a45e3){logger['error']('SmsQueue,\x20%s,\x20%s',_0x1013c5,_0x5a45e3);_0x1e05de(_0x5a45e3);});});}exports['GetSmsQueue']=function(_0x4c664b){var _0x375c03=this;return new Promise(function(_0x585ea9,_0x247c8b){return db[_0x4917('0x13')]['findAll']({'raw':_0x4c664b[_0x4917('0x14')]?_0x4c664b[_0x4917('0x14')][_0x4917('0x15')]===undefined?!![]:![]:!![],'where':_0x4c664b['options']?_0x4c664b[_0x4917('0x14')]['where']||null:null,'attributes':_0x4c664b['options']?_0x4c664b[_0x4917('0x14')]['attributes']||null:null,'limit':_0x4c664b['options']?_0x4c664b[_0x4917('0x14')]['limit']||null:null,'include':_0x4c664b[_0x4917('0x14')]?_0x4c664b[_0x4917('0x14')][_0x4917('0x16')]?_['map'](_0x4c664b['options'][_0x4917('0x16')],function(_0x29accb){return{'model':db[_0x29accb[_0x4917('0x17')]],'as':_0x29accb['as'],'attributes':_0x29accb['attributes'],'include':_0x29accb['include']?_[_0x4917('0x18')](_0x29accb['include'],function(_0x1bd4dd){return{'model':db[_0x1bd4dd[_0x4917('0x17')]],'as':_0x1bd4dd['as'],'attributes':_0x1bd4dd[_0x4917('0x19')],'include':_0x1bd4dd['include']?_[_0x4917('0x18')](_0x1bd4dd[_0x4917('0x16')],function(_0x47b66d){return{'model':db[_0x47b66d[_0x4917('0x17')]],'as':_0x47b66d['as'],'attributes':_0x47b66d[_0x4917('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4917('0xb')](function(_0x298314){logger[_0x4917('0xc')](_0x4917('0x1a'),_0x4c664b);logger[_0x4917('0x1b')](_0x4917('0x1a'),_0x4c664b,JSON['stringify'](_0x298314));_0x585ea9(_0x298314);})['catch'](function(_0x3e200b){logger['error'](_0x4917('0x1a'),_0x3e200b[_0x4917('0x11')],_0x4c664b);_0x247c8b(_0x375c03[_0x4917('0x10')](0x1f4,_0x3e200b[_0x4917('0x11')]));});});};exports[_0x4917('0x1c')]=function(_0x3baa7){var _0x15ea5a=this;return new Promise(function(_0x188751,_0xd357c1){return db['SmsQueue'][_0x4917('0x1d')]({'raw':_0x3baa7[_0x4917('0x14')]?_0x3baa7[_0x4917('0x14')][_0x4917('0x15')]===undefined?!![]:![]:!![],'where':_0x3baa7[_0x4917('0x14')]?_0x3baa7[_0x4917('0x14')][_0x4917('0x1e')]||null:null,'attributes':_0x3baa7[_0x4917('0x14')]?_0x3baa7[_0x4917('0x14')]['attributes']||null:null,'include':_0x3baa7[_0x4917('0x14')]?_0x3baa7['options'][_0x4917('0x16')]?_[_0x4917('0x18')](_0x3baa7['options']['include'],function(_0x1dd4e3){return{'model':db[_0x1dd4e3[_0x4917('0x17')]],'as':_0x1dd4e3['as'],'attributes':_0x1dd4e3[_0x4917('0x19')],'include':_0x1dd4e3[_0x4917('0x16')]?_[_0x4917('0x18')](_0x1dd4e3[_0x4917('0x16')],function(_0x5e1636){return{'model':db[_0x5e1636['model']],'as':_0x5e1636['as'],'attributes':_0x5e1636[_0x4917('0x19')],'include':_0x5e1636['include']?_[_0x4917('0x18')](_0x5e1636['include'],function(_0x54e99a){return{'model':db[_0x54e99a['model']],'as':_0x54e99a['as'],'attributes':_0x54e99a[_0x4917('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4917('0xb')](function(_0xb14112){logger[_0x4917('0xc')](_0x4917('0x1c'),_0x3baa7);logger[_0x4917('0x1b')](_0x4917('0x1c'),_0x3baa7,JSON[_0x4917('0xf')](_0xb14112));_0x188751(_0xb14112);})[_0x4917('0x1f')](function(_0x27dc16){logger[_0x4917('0x10')](_0x4917('0x1c'),_0x27dc16[_0x4917('0x11')],_0x3baa7);_0xd357c1(_0x15ea5a[_0x4917('0x10')](0x1f4,_0x27dc16['message']));});});}; \ No newline at end of file +var _0xf802=['raw','options','where','attributes','limit','include','model','map','stringify','ShowSmsQueue','SmsQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','request','then','request\x20sent','debug','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0xf802,0x108));var _0x2f80=function(_0x155455,_0x24d212){_0x155455=_0x155455-0x0;var _0x34b716=_0xf802[_0x155455];return _0x34b716;};'use strict';var _=require(_0x2f80('0x0'));var util=require(_0x2f80('0x1'));var moment=require(_0x2f80('0x2'));var BPromise=require(_0x2f80('0x3'));var rs=require(_0x2f80('0x4'));var fs=require('fs');var db=require(_0x2f80('0x5'))['db'];var utils=require(_0x2f80('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f80('0x7'));var jayson=require(_0x2f80('0x8'));var client=jayson['client'][_0x2f80('0x9')]({'port':0x232a});var socket=require(_0x2f80('0xa'))({'host':_0x2f80('0xb'),'port':0x18eb});require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4e3eab,_0xfdd432,_0xfa1ae4){return new BPromise(function(_0x48b398,_0x1bbdfd){return client[_0x2f80('0xc')](_0x4e3eab,_0xfa1ae4)[_0x2f80('0xd')](function(_0x392214){logger['info']('SmsQueue,\x20%s,\x20%s',_0xfdd432,_0x2f80('0xe'));logger[_0x2f80('0xf')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0xfdd432,_0x2f80('0xe'),JSON['stringify'](_0x392214));if(_0x392214['error']){if(_0x392214[_0x2f80('0x10')][_0x2f80('0x11')]===0x1f4){logger[_0x2f80('0x10')](_0x2f80('0x12'),_0xfdd432,_0x392214[_0x2f80('0x10')][_0x2f80('0x13')]);return _0x1bbdfd(_0x392214[_0x2f80('0x10')][_0x2f80('0x13')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0xfdd432,_0x392214[_0x2f80('0x10')][_0x2f80('0x13')]);return _0x48b398(_0x392214[_0x2f80('0x10')][_0x2f80('0x13')]);}else{logger[_0x2f80('0x14')](_0x2f80('0x12'),_0xfdd432,'request\x20sent');_0x48b398(_0x392214[_0x2f80('0x15')][_0x2f80('0x13')]);}})[_0x2f80('0x16')](function(_0x504cb5){logger['error'](_0x2f80('0x12'),_0xfdd432,_0x504cb5);_0x1bbdfd(_0x504cb5);});});}exports[_0x2f80('0x17')]=function(_0x40e4f8){var _0x3c079a=this;return new Promise(function(_0x2c0646,_0x56a437){return db['SmsQueue']['findAll']({'raw':_0x40e4f8['options']?_0x40e4f8['options'][_0x2f80('0x18')]===undefined?!![]:![]:!![],'where':_0x40e4f8[_0x2f80('0x19')]?_0x40e4f8[_0x2f80('0x19')][_0x2f80('0x1a')]||null:null,'attributes':_0x40e4f8[_0x2f80('0x19')]?_0x40e4f8[_0x2f80('0x19')][_0x2f80('0x1b')]||null:null,'limit':_0x40e4f8['options']?_0x40e4f8[_0x2f80('0x19')][_0x2f80('0x1c')]||null:null,'include':_0x40e4f8[_0x2f80('0x19')]?_0x40e4f8[_0x2f80('0x19')]['include']?_['map'](_0x40e4f8[_0x2f80('0x19')][_0x2f80('0x1d')],function(_0x47a1d7){return{'model':db[_0x47a1d7[_0x2f80('0x1e')]],'as':_0x47a1d7['as'],'attributes':_0x47a1d7[_0x2f80('0x1b')],'include':_0x47a1d7[_0x2f80('0x1d')]?_[_0x2f80('0x1f')](_0x47a1d7[_0x2f80('0x1d')],function(_0x250ccf){return{'model':db[_0x250ccf['model']],'as':_0x250ccf['as'],'attributes':_0x250ccf[_0x2f80('0x1b')],'include':_0x250ccf[_0x2f80('0x1d')]?_[_0x2f80('0x1f')](_0x250ccf[_0x2f80('0x1d')],function(_0x46fdec){return{'model':db[_0x46fdec[_0x2f80('0x1e')]],'as':_0x46fdec['as'],'attributes':_0x46fdec['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f80('0xd')](function(_0x264155){logger[_0x2f80('0x14')](_0x2f80('0x17'),_0x40e4f8);logger['debug']('GetSmsQueue',_0x40e4f8,JSON[_0x2f80('0x20')](_0x264155));_0x2c0646(_0x264155);})[_0x2f80('0x16')](function(_0x4f7c93){logger[_0x2f80('0x10')](_0x2f80('0x17'),_0x4f7c93['message'],_0x40e4f8);_0x56a437(_0x3c079a[_0x2f80('0x10')](0x1f4,_0x4f7c93[_0x2f80('0x13')]));});});};exports[_0x2f80('0x21')]=function(_0x5d4cd9){var _0x5f0fb6=this;return new Promise(function(_0x2b4a8f,_0x3a9d8d){return db[_0x2f80('0x22')][_0x2f80('0x23')]({'raw':_0x5d4cd9[_0x2f80('0x19')]?_0x5d4cd9['options'][_0x2f80('0x18')]===undefined?!![]:![]:!![],'where':_0x5d4cd9[_0x2f80('0x19')]?_0x5d4cd9['options'][_0x2f80('0x1a')]||null:null,'attributes':_0x5d4cd9['options']?_0x5d4cd9[_0x2f80('0x19')][_0x2f80('0x1b')]||null:null,'include':_0x5d4cd9[_0x2f80('0x19')]?_0x5d4cd9['options'][_0x2f80('0x1d')]?_['map'](_0x5d4cd9[_0x2f80('0x19')][_0x2f80('0x1d')],function(_0x4b54e6){return{'model':db[_0x4b54e6[_0x2f80('0x1e')]],'as':_0x4b54e6['as'],'attributes':_0x4b54e6['attributes'],'include':_0x4b54e6['include']?_[_0x2f80('0x1f')](_0x4b54e6[_0x2f80('0x1d')],function(_0x278a42){return{'model':db[_0x278a42[_0x2f80('0x1e')]],'as':_0x278a42['as'],'attributes':_0x278a42[_0x2f80('0x1b')],'include':_0x278a42['include']?_[_0x2f80('0x1f')](_0x278a42['include'],function(_0x41ce21){return{'model':db[_0x41ce21['model']],'as':_0x41ce21['as'],'attributes':_0x41ce21[_0x2f80('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2f80('0xd')](function(_0x3da840){logger[_0x2f80('0x14')](_0x2f80('0x21'),_0x5d4cd9);logger[_0x2f80('0xf')](_0x2f80('0x21'),_0x5d4cd9,JSON[_0x2f80('0x20')](_0x3da840));_0x2b4a8f(_0x3da840);})[_0x2f80('0x16')](function(_0x59c458){logger['error'](_0x2f80('0x21'),_0x59c458[_0x2f80('0x13')],_0x5d4cd9);_0x3a9d8d(_0x5f0fb6['error'](0x1f4,_0x59c458[_0x2f80('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 868ebc8..fa92c4f 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 _0x814b=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x814b,0x1a2));var _0xb814=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x814b[_0x3f6bcf];return _0x1c5350;};'use strict';var SmsQueueEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){SmsQueueEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);SmsQueueEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0x1636=['smsQueue:','./smsQueue.events','remove','removeListener','register','length'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x1636,0x1b1));var _0x6163=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1636[_0x17d9e3];return _0x14192d;};'use strict';var SmsQueueEvents=require(_0x6163('0x0'));var events=['save',_0x6163('0x1'),'update'];function createListener(_0x200b8f,_0x2b9111){return function(_0x3fe254){_0x2b9111['emit'](_0x200b8f,_0x3fe254);};}function removeListener(_0x5d81b6,_0x3fb2c5){return function(){SmsQueueEvents[_0x6163('0x2')](_0x5d81b6,_0x3fb2c5);};}exports[_0x6163('0x3')]=function(_0x5a2fb2){for(var _0x3bc1fa=0x0,_0x3705ec=events[_0x6163('0x4')];_0x3bc1fa<_0x3705ec;_0x3bc1fa++){var _0x417353=events[_0x3bc1fa];var _0x332d4e=createListener(_0x6163('0x5')+_0x417353,_0x5a2fb2);SmsQueueEvents['on'](_0x417353,_0x332d4e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8b9d050..3542b78 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 _0x5ec6=['util','path','Router','../../components/interaction/service','./smsQueueReport.controller','isAuthenticated','get','/describe','describe','show','post','put','update','/:id','exports','multer'];(function(_0x5e9aa4,_0x4f71e4){var _0x8de2b2=function(_0x32d6a1){while(--_0x32d6a1){_0x5e9aa4['push'](_0x5e9aa4['shift']());}};_0x8de2b2(++_0x4f71e4);}(_0x5ec6,0x7f));var _0x65ec=function(_0x55cc1f,_0x568f59){_0x55cc1f=_0x55cc1f-0x0;var _0x1d01b9=_0x5ec6[_0x55cc1f];return _0x1d01b9;};'use strict';var multer=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var path=require(_0x65ec('0x2'));var express=require('express');var router=express[_0x65ec('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x65ec('0x4'));var config=require('../../config/environment');var controller=require(_0x65ec('0x5'));router['get']('/',auth[_0x65ec('0x6')](),controller['index']);router[_0x65ec('0x7')](_0x65ec('0x8'),auth['isAuthenticated'](),controller[_0x65ec('0x9')]);router[_0x65ec('0x7')]('/:id',auth[_0x65ec('0x6')](),controller[_0x65ec('0xa')]);router[_0x65ec('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65ec('0xc')]('/:id',auth[_0x65ec('0x6')](),controller[_0x65ec('0xd')]);router['delete'](_0x65ec('0xe'),auth[_0x65ec('0x6')](),controller['destroy']);module[_0x65ec('0xf')]=router; \ No newline at end of file +var _0xb903=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','multer','util'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xb903,0x185));var _0x3b90=function(_0xfc6e18,_0x37675c){_0xfc6e18=_0xfc6e18-0x0;var _0xeb63f9=_0xb903[_0xfc6e18];return _0xeb63f9;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var express=require(_0x3b90('0x3'));var router=express['Router']();var auth=require(_0x3b90('0x4'));var interaction=require(_0x3b90('0x5'));var config=require(_0x3b90('0x6'));var controller=require(_0x3b90('0x7'));router[_0x3b90('0x8')]('/',auth[_0x3b90('0x9')](),controller[_0x3b90('0xa')]);router['get'](_0x3b90('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3b90('0x8')](_0x3b90('0xc'),auth[_0x3b90('0x9')](),controller[_0x3b90('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3b90('0xe')]);router[_0x3b90('0xf')]('/:id',auth[_0x3b90('0x9')](),controller[_0x3b90('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 2bc5484..d07efa7 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 _0x3c81=['sequelize','exports','DATE','STRING'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3c81,0x94));var _0x13c8=function(_0x4fae9e,_0x3f19a4){_0x4fae9e=_0x4fae9e-0x0;var _0x1228f6=_0x3c81[_0x4fae9e];return _0x1228f6;};'use strict';var moment=require('moment');var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x13c8('0x2')]},'leaveAt':{'type':Sequelize[_0x13c8('0x2')]},'acceptAt':{'type':Sequelize[_0x13c8('0x2')]},'exitAt':{'type':Sequelize[_0x13c8('0x2')]},'reason':{'type':Sequelize[_0x13c8('0x3')]}}; \ No newline at end of file +var _0xb1aa=['STRING','DATE','moment'];(function(_0x403379,_0x196a84){var _0x560401=function(_0x439e5f){while(--_0x439e5f){_0x403379['push'](_0x403379['shift']());}};_0x560401(++_0x196a84);}(_0xb1aa,0xb3));var _0xab1a=function(_0x3a19b4,_0x521b03){_0x3a19b4=_0x3a19b4-0x0;var _0xd1eec2=_0xb1aa[_0x3a19b4];return _0xd1eec2;};'use strict';var moment=require(_0xab1a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xab1a('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xab1a('0x2')]},'acceptAt':{'type':Sequelize[_0xab1a('0x2')]},'exitAt':{'type':Sequelize[_0xab1a('0x2')]},'reason':{'type':Sequelize[_0xab1a('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d2cf1ed..723fbc0 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 _0xb42f=['length','hasOwnProperty','limit','order','sort','where','pick','day','merge','map','filter','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xb42f,0x1b7));var _0xfb42=function(_0x1f2e1d,_0x13dde1){_0x1f2e1d=_0x1f2e1d-0x0;var _0x25db1=_0xb42f[_0x1f2e1d];return _0x25db1;};'use strict';var jsonpatch=require(_0xfb42('0x0'));var rp=require(_0xfb42('0x1'));var moment=require(_0xfb42('0x2'));var BPromise=require(_0xfb42('0x3'));var Mustache=require(_0xfb42('0x4'));var util=require(_0xfb42('0x5'));var path=require(_0xfb42('0x6'));var sox=require(_0xfb42('0x7'));var csv=require('to-csv');var ejs=require(_0xfb42('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfb42('0x9'));var crypto=require(_0xfb42('0xa'));var jsforce=require(_0xfb42('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfb42('0xc'));var querystring=require(_0xfb42('0xd'));var Papa=require(_0xfb42('0xe'));var qs=require(_0xfb42('0xf'));var logger=require(_0xfb42('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xfb42('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b071a,_0x39aa17){_0x39aa17=_0x39aa17||0xcc;return function(_0xa7e929){if(_0xa7e929){return _0x1b071a[_0xfb42('0x12')](_0x39aa17);}return _0x1b071a[_0xfb42('0x13')](_0x39aa17)[_0xfb42('0x14')]();};}function respondWithResult(_0x241766,_0x422c1b){_0x422c1b=_0x422c1b||0xc8;return function(_0x566594){if(_0x566594){return _0x241766[_0xfb42('0x13')](_0x422c1b)[_0xfb42('0x15')](_0x566594);}};}function respondWithFilteredResult(_0x408079,_0x2a8097){return function(_0x18b926){if(_0x18b926){var _0xd8cb6b=_0x18b926[_0xfb42('0x16')],_0x148ec0=_0x2a8097[_0xfb42('0x17')],_0x22b792=_0x2a8097[_0xfb42('0x17')]+_0x2a8097['limit'],_0x271784;if(_0x22b792>=_0xd8cb6b){_0x22b792=_0xd8cb6b;_0x271784=0xc8;}else{_0x271784=0xce;}_0x408079[_0xfb42('0x13')](_0x271784);return _0x408079[_0xfb42('0x18')](_0xfb42('0x19'),_0x148ec0+'-'+_0x22b792+'/'+_0xd8cb6b)[_0xfb42('0x15')](_0x18b926);}return null;};}function patchUpdates(_0x5c2097){return function(_0x2a43d3){try{jsonpatch[_0xfb42('0x1a')](_0x2a43d3,_0x5c2097,!![]);}catch(_0x4eaf63){return BPromise[_0xfb42('0x1b')](_0x4eaf63);}return _0x2a43d3[_0xfb42('0x1c')]();};}function saveUpdates(_0x48eabc,_0x229e6b){return function(_0x18c253){if(_0x18c253){return _0x18c253[_0xfb42('0x1d')](_0x48eabc)['then'](function(_0x11113f){return _0x11113f;});}return null;};}function removeEntity(_0xc454a3,_0xb581c4){return function(_0xf8e5e3){if(_0xf8e5e3){return _0xf8e5e3[_0xfb42('0x1e')]()[_0xfb42('0x1f')](function(){_0xc454a3['status'](0xcc)[_0xfb42('0x14')]();});}};}function handleEntityNotFound(_0x4dacd2,_0x5194d0){return function(_0x349c70){if(!_0x349c70){_0x4dacd2[_0xfb42('0x12')](0x194);}return _0x349c70;};}function handleError(_0x2dc103,_0x3638f3){_0x3638f3=_0x3638f3||0x1f4;return function(_0x2f43d6){logger[_0xfb42('0x20')](_0x2f43d6[_0xfb42('0x21')]);if(_0x2f43d6[_0xfb42('0x22')]){delete _0x2f43d6[_0xfb42('0x22')];}_0x2dc103[_0xfb42('0x13')](_0x3638f3)['send'](_0x2f43d6);};}exports['index']=function(_0x44653b,_0x113692){var _0x17c747={},_0x25f8bd={},_0x2914cc={'count':0x0,'rows':[]};var _0x155efa=db['SmsQueueReport']['rawAttributes'];_0x25f8bd[_0xfb42('0x23')]=_[_0xfb42('0x24')](_0x155efa);var _0xb9fb89={'dateStart':_0x44653b[_0xfb42('0x25')][_0xfb42('0x26')],'dateEnd':_0x44653b[_0xfb42('0x25')][_0xfb42('0x27')]};delete _0x44653b[_0xfb42('0x25')]['dateStart'];delete _0x44653b[_0xfb42('0x25')]['dateEnd'];_0x25f8bd[_0xfb42('0x25')]=_['keys'](_0x44653b[_0xfb42('0x25')]);_0x25f8bd[_0xfb42('0x28')]=_['intersection'](_0x25f8bd[_0xfb42('0x23')],_0x25f8bd['query']);_0x17c747[_0xfb42('0x29')]=_[_0xfb42('0x2a')](_0x25f8bd['model'],qs[_0xfb42('0x2b')](_0x44653b[_0xfb42('0x25')][_0xfb42('0x2b')]));_0x17c747[_0xfb42('0x29')]=_0x17c747[_0xfb42('0x29')][_0xfb42('0x2c')]?_0x17c747[_0xfb42('0x29')]:_0x25f8bd[_0xfb42('0x23')];if(!_0x44653b[_0xfb42('0x25')][_0xfb42('0x2d')]('nolimit')){_0x17c747[_0xfb42('0x2e')]=qs[_0xfb42('0x2e')](_0x44653b[_0xfb42('0x25')]['limit']);_0x17c747[_0xfb42('0x17')]=qs[_0xfb42('0x17')](_0x44653b['query'][_0xfb42('0x17')]);}_0x17c747[_0xfb42('0x2f')]=qs['sort'](_0x44653b[_0xfb42('0x25')][_0xfb42('0x30')]);_0x17c747[_0xfb42('0x31')]=qs[_0xfb42('0x28')](_[_0xfb42('0x32')](_0x44653b[_0xfb42('0x25')],_0x25f8bd['filters']));if(_0xb9fb89[_0xfb42('0x26')]){if(_0xb9fb89[_0xfb42('0x27')]){_0xb9fb89[_0xfb42('0x27')]=moment(_0xb9fb89['dateEnd'])['add'](0x1,_0xfb42('0x33'));}else{_0xb9fb89[_0xfb42('0x27')]=moment(_0xb9fb89[_0xfb42('0x26')])['add'](0x1,_0xfb42('0x33'));}_[_0xfb42('0x34')](_0x17c747[_0xfb42('0x31')],{'createdAt':{'$gte':_0xb9fb89['dateStart'],'$lte':_0xb9fb89[_0xfb42('0x27')]}});}if(_0x44653b[_0xfb42('0x25')]['filter']){_0x17c747[_0xfb42('0x31')]=_['merge'](_0x17c747[_0xfb42('0x31')],{'$or':_[_0xfb42('0x35')](_0x17c747[_0xfb42('0x29')],function(_0x2b2df5){var _0x4400ce={};_0x4400ce[_0x2b2df5]={'$like':'%'+_0x44653b[_0xfb42('0x25')][_0xfb42('0x36')]+'%'};return _0x4400ce;})});}_0x17c747=_[_0xfb42('0x34')]({},_0x17c747,_0x44653b[_0xfb42('0x37')]);var _0x38de3e={'where':_0x17c747[_0xfb42('0x31')]};return db[_0xfb42('0x38')][_0xfb42('0x16')](_0x38de3e)['then'](function(_0x5cce53){_0x2914cc[_0xfb42('0x16')]=_0x5cce53;if(_0x44653b[_0xfb42('0x25')][_0xfb42('0x39')]){_0x17c747[_0xfb42('0x3a')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xfb42('0x3b')](_0x17c747);})[_0xfb42('0x1f')](function(_0x4f6727){_0x2914cc[_0xfb42('0x3c')]=_0x4f6727;return _0x2914cc;})['then'](respondWithFilteredResult(_0x113692,_0x17c747))[_0xfb42('0x3d')](handleError(_0x113692,null));};exports[_0xfb42('0x3e')]=function(_0x33c280,_0xd9868b){var _0x361348={'raw':!![],'where':{'id':_0x33c280[_0xfb42('0x3f')]['id']}},_0x24019c={};_0x24019c[_0xfb42('0x23')]=_[_0xfb42('0x24')](db[_0xfb42('0x38')][_0xfb42('0x40')]);_0x24019c['query']=_[_0xfb42('0x24')](_0x33c280[_0xfb42('0x25')]);_0x24019c[_0xfb42('0x28')]=_['intersection'](_0x24019c['model'],_0x24019c['query']);_0x361348[_0xfb42('0x29')]=_['intersection'](_0x24019c[_0xfb42('0x23')],qs[_0xfb42('0x2b')](_0x33c280[_0xfb42('0x25')]['fields']));_0x361348[_0xfb42('0x29')]=_0x361348[_0xfb42('0x29')][_0xfb42('0x2c')]?_0x361348[_0xfb42('0x29')]:_0x24019c['model'];if(_0x33c280[_0xfb42('0x25')][_0xfb42('0x39')]){_0x361348[_0xfb42('0x3a')]=[{'all':!![]}];}_0x361348=_[_0xfb42('0x34')]({},_0x361348,_0x33c280['options']);return db[_0xfb42('0x38')]['find'](_0x361348)[_0xfb42('0x1f')](handleEntityNotFound(_0xd9868b,null))['then'](respondWithResult(_0xd9868b,null))[_0xfb42('0x3d')](handleError(_0xd9868b,null));};exports[_0xfb42('0x41')]=function(_0x1beec5,_0xca7347){return db[_0xfb42('0x38')][_0xfb42('0x41')](_0x1beec5[_0xfb42('0x42')],{})['then'](respondWithResult(_0xca7347,0xc9))[_0xfb42('0x3d')](handleError(_0xca7347,null));};exports[_0xfb42('0x1d')]=function(_0x1a56b6,_0x886802){if(_0x1a56b6[_0xfb42('0x42')]['id']){delete _0x1a56b6[_0xfb42('0x42')]['id'];}return db[_0xfb42('0x38')][_0xfb42('0x43')]({'where':{'id':_0x1a56b6['params']['id']}})[_0xfb42('0x1f')](handleEntityNotFound(_0x886802,null))['then'](saveUpdates(_0x1a56b6[_0xfb42('0x42')],null))[_0xfb42('0x1f')](respondWithResult(_0x886802,null))[_0xfb42('0x3d')](handleError(_0x886802,null));};exports[_0xfb42('0x1e')]=function(_0x26fb77,_0x48c519){return db[_0xfb42('0x38')][_0xfb42('0x43')]({'where':{'id':_0x26fb77[_0xfb42('0x3f')]['id']}})[_0xfb42('0x1f')](handleEntityNotFound(_0x48c519,null))['then'](removeEntity(_0x48c519,null))[_0xfb42('0x3d')](handleError(_0x48c519,null));};exports[_0xfb42('0x44')]=function(_0x4a6dd0,_0x5bd0ee){return db[_0xfb42('0x38')]['describe']()[_0xfb42('0x1f')](respondWithResult(_0x5bd0ee,null))[_0xfb42('0x3d')](handleError(_0x5bd0ee,null));}; \ No newline at end of file +var _0xa9c8=['attributes','fields','length','hasOwnProperty','sort','where','day','add','merge','filter','map','options','SmsQueueReport','include','findAll','rows','show','params','includeAll','find','create','body','catch','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model'];(function(_0x1de164,_0x1ccf5f){var _0x5613b4=function(_0x22dca9){while(--_0x22dca9){_0x1de164['push'](_0x1de164['shift']());}};_0x5613b4(++_0x1ccf5f);}(_0xa9c8,0xa4));var _0x8a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c8[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0x8a9c('0x0'));var rp=require(_0x8a9c('0x1'));var moment=require(_0x8a9c('0x2'));var BPromise=require(_0x8a9c('0x3'));var Mustache=require(_0x8a9c('0x4'));var util=require(_0x8a9c('0x5'));var path=require(_0x8a9c('0x6'));var sox=require(_0x8a9c('0x7'));var csv=require(_0x8a9c('0x8'));var ejs=require(_0x8a9c('0x9'));var fs=require('fs');var _=require(_0x8a9c('0xa'));var squel=require(_0x8a9c('0xb'));var crypto=require(_0x8a9c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8a9c('0xd'));var toCsv=require(_0x8a9c('0x8'));var querystring=require(_0x8a9c('0xe'));var Papa=require(_0x8a9c('0xf'));var qs=require(_0x8a9c('0x10'));var logger=require('../../config/logger')(_0x8a9c('0x11'));var utils=require(_0x8a9c('0x12'));var config=require(_0x8a9c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x459d6d,_0x31ce26){_0x31ce26=_0x31ce26||0xcc;return function(_0xd6e884){if(_0xd6e884){return _0x459d6d[_0x8a9c('0x14')](_0x31ce26);}return _0x459d6d[_0x8a9c('0x15')](_0x31ce26)['end']();};}function respondWithResult(_0x18b4cd,_0x5072ef){_0x5072ef=_0x5072ef||0xc8;return function(_0x5385ce){if(_0x5385ce){return _0x18b4cd[_0x8a9c('0x15')](_0x5072ef)[_0x8a9c('0x16')](_0x5385ce);}};}function respondWithFilteredResult(_0x104657,_0x5d3ede){return function(_0x220d6c){if(_0x220d6c){var _0x57f6e6=_0x220d6c['count'],_0x33871f=_0x5d3ede[_0x8a9c('0x17')],_0x2df997=_0x5d3ede[_0x8a9c('0x17')]+_0x5d3ede[_0x8a9c('0x18')],_0x14780f;if(_0x2df997>=_0x57f6e6){_0x2df997=_0x57f6e6;_0x14780f=0xc8;}else{_0x14780f=0xce;}_0x104657[_0x8a9c('0x15')](_0x14780f);return _0x104657[_0x8a9c('0x19')](_0x8a9c('0x1a'),_0x33871f+'-'+_0x2df997+'/'+_0x57f6e6)[_0x8a9c('0x16')](_0x220d6c);}return null;};}function patchUpdates(_0x45a11e){return function(_0x11f170){try{jsonpatch['apply'](_0x11f170,_0x45a11e,!![]);}catch(_0x41adb2){return BPromise[_0x8a9c('0x1b')](_0x41adb2);}return _0x11f170[_0x8a9c('0x1c')]();};}function saveUpdates(_0x2b9c8f,_0x190ab8){return function(_0x15fc13){if(_0x15fc13){return _0x15fc13[_0x8a9c('0x1d')](_0x2b9c8f)[_0x8a9c('0x1e')](function(_0x130f01){return _0x130f01;});}return null;};}function removeEntity(_0x174c86,_0x2eff20){return function(_0x230da0){if(_0x230da0){return _0x230da0[_0x8a9c('0x1f')]()['then'](function(){_0x174c86[_0x8a9c('0x15')](0xcc)[_0x8a9c('0x20')]();});}};}function handleEntityNotFound(_0x4d83b1,_0xfd94b7){return function(_0x1a952e){if(!_0x1a952e){_0x4d83b1['sendStatus'](0x194);}return _0x1a952e;};}function handleError(_0x562dc3,_0x403186){_0x403186=_0x403186||0x1f4;return function(_0x26eb66){logger[_0x8a9c('0x21')](_0x26eb66[_0x8a9c('0x22')]);if(_0x26eb66[_0x8a9c('0x23')]){delete _0x26eb66['name'];}_0x562dc3[_0x8a9c('0x15')](_0x403186)[_0x8a9c('0x24')](_0x26eb66);};}exports[_0x8a9c('0x25')]=function(_0x202ecc,_0x2af42a){var _0x4cf71d={},_0x388c49={},_0x1b0a59={'count':0x0,'rows':[]};var _0x53a042=db['SmsQueueReport'][_0x8a9c('0x26')];_0x388c49['model']=_[_0x8a9c('0x27')](_0x53a042);var _0x4c1f74={'dateStart':_0x202ecc[_0x8a9c('0x28')][_0x8a9c('0x29')],'dateEnd':_0x202ecc[_0x8a9c('0x28')][_0x8a9c('0x2a')]};delete _0x202ecc[_0x8a9c('0x28')][_0x8a9c('0x29')];delete _0x202ecc['query'][_0x8a9c('0x2a')];_0x388c49[_0x8a9c('0x28')]=_[_0x8a9c('0x27')](_0x202ecc[_0x8a9c('0x28')]);_0x388c49[_0x8a9c('0x2b')]=_[_0x8a9c('0x2c')](_0x388c49[_0x8a9c('0x2d')],_0x388c49['query']);_0x4cf71d[_0x8a9c('0x2e')]=_[_0x8a9c('0x2c')](_0x388c49[_0x8a9c('0x2d')],qs['fields'](_0x202ecc[_0x8a9c('0x28')][_0x8a9c('0x2f')]));_0x4cf71d[_0x8a9c('0x2e')]=_0x4cf71d['attributes'][_0x8a9c('0x30')]?_0x4cf71d[_0x8a9c('0x2e')]:_0x388c49['model'];if(!_0x202ecc['query'][_0x8a9c('0x31')]('nolimit')){_0x4cf71d['limit']=qs[_0x8a9c('0x18')](_0x202ecc[_0x8a9c('0x28')][_0x8a9c('0x18')]);_0x4cf71d[_0x8a9c('0x17')]=qs[_0x8a9c('0x17')](_0x202ecc[_0x8a9c('0x28')][_0x8a9c('0x17')]);}_0x4cf71d['order']=qs[_0x8a9c('0x32')](_0x202ecc[_0x8a9c('0x28')][_0x8a9c('0x32')]);_0x4cf71d[_0x8a9c('0x33')]=qs[_0x8a9c('0x2b')](_['pick'](_0x202ecc[_0x8a9c('0x28')],_0x388c49[_0x8a9c('0x2b')]));if(_0x4c1f74[_0x8a9c('0x29')]){if(_0x4c1f74[_0x8a9c('0x2a')]){_0x4c1f74[_0x8a9c('0x2a')]=moment(_0x4c1f74[_0x8a9c('0x2a')])['add'](0x1,_0x8a9c('0x34'));}else{_0x4c1f74[_0x8a9c('0x2a')]=moment(_0x4c1f74[_0x8a9c('0x29')])[_0x8a9c('0x35')](0x1,'day');}_[_0x8a9c('0x36')](_0x4cf71d[_0x8a9c('0x33')],{'createdAt':{'$gte':_0x4c1f74['dateStart'],'$lte':_0x4c1f74[_0x8a9c('0x2a')]}});}if(_0x202ecc['query'][_0x8a9c('0x37')]){_0x4cf71d[_0x8a9c('0x33')]=_[_0x8a9c('0x36')](_0x4cf71d['where'],{'$or':_[_0x8a9c('0x38')](_0x4cf71d[_0x8a9c('0x2e')],function(_0x1a0796){var _0xe9b0e5={};_0xe9b0e5[_0x1a0796]={'$like':'%'+_0x202ecc['query'][_0x8a9c('0x37')]+'%'};return _0xe9b0e5;})});}_0x4cf71d=_[_0x8a9c('0x36')]({},_0x4cf71d,_0x202ecc[_0x8a9c('0x39')]);var _0x544190={'where':_0x4cf71d['where']};return db[_0x8a9c('0x3a')]['count'](_0x544190)[_0x8a9c('0x1e')](function(_0x2c2dea){_0x1b0a59['count']=_0x2c2dea;if(_0x202ecc[_0x8a9c('0x28')]['includeAll']){_0x4cf71d[_0x8a9c('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x8a9c('0x3c')](_0x4cf71d);})['then'](function(_0x483b66){_0x1b0a59[_0x8a9c('0x3d')]=_0x483b66;return _0x1b0a59;})[_0x8a9c('0x1e')](respondWithFilteredResult(_0x2af42a,_0x4cf71d))['catch'](handleError(_0x2af42a,null));};exports[_0x8a9c('0x3e')]=function(_0x535d77,_0x7942c6){var _0x93980d={'raw':!![],'where':{'id':_0x535d77[_0x8a9c('0x3f')]['id']}},_0x2a33e4={};_0x2a33e4[_0x8a9c('0x2d')]=_[_0x8a9c('0x27')](db[_0x8a9c('0x3a')]['rawAttributes']);_0x2a33e4['query']=_[_0x8a9c('0x27')](_0x535d77[_0x8a9c('0x28')]);_0x2a33e4[_0x8a9c('0x2b')]=_[_0x8a9c('0x2c')](_0x2a33e4[_0x8a9c('0x2d')],_0x2a33e4[_0x8a9c('0x28')]);_0x93980d['attributes']=_[_0x8a9c('0x2c')](_0x2a33e4[_0x8a9c('0x2d')],qs[_0x8a9c('0x2f')](_0x535d77['query'][_0x8a9c('0x2f')]));_0x93980d[_0x8a9c('0x2e')]=_0x93980d[_0x8a9c('0x2e')][_0x8a9c('0x30')]?_0x93980d[_0x8a9c('0x2e')]:_0x2a33e4[_0x8a9c('0x2d')];if(_0x535d77[_0x8a9c('0x28')][_0x8a9c('0x40')]){_0x93980d[_0x8a9c('0x3b')]=[{'all':!![]}];}_0x93980d=_['merge']({},_0x93980d,_0x535d77['options']);return db[_0x8a9c('0x3a')][_0x8a9c('0x41')](_0x93980d)[_0x8a9c('0x1e')](handleEntityNotFound(_0x7942c6,null))['then'](respondWithResult(_0x7942c6,null))['catch'](handleError(_0x7942c6,null));};exports[_0x8a9c('0x42')]=function(_0xe7c6ad,_0x55b9f2){return db[_0x8a9c('0x3a')]['create'](_0xe7c6ad['body'],{})[_0x8a9c('0x1e')](respondWithResult(_0x55b9f2,0xc9))['catch'](handleError(_0x55b9f2,null));};exports[_0x8a9c('0x1d')]=function(_0x3773d7,_0x3845b2){if(_0x3773d7[_0x8a9c('0x43')]['id']){delete _0x3773d7[_0x8a9c('0x43')]['id'];}return db[_0x8a9c('0x3a')][_0x8a9c('0x41')]({'where':{'id':_0x3773d7[_0x8a9c('0x3f')]['id']}})[_0x8a9c('0x1e')](handleEntityNotFound(_0x3845b2,null))[_0x8a9c('0x1e')](saveUpdates(_0x3773d7[_0x8a9c('0x43')],null))['then'](respondWithResult(_0x3845b2,null))[_0x8a9c('0x44')](handleError(_0x3845b2,null));};exports[_0x8a9c('0x1f')]=function(_0x612d57,_0x463ac0){return db[_0x8a9c('0x3a')][_0x8a9c('0x41')]({'where':{'id':_0x612d57[_0x8a9c('0x3f')]['id']}})[_0x8a9c('0x1e')](handleEntityNotFound(_0x463ac0,null))[_0x8a9c('0x1e')](removeEntity(_0x463ac0,null))[_0x8a9c('0x44')](handleError(_0x463ac0,null));};exports[_0x8a9c('0x45')]=function(_0x14e3c5,_0x4d71a0){return db['SmsQueueReport'][_0x8a9c('0x45')]()['then'](respondWithResult(_0x4d71a0,null))[_0x8a9c('0x44')](handleError(_0x4d71a0,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b844161..e33f47e 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 _0x9486=['./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x9486,0x10a));var _0x6948=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9486[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x6948('0x0'));var util=require(_0x6948('0x1'));var logger=require(_0x6948('0x2'))(_0x6948('0x3'));var moment=require(_0x6948('0x4'));var BPromise=require(_0x6948('0x5'));var rp=require(_0x6948('0x6'));var attributes=require(_0x6948('0x7'));module[_0x6948('0x8')]=function(_0x450097,_0x341351){return _0x450097[_0x6948('0x9')](_0x6948('0xa'),attributes,{'tableName':_0x6948('0xb'),'paranoid':![],'indexes':[{'name':_0x6948('0xc'),'fields':[_0x6948('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc911=['exports','define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','./smsQueueReport.attributes'];(function(_0x1393ff,_0x23ffbc){var _0x35baf3=function(_0x28748a){while(--_0x28748a){_0x1393ff['push'](_0x1393ff['shift']());}};_0x35baf3(++_0x23ffbc);}(_0xc911,0x9a));var _0x1c91=function(_0x1a3b9a,_0x53bca6){_0x1a3b9a=_0x1a3b9a-0x0;var _0x339160=_0xc911[_0x1a3b9a];return _0x339160;};'use strict';var _=require(_0x1c91('0x0'));var util=require(_0x1c91('0x1'));var logger=require(_0x1c91('0x2'))(_0x1c91('0x3'));var moment=require(_0x1c91('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x1c91('0x5'));module[_0x1c91('0x6')]=function(_0x4a5a0c,_0x4a791a){return _0x4a5a0c[_0x1c91('0x7')](_0x1c91('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x1c91('0x9'),'fields':[_0x1c91('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 8181d92..c47594d 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 _0x0abf=['http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','stringify','UpdateSmsQueueReport','update','where','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x34d2ad,_0x547dde){var _0x548a0f=function(_0x3f0171){while(--_0x3f0171){_0x34d2ad['push'](_0x34d2ad['shift']());}};_0x548a0f(++_0x547dde);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xf0ab('0x3'));var logger=require('../../config/logger')(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var jayson=require(_0xf0ab('0x6'));var client=jayson[_0xf0ab('0x7')][_0xf0ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d2ea8,_0x233afe,_0x57ff3b){return new BPromise(function(_0x2c4628,_0x3f7e2b){return client[_0xf0ab('0x9')](_0x4d2ea8,_0x57ff3b)[_0xf0ab('0xa')](function(_0x480f49){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x233afe,_0xf0ab('0xd'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x233afe,_0xf0ab('0xd'),JSON['stringify'](_0x480f49));if(_0x480f49[_0xf0ab('0xe')]){if(_0x480f49[_0xf0ab('0xe')][_0xf0ab('0xf')]===0x1f4){logger[_0xf0ab('0xe')](_0xf0ab('0xc'),_0x233afe,_0x480f49[_0xf0ab('0xe')][_0xf0ab('0x10')]);return _0x3f7e2b(_0x480f49['error'][_0xf0ab('0x10')]);}logger[_0xf0ab('0xe')](_0xf0ab('0xc'),_0x233afe,_0x480f49[_0xf0ab('0xe')][_0xf0ab('0x10')]);return _0x2c4628(_0x480f49[_0xf0ab('0xe')][_0xf0ab('0x10')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x233afe,_0xf0ab('0xd'));_0x2c4628(_0x480f49[_0xf0ab('0x11')][_0xf0ab('0x10')]);}})[_0xf0ab('0x12')](function(_0x2f4618){logger[_0xf0ab('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x233afe,_0x2f4618);_0x3f7e2b(_0x2f4618);});});}exports[_0xf0ab('0x13')]=function(_0x9e3b47){var _0x1803f0=this;return new Promise(function(_0x1ffeb5,_0x776619){return db[_0xf0ab('0x14')][_0xf0ab('0x15')](_0x9e3b47[_0xf0ab('0x16')],{'raw':_0x9e3b47[_0xf0ab('0x17')]?_0x9e3b47[_0xf0ab('0x17')][_0xf0ab('0x18')]===undefined?!![]:![]:!![]})[_0xf0ab('0xa')](function(_0xf43bc4){logger[_0xf0ab('0xb')](_0xf0ab('0x13'),_0x9e3b47);logger[_0xf0ab('0x19')]('CreateSmsQueueReport',_0x9e3b47,JSON[_0xf0ab('0x1a')](_0xf43bc4));_0x1ffeb5(_0xf43bc4);})[_0xf0ab('0x12')](function(_0x1e1483){logger[_0xf0ab('0xe')](_0xf0ab('0x13'),_0x1e1483[_0xf0ab('0x10')],_0x9e3b47);_0x776619(_0x1803f0[_0xf0ab('0xe')](0x1f4,_0x1e1483[_0xf0ab('0x10')]));});});};exports[_0xf0ab('0x1b')]=function(_0x18bb37){var _0x43119f=this;return new Promise(function(_0x5645b2,_0x585841){return db['SmsQueueReport'][_0xf0ab('0x1c')](_0x18bb37['body'],{'raw':_0x18bb37[_0xf0ab('0x17')]?_0x18bb37[_0xf0ab('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18bb37[_0xf0ab('0x17')]?_0x18bb37[_0xf0ab('0x17')][_0xf0ab('0x1d')]||null:null,'attributes':_0x18bb37[_0xf0ab('0x17')]?_0x18bb37[_0xf0ab('0x17')]['attributes']||null:null,'limit':_0x18bb37[_0xf0ab('0x17')]?_0x18bb37['options']['limit']||null:null})[_0xf0ab('0xa')](function(_0x4306c6){logger[_0xf0ab('0xb')](_0xf0ab('0x1b'),_0x18bb37);logger[_0xf0ab('0x19')](_0xf0ab('0x1b'),_0x18bb37,JSON[_0xf0ab('0x1a')](_0x4306c6));_0x5645b2(_0x4306c6);})[_0xf0ab('0x12')](function(_0x76a3f3){logger[_0xf0ab('0xe')](_0xf0ab('0x1b'),_0x76a3f3[_0xf0ab('0x10')],_0x18bb37);_0x585841(_0x43119f['error'](0x1f4,_0x76a3f3[_0xf0ab('0x10')]));});});}; \ No newline at end of file +var _0x88c3=['limit','lodash','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body','attributes'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x88c3,0x1ee));var _0x388c=function(_0xa0b22d,_0x1b02ce){_0xa0b22d=_0xa0b22d-0x0;var _0x1cacc0=_0x88c3[_0xa0b22d];return _0x1cacc0;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var moment=require(_0x388c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x388c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x388c('0x3'));var config=require(_0x388c('0x4'));var jayson=require(_0x388c('0x5'));var client=jayson[_0x388c('0x6')][_0x388c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23199c,_0x5a1c0d,_0x3e79d8){return new BPromise(function(_0x374b99,_0x26be80){return client[_0x388c('0x8')](_0x23199c,_0x3e79d8)[_0x388c('0x9')](function(_0x17dbf8){logger[_0x388c('0xa')](_0x388c('0xb'),_0x5a1c0d,'request\x20sent');logger[_0x388c('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5a1c0d,'request\x20sent',JSON[_0x388c('0xd')](_0x17dbf8));if(_0x17dbf8[_0x388c('0xe')]){if(_0x17dbf8[_0x388c('0xe')][_0x388c('0xf')]===0x1f4){logger[_0x388c('0xe')](_0x388c('0xb'),_0x5a1c0d,_0x17dbf8[_0x388c('0xe')][_0x388c('0x10')]);return _0x26be80(_0x17dbf8[_0x388c('0xe')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5a1c0d,_0x17dbf8[_0x388c('0xe')][_0x388c('0x10')]);return _0x374b99(_0x17dbf8['error'][_0x388c('0x10')]);}else{logger[_0x388c('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x5a1c0d,'request\x20sent');_0x374b99(_0x17dbf8[_0x388c('0x11')][_0x388c('0x10')]);}})[_0x388c('0x12')](function(_0x4d5230){logger[_0x388c('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x5a1c0d,_0x4d5230);_0x26be80(_0x4d5230);});});}exports[_0x388c('0x13')]=function(_0x5f5cd9){var _0x50ff33=this;return new Promise(function(_0x52c787,_0x36f18a){return db[_0x388c('0x14')][_0x388c('0x15')](_0x5f5cd9['body'],{'raw':_0x5f5cd9[_0x388c('0x16')]?_0x5f5cd9['options'][_0x388c('0x17')]===undefined?!![]:![]:!![]})[_0x388c('0x9')](function(_0x37a5dd){logger['info']('CreateSmsQueueReport',_0x5f5cd9);logger['debug']('CreateSmsQueueReport',_0x5f5cd9,JSON[_0x388c('0xd')](_0x37a5dd));_0x52c787(_0x37a5dd);})['catch'](function(_0xfff1f5){logger['error'](_0x388c('0x13'),_0xfff1f5['message'],_0x5f5cd9);_0x36f18a(_0x50ff33[_0x388c('0xe')](0x1f4,_0xfff1f5['message']));});});};exports[_0x388c('0x18')]=function(_0x348bcd){var _0x12626e=this;return new Promise(function(_0x1924f8,_0x340aba){return db[_0x388c('0x14')][_0x388c('0x19')](_0x348bcd[_0x388c('0x1a')],{'raw':_0x348bcd[_0x388c('0x16')]?_0x348bcd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x348bcd[_0x388c('0x16')]?_0x348bcd['options']['where']||null:null,'attributes':_0x348bcd['options']?_0x348bcd[_0x388c('0x16')][_0x388c('0x1b')]||null:null,'limit':_0x348bcd[_0x388c('0x16')]?_0x348bcd[_0x388c('0x16')][_0x388c('0x1c')]||null:null})[_0x388c('0x9')](function(_0x3032f5){logger[_0x388c('0xa')](_0x388c('0x18'),_0x348bcd);logger[_0x388c('0xc')](_0x388c('0x18'),_0x348bcd,JSON[_0x388c('0xd')](_0x3032f5));_0x1924f8(_0x3032f5);})['catch'](function(_0x4e23ab){logger[_0x388c('0xe')](_0x388c('0x18'),_0x4e23ab[_0x388c('0x10')],_0x348bcd);_0x340aba(_0x12626e['error'](0x1f4,_0x4e23ab[_0x388c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 88754c3..8a244fb 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 _0x1094=['util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','delete','/:id','exports','multer'];(function(_0xf0f7ba,_0x48be70){var _0x44382c=function(_0x5b746c){while(--_0x5b746c){_0xf0f7ba['push'](_0xf0f7ba['shift']());}};_0x44382c(++_0x48be70);}(_0x1094,0x143));var _0x4109=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x1094[_0x58a4fe];return _0x697de2;};'use strict';var multer=require(_0x4109('0x0'));var util=require(_0x4109('0x1'));var path=require('path');var express=require(_0x4109('0x2'));var router=express['Router']();var auth=require(_0x4109('0x3'));var interaction=require(_0x4109('0x4'));var config=require(_0x4109('0x5'));var controller=require(_0x4109('0x6'));router[_0x4109('0x7')]('/',auth['isAuthenticated'](),controller[_0x4109('0x8')]);router[_0x4109('0x7')](_0x4109('0x9'),auth[_0x4109('0xa')](),controller[_0x4109('0xb')]);router[_0x4109('0x7')]('/:id',auth[_0x4109('0xa')](),controller[_0x4109('0xc')]);router[_0x4109('0xd')]('/',auth[_0x4109('0xa')](),controller[_0x4109('0xe')]);router['put']('/:id',auth[_0x4109('0xa')](),controller['update']);router[_0x4109('0xf')](_0x4109('0x10'),auth[_0x4109('0xa')](),controller['destroy']);module[_0x4109('0x11')]=router; \ No newline at end of file +var _0x6953=['exports','multer','util','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy'];(function(_0x4f9b2b,_0x384896){var _0x2a3f2d=function(_0x1650c9){while(--_0x1650c9){_0x4f9b2b['push'](_0x4f9b2b['shift']());}};_0x2a3f2d(++_0x384896);}(_0x6953,0x91));var _0x3695=function(_0x27db33,_0x358b84){_0x27db33=_0x27db33-0x0;var _0x2baf30=_0x6953[_0x27db33];return _0x2baf30;};'use strict';var multer=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x3695('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3695('0x3'));var controller=require(_0x3695('0x4'));router[_0x3695('0x5')]('/',auth['isAuthenticated'](),controller[_0x3695('0x6')]);router['get'](_0x3695('0x7'),auth[_0x3695('0x8')](),controller[_0x3695('0x9')]);router[_0x3695('0x5')](_0x3695('0xa'),auth['isAuthenticated'](),controller[_0x3695('0xb')]);router['post']('/',auth[_0x3695('0x8')](),controller['create']);router['put'](_0x3695('0xa'),auth['isAuthenticated'](),controller[_0x3695('0xc')]);router[_0x3695('0xd')](_0x3695('0xa'),auth[_0x3695('0x8')](),controller[_0x3695('0xe')]);module[_0x3695('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 bb9208c..2a3054d 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 _0xd771=['DATE','NOW','moment','exports','STRING','ENUM','account','agent','queue'];(function(_0x2c51ae,_0x51a045){var _0x3ca043=function(_0x50920e){while(--_0x50920e){_0x2c51ae['push'](_0x2c51ae['shift']());}};_0x3ca043(++_0x51a045);}(_0xd771,0x134));var _0x1d77=function(_0x2b2254,_0x6c1d5d){_0x2b2254=_0x2b2254-0x0;var _0x17b2a9=_0xd771[_0x2b2254];return _0x17b2a9;};'use strict';var moment=require(_0x1d77('0x0'));var Sequelize=require('sequelize');module[_0x1d77('0x1')]={'uniqueid':{'type':Sequelize[_0x1d77('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1d77('0x3')](_0x1d77('0x4'),_0x1d77('0x5'),_0x1d77('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x1d77('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x1d77('0x8')]}}; \ No newline at end of file +var _0x3aa4=['queue','DATE','NOW','moment','sequelize','exports','account','agent'];(function(_0x3def91,_0x33a11a){var _0x8e55ca=function(_0x3bfd32){while(--_0x3bfd32){_0x3def91['push'](_0x3def91['shift']());}};_0x8e55ca(++_0x33a11a);}(_0x3aa4,0xc3));var _0x43aa=function(_0x39e29c,_0x4bc605){_0x39e29c=_0x39e29c-0x0;var _0xb331fb=_0x3aa4[_0x39e29c];return _0xb331fb;};'use strict';var moment=require(_0x43aa('0x0'));var Sequelize=require(_0x43aa('0x1'));module[_0x43aa('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x43aa('0x3'),_0x43aa('0x4'),_0x43aa('0x5')),'allowNull':![],'defaultValue':_0x43aa('0x5')},'transferredAt':{'type':Sequelize[_0x43aa('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x43aa('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f7106a7..6427c70 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 _0x2329=['querystring','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','name','index','SmsTransferReport','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','dateStart','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x63efd8,_0x610780){var _0x34e635=function(_0x2eb0c1){while(--_0x2eb0c1){_0x63efd8['push'](_0x63efd8['shift']());}};_0x34e635(++_0x610780);}(_0x2329,0x17b));var _0x9232=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2329[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require(_0x9232('0x0'));var rp=require(_0x9232('0x1'));var moment=require('moment');var BPromise=require(_0x9232('0x2'));var Mustache=require('mustache');var util=require(_0x9232('0x3'));var path=require('path');var sox=require(_0x9232('0x4'));var csv=require(_0x9232('0x5'));var ejs=require(_0x9232('0x6'));var fs=require('fs');var _=require(_0x9232('0x7'));var squel=require(_0x9232('0x8'));var crypto=require(_0x9232('0x9'));var jsforce=require(_0x9232('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9232('0xb'));var Papa=require('papaparse');var qs=require(_0x9232('0xc'));var logger=require('../../config/logger')(_0x9232('0xd'));var utils=require(_0x9232('0xe'));var config=require('../../config/environment');var db=require(_0x9232('0xf'))['db'];function respondWithStatusCode(_0x21338a,_0xd66d73){_0xd66d73=_0xd66d73||0xcc;return function(_0xf7fb6a){if(_0xf7fb6a){return _0x21338a[_0x9232('0x10')](_0xd66d73);}return _0x21338a[_0x9232('0x11')](_0xd66d73)[_0x9232('0x12')]();};}function respondWithResult(_0x470da7,_0x454259){_0x454259=_0x454259||0xc8;return function(_0x5aad6d){if(_0x5aad6d){return _0x470da7[_0x9232('0x11')](_0x454259)[_0x9232('0x13')](_0x5aad6d);}};}function respondWithFilteredResult(_0xf259b7,_0xb211bb){return function(_0x5c05c3){if(_0x5c05c3){var _0x28590e=_0x5c05c3[_0x9232('0x14')],_0x304cca=_0xb211bb['offset'],_0x105acb=_0xb211bb[_0x9232('0x15')]+_0xb211bb['limit'],_0x34c9b4;if(_0x105acb>=_0x28590e){_0x105acb=_0x28590e;_0x34c9b4=0xc8;}else{_0x34c9b4=0xce;}_0xf259b7[_0x9232('0x11')](_0x34c9b4);return _0xf259b7[_0x9232('0x16')](_0x9232('0x17'),_0x304cca+'-'+_0x105acb+'/'+_0x28590e)[_0x9232('0x13')](_0x5c05c3);}return null;};}function patchUpdates(_0x432716){return function(_0x41d8b5){try{jsonpatch['apply'](_0x41d8b5,_0x432716,!![]);}catch(_0x307109){return BPromise[_0x9232('0x18')](_0x307109);}return _0x41d8b5[_0x9232('0x19')]();};}function saveUpdates(_0x13ad50,_0x3ebfd4){return function(_0x32ab83){if(_0x32ab83){return _0x32ab83[_0x9232('0x1a')](_0x13ad50)[_0x9232('0x1b')](function(_0x4de52b){return _0x4de52b;});}return null;};}function removeEntity(_0x40ee21,_0x3c5761){return function(_0x4c2ae5){if(_0x4c2ae5){return _0x4c2ae5['destroy']()[_0x9232('0x1b')](function(){_0x40ee21[_0x9232('0x11')](0xcc)[_0x9232('0x12')]();});}};}function handleEntityNotFound(_0xecce8b,_0x1527f6){return function(_0x251c65){if(!_0x251c65){_0xecce8b['sendStatus'](0x194);}return _0x251c65;};}function handleError(_0xf0eaf4,_0x190398){_0x190398=_0x190398||0x1f4;return function(_0xcd572c){logger['error'](_0xcd572c['stack']);if(_0xcd572c[_0x9232('0x1c')]){delete _0xcd572c[_0x9232('0x1c')];}_0xf0eaf4[_0x9232('0x11')](_0x190398)['send'](_0xcd572c);};}exports[_0x9232('0x1d')]=function(_0x220ac6,_0x5b53ba){var _0x2c2f24={},_0x44954c={},_0x1444d8={'count':0x0,'rows':[]};var _0x23ba09=db[_0x9232('0x1e')][_0x9232('0x1f')];_0x44954c[_0x9232('0x20')]=_[_0x9232('0x21')](_0x23ba09);var _0x3654eb={'dateStart':_0x220ac6[_0x9232('0x22')]['dateStart'],'dateEnd':_0x220ac6[_0x9232('0x22')]['dateEnd']};delete _0x220ac6[_0x9232('0x22')]['dateStart'];delete _0x220ac6[_0x9232('0x22')][_0x9232('0x23')];_0x44954c[_0x9232('0x22')]=_[_0x9232('0x21')](_0x220ac6['query']);_0x44954c[_0x9232('0x24')]=_[_0x9232('0x25')](_0x44954c['model'],_0x44954c[_0x9232('0x22')]);_0x2c2f24[_0x9232('0x26')]=_[_0x9232('0x25')](_0x44954c[_0x9232('0x20')],qs[_0x9232('0x27')](_0x220ac6[_0x9232('0x22')][_0x9232('0x27')]));_0x2c2f24['attributes']=_0x2c2f24[_0x9232('0x26')]['length']?_0x2c2f24[_0x9232('0x26')]:_0x44954c['model'];if(!_0x220ac6['query'][_0x9232('0x28')](_0x9232('0x29'))){_0x2c2f24['limit']=qs[_0x9232('0x2a')](_0x220ac6['query']['limit']);_0x2c2f24['offset']=qs[_0x9232('0x15')](_0x220ac6[_0x9232('0x22')][_0x9232('0x15')]);}_0x2c2f24['order']=qs[_0x9232('0x2b')](_0x220ac6['query'][_0x9232('0x2b')]);_0x2c2f24[_0x9232('0x2c')]=qs[_0x9232('0x24')](_[_0x9232('0x2d')](_0x220ac6[_0x9232('0x22')],_0x44954c[_0x9232('0x24')]));if(_0x3654eb[_0x9232('0x2e')]){if(_0x3654eb['dateEnd']){_0x3654eb[_0x9232('0x23')]=moment(_0x3654eb['dateEnd'])[_0x9232('0x2f')](0x1,'day');}else{_0x3654eb[_0x9232('0x23')]=moment(_0x3654eb[_0x9232('0x2e')])[_0x9232('0x2f')](0x1,'day');}_[_0x9232('0x30')](_0x2c2f24[_0x9232('0x2c')],{'createdAt':{'$gte':_0x3654eb['dateStart'],'$lte':_0x3654eb['dateEnd']}});}if(_0x220ac6['query'][_0x9232('0x31')]){_0x2c2f24[_0x9232('0x2c')]=_['merge'](_0x2c2f24[_0x9232('0x2c')],{'$or':_[_0x9232('0x32')](_0x2c2f24[_0x9232('0x26')],function(_0x38feb9){var _0xd73a26={};_0xd73a26[_0x38feb9]={'$like':'%'+_0x220ac6[_0x9232('0x22')][_0x9232('0x31')]+'%'};return _0xd73a26;})});}_0x2c2f24=_[_0x9232('0x30')]({},_0x2c2f24,_0x220ac6[_0x9232('0x33')]);var _0x509d9d={'where':_0x2c2f24[_0x9232('0x2c')]};return db[_0x9232('0x1e')][_0x9232('0x14')](_0x509d9d)[_0x9232('0x1b')](function(_0x43f702){_0x1444d8[_0x9232('0x14')]=_0x43f702;if(_0x220ac6['query'][_0x9232('0x34')]){_0x2c2f24[_0x9232('0x35')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x9232('0x36')](_0x2c2f24);})['then'](function(_0x3d421e){_0x1444d8[_0x9232('0x37')]=_0x3d421e;return _0x1444d8;})['then'](respondWithFilteredResult(_0x5b53ba,_0x2c2f24))[_0x9232('0x38')](handleError(_0x5b53ba,null));};exports[_0x9232('0x39')]=function(_0x17639b,_0x55d4e3){var _0x342003={'raw':!![],'where':{'id':_0x17639b[_0x9232('0x3a')]['id']}},_0x48d8ae={};_0x48d8ae[_0x9232('0x20')]=_[_0x9232('0x21')](db[_0x9232('0x1e')][_0x9232('0x1f')]);_0x48d8ae[_0x9232('0x22')]=_[_0x9232('0x21')](_0x17639b[_0x9232('0x22')]);_0x48d8ae['filters']=_[_0x9232('0x25')](_0x48d8ae[_0x9232('0x20')],_0x48d8ae[_0x9232('0x22')]);_0x342003[_0x9232('0x26')]=_['intersection'](_0x48d8ae[_0x9232('0x20')],qs[_0x9232('0x27')](_0x17639b[_0x9232('0x22')][_0x9232('0x27')]));_0x342003[_0x9232('0x26')]=_0x342003[_0x9232('0x26')][_0x9232('0x3b')]?_0x342003[_0x9232('0x26')]:_0x48d8ae[_0x9232('0x20')];if(_0x17639b[_0x9232('0x22')][_0x9232('0x34')]){_0x342003['include']=[{'all':!![]}];}_0x342003=_['merge']({},_0x342003,_0x17639b[_0x9232('0x33')]);return db[_0x9232('0x1e')][_0x9232('0x3c')](_0x342003)[_0x9232('0x1b')](handleEntityNotFound(_0x55d4e3,null))[_0x9232('0x1b')](respondWithResult(_0x55d4e3,null))[_0x9232('0x38')](handleError(_0x55d4e3,null));};exports[_0x9232('0x3d')]=function(_0x2d8c73,_0x3a050b){return db['SmsTransferReport']['create'](_0x2d8c73[_0x9232('0x3e')],{})[_0x9232('0x1b')](respondWithResult(_0x3a050b,0xc9))['catch'](handleError(_0x3a050b,null));};exports[_0x9232('0x1a')]=function(_0x326f64,_0x9e518a){if(_0x326f64[_0x9232('0x3e')]['id']){delete _0x326f64['body']['id'];}return db['SmsTransferReport'][_0x9232('0x3c')]({'where':{'id':_0x326f64[_0x9232('0x3a')]['id']}})[_0x9232('0x1b')](handleEntityNotFound(_0x9e518a,null))[_0x9232('0x1b')](saveUpdates(_0x326f64[_0x9232('0x3e')],null))[_0x9232('0x1b')](respondWithResult(_0x9e518a,null))[_0x9232('0x38')](handleError(_0x9e518a,null));};exports[_0x9232('0x3f')]=function(_0x3a5761,_0x168d01){return db[_0x9232('0x1e')][_0x9232('0x3c')]({'where':{'id':_0x3a5761[_0x9232('0x3a')]['id']}})[_0x9232('0x1b')](handleEntityNotFound(_0x168d01,null))[_0x9232('0x1b')](removeEntity(_0x168d01,null))[_0x9232('0x38')](handleError(_0x168d01,null));};exports[_0x9232('0x40')]=function(_0x39f2ec,_0x77738b){return db[_0x9232('0x1e')]['describe']()[_0x9232('0x1b')](respondWithResult(_0x77738b,null))['catch'](handleError(_0x77738b,null));}; \ No newline at end of file +var _0x9fc0=['util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../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','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','options','SmsTransferReport','includeAll','findAll','rows','catch','params','include','find','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5f1c73,_0x4f9432){var _0x3c1fa4=function(_0x334bd2){while(--_0x334bd2){_0x5f1c73['push'](_0x5f1c73['shift']());}};_0x3c1fa4(++_0x4f9432);}(_0x9fc0,0x10f));var _0x09fc=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x9fc0[_0x30abff];return _0x4c571e;};'use strict';var jsonpatch=require(_0x09fc('0x0'));var rp=require(_0x09fc('0x1'));var moment=require(_0x09fc('0x2'));var BPromise=require(_0x09fc('0x3'));var Mustache=require(_0x09fc('0x4'));var util=require(_0x09fc('0x5'));var path=require(_0x09fc('0x6'));var sox=require(_0x09fc('0x7'));var csv=require(_0x09fc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x09fc('0x9'));var squel=require('squel');var crypto=require(_0x09fc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x09fc('0xb'));var toCsv=require(_0x09fc('0x8'));var querystring=require(_0x09fc('0xc'));var Papa=require(_0x09fc('0xd'));var qs=require(_0x09fc('0xe'));var logger=require(_0x09fc('0xf'))(_0x09fc('0x10'));var utils=require(_0x09fc('0x11'));var config=require(_0x09fc('0x12'));var db=require(_0x09fc('0x13'))['db'];function respondWithStatusCode(_0x5bd885,_0x2205da){_0x2205da=_0x2205da||0xcc;return function(_0x37317b){if(_0x37317b){return _0x5bd885[_0x09fc('0x14')](_0x2205da);}return _0x5bd885[_0x09fc('0x15')](_0x2205da)[_0x09fc('0x16')]();};}function respondWithResult(_0x180a23,_0x1849d7){_0x1849d7=_0x1849d7||0xc8;return function(_0x3311d3){if(_0x3311d3){return _0x180a23[_0x09fc('0x15')](_0x1849d7)[_0x09fc('0x17')](_0x3311d3);}};}function respondWithFilteredResult(_0x1c883b,_0x19672a){return function(_0x3e9ed1){if(_0x3e9ed1){var _0x52d714=_0x3e9ed1[_0x09fc('0x18')],_0x37ee78=_0x19672a[_0x09fc('0x19')],_0x17c246=_0x19672a['offset']+_0x19672a[_0x09fc('0x1a')],_0x5af03a;if(_0x17c246>=_0x52d714){_0x17c246=_0x52d714;_0x5af03a=0xc8;}else{_0x5af03a=0xce;}_0x1c883b[_0x09fc('0x15')](_0x5af03a);return _0x1c883b['set'](_0x09fc('0x1b'),_0x37ee78+'-'+_0x17c246+'/'+_0x52d714)[_0x09fc('0x17')](_0x3e9ed1);}return null;};}function patchUpdates(_0x80ebd3){return function(_0x3ee280){try{jsonpatch[_0x09fc('0x1c')](_0x3ee280,_0x80ebd3,!![]);}catch(_0x16b553){return BPromise[_0x09fc('0x1d')](_0x16b553);}return _0x3ee280[_0x09fc('0x1e')]();};}function saveUpdates(_0x5356d3,_0x48a373){return function(_0x39e8dc){if(_0x39e8dc){return _0x39e8dc[_0x09fc('0x1f')](_0x5356d3)[_0x09fc('0x20')](function(_0x57acb0){return _0x57acb0;});}return null;};}function removeEntity(_0x207b1b,_0x40e7f5){return function(_0x3e5436){if(_0x3e5436){return _0x3e5436[_0x09fc('0x21')]()[_0x09fc('0x20')](function(){_0x207b1b[_0x09fc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f3eed,_0x366cfb){return function(_0xdc1801){if(!_0xdc1801){_0x4f3eed['sendStatus'](0x194);}return _0xdc1801;};}function handleError(_0x11eec2,_0x40785e){_0x40785e=_0x40785e||0x1f4;return function(_0x399aa6){logger['error'](_0x399aa6[_0x09fc('0x22')]);if(_0x399aa6[_0x09fc('0x23')]){delete _0x399aa6[_0x09fc('0x23')];}_0x11eec2['status'](_0x40785e)[_0x09fc('0x24')](_0x399aa6);};}exports[_0x09fc('0x25')]=function(_0x28798b,_0x3d57ab){var _0x442acc={},_0x2aaa26={},_0x26f3e0={'count':0x0,'rows':[]};var _0x393722=db['SmsTransferReport'][_0x09fc('0x26')];_0x2aaa26[_0x09fc('0x27')]=_[_0x09fc('0x28')](_0x393722);var _0x31a2ce={'dateStart':_0x28798b[_0x09fc('0x29')]['dateStart'],'dateEnd':_0x28798b['query']['dateEnd']};delete _0x28798b[_0x09fc('0x29')][_0x09fc('0x2a')];delete _0x28798b['query'][_0x09fc('0x2b')];_0x2aaa26[_0x09fc('0x29')]=_[_0x09fc('0x28')](_0x28798b['query']);_0x2aaa26[_0x09fc('0x2c')]=_[_0x09fc('0x2d')](_0x2aaa26[_0x09fc('0x27')],_0x2aaa26[_0x09fc('0x29')]);_0x442acc['attributes']=_[_0x09fc('0x2d')](_0x2aaa26['model'],qs[_0x09fc('0x2e')](_0x28798b[_0x09fc('0x29')][_0x09fc('0x2e')]));_0x442acc['attributes']=_0x442acc[_0x09fc('0x2f')][_0x09fc('0x30')]?_0x442acc[_0x09fc('0x2f')]:_0x2aaa26['model'];if(!_0x28798b[_0x09fc('0x29')][_0x09fc('0x31')]('nolimit')){_0x442acc[_0x09fc('0x1a')]=qs['limit'](_0x28798b[_0x09fc('0x29')][_0x09fc('0x1a')]);_0x442acc[_0x09fc('0x19')]=qs[_0x09fc('0x19')](_0x28798b['query']['offset']);}_0x442acc[_0x09fc('0x32')]=qs[_0x09fc('0x33')](_0x28798b[_0x09fc('0x29')][_0x09fc('0x33')]);_0x442acc[_0x09fc('0x34')]=qs[_0x09fc('0x2c')](_[_0x09fc('0x35')](_0x28798b['query'],_0x2aaa26[_0x09fc('0x2c')]));if(_0x31a2ce[_0x09fc('0x2a')]){if(_0x31a2ce[_0x09fc('0x2b')]){_0x31a2ce['dateEnd']=moment(_0x31a2ce[_0x09fc('0x2b')])[_0x09fc('0x36')](0x1,_0x09fc('0x37'));}else{_0x31a2ce[_0x09fc('0x2b')]=moment(_0x31a2ce[_0x09fc('0x2a')])[_0x09fc('0x36')](0x1,'day');}_[_0x09fc('0x38')](_0x442acc['where'],{'createdAt':{'$gte':_0x31a2ce[_0x09fc('0x2a')],'$lte':_0x31a2ce['dateEnd']}});}if(_0x28798b[_0x09fc('0x29')][_0x09fc('0x39')]){_0x442acc[_0x09fc('0x34')]=_[_0x09fc('0x38')](_0x442acc[_0x09fc('0x34')],{'$or':_['map'](_0x442acc[_0x09fc('0x2f')],function(_0x2036b2){var _0x41fa53={};_0x41fa53[_0x2036b2]={'$like':'%'+_0x28798b[_0x09fc('0x29')][_0x09fc('0x39')]+'%'};return _0x41fa53;})});}_0x442acc=_[_0x09fc('0x38')]({},_0x442acc,_0x28798b[_0x09fc('0x3a')]);var _0x51b7cf={'where':_0x442acc[_0x09fc('0x34')]};return db[_0x09fc('0x3b')][_0x09fc('0x18')](_0x51b7cf)[_0x09fc('0x20')](function(_0x318e77){_0x26f3e0['count']=_0x318e77;if(_0x28798b[_0x09fc('0x29')][_0x09fc('0x3c')]){_0x442acc['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x09fc('0x3d')](_0x442acc);})[_0x09fc('0x20')](function(_0x56a936){_0x26f3e0[_0x09fc('0x3e')]=_0x56a936;return _0x26f3e0;})[_0x09fc('0x20')](respondWithFilteredResult(_0x3d57ab,_0x442acc))[_0x09fc('0x3f')](handleError(_0x3d57ab,null));};exports['show']=function(_0x22f409,_0x380a85){var _0x86eded={'raw':!![],'where':{'id':_0x22f409[_0x09fc('0x40')]['id']}},_0x4aeccb={};_0x4aeccb[_0x09fc('0x27')]=_[_0x09fc('0x28')](db[_0x09fc('0x3b')][_0x09fc('0x26')]);_0x4aeccb['query']=_['keys'](_0x22f409[_0x09fc('0x29')]);_0x4aeccb[_0x09fc('0x2c')]=_[_0x09fc('0x2d')](_0x4aeccb[_0x09fc('0x27')],_0x4aeccb['query']);_0x86eded[_0x09fc('0x2f')]=_[_0x09fc('0x2d')](_0x4aeccb[_0x09fc('0x27')],qs[_0x09fc('0x2e')](_0x22f409['query'][_0x09fc('0x2e')]));_0x86eded['attributes']=_0x86eded['attributes']['length']?_0x86eded[_0x09fc('0x2f')]:_0x4aeccb['model'];if(_0x22f409[_0x09fc('0x29')][_0x09fc('0x3c')]){_0x86eded[_0x09fc('0x41')]=[{'all':!![]}];}_0x86eded=_['merge']({},_0x86eded,_0x22f409[_0x09fc('0x3a')]);return db[_0x09fc('0x3b')][_0x09fc('0x42')](_0x86eded)['then'](handleEntityNotFound(_0x380a85,null))[_0x09fc('0x20')](respondWithResult(_0x380a85,null))[_0x09fc('0x3f')](handleError(_0x380a85,null));};exports['create']=function(_0x1da413,_0x481131){return db[_0x09fc('0x3b')]['create'](_0x1da413[_0x09fc('0x43')],{})['then'](respondWithResult(_0x481131,0xc9))[_0x09fc('0x3f')](handleError(_0x481131,null));};exports['update']=function(_0x27cc67,_0x22d2f6){if(_0x27cc67['body']['id']){delete _0x27cc67[_0x09fc('0x43')]['id'];}return db[_0x09fc('0x3b')]['find']({'where':{'id':_0x27cc67[_0x09fc('0x40')]['id']}})[_0x09fc('0x20')](handleEntityNotFound(_0x22d2f6,null))['then'](saveUpdates(_0x27cc67[_0x09fc('0x43')],null))[_0x09fc('0x20')](respondWithResult(_0x22d2f6,null))[_0x09fc('0x3f')](handleError(_0x22d2f6,null));};exports[_0x09fc('0x21')]=function(_0xcdf275,_0x58c08b){return db[_0x09fc('0x3b')][_0x09fc('0x42')]({'where':{'id':_0xcdf275[_0x09fc('0x40')]['id']}})['then'](handleEntityNotFound(_0x58c08b,null))[_0x09fc('0x20')](removeEntity(_0x58c08b,null))[_0x09fc('0x3f')](handleError(_0x58c08b,null));};exports[_0x09fc('0x44')]=function(_0xddf139,_0x2f8493){return db['SmsTransferReport']['describe']()[_0x09fc('0x20')](respondWithResult(_0x2f8493,null))[_0x09fc('0x3f')](handleError(_0x2f8493,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 92eab8d..84e4996 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 _0x54ef=['./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5e442c,_0x5798ca){var _0x59f2ff=function(_0x30fc63){while(--_0x30fc63){_0x5e442c['push'](_0x5e442c['shift']());}};_0x59f2ff(++_0x5798ca);}(_0x54ef,0x112));var _0xf54e=function(_0x2cdbe0,_0xe21f2d){_0x2cdbe0=_0x2cdbe0-0x0;var _0x538395=_0x54ef[_0x2cdbe0];return _0x538395;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var attributes=require(_0xf54e('0x6'));module[_0xf54e('0x7')]=function(_0x431e36,_0x12d43f){return _0x431e36['define']('SmsTransferReport',attributes,{'tableName':_0xf54e('0x8'),'paranoid':![],'indexes':[{'name':_0xf54e('0x9'),'fields':[_0xf54e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['api','moment','request-promise','./smsTransferReport.attributes','define','uniqueid','lodash','util','../../config/logger'];(function(_0x3740e3,_0x3e0e4a){var _0x45c1df=function(_0x1183de){while(--_0x1183de){_0x3740e3['push'](_0x3740e3['shift']());}};_0x45c1df(++_0x3e0e4a);}(_0x84ab,0x12f));var _0xb84a=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0x84ab[_0x4b2251];return _0x5d22fb;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var attributes=require(_0xb84a('0x6'));module['exports']=function(_0x9d3a00,_0xe72ccd){return _0x9d3a00[_0xb84a('0x7')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb84a('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 84cba33..c1deef9 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 _0x4ee7=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info'];(function(_0x3071ab,_0x574a59){var _0x2f458c=function(_0x1eb9c7){while(--_0x1eb9c7){_0x3071ab['push'](_0x3071ab['shift']());}};_0x2f458c(++_0x574a59);}(_0x4ee7,0x14a));var _0x74ee=function(_0x410ef1,_0x16a949){_0x410ef1=_0x410ef1-0x0;var _0x583d73=_0x4ee7[_0x410ef1];return _0x583d73;};'use strict';var _=require('lodash');var util=require(_0x74ee('0x0'));var moment=require(_0x74ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x74ee('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x74ee('0x3'));var logger=require(_0x74ee('0x4'))('rpc');var config=require(_0x74ee('0x5'));var jayson=require(_0x74ee('0x6'));var client=jayson['client'][_0x74ee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dfdb3,_0xff0f7,_0x4b31f5){return new BPromise(function(_0x30de27,_0x36b2a2){return client[_0x74ee('0x8')](_0x5dfdb3,_0x4b31f5)['then'](function(_0x2acf42){logger[_0x74ee('0x9')](_0x74ee('0xa'),_0xff0f7,_0x74ee('0xb'));logger[_0x74ee('0xc')](_0x74ee('0xd'),_0xff0f7,'request\x20sent',JSON['stringify'](_0x2acf42));if(_0x2acf42[_0x74ee('0xe')]){if(_0x2acf42[_0x74ee('0xe')][_0x74ee('0xf')]===0x1f4){logger[_0x74ee('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0xff0f7,_0x2acf42[_0x74ee('0xe')]['message']);return _0x36b2a2(_0x2acf42[_0x74ee('0xe')][_0x74ee('0x10')]);}logger[_0x74ee('0xe')](_0x74ee('0xa'),_0xff0f7,_0x2acf42[_0x74ee('0xe')][_0x74ee('0x10')]);return _0x30de27(_0x2acf42[_0x74ee('0xe')][_0x74ee('0x10')]);}else{logger['info'](_0x74ee('0xa'),_0xff0f7,_0x74ee('0xb'));_0x30de27(_0x2acf42['result'][_0x74ee('0x10')]);}})['catch'](function(_0x315c24){logger[_0x74ee('0xe')](_0x74ee('0xa'),_0xff0f7,_0x315c24);_0x36b2a2(_0x315c24);});});} \ No newline at end of file +var _0x6161=['randomstring','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x540463,_0x207b72){var _0x50e631=function(_0x1a993f){while(--_0x1a993f){_0x540463['push'](_0x540463['shift']());}};_0x50e631(++_0x207b72);}(_0x6161,0x122));var _0x1616=function(_0x4c80a3,_0x6d3c4f){_0x4c80a3=_0x4c80a3-0x0;var _0x589f25=_0x6161[_0x4c80a3];return _0x589f25;};'use strict';var _=require(_0x1616('0x0'));var util=require(_0x1616('0x1'));var moment=require(_0x1616('0x2'));var BPromise=require(_0x1616('0x3'));var rs=require(_0x1616('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1616('0x5'));var jayson=require(_0x1616('0x6'));var client=jayson[_0x1616('0x7')][_0x1616('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3f57,_0xa1dafe,_0x5d2e53){return new BPromise(function(_0x386df8,_0x3d09f9){return client[_0x1616('0x9')](_0x2f3f57,_0x5d2e53)['then'](function(_0x50969f){logger[_0x1616('0xa')](_0x1616('0xb'),_0xa1dafe,_0x1616('0xc'));logger[_0x1616('0xd')](_0x1616('0xe'),_0xa1dafe,_0x1616('0xc'),JSON[_0x1616('0xf')](_0x50969f));if(_0x50969f[_0x1616('0x10')]){if(_0x50969f['error'][_0x1616('0x11')]===0x1f4){logger['error'](_0x1616('0xb'),_0xa1dafe,_0x50969f['error'][_0x1616('0x12')]);return _0x3d09f9(_0x50969f[_0x1616('0x10')]['message']);}logger[_0x1616('0x10')](_0x1616('0xb'),_0xa1dafe,_0x50969f[_0x1616('0x10')][_0x1616('0x12')]);return _0x386df8(_0x50969f[_0x1616('0x10')][_0x1616('0x12')]);}else{logger[_0x1616('0xa')](_0x1616('0xb'),_0xa1dafe,_0x1616('0xc'));_0x386df8(_0x50969f[_0x1616('0x13')][_0x1616('0x12')]);}})[_0x1616('0x14')](function(_0x275825){logger[_0x1616('0x10')](_0x1616('0xb'),_0xa1dafe,_0x275825);_0x3d09f9(_0x275825);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 4bed60e..0dcea31 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 _0xa6b9=['replace','format','%s-%s%s','basename','extname','post','file','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname'];(function(_0x4edd97,_0x339cc6){var _0x19559e=function(_0x38b503){while(--_0x38b503){_0x4edd97['push'](_0x4edd97['shift']());}};_0x19559e(++_0x339cc6);}(_0xa6b9,0x84));var _0x9a6b=function(_0x15d0e5,_0x3d2dca){_0x15d0e5=_0x15d0e5-0x0;var _0x1a4865=_0xa6b9[_0x15d0e5];return _0x1a4865;};'use strict';var multer=require(_0x9a6b('0x0'));var util=require(_0x9a6b('0x1'));var path=require(_0x9a6b('0x2'));var express=require(_0x9a6b('0x3'));var router=express[_0x9a6b('0x4')]();var auth=require(_0x9a6b('0x5'));var interaction=require(_0x9a6b('0x6'));var config=require(_0x9a6b('0x7'));var controller=require('./sound.controller');router[_0x9a6b('0x8')]('/',auth['isAuthenticated'](),controller[_0x9a6b('0x9')]);router[_0x9a6b('0x8')](_0x9a6b('0xa'),auth[_0x9a6b('0xb')](),controller['show']);router[_0x9a6b('0x8')](_0x9a6b('0xc'),auth['isAuthenticated'](),controller[_0x9a6b('0xd')]);var upload=multer({'storage':multer[_0x9a6b('0xe')]({'destination':function(_0x42479a,_0x43a276,_0x8a2c67){_0x8a2c67(null,path[_0x9a6b('0xf')](config['root'],_0x9a6b('0x10')));},'filename':function(_0xf2f7f2,_0x286ae9,_0x1afc1f){_0x286ae9[_0x9a6b('0x11')]=_0x286ae9[_0x9a6b('0x11')][_0x9a6b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1afc1f(null,util[_0x9a6b('0x13')](_0x9a6b('0x14'),path[_0x9a6b('0x15')](_0x286ae9[_0x9a6b('0x11')],path[_0x9a6b('0x16')](_0x286ae9[_0x9a6b('0x11')])),Date['now'](),path[_0x9a6b('0x16')](_0x286ae9[_0x9a6b('0x11')])));}})});router[_0x9a6b('0x17')]('/',upload['single'](_0x9a6b('0x18')),controller[_0x9a6b('0x19')]);router[_0x9a6b('0x1a')](_0x9a6b('0xa'),auth[_0x9a6b('0xb')](),controller[_0x9a6b('0x1b')]);router[_0x9a6b('0x1c')](_0x9a6b('0xa'),auth[_0x9a6b('0xb')](),controller['delete']);module[_0x9a6b('0x1d')]=router; \ No newline at end of file +var _0x55bc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','isAuthenticated','show','join','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','post','single','file','put','update','delete','/:id','exports','util','path','express','Router'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x55bc,0x10a));var _0xc55b=function(_0xfe2ed2,_0x1f2991){_0xfe2ed2=_0xfe2ed2-0x0;var _0x20942c=_0x55bc[_0xfe2ed2];return _0x20942c;};'use strict';var multer=require('multer');var util=require(_0xc55b('0x0'));var path=require(_0xc55b('0x1'));var express=require(_0xc55b('0x2'));var router=express[_0xc55b('0x3')]();var auth=require(_0xc55b('0x4'));var interaction=require(_0xc55b('0x5'));var config=require(_0xc55b('0x6'));var controller=require(_0xc55b('0x7'));router[_0xc55b('0x8')]('/',auth['isAuthenticated'](),controller[_0xc55b('0x9')]);router[_0xc55b('0x8')]('/:id',auth[_0xc55b('0xa')](),controller[_0xc55b('0xb')]);router[_0xc55b('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4bea9a,_0x4421ba,_0x3d1cc9){_0x3d1cc9(null,path[_0xc55b('0xc')](config['root'],_0xc55b('0xd')));},'filename':function(_0x236466,_0x3ec28a,_0x45115f){_0x3ec28a[_0xc55b('0xe')]=_0x3ec28a[_0xc55b('0xe')][_0xc55b('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45115f(null,util['format'](_0xc55b('0x10'),path[_0xc55b('0x11')](_0x3ec28a[_0xc55b('0xe')],path[_0xc55b('0x12')](_0x3ec28a['originalname'])),Date['now'](),path[_0xc55b('0x12')](_0x3ec28a[_0xc55b('0xe')])));}})});router[_0xc55b('0x13')]('/',upload[_0xc55b('0x14')](_0xc55b('0x15')),controller['create']);router[_0xc55b('0x16')]('/:id',auth[_0xc55b('0xa')](),controller[_0xc55b('0x17')]);router[_0xc55b('0x18')](_0xc55b('0x19'),auth[_0xc55b('0xa')](),controller['delete']);module[_0xc55b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b9e6d3d..a131c86 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 _0xec37=['BIGINT','INTEGER','sequelize','exports','name','STRING','FLOAT'];(function(_0xa21a6c,_0x58fdce){var _0x1893bd=function(_0x2420fa){while(--_0x2420fa){_0xa21a6c['push'](_0xa21a6c['shift']());}};_0x1893bd(++_0x58fdce);}(_0xec37,0x1b4));var _0x7ec3=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xec37[_0x5b27da];return _0x3254f4;};'use strict';var Sequelize=require(_0x7ec3('0x0'));module[_0x7ec3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7ec3('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x7ec3('0x3')]},'original_format':{'type':Sequelize[_0x7ec3('0x3')]},'original_duration':{'type':Sequelize[_0x7ec3('0x4')]},'original_sampleCount':{'type':Sequelize[_0x7ec3('0x5')]},'original_channelCount':{'type':Sequelize[_0x7ec3('0x6')]},'original_bitRate':{'type':Sequelize[_0x7ec3('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x7ec3('0x3')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x7ec3('0x5')]},'converted_channelCount':{'type':Sequelize[_0x7ec3('0x6')]},'converted_bitRate':{'type':Sequelize[_0x7ec3('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe013=['INTEGER','sequelize','exports','STRING','name','BIGINT'];(function(_0x3f9bbf,_0x197a82){var _0x555b03=function(_0x1ed120){while(--_0x1ed120){_0x3f9bbf['push'](_0x3f9bbf['shift']());}};_0x555b03(++_0x197a82);}(_0xe013,0x169));var _0x3e01=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xe013[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x3e01('0x0'));module[_0x3e01('0x1')]={'name':{'type':Sequelize[_0x3e01('0x2')],'unique':_0x3e01('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3e01('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x3e01('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x3e01('0x4')]},'original_channelCount':{'type':Sequelize[_0x3e01('0x5')]},'original_bitRate':{'type':Sequelize[_0x3e01('0x4')]},'original_sampleRate':{'type':Sequelize[_0x3e01('0x5')]},'converted_format':{'type':Sequelize[_0x3e01('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x3e01('0x4')]},'converted_channelCount':{'type':Sequelize[_0x3e01('0x5')]},'converted_bitRate':{'type':Sequelize[_0x3e01('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x3e01('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index fea2d00..84f230e 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 _0x158a=['delete','original_format','unlinkSync','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','Sound','keys','query','dateEnd','dateStart','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','add','day','merge','map','filter','options','count','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','chmodSync','transcode','send','src','duration','original_sampleCount','bitRate','sampleRate','dest','sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','start','body'];(function(_0x74c0f3,_0x3ad21e){var _0x442ab7=function(_0x4e121e){while(--_0x4e121e){_0x74c0f3['push'](_0x74c0f3['shift']());}};_0x442ab7(++_0x3ad21e);}(_0x158a,0x19f));var _0xa158=function(_0x554732,_0xdb5283){_0x554732=_0x554732-0x0;var _0x4c0300=_0x158a[_0x554732];return _0x4c0300;};'use strict';var jsonpatch=require(_0xa158('0x0'));var rp=require('request-promise');var moment=require(_0xa158('0x1'));var BPromise=require(_0xa158('0x2'));var Mustache=require('mustache');var util=require(_0xa158('0x3'));var path=require(_0xa158('0x4'));var sox=require(_0xa158('0x5'));var csv=require(_0xa158('0x6'));var ejs=require(_0xa158('0x7'));var fs=require('fs');var _=require(_0xa158('0x8'));var squel=require(_0xa158('0x9'));var crypto=require(_0xa158('0xa'));var jsforce=require(_0xa158('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa158('0x6'));var querystring=require(_0xa158('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xa158('0xd'))(_0xa158('0xe'));var utils=require(_0xa158('0xf'));var config=require('../../config/environment');var db=require(_0xa158('0x10'))['db'];function respondWithStatusCode(_0x5efdcf,_0x2bd165){_0x2bd165=_0x2bd165||0xcc;return function(_0x4e5927){if(_0x4e5927){return _0x5efdcf['sendStatus'](_0x2bd165);}return _0x5efdcf[_0xa158('0x11')](_0x2bd165)['end']();};}function respondWithResult(_0x4c5336,_0x5469b9){_0x5469b9=_0x5469b9||0xc8;return function(_0x5360f5){if(_0x5360f5){return _0x4c5336[_0xa158('0x11')](_0x5469b9)[_0xa158('0x12')](_0x5360f5);}};}function respondWithFilteredResult(_0x34898c,_0x15ebba){return function(_0x421c60){if(_0x421c60){var _0x1628c8=_0x421c60['count'],_0xf6f1e1=_0x15ebba['offset'],_0x4eef27=_0x15ebba[_0xa158('0x13')]+_0x15ebba[_0xa158('0x14')],_0x1c4037;if(_0x4eef27>=_0x1628c8){_0x4eef27=_0x1628c8;_0x1c4037=0xc8;}else{_0x1c4037=0xce;}_0x34898c[_0xa158('0x11')](_0x1c4037);return _0x34898c[_0xa158('0x15')](_0xa158('0x16'),_0xf6f1e1+'-'+_0x4eef27+'/'+_0x1628c8)[_0xa158('0x12')](_0x421c60);}return null;};}function patchUpdates(_0x4be90c){return function(_0x43d838){try{jsonpatch['apply'](_0x43d838,_0x4be90c,!![]);}catch(_0x7cf26){return BPromise['reject'](_0x7cf26);}return _0x43d838[_0xa158('0x17')]();};}function saveUpdates(_0x1596e8,_0x3874d0){return function(_0x154e0a){if(_0x154e0a){return _0x154e0a[_0xa158('0x18')](_0x1596e8)[_0xa158('0x19')](function(_0xe5434a){return _0xe5434a;});}return null;};}function removeEntity(_0x1be1e9,_0x3d5312){return function(_0x4fa11b){if(_0x4fa11b){return _0x4fa11b[_0xa158('0x1a')]()[_0xa158('0x19')](function(){_0x1be1e9[_0xa158('0x11')](0xcc)[_0xa158('0x1b')]();});}};}function handleEntityNotFound(_0xb36b81,_0x1ca767){return function(_0x472072){if(!_0x472072){_0xb36b81['sendStatus'](0x194);}return _0x472072;};}function handleError(_0x3351fd,_0x2e3d7f){_0x2e3d7f=_0x2e3d7f||0x1f4;return function(_0x2960b9){logger[_0xa158('0x1c')](_0x2960b9[_0xa158('0x1d')]);if(_0x2960b9[_0xa158('0x1e')]){delete _0x2960b9[_0xa158('0x1e')];}_0x3351fd[_0xa158('0x11')](_0x2e3d7f)['send'](_0x2960b9);};}exports[_0xa158('0x1f')]=function(_0xf7eeef,_0xf95795){var _0x4d89c3={},_0x1dbd1e={},_0x1fa6c5={'count':0x0,'rows':[]};var _0x2c1d4a=db[_0xa158('0x20')]['rawAttributes'];_0x1dbd1e['model']=_[_0xa158('0x21')](_0x2c1d4a);var _0x3b9e3c={'dateStart':_0xf7eeef[_0xa158('0x22')]['dateStart'],'dateEnd':_0xf7eeef[_0xa158('0x22')][_0xa158('0x23')]};delete _0xf7eeef[_0xa158('0x22')][_0xa158('0x24')];delete _0xf7eeef[_0xa158('0x22')][_0xa158('0x23')];_0x1dbd1e[_0xa158('0x22')]=_[_0xa158('0x21')](_0xf7eeef[_0xa158('0x22')]);_0x1dbd1e[_0xa158('0x25')]=_['intersection'](_0x1dbd1e[_0xa158('0x26')],_0x1dbd1e[_0xa158('0x22')]);_0x4d89c3[_0xa158('0x27')]=_['intersection'](_0x1dbd1e[_0xa158('0x26')],qs[_0xa158('0x28')](_0xf7eeef[_0xa158('0x22')][_0xa158('0x28')]));_0x4d89c3[_0xa158('0x27')]=_0x4d89c3['attributes'][_0xa158('0x29')]?_0x4d89c3[_0xa158('0x27')]:_0x1dbd1e[_0xa158('0x26')];if(!_0xf7eeef[_0xa158('0x22')][_0xa158('0x2a')](_0xa158('0x2b'))){_0x4d89c3['limit']=qs[_0xa158('0x14')](_0xf7eeef[_0xa158('0x22')][_0xa158('0x14')]);_0x4d89c3[_0xa158('0x13')]=qs[_0xa158('0x13')](_0xf7eeef[_0xa158('0x22')][_0xa158('0x13')]);}_0x4d89c3['order']=qs[_0xa158('0x2c')](_0xf7eeef[_0xa158('0x22')][_0xa158('0x2c')]);_0x4d89c3[_0xa158('0x2d')]=qs[_0xa158('0x25')](_['pick'](_0xf7eeef[_0xa158('0x22')],_0x1dbd1e[_0xa158('0x25')]));if(_0x3b9e3c[_0xa158('0x24')]){if(_0x3b9e3c[_0xa158('0x23')]){_0x3b9e3c['dateEnd']=moment(_0x3b9e3c['dateEnd'])[_0xa158('0x2e')](0x1,_0xa158('0x2f'));}else{_0x3b9e3c[_0xa158('0x23')]=moment(_0x3b9e3c[_0xa158('0x24')])['add'](0x1,_0xa158('0x2f'));}_[_0xa158('0x30')](_0x4d89c3[_0xa158('0x2d')],{'createdAt':{'$gte':_0x3b9e3c[_0xa158('0x24')],'$lte':_0x3b9e3c[_0xa158('0x23')]}});}if(_0xf7eeef[_0xa158('0x22')]['filter']){_0x4d89c3['where']=_['merge'](_0x4d89c3[_0xa158('0x2d')],{'$or':_[_0xa158('0x31')](_0x4d89c3[_0xa158('0x27')],function(_0x3fad0b){var _0x2b7f1d={};_0x2b7f1d[_0x3fad0b]={'$like':'%'+_0xf7eeef['query'][_0xa158('0x32')]+'%'};return _0x2b7f1d;})});}_0x4d89c3=_[_0xa158('0x30')]({},_0x4d89c3,_0xf7eeef[_0xa158('0x33')]);var _0x2f4db5={'where':_0x4d89c3['where']};return db[_0xa158('0x20')]['count'](_0x2f4db5)[_0xa158('0x19')](function(_0x590493){_0x1fa6c5[_0xa158('0x34')]=_0x590493;if(_0xf7eeef[_0xa158('0x22')][_0xa158('0x35')]){_0x4d89c3[_0xa158('0x36')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x4d89c3);})[_0xa158('0x19')](function(_0x1b3fc5){_0x1fa6c5[_0xa158('0x37')]=_0x1b3fc5;return _0x1fa6c5;})[_0xa158('0x19')](respondWithFilteredResult(_0xf95795,_0x4d89c3))[_0xa158('0x38')](handleError(_0xf95795,null));};exports[_0xa158('0x39')]=function(_0x770084,_0x322a76){var _0x5a085b={'raw':!![],'where':{'id':_0x770084[_0xa158('0x3a')]['id']}},_0x49958f={};_0x49958f[_0xa158('0x26')]=_[_0xa158('0x21')](db['Sound'][_0xa158('0x3b')]);_0x49958f['query']=_[_0xa158('0x21')](_0x770084[_0xa158('0x22')]);_0x49958f['filters']=_[_0xa158('0x3c')](_0x49958f[_0xa158('0x26')],_0x49958f[_0xa158('0x22')]);_0x5a085b[_0xa158('0x27')]=_[_0xa158('0x3c')](_0x49958f['model'],qs[_0xa158('0x28')](_0x770084['query']['fields']));_0x5a085b[_0xa158('0x27')]=_0x5a085b[_0xa158('0x27')]['length']?_0x5a085b[_0xa158('0x27')]:_0x49958f[_0xa158('0x26')];if(_0x770084['query']['includeAll']){_0x5a085b[_0xa158('0x36')]=[{'all':!![]}];}_0x5a085b=_['merge']({},_0x5a085b,_0x770084['options']);return db['Sound']['find'](_0x5a085b)[_0xa158('0x19')](handleEntityNotFound(_0x322a76,null))[_0xa158('0x19')](respondWithResult(_0x322a76,null))[_0xa158('0x38')](handleError(_0x322a76,null));};exports['download']=function(_0x389416,_0x53004f,_0x567043){return db[_0xa158('0x20')][_0xa158('0x3d')]({'where':{'id':_0x389416[_0xa158('0x3a')]['id']},'attributes':[_0xa158('0x1e'),_0xa158('0x3e'),_0xa158('0x3f')],'raw':!![]})['then'](handleEntityNotFound(_0x53004f,null))[_0xa158('0x19')](function(_0x40690b){if(_0x40690b){if(!fs[_0xa158('0x40')](path[_0xa158('0x41')](config[_0xa158('0x42')],_0xa158('0x43'),_0x40690b['save_name']+'.'+_0x40690b[_0xa158('0x3f')]))){throw new db[(_0xa158('0x44'))][(_0xa158('0x45'))](_0xa158('0x46'));}return _0x53004f[_0xa158('0x47')](path[_0xa158('0x41')](config[_0xa158('0x42')],_0xa158('0x43'),util[_0xa158('0x48')]('%s.%s',_0x40690b[_0xa158('0x3e')],_0x40690b[_0xa158('0x3f')])),util[_0xa158('0x48')](_0xa158('0x49'),_0x40690b[_0xa158('0x1e')],_0x40690b[_0xa158('0x3f')]));}return null;})[_0xa158('0x38')](handleError(_0x53004f,null));};exports[_0xa158('0x4a')]=function(_0x36239a,_0x66149c,_0x117e3e){var _0x539c0b={'name':path[_0xa158('0x4b')](_0x36239a[_0xa158('0x4c')][_0xa158('0x4d')],path['extname'](_0x36239a['file'][_0xa158('0x4d')])),'save_name':path[_0xa158('0x4b')](_0x36239a[_0xa158('0x4c')][_0xa158('0x4e')],path[_0xa158('0x4f')](_0x36239a[_0xa158('0x4c')][_0xa158('0x4e')])),'original_format':path[_0xa158('0x4f')](_0x36239a[_0xa158('0x4c')]['originalname'])[_0xa158('0x50')](0x1),'converted_format':_0xa158('0x51')};var _0x257c54=path[_0xa158('0x41')](config['root'],_0xa158('0x52'),_0x36239a[_0xa158('0x4c')]['filename']);var _0x9a1ce5=path[_0xa158('0x41')](config[_0xa158('0x42')],_0xa158('0x43'),util[_0xa158('0x48')](_0xa158('0x49'),path[_0xa158('0x4b')](_0x36239a['file']['filename'],path[_0xa158('0x4f')](_0x36239a[_0xa158('0x4c')][_0xa158('0x4e')])),_0x539c0b[_0xa158('0x3f')]));logger[_0xa158('0x53')]('Sound\x20upload\x20filepath:\x20%s',_0x257c54);logger[_0xa158('0x53')]('Sound\x20upload\x20destination:\x20%s',_0x9a1ce5);try{fs[_0xa158('0x54')](_0x257c54,parseInt('0777',0x8));var _0x2291f8=sox[_0xa158('0x55')](_0x257c54,_0x9a1ce5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2291f8['on'](_0xa158('0x1c'),function(_0xe5fd0a){fs['unlinkSync'](_0x257c54);_0x66149c[_0xa158('0x11')](0x1f4)[_0xa158('0x56')](_0xe5fd0a);});_0x2291f8['on'](_0xa158('0x57'),function(_0x5a0e89){_0x539c0b['original_duration']=isNaN(_0x5a0e89[_0xa158('0x58')])?null:_0x5a0e89[_0xa158('0x58')]*0x3e8;_0x539c0b[_0xa158('0x59')]=isNaN(_0x5a0e89['sampleCount'])?null:_0x5a0e89['sampleCount'];_0x539c0b['original_channelCount']=isNaN(_0x5a0e89['channelCount'])?null:_0x5a0e89['channelCount'];_0x539c0b['original_bitRate']=isNaN(_0x5a0e89[_0xa158('0x5a')])?null:_0x5a0e89[_0xa158('0x5a')];_0x539c0b['original_sampleRate']=isNaN(_0x5a0e89[_0xa158('0x5b')])?null:_0x5a0e89['sampleRate'];});_0x2291f8['on'](_0xa158('0x5c'),function(_0x25ce42){_0x539c0b['converted_duration']=isNaN(_0x25ce42[_0xa158('0x58')])?null:_0x25ce42[_0xa158('0x58')]*0x3e8;_0x539c0b['converted_sampleCount']=isNaN(_0x25ce42[_0xa158('0x5d')])?null:_0x25ce42[_0xa158('0x5d')];_0x539c0b[_0xa158('0x5e')]=isNaN(_0x25ce42[_0xa158('0x5f')])?null:_0x25ce42[_0xa158('0x5f')];_0x539c0b[_0xa158('0x60')]=isNaN(_0x25ce42['bitRate'])?null:_0x25ce42[_0xa158('0x5a')];_0x539c0b[_0xa158('0x61')]=isNaN(_0x25ce42['sampleRate'])?null:_0x25ce42[_0xa158('0x5b')];});_0x2291f8['on']('end',function(){fs[_0xa158('0x54')](_0x9a1ce5,parseInt('0777',0x8));return db[_0xa158('0x20')][_0xa158('0x4a')](_0x539c0b)[_0xa158('0x19')](respondWithResult(_0x66149c,null))['catch'](handleError(_0x66149c,null));});_0x2291f8[_0xa158('0x62')]();}catch(_0x1e26fd){_0x66149c[_0xa158('0x11')](0x1f4)[_0xa158('0x56')](_0x1e26fd);}};exports['update']=function(_0x578850,_0x1d5f6c,_0x1bec59){return db['Sound'][_0xa158('0x3d')]({'where':{'id':_0x578850[_0xa158('0x3a')]['id']}})[_0xa158('0x19')](handleEntityNotFound(_0x1d5f6c,null))[_0xa158('0x19')](saveUpdates(_['pick'](_0x578850[_0xa158('0x63')],[_0xa158('0x1e'),'description']),null))[_0xa158('0x19')](respondWithResult(_0x1d5f6c,null))['catch'](handleError(_0x1d5f6c,null));};exports[_0xa158('0x64')]=function(_0x258959,_0x1157ae,_0x1e3bbd){return db['Sound'][_0xa158('0x3d')]({'where':{'id':_0x258959[_0xa158('0x3a')]['id']}})[_0xa158('0x19')](function(_0x2e8cf4){if(_0x2e8cf4){return _0x2e8cf4['destroy']();}})['then'](function(_0x48db78){var _0x4b3471=path['join'](config['root'],'server/files/sounds/original',util['format']('%s.%s',_0x48db78[_0xa158('0x3e')],_0x48db78[_0xa158('0x65')]));var _0x3d67b0=path[_0xa158('0x41')](config[_0xa158('0x42')],_0xa158('0x43'),util[_0xa158('0x48')](_0xa158('0x49'),_0x48db78[_0xa158('0x3e')],_0x48db78[_0xa158('0x3f')]));fs[_0xa158('0x66')](_0x4b3471);fs['unlinkSync'](_0x3d67b0);return _0x48db78;})[_0xa158('0x19')](function(_0x4b6f0d){if(_0x4b6f0d){return _0x1157ae[_0xa158('0x11')](0xcc)['end']();}})[_0xa158('0x19')](handleEntityNotFound(_0x1157ae,null))[_0xa158('0x38')](handleError(_0x1157ae,null));}; \ No newline at end of file +var _0xde1c=['querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','then','error','name','send','index','Sound','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','download','save_name','converted_format','join','server/files/sounds/converted','ValidationError','root','format','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','start','update','body','description','delete','destroy','original_format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x1d5046,_0x21fae8){var _0x48cb97=function(_0x2d52f0){while(--_0x2d52f0){_0x1d5046['push'](_0x1d5046['shift']());}};_0x48cb97(++_0x21fae8);}(_0xde1c,0x12f));var _0xcde1=function(_0x3975bb,_0x199cff){_0x3975bb=_0x3975bb-0x0;var _0x33f650=_0xde1c[_0x3975bb];return _0x33f650;};'use strict';var jsonpatch=require(_0xcde1('0x0'));var rp=require(_0xcde1('0x1'));var moment=require(_0xcde1('0x2'));var BPromise=require(_0xcde1('0x3'));var Mustache=require(_0xcde1('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcde1('0x5'));var csv=require(_0xcde1('0x6'));var ejs=require(_0xcde1('0x7'));var fs=require('fs');var _=require(_0xcde1('0x8'));var squel=require(_0xcde1('0x9'));var crypto=require(_0xcde1('0xa'));var jsforce=require(_0xcde1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcde1('0x6'));var querystring=require(_0xcde1('0xc'));var Papa=require('papaparse');var qs=require(_0xcde1('0xd'));var logger=require(_0xcde1('0xe'))(_0xcde1('0xf'));var utils=require(_0xcde1('0x10'));var config=require(_0xcde1('0x11'));var db=require(_0xcde1('0x12'))['db'];function respondWithStatusCode(_0x3c2853,_0x4fb732){_0x4fb732=_0x4fb732||0xcc;return function(_0x434cf6){if(_0x434cf6){return _0x3c2853[_0xcde1('0x13')](_0x4fb732);}return _0x3c2853[_0xcde1('0x14')](_0x4fb732)[_0xcde1('0x15')]();};}function respondWithResult(_0xc7372c,_0x3be015){_0x3be015=_0x3be015||0xc8;return function(_0x407d31){if(_0x407d31){return _0xc7372c['status'](_0x3be015)[_0xcde1('0x16')](_0x407d31);}};}function respondWithFilteredResult(_0x52ebdd,_0x5ae3bb){return function(_0x5dfa96){if(_0x5dfa96){var _0x38d00b=_0x5dfa96[_0xcde1('0x17')],_0x412a5b=_0x5ae3bb[_0xcde1('0x18')],_0x3fa5e6=_0x5ae3bb[_0xcde1('0x18')]+_0x5ae3bb['limit'],_0x27856c;if(_0x3fa5e6>=_0x38d00b){_0x3fa5e6=_0x38d00b;_0x27856c=0xc8;}else{_0x27856c=0xce;}_0x52ebdd[_0xcde1('0x14')](_0x27856c);return _0x52ebdd['set'](_0xcde1('0x19'),_0x412a5b+'-'+_0x3fa5e6+'/'+_0x38d00b)[_0xcde1('0x16')](_0x5dfa96);}return null;};}function patchUpdates(_0x2d353b){return function(_0x5f5ab5){try{jsonpatch[_0xcde1('0x1a')](_0x5f5ab5,_0x2d353b,!![]);}catch(_0x5bd85c){return BPromise['reject'](_0x5bd85c);}return _0x5f5ab5['save']();};}function saveUpdates(_0x2a213a,_0x5dd55d){return function(_0x27166c){if(_0x27166c){return _0x27166c['update'](_0x2a213a)['then'](function(_0x465005){return _0x465005;});}return null;};}function removeEntity(_0x2c1380,_0x53954b){return function(_0x2b82b4){if(_0x2b82b4){return _0x2b82b4['destroy']()[_0xcde1('0x1b')](function(){_0x2c1380[_0xcde1('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a103,_0x2f2acd){return function(_0x424c18){if(!_0x424c18){_0x51a103['sendStatus'](0x194);}return _0x424c18;};}function handleError(_0x1f3dc4,_0x29a1ad){_0x29a1ad=_0x29a1ad||0x1f4;return function(_0x363ba4){logger[_0xcde1('0x1c')](_0x363ba4['stack']);if(_0x363ba4[_0xcde1('0x1d')]){delete _0x363ba4[_0xcde1('0x1d')];}_0x1f3dc4[_0xcde1('0x14')](_0x29a1ad)[_0xcde1('0x1e')](_0x363ba4);};}exports[_0xcde1('0x1f')]=function(_0x1caeae,_0x4e83a3){var _0x1daf98={},_0x2bd175={},_0x1f8cc1={'count':0x0,'rows':[]};var _0x35552d=db[_0xcde1('0x20')][_0xcde1('0x21')];_0x2bd175['model']=_[_0xcde1('0x22')](_0x35552d);var _0x49b275={'dateStart':_0x1caeae[_0xcde1('0x23')][_0xcde1('0x24')],'dateEnd':_0x1caeae[_0xcde1('0x23')][_0xcde1('0x25')]};delete _0x1caeae[_0xcde1('0x23')]['dateStart'];delete _0x1caeae[_0xcde1('0x23')][_0xcde1('0x25')];_0x2bd175[_0xcde1('0x23')]=_['keys'](_0x1caeae[_0xcde1('0x23')]);_0x2bd175[_0xcde1('0x26')]=_[_0xcde1('0x27')](_0x2bd175[_0xcde1('0x28')],_0x2bd175[_0xcde1('0x23')]);_0x1daf98['attributes']=_[_0xcde1('0x27')](_0x2bd175[_0xcde1('0x28')],qs[_0xcde1('0x29')](_0x1caeae['query']['fields']));_0x1daf98[_0xcde1('0x2a')]=_0x1daf98[_0xcde1('0x2a')][_0xcde1('0x2b')]?_0x1daf98[_0xcde1('0x2a')]:_0x2bd175[_0xcde1('0x28')];if(!_0x1caeae[_0xcde1('0x23')][_0xcde1('0x2c')](_0xcde1('0x2d'))){_0x1daf98[_0xcde1('0x2e')]=qs[_0xcde1('0x2e')](_0x1caeae[_0xcde1('0x23')][_0xcde1('0x2e')]);_0x1daf98['offset']=qs[_0xcde1('0x18')](_0x1caeae['query'][_0xcde1('0x18')]);}_0x1daf98[_0xcde1('0x2f')]=qs[_0xcde1('0x30')](_0x1caeae[_0xcde1('0x23')][_0xcde1('0x30')]);_0x1daf98[_0xcde1('0x31')]=qs['filters'](_[_0xcde1('0x32')](_0x1caeae[_0xcde1('0x23')],_0x2bd175[_0xcde1('0x26')]));if(_0x49b275[_0xcde1('0x24')]){if(_0x49b275[_0xcde1('0x25')]){_0x49b275[_0xcde1('0x25')]=moment(_0x49b275['dateEnd'])[_0xcde1('0x33')](0x1,_0xcde1('0x34'));}else{_0x49b275[_0xcde1('0x25')]=moment(_0x49b275[_0xcde1('0x24')])[_0xcde1('0x33')](0x1,_0xcde1('0x34'));}_[_0xcde1('0x35')](_0x1daf98[_0xcde1('0x31')],{'createdAt':{'$gte':_0x49b275[_0xcde1('0x24')],'$lte':_0x49b275[_0xcde1('0x25')]}});}if(_0x1caeae[_0xcde1('0x23')][_0xcde1('0x36')]){_0x1daf98['where']=_['merge'](_0x1daf98[_0xcde1('0x31')],{'$or':_['map'](_0x1daf98['attributes'],function(_0x4d2537){var _0x20bcd0={};_0x20bcd0[_0x4d2537]={'$like':'%'+_0x1caeae[_0xcde1('0x23')]['filter']+'%'};return _0x20bcd0;})});}_0x1daf98=_['merge']({},_0x1daf98,_0x1caeae[_0xcde1('0x37')]);var _0xa2dd34={'where':_0x1daf98[_0xcde1('0x31')]};return db['Sound'][_0xcde1('0x17')](_0xa2dd34)[_0xcde1('0x1b')](function(_0x99beda){_0x1f8cc1[_0xcde1('0x17')]=_0x99beda;if(_0x1caeae['query'][_0xcde1('0x38')]){_0x1daf98[_0xcde1('0x39')]=[{'all':!![]}];}return db['Sound'][_0xcde1('0x3a')](_0x1daf98);})['then'](function(_0x329d76){_0x1f8cc1[_0xcde1('0x3b')]=_0x329d76;return _0x1f8cc1;})['then'](respondWithFilteredResult(_0x4e83a3,_0x1daf98))[_0xcde1('0x3c')](handleError(_0x4e83a3,null));};exports['show']=function(_0x523dc3,_0x1e1fe8){var _0x2d4e79={'raw':!![],'where':{'id':_0x523dc3[_0xcde1('0x3d')]['id']}},_0xc5ea47={};_0xc5ea47[_0xcde1('0x28')]=_[_0xcde1('0x22')](db[_0xcde1('0x20')][_0xcde1('0x21')]);_0xc5ea47[_0xcde1('0x23')]=_['keys'](_0x523dc3[_0xcde1('0x23')]);_0xc5ea47[_0xcde1('0x26')]=_[_0xcde1('0x27')](_0xc5ea47['model'],_0xc5ea47['query']);_0x2d4e79[_0xcde1('0x2a')]=_[_0xcde1('0x27')](_0xc5ea47[_0xcde1('0x28')],qs[_0xcde1('0x29')](_0x523dc3[_0xcde1('0x23')][_0xcde1('0x29')]));_0x2d4e79['attributes']=_0x2d4e79[_0xcde1('0x2a')][_0xcde1('0x2b')]?_0x2d4e79[_0xcde1('0x2a')]:_0xc5ea47[_0xcde1('0x28')];if(_0x523dc3['query'][_0xcde1('0x38')]){_0x2d4e79[_0xcde1('0x39')]=[{'all':!![]}];}_0x2d4e79=_[_0xcde1('0x35')]({},_0x2d4e79,_0x523dc3['options']);return db['Sound'][_0xcde1('0x3e')](_0x2d4e79)[_0xcde1('0x1b')](handleEntityNotFound(_0x1e1fe8,null))['then'](respondWithResult(_0x1e1fe8,null))['catch'](handleError(_0x1e1fe8,null));};exports[_0xcde1('0x3f')]=function(_0x53de16,_0x9b0a66,_0x7e5340){return db[_0xcde1('0x20')]['find']({'where':{'id':_0x53de16['params']['id']},'attributes':[_0xcde1('0x1d'),_0xcde1('0x40'),_0xcde1('0x41')],'raw':!![]})[_0xcde1('0x1b')](handleEntityNotFound(_0x9b0a66,null))[_0xcde1('0x1b')](function(_0x481e86){if(_0x481e86){if(!fs['existsSync'](path[_0xcde1('0x42')](config['root'],_0xcde1('0x43'),_0x481e86[_0xcde1('0x40')]+'.'+_0x481e86[_0xcde1('0x41')]))){throw new db['Sequelize'][(_0xcde1('0x44'))]('Sound\x20not\x20found');}return _0x9b0a66['download'](path[_0xcde1('0x42')](config[_0xcde1('0x45')],'server/files/sounds/converted',util[_0xcde1('0x46')]('%s.%s',_0x481e86[_0xcde1('0x40')],_0x481e86['converted_format'])),util[_0xcde1('0x46')](_0xcde1('0x47'),_0x481e86['name'],_0x481e86[_0xcde1('0x41')]));}return null;})[_0xcde1('0x3c')](handleError(_0x9b0a66,null));};exports[_0xcde1('0x48')]=function(_0x15eb84,_0x5def10,_0xfd2e61){var _0x54d613={'name':path[_0xcde1('0x49')](_0x15eb84['file'][_0xcde1('0x4a')],path[_0xcde1('0x4b')](_0x15eb84[_0xcde1('0x4c')][_0xcde1('0x4a')])),'save_name':path[_0xcde1('0x49')](_0x15eb84['file'][_0xcde1('0x4d')],path[_0xcde1('0x4b')](_0x15eb84['file'][_0xcde1('0x4d')])),'original_format':path[_0xcde1('0x4b')](_0x15eb84[_0xcde1('0x4c')][_0xcde1('0x4a')])[_0xcde1('0x4e')](0x1),'converted_format':_0xcde1('0x4f')};var _0xb4d8c5=path[_0xcde1('0x42')](config['root'],_0xcde1('0x50'),_0x15eb84['file']['filename']);var _0x305b56=path[_0xcde1('0x42')](config[_0xcde1('0x45')],_0xcde1('0x43'),util['format'](_0xcde1('0x47'),path[_0xcde1('0x49')](_0x15eb84[_0xcde1('0x4c')][_0xcde1('0x4d')],path[_0xcde1('0x4b')](_0x15eb84[_0xcde1('0x4c')][_0xcde1('0x4d')])),_0x54d613['converted_format']));logger[_0xcde1('0x51')](_0xcde1('0x52'),_0xb4d8c5);logger[_0xcde1('0x51')]('Sound\x20upload\x20destination:\x20%s',_0x305b56);try{fs[_0xcde1('0x53')](_0xb4d8c5,parseInt(_0xcde1('0x54'),0x8));var _0x578340=sox['transcode'](_0xb4d8c5,_0x305b56,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x578340['on'](_0xcde1('0x1c'),function(_0x271145){fs[_0xcde1('0x55')](_0xb4d8c5);_0x5def10['status'](0x1f4)[_0xcde1('0x1e')](_0x271145);});_0x578340['on']('src',function(_0x15dfa8){_0x54d613[_0xcde1('0x56')]=isNaN(_0x15dfa8['duration'])?null:_0x15dfa8[_0xcde1('0x57')]*0x3e8;_0x54d613[_0xcde1('0x58')]=isNaN(_0x15dfa8[_0xcde1('0x59')])?null:_0x15dfa8[_0xcde1('0x59')];_0x54d613['original_channelCount']=isNaN(_0x15dfa8[_0xcde1('0x5a')])?null:_0x15dfa8[_0xcde1('0x5a')];_0x54d613[_0xcde1('0x5b')]=isNaN(_0x15dfa8[_0xcde1('0x5c')])?null:_0x15dfa8['bitRate'];_0x54d613['original_sampleRate']=isNaN(_0x15dfa8[_0xcde1('0x5d')])?null:_0x15dfa8[_0xcde1('0x5d')];});_0x578340['on']('dest',function(_0x120292){_0x54d613[_0xcde1('0x5e')]=isNaN(_0x120292[_0xcde1('0x57')])?null:_0x120292[_0xcde1('0x57')]*0x3e8;_0x54d613['converted_sampleCount']=isNaN(_0x120292[_0xcde1('0x59')])?null:_0x120292['sampleCount'];_0x54d613[_0xcde1('0x5f')]=isNaN(_0x120292[_0xcde1('0x5a')])?null:_0x120292[_0xcde1('0x5a')];_0x54d613[_0xcde1('0x60')]=isNaN(_0x120292[_0xcde1('0x5c')])?null:_0x120292[_0xcde1('0x5c')];_0x54d613[_0xcde1('0x61')]=isNaN(_0x120292[_0xcde1('0x5d')])?null:_0x120292[_0xcde1('0x5d')];});_0x578340['on'](_0xcde1('0x15'),function(){fs['chmodSync'](_0x305b56,parseInt(_0xcde1('0x54'),0x8));return db[_0xcde1('0x20')]['create'](_0x54d613)['then'](respondWithResult(_0x5def10,null))['catch'](handleError(_0x5def10,null));});_0x578340[_0xcde1('0x62')]();}catch(_0x4989ae){_0x5def10['status'](0x1f4)[_0xcde1('0x1e')](_0x4989ae);}};exports[_0xcde1('0x63')]=function(_0x2bdea3,_0x2fbbbf,_0x3b8e09){return db[_0xcde1('0x20')]['find']({'where':{'id':_0x2bdea3['params']['id']}})[_0xcde1('0x1b')](handleEntityNotFound(_0x2fbbbf,null))[_0xcde1('0x1b')](saveUpdates(_[_0xcde1('0x32')](_0x2bdea3[_0xcde1('0x64')],[_0xcde1('0x1d'),_0xcde1('0x65')]),null))[_0xcde1('0x1b')](respondWithResult(_0x2fbbbf,null))[_0xcde1('0x3c')](handleError(_0x2fbbbf,null));};exports[_0xcde1('0x66')]=function(_0x1d8b55,_0x46812b,_0x1b8647){return db[_0xcde1('0x20')]['find']({'where':{'id':_0x1d8b55[_0xcde1('0x3d')]['id']}})[_0xcde1('0x1b')](function(_0x3c0409){if(_0x3c0409){return _0x3c0409[_0xcde1('0x67')]();}})[_0xcde1('0x1b')](function(_0x2b2bed){var _0x29b78e=path[_0xcde1('0x42')](config['root'],_0xcde1('0x50'),util[_0xcde1('0x46')]('%s.%s',_0x2b2bed['save_name'],_0x2b2bed[_0xcde1('0x68')]));var _0x3b3be4=path[_0xcde1('0x42')](config[_0xcde1('0x45')],_0xcde1('0x43'),util['format']('%s.%s',_0x2b2bed['save_name'],_0x2b2bed[_0xcde1('0x41')]));fs[_0xcde1('0x55')](_0x29b78e);fs[_0xcde1('0x55')](_0x3b3be4);return _0x2b2bed;})[_0xcde1('0x1b')](function(_0x413c0c){if(_0x413c0c){return _0x46812b['status'](0xcc)[_0xcde1('0x15')]();}})[_0xcde1('0x1b')](handleEntityNotFound(_0x46812b,null))[_0xcde1('0x3c')](handleError(_0x46812b,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b84513d..2d4e118 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 _0x789b=['request-promise','./sound.attributes','exports','Sound','tools_sounds','util','api','moment','bluebird'];(function(_0xf6a0f,_0x2edf83){var _0x92e7df=function(_0x27afd1){while(--_0x27afd1){_0xf6a0f['push'](_0xf6a0f['shift']());}};_0x92e7df(++_0x2edf83);}(_0x789b,0x140));var _0xb789=function(_0x2e66e1,_0x2b38a1){_0x2e66e1=_0x2e66e1-0x0;var _0xbe2e3=_0x789b[_0x2e66e1];return _0xbe2e3;};'use strict';var _=require('lodash');var util=require(_0xb789('0x0'));var logger=require('../../config/logger')(_0xb789('0x1'));var moment=require(_0xb789('0x2'));var BPromise=require(_0xb789('0x3'));var rp=require(_0xb789('0x4'));var attributes=require(_0xb789('0x5'));module[_0xb789('0x6')]=function(_0x53bb29,_0xb10e63){return _0x53bb29['define'](_0xb789('0x7'),attributes,{'tableName':_0xb789('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa49=['bluebird','request-promise','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment'];(function(_0x25b5be,_0x4b4381){var _0x35a7de=function(_0x1c7b1a){while(--_0x1c7b1a){_0x25b5be['push'](_0x25b5be['shift']());}};_0x35a7de(++_0x4b4381);}(_0xaa49,0x1be));var _0x9aa4=function(_0x570a53,_0x3c609c){_0x570a53=_0x570a53-0x0;var _0x338d54=_0xaa49[_0x570a53];return _0x338d54;};'use strict';var _=require(_0x9aa4('0x0'));var util=require(_0x9aa4('0x1'));var logger=require(_0x9aa4('0x2'))(_0x9aa4('0x3'));var moment=require(_0x9aa4('0x4'));var BPromise=require(_0x9aa4('0x5'));var rp=require(_0x9aa4('0x6'));var attributes=require('./sound.attributes');module[_0x9aa4('0x7')]=function(_0x384e5d,_0x507c78){return _0x384e5d[_0x9aa4('0x8')](_0x9aa4('0x9'),attributes,{'tableName':_0x9aa4('0xa'),'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 9c27394..ff8f3f6 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 _0xcf69=['stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','options','raw','where','attributes','include','map','model','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x50b6ff,_0xb9324f){var _0x57cb31=function(_0x2e959d){while(--_0x2e959d){_0x50b6ff['push'](_0x50b6ff['shift']());}};_0x57cb31(++_0xb9324f);}(_0xcf69,0xbe));var _0x9cf6=function(_0x518bfa,_0x39f167){_0x518bfa=_0x518bfa-0x0;var _0x256be6=_0xcf69[_0x518bfa];return _0x256be6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9cf6('0x0'));var BPromise=require(_0x9cf6('0x1'));var rs=require(_0x9cf6('0x2'));var fs=require('fs');var db=require(_0x9cf6('0x3'))['db'];var utils=require(_0x9cf6('0x4'));var logger=require(_0x9cf6('0x5'))(_0x9cf6('0x6'));var config=require(_0x9cf6('0x7'));var jayson=require(_0x9cf6('0x8'));var client=jayson[_0x9cf6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58d13e,_0xd6ef43,_0x359b75){return new BPromise(function(_0x370748,_0x551a19){return client['request'](_0x58d13e,_0x359b75)[_0x9cf6('0xa')](function(_0x47964a){logger['info']('Sound,\x20%s,\x20%s',_0xd6ef43,_0x9cf6('0xb'));logger['debug'](_0x9cf6('0xc'),_0xd6ef43,_0x9cf6('0xb'),JSON[_0x9cf6('0xd')](_0x47964a));if(_0x47964a[_0x9cf6('0xe')]){if(_0x47964a['error'][_0x9cf6('0xf')]===0x1f4){logger[_0x9cf6('0xe')](_0x9cf6('0x10'),_0xd6ef43,_0x47964a['error']['message']);return _0x551a19(_0x47964a[_0x9cf6('0xe')][_0x9cf6('0x11')]);}logger['error']('Sound,\x20%s,\x20%s',_0xd6ef43,_0x47964a[_0x9cf6('0xe')][_0x9cf6('0x11')]);return _0x370748(_0x47964a['error']['message']);}else{logger[_0x9cf6('0x12')](_0x9cf6('0x10'),_0xd6ef43,_0x9cf6('0xb'));_0x370748(_0x47964a[_0x9cf6('0x13')][_0x9cf6('0x11')]);}})[_0x9cf6('0x14')](function(_0x54b905){logger['error'](_0x9cf6('0x10'),_0xd6ef43,_0x54b905);_0x551a19(_0x54b905);});});}exports[_0x9cf6('0x15')]=function(_0x77268c){var _0x32290f=this;return new Promise(function(_0x44bed1,_0x24b3ec){return db['Sound']['find']({'raw':_0x77268c[_0x9cf6('0x16')]?_0x77268c[_0x9cf6('0x16')][_0x9cf6('0x17')]===undefined?!![]:![]:!![],'where':_0x77268c['options']?_0x77268c[_0x9cf6('0x16')][_0x9cf6('0x18')]||null:null,'attributes':_0x77268c[_0x9cf6('0x16')]?_0x77268c['options'][_0x9cf6('0x19')]||null:null,'include':_0x77268c[_0x9cf6('0x16')]?_0x77268c['options'][_0x9cf6('0x1a')]?_[_0x9cf6('0x1b')](_0x77268c[_0x9cf6('0x16')][_0x9cf6('0x1a')],function(_0x5e1d15){return{'model':db[_0x5e1d15['model']],'as':_0x5e1d15['as'],'attributes':_0x5e1d15[_0x9cf6('0x19')],'include':_0x5e1d15[_0x9cf6('0x1a')]?_[_0x9cf6('0x1b')](_0x5e1d15[_0x9cf6('0x1a')],function(_0x4dba78){return{'model':db[_0x4dba78[_0x9cf6('0x1c')]],'as':_0x4dba78['as'],'attributes':_0x4dba78[_0x9cf6('0x19')],'include':_0x4dba78[_0x9cf6('0x1a')]?_[_0x9cf6('0x1b')](_0x4dba78[_0x9cf6('0x1a')],function(_0x187e62){return{'model':db[_0x187e62[_0x9cf6('0x1c')]],'as':_0x187e62['as'],'attributes':_0x187e62['attributes']};}):[]};}):[]};}):[]:[]})[_0x9cf6('0xa')](function(_0x145c8d){logger['info'](_0x9cf6('0x15'),_0x77268c);logger['debug']('ShowSound',_0x77268c,JSON[_0x9cf6('0xd')](_0x145c8d));_0x44bed1(_0x145c8d);})['catch'](function(_0x32f6f1){logger[_0x9cf6('0xe')](_0x9cf6('0x15'),_0x32f6f1[_0x9cf6('0x11')],_0x77268c);_0x24b3ec(_0x32290f[_0x9cf6('0xe')](0x1f4,_0x32f6f1['message']));});});}; \ No newline at end of file +var _0x3367=['find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSound','Sound'];(function(_0x14c0aa,_0x5877e0){var _0x3a6a5b=function(_0x112d09){while(--_0x112d09){_0x14c0aa['push'](_0x14c0aa['shift']());}};_0x3a6a5b(++_0x5877e0);}(_0x3367,0x188));var _0x7336=function(_0x231364,_0x5ccf31){_0x231364=_0x231364-0x0;var _0xa3c8b5=_0x3367[_0x231364];return _0xa3c8b5;};'use strict';var _=require(_0x7336('0x0'));var util=require(_0x7336('0x1'));var moment=require(_0x7336('0x2'));var BPromise=require(_0x7336('0x3'));var rs=require(_0x7336('0x4'));var fs=require('fs');var db=require(_0x7336('0x5'))['db'];var utils=require(_0x7336('0x6'));var logger=require('../../config/logger')(_0x7336('0x7'));var config=require(_0x7336('0x8'));var jayson=require(_0x7336('0x9'));var client=jayson[_0x7336('0xa')][_0x7336('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12827e,_0x555249,_0x4ca3de){return new BPromise(function(_0x54b8a2,_0x243151){return client['request'](_0x12827e,_0x4ca3de)[_0x7336('0xc')](function(_0x3f8dd7){logger[_0x7336('0xd')](_0x7336('0xe'),_0x555249,'request\x20sent');logger['debug'](_0x7336('0xf'),_0x555249,_0x7336('0x10'),JSON[_0x7336('0x11')](_0x3f8dd7));if(_0x3f8dd7['error']){if(_0x3f8dd7[_0x7336('0x12')]['code']===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x555249,_0x3f8dd7[_0x7336('0x12')][_0x7336('0x13')]);return _0x243151(_0x3f8dd7['error'][_0x7336('0x13')]);}logger[_0x7336('0x12')](_0x7336('0xe'),_0x555249,_0x3f8dd7['error'][_0x7336('0x13')]);return _0x54b8a2(_0x3f8dd7['error'][_0x7336('0x13')]);}else{logger[_0x7336('0xd')](_0x7336('0xe'),_0x555249,_0x7336('0x10'));_0x54b8a2(_0x3f8dd7[_0x7336('0x14')][_0x7336('0x13')]);}})[_0x7336('0x15')](function(_0x3a39f5){logger[_0x7336('0x12')]('Sound,\x20%s,\x20%s',_0x555249,_0x3a39f5);_0x243151(_0x3a39f5);});});}exports[_0x7336('0x16')]=function(_0x56a050){var _0x327982=this;return new Promise(function(_0x43513c,_0x5ec842){return db[_0x7336('0x17')][_0x7336('0x18')]({'raw':_0x56a050[_0x7336('0x19')]?_0x56a050[_0x7336('0x19')][_0x7336('0x1a')]===undefined?!![]:![]:!![],'where':_0x56a050[_0x7336('0x19')]?_0x56a050[_0x7336('0x19')][_0x7336('0x1b')]||null:null,'attributes':_0x56a050['options']?_0x56a050[_0x7336('0x19')][_0x7336('0x1c')]||null:null,'include':_0x56a050['options']?_0x56a050[_0x7336('0x19')]['include']?_[_0x7336('0x1d')](_0x56a050['options'][_0x7336('0x1e')],function(_0x533ddb){return{'model':db[_0x533ddb[_0x7336('0x1f')]],'as':_0x533ddb['as'],'attributes':_0x533ddb[_0x7336('0x1c')],'include':_0x533ddb[_0x7336('0x1e')]?_[_0x7336('0x1d')](_0x533ddb[_0x7336('0x1e')],function(_0x5c5529){return{'model':db[_0x5c5529[_0x7336('0x1f')]],'as':_0x5c5529['as'],'attributes':_0x5c5529[_0x7336('0x1c')],'include':_0x5c5529['include']?_[_0x7336('0x1d')](_0x5c5529[_0x7336('0x1e')],function(_0x356954){return{'model':db[_0x356954[_0x7336('0x1f')]],'as':_0x356954['as'],'attributes':_0x356954[_0x7336('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7336('0xc')](function(_0x746244){logger[_0x7336('0xd')]('ShowSound',_0x56a050);logger['debug'](_0x7336('0x16'),_0x56a050,JSON[_0x7336('0x11')](_0x746244));_0x43513c(_0x746244);})[_0x7336('0x15')](function(_0xf254f){logger[_0x7336('0x12')]('ShowSound',_0xf254f[_0x7336('0x13')],_0x56a050);_0x5ec842(_0x327982[_0x7336('0x12')](0x1f4,_0xf254f[_0x7336('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 73b5ae0..d570889 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 _0x7217=['get','isAuthenticated','index','/:id','show','/:id/test','test','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x7217,0x19e));var _0x7721=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x7217[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var express=require(_0x7721('0x2'));var router=express[_0x7721('0x3')]();var auth=require(_0x7721('0x4'));var interaction=require(_0x7721('0x5'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x7721('0x6')]('/',auth[_0x7721('0x7')](),controller[_0x7721('0x8')]);router[_0x7721('0x6')](_0x7721('0x9'),auth[_0x7721('0x7')](),controller[_0x7721('0xa')]);router[_0x7721('0x6')](_0x7721('0xb'),auth[_0x7721('0x7')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x7')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')]('/:id',auth[_0x7721('0x7')](),controller[_0x7721('0x10')]);router[_0x7721('0x11')](_0x7721('0x9'),auth[_0x7721('0x7')](),controller[_0x7721('0x12')]);module[_0x7721('0x13')]=router; \ No newline at end of file +var _0xd8fb=['index','/:id','show','/:id/test','create','put','update','destroy','exports','multer','util','path','express','../../config/environment','./squareOdbc.controller','isAuthenticated'];(function(_0x5c4eaf,_0x4839e0){var _0x4dae56=function(_0x3917af){while(--_0x3917af){_0x5c4eaf['push'](_0x5c4eaf['shift']());}};_0x4dae56(++_0x4839e0);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2d7b96,_0x50b055){_0x2d7b96=_0x2d7b96-0x0;var _0x1df561=_0xd8fb[_0x2d7b96];return _0x1df561;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var express=require(_0xbd8f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd8f('0x4'));var controller=require(_0xbd8f('0x5'));router['get']('/',auth[_0xbd8f('0x6')](),controller[_0xbd8f('0x7')]);router['get'](_0xbd8f('0x8'),auth['isAuthenticated'](),controller[_0xbd8f('0x9')]);router['get'](_0xbd8f('0xa'),auth[_0xbd8f('0x6')](),controller['test']);router['post']('/',auth[_0xbd8f('0x6')](),controller[_0xbd8f('0xb')]);router[_0xbd8f('0xc')]('/:id',auth[_0xbd8f('0x6')](),controller[_0xbd8f('0xd')]);router['delete']('/:id',auth[_0xbd8f('0x6')](),controller[_0xbd8f('0xe')]);module[_0xbd8f('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 6626bc3..0610a37 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 _0x555c=['STRING','name','sequelize','exports'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x555c,0x6a));var _0xc555=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x555c[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0xc555('0x0'));module[_0xc555('0x1')]={'name':{'type':Sequelize[_0xc555('0x2')],'unique':_0xc555('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc555('0x2')]},'description':{'type':Sequelize[_0xc555('0x2')]}}; \ No newline at end of file +var _0x872d=['name','sequelize','exports','STRING'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0x872d,0x79));var _0xd872=function(_0x4f28d3,_0x2b3742){_0x4f28d3=_0x4f28d3-0x0;var _0x50a274=_0x872d[_0x4f28d3];return _0x50a274;};'use strict';var Sequelize=require(_0xd872('0x0'));module[_0xd872('0x1')]={'name':{'type':Sequelize[_0xd872('0x2')],'unique':_0xd872('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd872('0x2')]},'description':{'type':Sequelize[_0xd872('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0f1257b..301406b 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 _0x171f=['dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','day','add','filter','merge','map','options','SquareOdbc','count','includeAll','include','findAll','rows','show','params','length','find','create','catch','body','test','odbc','closeSync','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','index','rawAttributes','model','keys','query'];(function(_0xdb8c35,_0x49387e){var _0x3636f6=function(_0x30e5e8){while(--_0x30e5e8){_0xdb8c35['push'](_0xdb8c35['shift']());}};_0x3636f6(++_0x49387e);}(_0x171f,0x184));var _0xf171=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x171f[_0x680821];return _0x3f132c;};'use strict';var jsonpatch=require(_0xf171('0x0'));var rp=require(_0xf171('0x1'));var moment=require('moment');var BPromise=require(_0xf171('0x2'));var Mustache=require(_0xf171('0x3'));var util=require('util');var path=require(_0xf171('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf171('0x5'));var fs=require('fs');var _=require(_0xf171('0x6'));var squel=require('squel');var crypto=require(_0xf171('0x7'));var jsforce=require(_0xf171('0x8'));var deskjs=require(_0xf171('0x9'));var toCsv=require(_0xf171('0xa'));var querystring=require(_0xf171('0xb'));var Papa=require('papaparse');var qs=require(_0xf171('0xc'));var logger=require(_0xf171('0xd'))(_0xf171('0xe'));var utils=require(_0xf171('0xf'));var config=require(_0xf171('0x10'));var db=require(_0xf171('0x11'))['db'];function respondWithStatusCode(_0x9f232b,_0x500ca9){_0x500ca9=_0x500ca9||0xcc;return function(_0x123c82){if(_0x123c82){return _0x9f232b['sendStatus'](_0x500ca9);}return _0x9f232b[_0xf171('0x12')](_0x500ca9)[_0xf171('0x13')]();};}function respondWithResult(_0x3e28c0,_0xc16122){_0xc16122=_0xc16122||0xc8;return function(_0x377869){if(_0x377869){return _0x3e28c0['status'](_0xc16122)[_0xf171('0x14')](_0x377869);}};}function respondWithFilteredResult(_0x2ff815,_0x452dc9){return function(_0x3619c3){if(_0x3619c3){var _0x436bfd=_0x3619c3['count'],_0x13aa9d=_0x452dc9[_0xf171('0x15')],_0x3269d0=_0x452dc9[_0xf171('0x15')]+_0x452dc9[_0xf171('0x16')],_0x3fbb25;if(_0x3269d0>=_0x436bfd){_0x3269d0=_0x436bfd;_0x3fbb25=0xc8;}else{_0x3fbb25=0xce;}_0x2ff815[_0xf171('0x12')](_0x3fbb25);return _0x2ff815[_0xf171('0x17')](_0xf171('0x18'),_0x13aa9d+'-'+_0x3269d0+'/'+_0x436bfd)['json'](_0x3619c3);}return null;};}function patchUpdates(_0x1e6686){return function(_0x4c8168){try{jsonpatch[_0xf171('0x19')](_0x4c8168,_0x1e6686,!![]);}catch(_0x584516){return BPromise['reject'](_0x584516);}return _0x4c8168['save']();};}function saveUpdates(_0x5a4359,_0x45d13c){return function(_0x29caff){if(_0x29caff){return _0x29caff[_0xf171('0x1a')](_0x5a4359)['then'](function(_0x12de2c){return _0x12de2c;});}return null;};}function removeEntity(_0x5773bc,_0x2c2a9c){return function(_0x353d41){if(_0x353d41){return _0x353d41[_0xf171('0x1b')]()[_0xf171('0x1c')](function(){_0x5773bc['status'](0xcc)[_0xf171('0x13')]();});}};}function handleEntityNotFound(_0x4faebc,_0x4f3915){return function(_0x22e35a){if(!_0x22e35a){_0x4faebc[_0xf171('0x1d')](0x194);}return _0x22e35a;};}function handleError(_0x429bde,_0x360a6f){_0x360a6f=_0x360a6f||0x1f4;return function(_0x41e309){logger[_0xf171('0x1e')](_0x41e309[_0xf171('0x1f')]);if(_0x41e309[_0xf171('0x20')]){delete _0x41e309['name'];}_0x429bde[_0xf171('0x12')](_0x360a6f)['send'](_0x41e309);};}exports[_0xf171('0x21')]=function(_0x33746e,_0x3e7548){var _0x5dca33={},_0xca2790={},_0x400063={'count':0x0,'rows':[]};var _0xfcf742=db['SquareOdbc'][_0xf171('0x22')];_0xca2790[_0xf171('0x23')]=_[_0xf171('0x24')](_0xfcf742);var _0x421e1a={'dateStart':_0x33746e[_0xf171('0x25')][_0xf171('0x26')],'dateEnd':_0x33746e['query']['dateEnd']};delete _0x33746e[_0xf171('0x25')][_0xf171('0x26')];delete _0x33746e[_0xf171('0x25')][_0xf171('0x27')];_0xca2790[_0xf171('0x25')]=_['keys'](_0x33746e['query']);_0xca2790[_0xf171('0x28')]=_[_0xf171('0x29')](_0xca2790[_0xf171('0x23')],_0xca2790[_0xf171('0x25')]);_0x5dca33[_0xf171('0x2a')]=_[_0xf171('0x29')](_0xca2790[_0xf171('0x23')],qs[_0xf171('0x2b')](_0x33746e['query']['fields']));_0x5dca33['attributes']=_0x5dca33[_0xf171('0x2a')]['length']?_0x5dca33[_0xf171('0x2a')]:_0xca2790[_0xf171('0x23')];if(!_0x33746e['query'][_0xf171('0x2c')](_0xf171('0x2d'))){_0x5dca33[_0xf171('0x16')]=qs[_0xf171('0x16')](_0x33746e['query'][_0xf171('0x16')]);_0x5dca33[_0xf171('0x15')]=qs[_0xf171('0x15')](_0x33746e[_0xf171('0x25')][_0xf171('0x15')]);}_0x5dca33['order']=qs[_0xf171('0x2e')](_0x33746e[_0xf171('0x25')][_0xf171('0x2e')]);_0x5dca33[_0xf171('0x2f')]=qs[_0xf171('0x28')](_[_0xf171('0x30')](_0x33746e[_0xf171('0x25')],_0xca2790[_0xf171('0x28')]));if(_0x421e1a[_0xf171('0x26')]){if(_0x421e1a['dateEnd']){_0x421e1a[_0xf171('0x27')]=moment(_0x421e1a['dateEnd'])['add'](0x1,_0xf171('0x31'));}else{_0x421e1a[_0xf171('0x27')]=moment(_0x421e1a[_0xf171('0x26')])[_0xf171('0x32')](0x1,'day');}_['merge'](_0x5dca33[_0xf171('0x2f')],{'createdAt':{'$gte':_0x421e1a[_0xf171('0x26')],'$lte':_0x421e1a[_0xf171('0x27')]}});}if(_0x33746e['query'][_0xf171('0x33')]){_0x5dca33[_0xf171('0x2f')]=_[_0xf171('0x34')](_0x5dca33[_0xf171('0x2f')],{'$or':_[_0xf171('0x35')](_0x5dca33[_0xf171('0x2a')],function(_0x4f8afe){var _0x44d072={};_0x44d072[_0x4f8afe]={'$like':'%'+_0x33746e[_0xf171('0x25')][_0xf171('0x33')]+'%'};return _0x44d072;})});}_0x5dca33=_['merge']({},_0x5dca33,_0x33746e[_0xf171('0x36')]);var _0x543ceb={'where':_0x5dca33[_0xf171('0x2f')]};return db[_0xf171('0x37')]['count'](_0x543ceb)[_0xf171('0x1c')](function(_0x5e2bf5){_0x400063[_0xf171('0x38')]=_0x5e2bf5;if(_0x33746e['query'][_0xf171('0x39')]){_0x5dca33[_0xf171('0x3a')]=[{'all':!![]}];}return db[_0xf171('0x37')][_0xf171('0x3b')](_0x5dca33);})['then'](function(_0x574804){_0x400063[_0xf171('0x3c')]=_0x574804;return _0x400063;})[_0xf171('0x1c')](respondWithFilteredResult(_0x3e7548,_0x5dca33))['catch'](handleError(_0x3e7548,null));};exports[_0xf171('0x3d')]=function(_0x3fa88c,_0x613db5){var _0x5c2bb9={'raw':!![],'where':{'id':_0x3fa88c[_0xf171('0x3e')]['id']}},_0x3e2493={};_0x3e2493[_0xf171('0x23')]=_[_0xf171('0x24')](db['SquareOdbc'][_0xf171('0x22')]);_0x3e2493['query']=_['keys'](_0x3fa88c['query']);_0x3e2493['filters']=_[_0xf171('0x29')](_0x3e2493[_0xf171('0x23')],_0x3e2493[_0xf171('0x25')]);_0x5c2bb9['attributes']=_[_0xf171('0x29')](_0x3e2493[_0xf171('0x23')],qs[_0xf171('0x2b')](_0x3fa88c[_0xf171('0x25')][_0xf171('0x2b')]));_0x5c2bb9[_0xf171('0x2a')]=_0x5c2bb9['attributes'][_0xf171('0x3f')]?_0x5c2bb9['attributes']:_0x3e2493['model'];if(_0x3fa88c['query']['includeAll']){_0x5c2bb9[_0xf171('0x3a')]=[{'all':!![]}];}_0x5c2bb9=_[_0xf171('0x34')]({},_0x5c2bb9,_0x3fa88c['options']);return db['SquareOdbc'][_0xf171('0x40')](_0x5c2bb9)[_0xf171('0x1c')](handleEntityNotFound(_0x613db5,null))[_0xf171('0x1c')](respondWithResult(_0x613db5,null))['catch'](handleError(_0x613db5,null));};exports[_0xf171('0x41')]=function(_0x1a6afa,_0x2ad565){return db['SquareOdbc'][_0xf171('0x41')](_0x1a6afa['body'],{})[_0xf171('0x1c')](respondWithResult(_0x2ad565,0xc9))[_0xf171('0x42')](handleError(_0x2ad565,null));};exports['update']=function(_0x1e5dc3,_0x29cabb){if(_0x1e5dc3[_0xf171('0x43')]['id']){delete _0x1e5dc3[_0xf171('0x43')]['id'];}return db[_0xf171('0x37')][_0xf171('0x40')]({'where':{'id':_0x1e5dc3['params']['id']}})[_0xf171('0x1c')](handleEntityNotFound(_0x29cabb,null))[_0xf171('0x1c')](saveUpdates(_0x1e5dc3[_0xf171('0x43')],null))['then'](respondWithResult(_0x29cabb,null))['catch'](handleError(_0x29cabb,null));};exports[_0xf171('0x1b')]=function(_0x468a60,_0x33580c){return db[_0xf171('0x37')][_0xf171('0x40')]({'where':{'id':_0x468a60['params']['id']}})[_0xf171('0x1c')](handleEntityNotFound(_0x33580c,null))[_0xf171('0x1c')](removeEntity(_0x33580c,null))[_0xf171('0x42')](handleError(_0x33580c,null));};exports[_0xf171('0x44')]=function(_0x166793,_0x2c5aa2,_0x3312a4){var _0x3f72bc;return db[_0xf171('0x37')]['find']({'where':{'id':_0x166793[_0xf171('0x3e')]['id']},'attributes':['id','dsn']})[_0xf171('0x1c')](handleEntityNotFound(_0x2c5aa2,null))[_0xf171('0x1c')](function(_0x28916c){if(_0x28916c){var _0x2e9251=require(_0xf171('0x45'))();_0x2e9251['openSync'](_0x28916c['dsn']);_0x2e9251[_0xf171('0x46')]();return _0x28916c;}})[_0xf171('0x1c')](respondWithResult(_0x2c5aa2,null))['catch'](handleError(_0x2c5aa2,null));}; \ No newline at end of file +var _0xc986=['mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','SquareOdbc','rawAttributes','model','query','dateStart','dateEnd','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','day','merge','filter','includeAll','include','findAll','show','params','keys','find','catch','create','body','test','dsn','odbc','openSync','closeSync','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2602a8,_0x31bf72){var _0x5034ac=function(_0x4c7020){while(--_0x4c7020){_0x2602a8['push'](_0x2602a8['shift']());}};_0x5034ac(++_0x31bf72);}(_0xc986,0xce));var _0x6c98=function(_0x3306b6,_0x42e90b){_0x3306b6=_0x3306b6-0x0;var _0x47340a=_0xc986[_0x3306b6];return _0x47340a;};'use strict';var jsonpatch=require(_0x6c98('0x0'));var rp=require(_0x6c98('0x1'));var moment=require(_0x6c98('0x2'));var BPromise=require(_0x6c98('0x3'));var Mustache=require(_0x6c98('0x4'));var util=require(_0x6c98('0x5'));var path=require(_0x6c98('0x6'));var sox=require(_0x6c98('0x7'));var csv=require(_0x6c98('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c98('0x9'));var squel=require(_0x6c98('0xa'));var crypto=require(_0x6c98('0xb'));var jsforce=require(_0x6c98('0xc'));var deskjs=require(_0x6c98('0xd'));var toCsv=require(_0x6c98('0x8'));var querystring=require(_0x6c98('0xe'));var Papa=require(_0x6c98('0xf'));var qs=require(_0x6c98('0x10'));var logger=require('../../config/logger')(_0x6c98('0x11'));var utils=require(_0x6c98('0x12'));var config=require('../../config/environment');var db=require(_0x6c98('0x13'))['db'];function respondWithStatusCode(_0x49d6f6,_0x2a10ab){_0x2a10ab=_0x2a10ab||0xcc;return function(_0x5613ab){if(_0x5613ab){return _0x49d6f6[_0x6c98('0x14')](_0x2a10ab);}return _0x49d6f6[_0x6c98('0x15')](_0x2a10ab)['end']();};}function respondWithResult(_0x5901d1,_0x3a1eac){_0x3a1eac=_0x3a1eac||0xc8;return function(_0x6405fa){if(_0x6405fa){return _0x5901d1['status'](_0x3a1eac)['json'](_0x6405fa);}};}function respondWithFilteredResult(_0x3c4352,_0x59a870){return function(_0x487ae1){if(_0x487ae1){var _0x537cb0=_0x487ae1[_0x6c98('0x16')],_0x39d8b1=_0x59a870['offset'],_0x5e5af4=_0x59a870[_0x6c98('0x17')]+_0x59a870[_0x6c98('0x18')],_0x1c9b6d;if(_0x5e5af4>=_0x537cb0){_0x5e5af4=_0x537cb0;_0x1c9b6d=0xc8;}else{_0x1c9b6d=0xce;}_0x3c4352['status'](_0x1c9b6d);return _0x3c4352[_0x6c98('0x19')](_0x6c98('0x1a'),_0x39d8b1+'-'+_0x5e5af4+'/'+_0x537cb0)[_0x6c98('0x1b')](_0x487ae1);}return null;};}function patchUpdates(_0x4df32c){return function(_0x4e0d9b){try{jsonpatch[_0x6c98('0x1c')](_0x4e0d9b,_0x4df32c,!![]);}catch(_0x4f36bb){return BPromise[_0x6c98('0x1d')](_0x4f36bb);}return _0x4e0d9b[_0x6c98('0x1e')]();};}function saveUpdates(_0x2a4f4d,_0x409820){return function(_0x343c46){if(_0x343c46){return _0x343c46[_0x6c98('0x1f')](_0x2a4f4d)[_0x6c98('0x20')](function(_0x27f6ed){return _0x27f6ed;});}return null;};}function removeEntity(_0x2384f5,_0x2764d6){return function(_0x226392){if(_0x226392){return _0x226392[_0x6c98('0x21')]()[_0x6c98('0x20')](function(){_0x2384f5[_0x6c98('0x15')](0xcc)[_0x6c98('0x22')]();});}};}function handleEntityNotFound(_0x3c9b7c,_0x14af42){return function(_0x53ce52){if(!_0x53ce52){_0x3c9b7c['sendStatus'](0x194);}return _0x53ce52;};}function handleError(_0x10872c,_0x5952e7){_0x5952e7=_0x5952e7||0x1f4;return function(_0x432734){logger['error'](_0x432734['stack']);if(_0x432734[_0x6c98('0x23')]){delete _0x432734[_0x6c98('0x23')];}_0x10872c[_0x6c98('0x15')](_0x5952e7)[_0x6c98('0x24')](_0x432734);};}exports['index']=function(_0x488bb0,_0x38eaa3){var _0x1b88a4={},_0x40d5b2={},_0x294e2d={'count':0x0,'rows':[]};var _0x4b96a9=db[_0x6c98('0x25')][_0x6c98('0x26')];_0x40d5b2[_0x6c98('0x27')]=_['keys'](_0x4b96a9);var _0x4c2217={'dateStart':_0x488bb0[_0x6c98('0x28')][_0x6c98('0x29')],'dateEnd':_0x488bb0[_0x6c98('0x28')][_0x6c98('0x2a')]};delete _0x488bb0[_0x6c98('0x28')][_0x6c98('0x29')];delete _0x488bb0[_0x6c98('0x28')][_0x6c98('0x2a')];_0x40d5b2[_0x6c98('0x28')]=_['keys'](_0x488bb0[_0x6c98('0x28')]);_0x40d5b2['filters']=_['intersection'](_0x40d5b2[_0x6c98('0x27')],_0x40d5b2[_0x6c98('0x28')]);_0x1b88a4[_0x6c98('0x2b')]=_['intersection'](_0x40d5b2[_0x6c98('0x27')],qs[_0x6c98('0x2c')](_0x488bb0['query'][_0x6c98('0x2c')]));_0x1b88a4[_0x6c98('0x2b')]=_0x1b88a4[_0x6c98('0x2b')][_0x6c98('0x2d')]?_0x1b88a4[_0x6c98('0x2b')]:_0x40d5b2[_0x6c98('0x27')];if(!_0x488bb0[_0x6c98('0x28')][_0x6c98('0x2e')](_0x6c98('0x2f'))){_0x1b88a4[_0x6c98('0x18')]=qs[_0x6c98('0x18')](_0x488bb0[_0x6c98('0x28')][_0x6c98('0x18')]);_0x1b88a4[_0x6c98('0x17')]=qs[_0x6c98('0x17')](_0x488bb0['query'][_0x6c98('0x17')]);}_0x1b88a4['order']=qs[_0x6c98('0x30')](_0x488bb0[_0x6c98('0x28')][_0x6c98('0x30')]);_0x1b88a4[_0x6c98('0x31')]=qs[_0x6c98('0x32')](_[_0x6c98('0x33')](_0x488bb0['query'],_0x40d5b2['filters']));if(_0x4c2217[_0x6c98('0x29')]){if(_0x4c2217[_0x6c98('0x2a')]){_0x4c2217[_0x6c98('0x2a')]=moment(_0x4c2217[_0x6c98('0x2a')])['add'](0x1,_0x6c98('0x34'));}else{_0x4c2217['dateEnd']=moment(_0x4c2217[_0x6c98('0x29')])['add'](0x1,_0x6c98('0x34'));}_[_0x6c98('0x35')](_0x1b88a4[_0x6c98('0x31')],{'createdAt':{'$gte':_0x4c2217[_0x6c98('0x29')],'$lte':_0x4c2217[_0x6c98('0x2a')]}});}if(_0x488bb0['query'][_0x6c98('0x36')]){_0x1b88a4['where']=_[_0x6c98('0x35')](_0x1b88a4[_0x6c98('0x31')],{'$or':_['map'](_0x1b88a4['attributes'],function(_0x172c14){var _0x331980={};_0x331980[_0x172c14]={'$like':'%'+_0x488bb0[_0x6c98('0x28')][_0x6c98('0x36')]+'%'};return _0x331980;})});}_0x1b88a4=_[_0x6c98('0x35')]({},_0x1b88a4,_0x488bb0['options']);var _0x10963c={'where':_0x1b88a4['where']};return db['SquareOdbc']['count'](_0x10963c)[_0x6c98('0x20')](function(_0x43ad88){_0x294e2d[_0x6c98('0x16')]=_0x43ad88;if(_0x488bb0[_0x6c98('0x28')][_0x6c98('0x37')]){_0x1b88a4[_0x6c98('0x38')]=[{'all':!![]}];}return db[_0x6c98('0x25')][_0x6c98('0x39')](_0x1b88a4);})[_0x6c98('0x20')](function(_0x200d40){_0x294e2d['rows']=_0x200d40;return _0x294e2d;})[_0x6c98('0x20')](respondWithFilteredResult(_0x38eaa3,_0x1b88a4))['catch'](handleError(_0x38eaa3,null));};exports[_0x6c98('0x3a')]=function(_0x39d442,_0x3b6e7a){var _0x288dc1={'raw':!![],'where':{'id':_0x39d442[_0x6c98('0x3b')]['id']}},_0x2332d9={};_0x2332d9[_0x6c98('0x27')]=_[_0x6c98('0x3c')](db[_0x6c98('0x25')][_0x6c98('0x26')]);_0x2332d9[_0x6c98('0x28')]=_[_0x6c98('0x3c')](_0x39d442[_0x6c98('0x28')]);_0x2332d9[_0x6c98('0x32')]=_['intersection'](_0x2332d9[_0x6c98('0x27')],_0x2332d9['query']);_0x288dc1[_0x6c98('0x2b')]=_['intersection'](_0x2332d9[_0x6c98('0x27')],qs[_0x6c98('0x2c')](_0x39d442[_0x6c98('0x28')][_0x6c98('0x2c')]));_0x288dc1[_0x6c98('0x2b')]=_0x288dc1['attributes'][_0x6c98('0x2d')]?_0x288dc1[_0x6c98('0x2b')]:_0x2332d9['model'];if(_0x39d442['query']['includeAll']){_0x288dc1['include']=[{'all':!![]}];}_0x288dc1=_[_0x6c98('0x35')]({},_0x288dc1,_0x39d442['options']);return db['SquareOdbc'][_0x6c98('0x3d')](_0x288dc1)[_0x6c98('0x20')](handleEntityNotFound(_0x3b6e7a,null))[_0x6c98('0x20')](respondWithResult(_0x3b6e7a,null))[_0x6c98('0x3e')](handleError(_0x3b6e7a,null));};exports[_0x6c98('0x3f')]=function(_0x457b3a,_0x551c8e){return db[_0x6c98('0x25')][_0x6c98('0x3f')](_0x457b3a[_0x6c98('0x40')],{})[_0x6c98('0x20')](respondWithResult(_0x551c8e,0xc9))[_0x6c98('0x3e')](handleError(_0x551c8e,null));};exports[_0x6c98('0x1f')]=function(_0x269dac,_0x26435d){if(_0x269dac['body']['id']){delete _0x269dac['body']['id'];}return db[_0x6c98('0x25')][_0x6c98('0x3d')]({'where':{'id':_0x269dac['params']['id']}})['then'](handleEntityNotFound(_0x26435d,null))['then'](saveUpdates(_0x269dac[_0x6c98('0x40')],null))['then'](respondWithResult(_0x26435d,null))['catch'](handleError(_0x26435d,null));};exports[_0x6c98('0x21')]=function(_0x5bd587,_0x135f2d){return db[_0x6c98('0x25')][_0x6c98('0x3d')]({'where':{'id':_0x5bd587['params']['id']}})['then'](handleEntityNotFound(_0x135f2d,null))[_0x6c98('0x20')](removeEntity(_0x135f2d,null))[_0x6c98('0x3e')](handleError(_0x135f2d,null));};exports[_0x6c98('0x41')]=function(_0x22e8be,_0x6c0586,_0xa1ea9a){var _0x15eb1f;return db[_0x6c98('0x25')][_0x6c98('0x3d')]({'where':{'id':_0x22e8be['params']['id']},'attributes':['id',_0x6c98('0x42')]})[_0x6c98('0x20')](handleEntityNotFound(_0x6c0586,null))[_0x6c98('0x20')](function(_0x40d492){if(_0x40d492){var _0xb16b8=require(_0x6c98('0x43'))();_0xb16b8[_0x6c98('0x44')](_0x40d492[_0x6c98('0x42')]);_0xb16b8[_0x6c98('0x45')]();return _0x40d492;}})[_0x6c98('0x20')](respondWithResult(_0x6c0586,null))['catch'](handleError(_0x6c0586,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b74ac85..2dc717f 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 _0x2dae=['moment','bluebird','request-promise','exports','define','square_odbc','lodash','../../config/logger','api'];(function(_0x25cc4b,_0x10fa52){var _0x54f64a=function(_0x4d911a){while(--_0x4d911a){_0x25cc4b['push'](_0x25cc4b['shift']());}};_0x54f64a(++_0x10fa52);}(_0x2dae,0xc3));var _0xe2da=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x2dae[_0x5d07ff];return _0x5226ad;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var attributes=require('./squareOdbc.attributes');module[_0xe2da('0x6')]=function(_0x439b5d,_0x77e45e){return _0x439b5d[_0xe2da('0x7')]('SquareOdbc',attributes,{'tableName':_0xe2da('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7a=['square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x47a050,_0x194e3d){var _0x4efcea=function(_0x28ef86){while(--_0x28ef86){_0x47a050['push'](_0x47a050['shift']());}};_0x4efcea(++_0x194e3d);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x4f26c4,_0x36c078){_0x4f26c4=_0x4f26c4-0x0;var _0x542dd4=_0x6f7a[_0x4f26c4];return _0x542dd4;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var attributes=require(_0xa6f7('0x6'));module[_0xa6f7('0x7')]=function(_0x22e529,_0x1f5922){return _0x22e529[_0xa6f7('0x8')](_0xa6f7('0x9'),attributes,{'tableName':_0xa6f7('0xa'),'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 12f30b0..7a8f536 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 _0x5ff2=['find','options','raw','where','attributes','map','model','include','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','ShowSquareOdbc','SquareOdbc'];(function(_0xf20b6,_0x49ddbb){var _0x4ff567=function(_0x3ccc7f){while(--_0x3ccc7f){_0xf20b6['push'](_0xf20b6['shift']());}};_0x4ff567(++_0x49ddbb);}(_0x5ff2,0xe8));var _0x25ff=function(_0x4a002e,_0x14a5f6){_0x4a002e=_0x4a002e-0x0;var _0xb86ae3=_0x5ff2[_0x4a002e];return _0xb86ae3;};'use strict';var _=require(_0x25ff('0x0'));var util=require(_0x25ff('0x1'));var moment=require(_0x25ff('0x2'));var BPromise=require(_0x25ff('0x3'));var rs=require(_0x25ff('0x4'));var fs=require('fs');var db=require(_0x25ff('0x5'))['db'];var utils=require(_0x25ff('0x6'));var logger=require('../../config/logger')(_0x25ff('0x7'));var config=require(_0x25ff('0x8'));var jayson=require(_0x25ff('0x9'));var client=jayson['client'][_0x25ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6462,_0x4fe603,_0x97a2fc){return new BPromise(function(_0x160eae,_0x3f1bba){return client[_0x25ff('0xb')](_0x4a6462,_0x97a2fc)[_0x25ff('0xc')](function(_0x2b228b){logger[_0x25ff('0xd')](_0x25ff('0xe'),_0x4fe603,'request\x20sent');logger[_0x25ff('0xf')](_0x25ff('0x10'),_0x4fe603,'request\x20sent',JSON[_0x25ff('0x11')](_0x2b228b));if(_0x2b228b[_0x25ff('0x12')]){if(_0x2b228b['error']['code']===0x1f4){logger['error'](_0x25ff('0xe'),_0x4fe603,_0x2b228b[_0x25ff('0x12')][_0x25ff('0x13')]);return _0x3f1bba(_0x2b228b[_0x25ff('0x12')][_0x25ff('0x13')]);}logger[_0x25ff('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x4fe603,_0x2b228b[_0x25ff('0x12')]['message']);return _0x160eae(_0x2b228b['error']['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x4fe603,_0x25ff('0x14'));_0x160eae(_0x2b228b['result'][_0x25ff('0x13')]);}})[_0x25ff('0x15')](function(_0x4b3ba7){logger[_0x25ff('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x4fe603,_0x4b3ba7);_0x3f1bba(_0x4b3ba7);});});}exports[_0x25ff('0x16')]=function(_0x42b1df){var _0x14472d=this;return new Promise(function(_0x3c3b6a,_0xaa8724){return db[_0x25ff('0x17')][_0x25ff('0x18')]({'raw':_0x42b1df[_0x25ff('0x19')]?_0x42b1df[_0x25ff('0x19')][_0x25ff('0x1a')]===undefined?!![]:![]:!![],'where':_0x42b1df[_0x25ff('0x19')]?_0x42b1df[_0x25ff('0x19')][_0x25ff('0x1b')]||null:null,'attributes':_0x42b1df[_0x25ff('0x19')]?_0x42b1df['options'][_0x25ff('0x1c')]||null:null,'include':_0x42b1df['options']?_0x42b1df[_0x25ff('0x19')]['include']?_[_0x25ff('0x1d')](_0x42b1df[_0x25ff('0x19')]['include'],function(_0x3c9954){return{'model':db[_0x3c9954[_0x25ff('0x1e')]],'as':_0x3c9954['as'],'attributes':_0x3c9954[_0x25ff('0x1c')],'include':_0x3c9954[_0x25ff('0x1f')]?_[_0x25ff('0x1d')](_0x3c9954[_0x25ff('0x1f')],function(_0x311be5){return{'model':db[_0x311be5['model']],'as':_0x311be5['as'],'attributes':_0x311be5[_0x25ff('0x1c')],'include':_0x311be5[_0x25ff('0x1f')]?_[_0x25ff('0x1d')](_0x311be5[_0x25ff('0x1f')],function(_0x428377){return{'model':db[_0x428377[_0x25ff('0x1e')]],'as':_0x428377['as'],'attributes':_0x428377[_0x25ff('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x25ff('0xc')](function(_0x596a96){logger[_0x25ff('0xd')](_0x25ff('0x16'),_0x42b1df);logger[_0x25ff('0xf')](_0x25ff('0x16'),_0x42b1df,JSON[_0x25ff('0x11')](_0x596a96));_0x3c3b6a(_0x596a96);})['catch'](function(_0x588610){logger['error']('ShowSquareOdbc',_0x588610[_0x25ff('0x13')],_0x42b1df);_0xaa8724(_0x14472d[_0x25ff('0x12')](0x1f4,_0x588610[_0x25ff('0x13')]));});});}; \ No newline at end of file +var _0x7392=['include','map','model','info','debug','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareOdbc','SquareOdbc','options','attributes'];(function(_0x3fc9d,_0x75d0dc){var _0x47fe8a=function(_0xf1e3d0){while(--_0xf1e3d0){_0x3fc9d['push'](_0x3fc9d['shift']());}};_0x47fe8a(++_0x75d0dc);}(_0x7392,0x13c));var _0x2739=function(_0x158e8c,_0x3b9f06){_0x158e8c=_0x158e8c-0x0;var _0x115707=_0x7392[_0x158e8c];return _0x115707;};'use strict';var _=require(_0x2739('0x0'));var util=require(_0x2739('0x1'));var moment=require(_0x2739('0x2'));var BPromise=require(_0x2739('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x2739('0x4'))['db'];var utils=require(_0x2739('0x5'));var logger=require(_0x2739('0x6'))(_0x2739('0x7'));var config=require(_0x2739('0x8'));var jayson=require(_0x2739('0x9'));var client=jayson[_0x2739('0xa')][_0x2739('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x266579,_0x493912,_0x53eda0){return new BPromise(function(_0x276fd3,_0xbcbb0c){return client['request'](_0x266579,_0x53eda0)[_0x2739('0xc')](function(_0x32a93d){logger['info'](_0x2739('0xd'),_0x493912,_0x2739('0xe'));logger['debug'](_0x2739('0xf'),_0x493912,_0x2739('0xe'),JSON[_0x2739('0x10')](_0x32a93d));if(_0x32a93d[_0x2739('0x11')]){if(_0x32a93d[_0x2739('0x11')][_0x2739('0x12')]===0x1f4){logger[_0x2739('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x493912,_0x32a93d[_0x2739('0x11')][_0x2739('0x13')]);return _0xbcbb0c(_0x32a93d[_0x2739('0x11')][_0x2739('0x13')]);}logger[_0x2739('0x11')](_0x2739('0xd'),_0x493912,_0x32a93d['error'][_0x2739('0x13')]);return _0x276fd3(_0x32a93d[_0x2739('0x11')][_0x2739('0x13')]);}else{logger['info'](_0x2739('0xd'),_0x493912,_0x2739('0xe'));_0x276fd3(_0x32a93d[_0x2739('0x14')][_0x2739('0x13')]);}})['catch'](function(_0x1a546d){logger[_0x2739('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x493912,_0x1a546d);_0xbcbb0c(_0x1a546d);});});}exports[_0x2739('0x15')]=function(_0x4b476c){var _0x4cdc14=this;return new Promise(function(_0x3fcb7a,_0x1d0d54){return db[_0x2739('0x16')]['find']({'raw':_0x4b476c[_0x2739('0x17')]?_0x4b476c[_0x2739('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4b476c[_0x2739('0x17')]?_0x4b476c[_0x2739('0x17')]['where']||null:null,'attributes':_0x4b476c[_0x2739('0x17')]?_0x4b476c[_0x2739('0x17')][_0x2739('0x18')]||null:null,'include':_0x4b476c[_0x2739('0x17')]?_0x4b476c[_0x2739('0x17')][_0x2739('0x19')]?_[_0x2739('0x1a')](_0x4b476c[_0x2739('0x17')][_0x2739('0x19')],function(_0x4593ab){return{'model':db[_0x4593ab[_0x2739('0x1b')]],'as':_0x4593ab['as'],'attributes':_0x4593ab[_0x2739('0x18')],'include':_0x4593ab['include']?_[_0x2739('0x1a')](_0x4593ab[_0x2739('0x19')],function(_0x57951d){return{'model':db[_0x57951d[_0x2739('0x1b')]],'as':_0x57951d['as'],'attributes':_0x57951d['attributes'],'include':_0x57951d[_0x2739('0x19')]?_[_0x2739('0x1a')](_0x57951d[_0x2739('0x19')],function(_0xcd3987){return{'model':db[_0xcd3987['model']],'as':_0xcd3987['as'],'attributes':_0xcd3987['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x383157){logger[_0x2739('0x1c')](_0x2739('0x15'),_0x4b476c);logger[_0x2739('0x1d')](_0x2739('0x15'),_0x4b476c,JSON[_0x2739('0x10')](_0x383157));_0x3fcb7a(_0x383157);})[_0x2739('0x1e')](function(_0x4f8514){logger['error'](_0x2739('0x15'),_0x4f8514[_0x2739('0x13')],_0x4b476c);_0x1d0d54(_0x4cdc14[_0x2739('0x11')](0x1f4,_0x4f8514[_0x2739('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f0546e4..f166957 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 _0x4d2e=['update','delete','destroy','/:id/users','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','getUsers','post','addUsers','put'];(function(_0x430084,_0x1af305){var _0x297e70=function(_0x48a54a){while(--_0x48a54a){_0x430084['push'](_0x430084['shift']());}};_0x297e70(++_0x1af305);}(_0x4d2e,0x1d1));var _0xe4d2=function(_0x2ae67a,_0x26b160){_0x2ae67a=_0x2ae67a-0x0;var _0x118b12=_0x4d2e[_0x2ae67a];return _0x118b12;};'use strict';var multer=require(_0xe4d2('0x0'));var util=require(_0xe4d2('0x1'));var path=require('path');var express=require(_0xe4d2('0x2'));var router=express[_0xe4d2('0x3')]();var auth=require(_0xe4d2('0x4'));var interaction=require(_0xe4d2('0x5'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe4d2('0x6')]);router[_0xe4d2('0x7')](_0xe4d2('0x8'),auth[_0xe4d2('0x9')](),controller[_0xe4d2('0xa')]);router[_0xe4d2('0x7')]('/:id/users',auth[_0xe4d2('0x9')](),controller[_0xe4d2('0xb')]);router['post']('/',auth[_0xe4d2('0x9')](),controller['create']);router[_0xe4d2('0xc')]('/:id/users',auth[_0xe4d2('0x9')](),controller[_0xe4d2('0xd')]);router[_0xe4d2('0xe')]('/:id',auth[_0xe4d2('0x9')](),controller[_0xe4d2('0xf')]);router[_0xe4d2('0x10')](_0xe4d2('0x8'),auth[_0xe4d2('0x9')](),controller[_0xe4d2('0x11')]);router[_0xe4d2('0x10')](_0xe4d2('0x12'),auth[_0xe4d2('0x9')](),controller['removeUsers']);module[_0xe4d2('0x13')]=router; \ No newline at end of file +var _0x1b3a=['put','update','delete','/:id','destroy','removeUsers','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','create','post'];(function(_0x4a4532,_0x27b3f0){var _0x305eaf=function(_0x4c0d57){while(--_0x4c0d57){_0x4a4532['push'](_0x4a4532['shift']());}};_0x305eaf(++_0x27b3f0);}(_0x1b3a,0x16c));var _0xa1b3=function(_0x487bef,_0x4e1291){_0x487bef=_0x487bef-0x0;var _0x59fb06=_0x1b3a[_0x487bef];return _0x59fb06;};'use strict';var multer=require(_0xa1b3('0x0'));var util=require(_0xa1b3('0x1'));var path=require('path');var express=require(_0xa1b3('0x2'));var router=express[_0xa1b3('0x3')]();var auth=require(_0xa1b3('0x4'));var interaction=require(_0xa1b3('0x5'));var config=require('../../config/environment');var controller=require(_0xa1b3('0x6'));router[_0xa1b3('0x7')]('/',auth[_0xa1b3('0x8')](),controller[_0xa1b3('0x9')]);router[_0xa1b3('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa1b3('0xa')]);router[_0xa1b3('0x7')](_0xa1b3('0xb'),auth[_0xa1b3('0x8')](),controller['getUsers']);router['post']('/',auth[_0xa1b3('0x8')](),controller[_0xa1b3('0xc')]);router[_0xa1b3('0xd')](_0xa1b3('0xb'),auth[_0xa1b3('0x8')](),controller['addUsers']);router[_0xa1b3('0xe')]('/:id',auth[_0xa1b3('0x8')](),controller[_0xa1b3('0xf')]);router[_0xa1b3('0x10')](_0xa1b3('0x11'),auth[_0xa1b3('0x8')](),controller[_0xa1b3('0x12')]);router[_0xa1b3('0x10')]('/:id/users',auth[_0xa1b3('0x8')](),controller[_0xa1b3('0x13')]);module[_0xa1b3('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 8ca9e6a..40e189d 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 _0x6eec=['sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production'];(function(_0x1d7d52,_0x2fba4c){var _0x486d10=function(_0x57e587){while(--_0x57e587){_0x1d7d52['push'](_0x1d7d52['shift']());}};_0x486d10(++_0x2fba4c);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc6ee('0x0'));module[_0xc6ee('0x1')]={'name':{'type':Sequelize[_0xc6ee('0x2')],'unique':_0xc6ee('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xc6ee('0x4')]},'preproduction':{'type':Sequelize[_0xc6ee('0x5')]('long'),'get':function(){if(this[_0xc6ee('0x6')](_0xc6ee('0x7'))){return this[_0xc6ee('0x6')](_0xc6ee('0x7'))[_0xc6ee('0x8')](_0xc6ee('0x9'));}}},'production':{'type':Sequelize[_0xc6ee('0x5')](_0xc6ee('0xa')),'get':function(){if(this[_0xc6ee('0x6')]('production')){return this['getDataValue'](_0xc6ee('0xb'))[_0xc6ee('0x8')]('utf8');}}}}; \ No newline at end of file +var _0x723e=['toString','utf8','production','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x65abff,_0x1c820c){var _0x48101a=function(_0x4d4f97){while(--_0x4d4f97){_0x65abff['push'](_0x65abff['shift']());}};_0x48101a(++_0x1c820c);}(_0x723e,0x179));var _0xe723=function(_0x5000e5,_0x1a2ed9){_0x5000e5=_0x5000e5-0x0;var _0x496c30=_0x723e[_0x5000e5];return _0x496c30;};'use strict';var Sequelize=require('sequelize');module[_0xe723('0x0')]={'name':{'type':Sequelize[_0xe723('0x1')],'unique':_0xe723('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xe723('0x1')]},'notes':{'type':Sequelize[_0xe723('0x3')]},'preproduction':{'type':Sequelize[_0xe723('0x4')](_0xe723('0x5')),'get':function(){if(this[_0xe723('0x6')](_0xe723('0x7'))){return this[_0xe723('0x6')]('preproduction')[_0xe723('0x8')](_0xe723('0x9'));}}},'production':{'type':Sequelize[_0xe723('0x4')](_0xe723('0x5')),'get':function(){if(this[_0xe723('0x6')](_0xe723('0xa'))){return this[_0xe723('0x6')](_0xe723('0xa'))['toString'](_0xe723('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2dfd242..541ddb3 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 _0x9eb1=['filter','map','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','pick','nolimit','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','SquareProject','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','add','day','merge'];(function(_0x58ee44,_0x18af5e){var _0x368152=function(_0x337460){while(--_0x337460){_0x58ee44['push'](_0x58ee44['shift']());}};_0x368152(++_0x18af5e);}(_0x9eb1,0x65));var _0x19eb=function(_0x4cc642,_0x2838e2){_0x4cc642=_0x4cc642-0x0;var _0x24ea52=_0x9eb1[_0x4cc642];return _0x24ea52;};'use strict';var jsonpatch=require(_0x19eb('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x19eb('0x1'));var Mustache=require(_0x19eb('0x2'));var util=require('util');var path=require('path');var sox=require(_0x19eb('0x3'));var csv=require(_0x19eb('0x4'));var ejs=require(_0x19eb('0x5'));var fs=require('fs');var _=require(_0x19eb('0x6'));var squel=require(_0x19eb('0x7'));var crypto=require(_0x19eb('0x8'));var jsforce=require(_0x19eb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x19eb('0x4'));var querystring=require('querystring');var Papa=require(_0x19eb('0xa'));var qs=require(_0x19eb('0xb'));var logger=require('../../config/logger')(_0x19eb('0xc'));var utils=require(_0x19eb('0xd'));var config=require(_0x19eb('0xe'));var db=require(_0x19eb('0xf'))['db'];var socket=require(_0x19eb('0x10'))({'host':_0x19eb('0x11'),'port':0x18eb});require(_0x19eb('0x12'))[_0x19eb('0x13')](socket);function respondWithStatusCode(_0x529451,_0x11aab2){_0x11aab2=_0x11aab2||0xcc;return function(_0x577870){if(_0x577870){return _0x529451[_0x19eb('0x14')](_0x11aab2);}return _0x529451[_0x19eb('0x15')](_0x11aab2)[_0x19eb('0x16')]();};}function respondWithResult(_0x25cda9,_0x5a38bd){_0x5a38bd=_0x5a38bd||0xc8;return function(_0x1308cd){if(_0x1308cd){return _0x25cda9[_0x19eb('0x15')](_0x5a38bd)[_0x19eb('0x17')](_0x1308cd);}};}function respondWithFilteredResult(_0x385e69,_0x35463c){return function(_0x556f86){if(_0x556f86){var _0x406873=_0x556f86['count'],_0x2219e9=_0x35463c[_0x19eb('0x18')],_0x5b123a=_0x35463c[_0x19eb('0x18')]+_0x35463c[_0x19eb('0x19')],_0x34c201;if(_0x5b123a>=_0x406873){_0x5b123a=_0x406873;_0x34c201=0xc8;}else{_0x34c201=0xce;}_0x385e69[_0x19eb('0x15')](_0x34c201);return _0x385e69['set'](_0x19eb('0x1a'),_0x2219e9+'-'+_0x5b123a+'/'+_0x406873)[_0x19eb('0x17')](_0x556f86);}return null;};}function patchUpdates(_0x2ab85c){return function(_0x5b702e){try{jsonpatch[_0x19eb('0x1b')](_0x5b702e,_0x2ab85c,!![]);}catch(_0x1b4086){return BPromise[_0x19eb('0x1c')](_0x1b4086);}return _0x5b702e[_0x19eb('0x1d')]();};}function saveUpdates(_0x1988ac,_0x127d0b){return function(_0x29d011){if(_0x29d011){return _0x29d011[_0x19eb('0x1e')](_0x1988ac)[_0x19eb('0x1f')](function(_0x494190){return _0x494190;});}return null;};}function removeEntity(_0x5a1dbd,_0x271575){return function(_0x2e44fd){if(_0x2e44fd){return _0x2e44fd[_0x19eb('0x20')]()['then'](function(){_0x5a1dbd[_0x19eb('0x15')](0xcc)[_0x19eb('0x16')]();});}};}function handleEntityNotFound(_0x4062e8,_0x38aff0){return function(_0x1c44c0){if(!_0x1c44c0){_0x4062e8[_0x19eb('0x14')](0x194);}return _0x1c44c0;};}function handleError(_0x31499d,_0x29ad51){_0x29ad51=_0x29ad51||0x1f4;return function(_0xc1a928){logger[_0x19eb('0x21')](_0xc1a928[_0x19eb('0x22')]);if(_0xc1a928[_0x19eb('0x23')]){delete _0xc1a928[_0x19eb('0x23')];}_0x31499d[_0x19eb('0x15')](_0x29ad51)['send'](_0xc1a928);};}exports[_0x19eb('0x24')]=function(_0xf28bd3,_0x1963d8){var _0x4fddfa={},_0x34fcc1={},_0x42bc38={'count':0x0,'rows':[]};var _0x4e25d8=db[_0x19eb('0x25')]['rawAttributes'];_0x34fcc1[_0x19eb('0x26')]=_[_0x19eb('0x27')](_0x4e25d8);var _0x3a6da0={'dateStart':_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x29')],'dateEnd':_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x2a')]};delete _0xf28bd3['query'][_0x19eb('0x29')];delete _0xf28bd3[_0x19eb('0x28')][_0x19eb('0x2a')];_0x34fcc1[_0x19eb('0x28')]=_[_0x19eb('0x27')](_0xf28bd3[_0x19eb('0x28')]);_0x34fcc1['filters']=_[_0x19eb('0x2b')](_0x34fcc1[_0x19eb('0x26')],_0x34fcc1[_0x19eb('0x28')]);_0x4fddfa['attributes']=_[_0x19eb('0x2b')](_0x34fcc1[_0x19eb('0x26')],qs['fields'](_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x2c')]));_0x4fddfa[_0x19eb('0x2d')]=_0x4fddfa['attributes'][_0x19eb('0x2e')]?_0x4fddfa[_0x19eb('0x2d')]:_0x34fcc1['model'];if(!_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x2f')]('nolimit')){_0x4fddfa[_0x19eb('0x19')]=qs['limit'](_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x19')]);_0x4fddfa['offset']=qs['offset'](_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x18')]);}_0x4fddfa[_0x19eb('0x30')]=qs[_0x19eb('0x31')](_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x31')]);_0x4fddfa[_0x19eb('0x32')]=qs[_0x19eb('0x33')](_['pick'](_0xf28bd3[_0x19eb('0x28')],_0x34fcc1[_0x19eb('0x33')]));if(_0x3a6da0['dateStart']){if(_0x3a6da0[_0x19eb('0x2a')]){_0x3a6da0[_0x19eb('0x2a')]=moment(_0x3a6da0['dateEnd'])[_0x19eb('0x34')](0x1,_0x19eb('0x35'));}else{_0x3a6da0[_0x19eb('0x2a')]=moment(_0x3a6da0[_0x19eb('0x29')])[_0x19eb('0x34')](0x1,_0x19eb('0x35'));}_[_0x19eb('0x36')](_0x4fddfa[_0x19eb('0x32')],{'createdAt':{'$gte':_0x3a6da0[_0x19eb('0x29')],'$lte':_0x3a6da0[_0x19eb('0x2a')]}});}if(_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x37')]){_0x4fddfa[_0x19eb('0x32')]=_[_0x19eb('0x36')](_0x4fddfa[_0x19eb('0x32')],{'$or':_[_0x19eb('0x38')](_0x4fddfa['attributes'],function(_0x479bb2){var _0x20c33f={};_0x20c33f[_0x479bb2]={'$like':'%'+_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x37')]+'%'};return _0x20c33f;})});}_0x4fddfa=_[_0x19eb('0x36')]({},_0x4fddfa,_0xf28bd3[_0x19eb('0x39')]);var _0x3daebb={'where':_0x4fddfa['where']};return db[_0x19eb('0x25')]['count'](_0x3daebb)[_0x19eb('0x1f')](function(_0x1afeae){_0x42bc38[_0x19eb('0x3a')]=_0x1afeae;if(_0xf28bd3[_0x19eb('0x28')][_0x19eb('0x3b')]){_0x4fddfa[_0x19eb('0x3c')]=[{'all':!![]}];}return db[_0x19eb('0x25')][_0x19eb('0x3d')](_0x4fddfa);})[_0x19eb('0x1f')](function(_0x70585d){_0x42bc38[_0x19eb('0x3e')]=_0x70585d;return _0x42bc38;})['then'](respondWithFilteredResult(_0x1963d8,_0x4fddfa))[_0x19eb('0x3f')](handleError(_0x1963d8,null));};exports['show']=function(_0x116203,_0x3ec66b){var _0x576e40={'raw':![],'where':{'id':_0x116203[_0x19eb('0x40')]['id']}},_0xde1848={};_0xde1848[_0x19eb('0x26')]=_['keys'](db['SquareProject'][_0x19eb('0x41')]);_0xde1848[_0x19eb('0x28')]=_['keys'](_0x116203[_0x19eb('0x28')]);_0xde1848['filters']=_[_0x19eb('0x2b')](_0xde1848[_0x19eb('0x26')],_0xde1848[_0x19eb('0x28')]);_0x576e40[_0x19eb('0x2d')]=_['intersection'](_0xde1848[_0x19eb('0x26')],qs['fields'](_0x116203['query'][_0x19eb('0x2c')]));_0x576e40[_0x19eb('0x2d')]=_0x576e40[_0x19eb('0x2d')][_0x19eb('0x2e')]?_0x576e40[_0x19eb('0x2d')]:_0xde1848[_0x19eb('0x26')];if(_0x116203['query']['includeAll']){_0x576e40[_0x19eb('0x3c')]=[{'all':!![]}];}_0x576e40=_[_0x19eb('0x36')]({},_0x576e40,_0x116203[_0x19eb('0x39')]);return db[_0x19eb('0x25')][_0x19eb('0x42')](_0x576e40)[_0x19eb('0x1f')](handleEntityNotFound(_0x3ec66b,null))[_0x19eb('0x1f')](respondWithResult(_0x3ec66b,null))['catch'](handleError(_0x3ec66b,null));};exports['create']=function(_0x5143b1,_0x39bd08){return db[_0x19eb('0x25')][_0x19eb('0x43')](_0x5143b1['body'],{})[_0x19eb('0x1f')](respondWithResult(_0x39bd08,0xc9))[_0x19eb('0x3f')](handleError(_0x39bd08,null));};exports[_0x19eb('0x1e')]=function(_0x1e15f8,_0x3523e3){if(_0x1e15f8[_0x19eb('0x44')]['id']){delete _0x1e15f8[_0x19eb('0x44')]['id'];}return db[_0x19eb('0x25')][_0x19eb('0x42')]({'where':{'id':_0x1e15f8['params']['id']}})[_0x19eb('0x1f')](handleEntityNotFound(_0x3523e3,null))['then'](saveUpdates(_0x1e15f8[_0x19eb('0x44')],null))[_0x19eb('0x1f')](respondWithResult(_0x3523e3,null))['catch'](handleError(_0x3523e3,null));};exports[_0x19eb('0x20')]=function(_0x2930a8,_0x596159){return db[_0x19eb('0x25')][_0x19eb('0x42')]({'where':{'id':_0x2930a8[_0x19eb('0x40')]['id']}})['then'](handleEntityNotFound(_0x596159,null))[_0x19eb('0x1f')](removeEntity(_0x596159,null))[_0x19eb('0x3f')](handleError(_0x596159,null));};exports[_0x19eb('0x45')]=function(_0x8f17e6,_0x52a654,_0x40c710){return db[_0x19eb('0x25')][_0x19eb('0x42')]({'where':{'id':_0x8f17e6[_0x19eb('0x40')]['id']}})[_0x19eb('0x1f')](handleEntityNotFound(_0x52a654,null))['then'](function(_0x2a77a3){if(_0x2a77a3){return _0x2a77a3[_0x19eb('0x45')](_0x8f17e6[_0x19eb('0x44')][_0x19eb('0x46')],_[_0x19eb('0x47')](_0x8f17e6[_0x19eb('0x44')],[_0x19eb('0x46'),'id'])||{});}})[_0x19eb('0x1f')](respondWithResult(_0x52a654,null))[_0x19eb('0x3f')](handleError(_0x52a654,null));};exports[_0x19eb('0x48')]=function(_0xa15eec,_0x591737,_0x2b78de){var _0x539462;return db[_0x19eb('0x25')][_0x19eb('0x42')]({'where':{'id':_0xa15eec[_0x19eb('0x40')]['id']}})[_0x19eb('0x1f')](handleEntityNotFound(_0x591737,null))['then'](function(_0x46b41a){if(_0x46b41a){return _0x46b41a[_0x19eb('0x48')](_0xa15eec[_0x19eb('0x28')][_0x19eb('0x46')])['then'](function(_0x18da9b){if(_['isArray'](_0xa15eec[_0x19eb('0x28')][_0x19eb('0x46')])){for(var _0x56d6df=0x0;_0x56d6df<_0xa15eec[_0x19eb('0x28')][_0x19eb('0x46')][_0x19eb('0x2e')];_0x56d6df+=0x1){socket[_0x19eb('0x49')](_0x19eb('0x4a'),{'UserId':_0xa15eec['query'][_0x19eb('0x46')][_0x56d6df],'SquareProjectId':_0xa15eec[_0x19eb('0x40')]['id']});}}else{socket[_0x19eb('0x49')](_0x19eb('0x4a'),{'UserId':_0xa15eec[_0x19eb('0x28')]['ids'],'SquareProjectId':_0xa15eec[_0x19eb('0x40')]['id']});}});}})[_0x19eb('0x1f')](respondWithStatusCode(_0x591737,null))[_0x19eb('0x3f')](handleError(_0x591737,null));};exports[_0x19eb('0x4b')]=function(_0x545c8b,_0x1e0d86,_0x49e3e0){var _0x355e32={};var _0x37eefc={};var _0x3a6770;var _0x3eed62;return db[_0x19eb('0x25')]['findOne']({'where':{'id':_0x545c8b['params']['id']}})[_0x19eb('0x1f')](handleEntityNotFound(_0x1e0d86,null))[_0x19eb('0x1f')](function(_0x57ee84){if(_0x57ee84){_0x3a6770=_0x57ee84;_0x37eefc[_0x19eb('0x26')]=_[_0x19eb('0x27')](db['User'][_0x19eb('0x41')]);_0x37eefc[_0x19eb('0x28')]=_[_0x19eb('0x27')](_0x545c8b[_0x19eb('0x28')]);_0x37eefc[_0x19eb('0x33')]=_[_0x19eb('0x2b')](_0x37eefc[_0x19eb('0x26')],_0x37eefc['query']);_0x355e32['attributes']=_[_0x19eb('0x2b')](_0x37eefc[_0x19eb('0x26')],qs[_0x19eb('0x2c')](_0x545c8b['query'][_0x19eb('0x2c')]));_0x355e32[_0x19eb('0x2d')]=_0x355e32[_0x19eb('0x2d')]['length']?_0x355e32[_0x19eb('0x2d')]:_0x37eefc[_0x19eb('0x26')];_0x355e32[_0x19eb('0x30')]=qs['sort'](_0x545c8b['query']['sort']);_0x355e32['where']=qs['filters'](_[_0x19eb('0x4c')](_0x545c8b['query'],_0x37eefc[_0x19eb('0x33')]));if(_0x545c8b[_0x19eb('0x28')][_0x19eb('0x37')]){_0x355e32[_0x19eb('0x32')]=_[_0x19eb('0x36')](_0x355e32[_0x19eb('0x32')],{'$or':_[_0x19eb('0x38')](_0x355e32[_0x19eb('0x2d')],function(_0xdd2b87){var _0x222462={};_0x222462[_0xdd2b87]={'$like':'%'+_0x545c8b[_0x19eb('0x28')][_0x19eb('0x37')]+'%'};return _0x222462;})});}_0x355e32=_[_0x19eb('0x36')]({},_0x355e32,_0x545c8b['options']);return _0x3a6770[_0x19eb('0x4b')](_0x355e32);}})[_0x19eb('0x1f')](function(_0xb0cc20){if(_0xb0cc20){_0x3eed62=_0xb0cc20[_0x19eb('0x2e')];if(!_0x545c8b[_0x19eb('0x28')]['hasOwnProperty'](_0x19eb('0x4d'))){_0x355e32['limit']=qs[_0x19eb('0x19')](_0x545c8b[_0x19eb('0x28')]['limit']);_0x355e32[_0x19eb('0x18')]=qs['offset'](_0x545c8b[_0x19eb('0x28')][_0x19eb('0x18')]);}return _0x3a6770[_0x19eb('0x4b')](_0x355e32);}})[_0x19eb('0x1f')](function(_0xcbdfef){if(_0xcbdfef){return _0xcbdfef?{'count':_0x3eed62,'rows':_0xcbdfef}:null;}})['then'](respondWithResult(_0x1e0d86,null))[_0x19eb('0x3f')](handleError(_0x1e0d86,null));}; \ No newline at end of file +var _0xc689=['api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./squareProject.socket','register','sendStatus','status','offset','set','json','save','update','then','destroy','end','name','index','SquareProject','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','filter','map','merge','options','count','includeAll','include','findAll','rows','show','catch','create','body','find','params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../config/logger'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xc689,0x90));var _0x9c68=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xc689[_0x46efd7];return _0x5637e4;};'use strict';var jsonpatch=require(_0x9c68('0x0'));var rp=require(_0x9c68('0x1'));var moment=require(_0x9c68('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9c68('0x3'));var util=require(_0x9c68('0x4'));var path=require(_0x9c68('0x5'));var sox=require(_0x9c68('0x6'));var csv=require('to-csv');var ejs=require(_0x9c68('0x7'));var fs=require('fs');var _=require(_0x9c68('0x8'));var squel=require(_0x9c68('0x9'));var crypto=require(_0x9c68('0xa'));var jsforce=require(_0x9c68('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9c68('0xc'));var querystring=require(_0x9c68('0xd'));var Papa=require('papaparse');var qs=require(_0x9c68('0xe'));var logger=require(_0x9c68('0xf'))(_0x9c68('0x10'));var utils=require('../../config/utils');var config=require(_0x9c68('0x11'));var db=require(_0x9c68('0x12'))['db'];var socket=require(_0x9c68('0x13'))({'host':_0x9c68('0x14'),'port':0x18eb});require(_0x9c68('0x15'))[_0x9c68('0x16')](socket);function respondWithStatusCode(_0x473669,_0x1eb4a1){_0x1eb4a1=_0x1eb4a1||0xcc;return function(_0x264e06){if(_0x264e06){return _0x473669[_0x9c68('0x17')](_0x1eb4a1);}return _0x473669[_0x9c68('0x18')](_0x1eb4a1)['end']();};}function respondWithResult(_0x19d251,_0xd508a5){_0xd508a5=_0xd508a5||0xc8;return function(_0x26eff8){if(_0x26eff8){return _0x19d251[_0x9c68('0x18')](_0xd508a5)['json'](_0x26eff8);}};}function respondWithFilteredResult(_0x57ada2,_0x269d98){return function(_0x4bb769){if(_0x4bb769){var _0x47e791=_0x4bb769['count'],_0x38b853=_0x269d98[_0x9c68('0x19')],_0x1c501b=_0x269d98[_0x9c68('0x19')]+_0x269d98['limit'],_0x8a3dc7;if(_0x1c501b>=_0x47e791){_0x1c501b=_0x47e791;_0x8a3dc7=0xc8;}else{_0x8a3dc7=0xce;}_0x57ada2[_0x9c68('0x18')](_0x8a3dc7);return _0x57ada2[_0x9c68('0x1a')]('Content-Range',_0x38b853+'-'+_0x1c501b+'/'+_0x47e791)[_0x9c68('0x1b')](_0x4bb769);}return null;};}function patchUpdates(_0x5cbfd7){return function(_0x4bc6b9){try{jsonpatch['apply'](_0x4bc6b9,_0x5cbfd7,!![]);}catch(_0x32c17b){return BPromise['reject'](_0x32c17b);}return _0x4bc6b9[_0x9c68('0x1c')]();};}function saveUpdates(_0x3926e4,_0x31681f){return function(_0x596efc){if(_0x596efc){return _0x596efc[_0x9c68('0x1d')](_0x3926e4)[_0x9c68('0x1e')](function(_0x5eb62e){return _0x5eb62e;});}return null;};}function removeEntity(_0x99afb6,_0x520be8){return function(_0x971e90){if(_0x971e90){return _0x971e90[_0x9c68('0x1f')]()['then'](function(){_0x99afb6['status'](0xcc)[_0x9c68('0x20')]();});}};}function handleEntityNotFound(_0x4f56c4,_0x13d898){return function(_0x595ca9){if(!_0x595ca9){_0x4f56c4[_0x9c68('0x17')](0x194);}return _0x595ca9;};}function handleError(_0x1dfa54,_0x1a9ab2){_0x1a9ab2=_0x1a9ab2||0x1f4;return function(_0x3f8727){logger['error'](_0x3f8727['stack']);if(_0x3f8727[_0x9c68('0x21')]){delete _0x3f8727['name'];}_0x1dfa54[_0x9c68('0x18')](_0x1a9ab2)['send'](_0x3f8727);};}exports[_0x9c68('0x22')]=function(_0x58e1df,_0x83b657){var _0x120a86={},_0x4dce82={},_0x4d7233={'count':0x0,'rows':[]};var _0x422594=db[_0x9c68('0x23')][_0x9c68('0x24')];_0x4dce82['model']=_['keys'](_0x422594);var _0x1564e9={'dateStart':_0x58e1df[_0x9c68('0x25')][_0x9c68('0x26')],'dateEnd':_0x58e1df[_0x9c68('0x25')][_0x9c68('0x27')]};delete _0x58e1df[_0x9c68('0x25')][_0x9c68('0x26')];delete _0x58e1df[_0x9c68('0x25')][_0x9c68('0x27')];_0x4dce82[_0x9c68('0x25')]=_[_0x9c68('0x28')](_0x58e1df[_0x9c68('0x25')]);_0x4dce82[_0x9c68('0x29')]=_[_0x9c68('0x2a')](_0x4dce82[_0x9c68('0x2b')],_0x4dce82['query']);_0x120a86[_0x9c68('0x2c')]=_[_0x9c68('0x2a')](_0x4dce82[_0x9c68('0x2b')],qs['fields'](_0x58e1df[_0x9c68('0x25')][_0x9c68('0x2d')]));_0x120a86[_0x9c68('0x2c')]=_0x120a86['attributes'][_0x9c68('0x2e')]?_0x120a86[_0x9c68('0x2c')]:_0x4dce82['model'];if(!_0x58e1df[_0x9c68('0x25')][_0x9c68('0x2f')](_0x9c68('0x30'))){_0x120a86[_0x9c68('0x31')]=qs[_0x9c68('0x31')](_0x58e1df[_0x9c68('0x25')][_0x9c68('0x31')]);_0x120a86[_0x9c68('0x19')]=qs[_0x9c68('0x19')](_0x58e1df[_0x9c68('0x25')][_0x9c68('0x19')]);}_0x120a86[_0x9c68('0x32')]=qs[_0x9c68('0x33')](_0x58e1df[_0x9c68('0x25')][_0x9c68('0x33')]);_0x120a86[_0x9c68('0x34')]=qs[_0x9c68('0x29')](_[_0x9c68('0x35')](_0x58e1df['query'],_0x4dce82[_0x9c68('0x29')]));if(_0x1564e9[_0x9c68('0x26')]){if(_0x1564e9['dateEnd']){_0x1564e9['dateEnd']=moment(_0x1564e9[_0x9c68('0x27')])[_0x9c68('0x36')](0x1,_0x9c68('0x37'));}else{_0x1564e9[_0x9c68('0x27')]=moment(_0x1564e9[_0x9c68('0x26')])[_0x9c68('0x36')](0x1,_0x9c68('0x37'));}_['merge'](_0x120a86[_0x9c68('0x34')],{'createdAt':{'$gte':_0x1564e9['dateStart'],'$lte':_0x1564e9['dateEnd']}});}if(_0x58e1df[_0x9c68('0x25')][_0x9c68('0x38')]){_0x120a86[_0x9c68('0x34')]=_['merge'](_0x120a86[_0x9c68('0x34')],{'$or':_[_0x9c68('0x39')](_0x120a86['attributes'],function(_0xde0f78){var _0x3c2e10={};_0x3c2e10[_0xde0f78]={'$like':'%'+_0x58e1df[_0x9c68('0x25')]['filter']+'%'};return _0x3c2e10;})});}_0x120a86=_[_0x9c68('0x3a')]({},_0x120a86,_0x58e1df[_0x9c68('0x3b')]);var _0x14e9e5={'where':_0x120a86['where']};return db[_0x9c68('0x23')][_0x9c68('0x3c')](_0x14e9e5)[_0x9c68('0x1e')](function(_0x3cb939){_0x4d7233[_0x9c68('0x3c')]=_0x3cb939;if(_0x58e1df['query'][_0x9c68('0x3d')]){_0x120a86[_0x9c68('0x3e')]=[{'all':!![]}];}return db[_0x9c68('0x23')][_0x9c68('0x3f')](_0x120a86);})['then'](function(_0x47c4b8){_0x4d7233[_0x9c68('0x40')]=_0x47c4b8;return _0x4d7233;})[_0x9c68('0x1e')](respondWithFilteredResult(_0x83b657,_0x120a86))['catch'](handleError(_0x83b657,null));};exports[_0x9c68('0x41')]=function(_0x2ca11f,_0x2b6671){var _0x1a8a93={'raw':![],'where':{'id':_0x2ca11f['params']['id']}},_0x1e4683={};_0x1e4683['model']=_['keys'](db[_0x9c68('0x23')]['rawAttributes']);_0x1e4683[_0x9c68('0x25')]=_[_0x9c68('0x28')](_0x2ca11f[_0x9c68('0x25')]);_0x1e4683[_0x9c68('0x29')]=_[_0x9c68('0x2a')](_0x1e4683[_0x9c68('0x2b')],_0x1e4683[_0x9c68('0x25')]);_0x1a8a93[_0x9c68('0x2c')]=_['intersection'](_0x1e4683[_0x9c68('0x2b')],qs[_0x9c68('0x2d')](_0x2ca11f[_0x9c68('0x25')]['fields']));_0x1a8a93['attributes']=_0x1a8a93[_0x9c68('0x2c')]['length']?_0x1a8a93[_0x9c68('0x2c')]:_0x1e4683[_0x9c68('0x2b')];if(_0x2ca11f[_0x9c68('0x25')][_0x9c68('0x3d')]){_0x1a8a93[_0x9c68('0x3e')]=[{'all':!![]}];}_0x1a8a93=_[_0x9c68('0x3a')]({},_0x1a8a93,_0x2ca11f[_0x9c68('0x3b')]);return db[_0x9c68('0x23')]['find'](_0x1a8a93)[_0x9c68('0x1e')](handleEntityNotFound(_0x2b6671,null))['then'](respondWithResult(_0x2b6671,null))[_0x9c68('0x42')](handleError(_0x2b6671,null));};exports[_0x9c68('0x43')]=function(_0x17b5f6,_0x11448d){return db[_0x9c68('0x23')][_0x9c68('0x43')](_0x17b5f6['body'],{})[_0x9c68('0x1e')](respondWithResult(_0x11448d,0xc9))['catch'](handleError(_0x11448d,null));};exports[_0x9c68('0x1d')]=function(_0x1898ba,_0x24f380){if(_0x1898ba[_0x9c68('0x44')]['id']){delete _0x1898ba[_0x9c68('0x44')]['id'];}return db[_0x9c68('0x23')][_0x9c68('0x45')]({'where':{'id':_0x1898ba[_0x9c68('0x46')]['id']}})[_0x9c68('0x1e')](handleEntityNotFound(_0x24f380,null))[_0x9c68('0x1e')](saveUpdates(_0x1898ba[_0x9c68('0x44')],null))[_0x9c68('0x1e')](respondWithResult(_0x24f380,null))[_0x9c68('0x42')](handleError(_0x24f380,null));};exports['destroy']=function(_0x28bedd,_0x1b85dc){return db['SquareProject']['find']({'where':{'id':_0x28bedd[_0x9c68('0x46')]['id']}})[_0x9c68('0x1e')](handleEntityNotFound(_0x1b85dc,null))[_0x9c68('0x1e')](removeEntity(_0x1b85dc,null))[_0x9c68('0x42')](handleError(_0x1b85dc,null));};exports[_0x9c68('0x47')]=function(_0x4fe559,_0x4e0563,_0x4feb8d){return db['SquareProject'][_0x9c68('0x45')]({'where':{'id':_0x4fe559[_0x9c68('0x46')]['id']}})[_0x9c68('0x1e')](handleEntityNotFound(_0x4e0563,null))[_0x9c68('0x1e')](function(_0x378cec){if(_0x378cec){return _0x378cec['addUsers'](_0x4fe559[_0x9c68('0x44')][_0x9c68('0x48')],_['omit'](_0x4fe559[_0x9c68('0x44')],[_0x9c68('0x48'),'id'])||{});}})[_0x9c68('0x1e')](respondWithResult(_0x4e0563,null))['catch'](handleError(_0x4e0563,null));};exports[_0x9c68('0x49')]=function(_0x3a86a7,_0x1c0f95,_0x50bc15){var _0x50a8a2;return db[_0x9c68('0x23')][_0x9c68('0x45')]({'where':{'id':_0x3a86a7[_0x9c68('0x46')]['id']}})[_0x9c68('0x1e')](handleEntityNotFound(_0x1c0f95,null))[_0x9c68('0x1e')](function(_0x1dc93d){if(_0x1dc93d){return _0x1dc93d[_0x9c68('0x49')](_0x3a86a7[_0x9c68('0x25')]['ids'])[_0x9c68('0x1e')](function(_0x505745){if(_[_0x9c68('0x4a')](_0x3a86a7[_0x9c68('0x25')][_0x9c68('0x48')])){for(var _0x4b985e=0x0;_0x4b985e<_0x3a86a7[_0x9c68('0x25')][_0x9c68('0x48')][_0x9c68('0x2e')];_0x4b985e+=0x1){socket[_0x9c68('0x4b')](_0x9c68('0x4c'),{'UserId':_0x3a86a7[_0x9c68('0x25')][_0x9c68('0x48')][_0x4b985e],'SquareProjectId':_0x3a86a7[_0x9c68('0x46')]['id']});}}else{socket[_0x9c68('0x4b')]('userSquareProject:remove',{'UserId':_0x3a86a7[_0x9c68('0x25')][_0x9c68('0x48')],'SquareProjectId':_0x3a86a7['params']['id']});}});}})['then'](respondWithStatusCode(_0x1c0f95,null))[_0x9c68('0x42')](handleError(_0x1c0f95,null));};exports[_0x9c68('0x4d')]=function(_0x4f2dd0,_0x3dc742,_0xe7fe45){var _0x5062d9={};var _0x221617={};var _0x2ec4b5;var _0x5a7e28;return db['SquareProject'][_0x9c68('0x4e')]({'where':{'id':_0x4f2dd0[_0x9c68('0x46')]['id']}})[_0x9c68('0x1e')](handleEntityNotFound(_0x3dc742,null))[_0x9c68('0x1e')](function(_0x3b719b){if(_0x3b719b){_0x2ec4b5=_0x3b719b;_0x221617['model']=_[_0x9c68('0x28')](db[_0x9c68('0x4f')][_0x9c68('0x24')]);_0x221617[_0x9c68('0x25')]=_['keys'](_0x4f2dd0[_0x9c68('0x25')]);_0x221617['filters']=_[_0x9c68('0x2a')](_0x221617['model'],_0x221617[_0x9c68('0x25')]);_0x5062d9[_0x9c68('0x2c')]=_[_0x9c68('0x2a')](_0x221617[_0x9c68('0x2b')],qs[_0x9c68('0x2d')](_0x4f2dd0[_0x9c68('0x25')]['fields']));_0x5062d9['attributes']=_0x5062d9[_0x9c68('0x2c')]['length']?_0x5062d9['attributes']:_0x221617[_0x9c68('0x2b')];_0x5062d9['order']=qs[_0x9c68('0x33')](_0x4f2dd0[_0x9c68('0x25')]['sort']);_0x5062d9[_0x9c68('0x34')]=qs[_0x9c68('0x29')](_['pick'](_0x4f2dd0[_0x9c68('0x25')],_0x221617[_0x9c68('0x29')]));if(_0x4f2dd0['query'][_0x9c68('0x38')]){_0x5062d9[_0x9c68('0x34')]=_[_0x9c68('0x3a')](_0x5062d9['where'],{'$or':_['map'](_0x5062d9[_0x9c68('0x2c')],function(_0x412c1e){var _0x33f7e7={};_0x33f7e7[_0x412c1e]={'$like':'%'+_0x4f2dd0[_0x9c68('0x25')][_0x9c68('0x38')]+'%'};return _0x33f7e7;})});}_0x5062d9=_[_0x9c68('0x3a')]({},_0x5062d9,_0x4f2dd0['options']);return _0x2ec4b5[_0x9c68('0x4d')](_0x5062d9);}})[_0x9c68('0x1e')](function(_0x4cbe46){if(_0x4cbe46){_0x5a7e28=_0x4cbe46[_0x9c68('0x2e')];if(!_0x4f2dd0[_0x9c68('0x25')][_0x9c68('0x2f')]('nolimit')){_0x5062d9['limit']=qs[_0x9c68('0x31')](_0x4f2dd0[_0x9c68('0x25')][_0x9c68('0x31')]);_0x5062d9[_0x9c68('0x19')]=qs[_0x9c68('0x19')](_0x4f2dd0[_0x9c68('0x25')][_0x9c68('0x19')]);}return _0x2ec4b5['getUsers'](_0x5062d9);}})[_0x9c68('0x1e')](function(_0x1970e3){if(_0x1970e3){return _0x1970e3?{'count':_0x5a7e28,'rows':_0x1970e3}:null;}})[_0x9c68('0x1e')](respondWithResult(_0x3dc742,null))[_0x9c68('0x42')](handleError(_0x3dc742,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 00156b7..e3c19d1 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 _0x2894=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0xbd03f6,_0x406435){var _0x3a137f=function(_0x36c0b2){while(--_0x36c0b2){_0xbd03f6['push'](_0xbd03f6['shift']());}};_0x3a137f(++_0x406435);}(_0x2894,0xa6));var _0x4289=function(_0xf52342,_0x2e9017){_0xf52342=_0xf52342-0x0;var _0x120899=_0x2894[_0xf52342];return _0x120899;};'use strict';var EventEmitter=require(_0x4289('0x0'));var SquareProject=require(_0x4289('0x1'))['db'][_0x4289('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4289('0x3')](0x0);var events={'afterCreate':_0x4289('0x4'),'afterUpdate':_0x4289('0x5'),'afterDestroy':_0x4289('0x6')};function emitEvent(_0x2b9ce4){return function(_0xa084f3,_0x247cf6,_0xa4a7c7){SquareProjectEvents[_0x4289('0x7')](_0x2b9ce4+':'+_0xa084f3['id'],_0xa084f3);SquareProjectEvents[_0x4289('0x7')](_0x2b9ce4,_0xa084f3);_0xa4a7c7(null);};}for(var e in events){if(events[_0x4289('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x4289('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x1034=['hook','exports','save','update','remove','emit','hasOwnProperty'];(function(_0xb9d07d,_0x4ce10c){var _0x16b1df=function(_0x36e855){while(--_0x36e855){_0xb9d07d['push'](_0xb9d07d['shift']());}};_0x16b1df(++_0x4ce10c);}(_0x1034,0x17c));var _0x4103=function(_0x2cb85a,_0x5d3075){_0x2cb85a=_0x2cb85a-0x0;var _0x30a51f=_0x1034[_0x2cb85a];return _0x30a51f;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4103('0x0'),'afterUpdate':_0x4103('0x1'),'afterDestroy':_0x4103('0x2')};function emitEvent(_0x2a39b9){return function(_0x5b434e,_0x38d9b1,_0x1e5f5f){SquareProjectEvents[_0x4103('0x3')](_0x2a39b9+':'+_0x5b434e['id'],_0x5b434e);SquareProjectEvents[_0x4103('0x3')](_0x2a39b9,_0x5b434e);_0x1e5f5f(null);};}for(var e in events){if(events[_0x4103('0x4')](e)){var event=events[e];SquareProject[_0x4103('0x5')](e,emitEvent(event));}}module[_0x4103('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7a2208a..8a3575a 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 _0xa384=['util','api','moment','bluebird','./squareProject.attributes','define'];(function(_0x4fc95f,_0x5581ed){var _0x289609=function(_0x129041){while(--_0x129041){_0x4fc95f['push'](_0x4fc95f['shift']());}};_0x289609(++_0x5581ed);}(_0xa384,0x150));var _0x4a38=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xa384[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');var util=require(_0x4a38('0x0'));var logger=require('../../config/logger')(_0x4a38('0x1'));var moment=require(_0x4a38('0x2'));var BPromise=require(_0x4a38('0x3'));var rp=require('request-promise');var attributes=require(_0x4a38('0x4'));module['exports']=function(_0x39c2c9,_0x5e6abd){return _0x39c2c9[_0x4a38('0x5')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8db=['./squareProject.attributes','exports','define','SquareProject','square_projects','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa8db,0x1b2));var _0xba8d=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xa8db[_0x39caaa];return _0x9b9c7d;};'use strict';var _=require(_0xba8d('0x0'));var util=require('util');var logger=require(_0xba8d('0x1'))(_0xba8d('0x2'));var moment=require(_0xba8d('0x3'));var BPromise=require(_0xba8d('0x4'));var rp=require(_0xba8d('0x5'));var attributes=require(_0xba8d('0x6'));module[_0xba8d('0x7')]=function(_0x548fff,_0x13f28c){return _0x548fff[_0xba8d('0x8')](_0xba8d('0x9'),attributes,{'tableName':_0xba8d('0xa'),'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 794cee7..2c2d48c 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 _0x55d0=['ShowSquareProject','SquareProject','raw','options','where','include','map','attributes','model','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x4eb34b,_0x33b4a6){var _0x1c4428=function(_0xfee1cb){while(--_0xfee1cb){_0x4eb34b['push'](_0x4eb34b['shift']());}};_0x1c4428(++_0x33b4a6);}(_0x55d0,0x72));var _0x055d=function(_0x4660b9,_0x172664){_0x4660b9=_0x4660b9-0x0;var _0x3d0b6b=_0x55d0[_0x4660b9];return _0x3d0b6b;};'use strict';var _=require(_0x055d('0x0'));var util=require(_0x055d('0x1'));var moment=require(_0x055d('0x2'));var BPromise=require(_0x055d('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x055d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x055d('0x5'))(_0x055d('0x6'));var config=require(_0x055d('0x7'));var jayson=require(_0x055d('0x8'));var client=jayson[_0x055d('0x9')][_0x055d('0xa')]({'port':0x232a});var socket=require(_0x055d('0xb'))({'host':_0x055d('0xc'),'port':0x18eb});require(_0x055d('0xd'))[_0x055d('0xe')](socket);function respondWithRpcPromise(_0x1488ed,_0x489f2d,_0x1ff450){return new BPromise(function(_0x14e039,_0x4a97ab){return client['request'](_0x1488ed,_0x1ff450)[_0x055d('0xf')](function(_0x2ba149){logger[_0x055d('0x10')](_0x055d('0x11'),_0x489f2d,_0x055d('0x12'));logger[_0x055d('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x489f2d,_0x055d('0x12'),JSON[_0x055d('0x14')](_0x2ba149));if(_0x2ba149['error']){if(_0x2ba149[_0x055d('0x15')][_0x055d('0x16')]===0x1f4){logger['error'](_0x055d('0x11'),_0x489f2d,_0x2ba149['error'][_0x055d('0x17')]);return _0x4a97ab(_0x2ba149[_0x055d('0x15')][_0x055d('0x17')]);}logger[_0x055d('0x15')](_0x055d('0x11'),_0x489f2d,_0x2ba149[_0x055d('0x15')]['message']);return _0x14e039(_0x2ba149[_0x055d('0x15')][_0x055d('0x17')]);}else{logger[_0x055d('0x10')]('SquareProject,\x20%s,\x20%s',_0x489f2d,'request\x20sent');_0x14e039(_0x2ba149[_0x055d('0x18')][_0x055d('0x17')]);}})[_0x055d('0x19')](function(_0x1f96e7){logger[_0x055d('0x15')](_0x055d('0x11'),_0x489f2d,_0x1f96e7);_0x4a97ab(_0x1f96e7);});});}exports[_0x055d('0x1a')]=function(_0x22439d){var _0x34dd71=this;return new Promise(function(_0x48a06a,_0x4baa8b){return db[_0x055d('0x1b')]['find']({'raw':_0x22439d['options']?_0x22439d['options'][_0x055d('0x1c')]===undefined?!![]:![]:!![],'where':_0x22439d[_0x055d('0x1d')]?_0x22439d[_0x055d('0x1d')][_0x055d('0x1e')]||null:null,'attributes':_0x22439d[_0x055d('0x1d')]?_0x22439d[_0x055d('0x1d')]['attributes']||null:null,'include':_0x22439d['options']?_0x22439d[_0x055d('0x1d')][_0x055d('0x1f')]?_[_0x055d('0x20')](_0x22439d['options'][_0x055d('0x1f')],function(_0x311cbb){return{'model':db[_0x311cbb['model']],'as':_0x311cbb['as'],'attributes':_0x311cbb[_0x055d('0x21')],'include':_0x311cbb[_0x055d('0x1f')]?_['map'](_0x311cbb[_0x055d('0x1f')],function(_0x59ccfd){return{'model':db[_0x59ccfd[_0x055d('0x22')]],'as':_0x59ccfd['as'],'attributes':_0x59ccfd['attributes'],'include':_0x59ccfd[_0x055d('0x1f')]?_[_0x055d('0x20')](_0x59ccfd[_0x055d('0x1f')],function(_0x4ac140){return{'model':db[_0x4ac140[_0x055d('0x22')]],'as':_0x4ac140['as'],'attributes':_0x4ac140[_0x055d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x055d('0xf')](function(_0x16045f){logger[_0x055d('0x10')](_0x055d('0x1a'),_0x22439d);logger[_0x055d('0x13')]('ShowSquareProject',_0x22439d,JSON[_0x055d('0x14')](_0x16045f));_0x48a06a(_0x16045f);})[_0x055d('0x19')](function(_0x3bfebb){logger['error']('ShowSquareProject',_0x3bfebb[_0x055d('0x17')],_0x22439d);_0x4baa8b(_0x34dd71['error'](0x1f4,_0x3bfebb['message']));});});}; \ No newline at end of file +var _0x55e6=['options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find'];(function(_0x51075a,_0x496c0f){var _0x494770=function(_0xfcd074){while(--_0xfcd074){_0x51075a['push'](_0x51075a['shift']());}};_0x494770(++_0x496c0f);}(_0x55e6,0x6d));var _0x655e=function(_0x283da5,_0x34163b){_0x283da5=_0x283da5-0x0;var _0x54359d=_0x55e6[_0x283da5];return _0x54359d;};'use strict';var _=require(_0x655e('0x0'));var util=require(_0x655e('0x1'));var moment=require(_0x655e('0x2'));var BPromise=require(_0x655e('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x655e('0x4'))['db'];var utils=require(_0x655e('0x5'));var logger=require(_0x655e('0x6'))(_0x655e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x655e('0x8')]({'port':0x232a});var socket=require(_0x655e('0x9'))({'host':'localhost','port':0x18eb});require(_0x655e('0xa'))[_0x655e('0xb')](socket);function respondWithRpcPromise(_0x155eb8,_0x56cc98,_0x315141){return new BPromise(function(_0x1b303d,_0x18709f){return client['request'](_0x155eb8,_0x315141)[_0x655e('0xc')](function(_0x2e5b6f){logger[_0x655e('0xd')](_0x655e('0xe'),_0x56cc98,_0x655e('0xf'));logger[_0x655e('0x10')](_0x655e('0x11'),_0x56cc98,_0x655e('0xf'),JSON[_0x655e('0x12')](_0x2e5b6f));if(_0x2e5b6f[_0x655e('0x13')]){if(_0x2e5b6f[_0x655e('0x13')][_0x655e('0x14')]===0x1f4){logger[_0x655e('0x13')](_0x655e('0xe'),_0x56cc98,_0x2e5b6f['error'][_0x655e('0x15')]);return _0x18709f(_0x2e5b6f[_0x655e('0x13')]['message']);}logger[_0x655e('0x13')](_0x655e('0xe'),_0x56cc98,_0x2e5b6f[_0x655e('0x13')][_0x655e('0x15')]);return _0x1b303d(_0x2e5b6f['error'][_0x655e('0x15')]);}else{logger[_0x655e('0xd')](_0x655e('0xe'),_0x56cc98,_0x655e('0xf'));_0x1b303d(_0x2e5b6f[_0x655e('0x16')]['message']);}})[_0x655e('0x17')](function(_0x48dac5){logger[_0x655e('0x13')](_0x655e('0xe'),_0x56cc98,_0x48dac5);_0x18709f(_0x48dac5);});});}exports[_0x655e('0x18')]=function(_0x54426e){var _0x4dc881=this;return new Promise(function(_0x3740c2,_0x26ff1e){return db[_0x655e('0x19')][_0x655e('0x1a')]({'raw':_0x54426e[_0x655e('0x1b')]?_0x54426e[_0x655e('0x1b')][_0x655e('0x1c')]===undefined?!![]:![]:!![],'where':_0x54426e['options']?_0x54426e[_0x655e('0x1b')][_0x655e('0x1d')]||null:null,'attributes':_0x54426e[_0x655e('0x1b')]?_0x54426e[_0x655e('0x1b')][_0x655e('0x1e')]||null:null,'include':_0x54426e[_0x655e('0x1b')]?_0x54426e[_0x655e('0x1b')][_0x655e('0x1f')]?_[_0x655e('0x20')](_0x54426e[_0x655e('0x1b')][_0x655e('0x1f')],function(_0x4ddd5c){return{'model':db[_0x4ddd5c[_0x655e('0x21')]],'as':_0x4ddd5c['as'],'attributes':_0x4ddd5c[_0x655e('0x1e')],'include':_0x4ddd5c['include']?_['map'](_0x4ddd5c[_0x655e('0x1f')],function(_0x14fe41){return{'model':db[_0x14fe41[_0x655e('0x21')]],'as':_0x14fe41['as'],'attributes':_0x14fe41[_0x655e('0x1e')],'include':_0x14fe41[_0x655e('0x1f')]?_['map'](_0x14fe41[_0x655e('0x1f')],function(_0x21d3a8){return{'model':db[_0x21d3a8[_0x655e('0x21')]],'as':_0x21d3a8['as'],'attributes':_0x21d3a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x655e('0xc')](function(_0x14b837){logger['info'](_0x655e('0x18'),_0x54426e);logger[_0x655e('0x10')]('ShowSquareProject',_0x54426e,JSON[_0x655e('0x12')](_0x14b837));_0x3740c2(_0x14b837);})[_0x655e('0x17')](function(_0x2d11df){logger[_0x655e('0x13')](_0x655e('0x18'),_0x2d11df[_0x655e('0x15')],_0x54426e);_0x26ff1e(_0x4dc881['error'](0x1f4,_0x2d11df['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 98b0636..998b4fc 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 _0xb575=['squareProject:','./squareProject.events','save','update','emit','removeListener','register'];(function(_0x25db26,_0x48f45f){var _0x748fa6=function(_0x27e011){while(--_0x27e011){_0x25db26['push'](_0x25db26['shift']());}};_0x748fa6(++_0x48f45f);}(_0xb575,0xda));var _0x5b57=function(_0x2a284a,_0x1d18f8){_0x2a284a=_0x2a284a-0x0;var _0x49584a=_0xb575[_0x2a284a];return _0x49584a;};'use strict';var SquareProjectEvents=require(_0x5b57('0x0'));var events=[_0x5b57('0x1'),'remove',_0x5b57('0x2')];function createListener(_0x4c5b3f,_0x4a644c){return function(_0x585c94){_0x4a644c[_0x5b57('0x3')](_0x4c5b3f,_0x585c94);};}function removeListener(_0x34ae8e,_0x4b91c3){return function(){SquareProjectEvents[_0x5b57('0x4')](_0x34ae8e,_0x4b91c3);};}exports[_0x5b57('0x5')]=function(_0x501a91){for(var _0x542b77=0x0,_0x672beb=events['length'];_0x542b77<_0x672beb;_0x542b77++){var _0x4232d0=events[_0x542b77];var _0x5dd0c7=createListener(_0x5b57('0x6')+_0x4232d0,_0x501a91);SquareProjectEvents['on'](_0x4232d0,_0x5dd0c7);}}; \ No newline at end of file +var _0x2821=['save','remove','update','emit','removeListener','length','squareProject:','./squareProject.events'];(function(_0x4f4d62,_0x5e1cd5){var _0x14e4d7=function(_0x2e00b6){while(--_0x2e00b6){_0x4f4d62['push'](_0x4f4d62['shift']());}};_0x14e4d7(++_0x5e1cd5);}(_0x2821,0x87));var _0x1282=function(_0xff1bb0,_0x71c6f0){_0xff1bb0=_0xff1bb0-0x0;var _0x307bc5=_0x2821[_0xff1bb0];return _0x307bc5;};'use strict';var SquareProjectEvents=require(_0x1282('0x0'));var events=[_0x1282('0x1'),_0x1282('0x2'),_0x1282('0x3')];function createListener(_0x27c0ae,_0x1bebaa){return function(_0x279fa6){_0x1bebaa[_0x1282('0x4')](_0x27c0ae,_0x279fa6);};}function removeListener(_0x3f5e68,_0x7c8e0f){return function(){SquareProjectEvents[_0x1282('0x5')](_0x3f5e68,_0x7c8e0f);};}exports['register']=function(_0x31e0cf){for(var _0x1843f2=0x0,_0x293947=events[_0x1282('0x6')];_0x1843f2<_0x293947;_0x1843f2++){var _0xa4eee9=events[_0x1843f2];var _0x1a8666=createListener(_0x1282('0x7')+_0xa4eee9,_0x31e0cf);SquareProjectEvents['on'](_0xa4eee9,_0x1a8666);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 233f9a3..3f14b6a 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 _0x8031=['post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','index','get','isAuthenticated','show','/:id/download'];(function(_0x45f344,_0x59c1c6){var _0x5b5ec0=function(_0x26e5d9){while(--_0x26e5d9){_0x45f344['push'](_0x45f344['shift']());}};_0x5b5ec0(++_0x59c1c6);}(_0x8031,0x198));var _0x1803=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x8031[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0x1803('0x0'));var util=require(_0x1803('0x1'));var path=require('path');var express=require(_0x1803('0x2'));var router=express[_0x1803('0x3')]();var auth=require(_0x1803('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1803('0x5'));var controller=require(_0x1803('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1803('0x7')]);router[_0x1803('0x8')]('/:id',auth[_0x1803('0x9')](),controller[_0x1803('0xa')]);router[_0x1803('0x8')](_0x1803('0xb'),auth[_0x1803('0x9')](),controller['download']);router[_0x1803('0xc')]('/',auth[_0x1803('0x9')](),controller[_0x1803('0xd')]);router[_0x1803('0xe')](_0x1803('0xf'),auth[_0x1803('0x9')](),controller[_0x1803('0x10')]);router[_0x1803('0x11')]('/:id',auth[_0x1803('0x9')](),controller[_0x1803('0x12')]);module[_0x1803('0x13')]=router; \ No newline at end of file +var _0xc836=['../../config/environment','./squareRecording.controller','isAuthenticated','index','get','/:id','show','/:id/download','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5f4de,_0x13e1d6){var _0x25772d=function(_0x5f5b56){while(--_0x5f5b56){_0x5f4de['push'](_0x5f4de['shift']());}};_0x25772d(++_0x13e1d6);}(_0xc836,0x1e7));var _0x6c83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc836[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6c83('0x0'));var util=require(_0x6c83('0x1'));var path=require(_0x6c83('0x2'));var express=require(_0x6c83('0x3'));var router=express[_0x6c83('0x4')]();var auth=require(_0x6c83('0x5'));var interaction=require(_0x6c83('0x6'));var config=require(_0x6c83('0x7'));var controller=require(_0x6c83('0x8'));router['get']('/',auth[_0x6c83('0x9')](),controller[_0x6c83('0xa')]);router[_0x6c83('0xb')](_0x6c83('0xc'),auth[_0x6c83('0x9')](),controller[_0x6c83('0xd')]);router['get'](_0x6c83('0xe'),auth[_0x6c83('0x9')](),controller['download']);router[_0x6c83('0xf')]('/',auth[_0x6c83('0x9')](),controller['create']);router['put'](_0x6c83('0xc'),auth[_0x6c83('0x9')](),controller['update']);router[_0x6c83('0x10')](_0x6c83('0xc'),auth[_0x6c83('0x9')](),controller[_0x6c83('0x11')]);module[_0x6c83('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index bfa6b7b..9833a31 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 _0xcbab=['STRING','sequelize','exports'];(function(_0x47c516,_0x36e014){var _0xbc8721=function(_0x476f89){while(--_0x476f89){_0x47c516['push'](_0x47c516['shift']());}};_0xbc8721(++_0x36e014);}(_0xcbab,0x16f));var _0xbcba=function(_0x425b10,_0xe4cbbe){_0x425b10=_0x425b10-0x0;var _0x1eecfe=_0xcbab[_0x425b10];return _0x1eecfe;};'use strict';var Sequelize=require(_0xbcba('0x0'));module[_0xbcba('0x1')]={'uniqueid':{'type':Sequelize[_0xbcba('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbcba('0x2')]},'context':{'type':Sequelize[_0xbcba('0x2')]},'extension':{'type':Sequelize[_0xbcba('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbcba('0x2')]},'dnid':{'type':Sequelize[_0xbcba('0x2')]},'projectName':{'type':Sequelize[_0xbcba('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xbcba('0x2')]},'savePath':{'type':Sequelize[_0xbcba('0x2')]}}; \ No newline at end of file +var _0x6bdc=['STRING','sequelize','exports'];(function(_0x98c1ae,_0x10fa88){var _0xfb9c53=function(_0x33322c){while(--_0x33322c){_0x98c1ae['push'](_0x98c1ae['shift']());}};_0xfb9c53(++_0x10fa88);}(_0x6bdc,0x1f0));var _0xc6bd=function(_0x44a200,_0x21d9cc){_0x44a200=_0x44a200-0x0;var _0x1fb808=_0x6bdc[_0x44a200];return _0x1fb808;};'use strict';var Sequelize=require(_0xc6bd('0x0'));module[_0xc6bd('0x1')]={'uniqueid':{'type':Sequelize[_0xc6bd('0x2')]},'callerid':{'type':Sequelize[_0xc6bd('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc6bd('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc6bd('0x2')]},'projectName':{'type':Sequelize[_0xc6bd('0x2')]},'saveName':{'type':Sequelize[_0xc6bd('0x2')]},'filename':{'type':Sequelize[_0xc6bd('0x2')]},'savePath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 9d841b5..aeec706 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 _0x3e74=['squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','end','status','json','offset','limit','reject','save','update','then','destroy','stack','send','SquareRecording','rawAttributes','dateStart','query','dateEnd','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','add','day','filter','where','merge','map','count','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','download','../../components/encryptor','uniqueid','filename','format','%s.cypher','value','existsSync','decryptFile','savePath','recording','SquareRecording\x20not\x20found','unlink','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3e74,0x175));var _0x43e7=function(_0x30fc4f,_0x301e66){_0x30fc4f=_0x30fc4f-0x0;var _0x5da2fa=_0x3e74[_0x30fc4f];return _0x5da2fa;};'use strict';var jsonpatch=require(_0x43e7('0x0'));var rp=require('request-promise');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var Mustache=require(_0x43e7('0x3'));var util=require('util');var path=require('path');var sox=require(_0x43e7('0x4'));var csv=require('to-csv');var ejs=require(_0x43e7('0x5'));var fs=require('fs');var _=require(_0x43e7('0x6'));var squel=require(_0x43e7('0x7'));var crypto=require(_0x43e7('0x8'));var jsforce=require(_0x43e7('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x43e7('0xa'));var querystring=require(_0x43e7('0xb'));var Papa=require(_0x43e7('0xc'));var qs=require(_0x43e7('0xd'));var logger=require(_0x43e7('0xe'))('api');var utils=require(_0x43e7('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39c8bd,_0x4139c9){_0x4139c9=_0x4139c9||0xcc;return function(_0x5c34f4){if(_0x5c34f4){return _0x39c8bd[_0x43e7('0x10')](_0x4139c9);}return _0x39c8bd['status'](_0x4139c9)[_0x43e7('0x11')]();};}function respondWithResult(_0x37302c,_0x4ebc8e){_0x4ebc8e=_0x4ebc8e||0xc8;return function(_0x3eb206){if(_0x3eb206){return _0x37302c[_0x43e7('0x12')](_0x4ebc8e)[_0x43e7('0x13')](_0x3eb206);}};}function respondWithFilteredResult(_0x3bb83f,_0x4e008c){return function(_0x583d85){if(_0x583d85){var _0x2fcb36=_0x583d85['count'],_0x21fdd3=_0x4e008c[_0x43e7('0x14')],_0x44b0bd=_0x4e008c[_0x43e7('0x14')]+_0x4e008c[_0x43e7('0x15')],_0x51b974;if(_0x44b0bd>=_0x2fcb36){_0x44b0bd=_0x2fcb36;_0x51b974=0xc8;}else{_0x51b974=0xce;}_0x3bb83f[_0x43e7('0x12')](_0x51b974);return _0x3bb83f['set']('Content-Range',_0x21fdd3+'-'+_0x44b0bd+'/'+_0x2fcb36)[_0x43e7('0x13')](_0x583d85);}return null;};}function patchUpdates(_0x264575){return function(_0x273a32){try{jsonpatch['apply'](_0x273a32,_0x264575,!![]);}catch(_0x4b5a6b){return BPromise[_0x43e7('0x16')](_0x4b5a6b);}return _0x273a32[_0x43e7('0x17')]();};}function saveUpdates(_0x9037d3,_0x140657){return function(_0x3776f5){if(_0x3776f5){return _0x3776f5[_0x43e7('0x18')](_0x9037d3)[_0x43e7('0x19')](function(_0x1441ef){return _0x1441ef;});}return null;};}function removeEntity(_0x2377a3,_0xab63cf){return function(_0x191dd5){if(_0x191dd5){return _0x191dd5[_0x43e7('0x1a')]()['then'](function(){_0x2377a3[_0x43e7('0x12')](0xcc)[_0x43e7('0x11')]();});}};}function handleEntityNotFound(_0x4b386b,_0x2898b5){return function(_0x3e281e){if(!_0x3e281e){_0x4b386b[_0x43e7('0x10')](0x194);}return _0x3e281e;};}function handleError(_0x28aacc,_0x4077fb){_0x4077fb=_0x4077fb||0x1f4;return function(_0x2f4cb4){logger['error'](_0x2f4cb4[_0x43e7('0x1b')]);if(_0x2f4cb4['name']){delete _0x2f4cb4['name'];}_0x28aacc[_0x43e7('0x12')](_0x4077fb)[_0x43e7('0x1c')](_0x2f4cb4);};}exports['index']=function(_0x1f0673,_0x4ca5cf){var _0x326dab={},_0x5c5e67={},_0x1af208={'count':0x0,'rows':[]};var _0x1b5f50=db[_0x43e7('0x1d')][_0x43e7('0x1e')];_0x5c5e67['model']=_['keys'](_0x1b5f50);var _0x805b54={'dateStart':_0x1f0673['query'][_0x43e7('0x1f')],'dateEnd':_0x1f0673[_0x43e7('0x20')][_0x43e7('0x21')]};delete _0x1f0673[_0x43e7('0x20')]['dateStart'];delete _0x1f0673[_0x43e7('0x20')][_0x43e7('0x21')];_0x5c5e67[_0x43e7('0x20')]=_[_0x43e7('0x22')](_0x1f0673[_0x43e7('0x20')]);_0x5c5e67[_0x43e7('0x23')]=_[_0x43e7('0x24')](_0x5c5e67[_0x43e7('0x25')],_0x5c5e67[_0x43e7('0x20')]);_0x326dab[_0x43e7('0x26')]=_[_0x43e7('0x24')](_0x5c5e67[_0x43e7('0x25')],qs[_0x43e7('0x27')](_0x1f0673[_0x43e7('0x20')]['fields']));_0x326dab[_0x43e7('0x26')]=_0x326dab[_0x43e7('0x26')][_0x43e7('0x28')]?_0x326dab[_0x43e7('0x26')]:_0x5c5e67[_0x43e7('0x25')];if(!_0x1f0673['query'][_0x43e7('0x29')](_0x43e7('0x2a'))){_0x326dab[_0x43e7('0x15')]=qs[_0x43e7('0x15')](_0x1f0673['query']['limit']);_0x326dab['offset']=qs[_0x43e7('0x14')](_0x1f0673[_0x43e7('0x20')][_0x43e7('0x14')]);}_0x326dab[_0x43e7('0x2b')]=qs[_0x43e7('0x2c')](_0x1f0673[_0x43e7('0x20')]['sort']);_0x326dab['where']=qs['filters'](_['pick'](_0x1f0673['query'],_0x5c5e67['filters']));if(_0x805b54['dateStart']){if(_0x805b54[_0x43e7('0x21')]){_0x805b54['dateEnd']=moment(_0x805b54[_0x43e7('0x21')])[_0x43e7('0x2d')](0x1,_0x43e7('0x2e'));}else{_0x805b54[_0x43e7('0x21')]=moment(_0x805b54[_0x43e7('0x1f')])[_0x43e7('0x2d')](0x1,_0x43e7('0x2e'));}_['merge'](_0x326dab['where'],{'createdAt':{'$gte':_0x805b54['dateStart'],'$lte':_0x805b54[_0x43e7('0x21')]}});}if(_0x1f0673[_0x43e7('0x20')][_0x43e7('0x2f')]){_0x326dab[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x326dab[_0x43e7('0x30')],{'$or':_[_0x43e7('0x32')](_0x326dab[_0x43e7('0x26')],function(_0x55c798){var _0x61ed8e={};_0x61ed8e[_0x55c798]={'$like':'%'+_0x1f0673[_0x43e7('0x20')]['filter']+'%'};return _0x61ed8e;})});}_0x326dab=_[_0x43e7('0x31')]({},_0x326dab,_0x1f0673['options']);var _0x44d8e4={'where':_0x326dab[_0x43e7('0x30')]};return db[_0x43e7('0x1d')][_0x43e7('0x33')](_0x44d8e4)[_0x43e7('0x19')](function(_0x234d8f){_0x1af208['count']=_0x234d8f;if(_0x1f0673['query'][_0x43e7('0x34')]){_0x326dab[_0x43e7('0x35')]=[{'all':!![]}];}return db[_0x43e7('0x1d')][_0x43e7('0x36')](_0x326dab);})[_0x43e7('0x19')](function(_0x4a4a85){_0x1af208[_0x43e7('0x37')]=_0x4a4a85;return _0x1af208;})[_0x43e7('0x19')](respondWithFilteredResult(_0x4ca5cf,_0x326dab))['catch'](handleError(_0x4ca5cf,null));};exports[_0x43e7('0x38')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x39')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x25')]=_[_0x43e7('0x22')](db['SquareRecording']['rawAttributes']);_0x3d81ae[_0x43e7('0x20')]=_[_0x43e7('0x22')](_0x51a69c[_0x43e7('0x20')]);_0x3d81ae[_0x43e7('0x23')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x26')]=_['intersection'](_0x3d81ae[_0x43e7('0x25')],qs['fields'](_0x51a69c['query'][_0x43e7('0x27')]));_0x504101['attributes']=_0x504101[_0x43e7('0x26')][_0x43e7('0x28')]?_0x504101[_0x43e7('0x26')]:_0x3d81ae[_0x43e7('0x25')];if(_0x51a69c['query'][_0x43e7('0x34')]){_0x504101[_0x43e7('0x35')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x31')]({},_0x504101,_0x51a69c[_0x43e7('0x3a')]);return db[_0x43e7('0x1d')][_0x43e7('0x3b')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x3c')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x3d')]=function(_0x212841,_0x4c00a8){return db['SquareRecording']['create'](_0x212841[_0x43e7('0x3e')],{})[_0x43e7('0x19')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x18')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['SquareRecording']['find']({'where':{'id':_0x47686e[_0x43e7('0x39')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x3e')],null))[_0x43e7('0x19')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x3c')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x1a')]=function(_0x4a0ce5,_0x2718d5){return db['SquareRecording']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x39')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x19')](removeEntity(_0x2718d5,null))[_0x43e7('0x3c')](handleError(_0x2718d5,null));};exports[_0x43e7('0x3f')]=function(_0x2351cf,_0x1cd87c,_0x256ddd){var _0x473fca=require(_0x43e7('0x40'));var _0x58dfd0=![];var _0x119d34={};if(_0x2351cf[_0x43e7('0x20')]['type']&&_0x2351cf[_0x43e7('0x20')]['type']===_0x43e7('0x41')){_0x119d34[_0x43e7('0x41')]=_0x2351cf[_0x43e7('0x39')]['id'];}else{_0x119d34['id']=_0x2351cf[_0x43e7('0x39')]['id'];}return db[_0x43e7('0x1d')]['find']({'where':_0x119d34,'attributes':['id','savePath',_0x43e7('0x42')],'raw':!![]})[_0x43e7('0x19')](handleEntityNotFound(_0x1cd87c,null))[_0x43e7('0x19')](function(_0x29c53d){if(_0x29c53d){var _0x23d835=util[_0x43e7('0x43')](_0x43e7('0x44'),_0x29c53d[_0x43e7('0x45')]);if(fs[_0x43e7('0x46')](_0x23d835)){_0x58dfd0=!![];return _0x473fca[_0x43e7('0x47')](_0x23d835,_0x29c53d[_0x43e7('0x48')],config['secrets'][_0x43e7('0x49')])[_0x43e7('0x19')](function(){return _0x29c53d;});}return _0x29c53d;}})['then'](function(_0x4314d8){if(_0x4314d8){if(!fs[_0x43e7('0x46')](_0x4314d8[_0x43e7('0x48')])){throw new db['Sequelize']['ValidationError'](_0x43e7('0x4a'));}if(_0x4314d8[_0x43e7('0x42')]){return _0x1cd87c['download'](_0x4314d8[_0x43e7('0x48')],_0x4314d8['filename']+path['extname'](_0x4314d8[_0x43e7('0x48')]),function(){if(_0x58dfd0){fs[_0x43e7('0x4b')](_0x4314d8[_0x43e7('0x48')]);}});}else{return _0x1cd87c[_0x43e7('0x3f')](_0x4314d8[_0x43e7('0x48')],function(_0x4dfdb0){if(_0x58dfd0){fs[_0x43e7('0x4b')](_0x4314d8[_0x43e7('0x48')]);}});}}})['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x0e85=['query','dateStart','filters','intersection','fields','attributes','nolimit','limit','order','sort','pick','dateEnd','add','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','download','../../components/encryptor','type','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','extname','unlink','fast-json-patch','request-promise','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','send','index','SquareRecording','model','keys'];(function(_0x55e6ee,_0x4c29db){var _0x420310=function(_0x1fffe6){while(--_0x1fffe6){_0x55e6ee['push'](_0x55e6ee['shift']());}};_0x420310(++_0x4c29db);}(_0x0e85,0x7c));var _0x50e8=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x0e85[_0x1477ef];return _0x164acd;};'use strict';var jsonpatch=require(_0x50e8('0x0'));var rp=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var Mustache=require(_0x50e8('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x50e8('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x50e8('0x5'));var squel=require(_0x50e8('0x6'));var crypto=require(_0x50e8('0x7'));var jsforce=require(_0x50e8('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x50e8('0x4'));var querystring=require(_0x50e8('0x9'));var Papa=require(_0x50e8('0xa'));var qs=require(_0x50e8('0xb'));var logger=require(_0x50e8('0xc'))(_0x50e8('0xd'));var utils=require('../../config/utils');var config=require(_0x50e8('0xe'));var db=require(_0x50e8('0xf'))['db'];function respondWithStatusCode(_0x19d1bc,_0x2d4750){_0x2d4750=_0x2d4750||0xcc;return function(_0x154b9e){if(_0x154b9e){return _0x19d1bc[_0x50e8('0x10')](_0x2d4750);}return _0x19d1bc[_0x50e8('0x11')](_0x2d4750)[_0x50e8('0x12')]();};}function respondWithResult(_0x55ba0a,_0x56707f){_0x56707f=_0x56707f||0xc8;return function(_0xfc6bb9){if(_0xfc6bb9){return _0x55ba0a[_0x50e8('0x11')](_0x56707f)['json'](_0xfc6bb9);}};}function respondWithFilteredResult(_0x49e02f,_0x3cb45c){return function(_0x2abda1){if(_0x2abda1){var _0x1a4c85=_0x2abda1[_0x50e8('0x13')],_0x473aa7=_0x3cb45c[_0x50e8('0x14')],_0x54efd3=_0x3cb45c['offset']+_0x3cb45c['limit'],_0x18596f;if(_0x54efd3>=_0x1a4c85){_0x54efd3=_0x1a4c85;_0x18596f=0xc8;}else{_0x18596f=0xce;}_0x49e02f[_0x50e8('0x11')](_0x18596f);return _0x49e02f[_0x50e8('0x15')](_0x50e8('0x16'),_0x473aa7+'-'+_0x54efd3+'/'+_0x1a4c85)[_0x50e8('0x17')](_0x2abda1);}return null;};}function patchUpdates(_0x211731){return function(_0x1f0338){try{jsonpatch['apply'](_0x1f0338,_0x211731,!![]);}catch(_0x5a5ef2){return BPromise[_0x50e8('0x18')](_0x5a5ef2);}return _0x1f0338[_0x50e8('0x19')]();};}function saveUpdates(_0x40d060,_0x45ce11){return function(_0x5dae4e){if(_0x5dae4e){return _0x5dae4e[_0x50e8('0x1a')](_0x40d060)[_0x50e8('0x1b')](function(_0x53e0a1){return _0x53e0a1;});}return null;};}function removeEntity(_0x415596,_0x55997c){return function(_0x4d2318){if(_0x4d2318){return _0x4d2318[_0x50e8('0x1c')]()[_0x50e8('0x1b')](function(){_0x415596[_0x50e8('0x11')](0xcc)[_0x50e8('0x12')]();});}};}function handleEntityNotFound(_0x58db83,_0x2c7c25){return function(_0x1e4e0d){if(!_0x1e4e0d){_0x58db83['sendStatus'](0x194);}return _0x1e4e0d;};}function handleError(_0x31d23c,_0x41500f){_0x41500f=_0x41500f||0x1f4;return function(_0x5691b2){logger[_0x50e8('0x1d')](_0x5691b2[_0x50e8('0x1e')]);if(_0x5691b2['name']){delete _0x5691b2['name'];}_0x31d23c['status'](_0x41500f)[_0x50e8('0x1f')](_0x5691b2);};}exports[_0x50e8('0x20')]=function(_0x124402,_0x371a1f){var _0xc2f832={},_0x13b6e9={},_0x53d848={'count':0x0,'rows':[]};var _0x3a6442=db[_0x50e8('0x21')]['rawAttributes'];_0x13b6e9[_0x50e8('0x22')]=_[_0x50e8('0x23')](_0x3a6442);var _0x3a14ca={'dateStart':_0x124402[_0x50e8('0x24')]['dateStart'],'dateEnd':_0x124402[_0x50e8('0x24')]['dateEnd']};delete _0x124402[_0x50e8('0x24')][_0x50e8('0x25')];delete _0x124402[_0x50e8('0x24')]['dateEnd'];_0x13b6e9[_0x50e8('0x24')]=_[_0x50e8('0x23')](_0x124402[_0x50e8('0x24')]);_0x13b6e9[_0x50e8('0x26')]=_[_0x50e8('0x27')](_0x13b6e9[_0x50e8('0x22')],_0x13b6e9[_0x50e8('0x24')]);_0xc2f832['attributes']=_[_0x50e8('0x27')](_0x13b6e9[_0x50e8('0x22')],qs['fields'](_0x124402['query'][_0x50e8('0x28')]));_0xc2f832[_0x50e8('0x29')]=_0xc2f832[_0x50e8('0x29')]['length']?_0xc2f832['attributes']:_0x13b6e9[_0x50e8('0x22')];if(!_0x124402[_0x50e8('0x24')]['hasOwnProperty'](_0x50e8('0x2a'))){_0xc2f832[_0x50e8('0x2b')]=qs[_0x50e8('0x2b')](_0x124402[_0x50e8('0x24')]['limit']);_0xc2f832[_0x50e8('0x14')]=qs['offset'](_0x124402[_0x50e8('0x24')][_0x50e8('0x14')]);}_0xc2f832[_0x50e8('0x2c')]=qs['sort'](_0x124402[_0x50e8('0x24')][_0x50e8('0x2d')]);_0xc2f832['where']=qs[_0x50e8('0x26')](_[_0x50e8('0x2e')](_0x124402[_0x50e8('0x24')],_0x13b6e9[_0x50e8('0x26')]));if(_0x3a14ca['dateStart']){if(_0x3a14ca[_0x50e8('0x2f')]){_0x3a14ca[_0x50e8('0x2f')]=moment(_0x3a14ca[_0x50e8('0x2f')])[_0x50e8('0x30')](0x1,'day');}else{_0x3a14ca[_0x50e8('0x2f')]=moment(_0x3a14ca[_0x50e8('0x25')])[_0x50e8('0x30')](0x1,'day');}_['merge'](_0xc2f832['where'],{'createdAt':{'$gte':_0x3a14ca[_0x50e8('0x25')],'$lte':_0x3a14ca[_0x50e8('0x2f')]}});}if(_0x124402[_0x50e8('0x24')][_0x50e8('0x31')]){_0xc2f832[_0x50e8('0x32')]=_[_0x50e8('0x33')](_0xc2f832[_0x50e8('0x32')],{'$or':_[_0x50e8('0x34')](_0xc2f832[_0x50e8('0x29')],function(_0x3a1b4d){var _0x53066b={};_0x53066b[_0x3a1b4d]={'$like':'%'+_0x124402[_0x50e8('0x24')][_0x50e8('0x31')]+'%'};return _0x53066b;})});}_0xc2f832=_[_0x50e8('0x33')]({},_0xc2f832,_0x124402[_0x50e8('0x35')]);var _0x5dbbe1={'where':_0xc2f832[_0x50e8('0x32')]};return db[_0x50e8('0x21')][_0x50e8('0x13')](_0x5dbbe1)[_0x50e8('0x1b')](function(_0x8e8a97){_0x53d848['count']=_0x8e8a97;if(_0x124402['query'][_0x50e8('0x36')]){_0xc2f832[_0x50e8('0x37')]=[{'all':!![]}];}return db['SquareRecording'][_0x50e8('0x38')](_0xc2f832);})[_0x50e8('0x1b')](function(_0x3db1ab){_0x53d848[_0x50e8('0x39')]=_0x3db1ab;return _0x53d848;})[_0x50e8('0x1b')](respondWithFilteredResult(_0x371a1f,_0xc2f832))[_0x50e8('0x3a')](handleError(_0x371a1f,null));};exports[_0x50e8('0x3b')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x3c')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x22')]=_['keys'](db[_0x50e8('0x21')][_0x50e8('0x3d')]);_0x44e0ca[_0x50e8('0x24')]=_[_0x50e8('0x23')](_0x172049['query']);_0x44e0ca[_0x50e8('0x26')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x29')]=_[_0x50e8('0x27')](_0x44e0ca['model'],qs[_0x50e8('0x28')](_0x172049[_0x50e8('0x24')][_0x50e8('0x28')]));_0x3d26bd[_0x50e8('0x29')]=_0x3d26bd[_0x50e8('0x29')][_0x50e8('0x3e')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x22')];if(_0x172049['query'][_0x50e8('0x36')]){_0x3d26bd[_0x50e8('0x37')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x35')]);return db['SquareRecording'][_0x50e8('0x3f')](_0x3d26bd)[_0x50e8('0x1b')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x1b')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x3a')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x40')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x21')][_0x50e8('0x40')](_0x3f72ea[_0x50e8('0x41')],{})[_0x50e8('0x1b')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x1a')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x41')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x21')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x3c')]['id']}})[_0x50e8('0x1b')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x1b')](saveUpdates(_0x275a1b[_0x50e8('0x41')],null))[_0x50e8('0x1b')](respondWithResult(_0x479431,null))[_0x50e8('0x3a')](handleError(_0x479431,null));};exports[_0x50e8('0x1c')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x21')][_0x50e8('0x3f')]({'where':{'id':_0x5f256a[_0x50e8('0x3c')]['id']}})[_0x50e8('0x1b')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x1b')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x42')]=function(_0x250b28,_0xff2e24,_0x27c80a){var _0x498309=require(_0x50e8('0x43'));var _0x167b8f=![];var _0x3476c5={};if(_0x250b28[_0x50e8('0x24')][_0x50e8('0x44')]&&_0x250b28[_0x50e8('0x24')][_0x50e8('0x44')]==='uniqueid'){_0x3476c5['uniqueid']=_0x250b28['params']['id'];}else{_0x3476c5['id']=_0x250b28[_0x50e8('0x3c')]['id'];}return db[_0x50e8('0x21')][_0x50e8('0x3f')]({'where':_0x3476c5,'attributes':['id',_0x50e8('0x45'),_0x50e8('0x46')],'raw':!![]})[_0x50e8('0x1b')](handleEntityNotFound(_0xff2e24,null))['then'](function(_0x2f2154){if(_0x2f2154){var _0x3706b6=util[_0x50e8('0x47')](_0x50e8('0x48'),_0x2f2154['value']);if(fs[_0x50e8('0x49')](_0x3706b6)){_0x167b8f=!![];return _0x498309[_0x50e8('0x4a')](_0x3706b6,_0x2f2154[_0x50e8('0x45')],config[_0x50e8('0x4b')][_0x50e8('0x4c')])[_0x50e8('0x1b')](function(){return _0x2f2154;});}return _0x2f2154;}})['then'](function(_0x234f94){if(_0x234f94){if(!fs['existsSync'](_0x234f94['savePath'])){throw new db['Sequelize'][(_0x50e8('0x4d'))]('SquareRecording\x20not\x20found');}if(_0x234f94[_0x50e8('0x46')]){return _0xff2e24[_0x50e8('0x42')](_0x234f94[_0x50e8('0x45')],_0x234f94[_0x50e8('0x46')]+path[_0x50e8('0x4e')](_0x234f94[_0x50e8('0x45')]),function(){if(_0x167b8f){fs[_0x50e8('0x4f')](_0x234f94['savePath']);}});}else{return _0xff2e24[_0x50e8('0x42')](_0x234f94[_0x50e8('0x45')],function(_0x3572ce){if(_0x167b8f){fs['unlink'](_0x234f94['savePath']);}});}}})['catch'](handleError(_0xff2e24,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 436b086..061a9d0 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 _0x624c=['../../config/logger','api','moment','bluebird','./squareRecording.attributes','define','SquareRecording','square_recordings','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x624c,0x1ee));var _0xc624=function(_0x584a03,_0x59e0c8){_0x584a03=_0x584a03-0x0;var _0x29d9c9=_0x624c[_0x584a03];return _0x29d9c9;};'use strict';var _=require('lodash');var util=require(_0xc624('0x0'));var logger=require(_0xc624('0x1'))(_0xc624('0x2'));var moment=require(_0xc624('0x3'));var BPromise=require(_0xc624('0x4'));var rp=require('request-promise');var attributes=require(_0xc624('0x5'));module['exports']=function(_0x1e6dbe,_0x5f0cc1){return _0x1e6dbe[_0xc624('0x6')](_0xc624('0x7'),attributes,{'tableName':_0xc624('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x158f=['square_recordings','util','../../config/logger','api','moment','bluebird','request-promise','./squareRecording.attributes','define','SquareRecording'];(function(_0x5f1dbf,_0x418b27){var _0x81790b=function(_0x3a90a5){while(--_0x3a90a5){_0x5f1dbf['push'](_0x5f1dbf['shift']());}};_0x81790b(++_0x418b27);}(_0x158f,0x137));var _0xf158=function(_0x4ffb89,_0x17f6ee){_0x4ffb89=_0x4ffb89-0x0;var _0x433ad9=_0x158f[_0x4ffb89];return _0x433ad9;};'use strict';var _=require('lodash');var util=require(_0xf158('0x0'));var logger=require(_0xf158('0x1'))(_0xf158('0x2'));var moment=require(_0xf158('0x3'));var BPromise=require(_0xf158('0x4'));var rp=require(_0xf158('0x5'));var attributes=require(_0xf158('0x6'));module['exports']=function(_0x29a06,_0x5c9b9b){return _0x29a06[_0xf158('0x7')](_0xf158('0x8'),attributes,{'tableName':_0xf158('0x9'),'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 76cbca8..f650b59 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 _0x88fc=['CreateSquareRecording','body','options','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x191c4c,_0x3b7c2b){var _0x2fd037=function(_0x26026a){while(--_0x26026a){_0x191c4c['push'](_0x191c4c['shift']());}};_0x2fd037(++_0x3b7c2b);}(_0x88fc,0x1e7));var _0xc88f=function(_0x4359c0,_0x4a8f65){_0x4359c0=_0x4359c0-0x0;var _0x500301=_0x88fc[_0x4359c0];return _0x500301;};'use strict';var _=require('lodash');var util=require(_0xc88f('0x0'));var moment=require(_0xc88f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xc88f('0x2'))['db'];var utils=require(_0xc88f('0x3'));var logger=require(_0xc88f('0x4'))('rpc');var config=require(_0xc88f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc88f('0x6')][_0xc88f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ed242,_0x4235dd,_0x255ba2){return new BPromise(function(_0x55853c,_0xcc6fce){return client[_0xc88f('0x8')](_0x3ed242,_0x255ba2)[_0xc88f('0x9')](function(_0x2f9713){logger[_0xc88f('0xa')](_0xc88f('0xb'),_0x4235dd,_0xc88f('0xc'));logger[_0xc88f('0xd')](_0xc88f('0xe'),_0x4235dd,_0xc88f('0xc'),JSON[_0xc88f('0xf')](_0x2f9713));if(_0x2f9713[_0xc88f('0x10')]){if(_0x2f9713[_0xc88f('0x10')]['code']===0x1f4){logger[_0xc88f('0x10')]('SquareRecording,\x20%s,\x20%s',_0x4235dd,_0x2f9713[_0xc88f('0x10')]['message']);return _0xcc6fce(_0x2f9713['error'][_0xc88f('0x11')]);}logger[_0xc88f('0x10')](_0xc88f('0xb'),_0x4235dd,_0x2f9713[_0xc88f('0x10')][_0xc88f('0x11')]);return _0x55853c(_0x2f9713[_0xc88f('0x10')]['message']);}else{logger[_0xc88f('0xa')](_0xc88f('0xb'),_0x4235dd,_0xc88f('0xc'));_0x55853c(_0x2f9713[_0xc88f('0x12')][_0xc88f('0x11')]);}})['catch'](function(_0x5751a9){logger[_0xc88f('0x10')]('SquareRecording,\x20%s,\x20%s',_0x4235dd,_0x5751a9);_0xcc6fce(_0x5751a9);});});}exports[_0xc88f('0x13')]=function(_0x3aa71a){var _0x2ff209=this;return new Promise(function(_0x2ff95f,_0x27dbd2){return db['SquareRecording']['create'](_0x3aa71a[_0xc88f('0x14')],{'raw':_0x3aa71a[_0xc88f('0x15')]?_0x3aa71a[_0xc88f('0x15')][_0xc88f('0x16')]===undefined?!![]:![]:!![]})[_0xc88f('0x9')](function(_0x179778){logger[_0xc88f('0xa')](_0xc88f('0x13'),_0x3aa71a);logger[_0xc88f('0xd')](_0xc88f('0x13'),_0x3aa71a,JSON[_0xc88f('0xf')](_0x179778));_0x2ff95f(_0x179778);})['catch'](function(_0x4dbf50){logger['error'](_0xc88f('0x13'),_0x4dbf50['message'],_0x3aa71a);_0x27dbd2(_0x2ff209[_0xc88f('0x10')](0x1f4,_0x4dbf50[_0xc88f('0x11')]));});});}; \ No newline at end of file +var _0xccea=['error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x63d570,_0x5d5940){var _0x4bac1=function(_0x211505){while(--_0x211505){_0x63d570['push'](_0x63d570['shift']());}};_0x4bac1(++_0x5d5940);}(_0xccea,0x104));var _0xacce=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xccea[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xacce('0x0'));var util=require(_0xacce('0x1'));var moment=require(_0xacce('0x2'));var BPromise=require('bluebird');var rs=require(_0xacce('0x3'));var fs=require('fs');var db=require(_0xacce('0x4'))['db'];var utils=require(_0xacce('0x5'));var logger=require('../../config/logger')(_0xacce('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xacce('0x7')][_0xacce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f005f,_0x5f11b3,_0x374188){return new BPromise(function(_0x525405,_0x816fc8){return client['request'](_0x5f005f,_0x374188)[_0xacce('0x9')](function(_0x3dd570){logger[_0xacce('0xa')](_0xacce('0xb'),_0x5f11b3,_0xacce('0xc'));logger['debug'](_0xacce('0xd'),_0x5f11b3,_0xacce('0xc'),JSON[_0xacce('0xe')](_0x3dd570));if(_0x3dd570['error']){if(_0x3dd570[_0xacce('0xf')][_0xacce('0x10')]===0x1f4){logger[_0xacce('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5f11b3,_0x3dd570[_0xacce('0xf')]['message']);return _0x816fc8(_0x3dd570['error'][_0xacce('0x11')]);}logger[_0xacce('0xf')](_0xacce('0xb'),_0x5f11b3,_0x3dd570[_0xacce('0xf')][_0xacce('0x11')]);return _0x525405(_0x3dd570[_0xacce('0xf')][_0xacce('0x11')]);}else{logger[_0xacce('0xa')](_0xacce('0xb'),_0x5f11b3,_0xacce('0xc'));_0x525405(_0x3dd570[_0xacce('0x12')][_0xacce('0x11')]);}})[_0xacce('0x13')](function(_0x44e7f5){logger[_0xacce('0xf')](_0xacce('0xb'),_0x5f11b3,_0x44e7f5);_0x816fc8(_0x44e7f5);});});}exports[_0xacce('0x14')]=function(_0x3f55cb){var _0xa2000b=this;return new Promise(function(_0xbb04fd,_0x4f2ad0){return db[_0xacce('0x15')][_0xacce('0x16')](_0x3f55cb['body'],{'raw':_0x3f55cb[_0xacce('0x17')]?_0x3f55cb[_0xacce('0x17')][_0xacce('0x18')]===undefined?!![]:![]:!![]})[_0xacce('0x9')](function(_0x4c907a){logger['info'](_0xacce('0x14'),_0x3f55cb);logger['debug']('CreateSquareRecording',_0x3f55cb,JSON[_0xacce('0xe')](_0x4c907a));_0xbb04fd(_0x4c907a);})[_0xacce('0x13')](function(_0x145e90){logger[_0xacce('0xf')](_0xacce('0x14'),_0x145e90[_0xacce('0x11')],_0x3f55cb);_0x4f2ad0(_0xa2000b['error'](0x1f4,_0x145e90['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d459a2e..0deca42 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 _0x558a=['destroy','exports','util','path','express','Router','../../components/auth/service','./squareReport.controller','get','index','/describe','describe','show','post','isAuthenticated','create','delete','/:id'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x558a,0x6e));var _0xa558=function(_0x33ba18,_0x249665){_0x33ba18=_0x33ba18-0x0;var _0x1d070a=_0x558a[_0x33ba18];return _0x1d070a;};'use strict';var multer=require('multer');var util=require(_0xa558('0x0'));var path=require(_0xa558('0x1'));var express=require(_0xa558('0x2'));var router=express[_0xa558('0x3')]();var auth=require(_0xa558('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa558('0x5'));router[_0xa558('0x6')]('/',auth['isAuthenticated'](),controller[_0xa558('0x7')]);router['get'](_0xa558('0x8'),auth['isAuthenticated'](),controller[_0xa558('0x9')]);router[_0xa558('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa558('0xa')]);router[_0xa558('0xb')]('/',auth[_0xa558('0xc')](),controller[_0xa558('0xd')]);router['put']('/:id',auth[_0xa558('0xc')](),controller['update']);router[_0xa558('0xe')](_0xa558('0xf'),auth[_0xa558('0xc')](),controller[_0xa558('0x10')]);module[_0xa558('0x11')]=router; \ No newline at end of file +var _0x6e07=['/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','describe','isAuthenticated','post','create','put'];(function(_0xe16edc,_0x20594a){var _0x301f01=function(_0x574fa4){while(--_0x574fa4){_0xe16edc['push'](_0xe16edc['shift']());}};_0x301f01(++_0x20594a);}(_0x6e07,0x122));var _0x76e0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6e07[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x76e0('0x0'));var util=require(_0x76e0('0x1'));var path=require(_0x76e0('0x2'));var express=require(_0x76e0('0x3'));var router=express['Router']();var auth=require(_0x76e0('0x4'));var interaction=require(_0x76e0('0x5'));var config=require(_0x76e0('0x6'));var controller=require(_0x76e0('0x7'));router[_0x76e0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x76e0('0x9')]);router['get']('/:id',auth[_0x76e0('0xa')](),controller['show']);router[_0x76e0('0xb')]('/',auth['isAuthenticated'](),controller[_0x76e0('0xc')]);router[_0x76e0('0xd')](_0x76e0('0xe'),auth['isAuthenticated'](),controller[_0x76e0('0xf')]);router[_0x76e0('0x10')]('/:id',auth[_0x76e0('0xa')](),controller[_0x76e0('0x11')]);module[_0x76e0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 122dd8c..d3d2dfc 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 _0x821b=['DATE','exports','STRING'];(function(_0x5500e9,_0x4d9612){var _0x3e6615=function(_0x1470e0){while(--_0x1470e0){_0x5500e9['push'](_0x5500e9['shift']());}};_0x3e6615(++_0x4d9612);}(_0x821b,0xb8));var _0xb821=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x821b[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require('sequelize');module[_0xb821('0x0')]={'network':{'type':Sequelize[_0xb821('0x1')]},'network_script':{'type':Sequelize[_0xb821('0x1')]},'request':{'type':Sequelize[_0xb821('0x1')]},'channel':{'type':Sequelize[_0xb821('0x1')]},'language':{'type':Sequelize[_0xb821('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb821('0x1')]},'version':{'type':Sequelize[_0xb821('0x1')]},'callerid':{'type':Sequelize[_0xb821('0x1')]},'calleridname':{'type':Sequelize[_0xb821('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xb821('0x1')]},'callington':{'type':Sequelize[_0xb821('0x1')]},'callingtns':{'type':Sequelize[_0xb821('0x1')]},'dnid':{'type':Sequelize[_0xb821('0x1')]},'rdnis':{'type':Sequelize[_0xb821('0x1')]},'context':{'type':Sequelize[_0xb821('0x1')]},'extension':{'type':Sequelize[_0xb821('0x1')]},'priority':{'type':Sequelize[_0xb821('0x1')]},'enhanced':{'type':Sequelize[_0xb821('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xb821('0x1')]},'project_name':{'type':Sequelize[_0xb821('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb821('0x2')]}}; \ No newline at end of file +var _0xd24b=['sequelize','exports','STRING','DATE'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0xd24b,0x194));var _0xbd24=function(_0x312962,_0x282d40){_0x312962=_0x312962-0x0;var _0x3e85d0=_0xd24b[_0x312962];return _0x3e85d0;};'use strict';var Sequelize=require(_0xbd24('0x0'));module[_0xbd24('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xbd24('0x2')]},'request':{'type':Sequelize[_0xbd24('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbd24('0x2')]},'uniqueid':{'type':Sequelize[_0xbd24('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xbd24('0x2')]},'calleridname':{'type':Sequelize[_0xbd24('0x2')]},'callingpres':{'type':Sequelize[_0xbd24('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xbd24('0x2')]},'dnid':{'type':Sequelize[_0xbd24('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbd24('0x2')]},'priority':{'type':Sequelize[_0xbd24('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbd24('0x2')]},'threadid':{'type':Sequelize[_0xbd24('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbd24('0x3')]},'leaveAt':{'type':Sequelize[_0xbd24('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 609a633..9dec9ba 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 _0xb903=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','SquareReport','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','length','attributes','hasOwnProperty','sort','where','add','day','merge','filter','map','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','fast-json-patch'];(function(_0x31106b,_0x199b46){var _0x1a8e53=function(_0x529964){while(--_0x529964){_0x31106b['push'](_0x31106b['shift']());}};_0x1a8e53(++_0x199b46);}(_0xb903,0x185));var _0x3b90=function(_0xe20754,_0x5bfc96){_0xe20754=_0xe20754-0x0;var _0x385f84=_0xb903[_0xe20754];return _0x385f84;};'use strict';var jsonpatch=require(_0x3b90('0x0'));var rp=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var Mustache=require('mustache');var util=require(_0x3b90('0x4'));var path=require(_0x3b90('0x5'));var sox=require(_0x3b90('0x6'));var csv=require(_0x3b90('0x7'));var ejs=require(_0x3b90('0x8'));var fs=require('fs');var _=require(_0x3b90('0x9'));var squel=require(_0x3b90('0xa'));var crypto=require('crypto');var jsforce=require(_0x3b90('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3b90('0xc'));var Papa=require(_0x3b90('0xd'));var qs=require(_0x3b90('0xe'));var logger=require(_0x3b90('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56261b,_0x55db3f){_0x55db3f=_0x55db3f||0xcc;return function(_0x336913){if(_0x336913){return _0x56261b[_0x3b90('0x10')](_0x55db3f);}return _0x56261b['status'](_0x55db3f)[_0x3b90('0x11')]();};}function respondWithResult(_0x233509,_0x4bb8f4){_0x4bb8f4=_0x4bb8f4||0xc8;return function(_0x45b75f){if(_0x45b75f){return _0x233509[_0x3b90('0x12')](_0x4bb8f4)[_0x3b90('0x13')](_0x45b75f);}};}function respondWithFilteredResult(_0x4badcb,_0x5447df){return function(_0x58c4d1){if(_0x58c4d1){var _0x542cb3=_0x58c4d1['count'],_0x492d39=_0x5447df['offset'],_0x3a0a55=_0x5447df[_0x3b90('0x14')]+_0x5447df[_0x3b90('0x15')],_0x2c72fb;if(_0x3a0a55>=_0x542cb3){_0x3a0a55=_0x542cb3;_0x2c72fb=0xc8;}else{_0x2c72fb=0xce;}_0x4badcb[_0x3b90('0x12')](_0x2c72fb);return _0x4badcb[_0x3b90('0x16')](_0x3b90('0x17'),_0x492d39+'-'+_0x3a0a55+'/'+_0x542cb3)['json'](_0x58c4d1);}return null;};}function patchUpdates(_0x494970){return function(_0xd83280){try{jsonpatch[_0x3b90('0x18')](_0xd83280,_0x494970,!![]);}catch(_0x4e9120){return BPromise[_0x3b90('0x19')](_0x4e9120);}return _0xd83280[_0x3b90('0x1a')]();};}function saveUpdates(_0x11ad7d,_0x131f3f){return function(_0x4f388b){if(_0x4f388b){return _0x4f388b[_0x3b90('0x1b')](_0x11ad7d)['then'](function(_0xd8d873){return _0xd8d873;});}return null;};}function removeEntity(_0x231690,_0x535894){return function(_0x39ae7c){if(_0x39ae7c){return _0x39ae7c[_0x3b90('0x1c')]()[_0x3b90('0x1d')](function(){_0x231690[_0x3b90('0x12')](0xcc)[_0x3b90('0x11')]();});}};}function handleEntityNotFound(_0x43deca,_0x3bc7d5){return function(_0x2f4270){if(!_0x2f4270){_0x43deca[_0x3b90('0x10')](0x194);}return _0x2f4270;};}function handleError(_0x3e5bb8,_0x4e2175){_0x4e2175=_0x4e2175||0x1f4;return function(_0x20b06a){logger[_0x3b90('0x1e')](_0x20b06a[_0x3b90('0x1f')]);if(_0x20b06a[_0x3b90('0x20')]){delete _0x20b06a[_0x3b90('0x20')];}_0x3e5bb8[_0x3b90('0x12')](_0x4e2175)['send'](_0x20b06a);};}exports['index']=function(_0x40955a,_0x29d472){var _0x103324={},_0x2ffa1a={},_0x583523={'count':0x0,'rows':[]};var _0x414462=db[_0x3b90('0x21')][_0x3b90('0x22')];_0x2ffa1a['model']=_[_0x3b90('0x23')](_0x414462);var _0x138d79={'dateStart':_0x40955a[_0x3b90('0x24')][_0x3b90('0x25')],'dateEnd':_0x40955a[_0x3b90('0x24')][_0x3b90('0x26')]};delete _0x40955a['query'][_0x3b90('0x25')];delete _0x40955a['query'][_0x3b90('0x26')];_0x2ffa1a[_0x3b90('0x24')]=_[_0x3b90('0x23')](_0x40955a[_0x3b90('0x24')]);_0x2ffa1a[_0x3b90('0x27')]=_[_0x3b90('0x28')](_0x2ffa1a[_0x3b90('0x29')],_0x2ffa1a[_0x3b90('0x24')]);_0x103324['attributes']=_['intersection'](_0x2ffa1a[_0x3b90('0x29')],qs[_0x3b90('0x2a')](_0x40955a[_0x3b90('0x24')][_0x3b90('0x2a')]));_0x103324['attributes']=_0x103324['attributes'][_0x3b90('0x2b')]?_0x103324[_0x3b90('0x2c')]:_0x2ffa1a[_0x3b90('0x29')];if(!_0x40955a['query'][_0x3b90('0x2d')]('nolimit')){_0x103324['limit']=qs[_0x3b90('0x15')](_0x40955a[_0x3b90('0x24')]['limit']);_0x103324[_0x3b90('0x14')]=qs[_0x3b90('0x14')](_0x40955a[_0x3b90('0x24')]['offset']);}_0x103324['order']=qs[_0x3b90('0x2e')](_0x40955a[_0x3b90('0x24')][_0x3b90('0x2e')]);_0x103324[_0x3b90('0x2f')]=qs['filters'](_['pick'](_0x40955a[_0x3b90('0x24')],_0x2ffa1a[_0x3b90('0x27')]));if(_0x138d79['dateStart']){if(_0x138d79['dateEnd']){_0x138d79[_0x3b90('0x26')]=moment(_0x138d79[_0x3b90('0x26')])[_0x3b90('0x30')](0x1,_0x3b90('0x31'));}else{_0x138d79['dateEnd']=moment(_0x138d79[_0x3b90('0x25')])['add'](0x1,_0x3b90('0x31'));}_[_0x3b90('0x32')](_0x103324[_0x3b90('0x2f')],{'createdAt':{'$gte':_0x138d79[_0x3b90('0x25')],'$lte':_0x138d79[_0x3b90('0x26')]}});}if(_0x40955a[_0x3b90('0x24')][_0x3b90('0x33')]){_0x103324['where']=_[_0x3b90('0x32')](_0x103324[_0x3b90('0x2f')],{'$or':_[_0x3b90('0x34')](_0x103324[_0x3b90('0x2c')],function(_0x3d6040){var _0x390952={};_0x390952[_0x3d6040]={'$like':'%'+_0x40955a[_0x3b90('0x24')][_0x3b90('0x33')]+'%'};return _0x390952;})});}_0x103324=_[_0x3b90('0x32')]({},_0x103324,_0x40955a['options']);var _0x369d0d={'where':_0x103324[_0x3b90('0x2f')]};return db[_0x3b90('0x21')][_0x3b90('0x35')](_0x369d0d)[_0x3b90('0x1d')](function(_0xb71509){_0x583523[_0x3b90('0x35')]=_0xb71509;if(_0x40955a[_0x3b90('0x24')][_0x3b90('0x36')]){_0x103324[_0x3b90('0x37')]=[{'all':!![]}];}return db[_0x3b90('0x21')][_0x3b90('0x38')](_0x103324);})[_0x3b90('0x1d')](function(_0x11285e){_0x583523[_0x3b90('0x39')]=_0x11285e;return _0x583523;})[_0x3b90('0x1d')](respondWithFilteredResult(_0x29d472,_0x103324))[_0x3b90('0x3a')](handleError(_0x29d472,null));};exports[_0x3b90('0x3b')]=function(_0x33056a,_0x37e8dd){var _0x11698a={'raw':!![],'where':{'id':_0x33056a[_0x3b90('0x3c')]['id']}},_0x4d1157={};_0x4d1157[_0x3b90('0x29')]=_[_0x3b90('0x23')](db[_0x3b90('0x21')]['rawAttributes']);_0x4d1157[_0x3b90('0x24')]=_['keys'](_0x33056a['query']);_0x4d1157[_0x3b90('0x27')]=_[_0x3b90('0x28')](_0x4d1157['model'],_0x4d1157[_0x3b90('0x24')]);_0x11698a[_0x3b90('0x2c')]=_[_0x3b90('0x28')](_0x4d1157[_0x3b90('0x29')],qs[_0x3b90('0x2a')](_0x33056a[_0x3b90('0x24')][_0x3b90('0x2a')]));_0x11698a[_0x3b90('0x2c')]=_0x11698a[_0x3b90('0x2c')]['length']?_0x11698a[_0x3b90('0x2c')]:_0x4d1157[_0x3b90('0x29')];if(_0x33056a['query'][_0x3b90('0x36')]){_0x11698a[_0x3b90('0x37')]=[{'all':!![]}];}_0x11698a=_[_0x3b90('0x32')]({},_0x11698a,_0x33056a[_0x3b90('0x3d')]);return db[_0x3b90('0x21')]['find'](_0x11698a)['then'](handleEntityNotFound(_0x37e8dd,null))[_0x3b90('0x1d')](respondWithResult(_0x37e8dd,null))['catch'](handleError(_0x37e8dd,null));};exports[_0x3b90('0x3e')]=function(_0xd5817,_0x330002){return db[_0x3b90('0x21')][_0x3b90('0x3e')](_0xd5817['body'],{})['then'](respondWithResult(_0x330002,0xc9))[_0x3b90('0x3a')](handleError(_0x330002,null));};exports[_0x3b90('0x1b')]=function(_0x9e2ee5,_0x5d7333){if(_0x9e2ee5[_0x3b90('0x3f')]['id']){delete _0x9e2ee5[_0x3b90('0x3f')]['id'];}return db[_0x3b90('0x21')][_0x3b90('0x40')]({'where':{'id':_0x9e2ee5[_0x3b90('0x3c')]['id']}})[_0x3b90('0x1d')](handleEntityNotFound(_0x5d7333,null))[_0x3b90('0x1d')](saveUpdates(_0x9e2ee5[_0x3b90('0x3f')],null))[_0x3b90('0x1d')](respondWithResult(_0x5d7333,null))['catch'](handleError(_0x5d7333,null));};exports[_0x3b90('0x1c')]=function(_0x407784,_0x2b5b6f){return db['SquareReport'][_0x3b90('0x40')]({'where':{'id':_0x407784['params']['id']}})[_0x3b90('0x1d')](handleEntityNotFound(_0x2b5b6f,null))[_0x3b90('0x1d')](removeEntity(_0x2b5b6f,null))[_0x3b90('0x3a')](handleError(_0x2b5b6f,null));};exports['describe']=function(_0x2a3fe8,_0x1ec976){return db['SquareReport']['describe']()[_0x3b90('0x1d')](respondWithResult(_0x1ec976,null))[_0x3b90('0x3a')](handleError(_0x1ec976,null));}; \ No newline at end of file +var _0xa8a8=['query','dateStart','dateEnd','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','options','includeAll','findAll','rows','keys','fields','include','find','catch','create','body','params','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','SquareReport','rawAttributes','model'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xa8a8,0xec));var _0x8a8a=function(_0xe0eae5,_0xbe9a12){_0xe0eae5=_0xe0eae5-0x0;var _0xb32e3e=_0xa8a8[_0xe0eae5];return _0xb32e3e;};'use strict';var jsonpatch=require(_0x8a8a('0x0'));var rp=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var Mustache=require('mustache');var util=require(_0x8a8a('0x4'));var path=require(_0x8a8a('0x5'));var sox=require(_0x8a8a('0x6'));var csv=require(_0x8a8a('0x7'));var ejs=require(_0x8a8a('0x8'));var fs=require('fs');var _=require(_0x8a8a('0x9'));var squel=require(_0x8a8a('0xa'));var crypto=require(_0x8a8a('0xb'));var jsforce=require(_0x8a8a('0xc'));var deskjs=require(_0x8a8a('0xd'));var toCsv=require(_0x8a8a('0x7'));var querystring=require(_0x8a8a('0xe'));var Papa=require(_0x8a8a('0xf'));var qs=require(_0x8a8a('0x10'));var logger=require(_0x8a8a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x8a8a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11788d,_0x3d3a00){_0x3d3a00=_0x3d3a00||0xcc;return function(_0x532621){if(_0x532621){return _0x11788d[_0x8a8a('0x13')](_0x3d3a00);}return _0x11788d[_0x8a8a('0x14')](_0x3d3a00)[_0x8a8a('0x15')]();};}function respondWithResult(_0x5e448d,_0x679da2){_0x679da2=_0x679da2||0xc8;return function(_0x42fab7){if(_0x42fab7){return _0x5e448d[_0x8a8a('0x14')](_0x679da2)[_0x8a8a('0x16')](_0x42fab7);}};}function respondWithFilteredResult(_0x4a1b91,_0x23febf){return function(_0x4e5d74){if(_0x4e5d74){var _0x25e1d5=_0x4e5d74[_0x8a8a('0x17')],_0xb2a3bc=_0x23febf[_0x8a8a('0x18')],_0x787eec=_0x23febf[_0x8a8a('0x18')]+_0x23febf['limit'],_0x2f6e33;if(_0x787eec>=_0x25e1d5){_0x787eec=_0x25e1d5;_0x2f6e33=0xc8;}else{_0x2f6e33=0xce;}_0x4a1b91[_0x8a8a('0x14')](_0x2f6e33);return _0x4a1b91['set'](_0x8a8a('0x19'),_0xb2a3bc+'-'+_0x787eec+'/'+_0x25e1d5)[_0x8a8a('0x16')](_0x4e5d74);}return null;};}function patchUpdates(_0x46a4f4){return function(_0x4291e9){try{jsonpatch[_0x8a8a('0x1a')](_0x4291e9,_0x46a4f4,!![]);}catch(_0x5dd616){return BPromise[_0x8a8a('0x1b')](_0x5dd616);}return _0x4291e9[_0x8a8a('0x1c')]();};}function saveUpdates(_0x262ca9,_0x2bce13){return function(_0x299827){if(_0x299827){return _0x299827[_0x8a8a('0x1d')](_0x262ca9)['then'](function(_0x5dc5ae){return _0x5dc5ae;});}return null;};}function removeEntity(_0x5181b2,_0x4e3d0a){return function(_0x4a6601){if(_0x4a6601){return _0x4a6601[_0x8a8a('0x1e')]()[_0x8a8a('0x1f')](function(){_0x5181b2[_0x8a8a('0x14')](0xcc)[_0x8a8a('0x15')]();});}};}function handleEntityNotFound(_0x22ebd4,_0x2f6af2){return function(_0x242bac){if(!_0x242bac){_0x22ebd4[_0x8a8a('0x13')](0x194);}return _0x242bac;};}function handleError(_0x25d5d4,_0x2deecb){_0x2deecb=_0x2deecb||0x1f4;return function(_0xb9db78){logger[_0x8a8a('0x20')](_0xb9db78[_0x8a8a('0x21')]);if(_0xb9db78[_0x8a8a('0x22')]){delete _0xb9db78[_0x8a8a('0x22')];}_0x25d5d4['status'](_0x2deecb)[_0x8a8a('0x23')](_0xb9db78);};}exports[_0x8a8a('0x24')]=function(_0x268b2f,_0x7662e){var _0x36e6d4={},_0x251315={},_0x3aa46d={'count':0x0,'rows':[]};var _0x5f4dcc=db[_0x8a8a('0x25')][_0x8a8a('0x26')];_0x251315[_0x8a8a('0x27')]=_['keys'](_0x5f4dcc);var _0x58f42b={'dateStart':_0x268b2f[_0x8a8a('0x28')][_0x8a8a('0x29')],'dateEnd':_0x268b2f['query']['dateEnd']};delete _0x268b2f['query'][_0x8a8a('0x29')];delete _0x268b2f['query'][_0x8a8a('0x2a')];_0x251315[_0x8a8a('0x28')]=_['keys'](_0x268b2f[_0x8a8a('0x28')]);_0x251315[_0x8a8a('0x2b')]=_[_0x8a8a('0x2c')](_0x251315[_0x8a8a('0x27')],_0x251315[_0x8a8a('0x28')]);_0x36e6d4[_0x8a8a('0x2d')]=_[_0x8a8a('0x2c')](_0x251315[_0x8a8a('0x27')],qs['fields'](_0x268b2f['query']['fields']));_0x36e6d4[_0x8a8a('0x2d')]=_0x36e6d4[_0x8a8a('0x2d')]['length']?_0x36e6d4[_0x8a8a('0x2d')]:_0x251315[_0x8a8a('0x27')];if(!_0x268b2f['query'][_0x8a8a('0x2e')](_0x8a8a('0x2f'))){_0x36e6d4[_0x8a8a('0x30')]=qs['limit'](_0x268b2f['query'][_0x8a8a('0x30')]);_0x36e6d4['offset']=qs[_0x8a8a('0x18')](_0x268b2f[_0x8a8a('0x28')][_0x8a8a('0x18')]);}_0x36e6d4[_0x8a8a('0x31')]=qs[_0x8a8a('0x32')](_0x268b2f[_0x8a8a('0x28')][_0x8a8a('0x32')]);_0x36e6d4[_0x8a8a('0x33')]=qs[_0x8a8a('0x2b')](_[_0x8a8a('0x34')](_0x268b2f[_0x8a8a('0x28')],_0x251315[_0x8a8a('0x2b')]));if(_0x58f42b[_0x8a8a('0x29')]){if(_0x58f42b[_0x8a8a('0x2a')]){_0x58f42b[_0x8a8a('0x2a')]=moment(_0x58f42b[_0x8a8a('0x2a')])[_0x8a8a('0x35')](0x1,_0x8a8a('0x36'));}else{_0x58f42b['dateEnd']=moment(_0x58f42b['dateStart'])['add'](0x1,_0x8a8a('0x36'));}_[_0x8a8a('0x37')](_0x36e6d4[_0x8a8a('0x33')],{'createdAt':{'$gte':_0x58f42b[_0x8a8a('0x29')],'$lte':_0x58f42b[_0x8a8a('0x2a')]}});}if(_0x268b2f['query']['filter']){_0x36e6d4[_0x8a8a('0x33')]=_['merge'](_0x36e6d4[_0x8a8a('0x33')],{'$or':_['map'](_0x36e6d4['attributes'],function(_0x1b33eb){var _0x1ac761={};_0x1ac761[_0x1b33eb]={'$like':'%'+_0x268b2f[_0x8a8a('0x28')][_0x8a8a('0x38')]+'%'};return _0x1ac761;})});}_0x36e6d4=_[_0x8a8a('0x37')]({},_0x36e6d4,_0x268b2f[_0x8a8a('0x39')]);var _0x20584a={'where':_0x36e6d4['where']};return db[_0x8a8a('0x25')][_0x8a8a('0x17')](_0x20584a)[_0x8a8a('0x1f')](function(_0x53f66e){_0x3aa46d[_0x8a8a('0x17')]=_0x53f66e;if(_0x268b2f[_0x8a8a('0x28')][_0x8a8a('0x3a')]){_0x36e6d4['include']=[{'all':!![]}];}return db[_0x8a8a('0x25')][_0x8a8a('0x3b')](_0x36e6d4);})[_0x8a8a('0x1f')](function(_0x19fd7a){_0x3aa46d[_0x8a8a('0x3c')]=_0x19fd7a;return _0x3aa46d;})[_0x8a8a('0x1f')](respondWithFilteredResult(_0x7662e,_0x36e6d4))['catch'](handleError(_0x7662e,null));};exports['show']=function(_0x392e7a,_0x568027){var _0x13e0d4={'raw':!![],'where':{'id':_0x392e7a['params']['id']}},_0x1aa8b5={};_0x1aa8b5['model']=_[_0x8a8a('0x3d')](db[_0x8a8a('0x25')][_0x8a8a('0x26')]);_0x1aa8b5[_0x8a8a('0x28')]=_['keys'](_0x392e7a[_0x8a8a('0x28')]);_0x1aa8b5['filters']=_[_0x8a8a('0x2c')](_0x1aa8b5[_0x8a8a('0x27')],_0x1aa8b5['query']);_0x13e0d4[_0x8a8a('0x2d')]=_[_0x8a8a('0x2c')](_0x1aa8b5[_0x8a8a('0x27')],qs['fields'](_0x392e7a[_0x8a8a('0x28')][_0x8a8a('0x3e')]));_0x13e0d4[_0x8a8a('0x2d')]=_0x13e0d4['attributes']['length']?_0x13e0d4[_0x8a8a('0x2d')]:_0x1aa8b5[_0x8a8a('0x27')];if(_0x392e7a[_0x8a8a('0x28')]['includeAll']){_0x13e0d4[_0x8a8a('0x3f')]=[{'all':!![]}];}_0x13e0d4=_[_0x8a8a('0x37')]({},_0x13e0d4,_0x392e7a[_0x8a8a('0x39')]);return db[_0x8a8a('0x25')][_0x8a8a('0x40')](_0x13e0d4)[_0x8a8a('0x1f')](handleEntityNotFound(_0x568027,null))[_0x8a8a('0x1f')](respondWithResult(_0x568027,null))[_0x8a8a('0x41')](handleError(_0x568027,null));};exports[_0x8a8a('0x42')]=function(_0x229751,_0x150b42){return db['SquareReport'][_0x8a8a('0x42')](_0x229751[_0x8a8a('0x43')],{})[_0x8a8a('0x1f')](respondWithResult(_0x150b42,0xc9))[_0x8a8a('0x41')](handleError(_0x150b42,null));};exports[_0x8a8a('0x1d')]=function(_0x2e22b0,_0x565a49){if(_0x2e22b0[_0x8a8a('0x43')]['id']){delete _0x2e22b0[_0x8a8a('0x43')]['id'];}return db[_0x8a8a('0x25')][_0x8a8a('0x40')]({'where':{'id':_0x2e22b0['params']['id']}})[_0x8a8a('0x1f')](handleEntityNotFound(_0x565a49,null))[_0x8a8a('0x1f')](saveUpdates(_0x2e22b0[_0x8a8a('0x43')],null))['then'](respondWithResult(_0x565a49,null))['catch'](handleError(_0x565a49,null));};exports[_0x8a8a('0x1e')]=function(_0x39a8e0,_0xf4b6ee){return db[_0x8a8a('0x25')][_0x8a8a('0x40')]({'where':{'id':_0x39a8e0[_0x8a8a('0x44')]['id']}})[_0x8a8a('0x1f')](handleEntityNotFound(_0xf4b6ee,null))[_0x8a8a('0x1f')](removeEntity(_0xf4b6ee,null))[_0x8a8a('0x41')](handleError(_0xf4b6ee,null));};exports['describe']=function(_0x4c1f1a,_0x17ffeb){return db[_0x8a8a('0x25')]['describe']()['then'](respondWithResult(_0x17ffeb,null))[_0x8a8a('0x41')](handleError(_0x17ffeb,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 5f82cc0..d0d947b 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 _0x3f40=['moment','bluebird','request-promise','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x51d69a,_0x3bcbd0){var _0x46cfd5=function(_0x568df3){while(--_0x568df3){_0x51d69a['push'](_0x51d69a['shift']());}};_0x46cfd5(++_0x3bcbd0);}(_0x3f40,0x97));var _0x03f4=function(_0xa6ad00,_0x58eed3){_0xa6ad00=_0xa6ad00-0x0;var _0x300709=_0x3f40[_0xa6ad00];return _0x300709;};'use strict';var _=require(_0x03f4('0x0'));var util=require(_0x03f4('0x1'));var logger=require(_0x03f4('0x2'))('api');var moment=require(_0x03f4('0x3'));var BPromise=require(_0x03f4('0x4'));var rp=require(_0x03f4('0x5'));var attributes=require(_0x03f4('0x6'));module[_0x03f4('0x7')]=function(_0x44b023,_0x4e8693){return _0x44b023[_0x03f4('0x8')](_0x03f4('0x9'),attributes,{'tableName':_0x03f4('0xa'),'paranoid':![],'indexes':[{'name':_0x03f4('0xb'),'fields':['uniqueid',_0x03f4('0xc')]},{'name':_0x03f4('0xd'),'fields':[_0x03f4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6260=['bluebird','request-promise','./squareReport.attributes','exports','define','uniqueid','project_name','leaveAt','api','moment'];(function(_0xae05cd,_0x1ef906){var _0x28382c=function(_0x379be1){while(--_0x379be1){_0xae05cd['push'](_0xae05cd['shift']());}};_0x28382c(++_0x1ef906);}(_0x6260,0xa8));var _0x0626=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x6260[_0x1678c8];return _0x387aa9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0626('0x0'));var moment=require(_0x0626('0x1'));var BPromise=require(_0x0626('0x2'));var rp=require(_0x0626('0x3'));var attributes=require(_0x0626('0x4'));module[_0x0626('0x5')]=function(_0x3053b2,_0x281b0c){return _0x3053b2[_0x0626('0x6')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x0626('0x7'),_0x0626('0x8')]},{'name':_0x0626('0x9'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 218879e..2da3f5c 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 _0x125e=['UpdateSquareReport','where','limit','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','then'];(function(_0x1a8f81,_0x3e23fa){var _0x266f21=function(_0x162bd4){while(--_0x162bd4){_0x1a8f81['push'](_0x1a8f81['shift']());}};_0x266f21(++_0x3e23fa);}(_0x125e,0x16f));var _0xe125=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x125e[_0x38a3d6];return _0x3768d7;};'use strict';var _=require('lodash');var util=require(_0xe125('0x0'));var moment=require(_0xe125('0x1'));var BPromise=require(_0xe125('0x2'));var rs=require(_0xe125('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe125('0x4'))('rpc');var config=require(_0xe125('0x5'));var jayson=require(_0xe125('0x6'));var client=jayson[_0xe125('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d6d61,_0x58e3de,_0x25d36a){return new BPromise(function(_0x757ba2,_0x45b7de){return client[_0xe125('0x8')](_0x3d6d61,_0x25d36a)['then'](function(_0x123659){logger[_0xe125('0x9')](_0xe125('0xa'),_0x58e3de,_0xe125('0xb'));logger[_0xe125('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x58e3de,_0xe125('0xb'),JSON[_0xe125('0xd')](_0x123659));if(_0x123659[_0xe125('0xe')]){if(_0x123659[_0xe125('0xe')][_0xe125('0xf')]===0x1f4){logger[_0xe125('0xe')](_0xe125('0xa'),_0x58e3de,_0x123659[_0xe125('0xe')][_0xe125('0x10')]);return _0x45b7de(_0x123659[_0xe125('0xe')][_0xe125('0x10')]);}logger[_0xe125('0xe')](_0xe125('0xa'),_0x58e3de,_0x123659['error']['message']);return _0x757ba2(_0x123659[_0xe125('0xe')][_0xe125('0x10')]);}else{logger['info'](_0xe125('0xa'),_0x58e3de,_0xe125('0xb'));_0x757ba2(_0x123659[_0xe125('0x11')]['message']);}})[_0xe125('0x12')](function(_0x5b7591){logger[_0xe125('0xe')]('SquareReport,\x20%s,\x20%s',_0x58e3de,_0x5b7591);_0x45b7de(_0x5b7591);});});}exports[_0xe125('0x13')]=function(_0x50bde5){var _0x1b0534=this;return new Promise(function(_0x5e0f75,_0x21cc89){return db[_0xe125('0x14')]['create'](_0x50bde5[_0xe125('0x15')],{'raw':_0x50bde5[_0xe125('0x16')]?_0x50bde5[_0xe125('0x16')][_0xe125('0x17')]===undefined?!![]:![]:!![]})[_0xe125('0x18')](function(_0x30c216){logger[_0xe125('0x9')]('CreateSquareReport',_0x50bde5);logger[_0xe125('0xc')](_0xe125('0x13'),_0x50bde5,JSON[_0xe125('0xd')](_0x30c216));_0x5e0f75(_0x30c216);})[_0xe125('0x12')](function(_0x2675d7){logger[_0xe125('0xe')](_0xe125('0x13'),_0x2675d7[_0xe125('0x10')],_0x50bde5);_0x21cc89(_0x1b0534[_0xe125('0xe')](0x1f4,_0x2675d7[_0xe125('0x10')]));});});};exports[_0xe125('0x19')]=function(_0x2e8541){var _0x475b7f=this;return new Promise(function(_0x7cf7c6,_0x33f3d5){return db[_0xe125('0x14')]['update'](_0x2e8541[_0xe125('0x15')],{'raw':_0x2e8541['options']?_0x2e8541[_0xe125('0x16')][_0xe125('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e8541[_0xe125('0x16')]?_0x2e8541[_0xe125('0x16')][_0xe125('0x1a')]||null:null,'attributes':_0x2e8541[_0xe125('0x16')]?_0x2e8541[_0xe125('0x16')]['attributes']||null:null,'limit':_0x2e8541[_0xe125('0x16')]?_0x2e8541[_0xe125('0x16')][_0xe125('0x1b')]||null:null})['then'](function(_0x444938){logger['info'](_0xe125('0x19'),_0x2e8541);logger[_0xe125('0xc')](_0xe125('0x19'),_0x2e8541,JSON[_0xe125('0xd')](_0x444938));_0x7cf7c6(_0x444938);})[_0xe125('0x12')](function(_0x8dc729){logger[_0xe125('0xe')](_0xe125('0x19'),_0x8dc729[_0xe125('0x10')],_0x2e8541);_0x33f3d5(_0x475b7f[_0xe125('0xe')](0x1f4,_0x8dc729[_0xe125('0x10')]));});});}; \ No newline at end of file +var _0xa97f=['code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','UpdateSquareReport','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3cc463,_0x6cb99a){var _0x3dc60a=function(_0x9363dd){while(--_0x9363dd){_0x3cc463['push'](_0x3cc463['shift']());}};_0x3dc60a(++_0x6cb99a);}(_0xa97f,0x10e));var _0xfa97=function(_0x59fafe,_0x3b5200){_0x59fafe=_0x59fafe-0x0;var _0x1000bf=_0xa97f[_0x59fafe];return _0x1000bf;};'use strict';var _=require(_0xfa97('0x0'));var util=require(_0xfa97('0x1'));var moment=require(_0xfa97('0x2'));var BPromise=require(_0xfa97('0x3'));var rs=require(_0xfa97('0x4'));var fs=require('fs');var db=require(_0xfa97('0x5'))['db'];var utils=require(_0xfa97('0x6'));var logger=require(_0xfa97('0x7'))('rpc');var config=require(_0xfa97('0x8'));var jayson=require(_0xfa97('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e70f2,_0x17018d,_0x2bf2d1){return new BPromise(function(_0x31ded2,_0x284fba){return client[_0xfa97('0xa')](_0x3e70f2,_0x2bf2d1)[_0xfa97('0xb')](function(_0x3c4a95){logger[_0xfa97('0xc')](_0xfa97('0xd'),_0x17018d,'request\x20sent');logger[_0xfa97('0xe')](_0xfa97('0xf'),_0x17018d,_0xfa97('0x10'),JSON['stringify'](_0x3c4a95));if(_0x3c4a95[_0xfa97('0x11')]){if(_0x3c4a95[_0xfa97('0x11')][_0xfa97('0x12')]===0x1f4){logger[_0xfa97('0x11')](_0xfa97('0xd'),_0x17018d,_0x3c4a95['error'][_0xfa97('0x13')]);return _0x284fba(_0x3c4a95['error'][_0xfa97('0x13')]);}logger['error'](_0xfa97('0xd'),_0x17018d,_0x3c4a95[_0xfa97('0x11')][_0xfa97('0x13')]);return _0x31ded2(_0x3c4a95[_0xfa97('0x11')]['message']);}else{logger[_0xfa97('0xc')](_0xfa97('0xd'),_0x17018d,'request\x20sent');_0x31ded2(_0x3c4a95[_0xfa97('0x14')]['message']);}})[_0xfa97('0x15')](function(_0x222b6d){logger['error'](_0xfa97('0xd'),_0x17018d,_0x222b6d);_0x284fba(_0x222b6d);});});}exports[_0xfa97('0x16')]=function(_0x16957c){var _0x203ec1=this;return new Promise(function(_0x483c62,_0x548644){return db[_0xfa97('0x17')]['create'](_0x16957c[_0xfa97('0x18')],{'raw':_0x16957c[_0xfa97('0x19')]?_0x16957c['options'][_0xfa97('0x1a')]===undefined?!![]:![]:!![]})[_0xfa97('0xb')](function(_0x50a6f2){logger[_0xfa97('0xc')](_0xfa97('0x16'),_0x16957c);logger[_0xfa97('0xe')]('CreateSquareReport',_0x16957c,JSON['stringify'](_0x50a6f2));_0x483c62(_0x50a6f2);})['catch'](function(_0x2d829c){logger[_0xfa97('0x11')](_0xfa97('0x16'),_0x2d829c['message'],_0x16957c);_0x548644(_0x203ec1[_0xfa97('0x11')](0x1f4,_0x2d829c[_0xfa97('0x13')]));});});};exports[_0xfa97('0x1b')]=function(_0x210471){var _0x3b9083=this;return new Promise(function(_0x15c472,_0x190b10){return db[_0xfa97('0x17')][_0xfa97('0x1c')](_0x210471[_0xfa97('0x18')],{'raw':_0x210471[_0xfa97('0x19')]?_0x210471[_0xfa97('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x210471['options']?_0x210471['options']['where']||null:null,'attributes':_0x210471[_0xfa97('0x19')]?_0x210471[_0xfa97('0x19')][_0xfa97('0x1d')]||null:null,'limit':_0x210471['options']?_0x210471[_0xfa97('0x19')][_0xfa97('0x1e')]||null:null})[_0xfa97('0xb')](function(_0x1d6eab){logger[_0xfa97('0xc')]('UpdateSquareReport',_0x210471);logger[_0xfa97('0xe')](_0xfa97('0x1b'),_0x210471,JSON[_0xfa97('0x1f')](_0x1d6eab));_0x15c472(_0x1d6eab);})[_0xfa97('0x15')](function(_0x2f7108){logger[_0xfa97('0x11')](_0xfa97('0x1b'),_0x2f7108[_0xfa97('0x13')],_0x210471);_0x190b10(_0x3b9083[_0xfa97('0x11')](0x1f4,_0x2f7108[_0xfa97('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6336472..407c83b 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 _0x5981=['show','post','create','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id'];(function(_0x170b8f,_0x4f2971){var _0x52d616=function(_0xe42e4e){while(--_0xe42e4e){_0x170b8f['push'](_0x170b8f['shift']());}};_0x52d616(++_0x4f2971);}(_0x5981,0xd1));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1598('0x0'));var util=require(_0x1598('0x1'));var path=require(_0x1598('0x2'));var express=require(_0x1598('0x3'));var router=express[_0x1598('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1598('0x5'));var config=require(_0x1598('0x6'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x1598('0x7')](),controller['index']);router[_0x1598('0x8')](_0x1598('0x9'),auth[_0x1598('0x7')](),controller[_0x1598('0xa')]);router[_0x1598('0x8')](_0x1598('0xb'),auth[_0x1598('0x7')](),controller[_0x1598('0xc')]);router[_0x1598('0xd')]('/',auth['isAuthenticated'](),controller[_0x1598('0xe')]);router['put']('/:id',auth[_0x1598('0x7')](),controller['update']);router[_0x1598('0xf')](_0x1598('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1598('0x10')]=router; \ No newline at end of file +var _0xffa0=['create','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post'];(function(_0x3e5b7b,_0x1ca279){var _0x441af8=function(_0x3931e7){while(--_0x3931e7){_0x3e5b7b['push'](_0x3e5b7b['shift']());}};_0x441af8(++_0x1ca279);}(_0xffa0,0x8a));var _0x0ffa=function(_0x40cb7c,_0x5c4519){_0x40cb7c=_0x40cb7c-0x0;var _0x137c65=_0xffa0[_0x40cb7c];return _0x137c65;};'use strict';var multer=require(_0x0ffa('0x0'));var util=require(_0x0ffa('0x1'));var path=require(_0x0ffa('0x2'));var express=require('express');var router=express[_0x0ffa('0x3')]();var auth=require(_0x0ffa('0x4'));var interaction=require(_0x0ffa('0x5'));var config=require(_0x0ffa('0x6'));var controller=require('./squareReportDetail.controller');router[_0x0ffa('0x7')]('/',auth['isAuthenticated'](),controller[_0x0ffa('0x8')]);router[_0x0ffa('0x7')](_0x0ffa('0x9'),auth[_0x0ffa('0xa')](),controller[_0x0ffa('0xb')]);router['get'](_0x0ffa('0xc'),auth[_0x0ffa('0xa')](),controller['show']);router[_0x0ffa('0xd')]('/',auth[_0x0ffa('0xa')](),controller[_0x0ffa('0xe')]);router['put'](_0x0ffa('0xc'),auth['isAuthenticated'](),controller[_0x0ffa('0xf')]);router[_0x0ffa('0x10')](_0x0ffa('0xc'),auth[_0x0ffa('0xa')](),controller[_0x0ffa('0x11')]);module[_0x0ffa('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index fec7243..e636a27 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 _0xb0e3=['STRING','exports'];(function(_0x7f3065,_0x443761){var _0x883049=function(_0x14c79b){while(--_0x14c79b){_0x7f3065['push'](_0x7f3065['shift']());}};_0x883049(++_0x443761);}(_0xb0e3,0x17d));var _0x3b0e=function(_0x9eb941,_0x5c02fa){_0x9eb941=_0x9eb941-0x0;var _0x48ad62=_0xb0e3[_0x9eb941];return _0x48ad62;};'use strict';var Sequelize=require('sequelize');module[_0x3b0e('0x0')]={'uniqueid':{'type':Sequelize[_0x3b0e('0x1')]},'node':{'type':Sequelize[_0x3b0e('0x1')]},'application':{'type':Sequelize[_0x3b0e('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3b0e('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb2fd=['STRING','TEXT','sequelize','exports'];(function(_0x4e6fda,_0x2c02f3){var _0x40ad68=function(_0x5cbe66){while(--_0x5cbe66){_0x4e6fda['push'](_0x4e6fda['shift']());}};_0x40ad68(++_0x2c02f3);}(_0xb2fd,0x186));var _0xdb2f=function(_0x2cfa47,_0x5cd4ff){_0x2cfa47=_0x2cfa47-0x0;var _0x4ebae5=_0xb2fd[_0x2cfa47];return _0x4ebae5;};'use strict';var Sequelize=require(_0xdb2f('0x0'));module[_0xdb2f('0x1')]={'uniqueid':{'type':Sequelize[_0xdb2f('0x2')]},'node':{'type':Sequelize[_0xdb2f('0x2')]},'application':{'type':Sequelize[_0xdb2f('0x2')]},'data':{'type':Sequelize[_0xdb2f('0x3')]},'project_name':{'type':Sequelize[_0xdb2f('0x2')]},'callerid':{'type':Sequelize[_0xdb2f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 238f893..d5d55b6 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 _0xf62b=['name','send','index','SquareDetailsReport','model','dateStart','dateEnd','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','add','day','merge','filter','count','then','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','reject','save','update','destroy','end','error','stack'];(function(_0xcd0828,_0x329e11){var _0x38e67d=function(_0x1cab02){while(--_0x1cab02){_0xcd0828['push'](_0xcd0828['shift']());}};_0x38e67d(++_0x329e11);}(_0xf62b,0x1cf));var _0xbf62=function(_0x12e1fa,_0x44e981){_0x12e1fa=_0x12e1fa-0x0;var _0x1e743e=_0xf62b[_0x12e1fa];return _0x1e743e;};'use strict';var jsonpatch=require(_0xbf62('0x0'));var rp=require('request-promise');var moment=require(_0xbf62('0x1'));var BPromise=require(_0xbf62('0x2'));var Mustache=require(_0xbf62('0x3'));var util=require(_0xbf62('0x4'));var path=require(_0xbf62('0x5'));var sox=require('sox');var csv=require(_0xbf62('0x6'));var ejs=require(_0xbf62('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbf62('0x8'));var crypto=require(_0xbf62('0x9'));var jsforce=require(_0xbf62('0xa'));var deskjs=require(_0xbf62('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbf62('0xc'));var Papa=require(_0xbf62('0xd'));var qs=require(_0xbf62('0xe'));var logger=require(_0xbf62('0xf'))(_0xbf62('0x10'));var utils=require(_0xbf62('0x11'));var config=require(_0xbf62('0x12'));var db=require(_0xbf62('0x13'))['db'];function respondWithStatusCode(_0x59af5a,_0x2ee65a){_0x2ee65a=_0x2ee65a||0xcc;return function(_0x5c6a08){if(_0x5c6a08){return _0x59af5a[_0xbf62('0x14')](_0x2ee65a);}return _0x59af5a['status'](_0x2ee65a)['end']();};}function respondWithResult(_0x2f6ce7,_0x14ba3c){_0x14ba3c=_0x14ba3c||0xc8;return function(_0x9cdbbd){if(_0x9cdbbd){return _0x2f6ce7['status'](_0x14ba3c)[_0xbf62('0x15')](_0x9cdbbd);}};}function respondWithFilteredResult(_0x2a6d8c,_0xbc13ac){return function(_0x12f5e7){if(_0x12f5e7){var _0x1ca1fa=_0x12f5e7['count'],_0x57a78b=_0xbc13ac[_0xbf62('0x16')],_0x2fce5c=_0xbc13ac[_0xbf62('0x16')]+_0xbc13ac[_0xbf62('0x17')],_0x1e68c1;if(_0x2fce5c>=_0x1ca1fa){_0x2fce5c=_0x1ca1fa;_0x1e68c1=0xc8;}else{_0x1e68c1=0xce;}_0x2a6d8c[_0xbf62('0x18')](_0x1e68c1);return _0x2a6d8c[_0xbf62('0x19')](_0xbf62('0x1a'),_0x57a78b+'-'+_0x2fce5c+'/'+_0x1ca1fa)['json'](_0x12f5e7);}return null;};}function patchUpdates(_0x226d08){return function(_0x431441){try{jsonpatch['apply'](_0x431441,_0x226d08,!![]);}catch(_0x108870){return BPromise[_0xbf62('0x1b')](_0x108870);}return _0x431441[_0xbf62('0x1c')]();};}function saveUpdates(_0x58050f,_0x1a03aa){return function(_0x264c08){if(_0x264c08){return _0x264c08[_0xbf62('0x1d')](_0x58050f)['then'](function(_0x233350){return _0x233350;});}return null;};}function removeEntity(_0xe8f5dc,_0x3d220b){return function(_0x1ad815){if(_0x1ad815){return _0x1ad815[_0xbf62('0x1e')]()['then'](function(){_0xe8f5dc[_0xbf62('0x18')](0xcc)[_0xbf62('0x1f')]();});}};}function handleEntityNotFound(_0x1f59a5,_0x4ac454){return function(_0x784672){if(!_0x784672){_0x1f59a5[_0xbf62('0x14')](0x194);}return _0x784672;};}function handleError(_0x11a4ec,_0x4c8707){_0x4c8707=_0x4c8707||0x1f4;return function(_0xedff74){logger[_0xbf62('0x20')](_0xedff74[_0xbf62('0x21')]);if(_0xedff74[_0xbf62('0x22')]){delete _0xedff74[_0xbf62('0x22')];}_0x11a4ec['status'](_0x4c8707)[_0xbf62('0x23')](_0xedff74);};}exports[_0xbf62('0x24')]=function(_0x427fc7,_0xf38133){var _0x208ae3={},_0x1f226d={},_0x1b5477={'count':0x0,'rows':[]};var _0x408e8e=db[_0xbf62('0x25')]['rawAttributes'];_0x1f226d[_0xbf62('0x26')]=_['keys'](_0x408e8e);var _0x24c0d6={'dateStart':_0x427fc7['query'][_0xbf62('0x27')],'dateEnd':_0x427fc7['query'][_0xbf62('0x28')]};delete _0x427fc7[_0xbf62('0x29')][_0xbf62('0x27')];delete _0x427fc7[_0xbf62('0x29')][_0xbf62('0x28')];_0x1f226d[_0xbf62('0x29')]=_[_0xbf62('0x2a')](_0x427fc7[_0xbf62('0x29')]);_0x1f226d['filters']=_[_0xbf62('0x2b')](_0x1f226d['model'],_0x1f226d[_0xbf62('0x29')]);_0x208ae3[_0xbf62('0x2c')]=_['intersection'](_0x1f226d['model'],qs[_0xbf62('0x2d')](_0x427fc7[_0xbf62('0x29')][_0xbf62('0x2d')]));_0x208ae3[_0xbf62('0x2c')]=_0x208ae3[_0xbf62('0x2c')][_0xbf62('0x2e')]?_0x208ae3[_0xbf62('0x2c')]:_0x1f226d[_0xbf62('0x26')];if(!_0x427fc7['query']['hasOwnProperty'](_0xbf62('0x2f'))){_0x208ae3[_0xbf62('0x17')]=qs[_0xbf62('0x17')](_0x427fc7[_0xbf62('0x29')][_0xbf62('0x17')]);_0x208ae3[_0xbf62('0x16')]=qs[_0xbf62('0x16')](_0x427fc7[_0xbf62('0x29')][_0xbf62('0x16')]);}_0x208ae3[_0xbf62('0x30')]=qs[_0xbf62('0x31')](_0x427fc7[_0xbf62('0x29')][_0xbf62('0x31')]);_0x208ae3[_0xbf62('0x32')]=qs[_0xbf62('0x33')](_[_0xbf62('0x34')](_0x427fc7[_0xbf62('0x29')],_0x1f226d['filters']));if(_0x24c0d6[_0xbf62('0x27')]){if(_0x24c0d6[_0xbf62('0x28')]){_0x24c0d6['dateEnd']=moment(_0x24c0d6['dateEnd'])[_0xbf62('0x35')](0x1,_0xbf62('0x36'));}else{_0x24c0d6[_0xbf62('0x28')]=moment(_0x24c0d6[_0xbf62('0x27')])['add'](0x1,_0xbf62('0x36'));}_[_0xbf62('0x37')](_0x208ae3[_0xbf62('0x32')],{'createdAt':{'$gte':_0x24c0d6[_0xbf62('0x27')],'$lte':_0x24c0d6['dateEnd']}});}if(_0x427fc7[_0xbf62('0x29')][_0xbf62('0x38')]){_0x208ae3[_0xbf62('0x32')]=_[_0xbf62('0x37')](_0x208ae3[_0xbf62('0x32')],{'$or':_['map'](_0x208ae3['attributes'],function(_0x67b4bf){var _0x34063e={};_0x34063e[_0x67b4bf]={'$like':'%'+_0x427fc7[_0xbf62('0x29')]['filter']+'%'};return _0x34063e;})});}_0x208ae3=_[_0xbf62('0x37')]({},_0x208ae3,_0x427fc7['options']);var _0x3e43a2={'where':_0x208ae3[_0xbf62('0x32')]};return db[_0xbf62('0x25')][_0xbf62('0x39')](_0x3e43a2)[_0xbf62('0x3a')](function(_0xb0272e){_0x1b5477['count']=_0xb0272e;if(_0x427fc7[_0xbf62('0x29')][_0xbf62('0x3b')]){_0x208ae3[_0xbf62('0x3c')]=[{'all':!![]}];}return db[_0xbf62('0x25')][_0xbf62('0x3d')](_0x208ae3);})[_0xbf62('0x3a')](function(_0xefe38f){_0x1b5477[_0xbf62('0x3e')]=_0xefe38f;return _0x1b5477;})[_0xbf62('0x3a')](respondWithFilteredResult(_0xf38133,_0x208ae3))[_0xbf62('0x3f')](handleError(_0xf38133,null));};exports[_0xbf62('0x40')]=function(_0x277e3b,_0x4b5559){var _0x571216={'raw':!![],'where':{'id':_0x277e3b[_0xbf62('0x41')]['id']}},_0x3852df={};_0x3852df[_0xbf62('0x26')]=_[_0xbf62('0x2a')](db[_0xbf62('0x25')]['rawAttributes']);_0x3852df[_0xbf62('0x29')]=_[_0xbf62('0x2a')](_0x277e3b[_0xbf62('0x29')]);_0x3852df[_0xbf62('0x33')]=_[_0xbf62('0x2b')](_0x3852df['model'],_0x3852df[_0xbf62('0x29')]);_0x571216[_0xbf62('0x2c')]=_['intersection'](_0x3852df[_0xbf62('0x26')],qs[_0xbf62('0x2d')](_0x277e3b[_0xbf62('0x29')][_0xbf62('0x2d')]));_0x571216[_0xbf62('0x2c')]=_0x571216[_0xbf62('0x2c')][_0xbf62('0x2e')]?_0x571216[_0xbf62('0x2c')]:_0x3852df[_0xbf62('0x26')];if(_0x277e3b[_0xbf62('0x29')][_0xbf62('0x3b')]){_0x571216[_0xbf62('0x3c')]=[{'all':!![]}];}_0x571216=_[_0xbf62('0x37')]({},_0x571216,_0x277e3b[_0xbf62('0x42')]);return db[_0xbf62('0x25')][_0xbf62('0x43')](_0x571216)['then'](handleEntityNotFound(_0x4b5559,null))['then'](respondWithResult(_0x4b5559,null))[_0xbf62('0x3f')](handleError(_0x4b5559,null));};exports['create']=function(_0x17e902,_0x5e453f){return db['SquareDetailsReport'][_0xbf62('0x44')](_0x17e902[_0xbf62('0x45')],{})['then'](respondWithResult(_0x5e453f,0xc9))[_0xbf62('0x3f')](handleError(_0x5e453f,null));};exports[_0xbf62('0x1d')]=function(_0xe05d09,_0x1e9d8e){if(_0xe05d09[_0xbf62('0x45')]['id']){delete _0xe05d09['body']['id'];}return db[_0xbf62('0x25')][_0xbf62('0x43')]({'where':{'id':_0xe05d09[_0xbf62('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e9d8e,null))[_0xbf62('0x3a')](saveUpdates(_0xe05d09[_0xbf62('0x45')],null))[_0xbf62('0x3a')](respondWithResult(_0x1e9d8e,null))['catch'](handleError(_0x1e9d8e,null));};exports[_0xbf62('0x1e')]=function(_0x31c807,_0x515b05){return db[_0xbf62('0x25')][_0xbf62('0x43')]({'where':{'id':_0x31c807[_0xbf62('0x41')]['id']}})[_0xbf62('0x3a')](handleEntityNotFound(_0x515b05,null))['then'](removeEntity(_0x515b05,null))[_0xbf62('0x3f')](handleError(_0x515b05,null));};exports['describe']=function(_0x5b1650,_0xb242b6){return db['SquareDetailsReport'][_0xbf62('0x46')]()['then'](respondWithResult(_0xb242b6,null))[_0xbf62('0x3f')](handleError(_0xb242b6,null));}; \ No newline at end of file +var _0x74ac=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','describe','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../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','then','error','stack','name','send','index','SquareDetailsReport','model','keys','query','dateEnd','dateStart','filters','intersection','attributes'];(function(_0xd94ff1,_0x354674){var _0x528e93=function(_0x2c380b){while(--_0x2c380b){_0xd94ff1['push'](_0xd94ff1['shift']());}};_0x528e93(++_0x354674);}(_0x74ac,0xa3));var _0xc74a=function(_0x330144,_0x3a7f25){_0x330144=_0x330144-0x0;var _0x14800b=_0x74ac[_0x330144];return _0x14800b;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc74a('0x0'));var moment=require('moment');var BPromise=require(_0xc74a('0x1'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc74a('0x2'));var csv=require(_0xc74a('0x3'));var ejs=require(_0xc74a('0x4'));var fs=require('fs');var _=require(_0xc74a('0x5'));var squel=require(_0xc74a('0x6'));var crypto=require(_0xc74a('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xc74a('0x8'));var toCsv=require(_0xc74a('0x3'));var querystring=require(_0xc74a('0x9'));var Papa=require('papaparse');var qs=require(_0xc74a('0xa'));var logger=require(_0xc74a('0xb'))(_0xc74a('0xc'));var utils=require(_0xc74a('0xd'));var config=require(_0xc74a('0xe'));var db=require(_0xc74a('0xf'))['db'];function respondWithStatusCode(_0x54bbb3,_0xf0a48f){_0xf0a48f=_0xf0a48f||0xcc;return function(_0x4249e8){if(_0x4249e8){return _0x54bbb3[_0xc74a('0x10')](_0xf0a48f);}return _0x54bbb3[_0xc74a('0x11')](_0xf0a48f)[_0xc74a('0x12')]();};}function respondWithResult(_0x60123c,_0x3cba4b){_0x3cba4b=_0x3cba4b||0xc8;return function(_0x5037ed){if(_0x5037ed){return _0x60123c[_0xc74a('0x11')](_0x3cba4b)[_0xc74a('0x13')](_0x5037ed);}};}function respondWithFilteredResult(_0x502f3c,_0x2781e7){return function(_0x12bb92){if(_0x12bb92){var _0x176fc7=_0x12bb92[_0xc74a('0x14')],_0x1b9c78=_0x2781e7[_0xc74a('0x15')],_0x21c12a=_0x2781e7[_0xc74a('0x15')]+_0x2781e7[_0xc74a('0x16')],_0x5538d0;if(_0x21c12a>=_0x176fc7){_0x21c12a=_0x176fc7;_0x5538d0=0xc8;}else{_0x5538d0=0xce;}_0x502f3c[_0xc74a('0x11')](_0x5538d0);return _0x502f3c[_0xc74a('0x17')](_0xc74a('0x18'),_0x1b9c78+'-'+_0x21c12a+'/'+_0x176fc7)[_0xc74a('0x13')](_0x12bb92);}return null;};}function patchUpdates(_0x14523a){return function(_0x5387f2){try{jsonpatch[_0xc74a('0x19')](_0x5387f2,_0x14523a,!![]);}catch(_0x8faab0){return BPromise[_0xc74a('0x1a')](_0x8faab0);}return _0x5387f2[_0xc74a('0x1b')]();};}function saveUpdates(_0x2418ef,_0xfd7522){return function(_0x5e7970){if(_0x5e7970){return _0x5e7970[_0xc74a('0x1c')](_0x2418ef)[_0xc74a('0x1d')](function(_0x40b596){return _0x40b596;});}return null;};}function removeEntity(_0x280861,_0x492843){return function(_0x5d7fcb){if(_0x5d7fcb){return _0x5d7fcb['destroy']()[_0xc74a('0x1d')](function(){_0x280861[_0xc74a('0x11')](0xcc)[_0xc74a('0x12')]();});}};}function handleEntityNotFound(_0x2e713d,_0x288251){return function(_0x481368){if(!_0x481368){_0x2e713d[_0xc74a('0x10')](0x194);}return _0x481368;};}function handleError(_0x4c6b3a,_0x2114d3){_0x2114d3=_0x2114d3||0x1f4;return function(_0x17351d){logger[_0xc74a('0x1e')](_0x17351d[_0xc74a('0x1f')]);if(_0x17351d[_0xc74a('0x20')]){delete _0x17351d['name'];}_0x4c6b3a['status'](_0x2114d3)[_0xc74a('0x21')](_0x17351d);};}exports[_0xc74a('0x22')]=function(_0x3c5c06,_0xed9d20){var _0x5f1fc6={},_0x2f6a6a={},_0x159368={'count':0x0,'rows':[]};var _0x286c18=db[_0xc74a('0x23')]['rawAttributes'];_0x2f6a6a[_0xc74a('0x24')]=_[_0xc74a('0x25')](_0x286c18);var _0x41aa06={'dateStart':_0x3c5c06[_0xc74a('0x26')]['dateStart'],'dateEnd':_0x3c5c06[_0xc74a('0x26')][_0xc74a('0x27')]};delete _0x3c5c06[_0xc74a('0x26')][_0xc74a('0x28')];delete _0x3c5c06[_0xc74a('0x26')][_0xc74a('0x27')];_0x2f6a6a['query']=_[_0xc74a('0x25')](_0x3c5c06[_0xc74a('0x26')]);_0x2f6a6a[_0xc74a('0x29')]=_[_0xc74a('0x2a')](_0x2f6a6a[_0xc74a('0x24')],_0x2f6a6a['query']);_0x5f1fc6[_0xc74a('0x2b')]=_[_0xc74a('0x2a')](_0x2f6a6a[_0xc74a('0x24')],qs['fields'](_0x3c5c06[_0xc74a('0x26')][_0xc74a('0x2c')]));_0x5f1fc6[_0xc74a('0x2b')]=_0x5f1fc6[_0xc74a('0x2b')][_0xc74a('0x2d')]?_0x5f1fc6[_0xc74a('0x2b')]:_0x2f6a6a[_0xc74a('0x24')];if(!_0x3c5c06[_0xc74a('0x26')][_0xc74a('0x2e')](_0xc74a('0x2f'))){_0x5f1fc6[_0xc74a('0x16')]=qs[_0xc74a('0x16')](_0x3c5c06['query'][_0xc74a('0x16')]);_0x5f1fc6[_0xc74a('0x15')]=qs[_0xc74a('0x15')](_0x3c5c06[_0xc74a('0x26')][_0xc74a('0x15')]);}_0x5f1fc6[_0xc74a('0x30')]=qs['sort'](_0x3c5c06[_0xc74a('0x26')][_0xc74a('0x31')]);_0x5f1fc6[_0xc74a('0x32')]=qs[_0xc74a('0x29')](_[_0xc74a('0x33')](_0x3c5c06['query'],_0x2f6a6a[_0xc74a('0x29')]));if(_0x41aa06[_0xc74a('0x28')]){if(_0x41aa06[_0xc74a('0x27')]){_0x41aa06[_0xc74a('0x27')]=moment(_0x41aa06[_0xc74a('0x27')])[_0xc74a('0x34')](0x1,_0xc74a('0x35'));}else{_0x41aa06[_0xc74a('0x27')]=moment(_0x41aa06[_0xc74a('0x28')])[_0xc74a('0x34')](0x1,_0xc74a('0x35'));}_[_0xc74a('0x36')](_0x5f1fc6[_0xc74a('0x32')],{'createdAt':{'$gte':_0x41aa06['dateStart'],'$lte':_0x41aa06[_0xc74a('0x27')]}});}if(_0x3c5c06[_0xc74a('0x26')][_0xc74a('0x37')]){_0x5f1fc6['where']=_[_0xc74a('0x36')](_0x5f1fc6['where'],{'$or':_['map'](_0x5f1fc6['attributes'],function(_0x5beb72){var _0x3f1413={};_0x3f1413[_0x5beb72]={'$like':'%'+_0x3c5c06['query'][_0xc74a('0x37')]+'%'};return _0x3f1413;})});}_0x5f1fc6=_[_0xc74a('0x36')]({},_0x5f1fc6,_0x3c5c06['options']);var _0x1bfe38={'where':_0x5f1fc6['where']};return db[_0xc74a('0x23')][_0xc74a('0x14')](_0x1bfe38)[_0xc74a('0x1d')](function(_0x5e43b5){_0x159368[_0xc74a('0x14')]=_0x5e43b5;if(_0x3c5c06[_0xc74a('0x26')][_0xc74a('0x38')]){_0x5f1fc6[_0xc74a('0x39')]=[{'all':!![]}];}return db[_0xc74a('0x23')][_0xc74a('0x3a')](_0x5f1fc6);})[_0xc74a('0x1d')](function(_0x1c4960){_0x159368[_0xc74a('0x3b')]=_0x1c4960;return _0x159368;})[_0xc74a('0x1d')](respondWithFilteredResult(_0xed9d20,_0x5f1fc6))[_0xc74a('0x3c')](handleError(_0xed9d20,null));};exports[_0xc74a('0x3d')]=function(_0x5f521b,_0x4d95fb){var _0x177e91={'raw':!![],'where':{'id':_0x5f521b['params']['id']}},_0x1d7616={};_0x1d7616[_0xc74a('0x24')]=_['keys'](db['SquareDetailsReport'][_0xc74a('0x3e')]);_0x1d7616[_0xc74a('0x26')]=_[_0xc74a('0x25')](_0x5f521b[_0xc74a('0x26')]);_0x1d7616[_0xc74a('0x29')]=_['intersection'](_0x1d7616[_0xc74a('0x24')],_0x1d7616['query']);_0x177e91[_0xc74a('0x2b')]=_[_0xc74a('0x2a')](_0x1d7616[_0xc74a('0x24')],qs['fields'](_0x5f521b[_0xc74a('0x26')][_0xc74a('0x2c')]));_0x177e91[_0xc74a('0x2b')]=_0x177e91[_0xc74a('0x2b')][_0xc74a('0x2d')]?_0x177e91[_0xc74a('0x2b')]:_0x1d7616[_0xc74a('0x24')];if(_0x5f521b[_0xc74a('0x26')][_0xc74a('0x38')]){_0x177e91['include']=[{'all':!![]}];}_0x177e91=_[_0xc74a('0x36')]({},_0x177e91,_0x5f521b['options']);return db[_0xc74a('0x23')][_0xc74a('0x3f')](_0x177e91)[_0xc74a('0x1d')](handleEntityNotFound(_0x4d95fb,null))[_0xc74a('0x1d')](respondWithResult(_0x4d95fb,null))['catch'](handleError(_0x4d95fb,null));};exports[_0xc74a('0x40')]=function(_0x5c90f1,_0x2896f2){return db[_0xc74a('0x23')][_0xc74a('0x40')](_0x5c90f1[_0xc74a('0x41')],{})[_0xc74a('0x1d')](respondWithResult(_0x2896f2,0xc9))['catch'](handleError(_0x2896f2,null));};exports[_0xc74a('0x1c')]=function(_0x459bf6,_0x585f42){if(_0x459bf6[_0xc74a('0x41')]['id']){delete _0x459bf6['body']['id'];}return db[_0xc74a('0x23')][_0xc74a('0x3f')]({'where':{'id':_0x459bf6[_0xc74a('0x42')]['id']}})[_0xc74a('0x1d')](handleEntityNotFound(_0x585f42,null))[_0xc74a('0x1d')](saveUpdates(_0x459bf6[_0xc74a('0x41')],null))[_0xc74a('0x1d')](respondWithResult(_0x585f42,null))[_0xc74a('0x3c')](handleError(_0x585f42,null));};exports[_0xc74a('0x43')]=function(_0x762482,_0x5f8f6c){return db['SquareDetailsReport'][_0xc74a('0x3f')]({'where':{'id':_0x762482['params']['id']}})[_0xc74a('0x1d')](handleEntityNotFound(_0x5f8f6c,null))['then'](removeEntity(_0x5f8f6c,null))[_0xc74a('0x3c')](handleError(_0x5f8f6c,null));};exports['describe']=function(_0x585b31,_0x5c7172){return db[_0xc74a('0x23')][_0xc74a('0x44')]()[_0xc74a('0x1d')](respondWithResult(_0x5c7172,null))['catch'](handleError(_0x5c7172,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ab71c0c..e5dcc05 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 _0x7549=['exports','define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','./squareReportDetail.attributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7549,0x1ed));var _0x9754=function(_0x26f56b,_0x16602e){_0x26f56b=_0x26f56b-0x0;var _0x21c0f7=_0x7549[_0x26f56b];return _0x21c0f7;};'use strict';var _=require(_0x9754('0x0'));var util=require(_0x9754('0x1'));var logger=require(_0x9754('0x2'))(_0x9754('0x3'));var moment=require(_0x9754('0x4'));var BPromise=require(_0x9754('0x5'));var rp=require('request-promise');var attributes=require(_0x9754('0x6'));module[_0x9754('0x7')]=function(_0x5e8dae,_0xb96bf1){return _0x5e8dae[_0x9754('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x9754('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc89=['api','moment','bluebird','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x1acfe1,_0x2fea35){var _0x42e090=function(_0x3614cc){while(--_0x3614cc){_0x1acfe1['push'](_0x1acfe1['shift']());}};_0x42e090(++_0x2fea35);}(_0xcc89,0x15c));var _0x9cc8=function(_0x145771,_0x244be2){_0x145771=_0x145771-0x0;var _0x587c1e=_0xcc89[_0x145771];return _0x587c1e;};'use strict';var _=require(_0x9cc8('0x0'));var util=require(_0x9cc8('0x1'));var logger=require('../../config/logger')(_0x9cc8('0x2'));var moment=require(_0x9cc8('0x3'));var BPromise=require(_0x9cc8('0x4'));var rp=require('request-promise');var attributes=require(_0x9cc8('0x5'));module[_0x9cc8('0x6')]=function(_0x3c61af,_0x26eb4b){return _0x3c61af[_0x9cc8('0x7')](_0x9cc8('0x8'),attributes,{'tableName':_0x9cc8('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 125d85b..708f8a2 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 _0x7a54=['result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x1eef13,_0x2e44c3){var _0x5a0406=function(_0xd47528){while(--_0xd47528){_0x1eef13['push'](_0x1eef13['shift']());}};_0x5a0406(++_0x2e44c3);}(_0x7a54,0x106));var _0x47a5=function(_0x42a1a1,_0x5c9379){_0x42a1a1=_0x42a1a1-0x0;var _0x24872f=_0x7a54[_0x42a1a1];return _0x24872f;};'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 db=require(_0x47a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var jayson=require(_0x47a5('0x8'));var client=jayson[_0x47a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5629,_0x59199c,_0x343372){return new BPromise(function(_0x30e405,_0x506eda){return client[_0x47a5('0xa')](_0x3d5629,_0x343372)['then'](function(_0x5d90b3){logger['info'](_0x47a5('0xb'),_0x59199c,_0x47a5('0xc'));logger['debug'](_0x47a5('0xd'),_0x59199c,'request\x20sent',JSON['stringify'](_0x5d90b3));if(_0x5d90b3[_0x47a5('0xe')]){if(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0xf')]===0x1f4){logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x506eda(_0x5d90b3['error'][_0x47a5('0x10')]);}logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x30e405(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);}else{logger[_0x47a5('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x59199c,_0x47a5('0xc'));_0x30e405(_0x5d90b3[_0x47a5('0x12')][_0x47a5('0x10')]);}})[_0x47a5('0x13')](function(_0x1ef44c){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x59199c,_0x1ef44c);_0x506eda(_0x1ef44c);});});}exports[_0x47a5('0x14')]=function(_0x4b966e){var _0x5247fd=this;return new Promise(function(_0x423a81,_0xaf70a6){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x4b966e[_0x47a5('0x17')],{'raw':_0x4b966e[_0x47a5('0x18')]?_0x4b966e[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})[_0x47a5('0x1a')](function(_0x4a9fcb){logger[_0x47a5('0x11')](_0x47a5('0x14'),_0x4b966e);logger['debug'](_0x47a5('0x14'),_0x4b966e,JSON[_0x47a5('0x1b')](_0x4a9fcb));_0x423a81(_0x4a9fcb);})[_0x47a5('0x13')](function(_0x4c5910){logger[_0x47a5('0xe')](_0x47a5('0x14'),_0x4c5910[_0x47a5('0x10')],_0x4b966e);_0xaf70a6(_0x5247fd[_0x47a5('0xe')](0x1f4,_0x4c5910['message']));});});}; \ No newline at end of file +var _0x9957=['client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateSquareDetailsReport','body','raw','then','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x34a6e9,_0x25cabe){var _0x11015c=function(_0x5c2ced){while(--_0x5c2ced){_0x34a6e9['push'](_0x34a6e9['shift']());}};_0x11015c(++_0x25cabe);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 db=require(_0x7995('0x4'))['db'];var utils=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var jayson=require(_0x7995('0x8'));var client=jayson[_0x7995('0x9')][_0x7995('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219534,_0xbda126,_0x326741){return new BPromise(function(_0x4996ca,_0x465276){return client[_0x7995('0xb')](_0x219534,_0x326741)['then'](function(_0xa2e5f0){logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));logger[_0x7995('0xf')](_0x7995('0x10'),_0xbda126,_0x7995('0xe'),JSON['stringify'](_0xa2e5f0));if(_0xa2e5f0[_0x7995('0x11')]){if(_0xa2e5f0[_0x7995('0x11')]['code']===0x1f4){logger[_0x7995('0x11')](_0x7995('0xd'),_0xbda126,_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);return _0x465276(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}logger[_0x7995('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0xbda126,_0xa2e5f0['error'][_0x7995('0x12')]);return _0x4996ca(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}else{logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));_0x4996ca(_0xa2e5f0[_0x7995('0x13')][_0x7995('0x12')]);}})['catch'](function(_0x2eeacc){logger['error'](_0x7995('0xd'),_0xbda126,_0x2eeacc);_0x465276(_0x2eeacc);});});}exports[_0x7995('0x14')]=function(_0x43d4b8){var _0x291317=this;return new Promise(function(_0x1e1415,_0x37a7d4){return db['SquareDetailsReport']['create'](_0x43d4b8[_0x7995('0x15')],{'raw':_0x43d4b8['options']?_0x43d4b8['options'][_0x7995('0x16')]===undefined?!![]:![]:!![]})[_0x7995('0x17')](function(_0x4cbe10){logger[_0x7995('0xc')]('CreateSquareDetailsReport',_0x43d4b8);logger['debug'](_0x7995('0x14'),_0x43d4b8,JSON[_0x7995('0x18')](_0x4cbe10));_0x1e1415(_0x4cbe10);})[_0x7995('0x19')](function(_0x1a8568){logger[_0x7995('0x11')](_0x7995('0x14'),_0x1a8568['message'],_0x43d4b8);_0x37a7d4(_0x291317[_0x7995('0x11')](0x1f4,_0x1a8568[_0x7995('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index c186a4d..9f3063c 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 _0xe527=['exports','express','Router','./system.controller','isAuthenticated','get','/process/:pid/kill'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xe527,0x12e));var _0x7e52=function(_0x339161,_0x12de59){_0x339161=_0x339161-0x0;var _0x59402d=_0xe527[_0x339161];return _0x59402d;};'use strict';var express=require(_0x7e52('0x0'));var router=express[_0x7e52('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x7e52('0x2'));router['get']('/',auth[_0x7e52('0x3')](),controller['index']);router[_0x7e52('0x4')](_0x7e52('0x5'),auth[_0x7e52('0x3')](),controller['killProcess']);module[_0x7e52('0x6')]=router; \ No newline at end of file +var _0xa4d9=['/process/:pid/kill','express','Router','./system.controller','get','isAuthenticated','index'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa4d9,0x1f2));var _0x9a4d=function(_0x59ce0c,_0x57ad27){_0x59ce0c=_0x59ce0c-0x0;var _0x135c1a=_0xa4d9[_0x59ce0c];return _0x135c1a;};'use strict';var express=require(_0x9a4d('0x0'));var router=express[_0x9a4d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9a4d('0x2'));router[_0x9a4d('0x3')]('/',auth[_0x9a4d('0x4')](),controller[_0x9a4d('0x5')]);router['get'](_0x9a4d('0x6'),auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index bb5afcf..eb67b9a 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 _0xb8e5=['inspect','name','send','index','then','status','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','systeminformation','child_process','exec','../../config/logger','util','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x46547d,_0x18a98b){var _0x211f4a=function(_0x1e0ee5){while(--_0x1e0ee5){_0x46547d['push'](_0x46547d['shift']());}};_0x211f4a(++_0x18a98b);}(_0xb8e5,0x132));var _0x5b8e=function(_0x5e6739,_0x2182dd){_0x5e6739=_0x5e6739-0x0;var _0x5182a5=_0xb8e5[_0x5e6739];return _0x5182a5;};'use strict';var info=require(_0x5b8e('0x0'));var exec=require(_0x5b8e('0x1'))[_0x5b8e('0x2')];var logger=require(_0x5b8e('0x3'))('api');var util=require(_0x5b8e('0x4'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x32ac58,_0x374ed1,_0x333086){_0x374ed1=_0x374ed1||0x1f4;return function(_0x5e4d6d){logger['error'](_0x5b8e('0x5'),_0x333086,_0x374ed1,util[_0x5b8e('0x6')](_0x5e4d6d,{'showHidden':![],'depth':null}));delete _0x5e4d6d[_0x5b8e('0x7')];_0x32ac58['status'](_0x374ed1)[_0x5b8e('0x8')](_0x5e4d6d);};}exports[_0x5b8e('0x9')]=function(_0x43dd39,_0x499f18){return info['getAllData']()[_0x5b8e('0xa')](function(_0xea35a){return _0x499f18[_0x5b8e('0xb')](0xc8)[_0x5b8e('0xc')](_0xea35a);})['catch'](function(_0x37cbbd){return _0x499f18[_0x5b8e('0xb')](0x1f4)[_0x5b8e('0xc')](_0x37cbbd);});};exports[_0x5b8e('0xd')]=function(_0x4a283f,_0x3f1fa0){var _0x219db6=[_0x5b8e('0xe')];return new BPromise(function(_0x2168f6,_0x3ca656){return exec(util[_0x5b8e('0xf')](_0x5b8e('0x10'),_0x4a283f['params'][_0x5b8e('0x11')]),function(_0x43e420,_0x18a489,_0x1a3fba){if(_0x43e420){return _0x3ca656(_0x43e420);}return _0x2168f6(_0x18a489);});})['then'](function(_0x5eba28){var _0x5cf243=![];var _0x4a8a65=_0x5eba28['split'](/\n/);for(var _0x1a0b32=0x0,_0x41b908=_0x219db6[_0x5b8e('0x12')];_0x1a0b32<_0x41b908,_0x5cf243===![];_0x1a0b32+=0x1){if(_0x5eba28[_0x5b8e('0x13')](_0x219db6[_0x1a0b32])>=0x0){_0x5cf243=!![];}}if(!_0x5cf243){throw new Error(util[_0x5b8e('0xf')](_0x5b8e('0x14'),_0x4a283f['params']['pid']));}process[_0x5b8e('0x15')](_0x4a283f[_0x5b8e('0x16')][_0x5b8e('0x11')],_0x5b8e('0x17'));return _0x3f1fa0[_0x5b8e('0xb')](0xc8)['json']({'message':util[_0x5b8e('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4a283f[_0x5b8e('0x16')][_0x5b8e('0x11')])});})['catch'](handleError(_0x3f1fa0,null,_0x5b8e('0xd')));}; \ No newline at end of file +var _0xd9ab=['Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','index','getAllData','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','indexOf'];(function(_0x11eae2,_0x31517a){var _0x567dbf=function(_0x6c8348){while(--_0x6c8348){_0x11eae2['push'](_0x11eae2['shift']());}};_0x567dbf(++_0x31517a);}(_0xd9ab,0xc1));var _0xbd9a=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xd9ab[_0x513aa5];return _0x1a1a7c;};'use strict';var info=require('systeminformation');var exec=require(_0xbd9a('0x0'))[_0xbd9a('0x1')];var logger=require(_0xbd9a('0x2'))(_0xbd9a('0x3'));var util=require(_0xbd9a('0x4'));var BPromise=require(_0xbd9a('0x5'));var _=require(_0xbd9a('0x6'));function handleError(_0x45ddcf,_0x451bf9,_0x3e96ba){_0x451bf9=_0x451bf9||0x1f4;return function(_0x40046c){logger[_0xbd9a('0x7')](_0xbd9a('0x8'),_0x3e96ba,_0x451bf9,util['inspect'](_0x40046c,{'showHidden':![],'depth':null}));delete _0x40046c[_0xbd9a('0x9')];_0x45ddcf['status'](_0x451bf9)['send'](_0x40046c);};}exports[_0xbd9a('0xa')]=function(_0x5e58a5,_0x53f32b){return info[_0xbd9a('0xb')]()[_0xbd9a('0xc')](function(_0x38a398){return _0x53f32b[_0xbd9a('0xd')](0xc8)[_0xbd9a('0xe')](_0x38a398);})[_0xbd9a('0xf')](function(_0x50ea0c){return _0x53f32b[_0xbd9a('0xd')](0x1f4)['json'](_0x50ea0c);});};exports[_0xbd9a('0x10')]=function(_0x4af29f,_0xd1781d){var _0x3753d1=[_0xbd9a('0x11')];return new BPromise(function(_0x8d17f3,_0x427915){return exec(util[_0xbd9a('0x12')](_0xbd9a('0x13'),_0x4af29f[_0xbd9a('0x14')]['pid']),function(_0x10581f,_0xe2a3ff,_0x1f1606){if(_0x10581f){return _0x427915(_0x10581f);}return _0x8d17f3(_0xe2a3ff);});})[_0xbd9a('0xc')](function(_0x62d8bb){var _0x1db034=![];var _0x248485=_0x62d8bb[_0xbd9a('0x15')](/\n/);for(var _0x285a62=0x0,_0x160b52=_0x3753d1['length'];_0x285a62<_0x160b52,_0x1db034===![];_0x285a62+=0x1){if(_0x62d8bb[_0xbd9a('0x16')](_0x3753d1[_0x285a62])>=0x0){_0x1db034=!![];}}if(!_0x1db034){throw new Error(util[_0xbd9a('0x12')](_0xbd9a('0x17'),_0x4af29f[_0xbd9a('0x14')][_0xbd9a('0x18')]));}process[_0xbd9a('0x19')](_0x4af29f[_0xbd9a('0x14')]['pid'],'SIGINT');return _0xd1781d[_0xbd9a('0xd')](0xc8)[_0xbd9a('0xe')]({'message':util[_0xbd9a('0x12')](_0xbd9a('0x1a'),_0x4af29f[_0xbd9a('0x14')]['pid'])});})[_0xbd9a('0xf')](handleError(_0xd1781d,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 165dcad..59e8eae 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 _0x51f9=['../../config/environment','isAuthenticated','index','get','/:id','post','create','update','delete','exports','multer','express','../../components/interaction/service'];(function(_0x53db0c,_0x4e7c08){var _0x4a526a=function(_0x4a0b53){while(--_0x4a0b53){_0x53db0c['push'](_0x53db0c['shift']());}};_0x4a526a(++_0x4e7c08);}(_0x51f9,0x1eb));var _0x951f=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x51f9[_0x55c1f0];return _0x1530fa;};'use strict';var multer=require(_0x951f('0x0'));var util=require('util');var path=require('path');var express=require(_0x951f('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x951f('0x2'));var config=require(_0x951f('0x3'));var controller=require('./tag.controller');router['get']('/',auth[_0x951f('0x4')](),controller[_0x951f('0x5')]);router[_0x951f('0x6')](_0x951f('0x7'),auth[_0x951f('0x4')](),controller['show']);router[_0x951f('0x8')]('/',auth[_0x951f('0x4')](),controller[_0x951f('0x9')]);router['put'](_0x951f('0x7'),auth['isAuthenticated'](),controller[_0x951f('0xa')]);router[_0x951f('0xb')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x951f('0xc')]=router; \ No newline at end of file +var _0x91a4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','/:id','isAuthenticated','post','create','delete','destroy','multer','util','path','express'];(function(_0x135c3d,_0xf4d149){var _0x23c7ea=function(_0x2de680){while(--_0x2de680){_0x135c3d['push'](_0x135c3d['shift']());}};_0x23c7ea(++_0xf4d149);}(_0x91a4,0x11c));var _0x491a=function(_0x3c7c9d,_0x1bbcb0){_0x3c7c9d=_0x3c7c9d-0x0;var _0x534390=_0x91a4[_0x3c7c9d];return _0x534390;};'use strict';var multer=require(_0x491a('0x0'));var util=require(_0x491a('0x1'));var path=require(_0x491a('0x2'));var express=require(_0x491a('0x3'));var router=express[_0x491a('0x4')]();var auth=require(_0x491a('0x5'));var interaction=require(_0x491a('0x6'));var config=require(_0x491a('0x7'));var controller=require(_0x491a('0x8'));router[_0x491a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x491a('0x9')](_0x491a('0xa'),auth[_0x491a('0xb')](),controller['show']);router[_0x491a('0xc')]('/',auth[_0x491a('0xb')](),controller[_0x491a('0xd')]);router['put']('/:id',auth[_0x491a('0xb')](),controller['update']);router[_0x491a('0xe')]('/:id',auth[_0x491a('0xb')](),controller[_0x491a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0c29d92..354a007 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 _0xaf7f=['#0091EA','sequelize','exports','name','STRING'];(function(_0x2ca8ba,_0x27f0f5){var _0x565aaf=function(_0x45cd15){while(--_0x45cd15){_0x2ca8ba['push'](_0x2ca8ba['shift']());}};_0x565aaf(++_0x27f0f5);}(_0xaf7f,0x1c3));var _0xfaf7=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xaf7f[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require(_0xfaf7('0x0'));module[_0xfaf7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfaf7('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xfaf7('0x3')],'defaultValue':_0xfaf7('0x4')},'description':{'type':Sequelize[_0xfaf7('0x3')]}}; \ No newline at end of file +var _0x590b=['sequelize','exports','STRING','#0091EA'];(function(_0x2eec7e,_0x8c4a6a){var _0x266083=function(_0x372bc7){while(--_0x372bc7){_0x2eec7e['push'](_0x2eec7e['shift']());}};_0x266083(++_0x8c4a6a);}(_0x590b,0x140));var _0xb590=function(_0x58fdc5,_0x5986a){_0x58fdc5=_0x58fdc5-0x0;var _0x121190=_0x590b[_0x58fdc5];return _0x121190;};'use strict';var Sequelize=require(_0xb590('0x0'));module[_0xb590('0x1')]={'name':{'type':Sequelize[_0xb590('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb590('0x2')],'defaultValue':_0xb590('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f64ce51..5b645bd 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 _0x7ee1=['filter','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','error','name','send','index','Tag','rawAttributes','keys','query','dateStart','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','dateEnd','add','day','merge','where'];(function(_0x194801,_0x147ece){var _0x18c56c=function(_0x236640){while(--_0x236640){_0x194801['push'](_0x194801['shift']());}};_0x18c56c(++_0x147ece);}(_0x7ee1,0x8d));var _0x17ee=function(_0x44af6f,_0x1d80b0){_0x44af6f=_0x44af6f-0x0;var _0x3118c0=_0x7ee1[_0x44af6f];return _0x3118c0;};'use strict';var jsonpatch=require(_0x17ee('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x17ee('0x1'));var util=require(_0x17ee('0x2'));var path=require(_0x17ee('0x3'));var sox=require('sox');var csv=require(_0x17ee('0x4'));var ejs=require(_0x17ee('0x5'));var fs=require('fs');var _=require(_0x17ee('0x6'));var squel=require(_0x17ee('0x7'));var crypto=require('crypto');var jsforce=require(_0x17ee('0x8'));var deskjs=require(_0x17ee('0x9'));var toCsv=require('to-csv');var querystring=require(_0x17ee('0xa'));var Papa=require('papaparse');var qs=require(_0x17ee('0xb'));var logger=require(_0x17ee('0xc'))(_0x17ee('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17f935,_0x4ee1e0){_0x4ee1e0=_0x4ee1e0||0xcc;return function(_0x155964){if(_0x155964){return _0x17f935[_0x17ee('0xe')](_0x4ee1e0);}return _0x17f935[_0x17ee('0xf')](_0x4ee1e0)[_0x17ee('0x10')]();};}function respondWithResult(_0x57fae0,_0x1acde5){_0x1acde5=_0x1acde5||0xc8;return function(_0x51b5d9){if(_0x51b5d9){return _0x57fae0[_0x17ee('0xf')](_0x1acde5)[_0x17ee('0x11')](_0x51b5d9);}};}function respondWithFilteredResult(_0x358514,_0xe75682){return function(_0x308ec7){if(_0x308ec7){var _0xca5e20=_0x308ec7[_0x17ee('0x12')],_0x225d05=_0xe75682[_0x17ee('0x13')],_0x54434e=_0xe75682['offset']+_0xe75682['limit'],_0x1e734f;if(_0x54434e>=_0xca5e20){_0x54434e=_0xca5e20;_0x1e734f=0xc8;}else{_0x1e734f=0xce;}_0x358514['status'](_0x1e734f);return _0x358514['set'](_0x17ee('0x14'),_0x225d05+'-'+_0x54434e+'/'+_0xca5e20)[_0x17ee('0x11')](_0x308ec7);}return null;};}function patchUpdates(_0x1b87c3){return function(_0x2e2287){try{jsonpatch[_0x17ee('0x15')](_0x2e2287,_0x1b87c3,!![]);}catch(_0x236d18){return BPromise[_0x17ee('0x16')](_0x236d18);}return _0x2e2287['save']();};}function saveUpdates(_0x44fe58,_0x1118a3){return function(_0x215bc7){if(_0x215bc7){return _0x215bc7[_0x17ee('0x17')](_0x44fe58)[_0x17ee('0x18')](function(_0x57925d){return _0x57925d;});}return null;};}function removeEntity(_0x393720,_0x587784){return function(_0x18e8cd){if(_0x18e8cd){return _0x18e8cd['destroy']()[_0x17ee('0x18')](function(){_0x393720[_0x17ee('0xf')](0xcc)[_0x17ee('0x10')]();});}};}function handleEntityNotFound(_0xdbeb6a,_0x3e23f8){return function(_0x4fb3d0){if(!_0x4fb3d0){_0xdbeb6a[_0x17ee('0xe')](0x194);}return _0x4fb3d0;};}function handleError(_0x14295f,_0x1425e5){_0x1425e5=_0x1425e5||0x1f4;return function(_0x1f3d6d){logger[_0x17ee('0x19')](_0x1f3d6d['stack']);if(_0x1f3d6d['name']){delete _0x1f3d6d[_0x17ee('0x1a')];}_0x14295f[_0x17ee('0xf')](_0x1425e5)[_0x17ee('0x1b')](_0x1f3d6d);};}exports[_0x17ee('0x1c')]=function(_0x3bbddf,_0xea358f){var _0x2f6e84={},_0x1d8aa2={},_0xadda65={'count':0x0,'rows':[]};var _0x1fca10=db[_0x17ee('0x1d')][_0x17ee('0x1e')];_0x1d8aa2['model']=_[_0x17ee('0x1f')](_0x1fca10);var _0xbc0aed={'dateStart':_0x3bbddf[_0x17ee('0x20')][_0x17ee('0x21')],'dateEnd':_0x3bbddf[_0x17ee('0x20')]['dateEnd']};delete _0x3bbddf[_0x17ee('0x20')][_0x17ee('0x21')];delete _0x3bbddf[_0x17ee('0x20')]['dateEnd'];_0x1d8aa2[_0x17ee('0x20')]=_[_0x17ee('0x1f')](_0x3bbddf['query']);_0x1d8aa2[_0x17ee('0x22')]=_['intersection'](_0x1d8aa2[_0x17ee('0x23')],_0x1d8aa2['query']);_0x2f6e84[_0x17ee('0x24')]=_[_0x17ee('0x25')](_0x1d8aa2[_0x17ee('0x23')],qs['fields'](_0x3bbddf[_0x17ee('0x20')][_0x17ee('0x26')]));_0x2f6e84['attributes']=_0x2f6e84[_0x17ee('0x24')][_0x17ee('0x27')]?_0x2f6e84[_0x17ee('0x24')]:_0x1d8aa2['model'];if(!_0x3bbddf['query'][_0x17ee('0x28')](_0x17ee('0x29'))){_0x2f6e84[_0x17ee('0x2a')]=qs[_0x17ee('0x2a')](_0x3bbddf['query']['limit']);_0x2f6e84[_0x17ee('0x13')]=qs[_0x17ee('0x13')](_0x3bbddf[_0x17ee('0x20')][_0x17ee('0x13')]);}_0x2f6e84[_0x17ee('0x2b')]=qs[_0x17ee('0x2c')](_0x3bbddf[_0x17ee('0x20')]['sort']);_0x2f6e84['where']=qs['filters'](_[_0x17ee('0x2d')](_0x3bbddf['query'],_0x1d8aa2[_0x17ee('0x22')]));if(_0xbc0aed[_0x17ee('0x21')]){if(_0xbc0aed[_0x17ee('0x2e')]){_0xbc0aed['dateEnd']=moment(_0xbc0aed[_0x17ee('0x2e')])[_0x17ee('0x2f')](0x1,'day');}else{_0xbc0aed['dateEnd']=moment(_0xbc0aed[_0x17ee('0x21')])[_0x17ee('0x2f')](0x1,_0x17ee('0x30'));}_[_0x17ee('0x31')](_0x2f6e84[_0x17ee('0x32')],{'createdAt':{'$gte':_0xbc0aed['dateStart'],'$lte':_0xbc0aed['dateEnd']}});}if(_0x3bbddf[_0x17ee('0x20')][_0x17ee('0x33')]){_0x2f6e84[_0x17ee('0x32')]=_[_0x17ee('0x31')](_0x2f6e84[_0x17ee('0x32')],{'$or':_[_0x17ee('0x34')](_0x2f6e84['attributes'],function(_0x50b909){var _0xe24eec={};_0xe24eec[_0x50b909]={'$like':'%'+_0x3bbddf[_0x17ee('0x20')][_0x17ee('0x33')]+'%'};return _0xe24eec;})});}_0x2f6e84=_[_0x17ee('0x31')]({},_0x2f6e84,_0x3bbddf[_0x17ee('0x35')]);var _0xec2dd7={'where':_0x2f6e84[_0x17ee('0x32')]};return db[_0x17ee('0x1d')][_0x17ee('0x12')](_0xec2dd7)[_0x17ee('0x18')](function(_0x53cb88){_0xadda65['count']=_0x53cb88;if(_0x3bbddf['query'][_0x17ee('0x36')]){_0x2f6e84[_0x17ee('0x37')]=[{'all':!![]}];}return db[_0x17ee('0x1d')][_0x17ee('0x38')](_0x2f6e84);})['then'](function(_0x4516c5){_0xadda65[_0x17ee('0x39')]=_0x4516c5;return _0xadda65;})[_0x17ee('0x18')](respondWithFilteredResult(_0xea358f,_0x2f6e84))[_0x17ee('0x3a')](handleError(_0xea358f,null));};exports['show']=function(_0x451dba,_0x55b4e2){var _0x2b9f50={'raw':!![],'where':{'id':_0x451dba[_0x17ee('0x3b')]['id']}},_0x23c47e={};_0x23c47e[_0x17ee('0x23')]=_[_0x17ee('0x1f')](db[_0x17ee('0x1d')]['rawAttributes']);_0x23c47e[_0x17ee('0x20')]=_[_0x17ee('0x1f')](_0x451dba[_0x17ee('0x20')]);_0x23c47e[_0x17ee('0x22')]=_[_0x17ee('0x25')](_0x23c47e[_0x17ee('0x23')],_0x23c47e[_0x17ee('0x20')]);_0x2b9f50[_0x17ee('0x24')]=_[_0x17ee('0x25')](_0x23c47e[_0x17ee('0x23')],qs[_0x17ee('0x26')](_0x451dba[_0x17ee('0x20')]['fields']));_0x2b9f50[_0x17ee('0x24')]=_0x2b9f50[_0x17ee('0x24')]['length']?_0x2b9f50['attributes']:_0x23c47e['model'];if(_0x451dba[_0x17ee('0x20')][_0x17ee('0x36')]){_0x2b9f50[_0x17ee('0x37')]=[{'all':!![]}];}_0x2b9f50=_[_0x17ee('0x31')]({},_0x2b9f50,_0x451dba[_0x17ee('0x35')]);return db['Tag'][_0x17ee('0x3c')](_0x2b9f50)[_0x17ee('0x18')](handleEntityNotFound(_0x55b4e2,null))[_0x17ee('0x18')](respondWithResult(_0x55b4e2,null))[_0x17ee('0x3a')](handleError(_0x55b4e2,null));};exports[_0x17ee('0x3d')]=function(_0x243ba7,_0x315049){return db[_0x17ee('0x1d')][_0x17ee('0x3d')](_0x243ba7[_0x17ee('0x3e')],{})[_0x17ee('0x18')](respondWithResult(_0x315049,0xc9))[_0x17ee('0x3a')](handleError(_0x315049,null));};exports['update']=function(_0x56a80a,_0x348e6b){if(_0x56a80a[_0x17ee('0x3e')]['id']){delete _0x56a80a['body']['id'];}return db['Tag'][_0x17ee('0x3c')]({'where':{'id':_0x56a80a['params']['id']}})[_0x17ee('0x18')](handleEntityNotFound(_0x348e6b,null))[_0x17ee('0x18')](saveUpdates(_0x56a80a[_0x17ee('0x3e')],null))[_0x17ee('0x18')](respondWithResult(_0x348e6b,null))[_0x17ee('0x3a')](handleError(_0x348e6b,null));};exports[_0x17ee('0x3f')]=function(_0x46e94a,_0xd53dc5){return db[_0x17ee('0x1d')][_0x17ee('0x3c')]({'where':{'id':_0x46e94a[_0x17ee('0x3b')]['id']}})[_0x17ee('0x18')](handleEntityNotFound(_0xd53dc5,null))[_0x17ee('0x18')](removeEntity(_0xd53dc5,null))['catch'](handleError(_0xd53dc5,null));}; \ No newline at end of file +var _0x4819=['add','merge','filter','map','options','includeAll','include','catch','show','find','create','body','params','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','then','destroy','error','stack','name','send','Tag','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4819,0xcd));var _0x9481=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0x4819[_0x50f0a9];return _0x5a33d9;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var Mustache=require(_0x9481('0x3'));var util=require(_0x9481('0x4'));var path=require(_0x9481('0x5'));var sox=require(_0x9481('0x6'));var csv=require(_0x9481('0x7'));var ejs=require(_0x9481('0x8'));var fs=require('fs');var _=require(_0x9481('0x9'));var squel=require('squel');var crypto=require(_0x9481('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9481('0x7'));var querystring=require(_0x9481('0xb'));var Papa=require(_0x9481('0xc'));var qs=require(_0x9481('0xd'));var logger=require(_0x9481('0xe'))('api');var utils=require(_0x9481('0xf'));var config=require('../../config/environment');var db=require(_0x9481('0x10'))['db'];function respondWithStatusCode(_0x564d5b,_0x411d24){_0x411d24=_0x411d24||0xcc;return function(_0x2d5d0f){if(_0x2d5d0f){return _0x564d5b[_0x9481('0x11')](_0x411d24);}return _0x564d5b[_0x9481('0x12')](_0x411d24)[_0x9481('0x13')]();};}function respondWithResult(_0x29515a,_0xa38c93){_0xa38c93=_0xa38c93||0xc8;return function(_0xe410c3){if(_0xe410c3){return _0x29515a[_0x9481('0x12')](_0xa38c93)['json'](_0xe410c3);}};}function respondWithFilteredResult(_0x5aac02,_0xce6fa2){return function(_0x150276){if(_0x150276){var _0x2f0032=_0x150276[_0x9481('0x14')],_0x28fcb6=_0xce6fa2['offset'],_0x3d23c2=_0xce6fa2[_0x9481('0x15')]+_0xce6fa2[_0x9481('0x16')],_0xc7a0b5;if(_0x3d23c2>=_0x2f0032){_0x3d23c2=_0x2f0032;_0xc7a0b5=0xc8;}else{_0xc7a0b5=0xce;}_0x5aac02['status'](_0xc7a0b5);return _0x5aac02[_0x9481('0x17')]('Content-Range',_0x28fcb6+'-'+_0x3d23c2+'/'+_0x2f0032)[_0x9481('0x18')](_0x150276);}return null;};}function patchUpdates(_0x7a2ac8){return function(_0x2bc12a){try{jsonpatch[_0x9481('0x19')](_0x2bc12a,_0x7a2ac8,!![]);}catch(_0x546fce){return BPromise['reject'](_0x546fce);}return _0x2bc12a[_0x9481('0x1a')]();};}function saveUpdates(_0x50a559,_0x4d0da7){return function(_0x26671c){if(_0x26671c){return _0x26671c[_0x9481('0x1b')](_0x50a559)[_0x9481('0x1c')](function(_0x41051d){return _0x41051d;});}return null;};}function removeEntity(_0x7000e7,_0x3dc33f){return function(_0x55a1bd){if(_0x55a1bd){return _0x55a1bd[_0x9481('0x1d')]()[_0x9481('0x1c')](function(){_0x7000e7[_0x9481('0x12')](0xcc)[_0x9481('0x13')]();});}};}function handleEntityNotFound(_0xb5cd2c,_0x56da97){return function(_0x215dd7){if(!_0x215dd7){_0xb5cd2c[_0x9481('0x11')](0x194);}return _0x215dd7;};}function handleError(_0x572599,_0x2bcf37){_0x2bcf37=_0x2bcf37||0x1f4;return function(_0xd1cd1a){logger[_0x9481('0x1e')](_0xd1cd1a[_0x9481('0x1f')]);if(_0xd1cd1a[_0x9481('0x20')]){delete _0xd1cd1a['name'];}_0x572599[_0x9481('0x12')](_0x2bcf37)[_0x9481('0x21')](_0xd1cd1a);};}exports['index']=function(_0x5eb4f5,_0x12b0c3){var _0x299e28={},_0x550fce={},_0x1e6f28={'count':0x0,'rows':[]};var _0x20ff9a=db[_0x9481('0x22')][_0x9481('0x23')];_0x550fce['model']=_[_0x9481('0x24')](_0x20ff9a);var _0x3ca064={'dateStart':_0x5eb4f5[_0x9481('0x25')]['dateStart'],'dateEnd':_0x5eb4f5[_0x9481('0x25')]['dateEnd']};delete _0x5eb4f5[_0x9481('0x25')][_0x9481('0x26')];delete _0x5eb4f5[_0x9481('0x25')][_0x9481('0x27')];_0x550fce[_0x9481('0x25')]=_['keys'](_0x5eb4f5[_0x9481('0x25')]);_0x550fce[_0x9481('0x28')]=_[_0x9481('0x29')](_0x550fce['model'],_0x550fce['query']);_0x299e28[_0x9481('0x2a')]=_[_0x9481('0x29')](_0x550fce[_0x9481('0x2b')],qs[_0x9481('0x2c')](_0x5eb4f5['query']['fields']));_0x299e28['attributes']=_0x299e28[_0x9481('0x2a')]['length']?_0x299e28[_0x9481('0x2a')]:_0x550fce['model'];if(!_0x5eb4f5[_0x9481('0x25')][_0x9481('0x2d')](_0x9481('0x2e'))){_0x299e28[_0x9481('0x16')]=qs[_0x9481('0x16')](_0x5eb4f5['query'][_0x9481('0x16')]);_0x299e28[_0x9481('0x15')]=qs[_0x9481('0x15')](_0x5eb4f5['query'][_0x9481('0x15')]);}_0x299e28[_0x9481('0x2f')]=qs[_0x9481('0x30')](_0x5eb4f5[_0x9481('0x25')][_0x9481('0x30')]);_0x299e28[_0x9481('0x31')]=qs['filters'](_[_0x9481('0x32')](_0x5eb4f5['query'],_0x550fce[_0x9481('0x28')]));if(_0x3ca064[_0x9481('0x26')]){if(_0x3ca064[_0x9481('0x27')]){_0x3ca064[_0x9481('0x27')]=moment(_0x3ca064[_0x9481('0x27')])[_0x9481('0x33')](0x1,'day');}else{_0x3ca064[_0x9481('0x27')]=moment(_0x3ca064[_0x9481('0x26')])['add'](0x1,'day');}_[_0x9481('0x34')](_0x299e28['where'],{'createdAt':{'$gte':_0x3ca064[_0x9481('0x26')],'$lte':_0x3ca064[_0x9481('0x27')]}});}if(_0x5eb4f5[_0x9481('0x25')][_0x9481('0x35')]){_0x299e28['where']=_[_0x9481('0x34')](_0x299e28['where'],{'$or':_[_0x9481('0x36')](_0x299e28['attributes'],function(_0x2ce972){var _0x4d6a13={};_0x4d6a13[_0x2ce972]={'$like':'%'+_0x5eb4f5[_0x9481('0x25')][_0x9481('0x35')]+'%'};return _0x4d6a13;})});}_0x299e28=_[_0x9481('0x34')]({},_0x299e28,_0x5eb4f5[_0x9481('0x37')]);var _0x97dc3e={'where':_0x299e28[_0x9481('0x31')]};return db[_0x9481('0x22')]['count'](_0x97dc3e)[_0x9481('0x1c')](function(_0x3857e8){_0x1e6f28[_0x9481('0x14')]=_0x3857e8;if(_0x5eb4f5[_0x9481('0x25')][_0x9481('0x38')]){_0x299e28[_0x9481('0x39')]=[{'all':!![]}];}return db[_0x9481('0x22')]['findAll'](_0x299e28);})[_0x9481('0x1c')](function(_0x1872ff){_0x1e6f28['rows']=_0x1872ff;return _0x1e6f28;})[_0x9481('0x1c')](respondWithFilteredResult(_0x12b0c3,_0x299e28))[_0x9481('0x3a')](handleError(_0x12b0c3,null));};exports[_0x9481('0x3b')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2b')]=_[_0x9481('0x24')](db['Tag']['rawAttributes']);_0x304791[_0x9481('0x25')]=_[_0x9481('0x24')](_0x3eb9ee[_0x9481('0x25')]);_0x304791['filters']=_[_0x9481('0x29')](_0x304791[_0x9481('0x2b')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x29')](_0x304791['model'],qs[_0x9481('0x2c')](_0x3eb9ee[_0x9481('0x25')][_0x9481('0x2c')]));_0x5a8ffd[_0x9481('0x2a')]=_0x5a8ffd[_0x9481('0x2a')]['length']?_0x5a8ffd[_0x9481('0x2a')]:_0x304791[_0x9481('0x2b')];if(_0x3eb9ee['query'][_0x9481('0x38')]){_0x5a8ffd[_0x9481('0x39')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x34')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x37')]);return db[_0x9481('0x22')][_0x9481('0x3c')](_0x5a8ffd)[_0x9481('0x1c')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x1c')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3a')](handleError(_0x29a8e9,null));};exports['create']=function(_0xd36133,_0x5d3a06){return db['Tag'][_0x9481('0x3d')](_0xd36133['body'],{})[_0x9481('0x1c')](respondWithResult(_0x5d3a06,0xc9))[_0x9481('0x3a')](handleError(_0x5d3a06,null));};exports['update']=function(_0x277e2a,_0x1044a2){if(_0x277e2a[_0x9481('0x3e')]['id']){delete _0x277e2a[_0x9481('0x3e')]['id'];}return db[_0x9481('0x22')][_0x9481('0x3c')]({'where':{'id':_0x277e2a['params']['id']}})['then'](handleEntityNotFound(_0x1044a2,null))[_0x9481('0x1c')](saveUpdates(_0x277e2a[_0x9481('0x3e')],null))[_0x9481('0x1c')](respondWithResult(_0x1044a2,null))[_0x9481('0x3a')](handleError(_0x1044a2,null));};exports[_0x9481('0x1d')]=function(_0x353aab,_0x1c070c){return db[_0x9481('0x22')]['find']({'where':{'id':_0x353aab[_0x9481('0x3f')]['id']}})[_0x9481('0x1c')](handleEntityNotFound(_0x1c070c,null))[_0x9481('0x1c')](removeEntity(_0x1c070c,null))[_0x9481('0x3a')](handleError(_0x1c070c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8d7abe5..35a548e 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 _0x8960=['moment','bluebird','request-promise','./tag.attributes','exports','define','Tag','lodash','../../config/logger','api'];(function(_0x2e4407,_0x29d3a5){var _0x3a60c9=function(_0x369101){while(--_0x369101){_0x2e4407['push'](_0x2e4407['shift']());}};_0x3a60c9(++_0x29d3a5);}(_0x8960,0x75));var _0x0896=function(_0x72a1e1,_0x239f84){_0x72a1e1=_0x72a1e1-0x0;var _0x3520bb=_0x8960[_0x72a1e1];return _0x3520bb;};'use strict';var _=require(_0x0896('0x0'));var util=require('util');var logger=require(_0x0896('0x1'))(_0x0896('0x2'));var moment=require(_0x0896('0x3'));var BPromise=require(_0x0896('0x4'));var rp=require(_0x0896('0x5'));var attributes=require(_0x0896('0x6'));module[_0x0896('0x7')]=function(_0x313420,_0x5b6297){return _0x313420[_0x0896('0x8')](_0x0896('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9232=['bluebird','request-promise','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x54cc4e,_0x217251){var _0x11167b=function(_0x4906fc){while(--_0x4906fc){_0x54cc4e['push'](_0x54cc4e['shift']());}};_0x11167b(++_0x217251);}(_0x9232,0xab));var _0x2923=function(_0x379443,_0x1263d0){_0x379443=_0x379443-0x0;var _0x5454ad=_0x9232[_0x379443];return _0x5454ad;};'use strict';var _=require(_0x2923('0x0'));var util=require(_0x2923('0x1'));var logger=require(_0x2923('0x2'))(_0x2923('0x3'));var moment=require(_0x2923('0x4'));var BPromise=require(_0x2923('0x5'));var rp=require(_0x2923('0x6'));var attributes=require(_0x2923('0x7'));module[_0x2923('0x8')]=function(_0x40948a,_0x3499db){return _0x40948a[_0x2923('0x9')]('Tag',attributes,{'tableName':_0x2923('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 3dfe230..c27e800 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 _0xbcff=['Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Tag,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','debug'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbcff,0x12e));var _0xfbcf=function(_0x52090e,_0x3c4474){_0x52090e=_0x52090e-0x0;var _0x2f177c=_0xbcff[_0x52090e];return _0x2f177c;};'use strict';var _=require(_0xfbcf('0x0'));var util=require(_0xfbcf('0x1'));var moment=require(_0xfbcf('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbcf('0x3'));var fs=require('fs');var db=require(_0xfbcf('0x4'))['db'];var utils=require(_0xfbcf('0x5'));var logger=require('../../config/logger')(_0xfbcf('0x6'));var config=require(_0xfbcf('0x7'));var jayson=require(_0xfbcf('0x8'));var client=jayson['client'][_0xfbcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b30c8,_0x4b87de,_0x51ee67){return new BPromise(function(_0x470fa8,_0x520d5f){return client[_0xfbcf('0xa')](_0x3b30c8,_0x51ee67)['then'](function(_0x23296d){logger[_0xfbcf('0xb')]('Tag,\x20%s,\x20%s',_0x4b87de,'request\x20sent');logger[_0xfbcf('0xc')](_0xfbcf('0xd'),_0x4b87de,_0xfbcf('0xe'),JSON[_0xfbcf('0xf')](_0x23296d));if(_0x23296d['error']){if(_0x23296d[_0xfbcf('0x10')][_0xfbcf('0x11')]===0x1f4){logger[_0xfbcf('0x10')](_0xfbcf('0x12'),_0x4b87de,_0x23296d[_0xfbcf('0x10')][_0xfbcf('0x13')]);return _0x520d5f(_0x23296d[_0xfbcf('0x10')]['message']);}logger[_0xfbcf('0x10')]('Tag,\x20%s,\x20%s',_0x4b87de,_0x23296d[_0xfbcf('0x10')][_0xfbcf('0x13')]);return _0x470fa8(_0x23296d[_0xfbcf('0x10')][_0xfbcf('0x13')]);}else{logger[_0xfbcf('0xb')](_0xfbcf('0x12'),_0x4b87de,_0xfbcf('0xe'));_0x470fa8(_0x23296d[_0xfbcf('0x14')][_0xfbcf('0x13')]);}})['catch'](function(_0x4592e4){logger[_0xfbcf('0x10')](_0xfbcf('0x12'),_0x4b87de,_0x4592e4);_0x520d5f(_0x4592e4);});});} \ No newline at end of file +var _0xba84=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1360e7,_0xde6306){var _0x4cdcff=function(_0x1d5662){while(--_0x1d5662){_0x1360e7['push'](_0x1360e7['shift']());}};_0x4cdcff(++_0xde6306);}(_0xba84,0x8b));var _0x4ba8=function(_0x4778a9,_0x25fc7b){_0x4778a9=_0x4778a9-0x0;var _0x42ddb3=_0xba84[_0x4778a9];return _0x42ddb3;};'use strict';var _=require('lodash');var util=require(_0x4ba8('0x0'));var moment=require(_0x4ba8('0x1'));var BPromise=require(_0x4ba8('0x2'));var rs=require(_0x4ba8('0x3'));var fs=require('fs');var db=require(_0x4ba8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ba8('0x5'));var config=require(_0x4ba8('0x6'));var jayson=require(_0x4ba8('0x7'));var client=jayson[_0x4ba8('0x8')][_0x4ba8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48f426,_0x5f3ebf,_0x4e73bc){return new BPromise(function(_0x3fb66d,_0x1c1350){return client['request'](_0x48f426,_0x4e73bc)[_0x4ba8('0xa')](function(_0x3e93ea){logger[_0x4ba8('0xb')](_0x4ba8('0xc'),_0x5f3ebf,_0x4ba8('0xd'));logger[_0x4ba8('0xe')](_0x4ba8('0xf'),_0x5f3ebf,_0x4ba8('0xd'),JSON[_0x4ba8('0x10')](_0x3e93ea));if(_0x3e93ea['error']){if(_0x3e93ea[_0x4ba8('0x11')][_0x4ba8('0x12')]===0x1f4){logger[_0x4ba8('0x11')]('Tag,\x20%s,\x20%s',_0x5f3ebf,_0x3e93ea[_0x4ba8('0x11')]['message']);return _0x1c1350(_0x3e93ea[_0x4ba8('0x11')]['message']);}logger[_0x4ba8('0x11')](_0x4ba8('0xc'),_0x5f3ebf,_0x3e93ea['error'][_0x4ba8('0x13')]);return _0x3fb66d(_0x3e93ea[_0x4ba8('0x11')][_0x4ba8('0x13')]);}else{logger[_0x4ba8('0xb')](_0x4ba8('0xc'),_0x5f3ebf,_0x4ba8('0xd'));_0x3fb66d(_0x3e93ea[_0x4ba8('0x14')][_0x4ba8('0x13')]);}})[_0x4ba8('0x15')](function(_0x1ff2a1){logger[_0x4ba8('0x11')](_0x4ba8('0xc'),_0x5f3ebf,_0x1ff2a1);_0x1c1350(_0x1ff2a1);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 722afea..fb1c3ac 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 _0xb527=['./team.controller','isAuthenticated','index','get','/:id','/:id/queues','/:id/users','getAgents','post','create','addQueues','addAgents','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xb527,0x6c));var _0x7b52=function(_0x9cdd9e,_0x17b471){_0x9cdd9e=_0x9cdd9e-0x0;var _0x9d61eb=_0xb527[_0x9cdd9e];return _0x9d61eb;};'use strict';var multer=require(_0x7b52('0x0'));var util=require(_0x7b52('0x1'));var path=require(_0x7b52('0x2'));var express=require(_0x7b52('0x3'));var router=express[_0x7b52('0x4')]();var auth=require(_0x7b52('0x5'));var interaction=require(_0x7b52('0x6'));var config=require('../../config/environment');var controller=require(_0x7b52('0x7'));router['get']('/',auth[_0x7b52('0x8')](),controller[_0x7b52('0x9')]);router[_0x7b52('0xa')](_0x7b52('0xb'),auth[_0x7b52('0x8')](),controller['show']);router[_0x7b52('0xa')](_0x7b52('0xc'),auth['isAuthenticated'](),controller['getQueues']);router[_0x7b52('0xa')](_0x7b52('0xd'),auth['isAuthenticated'](),controller[_0x7b52('0xe')]);router[_0x7b52('0xf')]('/',auth[_0x7b52('0x8')](),controller[_0x7b52('0x10')]);router[_0x7b52('0xf')](_0x7b52('0xc'),auth[_0x7b52('0x8')](),controller[_0x7b52('0x11')]);router['post']('/:id/users',auth[_0x7b52('0x8')](),controller[_0x7b52('0x12')]);router['put']('/:id',auth[_0x7b52('0x8')](),controller[_0x7b52('0x13')]);router[_0x7b52('0x14')](_0x7b52('0xb'),auth['isAuthenticated'](),controller[_0x7b52('0x15')]);router[_0x7b52('0x14')](_0x7b52('0xc'),auth[_0x7b52('0x8')](),controller['removeQueues']);router[_0x7b52('0x14')](_0x7b52('0xd'),auth[_0x7b52('0x8')](),controller['removeAgents']);module[_0x7b52('0x16')]=router; \ No newline at end of file +var _0x0a26=['/:id/users','getAgents','post','create','put','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','/:id','/:id/queues','getQueues'];(function(_0x3c04b6,_0x187cc4){var _0x1f40af=function(_0x46ea9f){while(--_0x46ea9f){_0x3c04b6['push'](_0x3c04b6['shift']());}};_0x1f40af(++_0x187cc4);}(_0x0a26,0x1eb));var _0x60a2=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x0a26[_0x710815];return _0x5b3b89;};'use strict';var multer=require(_0x60a2('0x0'));var util=require(_0x60a2('0x1'));var path=require('path');var express=require(_0x60a2('0x2'));var router=express[_0x60a2('0x3')]();var auth=require(_0x60a2('0x4'));var interaction=require(_0x60a2('0x5'));var config=require(_0x60a2('0x6'));var controller=require(_0x60a2('0x7'));router[_0x60a2('0x8')]('/',auth[_0x60a2('0x9')](),controller['index']);router[_0x60a2('0x8')](_0x60a2('0xa'),auth[_0x60a2('0x9')](),controller['show']);router['get'](_0x60a2('0xb'),auth[_0x60a2('0x9')](),controller[_0x60a2('0xc')]);router[_0x60a2('0x8')](_0x60a2('0xd'),auth[_0x60a2('0x9')](),controller[_0x60a2('0xe')]);router[_0x60a2('0xf')]('/',auth[_0x60a2('0x9')](),controller[_0x60a2('0x10')]);router[_0x60a2('0xf')](_0x60a2('0xb'),auth[_0x60a2('0x9')](),controller['addQueues']);router[_0x60a2('0xf')](_0x60a2('0xd'),auth[_0x60a2('0x9')](),controller['addAgents']);router[_0x60a2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x60a2('0x12')]);router[_0x60a2('0x13')]('/:id',auth[_0x60a2('0x9')](),controller[_0x60a2('0x14')]);router[_0x60a2('0x13')](_0x60a2('0xb'),auth[_0x60a2('0x9')](),controller[_0x60a2('0x15')]);router[_0x60a2('0x13')](_0x60a2('0xd'),auth[_0x60a2('0x9')](),controller[_0x60a2('0x16')]);module[_0x60a2('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 052566d..99bbf23 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 _0x784a=['STRING'];(function(_0xa4c373,_0x50ef03){var _0x4ee587=function(_0x302554){while(--_0x302554){_0xa4c373['push'](_0xa4c373['shift']());}};_0x4ee587(++_0x50ef03);}(_0x784a,0x117));var _0xa784=function(_0x16cfb0,_0x28d646){_0x16cfb0=_0x16cfb0-0x0;var _0x3d8504=_0x784a[_0x16cfb0];return _0x3d8504;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xa784('0x0')]}}; \ No newline at end of file +var _0x20f4=['STRING','sequelize','exports'];(function(_0x5d66a6,_0x418833){var _0x4ae805=function(_0x50998e){while(--_0x50998e){_0x5d66a6['push'](_0x5d66a6['shift']());}};_0x4ae805(++_0x418833);}(_0x20f4,0xa9));var _0x420f=function(_0x5aca71,_0x583dfa){_0x5aca71=_0x5aca71-0x0;var _0x375f79=_0x20f4[_0x5aca71];return _0x375f79;};'use strict';var Sequelize=require(_0x420f('0x0'));module[_0x420f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x420f('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 7f0a0d8..56b21ca 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 _0xbbbc=['ValidationError','Unknown\x20channel','toLowerCase','Queue','order','capitalize','Queues','addQueues','add','removeQueues','isValidChannel','remove','each','voice','chat','mail','sms','fax','openchannel','addAgents','ids','User','loginInPause','voicePause','UserVoiceQueueRt','upsert','format','%s/%s','SIP','omit','removeAgents','userTeam:remove','emit','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','localhost','register','status','json','count','offset','limit','set','save','update','then','end','sendStatus','error','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','map','options','Team','includeAll','include','findAll','rows','show','length','find','catch','create','body','destroy','params','getQueues','findOne','channel','Sequelize'];(function(_0x1d546a,_0x4ccf21){var _0x2ca664=function(_0x5569ee){while(--_0x5569ee){_0x1d546a['push'](_0x1d546a['shift']());}};_0x2ca664(++_0x4ccf21);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x2f870b,_0x2f5c67){_0x2f870b=_0x2f870b-0x0;var _0x227a43=_0xbbbc[_0x2f870b];return _0x227a43;};'use strict';var jsonpatch=require(_0xcbbb('0x0'));var rp=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var Mustache=require(_0xcbbb('0x4'));var util=require(_0xcbbb('0x5'));var path=require(_0xcbbb('0x6'));var sox=require('sox');var csv=require(_0xcbbb('0x7'));var ejs=require(_0xcbbb('0x8'));var fs=require('fs');var _=require(_0xcbbb('0x9'));var squel=require(_0xcbbb('0xa'));var crypto=require(_0xcbbb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcbbb('0xc'));var toCsv=require(_0xcbbb('0x7'));var querystring=require(_0xcbbb('0xd'));var Papa=require(_0xcbbb('0xe'));var qs=require(_0xcbbb('0xf'));var logger=require(_0xcbbb('0x10'))(_0xcbbb('0x11'));var utils=require('../../config/utils');var config=require(_0xcbbb('0x12'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':_0xcbbb('0x13'),'port':0x18eb});require('./team.socket')[_0xcbbb('0x14')](socket);function respondWithStatusCode(_0x5053cd,_0x3766c2){_0x3766c2=_0x3766c2||0xcc;return function(_0x3ba990){if(_0x3ba990){return _0x5053cd['sendStatus'](_0x3766c2);}return _0x5053cd[_0xcbbb('0x15')](_0x3766c2)['end']();};}function respondWithResult(_0x56f81,_0x523c50){_0x523c50=_0x523c50||0xc8;return function(_0x1a0fb3){if(_0x1a0fb3){return _0x56f81[_0xcbbb('0x15')](_0x523c50)[_0xcbbb('0x16')](_0x1a0fb3);}};}function respondWithFilteredResult(_0x47ea6a,_0x27ba56){return function(_0x3ff767){if(_0x3ff767){var _0x8a325c=_0x3ff767[_0xcbbb('0x17')],_0x273e13=_0x27ba56[_0xcbbb('0x18')],_0x47e679=_0x27ba56[_0xcbbb('0x18')]+_0x27ba56[_0xcbbb('0x19')],_0x5af226;if(_0x47e679>=_0x8a325c){_0x47e679=_0x8a325c;_0x5af226=0xc8;}else{_0x5af226=0xce;}_0x47ea6a['status'](_0x5af226);return _0x47ea6a[_0xcbbb('0x1a')]('Content-Range',_0x273e13+'-'+_0x47e679+'/'+_0x8a325c)[_0xcbbb('0x16')](_0x3ff767);}return null;};}function patchUpdates(_0x3436af){return function(_0x3572bb){try{jsonpatch['apply'](_0x3572bb,_0x3436af,!![]);}catch(_0x57c5e9){return BPromise['reject'](_0x57c5e9);}return _0x3572bb[_0xcbbb('0x1b')]();};}function saveUpdates(_0x3ae91b,_0x26c5eb){return function(_0x25e92f){if(_0x25e92f){return _0x25e92f[_0xcbbb('0x1c')](_0x3ae91b)[_0xcbbb('0x1d')](function(_0x45de5f){return _0x45de5f;});}return null;};}function removeEntity(_0x2be36c,_0x959609){return function(_0x2d4335){if(_0x2d4335){return _0x2d4335['destroy']()[_0xcbbb('0x1d')](function(){_0x2be36c[_0xcbbb('0x15')](0xcc)[_0xcbbb('0x1e')]();});}};}function handleEntityNotFound(_0x42aaf1,_0x258d1f){return function(_0x155e19){if(!_0x155e19){_0x42aaf1[_0xcbbb('0x1f')](0x194);}return _0x155e19;};}function handleError(_0xabb565,_0x3ca570){_0x3ca570=_0x3ca570||0x1f4;return function(_0x5e3970){logger[_0xcbbb('0x20')](_0x5e3970[_0xcbbb('0x21')]);if(_0x5e3970['name']){delete _0x5e3970[_0xcbbb('0x22')];}_0xabb565['status'](_0x3ca570)['send'](_0x5e3970);};}exports[_0xcbbb('0x23')]=function(_0x32e070,_0x548440){var _0x59c422={},_0x5499a1={},_0x4439ea={'count':0x0,'rows':[]};var _0x55e1d8=db['Team'][_0xcbbb('0x24')];_0x5499a1[_0xcbbb('0x25')]=_[_0xcbbb('0x26')](_0x55e1d8);var _0x13121e={'dateStart':_0x32e070[_0xcbbb('0x27')][_0xcbbb('0x28')],'dateEnd':_0x32e070[_0xcbbb('0x27')][_0xcbbb('0x29')]};delete _0x32e070[_0xcbbb('0x27')][_0xcbbb('0x28')];delete _0x32e070[_0xcbbb('0x27')][_0xcbbb('0x29')];_0x5499a1[_0xcbbb('0x27')]=_[_0xcbbb('0x26')](_0x32e070[_0xcbbb('0x27')]);_0x5499a1[_0xcbbb('0x2a')]=_[_0xcbbb('0x2b')](_0x5499a1[_0xcbbb('0x25')],_0x5499a1['query']);_0x59c422[_0xcbbb('0x2c')]=_[_0xcbbb('0x2b')](_0x5499a1['model'],qs[_0xcbbb('0x2d')](_0x32e070['query'][_0xcbbb('0x2d')]));_0x59c422[_0xcbbb('0x2c')]=_0x59c422[_0xcbbb('0x2c')]['length']?_0x59c422[_0xcbbb('0x2c')]:_0x5499a1[_0xcbbb('0x25')];if(!_0x32e070[_0xcbbb('0x27')][_0xcbbb('0x2e')](_0xcbbb('0x2f'))){_0x59c422[_0xcbbb('0x19')]=qs[_0xcbbb('0x19')](_0x32e070[_0xcbbb('0x27')][_0xcbbb('0x19')]);_0x59c422[_0xcbbb('0x18')]=qs['offset'](_0x32e070['query']['offset']);}_0x59c422['order']=qs[_0xcbbb('0x30')](_0x32e070[_0xcbbb('0x27')][_0xcbbb('0x30')]);_0x59c422[_0xcbbb('0x31')]=qs[_0xcbbb('0x2a')](_[_0xcbbb('0x32')](_0x32e070[_0xcbbb('0x27')],_0x5499a1[_0xcbbb('0x2a')]));if(_0x13121e[_0xcbbb('0x28')]){if(_0x13121e[_0xcbbb('0x29')]){_0x13121e[_0xcbbb('0x29')]=moment(_0x13121e[_0xcbbb('0x29')])['add'](0x1,'day');}else{_0x13121e[_0xcbbb('0x29')]=moment(_0x13121e['dateStart'])['add'](0x1,'day');}_[_0xcbbb('0x33')](_0x59c422[_0xcbbb('0x31')],{'createdAt':{'$gte':_0x13121e[_0xcbbb('0x28')],'$lte':_0x13121e[_0xcbbb('0x29')]}});}if(_0x32e070[_0xcbbb('0x27')][_0xcbbb('0x34')]){_0x59c422[_0xcbbb('0x31')]=_[_0xcbbb('0x33')](_0x59c422[_0xcbbb('0x31')],{'$or':_[_0xcbbb('0x35')](_0x59c422[_0xcbbb('0x2c')],function(_0x49a745){var _0x21ec4b={};_0x21ec4b[_0x49a745]={'$like':'%'+_0x32e070['query'][_0xcbbb('0x34')]+'%'};return _0x21ec4b;})});}_0x59c422=_[_0xcbbb('0x33')]({},_0x59c422,_0x32e070[_0xcbbb('0x36')]);var _0x392d9b={'where':_0x59c422[_0xcbbb('0x31')]};return db[_0xcbbb('0x37')]['count'](_0x392d9b)['then'](function(_0x496526){_0x4439ea[_0xcbbb('0x17')]=_0x496526;if(_0x32e070[_0xcbbb('0x27')][_0xcbbb('0x38')]){_0x59c422[_0xcbbb('0x39')]=[{'all':!![]}];}return db[_0xcbbb('0x37')][_0xcbbb('0x3a')](_0x59c422);})[_0xcbbb('0x1d')](function(_0x545e93){_0x4439ea[_0xcbbb('0x3b')]=_0x545e93;return _0x4439ea;})[_0xcbbb('0x1d')](respondWithFilteredResult(_0x548440,_0x59c422))['catch'](handleError(_0x548440,null));};exports[_0xcbbb('0x3c')]=function(_0xa8eff0,_0x351c89){var _0x349e13={'raw':![],'where':{'id':_0xa8eff0['params']['id']}},_0x2e360b={};_0x2e360b[_0xcbbb('0x25')]=_['keys'](db['Team'][_0xcbbb('0x24')]);_0x2e360b[_0xcbbb('0x27')]=_[_0xcbbb('0x26')](_0xa8eff0[_0xcbbb('0x27')]);_0x2e360b[_0xcbbb('0x2a')]=_[_0xcbbb('0x2b')](_0x2e360b[_0xcbbb('0x25')],_0x2e360b[_0xcbbb('0x27')]);_0x349e13[_0xcbbb('0x2c')]=_[_0xcbbb('0x2b')](_0x2e360b[_0xcbbb('0x25')],qs[_0xcbbb('0x2d')](_0xa8eff0[_0xcbbb('0x27')][_0xcbbb('0x2d')]));_0x349e13['attributes']=_0x349e13[_0xcbbb('0x2c')][_0xcbbb('0x3d')]?_0x349e13[_0xcbbb('0x2c')]:_0x2e360b[_0xcbbb('0x25')];if(_0xa8eff0['query']['includeAll']){_0x349e13['include']=[{'all':!![]}];}_0x349e13=_[_0xcbbb('0x33')]({},_0x349e13,_0xa8eff0[_0xcbbb('0x36')]);return db[_0xcbbb('0x37')][_0xcbbb('0x3e')](_0x349e13)[_0xcbbb('0x1d')](handleEntityNotFound(_0x351c89,null))[_0xcbbb('0x1d')](respondWithResult(_0x351c89,null))[_0xcbbb('0x3f')](handleError(_0x351c89,null));};exports['create']=function(_0x34026e,_0x1e66d0){return db[_0xcbbb('0x37')][_0xcbbb('0x40')](_0x34026e['body'],{})[_0xcbbb('0x1d')](respondWithResult(_0x1e66d0,0xc9))[_0xcbbb('0x3f')](handleError(_0x1e66d0,null));};exports[_0xcbbb('0x1c')]=function(_0x201de1,_0x58debc){if(_0x201de1['body']['id']){delete _0x201de1[_0xcbbb('0x41')]['id'];}return db[_0xcbbb('0x37')][_0xcbbb('0x3e')]({'where':{'id':_0x201de1['params']['id']}})['then'](handleEntityNotFound(_0x58debc,null))['then'](saveUpdates(_0x201de1[_0xcbbb('0x41')],null))[_0xcbbb('0x1d')](respondWithResult(_0x58debc,null))['catch'](handleError(_0x58debc,null));};exports[_0xcbbb('0x42')]=function(_0x35bb94,_0x2dc313){return db[_0xcbbb('0x37')]['find']({'where':{'id':_0x35bb94[_0xcbbb('0x43')]['id']}})[_0xcbbb('0x1d')](handleEntityNotFound(_0x2dc313,null))[_0xcbbb('0x1d')](removeEntity(_0x2dc313,null))[_0xcbbb('0x3f')](handleError(_0x2dc313,null));};exports[_0xcbbb('0x44')]=function(_0x3679f4,_0x32ead5,_0x1d9136){return db[_0xcbbb('0x37')][_0xcbbb('0x45')]({'where':{'id':_0x3679f4[_0xcbbb('0x43')]['id']}})['then'](handleEntityNotFound(_0x32ead5,null))['then'](function(_0x3fb0bd){if(!_0x3679f4[_0xcbbb('0x27')][_0xcbbb('0x46')]||!utils['isValidChannel'](_0x3679f4[_0xcbbb('0x27')]['channel'])){throw new db[(_0xcbbb('0x47'))][(_0xcbbb('0x48'))](_0xcbbb('0x49'));}var _0x477611={};var _0x3887e2={};_0x3887e2[_0xcbbb('0x25')]=_['keys'](db[_['capitalize'](_0x3679f4['query'][_0xcbbb('0x46')][_0xcbbb('0x4a')]())+_0xcbbb('0x4b')][_0xcbbb('0x24')]);_0x3887e2[_0xcbbb('0x27')]=_[_0xcbbb('0x26')](_0x3679f4[_0xcbbb('0x27')]);_0x3887e2[_0xcbbb('0x2a')]=_[_0xcbbb('0x2b')](_0x3887e2[_0xcbbb('0x25')],_0x3887e2[_0xcbbb('0x27')]);_0x477611[_0xcbbb('0x2c')]=_[_0xcbbb('0x2b')](_0x3887e2['model'],qs[_0xcbbb('0x2d')](_0x3679f4[_0xcbbb('0x27')][_0xcbbb('0x2d')]));_0x477611['attributes']=_0x477611[_0xcbbb('0x2c')][_0xcbbb('0x3d')]?_0x477611['attributes']:_0x3887e2[_0xcbbb('0x25')];_0x477611['limit']=qs[_0xcbbb('0x19')](_0x3679f4[_0xcbbb('0x27')]['limit']);_0x477611[_0xcbbb('0x18')]=qs[_0xcbbb('0x18')](_0x3679f4['query']['offset']);_0x477611[_0xcbbb('0x4c')]=qs['sort'](_0x3679f4[_0xcbbb('0x27')]['sort']);_0x477611[_0xcbbb('0x31')]=qs[_0xcbbb('0x2a')](_[_0xcbbb('0x32')](_0x3679f4['query'],_0x3887e2['filters']));_0x477611=_[_0xcbbb('0x33')]({},_0x477611,_0x3679f4[_0xcbbb('0x36')]);return _0x3fb0bd['get'+_[_0xcbbb('0x4d')](_0x3679f4[_0xcbbb('0x27')][_0xcbbb('0x46')]['toLowerCase']())+_0xcbbb('0x4e')](_0x477611);})[_0xcbbb('0x1d')](respondWithResult(_0x32ead5,null))[_0xcbbb('0x3f')](handleError(_0x32ead5,null));};exports[_0xcbbb('0x4f')]=function(_0xf13e52,_0x110e95,_0x42618c){return db['Team']['findOne']({'where':{'id':_0xf13e52[_0xcbbb('0x43')]['id']}})[_0xcbbb('0x1d')](function(_0x41f88b){if(_0x41f88b){if(!_0xf13e52[_0xcbbb('0x41')]['channel']||!utils['isValidChannel'](_0xf13e52[_0xcbbb('0x41')]['channel'])){throw new db['Sequelize'][(_0xcbbb('0x48'))](_0xcbbb('0x49'));}return _0x41f88b[_0xcbbb('0x50')+_[_0xcbbb('0x4d')](_0xf13e52[_0xcbbb('0x41')][_0xcbbb('0x46')][_0xcbbb('0x4a')]())+'Queues'](_0xf13e52[_0xcbbb('0x41')]['ids']);}return null;})[_0xcbbb('0x1d')](handleEntityNotFound(_0x110e95,null))['then'](respondWithStatusCode(_0x110e95,null))[_0xcbbb('0x3f')](handleError(_0x110e95,null));};exports[_0xcbbb('0x51')]=function(_0x3fc1a7,_0x23e28e,_0x19e98d){return db[_0xcbbb('0x37')][_0xcbbb('0x45')]({'where':{'id':_0x3fc1a7[_0xcbbb('0x43')]['id']}})['then'](function(_0x57d776){if(_0x57d776){if(!_0x3fc1a7[_0xcbbb('0x27')][_0xcbbb('0x46')]||!utils[_0xcbbb('0x52')](_0x3fc1a7[_0xcbbb('0x27')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xcbbb('0x49'));}return _0x57d776[_0xcbbb('0x53')+_['capitalize'](_0x3fc1a7[_0xcbbb('0x27')][_0xcbbb('0x46')]['toLowerCase']())+_0xcbbb('0x4e')](_0x3fc1a7[_0xcbbb('0x27')]['ids']);}return null;})[_0xcbbb('0x1d')](handleEntityNotFound(_0x23e28e,null))[_0xcbbb('0x1d')](respondWithStatusCode(_0x23e28e,null))[_0xcbbb('0x3f')](handleError(_0x23e28e,null));};exports['addAgents']=function(_0x50cd5e,_0x2b6839,_0x44dead){return db[_0xcbbb('0x37')]['find']({'where':{'id':_0x50cd5e['params']['id']}})[_0xcbbb('0x1d')](handleEntityNotFound(_0x2b6839,null))[_0xcbbb('0x1d')](function(_0x27c723){if(_0x27c723){return BPromise[_0xcbbb('0x54')]([_0xcbbb('0x55'),_0xcbbb('0x56'),_0xcbbb('0x57'),_0xcbbb('0x58'),_0xcbbb('0x59'),_0xcbbb('0x5a')],function(_0x190272){return _0x27c723['get'+_[_0xcbbb('0x4d')](_0x190272)+_0xcbbb('0x4e')]({'attributes':['id',_0xcbbb('0x22')]})[_0xcbbb('0x1d')](function(_0x3bd13c){return BPromise['each'](_0x3bd13c,function(_0x175b19){return _0x175b19[_0xcbbb('0x5b')](_0x50cd5e[_0xcbbb('0x41')][_0xcbbb('0x5c')])['then'](function(){if(_0x190272===_0xcbbb('0x55')){return db[_0xcbbb('0x5d')][_0xcbbb('0x3a')]({'where':{'id':_0x50cd5e['body']['ids']},'attributes':['id',_0xcbbb('0x22'),_0xcbbb('0x5e'),_0xcbbb('0x5f')],'raw':!![]});}})[_0xcbbb('0x1d')](function(_0x4dd587){if(_0x190272===_0xcbbb('0x55')){return BPromise[_0xcbbb('0x54')](_0x4dd587,function(_0x889104){return db[_0xcbbb('0x60')][_0xcbbb('0x61')]({'membername':_0x889104['name'],'UserId':_0x889104['id'],'queue_name':_0x175b19['name'],'VoiceQueueId':_0x175b19['id'],'interface':util[_0xcbbb('0x62')](_0xcbbb('0x63'),_0xcbbb('0x64'),_0x889104[_0xcbbb('0x22')]),'paused':_0x889104[_0xcbbb('0x5f')]||![],'penalty':0x0});});}});});})[_0xcbbb('0x1d')](function(){return _0x27c723;});})['then'](function(){return _0x27c723;});}})[_0xcbbb('0x1d')](function(_0xbe7e68){if(_0xbe7e68){return _0xbe7e68[_0xcbbb('0x5b')](_0x50cd5e[_0xcbbb('0x41')][_0xcbbb('0x5c')],_[_0xcbbb('0x65')](_0x50cd5e[_0xcbbb('0x41')],['ids','id'])||{})['spread'](function(_0x3cad22){for(var _0x49031d=0x0;_0x49031d<_0x50cd5e['body'][_0xcbbb('0x5c')]['length'];_0x49031d+=0x1){socket['emit']('userTeam:save',{'UserId':_0x50cd5e[_0xcbbb('0x41')]['ids'][_0x49031d],'TeamId':_0x50cd5e[_0xcbbb('0x43')]['id']});}return _0x3cad22;});}})['then'](respondWithResult(_0x2b6839,null))['catch'](handleError(_0x2b6839,null));};exports['removeAgents']=function(_0x4de2dd,_0x1c9dd2,_0x14c60b){var _0x56b09b;return db['Team'][_0xcbbb('0x3e')]({'where':{'id':_0x4de2dd[_0xcbbb('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c9dd2,null))[_0xcbbb('0x1d')](function(_0xa40cba){if(_0xa40cba){return BPromise[_0xcbbb('0x54')]([_0xcbbb('0x55'),_0xcbbb('0x56'),_0xcbbb('0x57'),_0xcbbb('0x58'),'fax',_0xcbbb('0x5a')],function(_0x26c32d){return _0xa40cba['get'+_[_0xcbbb('0x4d')](_0x26c32d)+_0xcbbb('0x4e')]({'attributes':['id',_0xcbbb('0x22')]})[_0xcbbb('0x1d')](function(_0x1db603){return BPromise[_0xcbbb('0x54')](_0x1db603,function(_0x59d24b){return _0x59d24b['removeAgents'](_0x4de2dd[_0xcbbb('0x27')][_0xcbbb('0x5c')])[_0xcbbb('0x1d')](function(){if(_0x26c32d===_0xcbbb('0x55')){return db[_0xcbbb('0x60')]['destroy']({'where':{'VoiceQueueId':_0x59d24b['id'],'UserId':_0x4de2dd[_0xcbbb('0x27')][_0xcbbb('0x5c')]}});}});});})[_0xcbbb('0x1d')](function(){return _0xa40cba;});})[_0xcbbb('0x1d')](function(){return _0xa40cba;});}})[_0xcbbb('0x1d')](function(_0x4145d6){if(_0x4145d6){return _0x4145d6[_0xcbbb('0x66')](_0x4de2dd[_0xcbbb('0x27')][_0xcbbb('0x5c')])[_0xcbbb('0x1d')](function(_0x1fafc4){if(_['isArray'](_0x4de2dd['query'][_0xcbbb('0x5c')])){for(var _0xc35b1f=0x0;_0xc35b1f<_0x4de2dd[_0xcbbb('0x27')][_0xcbbb('0x5c')][_0xcbbb('0x3d')];_0xc35b1f+=0x1){socket['emit'](_0xcbbb('0x67'),{'UserId':_0x4de2dd[_0xcbbb('0x27')]['ids'][_0xc35b1f],'TeamId':_0x4de2dd['params']['id']});}}else{socket[_0xcbbb('0x68')]('userTeam:remove',{'UserId':_0x4de2dd[_0xcbbb('0x27')][_0xcbbb('0x5c')],'TeamId':_0x4de2dd[_0xcbbb('0x43')]['id']});}});}})[_0xcbbb('0x1d')](respondWithStatusCode(_0x1c9dd2,null))['catch'](handleError(_0x1c9dd2,null));};exports['getAgents']=function(_0x315796,_0x2d6321,_0x55720a){var _0x20e46f={};var _0x28c1d4={};var _0x1815b7;var _0x3834b5;return db[_0xcbbb('0x37')][_0xcbbb('0x45')]({'where':{'id':_0x315796[_0xcbbb('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d6321,null))[_0xcbbb('0x1d')](function(_0x28c5c9){if(_0x28c5c9){_0x1815b7=_0x28c5c9;_0x28c1d4['model']=_[_0xcbbb('0x26')](db['User'][_0xcbbb('0x24')]);_0x28c1d4[_0xcbbb('0x27')]=_[_0xcbbb('0x26')](_0x315796[_0xcbbb('0x27')]);_0x28c1d4['filters']=_[_0xcbbb('0x2b')](_0x28c1d4[_0xcbbb('0x25')],_0x28c1d4[_0xcbbb('0x27')]);_0x20e46f[_0xcbbb('0x2c')]=_[_0xcbbb('0x2b')](_0x28c1d4['model'],qs['fields'](_0x315796[_0xcbbb('0x27')][_0xcbbb('0x2d')]));_0x20e46f[_0xcbbb('0x2c')]=_0x20e46f[_0xcbbb('0x2c')][_0xcbbb('0x3d')]?_0x20e46f['attributes']:_0x28c1d4['model'];_0x20e46f[_0xcbbb('0x4c')]=qs[_0xcbbb('0x30')](_0x315796[_0xcbbb('0x27')][_0xcbbb('0x30')]);_0x20e46f[_0xcbbb('0x31')]=qs['filters'](_[_0xcbbb('0x32')](_0x315796[_0xcbbb('0x27')],_0x28c1d4[_0xcbbb('0x2a')]));if(_0x315796['query'][_0xcbbb('0x34')]){_0x20e46f[_0xcbbb('0x31')]=_[_0xcbbb('0x33')](_0x20e46f[_0xcbbb('0x31')],{'$or':_[_0xcbbb('0x35')](_0x20e46f[_0xcbbb('0x2c')],function(_0x20cc1b){var _0x113f5e={};_0x113f5e[_0x20cc1b]={'$like':'%'+_0x315796['query'][_0xcbbb('0x34')]+'%'};return _0x113f5e;})});}_0x20e46f=_['merge']({},_0x20e46f,_0x315796['options']);return _0x1815b7['getAgents'](_0x20e46f);}})[_0xcbbb('0x1d')](function(_0x55d7d2){if(_0x55d7d2){_0x3834b5=_0x55d7d2[_0xcbbb('0x3d')];if(!_0x315796[_0xcbbb('0x27')]['hasOwnProperty'](_0xcbbb('0x2f'))){_0x20e46f[_0xcbbb('0x19')]=qs['limit'](_0x315796[_0xcbbb('0x27')][_0xcbbb('0x19')]);_0x20e46f[_0xcbbb('0x18')]=qs['offset'](_0x315796[_0xcbbb('0x27')][_0xcbbb('0x18')]);}return _0x1815b7[_0xcbbb('0x69')](_0x20e46f);}})[_0xcbbb('0x1d')](function(_0x1e12db){if(_0x1e12db){return _0x1e12db?{'count':_0x3834b5,'rows':_0x1e12db}:null;}})[_0xcbbb('0x1d')](respondWithResult(_0x2d6321,null))[_0xcbbb('0x3f')](handleError(_0x2d6321,null));}; \ No newline at end of file +var _0x7cfe=['getQueues','channel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','Queue','pick','get','capitalize','Queues','addQueues','findOne','ids','isValidChannel','remove','addAgents','each','voice','chat','mail','sms','fax','openchannel','loginInPause','voicePause','UserVoiceQueueRt','upsert','%s/%s','SIP','omit','emit','userTeam:save','removeAgents','isArray','userTeam:remove','getAgents','hasOwnProperty','nolimit','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','Team','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','order','sort','dateEnd','add','day','merge','filter','where','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x48112e,_0x261e02){var _0x4789ed=function(_0x316ea7){while(--_0x316ea7){_0x48112e['push'](_0x48112e['shift']());}};_0x4789ed(++_0x261e02);}(_0x7cfe,0x94));var _0xe7cf=function(_0x28e7f6,_0x4c0424){_0x28e7f6=_0x28e7f6-0x0;var _0x3d2e18=_0x7cfe[_0x28e7f6];return _0x3d2e18;};'use strict';var jsonpatch=require(_0xe7cf('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe7cf('0x1'));var Mustache=require(_0xe7cf('0x2'));var util=require(_0xe7cf('0x3'));var path=require(_0xe7cf('0x4'));var sox=require(_0xe7cf('0x5'));var csv=require(_0xe7cf('0x6'));var ejs=require(_0xe7cf('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe7cf('0x8'));var crypto=require(_0xe7cf('0x9'));var jsforce=require(_0xe7cf('0xa'));var deskjs=require(_0xe7cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe7cf('0xc'));var Papa=require(_0xe7cf('0xd'));var qs=require(_0xe7cf('0xe'));var logger=require('../../config/logger')(_0xe7cf('0xf'));var utils=require(_0xe7cf('0x10'));var config=require(_0xe7cf('0x11'));var db=require(_0xe7cf('0x12'))['db'];var socket=require(_0xe7cf('0x13'))({'host':_0xe7cf('0x14'),'port':0x18eb});require('./team.socket')[_0xe7cf('0x15')](socket);function respondWithStatusCode(_0x1c0a5d,_0x257f4f){_0x257f4f=_0x257f4f||0xcc;return function(_0x58e3ef){if(_0x58e3ef){return _0x1c0a5d[_0xe7cf('0x16')](_0x257f4f);}return _0x1c0a5d[_0xe7cf('0x17')](_0x257f4f)['end']();};}function respondWithResult(_0x4c12be,_0x53705c){_0x53705c=_0x53705c||0xc8;return function(_0x25ee7c){if(_0x25ee7c){return _0x4c12be['status'](_0x53705c)[_0xe7cf('0x18')](_0x25ee7c);}};}function respondWithFilteredResult(_0x37c3c9,_0x413cf7){return function(_0x58c826){if(_0x58c826){var _0x25f2fc=_0x58c826[_0xe7cf('0x19')],_0x536f07=_0x413cf7['offset'],_0x58a622=_0x413cf7[_0xe7cf('0x1a')]+_0x413cf7[_0xe7cf('0x1b')],_0x2985ce;if(_0x58a622>=_0x25f2fc){_0x58a622=_0x25f2fc;_0x2985ce=0xc8;}else{_0x2985ce=0xce;}_0x37c3c9['status'](_0x2985ce);return _0x37c3c9[_0xe7cf('0x1c')](_0xe7cf('0x1d'),_0x536f07+'-'+_0x58a622+'/'+_0x25f2fc)[_0xe7cf('0x18')](_0x58c826);}return null;};}function patchUpdates(_0x52a9fb){return function(_0x4a5e43){try{jsonpatch['apply'](_0x4a5e43,_0x52a9fb,!![]);}catch(_0x50687d){return BPromise[_0xe7cf('0x1e')](_0x50687d);}return _0x4a5e43['save']();};}function saveUpdates(_0x2408cb,_0x2207c6){return function(_0x5967a9){if(_0x5967a9){return _0x5967a9[_0xe7cf('0x1f')](_0x2408cb)[_0xe7cf('0x20')](function(_0x33c6bd){return _0x33c6bd;});}return null;};}function removeEntity(_0x5ea7a1,_0xbe8e61){return function(_0x6fedca){if(_0x6fedca){return _0x6fedca[_0xe7cf('0x21')]()[_0xe7cf('0x20')](function(){_0x5ea7a1[_0xe7cf('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x562ba1,_0x197142){return function(_0x4bc3a9){if(!_0x4bc3a9){_0x562ba1[_0xe7cf('0x16')](0x194);}return _0x4bc3a9;};}function handleError(_0x335619,_0x5459d2){_0x5459d2=_0x5459d2||0x1f4;return function(_0x60116d){logger[_0xe7cf('0x22')](_0x60116d[_0xe7cf('0x23')]);if(_0x60116d[_0xe7cf('0x24')]){delete _0x60116d[_0xe7cf('0x24')];}_0x335619[_0xe7cf('0x17')](_0x5459d2)[_0xe7cf('0x25')](_0x60116d);};}exports[_0xe7cf('0x26')]=function(_0x567f95,_0x1a48dc){var _0x342a1b={},_0x26a977={},_0x5bd7c5={'count':0x0,'rows':[]};var _0x13b5ec=db[_0xe7cf('0x27')][_0xe7cf('0x28')];_0x26a977[_0xe7cf('0x29')]=_[_0xe7cf('0x2a')](_0x13b5ec);var _0xec8824={'dateStart':_0x567f95[_0xe7cf('0x2b')][_0xe7cf('0x2c')],'dateEnd':_0x567f95['query']['dateEnd']};delete _0x567f95[_0xe7cf('0x2b')]['dateStart'];delete _0x567f95[_0xe7cf('0x2b')]['dateEnd'];_0x26a977[_0xe7cf('0x2b')]=_[_0xe7cf('0x2a')](_0x567f95[_0xe7cf('0x2b')]);_0x26a977[_0xe7cf('0x2d')]=_[_0xe7cf('0x2e')](_0x26a977[_0xe7cf('0x29')],_0x26a977['query']);_0x342a1b[_0xe7cf('0x2f')]=_[_0xe7cf('0x2e')](_0x26a977[_0xe7cf('0x29')],qs[_0xe7cf('0x30')](_0x567f95['query'][_0xe7cf('0x30')]));_0x342a1b[_0xe7cf('0x2f')]=_0x342a1b[_0xe7cf('0x2f')][_0xe7cf('0x31')]?_0x342a1b[_0xe7cf('0x2f')]:_0x26a977['model'];if(!_0x567f95[_0xe7cf('0x2b')]['hasOwnProperty']('nolimit')){_0x342a1b[_0xe7cf('0x1b')]=qs[_0xe7cf('0x1b')](_0x567f95[_0xe7cf('0x2b')][_0xe7cf('0x1b')]);_0x342a1b[_0xe7cf('0x1a')]=qs[_0xe7cf('0x1a')](_0x567f95['query']['offset']);}_0x342a1b[_0xe7cf('0x32')]=qs[_0xe7cf('0x33')](_0x567f95[_0xe7cf('0x2b')][_0xe7cf('0x33')]);_0x342a1b['where']=qs[_0xe7cf('0x2d')](_['pick'](_0x567f95[_0xe7cf('0x2b')],_0x26a977['filters']));if(_0xec8824[_0xe7cf('0x2c')]){if(_0xec8824[_0xe7cf('0x34')]){_0xec8824[_0xe7cf('0x34')]=moment(_0xec8824[_0xe7cf('0x34')])[_0xe7cf('0x35')](0x1,_0xe7cf('0x36'));}else{_0xec8824[_0xe7cf('0x34')]=moment(_0xec8824[_0xe7cf('0x2c')])[_0xe7cf('0x35')](0x1,_0xe7cf('0x36'));}_[_0xe7cf('0x37')](_0x342a1b['where'],{'createdAt':{'$gte':_0xec8824['dateStart'],'$lte':_0xec8824[_0xe7cf('0x34')]}});}if(_0x567f95[_0xe7cf('0x2b')][_0xe7cf('0x38')]){_0x342a1b[_0xe7cf('0x39')]=_[_0xe7cf('0x37')](_0x342a1b[_0xe7cf('0x39')],{'$or':_[_0xe7cf('0x3a')](_0x342a1b[_0xe7cf('0x2f')],function(_0x659d1a){var _0x5d143d={};_0x5d143d[_0x659d1a]={'$like':'%'+_0x567f95['query'][_0xe7cf('0x38')]+'%'};return _0x5d143d;})});}_0x342a1b=_[_0xe7cf('0x37')]({},_0x342a1b,_0x567f95[_0xe7cf('0x3b')]);var _0x5069c8={'where':_0x342a1b['where']};return db[_0xe7cf('0x27')][_0xe7cf('0x19')](_0x5069c8)[_0xe7cf('0x20')](function(_0x28335f){_0x5bd7c5[_0xe7cf('0x19')]=_0x28335f;if(_0x567f95['query'][_0xe7cf('0x3c')]){_0x342a1b[_0xe7cf('0x3d')]=[{'all':!![]}];}return db[_0xe7cf('0x27')][_0xe7cf('0x3e')](_0x342a1b);})[_0xe7cf('0x20')](function(_0x475899){_0x5bd7c5[_0xe7cf('0x3f')]=_0x475899;return _0x5bd7c5;})[_0xe7cf('0x20')](respondWithFilteredResult(_0x1a48dc,_0x342a1b))[_0xe7cf('0x40')](handleError(_0x1a48dc,null));};exports[_0xe7cf('0x41')]=function(_0x37c10c,_0x1eb167){var _0x902624={'raw':![],'where':{'id':_0x37c10c[_0xe7cf('0x42')]['id']}},_0x589578={};_0x589578[_0xe7cf('0x29')]=_[_0xe7cf('0x2a')](db[_0xe7cf('0x27')][_0xe7cf('0x28')]);_0x589578['query']=_[_0xe7cf('0x2a')](_0x37c10c[_0xe7cf('0x2b')]);_0x589578[_0xe7cf('0x2d')]=_[_0xe7cf('0x2e')](_0x589578[_0xe7cf('0x29')],_0x589578[_0xe7cf('0x2b')]);_0x902624[_0xe7cf('0x2f')]=_[_0xe7cf('0x2e')](_0x589578[_0xe7cf('0x29')],qs[_0xe7cf('0x30')](_0x37c10c[_0xe7cf('0x2b')]['fields']));_0x902624['attributes']=_0x902624[_0xe7cf('0x2f')][_0xe7cf('0x31')]?_0x902624[_0xe7cf('0x2f')]:_0x589578[_0xe7cf('0x29')];if(_0x37c10c[_0xe7cf('0x2b')]['includeAll']){_0x902624[_0xe7cf('0x3d')]=[{'all':!![]}];}_0x902624=_[_0xe7cf('0x37')]({},_0x902624,_0x37c10c['options']);return db[_0xe7cf('0x27')][_0xe7cf('0x43')](_0x902624)[_0xe7cf('0x20')](handleEntityNotFound(_0x1eb167,null))[_0xe7cf('0x20')](respondWithResult(_0x1eb167,null))[_0xe7cf('0x40')](handleError(_0x1eb167,null));};exports['create']=function(_0x1fcb9d,_0x2003e8){return db[_0xe7cf('0x27')][_0xe7cf('0x44')](_0x1fcb9d['body'],{})[_0xe7cf('0x20')](respondWithResult(_0x2003e8,0xc9))['catch'](handleError(_0x2003e8,null));};exports[_0xe7cf('0x1f')]=function(_0x402e78,_0x714782){if(_0x402e78[_0xe7cf('0x45')]['id']){delete _0x402e78[_0xe7cf('0x45')]['id'];}return db['Team'][_0xe7cf('0x43')]({'where':{'id':_0x402e78['params']['id']}})['then'](handleEntityNotFound(_0x714782,null))[_0xe7cf('0x20')](saveUpdates(_0x402e78[_0xe7cf('0x45')],null))[_0xe7cf('0x20')](respondWithResult(_0x714782,null))['catch'](handleError(_0x714782,null));};exports[_0xe7cf('0x21')]=function(_0x564b6c,_0x59b474){return db[_0xe7cf('0x27')][_0xe7cf('0x43')]({'where':{'id':_0x564b6c[_0xe7cf('0x42')]['id']}})['then'](handleEntityNotFound(_0x59b474,null))[_0xe7cf('0x20')](removeEntity(_0x59b474,null))[_0xe7cf('0x40')](handleError(_0x59b474,null));};exports[_0xe7cf('0x46')]=function(_0x41b154,_0x4be267,_0x49e371){return db[_0xe7cf('0x27')]['findOne']({'where':{'id':_0x41b154[_0xe7cf('0x42')]['id']}})[_0xe7cf('0x20')](handleEntityNotFound(_0x4be267,null))[_0xe7cf('0x20')](function(_0x4ecf74){if(!_0x41b154[_0xe7cf('0x2b')][_0xe7cf('0x47')]||!utils['isValidChannel'](_0x41b154[_0xe7cf('0x2b')][_0xe7cf('0x47')])){throw new db[(_0xe7cf('0x48'))][(_0xe7cf('0x49'))](_0xe7cf('0x4a'));}var _0x20c9f4={};var _0x4913ee={};_0x4913ee['model']=_[_0xe7cf('0x2a')](db[_['capitalize'](_0x41b154[_0xe7cf('0x2b')][_0xe7cf('0x47')][_0xe7cf('0x4b')]())+_0xe7cf('0x4c')][_0xe7cf('0x28')]);_0x4913ee['query']=_['keys'](_0x41b154[_0xe7cf('0x2b')]);_0x4913ee[_0xe7cf('0x2d')]=_[_0xe7cf('0x2e')](_0x4913ee['model'],_0x4913ee[_0xe7cf('0x2b')]);_0x20c9f4[_0xe7cf('0x2f')]=_['intersection'](_0x4913ee[_0xe7cf('0x29')],qs[_0xe7cf('0x30')](_0x41b154[_0xe7cf('0x2b')][_0xe7cf('0x30')]));_0x20c9f4[_0xe7cf('0x2f')]=_0x20c9f4[_0xe7cf('0x2f')][_0xe7cf('0x31')]?_0x20c9f4[_0xe7cf('0x2f')]:_0x4913ee['model'];_0x20c9f4[_0xe7cf('0x1b')]=qs[_0xe7cf('0x1b')](_0x41b154['query'][_0xe7cf('0x1b')]);_0x20c9f4['offset']=qs[_0xe7cf('0x1a')](_0x41b154[_0xe7cf('0x2b')][_0xe7cf('0x1a')]);_0x20c9f4[_0xe7cf('0x32')]=qs[_0xe7cf('0x33')](_0x41b154[_0xe7cf('0x2b')][_0xe7cf('0x33')]);_0x20c9f4[_0xe7cf('0x39')]=qs[_0xe7cf('0x2d')](_[_0xe7cf('0x4d')](_0x41b154[_0xe7cf('0x2b')],_0x4913ee['filters']));_0x20c9f4=_['merge']({},_0x20c9f4,_0x41b154['options']);return _0x4ecf74[_0xe7cf('0x4e')+_[_0xe7cf('0x4f')](_0x41b154['query'][_0xe7cf('0x47')][_0xe7cf('0x4b')]())+_0xe7cf('0x50')](_0x20c9f4);})[_0xe7cf('0x20')](respondWithResult(_0x4be267,null))['catch'](handleError(_0x4be267,null));};exports[_0xe7cf('0x51')]=function(_0x1c5e65,_0x5e4a88,_0x3eef57){return db[_0xe7cf('0x27')][_0xe7cf('0x52')]({'where':{'id':_0x1c5e65[_0xe7cf('0x42')]['id']}})['then'](function(_0x3260f7){if(_0x3260f7){if(!_0x1c5e65[_0xe7cf('0x45')][_0xe7cf('0x47')]||!utils['isValidChannel'](_0x1c5e65['body'][_0xe7cf('0x47')])){throw new db[(_0xe7cf('0x48'))]['ValidationError'](_0xe7cf('0x4a'));}return _0x3260f7[_0xe7cf('0x35')+_[_0xe7cf('0x4f')](_0x1c5e65[_0xe7cf('0x45')]['channel'][_0xe7cf('0x4b')]())+_0xe7cf('0x50')](_0x1c5e65['body'][_0xe7cf('0x53')]);}return null;})['then'](handleEntityNotFound(_0x5e4a88,null))[_0xe7cf('0x20')](respondWithStatusCode(_0x5e4a88,null))[_0xe7cf('0x40')](handleError(_0x5e4a88,null));};exports['removeQueues']=function(_0x19e174,_0x3fa4cb,_0x479022){return db['Team']['findOne']({'where':{'id':_0x19e174[_0xe7cf('0x42')]['id']}})['then'](function(_0x11dba1){if(_0x11dba1){if(!_0x19e174[_0xe7cf('0x2b')][_0xe7cf('0x47')]||!utils[_0xe7cf('0x54')](_0x19e174['query'][_0xe7cf('0x47')])){throw new db[(_0xe7cf('0x48'))]['ValidationError']('Unknown\x20channel');}return _0x11dba1[_0xe7cf('0x55')+_['capitalize'](_0x19e174[_0xe7cf('0x2b')][_0xe7cf('0x47')]['toLowerCase']())+_0xe7cf('0x50')](_0x19e174['query'][_0xe7cf('0x53')]);}return null;})[_0xe7cf('0x20')](handleEntityNotFound(_0x3fa4cb,null))[_0xe7cf('0x20')](respondWithStatusCode(_0x3fa4cb,null))[_0xe7cf('0x40')](handleError(_0x3fa4cb,null));};exports[_0xe7cf('0x56')]=function(_0x21a810,_0xb249a1,_0xc41247){return db['Team'][_0xe7cf('0x43')]({'where':{'id':_0x21a810[_0xe7cf('0x42')]['id']}})[_0xe7cf('0x20')](handleEntityNotFound(_0xb249a1,null))['then'](function(_0x15ec1f){if(_0x15ec1f){return BPromise[_0xe7cf('0x57')]([_0xe7cf('0x58'),_0xe7cf('0x59'),_0xe7cf('0x5a'),_0xe7cf('0x5b'),_0xe7cf('0x5c'),_0xe7cf('0x5d')],function(_0x33a2b7){return _0x15ec1f[_0xe7cf('0x4e')+_[_0xe7cf('0x4f')](_0x33a2b7)+_0xe7cf('0x50')]({'attributes':['id','name']})[_0xe7cf('0x20')](function(_0xdc4542){return BPromise[_0xe7cf('0x57')](_0xdc4542,function(_0x278197){return _0x278197[_0xe7cf('0x56')](_0x21a810[_0xe7cf('0x45')]['ids'])[_0xe7cf('0x20')](function(){if(_0x33a2b7===_0xe7cf('0x58')){return db['User'][_0xe7cf('0x3e')]({'where':{'id':_0x21a810[_0xe7cf('0x45')][_0xe7cf('0x53')]},'attributes':['id',_0xe7cf('0x24'),_0xe7cf('0x5e'),_0xe7cf('0x5f')],'raw':!![]});}})[_0xe7cf('0x20')](function(_0x5ef75f){if(_0x33a2b7==='voice'){return BPromise[_0xe7cf('0x57')](_0x5ef75f,function(_0x1817c0){return db[_0xe7cf('0x60')][_0xe7cf('0x61')]({'membername':_0x1817c0['name'],'UserId':_0x1817c0['id'],'queue_name':_0x278197['name'],'VoiceQueueId':_0x278197['id'],'interface':util['format'](_0xe7cf('0x62'),_0xe7cf('0x63'),_0x1817c0[_0xe7cf('0x24')]),'paused':_0x1817c0[_0xe7cf('0x5f')]||![],'penalty':0x0});});}});});})[_0xe7cf('0x20')](function(){return _0x15ec1f;});})[_0xe7cf('0x20')](function(){return _0x15ec1f;});}})[_0xe7cf('0x20')](function(_0x5a51c2){if(_0x5a51c2){return _0x5a51c2[_0xe7cf('0x56')](_0x21a810[_0xe7cf('0x45')][_0xe7cf('0x53')],_[_0xe7cf('0x64')](_0x21a810[_0xe7cf('0x45')],[_0xe7cf('0x53'),'id'])||{})['spread'](function(_0x326b8c){for(var _0x1893e9=0x0;_0x1893e9<_0x21a810[_0xe7cf('0x45')]['ids'][_0xe7cf('0x31')];_0x1893e9+=0x1){socket[_0xe7cf('0x65')](_0xe7cf('0x66'),{'UserId':_0x21a810[_0xe7cf('0x45')]['ids'][_0x1893e9],'TeamId':_0x21a810['params']['id']});}return _0x326b8c;});}})[_0xe7cf('0x20')](respondWithResult(_0xb249a1,null))['catch'](handleError(_0xb249a1,null));};exports[_0xe7cf('0x67')]=function(_0xa5464f,_0x23ebe2,_0x32f81b){var _0x1f8ba2;return db[_0xe7cf('0x27')][_0xe7cf('0x43')]({'where':{'id':_0xa5464f[_0xe7cf('0x42')]['id']}})[_0xe7cf('0x20')](handleEntityNotFound(_0x23ebe2,null))[_0xe7cf('0x20')](function(_0x4b8c4b){if(_0x4b8c4b){return BPromise[_0xe7cf('0x57')]([_0xe7cf('0x58'),_0xe7cf('0x59'),_0xe7cf('0x5a'),'sms',_0xe7cf('0x5c'),_0xe7cf('0x5d')],function(_0xa79966){return _0x4b8c4b[_0xe7cf('0x4e')+_[_0xe7cf('0x4f')](_0xa79966)+_0xe7cf('0x50')]({'attributes':['id',_0xe7cf('0x24')]})['then'](function(_0x50bc6c){return BPromise[_0xe7cf('0x57')](_0x50bc6c,function(_0x341c88){return _0x341c88[_0xe7cf('0x67')](_0xa5464f['query'][_0xe7cf('0x53')])['then'](function(){if(_0xa79966===_0xe7cf('0x58')){return db[_0xe7cf('0x60')][_0xe7cf('0x21')]({'where':{'VoiceQueueId':_0x341c88['id'],'UserId':_0xa5464f[_0xe7cf('0x2b')][_0xe7cf('0x53')]}});}});});})[_0xe7cf('0x20')](function(){return _0x4b8c4b;});})[_0xe7cf('0x20')](function(){return _0x4b8c4b;});}})[_0xe7cf('0x20')](function(_0x3bc42e){if(_0x3bc42e){return _0x3bc42e['removeAgents'](_0xa5464f['query'][_0xe7cf('0x53')])['then'](function(_0xe0b36e){if(_[_0xe7cf('0x68')](_0xa5464f[_0xe7cf('0x2b')][_0xe7cf('0x53')])){for(var _0x3aee42=0x0;_0x3aee42<_0xa5464f[_0xe7cf('0x2b')][_0xe7cf('0x53')][_0xe7cf('0x31')];_0x3aee42+=0x1){socket[_0xe7cf('0x65')]('userTeam:remove',{'UserId':_0xa5464f['query'][_0xe7cf('0x53')][_0x3aee42],'TeamId':_0xa5464f['params']['id']});}}else{socket[_0xe7cf('0x65')](_0xe7cf('0x69'),{'UserId':_0xa5464f[_0xe7cf('0x2b')]['ids'],'TeamId':_0xa5464f[_0xe7cf('0x42')]['id']});}});}})[_0xe7cf('0x20')](respondWithStatusCode(_0x23ebe2,null))['catch'](handleError(_0x23ebe2,null));};exports[_0xe7cf('0x6a')]=function(_0x289e8d,_0x32abed,_0x68a1f0){var _0x43cd35={};var _0x4cc60d={};var _0x22ffb0;var _0x1813f5;return db[_0xe7cf('0x27')][_0xe7cf('0x52')]({'where':{'id':_0x289e8d['params']['id']}})[_0xe7cf('0x20')](handleEntityNotFound(_0x32abed,null))[_0xe7cf('0x20')](function(_0x1f9480){if(_0x1f9480){_0x22ffb0=_0x1f9480;_0x4cc60d['model']=_[_0xe7cf('0x2a')](db['User'][_0xe7cf('0x28')]);_0x4cc60d[_0xe7cf('0x2b')]=_[_0xe7cf('0x2a')](_0x289e8d[_0xe7cf('0x2b')]);_0x4cc60d[_0xe7cf('0x2d')]=_['intersection'](_0x4cc60d[_0xe7cf('0x29')],_0x4cc60d[_0xe7cf('0x2b')]);_0x43cd35[_0xe7cf('0x2f')]=_['intersection'](_0x4cc60d['model'],qs[_0xe7cf('0x30')](_0x289e8d['query'][_0xe7cf('0x30')]));_0x43cd35[_0xe7cf('0x2f')]=_0x43cd35[_0xe7cf('0x2f')]['length']?_0x43cd35['attributes']:_0x4cc60d['model'];_0x43cd35[_0xe7cf('0x32')]=qs[_0xe7cf('0x33')](_0x289e8d[_0xe7cf('0x2b')][_0xe7cf('0x33')]);_0x43cd35['where']=qs[_0xe7cf('0x2d')](_[_0xe7cf('0x4d')](_0x289e8d[_0xe7cf('0x2b')],_0x4cc60d[_0xe7cf('0x2d')]));if(_0x289e8d['query']['filter']){_0x43cd35[_0xe7cf('0x39')]=_[_0xe7cf('0x37')](_0x43cd35[_0xe7cf('0x39')],{'$or':_[_0xe7cf('0x3a')](_0x43cd35[_0xe7cf('0x2f')],function(_0x163f57){var _0x2acb7b={};_0x2acb7b[_0x163f57]={'$like':'%'+_0x289e8d['query'][_0xe7cf('0x38')]+'%'};return _0x2acb7b;})});}_0x43cd35=_[_0xe7cf('0x37')]({},_0x43cd35,_0x289e8d[_0xe7cf('0x3b')]);return _0x22ffb0[_0xe7cf('0x6a')](_0x43cd35);}})[_0xe7cf('0x20')](function(_0x21f2a4){if(_0x21f2a4){_0x1813f5=_0x21f2a4['length'];if(!_0x289e8d['query'][_0xe7cf('0x6b')](_0xe7cf('0x6c'))){_0x43cd35[_0xe7cf('0x1b')]=qs[_0xe7cf('0x1b')](_0x289e8d[_0xe7cf('0x2b')][_0xe7cf('0x1b')]);_0x43cd35[_0xe7cf('0x1a')]=qs[_0xe7cf('0x1a')](_0x289e8d['query'][_0xe7cf('0x1a')]);}return _0x22ffb0['getAgents'](_0x43cd35);}})[_0xe7cf('0x20')](function(_0x79cd7e){if(_0x79cd7e){return _0x79cd7e?{'count':_0x1813f5,'rows':_0x79cd7e}:null;}})[_0xe7cf('0x20')](respondWithResult(_0x32abed,null))[_0xe7cf('0x40')](handleError(_0x32abed,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 1797e07..8ade255 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 _0x6b46=['hook','exports','events','../../mysqldb','Team','save','remove','emit','hasOwnProperty'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x6b46,0x1c4));var _0x66b4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6b46[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x66b4('0x0'));var Team=require(_0x66b4('0x1'))['db'][_0x66b4('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66b4('0x3'),'afterUpdate':'update','afterDestroy':_0x66b4('0x4')};function emitEvent(_0x1581ae){return function(_0x1ccf82,_0x5d1df5,_0x3aee93){TeamEvents[_0x66b4('0x5')](_0x1581ae+':'+_0x1ccf82['id'],_0x1ccf82);TeamEvents[_0x66b4('0x5')](_0x1581ae,_0x1ccf82);_0x3aee93(null);};}for(var e in events){if(events[_0x66b4('0x6')](e)){var event=events[e];Team[_0x66b4('0x7')](e,emitEvent(event));}}module[_0x66b4('0x8')]=TeamEvents; \ No newline at end of file +var _0x01f5=['hook','exports','../../mysqldb','Team','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x19e1b7,_0xb8e7b9){var _0x2ee04d=function(_0xc56737){while(--_0xc56737){_0x19e1b7['push'](_0x19e1b7['shift']());}};_0x2ee04d(++_0xb8e7b9);}(_0x01f5,0x1f1));var _0x501f=function(_0x5285ed,_0x389077){_0x5285ed=_0x5285ed-0x0;var _0x2ea9d5=_0x01f5[_0x5285ed];return _0x2ea9d5;};'use strict';var EventEmitter=require('events');var Team=require(_0x501f('0x0'))['db'][_0x501f('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x501f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x501f('0x3'),'afterDestroy':_0x501f('0x4')};function emitEvent(_0xa49df9){return function(_0xb4222,_0x172ce5,_0xfbc4b9){TeamEvents[_0x501f('0x5')](_0xa49df9+':'+_0xb4222['id'],_0xb4222);TeamEvents[_0x501f('0x5')](_0xa49df9,_0xb4222);_0xfbc4b9(null);};}for(var e in events){if(events[_0x501f('0x6')](e)){var event=events[e];Team[_0x501f('0x7')](e,emitEvent(event));}}module[_0x501f('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 b06ac20..fb2b1d2 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','./team.attributes','exports','define','Team','teams','util'];(function(_0x22aacb,_0x5018af){var _0x3c9d6a=function(_0x2de898){while(--_0x2de898){_0x22aacb['push'](_0x22aacb['shift']());}};_0x3c9d6a(++_0x5018af);}(_0xedd9,0xfc));var _0x9edd=function(_0x23b1fd,_0x347756){_0x23b1fd=_0x23b1fd-0x0;var _0x2bac5d=_0xedd9[_0x23b1fd];return _0x2bac5d;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var attributes=require(_0x9edd('0x6'));module[_0x9edd('0x7')]=function(_0x5943b3,_0x33679f){return _0x5943b3[_0x9edd('0x8')](_0x9edd('0x9'),attributes,{'tableName':_0x9edd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['exports','define','teams','lodash','util','../../config/logger','bluebird','./team.attributes'];(function(_0x5456fb,_0x14a676){var _0x3e380b=function(_0x4b8e8a){while(--_0x4b8e8a){_0x5456fb['push'](_0x5456fb['shift']());}};_0x3e380b(++_0x14a676);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var attributes=require(_0x0a9e('0x4'));module[_0x0a9e('0x5')]=function(_0x2ab90b,_0x991246){return _0x2ab90b[_0x0a9e('0x6')]('Team',attributes,{'tableName':_0x0a9e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b3c9368..4900980 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 _0xee94=['jayson/promise','socket.io-emitter','localhost','register','then','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xee94,0x1f2));var _0x4ee9=function(_0x54133c,_0x2b770d){_0x54133c=_0x54133c-0x0;var _0x3c32f4=_0xee94[_0x54133c];return _0x3c32f4;};'use strict';var _=require(_0x4ee9('0x0'));var util=require(_0x4ee9('0x1'));var moment=require(_0x4ee9('0x2'));var BPromise=require(_0x4ee9('0x3'));var rs=require(_0x4ee9('0x4'));var fs=require('fs');var db=require(_0x4ee9('0x5'))['db'];var utils=require(_0x4ee9('0x6'));var logger=require('../../config/logger')(_0x4ee9('0x7'));var config=require('../../config/environment');var jayson=require(_0x4ee9('0x8'));var client=jayson['client']['http']({'port':0x232a});var socket=require(_0x4ee9('0x9'))({'host':_0x4ee9('0xa'),'port':0x18eb});require('./team.socket')[_0x4ee9('0xb')](socket);function respondWithRpcPromise(_0x2fd2e4,_0xe62a1b,_0x52f87d){return new BPromise(function(_0x9fe172,_0x5a24ff){return client['request'](_0x2fd2e4,_0x52f87d)[_0x4ee9('0xc')](function(_0xb1e5d2){logger['info']('Team,\x20%s,\x20%s',_0xe62a1b,'request\x20sent');logger[_0x4ee9('0xd')](_0x4ee9('0xe'),_0xe62a1b,_0x4ee9('0xf'),JSON[_0x4ee9('0x10')](_0xb1e5d2));if(_0xb1e5d2[_0x4ee9('0x11')]){if(_0xb1e5d2[_0x4ee9('0x11')][_0x4ee9('0x12')]===0x1f4){logger[_0x4ee9('0x11')](_0x4ee9('0x13'),_0xe62a1b,_0xb1e5d2[_0x4ee9('0x11')]['message']);return _0x5a24ff(_0xb1e5d2[_0x4ee9('0x11')][_0x4ee9('0x14')]);}logger[_0x4ee9('0x11')]('Team,\x20%s,\x20%s',_0xe62a1b,_0xb1e5d2[_0x4ee9('0x11')][_0x4ee9('0x14')]);return _0x9fe172(_0xb1e5d2[_0x4ee9('0x11')]['message']);}else{logger['info'](_0x4ee9('0x13'),_0xe62a1b,'request\x20sent');_0x9fe172(_0xb1e5d2['result'][_0x4ee9('0x14')]);}})[_0x4ee9('0x15')](function(_0x376b7d){logger[_0x4ee9('0x11')](_0x4ee9('0x13'),_0xe62a1b,_0x376b7d);_0x5a24ff(_0x376b7d);});});} \ No newline at end of file +var _0xb677=['moment','randomstring','rpc','client','http','localhost','./team.socket','request','then','info','Team,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','lodash','util'];(function(_0x84355,_0x53ce20){var _0x156003=function(_0x310418){while(--_0x310418){_0x84355['push'](_0x84355['shift']());}};_0x156003(++_0x53ce20);}(_0xb677,0x1a0));var _0x7b67=function(_0x5d5e75,_0x22ccb7){_0x5d5e75=_0x5d5e75-0x0;var _0x30272b=_0xb677[_0x5d5e75];return _0x30272b;};'use strict';var _=require(_0x7b67('0x0'));var util=require(_0x7b67('0x1'));var moment=require(_0x7b67('0x2'));var BPromise=require('bluebird');var rs=require(_0x7b67('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b67('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7b67('0x5')][_0x7b67('0x6')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x7b67('0x7'),'port':0x18eb});require(_0x7b67('0x8'))['register'](socket);function respondWithRpcPromise(_0x4acffa,_0x1b4457,_0x23ddbb){return new BPromise(function(_0x407d70,_0xd40217){return client[_0x7b67('0x9')](_0x4acffa,_0x23ddbb)[_0x7b67('0xa')](function(_0x255dbf){logger[_0x7b67('0xb')](_0x7b67('0xc'),_0x1b4457,'request\x20sent');logger[_0x7b67('0xd')]('Team,\x20%s,\x20%s,\x20%s',_0x1b4457,'request\x20sent',JSON['stringify'](_0x255dbf));if(_0x255dbf['error']){if(_0x255dbf[_0x7b67('0xe')][_0x7b67('0xf')]===0x1f4){logger[_0x7b67('0xe')](_0x7b67('0xc'),_0x1b4457,_0x255dbf[_0x7b67('0xe')][_0x7b67('0x10')]);return _0xd40217(_0x255dbf['error'][_0x7b67('0x10')]);}logger[_0x7b67('0xe')](_0x7b67('0xc'),_0x1b4457,_0x255dbf['error']['message']);return _0x407d70(_0x255dbf[_0x7b67('0xe')][_0x7b67('0x10')]);}else{logger['info'](_0x7b67('0xc'),_0x1b4457,_0x7b67('0x11'));_0x407d70(_0x255dbf['result'][_0x7b67('0x10')]);}})[_0x7b67('0x12')](function(_0x36afae){logger[_0x7b67('0xe')](_0x7b67('0xc'),_0x1b4457,_0x36afae);_0xd40217(_0x36afae);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3259fc4..7d1b3b7 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 _0x8063=['team:','./team.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4e7c0e,_0x55d12b){var _0x5f458c=function(_0x3738ae){while(--_0x3738ae){_0x4e7c0e['push'](_0x4e7c0e['shift']());}};_0x5f458c(++_0x55d12b);}(_0x8063,0xb5));var _0x3806=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8063[_0x21a9d9];return _0x46adce;};'use strict';var TeamEvents=require(_0x3806('0x0'));var events=[_0x3806('0x1'),_0x3806('0x2'),_0x3806('0x3')];function createListener(_0x103f47,_0x50e0fc){return function(_0x29af73){_0x50e0fc[_0x3806('0x4')](_0x103f47,_0x29af73);};}function removeListener(_0x5c1d50,_0xe97931){return function(){TeamEvents[_0x3806('0x5')](_0x5c1d50,_0xe97931);};}exports[_0x3806('0x6')]=function(_0x8395c8){for(var _0x2ecd82=0x0,_0x48241c=events[_0x3806('0x7')];_0x2ecd82<_0x48241c;_0x2ecd82++){var _0xf6af48=events[_0x2ecd82];var _0x26358b=createListener(_0x3806('0x8')+_0xf6af48,_0x8395c8);TeamEvents['on'](_0xf6af48,_0x26358b);}}; \ No newline at end of file +var _0xed89=['length','team:','./team.events','save','remove','emit','removeListener','register'];(function(_0x19bc90,_0x335e95){var _0x250c6f=function(_0x2978da){while(--_0x2978da){_0x19bc90['push'](_0x19bc90['shift']());}};_0x250c6f(++_0x335e95);}(_0xed89,0x1aa));var _0x9ed8=function(_0x4705f4,_0x40e1ea){_0x4705f4=_0x4705f4-0x0;var _0xcf8706=_0xed89[_0x4705f4];return _0xcf8706;};'use strict';var TeamEvents=require(_0x9ed8('0x0'));var events=[_0x9ed8('0x1'),_0x9ed8('0x2'),'update'];function createListener(_0x5690bb,_0x383c6e){return function(_0x7f7630){_0x383c6e[_0x9ed8('0x3')](_0x5690bb,_0x7f7630);};}function removeListener(_0x21572c,_0x277b55){return function(){TeamEvents[_0x9ed8('0x4')](_0x21572c,_0x277b55);};}exports[_0x9ed8('0x5')]=function(_0x141877){for(var _0x2a1d57=0x0,_0x1a7da5=events[_0x9ed8('0x6')];_0x2a1d57<_0x1a7da5;_0x2a1d57++){var _0x16c482=events[_0x2a1d57];var _0x50501c=createListener(_0x9ed8('0x7')+_0x16c482,_0x141877);TeamEvents['on'](_0x16c482,_0x50501c);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8cad305..066ffe0 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 _0xeb80=['express','Router','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4c3afd,_0x3e7a45){var _0x4e2ef3=function(_0x426053){while(--_0x426053){_0x4c3afd['push'](_0x4c3afd['shift']());}};_0x4e2ef3(++_0x3e7a45);}(_0xeb80,0x196));var _0x0eb8=function(_0x20a6ee,_0x1db104){_0x20a6ee=_0x20a6ee-0x0;var _0xdadb53=_0xeb80[_0x20a6ee];return _0xdadb53;};'use strict';var multer=require(_0x0eb8('0x0'));var util=require(_0x0eb8('0x1'));var path=require('path');var express=require(_0x0eb8('0x2'));var router=express[_0x0eb8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0eb8('0x4'));var controller=require(_0x0eb8('0x5'));router[_0x0eb8('0x6')]('/',auth[_0x0eb8('0x7')](),controller[_0x0eb8('0x8')]);router[_0x0eb8('0x6')](_0x0eb8('0x9'),auth[_0x0eb8('0x7')](),controller[_0x0eb8('0xa')]);router[_0x0eb8('0xb')]('/',auth[_0x0eb8('0x7')](),controller[_0x0eb8('0xc')]);router[_0x0eb8('0xd')]('/:id',auth[_0x0eb8('0x7')](),controller['update']);router[_0x0eb8('0xe')]('/:id',auth[_0x0eb8('0x7')](),controller[_0x0eb8('0xf')]);module[_0x0eb8('0x10')]=router; \ No newline at end of file +var _0xa95e=['./template.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','Router','../../config/environment'];(function(_0x390cea,_0x43c078){var _0x14bf80=function(_0x196f3c){while(--_0x196f3c){_0x390cea['push'](_0x390cea['shift']());}};_0x14bf80(++_0x43c078);}(_0xa95e,0x11b));var _0xea95=function(_0x21c170,_0x2f8769){_0x21c170=_0x21c170-0x0;var _0x13f964=_0xa95e[_0x21c170];return _0x13f964;};'use strict';var multer=require(_0xea95('0x0'));var util=require(_0xea95('0x1'));var path=require(_0xea95('0x2'));var express=require('express');var router=express[_0xea95('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea95('0x4'));var controller=require(_0xea95('0x5'));router['get']('/',auth[_0xea95('0x6')](),controller['index']);router[_0xea95('0x7')](_0xea95('0x8'),auth[_0xea95('0x6')](),controller[_0xea95('0x9')]);router[_0xea95('0xa')]('/',auth[_0xea95('0x6')](),controller[_0xea95('0xb')]);router[_0xea95('0xc')](_0xea95('0x8'),auth[_0xea95('0x6')](),controller[_0xea95('0xd')]);router[_0xea95('0xe')](_0xea95('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xea95('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 99e1a99..26c47fd 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 _0x5d89=['sequelize','exports','STRING','TEXT'];(function(_0x153597,_0x492f6f){var _0x27d9de=function(_0x42f31f){while(--_0x42f31f){_0x153597['push'](_0x153597['shift']());}};_0x27d9de(++_0x492f6f);}(_0x5d89,0xe0));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x95d8('0x0'));module[_0x95d8('0x1')]={'name':{'type':Sequelize[_0x95d8('0x2')]},'description':{'type':Sequelize[_0x95d8('0x2')]},'html':{'type':Sequelize[_0x95d8('0x3')]}}; \ No newline at end of file +var _0x96e3=['STRING','exports'];(function(_0x5dea7e,_0x4483b0){var _0x141654=function(_0x3f2550){while(--_0x3f2550){_0x5dea7e['push'](_0x5dea7e['shift']());}};_0x141654(++_0x4483b0);}(_0x96e3,0x1e3));var _0x396e=function(_0x3142d8,_0x399438){_0x3142d8=_0x3142d8-0x0;var _0x1ab546=_0x96e3[_0x3142d8];return _0x1ab546;};'use strict';var Sequelize=require('sequelize');module[_0x396e('0x0')]={'name':{'type':Sequelize[_0x396e('0x1')]},'description':{'type':Sequelize[_0x396e('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5840230..fb77d30 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 _0x92f7=['Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','Template','rawAttributes','keys','query','dateStart','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','dateEnd','add','day','where','filter','map','merge','options','includeAll','rows','catch','params','intersection','include','create','body','find','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../mysqldb','status','end','json','count','offset','set'];(function(_0x8809b4,_0x3bdc8a){var _0xc33cb7=function(_0x4bec4e){while(--_0x4bec4e){_0x8809b4['push'](_0x8809b4['shift']());}};_0xc33cb7(++_0x3bdc8a);}(_0x92f7,0x6e));var _0x792f=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x92f7[_0xd22d95];return _0x15d7a3;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x792f('0x0'));var moment=require(_0x792f('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x792f('0x2'));var util=require('util');var path=require('path');var sox=require(_0x792f('0x3'));var csv=require(_0x792f('0x4'));var ejs=require(_0x792f('0x5'));var fs=require('fs');var _=require(_0x792f('0x6'));var squel=require(_0x792f('0x7'));var crypto=require(_0x792f('0x8'));var jsforce=require(_0x792f('0x9'));var deskjs=require(_0x792f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x792f('0xb'));var Papa=require(_0x792f('0xc'));var qs=require(_0x792f('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x792f('0xe'));var config=require('../../config/environment');var db=require(_0x792f('0xf'))['db'];function respondWithStatusCode(_0x372711,_0x5f2a38){_0x5f2a38=_0x5f2a38||0xcc;return function(_0x3ce077){if(_0x3ce077){return _0x372711['sendStatus'](_0x5f2a38);}return _0x372711[_0x792f('0x10')](_0x5f2a38)[_0x792f('0x11')]();};}function respondWithResult(_0x4a713b,_0x11df1c){_0x11df1c=_0x11df1c||0xc8;return function(_0x32ee5c){if(_0x32ee5c){return _0x4a713b[_0x792f('0x10')](_0x11df1c)[_0x792f('0x12')](_0x32ee5c);}};}function respondWithFilteredResult(_0x5268ea,_0x4de0f6){return function(_0x45a4ad){if(_0x45a4ad){var _0x35f360=_0x45a4ad[_0x792f('0x13')],_0x1da86a=_0x4de0f6[_0x792f('0x14')],_0x36cdba=_0x4de0f6[_0x792f('0x14')]+_0x4de0f6['limit'],_0x5d38ec;if(_0x36cdba>=_0x35f360){_0x36cdba=_0x35f360;_0x5d38ec=0xc8;}else{_0x5d38ec=0xce;}_0x5268ea[_0x792f('0x10')](_0x5d38ec);return _0x5268ea[_0x792f('0x15')](_0x792f('0x16'),_0x1da86a+'-'+_0x36cdba+'/'+_0x35f360)[_0x792f('0x12')](_0x45a4ad);}return null;};}function patchUpdates(_0x586632){return function(_0x2d0450){try{jsonpatch[_0x792f('0x17')](_0x2d0450,_0x586632,!![]);}catch(_0x6adf7d){return BPromise[_0x792f('0x18')](_0x6adf7d);}return _0x2d0450[_0x792f('0x19')]();};}function saveUpdates(_0x49da27,_0x24641d){return function(_0x27a04f){if(_0x27a04f){return _0x27a04f[_0x792f('0x1a')](_0x49da27)['then'](function(_0x49b2c2){return _0x49b2c2;});}return null;};}function removeEntity(_0x38579d,_0x360762){return function(_0xb3b8b2){if(_0xb3b8b2){return _0xb3b8b2[_0x792f('0x1b')]()[_0x792f('0x1c')](function(){_0x38579d['status'](0xcc)[_0x792f('0x11')]();});}};}function handleEntityNotFound(_0x165f5d,_0xc1d220){return function(_0x38c8ee){if(!_0x38c8ee){_0x165f5d[_0x792f('0x1d')](0x194);}return _0x38c8ee;};}function handleError(_0x5b41c4,_0x3c7036){_0x3c7036=_0x3c7036||0x1f4;return function(_0x473842){logger[_0x792f('0x1e')](_0x473842[_0x792f('0x1f')]);if(_0x473842[_0x792f('0x20')]){delete _0x473842[_0x792f('0x20')];}_0x5b41c4[_0x792f('0x10')](_0x3c7036)[_0x792f('0x21')](_0x473842);};}exports[_0x792f('0x22')]=function(_0x5930ae,_0x3a57b3){var _0x49bb1b={},_0x45fa80={},_0x184b7b={'count':0x0,'rows':[]};var _0x624e67=db[_0x792f('0x23')][_0x792f('0x24')];_0x45fa80['model']=_[_0x792f('0x25')](_0x624e67);var _0xcaa381={'dateStart':_0x5930ae[_0x792f('0x26')][_0x792f('0x27')],'dateEnd':_0x5930ae[_0x792f('0x26')]['dateEnd']};delete _0x5930ae[_0x792f('0x26')][_0x792f('0x27')];delete _0x5930ae[_0x792f('0x26')]['dateEnd'];_0x45fa80['query']=_['keys'](_0x5930ae[_0x792f('0x26')]);_0x45fa80['filters']=_['intersection'](_0x45fa80[_0x792f('0x28')],_0x45fa80['query']);_0x49bb1b[_0x792f('0x29')]=_['intersection'](_0x45fa80['model'],qs[_0x792f('0x2a')](_0x5930ae[_0x792f('0x26')]['fields']));_0x49bb1b[_0x792f('0x29')]=_0x49bb1b['attributes'][_0x792f('0x2b')]?_0x49bb1b[_0x792f('0x29')]:_0x45fa80[_0x792f('0x28')];if(!_0x5930ae[_0x792f('0x26')][_0x792f('0x2c')](_0x792f('0x2d'))){_0x49bb1b['limit']=qs['limit'](_0x5930ae[_0x792f('0x26')]['limit']);_0x49bb1b['offset']=qs[_0x792f('0x14')](_0x5930ae[_0x792f('0x26')]['offset']);}_0x49bb1b[_0x792f('0x2e')]=qs[_0x792f('0x2f')](_0x5930ae[_0x792f('0x26')][_0x792f('0x2f')]);_0x49bb1b['where']=qs[_0x792f('0x30')](_['pick'](_0x5930ae['query'],_0x45fa80['filters']));if(_0xcaa381['dateStart']){if(_0xcaa381[_0x792f('0x31')]){_0xcaa381[_0x792f('0x31')]=moment(_0xcaa381[_0x792f('0x31')])[_0x792f('0x32')](0x1,_0x792f('0x33'));}else{_0xcaa381[_0x792f('0x31')]=moment(_0xcaa381[_0x792f('0x27')])[_0x792f('0x32')](0x1,_0x792f('0x33'));}_['merge'](_0x49bb1b[_0x792f('0x34')],{'createdAt':{'$gte':_0xcaa381['dateStart'],'$lte':_0xcaa381[_0x792f('0x31')]}});}if(_0x5930ae[_0x792f('0x26')][_0x792f('0x35')]){_0x49bb1b[_0x792f('0x34')]=_['merge'](_0x49bb1b[_0x792f('0x34')],{'$or':_[_0x792f('0x36')](_0x49bb1b['attributes'],function(_0x384880){var _0x1a965d={};_0x1a965d[_0x384880]={'$like':'%'+_0x5930ae[_0x792f('0x26')][_0x792f('0x35')]+'%'};return _0x1a965d;})});}_0x49bb1b=_[_0x792f('0x37')]({},_0x49bb1b,_0x5930ae[_0x792f('0x38')]);var _0xd9cd31={'where':_0x49bb1b[_0x792f('0x34')]};return db['Template'][_0x792f('0x13')](_0xd9cd31)[_0x792f('0x1c')](function(_0x5a8fdf){_0x184b7b[_0x792f('0x13')]=_0x5a8fdf;if(_0x5930ae[_0x792f('0x26')][_0x792f('0x39')]){_0x49bb1b['include']=[{'all':!![]}];}return db[_0x792f('0x23')]['findAll'](_0x49bb1b);})[_0x792f('0x1c')](function(_0x3c27d5){_0x184b7b[_0x792f('0x3a')]=_0x3c27d5;return _0x184b7b;})[_0x792f('0x1c')](respondWithFilteredResult(_0x3a57b3,_0x49bb1b))[_0x792f('0x3b')](handleError(_0x3a57b3,null));};exports['show']=function(_0xec2e9e,_0x1f269e){var _0x266568={'raw':!![],'where':{'id':_0xec2e9e[_0x792f('0x3c')]['id']}},_0x4625ff={};_0x4625ff['model']=_['keys'](db['Template'][_0x792f('0x24')]);_0x4625ff['query']=_[_0x792f('0x25')](_0xec2e9e[_0x792f('0x26')]);_0x4625ff[_0x792f('0x30')]=_[_0x792f('0x3d')](_0x4625ff[_0x792f('0x28')],_0x4625ff[_0x792f('0x26')]);_0x266568['attributes']=_[_0x792f('0x3d')](_0x4625ff[_0x792f('0x28')],qs[_0x792f('0x2a')](_0xec2e9e[_0x792f('0x26')]['fields']));_0x266568[_0x792f('0x29')]=_0x266568[_0x792f('0x29')][_0x792f('0x2b')]?_0x266568[_0x792f('0x29')]:_0x4625ff[_0x792f('0x28')];if(_0xec2e9e[_0x792f('0x26')][_0x792f('0x39')]){_0x266568[_0x792f('0x3e')]=[{'all':!![]}];}_0x266568=_[_0x792f('0x37')]({},_0x266568,_0xec2e9e[_0x792f('0x38')]);return db[_0x792f('0x23')]['find'](_0x266568)[_0x792f('0x1c')](handleEntityNotFound(_0x1f269e,null))[_0x792f('0x1c')](respondWithResult(_0x1f269e,null))[_0x792f('0x3b')](handleError(_0x1f269e,null));};exports[_0x792f('0x3f')]=function(_0x412a6f,_0x4a64df){return db['Template'][_0x792f('0x3f')](_0x412a6f['body'],{})[_0x792f('0x1c')](respondWithResult(_0x4a64df,0xc9))[_0x792f('0x3b')](handleError(_0x4a64df,null));};exports[_0x792f('0x1a')]=function(_0x35eff4,_0x331de8){if(_0x35eff4['body']['id']){delete _0x35eff4[_0x792f('0x40')]['id'];}return db[_0x792f('0x23')][_0x792f('0x41')]({'where':{'id':_0x35eff4[_0x792f('0x3c')]['id']}})[_0x792f('0x1c')](handleEntityNotFound(_0x331de8,null))['then'](saveUpdates(_0x35eff4[_0x792f('0x40')],null))[_0x792f('0x1c')](respondWithResult(_0x331de8,null))[_0x792f('0x3b')](handleError(_0x331de8,null));};exports[_0x792f('0x1b')]=function(_0x5a8f41,_0x2afc35){return db[_0x792f('0x23')][_0x792f('0x41')]({'where':{'id':_0x5a8f41[_0x792f('0x3c')]['id']}})[_0x792f('0x1c')](handleEntityNotFound(_0x2afc35,null))[_0x792f('0x1c')](removeEntity(_0x2afc35,null))[_0x792f('0x3b')](handleError(_0x2afc35,null));}; \ No newline at end of file +var _0xa8d4=['filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','includeAll','include','findAll','rows','catch','show','options','create','update','body','find','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','end','error','stack','name','index','Template','rawAttributes','model','keys','query','dateStart','dateEnd'];(function(_0x231fa9,_0x2ee1c2){var _0x12f746=function(_0x459f47){while(--_0x459f47){_0x231fa9['push'](_0x231fa9['shift']());}};_0x12f746(++_0x2ee1c2);}(_0xa8d4,0x1e7));var _0x4a8d=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0xa8d4[_0x3d38ae];return _0x3757ee;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x4a8d('0x0'));var moment=require('moment');var BPromise=require(_0x4a8d('0x1'));var Mustache=require('mustache');var util=require(_0x4a8d('0x2'));var path=require(_0x4a8d('0x3'));var sox=require(_0x4a8d('0x4'));var csv=require(_0x4a8d('0x5'));var ejs=require(_0x4a8d('0x6'));var fs=require('fs');var _=require(_0x4a8d('0x7'));var squel=require(_0x4a8d('0x8'));var crypto=require(_0x4a8d('0x9'));var jsforce=require(_0x4a8d('0xa'));var deskjs=require(_0x4a8d('0xb'));var toCsv=require(_0x4a8d('0x5'));var querystring=require(_0x4a8d('0xc'));var Papa=require(_0x4a8d('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x4a8d('0xe'))('api');var utils=require(_0x4a8d('0xf'));var config=require(_0x4a8d('0x10'));var db=require(_0x4a8d('0x11'))['db'];function respondWithStatusCode(_0x229b63,_0x3b5211){_0x3b5211=_0x3b5211||0xcc;return function(_0x4fb13a){if(_0x4fb13a){return _0x229b63[_0x4a8d('0x12')](_0x3b5211);}return _0x229b63[_0x4a8d('0x13')](_0x3b5211)['end']();};}function respondWithResult(_0x27fc0e,_0x2d30fd){_0x2d30fd=_0x2d30fd||0xc8;return function(_0x4157d6){if(_0x4157d6){return _0x27fc0e[_0x4a8d('0x13')](_0x2d30fd)[_0x4a8d('0x14')](_0x4157d6);}};}function respondWithFilteredResult(_0x525118,_0x482f10){return function(_0x50356a){if(_0x50356a){var _0x3d9e8e=_0x50356a[_0x4a8d('0x15')],_0x1bbe3b=_0x482f10['offset'],_0x457ec6=_0x482f10[_0x4a8d('0x16')]+_0x482f10[_0x4a8d('0x17')],_0x344833;if(_0x457ec6>=_0x3d9e8e){_0x457ec6=_0x3d9e8e;_0x344833=0xc8;}else{_0x344833=0xce;}_0x525118[_0x4a8d('0x13')](_0x344833);return _0x525118['set'](_0x4a8d('0x18'),_0x1bbe3b+'-'+_0x457ec6+'/'+_0x3d9e8e)[_0x4a8d('0x14')](_0x50356a);}return null;};}function patchUpdates(_0xe5025b){return function(_0x13dc6d){try{jsonpatch['apply'](_0x13dc6d,_0xe5025b,!![]);}catch(_0x348db5){return BPromise[_0x4a8d('0x19')](_0x348db5);}return _0x13dc6d[_0x4a8d('0x1a')]();};}function saveUpdates(_0x3dfdcb,_0x4c2285){return function(_0x260a70){if(_0x260a70){return _0x260a70['update'](_0x3dfdcb)[_0x4a8d('0x1b')](function(_0x3af841){return _0x3af841;});}return null;};}function removeEntity(_0x930ae7,_0x1d3311){return function(_0x54a83f){if(_0x54a83f){return _0x54a83f[_0x4a8d('0x1c')]()[_0x4a8d('0x1b')](function(){_0x930ae7[_0x4a8d('0x13')](0xcc)[_0x4a8d('0x1d')]();});}};}function handleEntityNotFound(_0x33439b,_0x48fe64){return function(_0x5f1792){if(!_0x5f1792){_0x33439b[_0x4a8d('0x12')](0x194);}return _0x5f1792;};}function handleError(_0x56a963,_0x11982d){_0x11982d=_0x11982d||0x1f4;return function(_0x242f2c){logger[_0x4a8d('0x1e')](_0x242f2c[_0x4a8d('0x1f')]);if(_0x242f2c[_0x4a8d('0x20')]){delete _0x242f2c[_0x4a8d('0x20')];}_0x56a963[_0x4a8d('0x13')](_0x11982d)['send'](_0x242f2c);};}exports[_0x4a8d('0x21')]=function(_0x273e97,_0x1f4306){var _0x5d8cb5={},_0x3cff78={},_0x5a689f={'count':0x0,'rows':[]};var _0x2168fa=db[_0x4a8d('0x22')][_0x4a8d('0x23')];_0x3cff78[_0x4a8d('0x24')]=_[_0x4a8d('0x25')](_0x2168fa);var _0x548aa6={'dateStart':_0x273e97[_0x4a8d('0x26')][_0x4a8d('0x27')],'dateEnd':_0x273e97[_0x4a8d('0x26')][_0x4a8d('0x28')]};delete _0x273e97['query'][_0x4a8d('0x27')];delete _0x273e97[_0x4a8d('0x26')][_0x4a8d('0x28')];_0x3cff78[_0x4a8d('0x26')]=_[_0x4a8d('0x25')](_0x273e97['query']);_0x3cff78[_0x4a8d('0x29')]=_['intersection'](_0x3cff78[_0x4a8d('0x24')],_0x3cff78[_0x4a8d('0x26')]);_0x5d8cb5[_0x4a8d('0x2a')]=_[_0x4a8d('0x2b')](_0x3cff78['model'],qs[_0x4a8d('0x2c')](_0x273e97[_0x4a8d('0x26')][_0x4a8d('0x2c')]));_0x5d8cb5[_0x4a8d('0x2a')]=_0x5d8cb5[_0x4a8d('0x2a')][_0x4a8d('0x2d')]?_0x5d8cb5[_0x4a8d('0x2a')]:_0x3cff78['model'];if(!_0x273e97[_0x4a8d('0x26')]['hasOwnProperty'](_0x4a8d('0x2e'))){_0x5d8cb5[_0x4a8d('0x17')]=qs['limit'](_0x273e97['query'][_0x4a8d('0x17')]);_0x5d8cb5[_0x4a8d('0x16')]=qs['offset'](_0x273e97[_0x4a8d('0x26')]['offset']);}_0x5d8cb5[_0x4a8d('0x2f')]=qs['sort'](_0x273e97[_0x4a8d('0x26')][_0x4a8d('0x30')]);_0x5d8cb5[_0x4a8d('0x31')]=qs[_0x4a8d('0x29')](_[_0x4a8d('0x32')](_0x273e97[_0x4a8d('0x26')],_0x3cff78[_0x4a8d('0x29')]));if(_0x548aa6[_0x4a8d('0x27')]){if(_0x548aa6['dateEnd']){_0x548aa6[_0x4a8d('0x28')]=moment(_0x548aa6[_0x4a8d('0x28')])[_0x4a8d('0x33')](0x1,_0x4a8d('0x34'));}else{_0x548aa6[_0x4a8d('0x28')]=moment(_0x548aa6['dateStart'])[_0x4a8d('0x33')](0x1,_0x4a8d('0x34'));}_[_0x4a8d('0x35')](_0x5d8cb5[_0x4a8d('0x31')],{'createdAt':{'$gte':_0x548aa6[_0x4a8d('0x27')],'$lte':_0x548aa6[_0x4a8d('0x28')]}});}if(_0x273e97['query'][_0x4a8d('0x36')]){_0x5d8cb5[_0x4a8d('0x31')]=_[_0x4a8d('0x35')](_0x5d8cb5[_0x4a8d('0x31')],{'$or':_['map'](_0x5d8cb5[_0x4a8d('0x2a')],function(_0x15a3b3){var _0x384a34={};_0x384a34[_0x15a3b3]={'$like':'%'+_0x273e97[_0x4a8d('0x26')][_0x4a8d('0x36')]+'%'};return _0x384a34;})});}_0x5d8cb5=_[_0x4a8d('0x35')]({},_0x5d8cb5,_0x273e97['options']);var _0x3ea427={'where':_0x5d8cb5[_0x4a8d('0x31')]};return db[_0x4a8d('0x22')][_0x4a8d('0x15')](_0x3ea427)[_0x4a8d('0x1b')](function(_0x18aaa4){_0x5a689f[_0x4a8d('0x15')]=_0x18aaa4;if(_0x273e97['query'][_0x4a8d('0x37')]){_0x5d8cb5[_0x4a8d('0x38')]=[{'all':!![]}];}return db[_0x4a8d('0x22')][_0x4a8d('0x39')](_0x5d8cb5);})['then'](function(_0x53093e){_0x5a689f[_0x4a8d('0x3a')]=_0x53093e;return _0x5a689f;})[_0x4a8d('0x1b')](respondWithFilteredResult(_0x1f4306,_0x5d8cb5))[_0x4a8d('0x3b')](handleError(_0x1f4306,null));};exports[_0x4a8d('0x3c')]=function(_0x290c01,_0x239411){var _0x4ad23c={'raw':!![],'where':{'id':_0x290c01['params']['id']}},_0x4c3716={};_0x4c3716[_0x4a8d('0x24')]=_[_0x4a8d('0x25')](db[_0x4a8d('0x22')][_0x4a8d('0x23')]);_0x4c3716[_0x4a8d('0x26')]=_[_0x4a8d('0x25')](_0x290c01[_0x4a8d('0x26')]);_0x4c3716['filters']=_[_0x4a8d('0x2b')](_0x4c3716[_0x4a8d('0x24')],_0x4c3716[_0x4a8d('0x26')]);_0x4ad23c[_0x4a8d('0x2a')]=_[_0x4a8d('0x2b')](_0x4c3716['model'],qs[_0x4a8d('0x2c')](_0x290c01[_0x4a8d('0x26')][_0x4a8d('0x2c')]));_0x4ad23c[_0x4a8d('0x2a')]=_0x4ad23c[_0x4a8d('0x2a')][_0x4a8d('0x2d')]?_0x4ad23c[_0x4a8d('0x2a')]:_0x4c3716[_0x4a8d('0x24')];if(_0x290c01['query'][_0x4a8d('0x37')]){_0x4ad23c[_0x4a8d('0x38')]=[{'all':!![]}];}_0x4ad23c=_[_0x4a8d('0x35')]({},_0x4ad23c,_0x290c01[_0x4a8d('0x3d')]);return db[_0x4a8d('0x22')]['find'](_0x4ad23c)[_0x4a8d('0x1b')](handleEntityNotFound(_0x239411,null))['then'](respondWithResult(_0x239411,null))['catch'](handleError(_0x239411,null));};exports[_0x4a8d('0x3e')]=function(_0x1a9395,_0x336bfd){return db[_0x4a8d('0x22')][_0x4a8d('0x3e')](_0x1a9395['body'],{})[_0x4a8d('0x1b')](respondWithResult(_0x336bfd,0xc9))['catch'](handleError(_0x336bfd,null));};exports[_0x4a8d('0x3f')]=function(_0x5a1cd9,_0x3fdca7){if(_0x5a1cd9[_0x4a8d('0x40')]['id']){delete _0x5a1cd9[_0x4a8d('0x40')]['id'];}return db[_0x4a8d('0x22')][_0x4a8d('0x41')]({'where':{'id':_0x5a1cd9['params']['id']}})[_0x4a8d('0x1b')](handleEntityNotFound(_0x3fdca7,null))['then'](saveUpdates(_0x5a1cd9[_0x4a8d('0x40')],null))['then'](respondWithResult(_0x3fdca7,null))[_0x4a8d('0x3b')](handleError(_0x3fdca7,null));};exports[_0x4a8d('0x1c')]=function(_0x2bbfd7,_0x150f1d){return db[_0x4a8d('0x22')][_0x4a8d('0x41')]({'where':{'id':_0x2bbfd7['params']['id']}})['then'](handleEntityNotFound(_0x150f1d,null))['then'](removeEntity(_0x150f1d,null))[_0x4a8d('0x3b')](handleError(_0x150f1d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index dec9493..1e2c04e 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 _0x2e0f=['define','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./template.attributes'];(function(_0x18fb32,_0x582479){var _0x184c27=function(_0x435735){while(--_0x435735){_0x18fb32['push'](_0x18fb32['shift']());}};_0x184c27(++_0x582479);}(_0x2e0f,0xca));var _0xf2e0=function(_0x4f3518,_0x35680a){_0x4f3518=_0x4f3518-0x0;var _0x49efcc=_0x2e0f[_0x4f3518];return _0x49efcc;};'use strict';var _=require(_0xf2e0('0x0'));var util=require(_0xf2e0('0x1'));var logger=require(_0xf2e0('0x2'))(_0xf2e0('0x3'));var moment=require(_0xf2e0('0x4'));var BPromise=require(_0xf2e0('0x5'));var rp=require(_0xf2e0('0x6'));var attributes=require(_0xf2e0('0x7'));module['exports']=function(_0x293d36,_0x474f64){return _0x293d36[_0xf2e0('0x8')]('Template',attributes,{'tableName':_0xf2e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53aa=['tools_templates','../../config/logger','moment','bluebird','exports','define'];(function(_0x5d289a,_0x352880){var _0x14bd5f=function(_0x268766){while(--_0x268766){_0x5d289a['push'](_0x5d289a['shift']());}};_0x14bd5f(++_0x352880);}(_0x53aa,0x1cf));var _0xa53a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x53aa[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa53a('0x0'))('api');var moment=require(_0xa53a('0x1'));var BPromise=require(_0xa53a('0x2'));var rp=require('request-promise');var attributes=require('./template.attributes');module[_0xa53a('0x3')]=function(_0xabda59,_0x164438){return _0xabda59[_0xa53a('0x4')]('Template',attributes,{'tableName':_0xa53a('0x5'),'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 53a5308..63a2fa4 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 _0xb854=['map','model','include','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetTemplate','Template','options','attributes','limit'];(function(_0x1570e0,_0x271bdf){var _0x424cba=function(_0x5818d9){while(--_0x5818d9){_0x1570e0['push'](_0x1570e0['shift']());}};_0x424cba(++_0x271bdf);}(_0xb854,0x11a));var _0x4b85=function(_0x1e0499,_0x2222ed){_0x1e0499=_0x1e0499-0x0;var _0x527766=_0xb854[_0x1e0499];return _0x527766;};'use strict';var _=require(_0x4b85('0x0'));var util=require(_0x4b85('0x1'));var moment=require(_0x4b85('0x2'));var BPromise=require(_0x4b85('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x4b85('0x4'))['db'];var utils=require(_0x4b85('0x5'));var logger=require(_0x4b85('0x6'))(_0x4b85('0x7'));var config=require(_0x4b85('0x8'));var jayson=require(_0x4b85('0x9'));var client=jayson[_0x4b85('0xa')][_0x4b85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f7fc8,_0x57ace5,_0x51d440){return new BPromise(function(_0x5e3abc,_0x274c3a){return client[_0x4b85('0xc')](_0x2f7fc8,_0x51d440)[_0x4b85('0xd')](function(_0x427eb0){logger[_0x4b85('0xe')](_0x4b85('0xf'),_0x57ace5,_0x4b85('0x10'));logger[_0x4b85('0x11')]('Template,\x20%s,\x20%s,\x20%s',_0x57ace5,'request\x20sent',JSON[_0x4b85('0x12')](_0x427eb0));if(_0x427eb0[_0x4b85('0x13')]){if(_0x427eb0['error']['code']===0x1f4){logger[_0x4b85('0x13')](_0x4b85('0xf'),_0x57ace5,_0x427eb0['error'][_0x4b85('0x14')]);return _0x274c3a(_0x427eb0[_0x4b85('0x13')]['message']);}logger[_0x4b85('0x13')](_0x4b85('0xf'),_0x57ace5,_0x427eb0[_0x4b85('0x13')][_0x4b85('0x14')]);return _0x5e3abc(_0x427eb0['error']['message']);}else{logger[_0x4b85('0xe')]('Template,\x20%s,\x20%s',_0x57ace5,_0x4b85('0x10'));_0x5e3abc(_0x427eb0[_0x4b85('0x15')]['message']);}})[_0x4b85('0x16')](function(_0x4df459){logger[_0x4b85('0x13')](_0x4b85('0xf'),_0x57ace5,_0x4df459);_0x274c3a(_0x4df459);});});}exports[_0x4b85('0x17')]=function(_0x4a1988){var _0x4d489f=this;return new Promise(function(_0x2df3d3,_0x53fec2){return db[_0x4b85('0x18')]['findAll']({'raw':_0x4a1988[_0x4b85('0x19')]?_0x4a1988[_0x4b85('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4a1988['options']?_0x4a1988[_0x4b85('0x19')]['where']||null:null,'attributes':_0x4a1988[_0x4b85('0x19')]?_0x4a1988[_0x4b85('0x19')][_0x4b85('0x1a')]||null:null,'limit':_0x4a1988[_0x4b85('0x19')]?_0x4a1988[_0x4b85('0x19')][_0x4b85('0x1b')]||null:null,'include':_0x4a1988['options']?_0x4a1988[_0x4b85('0x19')]['include']?_[_0x4b85('0x1c')](_0x4a1988['options']['include'],function(_0x22bdbd){return{'model':db[_0x22bdbd[_0x4b85('0x1d')]],'as':_0x22bdbd['as'],'attributes':_0x22bdbd[_0x4b85('0x1a')],'include':_0x22bdbd[_0x4b85('0x1e')]?_[_0x4b85('0x1c')](_0x22bdbd[_0x4b85('0x1e')],function(_0x45d5fe){return{'model':db[_0x45d5fe[_0x4b85('0x1d')]],'as':_0x45d5fe['as'],'attributes':_0x45d5fe['attributes'],'include':_0x45d5fe[_0x4b85('0x1e')]?_['map'](_0x45d5fe['include'],function(_0x5ac851){return{'model':db[_0x5ac851[_0x4b85('0x1d')]],'as':_0x5ac851['as'],'attributes':_0x5ac851[_0x4b85('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4b85('0xd')](function(_0x48e23d){logger[_0x4b85('0xe')]('GetTemplate',_0x4a1988);logger[_0x4b85('0x11')]('GetTemplate',_0x4a1988,JSON[_0x4b85('0x12')](_0x48e23d));_0x2df3d3(_0x48e23d);})[_0x4b85('0x16')](function(_0x42a9b3){logger['error']('GetTemplate',_0x42a9b3['message'],_0x4a1988);_0x53fec2(_0x4d489f[_0x4b85('0x13')](0x1f4,_0x42a9b3[_0x4b85('0x14')]));});});}; \ No newline at end of file +var _0x4971=['info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','map','include','model','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x5085f1,_0x42e56f){var _0x3a5dea=function(_0x3f9324){while(--_0x3f9324){_0x5085f1['push'](_0x5085f1['shift']());}};_0x3a5dea(++_0x42e56f);}(_0x4971,0xa4));var _0x1497=function(_0x5b7e20,_0x17cfec){_0x5b7e20=_0x5b7e20-0x0;var _0x57eddf=_0x4971[_0x5b7e20];return _0x57eddf;};'use strict';var _=require(_0x1497('0x0'));var util=require('util');var moment=require(_0x1497('0x1'));var BPromise=require(_0x1497('0x2'));var rs=require(_0x1497('0x3'));var fs=require('fs');var db=require(_0x1497('0x4'))['db'];var utils=require(_0x1497('0x5'));var logger=require(_0x1497('0x6'))(_0x1497('0x7'));var config=require(_0x1497('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53edf1,_0x29f1c4,_0x580304){return new BPromise(function(_0x2da378,_0x48dabc){return client[_0x1497('0x9')](_0x53edf1,_0x580304)['then'](function(_0x365e74){logger[_0x1497('0xa')](_0x1497('0xb'),_0x29f1c4,_0x1497('0xc'));logger[_0x1497('0xd')]('Template,\x20%s,\x20%s,\x20%s',_0x29f1c4,'request\x20sent',JSON[_0x1497('0xe')](_0x365e74));if(_0x365e74['error']){if(_0x365e74['error']['code']===0x1f4){logger[_0x1497('0xf')]('Template,\x20%s,\x20%s',_0x29f1c4,_0x365e74[_0x1497('0xf')][_0x1497('0x10')]);return _0x48dabc(_0x365e74['error'][_0x1497('0x10')]);}logger['error']('Template,\x20%s,\x20%s',_0x29f1c4,_0x365e74['error'][_0x1497('0x10')]);return _0x2da378(_0x365e74['error']['message']);}else{logger[_0x1497('0xa')](_0x1497('0xb'),_0x29f1c4,_0x1497('0xc'));_0x2da378(_0x365e74['result']['message']);}})[_0x1497('0x11')](function(_0x49ee43){logger[_0x1497('0xf')](_0x1497('0xb'),_0x29f1c4,_0x49ee43);_0x48dabc(_0x49ee43);});});}exports[_0x1497('0x12')]=function(_0x3995e3){var _0x35a208=this;return new Promise(function(_0x845769,_0x57864a){return db[_0x1497('0x13')][_0x1497('0x14')]({'raw':_0x3995e3[_0x1497('0x15')]?_0x3995e3[_0x1497('0x15')][_0x1497('0x16')]===undefined?!![]:![]:!![],'where':_0x3995e3[_0x1497('0x15')]?_0x3995e3[_0x1497('0x15')]['where']||null:null,'attributes':_0x3995e3[_0x1497('0x15')]?_0x3995e3[_0x1497('0x15')][_0x1497('0x17')]||null:null,'limit':_0x3995e3['options']?_0x3995e3['options'][_0x1497('0x18')]||null:null,'include':_0x3995e3[_0x1497('0x15')]?_0x3995e3['options']['include']?_[_0x1497('0x19')](_0x3995e3[_0x1497('0x15')][_0x1497('0x1a')],function(_0x12bb08){return{'model':db[_0x12bb08[_0x1497('0x1b')]],'as':_0x12bb08['as'],'attributes':_0x12bb08[_0x1497('0x17')],'include':_0x12bb08[_0x1497('0x1a')]?_[_0x1497('0x19')](_0x12bb08[_0x1497('0x1a')],function(_0x5900cf){return{'model':db[_0x5900cf[_0x1497('0x1b')]],'as':_0x5900cf['as'],'attributes':_0x5900cf[_0x1497('0x17')],'include':_0x5900cf['include']?_[_0x1497('0x19')](_0x5900cf[_0x1497('0x1a')],function(_0x5e56c5){return{'model':db[_0x5e56c5[_0x1497('0x1b')]],'as':_0x5e56c5['as'],'attributes':_0x5e56c5[_0x1497('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1497('0x1c')](function(_0x436683){logger[_0x1497('0xa')](_0x1497('0x12'),_0x3995e3);logger[_0x1497('0xd')](_0x1497('0x12'),_0x3995e3,JSON[_0x1497('0xe')](_0x436683));_0x845769(_0x436683);})[_0x1497('0x11')](function(_0x518b1d){logger['error'](_0x1497('0x12'),_0x518b1d[_0x1497('0x10')],_0x3995e3);_0x57864a(_0x35a208[_0x1497('0xf')](0x1f4,_0x518b1d[_0x1497('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 84d2990..f17d8d0 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 _0xb69e=['put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction'];(function(_0x376abb,_0x10c182){var _0x391823=function(_0x8ae796){while(--_0x8ae796){_0x376abb['push'](_0x376abb['shift']());}};_0x391823(++_0x10c182);}(_0xb69e,0x163));var _0xeb69=function(_0x154d58,_0xb661bb){_0x154d58=_0x154d58-0x0;var _0x310418=_0xb69e[_0x154d58];return _0x310418;};'use strict';var multer=require(_0xeb69('0x0'));var util=require(_0xeb69('0x1'));var path=require(_0xeb69('0x2'));var express=require('express');var router=express[_0xeb69('0x3')]();var auth=require(_0xeb69('0x4'));var interaction=require(_0xeb69('0x5'));var config=require(_0xeb69('0x6'));var controller=require(_0xeb69('0x7'));router[_0xeb69('0x8')]('/',auth[_0xeb69('0x9')](),controller[_0xeb69('0xa')]);router[_0xeb69('0x8')](_0xeb69('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xeb69('0x8')](_0xeb69('0xc'),auth['isAuthenticated'](),controller[_0xeb69('0xd')]);router[_0xeb69('0x8')](_0xeb69('0xe'),auth[_0xeb69('0x9')](),controller[_0xeb69('0xf')]);router[_0xeb69('0x8')](_0xeb69('0x10'),auth[_0xeb69('0x9')](),controller[_0xeb69('0x11')]);router[_0xeb69('0x12')]('/',auth[_0xeb69('0x9')](),controller[_0xeb69('0x13')]);router['post'](_0xeb69('0xc'),auth[_0xeb69('0x9')](),controller[_0xeb69('0x14')]);router[_0xeb69('0x12')](_0xeb69('0xe'),auth['isAuthenticated'](),controller[_0xeb69('0x15')]);router['post']('/:id/actions',auth[_0xeb69('0x9')](),controller[_0xeb69('0x16')]);router[_0xeb69('0x17')](_0xeb69('0xb'),auth[_0xeb69('0x9')](),controller[_0xeb69('0x18')]);router[_0xeb69('0x19')](_0xeb69('0xb'),auth[_0xeb69('0x9')](),controller['destroy']);module[_0xeb69('0x1a')]=router; \ No newline at end of file +var _0x4627=['../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','getAllConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x4627,0xaa));var _0x7462=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x4627[_0x3e2fcf];return _0x497db7;};'use strict';var multer=require(_0x7462('0x0'));var util=require('util');var path=require(_0x7462('0x1'));var express=require(_0x7462('0x2'));var router=express[_0x7462('0x3')]();var auth=require(_0x7462('0x4'));var interaction=require(_0x7462('0x5'));var config=require(_0x7462('0x6'));var controller=require(_0x7462('0x7'));router['get']('/',auth[_0x7462('0x8')](),controller[_0x7462('0x9')]);router[_0x7462('0xa')]('/:id',auth[_0x7462('0x8')](),controller['show']);router[_0x7462('0xa')]('/:id/all_conditions',auth[_0x7462('0x8')](),controller[_0x7462('0xb')]);router[_0x7462('0xa')]('/:id/any_conditions',auth[_0x7462('0x8')](),controller['getAnyConditions']);router['get'](_0x7462('0xc'),auth[_0x7462('0x8')](),controller[_0x7462('0xd')]);router[_0x7462('0xe')]('/',auth['isAuthenticated'](),controller[_0x7462('0xf')]);router[_0x7462('0xe')](_0x7462('0x10'),auth[_0x7462('0x8')](),controller[_0x7462('0x11')]);router[_0x7462('0xe')]('/:id/any_conditions',auth[_0x7462('0x8')](),controller[_0x7462('0x12')]);router['post'](_0x7462('0xc'),auth['isAuthenticated'](),controller[_0x7462('0x13')]);router[_0x7462('0x14')](_0x7462('0x15'),auth['isAuthenticated'](),controller[_0x7462('0x16')]);router[_0x7462('0x17')](_0x7462('0x15'),auth[_0x7462('0x8')](),controller['destroy']);module[_0x7462('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 2c72f9c..a129084 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 _0x4163=['BOOLEAN','sequelize','exports','STRING'];(function(_0x70e7eb,_0x5f22f9){var _0x1ca996=function(_0x4271e4){while(--_0x4271e4){_0x70e7eb['push'](_0x70e7eb['shift']());}};_0x1ca996(++_0x5f22f9);}(_0x4163,0xa9));var _0x3416=function(_0x7b360c,_0x5cec49){_0x7b360c=_0x7b360c-0x0;var _0x2dad8e=_0x4163[_0x7b360c];return _0x2dad8e;};'use strict';var Sequelize=require(_0x3416('0x0'));module[_0x3416('0x1')]={'name':{'type':Sequelize[_0x3416('0x2')]},'channel':{'type':Sequelize[_0x3416('0x2')]},'description':{'type':Sequelize[_0x3416('0x2')]},'status':{'type':Sequelize[_0x3416('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa61f=['exports','STRING'];(function(_0x18d7b9,_0x2b4937){var _0x5aaf1a=function(_0x97db64){while(--_0x97db64){_0x18d7b9['push'](_0x18d7b9['shift']());}};_0x5aaf1a(++_0x2b4937);}(_0xa61f,0x106));var _0xfa61=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa61f[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0xfa61('0x0')]={'name':{'type':Sequelize[_0xfa61('0x1')]},'channel':{'type':Sequelize[_0xfa61('0x1')]},'description':{'type':Sequelize[_0xfa61('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7b00222..8d96557 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 _0x8aea=['Trigger','includeAll','include','findAll','rows','catch','params','create','body','find','addAllCondition','TriggerAllId','addAnyCondition','Condition','getAllConditions','findOne','length','getAnyConditions','addAction','TriggerId','Action','getActions','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','day','merge','map','filter','options'];(function(_0x374668,_0xc3e75a){var _0xd4e656=function(_0x1ddf27){while(--_0x1ddf27){_0x374668['push'](_0x374668['shift']());}};_0xd4e656(++_0xc3e75a);}(_0x8aea,0x67));var _0xa8ae=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8aea[_0x1facfa];return _0x9ec701;};'use strict';var jsonpatch=require(_0xa8ae('0x0'));var rp=require(_0xa8ae('0x1'));var moment=require(_0xa8ae('0x2'));var BPromise=require(_0xa8ae('0x3'));var Mustache=require(_0xa8ae('0x4'));var util=require('util');var path=require(_0xa8ae('0x5'));var sox=require(_0xa8ae('0x6'));var csv=require('to-csv');var ejs=require(_0xa8ae('0x7'));var fs=require('fs');var _=require(_0xa8ae('0x8'));var squel=require(_0xa8ae('0x9'));var crypto=require(_0xa8ae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa8ae('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa8ae('0xc'));var Papa=require(_0xa8ae('0xd'));var qs=require(_0xa8ae('0xe'));var logger=require(_0xa8ae('0xf'))(_0xa8ae('0x10'));var utils=require('../../config/utils');var config=require(_0xa8ae('0x11'));var db=require(_0xa8ae('0x12'))['db'];function respondWithStatusCode(_0x513b67,_0x1374ab){_0x1374ab=_0x1374ab||0xcc;return function(_0x4693e8){if(_0x4693e8){return _0x513b67['sendStatus'](_0x1374ab);}return _0x513b67['status'](_0x1374ab)[_0xa8ae('0x13')]();};}function respondWithResult(_0x50fd98,_0x6c26a5){_0x6c26a5=_0x6c26a5||0xc8;return function(_0x4e5dd1){if(_0x4e5dd1){return _0x50fd98[_0xa8ae('0x14')](_0x6c26a5)[_0xa8ae('0x15')](_0x4e5dd1);}};}function respondWithFilteredResult(_0x435208,_0x158a74){return function(_0x3595f2){if(_0x3595f2){var _0x360151=_0x3595f2[_0xa8ae('0x16')],_0x99f901=_0x158a74[_0xa8ae('0x17')],_0x306ea9=_0x158a74['offset']+_0x158a74['limit'],_0x1a5175;if(_0x306ea9>=_0x360151){_0x306ea9=_0x360151;_0x1a5175=0xc8;}else{_0x1a5175=0xce;}_0x435208[_0xa8ae('0x14')](_0x1a5175);return _0x435208[_0xa8ae('0x18')](_0xa8ae('0x19'),_0x99f901+'-'+_0x306ea9+'/'+_0x360151)['json'](_0x3595f2);}return null;};}function patchUpdates(_0xf0417f){return function(_0x24a183){try{jsonpatch[_0xa8ae('0x1a')](_0x24a183,_0xf0417f,!![]);}catch(_0x3f22f4){return BPromise[_0xa8ae('0x1b')](_0x3f22f4);}return _0x24a183['save']();};}function saveUpdates(_0x1a2162,_0x522a8a){return function(_0x4d2961){if(_0x4d2961){return _0x4d2961[_0xa8ae('0x1c')](_0x1a2162)[_0xa8ae('0x1d')](function(_0x40353e){return _0x40353e;});}return null;};}function removeEntity(_0x1e1160,_0x37b38c){return function(_0x4926db){if(_0x4926db){return _0x4926db[_0xa8ae('0x1e')]()[_0xa8ae('0x1d')](function(){_0x1e1160[_0xa8ae('0x14')](0xcc)[_0xa8ae('0x13')]();});}};}function handleEntityNotFound(_0x89972f,_0x199cf5){return function(_0x542070){if(!_0x542070){_0x89972f[_0xa8ae('0x1f')](0x194);}return _0x542070;};}function handleError(_0x526a07,_0x1d5708){_0x1d5708=_0x1d5708||0x1f4;return function(_0x2997d2){logger[_0xa8ae('0x20')](_0x2997d2[_0xa8ae('0x21')]);if(_0x2997d2[_0xa8ae('0x22')]){delete _0x2997d2['name'];}_0x526a07[_0xa8ae('0x14')](_0x1d5708)[_0xa8ae('0x23')](_0x2997d2);};}exports[_0xa8ae('0x24')]=function(_0x41a27a,_0x416594){var _0x2466b6={},_0x13577e={},_0x446017={'count':0x0,'rows':[]};var _0x414953=db['Trigger'][_0xa8ae('0x25')];_0x13577e[_0xa8ae('0x26')]=_[_0xa8ae('0x27')](_0x414953);var _0x26d00b={'dateStart':_0x41a27a[_0xa8ae('0x28')][_0xa8ae('0x29')],'dateEnd':_0x41a27a[_0xa8ae('0x28')][_0xa8ae('0x2a')]};delete _0x41a27a[_0xa8ae('0x28')][_0xa8ae('0x29')];delete _0x41a27a['query']['dateEnd'];_0x13577e[_0xa8ae('0x28')]=_[_0xa8ae('0x27')](_0x41a27a[_0xa8ae('0x28')]);_0x13577e['filters']=_['intersection'](_0x13577e[_0xa8ae('0x26')],_0x13577e['query']);_0x2466b6[_0xa8ae('0x2b')]=_[_0xa8ae('0x2c')](_0x13577e['model'],qs[_0xa8ae('0x2d')](_0x41a27a[_0xa8ae('0x28')][_0xa8ae('0x2d')]));_0x2466b6[_0xa8ae('0x2b')]=_0x2466b6['attributes']['length']?_0x2466b6[_0xa8ae('0x2b')]:_0x13577e[_0xa8ae('0x26')];if(!_0x41a27a[_0xa8ae('0x28')][_0xa8ae('0x2e')](_0xa8ae('0x2f'))){_0x2466b6['limit']=qs[_0xa8ae('0x30')](_0x41a27a[_0xa8ae('0x28')][_0xa8ae('0x30')]);_0x2466b6['offset']=qs['offset'](_0x41a27a[_0xa8ae('0x28')]['offset']);}_0x2466b6[_0xa8ae('0x31')]=qs[_0xa8ae('0x32')](_0x41a27a[_0xa8ae('0x28')][_0xa8ae('0x32')]);_0x2466b6[_0xa8ae('0x33')]=qs[_0xa8ae('0x34')](_[_0xa8ae('0x35')](_0x41a27a[_0xa8ae('0x28')],_0x13577e[_0xa8ae('0x34')]));if(_0x26d00b[_0xa8ae('0x29')]){if(_0x26d00b['dateEnd']){_0x26d00b[_0xa8ae('0x2a')]=moment(_0x26d00b[_0xa8ae('0x2a')])['add'](0x1,_0xa8ae('0x36'));}else{_0x26d00b[_0xa8ae('0x2a')]=moment(_0x26d00b[_0xa8ae('0x29')])['add'](0x1,_0xa8ae('0x36'));}_['merge'](_0x2466b6[_0xa8ae('0x33')],{'createdAt':{'$gte':_0x26d00b[_0xa8ae('0x29')],'$lte':_0x26d00b['dateEnd']}});}if(_0x41a27a[_0xa8ae('0x28')]['filter']){_0x2466b6[_0xa8ae('0x33')]=_[_0xa8ae('0x37')](_0x2466b6[_0xa8ae('0x33')],{'$or':_[_0xa8ae('0x38')](_0x2466b6[_0xa8ae('0x2b')],function(_0x568f8d){var _0x161deb={};_0x161deb[_0x568f8d]={'$like':'%'+_0x41a27a['query'][_0xa8ae('0x39')]+'%'};return _0x161deb;})});}_0x2466b6=_[_0xa8ae('0x37')]({},_0x2466b6,_0x41a27a[_0xa8ae('0x3a')]);var _0x14112f={'where':_0x2466b6[_0xa8ae('0x33')]};return db[_0xa8ae('0x3b')][_0xa8ae('0x16')](_0x14112f)[_0xa8ae('0x1d')](function(_0xa99e78){_0x446017[_0xa8ae('0x16')]=_0xa99e78;if(_0x41a27a[_0xa8ae('0x28')][_0xa8ae('0x3c')]){_0x2466b6[_0xa8ae('0x3d')]=[{'all':!![]}];}return db[_0xa8ae('0x3b')][_0xa8ae('0x3e')](_0x2466b6);})[_0xa8ae('0x1d')](function(_0x7f8239){_0x446017[_0xa8ae('0x3f')]=_0x7f8239;return _0x446017;})[_0xa8ae('0x1d')](respondWithFilteredResult(_0x416594,_0x2466b6))[_0xa8ae('0x40')](handleError(_0x416594,null));};exports['show']=function(_0x3022b6,_0x16f51c){var _0x82cb6d={'raw':![],'where':{'id':_0x3022b6[_0xa8ae('0x41')]['id']}},_0x1b24d7={};_0x1b24d7[_0xa8ae('0x26')]=_[_0xa8ae('0x27')](db[_0xa8ae('0x3b')][_0xa8ae('0x25')]);_0x1b24d7[_0xa8ae('0x28')]=_['keys'](_0x3022b6['query']);_0x1b24d7['filters']=_[_0xa8ae('0x2c')](_0x1b24d7[_0xa8ae('0x26')],_0x1b24d7['query']);_0x82cb6d['attributes']=_[_0xa8ae('0x2c')](_0x1b24d7['model'],qs[_0xa8ae('0x2d')](_0x3022b6['query']['fields']));_0x82cb6d['attributes']=_0x82cb6d['attributes']['length']?_0x82cb6d[_0xa8ae('0x2b')]:_0x1b24d7[_0xa8ae('0x26')];if(_0x3022b6['query'][_0xa8ae('0x3c')]){_0x82cb6d['include']=[{'all':!![]}];}_0x82cb6d=_['merge']({},_0x82cb6d,_0x3022b6[_0xa8ae('0x3a')]);return db[_0xa8ae('0x3b')]['find'](_0x82cb6d)[_0xa8ae('0x1d')](handleEntityNotFound(_0x16f51c,null))[_0xa8ae('0x1d')](respondWithResult(_0x16f51c,null))[_0xa8ae('0x40')](handleError(_0x16f51c,null));};exports[_0xa8ae('0x42')]=function(_0x409b3d,_0x5d3a9b){return db[_0xa8ae('0x3b')]['create'](_0x409b3d[_0xa8ae('0x43')],{})[_0xa8ae('0x1d')](respondWithResult(_0x5d3a9b,0xc9))[_0xa8ae('0x40')](handleError(_0x5d3a9b,null));};exports[_0xa8ae('0x1c')]=function(_0x1e40c1,_0x545618){if(_0x1e40c1[_0xa8ae('0x43')]['id']){delete _0x1e40c1['body']['id'];}return db['Trigger'][_0xa8ae('0x44')]({'where':{'id':_0x1e40c1['params']['id']}})[_0xa8ae('0x1d')](handleEntityNotFound(_0x545618,null))[_0xa8ae('0x1d')](saveUpdates(_0x1e40c1['body'],null))[_0xa8ae('0x1d')](respondWithResult(_0x545618,null))[_0xa8ae('0x40')](handleError(_0x545618,null));};exports[_0xa8ae('0x1e')]=function(_0x2b422f,_0xf5dadb){return db['Trigger'][_0xa8ae('0x44')]({'where':{'id':_0x2b422f[_0xa8ae('0x41')]['id']}})[_0xa8ae('0x1d')](handleEntityNotFound(_0xf5dadb,null))[_0xa8ae('0x1d')](removeEntity(_0xf5dadb,null))[_0xa8ae('0x40')](handleError(_0xf5dadb,null));};exports[_0xa8ae('0x45')]=function(_0x43023a,_0x417004,_0x66a3a5){if(_0x43023a[_0xa8ae('0x43')]['id']){delete _0x43023a['body']['id'];}return db[_0xa8ae('0x3b')]['find']({'where':{'id':_0x43023a[_0xa8ae('0x41')]['id']}})[_0xa8ae('0x1d')](handleEntityNotFound(_0x417004,null))[_0xa8ae('0x1d')](function(_0x39825a){if(_0x39825a){_0x43023a['body'][_0xa8ae('0x46')]=_0x39825a['id'];return db['Condition']['create'](_0x43023a[_0xa8ae('0x43')]);}})[_0xa8ae('0x1d')](respondWithResult(_0x417004,null))[_0xa8ae('0x40')](handleError(_0x417004,null));};exports[_0xa8ae('0x47')]=function(_0x3d4083,_0x11e4fd,_0x483dd6){if(_0x3d4083['body']['id']){delete _0x3d4083[_0xa8ae('0x43')]['id'];}return db['Trigger'][_0xa8ae('0x44')]({'where':{'id':_0x3d4083[_0xa8ae('0x41')]['id']}})[_0xa8ae('0x1d')](handleEntityNotFound(_0x11e4fd,null))['then'](function(_0xae2d85){if(_0xae2d85){_0x3d4083['body']['TriggerAnyId']=_0xae2d85['id'];return db[_0xa8ae('0x48')][_0xa8ae('0x42')](_0x3d4083[_0xa8ae('0x43')]);}})[_0xa8ae('0x1d')](respondWithResult(_0x11e4fd,null))[_0xa8ae('0x40')](handleError(_0x11e4fd,null));};exports[_0xa8ae('0x49')]=function(_0x66fe42,_0x3b24ad,_0x3c8b14){var _0x56701f={};var _0x5eb0ba={};var _0x1fa6f6;var _0x57b01b;return db['Trigger'][_0xa8ae('0x4a')]({'where':{'id':_0x66fe42[_0xa8ae('0x41')]['id']}})[_0xa8ae('0x1d')](handleEntityNotFound(_0x3b24ad,null))['then'](function(_0x1cba74){if(_0x1cba74){_0x1fa6f6=_0x1cba74;_0x5eb0ba[_0xa8ae('0x26')]=_['keys'](db[_0xa8ae('0x48')]['rawAttributes']);_0x5eb0ba[_0xa8ae('0x28')]=_[_0xa8ae('0x27')](_0x66fe42['query']);_0x5eb0ba[_0xa8ae('0x34')]=_['intersection'](_0x5eb0ba[_0xa8ae('0x26')],_0x5eb0ba[_0xa8ae('0x28')]);_0x56701f[_0xa8ae('0x2b')]=_[_0xa8ae('0x2c')](_0x5eb0ba['model'],qs[_0xa8ae('0x2d')](_0x66fe42[_0xa8ae('0x28')][_0xa8ae('0x2d')]));_0x56701f[_0xa8ae('0x2b')]=_0x56701f['attributes']['length']?_0x56701f[_0xa8ae('0x2b')]:_0x5eb0ba[_0xa8ae('0x26')];_0x56701f[_0xa8ae('0x31')]=qs[_0xa8ae('0x32')](_0x66fe42['query'][_0xa8ae('0x32')]);_0x56701f[_0xa8ae('0x33')]=qs[_0xa8ae('0x34')](_[_0xa8ae('0x35')](_0x66fe42[_0xa8ae('0x28')],_0x5eb0ba['filters']));if(_0x66fe42[_0xa8ae('0x28')][_0xa8ae('0x39')]){_0x56701f[_0xa8ae('0x33')]=_[_0xa8ae('0x37')](_0x56701f[_0xa8ae('0x33')],{'$or':_['map'](_0x56701f[_0xa8ae('0x2b')],function(_0x11fb64){var _0x3fe260={};_0x3fe260[_0x11fb64]={'$like':'%'+_0x66fe42[_0xa8ae('0x28')]['filter']+'%'};return _0x3fe260;})});}_0x56701f=_[_0xa8ae('0x37')]({},_0x56701f,_0x66fe42[_0xa8ae('0x3a')]);return _0x1fa6f6[_0xa8ae('0x49')](_0x56701f);}})[_0xa8ae('0x1d')](function(_0x390ad9){if(_0x390ad9){_0x57b01b=_0x390ad9[_0xa8ae('0x4b')];if(!_0x66fe42['query'][_0xa8ae('0x2e')](_0xa8ae('0x2f'))){_0x56701f['limit']=qs[_0xa8ae('0x30')](_0x66fe42[_0xa8ae('0x28')]['limit']);_0x56701f['offset']=qs[_0xa8ae('0x17')](_0x66fe42[_0xa8ae('0x28')][_0xa8ae('0x17')]);}return _0x1fa6f6['getAllConditions'](_0x56701f);}})['then'](function(_0x3d5074){if(_0x3d5074){return _0x3d5074?{'count':_0x57b01b,'rows':_0x3d5074}:null;}})['then'](respondWithResult(_0x3b24ad,null))[_0xa8ae('0x40')](handleError(_0x3b24ad,null));};exports[_0xa8ae('0x4c')]=function(_0x53dee4,_0x244030,_0x567349){var _0x2c3045={};var _0x17fda4={};var _0x342664;var _0x5367ab;return db['Trigger'][_0xa8ae('0x4a')]({'where':{'id':_0x53dee4['params']['id']}})[_0xa8ae('0x1d')](handleEntityNotFound(_0x244030,null))[_0xa8ae('0x1d')](function(_0x290257){if(_0x290257){_0x342664=_0x290257;_0x17fda4[_0xa8ae('0x26')]=_[_0xa8ae('0x27')](db[_0xa8ae('0x48')]['rawAttributes']);_0x17fda4[_0xa8ae('0x28')]=_[_0xa8ae('0x27')](_0x53dee4['query']);_0x17fda4[_0xa8ae('0x34')]=_['intersection'](_0x17fda4[_0xa8ae('0x26')],_0x17fda4['query']);_0x2c3045[_0xa8ae('0x2b')]=_[_0xa8ae('0x2c')](_0x17fda4[_0xa8ae('0x26')],qs[_0xa8ae('0x2d')](_0x53dee4[_0xa8ae('0x28')][_0xa8ae('0x2d')]));_0x2c3045['attributes']=_0x2c3045[_0xa8ae('0x2b')]['length']?_0x2c3045['attributes']:_0x17fda4[_0xa8ae('0x26')];_0x2c3045['order']=qs[_0xa8ae('0x32')](_0x53dee4['query']['sort']);_0x2c3045[_0xa8ae('0x33')]=qs['filters'](_[_0xa8ae('0x35')](_0x53dee4[_0xa8ae('0x28')],_0x17fda4[_0xa8ae('0x34')]));if(_0x53dee4[_0xa8ae('0x28')]['filter']){_0x2c3045['where']=_['merge'](_0x2c3045['where'],{'$or':_['map'](_0x2c3045[_0xa8ae('0x2b')],function(_0x4ae76a){var _0x3cea4f={};_0x3cea4f[_0x4ae76a]={'$like':'%'+_0x53dee4[_0xa8ae('0x28')][_0xa8ae('0x39')]+'%'};return _0x3cea4f;})});}_0x2c3045=_[_0xa8ae('0x37')]({},_0x2c3045,_0x53dee4[_0xa8ae('0x3a')]);return _0x342664[_0xa8ae('0x4c')](_0x2c3045);}})[_0xa8ae('0x1d')](function(_0x5661c6){if(_0x5661c6){_0x5367ab=_0x5661c6[_0xa8ae('0x4b')];if(!_0x53dee4['query']['hasOwnProperty'](_0xa8ae('0x2f'))){_0x2c3045[_0xa8ae('0x30')]=qs[_0xa8ae('0x30')](_0x53dee4[_0xa8ae('0x28')][_0xa8ae('0x30')]);_0x2c3045[_0xa8ae('0x17')]=qs[_0xa8ae('0x17')](_0x53dee4[_0xa8ae('0x28')][_0xa8ae('0x17')]);}return _0x342664[_0xa8ae('0x4c')](_0x2c3045);}})[_0xa8ae('0x1d')](function(_0x355b62){if(_0x355b62){return _0x355b62?{'count':_0x5367ab,'rows':_0x355b62}:null;}})['then'](respondWithResult(_0x244030,null))[_0xa8ae('0x40')](handleError(_0x244030,null));};exports[_0xa8ae('0x4d')]=function(_0x13db4d,_0x409cfb,_0x18d4ac){if(_0x13db4d['body']['id']){delete _0x13db4d[_0xa8ae('0x43')]['id'];}return db['Trigger'][_0xa8ae('0x44')]({'where':{'id':_0x13db4d[_0xa8ae('0x41')]['id']}})[_0xa8ae('0x1d')](handleEntityNotFound(_0x409cfb,null))[_0xa8ae('0x1d')](function(_0x5e09b2){if(_0x5e09b2){_0x13db4d['body'][_0xa8ae('0x4e')]=_0x5e09b2['id'];return db['Action'][_0xa8ae('0x42')](_0x13db4d['body']);}})[_0xa8ae('0x1d')](respondWithResult(_0x409cfb,null))['catch'](handleError(_0x409cfb,null));};exports['getActions']=function(_0x2eb741,_0xf86a07,_0x1451c8){var _0x2eaf7b={};var _0x4e6ad5={};var _0x15dfd7;var _0x859739;return db[_0xa8ae('0x3b')][_0xa8ae('0x4a')]({'where':{'id':_0x2eb741[_0xa8ae('0x41')]['id']}})[_0xa8ae('0x1d')](handleEntityNotFound(_0xf86a07,null))['then'](function(_0x11b24c){if(_0x11b24c){_0x15dfd7=_0x11b24c;_0x4e6ad5[_0xa8ae('0x26')]=_[_0xa8ae('0x27')](db[_0xa8ae('0x4f')]['rawAttributes']);_0x4e6ad5['query']=_[_0xa8ae('0x27')](_0x2eb741[_0xa8ae('0x28')]);_0x4e6ad5[_0xa8ae('0x34')]=_[_0xa8ae('0x2c')](_0x4e6ad5[_0xa8ae('0x26')],_0x4e6ad5['query']);_0x2eaf7b[_0xa8ae('0x2b')]=_[_0xa8ae('0x2c')](_0x4e6ad5[_0xa8ae('0x26')],qs[_0xa8ae('0x2d')](_0x2eb741[_0xa8ae('0x28')][_0xa8ae('0x2d')]));_0x2eaf7b[_0xa8ae('0x2b')]=_0x2eaf7b[_0xa8ae('0x2b')][_0xa8ae('0x4b')]?_0x2eaf7b[_0xa8ae('0x2b')]:_0x4e6ad5['model'];_0x2eaf7b['order']=qs['sort'](_0x2eb741[_0xa8ae('0x28')][_0xa8ae('0x32')]);_0x2eaf7b[_0xa8ae('0x33')]=qs[_0xa8ae('0x34')](_[_0xa8ae('0x35')](_0x2eb741['query'],_0x4e6ad5[_0xa8ae('0x34')]));if(_0x2eb741[_0xa8ae('0x28')][_0xa8ae('0x39')]){_0x2eaf7b[_0xa8ae('0x33')]=_[_0xa8ae('0x37')](_0x2eaf7b[_0xa8ae('0x33')],{'$or':_[_0xa8ae('0x38')](_0x2eaf7b[_0xa8ae('0x2b')],function(_0x5ce3a5){var _0x2d1e6c={};_0x2d1e6c[_0x5ce3a5]={'$like':'%'+_0x2eb741[_0xa8ae('0x28')][_0xa8ae('0x39')]+'%'};return _0x2d1e6c;})});}_0x2eaf7b=_['merge']({},_0x2eaf7b,_0x2eb741[_0xa8ae('0x3a')]);return _0x15dfd7[_0xa8ae('0x50')](_0x2eaf7b);}})[_0xa8ae('0x1d')](function(_0x1fb7f2){if(_0x1fb7f2){_0x859739=_0x1fb7f2[_0xa8ae('0x4b')];if(!_0x2eb741['query'][_0xa8ae('0x2e')](_0xa8ae('0x2f'))){_0x2eaf7b[_0xa8ae('0x30')]=qs['limit'](_0x2eb741[_0xa8ae('0x28')][_0xa8ae('0x30')]);_0x2eaf7b['offset']=qs['offset'](_0x2eb741['query']['offset']);}return _0x15dfd7['getActions'](_0x2eaf7b);}})[_0xa8ae('0x1d')](function(_0x469b73){if(_0x469b73){return _0x469b73?{'count':_0x859739,'rows':_0x469b73}:null;}})[_0xa8ae('0x1d')](respondWithResult(_0xf86a07,null))[_0xa8ae('0x40')](handleError(_0xf86a07,null));}; \ No newline at end of file +var _0xf39e=['Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','hasOwnProperty','nolimit','getAnyConditions','addAction','getActions','Action','fast-json-patch','request-promise','moment','bluebird','util','path','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','Trigger','rawAttributes','keys','query','dateStart','dateEnd','model','intersection','fields','attributes','length','limit','order','sort','where','filters','filter','map','merge','includeAll','findAll','rows','show','params','options','find','catch','create','body','destroy','addAllCondition','TriggerAllId'];(function(_0x1f3534,_0x45b267){var _0x52a5dc=function(_0x1d738f){while(--_0x1d738f){_0x1f3534['push'](_0x1f3534['shift']());}};_0x52a5dc(++_0x45b267);}(_0xf39e,0xf6));var _0xef39=function(_0x3353e2,_0x2399ea){_0x3353e2=_0x3353e2-0x0;var _0x215979=_0xf39e[_0x3353e2];return _0x215979;};'use strict';var jsonpatch=require(_0xef39('0x0'));var rp=require(_0xef39('0x1'));var moment=require(_0xef39('0x2'));var BPromise=require(_0xef39('0x3'));var Mustache=require('mustache');var util=require(_0xef39('0x4'));var path=require(_0xef39('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xef39('0x6'));var crypto=require(_0xef39('0x7'));var jsforce=require(_0xef39('0x8'));var deskjs=require(_0xef39('0x9'));var toCsv=require(_0xef39('0xa'));var querystring=require(_0xef39('0xb'));var Papa=require(_0xef39('0xc'));var qs=require(_0xef39('0xd'));var logger=require(_0xef39('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xef39('0xf'));var db=require(_0xef39('0x10'))['db'];function respondWithStatusCode(_0x4c272a,_0x395158){_0x395158=_0x395158||0xcc;return function(_0x361426){if(_0x361426){return _0x4c272a['sendStatus'](_0x395158);}return _0x4c272a[_0xef39('0x11')](_0x395158)[_0xef39('0x12')]();};}function respondWithResult(_0x4de344,_0x446f1f){_0x446f1f=_0x446f1f||0xc8;return function(_0x400bff){if(_0x400bff){return _0x4de344[_0xef39('0x11')](_0x446f1f)[_0xef39('0x13')](_0x400bff);}};}function respondWithFilteredResult(_0x31ab92,_0x280417){return function(_0xcadd26){if(_0xcadd26){var _0x2fcffd=_0xcadd26[_0xef39('0x14')],_0x55879a=_0x280417['offset'],_0x41585a=_0x280417[_0xef39('0x15')]+_0x280417['limit'],_0x465d59;if(_0x41585a>=_0x2fcffd){_0x41585a=_0x2fcffd;_0x465d59=0xc8;}else{_0x465d59=0xce;}_0x31ab92['status'](_0x465d59);return _0x31ab92[_0xef39('0x16')](_0xef39('0x17'),_0x55879a+'-'+_0x41585a+'/'+_0x2fcffd)[_0xef39('0x13')](_0xcadd26);}return null;};}function patchUpdates(_0x38e0cb){return function(_0x3aabaf){try{jsonpatch['apply'](_0x3aabaf,_0x38e0cb,!![]);}catch(_0x1014fe){return BPromise[_0xef39('0x18')](_0x1014fe);}return _0x3aabaf[_0xef39('0x19')]();};}function saveUpdates(_0x305f09,_0x55dc01){return function(_0x3a49da){if(_0x3a49da){return _0x3a49da[_0xef39('0x1a')](_0x305f09)[_0xef39('0x1b')](function(_0x29bcbc){return _0x29bcbc;});}return null;};}function removeEntity(_0xdd8ff7,_0x5c4ac4){return function(_0x3884da){if(_0x3884da){return _0x3884da['destroy']()['then'](function(){_0xdd8ff7[_0xef39('0x11')](0xcc)[_0xef39('0x12')]();});}};}function handleEntityNotFound(_0x53244f,_0x3d6778){return function(_0x530e2f){if(!_0x530e2f){_0x53244f[_0xef39('0x1c')](0x194);}return _0x530e2f;};}function handleError(_0x4f2cb3,_0x13db47){_0x13db47=_0x13db47||0x1f4;return function(_0x2c1eb9){logger[_0xef39('0x1d')](_0x2c1eb9[_0xef39('0x1e')]);if(_0x2c1eb9['name']){delete _0x2c1eb9[_0xef39('0x1f')];}_0x4f2cb3[_0xef39('0x11')](_0x13db47)[_0xef39('0x20')](_0x2c1eb9);};}exports[_0xef39('0x21')]=function(_0x4f7b0b,_0x545b48){var _0x4c7253={},_0x1c1536={},_0x2cfcfa={'count':0x0,'rows':[]};var _0x25edc3=db[_0xef39('0x22')][_0xef39('0x23')];_0x1c1536['model']=_[_0xef39('0x24')](_0x25edc3);var _0xbc6f57={'dateStart':_0x4f7b0b[_0xef39('0x25')][_0xef39('0x26')],'dateEnd':_0x4f7b0b[_0xef39('0x25')][_0xef39('0x27')]};delete _0x4f7b0b[_0xef39('0x25')]['dateStart'];delete _0x4f7b0b[_0xef39('0x25')][_0xef39('0x27')];_0x1c1536[_0xef39('0x25')]=_[_0xef39('0x24')](_0x4f7b0b[_0xef39('0x25')]);_0x1c1536['filters']=_['intersection'](_0x1c1536[_0xef39('0x28')],_0x1c1536[_0xef39('0x25')]);_0x4c7253['attributes']=_[_0xef39('0x29')](_0x1c1536[_0xef39('0x28')],qs[_0xef39('0x2a')](_0x4f7b0b['query'][_0xef39('0x2a')]));_0x4c7253[_0xef39('0x2b')]=_0x4c7253[_0xef39('0x2b')][_0xef39('0x2c')]?_0x4c7253[_0xef39('0x2b')]:_0x1c1536[_0xef39('0x28')];if(!_0x4f7b0b['query']['hasOwnProperty']('nolimit')){_0x4c7253[_0xef39('0x2d')]=qs['limit'](_0x4f7b0b['query'][_0xef39('0x2d')]);_0x4c7253[_0xef39('0x15')]=qs[_0xef39('0x15')](_0x4f7b0b['query'][_0xef39('0x15')]);}_0x4c7253[_0xef39('0x2e')]=qs[_0xef39('0x2f')](_0x4f7b0b[_0xef39('0x25')][_0xef39('0x2f')]);_0x4c7253[_0xef39('0x30')]=qs[_0xef39('0x31')](_['pick'](_0x4f7b0b[_0xef39('0x25')],_0x1c1536['filters']));if(_0xbc6f57[_0xef39('0x26')]){if(_0xbc6f57[_0xef39('0x27')]){_0xbc6f57[_0xef39('0x27')]=moment(_0xbc6f57[_0xef39('0x27')])['add'](0x1,'day');}else{_0xbc6f57[_0xef39('0x27')]=moment(_0xbc6f57[_0xef39('0x26')])['add'](0x1,'day');}_['merge'](_0x4c7253[_0xef39('0x30')],{'createdAt':{'$gte':_0xbc6f57[_0xef39('0x26')],'$lte':_0xbc6f57[_0xef39('0x27')]}});}if(_0x4f7b0b[_0xef39('0x25')][_0xef39('0x32')]){_0x4c7253[_0xef39('0x30')]=_['merge'](_0x4c7253[_0xef39('0x30')],{'$or':_[_0xef39('0x33')](_0x4c7253['attributes'],function(_0x19cfd1){var _0x4fdd59={};_0x4fdd59[_0x19cfd1]={'$like':'%'+_0x4f7b0b[_0xef39('0x25')][_0xef39('0x32')]+'%'};return _0x4fdd59;})});}_0x4c7253=_[_0xef39('0x34')]({},_0x4c7253,_0x4f7b0b['options']);var _0xd1d687={'where':_0x4c7253[_0xef39('0x30')]};return db[_0xef39('0x22')][_0xef39('0x14')](_0xd1d687)['then'](function(_0x354410){_0x2cfcfa[_0xef39('0x14')]=_0x354410;if(_0x4f7b0b[_0xef39('0x25')][_0xef39('0x35')]){_0x4c7253['include']=[{'all':!![]}];}return db[_0xef39('0x22')][_0xef39('0x36')](_0x4c7253);})[_0xef39('0x1b')](function(_0x4f4160){_0x2cfcfa[_0xef39('0x37')]=_0x4f4160;return _0x2cfcfa;})[_0xef39('0x1b')](respondWithFilteredResult(_0x545b48,_0x4c7253))['catch'](handleError(_0x545b48,null));};exports[_0xef39('0x38')]=function(_0x385856,_0x28a8ef){var _0xaeb2cc={'raw':![],'where':{'id':_0x385856[_0xef39('0x39')]['id']}},_0x1b0b0c={};_0x1b0b0c[_0xef39('0x28')]=_[_0xef39('0x24')](db[_0xef39('0x22')][_0xef39('0x23')]);_0x1b0b0c[_0xef39('0x25')]=_[_0xef39('0x24')](_0x385856[_0xef39('0x25')]);_0x1b0b0c[_0xef39('0x31')]=_[_0xef39('0x29')](_0x1b0b0c['model'],_0x1b0b0c['query']);_0xaeb2cc[_0xef39('0x2b')]=_[_0xef39('0x29')](_0x1b0b0c[_0xef39('0x28')],qs[_0xef39('0x2a')](_0x385856['query'][_0xef39('0x2a')]));_0xaeb2cc[_0xef39('0x2b')]=_0xaeb2cc[_0xef39('0x2b')][_0xef39('0x2c')]?_0xaeb2cc[_0xef39('0x2b')]:_0x1b0b0c['model'];if(_0x385856['query'][_0xef39('0x35')]){_0xaeb2cc['include']=[{'all':!![]}];}_0xaeb2cc=_[_0xef39('0x34')]({},_0xaeb2cc,_0x385856[_0xef39('0x3a')]);return db[_0xef39('0x22')][_0xef39('0x3b')](_0xaeb2cc)[_0xef39('0x1b')](handleEntityNotFound(_0x28a8ef,null))[_0xef39('0x1b')](respondWithResult(_0x28a8ef,null))[_0xef39('0x3c')](handleError(_0x28a8ef,null));};exports['create']=function(_0x233484,_0x41dd26){return db['Trigger'][_0xef39('0x3d')](_0x233484[_0xef39('0x3e')],{})[_0xef39('0x1b')](respondWithResult(_0x41dd26,0xc9))['catch'](handleError(_0x41dd26,null));};exports[_0xef39('0x1a')]=function(_0x522a54,_0x11dea5){if(_0x522a54['body']['id']){delete _0x522a54[_0xef39('0x3e')]['id'];}return db['Trigger']['find']({'where':{'id':_0x522a54[_0xef39('0x39')]['id']}})[_0xef39('0x1b')](handleEntityNotFound(_0x11dea5,null))[_0xef39('0x1b')](saveUpdates(_0x522a54[_0xef39('0x3e')],null))[_0xef39('0x1b')](respondWithResult(_0x11dea5,null))[_0xef39('0x3c')](handleError(_0x11dea5,null));};exports[_0xef39('0x3f')]=function(_0x360602,_0x54ca4c){return db[_0xef39('0x22')]['find']({'where':{'id':_0x360602[_0xef39('0x39')]['id']}})[_0xef39('0x1b')](handleEntityNotFound(_0x54ca4c,null))[_0xef39('0x1b')](removeEntity(_0x54ca4c,null))[_0xef39('0x3c')](handleError(_0x54ca4c,null));};exports[_0xef39('0x40')]=function(_0x188b35,_0x4c9d47,_0x57b961){if(_0x188b35['body']['id']){delete _0x188b35[_0xef39('0x3e')]['id'];}return db['Trigger'][_0xef39('0x3b')]({'where':{'id':_0x188b35[_0xef39('0x39')]['id']}})['then'](handleEntityNotFound(_0x4c9d47,null))[_0xef39('0x1b')](function(_0x1fb4a8){if(_0x1fb4a8){_0x188b35['body'][_0xef39('0x41')]=_0x1fb4a8['id'];return db[_0xef39('0x42')][_0xef39('0x3d')](_0x188b35[_0xef39('0x3e')]);}})['then'](respondWithResult(_0x4c9d47,null))['catch'](handleError(_0x4c9d47,null));};exports[_0xef39('0x43')]=function(_0x3a98fc,_0x4a35ff,_0xa3434b){if(_0x3a98fc[_0xef39('0x3e')]['id']){delete _0x3a98fc[_0xef39('0x3e')]['id'];}return db['Trigger'][_0xef39('0x3b')]({'where':{'id':_0x3a98fc[_0xef39('0x39')]['id']}})[_0xef39('0x1b')](handleEntityNotFound(_0x4a35ff,null))[_0xef39('0x1b')](function(_0x17c5e){if(_0x17c5e){_0x3a98fc[_0xef39('0x3e')][_0xef39('0x44')]=_0x17c5e['id'];return db['Condition']['create'](_0x3a98fc[_0xef39('0x3e')]);}})[_0xef39('0x1b')](respondWithResult(_0x4a35ff,null))[_0xef39('0x3c')](handleError(_0x4a35ff,null));};exports[_0xef39('0x45')]=function(_0x2adb67,_0x15ccd0,_0x15de3d){var _0x287139={};var _0x518c4d={};var _0xaf4c00;var _0x51f6a7;return db['Trigger'][_0xef39('0x46')]({'where':{'id':_0x2adb67[_0xef39('0x39')]['id']}})[_0xef39('0x1b')](handleEntityNotFound(_0x15ccd0,null))[_0xef39('0x1b')](function(_0x594354){if(_0x594354){_0xaf4c00=_0x594354;_0x518c4d[_0xef39('0x28')]=_[_0xef39('0x24')](db[_0xef39('0x42')][_0xef39('0x23')]);_0x518c4d[_0xef39('0x25')]=_['keys'](_0x2adb67['query']);_0x518c4d[_0xef39('0x31')]=_[_0xef39('0x29')](_0x518c4d[_0xef39('0x28')],_0x518c4d[_0xef39('0x25')]);_0x287139[_0xef39('0x2b')]=_['intersection'](_0x518c4d[_0xef39('0x28')],qs[_0xef39('0x2a')](_0x2adb67['query']['fields']));_0x287139[_0xef39('0x2b')]=_0x287139['attributes'][_0xef39('0x2c')]?_0x287139[_0xef39('0x2b')]:_0x518c4d[_0xef39('0x28')];_0x287139[_0xef39('0x2e')]=qs[_0xef39('0x2f')](_0x2adb67[_0xef39('0x25')][_0xef39('0x2f')]);_0x287139['where']=qs[_0xef39('0x31')](_[_0xef39('0x47')](_0x2adb67[_0xef39('0x25')],_0x518c4d['filters']));if(_0x2adb67[_0xef39('0x25')][_0xef39('0x32')]){_0x287139[_0xef39('0x30')]=_[_0xef39('0x34')](_0x287139[_0xef39('0x30')],{'$or':_[_0xef39('0x33')](_0x287139[_0xef39('0x2b')],function(_0x4cdc58){var _0x48ab48={};_0x48ab48[_0x4cdc58]={'$like':'%'+_0x2adb67['query'][_0xef39('0x32')]+'%'};return _0x48ab48;})});}_0x287139=_[_0xef39('0x34')]({},_0x287139,_0x2adb67[_0xef39('0x3a')]);return _0xaf4c00[_0xef39('0x45')](_0x287139);}})['then'](function(_0x230a90){if(_0x230a90){_0x51f6a7=_0x230a90[_0xef39('0x2c')];if(!_0x2adb67[_0xef39('0x25')][_0xef39('0x48')](_0xef39('0x49'))){_0x287139[_0xef39('0x2d')]=qs[_0xef39('0x2d')](_0x2adb67[_0xef39('0x25')][_0xef39('0x2d')]);_0x287139['offset']=qs[_0xef39('0x15')](_0x2adb67['query'][_0xef39('0x15')]);}return _0xaf4c00[_0xef39('0x45')](_0x287139);}})[_0xef39('0x1b')](function(_0x160bef){if(_0x160bef){return _0x160bef?{'count':_0x51f6a7,'rows':_0x160bef}:null;}})['then'](respondWithResult(_0x15ccd0,null))[_0xef39('0x3c')](handleError(_0x15ccd0,null));};exports['getAnyConditions']=function(_0x4afc7e,_0x13c718,_0x19044e){var _0x137594={};var _0x4a9e4c={};var _0x377a72;var _0x5461cf;return db[_0xef39('0x22')][_0xef39('0x46')]({'where':{'id':_0x4afc7e[_0xef39('0x39')]['id']}})[_0xef39('0x1b')](handleEntityNotFound(_0x13c718,null))[_0xef39('0x1b')](function(_0x488582){if(_0x488582){_0x377a72=_0x488582;_0x4a9e4c[_0xef39('0x28')]=_[_0xef39('0x24')](db[_0xef39('0x42')][_0xef39('0x23')]);_0x4a9e4c[_0xef39('0x25')]=_['keys'](_0x4afc7e[_0xef39('0x25')]);_0x4a9e4c[_0xef39('0x31')]=_[_0xef39('0x29')](_0x4a9e4c[_0xef39('0x28')],_0x4a9e4c[_0xef39('0x25')]);_0x137594['attributes']=_['intersection'](_0x4a9e4c[_0xef39('0x28')],qs['fields'](_0x4afc7e[_0xef39('0x25')][_0xef39('0x2a')]));_0x137594[_0xef39('0x2b')]=_0x137594[_0xef39('0x2b')]['length']?_0x137594['attributes']:_0x4a9e4c[_0xef39('0x28')];_0x137594[_0xef39('0x2e')]=qs['sort'](_0x4afc7e[_0xef39('0x25')][_0xef39('0x2f')]);_0x137594[_0xef39('0x30')]=qs['filters'](_['pick'](_0x4afc7e[_0xef39('0x25')],_0x4a9e4c['filters']));if(_0x4afc7e[_0xef39('0x25')][_0xef39('0x32')]){_0x137594[_0xef39('0x30')]=_[_0xef39('0x34')](_0x137594[_0xef39('0x30')],{'$or':_['map'](_0x137594[_0xef39('0x2b')],function(_0xd2bcd5){var _0x45a040={};_0x45a040[_0xd2bcd5]={'$like':'%'+_0x4afc7e[_0xef39('0x25')][_0xef39('0x32')]+'%'};return _0x45a040;})});}_0x137594=_[_0xef39('0x34')]({},_0x137594,_0x4afc7e[_0xef39('0x3a')]);return _0x377a72[_0xef39('0x4a')](_0x137594);}})[_0xef39('0x1b')](function(_0x93252b){if(_0x93252b){_0x5461cf=_0x93252b[_0xef39('0x2c')];if(!_0x4afc7e['query']['hasOwnProperty'](_0xef39('0x49'))){_0x137594[_0xef39('0x2d')]=qs[_0xef39('0x2d')](_0x4afc7e['query'][_0xef39('0x2d')]);_0x137594[_0xef39('0x15')]=qs[_0xef39('0x15')](_0x4afc7e['query'][_0xef39('0x15')]);}return _0x377a72[_0xef39('0x4a')](_0x137594);}})['then'](function(_0x4e100a){if(_0x4e100a){return _0x4e100a?{'count':_0x5461cf,'rows':_0x4e100a}:null;}})[_0xef39('0x1b')](respondWithResult(_0x13c718,null))[_0xef39('0x3c')](handleError(_0x13c718,null));};exports[_0xef39('0x4b')]=function(_0x20cda7,_0x4cc592,_0x1b30b1){if(_0x20cda7[_0xef39('0x3e')]['id']){delete _0x20cda7['body']['id'];}return db[_0xef39('0x22')][_0xef39('0x3b')]({'where':{'id':_0x20cda7['params']['id']}})[_0xef39('0x1b')](handleEntityNotFound(_0x4cc592,null))['then'](function(_0x454f6a){if(_0x454f6a){_0x20cda7['body']['TriggerId']=_0x454f6a['id'];return db['Action']['create'](_0x20cda7[_0xef39('0x3e')]);}})['then'](respondWithResult(_0x4cc592,null))[_0xef39('0x3c')](handleError(_0x4cc592,null));};exports[_0xef39('0x4c')]=function(_0x482df6,_0x38a9c4,_0x2f2269){var _0x490742={};var _0x43faa6={};var _0x2d623b;var _0x3be91b;return db['Trigger']['findOne']({'where':{'id':_0x482df6[_0xef39('0x39')]['id']}})[_0xef39('0x1b')](handleEntityNotFound(_0x38a9c4,null))[_0xef39('0x1b')](function(_0x3fad91){if(_0x3fad91){_0x2d623b=_0x3fad91;_0x43faa6['model']=_[_0xef39('0x24')](db[_0xef39('0x4d')][_0xef39('0x23')]);_0x43faa6[_0xef39('0x25')]=_[_0xef39('0x24')](_0x482df6[_0xef39('0x25')]);_0x43faa6[_0xef39('0x31')]=_[_0xef39('0x29')](_0x43faa6[_0xef39('0x28')],_0x43faa6[_0xef39('0x25')]);_0x490742[_0xef39('0x2b')]=_[_0xef39('0x29')](_0x43faa6[_0xef39('0x28')],qs['fields'](_0x482df6['query'][_0xef39('0x2a')]));_0x490742['attributes']=_0x490742[_0xef39('0x2b')]['length']?_0x490742[_0xef39('0x2b')]:_0x43faa6['model'];_0x490742[_0xef39('0x2e')]=qs['sort'](_0x482df6[_0xef39('0x25')][_0xef39('0x2f')]);_0x490742[_0xef39('0x30')]=qs['filters'](_[_0xef39('0x47')](_0x482df6['query'],_0x43faa6[_0xef39('0x31')]));if(_0x482df6[_0xef39('0x25')][_0xef39('0x32')]){_0x490742['where']=_['merge'](_0x490742['where'],{'$or':_[_0xef39('0x33')](_0x490742['attributes'],function(_0x1a2091){var _0x242360={};_0x242360[_0x1a2091]={'$like':'%'+_0x482df6[_0xef39('0x25')][_0xef39('0x32')]+'%'};return _0x242360;})});}_0x490742=_[_0xef39('0x34')]({},_0x490742,_0x482df6[_0xef39('0x3a')]);return _0x2d623b[_0xef39('0x4c')](_0x490742);}})['then'](function(_0x5a172c){if(_0x5a172c){_0x3be91b=_0x5a172c[_0xef39('0x2c')];if(!_0x482df6[_0xef39('0x25')]['hasOwnProperty'](_0xef39('0x49'))){_0x490742['limit']=qs[_0xef39('0x2d')](_0x482df6[_0xef39('0x25')][_0xef39('0x2d')]);_0x490742[_0xef39('0x15')]=qs['offset'](_0x482df6[_0xef39('0x25')][_0xef39('0x15')]);}return _0x2d623b['getActions'](_0x490742);}})['then'](function(_0x5bbc88){if(_0x5bbc88){return _0x5bbc88?{'count':_0x3be91b,'rows':_0x5bbc88}:null;}})[_0xef39('0x1b')](respondWithResult(_0x38a9c4,null))[_0xef39('0x3c')](handleError(_0x38a9c4,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index b15efb2..55d87ab 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 _0xf95d=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x571d85,_0xda439c){var _0x3c2e07=function(_0x2d2144){while(--_0x2d2144){_0x571d85['push'](_0x571d85['shift']());}};_0x3c2e07(++_0xda439c);}(_0xf95d,0x89));var _0xdf95=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xf95d[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xdf95('0x0'));var util=require(_0xdf95('0x1'));var logger=require(_0xdf95('0x2'))(_0xdf95('0x3'));var moment=require(_0xdf95('0x4'));var BPromise=require(_0xdf95('0x5'));var rp=require(_0xdf95('0x6'));var attributes=require(_0xdf95('0x7'));module[_0xdf95('0x8')]=function(_0x38e029,_0x308f11){return _0x38e029[_0xdf95('0x9')](_0xdf95('0xa'),attributes,{'tableName':_0xdf95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a39=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define','Trigger'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x3a39,0xfa));var _0x93a3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3a39[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x93a3('0x0'));var util=require(_0x93a3('0x1'));var logger=require(_0x93a3('0x2'))(_0x93a3('0x3'));var moment=require(_0x93a3('0x4'));var BPromise=require(_0x93a3('0x5'));var rp=require(_0x93a3('0x6'));var attributes=require('./trigger.attributes');module[_0x93a3('0x7')]=function(_0x4ea703,_0x5d0f62){return _0x4ea703[_0x93a3('0x8')](_0x93a3('0x9'),attributes,{'tableName':'tools_triggers','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 ffe250b..d41eb62 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 _0xdf20=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Trigger','findAll','options','where','attributes','limit','include','map','model','GetTrigger','catch','raw','ShowTrigger','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s'];(function(_0x2fcd0f,_0x4374b5){var _0x4b357e=function(_0x67618d){while(--_0x67618d){_0x2fcd0f['push'](_0x2fcd0f['shift']());}};_0x4b357e(++_0x4374b5);}(_0xdf20,0xec));var _0x0df2=function(_0x1147d5,_0x27a120){_0x1147d5=_0x1147d5-0x0;var _0x46c4a2=_0xdf20[_0x1147d5];return _0x46c4a2;};'use strict';var _=require(_0x0df2('0x0'));var util=require(_0x0df2('0x1'));var moment=require(_0x0df2('0x2'));var BPromise=require(_0x0df2('0x3'));var rs=require(_0x0df2('0x4'));var fs=require('fs');var db=require(_0x0df2('0x5'))['db'];var utils=require(_0x0df2('0x6'));var logger=require(_0x0df2('0x7'))(_0x0df2('0x8'));var config=require(_0x0df2('0x9'));var jayson=require(_0x0df2('0xa'));var client=jayson[_0x0df2('0xb')][_0x0df2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8e24d3,_0x56764b,_0x23fe39){return new BPromise(function(_0xe7f6cd,_0x23804c){return client['request'](_0x8e24d3,_0x23fe39)[_0x0df2('0xd')](function(_0x432f7f){logger[_0x0df2('0xe')](_0x0df2('0xf'),_0x56764b,_0x0df2('0x10'));logger[_0x0df2('0x11')](_0x0df2('0x12'),_0x56764b,_0x0df2('0x10'),JSON[_0x0df2('0x13')](_0x432f7f));if(_0x432f7f[_0x0df2('0x14')]){if(_0x432f7f[_0x0df2('0x14')]['code']===0x1f4){logger[_0x0df2('0x14')](_0x0df2('0xf'),_0x56764b,_0x432f7f[_0x0df2('0x14')][_0x0df2('0x15')]);return _0x23804c(_0x432f7f[_0x0df2('0x14')][_0x0df2('0x15')]);}logger[_0x0df2('0x14')](_0x0df2('0xf'),_0x56764b,_0x432f7f[_0x0df2('0x14')][_0x0df2('0x15')]);return _0xe7f6cd(_0x432f7f['error'][_0x0df2('0x15')]);}else{logger[_0x0df2('0xe')](_0x0df2('0xf'),_0x56764b,_0x0df2('0x10'));_0xe7f6cd(_0x432f7f[_0x0df2('0x16')][_0x0df2('0x15')]);}})['catch'](function(_0x2aaa98){logger[_0x0df2('0x14')](_0x0df2('0xf'),_0x56764b,_0x2aaa98);_0x23804c(_0x2aaa98);});});}exports['GetTrigger']=function(_0x28075c){var _0x2fd864=this;return new Promise(function(_0x104b8d,_0x2c6ca5){return db[_0x0df2('0x17')][_0x0df2('0x18')]({'raw':_0x28075c[_0x0df2('0x19')]?_0x28075c[_0x0df2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x28075c[_0x0df2('0x19')]?_0x28075c[_0x0df2('0x19')][_0x0df2('0x1a')]||null:null,'attributes':_0x28075c[_0x0df2('0x19')]?_0x28075c[_0x0df2('0x19')][_0x0df2('0x1b')]||null:null,'limit':_0x28075c[_0x0df2('0x19')]?_0x28075c['options'][_0x0df2('0x1c')]||null:null,'include':_0x28075c[_0x0df2('0x19')]?_0x28075c['options'][_0x0df2('0x1d')]?_['map'](_0x28075c['options'][_0x0df2('0x1d')],function(_0x2555f7){return{'model':db[_0x2555f7['model']],'as':_0x2555f7['as'],'attributes':_0x2555f7[_0x0df2('0x1b')],'include':_0x2555f7[_0x0df2('0x1d')]?_[_0x0df2('0x1e')](_0x2555f7['include'],function(_0x24fe6d){return{'model':db[_0x24fe6d[_0x0df2('0x1f')]],'as':_0x24fe6d['as'],'attributes':_0x24fe6d[_0x0df2('0x1b')],'include':_0x24fe6d[_0x0df2('0x1d')]?_[_0x0df2('0x1e')](_0x24fe6d[_0x0df2('0x1d')],function(_0x24c2b3){return{'model':db[_0x24c2b3[_0x0df2('0x1f')]],'as':_0x24c2b3['as'],'attributes':_0x24c2b3[_0x0df2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0df2('0xd')](function(_0x512997){logger[_0x0df2('0xe')](_0x0df2('0x20'),_0x28075c);logger['debug'](_0x0df2('0x20'),_0x28075c,JSON[_0x0df2('0x13')](_0x512997));_0x104b8d(_0x512997);})[_0x0df2('0x21')](function(_0xfac15a){logger[_0x0df2('0x14')]('GetTrigger',_0xfac15a[_0x0df2('0x15')],_0x28075c);_0x2c6ca5(_0x2fd864['error'](0x1f4,_0xfac15a[_0x0df2('0x15')]));});});};exports['ShowTrigger']=function(_0x1680f8){var _0x342090=this;return new Promise(function(_0x2ae858,_0x96f606){return db[_0x0df2('0x17')]['find']({'raw':_0x1680f8['options']?_0x1680f8['options'][_0x0df2('0x22')]===undefined?!![]:![]:!![],'where':_0x1680f8['options']?_0x1680f8['options'][_0x0df2('0x1a')]||null:null,'attributes':_0x1680f8[_0x0df2('0x19')]?_0x1680f8[_0x0df2('0x19')][_0x0df2('0x1b')]||null:null,'include':_0x1680f8[_0x0df2('0x19')]?_0x1680f8['options'][_0x0df2('0x1d')]?_[_0x0df2('0x1e')](_0x1680f8[_0x0df2('0x19')][_0x0df2('0x1d')],function(_0x20d926){return{'model':db[_0x20d926[_0x0df2('0x1f')]],'as':_0x20d926['as'],'attributes':_0x20d926[_0x0df2('0x1b')],'include':_0x20d926[_0x0df2('0x1d')]?_['map'](_0x20d926[_0x0df2('0x1d')],function(_0x2a9d34){return{'model':db[_0x2a9d34[_0x0df2('0x1f')]],'as':_0x2a9d34['as'],'attributes':_0x2a9d34['attributes'],'include':_0x2a9d34[_0x0df2('0x1d')]?_[_0x0df2('0x1e')](_0x2a9d34[_0x0df2('0x1d')],function(_0x158bb1){return{'model':db[_0x158bb1[_0x0df2('0x1f')]],'as':_0x158bb1['as'],'attributes':_0x158bb1[_0x0df2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0df2('0xd')](function(_0x1974cb){logger[_0x0df2('0xe')](_0x0df2('0x23'),_0x1680f8);logger[_0x0df2('0x11')](_0x0df2('0x23'),_0x1680f8,JSON[_0x0df2('0x13')](_0x1974cb));_0x2ae858(_0x1974cb);})[_0x0df2('0x21')](function(_0x3e8926){logger[_0x0df2('0x14')](_0x0df2('0x23'),_0x3e8926['message'],_0x1680f8);_0x96f606(_0x342090[_0x0df2('0x14')](0x1f4,_0x3e8926[_0x0df2('0x15')]));});});}; \ No newline at end of file +var _0xf860=['error','Trigger,\x20%s,\x20%s','message','info','result','catch','GetTrigger','findAll','options','where','attributes','limit','include','model','map','ShowTrigger','raw','lodash','util','bluebird','randomstring','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x11de69,_0x46c7c6){var _0x211379=function(_0x58c8dd){while(--_0x58c8dd){_0x11de69['push'](_0x11de69['shift']());}};_0x211379(++_0x46c7c6);}(_0xf860,0x109));var _0x0f86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf860[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f86('0x0'));var util=require(_0x0f86('0x1'));var moment=require('moment');var BPromise=require(_0x0f86('0x2'));var rs=require(_0x0f86('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0f86('0x4'));var config=require(_0x0f86('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0f86('0x6')][_0x0f86('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9ac7bf,_0x517e89,_0x4c192f){return new BPromise(function(_0x519243,_0x5da759){return client[_0x0f86('0x8')](_0x9ac7bf,_0x4c192f)[_0x0f86('0x9')](function(_0x2de77d){logger['info']('Trigger,\x20%s,\x20%s',_0x517e89,_0x0f86('0xa'));logger[_0x0f86('0xb')](_0x0f86('0xc'),_0x517e89,_0x0f86('0xa'),JSON[_0x0f86('0xd')](_0x2de77d));if(_0x2de77d['error']){if(_0x2de77d[_0x0f86('0xe')]['code']===0x1f4){logger['error'](_0x0f86('0xf'),_0x517e89,_0x2de77d['error']['message']);return _0x5da759(_0x2de77d[_0x0f86('0xe')][_0x0f86('0x10')]);}logger[_0x0f86('0xe')](_0x0f86('0xf'),_0x517e89,_0x2de77d[_0x0f86('0xe')]['message']);return _0x519243(_0x2de77d[_0x0f86('0xe')][_0x0f86('0x10')]);}else{logger[_0x0f86('0x11')](_0x0f86('0xf'),_0x517e89,_0x0f86('0xa'));_0x519243(_0x2de77d[_0x0f86('0x12')][_0x0f86('0x10')]);}})[_0x0f86('0x13')](function(_0x232b37){logger[_0x0f86('0xe')](_0x0f86('0xf'),_0x517e89,_0x232b37);_0x5da759(_0x232b37);});});}exports[_0x0f86('0x14')]=function(_0x28a138){var _0xf6e64d=this;return new Promise(function(_0xad03db,_0x55e285){return db['Trigger'][_0x0f86('0x15')]({'raw':_0x28a138[_0x0f86('0x16')]?_0x28a138[_0x0f86('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x28a138[_0x0f86('0x16')]?_0x28a138['options'][_0x0f86('0x17')]||null:null,'attributes':_0x28a138[_0x0f86('0x16')]?_0x28a138[_0x0f86('0x16')][_0x0f86('0x18')]||null:null,'limit':_0x28a138[_0x0f86('0x16')]?_0x28a138[_0x0f86('0x16')][_0x0f86('0x19')]||null:null,'include':_0x28a138[_0x0f86('0x16')]?_0x28a138['options'][_0x0f86('0x1a')]?_['map'](_0x28a138[_0x0f86('0x16')][_0x0f86('0x1a')],function(_0x1fd01d){return{'model':db[_0x1fd01d[_0x0f86('0x1b')]],'as':_0x1fd01d['as'],'attributes':_0x1fd01d['attributes'],'include':_0x1fd01d[_0x0f86('0x1a')]?_['map'](_0x1fd01d[_0x0f86('0x1a')],function(_0x159446){return{'model':db[_0x159446['model']],'as':_0x159446['as'],'attributes':_0x159446[_0x0f86('0x18')],'include':_0x159446['include']?_[_0x0f86('0x1c')](_0x159446['include'],function(_0x527aa1){return{'model':db[_0x527aa1['model']],'as':_0x527aa1['as'],'attributes':_0x527aa1[_0x0f86('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5be915){logger[_0x0f86('0x11')](_0x0f86('0x14'),_0x28a138);logger['debug']('GetTrigger',_0x28a138,JSON[_0x0f86('0xd')](_0x5be915));_0xad03db(_0x5be915);})['catch'](function(_0x34f8bc){logger[_0x0f86('0xe')](_0x0f86('0x14'),_0x34f8bc[_0x0f86('0x10')],_0x28a138);_0x55e285(_0xf6e64d[_0x0f86('0xe')](0x1f4,_0x34f8bc[_0x0f86('0x10')]));});});};exports[_0x0f86('0x1d')]=function(_0x51f07e){var _0xb4dc15=this;return new Promise(function(_0x2ec255,_0x5eb0f7){return db['Trigger']['find']({'raw':_0x51f07e[_0x0f86('0x16')]?_0x51f07e['options'][_0x0f86('0x1e')]===undefined?!![]:![]:!![],'where':_0x51f07e[_0x0f86('0x16')]?_0x51f07e[_0x0f86('0x16')][_0x0f86('0x17')]||null:null,'attributes':_0x51f07e[_0x0f86('0x16')]?_0x51f07e[_0x0f86('0x16')][_0x0f86('0x18')]||null:null,'include':_0x51f07e[_0x0f86('0x16')]?_0x51f07e[_0x0f86('0x16')]['include']?_[_0x0f86('0x1c')](_0x51f07e[_0x0f86('0x16')][_0x0f86('0x1a')],function(_0x4b0da1){return{'model':db[_0x4b0da1[_0x0f86('0x1b')]],'as':_0x4b0da1['as'],'attributes':_0x4b0da1[_0x0f86('0x18')],'include':_0x4b0da1['include']?_[_0x0f86('0x1c')](_0x4b0da1['include'],function(_0x578ec4){return{'model':db[_0x578ec4['model']],'as':_0x578ec4['as'],'attributes':_0x578ec4[_0x0f86('0x18')],'include':_0x578ec4['include']?_[_0x0f86('0x1c')](_0x578ec4[_0x0f86('0x1a')],function(_0x175aed){return{'model':db[_0x175aed[_0x0f86('0x1b')]],'as':_0x175aed['as'],'attributes':_0x175aed[_0x0f86('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a8ce7){logger[_0x0f86('0x11')](_0x0f86('0x1d'),_0x51f07e);logger[_0x0f86('0xb')]('ShowTrigger',_0x51f07e,JSON[_0x0f86('0xd')](_0x3a8ce7));_0x2ec255(_0x3a8ce7);})[_0x0f86('0x13')](function(_0x59bea6){logger[_0x0f86('0xe')](_0x0f86('0x1d'),_0x59bea6[_0x0f86('0x10')],_0x51f07e);_0x5eb0f7(_0xb4dc15['error'](0x1f4,_0x59bea6['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index edd5704..8ed3610 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 _0xd634=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','index','get','post','/:id/clone','isAuthenticated','clone','create','put','/:id','update','destroy','util','path','express'];(function(_0x49a811,_0x190495){var _0xd8ff9d=function(_0x3def3e){while(--_0x3def3e){_0x49a811['push'](_0x49a811['shift']());}};_0xd8ff9d(++_0x190495);}(_0xd634,0x107));var _0x4d63=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xd634[_0x269ee8];return _0x4d98bd;};'use strict';var multer=require('multer');var util=require(_0x4d63('0x0'));var path=require(_0x4d63('0x1'));var express=require(_0x4d63('0x2'));var router=express[_0x4d63('0x3')]();var auth=require(_0x4d63('0x4'));var interaction=require(_0x4d63('0x5'));var config=require(_0x4d63('0x6'));var controller=require(_0x4d63('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4d63('0x8')]);router[_0x4d63('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4d63('0xa')](_0x4d63('0xb'),auth[_0x4d63('0xc')](),controller[_0x4d63('0xd')]);router[_0x4d63('0xa')]('/',auth[_0x4d63('0xc')](),controller[_0x4d63('0xe')]);router[_0x4d63('0xf')](_0x4d63('0x10'),auth[_0x4d63('0xc')](),controller[_0x4d63('0x11')]);router['delete']('/:id',auth[_0x4d63('0xc')](),controller[_0x4d63('0x12')]);module['exports']=router; \ No newline at end of file +var _0x043c=['Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','get','/:id','show','/:id/clone','clone','post','update','delete','destroy','multer','util','path','express'];(function(_0x4f57e4,_0x18914d){var _0x4a584c=function(_0x312dcb){while(--_0x312dcb){_0x4f57e4['push'](_0x4f57e4['shift']());}};_0x4a584c(++_0x18914d);}(_0x043c,0x1c4));var _0xc043=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0x043c[_0x308374];return _0x1f71e0;};'use strict';var multer=require(_0xc043('0x0'));var util=require(_0xc043('0x1'));var path=require(_0xc043('0x2'));var express=require(_0xc043('0x3'));var router=express[_0xc043('0x4')]();var auth=require(_0xc043('0x5'));var interaction=require(_0xc043('0x6'));var config=require('../../config/environment');var controller=require(_0xc043('0x7'));router['get']('/',auth[_0xc043('0x8')](),controller[_0xc043('0x9')]);router[_0xc043('0xa')](_0xc043('0xb'),auth[_0xc043('0x8')](),controller[_0xc043('0xc')]);router['post'](_0xc043('0xd'),auth[_0xc043('0x8')](),controller[_0xc043('0xe')]);router[_0xc043('0xf')]('/',auth[_0xc043('0x8')](),controller['create']);router['put'](_0xc043('0xb'),auth[_0xc043('0x8')](),controller[_0xc043('0x10')]);router[_0xc043('0x11')](_0xc043('0xb'),auth[_0xc043('0x8')](),controller[_0xc043('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 533927f..9efc6b0 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 _0x0b0e=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','insecure','yes','never','\x22\x22\x20<>','INTEGER','always','accept','originate','uac','uas','pai','fingerprint','active','passive','dynamic','BOOLEAN','sequelize','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0x0b0e,0x187));var _0xe0b0=function(_0x14f7fe,_0x5132c4){_0x14f7fe=_0x14f7fe-0x0;var _0x3d8309=_0x0b0e[_0x14f7fe];return _0x3d8309;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5')),'allowNull':![],'defaultValue':_0xe0b0('0x3')},'context':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![],'defaultValue':_0xe0b0('0x6')},'callingpres':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'))},'deny':{'type':Sequelize[_0xe0b0('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xe0b0('0x1')]},'md5secret':{'type':Sequelize[_0xe0b0('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':_0xe0b0('0xd'),'set':function(_0x574d96){this[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x574d96?_0x574d96[_0xe0b0('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xe0b0('0xf'))?this[_0xe0b0('0x11')](_0xe0b0('0xf'))[_0xe0b0('0x12')](','):null;},'comment':_0xe0b0('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xe0b0('0x14'),_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),_0xe0b0('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xe0b0('0x2')]('yes','no',_0xe0b0('0x19'),_0xe0b0('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe0b0('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe0b0('0x1')]},'directmediadeny':{'type':Sequelize[_0xe0b0('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x46bb44){this['setDataValue']('nat',_0x46bb44?_0x46bb44['join'](','):null);},'get':function(){return this[_0xe0b0('0x11')]('nat')?this['getDataValue'](_0xe0b0('0x1b'))['split'](','):null;},'comment':_0xe0b0('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xe0b0('0x1')]},'pickupgroup':{'type':Sequelize[_0xe0b0('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xe0b0('0x1')]},'language':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x12b260){this[_0xe0b0('0xe')]('allow',_0x12b260?_0x12b260[_0xe0b0('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe0b0('0x11')]('allow')?this[_0xe0b0('0x11')]('allow')[_0xe0b0('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xe0b0('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':'port,invite','set':function(_0x362aba){this[_0xe0b0('0xe')](_0xe0b0('0x1d'),_0x362aba?_0x362aba[_0xe0b0('0x10')](','):null);},'get':function(){return this[_0xe0b0('0x11')](_0xe0b0('0x1d'))?this['getDataValue'](_0xe0b0('0x1d'))[_0xe0b0('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no',_0xe0b0('0x1f'))},'promiscredir':{'type':Sequelize['ENUM'](_0xe0b0('0x1e'),'no')},'useclientcode':{'type':Sequelize[_0xe0b0('0x2')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xe0b0('0x1')]},'callerid':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':_0xe0b0('0x20')},'amaflags':{'type':Sequelize[_0xe0b0('0x1')]},'callcounter':{'type':Sequelize[_0xe0b0('0x2')]('yes','no'),'defaultValue':_0xe0b0('0x1e')},'busylevel':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'allowsubscribe':{'type':Sequelize[_0xe0b0('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'subscribecontext':{'type':Sequelize[_0xe0b0('0x1')]},'template':{'type':Sequelize[_0xe0b0('0x1')]},'videosupport':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no',_0xe0b0('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'mailbox':{'type':Sequelize[_0xe0b0('0x1')]},'session_timers':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x23'),'refuse',_0xe0b0('0x24'))},'session_expires':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'session_minse':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x25'),_0xe0b0('0x26')),'defaultValue':_0xe0b0('0x26')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe0b0('0x21')](0x5)},'qualify':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'defaultip':{'type':Sequelize[_0xe0b0('0x1')]},'defaultuser':{'type':Sequelize[_0xe0b0('0x1')]},'rtptimeout':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no',_0xe0b0('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe0b0('0x1')]},'callbackextension':{'type':Sequelize[_0xe0b0('0x1')]},'timert1':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'timerb':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xe0b0('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xe0b0('0x1')]},'use_q850_reason':{'type':Sequelize[_0xe0b0('0x1')]},'maxforwards':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'encryption':{'type':Sequelize[_0xe0b0('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'force_avp':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'icesupport':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'dtlsenable':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xe0b0('0x1e'),'no',_0xe0b0('0x28'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xe0b0('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xe0b0('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xe0b0('0x1')]},'dtlscapath':{'type':Sequelize[_0xe0b0('0x1')]},'dtlssetup':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x29'),_0xe0b0('0x2a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xe0b0('0x1e'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe0b0('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xe0b0('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'subscribemwi':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xe0b0('0x1')]},'parkinglot':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize[_0xe0b0('0x1')]},'host':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':_0xe0b0('0x2b')},'canreinvite':{'type':Sequelize['ENUM'](_0xe0b0('0x1e'),'no',_0xe0b0('0x19'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xe0b0('0x1')]},'active':{'type':Sequelize[_0xe0b0('0x2c')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x757a=['always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','user','peer','friend','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','join','getDataValue','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>'];(function(_0x365988,_0x5ad630){var _0x518bba=function(_0x2cbe72){while(--_0x2cbe72){_0x365988['push'](_0x365988['shift']());}};_0x518bba(++_0x5ad630);}(_0x757a,0xde));var _0xa757=function(_0x440f9b,_0x5d2df5){_0x440f9b=_0x440f9b-0x0;var _0x4bdda7=_0x757a[_0x440f9b];return _0x4bdda7;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xa757('0x2'),_0xa757('0x3')),'allowNull':![],'defaultValue':_0xa757('0x4')},'context':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'defaultValue':_0xa757('0x5')},'callingpres':{'type':Sequelize[_0xa757('0x6')]('ALLOWED_NOT_SCREENED',_0xa757('0x7'),_0xa757('0x8'),'ALLOWED',_0xa757('0x9'),_0xa757('0xa'),_0xa757('0xb'),_0xa757('0xc'))},'deny':{'type':Sequelize[_0xa757('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xa757('0x1')]},'md5secret':{'type':Sequelize[_0xa757('0x1')]},'remotesecret':{'type':Sequelize[_0xa757('0x1')]},'transport':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0xd'),'set':function(_0x188ad5){this[_0xa757('0xe')]('transport',_0x188ad5?_0x188ad5['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0xa757('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa757('0x6')]('rfc2833','info',_0xa757('0x10'),_0xa757('0x11'),_0xa757('0x12')),'defaultValue':_0xa757('0x13')},'directmedia':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x15'),_0xa757('0x16'),_0xa757('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa757('0x6')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa757('0x1')]},'directmediadeny':{'type':Sequelize[_0xa757('0x1')]},'nat':{'type':Sequelize[_0xa757('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x54b305){this[_0xa757('0xe')](_0xa757('0x18'),_0x54b305?_0x54b305[_0xa757('0x19')](','):null);},'get':function(){return this[_0xa757('0x1a')](_0xa757('0x18'))?this[_0xa757('0x1a')]('nat')[_0xa757('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xa757('0x1')]},'namedcallgroup':{'type':Sequelize[_0xa757('0x1')]},'pickupgroup':{'type':Sequelize[_0xa757('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xa757('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x1c')},'allow':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'defaultValue':_0xa757('0x1d'),'set':function(_0x1d6e2){this[_0xa757('0xe')](_0xa757('0x1e'),_0x1d6e2?_0x1d6e2[_0xa757('0x19')](';'):_0xa757('0x1d'));},'get':function(){return this['getDataValue'](_0xa757('0x1e'))?this['getDataValue'](_0xa757('0x1e'))['split'](';'):null;},'comment':_0xa757('0x1f')},'autoframing':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xa757('0x20'),'set':function(_0xcd98bd){this[_0xa757('0xe')](_0xa757('0x21'),_0xcd98bd?_0xcd98bd['join'](','):null);},'get':function(){return this[_0xa757('0x1a')]('insecure')?this['getDataValue']('insecure')['split'](','):null;},'comment':_0xa757('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa757('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa757('0x6')]('yes','no',_0xa757('0x23'))},'promiscredir':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'useclientcode':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0xa757('0x24')](0xb)},'setvar':{'type':Sequelize[_0xa757('0x1')]},'callerid':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x25')},'amaflags':{'type':Sequelize[_0xa757('0x1')]},'callcounter':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':_0xa757('0x14')},'busylevel':{'type':Sequelize[_0xa757('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0xa757('0x1')]},'template':{'type':Sequelize[_0xa757('0x1')]},'videosupport':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa757('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0xa757('0x1')]},'session_timers':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x27'),_0xa757('0x28'),_0xa757('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xa757('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x2a'),_0xa757('0x2b')),'defaultValue':_0xa757('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xa757('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xa757('0x1')]},'fromuser':{'type':Sequelize[_0xa757('0x1')]},'port':{'type':Sequelize[_0xa757('0x24')](0x5)},'qualify':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':_0xa757('0x14')},'keepalive':{'type':Sequelize[_0xa757('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xa757('0x1')]},'defaultuser':{'type':Sequelize[_0xa757('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa757('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa757('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa757('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xa757('0x24')](0xb)},'timerb':{'type':Sequelize[_0xa757('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xa757('0x1')]},'contactacl':{'type':Sequelize[_0xa757('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xa757('0x24')](0xb)},'encryption':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'force_avp':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'icesupport':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xa757('0x2d'),_0xa757('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xa757('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa757('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xa757('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xa757('0x1')]},'dtlssetup':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x2f'),_0xa757('0x30'),_0xa757('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa757('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa757('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa757('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'vmexten':{'type':Sequelize[_0xa757('0x1')]},'mohinterpret':{'type':Sequelize[_0xa757('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xa757('0x1')]},'description':{'type':Sequelize[_0xa757('0x1')]},'host':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no',_0xa757('0x15'),_0xa757('0x16'),_0xa757('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xa757('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 82676fc..cf74a6b 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 _0x5012=['params','length','options','find','get','omit','createdAt','updatedAt','body','create','findAll','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/environment','../../mysqldb','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','index','Trunk','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','add','day','merge','where','map','filter','includeAll','include','rows'];(function(_0x44c30b,_0x184f2c){var _0x4a8178=function(_0x2698f9){while(--_0x2698f9){_0x44c30b['push'](_0x44c30b['shift']());}};_0x4a8178(++_0x184f2c);}(_0x5012,0x73));var _0x2501=function(_0x4af710,_0x569a47){_0x4af710=_0x4af710-0x0;var _0x472d7d=_0x5012[_0x4af710];return _0x472d7d;};'use strict';var jsonpatch=require(_0x2501('0x0'));var rp=require(_0x2501('0x1'));var moment=require(_0x2501('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2501('0x3'));var util=require(_0x2501('0x4'));var path=require(_0x2501('0x5'));var sox=require(_0x2501('0x6'));var csv=require('to-csv');var ejs=require(_0x2501('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2501('0x8'));var crypto=require(_0x2501('0x9'));var jsforce=require(_0x2501('0xa'));var deskjs=require(_0x2501('0xb'));var toCsv=require(_0x2501('0xc'));var querystring=require(_0x2501('0xd'));var Papa=require(_0x2501('0xe'));var qs=require(_0x2501('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2501('0x10'));var db=require(_0x2501('0x11'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2501('0x12')][_0x2501('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1bc848,_0x51df94,_0x58ef26,_0x5d05c7){return new BPromise(function(_0xe4654c,_0x238d38){var _0x38ad2a=_0x5d05c7||client;return _0x38ad2a[_0x2501('0x14')](_0x1bc848,_0x58ef26)['then'](function(_0x49f731){logger[_0x2501('0x15')](_0x2501('0x16'),_0x51df94,_0x2501('0x17'));logger['debug'](_0x2501('0x18'),_0x51df94,_0x2501('0x17'),JSON['stringify'](_0x49f731));if(_0x49f731['error']){if(_0x49f731['error']['code']===0x1f4){logger[_0x2501('0x19')](_0x2501('0x16'),_0x51df94,_0x49f731[_0x2501('0x19')][_0x2501('0x1a')]);return _0x238d38(_0x49f731['error'][_0x2501('0x1a')]);}logger[_0x2501('0x19')](_0x2501('0x16'),_0x51df94,_0x49f731['error']['message']);return _0xe4654c(_0x49f731['error']['message']);}else{logger[_0x2501('0x15')]('Trunk,\x20%s,\x20%s',_0x51df94,'request\x20sent');_0xe4654c(_0x49f731[_0x2501('0x1b')][_0x2501('0x1a')]);}})[_0x2501('0x1c')](function(_0x3ac33c){logger[_0x2501('0x19')](_0x2501('0x16'),_0x51df94,_0x3ac33c);_0x238d38(_0x3ac33c);});});}function respondWithStatusCode(_0xaf54d8,_0x12974b){_0x12974b=_0x12974b||0xcc;return function(_0x56b855){if(_0x56b855){return _0xaf54d8[_0x2501('0x1d')](_0x12974b);}return _0xaf54d8[_0x2501('0x1e')](_0x12974b)[_0x2501('0x1f')]();};}function respondWithResult(_0x4c14d1,_0x54ee78){_0x54ee78=_0x54ee78||0xc8;return function(_0x444476){if(_0x444476){return _0x4c14d1[_0x2501('0x1e')](_0x54ee78)[_0x2501('0x20')](_0x444476);}};}function respondWithFilteredResult(_0x40c41f,_0x2810d8){return function(_0x4e2cac){if(_0x4e2cac){var _0x5204e8=_0x4e2cac[_0x2501('0x21')],_0xce850=_0x2810d8['offset'],_0x5c8189=_0x2810d8[_0x2501('0x22')]+_0x2810d8[_0x2501('0x23')],_0x1d60fe;if(_0x5c8189>=_0x5204e8){_0x5c8189=_0x5204e8;_0x1d60fe=0xc8;}else{_0x1d60fe=0xce;}_0x40c41f[_0x2501('0x1e')](_0x1d60fe);return _0x40c41f[_0x2501('0x24')](_0x2501('0x25'),_0xce850+'-'+_0x5c8189+'/'+_0x5204e8)['json'](_0x4e2cac);}return null;};}function patchUpdates(_0x3801a4){return function(_0x1dc609){try{jsonpatch[_0x2501('0x26')](_0x1dc609,_0x3801a4,!![]);}catch(_0x1148ec){return BPromise[_0x2501('0x27')](_0x1148ec);}return _0x1dc609[_0x2501('0x28')]();};}function saveUpdates(_0x446ea5,_0x4f8247){return function(_0x1798e9){if(_0x1798e9){return _0x1798e9['update'](_0x446ea5)[_0x2501('0x29')](function(_0x4294a3){return _0x4294a3;});}return null;};}function removeEntity(_0x63de1,_0x21c42b){return function(_0x561ca5){if(_0x561ca5){return _0x561ca5[_0x2501('0x2a')]()[_0x2501('0x29')](function(){_0x63de1[_0x2501('0x1e')](0xcc)[_0x2501('0x1f')]();});}};}function handleEntityNotFound(_0x3e821a,_0xa2e8a){return function(_0x53a7aa){if(!_0x53a7aa){_0x3e821a[_0x2501('0x1d')](0x194);}return _0x53a7aa;};}function handleError(_0xf06dff,_0x2b3465){_0x2b3465=_0x2b3465||0x1f4;return function(_0x3d6dc3){logger[_0x2501('0x19')](_0x3d6dc3['stack']);if(_0x3d6dc3[_0x2501('0x2b')]){delete _0x3d6dc3[_0x2501('0x2b')];}_0xf06dff['status'](_0x2b3465)[_0x2501('0x2c')](_0x3d6dc3);};}exports[_0x2501('0x2d')]=function(_0x42476c,_0x679662){var _0x2982a5={},_0x2a507b={},_0x1287c8={'count':0x0,'rows':[]};var _0x26582d=db[_0x2501('0x2e')][_0x2501('0x2f')];_0x2a507b['model']=_['keys'](_0x26582d);var _0x198932={'dateStart':_0x42476c[_0x2501('0x30')][_0x2501('0x31')],'dateEnd':_0x42476c[_0x2501('0x30')][_0x2501('0x32')]};delete _0x42476c['query']['dateStart'];delete _0x42476c[_0x2501('0x30')][_0x2501('0x32')];_0x2a507b['query']=_[_0x2501('0x33')](_0x42476c['query']);_0x2a507b[_0x2501('0x34')]=_[_0x2501('0x35')](_0x2a507b[_0x2501('0x36')],_0x2a507b[_0x2501('0x30')]);_0x2982a5[_0x2501('0x37')]=_[_0x2501('0x35')](_0x2a507b[_0x2501('0x36')],qs[_0x2501('0x38')](_0x42476c[_0x2501('0x30')][_0x2501('0x38')]));_0x2982a5[_0x2501('0x37')]=_0x2982a5[_0x2501('0x37')]['length']?_0x2982a5[_0x2501('0x37')]:_0x2a507b[_0x2501('0x36')];if(!_0x42476c['query'][_0x2501('0x39')]('nolimit')){_0x2982a5[_0x2501('0x23')]=qs[_0x2501('0x23')](_0x42476c['query'][_0x2501('0x23')]);_0x2982a5[_0x2501('0x22')]=qs[_0x2501('0x22')](_0x42476c[_0x2501('0x30')][_0x2501('0x22')]);}_0x2982a5[_0x2501('0x3a')]=qs[_0x2501('0x3b')](_0x42476c[_0x2501('0x30')][_0x2501('0x3b')]);_0x2982a5['where']=qs[_0x2501('0x34')](_['pick'](_0x42476c['query'],_0x2a507b[_0x2501('0x34')]));if(_0x198932[_0x2501('0x31')]){if(_0x198932['dateEnd']){_0x198932['dateEnd']=moment(_0x198932['dateEnd'])[_0x2501('0x3c')](0x1,_0x2501('0x3d'));}else{_0x198932[_0x2501('0x32')]=moment(_0x198932['dateStart'])[_0x2501('0x3c')](0x1,'day');}_[_0x2501('0x3e')](_0x2982a5[_0x2501('0x3f')],{'createdAt':{'$gte':_0x198932[_0x2501('0x31')],'$lte':_0x198932[_0x2501('0x32')]}});}if(_0x42476c[_0x2501('0x30')]['filter']){_0x2982a5[_0x2501('0x3f')]=_[_0x2501('0x3e')](_0x2982a5[_0x2501('0x3f')],{'$or':_[_0x2501('0x40')](_0x2982a5['attributes'],function(_0x5f5c4d){var _0x22d177={};_0x22d177[_0x5f5c4d]={'$like':'%'+_0x42476c[_0x2501('0x30')][_0x2501('0x41')]+'%'};return _0x22d177;})});}_0x2982a5=_[_0x2501('0x3e')]({},_0x2982a5,_0x42476c['options']);var _0x1bbeb1={'where':_0x2982a5[_0x2501('0x3f')]};return db[_0x2501('0x2e')][_0x2501('0x21')](_0x1bbeb1)[_0x2501('0x29')](function(_0x259f7a){_0x1287c8[_0x2501('0x21')]=_0x259f7a;if(_0x42476c['query'][_0x2501('0x42')]){_0x2982a5[_0x2501('0x43')]=[{'all':!![]}];}return db[_0x2501('0x2e')]['findAll'](_0x2982a5);})[_0x2501('0x29')](function(_0x1f8fc9){_0x1287c8[_0x2501('0x44')]=_0x1f8fc9;return _0x1287c8;})['then'](respondWithFilteredResult(_0x679662,_0x2982a5))[_0x2501('0x1c')](handleError(_0x679662,null));};exports['show']=function(_0x3ba02b,_0x3d3454){var _0x539fce={'raw':![],'where':{'id':_0x3ba02b[_0x2501('0x45')]['id']}},_0x4dfafe={};_0x4dfafe[_0x2501('0x36')]=_[_0x2501('0x33')](db[_0x2501('0x2e')][_0x2501('0x2f')]);_0x4dfafe[_0x2501('0x30')]=_[_0x2501('0x33')](_0x3ba02b[_0x2501('0x30')]);_0x4dfafe[_0x2501('0x34')]=_[_0x2501('0x35')](_0x4dfafe[_0x2501('0x36')],_0x4dfafe[_0x2501('0x30')]);_0x539fce[_0x2501('0x37')]=_[_0x2501('0x35')](_0x4dfafe[_0x2501('0x36')],qs['fields'](_0x3ba02b[_0x2501('0x30')][_0x2501('0x38')]));_0x539fce[_0x2501('0x37')]=_0x539fce[_0x2501('0x37')][_0x2501('0x46')]?_0x539fce[_0x2501('0x37')]:_0x4dfafe[_0x2501('0x36')];if(_0x3ba02b['query'][_0x2501('0x42')]){_0x539fce[_0x2501('0x43')]=[{'all':!![]}];}_0x539fce=_[_0x2501('0x3e')]({},_0x539fce,_0x3ba02b[_0x2501('0x47')]);return db[_0x2501('0x2e')][_0x2501('0x48')](_0x539fce)[_0x2501('0x29')](handleEntityNotFound(_0x3d3454,null))[_0x2501('0x29')](respondWithResult(_0x3d3454,null))['catch'](handleError(_0x3d3454,null));};exports['clone']=function(_0x5ae95a,_0x3bb94d){var _0xc0d7da={'raw':![],'where':{'id':_0x5ae95a[_0x2501('0x45')]['id']}},_0x834e0b={};_0x834e0b['model']=_[_0x2501('0x33')](db[_0x2501('0x2e')][_0x2501('0x2f')]);_0xc0d7da[_0x2501('0x37')]=_[_0x2501('0x35')](_0x834e0b[_0x2501('0x36')],qs[_0x2501('0x38')](_0x5ae95a[_0x2501('0x30')][_0x2501('0x38')]));_0xc0d7da[_0x2501('0x37')]=_0xc0d7da['attributes'][_0x2501('0x46')]?_0xc0d7da[_0x2501('0x37')]:_0x834e0b['model'];if(_0x5ae95a['query'][_0x2501('0x42')]){_0xc0d7da['include']=[{'all':!![]}];}_0xc0d7da=_['merge']({},_0xc0d7da,_0x5ae95a['options']);return db['Trunk'][_0x2501('0x48')](_0xc0d7da)[_0x2501('0x29')](handleEntityNotFound(_0x3bb94d,null))['then'](function(_0x583a9c){if(_0x583a9c){var _0x358442=_0x583a9c[_0x2501('0x49')]({'plain':!![]});_0x358442=qs[_0x2501('0x4a')](_0x358442,['id',_0x2501('0x4b'),_0x2501('0x4c')]);_0x5ae95a[_0x2501('0x4d')]=_[_0x2501('0x4a')](_0x5ae95a[_0x2501('0x4d')],['id',_0x2501('0x4b'),_0x2501('0x4c')]);return db[_0x2501('0x2e')][_0x2501('0x4e')](_[_0x2501('0x3e')](_0x358442,_0x5ae95a['body']),{'include':_0x5ae95a[_0x2501('0x30')][_0x2501('0x42')]?[{'all':!![]}]:undefined});}})[_0x2501('0x29')](respondWithResult(_0x3bb94d,0xc9))[_0x2501('0x1c')](handleError(_0x3bb94d,null));};exports[_0x2501('0x4e')]=function(_0x380ce1,_0x547b51,_0x387b83){var _0x6efd16;return db[_0x2501('0x2e')][_0x2501('0x4e')](_0x380ce1['body'],{'raw':!![]})[_0x2501('0x29')](function(_0x1ab7c0){_0x6efd16=_0x1ab7c0;return db['Trunk'][_0x2501('0x4f')]({'raw':!![]});})[_0x2501('0x29')](function(_0x17776d){var _0x43b654=fs['readFileSync'](path[_0x2501('0x50')](config[_0x2501('0x51')],_0x2501('0x52')),_0x2501('0x53'));var _0x222d7c=fs[_0x2501('0x54')](path[_0x2501('0x50')](config['root'],_0x2501('0x55')),_0x2501('0x53'));var _0x21bd7f=ejs[_0x2501('0x56')](_0x43b654,{'trunks':_0x17776d||[]});fs[_0x2501('0x57')](_0x2501('0x58'),_0x21bd7f);if(_0x6efd16['registry']){var _0x27637f=ejs[_0x2501('0x56')](_0x222d7c,{'trunks':_0x17776d||[]});fs[_0x2501('0x57')]('/etc/asterisk/sip_xcally_registers.conf',_0x27637f);}})['then'](function(){return respondWithRpcPromise(_0x2501('0x59'),'create',{'module':'chan_sip.so'});})[_0x2501('0x29')](function(){return _0x6efd16;})[_0x2501('0x29')](respondWithResult(_0x547b51,0xc9))[_0x2501('0x1c')](handleError(_0x547b51,null));};exports['update']=function(_0x55d044,_0x121526,_0xce8386){var _0x15ea40;return db[_0x2501('0x2e')]['find']({'where':{'id':_0x55d044[_0x2501('0x45')]['id']}})[_0x2501('0x29')](handleEntityNotFound(_0x121526,null))[_0x2501('0x29')](saveUpdates(_0x55d044[_0x2501('0x4d')],null))[_0x2501('0x29')](function(_0x45f103){if(_0x45f103){_0x15ea40=_0x45f103;return db['Trunk'][_0x2501('0x4f')]({'raw':!![]});}})[_0x2501('0x29')](function(_0x3b8736){if(_0x3b8736){var _0x5e1169=fs[_0x2501('0x54')](path[_0x2501('0x50')](config[_0x2501('0x51')],'server/files/templates/trunk.ejs'),_0x2501('0x53'));var _0x4276a0=fs['readFileSync'](path[_0x2501('0x50')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x20ffe2=ejs[_0x2501('0x56')](_0x5e1169,{'trunks':_0x3b8736||[]});fs[_0x2501('0x57')](_0x2501('0x58'),_0x20ffe2);var _0x3e3ef0=ejs[_0x2501('0x56')](_0x4276a0,{'trunks':_0x3b8736||[]});fs[_0x2501('0x57')](_0x2501('0x5a'),_0x3e3ef0);return respondWithRpcPromise(_0x2501('0x59'),'update',{'module':_0x2501('0x5b')});}return null;})[_0x2501('0x29')](function(_0x594d44){if(_0x594d44){return _0x15ea40;}})[_0x2501('0x29')](respondWithResult(_0x121526,null))[_0x2501('0x1c')](handleError(_0x121526,null));};exports[_0x2501('0x2a')]=function(_0x4a0532,_0x5ac773,_0x5206fe){var _0x7c1352;return db[_0x2501('0x2e')][_0x2501('0x48')]({'where':{'id':_0x4a0532[_0x2501('0x45')]['id']}})[_0x2501('0x29')](handleEntityNotFound(_0x5ac773,null))[_0x2501('0x29')](removeEntity(_0x5ac773,null))[_0x2501('0x29')](function(){return db[_0x2501('0x2e')][_0x2501('0x4f')]({'raw':!![]});})[_0x2501('0x29')](function(_0x20a241){var _0x33df20=fs[_0x2501('0x54')](path[_0x2501('0x50')](config[_0x2501('0x51')],_0x2501('0x52')),_0x2501('0x53'));var _0x2eff7a=fs['readFileSync'](path['join'](config[_0x2501('0x51')],_0x2501('0x55')),_0x2501('0x53'));var _0x12c265=ejs[_0x2501('0x56')](_0x33df20,{'trunks':_0x20a241});var _0x3d2d4f=ejs[_0x2501('0x56')](_0x2eff7a,{'trunks':_0x20a241});fs[_0x2501('0x57')](_0x2501('0x58'),_0x12c265);fs[_0x2501('0x57')](_0x2501('0x5a'),_0x3d2d4f);return respondWithRpcPromise(_0x2501('0x59'),_0x2501('0x2a'),{'module':'chan_sip.so'});})[_0x2501('0x1c')](handleError(_0x5ac773,null));}; \ No newline at end of file +var _0xd719=['omit','body','createdAt','updatedAt','create','readFileSync','join','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','params','server/files/templates/trunk.ejs','fast-json-patch','request-promise','bluebird','mustache','util','ejs','squel','crypto','to-csv','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','Content-Range','apply','update','destroy','sendStatus','stack','name','send','index','Trunk','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','options','includeAll','findAll','rows','show','include','length','find'];(function(_0xf1f2e0,_0x37c415){var _0x991373=function(_0x5baf7f){while(--_0x5baf7f){_0xf1f2e0['push'](_0xf1f2e0['shift']());}};_0x991373(++_0x37c415);}(_0xd719,0xc5));var _0x9d71=function(_0x18136b,_0x479aaa){_0x18136b=_0x18136b-0x0;var _0x3bc898=_0xd719[_0x18136b];return _0x3bc898;};'use strict';var jsonpatch=require(_0x9d71('0x0'));var rp=require(_0x9d71('0x1'));var moment=require('moment');var BPromise=require(_0x9d71('0x2'));var Mustache=require(_0x9d71('0x3'));var util=require(_0x9d71('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d71('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9d71('0x6'));var crypto=require(_0x9d71('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9d71('0x8'));var querystring=require('querystring');var Papa=require(_0x9d71('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0x9d71('0xa'))(_0x9d71('0xb'));var utils=require('../../config/utils');var config=require(_0x9d71('0xc'));var db=require(_0x9d71('0xd'))['db'];var jayson=require(_0x9d71('0xe'));var client=jayson['client'][_0x9d71('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x45210a,_0x687dc6,_0x3eb03a,_0xd63498){return new BPromise(function(_0x262d72,_0x553d73){var _0x409787=_0xd63498||client;return _0x409787['request'](_0x45210a,_0x3eb03a)[_0x9d71('0x10')](function(_0x32fe6d){logger[_0x9d71('0x11')](_0x9d71('0x12'),_0x687dc6,_0x9d71('0x13'));logger['debug'](_0x9d71('0x14'),_0x687dc6,_0x9d71('0x13'),JSON[_0x9d71('0x15')](_0x32fe6d));if(_0x32fe6d[_0x9d71('0x16')]){if(_0x32fe6d[_0x9d71('0x16')][_0x9d71('0x17')]===0x1f4){logger[_0x9d71('0x16')]('Trunk,\x20%s,\x20%s',_0x687dc6,_0x32fe6d[_0x9d71('0x16')][_0x9d71('0x18')]);return _0x553d73(_0x32fe6d[_0x9d71('0x16')][_0x9d71('0x18')]);}logger[_0x9d71('0x16')](_0x9d71('0x12'),_0x687dc6,_0x32fe6d['error'][_0x9d71('0x18')]);return _0x262d72(_0x32fe6d[_0x9d71('0x16')]['message']);}else{logger[_0x9d71('0x11')](_0x9d71('0x12'),_0x687dc6,_0x9d71('0x13'));_0x262d72(_0x32fe6d['result']['message']);}})[_0x9d71('0x19')](function(_0x552866){logger[_0x9d71('0x16')](_0x9d71('0x12'),_0x687dc6,_0x552866);_0x553d73(_0x552866);});});}function respondWithStatusCode(_0x2c5a2d,_0x5df86c){_0x5df86c=_0x5df86c||0xcc;return function(_0x143dbf){if(_0x143dbf){return _0x2c5a2d['sendStatus'](_0x5df86c);}return _0x2c5a2d[_0x9d71('0x1a')](_0x5df86c)[_0x9d71('0x1b')]();};}function respondWithResult(_0x469e1d,_0x5c9e5f){_0x5c9e5f=_0x5c9e5f||0xc8;return function(_0x5d47af){if(_0x5d47af){return _0x469e1d['status'](_0x5c9e5f)[_0x9d71('0x1c')](_0x5d47af);}};}function respondWithFilteredResult(_0x5965cf,_0x4bbec5){return function(_0x370282){if(_0x370282){var _0x1842de=_0x370282[_0x9d71('0x1d')],_0x336d9a=_0x4bbec5[_0x9d71('0x1e')],_0x49e92d=_0x4bbec5[_0x9d71('0x1e')]+_0x4bbec5[_0x9d71('0x1f')],_0x28a286;if(_0x49e92d>=_0x1842de){_0x49e92d=_0x1842de;_0x28a286=0xc8;}else{_0x28a286=0xce;}_0x5965cf[_0x9d71('0x1a')](_0x28a286);return _0x5965cf['set'](_0x9d71('0x20'),_0x336d9a+'-'+_0x49e92d+'/'+_0x1842de)[_0x9d71('0x1c')](_0x370282);}return null;};}function patchUpdates(_0x3831eb){return function(_0x3584a5){try{jsonpatch[_0x9d71('0x21')](_0x3584a5,_0x3831eb,!![]);}catch(_0x396f5){return BPromise['reject'](_0x396f5);}return _0x3584a5['save']();};}function saveUpdates(_0x5b3152,_0xd652b6){return function(_0x304060){if(_0x304060){return _0x304060[_0x9d71('0x22')](_0x5b3152)[_0x9d71('0x10')](function(_0x152d25){return _0x152d25;});}return null;};}function removeEntity(_0x1d4a03,_0x4a4ec4){return function(_0x183575){if(_0x183575){return _0x183575[_0x9d71('0x23')]()['then'](function(){_0x1d4a03['status'](0xcc)[_0x9d71('0x1b')]();});}};}function handleEntityNotFound(_0x29a71f,_0x2117cc){return function(_0x1b29fd){if(!_0x1b29fd){_0x29a71f[_0x9d71('0x24')](0x194);}return _0x1b29fd;};}function handleError(_0x1997a0,_0x120c65){_0x120c65=_0x120c65||0x1f4;return function(_0x217de0){logger[_0x9d71('0x16')](_0x217de0[_0x9d71('0x25')]);if(_0x217de0[_0x9d71('0x26')]){delete _0x217de0['name'];}_0x1997a0['status'](_0x120c65)[_0x9d71('0x27')](_0x217de0);};}exports[_0x9d71('0x28')]=function(_0x24860a,_0xa94f14){var _0x5a350e={},_0x118ac3={},_0x2c0e32={'count':0x0,'rows':[]};var _0x2eefd2=db[_0x9d71('0x29')][_0x9d71('0x2a')];_0x118ac3['model']=_[_0x9d71('0x2b')](_0x2eefd2);var _0x58b5b6={'dateStart':_0x24860a[_0x9d71('0x2c')]['dateStart'],'dateEnd':_0x24860a[_0x9d71('0x2c')][_0x9d71('0x2d')]};delete _0x24860a[_0x9d71('0x2c')][_0x9d71('0x2e')];delete _0x24860a[_0x9d71('0x2c')][_0x9d71('0x2d')];_0x118ac3['query']=_['keys'](_0x24860a['query']);_0x118ac3[_0x9d71('0x2f')]=_[_0x9d71('0x30')](_0x118ac3['model'],_0x118ac3['query']);_0x5a350e[_0x9d71('0x31')]=_['intersection'](_0x118ac3[_0x9d71('0x32')],qs['fields'](_0x24860a[_0x9d71('0x2c')][_0x9d71('0x33')]));_0x5a350e[_0x9d71('0x31')]=_0x5a350e[_0x9d71('0x31')]['length']?_0x5a350e['attributes']:_0x118ac3['model'];if(!_0x24860a[_0x9d71('0x2c')][_0x9d71('0x34')](_0x9d71('0x35'))){_0x5a350e[_0x9d71('0x1f')]=qs[_0x9d71('0x1f')](_0x24860a[_0x9d71('0x2c')][_0x9d71('0x1f')]);_0x5a350e[_0x9d71('0x1e')]=qs['offset'](_0x24860a['query'][_0x9d71('0x1e')]);}_0x5a350e[_0x9d71('0x36')]=qs['sort'](_0x24860a['query'][_0x9d71('0x37')]);_0x5a350e[_0x9d71('0x38')]=qs[_0x9d71('0x2f')](_[_0x9d71('0x39')](_0x24860a[_0x9d71('0x2c')],_0x118ac3[_0x9d71('0x2f')]));if(_0x58b5b6[_0x9d71('0x2e')]){if(_0x58b5b6[_0x9d71('0x2d')]){_0x58b5b6[_0x9d71('0x2d')]=moment(_0x58b5b6['dateEnd'])[_0x9d71('0x3a')](0x1,_0x9d71('0x3b'));}else{_0x58b5b6[_0x9d71('0x2d')]=moment(_0x58b5b6[_0x9d71('0x2e')])[_0x9d71('0x3a')](0x1,_0x9d71('0x3b'));}_['merge'](_0x5a350e['where'],{'createdAt':{'$gte':_0x58b5b6['dateStart'],'$lte':_0x58b5b6['dateEnd']}});}if(_0x24860a[_0x9d71('0x2c')][_0x9d71('0x3c')]){_0x5a350e[_0x9d71('0x38')]=_[_0x9d71('0x3d')](_0x5a350e['where'],{'$or':_['map'](_0x5a350e['attributes'],function(_0x560727){var _0xa198b9={};_0xa198b9[_0x560727]={'$like':'%'+_0x24860a[_0x9d71('0x2c')][_0x9d71('0x3c')]+'%'};return _0xa198b9;})});}_0x5a350e=_[_0x9d71('0x3d')]({},_0x5a350e,_0x24860a[_0x9d71('0x3e')]);var _0x24f31d={'where':_0x5a350e['where']};return db[_0x9d71('0x29')]['count'](_0x24f31d)[_0x9d71('0x10')](function(_0x42e106){_0x2c0e32[_0x9d71('0x1d')]=_0x42e106;if(_0x24860a[_0x9d71('0x2c')][_0x9d71('0x3f')]){_0x5a350e['include']=[{'all':!![]}];}return db[_0x9d71('0x29')][_0x9d71('0x40')](_0x5a350e);})[_0x9d71('0x10')](function(_0x346ffe){_0x2c0e32[_0x9d71('0x41')]=_0x346ffe;return _0x2c0e32;})[_0x9d71('0x10')](respondWithFilteredResult(_0xa94f14,_0x5a350e))[_0x9d71('0x19')](handleError(_0xa94f14,null));};exports[_0x9d71('0x42')]=function(_0x30ce84,_0x1c61fa){var _0x1b4bf3={'raw':![],'where':{'id':_0x30ce84['params']['id']}},_0x806cc9={};_0x806cc9['model']=_[_0x9d71('0x2b')](db[_0x9d71('0x29')][_0x9d71('0x2a')]);_0x806cc9[_0x9d71('0x2c')]=_[_0x9d71('0x2b')](_0x30ce84[_0x9d71('0x2c')]);_0x806cc9[_0x9d71('0x2f')]=_['intersection'](_0x806cc9[_0x9d71('0x32')],_0x806cc9[_0x9d71('0x2c')]);_0x1b4bf3['attributes']=_[_0x9d71('0x30')](_0x806cc9[_0x9d71('0x32')],qs['fields'](_0x30ce84['query'][_0x9d71('0x33')]));_0x1b4bf3[_0x9d71('0x31')]=_0x1b4bf3[_0x9d71('0x31')]['length']?_0x1b4bf3['attributes']:_0x806cc9[_0x9d71('0x32')];if(_0x30ce84['query']['includeAll']){_0x1b4bf3[_0x9d71('0x43')]=[{'all':!![]}];}_0x1b4bf3=_[_0x9d71('0x3d')]({},_0x1b4bf3,_0x30ce84[_0x9d71('0x3e')]);return db[_0x9d71('0x29')]['find'](_0x1b4bf3)[_0x9d71('0x10')](handleEntityNotFound(_0x1c61fa,null))['then'](respondWithResult(_0x1c61fa,null))[_0x9d71('0x19')](handleError(_0x1c61fa,null));};exports['clone']=function(_0x2058ec,_0x5e1ba5){var _0xaa045f={'raw':![],'where':{'id':_0x2058ec['params']['id']}},_0x5c0dcb={};_0x5c0dcb[_0x9d71('0x32')]=_[_0x9d71('0x2b')](db['Trunk'][_0x9d71('0x2a')]);_0xaa045f[_0x9d71('0x31')]=_[_0x9d71('0x30')](_0x5c0dcb['model'],qs[_0x9d71('0x33')](_0x2058ec[_0x9d71('0x2c')]['fields']));_0xaa045f[_0x9d71('0x31')]=_0xaa045f['attributes'][_0x9d71('0x44')]?_0xaa045f[_0x9d71('0x31')]:_0x5c0dcb['model'];if(_0x2058ec['query'][_0x9d71('0x3f')]){_0xaa045f['include']=[{'all':!![]}];}_0xaa045f=_[_0x9d71('0x3d')]({},_0xaa045f,_0x2058ec[_0x9d71('0x3e')]);return db[_0x9d71('0x29')][_0x9d71('0x45')](_0xaa045f)[_0x9d71('0x10')](handleEntityNotFound(_0x5e1ba5,null))[_0x9d71('0x10')](function(_0x286533){if(_0x286533){var _0x51de98=_0x286533['get']({'plain':!![]});_0x51de98=qs[_0x9d71('0x46')](_0x51de98,['id','createdAt','updatedAt']);_0x2058ec[_0x9d71('0x47')]=_['omit'](_0x2058ec[_0x9d71('0x47')],['id',_0x9d71('0x48'),_0x9d71('0x49')]);return db[_0x9d71('0x29')]['create'](_[_0x9d71('0x3d')](_0x51de98,_0x2058ec['body']),{'include':_0x2058ec[_0x9d71('0x2c')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x9d71('0x10')](respondWithResult(_0x5e1ba5,0xc9))[_0x9d71('0x19')](handleError(_0x5e1ba5,null));};exports['create']=function(_0x25f429,_0x1da371,_0x328279){var _0x3cbe40;return db[_0x9d71('0x29')][_0x9d71('0x4a')](_0x25f429[_0x9d71('0x47')],{'raw':!![]})['then'](function(_0x55785d){_0x3cbe40=_0x55785d;return db[_0x9d71('0x29')][_0x9d71('0x40')]({'raw':!![]});})[_0x9d71('0x10')](function(_0x174e36){var _0x183b97=fs[_0x9d71('0x4b')](path[_0x9d71('0x4c')](config['root'],'server/files/templates/trunk.ejs'),_0x9d71('0x4d'));var _0x365a9c=fs[_0x9d71('0x4b')](path['join'](config[_0x9d71('0x4e')],_0x9d71('0x4f')),'utf8');var _0x46498f=ejs[_0x9d71('0x50')](_0x183b97,{'trunks':_0x174e36||[]});fs[_0x9d71('0x51')](_0x9d71('0x52'),_0x46498f);if(_0x3cbe40[_0x9d71('0x53')]){var _0xd11067=ejs[_0x9d71('0x50')](_0x365a9c,{'trunks':_0x174e36||[]});fs[_0x9d71('0x51')](_0x9d71('0x54'),_0xd11067);}})['then'](function(){return respondWithRpcPromise(_0x9d71('0x55'),_0x9d71('0x4a'),{'module':_0x9d71('0x56')});})[_0x9d71('0x10')](function(){return _0x3cbe40;})[_0x9d71('0x10')](respondWithResult(_0x1da371,0xc9))[_0x9d71('0x19')](handleError(_0x1da371,null));};exports[_0x9d71('0x22')]=function(_0xc5eb73,_0x4d04a9,_0x1af19a){var _0x2336a9;return db[_0x9d71('0x29')][_0x9d71('0x45')]({'where':{'id':_0xc5eb73[_0x9d71('0x57')]['id']}})['then'](handleEntityNotFound(_0x4d04a9,null))[_0x9d71('0x10')](saveUpdates(_0xc5eb73[_0x9d71('0x47')],null))['then'](function(_0x3244ad){if(_0x3244ad){_0x2336a9=_0x3244ad;return db[_0x9d71('0x29')][_0x9d71('0x40')]({'raw':!![]});}})['then'](function(_0x4bf030){if(_0x4bf030){var _0x5e6a0d=fs[_0x9d71('0x4b')](path[_0x9d71('0x4c')](config[_0x9d71('0x4e')],'server/files/templates/trunk.ejs'),_0x9d71('0x4d'));var _0x3f932b=fs[_0x9d71('0x4b')](path[_0x9d71('0x4c')](config[_0x9d71('0x4e')],_0x9d71('0x4f')),_0x9d71('0x4d'));var _0x165627=ejs[_0x9d71('0x50')](_0x5e6a0d,{'trunks':_0x4bf030||[]});fs['writeFileSync'](_0x9d71('0x52'),_0x165627);var _0x47a306=ejs['render'](_0x3f932b,{'trunks':_0x4bf030||[]});fs[_0x9d71('0x51')](_0x9d71('0x54'),_0x47a306);return respondWithRpcPromise(_0x9d71('0x55'),'update',{'module':'chan_sip.so'});}return null;})[_0x9d71('0x10')](function(_0x9153c3){if(_0x9153c3){return _0x2336a9;}})[_0x9d71('0x10')](respondWithResult(_0x4d04a9,null))[_0x9d71('0x19')](handleError(_0x4d04a9,null));};exports[_0x9d71('0x23')]=function(_0x2a355c,_0x509a62,_0x565c8b){var _0x275f44;return db['Trunk']['find']({'where':{'id':_0x2a355c[_0x9d71('0x57')]['id']}})[_0x9d71('0x10')](handleEntityNotFound(_0x509a62,null))[_0x9d71('0x10')](removeEntity(_0x509a62,null))[_0x9d71('0x10')](function(){return db[_0x9d71('0x29')][_0x9d71('0x40')]({'raw':!![]});})[_0x9d71('0x10')](function(_0x1363b7){var _0x14fa53=fs[_0x9d71('0x4b')](path[_0x9d71('0x4c')](config[_0x9d71('0x4e')],_0x9d71('0x58')),_0x9d71('0x4d'));var _0x3282b1=fs[_0x9d71('0x4b')](path['join'](config[_0x9d71('0x4e')],_0x9d71('0x4f')),_0x9d71('0x4d'));var _0x1ecf1f=ejs[_0x9d71('0x50')](_0x14fa53,{'trunks':_0x1363b7});var _0x10bb58=ejs[_0x9d71('0x50')](_0x3282b1,{'trunks':_0x1363b7});fs[_0x9d71('0x51')](_0x9d71('0x52'),_0x1ecf1f);fs[_0x9d71('0x51')](_0x9d71('0x54'),_0x10bb58);return respondWithRpcPromise(_0x9d71('0x55'),_0x9d71('0x23'),{'module':'chan_sip.so'});})[_0x9d71('0x19')](handleError(_0x509a62,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 44878e9..f2370f3 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 _0x1cf8=['moment','bluebird','request-promise','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x1cf8,0x184));var _0x81cf=function(_0x12ceba,_0x59ba15){_0x12ceba=_0x12ceba-0x0;var _0x36c243=_0x1cf8[_0x12ceba];return _0x36c243;};'use strict';var _=require(_0x81cf('0x0'));var util=require(_0x81cf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x81cf('0x2'));var BPromise=require(_0x81cf('0x3'));var rp=require(_0x81cf('0x4'));var attributes=require(_0x81cf('0x5'));module[_0x81cf('0x6')]=function(_0x2cebee,_0x10fd02){return _0x2cebee[_0x81cf('0x7')](_0x81cf('0x8'),attributes,{'tableName':_0x81cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd294=['Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','define'];(function(_0x57c2f6,_0x1ee1bf){var _0x1cbd95=function(_0x295da4){while(--_0x295da4){_0x57c2f6['push'](_0x57c2f6['shift']());}};_0x1cbd95(++_0x1ee1bf);}(_0xd294,0xfc));var _0x4d29=function(_0x5d0901,_0x110cc2){_0x5d0901=_0x5d0901-0x0;var _0xf961f0=_0xd294[_0x5d0901];return _0xf961f0;};'use strict';var _=require(_0x4d29('0x0'));var util=require(_0x4d29('0x1'));var logger=require(_0x4d29('0x2'))(_0x4d29('0x3'));var moment=require(_0x4d29('0x4'));var BPromise=require(_0x4d29('0x5'));var rp=require(_0x4d29('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x4f52d3,_0x2d05be){return _0x4f52d3[_0x4d29('0x7')](_0x4d29('0x8'),attributes,{'tableName':_0x4d29('0x9'),'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 ad23137..daf64d1 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 _0xfb7b=['find','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowTrunk'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xfb7b,0x177));var _0xbfb7=function(_0x28cd37,_0x13b7a3){_0x28cd37=_0x28cd37-0x0;var _0x27d922=_0xfb7b[_0x28cd37];return _0x27d922;};'use strict';var _=require(_0xbfb7('0x0'));var util=require(_0xbfb7('0x1'));var moment=require('moment');var BPromise=require(_0xbfb7('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xbfb7('0x3'))['db'];var utils=require(_0xbfb7('0x4'));var logger=require('../../config/logger')(_0xbfb7('0x5'));var config=require(_0xbfb7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbfb7('0x7')][_0xbfb7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f2ac2,_0x29eb3a,_0x22f875){return new BPromise(function(_0x4dc372,_0x368cc0){return client[_0xbfb7('0x9')](_0x5f2ac2,_0x22f875)[_0xbfb7('0xa')](function(_0xaf8598){logger[_0xbfb7('0xb')](_0xbfb7('0xc'),_0x29eb3a,_0xbfb7('0xd'));logger['debug'](_0xbfb7('0xe'),_0x29eb3a,_0xbfb7('0xd'),JSON[_0xbfb7('0xf')](_0xaf8598));if(_0xaf8598['error']){if(_0xaf8598[_0xbfb7('0x10')][_0xbfb7('0x11')]===0x1f4){logger[_0xbfb7('0x10')]('Trunk,\x20%s,\x20%s',_0x29eb3a,_0xaf8598[_0xbfb7('0x10')][_0xbfb7('0x12')]);return _0x368cc0(_0xaf8598[_0xbfb7('0x10')][_0xbfb7('0x12')]);}logger[_0xbfb7('0x10')]('Trunk,\x20%s,\x20%s',_0x29eb3a,_0xaf8598[_0xbfb7('0x10')][_0xbfb7('0x12')]);return _0x4dc372(_0xaf8598[_0xbfb7('0x10')][_0xbfb7('0x12')]);}else{logger[_0xbfb7('0xb')](_0xbfb7('0xc'),_0x29eb3a,'request\x20sent');_0x4dc372(_0xaf8598['result'][_0xbfb7('0x12')]);}})[_0xbfb7('0x13')](function(_0x4b73f9){logger[_0xbfb7('0x10')](_0xbfb7('0xc'),_0x29eb3a,_0x4b73f9);_0x368cc0(_0x4b73f9);});});}exports[_0xbfb7('0x14')]=function(_0x43b4f3){var _0x17b7c6=this;return new Promise(function(_0xdd5f78,_0x54e955){return db[_0xbfb7('0x15')][_0xbfb7('0x16')]({'raw':_0x43b4f3[_0xbfb7('0x17')]?_0x43b4f3[_0xbfb7('0x17')][_0xbfb7('0x18')]===undefined?!![]:![]:!![],'where':_0x43b4f3['options']?_0x43b4f3['options'][_0xbfb7('0x19')]||null:null,'attributes':_0x43b4f3[_0xbfb7('0x17')]?_0x43b4f3[_0xbfb7('0x17')][_0xbfb7('0x1a')]||null:null,'limit':_0x43b4f3[_0xbfb7('0x17')]?_0x43b4f3[_0xbfb7('0x17')][_0xbfb7('0x1b')]||null:null,'include':_0x43b4f3[_0xbfb7('0x17')]?_0x43b4f3[_0xbfb7('0x17')][_0xbfb7('0x1c')]?_[_0xbfb7('0x1d')](_0x43b4f3[_0xbfb7('0x17')]['include'],function(_0x549463){return{'model':db[_0x549463['model']],'as':_0x549463['as'],'attributes':_0x549463['attributes'],'include':_0x549463[_0xbfb7('0x1c')]?_['map'](_0x549463[_0xbfb7('0x1c')],function(_0x21bac8){return{'model':db[_0x21bac8[_0xbfb7('0x1e')]],'as':_0x21bac8['as'],'attributes':_0x21bac8[_0xbfb7('0x1a')],'include':_0x21bac8[_0xbfb7('0x1c')]?_[_0xbfb7('0x1d')](_0x21bac8[_0xbfb7('0x1c')],function(_0x32197b){return{'model':db[_0x32197b[_0xbfb7('0x1e')]],'as':_0x32197b['as'],'attributes':_0x32197b[_0xbfb7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbfb7('0xa')](function(_0x27bc2a){logger[_0xbfb7('0xb')](_0xbfb7('0x14'),_0x43b4f3);logger[_0xbfb7('0x1f')]('GetTrunk',_0x43b4f3,JSON[_0xbfb7('0xf')](_0x27bc2a));_0xdd5f78(_0x27bc2a);})['catch'](function(_0x27137b){logger[_0xbfb7('0x10')](_0xbfb7('0x14'),_0x27137b[_0xbfb7('0x12')],_0x43b4f3);_0x54e955(_0x17b7c6['error'](0x1f4,_0x27137b[_0xbfb7('0x12')]));});});};exports[_0xbfb7('0x20')]=function(_0x4083cc){var _0x31d6f8=this;return new Promise(function(_0x42069e,_0x4c431b){return db[_0xbfb7('0x15')][_0xbfb7('0x21')]({'raw':_0x4083cc[_0xbfb7('0x17')]?_0x4083cc[_0xbfb7('0x17')][_0xbfb7('0x18')]===undefined?!![]:![]:!![],'where':_0x4083cc[_0xbfb7('0x17')]?_0x4083cc[_0xbfb7('0x17')][_0xbfb7('0x19')]||null:null,'attributes':_0x4083cc[_0xbfb7('0x17')]?_0x4083cc['options'][_0xbfb7('0x1a')]||null:null,'include':_0x4083cc[_0xbfb7('0x17')]?_0x4083cc[_0xbfb7('0x17')][_0xbfb7('0x1c')]?_[_0xbfb7('0x1d')](_0x4083cc['options'][_0xbfb7('0x1c')],function(_0x1e2fe9){return{'model':db[_0x1e2fe9['model']],'as':_0x1e2fe9['as'],'attributes':_0x1e2fe9[_0xbfb7('0x1a')],'include':_0x1e2fe9[_0xbfb7('0x1c')]?_[_0xbfb7('0x1d')](_0x1e2fe9[_0xbfb7('0x1c')],function(_0x31ef68){return{'model':db[_0x31ef68[_0xbfb7('0x1e')]],'as':_0x31ef68['as'],'attributes':_0x31ef68[_0xbfb7('0x1a')],'include':_0x31ef68[_0xbfb7('0x1c')]?_[_0xbfb7('0x1d')](_0x31ef68[_0xbfb7('0x1c')],function(_0x1a4ae9){return{'model':db[_0x1a4ae9['model']],'as':_0x1a4ae9['as'],'attributes':_0x1a4ae9['attributes']};}):[]};}):[]};}):[]:[]})[_0xbfb7('0xa')](function(_0x697a91){logger[_0xbfb7('0xb')](_0xbfb7('0x20'),_0x4083cc);logger['debug'](_0xbfb7('0x20'),_0x4083cc,JSON[_0xbfb7('0xf')](_0x697a91));_0x42069e(_0x697a91);})[_0xbfb7('0x13')](function(_0x3f1d4d){logger[_0xbfb7('0x10')](_0xbfb7('0x20'),_0x3f1d4d[_0xbfb7('0x12')],_0x4083cc);_0x4c431b(_0x31d6f8[_0xbfb7('0x10')](0x1f4,_0x3f1d4d['message']));});});}; \ No newline at end of file +var _0xcabf=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrunk','findAll','options','raw','limit','include','model','map','attributes','ShowTrunk','Trunk','find','where','lodash','moment','bluebird','randomstring','../../config/logger'];(function(_0x481e23,_0x446615){var _0x3dde27=function(_0x283128){while(--_0x283128){_0x481e23['push'](_0x481e23['shift']());}};_0x3dde27(++_0x446615);}(_0xcabf,0x136));var _0xfcab=function(_0x590c4f,_0x5361e8){_0x590c4f=_0x590c4f-0x0;var _0x4e1b84=_0xcabf[_0x590c4f];return _0x4e1b84;};'use strict';var _=require(_0xfcab('0x0'));var util=require('util');var moment=require(_0xfcab('0x1'));var BPromise=require(_0xfcab('0x2'));var rs=require(_0xfcab('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfcab('0x4'))(_0xfcab('0x5'));var config=require(_0xfcab('0x6'));var jayson=require(_0xfcab('0x7'));var client=jayson[_0xfcab('0x8')][_0xfcab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2eee,_0x4d5c43,_0x44210a){return new BPromise(function(_0x3b259b,_0x5db9c3){return client[_0xfcab('0xa')](_0x2b2eee,_0x44210a)[_0xfcab('0xb')](function(_0x143c22){logger[_0xfcab('0xc')](_0xfcab('0xd'),_0x4d5c43,_0xfcab('0xe'));logger[_0xfcab('0xf')](_0xfcab('0x10'),_0x4d5c43,_0xfcab('0xe'),JSON[_0xfcab('0x11')](_0x143c22));if(_0x143c22[_0xfcab('0x12')]){if(_0x143c22[_0xfcab('0x12')]['code']===0x1f4){logger['error'](_0xfcab('0xd'),_0x4d5c43,_0x143c22['error'][_0xfcab('0x13')]);return _0x5db9c3(_0x143c22[_0xfcab('0x12')]['message']);}logger[_0xfcab('0x12')](_0xfcab('0xd'),_0x4d5c43,_0x143c22[_0xfcab('0x12')][_0xfcab('0x13')]);return _0x3b259b(_0x143c22['error'][_0xfcab('0x13')]);}else{logger['info'](_0xfcab('0xd'),_0x4d5c43,_0xfcab('0xe'));_0x3b259b(_0x143c22[_0xfcab('0x14')][_0xfcab('0x13')]);}})[_0xfcab('0x15')](function(_0x13ed06){logger[_0xfcab('0x12')](_0xfcab('0xd'),_0x4d5c43,_0x13ed06);_0x5db9c3(_0x13ed06);});});}exports[_0xfcab('0x16')]=function(_0x1f9599){var _0xf1c70a=this;return new Promise(function(_0x548a00,_0x117d5a){return db['Trunk'][_0xfcab('0x17')]({'raw':_0x1f9599[_0xfcab('0x18')]?_0x1f9599[_0xfcab('0x18')][_0xfcab('0x19')]===undefined?!![]:![]:!![],'where':_0x1f9599['options']?_0x1f9599[_0xfcab('0x18')]['where']||null:null,'attributes':_0x1f9599[_0xfcab('0x18')]?_0x1f9599[_0xfcab('0x18')]['attributes']||null:null,'limit':_0x1f9599[_0xfcab('0x18')]?_0x1f9599[_0xfcab('0x18')][_0xfcab('0x1a')]||null:null,'include':_0x1f9599[_0xfcab('0x18')]?_0x1f9599[_0xfcab('0x18')][_0xfcab('0x1b')]?_['map'](_0x1f9599[_0xfcab('0x18')][_0xfcab('0x1b')],function(_0x260679){return{'model':db[_0x260679[_0xfcab('0x1c')]],'as':_0x260679['as'],'attributes':_0x260679['attributes'],'include':_0x260679[_0xfcab('0x1b')]?_[_0xfcab('0x1d')](_0x260679[_0xfcab('0x1b')],function(_0x2adf49){return{'model':db[_0x2adf49[_0xfcab('0x1c')]],'as':_0x2adf49['as'],'attributes':_0x2adf49[_0xfcab('0x1e')],'include':_0x2adf49['include']?_['map'](_0x2adf49[_0xfcab('0x1b')],function(_0x3bff7d){return{'model':db[_0x3bff7d[_0xfcab('0x1c')]],'as':_0x3bff7d['as'],'attributes':_0x3bff7d[_0xfcab('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfcab('0xb')](function(_0x4e35e3){logger[_0xfcab('0xc')](_0xfcab('0x16'),_0x1f9599);logger[_0xfcab('0xf')](_0xfcab('0x16'),_0x1f9599,JSON['stringify'](_0x4e35e3));_0x548a00(_0x4e35e3);})['catch'](function(_0x1c4d2e){logger[_0xfcab('0x12')](_0xfcab('0x16'),_0x1c4d2e[_0xfcab('0x13')],_0x1f9599);_0x117d5a(_0xf1c70a['error'](0x1f4,_0x1c4d2e[_0xfcab('0x13')]));});});};exports[_0xfcab('0x1f')]=function(_0x6d92a7){var _0x24b72a=this;return new Promise(function(_0x5a840a,_0x4c8ac0){return db[_0xfcab('0x20')][_0xfcab('0x21')]({'raw':_0x6d92a7[_0xfcab('0x18')]?_0x6d92a7['options'][_0xfcab('0x19')]===undefined?!![]:![]:!![],'where':_0x6d92a7[_0xfcab('0x18')]?_0x6d92a7[_0xfcab('0x18')][_0xfcab('0x22')]||null:null,'attributes':_0x6d92a7['options']?_0x6d92a7[_0xfcab('0x18')][_0xfcab('0x1e')]||null:null,'include':_0x6d92a7['options']?_0x6d92a7['options'][_0xfcab('0x1b')]?_[_0xfcab('0x1d')](_0x6d92a7['options'][_0xfcab('0x1b')],function(_0x277dad){return{'model':db[_0x277dad['model']],'as':_0x277dad['as'],'attributes':_0x277dad[_0xfcab('0x1e')],'include':_0x277dad[_0xfcab('0x1b')]?_[_0xfcab('0x1d')](_0x277dad[_0xfcab('0x1b')],function(_0xc0aca5){return{'model':db[_0xc0aca5[_0xfcab('0x1c')]],'as':_0xc0aca5['as'],'attributes':_0xc0aca5['attributes'],'include':_0xc0aca5['include']?_[_0xfcab('0x1d')](_0xc0aca5[_0xfcab('0x1b')],function(_0xe7f6b7){return{'model':db[_0xe7f6b7['model']],'as':_0xe7f6b7['as'],'attributes':_0xe7f6b7[_0xfcab('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfcab('0xb')](function(_0x3257a3){logger[_0xfcab('0xc')](_0xfcab('0x1f'),_0x6d92a7);logger[_0xfcab('0xf')](_0xfcab('0x1f'),_0x6d92a7,JSON[_0xfcab('0x11')](_0x3257a3));_0x5a840a(_0x3257a3);})[_0xfcab('0x15')](function(_0x414251){logger[_0xfcab('0x12')](_0xfcab('0x1f'),_0x414251[_0xfcab('0x13')],_0x6d92a7);_0x4c8ac0(_0x24b72a[_0xfcab('0x12')](0x1f4,_0x414251[_0xfcab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 659c2e8..2eaf39c 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 _0xd44d=['Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/square_projects','getSquareProjects','post','/create_many','bulkCreate','addContacts','create','addQueues','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','addTeams','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','update','put','/:id/password','changePassword','delete','/:id/queues','removeQueues','destroy','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','util','express'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0xd44d,0xbe));var _0xdd44=function(_0x391955,_0x1fdcd6){_0x391955=_0x391955-0x0;var _0x121893=_0xd44d[_0x391955];return _0x121893;};'use strict';var multer=require('multer');var util=require(_0xdd44('0x0'));var path=require('path');var express=require(_0xdd44('0x1'));var router=express[_0xdd44('0x2')]();var auth=require(_0xdd44('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdd44('0x4'));var controller=require(_0xdd44('0x5'));router[_0xdd44('0x6')]('/',auth[_0xdd44('0x7')](),controller[_0xdd44('0x8')]);router[_0xdd44('0x6')](_0xdd44('0x9'),auth[_0xdd44('0x7')](),controller[_0xdd44('0xa')]);router['get'](_0xdd44('0xb'),auth[_0xdd44('0x7')](),controller[_0xdd44('0xc')]);router[_0xdd44('0x6')](_0xdd44('0xd'),controller['getAvatar']);router[_0xdd44('0x6')](_0xdd44('0xe'),auth['isAuthenticated'](),controller[_0xdd44('0xf')]);router[_0xdd44('0x6')]('/:id/queues',auth[_0xdd44('0x7')](),controller['getQueues']);router[_0xdd44('0x6')](_0xdd44('0x10'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x11')]);router[_0xdd44('0x6')](_0xdd44('0x12'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x13')]);router[_0xdd44('0x6')]('/:id/recordings',auth[_0xdd44('0x7')](),controller['getRecordings']);router['get'](_0xdd44('0x14'),auth['isAuthenticated'](),controller[_0xdd44('0x15')]);router[_0xdd44('0x6')](_0xdd44('0x16'),auth['isAuthenticated'](),controller[_0xdd44('0x17')]);router[_0xdd44('0x6')](_0xdd44('0x18'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x19')]);router['get'](_0xdd44('0x1a'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x1b')]);router[_0xdd44('0x6')]('/:id/fax/interactions',auth[_0xdd44('0x7')](),controller['getFaxInteractions']);router[_0xdd44('0x6')](_0xdd44('0x1c'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x1d')]);router['get'](_0xdd44('0x1e'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x1f')]);router['get']('/:id/agents',auth[_0xdd44('0x7')](),controller[_0xdd44('0x20')]);router[_0xdd44('0x6')](_0xdd44('0x21'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xdd44('0x6')](_0xdd44('0x22'),auth['isAuthenticated'](),controller[_0xdd44('0x23')]);router['get'](_0xdd44('0x24'),auth[_0xdd44('0x7')](),controller['getMailAccounts']);router[_0xdd44('0x6')](_0xdd44('0x25'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x26')]);router[_0xdd44('0x6')](_0xdd44('0x27'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x28')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xdd44('0x29')]);router[_0xdd44('0x6')](_0xdd44('0x2a'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x2b')]);router[_0xdd44('0x2c')](_0xdd44('0x2d'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x2e')]);router['post'](_0xdd44('0xe'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x2f')]);router[_0xdd44('0x2c')]('/',auth['isAuthenticated'](),controller[_0xdd44('0x30')]);router[_0xdd44('0x2c')]('/:id/queues',auth[_0xdd44('0x7')](),controller[_0xdd44('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a2ee4,_0x33fc93,_0x36c15a){_0x36c15a(null,path[_0xdd44('0x32')](config['root'],_0xdd44('0x33')));},'filename':function(_0x210d91,_0x561aff,_0xbd822a){_0xbd822a(null,util[_0xdd44('0x34')](_0xdd44('0x35'),Date[_0xdd44('0x36')](),_0x561aff[_0xdd44('0x37')]));}})});router[_0xdd44('0x2c')](_0xdd44('0xd'),upload[_0xdd44('0x38')](_0xdd44('0x39')),controller[_0xdd44('0x3a')]);router[_0xdd44('0x2c')](_0xdd44('0x3b'),auth[_0xdd44('0x7')](),controller['login']);router[_0xdd44('0x2c')](_0xdd44('0x3c'),auth['isAuthenticated'](),controller[_0xdd44('0x3d')]);router[_0xdd44('0x2c')](_0xdd44('0x3e'),auth[_0xdd44('0x7')](),controller['pause']);router[_0xdd44('0x2c')](_0xdd44('0x3f'),auth['isAuthenticated'](),controller['unpause']);router[_0xdd44('0x2c')](_0xdd44('0x1c'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x40')]);router[_0xdd44('0x2c')](_0xdd44('0x41'),auth[_0xdd44('0x7')](),controller['addChatInteractions']);router[_0xdd44('0x2c')]('/:id/mail_interactions',auth[_0xdd44('0x7')](),controller[_0xdd44('0x42')]);router[_0xdd44('0x2c')](_0xdd44('0x43'),auth[_0xdd44('0x7')](),controller['addFaxInteractions']);router[_0xdd44('0x2c')](_0xdd44('0x44'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x45')]);router['post'](_0xdd44('0x46'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x47')]);router[_0xdd44('0x2c')]('/:id/fax_accounts',auth[_0xdd44('0x7')](),controller[_0xdd44('0x48')]);router[_0xdd44('0x2c')](_0xdd44('0x24'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x49')]);router[_0xdd44('0x2c')](_0xdd44('0x25'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x4a')]);router['post'](_0xdd44('0x27'),auth[_0xdd44('0x7')](),controller['addSmsAccounts']);router[_0xdd44('0x2c')](_0xdd44('0x4b'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x4c')]);router[_0xdd44('0x2c')](_0xdd44('0x2a'),auth[_0xdd44('0x7')](),controller['addSquareProjects']);router['put'](_0xdd44('0xb'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x4d')]);router[_0xdd44('0x4e')](_0xdd44('0x4f'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x50')]);router[_0xdd44('0x51')](_0xdd44('0x52'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x53')]);router['delete']('/:id/teams',auth[_0xdd44('0x7')](),controller['removeTeams']);router[_0xdd44('0x51')](_0xdd44('0xb'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x54')]);router['delete'](_0xdd44('0x41'),auth[_0xdd44('0x7')](),controller['removeChatInteractions']);router[_0xdd44('0x51')](_0xdd44('0x55'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x56')]);router[_0xdd44('0x51')]('/:id/fax_interactions',auth[_0xdd44('0x7')](),controller[_0xdd44('0x57')]);router[_0xdd44('0x51')](_0xdd44('0x44'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x58')]);router[_0xdd44('0x51')]('/:id/openchannel_interactions',auth[_0xdd44('0x7')](),controller[_0xdd44('0x59')]);router[_0xdd44('0x51')](_0xdd44('0x22'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x5a')]);router[_0xdd44('0x51')](_0xdd44('0x24'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x5b')]);router[_0xdd44('0x51')](_0xdd44('0x25'),auth[_0xdd44('0x7')](),controller['removeOpenchannelAccounts']);router[_0xdd44('0x51')](_0xdd44('0x27'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x5c')]);router[_0xdd44('0x51')](_0xdd44('0x4b'),auth['isAuthenticated'](),controller[_0xdd44('0x5d')]);router[_0xdd44('0x51')](_0xdd44('0x2a'),auth[_0xdd44('0x7')](),controller[_0xdd44('0x5e')]);module[_0xdd44('0x5f')]=router; \ No newline at end of file +var _0xf372=['addChatWebsites','addSquareProjects','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/mail_interactions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','bulkCreate','post','create','addQueues','root','server/files/images/','format','%s-%s','now','originalname','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','addFaxInteractions','/:id/openchannel_interactions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','/:id/sms_accounts'];(function(_0x142ebd,_0x4453c7){var _0x3ca721=function(_0x21f921){while(--_0x21f921){_0x142ebd['push'](_0x142ebd['shift']());}};_0x3ca721(++_0x4453c7);}(_0xf372,0x142));var _0x2f37=function(_0x4a60d4,_0x5f2084){_0x4a60d4=_0x4a60d4-0x0;var _0x549ae4=_0xf372[_0x4a60d4];return _0x549ae4;};'use strict';var multer=require(_0x2f37('0x0'));var util=require(_0x2f37('0x1'));var path=require(_0x2f37('0x2'));var express=require(_0x2f37('0x3'));var router=express[_0x2f37('0x4')]();var auth=require(_0x2f37('0x5'));var interaction=require(_0x2f37('0x6'));var config=require('../../config/environment');var controller=require(_0x2f37('0x7'));router[_0x2f37('0x8')]('/',auth[_0x2f37('0x9')](),controller[_0x2f37('0xa')]);router['get'](_0x2f37('0xb'),auth[_0x2f37('0x9')](),controller[_0x2f37('0xc')]);router[_0x2f37('0x8')](_0x2f37('0xd'),auth[_0x2f37('0x9')](),controller[_0x2f37('0xe')]);router[_0x2f37('0x8')](_0x2f37('0xf'),controller[_0x2f37('0x10')]);router[_0x2f37('0x8')](_0x2f37('0x11'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x12')]);router['get'](_0x2f37('0x13'),auth['isAuthenticated'](),controller[_0x2f37('0x14')]);router[_0x2f37('0x8')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x2f37('0x15')]);router[_0x2f37('0x8')](_0x2f37('0x16'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x17')]);router[_0x2f37('0x8')](_0x2f37('0x18'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x19')]);router[_0x2f37('0x8')](_0x2f37('0x1a'),auth['isAuthenticated'](),controller['getChatInteractions']);router['get'](_0x2f37('0x1b'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x1c')]);router['get'](_0x2f37('0x1d'),auth['isAuthenticated'](),controller[_0x2f37('0x1e')]);router[_0x2f37('0x8')](_0x2f37('0x1f'),auth[_0x2f37('0x9')](),controller['getSmsInteractions']);router[_0x2f37('0x8')](_0x2f37('0x20'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x21')]);router['get']('/:id/teams',auth[_0x2f37('0x9')](),controller[_0x2f37('0x22')]);router[_0x2f37('0x8')](_0x2f37('0x23'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x24')]);router[_0x2f37('0x8')](_0x2f37('0x25'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x26')]);router[_0x2f37('0x8')](_0x2f37('0x27'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x28')]);router['get'](_0x2f37('0x29'),auth[_0x2f37('0x9')](),controller['getFaxAccounts']);router[_0x2f37('0x8')]('/:id/mail_accounts',auth[_0x2f37('0x9')](),controller[_0x2f37('0x2a')]);router['get'](_0x2f37('0x2b'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x2c')]);router[_0x2f37('0x8')]('/:id/sms_accounts',auth[_0x2f37('0x9')](),controller[_0x2f37('0x2d')]);router[_0x2f37('0x8')](_0x2f37('0x2e'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x2f')]);router[_0x2f37('0x8')](_0x2f37('0x30'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x31')]);router['post']('/create_many',auth[_0x2f37('0x9')](),controller[_0x2f37('0x32')]);router['post'](_0x2f37('0x11'),auth[_0x2f37('0x9')](),controller['addContacts']);router[_0x2f37('0x33')]('/',auth[_0x2f37('0x9')](),controller[_0x2f37('0x34')]);router['post'](_0x2f37('0x13'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x495fd6,_0x1c8af0,_0x3c8e54){_0x3c8e54(null,path['join'](config[_0x2f37('0x36')],_0x2f37('0x37')));},'filename':function(_0x2779cf,_0x530b6a,_0x33e344){_0x33e344(null,util[_0x2f37('0x38')](_0x2f37('0x39'),Date[_0x2f37('0x3a')](),_0x530b6a[_0x2f37('0x3b')]));}})});router['post'](_0x2f37('0xf'),upload['single']('file'),controller[_0x2f37('0x3c')]);router[_0x2f37('0x33')](_0x2f37('0x3d'),auth['isAuthenticated'](),controller[_0x2f37('0x3e')]);router[_0x2f37('0x33')](_0x2f37('0x3f'),auth['isAuthenticated'](),controller[_0x2f37('0x40')]);router['post'](_0x2f37('0x41'),auth[_0x2f37('0x9')](),controller['pause']);router[_0x2f37('0x33')](_0x2f37('0x42'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x43')]);router[_0x2f37('0x33')](_0x2f37('0x44'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x45')]);router[_0x2f37('0x33')](_0x2f37('0x46'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x47')]);router['post']('/:id/mail_interactions',auth[_0x2f37('0x9')](),controller['addMailInteractions']);router[_0x2f37('0x33')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x2f37('0x48')]);router[_0x2f37('0x33')]('/:id/sms_interactions',auth[_0x2f37('0x9')](),controller['addSmsInteractions']);router['post'](_0x2f37('0x49'),auth[_0x2f37('0x9')](),controller['addOpenchannelInteractions']);router['post'](_0x2f37('0x29'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x4a')]);router['post'](_0x2f37('0x4b'),auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0x2f37('0x2b'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x4c')]);router['post'](_0x2f37('0x4d'),auth[_0x2f37('0x9')](),controller['addSmsAccounts']);router[_0x2f37('0x33')](_0x2f37('0x2e'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x4e')]);router['post'](_0x2f37('0x30'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x4f')]);router[_0x2f37('0x50')](_0x2f37('0xd'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x51')]);router[_0x2f37('0x50')](_0x2f37('0x52'),auth[_0x2f37('0x9')](),controller['changePassword']);router[_0x2f37('0x53')]('/:id/queues',auth['isAuthenticated'](),controller[_0x2f37('0x54')]);router[_0x2f37('0x53')](_0x2f37('0x44'),auth['isAuthenticated'](),controller[_0x2f37('0x55')]);router['delete'](_0x2f37('0xd'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x56')]);router[_0x2f37('0x53')]('/:id/chat_interactions',auth[_0x2f37('0x9')](),controller['removeChatInteractions']);router[_0x2f37('0x53')](_0x2f37('0x57'),auth[_0x2f37('0x9')](),controller['removeMailInteractions']);router[_0x2f37('0x53')](_0x2f37('0x58'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x59')]);router['delete'](_0x2f37('0x5a'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x5b')]);router[_0x2f37('0x53')](_0x2f37('0x49'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x5c')]);router[_0x2f37('0x53')](_0x2f37('0x29'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x5d')]);router[_0x2f37('0x53')](_0x2f37('0x4b'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x5e')]);router[_0x2f37('0x53')](_0x2f37('0x2b'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x5f')]);router['delete'](_0x2f37('0x4d'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x60')]);router[_0x2f37('0x53')](_0x2f37('0x2e'),auth[_0x2f37('0x9')](),controller[_0x2f37('0x61')]);router[_0x2f37('0x53')]('/:id/square_projects',auth[_0x2f37('0x9')](),controller[_0x2f37('0x62')]);module[_0x2f37('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 838f76b..e8aab38 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 _0x50de=['toLowerCase','ENUM','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','rtcp_mux','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email'];(function(_0x12d123,_0x1d981f){var _0x36a1cb=function(_0x542369){while(--_0x542369){_0x12d123['push'](_0x12d123['shift']());}};_0x36a1cb(++_0x1d981f);}(_0x50de,0x1f4));var _0xe50d=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x50de[_0x33bc64];return _0x3fdd34;};'use strict';var Sequelize=require(_0xe50d('0x0'));var moment=require(_0xe50d('0x1'));var util=require(_0xe50d('0x2'));var _=require(_0xe50d('0x3'));module[_0xe50d('0x4')]={'name':{'type':Sequelize[_0xe50d('0x5')],'allowNull':![],'unique':_0xe50d('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5489f5){this[_0xe50d('0x7')](_0xe50d('0x6'),_0x5489f5);this['setDataValue'](_0xe50d('0x8'),_0x5489f5);},'comment':_0xe50d('0x9')},'fullname':{'type':Sequelize[_0xe50d('0x5')],'allowNull':![],'set':function(_0x313902){this[_0xe50d('0x7')](_0xe50d('0xa'),_0x313902);this[_0xe50d('0x7')](_0xe50d('0xb'),util[_0xe50d('0xc')](_0xe50d('0xd'),_0x313902,this[_0xe50d('0xe')]('internal')));}},'alias':{'type':Sequelize[_0xe50d('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe50d('0xf'),'validate':{'isEmail':!![]},'set':function(_0xc79925){if(_0xc79925){this[_0xe50d('0x7')]('email',_0xc79925[_0xe50d('0x10')]());}}},'role':{'type':Sequelize[_0xe50d('0x11')]('admin','user','agent',_0xe50d('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xe50d('0x13')},'internal':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':![],'unique':_0xe50d('0x15'),'set':function(_0xc23fd3){this[_0xe50d('0x7')](_0xe50d('0x15'),_0xc23fd3);this['setDataValue'](_0xe50d('0x16'),_0xc23fd3);this[_0xe50d('0x7')](_0xe50d('0xb'),util['format'](_0xe50d('0xd'),this[_0xe50d('0xe')](_0xe50d('0xa')),_0xc23fd3));}},'salt':{'type':Sequelize[_0xe50d('0x5')]},'phone':{'type':Sequelize[_0xe50d('0x5')]},'mobile':{'type':Sequelize[_0xe50d('0x5')]},'address':{'type':Sequelize[_0xe50d('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xe50d('0x5')]},'city':{'type':Sequelize[_0xe50d('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe50d('0x18')]},'voicePause':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe50d('0x5')],'defaultValue':_0xe50d('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xe50d('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe50d('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe50d('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe50d('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe50d('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe50d('0x14')](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize[_0xe50d('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe50d('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![],'defaultValue':_0xe50d('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xe50d('0x1b'),_0xe50d('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x1d'),_0xe50d('0x1e'),_0xe50d('0x1f'),'ALLOWED',_0xe50d('0x20'),_0xe50d('0x21'),_0xe50d('0x22'),_0xe50d('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0xc3055f){this[_0xe50d('0x7')](_0xe50d('0x24'),_0xc3055f?_0xc3055f[_0xe50d('0x25')](','):null);},'get':function(){return this[_0xe50d('0xe')]('transport')?this[_0xe50d('0xe')]('transport')[_0xe50d('0x26')](','):null;},'comment':_0xe50d('0x27')},'dtmfmode':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x28'),_0xe50d('0x29'),_0xe50d('0x2a'),_0xe50d('0x2b'),_0xe50d('0x2c')),'allowNull':!![],'defaultValue':_0xe50d('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xe50d('0x2d'),'no',_0xe50d('0x2e'),_0xe50d('0x2f'),_0xe50d('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe50d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![],'defaultValue':_0xe50d('0x31'),'set':function(_0x116d49){this[_0xe50d('0x7')](_0xe50d('0x32'),_0x116d49?_0x116d49['join'](','):null);},'get':function(){return this[_0xe50d('0xe')](_0xe50d('0x32'))?this[_0xe50d('0xe')](_0xe50d('0x32'))[_0xe50d('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe50d('0x5')]},'namedcallgroup':{'type':Sequelize[_0xe50d('0x5')]},'pickupgroup':{'type':Sequelize[_0xe50d('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xe50d('0x5')]},'language':{'type':Sequelize[_0xe50d('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe50d('0x5')]},'disallow':{'type':Sequelize[_0xe50d('0x5')],'allowNull':![],'defaultValue':_0xe50d('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe50d('0x34'),'set':function(_0x14c7e8){this[_0xe50d('0x7')](_0xe50d('0x35'),_0x14c7e8?_0x14c7e8['join'](';'):_0xe50d('0x34'));},'get':function(){return this[_0xe50d('0xe')](_0xe50d('0x35'))?this['getDataValue'](_0xe50d('0x35'))[_0xe50d('0x26')](';'):null;},'comment':_0xe50d('0x36')},'autoframing':{'type':Sequelize['ENUM'](_0xe50d('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x484d04){this['setDataValue'](_0xe50d('0x37'),_0x484d04?_0x484d04[_0xe50d('0x25')](','):null);},'get':function(){return this[_0xe50d('0xe')]('insecure')?this[_0xe50d('0xe')](_0xe50d('0x37'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xe50d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no',_0xe50d('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe50d('0x11')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![],'defaultValue':_0xe50d('0x39')},'amaflags':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xe50d('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xe50d('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe50d('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe50d('0x11')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe50d('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x3a'),_0xe50d('0x3b'),_0xe50d('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x3d'),_0xe50d('0x3e')),'allowNull':!![],'defaultValue':_0xe50d('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xe50d('0x2d')},'keepalive':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xe50d('0x2d'),'no',_0xe50d('0x3f'),_0xe50d('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x41'),_0xe50d('0x42'),_0xe50d('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe50d('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe50d('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no','nonat','update',_0xe50d('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe50d('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xe50d('0x18')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x413406){this[_0xe50d('0x7')]('showWebBar',_0x413406);var _0x46099a=this[_0xe50d('0x45')]({'plain':!![]});switch(_0x413406){case 0x0:case 0x1:var _0x522560=_0x46099a[_0xe50d('0x24')]?_[_0xe50d('0x46')](_0x46099a[_0xe50d('0x24')])?_0x46099a[_0xe50d('0x24')]['join']():_0x46099a[_0xe50d('0x24')]:'udp';if(_0x522560===_0xe50d('0x47')){_0x522560=_0xe50d('0x48');}this[_0xe50d('0x7')](_0xe50d('0x24'),_0x522560);this[_0xe50d('0x7')](_0xe50d('0x49'),'no');this['setDataValue'](_0xe50d('0x4a'),null);this[_0xe50d('0x7')](_0xe50d('0x4b'),null);this['setDataValue'](_0xe50d('0x4c'),null);this[_0xe50d('0x7')](_0xe50d('0x4d'),null);this[_0xe50d('0x7')](_0xe50d('0x4e'),null);this[_0xe50d('0x7')]('dtlssetup',null);this['setDataValue'](_0xe50d('0x4f'),null);this[_0xe50d('0x7')]('dtlsprivatekey',null);this[_0xe50d('0x7')](_0xe50d('0x50'),'no');break;case 0x2:this[_0xe50d('0x7')](_0xe50d('0x24'),_0xe50d('0x47'));this[_0xe50d('0x7')](_0xe50d('0x49'),_0xe50d('0x2d'));this[_0xe50d('0x7')]('avpf',_0xe50d('0x2d'));this['setDataValue'](_0xe50d('0x4b'),'yes');this[_0xe50d('0x7')]('icesupport',_0xe50d('0x2d'));this['setDataValue'](_0xe50d('0x4d'),_0xe50d('0x2d'));this[_0xe50d('0x7')](_0xe50d('0x4e'),'no');this[_0xe50d('0x7')]('dtlssetup',_0xe50d('0x43'));this[_0xe50d('0x7')](_0xe50d('0x4f'),_0x46099a[_0xe50d('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0xe50d('0x7')](_0xe50d('0x51'),_0x46099a[_0xe50d('0x51')]||_0xe50d('0x52'));this[_0xe50d('0x7')](_0xe50d('0x50'),_0xe50d('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xe50d('0x53')],'set':function(_0x35ce62){this['setDataValue'](_0xe50d('0x54'),_0x35ce62?_0x35ce62[_0xe50d('0x25')](','):[]);},'get':function(){return this[_0xe50d('0xe')](_0xe50d('0x54'))?_[_0xe50d('0x55')](this[_0xe50d('0xe')](_0xe50d('0x54'))[_0xe50d('0x26')](','),function(_0x48953d){return parseInt(_0x48953d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe50d('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe50d('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xe50d('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe50d('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe50d('0x11')](_0xe50d('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe50d('0x5')]},'passwordResetAt':{'type':Sequelize[_0xe50d('0x18')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe50d('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0x64c4=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','originate','uac','uas','fingerprint','certificate','active','passive','actpass','showWebBar','wss','udp','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','encryption','force_avp','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','sequelize','moment','lodash','exports','name','setDataValue','defaultuser','STRING','fullname','format','\x22%s\x22\x20<%s>','internal','toLowerCase','admin','user','agent','telephone','local','INTEGER','callerid','getDataValue','BOOLEAN','DATE','dynamic','ENUM','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x159792,_0x129128){var _0x2d2b1a=function(_0x475311){while(--_0x475311){_0x159792['push'](_0x159792['shift']());}};_0x2d2b1a(++_0x129128);}(_0x64c4,0x155));var _0x464c=function(_0x40c532,_0x48f4d0){_0x40c532=_0x40c532-0x0;var _0x546400=_0x64c4[_0x40c532];return _0x546400;};'use strict';var Sequelize=require(_0x464c('0x0'));var moment=require(_0x464c('0x1'));var util=require('util');var _=require(_0x464c('0x2'));module[_0x464c('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x464c('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xc7c9cf){this['setDataValue'](_0x464c('0x4'),_0xc7c9cf);this[_0x464c('0x5')](_0x464c('0x6'),_0xc7c9cf);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x464c('0x7')],'allowNull':![],'set':function(_0x2613e5){this[_0x464c('0x5')](_0x464c('0x8'),_0x2613e5);this['setDataValue']('callerid',util[_0x464c('0x9')](_0x464c('0xa'),_0x2613e5,this['getDataValue'](_0x464c('0xb'))));}},'alias':{'type':Sequelize[_0x464c('0x7')]},'email':{'type':Sequelize[_0x464c('0x7')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xbde7b){if(_0xbde7b){this[_0x464c('0x5')]('email',_0xbde7b[_0x464c('0xc')]());}}},'role':{'type':Sequelize['ENUM'](_0x464c('0xd'),_0x464c('0xe'),_0x464c('0xf'),_0x464c('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x464c('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x464c('0x11')},'internal':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':![],'unique':_0x464c('0xb'),'set':function(_0x39a371){this['setDataValue']('internal',_0x39a371);this[_0x464c('0x5')]('accountcode',_0x39a371);this['setDataValue'](_0x464c('0x13'),util['format'](_0x464c('0xa'),this[_0x464c('0x14')](_0x464c('0x8')),_0x39a371));}},'salt':{'type':Sequelize[_0x464c('0x7')]},'phone':{'type':Sequelize[_0x464c('0x7')]},'mobile':{'type':Sequelize[_0x464c('0x7')]},'address':{'type':Sequelize[_0x464c('0x7')]},'zipcode':{'type':Sequelize[_0x464c('0x7')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x464c('0x7')]},'country':{'type':Sequelize[_0x464c('0x7')]},'online':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x464c('0x7')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x464c('0x16')]},'chatCapacity':{'type':Sequelize[_0x464c('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x464c('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x464c('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x464c('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x464c('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x464c('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x464c('0x12')](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize[_0x464c('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x464c('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x464c('0x17')},'ipaddr':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0x464c('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x19'),'user',_0x464c('0x1a')),'allowNull':!![],'defaultValue':_0x464c('0x19')},'context':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x1b'),_0x464c('0x1c'),_0x464c('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![],'defaultValue':'udp','set':function(_0x241c7a){this['setDataValue'](_0x464c('0x1e'),_0x241c7a?_0x241c7a[_0x464c('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0x464c('0x1e'))?this['getDataValue'](_0x464c('0x1e'))['split'](','):null;},'comment':_0x464c('0x20')},'dtmfmode':{'type':Sequelize[_0x464c('0x18')]('rfc2833',_0x464c('0x21'),_0x464c('0x22'),_0x464c('0x23'),_0x464c('0x24')),'allowNull':!![],'defaultValue':_0x464c('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0x464c('0x26'),'no',_0x464c('0x27'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x464c('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![],'defaultValue':_0x464c('0x28'),'set':function(_0x468c3c){this[_0x464c('0x5')](_0x464c('0x29'),_0x468c3c?_0x468c3c[_0x464c('0x1f')](','):null);},'get':function(){return this[_0x464c('0x14')](_0x464c('0x29'))?this[_0x464c('0x14')](_0x464c('0x29'))[_0x464c('0x2a')](','):null;},'comment':_0x464c('0x2b')},'callgroup':{'type':Sequelize[_0x464c('0x7')]},'namedcallgroup':{'type':Sequelize[_0x464c('0x7')]},'pickupgroup':{'type':Sequelize[_0x464c('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x464c('0x7')]},'language':{'type':Sequelize[_0x464c('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x464c('0x7')]},'disallow':{'type':Sequelize[_0x464c('0x7')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x48e984){this[_0x464c('0x5')]('allow',_0x48e984?_0x48e984[_0x464c('0x1f')](';'):_0x464c('0x2c'));},'get':function(){return this[_0x464c('0x14')](_0x464c('0x2d'))?this[_0x464c('0x14')](_0x464c('0x2d'))[_0x464c('0x2a')](';'):null;},'comment':_0x464c('0x2e')},'autoframing':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x41f2d4){this[_0x464c('0x5')](_0x464c('0x2f'),_0x41f2d4?_0x41f2d4[_0x464c('0x1f')](','):null);},'get':function(){return this[_0x464c('0x14')](_0x464c('0x2f'))?this[_0x464c('0x14')](_0x464c('0x2f'))[_0x464c('0x2a')](','):null;},'comment':_0x464c('0x30')},'trustrpid':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x464c('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no',_0x464c('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x464c('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x464c('0x32')},'amaflags':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x464c('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no',_0x464c('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse',_0x464c('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x35'),_0x464c('0x36')),'allowNull':!![],'defaultValue':_0x464c('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x464c('0x26'),'no'),'allowNull':!![],'defaultValue':_0x464c('0x26')},'keepalive':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x464c('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x464c('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x464c('0x18')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no',_0x464c('0x37'),_0x464c('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x464c('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x39'),_0x464c('0x3a'),_0x464c('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x464c('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x464c('0x18')](_0x464c('0x26'),'no',_0x464c('0x27'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x464c('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x464c('0x16')]},'showWebBar':{'type':Sequelize[_0x464c('0x12')],'defaultValue':0x0,'set':function(_0xef3eb2){this['setDataValue'](_0x464c('0x3c'),_0xef3eb2);var _0x4b2b57=this['get']({'plain':!![]});switch(_0xef3eb2){case 0x0:case 0x1:var _0x4880e5=_0x4b2b57[_0x464c('0x1e')]?_['isArray'](_0x4b2b57[_0x464c('0x1e')])?_0x4b2b57['transport']['join']():_0x4b2b57[_0x464c('0x1e')]:'udp';if(_0x4880e5===_0x464c('0x3d')){_0x4880e5=_0x464c('0x3e');}this['setDataValue'](_0x464c('0x1e'),_0x4880e5);this[_0x464c('0x5')]('encryption','no');this[_0x464c('0x5')](_0x464c('0x3f'),null);this['setDataValue']('force_avp',null);this['setDataValue'](_0x464c('0x40'),null);this[_0x464c('0x5')](_0x464c('0x41'),null);this[_0x464c('0x5')](_0x464c('0x42'),null);this[_0x464c('0x5')](_0x464c('0x43'),null);this[_0x464c('0x5')](_0x464c('0x44'),null);this[_0x464c('0x5')](_0x464c('0x45'),null);this[_0x464c('0x5')]('rtcp_mux','no');break;case 0x2:this[_0x464c('0x5')](_0x464c('0x1e'),_0x464c('0x3d'));this[_0x464c('0x5')](_0x464c('0x46'),_0x464c('0x26'));this[_0x464c('0x5')](_0x464c('0x3f'),'yes');this[_0x464c('0x5')](_0x464c('0x47'),_0x464c('0x26'));this[_0x464c('0x5')](_0x464c('0x40'),_0x464c('0x26'));this[_0x464c('0x5')](_0x464c('0x41'),_0x464c('0x26'));this[_0x464c('0x5')](_0x464c('0x42'),'no');this[_0x464c('0x5')](_0x464c('0x43'),_0x464c('0x3b'));this[_0x464c('0x5')](_0x464c('0x44'),_0x4b2b57[_0x464c('0x44')]||'/etc/pki/tls/certs/motion.crt');this[_0x464c('0x5')]('dtlsprivatekey',_0x4b2b57[_0x464c('0x45')]||_0x464c('0x48'));this['setDataValue'](_0x464c('0x49'),_0x464c('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0x464c('0x4a')],'set':function(_0x1b6b48){this['setDataValue'](_0x464c('0x4b'),_0x1b6b48?_0x1b6b48['join'](','):[]);},'get':function(){return this[_0x464c('0x14')]('permissions')?_[_0x464c('0x4c')](this[_0x464c('0x14')]('permissions')[_0x464c('0x2a')](','),function(_0x355fbc){return parseInt(_0x355fbc,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x464c('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x464c('0x7')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x464c('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x464c('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x464c('0x7')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x464c('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index e3274b6..5057a1e 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 _0x00d4=['chatPause','faxPause','pauseType','lastPauseAt','QueuePause','manual','mail','chat','fax','sms','openchannel','Team','getTeams','addTeams','removeTeams','getLists','getAgents','Agents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','spread','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','register','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','end','name','index','User','rawAttributes','model','password','salt','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','add','day','merge','filter','where','map','sequelize','lower','col','options','count','includeAll','include','findAll','rows','catch','show','params','find','bulkCreate','body','addContacts','omit','ids','role','agent','telephone','user','../../config/license/util','getLicense','telephones','isNil','License\x20limit\x20reached','create','internal','Setting','min_internal','max','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','fullname','email','permissions','101','102','103','110','104','105','106','107','109','111','VoiceMail','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','ValidationError','Wrong\x20credentials','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','loginInPause','channel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','VoiceQueue','voice','format','%s/%s','SIP','each','upsert','removeQueues','isValidChannel','UserVoiceQueueRt','userpic','file','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','getContacts','findOne','UserId','CmContact','describe','order','pick','Queue','get','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','VoiceRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','mobile','interface','SIP/%s','emit','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','push','YYYY-MM-DD\x20HH:mm:ss','all','device','PAUSE','MemberReport','logout','pause','updateAttributes','forEach','type','unpause','voicePause'];(function(_0x3b64b1,_0x57558b){var _0x23df16=function(_0x552f06){while(--_0x552f06){_0x3b64b1['push'](_0x3b64b1['shift']());}};_0x23df16(++_0x57558b);}(_0x00d4,0x149));var _0x400d=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x00d4[_0x1a7846];return _0x48049;};'use strict';var jsonpatch=require(_0x400d('0x0'));var rp=require(_0x400d('0x1'));var moment=require(_0x400d('0x2'));var BPromise=require(_0x400d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x400d('0x4'));var csv=require(_0x400d('0x5'));var ejs=require(_0x400d('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x400d('0x7'));var crypto=require(_0x400d('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x400d('0x9'));var toCsv=require(_0x400d('0x5'));var querystring=require(_0x400d('0xa'));var Papa=require('papaparse');var qs=require(_0x400d('0xb'));var logger=require(_0x400d('0xc'))(_0x400d('0xd'));var utils=require(_0x400d('0xe'));var config=require('../../config/environment');var db=require(_0x400d('0xf'))['db'];var socket=require(_0x400d('0x10'))({'host':_0x400d('0x11'),'port':0x18eb});require('./user.socket')[_0x400d('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0x400d('0x13')][_0x400d('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x19f6d8,_0x5e0ae3,_0x5ba4ec,_0x5e1651){return new BPromise(function(_0x336bf2,_0x537409){var _0x178593=_0x5e1651||client;return _0x178593[_0x400d('0x15')](_0x19f6d8,_0x5ba4ec)[_0x400d('0x16')](function(_0x149e7e){logger[_0x400d('0x17')](_0x400d('0x18'),_0x5e0ae3,_0x400d('0x19'));logger[_0x400d('0x1a')](_0x400d('0x1b'),_0x5e0ae3,_0x400d('0x19'),JSON[_0x400d('0x1c')](_0x149e7e));if(_0x149e7e[_0x400d('0x1d')]){if(_0x149e7e['error'][_0x400d('0x1e')]===0x1f4){logger['error'](_0x400d('0x18'),_0x5e0ae3,_0x149e7e[_0x400d('0x1d')][_0x400d('0x1f')]);return _0x537409(_0x149e7e[_0x400d('0x1d')][_0x400d('0x1f')]);}logger[_0x400d('0x1d')](_0x400d('0x18'),_0x5e0ae3,_0x149e7e[_0x400d('0x1d')]['message']);return _0x336bf2(_0x149e7e[_0x400d('0x1d')]['message']);}else{logger['info'](_0x400d('0x18'),_0x5e0ae3,'request\x20sent');_0x336bf2(_0x149e7e[_0x400d('0x20')][_0x400d('0x1f')]);}})['catch'](function(_0x59deef){logger[_0x400d('0x1d')]('User,\x20%s,\x20%s',_0x5e0ae3,_0x59deef);_0x537409(_0x59deef);});});}function respondWithStatusCode(_0x53b87f,_0x4bd5f6){_0x4bd5f6=_0x4bd5f6||0xcc;return function(_0x52455b){if(_0x52455b){return _0x53b87f[_0x400d('0x21')](_0x4bd5f6);}return _0x53b87f[_0x400d('0x22')](_0x4bd5f6)['end']();};}function respondWithResult(_0x3a1d4c,_0x2bcbc9){_0x2bcbc9=_0x2bcbc9||0xc8;return function(_0x27916c){if(_0x27916c){return _0x3a1d4c[_0x400d('0x22')](_0x2bcbc9)[_0x400d('0x23')](_0x27916c);}};}function respondWithFilteredResult(_0x3eefb5,_0x1f312f){return function(_0xb4a24a){if(_0xb4a24a){var _0x1e3f4d=_0xb4a24a['count'],_0x3f2ba1=_0x1f312f['offset'],_0x4b8041=_0x1f312f[_0x400d('0x24')]+_0x1f312f[_0x400d('0x25')],_0x289069;if(_0x4b8041>=_0x1e3f4d){_0x4b8041=_0x1e3f4d;_0x289069=0xc8;}else{_0x289069=0xce;}_0x3eefb5[_0x400d('0x22')](_0x289069);return _0x3eefb5[_0x400d('0x26')]('Content-Range',_0x3f2ba1+'-'+_0x4b8041+'/'+_0x1e3f4d)[_0x400d('0x23')](_0xb4a24a);}return null;};}function patchUpdates(_0x43c9c5){return function(_0x5d0a04){try{jsonpatch[_0x400d('0x27')](_0x5d0a04,_0x43c9c5,!![]);}catch(_0x2841af){return BPromise[_0x400d('0x28')](_0x2841af);}return _0x5d0a04[_0x400d('0x29')]();};}function saveUpdates(_0x330275,_0x194c3d){return function(_0x4e4a9b){if(_0x4e4a9b){return _0x4e4a9b[_0x400d('0x2a')](_0x330275)[_0x400d('0x16')](function(_0xba0508){return _0xba0508;});}return null;};}function removeEntity(_0x5140fb,_0x47b252){return function(_0x4a2dfe){if(_0x4a2dfe){return _0x4a2dfe[_0x400d('0x2b')]()[_0x400d('0x16')](function(){_0x5140fb[_0x400d('0x22')](0xcc)[_0x400d('0x2c')]();});}};}function handleEntityNotFound(_0x1d1ae1,_0x10e0a4){return function(_0x8a282d){if(!_0x8a282d){_0x1d1ae1[_0x400d('0x21')](0x194);}return _0x8a282d;};}function handleError(_0x2dd311,_0x313e53){_0x313e53=_0x313e53||0x1f4;return function(_0x4f7c3e){logger[_0x400d('0x1d')](_0x4f7c3e['stack']);if(_0x4f7c3e[_0x400d('0x2d')]){delete _0x4f7c3e['name'];}_0x2dd311[_0x400d('0x22')](_0x313e53)['send'](_0x4f7c3e);};}exports[_0x400d('0x2e')]=function(_0x1f5446,_0x402afd){var _0x5e747b={},_0xbaaff2={},_0x3cbbe8={'count':0x0,'rows':[]};var _0x2dfdd4=db[_0x400d('0x2f')][_0x400d('0x30')];_0xbaaff2[_0x400d('0x31')]=_['differenceBy'](_['keys'](_0x2dfdd4),[_0x400d('0x32'),_0x400d('0x33')]);var _0xcc9801={'dateStart':_0x1f5446[_0x400d('0x34')][_0x400d('0x35')],'dateEnd':_0x1f5446[_0x400d('0x34')][_0x400d('0x36')]};delete _0x1f5446[_0x400d('0x34')][_0x400d('0x35')];delete _0x1f5446[_0x400d('0x34')][_0x400d('0x36')];_0xbaaff2[_0x400d('0x34')]=_[_0x400d('0x37')](_0x1f5446[_0x400d('0x34')]);_0xbaaff2[_0x400d('0x38')]=_[_0x400d('0x39')](_0xbaaff2['model'],_0xbaaff2['query']);_0x5e747b[_0x400d('0x3a')]=_[_0x400d('0x39')](_0xbaaff2[_0x400d('0x31')],qs['fields'](_0x1f5446[_0x400d('0x34')][_0x400d('0x3b')]));_0x5e747b['attributes']=_0x5e747b[_0x400d('0x3a')][_0x400d('0x3c')]?_0x5e747b['attributes']:_0xbaaff2[_0x400d('0x31')];if(!_0x1f5446['query'][_0x400d('0x3d')](_0x400d('0x3e'))){_0x5e747b[_0x400d('0x25')]=qs[_0x400d('0x25')](_0x1f5446[_0x400d('0x34')][_0x400d('0x25')]);_0x5e747b[_0x400d('0x24')]=qs['offset'](_0x1f5446[_0x400d('0x34')]['offset']);}_0x5e747b['order']=qs[_0x400d('0x3f')](_0x1f5446[_0x400d('0x34')][_0x400d('0x3f')]);_0x5e747b['where']=qs['filters'](_['pick'](_0x1f5446[_0x400d('0x34')],_0xbaaff2[_0x400d('0x38')]));if(_0xcc9801['dateStart']){if(_0xcc9801[_0x400d('0x36')]){_0xcc9801['dateEnd']=moment(_0xcc9801[_0x400d('0x36')])[_0x400d('0x40')](0x1,_0x400d('0x41'));}else{_0xcc9801[_0x400d('0x36')]=moment(_0xcc9801[_0x400d('0x35')])[_0x400d('0x40')](0x1,_0x400d('0x41'));}_[_0x400d('0x42')](_0x5e747b['where'],{'createdAt':{'$gte':_0xcc9801[_0x400d('0x35')],'$lte':_0xcc9801[_0x400d('0x36')]}});}if(_0x1f5446['query'][_0x400d('0x43')]){_0x5e747b[_0x400d('0x44')]=_[_0x400d('0x42')](_0x5e747b[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x5e747b[_0x400d('0x3a')],function(_0xcc2360){return db[_0x400d('0x46')][_0x400d('0x44')](db[_0x400d('0x46')]['fn'](_0x400d('0x47'),db['sequelize'][_0x400d('0x48')](_0xcc2360)),{'$like':db[_0x400d('0x46')]['fn'](_0x400d('0x47'),'%'+_0x1f5446[_0x400d('0x34')][_0x400d('0x43')]+'%')});})});}_0x5e747b=_[_0x400d('0x42')]({},_0x5e747b,_0x1f5446[_0x400d('0x49')]);var _0x1058f7={'where':_0x5e747b[_0x400d('0x44')]};return db['User'][_0x400d('0x4a')](_0x1058f7)[_0x400d('0x16')](function(_0x3c2b1e){_0x3cbbe8[_0x400d('0x4a')]=_0x3c2b1e;if(_0x1f5446[_0x400d('0x34')][_0x400d('0x4b')]){_0x5e747b[_0x400d('0x4c')]=[{'all':!![]}];}return db[_0x400d('0x2f')][_0x400d('0x4d')](_0x5e747b);})[_0x400d('0x16')](function(_0x595934){_0x3cbbe8[_0x400d('0x4e')]=_0x595934;return _0x3cbbe8;})['then'](respondWithFilteredResult(_0x402afd,_0x5e747b))[_0x400d('0x4f')](handleError(_0x402afd,null));};exports[_0x400d('0x50')]=function(_0x5e4cfc,_0x19e6ea){var _0x4c26d0={'raw':![],'where':{'id':_0x5e4cfc[_0x400d('0x51')]['id']}},_0x5670ea={};_0x5670ea[_0x400d('0x31')]=_['differenceBy'](_[_0x400d('0x37')](db[_0x400d('0x2f')][_0x400d('0x30')]),[_0x400d('0x32'),_0x400d('0x33')]);_0x5670ea[_0x400d('0x34')]=_[_0x400d('0x37')](_0x5e4cfc['query']);_0x5670ea[_0x400d('0x38')]=_[_0x400d('0x39')](_0x5670ea[_0x400d('0x31')],_0x5670ea[_0x400d('0x34')]);_0x4c26d0[_0x400d('0x3a')]=_['intersection'](_0x5670ea[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x5e4cfc[_0x400d('0x34')][_0x400d('0x3b')]));_0x4c26d0[_0x400d('0x3a')]=_0x4c26d0[_0x400d('0x3a')][_0x400d('0x3c')]?_0x4c26d0[_0x400d('0x3a')]:_0x5670ea[_0x400d('0x31')];if(_0x5e4cfc['query'][_0x400d('0x4b')]){_0x4c26d0['include']=[{'all':!![]}];}_0x4c26d0=_[_0x400d('0x42')]({},_0x4c26d0,_0x5e4cfc[_0x400d('0x49')]);return db[_0x400d('0x2f')][_0x400d('0x52')](_0x4c26d0)[_0x400d('0x16')](handleEntityNotFound(_0x19e6ea,null))['then'](respondWithResult(_0x19e6ea,null))[_0x400d('0x4f')](handleError(_0x19e6ea,null));};exports[_0x400d('0x53')]=function(_0x552e51,_0x350d56){return db[_0x400d('0x2f')][_0x400d('0x53')](_0x552e51['body'],{'raw':![],'individualHooks':!![]})[_0x400d('0x16')](respondWithResult(_0x350d56,0xc9))[_0x400d('0x4f')](handleError(_0x350d56,null));};exports['update']=function(_0x218d2f,_0x562ec8){if(_0x218d2f[_0x400d('0x54')]['id']){delete _0x218d2f[_0x400d('0x54')]['id'];}return db['User'][_0x400d('0x52')]({'where':{'id':_0x218d2f[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x562ec8,null))[_0x400d('0x16')](saveUpdates(_0x218d2f['body'],null))[_0x400d('0x16')](respondWithResult(_0x562ec8,null))[_0x400d('0x4f')](handleError(_0x562ec8,null));};exports['describe']=function(_0x2e31b9,_0x271ae7){return db[_0x400d('0x2f')]['describe']()[_0x400d('0x16')](respondWithResult(_0x271ae7,null))[_0x400d('0x4f')](handleError(_0x271ae7,null));};exports[_0x400d('0x55')]=function(_0x19c034,_0x2f860c,_0x501ad9){return db['User'][_0x400d('0x52')]({'where':{'id':_0x19c034['params']['id']}})['then'](handleEntityNotFound(_0x2f860c,null))[_0x400d('0x16')](function(_0x143892){if(_0x143892){return _0x143892['addContacts'](_0x19c034[_0x400d('0x54')]['ids'],_[_0x400d('0x56')](_0x19c034[_0x400d('0x54')],[_0x400d('0x57'),'id'])||{});}})['then'](respondWithResult(_0x2f860c,null))[_0x400d('0x4f')](handleError(_0x2f860c,null));};var getLicense=function(_0x213add){return new BPromise(function(_0x52e765,_0x262154){var _0x5c6eda=0x0;_0x213add[_0x400d('0x54')][_0x400d('0x58')]===_0x400d('0x59')&&_0x52e765('agent\x20role');return db[_0x400d('0x2f')][_0x400d('0x4a')]({'where':{'$or':[{'role':_0x213add['body']['role']===_0x400d('0x5a')?_0x400d('0x5a'):['admin',_0x400d('0x5b')]}]}})[_0x400d('0x16')](function(_0x26cccf){_0x5c6eda=_0x26cccf;return require(_0x400d('0x5c'))[_0x400d('0x5d')]();})[_0x400d('0x16')](function(_0x2a28b4){var _0x52eced=_0x213add[_0x400d('0x54')][_0x400d('0x58')]==='telephone'?_0x400d('0x5e'):'users';if(!_[_0x400d('0x5f')](_0x2a28b4[_0x52eced])&&_0x5c6eda>=_0x2a28b4[_0x52eced]){return _0x262154({'message':_0x400d('0x60')});}return _0x52e765(util['format']('count\x20%s:\x20%s',_0x52eced,_0x5c6eda));})[_0x400d('0x4f')](function(_0xa1670a){return _0x262154(_0xa1670a);});});};exports[_0x400d('0x61')]=function(_0x24ee79,_0x3abc03){return getLicense(_0x24ee79)[_0x400d('0x16')](function(_0x3aef8f){if(!_0x24ee79[_0x400d('0x54')][_0x400d('0x62')]){var _0x1c3606;return db[_0x400d('0x63')]['findById'](0x1)[_0x400d('0x16')](function(_0x302f59){_0x1c3606=_0x302f59[_0x400d('0x64')];return db[_0x400d('0x2f')][_0x400d('0x65')](_0x400d('0x62'));})['then'](function(_0x5231e3){if(_[_0x400d('0x5f')](_0x5231e3)){if(_0x1c3606){_0x24ee79[_0x400d('0x54')][_0x400d('0x62')]=_0x1c3606;}else{_0x24ee79[_0x400d('0x54')][_0x400d('0x62')]=0x1;}}else{if(_['isNil'](_0x1c3606)||_0x1c3606==_0x5231e3){_0x24ee79[_0x400d('0x54')][_0x400d('0x62')]=_0x5231e3+0x1;}else if(_0x1c3606>_0x5231e3){_0x24ee79[_0x400d('0x54')][_0x400d('0x62')]=_0x1c3606;}else{return db[_0x400d('0x46')][_0x400d('0x34')](_0x400d('0x66'),{'type':db['sequelize'][_0x400d('0x67')][_0x400d('0x68')]})['then'](function(_0x121f30){if(_0x121f30&&_0x121f30['length']){for(var _0x198592=0x0,_0x3d7003=_0x121f30['length'];_0x198592<_0x3d7003&&_['isNil'](_0x24ee79[_0x400d('0x54')][_0x400d('0x62')]);_0x198592++){if(_0x1c3606<=_0x121f30[_0x198592]['from']){_0x24ee79[_0x400d('0x54')]['internal']=_0x121f30[_0x198592]['from'];}else if(_0x1c3606>_0x121f30[_0x198592][_0x400d('0x69')]&&_0x1c3606<=_0x121f30[_0x198592]['to']){_0x24ee79[_0x400d('0x54')]['internal']=_0x1c3606;}}}if(_[_0x400d('0x5f')](_0x24ee79[_0x400d('0x54')][_0x400d('0x62')])){_0x24ee79[_0x400d('0x54')][_0x400d('0x62')]=_0x5231e3+0x1;}});}}});}})[_0x400d('0x16')](function(){if(_0x24ee79[_0x400d('0x54')]['voicemail']){_0x24ee79[_0x400d('0x54')][_0x400d('0x6a')]=_0x24ee79[_0x400d('0x54')][_0x400d('0x62')];_0x24ee79[_0x400d('0x54')]['VoiceMail']={'mailbox':_0x24ee79[_0x400d('0x54')][_0x400d('0x62')],'password':_0x24ee79[_0x400d('0x54')][_0x400d('0x32')],'fullname':_0x24ee79['body'][_0x400d('0x6b')],'email':_0x24ee79[_0x400d('0x54')][_0x400d('0x6c')]};}if(_0x24ee79[_0x400d('0x54')]&&_0x24ee79['body']['role']===_0x400d('0x59')){_0x24ee79[_0x400d('0x54')][_0x400d('0x6d')]=[_0x400d('0x6e'),_0x400d('0x6f'),_0x400d('0x70'),_0x400d('0x71'),_0x400d('0x72'),_0x400d('0x73'),_0x400d('0x74'),_0x400d('0x75'),'108',_0x400d('0x76'),'100',_0x400d('0x77')];}return db[_0x400d('0x2f')][_0x400d('0x61')](_0x24ee79[_0x400d('0x54')],{'include':[{'model':db['VoiceMail'],'as':_0x400d('0x78')}]});})[_0x400d('0x16')](respondWithResult(_0x3abc03,0xc9))[_0x400d('0x4f')](handleError(_0x3abc03,null));};exports[_0x400d('0x79')]=function(_0x2662b5,_0x593259,_0xf3581f){if(_0x2662b5[_0x400d('0x54')]['id']){delete _0x2662b5['body']['id'];}return db[_0x400d('0x2f')][_0x400d('0x52')]({'where':{'id':_0x2662b5['params']['id']}})[_0x400d('0x16')](function(_0x20083b){if(_0x20083b){if(_0x20083b['id']==_0x2662b5['user']['id']){if(!_0x2662b5['body'][_0x400d('0x7a')]||!_0x2662b5[_0x400d('0x54')][_0x400d('0x7b')]){throw new db[(_0x400d('0x7c'))]['ValidationError'](_0x400d('0x7d'));}if(!_0x20083b['authenticate'](_0x2662b5[_0x400d('0x54')]['oldPassword'])){throw new db['Sequelize'][(_0x400d('0x7e'))](_0x400d('0x7f'));}if(_0x2662b5[_0x400d('0x54')][_0x400d('0x7a')]==_0x2662b5[_0x400d('0x54')][_0x400d('0x7b')]){throw new db[(_0x400d('0x7c'))][(_0x400d('0x7e'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x20083b;}else if(_0x2662b5['user']['role']==_0x400d('0x80')){if(!_0x2662b5['body'][_0x400d('0x7b')]){throw new db[(_0x400d('0x7c'))][(_0x400d('0x7e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x20083b;}else if(_0x2662b5[_0x400d('0x5b')][_0x400d('0x58')]==_0x400d('0x5b')){if(!_0x2662b5[_0x400d('0x54')][_0x400d('0x7b')]){throw new db[(_0x400d('0x7c'))][(_0x400d('0x7e'))](_0x400d('0x81'));}if(_0x20083b[_0x400d('0x58')]!=_0x400d('0x59')){throw new db[(_0x400d('0x7c'))][(_0x400d('0x7e'))]('Unauthorized');}return _0x20083b;}else{throw new db[(_0x400d('0x7c'))]['ValidationError']('Unauthorized');}}return null;})[_0x400d('0x16')](handleEntityNotFound(_0x593259,null))[_0x400d('0x16')](saveUpdates({'password':_0x2662b5[_0x400d('0x54')]['newPassword'],'passwordResetAt':_0x2662b5[_0x400d('0x5b')]['id']==_0x2662b5[_0x400d('0x51')]['id']?moment():null},null))[_0x400d('0x16')](respondWithResult(_0x593259,null))['catch'](handleError(_0x593259,null));};exports['addQueues']=function(_0xf277fb,_0x194829,_0x50f0de){var _0x2c6c5a;return db[_0x400d('0x2f')][_0x400d('0x52')]({'where':{'id':_0xf277fb[_0x400d('0x51')]['id']},'attributes':['id',_0x400d('0x2d'),_0x400d('0x58'),_0x400d('0x82'),'voicePause']})['then'](handleEntityNotFound(_0x194829,null))[_0x400d('0x16')](function(_0x2f11b2){if(_0x2f11b2){_0x2c6c5a=_0x2f11b2;if(!utils['isValidChannel'](_0xf277fb[_0x400d('0x54')][_0x400d('0x83')])){throw new db[(_0x400d('0x7c'))][(_0x400d('0x7e'))](_0x400d('0x84'));}return _0x2f11b2['add'+_[_0x400d('0x85')](_0xf277fb[_0x400d('0x54')][_0x400d('0x83')][_0x400d('0x86')]())+_0x400d('0x87')](_0xf277fb[_0x400d('0x54')]['ids'],{'penalty':_0xf277fb[_0x400d('0x54')][_0x400d('0x88')]||0x0});}})[_0x400d('0x16')](function(){if(_0xf277fb[_0x400d('0x54')][_0x400d('0x83')]==='voice'){return db[_0x400d('0x89')][_0x400d('0x4d')]({'where':{'id':_0xf277fb[_0x400d('0x54')][_0x400d('0x57')]||[]},'raw':!![],'attributes':['id',_0x400d('0x2d')]});}})[_0x400d('0x16')](function(_0x498c35){var _0x279c40=[];if(_0xf277fb[_0x400d('0x54')][_0x400d('0x83')]===_0x400d('0x8a')&&_0x2c6c5a[_0x400d('0x58')]===_0x400d('0x59')){for(var _0xe3b34c=0x0;_0xe3b34c<_0x498c35[_0x400d('0x3c')];_0xe3b34c+=0x1){_0x279c40['push']({'membername':_0x2c6c5a[_0x400d('0x2d')],'UserId':_0x2c6c5a['id'],'queue_name':_0x498c35[_0xe3b34c][_0x400d('0x2d')],'VoiceQueueId':_0x498c35[_0xe3b34c]['id'],'interface':util[_0x400d('0x8b')](_0x400d('0x8c'),_0x400d('0x8d'),_0x2c6c5a['name']),'paused':_0x2c6c5a['voicePause']||![],'penalty':_0xf277fb[_0x400d('0x54')]['penalty']||0x0});}return BPromise[_0x400d('0x8e')](_0x279c40,function(_0x4db4af){return db['UserVoiceQueueRt'][_0x400d('0x8f')](_0x4db4af);});}return _0x2c6c5a;})[_0x400d('0x16')](respondWithStatusCode(_0x194829,null))['catch'](handleError(_0x194829,null));};exports[_0x400d('0x90')]=function(_0x127383,_0x24708f,_0x510dea){var _0x10de9a;return db['User']['find']({'where':{'id':_0x127383[_0x400d('0x51')]['id']},'attributes':['id','name',_0x400d('0x58')]})[_0x400d('0x16')](handleEntityNotFound(_0x24708f,null))[_0x400d('0x16')](function(_0x2a58bc){if(_0x2a58bc){_0x10de9a=_0x2a58bc;if(!_0x127383['query']['channel']||!utils[_0x400d('0x91')](_0x127383['query'][_0x400d('0x83')])){throw new db[(_0x400d('0x7c'))][(_0x400d('0x7e'))](_0x400d('0x84'));}return _0x2a58bc['remove'+_[_0x400d('0x85')](_0x127383[_0x400d('0x34')][_0x400d('0x83')][_0x400d('0x86')]())+_0x400d('0x87')](_0x127383[_0x400d('0x34')][_0x400d('0x57')]);}})[_0x400d('0x16')](function(_0x15ef0b){if(_0x127383[_0x400d('0x34')][_0x400d('0x83')]==='voice'){return db[_0x400d('0x92')][_0x400d('0x2b')]({'where':{'UserId':_0x127383[_0x400d('0x51')]['id'],'VoiceQueueId':_0x127383[_0x400d('0x34')][_0x400d('0x57')]},'individualHooks':!![]})['then'](function(){return _0x10de9a;});}return _0x10de9a;})[_0x400d('0x16')](respondWithStatusCode(_0x24708f,null))[_0x400d('0x4f')](handleError(_0x24708f,null));};exports['addAvatar']=function(_0x95dd92,_0x42ae41,_0x22c471){_0x95dd92[_0x400d('0x54')][_0x400d('0x93')]=_0x95dd92[_0x400d('0x94')]['filename'];return db[_0x400d('0x2f')]['find']({'where':{'id':_0x95dd92['params']['id']}})['then'](handleEntityNotFound(_0x42ae41,null))[_0x400d('0x16')](saveUpdates(_0x95dd92[_0x400d('0x54')],null))[_0x400d('0x16')](respondWithResult(_0x42ae41,null))[_0x400d('0x4f')](handleError(_0x42ae41,null));};exports[_0x400d('0x95')]=function(_0x5e98a7,_0x4ebf12,_0x410fc4){var _0x2e2924=path[_0x400d('0x96')](config['root'],_0x400d('0x97'));return db[_0x400d('0x2f')][_0x400d('0x52')]({'where':{'id':_0x5e98a7[_0x400d('0x51')]['id']},'attributes':['id',_0x400d('0x93')],'raw':!![]})[_0x400d('0x16')](handleEntityNotFound(_0x4ebf12,null))[_0x400d('0x16')](function(_0xc4fd18){if(_0xc4fd18){if(_['isNil'](_0xc4fd18[_0x400d('0x93')])){return _0x4ebf12[_0x400d('0x98')](_0x2e2924);}else{if(!fs[_0x400d('0x99')](path['join'](config['root'],'server/files/images/',_0xc4fd18[_0x400d('0x93')]))){return _0x4ebf12[_0x400d('0x98')](_0x2e2924);}return _0x4ebf12[_0x400d('0x98')](path['join'](config[_0x400d('0x9a')],_0x400d('0x9b'),_0xc4fd18['userpic']));}}})[_0x400d('0x4f')](handleError(_0x4ebf12,null));};exports[_0x400d('0x9c')]=function(_0x43ca1d,_0x4ea483,_0x1869d0){var _0x1211cb;var _0x7ebfdf={'where':{}},_0x52b74a={},_0x59ff5c={'count':0x0,'rows':[]};return db['User'][_0x400d('0x9d')]({'where':{'id':_0x43ca1d[_0x400d('0x51')]['id']}})['then'](handleEntityNotFound(_0x4ea483,null))[_0x400d('0x16')](function(_0x26c18b){if(_0x26c18b){_0x1211cb=_0x26c18b;_0x7ebfdf['where'][_0x400d('0x9e')]=_0x26c18b['id'];return db[_0x400d('0x9f')][_0x400d('0xa0')]();}})['then'](function(_0x1daacc){if(_0x1daacc){_0x52b74a[_0x400d('0x31')]=_[_0x400d('0x37')](_0x1daacc);_0x52b74a['query']=_[_0x400d('0x37')](_0x43ca1d[_0x400d('0x34')]);_0x52b74a['filters']=_[_0x400d('0x39')](_0x52b74a[_0x400d('0x31')],_0x52b74a[_0x400d('0x34')]);_0x7ebfdf[_0x400d('0x3a')]=_['intersection'](_0x52b74a[_0x400d('0x31')],qs['fields'](_0x43ca1d[_0x400d('0x34')][_0x400d('0x3b')]));_0x7ebfdf[_0x400d('0x3a')]=_0x7ebfdf[_0x400d('0x3a')][_0x400d('0x3c')]?_0x7ebfdf[_0x400d('0x3a')]:_0x52b74a[_0x400d('0x31')];if(!_0x43ca1d[_0x400d('0x34')]['hasOwnProperty'](_0x400d('0x3e'))){_0x7ebfdf[_0x400d('0x25')]=qs[_0x400d('0x25')](_0x43ca1d[_0x400d('0x34')][_0x400d('0x25')]);_0x7ebfdf[_0x400d('0x24')]=qs[_0x400d('0x24')](_0x43ca1d[_0x400d('0x34')][_0x400d('0x24')]);}_0x7ebfdf[_0x400d('0xa1')]=qs[_0x400d('0x3f')](_0x43ca1d[_0x400d('0x34')][_0x400d('0x3f')]);_0x7ebfdf['where']=qs['filters'](_[_0x400d('0xa2')](_0x43ca1d['query'],_0x52b74a['filters']));if(_0x43ca1d[_0x400d('0x34')][_0x400d('0x43')]){_0x7ebfdf['where']=_['merge'](_0x7ebfdf[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x7ebfdf['attributes'],function(_0x21d76c){var _0x502b33={};_0x502b33[_0x21d76c]={'$like':'%'+_0x43ca1d[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x502b33;})});}_0x7ebfdf=_[_0x400d('0x42')]({},_0x7ebfdf,_0x43ca1d[_0x400d('0x49')]);return _0x1211cb[_0x400d('0x9c')](_[_0x400d('0xa2')](_0x7ebfdf,[_0x400d('0x44')]))[_0x400d('0x16')](function(_0xecacf9){_0x59ff5c[_0x400d('0x4a')]=_0xecacf9['length']||0x0;if(_0x43ca1d[_0x400d('0x34')][_0x400d('0x4b')]){_0x7ebfdf[_0x400d('0x4c')]=[{'all':!![]}];}return _0x1211cb[_0x400d('0x9c')](_0x7ebfdf);})[_0x400d('0x16')](function(_0x5a804f){_0x59ff5c[_0x400d('0x4e')]=_0x5a804f;return _0x59ff5c;});}})[_0x400d('0x16')](respondWithFilteredResult(_0x4ea483,_0x7ebfdf))['catch'](handleError(_0x4ea483,null));};exports['getQueues']=function(_0x42e2c3,_0x4488e9,_0x48f7eb){var _0x10c862;var _0x81268c;var _0x3569aa={};var _0x5b62b6;return db[_0x400d('0x2f')][_0x400d('0x9d')]({'where':{'id':_0x42e2c3[_0x400d('0x51')]['id']},'attributes':['id',_0x400d('0x2d'),'role']})[_0x400d('0x16')](handleEntityNotFound(_0x4488e9,null))[_0x400d('0x16')](function(_0x618b34){if(!utils[_0x400d('0x91')](_0x42e2c3['query'][_0x400d('0x83')])){throw new db[(_0x400d('0x7c'))][(_0x400d('0x7e'))](_0x400d('0x84'));}_0x10c862=_0x618b34;var _0x8ee543={};_0x8ee543[_0x400d('0x31')]=_[_0x400d('0x37')](db[_[_0x400d('0x85')](_0x42e2c3[_0x400d('0x34')]['channel'])+_0x400d('0xa3')]['rawAttributes']);_0x8ee543[_0x400d('0x34')]=_['keys'](_0x42e2c3[_0x400d('0x34')]);_0x8ee543[_0x400d('0x38')]=_[_0x400d('0x39')](_0x8ee543[_0x400d('0x31')],_0x8ee543[_0x400d('0x34')]);_0x3569aa[_0x400d('0x3a')]=_[_0x400d('0x39')](_0x8ee543[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x42e2c3[_0x400d('0x34')][_0x400d('0x3b')]));_0x3569aa[_0x400d('0x3a')]=_0x3569aa[_0x400d('0x3a')]['length']?_0x3569aa[_0x400d('0x3a')]:_0x8ee543['model'];_0x3569aa['order']=qs[_0x400d('0x3f')](_0x42e2c3[_0x400d('0x34')][_0x400d('0x3f')]);_0x3569aa[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0x42e2c3[_0x400d('0x34')],_0x8ee543[_0x400d('0x38')]));if(_0x42e2c3[_0x400d('0x34')][_0x400d('0x43')]){_0x3569aa[_0x400d('0x44')]=_[_0x400d('0x42')](_0x3569aa['where'],{'$or':_[_0x400d('0x45')](_0x3569aa['attributes'],function(_0x5e2563){var _0x437132={};_0x437132[_0x5e2563]={'$like':'%'+_0x42e2c3[_0x400d('0x34')]['filter']+'%'};return _0x437132;})});}_0x3569aa=_[_0x400d('0x42')]({},_0x3569aa,_0x42e2c3[_0x400d('0x49')]);switch(_0x10c862[_0x400d('0x58')]){case'admin':return db[_['capitalize'](_0x42e2c3['query'][_0x400d('0x83')])+'Queue'][_0x400d('0x4d')](_0x3569aa);case _0x400d('0x5b'):case _0x400d('0x59'):return _0x10c862[_0x400d('0xa4')+_['capitalize'](_0x42e2c3[_0x400d('0x34')]['channel'])+_0x400d('0x87')](_0x3569aa);default:throw new db[(_0x400d('0x7c'))][(_0x400d('0x7e'))](_0x400d('0xa5'));}})[_0x400d('0x16')](function(_0x153951){_0x5b62b6=_0x153951[_0x400d('0x3c')];if(!_0x42e2c3['query'][_0x400d('0x3d')](_0x400d('0x3e'))){_0x3569aa[_0x400d('0x25')]=qs[_0x400d('0x25')](_0x42e2c3[_0x400d('0x34')][_0x400d('0x25')]);_0x3569aa[_0x400d('0x24')]=qs[_0x400d('0x24')](_0x42e2c3[_0x400d('0x34')]['offset']);}switch(_0x10c862[_0x400d('0x58')]){case'admin':return db[_[_0x400d('0x85')](_0x42e2c3['query']['channel'])+_0x400d('0xa3')]['findAll'](_0x3569aa);case'user':case _0x400d('0x59'):return _0x10c862[_0x400d('0xa4')+_['capitalize'](_0x42e2c3[_0x400d('0x34')][_0x400d('0x83')])+_0x400d('0x87')](_0x3569aa);}})[_0x400d('0x16')](function(_0x554dd9){return{'count':_0x5b62b6,'rows':_0x554dd9};})[_0x400d('0x16')](respondWithResult(_0x4488e9,null))['catch'](handleError(_0x4488e9,null));};exports['getVoiceQueuesRt']=function(_0x1cdac6,_0x13ab57,_0x1a25df){var _0x31b6cc={};var _0x37b841={};var _0xc23956;var _0x3a79bd;return db[_0x400d('0x2f')][_0x400d('0x9d')]({'where':{'id':_0x1cdac6[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x13ab57,null))[_0x400d('0x16')](function(_0x1a3631){if(_0x1a3631){_0xc23956=_0x1a3631;_0x37b841[_0x400d('0x31')]=_['keys'](db[_0x400d('0x92')][_0x400d('0x30')]);_0x37b841['query']=_['keys'](_0x1cdac6[_0x400d('0x34')]);_0x37b841[_0x400d('0x38')]=_[_0x400d('0x39')](_0x37b841[_0x400d('0x31')],_0x37b841[_0x400d('0x34')]);_0x31b6cc[_0x400d('0x3a')]=_[_0x400d('0x39')](_0x37b841[_0x400d('0x31')],qs['fields'](_0x1cdac6[_0x400d('0x34')]['fields']));_0x31b6cc[_0x400d('0x3a')]=_0x31b6cc[_0x400d('0x3a')][_0x400d('0x3c')]?_0x31b6cc['attributes']:_0x37b841['model'];_0x31b6cc[_0x400d('0xa1')]=qs[_0x400d('0x3f')](_0x1cdac6[_0x400d('0x34')][_0x400d('0x3f')]);_0x31b6cc[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0x1cdac6[_0x400d('0x34')],_0x37b841[_0x400d('0x38')]));if(_0x1cdac6[_0x400d('0x34')][_0x400d('0x43')]){_0x31b6cc[_0x400d('0x44')]=_['merge'](_0x31b6cc[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x31b6cc['attributes'],function(_0x800c5e){var _0x39b415={};_0x39b415[_0x800c5e]={'$like':'%'+_0x1cdac6['query'][_0x400d('0x43')]+'%'};return _0x39b415;})});}_0x31b6cc=_[_0x400d('0x42')]({},_0x31b6cc,_0x1cdac6[_0x400d('0x49')]);return _0xc23956[_0x400d('0xa6')](_0x31b6cc);}})[_0x400d('0x16')](function(_0x243692){if(_0x243692){_0x3a79bd=_0x243692['length'];if(!_0x1cdac6[_0x400d('0x34')][_0x400d('0x3d')](_0x400d('0x3e'))){_0x31b6cc[_0x400d('0x25')]=qs['limit'](_0x1cdac6[_0x400d('0x34')]['limit']);_0x31b6cc[_0x400d('0x24')]=qs['offset'](_0x1cdac6[_0x400d('0x34')]['offset']);}return _0xc23956['getVoiceQueuesRt'](_0x31b6cc);}})[_0x400d('0x16')](function(_0x29d71c){if(_0x29d71c){return _0x29d71c?{'count':_0x3a79bd,'rows':_0x29d71c}:null;}})[_0x400d('0x16')](respondWithResult(_0x13ab57,null))[_0x400d('0x4f')](handleError(_0x13ab57,null));};exports['getGroups']=function(_0x148486,_0x53a4b9,_0xd742cc){var _0x28ef5d={};var _0x5bf974={};var _0x444d8a;var _0x4dc4cc;return db[_0x400d('0x2f')][_0x400d('0x9d')]({'where':{'id':_0x148486[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x53a4b9,null))[_0x400d('0x16')](function(_0x5dfe4c){if(_0x5dfe4c){_0x444d8a=_0x5dfe4c;_0x5bf974[_0x400d('0x31')]=_[_0x400d('0x37')](db[_0x400d('0xa7')]['rawAttributes']);_0x5bf974['query']=_[_0x400d('0x37')](_0x148486[_0x400d('0x34')]);_0x5bf974[_0x400d('0x38')]=_[_0x400d('0x39')](_0x5bf974[_0x400d('0x31')],_0x5bf974['query']);_0x28ef5d[_0x400d('0x3a')]=_[_0x400d('0x39')](_0x5bf974[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x148486[_0x400d('0x34')][_0x400d('0x3b')]));_0x28ef5d[_0x400d('0x3a')]=_0x28ef5d[_0x400d('0x3a')][_0x400d('0x3c')]?_0x28ef5d[_0x400d('0x3a')]:_0x5bf974[_0x400d('0x31')];_0x28ef5d[_0x400d('0xa1')]=qs[_0x400d('0x3f')](_0x148486[_0x400d('0x34')][_0x400d('0x3f')]);_0x28ef5d[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0x148486[_0x400d('0x34')],_0x5bf974[_0x400d('0x38')]));if(_0x148486[_0x400d('0x34')][_0x400d('0x43')]){_0x28ef5d[_0x400d('0x44')]=_[_0x400d('0x42')](_0x28ef5d[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x28ef5d[_0x400d('0x3a')],function(_0x86ebd3){var _0x5cd440={};_0x5cd440[_0x86ebd3]={'$like':'%'+_0x148486[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x5cd440;})});}_0x28ef5d=_[_0x400d('0x42')]({},_0x28ef5d,_0x148486[_0x400d('0x49')]);return _0x444d8a[_0x400d('0xa8')](_0x28ef5d);}})['then'](function(_0x215ea0){if(_0x215ea0){_0x4dc4cc=_0x215ea0[_0x400d('0x3c')];if(!_0x148486[_0x400d('0x34')]['hasOwnProperty'](_0x400d('0x3e'))){_0x28ef5d[_0x400d('0x25')]=qs[_0x400d('0x25')](_0x148486['query']['limit']);_0x28ef5d[_0x400d('0x24')]=qs[_0x400d('0x24')](_0x148486[_0x400d('0x34')][_0x400d('0x24')]);}return _0x444d8a[_0x400d('0xa8')](_0x28ef5d);}})[_0x400d('0x16')](function(_0xe3f3d1){if(_0xe3f3d1){return _0xe3f3d1?{'count':_0x4dc4cc,'rows':_0xe3f3d1}:null;}})['then'](respondWithResult(_0x53a4b9,null))[_0x400d('0x4f')](handleError(_0x53a4b9,null));};exports['getRecordings']=function(_0x3e515c,_0x545ded,_0x1b13de){var _0x1fb0e9={'raw':!![],'where':{}};var _0x24b901={};var _0x288318={'count':0x0,'rows':[]};return db[_0x400d('0x2f')]['findOne']({'where':{'id':_0x3e515c['params']['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x545ded,null))[_0x400d('0x16')](function(_0x190198){if(_0x190198){_0x24b901[_0x400d('0x31')]=_['keys'](db[_0x400d('0xa9')][_0x400d('0x30')]);_0x24b901[_0x400d('0x34')]=_[_0x400d('0x37')](_0x3e515c[_0x400d('0x34')]);_0x24b901[_0x400d('0x38')]=_[_0x400d('0x39')](_0x24b901[_0x400d('0x31')],_0x24b901[_0x400d('0x34')]);_0x1fb0e9[_0x400d('0x3a')]=_['intersection'](_0x24b901[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x3e515c[_0x400d('0x34')][_0x400d('0x3b')]));_0x1fb0e9['attributes']=_0x1fb0e9[_0x400d('0x3a')][_0x400d('0x3c')]?_0x1fb0e9[_0x400d('0x3a')]:_0x24b901[_0x400d('0x31')];if(!_0x3e515c[_0x400d('0x34')][_0x400d('0x3d')]('nolimit')){_0x1fb0e9[_0x400d('0x25')]=qs['limit'](_0x3e515c['query']['limit']);_0x1fb0e9[_0x400d('0x24')]=qs[_0x400d('0x24')](_0x3e515c[_0x400d('0x34')][_0x400d('0x24')]);}_0x1fb0e9[_0x400d('0xa1')]=qs['sort'](_0x3e515c[_0x400d('0x34')]['sort']);_0x1fb0e9[_0x400d('0x44')]=qs[_0x400d('0x38')](_['pick'](_0x3e515c['query'],_0x24b901[_0x400d('0x38')]));_0x1fb0e9[_0x400d('0x44')]['UserId']=_0x190198['id'];if(_0x3e515c['query']['filter']){_0x1fb0e9['where']=_[_0x400d('0x42')](_0x1fb0e9[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x1fb0e9[_0x400d('0x3a')],function(_0x5648e3){var _0x313f01={};_0x313f01[_0x5648e3]={'$like':'%'+_0x3e515c[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x313f01;})});}_0x1fb0e9=_[_0x400d('0x42')]({},_0x1fb0e9,_0x3e515c['options']);return db['VoiceRecording']['count']({'where':_0x1fb0e9[_0x400d('0x44')]})[_0x400d('0x16')](function(_0x536fd1){_0x288318[_0x400d('0x4a')]=_0x536fd1;if(_0x3e515c['query'][_0x400d('0x4b')]){_0x1fb0e9[_0x400d('0x4c')]=[{'all':!![]}];}return db[_0x400d('0xa9')][_0x400d('0x4d')](_0x1fb0e9);})[_0x400d('0x16')](function(_0x3a8ed8){_0x288318['rows']=_0x3a8ed8;return _0x288318;});}})[_0x400d('0x16')](respondWithFilteredResult(_0x545ded,_0x1fb0e9))[_0x400d('0x4f')](handleError(_0x545ded,null));};exports[_0x400d('0xaa')]=function(_0x20d84e,_0x3d9499,_0x5a9be2){var _0x22b051={};var _0x3db91e={};var _0x4fff50;var _0x4ae6eb;return db[_0x400d('0x2f')][_0x400d('0x9d')]({'where':{'id':_0x20d84e[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x3d9499,null))['then'](function(_0x31a1ba){if(_0x31a1ba){_0x4fff50=_0x31a1ba;_0x3db91e[_0x400d('0x31')]=_[_0x400d('0x37')](db[_0x400d('0xab')][_0x400d('0x30')]);_0x3db91e[_0x400d('0x34')]=_[_0x400d('0x37')](_0x20d84e[_0x400d('0x34')]);_0x3db91e[_0x400d('0x38')]=_[_0x400d('0x39')](_0x3db91e[_0x400d('0x31')],_0x3db91e[_0x400d('0x34')]);_0x22b051[_0x400d('0x3a')]=_['intersection'](_0x3db91e[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x20d84e['query'][_0x400d('0x3b')]));_0x22b051[_0x400d('0x3a')]=_0x22b051[_0x400d('0x3a')][_0x400d('0x3c')]?_0x22b051[_0x400d('0x3a')]:_0x3db91e[_0x400d('0x31')];_0x22b051[_0x400d('0xa1')]=qs['sort'](_0x20d84e[_0x400d('0x34')][_0x400d('0x3f')]);_0x22b051['where']=qs['filters'](_[_0x400d('0xa2')](_0x20d84e[_0x400d('0x34')],_0x3db91e[_0x400d('0x38')]));if(_0x20d84e['query'][_0x400d('0x43')]){_0x22b051[_0x400d('0x44')]=_[_0x400d('0x42')](_0x22b051[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x22b051['attributes'],function(_0x3c4946){var _0x1ce99b={};_0x1ce99b[_0x3c4946]={'$like':'%'+_0x20d84e[_0x400d('0x34')]['filter']+'%'};return _0x1ce99b;})});}_0x22b051=_[_0x400d('0x42')]({},_0x22b051,_0x20d84e[_0x400d('0x49')]);return _0x4fff50[_0x400d('0xaa')](_0x22b051);}})['then'](function(_0x24fb3f){if(_0x24fb3f){_0x4ae6eb=_0x24fb3f[_0x400d('0x3c')];if(!_0x20d84e[_0x400d('0x34')]['hasOwnProperty'](_0x400d('0x3e'))){_0x22b051[_0x400d('0x25')]=qs[_0x400d('0x25')](_0x20d84e[_0x400d('0x34')][_0x400d('0x25')]);_0x22b051[_0x400d('0x24')]=qs[_0x400d('0x24')](_0x20d84e['query'][_0x400d('0x24')]);}return _0x4fff50[_0x400d('0xaa')](_0x22b051);}})[_0x400d('0x16')](function(_0x18d08b){if(_0x18d08b){return _0x18d08b?{'count':_0x4ae6eb,'rows':_0x18d08b}:null;}})['then'](respondWithResult(_0x3d9499,null))[_0x400d('0x4f')](handleError(_0x3d9499,null));};exports[_0x400d('0xac')]=function(_0x31e6b3,_0x16b183,_0x152a71){var _0x5c8672={};var _0x2b5765={};var _0x22e5d6;var _0x2171c5;return db['User']['findOne']({'where':{'id':_0x31e6b3[_0x400d('0x51')]['id']}})['then'](handleEntityNotFound(_0x16b183,null))[_0x400d('0x16')](function(_0xdb692a){if(_0xdb692a){_0x22e5d6=_0xdb692a;_0x2b5765[_0x400d('0x31')]=_[_0x400d('0x37')](db[_0x400d('0xad')]['rawAttributes']);_0x2b5765[_0x400d('0x34')]=_[_0x400d('0x37')](_0x31e6b3['query']);_0x2b5765[_0x400d('0x38')]=_['intersection'](_0x2b5765['model'],_0x2b5765[_0x400d('0x34')]);_0x5c8672[_0x400d('0x3a')]=_[_0x400d('0x39')](_0x2b5765[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x31e6b3[_0x400d('0x34')][_0x400d('0x3b')]));_0x5c8672[_0x400d('0x3a')]=_0x5c8672['attributes'][_0x400d('0x3c')]?_0x5c8672['attributes']:_0x2b5765[_0x400d('0x31')];_0x5c8672[_0x400d('0xa1')]=qs['sort'](_0x31e6b3[_0x400d('0x34')][_0x400d('0x3f')]);_0x5c8672[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0x31e6b3[_0x400d('0x34')],_0x2b5765[_0x400d('0x38')]));if(_0x31e6b3[_0x400d('0x34')][_0x400d('0x43')]){_0x5c8672[_0x400d('0x44')]=_['merge'](_0x5c8672['where'],{'$or':_[_0x400d('0x45')](_0x5c8672[_0x400d('0x3a')],function(_0x1f3065){var _0x1dc542={};_0x1dc542[_0x1f3065]={'$like':'%'+_0x31e6b3[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x1dc542;})});}_0x5c8672=_[_0x400d('0x42')]({},_0x5c8672,_0x31e6b3[_0x400d('0x49')]);return _0x22e5d6[_0x400d('0xac')](_0x5c8672);}})[_0x400d('0x16')](function(_0x3b8314){if(_0x3b8314){_0x2171c5=_0x3b8314[_0x400d('0x3c')];if(!_0x31e6b3[_0x400d('0x34')][_0x400d('0x3d')](_0x400d('0x3e'))){_0x5c8672[_0x400d('0x25')]=qs[_0x400d('0x25')](_0x31e6b3[_0x400d('0x34')][_0x400d('0x25')]);_0x5c8672[_0x400d('0x24')]=qs[_0x400d('0x24')](_0x31e6b3['query'][_0x400d('0x24')]);}return _0x22e5d6[_0x400d('0xac')](_0x5c8672);}})[_0x400d('0x16')](function(_0x4202d4){if(_0x4202d4){return _0x4202d4?{'count':_0x2171c5,'rows':_0x4202d4}:null;}})[_0x400d('0x16')](respondWithResult(_0x16b183,null))[_0x400d('0x4f')](handleError(_0x16b183,null));};exports[_0x400d('0xae')]=function(_0x2c0940,_0x5288a5,_0x5ceab9){var _0x328743={'raw':!![],'where':{}};var _0x42c123={};var _0x863298={'count':0x0,'rows':[]};return db['User'][_0x400d('0x9d')]({'where':{'id':_0x2c0940[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x5288a5,null))[_0x400d('0x16')](function(_0x1ef515){if(_0x1ef515){_0x42c123[_0x400d('0x31')]=_['keys'](db['MailInteraction'][_0x400d('0x30')]);_0x42c123[_0x400d('0x34')]=_[_0x400d('0x37')](_0x2c0940[_0x400d('0x34')]);_0x42c123[_0x400d('0x38')]=_['intersection'](_0x42c123[_0x400d('0x31')],_0x42c123[_0x400d('0x34')]);_0x328743[_0x400d('0x3a')]=_['intersection'](_0x42c123[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x2c0940['query'][_0x400d('0x3b')]));_0x328743[_0x400d('0x3a')]=_0x328743['attributes'][_0x400d('0x3c')]?_0x328743[_0x400d('0x3a')]:_0x42c123[_0x400d('0x31')];if(!_0x2c0940['query'][_0x400d('0x3d')](_0x400d('0x3e'))){_0x328743['limit']=qs['limit'](_0x2c0940[_0x400d('0x34')][_0x400d('0x25')]);_0x328743[_0x400d('0x24')]=qs['offset'](_0x2c0940[_0x400d('0x34')][_0x400d('0x24')]);}_0x328743[_0x400d('0xa1')]=qs[_0x400d('0x3f')](_0x2c0940[_0x400d('0x34')][_0x400d('0x3f')]);_0x328743[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0x2c0940[_0x400d('0x34')],_0x42c123[_0x400d('0x38')]));_0x328743[_0x400d('0x44')]['UserId']=_0x1ef515['id'];if(_0x2c0940[_0x400d('0x34')][_0x400d('0x43')]){_0x328743[_0x400d('0x44')]=_[_0x400d('0x42')](_0x328743[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x328743[_0x400d('0x3a')],function(_0x242ba0){var _0x53bb38={};_0x53bb38[_0x242ba0]={'$like':'%'+_0x2c0940[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x53bb38;})});}_0x328743=_[_0x400d('0x42')]({},_0x328743,_0x2c0940[_0x400d('0x49')]);return db[_0x400d('0xaf')]['count']({'where':_0x328743[_0x400d('0x44')]})[_0x400d('0x16')](function(_0x48fc74){_0x863298[_0x400d('0x4a')]=_0x48fc74;if(_0x2c0940[_0x400d('0x34')][_0x400d('0x4b')]){_0x328743[_0x400d('0x4c')]=[{'all':!![]}];}return db['MailInteraction'][_0x400d('0x4d')](_0x328743);})[_0x400d('0x16')](function(_0x1740f9){_0x863298[_0x400d('0x4e')]=_0x1740f9;return _0x863298;});}})[_0x400d('0x16')](respondWithFilteredResult(_0x5288a5,_0x328743))[_0x400d('0x4f')](handleError(_0x5288a5,null));};exports['getSmsInteractions']=function(_0xf20ace,_0x341088,_0x3f29f4){var _0x56c562={};var _0x5a32c0={};var _0x251a88;var _0x59318e;return db[_0x400d('0x2f')][_0x400d('0x9d')]({'where':{'id':_0xf20ace[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x341088,null))['then'](function(_0x2961aa){if(_0x2961aa){_0x251a88=_0x2961aa;_0x5a32c0[_0x400d('0x31')]=_[_0x400d('0x37')](db[_0x400d('0xb0')]['rawAttributes']);_0x5a32c0[_0x400d('0x34')]=_['keys'](_0xf20ace[_0x400d('0x34')]);_0x5a32c0['filters']=_[_0x400d('0x39')](_0x5a32c0['model'],_0x5a32c0[_0x400d('0x34')]);_0x56c562[_0x400d('0x3a')]=_[_0x400d('0x39')](_0x5a32c0[_0x400d('0x31')],qs['fields'](_0xf20ace[_0x400d('0x34')][_0x400d('0x3b')]));_0x56c562['attributes']=_0x56c562[_0x400d('0x3a')][_0x400d('0x3c')]?_0x56c562['attributes']:_0x5a32c0[_0x400d('0x31')];_0x56c562[_0x400d('0xa1')]=qs[_0x400d('0x3f')](_0xf20ace['query'][_0x400d('0x3f')]);_0x56c562[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0xf20ace['query'],_0x5a32c0[_0x400d('0x38')]));if(_0xf20ace['query']['filter']){_0x56c562[_0x400d('0x44')]=_[_0x400d('0x42')](_0x56c562['where'],{'$or':_[_0x400d('0x45')](_0x56c562['attributes'],function(_0x913c1e){var _0x47ace7={};_0x47ace7[_0x913c1e]={'$like':'%'+_0xf20ace[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x47ace7;})});}_0x56c562=_[_0x400d('0x42')]({},_0x56c562,_0xf20ace[_0x400d('0x49')]);return _0x251a88[_0x400d('0xb1')](_0x56c562);}})['then'](function(_0xfca34){if(_0xfca34){_0x59318e=_0xfca34['length'];if(!_0xf20ace[_0x400d('0x34')]['hasOwnProperty']('nolimit')){_0x56c562[_0x400d('0x25')]=qs[_0x400d('0x25')](_0xf20ace['query'][_0x400d('0x25')]);_0x56c562['offset']=qs[_0x400d('0x24')](_0xf20ace[_0x400d('0x34')][_0x400d('0x24')]);}return _0x251a88[_0x400d('0xb1')](_0x56c562);}})[_0x400d('0x16')](function(_0x55ab62){if(_0x55ab62){return _0x55ab62?{'count':_0x59318e,'rows':_0x55ab62}:null;}})[_0x400d('0x16')](respondWithResult(_0x341088,null))[_0x400d('0x4f')](handleError(_0x341088,null));};exports[_0x400d('0xb2')]=function(_0x2385d1,_0x3fde84,_0x2995c0){var _0x3fe768={};var _0x2451e2={};var _0x120faf;var _0x478eeb;return db[_0x400d('0x2f')][_0x400d('0x9d')]({'where':{'id':_0x2385d1['params']['id']}})['then'](handleEntityNotFound(_0x3fde84,null))[_0x400d('0x16')](function(_0x183754){if(_0x183754){_0x120faf=_0x183754;_0x2451e2[_0x400d('0x31')]=_[_0x400d('0x37')](db['FaxInteraction'][_0x400d('0x30')]);_0x2451e2['query']=_[_0x400d('0x37')](_0x2385d1['query']);_0x2451e2['filters']=_[_0x400d('0x39')](_0x2451e2[_0x400d('0x31')],_0x2451e2[_0x400d('0x34')]);_0x3fe768[_0x400d('0x3a')]=_[_0x400d('0x39')](_0x2451e2[_0x400d('0x31')],qs['fields'](_0x2385d1['query'][_0x400d('0x3b')]));_0x3fe768[_0x400d('0x3a')]=_0x3fe768[_0x400d('0x3a')][_0x400d('0x3c')]?_0x3fe768[_0x400d('0x3a')]:_0x2451e2[_0x400d('0x31')];_0x3fe768[_0x400d('0xa1')]=qs[_0x400d('0x3f')](_0x2385d1[_0x400d('0x34')][_0x400d('0x3f')]);_0x3fe768['where']=qs[_0x400d('0x38')](_['pick'](_0x2385d1['query'],_0x2451e2[_0x400d('0x38')]));if(_0x2385d1[_0x400d('0x34')][_0x400d('0x43')]){_0x3fe768['where']=_[_0x400d('0x42')](_0x3fe768[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x3fe768[_0x400d('0x3a')],function(_0x151aaf){var _0x40b9d2={};_0x40b9d2[_0x151aaf]={'$like':'%'+_0x2385d1[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x40b9d2;})});}_0x3fe768=_[_0x400d('0x42')]({},_0x3fe768,_0x2385d1[_0x400d('0x49')]);return _0x120faf[_0x400d('0xb2')](_0x3fe768);}})['then'](function(_0x37d482){if(_0x37d482){_0x478eeb=_0x37d482[_0x400d('0x3c')];if(!_0x2385d1['query']['hasOwnProperty']('nolimit')){_0x3fe768[_0x400d('0x25')]=qs[_0x400d('0x25')](_0x2385d1['query'][_0x400d('0x25')]);_0x3fe768[_0x400d('0x24')]=qs[_0x400d('0x24')](_0x2385d1[_0x400d('0x34')][_0x400d('0x24')]);}return _0x120faf[_0x400d('0xb2')](_0x3fe768);}})[_0x400d('0x16')](function(_0x298045){if(_0x298045){return _0x298045?{'count':_0x478eeb,'rows':_0x298045}:null;}})[_0x400d('0x16')](respondWithResult(_0x3fde84,null))[_0x400d('0x4f')](handleError(_0x3fde84,null));};exports['login']=function(_0x384799,_0x121d4f,_0x4c2cc3){var _0x1f83e5;var _0x55083e;var _0x1d2262;return db[_0x400d('0x2f')][_0x400d('0x52')]({'where':{'id':_0x384799['params']['id'],'role':'agent'},'attributes':['id',_0x400d('0x2d'),'phone',_0x400d('0xb3'),'role',_0x400d('0x62'),_0x400d('0x82')]})[_0x400d('0x16')](handleEntityNotFound(_0x121d4f,null))[_0x400d('0x16')](function(_0x2a13b6){if(_0x2a13b6){_0x1f83e5=_0x2a13b6;_0x1d2262=_0x384799[_0x400d('0x54')]['interface']&&_0x1f83e5[_0x384799[_0x400d('0x54')][_0x400d('0xb4')]]?util[_0x400d('0x8b')]('LOCAL/%s@from-sip/n',_0x1f83e5[_0x384799[_0x400d('0x54')]['interface']]):util[_0x400d('0x8b')](_0x400d('0xb5'),_0x1f83e5['name']);socket['to'](util[_0x400d('0x8b')]('user:%s',_0x1f83e5[_0x400d('0x2d')]))[_0x400d('0xb6')](_0x400d('0xb7'),{'ip':_0x384799[_0x400d('0xb8')][_0x400d('0xb9')]||_0x384799[_0x400d('0xba')][_0x400d('0xbb')]||_0x384799[_0x400d('0xbc')][_0x400d('0xbb')]||_0x384799['connection']['socket'][_0x400d('0xbb')]});return db[_0x400d('0x92')][_0x400d('0x2b')]({'where':{'membername':_0x1f83e5[_0x400d('0x2d')]},'individualHooks':!![]});}})[_0x400d('0x16')](function(_0x4b78d7){if(_0x1f83e5){return _0x1f83e5[_0x400d('0xbd')]({'raw':!![]});}})['then'](function(_0x122db1){var _0x425bf3=[];if(_0x122db1){_0x55083e=_0x122db1;if(_0x55083e[_0x400d('0x3c')]){for(var _0x1d74bd=0x0;_0x1d74bd<_0x55083e[_0x400d('0x3c')];_0x1d74bd++){_0x425bf3['push']({'membername':_0x1f83e5[_0x400d('0x2d')],'UserId':_0x1f83e5['id'],'queue_name':_0x55083e[_0x1d74bd][_0x400d('0x2d')],'VoiceQueueId':_0x55083e[_0x1d74bd]['id'],'interface':_0x1d2262||util[_0x400d('0x8b')](_0x400d('0x8c'),_0x400d('0x8d'),_0x1f83e5[_0x400d('0x2d')]),'paused':_0x1f83e5[_0x400d('0x82')]||![],'penalty':_0x55083e[_0x1d74bd]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x400d('0x8e')](_0x425bf3,function(_0x5bb126){return db['UserVoiceQueueRt'][_0x400d('0x8f')](_0x5bb126);});}}})[_0x400d('0x16')](function(){return db['MemberReport'][_0x400d('0x4d')]({'where':{'membername':_0x1f83e5[_0x400d('0x2d')],'interface':util[_0x400d('0x8b')](_0x400d('0x8c'),'SIP',_0x1f83e5[_0x400d('0x2d')]),'exitAt':null}});})['then'](function(_0x3ff58c){var _0x37a2fa=[];_0x3ff58c['forEach'](function(_0x4b5d48){_0x37a2fa[_0x400d('0xbe')](_0x4b5d48[_0x400d('0x2a')]({'exitAt':moment()[_0x400d('0x8b')](_0x400d('0xbf'))}));});return BPromise[_0x400d('0xc0')](_0x37a2fa);})[_0x400d('0x16')](function(){var _0x445cc5=[];var _0x536264=[];var _0x51b759=utils['getChannels']();var _0x451ccd={'membername':_0x1f83e5[_0x400d('0x2d')],'interface':util['format']('%s/%s',_0x400d('0x8d'),_0x1f83e5[_0x400d('0x2d')]),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1f83e5[_0x400d('0x58')],'internal':_0x1f83e5[_0x400d('0x62')]};_0x51b759['forEach'](function(_0x7ce44){_0x445cc5[_0x400d('0xbe')](_['merge']({'channel':_0x7ce44,'type':'LOGIN','data1':_0x384799[_0x400d('0x54')][_0x400d('0xc1')],'data2':_0x1d2262},_0x451ccd));if(_0x1f83e5[_0x400d('0x82')]){_0x536264[_0x400d('0xbe')](_[_0x400d('0x42')]({'channel':_0x7ce44,'type':_0x400d('0xc2'),'data1':'LOGININPAUSE'},_0x451ccd));}});return db[_0x400d('0xc3')][_0x400d('0x53')](_0x445cc5['concat'](_0x536264),{'individualHooks':!![]});})[_0x400d('0x16')](function(){return _0x1f83e5[_0x400d('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x400d('0x8b')](_0x400d('0xbf')),'voicePause':_0x1f83e5[_0x400d('0x82')]||![],'mailPause':_0x1f83e5[_0x400d('0x82')]||![],'chatPause':_0x1f83e5['loginInPause']||![],'faxPause':_0x1f83e5[_0x400d('0x82')]||![],'smsPause':_0x1f83e5[_0x400d('0x82')]||![],'openchannelPause':_0x1f83e5['loginInPause']||![],'pauseType':_0x1f83e5[_0x400d('0x82')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x400d('0x8b')](_0x400d('0xbf'))});})['then'](respondWithResult(_0x121d4f,null))['catch'](handleError(_0x121d4f,null));};exports[_0x400d('0xc4')]=function(_0x4190c5,_0x5a184c,_0x1acbb9){var _0x5eeec5;return db[_0x400d('0x2f')][_0x400d('0x52')]({'where':{'id':_0x4190c5[_0x400d('0x51')]['id'],'role':'agent'},'attributes':['id','name',_0x400d('0x58')]})['then'](handleEntityNotFound(_0x5a184c,null))[_0x400d('0x16')](function(_0x28c8e9){if(_0x28c8e9){_0x5eeec5=_0x28c8e9;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x5eeec5[_0x400d('0x2d')]},'individualHooks':!![]});}})[_0x400d('0x16')](function(){return db[_0x400d('0xc3')]['findAll']({'where':{'membername':_0x5eeec5[_0x400d('0x2d')],'interface':util[_0x400d('0x8b')](_0x400d('0x8c'),_0x400d('0x8d'),_0x5eeec5[_0x400d('0x2d')]),'exitAt':null}});})[_0x400d('0x16')](function(_0x332970){var _0x527878=[];_0x332970['forEach'](function(_0x540f3a){_0x527878[_0x400d('0xbe')](_0x540f3a[_0x400d('0x2a')]({'exitAt':moment()[_0x400d('0x8b')](_0x400d('0xbf'))}));});return BPromise[_0x400d('0xc0')](_0x527878);})['then'](function(){return _0x5eeec5[_0x400d('0x2a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});})['then'](respondWithResult(_0x5a184c,null))['catch'](handleError(_0x5a184c,null));};exports[_0x400d('0xc5')]=function(_0x5a9755,_0xa92e2f,_0x190eca){var _0x5c87cb;return db[_0x400d('0x92')]['update']({'paused':0x1},{'where':{'UserId':_0x5a9755['params']['id']},'individualHooks':!![]})[_0x400d('0x16')](function(){return db['User'][_0x400d('0x52')]({'where':{'id':_0x5a9755[_0x400d('0x51')]['id'],'role':_0x400d('0x59')},'attributes':['id','name','role',_0x400d('0x62')]});})['then'](handleEntityNotFound(_0xa92e2f,null))[_0x400d('0x16')](function(_0x372695){if(_0x372695){_0x5c87cb=_0x372695;return respondWithRpcPromise('QueuePause',_0x400d('0xc5'),{'id':_0x5c87cb['id'],'name':_0x5c87cb[_0x400d('0x2d')],'pause':!![]});}})[_0x400d('0x16')](function(){if(_0x5c87cb){return db[_0x400d('0xc3')][_0x400d('0x4d')]({'where':{'membername':_0x5c87cb[_0x400d('0x2d')],'interface':util['format'](_0x400d('0x8c'),_0x400d('0x8d'),_0x5c87cb['name']),'type':_0x400d('0xc2'),'exitAt':null}});}})[_0x400d('0x16')](function(_0x2ea633){if(_0x2ea633[_0x400d('0x3c')]){var _0x594e3e=moment()[_0x400d('0x8b')](_0x400d('0xbf'));for(var _0x537c99=0x0,_0x183b1d=_0x2ea633[_0x400d('0x3c')];_0x537c99<_0x183b1d;_0x537c99++){_0x2ea633[_0x537c99][_0x400d('0xc6')]({'exitAt':_0x594e3e});}}})[_0x400d('0x16')](function(){var _0x130424=[];var _0x46388a=utils['getChannels']();_0x46388a[_0x400d('0xc7')](function(_0x4da3dd){_0x130424['push']({'channel':_0x4da3dd,'membername':_0x5c87cb['name'],'interface':util[_0x400d('0x8b')](_0x400d('0x8c'),_0x400d('0x8d'),_0x5c87cb[_0x400d('0x2d')]),'type':_0x400d('0xc2'),'enterAt':moment()[_0x400d('0x8b')](_0x400d('0xbf')),'data1':_0x5a9755[_0x400d('0x54')][_0x400d('0xc8')]||'DEFAULT\x20PAUSE','role':_0x5c87cb[_0x400d('0x58')],'internal':_0x5c87cb[_0x400d('0x62')]});});return db[_0x400d('0xc3')][_0x400d('0x53')](_0x130424,{'individualHooks':!![]});})[_0x400d('0x16')](function(){return _0x5c87cb[_0x400d('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5a9755[_0x400d('0x54')][_0x400d('0xc8')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x400d('0x8b')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x400d('0x16')](respondWithResult(_0xa92e2f,null))[_0x400d('0x4f')](handleError(_0xa92e2f,null));};exports[_0x400d('0xc9')]=function(_0x137ff2,_0x5cbf57,_0x393648){var _0x500aac;return db[_0x400d('0x2f')][_0x400d('0x52')]({'where':{'id':_0x137ff2[_0x400d('0x51')]['id']},'attributes':['id','name',_0x400d('0x58'),_0x400d('0xca'),'mailPause',_0x400d('0xcb'),_0x400d('0xcc'),'openchannelPause','smsPause',_0x400d('0xcd'),_0x400d('0xce')]})['then'](handleEntityNotFound(_0x5cbf57,null))[_0x400d('0x16')](function(_0x2c1b2d){if(_0x2c1b2d){_0x500aac=_0x2c1b2d;if(_0x137ff2['body']['channel']&&!utils['isValidChannel'](_0x137ff2[_0x400d('0x54')][_0x400d('0x83')])){throw new db['Sequelize'][(_0x400d('0x7e'))](_0x400d('0x84'));}switch(_0x137ff2[_0x400d('0x54')]['channel']){case _0x400d('0x8a'):return respondWithRpcPromise(_0x400d('0xcf'),'unpause',{'id':_0x500aac['id'],'name':_0x500aac[_0x400d('0x2d')],'pause':![]})['then'](function(){return db[_0x400d('0x92')][_0x400d('0x2a')]({'paused':0x0},{'where':{'UserId':_0x500aac['id']},'individualHooks':!![]});})[_0x400d('0x16')](function(){return db[_0x400d('0xc3')][_0x400d('0x52')]({'where':{'channel':_0x137ff2[_0x400d('0x54')][_0x400d('0x83')],'membername':_0x500aac[_0x400d('0x2d')],'interface':util[_0x400d('0x8b')]('%s/%s','SIP',_0x500aac['name']),'type':'PAUSE','exitAt':null}});})[_0x400d('0x16')](function(_0xc587ee){if(_0xc587ee){return _0xc587ee[_0x400d('0x2a')]({'exitAt':moment()[_0x400d('0x8b')](_0x400d('0xbf')),'data2':_0x400d('0xd0')},{'individualHooks':!![]});}return null;})[_0x400d('0x16')](function(){return _0x500aac[_0x400d('0x2a')]({'voicePause':![]});});case _0x400d('0xd1'):case _0x400d('0xd2'):case _0x400d('0xd3'):case _0x400d('0xd4'):case _0x400d('0xd5'):return db[_0x400d('0xc3')]['find']({'where':{'channel':_0x137ff2['body'][_0x400d('0x83')],'membername':_0x500aac[_0x400d('0x2d')],'interface':util[_0x400d('0x8b')](_0x400d('0x8c'),_0x400d('0x8d'),_0x500aac['name']),'type':_0x400d('0xc2'),'exitAt':null}})['then'](function(_0x1ef049){if(_0x1ef049){return _0x1ef049['update']({'exitAt':moment()[_0x400d('0x8b')](_0x400d('0xbf')),'data2':_0x400d('0xd0')},{'individualHooks':!![]});}return null;})[_0x400d('0x16')](function(){var _0x4793fb={};_[_0x400d('0x26')](_0x4793fb,util[_0x400d('0x8b')]('%s%s',_0x137ff2[_0x400d('0x54')][_0x400d('0x83')],'Pause'),![]);return _0x500aac[_0x400d('0x2a')](_0x4793fb);});default:return respondWithRpcPromise(_0x400d('0xcf'),'unpause',{'id':_0x500aac['id'],'name':_0x500aac[_0x400d('0x2d')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x400d('0x2a')]({'paused':0x0},{'where':{'UserId':_0x500aac['id']}});})[_0x400d('0x16')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x500aac[_0x400d('0x2d')],'interface':util['format'](_0x400d('0x8c'),_0x400d('0x8d'),_0x500aac[_0x400d('0x2d')]),'type':_0x400d('0xc2'),'exitAt':null}});})[_0x400d('0x16')](function(_0x3c9b31){var _0x33befc=[];_0x3c9b31[_0x400d('0xc7')](function(_0x46dad3){_0x33befc['push'](_0x46dad3[_0x400d('0x2a')]({'exitAt':moment()['format'](_0x400d('0xbf')),'data2':_0x400d('0xd0')}));});return BPromise['all'](_0x33befc);})[_0x400d('0x16')](function(){return _0x500aac[_0x400d('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x400d('0x16')](respondWithResult(_0x5cbf57,null))[_0x400d('0x4f')](handleError(_0x5cbf57,null));};exports['getTeams']=function(_0x1ceb38,_0x20c6db,_0x556033){var _0x25ad4e={};var _0x5380b9={};var _0xd1a66e;var _0x1d9fac;return db['User']['findOne']({'where':{'id':_0x1ceb38[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x20c6db,null))[_0x400d('0x16')](function(_0x2d4390){if(_0x2d4390){_0xd1a66e=_0x2d4390;_0x5380b9[_0x400d('0x31')]=_[_0x400d('0x37')](db[_0x400d('0xd6')][_0x400d('0x30')]);_0x5380b9['query']=_[_0x400d('0x37')](_0x1ceb38['query']);_0x5380b9[_0x400d('0x38')]=_[_0x400d('0x39')](_0x5380b9['model'],_0x5380b9['query']);_0x25ad4e[_0x400d('0x3a')]=_[_0x400d('0x39')](_0x5380b9[_0x400d('0x31')],qs['fields'](_0x1ceb38[_0x400d('0x34')]['fields']));_0x25ad4e[_0x400d('0x3a')]=_0x25ad4e['attributes']['length']?_0x25ad4e[_0x400d('0x3a')]:_0x5380b9[_0x400d('0x31')];_0x25ad4e[_0x400d('0xa1')]=qs['sort'](_0x1ceb38[_0x400d('0x34')][_0x400d('0x3f')]);_0x25ad4e[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0x1ceb38['query'],_0x5380b9[_0x400d('0x38')]));if(_0x1ceb38[_0x400d('0x34')][_0x400d('0x43')]){_0x25ad4e[_0x400d('0x44')]=_['merge'](_0x25ad4e[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x25ad4e[_0x400d('0x3a')],function(_0x49334c){var _0x2f364f={};_0x2f364f[_0x49334c]={'$like':'%'+_0x1ceb38[_0x400d('0x34')]['filter']+'%'};return _0x2f364f;})});}_0x25ad4e=_[_0x400d('0x42')]({},_0x25ad4e,_0x1ceb38[_0x400d('0x49')]);return _0xd1a66e[_0x400d('0xd7')](_0x25ad4e);}})[_0x400d('0x16')](function(_0x342c58){if(_0x342c58){_0x1d9fac=_0x342c58[_0x400d('0x3c')];if(!_0x1ceb38[_0x400d('0x34')][_0x400d('0x3d')](_0x400d('0x3e'))){_0x25ad4e[_0x400d('0x25')]=qs[_0x400d('0x25')](_0x1ceb38[_0x400d('0x34')][_0x400d('0x25')]);_0x25ad4e['offset']=qs[_0x400d('0x24')](_0x1ceb38[_0x400d('0x34')][_0x400d('0x24')]);}return _0xd1a66e['getTeams'](_0x25ad4e);}})['then'](function(_0x153f3c){if(_0x153f3c){return _0x153f3c?{'count':_0x1d9fac,'rows':_0x153f3c}:null;}})['then'](respondWithResult(_0x20c6db,null))[_0x400d('0x4f')](handleError(_0x20c6db,null));};exports[_0x400d('0xd8')]=function(_0x28cf60,_0x315235,_0x5df740){return db[_0x400d('0x2f')]['find']({'where':{'id':_0x28cf60['params']['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x315235,null))['then'](function(_0x4c1a3e){if(_0x4c1a3e){return _0x4c1a3e['addTeams'](_0x28cf60[_0x400d('0x54')][_0x400d('0x57')],_[_0x400d('0x56')](_0x28cf60[_0x400d('0x54')],['ids','id'])||{});}})[_0x400d('0x16')](respondWithResult(_0x315235,null))[_0x400d('0x4f')](handleError(_0x315235,null));};exports[_0x400d('0xd9')]=function(_0x267713,_0x1da936,_0x34af99){var _0x237eda;return db[_0x400d('0x2f')][_0x400d('0x52')]({'where':{'id':_0x267713[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x1da936,null))[_0x400d('0x16')](function(_0x4f59fa){if(_0x4f59fa){return _0x4f59fa[_0x400d('0xd9')](_0x267713[_0x400d('0x34')][_0x400d('0x57')]);}})['then'](respondWithStatusCode(_0x1da936,null))[_0x400d('0x4f')](handleError(_0x1da936,null));};exports['getLists']=function(_0x5625e0,_0x545b2a,_0x58c94b){var _0x24e453={};var _0x20533c={};var _0xe1a121;var _0x1b3e65;return db['User'][_0x400d('0x9d')]({'where':{'id':_0x5625e0['params']['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x545b2a,null))['then'](function(_0xd30c01){if(_0xd30c01){_0xe1a121=_0xd30c01;_0x20533c[_0x400d('0x31')]=_[_0x400d('0x37')](db['CmList'][_0x400d('0x30')]);_0x20533c[_0x400d('0x34')]=_[_0x400d('0x37')](_0x5625e0[_0x400d('0x34')]);_0x20533c[_0x400d('0x38')]=_[_0x400d('0x39')](_0x20533c['model'],_0x20533c[_0x400d('0x34')]);_0x24e453['attributes']=_['intersection'](_0x20533c[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x5625e0[_0x400d('0x34')]['fields']));_0x24e453['attributes']=_0x24e453['attributes'][_0x400d('0x3c')]?_0x24e453[_0x400d('0x3a')]:_0x20533c[_0x400d('0x31')];_0x24e453[_0x400d('0xa1')]=qs[_0x400d('0x3f')](_0x5625e0['query'][_0x400d('0x3f')]);_0x24e453[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0x5625e0[_0x400d('0x34')],_0x20533c['filters']));if(_0x5625e0[_0x400d('0x34')][_0x400d('0x43')]){_0x24e453[_0x400d('0x44')]=_[_0x400d('0x42')](_0x24e453[_0x400d('0x44')],{'$or':_['map'](_0x24e453[_0x400d('0x3a')],function(_0x2fded1){var _0x26f088={};_0x26f088[_0x2fded1]={'$like':'%'+_0x5625e0[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x26f088;})});}_0x24e453=_['merge']({},_0x24e453,_0x5625e0['options']);return _0xe1a121['getLists'](_0x24e453);}})[_0x400d('0x16')](function(_0x40ee47){if(_0x40ee47){_0x1b3e65=_0x40ee47['length'];if(!_0x5625e0['query'][_0x400d('0x3d')](_0x400d('0x3e'))){_0x24e453['limit']=qs['limit'](_0x5625e0[_0x400d('0x34')][_0x400d('0x25')]);_0x24e453[_0x400d('0x24')]=qs['offset'](_0x5625e0['query'][_0x400d('0x24')]);}return _0xe1a121[_0x400d('0xda')](_0x24e453);}})[_0x400d('0x16')](function(_0x2fedee){if(_0x2fedee){return _0x2fedee?{'count':_0x1b3e65,'rows':_0x2fedee}:null;}})[_0x400d('0x16')](respondWithResult(_0x545b2a,null))[_0x400d('0x4f')](handleError(_0x545b2a,null));};exports[_0x400d('0xdb')]=function(_0x5c3761,_0x33c86b,_0x1813a6){var _0x141b11={};var _0x3a4397={};var _0x4a69e4;var _0xc4fa3d;return db[_0x400d('0x2f')]['findOne']({'where':{'id':_0x5c3761[_0x400d('0x51')]['id']}})[_0x400d('0x16')](handleEntityNotFound(_0x33c86b,null))[_0x400d('0x16')](function(_0x10bef8){if(_0x10bef8){_0x4a69e4=_0x10bef8;_0x3a4397['model']=_['keys'](db[_0x400d('0x2f')][_0x400d('0x30')]);_0x3a4397[_0x400d('0x34')]=_['keys'](_0x5c3761['query']);_0x3a4397['filters']=_[_0x400d('0x39')](_0x3a4397['model'],_0x3a4397[_0x400d('0x34')]);_0x141b11[_0x400d('0x3a')]=_[_0x400d('0x39')](_0x3a4397[_0x400d('0x31')],qs[_0x400d('0x3b')](_0x5c3761['query']['fields']));_0x141b11[_0x400d('0x3a')]=_0x141b11[_0x400d('0x3a')]['length']?_0x141b11[_0x400d('0x3a')]:_0x3a4397[_0x400d('0x31')];_0x141b11[_0x400d('0xa1')]=qs[_0x400d('0x3f')](_0x5c3761['query'][_0x400d('0x3f')]);_0x141b11[_0x400d('0x44')]=qs[_0x400d('0x38')](_[_0x400d('0xa2')](_0x5c3761[_0x400d('0x34')],_0x3a4397[_0x400d('0x38')]));if(_0x5c3761['query'][_0x400d('0x43')]){_0x141b11[_0x400d('0x44')]=_['merge'](_0x141b11[_0x400d('0x44')],{'$or':_[_0x400d('0x45')](_0x141b11[_0x400d('0x3a')],function(_0x2cce75){var _0x36154a={};_0x36154a[_0x2cce75]={'$like':'%'+_0x5c3761[_0x400d('0x34')][_0x400d('0x43')]+'%'};return _0x36154a;})});}_0x141b11[_0x400d('0x31')]=db[_0x400d('0x2f')];_0x141b11['as']=_0x400d('0xdc');_0x141b11=_[_0x400d('0x42')]({},_0x141b11,_0x5c3761[_0x400d('0x49')]);return _0x4a69e4[_0x400d('0xbd')]({'include':[_0x141b11]});}})[_0x400d('0x16')](function(_0x38aaca){if(_0x38aaca){var _0x2900be={},_0x3aca73=[],_0x36a31b=0x0;for(var _0x4ac8f1=0x0;_0x4ac8f1<_0x38aaca[_0x400d('0x3c')];_0x4ac8f1+=0x1){for(var _0x4d4a94=0x0,_0x27f287;_0x4d4a94<_0x38aaca[_0x4ac8f1][_0x400d('0xdc')][_0x400d('0x3c')];_0x4d4a94+=0x1){_0x27f287=_0x38aaca[_0x4ac8f1][_0x400d('0xdc')][_0x4d4a94]['get']({'plain':!![]});_0x2900be[_0x27f287['id']]=_0x27f287;}}_0x2900be=_['values'](_0x2900be);for(var _0x350d46=qs[_0x400d('0x24')](_0x5c3761[_0x400d('0x34')][_0x400d('0x24')]);_0x350d46<_0x2900be[_0x400d('0x3c')]&&_0x3aca73['length']=_0x5c81e2){_0x305006=_0x5c81e2;_0x3ac747=0xc8;}else{_0x3ac747=0xce;}_0x285b70[_0x27d6('0x22')](_0x3ac747);return _0x285b70[_0x27d6('0x25')](_0x27d6('0x26'),_0x225fd5+'-'+_0x305006+'/'+_0x5c81e2)[_0x27d6('0x27')](_0x519812);}return null;};}function patchUpdates(_0x312c17){return function(_0x29abbe){try{jsonpatch['apply'](_0x29abbe,_0x312c17,!![]);}catch(_0x3945b0){return BPromise[_0x27d6('0x28')](_0x3945b0);}return _0x29abbe[_0x27d6('0x29')]();};}function saveUpdates(_0x5c486c,_0x3e61ad){return function(_0x3acfef){if(_0x3acfef){return _0x3acfef[_0x27d6('0x2a')](_0x5c486c)['then'](function(_0x2a5804){return _0x2a5804;});}return null;};}function removeEntity(_0x4b0c4a,_0x4ecdd5){return function(_0x3f09bf){if(_0x3f09bf){return _0x3f09bf[_0x27d6('0x2b')]()[_0x27d6('0x18')](function(){_0x4b0c4a[_0x27d6('0x22')](0xcc)[_0x27d6('0x2c')]();});}};}function handleEntityNotFound(_0x3cca7d,_0x320320){return function(_0x1b672b){if(!_0x1b672b){_0x3cca7d[_0x27d6('0x21')](0x194);}return _0x1b672b;};}function handleError(_0x7d54fe,_0x37fc1a){_0x37fc1a=_0x37fc1a||0x1f4;return function(_0x3b62c9){logger[_0x27d6('0x1d')](_0x3b62c9[_0x27d6('0x2d')]);if(_0x3b62c9[_0x27d6('0x2e')]){delete _0x3b62c9[_0x27d6('0x2e')];}_0x7d54fe['status'](_0x37fc1a)[_0x27d6('0x2f')](_0x3b62c9);};}exports['index']=function(_0x212328,_0x166116){var _0x125a9a={},_0x2821cb={},_0x4083fd={'count':0x0,'rows':[]};var _0x250b38=db['User'][_0x27d6('0x30')];_0x2821cb[_0x27d6('0x31')]=_['differenceBy'](_['keys'](_0x250b38),['password','salt']);var _0x33e1f9={'dateStart':_0x212328[_0x27d6('0x32')][_0x27d6('0x33')],'dateEnd':_0x212328[_0x27d6('0x32')][_0x27d6('0x34')]};delete _0x212328['query'][_0x27d6('0x33')];delete _0x212328['query'][_0x27d6('0x34')];_0x2821cb[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x212328['query']);_0x2821cb[_0x27d6('0x36')]=_['intersection'](_0x2821cb['model'],_0x2821cb[_0x27d6('0x32')]);_0x125a9a['attributes']=_['intersection'](_0x2821cb['model'],qs[_0x27d6('0x37')](_0x212328[_0x27d6('0x32')][_0x27d6('0x37')]));_0x125a9a[_0x27d6('0x38')]=_0x125a9a[_0x27d6('0x38')][_0x27d6('0x39')]?_0x125a9a[_0x27d6('0x38')]:_0x2821cb[_0x27d6('0x31')];if(!_0x212328[_0x27d6('0x32')][_0x27d6('0x3a')](_0x27d6('0x3b'))){_0x125a9a[_0x27d6('0x24')]=qs[_0x27d6('0x24')](_0x212328[_0x27d6('0x32')]['limit']);_0x125a9a[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x212328['query'][_0x27d6('0x23')]);}_0x125a9a[_0x27d6('0x3c')]=qs[_0x27d6('0x3d')](_0x212328[_0x27d6('0x32')]['sort']);_0x125a9a[_0x27d6('0x3e')]=qs['filters'](_[_0x27d6('0x3f')](_0x212328[_0x27d6('0x32')],_0x2821cb[_0x27d6('0x36')]));if(_0x33e1f9['dateStart']){if(_0x33e1f9[_0x27d6('0x34')]){_0x33e1f9[_0x27d6('0x34')]=moment(_0x33e1f9['dateEnd'])[_0x27d6('0x40')](0x1,_0x27d6('0x41'));}else{_0x33e1f9['dateEnd']=moment(_0x33e1f9[_0x27d6('0x33')])['add'](0x1,_0x27d6('0x41'));}_[_0x27d6('0x42')](_0x125a9a['where'],{'createdAt':{'$gte':_0x33e1f9[_0x27d6('0x33')],'$lte':_0x33e1f9['dateEnd']}});}if(_0x212328[_0x27d6('0x32')]['filter']){_0x125a9a[_0x27d6('0x3e')]=_['merge'](_0x125a9a[_0x27d6('0x3e')],{'$or':_[_0x27d6('0x43')](_0x125a9a['attributes'],function(_0x29b830){return db[_0x27d6('0x44')][_0x27d6('0x3e')](db[_0x27d6('0x44')]['fn'](_0x27d6('0x45'),db[_0x27d6('0x44')][_0x27d6('0x46')](_0x29b830)),{'$like':db['sequelize']['fn']('lower','%'+_0x212328['query']['filter']+'%')});})});}_0x125a9a=_[_0x27d6('0x42')]({},_0x125a9a,_0x212328[_0x27d6('0x47')]);var _0x5174cc={'where':_0x125a9a['where']};return db[_0x27d6('0x48')][_0x27d6('0x49')](_0x5174cc)[_0x27d6('0x18')](function(_0x3ffb39){_0x4083fd['count']=_0x3ffb39;if(_0x212328[_0x27d6('0x32')]['includeAll']){_0x125a9a[_0x27d6('0x4a')]=[{'all':!![]}];}return db[_0x27d6('0x48')]['findAll'](_0x125a9a);})[_0x27d6('0x18')](function(_0x15452a){_0x4083fd['rows']=_0x15452a;return _0x4083fd;})[_0x27d6('0x18')](respondWithFilteredResult(_0x166116,_0x125a9a))['catch'](handleError(_0x166116,null));};exports[_0x27d6('0x4b')]=function(_0x1a02b9,_0x2d32d1){var _0x1b5ffe={'raw':![],'where':{'id':_0x1a02b9[_0x27d6('0x4c')]['id']}},_0xbcb4a5={};_0xbcb4a5[_0x27d6('0x31')]=_[_0x27d6('0x4d')](_[_0x27d6('0x35')](db['User'][_0x27d6('0x30')]),[_0x27d6('0x4e'),_0x27d6('0x4f')]);_0xbcb4a5[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x1a02b9[_0x27d6('0x32')]);_0xbcb4a5[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0xbcb4a5['model'],_0xbcb4a5['query']);_0x1b5ffe[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0xbcb4a5[_0x27d6('0x31')],qs[_0x27d6('0x37')](_0x1a02b9[_0x27d6('0x32')][_0x27d6('0x37')]));_0x1b5ffe['attributes']=_0x1b5ffe['attributes']['length']?_0x1b5ffe[_0x27d6('0x38')]:_0xbcb4a5[_0x27d6('0x31')];if(_0x1a02b9['query'][_0x27d6('0x51')]){_0x1b5ffe['include']=[{'all':!![]}];}_0x1b5ffe=_[_0x27d6('0x42')]({},_0x1b5ffe,_0x1a02b9[_0x27d6('0x47')]);return db['User']['find'](_0x1b5ffe)[_0x27d6('0x18')](handleEntityNotFound(_0x2d32d1,null))[_0x27d6('0x18')](respondWithResult(_0x2d32d1,null))[_0x27d6('0x52')](handleError(_0x2d32d1,null));};exports[_0x27d6('0x53')]=function(_0x250f8d,_0x57f434){return db[_0x27d6('0x48')][_0x27d6('0x53')](_0x250f8d[_0x27d6('0x54')],{'raw':![],'individualHooks':!![]})[_0x27d6('0x18')](respondWithResult(_0x57f434,0xc9))['catch'](handleError(_0x57f434,null));};exports[_0x27d6('0x2a')]=function(_0x51eac2,_0x47049c){if(_0x51eac2[_0x27d6('0x54')]['id']){delete _0x51eac2[_0x27d6('0x54')]['id'];}return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0x51eac2[_0x27d6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x47049c,null))['then'](saveUpdates(_0x51eac2[_0x27d6('0x54')],null))['then'](respondWithResult(_0x47049c,null))[_0x27d6('0x52')](handleError(_0x47049c,null));};exports['describe']=function(_0x508ca3,_0x3c14cf){return db[_0x27d6('0x48')][_0x27d6('0x56')]()[_0x27d6('0x18')](respondWithResult(_0x3c14cf,null))[_0x27d6('0x52')](handleError(_0x3c14cf,null));};exports[_0x27d6('0x57')]=function(_0x2adfd0,_0x4a5f9e,_0x339604){return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0x2adfd0[_0x27d6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a5f9e,null))[_0x27d6('0x18')](function(_0x2e3b3f){if(_0x2e3b3f){return _0x2e3b3f[_0x27d6('0x57')](_0x2adfd0[_0x27d6('0x54')][_0x27d6('0x58')],_[_0x27d6('0x59')](_0x2adfd0[_0x27d6('0x54')],['ids','id'])||{});}})[_0x27d6('0x18')](respondWithResult(_0x4a5f9e,null))[_0x27d6('0x52')](handleError(_0x4a5f9e,null));};var getLicense=function(_0x1cfa58){return new BPromise(function(_0x4654cf,_0x1cc0c9){var _0x5489ba=0x0;_0x1cfa58[_0x27d6('0x54')][_0x27d6('0x5a')]===_0x27d6('0x5b')&&_0x4654cf(_0x27d6('0x5c'));return db[_0x27d6('0x48')][_0x27d6('0x49')]({'where':{'$or':[{'role':_0x1cfa58[_0x27d6('0x54')]['role']===_0x27d6('0x5d')?_0x27d6('0x5d'):[_0x27d6('0x5e'),_0x27d6('0x5f')]}]}})[_0x27d6('0x18')](function(_0x2e065b){_0x5489ba=_0x2e065b;return require('../../config/license/util')['getLicense']();})[_0x27d6('0x18')](function(_0x5f5dd6){var _0x31ff86=_0x1cfa58[_0x27d6('0x54')][_0x27d6('0x5a')]===_0x27d6('0x5d')?'telephones':_0x27d6('0x60');if(!_['isNil'](_0x5f5dd6[_0x31ff86])&&_0x5489ba>=_0x5f5dd6[_0x31ff86]){return _0x1cc0c9({'message':_0x27d6('0x61')});}return _0x4654cf(util[_0x27d6('0x62')](_0x27d6('0x63'),_0x31ff86,_0x5489ba));})[_0x27d6('0x52')](function(_0x5458e2){return _0x1cc0c9(_0x5458e2);});});};exports[_0x27d6('0x64')]=function(_0x1123d4,_0x4441a8){return getLicense(_0x1123d4)[_0x27d6('0x18')](function(_0x368cf6){if(!_0x1123d4[_0x27d6('0x54')][_0x27d6('0x65')]){var _0x47c6ad;return db[_0x27d6('0x66')][_0x27d6('0x67')](0x1)[_0x27d6('0x18')](function(_0x277511){_0x47c6ad=_0x277511[_0x27d6('0x68')];return db['User'][_0x27d6('0x69')](_0x27d6('0x65'));})['then'](function(_0x12e94b){if(_[_0x27d6('0x6a')](_0x12e94b)){if(_0x47c6ad){_0x1123d4[_0x27d6('0x54')][_0x27d6('0x65')]=_0x47c6ad;}else{_0x1123d4[_0x27d6('0x54')][_0x27d6('0x65')]=0x1;}}else{if(_[_0x27d6('0x6a')](_0x47c6ad)||_0x47c6ad==_0x12e94b){_0x1123d4['body'][_0x27d6('0x65')]=_0x12e94b+0x1;}else if(_0x47c6ad>_0x12e94b){_0x1123d4[_0x27d6('0x54')][_0x27d6('0x65')]=_0x47c6ad;}else{return db[_0x27d6('0x44')]['query'](_0x27d6('0x6b'),{'type':db[_0x27d6('0x44')][_0x27d6('0x6c')][_0x27d6('0x6d')]})['then'](function(_0x158b91){if(_0x158b91&&_0x158b91[_0x27d6('0x39')]){for(var _0x3fa53d=0x0,_0x368b94=_0x158b91[_0x27d6('0x39')];_0x3fa53d<_0x368b94&&_['isNil'](_0x1123d4[_0x27d6('0x54')][_0x27d6('0x65')]);_0x3fa53d++){if(_0x47c6ad<=_0x158b91[_0x3fa53d]['from']){_0x1123d4['body'][_0x27d6('0x65')]=_0x158b91[_0x3fa53d]['from'];}else if(_0x47c6ad>_0x158b91[_0x3fa53d]['from']&&_0x47c6ad<=_0x158b91[_0x3fa53d]['to']){_0x1123d4['body']['internal']=_0x47c6ad;}}}if(_[_0x27d6('0x6a')](_0x1123d4[_0x27d6('0x54')]['internal'])){_0x1123d4[_0x27d6('0x54')][_0x27d6('0x65')]=_0x12e94b+0x1;}});}}});}})[_0x27d6('0x18')](function(){if(_0x1123d4[_0x27d6('0x54')][_0x27d6('0x6e')]){_0x1123d4[_0x27d6('0x54')][_0x27d6('0x6f')]=_0x1123d4['body'][_0x27d6('0x65')];_0x1123d4[_0x27d6('0x54')][_0x27d6('0x70')]={'mailbox':_0x1123d4[_0x27d6('0x54')][_0x27d6('0x65')],'password':_0x1123d4[_0x27d6('0x54')]['password'],'fullname':_0x1123d4[_0x27d6('0x54')][_0x27d6('0x71')],'email':_0x1123d4['body']['email']};}if(_0x1123d4[_0x27d6('0x54')]&&_0x1123d4[_0x27d6('0x54')]['role']==='agent'){_0x1123d4[_0x27d6('0x54')][_0x27d6('0x72')]=[_0x27d6('0x73'),_0x27d6('0x74'),_0x27d6('0x75'),'110','104','105',_0x27d6('0x76'),'107',_0x27d6('0x77'),'109',_0x27d6('0x78'),_0x27d6('0x79')];}return db[_0x27d6('0x48')][_0x27d6('0x64')](_0x1123d4[_0x27d6('0x54')],{'include':[{'model':db[_0x27d6('0x70')],'as':_0x27d6('0x70')}]});})[_0x27d6('0x18')](respondWithResult(_0x4441a8,0xc9))[_0x27d6('0x52')](handleError(_0x4441a8,null));};exports['changePassword']=function(_0x4f3bd7,_0x417153,_0x5252b0){if(_0x4f3bd7[_0x27d6('0x54')]['id']){delete _0x4f3bd7[_0x27d6('0x54')]['id'];}return db[_0x27d6('0x48')]['find']({'where':{'id':_0x4f3bd7[_0x27d6('0x4c')]['id']}})['then'](function(_0x2bb28d){if(_0x2bb28d){if(_0x2bb28d['id']==_0x4f3bd7[_0x27d6('0x5f')]['id']){if(!_0x4f3bd7[_0x27d6('0x54')][_0x27d6('0x7a')]||!_0x4f3bd7[_0x27d6('0x54')][_0x27d6('0x7b')]){throw new db['Sequelize']['ValidationError'](_0x27d6('0x7c'));}if(!_0x2bb28d[_0x27d6('0x7d')](_0x4f3bd7[_0x27d6('0x54')][_0x27d6('0x7a')])){throw new db[(_0x27d6('0x7e'))]['ValidationError'](_0x27d6('0x7f'));}if(_0x4f3bd7[_0x27d6('0x54')][_0x27d6('0x7a')]==_0x4f3bd7[_0x27d6('0x54')]['newPassword']){throw new db['Sequelize'][(_0x27d6('0x80'))](_0x27d6('0x81'));}return _0x2bb28d;}else if(_0x4f3bd7['user']['role']==_0x27d6('0x5e')){if(!_0x4f3bd7['body']['newPassword']){throw new db[(_0x27d6('0x7e'))]['ValidationError'](_0x27d6('0x82'));}return _0x2bb28d;}else if(_0x4f3bd7[_0x27d6('0x5f')]['role']=='user'){if(!_0x4f3bd7[_0x27d6('0x54')][_0x27d6('0x7b')]){throw new db[(_0x27d6('0x7e'))][(_0x27d6('0x80'))](_0x27d6('0x82'));}if(_0x2bb28d['role']!=_0x27d6('0x5b')){throw new db[(_0x27d6('0x7e'))][(_0x27d6('0x80'))](_0x27d6('0x83'));}return _0x2bb28d;}else{throw new db[(_0x27d6('0x7e'))][(_0x27d6('0x80'))](_0x27d6('0x83'));}}return null;})[_0x27d6('0x18')](handleEntityNotFound(_0x417153,null))[_0x27d6('0x18')](saveUpdates({'password':_0x4f3bd7[_0x27d6('0x54')]['newPassword'],'passwordResetAt':_0x4f3bd7['user']['id']==_0x4f3bd7['params']['id']?moment():null},null))[_0x27d6('0x18')](respondWithResult(_0x417153,null))[_0x27d6('0x52')](handleError(_0x417153,null));};exports[_0x27d6('0x84')]=function(_0x1fcd63,_0x40209a,_0x2c5f1a){var _0x26349a;return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0x1fcd63[_0x27d6('0x4c')]['id']},'attributes':['id',_0x27d6('0x2e'),_0x27d6('0x5a'),_0x27d6('0x85'),_0x27d6('0x86')]})[_0x27d6('0x18')](handleEntityNotFound(_0x40209a,null))['then'](function(_0x5e18a0){if(_0x5e18a0){_0x26349a=_0x5e18a0;if(!utils[_0x27d6('0x87')](_0x1fcd63[_0x27d6('0x54')]['channel'])){throw new db[(_0x27d6('0x7e'))][(_0x27d6('0x80'))](_0x27d6('0x88'));}return _0x5e18a0[_0x27d6('0x40')+_[_0x27d6('0x89')](_0x1fcd63[_0x27d6('0x54')][_0x27d6('0x8a')][_0x27d6('0x8b')]())+'Queues'](_0x1fcd63[_0x27d6('0x54')][_0x27d6('0x58')],{'penalty':_0x1fcd63['body'][_0x27d6('0x8c')]||0x0});}})[_0x27d6('0x18')](function(){if(_0x1fcd63[_0x27d6('0x54')][_0x27d6('0x8a')]===_0x27d6('0x8d')){return db[_0x27d6('0x8e')][_0x27d6('0x8f')]({'where':{'id':_0x1fcd63[_0x27d6('0x54')][_0x27d6('0x58')]||[]},'raw':!![],'attributes':['id',_0x27d6('0x2e')]});}})[_0x27d6('0x18')](function(_0xd428a0){var _0x47fbb6=[];if(_0x1fcd63[_0x27d6('0x54')]['channel']===_0x27d6('0x8d')&&_0x26349a[_0x27d6('0x5a')]==='agent'){for(var _0x4f3f75=0x0;_0x4f3f75<_0xd428a0[_0x27d6('0x39')];_0x4f3f75+=0x1){_0x47fbb6[_0x27d6('0x90')]({'membername':_0x26349a[_0x27d6('0x2e')],'UserId':_0x26349a['id'],'queue_name':_0xd428a0[_0x4f3f75]['name'],'VoiceQueueId':_0xd428a0[_0x4f3f75]['id'],'interface':util[_0x27d6('0x62')](_0x27d6('0x91'),'SIP',_0x26349a[_0x27d6('0x2e')]),'paused':_0x26349a[_0x27d6('0x86')]||![],'penalty':_0x1fcd63[_0x27d6('0x54')][_0x27d6('0x8c')]||0x0});}return BPromise[_0x27d6('0x92')](_0x47fbb6,function(_0x7dbd5d){return db[_0x27d6('0x93')][_0x27d6('0x94')](_0x7dbd5d);});}return _0x26349a;})[_0x27d6('0x18')](respondWithStatusCode(_0x40209a,null))[_0x27d6('0x52')](handleError(_0x40209a,null));};exports[_0x27d6('0x95')]=function(_0x41a8c1,_0x495e8b,_0x1ab2c4){var _0x248e2a;return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0x41a8c1['params']['id']},'attributes':['id',_0x27d6('0x2e'),_0x27d6('0x5a')]})[_0x27d6('0x18')](handleEntityNotFound(_0x495e8b,null))['then'](function(_0x233af1){if(_0x233af1){_0x248e2a=_0x233af1;if(!_0x41a8c1[_0x27d6('0x32')][_0x27d6('0x8a')]||!utils[_0x27d6('0x87')](_0x41a8c1[_0x27d6('0x32')][_0x27d6('0x8a')])){throw new db[(_0x27d6('0x7e'))][(_0x27d6('0x80'))](_0x27d6('0x88'));}return _0x233af1[_0x27d6('0x96')+_['capitalize'](_0x41a8c1[_0x27d6('0x32')][_0x27d6('0x8a')][_0x27d6('0x8b')]())+_0x27d6('0x97')](_0x41a8c1[_0x27d6('0x32')][_0x27d6('0x58')]);}})['then'](function(_0x5630cd){if(_0x41a8c1[_0x27d6('0x32')][_0x27d6('0x8a')]==='voice'){return db[_0x27d6('0x93')][_0x27d6('0x2b')]({'where':{'UserId':_0x41a8c1['params']['id'],'VoiceQueueId':_0x41a8c1[_0x27d6('0x32')][_0x27d6('0x58')]},'individualHooks':!![]})['then'](function(){return _0x248e2a;});}return _0x248e2a;})['then'](respondWithStatusCode(_0x495e8b,null))[_0x27d6('0x52')](handleError(_0x495e8b,null));};exports[_0x27d6('0x98')]=function(_0x43d3f8,_0x7936df,_0x44af14){_0x43d3f8[_0x27d6('0x54')][_0x27d6('0x99')]=_0x43d3f8['file'][_0x27d6('0x9a')];return db[_0x27d6('0x48')]['find']({'where':{'id':_0x43d3f8[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x7936df,null))[_0x27d6('0x18')](saveUpdates(_0x43d3f8[_0x27d6('0x54')],null))['then'](respondWithResult(_0x7936df,null))['catch'](handleError(_0x7936df,null));};exports['getAvatar']=function(_0x549f87,_0x5d3b52,_0x5170c7){var _0x1c716a=path['join'](config[_0x27d6('0x9b')],_0x27d6('0x9c'));return db[_0x27d6('0x48')]['find']({'where':{'id':_0x549f87[_0x27d6('0x4c')]['id']},'attributes':['id',_0x27d6('0x99')],'raw':!![]})[_0x27d6('0x18')](handleEntityNotFound(_0x5d3b52,null))['then'](function(_0x5ee6d9){if(_0x5ee6d9){if(_[_0x27d6('0x6a')](_0x5ee6d9[_0x27d6('0x99')])){return _0x5d3b52[_0x27d6('0x9d')](_0x1c716a);}else{if(!fs[_0x27d6('0x9e')](path[_0x27d6('0x9f')](config[_0x27d6('0x9b')],'server/files/images/',_0x5ee6d9['userpic']))){return _0x5d3b52[_0x27d6('0x9d')](_0x1c716a);}return _0x5d3b52[_0x27d6('0x9d')](path['join'](config[_0x27d6('0x9b')],'server/files/images/',_0x5ee6d9['userpic']));}}})[_0x27d6('0x52')](handleError(_0x5d3b52,null));};exports[_0x27d6('0xa0')]=function(_0x3e6eed,_0x4d67b4,_0x57ecb7){var _0x4fe11f;var _0x3b46a1={'where':{}},_0x13dc45={},_0x5744b7={'count':0x0,'rows':[]};return db['User'][_0x27d6('0xa1')]({'where':{'id':_0x3e6eed[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x4d67b4,null))[_0x27d6('0x18')](function(_0x57bc96){if(_0x57bc96){_0x4fe11f=_0x57bc96;_0x3b46a1[_0x27d6('0x3e')][_0x27d6('0xa2')]=_0x57bc96['id'];return db[_0x27d6('0xa3')][_0x27d6('0x56')]();}})[_0x27d6('0x18')](function(_0x1fff02){if(_0x1fff02){_0x13dc45['model']=_[_0x27d6('0x35')](_0x1fff02);_0x13dc45[_0x27d6('0x32')]=_['keys'](_0x3e6eed['query']);_0x13dc45[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0x13dc45[_0x27d6('0x31')],_0x13dc45[_0x27d6('0x32')]);_0x3b46a1[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x13dc45[_0x27d6('0x31')],qs[_0x27d6('0x37')](_0x3e6eed[_0x27d6('0x32')][_0x27d6('0x37')]));_0x3b46a1['attributes']=_0x3b46a1[_0x27d6('0x38')][_0x27d6('0x39')]?_0x3b46a1[_0x27d6('0x38')]:_0x13dc45[_0x27d6('0x31')];if(!_0x3e6eed[_0x27d6('0x32')]['hasOwnProperty'](_0x27d6('0x3b'))){_0x3b46a1['limit']=qs['limit'](_0x3e6eed[_0x27d6('0x32')]['limit']);_0x3b46a1[_0x27d6('0x23')]=qs['offset'](_0x3e6eed['query'][_0x27d6('0x23')]);}_0x3b46a1[_0x27d6('0x3c')]=qs[_0x27d6('0x3d')](_0x3e6eed['query'][_0x27d6('0x3d')]);_0x3b46a1[_0x27d6('0x3e')]=qs[_0x27d6('0x36')](_[_0x27d6('0x3f')](_0x3e6eed['query'],_0x13dc45['filters']));if(_0x3e6eed[_0x27d6('0x32')][_0x27d6('0xa4')]){_0x3b46a1[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x3b46a1[_0x27d6('0x3e')],{'$or':_[_0x27d6('0x43')](_0x3b46a1[_0x27d6('0x38')],function(_0x5100a8){var _0x3aedae={};_0x3aedae[_0x5100a8]={'$like':'%'+_0x3e6eed[_0x27d6('0x32')]['filter']+'%'};return _0x3aedae;})});}_0x3b46a1=_[_0x27d6('0x42')]({},_0x3b46a1,_0x3e6eed[_0x27d6('0x47')]);return _0x4fe11f[_0x27d6('0xa0')](_[_0x27d6('0x3f')](_0x3b46a1,[_0x27d6('0x3e')]))[_0x27d6('0x18')](function(_0x1ccde2){_0x5744b7[_0x27d6('0x49')]=_0x1ccde2[_0x27d6('0x39')]||0x0;if(_0x3e6eed['query'][_0x27d6('0x51')]){_0x3b46a1[_0x27d6('0x4a')]=[{'all':!![]}];}return _0x4fe11f[_0x27d6('0xa0')](_0x3b46a1);})['then'](function(_0x543d9b){_0x5744b7['rows']=_0x543d9b;return _0x5744b7;});}})[_0x27d6('0x18')](respondWithFilteredResult(_0x4d67b4,_0x3b46a1))[_0x27d6('0x52')](handleError(_0x4d67b4,null));};exports['getQueues']=function(_0x46328d,_0x19291c,_0x2fe1de){var _0x367e5f;var _0x565326;var _0x3ad74a={};var _0x510ff8;return db[_0x27d6('0x48')][_0x27d6('0xa1')]({'where':{'id':_0x46328d['params']['id']},'attributes':['id',_0x27d6('0x2e'),_0x27d6('0x5a')]})[_0x27d6('0x18')](handleEntityNotFound(_0x19291c,null))[_0x27d6('0x18')](function(_0x1455c7){if(!utils[_0x27d6('0x87')](_0x46328d[_0x27d6('0x32')][_0x27d6('0x8a')])){throw new db['Sequelize'][(_0x27d6('0x80'))](_0x27d6('0x88'));}_0x367e5f=_0x1455c7;var _0x41ea89={};_0x41ea89['model']=_[_0x27d6('0x35')](db[_[_0x27d6('0x89')](_0x46328d[_0x27d6('0x32')][_0x27d6('0x8a')])+_0x27d6('0xa5')][_0x27d6('0x30')]);_0x41ea89['query']=_[_0x27d6('0x35')](_0x46328d[_0x27d6('0x32')]);_0x41ea89['filters']=_[_0x27d6('0x50')](_0x41ea89['model'],_0x41ea89[_0x27d6('0x32')]);_0x3ad74a[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x41ea89[_0x27d6('0x31')],qs[_0x27d6('0x37')](_0x46328d[_0x27d6('0x32')][_0x27d6('0x37')]));_0x3ad74a['attributes']=_0x3ad74a[_0x27d6('0x38')]['length']?_0x3ad74a['attributes']:_0x41ea89['model'];_0x3ad74a[_0x27d6('0x3c')]=qs[_0x27d6('0x3d')](_0x46328d[_0x27d6('0x32')]['sort']);_0x3ad74a[_0x27d6('0x3e')]=qs['filters'](_[_0x27d6('0x3f')](_0x46328d[_0x27d6('0x32')],_0x41ea89[_0x27d6('0x36')]));if(_0x46328d['query'][_0x27d6('0xa4')]){_0x3ad74a[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x3ad74a[_0x27d6('0x3e')],{'$or':_['map'](_0x3ad74a[_0x27d6('0x38')],function(_0x3c1288){var _0x53e4bf={};_0x53e4bf[_0x3c1288]={'$like':'%'+_0x46328d[_0x27d6('0x32')][_0x27d6('0xa4')]+'%'};return _0x53e4bf;})});}_0x3ad74a=_[_0x27d6('0x42')]({},_0x3ad74a,_0x46328d[_0x27d6('0x47')]);switch(_0x367e5f[_0x27d6('0x5a')]){case _0x27d6('0x5e'):return db[_[_0x27d6('0x89')](_0x46328d['query'][_0x27d6('0x8a')])+_0x27d6('0xa5')][_0x27d6('0x8f')](_0x3ad74a);case _0x27d6('0x5f'):case _0x27d6('0x5b'):return _0x367e5f['get'+_[_0x27d6('0x89')](_0x46328d[_0x27d6('0x32')][_0x27d6('0x8a')])+_0x27d6('0x97')](_0x3ad74a);default:throw new db['Sequelize'][(_0x27d6('0x80'))](_0x27d6('0xa6'));}})[_0x27d6('0x18')](function(_0xbeeec7){_0x510ff8=_0xbeeec7[_0x27d6('0x39')];if(!_0x46328d[_0x27d6('0x32')][_0x27d6('0x3a')]('nolimit')){_0x3ad74a['limit']=qs[_0x27d6('0x24')](_0x46328d[_0x27d6('0x32')]['limit']);_0x3ad74a[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x46328d[_0x27d6('0x32')][_0x27d6('0x23')]);}switch(_0x367e5f[_0x27d6('0x5a')]){case'admin':return db[_[_0x27d6('0x89')](_0x46328d[_0x27d6('0x32')]['channel'])+_0x27d6('0xa5')][_0x27d6('0x8f')](_0x3ad74a);case _0x27d6('0x5f'):case'agent':return _0x367e5f[_0x27d6('0xa7')+_[_0x27d6('0x89')](_0x46328d['query'][_0x27d6('0x8a')])+_0x27d6('0x97')](_0x3ad74a);}})[_0x27d6('0x18')](function(_0x58f81c){return{'count':_0x510ff8,'rows':_0x58f81c};})[_0x27d6('0x18')](respondWithResult(_0x19291c,null))[_0x27d6('0x52')](handleError(_0x19291c,null));};exports[_0x27d6('0xa8')]=function(_0x1e1d02,_0x57f431,_0x5d77bd){var _0x14044a={};var _0x5d2cf8={};var _0xec4bf0;var _0x5883fa;return db[_0x27d6('0x48')][_0x27d6('0xa1')]({'where':{'id':_0x1e1d02[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x57f431,null))[_0x27d6('0x18')](function(_0x3e2be9){if(_0x3e2be9){_0xec4bf0=_0x3e2be9;_0x5d2cf8[_0x27d6('0x31')]=_[_0x27d6('0x35')](db[_0x27d6('0x93')][_0x27d6('0x30')]);_0x5d2cf8[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x1e1d02[_0x27d6('0x32')]);_0x5d2cf8[_0x27d6('0x36')]=_['intersection'](_0x5d2cf8[_0x27d6('0x31')],_0x5d2cf8[_0x27d6('0x32')]);_0x14044a['attributes']=_[_0x27d6('0x50')](_0x5d2cf8[_0x27d6('0x31')],qs['fields'](_0x1e1d02[_0x27d6('0x32')][_0x27d6('0x37')]));_0x14044a[_0x27d6('0x38')]=_0x14044a['attributes'][_0x27d6('0x39')]?_0x14044a['attributes']:_0x5d2cf8['model'];_0x14044a[_0x27d6('0x3c')]=qs[_0x27d6('0x3d')](_0x1e1d02[_0x27d6('0x32')][_0x27d6('0x3d')]);_0x14044a[_0x27d6('0x3e')]=qs[_0x27d6('0x36')](_['pick'](_0x1e1d02[_0x27d6('0x32')],_0x5d2cf8[_0x27d6('0x36')]));if(_0x1e1d02[_0x27d6('0x32')][_0x27d6('0xa4')]){_0x14044a[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x14044a[_0x27d6('0x3e')],{'$or':_[_0x27d6('0x43')](_0x14044a[_0x27d6('0x38')],function(_0x1debae){var _0x2403a8={};_0x2403a8[_0x1debae]={'$like':'%'+_0x1e1d02[_0x27d6('0x32')][_0x27d6('0xa4')]+'%'};return _0x2403a8;})});}_0x14044a=_[_0x27d6('0x42')]({},_0x14044a,_0x1e1d02[_0x27d6('0x47')]);return _0xec4bf0[_0x27d6('0xa8')](_0x14044a);}})[_0x27d6('0x18')](function(_0x437a3c){if(_0x437a3c){_0x5883fa=_0x437a3c[_0x27d6('0x39')];if(!_0x1e1d02[_0x27d6('0x32')][_0x27d6('0x3a')](_0x27d6('0x3b'))){_0x14044a[_0x27d6('0x24')]=qs['limit'](_0x1e1d02[_0x27d6('0x32')][_0x27d6('0x24')]);_0x14044a[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x1e1d02[_0x27d6('0x32')][_0x27d6('0x23')]);}return _0xec4bf0['getVoiceQueuesRt'](_0x14044a);}})['then'](function(_0x520454){if(_0x520454){return _0x520454?{'count':_0x5883fa,'rows':_0x520454}:null;}})[_0x27d6('0x18')](respondWithResult(_0x57f431,null))[_0x27d6('0x52')](handleError(_0x57f431,null));};exports[_0x27d6('0xa9')]=function(_0x418ecb,_0xa90f22,_0x2cbb6d){var _0x5b6d03={};var _0x1db8af={};var _0x13d09b;var _0x5aaf2d;return db[_0x27d6('0x48')]['findOne']({'where':{'id':_0x418ecb['params']['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0xa90f22,null))[_0x27d6('0x18')](function(_0x5bfbb1){if(_0x5bfbb1){_0x13d09b=_0x5bfbb1;_0x1db8af[_0x27d6('0x31')]=_[_0x27d6('0x35')](db['ChatGroup'][_0x27d6('0x30')]);_0x1db8af['query']=_['keys'](_0x418ecb[_0x27d6('0x32')]);_0x1db8af[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0x1db8af[_0x27d6('0x31')],_0x1db8af[_0x27d6('0x32')]);_0x5b6d03[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x1db8af['model'],qs[_0x27d6('0x37')](_0x418ecb[_0x27d6('0x32')][_0x27d6('0x37')]));_0x5b6d03[_0x27d6('0x38')]=_0x5b6d03['attributes'][_0x27d6('0x39')]?_0x5b6d03[_0x27d6('0x38')]:_0x1db8af[_0x27d6('0x31')];_0x5b6d03[_0x27d6('0x3c')]=qs['sort'](_0x418ecb[_0x27d6('0x32')]['sort']);_0x5b6d03['where']=qs[_0x27d6('0x36')](_[_0x27d6('0x3f')](_0x418ecb['query'],_0x1db8af['filters']));if(_0x418ecb[_0x27d6('0x32')]['filter']){_0x5b6d03['where']=_[_0x27d6('0x42')](_0x5b6d03[_0x27d6('0x3e')],{'$or':_['map'](_0x5b6d03[_0x27d6('0x38')],function(_0x5befc2){var _0x1b05f0={};_0x1b05f0[_0x5befc2]={'$like':'%'+_0x418ecb['query'][_0x27d6('0xa4')]+'%'};return _0x1b05f0;})});}_0x5b6d03=_[_0x27d6('0x42')]({},_0x5b6d03,_0x418ecb[_0x27d6('0x47')]);return _0x13d09b[_0x27d6('0xa9')](_0x5b6d03);}})[_0x27d6('0x18')](function(_0x552ea1){if(_0x552ea1){_0x5aaf2d=_0x552ea1[_0x27d6('0x39')];if(!_0x418ecb[_0x27d6('0x32')][_0x27d6('0x3a')]('nolimit')){_0x5b6d03[_0x27d6('0x24')]=qs['limit'](_0x418ecb[_0x27d6('0x32')][_0x27d6('0x24')]);_0x5b6d03[_0x27d6('0x23')]=qs['offset'](_0x418ecb[_0x27d6('0x32')][_0x27d6('0x23')]);}return _0x13d09b[_0x27d6('0xa9')](_0x5b6d03);}})[_0x27d6('0x18')](function(_0x21521c){if(_0x21521c){return _0x21521c?{'count':_0x5aaf2d,'rows':_0x21521c}:null;}})['then'](respondWithResult(_0xa90f22,null))[_0x27d6('0x52')](handleError(_0xa90f22,null));};exports[_0x27d6('0xaa')]=function(_0x57efd9,_0x4a9c75,_0x153de9){var _0x49c517={'raw':!![],'where':{}};var _0xb705fc={};var _0x297740={'count':0x0,'rows':[]};return db[_0x27d6('0x48')][_0x27d6('0xa1')]({'where':{'id':_0x57efd9['params']['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x4a9c75,null))[_0x27d6('0x18')](function(_0x3cc918){if(_0x3cc918){_0xb705fc[_0x27d6('0x31')]=_[_0x27d6('0x35')](db[_0x27d6('0xab')][_0x27d6('0x30')]);_0xb705fc['query']=_[_0x27d6('0x35')](_0x57efd9[_0x27d6('0x32')]);_0xb705fc[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0xb705fc['model'],_0xb705fc[_0x27d6('0x32')]);_0x49c517[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0xb705fc['model'],qs[_0x27d6('0x37')](_0x57efd9[_0x27d6('0x32')][_0x27d6('0x37')]));_0x49c517[_0x27d6('0x38')]=_0x49c517[_0x27d6('0x38')][_0x27d6('0x39')]?_0x49c517['attributes']:_0xb705fc[_0x27d6('0x31')];if(!_0x57efd9[_0x27d6('0x32')][_0x27d6('0x3a')](_0x27d6('0x3b'))){_0x49c517[_0x27d6('0x24')]=qs[_0x27d6('0x24')](_0x57efd9[_0x27d6('0x32')][_0x27d6('0x24')]);_0x49c517[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x57efd9['query'][_0x27d6('0x23')]);}_0x49c517[_0x27d6('0x3c')]=qs[_0x27d6('0x3d')](_0x57efd9[_0x27d6('0x32')][_0x27d6('0x3d')]);_0x49c517['where']=qs[_0x27d6('0x36')](_['pick'](_0x57efd9['query'],_0xb705fc[_0x27d6('0x36')]));_0x49c517[_0x27d6('0x3e')][_0x27d6('0xa2')]=_0x3cc918['id'];if(_0x57efd9[_0x27d6('0x32')][_0x27d6('0xa4')]){_0x49c517[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x49c517[_0x27d6('0x3e')],{'$or':_[_0x27d6('0x43')](_0x49c517[_0x27d6('0x38')],function(_0x338706){var _0x3a64af={};_0x3a64af[_0x338706]={'$like':'%'+_0x57efd9[_0x27d6('0x32')][_0x27d6('0xa4')]+'%'};return _0x3a64af;})});}_0x49c517=_[_0x27d6('0x42')]({},_0x49c517,_0x57efd9[_0x27d6('0x47')]);return db[_0x27d6('0xab')][_0x27d6('0x49')]({'where':_0x49c517[_0x27d6('0x3e')]})['then'](function(_0x2cd963){_0x297740['count']=_0x2cd963;if(_0x57efd9[_0x27d6('0x32')][_0x27d6('0x51')]){_0x49c517[_0x27d6('0x4a')]=[{'all':!![]}];}return db[_0x27d6('0xab')][_0x27d6('0x8f')](_0x49c517);})[_0x27d6('0x18')](function(_0x49eba3){_0x297740['rows']=_0x49eba3;return _0x297740;});}})['then'](respondWithFilteredResult(_0x4a9c75,_0x49c517))[_0x27d6('0x52')](handleError(_0x4a9c75,null));};exports[_0x27d6('0xac')]=function(_0x414dd2,_0x342de7,_0x293eaf){var _0x15a5fa={};var _0x13298e={};var _0xa52b34;var _0x49cd16;return db['User'][_0x27d6('0xa1')]({'where':{'id':_0x414dd2[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x342de7,null))[_0x27d6('0x18')](function(_0x2f20f2){if(_0x2f20f2){_0xa52b34=_0x2f20f2;_0x13298e['model']=_[_0x27d6('0x35')](db[_0x27d6('0xad')][_0x27d6('0x30')]);_0x13298e[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x414dd2[_0x27d6('0x32')]);_0x13298e['filters']=_[_0x27d6('0x50')](_0x13298e[_0x27d6('0x31')],_0x13298e[_0x27d6('0x32')]);_0x15a5fa[_0x27d6('0x38')]=_['intersection'](_0x13298e[_0x27d6('0x31')],qs['fields'](_0x414dd2[_0x27d6('0x32')][_0x27d6('0x37')]));_0x15a5fa[_0x27d6('0x38')]=_0x15a5fa[_0x27d6('0x38')][_0x27d6('0x39')]?_0x15a5fa['attributes']:_0x13298e['model'];_0x15a5fa[_0x27d6('0x3c')]=qs['sort'](_0x414dd2[_0x27d6('0x32')][_0x27d6('0x3d')]);_0x15a5fa[_0x27d6('0x3e')]=qs['filters'](_[_0x27d6('0x3f')](_0x414dd2[_0x27d6('0x32')],_0x13298e[_0x27d6('0x36')]));if(_0x414dd2['query']['filter']){_0x15a5fa['where']=_['merge'](_0x15a5fa['where'],{'$or':_[_0x27d6('0x43')](_0x15a5fa[_0x27d6('0x38')],function(_0x28b48e){var _0x3efa2e={};_0x3efa2e[_0x28b48e]={'$like':'%'+_0x414dd2[_0x27d6('0x32')]['filter']+'%'};return _0x3efa2e;})});}_0x15a5fa=_[_0x27d6('0x42')]({},_0x15a5fa,_0x414dd2[_0x27d6('0x47')]);return _0xa52b34['getChatInteractions'](_0x15a5fa);}})['then'](function(_0x4c4303){if(_0x4c4303){_0x49cd16=_0x4c4303[_0x27d6('0x39')];if(!_0x414dd2[_0x27d6('0x32')][_0x27d6('0x3a')](_0x27d6('0x3b'))){_0x15a5fa[_0x27d6('0x24')]=qs[_0x27d6('0x24')](_0x414dd2[_0x27d6('0x32')][_0x27d6('0x24')]);_0x15a5fa[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x414dd2['query']['offset']);}return _0xa52b34[_0x27d6('0xac')](_0x15a5fa);}})['then'](function(_0x49e5b6){if(_0x49e5b6){return _0x49e5b6?{'count':_0x49cd16,'rows':_0x49e5b6}:null;}})['then'](respondWithResult(_0x342de7,null))[_0x27d6('0x52')](handleError(_0x342de7,null));};exports[_0x27d6('0xae')]=function(_0x184efc,_0x5af7b3,_0xf2f015){var _0x334ff5={};var _0x103930={};var _0x572046;var _0x46ad5b;return db[_0x27d6('0x48')][_0x27d6('0xa1')]({'where':{'id':_0x184efc[_0x27d6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5af7b3,null))[_0x27d6('0x18')](function(_0x40502b){if(_0x40502b){_0x572046=_0x40502b;_0x103930[_0x27d6('0x31')]=_[_0x27d6('0x35')](db[_0x27d6('0xaf')][_0x27d6('0x30')]);_0x103930[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x184efc[_0x27d6('0x32')]);_0x103930[_0x27d6('0x36')]=_['intersection'](_0x103930['model'],_0x103930['query']);_0x334ff5[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x103930['model'],qs[_0x27d6('0x37')](_0x184efc['query'][_0x27d6('0x37')]));_0x334ff5[_0x27d6('0x38')]=_0x334ff5[_0x27d6('0x38')][_0x27d6('0x39')]?_0x334ff5[_0x27d6('0x38')]:_0x103930[_0x27d6('0x31')];_0x334ff5[_0x27d6('0x3c')]=qs[_0x27d6('0x3d')](_0x184efc['query'][_0x27d6('0x3d')]);_0x334ff5[_0x27d6('0x3e')]=qs[_0x27d6('0x36')](_[_0x27d6('0x3f')](_0x184efc[_0x27d6('0x32')],_0x103930[_0x27d6('0x36')]));if(_0x184efc[_0x27d6('0x32')][_0x27d6('0xa4')]){_0x334ff5[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x334ff5['where'],{'$or':_[_0x27d6('0x43')](_0x334ff5[_0x27d6('0x38')],function(_0x577258){var _0x40f309={};_0x40f309[_0x577258]={'$like':'%'+_0x184efc[_0x27d6('0x32')][_0x27d6('0xa4')]+'%'};return _0x40f309;})});}_0x334ff5=_[_0x27d6('0x42')]({},_0x334ff5,_0x184efc[_0x27d6('0x47')]);return _0x572046[_0x27d6('0xae')](_0x334ff5);}})[_0x27d6('0x18')](function(_0x41e763){if(_0x41e763){_0x46ad5b=_0x41e763[_0x27d6('0x39')];if(!_0x184efc[_0x27d6('0x32')]['hasOwnProperty'](_0x27d6('0x3b'))){_0x334ff5[_0x27d6('0x24')]=qs[_0x27d6('0x24')](_0x184efc[_0x27d6('0x32')]['limit']);_0x334ff5[_0x27d6('0x23')]=qs['offset'](_0x184efc[_0x27d6('0x32')]['offset']);}return _0x572046[_0x27d6('0xae')](_0x334ff5);}})['then'](function(_0x4ff4dd){if(_0x4ff4dd){return _0x4ff4dd?{'count':_0x46ad5b,'rows':_0x4ff4dd}:null;}})[_0x27d6('0x18')](respondWithResult(_0x5af7b3,null))[_0x27d6('0x52')](handleError(_0x5af7b3,null));};exports[_0x27d6('0xb0')]=function(_0x171c94,_0x4d2b76,_0x41932f){var _0x90066f={'raw':!![],'where':{}};var _0x162542={};var _0x46be05={'count':0x0,'rows':[]};return db['User'][_0x27d6('0xa1')]({'where':{'id':_0x171c94['params']['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x4d2b76,null))[_0x27d6('0x18')](function(_0x3a8ecb){if(_0x3a8ecb){_0x162542[_0x27d6('0x31')]=_[_0x27d6('0x35')](db[_0x27d6('0xb1')][_0x27d6('0x30')]);_0x162542[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x171c94['query']);_0x162542[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0x162542[_0x27d6('0x31')],_0x162542[_0x27d6('0x32')]);_0x90066f[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x162542[_0x27d6('0x31')],qs[_0x27d6('0x37')](_0x171c94['query']['fields']));_0x90066f[_0x27d6('0x38')]=_0x90066f[_0x27d6('0x38')][_0x27d6('0x39')]?_0x90066f[_0x27d6('0x38')]:_0x162542['model'];if(!_0x171c94[_0x27d6('0x32')][_0x27d6('0x3a')](_0x27d6('0x3b'))){_0x90066f[_0x27d6('0x24')]=qs[_0x27d6('0x24')](_0x171c94[_0x27d6('0x32')]['limit']);_0x90066f[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x171c94[_0x27d6('0x32')][_0x27d6('0x23')]);}_0x90066f['order']=qs[_0x27d6('0x3d')](_0x171c94['query']['sort']);_0x90066f[_0x27d6('0x3e')]=qs[_0x27d6('0x36')](_[_0x27d6('0x3f')](_0x171c94['query'],_0x162542[_0x27d6('0x36')]));_0x90066f[_0x27d6('0x3e')]['UserId']=_0x3a8ecb['id'];if(_0x171c94[_0x27d6('0x32')][_0x27d6('0xa4')]){_0x90066f[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x90066f[_0x27d6('0x3e')],{'$or':_['map'](_0x90066f[_0x27d6('0x38')],function(_0x5ed0fb){var _0x2a3d83={};_0x2a3d83[_0x5ed0fb]={'$like':'%'+_0x171c94[_0x27d6('0x32')][_0x27d6('0xa4')]+'%'};return _0x2a3d83;})});}_0x90066f=_['merge']({},_0x90066f,_0x171c94[_0x27d6('0x47')]);return db[_0x27d6('0xb1')][_0x27d6('0x49')]({'where':_0x90066f[_0x27d6('0x3e')]})[_0x27d6('0x18')](function(_0x15adc5){_0x46be05[_0x27d6('0x49')]=_0x15adc5;if(_0x171c94['query'][_0x27d6('0x51')]){_0x90066f[_0x27d6('0x4a')]=[{'all':!![]}];}return db[_0x27d6('0xb1')][_0x27d6('0x8f')](_0x90066f);})[_0x27d6('0x18')](function(_0x391783){_0x46be05['rows']=_0x391783;return _0x46be05;});}})[_0x27d6('0x18')](respondWithFilteredResult(_0x4d2b76,_0x90066f))[_0x27d6('0x52')](handleError(_0x4d2b76,null));};exports[_0x27d6('0xb2')]=function(_0x9095a5,_0x3edbb2,_0x453a20){var _0x16b549={};var _0x157f1e={};var _0x1069e8;var _0x3da684;return db['User']['findOne']({'where':{'id':_0x9095a5[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x3edbb2,null))[_0x27d6('0x18')](function(_0x12769b){if(_0x12769b){_0x1069e8=_0x12769b;_0x157f1e[_0x27d6('0x31')]=_['keys'](db[_0x27d6('0xb3')][_0x27d6('0x30')]);_0x157f1e[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x9095a5[_0x27d6('0x32')]);_0x157f1e[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0x157f1e[_0x27d6('0x31')],_0x157f1e['query']);_0x16b549[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x157f1e[_0x27d6('0x31')],qs['fields'](_0x9095a5[_0x27d6('0x32')][_0x27d6('0x37')]));_0x16b549[_0x27d6('0x38')]=_0x16b549[_0x27d6('0x38')][_0x27d6('0x39')]?_0x16b549[_0x27d6('0x38')]:_0x157f1e[_0x27d6('0x31')];_0x16b549['order']=qs[_0x27d6('0x3d')](_0x9095a5[_0x27d6('0x32')]['sort']);_0x16b549[_0x27d6('0x3e')]=qs[_0x27d6('0x36')](_['pick'](_0x9095a5[_0x27d6('0x32')],_0x157f1e[_0x27d6('0x36')]));if(_0x9095a5[_0x27d6('0x32')][_0x27d6('0xa4')]){_0x16b549[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x16b549['where'],{'$or':_[_0x27d6('0x43')](_0x16b549['attributes'],function(_0x486880){var _0x4f21fa={};_0x4f21fa[_0x486880]={'$like':'%'+_0x9095a5[_0x27d6('0x32')][_0x27d6('0xa4')]+'%'};return _0x4f21fa;})});}_0x16b549=_['merge']({},_0x16b549,_0x9095a5[_0x27d6('0x47')]);return _0x1069e8['getSmsInteractions'](_0x16b549);}})[_0x27d6('0x18')](function(_0x5ab183){if(_0x5ab183){_0x3da684=_0x5ab183[_0x27d6('0x39')];if(!_0x9095a5['query']['hasOwnProperty'](_0x27d6('0x3b'))){_0x16b549[_0x27d6('0x24')]=qs[_0x27d6('0x24')](_0x9095a5[_0x27d6('0x32')][_0x27d6('0x24')]);_0x16b549[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x9095a5[_0x27d6('0x32')][_0x27d6('0x23')]);}return _0x1069e8[_0x27d6('0xb2')](_0x16b549);}})[_0x27d6('0x18')](function(_0x5f2ea5){if(_0x5f2ea5){return _0x5f2ea5?{'count':_0x3da684,'rows':_0x5f2ea5}:null;}})[_0x27d6('0x18')](respondWithResult(_0x3edbb2,null))['catch'](handleError(_0x3edbb2,null));};exports[_0x27d6('0xb4')]=function(_0x33543a,_0x46ae2f,_0x198b93){var _0x7e9b7e={};var _0x1df743={};var _0x17ac13;var _0x4f138d;return db[_0x27d6('0x48')][_0x27d6('0xa1')]({'where':{'id':_0x33543a[_0x27d6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46ae2f,null))[_0x27d6('0x18')](function(_0x536a82){if(_0x536a82){_0x17ac13=_0x536a82;_0x1df743['model']=_[_0x27d6('0x35')](db[_0x27d6('0xb5')][_0x27d6('0x30')]);_0x1df743[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x33543a[_0x27d6('0x32')]);_0x1df743[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0x1df743[_0x27d6('0x31')],_0x1df743[_0x27d6('0x32')]);_0x7e9b7e[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x1df743['model'],qs[_0x27d6('0x37')](_0x33543a[_0x27d6('0x32')][_0x27d6('0x37')]));_0x7e9b7e[_0x27d6('0x38')]=_0x7e9b7e['attributes'][_0x27d6('0x39')]?_0x7e9b7e[_0x27d6('0x38')]:_0x1df743[_0x27d6('0x31')];_0x7e9b7e[_0x27d6('0x3c')]=qs[_0x27d6('0x3d')](_0x33543a[_0x27d6('0x32')][_0x27d6('0x3d')]);_0x7e9b7e[_0x27d6('0x3e')]=qs['filters'](_[_0x27d6('0x3f')](_0x33543a['query'],_0x1df743[_0x27d6('0x36')]));if(_0x33543a['query'][_0x27d6('0xa4')]){_0x7e9b7e[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x7e9b7e[_0x27d6('0x3e')],{'$or':_[_0x27d6('0x43')](_0x7e9b7e[_0x27d6('0x38')],function(_0x4af13f){var _0xd4d686={};_0xd4d686[_0x4af13f]={'$like':'%'+_0x33543a['query'][_0x27d6('0xa4')]+'%'};return _0xd4d686;})});}_0x7e9b7e=_[_0x27d6('0x42')]({},_0x7e9b7e,_0x33543a[_0x27d6('0x47')]);return _0x17ac13[_0x27d6('0xb4')](_0x7e9b7e);}})[_0x27d6('0x18')](function(_0x50bbbe){if(_0x50bbbe){_0x4f138d=_0x50bbbe[_0x27d6('0x39')];if(!_0x33543a[_0x27d6('0x32')][_0x27d6('0x3a')](_0x27d6('0x3b'))){_0x7e9b7e[_0x27d6('0x24')]=qs[_0x27d6('0x24')](_0x33543a['query']['limit']);_0x7e9b7e[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x33543a[_0x27d6('0x32')][_0x27d6('0x23')]);}return _0x17ac13[_0x27d6('0xb4')](_0x7e9b7e);}})[_0x27d6('0x18')](function(_0x125ad7){if(_0x125ad7){return _0x125ad7?{'count':_0x4f138d,'rows':_0x125ad7}:null;}})[_0x27d6('0x18')](respondWithResult(_0x46ae2f,null))[_0x27d6('0x52')](handleError(_0x46ae2f,null));};exports[_0x27d6('0xb6')]=function(_0xac1ed5,_0x1f62b1,_0x17727b){var _0x369e47;var _0x6af2d9;var _0x346e8c;return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0xac1ed5[_0x27d6('0x4c')]['id'],'role':_0x27d6('0x5b')},'attributes':['id','name',_0x27d6('0xb7'),_0x27d6('0xb8'),_0x27d6('0x5a'),_0x27d6('0x65'),'loginInPause']})[_0x27d6('0x18')](handleEntityNotFound(_0x1f62b1,null))['then'](function(_0x1b7848){if(_0x1b7848){_0x369e47=_0x1b7848;_0x346e8c=_0xac1ed5[_0x27d6('0x54')][_0x27d6('0xb9')]&&_0x369e47[_0xac1ed5[_0x27d6('0x54')][_0x27d6('0xb9')]]?util['format'](_0x27d6('0xba'),_0x369e47[_0xac1ed5['body']['interface']]):util[_0x27d6('0x62')](_0x27d6('0xbb'),_0x369e47['name']);socket['to'](util[_0x27d6('0x62')](_0x27d6('0xbc'),_0x369e47[_0x27d6('0x2e')]))[_0x27d6('0xbd')](_0x27d6('0xbe'),{'ip':_0xac1ed5[_0x27d6('0xbf')]['x-forwarded-for']||_0xac1ed5[_0x27d6('0xc0')][_0x27d6('0xc1')]||_0xac1ed5[_0x27d6('0xc2')][_0x27d6('0xc1')]||_0xac1ed5[_0x27d6('0xc0')][_0x27d6('0xc2')]['remoteAddress']});return db[_0x27d6('0x93')][_0x27d6('0x2b')]({'where':{'membername':_0x369e47[_0x27d6('0x2e')]},'individualHooks':!![]});}})['then'](function(_0x9c0c3b){if(_0x369e47){return _0x369e47['getVoiceQueues']({'raw':!![]});}})[_0x27d6('0x18')](function(_0x3105c5){var _0x157460=[];if(_0x3105c5){_0x6af2d9=_0x3105c5;if(_0x6af2d9['length']){for(var _0x313440=0x0;_0x313440<_0x6af2d9[_0x27d6('0x39')];_0x313440++){_0x157460[_0x27d6('0x90')]({'membername':_0x369e47[_0x27d6('0x2e')],'UserId':_0x369e47['id'],'queue_name':_0x6af2d9[_0x313440][_0x27d6('0x2e')],'VoiceQueueId':_0x6af2d9[_0x313440]['id'],'interface':_0x346e8c||util[_0x27d6('0x62')](_0x27d6('0x91'),_0x27d6('0xc3'),_0x369e47[_0x27d6('0x2e')]),'paused':_0x369e47[_0x27d6('0x85')]||![],'penalty':_0x6af2d9[_0x313440]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x27d6('0x92')](_0x157460,function(_0x204590){return db[_0x27d6('0x93')][_0x27d6('0x94')](_0x204590);});}}})[_0x27d6('0x18')](function(){return db['MemberReport'][_0x27d6('0x8f')]({'where':{'membername':_0x369e47[_0x27d6('0x2e')],'interface':util['format']('%s/%s',_0x27d6('0xc3'),_0x369e47[_0x27d6('0x2e')]),'exitAt':null}});})[_0x27d6('0x18')](function(_0x5144d3){var _0xaf9738=[];_0x5144d3[_0x27d6('0xc4')](function(_0x3c742d){_0xaf9738[_0x27d6('0x90')](_0x3c742d[_0x27d6('0x2a')]({'exitAt':moment()[_0x27d6('0x62')](_0x27d6('0xc5'))}));});return BPromise['all'](_0xaf9738);})[_0x27d6('0x18')](function(){var _0x31b99e=[];var _0x23c3b3=[];var _0x3a7165=utils['getChannels']();var _0x122b99={'membername':_0x369e47[_0x27d6('0x2e')],'interface':util[_0x27d6('0x62')](_0x27d6('0x91'),_0x27d6('0xc3'),_0x369e47[_0x27d6('0x2e')]),'enterAt':moment()[_0x27d6('0x62')](_0x27d6('0xc5')),'role':_0x369e47['role'],'internal':_0x369e47[_0x27d6('0x65')]};_0x3a7165[_0x27d6('0xc4')](function(_0x1841ee){_0x31b99e['push'](_['merge']({'channel':_0x1841ee,'type':_0x27d6('0xc6'),'data1':_0xac1ed5[_0x27d6('0x54')][_0x27d6('0xc7')],'data2':_0x346e8c},_0x122b99));if(_0x369e47[_0x27d6('0x85')]){_0x23c3b3[_0x27d6('0x90')](_[_0x27d6('0x42')]({'channel':_0x1841ee,'type':_0x27d6('0xc8'),'data1':_0x27d6('0xc9')},_0x122b99));}});return db['MemberReport'][_0x27d6('0x53')](_0x31b99e[_0x27d6('0xca')](_0x23c3b3),{'individualHooks':!![]});})[_0x27d6('0x18')](function(){return _0x369e47['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x369e47[_0x27d6('0x85')]||![],'mailPause':_0x369e47[_0x27d6('0x85')]||![],'chatPause':_0x369e47['loginInPause']||![],'faxPause':_0x369e47[_0x27d6('0x85')]||![],'smsPause':_0x369e47['loginInPause']||![],'openchannelPause':_0x369e47[_0x27d6('0x85')]||![],'pauseType':_0x369e47[_0x27d6('0x85')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x27d6('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x27d6('0x18')](respondWithResult(_0x1f62b1,null))['catch'](handleError(_0x1f62b1,null));};exports['logout']=function(_0x33bf81,_0x3fb67d,_0x2a09af){var _0x422b61;return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0x33bf81[_0x27d6('0x4c')]['id'],'role':_0x27d6('0x5b')},'attributes':['id',_0x27d6('0x2e'),_0x27d6('0x5a')]})[_0x27d6('0x18')](handleEntityNotFound(_0x3fb67d,null))['then'](function(_0x533a87){if(_0x533a87){_0x422b61=_0x533a87;return db['UserVoiceQueueRt'][_0x27d6('0x2b')]({'where':{'membername':_0x422b61[_0x27d6('0x2e')]},'individualHooks':!![]});}})[_0x27d6('0x18')](function(){return db[_0x27d6('0xcb')]['findAll']({'where':{'membername':_0x422b61[_0x27d6('0x2e')],'interface':util['format'](_0x27d6('0x91'),_0x27d6('0xc3'),_0x422b61[_0x27d6('0x2e')]),'exitAt':null}});})[_0x27d6('0x18')](function(_0x1c7f97){var _0x329e16=[];_0x1c7f97[_0x27d6('0xc4')](function(_0x1f561a){_0x329e16[_0x27d6('0x90')](_0x1f561a['update']({'exitAt':moment()[_0x27d6('0x62')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x27d6('0xcc')](_0x329e16);})[_0x27d6('0x18')](function(){return _0x422b61[_0x27d6('0x2a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});})[_0x27d6('0x18')](respondWithResult(_0x3fb67d,null))[_0x27d6('0x52')](handleError(_0x3fb67d,null));};exports[_0x27d6('0xcd')]=function(_0x42afa5,_0x5f3201,_0x31216b){var _0x36ed97;return db[_0x27d6('0x93')][_0x27d6('0x2a')]({'paused':0x1},{'where':{'UserId':_0x42afa5[_0x27d6('0x4c')]['id']},'individualHooks':!![]})[_0x27d6('0x18')](function(){return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0x42afa5[_0x27d6('0x4c')]['id'],'role':_0x27d6('0x5b')},'attributes':['id',_0x27d6('0x2e'),_0x27d6('0x5a'),_0x27d6('0x65')]});})[_0x27d6('0x18')](handleEntityNotFound(_0x5f3201,null))[_0x27d6('0x18')](function(_0x19d429){if(_0x19d429){_0x36ed97=_0x19d429;return respondWithRpcPromise(_0x27d6('0xce'),_0x27d6('0xcd'),{'id':_0x36ed97['id'],'name':_0x36ed97['name'],'pause':!![]});}})[_0x27d6('0x18')](function(){if(_0x36ed97){return db[_0x27d6('0xcb')][_0x27d6('0x8f')]({'where':{'membername':_0x36ed97[_0x27d6('0x2e')],'interface':util[_0x27d6('0x62')]('%s/%s',_0x27d6('0xc3'),_0x36ed97['name']),'type':_0x27d6('0xc8'),'exitAt':null}});}})[_0x27d6('0x18')](function(_0x58cfee){if(_0x58cfee[_0x27d6('0x39')]){var _0x5abe2f=moment()[_0x27d6('0x62')](_0x27d6('0xc5'));for(var _0x23f986=0x0,_0x1123e7=_0x58cfee['length'];_0x23f986<_0x1123e7;_0x23f986++){_0x58cfee[_0x23f986][_0x27d6('0xcf')]({'exitAt':_0x5abe2f});}}})['then'](function(){var _0x190bae=[];var _0x9f5fa8=utils['getChannels']();_0x9f5fa8[_0x27d6('0xc4')](function(_0x3b0e4a){_0x190bae[_0x27d6('0x90')]({'channel':_0x3b0e4a,'membername':_0x36ed97[_0x27d6('0x2e')],'interface':util[_0x27d6('0x62')]('%s/%s',_0x27d6('0xc3'),_0x36ed97['name']),'type':_0x27d6('0xc8'),'enterAt':moment()[_0x27d6('0x62')](_0x27d6('0xc5')),'data1':_0x42afa5[_0x27d6('0x54')][_0x27d6('0xd0')]||_0x27d6('0xd1'),'role':_0x36ed97[_0x27d6('0x5a')],'internal':_0x36ed97[_0x27d6('0x65')]});});return db[_0x27d6('0xcb')][_0x27d6('0x53')](_0x190bae,{'individualHooks':!![]});})[_0x27d6('0x18')](function(){return _0x36ed97['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x42afa5[_0x27d6('0x54')][_0x27d6('0xd0')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x27d6('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x27d6('0x18')](respondWithResult(_0x5f3201,null))[_0x27d6('0x52')](handleError(_0x5f3201,null));};exports[_0x27d6('0xd2')]=function(_0x2dd42,_0x3d0442,_0x40a01b){var _0x59f0cc;return db[_0x27d6('0x48')]['find']({'where':{'id':_0x2dd42['params']['id']},'attributes':['id',_0x27d6('0x2e'),_0x27d6('0x5a'),'voicePause',_0x27d6('0xd3'),_0x27d6('0xd4'),'faxPause','openchannelPause',_0x27d6('0xd5'),_0x27d6('0xd6'),'lastPauseAt']})[_0x27d6('0x18')](handleEntityNotFound(_0x3d0442,null))[_0x27d6('0x18')](function(_0x164fcc){if(_0x164fcc){_0x59f0cc=_0x164fcc;if(_0x2dd42[_0x27d6('0x54')][_0x27d6('0x8a')]&&!utils[_0x27d6('0x87')](_0x2dd42[_0x27d6('0x54')][_0x27d6('0x8a')])){throw new db[(_0x27d6('0x7e'))][(_0x27d6('0x80'))](_0x27d6('0x88'));}switch(_0x2dd42[_0x27d6('0x54')]['channel']){case _0x27d6('0x8d'):return respondWithRpcPromise('QueuePause',_0x27d6('0xd2'),{'id':_0x59f0cc['id'],'name':_0x59f0cc['name'],'pause':![]})[_0x27d6('0x18')](function(){return db[_0x27d6('0x93')][_0x27d6('0x2a')]({'paused':0x0},{'where':{'UserId':_0x59f0cc['id']},'individualHooks':!![]});})['then'](function(){return db[_0x27d6('0xcb')][_0x27d6('0x55')]({'where':{'channel':_0x2dd42[_0x27d6('0x54')][_0x27d6('0x8a')],'membername':_0x59f0cc[_0x27d6('0x2e')],'interface':util[_0x27d6('0x62')](_0x27d6('0x91'),_0x27d6('0xc3'),_0x59f0cc[_0x27d6('0x2e')]),'type':'PAUSE','exitAt':null}});})[_0x27d6('0x18')](function(_0x1c29eb){if(_0x1c29eb){return _0x1c29eb[_0x27d6('0x2a')]({'exitAt':moment()['format'](_0x27d6('0xc5')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x27d6('0x18')](function(){return _0x59f0cc[_0x27d6('0x2a')]({'voicePause':![]});});case _0x27d6('0xd7'):case _0x27d6('0xd8'):case _0x27d6('0xd9'):case'sms':case'openchannel':return db[_0x27d6('0xcb')]['find']({'where':{'channel':_0x2dd42[_0x27d6('0x54')][_0x27d6('0x8a')],'membername':_0x59f0cc[_0x27d6('0x2e')],'interface':util[_0x27d6('0x62')]('%s/%s',_0x27d6('0xc3'),_0x59f0cc['name']),'type':_0x27d6('0xc8'),'exitAt':null}})[_0x27d6('0x18')](function(_0x117621){if(_0x117621){return _0x117621[_0x27d6('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x27d6('0xda')},{'individualHooks':!![]});}return null;})[_0x27d6('0x18')](function(){var _0x528a14={};_[_0x27d6('0x25')](_0x528a14,util[_0x27d6('0x62')](_0x27d6('0xdb'),_0x2dd42['body'][_0x27d6('0x8a')],_0x27d6('0xdc')),![]);return _0x59f0cc[_0x27d6('0x2a')](_0x528a14);});default:return respondWithRpcPromise(_0x27d6('0xce'),_0x27d6('0xd2'),{'id':_0x59f0cc['id'],'name':_0x59f0cc['name'],'pause':![]})['then'](function(){return db[_0x27d6('0x93')][_0x27d6('0x2a')]({'paused':0x0},{'where':{'UserId':_0x59f0cc['id']}});})['then'](function(){return db['MemberReport'][_0x27d6('0x8f')]({'where':{'membername':_0x59f0cc[_0x27d6('0x2e')],'interface':util[_0x27d6('0x62')](_0x27d6('0x91'),'SIP',_0x59f0cc[_0x27d6('0x2e')]),'type':_0x27d6('0xc8'),'exitAt':null}});})[_0x27d6('0x18')](function(_0x1ee7b5){var _0x46ace0=[];_0x1ee7b5[_0x27d6('0xc4')](function(_0x4b689a){_0x46ace0[_0x27d6('0x90')](_0x4b689a[_0x27d6('0x2a')]({'exitAt':moment()[_0x27d6('0x62')](_0x27d6('0xc5')),'data2':_0x27d6('0xda')}));});return BPromise[_0x27d6('0xcc')](_0x46ace0);})[_0x27d6('0x18')](function(){return _0x59f0cc[_0x27d6('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x27d6('0x18')](respondWithResult(_0x3d0442,null))[_0x27d6('0x52')](handleError(_0x3d0442,null));};exports[_0x27d6('0xdd')]=function(_0x227769,_0x3da3b5,_0x80965c){var _0x41d0d0={};var _0xc307db={};var _0xcdcd9c;var _0x1b205f;return db[_0x27d6('0x48')][_0x27d6('0xa1')]({'where':{'id':_0x227769[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x3da3b5,null))[_0x27d6('0x18')](function(_0x4d58c0){if(_0x4d58c0){_0xcdcd9c=_0x4d58c0;_0xc307db[_0x27d6('0x31')]=_['keys'](db['Team']['rawAttributes']);_0xc307db[_0x27d6('0x32')]=_[_0x27d6('0x35')](_0x227769[_0x27d6('0x32')]);_0xc307db[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0xc307db[_0x27d6('0x31')],_0xc307db[_0x27d6('0x32')]);_0x41d0d0['attributes']=_[_0x27d6('0x50')](_0xc307db['model'],qs['fields'](_0x227769['query'][_0x27d6('0x37')]));_0x41d0d0[_0x27d6('0x38')]=_0x41d0d0['attributes'][_0x27d6('0x39')]?_0x41d0d0['attributes']:_0xc307db[_0x27d6('0x31')];_0x41d0d0[_0x27d6('0x3c')]=qs['sort'](_0x227769[_0x27d6('0x32')][_0x27d6('0x3d')]);_0x41d0d0[_0x27d6('0x3e')]=qs[_0x27d6('0x36')](_[_0x27d6('0x3f')](_0x227769['query'],_0xc307db[_0x27d6('0x36')]));if(_0x227769['query'][_0x27d6('0xa4')]){_0x41d0d0[_0x27d6('0x3e')]=_['merge'](_0x41d0d0[_0x27d6('0x3e')],{'$or':_['map'](_0x41d0d0['attributes'],function(_0x3dacaf){var _0x3b02e1={};_0x3b02e1[_0x3dacaf]={'$like':'%'+_0x227769['query'][_0x27d6('0xa4')]+'%'};return _0x3b02e1;})});}_0x41d0d0=_[_0x27d6('0x42')]({},_0x41d0d0,_0x227769[_0x27d6('0x47')]);return _0xcdcd9c['getTeams'](_0x41d0d0);}})[_0x27d6('0x18')](function(_0x1f4adc){if(_0x1f4adc){_0x1b205f=_0x1f4adc[_0x27d6('0x39')];if(!_0x227769[_0x27d6('0x32')][_0x27d6('0x3a')](_0x27d6('0x3b'))){_0x41d0d0['limit']=qs[_0x27d6('0x24')](_0x227769[_0x27d6('0x32')][_0x27d6('0x24')]);_0x41d0d0[_0x27d6('0x23')]=qs[_0x27d6('0x23')](_0x227769[_0x27d6('0x32')][_0x27d6('0x23')]);}return _0xcdcd9c['getTeams'](_0x41d0d0);}})[_0x27d6('0x18')](function(_0x53a7b3){if(_0x53a7b3){return _0x53a7b3?{'count':_0x1b205f,'rows':_0x53a7b3}:null;}})[_0x27d6('0x18')](respondWithResult(_0x3da3b5,null))[_0x27d6('0x52')](handleError(_0x3da3b5,null));};exports[_0x27d6('0xde')]=function(_0x5c08a8,_0x2bc249,_0xd504cd){return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0x5c08a8[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x2bc249,null))[_0x27d6('0x18')](function(_0x42a7f8){if(_0x42a7f8){return _0x42a7f8[_0x27d6('0xde')](_0x5c08a8[_0x27d6('0x54')][_0x27d6('0x58')],_[_0x27d6('0x59')](_0x5c08a8['body'],[_0x27d6('0x58'),'id'])||{});}})[_0x27d6('0x18')](respondWithResult(_0x2bc249,null))[_0x27d6('0x52')](handleError(_0x2bc249,null));};exports[_0x27d6('0xdf')]=function(_0x3fab52,_0x19866a,_0x3dc7ad){var _0x15823d;return db[_0x27d6('0x48')][_0x27d6('0x55')]({'where':{'id':_0x3fab52[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x19866a,null))['then'](function(_0x1eb7b0){if(_0x1eb7b0){return _0x1eb7b0['removeTeams'](_0x3fab52[_0x27d6('0x32')]['ids']);}})[_0x27d6('0x18')](respondWithStatusCode(_0x19866a,null))['catch'](handleError(_0x19866a,null));};exports['getLists']=function(_0x1aa314,_0x290326,_0x2494ae){var _0x40f686={};var _0x3772f8={};var _0x1d0171;var _0x3e1b2c;return db[_0x27d6('0x48')][_0x27d6('0xa1')]({'where':{'id':_0x1aa314[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x290326,null))['then'](function(_0x5ea8e6){if(_0x5ea8e6){_0x1d0171=_0x5ea8e6;_0x3772f8[_0x27d6('0x31')]=_[_0x27d6('0x35')](db['CmList'][_0x27d6('0x30')]);_0x3772f8['query']=_[_0x27d6('0x35')](_0x1aa314[_0x27d6('0x32')]);_0x3772f8[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0x3772f8['model'],_0x3772f8[_0x27d6('0x32')]);_0x40f686[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x3772f8[_0x27d6('0x31')],qs[_0x27d6('0x37')](_0x1aa314['query'][_0x27d6('0x37')]));_0x40f686[_0x27d6('0x38')]=_0x40f686['attributes'][_0x27d6('0x39')]?_0x40f686[_0x27d6('0x38')]:_0x3772f8[_0x27d6('0x31')];_0x40f686['order']=qs[_0x27d6('0x3d')](_0x1aa314[_0x27d6('0x32')][_0x27d6('0x3d')]);_0x40f686[_0x27d6('0x3e')]=qs[_0x27d6('0x36')](_[_0x27d6('0x3f')](_0x1aa314['query'],_0x3772f8[_0x27d6('0x36')]));if(_0x1aa314[_0x27d6('0x32')][_0x27d6('0xa4')]){_0x40f686[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x40f686[_0x27d6('0x3e')],{'$or':_[_0x27d6('0x43')](_0x40f686[_0x27d6('0x38')],function(_0x1c6dcf){var _0x52f1e0={};_0x52f1e0[_0x1c6dcf]={'$like':'%'+_0x1aa314[_0x27d6('0x32')]['filter']+'%'};return _0x52f1e0;})});}_0x40f686=_[_0x27d6('0x42')]({},_0x40f686,_0x1aa314['options']);return _0x1d0171[_0x27d6('0xe0')](_0x40f686);}})[_0x27d6('0x18')](function(_0x1f2d5e){if(_0x1f2d5e){_0x3e1b2c=_0x1f2d5e[_0x27d6('0x39')];if(!_0x1aa314[_0x27d6('0x32')][_0x27d6('0x3a')]('nolimit')){_0x40f686[_0x27d6('0x24')]=qs[_0x27d6('0x24')](_0x1aa314[_0x27d6('0x32')][_0x27d6('0x24')]);_0x40f686[_0x27d6('0x23')]=qs['offset'](_0x1aa314[_0x27d6('0x32')][_0x27d6('0x23')]);}return _0x1d0171[_0x27d6('0xe0')](_0x40f686);}})['then'](function(_0x49b824){if(_0x49b824){return _0x49b824?{'count':_0x3e1b2c,'rows':_0x49b824}:null;}})[_0x27d6('0x18')](respondWithResult(_0x290326,null))[_0x27d6('0x52')](handleError(_0x290326,null));};exports[_0x27d6('0xe1')]=function(_0x30cfa1,_0x25389e,_0xef13f1){var _0x2c4d42={};var _0x546043={};var _0x3e47c6;var _0x11f177;return db['User'][_0x27d6('0xa1')]({'where':{'id':_0x30cfa1[_0x27d6('0x4c')]['id']}})[_0x27d6('0x18')](handleEntityNotFound(_0x25389e,null))[_0x27d6('0x18')](function(_0x433077){if(_0x433077){_0x3e47c6=_0x433077;_0x546043['model']=_[_0x27d6('0x35')](db[_0x27d6('0x48')]['rawAttributes']);_0x546043['query']=_[_0x27d6('0x35')](_0x30cfa1['query']);_0x546043[_0x27d6('0x36')]=_[_0x27d6('0x50')](_0x546043[_0x27d6('0x31')],_0x546043['query']);_0x2c4d42[_0x27d6('0x38')]=_[_0x27d6('0x50')](_0x546043[_0x27d6('0x31')],qs['fields'](_0x30cfa1[_0x27d6('0x32')]['fields']));_0x2c4d42[_0x27d6('0x38')]=_0x2c4d42['attributes'][_0x27d6('0x39')]?_0x2c4d42[_0x27d6('0x38')]:_0x546043[_0x27d6('0x31')];_0x2c4d42[_0x27d6('0x3c')]=qs[_0x27d6('0x3d')](_0x30cfa1[_0x27d6('0x32')][_0x27d6('0x3d')]);_0x2c4d42[_0x27d6('0x3e')]=qs[_0x27d6('0x36')](_['pick'](_0x30cfa1['query'],_0x546043[_0x27d6('0x36')]));if(_0x30cfa1[_0x27d6('0x32')][_0x27d6('0xa4')]){_0x2c4d42[_0x27d6('0x3e')]=_[_0x27d6('0x42')](_0x2c4d42[_0x27d6('0x3e')],{'$or':_[_0x27d6('0x43')](_0x2c4d42['attributes'],function(_0x288423){var _0x554b59={};_0x554b59[_0x288423]={'$like':'%'+_0x30cfa1[_0x27d6('0x32')][_0x27d6('0xa4')]+'%'};return _0x554b59;})});}_0x2c4d42[_0x27d6('0x31')]=db[_0x27d6('0x48')];_0x2c4d42['as']=_0x27d6('0xe2');_0x2c4d42=_[_0x27d6('0x42')]({},_0x2c4d42,_0x30cfa1[_0x27d6('0x47')]);return _0x3e47c6[_0x27d6('0xe3')]({'include':[_0x2c4d42]});}})[_0x27d6('0x18')](function(_0x19f6ce){if(_0x19f6ce){var _0x326a70={},_0x51ad98=[],_0x57d659=0x0;for(var _0x4bf228=0x0;_0x4bf228<_0x19f6ce['length'];_0x4bf228+=0x1){for(var _0x288ca4=0x0,_0x1c4967;_0x288ca4<_0x19f6ce[_0x4bf228][_0x27d6('0xe2')][_0x27d6('0x39')];_0x288ca4+=0x1){_0x1c4967=_0x19f6ce[_0x4bf228][_0x27d6('0xe2')][_0x288ca4][_0x27d6('0xa7')]({'plain':!![]});_0x326a70[_0x1c4967['id']]=_0x1c4967;}}_0x326a70=_[_0x27d6('0xe4')](_0x326a70);for(var _0x3dd064=qs[_0x27d6('0x23')](_0x30cfa1[_0x27d6('0x32')][_0x27d6('0x23')]);_0x3dd064<_0x326a70[_0x27d6('0x39')]&&_0x51ad98['length']=_0x4d4c3d[_0xa3db('0x4a')]){throw new Error(_0xa3db('0x4b'));}})[_0xa3db('0xa')](function(){if(_0xbb10cf){return db[_0xa3db('0x26')][_0xa3db('0x46')]({'where':{'membername':_0xbb10cf[_0xa3db('0x31')]},'individualHooks':!![]});}})[_0xa3db('0xa')](function(){if(_0xbb10cf){return _0xbb10cf[_0xa3db('0x4c')]({'raw':!![]});}})[_0xa3db('0xa')](function(_0x4affde){if(_0xbb10cf){if(_0x4affde){var _0xe2f546=[];_0x54ce25=_0x4affde;if(_0x54ce25[_0xa3db('0x2c')]){for(var _0x3fc3ca=0x0;_0x3fc3ca<_0x54ce25[_0xa3db('0x2c')];_0x3fc3ca++){_0xe2f546['push'](db[_0xa3db('0x26')][_0xa3db('0x4d')]({'membername':_0xbb10cf[_0xa3db('0x31')],'UserId':_0xbb10cf['id'],'queue_name':_0x54ce25[_0x3fc3ca][_0xa3db('0x31')],'VoiceQueueId':_0x54ce25[_0x3fc3ca]['id'],'interface':_0x31713e[_0xa3db('0x32')]['interface']||util[_0xa3db('0x29')](_0xa3db('0x2a'),_0xa3db('0x2b'),_0xbb10cf[_0xa3db('0x31')]),'paused':_0xbb10cf[_0xa3db('0x47')]||![],'penalty':_0x54ce25[_0x3fc3ca]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xa3db('0x44')](_0xe2f546);}}}})[_0xa3db('0xa')](function(){if(_0xbb10cf){return db[_0xa3db('0x28')][_0xa3db('0x17')]({'where':{'membername':_0xbb10cf['name'],'interface':util[_0xa3db('0x29')](_0xa3db('0x2a'),_0xa3db('0x2b'),_0xbb10cf['name']),'exitAt':null}});}})[_0xa3db('0xa')](function(_0xd88b39){if(_0xbb10cf){if(_0xd88b39&&_0xd88b39[_0xa3db('0x2c')]){var _0x124997=[];_0xd88b39[_0xa3db('0x30')](function(_0x3d49f2){_0x124997[_0xa3db('0x43')](_0x3d49f2[_0xa3db('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x124997);}}})[_0xa3db('0xa')](function(_0x2fa116){if(_0xbb10cf){var _0x3999fb=[];var _0x2e38b0=[];var _0x449d86=utils[_0xa3db('0x2f')]();var _0x231093={'membername':_0xbb10cf[_0xa3db('0x31')],'interface':util['format'](_0xa3db('0x2a'),_0xa3db('0x2b'),_0xbb10cf[_0xa3db('0x31')]),'enterAt':moment()[_0xa3db('0x29')](_0xa3db('0x2d')),'role':_0xbb10cf[_0xa3db('0x24')],'internal':_0xbb10cf[_0xa3db('0x25')]};_0x449d86[_0xa3db('0x30')](function(_0x550426){_0x3999fb['push'](_['merge']({'channel':_0x550426,'type':_0xa3db('0x4e'),'data1':_0xa3db('0x4f'),'data2':_0x31713e['body']['interface']||util[_0xa3db('0x29')](_0xa3db('0x2a'),'SIP',_0xbb10cf[_0xa3db('0x31')])},_0x231093));if(_0xbb10cf[_0xa3db('0x47')]){_0x2e38b0[_0xa3db('0x43')](_[_0xa3db('0x50')]({'channel':_0x550426,'type':_0xa3db('0x40'),'data1':'LOGININPAUSE'},_0x231093));}});return db[_0xa3db('0x28')][_0xa3db('0x36')](_0x3999fb[_0xa3db('0x51')](_0x2e38b0),{'individualHooks':!![]});}})[_0xa3db('0xa')](function(){if(_0xbb10cf){return _0xbb10cf[_0xa3db('0x27')]({'online':!![],'lastLoginAt':moment()['format'](_0xa3db('0x2d')),'voicePause':_0xbb10cf['loginInPause']||![],'mailPause':_0xbb10cf['loginInPause']||![],'chatPause':_0xbb10cf[_0xa3db('0x47')]||![],'faxPause':_0xbb10cf[_0xa3db('0x47')]||![],'smsPause':_0xbb10cf[_0xa3db('0x47')]||![],'openchannelPause':_0xbb10cf[_0xa3db('0x47')]||![],'pauseType':_0xbb10cf[_0xa3db('0x47')]?_0xa3db('0x52'):null,'lastPauseAt':moment()[_0xa3db('0x29')](_0xa3db('0x2d'))});}})[_0xa3db('0xa')](function(_0x192df5){_0x34e1a0(_0x192df5);})['catch'](function(_0x22066e){_0x1dce51(_0x2f2d91[_0xa3db('0x11')](0x1f4,_0x22066e[_0xa3db('0x13')]));});});}; \ No newline at end of file +var _0xee9c=['info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetUser','User','findAll','options','attributes','limit','map','include','model','ShowUser','find','where','PauseUser','name','role','internal','UserVoiceQueueRt','update','MemberReport','format','%s/%s','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','SIP','body','type','findOne','channel','isValidChannel','voice','chat','fax','sms','openchannel','system','set','%s%s','Pause','all','LogoutUser','LoginUser','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','upsert','interface','UserVoiceQueue.penalty','getChannels','merge','callysquare','LOGININPAUSE','bulkCreate','concat','util','moment','bluebird','randomstring','../../config/logger','rpc','client','socket.io-emitter','localhost','./user.socket','request','then'];(function(_0x575b0d,_0x3b16e9){var _0x1cd20e=function(_0x3f910e){while(--_0x3f910e){_0x575b0d['push'](_0x575b0d['shift']());}};_0x1cd20e(++_0x3b16e9);}(_0xee9c,0x1e6));var _0xcee9=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0xee9c[_0x4a29a9];return _0x386570;};'use strict';var _=require('lodash');var util=require(_0xcee9('0x0'));var moment=require(_0xcee9('0x1'));var BPromise=require(_0xcee9('0x2'));var rs=require(_0xcee9('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcee9('0x4'))(_0xcee9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcee9('0x6')]['http']({'port':0x232a});var socket=require(_0xcee9('0x7'))({'host':_0xcee9('0x8'),'port':0x18eb});require(_0xcee9('0x9'))['register'](socket);function respondWithRpcPromise(_0x4d1f9a,_0x2b14da,_0x18ebe9){return new BPromise(function(_0x52fcc1,_0x7c80be){return client[_0xcee9('0xa')](_0x4d1f9a,_0x18ebe9)[_0xcee9('0xb')](function(_0x13d681){logger[_0xcee9('0xc')](_0xcee9('0xd'),_0x2b14da,'request\x20sent');logger[_0xcee9('0xe')](_0xcee9('0xf'),_0x2b14da,'request\x20sent',JSON[_0xcee9('0x10')](_0x13d681));if(_0x13d681[_0xcee9('0x11')]){if(_0x13d681[_0xcee9('0x11')]['code']===0x1f4){logger[_0xcee9('0x11')](_0xcee9('0xd'),_0x2b14da,_0x13d681[_0xcee9('0x11')][_0xcee9('0x12')]);return _0x7c80be(_0x13d681[_0xcee9('0x11')]['message']);}logger['error'](_0xcee9('0xd'),_0x2b14da,_0x13d681[_0xcee9('0x11')][_0xcee9('0x12')]);return _0x52fcc1(_0x13d681[_0xcee9('0x11')][_0xcee9('0x12')]);}else{logger[_0xcee9('0xc')](_0xcee9('0xd'),_0x2b14da,_0xcee9('0x13'));_0x52fcc1(_0x13d681[_0xcee9('0x14')][_0xcee9('0x12')]);}})[_0xcee9('0x15')](function(_0x309191){logger['error'](_0xcee9('0xd'),_0x2b14da,_0x309191);_0x7c80be(_0x309191);});});}exports[_0xcee9('0x16')]=function(_0x39f0dc){var _0xb84710=this;return new Promise(function(_0x29f6b2,_0x492fd6){return db[_0xcee9('0x17')][_0xcee9('0x18')]({'raw':_0x39f0dc[_0xcee9('0x19')]?_0x39f0dc[_0xcee9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x39f0dc[_0xcee9('0x19')]?_0x39f0dc[_0xcee9('0x19')]['where']||null:null,'attributes':_0x39f0dc['options']?_0x39f0dc[_0xcee9('0x19')][_0xcee9('0x1a')]||null:null,'limit':_0x39f0dc[_0xcee9('0x19')]?_0x39f0dc['options'][_0xcee9('0x1b')]||null:null,'include':_0x39f0dc[_0xcee9('0x19')]?_0x39f0dc[_0xcee9('0x19')]['include']?_[_0xcee9('0x1c')](_0x39f0dc['options'][_0xcee9('0x1d')],function(_0x3397bd){return{'model':db[_0x3397bd[_0xcee9('0x1e')]],'as':_0x3397bd['as'],'attributes':_0x3397bd[_0xcee9('0x1a')],'include':_0x3397bd[_0xcee9('0x1d')]?_[_0xcee9('0x1c')](_0x3397bd[_0xcee9('0x1d')],function(_0x591eaa){return{'model':db[_0x591eaa[_0xcee9('0x1e')]],'as':_0x591eaa['as'],'attributes':_0x591eaa[_0xcee9('0x1a')],'include':_0x591eaa['include']?_['map'](_0x591eaa[_0xcee9('0x1d')],function(_0x5180f5){return{'model':db[_0x5180f5[_0xcee9('0x1e')]],'as':_0x5180f5['as'],'attributes':_0x5180f5[_0xcee9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcee9('0xb')](function(_0x45a2b6){logger['info'](_0xcee9('0x16'),_0x39f0dc);logger[_0xcee9('0xe')](_0xcee9('0x16'),_0x39f0dc,JSON['stringify'](_0x45a2b6));_0x29f6b2(_0x45a2b6);})[_0xcee9('0x15')](function(_0x7014e5){logger[_0xcee9('0x11')]('GetUser',_0x7014e5[_0xcee9('0x12')],_0x39f0dc);_0x492fd6(_0xb84710[_0xcee9('0x11')](0x1f4,_0x7014e5[_0xcee9('0x12')]));});});};exports[_0xcee9('0x1f')]=function(_0x4de639){var _0x449a90=this;return new Promise(function(_0x3cacf1,_0x5a1882){return db[_0xcee9('0x17')][_0xcee9('0x20')]({'raw':_0x4de639[_0xcee9('0x19')]?_0x4de639[_0xcee9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4de639['options']?_0x4de639[_0xcee9('0x19')][_0xcee9('0x21')]||null:null,'attributes':_0x4de639[_0xcee9('0x19')]?_0x4de639[_0xcee9('0x19')][_0xcee9('0x1a')]||null:null,'include':_0x4de639[_0xcee9('0x19')]?_0x4de639[_0xcee9('0x19')]['include']?_[_0xcee9('0x1c')](_0x4de639[_0xcee9('0x19')][_0xcee9('0x1d')],function(_0x4b7726){return{'model':db[_0x4b7726[_0xcee9('0x1e')]],'as':_0x4b7726['as'],'attributes':_0x4b7726[_0xcee9('0x1a')],'include':_0x4b7726[_0xcee9('0x1d')]?_[_0xcee9('0x1c')](_0x4b7726[_0xcee9('0x1d')],function(_0x5f2fd3){return{'model':db[_0x5f2fd3['model']],'as':_0x5f2fd3['as'],'attributes':_0x5f2fd3[_0xcee9('0x1a')],'include':_0x5f2fd3[_0xcee9('0x1d')]?_[_0xcee9('0x1c')](_0x5f2fd3['include'],function(_0x33be39){return{'model':db[_0x33be39[_0xcee9('0x1e')]],'as':_0x33be39['as'],'attributes':_0x33be39[_0xcee9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcee9('0xb')](function(_0x34a120){logger[_0xcee9('0xc')]('ShowUser',_0x4de639);logger[_0xcee9('0xe')](_0xcee9('0x1f'),_0x4de639,JSON[_0xcee9('0x10')](_0x34a120));_0x3cacf1(_0x34a120);})[_0xcee9('0x15')](function(_0x4e3824){logger['error'](_0xcee9('0x1f'),_0x4e3824[_0xcee9('0x12')],_0x4de639);_0x5a1882(_0x449a90['error'](0x1f4,_0x4e3824['message']));});});};exports[_0xcee9('0x22')]=function(_0x21de1d){var _0x5663be=this;return new Promise(function(_0x13d410,_0x17a964){var _0x1327e0;return db['User']['find']({'where':_0x21de1d[_0xcee9('0x19')][_0xcee9('0x21')]||{},'attributes':['id',_0xcee9('0x23'),_0xcee9('0x24'),_0xcee9('0x25')]})[_0xcee9('0xb')](function(_0x30923e){if(_0x30923e){_0x1327e0=_0x30923e;return db[_0xcee9('0x26')][_0xcee9('0x27')]({'paused':0x1},{'where':{'UserId':_0x1327e0['id']},'individualHooks':!![]});}})[_0xcee9('0xb')](function(){if(_0x1327e0){return db[_0xcee9('0x28')]['findAll']({'where':{'membername':_0x1327e0['name'],'interface':util[_0xcee9('0x29')](_0xcee9('0x2a'),'SIP',_0x1327e0[_0xcee9('0x23')]),'type':_0xcee9('0x2b'),'exitAt':null}});}})[_0xcee9('0xb')](function(_0x53409e){if(_0x1327e0){if(_0x53409e&&_0x53409e[_0xcee9('0x2c')]){var _0x5d88a1=moment()[_0xcee9('0x29')](_0xcee9('0x2d'));for(var _0x369f31=0x0,_0x4ca507=_0x53409e[_0xcee9('0x2c')];_0x369f31<_0x4ca507;_0x369f31++){_0x53409e[_0x369f31][_0xcee9('0x2e')]({'exitAt':_0x5d88a1});}}}})[_0xcee9('0xb')](function(){if(_0x1327e0){var _0x5c9926=[];var _0x36f830=utils['getChannels']();_0x36f830[_0xcee9('0x2f')](function(_0x225ec8){_0x5c9926[_0xcee9('0x30')]({'channel':_0x225ec8,'membername':_0x1327e0[_0xcee9('0x23')],'interface':util[_0xcee9('0x29')](_0xcee9('0x2a'),_0xcee9('0x31'),_0x1327e0[_0xcee9('0x23')]),'type':_0xcee9('0x2b'),'enterAt':moment()[_0xcee9('0x29')](_0xcee9('0x2d')),'data1':_0x21de1d[_0xcee9('0x32')]['type']||'DEFAULT\x20PAUSE','role':_0x1327e0[_0xcee9('0x24')],'internal':_0x1327e0[_0xcee9('0x25')],'uniqueid':_0x21de1d[_0xcee9('0x32')]['uniqueid']||null});});return db['MemberReport']['bulkCreate'](_0x5c9926,{'individualHooks':!![]});}})[_0xcee9('0xb')](function(){if(_0x1327e0){return _0x1327e0[_0xcee9('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x21de1d[_0xcee9('0x32')][_0xcee9('0x33')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xcee9('0x29')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xcee9('0xb')](function(_0x372498){_0x13d410(_0x372498);})[_0xcee9('0x15')](function(_0x315446){_0x17a964(_0x5663be['error'](0x1f4,_0x315446['message']));});});};exports['UnpauseUser']=function(_0x5d61c5){var _0x587f3a=this;return new Promise(function(_0x5ada1e,_0x12945c){var _0x244fe5;return db['User'][_0xcee9('0x34')]({'where':_0x5d61c5[_0xcee9('0x19')][_0xcee9('0x21')]||{},'attributes':['id','name']})[_0xcee9('0xb')](function(_0x5d02af){if(_0x5d02af){_0x244fe5=_0x5d02af;if(_0x5d61c5[_0xcee9('0x32')][_0xcee9('0x35')]&&!utils[_0xcee9('0x36')](_0x5d61c5[_0xcee9('0x32')][_0xcee9('0x35')])){throw new Error('Unknown\x20channel');}switch(_0x5d61c5[_0xcee9('0x32')][_0xcee9('0x35')]){case _0xcee9('0x37'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x244fe5['id']}})[_0xcee9('0xb')](function(){return db[_0xcee9('0x28')][_0xcee9('0x20')]({'where':{'channel':_0x5d61c5[_0xcee9('0x32')][_0xcee9('0x35')],'membername':_0x244fe5[_0xcee9('0x23')],'interface':util[_0xcee9('0x29')]('%s/%s',_0xcee9('0x31'),_0x244fe5[_0xcee9('0x23')]),'type':_0xcee9('0x2b'),'exitAt':null}});})[_0xcee9('0xb')](function(_0x4c46a4){if(_0x4c46a4){return _0x4c46a4[_0xcee9('0x27')]({'exitAt':moment()[_0xcee9('0x29')](_0xcee9('0x2d')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xcee9('0xb')](function(){return _0x244fe5['update']({'voicePause':![]});});case'mail':case _0xcee9('0x38'):case _0xcee9('0x39'):case _0xcee9('0x3a'):case _0xcee9('0x3b'):return db[_0xcee9('0x28')][_0xcee9('0x20')]({'where':{'channel':_0x5d61c5[_0xcee9('0x32')][_0xcee9('0x35')],'membername':_0x244fe5[_0xcee9('0x23')],'interface':util[_0xcee9('0x29')](_0xcee9('0x2a'),'SIP',_0x244fe5[_0xcee9('0x23')]),'type':_0xcee9('0x2b'),'exitAt':null}})[_0xcee9('0xb')](function(_0xb85229){return _0xb85229[_0xcee9('0x27')]({'exitAt':moment()[_0xcee9('0x29')](_0xcee9('0x2d')),'data2':_0xcee9('0x3c')},{'individualHooks':!![]});})['then'](function(){var _0x5bd977={};_[_0xcee9('0x3d')](_0x5bd977,util[_0xcee9('0x29')](_0xcee9('0x3e'),_0x5d61c5['body'][_0xcee9('0x35')],_0xcee9('0x3f')),![]);return _0x244fe5[_0xcee9('0x27')](_0x5bd977);});default:return db[_0xcee9('0x26')][_0xcee9('0x27')]({'paused':0x0},{'where':{'UserId':_0x244fe5['id']}})['then'](function(){return db[_0xcee9('0x28')][_0xcee9('0x18')]({'where':{'membername':_0x244fe5['name'],'interface':util['format'](_0xcee9('0x2a'),_0xcee9('0x31'),_0x244fe5[_0xcee9('0x23')]),'type':_0xcee9('0x2b'),'exitAt':null}});})[_0xcee9('0xb')](function(_0x36211d){var _0xc9b2e1=[];_0x36211d[_0xcee9('0x2f')](function(_0x19086e){_0xc9b2e1[_0xcee9('0x30')](_0x19086e['update']({'exitAt':moment()['format'](_0xcee9('0x2d')),'data2':_0xcee9('0x3c')}));});return BPromise[_0xcee9('0x40')](_0xc9b2e1);})['then'](function(){return _0x244fe5[_0xcee9('0x27')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xcee9('0xb')](function(_0x3fac28){_0x5ada1e(_0x3fac28);})[_0xcee9('0x15')](function(_0x2753e6){_0x12945c(_0x587f3a[_0xcee9('0x11')](0x1f4,_0x2753e6['message']));});});};exports[_0xcee9('0x41')]=function(_0x2cd8e9){var _0x25b981=this;return new Promise(function(_0x3b005b,_0x1ea00e){var _0x47ee71;return db[_0xcee9('0x17')][_0xcee9('0x34')]({'where':_0x2cd8e9[_0xcee9('0x19')][_0xcee9('0x21')]||{},'attributes':['id',_0xcee9('0x23')]})[_0xcee9('0xb')](function(_0x34e485){if(_0x34e485){_0x47ee71=_0x34e485;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x47ee71[_0xcee9('0x23')]},'individualHooks':!![]});}})['then'](function(){if(_0x47ee71){return db[_0xcee9('0x28')][_0xcee9('0x18')]({'where':{'membername':_0x47ee71[_0xcee9('0x23')],'interface':util['format'](_0xcee9('0x2a'),_0xcee9('0x31'),_0x47ee71[_0xcee9('0x23')]),'exitAt':null}});}})[_0xcee9('0xb')](function(_0x3cb4ba){if(_0x47ee71){if(_0x3cb4ba&&_0x3cb4ba['length']){var _0x1cd48f=[];_0x3cb4ba[_0xcee9('0x2f')](function(_0x1eddc1){_0x1cd48f[_0xcee9('0x30')](_0x1eddc1[_0xcee9('0x27')]({'exitAt':moment()[_0xcee9('0x29')](_0xcee9('0x2d'))}));});return BPromise['all'](_0x1cd48f);}}})[_0xcee9('0xb')](function(){if(_0x47ee71){return _0x47ee71[_0xcee9('0x27')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x19c47a){_0x3b005b(_0x19c47a);})[_0xcee9('0x15')](function(_0x164112){_0x1ea00e(_0x25b981[_0xcee9('0x11')](0x1f4,_0x164112[_0xcee9('0x12')]));});});};exports[_0xcee9('0x42')]=function(_0x45d0f0){var _0x3cae12=this;return new Promise(function(_0x5713ad,_0x3853bd){var _0x19ba83;var _0x4d4605;var _0x56e4a2;return db['User'][_0xcee9('0x34')]({'where':_0x45d0f0[_0xcee9('0x19')][_0xcee9('0x21')]||{},'attributes':['id',_0xcee9('0x23'),_0xcee9('0x24'),'internal',_0xcee9('0x43')]})[_0xcee9('0xb')](function(_0x4dfbf0){if(_0x4dfbf0){_0x19ba83=_0x4dfbf0;return db[_0xcee9('0x17')]['count']({'where':{'role':_0xcee9('0x44'),'online':!![],'id':{'$ne':_0x19ba83['id']}}});}})[_0xcee9('0xb')](function(_0x26e715){if(_0x26e715){_0x56e4a2=_0x26e715;return require(_0xcee9('0x45'))[_0xcee9('0x46')]();}})[_0xcee9('0xb')](function(_0x327c1){if(_0x327c1&&_0x327c1[_0xcee9('0x47')]&&_0x56e4a2>=_0x327c1[_0xcee9('0x47')]){throw new Error(_0xcee9('0x48'));}})[_0xcee9('0xb')](function(){if(_0x19ba83){return db[_0xcee9('0x26')][_0xcee9('0x49')]({'where':{'membername':_0x19ba83['name']},'individualHooks':!![]});}})[_0xcee9('0xb')](function(){if(_0x19ba83){return _0x19ba83['getVoiceQueues']({'raw':!![]});}})[_0xcee9('0xb')](function(_0x587105){if(_0x19ba83){if(_0x587105){var _0xce2821=[];_0x4d4605=_0x587105;if(_0x4d4605[_0xcee9('0x2c')]){for(var _0x5ce143=0x0;_0x5ce143<_0x4d4605[_0xcee9('0x2c')];_0x5ce143++){_0xce2821[_0xcee9('0x30')](db['UserVoiceQueueRt'][_0xcee9('0x4a')]({'membername':_0x19ba83['name'],'UserId':_0x19ba83['id'],'queue_name':_0x4d4605[_0x5ce143]['name'],'VoiceQueueId':_0x4d4605[_0x5ce143]['id'],'interface':_0x45d0f0[_0xcee9('0x32')][_0xcee9('0x4b')]||util[_0xcee9('0x29')](_0xcee9('0x2a'),_0xcee9('0x31'),_0x19ba83[_0xcee9('0x23')]),'paused':_0x19ba83['loginInPause']||![],'penalty':_0x4d4605[_0x5ce143][_0xcee9('0x4c')]||0x0}));}return BPromise[_0xcee9('0x40')](_0xce2821);}}}})[_0xcee9('0xb')](function(){if(_0x19ba83){return db[_0xcee9('0x28')][_0xcee9('0x18')]({'where':{'membername':_0x19ba83['name'],'interface':util[_0xcee9('0x29')](_0xcee9('0x2a'),_0xcee9('0x31'),_0x19ba83[_0xcee9('0x23')]),'exitAt':null}});}})[_0xcee9('0xb')](function(_0x55993c){if(_0x19ba83){if(_0x55993c&&_0x55993c[_0xcee9('0x2c')]){var _0x109cdb=[];_0x55993c[_0xcee9('0x2f')](function(_0x5154f5){_0x109cdb[_0xcee9('0x30')](_0x5154f5[_0xcee9('0x27')]({'exitAt':moment()[_0xcee9('0x29')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xcee9('0x40')](_0x109cdb);}}})[_0xcee9('0xb')](function(_0x4abba3){if(_0x19ba83){var _0x404aca=[];var _0x2c1078=[];var _0x32e2ae=utils[_0xcee9('0x4d')]();var _0x3e895e={'membername':_0x19ba83[_0xcee9('0x23')],'interface':util[_0xcee9('0x29')]('%s/%s',_0xcee9('0x31'),_0x19ba83[_0xcee9('0x23')]),'enterAt':moment()['format'](_0xcee9('0x2d')),'role':_0x19ba83[_0xcee9('0x24')],'internal':_0x19ba83[_0xcee9('0x25')]};_0x32e2ae[_0xcee9('0x2f')](function(_0x55caab){_0x404aca['push'](_[_0xcee9('0x4e')]({'channel':_0x55caab,'type':'LOGIN','data1':_0xcee9('0x4f'),'data2':_0x45d0f0[_0xcee9('0x32')]['interface']||util['format'](_0xcee9('0x2a'),_0xcee9('0x31'),_0x19ba83[_0xcee9('0x23')])},_0x3e895e));if(_0x19ba83[_0xcee9('0x43')]){_0x2c1078[_0xcee9('0x30')](_[_0xcee9('0x4e')]({'channel':_0x55caab,'type':_0xcee9('0x2b'),'data1':_0xcee9('0x50')},_0x3e895e));}});return db[_0xcee9('0x28')][_0xcee9('0x51')](_0x404aca[_0xcee9('0x52')](_0x2c1078),{'individualHooks':!![]});}})[_0xcee9('0xb')](function(){if(_0x19ba83){return _0x19ba83[_0xcee9('0x27')]({'online':!![],'lastLoginAt':moment()[_0xcee9('0x29')](_0xcee9('0x2d')),'voicePause':_0x19ba83['loginInPause']||![],'mailPause':_0x19ba83[_0xcee9('0x43')]||![],'chatPause':_0x19ba83[_0xcee9('0x43')]||![],'faxPause':_0x19ba83[_0xcee9('0x43')]||![],'smsPause':_0x19ba83[_0xcee9('0x43')]||![],'openchannelPause':_0x19ba83[_0xcee9('0x43')]||![],'pauseType':_0x19ba83['loginInPause']?_0xcee9('0x50'):null,'lastPauseAt':moment()['format'](_0xcee9('0x2d'))});}})[_0xcee9('0xb')](function(_0x227243){_0x5713ad(_0x227243);})['catch'](function(_0xd1d4b2){_0x3853bd(_0x3cae12[_0xcee9('0x11')](0x1f4,_0xd1d4b2[_0xcee9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ea9d255..cc0e9df 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 _0xfed3=['save','remove','emit','removeListener','register','length','./user.events'];(function(_0x328718,_0x26e2c2){var _0x2d8f14=function(_0x389f90){while(--_0x389f90){_0x328718['push'](_0x328718['shift']());}};_0x2d8f14(++_0x26e2c2);}(_0xfed3,0x1a3));var _0x3fed=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xfed3[_0x2d4421];return _0x2d3b01;};'use strict';var UserEvents=require(_0x3fed('0x0'));var events=[_0x3fed('0x1'),_0x3fed('0x2'),'update'];function createListener(_0xd9d627,_0x4c7a38){return function(_0x17e156){_0x4c7a38[_0x3fed('0x3')](_0xd9d627,_0x17e156);};}function removeListener(_0x404443,_0x4b0ed7){return function(){UserEvents[_0x3fed('0x4')](_0x404443,_0x4b0ed7);};}exports[_0x3fed('0x5')]=function(_0x172a5a){for(var _0x52fffe=0x0,_0xbb2307=events[_0x3fed('0x6')];_0x52fffe<_0xbb2307;_0x52fffe++){var _0x19cf23=events[_0x52fffe];var _0x97093e=createListener('user:'+_0x19cf23,_0x172a5a);UserEvents['on'](_0x19cf23,_0x97093e);}}; \ No newline at end of file +var _0x8105=['remove','emit','register','length','user:','./user.events'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x8105,0x179));var _0x5810=function(_0xcde855,_0x26e01f){_0xcde855=_0xcde855-0x0;var _0x7d82d6=_0x8105[_0xcde855];return _0x7d82d6;};'use strict';var UserEvents=require(_0x5810('0x0'));var events=['save',_0x5810('0x1'),'update'];function createListener(_0x443b38,_0x28d2b6){return function(_0x5059c2){_0x28d2b6[_0x5810('0x2')](_0x443b38,_0x5059c2);};}function removeListener(_0x424e55,_0x37f77f){return function(){UserEvents['removeListener'](_0x424e55,_0x37f77f);};}exports[_0x5810('0x3')]=function(_0x43774d){for(var _0xddbde8=0x0,_0x31f2ca=events[_0x5810('0x4')];_0xddbde8<_0x31f2ca;_0xddbde8++){var _0xe9082e=events[_0xddbde8];var _0x3f57af=createListener(_0x5810('0x5')+_0xe9082e,_0x43774d);UserEvents['on'](_0xe9082e,_0x3f57af);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 1bd5d92..cd2dea7 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 _0x1f2d=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x3d64b7,_0x544ef5){var _0x4ee0ac=function(_0x1d04ca){while(--_0x1d04ca){_0x3d64b7['push'](_0x3d64b7['shift']());}};_0x4ee0ac(++_0x544ef5);}(_0x1f2d,0x128));var _0xd1f2=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0x1f2d[_0x4a45b4];return _0x1a99c9;};'use strict';var multer=require(_0xd1f2('0x0'));var util=require(_0xd1f2('0x1'));var path=require(_0xd1f2('0x2'));var express=require(_0xd1f2('0x3'));var router=express[_0xd1f2('0x4')]();var auth=require(_0xd1f2('0x5'));var interaction=require(_0xd1f2('0x6'));var config=require(_0xd1f2('0x7'));module[_0xd1f2('0x8')]=router; \ No newline at end of file +var _0x7699=['../../components/interaction/service','exports','multer','util','path','../../components/auth/service'];(function(_0x30af23,_0x1b9d6a){var _0x5cea96=function(_0x31be06){while(--_0x31be06){_0x30af23['push'](_0x30af23['shift']());}};_0x5cea96(++_0x1b9d6a);}(_0x7699,0x176));var _0x9769=function(_0x8f8dcd,_0x249623){_0x8f8dcd=_0x8f8dcd-0x0;var _0x4041bd=_0x7699[_0x8f8dcd];return _0x4041bd;};'use strict';var multer=require(_0x9769('0x0'));var util=require(_0x9769('0x1'));var path=require(_0x9769('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9769('0x3'));var interaction=require(_0x9769('0x4'));var config=require('../../config/environment');module[_0x9769('0x5')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 5b5ea0a..06c25d0 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 _0x44c9=['sequelize','exports','INTEGER'];(function(_0x2ba1e1,_0x474881){var _0x3b303d=function(_0x16119d){while(--_0x16119d){_0x2ba1e1['push'](_0x2ba1e1['shift']());}};_0x3b303d(++_0x474881);}(_0x44c9,0x11d));var _0x944c=function(_0x41f6e9,_0x4dac69){_0x41f6e9=_0x41f6e9-0x0;var _0x3a9b89=_0x44c9[_0x41f6e9];return _0x3a9b89;};'use strict';var Sequelize=require(_0x944c('0x0'));module[_0x944c('0x1')]={'penalty':{'type':Sequelize[_0x944c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbe7b=['sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe7b,0x1d4));var _0xbbe7=function(_0x485cb5,_0x91f1ae){_0x485cb5=_0x485cb5-0x0;var _0x208d06=_0xbe7b[_0x485cb5];return _0x208d06;};'use strict';var Sequelize=require(_0xbbe7('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 9af06d7..9bb2683 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 _0xa7fa=['request-promise','exports','define','user_has_chat_queues','lodash','api','moment','bluebird'];(function(_0x2b90dc,_0x10b832){var _0x4794a6=function(_0x3720ca){while(--_0x3720ca){_0x2b90dc['push'](_0x2b90dc['shift']());}};_0x4794a6(++_0x10b832);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa7f('0x1'));var moment=require(_0xaa7f('0x2'));var BPromise=require(_0xaa7f('0x3'));var rp=require(_0xaa7f('0x4'));var attributes=require('./userChatQueue.attributes');module[_0xaa7f('0x5')]=function(_0x310190,_0xc238d5){return _0x310190[_0xaa7f('0x6')]('UserChatQueue',attributes,{'tableName':_0xaa7f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af8=['./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','moment','bluebird','request-promise'];(function(_0x39e57f,_0x5eee1e){var _0x3e24cc=function(_0x252fd9){while(--_0x252fd9){_0x39e57f['push'](_0x39e57f['shift']());}};_0x3e24cc(++_0x5eee1e);}(_0x4af8,0x1ad));var _0x84af=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4af8[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x84af('0x0'));var BPromise=require(_0x84af('0x1'));var rp=require(_0x84af('0x2'));var attributes=require(_0x84af('0x3'));module['exports']=function(_0x294e04,_0x83633){return _0x294e04['define'](_0x84af('0x4'),attributes,{'tableName':_0x84af('0x5'),'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 44e1923..cfca5cd 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 _0xc034=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xc034,0x91));var _0x4c03=function(_0x6e842,_0x52fe7f){_0x6e842=_0x6e842-0x0;var _0x1db321=_0xc034[_0x6e842];return _0x1db321;};'use strict';var _=require(_0x4c03('0x0'));var util=require(_0x4c03('0x1'));var moment=require('moment');var BPromise=require(_0x4c03('0x2'));var rs=require(_0x4c03('0x3'));var fs=require('fs');var db=require(_0x4c03('0x4'))['db'];var utils=require(_0x4c03('0x5'));var logger=require(_0x4c03('0x6'))(_0x4c03('0x7'));var config=require(_0x4c03('0x8'));var jayson=require(_0x4c03('0x9'));var client=jayson[_0x4c03('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x129527,_0x3e0638,_0x242c55){return new BPromise(function(_0x2b0bb0,_0x5f24b3){return client[_0x4c03('0xb')](_0x129527,_0x242c55)[_0x4c03('0xc')](function(_0x389cb9){logger[_0x4c03('0xd')](_0x4c03('0xe'),_0x3e0638,_0x4c03('0xf'));logger[_0x4c03('0x10')](_0x4c03('0x11'),_0x3e0638,'request\x20sent',JSON[_0x4c03('0x12')](_0x389cb9));if(_0x389cb9['error']){if(_0x389cb9[_0x4c03('0x13')][_0x4c03('0x14')]===0x1f4){logger[_0x4c03('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x3e0638,_0x389cb9['error']['message']);return _0x5f24b3(_0x389cb9['error']['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3e0638,_0x389cb9['error'][_0x4c03('0x15')]);return _0x2b0bb0(_0x389cb9[_0x4c03('0x13')][_0x4c03('0x15')]);}else{logger[_0x4c03('0xd')](_0x4c03('0xe'),_0x3e0638,_0x4c03('0xf'));_0x2b0bb0(_0x389cb9[_0x4c03('0x16')][_0x4c03('0x15')]);}})[_0x4c03('0x17')](function(_0x41cf3c){logger[_0x4c03('0x13')](_0x4c03('0xe'),_0x3e0638,_0x41cf3c);_0x5f24b3(_0x41cf3c);});});} \ No newline at end of file +var _0x0eba=['http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x24a329,_0x1c5773){var _0x45c783=function(_0x1c0282){while(--_0x1c0282){_0x24a329['push'](_0x24a329['shift']());}};_0x45c783(++_0x1c5773);}(_0x0eba,0xfc));var _0xa0eb=function(_0x4a0c88,_0x1443f1){_0x4a0c88=_0x4a0c88-0x0;var _0xe10074=_0x0eba[_0x4a0c88];return _0xe10074;};'use strict';var _=require(_0xa0eb('0x0'));var util=require('util');var moment=require(_0xa0eb('0x1'));var BPromise=require(_0xa0eb('0x2'));var rs=require(_0xa0eb('0x3'));var fs=require('fs');var db=require(_0xa0eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0eb('0x5'))(_0xa0eb('0x6'));var config=require(_0xa0eb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa0eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x231978,_0x32c93b,_0x1c349a){return new BPromise(function(_0x22f714,_0x4c0ea5){return client[_0xa0eb('0x9')](_0x231978,_0x1c349a)['then'](function(_0x1b8618){logger[_0xa0eb('0xa')](_0xa0eb('0xb'),_0x32c93b,_0xa0eb('0xc'));logger['debug'](_0xa0eb('0xd'),_0x32c93b,_0xa0eb('0xc'),JSON[_0xa0eb('0xe')](_0x1b8618));if(_0x1b8618['error']){if(_0x1b8618['error'][_0xa0eb('0xf')]===0x1f4){logger[_0xa0eb('0x10')](_0xa0eb('0xb'),_0x32c93b,_0x1b8618[_0xa0eb('0x10')][_0xa0eb('0x11')]);return _0x4c0ea5(_0x1b8618[_0xa0eb('0x10')][_0xa0eb('0x11')]);}logger[_0xa0eb('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x32c93b,_0x1b8618[_0xa0eb('0x10')][_0xa0eb('0x11')]);return _0x22f714(_0x1b8618[_0xa0eb('0x10')][_0xa0eb('0x11')]);}else{logger[_0xa0eb('0xa')](_0xa0eb('0xb'),_0x32c93b,'request\x20sent');_0x22f714(_0x1b8618[_0xa0eb('0x12')][_0xa0eb('0x11')]);}})[_0xa0eb('0x13')](function(_0x420718){logger[_0xa0eb('0x10')](_0xa0eb('0xb'),_0x32c93b,_0x420718);_0x4c0ea5(_0x420718);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5563e4d..90cb36a 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 _0x19a1=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x19a1,0x1f4));var _0x119a=function(_0x5aa2bd,_0x5c445b){_0x5aa2bd=_0x5aa2bd-0x0;var _0x52bcba=_0x19a1[_0x5aa2bd];return _0x52bcba;};'use strict';var multer=require(_0x119a('0x0'));var util=require(_0x119a('0x1'));var path=require(_0x119a('0x2'));var express=require(_0x119a('0x3'));var router=express['Router']();var auth=require(_0x119a('0x4'));var interaction=require(_0x119a('0x5'));var config=require(_0x119a('0x6'));module[_0x119a('0x7')]=router; \ No newline at end of file +var _0x7153=['Router','../../config/environment','exports','util','path'];(function(_0x2072f4,_0x1f2f7e){var _0x330448=function(_0x27be6a){while(--_0x27be6a){_0x2072f4['push'](_0x2072f4['shift']());}};_0x330448(++_0x1f2f7e);}(_0x7153,0x99));var _0x3715=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x7153[_0x1deee5];return _0x1d6c3a;};'use strict';var multer=require('multer');var util=require(_0x3715('0x0'));var path=require(_0x3715('0x1'));var express=require('express');var router=express[_0x3715('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3715('0x3'));module[_0x3715('0x4')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c6ed6a4..4d43a4d 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 _0x36a7=['STRING','sequelize','exports'];(function(_0x43f14b,_0x3cefd2){var _0x4c5db9=function(_0xfc1273){while(--_0xfc1273){_0x43f14b['push'](_0x43f14b['shift']());}};_0x4c5db9(++_0x3cefd2);}(_0x36a7,0x1c0));var _0x736a=function(_0x1ca464,_0x3e1332){_0x1ca464=_0x1ca464-0x0;var _0x61ab91=_0x36a7[_0x1ca464];return _0x61ab91;};'use strict';var Sequelize=require(_0x736a('0x0'));module[_0x736a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x736a('0x2')]}}; \ No newline at end of file +var _0xc7a7=['STRING','sequelize','exports','INTEGER'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0xc7a7,0x171));var _0x7c7a=function(_0x44392a,_0x59c22a){_0x44392a=_0x44392a-0x0;var _0x4a38f4=_0xc7a7[_0x44392a];return _0x4a38f4;};'use strict';var Sequelize=require(_0x7c7a('0x0'));module[_0x7c7a('0x1')]={'penalty':{'type':Sequelize[_0x7c7a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7c7a('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 2fd64e8..cda8be8 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 _0xb66c=['exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xb66c,0x175));var _0xcb66=function(_0x395f94,_0xe3e00f){_0x395f94=_0x395f94-0x0;var _0x5e2259=_0xb66c[_0x395f94];return _0x5e2259;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var attributes=require('./userFaxQueue.attributes');module[_0xcb66('0x5')]=function(_0x386241,_0x3f7cc7){return _0x386241[_0xcb66('0x6')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','./userFaxQueue.attributes','exports','user_has_fax_queues','lodash','util'];(function(_0x5d5024,_0x9e0e87){var _0xe86dae=function(_0x214579){while(--_0x214579){_0x5d5024['push'](_0x5d5024['shift']());}};_0xe86dae(++_0x9e0e87);}(_0x4b84,0x1cc));var _0x44b8=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x4b84[_0xd0cd0b];return _0x59cced;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x44b8('0x3'));module[_0x44b8('0x4')]=function(_0x39ad16,_0x5766b0){return _0x39ad16['define']('UserFaxQueue',attributes,{'tableName':_0x44b8('0x5'),'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 6cee982..e19ffc2 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 _0xb846=['result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','info'];(function(_0x27f88b,_0x526bad){var _0x2114f4=function(_0x341508){while(--_0x341508){_0x27f88b['push'](_0x27f88b['shift']());}};_0x2114f4(++_0x526bad);}(_0xb846,0x1d0));var _0x6b84=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb846[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x6b84('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b84('0x1'));var rs=require(_0x6b84('0x2'));var fs=require('fs');var db=require(_0x6b84('0x3'))['db'];var utils=require(_0x6b84('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b84('0x5'));var jayson=require(_0x6b84('0x6'));var client=jayson[_0x6b84('0x7')][_0x6b84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31856c,_0x534d8e,_0x54466a){return new BPromise(function(_0x1482bd,_0x5706dc){return client[_0x6b84('0x9')](_0x31856c,_0x54466a)[_0x6b84('0xa')](function(_0x5b9f34){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x534d8e,_0x6b84('0xb'));logger[_0x6b84('0xc')](_0x6b84('0xd'),_0x534d8e,'request\x20sent',JSON['stringify'](_0x5b9f34));if(_0x5b9f34['error']){if(_0x5b9f34[_0x6b84('0xe')][_0x6b84('0xf')]===0x1f4){logger[_0x6b84('0xe')](_0x6b84('0x10'),_0x534d8e,_0x5b9f34[_0x6b84('0xe')][_0x6b84('0x11')]);return _0x5706dc(_0x5b9f34[_0x6b84('0xe')][_0x6b84('0x11')]);}logger[_0x6b84('0xe')](_0x6b84('0x10'),_0x534d8e,_0x5b9f34[_0x6b84('0xe')][_0x6b84('0x11')]);return _0x1482bd(_0x5b9f34[_0x6b84('0xe')]['message']);}else{logger[_0x6b84('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x534d8e,_0x6b84('0xb'));_0x1482bd(_0x5b9f34[_0x6b84('0x13')][_0x6b84('0x11')]);}})[_0x6b84('0x14')](function(_0x100b1e){logger[_0x6b84('0xe')](_0x6b84('0x10'),_0x534d8e,_0x100b1e);_0x5706dc(_0x100b1e);});});} \ No newline at end of file +var _0x6b19=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info'];(function(_0xe2f0ae,_0x363de7){var _0x27d44d=function(_0x269bc0){while(--_0x269bc0){_0xe2f0ae['push'](_0xe2f0ae['shift']());}};_0x27d44d(++_0x363de7);}(_0x6b19,0xf4));var _0x96b1=function(_0x41cc32,_0x4395fc){_0x41cc32=_0x41cc32-0x0;var _0x5b3597=_0x6b19[_0x41cc32];return _0x5b3597;};'use strict';var _=require(_0x96b1('0x0'));var util=require('util');var moment=require(_0x96b1('0x1'));var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var config=require('../../config/environment');var jayson=require(_0x96b1('0x7'));var client=jayson[_0x96b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e55b7,_0x288d77,_0x2347c5){return new BPromise(function(_0x519fbe,_0x280b00){return client[_0x96b1('0x9')](_0x5e55b7,_0x2347c5)['then'](function(_0x22e4c7){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x288d77,_0x96b1('0xc'));logger[_0x96b1('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x288d77,_0x96b1('0xc'),JSON['stringify'](_0x22e4c7));if(_0x22e4c7['error']){if(_0x22e4c7['error']['code']===0x1f4){logger[_0x96b1('0xe')](_0x96b1('0xb'),_0x288d77,_0x22e4c7[_0x96b1('0xe')][_0x96b1('0xf')]);return _0x280b00(_0x22e4c7[_0x96b1('0xe')]['message']);}logger[_0x96b1('0xe')](_0x96b1('0xb'),_0x288d77,_0x22e4c7[_0x96b1('0xe')][_0x96b1('0xf')]);return _0x519fbe(_0x22e4c7[_0x96b1('0xe')][_0x96b1('0xf')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x288d77,_0x96b1('0xc'));_0x519fbe(_0x22e4c7['result'][_0x96b1('0xf')]);}})[_0x96b1('0x10')](function(_0x3d871f){logger[_0x96b1('0xe')](_0x96b1('0xb'),_0x288d77,_0x3d871f);_0x280b00(_0x3d871f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b708b16..d947ee3 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 _0x5815=['../../components/interaction/service','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3e4e85,_0x3472c3){var _0x3102c6=function(_0xcff563){while(--_0xcff563){_0x3e4e85['push'](_0x3e4e85['shift']());}};_0x3102c6(++_0x3472c3);}(_0x5815,0x1eb));var _0x5581=function(_0x367353,_0x29d448){_0x367353=_0x367353-0x0;var _0x1bd728=_0x5815[_0x367353];return _0x1bd728;};'use strict';var multer=require(_0x5581('0x0'));var util=require(_0x5581('0x1'));var path=require(_0x5581('0x2'));var express=require(_0x5581('0x3'));var router=express[_0x5581('0x4')]();var auth=require(_0x5581('0x5'));var interaction=require(_0x5581('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x320b=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1f404a,_0x6cbce5){var _0x47e18f=function(_0x4b222b){while(--_0x4b222b){_0x1f404a['push'](_0x1f404a['shift']());}};_0x47e18f(++_0x6cbce5);}(_0x320b,0x183));var _0xb320=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0x320b[_0x246227];return _0x37bd4a;};'use strict';var multer=require(_0xb320('0x0'));var util=require(_0xb320('0x1'));var path=require(_0xb320('0x2'));var express=require('express');var router=express[_0xb320('0x3')]();var auth=require(_0xb320('0x4'));var interaction=require(_0xb320('0x5'));var config=require(_0xb320('0x6'));module[_0xb320('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 e7a9070..4b7be81 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 _0x2bfd=['INTEGER','sequelize','exports'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x2bfd,0x1cf));var _0xd2bf=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x2bfd[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0xd2bf('0x0'));module[_0xd2bf('0x1')]={'penalty':{'type':Sequelize[_0xd2bf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8b21=['INTEGER','exports'];(function(_0x1de539,_0x5cb58d){var _0x194844=function(_0x3ce7ed){while(--_0x3ce7ed){_0x1de539['push'](_0x1de539['shift']());}};_0x194844(++_0x5cb58d);}(_0x8b21,0x95));var _0x18b2=function(_0x4c4af1,_0x147cd8){_0x4c4af1=_0x4c4af1-0x0;var _0x267ba4=_0x8b21[_0x4c4af1];return _0x267ba4;};'use strict';var Sequelize=require('sequelize');module[_0x18b2('0x0')]={'penalty':{'type':Sequelize[_0x18b2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index fb7dac8..101201a 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 _0x6fad=['lodash','util','../../config/logger','api','moment','request-promise','exports','UserMailQueue','user_has_mail_queues'];(function(_0x3c9cd1,_0x555129){var _0x4820a9=function(_0x1e552e){while(--_0x1e552e){_0x3c9cd1['push'](_0x3c9cd1['shift']());}};_0x4820a9(++_0x555129);}(_0x6fad,0x17a));var _0xd6fa=function(_0x1509c6,_0x47611e){_0x1509c6=_0x1509c6-0x0;var _0x57ae28=_0x6fad[_0x1509c6];return _0x57ae28;};'use strict';var _=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var logger=require(_0xd6fa('0x2'))(_0xd6fa('0x3'));var moment=require(_0xd6fa('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6fa('0x5'));var attributes=require('./userMailQueue.attributes');module[_0xd6fa('0x6')]=function(_0x542461,_0x40ac02){return _0x542461['define'](_0xd6fa('0x7'),attributes,{'tableName':_0xd6fa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb3f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x456a0f,_0x190e9d){var _0x4b8723=function(_0x2fb850){while(--_0x2fb850){_0x456a0f['push'](_0x456a0f['shift']());}};_0x4b8723(++_0x190e9d);}(_0xeb3f,0xa8));var _0xfeb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeb3f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xfeb3('0x0'));var util=require(_0xfeb3('0x1'));var logger=require(_0xfeb3('0x2'))(_0xfeb3('0x3'));var moment=require(_0xfeb3('0x4'));var BPromise=require(_0xfeb3('0x5'));var rp=require(_0xfeb3('0x6'));var attributes=require(_0xfeb3('0x7'));module[_0xfeb3('0x8')]=function(_0x125a2f,_0x3cdfed){return _0x125a2f[_0xfeb3('0x9')](_0xfeb3('0xa'),attributes,{'tableName':_0xfeb3('0xb'),'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 7c7d98e..b9115a6 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 _0x3fec=['then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/environment','client','http','request'];(function(_0x4c9393,_0x20e6de){var _0x580eda=function(_0x5dfce1){while(--_0x5dfce1){_0x4c9393['push'](_0x4c9393['shift']());}};_0x580eda(++_0x20e6de);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc3fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc3fe('0x1'));var rs=require(_0xc3fe('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc3fe('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xc3fe('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xc3fe('0x5')][_0xc3fe('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x22dd19,_0x1ae20f,_0xf96362){return new BPromise(function(_0x43a9a9,_0x1e532e){return client[_0xc3fe('0x7')](_0x22dd19,_0xf96362)[_0xc3fe('0x8')](function(_0x17dbcb){logger[_0xc3fe('0x9')](_0xc3fe('0xa'),_0x1ae20f,_0xc3fe('0xb'));logger[_0xc3fe('0xc')](_0xc3fe('0xd'),_0x1ae20f,_0xc3fe('0xb'),JSON['stringify'](_0x17dbcb));if(_0x17dbcb[_0xc3fe('0xe')]){if(_0x17dbcb[_0xc3fe('0xe')]['code']===0x1f4){logger[_0xc3fe('0xe')](_0xc3fe('0xa'),_0x1ae20f,_0x17dbcb[_0xc3fe('0xe')][_0xc3fe('0xf')]);return _0x1e532e(_0x17dbcb[_0xc3fe('0xe')][_0xc3fe('0xf')]);}logger[_0xc3fe('0xe')](_0xc3fe('0xa'),_0x1ae20f,_0x17dbcb[_0xc3fe('0xe')][_0xc3fe('0xf')]);return _0x43a9a9(_0x17dbcb['error'][_0xc3fe('0xf')]);}else{logger['info'](_0xc3fe('0xa'),_0x1ae20f,_0xc3fe('0xb'));_0x43a9a9(_0x17dbcb[_0xc3fe('0x10')][_0xc3fe('0xf')]);}})[_0xc3fe('0x11')](function(_0x39705c){logger[_0xc3fe('0xe')](_0xc3fe('0xa'),_0x1ae20f,_0x39705c);_0x1e532e(_0x39705c);});});} \ No newline at end of file +var _0x8db0=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','client'];(function(_0x128b0e,_0x53d20f){var _0x13165d=function(_0x223b36){while(--_0x223b36){_0x128b0e['push'](_0x128b0e['shift']());}};_0x13165d(++_0x53d20f);}(_0x8db0,0x65));var _0x08db=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0x8db0[_0x349a9e];return _0x24c207;};'use strict';var _=require(_0x08db('0x0'));var util=require(_0x08db('0x1'));var moment=require('moment');var BPromise=require(_0x08db('0x2'));var rs=require(_0x08db('0x3'));var fs=require('fs');var db=require(_0x08db('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x08db('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x08db('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b0e6,_0x528139,_0x41b4bf){return new BPromise(function(_0x1ca3d1,_0x16bcc0){return client[_0x08db('0x7')](_0x14b0e6,_0x41b4bf)[_0x08db('0x8')](function(_0x5ec76d){logger['info'](_0x08db('0x9'),_0x528139,_0x08db('0xa'));logger[_0x08db('0xb')](_0x08db('0xc'),_0x528139,_0x08db('0xa'),JSON[_0x08db('0xd')](_0x5ec76d));if(_0x5ec76d[_0x08db('0xe')]){if(_0x5ec76d[_0x08db('0xe')][_0x08db('0xf')]===0x1f4){logger[_0x08db('0xe')](_0x08db('0x9'),_0x528139,_0x5ec76d[_0x08db('0xe')][_0x08db('0x10')]);return _0x16bcc0(_0x5ec76d[_0x08db('0xe')][_0x08db('0x10')]);}logger[_0x08db('0xe')](_0x08db('0x9'),_0x528139,_0x5ec76d['error']['message']);return _0x1ca3d1(_0x5ec76d['error'][_0x08db('0x10')]);}else{logger[_0x08db('0x11')](_0x08db('0x9'),_0x528139,_0x08db('0xa'));_0x1ca3d1(_0x5ec76d['result'][_0x08db('0x10')]);}})['catch'](function(_0x6395dc){logger['error'](_0x08db('0x9'),_0x528139,_0x6395dc);_0x16bcc0(_0x6395dc);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f393c6b..71c0da1 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 _0xa117=['../../config/environment','exports','path','express','Router','../../components/auth/service'];(function(_0x4136f2,_0xd13a91){var _0x1c1b52=function(_0x1746ff){while(--_0x1746ff){_0x4136f2['push'](_0x4136f2['shift']());}};_0x1c1b52(++_0xd13a91);}(_0xa117,0x1f4));var _0x7a11=function(_0x5b1f26,_0x2e552b){_0x5b1f26=_0x5b1f26-0x0;var _0x282a74=_0xa117[_0x5b1f26];return _0x282a74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7a11('0x0'));var express=require(_0x7a11('0x1'));var router=express[_0x7a11('0x2')]();var auth=require(_0x7a11('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7a11('0x4'));module[_0x7a11('0x5')]=router; \ No newline at end of file +var _0x817b=['Router','../../components/interaction/service','exports','multer','util','path','express'];(function(_0x1d2176,_0x53d5ae){var _0x3d99fc=function(_0x5133e6){while(--_0x5133e6){_0x1d2176['push'](_0x1d2176['shift']());}};_0x3d99fc(++_0x53d5ae);}(_0x817b,0x17d));var _0xb817=function(_0x190c4e,_0x3bc83d){_0x190c4e=_0x190c4e-0x0;var _0x3527ee=_0x817b[_0x190c4e];return _0x3527ee;};'use strict';var multer=require(_0xb817('0x0'));var util=require(_0xb817('0x1'));var path=require(_0xb817('0x2'));var express=require(_0xb817('0x3'));var router=express[_0xb817('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb817('0x5'));var config=require('../../config/environment');module[_0xb817('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 4ba5391..934d797 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 _0x5b96=['sequelize','INTEGER'];(function(_0x3bfed6,_0x1fef1e){var _0x19ba61=function(_0x7a17db){while(--_0x7a17db){_0x3bfed6['push'](_0x3bfed6['shift']());}};_0x19ba61(++_0x1fef1e);}(_0x5b96,0x1ea));var _0x65b9=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0x5b96[_0x3311ae];return _0x107949;};'use strict';var Sequelize=require(_0x65b9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x65b9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x59cb=['sequelize'];(function(_0x8d2cf4,_0x258636){var _0x3cfd53=function(_0x3659a2){while(--_0x3659a2){_0x8d2cf4['push'](_0x8d2cf4['shift']());}};_0x3cfd53(++_0x258636);}(_0x59cb,0x1e4));var _0xb59c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x59cb[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xb59c('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index c4c5f5d..7acea09 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 _0x35ae=['define','user_has_openchannel_queues','util','../../config/logger','moment','bluebird','request-promise','./userOpenchannelQueue.attributes','exports'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0x35ae,0x146));var _0xe35a=function(_0x5a86df,_0x5695aa){_0x5a86df=_0x5a86df-0x0;var _0x2b4820=_0x35ae[_0x5a86df];return _0x2b4820;};'use strict';var _=require('lodash');var util=require(_0xe35a('0x0'));var logger=require(_0xe35a('0x1'))('api');var moment=require(_0xe35a('0x2'));var BPromise=require(_0xe35a('0x3'));var rp=require(_0xe35a('0x4'));var attributes=require(_0xe35a('0x5'));module[_0xe35a('0x6')]=function(_0x401572,_0x5eb456){return _0x401572[_0xe35a('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0xe35a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d20=['define','UserOpenchannelQueue','user_has_openchannel_queues','api','bluebird','request-promise','./userOpenchannelQueue.attributes','exports'];(function(_0x429c92,_0x28a488){var _0x530459=function(_0x20792d){while(--_0x20792d){_0x429c92['push'](_0x429c92['shift']());}};_0x530459(++_0x28a488);}(_0x5d20,0xcb));var _0x05d2=function(_0xe82606,_0x433ec1){_0xe82606=_0xe82606-0x0;var _0x495d9d=_0x5d20[_0xe82606];return _0x495d9d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x05d2('0x0'));var moment=require('moment');var BPromise=require(_0x05d2('0x1'));var rp=require(_0x05d2('0x2'));var attributes=require(_0x05d2('0x3'));module[_0x05d2('0x4')]=function(_0x9e31a4,_0x47a110){return _0x9e31a4[_0x05d2('0x5')](_0x05d2('0x6'),attributes,{'tableName':_0x05d2('0x7'),'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 2c12863..ceb77f1 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 _0x322b=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','UserOpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x322b,0x9c));var _0xb322=function(_0x1e9025,_0xb37560){_0x1e9025=_0x1e9025-0x0;var _0x494c16=_0x322b[_0x1e9025];return _0x494c16;};'use strict';var _=require(_0xb322('0x0'));var util=require(_0xb322('0x1'));var moment=require(_0xb322('0x2'));var BPromise=require(_0xb322('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xb322('0x4'))['db'];var utils=require(_0xb322('0x5'));var logger=require(_0xb322('0x6'))('rpc');var config=require(_0xb322('0x7'));var jayson=require(_0xb322('0x8'));var client=jayson[_0xb322('0x9')][_0xb322('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x291452,_0x40ad64,_0x194dc8){return new BPromise(function(_0x46bf9a,_0x5c42f9){return client[_0xb322('0xb')](_0x291452,_0x194dc8)[_0xb322('0xc')](function(_0x1dd82a){logger[_0xb322('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x40ad64,_0xb322('0xe'));logger[_0xb322('0xf')](_0xb322('0x10'),_0x40ad64,_0xb322('0xe'),JSON['stringify'](_0x1dd82a));if(_0x1dd82a[_0xb322('0x11')]){if(_0x1dd82a['error']['code']===0x1f4){logger[_0xb322('0x11')](_0xb322('0x12'),_0x40ad64,_0x1dd82a['error']['message']);return _0x5c42f9(_0x1dd82a[_0xb322('0x11')][_0xb322('0x13')]);}logger[_0xb322('0x11')](_0xb322('0x12'),_0x40ad64,_0x1dd82a['error'][_0xb322('0x13')]);return _0x46bf9a(_0x1dd82a[_0xb322('0x11')]['message']);}else{logger['info'](_0xb322('0x12'),_0x40ad64,_0xb322('0xe'));_0x46bf9a(_0x1dd82a[_0xb322('0x14')][_0xb322('0x13')]);}})[_0xb322('0x15')](function(_0x4fe629){logger[_0xb322('0x11')](_0xb322('0x12'),_0x40ad64,_0x4fe629);_0x5c42f9(_0x4fe629);});});} \ No newline at end of file +var _0x8924=['stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2277c1,_0x1eee4d){var _0x5bdec3=function(_0x26d549){while(--_0x26d549){_0x2277c1['push'](_0x2277c1['shift']());}};_0x5bdec3(++_0x1eee4d);}(_0x8924,0x9a));var _0x4892=function(_0x163d42,_0x3cabea){_0x163d42=_0x163d42-0x0;var _0x59186c=_0x8924[_0x163d42];return _0x59186c;};'use strict';var _=require('lodash');var util=require(_0x4892('0x0'));var moment=require(_0x4892('0x1'));var BPromise=require(_0x4892('0x2'));var rs=require(_0x4892('0x3'));var fs=require('fs');var db=require(_0x4892('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4892('0x5'))(_0x4892('0x6'));var config=require(_0x4892('0x7'));var jayson=require(_0x4892('0x8'));var client=jayson['client'][_0x4892('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278bb3,_0x39844b,_0x1e4fd0){return new BPromise(function(_0x277542,_0x42eb11){return client['request'](_0x278bb3,_0x1e4fd0)[_0x4892('0xa')](function(_0x561420){logger['info'](_0x4892('0xb'),_0x39844b,_0x4892('0xc'));logger['debug'](_0x4892('0xd'),_0x39844b,_0x4892('0xc'),JSON[_0x4892('0xe')](_0x561420));if(_0x561420[_0x4892('0xf')]){if(_0x561420[_0x4892('0xf')][_0x4892('0x10')]===0x1f4){logger[_0x4892('0xf')](_0x4892('0xb'),_0x39844b,_0x561420[_0x4892('0xf')][_0x4892('0x11')]);return _0x42eb11(_0x561420[_0x4892('0xf')][_0x4892('0x11')]);}logger[_0x4892('0xf')](_0x4892('0xb'),_0x39844b,_0x561420[_0x4892('0xf')][_0x4892('0x11')]);return _0x277542(_0x561420[_0x4892('0xf')]['message']);}else{logger[_0x4892('0x12')](_0x4892('0xb'),_0x39844b,'request\x20sent');_0x277542(_0x561420[_0x4892('0x13')]['message']);}})[_0x4892('0x14')](function(_0x3cda5c){logger[_0x4892('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x39844b,_0x3cda5c);_0x42eb11(_0x3cda5c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 4d82f05..06d827c 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 _0xd7b4=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','express'];(function(_0x4362a9,_0x5729f8){var _0x20c08e=function(_0x1e8735){while(--_0x1e8735){_0x4362a9['push'](_0x4362a9['shift']());}};_0x20c08e(++_0x5729f8);}(_0xd7b4,0x1ed));var _0x4d7b=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0xd7b4[_0x28d225];return _0x1f79e1;};'use strict';var multer=require(_0x4d7b('0x0'));var util=require(_0x4d7b('0x1'));var path=require(_0x4d7b('0x2'));var express=require(_0x4d7b('0x3'));var router=express['Router']();var auth=require(_0x4d7b('0x4'));var interaction=require(_0x4d7b('0x5'));var config=require('../../config/environment');module[_0x4d7b('0x6')]=router; \ No newline at end of file +var _0x1926=['Router','../../config/environment','exports','multer','path'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x1926,0x10c));var _0x6192=function(_0x54bc0b,_0x246ef0){_0x54bc0b=_0x54bc0b-0x0;var _0x25a77f=_0x1926[_0x54bc0b];return _0x25a77f;};'use strict';var multer=require(_0x6192('0x0'));var util=require('util');var path=require(_0x6192('0x1'));var express=require('express');var router=express[_0x6192('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6192('0x3'));module[_0x6192('0x4')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 572a4a0..224560a 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 _0x80b4=['exports','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x80b4,0x87));var _0x480b=function(_0x370575,_0x4996b5){_0x370575=_0x370575-0x0;var _0x191c40=_0x80b4[_0x370575];return _0x191c40;};'use strict';var Sequelize=require(_0x480b('0x0'));module[_0x480b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8343=['exports','INTEGER','sequelize'];(function(_0x1784c1,_0x134a21){var _0x33c5dd=function(_0x274187){while(--_0x274187){_0x1784c1['push'](_0x1784c1['shift']());}};_0x33c5dd(++_0x134a21);}(_0x8343,0xcb));var _0x3834=function(_0x2b1515,_0x1da683){_0x2b1515=_0x2b1515-0x0;var _0x542f00=_0x8343[_0x2b1515];return _0x542f00;};'use strict';var Sequelize=require(_0x3834('0x0'));module[_0x3834('0x1')]={'penalty':{'type':Sequelize[_0x3834('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 7aac0fe..ca3f899 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 _0xb70f=['../../config/logger','api','moment','bluebird','request-promise','exports','user_has_sms_queues','lodash'];(function(_0x1d75ad,_0x2cb065){var _0x4c8106=function(_0xe7f974){while(--_0xe7f974){_0x1d75ad['push'](_0x1d75ad['shift']());}};_0x4c8106(++_0x2cb065);}(_0xb70f,0x1a7));var _0xfb70=function(_0x13d36d,_0x1c03fe){_0x13d36d=_0x13d36d-0x0;var _0x1c8a89=_0xb70f[_0x13d36d];return _0x1c8a89;};'use strict';var _=require(_0xfb70('0x0'));var util=require('util');var logger=require(_0xfb70('0x1'))(_0xfb70('0x2'));var moment=require(_0xfb70('0x3'));var BPromise=require(_0xfb70('0x4'));var rp=require(_0xfb70('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0xfb70('0x6')]=function(_0x2b8d3f,_0x244206){return _0x2b8d3f['define']('UserSmsQueue',attributes,{'tableName':_0xfb70('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc68=['moment','bluebird','request-promise','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x336ca2,_0x1a813a){var _0xda59a6=function(_0x47caa6){while(--_0x47caa6){_0x336ca2['push'](_0x336ca2['shift']());}};_0xda59a6(++_0x1a813a);}(_0xbc68,0x11c));var _0x8bc6=function(_0x295c46,_0x380cf8){_0x295c46=_0x295c46-0x0;var _0x22ffc9=_0xbc68[_0x295c46];return _0x22ffc9;};'use strict';var _=require(_0x8bc6('0x0'));var util=require(_0x8bc6('0x1'));var logger=require(_0x8bc6('0x2'))(_0x8bc6('0x3'));var moment=require(_0x8bc6('0x4'));var BPromise=require(_0x8bc6('0x5'));var rp=require(_0x8bc6('0x6'));var attributes=require(_0x8bc6('0x7'));module[_0x8bc6('0x8')]=function(_0x1e34d6,_0x445f34){return _0x1e34d6[_0x8bc6('0x9')](_0x8bc6('0xa'),attributes,{'tableName':_0x8bc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 2455bc7..ec70b8e 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 _0x74df=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x5e8b7e,_0x258072){var _0x19d445=function(_0xf028e8){while(--_0xf028e8){_0x5e8b7e['push'](_0x5e8b7e['shift']());}};_0x19d445(++_0x258072);}(_0x74df,0xc2));var _0xf74d=function(_0x2ef55a,_0x2e8331){_0x2ef55a=_0x2ef55a-0x0;var _0x242a93=_0x74df[_0x2ef55a];return _0x242a93;};'use strict';var _=require('lodash');var util=require(_0xf74d('0x0'));var moment=require(_0xf74d('0x1'));var BPromise=require(_0xf74d('0x2'));var rs=require(_0xf74d('0x3'));var fs=require('fs');var db=require(_0xf74d('0x4'))['db'];var utils=require(_0xf74d('0x5'));var logger=require(_0xf74d('0x6'))(_0xf74d('0x7'));var config=require('../../config/environment');var jayson=require(_0xf74d('0x8'));var client=jayson['client'][_0xf74d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bd7f0,_0x5dc4c5,_0x406e39){return new BPromise(function(_0x4e43a4,_0x4db7e6){return client['request'](_0x2bd7f0,_0x406e39)[_0xf74d('0xa')](function(_0x77a342){logger[_0xf74d('0xb')](_0xf74d('0xc'),_0x5dc4c5,_0xf74d('0xd'));logger[_0xf74d('0xe')](_0xf74d('0xf'),_0x5dc4c5,_0xf74d('0xd'),JSON[_0xf74d('0x10')](_0x77a342));if(_0x77a342[_0xf74d('0x11')]){if(_0x77a342['error'][_0xf74d('0x12')]===0x1f4){logger[_0xf74d('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x5dc4c5,_0x77a342[_0xf74d('0x11')][_0xf74d('0x13')]);return _0x4db7e6(_0x77a342['error'][_0xf74d('0x13')]);}logger[_0xf74d('0x11')](_0xf74d('0xc'),_0x5dc4c5,_0x77a342[_0xf74d('0x11')][_0xf74d('0x13')]);return _0x4e43a4(_0x77a342[_0xf74d('0x11')][_0xf74d('0x13')]);}else{logger[_0xf74d('0xb')](_0xf74d('0xc'),_0x5dc4c5,_0xf74d('0xd'));_0x4e43a4(_0x77a342[_0xf74d('0x14')][_0xf74d('0x13')]);}})[_0xf74d('0x15')](function(_0x2a8a31){logger['error'](_0xf74d('0xc'),_0x5dc4c5,_0x2a8a31);_0x4db7e6(_0x2a8a31);});});} \ No newline at end of file +var _0x1cfd=['client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x194262,_0x54eb5c){var _0x5eaf44=function(_0x454013){while(--_0x454013){_0x194262['push'](_0x194262['shift']());}};_0x5eaf44(++_0x54eb5c);}(_0x1cfd,0x1db));var _0xd1cf=function(_0x347c44,_0x386bb4){_0x347c44=_0x347c44-0x0;var _0x464750=_0x1cfd[_0x347c44];return _0x464750;};'use strict';var _=require(_0xd1cf('0x0'));var util=require(_0xd1cf('0x1'));var moment=require(_0xd1cf('0x2'));var BPromise=require(_0xd1cf('0x3'));var rs=require(_0xd1cf('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xd1cf('0x5'));var logger=require(_0xd1cf('0x6'))(_0xd1cf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd1cf('0x8')][_0xd1cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46ed3b,_0x4a4879,_0x1bf822){return new BPromise(function(_0x123b1d,_0x36e860){return client[_0xd1cf('0xa')](_0x46ed3b,_0x1bf822)['then'](function(_0x1b2d41){logger[_0xd1cf('0xb')](_0xd1cf('0xc'),_0x4a4879,_0xd1cf('0xd'));logger[_0xd1cf('0xe')](_0xd1cf('0xf'),_0x4a4879,_0xd1cf('0xd'),JSON['stringify'](_0x1b2d41));if(_0x1b2d41[_0xd1cf('0x10')]){if(_0x1b2d41[_0xd1cf('0x10')][_0xd1cf('0x11')]===0x1f4){logger[_0xd1cf('0x10')](_0xd1cf('0xc'),_0x4a4879,_0x1b2d41['error'][_0xd1cf('0x12')]);return _0x36e860(_0x1b2d41[_0xd1cf('0x10')][_0xd1cf('0x12')]);}logger[_0xd1cf('0x10')](_0xd1cf('0xc'),_0x4a4879,_0x1b2d41[_0xd1cf('0x10')]['message']);return _0x123b1d(_0x1b2d41[_0xd1cf('0x10')][_0xd1cf('0x12')]);}else{logger['info'](_0xd1cf('0xc'),_0x4a4879,_0xd1cf('0xd'));_0x123b1d(_0x1b2d41[_0xd1cf('0x13')][_0xd1cf('0x12')]);}})[_0xd1cf('0x14')](function(_0x13d45b){logger[_0xd1cf('0x10')](_0xd1cf('0xc'),_0x4a4879,_0x13d45b);_0x36e860(_0x13d45b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index f04d98c..641daa4 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 _0xb2d8=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xf8c855,_0x234ed1){var _0x23df1f=function(_0x252c1c){while(--_0x252c1c){_0xf8c855['push'](_0xf8c855['shift']());}};_0x23df1f(++_0x234ed1);}(_0xb2d8,0x111));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8b2d('0x0'));var util=require(_0x8b2d('0x1'));var path=require(_0x8b2d('0x2'));var express=require(_0x8b2d('0x3'));var router=express[_0x8b2d('0x4')]();var auth=require(_0x8b2d('0x5'));var interaction=require(_0x8b2d('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x9661=['../../components/interaction/service','../../config/environment','multer','util','express','Router'];(function(_0x2ad67e,_0x548b97){var _0x4c0b3a=function(_0x4e4397){while(--_0x4e4397){_0x2ad67e['push'](_0x2ad67e['shift']());}};_0x4c0b3a(++_0x548b97);}(_0x9661,0x1b2));var _0x1966=function(_0x38cc05,_0x1970f4){_0x38cc05=_0x38cc05-0x0;var _0x41399c=_0x9661[_0x38cc05];return _0x41399c;};'use strict';var multer=require(_0x1966('0x0'));var util=require(_0x1966('0x1'));var path=require('path');var express=require(_0x1966('0x2'));var router=express[_0x1966('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1966('0x4'));var config=require(_0x1966('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 16724d4..02bf150 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 _0xf906=['exports','INTEGER','sequelize'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0xf906,0x149));var _0x6f90=function(_0x3460c8,_0x52e885){_0x3460c8=_0x3460c8-0x0;var _0x4aeb3b=_0xf906[_0x3460c8];return _0x4aeb3b;};'use strict';var Sequelize=require(_0x6f90('0x0'));module[_0x6f90('0x1')]={'penalty':{'type':Sequelize[_0x6f90('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6aa9=['sequelize','exports','INTEGER'];(function(_0x3659f9,_0x34b8ba){var _0xa510d1=function(_0x4bfb68){while(--_0x4bfb68){_0x3659f9['push'](_0x3659f9['shift']());}};_0xa510d1(++_0x34b8ba);}(_0x6aa9,0x6c));var _0x96aa=function(_0x1f0c5f,_0xb80cb4){_0x1f0c5f=_0x1f0c5f-0x0;var _0x68b0f2=_0x6aa9[_0x1f0c5f];return _0x68b0f2;};'use strict';var Sequelize=require(_0x96aa('0x0'));module[_0x96aa('0x1')]={'penalty':{'type':Sequelize[_0x96aa('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 15a9e5b..cd792fb 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 _0xbec3=['exports','define','user_has_voice_queues','api','moment','bluebird','request-promise','./userVoiceQueue.attributes'];(function(_0x4f5ab6,_0x595a81){var _0x5807bd=function(_0x13730f){while(--_0x13730f){_0x4f5ab6['push'](_0x4f5ab6['shift']());}};_0x5807bd(++_0x595a81);}(_0xbec3,0x1e3));var _0x3bec=function(_0x46a653,_0x48bdf5){_0x46a653=_0x46a653-0x0;var _0x25eb85=_0xbec3[_0x46a653];return _0x25eb85;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3bec('0x0'));var moment=require(_0x3bec('0x1'));var BPromise=require(_0x3bec('0x2'));var rp=require(_0x3bec('0x3'));var attributes=require(_0x3bec('0x4'));module[_0x3bec('0x5')]=function(_0x11da90,_0x137c35){return _0x11da90[_0x3bec('0x6')]('UserVoiceQueue',attributes,{'tableName':_0x3bec('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x656a=['util','api','moment','request-promise','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x2539a6,_0x40d697){var _0x315e0f=function(_0x5c2049){while(--_0x5c2049){_0x2539a6['push'](_0x2539a6['shift']());}};_0x315e0f(++_0x40d697);}(_0x656a,0x14d));var _0xa656=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x656a[_0xbc346f];return _0x9f9260;};'use strict';var _=require('lodash');var util=require(_0xa656('0x0'));var logger=require('../../config/logger')(_0xa656('0x1'));var moment=require(_0xa656('0x2'));var BPromise=require('bluebird');var rp=require(_0xa656('0x3'));var attributes=require(_0xa656('0x4'));module[_0xa656('0x5')]=function(_0x1bbc59,_0x4dd2de){return _0x1bbc59[_0xa656('0x6')](_0xa656('0x7'),attributes,{'tableName':_0xa656('0x8'),'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 889cfc5..dfdad2d 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 _0x6483=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x54019b,_0x53bf08){var _0x5d1730=function(_0x323f4a){while(--_0x323f4a){_0x54019b['push'](_0x54019b['shift']());}};_0x5d1730(++_0x53bf08);}(_0x6483,0x1e2));var _0x3648=function(_0x54da6a,_0x515a8d){_0x54da6a=_0x54da6a-0x0;var _0x2de982=_0x6483[_0x54da6a];return _0x2de982;};'use strict';var _=require(_0x3648('0x0'));var util=require(_0x3648('0x1'));var moment=require(_0x3648('0x2'));var BPromise=require('bluebird');var rs=require(_0x3648('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x3648('0x4'));var logger=require(_0x3648('0x5'))(_0x3648('0x6'));var config=require(_0x3648('0x7'));var jayson=require(_0x3648('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f453c,_0x5d4f2c,_0x2a6587){return new BPromise(function(_0x201e30,_0x3cdccd){return client[_0x3648('0x9')](_0x1f453c,_0x2a6587)[_0x3648('0xa')](function(_0xb309e3){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x5d4f2c,_0x3648('0xb'));logger[_0x3648('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5d4f2c,_0x3648('0xb'),JSON[_0x3648('0xd')](_0xb309e3));if(_0xb309e3[_0x3648('0xe')]){if(_0xb309e3['error'][_0x3648('0xf')]===0x1f4){logger[_0x3648('0xe')](_0x3648('0x10'),_0x5d4f2c,_0xb309e3['error'][_0x3648('0x11')]);return _0x3cdccd(_0xb309e3['error']['message']);}logger[_0x3648('0xe')](_0x3648('0x10'),_0x5d4f2c,_0xb309e3['error'][_0x3648('0x11')]);return _0x201e30(_0xb309e3['error'][_0x3648('0x11')]);}else{logger[_0x3648('0x12')](_0x3648('0x10'),_0x5d4f2c,_0x3648('0xb'));_0x201e30(_0xb309e3[_0x3648('0x13')]['message']);}})[_0x3648('0x14')](function(_0x580a3a){logger[_0x3648('0xe')](_0x3648('0x10'),_0x5d4f2c,_0x580a3a);_0x3cdccd(_0x580a3a);});});} \ No newline at end of file +var _0x16b4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x16b4,0xa9));var _0x416b=function(_0x256e19,_0x16030b){_0x256e19=_0x256e19-0x0;var _0x12bda7=_0x16b4[_0x256e19];return _0x12bda7;};'use strict';var _=require(_0x416b('0x0'));var util=require(_0x416b('0x1'));var moment=require(_0x416b('0x2'));var BPromise=require(_0x416b('0x3'));var rs=require(_0x416b('0x4'));var fs=require('fs');var db=require(_0x416b('0x5'))['db'];var utils=require(_0x416b('0x6'));var logger=require(_0x416b('0x7'))(_0x416b('0x8'));var config=require(_0x416b('0x9'));var jayson=require(_0x416b('0xa'));var client=jayson[_0x416b('0xb')][_0x416b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x156ebf,_0x2da355,_0x185c7e){return new BPromise(function(_0x458871,_0x40d930){return client[_0x416b('0xd')](_0x156ebf,_0x185c7e)[_0x416b('0xe')](function(_0x4f9319){logger[_0x416b('0xf')](_0x416b('0x10'),_0x2da355,_0x416b('0x11'));logger[_0x416b('0x12')](_0x416b('0x13'),_0x2da355,_0x416b('0x11'),JSON[_0x416b('0x14')](_0x4f9319));if(_0x4f9319[_0x416b('0x15')]){if(_0x4f9319[_0x416b('0x15')]['code']===0x1f4){logger[_0x416b('0x15')](_0x416b('0x10'),_0x2da355,_0x4f9319[_0x416b('0x15')][_0x416b('0x16')]);return _0x40d930(_0x4f9319['error'][_0x416b('0x16')]);}logger['error'](_0x416b('0x10'),_0x2da355,_0x4f9319[_0x416b('0x15')][_0x416b('0x16')]);return _0x458871(_0x4f9319[_0x416b('0x15')][_0x416b('0x16')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2da355,_0x416b('0x11'));_0x458871(_0x4f9319[_0x416b('0x17')][_0x416b('0x16')]);}})[_0x416b('0x18')](function(_0x55adb9){logger[_0x416b('0x15')](_0x416b('0x10'),_0x2da355,_0x55adb9);_0x40d930(_0x55adb9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7548a8e..de4cd92 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 _0xd663=['../../components/interaction/service','../../config/environment','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xd663,0xeb));var _0x3d66=function(_0x2bd685,_0x29fb63){_0x2bd685=_0x2bd685-0x0;var _0x329bdf=_0xd663[_0x2bd685];return _0x329bdf;};'use strict';var multer=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var path=require('path');var express=require(_0x3d66('0x2'));var router=express[_0x3d66('0x3')]();var auth=require(_0x3d66('0x4'));var interaction=require(_0x3d66('0x5'));var config=require(_0x3d66('0x6'));module[_0x3d66('0x7')]=router; \ No newline at end of file +var _0x7e6d=['multer','util','path','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7e6d,0xcb));var _0xd7e6=function(_0x1b00ef,_0x1db1f0){_0x1b00ef=_0x1b00ef-0x0;var _0x58d353=_0x7e6d[_0x1b00ef];return _0x58d353;};'use strict';var multer=require(_0xd7e6('0x0'));var util=require(_0xd7e6('0x1'));var path=require(_0xd7e6('0x2'));var express=require('express');var router=express[_0xd7e6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7e6('0x4'));var config=require(_0xd7e6('0x5'));module[_0xd7e6('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 b9bebb0..0c62715 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 _0xaa68=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x277c66,_0x49eb1e){var _0x485d08=function(_0x3d2b28){while(--_0x3d2b28){_0x277c66['push'](_0x277c66['shift']());}};_0x485d08(++_0x49eb1e);}(_0xaa68,0x19a));var _0x8aa6=function(_0x2b8624,_0x24855a){_0x2b8624=_0x2b8624-0x0;var _0x2ce95b=_0xaa68[_0x2b8624];return _0x2ce95b;};'use strict';var Sequelize=require(_0x8aa6('0x0'));module[_0x8aa6('0x1')]={'uniqueid':{'type':Sequelize[_0x8aa6('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8aa6('0x3')},'membername':{'type':Sequelize[_0x8aa6('0x4')],'allowNull':![],'comment':_0x8aa6('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8aa6('0x4')],'allowNull':![],'unique':_0x8aa6('0x5'),'comment':_0x8aa6('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8aa6('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x8aa6('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x8aa6('0x3')},'penalty':{'type':Sequelize[_0x8aa6('0x2')](0xb),'defaultValue':0x0,'comment':_0x8aa6('0x3')},'paused':{'type':Sequelize[_0x8aa6('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x93f8=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0xde498,_0xb0a991){var _0x1c7732=function(_0x23bde8){while(--_0x23bde8){_0xde498['push'](_0xde498['shift']());}};_0x1c7732(++_0xb0a991);}(_0x93f8,0xa8));var _0x893f=function(_0x10c176,_0x3beb0e){_0x10c176=_0x10c176-0x0;var _0x4f8590=_0x93f8[_0x10c176];return _0x4f8590;};'use strict';var Sequelize=require(_0x893f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x893f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x893f('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x893f('0x2')},'UserId':{'type':Sequelize[_0x893f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x893f('0x3')],'allowNull':![],'unique':_0x893f('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x893f('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x893f('0x4'),'comment':_0x893f('0x2')},'penalty':{'type':Sequelize[_0x893f('0x1')](0xb),'defaultValue':0x0,'comment':_0x893f('0x2')},'paused':{'type':Sequelize[_0x893f('0x1')](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 85dabc5..a3fbe6b 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 _0xfd4a=['UserVoiceQueueRt','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3c2fdd,_0x2b71f4){var _0x554ea5=function(_0x4e3ece){while(--_0x4e3ece){_0x3c2fdd['push'](_0x3c2fdd['shift']());}};_0x554ea5(++_0x2b71f4);}(_0xfd4a,0x1ee));var _0xafd4=function(_0x79be43,_0x47de22){_0x79be43=_0x79be43-0x0;var _0xe01bf3=_0xfd4a[_0x79be43];return _0xe01bf3;};'use strict';var EventEmitter=require(_0xafd4('0x0'));var UserVoiceQueueRt=require(_0xafd4('0x1'))['db'][_0xafd4('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xafd4('0x3'),'afterUpdate':'update','afterDestroy':_0xafd4('0x4')};function emitEvent(_0x5b78dd){return function(_0x1c7adc,_0x2adf59,_0x4f6a11){UserVoiceQueueRtEvents[_0xafd4('0x5')](_0x5b78dd+':'+_0x1c7adc['id'],_0x1c7adc);UserVoiceQueueRtEvents[_0xafd4('0x5')](_0x5b78dd,_0x1c7adc);_0x4f6a11(null);};}for(var e in events){if(events[_0xafd4('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xafd4('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4321=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2657c1,_0x50043d){var _0x2a94c3=function(_0x6915e2){while(--_0x6915e2){_0x2657c1['push'](_0x2657c1['shift']());}};_0x2a94c3(++_0x50043d);}(_0x4321,0x137));var _0x1432=function(_0x27bdbc,_0x172645){_0x27bdbc=_0x27bdbc-0x0;var _0x1384a6=_0x4321[_0x27bdbc];return _0x1384a6;};'use strict';var EventEmitter=require(_0x1432('0x0'));var UserVoiceQueueRt=require(_0x1432('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1432('0x2')](0x0);var events={'afterCreate':_0x1432('0x3'),'afterUpdate':_0x1432('0x4'),'afterDestroy':_0x1432('0x5')};function emitEvent(_0x1fd561){return function(_0x2c4687,_0x572270,_0x246fe0){UserVoiceQueueRtEvents[_0x1432('0x6')](_0x1fd561+':'+_0x2c4687['id'],_0x2c4687);UserVoiceQueueRtEvents['emit'](_0x1fd561,_0x2c4687);_0x246fe0(null);};}for(var e in events){if(events[_0x1432('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x1432('0x8')](e,emitEvent(event));}}module[_0x1432('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 23c37ec..35930d4 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 _0x6bc1=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','bluebird','request-promise','exports'];(function(_0x38ba2b,_0xa1b9f4){var _0x55bca9=function(_0x358752){while(--_0x358752){_0x38ba2b['push'](_0x38ba2b['shift']());}};_0x55bca9(++_0xa1b9f4);}(_0x6bc1,0xff));var _0x16bc=function(_0x287d54,_0x7982ba){_0x287d54=_0x287d54-0x0;var _0x340689=_0x6bc1[_0x287d54];return _0x340689;};'use strict';var _=require(_0x16bc('0x0'));var util=require(_0x16bc('0x1'));var logger=require('../../config/logger')(_0x16bc('0x2'));var moment=require('moment');var BPromise=require(_0x16bc('0x3'));var rp=require(_0x16bc('0x4'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x16bc('0x5')]=function(_0x18076f,_0x329fac){return _0x18076f[_0x16bc('0x6')](_0x16bc('0x7'),attributes,{'tableName':_0x16bc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc567=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise','./userVoiceQueueRt.attributes','exports'];(function(_0x4c6fa8,_0x548efc){var _0x43eabd=function(_0x1cc638){while(--_0x1cc638){_0x4c6fa8['push'](_0x4c6fa8['shift']());}};_0x43eabd(++_0x548efc);}(_0xc567,0x1ec));var _0x7c56=function(_0x2afdf4,_0x2e5535){_0x2afdf4=_0x2afdf4-0x0;var _0x3402df=_0xc567[_0x2afdf4];return _0x3402df;};'use strict';var _=require(_0x7c56('0x0'));var util=require(_0x7c56('0x1'));var logger=require('../../config/logger')(_0x7c56('0x2'));var moment=require(_0x7c56('0x3'));var BPromise=require(_0x7c56('0x4'));var rp=require(_0x7c56('0x5'));var attributes=require(_0x7c56('0x6'));module[_0x7c56('0x7')]=function(_0x3363a1,_0x5db0a2){return _0x3363a1['define'](_0x7c56('0x8'),attributes,{'tableName':_0x7c56('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 2025e82..a7158c3 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 _0x94ca=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','outboundQueuePauses'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x94ca,0xde));var _0xa94c=function(_0xe833cc,_0x467d44){_0xe833cc=_0xe833cc-0x0;var _0x3ac7d6=_0x94ca[_0xe833cc];return _0x3ac7d6;};'use strict';var _=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var moment=require(_0xa94c('0x2'));var BPromise=require(_0xa94c('0x3'));var rs=require(_0xa94c('0x4'));var fs=require('fs');var db=require(_0xa94c('0x5'))['db'];var utils=require(_0xa94c('0x6'));var logger=require(_0xa94c('0x7'))(_0xa94c('0x8'));var config=require(_0xa94c('0x9'));var jayson=require(_0xa94c('0xa'));var client=jayson[_0xa94c('0xb')][_0xa94c('0xc')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xa94c('0xd'),'port':0x18eb});require(_0xa94c('0xe'))[_0xa94c('0xf')](socket);function respondWithRpcPromise(_0x46f724,_0x579f29,_0x482c02){return new BPromise(function(_0x536701,_0x5dcf28){return client[_0xa94c('0x10')](_0x46f724,_0x482c02)[_0xa94c('0x11')](function(_0x55e990){logger[_0xa94c('0x12')](_0xa94c('0x13'),_0x579f29,_0xa94c('0x14'));logger[_0xa94c('0x15')](_0xa94c('0x16'),_0x579f29,_0xa94c('0x14'),JSON['stringify'](_0x55e990));if(_0x55e990['error']){if(_0x55e990['error'][_0xa94c('0x17')]===0x1f4){logger[_0xa94c('0x18')](_0xa94c('0x13'),_0x579f29,_0x55e990[_0xa94c('0x18')][_0xa94c('0x19')]);return _0x5dcf28(_0x55e990[_0xa94c('0x18')][_0xa94c('0x19')]);}logger[_0xa94c('0x18')](_0xa94c('0x13'),_0x579f29,_0x55e990['error'][_0xa94c('0x19')]);return _0x536701(_0x55e990[_0xa94c('0x18')][_0xa94c('0x19')]);}else{logger[_0xa94c('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x579f29,_0xa94c('0x14'));_0x536701(_0x55e990[_0xa94c('0x1a')][_0xa94c('0x19')]);}})[_0xa94c('0x1b')](function(_0x532d31){logger['error'](_0xa94c('0x13'),_0x579f29,_0x532d31);_0x5dcf28(_0x532d31);});});}exports[_0xa94c('0x1c')]=function(_0x4cefe3){var _0x18116d=this;return new Promise(function(_0x84e72a,_0x188d0c){return db[_0xa94c('0x1d')][_0xa94c('0x1e')]({'raw':_0x4cefe3[_0xa94c('0x1f')]?_0x4cefe3[_0xa94c('0x1f')][_0xa94c('0x20')]===undefined?!![]:![]:!![],'where':_0x4cefe3[_0xa94c('0x1f')]?_0x4cefe3[_0xa94c('0x1f')][_0xa94c('0x21')]||null:null,'attributes':[[db[_0xa94c('0x22')]['fn'](_0xa94c('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xa94c('0x24')]]})[_0xa94c('0x11')](function(_0x2d7a8b){logger['info'](_0xa94c('0x1c'),_0x4cefe3);logger[_0xa94c('0x15')](_0xa94c('0x1c'),_0x4cefe3,JSON['stringify'](_0x2d7a8b));_0x84e72a(_0x2d7a8b);})['catch'](function(_0x291f6a){logger[_0xa94c('0x18')](_0xa94c('0x1c'),_0x291f6a[_0xa94c('0x19')],_0x4cefe3);_0x188d0c(_0x18116d['error'](0x1f4,_0x291f6a[_0xa94c('0x19')]));});});}; \ No newline at end of file +var _0x8f7d=['options','sequelize','COUNT','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UserVoiceQueueRt'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8f7d,0xf5));var _0xd8f7=function(_0xec09ab,_0x4ce447){_0xec09ab=_0xec09ab-0x0;var _0x46972c=_0x8f7d[_0xec09ab];return _0x46972c;};'use strict';var _=require(_0xd8f7('0x0'));var util=require(_0xd8f7('0x1'));var moment=require('moment');var BPromise=require(_0xd8f7('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xd8f7('0x3'));var logger=require('../../config/logger')(_0xd8f7('0x4'));var config=require(_0xd8f7('0x5'));var jayson=require(_0xd8f7('0x6'));var client=jayson[_0xd8f7('0x7')]['http']({'port':0x232a});var socket=require(_0xd8f7('0x8'))({'host':_0xd8f7('0x9'),'port':0x18eb});require(_0xd8f7('0xa'))[_0xd8f7('0xb')](socket);function respondWithRpcPromise(_0xa61f07,_0x219fcc,_0x253fb5){return new BPromise(function(_0x25dec9,_0x5ca868){return client[_0xd8f7('0xc')](_0xa61f07,_0x253fb5)['then'](function(_0x784191){logger[_0xd8f7('0xd')](_0xd8f7('0xe'),_0x219fcc,_0xd8f7('0xf'));logger[_0xd8f7('0x10')](_0xd8f7('0x11'),_0x219fcc,_0xd8f7('0xf'),JSON[_0xd8f7('0x12')](_0x784191));if(_0x784191[_0xd8f7('0x13')]){if(_0x784191[_0xd8f7('0x13')][_0xd8f7('0x14')]===0x1f4){logger[_0xd8f7('0x13')](_0xd8f7('0xe'),_0x219fcc,_0x784191[_0xd8f7('0x13')][_0xd8f7('0x15')]);return _0x5ca868(_0x784191[_0xd8f7('0x13')]['message']);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x219fcc,_0x784191[_0xd8f7('0x13')][_0xd8f7('0x15')]);return _0x25dec9(_0x784191[_0xd8f7('0x13')][_0xd8f7('0x15')]);}else{logger[_0xd8f7('0xd')](_0xd8f7('0xe'),_0x219fcc,_0xd8f7('0xf'));_0x25dec9(_0x784191[_0xd8f7('0x16')]['message']);}})[_0xd8f7('0x17')](function(_0x47c992){logger[_0xd8f7('0x13')](_0xd8f7('0xe'),_0x219fcc,_0x47c992);_0x5ca868(_0x47c992);});});}exports['GetVoiceQueueRtPauses']=function(_0x304473){var _0x163bf9=this;return new Promise(function(_0x1499f3,_0x48a97b){return db[_0xd8f7('0x18')]['findAll']({'raw':_0x304473[_0xd8f7('0x19')]?_0x304473[_0xd8f7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x304473[_0xd8f7('0x19')]?_0x304473[_0xd8f7('0x19')]['where']||null:null,'attributes':[[db[_0xd8f7('0x1a')]['fn'](_0xd8f7('0x1b'),db['sequelize']['fn']('IF',db[_0xd8f7('0x1a')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xd8f7('0x1c')]]})['then'](function(_0x148d6f){logger[_0xd8f7('0xd')]('GetVoiceQueueRtPauses',_0x304473);logger[_0xd8f7('0x10')](_0xd8f7('0x1d'),_0x304473,JSON[_0xd8f7('0x12')](_0x148d6f));_0x1499f3(_0x148d6f);})[_0xd8f7('0x17')](function(_0x8874d4){logger[_0xd8f7('0x13')](_0xd8f7('0x1d'),_0x8874d4[_0xd8f7('0x15')],_0x304473);_0x48a97b(_0x163bf9[_0xd8f7('0x13')](0x1f4,_0x8874d4[_0xd8f7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 345a6bd..cba3038 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 _0xeff8=['update','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x3a2067,_0xd409b2){var _0x46a87e=function(_0x3be505){while(--_0x3be505){_0x3a2067['push'](_0x3a2067['shift']());}};_0x46a87e(++_0xd409b2);}(_0xeff8,0x186));var _0x8eff=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0xeff8[_0x5c2c7c];return _0xea7ffe;};'use strict';var UserVoiceQueueRtEvents=require(_0x8eff('0x0'));var events=[_0x8eff('0x1'),'remove',_0x8eff('0x2')];function createListener(_0x354ff4,_0x1e55a0){return function(_0x55e437){_0x1e55a0[_0x8eff('0x3')](_0x354ff4,_0x55e437);};}function removeListener(_0x2a6581,_0x4ba2bf){return function(){UserVoiceQueueRtEvents[_0x8eff('0x4')](_0x2a6581,_0x4ba2bf);};}exports['register']=function(_0x469641){for(var _0xb54063=0x0,_0x3409bc=events[_0x8eff('0x5')];_0xb54063<_0x3409bc;_0xb54063++){var _0x491f01=events[_0xb54063];var _0x3fb9ee=createListener(_0x8eff('0x6')+_0x491f01,_0x469641);UserVoiceQueueRtEvents['on'](_0x491f01,_0x3fb9ee);}}; \ No newline at end of file +var _0x0fda=['register','length','./userVoiceQueueRt.events','remove','update','emit'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x1933d4,_0x3a4c85){_0x1933d4=_0x1933d4-0x0;var _0x9651a1=_0x0fda[_0x1933d4];return _0x9651a1;};'use strict';var UserVoiceQueueRtEvents=require(_0xa0fd('0x0'));var events=['save',_0xa0fd('0x1'),_0xa0fd('0x2')];function createListener(_0x314a1a,_0x2f71f3){return function(_0x426242){_0x2f71f3[_0xa0fd('0x3')](_0x314a1a,_0x426242);};}function removeListener(_0x13c734,_0x574fca){return function(){UserVoiceQueueRtEvents['removeListener'](_0x13c734,_0x574fca);};}exports[_0xa0fd('0x4')]=function(_0x4aec58){for(var _0x49b3c1=0x0,_0x868183=events[_0xa0fd('0x5')];_0x49b3c1<_0x868183;_0x49b3c1++){var _0x1aab41=events[_0x49b3c1];var _0x248cca=createListener('userVoiceQueueRt:'+_0x1aab41,_0x4aec58);UserVoiceQueueRtEvents['on'](_0x1aab41,_0x248cca);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2944521..945386b 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 _0xc30e=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy'];(function(_0x3b5a60,_0x4bc35b){var _0x480f92=function(_0x58099b){while(--_0x58099b){_0x3b5a60['push'](_0x3b5a60['shift']());}};_0x480f92(++_0x4bc35b);}(_0xc30e,0x1b1));var _0xec30=function(_0x162798,_0x2e3bb4){_0x162798=_0x162798-0x0;var _0x27a949=_0xc30e[_0x162798];return _0x27a949;};'use strict';var multer=require(_0xec30('0x0'));var util=require(_0xec30('0x1'));var path=require(_0xec30('0x2'));var express=require(_0xec30('0x3'));var router=express['Router']();var auth=require(_0xec30('0x4'));var interaction=require(_0xec30('0x5'));var config=require('../../config/environment');var controller=require(_0xec30('0x6'));router[_0xec30('0x7')]('/',auth[_0xec30('0x8')](),controller['index']);router['get'](_0xec30('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xec30('0xa')]('/',auth[_0xec30('0x8')](),controller[_0xec30('0xb')]);router['put']('/:id',auth[_0xec30('0x8')](),controller[_0xec30('0xc')]);router[_0xec30('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xec30('0xe')]);module[_0xec30('0xf')]=router; \ No newline at end of file +var _0x8390=['../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x468a9d,_0x9924e){var _0x1013c0=function(_0x544274){while(--_0x544274){_0x468a9d['push'](_0x468a9d['shift']());}};_0x1013c0(++_0x9924e);}(_0x8390,0x71));var _0x0839=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x8390[_0x3c487b];return _0x1d65f6;};'use strict';var multer=require(_0x0839('0x0'));var util=require(_0x0839('0x1'));var path=require(_0x0839('0x2'));var express=require(_0x0839('0x3'));var router=express['Router']();var auth=require(_0x0839('0x4'));var interaction=require(_0x0839('0x5'));var config=require(_0x0839('0x6'));var controller=require(_0x0839('0x7'));router[_0x0839('0x8')]('/',auth[_0x0839('0x9')](),controller[_0x0839('0xa')]);router[_0x0839('0x8')](_0x0839('0xb'),auth[_0x0839('0x9')](),controller[_0x0839('0xc')]);router['post']('/',auth[_0x0839('0x9')](),controller[_0x0839('0xd')]);router[_0x0839('0xe')](_0x0839('0xb'),auth['isAuthenticated'](),controller[_0x0839('0xf')]);router['delete'](_0x0839('0xb'),auth['isAuthenticated'](),controller[_0x0839('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3b640e2..847a3d7 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 _0x9983=['sequelize','STRING','name'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x9983,0x159));var _0x3998=function(_0x4c6073,_0x2157db){_0x4c6073=_0x4c6073-0x0;var _0x3b41b8=_0x9983[_0x4c6073];return _0x3b41b8;};'use strict';var Sequelize=require(_0x3998('0x0'));module['exports']={'name':{'type':Sequelize[_0x3998('0x1')],'unique':_0x3998('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3998('0x1')]}}; \ No newline at end of file +var _0xa1aa=['STRING','name'];(function(_0x5a03fa,_0xcf3275){var _0x29e6c2=function(_0x10638b){while(--_0x10638b){_0x5a03fa['push'](_0x5a03fa['shift']());}};_0x29e6c2(++_0xcf3275);}(_0xa1aa,0x88));var _0xaa1a=function(_0xd55c34,_0x214893){_0xd55c34=_0xd55c34-0x0;var _0x5421ea=_0xa1aa[_0xd55c34];return _0x5421ea;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaa1a('0x0')],'unique':_0xaa1a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaa1a('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 00ad570..5449ace 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 _0xc4ff=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','Variable','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','add','day','merge','filter','options','count','include','rows','show','params','includeAll','find','catch','body','fast-json-patch'];(function(_0x29a829,_0x3fc220){var _0x3acad2=function(_0x3e25b0){while(--_0x3e25b0){_0x29a829['push'](_0x29a829['shift']());}};_0x3acad2(++_0x3fc220);}(_0xc4ff,0x1cd));var _0xfc4f=function(_0x20ec8b,_0x17de04){_0x20ec8b=_0x20ec8b-0x0;var _0x3116ac=_0xc4ff[_0x20ec8b];return _0x3116ac;};'use strict';var jsonpatch=require(_0xfc4f('0x0'));var rp=require('request-promise');var moment=require(_0xfc4f('0x1'));var BPromise=require(_0xfc4f('0x2'));var Mustache=require(_0xfc4f('0x3'));var util=require(_0xfc4f('0x4'));var path=require(_0xfc4f('0x5'));var sox=require(_0xfc4f('0x6'));var csv=require(_0xfc4f('0x7'));var ejs=require(_0xfc4f('0x8'));var fs=require('fs');var _=require(_0xfc4f('0x9'));var squel=require('squel');var crypto=require(_0xfc4f('0xa'));var jsforce=require(_0xfc4f('0xb'));var deskjs=require(_0xfc4f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfc4f('0xd'));var Papa=require(_0xfc4f('0xe'));var qs=require(_0xfc4f('0xf'));var logger=require(_0xfc4f('0x10'))(_0xfc4f('0x11'));var utils=require(_0xfc4f('0x12'));var config=require('../../config/environment');var db=require(_0xfc4f('0x13'))['db'];function respondWithStatusCode(_0xae65f0,_0x218124){_0x218124=_0x218124||0xcc;return function(_0xa26be6){if(_0xa26be6){return _0xae65f0[_0xfc4f('0x14')](_0x218124);}return _0xae65f0[_0xfc4f('0x15')](_0x218124)['end']();};}function respondWithResult(_0x4a448e,_0x40835b){_0x40835b=_0x40835b||0xc8;return function(_0x1f255f){if(_0x1f255f){return _0x4a448e['status'](_0x40835b)[_0xfc4f('0x16')](_0x1f255f);}};}function respondWithFilteredResult(_0x36e7e4,_0x29bbd0){return function(_0x1da9fc){if(_0x1da9fc){var _0x4b3ea9=_0x1da9fc['count'],_0x5e99df=_0x29bbd0[_0xfc4f('0x17')],_0x5616e2=_0x29bbd0[_0xfc4f('0x17')]+_0x29bbd0[_0xfc4f('0x18')],_0x422104;if(_0x5616e2>=_0x4b3ea9){_0x5616e2=_0x4b3ea9;_0x422104=0xc8;}else{_0x422104=0xce;}_0x36e7e4['status'](_0x422104);return _0x36e7e4['set'](_0xfc4f('0x19'),_0x5e99df+'-'+_0x5616e2+'/'+_0x4b3ea9)['json'](_0x1da9fc);}return null;};}function patchUpdates(_0x4f7fa0){return function(_0x5d583d){try{jsonpatch[_0xfc4f('0x1a')](_0x5d583d,_0x4f7fa0,!![]);}catch(_0x3b8d87){return BPromise[_0xfc4f('0x1b')](_0x3b8d87);}return _0x5d583d['save']();};}function saveUpdates(_0x110989,_0x17da18){return function(_0x31247e){if(_0x31247e){return _0x31247e[_0xfc4f('0x1c')](_0x110989)[_0xfc4f('0x1d')](function(_0x29e254){return _0x29e254;});}return null;};}function removeEntity(_0xdcf44c,_0x1f1ed7){return function(_0x14aa00){if(_0x14aa00){return _0x14aa00[_0xfc4f('0x1e')]()[_0xfc4f('0x1d')](function(){_0xdcf44c[_0xfc4f('0x15')](0xcc)[_0xfc4f('0x1f')]();});}};}function handleEntityNotFound(_0xb50a10,_0x4a667b){return function(_0x1adbff){if(!_0x1adbff){_0xb50a10[_0xfc4f('0x14')](0x194);}return _0x1adbff;};}function handleError(_0x4c4960,_0x512d7e){_0x512d7e=_0x512d7e||0x1f4;return function(_0x358329){logger['error'](_0x358329[_0xfc4f('0x20')]);if(_0x358329[_0xfc4f('0x21')]){delete _0x358329['name'];}_0x4c4960['status'](_0x512d7e)[_0xfc4f('0x22')](_0x358329);};}exports['index']=function(_0x419898,_0x5bad9c){var _0x3d9503={},_0x4d7842={},_0x195546={'count':0x0,'rows':[]};var _0xeae093=db[_0xfc4f('0x23')][_0xfc4f('0x24')];_0x4d7842[_0xfc4f('0x25')]=_[_0xfc4f('0x26')](_0xeae093);var _0x314534={'dateStart':_0x419898[_0xfc4f('0x27')]['dateStart'],'dateEnd':_0x419898[_0xfc4f('0x27')]['dateEnd']};delete _0x419898[_0xfc4f('0x27')][_0xfc4f('0x28')];delete _0x419898['query'][_0xfc4f('0x29')];_0x4d7842[_0xfc4f('0x27')]=_['keys'](_0x419898[_0xfc4f('0x27')]);_0x4d7842['filters']=_[_0xfc4f('0x2a')](_0x4d7842[_0xfc4f('0x25')],_0x4d7842['query']);_0x3d9503[_0xfc4f('0x2b')]=_[_0xfc4f('0x2a')](_0x4d7842[_0xfc4f('0x25')],qs[_0xfc4f('0x2c')](_0x419898['query'][_0xfc4f('0x2c')]));_0x3d9503[_0xfc4f('0x2b')]=_0x3d9503[_0xfc4f('0x2b')][_0xfc4f('0x2d')]?_0x3d9503[_0xfc4f('0x2b')]:_0x4d7842['model'];if(!_0x419898[_0xfc4f('0x27')][_0xfc4f('0x2e')](_0xfc4f('0x2f'))){_0x3d9503[_0xfc4f('0x18')]=qs[_0xfc4f('0x18')](_0x419898[_0xfc4f('0x27')][_0xfc4f('0x18')]);_0x3d9503[_0xfc4f('0x17')]=qs[_0xfc4f('0x17')](_0x419898[_0xfc4f('0x27')][_0xfc4f('0x17')]);}_0x3d9503[_0xfc4f('0x30')]=qs[_0xfc4f('0x31')](_0x419898[_0xfc4f('0x27')][_0xfc4f('0x31')]);_0x3d9503[_0xfc4f('0x32')]=qs[_0xfc4f('0x33')](_['pick'](_0x419898['query'],_0x4d7842[_0xfc4f('0x33')]));if(_0x314534[_0xfc4f('0x28')]){if(_0x314534['dateEnd']){_0x314534[_0xfc4f('0x29')]=moment(_0x314534[_0xfc4f('0x29')])[_0xfc4f('0x34')](0x1,_0xfc4f('0x35'));}else{_0x314534['dateEnd']=moment(_0x314534[_0xfc4f('0x28')])[_0xfc4f('0x34')](0x1,_0xfc4f('0x35'));}_[_0xfc4f('0x36')](_0x3d9503[_0xfc4f('0x32')],{'createdAt':{'$gte':_0x314534[_0xfc4f('0x28')],'$lte':_0x314534['dateEnd']}});}if(_0x419898[_0xfc4f('0x27')][_0xfc4f('0x37')]){_0x3d9503[_0xfc4f('0x32')]=_[_0xfc4f('0x36')](_0x3d9503[_0xfc4f('0x32')],{'$or':_['map'](_0x3d9503[_0xfc4f('0x2b')],function(_0x35b5f5){var _0x30d530={};_0x30d530[_0x35b5f5]={'$like':'%'+_0x419898['query']['filter']+'%'};return _0x30d530;})});}_0x3d9503=_['merge']({},_0x3d9503,_0x419898[_0xfc4f('0x38')]);var _0x1a7a03={'where':_0x3d9503['where']};return db['Variable']['count'](_0x1a7a03)[_0xfc4f('0x1d')](function(_0x2b584c){_0x195546[_0xfc4f('0x39')]=_0x2b584c;if(_0x419898[_0xfc4f('0x27')]['includeAll']){_0x3d9503[_0xfc4f('0x3a')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x3d9503);})['then'](function(_0x4bf2dc){_0x195546[_0xfc4f('0x3b')]=_0x4bf2dc;return _0x195546;})['then'](respondWithFilteredResult(_0x5bad9c,_0x3d9503))['catch'](handleError(_0x5bad9c,null));};exports[_0xfc4f('0x3c')]=function(_0x1e411c,_0x42e94a){var _0x1b0052={'raw':!![],'where':{'id':_0x1e411c[_0xfc4f('0x3d')]['id']}},_0x53a8ed={};_0x53a8ed[_0xfc4f('0x25')]=_[_0xfc4f('0x26')](db[_0xfc4f('0x23')][_0xfc4f('0x24')]);_0x53a8ed[_0xfc4f('0x27')]=_[_0xfc4f('0x26')](_0x1e411c[_0xfc4f('0x27')]);_0x53a8ed['filters']=_['intersection'](_0x53a8ed[_0xfc4f('0x25')],_0x53a8ed['query']);_0x1b0052[_0xfc4f('0x2b')]=_['intersection'](_0x53a8ed[_0xfc4f('0x25')],qs[_0xfc4f('0x2c')](_0x1e411c[_0xfc4f('0x27')][_0xfc4f('0x2c')]));_0x1b0052[_0xfc4f('0x2b')]=_0x1b0052[_0xfc4f('0x2b')][_0xfc4f('0x2d')]?_0x1b0052[_0xfc4f('0x2b')]:_0x53a8ed['model'];if(_0x1e411c[_0xfc4f('0x27')][_0xfc4f('0x3e')]){_0x1b0052[_0xfc4f('0x3a')]=[{'all':!![]}];}_0x1b0052=_[_0xfc4f('0x36')]({},_0x1b0052,_0x1e411c[_0xfc4f('0x38')]);return db['Variable'][_0xfc4f('0x3f')](_0x1b0052)[_0xfc4f('0x1d')](handleEntityNotFound(_0x42e94a,null))[_0xfc4f('0x1d')](respondWithResult(_0x42e94a,null))[_0xfc4f('0x40')](handleError(_0x42e94a,null));};exports['create']=function(_0xc3a158,_0x59f80a){return db['Variable']['create'](_0xc3a158[_0xfc4f('0x41')],{})[_0xfc4f('0x1d')](respondWithResult(_0x59f80a,0xc9))[_0xfc4f('0x40')](handleError(_0x59f80a,null));};exports[_0xfc4f('0x1c')]=function(_0x356b2f,_0x534ed3){if(_0x356b2f[_0xfc4f('0x41')]['id']){delete _0x356b2f[_0xfc4f('0x41')]['id'];}return db[_0xfc4f('0x23')][_0xfc4f('0x3f')]({'where':{'id':_0x356b2f[_0xfc4f('0x3d')]['id']}})[_0xfc4f('0x1d')](handleEntityNotFound(_0x534ed3,null))[_0xfc4f('0x1d')](saveUpdates(_0x356b2f[_0xfc4f('0x41')],null))[_0xfc4f('0x1d')](respondWithResult(_0x534ed3,null))[_0xfc4f('0x40')](handleError(_0x534ed3,null));};exports['destroy']=function(_0x563728,_0x2e7f7e){return db[_0xfc4f('0x23')][_0xfc4f('0x3f')]({'where':{'id':_0x563728[_0xfc4f('0x3d')]['id']}})[_0xfc4f('0x1d')](handleEntityNotFound(_0x2e7f7e,null))[_0xfc4f('0x1d')](removeEntity(_0x2e7f7e,null))['catch'](handleError(_0x2e7f7e,null));}; \ No newline at end of file +var _0xfb5b=['hasOwnProperty','nolimit','sort','where','pick','add','day','map','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','stack','name','send','index','Variable','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','length'];(function(_0x56885a,_0x4229c8){var _0x52f639=function(_0x241bbf){while(--_0x241bbf){_0x56885a['push'](_0x56885a['shift']());}};_0x52f639(++_0x4229c8);}(_0xfb5b,0xdf));var _0xbfb5=function(_0x34e743,_0x584acc){_0x34e743=_0x34e743-0x0;var _0x17221d=_0xfb5b[_0x34e743];return _0x17221d;};'use strict';var jsonpatch=require(_0xbfb5('0x0'));var rp=require(_0xbfb5('0x1'));var moment=require(_0xbfb5('0x2'));var BPromise=require(_0xbfb5('0x3'));var Mustache=require(_0xbfb5('0x4'));var util=require(_0xbfb5('0x5'));var path=require('path');var sox=require(_0xbfb5('0x6'));var csv=require('to-csv');var ejs=require(_0xbfb5('0x7'));var fs=require('fs');var _=require(_0xbfb5('0x8'));var squel=require(_0xbfb5('0x9'));var crypto=require(_0xbfb5('0xa'));var jsforce=require(_0xbfb5('0xb'));var deskjs=require(_0xbfb5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xbfb5('0xd'));var logger=require(_0xbfb5('0xe'))(_0xbfb5('0xf'));var utils=require(_0xbfb5('0x10'));var config=require('../../config/environment');var db=require(_0xbfb5('0x11'))['db'];function respondWithStatusCode(_0x58441f,_0x5eaf57){_0x5eaf57=_0x5eaf57||0xcc;return function(_0x4f3264){if(_0x4f3264){return _0x58441f[_0xbfb5('0x12')](_0x5eaf57);}return _0x58441f[_0xbfb5('0x13')](_0x5eaf57)[_0xbfb5('0x14')]();};}function respondWithResult(_0x46ebed,_0x132b22){_0x132b22=_0x132b22||0xc8;return function(_0x3a1293){if(_0x3a1293){return _0x46ebed['status'](_0x132b22)[_0xbfb5('0x15')](_0x3a1293);}};}function respondWithFilteredResult(_0x133a71,_0x2a09cf){return function(_0x594cf1){if(_0x594cf1){var _0x305552=_0x594cf1[_0xbfb5('0x16')],_0x4c1bcc=_0x2a09cf[_0xbfb5('0x17')],_0x50793b=_0x2a09cf[_0xbfb5('0x17')]+_0x2a09cf[_0xbfb5('0x18')],_0x27dbbe;if(_0x50793b>=_0x305552){_0x50793b=_0x305552;_0x27dbbe=0xc8;}else{_0x27dbbe=0xce;}_0x133a71[_0xbfb5('0x13')](_0x27dbbe);return _0x133a71['set'](_0xbfb5('0x19'),_0x4c1bcc+'-'+_0x50793b+'/'+_0x305552)[_0xbfb5('0x15')](_0x594cf1);}return null;};}function patchUpdates(_0x1ec00a){return function(_0x1c4d4a){try{jsonpatch[_0xbfb5('0x1a')](_0x1c4d4a,_0x1ec00a,!![]);}catch(_0x55e01e){return BPromise[_0xbfb5('0x1b')](_0x55e01e);}return _0x1c4d4a['save']();};}function saveUpdates(_0x19f866,_0x411bc9){return function(_0xb5583b){if(_0xb5583b){return _0xb5583b[_0xbfb5('0x1c')](_0x19f866)[_0xbfb5('0x1d')](function(_0xfa90cd){return _0xfa90cd;});}return null;};}function removeEntity(_0x2d94fb,_0x171712){return function(_0x5df181){if(_0x5df181){return _0x5df181['destroy']()[_0xbfb5('0x1d')](function(){_0x2d94fb[_0xbfb5('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25c36a,_0x48a6ca){return function(_0x5cd486){if(!_0x5cd486){_0x25c36a['sendStatus'](0x194);}return _0x5cd486;};}function handleError(_0x5e6ce2,_0x9424c7){_0x9424c7=_0x9424c7||0x1f4;return function(_0x1e8bdd){logger['error'](_0x1e8bdd[_0xbfb5('0x1e')]);if(_0x1e8bdd[_0xbfb5('0x1f')]){delete _0x1e8bdd['name'];}_0x5e6ce2[_0xbfb5('0x13')](_0x9424c7)[_0xbfb5('0x20')](_0x1e8bdd);};}exports[_0xbfb5('0x21')]=function(_0x35e4d6,_0x356636){var _0x5838da={},_0x35ecc6={},_0x4c22e4={'count':0x0,'rows':[]};var _0x141c6a=db[_0xbfb5('0x22')]['rawAttributes'];_0x35ecc6[_0xbfb5('0x23')]=_['keys'](_0x141c6a);var _0x55ce0d={'dateStart':_0x35e4d6[_0xbfb5('0x24')][_0xbfb5('0x25')],'dateEnd':_0x35e4d6['query'][_0xbfb5('0x26')]};delete _0x35e4d6[_0xbfb5('0x24')][_0xbfb5('0x25')];delete _0x35e4d6[_0xbfb5('0x24')][_0xbfb5('0x26')];_0x35ecc6[_0xbfb5('0x24')]=_[_0xbfb5('0x27')](_0x35e4d6[_0xbfb5('0x24')]);_0x35ecc6[_0xbfb5('0x28')]=_['intersection'](_0x35ecc6[_0xbfb5('0x23')],_0x35ecc6[_0xbfb5('0x24')]);_0x5838da[_0xbfb5('0x29')]=_[_0xbfb5('0x2a')](_0x35ecc6[_0xbfb5('0x23')],qs['fields'](_0x35e4d6[_0xbfb5('0x24')][_0xbfb5('0x2b')]));_0x5838da['attributes']=_0x5838da['attributes'][_0xbfb5('0x2c')]?_0x5838da[_0xbfb5('0x29')]:_0x35ecc6[_0xbfb5('0x23')];if(!_0x35e4d6['query'][_0xbfb5('0x2d')](_0xbfb5('0x2e'))){_0x5838da[_0xbfb5('0x18')]=qs[_0xbfb5('0x18')](_0x35e4d6[_0xbfb5('0x24')][_0xbfb5('0x18')]);_0x5838da['offset']=qs[_0xbfb5('0x17')](_0x35e4d6[_0xbfb5('0x24')][_0xbfb5('0x17')]);}_0x5838da['order']=qs['sort'](_0x35e4d6[_0xbfb5('0x24')][_0xbfb5('0x2f')]);_0x5838da[_0xbfb5('0x30')]=qs[_0xbfb5('0x28')](_[_0xbfb5('0x31')](_0x35e4d6[_0xbfb5('0x24')],_0x35ecc6[_0xbfb5('0x28')]));if(_0x55ce0d[_0xbfb5('0x25')]){if(_0x55ce0d[_0xbfb5('0x26')]){_0x55ce0d[_0xbfb5('0x26')]=moment(_0x55ce0d[_0xbfb5('0x26')])[_0xbfb5('0x32')](0x1,'day');}else{_0x55ce0d[_0xbfb5('0x26')]=moment(_0x55ce0d['dateStart'])[_0xbfb5('0x32')](0x1,_0xbfb5('0x33'));}_['merge'](_0x5838da['where'],{'createdAt':{'$gte':_0x55ce0d[_0xbfb5('0x25')],'$lte':_0x55ce0d[_0xbfb5('0x26')]}});}if(_0x35e4d6['query']['filter']){_0x5838da[_0xbfb5('0x30')]=_['merge'](_0x5838da[_0xbfb5('0x30')],{'$or':_[_0xbfb5('0x34')](_0x5838da[_0xbfb5('0x29')],function(_0x373742){var _0x5c8f12={};_0x5c8f12[_0x373742]={'$like':'%'+_0x35e4d6['query'][_0xbfb5('0x35')]+'%'};return _0x5c8f12;})});}_0x5838da=_[_0xbfb5('0x36')]({},_0x5838da,_0x35e4d6['options']);var _0x367027={'where':_0x5838da[_0xbfb5('0x30')]};return db[_0xbfb5('0x22')][_0xbfb5('0x16')](_0x367027)['then'](function(_0x5a4767){_0x4c22e4[_0xbfb5('0x16')]=_0x5a4767;if(_0x35e4d6[_0xbfb5('0x24')][_0xbfb5('0x37')]){_0x5838da['include']=[{'all':!![]}];}return db['Variable'][_0xbfb5('0x38')](_0x5838da);})[_0xbfb5('0x1d')](function(_0x5af62f){_0x4c22e4[_0xbfb5('0x39')]=_0x5af62f;return _0x4c22e4;})[_0xbfb5('0x1d')](respondWithFilteredResult(_0x356636,_0x5838da))[_0xbfb5('0x3a')](handleError(_0x356636,null));};exports[_0xbfb5('0x3b')]=function(_0x2869d4,_0x4f474e){var _0x11b2d5={'raw':!![],'where':{'id':_0x2869d4[_0xbfb5('0x3c')]['id']}},_0x24a4ad={};_0x24a4ad['model']=_[_0xbfb5('0x27')](db['Variable'][_0xbfb5('0x3d')]);_0x24a4ad[_0xbfb5('0x24')]=_[_0xbfb5('0x27')](_0x2869d4[_0xbfb5('0x24')]);_0x24a4ad[_0xbfb5('0x28')]=_['intersection'](_0x24a4ad[_0xbfb5('0x23')],_0x24a4ad[_0xbfb5('0x24')]);_0x11b2d5[_0xbfb5('0x29')]=_[_0xbfb5('0x2a')](_0x24a4ad['model'],qs[_0xbfb5('0x2b')](_0x2869d4[_0xbfb5('0x24')][_0xbfb5('0x2b')]));_0x11b2d5['attributes']=_0x11b2d5[_0xbfb5('0x29')]['length']?_0x11b2d5[_0xbfb5('0x29')]:_0x24a4ad[_0xbfb5('0x23')];if(_0x2869d4[_0xbfb5('0x24')][_0xbfb5('0x37')]){_0x11b2d5[_0xbfb5('0x3e')]=[{'all':!![]}];}_0x11b2d5=_[_0xbfb5('0x36')]({},_0x11b2d5,_0x2869d4[_0xbfb5('0x3f')]);return db[_0xbfb5('0x22')][_0xbfb5('0x40')](_0x11b2d5)[_0xbfb5('0x1d')](handleEntityNotFound(_0x4f474e,null))[_0xbfb5('0x1d')](respondWithResult(_0x4f474e,null))['catch'](handleError(_0x4f474e,null));};exports[_0xbfb5('0x41')]=function(_0x2ef5d1,_0x468e3e){return db[_0xbfb5('0x22')][_0xbfb5('0x41')](_0x2ef5d1[_0xbfb5('0x42')],{})[_0xbfb5('0x1d')](respondWithResult(_0x468e3e,0xc9))[_0xbfb5('0x3a')](handleError(_0x468e3e,null));};exports[_0xbfb5('0x1c')]=function(_0x45cc9b,_0x324f85){if(_0x45cc9b[_0xbfb5('0x42')]['id']){delete _0x45cc9b[_0xbfb5('0x42')]['id'];}return db[_0xbfb5('0x22')][_0xbfb5('0x40')]({'where':{'id':_0x45cc9b[_0xbfb5('0x3c')]['id']}})[_0xbfb5('0x1d')](handleEntityNotFound(_0x324f85,null))['then'](saveUpdates(_0x45cc9b['body'],null))['then'](respondWithResult(_0x324f85,null))[_0xbfb5('0x3a')](handleError(_0x324f85,null));};exports['destroy']=function(_0x5e01d3,_0x253a6a){return db[_0xbfb5('0x22')][_0xbfb5('0x40')]({'where':{'id':_0x5e01d3[_0xbfb5('0x3c')]['id']}})[_0xbfb5('0x1d')](handleEntityNotFound(_0x253a6a,null))['then'](removeEntity(_0x253a6a,null))[_0xbfb5('0x3a')](handleError(_0x253a6a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index cd37747..f18e262 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 _0x2ef3=['api','moment','bluebird','./variable.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x23c02,_0x37db5f){var _0x3162cf=function(_0x53523c){while(--_0x53523c){_0x23c02['push'](_0x23c02['shift']());}};_0x3162cf(++_0x37db5f);}(_0x2ef3,0xba));var _0x32ef=function(_0x5749f6,_0x2d878a){_0x5749f6=_0x5749f6-0x0;var _0x526f96=_0x2ef3[_0x5749f6];return _0x526f96;};'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')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','./variable.attributes','exports','define','Variable','lodash','util'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x814b,0x1a2));var _0xb814=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x814b[_0x9df3d8];return _0x366da1;};'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':'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 69266e0..547b0b4 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 _0xcf58=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','find','options','raw','where','attributes','map','include','model','stringify','lodash','moment'];(function(_0x29c612,_0x1a2fed){var _0x4d5edb=function(_0x2b10f7){while(--_0x2b10f7){_0x29c612['push'](_0x29c612['shift']());}};_0x4d5edb(++_0x1a2fed);}(_0xcf58,0x153));var _0x8cf5=function(_0x45ebde,_0x314318){_0x45ebde=_0x45ebde-0x0;var _0x932736=_0xcf58[_0x45ebde];return _0x932736;};'use strict';var _=require(_0x8cf5('0x0'));var util=require('util');var moment=require(_0x8cf5('0x1'));var BPromise=require(_0x8cf5('0x2'));var rs=require(_0x8cf5('0x3'));var fs=require('fs');var db=require(_0x8cf5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cf5('0x5'))(_0x8cf5('0x6'));var config=require(_0x8cf5('0x7'));var jayson=require(_0x8cf5('0x8'));var client=jayson[_0x8cf5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bf207,_0xbff157,_0x94eee7){return new BPromise(function(_0x1a993f,_0x1f994b){return client[_0x8cf5('0xa')](_0x3bf207,_0x94eee7)['then'](function(_0x32c530){logger[_0x8cf5('0xb')](_0x8cf5('0xc'),_0xbff157,_0x8cf5('0xd'));logger[_0x8cf5('0xe')](_0x8cf5('0xf'),_0xbff157,_0x8cf5('0xd'),JSON['stringify'](_0x32c530));if(_0x32c530[_0x8cf5('0x10')]){if(_0x32c530[_0x8cf5('0x10')][_0x8cf5('0x11')]===0x1f4){logger[_0x8cf5('0x10')](_0x8cf5('0xc'),_0xbff157,_0x32c530[_0x8cf5('0x10')][_0x8cf5('0x12')]);return _0x1f994b(_0x32c530['error'][_0x8cf5('0x12')]);}logger[_0x8cf5('0x10')](_0x8cf5('0xc'),_0xbff157,_0x32c530['error']['message']);return _0x1a993f(_0x32c530[_0x8cf5('0x10')][_0x8cf5('0x12')]);}else{logger[_0x8cf5('0xb')](_0x8cf5('0xc'),_0xbff157,'request\x20sent');_0x1a993f(_0x32c530[_0x8cf5('0x13')]['message']);}})[_0x8cf5('0x14')](function(_0x2e0fec){logger[_0x8cf5('0x10')]('Variable,\x20%s,\x20%s',_0xbff157,_0x2e0fec);_0x1f994b(_0x2e0fec);});});}exports[_0x8cf5('0x15')]=function(_0x2ceb3f){var _0x5f4a9e=this;return new Promise(function(_0x2f5591,_0x140b31){return db['Variable'][_0x8cf5('0x16')]({'raw':_0x2ceb3f[_0x8cf5('0x17')]?_0x2ceb3f[_0x8cf5('0x17')][_0x8cf5('0x18')]===undefined?!![]:![]:!![],'where':_0x2ceb3f[_0x8cf5('0x17')]?_0x2ceb3f[_0x8cf5('0x17')][_0x8cf5('0x19')]||null:null,'attributes':_0x2ceb3f[_0x8cf5('0x17')]?_0x2ceb3f['options'][_0x8cf5('0x1a')]||null:null,'include':_0x2ceb3f[_0x8cf5('0x17')]?_0x2ceb3f[_0x8cf5('0x17')]['include']?_[_0x8cf5('0x1b')](_0x2ceb3f[_0x8cf5('0x17')][_0x8cf5('0x1c')],function(_0x1fb0f6){return{'model':db[_0x1fb0f6[_0x8cf5('0x1d')]],'as':_0x1fb0f6['as'],'attributes':_0x1fb0f6['attributes'],'include':_0x1fb0f6[_0x8cf5('0x1c')]?_[_0x8cf5('0x1b')](_0x1fb0f6[_0x8cf5('0x1c')],function(_0x34832c){return{'model':db[_0x34832c[_0x8cf5('0x1d')]],'as':_0x34832c['as'],'attributes':_0x34832c['attributes'],'include':_0x34832c[_0x8cf5('0x1c')]?_[_0x8cf5('0x1b')](_0x34832c[_0x8cf5('0x1c')],function(_0xa1320c){return{'model':db[_0xa1320c[_0x8cf5('0x1d')]],'as':_0xa1320c['as'],'attributes':_0xa1320c[_0x8cf5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7d0786){logger[_0x8cf5('0xb')]('ShowVariable',_0x2ceb3f);logger['debug'](_0x8cf5('0x15'),_0x2ceb3f,JSON[_0x8cf5('0x1e')](_0x7d0786));_0x2f5591(_0x7d0786);})[_0x8cf5('0x14')](function(_0x35d41a){logger['error'](_0x8cf5('0x15'),_0x35d41a[_0x8cf5('0x12')],_0x2ceb3f);_0x140b31(_0x5f4a9e[_0x8cf5('0x10')](0x1f4,_0x35d41a[_0x8cf5('0x12')]));});});}; \ No newline at end of file +var _0x7e15=['raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','Variable','options'];(function(_0x31c613,_0x511024){var _0x33a2a6=function(_0x16d467){while(--_0x16d467){_0x31c613['push'](_0x31c613['shift']());}};_0x33a2a6(++_0x511024);}(_0x7e15,0x1d4));var _0x57e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7e15[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x57e1('0x0'));var util=require(_0x57e1('0x1'));var moment=require(_0x57e1('0x2'));var BPromise=require(_0x57e1('0x3'));var rs=require(_0x57e1('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x57e1('0x5'));var logger=require(_0x57e1('0x6'))(_0x57e1('0x7'));var config=require(_0x57e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x57e1('0x9')][_0x57e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eaac3,_0x1e4e12,_0x1b36a2){return new BPromise(function(_0x10616b,_0x3d7a69){return client[_0x57e1('0xb')](_0x5eaac3,_0x1b36a2)[_0x57e1('0xc')](function(_0x579950){logger[_0x57e1('0xd')](_0x57e1('0xe'),_0x1e4e12,_0x57e1('0xf'));logger[_0x57e1('0x10')](_0x57e1('0x11'),_0x1e4e12,_0x57e1('0xf'),JSON[_0x57e1('0x12')](_0x579950));if(_0x579950[_0x57e1('0x13')]){if(_0x579950['error'][_0x57e1('0x14')]===0x1f4){logger[_0x57e1('0x13')]('Variable,\x20%s,\x20%s',_0x1e4e12,_0x579950[_0x57e1('0x13')]['message']);return _0x3d7a69(_0x579950[_0x57e1('0x13')][_0x57e1('0x15')]);}logger[_0x57e1('0x13')](_0x57e1('0xe'),_0x1e4e12,_0x579950[_0x57e1('0x13')]['message']);return _0x10616b(_0x579950[_0x57e1('0x13')][_0x57e1('0x15')]);}else{logger[_0x57e1('0xd')](_0x57e1('0xe'),_0x1e4e12,'request\x20sent');_0x10616b(_0x579950[_0x57e1('0x16')][_0x57e1('0x15')]);}})[_0x57e1('0x17')](function(_0x456a74){logger[_0x57e1('0x13')](_0x57e1('0xe'),_0x1e4e12,_0x456a74);_0x3d7a69(_0x456a74);});});}exports[_0x57e1('0x18')]=function(_0x1fd87a){var _0x38bf51=this;return new Promise(function(_0x1f7472,_0x3a6fb7){return db[_0x57e1('0x19')]['find']({'raw':_0x1fd87a[_0x57e1('0x1a')]?_0x1fd87a['options'][_0x57e1('0x1b')]===undefined?!![]:![]:!![],'where':_0x1fd87a[_0x57e1('0x1a')]?_0x1fd87a['options'][_0x57e1('0x1c')]||null:null,'attributes':_0x1fd87a[_0x57e1('0x1a')]?_0x1fd87a['options'][_0x57e1('0x1d')]||null:null,'include':_0x1fd87a[_0x57e1('0x1a')]?_0x1fd87a[_0x57e1('0x1a')][_0x57e1('0x1e')]?_[_0x57e1('0x1f')](_0x1fd87a[_0x57e1('0x1a')][_0x57e1('0x1e')],function(_0x444861){return{'model':db[_0x444861['model']],'as':_0x444861['as'],'attributes':_0x444861[_0x57e1('0x1d')],'include':_0x444861[_0x57e1('0x1e')]?_['map'](_0x444861[_0x57e1('0x1e')],function(_0x330732){return{'model':db[_0x330732[_0x57e1('0x20')]],'as':_0x330732['as'],'attributes':_0x330732[_0x57e1('0x1d')],'include':_0x330732[_0x57e1('0x1e')]?_[_0x57e1('0x1f')](_0x330732['include'],function(_0x37a41e){return{'model':db[_0x37a41e[_0x57e1('0x20')]],'as':_0x37a41e['as'],'attributes':_0x37a41e[_0x57e1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x57e1('0xc')](function(_0x5c77fc){logger[_0x57e1('0xd')](_0x57e1('0x18'),_0x1fd87a);logger[_0x57e1('0x10')]('ShowVariable',_0x1fd87a,JSON[_0x57e1('0x12')](_0x5c77fc));_0x1f7472(_0x5c77fc);})[_0x57e1('0x17')](function(_0x3592b6){logger['error']('ShowVariable',_0x3592b6[_0x57e1('0x15')],_0x1fd87a);_0x3a6fb7(_0x38bf51[_0x57e1('0x13')](0x1f4,_0x3592b6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f100ad1..478e5c7 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 _0xcf33=['index','/fetch','fetch','get','/reset','isAuthenticated','canUpdate','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x134764,_0x112da5){var _0x2fe527=function(_0x7db51d){while(--_0x7db51d){_0x134764['push'](_0x134764['shift']());}};_0x2fe527(++_0x112da5);}(_0xcf33,0x191));var _0x3cf3=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xcf33[_0x1f9f37];return _0x21c080;};'use strict';var express=require(_0x3cf3('0x0'));var router=express[_0x3cf3('0x1')]();var auth=require(_0x3cf3('0x2'));var controller=require(_0x3cf3('0x3'));router['get']('/',controller[_0x3cf3('0x4')]);router['get'](_0x3cf3('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x3cf3('0x6')]);router[_0x3cf3('0x7')](_0x3cf3('0x8'),auth[_0x3cf3('0x9')](),auth[_0x3cf3('0xa')](),controller['reset']);router[_0x3cf3('0x7')]('/pull',auth[_0x3cf3('0x9')](),auth[_0x3cf3('0xa')](),controller['pull']);router[_0x3cf3('0x7')]('/restart',auth['isAuthenticated'](),controller[_0x3cf3('0xb')]);router[_0x3cf3('0x7')](_0x3cf3('0xc'),controller[_0x3cf3('0xd')]);module[_0x3cf3('0xe')]=router; \ No newline at end of file +var _0x7e61=['fetch','/reset','isAuthenticated','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','get','canUpdate'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x7e61,0xb2));var _0x17e6=function(_0x4eac13,_0x161aa3){_0x4eac13=_0x4eac13-0x0;var _0x3580e5=_0x7e61[_0x4eac13];return _0x3580e5;};'use strict';var express=require(_0x17e6('0x0'));var router=express[_0x17e6('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x17e6('0x2')]('/',controller['index']);router[_0x17e6('0x2')]('/fetch',auth['isAuthenticated'](),auth[_0x17e6('0x3')](),controller[_0x17e6('0x4')]);router['get'](_0x17e6('0x5'),auth[_0x17e6('0x6')](),auth[_0x17e6('0x3')](),controller[_0x17e6('0x7')]);router[_0x17e6('0x2')](_0x17e6('0x8'),auth['isAuthenticated'](),auth[_0x17e6('0x3')](),controller[_0x17e6('0x9')]);router[_0x17e6('0x2')](_0x17e6('0xa'),auth[_0x17e6('0x6')](),controller[_0x17e6('0xb')]);router[_0x17e6('0x2')]('/migrations',controller[_0x17e6('0xc')]);module[_0x17e6('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a5efaa1..54fbf68 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(_0x9c6136,_0x3554de){var _0x253c7d=function(_0x3bdb82){while(--_0x3bdb82){_0x9c6136['push'](_0x9c6136['shift']());}};_0x253c7d(++_0x3554de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 _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(_0x1d4622,_0x5b2160){var _0x436efc=function(_0x51622c){while(--_0x51622c){_0x1d4622['push'](_0x1d4622['shift']());}};_0x436efc(++_0x5b2160);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Umzug=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var pkginfo=require(_0x0a9e('0x2'))(module,'version');var exec=require('child_process')[_0x0a9e('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var pm2=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var git=require(_0x0a9e('0x8'))(config['root']);exports[_0x0a9e('0x9')]=function(_0x441e3a,_0x2cc193){var _0x5f41ea={'current':module['exports'][_0x0a9e('0xa')],'phonebar':0x2};if(_0x441e3a['query']&&_0x441e3a['query'][_0x0a9e('0xb')]){return git[_0x0a9e('0xc')]()[_0x0a9e('0xd')](function(_0x3ab53f,_0xfeb75b){_0x5f41ea[_0x0a9e('0xb')]=(_0x3ab53f?module['exports']['version']:_0xfeb75b['latest'])||'2.0.0';return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);});}else{return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);}};exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return git[_0x0a9e('0xc')]([_0x0a9e('0x10'),_0x0a9e('0x11')],function(_0x281129){if(_0x281129){logger[_0x0a9e('0x12')](_0x281129);return _0x5db4b0[_0x0a9e('0xe')](0x1f4)['json'](_0x281129);}logger[_0x0a9e('0x13')]('git\x20fetch');return _0x5db4b0[_0x0a9e('0xe')](0xc8)['json']({'output':_0x0a9e('0x14')});});};exports[_0x0a9e('0x15')]=function(_0x48f32d,_0x225616){return git['reset']([_0x0a9e('0x16'),_0x0a9e('0x17')],function(_0x106033){if(_0x106033){logger[_0x0a9e('0x12')](_0x106033);return _0x225616[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x106033);}logger[_0x0a9e('0x13')](_0x0a9e('0x18'));return _0x225616[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x19')});});};exports[_0x0a9e('0x1a')]=function(_0x4bb1e3,_0x2c3407){exec(_0x0a9e('0x1b'),function(_0x53682f,_0x20f109,_0x5a09ef){logger['info'](_0x20f109);logger[_0x0a9e('0x13')](_0x5a09ef);if(_0x53682f){logger[_0x0a9e('0x12')](_0x53682f);return _0x2c3407[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x53682f);}return _0x2c3407['status'](0xc8)[_0x0a9e('0xf')]({'output':_0x20f109});});};exports[_0x0a9e('0x1c')]=function(_0x3b45bc,_0x4d00e6){return pm2[_0x0a9e('0x1c')](_0x0a9e('0x1d'))[_0x0a9e('0x1e')](function(_0x5ea472){logger['info'](_0x0a9e('0x1f'),_0x5ea472);return _0x4d00e6[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x20')});})['catch'](function(_0x384319){logger['error'](_0x384319);return _0x4d00e6[_0x0a9e('0xe')](0x1f4)['json'](_0x384319);});};exports[_0x0a9e('0x21')]=function(_0x34dc65,_0x25fba9){var _0x14433c=new Umzug({'storage':_0x0a9e('0x22'),'storageOptions':{'model':db[_0x0a9e('0x23')],'modelName':_0x0a9e('0x23'),'columnName':_0x0a9e('0xa')},'migrations':{'params':[db['sequelize'][_0x0a9e('0x24')](),db[_0x0a9e('0x22')][_0x0a9e('0x25')],function(){throw new Error(_0x0a9e('0x26'));}],'path':path['join'](config[_0x0a9e('0x27')],_0x0a9e('0x28'),_0x0a9e('0x21')),'pattern':/\.js$/}});_0x14433c['up']({'from':module[_0x0a9e('0x29')][_0x0a9e('0xa')]+_0x0a9e('0x2a')})[_0x0a9e('0x1e')](function(){return _0x25fba9[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':'Database\x20Migration\x20Completed!'});})[_0x0a9e('0x2b')](function(_0x5d1e0e){return _0x25fba9[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x5d1e0e);});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 838a49e..2ea2bdc 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 _0x7a54=['/describe','describe','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x1970c0,_0x34e3e5){var _0x5542da=function(_0x2d2975){while(--_0x2d2975){_0x1970c0['push'](_0x1970c0['shift']());}};_0x5542da(++_0x34e3e5);}(_0x7a54,0x106));var _0x47a5=function(_0x5080ff,_0x115006){_0x5080ff=_0x5080ff-0x0;var _0x56f1d5=_0x7a54[_0x5080ff];return _0x56f1d5;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var express=require('express');var router=express[_0x47a5('0x3')]();var auth=require(_0x47a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47a5('0x5'));var controller=require(_0x47a5('0x6'));router[_0x47a5('0x7')]('/',auth[_0x47a5('0x8')](),controller[_0x47a5('0x9')]);router['get'](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router[_0x47a5('0x7')]('/:id',auth[_0x47a5('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x47a5('0xc')]);router[_0x47a5('0xd')]('/:id',auth[_0x47a5('0x8')](),controller['update']);router['delete'](_0x47a5('0xe'),auth[_0x47a5('0x8')](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['/describe','describe','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x4e70bb,_0x1e494){var _0x6b7a64=function(_0xaa2efe){while(--_0xaa2efe){_0x4e70bb['push'](_0x4e70bb['shift']());}};_0x6b7a64(++_0x1e494);}(_0x7a54,0x106));var _0x47a5=function(_0x5a951d,_0x55dc81){_0x5a951d=_0x5a951d-0x0;var _0x3d4887=_0x7a54[_0x5a951d];return _0x3d4887;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var express=require('express');var router=express[_0x47a5('0x3')]();var auth=require(_0x47a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47a5('0x5'));var controller=require(_0x47a5('0x6'));router[_0x47a5('0x7')]('/',auth[_0x47a5('0x8')](),controller[_0x47a5('0x9')]);router['get'](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router[_0x47a5('0x7')]('/:id',auth[_0x47a5('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x47a5('0xc')]);router[_0x47a5('0xd')]('/:id',auth[_0x47a5('0x8')](),controller['update']);router['delete'](_0x47a5('0xe'),auth[_0x47a5('0x8')](),controller[_0x47a5('0xf')]);module[_0x47a5('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 8269147..7079faf 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 _0x5dc5=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x341389,_0x123e4b){var _0x5d861c=function(_0x13eef8){while(--_0x13eef8){_0x341389['push'](_0x341389['shift']());}};_0x5d861c(++_0x123e4b);}(_0x5dc5,0x108));var _0x55dc=function(_0x4b3bfe,_0x27baf4){_0x4b3bfe=_0x4b3bfe-0x0;var _0x5601e3=_0x5dc5[_0x4b3bfe];return _0x5601e3;};'use strict';var Sequelize=require(_0x55dc('0x0'));module[_0x55dc('0x1')]={'type':{'type':Sequelize[_0x55dc('0x2')]},'uniqueid':{'type':Sequelize[_0x55dc('0x2')]},'calleridnum':{'type':Sequelize[_0x55dc('0x2')]},'calleridname':{'type':Sequelize[_0x55dc('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x55dc('0x2')]},'membername':{'type':Sequelize[_0x55dc('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x55dc('0x3')]},'holdtime':{'type':Sequelize[_0x55dc('0x4')]},'agentcomplete':{'type':Sequelize[_0x55dc('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x55dc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x55dc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x55dc('0x4')]},'agentacw':{'type':Sequelize[_0x55dc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x55dc('0x2')]},'lastevent':{'type':Sequelize[_0x55dc('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x55dc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x55dc('0x2')]},'connectedlinename':{'type':Sequelize[_0x55dc('0x2')]},'language':{'type':Sequelize[_0x55dc('0x2')]},'accountcode':{'type':Sequelize[_0x55dc('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x55dc('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x55dc('0x2')]},'destchannelstate':{'type':Sequelize[_0x55dc('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x55dc('0x2')]},'destcalleridnum':{'type':Sequelize[_0x55dc('0x2')]},'destcalleridname':{'type':Sequelize[_0x55dc('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x55dc('0x2')]},'destlanguage':{'type':Sequelize[_0x55dc('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x55dc('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x55dc('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x55dc('0x2')]}}; \ No newline at end of file +var _0xa1c8=['STRING','DATE','BOOLEAN','INTEGER','sequelize'];(function(_0x56c944,_0x42d3b0){var _0x5081b9=function(_0x140461){while(--_0x140461){_0x56c944['push'](_0x56c944['shift']());}};_0x5081b9(++_0x42d3b0);}(_0xa1c8,0x180));var _0x8a1c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa1c8[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x8a1c('0x0'));module['exports']={'type':{'type':Sequelize[_0x8a1c('0x1')]},'uniqueid':{'type':Sequelize[_0x8a1c('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8a1c('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8a1c('0x1')]},'membername':{'type':Sequelize[_0x8a1c('0x1')]},'agentcalledAt':{'type':Sequelize[_0x8a1c('0x2')]},'agentconnectAt':{'type':Sequelize[_0x8a1c('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8a1c('0x2')]},'agentdumpAt':{'type':Sequelize[_0x8a1c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8a1c('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8a1c('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8a1c('0x4')]},'reason':{'type':Sequelize[_0x8a1c('0x1')]},'lastevent':{'type':Sequelize[_0x8a1c('0x1')]},'channel':{'type':Sequelize[_0x8a1c('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8a1c('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8a1c('0x1')]},'accountcode':{'type':Sequelize[_0x8a1c('0x1')]},'context':{'type':Sequelize[_0x8a1c('0x1')]},'exten':{'type':Sequelize[_0x8a1c('0x1')]},'priority':{'type':Sequelize[_0x8a1c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8a1c('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8a1c('0x1')]},'destcalleridname':{'type':Sequelize[_0x8a1c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x8a1c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x8a1c('0x1')]},'destlanguage':{'type':Sequelize[_0x8a1c('0x1')]},'destaccountcode':{'type':Sequelize[_0x8a1c('0x1')]},'destcontext':{'type':Sequelize[_0x8a1c('0x1')]},'destexten':{'type':Sequelize[_0x8a1c('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8a1c('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x8a1c('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 9b38ac7..182e96d 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 _0x4b19=['create','destroy','describe','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','offset','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','send','VoiceAgentReport','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','add','day','merge','where','map','filter','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find'];(function(_0x54ee94,_0x2bcced){var _0x4c60bb=function(_0x37a9c8){while(--_0x37a9c8){_0x54ee94['push'](_0x54ee94['shift']());}};_0x4c60bb(++_0x2bcced);}(_0x4b19,0x195));var _0x94b1=function(_0x3eda69,_0x25ac1d){_0x3eda69=_0x3eda69-0x0;var _0x5cdca3=_0x4b19[_0x3eda69];return _0x5cdca3;};'use strict';var jsonpatch=require(_0x94b1('0x0'));var rp=require('request-promise');var moment=require(_0x94b1('0x1'));var BPromise=require(_0x94b1('0x2'));var Mustache=require(_0x94b1('0x3'));var util=require('util');var path=require(_0x94b1('0x4'));var sox=require(_0x94b1('0x5'));var csv=require(_0x94b1('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x94b1('0x7'));var squel=require(_0x94b1('0x8'));var crypto=require('crypto');var jsforce=require(_0x94b1('0x9'));var deskjs=require(_0x94b1('0xa'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xb'));var Papa=require(_0x94b1('0xc'));var qs=require(_0x94b1('0xd'));var logger=require('../../config/logger')(_0x94b1('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x94b1('0xf'))['db'];function respondWithStatusCode(_0x126424,_0x38a71c){_0x38a71c=_0x38a71c||0xcc;return function(_0x8ddf47){if(_0x8ddf47){return _0x126424[_0x94b1('0x10')](_0x38a71c);}return _0x126424[_0x94b1('0x11')](_0x38a71c)['end']();};}function respondWithResult(_0x230c27,_0x360aea){_0x360aea=_0x360aea||0xc8;return function(_0x340a29){if(_0x340a29){return _0x230c27[_0x94b1('0x11')](_0x360aea)['json'](_0x340a29);}};}function respondWithFilteredResult(_0x4a4fe6,_0x26484b){return function(_0x1365a9){if(_0x1365a9){var _0x57de2f=_0x1365a9['count'],_0x5059d8=_0x26484b[_0x94b1('0x12')],_0x9329c9=_0x26484b['offset']+_0x26484b['limit'],_0xb9924c;if(_0x9329c9>=_0x57de2f){_0x9329c9=_0x57de2f;_0xb9924c=0xc8;}else{_0xb9924c=0xce;}_0x4a4fe6[_0x94b1('0x11')](_0xb9924c);return _0x4a4fe6[_0x94b1('0x13')](_0x94b1('0x14'),_0x5059d8+'-'+_0x9329c9+'/'+_0x57de2f)[_0x94b1('0x15')](_0x1365a9);}return null;};}function patchUpdates(_0x494138){return function(_0x326627){try{jsonpatch[_0x94b1('0x16')](_0x326627,_0x494138,!![]);}catch(_0xa29b90){return BPromise[_0x94b1('0x17')](_0xa29b90);}return _0x326627[_0x94b1('0x18')]();};}function saveUpdates(_0x1abb7f,_0x2d33dc){return function(_0x59d7cf){if(_0x59d7cf){return _0x59d7cf[_0x94b1('0x19')](_0x1abb7f)[_0x94b1('0x1a')](function(_0x1fcb91){return _0x1fcb91;});}return null;};}function removeEntity(_0x5deb20,_0x4490c9){return function(_0x32f329){if(_0x32f329){return _0x32f329['destroy']()[_0x94b1('0x1a')](function(){_0x5deb20[_0x94b1('0x11')](0xcc)[_0x94b1('0x1b')]();});}};}function handleEntityNotFound(_0x2ed3b7,_0x3a9c3c){return function(_0x38448d){if(!_0x38448d){_0x2ed3b7[_0x94b1('0x10')](0x194);}return _0x38448d;};}function handleError(_0xc8543,_0x1d88b4){_0x1d88b4=_0x1d88b4||0x1f4;return function(_0xeb777){logger['error'](_0xeb777[_0x94b1('0x1c')]);if(_0xeb777[_0x94b1('0x1d')]){delete _0xeb777[_0x94b1('0x1d')];}_0xc8543['status'](_0x1d88b4)[_0x94b1('0x1e')](_0xeb777);};}exports['index']=function(_0x269925,_0x3d10ea){var _0x14b8fe={},_0x109a81={},_0x5ad3e4={'count':0x0,'rows':[]};var _0x4ea6d9=db[_0x94b1('0x1f')]['rawAttributes'];_0x109a81[_0x94b1('0x20')]=_['keys'](_0x4ea6d9);var _0x4694de={'dateStart':_0x269925[_0x94b1('0x21')][_0x94b1('0x22')],'dateEnd':_0x269925['query'][_0x94b1('0x23')]};delete _0x269925[_0x94b1('0x21')][_0x94b1('0x22')];delete _0x269925[_0x94b1('0x21')][_0x94b1('0x23')];_0x109a81[_0x94b1('0x21')]=_[_0x94b1('0x24')](_0x269925[_0x94b1('0x21')]);_0x109a81[_0x94b1('0x25')]=_['intersection'](_0x109a81[_0x94b1('0x20')],_0x109a81[_0x94b1('0x21')]);_0x14b8fe['attributes']=_[_0x94b1('0x26')](_0x109a81[_0x94b1('0x20')],qs[_0x94b1('0x27')](_0x269925[_0x94b1('0x21')][_0x94b1('0x27')]));_0x14b8fe[_0x94b1('0x28')]=_0x14b8fe['attributes'][_0x94b1('0x29')]?_0x14b8fe['attributes']:_0x109a81[_0x94b1('0x20')];if(!_0x269925['query']['hasOwnProperty'](_0x94b1('0x2a'))){_0x14b8fe[_0x94b1('0x2b')]=qs[_0x94b1('0x2b')](_0x269925[_0x94b1('0x21')][_0x94b1('0x2b')]);_0x14b8fe[_0x94b1('0x12')]=qs[_0x94b1('0x12')](_0x269925[_0x94b1('0x21')][_0x94b1('0x12')]);}_0x14b8fe[_0x94b1('0x2c')]=qs[_0x94b1('0x2d')](_0x269925[_0x94b1('0x21')]['sort']);_0x14b8fe['where']=qs[_0x94b1('0x25')](_[_0x94b1('0x2e')](_0x269925[_0x94b1('0x21')],_0x109a81[_0x94b1('0x25')]));if(_0x4694de[_0x94b1('0x22')]){if(_0x4694de[_0x94b1('0x23')]){_0x4694de[_0x94b1('0x23')]=moment(_0x4694de[_0x94b1('0x23')])[_0x94b1('0x2f')](0x1,'day');}else{_0x4694de[_0x94b1('0x23')]=moment(_0x4694de['dateStart'])[_0x94b1('0x2f')](0x1,_0x94b1('0x30'));}_[_0x94b1('0x31')](_0x14b8fe['where'],{'createdAt':{'$gte':_0x4694de[_0x94b1('0x22')],'$lte':_0x4694de[_0x94b1('0x23')]}});}if(_0x269925[_0x94b1('0x21')]['filter']){_0x14b8fe[_0x94b1('0x32')]=_[_0x94b1('0x31')](_0x14b8fe[_0x94b1('0x32')],{'$or':_[_0x94b1('0x33')](_0x14b8fe[_0x94b1('0x28')],function(_0x2e6fb9){var _0x292964={};_0x292964[_0x2e6fb9]={'$like':'%'+_0x269925[_0x94b1('0x21')][_0x94b1('0x34')]+'%'};return _0x292964;})});}_0x14b8fe=_[_0x94b1('0x31')]({},_0x14b8fe,_0x269925[_0x94b1('0x35')]);var _0xfb5e55={'where':_0x14b8fe[_0x94b1('0x32')]};return db['VoiceAgentReport'][_0x94b1('0x36')](_0xfb5e55)[_0x94b1('0x1a')](function(_0xf29a10){_0x5ad3e4[_0x94b1('0x36')]=_0xf29a10;if(_0x269925[_0x94b1('0x21')]['includeAll']){_0x14b8fe[_0x94b1('0x37')]=[{'all':!![]}];}return db[_0x94b1('0x1f')][_0x94b1('0x38')](_0x14b8fe);})[_0x94b1('0x1a')](function(_0x3cf664){_0x5ad3e4[_0x94b1('0x39')]=_0x3cf664;return _0x5ad3e4;})['then'](respondWithFilteredResult(_0x3d10ea,_0x14b8fe))[_0x94b1('0x3a')](handleError(_0x3d10ea,null));};exports[_0x94b1('0x3b')]=function(_0x592daa,_0x317932){var _0x19d4e4={'raw':![],'where':{'id':_0x592daa[_0x94b1('0x3c')]['id']}},_0x59311b={};_0x59311b[_0x94b1('0x20')]=_[_0x94b1('0x24')](db['VoiceAgentReport'][_0x94b1('0x3d')]);_0x59311b[_0x94b1('0x21')]=_[_0x94b1('0x24')](_0x592daa[_0x94b1('0x21')]);_0x59311b[_0x94b1('0x25')]=_[_0x94b1('0x26')](_0x59311b[_0x94b1('0x20')],_0x59311b['query']);_0x19d4e4[_0x94b1('0x28')]=_[_0x94b1('0x26')](_0x59311b[_0x94b1('0x20')],qs['fields'](_0x592daa[_0x94b1('0x21')][_0x94b1('0x27')]));_0x19d4e4['attributes']=_0x19d4e4[_0x94b1('0x28')][_0x94b1('0x29')]?_0x19d4e4[_0x94b1('0x28')]:_0x59311b[_0x94b1('0x20')];if(_0x592daa[_0x94b1('0x21')][_0x94b1('0x3e')]){_0x19d4e4[_0x94b1('0x37')]=[{'all':!![]}];}_0x19d4e4=_[_0x94b1('0x31')]({},_0x19d4e4,_0x592daa[_0x94b1('0x35')]);return db[_0x94b1('0x1f')][_0x94b1('0x3f')](_0x19d4e4)[_0x94b1('0x1a')](handleEntityNotFound(_0x317932,null))[_0x94b1('0x1a')](respondWithResult(_0x317932,null))[_0x94b1('0x3a')](handleError(_0x317932,null));};exports[_0x94b1('0x40')]=function(_0x1a2aab,_0xfe1c8f){return db[_0x94b1('0x1f')][_0x94b1('0x40')](_0x1a2aab['body'],{})[_0x94b1('0x1a')](respondWithResult(_0xfe1c8f,0xc9))['catch'](handleError(_0xfe1c8f,null));};exports[_0x94b1('0x19')]=function(_0x3fc0fc,_0x1d8e57){if(_0x3fc0fc['body']['id']){delete _0x3fc0fc['body']['id'];}return db['VoiceAgentReport'][_0x94b1('0x3f')]({'where':{'id':_0x3fc0fc[_0x94b1('0x3c')]['id']}})[_0x94b1('0x1a')](handleEntityNotFound(_0x1d8e57,null))['then'](saveUpdates(_0x3fc0fc['body'],null))['then'](respondWithResult(_0x1d8e57,null))[_0x94b1('0x3a')](handleError(_0x1d8e57,null));};exports[_0x94b1('0x41')]=function(_0xbfd51b,_0x2a0f4c){return db[_0x94b1('0x1f')][_0x94b1('0x3f')]({'where':{'id':_0xbfd51b[_0x94b1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2a0f4c,null))[_0x94b1('0x1a')](removeEntity(_0x2a0f4c,null))[_0x94b1('0x3a')](handleError(_0x2a0f4c,null));};exports[_0x94b1('0x42')]=function(_0x1d9648,_0x344ebe){return db[_0x94b1('0x1f')][_0x94b1('0x42')]()[_0x94b1('0x1a')](respondWithResult(_0x344ebe,null))[_0x94b1('0x3a')](handleError(_0x344ebe,null));}; \ No newline at end of file +var _0xaba6=['save','destroy','then','end','error','stack','name','send','index','VoiceAgentReport','keys','query','dateStart','dateEnd','filters','model','fields','attributes','length','hasOwnProperty','limit','sort','where','add','day','filter','map','merge','options','includeAll','rows','catch','show','params','intersection','find','create','body','update','describe','fast-json-patch','request-promise','path','sox','ejs','lodash','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject'];(function(_0x32793e,_0x12ca23){var _0x24a404=function(_0x47ddfc){while(--_0x47ddfc){_0x32793e['push'](_0x32793e['shift']());}};_0x24a404(++_0x12ca23);}(_0xaba6,0xe2));var _0x6aba=function(_0x4c62af,_0x234da8){_0x4c62af=_0x4c62af-0x0;var _0x3d8c6d=_0xaba6[_0x4c62af];return _0x3d8c6d;};'use strict';var jsonpatch=require(_0x6aba('0x0'));var rp=require(_0x6aba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6aba('0x2'));var sox=require(_0x6aba('0x3'));var csv=require('to-csv');var ejs=require(_0x6aba('0x4'));var fs=require('fs');var _=require(_0x6aba('0x5'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6aba('0x6'));var toCsv=require('to-csv');var querystring=require(_0x6aba('0x7'));var Papa=require(_0x6aba('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x6aba('0x9'))(_0x6aba('0xa'));var utils=require('../../config/utils');var config=require(_0x6aba('0xb'));var db=require(_0x6aba('0xc'))['db'];function respondWithStatusCode(_0x1a2dcc,_0x1a04c3){_0x1a04c3=_0x1a04c3||0xcc;return function(_0xdbc119){if(_0xdbc119){return _0x1a2dcc[_0x6aba('0xd')](_0x1a04c3);}return _0x1a2dcc[_0x6aba('0xe')](_0x1a04c3)['end']();};}function respondWithResult(_0x3e7c1a,_0x158935){_0x158935=_0x158935||0xc8;return function(_0x43867b){if(_0x43867b){return _0x3e7c1a[_0x6aba('0xe')](_0x158935)['json'](_0x43867b);}};}function respondWithFilteredResult(_0x313529,_0xcb8096){return function(_0x4cad26){if(_0x4cad26){var _0x123575=_0x4cad26[_0x6aba('0xf')],_0x2934c3=_0xcb8096[_0x6aba('0x10')],_0x252574=_0xcb8096[_0x6aba('0x10')]+_0xcb8096['limit'],_0x515272;if(_0x252574>=_0x123575){_0x252574=_0x123575;_0x515272=0xc8;}else{_0x515272=0xce;}_0x313529[_0x6aba('0xe')](_0x515272);return _0x313529[_0x6aba('0x11')](_0x6aba('0x12'),_0x2934c3+'-'+_0x252574+'/'+_0x123575)[_0x6aba('0x13')](_0x4cad26);}return null;};}function patchUpdates(_0x379b17){return function(_0x26c91d){try{jsonpatch[_0x6aba('0x14')](_0x26c91d,_0x379b17,!![]);}catch(_0x564827){return BPromise[_0x6aba('0x15')](_0x564827);}return _0x26c91d[_0x6aba('0x16')]();};}function saveUpdates(_0x1c2efe,_0x5ca5b2){return function(_0x1d6ad4){if(_0x1d6ad4){return _0x1d6ad4['update'](_0x1c2efe)['then'](function(_0x23762e){return _0x23762e;});}return null;};}function removeEntity(_0x593bd7,_0x1f4a95){return function(_0x1881ae){if(_0x1881ae){return _0x1881ae[_0x6aba('0x17')]()[_0x6aba('0x18')](function(){_0x593bd7[_0x6aba('0xe')](0xcc)[_0x6aba('0x19')]();});}};}function handleEntityNotFound(_0x362a10,_0x5953f2){return function(_0x2e5f65){if(!_0x2e5f65){_0x362a10[_0x6aba('0xd')](0x194);}return _0x2e5f65;};}function handleError(_0x41744c,_0x3dc85b){_0x3dc85b=_0x3dc85b||0x1f4;return function(_0x3f1412){logger[_0x6aba('0x1a')](_0x3f1412[_0x6aba('0x1b')]);if(_0x3f1412[_0x6aba('0x1c')]){delete _0x3f1412[_0x6aba('0x1c')];}_0x41744c[_0x6aba('0xe')](_0x3dc85b)[_0x6aba('0x1d')](_0x3f1412);};}exports[_0x6aba('0x1e')]=function(_0x24d1ad,_0x3aafa3){var _0xcba6d4={},_0xb947da={},_0x74ac4a={'count':0x0,'rows':[]};var _0x2f7cdd=db[_0x6aba('0x1f')]['rawAttributes'];_0xb947da['model']=_[_0x6aba('0x20')](_0x2f7cdd);var _0x5b0845={'dateStart':_0x24d1ad[_0x6aba('0x21')][_0x6aba('0x22')],'dateEnd':_0x24d1ad[_0x6aba('0x21')][_0x6aba('0x23')]};delete _0x24d1ad['query'][_0x6aba('0x22')];delete _0x24d1ad[_0x6aba('0x21')][_0x6aba('0x23')];_0xb947da[_0x6aba('0x21')]=_[_0x6aba('0x20')](_0x24d1ad['query']);_0xb947da[_0x6aba('0x24')]=_['intersection'](_0xb947da[_0x6aba('0x25')],_0xb947da[_0x6aba('0x21')]);_0xcba6d4['attributes']=_['intersection'](_0xb947da[_0x6aba('0x25')],qs[_0x6aba('0x26')](_0x24d1ad[_0x6aba('0x21')][_0x6aba('0x26')]));_0xcba6d4[_0x6aba('0x27')]=_0xcba6d4[_0x6aba('0x27')][_0x6aba('0x28')]?_0xcba6d4['attributes']:_0xb947da[_0x6aba('0x25')];if(!_0x24d1ad[_0x6aba('0x21')][_0x6aba('0x29')]('nolimit')){_0xcba6d4[_0x6aba('0x2a')]=qs[_0x6aba('0x2a')](_0x24d1ad[_0x6aba('0x21')]['limit']);_0xcba6d4[_0x6aba('0x10')]=qs[_0x6aba('0x10')](_0x24d1ad['query'][_0x6aba('0x10')]);}_0xcba6d4['order']=qs[_0x6aba('0x2b')](_0x24d1ad['query'][_0x6aba('0x2b')]);_0xcba6d4[_0x6aba('0x2c')]=qs['filters'](_['pick'](_0x24d1ad[_0x6aba('0x21')],_0xb947da['filters']));if(_0x5b0845[_0x6aba('0x22')]){if(_0x5b0845[_0x6aba('0x23')]){_0x5b0845['dateEnd']=moment(_0x5b0845[_0x6aba('0x23')])[_0x6aba('0x2d')](0x1,_0x6aba('0x2e'));}else{_0x5b0845[_0x6aba('0x23')]=moment(_0x5b0845[_0x6aba('0x22')])[_0x6aba('0x2d')](0x1,_0x6aba('0x2e'));}_['merge'](_0xcba6d4['where'],{'createdAt':{'$gte':_0x5b0845[_0x6aba('0x22')],'$lte':_0x5b0845['dateEnd']}});}if(_0x24d1ad[_0x6aba('0x21')][_0x6aba('0x2f')]){_0xcba6d4[_0x6aba('0x2c')]=_['merge'](_0xcba6d4[_0x6aba('0x2c')],{'$or':_[_0x6aba('0x30')](_0xcba6d4[_0x6aba('0x27')],function(_0x406874){var _0x1bd3f3={};_0x1bd3f3[_0x406874]={'$like':'%'+_0x24d1ad[_0x6aba('0x21')][_0x6aba('0x2f')]+'%'};return _0x1bd3f3;})});}_0xcba6d4=_[_0x6aba('0x31')]({},_0xcba6d4,_0x24d1ad[_0x6aba('0x32')]);var _0x550d00={'where':_0xcba6d4[_0x6aba('0x2c')]};return db[_0x6aba('0x1f')][_0x6aba('0xf')](_0x550d00)[_0x6aba('0x18')](function(_0x4c485b){_0x74ac4a[_0x6aba('0xf')]=_0x4c485b;if(_0x24d1ad['query'][_0x6aba('0x33')]){_0xcba6d4['include']=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0xcba6d4);})[_0x6aba('0x18')](function(_0x5a8b22){_0x74ac4a[_0x6aba('0x34')]=_0x5a8b22;return _0x74ac4a;})[_0x6aba('0x18')](respondWithFilteredResult(_0x3aafa3,_0xcba6d4))[_0x6aba('0x35')](handleError(_0x3aafa3,null));};exports[_0x6aba('0x36')]=function(_0x3303c2,_0x474396){var _0x29aaa7={'raw':![],'where':{'id':_0x3303c2[_0x6aba('0x37')]['id']}},_0x5cfea2={};_0x5cfea2[_0x6aba('0x25')]=_[_0x6aba('0x20')](db['VoiceAgentReport']['rawAttributes']);_0x5cfea2[_0x6aba('0x21')]=_[_0x6aba('0x20')](_0x3303c2[_0x6aba('0x21')]);_0x5cfea2[_0x6aba('0x24')]=_[_0x6aba('0x38')](_0x5cfea2['model'],_0x5cfea2[_0x6aba('0x21')]);_0x29aaa7[_0x6aba('0x27')]=_[_0x6aba('0x38')](_0x5cfea2[_0x6aba('0x25')],qs[_0x6aba('0x26')](_0x3303c2[_0x6aba('0x21')][_0x6aba('0x26')]));_0x29aaa7['attributes']=_0x29aaa7[_0x6aba('0x27')][_0x6aba('0x28')]?_0x29aaa7[_0x6aba('0x27')]:_0x5cfea2[_0x6aba('0x25')];if(_0x3303c2[_0x6aba('0x21')][_0x6aba('0x33')]){_0x29aaa7['include']=[{'all':!![]}];}_0x29aaa7=_[_0x6aba('0x31')]({},_0x29aaa7,_0x3303c2['options']);return db['VoiceAgentReport'][_0x6aba('0x39')](_0x29aaa7)[_0x6aba('0x18')](handleEntityNotFound(_0x474396,null))[_0x6aba('0x18')](respondWithResult(_0x474396,null))[_0x6aba('0x35')](handleError(_0x474396,null));};exports[_0x6aba('0x3a')]=function(_0x3a659f,_0x439467){return db[_0x6aba('0x1f')][_0x6aba('0x3a')](_0x3a659f[_0x6aba('0x3b')],{})['then'](respondWithResult(_0x439467,0xc9))[_0x6aba('0x35')](handleError(_0x439467,null));};exports[_0x6aba('0x3c')]=function(_0xbb902,_0xee64df){if(_0xbb902[_0x6aba('0x3b')]['id']){delete _0xbb902[_0x6aba('0x3b')]['id'];}return db[_0x6aba('0x1f')][_0x6aba('0x39')]({'where':{'id':_0xbb902[_0x6aba('0x37')]['id']}})[_0x6aba('0x18')](handleEntityNotFound(_0xee64df,null))[_0x6aba('0x18')](saveUpdates(_0xbb902[_0x6aba('0x3b')],null))[_0x6aba('0x18')](respondWithResult(_0xee64df,null))['catch'](handleError(_0xee64df,null));};exports[_0x6aba('0x17')]=function(_0x81e284,_0xafc50e){return db['VoiceAgentReport'][_0x6aba('0x39')]({'where':{'id':_0x81e284['params']['id']}})['then'](handleEntityNotFound(_0xafc50e,null))[_0x6aba('0x18')](removeEntity(_0xafc50e,null))[_0x6aba('0x35')](handleError(_0xafc50e,null));};exports[_0x6aba('0x3d')]=function(_0x558089,_0x2dcce1){return db[_0x6aba('0x1f')][_0x6aba('0x3d')]()[_0x6aba('0x18')](respondWithResult(_0x2dcce1,null))[_0x6aba('0x35')](handleError(_0x2dcce1,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 35a01e9..21bf651 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 _0x86fd=['define','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceAgentReport.attributes','exports'];(function(_0x2a78d9,_0x271b92){var _0x293145=function(_0x164b12){while(--_0x164b12){_0x2a78d9['push'](_0x2a78d9['shift']());}};_0x293145(++_0x271b92);}(_0x86fd,0xd4));var _0xd86f=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x86fd[_0x132d12];return _0x1c3163;};'use strict';var _=require(_0xd86f('0x0'));var util=require(_0xd86f('0x1'));var logger=require(_0xd86f('0x2'))(_0xd86f('0x3'));var moment=require(_0xd86f('0x4'));var BPromise=require(_0xd86f('0x5'));var rp=require(_0xd86f('0x6'));var attributes=require(_0xd86f('0x7'));module[_0xd86f('0x8')]=function(_0x4d0539,_0x58065a){return _0x4d0539[_0xd86f('0x9')]('VoiceAgentReport',attributes,{'tableName':_0xd86f('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd86f('0xb'),_0xd86f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67f9=['uniqueid','destuniqueid','lodash','../../config/logger','bluebird','request-promise','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent'];(function(_0x286e06,_0x2f5528){var _0x30dcac=function(_0x51bd13){while(--_0x51bd13){_0x286e06['push'](_0x286e06['shift']());}};_0x30dcac(++_0x2f5528);}(_0x67f9,0x8e));var _0x967f=function(_0x457b9a,_0x22625f){_0x457b9a=_0x457b9a-0x0;var _0x4260ef=_0x67f9[_0x457b9a];return _0x4260ef;};'use strict';var _=require(_0x967f('0x0'));var util=require('util');var logger=require(_0x967f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x967f('0x2'));var rp=require(_0x967f('0x3'));var attributes=require(_0x967f('0x4'));module['exports']=function(_0x4effcb,_0x2d4cdb){return _0x4effcb[_0x967f('0x5')](_0x967f('0x6'),attributes,{'tableName':_0x967f('0x7'),'paranoid':![],'indexes':[{'fields':[_0x967f('0x8'),_0x967f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5c7703a..68e5555 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 _0x9957=['jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateVoiceAgentReport','body','raw','then','stringify','catch','UpdateVoiceAgentReport','VoiceAgentReport','options','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 db=require(_0x7995('0x4'))['db'];var utils=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var jayson=require(_0x7995('0x8'));var client=jayson[_0x7995('0x9')][_0x7995('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219534,_0xbda126,_0x326741){return new BPromise(function(_0x4996ca,_0x465276){return client[_0x7995('0xb')](_0x219534,_0x326741)['then'](function(_0xa2e5f0){logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));logger[_0x7995('0xf')](_0x7995('0x10'),_0xbda126,_0x7995('0xe'),JSON['stringify'](_0xa2e5f0));if(_0xa2e5f0[_0x7995('0x11')]){if(_0xa2e5f0[_0x7995('0x11')]['code']===0x1f4){logger[_0x7995('0x11')](_0x7995('0xd'),_0xbda126,_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);return _0x465276(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}logger[_0x7995('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0xbda126,_0xa2e5f0['error'][_0x7995('0x12')]);return _0x4996ca(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}else{logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));_0x4996ca(_0xa2e5f0[_0x7995('0x13')][_0x7995('0x12')]);}})['catch'](function(_0x2eeacc){logger['error'](_0x7995('0xd'),_0xbda126,_0x2eeacc);_0x465276(_0x2eeacc);});});}exports[_0x7995('0x14')]=function(_0x43d4b8){var _0x291317=this;return new Promise(function(_0x1e1415,_0x37a7d4){return db['VoiceAgentReport']['create'](_0x43d4b8[_0x7995('0x15')],{'raw':_0x43d4b8['options']?_0x43d4b8['options'][_0x7995('0x16')]===undefined?!![]:![]:!![]})[_0x7995('0x17')](function(_0x4cbe10){logger[_0x7995('0xc')]('CreateVoiceAgentReport',_0x43d4b8);logger['debug'](_0x7995('0x14'),_0x43d4b8,JSON[_0x7995('0x18')](_0x4cbe10));_0x1e1415(_0x4cbe10);})[_0x7995('0x19')](function(_0x1a8568){logger[_0x7995('0x11')](_0x7995('0x14'),_0x1a8568['message'],_0x43d4b8);_0x37a7d4(_0x291317[_0x7995('0x11')](0x1f4,_0x1a8568[_0x7995('0x12')]));});});};exports[_0x7995('0x1a')]=function(_0x285437){var _0x563799=this;return new Promise(function(_0x13bc35,_0x475351){return db[_0x7995('0x1b')]['update'](_0x285437[_0x7995('0x15')],{'raw':_0x285437[_0x7995('0x1c')]?_0x285437[_0x7995('0x1c')][_0x7995('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285437[_0x7995('0x1c')]?_0x285437[_0x7995('0x1c')]['where']||null:null,'attributes':_0x285437[_0x7995('0x1c')]?_0x285437['options'][_0x7995('0x1d')]||null:null,'limit':_0x285437[_0x7995('0x1c')]?_0x285437[_0x7995('0x1c')][_0x7995('0x1e')]||null:null})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0xc')]('UpdateVoiceAgentReport',_0x285437);logger[_0x7995('0xf')](_0x7995('0x1a'),_0x285437,JSON[_0x7995('0x18')](_0x4b6f99));_0x13bc35(_0x4b6f99);})['catch'](function(_0x530611){logger['error'](_0x7995('0x1a'),_0x530611[_0x7995('0x12')],_0x285437);_0x475351(_0x563799[_0x7995('0x11')](0x1f4,_0x530611[_0x7995('0x12')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','stringify','UpdateVoiceAgentReport','update','attributes','limit','debug','lodash','util'];(function(_0x207b91,_0xbb1574){var _0x4391ee=function(_0x1a25b4){while(--_0x1a25b4){_0x207b91['push'](_0x207b91['shift']());}};_0x4391ee(++_0xbb1574);}(_0x7a54,0x106));var _0x47a5=function(_0x440609,_0x6161a8){_0x440609=_0x440609-0x0;var _0x164fd5=_0x7a54[_0x440609];return _0x164fd5;};'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 db=require(_0x47a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var jayson=require(_0x47a5('0x8'));var client=jayson[_0x47a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5629,_0x59199c,_0x343372){return new BPromise(function(_0x30e405,_0x506eda){return client[_0x47a5('0xa')](_0x3d5629,_0x343372)['then'](function(_0x5d90b3){logger['info'](_0x47a5('0xb'),_0x59199c,_0x47a5('0xc'));logger['debug'](_0x47a5('0xd'),_0x59199c,'request\x20sent',JSON['stringify'](_0x5d90b3));if(_0x5d90b3[_0x47a5('0xe')]){if(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0xf')]===0x1f4){logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x506eda(_0x5d90b3['error'][_0x47a5('0x10')]);}logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x30e405(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);}else{logger[_0x47a5('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x59199c,_0x47a5('0xc'));_0x30e405(_0x5d90b3[_0x47a5('0x12')][_0x47a5('0x10')]);}})[_0x47a5('0x13')](function(_0x1ef44c){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x59199c,_0x1ef44c);_0x506eda(_0x1ef44c);});});}exports[_0x47a5('0x14')]=function(_0x4b966e){var _0x5247fd=this;return new Promise(function(_0x423a81,_0xaf70a6){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x4b966e[_0x47a5('0x17')],{'raw':_0x4b966e[_0x47a5('0x18')]?_0x4b966e[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})[_0x47a5('0x1a')](function(_0x4a9fcb){logger[_0x47a5('0x11')](_0x47a5('0x14'),_0x4b966e);logger['debug'](_0x47a5('0x14'),_0x4b966e,JSON[_0x47a5('0x1b')](_0x4a9fcb));_0x423a81(_0x4a9fcb);})[_0x47a5('0x13')](function(_0x4c5910){logger[_0x47a5('0xe')](_0x47a5('0x14'),_0x4c5910[_0x47a5('0x10')],_0x4b966e);_0xaf70a6(_0x5247fd[_0x47a5('0xe')](0x1f4,_0x4c5910['message']));});});};exports[_0x47a5('0x1c')]=function(_0x385687){var _0x513981=this;return new Promise(function(_0x28747d,_0xc4cd63){return db[_0x47a5('0x15')][_0x47a5('0x1d')](_0x385687[_0x47a5('0x17')],{'raw':_0x385687['options']?_0x385687['options'][_0x47a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385687['options']?_0x385687[_0x47a5('0x18')]['where']||null:null,'attributes':_0x385687[_0x47a5('0x18')]?_0x385687[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x385687[_0x47a5('0x18')]?_0x385687[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x1a')](function(_0x136b14){logger[_0x47a5('0x11')](_0x47a5('0x1c'),_0x385687);logger[_0x47a5('0x20')](_0x47a5('0x1c'),_0x385687,JSON[_0x47a5('0x1b')](_0x136b14));_0x28747d(_0x136b14);})['catch'](function(_0x243210){logger['error'](_0x47a5('0x1c'),_0x243210[_0x47a5('0x10')],_0x385687);_0xc4cd63(_0x513981[_0x47a5('0xe')](0x1f4,_0x243210['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d43778d..b4604d6 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 _0xd61e=['create','put','update','delete','destroy','exports','multer','express','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x12049c,_0x3c57e9){var _0x179df8=function(_0x4188a8){while(--_0x4188a8){_0x12049c['push'](_0x12049c['shift']());}};_0x179df8(++_0x3c57e9);}(_0xd61e,0x138));var _0xed61=function(_0x46ed8d,_0x48daff){_0x46ed8d=_0x46ed8d-0x0;var _0x69ef65=_0xd61e[_0x46ed8d];return _0x69ef65;};'use strict';var multer=require(_0xed61('0x0'));var util=require('util');var path=require('path');var express=require(_0xed61('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xed61('0x2'));var config=require(_0xed61('0x3'));var controller=require(_0xed61('0x4'));router[_0xed61('0x5')]('/',auth[_0xed61('0x6')](),controller[_0xed61('0x7')]);router[_0xed61('0x5')](_0xed61('0x8'),auth[_0xed61('0x6')](),controller[_0xed61('0x9')]);router[_0xed61('0x5')](_0xed61('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xed61('0xb')]('/',auth[_0xed61('0x6')](),controller[_0xed61('0xc')]);router[_0xed61('0xd')](_0xed61('0xa'),auth['isAuthenticated'](),controller[_0xed61('0xe')]);router[_0xed61('0xf')](_0xed61('0xa'),auth[_0xed61('0x6')](),controller[_0xed61('0x10')]);module[_0xed61('0x11')]=router; \ No newline at end of file +var _0x351f=['post','create','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/:id'];(function(_0xbcd604,_0x5c6862){var _0x16a71e=function(_0xa68500){while(--_0xa68500){_0xbcd604['push'](_0xbcd604['shift']());}};_0x16a71e(++_0x5c6862);}(_0x351f,0x18d));var _0xf351=function(_0x4f4065,_0x394aeb){_0x4f4065=_0x4f4065-0x0;var _0x320534=_0x351f[_0x4f4065];return _0x320534;};'use strict';var multer=require(_0xf351('0x0'));var util=require('util');var path=require(_0xf351('0x1'));var express=require(_0xf351('0x2'));var router=express[_0xf351('0x3')]();var auth=require(_0xf351('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf351('0x5'));var controller=require(_0xf351('0x6'));router[_0xf351('0x7')]('/',auth[_0xf351('0x8')](),controller[_0xf351('0x9')]);router[_0xf351('0x7')]('/describe',auth[_0xf351('0x8')](),controller['describe']);router[_0xf351('0x7')](_0xf351('0xa'),auth[_0xf351('0x8')](),controller['show']);router[_0xf351('0xb')]('/',auth[_0xf351('0x8')](),controller[_0xf351('0xc')]);router[_0xf351('0xd')]('/:id',auth[_0xf351('0x8')](),controller[_0xf351('0xe')]);router[_0xf351('0xf')]('/:id',auth[_0xf351('0x8')](),controller[_0xf351('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 1a51d0b..d12e2a4 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 _0x8c39=['ENUM','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING'];(function(_0x200713,_0x289d85){var _0x56c39a=function(_0x468481){while(--_0x468481){_0x200713['push'](_0x200713['shift']());}};_0x56c39a(++_0x289d85);}(_0x8c39,0x1ca));var _0x98c3=function(_0x563b0b,_0x2de539){_0x563b0b=_0x563b0b-0x0;var _0x1ef374=_0x8c39[_0x563b0b];return _0x1ef374;};'use strict';var Sequelize=require(_0x98c3('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x98c3('0x1')]},'type':{'type':Sequelize[_0x98c3('0x2')]('inbound',_0x98c3('0x3'),'outbound',_0x98c3('0x4'),_0x98c3('0x5'),_0x98c3('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x98c3('0x1')]},'destination':{'type':Sequelize[_0x98c3('0x1')]},'destinationcontext':{'type':Sequelize[_0x98c3('0x1')]},'callerid':{'type':Sequelize[_0x98c3('0x1')]},'channel':{'type':Sequelize[_0x98c3('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x98c3('0x7')]},'starttime':{'type':Sequelize[_0x98c3('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x98c3('0x8')]},'duration':{'type':Sequelize[_0x98c3('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x98c3('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x98c3('0x1')]},'amaflags':{'type':Sequelize[_0x98c3('0x1')]},'userfield':{'type':Sequelize[_0x98c3('0x1')]},'userDisposition':{'type':Sequelize[_0x98c3('0x1')]},'note':{'type':Sequelize[_0x98c3('0x1')]},'prefix':{'type':Sequelize[_0x98c3('0x1')]},'routeid':{'type':Sequelize[_0x98c3('0x9')]}}; \ No newline at end of file +var _0x75e9=['DATE','INTEGER','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x44c01c,_0x461938){var _0x35f154=function(_0x4eb730){while(--_0x4eb730){_0x44c01c['push'](_0x44c01c['shift']());}};_0x35f154(++_0x461938);}(_0x75e9,0x120));var _0x975e=function(_0x431fb9,_0x2fd25b){_0x431fb9=_0x431fb9-0x0;var _0xa94562=_0x75e9[_0x431fb9];return _0xa94562;};'use strict';var Sequelize=require('sequelize');module[_0x975e('0x0')]={'uniqueid':{'type':Sequelize[_0x975e('0x1')]},'type':{'type':Sequelize['ENUM'](_0x975e('0x2'),_0x975e('0x3'),_0x975e('0x4'),_0x975e('0x5'),_0x975e('0x6'),_0x975e('0x7'))},'tag':{'type':Sequelize[_0x975e('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x975e('0x1')]},'destination':{'type':Sequelize[_0x975e('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x975e('0x1')]},'channel':{'type':Sequelize[_0x975e('0x1')]},'destinationchannel':{'type':Sequelize[_0x975e('0x1')]},'lastapplication':{'type':Sequelize[_0x975e('0x1')]},'lastdata':{'type':Sequelize[_0x975e('0x8')]},'starttime':{'type':Sequelize[_0x975e('0x9')]},'answertime':{'type':Sequelize[_0x975e('0x9')]},'endtime':{'type':Sequelize[_0x975e('0x9')]},'duration':{'type':Sequelize[_0x975e('0xa')]},'billableseconds':{'type':Sequelize[_0x975e('0xa')]},'mohtime':{'type':Sequelize[_0x975e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x975e('0x1')]},'amaflags':{'type':Sequelize[_0x975e('0x1')]},'userfield':{'type':Sequelize[_0x975e('0x1')]},'userDisposition':{'type':Sequelize[_0x975e('0x1')]},'note':{'type':Sequelize[_0x975e('0x1')]},'prefix':{'type':Sequelize[_0x975e('0x1')]},'routeid':{'type':Sequelize[_0x975e('0xa')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8638b64..ae4dae5 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 _0xfa47=['fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','set','Content-Range','apply','save','then','destroy','name','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','filters','pick','add','day','filter','merge','options','VoiceCallReport','count','alias','User','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','describe','update','uniqueid','user'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xfa47,0x19e));var _0x7fa4=function(_0x2cbd58,_0x278e75){_0x2cbd58=_0x2cbd58-0x0;var _0x42ef2a=_0xfa47[_0x2cbd58];return _0x42ef2a;};'use strict';var jsonpatch=require(_0x7fa4('0x0'));var rp=require(_0x7fa4('0x1'));var moment=require(_0x7fa4('0x2'));var BPromise=require(_0x7fa4('0x3'));var Mustache=require(_0x7fa4('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7fa4('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7fa4('0x6'));var squel=require('squel');var crypto=require(_0x7fa4('0x7'));var jsforce=require(_0x7fa4('0x8'));var deskjs=require(_0x7fa4('0x9'));var toCsv=require(_0x7fa4('0x5'));var querystring=require(_0x7fa4('0xa'));var Papa=require('papaparse');var qs=require(_0x7fa4('0xb'));var logger=require(_0x7fa4('0xc'))(_0x7fa4('0xd'));var utils=require(_0x7fa4('0xe'));var config=require(_0x7fa4('0xf'));var db=require(_0x7fa4('0x10'))['db'];function respondWithStatusCode(_0x183c1a,_0x51098d){_0x51098d=_0x51098d||0xcc;return function(_0x18b9d8){if(_0x18b9d8){return _0x183c1a[_0x7fa4('0x11')](_0x51098d);}return _0x183c1a[_0x7fa4('0x12')](_0x51098d)[_0x7fa4('0x13')]();};}function respondWithResult(_0x101fcd,_0x36935e){_0x36935e=_0x36935e||0xc8;return function(_0x178041){if(_0x178041){return _0x101fcd[_0x7fa4('0x12')](_0x36935e)[_0x7fa4('0x14')](_0x178041);}};}function respondWithFilteredResult(_0x1096bf,_0x2fd475){return function(_0x287c00){if(_0x287c00){var _0x1396cd=_0x287c00['count'],_0x45588c=_0x2fd475['offset'],_0x372aa0=_0x2fd475['offset']+_0x2fd475['limit'],_0xe19e6f;if(_0x372aa0>=_0x1396cd){_0x372aa0=_0x1396cd;_0xe19e6f=0xc8;}else{_0xe19e6f=0xce;}_0x1096bf[_0x7fa4('0x12')](_0xe19e6f);return _0x1096bf[_0x7fa4('0x15')](_0x7fa4('0x16'),_0x45588c+'-'+_0x372aa0+'/'+_0x1396cd)[_0x7fa4('0x14')](_0x287c00);}return null;};}function patchUpdates(_0x115472){return function(_0x47877a){try{jsonpatch[_0x7fa4('0x17')](_0x47877a,_0x115472,!![]);}catch(_0x229406){return BPromise['reject'](_0x229406);}return _0x47877a[_0x7fa4('0x18')]();};}function saveUpdates(_0x126284,_0x479a74){return function(_0x52248f){if(_0x52248f){return _0x52248f['update'](_0x126284)[_0x7fa4('0x19')](function(_0x429387){return _0x429387;});}return null;};}function removeEntity(_0x56f8f8,_0xf5e8f0){return function(_0x12648c){if(_0x12648c){return _0x12648c[_0x7fa4('0x1a')]()[_0x7fa4('0x19')](function(){_0x56f8f8[_0x7fa4('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2243,_0x4e75ad){return function(_0xb190d){if(!_0xb190d){_0x5b2243[_0x7fa4('0x11')](0x194);}return _0xb190d;};}function handleError(_0xd1e151,_0x4fee10){_0x4fee10=_0x4fee10||0x1f4;return function(_0xe4b335){logger['error'](_0xe4b335['stack']);if(_0xe4b335[_0x7fa4('0x1b')]){delete _0xe4b335[_0x7fa4('0x1b')];}_0xd1e151[_0x7fa4('0x12')](_0x4fee10)['send'](_0xe4b335);};}exports['index']=function(_0x17ab36,_0x2979ad){var _0x4d55b5={},_0xbef194={},_0x1287ed={'count':0x0,'rows':[]};var _0x1ebc4a=db['VoiceCallReport'][_0x7fa4('0x1c')];_0xbef194[_0x7fa4('0x1d')]=_[_0x7fa4('0x1e')](_0x1ebc4a);var _0x16261e={'dateStart':_0x17ab36[_0x7fa4('0x1f')][_0x7fa4('0x20')],'dateEnd':_0x17ab36[_0x7fa4('0x1f')][_0x7fa4('0x21')]};delete _0x17ab36[_0x7fa4('0x1f')][_0x7fa4('0x20')];delete _0x17ab36[_0x7fa4('0x1f')]['dateEnd'];_0xbef194[_0x7fa4('0x1f')]=_[_0x7fa4('0x1e')](_0x17ab36['query']);_0xbef194['filters']=_[_0x7fa4('0x22')](_0xbef194[_0x7fa4('0x1d')],_0xbef194[_0x7fa4('0x1f')]);_0x4d55b5['attributes']=_[_0x7fa4('0x22')](_0xbef194[_0x7fa4('0x1d')],qs[_0x7fa4('0x23')](_0x17ab36['query'][_0x7fa4('0x23')]));_0x4d55b5[_0x7fa4('0x24')]=_0x4d55b5[_0x7fa4('0x24')]['length']?_0x4d55b5[_0x7fa4('0x24')]:_0xbef194[_0x7fa4('0x1d')];if(!_0x17ab36[_0x7fa4('0x1f')][_0x7fa4('0x25')](_0x7fa4('0x26'))){_0x4d55b5[_0x7fa4('0x27')]=qs[_0x7fa4('0x27')](_0x17ab36[_0x7fa4('0x1f')][_0x7fa4('0x27')]);_0x4d55b5[_0x7fa4('0x28')]=qs[_0x7fa4('0x28')](_0x17ab36[_0x7fa4('0x1f')]['offset']);}_0x4d55b5['order']=qs[_0x7fa4('0x29')](_0x17ab36[_0x7fa4('0x1f')]['sort']);_0x4d55b5[_0x7fa4('0x2a')]=qs[_0x7fa4('0x2b')](_[_0x7fa4('0x2c')](_0x17ab36['query'],_0xbef194[_0x7fa4('0x2b')]));if(_0x16261e['dateStart']){if(_0x16261e[_0x7fa4('0x21')]){_0x16261e['dateEnd']=moment(_0x16261e[_0x7fa4('0x21')])[_0x7fa4('0x2d')](0x1,_0x7fa4('0x2e'));}else{_0x16261e[_0x7fa4('0x21')]=moment(_0x16261e[_0x7fa4('0x20')])[_0x7fa4('0x2d')](0x1,_0x7fa4('0x2e'));}_['merge'](_0x4d55b5[_0x7fa4('0x2a')],{'createdAt':{'$gte':_0x16261e[_0x7fa4('0x20')],'$lte':_0x16261e[_0x7fa4('0x21')]}});}if(_0x17ab36[_0x7fa4('0x1f')][_0x7fa4('0x2f')]){_0x4d55b5[_0x7fa4('0x2a')]=_['merge'](_0x4d55b5['where'],{'$or':_['map'](_0x4d55b5['attributes'],function(_0x1b7e0d){var _0x168320={};_0x168320[_0x1b7e0d]={'$like':'%'+_0x17ab36[_0x7fa4('0x1f')][_0x7fa4('0x2f')]+'%'};return _0x168320;})});}_0x4d55b5=_[_0x7fa4('0x30')]({},_0x4d55b5,_0x17ab36[_0x7fa4('0x31')]);var _0x4cf764={'where':_0x4d55b5[_0x7fa4('0x2a')]};return db[_0x7fa4('0x32')][_0x7fa4('0x33')](_0x4cf764)[_0x7fa4('0x19')](function(_0x41cc79){_0x1287ed[_0x7fa4('0x33')]=_0x41cc79;if(_0x17ab36[_0x7fa4('0x1f')]['includeAll']){_0x4d55b5['include']=[{'attributes':['id',_0x7fa4('0x1b'),'fullname',_0x7fa4('0x34')],'model':db[_0x7fa4('0x35')],'as':_0x7fa4('0x35')}];}return db[_0x7fa4('0x32')][_0x7fa4('0x36')](_0x4d55b5);})['then'](function(_0x23d6ec){_0x1287ed[_0x7fa4('0x37')]=_0x23d6ec;return _0x1287ed;})[_0x7fa4('0x19')](respondWithFilteredResult(_0x2979ad,_0x4d55b5))[_0x7fa4('0x38')](handleError(_0x2979ad,null));};exports[_0x7fa4('0x39')]=function(_0x443586,_0x6cfab6){var _0x17a6e8={'raw':!![],'where':{'id':_0x443586[_0x7fa4('0x3a')]['id']}},_0x5e367d={};_0x5e367d[_0x7fa4('0x1d')]=_[_0x7fa4('0x1e')](db[_0x7fa4('0x32')][_0x7fa4('0x1c')]);_0x5e367d[_0x7fa4('0x1f')]=_[_0x7fa4('0x1e')](_0x443586[_0x7fa4('0x1f')]);_0x5e367d[_0x7fa4('0x2b')]=_[_0x7fa4('0x22')](_0x5e367d[_0x7fa4('0x1d')],_0x5e367d[_0x7fa4('0x1f')]);_0x17a6e8[_0x7fa4('0x24')]=_[_0x7fa4('0x22')](_0x5e367d[_0x7fa4('0x1d')],qs[_0x7fa4('0x23')](_0x443586[_0x7fa4('0x1f')][_0x7fa4('0x23')]));_0x17a6e8[_0x7fa4('0x24')]=_0x17a6e8[_0x7fa4('0x24')][_0x7fa4('0x3b')]?_0x17a6e8[_0x7fa4('0x24')]:_0x5e367d[_0x7fa4('0x1d')];if(_0x443586[_0x7fa4('0x1f')][_0x7fa4('0x3c')]){_0x17a6e8[_0x7fa4('0x3d')]=[{'all':!![]}];}_0x17a6e8=_[_0x7fa4('0x30')]({},_0x17a6e8,_0x443586['options']);return db['VoiceCallReport'][_0x7fa4('0x3e')](_0x17a6e8)['then'](handleEntityNotFound(_0x6cfab6,null))[_0x7fa4('0x19')](respondWithResult(_0x6cfab6,null))[_0x7fa4('0x38')](handleError(_0x6cfab6,null));};exports[_0x7fa4('0x3f')]=function(_0x40c8ea,_0x231612){return db[_0x7fa4('0x32')]['create'](_0x40c8ea[_0x7fa4('0x40')],{})[_0x7fa4('0x19')](respondWithResult(_0x231612,0xc9))[_0x7fa4('0x38')](handleError(_0x231612,null));};exports['destroy']=function(_0x57b0a7,_0xd5fb41){return db['VoiceCallReport'][_0x7fa4('0x3e')]({'where':{'id':_0x57b0a7[_0x7fa4('0x3a')]['id']}})[_0x7fa4('0x19')](handleEntityNotFound(_0xd5fb41,null))[_0x7fa4('0x19')](removeEntity(_0xd5fb41,null))[_0x7fa4('0x38')](handleError(_0xd5fb41,null));};exports[_0x7fa4('0x41')]=function(_0x423232,_0x5c7491){return db[_0x7fa4('0x32')][_0x7fa4('0x41')]()[_0x7fa4('0x19')](respondWithResult(_0x5c7491,null))['catch'](handleError(_0x5c7491,null));};exports[_0x7fa4('0x42')]=function(_0x4902c0,_0x5b34f0){if(_0x4902c0[_0x7fa4('0x40')][_0x7fa4('0x43')]){delete _0x4902c0['body'][_0x7fa4('0x43')];}return db[_0x7fa4('0x32')][_0x7fa4('0x3e')]({'where':{'uniqueid':_0x4902c0[_0x7fa4('0x3a')]['id'],'UserId':{'$or':[null,_0x4902c0[_0x7fa4('0x44')]['id']]}}})[_0x7fa4('0x19')](handleEntityNotFound(_0x5b34f0,null))[_0x7fa4('0x19')](saveUpdates(_0x4902c0[_0x7fa4('0x40')],null))[_0x7fa4('0x19')](respondWithResult(_0x5b34f0,null))[_0x7fa4('0x38')](handleError(_0x5b34f0,null));}; \ No newline at end of file +var _0x2301=['reject','update','then','destroy','sendStatus','error','stack','name','keys','dateStart','query','dateEnd','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','VoiceCallReport','fullname','alias','findAll','rows','catch','show','params','model','length','includeAll','include','options','create','body','find','describe','uniqueid','user','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x2301,0x176));var _0x1230=function(_0x105a8e,_0x12dd9a){_0x105a8e=_0x105a8e-0x0;var _0x298729=_0x2301[_0x105a8e];return _0x298729;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x1230('0x0'));var moment=require(_0x1230('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1230('0x2'));var sox=require(_0x1230('0x3'));var csv=require(_0x1230('0x4'));var ejs=require(_0x1230('0x5'));var fs=require('fs');var _=require(_0x1230('0x6'));var squel=require(_0x1230('0x7'));var crypto=require(_0x1230('0x8'));var jsforce=require(_0x1230('0x9'));var deskjs=require(_0x1230('0xa'));var toCsv=require(_0x1230('0x4'));var querystring=require('querystring');var Papa=require(_0x1230('0xb'));var qs=require(_0x1230('0xc'));var logger=require('../../config/logger')(_0x1230('0xd'));var utils=require('../../config/utils');var config=require(_0x1230('0xe'));var db=require(_0x1230('0xf'))['db'];function respondWithStatusCode(_0x7ae1a2,_0xc16500){_0xc16500=_0xc16500||0xcc;return function(_0x3389a7){if(_0x3389a7){return _0x7ae1a2['sendStatus'](_0xc16500);}return _0x7ae1a2[_0x1230('0x10')](_0xc16500)[_0x1230('0x11')]();};}function respondWithResult(_0xd4ca52,_0x47b290){_0x47b290=_0x47b290||0xc8;return function(_0x438012){if(_0x438012){return _0xd4ca52['status'](_0x47b290)['json'](_0x438012);}};}function respondWithFilteredResult(_0xb2a70,_0x303331){return function(_0x130c96){if(_0x130c96){var _0x5c362a=_0x130c96[_0x1230('0x12')],_0x10d1cf=_0x303331['offset'],_0x5229ad=_0x303331[_0x1230('0x13')]+_0x303331[_0x1230('0x14')],_0x44b2ee;if(_0x5229ad>=_0x5c362a){_0x5229ad=_0x5c362a;_0x44b2ee=0xc8;}else{_0x44b2ee=0xce;}_0xb2a70[_0x1230('0x10')](_0x44b2ee);return _0xb2a70[_0x1230('0x15')]('Content-Range',_0x10d1cf+'-'+_0x5229ad+'/'+_0x5c362a)['json'](_0x130c96);}return null;};}function patchUpdates(_0x70eb2f){return function(_0x3879b2){try{jsonpatch['apply'](_0x3879b2,_0x70eb2f,!![]);}catch(_0x265832){return BPromise[_0x1230('0x16')](_0x265832);}return _0x3879b2['save']();};}function saveUpdates(_0x12a957,_0x10c135){return function(_0x40c37e){if(_0x40c37e){return _0x40c37e[_0x1230('0x17')](_0x12a957)[_0x1230('0x18')](function(_0x31aa55){return _0x31aa55;});}return null;};}function removeEntity(_0x1b724b,_0x31b0af){return function(_0x1cbd7b){if(_0x1cbd7b){return _0x1cbd7b[_0x1230('0x19')]()['then'](function(){_0x1b724b['status'](0xcc)[_0x1230('0x11')]();});}};}function handleEntityNotFound(_0x44d143,_0x1e7c66){return function(_0x525a6d){if(!_0x525a6d){_0x44d143[_0x1230('0x1a')](0x194);}return _0x525a6d;};}function handleError(_0x2483be,_0x4ccbd0){_0x4ccbd0=_0x4ccbd0||0x1f4;return function(_0x5a07c4){logger[_0x1230('0x1b')](_0x5a07c4[_0x1230('0x1c')]);if(_0x5a07c4[_0x1230('0x1d')]){delete _0x5a07c4[_0x1230('0x1d')];}_0x2483be[_0x1230('0x10')](_0x4ccbd0)['send'](_0x5a07c4);};}exports['index']=function(_0x2a4da3,_0x2b8df6){var _0x4d987e={},_0x402c72={},_0x29d8e2={'count':0x0,'rows':[]};var _0x377105=db['VoiceCallReport']['rawAttributes'];_0x402c72['model']=_[_0x1230('0x1e')](_0x377105);var _0xc944d1={'dateStart':_0x2a4da3['query'][_0x1230('0x1f')],'dateEnd':_0x2a4da3[_0x1230('0x20')][_0x1230('0x21')]};delete _0x2a4da3[_0x1230('0x20')][_0x1230('0x1f')];delete _0x2a4da3[_0x1230('0x20')][_0x1230('0x21')];_0x402c72[_0x1230('0x20')]=_[_0x1230('0x1e')](_0x2a4da3[_0x1230('0x20')]);_0x402c72[_0x1230('0x22')]=_['intersection'](_0x402c72['model'],_0x402c72[_0x1230('0x20')]);_0x4d987e[_0x1230('0x23')]=_['intersection'](_0x402c72['model'],qs[_0x1230('0x24')](_0x2a4da3[_0x1230('0x20')][_0x1230('0x24')]));_0x4d987e[_0x1230('0x23')]=_0x4d987e[_0x1230('0x23')]['length']?_0x4d987e[_0x1230('0x23')]:_0x402c72['model'];if(!_0x2a4da3[_0x1230('0x20')][_0x1230('0x25')]('nolimit')){_0x4d987e[_0x1230('0x14')]=qs[_0x1230('0x14')](_0x2a4da3['query'][_0x1230('0x14')]);_0x4d987e[_0x1230('0x13')]=qs['offset'](_0x2a4da3[_0x1230('0x20')][_0x1230('0x13')]);}_0x4d987e[_0x1230('0x26')]=qs[_0x1230('0x27')](_0x2a4da3[_0x1230('0x20')]['sort']);_0x4d987e[_0x1230('0x28')]=qs[_0x1230('0x22')](_[_0x1230('0x29')](_0x2a4da3['query'],_0x402c72[_0x1230('0x22')]));if(_0xc944d1['dateStart']){if(_0xc944d1[_0x1230('0x21')]){_0xc944d1[_0x1230('0x21')]=moment(_0xc944d1[_0x1230('0x21')])[_0x1230('0x2a')](0x1,_0x1230('0x2b'));}else{_0xc944d1['dateEnd']=moment(_0xc944d1[_0x1230('0x1f')])['add'](0x1,_0x1230('0x2b'));}_[_0x1230('0x2c')](_0x4d987e[_0x1230('0x28')],{'createdAt':{'$gte':_0xc944d1[_0x1230('0x1f')],'$lte':_0xc944d1['dateEnd']}});}if(_0x2a4da3[_0x1230('0x20')][_0x1230('0x2d')]){_0x4d987e[_0x1230('0x28')]=_[_0x1230('0x2c')](_0x4d987e[_0x1230('0x28')],{'$or':_[_0x1230('0x2e')](_0x4d987e[_0x1230('0x23')],function(_0x31fa7d){var _0x356026={};_0x356026[_0x31fa7d]={'$like':'%'+_0x2a4da3[_0x1230('0x20')]['filter']+'%'};return _0x356026;})});}_0x4d987e=_[_0x1230('0x2c')]({},_0x4d987e,_0x2a4da3['options']);var _0x4da959={'where':_0x4d987e[_0x1230('0x28')]};return db[_0x1230('0x2f')][_0x1230('0x12')](_0x4da959)[_0x1230('0x18')](function(_0x270669){_0x29d8e2['count']=_0x270669;if(_0x2a4da3[_0x1230('0x20')]['includeAll']){_0x4d987e['include']=[{'attributes':['id','name',_0x1230('0x30'),_0x1230('0x31')],'model':db['User'],'as':'User'}];}return db[_0x1230('0x2f')][_0x1230('0x32')](_0x4d987e);})[_0x1230('0x18')](function(_0xcb262b){_0x29d8e2[_0x1230('0x33')]=_0xcb262b;return _0x29d8e2;})[_0x1230('0x18')](respondWithFilteredResult(_0x2b8df6,_0x4d987e))[_0x1230('0x34')](handleError(_0x2b8df6,null));};exports[_0x1230('0x35')]=function(_0x45b24f,_0x5a10f7){var _0x55d907={'raw':!![],'where':{'id':_0x45b24f[_0x1230('0x36')]['id']}},_0x435bbb={};_0x435bbb[_0x1230('0x37')]=_['keys'](db[_0x1230('0x2f')]['rawAttributes']);_0x435bbb[_0x1230('0x20')]=_[_0x1230('0x1e')](_0x45b24f[_0x1230('0x20')]);_0x435bbb['filters']=_['intersection'](_0x435bbb[_0x1230('0x37')],_0x435bbb['query']);_0x55d907['attributes']=_['intersection'](_0x435bbb[_0x1230('0x37')],qs['fields'](_0x45b24f[_0x1230('0x20')][_0x1230('0x24')]));_0x55d907[_0x1230('0x23')]=_0x55d907[_0x1230('0x23')][_0x1230('0x38')]?_0x55d907['attributes']:_0x435bbb[_0x1230('0x37')];if(_0x45b24f[_0x1230('0x20')][_0x1230('0x39')]){_0x55d907[_0x1230('0x3a')]=[{'all':!![]}];}_0x55d907=_[_0x1230('0x2c')]({},_0x55d907,_0x45b24f[_0x1230('0x3b')]);return db[_0x1230('0x2f')]['find'](_0x55d907)[_0x1230('0x18')](handleEntityNotFound(_0x5a10f7,null))['then'](respondWithResult(_0x5a10f7,null))['catch'](handleError(_0x5a10f7,null));};exports['create']=function(_0x3a910d,_0x27ddd1){return db['VoiceCallReport'][_0x1230('0x3c')](_0x3a910d[_0x1230('0x3d')],{})[_0x1230('0x18')](respondWithResult(_0x27ddd1,0xc9))[_0x1230('0x34')](handleError(_0x27ddd1,null));};exports['destroy']=function(_0x167d72,_0x185835){return db[_0x1230('0x2f')][_0x1230('0x3e')]({'where':{'id':_0x167d72[_0x1230('0x36')]['id']}})[_0x1230('0x18')](handleEntityNotFound(_0x185835,null))[_0x1230('0x18')](removeEntity(_0x185835,null))[_0x1230('0x34')](handleError(_0x185835,null));};exports[_0x1230('0x3f')]=function(_0x30d405,_0x582669){return db[_0x1230('0x2f')][_0x1230('0x3f')]()['then'](respondWithResult(_0x582669,null))[_0x1230('0x34')](handleError(_0x582669,null));};exports[_0x1230('0x17')]=function(_0x477041,_0x2b9f4f){if(_0x477041['body'][_0x1230('0x40')]){delete _0x477041['body'][_0x1230('0x40')];}return db[_0x1230('0x2f')][_0x1230('0x3e')]({'where':{'uniqueid':_0x477041[_0x1230('0x36')]['id'],'UserId':{'$or':[null,_0x477041[_0x1230('0x41')]['id']]}}})[_0x1230('0x18')](handleEntityNotFound(_0x2b9f4f,null))[_0x1230('0x18')](saveUpdates(_0x477041[_0x1230('0x3d')],null))['then'](respondWithResult(_0x2b9f4f,null))[_0x1230('0x34')](handleError(_0x2b9f4f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 121e22b..33c0288 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 _0x1a1b=['lodash','util','api','moment','bluebird','request-promise','exports','VoiceCallReport','report_call'];(function(_0x44dc9c,_0x233b92){var _0x30e98d=function(_0x5d86a1){while(--_0x5d86a1){_0x44dc9c['push'](_0x44dc9c['shift']());}};_0x30e98d(++_0x233b92);}(_0x1a1b,0x75));var _0xb1a1=function(_0x3b9859,_0x52b534){_0x3b9859=_0x3b9859-0x0;var _0x3bc080=_0x1a1b[_0x3b9859];return _0x3bc080;};'use strict';var _=require(_0xb1a1('0x0'));var util=require(_0xb1a1('0x1'));var logger=require('../../config/logger')(_0xb1a1('0x2'));var moment=require(_0xb1a1('0x3'));var BPromise=require(_0xb1a1('0x4'));var rp=require(_0xb1a1('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0xb1a1('0x6')]=function(_0x1b99ab,_0xe8e6f4){return _0x1b99ab['define'](_0xb1a1('0x7'),attributes,{'tableName':_0xb1a1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc393=['VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceCallReport.attributes','exports'];(function(_0x1e1fe9,_0x216dd9){var _0x4eeb06=function(_0x3c69c2){while(--_0x3c69c2){_0x1e1fe9['push'](_0x1e1fe9['shift']());}};_0x4eeb06(++_0x216dd9);}(_0xc393,0xd3));var _0x3c39=function(_0x32abf8,_0x3e0374){_0x32abf8=_0x32abf8-0x0;var _0x20bcdf=_0xc393[_0x32abf8];return _0x20bcdf;};'use strict';var _=require(_0x3c39('0x0'));var util=require(_0x3c39('0x1'));var logger=require(_0x3c39('0x2'))(_0x3c39('0x3'));var moment=require(_0x3c39('0x4'));var BPromise=require(_0x3c39('0x5'));var rp=require(_0x3c39('0x6'));var attributes=require(_0x3c39('0x7'));module[_0x3c39('0x8')]=function(_0xcc83ff,_0x41d6d6){return _0xcc83ff['define'](_0x3c39('0x9'),attributes,{'tableName':_0x3c39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 64742e5..8e77985 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 _0x9b65=['attributes','limit','map','model','include','then','info','GetVoiceCallReport','stringify','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','raw','options'];(function(_0x57022c,_0x1cc5d3){var _0x420c96=function(_0x172a7f){while(--_0x172a7f){_0x57022c['push'](_0x57022c['shift']());}};_0x420c96(++_0x1cc5d3);}(_0x9b65,0x177));var _0x59b6=function(_0xf29637,_0x3e44a4){_0xf29637=_0xf29637-0x0;var _0x5762fe=_0x9b65[_0xf29637];return _0x5762fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59b6('0x0'));var BPromise=require(_0x59b6('0x1'));var rs=require(_0x59b6('0x2'));var fs=require('fs');var db=require(_0x59b6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x59b6('0x4'))(_0x59b6('0x5'));var config=require(_0x59b6('0x6'));var jayson=require(_0x59b6('0x7'));var client=jayson[_0x59b6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a9d30,_0x3bf8ea,_0x541731){return new BPromise(function(_0x4b1ef9,_0xb5f5a5){return client['request'](_0x2a9d30,_0x541731)['then'](function(_0x2a7dff){logger['info'](_0x59b6('0x9'),_0x3bf8ea,_0x59b6('0xa'));logger[_0x59b6('0xb')](_0x59b6('0xc'),_0x3bf8ea,_0x59b6('0xa'),JSON['stringify'](_0x2a7dff));if(_0x2a7dff[_0x59b6('0xd')]){if(_0x2a7dff[_0x59b6('0xd')][_0x59b6('0xe')]===0x1f4){logger[_0x59b6('0xd')](_0x59b6('0x9'),_0x3bf8ea,_0x2a7dff['error'][_0x59b6('0xf')]);return _0xb5f5a5(_0x2a7dff[_0x59b6('0xd')]['message']);}logger[_0x59b6('0xd')](_0x59b6('0x9'),_0x3bf8ea,_0x2a7dff[_0x59b6('0xd')]['message']);return _0x4b1ef9(_0x2a7dff[_0x59b6('0xd')][_0x59b6('0xf')]);}else{logger['info'](_0x59b6('0x9'),_0x3bf8ea,'request\x20sent');_0x4b1ef9(_0x2a7dff[_0x59b6('0x10')][_0x59b6('0xf')]);}})[_0x59b6('0x11')](function(_0x2355fd){logger['error'](_0x59b6('0x9'),_0x3bf8ea,_0x2355fd);_0xb5f5a5(_0x2355fd);});});}exports['GetVoiceCallReport']=function(_0x409235){var _0x2ab8bb=this;return new Promise(function(_0x49ae68,_0x37bf21){return db['VoiceCallReport'][_0x59b6('0x12')]({'raw':_0x409235['options']?_0x409235['options'][_0x59b6('0x13')]===undefined?!![]:![]:!![],'where':_0x409235[_0x59b6('0x14')]?_0x409235[_0x59b6('0x14')]['where']||null:null,'attributes':_0x409235[_0x59b6('0x14')]?_0x409235[_0x59b6('0x14')][_0x59b6('0x15')]||null:null,'limit':_0x409235[_0x59b6('0x14')]?_0x409235[_0x59b6('0x14')][_0x59b6('0x16')]||null:null,'include':_0x409235[_0x59b6('0x14')]?_0x409235['options']['include']?_[_0x59b6('0x17')](_0x409235[_0x59b6('0x14')]['include'],function(_0x32209b){return{'model':db[_0x32209b[_0x59b6('0x18')]],'as':_0x32209b['as'],'attributes':_0x32209b['attributes'],'include':_0x32209b[_0x59b6('0x19')]?_[_0x59b6('0x17')](_0x32209b[_0x59b6('0x19')],function(_0x238b6c){return{'model':db[_0x238b6c[_0x59b6('0x18')]],'as':_0x238b6c['as'],'attributes':_0x238b6c[_0x59b6('0x15')],'include':_0x238b6c[_0x59b6('0x19')]?_[_0x59b6('0x17')](_0x238b6c[_0x59b6('0x19')],function(_0x35b968){return{'model':db[_0x35b968[_0x59b6('0x18')]],'as':_0x35b968['as'],'attributes':_0x35b968[_0x59b6('0x15')]};}):[]};}):[]};}):[]:[]})[_0x59b6('0x1a')](function(_0x2838c3){logger[_0x59b6('0x1b')](_0x59b6('0x1c'),_0x409235);logger[_0x59b6('0xb')](_0x59b6('0x1c'),_0x409235,JSON[_0x59b6('0x1d')](_0x2838c3));_0x49ae68(_0x2838c3);})['catch'](function(_0x1ceff7){logger[_0x59b6('0xd')](_0x59b6('0x1c'),_0x1ceff7[_0x59b6('0xf')],_0x409235);_0x37bf21(_0x2ab8bb[_0x59b6('0xd')](0x1f4,_0x1ceff7['message']));});});};exports[_0x59b6('0x1e')]=function(_0x5312d3){var _0x47d822=this;return new Promise(function(_0x3313cb,_0x240d00){return db[_0x59b6('0x1f')][_0x59b6('0x20')](_0x5312d3[_0x59b6('0x21')],{'raw':_0x5312d3['options']?_0x5312d3[_0x59b6('0x14')][_0x59b6('0x13')]===undefined?!![]:![]:!![]})[_0x59b6('0x1a')](function(_0x211ff3){logger[_0x59b6('0x1b')]('CreateVoiceCallReport',_0x5312d3);logger[_0x59b6('0xb')](_0x59b6('0x1e'),_0x5312d3,JSON['stringify'](_0x211ff3));_0x3313cb(_0x211ff3);})[_0x59b6('0x11')](function(_0x33e172){logger['error'](_0x59b6('0x1e'),_0x33e172[_0x59b6('0xf')],_0x5312d3);_0x240d00(_0x47d822[_0x59b6('0xd')](0x1f4,_0x33e172[_0x59b6('0xf')]));});});};exports[_0x59b6('0x22')]=function(_0x26ee43){var _0x3b8142=this;return new Promise(function(_0x4a1b07,_0x1f072b){return db[_0x59b6('0x1f')][_0x59b6('0x23')](_0x26ee43['body'],{'raw':_0x26ee43[_0x59b6('0x14')]?_0x26ee43['options'][_0x59b6('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26ee43[_0x59b6('0x14')]?_0x26ee43[_0x59b6('0x14')]['where']||null:null,'attributes':_0x26ee43[_0x59b6('0x14')]?_0x26ee43['options'][_0x59b6('0x15')]||null:null,'limit':_0x26ee43[_0x59b6('0x14')]?_0x26ee43[_0x59b6('0x14')][_0x59b6('0x16')]||null:null})[_0x59b6('0x1a')](function(_0x100d8b){logger[_0x59b6('0x1b')](_0x59b6('0x22'),_0x26ee43);logger[_0x59b6('0xb')](_0x59b6('0x22'),_0x26ee43,JSON[_0x59b6('0x1d')](_0x100d8b));_0x4a1b07(_0x100d8b);})[_0x59b6('0x11')](function(_0x2b9ca5){logger[_0x59b6('0xd')](_0x59b6('0x22'),_0x2b9ca5['message'],_0x26ee43);_0x1f072b(_0x3b8142[_0x59b6('0xd')](0x1f4,_0x2b9ca5[_0x59b6('0xf')]));});});}; \ No newline at end of file +var _0x2fe5=['error','code','message','info','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','body','update','UpdateVoiceCallReport','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20498e,_0x512b3d){var _0x286b42=function(_0x45a8ac){while(--_0x45a8ac){_0x20498e['push'](_0x20498e['shift']());}};_0x286b42(++_0x512b3d);}(_0x2fe5,0x85));var _0x52fe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2fe5[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52fe('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x52fe('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x52fe('0x2'))(_0x52fe('0x3'));var config=require(_0x52fe('0x4'));var jayson=require(_0x52fe('0x5'));var client=jayson[_0x52fe('0x6')][_0x52fe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f75b5,_0x328f8d,_0xf893b5){return new BPromise(function(_0x3b9e2d,_0x34b9ce){return client[_0x52fe('0x8')](_0x1f75b5,_0xf893b5)[_0x52fe('0x9')](function(_0x24460c){logger['info'](_0x52fe('0xa'),_0x328f8d,_0x52fe('0xb'));logger[_0x52fe('0xc')](_0x52fe('0xd'),_0x328f8d,'request\x20sent',JSON[_0x52fe('0xe')](_0x24460c));if(_0x24460c['error']){if(_0x24460c[_0x52fe('0xf')][_0x52fe('0x10')]===0x1f4){logger[_0x52fe('0xf')](_0x52fe('0xa'),_0x328f8d,_0x24460c['error'][_0x52fe('0x11')]);return _0x34b9ce(_0x24460c[_0x52fe('0xf')][_0x52fe('0x11')]);}logger[_0x52fe('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x328f8d,_0x24460c['error'][_0x52fe('0x11')]);return _0x3b9e2d(_0x24460c[_0x52fe('0xf')]['message']);}else{logger[_0x52fe('0x12')](_0x52fe('0xa'),_0x328f8d,_0x52fe('0xb'));_0x3b9e2d(_0x24460c[_0x52fe('0x13')]['message']);}})[_0x52fe('0x14')](function(_0x500812){logger['error'](_0x52fe('0xa'),_0x328f8d,_0x500812);_0x34b9ce(_0x500812);});});}exports['GetVoiceCallReport']=function(_0x327055){var _0x195504=this;return new Promise(function(_0x4069ab,_0x4aa9b3){return db['VoiceCallReport'][_0x52fe('0x15')]({'raw':_0x327055[_0x52fe('0x16')]?_0x327055[_0x52fe('0x16')][_0x52fe('0x17')]===undefined?!![]:![]:!![],'where':_0x327055[_0x52fe('0x16')]?_0x327055[_0x52fe('0x16')][_0x52fe('0x18')]||null:null,'attributes':_0x327055['options']?_0x327055[_0x52fe('0x16')][_0x52fe('0x19')]||null:null,'limit':_0x327055['options']?_0x327055['options'][_0x52fe('0x1a')]||null:null,'include':_0x327055[_0x52fe('0x16')]?_0x327055[_0x52fe('0x16')]['include']?_[_0x52fe('0x1b')](_0x327055[_0x52fe('0x16')][_0x52fe('0x1c')],function(_0x3cbe7a){return{'model':db[_0x3cbe7a[_0x52fe('0x1d')]],'as':_0x3cbe7a['as'],'attributes':_0x3cbe7a[_0x52fe('0x19')],'include':_0x3cbe7a[_0x52fe('0x1c')]?_['map'](_0x3cbe7a[_0x52fe('0x1c')],function(_0x2a0ee3){return{'model':db[_0x2a0ee3[_0x52fe('0x1d')]],'as':_0x2a0ee3['as'],'attributes':_0x2a0ee3[_0x52fe('0x19')],'include':_0x2a0ee3[_0x52fe('0x1c')]?_['map'](_0x2a0ee3[_0x52fe('0x1c')],function(_0x4f67e9){return{'model':db[_0x4f67e9[_0x52fe('0x1d')]],'as':_0x4f67e9['as'],'attributes':_0x4f67e9['attributes']};}):[]};}):[]};}):[]:[]})[_0x52fe('0x9')](function(_0xa63944){logger[_0x52fe('0x12')](_0x52fe('0x1e'),_0x327055);logger['debug'](_0x52fe('0x1e'),_0x327055,JSON[_0x52fe('0xe')](_0xa63944));_0x4069ab(_0xa63944);})[_0x52fe('0x14')](function(_0x457f19){logger[_0x52fe('0xf')]('GetVoiceCallReport',_0x457f19[_0x52fe('0x11')],_0x327055);_0x4aa9b3(_0x195504[_0x52fe('0xf')](0x1f4,_0x457f19[_0x52fe('0x11')]));});});};exports[_0x52fe('0x1f')]=function(_0x29c4e5){var _0x30bf6c=this;return new Promise(function(_0x357ad4,_0x2dd09b){return db[_0x52fe('0x20')][_0x52fe('0x21')](_0x29c4e5[_0x52fe('0x22')],{'raw':_0x29c4e5[_0x52fe('0x16')]?_0x29c4e5['options']['raw']===undefined?!![]:![]:!![]})[_0x52fe('0x9')](function(_0x403caf){logger[_0x52fe('0x12')](_0x52fe('0x1f'),_0x29c4e5);logger['debug'](_0x52fe('0x1f'),_0x29c4e5,JSON[_0x52fe('0xe')](_0x403caf));_0x357ad4(_0x403caf);})['catch'](function(_0x19855e){logger[_0x52fe('0xf')](_0x52fe('0x1f'),_0x19855e['message'],_0x29c4e5);_0x2dd09b(_0x30bf6c[_0x52fe('0xf')](0x1f4,_0x19855e[_0x52fe('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x312881){var _0xbc79b1=this;return new Promise(function(_0x3f87a0,_0x5aaf41){return db[_0x52fe('0x20')][_0x52fe('0x23')](_0x312881[_0x52fe('0x22')],{'raw':_0x312881[_0x52fe('0x16')]?_0x312881[_0x52fe('0x16')][_0x52fe('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x312881['options']?_0x312881['options'][_0x52fe('0x18')]||null:null,'attributes':_0x312881['options']?_0x312881['options'][_0x52fe('0x19')]||null:null,'limit':_0x312881[_0x52fe('0x16')]?_0x312881[_0x52fe('0x16')]['limit']||null:null})['then'](function(_0x4803d2){logger[_0x52fe('0x12')](_0x52fe('0x24'),_0x312881);logger[_0x52fe('0xc')]('UpdateVoiceCallReport',_0x312881,JSON['stringify'](_0x4803d2));_0x3f87a0(_0x4803d2);})[_0x52fe('0x14')](function(_0x429fbd){logger[_0x52fe('0xf')](_0x52fe('0x24'),_0x429fbd[_0x52fe('0x11')],_0x312881);_0x5aaf41(_0xbc79b1[_0x52fe('0xf')](0x1f4,_0x429fbd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index bcf5879..c53d6df 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 _0xbbf6=['destroy','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','create','update'];(function(_0x1c2505,_0x1a77ae){var _0x316005=function(_0xdb3dc1){while(--_0xdb3dc1){_0x1c2505['push'](_0x1c2505['shift']());}};_0x316005(++_0x1a77ae);}(_0xbbf6,0x135));var _0x6bbf=function(_0x4e83c2,_0x451304){_0x4e83c2=_0x4e83c2-0x0;var _0x35bd4b=_0xbbf6[_0x4e83c2];return _0x35bd4b;};'use strict';var multer=require('multer');var util=require(_0x6bbf('0x0'));var path=require(_0x6bbf('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x6bbf('0x2'));var interaction=require(_0x6bbf('0x3'));var config=require(_0x6bbf('0x4'));var controller=require(_0x6bbf('0x5'));router[_0x6bbf('0x6')]('/',auth['isAuthenticated'](),controller[_0x6bbf('0x7')]);router[_0x6bbf('0x6')](_0x6bbf('0x8'),auth[_0x6bbf('0x9')](),controller[_0x6bbf('0xa')]);router['post']('/',auth[_0x6bbf('0x9')](),controller[_0x6bbf('0xb')]);router['put']('/:id',auth[_0x6bbf('0x9')](),controller[_0x6bbf('0xc')]);router['delete'](_0x6bbf('0x8'),auth[_0x6bbf('0x9')](),controller[_0x6bbf('0xd')]);module['exports']=router; \ No newline at end of file +var _0xb051=['/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x29c3a0,_0x32be87){var _0x430f8a=function(_0x4143d9){while(--_0x4143d9){_0x29c3a0['push'](_0x29c3a0['shift']());}};_0x430f8a(++_0x32be87);}(_0xb051,0x1ee));var _0x1b05=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xb051[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0x1b05('0x0'));var util=require(_0x1b05('0x1'));var path=require('path');var express=require(_0x1b05('0x2'));var router=express[_0x1b05('0x3')]();var auth=require(_0x1b05('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1b05('0x5'));var controller=require(_0x1b05('0x6'));router[_0x1b05('0x7')]('/',auth[_0x1b05('0x8')](),controller[_0x1b05('0x9')]);router[_0x1b05('0x7')](_0x1b05('0xa'),auth[_0x1b05('0x8')](),controller[_0x1b05('0xb')]);router[_0x1b05('0xc')]('/',auth['isAuthenticated'](),controller[_0x1b05('0xd')]);router[_0x1b05('0xe')](_0x1b05('0xa'),auth[_0x1b05('0x8')](),controller[_0x1b05('0xf')]);router[_0x1b05('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1b05('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 21cdb85..035f59f 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 _0x8620=['STRING','name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize'];(function(_0x406ae7,_0x12181b){var _0x5a5b9d=function(_0x3f20c2){while(--_0x3f20c2){_0x406ae7['push'](_0x406ae7['shift']());}};_0x5a5b9d(++_0x12181b);}(_0x8620,0x1ef));var _0x0862=function(_0x49ad35,_0x369f5c){_0x49ad35=_0x49ad35-0x0;var _0x260154=_0x8620[_0x49ad35];return _0x260154;};'use strict';var Sequelize=require(_0x0862('0x0'));module['exports']={'name':{'type':Sequelize[_0x0862('0x1')]},'prefix':{'type':Sequelize[_0x0862('0x1')],'unique':_0x0862('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x35cb24){this[_0x0862('0x3')](_0x0862('0x4'),_0x35cb24?_0x35cb24[_0x0862('0x5')](''):[]);},'get':function(){return this[_0x0862('0x6')](_0x0862('0x4'))?this[_0x0862('0x6')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x0862('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x0862('0x1')]},'record':{'type':Sequelize[_0x0862('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6208=['setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6208,0xdd));var _0x8620=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x6208[_0x508685];return _0x976a76;};'use strict';var Sequelize=require(_0x8620('0x0'));module[_0x8620('0x1')]={'name':{'type':Sequelize[_0x8620('0x2')]},'prefix':{'type':Sequelize[_0x8620('0x2')],'unique':_0x8620('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x29addd){this[_0x8620('0x4')](_0x8620('0x5'),_0x29addd?_0x29addd[_0x8620('0x6')](''):[]);},'get':function(){return this[_0x8620('0x7')](_0x8620('0x5'))?this[_0x8620('0x7')](_0x8620('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x8620('0x2')]},'record':{'type':Sequelize[_0x8620('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8620('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index f055751..c91d85b 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 _0x2922=['sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','VoiceChanSpy','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','add','day','merge','map','includeAll','include','rows','params','options','create','body','catch','update','find','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0x2922,0x107));var _0x2292=function(_0x42fbbb,_0x48b693){_0x42fbbb=_0x42fbbb-0x0;var _0x4dda3d=_0x2922[_0x42fbbb];return _0x4dda3d;};'use strict';var jsonpatch=require(_0x2292('0x0'));var rp=require('request-promise');var moment=require(_0x2292('0x1'));var BPromise=require(_0x2292('0x2'));var Mustache=require(_0x2292('0x3'));var util=require('util');var path=require(_0x2292('0x4'));var sox=require(_0x2292('0x5'));var csv=require('to-csv');var ejs=require(_0x2292('0x6'));var fs=require('fs');var _=require(_0x2292('0x7'));var squel=require('squel');var crypto=require(_0x2292('0x8'));var jsforce=require(_0x2292('0x9'));var deskjs=require(_0x2292('0xa'));var toCsv=require(_0x2292('0xb'));var querystring=require(_0x2292('0xc'));var Papa=require(_0x2292('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x2292('0xe'))(_0x2292('0xf'));var utils=require(_0x2292('0x10'));var config=require('../../config/environment');var db=require(_0x2292('0x11'))['db'];function respondWithStatusCode(_0x5dbd1a,_0x275e14){_0x275e14=_0x275e14||0xcc;return function(_0x49f576){if(_0x49f576){return _0x5dbd1a[_0x2292('0x12')](_0x275e14);}return _0x5dbd1a[_0x2292('0x13')](_0x275e14)[_0x2292('0x14')]();};}function respondWithResult(_0x46fd04,_0x133b62){_0x133b62=_0x133b62||0xc8;return function(_0xc3f8a7){if(_0xc3f8a7){return _0x46fd04[_0x2292('0x13')](_0x133b62)['json'](_0xc3f8a7);}};}function respondWithFilteredResult(_0x387e04,_0x5a5804){return function(_0xb5b6){if(_0xb5b6){var _0x396a9e=_0xb5b6[_0x2292('0x15')],_0x26fda3=_0x5a5804[_0x2292('0x16')],_0x59adfa=_0x5a5804[_0x2292('0x16')]+_0x5a5804['limit'],_0xfad30b;if(_0x59adfa>=_0x396a9e){_0x59adfa=_0x396a9e;_0xfad30b=0xc8;}else{_0xfad30b=0xce;}_0x387e04['status'](_0xfad30b);return _0x387e04[_0x2292('0x17')](_0x2292('0x18'),_0x26fda3+'-'+_0x59adfa+'/'+_0x396a9e)[_0x2292('0x19')](_0xb5b6);}return null;};}function patchUpdates(_0x549b5a){return function(_0x34a5ce){try{jsonpatch[_0x2292('0x1a')](_0x34a5ce,_0x549b5a,!![]);}catch(_0x3fcee2){return BPromise['reject'](_0x3fcee2);}return _0x34a5ce[_0x2292('0x1b')]();};}function saveUpdates(_0x6d46b1,_0x2b9b82){return function(_0x140e70){if(_0x140e70){return _0x140e70['update'](_0x6d46b1)[_0x2292('0x1c')](function(_0x192647){return _0x192647;});}return null;};}function removeEntity(_0x14ee7d,_0x381f3c){return function(_0x93a424){if(_0x93a424){return _0x93a424[_0x2292('0x1d')]()['then'](function(){_0x14ee7d[_0x2292('0x13')](0xcc)[_0x2292('0x14')]();});}};}function handleEntityNotFound(_0x5a13e4,_0x1228cc){return function(_0x5becdc){if(!_0x5becdc){_0x5a13e4[_0x2292('0x12')](0x194);}return _0x5becdc;};}function handleError(_0x3a5ef4,_0x16076b){_0x16076b=_0x16076b||0x1f4;return function(_0x268b88){logger['error'](_0x268b88[_0x2292('0x1e')]);if(_0x268b88[_0x2292('0x1f')]){delete _0x268b88['name'];}_0x3a5ef4['status'](_0x16076b)[_0x2292('0x20')](_0x268b88);};}exports[_0x2292('0x21')]=function(_0x1f3573,_0x2c0596){var _0x5c92c8={},_0x5e2d27={},_0xed5993={'count':0x0,'rows':[]};var _0x4f28df=db[_0x2292('0x22')][_0x2292('0x23')];_0x5e2d27[_0x2292('0x24')]=_[_0x2292('0x25')](_0x4f28df);var _0x29adef={'dateStart':_0x1f3573['query'][_0x2292('0x26')],'dateEnd':_0x1f3573[_0x2292('0x27')][_0x2292('0x28')]};delete _0x1f3573['query'][_0x2292('0x26')];delete _0x1f3573[_0x2292('0x27')][_0x2292('0x28')];_0x5e2d27[_0x2292('0x27')]=_[_0x2292('0x25')](_0x1f3573[_0x2292('0x27')]);_0x5e2d27['filters']=_[_0x2292('0x29')](_0x5e2d27['model'],_0x5e2d27['query']);_0x5c92c8[_0x2292('0x2a')]=_['intersection'](_0x5e2d27[_0x2292('0x24')],qs['fields'](_0x1f3573[_0x2292('0x27')][_0x2292('0x2b')]));_0x5c92c8['attributes']=_0x5c92c8['attributes'][_0x2292('0x2c')]?_0x5c92c8[_0x2292('0x2a')]:_0x5e2d27[_0x2292('0x24')];if(!_0x1f3573[_0x2292('0x27')][_0x2292('0x2d')](_0x2292('0x2e'))){_0x5c92c8[_0x2292('0x2f')]=qs[_0x2292('0x2f')](_0x1f3573[_0x2292('0x27')]['limit']);_0x5c92c8[_0x2292('0x16')]=qs[_0x2292('0x16')](_0x1f3573['query'][_0x2292('0x16')]);}_0x5c92c8[_0x2292('0x30')]=qs[_0x2292('0x31')](_0x1f3573[_0x2292('0x27')][_0x2292('0x31')]);_0x5c92c8[_0x2292('0x32')]=qs[_0x2292('0x33')](_[_0x2292('0x34')](_0x1f3573[_0x2292('0x27')],_0x5e2d27[_0x2292('0x33')]));if(_0x29adef[_0x2292('0x26')]){if(_0x29adef[_0x2292('0x28')]){_0x29adef['dateEnd']=moment(_0x29adef[_0x2292('0x28')])[_0x2292('0x35')](0x1,_0x2292('0x36'));}else{_0x29adef[_0x2292('0x28')]=moment(_0x29adef[_0x2292('0x26')])[_0x2292('0x35')](0x1,_0x2292('0x36'));}_[_0x2292('0x37')](_0x5c92c8[_0x2292('0x32')],{'createdAt':{'$gte':_0x29adef[_0x2292('0x26')],'$lte':_0x29adef[_0x2292('0x28')]}});}if(_0x1f3573[_0x2292('0x27')]['filter']){_0x5c92c8['where']=_[_0x2292('0x37')](_0x5c92c8[_0x2292('0x32')],{'$or':_[_0x2292('0x38')](_0x5c92c8[_0x2292('0x2a')],function(_0x3556f6){var _0xef6cda={};_0xef6cda[_0x3556f6]={'$like':'%'+_0x1f3573[_0x2292('0x27')]['filter']+'%'};return _0xef6cda;})});}_0x5c92c8=_[_0x2292('0x37')]({},_0x5c92c8,_0x1f3573['options']);var _0x9bf3dd={'where':_0x5c92c8[_0x2292('0x32')]};return db['VoiceChanSpy'][_0x2292('0x15')](_0x9bf3dd)['then'](function(_0x1c18f4){_0xed5993[_0x2292('0x15')]=_0x1c18f4;if(_0x1f3573[_0x2292('0x27')][_0x2292('0x39')]){_0x5c92c8[_0x2292('0x3a')]=[{'all':!![]}];}return db[_0x2292('0x22')]['findAll'](_0x5c92c8);})[_0x2292('0x1c')](function(_0x18045b){_0xed5993[_0x2292('0x3b')]=_0x18045b;return _0xed5993;})['then'](respondWithFilteredResult(_0x2c0596,_0x5c92c8))['catch'](handleError(_0x2c0596,null));};exports['show']=function(_0x4b8f39,_0x12be11){var _0x54b11e={'raw':![],'where':{'id':_0x4b8f39[_0x2292('0x3c')]['id']}},_0x56ece5={};_0x56ece5[_0x2292('0x24')]=_[_0x2292('0x25')](db[_0x2292('0x22')]['rawAttributes']);_0x56ece5['query']=_['keys'](_0x4b8f39[_0x2292('0x27')]);_0x56ece5[_0x2292('0x33')]=_[_0x2292('0x29')](_0x56ece5['model'],_0x56ece5[_0x2292('0x27')]);_0x54b11e[_0x2292('0x2a')]=_['intersection'](_0x56ece5[_0x2292('0x24')],qs['fields'](_0x4b8f39[_0x2292('0x27')][_0x2292('0x2b')]));_0x54b11e[_0x2292('0x2a')]=_0x54b11e['attributes'][_0x2292('0x2c')]?_0x54b11e[_0x2292('0x2a')]:_0x56ece5['model'];if(_0x4b8f39[_0x2292('0x27')][_0x2292('0x39')]){_0x54b11e[_0x2292('0x3a')]=[{'all':!![]}];}_0x54b11e=_[_0x2292('0x37')]({},_0x54b11e,_0x4b8f39[_0x2292('0x3d')]);return db[_0x2292('0x22')]['find'](_0x54b11e)[_0x2292('0x1c')](handleEntityNotFound(_0x12be11,null))[_0x2292('0x1c')](respondWithResult(_0x12be11,null))['catch'](handleError(_0x12be11,null));};exports[_0x2292('0x3e')]=function(_0x5e8fb1,_0x31017b){return db[_0x2292('0x22')][_0x2292('0x3e')](_0x5e8fb1[_0x2292('0x3f')],{})[_0x2292('0x1c')](respondWithResult(_0x31017b,0xc9))[_0x2292('0x40')](handleError(_0x31017b,null));};exports[_0x2292('0x41')]=function(_0x19f93b,_0x387220){if(_0x19f93b['body']['id']){delete _0x19f93b[_0x2292('0x3f')]['id'];}return db[_0x2292('0x22')][_0x2292('0x42')]({'where':{'id':_0x19f93b['params']['id']}})[_0x2292('0x1c')](handleEntityNotFound(_0x387220,null))[_0x2292('0x1c')](saveUpdates(_0x19f93b['body'],null))[_0x2292('0x1c')](respondWithResult(_0x387220,null))[_0x2292('0x40')](handleError(_0x387220,null));};exports[_0x2292('0x1d')]=function(_0x3be58b,_0x328465){return db['VoiceChanSpy'][_0x2292('0x42')]({'where':{'id':_0x3be58b[_0x2292('0x3c')]['id']}})[_0x2292('0x1c')](handleEntityNotFound(_0x328465,null))[_0x2292('0x1c')](removeEntity(_0x328465,null))[_0x2292('0x40')](handleError(_0x328465,null));}; \ No newline at end of file +var _0x26c0=['json','count','offset','set','Content-Range','apply','reject','update','destroy','then','name','send','index','VoiceChanSpy','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','model','limit','order','sort','where','filters','pick','add','day','merge','filter','map','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x3ba2ef,_0x48697d){var _0x769dda=function(_0x34b9f1){while(--_0x34b9f1){_0x3ba2ef['push'](_0x3ba2ef['shift']());}};_0x769dda(++_0x48697d);}(_0x26c0,0xb2));var _0x026c=function(_0x334e7d,_0x3a4d38){_0x334e7d=_0x334e7d-0x0;var _0x3490ac=_0x26c0[_0x334e7d];return _0x3490ac;};'use strict';var jsonpatch=require(_0x026c('0x0'));var rp=require(_0x026c('0x1'));var moment=require('moment');var BPromise=require(_0x026c('0x2'));var Mustache=require(_0x026c('0x3'));var util=require(_0x026c('0x4'));var path=require(_0x026c('0x5'));var sox=require(_0x026c('0x6'));var csv=require(_0x026c('0x7'));var ejs=require(_0x026c('0x8'));var fs=require('fs');var _=require(_0x026c('0x9'));var squel=require(_0x026c('0xa'));var crypto=require(_0x026c('0xb'));var jsforce=require(_0x026c('0xc'));var deskjs=require(_0x026c('0xd'));var toCsv=require(_0x026c('0x7'));var querystring=require(_0x026c('0xe'));var Papa=require(_0x026c('0xf'));var qs=require(_0x026c('0x10'));var logger=require('../../config/logger')(_0x026c('0x11'));var utils=require(_0x026c('0x12'));var config=require(_0x026c('0x13'));var db=require(_0x026c('0x14'))['db'];function respondWithStatusCode(_0x3c3030,_0x1f682b){_0x1f682b=_0x1f682b||0xcc;return function(_0x38b917){if(_0x38b917){return _0x3c3030['sendStatus'](_0x1f682b);}return _0x3c3030[_0x026c('0x15')](_0x1f682b)[_0x026c('0x16')]();};}function respondWithResult(_0x43593d,_0x230d34){_0x230d34=_0x230d34||0xc8;return function(_0x200547){if(_0x200547){return _0x43593d['status'](_0x230d34)[_0x026c('0x17')](_0x200547);}};}function respondWithFilteredResult(_0x129068,_0x2d21bd){return function(_0x32b083){if(_0x32b083){var _0x126086=_0x32b083[_0x026c('0x18')],_0x26e26a=_0x2d21bd[_0x026c('0x19')],_0x41bf79=_0x2d21bd[_0x026c('0x19')]+_0x2d21bd['limit'],_0x15244d;if(_0x41bf79>=_0x126086){_0x41bf79=_0x126086;_0x15244d=0xc8;}else{_0x15244d=0xce;}_0x129068['status'](_0x15244d);return _0x129068[_0x026c('0x1a')](_0x026c('0x1b'),_0x26e26a+'-'+_0x41bf79+'/'+_0x126086)[_0x026c('0x17')](_0x32b083);}return null;};}function patchUpdates(_0x129541){return function(_0xd59087){try{jsonpatch[_0x026c('0x1c')](_0xd59087,_0x129541,!![]);}catch(_0xdbe91c){return BPromise[_0x026c('0x1d')](_0xdbe91c);}return _0xd59087['save']();};}function saveUpdates(_0xe2373c,_0x517962){return function(_0x185bb5){if(_0x185bb5){return _0x185bb5[_0x026c('0x1e')](_0xe2373c)['then'](function(_0x314d2a){return _0x314d2a;});}return null;};}function removeEntity(_0x11a7a7,_0x5c5564){return function(_0x15ce14){if(_0x15ce14){return _0x15ce14[_0x026c('0x1f')]()[_0x026c('0x20')](function(){_0x11a7a7[_0x026c('0x15')](0xcc)[_0x026c('0x16')]();});}};}function handleEntityNotFound(_0x125a80,_0xc4c5e9){return function(_0x46cfb5){if(!_0x46cfb5){_0x125a80['sendStatus'](0x194);}return _0x46cfb5;};}function handleError(_0x8d94b3,_0x439514){_0x439514=_0x439514||0x1f4;return function(_0xf4dddd){logger['error'](_0xf4dddd['stack']);if(_0xf4dddd[_0x026c('0x21')]){delete _0xf4dddd[_0x026c('0x21')];}_0x8d94b3[_0x026c('0x15')](_0x439514)[_0x026c('0x22')](_0xf4dddd);};}exports[_0x026c('0x23')]=function(_0x5b6be9,_0xc9014d){var _0x14bdc8={},_0x18e3a5={},_0x5d91d0={'count':0x0,'rows':[]};var _0x5f2d99=db[_0x026c('0x24')]['rawAttributes'];_0x18e3a5['model']=_[_0x026c('0x25')](_0x5f2d99);var _0x396467={'dateStart':_0x5b6be9[_0x026c('0x26')][_0x026c('0x27')],'dateEnd':_0x5b6be9[_0x026c('0x26')][_0x026c('0x28')]};delete _0x5b6be9[_0x026c('0x26')]['dateStart'];delete _0x5b6be9[_0x026c('0x26')][_0x026c('0x28')];_0x18e3a5[_0x026c('0x26')]=_['keys'](_0x5b6be9[_0x026c('0x26')]);_0x18e3a5['filters']=_[_0x026c('0x29')](_0x18e3a5['model'],_0x18e3a5[_0x026c('0x26')]);_0x14bdc8[_0x026c('0x2a')]=_['intersection'](_0x18e3a5['model'],qs['fields'](_0x5b6be9[_0x026c('0x26')][_0x026c('0x2b')]));_0x14bdc8[_0x026c('0x2a')]=_0x14bdc8[_0x026c('0x2a')][_0x026c('0x2c')]?_0x14bdc8[_0x026c('0x2a')]:_0x18e3a5[_0x026c('0x2d')];if(!_0x5b6be9['query']['hasOwnProperty']('nolimit')){_0x14bdc8[_0x026c('0x2e')]=qs['limit'](_0x5b6be9[_0x026c('0x26')][_0x026c('0x2e')]);_0x14bdc8[_0x026c('0x19')]=qs[_0x026c('0x19')](_0x5b6be9[_0x026c('0x26')][_0x026c('0x19')]);}_0x14bdc8[_0x026c('0x2f')]=qs[_0x026c('0x30')](_0x5b6be9['query'][_0x026c('0x30')]);_0x14bdc8[_0x026c('0x31')]=qs[_0x026c('0x32')](_[_0x026c('0x33')](_0x5b6be9['query'],_0x18e3a5[_0x026c('0x32')]));if(_0x396467[_0x026c('0x27')]){if(_0x396467[_0x026c('0x28')]){_0x396467[_0x026c('0x28')]=moment(_0x396467[_0x026c('0x28')])[_0x026c('0x34')](0x1,_0x026c('0x35'));}else{_0x396467['dateEnd']=moment(_0x396467['dateStart'])['add'](0x1,_0x026c('0x35'));}_[_0x026c('0x36')](_0x14bdc8[_0x026c('0x31')],{'createdAt':{'$gte':_0x396467[_0x026c('0x27')],'$lte':_0x396467['dateEnd']}});}if(_0x5b6be9['query'][_0x026c('0x37')]){_0x14bdc8['where']=_[_0x026c('0x36')](_0x14bdc8[_0x026c('0x31')],{'$or':_[_0x026c('0x38')](_0x14bdc8['attributes'],function(_0x512378){var _0x108282={};_0x108282[_0x512378]={'$like':'%'+_0x5b6be9[_0x026c('0x26')][_0x026c('0x37')]+'%'};return _0x108282;})});}_0x14bdc8=_[_0x026c('0x36')]({},_0x14bdc8,_0x5b6be9['options']);var _0x23f537={'where':_0x14bdc8[_0x026c('0x31')]};return db[_0x026c('0x24')][_0x026c('0x18')](_0x23f537)['then'](function(_0x27ff1e){_0x5d91d0[_0x026c('0x18')]=_0x27ff1e;if(_0x5b6be9[_0x026c('0x26')][_0x026c('0x39')]){_0x14bdc8[_0x026c('0x3a')]=[{'all':!![]}];}return db[_0x026c('0x24')]['findAll'](_0x14bdc8);})['then'](function(_0x5c7b30){_0x5d91d0[_0x026c('0x3b')]=_0x5c7b30;return _0x5d91d0;})[_0x026c('0x20')](respondWithFilteredResult(_0xc9014d,_0x14bdc8))['catch'](handleError(_0xc9014d,null));};exports[_0x026c('0x3c')]=function(_0x4ac873,_0x593d5e){var _0x1ba804={'raw':![],'where':{'id':_0x4ac873[_0x026c('0x3d')]['id']}},_0x4734e3={};_0x4734e3[_0x026c('0x2d')]=_[_0x026c('0x25')](db[_0x026c('0x24')][_0x026c('0x3e')]);_0x4734e3[_0x026c('0x26')]=_['keys'](_0x4ac873[_0x026c('0x26')]);_0x4734e3[_0x026c('0x32')]=_[_0x026c('0x29')](_0x4734e3[_0x026c('0x2d')],_0x4734e3[_0x026c('0x26')]);_0x1ba804['attributes']=_[_0x026c('0x29')](_0x4734e3[_0x026c('0x2d')],qs['fields'](_0x4ac873['query'][_0x026c('0x2b')]));_0x1ba804[_0x026c('0x2a')]=_0x1ba804[_0x026c('0x2a')][_0x026c('0x2c')]?_0x1ba804['attributes']:_0x4734e3[_0x026c('0x2d')];if(_0x4ac873['query']['includeAll']){_0x1ba804['include']=[{'all':!![]}];}_0x1ba804=_[_0x026c('0x36')]({},_0x1ba804,_0x4ac873['options']);return db[_0x026c('0x24')][_0x026c('0x3f')](_0x1ba804)[_0x026c('0x20')](handleEntityNotFound(_0x593d5e,null))[_0x026c('0x20')](respondWithResult(_0x593d5e,null))[_0x026c('0x40')](handleError(_0x593d5e,null));};exports[_0x026c('0x41')]=function(_0x1a058c,_0x4af95b){return db[_0x026c('0x24')][_0x026c('0x41')](_0x1a058c[_0x026c('0x42')],{})[_0x026c('0x20')](respondWithResult(_0x4af95b,0xc9))[_0x026c('0x40')](handleError(_0x4af95b,null));};exports['update']=function(_0x2e189d,_0x370827){if(_0x2e189d['body']['id']){delete _0x2e189d[_0x026c('0x42')]['id'];}return db[_0x026c('0x24')][_0x026c('0x3f')]({'where':{'id':_0x2e189d['params']['id']}})[_0x026c('0x20')](handleEntityNotFound(_0x370827,null))[_0x026c('0x20')](saveUpdates(_0x2e189d[_0x026c('0x42')],null))[_0x026c('0x20')](respondWithResult(_0x370827,null))[_0x026c('0x40')](handleError(_0x370827,null));};exports[_0x026c('0x1f')]=function(_0x430886,_0x2eb53b){return db[_0x026c('0x24')][_0x026c('0x3f')]({'where':{'id':_0x430886['params']['id']}})['then'](handleEntityNotFound(_0x2eb53b,null))[_0x026c('0x20')](removeEntity(_0x2eb53b,null))[_0x026c('0x40')](handleError(_0x2eb53b,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d2f6115..547a61b 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 _0x918a=['prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,ab','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','StopMixMonitor','length','internal','concat','User','findAll','then','exports','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','api','./voiceChanSpy.attributes','from-sip','system','format','%s%s'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x918a,0x1b4));var _0xa918=function(_0x439925,_0x45f4f7){_0x439925=_0x439925-0x0;var _0x3873d0=_0x918a[_0x439925];return _0x3873d0;};'use strict';var _=require(_0xa918('0x0'));var util=require('util');var BPromise=require(_0xa918('0x1'));var logger=require('../../config/logger')(_0xa918('0x2'));var attributes=require(_0xa918('0x3'));var getUserApplications=function(_0x4f3d98,_0x2bd33a,_0x2b553f){var _0x367000=0x1;var _0x18d0b1=[];var _0x4c61c6={'context':_0xa918('0x4'),'type':_0xa918('0x5'),'isApp':![]};var _0x50ef46={'exten':util[_0xa918('0x6')](_0xa918('0x7'),_0x4f3d98[_0xa918('0x8')],_0x2b553f),'ChanSpyId':_0x4f3d98['id'],'UserId':_0x2bd33a['id']};_0x18d0b1[_0xa918('0x9')](_[_0xa918('0xa')]({'app':_0xa918('0xb'),'appdata':util[_0xa918('0x6')](_0xa918('0xc'),_0xa918('0xd')),'priority':_0x367000++},_0x4c61c6,_0x50ef46));if(_0x4f3d98[_0xa918('0xe')]){_0x18d0b1[_0xa918('0x9')](_[_0xa918('0xa')]({'app':_0xa918('0xf'),'appdata':util[_0xa918('0x6')](_0xa918('0x10'),_0x4f3d98['recordingFormat']),'priority':_0x367000++},_0x4c61c6,_0x50ef46));}if(_0x4f3d98[_0xa918('0x11')]){_0x18d0b1[_0xa918('0x9')](_[_0xa918('0xa')]({'app':_0xa918('0x12'),'appdata':_0x4f3d98[_0xa918('0x13')],'priority':_0x367000++},_0x4c61c6,_0x50ef46));}_0x18d0b1['push'](_['merge']({'app':_0xa918('0x14'),'appdata':util[_0xa918('0x6')](_0xa918('0x15'),_0x2bd33a['name'],_0x4f3d98[_0xa918('0x16')]?_0x4f3d98[_0xa918('0x16')]['join'](''):''),'priority':_0x367000++},_0x4c61c6,_0x50ef46));if(_0x4f3d98[_0xa918('0xe')]){_0x18d0b1[_0xa918('0x9')](_['merge']({'app':_0xa918('0x17'),'priority':_0x367000++},_0x4c61c6,_0x50ef46));}return _0x18d0b1;};var getChanSpyApplications=function(_0xeb0d2a,_0xcbdb7b){var _0x486488=[];for(var _0x60525e=0x0,_0x14cf36=0x1;_0x60525e<_0xcbdb7b[_0xa918('0x18')];_0x60525e++,_0x14cf36=0x1){var _0x268f83=getUserApplications(_0xeb0d2a,_0xcbdb7b[_0x60525e],_0xcbdb7b[_0x60525e][_0xa918('0x19')]);var _0x647fee=getUserApplications(_0xeb0d2a,_0xcbdb7b[_0x60525e],_0xcbdb7b[_0x60525e]['name']);_0x486488=_0x486488[_0xa918('0x1a')](_0x268f83,_0x647fee);}return _0x486488;};var getChanSpyPromise=function(_0xb3498f,_0x2d105f){return new BPromise(function(_0x46fe99,_0x94d512){return _0xb3498f[_0xa918('0x1b')][_0xa918('0x1c')]({'attributes':['id','name',_0xa918('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xa918('0x1d')](function(_0x54a855){if(_0x54a855){return _0x46fe99(getChanSpyApplications(_0x2d105f,_0x54a855));}return _0x46fe99([]);})['catch'](function(_0x185a10){_0x94d512(_0x185a10);});});};module[_0xa918('0x1e')]=function(_0x3269ff,_0x36d8ec){var _0x15d976=_0x3269ff['models'];return _0x3269ff['define'](_0xa918('0x1f'),attributes,{'tableName':_0xa918('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bcd3d,_0x51afa3,_0x39b6f3){return getChanSpyPromise(_0x15d976,_0x2bcd3d)['then'](function(_0x1b5627){if(_0x1b5627&&_0x1b5627['length']){return _0x15d976[_0xa918('0x21')][_0xa918('0x22')](_0x1b5627);}})[_0xa918('0x1d')](function(){_0x39b6f3();})['catch'](function(_0x4af98d){_0x39b6f3(_0x4af98d);});},'afterUpdate':function(_0x3e8cd8,_0x2d871d,_0x5ce979){return _0x15d976['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x3e8cd8['id']}})[_0xa918('0x1d')](function(){return getChanSpyPromise(_0x15d976,_0x3e8cd8);})[_0xa918('0x1d')](function(_0x383c2f){if(_0x383c2f&&_0x383c2f[_0xa918('0x18')]){return _0x15d976[_0xa918('0x21')][_0xa918('0x22')](_0x383c2f);}})['then'](function(){_0x5ce979();})[_0xa918('0x23')](function(_0x3ec48f){_0x5ce979(_0x3ec48f);});},'afterDestroy':function(_0x5e5cdb,_0x2cd9f3,_0x228a91){return _0x15d976[_0xa918('0x21')][_0xa918('0x24')]({'where':{'ChanSpyId':_0x5e5cdb['id']}})[_0xa918('0x1d')](function(){_0x228a91();})['catch'](function(_0x1344b9){_0x228a91(_0x1344b9);});}}});}; \ No newline at end of file +var _0xc2eb=['join','record','StopMixMonitor','length','internal','concat','User','then','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','util','bluebird','../../config/logger','api','./voiceChanSpy.attributes','from-sip','format','merge','Set','CDR(type)=%s','chanspy','push','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','ChanSpy','SIP/%s,%s','name'];(function(_0x42fa41,_0x35e64c){var _0x1473e3=function(_0x196445){while(--_0x196445){_0x42fa41['push'](_0x42fa41['shift']());}};_0x1473e3(++_0x35e64c);}(_0xc2eb,0x1ee));var _0xbc2e=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xc2eb[_0x28d18d];return _0x470640;};'use strict';var _=require('lodash');var util=require(_0xbc2e('0x0'));var BPromise=require(_0xbc2e('0x1'));var logger=require(_0xbc2e('0x2'))(_0xbc2e('0x3'));var attributes=require(_0xbc2e('0x4'));var getUserApplications=function(_0x45aa90,_0x54e418,_0x2a65f3){var _0x43d719=0x1;var _0x190125=[];var _0x462153={'context':_0xbc2e('0x5'),'type':'system','isApp':![]};var _0x506a59={'exten':util[_0xbc2e('0x6')]('%s%s',_0x45aa90['prefix'],_0x2a65f3),'ChanSpyId':_0x45aa90['id'],'UserId':_0x54e418['id']};_0x190125['push'](_[_0xbc2e('0x7')]({'app':_0xbc2e('0x8'),'appdata':util[_0xbc2e('0x6')](_0xbc2e('0x9'),_0xbc2e('0xa')),'priority':_0x43d719++},_0x462153,_0x506a59));if(_0x45aa90['record']){_0x190125[_0xbc2e('0xb')](_[_0xbc2e('0x7')]({'app':_0xbc2e('0xc'),'appdata':util['format'](_0xbc2e('0xd'),_0x45aa90[_0xbc2e('0xe')]),'priority':_0x43d719++},_0x462153,_0x506a59));}if(_0x45aa90['auth']){_0x190125[_0xbc2e('0xb')](_[_0xbc2e('0x7')]({'app':'Authenticate','appdata':_0x45aa90['password'],'priority':_0x43d719++},_0x462153,_0x506a59));}_0x190125['push'](_[_0xbc2e('0x7')]({'app':_0xbc2e('0xf'),'appdata':util['format'](_0xbc2e('0x10'),_0x54e418[_0xbc2e('0x11')],_0x45aa90['options']?_0x45aa90['options'][_0xbc2e('0x12')](''):''),'priority':_0x43d719++},_0x462153,_0x506a59));if(_0x45aa90[_0xbc2e('0x13')]){_0x190125['push'](_[_0xbc2e('0x7')]({'app':_0xbc2e('0x14'),'priority':_0x43d719++},_0x462153,_0x506a59));}return _0x190125;};var getChanSpyApplications=function(_0x1694ef,_0x31d823){var _0x170c89=[];for(var _0x736d77=0x0,_0x5ffb00=0x1;_0x736d77<_0x31d823[_0xbc2e('0x15')];_0x736d77++,_0x5ffb00=0x1){var _0x18750a=getUserApplications(_0x1694ef,_0x31d823[_0x736d77],_0x31d823[_0x736d77][_0xbc2e('0x16')]);var _0x38af97=getUserApplications(_0x1694ef,_0x31d823[_0x736d77],_0x31d823[_0x736d77]['name']);_0x170c89=_0x170c89[_0xbc2e('0x17')](_0x18750a,_0x38af97);}return _0x170c89;};var getChanSpyPromise=function(_0x37c769,_0x15b9f0){return new BPromise(function(_0x5bc989,_0x34e6e6){return _0x37c769[_0xbc2e('0x18')]['findAll']({'attributes':['id',_0xbc2e('0x11'),_0xbc2e('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xbc2e('0x19')](function(_0x306511){if(_0x306511){return _0x5bc989(getChanSpyApplications(_0x15b9f0,_0x306511));}return _0x5bc989([]);})[_0xbc2e('0x1a')](function(_0xbf8bdc){_0x34e6e6(_0xbf8bdc);});});};module[_0xbc2e('0x1b')]=function(_0xcc1f43,_0x1e9eb2){var _0x1b874d=_0xcc1f43['models'];return _0xcc1f43[_0xbc2e('0x1c')](_0xbc2e('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d172b,_0x4441cd,_0x22b41e){return getChanSpyPromise(_0x1b874d,_0x1d172b)[_0xbc2e('0x19')](function(_0x5b608a){if(_0x5b608a&&_0x5b608a[_0xbc2e('0x15')]){return _0x1b874d[_0xbc2e('0x1e')][_0xbc2e('0x1f')](_0x5b608a);}})['then'](function(){_0x22b41e();})[_0xbc2e('0x1a')](function(_0x1355f3){_0x22b41e(_0x1355f3);});},'afterUpdate':function(_0x43cbf7,_0x31e625,_0x2ea6c2){return _0x1b874d[_0xbc2e('0x1e')]['destroy']({'where':{'ChanSpyId':_0x43cbf7['id']}})['then'](function(){return getChanSpyPromise(_0x1b874d,_0x43cbf7);})[_0xbc2e('0x19')](function(_0x184654){if(_0x184654&&_0x184654[_0xbc2e('0x15')]){return _0x1b874d[_0xbc2e('0x1e')][_0xbc2e('0x1f')](_0x184654);}})['then'](function(){_0x2ea6c2();})['catch'](function(_0x5e9d20){_0x2ea6c2(_0x5e9d20);});},'afterDestroy':function(_0xe3ba12,_0x25525a,_0x3e3a7d){return _0x1b874d[_0xbc2e('0x1e')]['destroy']({'where':{'ChanSpyId':_0xe3ba12['id']}})['then'](function(){_0x3e3a7d();})[_0xbc2e('0x1a')](function(_0x13186d){_0x3e3a7d(_0x13186d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8aec6a4..c0d235e 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 _0xd90a=['debug','stringify','error','code','message','info','result','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd90a,0x6b));var _0xad90=function(_0x11dcf5,_0x5c07db){_0x11dcf5=_0x11dcf5-0x0;var _0x30b36c=_0xd90a[_0x11dcf5];return _0x30b36c;};'use strict';var _=require(_0xad90('0x0'));var util=require('util');var moment=require(_0xad90('0x1'));var BPromise=require('bluebird');var rs=require(_0xad90('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xad90('0x3'));var logger=require(_0xad90('0x4'))(_0xad90('0x5'));var config=require(_0xad90('0x6'));var jayson=require(_0xad90('0x7'));var client=jayson[_0xad90('0x8')][_0xad90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1464c0,_0x1a356f,_0x33b9e6){return new BPromise(function(_0x361ca3,_0x128f6b){return client['request'](_0x1464c0,_0x33b9e6)[_0xad90('0xa')](function(_0x2c5b57){logger['info'](_0xad90('0xb'),_0x1a356f,_0xad90('0xc'));logger[_0xad90('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1a356f,_0xad90('0xc'),JSON[_0xad90('0xe')](_0x2c5b57));if(_0x2c5b57['error']){if(_0x2c5b57[_0xad90('0xf')][_0xad90('0x10')]===0x1f4){logger['error'](_0xad90('0xb'),_0x1a356f,_0x2c5b57[_0xad90('0xf')][_0xad90('0x11')]);return _0x128f6b(_0x2c5b57[_0xad90('0xf')][_0xad90('0x11')]);}logger[_0xad90('0xf')](_0xad90('0xb'),_0x1a356f,_0x2c5b57[_0xad90('0xf')]['message']);return _0x361ca3(_0x2c5b57[_0xad90('0xf')][_0xad90('0x11')]);}else{logger[_0xad90('0x12')](_0xad90('0xb'),_0x1a356f,_0xad90('0xc'));_0x361ca3(_0x2c5b57[_0xad90('0x13')]['message']);}})['catch'](function(_0x410804){logger[_0xad90('0xf')](_0xad90('0xb'),_0x1a356f,_0x410804);_0x128f6b(_0x410804);});});} \ No newline at end of file +var _0xce62=['client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3e5599,_0xa50179){var _0x596644=function(_0x1f95b6){while(--_0x1f95b6){_0x3e5599['push'](_0x3e5599['shift']());}};_0x596644(++_0xa50179);}(_0xce62,0x83));var _0x2ce6=function(_0x29e269,_0x51e954){_0x29e269=_0x29e269-0x0;var _0x4a3e09=_0xce62[_0x29e269];return _0x4a3e09;};'use strict';var _=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var moment=require('moment');var BPromise=require(_0x2ce6('0x2'));var rs=require(_0x2ce6('0x3'));var fs=require('fs');var db=require(_0x2ce6('0x4'))['db'];var utils=require(_0x2ce6('0x5'));var logger=require(_0x2ce6('0x6'))(_0x2ce6('0x7'));var config=require('../../config/environment');var jayson=require(_0x2ce6('0x8'));var client=jayson[_0x2ce6('0x9')][_0x2ce6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9bbac8,_0xcf425,_0x2c66c2){return new BPromise(function(_0x5b7f02,_0x46ef52){return client[_0x2ce6('0xb')](_0x9bbac8,_0x2c66c2)['then'](function(_0x4dc8d5){logger[_0x2ce6('0xc')](_0x2ce6('0xd'),_0xcf425,'request\x20sent');logger[_0x2ce6('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0xcf425,'request\x20sent',JSON[_0x2ce6('0xf')](_0x4dc8d5));if(_0x4dc8d5['error']){if(_0x4dc8d5[_0x2ce6('0x10')]['code']===0x1f4){logger[_0x2ce6('0x10')](_0x2ce6('0xd'),_0xcf425,_0x4dc8d5[_0x2ce6('0x10')][_0x2ce6('0x11')]);return _0x46ef52(_0x4dc8d5[_0x2ce6('0x10')][_0x2ce6('0x11')]);}logger[_0x2ce6('0x10')](_0x2ce6('0xd'),_0xcf425,_0x4dc8d5['error'][_0x2ce6('0x11')]);return _0x5b7f02(_0x4dc8d5['error'][_0x2ce6('0x11')]);}else{logger[_0x2ce6('0xc')](_0x2ce6('0xd'),_0xcf425,'request\x20sent');_0x5b7f02(_0x4dc8d5[_0x2ce6('0x12')][_0x2ce6('0x11')]);}})[_0x2ce6('0x13')](function(_0x3c1b9d){logger[_0x2ce6('0x10')](_0x2ce6('0xd'),_0xcf425,_0x3c1b9d);_0x46ef52(_0x3c1b9d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c8ec8e4..922b41b 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 _0x4861=['./voiceContext.controller','get','isAuthenticated','/:id','show','post','put','destroy','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x9625d9,_0x5b5cbe){var _0x3873e6=function(_0x8f84c3){while(--_0x8f84c3){_0x9625d9['push'](_0x9625d9['shift']());}};_0x3873e6(++_0x5b5cbe);}(_0x4861,0x1e9));var _0x1486=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4861[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0x1486('0x0'));var path=require(_0x1486('0x1'));var express=require('express');var router=express[_0x1486('0x2')]();var auth=require(_0x1486('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1486('0x4'));var controller=require(_0x1486('0x5'));router[_0x1486('0x6')]('/',auth[_0x1486('0x7')](),controller['index']);router[_0x1486('0x6')](_0x1486('0x8'),auth[_0x1486('0x7')](),controller[_0x1486('0x9')]);router[_0x1486('0xa')]('/',auth[_0x1486('0x7')](),controller['create']);router[_0x1486('0xb')](_0x1486('0x8'),auth[_0x1486('0x7')](),controller['update']);router['delete']('/:id',auth[_0x1486('0x7')](),controller[_0x1486('0xc')]);module['exports']=router; \ No newline at end of file +var _0x9271=['index','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3df5e0,_0x1a0a53){var _0x494b26=function(_0x3eb9ad){while(--_0x3eb9ad){_0x3df5e0['push'](_0x3df5e0['shift']());}};_0x494b26(++_0x1a0a53);}(_0x9271,0x1b1));var _0x1927=function(_0x909220,_0x5efcf1){_0x909220=_0x909220-0x0;var _0x5b483b=_0x9271[_0x909220];return _0x5b483b;};'use strict';var multer=require(_0x1927('0x0'));var util=require(_0x1927('0x1'));var path=require('path');var express=require(_0x1927('0x2'));var router=express[_0x1927('0x3')]();var auth=require(_0x1927('0x4'));var interaction=require(_0x1927('0x5'));var config=require(_0x1927('0x6'));var controller=require('./voiceContext.controller');router[_0x1927('0x7')]('/',auth[_0x1927('0x8')](),controller[_0x1927('0x9')]);router[_0x1927('0x7')](_0x1927('0xa'),auth[_0x1927('0x8')](),controller[_0x1927('0xb')]);router['post']('/',auth[_0x1927('0x8')](),controller[_0x1927('0xc')]);router[_0x1927('0xd')](_0x1927('0xa'),auth[_0x1927('0x8')](),controller[_0x1927('0xe')]);router[_0x1927('0xf')](_0x1927('0xa'),auth[_0x1927('0x8')](),controller[_0x1927('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f79dd7b..dc0484b 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 _0x616f=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x616f,0xe5));var _0xf616=function(_0x523414,_0x58a86a){_0x523414=_0x523414-0x0;var _0x354b87=_0x616f[_0x523414];return _0x354b87;};'use strict';var Sequelize=require(_0xf616('0x0'));module[_0xf616('0x1')]={'name':{'type':Sequelize[_0xf616('0x2')],'unique':_0xf616('0x3')},'description':{'type':Sequelize[_0xf616('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf616('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf6d6=['STRING','name','exports'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0xf6d6,0x1eb));var _0x6f6d=function(_0x5e7c7b,_0x303943){_0x5e7c7b=_0x5e7c7b-0x0;var _0x3e4b15=_0xf6d6[_0x5e7c7b];return _0x3e4b15;};'use strict';var Sequelize=require('sequelize');module[_0x6f6d('0x0')]={'name':{'type':Sequelize[_0x6f6d('0x1')],'unique':_0x6f6d('0x2')},'description':{'type':Sequelize[_0x6f6d('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 26933c8..5702e67 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 _0xe745=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','name','send','index','VoiceContext','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','map','options','includeAll','include','show','params','find','create','body','findAll','readFileSync','join','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','update','root','destroy','utf8','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0xe745,0x164));var _0x5e74=function(_0x3b8784,_0x378ebd){_0x3b8784=_0x3b8784-0x0;var _0x32339a=_0xe745[_0x3b8784];return _0x32339a;};'use strict';var jsonpatch=require(_0x5e74('0x0'));var rp=require('request-promise');var moment=require(_0x5e74('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x5e74('0x2'));var util=require(_0x5e74('0x3'));var path=require(_0x5e74('0x4'));var sox=require(_0x5e74('0x5'));var csv=require(_0x5e74('0x6'));var ejs=require(_0x5e74('0x7'));var fs=require('fs');var _=require(_0x5e74('0x8'));var squel=require(_0x5e74('0x9'));var crypto=require('crypto');var jsforce=require(_0x5e74('0xa'));var deskjs=require(_0x5e74('0xb'));var toCsv=require(_0x5e74('0x6'));var querystring=require(_0x5e74('0xc'));var Papa=require(_0x5e74('0xd'));var qs=require(_0x5e74('0xe'));var logger=require(_0x5e74('0xf'))(_0x5e74('0x10'));var utils=require(_0x5e74('0x11'));var config=require(_0x5e74('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5e74('0x13'));var client=jayson[_0x5e74('0x14')][_0x5e74('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4d34d8,_0x344b24,_0x43662f,_0x24dbab){return new BPromise(function(_0x43ed9f,_0x40a2f9){var _0x576bfe=_0x24dbab||client;return _0x576bfe['request'](_0x4d34d8,_0x43662f)[_0x5e74('0x16')](function(_0x99ac26){logger[_0x5e74('0x17')](_0x5e74('0x18'),_0x344b24,_0x5e74('0x19'));logger[_0x5e74('0x1a')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x344b24,_0x5e74('0x19'),JSON[_0x5e74('0x1b')](_0x99ac26));if(_0x99ac26[_0x5e74('0x1c')]){if(_0x99ac26[_0x5e74('0x1c')][_0x5e74('0x1d')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x344b24,_0x99ac26[_0x5e74('0x1c')][_0x5e74('0x1e')]);return _0x40a2f9(_0x99ac26[_0x5e74('0x1c')][_0x5e74('0x1e')]);}logger['error'](_0x5e74('0x18'),_0x344b24,_0x99ac26[_0x5e74('0x1c')][_0x5e74('0x1e')]);return _0x43ed9f(_0x99ac26[_0x5e74('0x1c')][_0x5e74('0x1e')]);}else{logger[_0x5e74('0x17')](_0x5e74('0x18'),_0x344b24,_0x5e74('0x19'));_0x43ed9f(_0x99ac26[_0x5e74('0x1f')][_0x5e74('0x1e')]);}})[_0x5e74('0x20')](function(_0x569d7d){logger[_0x5e74('0x1c')](_0x5e74('0x18'),_0x344b24,_0x569d7d);_0x40a2f9(_0x569d7d);});});}function respondWithStatusCode(_0x5a8c82,_0x305ab3){_0x305ab3=_0x305ab3||0xcc;return function(_0x58dea0){if(_0x58dea0){return _0x5a8c82[_0x5e74('0x21')](_0x305ab3);}return _0x5a8c82['status'](_0x305ab3)[_0x5e74('0x22')]();};}function respondWithResult(_0xdaaa78,_0x568339){_0x568339=_0x568339||0xc8;return function(_0x2cdc96){if(_0x2cdc96){return _0xdaaa78[_0x5e74('0x23')](_0x568339)[_0x5e74('0x24')](_0x2cdc96);}};}function respondWithFilteredResult(_0x33fcad,_0x50aba1){return function(_0x4ad3b4){if(_0x4ad3b4){var _0x24dc85=_0x4ad3b4[_0x5e74('0x25')],_0x4fddab=_0x50aba1[_0x5e74('0x26')],_0x375e2a=_0x50aba1['offset']+_0x50aba1['limit'],_0x2006bb;if(_0x375e2a>=_0x24dc85){_0x375e2a=_0x24dc85;_0x2006bb=0xc8;}else{_0x2006bb=0xce;}_0x33fcad[_0x5e74('0x23')](_0x2006bb);return _0x33fcad[_0x5e74('0x27')](_0x5e74('0x28'),_0x4fddab+'-'+_0x375e2a+'/'+_0x24dc85)[_0x5e74('0x24')](_0x4ad3b4);}return null;};}function patchUpdates(_0x51ce64){return function(_0x25d139){try{jsonpatch[_0x5e74('0x29')](_0x25d139,_0x51ce64,!![]);}catch(_0x39ecbe){return BPromise[_0x5e74('0x2a')](_0x39ecbe);}return _0x25d139[_0x5e74('0x2b')]();};}function saveUpdates(_0x1684e5,_0x55becc){return function(_0xd753a4){if(_0xd753a4){return _0xd753a4['update'](_0x1684e5)[_0x5e74('0x16')](function(_0x2f2ec1){return _0x2f2ec1;});}return null;};}function removeEntity(_0x48a3fb,_0xc9f19b){return function(_0x15d281){if(_0x15d281){return _0x15d281['destroy']()[_0x5e74('0x16')](function(){_0x48a3fb[_0x5e74('0x23')](0xcc)[_0x5e74('0x22')]();});}};}function handleEntityNotFound(_0x17b36f,_0xe367cc){return function(_0x4ea125){if(!_0x4ea125){_0x17b36f[_0x5e74('0x21')](0x194);}return _0x4ea125;};}function handleError(_0x49a2b8,_0x1a27d3){_0x1a27d3=_0x1a27d3||0x1f4;return function(_0x5bf344){logger[_0x5e74('0x1c')](_0x5bf344['stack']);if(_0x5bf344[_0x5e74('0x2c')]){delete _0x5bf344[_0x5e74('0x2c')];}_0x49a2b8['status'](_0x1a27d3)[_0x5e74('0x2d')](_0x5bf344);};}exports[_0x5e74('0x2e')]=function(_0x422153,_0x26ec51){var _0x551b5e={},_0x197e44={},_0x53ae0e={'count':0x0,'rows':[]};var _0x570a1c=db[_0x5e74('0x2f')][_0x5e74('0x30')];_0x197e44[_0x5e74('0x31')]=_[_0x5e74('0x32')](_0x570a1c);var _0x202ca8={'dateStart':_0x422153[_0x5e74('0x33')][_0x5e74('0x34')],'dateEnd':_0x422153[_0x5e74('0x33')]['dateEnd']};delete _0x422153[_0x5e74('0x33')]['dateStart'];delete _0x422153['query'][_0x5e74('0x35')];_0x197e44[_0x5e74('0x33')]=_[_0x5e74('0x32')](_0x422153['query']);_0x197e44[_0x5e74('0x36')]=_[_0x5e74('0x37')](_0x197e44[_0x5e74('0x31')],_0x197e44[_0x5e74('0x33')]);_0x551b5e['attributes']=_[_0x5e74('0x37')](_0x197e44['model'],qs[_0x5e74('0x38')](_0x422153[_0x5e74('0x33')]['fields']));_0x551b5e[_0x5e74('0x39')]=_0x551b5e['attributes'][_0x5e74('0x3a')]?_0x551b5e[_0x5e74('0x39')]:_0x197e44['model'];if(!_0x422153[_0x5e74('0x33')][_0x5e74('0x3b')](_0x5e74('0x3c'))){_0x551b5e[_0x5e74('0x3d')]=qs[_0x5e74('0x3d')](_0x422153[_0x5e74('0x33')]['limit']);_0x551b5e[_0x5e74('0x26')]=qs[_0x5e74('0x26')](_0x422153[_0x5e74('0x33')][_0x5e74('0x26')]);}_0x551b5e[_0x5e74('0x3e')]=qs['sort'](_0x422153['query'][_0x5e74('0x3f')]);_0x551b5e[_0x5e74('0x40')]=qs[_0x5e74('0x36')](_[_0x5e74('0x41')](_0x422153['query'],_0x197e44[_0x5e74('0x36')]));if(_0x202ca8[_0x5e74('0x34')]){if(_0x202ca8[_0x5e74('0x35')]){_0x202ca8[_0x5e74('0x35')]=moment(_0x202ca8[_0x5e74('0x35')])[_0x5e74('0x42')](0x1,_0x5e74('0x43'));}else{_0x202ca8['dateEnd']=moment(_0x202ca8[_0x5e74('0x34')])[_0x5e74('0x42')](0x1,_0x5e74('0x43'));}_[_0x5e74('0x44')](_0x551b5e[_0x5e74('0x40')],{'createdAt':{'$gte':_0x202ca8[_0x5e74('0x34')],'$lte':_0x202ca8[_0x5e74('0x35')]}});}if(_0x422153[_0x5e74('0x33')]['filter']){_0x551b5e['where']=_[_0x5e74('0x44')](_0x551b5e[_0x5e74('0x40')],{'$or':_[_0x5e74('0x45')](_0x551b5e[_0x5e74('0x39')],function(_0x3bd216){var _0x3bf1de={};_0x3bf1de[_0x3bd216]={'$like':'%'+_0x422153[_0x5e74('0x33')]['filter']+'%'};return _0x3bf1de;})});}_0x551b5e=_[_0x5e74('0x44')]({},_0x551b5e,_0x422153[_0x5e74('0x46')]);var _0x584cd9={'where':_0x551b5e[_0x5e74('0x40')]};return db[_0x5e74('0x2f')][_0x5e74('0x25')](_0x584cd9)[_0x5e74('0x16')](function(_0x18ed08){_0x53ae0e[_0x5e74('0x25')]=_0x18ed08;if(_0x422153[_0x5e74('0x33')][_0x5e74('0x47')]){_0x551b5e[_0x5e74('0x48')]=[{'all':!![]}];}return db[_0x5e74('0x2f')]['findAll'](_0x551b5e);})[_0x5e74('0x16')](function(_0x1ed473){_0x53ae0e['rows']=_0x1ed473;return _0x53ae0e;})[_0x5e74('0x16')](respondWithFilteredResult(_0x26ec51,_0x551b5e))[_0x5e74('0x20')](handleError(_0x26ec51,null));};exports[_0x5e74('0x49')]=function(_0x2c63c7,_0x431035){var _0x2e17c4={'raw':![],'where':{'id':_0x2c63c7[_0x5e74('0x4a')]['id']}},_0x4e2a51={};_0x4e2a51[_0x5e74('0x31')]=_[_0x5e74('0x32')](db[_0x5e74('0x2f')][_0x5e74('0x30')]);_0x4e2a51[_0x5e74('0x33')]=_['keys'](_0x2c63c7['query']);_0x4e2a51['filters']=_[_0x5e74('0x37')](_0x4e2a51[_0x5e74('0x31')],_0x4e2a51['query']);_0x2e17c4[_0x5e74('0x39')]=_['intersection'](_0x4e2a51[_0x5e74('0x31')],qs[_0x5e74('0x38')](_0x2c63c7[_0x5e74('0x33')][_0x5e74('0x38')]));_0x2e17c4['attributes']=_0x2e17c4[_0x5e74('0x39')][_0x5e74('0x3a')]?_0x2e17c4[_0x5e74('0x39')]:_0x4e2a51[_0x5e74('0x31')];if(_0x2c63c7[_0x5e74('0x33')][_0x5e74('0x47')]){_0x2e17c4[_0x5e74('0x48')]=[{'all':!![]}];}_0x2e17c4=_[_0x5e74('0x44')]({},_0x2e17c4,_0x2c63c7[_0x5e74('0x46')]);return db[_0x5e74('0x2f')][_0x5e74('0x4b')](_0x2e17c4)[_0x5e74('0x16')](handleEntityNotFound(_0x431035,null))[_0x5e74('0x16')](respondWithResult(_0x431035,null))[_0x5e74('0x20')](handleError(_0x431035,null));};exports[_0x5e74('0x4c')]=function(_0x55b155,_0x488a31,_0x378cb2){var _0x4e8e19;return db[_0x5e74('0x2f')]['create'](_0x55b155[_0x5e74('0x4d')],{'raw':!![]})[_0x5e74('0x16')](function(_0x40eed1){_0x4e8e19=_0x40eed1;return db['VoiceContext'][_0x5e74('0x4e')]({'raw':!![]});})[_0x5e74('0x16')](function(_0x2bce73){var _0x2d9db3=fs[_0x5e74('0x4f')](path[_0x5e74('0x50')](config['root'],_0x5e74('0x51')),'utf8');var _0x140c0a=ejs[_0x5e74('0x52')](_0x2d9db3,{'contexts':_0x2bce73||[]});fs[_0x5e74('0x53')](_0x5e74('0x54'),_0x140c0a);})[_0x5e74('0x16')](function(){return respondWithRpcPromise(_0x5e74('0x55'),_0x5e74('0x4c'),{'module':_0x5e74('0x56')});})['then'](function(){return _0x4e8e19;})['then'](respondWithResult(_0x488a31,0xc9))['catch'](handleError(_0x488a31,null));};exports[_0x5e74('0x57')]=function(_0x2b395c,_0x3c5228,_0x107424){var _0x7ea56a;return db[_0x5e74('0x2f')][_0x5e74('0x4b')]({'where':{'id':_0x2b395c[_0x5e74('0x4a')]['id']}})[_0x5e74('0x16')](handleEntityNotFound(_0x3c5228,null))['then'](saveUpdates(_0x2b395c[_0x5e74('0x4d')],null))[_0x5e74('0x16')](function(_0x14f0b5){if(_0x14f0b5){_0x7ea56a=_0x14f0b5;return db[_0x5e74('0x2f')][_0x5e74('0x4e')]({'raw':!![]});}})['then'](function(_0x5c3a96){var _0x5bff30=fs[_0x5e74('0x4f')](path['join'](config[_0x5e74('0x58')],_0x5e74('0x51')),'utf8');var _0x41fa84=ejs[_0x5e74('0x52')](_0x5bff30,{'contexts':_0x5c3a96||[]});fs[_0x5e74('0x53')](_0x5e74('0x54'),_0x41fa84);})[_0x5e74('0x16')](function(){return respondWithRpcPromise(_0x5e74('0x55'),_0x5e74('0x57'),{'module':'chan_sip.so'});})['then'](function(){return _0x7ea56a;})[_0x5e74('0x16')](respondWithResult(_0x3c5228,null))[_0x5e74('0x20')](handleError(_0x3c5228,null));};exports[_0x5e74('0x59')]=function(_0x1e945c,_0x453c7a,_0xcf7b0c){var _0x2f354b;return db[_0x5e74('0x2f')]['find']({'where':{'id':_0x1e945c['params']['id']}})['then'](handleEntityNotFound(_0x453c7a,null))['then'](removeEntity(_0x453c7a,null))[_0x5e74('0x16')](function(){return db['VoiceContext'][_0x5e74('0x4e')]({'raw':!![]});})[_0x5e74('0x16')](function(_0x55c9ab){var _0x8d9923=fs[_0x5e74('0x4f')](path['join'](config[_0x5e74('0x58')],_0x5e74('0x51')),_0x5e74('0x5a'));var _0xf75c7e=ejs['render'](_0x8d9923,{'contexts':_0x55c9ab});fs['writeFileSync'](_0x5e74('0x54'),_0xf75c7e);return respondWithRpcPromise('Reload',_0x5e74('0x59'),{'module':_0x5e74('0x56')});})['catch'](handleError(_0x453c7a,null));}; \ No newline at end of file +var _0xe9be=['utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','join','writeFileSync','Reload','find','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','VoiceContext','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','add','day','merge','map','filter','options','includeAll','include','findAll','rows','then','params','create','body','readFileSync','root','server/files/templates/context.ejs'];(function(_0x834bb6,_0x1c5e35){var _0xa35d00=function(_0x14aeb3){while(--_0x14aeb3){_0x834bb6['push'](_0x834bb6['shift']());}};_0xa35d00(++_0x1c5e35);}(_0xe9be,0xb6));var _0xee9b=function(_0x5b3e28,_0x2ad693){_0x5b3e28=_0x5b3e28-0x0;var _0x21a6f4=_0xe9be[_0x5b3e28];return _0x21a6f4;};'use strict';var jsonpatch=require(_0xee9b('0x0'));var rp=require('request-promise');var moment=require(_0xee9b('0x1'));var BPromise=require(_0xee9b('0x2'));var Mustache=require('mustache');var util=require(_0xee9b('0x3'));var path=require(_0xee9b('0x4'));var sox=require(_0xee9b('0x5'));var csv=require(_0xee9b('0x6'));var ejs=require(_0xee9b('0x7'));var fs=require('fs');var _=require(_0xee9b('0x8'));var squel=require('squel');var crypto=require(_0xee9b('0x9'));var jsforce=require(_0xee9b('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xee9b('0xb'));var Papa=require(_0xee9b('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xee9b('0xd'))('api');var utils=require('../../config/utils');var config=require(_0xee9b('0xe'));var db=require(_0xee9b('0xf'))['db'];var jayson=require(_0xee9b('0x10'));var client=jayson['client'][_0xee9b('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x24988e,_0x5b5f0d,_0x531349,_0x2e8b3c){return new BPromise(function(_0x3de1a9,_0x2e4b6b){var _0x1fe568=_0x2e8b3c||client;return _0x1fe568[_0xee9b('0x12')](_0x24988e,_0x531349)['then'](function(_0x299e9e){logger['info'](_0xee9b('0x13'),_0x5b5f0d,_0xee9b('0x14'));logger[_0xee9b('0x15')](_0xee9b('0x16'),_0x5b5f0d,_0xee9b('0x14'),JSON[_0xee9b('0x17')](_0x299e9e));if(_0x299e9e['error']){if(_0x299e9e['error'][_0xee9b('0x18')]===0x1f4){logger[_0xee9b('0x19')](_0xee9b('0x13'),_0x5b5f0d,_0x299e9e[_0xee9b('0x19')]['message']);return _0x2e4b6b(_0x299e9e['error']['message']);}logger[_0xee9b('0x19')](_0xee9b('0x13'),_0x5b5f0d,_0x299e9e[_0xee9b('0x19')][_0xee9b('0x1a')]);return _0x3de1a9(_0x299e9e[_0xee9b('0x19')]['message']);}else{logger['info'](_0xee9b('0x13'),_0x5b5f0d,_0xee9b('0x14'));_0x3de1a9(_0x299e9e[_0xee9b('0x1b')]['message']);}})[_0xee9b('0x1c')](function(_0x3c19a2){logger[_0xee9b('0x19')](_0xee9b('0x13'),_0x5b5f0d,_0x3c19a2);_0x2e4b6b(_0x3c19a2);});});}function respondWithStatusCode(_0x2e2ad8,_0x35dd6e){_0x35dd6e=_0x35dd6e||0xcc;return function(_0x1d7b26){if(_0x1d7b26){return _0x2e2ad8[_0xee9b('0x1d')](_0x35dd6e);}return _0x2e2ad8['status'](_0x35dd6e)[_0xee9b('0x1e')]();};}function respondWithResult(_0x35a36d,_0x5d63d2){_0x5d63d2=_0x5d63d2||0xc8;return function(_0x127ce3){if(_0x127ce3){return _0x35a36d[_0xee9b('0x1f')](_0x5d63d2)[_0xee9b('0x20')](_0x127ce3);}};}function respondWithFilteredResult(_0x292cfe,_0x4f6848){return function(_0xb277df){if(_0xb277df){var _0x1d0ded=_0xb277df[_0xee9b('0x21')],_0x1623a5=_0x4f6848[_0xee9b('0x22')],_0x264f8d=_0x4f6848[_0xee9b('0x22')]+_0x4f6848['limit'],_0x290ebc;if(_0x264f8d>=_0x1d0ded){_0x264f8d=_0x1d0ded;_0x290ebc=0xc8;}else{_0x290ebc=0xce;}_0x292cfe[_0xee9b('0x1f')](_0x290ebc);return _0x292cfe['set'](_0xee9b('0x23'),_0x1623a5+'-'+_0x264f8d+'/'+_0x1d0ded)[_0xee9b('0x20')](_0xb277df);}return null;};}function patchUpdates(_0x4fdcf4){return function(_0x103ec9){try{jsonpatch[_0xee9b('0x24')](_0x103ec9,_0x4fdcf4,!![]);}catch(_0x37fbc8){return BPromise[_0xee9b('0x25')](_0x37fbc8);}return _0x103ec9[_0xee9b('0x26')]();};}function saveUpdates(_0x53e81a,_0x3ce452){return function(_0x46ecf6){if(_0x46ecf6){return _0x46ecf6[_0xee9b('0x27')](_0x53e81a)['then'](function(_0x3947f5){return _0x3947f5;});}return null;};}function removeEntity(_0x372efd,_0x489493){return function(_0x4a0189){if(_0x4a0189){return _0x4a0189[_0xee9b('0x28')]()['then'](function(){_0x372efd[_0xee9b('0x1f')](0xcc)[_0xee9b('0x1e')]();});}};}function handleEntityNotFound(_0x569c21,_0x5a4b0d){return function(_0x3662b6){if(!_0x3662b6){_0x569c21['sendStatus'](0x194);}return _0x3662b6;};}function handleError(_0x2a9fc4,_0x1b1623){_0x1b1623=_0x1b1623||0x1f4;return function(_0x55cc96){logger[_0xee9b('0x19')](_0x55cc96[_0xee9b('0x29')]);if(_0x55cc96[_0xee9b('0x2a')]){delete _0x55cc96[_0xee9b('0x2a')];}_0x2a9fc4[_0xee9b('0x1f')](_0x1b1623)[_0xee9b('0x2b')](_0x55cc96);};}exports[_0xee9b('0x2c')]=function(_0x4c0184,_0x5ab9d7){var _0xff787f={},_0x4ea475={},_0x3eef51={'count':0x0,'rows':[]};var _0x1007c2=db[_0xee9b('0x2d')][_0xee9b('0x2e')];_0x4ea475['model']=_[_0xee9b('0x2f')](_0x1007c2);var _0x1002b5={'dateStart':_0x4c0184[_0xee9b('0x30')][_0xee9b('0x31')],'dateEnd':_0x4c0184[_0xee9b('0x30')]['dateEnd']};delete _0x4c0184['query']['dateStart'];delete _0x4c0184['query'][_0xee9b('0x32')];_0x4ea475[_0xee9b('0x30')]=_[_0xee9b('0x2f')](_0x4c0184[_0xee9b('0x30')]);_0x4ea475[_0xee9b('0x33')]=_[_0xee9b('0x34')](_0x4ea475['model'],_0x4ea475['query']);_0xff787f['attributes']=_[_0xee9b('0x34')](_0x4ea475[_0xee9b('0x35')],qs[_0xee9b('0x36')](_0x4c0184[_0xee9b('0x30')]['fields']));_0xff787f[_0xee9b('0x37')]=_0xff787f['attributes'][_0xee9b('0x38')]?_0xff787f['attributes']:_0x4ea475[_0xee9b('0x35')];if(!_0x4c0184[_0xee9b('0x30')][_0xee9b('0x39')]('nolimit')){_0xff787f[_0xee9b('0x3a')]=qs[_0xee9b('0x3a')](_0x4c0184[_0xee9b('0x30')][_0xee9b('0x3a')]);_0xff787f['offset']=qs[_0xee9b('0x22')](_0x4c0184[_0xee9b('0x30')]['offset']);}_0xff787f[_0xee9b('0x3b')]=qs['sort'](_0x4c0184[_0xee9b('0x30')][_0xee9b('0x3c')]);_0xff787f[_0xee9b('0x3d')]=qs[_0xee9b('0x33')](_['pick'](_0x4c0184[_0xee9b('0x30')],_0x4ea475[_0xee9b('0x33')]));if(_0x1002b5[_0xee9b('0x31')]){if(_0x1002b5['dateEnd']){_0x1002b5['dateEnd']=moment(_0x1002b5['dateEnd'])[_0xee9b('0x3e')](0x1,'day');}else{_0x1002b5[_0xee9b('0x32')]=moment(_0x1002b5[_0xee9b('0x31')])[_0xee9b('0x3e')](0x1,_0xee9b('0x3f'));}_[_0xee9b('0x40')](_0xff787f['where'],{'createdAt':{'$gte':_0x1002b5[_0xee9b('0x31')],'$lte':_0x1002b5[_0xee9b('0x32')]}});}if(_0x4c0184[_0xee9b('0x30')]['filter']){_0xff787f['where']=_[_0xee9b('0x40')](_0xff787f[_0xee9b('0x3d')],{'$or':_[_0xee9b('0x41')](_0xff787f['attributes'],function(_0x1ce4bf){var _0x39315b={};_0x39315b[_0x1ce4bf]={'$like':'%'+_0x4c0184[_0xee9b('0x30')][_0xee9b('0x42')]+'%'};return _0x39315b;})});}_0xff787f=_[_0xee9b('0x40')]({},_0xff787f,_0x4c0184[_0xee9b('0x43')]);var _0x5c81f6={'where':_0xff787f['where']};return db[_0xee9b('0x2d')][_0xee9b('0x21')](_0x5c81f6)['then'](function(_0x14736f){_0x3eef51[_0xee9b('0x21')]=_0x14736f;if(_0x4c0184[_0xee9b('0x30')][_0xee9b('0x44')]){_0xff787f[_0xee9b('0x45')]=[{'all':!![]}];}return db[_0xee9b('0x2d')][_0xee9b('0x46')](_0xff787f);})['then'](function(_0x3e1b06){_0x3eef51[_0xee9b('0x47')]=_0x3e1b06;return _0x3eef51;})[_0xee9b('0x48')](respondWithFilteredResult(_0x5ab9d7,_0xff787f))[_0xee9b('0x1c')](handleError(_0x5ab9d7,null));};exports['show']=function(_0x141dd6,_0x327a45){var _0x4bbe61={'raw':![],'where':{'id':_0x141dd6[_0xee9b('0x49')]['id']}},_0x36b9c3={};_0x36b9c3[_0xee9b('0x35')]=_[_0xee9b('0x2f')](db['VoiceContext'][_0xee9b('0x2e')]);_0x36b9c3['query']=_[_0xee9b('0x2f')](_0x141dd6['query']);_0x36b9c3['filters']=_[_0xee9b('0x34')](_0x36b9c3['model'],_0x36b9c3['query']);_0x4bbe61[_0xee9b('0x37')]=_['intersection'](_0x36b9c3[_0xee9b('0x35')],qs[_0xee9b('0x36')](_0x141dd6[_0xee9b('0x30')]['fields']));_0x4bbe61[_0xee9b('0x37')]=_0x4bbe61[_0xee9b('0x37')]['length']?_0x4bbe61[_0xee9b('0x37')]:_0x36b9c3[_0xee9b('0x35')];if(_0x141dd6['query'][_0xee9b('0x44')]){_0x4bbe61[_0xee9b('0x45')]=[{'all':!![]}];}_0x4bbe61=_[_0xee9b('0x40')]({},_0x4bbe61,_0x141dd6[_0xee9b('0x43')]);return db['VoiceContext']['find'](_0x4bbe61)[_0xee9b('0x48')](handleEntityNotFound(_0x327a45,null))[_0xee9b('0x48')](respondWithResult(_0x327a45,null))['catch'](handleError(_0x327a45,null));};exports[_0xee9b('0x4a')]=function(_0x352f4f,_0x3ef930,_0x1516db){var _0x5c336a;return db['VoiceContext'][_0xee9b('0x4a')](_0x352f4f[_0xee9b('0x4b')],{'raw':!![]})[_0xee9b('0x48')](function(_0x55f114){_0x5c336a=_0x55f114;return db['VoiceContext'][_0xee9b('0x46')]({'raw':!![]});})['then'](function(_0xd09187){var _0x495df6=fs[_0xee9b('0x4c')](path['join'](config[_0xee9b('0x4d')],_0xee9b('0x4e')),_0xee9b('0x4f'));var _0x16220f=ejs[_0xee9b('0x50')](_0x495df6,{'contexts':_0xd09187||[]});fs['writeFileSync'](_0xee9b('0x51'),_0x16220f);})[_0xee9b('0x48')](function(){return respondWithRpcPromise('Reload',_0xee9b('0x4a'),{'module':_0xee9b('0x52')});})[_0xee9b('0x48')](function(){return _0x5c336a;})[_0xee9b('0x48')](respondWithResult(_0x3ef930,0xc9))[_0xee9b('0x1c')](handleError(_0x3ef930,null));};exports[_0xee9b('0x27')]=function(_0x13333c,_0x4c696a,_0x322c09){var _0x39f5d1;return db[_0xee9b('0x2d')]['find']({'where':{'id':_0x13333c[_0xee9b('0x49')]['id']}})[_0xee9b('0x48')](handleEntityNotFound(_0x4c696a,null))[_0xee9b('0x48')](saveUpdates(_0x13333c[_0xee9b('0x4b')],null))[_0xee9b('0x48')](function(_0x724f1c){if(_0x724f1c){_0x39f5d1=_0x724f1c;return db[_0xee9b('0x2d')][_0xee9b('0x46')]({'raw':!![]});}})['then'](function(_0x3fe259){var _0x1fa30e=fs['readFileSync'](path[_0xee9b('0x53')](config[_0xee9b('0x4d')],'server/files/templates/context.ejs'),_0xee9b('0x4f'));var _0x16cd51=ejs[_0xee9b('0x50')](_0x1fa30e,{'contexts':_0x3fe259||[]});fs[_0xee9b('0x54')](_0xee9b('0x51'),_0x16cd51);})[_0xee9b('0x48')](function(){return respondWithRpcPromise(_0xee9b('0x55'),_0xee9b('0x27'),{'module':_0xee9b('0x52')});})[_0xee9b('0x48')](function(){return _0x39f5d1;})[_0xee9b('0x48')](respondWithResult(_0x4c696a,null))[_0xee9b('0x1c')](handleError(_0x4c696a,null));};exports['destroy']=function(_0x50d8c0,_0x27480a,_0x27a0af){var _0x475148;return db[_0xee9b('0x2d')][_0xee9b('0x56')]({'where':{'id':_0x50d8c0[_0xee9b('0x49')]['id']}})[_0xee9b('0x48')](handleEntityNotFound(_0x27480a,null))[_0xee9b('0x48')](removeEntity(_0x27480a,null))[_0xee9b('0x48')](function(){return db[_0xee9b('0x2d')][_0xee9b('0x46')]({'raw':!![]});})['then'](function(_0x2ad4de){var _0x10cbce=fs[_0xee9b('0x4c')](path[_0xee9b('0x53')](config['root'],'server/files/templates/context.ejs'),_0xee9b('0x4f'));var _0x3091bd=ejs[_0xee9b('0x50')](_0x10cbce,{'contexts':_0x2ad4de});fs[_0xee9b('0x54')](_0xee9b('0x51'),_0x3091bd);return respondWithRpcPromise('Reload',_0xee9b('0x28'),{'module':_0xee9b('0x52')});})[_0xee9b('0x1c')](handleError(_0x27480a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1d50bba..1c1a7fe 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 _0x3a59=['moment','bluebird','request-promise','./voiceContext.attributes','exports','VoiceContext','lodash','util'];(function(_0x408477,_0x413608){var _0x1157ff=function(_0x1872d2){while(--_0x1872d2){_0x408477['push'](_0x408477['shift']());}};_0x1157ff(++_0x413608);}(_0x3a59,0xde));var _0x93a5=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x3a59[_0xa2c0a3];return _0x52c618;};'use strict';var _=require(_0x93a5('0x0'));var util=require(_0x93a5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x93a5('0x2'));var BPromise=require(_0x93a5('0x3'));var rp=require(_0x93a5('0x4'));var attributes=require(_0x93a5('0x5'));module[_0x93a5('0x6')]=function(_0x1922d3,_0x14f66c){return _0x1922d3['define'](_0x93a5('0x7'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ef=['VoiceContext','voice_contexts','util','../../config/logger','api','bluebird','exports','define'];(function(_0x39640a,_0x2097ac){var _0x4ad510=function(_0x487a65){while(--_0x487a65){_0x39640a['push'](_0x39640a['shift']());}};_0x4ad510(++_0x2097ac);}(_0x71ef,0x18a));var _0xf71e=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x71ef[_0x58c851];return _0x534d8a;};'use strict';var _=require('lodash');var util=require(_0xf71e('0x0'));var logger=require(_0xf71e('0x1'))(_0xf71e('0x2'));var moment=require('moment');var BPromise=require(_0xf71e('0x3'));var rp=require('request-promise');var attributes=require('./voiceContext.attributes');module[_0xf71e('0x4')]=function(_0x310a49,_0x229a72){return _0x310a49[_0xf71e('0x5')](_0xf71e('0x6'),attributes,{'tableName':_0xf71e('0x7'),'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 f535ef7..54bf3e7 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 _0xedec=['request\x20sent','debug','stringify','error','VoiceContext,\x20%s,\x20%s','message','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0xedec,0xe3));var _0xcede=function(_0x8a917c,_0x19c5f6){_0x8a917c=_0x8a917c-0x0;var _0x2c704e=_0xedec[_0x8a917c];return _0x2c704e;};'use strict';var _=require(_0xcede('0x0'));var util=require(_0xcede('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xcede('0x2'))['db'];var utils=require(_0xcede('0x3'));var logger=require(_0xcede('0x4'))('rpc');var config=require(_0xcede('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xcede('0x6')][_0xcede('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa50131,_0x16bd3e,_0xc438c2){return new BPromise(function(_0x4c0923,_0x26091f){return client[_0xcede('0x8')](_0xa50131,_0xc438c2)[_0xcede('0x9')](function(_0x553712){logger[_0xcede('0xa')]('VoiceContext,\x20%s,\x20%s',_0x16bd3e,_0xcede('0xb'));logger[_0xcede('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x16bd3e,_0xcede('0xb'),JSON[_0xcede('0xd')](_0x553712));if(_0x553712[_0xcede('0xe')]){if(_0x553712['error']['code']===0x1f4){logger[_0xcede('0xe')](_0xcede('0xf'),_0x16bd3e,_0x553712['error'][_0xcede('0x10')]);return _0x26091f(_0x553712[_0xcede('0xe')][_0xcede('0x10')]);}logger[_0xcede('0xe')]('VoiceContext,\x20%s,\x20%s',_0x16bd3e,_0x553712['error'][_0xcede('0x10')]);return _0x4c0923(_0x553712[_0xcede('0xe')][_0xcede('0x10')]);}else{logger[_0xcede('0xa')](_0xcede('0xf'),_0x16bd3e,'request\x20sent');_0x4c0923(_0x553712['result']['message']);}})['catch'](function(_0x21365a){logger['error']('VoiceContext,\x20%s,\x20%s',_0x16bd3e,_0x21365a);_0x26091f(_0x21365a);});});} \ No newline at end of file +var _0x4330=['jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x4330,0x1bf));var _0x0433=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4330[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0433('0x0'));var util=require('util');var moment=require(_0x0433('0x1'));var BPromise=require(_0x0433('0x2'));var rs=require(_0x0433('0x3'));var fs=require('fs');var db=require(_0x0433('0x4'))['db'];var utils=require(_0x0433('0x5'));var logger=require(_0x0433('0x6'))(_0x0433('0x7'));var config=require(_0x0433('0x8'));var jayson=require(_0x0433('0x9'));var client=jayson[_0x0433('0xa')][_0x0433('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e00f0,_0x249fb6,_0x582185){return new BPromise(function(_0x458e09,_0x31e248){return client['request'](_0x4e00f0,_0x582185)[_0x0433('0xc')](function(_0x24c077){logger[_0x0433('0xd')](_0x0433('0xe'),_0x249fb6,_0x0433('0xf'));logger[_0x0433('0x10')](_0x0433('0x11'),_0x249fb6,'request\x20sent',JSON[_0x0433('0x12')](_0x24c077));if(_0x24c077['error']){if(_0x24c077['error'][_0x0433('0x13')]===0x1f4){logger[_0x0433('0x14')](_0x0433('0xe'),_0x249fb6,_0x24c077['error'][_0x0433('0x15')]);return _0x31e248(_0x24c077[_0x0433('0x14')]['message']);}logger['error'](_0x0433('0xe'),_0x249fb6,_0x24c077['error']['message']);return _0x458e09(_0x24c077[_0x0433('0x14')][_0x0433('0x15')]);}else{logger[_0x0433('0xd')](_0x0433('0xe'),_0x249fb6,_0x0433('0xf'));_0x458e09(_0x24c077[_0x0433('0x16')][_0x0433('0x15')]);}})[_0x0433('0x17')](function(_0x2d77ba){logger[_0x0433('0x14')](_0x0433('0xe'),_0x249fb6,_0x2d77ba);_0x31e248(_0x2d77ba);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d648ac8..9a757b9 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 _0x5f2f=['/describe','describe','/:id','show','create','put','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x40b96c,_0x5cf648){var _0x5a4ca3=function(_0x59a388){while(--_0x59a388){_0x40b96c['push'](_0x40b96c['shift']());}};_0x5a4ca3(++_0x5cf648);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4cc6e7,_0x4d1e8e){_0x4cc6e7=_0x4cc6e7-0x0;var _0x240ba2=_0x5f2f[_0x4cc6e7];return _0x240ba2;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var express=require(_0xf5f2('0x3'));var router=express[_0xf5f2('0x4')]();var auth=require(_0xf5f2('0x5'));var interaction=require(_0xf5f2('0x6'));var config=require(_0xf5f2('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xc')]);router['get'](_0xf5f2('0xd'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xe')]);router['post']('/',auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/:id',auth[_0xf5f2('0x8')](),controller['update']);router['delete'](_0xf5f2('0xd'),auth[_0xf5f2('0x8')](),controller['destroy']);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x814b=['path','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x49369c,_0x2581f0){var _0x9a3c85=function(_0x254bb8){while(--_0x254bb8){_0x49369c['push'](_0x49369c['shift']());}};_0x9a3c85(++_0x2581f0);}(_0x814b,0x1a2));var _0xb814=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x814b[_0x53f897];return _0x6879f8;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var express=require(_0xb814('0x3'));var router=express[_0xb814('0x4')]();var auth=require(_0xb814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb814('0x6'));var controller=require(_0xb814('0x7'));router[_0xb814('0x8')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xa')]);router[_0xb814('0x8')]('/describe',auth[_0xb814('0x9')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0x9')](),controller[_0xb814('0xd')]);router[_0xb814('0xe')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xc'),auth[_0xb814('0x9')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')]('/:id',auth[_0xb814('0x9')](),controller['destroy']);module[_0xb814('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index d8f98d4..63d610f 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 _0x64c4=['INTEGER','DATE','exports','STRING'];(function(_0x4d7585,_0x393069){var _0x5b6340=function(_0x16b22e){while(--_0x16b22e){_0x4d7585['push'](_0x4d7585['shift']());}};_0x5b6340(++_0x393069);}(_0x64c4,0x13a));var _0x464c=function(_0x3ece88,_0x32a412){_0x3ece88=_0x3ece88-0x0;var _0x53bf98=_0x64c4[_0x3ece88];return _0x53bf98;};'use strict';var Sequelize=require('sequelize');module[_0x464c('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x464c('0x1')]},'channelstate':{'type':Sequelize[_0x464c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x464c('0x1')]},'calleridname':{'type':Sequelize[_0x464c('0x1')]},'connectedlinenum':{'type':Sequelize[_0x464c('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x464c('0x1')]},'accountcode':{'type':Sequelize[_0x464c('0x1')]},'context':{'type':Sequelize[_0x464c('0x1')]},'exten':{'type':Sequelize[_0x464c('0x1')]},'priority':{'type':Sequelize[_0x464c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x464c('0x1')]},'destchannel':{'type':Sequelize[_0x464c('0x1')]},'destchannelstate':{'type':Sequelize[_0x464c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x464c('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x464c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x464c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x464c('0x1')]},'destlanguage':{'type':Sequelize[_0x464c('0x1')]},'destaccountcode':{'type':Sequelize[_0x464c('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x464c('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x464c('0x1')]},'destlinkedid':{'type':Sequelize[_0x464c('0x1')]},'dialstring':{'type':Sequelize[_0x464c('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x464c('0x3')]},'lastevent':{'type':Sequelize[_0x464c('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x464c('0x2')]},'duration':{'type':Sequelize[_0x464c('0x2')]},'holdtime':{'type':Sequelize[_0x464c('0x2')]},'billableseconds':{'type':Sequelize[_0x464c('0x2')]}}; \ No newline at end of file +var _0xf220=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf220,0x113));var _0x0f22=function(_0x1613b7,_0x167deb){_0x1613b7=_0x1613b7-0x0;var _0x5c382e=_0xf220[_0x1613b7];return _0x5c382e;};'use strict';var Sequelize=require('sequelize');module[_0x0f22('0x0')]={'privilege':{'type':Sequelize[_0x0f22('0x1')]},'channel':{'type':Sequelize[_0x0f22('0x1')]},'channelstate':{'type':Sequelize[_0x0f22('0x2')]},'channelstatedesc':{'type':Sequelize[_0x0f22('0x1')]},'calleridnum':{'type':Sequelize[_0x0f22('0x1')]},'calleridname':{'type':Sequelize[_0x0f22('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0f22('0x1')]},'connectedlinename':{'type':Sequelize[_0x0f22('0x1')]},'language':{'type':Sequelize[_0x0f22('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0f22('0x1')]},'exten':{'type':Sequelize[_0x0f22('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x0f22('0x1')]},'linkedid':{'type':Sequelize[_0x0f22('0x1')]},'destchannel':{'type':Sequelize[_0x0f22('0x1')]},'destchannelstate':{'type':Sequelize[_0x0f22('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x0f22('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0f22('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0f22('0x1')]},'destcontext':{'type':Sequelize[_0x0f22('0x1')]},'destexten':{'type':Sequelize[_0x0f22('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x0f22('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x0f22('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0f22('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x0f22('0x4')},'routeId':{'type':Sequelize[_0x0f22('0x2')]},'duration':{'type':Sequelize[_0x0f22('0x2')]},'holdtime':{'type':Sequelize[_0x0f22('0x2')]},'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 3df27b8..3687488 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 _0x984e=['params','find','create','body','describe','fast-json-patch','request-promise','moment','mustache','util','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','then','includeAll','include','findAll','catch','show'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x984e,0x163));var _0xe984=function(_0xcda733,_0xb6a901){_0xcda733=_0xcda733-0x0;var _0x543f15=_0x984e[_0xcda733];return _0x543f15;};'use strict';var jsonpatch=require(_0xe984('0x0'));var rp=require(_0xe984('0x1'));var moment=require(_0xe984('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe984('0x3'));var util=require(_0xe984('0x4'));var path=require('path');var sox=require(_0xe984('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe984('0x6'));var crypto=require(_0xe984('0x7'));var jsforce=require(_0xe984('0x8'));var deskjs=require(_0xe984('0x9'));var toCsv=require('to-csv');var querystring=require(_0xe984('0xa'));var Papa=require(_0xe984('0xb'));var qs=require(_0xe984('0xc'));var logger=require(_0xe984('0xd'))(_0xe984('0xe'));var utils=require(_0xe984('0xf'));var config=require('../../config/environment');var db=require(_0xe984('0x10'))['db'];function respondWithStatusCode(_0x1760e8,_0x4c2542){_0x4c2542=_0x4c2542||0xcc;return function(_0x3a2d84){if(_0x3a2d84){return _0x1760e8[_0xe984('0x11')](_0x4c2542);}return _0x1760e8['status'](_0x4c2542)[_0xe984('0x12')]();};}function respondWithResult(_0x3c9b13,_0x3604be){_0x3604be=_0x3604be||0xc8;return function(_0x383524){if(_0x383524){return _0x3c9b13['status'](_0x3604be)[_0xe984('0x13')](_0x383524);}};}function respondWithFilteredResult(_0x300e35,_0x1a27b4){return function(_0x17ec96){if(_0x17ec96){var _0x26d322=_0x17ec96[_0xe984('0x14')],_0x385e1f=_0x1a27b4[_0xe984('0x15')],_0x473b28=_0x1a27b4[_0xe984('0x15')]+_0x1a27b4[_0xe984('0x16')],_0x5a4e4f;if(_0x473b28>=_0x26d322){_0x473b28=_0x26d322;_0x5a4e4f=0xc8;}else{_0x5a4e4f=0xce;}_0x300e35[_0xe984('0x17')](_0x5a4e4f);return _0x300e35[_0xe984('0x18')](_0xe984('0x19'),_0x385e1f+'-'+_0x473b28+'/'+_0x26d322)[_0xe984('0x13')](_0x17ec96);}return null;};}function patchUpdates(_0xbba70f){return function(_0x41893e){try{jsonpatch[_0xe984('0x1a')](_0x41893e,_0xbba70f,!![]);}catch(_0x2c0ffe){return BPromise[_0xe984('0x1b')](_0x2c0ffe);}return _0x41893e['save']();};}function saveUpdates(_0x1e0b40,_0x5e70f4){return function(_0x1f61e3){if(_0x1f61e3){return _0x1f61e3[_0xe984('0x1c')](_0x1e0b40)['then'](function(_0x51fffc){return _0x51fffc;});}return null;};}function removeEntity(_0x3c58f7,_0x302cbd){return function(_0x4faaad){if(_0x4faaad){return _0x4faaad[_0xe984('0x1d')]()['then'](function(){_0x3c58f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20a041,_0xf11d0d){return function(_0x3df250){if(!_0x3df250){_0x20a041[_0xe984('0x11')](0x194);}return _0x3df250;};}function handleError(_0x3b6920,_0x5aa364){_0x5aa364=_0x5aa364||0x1f4;return function(_0x375768){logger[_0xe984('0x1e')](_0x375768[_0xe984('0x1f')]);if(_0x375768[_0xe984('0x20')]){delete _0x375768[_0xe984('0x20')];}_0x3b6920[_0xe984('0x17')](_0x5aa364)[_0xe984('0x21')](_0x375768);};}exports[_0xe984('0x22')]=function(_0x26163f,_0x5b2f21){var _0x5750d9={},_0x570eda={},_0x12e1c2={'count':0x0,'rows':[]};var _0x833487=db[_0xe984('0x23')][_0xe984('0x24')];_0x570eda['model']=_[_0xe984('0x25')](_0x833487);var _0x33aef7={'dateStart':_0x26163f[_0xe984('0x26')][_0xe984('0x27')],'dateEnd':_0x26163f[_0xe984('0x26')]['dateEnd']};delete _0x26163f[_0xe984('0x26')][_0xe984('0x27')];delete _0x26163f['query'][_0xe984('0x28')];_0x570eda[_0xe984('0x26')]=_[_0xe984('0x25')](_0x26163f['query']);_0x570eda[_0xe984('0x29')]=_[_0xe984('0x2a')](_0x570eda[_0xe984('0x2b')],_0x570eda[_0xe984('0x26')]);_0x5750d9[_0xe984('0x2c')]=_[_0xe984('0x2a')](_0x570eda['model'],qs[_0xe984('0x2d')](_0x26163f[_0xe984('0x26')][_0xe984('0x2d')]));_0x5750d9[_0xe984('0x2c')]=_0x5750d9[_0xe984('0x2c')][_0xe984('0x2e')]?_0x5750d9[_0xe984('0x2c')]:_0x570eda[_0xe984('0x2b')];if(!_0x26163f[_0xe984('0x26')][_0xe984('0x2f')](_0xe984('0x30'))){_0x5750d9['limit']=qs['limit'](_0x26163f[_0xe984('0x26')][_0xe984('0x16')]);_0x5750d9[_0xe984('0x15')]=qs[_0xe984('0x15')](_0x26163f[_0xe984('0x26')][_0xe984('0x15')]);}_0x5750d9[_0xe984('0x31')]=qs[_0xe984('0x32')](_0x26163f[_0xe984('0x26')][_0xe984('0x32')]);_0x5750d9[_0xe984('0x33')]=qs[_0xe984('0x29')](_[_0xe984('0x34')](_0x26163f[_0xe984('0x26')],_0x570eda[_0xe984('0x29')]));if(_0x33aef7['dateStart']){if(_0x33aef7[_0xe984('0x28')]){_0x33aef7[_0xe984('0x28')]=moment(_0x33aef7[_0xe984('0x28')])[_0xe984('0x35')](0x1,'day');}else{_0x33aef7['dateEnd']=moment(_0x33aef7[_0xe984('0x27')])[_0xe984('0x35')](0x1,_0xe984('0x36'));}_[_0xe984('0x37')](_0x5750d9[_0xe984('0x33')],{'createdAt':{'$gte':_0x33aef7[_0xe984('0x27')],'$lte':_0x33aef7[_0xe984('0x28')]}});}if(_0x26163f[_0xe984('0x26')][_0xe984('0x38')]){_0x5750d9['where']=_[_0xe984('0x37')](_0x5750d9['where'],{'$or':_[_0xe984('0x39')](_0x5750d9[_0xe984('0x2c')],function(_0xd202f3){var _0x184367={};_0x184367[_0xd202f3]={'$like':'%'+_0x26163f['query']['filter']+'%'};return _0x184367;})});}_0x5750d9=_[_0xe984('0x37')]({},_0x5750d9,_0x26163f[_0xe984('0x3a')]);var _0x3f10d6={'where':_0x5750d9[_0xe984('0x33')]};return db['VoiceDialReport']['count'](_0x3f10d6)[_0xe984('0x3b')](function(_0x3bd50e){_0x12e1c2[_0xe984('0x14')]=_0x3bd50e;if(_0x26163f[_0xe984('0x26')][_0xe984('0x3c')]){_0x5750d9[_0xe984('0x3d')]=[{'all':!![]}];}return db[_0xe984('0x23')][_0xe984('0x3e')](_0x5750d9);})[_0xe984('0x3b')](function(_0x5c1f5b){_0x12e1c2['rows']=_0x5c1f5b;return _0x12e1c2;})[_0xe984('0x3b')](respondWithFilteredResult(_0x5b2f21,_0x5750d9))[_0xe984('0x3f')](handleError(_0x5b2f21,null));};exports[_0xe984('0x40')]=function(_0x3e4e86,_0x63d0d4){var _0x3ba14c={'raw':!![],'where':{'id':_0x3e4e86[_0xe984('0x41')]['id']}},_0x5f2fe7={};_0x5f2fe7['model']=_[_0xe984('0x25')](db[_0xe984('0x23')][_0xe984('0x24')]);_0x5f2fe7['query']=_[_0xe984('0x25')](_0x3e4e86[_0xe984('0x26')]);_0x5f2fe7['filters']=_['intersection'](_0x5f2fe7['model'],_0x5f2fe7[_0xe984('0x26')]);_0x3ba14c[_0xe984('0x2c')]=_['intersection'](_0x5f2fe7[_0xe984('0x2b')],qs[_0xe984('0x2d')](_0x3e4e86[_0xe984('0x26')]['fields']));_0x3ba14c[_0xe984('0x2c')]=_0x3ba14c[_0xe984('0x2c')]['length']?_0x3ba14c['attributes']:_0x5f2fe7[_0xe984('0x2b')];if(_0x3e4e86[_0xe984('0x26')][_0xe984('0x3c')]){_0x3ba14c[_0xe984('0x3d')]=[{'all':!![]}];}_0x3ba14c=_[_0xe984('0x37')]({},_0x3ba14c,_0x3e4e86[_0xe984('0x3a')]);return db[_0xe984('0x23')][_0xe984('0x42')](_0x3ba14c)[_0xe984('0x3b')](handleEntityNotFound(_0x63d0d4,null))['then'](respondWithResult(_0x63d0d4,null))[_0xe984('0x3f')](handleError(_0x63d0d4,null));};exports['create']=function(_0x3c714d,_0x5f0267){return db['VoiceDialReport'][_0xe984('0x43')](_0x3c714d[_0xe984('0x44')],{})['then'](respondWithResult(_0x5f0267,0xc9))[_0xe984('0x3f')](handleError(_0x5f0267,null));};exports[_0xe984('0x1c')]=function(_0x4b693b,_0x4fe000){if(_0x4b693b[_0xe984('0x44')]['id']){delete _0x4b693b['body']['id'];}return db['VoiceDialReport'][_0xe984('0x42')]({'where':{'id':_0x4b693b['params']['id']}})[_0xe984('0x3b')](handleEntityNotFound(_0x4fe000,null))['then'](saveUpdates(_0x4b693b['body'],null))[_0xe984('0x3b')](respondWithResult(_0x4fe000,null))[_0xe984('0x3f')](handleError(_0x4fe000,null));};exports[_0xe984('0x1d')]=function(_0xc43a9,_0x1fdd4e){return db[_0xe984('0x23')][_0xe984('0x42')]({'where':{'id':_0xc43a9['params']['id']}})[_0xe984('0x3b')](handleEntityNotFound(_0x1fdd4e,null))[_0xe984('0x3b')](removeEntity(_0x1fdd4e,null))[_0xe984('0x3f')](handleError(_0x1fdd4e,null));};exports[_0xe984('0x45')]=function(_0x351cc8,_0x34814d){return db[_0xe984('0x23')][_0xe984('0x45')]()[_0xe984('0x3b')](respondWithResult(_0x34814d,null))[_0xe984('0x3f')](handleError(_0x34814d,null));}; \ No newline at end of file +var _0x3ec4=['body','describe','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','crypto','jsforce','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','send','index','VoiceDialReport','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','options','count','then','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x343c76,_0x1cac3a){var _0x1bb83=function(_0x23874a){while(--_0x23874a){_0x343c76['push'](_0x343c76['shift']());}};_0x1bb83(++_0x1cac3a);}(_0x3ec4,0x14c));var _0x43ec=function(_0x2e2013,_0x1d6093){_0x2e2013=_0x2e2013-0x0;var _0x3d3b57=_0x3ec4[_0x2e2013];return _0x3d3b57;};'use strict';var jsonpatch=require(_0x43ec('0x0'));var rp=require(_0x43ec('0x1'));var moment=require(_0x43ec('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x43ec('0x3'));var util=require(_0x43ec('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x43ec('0x5'));var ejs=require(_0x43ec('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x43ec('0x7'));var jsforce=require(_0x43ec('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x43ec('0x9'));var utils=require(_0x43ec('0xa'));var config=require(_0x43ec('0xb'));var db=require(_0x43ec('0xc'))['db'];function respondWithStatusCode(_0xced3c1,_0x56e753){_0x56e753=_0x56e753||0xcc;return function(_0x231c2b){if(_0x231c2b){return _0xced3c1['sendStatus'](_0x56e753);}return _0xced3c1['status'](_0x56e753)[_0x43ec('0xd')]();};}function respondWithResult(_0x472021,_0x397ba0){_0x397ba0=_0x397ba0||0xc8;return function(_0x352a19){if(_0x352a19){return _0x472021[_0x43ec('0xe')](_0x397ba0)[_0x43ec('0xf')](_0x352a19);}};}function respondWithFilteredResult(_0x570024,_0x4265ad){return function(_0x1fde52){if(_0x1fde52){var _0x172efb=_0x1fde52['count'],_0x4df581=_0x4265ad[_0x43ec('0x10')],_0x482340=_0x4265ad[_0x43ec('0x10')]+_0x4265ad[_0x43ec('0x11')],_0xcd1ca4;if(_0x482340>=_0x172efb){_0x482340=_0x172efb;_0xcd1ca4=0xc8;}else{_0xcd1ca4=0xce;}_0x570024[_0x43ec('0xe')](_0xcd1ca4);return _0x570024[_0x43ec('0x12')](_0x43ec('0x13'),_0x4df581+'-'+_0x482340+'/'+_0x172efb)[_0x43ec('0xf')](_0x1fde52);}return null;};}function patchUpdates(_0x4d6988){return function(_0x61acde){try{jsonpatch[_0x43ec('0x14')](_0x61acde,_0x4d6988,!![]);}catch(_0x4e8fa5){return BPromise['reject'](_0x4e8fa5);}return _0x61acde[_0x43ec('0x15')]();};}function saveUpdates(_0x607216,_0x2a277f){return function(_0x1a8b10){if(_0x1a8b10){return _0x1a8b10[_0x43ec('0x16')](_0x607216)['then'](function(_0x47003f){return _0x47003f;});}return null;};}function removeEntity(_0x2e2be9,_0x2e4f3b){return function(_0x48cd99){if(_0x48cd99){return _0x48cd99[_0x43ec('0x17')]()['then'](function(){_0x2e2be9['status'](0xcc)[_0x43ec('0xd')]();});}};}function handleEntityNotFound(_0x32ce0d,_0x1f80fb){return function(_0x3e0fcd){if(!_0x3e0fcd){_0x32ce0d[_0x43ec('0x18')](0x194);}return _0x3e0fcd;};}function handleError(_0x1241ea,_0x37467a){_0x37467a=_0x37467a||0x1f4;return function(_0x47049a){logger[_0x43ec('0x19')](_0x47049a[_0x43ec('0x1a')]);if(_0x47049a[_0x43ec('0x1b')]){delete _0x47049a['name'];}_0x1241ea[_0x43ec('0xe')](_0x37467a)[_0x43ec('0x1c')](_0x47049a);};}exports[_0x43ec('0x1d')]=function(_0x5acf07,_0x2ce05f){var _0x54547a={},_0x33d71a={},_0x3a66ae={'count':0x0,'rows':[]};var _0x5ae45c=db[_0x43ec('0x1e')][_0x43ec('0x1f')];_0x33d71a[_0x43ec('0x20')]=_[_0x43ec('0x21')](_0x5ae45c);var _0x58945a={'dateStart':_0x5acf07[_0x43ec('0x22')][_0x43ec('0x23')],'dateEnd':_0x5acf07['query'][_0x43ec('0x24')]};delete _0x5acf07[_0x43ec('0x22')][_0x43ec('0x23')];delete _0x5acf07[_0x43ec('0x22')][_0x43ec('0x24')];_0x33d71a[_0x43ec('0x22')]=_[_0x43ec('0x21')](_0x5acf07['query']);_0x33d71a['filters']=_[_0x43ec('0x25')](_0x33d71a[_0x43ec('0x20')],_0x33d71a[_0x43ec('0x22')]);_0x54547a[_0x43ec('0x26')]=_[_0x43ec('0x25')](_0x33d71a[_0x43ec('0x20')],qs['fields'](_0x5acf07[_0x43ec('0x22')][_0x43ec('0x27')]));_0x54547a['attributes']=_0x54547a[_0x43ec('0x26')][_0x43ec('0x28')]?_0x54547a[_0x43ec('0x26')]:_0x33d71a['model'];if(!_0x5acf07[_0x43ec('0x22')][_0x43ec('0x29')](_0x43ec('0x2a'))){_0x54547a[_0x43ec('0x11')]=qs[_0x43ec('0x11')](_0x5acf07[_0x43ec('0x22')][_0x43ec('0x11')]);_0x54547a[_0x43ec('0x10')]=qs[_0x43ec('0x10')](_0x5acf07[_0x43ec('0x22')][_0x43ec('0x10')]);}_0x54547a[_0x43ec('0x2b')]=qs[_0x43ec('0x2c')](_0x5acf07[_0x43ec('0x22')]['sort']);_0x54547a[_0x43ec('0x2d')]=qs[_0x43ec('0x2e')](_[_0x43ec('0x2f')](_0x5acf07[_0x43ec('0x22')],_0x33d71a[_0x43ec('0x2e')]));if(_0x58945a['dateStart']){if(_0x58945a['dateEnd']){_0x58945a[_0x43ec('0x24')]=moment(_0x58945a[_0x43ec('0x24')])[_0x43ec('0x30')](0x1,_0x43ec('0x31'));}else{_0x58945a[_0x43ec('0x24')]=moment(_0x58945a[_0x43ec('0x23')])[_0x43ec('0x30')](0x1,_0x43ec('0x31'));}_[_0x43ec('0x32')](_0x54547a['where'],{'createdAt':{'$gte':_0x58945a[_0x43ec('0x23')],'$lte':_0x58945a[_0x43ec('0x24')]}});}if(_0x5acf07[_0x43ec('0x22')][_0x43ec('0x33')]){_0x54547a[_0x43ec('0x2d')]=_['merge'](_0x54547a[_0x43ec('0x2d')],{'$or':_['map'](_0x54547a['attributes'],function(_0x563837){var _0x1e96cf={};_0x1e96cf[_0x563837]={'$like':'%'+_0x5acf07[_0x43ec('0x22')][_0x43ec('0x33')]+'%'};return _0x1e96cf;})});}_0x54547a=_[_0x43ec('0x32')]({},_0x54547a,_0x5acf07[_0x43ec('0x34')]);var _0x3f562b={'where':_0x54547a[_0x43ec('0x2d')]};return db[_0x43ec('0x1e')][_0x43ec('0x35')](_0x3f562b)[_0x43ec('0x36')](function(_0x3fe83c){_0x3a66ae[_0x43ec('0x35')]=_0x3fe83c;if(_0x5acf07[_0x43ec('0x22')][_0x43ec('0x37')]){_0x54547a[_0x43ec('0x38')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x43ec('0x39')](_0x54547a);})[_0x43ec('0x36')](function(_0x346b63){_0x3a66ae[_0x43ec('0x3a')]=_0x346b63;return _0x3a66ae;})['then'](respondWithFilteredResult(_0x2ce05f,_0x54547a))[_0x43ec('0x3b')](handleError(_0x2ce05f,null));};exports[_0x43ec('0x3c')]=function(_0x2588c1,_0x456ea9){var _0x1b6bc6={'raw':!![],'where':{'id':_0x2588c1[_0x43ec('0x3d')]['id']}},_0x36027f={};_0x36027f[_0x43ec('0x20')]=_[_0x43ec('0x21')](db[_0x43ec('0x1e')][_0x43ec('0x1f')]);_0x36027f['query']=_[_0x43ec('0x21')](_0x2588c1[_0x43ec('0x22')]);_0x36027f[_0x43ec('0x2e')]=_[_0x43ec('0x25')](_0x36027f[_0x43ec('0x20')],_0x36027f[_0x43ec('0x22')]);_0x1b6bc6['attributes']=_['intersection'](_0x36027f[_0x43ec('0x20')],qs['fields'](_0x2588c1['query'][_0x43ec('0x27')]));_0x1b6bc6[_0x43ec('0x26')]=_0x1b6bc6[_0x43ec('0x26')][_0x43ec('0x28')]?_0x1b6bc6['attributes']:_0x36027f['model'];if(_0x2588c1[_0x43ec('0x22')]['includeAll']){_0x1b6bc6[_0x43ec('0x38')]=[{'all':!![]}];}_0x1b6bc6=_[_0x43ec('0x32')]({},_0x1b6bc6,_0x2588c1[_0x43ec('0x34')]);return db['VoiceDialReport'][_0x43ec('0x3e')](_0x1b6bc6)[_0x43ec('0x36')](handleEntityNotFound(_0x456ea9,null))[_0x43ec('0x36')](respondWithResult(_0x456ea9,null))['catch'](handleError(_0x456ea9,null));};exports[_0x43ec('0x3f')]=function(_0x1d9fab,_0x460133){return db['VoiceDialReport']['create'](_0x1d9fab[_0x43ec('0x40')],{})['then'](respondWithResult(_0x460133,0xc9))[_0x43ec('0x3b')](handleError(_0x460133,null));};exports['update']=function(_0x19f539,_0x3cb13a){if(_0x19f539[_0x43ec('0x40')]['id']){delete _0x19f539[_0x43ec('0x40')]['id'];}return db['VoiceDialReport'][_0x43ec('0x3e')]({'where':{'id':_0x19f539[_0x43ec('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3cb13a,null))['then'](saveUpdates(_0x19f539['body'],null))[_0x43ec('0x36')](respondWithResult(_0x3cb13a,null))[_0x43ec('0x3b')](handleError(_0x3cb13a,null));};exports['destroy']=function(_0x1232c3,_0x371f54){return db[_0x43ec('0x1e')][_0x43ec('0x3e')]({'where':{'id':_0x1232c3[_0x43ec('0x3d')]['id']}})[_0x43ec('0x36')](handleEntityNotFound(_0x371f54,null))[_0x43ec('0x36')](removeEntity(_0x371f54,null))[_0x43ec('0x3b')](handleError(_0x371f54,null));};exports['describe']=function(_0x19a7a4,_0x532cd9){return db[_0x43ec('0x1e')][_0x43ec('0x41')]()[_0x43ec('0x36')](respondWithResult(_0x532cd9,null))[_0x43ec('0x3b')](handleError(_0x532cd9,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9287afb..a8bfcb4 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 _0x1acf=['request-promise','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3ab4fa,_0x3e4db2){var _0x3509e2=function(_0x4ffdce){while(--_0x4ffdce){_0x3ab4fa['push'](_0x3ab4fa['shift']());}};_0x3509e2(++_0x3e4db2);}(_0x1acf,0x11b));var _0xf1ac=function(_0x426fba,_0x419130){_0x426fba=_0x426fba-0x0;var _0x489ccb=_0x1acf[_0x426fba];return _0x489ccb;};'use strict';var _=require(_0xf1ac('0x0'));var util=require('util');var logger=require(_0xf1ac('0x1'))(_0xf1ac('0x2'));var moment=require(_0xf1ac('0x3'));var BPromise=require(_0xf1ac('0x4'));var rp=require(_0xf1ac('0x5'));var attributes=require(_0xf1ac('0x6'));module[_0xf1ac('0x7')]=function(_0x150c61,_0x284e99){return _0x150c61[_0xf1ac('0x8')](_0xf1ac('0x9'),attributes,{'tableName':_0xf1ac('0xa'),'paranoid':![],'indexes':[{'fields':[_0xf1ac('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x660e=['define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','moment','bluebird','exports'];(function(_0x151c21,_0x54df13){var _0x5a9f37=function(_0x4f5605){while(--_0x4f5605){_0x151c21['push'](_0x151c21['shift']());}};_0x5a9f37(++_0x54df13);}(_0x660e,0xf7));var _0xe660=function(_0x29f8f1,_0x5e3d30){_0x29f8f1=_0x29f8f1-0x0;var _0x303eef=_0x660e[_0x29f8f1];return _0x303eef;};'use strict';var _=require(_0xe660('0x0'));var util=require('util');var logger=require(_0xe660('0x1'))('api');var moment=require(_0xe660('0x2'));var BPromise=require(_0xe660('0x3'));var rp=require('request-promise');var attributes=require('./voiceDialReport.attributes');module[_0xe660('0x4')]=function(_0x4de113,_0x1fa650){return _0x4de113[_0xe660('0x5')](_0xe660('0x6'),attributes,{'tableName':_0xe660('0x7'),'paranoid':![],'indexes':[{'fields':[_0xe660('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 7484fa2..d118ab3 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 _0x9f0e=['update','where','attributes','limit','stringify','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2f7563,_0x3b50e4){_0x2f7563=_0x2f7563-0x0;var _0x56bf88=_0x9f0e[_0x2f7563];return _0x56bf88;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe9f0('0x5'))(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var jayson=require(_0xe9f0('0x8'));var client=jayson[_0xe9f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b87c1,_0x3a17b3,_0x167198){return new BPromise(function(_0xe64a79,_0x4be6a6){return client[_0xe9f0('0xa')](_0x5b87c1,_0x167198)[_0xe9f0('0xb')](function(_0x20d602){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x3a17b3,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x3a17b3,_0xe9f0('0xe'),JSON['stringify'](_0x20d602));if(_0x20d602[_0xe9f0('0x11')]){if(_0x20d602[_0xe9f0('0x11')][_0xe9f0('0x12')]===0x1f4){logger['error'](_0xe9f0('0xd'),_0x3a17b3,_0x20d602['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x20d602[_0xe9f0('0x11')][_0xe9f0('0x13')]);}logger[_0xe9f0('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3a17b3,_0x20d602[_0xe9f0('0x11')]['message']);return _0xe64a79(_0x20d602[_0xe9f0('0x11')][_0xe9f0('0x13')]);}else{logger[_0xe9f0('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x3a17b3,_0xe9f0('0xe'));_0xe64a79(_0x20d602[_0xe9f0('0x14')][_0xe9f0('0x13')]);}})['catch'](function(_0xaa7aa6){logger[_0xe9f0('0x11')](_0xe9f0('0xd'),_0x3a17b3,_0xaa7aa6);_0x4be6a6(_0xaa7aa6);});});}exports[_0xe9f0('0x15')]=function(_0x3ed69a){var _0x2ab12b=this;return new Promise(function(_0x3da237,_0x59bf5a){return db[_0xe9f0('0x16')][_0xe9f0('0x17')](_0x3ed69a[_0xe9f0('0x18')],{'raw':_0x3ed69a['options']?_0x3ed69a[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![]})[_0xe9f0('0xb')](function(_0x43f399){logger['info'](_0xe9f0('0x15'),_0x3ed69a);logger[_0xe9f0('0xf')]('CreateVoiceDialReport',_0x3ed69a,JSON['stringify'](_0x43f399));_0x3da237(_0x43f399);})['catch'](function(_0x12fe9f){logger[_0xe9f0('0x11')](_0xe9f0('0x15'),_0x12fe9f[_0xe9f0('0x13')],_0x3ed69a);_0x59bf5a(_0x2ab12b[_0xe9f0('0x11')](0x1f4,_0x12fe9f['message']));});});};exports[_0xe9f0('0x1b')]=function(_0x38b7ee){var _0x437d43=this;return new Promise(function(_0x10801b,_0x3ca991){return db[_0xe9f0('0x16')][_0xe9f0('0x1c')](_0x38b7ee[_0xe9f0('0x18')],{'raw':_0x38b7ee[_0xe9f0('0x19')]?_0x38b7ee[_0xe9f0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38b7ee[_0xe9f0('0x19')]?_0x38b7ee[_0xe9f0('0x19')][_0xe9f0('0x1d')]||null:null,'attributes':_0x38b7ee[_0xe9f0('0x19')]?_0x38b7ee['options'][_0xe9f0('0x1e')]||null:null,'limit':_0x38b7ee[_0xe9f0('0x19')]?_0x38b7ee[_0xe9f0('0x19')][_0xe9f0('0x1f')]||null:null})[_0xe9f0('0xb')](function(_0x5457f6){logger[_0xe9f0('0xc')](_0xe9f0('0x1b'),_0x38b7ee);logger[_0xe9f0('0xf')](_0xe9f0('0x1b'),_0x38b7ee,JSON[_0xe9f0('0x20')](_0x5457f6));_0x10801b(_0x5457f6);})[_0xe9f0('0x21')](function(_0x1d788a){logger[_0xe9f0('0x11')](_0xe9f0('0x1b'),_0x1d788a[_0xe9f0('0x13')],_0x38b7ee);_0x3ca991(_0x437d43[_0xe9f0('0x11')](0x1f4,_0x1d788a[_0xe9f0('0x13')]));});});}; \ No newline at end of file +var _0x57ca=['update','where','attributes','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport'];(function(_0x1e0222,_0x1a09bf){var _0x5656a2=function(_0x107597){while(--_0x107597){_0x1e0222['push'](_0x1e0222['shift']());}};_0x5656a2(++_0x1a09bf);}(_0x57ca,0x108));var _0xa57c=function(_0x485463,_0x33e484){_0x485463=_0x485463-0x0;var _0x11c4ee=_0x57ca[_0x485463];return _0x11c4ee;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var db=require(_0xa57c('0x3'))['db'];var utils=require(_0xa57c('0x4'));var logger=require(_0xa57c('0x5'))(_0xa57c('0x6'));var config=require('../../config/environment');var jayson=require(_0xa57c('0x7'));var client=jayson[_0xa57c('0x8')][_0xa57c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19473f,_0xbdfffb,_0x314574){return new BPromise(function(_0x19e28e,_0x271ccc){return client['request'](_0x19473f,_0x314574)[_0xa57c('0xa')](function(_0x4b51d8){logger[_0xa57c('0xb')](_0xa57c('0xc'),_0xbdfffb,'request\x20sent');logger[_0xa57c('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xbdfffb,_0xa57c('0xe'),JSON[_0xa57c('0xf')](_0x4b51d8));if(_0x4b51d8['error']){if(_0x4b51d8[_0xa57c('0x10')]['code']===0x1f4){logger[_0xa57c('0x10')](_0xa57c('0xc'),_0xbdfffb,_0x4b51d8[_0xa57c('0x10')][_0xa57c('0x11')]);return _0x271ccc(_0x4b51d8[_0xa57c('0x10')]['message']);}logger[_0xa57c('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0xbdfffb,_0x4b51d8[_0xa57c('0x10')][_0xa57c('0x11')]);return _0x19e28e(_0x4b51d8[_0xa57c('0x10')][_0xa57c('0x11')]);}else{logger[_0xa57c('0xb')](_0xa57c('0xc'),_0xbdfffb,_0xa57c('0xe'));_0x19e28e(_0x4b51d8['result'][_0xa57c('0x11')]);}})[_0xa57c('0x12')](function(_0x261725){logger['error'](_0xa57c('0xc'),_0xbdfffb,_0x261725);_0x271ccc(_0x261725);});});}exports['CreateVoiceDialReport']=function(_0x3e7afa){var _0x3d781d=this;return new Promise(function(_0x93462c,_0xe3d505){return db[_0xa57c('0x13')][_0xa57c('0x14')](_0x3e7afa[_0xa57c('0x15')],{'raw':_0x3e7afa[_0xa57c('0x16')]?_0x3e7afa['options'][_0xa57c('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4a35bb){logger[_0xa57c('0xb')](_0xa57c('0x18'),_0x3e7afa);logger[_0xa57c('0xd')](_0xa57c('0x18'),_0x3e7afa,JSON['stringify'](_0x4a35bb));_0x93462c(_0x4a35bb);})[_0xa57c('0x12')](function(_0x25715f){logger[_0xa57c('0x10')](_0xa57c('0x18'),_0x25715f[_0xa57c('0x11')],_0x3e7afa);_0xe3d505(_0x3d781d[_0xa57c('0x10')](0x1f4,_0x25715f[_0xa57c('0x11')]));});});};exports[_0xa57c('0x19')]=function(_0x2e99ed){var _0xdf65dd=this;return new Promise(function(_0x382a26,_0x1e7f7a){return db[_0xa57c('0x13')][_0xa57c('0x1a')](_0x2e99ed[_0xa57c('0x15')],{'raw':_0x2e99ed['options']?_0x2e99ed[_0xa57c('0x16')][_0xa57c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e99ed[_0xa57c('0x16')]?_0x2e99ed[_0xa57c('0x16')][_0xa57c('0x1b')]||null:null,'attributes':_0x2e99ed[_0xa57c('0x16')]?_0x2e99ed[_0xa57c('0x16')][_0xa57c('0x1c')]||null:null,'limit':_0x2e99ed[_0xa57c('0x16')]?_0x2e99ed[_0xa57c('0x16')]['limit']||null:null})[_0xa57c('0xa')](function(_0x4c1478){logger['info'](_0xa57c('0x19'),_0x2e99ed);logger[_0xa57c('0xd')]('UpdateVoiceDialReport',_0x2e99ed,JSON[_0xa57c('0xf')](_0x4c1478));_0x382a26(_0x4c1478);})[_0xa57c('0x12')](function(_0x3eb9e9){logger['error'](_0xa57c('0x19'),_0x3eb9e9['message'],_0x2e99ed);_0x1e7f7a(_0xdf65dd[_0xa57c('0x10')](0x1f4,_0x3eb9e9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index fb053c5..e9c3e80 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 _0x23e0=['put','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','post','/:id/applications','addApplications'];(function(_0x4e77b5,_0x19c830){var _0x18c3bb=function(_0x3631f1){while(--_0x3631f1){_0x4e77b5['push'](_0x4e77b5['shift']());}};_0x18c3bb(++_0x19c830);}(_0x23e0,0x1f0));var _0x023e=function(_0x5781c9,_0x4738f1){_0x5781c9=_0x5781c9-0x0;var _0x437b4a=_0x23e0[_0x5781c9];return _0x437b4a;};'use strict';var multer=require(_0x023e('0x0'));var util=require('util');var path=require(_0x023e('0x1'));var express=require('express');var router=express[_0x023e('0x2')]();var auth=require(_0x023e('0x3'));var interaction=require(_0x023e('0x4'));var config=require(_0x023e('0x5'));var controller=require(_0x023e('0x6'));router[_0x023e('0x7')]('/',auth['isAuthenticated'](),controller[_0x023e('0x8')]);router['get'](_0x023e('0x9'),auth[_0x023e('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x023e('0xb')](_0x023e('0xc'),auth[_0x023e('0xa')](),controller[_0x023e('0xd')]);router[_0x023e('0xe')]('/:id',auth[_0x023e('0xa')](),controller['update']);router['delete'](_0x023e('0x9'),auth[_0x023e('0xa')](),controller[_0x023e('0xf')]);module[_0x023e('0x10')]=router; \ No newline at end of file +var _0x425b=['delete','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','post','/:id/applications','update'];(function(_0x271a4b,_0x2c76ab){var _0x1ebe00=function(_0x38aabb){while(--_0x38aabb){_0x271a4b['push'](_0x271a4b['shift']());}};_0x1ebe00(++_0x2c76ab);}(_0x425b,0x192));var _0xb425=function(_0x3ebccf,_0x1f7fe7){_0x3ebccf=_0x3ebccf-0x0;var _0xdaf025=_0x425b[_0x3ebccf];return _0xdaf025;};'use strict';var multer=require(_0xb425('0x0'));var util=require('util');var path=require(_0xb425('0x1'));var express=require(_0xb425('0x2'));var router=express[_0xb425('0x3')]();var auth=require(_0xb425('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb425('0x5'));var controller=require(_0xb425('0x6'));router[_0xb425('0x7')]('/',auth['isAuthenticated'](),controller[_0xb425('0x8')]);router[_0xb425('0x7')](_0xb425('0x9'),auth[_0xb425('0xa')](),controller['show']);router[_0xb425('0xb')]('/',auth[_0xb425('0xa')](),controller['create']);router[_0xb425('0xb')](_0xb425('0xc'),auth[_0xb425('0xa')](),controller['addApplications']);router['put'](_0xb425('0x9'),auth['isAuthenticated'](),controller[_0xb425('0xd')]);router[_0xb425('0xe')](_0xb425('0x9'),auth[_0xb425('0xa')](),controller['destroy']);module[_0xb425('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 502b70a..26d4f1b 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 _0x6e0b=['inbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER','wav','BOOLEAN','STRING','compositeIndex','NoOp','ENUM'];(function(_0x26f8d5,_0x3ffcb8){var _0x122cc3=function(_0x5e78e5){while(--_0x5e78e5){_0x26f8d5['push'](_0x26f8d5['shift']());}};_0x122cc3(++_0x3ffcb8);}(_0x6e0b,0xf3));var _0xb6e0=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x6e0b[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xb6e0('0x0')],'allowNull':![],'unique':_0xb6e0('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb6e0('0x0')],'allowNull':![],'unique':_0xb6e0('0x1')},'priority':{'type':Sequelize[_0xb6e0('0x0')],'allowNull':![],'defaultValue':'1','unique':_0xb6e0('0x1')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb6e0('0x2')},'appdata':{'type':Sequelize[_0xb6e0('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb6e0('0x3')](_0xb6e0('0x4'),'outbound',_0xb6e0('0x5'),'inbound-fax',_0xb6e0('0x6'),_0xb6e0('0x7'),_0xb6e0('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xb6e0('0x0')]},'interval':{'type':Sequelize[_0xb6e0('0x0')],'allowNull':![],'defaultValue':_0xb6e0('0x9')},'IntervalId':{'type':Sequelize[_0xb6e0('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb6e0('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xb6e0('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb6e0('0xa')]},'recordingFormat':{'type':Sequelize[_0xb6e0('0x0')],'defaultValue':_0xb6e0('0xb')},'answer':{'type':Sequelize[_0xb6e0('0xc')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6b62=['ENUM','inbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','sequelize','exports','STRING','compositeIndex','NoOp'];(function(_0x1bcdda,_0x10ae57){var _0xe312ae=function(_0x93c410){while(--_0x93c410){_0x1bcdda['push'](_0x1bcdda['shift']());}};_0xe312ae(++_0x10ae57);}(_0x6b62,0x73));var _0x26b6=function(_0x417bb7,_0x317a70){_0x417bb7=_0x417bb7-0x0;var _0x325d9d=_0x6b62[_0x417bb7];return _0x325d9d;};'use strict';var Sequelize=require(_0x26b6('0x0'));module[_0x26b6('0x1')]={'context':{'type':Sequelize[_0x26b6('0x2')],'allowNull':![],'unique':_0x26b6('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x26b6('0x2')],'allowNull':![],'unique':_0x26b6('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x26b6('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x26b6('0x2')],'allowNull':![],'defaultValue':_0x26b6('0x4')},'appdata':{'type':Sequelize[_0x26b6('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x26b6('0x5')](_0x26b6('0x6'),'outbound',_0x26b6('0x7'),_0x26b6('0x8'),_0x26b6('0x9'),'system',_0x26b6('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x26b6('0x2')]},'interval':{'type':Sequelize[_0x26b6('0x2')],'allowNull':![],'defaultValue':_0x26b6('0xb')},'IntervalId':{'type':Sequelize[_0x26b6('0xc')]},'isApp':{'type':Sequelize[_0x26b6('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x26b6('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x26b6('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x26b6('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x26b6('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0d5ba24..0f1e681 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 _0xa9e0=['json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','VoiceExtension','length','find','create','body','type','outbound','startsWith','exten','concat','description','cutdigits','context','destroy','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./voiceExtension.socket','sendStatus','status','end'];(function(_0xcfbb97,_0x3ba3c8){var _0x5bc0b7=function(_0x110729){while(--_0x110729){_0xcfbb97['push'](_0xcfbb97['shift']());}};_0x5bc0b7(++_0x3ba3c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];var socket=require(_0x0a9e('0xf'))({'host':_0x0a9e('0x10'),'port':0x18eb});require(_0x0a9e('0x11'))['register'](socket);function respondWithStatusCode(_0x50dfb2,_0x527cdd){_0x527cdd=_0x527cdd||0xcc;return function(_0x4cfe67){if(_0x4cfe67){return _0x50dfb2[_0x0a9e('0x12')](_0x527cdd);}return _0x50dfb2[_0x0a9e('0x13')](_0x527cdd)[_0x0a9e('0x14')]();};}function respondWithResult(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xc8;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['status'](_0x32d742)[_0x0a9e('0x15')](_0x69aeb7);}};}function respondWithFilteredResult(_0x239b12,_0x2b4227){return function(_0x281129){if(_0x281129){var _0x44dcfd=_0x281129['count'],_0x4d5611=_0x2b4227[_0x0a9e('0x16')],_0x52a03d=_0x2b4227['offset']+_0x2b4227[_0x0a9e('0x17')],_0x22dccb;if(_0x52a03d>=_0x44dcfd){_0x52a03d=_0x44dcfd;_0x22dccb=0xc8;}else{_0x22dccb=0xce;}_0x239b12[_0x0a9e('0x13')](_0x22dccb);return _0x239b12['set'](_0x0a9e('0x18'),_0x4d5611+'-'+_0x52a03d+'/'+_0x44dcfd)['json'](_0x281129);}return null;};}function patchUpdates(_0x459eb1){return function(_0x478723){try{jsonpatch[_0x0a9e('0x19')](_0x478723,_0x459eb1,!![]);}catch(_0x205fd6){return BPromise[_0x0a9e('0x1a')](_0x205fd6);}return _0x478723[_0x0a9e('0x1b')]();};}function saveUpdates(_0x530eb7,_0x20559e){return function(_0x1314ae){if(_0x1314ae){return _0x1314ae[_0x0a9e('0x1c')](_0x530eb7)[_0x0a9e('0x1d')](function(_0x105080){return _0x105080;});}return null;};}function removeEntity(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['destroy']()[_0x0a9e('0x1d')](function(){_0x4bb1e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(!_0x38e7c4){_0x3a02e1[_0x0a9e('0x12')](0x194);}return _0x38e7c4;};}function handleError(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0x1f4;return function(_0x2fb0e4){logger[_0x0a9e('0x1e')](_0x2fb0e4[_0x0a9e('0x1f')]);if(_0x2fb0e4[_0x0a9e('0x20')]){delete _0x2fb0e4[_0x0a9e('0x20')];}_0x4abc77[_0x0a9e('0x13')](_0xfb6e48)['send'](_0x2fb0e4);};}exports['index']=function(_0x197ec0,_0x3a8e58){var _0x40c424={},_0x33161b={},_0x526cf3={'count':0x0,'rows':[]};var _0x384319=db['VoiceExtension'][_0x0a9e('0x21')];_0x33161b['model']=_[_0x0a9e('0x22')](_0x384319);var _0x34dc65={'dateStart':_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x24')],'dateEnd':_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x25')]};delete _0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x24')];delete _0x197ec0['query'][_0x0a9e('0x25')];_0x33161b[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x197ec0[_0x0a9e('0x23')]);_0x33161b['filters']=_[_0x0a9e('0x26')](_0x33161b[_0x0a9e('0x27')],_0x33161b[_0x0a9e('0x23')]);_0x40c424[_0x0a9e('0x28')]=_[_0x0a9e('0x26')](_0x33161b[_0x0a9e('0x27')],qs[_0x0a9e('0x29')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x40c424['attributes']=_0x40c424[_0x0a9e('0x28')]['length']?_0x40c424[_0x0a9e('0x28')]:_0x33161b[_0x0a9e('0x27')];if(!_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x2a')](_0x0a9e('0x2b'))){_0x40c424['limit']=qs[_0x0a9e('0x17')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x17')]);_0x40c424[_0x0a9e('0x16')]=qs[_0x0a9e('0x16')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x16')]);}_0x40c424[_0x0a9e('0x2c')]=qs['sort'](_0x197ec0[_0x0a9e('0x23')]['sort']);_0x40c424[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x197ec0[_0x0a9e('0x23')],_0x33161b['filters']));if(_0x34dc65[_0x0a9e('0x24')]){if(_0x34dc65[_0x0a9e('0x25')]){_0x34dc65[_0x0a9e('0x25')]=moment(_0x34dc65[_0x0a9e('0x25')])['add'](0x1,'day');}else{_0x34dc65[_0x0a9e('0x25')]=moment(_0x34dc65['dateStart'])[_0x0a9e('0x30')](0x1,_0x0a9e('0x31'));}_[_0x0a9e('0x32')](_0x40c424[_0x0a9e('0x2d')],{'createdAt':{'$gte':_0x34dc65['dateStart'],'$lte':_0x34dc65[_0x0a9e('0x25')]}});}if(_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x33')]){_0x40c424['where']=_[_0x0a9e('0x32')](_0x40c424[_0x0a9e('0x2d')],{'$or':_[_0x0a9e('0x34')](_0x40c424['attributes'],function(_0x546ef8){var _0x11b61d={};_0x11b61d[_0x546ef8]={'$like':'%'+_0x197ec0[_0x0a9e('0x23')]['filter']+'%'};return _0x11b61d;})});}_0x40c424=_[_0x0a9e('0x32')]({},_0x40c424,_0x197ec0[_0x0a9e('0x35')]);var _0x2e1b3a={'where':_0x40c424[_0x0a9e('0x2d')]};return db['VoiceExtension']['count'](_0x2e1b3a)[_0x0a9e('0x1d')](function(_0x45b3d0){_0x526cf3['count']=_0x45b3d0;if(_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x36')]){_0x40c424[_0x0a9e('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0x0a9e('0x38')](_0x40c424);})[_0x0a9e('0x1d')](function(_0x274e8e){_0x526cf3[_0x0a9e('0x39')]=_0x274e8e;return _0x526cf3;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3a8e58,_0x40c424))[_0x0a9e('0x3a')](handleError(_0x3a8e58,null));};exports[_0x0a9e('0x3b')]=function(_0x45a9b8,_0x23b089){var _0x3da2cd={'raw':![],'where':{'id':_0x45a9b8[_0x0a9e('0x3c')]['id']}},_0x2c3711={};_0x2c3711[_0x0a9e('0x27')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x3d')]['rawAttributes']);_0x2c3711['query']=_[_0x0a9e('0x22')](_0x45a9b8[_0x0a9e('0x23')]);_0x2c3711[_0x0a9e('0x2e')]=_[_0x0a9e('0x26')](_0x2c3711[_0x0a9e('0x27')],_0x2c3711[_0x0a9e('0x23')]);_0x3da2cd[_0x0a9e('0x28')]=_[_0x0a9e('0x26')](_0x2c3711[_0x0a9e('0x27')],qs[_0x0a9e('0x29')](_0x45a9b8[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x3da2cd['attributes']=_0x3da2cd[_0x0a9e('0x28')][_0x0a9e('0x3e')]?_0x3da2cd[_0x0a9e('0x28')]:_0x2c3711[_0x0a9e('0x27')];if(_0x45a9b8[_0x0a9e('0x23')][_0x0a9e('0x36')]){_0x3da2cd[_0x0a9e('0x37')]=[{'all':!![]}];}_0x3da2cd=_[_0x0a9e('0x32')]({},_0x3da2cd,_0x45a9b8['options']);return db[_0x0a9e('0x3d')]['find'](_0x3da2cd)[_0x0a9e('0x1d')](handleEntityNotFound(_0x23b089,null))[_0x0a9e('0x1d')](respondWithResult(_0x23b089,null))[_0x0a9e('0x3a')](handleError(_0x23b089,null));};exports['destroy']=function(_0x14bec2,_0x7f6eb1){return db[_0x0a9e('0x3d')][_0x0a9e('0x3f')]({'where':{'id':_0x14bec2[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x7f6eb1,null))[_0x0a9e('0x1d')](removeEntity(_0x7f6eb1,null))['catch'](handleError(_0x7f6eb1,null));};exports[_0x0a9e('0x40')]=function(_0x1bde3c,_0x1b5e80){if(_0x1bde3c[_0x0a9e('0x41')][_0x0a9e('0x42')]===_0x0a9e('0x43')&&!_[_0x0a9e('0x44')](_0x1bde3c[_0x0a9e('0x41')][_0x0a9e('0x45')],'_')){_0x1bde3c['body'][_0x0a9e('0x45')]='_'[_0x0a9e('0x46')](_0x1bde3c['body']['exten']);}return db['VoiceExtension'][_0x0a9e('0x40')](_0x1bde3c[_0x0a9e('0x41')],{'raw':![]})[_0x0a9e('0x1d')](respondWithResult(_0x1b5e80,0xc9))[_0x0a9e('0x3a')](handleError(_0x1b5e80,null));};exports[_0x0a9e('0x1c')]=function(_0x30decb,_0x2e5165){if(_0x30decb[_0x0a9e('0x41')]['id']){delete _0x30decb['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x30decb[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2e5165,null))[_0x0a9e('0x1d')](function(_0x5bb3ed){if(_0x5bb3ed){return db[_0x0a9e('0x3d')][_0x0a9e('0x1c')](_['pick'](_0x30decb['body'],[_0x0a9e('0x45'),'context',_0x0a9e('0x47'),'recordingFormat',_0x0a9e('0x48')]),{'where':{'context':_0x5bb3ed[_0x0a9e('0x49')],'exten':_0x5bb3ed[_0x0a9e('0x45')]},'individualHooks':!![]})['then'](function(_0x2f82da){return _0x2f82da;});}return null;})[_0x0a9e('0x1d')](respondWithStatusCode(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports['addApplications']=function(_0x128aa6,_0x3aedd0,_0x49c095){return db[_0x0a9e('0x3d')]['findOne']({'where':{'id':_0x128aa6[_0x0a9e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3aedd0,null))[_0x0a9e('0x1d')](function(_0x4a6deb){if(_0x4a6deb){return db['sequelize']['transaction'](function(_0x2da03c){return db['VoiceExtension'][_0x0a9e('0x4a')]({'where':{'VoiceExtensionId':_0x128aa6[_0x0a9e('0x3c')]['id']},'transaction':_0x2da03c})[_0x0a9e('0x1d')](function(_0x19b4df){var _0x232830=_[_0x0a9e('0x34')](_0x128aa6[_0x0a9e('0x41')],function(_0x28d814){_0x28d814['VoiceExtensionId']=_0x128aa6[_0x0a9e('0x3c')]['id'];return _0x28d814;});return db[_0x0a9e('0x3d')][_0x0a9e('0x4b')](_0x232830,{'transaction':_0x2da03c});});})[_0x0a9e('0x1d')](function(){return db[_0x0a9e('0x3d')][_0x0a9e('0x4c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x128aa6['params']['id']},'order':_0x0a9e('0x4d')});});}})[_0x0a9e('0x1d')](respondWithResult(_0x3aedd0,null))['catch'](handleError(_0x3aedd0,null));}; \ No newline at end of file +var _0xa9e0=['json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','VoiceExtension','length','find','create','body','type','outbound','startsWith','exten','concat','description','cutdigits','context','destroy','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./voiceExtension.socket','sendStatus','status','end'];(function(_0x1d37c6,_0x5ec404){var _0xd95b3a=function(_0x3cfaff){while(--_0x3cfaff){_0x1d37c6['push'](_0x1d37c6['shift']());}};_0xd95b3a(++_0x5ec404);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];var socket=require(_0x0a9e('0xf'))({'host':_0x0a9e('0x10'),'port':0x18eb});require(_0x0a9e('0x11'))['register'](socket);function respondWithStatusCode(_0x50dfb2,_0x527cdd){_0x527cdd=_0x527cdd||0xcc;return function(_0x4cfe67){if(_0x4cfe67){return _0x50dfb2[_0x0a9e('0x12')](_0x527cdd);}return _0x50dfb2[_0x0a9e('0x13')](_0x527cdd)[_0x0a9e('0x14')]();};}function respondWithResult(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xc8;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['status'](_0x32d742)[_0x0a9e('0x15')](_0x69aeb7);}};}function respondWithFilteredResult(_0x239b12,_0x2b4227){return function(_0x281129){if(_0x281129){var _0x44dcfd=_0x281129['count'],_0x4d5611=_0x2b4227[_0x0a9e('0x16')],_0x52a03d=_0x2b4227['offset']+_0x2b4227[_0x0a9e('0x17')],_0x22dccb;if(_0x52a03d>=_0x44dcfd){_0x52a03d=_0x44dcfd;_0x22dccb=0xc8;}else{_0x22dccb=0xce;}_0x239b12[_0x0a9e('0x13')](_0x22dccb);return _0x239b12['set'](_0x0a9e('0x18'),_0x4d5611+'-'+_0x52a03d+'/'+_0x44dcfd)['json'](_0x281129);}return null;};}function patchUpdates(_0x459eb1){return function(_0x478723){try{jsonpatch[_0x0a9e('0x19')](_0x478723,_0x459eb1,!![]);}catch(_0x205fd6){return BPromise[_0x0a9e('0x1a')](_0x205fd6);}return _0x478723[_0x0a9e('0x1b')]();};}function saveUpdates(_0x530eb7,_0x20559e){return function(_0x1314ae){if(_0x1314ae){return _0x1314ae[_0x0a9e('0x1c')](_0x530eb7)[_0x0a9e('0x1d')](function(_0x105080){return _0x105080;});}return null;};}function removeEntity(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['destroy']()[_0x0a9e('0x1d')](function(){_0x4bb1e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(!_0x38e7c4){_0x3a02e1[_0x0a9e('0x12')](0x194);}return _0x38e7c4;};}function handleError(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0x1f4;return function(_0x2fb0e4){logger[_0x0a9e('0x1e')](_0x2fb0e4[_0x0a9e('0x1f')]);if(_0x2fb0e4[_0x0a9e('0x20')]){delete _0x2fb0e4[_0x0a9e('0x20')];}_0x4abc77[_0x0a9e('0x13')](_0xfb6e48)['send'](_0x2fb0e4);};}exports['index']=function(_0x197ec0,_0x3a8e58){var _0x40c424={},_0x33161b={},_0x526cf3={'count':0x0,'rows':[]};var _0x384319=db['VoiceExtension'][_0x0a9e('0x21')];_0x33161b['model']=_[_0x0a9e('0x22')](_0x384319);var _0x34dc65={'dateStart':_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x24')],'dateEnd':_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x25')]};delete _0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x24')];delete _0x197ec0['query'][_0x0a9e('0x25')];_0x33161b[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x197ec0[_0x0a9e('0x23')]);_0x33161b['filters']=_[_0x0a9e('0x26')](_0x33161b[_0x0a9e('0x27')],_0x33161b[_0x0a9e('0x23')]);_0x40c424[_0x0a9e('0x28')]=_[_0x0a9e('0x26')](_0x33161b[_0x0a9e('0x27')],qs[_0x0a9e('0x29')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x40c424['attributes']=_0x40c424[_0x0a9e('0x28')]['length']?_0x40c424[_0x0a9e('0x28')]:_0x33161b[_0x0a9e('0x27')];if(!_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x2a')](_0x0a9e('0x2b'))){_0x40c424['limit']=qs[_0x0a9e('0x17')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x17')]);_0x40c424[_0x0a9e('0x16')]=qs[_0x0a9e('0x16')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x16')]);}_0x40c424[_0x0a9e('0x2c')]=qs['sort'](_0x197ec0[_0x0a9e('0x23')]['sort']);_0x40c424[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x197ec0[_0x0a9e('0x23')],_0x33161b['filters']));if(_0x34dc65[_0x0a9e('0x24')]){if(_0x34dc65[_0x0a9e('0x25')]){_0x34dc65[_0x0a9e('0x25')]=moment(_0x34dc65[_0x0a9e('0x25')])['add'](0x1,'day');}else{_0x34dc65[_0x0a9e('0x25')]=moment(_0x34dc65['dateStart'])[_0x0a9e('0x30')](0x1,_0x0a9e('0x31'));}_[_0x0a9e('0x32')](_0x40c424[_0x0a9e('0x2d')],{'createdAt':{'$gte':_0x34dc65['dateStart'],'$lte':_0x34dc65[_0x0a9e('0x25')]}});}if(_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x33')]){_0x40c424['where']=_[_0x0a9e('0x32')](_0x40c424[_0x0a9e('0x2d')],{'$or':_[_0x0a9e('0x34')](_0x40c424['attributes'],function(_0x546ef8){var _0x11b61d={};_0x11b61d[_0x546ef8]={'$like':'%'+_0x197ec0[_0x0a9e('0x23')]['filter']+'%'};return _0x11b61d;})});}_0x40c424=_[_0x0a9e('0x32')]({},_0x40c424,_0x197ec0[_0x0a9e('0x35')]);var _0x2e1b3a={'where':_0x40c424[_0x0a9e('0x2d')]};return db['VoiceExtension']['count'](_0x2e1b3a)[_0x0a9e('0x1d')](function(_0x45b3d0){_0x526cf3['count']=_0x45b3d0;if(_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x36')]){_0x40c424[_0x0a9e('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0x0a9e('0x38')](_0x40c424);})[_0x0a9e('0x1d')](function(_0x274e8e){_0x526cf3[_0x0a9e('0x39')]=_0x274e8e;return _0x526cf3;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3a8e58,_0x40c424))[_0x0a9e('0x3a')](handleError(_0x3a8e58,null));};exports[_0x0a9e('0x3b')]=function(_0x45a9b8,_0x23b089){var _0x3da2cd={'raw':![],'where':{'id':_0x45a9b8[_0x0a9e('0x3c')]['id']}},_0x2c3711={};_0x2c3711[_0x0a9e('0x27')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x3d')]['rawAttributes']);_0x2c3711['query']=_[_0x0a9e('0x22')](_0x45a9b8[_0x0a9e('0x23')]);_0x2c3711[_0x0a9e('0x2e')]=_[_0x0a9e('0x26')](_0x2c3711[_0x0a9e('0x27')],_0x2c3711[_0x0a9e('0x23')]);_0x3da2cd[_0x0a9e('0x28')]=_[_0x0a9e('0x26')](_0x2c3711[_0x0a9e('0x27')],qs[_0x0a9e('0x29')](_0x45a9b8[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x3da2cd['attributes']=_0x3da2cd[_0x0a9e('0x28')][_0x0a9e('0x3e')]?_0x3da2cd[_0x0a9e('0x28')]:_0x2c3711[_0x0a9e('0x27')];if(_0x45a9b8[_0x0a9e('0x23')][_0x0a9e('0x36')]){_0x3da2cd[_0x0a9e('0x37')]=[{'all':!![]}];}_0x3da2cd=_[_0x0a9e('0x32')]({},_0x3da2cd,_0x45a9b8['options']);return db[_0x0a9e('0x3d')]['find'](_0x3da2cd)[_0x0a9e('0x1d')](handleEntityNotFound(_0x23b089,null))[_0x0a9e('0x1d')](respondWithResult(_0x23b089,null))[_0x0a9e('0x3a')](handleError(_0x23b089,null));};exports['destroy']=function(_0x14bec2,_0x7f6eb1){return db[_0x0a9e('0x3d')][_0x0a9e('0x3f')]({'where':{'id':_0x14bec2[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x7f6eb1,null))[_0x0a9e('0x1d')](removeEntity(_0x7f6eb1,null))['catch'](handleError(_0x7f6eb1,null));};exports[_0x0a9e('0x40')]=function(_0x1bde3c,_0x1b5e80){if(_0x1bde3c[_0x0a9e('0x41')][_0x0a9e('0x42')]===_0x0a9e('0x43')&&!_[_0x0a9e('0x44')](_0x1bde3c[_0x0a9e('0x41')][_0x0a9e('0x45')],'_')){_0x1bde3c['body'][_0x0a9e('0x45')]='_'[_0x0a9e('0x46')](_0x1bde3c['body']['exten']);}return db['VoiceExtension'][_0x0a9e('0x40')](_0x1bde3c[_0x0a9e('0x41')],{'raw':![]})[_0x0a9e('0x1d')](respondWithResult(_0x1b5e80,0xc9))[_0x0a9e('0x3a')](handleError(_0x1b5e80,null));};exports[_0x0a9e('0x1c')]=function(_0x30decb,_0x2e5165){if(_0x30decb[_0x0a9e('0x41')]['id']){delete _0x30decb['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x30decb[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2e5165,null))[_0x0a9e('0x1d')](function(_0x5bb3ed){if(_0x5bb3ed){return db[_0x0a9e('0x3d')][_0x0a9e('0x1c')](_['pick'](_0x30decb['body'],[_0x0a9e('0x45'),'context',_0x0a9e('0x47'),'recordingFormat',_0x0a9e('0x48')]),{'where':{'context':_0x5bb3ed[_0x0a9e('0x49')],'exten':_0x5bb3ed[_0x0a9e('0x45')]},'individualHooks':!![]})['then'](function(_0x2f82da){return _0x2f82da;});}return null;})[_0x0a9e('0x1d')](respondWithStatusCode(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports['addApplications']=function(_0x128aa6,_0x3aedd0,_0x49c095){return db[_0x0a9e('0x3d')]['findOne']({'where':{'id':_0x128aa6[_0x0a9e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3aedd0,null))[_0x0a9e('0x1d')](function(_0x4a6deb){if(_0x4a6deb){return db['sequelize']['transaction'](function(_0x2da03c){return db['VoiceExtension'][_0x0a9e('0x4a')]({'where':{'VoiceExtensionId':_0x128aa6[_0x0a9e('0x3c')]['id']},'transaction':_0x2da03c})[_0x0a9e('0x1d')](function(_0x19b4df){var _0x232830=_[_0x0a9e('0x34')](_0x128aa6[_0x0a9e('0x41')],function(_0x28d814){_0x28d814['VoiceExtensionId']=_0x128aa6[_0x0a9e('0x3c')]['id'];return _0x28d814;});return db[_0x0a9e('0x3d')][_0x0a9e('0x4b')](_0x232830,{'transaction':_0x2da03c});});})[_0x0a9e('0x1d')](function(){return db[_0x0a9e('0x3d')][_0x0a9e('0x4c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x128aa6['params']['id']},'order':_0x0a9e('0x4d')});});}})[_0x0a9e('0x1d')](respondWithResult(_0x3aedd0,null))['catch'](handleError(_0x3aedd0,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 621c163..ebb6a1b 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 _0x29a2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x68640b,_0x5c5ca8){var _0xe32f33=function(_0x26c3c6){while(--_0x26c3c6){_0x68640b['push'](_0x68640b['shift']());}};_0xe32f33(++_0x5c5ca8);}(_0x29a2,0x1a6));var _0x229a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x29a2[_0x5d4607];return _0x5e4a86;};'use strict';var EventEmitter=require(_0x229a('0x0'));var VoiceExtension=require(_0x229a('0x1'))['db'][_0x229a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x229a('0x3')](0x0);var events={'afterCreate':_0x229a('0x4'),'afterUpdate':_0x229a('0x5'),'afterDestroy':_0x229a('0x6')};function emitEvent(_0x357917){return function(_0x57c97c,_0x463c1e,_0x5e3aef){VoiceExtensionEvents['emit'](_0x357917+':'+_0x57c97c['id'],_0x57c97c);VoiceExtensionEvents[_0x229a('0x7')](_0x357917,_0x57c97c);_0x5e3aef(null);};}for(var e in events){if(events[_0x229a('0x8')](e)){var event=events[e];VoiceExtension[_0x229a('0x9')](e,emitEvent(event));}}module[_0x229a('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0xacfc=['VoiceExtension','save','update','hasOwnProperty','hook','exports','events'];(function(_0x3ed0f1,_0x3d8119){var _0x58ba03=function(_0x348764){while(--_0x348764){_0x3ed0f1['push'](_0x3ed0f1['shift']());}};_0x58ba03(++_0x3d8119);}(_0xacfc,0x76));var _0xcacf=function(_0x576e41,_0x579bab){_0x576e41=_0x576e41-0x0;var _0x5297c7=_0xacfc[_0x576e41];return _0x5297c7;};'use strict';var EventEmitter=require(_0xcacf('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xcacf('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcacf('0x2'),'afterUpdate':_0xcacf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x58c61e){return function(_0x467830,_0x1d13b5,_0x1b21dc){VoiceExtensionEvents['emit'](_0x58c61e+':'+_0x467830['id'],_0x467830);VoiceExtensionEvents['emit'](_0x58c61e,_0x467830);_0x1b21dc(null);};}for(var e in events){if(events[_0xcacf('0x4')](e)){var event=events[e];VoiceExtension[_0xcacf('0x5')](e,emitEvent(event));}}module[_0xcacf('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 a0dcd03..3c4ba29 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 _0x9e6d=['api','moment','bluebird','request-promise','VoiceExtension','voice_extensions','../../config/logger'];(function(_0x2174cf,_0x10699e){var _0x290161=function(_0x3248b7){while(--_0x3248b7){_0x2174cf['push'](_0x2174cf['shift']());}};_0x290161(++_0x10699e);}(_0x9e6d,0x6f));var _0xd9e6=function(_0x61f2ec,_0x36c2ed){_0x61f2ec=_0x61f2ec-0x0;var _0x2584f1=_0x9e6d[_0x61f2ec];return _0x2584f1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd9e6('0x0'))(_0xd9e6('0x1'));var moment=require(_0xd9e6('0x2'));var BPromise=require(_0xd9e6('0x3'));var rp=require(_0xd9e6('0x4'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x3be75b,_0x54b0da){return _0x3be75b['define'](_0xd9e6('0x5'),attributes,{'tableName':_0xd9e6('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf34=['api','moment','request-promise','exports','define','VoiceExtension','voice_extensions','lodash','../../config/logger'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdf34,0xc4));var _0x4df3=function(_0x400c3b,_0x1d72e9){_0x400c3b=_0x400c3b-0x0;var _0x970571=_0xdf34[_0x400c3b];return _0x970571;};'use strict';var _=require(_0x4df3('0x0'));var util=require('util');var logger=require(_0x4df3('0x1'))(_0x4df3('0x2'));var moment=require(_0x4df3('0x3'));var BPromise=require('bluebird');var rp=require(_0x4df3('0x4'));var attributes=require('./voiceExtension.attributes');module[_0x4df3('0x5')]=function(_0x56cf62,_0x12db82){return _0x56cf62[_0x4df3('0x6')](_0x4df3('0x7'),attributes,{'tableName':_0x4df3('0x8'),'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 980cad6..7d6cd9e 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 _0x702d=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','socket.io-emitter','localhost','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','VoiceExtension','findAll','options','where','include','map','model','attributes','GetVoiceExtension','lodash','util','moment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x702d,0x147));var _0xd702=function(_0x5056fd,_0xd7929a){_0x5056fd=_0x5056fd-0x0;var _0x279032=_0x702d[_0x5056fd];return _0x279032;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xd702('0x5'));var logger=require(_0xd702('0x6'))(_0xd702('0x7'));var config=require(_0xd702('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd702('0x9')]['http']({'port':0x232a});var socket=require(_0xd702('0xa'))({'host':_0xd702('0xb'),'port':0x18eb});require(_0xd702('0xc'))['register'](socket);function respondWithRpcPromise(_0x12bb75,_0x53bd02,_0x39c49e){return new BPromise(function(_0x25423f,_0x907a9f){return client[_0xd702('0xd')](_0x12bb75,_0x39c49e)[_0xd702('0xe')](function(_0x2a1f0d){logger[_0xd702('0xf')](_0xd702('0x10'),_0x53bd02,_0xd702('0x11'));logger[_0xd702('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x53bd02,'request\x20sent',JSON[_0xd702('0x13')](_0x2a1f0d));if(_0x2a1f0d[_0xd702('0x14')]){if(_0x2a1f0d[_0xd702('0x14')]['code']===0x1f4){logger[_0xd702('0x14')](_0xd702('0x10'),_0x53bd02,_0x2a1f0d[_0xd702('0x14')][_0xd702('0x15')]);return _0x907a9f(_0x2a1f0d[_0xd702('0x14')][_0xd702('0x15')]);}logger['error'](_0xd702('0x10'),_0x53bd02,_0x2a1f0d[_0xd702('0x14')]['message']);return _0x25423f(_0x2a1f0d[_0xd702('0x14')]['message']);}else{logger[_0xd702('0xf')](_0xd702('0x10'),_0x53bd02,'request\x20sent');_0x25423f(_0x2a1f0d[_0xd702('0x16')][_0xd702('0x15')]);}})[_0xd702('0x17')](function(_0x4fdbbd){logger['error'](_0xd702('0x10'),_0x53bd02,_0x4fdbbd);_0x907a9f(_0x4fdbbd);});});}exports['GetVoiceExtension']=function(_0x3fbcec){var _0x2a871e=this;return new Promise(function(_0x37267c,_0x265b1b){return db[_0xd702('0x18')][_0xd702('0x19')]({'raw':_0x3fbcec[_0xd702('0x1a')]?_0x3fbcec['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fbcec['options']?_0x3fbcec[_0xd702('0x1a')][_0xd702('0x1b')]||null:null,'attributes':_0x3fbcec['options']?_0x3fbcec[_0xd702('0x1a')]['attributes']||null:null,'limit':_0x3fbcec[_0xd702('0x1a')]?_0x3fbcec['options']['limit']||null:null,'include':_0x3fbcec['options']?_0x3fbcec[_0xd702('0x1a')][_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x3fbcec['options'][_0xd702('0x1c')],function(_0x17cd14){return{'model':db[_0x17cd14[_0xd702('0x1e')]],'as':_0x17cd14['as'],'attributes':_0x17cd14[_0xd702('0x1f')],'include':_0x17cd14[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x17cd14[_0xd702('0x1c')],function(_0x45ca87){return{'model':db[_0x45ca87[_0xd702('0x1e')]],'as':_0x45ca87['as'],'attributes':_0x45ca87['attributes'],'include':_0x45ca87[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x45ca87[_0xd702('0x1c')],function(_0x335202){return{'model':db[_0x335202[_0xd702('0x1e')]],'as':_0x335202['as'],'attributes':_0x335202[_0xd702('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd702('0xe')](function(_0x22441b){logger['info']('GetVoiceExtension',_0x3fbcec);logger[_0xd702('0x12')](_0xd702('0x20'),_0x3fbcec,JSON['stringify'](_0x22441b));_0x37267c(_0x22441b);})[_0xd702('0x17')](function(_0xee8bf1){logger[_0xd702('0x14')](_0xd702('0x20'),_0xee8bf1['message'],_0x3fbcec);_0x265b1b(_0x2a871e[_0xd702('0x14')](0x1f4,_0xee8bf1[_0xd702('0x15')]));});});}; \ No newline at end of file +var _0x91a7=['limit','include','map','model','then','GetVoiceExtension','catch','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','socket.io-emitter','./voiceExtension.socket','register','request','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','VoiceExtension,\x20%s,\x20%s','message','VoiceExtension','findAll','options','raw','where','attributes'];(function(_0x1ac283,_0xab4f65){var _0x429649=function(_0x1813c4){while(--_0x1813c4){_0x1ac283['push'](_0x1ac283['shift']());}};_0x429649(++_0xab4f65);}(_0x91a7,0xe7));var _0x791a=function(_0x5a457a,_0x4eb148){_0x5a457a=_0x5a457a-0x0;var _0x5c2b62=_0x91a7[_0x5a457a];return _0x5c2b62;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x791a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x791a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x791a('0x5'));var client=jayson[_0x791a('0x6')]['http']({'port':0x232a});var socket=require(_0x791a('0x7'))({'host':'localhost','port':0x18eb});require(_0x791a('0x8'))[_0x791a('0x9')](socket);function respondWithRpcPromise(_0x5aa10a,_0x1a32b4,_0x12884d){return new BPromise(function(_0x2c59ba,_0x80ff65){return client[_0x791a('0xa')](_0x5aa10a,_0x12884d)['then'](function(_0x21f0e0){logger[_0x791a('0xb')]('VoiceExtension,\x20%s,\x20%s',_0x1a32b4,_0x791a('0xc'));logger[_0x791a('0xd')](_0x791a('0xe'),_0x1a32b4,_0x791a('0xc'),JSON[_0x791a('0xf')](_0x21f0e0));if(_0x21f0e0[_0x791a('0x10')]){if(_0x21f0e0['error']['code']===0x1f4){logger[_0x791a('0x10')](_0x791a('0x11'),_0x1a32b4,_0x21f0e0['error'][_0x791a('0x12')]);return _0x80ff65(_0x21f0e0[_0x791a('0x10')]['message']);}logger[_0x791a('0x10')](_0x791a('0x11'),_0x1a32b4,_0x21f0e0[_0x791a('0x10')][_0x791a('0x12')]);return _0x2c59ba(_0x21f0e0['error'][_0x791a('0x12')]);}else{logger['info'](_0x791a('0x11'),_0x1a32b4,_0x791a('0xc'));_0x2c59ba(_0x21f0e0['result'][_0x791a('0x12')]);}})['catch'](function(_0x35fe48){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x1a32b4,_0x35fe48);_0x80ff65(_0x35fe48);});});}exports['GetVoiceExtension']=function(_0x40f0d3){var _0x52fa43=this;return new Promise(function(_0x4cf613,_0x39c60b){return db[_0x791a('0x13')][_0x791a('0x14')]({'raw':_0x40f0d3[_0x791a('0x15')]?_0x40f0d3['options'][_0x791a('0x16')]===undefined?!![]:![]:!![],'where':_0x40f0d3[_0x791a('0x15')]?_0x40f0d3[_0x791a('0x15')][_0x791a('0x17')]||null:null,'attributes':_0x40f0d3['options']?_0x40f0d3[_0x791a('0x15')][_0x791a('0x18')]||null:null,'limit':_0x40f0d3[_0x791a('0x15')]?_0x40f0d3[_0x791a('0x15')][_0x791a('0x19')]||null:null,'include':_0x40f0d3[_0x791a('0x15')]?_0x40f0d3[_0x791a('0x15')][_0x791a('0x1a')]?_[_0x791a('0x1b')](_0x40f0d3[_0x791a('0x15')][_0x791a('0x1a')],function(_0x5e03a3){return{'model':db[_0x5e03a3[_0x791a('0x1c')]],'as':_0x5e03a3['as'],'attributes':_0x5e03a3[_0x791a('0x18')],'include':_0x5e03a3[_0x791a('0x1a')]?_[_0x791a('0x1b')](_0x5e03a3['include'],function(_0x456480){return{'model':db[_0x456480[_0x791a('0x1c')]],'as':_0x456480['as'],'attributes':_0x456480['attributes'],'include':_0x456480[_0x791a('0x1a')]?_[_0x791a('0x1b')](_0x456480[_0x791a('0x1a')],function(_0x4c1626){return{'model':db[_0x4c1626[_0x791a('0x1c')]],'as':_0x4c1626['as'],'attributes':_0x4c1626[_0x791a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x791a('0x1d')](function(_0x395376){logger[_0x791a('0xb')](_0x791a('0x1e'),_0x40f0d3);logger[_0x791a('0xd')](_0x791a('0x1e'),_0x40f0d3,JSON['stringify'](_0x395376));_0x4cf613(_0x395376);})[_0x791a('0x1f')](function(_0x9e9332){logger[_0x791a('0x10')]('GetVoiceExtension',_0x9e9332[_0x791a('0x12')],_0x40f0d3);_0x39c60b(_0x52fa43['error'](0x1f4,_0x9e9332[_0x791a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0b7e2f6..65b2429 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 _0x2116=['save','remove','removeListener','register','length','voiceExtension:'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x2116,0x17a));var _0x6211=function(_0x3448bb,_0x4ea3d7){_0x3448bb=_0x3448bb-0x0;var _0x2b2859=_0x2116[_0x3448bb];return _0x2b2859;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x6211('0x0'),_0x6211('0x1'),'update'];function createListener(_0x5480a1,_0x57cf01){return function(_0x7c3f85){_0x57cf01['emit'](_0x5480a1,_0x7c3f85);};}function removeListener(_0x3239a6,_0xab9a79){return function(){VoiceExtensionEvents[_0x6211('0x2')](_0x3239a6,_0xab9a79);};}exports[_0x6211('0x3')]=function(_0x32b68f){for(var _0x12ec5e=0x0,_0x5700dc=events[_0x6211('0x4')];_0x12ec5e<_0x5700dc;_0x12ec5e++){var _0x15dac6=events[_0x12ec5e];var _0x15649b=createListener(_0x6211('0x5')+_0x15dac6,_0x32b68f);VoiceExtensionEvents['on'](_0x15dac6,_0x15649b);}}; \ No newline at end of file +var _0xad91=['emit','removeListener','register','length','voiceExtension:','save','remove'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xad91,0xb4));var _0x1ad9=function(_0x5efa4b,_0x40d22c){_0x5efa4b=_0x5efa4b-0x0;var _0x1b7f87=_0xad91[_0x5efa4b];return _0x1b7f87;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1ad9('0x0'),_0x1ad9('0x1'),'update'];function createListener(_0x40b17a,_0x20ea37){return function(_0x153e12){_0x20ea37[_0x1ad9('0x2')](_0x40b17a,_0x153e12);};}function removeListener(_0x2b5496,_0x383c81){return function(){VoiceExtensionEvents[_0x1ad9('0x3')](_0x2b5496,_0x383c81);};}exports[_0x1ad9('0x4')]=function(_0x3d8249){for(var _0x593ed2=0x0,_0xe99e0e=events[_0x1ad9('0x5')];_0x593ed2<_0xe99e0e;_0x593ed2++){var _0xe162d8=events[_0x593ed2];var _0x5187d9=createListener(_0x1ad9('0x6')+_0xe162d8,_0x3d8249);VoiceExtensionEvents['on'](_0xe162d8,_0x5187d9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4f62e6e..053d5ec 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 _0xa9e0=['/:id','show','create','put','update','exports','multer','util','path','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id/messages',auth[_0x0a9e('0x7')](),controller['getMessages']);router['post']('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0a9e('0xe')]=router; \ No newline at end of file +var _0xa9e0=['/:id','show','create','put','update','exports','multer','util','path','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x314115,_0x22f606){var _0x1347df=function(_0x3fe46a){while(--_0x3fe46a){_0x314115['push'](_0x314115['shift']());}};_0x1347df(++_0x22f606);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id/messages',auth[_0x0a9e('0x7')](),controller['getMessages']);router['post']('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0a9e('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 46df97e..2ecf4b0 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 _0x32d3=['setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','sequelize','STRING','contest_mailbox'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x32d3,0x1c4));var _0x332d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x32d3[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x332d('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x332d('0x1')]},'context':{'type':Sequelize[_0x332d('0x1')],'defaultValue':'from-voicemail','unique':_0x332d('0x2')},'mailbox':{'type':Sequelize[_0x332d('0x1')],'defaultValue':'','allowNull':![],'unique':_0x332d('0x2')},'password':{'type':Sequelize[_0x332d('0x1')]},'fullname':{'type':Sequelize[_0x332d('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x40eb3a){this[_0x332d('0x3')](_0x332d('0x4'),typeof _0x40eb3a===_0x332d('0x5')&&_0x40eb3a[_0x332d('0x6')]()?_0x40eb3a[_0x332d('0x6')]():null);}},'pager':{'type':Sequelize[_0x332d('0x1')]},'tz':{'type':Sequelize[_0x332d('0x1')],'defaultValue':_0x332d('0x7')},'attach':{'type':Sequelize['ENUM'](_0x332d('0x8'),'no'),'defaultValue':_0x332d('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x332d('0x9')](_0x332d('0x8'),'no'),'defaultValue':_0x332d('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x332d('0x1')]},'callback':{'type':Sequelize[_0x332d('0x1')]},'review':{'type':Sequelize[_0x332d('0x9')](_0x332d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x332d('0x9')](_0x332d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x332d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x332d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x332d('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x332d('0x9')](_0x332d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x332d('0x9')](_0x332d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x332d('0x9')](_0x332d('0x8'),'no'),'defaultValue':_0x332d('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x332d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x332d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x332d('0x9')](_0x332d('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x332d('0xb')},'emailsubject':{'type':Sequelize[_0x332d('0x1')]},'emailbody':{'type':Sequelize[_0x332d('0x1')]},'name':{'type':Sequelize[_0x332d('0x1')]},'maxsecs':{'type':Sequelize[_0x332d('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x332d('0xc')](0xff),'defaultValue':0x64,'allowNull':![]}}; \ No newline at end of file +var _0x6b9b=['yes','TINYINT(4)','TIMESTAMP','INTEGER','sequelize','STRING','from-voicemail','contest_mailbox','string','trim','ENUM'];(function(_0x3b5213,_0x10e73c){var _0xe6882b=function(_0x42b384){while(--_0x42b384){_0x3b5213['push'](_0x3b5213['shift']());}};_0xe6882b(++_0x10e73c);}(_0x6b9b,0x1f3));var _0xb6b9=function(_0x36adf3,_0x187dfd){_0x36adf3=_0x36adf3-0x0;var _0x31173d=_0x6b9b[_0x36adf3];return _0x31173d;};'use strict';var Sequelize=require(_0xb6b9('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb6b9('0x1')],'defaultValue':_0xb6b9('0x2'),'unique':_0xb6b9('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xb6b9('0x3')},'password':{'type':Sequelize[_0xb6b9('0x1')]},'fullname':{'type':Sequelize[_0xb6b9('0x1')]},'email':{'type':Sequelize[_0xb6b9('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4a5997){this['setDataValue']('email',typeof _0x4a5997===_0xb6b9('0x4')&&_0x4a5997[_0xb6b9('0x5')]()?_0x4a5997[_0xb6b9('0x5')]():null);}},'pager':{'type':Sequelize[_0xb6b9('0x1')]},'tz':{'type':Sequelize[_0xb6b9('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xb6b9('0x6')](_0xb6b9('0x7'),'no'),'defaultValue':_0xb6b9('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xb6b9('0x1')]},'review':{'type':Sequelize[_0xb6b9('0x6')](_0xb6b9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xb6b9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb6b9('0x6')](_0xb6b9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb6b9('0x6')](_0xb6b9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb6b9('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb6b9('0x6')](_0xb6b9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb6b9('0x6')](_0xb6b9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xb6b9('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb6b9('0x6')](_0xb6b9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xb6b9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb6b9('0x6')](_0xb6b9('0x7'),'no'),'defaultValue':_0xb6b9('0x7'),'allowNull':![]},'stamp':{'type':_0xb6b9('0x9')},'emailsubject':{'type':Sequelize[_0xb6b9('0x1')]},'emailbody':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xb6b9('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb6b9('0xa')](0xff),'defaultValue':0x64,'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 03dd6ef..7f484cb 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 _0x76b5=['json','apply','reject','save','destroy','end','error','name','index','VoiceMail','rawAttributes','model','keys','query','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','dateStart','add','day','merge','where','filter','map','then','findAll','rows','params','includeAll','options','create','body','catch','find','VoiceMailMessage','length','sort','findAndCountAll','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range'];(function(_0x129102,_0x3ac9c9){var _0x346551=function(_0x4040e5){while(--_0x4040e5){_0x129102['push'](_0x129102['shift']());}};_0x346551(++_0x3ac9c9);}(_0x76b5,0x185));var _0x576b=function(_0x563af1,_0x37924c){_0x563af1=_0x563af1-0x0;var _0x58fccb=_0x76b5[_0x563af1];return _0x58fccb;};'use strict';var jsonpatch=require(_0x576b('0x0'));var rp=require('request-promise');var moment=require(_0x576b('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x576b('0x2'));var path=require(_0x576b('0x3'));var sox=require('sox');var csv=require(_0x576b('0x4'));var ejs=require(_0x576b('0x5'));var fs=require('fs');var _=require(_0x576b('0x6'));var squel=require(_0x576b('0x7'));var crypto=require(_0x576b('0x8'));var jsforce=require(_0x576b('0x9'));var deskjs=require(_0x576b('0xa'));var toCsv=require(_0x576b('0x4'));var querystring=require(_0x576b('0xb'));var Papa=require(_0x576b('0xc'));var qs=require(_0x576b('0xd'));var logger=require('../../config/logger')(_0x576b('0xe'));var utils=require(_0x576b('0xf'));var config=require(_0x576b('0x10'));var db=require(_0x576b('0x11'))['db'];function respondWithStatusCode(_0xb867fc,_0x408f75){_0x408f75=_0x408f75||0xcc;return function(_0x4b1c4f){if(_0x4b1c4f){return _0xb867fc[_0x576b('0x12')](_0x408f75);}return _0xb867fc[_0x576b('0x13')](_0x408f75)['end']();};}function respondWithResult(_0x4ef0a8,_0x33cd46){_0x33cd46=_0x33cd46||0xc8;return function(_0x11880a){if(_0x11880a){return _0x4ef0a8[_0x576b('0x13')](_0x33cd46)['json'](_0x11880a);}};}function respondWithFilteredResult(_0x266680,_0x4d097c){return function(_0x2fda5f){if(_0x2fda5f){var _0x37d9fd=_0x2fda5f[_0x576b('0x14')],_0x174e2f=_0x4d097c[_0x576b('0x15')],_0xac0f4f=_0x4d097c[_0x576b('0x15')]+_0x4d097c[_0x576b('0x16')],_0x47da02;if(_0xac0f4f>=_0x37d9fd){_0xac0f4f=_0x37d9fd;_0x47da02=0xc8;}else{_0x47da02=0xce;}_0x266680[_0x576b('0x13')](_0x47da02);return _0x266680[_0x576b('0x17')](_0x576b('0x18'),_0x174e2f+'-'+_0xac0f4f+'/'+_0x37d9fd)[_0x576b('0x19')](_0x2fda5f);}return null;};}function patchUpdates(_0x2001bb){return function(_0x1cdd8d){try{jsonpatch[_0x576b('0x1a')](_0x1cdd8d,_0x2001bb,!![]);}catch(_0x3b3748){return BPromise[_0x576b('0x1b')](_0x3b3748);}return _0x1cdd8d[_0x576b('0x1c')]();};}function saveUpdates(_0x145a90,_0x398962){return function(_0x4b5734){if(_0x4b5734){return _0x4b5734['update'](_0x145a90)['then'](function(_0x533474){return _0x533474;});}return null;};}function removeEntity(_0x3b4249,_0x362b3c){return function(_0x39164f){if(_0x39164f){return _0x39164f[_0x576b('0x1d')]()['then'](function(){_0x3b4249[_0x576b('0x13')](0xcc)[_0x576b('0x1e')]();});}};}function handleEntityNotFound(_0x5baed9,_0x3d9dcb){return function(_0x222d58){if(!_0x222d58){_0x5baed9[_0x576b('0x12')](0x194);}return _0x222d58;};}function handleError(_0x3f9920,_0x37df76){_0x37df76=_0x37df76||0x1f4;return function(_0x2533e0){logger[_0x576b('0x1f')](_0x2533e0['stack']);if(_0x2533e0[_0x576b('0x20')]){delete _0x2533e0['name'];}_0x3f9920[_0x576b('0x13')](_0x37df76)['send'](_0x2533e0);};}exports[_0x576b('0x21')]=function(_0x396d81,_0x20f2d9){var _0x5b4c7f={},_0x4e08b8={},_0x49b82f={'count':0x0,'rows':[]};var _0x3c5679=db[_0x576b('0x22')][_0x576b('0x23')];_0x4e08b8[_0x576b('0x24')]=_[_0x576b('0x25')](_0x3c5679);var _0x488e02={'dateStart':_0x396d81[_0x576b('0x26')]['dateStart'],'dateEnd':_0x396d81['query'][_0x576b('0x27')]};delete _0x396d81['query']['dateStart'];delete _0x396d81[_0x576b('0x26')]['dateEnd'];_0x4e08b8[_0x576b('0x26')]=_[_0x576b('0x25')](_0x396d81[_0x576b('0x26')]);_0x4e08b8['filters']=_[_0x576b('0x28')](_0x4e08b8[_0x576b('0x24')],_0x4e08b8[_0x576b('0x26')]);_0x5b4c7f[_0x576b('0x29')]=_[_0x576b('0x28')](_0x4e08b8[_0x576b('0x24')],qs[_0x576b('0x2a')](_0x396d81[_0x576b('0x26')][_0x576b('0x2a')]));_0x5b4c7f[_0x576b('0x29')]=_0x5b4c7f[_0x576b('0x29')]['length']?_0x5b4c7f[_0x576b('0x29')]:_0x4e08b8[_0x576b('0x24')];if(!_0x396d81[_0x576b('0x26')][_0x576b('0x2b')](_0x576b('0x2c'))){_0x5b4c7f[_0x576b('0x16')]=qs['limit'](_0x396d81[_0x576b('0x26')][_0x576b('0x16')]);_0x5b4c7f['offset']=qs[_0x576b('0x15')](_0x396d81['query']['offset']);}_0x5b4c7f[_0x576b('0x2d')]=qs['sort'](_0x396d81[_0x576b('0x26')]['sort']);_0x5b4c7f['where']=qs[_0x576b('0x2e')](_[_0x576b('0x2f')](_0x396d81[_0x576b('0x26')],_0x4e08b8['filters']));if(_0x488e02[_0x576b('0x30')]){if(_0x488e02[_0x576b('0x27')]){_0x488e02[_0x576b('0x27')]=moment(_0x488e02['dateEnd'])[_0x576b('0x31')](0x1,_0x576b('0x32'));}else{_0x488e02[_0x576b('0x27')]=moment(_0x488e02[_0x576b('0x30')])[_0x576b('0x31')](0x1,_0x576b('0x32'));}_[_0x576b('0x33')](_0x5b4c7f[_0x576b('0x34')],{'createdAt':{'$gte':_0x488e02[_0x576b('0x30')],'$lte':_0x488e02[_0x576b('0x27')]}});}if(_0x396d81[_0x576b('0x26')][_0x576b('0x35')]){_0x5b4c7f[_0x576b('0x34')]=_['merge'](_0x5b4c7f['where'],{'$or':_[_0x576b('0x36')](_0x5b4c7f[_0x576b('0x29')],function(_0x2ac14a){var _0xddc7c0={};_0xddc7c0[_0x2ac14a]={'$like':'%'+_0x396d81['query'][_0x576b('0x35')]+'%'};return _0xddc7c0;})});}_0x5b4c7f=_[_0x576b('0x33')]({},_0x5b4c7f,_0x396d81['options']);var _0x281a83={'where':_0x5b4c7f[_0x576b('0x34')]};return db[_0x576b('0x22')][_0x576b('0x14')](_0x281a83)[_0x576b('0x37')](function(_0xcd6843){_0x49b82f['count']=_0xcd6843;if(_0x396d81[_0x576b('0x26')]['includeAll']){_0x5b4c7f['include']=[{'all':!![]}];}return db[_0x576b('0x22')][_0x576b('0x38')](_0x5b4c7f);})[_0x576b('0x37')](function(_0x3ae2c4){_0x49b82f[_0x576b('0x39')]=_0x3ae2c4;return _0x49b82f;})['then'](respondWithFilteredResult(_0x20f2d9,_0x5b4c7f))['catch'](handleError(_0x20f2d9,null));};exports['show']=function(_0x382afd,_0x2b7028){var _0x499904={'raw':!![],'where':{'id':_0x382afd[_0x576b('0x3a')]['id']}},_0x587c2c={};_0x587c2c[_0x576b('0x24')]=_['keys'](db[_0x576b('0x22')][_0x576b('0x23')]);_0x587c2c['query']=_['keys'](_0x382afd[_0x576b('0x26')]);_0x587c2c[_0x576b('0x2e')]=_['intersection'](_0x587c2c[_0x576b('0x24')],_0x587c2c['query']);_0x499904[_0x576b('0x29')]=_[_0x576b('0x28')](_0x587c2c[_0x576b('0x24')],qs['fields'](_0x382afd[_0x576b('0x26')]['fields']));_0x499904['attributes']=_0x499904[_0x576b('0x29')]['length']?_0x499904[_0x576b('0x29')]:_0x587c2c[_0x576b('0x24')];if(_0x382afd[_0x576b('0x26')][_0x576b('0x3b')]){_0x499904['include']=[{'all':!![]}];}_0x499904=_[_0x576b('0x33')]({},_0x499904,_0x382afd[_0x576b('0x3c')]);return db[_0x576b('0x22')]['find'](_0x499904)[_0x576b('0x37')](handleEntityNotFound(_0x2b7028,null))[_0x576b('0x37')](respondWithResult(_0x2b7028,null))['catch'](handleError(_0x2b7028,null));};exports[_0x576b('0x3d')]=function(_0x1237c6,_0x578232){return db[_0x576b('0x22')][_0x576b('0x3d')](_0x1237c6[_0x576b('0x3e')],{})[_0x576b('0x37')](respondWithResult(_0x578232,0xc9))['catch'](handleError(_0x578232,null));};exports['update']=function(_0x2b91b9,_0xb7aaf1){if(_0x2b91b9[_0x576b('0x3e')]['id']){delete _0x2b91b9[_0x576b('0x3e')]['id'];}return db[_0x576b('0x22')]['find']({'where':{'id':_0x2b91b9[_0x576b('0x3a')]['id']}})['then'](handleEntityNotFound(_0xb7aaf1,null))['then'](saveUpdates(_0x2b91b9['body'],null))['then'](respondWithResult(_0xb7aaf1,null))[_0x576b('0x3f')](handleError(_0xb7aaf1,null));};exports[_0x576b('0x1d')]=function(_0x1fd4a0,_0xe4c2ae){return db[_0x576b('0x22')][_0x576b('0x40')]({'where':{'id':_0x1fd4a0[_0x576b('0x3a')]['id']}})[_0x576b('0x37')](handleEntityNotFound(_0xe4c2ae,null))[_0x576b('0x37')](removeEntity(_0xe4c2ae,null))[_0x576b('0x3f')](handleError(_0xe4c2ae,null));};exports['getMessages']=function(_0x2f8d49,_0x2d0b48,_0x4272e2){return db[_0x576b('0x22')]['findOne']({'where':{'id':_0x2f8d49[_0x576b('0x3a')]['id']}})[_0x576b('0x37')](handleEntityNotFound(_0x2d0b48,null))[_0x576b('0x37')](function(_0x189441){var _0x5c7f4c;var _0x3f18d1={},_0x25f355={};_0x25f355['model']=_['keys'](db[_0x576b('0x41')][_0x576b('0x23')]);_0x25f355[_0x576b('0x26')]=_['keys'](_0x2f8d49[_0x576b('0x26')]);_0x25f355[_0x576b('0x2e')]=_[_0x576b('0x28')](_0x25f355[_0x576b('0x24')],_0x25f355[_0x576b('0x26')]);_0x3f18d1[_0x576b('0x29')]=_[_0x576b('0x28')](_0x25f355['model'],qs[_0x576b('0x2a')](_0x2f8d49['query']['fields']));_0x3f18d1[_0x576b('0x29')]=_0x3f18d1[_0x576b('0x29')][_0x576b('0x42')]?_0x3f18d1[_0x576b('0x29')]:_0x25f355[_0x576b('0x24')];if(!_0x2f8d49[_0x576b('0x26')]['hasOwnProperty'](_0x576b('0x2c'))){_0x3f18d1[_0x576b('0x16')]=qs['limit'](_0x2f8d49[_0x576b('0x26')][_0x576b('0x16')]);_0x3f18d1[_0x576b('0x15')]=qs[_0x576b('0x15')](_0x2f8d49[_0x576b('0x26')][_0x576b('0x15')]);}_0x3f18d1[_0x576b('0x2d')]=qs[_0x576b('0x43')](_0x2f8d49['query'][_0x576b('0x43')]);_0x3f18d1[_0x576b('0x34')]=qs[_0x576b('0x2e')](_[_0x576b('0x2f')](_0x2f8d49[_0x576b('0x26')],_0x25f355[_0x576b('0x2e')]));if(_0x2f8d49[_0x576b('0x26')][_0x576b('0x35')]){_0x3f18d1['where']=_[_0x576b('0x33')](_0x3f18d1[_0x576b('0x34')],{'$or':_[_0x576b('0x36')](_0x3f18d1[_0x576b('0x29')],function(_0x550108){var _0x2d8a38={};_0x2d8a38[_0x550108]={'$like':'%'+_0x2f8d49['query']['filter']+'%'};return _0x2d8a38;})});}_0x3f18d1['where']=_[_0x576b('0x33')](_0x3f18d1[_0x576b('0x34')],{'mailboxuser':_0x189441['mailbox']});_0x3f18d1=_[_0x576b('0x33')]({},_0x3f18d1,_0x2f8d49[_0x576b('0x3c')]);return db['VoiceMailMessage'][_0x576b('0x44')](_0x3f18d1)[_0x576b('0x37')](respondWithFilteredResult(_0x2d0b48,_0x3f18d1));})[_0x576b('0x3f')](handleError(_0x2d0b48,null));}; \ No newline at end of file +var _0x492f=['dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','add','day','where','filter','map','merge','options','findAll','catch','params','includeAll','include','find','create','body','getMessages','VoiceMailMessage','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','VoiceMail','rawAttributes','model','keys','query'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x492f,0x18b));var _0xf492=function(_0x548d2d,_0x1ac7d4){_0x548d2d=_0x548d2d-0x0;var _0x4a733e=_0x492f[_0x548d2d];return _0x4a733e;};'use strict';var jsonpatch=require(_0xf492('0x0'));var rp=require(_0xf492('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf492('0x2'));var util=require(_0xf492('0x3'));var path=require(_0xf492('0x4'));var sox=require(_0xf492('0x5'));var csv=require(_0xf492('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf492('0x7'));var squel=require(_0xf492('0x8'));var crypto=require(_0xf492('0x9'));var jsforce=require(_0xf492('0xa'));var deskjs=require(_0xf492('0xb'));var toCsv=require(_0xf492('0x6'));var querystring=require(_0xf492('0xc'));var Papa=require(_0xf492('0xd'));var qs=require(_0xf492('0xe'));var logger=require(_0xf492('0xf'))(_0xf492('0x10'));var utils=require(_0xf492('0x11'));var config=require(_0xf492('0x12'));var db=require(_0xf492('0x13'))['db'];function respondWithStatusCode(_0x59beaa,_0x26e5ed){_0x26e5ed=_0x26e5ed||0xcc;return function(_0x5077ba){if(_0x5077ba){return _0x59beaa[_0xf492('0x14')](_0x26e5ed);}return _0x59beaa[_0xf492('0x15')](_0x26e5ed)['end']();};}function respondWithResult(_0x2850d4,_0x2c2712){_0x2c2712=_0x2c2712||0xc8;return function(_0x532e2d){if(_0x532e2d){return _0x2850d4[_0xf492('0x15')](_0x2c2712)[_0xf492('0x16')](_0x532e2d);}};}function respondWithFilteredResult(_0x395434,_0x1d1058){return function(_0x31fc91){if(_0x31fc91){var _0x49a479=_0x31fc91[_0xf492('0x17')],_0xadd894=_0x1d1058[_0xf492('0x18')],_0x47b6d8=_0x1d1058['offset']+_0x1d1058['limit'],_0x144751;if(_0x47b6d8>=_0x49a479){_0x47b6d8=_0x49a479;_0x144751=0xc8;}else{_0x144751=0xce;}_0x395434['status'](_0x144751);return _0x395434[_0xf492('0x19')](_0xf492('0x1a'),_0xadd894+'-'+_0x47b6d8+'/'+_0x49a479)[_0xf492('0x16')](_0x31fc91);}return null;};}function patchUpdates(_0x359548){return function(_0x234c61){try{jsonpatch[_0xf492('0x1b')](_0x234c61,_0x359548,!![]);}catch(_0x2c786a){return BPromise[_0xf492('0x1c')](_0x2c786a);}return _0x234c61[_0xf492('0x1d')]();};}function saveUpdates(_0x1534f2,_0x3863e5){return function(_0x56ff98){if(_0x56ff98){return _0x56ff98['update'](_0x1534f2)[_0xf492('0x1e')](function(_0x11cd79){return _0x11cd79;});}return null;};}function removeEntity(_0x27df58,_0x4ebfc8){return function(_0x57547c){if(_0x57547c){return _0x57547c[_0xf492('0x1f')]()['then'](function(){_0x27df58[_0xf492('0x15')](0xcc)[_0xf492('0x20')]();});}};}function handleEntityNotFound(_0x437331,_0x403ab2){return function(_0x19db14){if(!_0x19db14){_0x437331[_0xf492('0x14')](0x194);}return _0x19db14;};}function handleError(_0x369a25,_0x5f40f3){_0x5f40f3=_0x5f40f3||0x1f4;return function(_0x3256be){logger[_0xf492('0x21')](_0x3256be[_0xf492('0x22')]);if(_0x3256be[_0xf492('0x23')]){delete _0x3256be[_0xf492('0x23')];}_0x369a25[_0xf492('0x15')](_0x5f40f3)[_0xf492('0x24')](_0x3256be);};}exports[_0xf492('0x25')]=function(_0x2c2bac,_0x1f74f4){var _0x71f22b={},_0x347e65={},_0x46f450={'count':0x0,'rows':[]};var _0x24f7e1=db[_0xf492('0x26')][_0xf492('0x27')];_0x347e65[_0xf492('0x28')]=_[_0xf492('0x29')](_0x24f7e1);var _0x4e96d5={'dateStart':_0x2c2bac[_0xf492('0x2a')][_0xf492('0x2b')],'dateEnd':_0x2c2bac[_0xf492('0x2a')][_0xf492('0x2c')]};delete _0x2c2bac[_0xf492('0x2a')][_0xf492('0x2b')];delete _0x2c2bac['query'][_0xf492('0x2c')];_0x347e65[_0xf492('0x2a')]=_[_0xf492('0x29')](_0x2c2bac['query']);_0x347e65['filters']=_[_0xf492('0x2d')](_0x347e65[_0xf492('0x28')],_0x347e65[_0xf492('0x2a')]);_0x71f22b['attributes']=_[_0xf492('0x2d')](_0x347e65[_0xf492('0x28')],qs[_0xf492('0x2e')](_0x2c2bac[_0xf492('0x2a')][_0xf492('0x2e')]));_0x71f22b[_0xf492('0x2f')]=_0x71f22b[_0xf492('0x2f')][_0xf492('0x30')]?_0x71f22b[_0xf492('0x2f')]:_0x347e65[_0xf492('0x28')];if(!_0x2c2bac[_0xf492('0x2a')][_0xf492('0x31')](_0xf492('0x32'))){_0x71f22b[_0xf492('0x33')]=qs['limit'](_0x2c2bac['query'][_0xf492('0x33')]);_0x71f22b[_0xf492('0x18')]=qs[_0xf492('0x18')](_0x2c2bac[_0xf492('0x2a')][_0xf492('0x18')]);}_0x71f22b[_0xf492('0x34')]=qs[_0xf492('0x35')](_0x2c2bac[_0xf492('0x2a')][_0xf492('0x35')]);_0x71f22b['where']=qs[_0xf492('0x36')](_[_0xf492('0x37')](_0x2c2bac['query'],_0x347e65['filters']));if(_0x4e96d5['dateStart']){if(_0x4e96d5[_0xf492('0x2c')]){_0x4e96d5[_0xf492('0x2c')]=moment(_0x4e96d5[_0xf492('0x2c')])[_0xf492('0x38')](0x1,_0xf492('0x39'));}else{_0x4e96d5[_0xf492('0x2c')]=moment(_0x4e96d5[_0xf492('0x2b')])[_0xf492('0x38')](0x1,'day');}_['merge'](_0x71f22b[_0xf492('0x3a')],{'createdAt':{'$gte':_0x4e96d5[_0xf492('0x2b')],'$lte':_0x4e96d5['dateEnd']}});}if(_0x2c2bac['query'][_0xf492('0x3b')]){_0x71f22b[_0xf492('0x3a')]=_['merge'](_0x71f22b[_0xf492('0x3a')],{'$or':_[_0xf492('0x3c')](_0x71f22b[_0xf492('0x2f')],function(_0x2d460c){var _0x1fc52b={};_0x1fc52b[_0x2d460c]={'$like':'%'+_0x2c2bac[_0xf492('0x2a')][_0xf492('0x3b')]+'%'};return _0x1fc52b;})});}_0x71f22b=_[_0xf492('0x3d')]({},_0x71f22b,_0x2c2bac[_0xf492('0x3e')]);var _0x359a78={'where':_0x71f22b[_0xf492('0x3a')]};return db[_0xf492('0x26')][_0xf492('0x17')](_0x359a78)[_0xf492('0x1e')](function(_0x59bf67){_0x46f450[_0xf492('0x17')]=_0x59bf67;if(_0x2c2bac[_0xf492('0x2a')]['includeAll']){_0x71f22b['include']=[{'all':!![]}];}return db[_0xf492('0x26')][_0xf492('0x3f')](_0x71f22b);})[_0xf492('0x1e')](function(_0x5ac679){_0x46f450['rows']=_0x5ac679;return _0x46f450;})[_0xf492('0x1e')](respondWithFilteredResult(_0x1f74f4,_0x71f22b))[_0xf492('0x40')](handleError(_0x1f74f4,null));};exports['show']=function(_0x218e1b,_0x41edbd){var _0x157497={'raw':!![],'where':{'id':_0x218e1b[_0xf492('0x41')]['id']}},_0x5c9a36={};_0x5c9a36[_0xf492('0x28')]=_[_0xf492('0x29')](db[_0xf492('0x26')]['rawAttributes']);_0x5c9a36[_0xf492('0x2a')]=_['keys'](_0x218e1b['query']);_0x5c9a36[_0xf492('0x36')]=_['intersection'](_0x5c9a36['model'],_0x5c9a36[_0xf492('0x2a')]);_0x157497[_0xf492('0x2f')]=_[_0xf492('0x2d')](_0x5c9a36[_0xf492('0x28')],qs['fields'](_0x218e1b[_0xf492('0x2a')]['fields']));_0x157497[_0xf492('0x2f')]=_0x157497[_0xf492('0x2f')][_0xf492('0x30')]?_0x157497[_0xf492('0x2f')]:_0x5c9a36['model'];if(_0x218e1b[_0xf492('0x2a')][_0xf492('0x42')]){_0x157497[_0xf492('0x43')]=[{'all':!![]}];}_0x157497=_['merge']({},_0x157497,_0x218e1b[_0xf492('0x3e')]);return db[_0xf492('0x26')][_0xf492('0x44')](_0x157497)[_0xf492('0x1e')](handleEntityNotFound(_0x41edbd,null))[_0xf492('0x1e')](respondWithResult(_0x41edbd,null))[_0xf492('0x40')](handleError(_0x41edbd,null));};exports[_0xf492('0x45')]=function(_0x2689cb,_0x5cda9f){return db[_0xf492('0x26')][_0xf492('0x45')](_0x2689cb['body'],{})[_0xf492('0x1e')](respondWithResult(_0x5cda9f,0xc9))[_0xf492('0x40')](handleError(_0x5cda9f,null));};exports['update']=function(_0x214ff7,_0x250c29){if(_0x214ff7[_0xf492('0x46')]['id']){delete _0x214ff7[_0xf492('0x46')]['id'];}return db[_0xf492('0x26')][_0xf492('0x44')]({'where':{'id':_0x214ff7['params']['id']}})[_0xf492('0x1e')](handleEntityNotFound(_0x250c29,null))[_0xf492('0x1e')](saveUpdates(_0x214ff7['body'],null))[_0xf492('0x1e')](respondWithResult(_0x250c29,null))['catch'](handleError(_0x250c29,null));};exports[_0xf492('0x1f')]=function(_0x1d4764,_0x9d1a89){return db['VoiceMail'][_0xf492('0x44')]({'where':{'id':_0x1d4764['params']['id']}})[_0xf492('0x1e')](handleEntityNotFound(_0x9d1a89,null))[_0xf492('0x1e')](removeEntity(_0x9d1a89,null))[_0xf492('0x40')](handleError(_0x9d1a89,null));};exports[_0xf492('0x47')]=function(_0x5ec429,_0xa74c20,_0x58ab86){return db[_0xf492('0x26')]['findOne']({'where':{'id':_0x5ec429[_0xf492('0x41')]['id']}})[_0xf492('0x1e')](handleEntityNotFound(_0xa74c20,null))['then'](function(_0x4b4047){var _0x2bf4cd;var _0x2a5ff9={},_0xd354={};_0xd354[_0xf492('0x28')]=_[_0xf492('0x29')](db[_0xf492('0x48')][_0xf492('0x27')]);_0xd354[_0xf492('0x2a')]=_[_0xf492('0x29')](_0x5ec429[_0xf492('0x2a')]);_0xd354[_0xf492('0x36')]=_['intersection'](_0xd354[_0xf492('0x28')],_0xd354[_0xf492('0x2a')]);_0x2a5ff9['attributes']=_['intersection'](_0xd354[_0xf492('0x28')],qs[_0xf492('0x2e')](_0x5ec429[_0xf492('0x2a')][_0xf492('0x2e')]));_0x2a5ff9[_0xf492('0x2f')]=_0x2a5ff9[_0xf492('0x2f')]['length']?_0x2a5ff9[_0xf492('0x2f')]:_0xd354[_0xf492('0x28')];if(!_0x5ec429[_0xf492('0x2a')][_0xf492('0x31')]('nolimit')){_0x2a5ff9[_0xf492('0x33')]=qs[_0xf492('0x33')](_0x5ec429[_0xf492('0x2a')][_0xf492('0x33')]);_0x2a5ff9[_0xf492('0x18')]=qs['offset'](_0x5ec429[_0xf492('0x2a')][_0xf492('0x18')]);}_0x2a5ff9[_0xf492('0x34')]=qs[_0xf492('0x35')](_0x5ec429[_0xf492('0x2a')]['sort']);_0x2a5ff9[_0xf492('0x3a')]=qs[_0xf492('0x36')](_[_0xf492('0x37')](_0x5ec429[_0xf492('0x2a')],_0xd354[_0xf492('0x36')]));if(_0x5ec429[_0xf492('0x2a')][_0xf492('0x3b')]){_0x2a5ff9[_0xf492('0x3a')]=_[_0xf492('0x3d')](_0x2a5ff9[_0xf492('0x3a')],{'$or':_[_0xf492('0x3c')](_0x2a5ff9[_0xf492('0x2f')],function(_0x35787a){var _0x5d0051={};_0x5d0051[_0x35787a]={'$like':'%'+_0x5ec429[_0xf492('0x2a')]['filter']+'%'};return _0x5d0051;})});}_0x2a5ff9['where']=_[_0xf492('0x3d')](_0x2a5ff9[_0xf492('0x3a')],{'mailboxuser':_0x4b4047['mailbox']});_0x2a5ff9=_[_0xf492('0x3d')]({},_0x2a5ff9,_0x5ec429[_0xf492('0x3e')]);return db[_0xf492('0x48')]['findAndCountAll'](_0x2a5ff9)[_0xf492('0x1e')](respondWithFilteredResult(_0xa74c20,_0x2a5ff9));})[_0xf492('0x40')](handleError(_0xa74c20,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2f870c7..6890054 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 _0xd5f2=['util','api','moment','bluebird','request-promise','./voiceMail.attributes','exports','voice_voicemail','mailbox_context','lodash'];(function(_0x188d37,_0x1f137a){var _0x31e650=function(_0x1ffc5c){while(--_0x1ffc5c){_0x188d37['push'](_0x188d37['shift']());}};_0x31e650(++_0x1f137a);}(_0xd5f2,0x167));var _0x2d5f=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xd5f2[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x2d5f('0x0'));var util=require(_0x2d5f('0x1'));var logger=require('../../config/logger')(_0x2d5f('0x2'));var moment=require(_0x2d5f('0x3'));var BPromise=require(_0x2d5f('0x4'));var rp=require(_0x2d5f('0x5'));var attributes=require(_0x2d5f('0x6'));module[_0x2d5f('0x7')]=function(_0x281cdd,_0x3fecd0){return _0x281cdd['define']('VoiceMail',attributes,{'tableName':_0x2d5f('0x8'),'paranoid':![],'indexes':[{'name':_0x2d5f('0x9'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x28db=['context','lodash','util','api','moment','bluebird','request-promise','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x34bdc9,_0x162199){var _0x5d19fc=function(_0x3d6217){while(--_0x3d6217){_0x34bdc9['push'](_0x34bdc9['shift']());}};_0x5d19fc(++_0x162199);}(_0x28db,0x69));var _0xb28d=function(_0x190a63,_0x235a68){_0x190a63=_0x190a63-0x0;var _0x3f234d=_0x28db[_0x190a63];return _0x3f234d;};'use strict';var _=require(_0xb28d('0x0'));var util=require(_0xb28d('0x1'));var logger=require('../../config/logger')(_0xb28d('0x2'));var moment=require(_0xb28d('0x3'));var BPromise=require(_0xb28d('0x4'));var rp=require(_0xb28d('0x5'));var attributes=require('./voiceMail.attributes');module[_0xb28d('0x6')]=function(_0x13feae,_0x36c0dc){return _0x13feae[_0xb28d('0x7')](_0xb28d('0x8'),attributes,{'tableName':_0xb28d('0x9'),'paranoid':![],'indexes':[{'name':_0xb28d('0xa'),'fields':[_0xb28d('0xb'),_0xb28d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 01cf852..3f346ab 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 _0xc546=['../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc546,0x177));var _0x6c54=function(_0x5e5388,_0x472448){_0x5e5388=_0x5e5388-0x0;var _0x2dcd9b=_0xc546[_0x5e5388];return _0x2dcd9b;};'use strict';var _=require(_0x6c54('0x0'));var util=require(_0x6c54('0x1'));var moment=require(_0x6c54('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x6c54('0x3'))['db'];var utils=require(_0x6c54('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6c54('0x5'));var client=jayson[_0x6c54('0x6')][_0x6c54('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x13fd4e,_0xae7fef,_0x143992){return new BPromise(function(_0x18eb54,_0x2d791f){return client[_0x6c54('0x8')](_0x13fd4e,_0x143992)['then'](function(_0xe5d22a){logger[_0x6c54('0x9')](_0x6c54('0xa'),_0xae7fef,_0x6c54('0xb'));logger[_0x6c54('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0xae7fef,_0x6c54('0xb'),JSON['stringify'](_0xe5d22a));if(_0xe5d22a[_0x6c54('0xd')]){if(_0xe5d22a['error'][_0x6c54('0xe')]===0x1f4){logger[_0x6c54('0xd')](_0x6c54('0xa'),_0xae7fef,_0xe5d22a['error'][_0x6c54('0xf')]);return _0x2d791f(_0xe5d22a[_0x6c54('0xd')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0xae7fef,_0xe5d22a[_0x6c54('0xd')][_0x6c54('0xf')]);return _0x18eb54(_0xe5d22a[_0x6c54('0xd')][_0x6c54('0xf')]);}else{logger[_0x6c54('0x9')](_0x6c54('0xa'),_0xae7fef,_0x6c54('0xb'));_0x18eb54(_0xe5d22a[_0x6c54('0x10')][_0x6c54('0xf')]);}})[_0x6c54('0x11')](function(_0x187a7a){logger['error'](_0x6c54('0xa'),_0xae7fef,_0x187a7a);_0x2d791f(_0x187a7a);});});} \ No newline at end of file +var _0x6b33=['result','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceMail,\x20%s,\x20%s'];(function(_0x4fb789,_0x6b8092){var _0x49b5e4=function(_0x256537){while(--_0x256537){_0x4fb789['push'](_0x4fb789['shift']());}};_0x49b5e4(++_0x6b8092);}(_0x6b33,0x9c));var _0x36b3=function(_0x4a00ab,_0x1d1ff5){_0x4a00ab=_0x4a00ab-0x0;var _0x55c4e8=_0x6b33[_0x4a00ab];return _0x55c4e8;};'use strict';var _=require(_0x36b3('0x0'));var util=require(_0x36b3('0x1'));var moment=require(_0x36b3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x36b3('0x3'));var logger=require(_0x36b3('0x4'))(_0x36b3('0x5'));var config=require('../../config/environment');var jayson=require(_0x36b3('0x6'));var client=jayson[_0x36b3('0x7')][_0x36b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e0d48,_0x268e9f,_0x3eb377){return new BPromise(function(_0xb99c74,_0x51fd37){return client[_0x36b3('0x9')](_0x3e0d48,_0x3eb377)[_0x36b3('0xa')](function(_0x3f2133){logger[_0x36b3('0xb')]('VoiceMail,\x20%s,\x20%s',_0x268e9f,'request\x20sent');logger[_0x36b3('0xc')](_0x36b3('0xd'),_0x268e9f,_0x36b3('0xe'),JSON[_0x36b3('0xf')](_0x3f2133));if(_0x3f2133[_0x36b3('0x10')]){if(_0x3f2133['error'][_0x36b3('0x11')]===0x1f4){logger[_0x36b3('0x10')]('VoiceMail,\x20%s,\x20%s',_0x268e9f,_0x3f2133['error']['message']);return _0x51fd37(_0x3f2133['error'][_0x36b3('0x12')]);}logger['error'](_0x36b3('0x13'),_0x268e9f,_0x3f2133[_0x36b3('0x10')][_0x36b3('0x12')]);return _0xb99c74(_0x3f2133[_0x36b3('0x10')][_0x36b3('0x12')]);}else{logger['info'](_0x36b3('0x13'),_0x268e9f,_0x36b3('0xe'));_0xb99c74(_0x3f2133[_0x36b3('0x14')][_0x36b3('0x12')]);}})[_0x36b3('0x15')](function(_0x20b28c){logger['error']('VoiceMail,\x20%s,\x20%s',_0x268e9f,_0x20b28c);_0x51fd37(_0x20b28c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e8f6e30..8c53ae2 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 _0xfb6d=['get','/:id','show','download','post','create','put','isAuthenticated','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb6d,0x70));var _0xdfb6=function(_0x1b3218,_0x292748){_0x1b3218=_0x1b3218-0x0;var _0x4e18c9=_0xfb6d[_0x1b3218];return _0x4e18c9;};'use strict';var multer=require('multer');var util=require(_0xdfb6('0x0'));var path=require(_0xdfb6('0x1'));var express=require(_0xdfb6('0x2'));var router=express[_0xdfb6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xdfb6('0x4'));var config=require(_0xdfb6('0x5'));var controller=require(_0xdfb6('0x6'));router[_0xdfb6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdfb6('0x7')](_0xdfb6('0x8'),auth['isAuthenticated'](),controller[_0xdfb6('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xdfb6('0xa')]);router[_0xdfb6('0xb')]('/',auth['isAuthenticated'](),controller[_0xdfb6('0xc')]);router[_0xdfb6('0xd')](_0xdfb6('0x8'),auth[_0xdfb6('0xe')](),controller['update']);router[_0xdfb6('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdfb6('0x10')]=router; \ No newline at end of file +var _0xe47d=['show','/:id/download','download','create','put','update','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id'];(function(_0x2009cd,_0x549a5d){var _0x509e8a=function(_0x3b4e02){while(--_0x3b4e02){_0x2009cd['push'](_0x2009cd['shift']());}};_0x509e8a(++_0x549a5d);}(_0xe47d,0xbc));var _0xde47=function(_0x74c392,_0x29cc28){_0x74c392=_0x74c392-0x0;var _0x306791=_0xe47d[_0x74c392];return _0x306791;};'use strict';var multer=require(_0xde47('0x0'));var util=require(_0xde47('0x1'));var path=require('path');var express=require('express');var router=express[_0xde47('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xde47('0x3'));var config=require(_0xde47('0x4'));var controller=require(_0xde47('0x5'));router[_0xde47('0x6')]('/',auth[_0xde47('0x7')](),controller[_0xde47('0x8')]);router[_0xde47('0x6')](_0xde47('0x9'),auth[_0xde47('0x7')](),controller[_0xde47('0xa')]);router[_0xde47('0x6')](_0xde47('0xb'),auth[_0xde47('0x7')](),controller[_0xde47('0xc')]);router['post']('/',auth[_0xde47('0x7')](),controller[_0xde47('0xd')]);router[_0xde47('0xe')](_0xde47('0x9'),auth[_0xde47('0x7')](),controller[_0xde47('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xde47('0x10')]);module[_0xde47('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 4e53450..a43a317 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 _0xc981=['STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x1a2928,_0x98b470){var _0x286f70=function(_0x465428){while(--_0x465428){_0x1a2928['push'](_0x1a2928['shift']());}};_0x286f70(++_0x98b470);}(_0xc981,0x151));var _0x1c98=function(_0x40048a,_0x19af28){_0x40048a=_0x40048a-0x0;var _0x33cafa=_0xc981[_0x40048a];return _0x33cafa;};'use strict';var Sequelize=require(_0x1c98('0x0'));module[_0x1c98('0x1')]={'name':{'type':Sequelize[_0x1c98('0x2')],'get':function(_0x5af272){return this[_0x1c98('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x1c98('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1c98('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1c98('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1c98('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x1c98('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1c98('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1c98('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x1c98('0x6')](_0x1c98('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1c98('0x5')],'defaultValue':''},'stamp':{'type':_0x1c98('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0xc445=['sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x372708,_0x56293f){var _0x27a147=function(_0x5b9f5a){while(--_0x5b9f5a){_0x372708['push'](_0x372708['shift']());}};_0x27a147(++_0x56293f);}(_0xc445,0x150));var _0x5c44=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0xc445[_0x2cc594];return _0x4abff7;};'use strict';var Sequelize=require(_0x5c44('0x0'));module[_0x5c44('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xa8e0b6){return this[_0x5c44('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x5c44('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5c44('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5c44('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5c44('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5c44('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5c44('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5c44('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5c44('0x5')](_0x5c44('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5c44('0x4')],'defaultValue':''},'stamp':{'type':_0x5c44('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 6285957..3c57b5c 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 _0x63d0=['limit','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','VoiceMailMessage','model','differenceBy','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','length','order','sort','add','day','merge','where','filter','map','options','then','includeAll','include','catch','show','params','find','create','body','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','set','moment','bluebird','path','sox','to-csv','crypto','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x168310,_0xe393f5){var _0x4ba9d3=function(_0x4576ca){while(--_0x4576ca){_0x168310['push'](_0x168310['shift']());}};_0x4ba9d3(++_0xe393f5);}(_0x63d0,0x77));var _0x063d=function(_0x409237,_0xe36701){_0x409237=_0x409237-0x0;var _0x2b3e72=_0x63d0[_0x409237];return _0x2b3e72;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x063d('0x0'));var BPromise=require(_0x063d('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x063d('0x2'));var sox=require(_0x063d('0x3'));var csv=require(_0x063d('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x063d('0x5'));var jsforce=require('jsforce');var deskjs=require(_0x063d('0x6'));var toCsv=require(_0x063d('0x4'));var querystring=require(_0x063d('0x7'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x063d('0x8'))(_0x063d('0x9'));var utils=require(_0x063d('0xa'));var config=require(_0x063d('0xb'));var db=require(_0x063d('0xc'))['db'];function respondWithStatusCode(_0xf0d327,_0x49044b){_0x49044b=_0x49044b||0xcc;return function(_0x16deff){if(_0x16deff){return _0xf0d327[_0x063d('0xd')](_0x49044b);}return _0xf0d327['status'](_0x49044b)[_0x063d('0xe')]();};}function respondWithResult(_0x47d581,_0x2518f8){_0x2518f8=_0x2518f8||0xc8;return function(_0x263d89){if(_0x263d89){return _0x47d581[_0x063d('0xf')](_0x2518f8)[_0x063d('0x10')](_0x263d89);}};}function respondWithFilteredResult(_0x2f12ce,_0x432e54){return function(_0x1723c6){if(_0x1723c6){var _0x265ca2=_0x1723c6[_0x063d('0x11')],_0xe57c3f=_0x432e54[_0x063d('0x12')],_0x1ff06a=_0x432e54[_0x063d('0x12')]+_0x432e54[_0x063d('0x13')],_0x377bab;if(_0x1ff06a>=_0x265ca2){_0x1ff06a=_0x265ca2;_0x377bab=0xc8;}else{_0x377bab=0xce;}_0x2f12ce[_0x063d('0xf')](_0x377bab);return _0x2f12ce['set'](_0x063d('0x14'),_0xe57c3f+'-'+_0x1ff06a+'/'+_0x265ca2)[_0x063d('0x10')](_0x1723c6);}return null;};}function patchUpdates(_0x452bb5){return function(_0x2a8d9d){try{jsonpatch[_0x063d('0x15')](_0x2a8d9d,_0x452bb5,!![]);}catch(_0x48e137){return BPromise[_0x063d('0x16')](_0x48e137);}return _0x2a8d9d['save']();};}function saveUpdates(_0x465936,_0x2aeb9e){return function(_0x30cad1){if(_0x30cad1){return _0x30cad1[_0x063d('0x17')](_0x465936)['then'](function(_0x567929){return _0x567929;});}return null;};}function removeEntity(_0x20521,_0x389800){return function(_0x11b7db){if(_0x11b7db){return _0x11b7db[_0x063d('0x18')]()['then'](function(){_0x20521[_0x063d('0xf')](0xcc)[_0x063d('0xe')]();});}};}function handleEntityNotFound(_0x496ded,_0x24bd1f){return function(_0x6bb26){if(!_0x6bb26){_0x496ded['sendStatus'](0x194);}return _0x6bb26;};}function handleError(_0x2323ab,_0x5d176c){_0x5d176c=_0x5d176c||0x1f4;return function(_0x1af4ac){logger[_0x063d('0x19')](_0x1af4ac[_0x063d('0x1a')]);if(_0x1af4ac['name']){delete _0x1af4ac[_0x063d('0x1b')];}_0x2323ab[_0x063d('0xf')](_0x5d176c)[_0x063d('0x1c')](_0x1af4ac);};}exports[_0x063d('0x1d')]=function(_0x5e2aff,_0x1e2859){var _0x25f6bc={},_0x23b87f={},_0x14d0c3={'count':0x0,'rows':[]};var _0xdec7a3=db[_0x063d('0x1e')]['rawAttributes'];_0x23b87f[_0x063d('0x1f')]=_[_0x063d('0x20')](_['keys'](_0xdec7a3),['name']);var _0x49a162={'dateStart':_0x5e2aff[_0x063d('0x21')][_0x063d('0x22')],'dateEnd':_0x5e2aff['query'][_0x063d('0x23')]};delete _0x5e2aff['query'][_0x063d('0x22')];delete _0x5e2aff[_0x063d('0x21')][_0x063d('0x23')];_0x23b87f[_0x063d('0x21')]=_[_0x063d('0x24')](_0x5e2aff[_0x063d('0x21')]);_0x23b87f[_0x063d('0x25')]=_['intersection'](_0x23b87f['model'],_0x23b87f[_0x063d('0x21')]);_0x25f6bc[_0x063d('0x26')]=_[_0x063d('0x27')](_0x23b87f[_0x063d('0x1f')],qs[_0x063d('0x28')](_0x5e2aff[_0x063d('0x21')]['fields']));_0x25f6bc[_0x063d('0x26')]=_0x25f6bc[_0x063d('0x26')][_0x063d('0x29')]?_0x25f6bc['attributes']:_0x23b87f[_0x063d('0x1f')];if(!_0x5e2aff[_0x063d('0x21')]['hasOwnProperty']('nolimit')){_0x25f6bc['limit']=qs[_0x063d('0x13')](_0x5e2aff[_0x063d('0x21')][_0x063d('0x13')]);_0x25f6bc[_0x063d('0x12')]=qs[_0x063d('0x12')](_0x5e2aff[_0x063d('0x21')][_0x063d('0x12')]);}_0x25f6bc[_0x063d('0x2a')]=qs[_0x063d('0x2b')](_0x5e2aff['query'][_0x063d('0x2b')]);_0x25f6bc['where']=qs[_0x063d('0x25')](_['pick'](_0x5e2aff['query'],_0x23b87f['filters']));if(_0x49a162[_0x063d('0x22')]){if(_0x49a162[_0x063d('0x23')]){_0x49a162[_0x063d('0x23')]=moment(_0x49a162[_0x063d('0x23')])[_0x063d('0x2c')](0x1,_0x063d('0x2d'));}else{_0x49a162[_0x063d('0x23')]=moment(_0x49a162['dateStart'])[_0x063d('0x2c')](0x1,_0x063d('0x2d'));}_[_0x063d('0x2e')](_0x25f6bc[_0x063d('0x2f')],{'createdAt':{'$gte':_0x49a162[_0x063d('0x22')],'$lte':_0x49a162[_0x063d('0x23')]}});}if(_0x5e2aff[_0x063d('0x21')][_0x063d('0x30')]){_0x25f6bc['where']=_['merge'](_0x25f6bc[_0x063d('0x2f')],{'$or':_[_0x063d('0x31')](_0x25f6bc[_0x063d('0x26')],function(_0x32eb35){var _0xcf01a3={};_0xcf01a3[_0x32eb35]={'$like':'%'+_0x5e2aff['query'][_0x063d('0x30')]+'%'};return _0xcf01a3;})});}_0x25f6bc=_[_0x063d('0x2e')]({},_0x25f6bc,_0x5e2aff[_0x063d('0x32')]);var _0x17ca08={'where':_0x25f6bc[_0x063d('0x2f')]};return db[_0x063d('0x1e')]['count'](_0x17ca08)[_0x063d('0x33')](function(_0xab90c8){_0x14d0c3['count']=_0xab90c8;if(_0x5e2aff[_0x063d('0x21')][_0x063d('0x34')]){_0x25f6bc[_0x063d('0x35')]=[{'all':!![]}];}return db[_0x063d('0x1e')]['findAll'](_0x25f6bc);})[_0x063d('0x33')](function(_0x32a4b2){_0x14d0c3['rows']=_0x32a4b2;return _0x14d0c3;})[_0x063d('0x33')](respondWithFilteredResult(_0x1e2859,_0x25f6bc))[_0x063d('0x36')](handleError(_0x1e2859,null));};exports[_0x063d('0x37')]=function(_0x113b67,_0x12aaf4){var _0x5b6f8d={'raw':!![],'where':{'id':_0x113b67[_0x063d('0x38')]['id']}},_0x5dc97d={};_0x5dc97d[_0x063d('0x1f')]=_[_0x063d('0x24')](db['VoiceMailMessage']['rawAttributes']);_0x5dc97d[_0x063d('0x21')]=_[_0x063d('0x24')](_0x113b67[_0x063d('0x21')]);_0x5dc97d[_0x063d('0x25')]=_[_0x063d('0x27')](_0x5dc97d[_0x063d('0x1f')],_0x5dc97d[_0x063d('0x21')]);_0x5b6f8d[_0x063d('0x26')]=_[_0x063d('0x27')](_0x5dc97d[_0x063d('0x1f')],qs[_0x063d('0x28')](_0x113b67[_0x063d('0x21')][_0x063d('0x28')]));_0x5b6f8d['attributes']=_0x5b6f8d['attributes']['length']?_0x5b6f8d[_0x063d('0x26')]:_0x5dc97d[_0x063d('0x1f')];if(_0x113b67[_0x063d('0x21')]['includeAll']){_0x5b6f8d[_0x063d('0x35')]=[{'all':!![]}];}_0x5b6f8d=_[_0x063d('0x2e')]({},_0x5b6f8d,_0x113b67['options']);return db[_0x063d('0x1e')][_0x063d('0x39')](_0x5b6f8d)[_0x063d('0x33')](handleEntityNotFound(_0x12aaf4,null))[_0x063d('0x33')](respondWithResult(_0x12aaf4,null))[_0x063d('0x36')](handleError(_0x12aaf4,null));};exports[_0x063d('0x3a')]=function(_0x4e97d6,_0x77db86){return db[_0x063d('0x1e')][_0x063d('0x3a')](_0x4e97d6[_0x063d('0x3b')],{})[_0x063d('0x33')](respondWithResult(_0x77db86,0xc9))[_0x063d('0x36')](handleError(_0x77db86,null));};exports['update']=function(_0x220dee,_0x4a192c){if(_0x220dee[_0x063d('0x3b')]['id']){delete _0x220dee[_0x063d('0x3b')]['id'];}return db[_0x063d('0x1e')][_0x063d('0x39')]({'where':{'id':_0x220dee['params']['id']}})['then'](handleEntityNotFound(_0x4a192c,null))[_0x063d('0x33')](saveUpdates(_0x220dee[_0x063d('0x3b')],null))[_0x063d('0x33')](respondWithResult(_0x4a192c,null))[_0x063d('0x36')](handleError(_0x4a192c,null));};exports[_0x063d('0x18')]=function(_0x1a45e8,_0x434406){return db[_0x063d('0x1e')][_0x063d('0x39')]({'where':{'id':_0x1a45e8[_0x063d('0x38')]['id']}})[_0x063d('0x33')](handleEntityNotFound(_0x434406,null))['then'](removeEntity(_0x434406,null))[_0x063d('0x36')](handleError(_0x434406,null));};exports[_0x063d('0x3c')]=function(_0x2e9006,_0xe5b37d,_0x6158a8){return db[_0x063d('0x1e')][_0x063d('0x39')]({'where':{'id':_0x2e9006[_0x063d('0x38')]['id']},'attributes':['id',_0x063d('0x3d'),_0x063d('0x3e')]})['then'](handleEntityNotFound(_0xe5b37d,null))[_0x063d('0x33')](function(_0xd88d32){if(_0xd88d32){if(!_0xd88d32[_0x063d('0x3d')]){throw new db[(_0x063d('0x3f'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0xfa6767={'Content-Type':_0x063d('0x40'),'Content-Disposition':_0x063d('0x41')};if(_0xd88d32[_0x063d('0x3e')]){_0xfa6767[_0x063d('0x42')]=_0x063d('0x43')+_0xd88d32['msg_id']+'.wav\x22';}_0xe5b37d[_0x063d('0x44')](_0xfa6767);return _0xe5b37d['send'](new Buffer(_0xd88d32[_0x063d('0x3d')]));}})[_0x063d('0x36')](handleError(_0xe5b37d,null));}; \ No newline at end of file +var _0x5d37=['options','count','includeAll','findAll','show','rawAttributes','catch','create','body','find','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','save','update','then','destroy','end','error','stack','name','send','index','VoiceMailMessage','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','add','day','where','merge','map','filter'];(function(_0x474712,_0x231ed5){var _0x3d6362=function(_0x41622d){while(--_0x41622d){_0x474712['push'](_0x474712['shift']());}};_0x3d6362(++_0x231ed5);}(_0x5d37,0x196));var _0x75d3=function(_0x403611,_0x2c14cd){_0x403611=_0x403611-0x0;var _0x3438e5=_0x5d37[_0x403611];return _0x3438e5;};'use strict';var jsonpatch=require(_0x75d3('0x0'));var rp=require(_0x75d3('0x1'));var moment=require(_0x75d3('0x2'));var BPromise=require(_0x75d3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x75d3('0x4'));var sox=require(_0x75d3('0x5'));var csv=require(_0x75d3('0x6'));var ejs=require(_0x75d3('0x7'));var fs=require('fs');var _=require(_0x75d3('0x8'));var squel=require('squel');var crypto=require(_0x75d3('0x9'));var jsforce=require(_0x75d3('0xa'));var deskjs=require(_0x75d3('0xb'));var toCsv=require(_0x75d3('0x6'));var querystring=require(_0x75d3('0xc'));var Papa=require(_0x75d3('0xd'));var qs=require(_0x75d3('0xe'));var logger=require(_0x75d3('0xf'))('api');var utils=require(_0x75d3('0x10'));var config=require('../../config/environment');var db=require(_0x75d3('0x11'))['db'];function respondWithStatusCode(_0x3fef2f,_0x1cb7b0){_0x1cb7b0=_0x1cb7b0||0xcc;return function(_0x2f9abe){if(_0x2f9abe){return _0x3fef2f[_0x75d3('0x12')](_0x1cb7b0);}return _0x3fef2f[_0x75d3('0x13')](_0x1cb7b0)['end']();};}function respondWithResult(_0xb2c1dd,_0x596441){_0x596441=_0x596441||0xc8;return function(_0x2c9fee){if(_0x2c9fee){return _0xb2c1dd[_0x75d3('0x13')](_0x596441)[_0x75d3('0x14')](_0x2c9fee);}};}function respondWithFilteredResult(_0x50591b,_0xcac125){return function(_0x396d09){if(_0x396d09){var _0x25c5f2=_0x396d09['count'],_0x58a7ad=_0xcac125[_0x75d3('0x15')],_0x1e4891=_0xcac125[_0x75d3('0x15')]+_0xcac125[_0x75d3('0x16')],_0x5ce434;if(_0x1e4891>=_0x25c5f2){_0x1e4891=_0x25c5f2;_0x5ce434=0xc8;}else{_0x5ce434=0xce;}_0x50591b[_0x75d3('0x13')](_0x5ce434);return _0x50591b[_0x75d3('0x17')]('Content-Range',_0x58a7ad+'-'+_0x1e4891+'/'+_0x25c5f2)['json'](_0x396d09);}return null;};}function patchUpdates(_0x4304a2){return function(_0x297039){try{jsonpatch[_0x75d3('0x18')](_0x297039,_0x4304a2,!![]);}catch(_0x590831){return BPromise['reject'](_0x590831);}return _0x297039[_0x75d3('0x19')]();};}function saveUpdates(_0x47c947,_0x381806){return function(_0x15aff5){if(_0x15aff5){return _0x15aff5[_0x75d3('0x1a')](_0x47c947)[_0x75d3('0x1b')](function(_0x50ae77){return _0x50ae77;});}return null;};}function removeEntity(_0x14c9a8,_0x3ef131){return function(_0x51bacf){if(_0x51bacf){return _0x51bacf[_0x75d3('0x1c')]()['then'](function(){_0x14c9a8[_0x75d3('0x13')](0xcc)[_0x75d3('0x1d')]();});}};}function handleEntityNotFound(_0x47225b,_0x59f170){return function(_0x52fd46){if(!_0x52fd46){_0x47225b['sendStatus'](0x194);}return _0x52fd46;};}function handleError(_0xf8a028,_0x4d3d3b){_0x4d3d3b=_0x4d3d3b||0x1f4;return function(_0x4a897a){logger[_0x75d3('0x1e')](_0x4a897a[_0x75d3('0x1f')]);if(_0x4a897a[_0x75d3('0x20')]){delete _0x4a897a[_0x75d3('0x20')];}_0xf8a028[_0x75d3('0x13')](_0x4d3d3b)[_0x75d3('0x21')](_0x4a897a);};}exports[_0x75d3('0x22')]=function(_0xce9322,_0x12a7f9){var _0x19c741={},_0x18f7d9={},_0x16ed0b={'count':0x0,'rows':[]};var _0x29a933=db[_0x75d3('0x23')]['rawAttributes'];_0x18f7d9[_0x75d3('0x24')]=_['differenceBy'](_[_0x75d3('0x25')](_0x29a933),[_0x75d3('0x20')]);var _0x2063ed={'dateStart':_0xce9322['query']['dateStart'],'dateEnd':_0xce9322[_0x75d3('0x26')]['dateEnd']};delete _0xce9322[_0x75d3('0x26')][_0x75d3('0x27')];delete _0xce9322[_0x75d3('0x26')][_0x75d3('0x28')];_0x18f7d9[_0x75d3('0x26')]=_[_0x75d3('0x25')](_0xce9322['query']);_0x18f7d9['filters']=_[_0x75d3('0x29')](_0x18f7d9[_0x75d3('0x24')],_0x18f7d9['query']);_0x19c741[_0x75d3('0x2a')]=_[_0x75d3('0x29')](_0x18f7d9[_0x75d3('0x24')],qs[_0x75d3('0x2b')](_0xce9322['query'][_0x75d3('0x2b')]));_0x19c741[_0x75d3('0x2a')]=_0x19c741['attributes'][_0x75d3('0x2c')]?_0x19c741[_0x75d3('0x2a')]:_0x18f7d9[_0x75d3('0x24')];if(!_0xce9322['query'][_0x75d3('0x2d')]('nolimit')){_0x19c741[_0x75d3('0x16')]=qs[_0x75d3('0x16')](_0xce9322[_0x75d3('0x26')]['limit']);_0x19c741[_0x75d3('0x15')]=qs[_0x75d3('0x15')](_0xce9322[_0x75d3('0x26')][_0x75d3('0x15')]);}_0x19c741[_0x75d3('0x2e')]=qs[_0x75d3('0x2f')](_0xce9322[_0x75d3('0x26')]['sort']);_0x19c741['where']=qs[_0x75d3('0x30')](_[_0x75d3('0x31')](_0xce9322[_0x75d3('0x26')],_0x18f7d9[_0x75d3('0x30')]));if(_0x2063ed[_0x75d3('0x27')]){if(_0x2063ed[_0x75d3('0x28')]){_0x2063ed[_0x75d3('0x28')]=moment(_0x2063ed[_0x75d3('0x28')])[_0x75d3('0x32')](0x1,_0x75d3('0x33'));}else{_0x2063ed[_0x75d3('0x28')]=moment(_0x2063ed[_0x75d3('0x27')])['add'](0x1,_0x75d3('0x33'));}_['merge'](_0x19c741[_0x75d3('0x34')],{'createdAt':{'$gte':_0x2063ed['dateStart'],'$lte':_0x2063ed['dateEnd']}});}if(_0xce9322[_0x75d3('0x26')]['filter']){_0x19c741[_0x75d3('0x34')]=_[_0x75d3('0x35')](_0x19c741[_0x75d3('0x34')],{'$or':_[_0x75d3('0x36')](_0x19c741[_0x75d3('0x2a')],function(_0x7a35fe){var _0x75155d={};_0x75155d[_0x7a35fe]={'$like':'%'+_0xce9322[_0x75d3('0x26')][_0x75d3('0x37')]+'%'};return _0x75155d;})});}_0x19c741=_['merge']({},_0x19c741,_0xce9322[_0x75d3('0x38')]);var _0x1c4225={'where':_0x19c741[_0x75d3('0x34')]};return db[_0x75d3('0x23')][_0x75d3('0x39')](_0x1c4225)['then'](function(_0x4c69a9){_0x16ed0b[_0x75d3('0x39')]=_0x4c69a9;if(_0xce9322[_0x75d3('0x26')][_0x75d3('0x3a')]){_0x19c741['include']=[{'all':!![]}];}return db[_0x75d3('0x23')][_0x75d3('0x3b')](_0x19c741);})[_0x75d3('0x1b')](function(_0xd92f3d){_0x16ed0b['rows']=_0xd92f3d;return _0x16ed0b;})[_0x75d3('0x1b')](respondWithFilteredResult(_0x12a7f9,_0x19c741))['catch'](handleError(_0x12a7f9,null));};exports[_0x75d3('0x3c')]=function(_0x220793,_0x420b2b){var _0x4a75d9={'raw':!![],'where':{'id':_0x220793['params']['id']}},_0x18fc0f={};_0x18fc0f[_0x75d3('0x24')]=_[_0x75d3('0x25')](db[_0x75d3('0x23')][_0x75d3('0x3d')]);_0x18fc0f['query']=_['keys'](_0x220793[_0x75d3('0x26')]);_0x18fc0f[_0x75d3('0x30')]=_[_0x75d3('0x29')](_0x18fc0f[_0x75d3('0x24')],_0x18fc0f[_0x75d3('0x26')]);_0x4a75d9['attributes']=_['intersection'](_0x18fc0f['model'],qs[_0x75d3('0x2b')](_0x220793['query'][_0x75d3('0x2b')]));_0x4a75d9[_0x75d3('0x2a')]=_0x4a75d9[_0x75d3('0x2a')][_0x75d3('0x2c')]?_0x4a75d9[_0x75d3('0x2a')]:_0x18fc0f['model'];if(_0x220793[_0x75d3('0x26')][_0x75d3('0x3a')]){_0x4a75d9['include']=[{'all':!![]}];}_0x4a75d9=_[_0x75d3('0x35')]({},_0x4a75d9,_0x220793[_0x75d3('0x38')]);return db[_0x75d3('0x23')]['find'](_0x4a75d9)[_0x75d3('0x1b')](handleEntityNotFound(_0x420b2b,null))[_0x75d3('0x1b')](respondWithResult(_0x420b2b,null))[_0x75d3('0x3e')](handleError(_0x420b2b,null));};exports[_0x75d3('0x3f')]=function(_0x559982,_0x116c9a){return db[_0x75d3('0x23')][_0x75d3('0x3f')](_0x559982[_0x75d3('0x40')],{})[_0x75d3('0x1b')](respondWithResult(_0x116c9a,0xc9))[_0x75d3('0x3e')](handleError(_0x116c9a,null));};exports['update']=function(_0x2684e8,_0x4eb26b){if(_0x2684e8[_0x75d3('0x40')]['id']){delete _0x2684e8[_0x75d3('0x40')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x2684e8['params']['id']}})['then'](handleEntityNotFound(_0x4eb26b,null))[_0x75d3('0x1b')](saveUpdates(_0x2684e8[_0x75d3('0x40')],null))[_0x75d3('0x1b')](respondWithResult(_0x4eb26b,null))[_0x75d3('0x3e')](handleError(_0x4eb26b,null));};exports[_0x75d3('0x1c')]=function(_0x3f8470,_0x4f6701){return db[_0x75d3('0x23')][_0x75d3('0x41')]({'where':{'id':_0x3f8470[_0x75d3('0x42')]['id']}})[_0x75d3('0x1b')](handleEntityNotFound(_0x4f6701,null))[_0x75d3('0x1b')](removeEntity(_0x4f6701,null))[_0x75d3('0x3e')](handleError(_0x4f6701,null));};exports[_0x75d3('0x43')]=function(_0x15b61f,_0x1bbbfc,_0x2b5e22){return db[_0x75d3('0x23')][_0x75d3('0x41')]({'where':{'id':_0x15b61f['params']['id']},'attributes':['id',_0x75d3('0x44'),_0x75d3('0x45')]})[_0x75d3('0x1b')](handleEntityNotFound(_0x1bbbfc,null))[_0x75d3('0x1b')](function(_0x2fb34b){if(_0x2fb34b){if(!_0x2fb34b[_0x75d3('0x44')]){throw new db[(_0x75d3('0x46'))]['ValidationError'](_0x75d3('0x47'));}var _0x1c45ea={'Content-Type':_0x75d3('0x48'),'Content-Disposition':_0x75d3('0x49')};if(_0x2fb34b['msg_id']){_0x1c45ea[_0x75d3('0x4a')]=_0x75d3('0x4b')+_0x2fb34b[_0x75d3('0x45')]+_0x75d3('0x4c');}_0x1bbbfc[_0x75d3('0x17')](_0x1c45ea);return _0x1bbbfc[_0x75d3('0x21')](new Buffer(_0x2fb34b[_0x75d3('0x44')]));}})[_0x75d3('0x3e')](handleError(_0x1bbbfc,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2210c12..fbb39b2 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 _0x3c4f=['exports','define','VoiceMailMessage','dir','util','moment','bluebird'];(function(_0x2738c6,_0x276a49){var _0x41f441=function(_0x5252e3){while(--_0x5252e3){_0x2738c6['push'](_0x2738c6['shift']());}};_0x41f441(++_0x276a49);}(_0x3c4f,0x1c4));var _0xf3c4=function(_0x3020fa,_0x5168a0){_0x3020fa=_0x3020fa-0x0;var _0x3d1204=_0x3c4f[_0x3020fa];return _0x3d1204;};'use strict';var _=require('lodash');var util=require(_0xf3c4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf3c4('0x1'));var BPromise=require(_0xf3c4('0x2'));var rp=require('request-promise');var attributes=require('./voiceMailMessage.attributes');module[_0xf3c4('0x3')]=function(_0x482258,_0x144ad1){return _0x482258[_0xf3c4('0x4')](_0xf3c4('0x5'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xf3c4('0x6'),'fields':[_0xf3c4('0x6')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc293=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','moment','bluebird','./voiceMailMessage.attributes'];(function(_0x2804b8,_0x269e0e){var _0x4b2e9d=function(_0x25e628){while(--_0x25e628){_0x2804b8['push'](_0x2804b8['shift']());}};_0x4b2e9d(++_0x269e0e);}(_0xc293,0x1ef));var _0x3c29=function(_0x5a2436,_0x11375a){_0x5a2436=_0x5a2436-0x0;var _0x2d8468=_0xc293[_0x5a2436];return _0x2d8468;};'use strict';var _=require('lodash');var util=require(_0x3c29('0x0'));var logger=require(_0x3c29('0x1'))('api');var moment=require(_0x3c29('0x2'));var BPromise=require(_0x3c29('0x3'));var rp=require('request-promise');var attributes=require(_0x3c29('0x4'));module[_0x3c29('0x5')]=function(_0x398da1,_0x340c85){return _0x398da1[_0x3c29('0x6')](_0x3c29('0x7'),attributes,{'tableName':_0x3c29('0x8'),'paranoid':![],'indexes':[{'name':_0x3c29('0x9'),'fields':[_0x3c29('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0a7dca9..89cd470 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 _0xf4d2=['error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','debug','stringify'];(function(_0x3b3722,_0x31c569){var _0x2a679a=function(_0x338aaf){while(--_0x338aaf){_0x3b3722['push'](_0x3b3722['shift']());}};_0x2a679a(++_0x31c569);}(_0xf4d2,0x1a3));var _0x2f4d=function(_0x5862d3,_0x4d94ef){_0x5862d3=_0x5862d3-0x0;var _0x2521a8=_0xf4d2[_0x5862d3];return _0x2521a8;};'use strict';var _=require(_0x2f4d('0x0'));var util=require(_0x2f4d('0x1'));var moment=require('moment');var BPromise=require(_0x2f4d('0x2'));var rs=require(_0x2f4d('0x3'));var fs=require('fs');var db=require(_0x2f4d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f4d('0x5'))(_0x2f4d('0x6'));var config=require(_0x2f4d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd412a9,_0x57b197,_0x233541){return new BPromise(function(_0x271542,_0x54ba2a){return client[_0x2f4d('0x9')](_0xd412a9,_0x233541)['then'](function(_0x1baa1b){logger[_0x2f4d('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x57b197,'request\x20sent');logger[_0x2f4d('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x57b197,'request\x20sent',JSON[_0x2f4d('0xc')](_0x1baa1b));if(_0x1baa1b[_0x2f4d('0xd')]){if(_0x1baa1b['error']['code']===0x1f4){logger[_0x2f4d('0xd')](_0x2f4d('0xe'),_0x57b197,_0x1baa1b[_0x2f4d('0xd')][_0x2f4d('0xf')]);return _0x54ba2a(_0x1baa1b[_0x2f4d('0xd')]['message']);}logger['error'](_0x2f4d('0xe'),_0x57b197,_0x1baa1b[_0x2f4d('0xd')][_0x2f4d('0xf')]);return _0x271542(_0x1baa1b[_0x2f4d('0xd')][_0x2f4d('0xf')]);}else{logger[_0x2f4d('0xa')](_0x2f4d('0xe'),_0x57b197,'request\x20sent');_0x271542(_0x1baa1b[_0x2f4d('0x10')][_0x2f4d('0xf')]);}})[_0x2f4d('0x11')](function(_0x38e5ec){logger[_0x2f4d('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x57b197,_0x38e5ec);_0x54ba2a(_0x38e5ec);});});} \ No newline at end of file +var _0x6dac=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0x6dac,0x130));var _0xc6da=function(_0x4b267d,_0x17fd20){_0x4b267d=_0x4b267d-0x0;var _0x59443d=_0x6dac[_0x4b267d];return _0x59443d;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var moment=require(_0xc6da('0x2'));var BPromise=require(_0xc6da('0x3'));var rs=require(_0xc6da('0x4'));var fs=require('fs');var db=require(_0xc6da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6da('0x6'))(_0xc6da('0x7'));var config=require(_0xc6da('0x8'));var jayson=require(_0xc6da('0x9'));var client=jayson['client'][_0xc6da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x512eab,_0x1c328b,_0x41d836){return new BPromise(function(_0x1121b8,_0xcf796c){return client[_0xc6da('0xb')](_0x512eab,_0x41d836)[_0xc6da('0xc')](function(_0x17a6ab){logger[_0xc6da('0xd')](_0xc6da('0xe'),_0x1c328b,'request\x20sent');logger[_0xc6da('0xf')](_0xc6da('0x10'),_0x1c328b,_0xc6da('0x11'),JSON[_0xc6da('0x12')](_0x17a6ab));if(_0x17a6ab['error']){if(_0x17a6ab[_0xc6da('0x13')]['code']===0x1f4){logger[_0xc6da('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x1c328b,_0x17a6ab['error'][_0xc6da('0x14')]);return _0xcf796c(_0x17a6ab[_0xc6da('0x13')][_0xc6da('0x14')]);}logger[_0xc6da('0x13')](_0xc6da('0xe'),_0x1c328b,_0x17a6ab[_0xc6da('0x13')][_0xc6da('0x14')]);return _0x1121b8(_0x17a6ab[_0xc6da('0x13')][_0xc6da('0x14')]);}else{logger['info'](_0xc6da('0xe'),_0x1c328b,_0xc6da('0x11'));_0x1121b8(_0x17a6ab[_0xc6da('0x15')][_0xc6da('0x14')]);}})['catch'](function(_0x575787){logger[_0xc6da('0x13')](_0xc6da('0xe'),_0x1c328b,_0x575787);_0xcf796c(_0x575787);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1fc6ad7..29db3ec 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 _0xda5c=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','index','get','isAuthenticated','show','getSounds','post','addSound','put','/:id','update','delete','destroy','removeSound'];(function(_0x126e50,_0x22e8be){var _0x2c2007=function(_0xd5e597){while(--_0xd5e597){_0x126e50['push'](_0x126e50['shift']());}};_0x2c2007(++_0x22e8be);}(_0xda5c,0x1ce));var _0xcda5=function(_0x517d4c,_0x3458e0){_0x517d4c=_0x517d4c-0x0;var _0x5a6d0f=_0xda5c[_0x517d4c];return _0x5a6d0f;};'use strict';var multer=require(_0xcda5('0x0'));var util=require(_0xcda5('0x1'));var path=require('path');var express=require(_0xcda5('0x2'));var router=express[_0xcda5('0x3')]();var auth=require(_0xcda5('0x4'));var interaction=require(_0xcda5('0x5'));var config=require(_0xcda5('0x6'));var controller=require(_0xcda5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcda5('0x8')]);router[_0xcda5('0x9')]('/:id',auth[_0xcda5('0xa')](),controller[_0xcda5('0xb')]);router[_0xcda5('0x9')]('/:id/sounds',auth[_0xcda5('0xa')](),controller[_0xcda5('0xc')]);router[_0xcda5('0xd')]('/',auth[_0xcda5('0xa')](),controller['create']);router[_0xcda5('0xd')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xcda5('0xe')]);router[_0xcda5('0xf')](_0xcda5('0x10'),auth[_0xcda5('0xa')](),controller[_0xcda5('0x11')]);router[_0xcda5('0x12')]('/:id',auth[_0xcda5('0xa')](),controller[_0xcda5('0x13')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xcda5('0x14')]);module['exports']=router; \ No newline at end of file +var _0xecbc=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','/:id/sounds/:id2','removeSound','multer','util','path','Router','../../components/auth/service'];(function(_0x5d0282,_0x15b295){var _0x44afee=function(_0x21f7de){while(--_0x21f7de){_0x5d0282['push'](_0x5d0282['shift']());}};_0x44afee(++_0x15b295);}(_0xecbc,0x69));var _0xcecb=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xecbc[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0xcecb('0x0'));var util=require(_0xcecb('0x1'));var path=require(_0xcecb('0x2'));var express=require('express');var router=express[_0xcecb('0x3')]();var auth=require(_0xcecb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcecb('0x5'));var controller=require(_0xcecb('0x6'));router[_0xcecb('0x7')]('/',auth[_0xcecb('0x8')](),controller[_0xcecb('0x9')]);router[_0xcecb('0x7')](_0xcecb('0xa'),auth[_0xcecb('0x8')](),controller[_0xcecb('0xb')]);router[_0xcecb('0x7')](_0xcecb('0xc'),auth[_0xcecb('0x8')](),controller[_0xcecb('0xd')]);router[_0xcecb('0xe')]('/',auth['isAuthenticated'](),controller[_0xcecb('0xf')]);router[_0xcecb('0xe')](_0xcecb('0xc'),auth[_0xcecb('0x8')](),controller[_0xcecb('0x10')]);router[_0xcecb('0x11')](_0xcecb('0xa'),auth[_0xcecb('0x8')](),controller[_0xcecb('0x12')]);router[_0xcecb('0x13')](_0xcecb('0xa'),auth[_0xcecb('0x8')](),controller['destroy']);router[_0xcecb('0x13')](_0xcecb('0x14'),auth[_0xcecb('0x8')](),controller[_0xcecb('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 da68ce4..fef348e 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 _0x61e6=['STRING','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x4d0094,_0x127019){var _0x48039e=function(_0x326ebc){while(--_0x326ebc){_0x4d0094['push'](_0x4d0094['shift']());}};_0x48039e(++_0x127019);}(_0x61e6,0x9a));var _0x661e=function(_0x776803,_0x3c7705){_0x776803=_0x776803-0x0;var _0x228d4c=_0x61e6[_0x776803];return _0x228d4c;};'use strict';var Sequelize=require(_0x661e('0x0'));module[_0x661e('0x1')]={'name':{'type':Sequelize[_0x661e('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x661e('0x3')](_0x661e('0x4'),_0x661e('0x5'),_0x661e('0x6'),_0x661e('0x7'),_0x661e('0x8'),_0x661e('0x9')),'allowNull':!![],'defaultValue':_0x661e('0x5')},'directory':{'type':Sequelize[_0x661e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x661e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x661e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x661e('0x2')],'allowNull':!![],'defaultValue':_0x661e('0xa')},'format':{'type':Sequelize[_0x661e('0x2')],'allowNull':!![]},'stamp':{'type':_0x661e('0xb')},'defaultEntry':{'type':Sequelize[_0x661e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbf40=['name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','TIMESTAMP','sequelize','exports','STRING'];(function(_0x2b7165,_0x157e87){var _0x119b5f=function(_0x3dcfd5){while(--_0x3dcfd5){_0x2b7165['push'](_0x2b7165['shift']());}};_0x119b5f(++_0x157e87);}(_0xbf40,0xad));var _0x0bf4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbf40[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x0bf4('0x0'));module[_0x0bf4('0x1')]={'name':{'type':Sequelize[_0x0bf4('0x2')],'allowNull':![],'unique':_0x0bf4('0x3')},'mode':{'type':Sequelize[_0x0bf4('0x4')](_0x0bf4('0x5'),_0x0bf4('0x6'),_0x0bf4('0x7'),_0x0bf4('0x8'),_0x0bf4('0x9'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x0bf4('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x0bf4('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x0bf4('0x2')],'allowNull':!![]},'stamp':{'type':_0x0bf4('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 b83d097..45d3c68 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 _0xa9e0=['message','addSound','converted_format','createdAt','join','server/files/sounds/converted','%s.%s','basename','save_name','server/files/moh','symlinkSync','Sequelize','findOne','removeSound','id2','getSounds','Sound','hasOwnProperty','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','VoiceMusicOnHold','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','body','create','sequelize','transaction','mode','directory','0777','readdirSync','forEach','unlinkSync','ValidationError'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];function respondWithStatusCode(_0x3ab53f,_0xfeb75b){_0xfeb75b=_0xfeb75b||0xcc;return function(_0xbd1168){if(_0xbd1168){return _0x3ab53f['sendStatus'](_0xfeb75b);}return _0x3ab53f['status'](_0xfeb75b)['end']();};}function respondWithResult(_0x4cfe67,_0x273d4d){_0x273d4d=_0x273d4d||0xc8;return function(_0x36471c){if(_0x36471c){return _0x4cfe67[_0x0a9e('0xf')](_0x273d4d)[_0x0a9e('0x10')](_0x36471c);}};}function respondWithFilteredResult(_0x32d742,_0x69aeb7){return function(_0x5db4b0){if(_0x5db4b0){var _0x4283ce=_0x5db4b0[_0x0a9e('0x11')],_0x239b12=_0x69aeb7[_0x0a9e('0x12')],_0x2b4227=_0x69aeb7['offset']+_0x69aeb7[_0x0a9e('0x13')],_0x281129;if(_0x2b4227>=_0x4283ce){_0x2b4227=_0x4283ce;_0x281129=0xc8;}else{_0x281129=0xce;}_0x32d742['status'](_0x281129);return _0x32d742[_0x0a9e('0x14')]('Content-Range',_0x239b12+'-'+_0x2b4227+'/'+_0x4283ce)[_0x0a9e('0x10')](_0x5db4b0);}return null;};}function patchUpdates(_0x12066b){return function(_0x48f32d){try{jsonpatch[_0x0a9e('0x15')](_0x48f32d,_0x12066b,!![]);}catch(_0x5a0a06){return BPromise[_0x0a9e('0x16')](_0x5a0a06);}return _0x48f32d[_0x0a9e('0x17')]();};}function saveUpdates(_0x106033,_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x18')](_0x106033)[_0x0a9e('0x19')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae,_0x112016){return function(_0x1c696a){if(_0x1c696a){return _0x1c696a[_0x0a9e('0x1a')]()['then'](function(){_0x1314ae[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x53682f,_0x20f109){return function(_0x5a09ef){if(!_0x5a09ef){_0x53682f['sendStatus'](0x194);}return _0x5a09ef;};}function handleError(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0x1f4;return function(_0x38e7c4){logger[_0x0a9e('0x1c')](_0x38e7c4['stack']);if(_0x38e7c4[_0x0a9e('0x1d')]){delete _0x38e7c4[_0x0a9e('0x1d')];}_0x3a02e1[_0x0a9e('0xf')](_0x432e56)[_0x0a9e('0x1e')](_0x38e7c4);};}exports[_0x0a9e('0x1f')]=function(_0x42ac8f,_0x16b1ca){var _0x5ea472={},_0x59181e={},_0x197ec0={'count':0x0,'rows':[]};var _0x3a8e58=db[_0x0a9e('0x20')][_0x0a9e('0x21')];_0x59181e['model']=_[_0x0a9e('0x22')](_0x3a8e58);var _0x479bc4={'dateStart':_0x42ac8f[_0x0a9e('0x23')]['dateStart'],'dateEnd':_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')]};delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x25')];delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')];_0x59181e[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x42ac8f['query']);_0x59181e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],_0x59181e[_0x0a9e('0x23')]);_0x5ea472['attributes']=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x5ea472[_0x0a9e('0x2a')]=_0x5ea472[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x5ea472[_0x0a9e('0x2a')]:_0x59181e['model'];if(!_0x42ac8f[_0x0a9e('0x23')]['hasOwnProperty'](_0x0a9e('0x2c'))){_0x5ea472[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x5ea472['offset']=qs[_0x0a9e('0x12')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x12')]);}_0x5ea472[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x2e')]);_0x5ea472[_0x0a9e('0x2f')]=qs['filters'](_[_0x0a9e('0x30')](_0x42ac8f['query'],_0x59181e[_0x0a9e('0x26')]));if(_0x479bc4[_0x0a9e('0x25')]){if(_0x479bc4[_0x0a9e('0x24')]){_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4['dateEnd'])[_0x0a9e('0x31')](0x1,_0x0a9e('0x32'));}else{_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4[_0x0a9e('0x25')])['add'](0x1,'day');}_[_0x0a9e('0x33')](_0x5ea472['where'],{'createdAt':{'$gte':_0x479bc4[_0x0a9e('0x25')],'$lte':_0x479bc4[_0x0a9e('0x24')]}});}if(_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x5ea472['where']=_[_0x0a9e('0x33')](_0x5ea472[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x5ea472['attributes'],function(_0x1dbf74){var _0x1a180b={};_0x1a180b[_0x1dbf74]={'$like':'%'+_0x42ac8f[_0x0a9e('0x23')]['filter']+'%'};return _0x1a180b;})});}_0x5ea472=_['merge']({},_0x5ea472,_0x42ac8f[_0x0a9e('0x36')]);var _0x40d766={'where':_0x5ea472['where']};return db[_0x0a9e('0x20')][_0x0a9e('0x11')](_0x40d766)[_0x0a9e('0x19')](function(_0x148f55){_0x197ec0['count']=_0x148f55;if(_0x42ac8f['query'][_0x0a9e('0x37')]){_0x5ea472[_0x0a9e('0x38')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x0a9e('0x39')](_0x5ea472);})[_0x0a9e('0x19')](function(_0x1459bb){_0x197ec0['rows']=_0x1459bb;return _0x197ec0;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x16b1ca,_0x5ea472))[_0x0a9e('0x3a')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x3b')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x3c')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x20')][_0x0a9e('0x21')]);_0x2881b3[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x43dd5b[_0x0a9e('0x23')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x28')],_0x2881b3[_0x0a9e('0x23')]);_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x2881b3[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0xeaa5e5[_0x0a9e('0x2a')]=_0xeaa5e5[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0xeaa5e5[_0x0a9e('0x2a')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x37')]){_0xeaa5e5[_0x0a9e('0x38')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x33')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x36')]);return db[_0x0a9e('0x20')][_0x0a9e('0x3d')](_0xeaa5e5)[_0x0a9e('0x19')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x3a')](handleError(_0x13cb1f,null));};exports['update']=function(_0x473dc8,_0x476688){if(_0x473dc8[_0x0a9e('0x3e')]['id']){delete _0x473dc8['body']['id'];}return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0x473dc8[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x476688,null))[_0x0a9e('0x19')](saveUpdates(_0x473dc8[_0x0a9e('0x3e')],null))[_0x0a9e('0x19')](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports[_0x0a9e('0x3f')]=function(_0x1bde3c,_0x1b5e80,_0x16f976){return db[_0x0a9e('0x40')][_0x0a9e('0x41')](function(_0x6054ee){if(_0x1bde3c[_0x0a9e('0x3e')][_0x0a9e('0x42')]==='files'){_0x1bde3c[_0x0a9e('0x3e')][_0x0a9e('0x43')]=path['join'](config['root'],'server/files/moh',_0x1bde3c[_0x0a9e('0x3e')][_0x0a9e('0x1d')]);}return db[_0x0a9e('0x20')][_0x0a9e('0x3f')](_0x1bde3c[_0x0a9e('0x3e')],{'transaction':_0x6054ee})[_0x0a9e('0x19')](function(_0x2e5165){if(_0x1bde3c[_0x0a9e('0x3e')]['mode']==='files'){fs['mkdirSync'](_0x2e5165[_0x0a9e('0x43')],parseInt(_0x0a9e('0x44'),0x8));}return _0x2e5165;});})[_0x0a9e('0x19')](respondWithResult(_0x1b5e80,0xc9))['catch'](handleError(_0x1b5e80,null));};exports[_0x0a9e('0x1a')]=function(_0x161aa7,_0x53d113,_0x5a88da){var _0x2ef381;return db['VoiceMusicOnHold'][_0x0a9e('0x3d')]({'where':{'id':_0x161aa7['params']['id']}})[_0x0a9e('0x19')](function(_0x3c20b2){if(_0x3c20b2){return db[_0x0a9e('0x40')]['transaction'](function(_0x2f82da){return _0x3c20b2[_0x0a9e('0x1a')]({'transaction':_0x2f82da,'raw':!![]})['then'](function(_0x50f687){if(_0x50f687[_0x0a9e('0x43')]){fs[_0x0a9e('0x45')](_0x50f687['directory'])[_0x0a9e('0x46')](function(_0x5ce9ac){fs[_0x0a9e('0x47')](path['join'](_0x50f687[_0x0a9e('0x43')],_0x5ce9ac));});fs['rmdirSync'](_0x50f687['directory']);}return _0x50f687;});})['catch'](function(_0x2da03c){throw new db['Sequelize'][(_0x0a9e('0x48'))](_0x2da03c[_0x0a9e('0x49')]);});}})[_0x0a9e('0x19')](handleEntityNotFound(_0x53d113,null))[_0x0a9e('0x19')](removeEntity(_0x53d113,null))[_0x0a9e('0x3a')](handleError(_0x53d113,null));};exports[_0x0a9e('0x4a')]=function(_0xd10662,_0x28d814,_0x4e67ab){return db[_0x0a9e('0x40')][_0x0a9e('0x41')](function(_0x2642bb){var _0x30c491;return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0xd10662['params']['id']}})[_0x0a9e('0x19')](function(_0x26bc80){if(_0x26bc80){_0x30c491=_0x26bc80;return _0x26bc80['addSound'](_0xd10662[_0x0a9e('0x3e')]['id'],{'transaction':_0x2642bb});}})['then'](function(_0x20c668){if(_0x20c668){return db['Sound']['findOne']({'where':{'id':_0xd10662['body']['id']},'attributes':['id',_0x0a9e('0x1d'),'save_name',_0x0a9e('0x4b'),_0x0a9e('0x4c')],'raw':!![]});}})[_0x0a9e('0x19')](function(_0x7be420){if(_0x7be420){var _0x1cca9f=path[_0x0a9e('0x4d')](config['root'],_0x0a9e('0x4e'),util['format'](_0x0a9e('0x4f'),path[_0x0a9e('0x50')](_0x7be420[_0x0a9e('0x51')],path['extname'](_0x7be420[_0x0a9e('0x51')])),_0x7be420[_0x0a9e('0x4b')]));var _0x119677=path[_0x0a9e('0x4d')](config['root'],_0x0a9e('0x52'),_0x30c491[_0x0a9e('0x1d')],util['format'](_0x0a9e('0x4f'),_0x7be420[_0x0a9e('0x1d')],_0x7be420[_0x0a9e('0x4b')]));fs[_0x0a9e('0x53')](_0x1cca9f,_0x119677);return _0x7be420;}})[_0x0a9e('0x3a')](function(_0x4d4a35){throw new db[(_0x0a9e('0x54'))][(_0x0a9e('0x48'))](_0x4d4a35[_0x0a9e('0x49')]);});})['then'](handleEntityNotFound(_0x28d814,null))[_0x0a9e('0x19')](respondWithResult(_0x28d814,0xc9))['catch'](handleError(_0x28d814,null));};exports['removeSound']=function(_0x242745,_0x4556c5,_0x9375fb){return db[_0x0a9e('0x40')][_0x0a9e('0x41')](function(_0xc8c264){var _0x387489;return db[_0x0a9e('0x20')][_0x0a9e('0x55')]({'where':{'id':_0x242745[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x19')](function(_0x2bbb86){if(_0x2bbb86){_0x387489=_0x2bbb86;return _0x2bbb86[_0x0a9e('0x56')](_0x242745[_0x0a9e('0x3c')][_0x0a9e('0x57')]);}})[_0x0a9e('0x19')](function(_0x4257c9){if(_0x4257c9){return db['Sound'][_0x0a9e('0x55')]({'where':{'id':_0x242745[_0x0a9e('0x3c')][_0x0a9e('0x57')]},'attributes':['id','name',_0x0a9e('0x51'),_0x0a9e('0x4b'),'createdAt'],'raw':!![]});}})[_0x0a9e('0x19')](function(_0x56e31e){if(_0x56e31e){fs[_0x0a9e('0x47')](path[_0x0a9e('0x4d')](_0x387489[_0x0a9e('0x43')],util['format']('%s.%s',_0x56e31e['name'],_0x56e31e[_0x0a9e('0x4b')])));return _0x56e31e;}})[_0x0a9e('0x3a')](function(_0x1104ad){throw new db[(_0x0a9e('0x54'))][(_0x0a9e('0x48'))](_0x1104ad[_0x0a9e('0x49')]);});})[_0x0a9e('0x19')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x19')](respondWithStatusCode(_0x4556c5,0xcc))['catch'](handleError(_0x4556c5,null));};exports[_0x0a9e('0x58')]=function(_0xcbc8b2,_0x12ccdb,_0x4a4fc7){var _0x2bdc44={};var _0x583b2e={};var _0x4437ff;var _0x44351d;return db['VoiceMusicOnHold'][_0x0a9e('0x55')]({'where':{'id':_0xcbc8b2[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x12ccdb,null))[_0x0a9e('0x19')](function(_0x542ece){if(_0x542ece){_0x4437ff=_0x542ece;_0x583b2e[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x59')][_0x0a9e('0x21')]);_0x583b2e['query']=_[_0x0a9e('0x22')](_0xcbc8b2[_0x0a9e('0x23')]);_0x583b2e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x583b2e['model'],_0x583b2e[_0x0a9e('0x23')]);_0x2bdc44[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x583b2e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x2bdc44[_0x0a9e('0x2a')]=_0x2bdc44[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x2bdc44[_0x0a9e('0x2a')]:_0x583b2e[_0x0a9e('0x28')];_0x2bdc44[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0xcbc8b2['query'][_0x0a9e('0x2e')]);_0x2bdc44[_0x0a9e('0x2f')]=qs[_0x0a9e('0x26')](_['pick'](_0xcbc8b2[_0x0a9e('0x23')],_0x583b2e[_0x0a9e('0x26')]));if(_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x2bdc44['where']=_['merge'](_0x2bdc44[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x2bdc44['attributes'],function(_0x45108c){var _0x53a6a1={};_0x53a6a1[_0x45108c]={'$like':'%'+_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x34')]+'%'};return _0x53a6a1;})});}_0x2bdc44=_['merge']({},_0x2bdc44,_0xcbc8b2[_0x0a9e('0x36')]);return _0x4437ff[_0x0a9e('0x58')](_0x2bdc44);}})[_0x0a9e('0x19')](function(_0x42b959){if(_0x42b959){_0x44351d=_0x42b959[_0x0a9e('0x2b')];if(!_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x5a')]('nolimit')){_0x2bdc44[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x2bdc44['offset']=qs[_0x0a9e('0x12')](_0xcbc8b2[_0x0a9e('0x23')]['offset']);}return _0x4437ff[_0x0a9e('0x58')](_0x2bdc44);}})['then'](function(_0x163710){if(_0x163710){return _0x163710?{'count':_0x44351d,'rows':_0x163710}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x12ccdb,null))[_0x0a9e('0x3a')](handleError(_0x12ccdb,null));}; \ No newline at end of file +var _0x9957=['map','options','then','findAll','rows','show','rawAttributes','includeAll','include','find','body','params','catch','create','sequelize','mode','directory','join','mkdirSync','0777','transaction','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','Sound','findOne','createdAt','root','server/files/sounds/converted','format','basename','extname','save_name','converted_format','server/files/moh','%s.%s','Sequelize','ValidationError','removeSound','id2','getSounds','filters','nolimit','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','model','query','dateStart','dateEnd','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','add','day','merge','filter'];(function(_0xbcf1df,_0x406557){var _0x530d1c=function(_0x4caa92){while(--_0x4caa92){_0xbcf1df['push'](_0xbcf1df['shift']());}};_0x530d1c(++_0x406557);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var jsonpatch=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var Mustache=require('mustache');var util=require(_0x7995('0x4'));var path=require(_0x7995('0x5'));var sox=require(_0x7995('0x6'));var csv=require(_0x7995('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7995('0x8'));var squel=require(_0x7995('0x9'));var crypto=require(_0x7995('0xa'));var jsforce=require(_0x7995('0xb'));var deskjs=require(_0x7995('0xc'));var toCsv=require(_0x7995('0x7'));var querystring=require('querystring');var Papa=require(_0x7995('0xd'));var qs=require(_0x7995('0xe'));var logger=require('../../config/logger')(_0x7995('0xf'));var utils=require(_0x7995('0x10'));var config=require(_0x7995('0x11'));var db=require(_0x7995('0x12'))['db'];function respondWithStatusCode(_0x3c1d19,_0x1e400a){_0x1e400a=_0x1e400a||0xcc;return function(_0x341672){if(_0x341672){return _0x3c1d19['sendStatus'](_0x1e400a);}return _0x3c1d19[_0x7995('0x13')](_0x1e400a)[_0x7995('0x14')]();};}function respondWithResult(_0x581f22,_0xb0c872){_0xb0c872=_0xb0c872||0xc8;return function(_0x2cb37a){if(_0x2cb37a){return _0x581f22[_0x7995('0x13')](_0xb0c872)[_0x7995('0x15')](_0x2cb37a);}};}function respondWithFilteredResult(_0x281576,_0x23999f){return function(_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=_0x2bbe7a[_0x7995('0x16')],_0x58f5ad=_0x23999f[_0x7995('0x17')],_0x2b4e94=_0x23999f[_0x7995('0x17')]+_0x23999f[_0x7995('0x18')],_0x2233dd;if(_0x2b4e94>=_0x4cc004){_0x2b4e94=_0x4cc004;_0x2233dd=0xc8;}else{_0x2233dd=0xce;}_0x281576[_0x7995('0x13')](_0x2233dd);return _0x281576[_0x7995('0x19')]('Content-Range',_0x58f5ad+'-'+_0x2b4e94+'/'+_0x4cc004)[_0x7995('0x15')](_0x2bbe7a);}return null;};}function patchUpdates(_0x565d97){return function(_0x2f832e){try{jsonpatch[_0x7995('0x1a')](_0x2f832e,_0x565d97,!![]);}catch(_0x43d4b8){return BPromise[_0x7995('0x1b')](_0x43d4b8);}return _0x2f832e[_0x7995('0x1c')]();};}function saveUpdates(_0x37a7d4,_0x4faa60){return function(_0x54c9ae){if(_0x54c9ae){return _0x54c9ae[_0x7995('0x1d')](_0x37a7d4)['then'](function(_0x555f74){return _0x555f74;});}return null;};}function removeEntity(_0x3ec178,_0x3d463e){return function(_0x4cbe10){if(_0x4cbe10){return _0x4cbe10[_0x7995('0x1e')]()['then'](function(){_0x3ec178['status'](0xcc)[_0x7995('0x14')]();});}};}function handleEntityNotFound(_0x327b1f,_0x350fd9){return function(_0x1a8568){if(!_0x1a8568){_0x327b1f[_0x7995('0x1f')](0x194);}return _0x1a8568;};}function handleError(_0x1c278a,_0x5d40ae){_0x5d40ae=_0x5d40ae||0x1f4;return function(_0x32a09a){logger[_0x7995('0x20')](_0x32a09a[_0x7995('0x21')]);if(_0x32a09a[_0x7995('0x22')]){delete _0x32a09a[_0x7995('0x22')];}_0x1c278a[_0x7995('0x13')](_0x5d40ae)[_0x7995('0x23')](_0x32a09a);};}exports[_0x7995('0x24')]=function(_0x59405a,_0x39df42){var _0x34e70c={},_0x401dc3={},_0x268ce7={'count':0x0,'rows':[]};var _0x3a3fcf=db[_0x7995('0x25')]['rawAttributes'];_0x401dc3[_0x7995('0x26')]=_['keys'](_0x3a3fcf);var _0x229742={'dateStart':_0x59405a[_0x7995('0x27')][_0x7995('0x28')],'dateEnd':_0x59405a[_0x7995('0x27')][_0x7995('0x29')]};delete _0x59405a['query'][_0x7995('0x28')];delete _0x59405a['query'][_0x7995('0x29')];_0x401dc3[_0x7995('0x27')]=_[_0x7995('0x2a')](_0x59405a['query']);_0x401dc3['filters']=_['intersection'](_0x401dc3[_0x7995('0x26')],_0x401dc3[_0x7995('0x27')]);_0x34e70c[_0x7995('0x2b')]=_[_0x7995('0x2c')](_0x401dc3[_0x7995('0x26')],qs[_0x7995('0x2d')](_0x59405a['query']['fields']));_0x34e70c[_0x7995('0x2b')]=_0x34e70c['attributes'][_0x7995('0x2e')]?_0x34e70c[_0x7995('0x2b')]:_0x401dc3[_0x7995('0x26')];if(!_0x59405a[_0x7995('0x27')][_0x7995('0x2f')]('nolimit')){_0x34e70c[_0x7995('0x18')]=qs[_0x7995('0x18')](_0x59405a['query']['limit']);_0x34e70c['offset']=qs[_0x7995('0x17')](_0x59405a[_0x7995('0x27')]['offset']);}_0x34e70c[_0x7995('0x30')]=qs['sort'](_0x59405a[_0x7995('0x27')][_0x7995('0x31')]);_0x34e70c[_0x7995('0x32')]=qs['filters'](_['pick'](_0x59405a[_0x7995('0x27')],_0x401dc3['filters']));if(_0x229742['dateStart']){if(_0x229742[_0x7995('0x29')]){_0x229742[_0x7995('0x29')]=moment(_0x229742['dateEnd'])[_0x7995('0x33')](0x1,_0x7995('0x34'));}else{_0x229742[_0x7995('0x29')]=moment(_0x229742[_0x7995('0x28')])[_0x7995('0x33')](0x1,'day');}_[_0x7995('0x35')](_0x34e70c[_0x7995('0x32')],{'createdAt':{'$gte':_0x229742[_0x7995('0x28')],'$lte':_0x229742[_0x7995('0x29')]}});}if(_0x59405a['query'][_0x7995('0x36')]){_0x34e70c[_0x7995('0x32')]=_[_0x7995('0x35')](_0x34e70c[_0x7995('0x32')],{'$or':_[_0x7995('0x37')](_0x34e70c[_0x7995('0x2b')],function(_0x5688a1){var _0x183a68={};_0x183a68[_0x5688a1]={'$like':'%'+_0x59405a[_0x7995('0x27')][_0x7995('0x36')]+'%'};return _0x183a68;})});}_0x34e70c=_[_0x7995('0x35')]({},_0x34e70c,_0x59405a[_0x7995('0x38')]);var _0x298fc2={'where':_0x34e70c[_0x7995('0x32')]};return db[_0x7995('0x25')][_0x7995('0x16')](_0x298fc2)[_0x7995('0x39')](function(_0x6fe77b){_0x268ce7[_0x7995('0x16')]=_0x6fe77b;if(_0x59405a[_0x7995('0x27')]['includeAll']){_0x34e70c['include']=[{'all':!![]}];}return db[_0x7995('0x25')][_0x7995('0x3a')](_0x34e70c);})['then'](function(_0x4b0855){_0x268ce7[_0x7995('0x3b')]=_0x4b0855;return _0x268ce7;})['then'](respondWithFilteredResult(_0x39df42,_0x34e70c))['catch'](handleError(_0x39df42,null));};exports[_0x7995('0x3c')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x26')]=_['keys'](db['VoiceMusicOnHold'][_0x7995('0x3d')]);_0x46ac4f[_0x7995('0x27')]=_[_0x7995('0x2a')](_0x36e28b[_0x7995('0x27')]);_0x46ac4f['filters']=_[_0x7995('0x2c')](_0x46ac4f[_0x7995('0x26')],_0x46ac4f[_0x7995('0x27')]);_0x576b96[_0x7995('0x2b')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x2d')](_0x36e28b['query'][_0x7995('0x2d')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x2b')]['length']?_0x576b96[_0x7995('0x2b')]:_0x46ac4f[_0x7995('0x26')];if(_0x36e28b['query'][_0x7995('0x3e')]){_0x576b96[_0x7995('0x3f')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x35')]({},_0x576b96,_0x36e28b[_0x7995('0x38')]);return db['VoiceMusicOnHold'][_0x7995('0x40')](_0x576b96)[_0x7995('0x39')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x39')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x1d')]=function(_0x44f516,_0x511567){if(_0x44f516[_0x7995('0x41')]['id']){delete _0x44f516[_0x7995('0x41')]['id'];}return db['VoiceMusicOnHold'][_0x7995('0x40')]({'where':{'id':_0x44f516[_0x7995('0x42')]['id']}})['then'](handleEntityNotFound(_0x511567,null))[_0x7995('0x39')](saveUpdates(_0x44f516['body'],null))[_0x7995('0x39')](respondWithResult(_0x511567,null))[_0x7995('0x43')](handleError(_0x511567,null));};exports[_0x7995('0x44')]=function(_0x30e220,_0xddf537,_0x14b537){return db[_0x7995('0x45')]['transaction'](function(_0x427dcf){if(_0x30e220[_0x7995('0x41')][_0x7995('0x46')]==='files'){_0x30e220[_0x7995('0x41')][_0x7995('0x47')]=path[_0x7995('0x48')](config['root'],'server/files/moh',_0x30e220['body'][_0x7995('0x22')]);}return db[_0x7995('0x25')]['create'](_0x30e220[_0x7995('0x41')],{'transaction':_0x427dcf})[_0x7995('0x39')](function(_0x31f27c){if(_0x30e220[_0x7995('0x41')][_0x7995('0x46')]==='files'){fs[_0x7995('0x49')](_0x31f27c['directory'],parseInt(_0x7995('0x4a'),0x8));}return _0x31f27c;});})[_0x7995('0x39')](respondWithResult(_0xddf537,0xc9))[_0x7995('0x43')](handleError(_0xddf537,null));};exports['destroy']=function(_0x5e1f34,_0x54e2b1,_0x563f8e){var _0x2e13b0;return db[_0x7995('0x25')][_0x7995('0x40')]({'where':{'id':_0x5e1f34[_0x7995('0x42')]['id']}})[_0x7995('0x39')](function(_0x357e60){if(_0x357e60){return db[_0x7995('0x45')][_0x7995('0x4b')](function(_0x328671){return _0x357e60[_0x7995('0x1e')]({'transaction':_0x328671,'raw':!![]})[_0x7995('0x39')](function(_0x133c63){if(_0x133c63[_0x7995('0x47')]){fs[_0x7995('0x4c')](_0x133c63[_0x7995('0x47')])[_0x7995('0x4d')](function(_0x447a2b){fs[_0x7995('0x4e')](path[_0x7995('0x48')](_0x133c63['directory'],_0x447a2b));});fs[_0x7995('0x4f')](_0x133c63[_0x7995('0x47')]);}return _0x133c63;});})[_0x7995('0x43')](function(_0x32c0d3){throw new db['Sequelize']['ValidationError'](_0x32c0d3[_0x7995('0x50')]);});}})[_0x7995('0x39')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x39')](removeEntity(_0x54e2b1,null))[_0x7995('0x43')](handleError(_0x54e2b1,null));};exports['addSound']=function(_0x13cd7b,_0x74ff38,_0xef5044){return db[_0x7995('0x45')]['transaction'](function(_0x5e2d97){var _0x40e5fc;return db[_0x7995('0x25')][_0x7995('0x40')]({'where':{'id':_0x13cd7b[_0x7995('0x42')]['id']}})[_0x7995('0x39')](function(_0x27c5cd){if(_0x27c5cd){_0x40e5fc=_0x27c5cd;return _0x27c5cd[_0x7995('0x51')](_0x13cd7b[_0x7995('0x41')]['id'],{'transaction':_0x5e2d97});}})[_0x7995('0x39')](function(_0x50caf5){if(_0x50caf5){return db[_0x7995('0x52')][_0x7995('0x53')]({'where':{'id':_0x13cd7b[_0x7995('0x41')]['id']},'attributes':['id',_0x7995('0x22'),'save_name','converted_format',_0x7995('0x54')],'raw':!![]});}})[_0x7995('0x39')](function(_0x47d5d7){if(_0x47d5d7){var _0x971a23=path[_0x7995('0x48')](config[_0x7995('0x55')],_0x7995('0x56'),util[_0x7995('0x57')]('%s.%s',path[_0x7995('0x58')](_0x47d5d7['save_name'],path[_0x7995('0x59')](_0x47d5d7[_0x7995('0x5a')])),_0x47d5d7[_0x7995('0x5b')]));var _0x25b534=path[_0x7995('0x48')](config[_0x7995('0x55')],_0x7995('0x5c'),_0x40e5fc[_0x7995('0x22')],util[_0x7995('0x57')](_0x7995('0x5d'),_0x47d5d7[_0x7995('0x22')],_0x47d5d7[_0x7995('0x5b')]));fs['symlinkSync'](_0x971a23,_0x25b534);return _0x47d5d7;}})[_0x7995('0x43')](function(_0x23bbc1){throw new db[(_0x7995('0x5e'))][(_0x7995('0x5f'))](_0x23bbc1[_0x7995('0x50')]);});})['then'](handleEntityNotFound(_0x74ff38,null))['then'](respondWithResult(_0x74ff38,0xc9))[_0x7995('0x43')](handleError(_0x74ff38,null));};exports[_0x7995('0x60')]=function(_0x221542,_0xae6166,_0x5aa2ec){return db[_0x7995('0x45')]['transaction'](function(_0x5df621){var _0xca8238;return db[_0x7995('0x25')][_0x7995('0x53')]({'where':{'id':_0x221542[_0x7995('0x42')]['id']}})[_0x7995('0x39')](handleEntityNotFound(_0xae6166,null))[_0x7995('0x39')](function(_0x32a52f){if(_0x32a52f){_0xca8238=_0x32a52f;return _0x32a52f[_0x7995('0x60')](_0x221542[_0x7995('0x42')][_0x7995('0x61')]);}})['then'](function(_0x2dc1f7){if(_0x2dc1f7){return db[_0x7995('0x52')][_0x7995('0x53')]({'where':{'id':_0x221542['params'][_0x7995('0x61')]},'attributes':['id',_0x7995('0x22'),_0x7995('0x5a'),_0x7995('0x5b'),_0x7995('0x54')],'raw':!![]});}})[_0x7995('0x39')](function(_0x550a10){if(_0x550a10){fs[_0x7995('0x4e')](path[_0x7995('0x48')](_0xca8238[_0x7995('0x47')],util[_0x7995('0x57')]('%s.%s',_0x550a10['name'],_0x550a10[_0x7995('0x5b')])));return _0x550a10;}})[_0x7995('0x43')](function(_0x39ebb6){throw new db[(_0x7995('0x5e'))]['ValidationError'](_0x39ebb6[_0x7995('0x50')]);});})[_0x7995('0x39')](handleEntityNotFound(_0xae6166,null))['then'](respondWithStatusCode(_0xae6166,0xcc))['catch'](handleError(_0xae6166,null));};exports[_0x7995('0x62')]=function(_0x305b5a,_0x555277,_0x228de1){var _0x5b1cba={};var _0x3758f9={};var _0xea9aba;var _0x4ff9ff;return db['VoiceMusicOnHold'][_0x7995('0x53')]({'where':{'id':_0x305b5a['params']['id']}})[_0x7995('0x39')](handleEntityNotFound(_0x555277,null))[_0x7995('0x39')](function(_0x3dd197){if(_0x3dd197){_0xea9aba=_0x3dd197;_0x3758f9[_0x7995('0x26')]=_[_0x7995('0x2a')](db[_0x7995('0x52')][_0x7995('0x3d')]);_0x3758f9[_0x7995('0x27')]=_[_0x7995('0x2a')](_0x305b5a[_0x7995('0x27')]);_0x3758f9[_0x7995('0x63')]=_[_0x7995('0x2c')](_0x3758f9[_0x7995('0x26')],_0x3758f9[_0x7995('0x27')]);_0x5b1cba[_0x7995('0x2b')]=_[_0x7995('0x2c')](_0x3758f9[_0x7995('0x26')],qs[_0x7995('0x2d')](_0x305b5a[_0x7995('0x27')][_0x7995('0x2d')]));_0x5b1cba[_0x7995('0x2b')]=_0x5b1cba[_0x7995('0x2b')][_0x7995('0x2e')]?_0x5b1cba[_0x7995('0x2b')]:_0x3758f9[_0x7995('0x26')];_0x5b1cba[_0x7995('0x30')]=qs[_0x7995('0x31')](_0x305b5a[_0x7995('0x27')]['sort']);_0x5b1cba[_0x7995('0x32')]=qs[_0x7995('0x63')](_['pick'](_0x305b5a['query'],_0x3758f9[_0x7995('0x63')]));if(_0x305b5a[_0x7995('0x27')][_0x7995('0x36')]){_0x5b1cba[_0x7995('0x32')]=_[_0x7995('0x35')](_0x5b1cba[_0x7995('0x32')],{'$or':_['map'](_0x5b1cba[_0x7995('0x2b')],function(_0xb68962){var _0x3fea6a={};_0x3fea6a[_0xb68962]={'$like':'%'+_0x305b5a[_0x7995('0x27')][_0x7995('0x36')]+'%'};return _0x3fea6a;})});}_0x5b1cba=_[_0x7995('0x35')]({},_0x5b1cba,_0x305b5a[_0x7995('0x38')]);return _0xea9aba[_0x7995('0x62')](_0x5b1cba);}})['then'](function(_0x1c8e7d){if(_0x1c8e7d){_0x4ff9ff=_0x1c8e7d[_0x7995('0x2e')];if(!_0x305b5a['query']['hasOwnProperty'](_0x7995('0x64'))){_0x5b1cba[_0x7995('0x18')]=qs[_0x7995('0x18')](_0x305b5a[_0x7995('0x27')][_0x7995('0x18')]);_0x5b1cba['offset']=qs[_0x7995('0x17')](_0x305b5a[_0x7995('0x27')]['offset']);}return _0xea9aba[_0x7995('0x62')](_0x5b1cba);}})[_0x7995('0x39')](function(_0x489bac){if(_0x489bac){return _0x489bac?{'count':_0x4ff9ff,'rows':_0x489bac}:null;}})[_0x7995('0x39')](respondWithResult(_0x555277,null))['catch'](handleError(_0x555277,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d38f006..956a082 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 _0x93fa=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x93fa,0x17b));var _0xa93f=function(_0x3da72b,_0x4fd809){_0x3da72b=_0x3da72b-0x0;var _0xc64ac4=_0x93fa[_0x3da72b];return _0xc64ac4;};'use strict';var _=require(_0xa93f('0x0'));var util=require('util');var logger=require(_0xa93f('0x1'))(_0xa93f('0x2'));var moment=require(_0xa93f('0x3'));var BPromise=require(_0xa93f('0x4'));var rp=require(_0xa93f('0x5'));var attributes=require(_0xa93f('0x6'));module[_0xa93f('0x7')]=function(_0x3e3963,_0x3bf1cd){return _0x3e3963[_0xa93f('0x8')](_0xa93f('0x9'),attributes,{'tableName':_0xa93f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf749=['../../config/logger','api','moment','bluebird','request-promise','./voiceMusicOnHold.attributes','util'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf749,0xd8));var _0x9f74=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf749[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x9f74('0x0'));var logger=require(_0x9f74('0x1'))(_0x9f74('0x2'));var moment=require(_0x9f74('0x3'));var BPromise=require(_0x9f74('0x4'));var rp=require(_0x9f74('0x5'));var attributes=require(_0x9f74('0x6'));module['exports']=function(_0x13363a,_0x4acc80){return _0x13363a['define']('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','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 3776f3f..0ea4f58 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 _0x7f18=['info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x57bb6f,_0x305aa5){var _0x1883ce=function(_0x143307){while(--_0x143307){_0x57bb6f['push'](_0x57bb6f['shift']());}};_0x1883ce(++_0x305aa5);}(_0x7f18,0x95));var _0x87f1=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x7f18[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x87f1('0x0'));var util=require('util');var moment=require(_0x87f1('0x1'));var BPromise=require('bluebird');var rs=require(_0x87f1('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x87f1('0x3'));var logger=require(_0x87f1('0x4'))(_0x87f1('0x5'));var config=require(_0x87f1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x87f1('0x7')][_0x87f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1641,_0x2aa87e,_0x113858){return new BPromise(function(_0x141416,_0x1ea396){return client[_0x87f1('0x9')](_0x5d1641,_0x113858)[_0x87f1('0xa')](function(_0x1500ca){logger[_0x87f1('0xb')](_0x87f1('0xc'),_0x2aa87e,_0x87f1('0xd'));logger[_0x87f1('0xe')](_0x87f1('0xf'),_0x2aa87e,_0x87f1('0xd'),JSON[_0x87f1('0x10')](_0x1500ca));if(_0x1500ca[_0x87f1('0x11')]){if(_0x1500ca[_0x87f1('0x11')][_0x87f1('0x12')]===0x1f4){logger[_0x87f1('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2aa87e,_0x1500ca[_0x87f1('0x11')][_0x87f1('0x13')]);return _0x1ea396(_0x1500ca[_0x87f1('0x11')][_0x87f1('0x13')]);}logger[_0x87f1('0x11')](_0x87f1('0xc'),_0x2aa87e,_0x1500ca[_0x87f1('0x11')][_0x87f1('0x13')]);return _0x141416(_0x1500ca[_0x87f1('0x11')][_0x87f1('0x13')]);}else{logger[_0x87f1('0xb')](_0x87f1('0xc'),_0x2aa87e,_0x87f1('0xd'));_0x141416(_0x1500ca['result'][_0x87f1('0x13')]);}})['catch'](function(_0x505275){logger[_0x87f1('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2aa87e,_0x505275);_0x1ea396(_0x505275);});});} \ No newline at end of file +var _0xcb5d=['../../config/environment','jayson/promise','client','http','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x52aca0,_0x2f718f){var _0x43ca9d=function(_0x528b28){while(--_0x528b28){_0x52aca0['push'](_0x52aca0['shift']());}};_0x43ca9d(++_0x2f718f);}(_0xcb5d,0x144));var _0xdcb5=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xcb5d[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0xdcb5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdcb5('0x1'));var rs=require(_0xdcb5('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xdcb5('0x3'));var logger=require(_0xdcb5('0x4'))(_0xdcb5('0x5'));var config=require(_0xdcb5('0x6'));var jayson=require(_0xdcb5('0x7'));var client=jayson[_0xdcb5('0x8')][_0xdcb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e567f,_0x52b25e,_0x27bdab){return new BPromise(function(_0x38379e,_0x11bdcf){return client['request'](_0x3e567f,_0x27bdab)[_0xdcb5('0xa')](function(_0x2f88a9){logger[_0xdcb5('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x52b25e,'request\x20sent');logger[_0xdcb5('0xc')](_0xdcb5('0xd'),_0x52b25e,_0xdcb5('0xe'),JSON[_0xdcb5('0xf')](_0x2f88a9));if(_0x2f88a9[_0xdcb5('0x10')]){if(_0x2f88a9[_0xdcb5('0x10')][_0xdcb5('0x11')]===0x1f4){logger[_0xdcb5('0x10')](_0xdcb5('0x12'),_0x52b25e,_0x2f88a9['error']['message']);return _0x11bdcf(_0x2f88a9[_0xdcb5('0x10')][_0xdcb5('0x13')]);}logger[_0xdcb5('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x52b25e,_0x2f88a9[_0xdcb5('0x10')][_0xdcb5('0x13')]);return _0x38379e(_0x2f88a9[_0xdcb5('0x10')]['message']);}else{logger[_0xdcb5('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x52b25e,_0xdcb5('0xe'));_0x38379e(_0x2f88a9[_0xdcb5('0x14')][_0xdcb5('0x13')]);}})[_0xdcb5('0x15')](function(_0x29ee58){logger[_0xdcb5('0x10')](_0xdcb5('0x12'),_0x52b25e,_0x29ee58);_0x11bdcf(_0x29ee58);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 88656a2..ad57bc4 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 _0xbdf4=['util','path','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/users','post','create','addAgents','put','delete','destroy','removeAgents','exports','multer'];(function(_0x261f90,_0x45faa4){var _0x4313da=function(_0x18fecc){while(--_0x18fecc){_0x261f90['push'](_0x261f90['shift']());}};_0x4313da(++_0x45faa4);}(_0xbdf4,0x17b));var _0x4bdf=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xbdf4[_0x1a9204];return _0x17ca68;};'use strict';var multer=require(_0x4bdf('0x0'));var util=require(_0x4bdf('0x1'));var path=require(_0x4bdf('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4bdf('0x3'));var config=require('../../config/environment');var controller=require(_0x4bdf('0x4'));router[_0x4bdf('0x5')]('/',auth[_0x4bdf('0x6')](),controller['index']);router[_0x4bdf('0x5')](_0x4bdf('0x7'),auth[_0x4bdf('0x6')](),controller[_0x4bdf('0x8')]);router[_0x4bdf('0x5')](_0x4bdf('0x9'),auth[_0x4bdf('0x6')](),controller[_0x4bdf('0xa')]);router['get'](_0x4bdf('0xb'),auth[_0x4bdf('0x6')](),controller['getAgents']);router[_0x4bdf('0xc')]('/',auth[_0x4bdf('0x6')](),controller[_0x4bdf('0xd')]);router[_0x4bdf('0xc')](_0x4bdf('0xb'),auth['isAuthenticated'](),controller[_0x4bdf('0xe')]);router[_0x4bdf('0xf')](_0x4bdf('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4bdf('0x10')](_0x4bdf('0x9'),auth[_0x4bdf('0x6')](),controller[_0x4bdf('0x11')]);router['delete']('/:id/users',auth[_0x4bdf('0x6')](),controller[_0x4bdf('0x12')]);module[_0x4bdf('0x13')]=router; \ No newline at end of file +var _0x401d=['addAgents','update','delete','destroy','removeAgents','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','/:id/users'];(function(_0x57c1eb,_0x35407a){var _0x5cde74=function(_0x2f0b08){while(--_0x2f0b08){_0x57c1eb['push'](_0x57c1eb['shift']());}};_0x5cde74(++_0x35407a);}(_0x401d,0x1e0));var _0xd401=function(_0xd520e,_0x42d39c){_0xd520e=_0xd520e-0x0;var _0x48973e=_0x401d[_0xd520e];return _0x48973e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xd401('0x0'));var router=express[_0xd401('0x1')]();var auth=require(_0xd401('0x2'));var interaction=require(_0xd401('0x3'));var config=require(_0xd401('0x4'));var controller=require('./voicePrefix.controller');router[_0xd401('0x5')]('/',auth['isAuthenticated'](),controller[_0xd401('0x6')]);router[_0xd401('0x5')](_0xd401('0x7'),auth[_0xd401('0x8')](),controller[_0xd401('0x9')]);router[_0xd401('0x5')](_0xd401('0xa'),auth[_0xd401('0x8')](),controller['show']);router[_0xd401('0x5')]('/:id/users',auth[_0xd401('0x8')](),controller['getAgents']);router[_0xd401('0xb')]('/',auth[_0xd401('0x8')](),controller[_0xd401('0xc')]);router[_0xd401('0xb')](_0xd401('0xd'),auth[_0xd401('0x8')](),controller[_0xd401('0xe')]);router['put'](_0xd401('0xa'),auth[_0xd401('0x8')](),controller[_0xd401('0xf')]);router[_0xd401('0x10')](_0xd401('0xa'),auth['isAuthenticated'](),controller[_0xd401('0x11')]);router[_0xd401('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xd401('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 683a148..388faf4 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 _0x9056=['STRING','name','system-','getDataValue','INTEGER','exports'];(function(_0x4cca2f,_0xa86659){var _0x25c652=function(_0x282fb3){while(--_0x282fb3){_0x4cca2f['push'](_0x4cca2f['shift']());}};_0x25c652(++_0xa86659);}(_0x9056,0x6b));var _0x6905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9056[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6905('0x0')]={'name':{'type':Sequelize[_0x6905('0x1')],'allowNull':![],'unique':_0x6905('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x30d500){return _0x6905('0x3')+this[_0x6905('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x6905('0x1')]},'callerIdAll':{'type':Sequelize[_0x6905('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x6905('0x5')]}}; \ No newline at end of file +var _0xd8d6=['INTEGER','exports','STRING','name','VIRTUAL','getDataValue'];(function(_0x2d24f1,_0xdb7383){var _0xffc4df=function(_0x15c478){while(--_0x15c478){_0x2d24f1['push'](_0x2d24f1['shift']());}};_0xffc4df(++_0xdb7383);}(_0xd8d6,0x1ed));var _0x6d8d=function(_0x57e665,_0x465abd){_0x57e665=_0x57e665-0x0;var _0x229c0e=_0xd8d6[_0x57e665];return _0x229c0e;};'use strict';var Sequelize=require('sequelize');module[_0x6d8d('0x0')]={'name':{'type':Sequelize[_0x6d8d('0x1')],'allowNull':![],'unique':_0x6d8d('0x2')},'prefix':{'type':Sequelize[_0x6d8d('0x3')],'get':function(_0x463e53){return'system-'+this[_0x6d8d('0x4')](_0x6d8d('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6d8d('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7d892e8..14230f7 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 _0x76dc=['sort','where','pick','add','day','merge','map','filter','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','intersection','find','params','describe','create','sequelize','transaction','body','get','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','spread','ids','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','nolimit','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','fields','length','hasOwnProperty','order'];(function(_0x193c31,_0x1b8bf3){var _0x50c213=function(_0x2f4ba9){while(--_0x2f4ba9){_0x193c31['push'](_0x193c31['shift']());}};_0x50c213(++_0x1b8bf3);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2bb789,_0x1608bb){_0x2bb789=_0x2bb789-0x0;var _0x5021a1=_0x76dc[_0x2bb789];return _0x5021a1;};'use strict';var jsonpatch=require(_0xc76d('0x0'));var rp=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var Mustache=require('mustache');var util=require(_0xc76d('0x4'));var path=require(_0xc76d('0x5'));var sox=require('sox');var csv=require(_0xc76d('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc76d('0x7'));var crypto=require(_0xc76d('0x8'));var jsforce=require(_0xc76d('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc76d('0xa'));var Papa=require(_0xc76d('0xb'));var qs=require(_0xc76d('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0xc76d('0xd'));var config=require(_0xc76d('0xe'));var db=require('../../mysqldb')['db'];var socket=require(_0xc76d('0xf'))({'host':'localhost','port':0x18eb});require(_0xc76d('0x10'))[_0xc76d('0x11')](socket);function respondWithStatusCode(_0x15af48,_0x95e06b){_0x95e06b=_0x95e06b||0xcc;return function(_0x3f59ea){if(_0x3f59ea){return _0x15af48[_0xc76d('0x12')](_0x95e06b);}return _0x15af48[_0xc76d('0x13')](_0x95e06b)[_0xc76d('0x14')]();};}function respondWithResult(_0x1722b3,_0x311814){_0x311814=_0x311814||0xc8;return function(_0x1a7b47){if(_0x1a7b47){return _0x1722b3[_0xc76d('0x13')](_0x311814)[_0xc76d('0x15')](_0x1a7b47);}};}function respondWithFilteredResult(_0x3ed1bd,_0x5cda20){return function(_0x8696db){if(_0x8696db){var _0x2e9ec7=_0x8696db[_0xc76d('0x16')],_0x5bbed9=_0x5cda20[_0xc76d('0x17')],_0x4741a4=_0x5cda20['offset']+_0x5cda20[_0xc76d('0x18')],_0x2d23d2;if(_0x4741a4>=_0x2e9ec7){_0x4741a4=_0x2e9ec7;_0x2d23d2=0xc8;}else{_0x2d23d2=0xce;}_0x3ed1bd['status'](_0x2d23d2);return _0x3ed1bd['set'](_0xc76d('0x19'),_0x5bbed9+'-'+_0x4741a4+'/'+_0x2e9ec7)[_0xc76d('0x15')](_0x8696db);}return null;};}function patchUpdates(_0x339623){return function(_0x23f3ca){try{jsonpatch[_0xc76d('0x1a')](_0x23f3ca,_0x339623,!![]);}catch(_0x4b0402){return BPromise[_0xc76d('0x1b')](_0x4b0402);}return _0x23f3ca[_0xc76d('0x1c')]();};}function saveUpdates(_0xa0c5b6,_0x1c6d5b){return function(_0x2181dd){if(_0x2181dd){return _0x2181dd['update'](_0xa0c5b6)[_0xc76d('0x1d')](function(_0x324db7){return _0x324db7;});}return null;};}function removeEntity(_0x5dffde,_0x455371){return function(_0x777f22){if(_0x777f22){return _0x777f22[_0xc76d('0x1e')]()[_0xc76d('0x1d')](function(){_0x5dffde[_0xc76d('0x13')](0xcc)[_0xc76d('0x14')]();});}};}function handleEntityNotFound(_0x42b89c,_0x107fad){return function(_0xbebde6){if(!_0xbebde6){_0x42b89c[_0xc76d('0x12')](0x194);}return _0xbebde6;};}function handleError(_0x15328d,_0x5de11f){_0x5de11f=_0x5de11f||0x1f4;return function(_0x11b42f){logger[_0xc76d('0x1f')](_0x11b42f['stack']);if(_0x11b42f[_0xc76d('0x20')]){delete _0x11b42f[_0xc76d('0x20')];}_0x15328d['status'](_0x5de11f)[_0xc76d('0x21')](_0x11b42f);};}exports[_0xc76d('0x22')]=function(_0x2cd06e,_0xd1dda0){var _0xfc4aea={},_0x1949c4={},_0x89ee5={'count':0x0,'rows':[]};var _0x59ebd1=db['VoicePrefix'][_0xc76d('0x23')];_0x1949c4[_0xc76d('0x24')]=_['keys'](_0x59ebd1);var _0x31501a={'dateStart':_0x2cd06e[_0xc76d('0x25')][_0xc76d('0x26')],'dateEnd':_0x2cd06e['query'][_0xc76d('0x27')]};delete _0x2cd06e['query'][_0xc76d('0x26')];delete _0x2cd06e[_0xc76d('0x25')]['dateEnd'];_0x1949c4[_0xc76d('0x25')]=_[_0xc76d('0x28')](_0x2cd06e[_0xc76d('0x25')]);_0x1949c4[_0xc76d('0x29')]=_['intersection'](_0x1949c4[_0xc76d('0x24')],_0x1949c4['query']);_0xfc4aea[_0xc76d('0x2a')]=_['intersection'](_0x1949c4[_0xc76d('0x24')],qs[_0xc76d('0x2b')](_0x2cd06e['query']['fields']));_0xfc4aea['attributes']=_0xfc4aea['attributes'][_0xc76d('0x2c')]?_0xfc4aea[_0xc76d('0x2a')]:_0x1949c4[_0xc76d('0x24')];if(!_0x2cd06e[_0xc76d('0x25')][_0xc76d('0x2d')]('nolimit')){_0xfc4aea[_0xc76d('0x18')]=qs['limit'](_0x2cd06e[_0xc76d('0x25')]['limit']);_0xfc4aea[_0xc76d('0x17')]=qs[_0xc76d('0x17')](_0x2cd06e[_0xc76d('0x25')][_0xc76d('0x17')]);}_0xfc4aea[_0xc76d('0x2e')]=qs['sort'](_0x2cd06e[_0xc76d('0x25')][_0xc76d('0x2f')]);_0xfc4aea[_0xc76d('0x30')]=qs['filters'](_[_0xc76d('0x31')](_0x2cd06e[_0xc76d('0x25')],_0x1949c4[_0xc76d('0x29')]));if(_0x31501a['dateStart']){if(_0x31501a[_0xc76d('0x27')]){_0x31501a[_0xc76d('0x27')]=moment(_0x31501a[_0xc76d('0x27')])[_0xc76d('0x32')](0x1,_0xc76d('0x33'));}else{_0x31501a[_0xc76d('0x27')]=moment(_0x31501a['dateStart'])['add'](0x1,_0xc76d('0x33'));}_['merge'](_0xfc4aea[_0xc76d('0x30')],{'createdAt':{'$gte':_0x31501a[_0xc76d('0x26')],'$lte':_0x31501a[_0xc76d('0x27')]}});}if(_0x2cd06e[_0xc76d('0x25')]['filter']){_0xfc4aea['where']=_[_0xc76d('0x34')](_0xfc4aea[_0xc76d('0x30')],{'$or':_[_0xc76d('0x35')](_0xfc4aea[_0xc76d('0x2a')],function(_0x410029){var _0x58c724={};_0x58c724[_0x410029]={'$like':'%'+_0x2cd06e[_0xc76d('0x25')][_0xc76d('0x36')]+'%'};return _0x58c724;})});}_0xfc4aea=_[_0xc76d('0x34')]({},_0xfc4aea,_0x2cd06e[_0xc76d('0x37')]);var _0x3eab5c={'where':_0xfc4aea[_0xc76d('0x30')]};return db[_0xc76d('0x38')][_0xc76d('0x16')](_0x3eab5c)[_0xc76d('0x1d')](function(_0x2b0c41){_0x89ee5['count']=_0x2b0c41;if(_0x2cd06e['query'][_0xc76d('0x39')]){_0xfc4aea[_0xc76d('0x3a')]=[{'all':!![]}];}return db[_0xc76d('0x38')][_0xc76d('0x3b')](_0xfc4aea);})['then'](function(_0x52495c){_0x89ee5[_0xc76d('0x3c')]=_0x52495c;return _0x89ee5;})[_0xc76d('0x1d')](respondWithFilteredResult(_0xd1dda0,_0xfc4aea))[_0xc76d('0x3d')](handleError(_0xd1dda0,null));};exports[_0xc76d('0x3e')]=function(_0x21c18f,_0x442a6b){var _0x14efbc={'raw':![],'where':{'id':_0x21c18f['params']['id']}},_0x2ec887={};_0x2ec887[_0xc76d('0x24')]=_[_0xc76d('0x28')](db[_0xc76d('0x38')][_0xc76d('0x23')]);_0x2ec887['query']=_['keys'](_0x21c18f['query']);_0x2ec887['filters']=_['intersection'](_0x2ec887['model'],_0x2ec887['query']);_0x14efbc[_0xc76d('0x2a')]=_[_0xc76d('0x3f')](_0x2ec887[_0xc76d('0x24')],qs[_0xc76d('0x2b')](_0x21c18f[_0xc76d('0x25')][_0xc76d('0x2b')]));_0x14efbc[_0xc76d('0x2a')]=_0x14efbc[_0xc76d('0x2a')]['length']?_0x14efbc[_0xc76d('0x2a')]:_0x2ec887[_0xc76d('0x24')];if(_0x21c18f[_0xc76d('0x25')][_0xc76d('0x39')]){_0x14efbc[_0xc76d('0x3a')]=[{'all':!![]}];}_0x14efbc=_[_0xc76d('0x34')]({},_0x14efbc,_0x21c18f[_0xc76d('0x37')]);return db[_0xc76d('0x38')][_0xc76d('0x40')](_0x14efbc)['then'](handleEntityNotFound(_0x442a6b,null))['then'](respondWithResult(_0x442a6b,null))[_0xc76d('0x3d')](handleError(_0x442a6b,null));};exports[_0xc76d('0x1e')]=function(_0x2fa905,_0x160f4b){return db[_0xc76d('0x38')]['find']({'where':{'id':_0x2fa905[_0xc76d('0x41')]['id']}})[_0xc76d('0x1d')](handleEntityNotFound(_0x160f4b,null))['then'](removeEntity(_0x160f4b,null))['catch'](handleError(_0x160f4b,null));};exports[_0xc76d('0x42')]=function(_0x2c3120,_0x48cad0){return db[_0xc76d('0x38')][_0xc76d('0x42')]()[_0xc76d('0x1d')](respondWithResult(_0x48cad0,null))[_0xc76d('0x3d')](handleError(_0x48cad0,null));};exports[_0xc76d('0x43')]=function(_0x46bcd4,_0x25a549){var _0x10b1b0;return db[_0xc76d('0x44')][_0xc76d('0x45')](function(_0x56dc48){return db[_0xc76d('0x38')][_0xc76d('0x43')](_0x46bcd4[_0xc76d('0x46')],{'transaction':_0x56dc48})['then'](function(_0xbb9ef3){_0x10b1b0=_0xbb9ef3[_0xc76d('0x47')]({'plain':!![]});return db['VoiceExtension'][_0xc76d('0x40')]({'where':{'id':_0x10b1b0['VoiceExtensionId']},'raw':!![]})[_0xc76d('0x1d')](function(_0x12c972){return createVoicePrefixExtensions(_0x10b1b0,_0x12c972,_0x56dc48);});});})[_0xc76d('0x1d')](function(){return _0x10b1b0;})[_0xc76d('0x1d')](respondWithResult(_0x25a549,null))[_0xc76d('0x3d')](handleError(_0x25a549,null));};function Extension(_0x4a1e17,_0x4b76e2,_0x5bec6c,_0x320483){this[_0xc76d('0x48')]=_0xc76d('0x49');this[_0xc76d('0x4a')]=_0x4a1e17;this[_0xc76d('0x4b')]=_0x5bec6c;this[_0xc76d('0x4c')]='system';this[_0xc76d('0x4d')]=_0xc76d('0x4e');this[_0xc76d('0x4f')]=_0x4b76e2;this[_0xc76d('0x50')]=_0x320483;}function createVoicePrefixExtensions(_0x257c19,_0x4ce981,_0x275dfd){return new BPromise(function(_0x463cbe,_0x444017){var _0xee9030=new Extension(formatPrefixName(_0x257c19[_0xc76d('0x51')]),0x1,_0xc76d('0x52'),'Voice\x20Prefix');_0xee9030[_0xc76d('0x53')]=_0x257c19['id'];return db[_0xc76d('0x54')]['create'](_0xee9030,{'transaction':_0x275dfd})['then'](function(_0x1e9461){var _0x5ddcc6=_0x1e9461[_0xc76d('0x47')]({'plain':!![]});var _0x41e514=_[_0xc76d('0x35')](addVoicePrefixExtensions(_0x257c19,_0x4ce981),function(_0xfe2be1){_0xfe2be1[_0xc76d('0x55')]=_0x5ddcc6['id'];_0xfe2be1[_0xc76d('0x53')]=_0x257c19['id'];return _0xfe2be1;});return db[_0xc76d('0x54')][_0xc76d('0x56')](_0x41e514,{'transaction':_0x275dfd})[_0xc76d('0x1d')](function(_0x35b053){if(!_0x35b053){return _0x444017(_0xc76d('0x57'));}else{return _0x463cbe(_0x35b053);}})[_0xc76d('0x3d')](function(_0x2a9247){return _0x444017(_0x2a9247);});});;});};function addVoicePrefixExtensions(_0x3afeb6,_0x4cd7bf){var _0x3054e0=[];var _0xa0aa45=formatPrefixName(_0x3afeb6[_0xc76d('0x51')]);_0x3054e0[_0xc76d('0x58')](new Extension(_0xa0aa45,0x2,_0xc76d('0x59'),'CDR(prefix)='+_0x3afeb6[_0xc76d('0x20')]));if(_0x3afeb6[_0xc76d('0x5a')]){_0x3054e0['push'](new Extension(_0xa0aa45,0x3,'Set','PREFIX-CALLERIDALL='+_0x3afeb6[_0xc76d('0x5a')]));}else{_0x3054e0[_0xc76d('0x58')](new Extension(_0xa0aa45,0x3,_0xc76d('0x52'),_0xc76d('0x5b')));}_0x3054e0[_0xc76d('0x58')](new Extension(_0xa0aa45,0x4,_0xc76d('0x5c'),_0x4cd7bf[_0xc76d('0x48')]+','+_0xc76d('0x5d')+(0x8+_0x3afeb6['name'][_0xc76d('0x2c')])+'}'+','+0x1));return _0x3054e0;}function formatPrefixName(_0x5e2f0d){var _0x5f143e='_';for(var _0x3f4dd1=0x0;_0x3f4dd1<_0x5e2f0d[_0xc76d('0x2c')];_0x3f4dd1++){if(_0x5e2f0d[_0xc76d('0x5e')](_0x3f4dd1)=='-'){_0x5f143e+=_0x5e2f0d['charAt'](_0x3f4dd1);}else{_0x5f143e+='['+_0x5e2f0d[_0xc76d('0x5e')](_0x3f4dd1)+']';}}_0x5f143e+='.';return _0x5f143e;}exports['update']=function(_0x48ccf7,_0x5a651d,_0x3ac663){var _0x39784e=_0x48ccf7['body'];_0x39784e[_0xc76d('0x51')]=_0xc76d('0x5f')+_0x39784e[_0xc76d('0x20')]+'-';return db[_0xc76d('0x44')][_0xc76d('0x45')](function(_0xa81af6){return db[_0xc76d('0x38')]['update'](_0x39784e,{'where':{'id':_0x39784e['id']},'transaction':_0xa81af6})['then'](function(){return db['VoiceExtension'][_0xc76d('0x1e')]({'where':{'VoicePrefixId':_0x39784e['id']},'transaction':_0xa81af6})[_0xc76d('0x1d')](function(){return db[_0xc76d('0x54')][_0xc76d('0x40')]({'where':{'id':_0x39784e[_0xc76d('0x55')]},'raw':!![]})['then'](function(_0x986e){return createVoicePrefixExtensions(_0x39784e,_0x986e,_0xa81af6);});});});})[_0xc76d('0x1d')](function(){return db[_0xc76d('0x38')][_0xc76d('0x60')](_0x39784e['id']);})[_0xc76d('0x1d')](respondWithResult(_0x5a651d,null))[_0xc76d('0x3d')](handleError(_0x5a651d,null));};exports[_0xc76d('0x61')]=function(_0x2d791f,_0x49ec96,_0x4240cb){return db['VoicePrefix'][_0xc76d('0x40')]({'where':{'id':_0x2d791f[_0xc76d('0x41')]['id']}})[_0xc76d('0x1d')](handleEntityNotFound(_0x49ec96,null))[_0xc76d('0x1d')](function(_0x58c3ce){if(_0x58c3ce){return _0x58c3ce[_0xc76d('0x61')](_0x2d791f['body']['ids'],_[_0xc76d('0x62')](_0x2d791f[_0xc76d('0x46')],['ids','id'])||{})[_0xc76d('0x63')](function(_0x1062ea){for(var _0x4eab1d=0x0;_0x4eab1d<_0x2d791f[_0xc76d('0x46')][_0xc76d('0x64')]['length'];_0x4eab1d+=0x1){socket[_0xc76d('0x65')]('userVoicePrefix:save',{'UserId':_0x2d791f[_0xc76d('0x46')][_0xc76d('0x64')][_0x4eab1d],'VoicePrefixId':_0x2d791f['params']['id']});}return _0x1062ea;});}})[_0xc76d('0x1d')](respondWithResult(_0x49ec96,null))[_0xc76d('0x3d')](handleError(_0x49ec96,null));};exports['removeAgents']=function(_0x2642b0,_0xc3e996,_0x277382){var _0x5b7f2e;return db[_0xc76d('0x38')]['find']({'where':{'id':_0x2642b0['params']['id']}})[_0xc76d('0x1d')](handleEntityNotFound(_0xc3e996,null))[_0xc76d('0x1d')](function(_0x559541){if(_0x559541){return _0x559541[_0xc76d('0x66')](_0x2642b0[_0xc76d('0x25')][_0xc76d('0x64')])[_0xc76d('0x1d')](function(_0x1bcd83){if(_[_0xc76d('0x67')](_0x2642b0[_0xc76d('0x25')][_0xc76d('0x64')])){for(var _0x26855a=0x0;_0x26855a<_0x2642b0[_0xc76d('0x25')][_0xc76d('0x64')][_0xc76d('0x2c')];_0x26855a+=0x1){socket[_0xc76d('0x65')](_0xc76d('0x68'),{'UserId':_0x2642b0[_0xc76d('0x25')][_0xc76d('0x64')][_0x26855a],'VoicePrefixId':_0x2642b0[_0xc76d('0x41')]['id']});}}else{socket[_0xc76d('0x65')](_0xc76d('0x68'),{'UserId':_0x2642b0[_0xc76d('0x25')]['ids'],'VoicePrefixId':_0x2642b0[_0xc76d('0x41')]['id']});}});}})[_0xc76d('0x1d')](respondWithStatusCode(_0xc3e996,null))[_0xc76d('0x3d')](handleError(_0xc3e996,null));};exports[_0xc76d('0x69')]=function(_0xe3b714,_0x15ad91,_0x361bd2){var _0x109a99={};var _0x2b9ed9={};var _0x41d7cb;var _0x7210ee;return db[_0xc76d('0x38')][_0xc76d('0x6a')]({'where':{'id':_0xe3b714[_0xc76d('0x41')]['id']}})[_0xc76d('0x1d')](handleEntityNotFound(_0x15ad91,null))[_0xc76d('0x1d')](function(_0xb30e61){if(_0xb30e61){_0x41d7cb=_0xb30e61;_0x2b9ed9[_0xc76d('0x24')]=_[_0xc76d('0x28')](db[_0xc76d('0x6b')][_0xc76d('0x23')]);_0x2b9ed9[_0xc76d('0x25')]=_[_0xc76d('0x28')](_0xe3b714[_0xc76d('0x25')]);_0x2b9ed9['filters']=_[_0xc76d('0x3f')](_0x2b9ed9[_0xc76d('0x24')],_0x2b9ed9['query']);_0x109a99[_0xc76d('0x2a')]=_[_0xc76d('0x3f')](_0x2b9ed9['model'],qs[_0xc76d('0x2b')](_0xe3b714[_0xc76d('0x25')][_0xc76d('0x2b')]));_0x109a99[_0xc76d('0x2a')]=_0x109a99[_0xc76d('0x2a')][_0xc76d('0x2c')]?_0x109a99[_0xc76d('0x2a')]:_0x2b9ed9['model'];_0x109a99['order']=qs[_0xc76d('0x2f')](_0xe3b714[_0xc76d('0x25')]['sort']);_0x109a99[_0xc76d('0x30')]=qs[_0xc76d('0x29')](_[_0xc76d('0x31')](_0xe3b714[_0xc76d('0x25')],_0x2b9ed9[_0xc76d('0x29')]));if(_0xe3b714[_0xc76d('0x25')][_0xc76d('0x36')]){_0x109a99[_0xc76d('0x30')]=_[_0xc76d('0x34')](_0x109a99[_0xc76d('0x30')],{'$or':_[_0xc76d('0x35')](_0x109a99[_0xc76d('0x2a')],function(_0x9a32b3){var _0x1f2fb5={};_0x1f2fb5[_0x9a32b3]={'$like':'%'+_0xe3b714[_0xc76d('0x25')][_0xc76d('0x36')]+'%'};return _0x1f2fb5;})});}_0x109a99=_[_0xc76d('0x34')]({},_0x109a99,_0xe3b714[_0xc76d('0x37')]);return _0x41d7cb[_0xc76d('0x69')](_0x109a99);}})[_0xc76d('0x1d')](function(_0x58769f){if(_0x58769f){_0x7210ee=_0x58769f[_0xc76d('0x2c')];if(!_0xe3b714['query'][_0xc76d('0x2d')](_0xc76d('0x6c'))){_0x109a99[_0xc76d('0x18')]=qs[_0xc76d('0x18')](_0xe3b714[_0xc76d('0x25')]['limit']);_0x109a99[_0xc76d('0x17')]=qs['offset'](_0xe3b714[_0xc76d('0x25')][_0xc76d('0x17')]);}return _0x41d7cb[_0xc76d('0x69')](_0x109a99);}})[_0xc76d('0x1d')](function(_0x3714cf){if(_0x3714cf){return _0x3714cf?{'count':_0x7210ee,'rows':_0x3714cf}:null;}})['then'](respondWithResult(_0x15ad91,null))['catch'](handleError(_0x15ad91,null));}; \ No newline at end of file +var _0xce25=['destroy','end','stack','name','send','index','VoicePrefix','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','limit','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','length','find','params','describe','create','sequelize','transaction','body','VoiceExtensionId','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','hasOwnProperty','nolimit','moment','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./voicePrefix.socket','register','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x3b0d74,_0x41e919){var _0x15e419=function(_0x16c29e){while(--_0x16c29e){_0x3b0d74['push'](_0x3b0d74['shift']());}};_0x15e419(++_0x41e919);}(_0xce25,0x196));var _0x5ce2=function(_0x58cff9,_0x409230){_0x58cff9=_0x58cff9-0x0;var _0x55c013=_0xce25[_0x58cff9];return _0x55c013;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ce2('0x0'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5ce2('0x1'));var sox=require(_0x5ce2('0x2'));var csv=require('to-csv');var ejs=require(_0x5ce2('0x3'));var fs=require('fs');var _=require(_0x5ce2('0x4'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ce2('0x5'));var deskjs=require(_0x5ce2('0x6'));var toCsv=require(_0x5ce2('0x7'));var querystring=require(_0x5ce2('0x8'));var Papa=require('papaparse');var qs=require(_0x5ce2('0x9'));var logger=require(_0x5ce2('0xa'))(_0x5ce2('0xb'));var utils=require('../../config/utils');var config=require(_0x5ce2('0xc'));var db=require(_0x5ce2('0xd'))['db'];var socket=require(_0x5ce2('0xe'))({'host':_0x5ce2('0xf'),'port':0x18eb});require(_0x5ce2('0x10'))[_0x5ce2('0x11')](socket);function respondWithStatusCode(_0x54241f,_0x270340){_0x270340=_0x270340||0xcc;return function(_0x4f7a36){if(_0x4f7a36){return _0x54241f[_0x5ce2('0x12')](_0x270340);}return _0x54241f[_0x5ce2('0x13')](_0x270340)['end']();};}function respondWithResult(_0x496c1e,_0x595d33){_0x595d33=_0x595d33||0xc8;return function(_0x550fb3){if(_0x550fb3){return _0x496c1e[_0x5ce2('0x13')](_0x595d33)['json'](_0x550fb3);}};}function respondWithFilteredResult(_0x5360b8,_0x3a69ec){return function(_0x56bd1b){if(_0x56bd1b){var _0x9316be=_0x56bd1b[_0x5ce2('0x14')],_0xb9aead=_0x3a69ec[_0x5ce2('0x15')],_0x24522c=_0x3a69ec[_0x5ce2('0x15')]+_0x3a69ec['limit'],_0x53e047;if(_0x24522c>=_0x9316be){_0x24522c=_0x9316be;_0x53e047=0xc8;}else{_0x53e047=0xce;}_0x5360b8['status'](_0x53e047);return _0x5360b8[_0x5ce2('0x16')](_0x5ce2('0x17'),_0xb9aead+'-'+_0x24522c+'/'+_0x9316be)[_0x5ce2('0x18')](_0x56bd1b);}return null;};}function patchUpdates(_0x5369e7){return function(_0x19915d){try{jsonpatch[_0x5ce2('0x19')](_0x19915d,_0x5369e7,!![]);}catch(_0x3dd57a){return BPromise[_0x5ce2('0x1a')](_0x3dd57a);}return _0x19915d[_0x5ce2('0x1b')]();};}function saveUpdates(_0x2f9013,_0x3b3eea){return function(_0x1e13be){if(_0x1e13be){return _0x1e13be[_0x5ce2('0x1c')](_0x2f9013)[_0x5ce2('0x1d')](function(_0x3519c4){return _0x3519c4;});}return null;};}function removeEntity(_0x2d32c9,_0xc9644){return function(_0x3cf781){if(_0x3cf781){return _0x3cf781[_0x5ce2('0x1e')]()[_0x5ce2('0x1d')](function(){_0x2d32c9[_0x5ce2('0x13')](0xcc)[_0x5ce2('0x1f')]();});}};}function handleEntityNotFound(_0x350fd9,_0x587abb){return function(_0x5e703f){if(!_0x5e703f){_0x350fd9[_0x5ce2('0x12')](0x194);}return _0x5e703f;};}function handleError(_0x2e9675,_0x3440b5){_0x3440b5=_0x3440b5||0x1f4;return function(_0x4f27aa){logger['error'](_0x4f27aa[_0x5ce2('0x20')]);if(_0x4f27aa[_0x5ce2('0x21')]){delete _0x4f27aa['name'];}_0x2e9675[_0x5ce2('0x13')](_0x3440b5)[_0x5ce2('0x22')](_0x4f27aa);};}exports[_0x5ce2('0x23')]=function(_0x2198aa,_0x44c692){var _0x208448={},_0x3a4bb9={},_0x19e637={'count':0x0,'rows':[]};var _0x41af3d=db[_0x5ce2('0x24')][_0x5ce2('0x25')];_0x3a4bb9[_0x5ce2('0x26')]=_[_0x5ce2('0x27')](_0x41af3d);var _0xff0a11={'dateStart':_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x29')],'dateEnd':_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x2a')]};delete _0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x29')];delete _0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x2a')];_0x3a4bb9[_0x5ce2('0x28')]=_[_0x5ce2('0x27')](_0x2198aa[_0x5ce2('0x28')]);_0x3a4bb9[_0x5ce2('0x2b')]=_[_0x5ce2('0x2c')](_0x3a4bb9[_0x5ce2('0x26')],_0x3a4bb9[_0x5ce2('0x28')]);_0x208448[_0x5ce2('0x2d')]=_[_0x5ce2('0x2c')](_0x3a4bb9[_0x5ce2('0x26')],qs['fields'](_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x2e')]));_0x208448[_0x5ce2('0x2d')]=_0x208448['attributes']['length']?_0x208448[_0x5ce2('0x2d')]:_0x3a4bb9[_0x5ce2('0x26')];if(!_0x2198aa[_0x5ce2('0x28')]['hasOwnProperty']('nolimit')){_0x208448[_0x5ce2('0x2f')]=qs[_0x5ce2('0x2f')](_0x2198aa['query'][_0x5ce2('0x2f')]);_0x208448[_0x5ce2('0x15')]=qs[_0x5ce2('0x15')](_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x15')]);}_0x208448[_0x5ce2('0x30')]=qs[_0x5ce2('0x31')](_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x31')]);_0x208448[_0x5ce2('0x32')]=qs[_0x5ce2('0x2b')](_['pick'](_0x2198aa['query'],_0x3a4bb9['filters']));if(_0xff0a11['dateStart']){if(_0xff0a11[_0x5ce2('0x2a')]){_0xff0a11[_0x5ce2('0x2a')]=moment(_0xff0a11[_0x5ce2('0x2a')])[_0x5ce2('0x33')](0x1,_0x5ce2('0x34'));}else{_0xff0a11[_0x5ce2('0x2a')]=moment(_0xff0a11[_0x5ce2('0x29')])[_0x5ce2('0x33')](0x1,_0x5ce2('0x34'));}_[_0x5ce2('0x35')](_0x208448[_0x5ce2('0x32')],{'createdAt':{'$gte':_0xff0a11[_0x5ce2('0x29')],'$lte':_0xff0a11['dateEnd']}});}if(_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x36')]){_0x208448['where']=_[_0x5ce2('0x35')](_0x208448[_0x5ce2('0x32')],{'$or':_[_0x5ce2('0x37')](_0x208448[_0x5ce2('0x2d')],function(_0x57dee1){var _0x234789={};_0x234789[_0x57dee1]={'$like':'%'+_0x2198aa[_0x5ce2('0x28')][_0x5ce2('0x36')]+'%'};return _0x234789;})});}_0x208448=_[_0x5ce2('0x35')]({},_0x208448,_0x2198aa[_0x5ce2('0x38')]);var _0x45d745={'where':_0x208448['where']};return db[_0x5ce2('0x24')][_0x5ce2('0x14')](_0x45d745)['then'](function(_0x361a90){_0x19e637[_0x5ce2('0x14')]=_0x361a90;if(_0x2198aa['query'][_0x5ce2('0x39')]){_0x208448[_0x5ce2('0x3a')]=[{'all':!![]}];}return db[_0x5ce2('0x24')][_0x5ce2('0x3b')](_0x208448);})[_0x5ce2('0x1d')](function(_0x24918f){_0x19e637[_0x5ce2('0x3c')]=_0x24918f;return _0x19e637;})[_0x5ce2('0x1d')](respondWithFilteredResult(_0x44c692,_0x208448))[_0x5ce2('0x3d')](handleError(_0x44c692,null));};exports['show']=function(_0xf652b4,_0x3b6b09){var _0x53ab87={'raw':![],'where':{'id':_0xf652b4['params']['id']}},_0x44675f={};_0x44675f[_0x5ce2('0x26')]=_[_0x5ce2('0x27')](db[_0x5ce2('0x24')][_0x5ce2('0x25')]);_0x44675f[_0x5ce2('0x28')]=_[_0x5ce2('0x27')](_0xf652b4[_0x5ce2('0x28')]);_0x44675f['filters']=_[_0x5ce2('0x2c')](_0x44675f[_0x5ce2('0x26')],_0x44675f[_0x5ce2('0x28')]);_0x53ab87[_0x5ce2('0x2d')]=_['intersection'](_0x44675f[_0x5ce2('0x26')],qs[_0x5ce2('0x2e')](_0xf652b4[_0x5ce2('0x28')][_0x5ce2('0x2e')]));_0x53ab87['attributes']=_0x53ab87[_0x5ce2('0x2d')][_0x5ce2('0x3e')]?_0x53ab87[_0x5ce2('0x2d')]:_0x44675f[_0x5ce2('0x26')];if(_0xf652b4['query'][_0x5ce2('0x39')]){_0x53ab87[_0x5ce2('0x3a')]=[{'all':!![]}];}_0x53ab87=_[_0x5ce2('0x35')]({},_0x53ab87,_0xf652b4[_0x5ce2('0x38')]);return db[_0x5ce2('0x24')]['find'](_0x53ab87)[_0x5ce2('0x1d')](handleEntityNotFound(_0x3b6b09,null))[_0x5ce2('0x1d')](respondWithResult(_0x3b6b09,null))[_0x5ce2('0x3d')](handleError(_0x3b6b09,null));};exports[_0x5ce2('0x1e')]=function(_0x244eae,_0x1b8e53){return db[_0x5ce2('0x24')][_0x5ce2('0x3f')]({'where':{'id':_0x244eae[_0x5ce2('0x40')]['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x1b8e53,null))['then'](removeEntity(_0x1b8e53,null))[_0x5ce2('0x3d')](handleError(_0x1b8e53,null));};exports[_0x5ce2('0x41')]=function(_0x1e5a07,_0x5a1f56){return db[_0x5ce2('0x24')]['describe']()[_0x5ce2('0x1d')](respondWithResult(_0x5a1f56,null))['catch'](handleError(_0x5a1f56,null));};exports[_0x5ce2('0x42')]=function(_0x497afe,_0x50568c){var _0x4ae957;return db[_0x5ce2('0x43')][_0x5ce2('0x44')](function(_0x42af68){return db[_0x5ce2('0x24')][_0x5ce2('0x42')](_0x497afe[_0x5ce2('0x45')],{'transaction':_0x42af68})[_0x5ce2('0x1d')](function(_0x54d572){_0x4ae957=_0x54d572['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x4ae957[_0x5ce2('0x46')]},'raw':!![]})['then'](function(_0x1d9eed){return createVoicePrefixExtensions(_0x4ae957,_0x1d9eed,_0x42af68);});});})[_0x5ce2('0x1d')](function(){return _0x4ae957;})[_0x5ce2('0x1d')](respondWithResult(_0x50568c,null))[_0x5ce2('0x3d')](handleError(_0x50568c,null));};function Extension(_0x5bdbe2,_0x303e93,_0xd4abcc,_0x187b74){this[_0x5ce2('0x47')]=_0x5ce2('0x48');this[_0x5ce2('0x49')]=_0x5bdbe2;this[_0x5ce2('0x4a')]=_0xd4abcc;this['type']=_0x5ce2('0x4b');this[_0x5ce2('0x4c')]=_0x5ce2('0x4d');this[_0x5ce2('0x4e')]=_0x303e93;this['appdata']=_0x187b74;}function createVoicePrefixExtensions(_0x155a39,_0x37bb53,_0x51e14f){return new BPromise(function(_0x1cec1f,_0x66a61d){var _0x33bc40=new Extension(formatPrefixName(_0x155a39[_0x5ce2('0x4f')]),0x1,_0x5ce2('0x50'),_0x5ce2('0x51'));_0x33bc40[_0x5ce2('0x52')]=_0x155a39['id'];return db[_0x5ce2('0x53')][_0x5ce2('0x42')](_0x33bc40,{'transaction':_0x51e14f})[_0x5ce2('0x1d')](function(_0x55e45b){var _0x17aa52=_0x55e45b['get']({'plain':!![]});var _0x440264=_[_0x5ce2('0x37')](addVoicePrefixExtensions(_0x155a39,_0x37bb53),function(_0x8a3ec4){_0x8a3ec4['VoiceExtensionId']=_0x17aa52['id'];_0x8a3ec4[_0x5ce2('0x52')]=_0x155a39['id'];return _0x8a3ec4;});return db['VoiceExtension']['bulkCreate'](_0x440264,{'transaction':_0x51e14f})[_0x5ce2('0x1d')](function(_0x446616){if(!_0x446616){return _0x66a61d(_0x5ce2('0x54'));}else{return _0x1cec1f(_0x446616);}})['catch'](function(_0x2564e7){return _0x66a61d(_0x2564e7);});});;});};function addVoicePrefixExtensions(_0x14c084,_0xcae51f){var _0x11f84c=[];var _0x272aba=formatPrefixName(_0x14c084['prefix']);_0x11f84c[_0x5ce2('0x55')](new Extension(_0x272aba,0x2,_0x5ce2('0x56'),_0x5ce2('0x57')+_0x14c084[_0x5ce2('0x21')]));if(_0x14c084[_0x5ce2('0x58')]){_0x11f84c[_0x5ce2('0x55')](new Extension(_0x272aba,0x3,_0x5ce2('0x56'),_0x5ce2('0x59')+_0x14c084[_0x5ce2('0x58')]));}else{_0x11f84c['push'](new Extension(_0x272aba,0x3,'NoOp',_0x5ce2('0x5a')));}_0x11f84c[_0x5ce2('0x55')](new Extension(_0x272aba,0x4,'goto',_0xcae51f['context']+','+_0x5ce2('0x5b')+(0x8+_0x14c084[_0x5ce2('0x21')][_0x5ce2('0x3e')])+'}'+','+0x1));return _0x11f84c;}function formatPrefixName(_0x58e990){var _0x490670='_';for(var _0x285b77=0x0;_0x285b77<_0x58e990[_0x5ce2('0x3e')];_0x285b77++){if(_0x58e990[_0x5ce2('0x5c')](_0x285b77)=='-'){_0x490670+=_0x58e990[_0x5ce2('0x5c')](_0x285b77);}else{_0x490670+='['+_0x58e990[_0x5ce2('0x5c')](_0x285b77)+']';}}_0x490670+='.';return _0x490670;}exports[_0x5ce2('0x1c')]=function(_0x1514e8,_0x2ca8ed,_0x23ae0){var _0x4e5baa=_0x1514e8['body'];_0x4e5baa[_0x5ce2('0x4f')]=_0x5ce2('0x5d')+_0x4e5baa[_0x5ce2('0x21')]+'-';return db[_0x5ce2('0x43')][_0x5ce2('0x44')](function(_0x5a2a33){return db[_0x5ce2('0x24')][_0x5ce2('0x1c')](_0x4e5baa,{'where':{'id':_0x4e5baa['id']},'transaction':_0x5a2a33})[_0x5ce2('0x1d')](function(){return db[_0x5ce2('0x53')][_0x5ce2('0x1e')]({'where':{'VoicePrefixId':_0x4e5baa['id']},'transaction':_0x5a2a33})[_0x5ce2('0x1d')](function(){return db[_0x5ce2('0x53')]['find']({'where':{'id':_0x4e5baa[_0x5ce2('0x46')]},'raw':!![]})[_0x5ce2('0x1d')](function(_0x48d415){return createVoicePrefixExtensions(_0x4e5baa,_0x48d415,_0x5a2a33);});});});})[_0x5ce2('0x1d')](function(){return db[_0x5ce2('0x24')][_0x5ce2('0x5e')](_0x4e5baa['id']);})[_0x5ce2('0x1d')](respondWithResult(_0x2ca8ed,null))[_0x5ce2('0x3d')](handleError(_0x2ca8ed,null));};exports['addAgents']=function(_0x9174b5,_0x5f39ba,_0x5a4505){return db[_0x5ce2('0x24')][_0x5ce2('0x3f')]({'where':{'id':_0x9174b5[_0x5ce2('0x40')]['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x5f39ba,null))[_0x5ce2('0x1d')](function(_0x2549ea){if(_0x2549ea){return _0x2549ea[_0x5ce2('0x5f')](_0x9174b5[_0x5ce2('0x45')][_0x5ce2('0x60')],_[_0x5ce2('0x61')](_0x9174b5['body'],[_0x5ce2('0x60'),'id'])||{})[_0x5ce2('0x62')](function(_0x590943){for(var _0x343b21=0x0;_0x343b21<_0x9174b5['body'][_0x5ce2('0x60')][_0x5ce2('0x3e')];_0x343b21+=0x1){socket[_0x5ce2('0x63')](_0x5ce2('0x64'),{'UserId':_0x9174b5['body']['ids'][_0x343b21],'VoicePrefixId':_0x9174b5[_0x5ce2('0x40')]['id']});}return _0x590943;});}})['then'](respondWithResult(_0x5f39ba,null))['catch'](handleError(_0x5f39ba,null));};exports[_0x5ce2('0x65')]=function(_0x30cadc,_0x1981fd,_0x34cb64){var _0x3fff84;return db[_0x5ce2('0x24')]['find']({'where':{'id':_0x30cadc[_0x5ce2('0x40')]['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x1981fd,null))['then'](function(_0x2f5bf0){if(_0x2f5bf0){return _0x2f5bf0[_0x5ce2('0x65')](_0x30cadc[_0x5ce2('0x28')]['ids'])[_0x5ce2('0x1d')](function(_0x371658){if(_['isArray'](_0x30cadc['query']['ids'])){for(var _0x5ed0af=0x0;_0x5ed0af<_0x30cadc[_0x5ce2('0x28')][_0x5ce2('0x60')][_0x5ce2('0x3e')];_0x5ed0af+=0x1){socket[_0x5ce2('0x63')](_0x5ce2('0x66'),{'UserId':_0x30cadc[_0x5ce2('0x28')]['ids'][_0x5ed0af],'VoicePrefixId':_0x30cadc[_0x5ce2('0x40')]['id']});}}else{socket['emit'](_0x5ce2('0x66'),{'UserId':_0x30cadc[_0x5ce2('0x28')][_0x5ce2('0x60')],'VoicePrefixId':_0x30cadc[_0x5ce2('0x40')]['id']});}});}})['then'](respondWithStatusCode(_0x1981fd,null))[_0x5ce2('0x3d')](handleError(_0x1981fd,null));};exports[_0x5ce2('0x67')]=function(_0x5e3658,_0x216e46,_0x5508e9){var _0x18489e={};var _0x5d418c={};var _0x37249c;var _0x544a6a;return db[_0x5ce2('0x24')][_0x5ce2('0x68')]({'where':{'id':_0x5e3658[_0x5ce2('0x40')]['id']}})[_0x5ce2('0x1d')](handleEntityNotFound(_0x216e46,null))[_0x5ce2('0x1d')](function(_0x4cdf62){if(_0x4cdf62){_0x37249c=_0x4cdf62;_0x5d418c[_0x5ce2('0x26')]=_[_0x5ce2('0x27')](db[_0x5ce2('0x69')][_0x5ce2('0x25')]);_0x5d418c['query']=_[_0x5ce2('0x27')](_0x5e3658[_0x5ce2('0x28')]);_0x5d418c['filters']=_[_0x5ce2('0x2c')](_0x5d418c[_0x5ce2('0x26')],_0x5d418c[_0x5ce2('0x28')]);_0x18489e[_0x5ce2('0x2d')]=_[_0x5ce2('0x2c')](_0x5d418c[_0x5ce2('0x26')],qs[_0x5ce2('0x2e')](_0x5e3658[_0x5ce2('0x28')][_0x5ce2('0x2e')]));_0x18489e[_0x5ce2('0x2d')]=_0x18489e[_0x5ce2('0x2d')][_0x5ce2('0x3e')]?_0x18489e['attributes']:_0x5d418c[_0x5ce2('0x26')];_0x18489e[_0x5ce2('0x30')]=qs['sort'](_0x5e3658['query'][_0x5ce2('0x31')]);_0x18489e['where']=qs[_0x5ce2('0x2b')](_[_0x5ce2('0x6a')](_0x5e3658[_0x5ce2('0x28')],_0x5d418c['filters']));if(_0x5e3658[_0x5ce2('0x28')]['filter']){_0x18489e[_0x5ce2('0x32')]=_[_0x5ce2('0x35')](_0x18489e[_0x5ce2('0x32')],{'$or':_[_0x5ce2('0x37')](_0x18489e[_0x5ce2('0x2d')],function(_0x33621e){var _0x5d6811={};_0x5d6811[_0x33621e]={'$like':'%'+_0x5e3658[_0x5ce2('0x28')][_0x5ce2('0x36')]+'%'};return _0x5d6811;})});}_0x18489e=_[_0x5ce2('0x35')]({},_0x18489e,_0x5e3658['options']);return _0x37249c[_0x5ce2('0x67')](_0x18489e);}})[_0x5ce2('0x1d')](function(_0x6c2b71){if(_0x6c2b71){_0x544a6a=_0x6c2b71[_0x5ce2('0x3e')];if(!_0x5e3658[_0x5ce2('0x28')][_0x5ce2('0x6b')](_0x5ce2('0x6c'))){_0x18489e[_0x5ce2('0x2f')]=qs[_0x5ce2('0x2f')](_0x5e3658[_0x5ce2('0x28')][_0x5ce2('0x2f')]);_0x18489e[_0x5ce2('0x15')]=qs['offset'](_0x5e3658[_0x5ce2('0x28')][_0x5ce2('0x15')]);}return _0x37249c[_0x5ce2('0x67')](_0x18489e);}})[_0x5ce2('0x1d')](function(_0x473896){if(_0x473896){return _0x473896?{'count':_0x544a6a,'rows':_0x473896}:null;}})[_0x5ce2('0x1d')](respondWithResult(_0x216e46,null))['catch'](handleError(_0x216e46,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6d406c3..410054d 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 _0x5ad3=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x242538,_0x1221e8){var _0x5b458d=function(_0x3fa53d){while(--_0x3fa53d){_0x242538['push'](_0x242538['shift']());}};_0x5b458d(++_0x1221e8);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x5ad3[_0x42c6f1];return _0x3c7398;};'use strict';var EventEmitter=require(_0x35ad('0x0'));var VoicePrefix=require(_0x35ad('0x1'))['db'][_0x35ad('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x35ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ad('0x4'),'afterDestroy':_0x35ad('0x5')};function emitEvent(_0xc77352){return function(_0x69a0b3,_0x450f55,_0x1fed0d){VoicePrefixEvents[_0x35ad('0x6')](_0xc77352+':'+_0x69a0b3['id'],_0x69a0b3);VoicePrefixEvents[_0x35ad('0x6')](_0xc77352,_0x69a0b3);_0x1fed0d(null);};}for(var e in events){if(events[_0x35ad('0x7')](e)){var event=events[e];VoicePrefix[_0x35ad('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x3edb26,_0x9613b4){var _0x4ad9f5=function(_0x5cb828){while(--_0x5cb828){_0x3edb26['push'](_0x3edb26['shift']());}};_0x4ad9f5(++_0x9613b4);}(_0x7217,0x19e));var _0x7721=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7217[_0x491a7f];return _0x3d8f44;};'use strict';var EventEmitter=require(_0x7721('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x7721('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){VoicePrefixEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);VoicePrefixEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];VoicePrefix[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 109dea3..8f4926b 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 _0xcae6=['lodash','util','../../config/logger','api','bluebird','request-promise','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x2704be,_0x2555d4){var _0x21d7b5=function(_0x5f2a1b){while(--_0x5f2a1b){_0x2704be['push'](_0x2704be['shift']());}};_0x21d7b5(++_0x2555d4);}(_0xcae6,0x1ae));var _0x6cae=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xcae6[_0x126f47];return _0x49508a;};'use strict';var _=require(_0x6cae('0x0'));var util=require(_0x6cae('0x1'));var logger=require(_0x6cae('0x2'))(_0x6cae('0x3'));var moment=require('moment');var BPromise=require(_0x6cae('0x4'));var rp=require(_0x6cae('0x5'));var attributes=require(_0x6cae('0x6'));module['exports']=function(_0x265feb,_0x431726){return _0x265feb[_0x6cae('0x7')](_0x6cae('0x8'),attributes,{'tableName':_0x6cae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd0c=['bluebird','./voicePrefix.attributes','exports','define','voice_prefixes','util','../../config/logger','api'];(function(_0x3d1d8e,_0x533b1c){var _0x175671=function(_0x4a9333){while(--_0x4a9333){_0x3d1d8e['push'](_0x3d1d8e['shift']());}};_0x175671(++_0x533b1c);}(_0xdd0c,0x165));var _0xcdd0=function(_0x2b7921,_0x28277c){_0x2b7921=_0x2b7921-0x0;var _0x28b2ad=_0xdd0c[_0x2b7921];return _0x28b2ad;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var logger=require(_0xcdd0('0x1'))(_0xcdd0('0x2'));var moment=require('moment');var BPromise=require(_0xcdd0('0x3'));var rp=require('request-promise');var attributes=require(_0xcdd0('0x4'));module[_0xcdd0('0x5')]=function(_0x432716,_0x354e5f){return _0x432716[_0xcdd0('0x6')]('VoicePrefix',attributes,{'tableName':_0xcdd0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index b47db64..47bbdc6 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 _0x717c=['./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','socket.io-emitter','localhost'];(function(_0xc25390,_0xc7416d){var _0x59046f=function(_0x2f31f1){while(--_0x2f31f1){_0xc25390['push'](_0xc25390['shift']());}};_0x59046f(++_0xc7416d);}(_0x717c,0x1ee));var _0xc717=function(_0x5ebc44,_0x51b50d){_0x5ebc44=_0x5ebc44-0x0;var _0x596c31=_0x717c[_0x5ebc44];return _0x596c31;};'use strict';var _=require(_0xc717('0x0'));var util=require(_0xc717('0x1'));var moment=require('moment');var BPromise=require(_0xc717('0x2'));var rs=require(_0xc717('0x3'));var fs=require('fs');var db=require(_0xc717('0x4'))['db'];var utils=require(_0xc717('0x5'));var logger=require(_0xc717('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc717('0x7'));var client=jayson[_0xc717('0x8')][_0xc717('0x9')]({'port':0x232a});var socket=require(_0xc717('0xa'))({'host':_0xc717('0xb'),'port':0x18eb});require(_0xc717('0xc'))[_0xc717('0xd')](socket);function respondWithRpcPromise(_0xc983a9,_0x1e120b,_0x1a1f52){return new BPromise(function(_0x1a480d,_0x2999a5){return client['request'](_0xc983a9,_0x1a1f52)['then'](function(_0x20e4e8){logger[_0xc717('0xe')](_0xc717('0xf'),_0x1e120b,'request\x20sent');logger[_0xc717('0x10')](_0xc717('0x11'),_0x1e120b,'request\x20sent',JSON['stringify'](_0x20e4e8));if(_0x20e4e8[_0xc717('0x12')]){if(_0x20e4e8[_0xc717('0x12')][_0xc717('0x13')]===0x1f4){logger[_0xc717('0x12')](_0xc717('0xf'),_0x1e120b,_0x20e4e8[_0xc717('0x12')]['message']);return _0x2999a5(_0x20e4e8[_0xc717('0x12')]['message']);}logger['error'](_0xc717('0xf'),_0x1e120b,_0x20e4e8[_0xc717('0x12')]['message']);return _0x1a480d(_0x20e4e8['error'][_0xc717('0x14')]);}else{logger[_0xc717('0xe')](_0xc717('0xf'),_0x1e120b,_0xc717('0x15'));_0x1a480d(_0x20e4e8['result'][_0xc717('0x14')]);}})[_0xc717('0x16')](function(_0x5a6603){logger['error'](_0xc717('0xf'),_0x1e120b,_0x5a6603);_0x2999a5(_0x5a6603);});});} \ No newline at end of file +var _0xf434=['util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','VoicePrefix,\x20%s,\x20%s','result','catch','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf434,0xe6));var _0x4f43=function(_0x3adf06,_0x46aa71){_0x3adf06=_0x3adf06-0x0;var _0x44ba8d=_0xf434[_0x3adf06];return _0x44ba8d;};'use strict';var _=require(_0x4f43('0x0'));var util=require(_0x4f43('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f43('0x2'));var fs=require('fs');var db=require(_0x4f43('0x3'))['db'];var utils=require(_0x4f43('0x4'));var logger=require('../../config/logger')(_0x4f43('0x5'));var config=require('../../config/environment');var jayson=require(_0x4f43('0x6'));var client=jayson['client'][_0x4f43('0x7')]({'port':0x232a});var socket=require(_0x4f43('0x8'))({'host':'localhost','port':0x18eb});require('./voicePrefix.socket')[_0x4f43('0x9')](socket);function respondWithRpcPromise(_0x16295a,_0x5870aa,_0x508808){return new BPromise(function(_0x4f773a,_0x28e845){return client[_0x4f43('0xa')](_0x16295a,_0x508808)[_0x4f43('0xb')](function(_0x49dec4){logger[_0x4f43('0xc')]('VoicePrefix,\x20%s,\x20%s',_0x5870aa,_0x4f43('0xd'));logger[_0x4f43('0xe')](_0x4f43('0xf'),_0x5870aa,_0x4f43('0xd'),JSON['stringify'](_0x49dec4));if(_0x49dec4[_0x4f43('0x10')]){if(_0x49dec4[_0x4f43('0x10')]['code']===0x1f4){logger[_0x4f43('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x5870aa,_0x49dec4[_0x4f43('0x10')][_0x4f43('0x11')]);return _0x28e845(_0x49dec4[_0x4f43('0x10')][_0x4f43('0x11')]);}logger[_0x4f43('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x5870aa,_0x49dec4[_0x4f43('0x10')]['message']);return _0x4f773a(_0x49dec4['error'][_0x4f43('0x11')]);}else{logger[_0x4f43('0xc')](_0x4f43('0x12'),_0x5870aa,_0x4f43('0xd'));_0x4f773a(_0x49dec4[_0x4f43('0x13')]['message']);}})[_0x4f43('0x14')](function(_0x313807){logger[_0x4f43('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x5870aa,_0x313807);_0x28e845(_0x313807);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index fb41fda..31db379 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 _0x2d59=['register','voicePrefix:','save','remove','update','emit'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2d59,0x110));var _0x92d5=function(_0x36a9f5,_0x459eee){_0x36a9f5=_0x36a9f5-0x0;var _0x552043=_0x2d59[_0x36a9f5];return _0x552043;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x92d5('0x0'),_0x92d5('0x1'),_0x92d5('0x2')];function createListener(_0xded730,_0x4f957c){return function(_0x11b913){_0x4f957c[_0x92d5('0x3')](_0xded730,_0x11b913);};}function removeListener(_0x425aa8,_0x2b2e01){return function(){VoicePrefixEvents['removeListener'](_0x425aa8,_0x2b2e01);};}exports[_0x92d5('0x4')]=function(_0x2c040a){for(var _0x1da5c5=0x0,_0x36638b=events['length'];_0x1da5c5<_0x36638b;_0x1da5c5++){var _0x3c3ef3=events[_0x1da5c5];var _0x4c05f0=createListener(_0x92d5('0x5')+_0x3c3ef3,_0x2c040a);VoicePrefixEvents['on'](_0x3c3ef3,_0x4c05f0);}}; \ No newline at end of file +var _0x09d7=['voicePrefix:','./voicePrefix.events','save','remove','update','register'];(function(_0x554e87,_0x45997f){var _0x6c8303=function(_0x429260){while(--_0x429260){_0x554e87['push'](_0x554e87['shift']());}};_0x6c8303(++_0x45997f);}(_0x09d7,0x14b));var _0x709d=function(_0x1a9f1a,_0x4d7dba){_0x1a9f1a=_0x1a9f1a-0x0;var _0xb3a547=_0x09d7[_0x1a9f1a];return _0xb3a547;};'use strict';var VoicePrefixEvents=require(_0x709d('0x0'));var events=[_0x709d('0x1'),_0x709d('0x2'),_0x709d('0x3')];function createListener(_0x167d0a,_0x5ba43f){return function(_0x15bcdd){_0x5ba43f['emit'](_0x167d0a,_0x15bcdd);};}function removeListener(_0x3bb945,_0x4be3aa){return function(){VoicePrefixEvents['removeListener'](_0x3bb945,_0x4be3aa);};}exports[_0x709d('0x4')]=function(_0x19b6d2){for(var _0x304146=0x0,_0x46c280=events['length'];_0x304146<_0x46c280;_0x304146++){var _0x3f21eb=events[_0x304146];var _0x1fdff4=createListener(_0x709d('0x5')+_0x3f21eb,_0x19b6d2);VoicePrefixEvents['on'](_0x3f21eb,_0x1fdff4);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b55eaae..2056595 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 _0x0820=['/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addAgents','addLists','addBlackLists','destroy','removeTeams','removeAgents','delete','removeLists','removeBlackLists','exports','path','express','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','/:id/lists','getLists'];(function(_0x55193b,_0x204da0){var _0x295171=function(_0x5686c5){while(--_0x5686c5){_0x55193b['push'](_0x55193b['shift']());}};_0x295171(++_0x204da0);}(_0x0820,0x1c8));var _0x0082=function(_0x57189c,_0x9a9dcf){_0x57189c=_0x57189c-0x0;var _0x9a560b=_0x0820[_0x57189c];return _0x9a560b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0082('0x0'));var express=require(_0x0082('0x1'));var router=express[_0x0082('0x2')]();var auth=require(_0x0082('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0082('0x4'));var controller=require(_0x0082('0x5'));router[_0x0082('0x6')]('/',auth[_0x0082('0x7')](),controller[_0x0082('0x8')]);router[_0x0082('0x6')](_0x0082('0x9'),auth['isAuthenticated'](),controller[_0x0082('0xa')]);router[_0x0082('0x6')](_0x0082('0xb'),auth[_0x0082('0x7')](),controller[_0x0082('0xc')]);router['get'](_0x0082('0xd'),auth[_0x0082('0x7')](),controller[_0x0082('0xe')]);router[_0x0082('0x6')](_0x0082('0xf'),auth[_0x0082('0x7')](),controller[_0x0082('0x10')]);router[_0x0082('0x6')](_0x0082('0x11'),auth[_0x0082('0x7')](),controller[_0x0082('0x12')]);router[_0x0082('0x6')]('/:id/teams',auth[_0x0082('0x7')](),controller[_0x0082('0x13')]);router[_0x0082('0x6')](_0x0082('0x14'),auth['isAuthenticated'](),controller[_0x0082('0x15')]);router[_0x0082('0x6')]('/:id/members',auth[_0x0082('0x7')](),controller['getMembers']);router[_0x0082('0x6')](_0x0082('0x16'),auth[_0x0082('0x7')](),controller[_0x0082('0x17')]);router[_0x0082('0x6')](_0x0082('0x18'),auth[_0x0082('0x7')](),controller[_0x0082('0x19')]);router['post']('/',auth[_0x0082('0x7')](),controller[_0x0082('0x1a')]);router[_0x0082('0x1b')](_0x0082('0x1c'),auth[_0x0082('0x7')](),controller[_0x0082('0x1d')]);router[_0x0082('0x1b')]('/:id/teams',auth[_0x0082('0x7')](),controller['addTeams']);router[_0x0082('0x1b')](_0x0082('0x14'),auth[_0x0082('0x7')](),controller[_0x0082('0x1e')]);router[_0x0082('0x1b')](_0x0082('0x16'),auth[_0x0082('0x7')](),controller[_0x0082('0x1f')]);router[_0x0082('0x1b')](_0x0082('0x18'),auth['isAuthenticated'](),controller[_0x0082('0x20')]);router['put']('/:id',auth[_0x0082('0x7')](),controller['update']);router['delete'](_0x0082('0x9'),auth[_0x0082('0x7')](),controller[_0x0082('0x21')]);router['delete']('/:id/teams',auth[_0x0082('0x7')](),controller[_0x0082('0x22')]);router['delete'](_0x0082('0x14'),auth[_0x0082('0x7')](),controller[_0x0082('0x23')]);router[_0x0082('0x24')]('/:id/lists',auth['isAuthenticated'](),controller[_0x0082('0x25')]);router[_0x0082('0x24')]('/:id/blacklists',auth[_0x0082('0x7')](),controller[_0x0082('0x26')]);module[_0x0082('0x27')]=router; \ No newline at end of file +var _0x5987=['addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','exports','multer','util','path','express','Router','../../config/environment','./voiceQueue.controller','index','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','/:id/users','addAgents','addLists'];(function(_0x6648cc,_0x168f14){var _0x3d4fb3=function(_0x5e8137){while(--_0x5e8137){_0x6648cc['push'](_0x6648cc['shift']());}};_0x3d4fb3(++_0x168f14);}(_0x5987,0x13d));var _0x7598=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5987[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x7598('0x0'));var util=require(_0x7598('0x1'));var path=require(_0x7598('0x2'));var express=require(_0x7598('0x3'));var router=express[_0x7598('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7598('0x5'));var controller=require(_0x7598('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7598('0x7')]);router[_0x7598('0x8')](_0x7598('0x9'),auth[_0x7598('0xa')](),controller[_0x7598('0xb')]);router[_0x7598('0x8')](_0x7598('0xc'),auth[_0x7598('0xa')](),controller[_0x7598('0xd')]);router['get'](_0x7598('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0x7598('0xf'),auth['isAuthenticated'](),controller[_0x7598('0x10')]);router[_0x7598('0x8')](_0x7598('0x11'),auth['isAuthenticated'](),controller[_0x7598('0x12')]);router[_0x7598('0x8')](_0x7598('0x13'),auth[_0x7598('0xa')](),controller[_0x7598('0x14')]);router['get']('/:id/users',auth[_0x7598('0xa')](),controller[_0x7598('0x15')]);router[_0x7598('0x8')](_0x7598('0x16'),auth[_0x7598('0xa')](),controller[_0x7598('0x17')]);router[_0x7598('0x8')](_0x7598('0x18'),auth[_0x7598('0xa')](),controller[_0x7598('0x19')]);router[_0x7598('0x8')](_0x7598('0x1a'),auth[_0x7598('0xa')](),controller[_0x7598('0x1b')]);router[_0x7598('0x1c')]('/',auth[_0x7598('0xa')](),controller['create']);router['post'](_0x7598('0x1d'),auth[_0x7598('0xa')](),controller[_0x7598('0x1e')]);router[_0x7598('0x1c')](_0x7598('0x13'),auth[_0x7598('0xa')](),controller[_0x7598('0x1f')]);router[_0x7598('0x1c')](_0x7598('0x20'),auth['isAuthenticated'](),controller[_0x7598('0x21')]);router[_0x7598('0x1c')]('/:id/lists',auth[_0x7598('0xa')](),controller[_0x7598('0x22')]);router[_0x7598('0x1c')]('/:id/blacklists',auth[_0x7598('0xa')](),controller[_0x7598('0x23')]);router[_0x7598('0x24')](_0x7598('0x9'),auth['isAuthenticated'](),controller[_0x7598('0x25')]);router[_0x7598('0x26')](_0x7598('0x9'),auth[_0x7598('0xa')](),controller[_0x7598('0x27')]);router[_0x7598('0x26')](_0x7598('0x13'),auth[_0x7598('0xa')](),controller[_0x7598('0x28')]);router[_0x7598('0x26')]('/:id/users',auth[_0x7598('0xa')](),controller[_0x7598('0x29')]);router[_0x7598('0x26')](_0x7598('0x18'),auth['isAuthenticated'](),controller[_0x7598('0x2a')]);router['delete']('/:id/blacklists',auth[_0x7598('0xa')](),controller['removeBlackLists']);module[_0x7598('0x2b')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index cee2e0e..47ddda1 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','ENUM','inbound','default','leastrecent','random','rrmemory','wrandom','setDataValue','strategy','getDataValue','dialMethod'];(function(_0x4f0ac9,_0xf8844e){var _0x1d1f24=function(_0x4f1387){while(--_0x4f1387){_0x4f0ac9['push'](_0x4f0ac9['shift']());}};_0x1d1f24(++_0xf8844e);}(_0x7a54,0x106));var _0x47a5=function(_0x59b9fe,_0x20e4bb){_0x59b9fe=_0x59b9fe-0x0;var _0x21b928=_0x7a54[_0x59b9fe];return _0x21b928;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'name':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x47a5('0x4')},'musiconhold':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x5')},'announce':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x47a5('0x3')]('rr','ringall',_0x47a5('0x6'),'fewestcalls',_0x47a5('0x7'),_0x47a5('0x8'),'linear',_0x47a5('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x582352){this[_0x47a5('0xa')](_0x47a5('0xb'),_0x582352?_0x582352:'rrmemory');},'get':function(){var _0x2eb0dd=this['getDataValue']('type');var _0x1f47f4=this[_0x47a5('0xc')](_0x47a5('0xd'));var _0x250fad=this[_0x47a5('0xc')](_0x47a5('0xb'));if(_0x2eb0dd===_0x47a5('0x4')){return _0x250fad;}if(_0x1f47f4==='booked'&&_0x250fad===_0x47a5('0x8')||_0x1f47f4===_0x47a5('0xe')&&_0x250fad===_0x47a5('0xf')){return _0x250fad;}if(_0x1f47f4===_0x47a5('0x10')||_0x1f47f4===_0x47a5('0x11')||_0x1f47f4===_0x47a5('0x12')){return _0x250fad;}return null;}},'servicelevel':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x47a5('0x2')]},'weight':{'type':Sequelize[_0x47a5('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x47a5('0x14')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x47a5('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x47a5('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x47a5('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x47a5('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no',_0x47a5('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x47a5('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x47a5('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x47a5('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x47a5('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x47a5('0x2')]},'queue_quantity1':{'type':Sequelize[_0x47a5('0x2')]},'queue_quantity2':{'type':Sequelize[_0x47a5('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x47a5('0x2')]},'queue_less_than':{'type':Sequelize[_0x47a5('0x2')]},'periodic_announce':{'type':Sequelize[_0x47a5('0x17')],'set':function(_0x528582){this[_0x47a5('0xa')]('periodic_announce',_0x528582?_0x528582[_0x47a5('0x18')](','):[]);},'get':function(){return this[_0x47a5('0xc')](_0x47a5('0x19'))?this['getDataValue'](_0x47a5('0x19'))[_0x47a5('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x14'),'set':function(_0x51cc81){this['setDataValue'](_0x47a5('0x1b'),_0x51cc81?_0x51cc81[_0x47a5('0x18')](','):[]);},'get':function(){return this['getDataValue']('joinempty')?this[_0x47a5('0xc')](_0x47a5('0x1b'))['split'](','):[];}},'leavewhenempty':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'no','set':function(_0x53119b){this[_0x47a5('0xa')](_0x47a5('0x1c'),_0x53119b?_0x53119b['join'](','):[]);},'get':function(){return this['getDataValue'](_0x47a5('0x1c'))?this['getDataValue'](_0x47a5('0x1c'))[_0x47a5('0x1a')](','):[];}},'reportholdtime':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x47a5('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':0x0,'set':function(_0x3534cb){this[_0x47a5('0xa')](_0x47a5('0x1e'),_0x3534cb);if(_0x3534cb){if(this[_0x47a5('0xc')](_0x47a5('0x1f'))<0x2){this[_0x47a5('0xa')](_0x47a5('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x47a5('0x20')},'dialMethod':{'type':Sequelize[_0x47a5('0x3')]('preview',_0x47a5('0x10'),_0x47a5('0x12'),_0x47a5('0x11'),'booked'),'defaultValue':_0x47a5('0x10'),'comment':_0x47a5('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x47a5('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x47a5('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x47a5('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x47a5('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x26'),_0x47a5('0x27')),'defaultValue':_0x47a5('0x27'),'comment':_0x47a5('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x47a5('0x24')](0x2)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x47a5('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x47a5('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x47a5('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x47a5('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'tTxX','comment':_0x47a5('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x47a5('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x47a5('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0x3,'comment':_0x47a5('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)[_0x47a5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x47a5('0x33')},'dialTimezone':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x34')},'dialPrefix':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x35'),'never',_0x47a5('0x36')),'defaultValue':_0x47a5('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x47a5('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x47a5('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x47a5('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x47a5('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x47a5('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x47a5('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x47a5('0x13')](0x5)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x47a5('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x47a5('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x47a5('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x47a5('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x47a5('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x41'),_0x47a5('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x47a5('0x2')],'comment':_0x47a5('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x47a5('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x47a5('0x44')}}; \ No newline at end of file +var _0x7a54=['booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','ENUM','inbound','default','leastrecent','random','rrmemory','wrandom','setDataValue','strategy','getDataValue','dialMethod'];(function(_0x579042,_0x5a356f){var _0x3546af=function(_0x5a2689){while(--_0x5a2689){_0x579042['push'](_0x579042['shift']());}};_0x3546af(++_0x5a356f);}(_0x7a54,0x106));var _0x47a5=function(_0x4f3598,_0x1967cd){_0x4f3598=_0x4f3598-0x0;var _0xda8791=_0x7a54[_0x4f3598];return _0xda8791;};'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 884635e..ace7e87 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 _0x11d0=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','VoiceQueue','includeAll','include','findAll','catch','show','params','find','create','body','clone','get','omit','createdAt','getHoppers','findOne','CmHopper','rows','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','ids','Agents','union','addAgents','penalty','removeTeams','User','removeAgents','spread','push','upsert','format','%s/%s','SIP','voicePause','isArray','emit','userVoiceQueue:remove','realtime','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','from','phone\x20IS\x20NOT\x20NULL','insert','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','localhost','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd'];(function(_0x39f47b,_0x5bd88e){var _0x118b7a=function(_0x557a64){while(--_0x557a64){_0x39f47b['push'](_0x39f47b['shift']());}};_0x118b7a(++_0x5bd88e);}(_0x11d0,0xf4));var _0x011d=function(_0x532e54,_0x560399){_0x532e54=_0x532e54-0x0;var _0x3c62db=_0x11d0[_0x532e54];return _0x3c62db;};'use strict';var jsonpatch=require(_0x011d('0x0'));var rp=require(_0x011d('0x1'));var moment=require('moment');var BPromise=require(_0x011d('0x2'));var Mustache=require(_0x011d('0x3'));var util=require(_0x011d('0x4'));var path=require(_0x011d('0x5'));var sox=require(_0x011d('0x6'));var csv=require(_0x011d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x011d('0x8'));var squel=require(_0x011d('0x9'));var crypto=require('crypto');var jsforce=require(_0x011d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x011d('0x7'));var querystring=require(_0x011d('0xb'));var Papa=require(_0x011d('0xc'));var qs=require(_0x011d('0xd'));var logger=require(_0x011d('0xe'))(_0x011d('0xf'));var utils=require('../../config/utils');var config=require(_0x011d('0x10'));var db=require(_0x011d('0x11'))['db'];var socket=require('socket.io-emitter')({'host':_0x011d('0x12'),'port':0x18eb});require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x5ddf5f,_0x3f35a6){_0x3f35a6=_0x3f35a6||0xcc;return function(_0x5c2f7d){if(_0x5c2f7d){return _0x5ddf5f['sendStatus'](_0x3f35a6);}return _0x5ddf5f[_0x011d('0x13')](_0x3f35a6)[_0x011d('0x14')]();};}function respondWithResult(_0x4718a0,_0x5dfb2c){_0x5dfb2c=_0x5dfb2c||0xc8;return function(_0x2b21c3){if(_0x2b21c3){return _0x4718a0[_0x011d('0x13')](_0x5dfb2c)[_0x011d('0x15')](_0x2b21c3);}};}function respondWithFilteredResult(_0x6c9883,_0x426c0c){return function(_0x450651){if(_0x450651){var _0x5beb0c=_0x450651[_0x011d('0x16')],_0x9cebe4=_0x426c0c[_0x011d('0x17')],_0x3cf9f2=_0x426c0c[_0x011d('0x17')]+_0x426c0c['limit'],_0x56bbad;if(_0x3cf9f2>=_0x5beb0c){_0x3cf9f2=_0x5beb0c;_0x56bbad=0xc8;}else{_0x56bbad=0xce;}_0x6c9883[_0x011d('0x13')](_0x56bbad);return _0x6c9883['set'](_0x011d('0x18'),_0x9cebe4+'-'+_0x3cf9f2+'/'+_0x5beb0c)['json'](_0x450651);}return null;};}function patchUpdates(_0x76b151){return function(_0x4499a7){try{jsonpatch[_0x011d('0x19')](_0x4499a7,_0x76b151,!![]);}catch(_0x492c30){return BPromise[_0x011d('0x1a')](_0x492c30);}return _0x4499a7[_0x011d('0x1b')]();};}function saveUpdates(_0x43b87b,_0xc1cea6){return function(_0x1772ca){if(_0x1772ca){return _0x1772ca[_0x011d('0x1c')](_0x43b87b)[_0x011d('0x1d')](function(_0x5d07b8){return _0x5d07b8;});}return null;};}function removeEntity(_0x2f779c,_0x3a33b7){return function(_0x37a29a){if(_0x37a29a){return _0x37a29a[_0x011d('0x1e')]()['then'](function(){_0x2f779c[_0x011d('0x13')](0xcc)[_0x011d('0x14')]();});}};}function handleEntityNotFound(_0x5489ff,_0x478f15){return function(_0x22ef23){if(!_0x22ef23){_0x5489ff[_0x011d('0x1f')](0x194);}return _0x22ef23;};}function handleError(_0x2aecbe,_0x3daf51){_0x3daf51=_0x3daf51||0x1f4;return function(_0xef770c){logger[_0x011d('0x20')](_0xef770c['stack']);if(_0xef770c[_0x011d('0x21')]){delete _0xef770c['name'];}_0x2aecbe[_0x011d('0x13')](_0x3daf51)[_0x011d('0x22')](_0xef770c);};}exports[_0x011d('0x23')]=function(_0x5cd847,_0x57abfe){var _0x468640={},_0x19bbff={},_0x4abd1b={'count':0x0,'rows':[]};var _0x2f7cc2=db['VoiceQueue'][_0x011d('0x24')];_0x19bbff[_0x011d('0x25')]=_[_0x011d('0x26')](_0x2f7cc2);var _0x20358a={'dateStart':_0x5cd847[_0x011d('0x27')][_0x011d('0x28')],'dateEnd':_0x5cd847['query'][_0x011d('0x29')]};delete _0x5cd847['query'][_0x011d('0x28')];delete _0x5cd847[_0x011d('0x27')][_0x011d('0x29')];_0x19bbff['query']=_['keys'](_0x5cd847[_0x011d('0x27')]);_0x19bbff[_0x011d('0x2a')]=_['intersection'](_0x19bbff[_0x011d('0x25')],_0x19bbff[_0x011d('0x27')]);_0x468640[_0x011d('0x2b')]=_[_0x011d('0x2c')](_0x19bbff[_0x011d('0x25')],qs[_0x011d('0x2d')](_0x5cd847[_0x011d('0x27')][_0x011d('0x2d')]));_0x468640['attributes']=_0x468640[_0x011d('0x2b')][_0x011d('0x2e')]?_0x468640['attributes']:_0x19bbff['model'];if(!_0x5cd847[_0x011d('0x27')][_0x011d('0x2f')](_0x011d('0x30'))){_0x468640[_0x011d('0x31')]=qs[_0x011d('0x31')](_0x5cd847[_0x011d('0x27')][_0x011d('0x31')]);_0x468640[_0x011d('0x17')]=qs[_0x011d('0x17')](_0x5cd847['query'][_0x011d('0x17')]);}_0x468640[_0x011d('0x32')]=qs[_0x011d('0x33')](_0x5cd847[_0x011d('0x27')]['sort']);_0x468640[_0x011d('0x34')]=qs[_0x011d('0x2a')](_[_0x011d('0x35')](_0x5cd847[_0x011d('0x27')],_0x19bbff[_0x011d('0x2a')]));if(_0x20358a['dateStart']){if(_0x20358a['dateEnd']){_0x20358a[_0x011d('0x29')]=moment(_0x20358a[_0x011d('0x29')])[_0x011d('0x36')](0x1,_0x011d('0x37'));}else{_0x20358a[_0x011d('0x29')]=moment(_0x20358a[_0x011d('0x28')])[_0x011d('0x36')](0x1,_0x011d('0x37'));}_[_0x011d('0x38')](_0x468640[_0x011d('0x34')],{'createdAt':{'$gte':_0x20358a[_0x011d('0x28')],'$lte':_0x20358a['dateEnd']}});}if(_0x5cd847[_0x011d('0x27')][_0x011d('0x39')]){_0x468640[_0x011d('0x34')]=_[_0x011d('0x38')](_0x468640[_0x011d('0x34')],{'$or':_[_0x011d('0x3a')](_0x468640[_0x011d('0x2b')],function(_0x59e1ed){var _0x1aeb8e={};_0x1aeb8e[_0x59e1ed]={'$like':'%'+_0x5cd847['query']['filter']+'%'};return _0x1aeb8e;})});}_0x468640=_[_0x011d('0x38')]({},_0x468640,_0x5cd847[_0x011d('0x3b')]);var _0x49bda5={'where':_0x468640[_0x011d('0x34')]};return db[_0x011d('0x3c')][_0x011d('0x16')](_0x49bda5)['then'](function(_0x20034f){_0x4abd1b['count']=_0x20034f;if(_0x5cd847[_0x011d('0x27')][_0x011d('0x3d')]){_0x468640[_0x011d('0x3e')]=[{'all':!![]}];}return db[_0x011d('0x3c')][_0x011d('0x3f')](_0x468640);})[_0x011d('0x1d')](function(_0x23b53e){_0x4abd1b['rows']=_0x23b53e;return _0x4abd1b;})[_0x011d('0x1d')](respondWithFilteredResult(_0x57abfe,_0x468640))[_0x011d('0x40')](handleError(_0x57abfe,null));};exports[_0x011d('0x41')]=function(_0x40bd9b,_0x18acdd){var _0x21e5e2={'raw':![],'where':{'id':_0x40bd9b[_0x011d('0x42')]['id']}},_0x5533aa={};_0x5533aa[_0x011d('0x25')]=_[_0x011d('0x26')](db[_0x011d('0x3c')]['rawAttributes']);_0x5533aa[_0x011d('0x27')]=_[_0x011d('0x26')](_0x40bd9b[_0x011d('0x27')]);_0x5533aa[_0x011d('0x2a')]=_[_0x011d('0x2c')](_0x5533aa['model'],_0x5533aa[_0x011d('0x27')]);_0x21e5e2[_0x011d('0x2b')]=_[_0x011d('0x2c')](_0x5533aa[_0x011d('0x25')],qs[_0x011d('0x2d')](_0x40bd9b[_0x011d('0x27')][_0x011d('0x2d')]));_0x21e5e2[_0x011d('0x2b')]=_0x21e5e2[_0x011d('0x2b')][_0x011d('0x2e')]?_0x21e5e2[_0x011d('0x2b')]:_0x5533aa[_0x011d('0x25')];if(_0x40bd9b[_0x011d('0x27')][_0x011d('0x3d')]){_0x21e5e2[_0x011d('0x3e')]=[{'all':!![]}];}_0x21e5e2=_[_0x011d('0x38')]({},_0x21e5e2,_0x40bd9b['options']);return db[_0x011d('0x3c')][_0x011d('0x43')](_0x21e5e2)[_0x011d('0x1d')](handleEntityNotFound(_0x18acdd,null))['then'](respondWithResult(_0x18acdd,null))[_0x011d('0x40')](handleError(_0x18acdd,null));};exports[_0x011d('0x44')]=function(_0x458dae,_0x50cd8d){return db[_0x011d('0x3c')][_0x011d('0x44')](_0x458dae[_0x011d('0x45')],{})['then'](respondWithResult(_0x50cd8d,0xc9))[_0x011d('0x40')](handleError(_0x50cd8d,null));};exports[_0x011d('0x46')]=function(_0x5a71a5,_0x20962d){var _0x4dcedd={'raw':![],'where':{'id':_0x5a71a5['params']['id']}},_0x157507={};_0x157507[_0x011d('0x25')]=_[_0x011d('0x26')](db[_0x011d('0x3c')][_0x011d('0x24')]);_0x4dcedd[_0x011d('0x2b')]=_[_0x011d('0x2c')](_0x157507[_0x011d('0x25')],qs[_0x011d('0x2d')](_0x5a71a5[_0x011d('0x27')][_0x011d('0x2d')]));_0x4dcedd[_0x011d('0x2b')]=_0x4dcedd['attributes']['length']?_0x4dcedd['attributes']:_0x157507[_0x011d('0x25')];if(_0x5a71a5[_0x011d('0x27')][_0x011d('0x3d')]){_0x4dcedd[_0x011d('0x3e')]=[{'all':!![]}];}_0x4dcedd=_[_0x011d('0x38')]({},_0x4dcedd,_0x5a71a5['options']);return db[_0x011d('0x3c')]['find'](_0x4dcedd)[_0x011d('0x1d')](handleEntityNotFound(_0x20962d,null))[_0x011d('0x1d')](function(_0x199a88){if(_0x199a88){var _0x523a35=_0x199a88[_0x011d('0x47')]({'plain':!![]});_0x523a35=qs[_0x011d('0x48')](_0x523a35,['id','createdAt','updatedAt']);_0x5a71a5[_0x011d('0x45')]=_[_0x011d('0x48')](_0x5a71a5['body'],['id',_0x011d('0x49'),'updatedAt']);return db[_0x011d('0x3c')][_0x011d('0x44')](_[_0x011d('0x38')](_0x523a35,_0x5a71a5[_0x011d('0x45')]),{'include':_0x5a71a5[_0x011d('0x27')][_0x011d('0x3d')]?[{'all':!![]}]:undefined});}})[_0x011d('0x1d')](respondWithResult(_0x20962d,0xc9))[_0x011d('0x40')](handleError(_0x20962d,null));};exports[_0x011d('0x1c')]=function(_0x2baa01,_0x22c0b1){if(_0x2baa01[_0x011d('0x45')]['id']){delete _0x2baa01[_0x011d('0x45')]['id'];}return db['VoiceQueue'][_0x011d('0x43')]({'where':{'id':_0x2baa01['params']['id']}})['then'](handleEntityNotFound(_0x22c0b1,null))['then'](saveUpdates(_0x2baa01['body'],null))[_0x011d('0x1d')](respondWithResult(_0x22c0b1,null))[_0x011d('0x40')](handleError(_0x22c0b1,null));};exports[_0x011d('0x1e')]=function(_0x2025c8,_0x432ca5){return db['VoiceQueue'][_0x011d('0x43')]({'where':{'id':_0x2025c8[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x432ca5,null))['then'](removeEntity(_0x432ca5,null))[_0x011d('0x40')](handleError(_0x432ca5,null));};exports[_0x011d('0x4a')]=function(_0x2b26c9,_0x21518d,_0x106371){var _0x7ece0f={'raw':![],'where':{}};var _0x1f7cdc={};var _0x238c3f={'count':0x0,'rows':[]};return db[_0x011d('0x3c')][_0x011d('0x4b')]({'where':{'id':_0x2b26c9[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x21518d,null))[_0x011d('0x1d')](function(_0x3f8c02){if(_0x3f8c02){_0x1f7cdc[_0x011d('0x25')]=_[_0x011d('0x26')](db[_0x011d('0x4c')]['rawAttributes']);_0x1f7cdc[_0x011d('0x27')]=_['keys'](_0x2b26c9[_0x011d('0x27')]);_0x1f7cdc[_0x011d('0x2a')]=_[_0x011d('0x2c')](_0x1f7cdc['model'],_0x1f7cdc[_0x011d('0x27')]);_0x7ece0f[_0x011d('0x2b')]=_[_0x011d('0x2c')](_0x1f7cdc[_0x011d('0x25')],qs[_0x011d('0x2d')](_0x2b26c9['query']['fields']));_0x7ece0f[_0x011d('0x2b')]=_0x7ece0f[_0x011d('0x2b')][_0x011d('0x2e')]?_0x7ece0f[_0x011d('0x2b')]:_0x1f7cdc[_0x011d('0x25')];if(!_0x2b26c9['query'][_0x011d('0x2f')](_0x011d('0x30'))){_0x7ece0f[_0x011d('0x31')]=qs[_0x011d('0x31')](_0x2b26c9[_0x011d('0x27')][_0x011d('0x31')]);_0x7ece0f['offset']=qs['offset'](_0x2b26c9['query']['offset']);}_0x7ece0f[_0x011d('0x32')]=qs[_0x011d('0x33')](_0x2b26c9['query']['sort']);_0x7ece0f[_0x011d('0x34')]=qs[_0x011d('0x2a')](_[_0x011d('0x35')](_0x2b26c9[_0x011d('0x27')],_0x1f7cdc[_0x011d('0x2a')]));_0x7ece0f[_0x011d('0x34')]['VoiceQueueId']=_0x3f8c02['id'];if(_0x2b26c9[_0x011d('0x27')]['filter']){_0x7ece0f['where']=_[_0x011d('0x38')](_0x7ece0f['where'],{'$or':_[_0x011d('0x3a')](_0x7ece0f[_0x011d('0x2b')],function(_0x4a75b6){var _0x3f4f66={};_0x3f4f66[_0x4a75b6]={'$like':'%'+_0x2b26c9['query'][_0x011d('0x39')]+'%'};return _0x3f4f66;})});}_0x7ece0f=_[_0x011d('0x38')]({},_0x7ece0f,_0x2b26c9[_0x011d('0x3b')]);return db[_0x011d('0x4c')][_0x011d('0x16')]({'where':_0x7ece0f[_0x011d('0x34')]})[_0x011d('0x1d')](function(_0x3b5b99){_0x238c3f[_0x011d('0x16')]=_0x3b5b99;if(_0x2b26c9[_0x011d('0x27')][_0x011d('0x3d')]){_0x7ece0f[_0x011d('0x3e')]=[{'all':!![]}];}return db[_0x011d('0x4c')][_0x011d('0x3f')](_0x7ece0f);})[_0x011d('0x1d')](function(_0x23b3f4){_0x238c3f[_0x011d('0x4d')]=_0x23b3f4;return _0x238c3f;});}})[_0x011d('0x1d')](respondWithFilteredResult(_0x21518d,_0x7ece0f))['catch'](handleError(_0x21518d,null));};exports['getHopperHistories']=function(_0x2cff8e,_0x1fc920,_0x3345b9){var _0x120b25={'raw':!![],'where':{}};var _0x32826b={};var _0x399133={'count':0x0,'rows':[]};return db[_0x011d('0x3c')][_0x011d('0x4b')]({'where':{'id':_0x2cff8e[_0x011d('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fc920,null))['then'](function(_0x2b0ebc){if(_0x2b0ebc){_0x32826b[_0x011d('0x25')]=_['keys'](db['CmHopperHistory'][_0x011d('0x24')]);_0x32826b[_0x011d('0x27')]=_[_0x011d('0x26')](_0x2cff8e[_0x011d('0x27')]);_0x32826b[_0x011d('0x2a')]=_[_0x011d('0x2c')](_0x32826b[_0x011d('0x25')],_0x32826b[_0x011d('0x27')]);_0x120b25['attributes']=_['intersection'](_0x32826b[_0x011d('0x25')],qs[_0x011d('0x2d')](_0x2cff8e['query'][_0x011d('0x2d')]));_0x120b25[_0x011d('0x2b')]=_0x120b25[_0x011d('0x2b')]['length']?_0x120b25[_0x011d('0x2b')]:_0x32826b[_0x011d('0x25')];if(!_0x2cff8e[_0x011d('0x27')][_0x011d('0x2f')]('nolimit')){_0x120b25[_0x011d('0x31')]=qs['limit'](_0x2cff8e[_0x011d('0x27')][_0x011d('0x31')]);_0x120b25[_0x011d('0x17')]=qs[_0x011d('0x17')](_0x2cff8e[_0x011d('0x27')][_0x011d('0x17')]);}_0x120b25[_0x011d('0x32')]=qs[_0x011d('0x33')](_0x2cff8e[_0x011d('0x27')]['sort']);_0x120b25[_0x011d('0x34')]=qs[_0x011d('0x2a')](_[_0x011d('0x35')](_0x2cff8e['query'],_0x32826b['filters']));_0x120b25[_0x011d('0x34')][_0x011d('0x4e')]=_0x2b0ebc['id'];if(_0x2cff8e[_0x011d('0x27')][_0x011d('0x39')]){_0x120b25[_0x011d('0x34')]=_[_0x011d('0x38')](_0x120b25[_0x011d('0x34')],{'$or':_['map'](_0x120b25[_0x011d('0x2b')],function(_0x5a5828){var _0x4a8aa1={};_0x4a8aa1[_0x5a5828]={'$like':'%'+_0x2cff8e['query'][_0x011d('0x39')]+'%'};return _0x4a8aa1;})});}_0x120b25=_['merge']({},_0x120b25,_0x2cff8e[_0x011d('0x3b')]);return db[_0x011d('0x4f')]['count']({'where':_0x120b25[_0x011d('0x34')]})[_0x011d('0x1d')](function(_0xf36cb9){_0x399133['count']=_0xf36cb9;if(_0x2cff8e[_0x011d('0x27')][_0x011d('0x3d')]){_0x120b25[_0x011d('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x120b25);})[_0x011d('0x1d')](function(_0x469f56){_0x399133[_0x011d('0x4d')]=_0x469f56;return _0x399133;});}})[_0x011d('0x1d')](respondWithFilteredResult(_0x1fc920,_0x120b25))[_0x011d('0x40')](handleError(_0x1fc920,null));};exports[_0x011d('0x50')]=function(_0x19f6e1,_0x4b03b3,_0x71e1){var _0x4624cf={'raw':!![],'where':{}};var _0x379097={};var _0x5591ce={'count':0x0,'rows':[]};return db[_0x011d('0x3c')][_0x011d('0x4b')]({'where':{'id':_0x19f6e1['params']['id']}})['then'](handleEntityNotFound(_0x4b03b3,null))['then'](function(_0x3f54f3){if(_0x3f54f3){_0x379097[_0x011d('0x25')]=_[_0x011d('0x26')](db['CmHopperFinal'][_0x011d('0x24')]);_0x379097[_0x011d('0x27')]=_[_0x011d('0x26')](_0x19f6e1[_0x011d('0x27')]);_0x379097[_0x011d('0x2a')]=_[_0x011d('0x2c')](_0x379097[_0x011d('0x25')],_0x379097[_0x011d('0x27')]);_0x4624cf['attributes']=_[_0x011d('0x2c')](_0x379097['model'],qs['fields'](_0x19f6e1[_0x011d('0x27')][_0x011d('0x2d')]));_0x4624cf[_0x011d('0x2b')]=_0x4624cf[_0x011d('0x2b')]['length']?_0x4624cf[_0x011d('0x2b')]:_0x379097['model'];if(!_0x19f6e1[_0x011d('0x27')]['hasOwnProperty'](_0x011d('0x30'))){_0x4624cf[_0x011d('0x31')]=qs[_0x011d('0x31')](_0x19f6e1[_0x011d('0x27')][_0x011d('0x31')]);_0x4624cf['offset']=qs[_0x011d('0x17')](_0x19f6e1[_0x011d('0x27')][_0x011d('0x17')]);}_0x4624cf[_0x011d('0x32')]=qs['sort'](_0x19f6e1[_0x011d('0x27')][_0x011d('0x33')]);_0x4624cf[_0x011d('0x34')]=qs['filters'](_[_0x011d('0x35')](_0x19f6e1[_0x011d('0x27')],_0x379097[_0x011d('0x2a')]));_0x4624cf[_0x011d('0x34')]['VoiceQueueId']=_0x3f54f3['id'];if(_0x19f6e1[_0x011d('0x27')][_0x011d('0x39')]){_0x4624cf[_0x011d('0x34')]=_[_0x011d('0x38')](_0x4624cf[_0x011d('0x34')],{'$or':_[_0x011d('0x3a')](_0x4624cf['attributes'],function(_0x37d565){var _0x3ebc21={};_0x3ebc21[_0x37d565]={'$like':'%'+_0x19f6e1[_0x011d('0x27')][_0x011d('0x39')]+'%'};return _0x3ebc21;})});}_0x4624cf=_['merge']({},_0x4624cf,_0x19f6e1[_0x011d('0x3b')]);return db[_0x011d('0x51')][_0x011d('0x16')]({'where':_0x4624cf[_0x011d('0x34')]})['then'](function(_0x312810){_0x5591ce[_0x011d('0x16')]=_0x312810;if(_0x19f6e1[_0x011d('0x27')][_0x011d('0x3d')]){_0x4624cf[_0x011d('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4624cf);})[_0x011d('0x1d')](function(_0x583512){_0x5591ce[_0x011d('0x4d')]=_0x583512;return _0x5591ce;});}})[_0x011d('0x1d')](respondWithFilteredResult(_0x4b03b3,_0x4624cf))[_0x011d('0x40')](handleError(_0x4b03b3,null));};exports[_0x011d('0x52')]=function(_0x2f6bdb,_0x3bc824,_0x48e753){var _0x4437a5={'raw':!![],'where':{}};var _0x21f53b={};var _0x592a88={'count':0x0,'rows':[]};return db[_0x011d('0x3c')][_0x011d('0x4b')]({'where':{'id':_0x2f6bdb[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x3bc824,null))[_0x011d('0x1d')](function(_0x85b593){if(_0x85b593){_0x21f53b[_0x011d('0x25')]=_['keys'](db[_0x011d('0x53')][_0x011d('0x24')]);_0x21f53b[_0x011d('0x27')]=_[_0x011d('0x26')](_0x2f6bdb['query']);_0x21f53b['filters']=_[_0x011d('0x2c')](_0x21f53b[_0x011d('0x25')],_0x21f53b[_0x011d('0x27')]);_0x4437a5['attributes']=_[_0x011d('0x2c')](_0x21f53b[_0x011d('0x25')],qs['fields'](_0x2f6bdb['query'][_0x011d('0x2d')]));_0x4437a5['attributes']=_0x4437a5[_0x011d('0x2b')][_0x011d('0x2e')]?_0x4437a5[_0x011d('0x2b')]:_0x21f53b[_0x011d('0x25')];if(!_0x2f6bdb[_0x011d('0x27')]['hasOwnProperty'](_0x011d('0x30'))){_0x4437a5[_0x011d('0x31')]=qs['limit'](_0x2f6bdb[_0x011d('0x27')]['limit']);_0x4437a5[_0x011d('0x17')]=qs[_0x011d('0x17')](_0x2f6bdb[_0x011d('0x27')][_0x011d('0x17')]);}_0x4437a5[_0x011d('0x32')]=qs[_0x011d('0x33')](_0x2f6bdb[_0x011d('0x27')][_0x011d('0x33')]);_0x4437a5[_0x011d('0x34')]=qs[_0x011d('0x2a')](_['pick'](_0x2f6bdb['query'],_0x21f53b[_0x011d('0x2a')]));_0x4437a5[_0x011d('0x34')][_0x011d('0x4e')]=_0x85b593['id'];if(_0x2f6bdb[_0x011d('0x27')][_0x011d('0x39')]){_0x4437a5[_0x011d('0x34')]=_[_0x011d('0x38')](_0x4437a5['where'],{'$or':_[_0x011d('0x3a')](_0x4437a5[_0x011d('0x2b')],function(_0x4f20ff){var _0x102fcf={};_0x102fcf[_0x4f20ff]={'$like':'%'+_0x2f6bdb[_0x011d('0x27')][_0x011d('0x39')]+'%'};return _0x102fcf;})});}_0x4437a5=_[_0x011d('0x38')]({},_0x4437a5,_0x2f6bdb[_0x011d('0x3b')]);return db[_0x011d('0x53')]['count']({'where':_0x4437a5['where']})['then'](function(_0x34207a){_0x592a88['count']=_0x34207a;if(_0x2f6bdb['query'][_0x011d('0x3d')]){_0x4437a5[_0x011d('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4437a5);})['then'](function(_0x4f5750){_0x592a88[_0x011d('0x4d')]=_0x4f5750;return _0x592a88;});}})['then'](respondWithFilteredResult(_0x3bc824,_0x4437a5))[_0x011d('0x40')](handleError(_0x3bc824,null));};exports[_0x011d('0x54')]=function(_0x3bd5af,_0x1d2760,_0x1d3023){var _0x2e3c14={};var _0x1f201a={};var _0x44f1cd;var _0x28f82b;return db['VoiceQueue']['findOne']({'where':{'id':_0x3bd5af['params']['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x1d2760,null))['then'](function(_0x41c8ac){if(_0x41c8ac){_0x44f1cd=_0x41c8ac;_0x1f201a[_0x011d('0x25')]=_[_0x011d('0x26')](db[_0x011d('0x55')][_0x011d('0x24')]);_0x1f201a['query']=_['keys'](_0x3bd5af[_0x011d('0x27')]);_0x1f201a[_0x011d('0x2a')]=_[_0x011d('0x2c')](_0x1f201a[_0x011d('0x25')],_0x1f201a[_0x011d('0x27')]);_0x2e3c14['attributes']=_[_0x011d('0x2c')](_0x1f201a[_0x011d('0x25')],qs[_0x011d('0x2d')](_0x3bd5af[_0x011d('0x27')][_0x011d('0x2d')]));_0x2e3c14[_0x011d('0x2b')]=_0x2e3c14['attributes']['length']?_0x2e3c14[_0x011d('0x2b')]:_0x1f201a[_0x011d('0x25')];_0x2e3c14[_0x011d('0x32')]=qs['sort'](_0x3bd5af[_0x011d('0x27')][_0x011d('0x33')]);_0x2e3c14['where']=qs[_0x011d('0x2a')](_['pick'](_0x3bd5af['query'],_0x1f201a[_0x011d('0x2a')]));if(_0x3bd5af['query'][_0x011d('0x39')]){_0x2e3c14[_0x011d('0x34')]=_[_0x011d('0x38')](_0x2e3c14[_0x011d('0x34')],{'$or':_[_0x011d('0x3a')](_0x2e3c14[_0x011d('0x2b')],function(_0x19963f){var _0x13b76f={};_0x13b76f[_0x19963f]={'$like':'%'+_0x3bd5af[_0x011d('0x27')][_0x011d('0x39')]+'%'};return _0x13b76f;})});}_0x2e3c14=_[_0x011d('0x38')]({},_0x2e3c14,_0x3bd5af[_0x011d('0x3b')]);return _0x44f1cd[_0x011d('0x54')](_0x2e3c14);}})['then'](function(_0x405e6d){if(_0x405e6d){_0x28f82b=_0x405e6d['length'];if(!_0x3bd5af['query'][_0x011d('0x2f')]('nolimit')){_0x2e3c14[_0x011d('0x31')]=qs['limit'](_0x3bd5af[_0x011d('0x27')]['limit']);_0x2e3c14[_0x011d('0x17')]=qs['offset'](_0x3bd5af[_0x011d('0x27')][_0x011d('0x17')]);}return _0x44f1cd['getTeams'](_0x2e3c14);}})['then'](function(_0x1c4508){if(_0x1c4508){return _0x1c4508?{'count':_0x28f82b,'rows':_0x1c4508}:null;}})['then'](respondWithResult(_0x1d2760,null))[_0x011d('0x40')](handleError(_0x1d2760,null));};exports[_0x011d('0x56')]=function(_0x4bae97,_0x5ed473,_0x4a04eb){var _0x2c9e12=[];var _0x21a941;return db[_0x011d('0x55')][_0x011d('0x3f')]({'where':{'id':_0x4bae97['body'][_0x011d('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x011d('0x1d')](function(_0x27c9f5){if(_0x27c9f5){for(var _0xb02312=0x0;_0xb02312<_0x27c9f5[_0x011d('0x2e')];_0xb02312+=0x1){for(var _0x5f519b=0x0;_0x5f519b<_0x27c9f5[_0xb02312][_0x011d('0x58')][_0x011d('0x2e')];_0x5f519b+=0x1){_0x2c9e12=_[_0x011d('0x59')](_0x2c9e12,[_0x27c9f5[_0xb02312]['Agents'][_0x5f519b]['id']]);}}return _0x2c9e12;}})[_0x011d('0x1d')](function(_0x629b1a){if(_0x629b1a){return db[_0x011d('0x3c')]['find']({'where':{'id':_0x4bae97[_0x011d('0x42')]['id']}});}})[_0x011d('0x1d')](function(_0x4c03a8){if(_0x4c03a8){_0x21a941=_0x4c03a8;return _0x21a941[_0x011d('0x5a')](_0x2c9e12,{'penalty':_0x4bae97[_0x011d('0x45')][_0x011d('0x5b')]});}})[_0x011d('0x1d')](function(_0xd165c9){if(_0xd165c9){return _0x21a941[_0x011d('0x56')](_0x4bae97['body'][_0x011d('0x57')]);}})[_0x011d('0x1d')](handleEntityNotFound(_0x5ed473,null))[_0x011d('0x1d')](respondWithStatusCode(_0x5ed473,null))[_0x011d('0x40')](handleError(_0x5ed473,null));};exports[_0x011d('0x5c')]=function(_0x40796b,_0x334321,_0x29b5b9){var _0x5a5af0=[];var _0x3cfbfa;return db[_0x011d('0x55')][_0x011d('0x3f')]({'where':{'id':_0x40796b['query'][_0x011d('0x57')]},'attributes':['id'],'include':[{'model':db[_0x011d('0x5d')],'as':_0x011d('0x58'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x31896d){if(_0x31896d){for(var _0x2592fa=0x0;_0x2592fa<_0x31896d[_0x011d('0x2e')];_0x2592fa+=0x1){for(var _0x19bb13=0x0;_0x19bb13<_0x31896d[_0x2592fa]['Agents']['length'];_0x19bb13+=0x1){_0x5a5af0=_['union'](_0x5a5af0,[_0x31896d[_0x2592fa][_0x011d('0x58')][_0x19bb13]['id']]);}}return _0x5a5af0;}})[_0x011d('0x1d')](function(_0x589024){if(_0x589024){return db[_0x011d('0x3c')][_0x011d('0x43')]({'where':{'id':_0x40796b[_0x011d('0x42')]['id']}});}})[_0x011d('0x1d')](function(_0x5bbdfb){if(_0x5bbdfb){_0x3cfbfa=_0x5bbdfb;return _0x3cfbfa[_0x011d('0x5e')](_0x5a5af0);}})[_0x011d('0x1d')](function(_0x4eef92){if(_0x3cfbfa){return _0x3cfbfa[_0x011d('0x5c')](_0x40796b[_0x011d('0x27')]['ids']);}})[_0x011d('0x1d')](handleEntityNotFound(_0x334321,null))[_0x011d('0x1d')](respondWithStatusCode(_0x334321,null))[_0x011d('0x40')](handleError(_0x334321,null));};exports[_0x011d('0x5a')]=function(_0x2a2735,_0xd68a94,_0x2da748){var _0x182980,_0x459581;return db[_0x011d('0x3c')][_0x011d('0x43')]({'where':{'id':_0x2a2735[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0xd68a94,null))[_0x011d('0x1d')](function(_0x439520){if(_0x439520){_0x459581=_0x439520;return _0x439520[_0x011d('0x5a')](_0x2a2735['body'][_0x011d('0x57')],_['omit'](_0x2a2735[_0x011d('0x45')],[_0x011d('0x57'),'id'])||{})[_0x011d('0x5f')](function(_0x427131){for(var _0x2a1b6b=0x0;_0x2a1b6b<_0x2a2735[_0x011d('0x45')][_0x011d('0x57')][_0x011d('0x2e')];_0x2a1b6b+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x2a2735[_0x011d('0x45')][_0x011d('0x57')][_0x2a1b6b],'VoiceQueueId':_0x2a2735[_0x011d('0x42')]['id']});}return _0x427131;});}})[_0x011d('0x1d')](function(_0x16bdcb){_0x182980=_0x16bdcb||[];if(_0x459581){return db['User']['findAll']({'where':{'id':_0x2a2735['body'][_0x011d('0x57')]},'attributes':['id',_0x011d('0x21'),'loginInPause','voicePause'],'raw':!![]});}})[_0x011d('0x1d')](function(_0x56f9da){if(_0x56f9da&&_0x56f9da[_0x011d('0x2e')]){var _0x57141b=[];for(var _0xc3260c=0x0;_0xc3260c<_0x56f9da[_0x011d('0x2e')];_0xc3260c++){_0x57141b[_0x011d('0x60')](db['UserVoiceQueueRt'][_0x011d('0x61')]({'membername':_0x56f9da[_0xc3260c][_0x011d('0x21')],'UserId':_0x56f9da[_0xc3260c]['id'],'queue_name':_0x459581[_0x011d('0x21')],'VoiceQueueId':_0x459581['id'],'interface':util[_0x011d('0x62')](_0x011d('0x63'),_0x011d('0x64'),_0x56f9da[_0xc3260c][_0x011d('0x21')]),'paused':_0x56f9da[_0xc3260c][_0x011d('0x65')]||![],'penalty':_0x2a2735[_0x011d('0x45')][_0x011d('0x5b')]||0x0}));}return BPromise['all'](_0x57141b);}})[_0x011d('0x1d')](function(_0x57da56){return _0x182980;})[_0x011d('0x1d')](respondWithResult(_0xd68a94,null))[_0x011d('0x40')](handleError(_0xd68a94,null));};exports[_0x011d('0x5e')]=function(_0x599fab,_0x2a8c78,_0x354a70){var _0x3d9e03;return db['VoiceQueue'][_0x011d('0x43')]({'where':{'id':_0x599fab[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x2a8c78,null))[_0x011d('0x1d')](function(_0x51937e){if(_0x51937e){return _0x51937e[_0x011d('0x5e')](_0x599fab[_0x011d('0x27')]['ids'])['then'](function(_0x105126){if(_[_0x011d('0x66')](_0x599fab[_0x011d('0x27')][_0x011d('0x57')])){for(var _0x1f0ab0=0x0;_0x1f0ab0<_0x599fab['query']['ids'][_0x011d('0x2e')];_0x1f0ab0+=0x1){socket[_0x011d('0x67')](_0x011d('0x68'),{'UserId':_0x599fab[_0x011d('0x27')][_0x011d('0x57')][_0x1f0ab0],'VoiceQueueId':_0x599fab['params']['id']});}}else{socket[_0x011d('0x67')](_0x011d('0x68'),{'UserId':_0x599fab[_0x011d('0x27')][_0x011d('0x57')],'VoiceQueueId':_0x599fab[_0x011d('0x42')]['id']});}});}})[_0x011d('0x1d')](function(_0x48c0df){if(_0x599fab[_0x011d('0x27')][_0x011d('0x69')]){_0x3d9e03=_0x48c0df;return db[_0x011d('0x6a')][_0x011d('0x1e')]({'where':{'VoiceQueueId':_0x599fab[_0x011d('0x42')]['id'],'UserId':_0x599fab[_0x011d('0x27')]['ids']}})['then'](function(){return _0x3d9e03;});}})[_0x011d('0x1d')](respondWithStatusCode(_0x2a8c78,null))[_0x011d('0x40')](handleError(_0x2a8c78,null));};exports[_0x011d('0x6b')]=function(_0x502e0d,_0xcf4fce,_0x427df7){var _0x16711a={};var _0x3e12eb={};var _0x52e377;var _0x546670;return db['VoiceQueue']['findOne']({'where':{'id':_0x502e0d['params']['id']}})['then'](handleEntityNotFound(_0xcf4fce,null))[_0x011d('0x1d')](function(_0x39f12e){if(_0x39f12e){_0x52e377=_0x39f12e;_0x3e12eb[_0x011d('0x25')]=_[_0x011d('0x26')](db[_0x011d('0x5d')][_0x011d('0x24')]);_0x3e12eb['query']=_[_0x011d('0x26')](_0x502e0d[_0x011d('0x27')]);_0x3e12eb['filters']=_['intersection'](_0x3e12eb[_0x011d('0x25')],_0x3e12eb[_0x011d('0x27')]);_0x16711a[_0x011d('0x2b')]=_[_0x011d('0x2c')](_0x3e12eb['model'],qs[_0x011d('0x2d')](_0x502e0d[_0x011d('0x27')][_0x011d('0x2d')]));_0x16711a[_0x011d('0x2b')]=_0x16711a['attributes']['length']?_0x16711a['attributes']:_0x3e12eb[_0x011d('0x25')];_0x16711a[_0x011d('0x32')]=qs['sort'](_0x502e0d[_0x011d('0x27')][_0x011d('0x33')]);_0x16711a[_0x011d('0x34')]=qs[_0x011d('0x2a')](_[_0x011d('0x35')](_0x502e0d['query'],_0x3e12eb['filters']));if(_0x502e0d[_0x011d('0x27')][_0x011d('0x39')]){_0x16711a[_0x011d('0x34')]=_[_0x011d('0x38')](_0x16711a[_0x011d('0x34')],{'$or':_[_0x011d('0x3a')](_0x16711a['attributes'],function(_0x4ecb43){var _0x5c573c={};_0x5c573c[_0x4ecb43]={'$like':'%'+_0x502e0d[_0x011d('0x27')][_0x011d('0x39')]+'%'};return _0x5c573c;})});}_0x16711a=_[_0x011d('0x38')]({},_0x16711a,_0x502e0d[_0x011d('0x3b')]);return _0x52e377[_0x011d('0x6b')](_0x16711a);}})[_0x011d('0x1d')](function(_0x520cdc){if(_0x520cdc){_0x546670=_0x520cdc[_0x011d('0x2e')];if(!_0x502e0d[_0x011d('0x27')][_0x011d('0x2f')](_0x011d('0x30'))){_0x16711a[_0x011d('0x31')]=qs['limit'](_0x502e0d[_0x011d('0x27')][_0x011d('0x31')]);_0x16711a[_0x011d('0x17')]=qs['offset'](_0x502e0d['query']['offset']);}return _0x52e377[_0x011d('0x6b')](_0x16711a);}})[_0x011d('0x1d')](function(_0x54974f){if(_0x54974f){return _0x54974f?{'count':_0x546670,'rows':_0x54974f}:null;}})[_0x011d('0x1d')](respondWithResult(_0xcf4fce,null))[_0x011d('0x40')](handleError(_0xcf4fce,null));};exports[_0x011d('0x6c')]=function(_0x311bf4,_0x2bba13,_0x1c9371){var _0x278bf4={};var _0x1cc1e6={};var _0x1a749a;var _0x1c3b5c;return db[_0x011d('0x3c')]['findOne']({'where':{'id':_0x311bf4['params']['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x2bba13,null))[_0x011d('0x1d')](function(_0xed2b73){if(_0xed2b73){_0x1a749a=_0xed2b73;_0x1cc1e6['model']=_[_0x011d('0x26')](db[_0x011d('0x6a')][_0x011d('0x24')]);_0x1cc1e6[_0x011d('0x27')]=_['keys'](_0x311bf4[_0x011d('0x27')]);_0x1cc1e6[_0x011d('0x2a')]=_['intersection'](_0x1cc1e6[_0x011d('0x25')],_0x1cc1e6[_0x011d('0x27')]);_0x278bf4[_0x011d('0x2b')]=_[_0x011d('0x2c')](_0x1cc1e6[_0x011d('0x25')],qs[_0x011d('0x2d')](_0x311bf4[_0x011d('0x27')][_0x011d('0x2d')]));_0x278bf4['attributes']=_0x278bf4['attributes'][_0x011d('0x2e')]?_0x278bf4[_0x011d('0x2b')]:_0x1cc1e6[_0x011d('0x25')];_0x278bf4[_0x011d('0x32')]=qs[_0x011d('0x33')](_0x311bf4[_0x011d('0x27')]['sort']);_0x278bf4[_0x011d('0x34')]=qs[_0x011d('0x2a')](_[_0x011d('0x35')](_0x311bf4[_0x011d('0x27')],_0x1cc1e6[_0x011d('0x2a')]));if(_0x311bf4[_0x011d('0x27')][_0x011d('0x39')]){_0x278bf4[_0x011d('0x34')]=_[_0x011d('0x38')](_0x278bf4[_0x011d('0x34')],{'$or':_['map'](_0x278bf4[_0x011d('0x2b')],function(_0x827f91){var _0x18486e={};_0x18486e[_0x827f91]={'$like':'%'+_0x311bf4[_0x011d('0x27')]['filter']+'%'};return _0x18486e;})});}_0x278bf4=_['merge']({},_0x278bf4,_0x311bf4[_0x011d('0x3b')]);return _0x1a749a[_0x011d('0x6c')](_0x278bf4);}})['then'](function(_0x5bc09f){if(_0x5bc09f){_0x1c3b5c=_0x5bc09f[_0x011d('0x2e')];if(!_0x311bf4[_0x011d('0x27')]['hasOwnProperty'](_0x011d('0x30'))){_0x278bf4['limit']=qs[_0x011d('0x31')](_0x311bf4[_0x011d('0x27')][_0x011d('0x31')]);_0x278bf4[_0x011d('0x17')]=qs['offset'](_0x311bf4[_0x011d('0x27')][_0x011d('0x17')]);}return _0x1a749a[_0x011d('0x6c')](_0x278bf4);}})[_0x011d('0x1d')](function(_0x12d5d1){return _0x12d5d1?{'count':_0x1c3b5c,'rows':_0x12d5d1}:null;})[_0x011d('0x1d')](respondWithResult(_0x2bba13,null))['catch'](handleError(_0x2bba13,null));};exports[_0x011d('0x6d')]=function(_0x10f588,_0x5c6e0e,_0x18c4de){var _0x4d2ae3={};var _0x10effe={};var _0x4218ac;var _0x2e3797;return db[_0x011d('0x3c')][_0x011d('0x4b')]({'where':{'id':_0x10f588[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x5c6e0e,null))['then'](function(_0x2dcb9c){if(_0x2dcb9c){_0x4218ac=_0x2dcb9c;_0x10effe[_0x011d('0x25')]=_['keys'](db[_0x011d('0x6e')]['rawAttributes']);_0x10effe[_0x011d('0x27')]=_['keys'](_0x10f588[_0x011d('0x27')]);_0x10effe[_0x011d('0x2a')]=_[_0x011d('0x2c')](_0x10effe['model'],_0x10effe[_0x011d('0x27')]);_0x4d2ae3[_0x011d('0x2b')]=_[_0x011d('0x2c')](_0x10effe['model'],qs[_0x011d('0x2d')](_0x10f588[_0x011d('0x27')][_0x011d('0x2d')]));_0x4d2ae3[_0x011d('0x2b')]=_0x4d2ae3[_0x011d('0x2b')]['length']?_0x4d2ae3[_0x011d('0x2b')]:_0x10effe[_0x011d('0x25')];_0x4d2ae3[_0x011d('0x32')]=qs[_0x011d('0x33')](_0x10f588[_0x011d('0x27')][_0x011d('0x33')]);_0x4d2ae3['where']=qs[_0x011d('0x2a')](_[_0x011d('0x35')](_0x10f588[_0x011d('0x27')],_0x10effe[_0x011d('0x2a')]));if(_0x10f588[_0x011d('0x27')][_0x011d('0x39')]){_0x4d2ae3[_0x011d('0x34')]=_[_0x011d('0x38')](_0x4d2ae3[_0x011d('0x34')],{'$or':_[_0x011d('0x3a')](_0x4d2ae3[_0x011d('0x2b')],function(_0x3b241c){var _0x298769={};_0x298769[_0x3b241c]={'$like':'%'+_0x10f588['query'][_0x011d('0x39')]+'%'};return _0x298769;})});}_0x4d2ae3=_[_0x011d('0x38')]({},_0x4d2ae3,_0x10f588[_0x011d('0x3b')]);return _0x4218ac[_0x011d('0x6d')](_0x4d2ae3);}})['then'](function(_0x2035bc){if(_0x2035bc){_0x2e3797=_0x2035bc['length'];if(!_0x10f588[_0x011d('0x27')][_0x011d('0x2f')](_0x011d('0x30'))){_0x4d2ae3[_0x011d('0x31')]=qs[_0x011d('0x31')](_0x10f588[_0x011d('0x27')]['limit']);_0x4d2ae3[_0x011d('0x17')]=qs[_0x011d('0x17')](_0x10f588['query'][_0x011d('0x17')]);}return _0x4218ac[_0x011d('0x6d')](_0x4d2ae3);}})[_0x011d('0x1d')](function(_0x4cefdd){if(_0x4cefdd){return _0x4cefdd?{'count':_0x2e3797,'rows':_0x4cefdd}:null;}})[_0x011d('0x1d')](respondWithResult(_0x5c6e0e,null))[_0x011d('0x40')](handleError(_0x5c6e0e,null));};exports['addLists']=function(_0x230065,_0x58ae6b,_0x41631a){var _0x53df8d,_0x235bcc;return db[_0x011d('0x3c')]['find']({'where':{'id':_0x230065['params']['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x58ae6b,null))['then'](function(_0x388d83){if(_0x388d83){_0x235bcc=_0x388d83;return _0x388d83[_0x011d('0x6f')](_0x230065['body']['ids'],_[_0x011d('0x48')](_0x230065[_0x011d('0x45')],[_0x011d('0x57'),'id'])||{});}return null;})[_0x011d('0x5f')](function(_0x589ec8){var _0x2f8e73;_0x53df8d=_0x589ec8||[];var _0x58df8a=[];if(_0x589ec8){for(var _0x53fc73=0x0;_0x53fc73<_0x589ec8[_0x011d('0x2e')];_0x53fc73+=0x1){var _0x17495e=_0x589ec8[_0x53fc73][_0x011d('0x47')]({'plain':!![]});_0x235bcc[_0x011d('0x70')]=_0x230065['body'][_0x011d('0x70')]?_0x230065[_0x011d('0x45')][_0x011d('0x70')]:_0x235bcc[_0x011d('0x70')];switch(_0x235bcc['dialCheckDuplicateType']){case _0x011d('0x71'):_0x2f8e73=squel['insert']()[_0x011d('0x72')](_0x011d('0x73'))[_0x011d('0x74')]([_0x011d('0x75'),_0x011d('0x76'),_0x011d('0x77'),_0x011d('0x78'),_0x011d('0x4e'),'createdAt',_0x011d('0x79')],squel[_0x011d('0x7a')]()[_0x011d('0x7b')](_0x011d('0x75'),'phone')[_0x011d('0x7b')](_0x011d('0x7c'),'scheduledAt')['field']('id',_0x011d('0x77'))[_0x011d('0x7b')](_0x17495e[_0x011d('0x7d')]['toString'](),_0x011d('0x78'))['field'](_0x230065['params']['id']['toString'](),_0x011d('0x4e'))[_0x011d('0x7b')](_0x011d('0x7c'),_0x011d('0x49'))[_0x011d('0x7b')](_0x011d('0x7c'),_0x011d('0x79'))['from'](_0x011d('0x7e'))[_0x011d('0x34')](_0x011d('0x7f'))['where'](_0x011d('0x80'),_0x17495e[_0x011d('0x7d')]['toString']())[_0x011d('0x34')]('phone\x20IS\x20NOT\x20NULL')[_0x011d('0x34')](_0x011d('0x81'),squel['select']()['field'](_0x011d('0x82'))['from'](_0x011d('0x83'))[_0x011d('0x34')](_0x011d('0x84'),_0x230065[_0x011d('0x42')]['id'][_0x011d('0x85')]()))[_0x011d('0x34')](_0x011d('0x81'),squel[_0x011d('0x7a')]()[_0x011d('0x7b')](_0x011d('0x75'))['from']('cm_hopper')[_0x011d('0x34')](_0x011d('0x84'),_0x230065[_0x011d('0x42')]['id'][_0x011d('0x85')]())))['toString']();break;case'onlyIfOpen':_0x2f8e73=squel['insert']()['into']('cm_hopper')[_0x011d('0x74')](['phone',_0x011d('0x76'),_0x011d('0x77'),'ListId',_0x011d('0x4e'),_0x011d('0x49'),_0x011d('0x79')],squel[_0x011d('0x7a')]()[_0x011d('0x7b')](_0x011d('0x75'),_0x011d('0x75'))['field'](_0x011d('0x7c'),_0x011d('0x76'))['field']('id',_0x011d('0x77'))['field'](_0x17495e[_0x011d('0x7d')][_0x011d('0x85')](),_0x011d('0x78'))[_0x011d('0x7b')](_0x230065[_0x011d('0x42')]['id'][_0x011d('0x85')](),'VoiceQueueId')['field'](_0x011d('0x7c'),_0x011d('0x49'))[_0x011d('0x7b')](_0x011d('0x7c'),_0x011d('0x79'))[_0x011d('0x86')](_0x011d('0x7e'))[_0x011d('0x34')](_0x011d('0x7f'))[_0x011d('0x34')](_0x011d('0x80'),_0x17495e[_0x011d('0x7d')]['toString']())[_0x011d('0x34')](_0x011d('0x87'))['where'](_0x011d('0x81'),squel['select']()[_0x011d('0x7b')](_0x011d('0x75'))[_0x011d('0x86')]('cm_hopper')[_0x011d('0x34')](_0x011d('0x84'),_0x230065[_0x011d('0x42')]['id']['toString']())))[_0x011d('0x85')]();break;default:_0x2f8e73=squel[_0x011d('0x88')]()[_0x011d('0x72')]('cm_hopper')[_0x011d('0x74')]([_0x011d('0x75'),_0x011d('0x76'),'ContactId',_0x011d('0x78'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x011d('0x7a')]()['field']('phone',_0x011d('0x75'))[_0x011d('0x7b')](_0x011d('0x7c'),_0x011d('0x76'))['field']('id',_0x011d('0x77'))['field'](_0x17495e[_0x011d('0x7d')]['toString'](),'ListId')['field'](_0x230065[_0x011d('0x42')]['id']['toString'](),'VoiceQueueId')[_0x011d('0x7b')](_0x011d('0x7c'),_0x011d('0x49'))[_0x011d('0x7b')](_0x011d('0x7c'),_0x011d('0x79'))[_0x011d('0x86')](_0x011d('0x7e'))[_0x011d('0x34')](_0x011d('0x7f'))[_0x011d('0x34')](_0x011d('0x80'),_0x17495e[_0x011d('0x7d')][_0x011d('0x85')]())['where'](_0x011d('0x87')))[_0x011d('0x85')]();}_0x58df8a[_0x011d('0x60')](db[_0x011d('0x89')][_0x011d('0x27')](_0x2f8e73));}return BPromise[_0x011d('0x8a')](_0x58df8a);}})[_0x011d('0x1d')](function(){return _0x53df8d;})[_0x011d('0x1d')](respondWithResult(_0x58ae6b,null))['catch'](handleError(_0x58ae6b,null));};exports[_0x011d('0x8b')]=function(_0x34090b,_0x36f694,_0x52edff){var _0x40657a;return db[_0x011d('0x3c')][_0x011d('0x43')]({'where':{'id':_0x34090b[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x36f694,null))[_0x011d('0x1d')](function(_0x22ee96){if(_0x22ee96){return _0x22ee96['removeLists'](_0x34090b[_0x011d('0x27')][_0x011d('0x57')]);}})[_0x011d('0x1d')](function(_0x5c6bad){if(_0x5c6bad){_0x40657a=_0x5c6bad;return db['CmHopper'][_0x011d('0x1e')]({'where':{'ListId':_0x34090b['query'][_0x011d('0x57')],'VoiceQueueId':_0x34090b['params']['id']}})[_0x011d('0x1d')](function(){return _0x40657a;});}})[_0x011d('0x1d')](respondWithStatusCode(_0x36f694,null))[_0x011d('0x40')](handleError(_0x36f694,null));};exports[_0x011d('0x8c')]=function(_0x4284a0,_0x2cfa16,_0x32e102){var _0x310451={};var _0x234aac={};var _0x5d3fc0;var _0x3b39fe;return db[_0x011d('0x3c')][_0x011d('0x4b')]({'where':{'id':_0x4284a0[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](handleEntityNotFound(_0x2cfa16,null))[_0x011d('0x1d')](function(_0x2ce9de){if(_0x2ce9de){_0x5d3fc0=_0x2ce9de;_0x234aac[_0x011d('0x25')]=_[_0x011d('0x26')](db[_0x011d('0x6e')][_0x011d('0x24')]);_0x234aac[_0x011d('0x27')]=_[_0x011d('0x26')](_0x4284a0['query']);_0x234aac['filters']=_[_0x011d('0x2c')](_0x234aac['model'],_0x234aac['query']);_0x310451[_0x011d('0x2b')]=_[_0x011d('0x2c')](_0x234aac[_0x011d('0x25')],qs[_0x011d('0x2d')](_0x4284a0[_0x011d('0x27')][_0x011d('0x2d')]));_0x310451['attributes']=_0x310451[_0x011d('0x2b')][_0x011d('0x2e')]?_0x310451[_0x011d('0x2b')]:_0x234aac['model'];_0x310451[_0x011d('0x32')]=qs[_0x011d('0x33')](_0x4284a0[_0x011d('0x27')][_0x011d('0x33')]);_0x310451[_0x011d('0x34')]=qs['filters'](_[_0x011d('0x35')](_0x4284a0[_0x011d('0x27')],_0x234aac[_0x011d('0x2a')]));if(_0x4284a0['query'][_0x011d('0x39')]){_0x310451[_0x011d('0x34')]=_[_0x011d('0x38')](_0x310451[_0x011d('0x34')],{'$or':_['map'](_0x310451[_0x011d('0x2b')],function(_0x364ae0){var _0x2f5ab6={};_0x2f5ab6[_0x364ae0]={'$like':'%'+_0x4284a0[_0x011d('0x27')][_0x011d('0x39')]+'%'};return _0x2f5ab6;})});}_0x310451=_['merge']({},_0x310451,_0x4284a0[_0x011d('0x3b')]);return _0x5d3fc0['getBlackLists'](_0x310451);}})[_0x011d('0x1d')](function(_0x41cbc7){if(_0x41cbc7){_0x3b39fe=_0x41cbc7[_0x011d('0x2e')];if(!_0x4284a0[_0x011d('0x27')][_0x011d('0x2f')](_0x011d('0x30'))){_0x310451[_0x011d('0x31')]=qs[_0x011d('0x31')](_0x4284a0[_0x011d('0x27')][_0x011d('0x31')]);_0x310451['offset']=qs[_0x011d('0x17')](_0x4284a0[_0x011d('0x27')][_0x011d('0x17')]);}return _0x5d3fc0[_0x011d('0x8c')](_0x310451);}})['then'](function(_0x5758e5){if(_0x5758e5){return _0x5758e5?{'count':_0x3b39fe,'rows':_0x5758e5}:null;}})[_0x011d('0x1d')](respondWithResult(_0x2cfa16,null))['catch'](handleError(_0x2cfa16,null));};exports[_0x011d('0x8d')]=function(_0x30b9f8,_0x2c80f0,_0x2a200e){var _0x2941df,_0x180e5a;return db['VoiceQueue']['find']({'where':{'id':_0x30b9f8[_0x011d('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c80f0,null))[_0x011d('0x1d')](function(_0x55d322){if(_0x55d322){_0x180e5a=_0x55d322;return _0x55d322[_0x011d('0x8d')](_0x30b9f8[_0x011d('0x45')][_0x011d('0x57')],_[_0x011d('0x48')](_0x30b9f8[_0x011d('0x45')],[_0x011d('0x57'),'id'])||{});}return null;})['spread'](function(_0x9a2bcc){var _0x4bfbb0;_0x2941df=_0x9a2bcc||[];var _0xea9213=[];if(_0x9a2bcc){for(var _0x27eed8=0x0;_0x27eed8<_0x9a2bcc[_0x011d('0x2e')];_0x27eed8+=0x1){var _0x53cf89=_0x9a2bcc[_0x27eed8][_0x011d('0x47')]({'plain':!![]});_0x4bfbb0=squel[_0x011d('0x88')]()['into'](_0x011d('0x8e'))[_0x011d('0x74')]([_0x011d('0x75'),_0x011d('0x77'),_0x011d('0x78'),_0x011d('0x4e'),_0x011d('0x49'),_0x011d('0x79')],squel[_0x011d('0x7a')]()[_0x011d('0x7b')](_0x011d('0x75'),_0x011d('0x75'))[_0x011d('0x7b')]('id',_0x011d('0x77'))['field'](_0x53cf89[_0x011d('0x7d')]['toString'](),'ListId')[_0x011d('0x7b')](_0x30b9f8[_0x011d('0x42')]['id']['toString'](),'VoiceQueueId')[_0x011d('0x7b')]('NOW()','createdAt')[_0x011d('0x7b')](_0x011d('0x7c'),_0x011d('0x79'))[_0x011d('0x86')]('cm_contacts')[_0x011d('0x34')]('deletedAt\x20IS\x20NULL')['where'](_0x011d('0x80'),_0x53cf89[_0x011d('0x7d')][_0x011d('0x85')]())[_0x011d('0x34')](_0x011d('0x87')))[_0x011d('0x85')]();_0xea9213[_0x011d('0x60')](db['sequelize'][_0x011d('0x27')](_0x4bfbb0));}return BPromise[_0x011d('0x8a')](_0xea9213);}})[_0x011d('0x1d')](function(){return _0x2941df;})[_0x011d('0x1d')](respondWithResult(_0x2c80f0,null))[_0x011d('0x40')](handleError(_0x2c80f0,null));};exports['removeBlackLists']=function(_0x16f3be,_0x48a9e2,_0x2072d4){var _0x3fcf2d;return db[_0x011d('0x3c')][_0x011d('0x43')]({'where':{'id':_0x16f3be[_0x011d('0x42')]['id']}})['then'](handleEntityNotFound(_0x48a9e2,null))['then'](function(_0x50a57b){if(_0x50a57b){return _0x50a57b['removeBlackLists'](_0x16f3be[_0x011d('0x27')][_0x011d('0x57')]);}})[_0x011d('0x1d')](function(_0x5e2a03){if(_0x5e2a03){_0x3fcf2d=_0x5e2a03;return db[_0x011d('0x53')][_0x011d('0x1e')]({'where':{'ListId':_0x16f3be[_0x011d('0x27')][_0x011d('0x57')],'VoiceQueueId':_0x16f3be[_0x011d('0x42')]['id']}})[_0x011d('0x1d')](function(){return _0x3fcf2d;});}})[_0x011d('0x1d')](respondWithStatusCode(_0x48a9e2,null))[_0x011d('0x40')](handleError(_0x48a9e2,null));}; \ No newline at end of file +var _0x6778=['field','NOW()','scheduledAt','ContactId','CmListId','toString','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','VoiceQueueId\x20=\x20?','onlyIfOpen','into','ListId','cm_contacts','deletedAt\x20IS\x20NULL','insert','fromQuery','sequelize','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./voiceQueue.socket','register','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','then','stack','name','send','index','VoiceQueue','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','clone','get','omit','body','createdAt','updatedAt','destroy','rawAttributes','CmHopper','findOne','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','ids','User','Agents','union','addAgents','penalty','addTeams','removeTeams','removeAgents','spread','emit','loginInPause','voicePause','push','UserVoiceQueueRt','upsert','format','%s/%s','SIP','all','isArray','userVoiceQueue:remove','realtime','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','cm_hopper','phone'];(function(_0x2e50bc,_0x28b59d){var _0x1deeb4=function(_0x3084f1){while(--_0x3084f1){_0x2e50bc['push'](_0x2e50bc['shift']());}};_0x1deeb4(++_0x28b59d);}(_0x6778,0x134));var _0x8677=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x6778[_0x2cde0a];return _0x260610;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8677('0x0'));var Mustache=require(_0x8677('0x1'));var util=require(_0x8677('0x2'));var path=require(_0x8677('0x3'));var sox=require(_0x8677('0x4'));var csv=require(_0x8677('0x5'));var ejs=require(_0x8677('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8677('0x7'));var crypto=require('crypto');var jsforce=require(_0x8677('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8677('0x9'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x8677('0xa'))(_0x8677('0xb'));var utils=require('../../config/utils');var config=require(_0x8677('0xc'));var db=require(_0x8677('0xd'))['db'];var socket=require(_0x8677('0xe'))({'host':_0x8677('0xf'),'port':0x18eb});require(_0x8677('0x10'))[_0x8677('0x11')](socket);function respondWithStatusCode(_0x3cfcf8,_0x308d05){_0x308d05=_0x308d05||0xcc;return function(_0x2db6c2){if(_0x2db6c2){return _0x3cfcf8[_0x8677('0x12')](_0x308d05);}return _0x3cfcf8['status'](_0x308d05)[_0x8677('0x13')]();};}function respondWithResult(_0x399e6e,_0x2500bf){_0x2500bf=_0x2500bf||0xc8;return function(_0x285b6a){if(_0x285b6a){return _0x399e6e['status'](_0x2500bf)[_0x8677('0x14')](_0x285b6a);}};}function respondWithFilteredResult(_0x493fbb,_0x56c92b){return function(_0x832a53){if(_0x832a53){var _0x5cbdeb=_0x832a53[_0x8677('0x15')],_0x5e5458=_0x56c92b[_0x8677('0x16')],_0x3a4ad8=_0x56c92b[_0x8677('0x16')]+_0x56c92b[_0x8677('0x17')],_0x3516fa;if(_0x3a4ad8>=_0x5cbdeb){_0x3a4ad8=_0x5cbdeb;_0x3516fa=0xc8;}else{_0x3516fa=0xce;}_0x493fbb[_0x8677('0x18')](_0x3516fa);return _0x493fbb[_0x8677('0x19')](_0x8677('0x1a'),_0x5e5458+'-'+_0x3a4ad8+'/'+_0x5cbdeb)[_0x8677('0x14')](_0x832a53);}return null;};}function patchUpdates(_0x2f481a){return function(_0x2034b9){try{jsonpatch['apply'](_0x2034b9,_0x2f481a,!![]);}catch(_0x1e714d){return BPromise['reject'](_0x1e714d);}return _0x2034b9[_0x8677('0x1b')]();};}function saveUpdates(_0x273173,_0x4e9ad3){return function(_0x322a8f){if(_0x322a8f){return _0x322a8f[_0x8677('0x1c')](_0x273173)[_0x8677('0x1d')](function(_0x1cfa93){return _0x1cfa93;});}return null;};}function removeEntity(_0x3222da,_0x4fb4a2){return function(_0x2ef16a){if(_0x2ef16a){return _0x2ef16a['destroy']()[_0x8677('0x1d')](function(){_0x3222da[_0x8677('0x18')](0xcc)[_0x8677('0x13')]();});}};}function handleEntityNotFound(_0x28a0ac,_0x205cb1){return function(_0x206d88){if(!_0x206d88){_0x28a0ac[_0x8677('0x12')](0x194);}return _0x206d88;};}function handleError(_0x2c4b45,_0x399cf4){_0x399cf4=_0x399cf4||0x1f4;return function(_0x4ed524){logger['error'](_0x4ed524[_0x8677('0x1e')]);if(_0x4ed524[_0x8677('0x1f')]){delete _0x4ed524[_0x8677('0x1f')];}_0x2c4b45['status'](_0x399cf4)[_0x8677('0x20')](_0x4ed524);};}exports[_0x8677('0x21')]=function(_0x2bd318,_0xd1efa1){var _0x2c5438={},_0x41dd0a={},_0x9175f9={'count':0x0,'rows':[]};var _0x113448=db[_0x8677('0x22')]['rawAttributes'];_0x41dd0a[_0x8677('0x23')]=_[_0x8677('0x24')](_0x113448);var _0x23c5ba={'dateStart':_0x2bd318[_0x8677('0x25')][_0x8677('0x26')],'dateEnd':_0x2bd318[_0x8677('0x25')][_0x8677('0x27')]};delete _0x2bd318[_0x8677('0x25')][_0x8677('0x26')];delete _0x2bd318[_0x8677('0x25')]['dateEnd'];_0x41dd0a['query']=_['keys'](_0x2bd318[_0x8677('0x25')]);_0x41dd0a['filters']=_[_0x8677('0x28')](_0x41dd0a[_0x8677('0x23')],_0x41dd0a[_0x8677('0x25')]);_0x2c5438['attributes']=_[_0x8677('0x28')](_0x41dd0a['model'],qs[_0x8677('0x29')](_0x2bd318[_0x8677('0x25')]['fields']));_0x2c5438['attributes']=_0x2c5438[_0x8677('0x2a')][_0x8677('0x2b')]?_0x2c5438[_0x8677('0x2a')]:_0x41dd0a[_0x8677('0x23')];if(!_0x2bd318[_0x8677('0x25')][_0x8677('0x2c')](_0x8677('0x2d'))){_0x2c5438[_0x8677('0x17')]=qs[_0x8677('0x17')](_0x2bd318[_0x8677('0x25')][_0x8677('0x17')]);_0x2c5438['offset']=qs[_0x8677('0x16')](_0x2bd318['query'][_0x8677('0x16')]);}_0x2c5438[_0x8677('0x2e')]=qs[_0x8677('0x2f')](_0x2bd318[_0x8677('0x25')][_0x8677('0x2f')]);_0x2c5438[_0x8677('0x30')]=qs['filters'](_['pick'](_0x2bd318[_0x8677('0x25')],_0x41dd0a[_0x8677('0x31')]));if(_0x23c5ba[_0x8677('0x26')]){if(_0x23c5ba['dateEnd']){_0x23c5ba[_0x8677('0x27')]=moment(_0x23c5ba[_0x8677('0x27')])[_0x8677('0x32')](0x1,_0x8677('0x33'));}else{_0x23c5ba['dateEnd']=moment(_0x23c5ba['dateStart'])[_0x8677('0x32')](0x1,_0x8677('0x33'));}_[_0x8677('0x34')](_0x2c5438[_0x8677('0x30')],{'createdAt':{'$gte':_0x23c5ba[_0x8677('0x26')],'$lte':_0x23c5ba[_0x8677('0x27')]}});}if(_0x2bd318['query'][_0x8677('0x35')]){_0x2c5438[_0x8677('0x30')]=_[_0x8677('0x34')](_0x2c5438['where'],{'$or':_[_0x8677('0x36')](_0x2c5438[_0x8677('0x2a')],function(_0x182241){var _0x44c625={};_0x44c625[_0x182241]={'$like':'%'+_0x2bd318[_0x8677('0x25')][_0x8677('0x35')]+'%'};return _0x44c625;})});}_0x2c5438=_[_0x8677('0x34')]({},_0x2c5438,_0x2bd318[_0x8677('0x37')]);var _0x2c613a={'where':_0x2c5438[_0x8677('0x30')]};return db[_0x8677('0x22')]['count'](_0x2c613a)[_0x8677('0x1d')](function(_0x48c216){_0x9175f9[_0x8677('0x15')]=_0x48c216;if(_0x2bd318[_0x8677('0x25')][_0x8677('0x38')]){_0x2c5438[_0x8677('0x39')]=[{'all':!![]}];}return db[_0x8677('0x22')][_0x8677('0x3a')](_0x2c5438);})[_0x8677('0x1d')](function(_0x20f8f0){_0x9175f9[_0x8677('0x3b')]=_0x20f8f0;return _0x9175f9;})[_0x8677('0x1d')](respondWithFilteredResult(_0xd1efa1,_0x2c5438))[_0x8677('0x3c')](handleError(_0xd1efa1,null));};exports[_0x8677('0x3d')]=function(_0x57568e,_0x1d8803){var _0x11e9a3={'raw':![],'where':{'id':_0x57568e[_0x8677('0x3e')]['id']}},_0x5d9025={};_0x5d9025[_0x8677('0x23')]=_[_0x8677('0x24')](db[_0x8677('0x22')]['rawAttributes']);_0x5d9025[_0x8677('0x25')]=_['keys'](_0x57568e[_0x8677('0x25')]);_0x5d9025[_0x8677('0x31')]=_[_0x8677('0x28')](_0x5d9025[_0x8677('0x23')],_0x5d9025['query']);_0x11e9a3[_0x8677('0x2a')]=_[_0x8677('0x28')](_0x5d9025[_0x8677('0x23')],qs[_0x8677('0x29')](_0x57568e[_0x8677('0x25')]['fields']));_0x11e9a3[_0x8677('0x2a')]=_0x11e9a3[_0x8677('0x2a')][_0x8677('0x2b')]?_0x11e9a3[_0x8677('0x2a')]:_0x5d9025[_0x8677('0x23')];if(_0x57568e[_0x8677('0x25')][_0x8677('0x38')]){_0x11e9a3[_0x8677('0x39')]=[{'all':!![]}];}_0x11e9a3=_[_0x8677('0x34')]({},_0x11e9a3,_0x57568e['options']);return db[_0x8677('0x22')][_0x8677('0x3f')](_0x11e9a3)[_0x8677('0x1d')](handleEntityNotFound(_0x1d8803,null))[_0x8677('0x1d')](respondWithResult(_0x1d8803,null))['catch'](handleError(_0x1d8803,null));};exports[_0x8677('0x40')]=function(_0x45605e,_0x30deb4){return db[_0x8677('0x22')][_0x8677('0x40')](_0x45605e['body'],{})['then'](respondWithResult(_0x30deb4,0xc9))['catch'](handleError(_0x30deb4,null));};exports[_0x8677('0x41')]=function(_0xcd3380,_0x2c6b29){var _0x13cefb={'raw':![],'where':{'id':_0xcd3380['params']['id']}},_0x44c1f5={};_0x44c1f5[_0x8677('0x23')]=_[_0x8677('0x24')](db['VoiceQueue']['rawAttributes']);_0x13cefb['attributes']=_[_0x8677('0x28')](_0x44c1f5[_0x8677('0x23')],qs['fields'](_0xcd3380[_0x8677('0x25')]['fields']));_0x13cefb['attributes']=_0x13cefb[_0x8677('0x2a')][_0x8677('0x2b')]?_0x13cefb['attributes']:_0x44c1f5['model'];if(_0xcd3380[_0x8677('0x25')][_0x8677('0x38')]){_0x13cefb[_0x8677('0x39')]=[{'all':!![]}];}_0x13cefb=_[_0x8677('0x34')]({},_0x13cefb,_0xcd3380[_0x8677('0x37')]);return db['VoiceQueue'][_0x8677('0x3f')](_0x13cefb)['then'](handleEntityNotFound(_0x2c6b29,null))[_0x8677('0x1d')](function(_0x71671e){if(_0x71671e){var _0x3126e7=_0x71671e[_0x8677('0x42')]({'plain':!![]});_0x3126e7=qs[_0x8677('0x43')](_0x3126e7,['id','createdAt','updatedAt']);_0xcd3380[_0x8677('0x44')]=_[_0x8677('0x43')](_0xcd3380[_0x8677('0x44')],['id',_0x8677('0x45'),_0x8677('0x46')]);return db[_0x8677('0x22')]['create'](_[_0x8677('0x34')](_0x3126e7,_0xcd3380[_0x8677('0x44')]),{'include':_0xcd3380[_0x8677('0x25')][_0x8677('0x38')]?[{'all':!![]}]:undefined});}})[_0x8677('0x1d')](respondWithResult(_0x2c6b29,0xc9))['catch'](handleError(_0x2c6b29,null));};exports[_0x8677('0x1c')]=function(_0xfa2d2c,_0x1ff61a){if(_0xfa2d2c[_0x8677('0x44')]['id']){delete _0xfa2d2c[_0x8677('0x44')]['id'];}return db[_0x8677('0x22')][_0x8677('0x3f')]({'where':{'id':_0xfa2d2c[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x1ff61a,null))[_0x8677('0x1d')](saveUpdates(_0xfa2d2c[_0x8677('0x44')],null))[_0x8677('0x1d')](respondWithResult(_0x1ff61a,null))[_0x8677('0x3c')](handleError(_0x1ff61a,null));};exports[_0x8677('0x47')]=function(_0xdde493,_0x3514d2){return db['VoiceQueue'][_0x8677('0x3f')]({'where':{'id':_0xdde493[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x3514d2,null))[_0x8677('0x1d')](removeEntity(_0x3514d2,null))[_0x8677('0x3c')](handleError(_0x3514d2,null));};exports['getHoppers']=function(_0x3528ba,_0x4aaa97,_0x5b41eb){var _0x1de9c8={'raw':![],'where':{}};var _0x2d8e9a={};var _0x3fc9e5={'count':0x0,'rows':[]};return db[_0x8677('0x22')]['findOne']({'where':{'id':_0x3528ba['params']['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x4aaa97,null))[_0x8677('0x1d')](function(_0x202733){if(_0x202733){_0x2d8e9a[_0x8677('0x23')]=_['keys'](db['CmHopper'][_0x8677('0x48')]);_0x2d8e9a[_0x8677('0x25')]=_[_0x8677('0x24')](_0x3528ba[_0x8677('0x25')]);_0x2d8e9a[_0x8677('0x31')]=_['intersection'](_0x2d8e9a[_0x8677('0x23')],_0x2d8e9a[_0x8677('0x25')]);_0x1de9c8['attributes']=_[_0x8677('0x28')](_0x2d8e9a[_0x8677('0x23')],qs['fields'](_0x3528ba['query']['fields']));_0x1de9c8[_0x8677('0x2a')]=_0x1de9c8[_0x8677('0x2a')]['length']?_0x1de9c8['attributes']:_0x2d8e9a[_0x8677('0x23')];if(!_0x3528ba[_0x8677('0x25')][_0x8677('0x2c')]('nolimit')){_0x1de9c8[_0x8677('0x17')]=qs['limit'](_0x3528ba['query'][_0x8677('0x17')]);_0x1de9c8[_0x8677('0x16')]=qs[_0x8677('0x16')](_0x3528ba[_0x8677('0x25')][_0x8677('0x16')]);}_0x1de9c8['order']=qs['sort'](_0x3528ba[_0x8677('0x25')][_0x8677('0x2f')]);_0x1de9c8[_0x8677('0x30')]=qs[_0x8677('0x31')](_['pick'](_0x3528ba[_0x8677('0x25')],_0x2d8e9a[_0x8677('0x31')]));_0x1de9c8[_0x8677('0x30')]['VoiceQueueId']=_0x202733['id'];if(_0x3528ba['query'][_0x8677('0x35')]){_0x1de9c8[_0x8677('0x30')]=_[_0x8677('0x34')](_0x1de9c8['where'],{'$or':_[_0x8677('0x36')](_0x1de9c8[_0x8677('0x2a')],function(_0x55bbc6){var _0x2ad449={};_0x2ad449[_0x55bbc6]={'$like':'%'+_0x3528ba[_0x8677('0x25')][_0x8677('0x35')]+'%'};return _0x2ad449;})});}_0x1de9c8=_[_0x8677('0x34')]({},_0x1de9c8,_0x3528ba[_0x8677('0x37')]);return db[_0x8677('0x49')][_0x8677('0x15')]({'where':_0x1de9c8[_0x8677('0x30')]})[_0x8677('0x1d')](function(_0x16ac6e){_0x3fc9e5[_0x8677('0x15')]=_0x16ac6e;if(_0x3528ba['query'][_0x8677('0x38')]){_0x1de9c8[_0x8677('0x39')]=[{'all':!![]}];}return db['CmHopper'][_0x8677('0x3a')](_0x1de9c8);})[_0x8677('0x1d')](function(_0x358820){_0x3fc9e5['rows']=_0x358820;return _0x3fc9e5;});}})[_0x8677('0x1d')](respondWithFilteredResult(_0x4aaa97,_0x1de9c8))[_0x8677('0x3c')](handleError(_0x4aaa97,null));};exports['getHopperHistories']=function(_0x510fc1,_0x1277c8,_0x3609ae){var _0x78710c={'raw':!![],'where':{}};var _0x53a6b2={};var _0x2a5a70={'count':0x0,'rows':[]};return db[_0x8677('0x22')][_0x8677('0x4a')]({'where':{'id':_0x510fc1[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x1277c8,null))[_0x8677('0x1d')](function(_0x21c7ec){if(_0x21c7ec){_0x53a6b2['model']=_[_0x8677('0x24')](db[_0x8677('0x4b')][_0x8677('0x48')]);_0x53a6b2[_0x8677('0x25')]=_[_0x8677('0x24')](_0x510fc1[_0x8677('0x25')]);_0x53a6b2[_0x8677('0x31')]=_[_0x8677('0x28')](_0x53a6b2[_0x8677('0x23')],_0x53a6b2['query']);_0x78710c['attributes']=_[_0x8677('0x28')](_0x53a6b2[_0x8677('0x23')],qs[_0x8677('0x29')](_0x510fc1[_0x8677('0x25')][_0x8677('0x29')]));_0x78710c['attributes']=_0x78710c[_0x8677('0x2a')][_0x8677('0x2b')]?_0x78710c[_0x8677('0x2a')]:_0x53a6b2[_0x8677('0x23')];if(!_0x510fc1[_0x8677('0x25')][_0x8677('0x2c')](_0x8677('0x2d'))){_0x78710c['limit']=qs[_0x8677('0x17')](_0x510fc1['query'][_0x8677('0x17')]);_0x78710c[_0x8677('0x16')]=qs[_0x8677('0x16')](_0x510fc1['query']['offset']);}_0x78710c[_0x8677('0x2e')]=qs['sort'](_0x510fc1['query']['sort']);_0x78710c['where']=qs['filters'](_[_0x8677('0x4c')](_0x510fc1['query'],_0x53a6b2['filters']));_0x78710c[_0x8677('0x30')][_0x8677('0x4d')]=_0x21c7ec['id'];if(_0x510fc1[_0x8677('0x25')][_0x8677('0x35')]){_0x78710c[_0x8677('0x30')]=_[_0x8677('0x34')](_0x78710c[_0x8677('0x30')],{'$or':_[_0x8677('0x36')](_0x78710c[_0x8677('0x2a')],function(_0x468919){var _0x3e96b5={};_0x3e96b5[_0x468919]={'$like':'%'+_0x510fc1[_0x8677('0x25')][_0x8677('0x35')]+'%'};return _0x3e96b5;})});}_0x78710c=_[_0x8677('0x34')]({},_0x78710c,_0x510fc1[_0x8677('0x37')]);return db[_0x8677('0x4b')][_0x8677('0x15')]({'where':_0x78710c[_0x8677('0x30')]})[_0x8677('0x1d')](function(_0x37f134){_0x2a5a70[_0x8677('0x15')]=_0x37f134;if(_0x510fc1[_0x8677('0x25')][_0x8677('0x38')]){_0x78710c[_0x8677('0x39')]=[{'all':!![]}];}return db[_0x8677('0x4b')][_0x8677('0x3a')](_0x78710c);})[_0x8677('0x1d')](function(_0x24894c){_0x2a5a70[_0x8677('0x3b')]=_0x24894c;return _0x2a5a70;});}})[_0x8677('0x1d')](respondWithFilteredResult(_0x1277c8,_0x78710c))['catch'](handleError(_0x1277c8,null));};exports[_0x8677('0x4e')]=function(_0x26379a,_0x166a9b,_0x2da146){var _0x45de24={'raw':!![],'where':{}};var _0xc64c93={};var _0xa494d6={'count':0x0,'rows':[]};return db[_0x8677('0x22')][_0x8677('0x4a')]({'where':{'id':_0x26379a[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x166a9b,null))[_0x8677('0x1d')](function(_0xb9282a){if(_0xb9282a){_0xc64c93[_0x8677('0x23')]=_[_0x8677('0x24')](db['CmHopperFinal'][_0x8677('0x48')]);_0xc64c93[_0x8677('0x25')]=_[_0x8677('0x24')](_0x26379a[_0x8677('0x25')]);_0xc64c93[_0x8677('0x31')]=_[_0x8677('0x28')](_0xc64c93[_0x8677('0x23')],_0xc64c93[_0x8677('0x25')]);_0x45de24[_0x8677('0x2a')]=_['intersection'](_0xc64c93['model'],qs[_0x8677('0x29')](_0x26379a[_0x8677('0x25')]['fields']));_0x45de24[_0x8677('0x2a')]=_0x45de24[_0x8677('0x2a')]['length']?_0x45de24['attributes']:_0xc64c93[_0x8677('0x23')];if(!_0x26379a[_0x8677('0x25')][_0x8677('0x2c')](_0x8677('0x2d'))){_0x45de24[_0x8677('0x17')]=qs[_0x8677('0x17')](_0x26379a[_0x8677('0x25')][_0x8677('0x17')]);_0x45de24[_0x8677('0x16')]=qs['offset'](_0x26379a[_0x8677('0x25')][_0x8677('0x16')]);}_0x45de24[_0x8677('0x2e')]=qs[_0x8677('0x2f')](_0x26379a[_0x8677('0x25')][_0x8677('0x2f')]);_0x45de24[_0x8677('0x30')]=qs[_0x8677('0x31')](_[_0x8677('0x4c')](_0x26379a['query'],_0xc64c93['filters']));_0x45de24[_0x8677('0x30')]['VoiceQueueId']=_0xb9282a['id'];if(_0x26379a[_0x8677('0x25')][_0x8677('0x35')]){_0x45de24['where']=_[_0x8677('0x34')](_0x45de24[_0x8677('0x30')],{'$or':_[_0x8677('0x36')](_0x45de24[_0x8677('0x2a')],function(_0x280e99){var _0xe986d6={};_0xe986d6[_0x280e99]={'$like':'%'+_0x26379a[_0x8677('0x25')]['filter']+'%'};return _0xe986d6;})});}_0x45de24=_[_0x8677('0x34')]({},_0x45de24,_0x26379a[_0x8677('0x37')]);return db['CmHopperFinal'][_0x8677('0x15')]({'where':_0x45de24[_0x8677('0x30')]})[_0x8677('0x1d')](function(_0x16372d){_0xa494d6['count']=_0x16372d;if(_0x26379a[_0x8677('0x25')][_0x8677('0x38')]){_0x45de24['include']=[{'all':!![]}];}return db[_0x8677('0x4f')][_0x8677('0x3a')](_0x45de24);})[_0x8677('0x1d')](function(_0x275ec7){_0xa494d6[_0x8677('0x3b')]=_0x275ec7;return _0xa494d6;});}})['then'](respondWithFilteredResult(_0x166a9b,_0x45de24))['catch'](handleError(_0x166a9b,null));};exports[_0x8677('0x50')]=function(_0x3d1eb8,_0x34628e,_0x2da60a){var _0x30c095={'raw':!![],'where':{}};var _0x2f5db5={};var _0x397609={'count':0x0,'rows':[]};return db[_0x8677('0x22')][_0x8677('0x4a')]({'where':{'id':_0x3d1eb8[_0x8677('0x3e')]['id']}})['then'](handleEntityNotFound(_0x34628e,null))[_0x8677('0x1d')](function(_0x4b65f3){if(_0x4b65f3){_0x2f5db5['model']=_['keys'](db['CmHopperBlack'][_0x8677('0x48')]);_0x2f5db5[_0x8677('0x25')]=_[_0x8677('0x24')](_0x3d1eb8['query']);_0x2f5db5[_0x8677('0x31')]=_['intersection'](_0x2f5db5['model'],_0x2f5db5[_0x8677('0x25')]);_0x30c095[_0x8677('0x2a')]=_[_0x8677('0x28')](_0x2f5db5[_0x8677('0x23')],qs[_0x8677('0x29')](_0x3d1eb8['query'][_0x8677('0x29')]));_0x30c095['attributes']=_0x30c095[_0x8677('0x2a')][_0x8677('0x2b')]?_0x30c095[_0x8677('0x2a')]:_0x2f5db5[_0x8677('0x23')];if(!_0x3d1eb8['query'][_0x8677('0x2c')](_0x8677('0x2d'))){_0x30c095['limit']=qs['limit'](_0x3d1eb8[_0x8677('0x25')]['limit']);_0x30c095['offset']=qs[_0x8677('0x16')](_0x3d1eb8[_0x8677('0x25')][_0x8677('0x16')]);}_0x30c095[_0x8677('0x2e')]=qs[_0x8677('0x2f')](_0x3d1eb8['query'][_0x8677('0x2f')]);_0x30c095[_0x8677('0x30')]=qs[_0x8677('0x31')](_[_0x8677('0x4c')](_0x3d1eb8[_0x8677('0x25')],_0x2f5db5[_0x8677('0x31')]));_0x30c095['where'][_0x8677('0x4d')]=_0x4b65f3['id'];if(_0x3d1eb8[_0x8677('0x25')][_0x8677('0x35')]){_0x30c095[_0x8677('0x30')]=_[_0x8677('0x34')](_0x30c095[_0x8677('0x30')],{'$or':_[_0x8677('0x36')](_0x30c095['attributes'],function(_0x566a6e){var _0xd01e60={};_0xd01e60[_0x566a6e]={'$like':'%'+_0x3d1eb8['query'][_0x8677('0x35')]+'%'};return _0xd01e60;})});}_0x30c095=_['merge']({},_0x30c095,_0x3d1eb8[_0x8677('0x37')]);return db['CmHopperBlack'][_0x8677('0x15')]({'where':_0x30c095[_0x8677('0x30')]})[_0x8677('0x1d')](function(_0x448bec){_0x397609['count']=_0x448bec;if(_0x3d1eb8[_0x8677('0x25')]['includeAll']){_0x30c095[_0x8677('0x39')]=[{'all':!![]}];}return db[_0x8677('0x51')][_0x8677('0x3a')](_0x30c095);})[_0x8677('0x1d')](function(_0x3f2dd9){_0x397609['rows']=_0x3f2dd9;return _0x397609;});}})['then'](respondWithFilteredResult(_0x34628e,_0x30c095))[_0x8677('0x3c')](handleError(_0x34628e,null));};exports[_0x8677('0x52')]=function(_0x58eb98,_0x4eca10,_0x3eaf78){var _0x4788c4={};var _0x221566={};var _0xd49bf7;var _0xcf127b;return db[_0x8677('0x22')]['findOne']({'where':{'id':_0x58eb98[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x4eca10,null))['then'](function(_0x273190){if(_0x273190){_0xd49bf7=_0x273190;_0x221566[_0x8677('0x23')]=_[_0x8677('0x24')](db[_0x8677('0x53')]['rawAttributes']);_0x221566[_0x8677('0x25')]=_[_0x8677('0x24')](_0x58eb98['query']);_0x221566[_0x8677('0x31')]=_[_0x8677('0x28')](_0x221566[_0x8677('0x23')],_0x221566[_0x8677('0x25')]);_0x4788c4[_0x8677('0x2a')]=_[_0x8677('0x28')](_0x221566[_0x8677('0x23')],qs[_0x8677('0x29')](_0x58eb98[_0x8677('0x25')][_0x8677('0x29')]));_0x4788c4[_0x8677('0x2a')]=_0x4788c4['attributes'][_0x8677('0x2b')]?_0x4788c4['attributes']:_0x221566['model'];_0x4788c4[_0x8677('0x2e')]=qs[_0x8677('0x2f')](_0x58eb98['query'][_0x8677('0x2f')]);_0x4788c4[_0x8677('0x30')]=qs[_0x8677('0x31')](_[_0x8677('0x4c')](_0x58eb98['query'],_0x221566['filters']));if(_0x58eb98[_0x8677('0x25')][_0x8677('0x35')]){_0x4788c4[_0x8677('0x30')]=_[_0x8677('0x34')](_0x4788c4[_0x8677('0x30')],{'$or':_['map'](_0x4788c4[_0x8677('0x2a')],function(_0x2016d7){var _0x5eb180={};_0x5eb180[_0x2016d7]={'$like':'%'+_0x58eb98[_0x8677('0x25')][_0x8677('0x35')]+'%'};return _0x5eb180;})});}_0x4788c4=_[_0x8677('0x34')]({},_0x4788c4,_0x58eb98['options']);return _0xd49bf7[_0x8677('0x52')](_0x4788c4);}})['then'](function(_0x1fd2b6){if(_0x1fd2b6){_0xcf127b=_0x1fd2b6[_0x8677('0x2b')];if(!_0x58eb98['query'][_0x8677('0x2c')](_0x8677('0x2d'))){_0x4788c4[_0x8677('0x17')]=qs[_0x8677('0x17')](_0x58eb98[_0x8677('0x25')][_0x8677('0x17')]);_0x4788c4[_0x8677('0x16')]=qs[_0x8677('0x16')](_0x58eb98[_0x8677('0x25')]['offset']);}return _0xd49bf7[_0x8677('0x52')](_0x4788c4);}})[_0x8677('0x1d')](function(_0x277edc){if(_0x277edc){return _0x277edc?{'count':_0xcf127b,'rows':_0x277edc}:null;}})['then'](respondWithResult(_0x4eca10,null))[_0x8677('0x3c')](handleError(_0x4eca10,null));};exports['addTeams']=function(_0x4e0a99,_0x5533b1,_0xfb8a3d){var _0x46f802=[];var _0x557f95;return db[_0x8677('0x53')][_0x8677('0x3a')]({'where':{'id':_0x4e0a99['body'][_0x8677('0x54')]},'attributes':['id'],'include':[{'model':db[_0x8677('0x55')],'as':_0x8677('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8677('0x1d')](function(_0x474996){if(_0x474996){for(var _0x59ae88=0x0;_0x59ae88<_0x474996['length'];_0x59ae88+=0x1){for(var _0x5ed0fa=0x0;_0x5ed0fa<_0x474996[_0x59ae88][_0x8677('0x56')][_0x8677('0x2b')];_0x5ed0fa+=0x1){_0x46f802=_[_0x8677('0x57')](_0x46f802,[_0x474996[_0x59ae88]['Agents'][_0x5ed0fa]['id']]);}}return _0x46f802;}})['then'](function(_0x59e3c1){if(_0x59e3c1){return db[_0x8677('0x22')][_0x8677('0x3f')]({'where':{'id':_0x4e0a99[_0x8677('0x3e')]['id']}});}})['then'](function(_0x206976){if(_0x206976){_0x557f95=_0x206976;return _0x557f95[_0x8677('0x58')](_0x46f802,{'penalty':_0x4e0a99[_0x8677('0x44')][_0x8677('0x59')]});}})[_0x8677('0x1d')](function(_0x35866a){if(_0x35866a){return _0x557f95[_0x8677('0x5a')](_0x4e0a99[_0x8677('0x44')][_0x8677('0x54')]);}})[_0x8677('0x1d')](handleEntityNotFound(_0x5533b1,null))[_0x8677('0x1d')](respondWithStatusCode(_0x5533b1,null))[_0x8677('0x3c')](handleError(_0x5533b1,null));};exports[_0x8677('0x5b')]=function(_0x4d9b03,_0x55e4b3,_0x244473){var _0x2d96df=[];var _0x4c380c;return db[_0x8677('0x53')][_0x8677('0x3a')]({'where':{'id':_0x4d9b03[_0x8677('0x25')][_0x8677('0x54')]},'attributes':['id'],'include':[{'model':db[_0x8677('0x55')],'as':_0x8677('0x56'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x39791a){if(_0x39791a){for(var _0x30095a=0x0;_0x30095a<_0x39791a[_0x8677('0x2b')];_0x30095a+=0x1){for(var _0xbd9401=0x0;_0xbd9401<_0x39791a[_0x30095a][_0x8677('0x56')][_0x8677('0x2b')];_0xbd9401+=0x1){_0x2d96df=_[_0x8677('0x57')](_0x2d96df,[_0x39791a[_0x30095a][_0x8677('0x56')][_0xbd9401]['id']]);}}return _0x2d96df;}})[_0x8677('0x1d')](function(_0xe32756){if(_0xe32756){return db['VoiceQueue'][_0x8677('0x3f')]({'where':{'id':_0x4d9b03['params']['id']}});}})['then'](function(_0x2114d6){if(_0x2114d6){_0x4c380c=_0x2114d6;return _0x4c380c[_0x8677('0x5c')](_0x2d96df);}})[_0x8677('0x1d')](function(_0x314b17){if(_0x4c380c){return _0x4c380c[_0x8677('0x5b')](_0x4d9b03[_0x8677('0x25')][_0x8677('0x54')]);}})[_0x8677('0x1d')](handleEntityNotFound(_0x55e4b3,null))[_0x8677('0x1d')](respondWithStatusCode(_0x55e4b3,null))[_0x8677('0x3c')](handleError(_0x55e4b3,null));};exports['addAgents']=function(_0x91a760,_0x371137,_0x2c0d1e){var _0x31a327,_0x3df110;return db[_0x8677('0x22')][_0x8677('0x3f')]({'where':{'id':_0x91a760['params']['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x371137,null))[_0x8677('0x1d')](function(_0x55a05b){if(_0x55a05b){_0x3df110=_0x55a05b;return _0x55a05b[_0x8677('0x58')](_0x91a760['body'][_0x8677('0x54')],_[_0x8677('0x43')](_0x91a760['body'],['ids','id'])||{})[_0x8677('0x5d')](function(_0x38e2d2){for(var _0x2501e5=0x0;_0x2501e5<_0x91a760['body'][_0x8677('0x54')][_0x8677('0x2b')];_0x2501e5+=0x1){socket[_0x8677('0x5e')]('userVoiceQueue:save',{'UserId':_0x91a760['body'][_0x8677('0x54')][_0x2501e5],'VoiceQueueId':_0x91a760[_0x8677('0x3e')]['id']});}return _0x38e2d2;});}})[_0x8677('0x1d')](function(_0x59efa5){_0x31a327=_0x59efa5||[];if(_0x3df110){return db[_0x8677('0x55')][_0x8677('0x3a')]({'where':{'id':_0x91a760['body'][_0x8677('0x54')]},'attributes':['id',_0x8677('0x1f'),_0x8677('0x5f'),_0x8677('0x60')],'raw':!![]});}})[_0x8677('0x1d')](function(_0x2ef0aa){if(_0x2ef0aa&&_0x2ef0aa[_0x8677('0x2b')]){var _0x362b59=[];for(var _0x25e468=0x0;_0x25e468<_0x2ef0aa[_0x8677('0x2b')];_0x25e468++){_0x362b59[_0x8677('0x61')](db[_0x8677('0x62')][_0x8677('0x63')]({'membername':_0x2ef0aa[_0x25e468][_0x8677('0x1f')],'UserId':_0x2ef0aa[_0x25e468]['id'],'queue_name':_0x3df110[_0x8677('0x1f')],'VoiceQueueId':_0x3df110['id'],'interface':util[_0x8677('0x64')](_0x8677('0x65'),_0x8677('0x66'),_0x2ef0aa[_0x25e468][_0x8677('0x1f')]),'paused':_0x2ef0aa[_0x25e468][_0x8677('0x60')]||![],'penalty':_0x91a760[_0x8677('0x44')][_0x8677('0x59')]||0x0}));}return BPromise[_0x8677('0x67')](_0x362b59);}})[_0x8677('0x1d')](function(_0x189247){return _0x31a327;})[_0x8677('0x1d')](respondWithResult(_0x371137,null))[_0x8677('0x3c')](handleError(_0x371137,null));};exports['removeAgents']=function(_0x467a32,_0x2cf5d2,_0x236885){var _0x431cf4;return db['VoiceQueue']['find']({'where':{'id':_0x467a32[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x2cf5d2,null))[_0x8677('0x1d')](function(_0x39335b){if(_0x39335b){return _0x39335b['removeAgents'](_0x467a32['query'][_0x8677('0x54')])[_0x8677('0x1d')](function(_0x186d24){if(_[_0x8677('0x68')](_0x467a32['query']['ids'])){for(var _0x3c4fc2=0x0;_0x3c4fc2<_0x467a32[_0x8677('0x25')][_0x8677('0x54')][_0x8677('0x2b')];_0x3c4fc2+=0x1){socket[_0x8677('0x5e')](_0x8677('0x69'),{'UserId':_0x467a32[_0x8677('0x25')][_0x8677('0x54')][_0x3c4fc2],'VoiceQueueId':_0x467a32['params']['id']});}}else{socket['emit'](_0x8677('0x69'),{'UserId':_0x467a32[_0x8677('0x25')][_0x8677('0x54')],'VoiceQueueId':_0x467a32[_0x8677('0x3e')]['id']});}});}})[_0x8677('0x1d')](function(_0x14db0c){if(_0x467a32['query'][_0x8677('0x6a')]){_0x431cf4=_0x14db0c;return db[_0x8677('0x62')][_0x8677('0x47')]({'where':{'VoiceQueueId':_0x467a32[_0x8677('0x3e')]['id'],'UserId':_0x467a32['query'][_0x8677('0x54')]}})[_0x8677('0x1d')](function(){return _0x431cf4;});}})[_0x8677('0x1d')](respondWithStatusCode(_0x2cf5d2,null))[_0x8677('0x3c')](handleError(_0x2cf5d2,null));};exports[_0x8677('0x6b')]=function(_0x442a2f,_0x1ff399,_0x523525){var _0x39780a={};var _0x4a5d2f={};var _0x328631;var _0x525cfa;return db[_0x8677('0x22')][_0x8677('0x4a')]({'where':{'id':_0x442a2f[_0x8677('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1ff399,null))['then'](function(_0x3b2309){if(_0x3b2309){_0x328631=_0x3b2309;_0x4a5d2f[_0x8677('0x23')]=_[_0x8677('0x24')](db[_0x8677('0x55')]['rawAttributes']);_0x4a5d2f['query']=_[_0x8677('0x24')](_0x442a2f[_0x8677('0x25')]);_0x4a5d2f[_0x8677('0x31')]=_[_0x8677('0x28')](_0x4a5d2f[_0x8677('0x23')],_0x4a5d2f[_0x8677('0x25')]);_0x39780a[_0x8677('0x2a')]=_[_0x8677('0x28')](_0x4a5d2f[_0x8677('0x23')],qs[_0x8677('0x29')](_0x442a2f[_0x8677('0x25')]['fields']));_0x39780a['attributes']=_0x39780a[_0x8677('0x2a')][_0x8677('0x2b')]?_0x39780a[_0x8677('0x2a')]:_0x4a5d2f[_0x8677('0x23')];_0x39780a[_0x8677('0x2e')]=qs[_0x8677('0x2f')](_0x442a2f[_0x8677('0x25')][_0x8677('0x2f')]);_0x39780a[_0x8677('0x30')]=qs[_0x8677('0x31')](_[_0x8677('0x4c')](_0x442a2f['query'],_0x4a5d2f[_0x8677('0x31')]));if(_0x442a2f['query']['filter']){_0x39780a['where']=_[_0x8677('0x34')](_0x39780a[_0x8677('0x30')],{'$or':_[_0x8677('0x36')](_0x39780a[_0x8677('0x2a')],function(_0x40729b){var _0x326cd4={};_0x326cd4[_0x40729b]={'$like':'%'+_0x442a2f[_0x8677('0x25')][_0x8677('0x35')]+'%'};return _0x326cd4;})});}_0x39780a=_[_0x8677('0x34')]({},_0x39780a,_0x442a2f[_0x8677('0x37')]);return _0x328631[_0x8677('0x6b')](_0x39780a);}})[_0x8677('0x1d')](function(_0x12a267){if(_0x12a267){_0x525cfa=_0x12a267[_0x8677('0x2b')];if(!_0x442a2f[_0x8677('0x25')][_0x8677('0x2c')]('nolimit')){_0x39780a[_0x8677('0x17')]=qs['limit'](_0x442a2f[_0x8677('0x25')][_0x8677('0x17')]);_0x39780a[_0x8677('0x16')]=qs['offset'](_0x442a2f[_0x8677('0x25')][_0x8677('0x16')]);}return _0x328631[_0x8677('0x6b')](_0x39780a);}})[_0x8677('0x1d')](function(_0xbc15f0){if(_0xbc15f0){return _0xbc15f0?{'count':_0x525cfa,'rows':_0xbc15f0}:null;}})['then'](respondWithResult(_0x1ff399,null))[_0x8677('0x3c')](handleError(_0x1ff399,null));};exports['getMembers']=function(_0x431a06,_0x90dfb4,_0x38a9b3){var _0x4864e3={};var _0x457b88={};var _0x1bafd0;var _0x3af41e;return db[_0x8677('0x22')][_0x8677('0x4a')]({'where':{'id':_0x431a06[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x90dfb4,null))[_0x8677('0x1d')](function(_0x64c74b){if(_0x64c74b){_0x1bafd0=_0x64c74b;_0x457b88['model']=_['keys'](db[_0x8677('0x62')][_0x8677('0x48')]);_0x457b88[_0x8677('0x25')]=_[_0x8677('0x24')](_0x431a06['query']);_0x457b88[_0x8677('0x31')]=_[_0x8677('0x28')](_0x457b88['model'],_0x457b88[_0x8677('0x25')]);_0x4864e3['attributes']=_[_0x8677('0x28')](_0x457b88[_0x8677('0x23')],qs['fields'](_0x431a06[_0x8677('0x25')][_0x8677('0x29')]));_0x4864e3[_0x8677('0x2a')]=_0x4864e3[_0x8677('0x2a')]['length']?_0x4864e3[_0x8677('0x2a')]:_0x457b88['model'];_0x4864e3['order']=qs[_0x8677('0x2f')](_0x431a06['query'][_0x8677('0x2f')]);_0x4864e3[_0x8677('0x30')]=qs[_0x8677('0x31')](_['pick'](_0x431a06[_0x8677('0x25')],_0x457b88['filters']));if(_0x431a06[_0x8677('0x25')][_0x8677('0x35')]){_0x4864e3[_0x8677('0x30')]=_['merge'](_0x4864e3[_0x8677('0x30')],{'$or':_[_0x8677('0x36')](_0x4864e3['attributes'],function(_0x3bebbe){var _0x56334e={};_0x56334e[_0x3bebbe]={'$like':'%'+_0x431a06[_0x8677('0x25')]['filter']+'%'};return _0x56334e;})});}_0x4864e3=_[_0x8677('0x34')]({},_0x4864e3,_0x431a06['options']);return _0x1bafd0[_0x8677('0x6c')](_0x4864e3);}})[_0x8677('0x1d')](function(_0x4c94a8){if(_0x4c94a8){_0x3af41e=_0x4c94a8[_0x8677('0x2b')];if(!_0x431a06[_0x8677('0x25')][_0x8677('0x2c')](_0x8677('0x2d'))){_0x4864e3[_0x8677('0x17')]=qs[_0x8677('0x17')](_0x431a06[_0x8677('0x25')]['limit']);_0x4864e3[_0x8677('0x16')]=qs['offset'](_0x431a06[_0x8677('0x25')]['offset']);}return _0x1bafd0[_0x8677('0x6c')](_0x4864e3);}})['then'](function(_0x20c79b){return _0x20c79b?{'count':_0x3af41e,'rows':_0x20c79b}:null;})[_0x8677('0x1d')](respondWithResult(_0x90dfb4,null))['catch'](handleError(_0x90dfb4,null));};exports[_0x8677('0x6d')]=function(_0x128e3d,_0x5cf10a,_0x19adbc){var _0x5d64e7={};var _0x35b3ae={};var _0x26cd51;var _0x1decf4;return db[_0x8677('0x22')]['findOne']({'where':{'id':_0x128e3d[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x5cf10a,null))[_0x8677('0x1d')](function(_0x3c90de){if(_0x3c90de){_0x26cd51=_0x3c90de;_0x35b3ae[_0x8677('0x23')]=_[_0x8677('0x24')](db['CmList']['rawAttributes']);_0x35b3ae[_0x8677('0x25')]=_[_0x8677('0x24')](_0x128e3d[_0x8677('0x25')]);_0x35b3ae[_0x8677('0x31')]=_[_0x8677('0x28')](_0x35b3ae[_0x8677('0x23')],_0x35b3ae['query']);_0x5d64e7[_0x8677('0x2a')]=_[_0x8677('0x28')](_0x35b3ae['model'],qs[_0x8677('0x29')](_0x128e3d[_0x8677('0x25')][_0x8677('0x29')]));_0x5d64e7[_0x8677('0x2a')]=_0x5d64e7[_0x8677('0x2a')][_0x8677('0x2b')]?_0x5d64e7[_0x8677('0x2a')]:_0x35b3ae[_0x8677('0x23')];_0x5d64e7[_0x8677('0x2e')]=qs[_0x8677('0x2f')](_0x128e3d[_0x8677('0x25')]['sort']);_0x5d64e7[_0x8677('0x30')]=qs['filters'](_[_0x8677('0x4c')](_0x128e3d[_0x8677('0x25')],_0x35b3ae[_0x8677('0x31')]));if(_0x128e3d[_0x8677('0x25')]['filter']){_0x5d64e7['where']=_[_0x8677('0x34')](_0x5d64e7[_0x8677('0x30')],{'$or':_[_0x8677('0x36')](_0x5d64e7['attributes'],function(_0x2dcbf9){var _0x2b5dd2={};_0x2b5dd2[_0x2dcbf9]={'$like':'%'+_0x128e3d[_0x8677('0x25')][_0x8677('0x35')]+'%'};return _0x2b5dd2;})});}_0x5d64e7=_[_0x8677('0x34')]({},_0x5d64e7,_0x128e3d[_0x8677('0x37')]);return _0x26cd51[_0x8677('0x6d')](_0x5d64e7);}})[_0x8677('0x1d')](function(_0x408ac8){if(_0x408ac8){_0x1decf4=_0x408ac8[_0x8677('0x2b')];if(!_0x128e3d['query'][_0x8677('0x2c')](_0x8677('0x2d'))){_0x5d64e7[_0x8677('0x17')]=qs[_0x8677('0x17')](_0x128e3d[_0x8677('0x25')][_0x8677('0x17')]);_0x5d64e7[_0x8677('0x16')]=qs['offset'](_0x128e3d[_0x8677('0x25')][_0x8677('0x16')]);}return _0x26cd51[_0x8677('0x6d')](_0x5d64e7);}})[_0x8677('0x1d')](function(_0x32a02b){if(_0x32a02b){return _0x32a02b?{'count':_0x1decf4,'rows':_0x32a02b}:null;}})[_0x8677('0x1d')](respondWithResult(_0x5cf10a,null))[_0x8677('0x3c')](handleError(_0x5cf10a,null));};exports[_0x8677('0x6e')]=function(_0x98651e,_0x514fbd,_0x188085){var _0x41030e,_0x16ecd2;return db[_0x8677('0x22')][_0x8677('0x3f')]({'where':{'id':_0x98651e[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x514fbd,null))[_0x8677('0x1d')](function(_0x439486){if(_0x439486){_0x16ecd2=_0x439486;return _0x439486[_0x8677('0x6e')](_0x98651e[_0x8677('0x44')][_0x8677('0x54')],_['omit'](_0x98651e[_0x8677('0x44')],[_0x8677('0x54'),'id'])||{});}return null;})[_0x8677('0x5d')](function(_0x56b613){var _0x29b4b6;_0x41030e=_0x56b613||[];var _0x315da2=[];if(_0x56b613){for(var _0x43c5e9=0x0;_0x43c5e9<_0x56b613['length'];_0x43c5e9+=0x1){var _0xce031e=_0x56b613[_0x43c5e9][_0x8677('0x42')]({'plain':!![]});_0x16ecd2[_0x8677('0x6f')]=_0x98651e[_0x8677('0x44')][_0x8677('0x6f')]?_0x98651e[_0x8677('0x44')][_0x8677('0x6f')]:_0x16ecd2[_0x8677('0x6f')];switch(_0x16ecd2[_0x8677('0x6f')]){case _0x8677('0x70'):_0x29b4b6=squel['insert']()['into'](_0x8677('0x71'))['fromQuery']([_0x8677('0x72'),'scheduledAt','ContactId','ListId','VoiceQueueId',_0x8677('0x45'),'updatedAt'],squel['select']()[_0x8677('0x73')](_0x8677('0x72'),'phone')[_0x8677('0x73')](_0x8677('0x74'),_0x8677('0x75'))[_0x8677('0x73')]('id',_0x8677('0x76'))['field'](_0xce031e[_0x8677('0x77')][_0x8677('0x78')](),'ListId')[_0x8677('0x73')](_0x98651e[_0x8677('0x3e')]['id'][_0x8677('0x78')](),_0x8677('0x4d'))['field']('NOW()',_0x8677('0x45'))[_0x8677('0x73')](_0x8677('0x74'),'updatedAt')[_0x8677('0x79')]('cm_contacts')[_0x8677('0x30')]('deletedAt\x20IS\x20NULL')[_0x8677('0x30')](_0x8677('0x7a'),_0xce031e[_0x8677('0x77')][_0x8677('0x78')]())[_0x8677('0x30')](_0x8677('0x7b'))['where'](_0x8677('0x7c'),squel[_0x8677('0x7d')]()['field']('calleridnum')[_0x8677('0x79')](_0x8677('0x7e'))[_0x8677('0x30')]('VoiceQueueId\x20=\x20?',_0x98651e[_0x8677('0x3e')]['id'][_0x8677('0x78')]()))['where'](_0x8677('0x7c'),squel['select']()[_0x8677('0x73')](_0x8677('0x72'))[_0x8677('0x79')](_0x8677('0x71'))['where'](_0x8677('0x7f'),_0x98651e[_0x8677('0x3e')]['id'][_0x8677('0x78')]())))[_0x8677('0x78')]();break;case _0x8677('0x80'):_0x29b4b6=squel['insert']()[_0x8677('0x81')](_0x8677('0x71'))['fromQuery']([_0x8677('0x72'),'scheduledAt',_0x8677('0x76'),_0x8677('0x82'),_0x8677('0x4d'),_0x8677('0x45'),'updatedAt'],squel['select']()[_0x8677('0x73')](_0x8677('0x72'),_0x8677('0x72'))[_0x8677('0x73')](_0x8677('0x74'),_0x8677('0x75'))[_0x8677('0x73')]('id','ContactId')[_0x8677('0x73')](_0xce031e['CmListId'][_0x8677('0x78')](),_0x8677('0x82'))['field'](_0x98651e['params']['id'][_0x8677('0x78')](),'VoiceQueueId')['field']('NOW()','createdAt')[_0x8677('0x73')]('NOW()',_0x8677('0x46'))[_0x8677('0x79')](_0x8677('0x83'))['where'](_0x8677('0x84'))[_0x8677('0x30')](_0x8677('0x7a'),_0xce031e['CmListId'][_0x8677('0x78')]())[_0x8677('0x30')]('phone\x20IS\x20NOT\x20NULL')[_0x8677('0x30')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x8677('0x73')](_0x8677('0x72'))[_0x8677('0x79')](_0x8677('0x71'))[_0x8677('0x30')](_0x8677('0x7f'),_0x98651e[_0x8677('0x3e')]['id'][_0x8677('0x78')]())))[_0x8677('0x78')]();break;default:_0x29b4b6=squel[_0x8677('0x85')]()['into'](_0x8677('0x71'))[_0x8677('0x86')]([_0x8677('0x72'),_0x8677('0x75'),_0x8677('0x76'),_0x8677('0x82'),_0x8677('0x4d'),_0x8677('0x45'),_0x8677('0x46')],squel['select']()['field'](_0x8677('0x72'),_0x8677('0x72'))[_0x8677('0x73')](_0x8677('0x74'),'scheduledAt')[_0x8677('0x73')]('id',_0x8677('0x76'))[_0x8677('0x73')](_0xce031e[_0x8677('0x77')][_0x8677('0x78')](),_0x8677('0x82'))['field'](_0x98651e[_0x8677('0x3e')]['id'][_0x8677('0x78')](),_0x8677('0x4d'))[_0x8677('0x73')](_0x8677('0x74'),_0x8677('0x45'))['field'](_0x8677('0x74'),_0x8677('0x46'))[_0x8677('0x79')]('cm_contacts')['where'](_0x8677('0x84'))[_0x8677('0x30')]('ListId\x20=\x20?',_0xce031e[_0x8677('0x77')][_0x8677('0x78')]())[_0x8677('0x30')](_0x8677('0x7b')))[_0x8677('0x78')]();}_0x315da2['push'](db[_0x8677('0x87')][_0x8677('0x25')](_0x29b4b6));}return BPromise[_0x8677('0x67')](_0x315da2);}})[_0x8677('0x1d')](function(){return _0x41030e;})[_0x8677('0x1d')](respondWithResult(_0x514fbd,null))['catch'](handleError(_0x514fbd,null));};exports[_0x8677('0x88')]=function(_0x351a98,_0x279630,_0x5b60b6){var _0x20fd80;return db[_0x8677('0x22')]['find']({'where':{'id':_0x351a98['params']['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x279630,null))[_0x8677('0x1d')](function(_0x4bde75){if(_0x4bde75){return _0x4bde75[_0x8677('0x88')](_0x351a98[_0x8677('0x25')][_0x8677('0x54')]);}})['then'](function(_0x463cb5){if(_0x463cb5){_0x20fd80=_0x463cb5;return db[_0x8677('0x49')][_0x8677('0x47')]({'where':{'ListId':_0x351a98[_0x8677('0x25')][_0x8677('0x54')],'VoiceQueueId':_0x351a98[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](function(){return _0x20fd80;});}})['then'](respondWithStatusCode(_0x279630,null))[_0x8677('0x3c')](handleError(_0x279630,null));};exports[_0x8677('0x89')]=function(_0x217177,_0x2fcba2,_0x5a873d){var _0x3ad253={};var _0x4a4919={};var _0x2f57b8;var _0x1d7895;return db['VoiceQueue'][_0x8677('0x4a')]({'where':{'id':_0x217177[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x2fcba2,null))[_0x8677('0x1d')](function(_0x4e09ed){if(_0x4e09ed){_0x2f57b8=_0x4e09ed;_0x4a4919['model']=_[_0x8677('0x24')](db[_0x8677('0x8a')][_0x8677('0x48')]);_0x4a4919[_0x8677('0x25')]=_[_0x8677('0x24')](_0x217177[_0x8677('0x25')]);_0x4a4919[_0x8677('0x31')]=_['intersection'](_0x4a4919[_0x8677('0x23')],_0x4a4919['query']);_0x3ad253[_0x8677('0x2a')]=_[_0x8677('0x28')](_0x4a4919[_0x8677('0x23')],qs[_0x8677('0x29')](_0x217177[_0x8677('0x25')][_0x8677('0x29')]));_0x3ad253[_0x8677('0x2a')]=_0x3ad253['attributes'][_0x8677('0x2b')]?_0x3ad253[_0x8677('0x2a')]:_0x4a4919[_0x8677('0x23')];_0x3ad253['order']=qs[_0x8677('0x2f')](_0x217177['query'][_0x8677('0x2f')]);_0x3ad253['where']=qs[_0x8677('0x31')](_['pick'](_0x217177[_0x8677('0x25')],_0x4a4919[_0x8677('0x31')]));if(_0x217177[_0x8677('0x25')][_0x8677('0x35')]){_0x3ad253[_0x8677('0x30')]=_[_0x8677('0x34')](_0x3ad253[_0x8677('0x30')],{'$or':_[_0x8677('0x36')](_0x3ad253[_0x8677('0x2a')],function(_0x2db85a){var _0x272632={};_0x272632[_0x2db85a]={'$like':'%'+_0x217177[_0x8677('0x25')][_0x8677('0x35')]+'%'};return _0x272632;})});}_0x3ad253=_[_0x8677('0x34')]({},_0x3ad253,_0x217177[_0x8677('0x37')]);return _0x2f57b8['getBlackLists'](_0x3ad253);}})['then'](function(_0x46d22c){if(_0x46d22c){_0x1d7895=_0x46d22c[_0x8677('0x2b')];if(!_0x217177[_0x8677('0x25')]['hasOwnProperty'](_0x8677('0x2d'))){_0x3ad253[_0x8677('0x17')]=qs[_0x8677('0x17')](_0x217177[_0x8677('0x25')]['limit']);_0x3ad253[_0x8677('0x16')]=qs['offset'](_0x217177[_0x8677('0x25')][_0x8677('0x16')]);}return _0x2f57b8[_0x8677('0x89')](_0x3ad253);}})[_0x8677('0x1d')](function(_0x1ce361){if(_0x1ce361){return _0x1ce361?{'count':_0x1d7895,'rows':_0x1ce361}:null;}})[_0x8677('0x1d')](respondWithResult(_0x2fcba2,null))[_0x8677('0x3c')](handleError(_0x2fcba2,null));};exports[_0x8677('0x8b')]=function(_0x2fca37,_0x15d566,_0x10f0a7){var _0x185e5c,_0x2caa21;return db[_0x8677('0x22')][_0x8677('0x3f')]({'where':{'id':_0x2fca37[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x15d566,null))['then'](function(_0x1e3eb3){if(_0x1e3eb3){_0x2caa21=_0x1e3eb3;return _0x1e3eb3['addBlackLists'](_0x2fca37[_0x8677('0x44')][_0x8677('0x54')],_[_0x8677('0x43')](_0x2fca37[_0x8677('0x44')],[_0x8677('0x54'),'id'])||{});}return null;})[_0x8677('0x5d')](function(_0x4d0f8f){var _0x23dadd;_0x185e5c=_0x4d0f8f||[];var _0x1c1b4e=[];if(_0x4d0f8f){for(var _0x2bffa9=0x0;_0x2bffa9<_0x4d0f8f[_0x8677('0x2b')];_0x2bffa9+=0x1){var _0x38c79d=_0x4d0f8f[_0x2bffa9][_0x8677('0x42')]({'plain':!![]});_0x23dadd=squel['insert']()['into']('cm_hopper_black')[_0x8677('0x86')]([_0x8677('0x72'),'ContactId','ListId',_0x8677('0x4d'),_0x8677('0x45'),_0x8677('0x46')],squel[_0x8677('0x7d')]()[_0x8677('0x73')](_0x8677('0x72'),_0x8677('0x72'))[_0x8677('0x73')]('id','ContactId')['field'](_0x38c79d[_0x8677('0x77')][_0x8677('0x78')](),_0x8677('0x82'))[_0x8677('0x73')](_0x2fca37['params']['id'][_0x8677('0x78')](),_0x8677('0x4d'))[_0x8677('0x73')]('NOW()','createdAt')[_0x8677('0x73')](_0x8677('0x74'),_0x8677('0x46'))[_0x8677('0x79')]('cm_contacts')[_0x8677('0x30')](_0x8677('0x84'))[_0x8677('0x30')](_0x8677('0x7a'),_0x38c79d[_0x8677('0x77')][_0x8677('0x78')]())[_0x8677('0x30')](_0x8677('0x7b')))[_0x8677('0x78')]();_0x1c1b4e['push'](db['sequelize'][_0x8677('0x25')](_0x23dadd));}return BPromise[_0x8677('0x67')](_0x1c1b4e);}})['then'](function(){return _0x185e5c;})[_0x8677('0x1d')](respondWithResult(_0x15d566,null))[_0x8677('0x3c')](handleError(_0x15d566,null));};exports['removeBlackLists']=function(_0x29be2d,_0x5ed5e6,_0x25a491){var _0x1a72bf;return db['VoiceQueue'][_0x8677('0x3f')]({'where':{'id':_0x29be2d[_0x8677('0x3e')]['id']}})[_0x8677('0x1d')](handleEntityNotFound(_0x5ed5e6,null))[_0x8677('0x1d')](function(_0x26eb05){if(_0x26eb05){return _0x26eb05[_0x8677('0x8c')](_0x29be2d[_0x8677('0x25')][_0x8677('0x54')]);}})['then'](function(_0x5bc227){if(_0x5bc227){_0x1a72bf=_0x5bc227;return db[_0x8677('0x51')][_0x8677('0x47')]({'where':{'ListId':_0x29be2d['query']['ids'],'VoiceQueueId':_0x29be2d[_0x8677('0x3e')]['id']}})['then'](function(){return _0x1a72bf;});}})['then'](respondWithStatusCode(_0x5ed5e6,null))[_0x8677('0x3c')](handleError(_0x5ed5e6,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8be4150..a43d162 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 _0xe032=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe032,0x175));var _0x2e03=function(_0x3f477c,_0x52b7ff){_0x3f477c=_0x3f477c-0x0;var _0x4c36b3=_0xe032[_0x3f477c];return _0x4c36b3;};'use strict';var EventEmitter=require(_0x2e03('0x0'));var VoiceQueue=require(_0x2e03('0x1'))['db'][_0x2e03('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2e03('0x3')](0x0);var events={'afterCreate':_0x2e03('0x4'),'afterUpdate':_0x2e03('0x5'),'afterDestroy':_0x2e03('0x6')};function emitEvent(_0x480893){return function(_0x172656,_0x58db1e,_0x1066e3){VoiceQueueEvents['emit'](_0x480893+':'+_0x172656['id'],_0x172656);VoiceQueueEvents[_0x2e03('0x7')](_0x480893,_0x172656);_0x1066e3(null);};}for(var e in events){if(events[_0x2e03('0x8')](e)){var event=events[e];VoiceQueue[_0x2e03('0x9')](e,emitEvent(event));}}module[_0x2e03('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x119c=['save','emit','hook','events','VoiceQueue','setMaxListeners'];(function(_0x40ca0c,_0x1d3ce0){var _0x5a1c45=function(_0x195a7c){while(--_0x195a7c){_0x40ca0c['push'](_0x40ca0c['shift']());}};_0x5a1c45(++_0x1d3ce0);}(_0x119c,0xa5));var _0xc119=function(_0x357f0a,_0x37aa60){_0x357f0a=_0x357f0a-0x0;var _0x10d41b=_0x119c[_0x357f0a];return _0x10d41b;};'use strict';var EventEmitter=require(_0xc119('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xc119('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc119('0x2')](0x0);var events={'afterCreate':_0xc119('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x118cd7){return function(_0x471ef0,_0xa35eba,_0x11f48a){VoiceQueueEvents[_0xc119('0x4')](_0x118cd7+':'+_0x471ef0['id'],_0x471ef0);VoiceQueueEvents['emit'](_0x118cd7,_0x471ef0);_0x11f48a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xc119('0x5')](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 a3a322b..0bf3d37 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 _0xb232=['moment','bluebird','request-promise','./voiceQueue.attributes','exports','define','voice_queues','lodash','util','../../config/logger'];(function(_0x2acd64,_0x4e8ce8){var _0x3d3fce=function(_0x5570df){while(--_0x5570df){_0x2acd64['push'](_0x2acd64['shift']());}};_0x3d3fce(++_0x4e8ce8);}(_0xb232,0x197));var _0x2b23=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xb232[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x2b23('0x0'));var util=require(_0x2b23('0x1'));var logger=require(_0x2b23('0x2'))('api');var moment=require(_0x2b23('0x3'));var BPromise=require(_0x2b23('0x4'));var rp=require(_0x2b23('0x5'));var attributes=require(_0x2b23('0x6'));module[_0x2b23('0x7')]=function(_0x37df55,_0x1e1f41){return _0x37df55[_0x2b23('0x8')]('VoiceQueue',attributes,{'tableName':_0x2b23('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b2d=['bluebird','request-promise','./voiceQueue.attributes','exports','define','VoiceQueue','util','../../config/logger','api','moment'];(function(_0x466db0,_0x1dcd73){var _0xbc1887=function(_0x4ad9d4){while(--_0x4ad9d4){_0x466db0['push'](_0x466db0['shift']());}};_0xbc1887(++_0x1dcd73);}(_0x0b2d,0x100));var _0xd0b2=function(_0xe3853b,_0x5bbf8c){_0xe3853b=_0xe3853b-0x0;var _0x20fb3c=_0x0b2d[_0xe3853b];return _0x20fb3c;};'use strict';var _=require('lodash');var util=require(_0xd0b2('0x0'));var logger=require(_0xd0b2('0x1'))(_0xd0b2('0x2'));var moment=require(_0xd0b2('0x3'));var BPromise=require(_0xd0b2('0x4'));var rp=require(_0xd0b2('0x5'));var attributes=require(_0xd0b2('0x6'));module[_0xd0b2('0x7')]=function(_0xf19b51,_0x1af3eb){return _0xf19b51[_0xd0b2('0x8')](_0xd0b2('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1b4010b..ddedbfe 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 _0x430c=['VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','stringify','lodash','bluebird','randomstring','../../mysqldb','jayson/promise','client','socket.io-emitter','./voiceQueue.socket','register','request','then','info'];(function(_0x4cb9f5,_0x296b94){var _0x156c1c=function(_0x5f4859){while(--_0x5f4859){_0x4cb9f5['push'](_0x4cb9f5['shift']());}};_0x156c1c(++_0x296b94);}(_0x430c,0x1a1));var _0xc430=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0x430c[_0x3f25db];return _0x54f29d;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var db=require(_0xc430('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc430('0x4'));var client=jayson[_0xc430('0x5')]['http']({'port':0x232a});var socket=require(_0xc430('0x6'))({'host':'localhost','port':0x18eb});require(_0xc430('0x7'))[_0xc430('0x8')](socket);function respondWithRpcPromise(_0x814a90,_0x13ae66,_0x2e23f8){return new BPromise(function(_0x11f4b0,_0x861581){return client[_0xc430('0x9')](_0x814a90,_0x2e23f8)[_0xc430('0xa')](function(_0x5bbdf9){logger[_0xc430('0xb')](_0xc430('0xc'),_0x13ae66,'request\x20sent');logger[_0xc430('0xd')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x13ae66,_0xc430('0xe'),JSON['stringify'](_0x5bbdf9));if(_0x5bbdf9[_0xc430('0xf')]){if(_0x5bbdf9[_0xc430('0xf')][_0xc430('0x10')]===0x1f4){logger[_0xc430('0xf')](_0xc430('0xc'),_0x13ae66,_0x5bbdf9[_0xc430('0xf')][_0xc430('0x11')]);return _0x861581(_0x5bbdf9['error']['message']);}logger[_0xc430('0xf')](_0xc430('0xc'),_0x13ae66,_0x5bbdf9[_0xc430('0xf')][_0xc430('0x11')]);return _0x11f4b0(_0x5bbdf9[_0xc430('0xf')]['message']);}else{logger[_0xc430('0xb')]('VoiceQueue,\x20%s,\x20%s',_0x13ae66,'request\x20sent');_0x11f4b0(_0x5bbdf9[_0xc430('0x12')][_0xc430('0x11')]);}})[_0xc430('0x13')](function(_0x5830b0){logger['error'](_0xc430('0xc'),_0x13ae66,_0x5830b0);_0x861581(_0x5830b0);});});}exports['GetVoiceQueue']=function(_0x2bcb21){var _0x4f7094=this;return new Promise(function(_0x564522,_0x2f3203){return db['VoiceQueue'][_0xc430('0x14')]({'raw':_0x2bcb21[_0xc430('0x15')]?_0x2bcb21[_0xc430('0x15')][_0xc430('0x16')]===undefined?!![]:![]:!![],'where':_0x2bcb21[_0xc430('0x15')]?_0x2bcb21['options'][_0xc430('0x17')]||null:null,'attributes':_0x2bcb21['options']?_0x2bcb21['options'][_0xc430('0x18')]||null:null,'limit':_0x2bcb21[_0xc430('0x15')]?_0x2bcb21[_0xc430('0x15')]['limit']||null:null,'include':_0x2bcb21[_0xc430('0x15')]?_0x2bcb21['options'][_0xc430('0x19')]?_[_0xc430('0x1a')](_0x2bcb21['options'][_0xc430('0x19')],function(_0x3cdbd3){return{'model':db[_0x3cdbd3['model']],'as':_0x3cdbd3['as'],'attributes':_0x3cdbd3[_0xc430('0x18')],'include':_0x3cdbd3['include']?_[_0xc430('0x1a')](_0x3cdbd3['include'],function(_0x3db397){return{'model':db[_0x3db397[_0xc430('0x1b')]],'as':_0x3db397['as'],'attributes':_0x3db397['attributes'],'include':_0x3db397[_0xc430('0x19')]?_[_0xc430('0x1a')](_0x3db397[_0xc430('0x19')],function(_0x44833e){return{'model':db[_0x44833e[_0xc430('0x1b')]],'as':_0x44833e['as'],'attributes':_0x44833e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc430('0xa')](function(_0x1a9512){logger[_0xc430('0xb')](_0xc430('0x1c'),_0x2bcb21);logger['debug'](_0xc430('0x1c'),_0x2bcb21,JSON['stringify'](_0x1a9512));_0x564522(_0x1a9512);})[_0xc430('0x13')](function(_0x4ad29e){logger[_0xc430('0xf')](_0xc430('0x1c'),_0x4ad29e[_0xc430('0x11')],_0x2bcb21);_0x2f3203(_0x4f7094[_0xc430('0xf')](0x1f4,_0x4ad29e['message']));});});};exports[_0xc430('0x1d')]=function(_0x2a85aa){var _0x2bdfc4=this;return new Promise(function(_0xaec1ed,_0x49ba65){return db[_0xc430('0x1e')][_0xc430('0x1f')]({'raw':_0x2a85aa['options']?_0x2a85aa[_0xc430('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2a85aa['options']?_0x2a85aa[_0xc430('0x15')][_0xc430('0x17')]||null:null,'attributes':_0x2a85aa[_0xc430('0x15')]?_0x2a85aa[_0xc430('0x15')][_0xc430('0x18')]||null:null,'include':_0x2a85aa[_0xc430('0x15')]?_0x2a85aa[_0xc430('0x15')][_0xc430('0x19')]?_['map'](_0x2a85aa[_0xc430('0x15')]['include'],function(_0x119bee){return{'model':db[_0x119bee[_0xc430('0x1b')]],'as':_0x119bee['as'],'attributes':_0x119bee[_0xc430('0x18')],'include':_0x119bee[_0xc430('0x19')]?_['map'](_0x119bee[_0xc430('0x19')],function(_0x510fa1){return{'model':db[_0x510fa1['model']],'as':_0x510fa1['as'],'attributes':_0x510fa1[_0xc430('0x18')],'include':_0x510fa1[_0xc430('0x19')]?_['map'](_0x510fa1[_0xc430('0x19')],function(_0x10e589){return{'model':db[_0x10e589[_0xc430('0x1b')]],'as':_0x10e589['as'],'attributes':_0x10e589[_0xc430('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc430('0xa')](function(_0x2c00a4){logger[_0xc430('0xb')](_0xc430('0x1d'),_0x2a85aa);logger[_0xc430('0xd')](_0xc430('0x1d'),_0x2a85aa,JSON[_0xc430('0x20')](_0x2c00a4));_0xaec1ed(_0x2c00a4);})[_0xc430('0x13')](function(_0x5fd38b){logger[_0xc430('0xf')](_0xc430('0x1d'),_0x5fd38b['message'],_0x2a85aa);_0x49ba65(_0x2bdfc4[_0xc430('0xf')](0x1f4,_0x5fd38b[_0xc430('0x11')]));});});}; \ No newline at end of file +var _0x2675=['message','info','result','catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','include','model','map','ShowVoiceQueue','find','where','lodash','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','socket.io-emitter','localhost','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x3896ea,_0x489972){var _0x3527bf=function(_0xa92d01){while(--_0xa92d01){_0x3896ea['push'](_0x3896ea['shift']());}};_0x3527bf(++_0x489972);}(_0x2675,0x75));var _0x5267=function(_0x591452,_0x8e2274){_0x591452=_0x591452-0x0;var _0x55133b=_0x2675[_0x591452];return _0x55133b;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var db=require(_0x5267('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5267('0x3'))(_0x5267('0x4'));var config=require('../../config/environment');var jayson=require(_0x5267('0x5'));var client=jayson[_0x5267('0x6')][_0x5267('0x7')]({'port':0x232a});var socket=require(_0x5267('0x8'))({'host':_0x5267('0x9'),'port':0x18eb});require(_0x5267('0xa'))['register'](socket);function respondWithRpcPromise(_0x9e0a27,_0x46bfdf,_0x506fd7){return new BPromise(function(_0x799fcc,_0x5d6645){return client[_0x5267('0xb')](_0x9e0a27,_0x506fd7)[_0x5267('0xc')](function(_0x26e22b){logger['info'](_0x5267('0xd'),_0x46bfdf,'request\x20sent');logger[_0x5267('0xe')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x46bfdf,_0x5267('0xf'),JSON[_0x5267('0x10')](_0x26e22b));if(_0x26e22b[_0x5267('0x11')]){if(_0x26e22b[_0x5267('0x11')][_0x5267('0x12')]===0x1f4){logger[_0x5267('0x11')](_0x5267('0xd'),_0x46bfdf,_0x26e22b[_0x5267('0x11')][_0x5267('0x13')]);return _0x5d6645(_0x26e22b[_0x5267('0x11')][_0x5267('0x13')]);}logger[_0x5267('0x11')](_0x5267('0xd'),_0x46bfdf,_0x26e22b['error']['message']);return _0x799fcc(_0x26e22b[_0x5267('0x11')][_0x5267('0x13')]);}else{logger[_0x5267('0x14')](_0x5267('0xd'),_0x46bfdf,_0x5267('0xf'));_0x799fcc(_0x26e22b[_0x5267('0x15')][_0x5267('0x13')]);}})[_0x5267('0x16')](function(_0x15d81e){logger[_0x5267('0x11')](_0x5267('0xd'),_0x46bfdf,_0x15d81e);_0x5d6645(_0x15d81e);});});}exports[_0x5267('0x17')]=function(_0x528d61){var _0x18f32e=this;return new Promise(function(_0x2afd38,_0x5069e8){return db[_0x5267('0x18')]['findAll']({'raw':_0x528d61[_0x5267('0x19')]?_0x528d61[_0x5267('0x19')][_0x5267('0x1a')]===undefined?!![]:![]:!![],'where':_0x528d61[_0x5267('0x19')]?_0x528d61[_0x5267('0x19')]['where']||null:null,'attributes':_0x528d61[_0x5267('0x19')]?_0x528d61['options'][_0x5267('0x1b')]||null:null,'limit':_0x528d61[_0x5267('0x19')]?_0x528d61[_0x5267('0x19')]['limit']||null:null,'include':_0x528d61['options']?_0x528d61['options']['include']?_['map'](_0x528d61[_0x5267('0x19')][_0x5267('0x1c')],function(_0x2d761d){return{'model':db[_0x2d761d[_0x5267('0x1d')]],'as':_0x2d761d['as'],'attributes':_0x2d761d[_0x5267('0x1b')],'include':_0x2d761d[_0x5267('0x1c')]?_[_0x5267('0x1e')](_0x2d761d[_0x5267('0x1c')],function(_0x2cdc45){return{'model':db[_0x2cdc45['model']],'as':_0x2cdc45['as'],'attributes':_0x2cdc45['attributes'],'include':_0x2cdc45[_0x5267('0x1c')]?_[_0x5267('0x1e')](_0x2cdc45['include'],function(_0x45373e){return{'model':db[_0x45373e['model']],'as':_0x45373e['as'],'attributes':_0x45373e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5267('0xc')](function(_0x273769){logger[_0x5267('0x14')](_0x5267('0x17'),_0x528d61);logger[_0x5267('0xe')]('GetVoiceQueue',_0x528d61,JSON['stringify'](_0x273769));_0x2afd38(_0x273769);})[_0x5267('0x16')](function(_0x10a68c){logger[_0x5267('0x11')]('GetVoiceQueue',_0x10a68c['message'],_0x528d61);_0x5069e8(_0x18f32e[_0x5267('0x11')](0x1f4,_0x10a68c[_0x5267('0x13')]));});});};exports[_0x5267('0x1f')]=function(_0x5bec7e){var _0x59b091=this;return new Promise(function(_0x2249a1,_0xc7691d){return db[_0x5267('0x18')][_0x5267('0x20')]({'raw':_0x5bec7e['options']?_0x5bec7e[_0x5267('0x19')][_0x5267('0x1a')]===undefined?!![]:![]:!![],'where':_0x5bec7e[_0x5267('0x19')]?_0x5bec7e[_0x5267('0x19')][_0x5267('0x21')]||null:null,'attributes':_0x5bec7e[_0x5267('0x19')]?_0x5bec7e[_0x5267('0x19')][_0x5267('0x1b')]||null:null,'include':_0x5bec7e['options']?_0x5bec7e['options'][_0x5267('0x1c')]?_['map'](_0x5bec7e[_0x5267('0x19')][_0x5267('0x1c')],function(_0x2b963e){return{'model':db[_0x2b963e[_0x5267('0x1d')]],'as':_0x2b963e['as'],'attributes':_0x2b963e['attributes'],'include':_0x2b963e[_0x5267('0x1c')]?_[_0x5267('0x1e')](_0x2b963e[_0x5267('0x1c')],function(_0x1b79a3){return{'model':db[_0x1b79a3[_0x5267('0x1d')]],'as':_0x1b79a3['as'],'attributes':_0x1b79a3[_0x5267('0x1b')],'include':_0x1b79a3[_0x5267('0x1c')]?_[_0x5267('0x1e')](_0x1b79a3['include'],function(_0x1b297c){return{'model':db[_0x1b297c['model']],'as':_0x1b297c['as'],'attributes':_0x1b297c[_0x5267('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5267('0xc')](function(_0x1d1617){logger[_0x5267('0x14')](_0x5267('0x1f'),_0x5bec7e);logger[_0x5267('0xe')](_0x5267('0x1f'),_0x5bec7e,JSON['stringify'](_0x1d1617));_0x2249a1(_0x1d1617);})[_0x5267('0x16')](function(_0x3a2e07){logger[_0x5267('0x11')](_0x5267('0x1f'),_0x3a2e07[_0x5267('0x13')],_0x5bec7e);_0xc7691d(_0x59b091[_0x5267('0x11')](0x1f4,_0x3a2e07[_0x5267('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9a3e414..26fccaf 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 _0x2fdf=['length','./voiceQueue.events','remove','emit','removeListener'];(function(_0x57f993,_0x151301){var _0x59aa06=function(_0x17d791){while(--_0x17d791){_0x57f993['push'](_0x57f993['shift']());}};_0x59aa06(++_0x151301);}(_0x2fdf,0xbf));var _0xf2fd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2fdf[_0x432682];return _0x463d05;};'use strict';var VoiceQueueEvents=require(_0xf2fd('0x0'));var events=['save',_0xf2fd('0x1'),'update'];function createListener(_0x52de29,_0x6431a3){return function(_0x5354fc){_0x6431a3[_0xf2fd('0x2')](_0x52de29,_0x5354fc);};}function removeListener(_0x582557,_0x583d03){return function(){VoiceQueueEvents[_0xf2fd('0x3')](_0x582557,_0x583d03);};}exports['register']=function(_0xe8fcf3){for(var _0x3ed2c0=0x0,_0x5987f9=events[_0xf2fd('0x4')];_0x3ed2c0<_0x5987f9;_0x3ed2c0++){var _0x41dd0f=events[_0x3ed2c0];var _0x4be3fe=createListener('voiceQueue:'+_0x41dd0f,_0xe8fcf3);VoiceQueueEvents['on'](_0x41dd0f,_0x4be3fe);}}; \ No newline at end of file +var _0x6995=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x35a055,_0x14902e){var _0x483123=function(_0x26a384){while(--_0x26a384){_0x35a055['push'](_0x35a055['shift']());}};_0x483123(++_0x14902e);}(_0x6995,0x15f));var _0x5699=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6995[_0xfae23b];return _0x200640;};'use strict';var VoiceQueueEvents=require(_0x5699('0x0'));var events=['save',_0x5699('0x1'),_0x5699('0x2')];function createListener(_0x116271,_0x48383b){return function(_0x2c058e){_0x48383b[_0x5699('0x3')](_0x116271,_0x2c058e);};}function removeListener(_0x35cd07,_0x306747){return function(){VoiceQueueEvents[_0x5699('0x4')](_0x35cd07,_0x306747);};}exports[_0x5699('0x5')]=function(_0x4f1e20){for(var _0x5b2a9d=0x0,_0x17732f=events[_0x5699('0x6')];_0x5b2a9d<_0x17732f;_0x5b2a9d++){var _0x36f3a1=events[_0x5b2a9d];var _0x195837=createListener(_0x5699('0x7')+_0x36f3a1,_0x4f1e20);VoiceQueueEvents['on'](_0x36f3a1,_0x195837);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index cee2f92..dd5ec6b 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 _0x7916=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/describe','describe','/index','/:id','show','post','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service'];(function(_0x3c99c2,_0x4fa88b){var _0x55c2e1=function(_0x1b8a53){while(--_0x1b8a53){_0x3c99c2['push'](_0x3c99c2['shift']());}};_0x55c2e1(++_0x4fa88b);}(_0x7916,0x128));var _0x6791=function(_0x2813d2,_0x409ae6){_0x2813d2=_0x2813d2-0x0;var _0x16be8c=_0x7916[_0x2813d2];return _0x16be8c;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var express=require(_0x6791('0x2'));var router=express['Router']();var auth=require(_0x6791('0x3'));var interaction=require(_0x6791('0x4'));var config=require(_0x6791('0x5'));var controller=require(_0x6791('0x6'));router['get']('/',auth[_0x6791('0x7')](),controller['index']);router[_0x6791('0x8')](_0x6791('0x9'),auth['isAuthenticated'](),controller[_0x6791('0xa')]);router['get'](_0x6791('0xb'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x6791('0x8')](_0x6791('0xc'),auth['isAuthenticated'](),controller[_0x6791('0xd')]);router[_0x6791('0xe')]('/',auth[_0x6791('0x7')](),controller['create']);router[_0x6791('0xf')](_0x6791('0xc'),auth[_0x6791('0x7')](),controller[_0x6791('0x10')]);router[_0x6791('0x11')](_0x6791('0xc'),auth[_0x6791('0x7')](),controller[_0x6791('0x12')]);module[_0x6791('0x13')]=router; \ No newline at end of file +var _0x1a85=['./voiceQueueReport.controller','get','index','/describe','describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','path','express','Router','../../config/environment'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x1a85,0x178));var _0x51a8=function(_0x121d9e,_0x11b966){_0x121d9e=_0x121d9e-0x0;var _0x5df466=_0x1a85[_0x121d9e];return _0x5df466;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var express=require(_0x51a8('0x1'));var router=express[_0x51a8('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x51a8('0x3'));var controller=require(_0x51a8('0x4'));router[_0x51a8('0x5')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x6')]);router['get'](_0x51a8('0x7'),auth['isAuthenticated'](),controller[_0x51a8('0x8')]);router[_0x51a8('0x5')]('/index',auth[_0x51a8('0x9')](),controller['getVoiceQueuesReport']);router['get'](_0x51a8('0xa'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xb')]);router[_0x51a8('0xc')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xd')]);router[_0x51a8('0xe')](_0x51a8('0xa'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xa'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 85e7ad3..91368f3 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 _0xb1ba=['FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb1ba,0x133));var _0xab1b=function(_0x1ea8e1,_0x285729){_0x1ea8e1=_0x1ea8e1-0x0;var _0xc87280=_0xb1ba[_0x1ea8e1];return _0xc87280;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xab1b('0x0'));module[_0xab1b('0x1')]={'type':{'type':Sequelize[_0xab1b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xab1b('0x2')]},'calleridname':{'type':Sequelize[_0xab1b('0x2')]},'queue':{'type':Sequelize[_0xab1b('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xab1b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xab1b('0x3')],'set':function(_0x28f4c6){var _0x19fd25=moment(_0x28f4c6);var _0x1cba81=moment(this[_0xab1b('0x4')](_0xab1b('0x5')))[_0xab1b('0x6')](_0xab1b('0x7'));var _0x517d8b=_0x19fd25[_0xab1b('0x8')](_0x1cba81,_0xab1b('0x9'));this[_0xab1b('0xa')](_0xab1b('0xb'),_0x28f4c6);this[_0xab1b('0xa')](_0xab1b('0xc'),_0x517d8b||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xab1b('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xab1b('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xab1b('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xab1b('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xab1b('0x3')]},'queuecallerexit':{'type':Sequelize[_0xab1b('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xab1b('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xab1b('0xf')},'originalposition':{'type':Sequelize[_0xab1b('0xd')]},'channel':{'type':Sequelize[_0xab1b('0x2')]},'connectedlinenum':{'type':Sequelize[_0xab1b('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xab1b('0x2')]},'context':{'type':Sequelize[_0xab1b('0x2')]},'exten':{'type':Sequelize[_0xab1b('0x2')]},'priority':{'type':Sequelize[_0xab1b('0x2')]},'holdtime':{'type':Sequelize[_0xab1b('0xd')]},'mohtime':{'type':Sequelize[_0xab1b('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xab1b('0x2')]},'transfer':{'type':Sequelize[_0xab1b('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xab1b('0x2')],'comment':_0xab1b('0x10')},'transferexten':{'type':Sequelize[_0xab1b('0x2')]},'transferuniqueid':{'type':Sequelize[_0xab1b('0x2')]},'disposition':{'type':Sequelize[_0xab1b('0x2')]}}; \ No newline at end of file +var _0xf1e8=['STRING','DATE','getDataValue','queuecallerjoinAt','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports'];(function(_0x334c9e,_0x3709cd){var _0x178804=function(_0x4eab3f){while(--_0x4eab3f){_0x334c9e['push'](_0x334c9e['shift']());}};_0x178804(++_0x3709cd);}(_0xf1e8,0x98));var _0x8f1e=function(_0x3f71d5,_0x38eef5){_0x3f71d5=_0x3f71d5-0x0;var _0x5e2b34=_0xf1e8[_0x3f71d5];return _0x5e2b34;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8f1e('0x0'));module[_0x8f1e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8f1e('0x2')]},'calleridnum':{'type':Sequelize[_0x8f1e('0x2')]},'calleridname':{'type':Sequelize[_0x8f1e('0x2')]},'queue':{'type':Sequelize[_0x8f1e('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x8f1e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x8f1e('0x3')],'set':function(_0x2fd706){var _0x2f574f=moment(_0x2fd706);var _0x545e22=moment(this[_0x8f1e('0x4')](_0x8f1e('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1b970a=_0x2f574f['diff'](_0x545e22,_0x8f1e('0x6'));this[_0x8f1e('0x7')](_0x8f1e('0x8'),_0x2fd706);this['setDataValue'](_0x8f1e('0x9'),_0x1b970a||null);}},'position':{'type':Sequelize[_0x8f1e('0xa')]},'count':{'type':Sequelize[_0x8f1e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x8f1e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8f1e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x8f1e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x8f1e('0x2')],'comment':_0x8f1e('0xc')},'originalposition':{'type':Sequelize[_0x8f1e('0xa')]},'channel':{'type':Sequelize[_0x8f1e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8f1e('0x2')]},'context':{'type':Sequelize[_0x8f1e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8f1e('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x8f1e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8f1e('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8f1e('0x2')]},'transfer':{'type':Sequelize[_0x8f1e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8f1e('0x2')],'comment':_0x8f1e('0xd')},'transferexten':{'type':Sequelize[_0x8f1e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8f1e('0x2')]},'disposition':{'type':Sequelize[_0x8f1e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 1e85cd7..a25d382 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 _0x4a5c=['limit','set','apply','save','update','then','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','keys','dateStart','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','dateEnd','add','day','merge','includeAll','include','rows','catch','show','params','options','find','create','body','describe','getVoiceQueuesReport','nolimit','filter','map','findAll','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','./voiceQueueReport.socket','sendStatus','end','status','json','count','offset'];(function(_0x5ad047,_0x5f05a6){var _0x770804=function(_0x91cfc9){while(--_0x91cfc9){_0x5ad047['push'](_0x5ad047['shift']());}};_0x770804(++_0x5f05a6);}(_0x4a5c,0x7b));var _0xc4a5=function(_0x1ad12c,_0x5bd618){_0x1ad12c=_0x1ad12c-0x0;var _0xb60e0f=_0x4a5c[_0x1ad12c];return _0xb60e0f;};'use strict';var jsonpatch=require(_0xc4a5('0x0'));var rp=require(_0xc4a5('0x1'));var moment=require('moment');var BPromise=require(_0xc4a5('0x2'));var Mustache=require(_0xc4a5('0x3'));var util=require(_0xc4a5('0x4'));var path=require('path');var sox=require(_0xc4a5('0x5'));var csv=require(_0xc4a5('0x6'));var ejs=require(_0xc4a5('0x7'));var fs=require('fs');var _=require(_0xc4a5('0x8'));var squel=require('squel');var crypto=require(_0xc4a5('0x9'));var jsforce=require(_0xc4a5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc4a5('0x6'));var querystring=require(_0xc4a5('0xb'));var Papa=require(_0xc4a5('0xc'));var qs=require(_0xc4a5('0xd'));var logger=require(_0xc4a5('0xe'))(_0xc4a5('0xf'));var utils=require(_0xc4a5('0x10'));var config=require(_0xc4a5('0x11'));var db=require(_0xc4a5('0x12'))['db'];var socket=require('socket.io-emitter')({'host':_0xc4a5('0x13'),'port':0x18eb});require(_0xc4a5('0x14'))['register'](socket);function respondWithStatusCode(_0x1c6449,_0x8475c6){_0x8475c6=_0x8475c6||0xcc;return function(_0x23f32a){if(_0x23f32a){return _0x1c6449[_0xc4a5('0x15')](_0x8475c6);}return _0x1c6449['status'](_0x8475c6)[_0xc4a5('0x16')]();};}function respondWithResult(_0x2c233e,_0x417d26){_0x417d26=_0x417d26||0xc8;return function(_0x3fbd41){if(_0x3fbd41){return _0x2c233e[_0xc4a5('0x17')](_0x417d26)[_0xc4a5('0x18')](_0x3fbd41);}};}function respondWithFilteredResult(_0x200035,_0x69dd39){return function(_0x5adcab){if(_0x5adcab){var _0x11c8be=_0x5adcab[_0xc4a5('0x19')],_0x1a3dc7=_0x69dd39[_0xc4a5('0x1a')],_0x32a577=_0x69dd39[_0xc4a5('0x1a')]+_0x69dd39[_0xc4a5('0x1b')],_0x4d6bf3;if(_0x32a577>=_0x11c8be){_0x32a577=_0x11c8be;_0x4d6bf3=0xc8;}else{_0x4d6bf3=0xce;}_0x200035[_0xc4a5('0x17')](_0x4d6bf3);return _0x200035[_0xc4a5('0x1c')]('Content-Range',_0x1a3dc7+'-'+_0x32a577+'/'+_0x11c8be)[_0xc4a5('0x18')](_0x5adcab);}return null;};}function patchUpdates(_0x160ce5){return function(_0x537f5e){try{jsonpatch[_0xc4a5('0x1d')](_0x537f5e,_0x160ce5,!![]);}catch(_0x5cffc2){return BPromise['reject'](_0x5cffc2);}return _0x537f5e[_0xc4a5('0x1e')]();};}function saveUpdates(_0x417473,_0x356535){return function(_0x2e49ae){if(_0x2e49ae){return _0x2e49ae[_0xc4a5('0x1f')](_0x417473)[_0xc4a5('0x20')](function(_0x198bed){return _0x198bed;});}return null;};}function removeEntity(_0x3d8dee,_0x497878){return function(_0x168532){if(_0x168532){return _0x168532[_0xc4a5('0x21')]()[_0xc4a5('0x20')](function(){_0x3d8dee[_0xc4a5('0x17')](0xcc)[_0xc4a5('0x16')]();});}};}function handleEntityNotFound(_0x55e315,_0x209358){return function(_0x339d59){if(!_0x339d59){_0x55e315['sendStatus'](0x194);}return _0x339d59;};}function handleError(_0x43051d,_0x1d473d){_0x1d473d=_0x1d473d||0x1f4;return function(_0x1f98a6){logger[_0xc4a5('0x22')](_0x1f98a6[_0xc4a5('0x23')]);if(_0x1f98a6[_0xc4a5('0x24')]){delete _0x1f98a6[_0xc4a5('0x24')];}_0x43051d[_0xc4a5('0x17')](_0x1d473d)[_0xc4a5('0x25')](_0x1f98a6);};}exports[_0xc4a5('0x26')]=function(_0x5425db,_0x5c9c4c){var _0x217489={},_0x3bd8ea={},_0xba2815={'count':0x0,'rows':[]};var _0x1add12=db[_0xc4a5('0x27')][_0xc4a5('0x28')];_0x3bd8ea['model']=_[_0xc4a5('0x29')](_0x1add12);var _0x4416eb={'dateStart':_0x5425db['query']['dateStart'],'dateEnd':_0x5425db['query']['dateEnd']};delete _0x5425db['query'][_0xc4a5('0x2a')];delete _0x5425db[_0xc4a5('0x2b')]['dateEnd'];_0x3bd8ea[_0xc4a5('0x2b')]=_[_0xc4a5('0x29')](_0x5425db[_0xc4a5('0x2b')]);_0x3bd8ea[_0xc4a5('0x2c')]=_[_0xc4a5('0x2d')](_0x3bd8ea[_0xc4a5('0x2e')],_0x3bd8ea['query']);_0x217489[_0xc4a5('0x2f')]=_[_0xc4a5('0x2d')](_0x3bd8ea['model'],qs[_0xc4a5('0x30')](_0x5425db[_0xc4a5('0x2b')][_0xc4a5('0x30')]));_0x217489['attributes']=_0x217489['attributes'][_0xc4a5('0x31')]?_0x217489[_0xc4a5('0x2f')]:_0x3bd8ea[_0xc4a5('0x2e')];if(!_0x5425db[_0xc4a5('0x2b')][_0xc4a5('0x32')]('nolimit')){_0x217489[_0xc4a5('0x1b')]=qs[_0xc4a5('0x1b')](_0x5425db['query'][_0xc4a5('0x1b')]);_0x217489[_0xc4a5('0x1a')]=qs[_0xc4a5('0x1a')](_0x5425db[_0xc4a5('0x2b')][_0xc4a5('0x1a')]);}_0x217489[_0xc4a5('0x33')]=qs['sort'](_0x5425db['query'][_0xc4a5('0x34')]);_0x217489[_0xc4a5('0x35')]=qs[_0xc4a5('0x2c')](_[_0xc4a5('0x36')](_0x5425db[_0xc4a5('0x2b')],_0x3bd8ea[_0xc4a5('0x2c')]));if(_0x4416eb[_0xc4a5('0x2a')]){if(_0x4416eb[_0xc4a5('0x37')]){_0x4416eb[_0xc4a5('0x37')]=moment(_0x4416eb[_0xc4a5('0x37')])[_0xc4a5('0x38')](0x1,'day');}else{_0x4416eb['dateEnd']=moment(_0x4416eb[_0xc4a5('0x2a')])[_0xc4a5('0x38')](0x1,_0xc4a5('0x39'));}_[_0xc4a5('0x3a')](_0x217489[_0xc4a5('0x35')],{'createdAt':{'$gte':_0x4416eb['dateStart'],'$lte':_0x4416eb[_0xc4a5('0x37')]}});}if(_0x5425db['query']['filter']){_0x217489['where']=_[_0xc4a5('0x3a')](_0x217489[_0xc4a5('0x35')],{'$or':_['map'](_0x217489[_0xc4a5('0x2f')],function(_0x5838b1){var _0x5d2f6b={};_0x5d2f6b[_0x5838b1]={'$like':'%'+_0x5425db[_0xc4a5('0x2b')]['filter']+'%'};return _0x5d2f6b;})});}_0x217489=_['merge']({},_0x217489,_0x5425db['options']);var _0x1a9161={'where':_0x217489[_0xc4a5('0x35')]};return db[_0xc4a5('0x27')][_0xc4a5('0x19')](_0x1a9161)[_0xc4a5('0x20')](function(_0xb65351){_0xba2815[_0xc4a5('0x19')]=_0xb65351;if(_0x5425db['query'][_0xc4a5('0x3b')]){_0x217489[_0xc4a5('0x3c')]=[{'all':!![]}];}return db[_0xc4a5('0x27')]['findAll'](_0x217489);})[_0xc4a5('0x20')](function(_0xf58858){_0xba2815[_0xc4a5('0x3d')]=_0xf58858;return _0xba2815;})['then'](respondWithFilteredResult(_0x5c9c4c,_0x217489))[_0xc4a5('0x3e')](handleError(_0x5c9c4c,null));};exports[_0xc4a5('0x3f')]=function(_0x606eb9,_0x36ad6b){var _0x4ce8dc={'raw':![],'where':{'id':_0x606eb9[_0xc4a5('0x40')]['id']}},_0x465d6e={};_0x465d6e[_0xc4a5('0x2e')]=_['keys'](db['VoiceQueueReport'][_0xc4a5('0x28')]);_0x465d6e[_0xc4a5('0x2b')]=_['keys'](_0x606eb9[_0xc4a5('0x2b')]);_0x465d6e[_0xc4a5('0x2c')]=_[_0xc4a5('0x2d')](_0x465d6e['model'],_0x465d6e[_0xc4a5('0x2b')]);_0x4ce8dc[_0xc4a5('0x2f')]=_['intersection'](_0x465d6e[_0xc4a5('0x2e')],qs[_0xc4a5('0x30')](_0x606eb9[_0xc4a5('0x2b')][_0xc4a5('0x30')]));_0x4ce8dc['attributes']=_0x4ce8dc['attributes']['length']?_0x4ce8dc[_0xc4a5('0x2f')]:_0x465d6e[_0xc4a5('0x2e')];if(_0x606eb9[_0xc4a5('0x2b')]['includeAll']){_0x4ce8dc[_0xc4a5('0x3c')]=[{'all':!![]}];}_0x4ce8dc=_['merge']({},_0x4ce8dc,_0x606eb9[_0xc4a5('0x41')]);return db[_0xc4a5('0x27')][_0xc4a5('0x42')](_0x4ce8dc)[_0xc4a5('0x20')](handleEntityNotFound(_0x36ad6b,null))['then'](respondWithResult(_0x36ad6b,null))[_0xc4a5('0x3e')](handleError(_0x36ad6b,null));};exports[_0xc4a5('0x43')]=function(_0x48d241,_0x377fb1){return db[_0xc4a5('0x27')][_0xc4a5('0x43')](_0x48d241['body'],{})[_0xc4a5('0x20')](respondWithResult(_0x377fb1,0xc9))[_0xc4a5('0x3e')](handleError(_0x377fb1,null));};exports['update']=function(_0x581c85,_0x225ff0){if(_0x581c85[_0xc4a5('0x44')]['id']){delete _0x581c85[_0xc4a5('0x44')]['id'];}return db[_0xc4a5('0x27')]['find']({'where':{'id':_0x581c85['params']['id']}})['then'](handleEntityNotFound(_0x225ff0,null))[_0xc4a5('0x20')](saveUpdates(_0x581c85[_0xc4a5('0x44')],null))['then'](respondWithResult(_0x225ff0,null))[_0xc4a5('0x3e')](handleError(_0x225ff0,null));};exports[_0xc4a5('0x21')]=function(_0x13e183,_0x42e7b7){return db[_0xc4a5('0x27')][_0xc4a5('0x42')]({'where':{'id':_0x13e183[_0xc4a5('0x40')]['id']}})[_0xc4a5('0x20')](handleEntityNotFound(_0x42e7b7,null))[_0xc4a5('0x20')](removeEntity(_0x42e7b7,null))[_0xc4a5('0x3e')](handleError(_0x42e7b7,null));};exports[_0xc4a5('0x45')]=function(_0x585352,_0x5b5de3){return db[_0xc4a5('0x27')][_0xc4a5('0x45')]()[_0xc4a5('0x20')](respondWithResult(_0x5b5de3,null))[_0xc4a5('0x3e')](handleError(_0x5b5de3,null));};exports[_0xc4a5('0x46')]=function(_0x2cff2c,_0x1e165a){var _0x3e6e2c={},_0x57a7d7={},_0x4aac9b={'count':0x0,'rows':[]};_0x57a7d7[_0xc4a5('0x2e')]=_[_0xc4a5('0x29')](db[_0xc4a5('0x27')][_0xc4a5('0x28')]);var _0x32093f={'dateStart':_0x2cff2c[_0xc4a5('0x2b')]['dateStart'],'dateEnd':_0x2cff2c[_0xc4a5('0x2b')][_0xc4a5('0x37')]};delete _0x2cff2c[_0xc4a5('0x2b')][_0xc4a5('0x2a')];delete _0x2cff2c['query'][_0xc4a5('0x37')];_0x57a7d7['query']=_[_0xc4a5('0x29')](_0x2cff2c[_0xc4a5('0x2b')]);_0x57a7d7[_0xc4a5('0x2c')]=_[_0xc4a5('0x2d')](_0x57a7d7[_0xc4a5('0x2e')],_0x57a7d7[_0xc4a5('0x2b')]);_0x3e6e2c[_0xc4a5('0x2f')]=_[_0xc4a5('0x2d')](_0x57a7d7['model'],qs['fields'](_0x2cff2c['query'][_0xc4a5('0x30')]));_0x3e6e2c[_0xc4a5('0x2f')]=_0x3e6e2c[_0xc4a5('0x2f')][_0xc4a5('0x31')]?_0x3e6e2c['attributes']:_0x57a7d7[_0xc4a5('0x2e')];if(!_0x2cff2c[_0xc4a5('0x2b')][_0xc4a5('0x32')](_0xc4a5('0x47'))){_0x3e6e2c[_0xc4a5('0x1b')]=qs[_0xc4a5('0x1b')](_0x2cff2c['query'][_0xc4a5('0x1b')]);_0x3e6e2c[_0xc4a5('0x1a')]=qs['offset'](_0x2cff2c[_0xc4a5('0x2b')][_0xc4a5('0x1a')]);}_0x3e6e2c[_0xc4a5('0x33')]=qs[_0xc4a5('0x34')](_0x2cff2c[_0xc4a5('0x2b')][_0xc4a5('0x34')]);_0x3e6e2c['where']=qs[_0xc4a5('0x2c')](_['pick'](_0x2cff2c[_0xc4a5('0x2b')],_0x57a7d7[_0xc4a5('0x2c')]));if(_0x32093f[_0xc4a5('0x2a')]){if(_0x32093f[_0xc4a5('0x37')]){_0x32093f[_0xc4a5('0x37')]=moment(_0x32093f[_0xc4a5('0x37')])[_0xc4a5('0x38')](0x1,_0xc4a5('0x39'));}else{_0x32093f['dateEnd']=moment(_0x32093f['dateStart'])[_0xc4a5('0x38')](0x1,_0xc4a5('0x39'));}_[_0xc4a5('0x3a')](_0x3e6e2c[_0xc4a5('0x35')],{'createdAt':{'$gte':_0x32093f[_0xc4a5('0x2a')],'$lte':_0x32093f[_0xc4a5('0x37')]}});}if(_0x2cff2c[_0xc4a5('0x2b')][_0xc4a5('0x48')]){_0x3e6e2c[_0xc4a5('0x35')]=_['merge'](_0x3e6e2c[_0xc4a5('0x35')],{'$or':_[_0xc4a5('0x49')](_0x3e6e2c['attributes'],function(_0x264eb5){var _0xde9f9b={};_0xde9f9b[_0x264eb5]={'$like':'%'+_0x2cff2c['query'][_0xc4a5('0x48')]+'%'};return _0xde9f9b;})});}_0x3e6e2c=_[_0xc4a5('0x3a')]({},_0x3e6e2c,_0x2cff2c[_0xc4a5('0x41')]);var _0x8e81b4={'where':_0x3e6e2c['where']};return db[_0xc4a5('0x27')][_0xc4a5('0x19')](_0x8e81b4)['then'](function(_0x2a9a20){_0x4aac9b[_0xc4a5('0x19')]=_0x2a9a20;if(_0x2cff2c['query'][_0xc4a5('0x3b')]){_0x3e6e2c[_0xc4a5('0x3c')]=[{'all':!![]}];}return db[_0xc4a5('0x27')][_0xc4a5('0x4a')](_0x3e6e2c);})[_0xc4a5('0x20')](function(_0x19f4cb){_0x4aac9b[_0xc4a5('0x3d')]=_0x19f4cb;return _0x4aac9b;})[_0xc4a5('0x20')](respondWithFilteredResult(_0x1e165a,_0x3e6e2c,'getVoiceQueuesReport'))[_0xc4a5('0x3e')](handleError(_0x1e165a,null,_0xc4a5('0x46')));}; \ No newline at end of file +var _0xc1df=['model','dateStart','query','dateEnd','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','add','day','merge','filter','map','options','rows','show','intersection','include','catch','create','update','body','find','params','describe','getVoiceQueuesReport','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','./voiceQueueReport.socket','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','VoiceQueueReport','rawAttributes'];(function(_0x2ab601,_0x3a1bb1){var _0x2622d9=function(_0x34945f){while(--_0x34945f){_0x2ab601['push'](_0x2ab601['shift']());}};_0x2622d9(++_0x3a1bb1);}(_0xc1df,0x1de));var _0xfc1d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1df[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0xfc1d('0x0'));var rp=require(_0xfc1d('0x1'));var moment=require(_0xfc1d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfc1d('0x3'));var util=require(_0xfc1d('0x4'));var path=require(_0xfc1d('0x5'));var sox=require(_0xfc1d('0x6'));var csv=require(_0xfc1d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc1d('0x8'));var squel=require(_0xfc1d('0x9'));var crypto=require(_0xfc1d('0xa'));var jsforce=require(_0xfc1d('0xb'));var deskjs=require(_0xfc1d('0xc'));var toCsv=require(_0xfc1d('0x7'));var querystring=require(_0xfc1d('0xd'));var Papa=require(_0xfc1d('0xe'));var qs=require(_0xfc1d('0xf'));var logger=require(_0xfc1d('0x10'))(_0xfc1d('0x11'));var utils=require(_0xfc1d('0x12'));var config=require(_0xfc1d('0x13'));var db=require(_0xfc1d('0x14'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xfc1d('0x15'))['register'](socket);function respondWithStatusCode(_0x886e13,_0x13245b){_0x13245b=_0x13245b||0xcc;return function(_0x74acf4){if(_0x74acf4){return _0x886e13['sendStatus'](_0x13245b);}return _0x886e13[_0xfc1d('0x16')](_0x13245b)['end']();};}function respondWithResult(_0x2965f4,_0x2875c7){_0x2875c7=_0x2875c7||0xc8;return function(_0x51caa9){if(_0x51caa9){return _0x2965f4[_0xfc1d('0x16')](_0x2875c7)[_0xfc1d('0x17')](_0x51caa9);}};}function respondWithFilteredResult(_0x4c6acd,_0x972927){return function(_0xa185d5){if(_0xa185d5){var _0x14c9ed=_0xa185d5[_0xfc1d('0x18')],_0x238941=_0x972927[_0xfc1d('0x19')],_0x40d6c7=_0x972927[_0xfc1d('0x19')]+_0x972927['limit'],_0x3be19d;if(_0x40d6c7>=_0x14c9ed){_0x40d6c7=_0x14c9ed;_0x3be19d=0xc8;}else{_0x3be19d=0xce;}_0x4c6acd['status'](_0x3be19d);return _0x4c6acd[_0xfc1d('0x1a')](_0xfc1d('0x1b'),_0x238941+'-'+_0x40d6c7+'/'+_0x14c9ed)['json'](_0xa185d5);}return null;};}function patchUpdates(_0x9ee3fe){return function(_0x213057){try{jsonpatch[_0xfc1d('0x1c')](_0x213057,_0x9ee3fe,!![]);}catch(_0x4c3d74){return BPromise[_0xfc1d('0x1d')](_0x4c3d74);}return _0x213057[_0xfc1d('0x1e')]();};}function saveUpdates(_0x3130f9,_0x2fb5db){return function(_0x2cc49b){if(_0x2cc49b){return _0x2cc49b['update'](_0x3130f9)[_0xfc1d('0x1f')](function(_0x5ecf63){return _0x5ecf63;});}return null;};}function removeEntity(_0x4e6ceb,_0x1cf2c7){return function(_0x24477d){if(_0x24477d){return _0x24477d[_0xfc1d('0x20')]()[_0xfc1d('0x1f')](function(){_0x4e6ceb['status'](0xcc)[_0xfc1d('0x21')]();});}};}function handleEntityNotFound(_0x5398b4,_0x1c2ba8){return function(_0x34c06c){if(!_0x34c06c){_0x5398b4[_0xfc1d('0x22')](0x194);}return _0x34c06c;};}function handleError(_0x333a6c,_0x1c75e8){_0x1c75e8=_0x1c75e8||0x1f4;return function(_0x3e7c19){logger[_0xfc1d('0x23')](_0x3e7c19[_0xfc1d('0x24')]);if(_0x3e7c19[_0xfc1d('0x25')]){delete _0x3e7c19[_0xfc1d('0x25')];}_0x333a6c[_0xfc1d('0x16')](_0x1c75e8)['send'](_0x3e7c19);};}exports['index']=function(_0x2059a7,_0x417f61){var _0x153504={},_0x149e41={},_0x164b13={'count':0x0,'rows':[]};var _0x4bbd03=db[_0xfc1d('0x26')][_0xfc1d('0x27')];_0x149e41[_0xfc1d('0x28')]=_['keys'](_0x4bbd03);var _0x4912f0={'dateStart':_0x2059a7['query'][_0xfc1d('0x29')],'dateEnd':_0x2059a7[_0xfc1d('0x2a')][_0xfc1d('0x2b')]};delete _0x2059a7[_0xfc1d('0x2a')]['dateStart'];delete _0x2059a7[_0xfc1d('0x2a')][_0xfc1d('0x2b')];_0x149e41[_0xfc1d('0x2a')]=_[_0xfc1d('0x2c')](_0x2059a7[_0xfc1d('0x2a')]);_0x149e41['filters']=_['intersection'](_0x149e41['model'],_0x149e41[_0xfc1d('0x2a')]);_0x153504[_0xfc1d('0x2d')]=_['intersection'](_0x149e41[_0xfc1d('0x28')],qs['fields'](_0x2059a7[_0xfc1d('0x2a')][_0xfc1d('0x2e')]));_0x153504['attributes']=_0x153504[_0xfc1d('0x2d')][_0xfc1d('0x2f')]?_0x153504['attributes']:_0x149e41[_0xfc1d('0x28')];if(!_0x2059a7['query'][_0xfc1d('0x30')](_0xfc1d('0x31'))){_0x153504[_0xfc1d('0x32')]=qs[_0xfc1d('0x32')](_0x2059a7['query'][_0xfc1d('0x32')]);_0x153504['offset']=qs['offset'](_0x2059a7[_0xfc1d('0x2a')][_0xfc1d('0x19')]);}_0x153504[_0xfc1d('0x33')]=qs[_0xfc1d('0x34')](_0x2059a7[_0xfc1d('0x2a')][_0xfc1d('0x34')]);_0x153504[_0xfc1d('0x35')]=qs[_0xfc1d('0x36')](_[_0xfc1d('0x37')](_0x2059a7[_0xfc1d('0x2a')],_0x149e41[_0xfc1d('0x36')]));if(_0x4912f0['dateStart']){if(_0x4912f0[_0xfc1d('0x2b')]){_0x4912f0['dateEnd']=moment(_0x4912f0[_0xfc1d('0x2b')])[_0xfc1d('0x38')](0x1,_0xfc1d('0x39'));}else{_0x4912f0[_0xfc1d('0x2b')]=moment(_0x4912f0[_0xfc1d('0x29')])['add'](0x1,_0xfc1d('0x39'));}_[_0xfc1d('0x3a')](_0x153504['where'],{'createdAt':{'$gte':_0x4912f0[_0xfc1d('0x29')],'$lte':_0x4912f0[_0xfc1d('0x2b')]}});}if(_0x2059a7['query'][_0xfc1d('0x3b')]){_0x153504['where']=_[_0xfc1d('0x3a')](_0x153504[_0xfc1d('0x35')],{'$or':_[_0xfc1d('0x3c')](_0x153504[_0xfc1d('0x2d')],function(_0x2a4ee3){var _0x1c1648={};_0x1c1648[_0x2a4ee3]={'$like':'%'+_0x2059a7[_0xfc1d('0x2a')][_0xfc1d('0x3b')]+'%'};return _0x1c1648;})});}_0x153504=_[_0xfc1d('0x3a')]({},_0x153504,_0x2059a7[_0xfc1d('0x3d')]);var _0x30d1dd={'where':_0x153504[_0xfc1d('0x35')]};return db[_0xfc1d('0x26')][_0xfc1d('0x18')](_0x30d1dd)[_0xfc1d('0x1f')](function(_0x33e330){_0x164b13[_0xfc1d('0x18')]=_0x33e330;if(_0x2059a7[_0xfc1d('0x2a')]['includeAll']){_0x153504['include']=[{'all':!![]}];}return db[_0xfc1d('0x26')]['findAll'](_0x153504);})[_0xfc1d('0x1f')](function(_0x278204){_0x164b13[_0xfc1d('0x3e')]=_0x278204;return _0x164b13;})[_0xfc1d('0x1f')](respondWithFilteredResult(_0x417f61,_0x153504))['catch'](handleError(_0x417f61,null));};exports[_0xfc1d('0x3f')]=function(_0x469fe3,_0x595dea){var _0xba4b7a={'raw':![],'where':{'id':_0x469fe3['params']['id']}},_0x347308={};_0x347308[_0xfc1d('0x28')]=_['keys'](db[_0xfc1d('0x26')][_0xfc1d('0x27')]);_0x347308[_0xfc1d('0x2a')]=_[_0xfc1d('0x2c')](_0x469fe3[_0xfc1d('0x2a')]);_0x347308[_0xfc1d('0x36')]=_['intersection'](_0x347308[_0xfc1d('0x28')],_0x347308[_0xfc1d('0x2a')]);_0xba4b7a[_0xfc1d('0x2d')]=_[_0xfc1d('0x40')](_0x347308['model'],qs[_0xfc1d('0x2e')](_0x469fe3[_0xfc1d('0x2a')]['fields']));_0xba4b7a['attributes']=_0xba4b7a[_0xfc1d('0x2d')][_0xfc1d('0x2f')]?_0xba4b7a[_0xfc1d('0x2d')]:_0x347308[_0xfc1d('0x28')];if(_0x469fe3['query']['includeAll']){_0xba4b7a[_0xfc1d('0x41')]=[{'all':!![]}];}_0xba4b7a=_['merge']({},_0xba4b7a,_0x469fe3[_0xfc1d('0x3d')]);return db[_0xfc1d('0x26')]['find'](_0xba4b7a)[_0xfc1d('0x1f')](handleEntityNotFound(_0x595dea,null))[_0xfc1d('0x1f')](respondWithResult(_0x595dea,null))[_0xfc1d('0x42')](handleError(_0x595dea,null));};exports[_0xfc1d('0x43')]=function(_0x162804,_0x61049c){return db[_0xfc1d('0x26')]['create'](_0x162804['body'],{})[_0xfc1d('0x1f')](respondWithResult(_0x61049c,0xc9))[_0xfc1d('0x42')](handleError(_0x61049c,null));};exports[_0xfc1d('0x44')]=function(_0x233528,_0x1b9d95){if(_0x233528[_0xfc1d('0x45')]['id']){delete _0x233528[_0xfc1d('0x45')]['id'];}return db['VoiceQueueReport'][_0xfc1d('0x46')]({'where':{'id':_0x233528[_0xfc1d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b9d95,null))[_0xfc1d('0x1f')](saveUpdates(_0x233528[_0xfc1d('0x45')],null))[_0xfc1d('0x1f')](respondWithResult(_0x1b9d95,null))[_0xfc1d('0x42')](handleError(_0x1b9d95,null));};exports[_0xfc1d('0x20')]=function(_0x5d23f7,_0x4eff89){return db[_0xfc1d('0x26')]['find']({'where':{'id':_0x5d23f7[_0xfc1d('0x47')]['id']}})[_0xfc1d('0x1f')](handleEntityNotFound(_0x4eff89,null))[_0xfc1d('0x1f')](removeEntity(_0x4eff89,null))['catch'](handleError(_0x4eff89,null));};exports[_0xfc1d('0x48')]=function(_0x3b39de,_0x57be93){return db[_0xfc1d('0x26')][_0xfc1d('0x48')]()[_0xfc1d('0x1f')](respondWithResult(_0x57be93,null))[_0xfc1d('0x42')](handleError(_0x57be93,null));};exports[_0xfc1d('0x49')]=function(_0xb4eabd,_0x7070be){var _0x4861b8={},_0x23ea50={},_0x3f840f={'count':0x0,'rows':[]};_0x23ea50[_0xfc1d('0x28')]=_[_0xfc1d('0x2c')](db[_0xfc1d('0x26')][_0xfc1d('0x27')]);var _0x2f9163={'dateStart':_0xb4eabd[_0xfc1d('0x2a')][_0xfc1d('0x29')],'dateEnd':_0xb4eabd[_0xfc1d('0x2a')][_0xfc1d('0x2b')]};delete _0xb4eabd[_0xfc1d('0x2a')][_0xfc1d('0x29')];delete _0xb4eabd[_0xfc1d('0x2a')][_0xfc1d('0x2b')];_0x23ea50['query']=_['keys'](_0xb4eabd[_0xfc1d('0x2a')]);_0x23ea50[_0xfc1d('0x36')]=_[_0xfc1d('0x40')](_0x23ea50[_0xfc1d('0x28')],_0x23ea50['query']);_0x4861b8[_0xfc1d('0x2d')]=_[_0xfc1d('0x40')](_0x23ea50[_0xfc1d('0x28')],qs[_0xfc1d('0x2e')](_0xb4eabd[_0xfc1d('0x2a')][_0xfc1d('0x2e')]));_0x4861b8[_0xfc1d('0x2d')]=_0x4861b8[_0xfc1d('0x2d')][_0xfc1d('0x2f')]?_0x4861b8['attributes']:_0x23ea50[_0xfc1d('0x28')];if(!_0xb4eabd[_0xfc1d('0x2a')][_0xfc1d('0x30')]('nolimit')){_0x4861b8['limit']=qs[_0xfc1d('0x32')](_0xb4eabd['query'][_0xfc1d('0x32')]);_0x4861b8['offset']=qs[_0xfc1d('0x19')](_0xb4eabd[_0xfc1d('0x2a')][_0xfc1d('0x19')]);}_0x4861b8[_0xfc1d('0x33')]=qs[_0xfc1d('0x34')](_0xb4eabd['query'][_0xfc1d('0x34')]);_0x4861b8[_0xfc1d('0x35')]=qs[_0xfc1d('0x36')](_[_0xfc1d('0x37')](_0xb4eabd[_0xfc1d('0x2a')],_0x23ea50[_0xfc1d('0x36')]));if(_0x2f9163[_0xfc1d('0x29')]){if(_0x2f9163[_0xfc1d('0x2b')]){_0x2f9163[_0xfc1d('0x2b')]=moment(_0x2f9163['dateEnd'])[_0xfc1d('0x38')](0x1,_0xfc1d('0x39'));}else{_0x2f9163[_0xfc1d('0x2b')]=moment(_0x2f9163[_0xfc1d('0x29')])['add'](0x1,_0xfc1d('0x39'));}_['merge'](_0x4861b8[_0xfc1d('0x35')],{'createdAt':{'$gte':_0x2f9163[_0xfc1d('0x29')],'$lte':_0x2f9163[_0xfc1d('0x2b')]}});}if(_0xb4eabd[_0xfc1d('0x2a')]['filter']){_0x4861b8[_0xfc1d('0x35')]=_[_0xfc1d('0x3a')](_0x4861b8[_0xfc1d('0x35')],{'$or':_[_0xfc1d('0x3c')](_0x4861b8[_0xfc1d('0x2d')],function(_0x452da9){var _0xbae249={};_0xbae249[_0x452da9]={'$like':'%'+_0xb4eabd[_0xfc1d('0x2a')]['filter']+'%'};return _0xbae249;})});}_0x4861b8=_[_0xfc1d('0x3a')]({},_0x4861b8,_0xb4eabd[_0xfc1d('0x3d')]);var _0x246459={'where':_0x4861b8[_0xfc1d('0x35')]};return db[_0xfc1d('0x26')][_0xfc1d('0x18')](_0x246459)[_0xfc1d('0x1f')](function(_0xc3e670){_0x3f840f[_0xfc1d('0x18')]=_0xc3e670;if(_0xb4eabd[_0xfc1d('0x2a')]['includeAll']){_0x4861b8[_0xfc1d('0x41')]=[{'all':!![]}];}return db[_0xfc1d('0x26')]['findAll'](_0x4861b8);})[_0xfc1d('0x1f')](function(_0x10ab6d){_0x3f840f[_0xfc1d('0x3e')]=_0x10ab6d;return _0x3f840f;})['then'](respondWithFilteredResult(_0x7070be,_0x4861b8,_0xfc1d('0x49')))[_0xfc1d('0x42')](handleError(_0x7070be,null,_0xfc1d('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 526b7e1..0d8ca9c 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 _0xe559=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0x695dc7,_0x4ed034){var _0x5b054e=function(_0x2ea183){while(--_0x2ea183){_0x695dc7['push'](_0x695dc7['shift']());}};_0x5b054e(++_0x4ed034);}(_0xe559,0xb4));var _0x9e55=function(_0xbb2816,_0x2a7dba){_0xbb2816=_0xbb2816-0x0;var _0x14351c=_0xe559[_0xbb2816];return _0x14351c;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x9e55('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e55('0x1'),'afterUpdate':_0x9e55('0x2'),'afterDestroy':_0x9e55('0x3')};function emitEvent(_0x237572){return function(_0x343f60,_0x124e7b,_0x43ca78){VoiceQueueReportEvents['emit'](_0x237572+':'+_0x343f60['id'],_0x343f60);VoiceQueueReportEvents[_0x9e55('0x4')](_0x237572,_0x343f60);_0x43ca78(null);};}for(var e in events){if(events[_0x9e55('0x5')](e)){var event=events[e];VoiceQueueReport[_0x9e55('0x6')](e,emitEvent(event));}}module[_0x9e55('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9504=['save','remove','emit','hook','exports','events','VoiceQueueReport','setMaxListeners'];(function(_0x3ab935,_0xa28999){var _0xa46eac=function(_0x3a3f6f){while(--_0x3a3f6f){_0x3ab935['push'](_0x3ab935['shift']());}};_0xa46eac(++_0xa28999);}(_0x9504,0x1dd));var _0x4950=function(_0x334822,_0x535300){_0x334822=_0x334822-0x0;var _0x570ec4=_0x9504[_0x334822];return _0x570ec4;};'use strict';var EventEmitter=require(_0x4950('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x4950('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4950('0x2')](0x0);var events={'afterCreate':_0x4950('0x3'),'afterUpdate':'update','afterDestroy':_0x4950('0x4')};function emitEvent(_0x295db9){return function(_0x50c402,_0x291e5f,_0x335785){VoiceQueueReportEvents[_0x4950('0x5')](_0x295db9+':'+_0x50c402['id'],_0x50c402);VoiceQueueReportEvents[_0x4950('0x5')](_0x295db9,_0x50c402);_0x335785(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x4950('0x6')](e,emitEvent(event));}}module[_0x4950('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 1ba4724..e641b09 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 _0xf3ec=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceQueueReport.attributes','report_queue','uniqueid'];(function(_0x5400ea,_0x27e7d4){var _0x173494=function(_0x1c9a42){while(--_0x1c9a42){_0x5400ea['push'](_0x5400ea['shift']());}};_0x173494(++_0x27e7d4);}(_0xf3ec,0xbe));var _0xcf3e=function(_0x32607d,_0x2fd147){_0x32607d=_0x32607d-0x0;var _0x2133be=_0xf3ec[_0x32607d];return _0x2133be;};'use strict';var _=require(_0xcf3e('0x0'));var util=require(_0xcf3e('0x1'));var logger=require(_0xcf3e('0x2'))(_0xcf3e('0x3'));var moment=require(_0xcf3e('0x4'));var BPromise=require(_0xcf3e('0x5'));var rp=require(_0xcf3e('0x6'));var attributes=require(_0xcf3e('0x7'));module['exports']=function(_0x5658be,_0x30be3c){return _0x5658be['define']('VoiceQueueReport',attributes,{'tableName':_0xcf3e('0x8'),'paranoid':![],'indexes':[{'fields':[_0xcf3e('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x980c=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','bluebird'];(function(_0x356018,_0x4e0189){var _0x1b9372=function(_0xe0e7d6){while(--_0xe0e7d6){_0x356018['push'](_0x356018['shift']());}};_0x1b9372(++_0x4e0189);}(_0x980c,0xdf));var _0xc980=function(_0x2208a8,_0x4a2589){_0x2208a8=_0x2208a8-0x0;var _0x4cae41=_0x980c[_0x2208a8];return _0x4cae41;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var logger=require(_0xc980('0x2'))('api');var moment=require(_0xc980('0x3'));var BPromise=require(_0xc980('0x4'));var rp=require('request-promise');var attributes=require(_0xc980('0x5'));module[_0xc980('0x6')]=function(_0x4be212,_0xfc661c){return _0x4be212[_0xc980('0x7')](_0xc980('0x8'),attributes,{'tableName':_0xc980('0x9'),'paranoid':![],'indexes':[{'fields':[_0xc980('0xa')]},{'fields':[_0xc980('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 fa734eb..45b33a0 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 _0x084b=['../../config/logger','rpc','../../config/environment','client','socket.io-emitter','localhost','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','limit','include','model','map','attributes','create','body','UpdateVoiceQueueReport','lodash','randomstring','../../mysqldb'];(function(_0x137d0a,_0x5e2ba2){var _0x3d4f4e=function(_0x586e7f){while(--_0x586e7f){_0x137d0a['push'](_0x137d0a['shift']());}};_0x3d4f4e(++_0x5e2ba2);}(_0x084b,0xd5));var _0xb084=function(_0x33b85e,_0x9ab507){_0x33b85e=_0x33b85e-0x0;var _0x4d222e=_0x084b[_0x33b85e];return _0x4d222e;};'use strict';var _=require(_0xb084('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb084('0x1'));var fs=require('fs');var db=require(_0xb084('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb084('0x3'))(_0xb084('0x4'));var config=require(_0xb084('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb084('0x6')]['http']({'port':0x232a});var socket=require(_0xb084('0x7'))({'host':_0xb084('0x8'),'port':0x18eb});require(_0xb084('0x9'))['register'](socket);function respondWithRpcPromise(_0x4f45d2,_0x18a300,_0x118830){return new BPromise(function(_0x2f8d3d,_0xec1e0d){return client[_0xb084('0xa')](_0x4f45d2,_0x118830)[_0xb084('0xb')](function(_0x2b23e9){logger[_0xb084('0xc')](_0xb084('0xd'),_0x18a300,_0xb084('0xe'));logger[_0xb084('0xf')](_0xb084('0x10'),_0x18a300,_0xb084('0xe'),JSON[_0xb084('0x11')](_0x2b23e9));if(_0x2b23e9['error']){if(_0x2b23e9['error'][_0xb084('0x12')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x18a300,_0x2b23e9[_0xb084('0x13')][_0xb084('0x14')]);return _0xec1e0d(_0x2b23e9['error']['message']);}logger[_0xb084('0x13')](_0xb084('0xd'),_0x18a300,_0x2b23e9[_0xb084('0x13')][_0xb084('0x14')]);return _0x2f8d3d(_0x2b23e9[_0xb084('0x13')]['message']);}else{logger[_0xb084('0xc')](_0xb084('0xd'),_0x18a300,_0xb084('0xe'));_0x2f8d3d(_0x2b23e9[_0xb084('0x15')][_0xb084('0x14')]);}})[_0xb084('0x16')](function(_0x3e32f4){logger[_0xb084('0x13')](_0xb084('0xd'),_0x18a300,_0x3e32f4);_0xec1e0d(_0x3e32f4);});});}exports[_0xb084('0x17')]=function(_0x4b91e5){var _0x49884a=this;return new Promise(function(_0x567b92,_0x5b076b){return db[_0xb084('0x18')]['findAll']({'raw':_0x4b91e5[_0xb084('0x19')]?_0x4b91e5[_0xb084('0x19')][_0xb084('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b91e5[_0xb084('0x19')]?_0x4b91e5[_0xb084('0x19')][_0xb084('0x1b')]||null:null,'attributes':_0x4b91e5[_0xb084('0x19')]?_0x4b91e5[_0xb084('0x19')]['attributes']||null:null,'limit':_0x4b91e5['options']?_0x4b91e5[_0xb084('0x19')][_0xb084('0x1c')]||null:null,'include':_0x4b91e5[_0xb084('0x19')]?_0x4b91e5[_0xb084('0x19')][_0xb084('0x1d')]?_['map'](_0x4b91e5[_0xb084('0x19')][_0xb084('0x1d')],function(_0x50aafa){return{'model':db[_0x50aafa[_0xb084('0x1e')]],'as':_0x50aafa['as'],'attributes':_0x50aafa['attributes'],'include':_0x50aafa[_0xb084('0x1d')]?_[_0xb084('0x1f')](_0x50aafa['include'],function(_0x18e172){return{'model':db[_0x18e172[_0xb084('0x1e')]],'as':_0x18e172['as'],'attributes':_0x18e172[_0xb084('0x20')],'include':_0x18e172['include']?_[_0xb084('0x1f')](_0x18e172['include'],function(_0x2f26d3){return{'model':db[_0x2f26d3[_0xb084('0x1e')]],'as':_0x2f26d3['as'],'attributes':_0x2f26d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xb084('0xb')](function(_0x37b1a0){logger['info'](_0xb084('0x17'),_0x4b91e5);logger[_0xb084('0xf')]('GetVoiceQueueReport',_0x4b91e5,JSON[_0xb084('0x11')](_0x37b1a0));_0x567b92(_0x37b1a0);})[_0xb084('0x16')](function(_0x4a56c0){logger[_0xb084('0x13')](_0xb084('0x17'),_0x4a56c0[_0xb084('0x14')],_0x4b91e5);_0x5b076b(_0x49884a[_0xb084('0x13')](0x1f4,_0x4a56c0[_0xb084('0x14')]));});});};exports['CreateVoiceQueueReport']=function(_0x318b34){var _0x10f445=this;return new Promise(function(_0x28f30b,_0x2173da){return db['VoiceQueueReport'][_0xb084('0x21')](_0x318b34[_0xb084('0x22')],{'raw':_0x318b34[_0xb084('0x19')]?_0x318b34[_0xb084('0x19')][_0xb084('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5f05bf){logger[_0xb084('0xc')]('CreateVoiceQueueReport',_0x318b34);logger[_0xb084('0xf')]('CreateVoiceQueueReport',_0x318b34,JSON[_0xb084('0x11')](_0x5f05bf));_0x28f30b(_0x5f05bf);})[_0xb084('0x16')](function(_0x40e50b){logger[_0xb084('0x13')]('CreateVoiceQueueReport',_0x40e50b[_0xb084('0x14')],_0x318b34);_0x2173da(_0x10f445[_0xb084('0x13')](0x1f4,_0x40e50b[_0xb084('0x14')]));});});};exports[_0xb084('0x23')]=function(_0x3d27cf){var _0x47b9a8=this;return new Promise(function(_0x84e9d8,_0xc5900e){return db['VoiceQueueReport']['update'](_0x3d27cf[_0xb084('0x22')],{'raw':_0x3d27cf[_0xb084('0x19')]?_0x3d27cf[_0xb084('0x19')][_0xb084('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d27cf[_0xb084('0x19')]?_0x3d27cf[_0xb084('0x19')][_0xb084('0x1b')]||null:null,'attributes':_0x3d27cf[_0xb084('0x19')]?_0x3d27cf['options'][_0xb084('0x20')]||null:null,'limit':_0x3d27cf[_0xb084('0x19')]?_0x3d27cf['options'][_0xb084('0x1c')]||null:null})['then'](function(_0xd88374){logger[_0xb084('0xc')](_0xb084('0x23'),_0x3d27cf);logger[_0xb084('0xf')](_0xb084('0x23'),_0x3d27cf,JSON[_0xb084('0x11')](_0xd88374));_0x84e9d8(_0xd88374);})[_0xb084('0x16')](function(_0x192643){logger[_0xb084('0x13')](_0xb084('0x23'),_0x192643[_0xb084('0x14')],_0x3d27cf);_0xc5900e(_0x47b9a8[_0xb084('0x13')](0x1f4,_0x192643[_0xb084('0x14')]));});});}; \ No newline at end of file +var _0x3558=['register','request','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','catch','GetVoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceQueueReport','VoiceQueueReport','body','debug','where','UpdateVoiceQueueReport','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','socket.io-emitter','localhost','./voiceQueueReport.socket'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3558,0x67));var _0x8355=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x3558[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x8355('0x0'));var util=require(_0x8355('0x1'));var moment=require('moment');var BPromise=require(_0x8355('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x8355('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8355('0x4'))(_0x8355('0x5'));var config=require('../../config/environment');var jayson=require(_0x8355('0x6'));var client=jayson[_0x8355('0x7')]['http']({'port':0x232a});var socket=require(_0x8355('0x8'))({'host':_0x8355('0x9'),'port':0x18eb});require(_0x8355('0xa'))[_0x8355('0xb')](socket);function respondWithRpcPromise(_0x4abb5f,_0x587769,_0x30e9c3){return new BPromise(function(_0x4f20a3,_0x587384){return client[_0x8355('0xc')](_0x4abb5f,_0x30e9c3)[_0x8355('0xd')](function(_0x532da5){logger[_0x8355('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x587769,_0x8355('0xf'));logger['debug'](_0x8355('0x10'),_0x587769,_0x8355('0xf'),JSON[_0x8355('0x11')](_0x532da5));if(_0x532da5['error']){if(_0x532da5[_0x8355('0x12')][_0x8355('0x13')]===0x1f4){logger[_0x8355('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x587769,_0x532da5[_0x8355('0x12')][_0x8355('0x14')]);return _0x587384(_0x532da5['error'][_0x8355('0x14')]);}logger['error'](_0x8355('0x15'),_0x587769,_0x532da5[_0x8355('0x12')]['message']);return _0x4f20a3(_0x532da5[_0x8355('0x12')]['message']);}else{logger[_0x8355('0xe')](_0x8355('0x15'),_0x587769,_0x8355('0xf'));_0x4f20a3(_0x532da5['result'][_0x8355('0x14')]);}})[_0x8355('0x16')](function(_0x1aaaea){logger['error'](_0x8355('0x15'),_0x587769,_0x1aaaea);_0x587384(_0x1aaaea);});});}exports[_0x8355('0x17')]=function(_0x5a871c){var _0x48dd4c=this;return new Promise(function(_0x560005,_0x425552){return db['VoiceQueueReport'][_0x8355('0x18')]({'raw':_0x5a871c[_0x8355('0x19')]?_0x5a871c[_0x8355('0x19')][_0x8355('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a871c[_0x8355('0x19')]?_0x5a871c[_0x8355('0x19')]['where']||null:null,'attributes':_0x5a871c[_0x8355('0x19')]?_0x5a871c[_0x8355('0x19')][_0x8355('0x1b')]||null:null,'limit':_0x5a871c[_0x8355('0x19')]?_0x5a871c[_0x8355('0x19')][_0x8355('0x1c')]||null:null,'include':_0x5a871c[_0x8355('0x19')]?_0x5a871c[_0x8355('0x19')][_0x8355('0x1d')]?_[_0x8355('0x1e')](_0x5a871c['options'][_0x8355('0x1d')],function(_0x4a2c4b){return{'model':db[_0x4a2c4b[_0x8355('0x1f')]],'as':_0x4a2c4b['as'],'attributes':_0x4a2c4b['attributes'],'include':_0x4a2c4b[_0x8355('0x1d')]?_['map'](_0x4a2c4b[_0x8355('0x1d')],function(_0x44b696){return{'model':db[_0x44b696[_0x8355('0x1f')]],'as':_0x44b696['as'],'attributes':_0x44b696[_0x8355('0x1b')],'include':_0x44b696['include']?_[_0x8355('0x1e')](_0x44b696[_0x8355('0x1d')],function(_0x564551){return{'model':db[_0x564551[_0x8355('0x1f')]],'as':_0x564551['as'],'attributes':_0x564551['attributes']};}):[]};}):[]};}):[]:[]})[_0x8355('0xd')](function(_0x422abe){logger[_0x8355('0xe')](_0x8355('0x17'),_0x5a871c);logger['debug'](_0x8355('0x17'),_0x5a871c,JSON[_0x8355('0x11')](_0x422abe));_0x560005(_0x422abe);})[_0x8355('0x16')](function(_0x256261){logger['error'](_0x8355('0x17'),_0x256261[_0x8355('0x14')],_0x5a871c);_0x425552(_0x48dd4c[_0x8355('0x12')](0x1f4,_0x256261[_0x8355('0x14')]));});});};exports[_0x8355('0x20')]=function(_0x5881f2){var _0x3847c7=this;return new Promise(function(_0x32dd12,_0x496b15){return db[_0x8355('0x21')]['create'](_0x5881f2[_0x8355('0x22')],{'raw':_0x5881f2['options']?_0x5881f2['options'][_0x8355('0x1a')]===undefined?!![]:![]:!![]})[_0x8355('0xd')](function(_0xec3343){logger[_0x8355('0xe')](_0x8355('0x20'),_0x5881f2);logger[_0x8355('0x23')](_0x8355('0x20'),_0x5881f2,JSON[_0x8355('0x11')](_0xec3343));_0x32dd12(_0xec3343);})['catch'](function(_0x50bf62){logger[_0x8355('0x12')]('CreateVoiceQueueReport',_0x50bf62[_0x8355('0x14')],_0x5881f2);_0x496b15(_0x3847c7[_0x8355('0x12')](0x1f4,_0x50bf62[_0x8355('0x14')]));});});};exports['UpdateVoiceQueueReport']=function(_0x6963cc){var _0x1934fd=this;return new Promise(function(_0x40d887,_0x160ff5){return db[_0x8355('0x21')]['update'](_0x6963cc['body'],{'raw':_0x6963cc['options']?_0x6963cc[_0x8355('0x19')][_0x8355('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6963cc[_0x8355('0x19')]?_0x6963cc[_0x8355('0x19')][_0x8355('0x24')]||null:null,'attributes':_0x6963cc[_0x8355('0x19')]?_0x6963cc[_0x8355('0x19')][_0x8355('0x1b')]||null:null,'limit':_0x6963cc['options']?_0x6963cc[_0x8355('0x19')][_0x8355('0x1c')]||null:null})[_0x8355('0xd')](function(_0x27dbfc){logger[_0x8355('0xe')]('UpdateVoiceQueueReport',_0x6963cc);logger[_0x8355('0x23')](_0x8355('0x25'),_0x6963cc,JSON[_0x8355('0x11')](_0x27dbfc));_0x40d887(_0x27dbfc);})[_0x8355('0x16')](function(_0x426782){logger[_0x8355('0x12')]('UpdateVoiceQueueReport',_0x426782[_0x8355('0x14')],_0x6963cc);_0x160ff5(_0x1934fd['error'](0x1f4,_0x426782[_0x8355('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 00991c3..99467f2 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 _0x8a5d=['emit','removeListener','length','remove','update'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x8a5d,0xbc));var _0xd8a5=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x8a5d[_0x4fc421];return _0x8c6d63;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xd8a5('0x0'),_0xd8a5('0x1')];function createListener(_0x5e231d,_0x2d41b7){return function(_0x411447){_0x2d41b7[_0xd8a5('0x2')](_0x5e231d,_0x411447);};}function removeListener(_0x122542,_0x5a5871){return function(){VoiceQueueReportEvents[_0xd8a5('0x3')](_0x122542,_0x5a5871);};}exports['register']=function(_0x274e3b){for(var _0x4bd9dd=0x0,_0x4ce04c=events[_0xd8a5('0x4')];_0x4bd9dd<_0x4ce04c;_0x4bd9dd++){var _0x53850b=events[_0x4bd9dd];var _0x27067a=createListener('voiceQueueReport:'+_0x53850b,_0x274e3b);VoiceQueueReportEvents['on'](_0x53850b,_0x27067a);}}; \ No newline at end of file +var _0x8b3b=['removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x8b3b,0x6c));var _0xb8b3=function(_0x245d02,_0x454cd7){_0x245d02=_0x245d02-0x0;var _0x3d7d1d=_0x8b3b[_0x245d02];return _0x3d7d1d;};'use strict';var VoiceQueueReportEvents=require(_0xb8b3('0x0'));var events=[_0xb8b3('0x1'),_0xb8b3('0x2'),_0xb8b3('0x3')];function createListener(_0x5b40f3,_0x5a4c75){return function(_0x265438){_0x5a4c75['emit'](_0x5b40f3,_0x265438);};}function removeListener(_0x1a7e52,_0xed3888){return function(){VoiceQueueReportEvents[_0xb8b3('0x4')](_0x1a7e52,_0xed3888);};}exports[_0xb8b3('0x5')]=function(_0x40a038){for(var _0x622db1=0x0,_0x317075=events['length'];_0x622db1<_0x317075;_0x622db1++){var _0xcb58fc=events[_0x622db1];var _0x4cbc04=createListener(_0xb8b3('0x6')+_0xcb58fc,_0x40a038);VoiceQueueReportEvents['on'](_0xcb58fc,_0x4cbc04);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 169b48a..c9dd8c7 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 _0xa9e0=['/:id','show','create','update','delete','destroy','multer','util','path','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x395a4a,_0x345150){var _0x305859=function(_0x2121e5){while(--_0x2121e5){_0x395a4a['push'](_0x395a4a['shift']());}};_0x305859(++_0x345150);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router['put']('/:id',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','show','create','update','delete','destroy','multer','util','path','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x2b1e09,_0xf9c2fa){var _0x4dd61d=function(_0x72d993){while(--_0x72d993){_0x2b1e09['push'](_0x2b1e09['shift']());}};_0x4dd61d(++_0xf9c2fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router['put']('/:id',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index bf4a4d5..5e16e36 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 _0x8ef6=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x2ffd90,_0x45ee66){var _0x313de7=function(_0x4eab3f){while(--_0x4eab3f){_0x2ffd90['push'](_0x2ffd90['shift']());}};_0x313de7(++_0x45ee66);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1d914b,_0xfe25a7){_0x1d914b=_0x1d914b-0x0;var _0x45a07a=_0x8ef6[_0x1d914b];return _0x45a07a;};'use strict';var Sequelize=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));module[_0x68ef('0x2')]={'time':{'type':Sequelize[_0x68ef('0x3')]},'callid':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x68ef('0x4')],'allowNull':![],'defaultValue':moment()[_0x68ef('0x5')](_0x68ef('0x6'))}}; \ No newline at end of file +var _0x2d17=['DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0xb2cb08,_0x3204b1){var _0x5e5b82=function(_0x1d6f8c){while(--_0x1d6f8c){_0xb2cb08['push'](_0xb2cb08['shift']());}};_0x5e5b82(++_0x3204b1);}(_0x2d17,0x17e));var _0x72d1=function(_0x3bfe6c,_0x372137){_0x3bfe6c=_0x3bfe6c-0x0;var _0x389036=_0x2d17[_0x3bfe6c];return _0x389036;};'use strict';var Sequelize=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));module['exports']={'time':{'type':Sequelize[_0x72d1('0x2')]},'callid':{'type':Sequelize[_0x72d1('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x72d1('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x72d1('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x72d1('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x72d1('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x72d1('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x72d1('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x72d1('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f6a87d8..75b3376 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 _0xb1bb=['Content-Range','apply','save','destroy','then','error','name','send','VoiceQueuesLog','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','show','rawAttributes','catch','create','update','body','find','params','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','sendStatus','status','end','count','offset','limit','set'];(function(_0xde7253,_0x268ea8){var _0x9c1ce0=function(_0x7b7e38){while(--_0x7b7e38){_0xde7253['push'](_0xde7253['shift']());}};_0x9c1ce0(++_0x268ea8);}(_0xb1bb,0x1c2));var _0xbb1b=function(_0x4905e4,_0x500a74){_0x4905e4=_0x4905e4-0x0;var _0x53ec71=_0xb1bb[_0x4905e4];return _0x53ec71;};'use strict';var jsonpatch=require(_0xbb1b('0x0'));var rp=require(_0xbb1b('0x1'));var moment=require('moment');var BPromise=require(_0xbb1b('0x2'));var Mustache=require(_0xbb1b('0x3'));var util=require('util');var path=require(_0xbb1b('0x4'));var sox=require(_0xbb1b('0x5'));var csv=require(_0xbb1b('0x6'));var ejs=require(_0xbb1b('0x7'));var fs=require('fs');var _=require(_0xbb1b('0x8'));var squel=require(_0xbb1b('0x9'));var crypto=require(_0xbb1b('0xa'));var jsforce=require(_0xbb1b('0xb'));var deskjs=require(_0xbb1b('0xc'));var toCsv=require(_0xbb1b('0x6'));var querystring=require(_0xbb1b('0xd'));var Papa=require(_0xbb1b('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xbb1b('0xf'))(_0xbb1b('0x10'));var utils=require(_0xbb1b('0x11'));var config=require(_0xbb1b('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd28c92,_0x38826d){_0x38826d=_0x38826d||0xcc;return function(_0x399ec8){if(_0x399ec8){return _0xd28c92[_0xbb1b('0x13')](_0x38826d);}return _0xd28c92[_0xbb1b('0x14')](_0x38826d)[_0xbb1b('0x15')]();};}function respondWithResult(_0x33fe3c,_0x54b48e){_0x54b48e=_0x54b48e||0xc8;return function(_0x34f173){if(_0x34f173){return _0x33fe3c[_0xbb1b('0x14')](_0x54b48e)['json'](_0x34f173);}};}function respondWithFilteredResult(_0x2e7c73,_0x49234f){return function(_0x356046){if(_0x356046){var _0x187805=_0x356046[_0xbb1b('0x16')],_0x3abfbe=_0x49234f[_0xbb1b('0x17')],_0x3576e5=_0x49234f[_0xbb1b('0x17')]+_0x49234f[_0xbb1b('0x18')],_0x718cf4;if(_0x3576e5>=_0x187805){_0x3576e5=_0x187805;_0x718cf4=0xc8;}else{_0x718cf4=0xce;}_0x2e7c73[_0xbb1b('0x14')](_0x718cf4);return _0x2e7c73[_0xbb1b('0x19')](_0xbb1b('0x1a'),_0x3abfbe+'-'+_0x3576e5+'/'+_0x187805)['json'](_0x356046);}return null;};}function patchUpdates(_0x33018f){return function(_0x53f241){try{jsonpatch[_0xbb1b('0x1b')](_0x53f241,_0x33018f,!![]);}catch(_0x66f9ed){return BPromise['reject'](_0x66f9ed);}return _0x53f241[_0xbb1b('0x1c')]();};}function saveUpdates(_0x48b8b6,_0x4906e7){return function(_0x5909cc){if(_0x5909cc){return _0x5909cc['update'](_0x48b8b6)['then'](function(_0x2f0094){return _0x2f0094;});}return null;};}function removeEntity(_0x342234,_0x219766){return function(_0x229c34){if(_0x229c34){return _0x229c34[_0xbb1b('0x1d')]()[_0xbb1b('0x1e')](function(){_0x342234['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x572395,_0xcfcbdc){return function(_0x30a4e2){if(!_0x30a4e2){_0x572395['sendStatus'](0x194);}return _0x30a4e2;};}function handleError(_0x1cb5c9,_0x5f1176){_0x5f1176=_0x5f1176||0x1f4;return function(_0x5e2c51){logger[_0xbb1b('0x1f')](_0x5e2c51['stack']);if(_0x5e2c51[_0xbb1b('0x20')]){delete _0x5e2c51[_0xbb1b('0x20')];}_0x1cb5c9[_0xbb1b('0x14')](_0x5f1176)[_0xbb1b('0x21')](_0x5e2c51);};}exports['index']=function(_0x6c0bfe,_0x1b7ce1){var _0x5dfa7e={},_0x19f5fb={},_0x24af91={'count':0x0,'rows':[]};var _0x57ede1=db[_0xbb1b('0x22')]['rawAttributes'];_0x19f5fb[_0xbb1b('0x23')]=_[_0xbb1b('0x24')](_0x57ede1);var _0x591480={'dateStart':_0x6c0bfe[_0xbb1b('0x25')]['dateStart'],'dateEnd':_0x6c0bfe['query'][_0xbb1b('0x26')]};delete _0x6c0bfe[_0xbb1b('0x25')][_0xbb1b('0x27')];delete _0x6c0bfe[_0xbb1b('0x25')]['dateEnd'];_0x19f5fb[_0xbb1b('0x25')]=_[_0xbb1b('0x24')](_0x6c0bfe[_0xbb1b('0x25')]);_0x19f5fb[_0xbb1b('0x28')]=_[_0xbb1b('0x29')](_0x19f5fb[_0xbb1b('0x23')],_0x19f5fb[_0xbb1b('0x25')]);_0x5dfa7e['attributes']=_[_0xbb1b('0x29')](_0x19f5fb['model'],qs[_0xbb1b('0x2a')](_0x6c0bfe[_0xbb1b('0x25')][_0xbb1b('0x2a')]));_0x5dfa7e[_0xbb1b('0x2b')]=_0x5dfa7e[_0xbb1b('0x2b')][_0xbb1b('0x2c')]?_0x5dfa7e[_0xbb1b('0x2b')]:_0x19f5fb['model'];if(!_0x6c0bfe[_0xbb1b('0x25')][_0xbb1b('0x2d')](_0xbb1b('0x2e'))){_0x5dfa7e[_0xbb1b('0x18')]=qs['limit'](_0x6c0bfe[_0xbb1b('0x25')][_0xbb1b('0x18')]);_0x5dfa7e[_0xbb1b('0x17')]=qs['offset'](_0x6c0bfe[_0xbb1b('0x25')][_0xbb1b('0x17')]);}_0x5dfa7e[_0xbb1b('0x2f')]=qs[_0xbb1b('0x30')](_0x6c0bfe['query']['sort']);_0x5dfa7e[_0xbb1b('0x31')]=qs[_0xbb1b('0x28')](_[_0xbb1b('0x32')](_0x6c0bfe[_0xbb1b('0x25')],_0x19f5fb[_0xbb1b('0x28')]));if(_0x591480[_0xbb1b('0x27')]){if(_0x591480[_0xbb1b('0x26')]){_0x591480['dateEnd']=moment(_0x591480['dateEnd'])[_0xbb1b('0x33')](0x1,_0xbb1b('0x34'));}else{_0x591480[_0xbb1b('0x26')]=moment(_0x591480[_0xbb1b('0x27')])[_0xbb1b('0x33')](0x1,'day');}_[_0xbb1b('0x35')](_0x5dfa7e[_0xbb1b('0x31')],{'createdAt':{'$gte':_0x591480[_0xbb1b('0x27')],'$lte':_0x591480[_0xbb1b('0x26')]}});}if(_0x6c0bfe['query'][_0xbb1b('0x36')]){_0x5dfa7e['where']=_[_0xbb1b('0x35')](_0x5dfa7e[_0xbb1b('0x31')],{'$or':_['map'](_0x5dfa7e[_0xbb1b('0x2b')],function(_0x4937c5){var _0x5229df={};_0x5229df[_0x4937c5]={'$like':'%'+_0x6c0bfe[_0xbb1b('0x25')][_0xbb1b('0x36')]+'%'};return _0x5229df;})});}_0x5dfa7e=_['merge']({},_0x5dfa7e,_0x6c0bfe[_0xbb1b('0x37')]);var _0x1945d0={'where':_0x5dfa7e[_0xbb1b('0x31')]};return db[_0xbb1b('0x22')]['count'](_0x1945d0)[_0xbb1b('0x1e')](function(_0x21dc4b){_0x24af91['count']=_0x21dc4b;if(_0x6c0bfe['query'][_0xbb1b('0x38')]){_0x5dfa7e[_0xbb1b('0x39')]=[{'all':!![]}];}return db[_0xbb1b('0x22')][_0xbb1b('0x3a')](_0x5dfa7e);})[_0xbb1b('0x1e')](function(_0x4d5de6){_0x24af91[_0xbb1b('0x3b')]=_0x4d5de6;return _0x24af91;})[_0xbb1b('0x1e')](respondWithFilteredResult(_0x1b7ce1,_0x5dfa7e))['catch'](handleError(_0x1b7ce1,null));};exports[_0xbb1b('0x3c')]=function(_0x219946,_0x144ae8){var _0x3b16f2={'raw':!![],'where':{'id':_0x219946['params']['id']}},_0x3a3d6f={};_0x3a3d6f[_0xbb1b('0x23')]=_[_0xbb1b('0x24')](db[_0xbb1b('0x22')][_0xbb1b('0x3d')]);_0x3a3d6f[_0xbb1b('0x25')]=_[_0xbb1b('0x24')](_0x219946[_0xbb1b('0x25')]);_0x3a3d6f[_0xbb1b('0x28')]=_['intersection'](_0x3a3d6f[_0xbb1b('0x23')],_0x3a3d6f[_0xbb1b('0x25')]);_0x3b16f2[_0xbb1b('0x2b')]=_['intersection'](_0x3a3d6f[_0xbb1b('0x23')],qs[_0xbb1b('0x2a')](_0x219946['query'][_0xbb1b('0x2a')]));_0x3b16f2['attributes']=_0x3b16f2[_0xbb1b('0x2b')][_0xbb1b('0x2c')]?_0x3b16f2[_0xbb1b('0x2b')]:_0x3a3d6f[_0xbb1b('0x23')];if(_0x219946[_0xbb1b('0x25')][_0xbb1b('0x38')]){_0x3b16f2['include']=[{'all':!![]}];}_0x3b16f2=_[_0xbb1b('0x35')]({},_0x3b16f2,_0x219946[_0xbb1b('0x37')]);return db[_0xbb1b('0x22')]['find'](_0x3b16f2)['then'](handleEntityNotFound(_0x144ae8,null))[_0xbb1b('0x1e')](respondWithResult(_0x144ae8,null))[_0xbb1b('0x3e')](handleError(_0x144ae8,null));};exports[_0xbb1b('0x3f')]=function(_0x303129,_0x216f9b){return db['VoiceQueuesLog'][_0xbb1b('0x3f')](_0x303129['body'],{})[_0xbb1b('0x1e')](respondWithResult(_0x216f9b,0xc9))['catch'](handleError(_0x216f9b,null));};exports[_0xbb1b('0x40')]=function(_0x3f96d1,_0x5ceb77){if(_0x3f96d1['body']['id']){delete _0x3f96d1[_0xbb1b('0x41')]['id'];}return db[_0xbb1b('0x22')][_0xbb1b('0x42')]({'where':{'id':_0x3f96d1[_0xbb1b('0x43')]['id']}})[_0xbb1b('0x1e')](handleEntityNotFound(_0x5ceb77,null))[_0xbb1b('0x1e')](saveUpdates(_0x3f96d1[_0xbb1b('0x41')],null))['then'](respondWithResult(_0x5ceb77,null))['catch'](handleError(_0x5ceb77,null));};exports[_0xbb1b('0x1d')]=function(_0x19d40b,_0x59e896){return db[_0xbb1b('0x22')][_0xbb1b('0x42')]({'where':{'id':_0x19d40b['params']['id']}})['then'](handleEntityNotFound(_0x59e896,null))['then'](removeEntity(_0x59e896,null))['catch'](handleError(_0x59e896,null));}; \ No newline at end of file +var _0xbb30=['set','Content-Range','apply','reject','update','destroy','sendStatus','error','name','send','index','VoiceQueuesLog','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','then','includeAll','include','findAll','catch','params','length','create','body','find','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','count','offset','limit','status'];(function(_0xe0d5b1,_0x27837e){var _0x3b883f=function(_0x4c6bf9){while(--_0x4c6bf9){_0xe0d5b1['push'](_0xe0d5b1['shift']());}};_0x3b883f(++_0x27837e);}(_0xbb30,0xaf));var _0x0bb3=function(_0x532041,_0x55045e){_0x532041=_0x532041-0x0;var _0x2ed8f0=_0xbb30[_0x532041];return _0x2ed8f0;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0bb3('0x0'));var BPromise=require(_0x0bb3('0x1'));var Mustache=require('mustache');var util=require(_0x0bb3('0x2'));var path=require(_0x0bb3('0x3'));var sox=require(_0x0bb3('0x4'));var csv=require(_0x0bb3('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0bb3('0x6'));var squel=require(_0x0bb3('0x7'));var crypto=require('crypto');var jsforce=require(_0x0bb3('0x8'));var deskjs=require(_0x0bb3('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0bb3('0xa'));var Papa=require(_0x0bb3('0xb'));var qs=require(_0x0bb3('0xc'));var logger=require(_0x0bb3('0xd'))(_0x0bb3('0xe'));var utils=require(_0x0bb3('0xf'));var config=require(_0x0bb3('0x10'));var db=require(_0x0bb3('0x11'))['db'];function respondWithStatusCode(_0x3b3933,_0x5063f7){_0x5063f7=_0x5063f7||0xcc;return function(_0x5d8f91){if(_0x5d8f91){return _0x3b3933['sendStatus'](_0x5063f7);}return _0x3b3933['status'](_0x5063f7)[_0x0bb3('0x12')]();};}function respondWithResult(_0x493bc0,_0x15db5f){_0x15db5f=_0x15db5f||0xc8;return function(_0x4552b1){if(_0x4552b1){return _0x493bc0['status'](_0x15db5f)['json'](_0x4552b1);}};}function respondWithFilteredResult(_0x398919,_0x5048ce){return function(_0x27bd6b){if(_0x27bd6b){var _0x43ac39=_0x27bd6b[_0x0bb3('0x13')],_0x4afd9a=_0x5048ce[_0x0bb3('0x14')],_0x4e8c24=_0x5048ce['offset']+_0x5048ce[_0x0bb3('0x15')],_0x3c7059;if(_0x4e8c24>=_0x43ac39){_0x4e8c24=_0x43ac39;_0x3c7059=0xc8;}else{_0x3c7059=0xce;}_0x398919[_0x0bb3('0x16')](_0x3c7059);return _0x398919[_0x0bb3('0x17')](_0x0bb3('0x18'),_0x4afd9a+'-'+_0x4e8c24+'/'+_0x43ac39)['json'](_0x27bd6b);}return null;};}function patchUpdates(_0x39e743){return function(_0x1526d8){try{jsonpatch[_0x0bb3('0x19')](_0x1526d8,_0x39e743,!![]);}catch(_0x24a5ff){return BPromise[_0x0bb3('0x1a')](_0x24a5ff);}return _0x1526d8['save']();};}function saveUpdates(_0x15efd9,_0x54f2aa){return function(_0x1114b5){if(_0x1114b5){return _0x1114b5[_0x0bb3('0x1b')](_0x15efd9)['then'](function(_0xcdc34f){return _0xcdc34f;});}return null;};}function removeEntity(_0x3c83c4,_0x212661){return function(_0x560cfc){if(_0x560cfc){return _0x560cfc[_0x0bb3('0x1c')]()['then'](function(){_0x3c83c4[_0x0bb3('0x16')](0xcc)[_0x0bb3('0x12')]();});}};}function handleEntityNotFound(_0x153019,_0x34539e){return function(_0x35b3e4){if(!_0x35b3e4){_0x153019[_0x0bb3('0x1d')](0x194);}return _0x35b3e4;};}function handleError(_0x1061cf,_0xaf1f08){_0xaf1f08=_0xaf1f08||0x1f4;return function(_0x437d74){logger[_0x0bb3('0x1e')](_0x437d74['stack']);if(_0x437d74[_0x0bb3('0x1f')]){delete _0x437d74[_0x0bb3('0x1f')];}_0x1061cf[_0x0bb3('0x16')](_0xaf1f08)[_0x0bb3('0x20')](_0x437d74);};}exports[_0x0bb3('0x21')]=function(_0x46a2b5,_0x30e4be){var _0x4c5139={},_0x1469b1={},_0x5a3ee9={'count':0x0,'rows':[]};var _0x34fdeb=db[_0x0bb3('0x22')][_0x0bb3('0x23')];_0x1469b1[_0x0bb3('0x24')]=_[_0x0bb3('0x25')](_0x34fdeb);var _0x4d8865={'dateStart':_0x46a2b5[_0x0bb3('0x26')][_0x0bb3('0x27')],'dateEnd':_0x46a2b5[_0x0bb3('0x26')]['dateEnd']};delete _0x46a2b5['query'][_0x0bb3('0x27')];delete _0x46a2b5['query']['dateEnd'];_0x1469b1['query']=_[_0x0bb3('0x25')](_0x46a2b5[_0x0bb3('0x26')]);_0x1469b1[_0x0bb3('0x28')]=_[_0x0bb3('0x29')](_0x1469b1['model'],_0x1469b1[_0x0bb3('0x26')]);_0x4c5139[_0x0bb3('0x2a')]=_[_0x0bb3('0x29')](_0x1469b1[_0x0bb3('0x24')],qs[_0x0bb3('0x2b')](_0x46a2b5[_0x0bb3('0x26')][_0x0bb3('0x2b')]));_0x4c5139[_0x0bb3('0x2a')]=_0x4c5139[_0x0bb3('0x2a')]['length']?_0x4c5139[_0x0bb3('0x2a')]:_0x1469b1[_0x0bb3('0x24')];if(!_0x46a2b5[_0x0bb3('0x26')]['hasOwnProperty'](_0x0bb3('0x2c'))){_0x4c5139[_0x0bb3('0x15')]=qs[_0x0bb3('0x15')](_0x46a2b5[_0x0bb3('0x26')]['limit']);_0x4c5139[_0x0bb3('0x14')]=qs[_0x0bb3('0x14')](_0x46a2b5[_0x0bb3('0x26')][_0x0bb3('0x14')]);}_0x4c5139[_0x0bb3('0x2d')]=qs['sort'](_0x46a2b5['query'][_0x0bb3('0x2e')]);_0x4c5139[_0x0bb3('0x2f')]=qs['filters'](_[_0x0bb3('0x30')](_0x46a2b5['query'],_0x1469b1[_0x0bb3('0x28')]));if(_0x4d8865[_0x0bb3('0x27')]){if(_0x4d8865['dateEnd']){_0x4d8865[_0x0bb3('0x31')]=moment(_0x4d8865[_0x0bb3('0x31')])[_0x0bb3('0x32')](0x1,_0x0bb3('0x33'));}else{_0x4d8865[_0x0bb3('0x31')]=moment(_0x4d8865[_0x0bb3('0x27')])[_0x0bb3('0x32')](0x1,_0x0bb3('0x33'));}_[_0x0bb3('0x34')](_0x4c5139[_0x0bb3('0x2f')],{'createdAt':{'$gte':_0x4d8865[_0x0bb3('0x27')],'$lte':_0x4d8865['dateEnd']}});}if(_0x46a2b5[_0x0bb3('0x26')][_0x0bb3('0x35')]){_0x4c5139[_0x0bb3('0x2f')]=_[_0x0bb3('0x34')](_0x4c5139[_0x0bb3('0x2f')],{'$or':_[_0x0bb3('0x36')](_0x4c5139[_0x0bb3('0x2a')],function(_0x28ed3a){var _0x2c5a26={};_0x2c5a26[_0x28ed3a]={'$like':'%'+_0x46a2b5[_0x0bb3('0x26')][_0x0bb3('0x35')]+'%'};return _0x2c5a26;})});}_0x4c5139=_[_0x0bb3('0x34')]({},_0x4c5139,_0x46a2b5[_0x0bb3('0x37')]);var _0xbcaa90={'where':_0x4c5139[_0x0bb3('0x2f')]};return db[_0x0bb3('0x22')][_0x0bb3('0x13')](_0xbcaa90)[_0x0bb3('0x38')](function(_0x51c546){_0x5a3ee9[_0x0bb3('0x13')]=_0x51c546;if(_0x46a2b5[_0x0bb3('0x26')][_0x0bb3('0x39')]){_0x4c5139[_0x0bb3('0x3a')]=[{'all':!![]}];}return db[_0x0bb3('0x22')][_0x0bb3('0x3b')](_0x4c5139);})[_0x0bb3('0x38')](function(_0x37ccd0){_0x5a3ee9['rows']=_0x37ccd0;return _0x5a3ee9;})[_0x0bb3('0x38')](respondWithFilteredResult(_0x30e4be,_0x4c5139))[_0x0bb3('0x3c')](handleError(_0x30e4be,null));};exports['show']=function(_0x2c6eea,_0x21f68f){var _0x314af7={'raw':!![],'where':{'id':_0x2c6eea[_0x0bb3('0x3d')]['id']}},_0x7fa9c5={};_0x7fa9c5[_0x0bb3('0x24')]=_[_0x0bb3('0x25')](db[_0x0bb3('0x22')][_0x0bb3('0x23')]);_0x7fa9c5[_0x0bb3('0x26')]=_['keys'](_0x2c6eea[_0x0bb3('0x26')]);_0x7fa9c5['filters']=_[_0x0bb3('0x29')](_0x7fa9c5['model'],_0x7fa9c5[_0x0bb3('0x26')]);_0x314af7[_0x0bb3('0x2a')]=_['intersection'](_0x7fa9c5[_0x0bb3('0x24')],qs[_0x0bb3('0x2b')](_0x2c6eea['query'][_0x0bb3('0x2b')]));_0x314af7['attributes']=_0x314af7[_0x0bb3('0x2a')][_0x0bb3('0x3e')]?_0x314af7[_0x0bb3('0x2a')]:_0x7fa9c5[_0x0bb3('0x24')];if(_0x2c6eea['query'][_0x0bb3('0x39')]){_0x314af7[_0x0bb3('0x3a')]=[{'all':!![]}];}_0x314af7=_[_0x0bb3('0x34')]({},_0x314af7,_0x2c6eea[_0x0bb3('0x37')]);return db[_0x0bb3('0x22')]['find'](_0x314af7)[_0x0bb3('0x38')](handleEntityNotFound(_0x21f68f,null))[_0x0bb3('0x38')](respondWithResult(_0x21f68f,null))[_0x0bb3('0x3c')](handleError(_0x21f68f,null));};exports[_0x0bb3('0x3f')]=function(_0xa23edd,_0x552d83){return db[_0x0bb3('0x22')][_0x0bb3('0x3f')](_0xa23edd[_0x0bb3('0x40')],{})['then'](respondWithResult(_0x552d83,0xc9))['catch'](handleError(_0x552d83,null));};exports[_0x0bb3('0x1b')]=function(_0x3be30b,_0x5e7528){if(_0x3be30b[_0x0bb3('0x40')]['id']){delete _0x3be30b[_0x0bb3('0x40')]['id'];}return db['VoiceQueuesLog'][_0x0bb3('0x41')]({'where':{'id':_0x3be30b['params']['id']}})[_0x0bb3('0x38')](handleEntityNotFound(_0x5e7528,null))[_0x0bb3('0x38')](saveUpdates(_0x3be30b[_0x0bb3('0x40')],null))[_0x0bb3('0x38')](respondWithResult(_0x5e7528,null))[_0x0bb3('0x3c')](handleError(_0x5e7528,null));};exports[_0x0bb3('0x1c')]=function(_0xce0049,_0x12b2c4){return db[_0x0bb3('0x22')][_0x0bb3('0x41')]({'where':{'id':_0xce0049[_0x0bb3('0x3d')]['id']}})[_0x0bb3('0x38')](handleEntityNotFound(_0x12b2c4,null))[_0x0bb3('0x38')](removeEntity(_0x12b2c4,null))[_0x0bb3('0x3c')](handleError(_0x12b2c4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 1c02000..fb9fb88 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 _0x0375=['exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','bluebird','./voiceQueuesLog.attributes'];(function(_0x358acc,_0xf0f7e6){var _0xb3031a=function(_0x28a6a1){while(--_0x28a6a1){_0x358acc['push'](_0x358acc['shift']());}};_0xb3031a(++_0xf0f7e6);}(_0x0375,0xf7));var _0x5037=function(_0x467a9d,_0xa24b4e){_0x467a9d=_0x467a9d-0x0;var _0x478b42=_0x0375[_0x467a9d];return _0x478b42;};'use strict';var _=require(_0x5037('0x0'));var util=require(_0x5037('0x1'));var logger=require(_0x5037('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5037('0x3'));var rp=require('request-promise');var attributes=require(_0x5037('0x4'));module[_0x5037('0x5')]=function(_0x197da8,_0x5070f8){return _0x197da8[_0x5037('0x6')](_0x5037('0x7'),attributes,{'tableName':_0x5037('0x8'),'paranoid':![],'indexes':[{'name':_0x5037('0x9'),'fields':[_0x5037('0xa'),_0x5037('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7e47=['../../config/logger','api','moment','bluebird','define','VoiceQueuesLog','event','dtm','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7e47,0x19d));var _0x77e4=function(_0x31c0b2,_0x5db446){_0x31c0b2=_0x31c0b2-0x0;var _0x4f5c43=_0x7e47[_0x31c0b2];return _0x4f5c43;};'use strict';var _=require('lodash');var util=require(_0x77e4('0x0'));var logger=require(_0x77e4('0x1'))(_0x77e4('0x2'));var moment=require(_0x77e4('0x3'));var BPromise=require(_0x77e4('0x4'));var rp=require('request-promise');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x3d61bd,_0x5a83a5){return _0x3d61bd[_0x77e4('0x5')](_0x77e4('0x6'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x77e4('0x7'),_0x77e4('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 518d9d6..b9868af 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 _0xda79=['error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xda79,0x82));var _0x9da7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xda79[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var moment=require('moment');var BPromise=require(_0x9da7('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x9da7('0x3'))['db'];var utils=require(_0x9da7('0x4'));var logger=require(_0x9da7('0x5'))('rpc');var config=require(_0x9da7('0x6'));var jayson=require(_0x9da7('0x7'));var client=jayson[_0x9da7('0x8')][_0x9da7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d1a1,_0x1cfb66,_0x3fc0ba){return new BPromise(function(_0x558307,_0x5cd11e){return client[_0x9da7('0xa')](_0x2d1a1,_0x3fc0ba)['then'](function(_0x1c52b1){logger[_0x9da7('0xb')](_0x9da7('0xc'),_0x1cfb66,_0x9da7('0xd'));logger[_0x9da7('0xe')](_0x9da7('0xf'),_0x1cfb66,'request\x20sent',JSON[_0x9da7('0x10')](_0x1c52b1));if(_0x1c52b1[_0x9da7('0x11')]){if(_0x1c52b1[_0x9da7('0x11')]['code']===0x1f4){logger[_0x9da7('0x11')](_0x9da7('0xc'),_0x1cfb66,_0x1c52b1[_0x9da7('0x11')][_0x9da7('0x12')]);return _0x5cd11e(_0x1c52b1[_0x9da7('0x11')][_0x9da7('0x12')]);}logger[_0x9da7('0x11')](_0x9da7('0xc'),_0x1cfb66,_0x1c52b1['error'][_0x9da7('0x12')]);return _0x558307(_0x1c52b1[_0x9da7('0x11')][_0x9da7('0x12')]);}else{logger['info'](_0x9da7('0xc'),_0x1cfb66,_0x9da7('0xd'));_0x558307(_0x1c52b1[_0x9da7('0x13')][_0x9da7('0x12')]);}})[_0x9da7('0x14')](function(_0xb211b1){logger[_0x9da7('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1cfb66,_0xb211b1);_0x5cd11e(_0xb211b1);});});} \ No newline at end of file +var _0x0f17=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result'];(function(_0x432b87,_0x289bd0){var _0x3aa78a=function(_0x1e03ca){while(--_0x1e03ca){_0x432b87['push'](_0x432b87['shift']());}};_0x3aa78a(++_0x289bd0);}(_0x0f17,0xb9));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70f1('0x0'));var util=require(_0x70f1('0x1'));var moment=require(_0x70f1('0x2'));var BPromise=require(_0x70f1('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x70f1('0x4'))['db'];var utils=require(_0x70f1('0x5'));var logger=require(_0x70f1('0x6'))(_0x70f1('0x7'));var config=require(_0x70f1('0x8'));var jayson=require(_0x70f1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c96cb,_0xdc53c6,_0x497046){return new BPromise(function(_0xcd5620,_0x515642){return client[_0x70f1('0xa')](_0x5c96cb,_0x497046)[_0x70f1('0xb')](function(_0x6a3a49){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0xdc53c6,'request\x20sent');logger[_0x70f1('0xc')](_0x70f1('0xd'),_0xdc53c6,_0x70f1('0xe'),JSON[_0x70f1('0xf')](_0x6a3a49));if(_0x6a3a49[_0x70f1('0x10')]){if(_0x6a3a49[_0x70f1('0x10')][_0x70f1('0x11')]===0x1f4){logger[_0x70f1('0x10')](_0x70f1('0x12'),_0xdc53c6,_0x6a3a49['error'][_0x70f1('0x13')]);return _0x515642(_0x6a3a49['error'][_0x70f1('0x13')]);}logger[_0x70f1('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0xdc53c6,_0x6a3a49[_0x70f1('0x10')][_0x70f1('0x13')]);return _0xcd5620(_0x6a3a49[_0x70f1('0x10')][_0x70f1('0x13')]);}else{logger[_0x70f1('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0xdc53c6,_0x70f1('0xe'));_0xcd5620(_0x6a3a49[_0x70f1('0x15')]['message']);}})[_0x70f1('0x16')](function(_0x509c95){logger[_0x70f1('0x10')](_0x70f1('0x12'),_0xdc53c6,_0x509c95);_0x515642(_0x509c95);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 16c6aad..a4bdc0f 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 _0x56e6=['/:id','show','/:id/download','download','/:id/downloads','downloads','post','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3d15e0,_0x2b60dd){var _0x351975=function(_0x4a3e85){while(--_0x4a3e85){_0x3d15e0['push'](_0x3d15e0['shift']());}};_0x351975(++_0x2b60dd);}(_0x56e6,0x6b));var _0x656e=function(_0xd6e388,_0x3495ab){_0xd6e388=_0xd6e388-0x0;var _0xef7093=_0x56e6[_0xd6e388];return _0xef7093;};'use strict';var multer=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var path=require(_0x656e('0x2'));var express=require(_0x656e('0x3'));var router=express[_0x656e('0x4')]();var auth=require(_0x656e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x656e('0x6'));var controller=require(_0x656e('0x7'));router[_0x656e('0x8')]('/',auth[_0x656e('0x9')](),controller[_0x656e('0xa')]);router[_0x656e('0x8')](_0x656e('0xb'),auth['isAuthenticated'](),controller[_0x656e('0xc')]);router[_0x656e('0x8')](_0x656e('0xd'),auth[_0x656e('0x9')](),controller[_0x656e('0xe')]);router[_0x656e('0x8')](_0x656e('0xf'),auth[_0x656e('0x9')](),controller[_0x656e('0x10')]);router[_0x656e('0x8')](_0x656e('0x11'),controller[_0x656e('0x12')]);router[_0x656e('0x13')]('/',auth[_0x656e('0x9')](),controller['create']);router['put'](_0x656e('0xd'),auth[_0x656e('0x9')](),controller[_0x656e('0x14')]);router[_0x656e('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x656e('0x16')]);module[_0x656e('0x17')]=router; \ No newline at end of file +var _0xeea0=['./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','/:id/download','download','downloads','create','put','delete','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2376d1,_0x38eec4){var _0x443759=function(_0x73c733){while(--_0x73c733){_0x2376d1['push'](_0x2376d1['shift']());}};_0x443759(++_0x38eec4);}(_0xeea0,0x91));var _0x0eea=function(_0x56a1e9,_0xb5ce2b){_0x56a1e9=_0x56a1e9-0x0;var _0x22fd83=_0xeea0[_0x56a1e9];return _0x22fd83;};'use strict';var multer=require(_0x0eea('0x0'));var util=require(_0x0eea('0x1'));var path=require(_0x0eea('0x2'));var express=require(_0x0eea('0x3'));var router=express[_0x0eea('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0eea('0x5'));var config=require(_0x0eea('0x6'));var controller=require(_0x0eea('0x7'));router[_0x0eea('0x8')]('/',auth[_0x0eea('0x9')](),controller[_0x0eea('0xa')]);router[_0x0eea('0x8')]('/describe',auth[_0x0eea('0x9')](),controller[_0x0eea('0xb')]);router[_0x0eea('0x8')](_0x0eea('0xc'),auth[_0x0eea('0x9')](),controller['show']);router[_0x0eea('0x8')](_0x0eea('0xd'),auth[_0x0eea('0x9')](),controller[_0x0eea('0xe')]);router['get']('/:id/downloads',controller[_0x0eea('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0eea('0x10')]);router[_0x0eea('0x11')]('/:id',auth[_0x0eea('0x9')](),controller['update']);router[_0x0eea('0x12')]('/:id',auth[_0x0eea('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 0f1e5ef..b0946af 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 _0x3a46=['setDataValue','channel','membername','INTEGER','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','path','exports','VIRTUAL','getDataValue','value','extname','STRING'];(function(_0x28f892,_0x41187e){var _0x582d6d=function(_0x17ca57){while(--_0x17ca57){_0x28f892['push'](_0x28f892['shift']());}};_0x582d6d(++_0x41187e);}(_0x3a46,0x13c));var _0x63a4=function(_0x1ea268,_0x60194){_0x1ea268=_0x1ea268-0x0;var _0x3d5fd2=_0x3a46[_0x1ea268];return _0x3d5fd2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x63a4('0x0'));module[_0x63a4('0x1')]={'format':{'type':Sequelize[_0x63a4('0x2')],'get':function(){return this[_0x63a4('0x3')](_0x63a4('0x4'))?path[_0x63a4('0x5')](this[_0x63a4('0x3')](_0x63a4('0x4'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x63a4('0x6')],'set':function(_0xc36ab7){if(_0xc36ab7){this[_0x63a4('0x7')](_0x63a4('0x8'),_0xc36ab7);this[_0x63a4('0x7')](_0x63a4('0x9'),_0xc36ab7['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x63a4('0x6')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x63a4('0x6')]},'connectedlinename':{'type':Sequelize[_0x63a4('0x6')]},'accountcode':{'type':Sequelize[_0x63a4('0x6')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x63a4('0x6')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x63a4('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x63a4('0x6')]},'userDisposition':{'type':Sequelize[_0x63a4('0x6')]},'createdAt':{'type':Sequelize[_0x63a4('0xb')],'get':function(){return moment(this[_0x63a4('0x3')](_0x63a4('0xc')))['format'](_0x63a4('0xd'))[_0x63a4('0xe')]();}},'updatedAt':{'type':Sequelize[_0x63a4('0xb')],'get':function(){return moment(this['getDataValue'](_0x63a4('0xf')))[_0x63a4('0x10')](_0x63a4('0xd'))[_0x63a4('0xe')]();}}}; \ No newline at end of file +var _0xd03c=['value','extname','getDataValue','STRING','setDataValue','channel','split','INTEGER','DATE','format','MM-DD-YYYY\x20HH:mm','updatedAt','toString','exports','VIRTUAL'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xd03c,0x166));var _0xcd03=function(_0x5f1970,_0x2b50c9){_0x5f1970=_0x5f1970-0x0;var _0x9f5eca=_0xd03c[_0x5f1970];return _0x9f5eca;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');module[_0xcd03('0x0')]={'format':{'type':Sequelize[_0xcd03('0x1')],'get':function(){return this['getDataValue'](_0xcd03('0x2'))?path[_0xcd03('0x3')](this[_0xcd03('0x4')](_0xcd03('0x2'))):undefined;}},'uniqueid':{'type':Sequelize[_0xcd03('0x5')]},'channel':{'type':Sequelize[_0xcd03('0x5')],'set':function(_0x2cb32b){if(_0x2cb32b){this[_0xcd03('0x6')](_0xcd03('0x7'),_0x2cb32b);this[_0xcd03('0x6')]('membername',_0x2cb32b[_0xcd03('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xcd03('0x5')]},'calleridnum':{'type':Sequelize[_0xcd03('0x5')]},'calleridname':{'type':Sequelize[_0xcd03('0x5')]},'connectedlinenum':{'type':Sequelize[_0xcd03('0x5')]},'connectedlinename':{'type':Sequelize[_0xcd03('0x5')]},'accountcode':{'type':Sequelize[_0xcd03('0x5')]},'context':{'type':Sequelize[_0xcd03('0x5')]},'exten':{'type':Sequelize[_0xcd03('0x5')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcd03('0x5')]},'rating':{'type':Sequelize[_0xcd03('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xcd03('0x5')]},'userDisposition':{'type':Sequelize[_0xcd03('0x5')]},'createdAt':{'type':Sequelize[_0xcd03('0xa')],'get':function(){return moment(this[_0xcd03('0x4')]('createdAt'))[_0xcd03('0xb')](_0xcd03('0xc'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcd03('0x4')](_0xcd03('0xd')))[_0xcd03('0xb')](_0xcd03('0xc'))[_0xcd03('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 75203c3..c74f4a3 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 _0xdb28=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','rawAttributes','model','differenceBy','keys','query','dateStart','dateEnd','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filters','add','day','merge','filter','map','options','VoiceRecording','includeAll','include','rows','catch','show','params','find','create','body','describe','download','type','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','../../components/encryptor','sequelize','MD5','col','token','push','$and','format','secrets','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x130908,_0x3bc9a9){var _0xa360c6=function(_0x39a003){while(--_0x39a003){_0x130908['push'](_0x130908['shift']());}};_0xa360c6(++_0x3bc9a9);}(_0xdb28,0x106));var _0x8db2=function(_0xb5d304,_0x3350df){_0xb5d304=_0xb5d304-0x0;var _0x28bb78=_0xdb28[_0xb5d304];return _0x28bb78;};'use strict';var jsonpatch=require(_0x8db2('0x0'));var rp=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var Mustache=require('mustache');var util=require(_0x8db2('0x4'));var path=require(_0x8db2('0x5'));var sox=require(_0x8db2('0x6'));var csv=require(_0x8db2('0x7'));var ejs=require(_0x8db2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0x9'));var crypto=require(_0x8db2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8db2('0x7'));var querystring=require(_0x8db2('0xb'));var Papa=require(_0x8db2('0xc'));var qs=require(_0x8db2('0xd'));var logger=require(_0x8db2('0xe'))(_0x8db2('0xf'));var utils=require(_0x8db2('0x10'));var config=require('../../config/environment');var db=require(_0x8db2('0x11'))['db'];function respondWithStatusCode(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xcc;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0x12')](_0x1f62af);}return _0x476216[_0x8db2('0x13')](_0x1f62af)['end']();};}function respondWithResult(_0x41beda,_0x3b2faa){_0x3b2faa=_0x3b2faa||0xc8;return function(_0x1349f6){if(_0x1349f6){return _0x41beda[_0x8db2('0x13')](_0x3b2faa)[_0x8db2('0x14')](_0x1349f6);}};}function respondWithFilteredResult(_0x559fb1,_0x49fadc){return function(_0x15070d){if(_0x15070d){var _0x15e87c=_0x15070d[_0x8db2('0x15')],_0x350d61=_0x49fadc[_0x8db2('0x16')],_0x1d6a15=_0x49fadc[_0x8db2('0x16')]+_0x49fadc[_0x8db2('0x17')],_0x227355;if(_0x1d6a15>=_0x15e87c){_0x1d6a15=_0x15e87c;_0x227355=0xc8;}else{_0x227355=0xce;}_0x559fb1[_0x8db2('0x13')](_0x227355);return _0x559fb1['set'](_0x8db2('0x18'),_0x350d61+'-'+_0x1d6a15+'/'+_0x15e87c)[_0x8db2('0x14')](_0x15070d);}return null;};}function patchUpdates(_0x48101e){return function(_0x2b3f73){try{jsonpatch[_0x8db2('0x19')](_0x2b3f73,_0x48101e,!![]);}catch(_0x21db8c){return BPromise[_0x8db2('0x1a')](_0x21db8c);}return _0x2b3f73[_0x8db2('0x1b')]();};}function saveUpdates(_0x46ce14,_0x51d60d){return function(_0x5df464){if(_0x5df464){return _0x5df464[_0x8db2('0x1c')](_0x46ce14)[_0x8db2('0x1d')](function(_0x1310d3){return _0x1310d3;});}return null;};}function removeEntity(_0x1b64e4,_0x58562e){return function(_0x431d60){if(_0x431d60){return _0x431d60[_0x8db2('0x1e')]()[_0x8db2('0x1d')](function(){_0x1b64e4[_0x8db2('0x13')](0xcc)[_0x8db2('0x1f')]();});}};}function handleEntityNotFound(_0x597260,_0x124467){return function(_0x3e30e6){if(!_0x3e30e6){_0x597260[_0x8db2('0x12')](0x194);}return _0x3e30e6;};}function handleError(_0x125be2,_0x2260d8){_0x2260d8=_0x2260d8||0x1f4;return function(_0x21704c){logger[_0x8db2('0x20')](_0x21704c['stack']);if(_0x21704c[_0x8db2('0x21')]){delete _0x21704c['name'];}_0x125be2['status'](_0x2260d8)['send'](_0x21704c);};}exports['index']=function(_0xec8cd2,_0x29b5cd){var _0x3be281={},_0x2baed0={},_0x145328={'count':0x0,'rows':[]};var _0x8d4f54=db['VoiceRecording'][_0x8db2('0x22')];_0x2baed0[_0x8db2('0x23')]=_[_0x8db2('0x24')](_[_0x8db2('0x25')](_0x8d4f54),['format']);var _0x2e0691={'dateStart':_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x27')],'dateEnd':_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x28')]};delete _0xec8cd2[_0x8db2('0x26')][_0x8db2('0x27')];delete _0xec8cd2[_0x8db2('0x26')][_0x8db2('0x28')];_0x2baed0['query']=_[_0x8db2('0x25')](_0xec8cd2['query']);_0x2baed0['filters']=_[_0x8db2('0x29')](_0x2baed0[_0x8db2('0x23')],_0x2baed0[_0x8db2('0x26')]);_0x3be281['attributes']=_[_0x8db2('0x29')](_0x2baed0['model'],qs[_0x8db2('0x2a')](_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x2a')]));_0x3be281['attributes']=_0x3be281['attributes'][_0x8db2('0x2b')]?_0x3be281[_0x8db2('0x2c')]:_0x2baed0['model'];if(!_0xec8cd2['query'][_0x8db2('0x2d')](_0x8db2('0x2e'))){_0x3be281[_0x8db2('0x17')]=qs[_0x8db2('0x17')](_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x17')]);_0x3be281[_0x8db2('0x16')]=qs[_0x8db2('0x16')](_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x16')]);}_0x3be281['order']=qs[_0x8db2('0x2f')](_0xec8cd2[_0x8db2('0x26')]['sort']);_0x3be281[_0x8db2('0x30')]=qs[_0x8db2('0x31')](_['pick'](_0xec8cd2['query'],_0x2baed0[_0x8db2('0x31')]));if(_0x2e0691['dateStart']){if(_0x2e0691[_0x8db2('0x28')]){_0x2e0691[_0x8db2('0x28')]=moment(_0x2e0691[_0x8db2('0x28')])[_0x8db2('0x32')](0x1,'day');}else{_0x2e0691[_0x8db2('0x28')]=moment(_0x2e0691['dateStart'])[_0x8db2('0x32')](0x1,_0x8db2('0x33'));}_[_0x8db2('0x34')](_0x3be281[_0x8db2('0x30')],{'createdAt':{'$gte':_0x2e0691['dateStart'],'$lte':_0x2e0691['dateEnd']}});}if(_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x35')]){_0x3be281['where']=_[_0x8db2('0x34')](_0x3be281[_0x8db2('0x30')],{'$or':_[_0x8db2('0x36')](_0x3be281['attributes'],function(_0x152e15){var _0x149186={};_0x149186[_0x152e15]={'$like':'%'+_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x35')]+'%'};return _0x149186;})});}_0x3be281=_[_0x8db2('0x34')]({},_0x3be281,_0xec8cd2[_0x8db2('0x37')]);var _0x380046={'where':_0x3be281[_0x8db2('0x30')]};return db[_0x8db2('0x38')][_0x8db2('0x15')](_0x380046)[_0x8db2('0x1d')](function(_0x20bf0b){_0x145328[_0x8db2('0x15')]=_0x20bf0b;if(_0xec8cd2['query'][_0x8db2('0x39')]){_0x3be281[_0x8db2('0x3a')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x3be281);})[_0x8db2('0x1d')](function(_0x4f1a49){_0x145328[_0x8db2('0x3b')]=_0x4f1a49;return _0x145328;})[_0x8db2('0x1d')](respondWithFilteredResult(_0x29b5cd,_0x3be281))[_0x8db2('0x3c')](handleError(_0x29b5cd,null));};exports[_0x8db2('0x3d')]=function(_0xb4fe2c,_0x30d606){var _0xa53fba={'raw':![],'where':{'id':_0xb4fe2c[_0x8db2('0x3e')]['id']}},_0x5c97ef={};_0x5c97ef[_0x8db2('0x23')]=_[_0x8db2('0x25')](db[_0x8db2('0x38')]['rawAttributes']);_0x5c97ef[_0x8db2('0x26')]=_[_0x8db2('0x25')](_0xb4fe2c[_0x8db2('0x26')]);_0x5c97ef[_0x8db2('0x31')]=_['intersection'](_0x5c97ef[_0x8db2('0x23')],_0x5c97ef['query']);_0xa53fba[_0x8db2('0x2c')]=_[_0x8db2('0x29')](_0x5c97ef[_0x8db2('0x23')],qs['fields'](_0xb4fe2c['query'][_0x8db2('0x2a')]));_0xa53fba['attributes']=_0xa53fba[_0x8db2('0x2c')][_0x8db2('0x2b')]?_0xa53fba[_0x8db2('0x2c')]:_0x5c97ef[_0x8db2('0x23')];if(_0xb4fe2c[_0x8db2('0x26')][_0x8db2('0x39')]){_0xa53fba[_0x8db2('0x3a')]=[{'all':!![]}];}_0xa53fba=_[_0x8db2('0x34')]({},_0xa53fba,_0xb4fe2c[_0x8db2('0x37')]);return db[_0x8db2('0x38')][_0x8db2('0x3f')](_0xa53fba)[_0x8db2('0x1d')](handleEntityNotFound(_0x30d606,null))['then'](respondWithResult(_0x30d606,null))[_0x8db2('0x3c')](handleError(_0x30d606,null));};exports[_0x8db2('0x40')]=function(_0xdbba64,_0x3244db){return db['VoiceRecording']['create'](_0xdbba64[_0x8db2('0x41')],{})[_0x8db2('0x1d')](respondWithResult(_0x3244db,0xc9))[_0x8db2('0x3c')](handleError(_0x3244db,null));};exports['update']=function(_0x540d90,_0x494d6e){if(_0x540d90[_0x8db2('0x41')]['id']){delete _0x540d90[_0x8db2('0x41')]['id'];}return db[_0x8db2('0x38')][_0x8db2('0x3f')]({'where':{'id':_0x540d90[_0x8db2('0x3e')]['id']}})[_0x8db2('0x1d')](handleEntityNotFound(_0x494d6e,null))[_0x8db2('0x1d')](saveUpdates(_0x540d90['body'],null))['then'](respondWithResult(_0x494d6e,null))[_0x8db2('0x3c')](handleError(_0x494d6e,null));};exports[_0x8db2('0x1e')]=function(_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x38')][_0x8db2('0x3f')]({'where':{'id':_0x2908e4[_0x8db2('0x3e')]['id']}})[_0x8db2('0x1d')](handleEntityNotFound(_0x2f0bd0,null))[_0x8db2('0x1d')](removeEntity(_0x2f0bd0,null))[_0x8db2('0x3c')](handleError(_0x2f0bd0,null));};exports[_0x8db2('0x42')]=function(_0x319273,_0x345c74){return db[_0x8db2('0x38')][_0x8db2('0x42')]()['then'](respondWithResult(_0x345c74,null))[_0x8db2('0x3c')](handleError(_0x345c74,null));};exports[_0x8db2('0x43')]=function(_0x579317,_0x27b644,_0xd78022){var _0x3af298=require('../../components/encryptor');var _0x3498dc=![];var _0x27acd2={};if(_0x579317[_0x8db2('0x26')][_0x8db2('0x44')]&&_0x579317[_0x8db2('0x26')]['type']===_0x8db2('0x45')){_0x27acd2[_0x8db2('0x45')]=_0x579317[_0x8db2('0x3e')]['id'];}else{_0x27acd2['id']=_0x579317['params']['id'];}return db[_0x8db2('0x38')][_0x8db2('0x3f')]({'where':_0x27acd2,'attributes':['id',_0x8db2('0x46')],'raw':!![]})[_0x8db2('0x1d')](handleEntityNotFound(_0x27b644,null))[_0x8db2('0x1d')](function(_0x16d897){if(_0x16d897){var _0x12a81a=util['format'](_0x8db2('0x47'),_0x16d897[_0x8db2('0x46')]);if(fs['existsSync'](_0x12a81a)){_0x3498dc=!![];return _0x3af298[_0x8db2('0x48')](_0x12a81a,_0x16d897[_0x8db2('0x46')],config['secrets'][_0x8db2('0x49')])[_0x8db2('0x1d')](function(){return _0x16d897;});}return _0x16d897;}})[_0x8db2('0x1d')](function(_0x30f4f3){if(_0x30f4f3){if(!fs[_0x8db2('0x4a')](_0x30f4f3[_0x8db2('0x46')])){throw new db[(_0x8db2('0x4b'))][(_0x8db2('0x4c'))](_0x8db2('0x4d'));}if(_0x30f4f3[_0x8db2('0x4e')]){return _0x27b644[_0x8db2('0x43')](_0x30f4f3[_0x8db2('0x46')],_0x30f4f3[_0x8db2('0x4e')]+path[_0x8db2('0x4f')](_0x30f4f3[_0x8db2('0x46')]),function(){if(_0x3498dc){fs[_0x8db2('0x50')](_0x30f4f3['value']);}});}else{return _0x27b644[_0x8db2('0x43')](_0x30f4f3[_0x8db2('0x46')],function(_0x44118a){if(_0x3498dc){fs[_0x8db2('0x50')](_0x30f4f3[_0x8db2('0x46')]);}});}}})['catch'](handleError(_0x27b644,null));};exports[_0x8db2('0x51')]=function(_0x2c3087,_0x3ab670,_0x1e1c0d){var _0x2ad70f=require(_0x8db2('0x52'));var _0x17341d=![];var _0x2c7b04={'$and':[db[_0x8db2('0x53')][_0x8db2('0x30')](db[_0x8db2('0x53')]['fn'](_0x8db2('0x54'),db[_0x8db2('0x53')][_0x8db2('0x55')](_0x8db2('0x45'))),_0x2c3087[_0x8db2('0x26')][_0x8db2('0x56')])]};if(_0x2c3087[_0x8db2('0x26')]['type']&&_0x2c3087[_0x8db2('0x26')]['type']===_0x8db2('0x45')){_0x2c7b04['$and'][_0x8db2('0x57')]({'uniqueid':_0x2c3087[_0x8db2('0x3e')]['id']});}else{_0x2c7b04[_0x8db2('0x58')][_0x8db2('0x57')]({'id':_0x2c3087[_0x8db2('0x3e')]['id']});}return db['VoiceRecording']['find']({'where':_0x2c7b04,'attributes':['id',_0x8db2('0x46')],'raw':!![]})[_0x8db2('0x1d')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x1d')](function(_0x3ba1d2){if(_0x3ba1d2){var _0x20b49c=util[_0x8db2('0x59')](_0x8db2('0x47'),_0x3ba1d2[_0x8db2('0x46')]);if(fs['existsSync'](_0x20b49c)){_0x17341d=!![];return _0x2ad70f[_0x8db2('0x48')](_0x20b49c,_0x3ba1d2[_0x8db2('0x46')],config[_0x8db2('0x5a')][_0x8db2('0x49')])[_0x8db2('0x1d')](function(){return _0x3ba1d2;});}return _0x3ba1d2;}})[_0x8db2('0x1d')](function(_0x451746){if(_0x451746){if(!fs[_0x8db2('0x4a')](_0x451746['value'])){throw new db['Sequelize'][(_0x8db2('0x4c'))](_0x8db2('0x4d'));}if(_0x451746[_0x8db2('0x4e')]){return _0x3ab670[_0x8db2('0x43')](_0x451746[_0x8db2('0x46')],_0x451746['filename']+path['extname'](_0x451746[_0x8db2('0x46')]),function(){if(_0x17341d){fs[_0x8db2('0x50')](_0x451746['value']);}});}else{return _0x3ab670[_0x8db2('0x43')](_0x451746[_0x8db2('0x46')],function(_0x1ab84c){if(_0x17341d){fs['unlink'](_0x451746[_0x8db2('0x46')]);}});}}})[_0x8db2('0x3c')](handleError(_0x3ab670,null));}; \ No newline at end of file +var _0xadb5=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','VoiceRecording','rawAttributes','differenceBy','keys','format','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','day','merge','filter','count','includeAll','include','rows','catch','show','length','find','create','body','params','describe','type','uniqueid','value','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','../../components/encryptor','sequelize','col','token','$and','push','%s.cypher','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x4cc546,_0x4772ea){_0x4cc546=_0x4cc546-0x0;var _0x160659=_0xadb5[_0x4cc546];return _0x160659;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var Mustache=require(_0x5adb('0x2'));var util=require(_0x5adb('0x3'));var path=require('path');var sox=require(_0x5adb('0x4'));var csv=require(_0x5adb('0x5'));var ejs=require(_0x5adb('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5adb('0x7'));var crypto=require(_0x5adb('0x8'));var jsforce=require(_0x5adb('0x9'));var deskjs=require(_0x5adb('0xa'));var toCsv=require(_0x5adb('0x5'));var querystring=require(_0x5adb('0xb'));var Papa=require(_0x5adb('0xc'));var qs=require(_0x5adb('0xd'));var logger=require(_0x5adb('0xe'))(_0x5adb('0xf'));var utils=require(_0x5adb('0x10'));var config=require(_0x5adb('0x11'));var db=require(_0x5adb('0x12'))['db'];function respondWithStatusCode(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xcc;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0x13')](_0x563d86);}return _0x275428[_0x5adb('0x14')](_0x563d86)[_0x5adb('0x15')]();};}function respondWithResult(_0x53b772,_0x29f0d5){_0x29f0d5=_0x29f0d5||0xc8;return function(_0x56012f){if(_0x56012f){return _0x53b772[_0x5adb('0x14')](_0x29f0d5)['json'](_0x56012f);}};}function respondWithFilteredResult(_0x8cfcc6,_0x39a0b3){return function(_0x44abe3){if(_0x44abe3){var _0x5c929a=_0x44abe3['count'],_0x2a545b=_0x39a0b3[_0x5adb('0x16')],_0x34af2c=_0x39a0b3['offset']+_0x39a0b3[_0x5adb('0x17')],_0xf82f72;if(_0x34af2c>=_0x5c929a){_0x34af2c=_0x5c929a;_0xf82f72=0xc8;}else{_0xf82f72=0xce;}_0x8cfcc6[_0x5adb('0x14')](_0xf82f72);return _0x8cfcc6[_0x5adb('0x18')](_0x5adb('0x19'),_0x2a545b+'-'+_0x34af2c+'/'+_0x5c929a)[_0x5adb('0x1a')](_0x44abe3);}return null;};}function patchUpdates(_0x39d24d){return function(_0xa29dc){try{jsonpatch[_0x5adb('0x1b')](_0xa29dc,_0x39d24d,!![]);}catch(_0xb953a6){return BPromise['reject'](_0xb953a6);}return _0xa29dc[_0x5adb('0x1c')]();};}function saveUpdates(_0x5de028,_0x1d9e86){return function(_0x558f76){if(_0x558f76){return _0x558f76[_0x5adb('0x1d')](_0x5de028)['then'](function(_0x5e218c){return _0x5e218c;});}return null;};}function removeEntity(_0x1fbaa5,_0x1bed20){return function(_0x438671){if(_0x438671){return _0x438671[_0x5adb('0x1e')]()[_0x5adb('0x1f')](function(){_0x1fbaa5['status'](0xcc)[_0x5adb('0x15')]();});}};}function handleEntityNotFound(_0x5c296e,_0x4e9f16){return function(_0x3754cc){if(!_0x3754cc){_0x5c296e[_0x5adb('0x13')](0x194);}return _0x3754cc;};}function handleError(_0x1a38d3,_0x1a8014){_0x1a8014=_0x1a8014||0x1f4;return function(_0x1e9ccf){logger[_0x5adb('0x20')](_0x1e9ccf[_0x5adb('0x21')]);if(_0x1e9ccf['name']){delete _0x1e9ccf[_0x5adb('0x22')];}_0x1a38d3[_0x5adb('0x14')](_0x1a8014)[_0x5adb('0x23')](_0x1e9ccf);};}exports[_0x5adb('0x24')]=function(_0xeb556c,_0x49f203){var _0x2fee18={},_0x2e1e63={},_0x5aed76={'count':0x0,'rows':[]};var _0x1feecf=db[_0x5adb('0x25')][_0x5adb('0x26')];_0x2e1e63['model']=_[_0x5adb('0x27')](_[_0x5adb('0x28')](_0x1feecf),[_0x5adb('0x29')]);var _0x2c64a3={'dateStart':_0xeb556c[_0x5adb('0x2a')][_0x5adb('0x2b')],'dateEnd':_0xeb556c['query']['dateEnd']};delete _0xeb556c['query'][_0x5adb('0x2b')];delete _0xeb556c[_0x5adb('0x2a')][_0x5adb('0x2c')];_0x2e1e63[_0x5adb('0x2a')]=_[_0x5adb('0x28')](_0xeb556c['query']);_0x2e1e63[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x2e1e63[_0x5adb('0x2f')],_0x2e1e63[_0x5adb('0x2a')]);_0x2fee18[_0x5adb('0x30')]=_[_0x5adb('0x2e')](_0x2e1e63[_0x5adb('0x2f')],qs[_0x5adb('0x31')](_0xeb556c[_0x5adb('0x2a')][_0x5adb('0x31')]));_0x2fee18['attributes']=_0x2fee18[_0x5adb('0x30')]['length']?_0x2fee18[_0x5adb('0x30')]:_0x2e1e63[_0x5adb('0x2f')];if(!_0xeb556c['query'][_0x5adb('0x32')](_0x5adb('0x33'))){_0x2fee18[_0x5adb('0x17')]=qs['limit'](_0xeb556c[_0x5adb('0x2a')][_0x5adb('0x17')]);_0x2fee18['offset']=qs['offset'](_0xeb556c[_0x5adb('0x2a')]['offset']);}_0x2fee18[_0x5adb('0x34')]=qs[_0x5adb('0x35')](_0xeb556c[_0x5adb('0x2a')][_0x5adb('0x35')]);_0x2fee18[_0x5adb('0x36')]=qs['filters'](_[_0x5adb('0x37')](_0xeb556c[_0x5adb('0x2a')],_0x2e1e63[_0x5adb('0x2d')]));if(_0x2c64a3['dateStart']){if(_0x2c64a3['dateEnd']){_0x2c64a3[_0x5adb('0x2c')]=moment(_0x2c64a3[_0x5adb('0x2c')])['add'](0x1,_0x5adb('0x38'));}else{_0x2c64a3['dateEnd']=moment(_0x2c64a3[_0x5adb('0x2b')])['add'](0x1,_0x5adb('0x38'));}_['merge'](_0x2fee18[_0x5adb('0x36')],{'createdAt':{'$gte':_0x2c64a3[_0x5adb('0x2b')],'$lte':_0x2c64a3['dateEnd']}});}if(_0xeb556c[_0x5adb('0x2a')]['filter']){_0x2fee18[_0x5adb('0x36')]=_[_0x5adb('0x39')](_0x2fee18[_0x5adb('0x36')],{'$or':_['map'](_0x2fee18[_0x5adb('0x30')],function(_0x2b3b0b){var _0xcdaf8e={};_0xcdaf8e[_0x2b3b0b]={'$like':'%'+_0xeb556c[_0x5adb('0x2a')][_0x5adb('0x3a')]+'%'};return _0xcdaf8e;})});}_0x2fee18=_['merge']({},_0x2fee18,_0xeb556c['options']);var _0x4f491a={'where':_0x2fee18['where']};return db[_0x5adb('0x25')][_0x5adb('0x3b')](_0x4f491a)[_0x5adb('0x1f')](function(_0x399489){_0x5aed76[_0x5adb('0x3b')]=_0x399489;if(_0xeb556c[_0x5adb('0x2a')][_0x5adb('0x3c')]){_0x2fee18[_0x5adb('0x3d')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x2fee18);})[_0x5adb('0x1f')](function(_0x48eb26){_0x5aed76[_0x5adb('0x3e')]=_0x48eb26;return _0x5aed76;})[_0x5adb('0x1f')](respondWithFilteredResult(_0x49f203,_0x2fee18))[_0x5adb('0x3f')](handleError(_0x49f203,null));};exports[_0x5adb('0x40')]=function(_0xdfecfd,_0x522ee5){var _0x43d320={'raw':![],'where':{'id':_0xdfecfd['params']['id']}},_0x565b03={};_0x565b03[_0x5adb('0x2f')]=_[_0x5adb('0x28')](db['VoiceRecording'][_0x5adb('0x26')]);_0x565b03[_0x5adb('0x2a')]=_[_0x5adb('0x28')](_0xdfecfd[_0x5adb('0x2a')]);_0x565b03[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x565b03[_0x5adb('0x2f')],_0x565b03['query']);_0x43d320['attributes']=_[_0x5adb('0x2e')](_0x565b03[_0x5adb('0x2f')],qs[_0x5adb('0x31')](_0xdfecfd[_0x5adb('0x2a')]['fields']));_0x43d320['attributes']=_0x43d320[_0x5adb('0x30')][_0x5adb('0x41')]?_0x43d320[_0x5adb('0x30')]:_0x565b03[_0x5adb('0x2f')];if(_0xdfecfd[_0x5adb('0x2a')]['includeAll']){_0x43d320[_0x5adb('0x3d')]=[{'all':!![]}];}_0x43d320=_[_0x5adb('0x39')]({},_0x43d320,_0xdfecfd['options']);return db[_0x5adb('0x25')][_0x5adb('0x42')](_0x43d320)[_0x5adb('0x1f')](handleEntityNotFound(_0x522ee5,null))[_0x5adb('0x1f')](respondWithResult(_0x522ee5,null))[_0x5adb('0x3f')](handleError(_0x522ee5,null));};exports[_0x5adb('0x43')]=function(_0x39840e,_0x54252){return db['VoiceRecording'][_0x5adb('0x43')](_0x39840e['body'],{})['then'](respondWithResult(_0x54252,0xc9))['catch'](handleError(_0x54252,null));};exports[_0x5adb('0x1d')]=function(_0x3fbac8,_0x207a81){if(_0x3fbac8['body']['id']){delete _0x3fbac8[_0x5adb('0x44')]['id'];}return db['VoiceRecording'][_0x5adb('0x42')]({'where':{'id':_0x3fbac8[_0x5adb('0x45')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x207a81,null))['then'](saveUpdates(_0x3fbac8[_0x5adb('0x44')],null))['then'](respondWithResult(_0x207a81,null))[_0x5adb('0x3f')](handleError(_0x207a81,null));};exports[_0x5adb('0x1e')]=function(_0x55c535,_0x2402a3){return db[_0x5adb('0x25')][_0x5adb('0x42')]({'where':{'id':_0x55c535[_0x5adb('0x45')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x2402a3,null))['then'](removeEntity(_0x2402a3,null))[_0x5adb('0x3f')](handleError(_0x2402a3,null));};exports[_0x5adb('0x46')]=function(_0x3bcf6f,_0x1b0938){return db['VoiceRecording'][_0x5adb('0x46')]()[_0x5adb('0x1f')](respondWithResult(_0x1b0938,null))[_0x5adb('0x3f')](handleError(_0x1b0938,null));};exports['download']=function(_0x2b34a8,_0xd0e5b7,_0x444a6c){var _0xfd3471=require('../../components/encryptor');var _0x3f5c8e=![];var _0x91775c={};if(_0x2b34a8[_0x5adb('0x2a')][_0x5adb('0x47')]&&_0x2b34a8[_0x5adb('0x2a')]['type']===_0x5adb('0x48')){_0x91775c['uniqueid']=_0x2b34a8[_0x5adb('0x45')]['id'];}else{_0x91775c['id']=_0x2b34a8['params']['id'];}return db[_0x5adb('0x25')][_0x5adb('0x42')]({'where':_0x91775c,'attributes':['id',_0x5adb('0x49')],'raw':!![]})[_0x5adb('0x1f')](handleEntityNotFound(_0xd0e5b7,null))['then'](function(_0x18f95c){if(_0x18f95c){var _0x229ae2=util[_0x5adb('0x29')]('%s.cypher',_0x18f95c['value']);if(fs['existsSync'](_0x229ae2)){_0x3f5c8e=!![];return _0xfd3471[_0x5adb('0x4a')](_0x229ae2,_0x18f95c[_0x5adb('0x49')],config[_0x5adb('0x4b')][_0x5adb('0x4c')])[_0x5adb('0x1f')](function(){return _0x18f95c;});}return _0x18f95c;}})[_0x5adb('0x1f')](function(_0x204b9b){if(_0x204b9b){if(!fs[_0x5adb('0x4d')](_0x204b9b[_0x5adb('0x49')])){throw new db[(_0x5adb('0x4e'))][(_0x5adb('0x4f'))](_0x5adb('0x50'));}if(_0x204b9b[_0x5adb('0x51')]){return _0xd0e5b7['download'](_0x204b9b['value'],_0x204b9b[_0x5adb('0x51')]+path[_0x5adb('0x52')](_0x204b9b[_0x5adb('0x49')]),function(){if(_0x3f5c8e){fs[_0x5adb('0x53')](_0x204b9b['value']);}});}else{return _0xd0e5b7[_0x5adb('0x54')](_0x204b9b[_0x5adb('0x49')],function(_0x5d2d2f){if(_0x3f5c8e){fs[_0x5adb('0x53')](_0x204b9b[_0x5adb('0x49')]);}});}}})[_0x5adb('0x3f')](handleError(_0xd0e5b7,null));};exports['downloads']=function(_0x30d185,_0x409357,_0x19df2f){var _0x30c92c=require(_0x5adb('0x55'));var _0x428019=![];var _0x513f26={'$and':[db[_0x5adb('0x56')][_0x5adb('0x36')](db[_0x5adb('0x56')]['fn']('MD5',db[_0x5adb('0x56')][_0x5adb('0x57')](_0x5adb('0x48'))),_0x30d185['query'][_0x5adb('0x58')])]};if(_0x30d185['query'][_0x5adb('0x47')]&&_0x30d185[_0x5adb('0x2a')][_0x5adb('0x47')]==='uniqueid'){_0x513f26[_0x5adb('0x59')][_0x5adb('0x5a')]({'uniqueid':_0x30d185['params']['id']});}else{_0x513f26[_0x5adb('0x59')][_0x5adb('0x5a')]({'id':_0x30d185[_0x5adb('0x45')]['id']});}return db[_0x5adb('0x25')]['find']({'where':_0x513f26,'attributes':['id',_0x5adb('0x49')],'raw':!![]})[_0x5adb('0x1f')](handleEntityNotFound(_0x409357,null))[_0x5adb('0x1f')](function(_0x16716e){if(_0x16716e){var _0x5b7556=util['format'](_0x5adb('0x5b'),_0x16716e['value']);if(fs['existsSync'](_0x5b7556)){_0x428019=!![];return _0x30c92c['decryptFile'](_0x5b7556,_0x16716e[_0x5adb('0x49')],config[_0x5adb('0x4b')]['recording'])[_0x5adb('0x1f')](function(){return _0x16716e;});}return _0x16716e;}})[_0x5adb('0x1f')](function(_0xcdde17){if(_0xcdde17){if(!fs[_0x5adb('0x4d')](_0xcdde17[_0x5adb('0x49')])){throw new db[(_0x5adb('0x4e'))][(_0x5adb('0x4f'))](_0x5adb('0x50'));}if(_0xcdde17['filename']){return _0x409357['download'](_0xcdde17['value'],_0xcdde17[_0x5adb('0x51')]+path[_0x5adb('0x52')](_0xcdde17[_0x5adb('0x49')]),function(){if(_0x428019){fs[_0x5adb('0x53')](_0xcdde17[_0x5adb('0x49')]);}});}else{return _0x409357[_0x5adb('0x54')](_0xcdde17[_0x5adb('0x49')],function(_0x25f761){if(_0x428019){fs['unlink'](_0xcdde17['value']);}});}}})[_0x5adb('0x3f')](handleError(_0x409357,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0e47b18..3580457 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 _0xd6f9=['util','../../config/logger','api','moment','bluebird','./voiceRecording.attributes','exports','define','uniqueid','lodash'];(function(_0x4f4386,_0x31af2){var _0x4bf33f=function(_0x4bb726){while(--_0x4bb726){_0x4f4386['push'](_0x4f4386['shift']());}};_0x4bf33f(++_0x31af2);}(_0xd6f9,0x1ad));var _0x9d6f=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xd6f9[_0x521929];return _0x632436;};'use strict';var _=require(_0x9d6f('0x0'));var util=require(_0x9d6f('0x1'));var logger=require(_0x9d6f('0x2'))(_0x9d6f('0x3'));var moment=require(_0x9d6f('0x4'));var BPromise=require(_0x9d6f('0x5'));var rp=require('request-promise');var attributes=require(_0x9d6f('0x6'));module[_0x9d6f('0x7')]=function(_0x5ced67,_0x139c79){return _0x5ced67[_0x9d6f('0x8')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9d6f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x862a=['./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4481fd,_0x5e9b54){var _0x483520=function(_0x101b14){while(--_0x101b14){_0x4481fd['push'](_0x4481fd['shift']());}};_0x483520(++_0x5e9b54);}(_0x862a,0x1b3));var _0xa862=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x862a[_0x2300f2];return _0x6bd508;};'use strict';var _=require(_0xa862('0x0'));var util=require(_0xa862('0x1'));var logger=require(_0xa862('0x2'))(_0xa862('0x3'));var moment=require(_0xa862('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xa862('0x5'));module[_0xa862('0x6')]=function(_0x3ddde9,_0x5c0ab4){return _0x3ddde9[_0xa862('0x7')]('VoiceRecording',attributes,{'tableName':_0xa862('0x8'),'paranoid':![],'indexes':[{'name':_0xa862('0x9'),'fields':[_0xa862('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 1b2b1ab..1c5d75a 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 _0x8c38=['unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','update','body','options','attributes','limit','UpdateVoiceRecording','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0x8c38,0x83));var _0x88c3=function(_0x5c35a7,_0x5b34be){_0x5c35a7=_0x5c35a7-0x0;var _0x10f16f=_0x8c38[_0x5c35a7];return _0x10f16f;};'use strict';var _=require(_0x88c3('0x0'));var util=require(_0x88c3('0x1'));var moment=require('moment');var BPromise=require(_0x88c3('0x2'));var rs=require(_0x88c3('0x3'));var fs=require('fs');var db=require(_0x88c3('0x4'))['db'];var utils=require(_0x88c3('0x5'));var logger=require('../../config/logger')(_0x88c3('0x6'));var config=require(_0x88c3('0x7'));var jayson=require(_0x88c3('0x8'));var client=jayson[_0x88c3('0x9')][_0x88c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6b76d7,_0xcdbc28,_0x25e385){return new BPromise(function(_0x5020c9,_0x350a11){return client['request'](_0x6b76d7,_0x25e385)[_0x88c3('0xb')](function(_0x48736e){logger[_0x88c3('0xc')]('VoiceRecording,\x20%s,\x20%s',_0xcdbc28,_0x88c3('0xd'));logger[_0x88c3('0xe')](_0x88c3('0xf'),_0xcdbc28,_0x88c3('0xd'),JSON['stringify'](_0x48736e));if(_0x48736e[_0x88c3('0x10')]){if(_0x48736e[_0x88c3('0x10')][_0x88c3('0x11')]===0x1f4){logger['error'](_0x88c3('0x12'),_0xcdbc28,_0x48736e['error']['message']);return _0x350a11(_0x48736e[_0x88c3('0x10')][_0x88c3('0x13')]);}logger[_0x88c3('0x10')](_0x88c3('0x12'),_0xcdbc28,_0x48736e[_0x88c3('0x10')]['message']);return _0x5020c9(_0x48736e[_0x88c3('0x10')][_0x88c3('0x13')]);}else{logger[_0x88c3('0xc')](_0x88c3('0x12'),_0xcdbc28,'request\x20sent');_0x5020c9(_0x48736e[_0x88c3('0x14')]['message']);}})[_0x88c3('0x15')](function(_0x2b588b){logger[_0x88c3('0x10')](_0x88c3('0x12'),_0xcdbc28,_0x2b588b);_0x350a11(_0x2b588b);});});}exports['UpdateVoiceRecording']=function(_0x4c6749){var _0x3b8d75=this;return new Promise(function(_0x16ee57,_0x2ecca1){return db['VoiceRecording'][_0x88c3('0x16')](_0x4c6749[_0x88c3('0x17')],{'raw':_0x4c6749[_0x88c3('0x18')]?_0x4c6749[_0x88c3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c6749['options']?_0x4c6749[_0x88c3('0x18')]['where']||null:null,'attributes':_0x4c6749['options']?_0x4c6749[_0x88c3('0x18')][_0x88c3('0x19')]||null:null,'limit':_0x4c6749[_0x88c3('0x18')]?_0x4c6749[_0x88c3('0x18')][_0x88c3('0x1a')]||null:null})[_0x88c3('0xb')](function(_0x226077){logger[_0x88c3('0xc')](_0x88c3('0x1b'),_0x4c6749);logger[_0x88c3('0xe')](_0x88c3('0x1b'),_0x4c6749,JSON[_0x88c3('0x1c')](_0x226077));_0x16ee57(_0x226077);})['catch'](function(_0x2988cd){logger['error'](_0x88c3('0x1b'),_0x2988cd[_0x88c3('0x13')],_0x4c6749);_0x2ecca1(_0x3b8d75[_0x88c3('0x10')](0x1f4,_0x2988cd['message']));});});};exports[_0x88c3('0x1d')]=function(_0x1399a0){var _0x3caa2b=this;return new Promise(function(_0x20b567,_0xf0784e){var _0x14a386=require(_0x88c3('0x1e'));var _0x454372;return db[_0x88c3('0x1f')][_0x88c3('0x20')]({'attributes':['id',_0x88c3('0x21')],'where':{'id':0x1},'raw':!![]})[_0x88c3('0xb')](function(_0x3d8c32){_0x454372=_0x3d8c32;return db['VoiceRecording'][_0x88c3('0x22')](_0x1399a0[_0x88c3('0x17')]);})[_0x88c3('0xb')](function(_0x753c0b){if(_0x454372[_0x88c3('0x21')]&&fs[_0x88c3('0x23')](_0x753c0b[_0x88c3('0x24')])){var _0x5337e8=util[_0x88c3('0x25')](_0x88c3('0x26'),_0x753c0b[_0x88c3('0x24')]);return _0x14a386[_0x88c3('0x27')](_0x753c0b['value'],_0x5337e8,config[_0x88c3('0x28')]['recording'])[_0x88c3('0xb')](function(){fs[_0x88c3('0x29')](_0x753c0b[_0x88c3('0x24')]);logger['info'](_0x88c3('0x2a'));return _0x753c0b;});}return _0x753c0b;})[_0x88c3('0xb')](function(_0x53f71c){logger[_0x88c3('0xc')](_0x88c3('0x1d'),_0x1399a0);logger['debug'](_0x88c3('0x1d'),_0x1399a0,JSON['stringify'](_0x53f71c));_0x20b567(_0x53f71c);})['catch'](function(_0x3a31fe){logger[_0x88c3('0x10')]('CreateVoiceRecording',_0x3a31fe['message'],_0x1399a0);_0xf0784e(_0x3caa2b[_0x88c3('0x10')](0x1f4,_0x3a31fe[_0x88c3('0x13')]));});});}; \ No newline at end of file +var _0x34ab=['jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','UpdateVoiceRecording','update','body','options','where','attributes','limit','catch','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','secrets','recording','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x34ab,0x169));var _0xb34a=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x34ab[_0x47cfa0];return _0x386b1d;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var moment=require(_0xb34a('0x2'));var BPromise=require(_0xb34a('0x3'));var rs=require(_0xb34a('0x4'));var fs=require('fs');var db=require(_0xb34a('0x5'))['db'];var utils=require(_0xb34a('0x6'));var logger=require(_0xb34a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb34a('0x8'));var client=jayson[_0xb34a('0x9')][_0xb34a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528d48,_0x2b8d3e,_0x492c6d){return new BPromise(function(_0x14c0d2,_0xb915fb){return client[_0xb34a('0xb')](_0x528d48,_0x492c6d)[_0xb34a('0xc')](function(_0x374b5c){logger[_0xb34a('0xd')](_0xb34a('0xe'),_0x2b8d3e,'request\x20sent');logger[_0xb34a('0xf')](_0xb34a('0x10'),_0x2b8d3e,_0xb34a('0x11'),JSON['stringify'](_0x374b5c));if(_0x374b5c[_0xb34a('0x12')]){if(_0x374b5c[_0xb34a('0x12')][_0xb34a('0x13')]===0x1f4){logger[_0xb34a('0x12')](_0xb34a('0xe'),_0x2b8d3e,_0x374b5c[_0xb34a('0x12')]['message']);return _0xb915fb(_0x374b5c['error']['message']);}logger['error'](_0xb34a('0xe'),_0x2b8d3e,_0x374b5c['error']['message']);return _0x14c0d2(_0x374b5c[_0xb34a('0x12')][_0xb34a('0x14')]);}else{logger[_0xb34a('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x2b8d3e,_0xb34a('0x11'));_0x14c0d2(_0x374b5c[_0xb34a('0x15')][_0xb34a('0x14')]);}})['catch'](function(_0xd2eb2b){logger['error'](_0xb34a('0xe'),_0x2b8d3e,_0xd2eb2b);_0xb915fb(_0xd2eb2b);});});}exports[_0xb34a('0x16')]=function(_0x13f97f){var _0x1ede11=this;return new Promise(function(_0x407255,_0x45e7da){return db['VoiceRecording'][_0xb34a('0x17')](_0x13f97f[_0xb34a('0x18')],{'raw':_0x13f97f[_0xb34a('0x19')]?_0x13f97f[_0xb34a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13f97f[_0xb34a('0x19')]?_0x13f97f[_0xb34a('0x19')][_0xb34a('0x1a')]||null:null,'attributes':_0x13f97f[_0xb34a('0x19')]?_0x13f97f[_0xb34a('0x19')][_0xb34a('0x1b')]||null:null,'limit':_0x13f97f[_0xb34a('0x19')]?_0x13f97f[_0xb34a('0x19')][_0xb34a('0x1c')]||null:null})['then'](function(_0x3a3b1d){logger[_0xb34a('0xd')]('UpdateVoiceRecording',_0x13f97f);logger[_0xb34a('0xf')](_0xb34a('0x16'),_0x13f97f,JSON['stringify'](_0x3a3b1d));_0x407255(_0x3a3b1d);})[_0xb34a('0x1d')](function(_0x41c197){logger[_0xb34a('0x12')](_0xb34a('0x16'),_0x41c197[_0xb34a('0x14')],_0x13f97f);_0x45e7da(_0x1ede11[_0xb34a('0x12')](0x1f4,_0x41c197[_0xb34a('0x14')]));});});};exports[_0xb34a('0x1e')]=function(_0x1aa03e){var _0x1c30f7=this;return new Promise(function(_0x28afd8,_0x153ef2){var _0x338fdd=require('../../components/encryptor');var _0x4c1f28;return db[_0xb34a('0x1f')][_0xb34a('0x20')]({'attributes':['id',_0xb34a('0x21')],'where':{'id':0x1},'raw':!![]})[_0xb34a('0xc')](function(_0x4cd44d){_0x4c1f28=_0x4cd44d;return db['VoiceRecording']['create'](_0x1aa03e[_0xb34a('0x18')]);})[_0xb34a('0xc')](function(_0x18ced2){if(_0x4c1f28[_0xb34a('0x21')]&&fs[_0xb34a('0x22')](_0x18ced2[_0xb34a('0x23')])){var _0x3caaaa=util['format'](_0xb34a('0x24'),_0x18ced2[_0xb34a('0x23')]);return _0x338fdd[_0xb34a('0x25')](_0x18ced2[_0xb34a('0x23')],_0x3caaaa,config[_0xb34a('0x26')][_0xb34a('0x27')])['then'](function(){fs['unlink'](_0x18ced2['value']);logger[_0xb34a('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x18ced2;});}return _0x18ced2;})[_0xb34a('0xc')](function(_0x444def){logger[_0xb34a('0xd')]('CreateVoiceRecording',_0x1aa03e);logger[_0xb34a('0xf')](_0xb34a('0x1e'),_0x1aa03e,JSON[_0xb34a('0x28')](_0x444def));_0x28afd8(_0x444def);})[_0xb34a('0x1d')](function(_0x4aea20){logger['error']('CreateVoiceRecording',_0x4aea20[_0xb34a('0x14')],_0x1aa03e);_0x153ef2(_0x1c30f7[_0xb34a('0x12')](0x1f4,_0x4aea20[_0xb34a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d1e0db4..d9d875c 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 _0x873a=['isAuthenticated','show','post','create','/:id','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x5da0fa,_0x4d2ff1){var _0x36fe1a=function(_0x239f76){while(--_0x239f76){_0x5da0fa['push'](_0x5da0fa['shift']());}};_0x36fe1a(++_0x4d2ff1);}(_0x873a,0x160));var _0xa873=function(_0x4868c4,_0x444efa){_0x4868c4=_0x4868c4-0x0;var _0x6fbdb=_0x873a[_0x4868c4];return _0x6fbdb;};'use strict';var multer=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var path=require(_0xa873('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xa873('0x3'));var interaction=require(_0xa873('0x4'));var config=require(_0xa873('0x5'));var controller=require('./voiceTransferReport.controller');router[_0xa873('0x6')]('/',auth['isAuthenticated'](),controller[_0xa873('0x7')]);router[_0xa873('0x6')]('/:id',auth[_0xa873('0x8')](),controller[_0xa873('0x9')]);router[_0xa873('0xa')]('/',auth[_0xa873('0x8')](),controller[_0xa873('0xb')]);router['put'](_0xa873('0xc'),auth[_0xa873('0x8')](),controller['update']);router[_0xa873('0xd')]('/:id',auth[_0xa873('0x8')](),controller['destroy']);module[_0xa873('0xe')]=router; \ No newline at end of file +var _0x4415=['get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller'];(function(_0x294b08,_0x3b4374){var _0x2fceb9=function(_0x412109){while(--_0x412109){_0x294b08['push'](_0x294b08['shift']());}};_0x2fceb9(++_0x3b4374);}(_0x4415,0x1d5));var _0x5441=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x4415[_0x324012];return _0x435cf2;};'use strict';var multer=require(_0x5441('0x0'));var util=require(_0x5441('0x1'));var path=require('path');var express=require(_0x5441('0x2'));var router=express[_0x5441('0x3')]();var auth=require(_0x5441('0x4'));var interaction=require(_0x5441('0x5'));var config=require('../../config/environment');var controller=require(_0x5441('0x6'));router[_0x5441('0x7')]('/',auth[_0x5441('0x8')](),controller[_0x5441('0x9')]);router[_0x5441('0x7')](_0x5441('0xa'),auth[_0x5441('0x8')](),controller[_0x5441('0xb')]);router[_0x5441('0xc')]('/',auth['isAuthenticated'](),controller[_0x5441('0xd')]);router[_0x5441('0xe')](_0x5441('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5441('0xf')](_0x5441('0xa'),auth[_0x5441('0x8')](),controller['destroy']);module[_0x5441('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 744e901..a5fb690 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 _0xe1d7=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xe1d7,0x67));var _0x7e1d=function(_0x1e371f,_0x361627){_0x1e371f=_0x1e371f-0x0;var _0x4671ef=_0xe1d7[_0x1e371f];return _0x4671ef;};'use strict';var Sequelize=require(_0x7e1d('0x0'));var moment=require(_0x7e1d('0x1'));module[_0x7e1d('0x2')]={'type':{'type':Sequelize[_0x7e1d('0x3')](_0x7e1d('0x4'),_0x7e1d('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x7e1d('0x6')]},'transferercalleridname':{'type':Sequelize[_0x7e1d('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7e1d('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x7e1d('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x7e1d('0x6')]},'transferercontext':{'type':Sequelize[_0x7e1d('0x6')]},'transfererexten':{'type':Sequelize[_0x7e1d('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x7e1d('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x7e1d('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7e1d('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7e1d('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x7e1d('0x6')]},'transfereecontext':{'type':Sequelize[_0x7e1d('0x6')]},'transfereeexten':{'type':Sequelize[_0x7e1d('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x7e1d('0x6')]},'isexternal':{'type':Sequelize[_0x7e1d('0x3')](_0x7e1d('0x7'),'No')},'context':{'type':Sequelize[_0x7e1d('0x6')]},'extension':{'type':Sequelize[_0x7e1d('0x6')]}}; \ No newline at end of file +var _0xa9b8=['STRING','Yes','sequelize','moment','ENUM','blind'];(function(_0x4c1732,_0x86ab68){var _0x42311b=function(_0x2aa60f){while(--_0x2aa60f){_0x4c1732['push'](_0x4c1732['shift']());}};_0x42311b(++_0x86ab68);}(_0xa9b8,0x1be));var _0x8a9b=function(_0x588672,_0xedbdaa){_0x588672=_0x588672-0x0;var _0x130fd1=_0xa9b8[_0x588672];return _0x130fd1;};'use strict';var Sequelize=require(_0x8a9b('0x0'));var moment=require(_0x8a9b('0x1'));module['exports']={'type':{'type':Sequelize[_0x8a9b('0x2')](_0x8a9b('0x3'),'attended')},'result':{'type':Sequelize[_0x8a9b('0x4')]},'transfererchannel':{'type':Sequelize[_0x8a9b('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x8a9b('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8a9b('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8a9b('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x8a9b('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x8a9b('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x8a9b('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x8a9b('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8a9b('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8a9b('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8a9b('0x4')]},'transfereeexten':{'type':Sequelize[_0x8a9b('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x8a9b('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x8a9b('0x5'),'No')},'context':{'type':Sequelize[_0x8a9b('0x4')]},'extension':{'type':Sequelize[_0x8a9b('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 21e7b65..9597153 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 _0x4f80=['where','pick','add','day','merge','map','options','includeAll','include','rows','show','params','length','find','create','body','catch','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','VoiceTransferReport','rawAttributes','keys','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','order'];(function(_0x163332,_0x351ff5){var _0x56243a=function(_0x3082ca){while(--_0x3082ca){_0x163332['push'](_0x163332['shift']());}};_0x56243a(++_0x351ff5);}(_0x4f80,0x1a9));var _0x04f8=function(_0x5a8269,_0xfb2f54){_0x5a8269=_0x5a8269-0x0;var _0x539ed7=_0x4f80[_0x5a8269];return _0x539ed7;};'use strict';var jsonpatch=require(_0x04f8('0x0'));var rp=require(_0x04f8('0x1'));var moment=require(_0x04f8('0x2'));var BPromise=require(_0x04f8('0x3'));var Mustache=require(_0x04f8('0x4'));var util=require(_0x04f8('0x5'));var path=require(_0x04f8('0x6'));var sox=require(_0x04f8('0x7'));var csv=require(_0x04f8('0x8'));var ejs=require(_0x04f8('0x9'));var fs=require('fs');var _=require(_0x04f8('0xa'));var squel=require('squel');var crypto=require(_0x04f8('0xb'));var jsforce=require(_0x04f8('0xc'));var deskjs=require(_0x04f8('0xd'));var toCsv=require(_0x04f8('0x8'));var querystring=require(_0x04f8('0xe'));var Papa=require(_0x04f8('0xf'));var qs=require(_0x04f8('0x10'));var logger=require(_0x04f8('0x11'))(_0x04f8('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x04f8('0x13'))['db'];function respondWithStatusCode(_0x3eb53d,_0xc21dcc){_0xc21dcc=_0xc21dcc||0xcc;return function(_0x15672e){if(_0x15672e){return _0x3eb53d[_0x04f8('0x14')](_0xc21dcc);}return _0x3eb53d[_0x04f8('0x15')](_0xc21dcc)[_0x04f8('0x16')]();};}function respondWithResult(_0x271c4c,_0x3c1e5b){_0x3c1e5b=_0x3c1e5b||0xc8;return function(_0x32e2c7){if(_0x32e2c7){return _0x271c4c[_0x04f8('0x15')](_0x3c1e5b)[_0x04f8('0x17')](_0x32e2c7);}};}function respondWithFilteredResult(_0x3d5681,_0x3155ce){return function(_0x59c0a1){if(_0x59c0a1){var _0xcda6f0=_0x59c0a1[_0x04f8('0x18')],_0x386c49=_0x3155ce['offset'],_0x4960cc=_0x3155ce[_0x04f8('0x19')]+_0x3155ce[_0x04f8('0x1a')],_0x5ab12b;if(_0x4960cc>=_0xcda6f0){_0x4960cc=_0xcda6f0;_0x5ab12b=0xc8;}else{_0x5ab12b=0xce;}_0x3d5681[_0x04f8('0x15')](_0x5ab12b);return _0x3d5681[_0x04f8('0x1b')](_0x04f8('0x1c'),_0x386c49+'-'+_0x4960cc+'/'+_0xcda6f0)[_0x04f8('0x17')](_0x59c0a1);}return null;};}function patchUpdates(_0xcfcf13){return function(_0x342934){try{jsonpatch[_0x04f8('0x1d')](_0x342934,_0xcfcf13,!![]);}catch(_0x126730){return BPromise['reject'](_0x126730);}return _0x342934['save']();};}function saveUpdates(_0x4b1eb6,_0x50e597){return function(_0xaeeb61){if(_0xaeeb61){return _0xaeeb61[_0x04f8('0x1e')](_0x4b1eb6)['then'](function(_0x18fb97){return _0x18fb97;});}return null;};}function removeEntity(_0x3f5a70,_0x5bc7ff){return function(_0x554dd5){if(_0x554dd5){return _0x554dd5[_0x04f8('0x1f')]()[_0x04f8('0x20')](function(){_0x3f5a70[_0x04f8('0x15')](0xcc)[_0x04f8('0x16')]();});}};}function handleEntityNotFound(_0x392a93,_0x55de93){return function(_0x419403){if(!_0x419403){_0x392a93[_0x04f8('0x14')](0x194);}return _0x419403;};}function handleError(_0x25789e,_0x5a0ba5){_0x5a0ba5=_0x5a0ba5||0x1f4;return function(_0x1e1604){logger[_0x04f8('0x21')](_0x1e1604[_0x04f8('0x22')]);if(_0x1e1604['name']){delete _0x1e1604[_0x04f8('0x23')];}_0x25789e[_0x04f8('0x15')](_0x5a0ba5)[_0x04f8('0x24')](_0x1e1604);};}exports[_0x04f8('0x25')]=function(_0x3a7f8c,_0x5a0250){var _0x568142={},_0x2b6597={},_0x1ae1a8={'count':0x0,'rows':[]};var _0x27c9b8=db[_0x04f8('0x26')][_0x04f8('0x27')];_0x2b6597['model']=_[_0x04f8('0x28')](_0x27c9b8);var _0x298ff6={'dateStart':_0x3a7f8c['query'][_0x04f8('0x29')],'dateEnd':_0x3a7f8c[_0x04f8('0x2a')]['dateEnd']};delete _0x3a7f8c[_0x04f8('0x2a')][_0x04f8('0x29')];delete _0x3a7f8c[_0x04f8('0x2a')][_0x04f8('0x2b')];_0x2b6597[_0x04f8('0x2a')]=_[_0x04f8('0x28')](_0x3a7f8c[_0x04f8('0x2a')]);_0x2b6597[_0x04f8('0x2c')]=_[_0x04f8('0x2d')](_0x2b6597[_0x04f8('0x2e')],_0x2b6597[_0x04f8('0x2a')]);_0x568142[_0x04f8('0x2f')]=_[_0x04f8('0x2d')](_0x2b6597[_0x04f8('0x2e')],qs[_0x04f8('0x30')](_0x3a7f8c[_0x04f8('0x2a')][_0x04f8('0x30')]));_0x568142[_0x04f8('0x2f')]=_0x568142[_0x04f8('0x2f')]['length']?_0x568142[_0x04f8('0x2f')]:_0x2b6597[_0x04f8('0x2e')];if(!_0x3a7f8c['query'][_0x04f8('0x31')]('nolimit')){_0x568142['limit']=qs[_0x04f8('0x1a')](_0x3a7f8c['query'][_0x04f8('0x1a')]);_0x568142[_0x04f8('0x19')]=qs[_0x04f8('0x19')](_0x3a7f8c['query'][_0x04f8('0x19')]);}_0x568142[_0x04f8('0x32')]=qs['sort'](_0x3a7f8c[_0x04f8('0x2a')]['sort']);_0x568142[_0x04f8('0x33')]=qs['filters'](_[_0x04f8('0x34')](_0x3a7f8c['query'],_0x2b6597[_0x04f8('0x2c')]));if(_0x298ff6[_0x04f8('0x29')]){if(_0x298ff6[_0x04f8('0x2b')]){_0x298ff6[_0x04f8('0x2b')]=moment(_0x298ff6[_0x04f8('0x2b')])[_0x04f8('0x35')](0x1,_0x04f8('0x36'));}else{_0x298ff6[_0x04f8('0x2b')]=moment(_0x298ff6['dateStart'])[_0x04f8('0x35')](0x1,'day');}_[_0x04f8('0x37')](_0x568142['where'],{'createdAt':{'$gte':_0x298ff6[_0x04f8('0x29')],'$lte':_0x298ff6[_0x04f8('0x2b')]}});}if(_0x3a7f8c[_0x04f8('0x2a')]['filter']){_0x568142[_0x04f8('0x33')]=_[_0x04f8('0x37')](_0x568142[_0x04f8('0x33')],{'$or':_[_0x04f8('0x38')](_0x568142[_0x04f8('0x2f')],function(_0x18ae79){var _0x5963dc={};_0x5963dc[_0x18ae79]={'$like':'%'+_0x3a7f8c['query']['filter']+'%'};return _0x5963dc;})});}_0x568142=_[_0x04f8('0x37')]({},_0x568142,_0x3a7f8c[_0x04f8('0x39')]);var _0x4adc77={'where':_0x568142[_0x04f8('0x33')]};return db['VoiceTransferReport']['count'](_0x4adc77)[_0x04f8('0x20')](function(_0x4bb8f6){_0x1ae1a8[_0x04f8('0x18')]=_0x4bb8f6;if(_0x3a7f8c['query'][_0x04f8('0x3a')]){_0x568142[_0x04f8('0x3b')]=[{'all':!![]}];}return db[_0x04f8('0x26')]['findAll'](_0x568142);})['then'](function(_0x18d87a){_0x1ae1a8[_0x04f8('0x3c')]=_0x18d87a;return _0x1ae1a8;})[_0x04f8('0x20')](respondWithFilteredResult(_0x5a0250,_0x568142))['catch'](handleError(_0x5a0250,null));};exports[_0x04f8('0x3d')]=function(_0x2da531,_0x207b18){var _0x1dd68e={'raw':!![],'where':{'id':_0x2da531[_0x04f8('0x3e')]['id']}},_0x5fa4e6={};_0x5fa4e6[_0x04f8('0x2e')]=_[_0x04f8('0x28')](db[_0x04f8('0x26')][_0x04f8('0x27')]);_0x5fa4e6[_0x04f8('0x2a')]=_[_0x04f8('0x28')](_0x2da531[_0x04f8('0x2a')]);_0x5fa4e6['filters']=_['intersection'](_0x5fa4e6[_0x04f8('0x2e')],_0x5fa4e6['query']);_0x1dd68e[_0x04f8('0x2f')]=_[_0x04f8('0x2d')](_0x5fa4e6[_0x04f8('0x2e')],qs['fields'](_0x2da531[_0x04f8('0x2a')]['fields']));_0x1dd68e[_0x04f8('0x2f')]=_0x1dd68e['attributes'][_0x04f8('0x3f')]?_0x1dd68e[_0x04f8('0x2f')]:_0x5fa4e6['model'];if(_0x2da531[_0x04f8('0x2a')][_0x04f8('0x3a')]){_0x1dd68e[_0x04f8('0x3b')]=[{'all':!![]}];}_0x1dd68e=_['merge']({},_0x1dd68e,_0x2da531[_0x04f8('0x39')]);return db[_0x04f8('0x26')][_0x04f8('0x40')](_0x1dd68e)[_0x04f8('0x20')](handleEntityNotFound(_0x207b18,null))[_0x04f8('0x20')](respondWithResult(_0x207b18,null))['catch'](handleError(_0x207b18,null));};exports[_0x04f8('0x41')]=function(_0x21ce73,_0x422286){return db[_0x04f8('0x26')][_0x04f8('0x41')](_0x21ce73[_0x04f8('0x42')],{})[_0x04f8('0x20')](respondWithResult(_0x422286,0xc9))[_0x04f8('0x43')](handleError(_0x422286,null));};exports[_0x04f8('0x1e')]=function(_0x4b6b43,_0x38e86a){if(_0x4b6b43[_0x04f8('0x42')]['id']){delete _0x4b6b43[_0x04f8('0x42')]['id'];}return db[_0x04f8('0x26')]['find']({'where':{'id':_0x4b6b43[_0x04f8('0x3e')]['id']}})[_0x04f8('0x20')](handleEntityNotFound(_0x38e86a,null))[_0x04f8('0x20')](saveUpdates(_0x4b6b43[_0x04f8('0x42')],null))[_0x04f8('0x20')](respondWithResult(_0x38e86a,null))['catch'](handleError(_0x38e86a,null));};exports['destroy']=function(_0x15c34c,_0x1a81f9){return db['VoiceTransferReport'][_0x04f8('0x40')]({'where':{'id':_0x15c34c['params']['id']}})[_0x04f8('0x20')](handleEntityNotFound(_0x1a81f9,null))[_0x04f8('0x20')](removeEntity(_0x1a81f9,null))[_0x04f8('0x43')](handleError(_0x1a81f9,null));}; \ No newline at end of file +var _0x23cb=['includeAll','include','rows','catch','params','find','body','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','VoiceTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','offset','order','sort','add','day','merge','where','options'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x23cb,0x1c7));var _0xb23c=function(_0x29050b,_0x54676e){_0x29050b=_0x29050b-0x0;var _0xd412ec=_0x23cb[_0x29050b];return _0xd412ec;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xb23c('0x0'));var moment=require(_0xb23c('0x1'));var BPromise=require(_0xb23c('0x2'));var Mustache=require(_0xb23c('0x3'));var util=require(_0xb23c('0x4'));var path=require(_0xb23c('0x5'));var sox=require(_0xb23c('0x6'));var csv=require('to-csv');var ejs=require(_0xb23c('0x7'));var fs=require('fs');var _=require(_0xb23c('0x8'));var squel=require(_0xb23c('0x9'));var crypto=require('crypto');var jsforce=require(_0xb23c('0xa'));var deskjs=require(_0xb23c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb23c('0xc'));var Papa=require(_0xb23c('0xd'));var qs=require(_0xb23c('0xe'));var logger=require('../../config/logger')(_0xb23c('0xf'));var utils=require('../../config/utils');var config=require(_0xb23c('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39ae63,_0x40dd62){_0x40dd62=_0x40dd62||0xcc;return function(_0x240659){if(_0x240659){return _0x39ae63[_0xb23c('0x11')](_0x40dd62);}return _0x39ae63[_0xb23c('0x12')](_0x40dd62)['end']();};}function respondWithResult(_0x435e7d,_0x11cc23){_0x11cc23=_0x11cc23||0xc8;return function(_0x3edb9a){if(_0x3edb9a){return _0x435e7d[_0xb23c('0x12')](_0x11cc23)[_0xb23c('0x13')](_0x3edb9a);}};}function respondWithFilteredResult(_0xe5e0a7,_0x4789d4){return function(_0x1fe4c8){if(_0x1fe4c8){var _0x14a735=_0x1fe4c8[_0xb23c('0x14')],_0x2b10ae=_0x4789d4['offset'],_0x10c7b6=_0x4789d4['offset']+_0x4789d4[_0xb23c('0x15')],_0x58debe;if(_0x10c7b6>=_0x14a735){_0x10c7b6=_0x14a735;_0x58debe=0xc8;}else{_0x58debe=0xce;}_0xe5e0a7[_0xb23c('0x12')](_0x58debe);return _0xe5e0a7[_0xb23c('0x16')](_0xb23c('0x17'),_0x2b10ae+'-'+_0x10c7b6+'/'+_0x14a735)[_0xb23c('0x13')](_0x1fe4c8);}return null;};}function patchUpdates(_0x329107){return function(_0x39b160){try{jsonpatch[_0xb23c('0x18')](_0x39b160,_0x329107,!![]);}catch(_0x22a019){return BPromise[_0xb23c('0x19')](_0x22a019);}return _0x39b160[_0xb23c('0x1a')]();};}function saveUpdates(_0x469f31,_0x2bda9f){return function(_0xd72680){if(_0xd72680){return _0xd72680[_0xb23c('0x1b')](_0x469f31)[_0xb23c('0x1c')](function(_0x51f3c0){return _0x51f3c0;});}return null;};}function removeEntity(_0x432c13,_0x32f422){return function(_0x3c7c07){if(_0x3c7c07){return _0x3c7c07[_0xb23c('0x1d')]()['then'](function(){_0x432c13[_0xb23c('0x12')](0xcc)[_0xb23c('0x1e')]();});}};}function handleEntityNotFound(_0xc61cb5,_0x3f7991){return function(_0x5e386b){if(!_0x5e386b){_0xc61cb5[_0xb23c('0x11')](0x194);}return _0x5e386b;};}function handleError(_0xf75539,_0x40decf){_0x40decf=_0x40decf||0x1f4;return function(_0x363af0){logger[_0xb23c('0x1f')](_0x363af0['stack']);if(_0x363af0[_0xb23c('0x20')]){delete _0x363af0[_0xb23c('0x20')];}_0xf75539[_0xb23c('0x12')](_0x40decf)[_0xb23c('0x21')](_0x363af0);};}exports[_0xb23c('0x22')]=function(_0x333dca,_0x35da42){var _0xc3c888={},_0x38f403={},_0x545be0={'count':0x0,'rows':[]};var _0x4e29b6=db[_0xb23c('0x23')][_0xb23c('0x24')];_0x38f403[_0xb23c('0x25')]=_[_0xb23c('0x26')](_0x4e29b6);var _0x264e71={'dateStart':_0x333dca[_0xb23c('0x27')][_0xb23c('0x28')],'dateEnd':_0x333dca[_0xb23c('0x27')]['dateEnd']};delete _0x333dca[_0xb23c('0x27')]['dateStart'];delete _0x333dca[_0xb23c('0x27')][_0xb23c('0x29')];_0x38f403['query']=_[_0xb23c('0x26')](_0x333dca[_0xb23c('0x27')]);_0x38f403[_0xb23c('0x2a')]=_[_0xb23c('0x2b')](_0x38f403[_0xb23c('0x25')],_0x38f403[_0xb23c('0x27')]);_0xc3c888['attributes']=_[_0xb23c('0x2b')](_0x38f403['model'],qs[_0xb23c('0x2c')](_0x333dca[_0xb23c('0x27')][_0xb23c('0x2c')]));_0xc3c888['attributes']=_0xc3c888['attributes'][_0xb23c('0x2d')]?_0xc3c888[_0xb23c('0x2e')]:_0x38f403[_0xb23c('0x25')];if(!_0x333dca[_0xb23c('0x27')][_0xb23c('0x2f')](_0xb23c('0x30'))){_0xc3c888[_0xb23c('0x15')]=qs['limit'](_0x333dca[_0xb23c('0x27')][_0xb23c('0x15')]);_0xc3c888['offset']=qs['offset'](_0x333dca[_0xb23c('0x27')][_0xb23c('0x31')]);}_0xc3c888[_0xb23c('0x32')]=qs[_0xb23c('0x33')](_0x333dca[_0xb23c('0x27')][_0xb23c('0x33')]);_0xc3c888['where']=qs[_0xb23c('0x2a')](_['pick'](_0x333dca[_0xb23c('0x27')],_0x38f403[_0xb23c('0x2a')]));if(_0x264e71[_0xb23c('0x28')]){if(_0x264e71[_0xb23c('0x29')]){_0x264e71[_0xb23c('0x29')]=moment(_0x264e71[_0xb23c('0x29')])[_0xb23c('0x34')](0x1,_0xb23c('0x35'));}else{_0x264e71[_0xb23c('0x29')]=moment(_0x264e71[_0xb23c('0x28')])[_0xb23c('0x34')](0x1,_0xb23c('0x35'));}_[_0xb23c('0x36')](_0xc3c888[_0xb23c('0x37')],{'createdAt':{'$gte':_0x264e71[_0xb23c('0x28')],'$lte':_0x264e71[_0xb23c('0x29')]}});}if(_0x333dca[_0xb23c('0x27')]['filter']){_0xc3c888[_0xb23c('0x37')]=_[_0xb23c('0x36')](_0xc3c888[_0xb23c('0x37')],{'$or':_['map'](_0xc3c888[_0xb23c('0x2e')],function(_0x52e923){var _0xdde59f={};_0xdde59f[_0x52e923]={'$like':'%'+_0x333dca[_0xb23c('0x27')]['filter']+'%'};return _0xdde59f;})});}_0xc3c888=_[_0xb23c('0x36')]({},_0xc3c888,_0x333dca[_0xb23c('0x38')]);var _0x28c7e0={'where':_0xc3c888[_0xb23c('0x37')]};return db['VoiceTransferReport'][_0xb23c('0x14')](_0x28c7e0)['then'](function(_0x217790){_0x545be0[_0xb23c('0x14')]=_0x217790;if(_0x333dca[_0xb23c('0x27')][_0xb23c('0x39')]){_0xc3c888[_0xb23c('0x3a')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0xc3c888);})[_0xb23c('0x1c')](function(_0x256605){_0x545be0[_0xb23c('0x3b')]=_0x256605;return _0x545be0;})[_0xb23c('0x1c')](respondWithFilteredResult(_0x35da42,_0xc3c888))[_0xb23c('0x3c')](handleError(_0x35da42,null));};exports['show']=function(_0x554639,_0x6b5ce3){var _0x1811a4={'raw':!![],'where':{'id':_0x554639[_0xb23c('0x3d')]['id']}},_0x45b1af={};_0x45b1af[_0xb23c('0x25')]=_[_0xb23c('0x26')](db[_0xb23c('0x23')][_0xb23c('0x24')]);_0x45b1af[_0xb23c('0x27')]=_[_0xb23c('0x26')](_0x554639[_0xb23c('0x27')]);_0x45b1af[_0xb23c('0x2a')]=_['intersection'](_0x45b1af[_0xb23c('0x25')],_0x45b1af['query']);_0x1811a4[_0xb23c('0x2e')]=_[_0xb23c('0x2b')](_0x45b1af[_0xb23c('0x25')],qs[_0xb23c('0x2c')](_0x554639[_0xb23c('0x27')]['fields']));_0x1811a4['attributes']=_0x1811a4[_0xb23c('0x2e')][_0xb23c('0x2d')]?_0x1811a4['attributes']:_0x45b1af['model'];if(_0x554639[_0xb23c('0x27')]['includeAll']){_0x1811a4[_0xb23c('0x3a')]=[{'all':!![]}];}_0x1811a4=_['merge']({},_0x1811a4,_0x554639[_0xb23c('0x38')]);return db['VoiceTransferReport'][_0xb23c('0x3e')](_0x1811a4)[_0xb23c('0x1c')](handleEntityNotFound(_0x6b5ce3,null))[_0xb23c('0x1c')](respondWithResult(_0x6b5ce3,null))['catch'](handleError(_0x6b5ce3,null));};exports['create']=function(_0x1b98ad,_0x149963){return db[_0xb23c('0x23')]['create'](_0x1b98ad[_0xb23c('0x3f')],{})[_0xb23c('0x1c')](respondWithResult(_0x149963,0xc9))[_0xb23c('0x3c')](handleError(_0x149963,null));};exports[_0xb23c('0x1b')]=function(_0x9dedae,_0x14cef4){if(_0x9dedae[_0xb23c('0x3f')]['id']){delete _0x9dedae[_0xb23c('0x3f')]['id'];}return db[_0xb23c('0x23')]['find']({'where':{'id':_0x9dedae[_0xb23c('0x3d')]['id']}})[_0xb23c('0x1c')](handleEntityNotFound(_0x14cef4,null))[_0xb23c('0x1c')](saveUpdates(_0x9dedae[_0xb23c('0x3f')],null))[_0xb23c('0x1c')](respondWithResult(_0x14cef4,null))[_0xb23c('0x3c')](handleError(_0x14cef4,null));};exports[_0xb23c('0x1d')]=function(_0x535b04,_0x6b454b){return db[_0xb23c('0x23')][_0xb23c('0x3e')]({'where':{'id':_0x535b04[_0xb23c('0x3d')]['id']}})[_0xb23c('0x1c')](handleEntityNotFound(_0x6b454b,null))[_0xb23c('0x1c')](removeEntity(_0x6b454b,null))['catch'](handleError(_0x6b454b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index aa6ca3f..6398544 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 _0xd191=['report_call_transfer','lodash','api','moment','bluebird','request-promise','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x8ca8ae,_0x30fac3){var _0x2817bb=function(_0x20eb93){while(--_0x20eb93){_0x8ca8ae['push'](_0x8ca8ae['shift']());}};_0x2817bb(++_0x30fac3);}(_0xd191,0x191));var _0x1d19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd191[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1d19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1d19('0x1'));var moment=require(_0x1d19('0x2'));var BPromise=require(_0x1d19('0x3'));var rp=require(_0x1d19('0x4'));var attributes=require(_0x1d19('0x5'));module[_0x1d19('0x6')]=function(_0x3b5b45,_0x52c81f){return _0x3b5b45[_0x1d19('0x7')](_0x1d19('0x8'),attributes,{'tableName':_0x1d19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0b2=['VoiceTransferReport','lodash','util','../../config/logger','api','moment','request-promise','./voiceTransferReport.attributes','exports'];(function(_0x4b2577,_0x1563d5){var _0x184a45=function(_0x96bd5f){while(--_0x96bd5f){_0x4b2577['push'](_0x4b2577['shift']());}};_0x184a45(++_0x1563d5);}(_0xf0b2,0xe2));var _0x2f0b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf0b2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x2f0b('0x0'));var util=require(_0x2f0b('0x1'));var logger=require(_0x2f0b('0x2'))(_0x2f0b('0x3'));var moment=require(_0x2f0b('0x4'));var BPromise=require('bluebird');var rp=require(_0x2f0b('0x5'));var attributes=require(_0x2f0b('0x6'));module[_0x2f0b('0x7')]=function(_0x56f489,_0x686566){return _0x56f489['define'](_0x2f0b('0x8'),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 c90da81..e41c439 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 _0xc590=['code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x313a82,_0x59927e){var _0x32da1b=function(_0x28546a){while(--_0x28546a){_0x313a82['push'](_0x313a82['shift']());}};_0x32da1b(++_0x59927e);}(_0xc590,0x9c));var _0x0c59=function(_0x411540,_0x432160){_0x411540=_0x411540-0x0;var _0x31c28b=_0xc590[_0x411540];return _0x31c28b;};'use strict';var _=require(_0x0c59('0x0'));var util=require('util');var moment=require(_0x0c59('0x1'));var BPromise=require(_0x0c59('0x2'));var rs=require(_0x0c59('0x3'));var fs=require('fs');var db=require(_0x0c59('0x4'))['db'];var utils=require(_0x0c59('0x5'));var logger=require('../../config/logger')(_0x0c59('0x6'));var config=require(_0x0c59('0x7'));var jayson=require(_0x0c59('0x8'));var client=jayson[_0x0c59('0x9')][_0x0c59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5231f1,_0x27bd51,_0x29be52){return new BPromise(function(_0x2f6f2a,_0x23a4e7){return client[_0x0c59('0xb')](_0x5231f1,_0x29be52)['then'](function(_0x5a67e9){logger[_0x0c59('0xc')](_0x0c59('0xd'),_0x27bd51,'request\x20sent');logger[_0x0c59('0xe')](_0x0c59('0xf'),_0x27bd51,_0x0c59('0x10'),JSON['stringify'](_0x5a67e9));if(_0x5a67e9[_0x0c59('0x11')]){if(_0x5a67e9[_0x0c59('0x11')][_0x0c59('0x12')]===0x1f4){logger[_0x0c59('0x11')](_0x0c59('0xd'),_0x27bd51,_0x5a67e9['error'][_0x0c59('0x13')]);return _0x23a4e7(_0x5a67e9[_0x0c59('0x11')][_0x0c59('0x13')]);}logger[_0x0c59('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x27bd51,_0x5a67e9['error']['message']);return _0x2f6f2a(_0x5a67e9[_0x0c59('0x11')]['message']);}else{logger[_0x0c59('0xc')](_0x0c59('0xd'),_0x27bd51,_0x0c59('0x10'));_0x2f6f2a(_0x5a67e9[_0x0c59('0x14')][_0x0c59('0x13')]);}})[_0x0c59('0x15')](function(_0x1ae9c8){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x27bd51,_0x1ae9c8);_0x23a4e7(_0x1ae9c8);});});}exports[_0x0c59('0x16')]=function(_0x422208){var _0x1bdccd=this;return new Promise(function(_0x5422e9,_0x4e1e97){return db[_0x0c59('0x17')]['create'](_0x422208[_0x0c59('0x18')],{'raw':_0x422208[_0x0c59('0x19')]?_0x422208['options'][_0x0c59('0x1a')]===undefined?!![]:![]:!![]})[_0x0c59('0x1b')](function(_0x5d4ee6){logger['info'](_0x0c59('0x16'),_0x422208);logger[_0x0c59('0xe')]('CreateVoiceTransferReport',_0x422208,JSON[_0x0c59('0x1c')](_0x5d4ee6));_0x5422e9(_0x5d4ee6);})[_0x0c59('0x15')](function(_0x4d7652){logger[_0x0c59('0x11')](_0x0c59('0x16'),_0x4d7652[_0x0c59('0x13')],_0x422208);_0x4e1e97(_0x1bdccd['error'](0x1f4,_0x4d7652['message']));});});}; \ No newline at end of file +var _0x6943=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','moment','bluebird','randomstring'];(function(_0x4b5139,_0x10e4f1){var _0xf0f8a0=function(_0x53ceb7){while(--_0x53ceb7){_0x4b5139['push'](_0x4b5139['shift']());}};_0xf0f8a0(++_0x10e4f1);}(_0x6943,0x7e));var _0x3694=function(_0x3a951e,_0x35eade){_0x3a951e=_0x3a951e-0x0;var _0x142e63=_0x6943[_0x3a951e];return _0x142e63;};'use strict';var _=require('lodash');var util=require(_0x3694('0x0'));var moment=require(_0x3694('0x1'));var BPromise=require(_0x3694('0x2'));var rs=require(_0x3694('0x3'));var fs=require('fs');var db=require(_0x3694('0x4'))['db'];var utils=require(_0x3694('0x5'));var logger=require(_0x3694('0x6'))('rpc');var config=require(_0x3694('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3694('0x8')][_0x3694('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x320e00,_0x3447f4,_0x47b48a){return new BPromise(function(_0x4be164,_0x28ae82){return client[_0x3694('0xa')](_0x320e00,_0x47b48a)[_0x3694('0xb')](function(_0x2419af){logger[_0x3694('0xc')](_0x3694('0xd'),_0x3447f4,_0x3694('0xe'));logger['debug'](_0x3694('0xf'),_0x3447f4,_0x3694('0xe'),JSON[_0x3694('0x10')](_0x2419af));if(_0x2419af[_0x3694('0x11')]){if(_0x2419af['error']['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x3447f4,_0x2419af[_0x3694('0x11')]['message']);return _0x28ae82(_0x2419af[_0x3694('0x11')]['message']);}logger[_0x3694('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x3447f4,_0x2419af[_0x3694('0x11')][_0x3694('0x12')]);return _0x4be164(_0x2419af[_0x3694('0x11')][_0x3694('0x12')]);}else{logger[_0x3694('0xc')](_0x3694('0xd'),_0x3447f4,'request\x20sent');_0x4be164(_0x2419af[_0x3694('0x13')][_0x3694('0x12')]);}})['catch'](function(_0x457263){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x3447f4,_0x457263);_0x28ae82(_0x457263);});});}exports['CreateVoiceTransferReport']=function(_0xbfb540){var _0x132fa9=this;return new Promise(function(_0x5d4763,_0x4c6ee2){return db[_0x3694('0x14')][_0x3694('0x15')](_0xbfb540[_0x3694('0x16')],{'raw':_0xbfb540[_0x3694('0x17')]?_0xbfb540[_0x3694('0x17')][_0x3694('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3a87b9){logger[_0x3694('0xc')](_0x3694('0x19'),_0xbfb540);logger['debug'](_0x3694('0x19'),_0xbfb540,JSON['stringify'](_0x3a87b9));_0x5d4763(_0x3a87b9);})['catch'](function(_0x300484){logger['error'](_0x3694('0x19'),_0x300484[_0x3694('0x12')],_0xbfb540);_0x4c6ee2(_0x132fa9[_0x3694('0x11')](0x1f4,_0x300484[_0x3694('0x12')]));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2446504..0eb0248 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8545=['./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sync','then','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','seedDB','./config/seedDB','default'];(function(_0x7f8a14,_0x4dda47){var _0x161a1b=function(_0x519943){while(--_0x519943){_0x7f8a14['push'](_0x7f8a14['shift']());}};_0x161a1b(++_0x4dda47);}(_0x8545,0xb3));var _0x5854=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x8545[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x5854('0x0'));var config=require(_0x5854('0x1'));var logger=require(_0x5854('0x2'))('app');var pm2=require(_0x5854('0x3'));var pm2Config=require(_0x5854('0x4'));var schedule=require(_0x5854('0x5'));var chat=require(_0x5854('0x6'));function main(){return mysqldb['db']['sequelize'][_0x5854('0x7')]()[_0x5854('0x8')](function(){return rpc['listen']();})[_0x5854('0x8')](function(_0xeb0e1f){logger[_0x5854('0x9')](_0xeb0e1f);return chat['start']();})[_0x5854('0x8')](function(){return schedule[_0x5854('0xa')]();})[_0x5854('0x8')](function(_0x53db28){logger[_0x5854('0x9')](_0x53db28);return pm2['start'](pm2Config);})['then'](function(_0x3ebf6e){logger[_0x5854('0x9')](_0x5854('0xb'),_[_0x5854('0xc')](_[_0x5854('0xd')](_0x3ebf6e,{'status':_0x5854('0xe')}),_0x5854('0xf'))[_0x5854('0x10')]());logger['info'](_0x5854('0x11'),_[_0x5854('0xc')](_[_0x5854('0xd')](_0x3ebf6e,function(_0x426b53){return _0x426b53['status']!=='online';}),_0x5854('0xf'))['join']()||'None');config[_0x5854('0x12')]&&require(_0x5854('0x13'))[_0x5854('0x14')]();require(_0x5854('0x15'))[_0x5854('0x14')]();})[_0x5854('0x16')](function(_0x33b9a5){logger[_0x5854('0x17')](_0x5854('0x18'),_0x33b9a5);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x4373=['exit','lodash','./rpc','./config/environment','app','./config/pm2','./config/schedule/chat','sequelize','sync','then','info','start','Online\x20apps:','map','filter','online','name','Offline\x20apps:','status','join','./config/seedDB','default','./config/license','error'];(function(_0x5167a8,_0x5bfd1b){var _0x13dfc1=function(_0x567a71){while(--_0x567a71){_0x5167a8['push'](_0x5167a8['shift']());}};_0x13dfc1(++_0x5bfd1b);}(_0x4373,0x1b1));var _0x3437=function(_0x5a4401,_0x3d2b84){_0x5a4401=_0x5a4401-0x0;var _0x361d73=_0x4373[_0x5a4401];return _0x361d73;};'use strict';var _=require(_0x3437('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x3437('0x1'));var config=require(_0x3437('0x2'));var logger=require('./config/logger')(_0x3437('0x3'));var pm2=require(_0x3437('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x3437('0x5'));function main(){return mysqldb['db'][_0x3437('0x6')][_0x3437('0x7')]()[_0x3437('0x8')](function(){return rpc['listen']();})['then'](function(_0x3b6946){logger[_0x3437('0x9')](_0x3b6946);return chat['start']();})[_0x3437('0x8')](function(){return schedule[_0x3437('0xa')]();})[_0x3437('0x8')](function(_0x374074){logger['info'](_0x374074);return pm2[_0x3437('0xa')](pm2Config);})[_0x3437('0x8')](function(_0x47b8ca){logger[_0x3437('0x9')](_0x3437('0xb'),_[_0x3437('0xc')](_[_0x3437('0xd')](_0x47b8ca,{'status':_0x3437('0xe')}),_0x3437('0xf'))['join']());logger[_0x3437('0x9')](_0x3437('0x10'),_[_0x3437('0xc')](_['filter'](_0x47b8ca,function(_0x425dc6){return _0x425dc6[_0x3437('0x11')]!==_0x3437('0xe');}),_0x3437('0xf'))[_0x3437('0x12')]()||'None');config['seedDB']&&require(_0x3437('0x13'))[_0x3437('0x14')]();require(_0x3437('0x15'))[_0x3437('0x14')]();})['catch'](function(_0x52e6b6){logger[_0x3437('0x16')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x52e6b6);process[_0x3437('0x17')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e6189cb..31fc770 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 _0x284b=['startsWith','headers','Basic','User','find','authenticate','pass','Bearer','Unknown\x20authorization\x20format.','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','getLicense','Forbidden','canUpdate','sign','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','role','setTokenCookie','cookie','motion.token','motion.user','stringify','pick','redirect','/dashboards/general','../../mysqldb','../../config/environment','lodash','jsonwebtoken','express-jwt','basic-auth','ipaddr.js','secrets','session','fullname','name','internal','email','userpic','voicePause','chatPause','faxPause','pauseType','showWebBar','phoneBarRemoteControlPort','isChatInteractionAuthorized','user','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','authorization'];(function(_0x52883a,_0x33b491){var _0x37f3a9=function(_0x25d5b5){while(--_0x25d5b5){_0x52883a['push'](_0x52883a['shift']());}};_0x37f3a9(++_0x33b491);}(_0x284b,0x11a));var _0xb284=function(_0x3bef11,_0x349d3c){_0x3bef11=_0x3bef11-0x0;var _0x3d0c2b=_0x284b[_0x3bef11];return _0x3d0c2b;};'use strict';var db=require(_0xb284('0x0'))['db'];var config=require(_0xb284('0x1'));var _=require(_0xb284('0x2'));var jwt=require(_0xb284('0x3'));var expressJwt=require(_0xb284('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0xb284('0x5'));var ipaddr=require(_0xb284('0x6'));var validateJwt=expressJwt({'secret':config[_0xb284('0x7')][_0xb284('0x8')]});var userAttributes=['id','role',_0xb284('0x9'),_0xb284('0xa'),_0xb284('0xb'),_0xb284('0xc'),_0xb284('0xd'),'permissions',_0xb284('0xe'),_0xb284('0xf'),'mailPause',_0xb284('0x10'),'smsPause','openchannelPause',_0xb284('0x11'),_0xb284('0x12'),_0xb284('0x13'),'phoneBarRemoteControl'];exports[_0xb284('0x14')]=function(){return isAuthenticated(!![])['use'](function(_0x3bb5bf,_0x25a8d0,_0x10c06c){if(_0x3bb5bf[_0xb284('0x15')]){_0x10c06c();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x3bb5bf['params']['id']},'attributes':['id',_0xb284('0x16'),_0xb284('0x17')],'raw':!![]})[_0xb284('0x18')](function(_0x3bee1e){if(_0x3bee1e&&_0x3bee1e[_0xb284('0x16')]){return _0x25a8d0[_0xb284('0x19')](_0x3bee1e[_0xb284('0x17')]===_0xb284('0x1a')?0x195:0x193)[_0xb284('0x1b')]({'message':_0x3bee1e[_0xb284('0x17')]===_0xb284('0x1a')?_0xb284('0x1c'):_0xb284('0x1d')});}else{_0x10c06c();}})[_0xb284('0x1e')](function(_0x2eb697){_0x10c06c(_0x2eb697);});}});};function isAuthenticated(_0x16bd57){return compose()[_0xb284('0x1f')](function(_0x3dc39b,_0x20ea21,_0xfe0ccb){if(_0x3dc39b['headers'][_0xb284('0x20')]){if(_[_0xb284('0x21')](_0x3dc39b[_0xb284('0x22')][_0xb284('0x20')],_0xb284('0x23'))){var _0x53d040=basicAuth(_0x3dc39b);db[_0xb284('0x24')][_0xb284('0x25')]({'where':{'name':_0x53d040['name']}})[_0xb284('0x18')](function(_0x28df1c){if(!_0x28df1c||!_0x28df1c[_0xb284('0x26')](_0x53d040[_0xb284('0x27')])){return _0x20ea21[_0xb284('0x19')](0x191)[_0xb284('0x1b')]({'message':'Wrong\x20credentials.'});}_0x3dc39b['user']={'id':_0x28df1c['id']};_0xfe0ccb();})[_0xb284('0x1e')](function(_0x42cf18){_0xfe0ccb(_0x42cf18);});}else if(_[_0xb284('0x21')](_0x3dc39b[_0xb284('0x22')][_0xb284('0x20')],_0xb284('0x28'))){validateJwt(_0x3dc39b,_0x20ea21,_0xfe0ccb);}}else{if(_0x16bd57){_0xfe0ccb();}else{return _0x20ea21['status'](0x191)[_0xb284('0x1b')]({'message':_0xb284('0x29')});}}})[_0xb284('0x1f')](function(_0x526026,_0x398be7,_0x1dee0a){if(_0x526026['user']){db[_0xb284('0x24')]['find']({'where':{'id':_0x526026[_0xb284('0x15')]['id']},'attributes':userAttributes})[_0xb284('0x18')](function(_0x26df3e){if(!_0x26df3e){return _0x398be7[_0xb284('0x19')](0x194)[_0xb284('0x1b')]({'message':_0xb284('0x2a')});}_0x526026[_0xb284('0x15')]=_0x26df3e;_0x1dee0a();})['catch'](function(_0x2696cb){_0x1dee0a(_0x2696cb);});}else if(_0x16bd57){_0x1dee0a();}else{return _0x398be7['status'](0x194)['json']({'message':_0xb284('0x2b')});}});}exports['isAuthenticated']=isAuthenticated;function canUpdate(){return compose()['use'](function(_0x265970,_0x5a9826,_0x3298cf){return require(_0xb284('0x2c'))[_0xb284('0x2d')]()[_0xb284('0x18')](function(_0x1d4956){if(_0x1d4956['update']){_0x3298cf();}else{return _0x5a9826[_0xb284('0x19')](0x193)[_0xb284('0x1b')]({'message':_0xb284('0x2e')});}})[_0xb284('0x1e')](function(_0x5d6181){_0x3298cf(_0x5d6181);});});}exports[_0xb284('0x2f')]=canUpdate;function signToken(_0x580937,_0xdd8d60){return jwt[_0xb284('0x30')]({'id':_0x580937,'role':_0xdd8d60},config[_0xb284('0x7')][_0xb284('0x8')],{'expiresIn':0x15180});}exports[_0xb284('0x31')]=signToken;exports[_0xb284('0x32')]=function(_0x10e0dc){if(!_0x10e0dc){throw new Error(_0xb284('0x33'));}return compose()[_0xb284('0x1f')](isAuthenticated())[_0xb284('0x1f')](function meetsRequirements(_0x4cafc9,_0x3b0c44,_0x383eeb){if(config[_0xb284('0x34')][_0xb284('0x35')](_0x4cafc9[_0xb284('0x15')][_0xb284('0x36')])>=config[_0xb284('0x34')][_0xb284('0x35')](_0x10e0dc)){return _0x383eeb();}else{return _0x3b0c44[_0xb284('0x19')](0x193)[_0xb284('0x1b')]({'message':'Forbidden'});}});};exports[_0xb284('0x37')]=function(_0x563fa7,_0x23de4e){if(!_0x563fa7[_0xb284('0x15')]){return _0x23de4e[_0xb284('0x19')](0x194)[_0xb284('0x1b')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x9c2acf=signToken(_0x563fa7[_0xb284('0x15')]['id'],_0x563fa7[_0xb284('0x15')][_0xb284('0x36')]);_0x23de4e[_0xb284('0x38')](_0xb284('0x39'),_0x9c2acf);_0x23de4e[_0xb284('0x38')](_0xb284('0x3a'),JSON[_0xb284('0x3b')](_[_0xb284('0x3c')](_0x563fa7[_0xb284('0x15')],userAttributes)));_0x23de4e[_0xb284('0x3d')](_0xb284('0x3e'));}; \ No newline at end of file +var _0xedea=['pick','redirect','/dashboards/general','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','ipaddr.js','secrets','session','role','fullname','internal','userpic','permissions','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','phoneBarRemoteControl','use','user','ChatInteraction','findOne','params','closed','then','status','unmanaged','disposition','Unmanaged.','Forbidden.','catch','headers','authorization','User','find','name','authenticate','pass','json','startsWith','Bearer','Unknown\x20authorization\x20format.','User\x20not\x20found.','User\x20object\x20not\x20found.','isAuthenticated','../../config/license/util','getLicense','update','Forbidden','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','motion.user','stringify'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xedea,0xc6));var _0xaede=function(_0x17632e,_0x1b3e50){_0x17632e=_0x17632e-0x0;var _0x439ca4=_0xedea[_0x17632e];return _0x439ca4;};'use strict';var db=require(_0xaede('0x0'))['db'];var config=require(_0xaede('0x1'));var _=require(_0xaede('0x2'));var jwt=require(_0xaede('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xaede('0x4'));var basicAuth=require('basic-auth');var ipaddr=require(_0xaede('0x5'));var validateJwt=expressJwt({'secret':config[_0xaede('0x6')][_0xaede('0x7')]});var userAttributes=['id',_0xaede('0x8'),_0xaede('0x9'),'name',_0xaede('0xa'),'email',_0xaede('0xb'),_0xaede('0xc'),'voicePause',_0xaede('0xd'),'mailPause',_0xaede('0xe'),_0xaede('0xf'),_0xaede('0x10'),_0xaede('0x11'),_0xaede('0x12'),'phoneBarRemoteControlPort',_0xaede('0x13')];exports['isChatInteractionAuthorized']=function(){return isAuthenticated(!![])[_0xaede('0x14')](function(_0x11cf0d,_0x3926f7,_0x2579f4){if(_0x11cf0d[_0xaede('0x15')]){_0x2579f4();}else{return db[_0xaede('0x16')][_0xaede('0x17')]({'where':{'id':_0x11cf0d[_0xaede('0x18')]['id']},'attributes':['id',_0xaede('0x19'),'disposition'],'raw':!![]})[_0xaede('0x1a')](function(_0x3f2da1){if(_0x3f2da1&&_0x3f2da1[_0xaede('0x19')]){return _0x3926f7[_0xaede('0x1b')](_0x3f2da1['disposition']===_0xaede('0x1c')?0x195:0x193)['json']({'message':_0x3f2da1[_0xaede('0x1d')]===_0xaede('0x1c')?_0xaede('0x1e'):_0xaede('0x1f')});}else{_0x2579f4();}})[_0xaede('0x20')](function(_0x1cad6f){_0x2579f4(_0x1cad6f);});}});};function isAuthenticated(_0x334efc){return compose()['use'](function(_0x30dac1,_0x312a71,_0x56ce8d){if(_0x30dac1[_0xaede('0x21')][_0xaede('0x22')]){if(_['startsWith'](_0x30dac1['headers'][_0xaede('0x22')],'Basic')){var _0x76d40c=basicAuth(_0x30dac1);db[_0xaede('0x23')][_0xaede('0x24')]({'where':{'name':_0x76d40c[_0xaede('0x25')]}})[_0xaede('0x1a')](function(_0x3989b7){if(!_0x3989b7||!_0x3989b7[_0xaede('0x26')](_0x76d40c[_0xaede('0x27')])){return _0x312a71['status'](0x191)[_0xaede('0x28')]({'message':'Wrong\x20credentials.'});}_0x30dac1[_0xaede('0x15')]={'id':_0x3989b7['id']};_0x56ce8d();})[_0xaede('0x20')](function(_0x261d72){_0x56ce8d(_0x261d72);});}else if(_[_0xaede('0x29')](_0x30dac1['headers']['authorization'],_0xaede('0x2a'))){validateJwt(_0x30dac1,_0x312a71,_0x56ce8d);}}else{if(_0x334efc){_0x56ce8d();}else{return _0x312a71['status'](0x191)[_0xaede('0x28')]({'message':_0xaede('0x2b')});}}})[_0xaede('0x14')](function(_0x2a0103,_0x2bcbb0,_0x2b68ee){if(_0x2a0103[_0xaede('0x15')]){db['User'][_0xaede('0x24')]({'where':{'id':_0x2a0103['user']['id']},'attributes':userAttributes})[_0xaede('0x1a')](function(_0x513402){if(!_0x513402){return _0x2bcbb0['status'](0x194)[_0xaede('0x28')]({'message':_0xaede('0x2c')});}_0x2a0103['user']=_0x513402;_0x2b68ee();})[_0xaede('0x20')](function(_0x3809d7){_0x2b68ee(_0x3809d7);});}else if(_0x334efc){_0x2b68ee();}else{return _0x2bcbb0[_0xaede('0x1b')](0x194)['json']({'message':_0xaede('0x2d')});}});}exports[_0xaede('0x2e')]=isAuthenticated;function canUpdate(){return compose()[_0xaede('0x14')](function(_0x31b19a,_0x33f2ff,_0x166de2){return require(_0xaede('0x2f'))[_0xaede('0x30')]()['then'](function(_0x13859d){if(_0x13859d[_0xaede('0x31')]){_0x166de2();}else{return _0x33f2ff[_0xaede('0x1b')](0x193)[_0xaede('0x28')]({'message':_0xaede('0x32')});}})['catch'](function(_0x2f6ef0){_0x166de2(_0x2f6ef0);});});}exports['canUpdate']=canUpdate;function signToken(_0x477e81,_0x311577){return jwt['sign']({'id':_0x477e81,'role':_0x311577},config['secrets'][_0xaede('0x7')],{'expiresIn':0x15180});}exports[_0xaede('0x33')]=signToken;exports[_0xaede('0x34')]=function(_0x24137a){if(!_0x24137a){throw new Error(_0xaede('0x35'));}return compose()[_0xaede('0x14')](isAuthenticated())[_0xaede('0x14')](function meetsRequirements(_0x546e61,_0x411f7d,_0x3f0444){if(config[_0xaede('0x36')][_0xaede('0x37')](_0x546e61['user'][_0xaede('0x8')])>=config[_0xaede('0x36')][_0xaede('0x37')](_0x24137a)){return _0x3f0444();}else{return _0x411f7d['status'](0x193)[_0xaede('0x28')]({'message':_0xaede('0x32')});}});};exports[_0xaede('0x38')]=function(_0x113364,_0x133f22){if(!_0x113364[_0xaede('0x15')]){return _0x133f22['status'](0x194)[_0xaede('0x28')]({'message':_0xaede('0x39')});}var _0x12a416=signToken(_0x113364[_0xaede('0x15')]['id'],_0x113364['user'][_0xaede('0x8')]);_0x133f22[_0xaede('0x3a')](_0xaede('0x3b'),_0x12a416);_0x133f22[_0xaede('0x3a')](_0xaede('0x3c'),JSON[_0xaede('0x3d')](_[_0xaede('0x3e')](_0x113364['user'],userAttributes)));_0x133f22[_0xaede('0x3f')](_0xaede('0x40'));}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 11ee859..7a159e5 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 _0xbdaa=['hasOwnProperty','createReadStream','createWriteStream','createCipher','algorithm','data','update','binary','write','final','end','close','unlink','createDecipher','crypto','bluebird','aes192'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0xbdaa,0x1d9));var _0xabda=function(_0x257f03,_0x33d1e2){_0x257f03=_0x257f03-0x0;var _0x46ac28=_0xbdaa[_0x257f03];return _0x46ac28;};'use strict';var crypto=require(_0xabda('0x0'));var fs=require('fs');var BPromise=require(_0xabda('0x1'));var defaultOptions={'algorithm':_0xabda('0x2')};function combineOptions(_0x531ccb){var _0x352229={};for(var _0x35912a in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x35912a)){_0x352229[_0x35912a]=defaultOptions[_0x35912a];}}if(_0x531ccb){for(var _0x1b2989 in _0x531ccb){if(_0x531ccb[_0xabda('0x3')](_0x1b2989)){_0x352229[_0x1b2989]=_0x531ccb[_0x1b2989];}}}return _0x352229;}exports['encryptFile']=function(_0x5751e3,_0x8781b1,_0x2a7b37,_0x1b12a6){return new BPromise(function(_0x16e05e,_0x550961){_0x1b12a6=combineOptions(_0x1b12a6);var _0x3435e7=new Buffer(_0x2a7b37);var _0x5c5813=fs[_0xabda('0x4')](_0x5751e3);var _0x3b2dc3=fs[_0xabda('0x5')](_0x8781b1);var _0x17f26e=crypto[_0xabda('0x6')](_0x1b12a6[_0xabda('0x7')],_0x3435e7);_0x5c5813['on'](_0xabda('0x8'),function(_0x36b471){var _0x90a935=new Buffer(_0x17f26e[_0xabda('0x9')](_0x36b471),_0xabda('0xa'));_0x3b2dc3[_0xabda('0xb')](_0x90a935);});_0x5c5813['on']('end',function(){try{var _0x4d77ab=new Buffer(_0x17f26e[_0xabda('0xc')](_0xabda('0xa')),'binary');_0x3b2dc3[_0xabda('0xb')](_0x4d77ab);_0x3b2dc3[_0xabda('0xd')]();_0x3b2dc3['on'](_0xabda('0xe'),function(){return _0x16e05e(_0x8781b1);});}catch(_0x1f3cf5){fs[_0xabda('0xf')](_0x8781b1);return _0x550961(_0x1f3cf5);}});});};exports['decryptFile']=function(_0x2ae048,_0x3eb93a,_0x3a96f6,_0x3adfef){return new BPromise(function(_0x1b5c8e,_0x519e7c){_0x3adfef=combineOptions(_0x3adfef);var _0x5c8355=new Buffer(_0x3a96f6);var _0x58888a=fs[_0xabda('0x4')](_0x2ae048);var _0x2a05c3=fs[_0xabda('0x5')](_0x3eb93a);var _0x132667=crypto[_0xabda('0x10')](_0x3adfef[_0xabda('0x7')],_0x5c8355);_0x58888a['on']('data',function(_0x29b613){var _0x6eb5b5=new Buffer(_0x132667[_0xabda('0x9')](_0x29b613),_0xabda('0xa'));_0x2a05c3[_0xabda('0xb')](_0x6eb5b5);});_0x58888a['on']('end',function(){try{var _0x2946c9=new Buffer(_0x132667['final']('binary'),_0xabda('0xa'));_0x2a05c3[_0xabda('0xb')](_0x2946c9);_0x2a05c3[_0xabda('0xd')]();_0x2a05c3['on']('close',function(){return _0x1b5c8e(_0x3eb93a);});}catch(_0x128452){fs[_0xabda('0xf')](_0x3eb93a);return _0x519e7c(_0x128452);}});});}; \ No newline at end of file +var _0xf14c=['encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','unlink','decryptFile','createDecipher','update','crypto','aes192','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf14c,0xe7));var _0xcf14=function(_0x52b2b6,_0x2ebdf7){_0x52b2b6=_0x52b2b6-0x0;var _0xe9950=_0xf14c[_0x52b2b6];return _0xe9950;};'use strict';var crypto=require(_0xcf14('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0xcf14('0x1')};function combineOptions(_0x4be214){var _0xb23a27={};for(var _0x16c1f2 in defaultOptions){if(defaultOptions[_0xcf14('0x2')](_0x16c1f2)){_0xb23a27[_0x16c1f2]=defaultOptions[_0x16c1f2];}}if(_0x4be214){for(var _0x1e31ce in _0x4be214){if(_0x4be214[_0xcf14('0x2')](_0x1e31ce)){_0xb23a27[_0x1e31ce]=_0x4be214[_0x1e31ce];}}}return _0xb23a27;}exports[_0xcf14('0x3')]=function(_0x4dead6,_0x3afa91,_0x505f1f,_0xee8c79){return new BPromise(function(_0x549f7a,_0x1df031){_0xee8c79=combineOptions(_0xee8c79);var _0x26ad5f=new Buffer(_0x505f1f);var _0x2123cc=fs[_0xcf14('0x4')](_0x4dead6);var _0x12f764=fs[_0xcf14('0x5')](_0x3afa91);var _0x1f6a6d=crypto[_0xcf14('0x6')](_0xee8c79[_0xcf14('0x7')],_0x26ad5f);_0x2123cc['on'](_0xcf14('0x8'),function(_0x575ef8){var _0x1d7476=new Buffer(_0x1f6a6d['update'](_0x575ef8),_0xcf14('0x9'));_0x12f764[_0xcf14('0xa')](_0x1d7476);});_0x2123cc['on'](_0xcf14('0xb'),function(){try{var _0x20bd9d=new Buffer(_0x1f6a6d[_0xcf14('0xc')](_0xcf14('0x9')),_0xcf14('0x9'));_0x12f764[_0xcf14('0xa')](_0x20bd9d);_0x12f764[_0xcf14('0xb')]();_0x12f764['on'](_0xcf14('0xd'),function(){return _0x549f7a(_0x3afa91);});}catch(_0x348728){fs[_0xcf14('0xe')](_0x3afa91);return _0x1df031(_0x348728);}});});};exports[_0xcf14('0xf')]=function(_0x25e137,_0x4390c9,_0x47b243,_0x45de95){return new BPromise(function(_0x5bb817,_0x85225f){_0x45de95=combineOptions(_0x45de95);var _0x32de44=new Buffer(_0x47b243);var _0x25b631=fs[_0xcf14('0x4')](_0x25e137);var _0x5bc430=fs[_0xcf14('0x5')](_0x4390c9);var _0x1975c1=crypto[_0xcf14('0x10')](_0x45de95[_0xcf14('0x7')],_0x32de44);_0x25b631['on'](_0xcf14('0x8'),function(_0x4f276d){var _0x139ffd=new Buffer(_0x1975c1[_0xcf14('0x11')](_0x4f276d),_0xcf14('0x9'));_0x5bc430[_0xcf14('0xa')](_0x139ffd);});_0x25b631['on'](_0xcf14('0xb'),function(){try{var _0x1ea9af=new Buffer(_0x1975c1['final']('binary'),_0xcf14('0x9'));_0x5bc430[_0xcf14('0xa')](_0x1ea9af);_0x5bc430[_0xcf14('0xb')]();_0x5bc430['on']('close',function(){return _0x5bb817(_0x4390c9);});}catch(_0x13b226){fs[_0xcf14('0xe')](_0x4390c9);return _0x85225f(_0x13b226);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 09013d8..1084cc5 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 _0x814b=['SELECT','num','Empty','length','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','error','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','Setting','find','split','splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes'];(function(_0xa2c2e2,_0x535d90){var _0x3d7867=function(_0x48be46){while(--_0x48be46){_0xa2c2e2['push'](_0xa2c2e2['shift']());}};_0x3d7867(++_0x535d90);}(_0x814b,0x1a2));var _0xb814=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0x814b[_0x1709e7];return _0x402819;};'use strict';var util=require(_0xb814('0x0'));var path=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));var csv=require(_0xb814('0x3'));var fs=require('fs');var BPromise=require(_0xb814('0x4'));var zipdir=require(_0xb814('0x5'));var rimraf=require('rimraf');var db=require(_0xb814('0x6'))['db'];var dbH=require(_0xb814('0x6'))[_0xb814('0x7')];var EXTRACTED_REPORT_ID=Number(process[_0xb814('0x8')][0x2]);var QUERY=process[_0xb814('0x8')][0x3];var PATH=process[_0xb814('0x8')][0x4];function analyticExtractedReport(_0x53e507,_0x3b0829){var _0x2e6272={'status':_0x53e507};var _0x5c8539={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b0829){_0x2e6272[_0xb814('0x9')]=_0x3b0829;}return db[_0xb814('0xa')][_0xb814('0xb')](_0x2e6272,_0x5c8539);}function main(){var _0x41166c=0x1388;var _0x1fea33;return db[_0xb814('0xc')][_0xb814('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb814('0xe'),_0xb814('0xf')]})[_0xb814('0x10')](function(_0x10e4a6){if(_0x10e4a6){_0x1fea33=_0x10e4a6;_0x41166c=_0x1fea33['splitSizeCsv']||0x1388;}})[_0xb814('0x10')](function(){return dbH['sequelize'][_0xb814('0x11')](util[_0xb814('0x12')](_0xb814('0x13'),QUERY),{'type':dbH[_0xb814('0x14')][_0xb814('0x15')][_0xb814('0x16')]});})[_0xb814('0x10')](function(_0x41ed7b){if(!_0x41ed7b[0x0][_0xb814('0x17')]){return analyticExtractedReport(_0xb814('0x18'));}var _0x3f4881=[];var _0x44fb96=0x0;var _0x17f5bd=!![];if(_0x41ed7b&&_0x41ed7b[_0xb814('0x19')]){var _0x303aca=_0x41ed7b[0x0][_0xb814('0x17')]%(_0x44fb96+_0x41166c);if(_0x1fea33[_0xb814('0xe')]){for(;_0x17f5bd;_0x44fb96+=_0x41166c,_0x303aca=_0x41ed7b[0x0][_0xb814('0x17')]%(_0x44fb96+_0x41166c)){if(_0x303aca==0x0||_0x303aca==_0x41ed7b[0x0][_0xb814('0x17')]){_0x17f5bd=![];}_0x3f4881[_0xb814('0x1a')](dbH[_0xb814('0x14')]['query'](util[_0xb814('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41166c,_0x44fb96),{'type':dbH[_0xb814('0x14')][_0xb814('0x15')]['SELECT']}));}}else{_0x3f4881['push'](dbH['sequelize'][_0xb814('0x11')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xb814('0x16')]}));}}var _0x24211d=path[_0xb814('0x1b')](PATH);var _0x4e139e=path[_0xb814('0x1c')](PATH,'.csv');var _0x1e6393=_0x1fea33[_0xb814('0xe')]&&_0x3f4881[_0xb814('0x19')]>0x1;var _0x470e81=[];if(!fs[_0xb814('0x1d')](path[_0xb814('0x1e')](_0x24211d,_0x4e139e))&&_0x1e6393){fs[_0xb814('0x1f')](path['join'](_0x24211d,_0x4e139e));}return BPromise[_0xb814('0x20')](_0x3f4881,function(_0x52b7a3){_0x470e81[_0xb814('0x1a')](_0x52b7a3);})[_0xb814('0x10')](function(){for(var _0x31c7ec=0x0;_0x31c7ec<_0x470e81[_0xb814('0x19')];_0x31c7ec+=0x1){var _0x1c8a2e;var _0xb9e57d=_0x470e81[_0x31c7ec];if(_0x1e6393){_0x1c8a2e=path[_0xb814('0x1e')](_0x24211d,_0x4e139e,util['format'](_0xb814('0x21'),_0x4e139e,_0x31c7ec,_0xb814('0x22')));}else{_0x1c8a2e=path[_0xb814('0x1e')](_0x24211d,util[_0xb814('0x12')](_0xb814('0x23'),_0x4e139e,_0xb814('0x22')));}fs[_0xb814('0x24')](_0x1c8a2e,csv(_0xb9e57d));}})[_0xb814('0x10')](function(){if(_0x1e6393){zipdir(path['join'](_0x24211d,_0x4e139e),{'saveTo':path[_0xb814('0x1e')](_0x24211d,util[_0xb814('0x12')]('%s.%s',_0x4e139e,_0xb814('0x25')))},function(_0x37d24d,_0x530744){});rimraf(path['join'](_0x24211d,_0x4e139e),function(){});}})[_0xb814('0x10')](function(){return analyticExtractedReport(_0xb814('0x26'),_0x1e6393?util['format'](_0xb814('0x23'),_0x4e139e,_0x1e6393?'zip':_0xb814('0x22')):null);});})['catch'](function(_0x4cfc58){console[_0xb814('0x27')](_0x4cfc58);return analyticExtractedReport('Error');});}main(); \ No newline at end of file +var _0x814b=['SELECT','num','Empty','length','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','error','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','Setting','find','split','splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x814b,0x1a2));var _0xb814=function(_0x3afbdf,_0x9e463b){_0x3afbdf=_0x3afbdf-0x0;var _0x5b6861=_0x814b[_0x3afbdf];return _0x5b6861;};'use strict';var util=require(_0xb814('0x0'));var path=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));var csv=require(_0xb814('0x3'));var fs=require('fs');var BPromise=require(_0xb814('0x4'));var zipdir=require(_0xb814('0x5'));var rimraf=require('rimraf');var db=require(_0xb814('0x6'))['db'];var dbH=require(_0xb814('0x6'))[_0xb814('0x7')];var EXTRACTED_REPORT_ID=Number(process[_0xb814('0x8')][0x2]);var QUERY=process[_0xb814('0x8')][0x3];var PATH=process[_0xb814('0x8')][0x4];function analyticExtractedReport(_0x53e507,_0x3b0829){var _0x2e6272={'status':_0x53e507};var _0x5c8539={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b0829){_0x2e6272[_0xb814('0x9')]=_0x3b0829;}return db[_0xb814('0xa')][_0xb814('0xb')](_0x2e6272,_0x5c8539);}function main(){var _0x41166c=0x1388;var _0x1fea33;return db[_0xb814('0xc')][_0xb814('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb814('0xe'),_0xb814('0xf')]})[_0xb814('0x10')](function(_0x10e4a6){if(_0x10e4a6){_0x1fea33=_0x10e4a6;_0x41166c=_0x1fea33['splitSizeCsv']||0x1388;}})[_0xb814('0x10')](function(){return dbH['sequelize'][_0xb814('0x11')](util[_0xb814('0x12')](_0xb814('0x13'),QUERY),{'type':dbH[_0xb814('0x14')][_0xb814('0x15')][_0xb814('0x16')]});})[_0xb814('0x10')](function(_0x41ed7b){if(!_0x41ed7b[0x0][_0xb814('0x17')]){return analyticExtractedReport(_0xb814('0x18'));}var _0x3f4881=[];var _0x44fb96=0x0;var _0x17f5bd=!![];if(_0x41ed7b&&_0x41ed7b[_0xb814('0x19')]){var _0x303aca=_0x41ed7b[0x0][_0xb814('0x17')]%(_0x44fb96+_0x41166c);if(_0x1fea33[_0xb814('0xe')]){for(;_0x17f5bd;_0x44fb96+=_0x41166c,_0x303aca=_0x41ed7b[0x0][_0xb814('0x17')]%(_0x44fb96+_0x41166c)){if(_0x303aca==0x0||_0x303aca==_0x41ed7b[0x0][_0xb814('0x17')]){_0x17f5bd=![];}_0x3f4881[_0xb814('0x1a')](dbH[_0xb814('0x14')]['query'](util[_0xb814('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41166c,_0x44fb96),{'type':dbH[_0xb814('0x14')][_0xb814('0x15')]['SELECT']}));}}else{_0x3f4881['push'](dbH['sequelize'][_0xb814('0x11')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xb814('0x16')]}));}}var _0x24211d=path[_0xb814('0x1b')](PATH);var _0x4e139e=path[_0xb814('0x1c')](PATH,'.csv');var _0x1e6393=_0x1fea33[_0xb814('0xe')]&&_0x3f4881[_0xb814('0x19')]>0x1;var _0x470e81=[];if(!fs[_0xb814('0x1d')](path[_0xb814('0x1e')](_0x24211d,_0x4e139e))&&_0x1e6393){fs[_0xb814('0x1f')](path['join'](_0x24211d,_0x4e139e));}return BPromise[_0xb814('0x20')](_0x3f4881,function(_0x52b7a3){_0x470e81[_0xb814('0x1a')](_0x52b7a3);})[_0xb814('0x10')](function(){for(var _0x31c7ec=0x0;_0x31c7ec<_0x470e81[_0xb814('0x19')];_0x31c7ec+=0x1){var _0x1c8a2e;var _0xb9e57d=_0x470e81[_0x31c7ec];if(_0x1e6393){_0x1c8a2e=path[_0xb814('0x1e')](_0x24211d,_0x4e139e,util['format'](_0xb814('0x21'),_0x4e139e,_0x31c7ec,_0xb814('0x22')));}else{_0x1c8a2e=path[_0xb814('0x1e')](_0x24211d,util[_0xb814('0x12')](_0xb814('0x23'),_0x4e139e,_0xb814('0x22')));}fs[_0xb814('0x24')](_0x1c8a2e,csv(_0xb9e57d));}})[_0xb814('0x10')](function(){if(_0x1e6393){zipdir(path['join'](_0x24211d,_0x4e139e),{'saveTo':path[_0xb814('0x1e')](_0x24211d,util[_0xb814('0x12')]('%s.%s',_0x4e139e,_0xb814('0x25')))},function(_0x37d24d,_0x530744){});rimraf(path['join'](_0x24211d,_0x4e139e),function(){});}})[_0xb814('0x10')](function(){return analyticExtractedReport(_0xb814('0x26'),_0x1e6393?util['format'](_0xb814('0x23'),_0x4e139e,_0x1e6393?'zip':_0xb814('0x22')):null);});})['catch'](function(_0x4cfc58){console[_0xb814('0x27')](_0x4cfc58);return analyticExtractedReport('Error');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4228ed1..a4604f8 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 _0xbb91=['split','splitSizePdf','then','length','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','header','body','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','createWriteStream','finish','log','err','zip','Completed','findOne','error','Error','lodash','bluebird','util','moment','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','push','tableHeader','num','dirname','basename','.pdf','Setting','find'];(function(_0x1fd456,_0x3b5d5f){var _0x599648=function(_0x1f8a70){while(--_0x1f8a70){_0x1fd456['push'](_0x1fd456['shift']());}};_0x599648(++_0x3b5d5f);}(_0xbb91,0xce));var _0x1bb9=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0xbb91[_0x1e5068];return _0x2230b6;};'use strict';var _=require(_0x1bb9('0x0'));var fs=require('fs');var BPromise=require(_0x1bb9('0x1'));var util=require(_0x1bb9('0x2'));var path=require('path');var moment=require(_0x1bb9('0x3'));var PdfPrinter=require(_0x1bb9('0x4'));var zipdir=require(_0x1bb9('0x5'));var rimraf=require(_0x1bb9('0x6'));var db=require(_0x1bb9('0x7'))['db'];var dbH=require(_0x1bb9('0x7'))[_0x1bb9('0x8')];var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1bb9('0x9')][0x3];var PATH=process[_0x1bb9('0x9')][0x4];var NAME=process[_0x1bb9('0x9')][0x5];var FORMAT=_0x1bb9('0xa');var _extractedReport;function analyticExtractedReport(_0x257cae,_0x5becd3){var _0x5a45f0={'status':_0x257cae};var _0x14e709={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5becd3){_0x5a45f0[_0x1bb9('0xb')]=_0x5becd3;}return db[_0x1bb9('0xc')]['update'](_0x5a45f0,_0x14e709);}function getHeader(_0x5d8df9){var _0x303345=[];for(var _0x269cc9 in _0x5d8df9){if(_0x5d8df9[_0x1bb9('0xd')](_0x269cc9)){_0x303345[_0x1bb9('0xe')]({'text':_0x269cc9,'style':_0x1bb9('0xf')});}}return _0x303345;}function extractReport(_0x1f0206){var _0x52665e=0x1388;var _0x52cd9b;if(!_0x1f0206[0x0][_0x1bb9('0x10')]){return analyticExtractedReport('Empty');}var _0x4f3e34=[];var _0x5a9c2e=0x0;var _0x386393=!![];var _0x2de380=path[_0x1bb9('0x11')](PATH);var _0x1ef180=path[_0x1bb9('0x12')](PATH,_0x1bb9('0x13'));var _0x46c05a=![];var _0x1dd719=[];return db[_0x1bb9('0x14')][_0x1bb9('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1bb9('0x16'),_0x1bb9('0x17')]})[_0x1bb9('0x18')](function(_0x546c15){if(_0x546c15){_0x52cd9b=_0x546c15;_0x52665e=_0x52cd9b[_0x1bb9('0x17')]||0x3e8;}})[_0x1bb9('0x18')](function(){if(_0x1f0206&&_0x1f0206[_0x1bb9('0x19')]){var _0x1ec5be=_0x1f0206[0x0]['num']%(_0x5a9c2e+_0x52665e);if(_0x52cd9b['split']){for(;_0x386393;_0x5a9c2e+=_0x52665e,_0x1ec5be=_0x1f0206[0x0]['num']%(_0x5a9c2e+_0x52665e)){if(_0x1ec5be==0x0||_0x1ec5be==_0x1f0206[0x0][_0x1bb9('0x10')]){_0x386393=![];}_0x4f3e34[_0x1bb9('0xe')](dbH[_0x1bb9('0x1a')][_0x1bb9('0x1b')](util[_0x1bb9('0x1c')](_0x1bb9('0x1d'),QUERY,_0x52665e,_0x5a9c2e),{'type':dbH['sequelize'][_0x1bb9('0x1e')][_0x1bb9('0x1f')]}));}}else{_0x4f3e34['push'](dbH['sequelize'][_0x1bb9('0x1b')](QUERY,{'type':dbH[_0x1bb9('0x1a')][_0x1bb9('0x1e')][_0x1bb9('0x1f')]}));}}_0x46c05a=_0x52cd9b[_0x1bb9('0x16')]&&_0x4f3e34[_0x1bb9('0x19')]>0x1;if(!fs['existsSync'](path[_0x1bb9('0x20')](_0x2de380,_0x1ef180))&&_0x46c05a){fs[_0x1bb9('0x21')](path[_0x1bb9('0x20')](_0x2de380,_0x1ef180));}return BPromise[_0x1bb9('0x22')](_0x4f3e34,function(_0xa6d52a){_0x1dd719[_0x1bb9('0xe')](_0xa6d52a);});})['then'](function(){return BPromise[_0x1bb9('0x22')](_0x4f3e34,function(_0x1ccaf4,_0x21b0c9){var _0x2eb509;var _0xdf48a=util[_0x1bb9('0x1c')](_0x1bb9('0x23'),NAME,_extractedReport[_0x1bb9('0x24')],moment(_extractedReport['startDate'])[_0x1bb9('0x1c')](FORMAT),moment(_extractedReport[_0x1bb9('0x25')])[_0x1bb9('0x1c')](FORMAT));var _0x272cf1={'pageSize':'A4','pageOrientation':_0x1bb9('0x26'),'content':[{'text':_0xdf48a,'style':_0x1bb9('0x27')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x1026bd={'headerRows':0x1,'body':[]};_0x1026bd[_0x1bb9('0x28')][_0x1bb9('0xe')](getHeader(_0x1ccaf4[0x0]));var _0x295794;for(var _0x4503c6=0x0;_0x4503c6<_0x1ccaf4[_0x1bb9('0x19')];_0x4503c6+=0x1){_0x295794=[];for(var _0x4237fa in _0x1ccaf4[_0x4503c6]){if(_0x1ccaf4[_0x4503c6][_0x1bb9('0xd')](_0x4237fa)){_0x295794[_0x1bb9('0xe')](_0x1ccaf4[_0x4503c6][_0x4237fa]?_['toString'](_0x1ccaf4[_0x4503c6][_0x4237fa]):'');}}_0x1026bd[_0x1bb9('0x28')][_0x1bb9('0xe')](_0x295794);}_0x272cf1[_0x1bb9('0x29')][_0x1bb9('0xe')]({'table':_0x1026bd});return new BPromise(function(_0x23c465,_0x4e6505){var _0x2a9750=new PdfPrinter({'Roboto':{'normal':__dirname+_0x1bb9('0x2a'),'bold':__dirname+_0x1bb9('0x2b'),'italics':__dirname+'/fonts/Roboto-Italic.ttf','bolditalics':__dirname+_0x1bb9('0x2c')}});var _0x1dba19=_0x2a9750[_0x1bb9('0x2d')](_0x272cf1);if(_0x46c05a){_0x2eb509=path['join'](_0x2de380,_0x1ef180,util[_0x1bb9('0x1c')]('%s%d.%s',_0x1ef180,_0x21b0c9,_0x1bb9('0x2e')));}else{_0x2eb509=path[_0x1bb9('0x20')](_0x2de380,util[_0x1bb9('0x1c')](_0x1bb9('0x2f'),_0x1ef180,_0x1bb9('0x2e')));}var _0x14188b=_0x1dba19['pipe'](fs[_0x1bb9('0x30')](_0x2eb509));_0x14188b['on'](_0x1bb9('0x31'),function(){_0x23c465();});_0x14188b['on']('error',function(_0x5d4869){console[_0x1bb9('0x32')](_0x1bb9('0x33'),_0x5d4869);_0x4e6505(_0x5d4869);});_0x1dba19['end']();});});})['then'](function(){if(_0x46c05a){return new BPromise(function(_0x507db8,_0xee4ff3){zipdir(path[_0x1bb9('0x20')](_0x2de380,_0x1ef180),{'saveTo':path['join'](_0x2de380,util[_0x1bb9('0x1c')](_0x1bb9('0x2f'),_0x1ef180,_0x1bb9('0x34')))},function(_0x64396f){if(_0x64396f){_0xee4ff3(_0x64396f);}else{_0x507db8();}});});}})[_0x1bb9('0x18')](function(){if(_0x46c05a){rimraf(path['join'](_0x2de380,_0x1ef180),function(){});}})['then'](function(){return analyticExtractedReport(_0x1bb9('0x35'),_0x46c05a?util[_0x1bb9('0x1c')](_0x1bb9('0x2f'),_0x1ef180,_0x46c05a?'zip':'pdf'):null);});}function main(){return db['AnalyticExtractedReport'][_0x1bb9('0x36')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1bb9('0x18')](function(_0x4021f4){_extractedReport=_0x4021f4;return dbH[_0x1bb9('0x1a')][_0x1bb9('0x1b')](util[_0x1bb9('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1bb9('0x1a')][_0x1bb9('0x1e')]['SELECT']});})[_0x1bb9('0x18')](extractReport)['catch'](function(_0x40f28b){console[_0x1bb9('0x37')](_0x40f28b);return analyticExtractedReport(_0x1bb9('0x38'));});}main(); \ No newline at end of file +var _0xe676=['existsSync','join','each','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','header','body','hasOwnProperty','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','pipe','createWriteStream','finish','error','log','err','Completed','zip','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','push','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query'];(function(_0x3eba07,_0x35f0eb){var _0x3b4be5=function(_0x44de29){while(--_0x44de29){_0x3eba07['push'](_0x3eba07['shift']());}};_0x3b4be5(++_0x35f0eb);}(_0xe676,0x14f));var _0x6e67=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xe676[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x6e67('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0x6e67('0x1'));var path=require(_0x6e67('0x2'));var moment=require(_0x6e67('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x6e67('0x4'));var rimraf=require(_0x6e67('0x5'));var db=require(_0x6e67('0x6'))['db'];var dbH=require(_0x6e67('0x6'))[_0x6e67('0x7')];var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6e67('0x8')][0x3];var PATH=process[_0x6e67('0x8')][0x4];var NAME=process[_0x6e67('0x8')][0x5];var FORMAT=_0x6e67('0x9');var _extractedReport;function analyticExtractedReport(_0x1b252d,_0x3868e0){var _0x1b77db={'status':_0x1b252d};var _0x210439={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3868e0){_0x1b77db[_0x6e67('0xa')]=_0x3868e0;}return db[_0x6e67('0xb')][_0x6e67('0xc')](_0x1b77db,_0x210439);}function getHeader(_0x257864){var _0x1900c9=[];for(var _0x3e1bde in _0x257864){if(_0x257864['hasOwnProperty'](_0x3e1bde)){_0x1900c9[_0x6e67('0xd')]({'text':_0x3e1bde,'style':_0x6e67('0xe')});}}return _0x1900c9;}function extractReport(_0x5dc823){var _0x58274a=0x1388;var _0xebf94;if(!_0x5dc823[0x0][_0x6e67('0xf')]){return analyticExtractedReport(_0x6e67('0x10'));}var _0x30f49c=[];var _0x2431d0=0x0;var _0x30e5dd=!![];var _0xe7e1f7=path[_0x6e67('0x11')](PATH);var _0x30d6c2=path[_0x6e67('0x12')](PATH,_0x6e67('0x13'));var _0x37f28c=![];var _0x578eaf=[];return db[_0x6e67('0x14')][_0x6e67('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6e67('0x16'),_0x6e67('0x17')]})['then'](function(_0xc259ad){if(_0xc259ad){_0xebf94=_0xc259ad;_0x58274a=_0xebf94[_0x6e67('0x17')]||0x3e8;}})[_0x6e67('0x18')](function(){if(_0x5dc823&&_0x5dc823[_0x6e67('0x19')]){var _0x330043=_0x5dc823[0x0][_0x6e67('0xf')]%(_0x2431d0+_0x58274a);if(_0xebf94[_0x6e67('0x16')]){for(;_0x30e5dd;_0x2431d0+=_0x58274a,_0x330043=_0x5dc823[0x0][_0x6e67('0xf')]%(_0x2431d0+_0x58274a)){if(_0x330043==0x0||_0x330043==_0x5dc823[0x0][_0x6e67('0xf')]){_0x30e5dd=![];}_0x30f49c[_0x6e67('0xd')](dbH['sequelize']['query'](util['format'](_0x6e67('0x1a'),QUERY,_0x58274a,_0x2431d0),{'type':dbH[_0x6e67('0x1b')][_0x6e67('0x1c')][_0x6e67('0x1d')]}));}}else{_0x30f49c[_0x6e67('0xd')](dbH[_0x6e67('0x1b')][_0x6e67('0x1e')](QUERY,{'type':dbH[_0x6e67('0x1b')][_0x6e67('0x1c')][_0x6e67('0x1d')]}));}}_0x37f28c=_0xebf94[_0x6e67('0x16')]&&_0x30f49c[_0x6e67('0x19')]>0x1;if(!fs[_0x6e67('0x1f')](path[_0x6e67('0x20')](_0xe7e1f7,_0x30d6c2))&&_0x37f28c){fs['mkdirSync'](path[_0x6e67('0x20')](_0xe7e1f7,_0x30d6c2));}return BPromise[_0x6e67('0x21')](_0x30f49c,function(_0x3dbb91){_0x578eaf['push'](_0x3dbb91);});})[_0x6e67('0x18')](function(){return BPromise['each'](_0x30f49c,function(_0x307026,_0x5da658){var _0x14f3eb;var _0x218d95=util[_0x6e67('0x22')](_0x6e67('0x23'),NAME,_extractedReport['name'],moment(_extractedReport[_0x6e67('0x24')])[_0x6e67('0x22')](FORMAT),moment(_extractedReport[_0x6e67('0x25')])[_0x6e67('0x22')](FORMAT));var _0x16efec={'pageSize':'A4','pageOrientation':_0x6e67('0x26'),'content':[{'text':_0x218d95,'style':_0x6e67('0x27')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x5e3c28={'headerRows':0x1,'body':[]};_0x5e3c28[_0x6e67('0x28')][_0x6e67('0xd')](getHeader(_0x307026[0x0]));var _0x1486ed;for(var _0x36fe2b=0x0;_0x36fe2b<_0x307026[_0x6e67('0x19')];_0x36fe2b+=0x1){_0x1486ed=[];for(var _0xf6bafe in _0x307026[_0x36fe2b]){if(_0x307026[_0x36fe2b][_0x6e67('0x29')](_0xf6bafe)){_0x1486ed[_0x6e67('0xd')](_0x307026[_0x36fe2b][_0xf6bafe]?_[_0x6e67('0x2a')](_0x307026[_0x36fe2b][_0xf6bafe]):'');}}_0x5e3c28[_0x6e67('0x28')][_0x6e67('0xd')](_0x1486ed);}_0x16efec[_0x6e67('0x2b')]['push']({'table':_0x5e3c28});return new BPromise(function(_0x28447f,_0x1941db){var _0x2c805d=new PdfPrinter({'Roboto':{'normal':__dirname+_0x6e67('0x2c'),'bold':__dirname+'/fonts/Roboto-Medium.ttf','italics':__dirname+'/fonts/Roboto-Italic.ttf','bolditalics':__dirname+_0x6e67('0x2d')}});var _0x59c641=_0x2c805d[_0x6e67('0x2e')](_0x16efec);if(_0x37f28c){_0x14f3eb=path[_0x6e67('0x20')](_0xe7e1f7,_0x30d6c2,util[_0x6e67('0x22')](_0x6e67('0x2f'),_0x30d6c2,_0x5da658,_0x6e67('0x30')));}else{_0x14f3eb=path['join'](_0xe7e1f7,util[_0x6e67('0x22')](_0x6e67('0x31'),_0x30d6c2,'pdf'));}var _0x3af6c4=_0x59c641[_0x6e67('0x32')](fs[_0x6e67('0x33')](_0x14f3eb));_0x3af6c4['on'](_0x6e67('0x34'),function(){_0x28447f();});_0x3af6c4['on'](_0x6e67('0x35'),function(_0x51c7aa){console[_0x6e67('0x36')](_0x6e67('0x37'),_0x51c7aa);_0x1941db(_0x51c7aa);});_0x59c641['end']();});});})[_0x6e67('0x18')](function(){if(_0x37f28c){return new BPromise(function(_0x2306d3,_0xf295a0){zipdir(path['join'](_0xe7e1f7,_0x30d6c2),{'saveTo':path[_0x6e67('0x20')](_0xe7e1f7,util[_0x6e67('0x22')](_0x6e67('0x31'),_0x30d6c2,'zip'))},function(_0x3f6f7f){if(_0x3f6f7f){_0xf295a0(_0x3f6f7f);}else{_0x2306d3();}});});}})[_0x6e67('0x18')](function(){if(_0x37f28c){rimraf(path[_0x6e67('0x20')](_0xe7e1f7,_0x30d6c2),function(){});}})[_0x6e67('0x18')](function(){return analyticExtractedReport(_0x6e67('0x38'),_0x37f28c?util['format'](_0x6e67('0x31'),_0x30d6c2,_0x37f28c?_0x6e67('0x39'):_0x6e67('0x30')):null);});}function main(){return db[_0x6e67('0xb')][_0x6e67('0x3a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x6e67('0x18')](function(_0x27cd21){_extractedReport=_0x27cd21;return dbH[_0x6e67('0x1b')][_0x6e67('0x1e')](util[_0x6e67('0x22')](_0x6e67('0x3b'),QUERY),{'type':dbH[_0x6e67('0x1b')]['QueryTypes'][_0x6e67('0x1d')]});})[_0x6e67('0x18')](extractReport)['catch'](function(_0x4e48d2){console[_0x6e67('0x35')](_0x4e48d2);return analyticExtractedReport(_0x6e67('0x3c'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4cd821d..6d11cc3 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 _0xc5e4=['catch','error','Error','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','argv','savename','Setting','find','splitSizeXlsx','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Completed'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xc5e4,0x189));var _0x4c5e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc5e4[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x4c5e('0x0'));var path=require(_0x4c5e('0x1'));var _=require(_0x4c5e('0x2'));var fs=require('fs');var json2xls=require(_0x4c5e('0x3'));var BPromise=require(_0x4c5e('0x4'));var zipdir=require(_0x4c5e('0x5'));var rimraf=require(_0x4c5e('0x6'));var db=require(_0x4c5e('0x7'))['db'];var dbH=require(_0x4c5e('0x7'))['dbH'];var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4c5e('0x8')][0x3];var PATH=process[_0x4c5e('0x8')][0x4];function analyticExtractedReport(_0xaddf9e,_0x365a7d){var _0x1f8042={'status':_0xaddf9e};var _0x3b33d6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x365a7d){_0x1f8042[_0x4c5e('0x9')]=_0x365a7d;}return db['AnalyticExtractedReport']['update'](_0x1f8042,_0x3b33d6);}function main(){var _0x4a69af=0x1388;var _0x32fde4;return db[_0x4c5e('0xa')][_0x4c5e('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4c5e('0xc')]})[_0x4c5e('0xd')](function(_0x2b1311){if(_0x2b1311){_0x32fde4=_0x2b1311;_0x4a69af=_0x32fde4['splitSizeXlsx']||0x1388;}})[_0x4c5e('0xd')](function(){return dbH['sequelize'][_0x4c5e('0xe')](util[_0x4c5e('0xf')](_0x4c5e('0x10'),QUERY),{'type':dbH[_0x4c5e('0x11')][_0x4c5e('0x12')][_0x4c5e('0x13')]});})[_0x4c5e('0xd')](function(_0x2180e2){if(!_0x2180e2[0x0][_0x4c5e('0x14')]){return analyticExtractedReport(_0x4c5e('0x15'));}var _0xb2cfd5=[];var _0xf2c3e0=0x0;var _0x567c77=!![];if(_0x32fde4[_0x4c5e('0x16')]){if(_0x2180e2&&_0x2180e2[_0x4c5e('0x17')]){var _0x89621c=_0x2180e2[0x0][_0x4c5e('0x14')]%(_0xf2c3e0+_0x4a69af);for(;_0x567c77;_0xf2c3e0+=_0x4a69af,_0x89621c=_0x2180e2[0x0]['num']%(_0xf2c3e0+_0x4a69af)){if(_0x89621c==0x0||_0x89621c==_0x2180e2[0x0][_0x4c5e('0x14')]){_0x567c77=![];}_0xb2cfd5[_0x4c5e('0x18')](dbH[_0x4c5e('0x11')][_0x4c5e('0xe')](util[_0x4c5e('0xf')](_0x4c5e('0x19'),QUERY,_0x4a69af,_0xf2c3e0),{'type':dbH[_0x4c5e('0x11')][_0x4c5e('0x12')][_0x4c5e('0x13')]}));}}}else{_0xb2cfd5[_0x4c5e('0x18')](dbH[_0x4c5e('0x11')]['query'](QUERY,{'type':dbH[_0x4c5e('0x11')][_0x4c5e('0x12')][_0x4c5e('0x13')]}));}var _0x3ddfcf=path['dirname'](PATH);var _0x5a1370=path[_0x4c5e('0x1a')](PATH,'.xlsx');var _0x2d63f9=_0x32fde4['split']&&_0xb2cfd5[_0x4c5e('0x17')]>0x1;var _0xf65456=[];if(!fs[_0x4c5e('0x1b')](path[_0x4c5e('0x1c')](_0x3ddfcf,_0x5a1370))&&_0x2d63f9){fs['mkdirSync'](path[_0x4c5e('0x1c')](_0x3ddfcf,_0x5a1370));}return BPromise['each'](_0xb2cfd5,function(_0x2d4ba7){_0xf65456[_0x4c5e('0x18')](_0x2d4ba7);})[_0x4c5e('0xd')](function(){for(var _0x3d8c87=0x0;_0x3d8c87<_0xf65456[_0x4c5e('0x17')];_0x3d8c87+=0x1){var _0x3b87de;var _0x469e79=_0xf65456[_0x3d8c87];if(_0x2d63f9){_0x3b87de=path[_0x4c5e('0x1c')](_0x3ddfcf,_0x5a1370,util[_0x4c5e('0xf')](_0x4c5e('0x1d'),_0x5a1370,_0x3d8c87,_0x4c5e('0x1e')));}else{_0x3b87de=path['join'](_0x3ddfcf,util['format']('%s.%s',_0x5a1370,_0x4c5e('0x1e')));}fs[_0x4c5e('0x1f')](_0x3b87de,json2xls(_0x469e79),_0x4c5e('0x20'));}})[_0x4c5e('0xd')](function(){if(_0x2d63f9){zipdir(path[_0x4c5e('0x1c')](_0x3ddfcf,_0x5a1370),{'saveTo':path[_0x4c5e('0x1c')](_0x3ddfcf,util[_0x4c5e('0xf')](_0x4c5e('0x21'),_0x5a1370,_0x4c5e('0x22')))},function(_0x1d1456,_0x24db7b){});rimraf(path[_0x4c5e('0x1c')](_0x3ddfcf,_0x5a1370),function(){});}})[_0x4c5e('0xd')](function(){return analyticExtractedReport(_0x4c5e('0x23'),_0x2d63f9?util[_0x4c5e('0xf')]('%s.%s',_0x5a1370,_0x2d63f9?_0x4c5e('0x22'):_0x4c5e('0x1e')):null);});})[_0x4c5e('0x24')](function(_0xf0ac4){console[_0x4c5e('0x25')](_0xf0ac4);return analyticExtractedReport(_0x4c5e('0x26'));});}main(); \ No newline at end of file +var _0xa583=['join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','catch','error','Error','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','argv','savename','update','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','num','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length'];(function(_0x4ce1b9,_0x397a4b){var _0x2bb15d=function(_0x3790ad){while(--_0x3790ad){_0x4ce1b9['push'](_0x4ce1b9['shift']());}};_0x2bb15d(++_0x397a4b);}(_0xa583,0xa3));var _0x3a58=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa583[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0x3a58('0x0'));var path=require(_0x3a58('0x1'));var _=require(_0x3a58('0x2'));var fs=require('fs');var json2xls=require(_0x3a58('0x3'));var BPromise=require(_0x3a58('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x3a58('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x3a58('0x6'))[_0x3a58('0x7')];var EXTRACTED_REPORT_ID=Number(process[_0x3a58('0x8')][0x2]);var QUERY=process[_0x3a58('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x28d233,_0x1ea534){var _0x273078={'status':_0x28d233};var _0x4bad1f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ea534){_0x273078[_0x3a58('0x9')]=_0x1ea534;}return db['AnalyticExtractedReport'][_0x3a58('0xa')](_0x273078,_0x4bad1f);}function main(){var _0x4ace2e=0x1388;var _0x338ffb;return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3a58('0xb'),_0x3a58('0xc')]})[_0x3a58('0xd')](function(_0x44699d){if(_0x44699d){_0x338ffb=_0x44699d;_0x4ace2e=_0x338ffb['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x3a58('0xe')][_0x3a58('0xf')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3a58('0xe')][_0x3a58('0x10')][_0x3a58('0x11')]});})[_0x3a58('0xd')](function(_0x4416a7){if(!_0x4416a7[0x0]['num']){return analyticExtractedReport(_0x3a58('0x12'));}var _0x45798b=[];var _0x1dd828=0x0;var _0x40f4be=!![];if(_0x338ffb['split']){if(_0x4416a7&&_0x4416a7['length']){var _0x1413d9=_0x4416a7[0x0][_0x3a58('0x13')]%(_0x1dd828+_0x4ace2e);for(;_0x40f4be;_0x1dd828+=_0x4ace2e,_0x1413d9=_0x4416a7[0x0][_0x3a58('0x13')]%(_0x1dd828+_0x4ace2e)){if(_0x1413d9==0x0||_0x1413d9==_0x4416a7[0x0][_0x3a58('0x13')]){_0x40f4be=![];}_0x45798b[_0x3a58('0x14')](dbH['sequelize']['query'](util[_0x3a58('0x15')](_0x3a58('0x16'),QUERY,_0x4ace2e,_0x1dd828),{'type':dbH[_0x3a58('0xe')][_0x3a58('0x10')][_0x3a58('0x11')]}));}}}else{_0x45798b[_0x3a58('0x14')](dbH[_0x3a58('0xe')][_0x3a58('0xf')](QUERY,{'type':dbH[_0x3a58('0xe')][_0x3a58('0x10')][_0x3a58('0x11')]}));}var _0x3f2136=path[_0x3a58('0x17')](PATH);var _0x531b03=path[_0x3a58('0x18')](PATH,_0x3a58('0x19'));var _0x269f9c=_0x338ffb['split']&&_0x45798b[_0x3a58('0x1a')]>0x1;var _0x5995f8=[];if(!fs['existsSync'](path[_0x3a58('0x1b')](_0x3f2136,_0x531b03))&&_0x269f9c){fs[_0x3a58('0x1c')](path[_0x3a58('0x1b')](_0x3f2136,_0x531b03));}return BPromise['each'](_0x45798b,function(_0x1b20d6){_0x5995f8[_0x3a58('0x14')](_0x1b20d6);})[_0x3a58('0xd')](function(){for(var _0x2d1742=0x0;_0x2d1742<_0x5995f8[_0x3a58('0x1a')];_0x2d1742+=0x1){var _0x57096b;var _0x4aae1f=_0x5995f8[_0x2d1742];if(_0x269f9c){_0x57096b=path[_0x3a58('0x1b')](_0x3f2136,_0x531b03,util[_0x3a58('0x15')](_0x3a58('0x1d'),_0x531b03,_0x2d1742,_0x3a58('0x1e')));}else{_0x57096b=path[_0x3a58('0x1b')](_0x3f2136,util[_0x3a58('0x15')](_0x3a58('0x1f'),_0x531b03,_0x3a58('0x1e')));}fs[_0x3a58('0x20')](_0x57096b,json2xls(_0x4aae1f),_0x3a58('0x21'));}})[_0x3a58('0xd')](function(){if(_0x269f9c){zipdir(path[_0x3a58('0x1b')](_0x3f2136,_0x531b03),{'saveTo':path[_0x3a58('0x1b')](_0x3f2136,util[_0x3a58('0x15')](_0x3a58('0x1f'),_0x531b03,'zip'))},function(_0x3bb095,_0x45bc88){});rimraf(path[_0x3a58('0x1b')](_0x3f2136,_0x531b03),function(){});}})[_0x3a58('0xd')](function(){return analyticExtractedReport('Completed',_0x269f9c?util[_0x3a58('0x15')]('%s.%s',_0x531b03,_0x269f9c?_0x3a58('0x22'):_0x3a58('0x1e')):null);});})[_0x3a58('0x23')](function(_0x4e930d){console[_0x3a58('0x24')](_0x4e930d);return analyticExtractedReport(_0x3a58('0x25'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 53846c9..7fd0a64 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 _0x1ae6=['appType','custom','Answer','Progress','record','MixMonitor','${UNIQUEID}.',',ab','recordingFormat','StopMixMonitor','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','uniq','map','exten','groupBy','queue','playback','hasOwnProperty','answer','progress','extensions','push','type','context','priority','format','VoiceExtensionId','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','filter','tag','Set','CDR(tag)=','callerID','CALLERID(all)=','indexOf','app','toLowerCase'];(function(_0x1577f9,_0x472ef2){var _0x19fd6c=function(_0xe6d9b2){while(--_0xe6d9b2){_0x1577f9['push'](_0x1577f9['shift']());}};_0x19fd6c(++_0x472ef2);}(_0x1ae6,0xc6));var _0x61ae=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x1ae6[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x61ae('0x0'));var util=require(_0x61ae('0x1'));function rewrite(_0x570c74,_0x2aa1b3){var _0x574f9c=this;return _0x570c74[_0x61ae('0x2')][_0x61ae('0x3')][_0x61ae('0x4')]({'raw':!![]})['then'](function(_0x46ef03){_0x574f9c['intervals']=_0x46ef03;return _0x570c74[_0x61ae('0x2')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x2aa1b3['IntervalId']},'raw':!![]});})[_0x61ae('0x5')](function(_0x4ae9d1){return _0x570c74[_0x61ae('0x2')][_0x61ae('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x61ae('0x7')](_[_0x61ae('0x8')](_0x4ae9d1,_0x61ae('0x9')))},'isApp':!![]},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x61ae('0x5')](function(_0x577674){var _0x2a94c5=_[_0x61ae('0xa')](_0x577674,_0x61ae('0x9'));var _0x38ff19=[_0x61ae('0xb'),_0x61ae('0xc')];var _0x393fbb=[];var _0x8d0063=[];for(var _0x46d844 in _0x2a94c5){if(_0x2a94c5[_0x61ae('0xd')](_0x46d844)){_0x574f9c[_0x61ae('0xe')]=![];_0x574f9c[_0x61ae('0xf')]=![];_0x574f9c['priority']=0x2;_0x574f9c['extensions']=[];_0x574f9c[_0x61ae('0x10')][_0x61ae('0x11')]({'type':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x12')],'context':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x13')],'exten':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x9')],'priority':_0x574f9c[_0x61ae('0x14')]++,'app':'Set','appdata':util[_0x61ae('0x15')]('CDR(type)=%s',_0x2a94c5[_0x46d844][0x0][_0x61ae('0x12')]),'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x16')]});for(var _0x5b68d1=0x0,_0x40afca=0x0;_0x5b68d1<_0x2a94c5[_0x46d844][_0x61ae('0x17')];_0x5b68d1+=0x1,_0x40afca=0x0){var _0x27b198=_0x2a94c5[_0x46d844][_0x5b68d1];var _0x41a85a=[];var _0x14da7b=[];delete _0x27b198['id'];delete _0x27b198[_0x61ae('0x18')];delete _0x27b198[_0x61ae('0x19')];var _0x31e823=_0x27b198[_0x61ae('0x1a')]!==_0x61ae('0x1b')?[_0x27b198['interval']]:_0x27b198[_0x61ae('0x1c')]?_[_0x61ae('0x8')](_[_0x61ae('0x1d')](_0x574f9c['intervals'],{'IntervalId':_0x27b198['IntervalId']}),_0x61ae('0x1a')):[];if(_0x27b198[_0x61ae('0xd')](_0x61ae('0x1e'))){if(_0x27b198['tag']&&_0x27b198[_0x61ae('0x1e')]!=='--'){_0x41a85a[_0x61ae('0x11')]({'type':_0x27b198[_0x61ae('0x12')],'app':_0x61ae('0x1f'),'appdata':_0x61ae('0x20')+_0x27b198['tag'],'context':_0x27b198['context'],'exten':_0x27b198['exten'],'priority':_0x31e823[_0x61ae('0x17')]+_0x574f9c[_0x61ae('0x14')]+_0x40afca++,'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0]['VoiceExtensionId']});}}if(_0x27b198[_0x61ae('0xd')](_0x61ae('0x21'))){if(_0x27b198[_0x61ae('0x21')]){_0x41a85a['push']({'type':_0x27b198['type'],'app':_0x61ae('0x1f'),'appdata':_0x61ae('0x22')+_0x27b198['callerID'],'context':_0x27b198[_0x61ae('0x13')],'exten':_0x27b198[_0x61ae('0x9')],'priority':_0x31e823[_0x61ae('0x17')]+_0x574f9c[_0x61ae('0x14')]+_0x40afca++,'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x16')]});}}if(_0x27b198[_0x61ae('0xd')](_0x61ae('0xe'))){if(_0x38ff19[_0x61ae('0x23')](_0x27b198[_0x61ae('0x24')][_0x61ae('0x25')]())>=0x0&&_0x27b198[_0x61ae('0x26')]!==_0x61ae('0x27')){if(!_0x574f9c[_0x61ae('0xe')]&&_0x27b198[_0x61ae('0xe')]){_0x574f9c['answer']=!![];_0x41a85a[_0x61ae('0x11')]({'type':_0x27b198['type'],'app':_0x61ae('0x28'),'context':_0x27b198['context'],'exten':_0x27b198[_0x61ae('0x9')],'priority':_0x31e823[_0x61ae('0x17')]+_0x574f9c[_0x61ae('0x14')]+_0x40afca++,'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0]['VoiceExtensionId']});}if(!_0x574f9c[_0x61ae('0xe')]&&!_0x574f9c['progress']&&!_0x27b198[_0x61ae('0xe')]){_0x574f9c[_0x61ae('0xf')]=!![];_0x41a85a[_0x61ae('0x11')]({'type':_0x27b198[_0x61ae('0x12')],'app':_0x61ae('0x29'),'context':_0x27b198['context'],'exten':_0x27b198['exten'],'priority':_0x31e823[_0x61ae('0x17')]+_0x574f9c[_0x61ae('0x14')]+_0x40afca++,'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x16')]});}}}if(_0x27b198['hasOwnProperty'](_0x61ae('0x2a'))&&_0x27b198[_0x61ae('0xd')]('recordingFormat')){if(_0x27b198['record']){_0x41a85a[_0x61ae('0x11')]({'type':_0x27b198['type'],'app':_0x61ae('0x2b'),'appdata':_0x61ae('0x2c')+_0x27b198['recordingFormat']+_0x61ae('0x2d'),'context':_0x27b198[_0x61ae('0x13')],'exten':_0x27b198[_0x61ae('0x9')],'priority':_0x31e823[_0x61ae('0x17')]+_0x574f9c[_0x61ae('0x14')]+_0x40afca++,'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x16')]});}}if(_0x27b198[_0x61ae('0xd')](_0x61ae('0x2a'))&&_0x27b198[_0x61ae('0xd')](_0x61ae('0x2e'))){if(_0x27b198[_0x61ae('0x2a')]){_0x14da7b[_0x61ae('0x11')]({'type':_0x27b198[_0x61ae('0x12')],'app':_0x61ae('0x2f'),'appdata':null,'context':_0x27b198[_0x61ae('0x13')],'exten':_0x27b198[_0x61ae('0x9')],'priority':_0x31e823['length']+_0x574f9c[_0x61ae('0x14')]+_0x40afca++ +0x1,'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0]['VoiceExtensionId']});}}for(var _0x44517a=0x0;_0x44517a<_0x31e823[_0x61ae('0x17')];_0x44517a+=0x1){var _0x1597f3=_0x574f9c[_0x61ae('0x14')]+_0x31e823[_0x61ae('0x17')];var _0x58e96a=_0x44517a===_0x31e823[_0x61ae('0x17')]-0x1?_0x574f9c['priority']+_0x41a85a[_0x61ae('0x17')]+_0x14da7b['length']+0x2:_0x574f9c[_0x61ae('0x14')]+_0x44517a+0x1;_0x41a85a['splice'](_0x44517a,0x0,{'type':_0x27b198['type'],'app':_0x61ae('0x30'),'appdata':_0x31e823[_0x44517a]+'?'+_0x27b198[_0x61ae('0x13')]+_0x61ae('0x31')+_0x1597f3+':'+_0x27b198[_0x61ae('0x13')]+',${EXTEN},'+_0x58e96a,'exten':_0x27b198['exten'],'context':_0x27b198[_0x61ae('0x13')],'priority':_0x574f9c[_0x61ae('0x14')]+_0x44517a,'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x16')]});}_0x27b198[_0x61ae('0x14')]=_0x41a85a[_0x61ae('0x17')]?_[_0x61ae('0x32')](_0x41a85a)[_0x61ae('0x14')]+0x1:_0x574f9c['priority'];_0x574f9c['priority']=(_0x14da7b[_0x61ae('0x17')]?_[_0x61ae('0x32')](_0x14da7b)[_0x61ae('0x14')]:_0x27b198[_0x61ae('0x14')])+0x1;_0x574f9c[_0x61ae('0x10')]=_[_0x61ae('0x33')](_0x574f9c['extensions'],_0x41a85a,[_0x27b198],_0x14da7b);}_0x574f9c['extensions'][_0x61ae('0x11')]({'type':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x12')],'app':'Hangup','exten':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x9')],'context':_0x2a94c5[_0x46d844][0x0][_0x61ae('0x13')],'priority':_0x574f9c[_0x61ae('0x14')],'VoiceExtensionId':_0x2a94c5[_0x46d844][0x0]['VoiceExtensionId']});_0x393fbb[_0x61ae('0x11')](_0x2a94c5[_0x46d844][0x0]['VoiceExtensionId']);_0x8d0063=_[_0x61ae('0x33')](_0x8d0063,_0x574f9c[_0x61ae('0x10')]);}}return _0x570c74[_0x61ae('0x34')](function(_0x4a96fe){return _0x570c74['models'][_0x61ae('0x6')][_0x61ae('0x35')]({'where':{'VoiceExtensionId':{'$in':_0x393fbb}},'transaction':_0x4a96fe})['then'](function(_0x14154b){return _0x570c74['models'][_0x61ae('0x6')][_0x61ae('0x36')](_[_0x61ae('0x37')](_0x8d0063,_0x61ae('0x14')),{'transaction':_0x4a96fe});});});})[_0x61ae('0x38')](function(_0x53b865){console[_0x61ae('0x39')](_0x53b865);});}exports[_0x61ae('0x3a')]=rewrite; \ No newline at end of file +var _0x2237=['filter','tag','push','CDR(tag)=','callerID','CALLERID(all)=','VoiceExtensionId','indexOf','toLowerCase','appType','custom','Progress','record','recordingFormat','MixMonitor','${UNIQUEID}.',',ab','StopMixMonitor','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','IntervalId','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','hasOwnProperty','answer','progress','priority','extensions','type','context','Set','format','CDR(type)=%s','length','interval','*,*,*,*','map'];(function(_0x30317a,_0x4cfd9a){var _0x581a8b=function(_0x1b2ac){while(--_0x1b2ac){_0x30317a['push'](_0x30317a['shift']());}};_0x581a8b(++_0x4cfd9a);}(_0x2237,0x175));var _0x7223=function(_0xc8dec2,_0x5b3b90){_0xc8dec2=_0xc8dec2-0x0;var _0x1a3fb0=_0x2237[_0xc8dec2];return _0x1a3fb0;};'use strict';var _=require(_0x7223('0x0'));var util=require(_0x7223('0x1'));function rewrite(_0x53e9f2,_0x4c66c2){var _0x35742e=this;return _0x53e9f2[_0x7223('0x2')]['Interval'][_0x7223('0x3')]({'raw':!![]})[_0x7223('0x4')](function(_0x262e7f){_0x35742e['intervals']=_0x262e7f;return _0x53e9f2[_0x7223('0x2')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x4c66c2[_0x7223('0x5')]},'raw':!![]});})[_0x7223('0x4')](function(_0x31f7e2){return _0x53e9f2['models'][_0x7223('0x6')][_0x7223('0x3')]({'where':{'exten':{'$in':_[_0x7223('0x7')](_['map'](_0x31f7e2,_0x7223('0x8')))},'isApp':!![]},'order':[{'raw':_0x7223('0x9')}],'raw':!![]});})[_0x7223('0x4')](function(_0x2fd0df){var _0x32ccca=_[_0x7223('0xa')](_0x2fd0df,'exten');var _0x5f1f73=[_0x7223('0xb'),'playback'];var _0x18a4cc=[];var _0x550b13=[];for(var _0x98b8cf in _0x32ccca){if(_0x32ccca[_0x7223('0xc')](_0x98b8cf)){_0x35742e[_0x7223('0xd')]=![];_0x35742e[_0x7223('0xe')]=![];_0x35742e[_0x7223('0xf')]=0x2;_0x35742e['extensions']=[];_0x35742e[_0x7223('0x10')]['push']({'type':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x11')],'context':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x12')],'exten':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x8')],'priority':_0x35742e[_0x7223('0xf')]++,'app':_0x7223('0x13'),'appdata':util[_0x7223('0x14')](_0x7223('0x15'),_0x32ccca[_0x98b8cf][0x0]['type']),'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0]['VoiceExtensionId']});for(var _0x3598e8=0x0,_0x1b92a5=0x0;_0x3598e8<_0x32ccca[_0x98b8cf][_0x7223('0x16')];_0x3598e8+=0x1,_0x1b92a5=0x0){var _0x4aac60=_0x32ccca[_0x98b8cf][_0x3598e8];var _0x3f2a2f=[];var _0x2d4148=[];delete _0x4aac60['id'];delete _0x4aac60['createdAt'];delete _0x4aac60['updatedAt'];var _0x4d4d57=_0x4aac60[_0x7223('0x17')]!==_0x7223('0x18')?[_0x4aac60[_0x7223('0x17')]]:_0x4aac60[_0x7223('0x5')]?_[_0x7223('0x19')](_[_0x7223('0x1a')](_0x35742e['intervals'],{'IntervalId':_0x4aac60[_0x7223('0x5')]}),_0x7223('0x17')):[];if(_0x4aac60[_0x7223('0xc')](_0x7223('0x1b'))){if(_0x4aac60[_0x7223('0x1b')]&&_0x4aac60['tag']!=='--'){_0x3f2a2f[_0x7223('0x1c')]({'type':_0x4aac60[_0x7223('0x11')],'app':_0x7223('0x13'),'appdata':_0x7223('0x1d')+_0x4aac60['tag'],'context':_0x4aac60[_0x7223('0x12')],'exten':_0x4aac60[_0x7223('0x8')],'priority':_0x4d4d57[_0x7223('0x16')]+_0x35742e[_0x7223('0xf')]+_0x1b92a5++,'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0]['VoiceExtensionId']});}}if(_0x4aac60[_0x7223('0xc')](_0x7223('0x1e'))){if(_0x4aac60['callerID']){_0x3f2a2f[_0x7223('0x1c')]({'type':_0x4aac60['type'],'app':'Set','appdata':_0x7223('0x1f')+_0x4aac60[_0x7223('0x1e')],'context':_0x4aac60[_0x7223('0x12')],'exten':_0x4aac60[_0x7223('0x8')],'priority':_0x4d4d57[_0x7223('0x16')]+_0x35742e[_0x7223('0xf')]+_0x1b92a5++,'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x20')]});}}if(_0x4aac60[_0x7223('0xc')]('answer')){if(_0x5f1f73[_0x7223('0x21')](_0x4aac60['app'][_0x7223('0x22')]())>=0x0&&_0x4aac60[_0x7223('0x23')]!==_0x7223('0x24')){if(!_0x35742e[_0x7223('0xd')]&&_0x4aac60[_0x7223('0xd')]){_0x35742e[_0x7223('0xd')]=!![];_0x3f2a2f[_0x7223('0x1c')]({'type':_0x4aac60[_0x7223('0x11')],'app':'Answer','context':_0x4aac60[_0x7223('0x12')],'exten':_0x4aac60['exten'],'priority':_0x4d4d57[_0x7223('0x16')]+_0x35742e[_0x7223('0xf')]+_0x1b92a5++,'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x20')]});}if(!_0x35742e[_0x7223('0xd')]&&!_0x35742e['progress']&&!_0x4aac60[_0x7223('0xd')]){_0x35742e[_0x7223('0xe')]=!![];_0x3f2a2f[_0x7223('0x1c')]({'type':_0x4aac60[_0x7223('0x11')],'app':_0x7223('0x25'),'context':_0x4aac60[_0x7223('0x12')],'exten':_0x4aac60[_0x7223('0x8')],'priority':_0x4d4d57[_0x7223('0x16')]+_0x35742e['priority']+_0x1b92a5++,'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x20')]});}}}if(_0x4aac60[_0x7223('0xc')](_0x7223('0x26'))&&_0x4aac60['hasOwnProperty'](_0x7223('0x27'))){if(_0x4aac60[_0x7223('0x26')]){_0x3f2a2f[_0x7223('0x1c')]({'type':_0x4aac60['type'],'app':_0x7223('0x28'),'appdata':_0x7223('0x29')+_0x4aac60[_0x7223('0x27')]+_0x7223('0x2a'),'context':_0x4aac60[_0x7223('0x12')],'exten':_0x4aac60[_0x7223('0x8')],'priority':_0x4d4d57[_0x7223('0x16')]+_0x35742e[_0x7223('0xf')]+_0x1b92a5++,'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x20')]});}}if(_0x4aac60['hasOwnProperty'](_0x7223('0x26'))&&_0x4aac60[_0x7223('0xc')](_0x7223('0x27'))){if(_0x4aac60[_0x7223('0x26')]){_0x2d4148[_0x7223('0x1c')]({'type':_0x4aac60['type'],'app':_0x7223('0x2b'),'appdata':null,'context':_0x4aac60[_0x7223('0x12')],'exten':_0x4aac60[_0x7223('0x8')],'priority':_0x4d4d57[_0x7223('0x16')]+_0x35742e[_0x7223('0xf')]+_0x1b92a5++ +0x1,'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0]['VoiceExtensionId']});}}for(var _0x58afd3=0x0;_0x58afd3<_0x4d4d57[_0x7223('0x16')];_0x58afd3+=0x1){var _0x219821=_0x35742e[_0x7223('0xf')]+_0x4d4d57['length'];var _0x47c91d=_0x58afd3===_0x4d4d57[_0x7223('0x16')]-0x1?_0x35742e[_0x7223('0xf')]+_0x3f2a2f[_0x7223('0x16')]+_0x2d4148[_0x7223('0x16')]+0x2:_0x35742e[_0x7223('0xf')]+_0x58afd3+0x1;_0x3f2a2f[_0x7223('0x2c')](_0x58afd3,0x0,{'type':_0x4aac60[_0x7223('0x11')],'app':_0x7223('0x2d'),'appdata':_0x4d4d57[_0x58afd3]+'?'+_0x4aac60[_0x7223('0x12')]+_0x7223('0x2e')+_0x219821+':'+_0x4aac60[_0x7223('0x12')]+_0x7223('0x2e')+_0x47c91d,'exten':_0x4aac60['exten'],'context':_0x4aac60[_0x7223('0x12')],'priority':_0x35742e['priority']+_0x58afd3,'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x20')]});}_0x4aac60[_0x7223('0xf')]=_0x3f2a2f[_0x7223('0x16')]?_[_0x7223('0x2f')](_0x3f2a2f)[_0x7223('0xf')]+0x1:_0x35742e[_0x7223('0xf')];_0x35742e['priority']=(_0x2d4148[_0x7223('0x16')]?_[_0x7223('0x2f')](_0x2d4148)[_0x7223('0xf')]:_0x4aac60[_0x7223('0xf')])+0x1;_0x35742e[_0x7223('0x10')]=_[_0x7223('0x30')](_0x35742e[_0x7223('0x10')],_0x3f2a2f,[_0x4aac60],_0x2d4148);}_0x35742e[_0x7223('0x10')][_0x7223('0x1c')]({'type':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x11')],'app':_0x7223('0x31'),'exten':_0x32ccca[_0x98b8cf][0x0][_0x7223('0x8')],'context':_0x32ccca[_0x98b8cf][0x0]['context'],'priority':_0x35742e[_0x7223('0xf')],'VoiceExtensionId':_0x32ccca[_0x98b8cf][0x0]['VoiceExtensionId']});_0x18a4cc[_0x7223('0x1c')](_0x32ccca[_0x98b8cf][0x0]['VoiceExtensionId']);_0x550b13=_[_0x7223('0x30')](_0x550b13,_0x35742e[_0x7223('0x10')]);}}return _0x53e9f2[_0x7223('0x32')](function(_0xbf2625){return _0x53e9f2['models'][_0x7223('0x6')][_0x7223('0x33')]({'where':{'VoiceExtensionId':{'$in':_0x18a4cc}},'transaction':_0xbf2625})[_0x7223('0x4')](function(_0x482598){return _0x53e9f2['models'][_0x7223('0x6')][_0x7223('0x34')](_[_0x7223('0x35')](_0x550b13,'priority'),{'transaction':_0xbf2625});});});})[_0x7223('0x36')](function(_0x1e564d){console[_0x7223('0x37')](_0x1e564d);});}exports[_0x7223('0x38')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a624165..d49b073 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 _0xd3d1=['VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','push','all','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','../../../mysqldb','util','lodash','squel','papaparse','socket.io-emitter','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','phone','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','length','find','duplicate','Duplicate\x20Contact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper','id\x20IN\x20?','str','calleridnum','cm_hopper_final'];(function(_0x1832ab,_0x9adc41){var _0x488011=function(_0x22a778){while(--_0x22a778){_0x1832ab['push'](_0x1832ab['shift']());}};_0x488011(++_0x9adc41);}(_0xd3d1,0x172));var _0x1d3d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd3d1[_0x2be8c2];return _0x97f531;};'use strict';var BPromise=require(_0x1d3d('0x0'));var db=require(_0x1d3d('0x1'))['db'];var logger=require('../../../config/logger')('api');var util=require(_0x1d3d('0x2'));var _=require(_0x1d3d('0x3'));var fs=require('fs');var squel=require(_0x1d3d('0x4'));var Papa=require(_0x1d3d('0x5'));var socket=require(_0x1d3d('0x6'))({'host':_0x1d3d('0x7'),'port':0x18eb});require(_0x1d3d('0x8'))[_0x1d3d('0x9')](socket);try{if(!process[_0x1d3d('0xa')][0x2]||process[_0x1d3d('0xa')][0x2]===_0x1d3d('0xb')||process[_0x1d3d('0xa')][0x2]===_0x1d3d('0xc')){throw new Error(_0x1d3d('0xd'));}var FILEPATH=process[_0x1d3d('0xa')][0x2];if(!process[_0x1d3d('0xa')][0x3]||process[_0x1d3d('0xa')][0x3]==='undefined'||process[_0x1d3d('0xa')][0x3]===_0x1d3d('0xc')||!process[_0x1d3d('0xa')][0x4]||process[_0x1d3d('0xa')][0x4]===_0x1d3d('0xb')||process[_0x1d3d('0xa')][0x4]===_0x1d3d('0xc')){throw new Error(_0x1d3d('0xe'));}var FIELDS=_[_0x1d3d('0xf')](process[_0x1d3d('0xa')][0x3][_0x1d3d('0x10')](','),process['argv'][0x4][_0x1d3d('0x10')](','));if(!process[_0x1d3d('0xa')][0x5]||process['argv'][0x5]==='undefined'||process[_0x1d3d('0xa')][0x5]===_0x1d3d('0xc')){throw new Error(_0x1d3d('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1d3d('0xa')][0x6]&&process['argv'][0x6]!==_0x1d3d('0xb')&&process[_0x1d3d('0xa')][0x6]!==_0x1d3d('0xc')?process[_0x1d3d('0xa')][0x6]:null;var DUPLICATES=process[_0x1d3d('0xa')][0x7]&&process[_0x1d3d('0xa')][0x7]!==_0x1d3d('0xb')&&process['argv'][0x7]!=='null'?process[_0x1d3d('0xa')][0x7]:null;if(!process[_0x1d3d('0xa')][0x8]||process['argv'][0x8]===_0x1d3d('0xb')||process['argv'][0x8]===_0x1d3d('0xc')){throw new Error(_0x1d3d('0x12'));}var SOCKET_TIMESTAMP=process[_0x1d3d('0xa')][0x8];}catch(_0x2d6dfb){logger['error'](_0x2d6dfb);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(_0x2b77ee,_0x56db7a,_0x56c424,_0x108005){var _0x2bfac3={'message':_0x56db7a};_0x2bfac3[_0x2b77ee]=!![];if(_0x56c424){_0x2bfac3[_0x1d3d('0x13')]=_0x56c424;}if(_0x108005){_0x2bfac3[_0x1d3d('0x14')]=_0x108005;}return _0x2bfac3;}function isEmail(_0xa6f180){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))*$/[_0x1d3d('0x15')](_0xa6f180);}function checkRow(_0x471df5,_0xa55c43,_0x270b90){return new BPromise(function(_0x18f234,_0x1610a6){if(_['isNil'](_0x471df5)){return _0x1610a6(handleCheckRowError(_0x1d3d('0x16'),_0x1d3d('0x17'),null,_0x270b90));}if(_0x471df5['errors']&&_0x471df5[_0x1d3d('0x18')]['length']){var _0x467ea7=_[_0x1d3d('0x19')](_0x471df5[_0x1d3d('0x18')],_0x1d3d('0x1a'))[_0x1d3d('0x1b')](';');return _0x1610a6(handleCheckRowError(_0x1d3d('0x16'),_0x467ea7,null,_0x270b90));}var _0x2b8074={};for(var _0x298fd3 in FIELDS){if(FIELDS[_0x1d3d('0x1c')](_0x298fd3)&&FIELDS[_0x298fd3]){_0x2b8074[_0x298fd3]=_0x471df5[_0x1d3d('0x1d')][0x0][FIELDS[_0x298fd3]]||_0x471df5[_0x1d3d('0x1d')][0x0]['\ufeff'+FIELDS[_0x298fd3]];}}if(!_0x2b8074['firstName']){return _0x1610a6(handleCheckRowError(_0x1d3d('0x16'),'firstName\x20not\x20specified!',null,_0x270b90));}if(!_0x2b8074[_0x1d3d('0x1e')]){return _0x1610a6(handleCheckRowError(_0x1d3d('0x16'),'phone\x20not\x20specified!',null,_0x270b90));}if(_0x2b8074[_0x1d3d('0x1f')]){var _0x16b7b3=moment(_0x2b8074[_0x1d3d('0x1f')],_0x1d3d('0x20'));if(!_0x16b7b3['isValid']()){return _0x1610a6(handleCheckRowError(_0x1d3d('0x16'),_0x1d3d('0x21'),null,_0x270b90));}}if(_0x2b8074['email']){if(!isEmail(_0x2b8074[_0x1d3d('0x22')])){return _0x1610a6(handleCheckRowError('error',_0x1d3d('0x23'),null,_0x270b90));}}_0x2b8074[_0x1d3d('0x24')]=LISTID;_0x2b8074['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1d3d('0x25')]&&_0xa55c43){var _0x192f60={};for(var _0x102b70=0x0,_0x250b03=DUPLICATES[_0x1d3d('0x25')];_0x102b70<_0x250b03;_0x102b70+=0x1){_0x192f60[DUPLICATES[_0x102b70]]=_0x2b8074[DUPLICATES[_0x102b70]];}var _0x462628=_[_0x1d3d('0x26')](_0xa55c43,_0x192f60);if(_0x462628){return _0x1610a6(handleCheckRowError(_0x1d3d('0x27'),_0x1d3d('0x28'),_0x462628,_0x270b90));}}return db['CmContact'][_0x1d3d('0x29')](_0x2b8074,{'raw':!![],'hooks':![],'fields':_[_0x1d3d('0x2a')](_0x2b8074)})[_0x1d3d('0x2b')](function(_0x253e9b){if(DUPLICATES&&DUPLICATES['length']&&_0xa55c43){_0xa55c43['push'](_[_0x1d3d('0x2c')](_0x2b8074,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x253e9b['id'];return _0x18f234();})[_0x1d3d('0x2d')](function(_0x47a8e3){return _0x1610a6(handleCheckRowError(_0x1d3d('0x16'),_0x1d3d('0x2e')+(_0x47a8e3[_0x1d3d('0x1a')]||JSON[_0x1d3d('0x2f')](_0x47a8e3)),null,_0x270b90));});});}function checkHopper(){function _0x5d906d(){return function(_0x5ad85b){logger[_0x1d3d('0x16')]('cmContact',_0x1d3d('0x30'),util[_0x1d3d('0x31')](_0x5ad85b,{'showHidden':![],'depth':null}));};}var _0x3574d7=function(_0x318dd3,_0xbe316){var _0x195e3e=squel[_0x1d3d('0x32')]()[_0x1d3d('0x33')]('cm_hopper')[_0x1d3d('0x34')](['phone',_0x1d3d('0x35'),_0x1d3d('0x36'),'ListId',_0xbe316,_0x1d3d('0x37'),_0x1d3d('0x38')],squel[_0x1d3d('0x39')]()[_0x1d3d('0x3a')]('phone','phone')[_0x1d3d('0x3a')]('NOW()',_0x1d3d('0x35'))[_0x1d3d('0x3a')]('id','ContactId')[_0x1d3d('0x3a')](LISTID[_0x1d3d('0x3b')](),'ListId')[_0x1d3d('0x3a')](_0x318dd3['id'][_0x1d3d('0x3b')](),_0xbe316)[_0x1d3d('0x3a')](_0x1d3d('0x3c'),_0x1d3d('0x37'))[_0x1d3d('0x3a')]('NOW()',_0x1d3d('0x38'))[_0x1d3d('0x3d')](_0x1d3d('0x3e'))[_0x1d3d('0x3f')](_0x1d3d('0x40'))['where'](_0x1d3d('0x41'),LISTID[_0x1d3d('0x3b')]())[_0x1d3d('0x3f')](_0x1d3d('0x42'))['where'](_0x1d3d('0x43'),squel[_0x1d3d('0x39')]()[_0x1d3d('0x3a')](_0x1d3d('0x1e'))[_0x1d3d('0x3d')]('cm_hopper')['where'](_0xbe316+_0x1d3d('0x44'),_0x318dd3['id'][_0x1d3d('0x3b')]())))[_0x1d3d('0x3b')]();return _0x195e3e;};var _0x66efd=function(_0x6f655c,_0x5c87c6){var _0x7560fe=squel['insert']()[_0x1d3d('0x33')](_0x1d3d('0x45'))[_0x1d3d('0x34')]([_0x1d3d('0x1e'),'scheduledAt',_0x1d3d('0x36'),_0x1d3d('0x24'),_0x5c87c6,_0x1d3d('0x37'),_0x1d3d('0x38')],squel[_0x1d3d('0x39')]()[_0x1d3d('0x3a')](_0x1d3d('0x1e'),'phone')[_0x1d3d('0x3a')]('NOW()',_0x1d3d('0x35'))[_0x1d3d('0x3a')]('id','ContactId')[_0x1d3d('0x3a')](LISTID['toString'](),_0x1d3d('0x24'))['field'](_0x6f655c['id'][_0x1d3d('0x3b')](),_0x5c87c6)[_0x1d3d('0x3a')](_0x1d3d('0x3c'),_0x1d3d('0x37'))[_0x1d3d('0x3a')](_0x1d3d('0x3c'),_0x1d3d('0x38'))[_0x1d3d('0x3d')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x1d3d('0x3f')](_0x1d3d('0x41'),LISTID[_0x1d3d('0x3b')]())[_0x1d3d('0x3f')](_0x1d3d('0x46'),squel[_0x1d3d('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1d3d('0x39')]()[_0x1d3d('0x3a')](_0x1d3d('0x48'))[_0x1d3d('0x3d')](_0x1d3d('0x49'))[_0x1d3d('0x3f')](_0x5c87c6+_0x1d3d('0x44'),_0x6f655c['id'][_0x1d3d('0x3b')]()))[_0x1d3d('0x3f')](_0x1d3d('0x43'),squel[_0x1d3d('0x39')]()[_0x1d3d('0x3a')](_0x1d3d('0x1e'))[_0x1d3d('0x3d')](_0x1d3d('0x45'))['where'](_0x5c87c6+_0x1d3d('0x44'),_0x6f655c['id'][_0x1d3d('0x3b')]())))[_0x1d3d('0x3b')]();return _0x7560fe;};function _0xcfc9c7(_0x502f6c,_0x41930f){var _0x4973b4=squel['insert']()[_0x1d3d('0x33')](_0x1d3d('0x45'))['fromQuery']([_0x1d3d('0x1e'),_0x1d3d('0x35'),'ContactId',_0x1d3d('0x24'),_0x41930f,_0x1d3d('0x37'),_0x1d3d('0x38')],squel[_0x1d3d('0x39')]()[_0x1d3d('0x3a')](_0x1d3d('0x1e'),_0x1d3d('0x1e'))[_0x1d3d('0x3a')](_0x1d3d('0x3c'),'scheduledAt')[_0x1d3d('0x3a')]('id','ContactId')['field'](LISTID['toString'](),'ListId')[_0x1d3d('0x3a')](_0x502f6c['id'][_0x1d3d('0x3b')](),_0x41930f)[_0x1d3d('0x3a')](_0x1d3d('0x3c'),'createdAt')[_0x1d3d('0x3a')]('NOW()',_0x1d3d('0x38'))[_0x1d3d('0x3d')]('cm_contacts')[_0x1d3d('0x3f')](_0x1d3d('0x40'))['where'](_0x1d3d('0x41'),LISTID[_0x1d3d('0x3b')]())[_0x1d3d('0x3f')](_0x1d3d('0x46'),squel[_0x1d3d('0x47')](hopperContacts))[_0x1d3d('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x1d3d('0x3b')]();return _0x4973b4;}function _0x31b07c(_0x1ea7ce,_0x1183c0){var _0x35e53e=squel['insert']()[_0x1d3d('0x33')]('cm_hopper_black')[_0x1d3d('0x34')](['phone',_0x1d3d('0x36'),_0x1d3d('0x24'),_0x1183c0,_0x1d3d('0x37'),_0x1d3d('0x38')],squel[_0x1d3d('0x39')]()[_0x1d3d('0x3a')](_0x1d3d('0x1e'),'phone')[_0x1d3d('0x3a')]('id',_0x1d3d('0x36'))[_0x1d3d('0x3a')](LISTID[_0x1d3d('0x3b')](),_0x1d3d('0x24'))[_0x1d3d('0x3a')](_0x1ea7ce['id']['toString'](),_0x1183c0)[_0x1d3d('0x3a')](_0x1d3d('0x3c'),_0x1d3d('0x37'))[_0x1d3d('0x3a')](_0x1d3d('0x3c'),'updatedAt')[_0x1d3d('0x3d')](_0x1d3d('0x3e'))[_0x1d3d('0x3f')]('deletedAt\x20IS\x20NULL')[_0x1d3d('0x3f')]('ListId\x20=\x20?',LISTID[_0x1d3d('0x3b')]())['where'](_0x1d3d('0x46'),squel[_0x1d3d('0x47')](hopperContacts))[_0x1d3d('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x1d3d('0x3b')]();return _0x35e53e;}return db[_0x1d3d('0x4a')][_0x1d3d('0x4b')]({'where':{'type':'outbound'},'attributes':['id',_0x1d3d('0x4c')],'include':[{'model':db[_0x1d3d('0x4d')],'as':_0x1d3d('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x336263){var _0x31672e=[];if(_0x336263){var _0x37667d;for(var _0x411cb0=0x0,_0x107494;_0x411cb0<_0x336263['length'];_0x411cb0+=0x1){_0x107494=_0x336263[_0x411cb0][_0x1d3d('0x4f')]({'plain':!![]});switch(_0x107494[_0x1d3d('0x4c')]){case _0x1d3d('0x50'):_0x31672e['push'](db[_0x1d3d('0x51')][_0x1d3d('0x52')](_0x66efd(_0x107494,_0x1d3d('0x53')))[_0x1d3d('0x2b')](function(){})[_0x1d3d('0x2d')](_0x5d906d()));break;case'onlyIfOpen':_0x31672e[_0x1d3d('0x54')](db[_0x1d3d('0x51')]['query'](_0x3574d7(_0x107494,_0x1d3d('0x53')))[_0x1d3d('0x2b')](function(){})['catch'](_0x5d906d()));break;default:_0x31672e[_0x1d3d('0x54')](db[_0x1d3d('0x51')][_0x1d3d('0x52')](_0xcfc9c7(_0x107494,_0x1d3d('0x53')))['then'](function(){})[_0x1d3d('0x2d')](_0x5d906d()));}}}return _0x31672e;})[_0x1d3d('0x55')]()[_0x1d3d('0x2b')](function(){return db[_0x1d3d('0x4a')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x1d3d('0x4d')],'as':_0x1d3d('0x56'),'where':{'id':LISTID}}]})[_0x1d3d('0x2b')](function(_0x14e615){var _0x3645b2=[];if(_0x14e615){var _0x33a3f3;for(var _0x19f00b=0x0,_0x4d3e35;_0x19f00b<_0x14e615[_0x1d3d('0x25')];_0x19f00b+=0x1){_0x4d3e35=_0x14e615[_0x19f00b][_0x1d3d('0x4f')]({'plain':!![]});_0x3645b2['push'](db[_0x1d3d('0x51')][_0x1d3d('0x52')](_0x31b07c(_0x4d3e35,_0x1d3d('0x53')))['then'](function(){})[_0x1d3d('0x2d')](_0x5d906d()));}}return _0x3645b2;})[_0x1d3d('0x55')]();})[_0x1d3d('0x2b')](function(){return db[_0x1d3d('0x57')]['findAll']({'attributes':['id',_0x1d3d('0x4c')],'include':[{'model':db[_0x1d3d('0x4d')],'as':_0x1d3d('0x4e'),'where':{'id':LISTID}}]})[_0x1d3d('0x2b')](function(_0x58c51a){var _0xc2c9e2=[];if(_0x58c51a){for(var _0x9a0a16=0x0,_0x17081a;_0x9a0a16<_0x58c51a['length'];_0x9a0a16+=0x1){_0x17081a=_0x58c51a[_0x9a0a16][_0x1d3d('0x4f')]({'plain':!![]});switch(_0x17081a[_0x1d3d('0x4c')]){case'always':_0xc2c9e2[_0x1d3d('0x54')](db['sequelize'][_0x1d3d('0x52')](_0x66efd(_0x17081a,_0x1d3d('0x58')))['then'](function(){})['catch'](_0x5d906d()));break;case _0x1d3d('0x59'):_0xc2c9e2[_0x1d3d('0x54')](db['sequelize'][_0x1d3d('0x52')](_0x3574d7(_0x17081a,_0x1d3d('0x58')))[_0x1d3d('0x2b')](function(){})[_0x1d3d('0x2d')](_0x5d906d()));break;default:_0xc2c9e2['push'](db[_0x1d3d('0x51')][_0x1d3d('0x52')](_0xcfc9c7(_0x17081a,_0x1d3d('0x58')))['then'](function(){})[_0x1d3d('0x2d')](_0x5d906d()));}}}return _0xc2c9e2;})[_0x1d3d('0x55')]();})[_0x1d3d('0x2b')](function(){return db['Campaign'][_0x1d3d('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x1d3d('0x4d')],'as':_0x1d3d('0x56'),'where':{'id':LISTID}}]})[_0x1d3d('0x2b')](function(_0x1f9d7e){var _0x2926e0=[];if(_0x1f9d7e){for(var _0x516cb9=0x0,_0x1dd488;_0x516cb9<_0x1f9d7e[_0x1d3d('0x25')];_0x516cb9+=0x1){_0x1dd488=_0x1f9d7e[_0x516cb9]['get']({'plain':!![]});_0x2926e0[_0x1d3d('0x54')](db[_0x1d3d('0x51')][_0x1d3d('0x52')](_0x31b07c(_0x1dd488,'CampaignId'))[_0x1d3d('0x2b')](function(){})['catch'](_0x5d906d()));}}return _0x2926e0;})['all']();})['catch'](function(_0x451410){logger['error'](_0x1d3d('0x5a'),_0x1d3d('0x5b'),_0x451410[_0x1d3d('0x1a')]);});}var processPromises=function(_0x175e7f){return BPromise['all'](promises)['then'](function(_0x2abd7e){})[_0x1d3d('0x2d')](function(_0x5dc159){logger[_0x1d3d('0x16')](_0x1d3d('0x5c'),JSON['stringify'](_0x5dc159));})[_0x1d3d('0x5d')](function(){socket[_0x1d3d('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x175e7f){return _0x175e7f[_0x1d3d('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x1d3d('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x1d3d('0x2b')](function(){socket[_0x1d3d('0x5e')](_0x1d3d('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1d3d('0x61')](FILEPATH);}catch(_0x47fef2){logger[_0x1d3d('0x16')](_0x1d3d('0x62'),JSON[_0x1d3d('0x2f')](_0x47fef2));}finally{process[_0x1d3d('0x63')](0x0);}});};process['on'](_0x1d3d('0x64'),function(){logger[_0x1d3d('0x65')](_0x1d3d('0x66'));endCsv();});function main(){return BPromise[_0x1d3d('0x67')]()[_0x1d3d('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1d3d('0x10')](',');return db[_0x1d3d('0x68')][_0x1d3d('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x8054f9){var _0x5f138c=fs[_0x1d3d('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1d3d('0x6a')](_0x5f138c,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a8a53,_0x1d5518){total+=0x1;var _0x410d43=total;promises[_0x1d3d('0x54')](checkRow(_0x3a8a53,_0x8054f9,_0x410d43)[_0x1d3d('0x2b')](function(){success+=0x1;})[_0x1d3d('0x2d')](function(_0x264c82){if(_0x264c82['error']){errors+=0x1;delete _0x264c82['error'];}else if(_0x264c82['duplicate']){duplicates+=0x1;delete _0x264c82[_0x1d3d('0x27')];}rows['push'](_0x264c82);}));if(total%0xc8===0x0){_0x1d5518[_0x1d3d('0x6b')]();return processPromises(_0x1d5518);}},'complete':function(){return processPromises()['then'](function(){logger[_0x1d3d('0x65')](_0x1d3d('0x6c'));endCsv();});},'error':function(_0x376dc9,_0x3657ce){logger['info'](_0x1d3d('0x6d'),JSON[_0x1d3d('0x2f')](_0x376dc9));endCsv();}});})[_0x1d3d('0x2d')](function(_0x24f238){logger['error'](_0x1d3d('0x6e'),JSON[_0x1d3d('0x2f')](_0x24f238));});}main(); \ No newline at end of file +var _0xee5b=['email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','updatedAt','select','field','ContactId','toString','NOW()','createdAt','from','cm_contacts','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','ListId\x20=\x20?','id\x20IN\x20?','VoiceQueue','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','get','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','../../../config/logger','api','lodash','squel','papaparse','socket.io-emitter','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!'];(function(_0x150ee9,_0x3b68ed){var _0x5d41dc=function(_0x343012){while(--_0x343012){_0x150ee9['push'](_0x150ee9['shift']());}};_0x5d41dc(++_0x3b68ed);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3d0622,_0xc6e701){_0x3d0622=_0x3d0622-0x0;var _0x3838bb=_0xee5b[_0x3d0622];return _0x3838bb;};'use strict';var BPromise=require(_0xbee5('0x0'));var db=require('../../../mysqldb')['db'];var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var util=require('util');var _=require(_0xbee5('0x3'));var fs=require('fs');var squel=require(_0xbee5('0x4'));var Papa=require(_0xbee5('0x5'));var socket=require(_0xbee5('0x6'))({'host':'localhost','port':0x18eb});require('../../../api/cmContact/cmContact.socket')[_0xbee5('0x7')](socket);try{if(!process[_0xbee5('0x8')][0x2]||process[_0xbee5('0x8')][0x2]===_0xbee5('0x9')||process['argv'][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xbee5('0x8')][0x3]===_0xbee5('0x9')||process[_0xbee5('0x8')][0x3]===_0xbee5('0xa')||!process['argv'][0x4]||process[_0xbee5('0x8')][0x4]===_0xbee5('0x9')||process[_0xbee5('0x8')][0x4]===_0xbee5('0xa')){throw new Error(_0xbee5('0xb'));}var FIELDS=_[_0xbee5('0xc')](process[_0xbee5('0x8')][0x3][_0xbee5('0xd')](','),process[_0xbee5('0x8')][0x4]['split'](','));if(!process[_0xbee5('0x8')][0x5]||process['argv'][0x5]===_0xbee5('0x9')||process[_0xbee5('0x8')][0x5]===_0xbee5('0xa')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xbee5('0x8')][0x6]&&process['argv'][0x6]!==_0xbee5('0x9')&&process['argv'][0x6]!==_0xbee5('0xa')?process[_0xbee5('0x8')][0x6]:null;var DUPLICATES=process[_0xbee5('0x8')][0x7]&&process['argv'][0x7]!==_0xbee5('0x9')&&process[_0xbee5('0x8')][0x7]!=='null'?process[_0xbee5('0x8')][0x7]:null;if(!process[_0xbee5('0x8')][0x8]||process[_0xbee5('0x8')][0x8]===_0xbee5('0x9')||process[_0xbee5('0x8')][0x8]===_0xbee5('0xa')){throw new Error(_0xbee5('0xe'));}var SOCKET_TIMESTAMP=process[_0xbee5('0x8')][0x8];}catch(_0x20cf52){logger[_0xbee5('0xf')](_0x20cf52);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(_0x3d49b0,_0x117f10,_0x35d7d3,_0x40a06){var _0x450824={'message':_0x117f10};_0x450824[_0x3d49b0]=!![];if(_0x35d7d3){_0x450824['contact']=_0x35d7d3;}if(_0x40a06){_0x450824['index']=_0x40a06;}return _0x450824;}function isEmail(_0x469a7a){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'](_0x469a7a);}function checkRow(_0x205491,_0x117cb3,_0x3cee7f){return new BPromise(function(_0x2bfb0f,_0x3f23c5){if(_[_0xbee5('0x10')](_0x205491)){return _0x3f23c5(handleCheckRowError(_0xbee5('0xf'),_0xbee5('0x11'),null,_0x3cee7f));}if(_0x205491[_0xbee5('0x12')]&&_0x205491['errors']['length']){var _0x5d9195=_['map'](_0x205491['errors'],_0xbee5('0x13'))[_0xbee5('0x14')](';');return _0x3f23c5(handleCheckRowError(_0xbee5('0xf'),_0x5d9195,null,_0x3cee7f));}var _0x28c74d={};for(var _0x169042 in FIELDS){if(FIELDS[_0xbee5('0x15')](_0x169042)&&FIELDS[_0x169042]){_0x28c74d[_0x169042]=_0x205491[_0xbee5('0x16')][0x0][FIELDS[_0x169042]]||_0x205491['data'][0x0]['\ufeff'+FIELDS[_0x169042]];}}if(!_0x28c74d[_0xbee5('0x17')]){return _0x3f23c5(handleCheckRowError(_0xbee5('0xf'),_0xbee5('0x18'),null,_0x3cee7f));}if(!_0x28c74d[_0xbee5('0x19')]){return _0x3f23c5(handleCheckRowError(_0xbee5('0xf'),'phone\x20not\x20specified!',null,_0x3cee7f));}if(_0x28c74d[_0xbee5('0x1a')]){var _0x15ffb1=moment(_0x28c74d[_0xbee5('0x1a')],_0xbee5('0x1b'));if(!_0x15ffb1[_0xbee5('0x1c')]()){return _0x3f23c5(handleCheckRowError(_0xbee5('0xf'),_0xbee5('0x1d'),null,_0x3cee7f));}}if(_0x28c74d[_0xbee5('0x1e')]){if(!isEmail(_0x28c74d[_0xbee5('0x1e')])){return _0x3f23c5(handleCheckRowError('error',_0xbee5('0x1f'),null,_0x3cee7f));}}_0x28c74d['ListId']=LISTID;_0x28c74d[_0xbee5('0x20')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x117cb3){var _0x2d20cd={};for(var _0x52dad9=0x0,_0x35609d=DUPLICATES['length'];_0x52dad9<_0x35609d;_0x52dad9+=0x1){_0x2d20cd[DUPLICATES[_0x52dad9]]=_0x28c74d[DUPLICATES[_0x52dad9]];}var _0x3220bf=_[_0xbee5('0x21')](_0x117cb3,_0x2d20cd);if(_0x3220bf){return _0x3f23c5(handleCheckRowError(_0xbee5('0x22'),_0xbee5('0x23'),_0x3220bf,_0x3cee7f));}}return db['CmContact'][_0xbee5('0x24')](_0x28c74d,{'raw':!![],'hooks':![],'fields':_[_0xbee5('0x25')](_0x28c74d)})[_0xbee5('0x26')](function(_0x1c78cc){if(DUPLICATES&&DUPLICATES['length']&&_0x117cb3){_0x117cb3[_0xbee5('0x27')](_[_0xbee5('0x28')](_0x28c74d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1c78cc['id'];return _0x2bfb0f();})[_0xbee5('0x29')](function(_0x30a2fc){return _0x3f23c5(handleCheckRowError('error',_0xbee5('0x2a')+(_0x30a2fc[_0xbee5('0x13')]||JSON[_0xbee5('0x2b')](_0x30a2fc)),null,_0x3cee7f));});});}function checkHopper(){function _0x33aaba(){return function(_0x52ecf1){logger[_0xbee5('0xf')]('cmContact',_0xbee5('0x2c'),util['inspect'](_0x52ecf1,{'showHidden':![],'depth':null}));};}var _0x5edf19=function(_0x59bf49,_0x45e8d7){var _0x315523=squel[_0xbee5('0x2d')]()[_0xbee5('0x2e')](_0xbee5('0x2f'))[_0xbee5('0x30')]([_0xbee5('0x19'),_0xbee5('0x31'),'ContactId',_0xbee5('0x32'),_0x45e8d7,'createdAt',_0xbee5('0x33')],squel[_0xbee5('0x34')]()[_0xbee5('0x35')](_0xbee5('0x19'),'phone')[_0xbee5('0x35')]('NOW()','scheduledAt')[_0xbee5('0x35')]('id',_0xbee5('0x36'))[_0xbee5('0x35')](LISTID[_0xbee5('0x37')](),'ListId')[_0xbee5('0x35')](_0x59bf49['id'][_0xbee5('0x37')](),_0x45e8d7)[_0xbee5('0x35')](_0xbee5('0x38'),_0xbee5('0x39'))[_0xbee5('0x35')](_0xbee5('0x38'),_0xbee5('0x33'))[_0xbee5('0x3a')](_0xbee5('0x3b'))['where'](_0xbee5('0x3c'))[_0xbee5('0x3d')]('ListId\x20=\x20?',LISTID[_0xbee5('0x37')]())[_0xbee5('0x3d')](_0xbee5('0x3e'))[_0xbee5('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xbee5('0x19'))[_0xbee5('0x3a')](_0xbee5('0x2f'))[_0xbee5('0x3d')](_0x45e8d7+_0xbee5('0x3f'),_0x59bf49['id'][_0xbee5('0x37')]())))[_0xbee5('0x37')]();return _0x315523;};var _0x2c4464=function(_0x4772ae,_0x5ee32c){var _0x4e6350=squel[_0xbee5('0x2d')]()['into'](_0xbee5('0x2f'))[_0xbee5('0x30')](['phone',_0xbee5('0x31'),_0xbee5('0x36'),'ListId',_0x5ee32c,'createdAt',_0xbee5('0x33')],squel[_0xbee5('0x34')]()['field'](_0xbee5('0x19'),_0xbee5('0x19'))['field'](_0xbee5('0x38'),_0xbee5('0x31'))[_0xbee5('0x35')]('id',_0xbee5('0x36'))[_0xbee5('0x35')](LISTID[_0xbee5('0x37')](),_0xbee5('0x32'))['field'](_0x4772ae['id'][_0xbee5('0x37')](),_0x5ee32c)[_0xbee5('0x35')](_0xbee5('0x38'),_0xbee5('0x39'))['field'](_0xbee5('0x38'),_0xbee5('0x33'))[_0xbee5('0x3a')]('cm_contacts')[_0xbee5('0x3d')](_0xbee5('0x3c'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xbee5('0x3d')]('id\x20IN\x20?',squel[_0xbee5('0x40')](hopperContacts))[_0xbee5('0x3d')](_0xbee5('0x3e'))[_0xbee5('0x3d')](_0xbee5('0x41'),squel[_0xbee5('0x34')]()['field'](_0xbee5('0x42'))[_0xbee5('0x3a')](_0xbee5('0x43'))[_0xbee5('0x3d')](_0x5ee32c+'\x20=\x20?',_0x4772ae['id'][_0xbee5('0x37')]()))['where'](_0xbee5('0x41'),squel[_0xbee5('0x34')]()[_0xbee5('0x35')](_0xbee5('0x19'))[_0xbee5('0x3a')](_0xbee5('0x2f'))[_0xbee5('0x3d')](_0x5ee32c+_0xbee5('0x3f'),_0x4772ae['id'][_0xbee5('0x37')]())))[_0xbee5('0x37')]();return _0x4e6350;};function _0x18270a(_0x2dbb4e,_0xeebac7){var _0x359738=squel[_0xbee5('0x2d')]()['into'](_0xbee5('0x2f'))[_0xbee5('0x30')]([_0xbee5('0x19'),'scheduledAt',_0xbee5('0x36'),_0xbee5('0x32'),_0xeebac7,_0xbee5('0x39'),'updatedAt'],squel[_0xbee5('0x34')]()['field'](_0xbee5('0x19'),'phone')[_0xbee5('0x35')](_0xbee5('0x38'),_0xbee5('0x31'))['field']('id','ContactId')['field'](LISTID[_0xbee5('0x37')](),_0xbee5('0x32'))[_0xbee5('0x35')](_0x2dbb4e['id']['toString'](),_0xeebac7)[_0xbee5('0x35')]('NOW()',_0xbee5('0x39'))[_0xbee5('0x35')](_0xbee5('0x38'),'updatedAt')[_0xbee5('0x3a')](_0xbee5('0x3b'))[_0xbee5('0x3d')](_0xbee5('0x3c'))[_0xbee5('0x3d')](_0xbee5('0x44'),LISTID[_0xbee5('0x37')]())[_0xbee5('0x3d')](_0xbee5('0x45'),squel[_0xbee5('0x40')](hopperContacts))[_0xbee5('0x3d')](_0xbee5('0x3e')))[_0xbee5('0x37')]();return _0x359738;}function _0x317b5c(_0x2c4a4f,_0x143fd9){var _0x32a8d2=squel['insert']()[_0xbee5('0x2e')]('cm_hopper_black')['fromQuery']([_0xbee5('0x19'),_0xbee5('0x36'),'ListId',_0x143fd9,'createdAt',_0xbee5('0x33')],squel['select']()[_0xbee5('0x35')](_0xbee5('0x19'),'phone')[_0xbee5('0x35')]('id',_0xbee5('0x36'))[_0xbee5('0x35')](LISTID[_0xbee5('0x37')](),'ListId')[_0xbee5('0x35')](_0x2c4a4f['id']['toString'](),_0x143fd9)[_0xbee5('0x35')](_0xbee5('0x38'),'createdAt')[_0xbee5('0x35')](_0xbee5('0x38'),'updatedAt')[_0xbee5('0x3a')](_0xbee5('0x3b'))['where'](_0xbee5('0x3c'))['where'](_0xbee5('0x44'),LISTID['toString']())[_0xbee5('0x3d')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xbee5('0x3d')](_0xbee5('0x3e')))[_0xbee5('0x37')]();return _0x32a8d2;}return db[_0xbee5('0x46')][_0xbee5('0x47')]({'where':{'type':_0xbee5('0x48')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xbee5('0x49')],'as':_0xbee5('0x4a'),'where':{'id':LISTID}}]})[_0xbee5('0x26')](function(_0x70f14d){var _0x34c020=[];if(_0x70f14d){var _0xf77d34;for(var _0x3b0deb=0x0,_0x2ef7aa;_0x3b0deb<_0x70f14d[_0xbee5('0x4b')];_0x3b0deb+=0x1){_0x2ef7aa=_0x70f14d[_0x3b0deb]['get']({'plain':!![]});switch(_0x2ef7aa[_0xbee5('0x4c')]){case _0xbee5('0x4d'):_0x34c020[_0xbee5('0x27')](db[_0xbee5('0x4e')]['query'](_0x2c4464(_0x2ef7aa,_0xbee5('0x4f')))[_0xbee5('0x26')](function(){})[_0xbee5('0x29')](_0x33aaba()));break;case _0xbee5('0x50'):_0x34c020[_0xbee5('0x27')](db[_0xbee5('0x4e')][_0xbee5('0x51')](_0x5edf19(_0x2ef7aa,_0xbee5('0x4f')))[_0xbee5('0x26')](function(){})[_0xbee5('0x29')](_0x33aaba()));break;default:_0x34c020[_0xbee5('0x27')](db[_0xbee5('0x4e')]['query'](_0x18270a(_0x2ef7aa,_0xbee5('0x4f')))[_0xbee5('0x26')](function(){})['catch'](_0x33aaba()));}}}return _0x34c020;})[_0xbee5('0x52')]()['then'](function(){return db[_0xbee5('0x46')][_0xbee5('0x47')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xbee5('0x49')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x58ca95){var _0x50a8c8=[];if(_0x58ca95){var _0x4c7b07;for(var _0x560c03=0x0,_0x14d5e4;_0x560c03<_0x58ca95[_0xbee5('0x4b')];_0x560c03+=0x1){_0x14d5e4=_0x58ca95[_0x560c03][_0xbee5('0x53')]({'plain':!![]});_0x50a8c8[_0xbee5('0x27')](db[_0xbee5('0x4e')][_0xbee5('0x51')](_0x317b5c(_0x14d5e4,_0xbee5('0x4f')))[_0xbee5('0x26')](function(){})[_0xbee5('0x29')](_0x33aaba()));}}return _0x50a8c8;})[_0xbee5('0x52')]();})[_0xbee5('0x26')](function(){return db[_0xbee5('0x54')]['findAll']({'attributes':['id',_0xbee5('0x4c')],'include':[{'model':db[_0xbee5('0x49')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x64fa87){var _0x1baf3b=[];if(_0x64fa87){for(var _0x39cc65=0x0,_0x5e5cba;_0x39cc65<_0x64fa87[_0xbee5('0x4b')];_0x39cc65+=0x1){_0x5e5cba=_0x64fa87[_0x39cc65][_0xbee5('0x53')]({'plain':!![]});switch(_0x5e5cba[_0xbee5('0x4c')]){case'always':_0x1baf3b['push'](db['sequelize'][_0xbee5('0x51')](_0x2c4464(_0x5e5cba,_0xbee5('0x55')))[_0xbee5('0x26')](function(){})[_0xbee5('0x29')](_0x33aaba()));break;case _0xbee5('0x50'):_0x1baf3b[_0xbee5('0x27')](db[_0xbee5('0x4e')][_0xbee5('0x51')](_0x5edf19(_0x5e5cba,'CampaignId'))['then'](function(){})[_0xbee5('0x29')](_0x33aaba()));break;default:_0x1baf3b[_0xbee5('0x27')](db['sequelize']['query'](_0x18270a(_0x5e5cba,_0xbee5('0x55')))['then'](function(){})['catch'](_0x33aaba()));}}}return _0x1baf3b;})[_0xbee5('0x52')]();})['then'](function(){return db[_0xbee5('0x54')][_0xbee5('0x47')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xbee5('0x56'),'where':{'id':LISTID}}]})[_0xbee5('0x26')](function(_0x122ccf){var _0x37948a=[];if(_0x122ccf){for(var _0x28f5a0=0x0,_0x589d16;_0x28f5a0<_0x122ccf['length'];_0x28f5a0+=0x1){_0x589d16=_0x122ccf[_0x28f5a0][_0xbee5('0x53')]({'plain':!![]});_0x37948a['push'](db[_0xbee5('0x4e')]['query'](_0x317b5c(_0x589d16,_0xbee5('0x55')))[_0xbee5('0x26')](function(){})[_0xbee5('0x29')](_0x33aaba()));}}return _0x37948a;})[_0xbee5('0x52')]();})[_0xbee5('0x29')](function(_0x306196){logger[_0xbee5('0xf')](_0xbee5('0x57'),_0xbee5('0x58'),_0x306196[_0xbee5('0x13')]);});}var processPromises=function(_0x1a07ac){return BPromise[_0xbee5('0x52')](promises)['then'](function(_0x2aff1f){})[_0xbee5('0x29')](function(_0x2cc73a){logger[_0xbee5('0xf')]('Error\x20processing\x20rows\x20block:',JSON[_0xbee5('0x2b')](_0x2cc73a));})[_0xbee5('0x59')](function(){socket[_0xbee5('0x5a')](_0xbee5('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1a07ac){return _0x1a07ac[_0xbee5('0x5c')]();}});};var endCsv=function(){return BPromise[_0xbee5('0x5d')]()[_0xbee5('0x26')](function(){if(hopperContacts){return checkHopper();}})[_0xbee5('0x26')](function(){socket['emit'](_0xbee5('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xbee5('0x5e')](FILEPATH);}catch(_0x232c0d){logger[_0xbee5('0xf')](_0xbee5('0x5f'),JSON[_0xbee5('0x2b')](_0x232c0d));}finally{process[_0xbee5('0x60')](0x0);}});};process['on'](_0xbee5('0x61'),function(){logger[_0xbee5('0x62')](_0xbee5('0x63'));endCsv();});function main(){return BPromise[_0xbee5('0x5d')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xbee5('0xd')](',');return db[_0xbee5('0x64')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xbee5('0x26')](function(_0x45f8d4){var _0x32fd4d=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xbee5('0x65')](_0x32fd4d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x6a41d8,_0x21c3df){total+=0x1;var _0x32b253=total;promises[_0xbee5('0x27')](checkRow(_0x6a41d8,_0x45f8d4,_0x32b253)[_0xbee5('0x26')](function(){success+=0x1;})[_0xbee5('0x29')](function(_0x359fe1){if(_0x359fe1[_0xbee5('0xf')]){errors+=0x1;delete _0x359fe1[_0xbee5('0xf')];}else if(_0x359fe1[_0xbee5('0x22')]){duplicates+=0x1;delete _0x359fe1[_0xbee5('0x22')];}rows['push'](_0x359fe1);}));if(total%0xc8===0x0){_0x21c3df[_0xbee5('0x66')]();return processPromises(_0x21c3df);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0xbee5('0x67'));endCsv();});},'error':function(_0x198a43,_0x5aa8f7){logger['info'](_0xbee5('0x68'),JSON[_0xbee5('0x2b')](_0x198a43));endCsv();}});})[_0xbee5('0x29')](function(_0x2947b5){logger[_0xbee5('0xf')](_0xbee5('0x69'),JSON[_0xbee5('0x2b')](_0x2947b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 4428e53..bf03d12 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 _0xb557=['phone','join','.id\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','scheduledat','ListId','createdAt','updatedAt','priority','UserId','select','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','fromQuery','ContactId','cm_contacts','ListId\x20=\x20?','\x20=\x20?','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','errors','push','sequelize','query','spread','catch','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','keys','header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','SystemRow','emit','contact:import:','Abort\x20parser','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()','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','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','lodash','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','socket.io-emitter','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xb557,0x6f));var _0x7b55=function(_0x2335dc,_0x1e055b){_0x2335dc=_0x2335dc-0x0;var _0x2c8e8a=_0xb557[_0x2335dc];return _0x2c8e8a;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x7b55('0x0'));var Papa=require(_0x7b55('0x1'));var util=require(_0x7b55('0x2'));var BPromise=require('bluebird');var moment=require(_0x7b55('0x3'));var squel=require(_0x7b55('0x4'));var db=require(_0x7b55('0x5'))['db'];var config=require(_0x7b55('0x6'));var logger=require(_0x7b55('0x7'))(_0x7b55('0x8'));var socket=require(_0x7b55('0x9'))({'host':_0x7b55('0xa'),'port':0x18eb});var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7b55('0xb')](_0x7b55('0xc'));function isEmail(_0x2752fb){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))*$/[_0x7b55('0xd')](_0x2752fb);}function selectNotIn(_0x21d384,_0x2c1528,_0x22ad1d,_0x26c605,_0x5ad9d9){return squel['select']()[_0x7b55('0xe')](_0x7b55('0xf'))['from'](_0x26c605)[_0x7b55('0x10')](_0x2c1528,null,_0x2c1528+_0x7b55('0x11')+_0x26c605+'.'+_0x22ad1d)[_0x7b55('0x12')](_0x26c605+'.'+_0x22ad1d+'\x20=\x20'+_0x21d384+'.'+_0x22ad1d)[_0x7b55('0x12')](_0x2c1528+'.dialCheckDuplicateType\x20IN\x20('+_0x5ad9d9['join']()+')');}function insertCmHopper(_0x32ece1,_0x42bc56,_0x1c008b,_0x1a3f24,_0x1fd584){var _0x285f9b=[_0x7b55('0x13'),_0x7b55('0x14'),_0x7b55('0x15'),_0x7b55('0x16'),_0x42bc56+'.'+_0x1a3f24,_0x7b55('0x17'),'cm_contacts.updatedAt',_0x7b55('0x18'),'cm_contacts.UserId','\x22'+_0x1fd584+'\x22'];return squel[_0x7b55('0x19')]()[_0x7b55('0x1a')]('cm_hopper')['fromQuery'](['phone',_0x7b55('0x1b'),'ContactId',_0x7b55('0x1c'),_0x1a3f24,_0x7b55('0x1d'),_0x7b55('0x1e'),_0x7b55('0x1f'),_0x7b55('0x20'),'recallme'],squel[_0x7b55('0x21')]()[_0x7b55('0x22')](_0x285f9b)[_0x7b55('0x23')](_0x42bc56)[_0x7b55('0x10')]('cm_contacts',null,_0x7b55('0x24')+_0x42bc56+_0x7b55('0x25'))['join'](_0x1c008b,null,_0x1c008b+_0x7b55('0x11')+_0x42bc56+'.'+_0x1a3f24)[_0x7b55('0x12')](_0x42bc56+_0x7b55('0x26'),_0x32ece1)[_0x7b55('0x12')](_0x7b55('0x27'),NOW)[_0x7b55('0x12')](_0x7b55('0x28'),selectNotIn(_0x42bc56,_0x1c008b,_0x1a3f24,_0x7b55('0x29'),[_0x7b55('0x2a'),_0x7b55('0x2b')]))['where'](_0x7b55('0x28'),selectNotIn(_0x42bc56,_0x1c008b,_0x1a3f24,_0x7b55('0x29'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x2c387e,_0x46956a,_0x193e66,_0x302975){var _0x466615=['cm_contacts.phone',_0x7b55('0x15'),_0x7b55('0x16'),_0x46956a+'.'+_0x302975,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x7b55('0x19')]()['into'](_0x7b55('0x2c'))[_0x7b55('0x2d')]([_0x7b55('0xf'),_0x7b55('0x2e'),'ListId',_0x302975,_0x7b55('0x1d'),_0x7b55('0x1e')],squel[_0x7b55('0x21')]()[_0x7b55('0x22')](_0x466615)['from'](_0x46956a)[_0x7b55('0x10')](_0x7b55('0x2f'),null,_0x7b55('0x24')+_0x46956a+'.CmListId')[_0x7b55('0x10')](_0x193e66,null,_0x193e66+_0x7b55('0x11')+_0x46956a+'.'+_0x302975)[_0x7b55('0x12')](_0x46956a+_0x7b55('0x26'),_0x2c387e)[_0x7b55('0x12')](_0x7b55('0x27'),NOW)[_0x7b55('0x12')](_0x7b55('0x28'),squel[_0x7b55('0x21')]()['field']('phone')[_0x7b55('0x23')](_0x7b55('0x2c'))[_0x7b55('0x12')](_0x7b55('0x30'),_0x2c387e)['where'](_0x302975+_0x7b55('0x31'),_0x46956a+'.'+_0x302975)))['toString']();}function insertCmContact(_0x3bd562,_0x573fc3,_0x567caa,_0x19cf0b){var _0x1863f7=_['concat'](_['keys'](_0x19cf0b),[_0x7b55('0x1c'),_0x7b55('0x32'),'createdAt',_0x7b55('0x1e')]);return squel[_0x7b55('0x19')]()['into'](_0x7b55('0x2f'))[_0x7b55('0x2d')](_0x1863f7,squel[_0x7b55('0x21')]()[_0x7b55('0x22')](_0x1863f7)[_0x7b55('0x23')](_0x573fc3)[_0x7b55('0x12')]('('+_0x567caa[_0x7b55('0x10')](',')+_0x7b55('0x33'),squel[_0x7b55('0x21')]()[_0x7b55('0x22')](_0x567caa)['from']('cm_contacts')[_0x7b55('0x12')]('ListId\x20=\x20?',_0x3bd562))[_0x7b55('0x12')](_0x7b55('0x34'),squel[_0x7b55('0x21')]()[_0x7b55('0xe')](_0x7b55('0x35'),'min_id')[_0x7b55('0x23')](_0x573fc3)[_0x7b55('0x36')](_0x567caa[_0x7b55('0x10')](','))))['toString']();}function handleStop(){logger[_0x7b55('0x37')](_0x7b55('0x38'));stopped=!![];}function handleUncaughtException(_0x97cf0){logger[_0x7b55('0x39')](_0x97cf0[_0x7b55('0x3a')]);process['exit'](0x1);}function handleError(_0x358858,_0xf151d7){stats[_0x7b55('0x3b')][_0x7b55('0x3c')]({'name':_0xf151d7['code'],'message':_0xf151d7['message'],'row':_0x358858});}function handleQuery(_0x4b292b){logger[_0x7b55('0x37')](_0x4b292b);return db[_0x7b55('0x3d')][_0x7b55('0x3e')](_0x4b292b)[_0x7b55('0x3f')](function(_0x354629){results[_0x7b55('0x3c')](_0x354629);})[_0x7b55('0x40')](function(_0x248bfd){logger[_0x7b55('0x39')](_0x248bfd['message']);});}function main(_0x5d89af,_0x9fe450,_0x40f78e,_0x45bbca){logger[_0x7b55('0x37')](_0x7b55('0x41'),_0x5d89af,JSON[_0x7b55('0x42')](_0x9fe450));process[_0x7b55('0x43')]('start');var _0x1222de=_0x9fe450[_0x7b55('0x44')];var _0x374b6e=_0x9fe450[_0x7b55('0x45')];var _0x58bd52=path['join'](config[_0x7b55('0x46')],_0x7b55('0x47'),_0x374b6e+_0x7b55('0x48'));var _0x45db68=_[_0x7b55('0x49')](_0x1222de)['join']();logger[_0x7b55('0x37')](_0x7b55('0x4a'),_0x45db68);fs[_0x7b55('0x4b')](_0x58bd52,_0x45db68+'\x0a');Papa[_0x7b55('0x4c')](fs['createReadStream'](_0x5d89af),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4c05ae,_0x357fda){try{for(var _0x31ac13=0x0,_0x38a717=[];_0x31ac13<_0x4c05ae[_0x7b55('0x4d')][_0x7b55('0x4e')];_0x31ac13++){stats[_0x7b55('0x4f')]+=0x1;if(_0x4c05ae[_0x7b55('0x3b')][_0x31ac13]){handleError(_0x4c05ae[_0x7b55('0x4d')][_0x31ac13],_0x4c05ae[_0x7b55('0x3b')][_0x31ac13]);}else{var _0x16faa4=[];for(var _0x304cbb in _0x1222de){if(_0x1222de[_0x7b55('0x50')](_0x304cbb)){if(_0x4c05ae[_0x7b55('0x4d')][_0x31ac13][_0x1222de[_0x304cbb]]){var _0x37cf45=_[_0x7b55('0x51')](_0x4c05ae['data'][_0x31ac13][_0x1222de[_0x304cbb]]['replace'](/"/g,'\x27'));switch(_0x304cbb){case _0x7b55('0x1b'):var _0x2284ca=moment(_0x37cf45,_0x7b55('0xc'),!![]);if(_0x2284ca[_0x7b55('0x52')]()){_0x38a717['push']('\x22'+_0x37cf45+'\x22');}else{_0x16faa4[_0x7b55('0x3c')](_0x7b55('0x53'));}break;case _0x7b55('0x1f'):var _0x421133=parseInt(_0x37cf45);_0x37cf45=_['isNaN'](_0x421133)||_0x421133<0x0||_0x421133>0x4?_0x45bbca?0x3:0x2:_0x421133;_0x38a717[_0x7b55('0x3c')]('\x22'+_0x37cf45+'\x22');break;case _0x7b55('0x20'):var _0x6ff8c=parseInt(_0x37cf45);if(_['isNumber'](_0x6ff8c)&&_[_0x7b55('0x54')](_0x40f78e,_0x6ff8c)){_0x38a717[_0x7b55('0x3c')]('\x22'+_0x6ff8c+'\x22');}else{_0x16faa4[_0x7b55('0x3c')](_0x7b55('0x55'));}break;case'email':if(isEmail(_0x37cf45)){_0x38a717[_0x7b55('0x3c')]('\x22'+_0x37cf45+'\x22');}else{_0x16faa4['push'](_0x7b55('0x56'));}break;case _0x7b55('0x57'):var _0x5d013c=moment(_0x37cf45,_0x7b55('0x58'),!![]);if(_0x5d013c[_0x7b55('0x52')]()){_0x38a717[_0x7b55('0x3c')]('\x22'+_0x37cf45+'\x22');}else{_0x16faa4['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x38a717['push']('\x22'+_0x37cf45+'\x22');}}else{switch(_0x304cbb){case'firstName':case _0x7b55('0xf'):_0x16faa4['push'](_0x304cbb+'\x20not\x20specified');break;default:_0x38a717[_0x7b55('0x3c')]('\x22\x22');}}}}if(_0x16faa4['length']){handleError(_0x4c05ae['data'][_0x31ac13],{'code':_0x7b55('0x59'),'message':_0x16faa4[_0x7b55('0x10')]()});}else{fs['appendFileSync'](_0x58bd52,_0x38a717[_0x7b55('0x10')]()+'\x0a');}_0x38a717=[];}if(!(stats[_0x7b55('0x4f')]%0xc8)){socket[_0x7b55('0x5a')](_0x7b55('0x5b')+_0x374b6e,stats);stats[_0x7b55('0x3b')]=[];}}if(stopped){logger[_0x7b55('0x37')](_0x7b55('0x5c'));_0x357fda['abort']();}}catch(_0x1c5767){handleError(_0x4c05ae['data'][_0x31ac13],{'code':_0x7b55('0x5d'),'message':_0x1c5767[_0x7b55('0x3a')]});logger['error'](_0x7b55('0x5e'),_0x1c5767[_0x7b55('0x3a')]);}},'complete':function(){try{var _0x49f856=[];var _0x41e89d=_0x7b55('0x2f');if(_0x9fe450['duplicates']&&_0x9fe450[_0x7b55('0x5f')][_0x7b55('0x4e')]){_0x41e89d=_0x7b55('0x60')+_0x374b6e;_0x49f856[_0x7b55('0x3c')](_0x7b55('0x61')+_0x41e89d+_0x7b55('0x62'));}var _0x145454=util['format'](_0x7b55('0x63'),_0x58bd52,_0x41e89d,_0x45db68,_0x9fe450[_0x7b55('0x1c')],_0x9fe450[_0x7b55('0x32')]||null,NOW,NOW);if(_[_0x7b55('0x64')](_0x1222de[_0x7b55('0x1b')])){_0x145454+=_0x7b55('0x65');}_0x49f856['push'](_0x145454);if(_0x9fe450[_0x7b55('0x5f')]&&_0x9fe450[_0x7b55('0x5f')][_0x7b55('0x4e')]){_0x49f856['push'](insertCmContact(_0x9fe450[_0x7b55('0x1c')],_0x41e89d,_0x9fe450['duplicates'],_0x1222de));_0x49f856['push']('DROP\x20TABLE\x20'+_0x41e89d+';');}_0x49f856['push'](insertCmHopper(_0x9fe450[_0x7b55('0x1c')],_0x7b55('0x66'),_0x7b55('0x67'),'VoiceQueueId',_0x45bbca));_0x49f856[_0x7b55('0x3c')](insertCmHopperBlack(_0x9fe450[_0x7b55('0x1c')],_0x7b55('0x68'),_0x7b55('0x67'),_0x7b55('0x69')));_0x49f856[_0x7b55('0x3c')](insertCmHopper(_0x9fe450[_0x7b55('0x1c')],_0x7b55('0x6a'),_0x7b55('0x6b'),_0x7b55('0x6c'),_0x45bbca));_0x49f856[_0x7b55('0x3c')](insertCmHopperBlack(_0x9fe450[_0x7b55('0x1c')],_0x7b55('0x6d'),'campaigns',_0x7b55('0x6c')));BPromise[_0x7b55('0x6e')](_0x49f856,handleQuery)[_0x7b55('0x6f')](function(_0x41fe49){stats['finish']=!![];stats[_0x7b55('0x70')]=_0x9fe450[_0x7b55('0x5f')]&&_0x9fe450[_0x7b55('0x5f')][_0x7b55('0x4e')]?results[0x2][_0x7b55('0x70')]:results[0x0]['affectedRows'];socket[_0x7b55('0x5a')]('contact:import:'+_0x374b6e,stats);fs[_0x7b55('0x71')](_0x5d89af);fs[_0x7b55('0x71')](_0x58bd52);process[_0x7b55('0x72')](0x0);})[_0x7b55('0x40')](function(_0x403bc4){logger['error'](_0x403bc4[_0x7b55('0x3a')]);process['exit'](0x1);});}catch(_0x301617){logger[_0x7b55('0x39')](_0x7b55('0x73'),_0x301617[_0x7b55('0x3a')]);process[_0x7b55('0x72')](0x1);}},'error':function(_0x17e5d0,_0x232996,_0x1151d5,_0xa7525d){throw new Error(_0xa7525d);}});}function validate(){if(process[_0x7b55('0x74')]&&process[_0x7b55('0x74')][_0x7b55('0x4e')]<0x4){throw new Error(_0x7b55('0x75'));}var _0x554e4d=path[_0x7b55('0x10')](config['root'],_0x7b55('0x47'),process['argv'][0x2]);if(!fs[_0x7b55('0x76')](_0x554e4d)){throw new Error(_0x7b55('0x77'));}var _0x2dddb5={};try{_0x2dddb5=JSON[_0x7b55('0x4c')](process[_0x7b55('0x74')][0x3]);if(!_0x2dddb5[_0x7b55('0x44')]){throw new Error(_0x7b55('0x78'));}if(!_0x2dddb5[_0x7b55('0x44')][_0x7b55('0xf')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x2dddb5[_0x7b55('0x44')][_0x7b55('0x79')]){throw new Error(_0x7b55('0x7a'));}var _0x562c97=0x0;if(_0x2dddb5[_0x7b55('0x44')][_0x7b55('0x20')]){_0x562c97=0x1;}if(!_0x2dddb5[_0x7b55('0x1c')]){throw new Error(_0x7b55('0x7b'));}}catch(_0x2ccbbf){throw new Error(_0x7b55('0x7c'));}var _0x5632ec=[];try{_0x5632ec=_['map'](JSON[_0x7b55('0x4c')](process[_0x7b55('0x74')][0x4]),'id');}catch(_0x542ac2){logger[_0x7b55('0x37')](_0x7b55('0x7d'));}main(_0x554e4d,_0x2dddb5,_0x5632ec,_0x562c97);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xdd3c=['select','field','phone','from','join','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.id','cm_contacts.createdAt','insert','into','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','ListId','\x20=\x20?','toString','concat','CompanyId','cm_contacts',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','min_id','info','message','exit','errors','push','sequelize','spread','catch','error','main','stringify','send','root','server/files/tmp','keys','header','data','length','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','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','scheduledat','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','parse','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','socket.io-emitter','localhost','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4137ef,_0x3cde9e){var _0x17ee3b=function(_0x5cabca){while(--_0x5cabca){_0x4137ef['push'](_0x4137ef['shift']());}};_0x17ee3b(++_0x3cde9e);}(_0xdd3c,0xe3));var _0xcdd3=function(_0x249b60,_0x13ff4a){_0x249b60=_0x249b60-0x0;var _0x3e4aae=_0xdd3c[_0x249b60];return _0x3e4aae;};'use strict';var fs=require('fs');var path=require(_0xcdd3('0x0'));var _=require(_0xcdd3('0x1'));var Papa=require(_0xcdd3('0x2'));var util=require(_0xcdd3('0x3'));var BPromise=require(_0xcdd3('0x4'));var moment=require(_0xcdd3('0x5'));var squel=require(_0xcdd3('0x6'));var db=require(_0xcdd3('0x7'))['db'];var config=require(_0xcdd3('0x8'));var logger=require(_0xcdd3('0x9'))(_0xcdd3('0xa'));var socket=require(_0xcdd3('0xb'))({'host':_0xcdd3('0xc'),'port':0x18eb});var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xcdd3('0xd')](_0xcdd3('0xe'));function isEmail(_0x289257){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'](_0x289257);}function selectNotIn(_0x2ba169,_0x522635,_0x4425bf,_0x3e61bc,_0x25cc83){return squel[_0xcdd3('0xf')]()[_0xcdd3('0x10')](_0xcdd3('0x11'))[_0xcdd3('0x12')](_0x3e61bc)[_0xcdd3('0x13')](_0x522635,null,_0x522635+'.id\x20=\x20'+_0x3e61bc+'.'+_0x4425bf)['where'](_0x3e61bc+'.'+_0x4425bf+'\x20=\x20'+_0x2ba169+'.'+_0x4425bf)['where'](_0x522635+_0xcdd3('0x14')+_0x25cc83[_0xcdd3('0x13')]()+')');}function insertCmHopper(_0xbfe00a,_0x1ad53d,_0x31e70f,_0xe1ca09,_0x1a7d45){var _0x1e2c8e=['cm_contacts.phone','cm_contacts.scheduledat',_0xcdd3('0x15'),'cm_contacts.ListId',_0x1ad53d+'.'+_0xe1ca09,_0xcdd3('0x16'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x1a7d45+'\x22'];return squel[_0xcdd3('0x17')]()[_0xcdd3('0x18')]('cm_hopper')['fromQuery'](['phone','scheduledat',_0xcdd3('0x19'),'ListId',_0xe1ca09,_0xcdd3('0x1a'),_0xcdd3('0x1b'),_0xcdd3('0x1c'),_0xcdd3('0x1d'),_0xcdd3('0x1e')],squel['select']()[_0xcdd3('0x1f')](_0x1e2c8e)[_0xcdd3('0x12')](_0x1ad53d)[_0xcdd3('0x13')]('cm_contacts',null,_0xcdd3('0x20')+_0x1ad53d+_0xcdd3('0x21'))['join'](_0x31e70f,null,_0x31e70f+_0xcdd3('0x22')+_0x1ad53d+'.'+_0xe1ca09)[_0xcdd3('0x23')](_0x1ad53d+_0xcdd3('0x24'),_0xbfe00a)['where'](_0xcdd3('0x25'),NOW)[_0xcdd3('0x23')](_0xcdd3('0x26'),selectNotIn(_0x1ad53d,_0x31e70f,_0xe1ca09,'cm_hopper',[_0xcdd3('0x27'),_0xcdd3('0x28')]))[_0xcdd3('0x23')](_0xcdd3('0x26'),selectNotIn(_0x1ad53d,_0x31e70f,_0xe1ca09,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x3ac02a,_0x38bdfa,_0x234b4a,_0x4cf775){var _0x384a28=[_0xcdd3('0x29'),_0xcdd3('0x15'),_0xcdd3('0x2a'),_0x38bdfa+'.'+_0x4cf775,_0xcdd3('0x16'),_0xcdd3('0x2b')];return squel[_0xcdd3('0x17')]()['into']('cm_hopper_black')['fromQuery'](['phone',_0xcdd3('0x19'),_0xcdd3('0x2c'),_0x4cf775,_0xcdd3('0x1a'),_0xcdd3('0x1b')],squel[_0xcdd3('0xf')]()[_0xcdd3('0x1f')](_0x384a28)[_0xcdd3('0x12')](_0x38bdfa)[_0xcdd3('0x13')]('cm_contacts',null,_0xcdd3('0x20')+_0x38bdfa+_0xcdd3('0x21'))[_0xcdd3('0x13')](_0x234b4a,null,_0x234b4a+_0xcdd3('0x22')+_0x38bdfa+'.'+_0x4cf775)['where'](_0x38bdfa+_0xcdd3('0x24'),_0x3ac02a)[_0xcdd3('0x23')](_0xcdd3('0x25'),NOW)[_0xcdd3('0x23')](_0xcdd3('0x26'),squel[_0xcdd3('0xf')]()[_0xcdd3('0x10')](_0xcdd3('0x11'))[_0xcdd3('0x12')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x3ac02a)[_0xcdd3('0x23')](_0x4cf775+_0xcdd3('0x2d'),_0x38bdfa+'.'+_0x4cf775)))[_0xcdd3('0x2e')]();}function insertCmContact(_0x282c96,_0x5bf82f,_0x2789aa,_0x5ba1c5){var _0x301fa9=_[_0xcdd3('0x2f')](_['keys'](_0x5ba1c5),[_0xcdd3('0x2c'),_0xcdd3('0x30'),'createdAt',_0xcdd3('0x1b')]);return squel[_0xcdd3('0x17')]()[_0xcdd3('0x18')](_0xcdd3('0x31'))['fromQuery'](_0x301fa9,squel[_0xcdd3('0xf')]()[_0xcdd3('0x1f')](_0x301fa9)['from'](_0x5bf82f)[_0xcdd3('0x23')]('('+_0x2789aa['join'](',')+_0xcdd3('0x32'),squel[_0xcdd3('0xf')]()[_0xcdd3('0x1f')](_0x2789aa)[_0xcdd3('0x12')](_0xcdd3('0x31'))[_0xcdd3('0x23')](_0xcdd3('0x33'),_0x282c96))[_0xcdd3('0x23')]('id\x20IN\x20?',squel['select']()[_0xcdd3('0x10')]('MIN(id)',_0xcdd3('0x34'))[_0xcdd3('0x12')](_0x5bf82f)['group'](_0x2789aa[_0xcdd3('0x13')](','))))['toString']();}function handleStop(){logger[_0xcdd3('0x35')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5abd16){logger['error'](_0x5abd16[_0xcdd3('0x36')]);process[_0xcdd3('0x37')](0x1);}function handleError(_0x15ad7b,_0x5e1996){stats[_0xcdd3('0x38')][_0xcdd3('0x39')]({'name':_0x5e1996['code'],'message':_0x5e1996['message'],'row':_0x15ad7b});}function handleQuery(_0x34ab88){logger[_0xcdd3('0x35')](_0x34ab88);return db[_0xcdd3('0x3a')]['query'](_0x34ab88)[_0xcdd3('0x3b')](function(_0x38544f){results[_0xcdd3('0x39')](_0x38544f);})[_0xcdd3('0x3c')](function(_0xbc9638){logger[_0xcdd3('0x3d')](_0xbc9638[_0xcdd3('0x36')]);});}function main(_0x267f80,_0x4e33d2,_0x11ab14,_0x96b228){logger[_0xcdd3('0x35')](_0xcdd3('0x3e'),_0x267f80,JSON[_0xcdd3('0x3f')](_0x4e33d2));process[_0xcdd3('0x40')]('start');var _0x4489b2=_0x4e33d2['binding'];var _0x55ae75=_0x4e33d2['socket_timestamp'];var _0x3d05e6=path[_0xcdd3('0x13')](config[_0xcdd3('0x41')],_0xcdd3('0x42'),_0x55ae75+'.csv');var _0x372b0a=_[_0xcdd3('0x43')](_0x4489b2)['join']();logger[_0xcdd3('0x35')](_0xcdd3('0x44'),_0x372b0a);fs['writeFileSync'](_0x3d05e6,_0x372b0a+'\x0a');Papa['parse'](fs['createReadStream'](_0x267f80),{'header':!![],'skipEmptyLines':!![],'step':function(_0x53f041,_0x24c752){try{for(var _0x10fc98=0x0,_0x139e51=[];_0x10fc98<_0x53f041[_0xcdd3('0x45')][_0xcdd3('0x46')];_0x10fc98++){stats[_0xcdd3('0x47')]+=0x1;if(_0x53f041[_0xcdd3('0x38')][_0x10fc98]){handleError(_0x53f041[_0xcdd3('0x45')][_0x10fc98],_0x53f041[_0xcdd3('0x38')][_0x10fc98]);}else{var _0x43045f=[];for(var _0x3ced41 in _0x4489b2){if(_0x4489b2[_0xcdd3('0x48')](_0x3ced41)){if(_0x53f041[_0xcdd3('0x45')][_0x10fc98][_0x4489b2[_0x3ced41]]){var _0x10ac8f=_[_0xcdd3('0x49')](_0x53f041['data'][_0x10fc98][_0x4489b2[_0x3ced41]][_0xcdd3('0x4a')](/"/g,'\x27'));switch(_0x3ced41){case'scheduledat':var _0x414c60=moment(_0x10ac8f,_0xcdd3('0xe'),!![]);if(_0x414c60['isValid']()){_0x139e51[_0xcdd3('0x39')]('\x22'+_0x10ac8f+'\x22');}else{_0x43045f[_0xcdd3('0x39')](_0xcdd3('0x4b'));}break;case _0xcdd3('0x1c'):var _0x4bfc1f=parseInt(_0x10ac8f);_0x10ac8f=_['isNaN'](_0x4bfc1f)||_0x4bfc1f<0x0||_0x4bfc1f>0x4?_0x96b228?0x3:0x2:_0x4bfc1f;_0x139e51[_0xcdd3('0x39')]('\x22'+_0x10ac8f+'\x22');break;case _0xcdd3('0x1d'):var _0x61be9a=parseInt(_0x10ac8f);if(_[_0xcdd3('0x4c')](_0x61be9a)&&_[_0xcdd3('0x4d')](_0x11ab14,_0x61be9a)){_0x139e51[_0xcdd3('0x39')]('\x22'+_0x61be9a+'\x22');}else{_0x43045f[_0xcdd3('0x39')](_0xcdd3('0x4e'));}break;case _0xcdd3('0x4f'):if(isEmail(_0x10ac8f)){_0x139e51[_0xcdd3('0x39')]('\x22'+_0x10ac8f+'\x22');}else{_0x43045f[_0xcdd3('0x39')](_0xcdd3('0x50'));}break;case _0xcdd3('0x51'):var _0x2bedb4=moment(_0x10ac8f,'YYYY-MM-DD',!![]);if(_0x2bedb4['isValid']()){_0x139e51[_0xcdd3('0x39')]('\x22'+_0x10ac8f+'\x22');}else{_0x43045f[_0xcdd3('0x39')](_0xcdd3('0x52'));}break;default:_0x139e51[_0xcdd3('0x39')]('\x22'+_0x10ac8f+'\x22');}}else{switch(_0x3ced41){case'firstName':case'phone':_0x43045f['push'](_0x3ced41+_0xcdd3('0x53'));break;default:_0x139e51[_0xcdd3('0x39')]('\x22\x22');}}}}if(_0x43045f[_0xcdd3('0x46')]){handleError(_0x53f041['data'][_0x10fc98],{'code':_0xcdd3('0x54'),'message':_0x43045f[_0xcdd3('0x13')]()});}else{fs[_0xcdd3('0x55')](_0x3d05e6,_0x139e51[_0xcdd3('0x13')]()+'\x0a');}_0x139e51=[];}if(!(stats[_0xcdd3('0x47')]%0xc8)){socket[_0xcdd3('0x56')](_0xcdd3('0x57')+_0x55ae75,stats);stats[_0xcdd3('0x38')]=[];}}if(stopped){logger['info'](_0xcdd3('0x58'));_0x24c752[_0xcdd3('0x59')]();}}catch(_0x158d78){handleError(_0x53f041[_0xcdd3('0x45')][_0x10fc98],{'code':_0xcdd3('0x5a'),'message':_0x158d78[_0xcdd3('0x36')]});logger['error']('step',_0x158d78[_0xcdd3('0x36')]);}},'complete':function(){try{var _0x31d5f7=[];var _0x27e4ad='cm_contacts';if(_0x4e33d2[_0xcdd3('0x5b')]&&_0x4e33d2[_0xcdd3('0x5b')][_0xcdd3('0x46')]){_0x27e4ad=_0xcdd3('0x5c')+_0x55ae75;_0x31d5f7[_0xcdd3('0x39')](_0xcdd3('0x5d')+_0x27e4ad+_0xcdd3('0x5e'));}var _0xf9c755=util['format'](_0xcdd3('0x5f'),_0x3d05e6,_0x27e4ad,_0x372b0a,_0x4e33d2[_0xcdd3('0x2c')],_0x4e33d2[_0xcdd3('0x30')]||null,NOW,NOW);if(_[_0xcdd3('0x60')](_0x4489b2[_0xcdd3('0x61')])){_0xf9c755+=',\x20scheduledAt\x20=\x20NOW()';}_0x31d5f7[_0xcdd3('0x39')](_0xf9c755);if(_0x4e33d2[_0xcdd3('0x5b')]&&_0x4e33d2[_0xcdd3('0x5b')]['length']){_0x31d5f7[_0xcdd3('0x39')](insertCmContact(_0x4e33d2[_0xcdd3('0x2c')],_0x27e4ad,_0x4e33d2[_0xcdd3('0x5b')],_0x4489b2));_0x31d5f7[_0xcdd3('0x39')](_0xcdd3('0x62')+_0x27e4ad+';');}_0x31d5f7[_0xcdd3('0x39')](insertCmHopper(_0x4e33d2[_0xcdd3('0x2c')],_0xcdd3('0x63'),_0xcdd3('0x64'),_0xcdd3('0x65'),_0x96b228));_0x31d5f7['push'](insertCmHopperBlack(_0x4e33d2[_0xcdd3('0x2c')],_0xcdd3('0x66'),_0xcdd3('0x64'),_0xcdd3('0x65')));_0x31d5f7['push'](insertCmHopper(_0x4e33d2[_0xcdd3('0x2c')],_0xcdd3('0x67'),_0xcdd3('0x68'),_0xcdd3('0x69'),_0x96b228));_0x31d5f7[_0xcdd3('0x39')](insertCmHopperBlack(_0x4e33d2[_0xcdd3('0x2c')],'campaigns_has_cm_blacklists',_0xcdd3('0x68'),'CampaignId'));BPromise[_0xcdd3('0x6a')](_0x31d5f7,handleQuery)[_0xcdd3('0x6b')](function(_0x43b3e2){stats[_0xcdd3('0x6c')]=!![];stats[_0xcdd3('0x6d')]=_0x4e33d2[_0xcdd3('0x5b')]&&_0x4e33d2['duplicates']['length']?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0xcdd3('0x56')]('contact:import:'+_0x55ae75,stats);fs[_0xcdd3('0x6e')](_0x267f80);fs[_0xcdd3('0x6e')](_0x3d05e6);process[_0xcdd3('0x37')](0x0);})[_0xcdd3('0x3c')](function(_0x3ca9d5){logger[_0xcdd3('0x3d')](_0x3ca9d5['message']);process['exit'](0x1);});}catch(_0x1a329b){logger[_0xcdd3('0x3d')](_0xcdd3('0x6f'),_0x1a329b[_0xcdd3('0x36')]);process[_0xcdd3('0x37')](0x1);}},'error':function(_0x128d0f,_0xa7b8d4,_0x2744df,_0x2d8de8){throw new Error(_0x2d8de8);}});}function validate(){if(process[_0xcdd3('0x70')]&&process[_0xcdd3('0x70')][_0xcdd3('0x46')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x14261c=path[_0xcdd3('0x13')](config[_0xcdd3('0x41')],_0xcdd3('0x42'),process[_0xcdd3('0x70')][0x2]);if(!fs['existsSync'](_0x14261c)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2eaaad={};try{_0x2eaaad=JSON[_0xcdd3('0x71')](process[_0xcdd3('0x70')][0x3]);if(!_0x2eaaad[_0xcdd3('0x72')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2eaaad[_0xcdd3('0x72')][_0xcdd3('0x11')]){throw new Error(_0xcdd3('0x73'));}if(!_0x2eaaad[_0xcdd3('0x72')][_0xcdd3('0x74')]){throw new Error(_0xcdd3('0x75'));}var _0x4534e2=0x0;if(_0x2eaaad['binding'][_0xcdd3('0x1d')]){_0x4534e2=0x1;}if(!_0x2eaaad['ListId']){throw new Error(_0xcdd3('0x76'));}}catch(_0xe2f91f){throw new Error('body\x20id\x20mandatory');}var _0x319ced=[];try{_0x319ced=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x2da6de){logger[_0xcdd3('0x35')](_0xcdd3('0x77'));}main(_0x14261c,_0x2eaaad,_0x319ced,_0x4534e2);}validate();process['on']('SIGINT',handleStop);process['on'](_0xcdd3('0x78'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 8b13fe0..767f293 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 _0x702d=['push','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To','queue','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','Date','Answer\x20Time','Complete\x20Time','getSubjects','string','toLowerCase','voice','inbound','variable'];(function(_0xe47347,_0x39aa46){var _0x335764=function(_0x2090c2){while(--_0x2090c2){_0xe47347['push'](_0xe47347['shift']());}};_0x335764(++_0x39aa46);}(_0x702d,0x147));var _0xd702=function(_0x12d1c1,_0x42bb3a){_0x12d1c1=_0x12d1c1-0x0;var _0x392c7b=_0x702d[_0x12d1c1];return _0x392c7b;};'use strict';exports[_0xd702('0x0')]=function(_0x3df704,_0x37c2c5){var _0x33e7c5=[{'type':_0xd702('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x3df704[_0xd702('0x2')]()){case _0xd702('0x3'):switch(_0x37c2c5[_0xd702('0x2')]()){case _0xd702('0x4'):_0x33e7c5['push']({'type':_0xd702('0x5'),'content':'','variableName':'queue'});_0x33e7c5[_0xd702('0x6')]({'type':_0xd702('0x5'),'content':'','variableName':_0xd702('0x7')});break;case'outbound':_0x33e7c5[_0xd702('0x6')]({'type':'string','content':_0xd702('0x8'),'variableName':null});_0x33e7c5[_0xd702('0x6')]({'type':_0xd702('0x5'),'content':'','variableName':_0xd702('0x9')});break;}}return _0x33e7c5;};exports[_0xd702('0xa')]=function(_0x2a1f0d,_0x178ad6){var _0x1988eb=[];switch(_0x2a1f0d[_0xd702('0x2')]()){case _0xd702('0x3'):switch(_0x178ad6['toLowerCase']()){case'inbound':_0x1988eb=[{'type':_0xd702('0x1'),'content':_0xd702('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xd702('0xc'),'content':'','key':'Caller\x20Number','keyType':_0xd702('0x5'),'variableName':_0xd702('0x7')},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0xd'),'keyType':_0xd702('0x5'),'variableName':_0xd702('0xe')},{'type':'keyValue','content':'','key':_0xd702('0xf'),'keyType':_0xd702('0x5'),'variableName':'destexten'},{'type':_0xd702('0xc'),'content':'','key':'Queue','keyType':_0xd702('0x5'),'variableName':_0xd702('0x10')},{'type':'keyValue','content':'','key':_0xd702('0x11'),'keyType':_0xd702('0x5'),'variableName':_0xd702('0x12')},{'type':'keyValue','content':'','key':'Date','keyType':_0xd702('0x5'),'variableName':'agentcalledAt'},{'type':_0xd702('0x1'),'content':_0xd702('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x14'),'keyType':_0xd702('0x5'),'variableName':_0xd702('0x15')},{'type':_0xd702('0xc'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':'destcalleridnum'},{'type':_0xd702('0x1'),'content':_0xd702('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xd702('0x17'),'keyType':'variable','variableName':_0xd702('0x18')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0xd702('0x19')},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x1a'),'keyType':'variable','variableName':_0xd702('0x1b')},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x1c'),'keyType':_0xd702('0x5'),'variableName':_0xd702('0x1d')},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x1e'),'keyType':_0xd702('0x5'),'variableName':_0xd702('0x1f')}];break;case'outbound':_0x1988eb=[{'type':_0xd702('0x1'),'content':_0xd702('0xb'),'variableName':null},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x20'),'keyType':_0xd702('0x5'),'keyContent':'','variableName':_0xd702('0x9')},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x21'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x11'),'keyType':'variable','keyContent':'','variableName':_0xd702('0x12')},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x22'),'keyType':_0xd702('0x5'),'keyContent':'','variableName':'starttime'},{'type':_0xd702('0x1'),'content':_0xd702('0x16')},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x23'),'keyType':_0xd702('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0xd702('0xc'),'content':'','key':_0xd702('0x24'),'keyType':_0xd702('0x5'),'keyContent':'','variableName':'endtime'}];break;}}return _0x1988eb;}; \ No newline at end of file +var _0xdace=['Complete\x20Time','endtime','getSubjects','string','toLowerCase','voice','inbound','variable','queue','push','calleridnum','outbound','Outbound\x20Call','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','starttime','Answer\x20Time','answertime'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xdace,0xc5));var _0xedac=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0xdace[_0x138d06];return _0x1a01eb;};'use strict';exports[_0xedac('0x0')]=function(_0x4aa277,_0x1c76b2){var _0x13adb5=[{'type':_0xedac('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x4aa277[_0xedac('0x2')]()){case _0xedac('0x3'):switch(_0x1c76b2[_0xedac('0x2')]()){case _0xedac('0x4'):_0x13adb5['push']({'type':_0xedac('0x5'),'content':'','variableName':_0xedac('0x6')});_0x13adb5[_0xedac('0x7')]({'type':'variable','content':'','variableName':_0xedac('0x8')});break;case _0xedac('0x9'):_0x13adb5[_0xedac('0x7')]({'type':'string','content':_0xedac('0xa'),'variableName':null});_0x13adb5[_0xedac('0x7')]({'type':_0xedac('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x13adb5;};exports['getDescriptions']=function(_0x144368,_0x2ea11d){var _0x57e1bf=[];switch(_0x144368['toLowerCase']()){case _0xedac('0x3'):switch(_0x2ea11d[_0xedac('0x2')]()){case'inbound':_0x57e1bf=[{'type':_0xedac('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xedac('0xb'),'content':'','key':_0xedac('0xc'),'keyType':_0xedac('0x5'),'variableName':_0xedac('0x8')},{'type':_0xedac('0xb'),'content':'','key':_0xedac('0xd'),'keyType':_0xedac('0x5'),'variableName':_0xedac('0xe')},{'type':'keyValue','content':'','key':_0xedac('0xf'),'keyType':_0xedac('0x5'),'variableName':_0xedac('0x10')},{'type':_0xedac('0xb'),'content':'','key':_0xedac('0x11'),'keyType':'variable','variableName':_0xedac('0x6')},{'type':'keyValue','content':'','key':_0xedac('0x12'),'keyType':_0xedac('0x5'),'variableName':_0xedac('0x13')},{'type':_0xedac('0xb'),'content':'','key':'Date','keyType':'variable','variableName':_0xedac('0x14')},{'type':_0xedac('0x1'),'content':_0xedac('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xedac('0xb'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0xedac('0x16')},{'type':_0xedac('0xb'),'content':'','key':_0xedac('0x17'),'keyType':_0xedac('0x5'),'variableName':_0xedac('0x18')},{'type':_0xedac('0x1'),'content':_0xedac('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xedac('0xb'),'content':'','key':'Agent\x20Ring','keyType':_0xedac('0x5'),'variableName':'agentcalledAt'},{'type':_0xedac('0xb'),'content':'','key':_0xedac('0x1a'),'keyType':'variable','variableName':_0xedac('0x1b')},{'type':_0xedac('0xb'),'content':'','key':_0xedac('0x1c'),'keyType':_0xedac('0x5'),'variableName':_0xedac('0x1d')},{'type':_0xedac('0xb'),'content':'','key':'Hold\x20Time','keyType':_0xedac('0x5'),'variableName':_0xedac('0x1e')},{'type':_0xedac('0xb'),'content':'','key':_0xedac('0x1f'),'keyType':_0xedac('0x5'),'variableName':_0xedac('0x20')}];break;case _0xedac('0x9'):_0x57e1bf=[{'type':_0xedac('0x1'),'content':_0xedac('0x21'),'variableName':null},{'type':_0xedac('0xb'),'content':'','key':'Called\x20Number','keyType':_0xedac('0x5'),'keyContent':'','variableName':_0xedac('0x18')},{'type':_0xedac('0xb'),'content':'','key':'Member\x20Name','keyType':_0xedac('0x5'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0xedac('0x12'),'keyType':_0xedac('0x5'),'keyContent':'','variableName':_0xedac('0x13')},{'type':_0xedac('0xb'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xedac('0x22')},{'type':_0xedac('0x1'),'content':_0xedac('0x19')},{'type':_0xedac('0xb'),'content':'','key':_0xedac('0x23'),'keyType':_0xedac('0x5'),'keyContent':'','variableName':_0xedac('0x24')},{'type':'keyValue','content':'','key':_0xedac('0x25'),'keyType':_0xedac('0x5'),'keyContent':'','variableName':_0xedac('0x26')}];break;}}return _0x57e1bf;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 3a13dbb..c487c52 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 _0x0241=['mail-interactions','fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','Interaction','findOne','then','update','info','error','query','clone','body','html','phone','fax','lodash','../../config/logger','openchannel-interactions'];(function(_0x533ebd,_0x42c15e){var _0x1324f1=function(_0x1ccdb0){while(--_0x1ccdb0){_0x533ebd['push'](_0x533ebd['shift']());}};_0x1324f1(++_0x42c15e);}(_0x0241,0x65));var _0x1024=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0241[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x1024('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x1024('0x1'))(_0x1024('0x2')),'mail':require(_0x1024('0x1'))(_0x1024('0x3')),'fax':require('../../config/logger')(_0x1024('0x4')),'sms':require(_0x1024('0x1'))(_0x1024('0x5')),'chat':require(_0x1024('0x1'))('chat-interactions')};function getInteractionId(_0x50a707,_0x3c605f,_0x4d2ae0){if(_0x50a707&&_0x50a707[_[_0x1024('0x6')](_0x4d2ae0)+_0x1024('0x7')]){return _0x50a707[_['upperFirst'](_0x4d2ae0)+_0x1024('0x7')];}else if(_0x50a707&&_0x50a707['id']){return _0x50a707['id'];}else if(_0x3c605f&&_0x3c605f['id']){return _0x3c605f['id'];}else{return _0x1024('0x8');}}function log(_0x4cc739,_0x4b8860,_0xdac691,_0x183476,_0x45e620,_0x58b88e){loggers[_0x45e620[_0x1024('0x9')]()][_0x4cc739](_0x1024('0xa'),_0x58b88e['toUpperCase'](),_0x4b8860?_0x4b8860['id']:null,_0x4b8860?_0x4b8860[_0x1024('0xb')]:null,_0x4b8860?_0x4b8860[_0x1024('0xc')]:null,getInteractionId(_0xdac691,_0x183476,_0x45e620),_0xdac691?JSON[_0x1024('0xd')](_0xdac691):'null');}function updateUser(_0x24723a,_0x59fa9a,_0x4f0de7,_0x449d7e,_0x4287ce){db[_[_0x1024('0x6')](_0x449d7e)+_0x1024('0xe')][_0x1024('0xf')]({'where':{'id':getInteractionId(_0x59fa9a,_0x4f0de7,_0x449d7e)}})[_0x1024('0x10')](function(_0x4001ee){if(_0x4001ee){return _0x4001ee[_0x1024('0x11')]({'UserId':_0x24723a?_0x24723a['id']:null});}})[_0x1024('0x10')](function(_0x5d2bcd){if(_0x5d2bcd){log(_0x1024('0x12'),_0x24723a,_0x59fa9a,_0x4f0de7,_0x449d7e,_0x4287ce);}})['catch'](function(){log(_0x1024('0x13'),_0x24723a,_0x59fa9a,_0x4f0de7,_0x449d7e,_0x4287ce);});}exports['tracked']=function(_0x5e7022,_0x512783){return function(_0xe97216,_0x42faf0,_0x2049a6){var _0x4a27d7=_0xe97216['user'];var _0x320329={};var _0x373e6f=_0xe97216[_0x1024('0x14')];if(_0x320329){_0x320329=_[_0x1024('0x15')](_0xe97216[_0x1024('0x16')]);_0x320329=_['omit'](_0x320329,['body',_0x1024('0x17'),_0x1024('0x18'),_0x1024('0x19'),'mobile']);}updateUser(_0x4a27d7,_0x320329,_0x373e6f,_0x5e7022,_0x512783);_0x2049a6(null);};}; \ No newline at end of file +var _0x6f88=['fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','name','role','stringify','Interaction','findOne','then','catch','error','tracked','user','query','body','omit','html','fax','lodash','../../mysqldb','../../config/logger','openchannel-interactions'];(function(_0x3901ba,_0x591da1){var _0x3ea39f=function(_0x509074){while(--_0x509074){_0x3901ba['push'](_0x3901ba['shift']());}};_0x3ea39f(++_0x591da1);}(_0x6f88,0x134));var _0x86f8=function(_0x5f5a1e,_0x2618a8){_0x5f5a1e=_0x5f5a1e-0x0;var _0x3a66cf=_0x6f88[_0x5f5a1e];return _0x3a66cf;};'use strict';var _=require(_0x86f8('0x0'));var db=require(_0x86f8('0x1'))['db'];var loggers={'openchannel':require(_0x86f8('0x2'))(_0x86f8('0x3')),'mail':require(_0x86f8('0x2'))('mail-interactions'),'fax':require(_0x86f8('0x2'))(_0x86f8('0x4')),'sms':require(_0x86f8('0x2'))(_0x86f8('0x5')),'chat':require(_0x86f8('0x2'))(_0x86f8('0x6'))};function getInteractionId(_0x53b79b,_0x2368c4,_0x800ce3){if(_0x53b79b&&_0x53b79b[_[_0x86f8('0x7')](_0x800ce3)+_0x86f8('0x8')]){return _0x53b79b[_[_0x86f8('0x7')](_0x800ce3)+_0x86f8('0x8')];}else if(_0x53b79b&&_0x53b79b['id']){return _0x53b79b['id'];}else if(_0x2368c4&&_0x2368c4['id']){return _0x2368c4['id'];}else{return _0x86f8('0x9');}}function log(_0x5666ea,_0x415d2d,_0x39218f,_0x3f99a5,_0x3a06d0,_0x23083e){loggers[_0x3a06d0[_0x86f8('0xa')]()][_0x5666ea]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23083e['toUpperCase'](),_0x415d2d?_0x415d2d['id']:null,_0x415d2d?_0x415d2d[_0x86f8('0xb')]:null,_0x415d2d?_0x415d2d[_0x86f8('0xc')]:null,getInteractionId(_0x39218f,_0x3f99a5,_0x3a06d0),_0x39218f?JSON[_0x86f8('0xd')](_0x39218f):'null');}function updateUser(_0xee5db8,_0x172aca,_0xcf8ec9,_0x19371f,_0x480651){db[_['upperFirst'](_0x19371f)+_0x86f8('0xe')][_0x86f8('0xf')]({'where':{'id':getInteractionId(_0x172aca,_0xcf8ec9,_0x19371f)}})[_0x86f8('0x10')](function(_0x478da2){if(_0x478da2){return _0x478da2['update']({'UserId':_0xee5db8?_0xee5db8['id']:null});}})['then'](function(_0xd4bac1){if(_0xd4bac1){log('info',_0xee5db8,_0x172aca,_0xcf8ec9,_0x19371f,_0x480651);}})[_0x86f8('0x11')](function(){log(_0x86f8('0x12'),_0xee5db8,_0x172aca,_0xcf8ec9,_0x19371f,_0x480651);});}exports[_0x86f8('0x13')]=function(_0x43cc94,_0x52bc7c){return function(_0x3d4209,_0x23fe47,_0x1186fd){var _0x3ad419=_0x3d4209[_0x86f8('0x14')];var _0x346f78={};var _0x120b50=_0x3d4209[_0x86f8('0x15')];if(_0x346f78){_0x346f78=_['clone'](_0x3d4209[_0x86f8('0x16')]);_0x346f78=_[_0x86f8('0x17')](_0x346f78,[_0x86f8('0x16'),_0x86f8('0x18'),'phone',_0x86f8('0x19'),'mobile']);}updateUser(_0x3ad419,_0x346f78,_0x120b50,_0x43cc94,_0x52bc7c);_0x1186fd(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 8d3cf71..6eb59d2 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 _0x8a59=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8','parse','use','License','findOne','count','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','../../mysqldb','data1','license'];(function(_0x37e82b,_0x4400ec){var _0x940bf6=function(_0x314581){while(--_0x314581){_0x37e82b['push'](_0x37e82b['shift']());}};_0x940bf6(++_0x4400ec);}(_0x8a59,0x1a5));var _0x98a5=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x8a59[_0xf0bcac];return _0x4e4c65;};'use strict';var crypto=require(_0x98a5('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x98a5('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2c3563,_0x5d71ae){if(_0x2c3563&&_0x5d71ae){if(_0x5d71ae[_0x98a5('0x2')]&&_0x5d71ae['license']){var _0x2f881d=_0x5d71ae[_0x98a5('0x2')];var _0x37674d=_0x5d71ae[_0x98a5('0x3')];var _0x491545=_0x2f881d[_0x98a5('0x4')]('-')[0x4];var _0x49657c=_0x2f881d[_0x98a5('0x4')]('-')[0x0];var _0x51984c=crypto[_0x98a5('0x5')](_0x98a5('0x6'),util[_0x98a5('0x7')](_0x98a5('0x8'),_0x491545,_0x2f881d,_0x49657c));var _0x57722d=_0x51984c['update'](_0x37674d,'base64','utf8');_0x57722d+=_0x51984c['final'](_0x98a5('0x9'));var _0x333eb6=JSON[_0x98a5('0xa')](_0x57722d);return _0x333eb6['hasOwnProperty'](_0x2c3563)?_0x333eb6[_0x2c3563]:null;}}return null;}function isLimit(_0x2d6895,_0x5c5e63,_0x55dc31,_0x570b8d){var _0x32fed8=_0x5c5e63;return compose()[_0x98a5('0xb')](function(_0x3a8ec7,_0x461c39,_0x3eaab9){return db[_0x98a5('0xc')][_0x98a5('0xd')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x45aa99){var _0xbbf3e5=getValueFromLicense(_0x2d6895,_0x45aa99);return _0xbbf3e5?_0xbbf3e5:_0x32fed8;})['then'](function(_0x4e9e16){_0x32fed8=_0x4e9e16;return _0x55dc31[_0x98a5('0xe')](_0x570b8d);})[_0x98a5('0xf')](function(_0x169f52){if(_0x169f52>=_0x32fed8){return _0x461c39[_0x98a5('0x10')](0x193)[_0x98a5('0x11')]({'message':util[_0x98a5('0x7')](_0x98a5('0x12'),_0x2d6895)});}_0x3eaab9();})[_0x98a5('0x13')](function(_0xadefcd){_0x3eaab9(_0xadefcd);});});}function isUserLimit(){return isLimit(_0x98a5('0x14'),0x1,db[_0x98a5('0x15')],{'where':{'$or':[{'role':_0x98a5('0x16')},{'role':_0x98a5('0x17')}]}});}exports[_0x98a5('0x18')]=isUserLimit; \ No newline at end of file +var _0x88ed=['final','parse','hasOwnProperty','use','License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','user','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8'];(function(_0x3a2a17,_0xf10411){var _0x404d59=function(_0x407e0a){while(--_0x407e0a){_0x3a2a17['push'](_0x3a2a17['shift']());}};_0x404d59(++_0xf10411);}(_0x88ed,0x15d));var _0xd88e=function(_0x2bae8c,_0x86c9ab){_0x2bae8c=_0x2bae8c-0x0;var _0x48d7ad=_0x88ed[_0x2bae8c];return _0x48d7ad;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xd88e('0x0'));var db=require(_0xd88e('0x1'))['db'];var config=require(_0xd88e('0x2'));function getValueFromLicense(_0x556ce0,_0x279f4e){if(_0x556ce0&&_0x279f4e){if(_0x279f4e['data1']&&_0x279f4e[_0xd88e('0x3')]){var _0x57d7e6=_0x279f4e[_0xd88e('0x4')];var _0x2104af=_0x279f4e[_0xd88e('0x3')];var _0x3ce061=_0x57d7e6[_0xd88e('0x5')]('-')[0x4];var _0x493308=_0x57d7e6['split']('-')[0x0];var _0x478181=crypto[_0xd88e('0x6')](_0xd88e('0x7'),util[_0xd88e('0x8')](_0xd88e('0x9'),_0x3ce061,_0x57d7e6,_0x493308));var _0x4878c8=_0x478181['update'](_0x2104af,'base64',_0xd88e('0xa'));_0x4878c8+=_0x478181[_0xd88e('0xb')]('utf8');var _0x2da5aa=JSON[_0xd88e('0xc')](_0x4878c8);return _0x2da5aa[_0xd88e('0xd')](_0x556ce0)?_0x2da5aa[_0x556ce0]:null;}}return null;}function isLimit(_0x297d0e,_0x474abf,_0x2ce888,_0x252e94){var _0xf2e2fa=_0x474abf;return compose()[_0xd88e('0xe')](function(_0x4dd977,_0x813520,_0x17dfa6){return db[_0xd88e('0xf')][_0xd88e('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xd88e('0x11')](function(_0x475bad){var _0x471efc=getValueFromLicense(_0x297d0e,_0x475bad);return _0x471efc?_0x471efc:_0xf2e2fa;})[_0xd88e('0x11')](function(_0x53b707){_0xf2e2fa=_0x53b707;return _0x2ce888['count'](_0x252e94);})[_0xd88e('0x11')](function(_0x437e56){if(_0x437e56>=_0xf2e2fa){return _0x813520['status'](0x193)[_0xd88e('0x12')]({'message':util[_0xd88e('0x8')](_0xd88e('0x13'),_0x297d0e)});}_0x17dfa6();})['catch'](function(_0x4f72e4){_0x17dfa6(_0x4f72e4);});});}function isUserLimit(){return isLimit(_0xd88e('0x14'),0x1,db[_0xd88e('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0xd88e('0x16')}]}});}exports[_0xd88e('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index b56e10c..08eed5e 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 _0x37aa=['isString','isArray','unset','hasOwnProperty','lodash','sequelize','fields','split','filters','isEmpty','parse','limit','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','length','omit','isObject'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0x37aa,0x124));var _0xa37a=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0x37aa[_0x29d2d2];return _0x3f6476;};'use strict';var _=require(_0xa37a('0x0'));var sequelize=require(_0xa37a('0x1'));var LIMIT_VALUE=0xfa;exports[_0xa37a('0x2')]=function(_0x39775c){var _0x40ea4a=null;if(_0x39775c){_0x40ea4a=_0x39775c[_0xa37a('0x3')](',');}return _0x40ea4a;};exports[_0xa37a('0x4')]=function(_0x20d336){var _0x40dfc9={};if(!_[_0xa37a('0x5')](_0x20d336)){_0x40dfc9={};_['forOwn'](_0x20d336,function(_0x38d298,_0x1e7c82){try{_0x40dfc9[_0x1e7c82]=JSON[_0xa37a('0x6')](_0x38d298);}catch(_0x36eb37){_0x40dfc9[_0x1e7c82]=_0x38d298[_0xa37a('0x3')](',');}});}return _0x40dfc9;};exports[_0xa37a('0x7')]=function(_0x426633){_0x426633=parseInt(_0x426633,0xa);if(!_0x426633||_0x426633<0x0){_0x426633=LIMIT_VALUE;}return _0x426633;};exports['offset']=function(_0x5a5b0e){_0x5a5b0e=parseInt(_0x5a5b0e,0xa);if(!_0x5a5b0e||_0x5a5b0e<0x0){_0x5a5b0e=0x0;}return _0x5a5b0e;};exports[_0xa37a('0x8')]=function(_0x5ae6cb){var _0x3d3c5c,_0x9820ba=null;if(_0x5ae6cb){_0x3d3c5c=_0x5ae6cb[_0xa37a('0x3')](',');_0x9820ba=_[_0xa37a('0x9')](_0x3d3c5c,function(_0x46b38f){if(_0x46b38f[_0xa37a('0xa')]('-')===0x0){return[_0x46b38f===_0xa37a('0xb')?sequelize[_0xa37a('0xc')](sequelize['col'](_0xa37a('0xb')),_0xa37a('0xd')):_0x46b38f[_0xa37a('0xe')](0x1),_0xa37a('0xf')];}else{return[_0x46b38f==='priority'?sequelize[_0xa37a('0xc')](sequelize[_0xa37a('0x10')](_0xa37a('0xb')),'unsigned'):_0x46b38f,'ASC'];}});}return _0x9820ba;};exports['omit']=function(_0x5bcf01,_0xfc0470){if(_['isEmpty'](_0x5bcf01)){return _0x5bcf01;}if(_['isArray'](_0x5bcf01)){for(var _0x376a4f=0x0;_0x376a4f<_0x5bcf01[_0xa37a('0x11')];_0x376a4f+=0x1){_0x5bcf01[_0x376a4f]=this[_0xa37a('0x12')](_0x5bcf01[_0x376a4f],_0xfc0470);}return _0x5bcf01;}if(!_[_0xa37a('0x13')](_0x5bcf01)){return _0x5bcf01;}if(_[_0xa37a('0x14')](_0xfc0470)){_0xfc0470=[_0xfc0470];}if(!_[_0xa37a('0x15')](_0xfc0470)){return _0x5bcf01;}for(var _0x134689=0x0;_0x134689<_0xfc0470['length'];_0x134689+=0x1){_[_0xa37a('0x16')](_0x5bcf01,_0xfc0470[_0x134689]);}for(var _0x7ba5f2 in _0x5bcf01){if(_0x5bcf01[_0xa37a('0x17')](_0x7ba5f2)){_0x5bcf01[_0x7ba5f2]=this['omit'](_0x5bcf01[_0x7ba5f2],_0xfc0470);}}return _0x5bcf01;}; \ No newline at end of file +var _0xfddb=['isEmpty','isArray','length','isObject','isString','unset','sequelize','fields','split','forOwn','limit','offset','map','indexOf','priority','col','unsigned','substr','ASC','omit'];(function(_0x3370b5,_0x1a2130){var _0x4270be=function(_0x5f4b4e){while(--_0x5f4b4e){_0x3370b5['push'](_0x3370b5['shift']());}};_0x4270be(++_0x1a2130);}(_0xfddb,0x16e));var _0xbfdd=function(_0x14d1b2,_0x4f6472){_0x14d1b2=_0x14d1b2-0x0;var _0x34c82b=_0xfddb[_0x14d1b2];return _0x34c82b;};'use strict';var _=require('lodash');var sequelize=require(_0xbfdd('0x0'));var LIMIT_VALUE=0xfa;exports[_0xbfdd('0x1')]=function(_0x4bb47e){var _0xf31d51=null;if(_0x4bb47e){_0xf31d51=_0x4bb47e[_0xbfdd('0x2')](',');}return _0xf31d51;};exports['filters']=function(_0x1c1e0c){var _0x295c92={};if(!_['isEmpty'](_0x1c1e0c)){_0x295c92={};_[_0xbfdd('0x3')](_0x1c1e0c,function(_0x5becd6,_0x540f9e){try{_0x295c92[_0x540f9e]=JSON['parse'](_0x5becd6);}catch(_0x1fc055){_0x295c92[_0x540f9e]=_0x5becd6['split'](',');}});}return _0x295c92;};exports[_0xbfdd('0x4')]=function(_0x3ca597){_0x3ca597=parseInt(_0x3ca597,0xa);if(!_0x3ca597||_0x3ca597<0x0){_0x3ca597=LIMIT_VALUE;}return _0x3ca597;};exports[_0xbfdd('0x5')]=function(_0x4b78ad){_0x4b78ad=parseInt(_0x4b78ad,0xa);if(!_0x4b78ad||_0x4b78ad<0x0){_0x4b78ad=0x0;}return _0x4b78ad;};exports['sort']=function(_0x54cc21){var _0x6585f7,_0x20c2fd=null;if(_0x54cc21){_0x6585f7=_0x54cc21[_0xbfdd('0x2')](',');_0x20c2fd=_[_0xbfdd('0x6')](_0x6585f7,function(_0x28c358){if(_0x28c358[_0xbfdd('0x7')]('-')===0x0){return[_0x28c358===_0xbfdd('0x8')?sequelize['cast'](sequelize[_0xbfdd('0x9')](_0xbfdd('0x8')),_0xbfdd('0xa')):_0x28c358[_0xbfdd('0xb')](0x1),'DESC'];}else{return[_0x28c358===_0xbfdd('0x8')?sequelize['cast'](sequelize['col'](_0xbfdd('0x8')),_0xbfdd('0xa')):_0x28c358,_0xbfdd('0xc')];}});}return _0x20c2fd;};exports[_0xbfdd('0xd')]=function(_0x20e9d8,_0x69d1){if(_[_0xbfdd('0xe')](_0x20e9d8)){return _0x20e9d8;}if(_[_0xbfdd('0xf')](_0x20e9d8)){for(var _0x388edd=0x0;_0x388edd<_0x20e9d8[_0xbfdd('0x10')];_0x388edd+=0x1){_0x20e9d8[_0x388edd]=this[_0xbfdd('0xd')](_0x20e9d8[_0x388edd],_0x69d1);}return _0x20e9d8;}if(!_[_0xbfdd('0x11')](_0x20e9d8)){return _0x20e9d8;}if(_[_0xbfdd('0x12')](_0x69d1)){_0x69d1=[_0x69d1];}if(!_[_0xbfdd('0xf')](_0x69d1)){return _0x20e9d8;}for(var _0x167bd2=0x0;_0x167bd2<_0x69d1['length'];_0x167bd2+=0x1){_[_0xbfdd('0x13')](_0x20e9d8,_0x69d1[_0x167bd2]);}for(var _0x394365 in _0x20e9d8){if(_0x20e9d8['hasOwnProperty'](_0x394365)){_0x20e9d8[_0x394365]=this[_0xbfdd('0xd')](_0x20e9d8[_0x394365],_0x69d1);}}return _0x20e9d8;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ab6d8ea..3d09f5c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60b3=['sessions','Session','sync','secrets','session','express','serve-favicon','cookie-parser','path','passport','cors','express-sequelize-session','moment','./environment','../mysqldb','Store','default','get','use','join','root','favicon.ico','set','appPath','public','development','test','client','json\x20replacer','toISOString','split','static','views','/server/views','html','renderFile','view\x20engine','urlencoded','50mb','initialize'];(function(_0x578179,_0x44eea5){var _0xfd0add=function(_0x481fbd){while(--_0x481fbd){_0x578179['push'](_0x578179['shift']());}};_0xfd0add(++_0x44eea5);}(_0x60b3,0x145));var _0x360b=function(_0x24c405,_0x56d6fb){_0x24c405=_0x24c405-0x0;var _0x383aef=_0x60b3[_0x24c405];return _0x383aef;};'use strict';var express=require(_0x360b('0x0'));var favicon=require(_0x360b('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x360b('0x2'));var errorHandler=require('errorhandler');var path=require(_0x360b('0x3'));var passport=require(_0x360b('0x4'));var session=require('express-session');var cors=require(_0x360b('0x5'));var expressSequelizeSession=require(_0x360b('0x6'));var moment=require(_0x360b('0x7'));var config=require(_0x360b('0x8'));var db=require(_0x360b('0x9'))['db'];var Store=expressSequelizeSession(session[_0x360b('0xa')]);exports[_0x360b('0xb')]=function(_0x68bbf4){var _0x2a300f=_0x68bbf4[_0x360b('0xc')]('env');if(_0x2a300f==='production'){_0x68bbf4[_0x360b('0xd')](favicon(path[_0x360b('0xe')](config[_0x360b('0xf')],'public',_0x360b('0x10'))));_0x68bbf4[_0x360b('0x11')](_0x360b('0x12'),path['join'](config[_0x360b('0xf')],_0x360b('0x13')));}if(_0x2a300f===_0x360b('0x14')||_0x2a300f===_0x360b('0x15')){_0x68bbf4[_0x360b('0xd')](favicon(path[_0x360b('0xe')](config['root'],'client',_0x360b('0x10'))));_0x68bbf4[_0x360b('0x11')](_0x360b('0x12'),path['join'](config['root'],_0x360b('0x16')));_0x68bbf4['use'](errorHandler());}_0x68bbf4[_0x360b('0x11')](_0x360b('0x17'),function(_0x460de8,_0x31a687){if(this[_0x460de8]instanceof Date){_0x31a687=this[_0x460de8][_0x360b('0x18')]()[_0x360b('0x19')]('.')[0x0]+'Z';}return _0x31a687;});_0x68bbf4[_0x360b('0xd')](express[_0x360b('0x1a')](_0x68bbf4['get'](_0x360b('0x12'))));_0x68bbf4[_0x360b('0x11')](_0x360b('0x1b'),config[_0x360b('0xf')]+_0x360b('0x1c'));_0x68bbf4['engine'](_0x360b('0x1d'),require('ejs')[_0x360b('0x1e')]);_0x68bbf4[_0x360b('0x11')](_0x360b('0x1f'),'html');_0x68bbf4[_0x360b('0xd')](bodyParser[_0x360b('0x20')]({'limit':_0x360b('0x21'),'extended':!![]}));_0x68bbf4['use'](bodyParser['json']({'limit':_0x360b('0x21')}));_0x68bbf4[_0x360b('0xd')](cors());_0x68bbf4['use'](methodOverride());_0x68bbf4['use'](cookieParser());_0x68bbf4[_0x360b('0xd')](passport[_0x360b('0x22')]());var _0xbe0f14=new Store(db['sequelize'],_0x360b('0x23'));_0xbe0f14[_0x360b('0x24')][_0x360b('0x25')]();_0x68bbf4[_0x360b('0xd')](session({'secret':config[_0x360b('0x26')][_0x360b('0x27')],'saveUninitialized':!![],'resave':![],'store':_0xbe0f14}));}; \ No newline at end of file +var _0x522e=['public','favicon.ico','set','appPath','development','test','client','json\x20replacer','toISOString','split','static','views','/server/views','engine','html','ejs','renderFile','view\x20engine','50mb','initialize','sequelize','sessions','secrets','express','serve-favicon','body-parser','method-override','cookie-parser','path','passport','express-session','express-sequelize-session','moment','./environment','../mysqldb','Store','default','get','production','use','join','root'];(function(_0x4b830c,_0x2399de){var _0x274dbc=function(_0x3bc324){while(--_0x3bc324){_0x4b830c['push'](_0x4b830c['shift']());}};_0x274dbc(++_0x2399de);}(_0x522e,0xbf));var _0xe522=function(_0x513f05,_0x850141){_0x513f05=_0x513f05-0x0;var _0x381638=_0x522e[_0x513f05];return _0x381638;};'use strict';var express=require(_0xe522('0x0'));var favicon=require(_0xe522('0x1'));var bodyParser=require(_0xe522('0x2'));var methodOverride=require(_0xe522('0x3'));var cookieParser=require(_0xe522('0x4'));var errorHandler=require('errorhandler');var path=require(_0xe522('0x5'));var passport=require(_0xe522('0x6'));var session=require(_0xe522('0x7'));var cors=require('cors');var expressSequelizeSession=require(_0xe522('0x8'));var moment=require(_0xe522('0x9'));var config=require(_0xe522('0xa'));var db=require(_0xe522('0xb'))['db'];var Store=expressSequelizeSession(session[_0xe522('0xc')]);exports[_0xe522('0xd')]=function(_0x21b4a8){var _0x1f0830=_0x21b4a8[_0xe522('0xe')]('env');if(_0x1f0830===_0xe522('0xf')){_0x21b4a8[_0xe522('0x10')](favicon(path[_0xe522('0x11')](config[_0xe522('0x12')],_0xe522('0x13'),_0xe522('0x14'))));_0x21b4a8[_0xe522('0x15')](_0xe522('0x16'),path['join'](config['root'],_0xe522('0x13')));}if(_0x1f0830===_0xe522('0x17')||_0x1f0830===_0xe522('0x18')){_0x21b4a8[_0xe522('0x10')](favicon(path[_0xe522('0x11')](config[_0xe522('0x12')],_0xe522('0x19'),_0xe522('0x14'))));_0x21b4a8['set'](_0xe522('0x16'),path[_0xe522('0x11')](config[_0xe522('0x12')],_0xe522('0x19')));_0x21b4a8[_0xe522('0x10')](errorHandler());}_0x21b4a8['set'](_0xe522('0x1a'),function(_0x34c7bf,_0x475988){if(this[_0x34c7bf]instanceof Date){_0x475988=this[_0x34c7bf][_0xe522('0x1b')]()[_0xe522('0x1c')]('.')[0x0]+'Z';}return _0x475988;});_0x21b4a8['use'](express[_0xe522('0x1d')](_0x21b4a8[_0xe522('0xe')](_0xe522('0x16'))));_0x21b4a8['set'](_0xe522('0x1e'),config['root']+_0xe522('0x1f'));_0x21b4a8[_0xe522('0x20')](_0xe522('0x21'),require(_0xe522('0x22'))[_0xe522('0x23')]);_0x21b4a8[_0xe522('0x15')](_0xe522('0x24'),_0xe522('0x21'));_0x21b4a8[_0xe522('0x10')](bodyParser['urlencoded']({'limit':_0xe522('0x25'),'extended':!![]}));_0x21b4a8[_0xe522('0x10')](bodyParser['json']({'limit':_0xe522('0x25')}));_0x21b4a8[_0xe522('0x10')](cors());_0x21b4a8['use'](methodOverride());_0x21b4a8[_0xe522('0x10')](cookieParser());_0x21b4a8[_0xe522('0x10')](passport[_0xe522('0x26')]());var _0x42e7a1=new Store(db[_0xe522('0x27')],_0xe522('0x28'));_0x42e7a1['Session']['sync']();_0x21b4a8[_0xe522('0x10')](session({'secret':config[_0xe522('0x29')]['session'],'saveUninitialized':!![],'resave':![],'store':_0x42e7a1}));}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 98ce59b..f1e469a 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 _0x7380=['concat','mac','address','127.0.0.1','cpus','map','model','join','createHash','md5','update','digest','getUuid','platform','win32','utf8','replace','hostname','macAddress','ipAddress','hex','substring','crypto','bimedia-machine-uuid','orderBy','keys','filter','IPv4','internal'];(function(_0x479bf2,_0x443252){var _0x21fec8=function(_0x98a0f6){while(--_0x98a0f6){_0x479bf2['push'](_0x479bf2['shift']());}};_0x21fec8(++_0x443252);}(_0x7380,0x172));var _0x0738=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x7380[_0x234ae1];return _0x227ba0;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x0738('0x0'));var machine=require(_0x0738('0x1'));var exec=require('child_process')['execSync'];function getInterfaces(){var _0x151b00=[];var _0xdb7ed1=os['networkInterfaces']();var _0x235e91=_[_0x0738('0x2')](_[_0x0738('0x3')](_0xdb7ed1));for(var _0x542810=0x0;_0x542810<_0x235e91['length'];_0x542810++){var _0x53272=_0xdb7ed1[_0x235e91[_0x542810]][_0x0738('0x4')](function(_0x526a56){return _0x526a56['family']===_0x0738('0x5')&&_0x526a56[_0x0738('0x6')]===![];});_0x151b00=_0x151b00[_0x0738('0x7')](_0x53272);}return _0x151b00;}function getFirstInterface(){var _0xb554e3=_['head'](getInterfaces());return{'macAddress':_0xb554e3&&_0xb554e3['mac']?_0xb554e3[_0x0738('0x8')]:'00:00:00:00:00:00','ipAddress':_0xb554e3&&_0xb554e3[_0x0738('0x9')]?_0xb554e3[_0x0738('0x9')]:_0x0738('0xa')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2c4b90=_['orderBy'](os[_0x0738('0xb')]()[_0x0738('0xc')](function(_0x3504f4){return _0x3504f4[_0x0738('0xd')];}))[_0x0738('0xe')](':');return crypto[_0x0738('0xf')](_0x0738('0x10'))[_0x0738('0x11')](_0x2c4b90)[_0x0738('0x12')]('hex');}exports[_0x0738('0x13')]=function(){switch(os[_0x0738('0x14')]()){case _0x0738('0x15'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x0738('0x16')})[_0x0738('0x17')]('\x0d\x0a','');default:var _0x2b8d06=getFirstInterface();var _0x419e33=getCPUhash();var _0xf46ef=_0x419e33+'|'+os[_0x0738('0x18')]()+'|'+_0x2b8d06[_0x0738('0x19')]+'|'+_0x2b8d06[_0x0738('0x1a')];var _0x8b333f=crypto[_0x0738('0xf')](_0x0738('0x10'))['update'](_0xf46ef)['digest'](_0x0738('0x1b'));return _0x8b333f[_0x0738('0x1c')](0x0,0x8)+'-'+_0x8b333f[_0x0738('0x1c')](0x8,0xc)+'-'+_0x8b333f['substring'](0xc,0x10)+'-'+_0x8b333f['substring'](0x10,0x14)+'-'+_0x8b333f[_0x0738('0x1c')](0x14);}}; \ No newline at end of file +var _0x9620=['substring','crypto','child_process','execSync','networkInterfaces','length','filter','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','model','createHash','md5','digest','hex','platform','win32','replace','hostname','macAddress','ipAddress','update'];(function(_0x1cbed9,_0x25c882){var _0x5e8253=function(_0x5585ae){while(--_0x5585ae){_0x1cbed9['push'](_0x1cbed9['shift']());}};_0x5e8253(++_0x25c882);}(_0x9620,0xa9));var _0x0962=function(_0x4f6ba4,_0x59f7d9){_0x4f6ba4=_0x4f6ba4-0x0;var _0x37eac7=_0x9620[_0x4f6ba4];return _0x37eac7;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x0962('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0x0962('0x1'))[_0x0962('0x2')];function getInterfaces(){var _0xdfeca=[];var _0x1fd627=os[_0x0962('0x3')]();var _0xf7064c=_['orderBy'](_['keys'](_0x1fd627));for(var _0x3a4e37=0x0;_0x3a4e37<_0xf7064c[_0x0962('0x4')];_0x3a4e37++){var _0x4591e9=_0x1fd627[_0xf7064c[_0x3a4e37]][_0x0962('0x5')](function(_0x2fd698){return _0x2fd698['family']===_0x0962('0x6')&&_0x2fd698['internal']===![];});_0xdfeca=_0xdfeca['concat'](_0x4591e9);}return _0xdfeca;}function getFirstInterface(){var _0x1aca16=_[_0x0962('0x7')](getInterfaces());return{'macAddress':_0x1aca16&&_0x1aca16[_0x0962('0x8')]?_0x1aca16[_0x0962('0x8')]:_0x0962('0x9'),'ipAddress':_0x1aca16&&_0x1aca16[_0x0962('0xa')]?_0x1aca16[_0x0962('0xa')]:_0x0962('0xb')};}exports[_0x0962('0xc')]=getFirstInterface;function getCPUhash(){var _0x5cff9b=_[_0x0962('0xd')](os[_0x0962('0xe')]()['map'](function(_0x2149c1){return _0x2149c1[_0x0962('0xf')];}))['join'](':');return crypto[_0x0962('0x10')](_0x0962('0x11'))['update'](_0x5cff9b)[_0x0962('0x12')](_0x0962('0x13'));}exports['getUuid']=function(){switch(os[_0x0962('0x14')]()){case _0x0962('0x15'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x0962('0x16')]('\x0d\x0a','');default:var _0x150b5c=getFirstInterface();var _0x5aa400=getCPUhash();var _0x3711cc=_0x5aa400+'|'+os[_0x0962('0x17')]()+'|'+_0x150b5c[_0x0962('0x18')]+'|'+_0x150b5c[_0x0962('0x19')];var _0x1f7228=crypto[_0x0962('0x10')](_0x0962('0x11'))[_0x0962('0x1a')](_0x3711cc)[_0x0962('0x12')]('hex');return _0x1f7228[_0x0962('0x1b')](0x0,0x8)+'-'+_0x1f7228['substring'](0x8,0xc)+'-'+_0x1f7228[_0x0962('0x1b')](0xc,0x10)+'-'+_0x1f7228['substring'](0x10,0x14)+'-'+_0x1f7228[_0x0962('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ea0a845..7be379d 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 _0x597c=['final','createDecipher','update','||FIELD||VALUE||\x0a','User','findOne','admin','email','then','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','openIssue','Motion\x20License\x20Alert','Alert','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','catch','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','https','moment','bluebird','version','../../mysqldb','./hardware','../logger','../../api/jira/jira.controller','format','/api/servers/%s/check?version=%s','exports','setEncoding','utf8','data','end','parse','error','createCipher','aes-256-ctr','secrets','session','base64'];(function(_0x39b95b,_0x2d2f8b){var _0x191091=function(_0x1f455c){while(--_0x1f455c){_0x39b95b['push'](_0x39b95b['shift']());}};_0x191091(++_0x2d2f8b);}(_0x597c,0x1c9));var _0xc597=function(_0xb68ae,_0x2bd5e4){_0xb68ae=_0xb68ae-0x0;var _0x3eb127=_0x597c[_0xb68ae];return _0x3eb127;};'use strict';var util=require(_0xc597('0x0'));var https=require(_0xc597('0x1'));var crypto=require('crypto');var moment=require(_0xc597('0x2'));var BPromise=require(_0xc597('0x3'));var pkginfo=require('pkginfo')(module,_0xc597('0x4'));var db=require(_0xc597('0x5'))['db'];var config=require('../environment');var hardware=require(_0xc597('0x6'));var logger=require(_0xc597('0x7'))('license');var jira=require(_0xc597('0x8'));var HOST='www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0xc814bf){return new BPromise(function(_0x2cc628,_0x81dbf6){var _0x1a0cd9={'host':HOST,'port':0x1bb,'path':util[_0xc597('0x9')](_0xc597('0xa'),_0xc814bf,module[_0xc597('0xb')][_0xc597('0x4')]),'method':'GET','timeout':0xea60,'headers':{'Content-Type':'application/json'}};var _0x557feb=https['request'](_0x1a0cd9,function(_0x228e07){_0x228e07[_0xc597('0xc')](_0xc597('0xd'));var _0x200c8c='';_0x228e07['on'](_0xc597('0xe'),function(_0x3401fe){_0x200c8c+=_0x3401fe;});_0x228e07['on'](_0xc597('0xf'),function(){try{_0x2cc628(JSON[_0xc597('0x10')](_0x200c8c));}catch(_0x254d2c){_0x81dbf6(_0x254d2c);}});});_0x557feb['on'](_0xc597('0x11'),_0x81dbf6);_0x557feb[_0xc597('0xf')]();});}function encryptDate(_0x34a16c){var _0x4a9b56=crypto[_0xc597('0x12')](_0xc597('0x13'),config[_0xc597('0x14')][_0xc597('0x15')]);var _0xfa4da5=_0x4a9b56['update'](_0x34a16c,_0xc597('0xd'),_0xc597('0x16'));_0xfa4da5+=_0x4a9b56[_0xc597('0x17')](_0xc597('0x16'));return _0xfa4da5;}function decryptDate(_0x3fb947){var _0x4e2a1d=crypto[_0xc597('0x18')]('aes-256-ctr',config[_0xc597('0x14')]['session']);var _0x3833f5=_0x4e2a1d[_0xc597('0x19')](_0x3fb947,_0xc597('0x16'),'utf8');_0x3833f5+=_0x4e2a1d[_0xc597('0x17')](_0xc597('0xd'));return _0x3833f5;}function sendJiraAlert(_0x5e17dc,_0x4feca5,_0x5e0640){var _0x5d58d4=_0xc597('0x1a');return db[_0xc597('0x1b')][_0xc597('0x1c')]({'where':{'role':_0xc597('0x1d')},'attributes':['fullname',_0xc597('0x1e')],'raw':!![]})[_0xc597('0x1f')](function(_0x4303cb){ADMIN=_0x4303cb;_0x5d58d4+=_0xc597('0x20')+_0x5e0640+'|\x0a';_0x5d58d4+=_0xc597('0x21')+_0x5e17dc+'|\x0a';_0x5d58d4+=_0xc597('0x22')+_0x4feca5+'|\x0a';_0x5d58d4+=_0xc597('0x23')+ADMIN['fullname']+'|\x0a';_0x5d58d4+=_0xc597('0x24')+ADMIN[_0xc597('0x1e')]+'|\x0a';return _0x5d58d4;})['then'](function(_0x2c8d79){var _0x3e6683=hardware[_0xc597('0x25')]()['ipAddress'];return jira[_0xc597('0x26')]({'key':'MOTLICENSE','summary':_0xc597('0x27'),'description':_0x2c8d79,'issuetype':_0xc597('0x28'),'oldToken':_0x5e17dc,'newToken':_0x4feca5,'email':ADMIN[_0xc597('0x1e')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x3e6683});});}function manageLicense(_0x36785a,_0x95ac99){var _0x2d5bd9=_0x95ac99['get']({'plain':!![]});httpRequest(_0x36785a)[_0xc597('0x1f')](function(_0x580185){if(_0x580185['active']){if(!_0x2d5bd9[_0xc597('0x29')]&&_0x2d5bd9['license']!=_0x580185[_0xc597('0x29')]||_0x2d5bd9['license']&&_0x2d5bd9['data2']){logger[_0xc597('0x2a')](_0xc597('0x2b'));}if(_0x2d5bd9[_0xc597('0x29')]&&!_0x2d5bd9[_0xc597('0x2c')]&&_0x2d5bd9[_0xc597('0x29')]!=_0x580185[_0xc597('0x29')]){logger[_0xc597('0x2a')](_0xc597('0x2d'));}if(_0x2d5bd9[_0xc597('0x29')]&&!_0x2d5bd9[_0xc597('0x2c')]&&_0x2d5bd9[_0xc597('0x29')]==_0x580185[_0xc597('0x29')]){return _0x95ac99;}return _0x95ac99[_0xc597('0x19')]({'data1':_0x36785a,'data2':null,'license':_0x580185[_0xc597('0x29')]});}else{if(_0x580185[_0xc597('0x29')]||_0x2d5bd9[_0xc597('0x29')]){if(!_0x2d5bd9[_0xc597('0x2c')]){if(_0x2d5bd9[_0xc597('0x2e')]==_0x36785a){GRAY_PERIOD_REASON=_0xc597('0x2f');logger[_0xc597('0x2a')](_0xc597('0x30'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xc597('0x2a')](_0xc597('0x31'),_0x2d5bd9[_0xc597('0x2e')],_0x36785a);}sendJiraAlert(_0x2d5bd9['data1'],_0x580185[_0xc597('0x32')],GRAY_PERIOD_REASON);logger['info'](_0xc597('0x33'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xc597('0x9')](_0xc597('0x34')));return _0x95ac99[_0xc597('0x19')]({'data2':encryptDate(moment()[_0xc597('0x9')](_0xc597('0x34')))});}else{if(moment()['diff'](decryptDate(_0x2d5bd9[_0xc597('0x2c')]),'days')>DAYS){logger[_0xc597('0x2a')]('DEMO\x20START\x20AT\x20%s',moment()[_0xc597('0x9')](_0xc597('0x34')));return _0x95ac99['update']({'data1':_0x36785a,'data2':null,'license':null});}}}else{if(_0x2d5bd9[_0xc597('0x2e')]!=_0x36785a){logger[_0xc597('0x2a')](_0xc597('0x31'),_0x2d5bd9[_0xc597('0x2e')],_0x36785a);return _0x95ac99[_0xc597('0x19')]({'data1':_0x36785a,'data2':null,'license':null});}}}return _0x95ac99;})['then'](function(_0x3f1a11){_0x95ac99=_0x3f1a11;})[_0xc597('0x35')](function(_0x89560d){logger[_0xc597('0x11')](_0x89560d[_0xc597('0x36')]);})[_0xc597('0x37')](function(){setTimeout(function(){manageLicense(hardware[_0xc597('0x38')](),_0x95ac99);},TIME);});}function defaultLicense(){var _0x51eb7f=hardware[_0xc597('0x38')]();if(_0x51eb7f){return db['License'][_0xc597('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x51eb7f}})['spread'](function(_0x13fb96,_0x24c20f){logger[_0xc597('0x2a')](_0xc597('0x3a'),_0x51eb7f);manageLicense(_0x51eb7f,_0x13fb96);})[_0xc597('0x35')](function(_0x5a3434){logger[_0xc597('0x11')](_0x5a3434[_0xc597('0x36')]);});}}exports[_0xc597('0x3b')]=defaultLicense; \ No newline at end of file +var _0x0c5f=['then','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Alert','get','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','catch','message','finally','getUuid','License','spread','default','util','https','crypto','moment','bluebird','pkginfo','version','../../mysqldb','../environment','../logger','license','www.xcallymotion.com','format','/api/servers/%s/check?version=%s','exports','GET','application/json','request','setEncoding','utf8','data','end','parse','error','aes-256-ctr','secrets','session','final','base64','createDecipher','update','||FIELD||VALUE||\x0a','User','fullname','email'];(function(_0x1a1090,_0x822fba){var _0x24f572=function(_0x18137c){while(--_0x18137c){_0x1a1090['push'](_0x1a1090['shift']());}};_0x24f572(++_0x822fba);}(_0x0c5f,0x181));var _0xf0c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c5f[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf0c5('0x0'));var https=require(_0xf0c5('0x1'));var crypto=require(_0xf0c5('0x2'));var moment=require(_0xf0c5('0x3'));var BPromise=require(_0xf0c5('0x4'));var pkginfo=require(_0xf0c5('0x5'))(module,_0xf0c5('0x6'));var db=require(_0xf0c5('0x7'))['db'];var config=require(_0xf0c5('0x8'));var hardware=require('./hardware');var logger=require(_0xf0c5('0x9'))(_0xf0c5('0xa'));var jira=require('../../api/jira/jira.controller');var HOST=_0xf0c5('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x4c4019){return new BPromise(function(_0x323bb9,_0x15bc78){var _0x54167e={'host':HOST,'port':0x1bb,'path':util[_0xf0c5('0xc')](_0xf0c5('0xd'),_0x4c4019,module[_0xf0c5('0xe')][_0xf0c5('0x6')]),'method':_0xf0c5('0xf'),'timeout':0xea60,'headers':{'Content-Type':_0xf0c5('0x10')}};var _0x7bb1af=https[_0xf0c5('0x11')](_0x54167e,function(_0x30382a){_0x30382a[_0xf0c5('0x12')](_0xf0c5('0x13'));var _0x4b687e='';_0x30382a['on'](_0xf0c5('0x14'),function(_0x5c4fd7){_0x4b687e+=_0x5c4fd7;});_0x30382a['on'](_0xf0c5('0x15'),function(){try{_0x323bb9(JSON[_0xf0c5('0x16')](_0x4b687e));}catch(_0x28018d){_0x15bc78(_0x28018d);}});});_0x7bb1af['on'](_0xf0c5('0x17'),_0x15bc78);_0x7bb1af[_0xf0c5('0x15')]();});}function encryptDate(_0x1a9aa1){var _0x5355f0=crypto['createCipher'](_0xf0c5('0x18'),config[_0xf0c5('0x19')][_0xf0c5('0x1a')]);var _0x348d58=_0x5355f0['update'](_0x1a9aa1,_0xf0c5('0x13'),'base64');_0x348d58+=_0x5355f0[_0xf0c5('0x1b')](_0xf0c5('0x1c'));return _0x348d58;}function decryptDate(_0xb8dc2c){var _0x2cfa33=crypto[_0xf0c5('0x1d')](_0xf0c5('0x18'),config['secrets'][_0xf0c5('0x1a')]);var _0x1c44c1=_0x2cfa33[_0xf0c5('0x1e')](_0xb8dc2c,_0xf0c5('0x1c'),'utf8');_0x1c44c1+=_0x2cfa33[_0xf0c5('0x1b')]('utf8');return _0x1c44c1;}function sendJiraAlert(_0x1fc1dc,_0x286e26,_0x26ed6d){var _0x299653=_0xf0c5('0x1f');return db[_0xf0c5('0x20')]['findOne']({'where':{'role':'admin'},'attributes':[_0xf0c5('0x21'),_0xf0c5('0x22')],'raw':!![]})[_0xf0c5('0x23')](function(_0x8c160){ADMIN=_0x8c160;_0x299653+=_0xf0c5('0x24')+_0x26ed6d+'|\x0a';_0x299653+=_0xf0c5('0x25')+_0x1fc1dc+'|\x0a';_0x299653+=_0xf0c5('0x26')+_0x286e26+'|\x0a';_0x299653+=_0xf0c5('0x27')+ADMIN[_0xf0c5('0x21')]+'|\x0a';_0x299653+=_0xf0c5('0x28')+ADMIN['email']+'|\x0a';return _0x299653;})['then'](function(_0x376490){var _0x116a8a=hardware[_0xf0c5('0x29')]()[_0xf0c5('0x2a')];return jira[_0xf0c5('0x2b')]({'key':_0xf0c5('0x2c'),'summary':'Motion\x20License\x20Alert','description':_0x376490,'issuetype':_0xf0c5('0x2d'),'oldToken':_0x1fc1dc,'newToken':_0x286e26,'email':ADMIN[_0xf0c5('0x22')],'name':ADMIN[_0xf0c5('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x116a8a});});}function manageLicense(_0x36f134,_0x2dda82){var _0x4ebb18=_0x2dda82[_0xf0c5('0x2e')]({'plain':!![]});httpRequest(_0x36f134)[_0xf0c5('0x23')](function(_0x7e21d8){if(_0x7e21d8[_0xf0c5('0x2f')]){if(!_0x4ebb18[_0xf0c5('0xa')]&&_0x4ebb18[_0xf0c5('0xa')]!=_0x7e21d8[_0xf0c5('0xa')]||_0x4ebb18[_0xf0c5('0xa')]&&_0x4ebb18[_0xf0c5('0x30')]){logger['info'](_0xf0c5('0x31'));}if(_0x4ebb18['license']&&!_0x4ebb18[_0xf0c5('0x30')]&&_0x4ebb18[_0xf0c5('0xa')]!=_0x7e21d8[_0xf0c5('0xa')]){logger[_0xf0c5('0x32')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4ebb18[_0xf0c5('0xa')]&&!_0x4ebb18[_0xf0c5('0x30')]&&_0x4ebb18['license']==_0x7e21d8[_0xf0c5('0xa')]){return _0x2dda82;}return _0x2dda82[_0xf0c5('0x1e')]({'data1':_0x36f134,'data2':null,'license':_0x7e21d8['license']});}else{if(_0x7e21d8[_0xf0c5('0xa')]||_0x4ebb18[_0xf0c5('0xa')]){if(!_0x4ebb18[_0xf0c5('0x30')]){if(_0x4ebb18[_0xf0c5('0x33')]==_0x36f134){GRAY_PERIOD_REASON=_0xf0c5('0x34');logger[_0xf0c5('0x32')](_0xf0c5('0x35'));}else{GRAY_PERIOD_REASON=_0xf0c5('0x36');logger[_0xf0c5('0x32')](_0xf0c5('0x37'),_0x4ebb18['data1'],_0x36f134);}sendJiraAlert(_0x4ebb18['data1'],_0x7e21d8[_0xf0c5('0x38')],GRAY_PERIOD_REASON);logger[_0xf0c5('0x32')](_0xf0c5('0x39'),GRAY_PERIOD_REASON[_0xf0c5('0x3a')](),moment()[_0xf0c5('0xc')](_0xf0c5('0x3b')));return _0x2dda82['update']({'data2':encryptDate(moment()['format'](_0xf0c5('0x3b')))});}else{if(moment()[_0xf0c5('0x3c')](decryptDate(_0x4ebb18[_0xf0c5('0x30')]),_0xf0c5('0x3d'))>DAYS){logger[_0xf0c5('0x32')](_0xf0c5('0x3e'),moment()[_0xf0c5('0xc')](_0xf0c5('0x3b')));return _0x2dda82[_0xf0c5('0x1e')]({'data1':_0x36f134,'data2':null,'license':null});}}}else{if(_0x4ebb18[_0xf0c5('0x33')]!=_0x36f134){logger[_0xf0c5('0x32')](_0xf0c5('0x37'),_0x4ebb18['data1'],_0x36f134);return _0x2dda82[_0xf0c5('0x1e')]({'data1':_0x36f134,'data2':null,'license':null});}}}return _0x2dda82;})['then'](function(_0x22ab8d){_0x2dda82=_0x22ab8d;})[_0xf0c5('0x3f')](function(_0x56056c){logger[_0xf0c5('0x17')](_0x56056c[_0xf0c5('0x40')]);})[_0xf0c5('0x41')](function(){setTimeout(function(){manageLicense(hardware[_0xf0c5('0x42')](),_0x2dda82);},TIME);});}function defaultLicense(){var _0x16d74e=hardware[_0xf0c5('0x42')]();if(_0x16d74e){return db[_0xf0c5('0x43')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x16d74e}})[_0xf0c5('0x44')](function(_0x587d74,_0x3411ab){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x16d74e);manageLicense(_0x16d74e,_0x587d74);})['catch'](function(_0x599824){logger[_0xf0c5('0x17')](_0x599824[_0xf0c5('0x40')]);});}}exports[_0xf0c5('0x45')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5183ae8..ce9701e 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 _0x26ed=['license','License\x20key\x20value\x20not\x20found','data1','split','aes-256-ctr','format','%s:%s:%s','utf8','final','demo','uuid','machineUuid','getUuid','createDecipher','secrets','session','base64','deadline','days','grayReason','changed','disabled','message','Demo\x20license','find','defaults','then','crypto','moment','./hardware'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x26ed,0x1a1));var _0xd26e=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x26ed[_0x29e3ec];return _0x25727e;};'use strict';var crypto=require(_0xd26e('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0xd26e('0x1'));var hardware=require(_0xd26e('0x2'));var config=require('../environment');var db=require('../../mysqldb')['db'];function checkLicense(_0x5665b6,_0x13daf8){if(_0x5665b6){try{var _0x23cc7b=_0x13daf8||_0x5665b6[_0xd26e('0x3')];if(_['isEmpty'](_0x23cc7b)){throw new Error(_0xd26e('0x4'));}var _0x442a3a=_0x5665b6[_0xd26e('0x5')];var _0x231959=_0x5665b6['data2'];var _0x2a8a60=_0x442a3a[_0xd26e('0x6')]('-')[0x4];var _0x19494e=_0x442a3a[_0xd26e('0x6')]('-')[0x0];var _0x545847=crypto['createDecipher'](_0xd26e('0x7'),util[_0xd26e('0x8')](_0xd26e('0x9'),_0x2a8a60,_0x442a3a,_0x19494e));var _0x13e00d=_0x545847['update'](_0x23cc7b,'base64',_0xd26e('0xa'));_0x13e00d+=_0x545847[_0xd26e('0xb')](_0xd26e('0xa'));var _0x2eaa11=JSON['parse'](_0x13e00d);_0x2eaa11[_0xd26e('0xc')]=![];_0x2eaa11[_0xd26e('0xd')]=_0x442a3a;_0x2eaa11[_0xd26e('0xe')]=hardware[_0xd26e('0xf')]();if(_0x231959){var _0x1350b7=crypto[_0xd26e('0x10')]('aes-256-ctr',config[_0xd26e('0x11')][_0xd26e('0x12')]);var _0xb4a611=_0x1350b7['update'](_0x231959,_0xd26e('0x13'),_0xd26e('0xa'));_0xb4a611+=_0x1350b7[_0xd26e('0xb')](_0xd26e('0xa'));_0x2eaa11['gray']=_0xb4a611;_0x2eaa11[_0xd26e('0x14')]=moment(_0xb4a611)['add'](0x7,_0xd26e('0x15'))[_0xd26e('0x8')]();_0x2eaa11[_0xd26e('0x16')]=_0x2eaa11[_0xd26e('0xd')]!=_0x2eaa11[_0xd26e('0xe')]?_0xd26e('0x17'):_0xd26e('0x18');}return _0x2eaa11;}catch(_0x5b3f72){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x5665b6[_0xd26e('0x5')],'machineUuid':hardware[_0xd26e('0xf')](),'message':_0x5b3f72[_0xd26e('0x19')],'virtual':0x0,'voice':!![]};}}return{'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':_0xd26e('0x1a'),'uuid':_0x5665b6[_0xd26e('0x5')],'machineUuid':hardware[_0xd26e('0xf')](),'virtual':0x0,'voice':!![]};}exports['getLicense']=function(_0x5644f7){return db['License'][_0xd26e('0x1b')](_[_0xd26e('0x1c')](_0x5644f7,{'raw':!![],'where':{'id':0x1}}))[_0xd26e('0x1d')](function(_0x1df7f2){return checkLicense(_0x1df7f2,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0xec4a=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','uuid','machineUuid','getUuid','secrets','session','gray','deadline','add','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','data1','message','Demo\x20license','getLicense','find','defaults','then','checkLicense','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split'];(function(_0x4ced3f,_0x42b01d){var _0x47a8fa=function(_0x20c61a){while(--_0x20c61a){_0x4ced3f['push'](_0x4ced3f['shift']());}};_0x47a8fa(++_0x42b01d);}(_0xec4a,0x1e0));var _0xaec4=function(_0x23f8c9,_0x38edbd){_0x23f8c9=_0x23f8c9-0x0;var _0x30ded6=_0xec4a[_0x23f8c9];return _0x30ded6;};'use strict';var crypto=require(_0xaec4('0x0'));var util=require(_0xaec4('0x1'));var _=require(_0xaec4('0x2'));var moment=require(_0xaec4('0x3'));var hardware=require(_0xaec4('0x4'));var config=require(_0xaec4('0x5'));var db=require(_0xaec4('0x6'))['db'];function checkLicense(_0x42b8d8,_0x558226){if(_0x42b8d8){try{var _0x4aa94b=_0x558226||_0x42b8d8[_0xaec4('0x7')];if(_[_0xaec4('0x8')](_0x4aa94b)){throw new Error(_0xaec4('0x9'));}var _0x4a6dda=_0x42b8d8['data1'];var _0x1f2a97=_0x42b8d8[_0xaec4('0xa')];var _0x417f0e=_0x4a6dda[_0xaec4('0xb')]('-')[0x4];var _0x586b5a=_0x4a6dda[_0xaec4('0xb')]('-')[0x0];var _0xe012cb=crypto[_0xaec4('0xc')](_0xaec4('0xd'),util[_0xaec4('0xe')](_0xaec4('0xf'),_0x417f0e,_0x4a6dda,_0x586b5a));var _0x1068a9=_0xe012cb[_0xaec4('0x10')](_0x4aa94b,_0xaec4('0x11'),_0xaec4('0x12'));_0x1068a9+=_0xe012cb[_0xaec4('0x13')](_0xaec4('0x12'));var _0x598fdb=JSON[_0xaec4('0x14')](_0x1068a9);_0x598fdb['demo']=![];_0x598fdb[_0xaec4('0x15')]=_0x4a6dda;_0x598fdb[_0xaec4('0x16')]=hardware[_0xaec4('0x17')]();if(_0x1f2a97){var _0x2bd624=crypto[_0xaec4('0xc')]('aes-256-ctr',config[_0xaec4('0x18')][_0xaec4('0x19')]);var _0x4db5e9=_0x2bd624[_0xaec4('0x10')](_0x1f2a97,_0xaec4('0x11'),'utf8');_0x4db5e9+=_0x2bd624[_0xaec4('0x13')](_0xaec4('0x12'));_0x598fdb[_0xaec4('0x1a')]=_0x4db5e9;_0x598fdb[_0xaec4('0x1b')]=moment(_0x4db5e9)[_0xaec4('0x1c')](0x7,'days')['format']();_0x598fdb[_0xaec4('0x1d')]=_0x598fdb[_0xaec4('0x15')]!=_0x598fdb[_0xaec4('0x16')]?_0xaec4('0x1e'):_0xaec4('0x1f');}return _0x598fdb;}catch(_0xd28f32){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xaec4('0x20'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x42b8d8[_0xaec4('0x21')],'machineUuid':hardware[_0xaec4('0x17')](),'message':_0xd28f32[_0xaec4('0x22')],'virtual':0x0,'voice':!![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xaec4('0x20'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xaec4('0x23'),'uuid':_0x42b8d8[_0xaec4('0x21')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![]};}exports[_0xaec4('0x24')]=function(_0x29519b){return db['License'][_0xaec4('0x25')](_[_0xaec4('0x26')](_0x29519b,{'raw':!![],'where':{'id':0x1}}))[_0xaec4('0x27')](function(_0x1b03c1){return checkLicense(_0x1b03c1,null);});};exports[_0xaec4('0x28')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 2814582..c258b71 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 _0x581a=['http://localhost:9000','app-id','secret','exports'];(function(_0x548304,_0x4fdacf){var _0x4149a7=function(_0x130458){while(--_0x130458){_0x548304['push'](_0x548304['shift']());}};_0x4149a7(++_0x4fdacf);}(_0x581a,0x127));var _0xa581=function(_0x19e59a,_0x3238cd){_0x19e59a=_0x19e59a-0x0;var _0x46c680=_0x581a[_0x19e59a];return _0x46c680;};'use strict';module[_0xa581('0x0')]={'DOMAIN':_0xa581('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa581('0x2'),'GOOGLE_SECRET':_0xa581('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x0ba7=['secret','exports','myappanuglar-secret','app-id'];(function(_0x47370c,_0x408606){var _0x384525=function(_0x5e3831){while(--_0x5e3831){_0x47370c['push'](_0x47370c['shift']());}};_0x384525(++_0x408606);}(_0x0ba7,0x16d));var _0x70ba=function(_0x276b3e,_0x553a75){_0x276b3e=_0x276b3e-0x0;var _0x497c74=_0x0ba7[_0x276b3e];return _0x497c74;};'use strict';module[_0x70ba('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x70ba('0x1'),'GOOGLE_ID':_0x70ba('0x2'),'GOOGLE_SECRET':_0x70ba('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f1b49ae..47971ff 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7007=['Console','debugLevel','moment','winston','util','INFO','join','log','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','level','message','exports','Logger','transports','File','error','info'];(function(_0x108f1c,_0x15baae){var _0x3d3b3b=function(_0x43dd2a){while(--_0x43dd2a){_0x108f1c['push'](_0x108f1c['shift']());}};_0x3d3b3b(++_0x15baae);}(_0x7007,0x74));var _0x7700=function(_0x2e96c6,_0x41a22d){_0x2e96c6=_0x2e96c6-0x0;var _0x3058b9=_0x7007[_0x2e96c6];return _0x3058b9;};'use strict';var moment=require(_0x7700('0x0'));var winston=require(_0x7700('0x1'));var util=require(_0x7700('0x2'));var path=require('path');var debugLevel=_0x7700('0x3');function filename(_0x4e1584,_0x329573){return path[_0x7700('0x4')]('/var',_0x7700('0x5'),'xcally',util[_0x7700('0x6')](_0x7700('0x7'),_0x4e1584,_0x329573));}function formatter(_0xe6ddf0,_0x1dd7f9){return util[_0x7700('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x7700('0x6')](_0x7700('0x8')),_0x1dd7f9[_0x7700('0x9')]['toUpperCase'](),_0xe6ddf0,_0x1dd7f9[_0x7700('0xa')]);}module[_0x7700('0xb')]=function(_0x1c7aab){return new winston[(_0x7700('0xc'))]({'transports':[new winston[(_0x7700('0xd'))][(_0x7700('0xe'))]({'name':util[_0x7700('0x6')]('%s-%s',_0x1c7aab,_0x7700('0xf')),'filename':filename(_0x1c7aab,_0x7700('0xf')),'level':_0x7700('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2fff99){return formatter(_0x1c7aab,_0x2fff99);}}),new winston[(_0x7700('0xd'))][(_0x7700('0xe'))]({'name':util[_0x7700('0x6')]('%s-%s',_0x1c7aab,_0x7700('0x10')),'filename':filename(_0x1c7aab,_0x7700('0x10')),'level':_0x7700('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3df08d){return formatter(_0x1c7aab,_0x3df08d);}}),new winston[(_0x7700('0xd'))][(_0x7700('0x11'))]({'level':process['env'][_0x7700('0x12')]||debugLevel,'json':![],'formatter':function(_0x296bee){return formatter(_0x1c7aab,_0x296bee);}})]});}; \ No newline at end of file +var _0xec74=['%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports','Logger','%s-%s','error','transports','File','info','Console','moment','util','path','INFO','/var','log','xcally','format'];(function(_0x23fdb8,_0x52ca72){var _0x3254f7=function(_0x4339c5){while(--_0x4339c5){_0x23fdb8['push'](_0x23fdb8['shift']());}};_0x3254f7(++_0x52ca72);}(_0xec74,0x1c6));var _0x4ec7=function(_0x15dc5f,_0x165eaa){_0x15dc5f=_0x15dc5f-0x0;var _0x15531f=_0xec74[_0x15dc5f];return _0x15531f;};'use strict';var moment=require(_0x4ec7('0x0'));var winston=require('winston');var util=require(_0x4ec7('0x1'));var path=require(_0x4ec7('0x2'));var debugLevel=_0x4ec7('0x3');function filename(_0xee8a1c,_0x332f13){return path['join'](_0x4ec7('0x4'),_0x4ec7('0x5'),_0x4ec7('0x6'),util[_0x4ec7('0x7')](_0x4ec7('0x8'),_0xee8a1c,_0x332f13));}function formatter(_0x4a76d4,_0x5517fd){return util[_0x4ec7('0x7')](_0x4ec7('0x9'),moment()['format'](_0x4ec7('0xa')),_0x5517fd['level'][_0x4ec7('0xb')](),_0x4a76d4,_0x5517fd[_0x4ec7('0xc')]);}module[_0x4ec7('0xd')]=function(_0x2426bc){return new winston[(_0x4ec7('0xe'))]({'transports':[new winston['transports']['File']({'name':util[_0x4ec7('0x7')](_0x4ec7('0xf'),_0x2426bc,_0x4ec7('0x10')),'filename':filename(_0x2426bc,_0x4ec7('0x10')),'level':_0x4ec7('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1210ac){return formatter(_0x2426bc,_0x1210ac);}}),new winston[(_0x4ec7('0x11'))][(_0x4ec7('0x12'))]({'name':util['format'](_0x4ec7('0xf'),_0x2426bc,'info'),'filename':filename(_0x2426bc,_0x4ec7('0x13')),'level':_0x4ec7('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a104a){return formatter(_0x2426bc,_0x4a104a);}}),new winston[(_0x4ec7('0x11'))][(_0x4ec7('0x14'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x189c86){return formatter(_0x2426bc,_0x189c86);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 325941a..726ed48 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 _0xe6dd=['join','ami','../../services/ami/index.js','agi','../../services/email/index.js','../../services/routing/index.js','exports','path','express'];(function(_0x1f6fd5,_0x399cb0){var _0x587d12=function(_0x4d26e8){while(--_0x4d26e8){_0x1f6fd5['push'](_0x1f6fd5['shift']());}};_0x587d12(++_0x399cb0);}(_0xe6dd,0x10c));var _0xde6d=function(_0x3379f7,_0x3a5017){_0x3379f7=_0x3379f7-0x0;var _0x3784cd=_0xe6dd[_0x3379f7];return _0x3784cd;};'use strict';var path=require(_0xde6d('0x0'));var os=require('os');var config={'apps':[{'name':_0xde6d('0x1'),'script':path[_0xde6d('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xde6d('0x3'),'script':path[_0xde6d('0x2')](__dirname,_0xde6d('0x4'))},{'name':_0xde6d('0x5'),'script':path[_0xde6d('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0xde6d('0x2')](__dirname,_0xde6d('0x6'))},{'name':'routing','script':path['join'](__dirname,_0xde6d('0x7'))}]};module[_0xde6d('0x8')]=config; \ No newline at end of file +var _0x2fbe=['exports','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','routing'];(function(_0x2484fd,_0x44a515){var _0xf0b307=function(_0x40034a){while(--_0x40034a){_0x2484fd['push'](_0x2484fd['shift']());}};_0xf0b307(++_0x44a515);}(_0x2fbe,0x169));var _0xe2fb=function(_0x2707f0,_0x2c092a){_0x2707f0=_0x2707f0-0x0;var _0x2a3afc=_0x2fbe[_0x2707f0];return _0x2a3afc;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0xe2fb('0x0')](__dirname,_0xe2fb('0x1'))},{'name':_0xe2fb('0x2'),'script':path[_0xe2fb('0x0')](__dirname,_0xe2fb('0x3'))},{'name':_0xe2fb('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0xe2fb('0x5'),'script':path[_0xe2fb('0x0')](__dirname,_0xe2fb('0x6'))},{'name':_0xe2fb('0x7'),'script':path['join'](__dirname,'../../services/routing/index.js')}]};module[_0xe2fb('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5a7ccd6..cbe24a4 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 _0xedd9=['restart','list','describe','delete','saved','bluebird','./config','connect','connected','start','then','stop','disconnect'];(function(_0x36e6da,_0x207319){var _0xecddcb=function(_0x1b731e){while(--_0x1b731e){_0x36e6da['push'](_0x36e6da['shift']());}};_0xecddcb(++_0x207319);}(_0xedd9,0xfc));var _0x9edd=function(_0x3db159,_0x2796f0){_0x3db159=_0x3db159-0x0;var _0x2e926a=_0xedd9[_0x3db159];return _0x2e926a;};'use strict';var pm2=require('pm2');var BPromise=require(_0x9edd('0x0'));var config=require(_0x9edd('0x1'));function connect(){return new BPromise(function(_0x2af857,_0x2c16b8){return pm2[_0x9edd('0x2')](function(_0x127cbe){if(_0x127cbe){return _0x2c16b8(_0x127cbe);}return _0x2af857(_0x9edd('0x3'));});});};exports[_0x9edd('0x4')]=function(_0x5943b3){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x2cd163,_0x268f9e){return pm2[_0x9edd('0x4')](_0x5943b3,function(_0x5319f7,_0xf0b2d8){if(_0x5319f7){return _0x268f9e(_0x5319f7);}pm2['disconnect']();return _0x2cd163(_0xf0b2d8);});});});};exports[_0x9edd('0x6')]=function(_0x190185){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x3280fd,_0x49d5e3){return pm2[_0x9edd('0x6')](_0x190185,function(_0x5d2f90,_0x2076fc){if(_0x5d2f90){return _0x49d5e3(_0x5d2f90);}pm2[_0x9edd('0x7')]();return _0x3280fd(_0x2076fc);});});});};exports['restart']=function(_0xbf9da6){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x5b6c00,_0x30c0d7){return pm2[_0x9edd('0x8')](_0xbf9da6,function(_0x25e64c,_0xfd544a){if(_0x25e64c){return _0x30c0d7(_0x25e64c);}pm2[_0x9edd('0x7')]();return _0x5b6c00(_0xfd544a);});});});};exports[_0x9edd('0x9')]=function(){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0xef5498,_0x47eb64){return pm2[_0x9edd('0x9')](function(_0x44fc7c,_0x891832){if(_0x44fc7c){return _0x47eb64(_0x44fc7c);}pm2[_0x9edd('0x7')]();return _0xef5498(_0x891832);});});});};exports[_0x9edd('0xa')]=function(_0x338f3c){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x75a4ab,_0x4ea60f){return pm2[_0x9edd('0xa')](_0x338f3c,function(_0x448996,_0x449cee){if(_0x448996){return _0x4ea60f(_0x448996);}pm2['disconnect']();return _0x75a4ab(_0x449cee);});});});};exports[_0x9edd('0xb')]=function(_0x35f454){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x4d8f33,_0x43dc70){return pm2['delete'](_0x35f454,function(_0x2cdcef,_0x1083e4){if(_0x2cdcef){return _0x43dc70(_0x2cdcef);}pm2['disconnect']();return _0x4d8f33(_0x1083e4);});});});};exports['dump']=function(){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x50338f,_0x27a95a){return pm2['dump'](function(_0x535f37){if(_0x535f37){return _0x27a95a(_0x535f37);}return _0x50338f(_0x9edd('0xc'));});});});}; \ No newline at end of file +var _0x008c=['start','then','disconnect','stop','restart','list','describe','delete','pm2','bluebird','./config','connected'];(function(_0x46004c,_0x19d3b0){var _0x10a2c9=function(_0xf7bb01){while(--_0xf7bb01){_0x46004c['push'](_0x46004c['shift']());}};_0x10a2c9(++_0x19d3b0);}(_0x008c,0x188));var _0xc008=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0x008c[_0x4370c7];return _0xce78a9;};'use strict';var pm2=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var config=require(_0xc008('0x2'));function connect(){return new BPromise(function(_0xae17af,_0x1d119a){return pm2['connect'](function(_0x3641af){if(_0x3641af){return _0x1d119a(_0x3641af);}return _0xae17af(_0xc008('0x3'));});});};exports[_0xc008('0x4')]=function(_0x163bd9){return connect()[_0xc008('0x5')](function(){return new BPromise(function(_0x1679e0,_0x13aa7){return pm2[_0xc008('0x4')](_0x163bd9,function(_0x9c8cb2,_0x4af530){if(_0x9c8cb2){return _0x13aa7(_0x9c8cb2);}pm2[_0xc008('0x6')]();return _0x1679e0(_0x4af530);});});});};exports['stop']=function(_0x30be38){return connect()['then'](function(){return new BPromise(function(_0x52041f,_0x27830d){return pm2[_0xc008('0x7')](_0x30be38,function(_0x57c46d,_0x51ba7d){if(_0x57c46d){return _0x27830d(_0x57c46d);}pm2['disconnect']();return _0x52041f(_0x51ba7d);});});});};exports[_0xc008('0x8')]=function(_0xc881aa){return connect()['then'](function(){return new BPromise(function(_0xae2dab,_0x332fd4){return pm2[_0xc008('0x8')](_0xc881aa,function(_0x2a5b4e,_0x9ffa93){if(_0x2a5b4e){return _0x332fd4(_0x2a5b4e);}pm2[_0xc008('0x6')]();return _0xae2dab(_0x9ffa93);});});});};exports[_0xc008('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x560e28,_0x33f44c){return pm2['list'](function(_0x25e13f,_0x4584e1){if(_0x25e13f){return _0x33f44c(_0x25e13f);}pm2[_0xc008('0x6')]();return _0x560e28(_0x4584e1);});});});};exports[_0xc008('0xa')]=function(_0x3f0ecf){return connect()['then'](function(){return new BPromise(function(_0x5e894e,_0x4bd0f4){return pm2[_0xc008('0xa')](_0x3f0ecf,function(_0x15a6ad,_0x3cafe3){if(_0x15a6ad){return _0x4bd0f4(_0x15a6ad);}pm2[_0xc008('0x6')]();return _0x5e894e(_0x3cafe3);});});});};exports['delete']=function(_0x53b06e){return connect()['then'](function(){return new BPromise(function(_0x5c2668,_0x46042b){return pm2[_0xc008('0xb')](_0x53b06e,function(_0x501137,_0x813397){if(_0x501137){return _0x46042b(_0x501137);}pm2['disconnect']();return _0x5c2668(_0x813397);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x50261c,_0x5754a0){return pm2['dump'](function(_0x5560b1){if(_0x5560b1){return _0x5754a0(_0x5560b1);}return _0x50261c('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 42006ba..0bb885e 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 _0xab1f=['format','YYYY-MM-DD\x20HH:mm:ss','map','emit','catch','start','moment','Setting','find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','update','system','timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab1f,0x1ec));var _0xfab1=function(_0x261607,_0x22cfbb){_0x261607=_0x261607-0x0;var _0x3a59a5=_0xab1f[_0x261607];return _0x3a59a5;};'use strict';var _=require('lodash');var moment=require(_0xfab1('0x0'));var db=require('../../mysqldb')['db'];var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function closeInteractions(){var _0x387bb4=0x0;var _0x4e2939=[];return db[_0xfab1('0x1')][_0xfab1('0x2')]({'raw':!![],'attributes':['id',_0xfab1('0x3')],'where':{'id':0x1}})[_0xfab1('0x4')](function(_0x1cdb62){_0x387bb4=_0x1cdb62[_0xfab1('0x3')];if(_0x387bb4){return db[_0xfab1('0x5')][_0xfab1('0x6')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xfab1('0x7')](_0x1cdb62[_0xfab1('0x3')],_0xfab1('0x8'))}}});}else{return[];}})[_0xfab1('0x4')](function(_0x49d4a3){_0x4e2939=_0x49d4a3;if(_0x387bb4){return db[_0xfab1('0x5')][_0xfab1('0x9')]({'closeReason':_0xfab1('0xa'),'disposition':_0xfab1('0xb'),'closed':!![],'closedAt':moment()[_0xfab1('0xc')](_0xfab1('0xd'))},{'where':{'id':_[_0xfab1('0xe')](_0x4e2939||[],'id')}});}})['then'](function(_0x453099){for(var _0x3a5f40=0x0;_0x3a5f40<_0x4e2939['length'];_0x3a5f40++){io[_0xfab1('0xf')]('chatInteraction:update',{'id':_0x4e2939[_0x3a5f40]['id'],'closed':!![]});}})[_0xfab1('0x10')](function(_0x512cf6){console['error'](_0x512cf6);});}exports[_0xfab1('0x11')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa282=['timeout','format','map','length','emit','chatInteraction:update','catch','error','start','lodash','moment','../../mysqldb','socket.io-emitter','localhost','Setting','find','chatTimeout','then','lastMsgAt','subtract','minutes','ChatInteraction','update','system'];(function(_0x3eff73,_0x57248d){var _0x35eedb=function(_0x6774aa){while(--_0x6774aa){_0x3eff73['push'](_0x3eff73['shift']());}};_0x35eedb(++_0x57248d);}(_0xa282,0x189));var _0x2a28=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xa282[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x2a28('0x0'));var moment=require(_0x2a28('0x1'));var db=require(_0x2a28('0x2'))['db'];var io=require(_0x2a28('0x3'))({'host':_0x2a28('0x4'),'port':0x18eb});function closeInteractions(){var _0x2a0cab=0x0;var _0x1f1c39=[];return db[_0x2a28('0x5')][_0x2a28('0x6')]({'raw':!![],'attributes':['id',_0x2a28('0x7')],'where':{'id':0x1}})[_0x2a28('0x8')](function(_0x38d004){_0x2a0cab=_0x38d004[_0x2a28('0x7')];if(_0x2a0cab){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x2a28('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2a28('0xa')](_0x38d004[_0x2a28('0x7')],_0x2a28('0xb'))}}});}else{return[];}})['then'](function(_0xcdf79f){_0x1f1c39=_0xcdf79f;if(_0x2a0cab){return db[_0x2a28('0xc')][_0x2a28('0xd')]({'closeReason':_0x2a28('0xe'),'disposition':_0x2a28('0xf'),'closed':!![],'closedAt':moment()[_0x2a28('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x2a28('0x11')](_0x1f1c39||[],'id')}});}})['then'](function(_0x1d4e90){for(var _0x58ce21=0x0;_0x58ce21<_0x1f1c39[_0x2a28('0x12')];_0x58ce21++){io[_0x2a28('0x13')](_0x2a28('0x14'),{'id':_0x1f1c39[_0x58ce21]['id'],'closed':!![]});}})[_0x2a28('0x15')](function(_0x7b5ca){console[_0x2a28('0x16')](_0x7b5ca);});}exports[_0x2a28('0x17')]=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 6c51cd6..13137c5 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 _0x653d=['Schedule','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','update\x20cron','stop\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','host','MailAccount','port','secure','authentication','user','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id'];(function(_0x5a37d4,_0x4a32fc){var _0x6d20b9=function(_0x38591e){while(--_0x38591e){_0x5a37d4['push'](_0x5a37d4['shift']());}};_0x6d20b9(++_0x4a32fc);}(_0x653d,0x133));var _0xd653=function(_0x62c4d9,_0xb326b){_0x62c4d9=_0x62c4d9-0x0;var _0xc69de8=_0x653d[_0x62c4d9];return _0xc69de8;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xd653('0x0'));var _=require(_0xd653('0x1'));var moment=require(_0xd653('0x2'));var CronJobManager=require(_0xd653('0x3'));var jayson=require(_0xd653('0x4'));var BPromise=require(_0xd653('0x5'));var logger=require(_0xd653('0x6'))(_0xd653('0x7'));var db=require(_0xd653('0x8'))['db'];var analyticCustomReportController=require(_0xd653('0x9'));var analyticDefaultReportController=require(_0xd653('0xa'));var client=jayson[_0xd653('0xb')][_0xd653('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2bf7a1,_0x490041){return function(){logger['info'](_0xd653('0xd'),_0x2bf7a1['email']);var _0x2fa0b3=!![];var _0x1134e6={'tls':{'rejectUnauthorized':![]}};if(_0x2bf7a1['MailAccount'][_0xd653('0xe')][_0xd653('0xf')]){_0x1134e6[_0xd653('0xf')]=_0x2bf7a1['MailAccount'][_0xd653('0xe')]['service'];}else{_0x1134e6[_0xd653('0x10')]=_0x2bf7a1[_0xd653('0x11')][_0xd653('0xe')][_0xd653('0x10')];_0x1134e6[_0xd653('0x12')]=_0x2bf7a1[_0xd653('0x11')][_0xd653('0xe')]['port'];_0x1134e6['secure']=_0x2bf7a1[_0xd653('0x11')][_0xd653('0xe')][_0xd653('0x13')];}if(_0x2bf7a1[_0xd653('0x11')][_0xd653('0xe')][_0xd653('0x14')]){_0x1134e6['auth']={'user':_0x2bf7a1['MailAccount']['Smtp'][_0xd653('0x15')],'pass':_0x2bf7a1[_0xd653('0x11')][_0xd653('0xe')]['pass']};}var _0x2a4d7f={'account':_0x1134e6,'message':{'from':util[_0xd653('0x16')](_0xd653('0x17'),_0x2bf7a1[_0xd653('0x11')][_0xd653('0x18')],_0x2bf7a1[_0xd653('0x11')][_0xd653('0x19')]||_0x2bf7a1[_0xd653('0x11')]['Smtp'][_0xd653('0x15')]),'to':_0x2bf7a1[_0xd653('0x19')],'cc':_0x2bf7a1['cc'],'bcc':_0x2bf7a1[_0xd653('0x1a')],'subject':util['format'](_0xd653('0x1b'),_0x490041[_0xd653('0x18')],_0x2bf7a1[_0xd653('0x1c')],_0x2bf7a1[_0xd653('0x1d')])}};var _0x30750c=path[_0xd653('0x1e')](__dirname,_0xd653('0x1f'));var _0x5e3d28=_0x490041[_0xd653('0x20')];var _0x36b03b=util[_0xd653('0x16')](_0xd653('0x21'),path[_0xd653('0x22')](_0x490041[_0xd653('0x20')],path[_0xd653('0x23')](_0x490041[_0xd653('0x20')])),_0xd653('0x24'));var _0x42fd55=path[_0xd653('0x1e')](_0x30750c,_0x5e3d28);var _0x59c9dc=path[_0xd653('0x1e')](_0x30750c,_0x36b03b);if(fs['existsSync'](_0x42fd55)){_0x490041[_0xd653('0x25')]=_0xd653('0x26');_0x2a4d7f['message']['attachments']=[{'filename':_0x5e3d28,'path':_0x42fd55}];_0x2a4d7f[_0xd653('0x27')][_0xd653('0x28')]=util[_0xd653('0x16')](_0xd653('0x29'),JSON[_0xd653('0x2a')](_0x490041,null,0x2));}else if(fs['existsSync'](_0x59c9dc)){_0x490041[_0xd653('0x25')]=_0xd653('0x26');_0x2a4d7f[_0xd653('0x27')]['attachments']=[{'filename':_0x36b03b,'path':_0x59c9dc}];}else{_0x2a4d7f[_0xd653('0x27')][_0xd653('0x28')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2bf7a1[_0xd653('0x2b')]){_0x2fa0b3=![];logger[_0xd653('0x2c')](_0xd653('0x2d'));}}if(_0x2fa0b3){return client['request'](_0xd653('0x2e'),_0x2a4d7f)['then'](function(_0x1f301f){if(_0x1f301f[_0xd653('0x2f')]){return logger[_0xd653('0x2f')](_0xd653('0x30'),JSON[_0xd653('0x2a')](_0x1f301f));}return logger['info'](_0xd653('0x31'));})[_0xd653('0x32')](function(_0x23bf1d){return logger[_0xd653('0x2f')](_0xd653('0x30'),JSON[_0xd653('0x2a')](_0x23bf1d));});}};}function handleError(){return function(_0x2467e1){return logger[_0xd653('0x2f')](JSON[_0xd653('0x2a')](_0x2467e1));};}function handleResult(_0x20db31){return function(_0xfd7313){logger['info'](_0xd653('0x33'),JSON[_0xd653('0x2a')](_0xfd7313));if(_0x20db31[_0xd653('0x11')]&&_0x20db31[_0xd653('0x11')][_0xd653('0xe')]&&!_[_0xd653('0x34')](_0x20db31[_0xd653('0x19')])){setTimeout(handleSendEmail(_0x20db31,_0xfd7313),0x3c*0x3e8);}};}function handleJob(_0x403c4a){return function(){try{if(_[_0xd653('0x34')](_0x403c4a[_0xd653('0x1c')])){return logger[_0xd653('0x2c')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xd653('0x34')](_0x403c4a['subtractUnit'])){return logger['info'](_0xd653('0x35'));}var _0x283814={'startDate':moment()[_0xd653('0x36')](_0x403c4a[_0xd653('0x1c')],_0x403c4a[_0xd653('0x1d')])['format'](_0xd653('0x37')),'endDate':moment()['format'](_0xd653('0x37')),'type':_0xd653('0x38'),'output':_0x403c4a[_0xd653('0x39')],'name':_0x403c4a[_0xd653('0x18')]};if(!_[_0xd653('0x34')](_0x403c4a[_0xd653('0x3a')])){logger[_0xd653('0x2c')](_0xd653('0x3b'),_0x403c4a[_0xd653('0x3a')]);return analyticDefaultReportController[_0xd653('0x3c')]({'id':_0x403c4a['DefaultReportId']},_0x283814)[_0xd653('0x3d')](handleResult(_0x403c4a))[_0xd653('0x32')](handleError());}if(!_['isNil'](_0x403c4a[_0xd653('0x3e')])){logger[_0xd653('0x2c')](_0xd653('0x3f'),_0x403c4a[_0xd653('0x3e')]);return analyticCustomReportController[_0xd653('0x3c')]({'id':_0x403c4a['CustomReportId']},_0x283814)[_0xd653('0x3d')](handleResult(_0x403c4a))[_0xd653('0x32')](handleError());}}catch(_0x4fe21e){logger[_0xd653('0x2f')](JSON[_0xd653('0x2a')](_0x4fe21e));}return logger[_0xd653('0x2c')](_0xd653('0x40'));};}function getJobs(_0x35cb76){var _0x4fc78f={};if(_0x35cb76){_0x4fc78f['id']=_0x35cb76;}return db[_0xd653('0x41')]['findAll']({'where':_0x4fc78f,'include':[{'model':db[_0xd653('0x11')],'attributes':['id',_0xd653('0x18'),_0xd653('0x19')],'include':[{'model':db[_0xd653('0x42')],'as':_0xd653('0xe')}]}]})[_0xd653('0x3d')](function(_0x492233){var _0x472a50=_[_0xd653('0x43')](manager[_0xd653('0x44')]);var _0x2e4c7b=_['map'](_0x492233,function(_0x1c14c6){return _0x1c14c6['id'][_0xd653('0x45')]();});var _0x4a3d24=_[_0xd653('0x46')](_0x492233,function(_0x31b44b){return _0x31b44b['id'][_0xd653('0x45')]();});var _0x41548a=_0x35cb76?_0x2e4c7b:_[_0xd653('0x47')](_0x2e4c7b,_0x472a50);var _0x239687=_[_0xd653('0x48')](_0x2e4c7b,_0x472a50);var _0xff451b=_[_0xd653('0x47')](_0x472a50,_0x2e4c7b);var _0x4ebe34;var _0xf6e6a0;for(_0x4ebe34=0x0;_0x4ebe34<_0xff451b[_0xd653('0x49')]&&!_0x35cb76;_0x4ebe34+=0x1){_0xf6e6a0=_0xff451b[_0x4ebe34]['toString']();if(manager['exists'](_0xf6e6a0)){manager[_0xd653('0x4a')](_0xf6e6a0);manager[_0xd653('0x4b')](_0xf6e6a0);logger['info'](_0xd653('0x4c'),_0xf6e6a0);}}logger[_0xd653('0x2c')](_0xd653('0x4d'),JSON[_0xd653('0x2a')](_0x41548a));for(_0x4ebe34=0x0;_0x4ebe34<_0x41548a[_0xd653('0x49')];_0x4ebe34+=0x1){_0xf6e6a0=_0x41548a[_0x4ebe34][_0xd653('0x45')]();logger[_0xd653('0x2c')](_0xd653('0x4e'),_0xf6e6a0);if(_0x35cb76){logger['info'](_0xd653('0x4f'),_0x35cb76);logger[_0xd653('0x2c')](JSON['stringify'](_0x4a3d24[_0xf6e6a0]));BPromise[_0xd653('0x50')]()[_0xd653('0x3d')](handleJob(_0x4a3d24[_0xf6e6a0]));logger[_0xd653('0x2c')](_0xd653('0x51'),_0x4a3d24[_0xf6e6a0][_0xd653('0x18')],_0x4a3d24[_0xf6e6a0]['cron']);}else if(_0x4a3d24[_0xf6e6a0][_0xd653('0x52')]&&_0x4a3d24[_0xf6e6a0][_0xd653('0x53')]&&moment()[_0xd653('0x54')](_0x4a3d24[_0xf6e6a0][_0xd653('0x55')],_0x4a3d24[_0xf6e6a0][_0xd653('0x56')])){manager[_0xd653('0x57')](_0xf6e6a0,_0x4a3d24[_0xf6e6a0][_0xd653('0x52')],handleJob(_0x4a3d24[_0xf6e6a0]));manager[_0xd653('0x58')](_0xf6e6a0);logger['info'](_0xd653('0x59'),_0x4a3d24[_0xf6e6a0]['name'],_0x4a3d24[_0xf6e6a0]['cron']);}else if(manager['exists'](_0xf6e6a0)){manager['stop'](_0xf6e6a0);manager[_0xd653('0x4b')](_0xf6e6a0);logger['info']('stop\x20cron',_0x4a3d24[_0xf6e6a0][_0xd653('0x18')],_0x4a3d24[_0xf6e6a0][_0xd653('0x52')]);}}for(_0x4ebe34=0x0,_0xf6e6a0;_0x4ebe34<_0x239687[_0xd653('0x49')]&&!_0x35cb76;_0x4ebe34+=0x1){_0xf6e6a0=_0x239687[_0x4ebe34][_0xd653('0x45')]();if(manager[_0xd653('0x5a')](_0xf6e6a0)){if(_0x4a3d24[_0xf6e6a0][_0xd653('0x52')]&&_0x4a3d24[_0xf6e6a0]['active']&&moment()[_0xd653('0x54')](_0x4a3d24[_0xf6e6a0][_0xd653('0x55')],_0x4a3d24[_0xf6e6a0][_0xd653('0x56')])){manager['update'](_0xf6e6a0,_0x4a3d24[_0xf6e6a0][_0xd653('0x52')],handleJob(_0x4a3d24[_0xf6e6a0]));logger[_0xd653('0x2c')](_0xd653('0x5b'),_0x4a3d24[_0xf6e6a0]['name'],_0x4a3d24[_0xf6e6a0]['cron']);}else{manager[_0xd653('0x4a')](_0xf6e6a0);manager['deleteJob'](_0xf6e6a0);logger[_0xd653('0x2c')](_0xd653('0x5c'),_0x4a3d24[_0xf6e6a0][_0xd653('0x18')],_0x4a3d24[_0xf6e6a0]['cron']);}}}})[_0xd653('0x32')](function(_0x2c2100){logger[_0xd653('0x2f')](JSON[_0xd653('0x2a')](_0x2c2100));});}exports['run']=function(_0x3ceba1){return getJobs(_0x3ceba1);};exports[_0xd653('0x58')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6910=['schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','basename','extname','zip','Sent','message','text','stringify','existsSync','status','attachments','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','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','intersection','exists','delete\x20cron','toRun','length','index','my\x20id','cron','active','isBetween','startAt','endAt','add\x20cron','stop','deleteJob','stop\x20cron','update','update\x20cron','run','start','util','lodash','moment','cron-job-manager','bluebird'];(function(_0x32744a,_0x40c749){var _0x36265b=function(_0xf46846){while(--_0xf46846){_0x32744a['push'](_0x32744a['shift']());}};_0x36265b(++_0x40c749);}(_0x6910,0xfd));var _0x0691=function(_0x27fb50,_0x33a207){_0x27fb50=_0x27fb50-0x0;var _0x24a89a=_0x6910[_0x27fb50];return _0x24a89a;};'use strict';var fs=require('fs');var util=require(_0x0691('0x0'));var path=require('path');var _=require(_0x0691('0x1'));var moment=require(_0x0691('0x2'));var CronJobManager=require(_0x0691('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x0691('0x4'));var logger=require('../logger')(_0x0691('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x0691('0x6'));var client=jayson[_0x0691('0x7')][_0x0691('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1ff6e8,_0x540607){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x1ff6e8[_0x0691('0x9')]);var _0x4c68a5=!![];var _0x3510cc={'tls':{'rejectUnauthorized':![]}};if(_0x1ff6e8[_0x0691('0xa')][_0x0691('0xb')][_0x0691('0xc')]){_0x3510cc[_0x0691('0xc')]=_0x1ff6e8[_0x0691('0xa')][_0x0691('0xb')][_0x0691('0xc')];}else{_0x3510cc['host']=_0x1ff6e8['MailAccount']['Smtp'][_0x0691('0xd')];_0x3510cc['port']=_0x1ff6e8['MailAccount'][_0x0691('0xb')][_0x0691('0xe')];_0x3510cc[_0x0691('0xf')]=_0x1ff6e8[_0x0691('0xa')][_0x0691('0xb')]['secure'];}if(_0x1ff6e8[_0x0691('0xa')][_0x0691('0xb')][_0x0691('0x10')]){_0x3510cc[_0x0691('0x11')]={'user':_0x1ff6e8[_0x0691('0xa')][_0x0691('0xb')][_0x0691('0x12')],'pass':_0x1ff6e8[_0x0691('0xa')][_0x0691('0xb')][_0x0691('0x13')]};}var _0x59da42={'account':_0x3510cc,'message':{'from':util[_0x0691('0x14')]('\x22%s\x22\x20<%s>',_0x1ff6e8['MailAccount'][_0x0691('0x15')],_0x1ff6e8[_0x0691('0xa')][_0x0691('0x9')]||_0x1ff6e8[_0x0691('0xa')][_0x0691('0xb')][_0x0691('0x12')]),'to':_0x1ff6e8[_0x0691('0x9')],'cc':_0x1ff6e8['cc'],'bcc':_0x1ff6e8['bcc'],'subject':util[_0x0691('0x14')](_0x0691('0x16'),_0x540607[_0x0691('0x15')],_0x1ff6e8[_0x0691('0x17')],_0x1ff6e8['subtractUnit'])}};var _0x417f66=path[_0x0691('0x18')](__dirname,_0x0691('0x19'));var _0x410f04=_0x540607[_0x0691('0x1a')];var _0x385297=util[_0x0691('0x14')]('%s.%s',path[_0x0691('0x1b')](_0x540607[_0x0691('0x1a')],path[_0x0691('0x1c')](_0x540607[_0x0691('0x1a')])),_0x0691('0x1d'));var _0x1404ed=path[_0x0691('0x18')](_0x417f66,_0x410f04);var _0x2df000=path[_0x0691('0x18')](_0x417f66,_0x385297);if(fs['existsSync'](_0x1404ed)){_0x540607['status']=_0x0691('0x1e');_0x59da42[_0x0691('0x1f')]['attachments']=[{'filename':_0x410f04,'path':_0x1404ed}];_0x59da42[_0x0691('0x1f')][_0x0691('0x20')]=util[_0x0691('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x0691('0x21')](_0x540607,null,0x2));}else if(fs[_0x0691('0x22')](_0x2df000)){_0x540607[_0x0691('0x23')]=_0x0691('0x1e');_0x59da42[_0x0691('0x1f')][_0x0691('0x24')]=[{'filename':_0x385297,'path':_0x2df000}];}else{_0x59da42[_0x0691('0x1f')]['text']=_0x0691('0x25');if(!_0x1ff6e8[_0x0691('0x26')]){_0x4c68a5=![];logger[_0x0691('0x27')](_0x0691('0x28'));}}if(_0x4c68a5){return client[_0x0691('0x29')]('SendMail',_0x59da42)[_0x0691('0x2a')](function(_0x2c3e3f){if(_0x2c3e3f[_0x0691('0x2b')]){return logger[_0x0691('0x2b')](_0x0691('0x2c'),JSON['stringify'](_0x2c3e3f));}return logger[_0x0691('0x27')](_0x0691('0x2d'));})[_0x0691('0x2e')](function(_0x2ee911){return logger[_0x0691('0x2b')]('error\x20mail',JSON['stringify'](_0x2ee911));});}};}function handleError(){return function(_0x3434de){return logger[_0x0691('0x2b')](JSON[_0x0691('0x21')](_0x3434de));};}function handleResult(_0x591e08){return function(_0x574077){logger[_0x0691('0x27')]('data',JSON['stringify'](_0x574077));if(_0x591e08[_0x0691('0xa')]&&_0x591e08[_0x0691('0xa')][_0x0691('0xb')]&&!_[_0x0691('0x2f')](_0x591e08[_0x0691('0x9')])){setTimeout(handleSendEmail(_0x591e08,_0x574077),0x3c*0x3e8);}};}function handleJob(_0x5c08a9){return function(){try{if(_[_0x0691('0x2f')](_0x5c08a9[_0x0691('0x17')])){return logger[_0x0691('0x27')](_0x0691('0x30'));}if(_[_0x0691('0x2f')](_0x5c08a9[_0x0691('0x31')])){return logger['info'](_0x0691('0x32'));}var _0x2cdb97={'startDate':moment()[_0x0691('0x33')](_0x5c08a9[_0x0691('0x17')],_0x5c08a9[_0x0691('0x31')])['format'](_0x0691('0x34')),'endDate':moment()[_0x0691('0x14')](_0x0691('0x34')),'type':_0x0691('0x35'),'output':_0x5c08a9[_0x0691('0x36')],'name':_0x5c08a9[_0x0691('0x15')]};if(!_[_0x0691('0x2f')](_0x5c08a9[_0x0691('0x37')])){logger[_0x0691('0x27')](_0x0691('0x38'),_0x5c08a9['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x5c08a9[_0x0691('0x37')]},_0x2cdb97)[_0x0691('0x2a')](handleResult(_0x5c08a9))['catch'](handleError());}if(!_[_0x0691('0x2f')](_0x5c08a9[_0x0691('0x39')])){logger[_0x0691('0x27')]('exec\x20custom\x20report\x20id:%s',_0x5c08a9[_0x0691('0x39')]);return analyticCustomReportController[_0x0691('0x3a')]({'id':_0x5c08a9['CustomReportId']},_0x2cdb97)[_0x0691('0x2a')](handleResult(_0x5c08a9))[_0x0691('0x2e')](handleError());}}catch(_0x1df2be){logger[_0x0691('0x2b')](JSON['stringify'](_0x1df2be));}return logger[_0x0691('0x27')]('no\x20report\x20id');};}function getJobs(_0x364459){var _0x237bd9={};if(_0x364459){_0x237bd9['id']=_0x364459;}return db[_0x0691('0x3b')][_0x0691('0x3c')]({'where':_0x237bd9,'include':[{'model':db[_0x0691('0xa')],'attributes':['id',_0x0691('0x15'),'email'],'include':[{'model':db[_0x0691('0x3d')],'as':_0x0691('0xb')}]}]})[_0x0691('0x2a')](function(_0x19d7a0){var _0x1d2537=_['keys'](manager[_0x0691('0x3e')]);var _0x353418=_[_0x0691('0x3f')](_0x19d7a0,function(_0x35ffec){return _0x35ffec['id'][_0x0691('0x40')]();});var _0x565920=_[_0x0691('0x41')](_0x19d7a0,function(_0x1d5f32){return _0x1d5f32['id'][_0x0691('0x40')]();});var _0x573700=_0x364459?_0x353418:_['difference'](_0x353418,_0x1d2537);var _0x5b90a7=_[_0x0691('0x42')](_0x353418,_0x1d2537);var _0x52c981=_['difference'](_0x1d2537,_0x353418);var _0x41b81f;var _0x3a27c9;for(_0x41b81f=0x0;_0x41b81f<_0x52c981['length']&&!_0x364459;_0x41b81f+=0x1){_0x3a27c9=_0x52c981[_0x41b81f]['toString']();if(manager[_0x0691('0x43')](_0x3a27c9)){manager['stop'](_0x3a27c9);manager['deleteJob'](_0x3a27c9);logger[_0x0691('0x27')](_0x0691('0x44'),_0x3a27c9);}}logger[_0x0691('0x27')](_0x0691('0x45'),JSON[_0x0691('0x21')](_0x573700));for(_0x41b81f=0x0;_0x41b81f<_0x573700[_0x0691('0x46')];_0x41b81f+=0x1){_0x3a27c9=_0x573700[_0x41b81f]['toString']();logger[_0x0691('0x27')](_0x0691('0x47'),_0x3a27c9);if(_0x364459){logger[_0x0691('0x27')](_0x0691('0x48'),_0x364459);logger['info'](JSON['stringify'](_0x565920[_0x3a27c9]));BPromise['resolve']()[_0x0691('0x2a')](handleJob(_0x565920[_0x3a27c9]));logger[_0x0691('0x27')]('run\x20job',_0x565920[_0x3a27c9][_0x0691('0x15')],_0x565920[_0x3a27c9][_0x0691('0x49')]);}else if(_0x565920[_0x3a27c9][_0x0691('0x49')]&&_0x565920[_0x3a27c9][_0x0691('0x4a')]&&moment()[_0x0691('0x4b')](_0x565920[_0x3a27c9][_0x0691('0x4c')],_0x565920[_0x3a27c9][_0x0691('0x4d')])){manager['add'](_0x3a27c9,_0x565920[_0x3a27c9][_0x0691('0x49')],handleJob(_0x565920[_0x3a27c9]));manager['start'](_0x3a27c9);logger['info'](_0x0691('0x4e'),_0x565920[_0x3a27c9][_0x0691('0x15')],_0x565920[_0x3a27c9]['cron']);}else if(manager[_0x0691('0x43')](_0x3a27c9)){manager[_0x0691('0x4f')](_0x3a27c9);manager[_0x0691('0x50')](_0x3a27c9);logger['info'](_0x0691('0x51'),_0x565920[_0x3a27c9][_0x0691('0x15')],_0x565920[_0x3a27c9][_0x0691('0x49')]);}}for(_0x41b81f=0x0,_0x3a27c9;_0x41b81f<_0x5b90a7['length']&&!_0x364459;_0x41b81f+=0x1){_0x3a27c9=_0x5b90a7[_0x41b81f][_0x0691('0x40')]();if(manager[_0x0691('0x43')](_0x3a27c9)){if(_0x565920[_0x3a27c9]['cron']&&_0x565920[_0x3a27c9][_0x0691('0x4a')]&&moment()[_0x0691('0x4b')](_0x565920[_0x3a27c9][_0x0691('0x4c')],_0x565920[_0x3a27c9][_0x0691('0x4d')])){manager[_0x0691('0x52')](_0x3a27c9,_0x565920[_0x3a27c9][_0x0691('0x49')],handleJob(_0x565920[_0x3a27c9]));logger[_0x0691('0x27')](_0x0691('0x53'),_0x565920[_0x3a27c9][_0x0691('0x15')],_0x565920[_0x3a27c9][_0x0691('0x49')]);}else{manager['stop'](_0x3a27c9);manager['deleteJob'](_0x3a27c9);logger[_0x0691('0x27')](_0x0691('0x51'),_0x565920[_0x3a27c9][_0x0691('0x15')],_0x565920[_0x3a27c9]['cron']);}}}})[_0x0691('0x2e')](function(_0x578e55){logger[_0x0691('0x2b')](JSON[_0x0691('0x21')](_0x578e55));});}exports[_0x0691('0x54')]=function(_0x459fe5){return getJobs(_0x459fe5);};exports[_0x0691('0x55')]=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 49c132a..f65a62d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76fe=['Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo'];(function(_0x539112,_0x2a502a){var _0x2a47b9=function(_0x391bb8){while(--_0x391bb8){_0x539112['push'](_0x539112['shift']());}};_0x2a47b9(++_0x2a502a);}(_0x76fe,0x179));var _0xe76f=function(_0x1f23b1,_0x57c83f){_0x1f23b1=_0x1f23b1-0x0;var _0x3c9197=_0x76fe[_0x1f23b1];return _0x3c9197;};'use strict';var util=require(_0xe76f('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe76f('0x1')]({'id':i,'firstName':_0xe76f('0x2')+i,'lastName':_0xe76f('0x3')+i,'phone':0xf879fb460+i,'email':_0xe76f('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xe76f('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe76f('0x2')+i,'lastName':_0xe76f('0x3')+i,'phone':0xf879fb460+i,'email':_0xe76f('0x4')+i+_0xe76f('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe76f('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe76f('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe76f('0x5')](),'updatedAt':Date['now']()});}db[_0xe76f('0x7')][_0xe76f('0x8')]({'where':{}})['then'](function(){return db[_0xe76f('0x7')][_0xe76f('0x9')](contacts);})[_0xe76f('0xa')](function(){console[_0xe76f('0xb')](_0xe76f('0xc'),_0xe76f('0xd'));return db[_0xe76f('0xe')]['destroy']({'where':{}});})[_0xe76f('0xa')](function(){return db[_0xe76f('0xe')][_0xe76f('0x9')](hopper);})[_0xe76f('0xa')](function(){console['log'](_0xe76f('0xc'),_0xe76f('0xf'));return db[_0xe76f('0x7')][_0xe76f('0x9')](contacts2);})['then'](function(){console[_0xe76f('0xb')](_0xe76f('0xc'),_0xe76f('0x10'));return db[_0xe76f('0xe')][_0xe76f('0x9')](hopper2);})['then'](function(){console[_0xe76f('0xb')](_0xe76f('0xc'),_0xe76f('0x11'));})[_0xe76f('0x12')](function(_0x2f3cd1){console['log'](_0x2f3cd1);}); \ No newline at end of file +var _0x0c11=['Innocenzo','@xcally.com','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','catch','util','../mysqldb','Biondo','innocenzo.biondo','push','now'];(function(_0x229dde,_0x3e7444){var _0x2fc75b=function(_0x11bbbe){while(--_0x11bbbe){_0x229dde['push'](_0x229dde['shift']());}};_0x2fc75b(++_0x3e7444);}(_0x0c11,0x1c5));var _0x10c1=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x0c11[_0x52a857];return _0x4e2aae;};'use strict';var util=require(_0x10c1('0x0'));var db=require(_0x10c1('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x10c1('0x2')+i,'phone':0xf879fb460+i,'email':_0x10c1('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x10c1('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x10c1('0x5')](),'updatedAt':Date[_0x10c1('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x10c1('0x4')]({'id':i,'firstName':_0x10c1('0x6')+i,'lastName':_0x10c1('0x2')+i,'phone':0xf879fb460+i,'email':_0x10c1('0x3')+i+_0x10c1('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x10c1('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x10c1('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x10c1('0x5')](),'updatedAt':Date[_0x10c1('0x5')]()});}db['CmContact'][_0x10c1('0x8')]({'where':{}})[_0x10c1('0x9')](function(){return db['CmContact'][_0x10c1('0xa')](contacts);})[_0x10c1('0x9')](function(){console[_0x10c1('0xb')](_0x10c1('0xc'),'contacts1');return db[_0x10c1('0xd')][_0x10c1('0x8')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x10c1('0xa')](hopper);})['then'](function(){console[_0x10c1('0xb')](_0x10c1('0xc'),_0x10c1('0xe'));return db['CmContact'][_0x10c1('0xa')](contacts2);})['then'](function(){console['log'](_0x10c1('0xc'),_0x10c1('0xf'));return db[_0x10c1('0xd')][_0x10c1('0xa')](hopper2);})['then'](function(){console[_0x10c1('0xb')]('finished\x20populating','hopper2');})[_0x10c1('0x10')](function(_0x58ddf0){console[_0x10c1('0xb')](_0x58ddf0);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1a35d07..a7b8b36 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2baf=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','add\x20user','catch','log','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x2baf,0xc8));var _0xf2ba=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x2baf[_0x352e09];return _0x1b7094;};'use strict';var util=require('util');var db=require(_0xf2ba('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf2ba('0x1')]({'name':util[_0xf2ba('0x2')](_0xf2ba('0x3'),_0xf2ba('0x4'),i),'fullname':util['format'](_0xf2ba('0x3'),'agent',i),'email':util['format'](_0xf2ba('0x5'),_0xf2ba('0x4'),i),'role':_0xf2ba('0x4'),'password':_0xf2ba('0x6'),'internal':0xfa0+i,'type':_0xf2ba('0x7'),'transport':['udp','ws',_0xf2ba('0x8')],'disallow':[_0xf2ba('0x9')],'allow':[_0xf2ba('0xa')],'defaultuser':util[_0xf2ba('0x2')](_0xf2ba('0x3'),_0xf2ba('0x4'),i),'encryption':_0xf2ba('0xb'),'avpf':_0xf2ba('0xb'),'force_avp':_0xf2ba('0xb'),'icesupport':_0xf2ba('0xb'),'dtlsenable':_0xf2ba('0xb'),'dtlsverify':'no','dtlscertfile':_0xf2ba('0xc'),'dtlsprivatekey':_0xf2ba('0xd'),'dtlssetup':_0xf2ba('0xe'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0xf2ba('0x2')](_0xf2ba('0x3'),'agent',i),0xfa0+i)});}db[_0xf2ba('0xf')][_0xf2ba('0x10')](users)[_0xf2ba('0x11')](function(){console['log'](_0xf2ba('0x12'));})[_0xf2ba('0x13')](function(_0x12e446){console[_0xf2ba('0x14')](_0x12e446);}); \ No newline at end of file +var _0xcd47=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss'];(function(_0x5ae014,_0x79dc2e){var _0x11bb09=function(_0x3c7af2){while(--_0x3c7af2){_0x5ae014['push'](_0x5ae014['shift']());}};_0x11bb09(++_0x79dc2e);}(_0xcd47,0x1c5));var _0x7cd4=function(_0x405069,_0x14db45){_0x405069=_0x405069-0x0;var _0xd7c425=_0xcd47[_0x405069];return _0xd7c425;};'use strict';var util=require(_0x7cd4('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7cd4('0x1')]({'name':util[_0x7cd4('0x2')](_0x7cd4('0x3'),_0x7cd4('0x4'),i),'fullname':util[_0x7cd4('0x2')](_0x7cd4('0x3'),_0x7cd4('0x4'),i),'email':util[_0x7cd4('0x2')](_0x7cd4('0x5'),'agent',i),'role':_0x7cd4('0x4'),'password':_0x7cd4('0x6'),'internal':0xfa0+i,'type':_0x7cd4('0x7'),'transport':['udp','ws',_0x7cd4('0x8')],'disallow':[_0x7cd4('0x9')],'allow':[_0x7cd4('0xa')],'defaultuser':util['format']('%s%s',_0x7cd4('0x4'),i),'encryption':'yes','avpf':'yes','force_avp':_0x7cd4('0xb'),'icesupport':_0x7cd4('0xb'),'dtlsenable':_0x7cd4('0xb'),'dtlsverify':'no','dtlscertfile':_0x7cd4('0xc'),'dtlsprivatekey':_0x7cd4('0xd'),'dtlssetup':_0x7cd4('0xe'),'callerid':util[_0x7cd4('0x2')]('\x22%s\x22\x20<%s>',util[_0x7cd4('0x2')](_0x7cd4('0x3'),_0x7cd4('0x4'),i),0xfa0+i)});}db[_0x7cd4('0xf')][_0x7cd4('0x10')](users)[_0x7cd4('0x11')](function(){console[_0x7cd4('0x12')](_0x7cd4('0x13'));})[_0x7cd4('0x14')](function(_0x1be1ad){console[_0x7cd4('0x12')](_0x1be1ad);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d764121..e679109 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2efa=['connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','User','agent','telephone','type','ivr','format','%s:queue:%s','Agents','length','user:%s','query','find','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','then','role','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','findAll','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getVoiceQueues','getMailQueues','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','log','join','default','setMaxListeners','address','request'];(function(_0x1e454,_0x587c4a){var _0x4ead8f=function(_0x5999d3){while(--_0x5999d3){_0x1e454['push'](_0x1e454['shift']());}};_0x4ead8f(++_0x587c4a);}(_0x2efa,0x141));var _0xa2ef=function(_0x369d85,_0x35724e){_0x369d85=_0x369d85-0x0;var _0x38e747=_0x2efa[_0x369d85];return _0x38e747;};'use strict';var _=require(_0xa2ef('0x0'));var util=require('util');var BPromise=require(_0xa2ef('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xa2ef('0x2'));var queryQueues={'attributes':['id',_0xa2ef('0x3')],'include':[{'as':'Agents','model':db[_0xa2ef('0x4')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0xa2ef('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa2ef('0x3')],'where':{'role':_0xa2ef('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa2ef('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xa2ef('0x3')],'where':{'role':_0xa2ef('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa2ef('0x3'),_0xa2ef('0x7')],'where':{'type':_0xa2ef('0x8')}};function joinOrLeaveQueues(_0x1e30d3,_0x3833c6,_0x3f3613,_0x7b04ea){_0x1e30d3[_0x3833c6](util[_0xa2ef('0x9')](_0xa2ef('0xa'),_0x3f3613,_0x7b04ea[_0xa2ef('0x3')]));if(_0x7b04ea[_0xa2ef('0xb')]){for(var _0x5d9bc0=0x0;_0x5d9bc0<_0x7b04ea[_0xa2ef('0xb')][_0xa2ef('0xc')];_0x5d9bc0+=0x1){_0x1e30d3[_0x3833c6](util[_0xa2ef('0x9')](_0xa2ef('0xd'),_0x7b04ea[_0xa2ef('0xb')][_0x5d9bc0][_0xa2ef('0x3')]));}}}function joinOrLeave(_0x154e60,_0x28340e,_0x374b7e){var _0x57b999;if(_0x154e60['handshake'][_0xa2ef('0xe')]['id']){db[_0xa2ef('0x4')][_0xa2ef('0xf')]({'attributes':['id',_0xa2ef('0x3'),'role'],'where':{'id':_0x154e60['handshake'][_0xa2ef('0xe')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xa2ef('0x10'),'attributes':['id'],'raw':!![]},{'model':db[_0xa2ef('0x11')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa2ef('0x12')],'as':_0xa2ef('0x13'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xa2ef('0x14'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xa2ef('0x15'),'attributes':['id'],'raw':!![]}]})[_0xa2ef('0x16')](function(_0x57035e){if(_0x57035e){_0x57b999=_0x57035e;_0x154e60[_0x28340e](util[_0xa2ef('0x9')]('user:%s',_0x57035e[_0xa2ef('0x3')]));var _0x57f924=[];switch(_0x57035e[_0xa2ef('0x17')]){case _0xa2ef('0x18'):_0x154e60[_0x28340e](_0xa2ef('0x19'));_0x154e60[_0x28340e](_0xa2ef('0x1a'));if(queryQueues['hasOwnProperty'](_0xa2ef('0x1b'))){delete queryQueues[_0xa2ef('0x1b')];}_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x1d')]['findAll'](queryQueues));_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x1e')][_0xa2ef('0x1f')](queryQueues));_0x57f924['push'](db['FaxQueue'][_0xa2ef('0x1f')](queryQueues));_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x20')][_0xa2ef('0x1f')](queryQueues));_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x21')][_0xa2ef('0x1f')](queryQueues));_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x22')]['findAll'](queryQueues));_0x57f924['push'](db[_0xa2ef('0x4')][_0xa2ef('0x1f')](queryTelephones));_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x23')][_0xa2ef('0x1f')](queryTrunks));_0x57f924['push'](db[_0xa2ef('0x24')][_0xa2ef('0x1f')](queryCampaigns));_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x4')][_0xa2ef('0x1f')](queryAgents));break;case _0xa2ef('0x25'):_0x154e60[_0x28340e]('voice:inbound');_0x154e60[_0x28340e](_0xa2ef('0x1a'));_0x57f924[_0xa2ef('0x1c')](_0x57035e['getVoiceQueues'](queryQueues));_0x57f924[_0xa2ef('0x1c')](_0x57035e[_0xa2ef('0x26')](queryQueues));_0x57f924[_0xa2ef('0x1c')](_0x57035e[_0xa2ef('0x27')](queryQueues));_0x57f924['push'](_0x57035e[_0xa2ef('0x28')](queryQueues));_0x57f924[_0xa2ef('0x1c')](_0x57035e['getMailQueues'](queryQueues));_0x57f924['push'](_0x57035e[_0xa2ef('0x29')](queryQueues));_0x57f924['push'](db[_0xa2ef('0x4')][_0xa2ef('0x1f')](queryTelephones));_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x23')][_0xa2ef('0x1f')](queryTrunks));_0x57f924[_0xa2ef('0x1c')](db['Campaign'][_0xa2ef('0x1f')](queryCampaigns));_0x57f924[_0xa2ef('0x1c')](db[_0xa2ef('0x4')][_0xa2ef('0x1f')](queryAgents));break;case _0xa2ef('0x5'):_0x154e60[_0x28340e](_0xa2ef('0x19'));_0x154e60[_0x28340e](_0xa2ef('0x1a'));_0x57f924[_0xa2ef('0x1c')](_0x57035e[_0xa2ef('0x2a')]({'attributes':['id',_0xa2ef('0x3')]}));_0x57f924['push'](_0x57035e[_0xa2ef('0x26')]({'attributes':['id',_0xa2ef('0x3')]}));_0x57f924[_0xa2ef('0x1c')](_0x57035e[_0xa2ef('0x27')]({'attributes':['id','name']}));_0x57f924[_0xa2ef('0x1c')](_0x57035e[_0xa2ef('0x28')]({'attributes':['id',_0xa2ef('0x3')]}));_0x57f924['push'](_0x57035e[_0xa2ef('0x2b')]({'attributes':['id',_0xa2ef('0x3')]}));_0x57f924[_0xa2ef('0x1c')](_0x57035e[_0xa2ef('0x29')]({'attributes':['id',_0xa2ef('0x3')]}));break;}return BPromise['all'](_0x57f924);}})['then'](function(_0x94f1db){if(_0x94f1db&&_0x94f1db[_0xa2ef('0xc')]){for(var _0x4acc45=0x0;_0x4acc45<_0x94f1db['length'];_0x4acc45+=0x1){for(var _0x253c93=0x0;_0x253c93<_0x94f1db[_0x4acc45]['length'];_0x253c93+=0x1){switch(_0x4acc45){case 0x0:joinOrLeaveQueues(_0x154e60,_0x28340e,_0xa2ef('0x2c'),_0x94f1db[_0x4acc45][_0x253c93]);break;case 0x1:joinOrLeaveQueues(_0x154e60,_0x28340e,_0xa2ef('0x2d'),_0x94f1db[_0x4acc45][_0x253c93]);break;case 0x2:joinOrLeaveQueues(_0x154e60,_0x28340e,_0xa2ef('0x2e'),_0x94f1db[_0x4acc45][_0x253c93]);break;case 0x3:joinOrLeaveQueues(_0x154e60,_0x28340e,_0xa2ef('0x2f'),_0x94f1db[_0x4acc45][_0x253c93]);break;case 0x4:joinOrLeaveQueues(_0x154e60,_0x28340e,_0xa2ef('0x30'),_0x94f1db[_0x4acc45][_0x253c93]);break;case 0x5:joinOrLeaveQueues(_0x154e60,_0x28340e,_0xa2ef('0x31'),_0x94f1db[_0x4acc45][_0x253c93]);break;case 0x6:_0x154e60[_0x28340e](util[_0xa2ef('0x9')](_0xa2ef('0x32'),_0x94f1db[_0x4acc45][_0x253c93][_0xa2ef('0x3')]));break;case 0x7:_0x154e60[_0x28340e](util[_0xa2ef('0x9')](_0xa2ef('0x33'),_0x94f1db[_0x4acc45][_0x253c93][_0xa2ef('0x3')]));break;case 0x8:_0x154e60[_0x28340e](util[_0xa2ef('0x9')](_0xa2ef('0x34'),_0x94f1db[_0x4acc45][_0x253c93][_0xa2ef('0x7')],_0x94f1db[_0x4acc45][_0x253c93][_0xa2ef('0x3')]));break;case 0x9:_0x154e60[_0x28340e](util['format']('user:%s',_0x94f1db[_0x4acc45][_0x253c93][_0xa2ef('0x3')]));break;}}}}})[_0xa2ef('0x16')](function(){if(_0x28340e===_0xa2ef('0x35')){var _0x5c0185=_[_0xa2ef('0x36')](_0x57b999[_0xa2ef('0x10')],'id');return _0x57b999[_0xa2ef('0x37')](_0x5c0185)[_0xa2ef('0x16')](function(){for(var _0x33678e=0x0;_0x33678e<_0x5c0185[_0xa2ef('0xc')];_0x33678e+=0x1){_0x374b7e[_0xa2ef('0x38')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x5c0185[_0x33678e]),'UserId':Number(_0x57b999['id'])});}});}})[_0xa2ef('0x16')](function(){if(_0x28340e===_0xa2ef('0x35')){var _0x2aac68=_[_0xa2ef('0x36')](_0x57b999['MailInteractions'],'id');return _0x57b999[_0xa2ef('0x39')](_0x2aac68)[_0xa2ef('0x16')](function(){for(var _0x230c0a=0x0;_0x230c0a<_0x2aac68[_0xa2ef('0xc')];_0x230c0a+=0x1){_0x374b7e[_0xa2ef('0x38')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2aac68[_0x230c0a]),'UserId':Number(_0x57b999['id'])});}});}})[_0xa2ef('0x16')](function(){if(_0x28340e===_0xa2ef('0x35')){var _0x4fc091=_[_0xa2ef('0x36')](_0x57b999[_0xa2ef('0x13')],'id');return _0x57b999[_0xa2ef('0x3a')](_0x4fc091)[_0xa2ef('0x16')](function(){for(var _0x56462d=0x0;_0x56462d<_0x4fc091[_0xa2ef('0xc')];_0x56462d+=0x1){_0x374b7e[_0xa2ef('0x38')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4fc091[_0x56462d]),'UserId':Number(_0x57b999['id'])});}});}})[_0xa2ef('0x16')](function(){if(_0x28340e===_0xa2ef('0x35')){var _0x2972dd=_[_0xa2ef('0x36')](_0x57b999[_0xa2ef('0x14')],'id');return _0x57b999[_0xa2ef('0x3b')](_0x2972dd)[_0xa2ef('0x16')](function(){for(var _0x4af30e=0x0;_0x4af30e<_0x2972dd[_0xa2ef('0xc')];_0x4af30e+=0x1){_0x374b7e['emit'](_0xa2ef('0x3c'),{'SmsInteractionId':Number(_0x2972dd[_0x4af30e]),'UserId':Number(_0x57b999['id'])});}});}})[_0xa2ef('0x16')](function(){if(_0x28340e==='leave'){var _0x561c48=_[_0xa2ef('0x36')](_0x57b999[_0xa2ef('0x15')],'id');return _0x57b999[_0xa2ef('0x3d')](_0x561c48)[_0xa2ef('0x16')](function(){for(var _0x4e53e7=0x0;_0x4e53e7<_0x561c48[_0xa2ef('0xc')];_0x4e53e7+=0x1){_0x374b7e[_0xa2ef('0x38')](_0xa2ef('0x3e'),{'OpenchannelInteractionId':Number(_0x561c48[_0x4e53e7]),'UserId':Number(_0x57b999['id'])});}});}})['catch'](function(_0x5c80e5){_0x154e60[_0xa2ef('0x3f')](_0x5c80e5);});}}function onDisconnect(_0x397ef9,_0x3942ac){joinOrLeave(_0x397ef9,_0xa2ef('0x35'),_0x3942ac);}function onConnect(_0x27cb2f){joinOrLeave(_0x27cb2f,_0xa2ef('0x40'));}exports[_0xa2ef('0x41')]=function(_0x2709f7){_0x2709f7['on']('connection',function(_0x15f816){_0x15f816[_0xa2ef('0x42')](0x0);_0x15f816[_0xa2ef('0x43')]=_0x15f816[_0xa2ef('0x44')][_0xa2ef('0x45')][_0xa2ef('0x46')]+':'+_0x15f816[_0xa2ef('0x44')][_0xa2ef('0x45')][_0xa2ef('0x47')];_0x15f816[_0xa2ef('0x48')]=new Date();_0x15f816[_0xa2ef('0x3f')]=function(_0x4773c3){console[_0xa2ef('0x3f')](_0xa2ef('0x49')+_0x15f816[_0xa2ef('0x4a')][_0xa2ef('0x3')]+'['+_0x15f816[_0xa2ef('0x43')]+']',_0x4773c3);};_0x15f816['on'](_0xa2ef('0x4b'),function(){onDisconnect(_0x15f816,_0x2709f7);_0x15f816[_0xa2ef('0x3f')](_0xa2ef('0x4c'));});onConnect(_0x15f816);_0x15f816[_0xa2ef('0x3f')](_0xa2ef('0x4d'));});}; \ No newline at end of file +var _0x0a9f=['voice:inbound','voice:outbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','then','voice','chat','sms','mail','openchannel','telephone:%s','trunk:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','catch','log','join','default','setMaxListeners','address','connection','remoteAddress','request','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','ivr','format','length','user:%s','handshake','query','find','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','hasOwnProperty','include','push','VoiceQueue','findAll','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','Campaign','user'];(function(_0xf0d35,_0xce9c1c){var _0x5ba3bc=function(_0x3314d3){while(--_0x3314d3){_0xf0d35['push'](_0xf0d35['shift']());}};_0x5ba3bc(++_0xce9c1c);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x5206a7,_0x3c7975){_0x5206a7=_0x5206a7-0x0;var _0x4cd7ee=_0x0a9f[_0x5206a7];return _0x4cd7ee;};'use strict';var _=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var BPromise=require(_0xf0a9('0x2'));var db=require(_0xf0a9('0x3'))['db'];var config=require(_0xf0a9('0x4'));var queryQueues={'attributes':['id',_0xf0a9('0x5')],'include':[{'as':_0xf0a9('0x6'),'model':db[_0xf0a9('0x7')],'attributes':['id',_0xf0a9('0x5'),_0xf0a9('0x8')],'raw':!![],'where':{'role':_0xf0a9('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf0a9('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xf0a9('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf0a9('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf0a9('0x5'),'type'],'where':{'type':_0xf0a9('0xa')}};function joinOrLeaveQueues(_0x150bf8,_0x5acca0,_0x33f509,_0x1bb530){_0x150bf8[_0x5acca0](util[_0xf0a9('0xb')]('%s:queue:%s',_0x33f509,_0x1bb530[_0xf0a9('0x5')]));if(_0x1bb530[_0xf0a9('0x6')]){for(var _0x25530a=0x0;_0x25530a<_0x1bb530[_0xf0a9('0x6')][_0xf0a9('0xc')];_0x25530a+=0x1){_0x150bf8[_0x5acca0](util[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x1bb530[_0xf0a9('0x6')][_0x25530a][_0xf0a9('0x5')]));}}}function joinOrLeave(_0x19b0b8,_0x123f9b,_0x189e2a){var _0x4c0b0d;if(_0x19b0b8[_0xf0a9('0xe')][_0xf0a9('0xf')]['id']){db[_0xf0a9('0x7')][_0xf0a9('0x10')]({'attributes':['id',_0xf0a9('0x5'),_0xf0a9('0x8')],'where':{'id':_0x19b0b8['handshake'][_0xf0a9('0xf')]['id']},'include':[{'model':db[_0xf0a9('0x11')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf0a9('0x12')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf0a9('0x13')],'as':_0xf0a9('0x14'),'attributes':['id'],'raw':!![]},{'model':db[_0xf0a9('0x15')],'as':_0xf0a9('0x16'),'attributes':['id'],'raw':!![]},{'model':db[_0xf0a9('0x17')],'as':_0xf0a9('0x18'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1952ab){if(_0x1952ab){_0x4c0b0d=_0x1952ab;_0x19b0b8[_0x123f9b](util[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x1952ab[_0xf0a9('0x5')]));var _0x21d9fc=[];switch(_0x1952ab[_0xf0a9('0x8')]){case _0xf0a9('0x19'):_0x19b0b8[_0x123f9b]('voice:inbound');_0x19b0b8[_0x123f9b]('voice:outbound');if(queryQueues[_0xf0a9('0x1a')](_0xf0a9('0x1b'))){delete queryQueues[_0xf0a9('0x1b')];}_0x21d9fc[_0xf0a9('0x1c')](db[_0xf0a9('0x1d')][_0xf0a9('0x1e')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](db['ChatQueue'][_0xf0a9('0x1e')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](db[_0xf0a9('0x1f')]['findAll'](queryQueues));_0x21d9fc['push'](db[_0xf0a9('0x20')][_0xf0a9('0x1e')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](db['MailQueue'][_0xf0a9('0x1e')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](db[_0xf0a9('0x21')]['findAll'](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](db['User'][_0xf0a9('0x1e')](queryTelephones));_0x21d9fc['push'](db[_0xf0a9('0x22')]['findAll'](queryTrunks));_0x21d9fc[_0xf0a9('0x1c')](db[_0xf0a9('0x23')][_0xf0a9('0x1e')](queryCampaigns));_0x21d9fc[_0xf0a9('0x1c')](db[_0xf0a9('0x7')][_0xf0a9('0x1e')](queryAgents));break;case _0xf0a9('0x24'):_0x19b0b8[_0x123f9b](_0xf0a9('0x25'));_0x19b0b8[_0x123f9b](_0xf0a9('0x26'));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab[_0xf0a9('0x27')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab[_0xf0a9('0x28')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab[_0xf0a9('0x29')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab[_0xf0a9('0x2a')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab[_0xf0a9('0x2b')](queryQueues));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab[_0xf0a9('0x2c')](queryQueues));_0x21d9fc['push'](db[_0xf0a9('0x7')][_0xf0a9('0x1e')](queryTelephones));_0x21d9fc[_0xf0a9('0x1c')](db[_0xf0a9('0x22')][_0xf0a9('0x1e')](queryTrunks));_0x21d9fc[_0xf0a9('0x1c')](db[_0xf0a9('0x23')]['findAll'](queryCampaigns));_0x21d9fc['push'](db[_0xf0a9('0x7')][_0xf0a9('0x1e')](queryAgents));break;case _0xf0a9('0x9'):_0x19b0b8[_0x123f9b]('voice:inbound');_0x19b0b8[_0x123f9b](_0xf0a9('0x26'));_0x21d9fc['push'](_0x1952ab[_0xf0a9('0x27')]({'attributes':['id','name']}));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab[_0xf0a9('0x28')]({'attributes':['id','name']}));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab['getFaxQueues']({'attributes':['id','name']}));_0x21d9fc['push'](_0x1952ab[_0xf0a9('0x2a')]({'attributes':['id',_0xf0a9('0x5')]}));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab[_0xf0a9('0x2b')]({'attributes':['id',_0xf0a9('0x5')]}));_0x21d9fc[_0xf0a9('0x1c')](_0x1952ab['getOpenchannelQueues']({'attributes':['id','name']}));break;}return BPromise[_0xf0a9('0x2d')](_0x21d9fc);}})[_0xf0a9('0x2e')](function(_0x1264f3){if(_0x1264f3&&_0x1264f3[_0xf0a9('0xc')]){for(var _0xe12da4=0x0;_0xe12da4<_0x1264f3['length'];_0xe12da4+=0x1){for(var _0x51958a=0x0;_0x51958a<_0x1264f3[_0xe12da4][_0xf0a9('0xc')];_0x51958a+=0x1){switch(_0xe12da4){case 0x0:joinOrLeaveQueues(_0x19b0b8,_0x123f9b,_0xf0a9('0x2f'),_0x1264f3[_0xe12da4][_0x51958a]);break;case 0x1:joinOrLeaveQueues(_0x19b0b8,_0x123f9b,_0xf0a9('0x30'),_0x1264f3[_0xe12da4][_0x51958a]);break;case 0x2:joinOrLeaveQueues(_0x19b0b8,_0x123f9b,'fax',_0x1264f3[_0xe12da4][_0x51958a]);break;case 0x3:joinOrLeaveQueues(_0x19b0b8,_0x123f9b,_0xf0a9('0x31'),_0x1264f3[_0xe12da4][_0x51958a]);break;case 0x4:joinOrLeaveQueues(_0x19b0b8,_0x123f9b,_0xf0a9('0x32'),_0x1264f3[_0xe12da4][_0x51958a]);break;case 0x5:joinOrLeaveQueues(_0x19b0b8,_0x123f9b,_0xf0a9('0x33'),_0x1264f3[_0xe12da4][_0x51958a]);break;case 0x6:_0x19b0b8[_0x123f9b](util[_0xf0a9('0xb')](_0xf0a9('0x34'),_0x1264f3[_0xe12da4][_0x51958a]['name']));break;case 0x7:_0x19b0b8[_0x123f9b](util[_0xf0a9('0xb')](_0xf0a9('0x35'),_0x1264f3[_0xe12da4][_0x51958a][_0xf0a9('0x5')]));break;case 0x8:_0x19b0b8[_0x123f9b](util[_0xf0a9('0xb')]('campaign:%s:%s',_0x1264f3[_0xe12da4][_0x51958a]['type'],_0x1264f3[_0xe12da4][_0x51958a][_0xf0a9('0x5')]));break;case 0x9:_0x19b0b8[_0x123f9b](util[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x1264f3[_0xe12da4][_0x51958a]['name']));break;}}}}})[_0xf0a9('0x2e')](function(){if(_0x123f9b==='leave'){var _0x351b02=_[_0xf0a9('0x36')](_0x4c0b0d['ChatInteractions'],'id');return _0x4c0b0d[_0xf0a9('0x37')](_0x351b02)['then'](function(){for(var _0x14c353=0x0;_0x14c353<_0x351b02[_0xf0a9('0xc')];_0x14c353+=0x1){_0x189e2a[_0xf0a9('0x38')](_0xf0a9('0x39'),{'ChatInteractionId':Number(_0x351b02[_0x14c353]),'UserId':Number(_0x4c0b0d['id'])});}});}})[_0xf0a9('0x2e')](function(){if(_0x123f9b===_0xf0a9('0x3a')){var _0x50932c=_[_0xf0a9('0x36')](_0x4c0b0d['MailInteractions'],'id');return _0x4c0b0d['removeMailInteractions'](_0x50932c)[_0xf0a9('0x2e')](function(){for(var _0x4a51ff=0x0;_0x4a51ff<_0x50932c['length'];_0x4a51ff+=0x1){_0x189e2a[_0xf0a9('0x38')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x50932c[_0x4a51ff]),'UserId':Number(_0x4c0b0d['id'])});}});}})[_0xf0a9('0x2e')](function(){if(_0x123f9b===_0xf0a9('0x3a')){var _0x4f7d31=_[_0xf0a9('0x36')](_0x4c0b0d[_0xf0a9('0x14')],'id');return _0x4c0b0d[_0xf0a9('0x3b')](_0x4f7d31)[_0xf0a9('0x2e')](function(){for(var _0x530aff=0x0;_0x530aff<_0x4f7d31[_0xf0a9('0xc')];_0x530aff+=0x1){_0x189e2a['emit'](_0xf0a9('0x3c'),{'FaxInteractionId':Number(_0x4f7d31[_0x530aff]),'UserId':Number(_0x4c0b0d['id'])});}});}})[_0xf0a9('0x2e')](function(){if(_0x123f9b==='leave'){var _0x56a1b4=_[_0xf0a9('0x36')](_0x4c0b0d[_0xf0a9('0x16')],'id');return _0x4c0b0d[_0xf0a9('0x3d')](_0x56a1b4)[_0xf0a9('0x2e')](function(){for(var _0x38496e=0x0;_0x38496e<_0x56a1b4[_0xf0a9('0xc')];_0x38496e+=0x1){_0x189e2a[_0xf0a9('0x38')](_0xf0a9('0x3e'),{'SmsInteractionId':Number(_0x56a1b4[_0x38496e]),'UserId':Number(_0x4c0b0d['id'])});}});}})['then'](function(){if(_0x123f9b===_0xf0a9('0x3a')){var _0x194c5a=_[_0xf0a9('0x36')](_0x4c0b0d[_0xf0a9('0x18')],'id');return _0x4c0b0d['removeOpenchannelInteractions'](_0x194c5a)['then'](function(){for(var _0x1db81c=0x0;_0x1db81c<_0x194c5a['length'];_0x1db81c+=0x1){_0x189e2a[_0xf0a9('0x38')](_0xf0a9('0x3f'),{'OpenchannelInteractionId':Number(_0x194c5a[_0x1db81c]),'UserId':Number(_0x4c0b0d['id'])});}});}})[_0xf0a9('0x40')](function(_0x100a8f){_0x19b0b8[_0xf0a9('0x41')](_0x100a8f);});}}function onDisconnect(_0x1718e0,_0x115145){joinOrLeave(_0x1718e0,_0xf0a9('0x3a'),_0x115145);}function onConnect(_0x9fdf8c){joinOrLeave(_0x9fdf8c,_0xf0a9('0x42'));}exports[_0xf0a9('0x43')]=function(_0x5221e2){_0x5221e2['on']('connection',function(_0xafa2ed){_0xafa2ed[_0xf0a9('0x44')](0x0);_0xafa2ed[_0xf0a9('0x45')]=_0xafa2ed['request'][_0xf0a9('0x46')][_0xf0a9('0x47')]+':'+_0xafa2ed[_0xf0a9('0x48')][_0xf0a9('0x46')][_0xf0a9('0x49')];_0xafa2ed[_0xf0a9('0x4a')]=new Date();_0xafa2ed[_0xf0a9('0x41')]=function(_0x570430){console[_0xf0a9('0x41')]('SocketIO\x20'+_0xafa2ed[_0xf0a9('0x4b')]['name']+'['+_0xafa2ed['address']+']',_0x570430);};_0xafa2ed['on'](_0xf0a9('0x4c'),function(){onDisconnect(_0xafa2ed,_0x5221e2);_0xafa2ed[_0xf0a9('0x41')](_0xf0a9('0x4d'));});onConnect(_0xafa2ed);_0xafa2ed[_0xf0a9('0x41')](_0xf0a9('0x4e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 895a507..11557e2 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 _0xf827=['Trigger,\x20%s','EventManager','error','code','catch','event','UserId','find','name','interface','format','channel','incomingmessage','outgoingmessage','get','changed','closed','User','SIP/%s','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','SmsMessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','request','then','info'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf827,0xbd));var _0x7f82=function(_0x3c477e,_0x2bb0ee){_0x3c477e=_0x3c477e-0x0;var _0x51f402=_0xf827[_0x3c477e];return _0x51f402;};'use strict';var util=require(_0x7f82('0x0'));var db=require(_0x7f82('0x1'))['db'];var jayson=require(_0x7f82('0x2'));var logger=require(_0x7f82('0x3'))(_0x7f82('0x4'));var client=jayson[_0x7f82('0x5')][_0x7f82('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x7f82('0x7'),'event':_0x7f82('0x8'),'condition':_0x7f82('0x9'),'callback':afterCreate},{'channel':_0x7f82('0xa'),'model':_0x7f82('0x7'),'event':_0x7f82('0xb'),'condition':_0x7f82('0xc'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':'afterCreate','condition':_0x7f82('0xd'),'callback':afterCreateMessage},{'channel':_0x7f82('0xe'),'model':'SmsInteraction','event':_0x7f82('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0x7f82('0xf'),'event':_0x7f82('0xb'),'condition':_0x7f82('0xc'),'callback':afterUpdate},{'channel':_0x7f82('0xe'),'model':_0x7f82('0x10'),'event':'afterCreate','condition':_0x7f82('0xd'),'callback':afterCreateMessage},{'channel':_0x7f82('0x11'),'model':'FaxInteraction','event':'afterCreate','condition':_0x7f82('0x9'),'callback':afterCreate},{'channel':_0x7f82('0x11'),'model':'FaxInteraction','event':_0x7f82('0xb'),'condition':_0x7f82('0xc'),'callback':afterUpdate},{'channel':_0x7f82('0x11'),'model':_0x7f82('0x12'),'event':_0x7f82('0x8'),'condition':_0x7f82('0xd'),'callback':afterCreateMessage},{'channel':_0x7f82('0x13'),'model':_0x7f82('0x14'),'event':'afterCreate','condition':_0x7f82('0x9'),'callback':afterCreate},{'channel':_0x7f82('0x13'),'model':_0x7f82('0x14'),'event':'afterUpdate','condition':_0x7f82('0xc'),'callback':afterUpdate},{'channel':_0x7f82('0x13'),'model':_0x7f82('0x15'),'event':_0x7f82('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x7f82('0x16'),'event':_0x7f82('0x8'),'condition':_0x7f82('0x9'),'callback':afterCreate},{'channel':_0x7f82('0x17'),'model':_0x7f82('0x16'),'event':_0x7f82('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x7f82('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x261782){return client[_0x7f82('0x18')]('EventManager',_0x261782)[_0x7f82('0x19')](function(_0x2e3194){logger[_0x7f82('0x1a')](_0x7f82('0x1b'),_0x7f82('0x1c'),_0x2e3194);if(_0x2e3194[_0x7f82('0x1d')]){if(_0x2e3194[_0x7f82('0x1d')][_0x7f82('0x1e')]===0x1f4){logger[_0x7f82('0x1d')](_0x7f82('0x1b'),_0x7f82('0x1c'),_0x2e3194['error']);}}})[_0x7f82('0x1f')](function(_0x37b35d){logger[_0x7f82('0x1d')]('Trigger,\x20%s',_0x7f82('0x1c'),_0x37b35d);});}function afterCreateMessage(_0x2a6d32,_0x458141){return function(_0x637256,_0x33280b){_0x637256=_0x637256['get']({'plain':!![]});_0x637256['channel']=_0x2a6d32;_0x637256[_0x7f82('0x20')]=_0x637256['direction'];if(_0x637256[_0x7f82('0x21')]){return db['User'][_0x7f82('0x22')]({'where':{'id':_0x637256[_0x7f82('0x21')]},'attributes':['id',_0x7f82('0x23')],'raw':!![]})[_0x7f82('0x19')](function(_0x2624c7){_0x637256[_0x7f82('0x24')]=util[_0x7f82('0x25')]('SIP/%s',_0x2624c7[_0x7f82('0x23')]);_0x637256[_0x7f82('0x26')]=_0x2a6d32;return request({'event':_0x7f82('0x27'),'message':_0x637256});})[_0x7f82('0x1f')](function(_0x1bfedf){console[_0x7f82('0x1d')](_0x1bfedf);});}else{return request({'event':_0x7f82('0x28'),'message':_0x637256});}};}function afterCreate(_0x308b59,_0x304196){return function(_0x56ec7b,_0x4e14e3){_0x56ec7b=_0x56ec7b[_0x7f82('0x29')]({'plain':!![]});_0x56ec7b[_0x7f82('0x26')]=_0x308b59;_0x56ec7b[_0x7f82('0x20')]='opened';return request({'event':_0x304196,'message':_0x56ec7b});};}function afterUpdate(_0x106f38,_0x952f38){return function(_0x27b33d,_0x4b1a74){if(_0x27b33d[_0x7f82('0x2a')]('closed')&&_0x27b33d[_0x7f82('0x2b')]){_0x27b33d=_0x27b33d['get']({'plain':!![]});_0x27b33d['channel']=_0x106f38;_0x27b33d['event']=_0x7f82('0x2b');if(_0x27b33d[_0x7f82('0x21')]){return db[_0x7f82('0x2c')][_0x7f82('0x22')]({'where':{'id':_0x27b33d['UserId']},'attributes':['id','name'],'raw':!![]})[_0x7f82('0x19')](function(_0x2be66d){_0x27b33d['interface']=util['format'](_0x7f82('0x2d'),_0x2be66d[_0x7f82('0x23')]);return request({'event':_0x952f38,'message':_0x27b33d});})['catch'](function(_0x45038c){console['error'](_0x45038c);});}else{return request({'event':_0x952f38,'message':_0x27b33d});}}};}exports[_0x7f82('0x2e')]=function(){for(var _0x4bd1df=0x0;_0x4bd1df0x3){var _0xdee841=/\((.+)\)/;var _0x3882c2=_0x4cd241['rx'][_0x0aca('0x15')](_0xdee841);if(_0x3882c2){_0x30dc23=_0x3882c2[0x1];}else{_0x30dc23=null;}}else{_0x30dc23=null;}_0x4cd241['cb'](null,{'code':_0x865435,'result':_0x301886,'extra':_0x30dc23});}});_0x47b4fc['on']('error',function(_0xeb82fd){_0x5a3f99[_0x0aca('0x7')](_0x0aca('0x16'),new AGIError(_0x0aca('0x17'),_0xeb82fd[_0x0aca('0x18')]));});_0x47b4fc['on'](_0x0aca('0x19'),function(){_0x5a3f99['emit'](_0x0aca('0x19'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x47b4fc['on']('timeout',function(){_0x5a3f99['emit'](_0x0aca('0x1a'),new AGIError(_0x0aca('0x1b')));_0x47b4fc['destroy']();});_0x47b4fc['pipe'](_0x30e340);this[_0x0aca('0x1c')]=function(_0x38bc96,_0x1a0bba){var _0x38bc96=_0x38bc96||'',_0x1a0bba=typeof _0x1a0bba=='function'?_0x1a0bba:new Function();_0x4cd241={'tx':_0x38bc96,'rx':'','cb':_0x1a0bba};_0x47b4fc[_0x0aca('0x1d')](_0x38bc96+'\x0a');},this[_0x0aca('0x19')]=function(){_0x47b4fc[_0x0aca('0x1e')]();};}util[_0x0aca('0x1f')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x0aca('0x20')]=function(_0x440bf3){return this[_0x0aca('0x1c')][_0x0aca('0x21')](this,_0x440bf3);};AGIChannel[_0x0aca('0x22')][_0x0aca('0x23')]=function(){return this[_0x0aca('0x20')](_0x0aca('0x24'));};AGIChannel['prototype'][_0x0aca('0x25')]=function(_0xe0359a,_0x52ab43,_0x24eec0){_0xe0359a=_0xe0359a===undefined?'beep':_0xe0359a;_0x52ab43=_0x52ab43===undefined?'5':_0x52ab43;_0x24eec0=_0x24eec0===undefined?'1':_0x24eec0;return this[_0x0aca('0x20')](util[_0x0aca('0x26')](_0x0aca('0x27'),_0xe0359a,_0x52ab43*0x3e8,_0x24eec0));};AGIChannel[_0x0aca('0x22')][_0x0aca('0x28')]=function(_0x1c7837){_0x1c7837=_0x1c7837||_0x0aca('0x29');return this[_0x0aca('0x20')](util[_0x0aca('0x26')]('VERBOSE\x20\x22%s\x22',_0x1c7837));};AGIChannel[_0x0aca('0x22')][_0x0aca('0x2a')]=function(_0x5087af,_0x3b3429){if(_[_0x0aca('0x2b')](_0x3b3429)){return this['sendRequest'](util[_0x0aca('0x26')]('EXEC\x20%s\x20%s',_0x5087af,_0x3b3429[_0x0aca('0x2c')](',')));}return this[_0x0aca('0x20')](util[_0x0aca('0x26')](_0x0aca('0x2d'),_0x5087af,_0x3b3429));};AGIChannel['prototype'][_0x0aca('0x2e')]=function(_0x102dae){return this[_0x0aca('0x20')](util[_0x0aca('0x26')](_0x0aca('0x2f'),_0x102dae));};AGIChannel[_0x0aca('0x22')][_0x0aca('0x30')]=function(_0x3528bd){return this['sendRequest'](util[_0x0aca('0x26')](_0x0aca('0x31'),_0x3528bd));};AGIChannel[_0x0aca('0x22')][_0x0aca('0x32')]=function(_0x18c22c){return this[_0x0aca('0x20')](util[_0x0aca('0x26')](_0x0aca('0x33'),_0x18c22c));};AGIChannel[_0x0aca('0x22')]['hangup']=function(){return this[_0x0aca('0x20')]('HANGUP');};AGIChannel[_0x0aca('0x22')]['setVariable']=function(_0x5ab984,_0x3e2f1f){return this['sendRequest'](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x5ab984,_0x3e2f1f?_0x3e2f1f['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x17b631,_0x2bdcf8){return this[_0x0aca('0x20')](util['format'](_0x0aca('0x34'),_0x17b631,_0x2bdcf8));};AGIChannel[_0x0aca('0x22')][_0x0aca('0x35')]=function(_0x546c88,_0x3d2bbb){return this['sendRequest'](util['format'](_0x0aca('0x36'),_0x546c88,_0x3d2bbb));};AGIChannel[_0x0aca('0x22')]['sayPhonetic']=function(_0x2d0f82,_0x4c082d){return this[_0x0aca('0x20')](util[_0x0aca('0x26')](_0x0aca('0x37'),_0x2d0f82,_0x4c082d));};AGIChannel['prototype'][_0x0aca('0x38')]=function(_0x2f19d9,_0x15c6c3,_0xf18585){_0x15c6c3=_0x15c6c3||this[_0x0aca('0x39')];_0xf18585=_0xf18585||0x1;this[_0x0aca('0x2e')](_0x2f19d9);this[_0x0aca('0x30')](_0x15c6c3);this[_0x0aca('0x32')](_0xf18585);return this[_0x0aca('0x28')](util[_0x0aca('0x26')](_0x0aca('0x3a'),_0x2f19d9,_0x15c6c3,_0xf18585));};AGIChannel[_0x0aca('0x22')][_0x0aca('0x3b')]=function(_0x26e04d){return this[_0x0aca('0x20')](util[_0x0aca('0x26')](_0x0aca('0x3c'),_0x26e04d));};AGIChannel['prototype'][_0x0aca('0x3d')]=function(_0xd9a9aa,_0x429100,_0x57ae3b,_0x225e7e,_0x6621df,_0x632594){_0x429100=_0x429100||_0x0aca('0x3e');_0x57ae3b=_0x57ae3b||'';_0x225e7e=_0x225e7e===undefined?-0x1:_0x225e7e==='-1'?-0x1:_0x225e7e*0x3e8;_0x6621df=_0x6621df===undefined?'':'s='+_0x6621df;_0x632594=_0x632594?'BEEP':'';return this[_0x0aca('0x20')](util[_0x0aca('0x26')](_0x0aca('0x3f'),_0xd9a9aa,_0x429100,_0x57ae3b,_0x225e7e,_0x632594,_0x6621df));};AGIChannel['prototype'][_0x0aca('0x40')]=function(_0x56f1d5,_0xd9f07c){_0xd9f07c=_0xd9f07c||'';return this[_0x0aca('0x20')](util[_0x0aca('0x26')](_0x0aca('0x41'),_0x56f1d5,_0xd9f07c));};AGIChannel['prototype'][_0x0aca('0x42')]=function(_0x557d07){return this[_0x0aca('0x2a')](_0x0aca('0x43'),_0x557d07);};AGIChannel['prototype'][_0x0aca('0x44')]=function(_0x2d111f){return this['exec']('WAIT',_0x2d111f);};AGIChannel['prototype'][_0x0aca('0x16')]=function(_0x3c8b22,_0x7d519b){this['noop'](util[_0x0aca('0x26')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3c8b22['id'],_0x3c8b22[_0x0aca('0x45')],_0x7d519b));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xab0f=['SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','substring','search','function','result=','indexOf','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','sendRequest','sync','ANSWER','prototype','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s'];(function(_0x59db6c,_0x41e38b){var _0x475416=function(_0x1d9b32){while(--_0x1d9b32){_0x59db6c['push'](_0x59db6c['shift']());}};_0x475416(++_0x41e38b);}(_0xab0f,0x1c3));var _0xfab0=function(_0x4ef4ce,_0x55a4ff){_0x4ef4ce=_0x4ef4ce-0x0;var _0x5af9de=_0xab0f[_0x4ef4ce];return _0x5af9de;};'use strict';var util=require(_0xfab0('0x0'));var _=require(_0xfab0('0x1'));var EventEmitter=require(_0xfab0('0x2'))[_0xfab0('0x3')];var AGIReply=require(_0xfab0('0x4'));var AGIError=require(_0xfab0('0x5'));function AGIChannel(_0x24b247){var _0x443765=this,_0x417115=new AGIReply(),_0x1f6dde=![],_0x2a0026={};EventEmitter[_0xfab0('0x6')](_0x443765);_0x24b247[_0xfab0('0x7')](_0xfab0('0x8'));_0x24b247[_0xfab0('0x9')](0x8*0x3c*0x3c*0x3e8);_0x417115[_0xfab0('0x7')](_0xfab0('0x8'));_0x417115['on'](_0xfab0('0xa'),function(_0x289635){for(var _0x4675ae in _0x289635){_0x443765[_0x4675ae]=_0x289635[_0x4675ae];}_0x443765[_0xfab0('0xb')]('ready');});_0x417115['on'](_0xfab0('0xc'),function(_0x35937c){if(_0x35937c[_0xfab0('0xd')]()=='hangup'){_0x443765[_0xfab0('0xb')]('hangup');return;}if(_0x35937c[_0xfab0('0xe')](0x0,0xb)=='520-Invalid'){_0x1f6dde=!![];}if(_0x1f6dde){_0x2a0026['rx']+=_0x35937c+'\x0a';if(_0x35937c[_0xfab0('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x1f6dde=![];}}else{_0x2a0026['rx']=_0x35937c;}if(_0x1f6dde){return;}if(typeof _0x2a0026['cb']==_0xfab0('0x10')){var _0x397547=_0x2a0026['rx'][_0xfab0('0xe')](0x0,0x3),_0x1724b1=null,_0x51a1bf=null;_0x397547=parseInt(_0x397547);if(isNaN(_0x397547)){_0x2a0026['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x397547!=0xc8){_0x2a0026['cb'](null,{'code':_0x397547,'result':-0x1,'extra':'KO'});return;}_0x1724b1=_0x2a0026['rx'][_0xfab0('0xe')](0x4)['replace'](_0xfab0('0x11'),'');if(_0x1724b1['indexOf']('\x20')!=-0x1){_0x1724b1=_0x1724b1['substr'](0x0,_0x1724b1[_0xfab0('0x12')]('\x20'));}if(_['startsWith'](_0x1724b1,'-1')){_0x1724b1=parseInt(_0x1724b1);}_0x51a1bf=_0x2a0026['rx'][_0xfab0('0x13')]('\x20');if(_0x51a1bf[_0xfab0('0x14')]==0x3){_0x51a1bf=_0x51a1bf[0x2][_0xfab0('0xe')](0x1,_0x51a1bf[0x2][_0xfab0('0x14')]-0x1);}else if(_0x51a1bf[_0xfab0('0x14')]>0x3){var _0x5ea1ab=/\((.+)\)/;var _0x4dafd0=_0x2a0026['rx']['match'](_0x5ea1ab);if(_0x4dafd0){_0x51a1bf=_0x4dafd0[0x1];}else{_0x51a1bf=null;}}else{_0x51a1bf=null;}_0x2a0026['cb'](null,{'code':_0x397547,'result':_0x1724b1,'extra':_0x51a1bf});}});_0x24b247['on']('error',function(_0x1bd4ca){_0x443765[_0xfab0('0xb')](_0xfab0('0x15'),new AGIError(_0xfab0('0x16'),_0x1bd4ca[_0xfab0('0x17')]));});_0x24b247['on'](_0xfab0('0x18'),function(){_0x443765[_0xfab0('0xb')](_0xfab0('0x18'),new AGIError(_0xfab0('0x19')));});_0x24b247['on'](_0xfab0('0x1a'),function(){_0x443765['emit']('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x24b247[_0xfab0('0x1b')]();});_0x24b247[_0xfab0('0x1c')](_0x417115);this[_0xfab0('0x1d')]=function(_0x39985a,_0x3f9458){var _0x39985a=_0x39985a||'',_0x3f9458=typeof _0x3f9458=='function'?_0x3f9458:new Function();_0x2a0026={'tx':_0x39985a,'rx':'','cb':_0x3f9458};_0x24b247[_0xfab0('0x1e')](_0x39985a+'\x0a');},this[_0xfab0('0x18')]=function(){_0x24b247[_0xfab0('0x1b')]();};}util[_0xfab0('0x1f')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xfab0('0x20')]=function(_0x19fd59){return this['command'][_0xfab0('0x21')](this,_0x19fd59);};AGIChannel['prototype']['answer']=function(){return this['sendRequest'](_0xfab0('0x22'));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x24')]=function(_0x182d9b,_0x426d09,_0x54305c){_0x182d9b=_0x182d9b===undefined?'beep':_0x182d9b;_0x426d09=_0x426d09===undefined?'5':_0x426d09;_0x54305c=_0x54305c===undefined?'1':_0x54305c;return this[_0xfab0('0x20')](util[_0xfab0('0x25')](_0xfab0('0x26'),_0x182d9b,_0x426d09*0x3e8,_0x54305c));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x27')]=function(_0x5d5a56){_0x5d5a56=_0x5d5a56||_0xfab0('0x28');return this[_0xfab0('0x20')](util[_0xfab0('0x25')]('VERBOSE\x20\x22%s\x22',_0x5d5a56));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x29')]=function(_0x587ed1,_0x561594){if(_[_0xfab0('0x2a')](_0x561594)){return this[_0xfab0('0x20')](util['format']('EXEC\x20%s\x20%s',_0x587ed1,_0x561594['join'](',')));}return this['sendRequest'](util[_0xfab0('0x25')]('EXEC\x20%s\x20%s',_0x587ed1,_0x561594));};AGIChannel['prototype'][_0xfab0('0x2b')]=function(_0x471a45){return this[_0xfab0('0x20')](util[_0xfab0('0x25')](_0xfab0('0x2c'),_0x471a45));};AGIChannel[_0xfab0('0x23')]['setExtension']=function(_0x47e0be){return this['sendRequest'](util[_0xfab0('0x25')](_0xfab0('0x2d'),_0x47e0be));};AGIChannel[_0xfab0('0x23')]['setPriority']=function(_0x12ffb7){return this[_0xfab0('0x20')](util[_0xfab0('0x25')](_0xfab0('0x2e'),_0x12ffb7));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x2f')]=function(){return this[_0xfab0('0x20')](_0xfab0('0x30'));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x31')]=function(_0x28f366,_0x4a5f1c){return this[_0xfab0('0x20')](util['format'](_0xfab0('0x32'),_0x28f366,_0x4a5f1c?_0x4a5f1c[_0xfab0('0x33')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xfab0('0x34')]=function(_0x498835,_0x1f89fb){return this[_0xfab0('0x20')](util[_0xfab0('0x25')](_0xfab0('0x35'),_0x498835,_0x1f89fb));};AGIChannel['prototype'][_0xfab0('0x36')]=function(_0x50371a,_0x5d05df){return this[_0xfab0('0x20')](util[_0xfab0('0x25')](_0xfab0('0x37'),_0x50371a,_0x5d05df));};AGIChannel['prototype'][_0xfab0('0x38')]=function(_0x37a9f6,_0x2fb799){return this[_0xfab0('0x20')](util[_0xfab0('0x25')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x37a9f6,_0x2fb799));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x39')]=function(_0xe3a4f8,_0xe1df53,_0x3a979b){_0xe1df53=_0xe1df53||this['extension'];_0x3a979b=_0x3a979b||0x1;this[_0xfab0('0x2b')](_0xe3a4f8);this[_0xfab0('0x3a')](_0xe1df53);this['setPriority'](_0x3a979b);return this[_0xfab0('0x27')](util[_0xfab0('0x25')](_0xfab0('0x3b'),_0xe3a4f8,_0xe1df53,_0x3a979b));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x3c')]=function(_0x2e30f3){return this['sendRequest'](util[_0xfab0('0x25')](_0xfab0('0x3d'),_0x2e30f3));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x3e')]=function(_0xa80523,_0x359f05,_0x5bcc15,_0x30bf35,_0x2d97e5,_0x14fa3c){_0x359f05=_0x359f05||'wav';_0x5bcc15=_0x5bcc15||'';_0x30bf35=_0x30bf35===undefined?-0x1:_0x30bf35==='-1'?-0x1:_0x30bf35*0x3e8;_0x2d97e5=_0x2d97e5===undefined?'':'s='+_0x2d97e5;_0x14fa3c=_0x14fa3c?_0xfab0('0x3f'):'';return this[_0xfab0('0x20')](util['format'](_0xfab0('0x40'),_0xa80523,_0x359f05,_0x5bcc15,_0x30bf35,_0x14fa3c,_0x2d97e5));};AGIChannel[_0xfab0('0x23')][_0xfab0('0x41')]=function(_0x32d236,_0x1066ae){_0x1066ae=_0x1066ae||'';return this[_0xfab0('0x20')](util[_0xfab0('0x25')](_0xfab0('0x42'),_0x32d236,_0x1066ae));};AGIChannel[_0xfab0('0x23')]['agi']=function(_0x9dabd4){return this[_0xfab0('0x29')]('AGI',_0x9dabd4);};AGIChannel[_0xfab0('0x23')][_0xfab0('0x43')]=function(_0x52d48b){return this['exec'](_0xfab0('0x44'),_0x52d48b);};AGIChannel[_0xfab0('0x23')]['error']=function(_0x4ceff9,_0x2198a1){this[_0xfab0('0x27')](util[_0xfab0('0x25')](_0xfab0('0x45'),_0x4ceff9['id'],_0x4ceff9['label'],_0x2198a1));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xfab0('0x46')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1a69709..7b5cee3 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 _0x42e4=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x47fb9e,_0x59ca39){var _0x235246=function(_0x37b2cc){while(--_0x37b2cc){_0x47fb9e['push'](_0x47fb9e['shift']());}};_0x235246(++_0x59ca39);}(_0x42e4,0xf8));var _0x442e=function(_0x14ae69,_0x5ee70b){_0x14ae69=_0x14ae69-0x0;var _0x5d2abc=_0x42e4[_0x14ae69];return _0x5d2abc;};'use strict';var util=require(_0x442e('0x0'));var error={'E_AGI_UNDEFINED':_0x442e('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x442e('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x442e('0x3'),'E_AGI_SOCKET_ERROR':_0x442e('0x4'),'E_AGI_SOCKET_CLOSE':_0x442e('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x442e('0x6'),'E_AGI_COMMAND_EMPTY':_0x442e('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x442e('0x8'),'E_AGI_IVR_ENTRY':_0x442e('0x9')};function AGIError(_0x284ab3){var _0x284ab3=_0x284ab3||null,_0x35c04e=_0x35c04e||[],_0xf2fb44=0x1,_0x3ce4b3='';if(!error[_0x284ab3]){_0x284ab3=_0x442e('0xa');}_0x35c04e[_0x442e('0xb')](error[_0x284ab3]);while(arguments[_0xf2fb44]){_0x35c04e[_0x442e('0xb')](arguments[_0xf2fb44]);_0xf2fb44++;}_0x3ce4b3=util[_0x442e('0xc')][_0x442e('0xd')](util,_0x35c04e);this[_0x442e('0xe')]=_0x3ce4b3;this['name']=_0x284ab3;}module[_0x442e('0xf')]=AGIError; \ No newline at end of file +var _0x7b13=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','util'];(function(_0xac3b20,_0x48e68c){var _0x580caf=function(_0xa07fcd){while(--_0xa07fcd){_0xac3b20['push'](_0xac3b20['shift']());}};_0x580caf(++_0x48e68c);}(_0x7b13,0x1c1));var _0x37b1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7b13[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0x37b1('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x37b1('0x1'),'E_AGI_SERVER_ERROR':_0x37b1('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x37b1('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x37b1('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x37b1('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x37b1('0x6')};function AGIError(_0x32d69d){var _0x32d69d=_0x32d69d||null,_0x422af3=_0x422af3||[],_0x1424dc=0x1,_0x5bf455='';if(!error[_0x32d69d]){_0x32d69d='E_AGI_UNDEFINED';}_0x422af3['push'](error[_0x32d69d]);while(arguments[_0x1424dc]){_0x422af3[_0x37b1('0x7')](arguments[_0x1424dc]);_0x1424dc++;}_0x5bf455=util[_0x37b1('0x8')][_0x37b1('0x9')](util,_0x422af3);this['message']=_0x5bf455;this['name']=_0x32d69d;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2c47604..9056477 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 _0x5423=['length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','vertices','edges','numberOfEdges','prototype','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse'];(function(_0x2b6896,_0x86fdd7){var _0x5cc690=function(_0x66aac8){while(--_0x66aac8){_0x2b6896['push'](_0x2b6896['shift']());}};_0x5cc690(++_0x86fdd7);}(_0x5423,0xe3));var _0x3542=function(_0x3d7edf,_0x1f43da){_0x3d7edf=_0x3d7edf-0x0;var _0x319dd1=_0x5423[_0x3d7edf];return _0x319dd1;};'use strict';var _=require(_0x3542('0x0'));var logger=require(_0x3542('0x1'))('agi');var verticesWithRetry=[_0x3542('0x2'),_0x3542('0x3'),'getsecretdigits'];var Graph=function(){this[_0x3542('0x4')]={};this[_0x3542('0x5')]={};this[_0x3542('0x6')]=0x0;};Graph[_0x3542('0x7')]['addVertex']=function(_0x8ba9d5){this[_0x3542('0x4')][_0x8ba9d5['id']]=_0x8ba9d5;this[_0x3542('0x5')][_0x8ba9d5['id']]=[];};Graph[_0x3542('0x7')][_0x3542('0x8')]=function(_0x55413c,_0x4cdc86,_0xbc51ab){this[_0x3542('0x5')][_0x55413c]['push']({'target':_0x4cdc86,'condition':_0xbc51ab});this[_0x3542('0x6')]+=0x1;};Graph[_0x3542('0x7')]['size']=function(){return _[_0x3542('0x9')](this[_0x3542('0x4')]);};Graph['prototype'][_0x3542('0xa')]=function(){return this[_0x3542('0x6')];};Graph[_0x3542('0x7')][_0x3542('0xb')]=function(_0x471ea0){return this[_0x3542('0x4')][_0x471ea0];};Graph[_0x3542('0x7')][_0x3542('0xc')]=function(_0x4ee86,_0x1a9062){if(!this[_0x3542('0x4')][_0x4ee86]){return logger[_0x3542('0xd')](_0x3542('0xe'));}var _0x4bac5b=_0x1a9062(this[_0x3542('0x4')][_0x4ee86]);if(!_0x4bac5b){return logger['info'](_0x3542('0xf'));}if(this[_0x3542('0x5')][_0x4ee86][_0x3542('0x10')]===0x0){return logger['info'](_0x3542('0x11'));}for(var _0x177fb9=0x0,_0x347ac8=[],_0x5726af=![];_0x177fb9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','length','source','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','start','debug','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED'];(function(_0x532b9f,_0x1c859e){var _0xcf4df4=function(_0x1f1f20){while(--_0x1f1f20){_0x532b9f['push'](_0x532b9f['shift']());}};_0xcf4df4(++_0x1c859e);}(_0xa3f1,0x1c7));var _0x1a3f=function(_0x1782b5,_0x292557){_0x1782b5=_0x1782b5-0x0;var _0x3d453e=_0xa3f1[_0x1782b5];return _0x3d453e;};'use strict';var parser=require(_0x1a3f('0x0'));var _=require(_0x1a3f('0x1'));var syncho=require(_0x1a3f('0x2'));var util=require(_0x1a3f('0x3'));var moment=require(_0x1a3f('0x4'));var config=require(_0x1a3f('0x5'));var logger=require(_0x1a3f('0x6'))(_0x1a3f('0x7'));var utilLicense=require(_0x1a3f('0x8'));var rpc=require(_0x1a3f('0x9'));var mailRpc=require(_0x1a3f('0xa'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function connectionHandler(_0x2a3d86){process[_0x1a3f('0xb')](function(){syncho(function(){try{setChannelVariables(_0x2a3d86);agiHandler(_0x2a3d86);}catch(_0x2f92dc){logger[_0x1a3f('0xc')](_0x2f92dc[_0x1a3f('0xd')]);}});});}function listeningHandler(_0x2b13c2){console[_0x1a3f('0xe')](_0x1a3f('0xf'),0x11dd);logger[_0x1a3f('0x10')](_0x1a3f('0x11'));}function errorHandler(_0xb4b195){if(_0xb4b195&&_0xb4b195[_0x1a3f('0x12')]&&_0xb4b195[_0x1a3f('0x13')]){logger['error'](util[_0x1a3f('0x14')](_0x1a3f('0x15'),_0xb4b195[_0x1a3f('0x12')],_0xb4b195['message']));}else{logger[_0x1a3f('0xc')](util[_0x1a3f('0x14')]('[ERROR]\x20%s',_0xb4b195[_0x1a3f('0xd')]));}}function closeHandler(){logger['info'](util[_0x1a3f('0x14')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1a3f('0x16')],this[_0x1a3f('0x17')],this[_0x1a3f('0x18')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x36404c){logger['error'](_0x36404c['stack']);}}function timeoutHandler(){logger[_0x1a3f('0x10')](util[_0x1a3f('0x14')](_0x1a3f('0x19'),this[_0x1a3f('0x16')],this[_0x1a3f('0x17')],this[_0x1a3f('0x18')],this[_0x1a3f('0x1a')],this[_0x1a3f('0x1b')]));}function hangupHandler(){logger[_0x1a3f('0x10')](util['format'](_0x1a3f('0x1c'),this[_0x1a3f('0x16')],this[_0x1a3f('0x17')],this[_0x1a3f('0x18')],this[_0x1a3f('0x1a')],this[_0x1a3f('0x1b')]));this[_0x1a3f('0x1d')]=!![];}function getRoot(_0x34093e){return parser[_0x1a3f('0x1e')](_0x34093e,{'object':!![]})[_0x1a3f('0x1f')][_0x1a3f('0x20')];}function addVertex(_0x302a45,_0x2001ed,_0x535dac){_0x2001ed[_0x1a3f('0x21')]=_0x535dac;if(_0x2001ed[_0x1a3f('0x22')](_0x1a3f('0x23'))){_0x2001ed[_0x1a3f('0x24')]=parseInt(_0x2001ed[_0x1a3f('0x23')],0xa);}_0x302a45['addVertex'](_[_0x1a3f('0x25')](_0x2001ed,_0x1a3f('0x26')));}function initGraph(_0x1a5f7a,_0x1fa5f5){var _0x2d82bf=new Graph();for(var _0x595cd4 in _0x1a5f7a){if(_0x1a5f7a['hasOwnProperty'](_0x595cd4)){if(_['isArray'](_0x1a5f7a[_0x595cd4])){for(var _0x14a329=0x0;_0x14a329<_0x1a5f7a[_0x595cd4][_0x1a3f('0x27')];_0x14a329+=0x1){addVertex(_0x2d82bf,_0x1a5f7a[_0x595cd4][_0x14a329],_0x595cd4);}}else{addVertex(_0x2d82bf,_0x1a5f7a[_0x595cd4],_0x595cd4);}}}for(var _0x1473c9=0x0;_0x1473c9<_0x1fa5f5['length'];_0x1473c9+=0x1){if(_0x1fa5f5[_0x1473c9][_0x1a3f('0x28')]&&_0x1fa5f5[_0x1473c9]['target']){_0x2d82bf['addEdge'](_0x1fa5f5[_0x1473c9][_0x1a3f('0x28')],_0x1fa5f5[_0x1473c9]['target'],_0x1fa5f5[_0x1473c9]['value']);}}return _0x2d82bf;}function getSquareProject(_0x4605db,_0x566be4){rpc[_0x1a3f('0x29')](_0x4605db)[_0x1a3f('0x2a')](function(_0x3c0bd2){_0x566be4(null,_0x3c0bd2);})['catch'](function(_0x1845f8){_0x566be4(null,_0x1845f8);});}function createSquareReport(_0x10460a,_0x1147dd){rpc[_0x1a3f('0x2b')](_0x10460a)['then'](function(_0x2ad33d){if(_0x1147dd){_0x1147dd(null,_0x2ad33d);}})[_0x1a3f('0x2c')](function(_0x2a9291){if(_0x1147dd){_0x1147dd(null,_0x2a9291);}});}function setChannelVariables(_0x18e36a){for(var _0x27c9df in _0x18e36a){if(_0x18e36a[_0x1a3f('0x22')](_0x27c9df)){if(_0x27c9df[_0x1a3f('0x2d')](_0x1a3f('0x2e'))===0x0){_0x18e36a[_0x27c9df[_0x1a3f('0x2f')](0x4)]=_0x18e36a[_0x27c9df];delete _0x18e36a[_0x27c9df];}}}}function getLogFromObject(_0x5943ec){return util[_0x1a3f('0x30')](_0x5943ec,{'showHidden':![],'depth':null});}function agiHandler(_0x46b29d){var _0x4aa3f2,_0x423331,_0xa1c216,_0x206d2c,_0x2b9798;logger['debug'](_0x1a3f('0x31'),JSON[_0x1a3f('0x32')](_0x46b29d,null,0x2));logger[_0x1a3f('0x10')](util[_0x1a3f('0x14')](_0x1a3f('0x33'),_0x46b29d[_0x1a3f('0x16')],_0x46b29d[_0x1a3f('0x17')],_0x46b29d['callerid'],_0x46b29d['dnid'],_0x46b29d[_0x1a3f('0x1b')]));_0x46b29d['on'](_0x1a3f('0xc'),errorHandler);_0x46b29d['on'](_0x1a3f('0x34'),closeHandler);_0x46b29d['on'](_0x1a3f('0x35'),timeoutHandler);_0x46b29d[_0x1a3f('0x1d')]=![];_0x46b29d['on'](_0x1a3f('0x36'),hangupHandler);var _0x1462f3=getSquareProject[_0x1a3f('0x37')](null,_0x46b29d[_0x1a3f('0x16')]);if(_0x1462f3){if(_0x1462f3['production']){_0x4aa3f2=getRoot(_0x1462f3['production']);if(_0x4aa3f2&&_0x4aa3f2[_0x1a3f('0x38')]){logger[_0x1a3f('0x39')]('root',JSON['stringify'](_0x4aa3f2,null,0x2));_0x46b29d[_0x1a3f('0x3a')]=moment()[_0x1a3f('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x423331=initGraph(_[_0x1a3f('0x25')](_0x4aa3f2,_0x1a3f('0x26')),_0x4aa3f2['mxCell']);_0xa1c216=new Vertices(_0x46b29d,rpc,mailRpc);logger['info'](util[_0x1a3f('0x14')](_0x1a3f('0x3b'),_0x46b29d['arg_1'],_0x46b29d['calleridname'],_0x46b29d[_0x1a3f('0x18')],_0x46b29d[_0x1a3f('0x1a')],_0x46b29d[_0x1a3f('0x1b')]));_0x423331[_0x1a3f('0x3c')](_0x4aa3f2[_0x1a3f('0x38')]['id'],function(_0x3d3f69){try{_0x3d3f69=_0xa1c216[_0x1a3f('0x3d')](_0x3d3f69);logger['debug'](_0x1a3f('0x3e'),JSON[_0x1a3f('0x32')](_0x3d3f69,null,0x2));if(_0x3d3f69[_0x1a3f('0x21')]===_0x1a3f('0x3f')){logger[_0x1a3f('0x10')](_0x1a3f('0x40'));_0x46b29d[_0x1a3f('0x41')]=_0x3d3f69[_0x1a3f('0x41')]||_0x46b29d['context'];_0x46b29d['extension']=_0x3d3f69[_0x1a3f('0x42')];_0x46b29d[_0x1a3f('0x43')]=_0x3d3f69[_0x1a3f('0x43')]?_0x3d3f69[_0x1a3f('0x43')]-0x1:0x1;return null;}else if(_0x3d3f69&&_0xa1c216[_0x3d3f69[_0x1a3f('0x21')]]){_0x2b9798=_0xa1c216[_0x3d3f69['agicommand']](_0x3d3f69);logger['info'](_0x1a3f('0x44'),JSON[_0x1a3f('0x32')](_0x2b9798,null,0x2));if(_0x2b9798&&_0x2b9798[_0x1a3f('0x45')]===AGI_CODE_SUCCESS&&_0x2b9798[_0x1a3f('0x46')]!==AGI_RESULT_ERROR&&!_0x46b29d[_0x1a3f('0x1d')]){logger['debug'](_0x1a3f('0x44'),getLogFromObject(_0x2b9798));return _[_0x1a3f('0x47')](_0x2b9798[_0x1a3f('0x46')])?null:_0x2b9798['result']['toString']();}else{logger['error'](_0x1a3f('0x44'),getLogFromObject(_0x2b9798));return null;}}else{logger[_0x1a3f('0xc')](_0x1a3f('0x48'));return null;}}catch(_0x23014e){logger['error'](_0x23014e[_0x1a3f('0xd')]);return null;}});if(_0x4aa3f2[_0x1a3f('0x49')]){logger['info'](util[_0x1a3f('0x14')](_0x1a3f('0x4a'),_0x46b29d['arg_1'],_0x46b29d[_0x1a3f('0x17')],_0x46b29d['callerid'],_0x46b29d[_0x1a3f('0x1a')],_0x46b29d[_0x1a3f('0x1b')]));_0x423331[_0x1a3f('0x3c')](_0x4aa3f2[_0x1a3f('0x49')]['id'],function(_0x324b3a){try{_0x324b3a=_0xa1c216[_0x1a3f('0x3d')](_0x324b3a);logger[_0x1a3f('0x39')](_0x1a3f('0x3e'),JSON[_0x1a3f('0x32')](_0x324b3a,null,0x2));if(_0x324b3a&&_0xa1c216[_0x324b3a[_0x1a3f('0x21')]]){_0x2b9798=_0xa1c216[_0x324b3a['agicommand']](_0x324b3a);if(_0x2b9798){logger[_0x1a3f('0x39')](_0x1a3f('0x44'),getLogFromObject(_0x2b9798));return _[_0x1a3f('0x47')](_0x2b9798['result'])?null:_0x2b9798[_0x1a3f('0x46')][_0x1a3f('0x4b')]();}else{logger[_0x1a3f('0xc')](_0x1a3f('0x44'),getLogFromObject(_0x2b9798));return null;}}else{logger[_0x1a3f('0xc')](_0x1a3f('0x48'));return null;}}catch(_0x1ddc61){logger[_0x1a3f('0xc')](_0x1ddc61[_0x1a3f('0xd')]);return null;}});}logger['info'](util[_0x1a3f('0x14')](_0x1a3f('0x4c'),_0x46b29d[_0x1a3f('0x16')],_0x46b29d['calleridname'],_0x46b29d[_0x1a3f('0x18')],_0x46b29d['dnid'],_0x46b29d['uniqueid']));logger['info'](util['format'](_0x1a3f('0x4d'),_0x46b29d[_0x1a3f('0x41')],_0x46b29d[_0x1a3f('0x42')],parseInt(_0x46b29d['priority'],0xa)+0x1));_0x46b29d[_0x1a3f('0x4e')](_0x46b29d[_0x1a3f('0x41')],_0x46b29d[_0x1a3f('0x42')],parseInt(_0x46b29d['priority'],0xa)+0x1);_0x46b29d[_0x1a3f('0x34')]();}}else{logger[_0x1a3f('0xc')](util[_0x1a3f('0x14')](_0x1a3f('0x4f'),_0x46b29d[_0x1a3f('0x16')]));_0x46b29d[_0x1a3f('0x4e')](_0x46b29d[_0x1a3f('0x41')],_0x46b29d[_0x1a3f('0x42')],parseInt(_0x46b29d[_0x1a3f('0x43')],0xa)+0x1);_0x46b29d['close']();}}else{logger['error'](util[_0x1a3f('0x14')](_0x1a3f('0x50'),_0x46b29d[_0x1a3f('0x16')]));_0x46b29d[_0x1a3f('0x4e')](_0x46b29d[_0x1a3f('0x41')],_0x46b29d['extension'],parseInt(_0x46b29d[_0x1a3f('0x43')],0xa)+0x1);_0x46b29d[_0x1a3f('0x34')]();}}function main(){var _0x319ac8;return utilLicense[_0x1a3f('0x51')]()[_0x1a3f('0x2a')](function(_0x38a43f){if(_0x38a43f){if(_0x38a43f[_0x1a3f('0x52')]){if(_0x38a43f[_0x1a3f('0x53')]&&_0x38a43f['callysquare']>0x0){logger['info'](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x38a43f[_0x1a3f('0x53')]));_0x319ac8=_0x38a43f[_0x1a3f('0x53')];}else{logger[_0x1a3f('0x10')](_0x1a3f('0x54'));}}else{logger['info'](_0x1a3f('0x55'));_0x319ac8=-0x1;}}})['catch'](function(_0x1dee3e){logger[_0x1a3f('0xc')](_0x1a3f('0x56'),_0x1dee3e[_0x1a3f('0xd')]);})['finally'](function(){var _0x5422b5=require(_0x1a3f('0x57'))(0x11dd,_0x1a3f('0x58'),_0x319ac8);_0x5422b5['on'](_0x1a3f('0xc'),errorHandler);_0x5422b5['on']('listening',listeningHandler);_0x5422b5['on'](_0x1a3f('0x59'),connectionHandler);_0x5422b5['on'](_0x1a3f('0x34'),closeHandler);});}main(); \ No newline at end of file +var _0x2afb=['callerid','dnid','uniqueid','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','0.0.0.0','listening','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/license/util','./rpc','./graph','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','[LISTENING]\x20Cally\x20Square\x20listening\x200.0.0.0:4573','name','message','format','[%s]\x20%s','[ERROR]\x20%s','arg_1'];(function(_0x5a6a51,_0x57656c){var _0x437318=function(_0x429767){while(--_0x429767){_0x5a6a51['push'](_0x5a6a51['shift']());}};_0x437318(++_0x57656c);}(_0x2afb,0xf8));var _0xb2af=function(_0x5e5568,_0x300d0d){_0x5e5568=_0x5e5568-0x0;var _0x557045=_0x2afb[_0x5e5568];return _0x557045;};'use strict';var parser=require(_0xb2af('0x0'));var _=require(_0xb2af('0x1'));var syncho=require(_0xb2af('0x2'));var util=require(_0xb2af('0x3'));var moment=require(_0xb2af('0x4'));var config=require(_0xb2af('0x5'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0xb2af('0x6'));var rpc=require(_0xb2af('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0xb2af('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function connectionHandler(_0x1dc34d){process[_0xb2af('0x9')](function(){syncho(function(){try{setChannelVariables(_0x1dc34d);agiHandler(_0x1dc34d);}catch(_0x106b7f){logger[_0xb2af('0xa')](_0x106b7f[_0xb2af('0xb')]);}});});}function listeningHandler(_0x4b986c){console[_0xb2af('0xc')](_0xb2af('0xd'),0x11dd);logger[_0xb2af('0xe')](_0xb2af('0xf'));}function errorHandler(_0x2ff911){if(_0x2ff911&&_0x2ff911[_0xb2af('0x10')]&&_0x2ff911[_0xb2af('0x11')]){logger[_0xb2af('0xa')](util[_0xb2af('0x12')](_0xb2af('0x13'),_0x2ff911['name'],_0x2ff911[_0xb2af('0x11')]));}else{logger[_0xb2af('0xa')](util[_0xb2af('0x12')](_0xb2af('0x14'),_0x2ff911['stack']));}}function closeHandler(){logger[_0xb2af('0xe')](util[_0xb2af('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb2af('0x15')],this['calleridname'],this[_0xb2af('0x16')],this[_0xb2af('0x17')],this[_0xb2af('0x18')]));try{createSquareReport(this);}catch(_0x1e2cff){logger[_0xb2af('0xa')](_0x1e2cff['stack']);}}function timeoutHandler(){logger[_0xb2af('0xe')](util[_0xb2af('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb2af('0x15')],this[_0xb2af('0x19')],this[_0xb2af('0x16')],this['dnid'],this[_0xb2af('0x18')]));}function hangupHandler(){logger['info'](util['format'](_0xb2af('0x1a'),this['arg_1'],this['calleridname'],this[_0xb2af('0x16')],this[_0xb2af('0x17')],this['uniqueid']));this[_0xb2af('0x1b')]=!![];}function getRoot(_0x5e4674){return parser['toJson'](_0x5e4674,{'object':!![]})[_0xb2af('0x1c')][_0xb2af('0x1d')];}function addVertex(_0x123dee,_0x1cc585,_0x4a8c9e){_0x1cc585[_0xb2af('0x1e')]=_0x4a8c9e;if(_0x1cc585[_0xb2af('0x1f')](_0xb2af('0x20'))){_0x1cc585[_0xb2af('0x21')]=parseInt(_0x1cc585[_0xb2af('0x20')],0xa);}_0x123dee[_0xb2af('0x22')](_[_0xb2af('0x23')](_0x1cc585,_0xb2af('0x24')));}function initGraph(_0xc19074,_0x251879){var _0x438f6d=new Graph();for(var _0x37927c in _0xc19074){if(_0xc19074[_0xb2af('0x1f')](_0x37927c)){if(_[_0xb2af('0x25')](_0xc19074[_0x37927c])){for(var _0xe270b5=0x0;_0xe270b5<_0xc19074[_0x37927c]['length'];_0xe270b5+=0x1){addVertex(_0x438f6d,_0xc19074[_0x37927c][_0xe270b5],_0x37927c);}}else{addVertex(_0x438f6d,_0xc19074[_0x37927c],_0x37927c);}}}for(var _0x2c1dbe=0x0;_0x2c1dbe<_0x251879[_0xb2af('0x26')];_0x2c1dbe+=0x1){if(_0x251879[_0x2c1dbe][_0xb2af('0x27')]&&_0x251879[_0x2c1dbe][_0xb2af('0x28')]){_0x438f6d[_0xb2af('0x29')](_0x251879[_0x2c1dbe][_0xb2af('0x27')],_0x251879[_0x2c1dbe][_0xb2af('0x28')],_0x251879[_0x2c1dbe][_0xb2af('0x2a')]);}}return _0x438f6d;}function getSquareProject(_0x39b79c,_0x240872){rpc[_0xb2af('0x2b')](_0x39b79c)[_0xb2af('0x2c')](function(_0x1bf1e1){_0x240872(null,_0x1bf1e1);})[_0xb2af('0x2d')](function(_0x11dee4){_0x240872(null,_0x11dee4);});}function createSquareReport(_0x52f24c,_0x5380f5){rpc[_0xb2af('0x2e')](_0x52f24c)[_0xb2af('0x2c')](function(_0x40e891){if(_0x5380f5){_0x5380f5(null,_0x40e891);}})[_0xb2af('0x2d')](function(_0x2ef0e1){if(_0x5380f5){_0x5380f5(null,_0x2ef0e1);}});}function setChannelVariables(_0x440391){for(var _0x4129c0 in _0x440391){if(_0x440391[_0xb2af('0x1f')](_0x4129c0)){if(_0x4129c0[_0xb2af('0x2f')](_0xb2af('0x30'))===0x0){_0x440391[_0x4129c0[_0xb2af('0x31')](0x4)]=_0x440391[_0x4129c0];delete _0x440391[_0x4129c0];}}}}function getLogFromObject(_0x4e933b){return util[_0xb2af('0x32')](_0x4e933b,{'showHidden':![],'depth':null});}function agiHandler(_0x2393db){var _0x2e8307,_0x3c8a6d,_0x2fc9a0,_0x594ba7,_0x43b5b1;logger[_0xb2af('0x33')](_0xb2af('0x34'),JSON[_0xb2af('0x35')](_0x2393db,null,0x2));logger['info'](util['format'](_0xb2af('0x36'),_0x2393db[_0xb2af('0x15')],_0x2393db[_0xb2af('0x19')],_0x2393db['callerid'],_0x2393db[_0xb2af('0x17')],_0x2393db[_0xb2af('0x18')]));_0x2393db['on'](_0xb2af('0xa'),errorHandler);_0x2393db['on'](_0xb2af('0x37'),closeHandler);_0x2393db['on'](_0xb2af('0x38'),timeoutHandler);_0x2393db[_0xb2af('0x1b')]=![];_0x2393db['on'](_0xb2af('0x39'),hangupHandler);var _0x16d856=getSquareProject[_0xb2af('0x3a')](null,_0x2393db[_0xb2af('0x15')]);if(_0x16d856){if(_0x16d856['production']){_0x2e8307=getRoot(_0x16d856[_0xb2af('0x3b')]);if(_0x2e8307&&_0x2e8307[_0xb2af('0x3c')]){logger['debug'](_0xb2af('0x1d'),JSON['stringify'](_0x2e8307,null,0x2));_0x2393db[_0xb2af('0x3d')]=moment()[_0xb2af('0x12')](_0xb2af('0x3e'));_0x3c8a6d=initGraph(_[_0xb2af('0x23')](_0x2e8307,_0xb2af('0x24')),_0x2e8307[_0xb2af('0x24')]);_0x2fc9a0=new Vertices(_0x2393db,rpc,mailRpc);logger[_0xb2af('0xe')](util['format'](_0xb2af('0x3f'),_0x2393db['arg_1'],_0x2393db[_0xb2af('0x19')],_0x2393db[_0xb2af('0x16')],_0x2393db[_0xb2af('0x17')],_0x2393db['uniqueid']));_0x3c8a6d[_0xb2af('0x40')](_0x2e8307[_0xb2af('0x3c')]['id'],function(_0x5a6fd9){try{_0x5a6fd9=_0x2fc9a0[_0xb2af('0x41')](_0x5a6fd9);logger[_0xb2af('0x33')](_0xb2af('0x42'),JSON['stringify'](_0x5a6fd9,null,0x2));if(_0x5a6fd9['agicommand']===_0xb2af('0x43')){logger['info'](_0xb2af('0x44'));_0x2393db['context']=_0x5a6fd9[_0xb2af('0x45')]||_0x2393db['context'];_0x2393db[_0xb2af('0x46')]=_0x5a6fd9['extension'];_0x2393db[_0xb2af('0x47')]=_0x5a6fd9[_0xb2af('0x47')]?_0x5a6fd9[_0xb2af('0x47')]-0x1:0x1;return null;}else if(_0x5a6fd9&&_0x2fc9a0[_0x5a6fd9[_0xb2af('0x1e')]]){_0x43b5b1=_0x2fc9a0[_0x5a6fd9[_0xb2af('0x1e')]](_0x5a6fd9);logger[_0xb2af('0xe')](_0xb2af('0x48'),JSON['stringify'](_0x43b5b1,null,0x2));if(_0x43b5b1&&_0x43b5b1[_0xb2af('0x49')]===AGI_CODE_SUCCESS&&_0x43b5b1[_0xb2af('0x4a')]!==AGI_RESULT_ERROR&&!_0x2393db['evtHangup']){logger[_0xb2af('0x33')](_0xb2af('0x48'),getLogFromObject(_0x43b5b1));return _[_0xb2af('0x4b')](_0x43b5b1['result'])?null:_0x43b5b1[_0xb2af('0x4a')][_0xb2af('0x4c')]();}else{logger[_0xb2af('0xa')](_0xb2af('0x48'),getLogFromObject(_0x43b5b1));return null;}}else{logger[_0xb2af('0xa')](_0xb2af('0x4d'));return null;}}catch(_0x5bc1ea){logger['error'](_0x5bc1ea[_0xb2af('0xb')]);return null;}});if(_0x2e8307['finally']){logger[_0xb2af('0xe')](util[_0xb2af('0x12')](_0xb2af('0x4e'),_0x2393db[_0xb2af('0x15')],_0x2393db['calleridname'],_0x2393db[_0xb2af('0x16')],_0x2393db['dnid'],_0x2393db['uniqueid']));_0x3c8a6d[_0xb2af('0x40')](_0x2e8307[_0xb2af('0x4f')]['id'],function(_0x580fe4){try{_0x580fe4=_0x2fc9a0[_0xb2af('0x41')](_0x580fe4);logger[_0xb2af('0x33')]('vertex',JSON['stringify'](_0x580fe4,null,0x2));if(_0x580fe4&&_0x2fc9a0[_0x580fe4[_0xb2af('0x1e')]]){_0x43b5b1=_0x2fc9a0[_0x580fe4[_0xb2af('0x1e')]](_0x580fe4);if(_0x43b5b1){logger[_0xb2af('0x33')](_0xb2af('0x48'),getLogFromObject(_0x43b5b1));return _[_0xb2af('0x4b')](_0x43b5b1['result'])?null:_0x43b5b1[_0xb2af('0x4a')][_0xb2af('0x4c')]();}else{logger[_0xb2af('0xa')](_0xb2af('0x48'),getLogFromObject(_0x43b5b1));return null;}}else{logger['error'](_0xb2af('0x4d'));return null;}}catch(_0x4b0525){logger['error'](_0x4b0525[_0xb2af('0xb')]);return null;}});}logger[_0xb2af('0xe')](util['format'](_0xb2af('0x50'),_0x2393db[_0xb2af('0x15')],_0x2393db[_0xb2af('0x19')],_0x2393db[_0xb2af('0x16')],_0x2393db[_0xb2af('0x17')],_0x2393db[_0xb2af('0x18')]));logger['info'](util[_0xb2af('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2393db[_0xb2af('0x45')],_0x2393db[_0xb2af('0x46')],parseInt(_0x2393db[_0xb2af('0x47')],0xa)+0x1));_0x2393db[_0xb2af('0x51')](_0x2393db[_0xb2af('0x45')],_0x2393db['extension'],parseInt(_0x2393db[_0xb2af('0x47')],0xa)+0x1);_0x2393db[_0xb2af('0x37')]();}}else{logger[_0xb2af('0xa')](util[_0xb2af('0x12')](_0xb2af('0x52'),_0x2393db['arg_1']));_0x2393db[_0xb2af('0x51')](_0x2393db['context'],_0x2393db[_0xb2af('0x46')],parseInt(_0x2393db['priority'],0xa)+0x1);_0x2393db[_0xb2af('0x37')]();}}else{logger[_0xb2af('0xa')](util[_0xb2af('0x12')]('Project\x20%s\x20not\x20found',_0x2393db[_0xb2af('0x15')]));_0x2393db[_0xb2af('0x51')](_0x2393db[_0xb2af('0x45')],_0x2393db[_0xb2af('0x46')],parseInt(_0x2393db[_0xb2af('0x47')],0xa)+0x1);_0x2393db[_0xb2af('0x37')]();}}function main(){var _0x3290bc;return utilLicense[_0xb2af('0x53')]()[_0xb2af('0x2c')](function(_0x82184a){if(_0x82184a){if(_0x82184a['voice']){if(_0x82184a[_0xb2af('0x54')]&&_0x82184a[_0xb2af('0x54')]>0x0){logger[_0xb2af('0xe')](util[_0xb2af('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x82184a[_0xb2af('0x54')]));_0x3290bc=_0x82184a[_0xb2af('0x54')];}else{logger[_0xb2af('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0xb2af('0x55'));_0x3290bc=-0x1;}}})[_0xb2af('0x2d')](function(_0x42c542){logger[_0xb2af('0xa')](_0xb2af('0x56'),_0x42c542['stack']);})[_0xb2af('0x4f')](function(){var _0x243324=require(_0xb2af('0x57'))(0x11dd,_0xb2af('0x58'),_0x3290bc);_0x243324['on'](_0xb2af('0xa'),errorHandler);_0x243324['on'](_0xb2af('0x59'),listeningHandler);_0x243324['on']('connection',connectionHandler);_0x243324['on'](_0xb2af('0x37'),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 8bc7b1a..5da10c7 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3d539d,_0x2bb90e){var _0x328c59=function(_0x55d148){while(--_0x55d148){_0x3d539d['push'](_0x3d539d['shift']());}};_0x328c59(++_0x2bb90e);}(_0x34e8,0x12c));var _0x834e=function(_0x1376b5,_0x5512ab){_0x1376b5=_0x1376b5-0x0;var _0x521a0e=_0x34e8[_0x1376b5];return _0x521a0e;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x5daf54,_0x3a3caf){var _0x3d28ae=function(_0x5c0aa0){while(--_0x5c0aa0){_0x5daf54['push'](_0x5daf54['shift']());}};_0x3d28ae(++_0x3a3caf);}(_0x814b,0x1a2));var _0xb814=function(_0x466410,_0x4069d9){_0x466410=_0x466410-0x0;var _0x3d758e=_0x814b[_0x466410];return _0x3d758e;};'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 136d629..a76ff79 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x5a77eb,_0x10aef){var _0x5d9502=function(_0x8424ea){while(--_0x8424ea){_0x5a77eb['push'](_0x5a77eb['shift']());}};_0x5d9502(++_0x10aef);}(_0x5f2f,0x73));var _0xf5f2=function(_0x570be6,_0x1a25ec){_0x570be6=_0x570be6-0x0;var _0x49302c=_0x5f2f[_0x570be6];return _0x49302c;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x39c9f5,_0x2f4c88){var _0x20e4b0=function(_0x4c553a){while(--_0x4c553a){_0x39c9f5['push'](_0x39c9f5['shift']());}};_0x20e4b0(++_0x2f4c88);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46a658,_0x5d68d7){_0x46a658=_0x46a658-0x0;var _0x55119f=_0x5f2f[_0x46a658];return _0x55119f;};'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 695eec2..3801d6f 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 _0x5cbb=['PauseUser','agentUnpause','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','request','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVariable','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createCmContact','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause'];(function(_0x485ac2,_0x5238a0){var _0x40bd4d=function(_0x2e12c9){while(--_0x2e12c9){_0x485ac2['push'](_0x485ac2['shift']());}};_0x40bd4d(++_0x5238a0);}(_0x5cbb,0xe3));var _0xb5cb=function(_0x541dd8,_0x319dcd){_0x541dd8=_0x541dd8-0x0;var _0x2dbda2=_0x5cbb[_0x541dd8];return _0x2dbda2;};'use strict';var BPromise=require(_0xb5cb('0x0'));var moment=require(_0xb5cb('0x1'));var _=require(_0xb5cb('0x2'));var util=require(_0xb5cb('0x3'));var jayson=require(_0xb5cb('0x4'));var client=jayson[_0xb5cb('0x5')]['http']({'port':0x2329});function request(_0x109128,_0x53e36a){return new BPromise(function(_0x634d4e,_0xd48eb1){return client[_0xb5cb('0x6')](_0x109128,_0x53e36a)['then'](function(_0x28e0d1){if(_0x28e0d1[_0xb5cb('0x7')]){return _0xd48eb1(_0x28e0d1[_0xb5cb('0x7')]['message']);}else{return _0x634d4e(_0x28e0d1[_0xb5cb('0x8')]);}})[_0xb5cb('0x9')](function(_0x2e1293){return _0xd48eb1(_0x2e1293);});});}exports[_0xb5cb('0xa')]=function(_0x41877f){return request(_0xb5cb('0xb'),{'options':{'raw':![],'where':{'name':_0x41877f},'attributes':[_0xb5cb('0xc')]}});};exports[_0xb5cb('0xd')]=function(_0x317426){return request(_0xb5cb('0xe'),{'options':{'raw':![],'where':{'id':_0x317426},'include':[{'model':_0xb5cb('0xf'),'as':_0xb5cb('0x10')}],'attributes':['id',_0xb5cb('0x11'),_0xb5cb('0x12')]}});};exports[_0xb5cb('0x13')]=function(_0x5bcf47){return request('ShowSquareProject',{'options':{'where':{'id':_0x5bcf47},'attributes':[_0xb5cb('0x11')]}});};exports[_0xb5cb('0x14')]=function(_0x247b21){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x247b21},'attributes':[_0xb5cb('0x11')]}});};exports['getVariableById']=function(_0x5771e2){return request(_0xb5cb('0x15'),{'options':{'where':{'id':_0x5771e2},'attributes':[_0xb5cb('0x11')]}});};exports['getSquareOdbcById']=function(_0xb6314f){return request(_0xb5cb('0x16'),{'options':{'where':{'id':_0xb6314f},'attributes':['dsn']}});};exports[_0xb5cb('0x17')]=function(_0x553fc4){return request(_0xb5cb('0x18'),{'options':{'where':{'id':_0x553fc4},'attributes':[_0xb5cb('0x11')]}});};exports[_0xb5cb('0x19')]=function(_0x1fe20c){return request(_0xb5cb('0x1a'),{'options':{'where':{'id':_0x1fe20c},'attributes':[_0xb5cb('0x11')]}});};exports['getSoundById']=function(_0x13f186){return request(_0xb5cb('0x1b'),{'options':{'where':{'id':_0x13f186},'attributes':[_0xb5cb('0x1c')]}});};exports[_0xb5cb('0x1d')]=function(_0x15700e){return request(_0xb5cb('0x1e'),{'options':{'raw':![],'where':{'id':_0x15700e},'include':[{'model':_0xb5cb('0x1f'),'as':_0xb5cb('0x20')}]}});};exports[_0xb5cb('0x21')]=function(_0x5b8c34){return request(_0xb5cb('0x22'),{'options':{'where':{'id':_0x5b8c34},'attributes':['id',_0xb5cb('0x11')]}});};exports[_0xb5cb('0x23')]=function(_0x12dc6e){return request('CreateSmsMessage',{'body':_0x12dc6e});};exports['createSquareDetailsReport']=function(_0x328027){return request('CreateSquareDetailsReport',{'body':_0x328027});};exports[_0xb5cb('0x24')]=function(_0x577c50){return request(_0xb5cb('0x25'),{'body':_[_0xb5cb('0x26')](_0x577c50,{'project_name':_0x577c50[_0xb5cb('0x27')],'prev_project_name':_0x577c50[_0xb5cb('0x28')]||'','is_subproject':_0x577c50[_0xb5cb('0x28')]?!![]:![],'leaveAt':moment()['format'](_0xb5cb('0x29'))})});};exports['createSquareRecording']=function(_0x53f16f){return request(_0xb5cb('0x2a'),{'body':_0x53f16f});};exports[_0xb5cb('0x2b')]=function(_0x825c82){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x825c82[_0xb5cb('0x2c')],'ListId':_0x825c82[_0xb5cb('0x2d')]}}})[_0xb5cb('0x2e')](function(_0xc2cc1c){if(_0xc2cc1c){return _0xc2cc1c;}return request(_0xb5cb('0x2f'),{'body':_0x825c82});});};exports[_0xb5cb('0x30')]=function(_0x1fbb94){return request(_0xb5cb('0x31'),{'options':{'where':{'id':_0x1fbb94},'attributes':[_0xb5cb('0x11')]}});};exports[_0xb5cb('0x32')]=function(_0x2b9365,_0x4fd17b){return request(_0xb5cb('0x33'),{'body':{'interface':_0x4fd17b},'options':{'where':_0x2b9365}});};exports[_0xb5cb('0x34')]=function(_0x391c9f,_0x5843bb,_0x34e0fa){return request(_0xb5cb('0x35'),{'body':{'type':_0x5843bb,'uniqueid':_0x34e0fa},'options':{'where':_0x391c9f}});};exports[_0xb5cb('0x36')]=function(_0x2a6d81){return request('UnpauseUser',{'body':{},'options':{'where':_0x2a6d81}});};exports['agentLogout']=function(_0x244905){return request(_0xb5cb('0x37'),{'body':{},'options':{'where':_0x244905}});}; \ No newline at end of file +var _0x9db7=['getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','http','request','then','error','message','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals'];(function(_0x264c3d,_0x304ebc){var _0x23647c=function(_0x3ede24){while(--_0x3ede24){_0x264c3d['push'](_0x264c3d['shift']());}};_0x23647c(++_0x304ebc);}(_0x9db7,0x176));var _0x79db=function(_0x1908d8,_0x5e8448){_0x1908d8=_0x1908d8-0x0;var _0x10f91c=_0x9db7[_0x1908d8];return _0x10f91c;};'use strict';var BPromise=require('bluebird');var moment=require(_0x79db('0x0'));var _=require(_0x79db('0x1'));var util=require('util');var jayson=require(_0x79db('0x2'));var client=jayson[_0x79db('0x3')][_0x79db('0x4')]({'port':0x2329});function request(_0x4827eb,_0x56e234){return new BPromise(function(_0x2c670c,_0x3f4c03){return client[_0x79db('0x5')](_0x4827eb,_0x56e234)[_0x79db('0x6')](function(_0x5ece38){if(_0x5ece38[_0x79db('0x7')]){return _0x3f4c03(_0x5ece38[_0x79db('0x7')][_0x79db('0x8')]);}else{return _0x2c670c(_0x5ece38['result']);}})['catch'](function(_0x175888){return _0x3f4c03(_0x175888);});});}exports['getSquareProject']=function(_0x29557c){return request(_0x79db('0x9'),{'options':{'raw':![],'where':{'name':_0x29557c},'attributes':[_0x79db('0xa')]}});};exports['getMailAccountById']=function(_0x16b62d){return request(_0x79db('0xb'),{'options':{'raw':![],'where':{'id':_0x16b62d},'include':[{'model':_0x79db('0xc'),'as':_0x79db('0xd')}],'attributes':['id',_0x79db('0xe'),_0x79db('0xf')]}});};exports[_0x79db('0x10')]=function(_0x36b763){return request('ShowSquareProject',{'options':{'where':{'id':_0x36b763},'attributes':[_0x79db('0xe')]}});};exports['getVoiceQueueById']=function(_0x1fc304){return request(_0x79db('0x11'),{'options':{'where':{'id':_0x1fc304},'attributes':[_0x79db('0xe')]}});};exports['getVariableById']=function(_0x429fa2){return request(_0x79db('0x12'),{'options':{'where':{'id':_0x429fa2},'attributes':[_0x79db('0xe')]}});};exports[_0x79db('0x13')]=function(_0x44dc19){return request(_0x79db('0x14'),{'options':{'where':{'id':_0x44dc19},'attributes':[_0x79db('0x15')]}});};exports[_0x79db('0x16')]=function(_0x5ec3e0){return request('ShowUser',{'options':{'where':{'id':_0x5ec3e0},'attributes':[_0x79db('0xe')]}});};exports[_0x79db('0x17')]=function(_0x297fe7){return request(_0x79db('0x18'),{'options':{'where':{'id':_0x297fe7},'attributes':[_0x79db('0xe')]}});};exports[_0x79db('0x19')]=function(_0x319fad){return request(_0x79db('0x1a'),{'options':{'where':{'id':_0x319fad},'attributes':[_0x79db('0x1b')]}});};exports[_0x79db('0x1c')]=function(_0x40ab5f){return request(_0x79db('0x1d'),{'options':{'raw':![],'where':{'id':_0x40ab5f},'include':[{'model':_0x79db('0x1e'),'as':_0x79db('0x1f')}]}});};exports[_0x79db('0x20')]=function(_0x2881be){return request(_0x79db('0x21'),{'options':{'where':{'id':_0x2881be},'attributes':['id',_0x79db('0xe')]}});};exports[_0x79db('0x22')]=function(_0x304dd0){return request(_0x79db('0x23'),{'body':_0x304dd0});};exports[_0x79db('0x24')]=function(_0x2ff1b4){return request(_0x79db('0x25'),{'body':_0x2ff1b4});};exports[_0x79db('0x26')]=function(_0x32e6ae){return request(_0x79db('0x27'),{'body':_[_0x79db('0x28')](_0x32e6ae,{'project_name':_0x32e6ae[_0x79db('0x29')],'prev_project_name':_0x32e6ae[_0x79db('0x2a')]||'','is_subproject':_0x32e6ae[_0x79db('0x2a')]?!![]:![],'leaveAt':moment()[_0x79db('0x2b')](_0x79db('0x2c'))})});};exports['createSquareRecording']=function(_0xaecd42){return request('CreateSquareRecording',{'body':_0xaecd42});};exports[_0x79db('0x2d')]=function(_0x106b15){return request(_0x79db('0x2e'),{'options':{'raw':![],'where':{'phone':_0x106b15[_0x79db('0x2f')],'ListId':_0x106b15[_0x79db('0x30')]}}})[_0x79db('0x6')](function(_0x1a2d93){if(_0x1a2d93){return _0x1a2d93;}return request(_0x79db('0x31'),{'body':_0x106b15});});};exports[_0x79db('0x32')]=function(_0x6e4a95){return request(_0x79db('0x33'),{'options':{'where':{'id':_0x6e4a95},'attributes':['name']}});};exports[_0x79db('0x34')]=function(_0xa66ae1,_0x393782){return request('LoginUser',{'body':{'interface':_0x393782},'options':{'where':_0xa66ae1}});};exports[_0x79db('0x35')]=function(_0x1ce692,_0x353c05,_0x27bd54){return request(_0x79db('0x36'),{'body':{'type':_0x353c05,'uniqueid':_0x27bd54},'options':{'where':_0x1ce692}});};exports['agentUnpause']=function(_0xde9898){return request(_0x79db('0x37'),{'body':{},'options':{'where':_0xde9898}});};exports[_0x79db('0x38')]=function(_0x763f4a){return request(_0x79db('0x39'),{'body':{},'options':{'where':_0x763f4a}});}; \ 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 27b6b31..1a5d813 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 polly=require('./polly');module['exports']={'polly':polly}; \ No newline at end of file +var _0xf346=['exports','./polly'];(function(_0x1aaf72,_0x3e1520){var _0x522c70=function(_0x372c30){while(--_0x372c30){_0x1aaf72['push'](_0x1aaf72['shift']());}};_0x522c70(++_0x3e1520);}(_0xf346,0x13f));var _0x6f34=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf346[_0x40a045];return _0x1a687c;};var polly=require(_0x6f34('0x0'));module[_0x6f34('0x1')]={'polly':polly}; \ 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 44a7d9f..ab7c2e4 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 _0x33a3=['./lib/api'];(function(_0x69f81e,_0x1cc2b1){var _0x2b004e=function(_0x3deecb){while(--_0x3deecb){_0x69f81e['push'](_0x69f81e['shift']());}};_0x2b004e(++_0x1cc2b1);}(_0x33a3,0xde));var _0x333a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33a3[_0x2dafbe];return _0x58a45a;};'use strict';var polly=require(_0x333a('0x0'));module['exports']=function(_0x16d451,_0x45e315,_0x37703c,_0x481982,_0x5438a7,_0x570eac,_0x3f1256){return polly(_0x16d451,_0x45e315,_0x37703c,_0x481982,_0x5438a7,_0x570eac,_0x3f1256);}; \ No newline at end of file +var _0x595b=['./lib/api','exports'];(function(_0x56e7c1,_0x450309){var _0x5cd72e=function(_0x1dd0b8){while(--_0x1dd0b8){_0x56e7c1['push'](_0x56e7c1['shift']());}};_0x5cd72e(++_0x450309);}(_0x595b,0x112));var _0xb595=function(_0x516aa2,_0x543413){_0x516aa2=_0x516aa2-0x0;var _0x336ed3=_0x595b[_0x516aa2];return _0x336ed3;};'use strict';var polly=require(_0xb595('0x0'));module[_0xb595('0x1')]=function(_0x2a9bb9,_0x7d0fa,_0x1abd97,_0x2dbfb3,_0x16178d,_0x47f6f1,_0x457f83){return polly(_0x2a9bb9,_0x7d0fa,_0x1abd97,_0x2dbfb3,_0x16178d,_0x47f6f1,_0x457f83);}; \ 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 87e8f71..0b04703 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 _0xe3c7=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','synthesizeSpeech','AudioStream','writeFile'];(function(_0x53056c,_0x1d56a9){var _0x5cec88=function(_0x2ad06b){while(--_0x2ad06b){_0x53056c['push'](_0x53056c['shift']());}};_0x5cec88(++_0x1d56a9);}(_0xe3c7,0x1b3));var _0x7e3c=function(_0x193551,_0x29ab95){_0x193551=_0x193551-0x0;var _0x188c8f=_0xe3c7[_0x193551];return _0x188c8f;};'use strict';var fs=require('fs');var path=require(_0x7e3c('0x0'));var BPromise=require(_0x7e3c('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x507253,_0x30c2c7,_0x252b06){return new BPromise(function(_0x95ab66,_0x43dc26){_0x507253[_0x7e3c('0x2')](_0x30c2c7,function(_0x5650e8,_0x13a54a){if(_0x5650e8){_0x43dc26(_0x5650e8);}else if(_0x13a54a){if(_0x13a54a[_0x7e3c('0x3')]instanceof Buffer){fs[_0x7e3c('0x4')](_0x252b06,_0x13a54a[_0x7e3c('0x3')],function(_0x44ba29){if(_0x44ba29){_0x43dc26(_0x44ba29);}else{_0x95ab66();}});}else{_0x43dc26(new Error(_0x7e3c('0x5')));}}else{_0x43dc26(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x7e3c('0x6')]=function(_0x112dd1,_0x1d0bd8,_0x5005c8,_0x5ed16a,_0x7903a3,_0x4f9944,_0x43671d){var _0x230ddf=new AWS[(_0x7e3c('0x7'))]({'accessKeyId':_0x112dd1,'secretAccessKey':_0x1d0bd8,'region':_0x5005c8});var _0x5d569a={'Text':_0x7903a3,'TextType':_0x4f9944||'text','OutputFormat':'mp3','VoiceId':_0x5ed16a};return pollyResult(_0x230ddf,_0x5d569a,_0x43671d);}; \ No newline at end of file +var _0x349a=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x14fd98,_0x44ce0a){var _0x3d9d2b=function(_0x68a6f6){while(--_0x68a6f6){_0x14fd98['push'](_0x14fd98['shift']());}};_0x3d9d2b(++_0x44ce0a);}(_0x349a,0x66));var _0xa349=function(_0x35e768,_0xbe0d60){_0x35e768=_0x35e768-0x0;var _0x58cc5f=_0x349a[_0x35e768];return _0x58cc5f;};'use strict';var fs=require('fs');var path=require(_0xa349('0x0'));var BPromise=require('bluebird');var rs=require(_0xa349('0x1'));var AWS=require(_0xa349('0x2'));function pollyResult(_0x59187e,_0xef25f0,_0x5350c9){return new BPromise(function(_0xdfede0,_0x4c1af1){_0x59187e[_0xa349('0x3')](_0xef25f0,function(_0x521049,_0x373526){if(_0x521049){_0x4c1af1(_0x521049);}else if(_0x373526){if(_0x373526[_0xa349('0x4')]instanceof Buffer){fs[_0xa349('0x5')](_0x5350c9,_0x373526['AudioStream'],function(_0x37f859){if(_0x37f859){_0x4c1af1(_0x37f859);}else{_0xdfede0();}});}else{_0x4c1af1(new Error(_0xa349('0x6')));}}else{_0x4c1af1(new Error(_0xa349('0x7')));}});});}module[_0xa349('0x8')]=function(_0x566bf2,_0xa25fb4,_0x411576,_0x566a28,_0x4de9fc,_0x384bad,_0x227ff6){var _0x4708c1=new AWS[(_0xa349('0x9'))]({'accessKeyId':_0x566bf2,'secretAccessKey':_0xa25fb4,'region':_0x411576});var _0x5adb7e={'Text':_0x4de9fc,'TextType':_0x384bad||_0xa349('0xa'),'OutputFormat':_0xa349('0xb'),'VoiceId':_0x566a28};return pollyResult(_0x4708c1,_0x5adb7e,_0x227ff6);}; \ 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 aadddf4..26c1870 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 _0xfbb2=['./lib/api','exports'];(function(_0x4c0829,_0x330f43){var _0x35a9d6=function(_0x368a1f){while(--_0x368a1f){_0x4c0829['push'](_0x4c0829['shift']());}};_0x35a9d6(++_0x330f43);}(_0xfbb2,0xae));var _0x2fbb=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0xfbb2[_0x4ac48d];return _0x7537af;};'use strict';var asr=require(_0x2fbb('0x0'));module[_0x2fbb('0x1')]=function(_0x2dd363,_0x2b885f,_0x4da922,_0x25fc98){return asr(_0x2dd363,_0x2b885f,_0x4da922);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x23b8bf,_0x28e252,_0x2dc207,_0x2450f8){return asr(_0x23b8bf,_0x28e252,_0x2dc207);}; \ 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 176ea0a..ea9249f 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 _0x6b04=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string','length'];(function(_0x2965af,_0x225655){var _0x49edaa=function(_0x27b459){while(--_0x27b459){_0x2965af['push'](_0x2965af['shift']());}};_0x49edaa(++_0x225655);}(_0x6b04,0x86));var _0x46b0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6b04[_0x501510];return _0x1e6ee5;};'use strict';var url=require('url');var BPromise=require(_0x46b0('0x0'));var fs=require('fs');var host=_0x46b0('0x1');module[_0x46b0('0x2')]=function(_0x4337d9,_0x32cfc1,_0x456a13){return new BPromise(function(_0xe6f888,_0x3731b7){var _0x53ed30;if(typeof _0x4337d9!=='string'||_0x4337d9['length']===0x0){return _0x3731b7(_0x46b0('0x3'));}if(typeof _0x32cfc1!==_0x46b0('0x4')||_0x32cfc1[_0x46b0('0x5')]===0x0){return _0x3731b7('key\x20should\x20be\x20a\x20string');}if(typeof _0x456a13!=='undefined'&&(typeof _0x456a13!==_0x46b0('0x4')||_0x456a13[_0x46b0('0x5')]===0x0)){return _0x3731b7(_0x46b0('0x6'));}try{_0x53ed30=fs[_0x46b0('0x7')](_0x4337d9)[_0x46b0('0x8')](_0x46b0('0x9'));}catch(_0x52c97d){return _0x3731b7(_0x52c97d);}return _0xe6f888({'method':_0x46b0('0xa'),'uri':host+_0x46b0('0xb')+_0x32cfc1,'body':{'config':{'encoding':_0x46b0('0xc'),'sampleRateHertz':_0x46b0('0xd'),'languageCode':_0x456a13},'audio':{'content':_0x53ed30}},'json':!![]});});}; \ No newline at end of file +var _0xc008=['https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','toString','base64','LINEAR16','url','bluebird'];(function(_0x148bc0,_0xf5cfdc){var _0x34d7d0=function(_0x28f5d7){while(--_0x28f5d7){_0x148bc0['push'](_0x148bc0['shift']());}};_0x34d7d0(++_0xf5cfdc);}(_0xc008,0x77));var _0x8c00=function(_0xce0461,_0x5ebbf5){_0xce0461=_0xce0461-0x0;var _0x18da50=_0xc008[_0xce0461];return _0x18da50;};'use strict';var url=require(_0x8c00('0x0'));var BPromise=require(_0x8c00('0x1'));var fs=require('fs');var host=_0x8c00('0x2');module['exports']=function(_0x369841,_0x2c6f2e,_0x302396){return new BPromise(function(_0x4c4280,_0xc9f6e2){var _0x996cb4;if(typeof _0x369841!=='string'||_0x369841[_0x8c00('0x3')]===0x0){return _0xc9f6e2(_0x8c00('0x4'));}if(typeof _0x2c6f2e!==_0x8c00('0x5')||_0x2c6f2e[_0x8c00('0x3')]===0x0){return _0xc9f6e2(_0x8c00('0x6'));}if(typeof _0x302396!==_0x8c00('0x7')&&(typeof _0x302396!==_0x8c00('0x5')||_0x302396[_0x8c00('0x3')]===0x0)){return _0xc9f6e2('lang\x20should\x20be\x20a\x20string');}try{_0x996cb4=fs['readFileSync'](_0x369841)[_0x8c00('0x8')](_0x8c00('0x9'));}catch(_0x547e30){return _0xc9f6e2(_0x547e30);}return _0x4c4280({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x2c6f2e,'body':{'config':{'encoding':_0x8c00('0xa'),'sampleRateHertz':'8000','languageCode':_0x302396},'audio':{'content':_0x996cb4}},'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 3ffac9b..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(_0x2f3b86,_0x1fffad){var _0x9741a0=function(_0x654b64){while(--_0x654b64){_0x2f3b86['push'](_0x2f3b86['shift']());}};_0x9741a0(++_0x1fffad);}(_0x008c,0x188));var _0xc008=function(_0x473a79,_0x5e608b){_0x473a79=_0x473a79-0x0;var _0x5a91b3=_0x008c[_0x473a79];return _0x5a91b3;};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 ba0e4c0..c395a02 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 _0x2e62=['unlink','pipe','protocol','https:','data','end','transcode','wav','finish\x20to\x20convert','start','readFileSync','base64','then','info','resolve','generate','.mp3','tmp','.wav','chmodSync','777','goggleTTS\x20path','split','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','dirName','http','https','url','parse','bluebird','randomstring','util','google-tts-api','apiai-promise','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','close'];(function(_0x44c340,_0x575719){var _0x2cd080=function(_0x1109ea){while(--_0x1109ea){_0x44c340['push'](_0x44c340['shift']());}};_0x2cd080(++_0x575719);}(_0x2e62,0x136));var _0x22e6=function(_0x3c5cdf,_0x3fff40){_0x3c5cdf=_0x3c5cdf-0x0;var _0x341557=_0x2e62[_0x3c5cdf];return _0x341557;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0x22e6('0x0'));var https=require(_0x22e6('0x1'));var urlParse=require(_0x22e6('0x2'))[_0x22e6('0x3')];var BPromise=require(_0x22e6('0x4'));var rs=require(_0x22e6('0x5'));var sox=require('sox');var rp=require('request-promise');var util=require(_0x22e6('0x6'));var querystring=require('querystring');var moment=require('moment');var tts=require(_0x22e6('0x7'));var apiai=require(_0x22e6('0x8'));var google=require('./google');var aws=require(_0x22e6('0x9'));var tilde=require(_0x22e6('0xa'));var logger=require(_0x22e6('0xb'))(_0x22e6('0xc'));var ISPEECH_API=_0x22e6('0xd');function downloadFile(_0x8b880f,_0x1aae0c){return new BPromise(function(_0x1f1095,_0x5daad3){var _0x5c0d7b=urlParse(_0x8b880f);var _0x17d195=_0x5c0d7b['protocol']==='https:'?https:http;var _0x29aff7={'host':_0x5c0d7b[_0x22e6('0xe')],'path':_0x5c0d7b[_0x22e6('0xf')],'headers':{'user-agent':_0x22e6('0x10')}};_0x17d195[_0x22e6('0x11')](_0x29aff7,function(_0x2bea84){if(_0x2bea84[_0x22e6('0x12')]!==0xc8){logger[_0x22e6('0x13')](_0x22e6('0x14')+_0x8b880f+_0x22e6('0x15')+_0x2bea84[_0x22e6('0x12')]+'\x20('+_0x2bea84['statusMessage']+')');_0x5daad3(new Error(_0x22e6('0x14')+_0x8b880f+_0x22e6('0x15')+_0x2bea84[_0x22e6('0x12')]+'\x20('+_0x2bea84[_0x22e6('0x16')]+')'));return;}var _0x298d37=fs[_0x22e6('0x17')](_0x1aae0c);_0x298d37['on']('finish',function(){logger['info'](_0x22e6('0x18'));_0x298d37[_0x22e6('0x19')](_0x1f1095);});_0x298d37['on'](_0x22e6('0x13'),function(_0x5129de){fs[_0x22e6('0x1a')](_0x1aae0c);logger['error']('download\x20error',_0x5129de);_0x5daad3(_0x5129de);});_0x2bea84[_0x22e6('0x1b')](_0x298d37);})['on']('error',function(_0x499f5a){logger[_0x22e6('0x13')](_0x499f5a);_0x5daad3(_0x499f5a);})['end']();});}function uploadFile(_0x114478){return new BPromise(function(_0x4293c3,_0x340cd5){var _0x5a89f2=urlParse(_0x114478);var _0xef4bad=_0x5a89f2[_0x22e6('0x1c')]===_0x22e6('0x1d')?https:http;var _0x4d2a4a={'host':_0x5a89f2[_0x22e6('0xe')],'path':_0x5a89f2['path'],'headers':{'user-agent':_0x22e6('0x10')}};_0xef4bad[_0x22e6('0x11')](_0x4d2a4a,function(_0xf6dd87){if(_0xf6dd87[_0x22e6('0x12')]!==0xc8){_0x340cd5(new Error(_0x22e6('0x14')+_0x114478+_0x22e6('0x15')+_0xf6dd87[_0x22e6('0x12')]+'\x20('+_0xf6dd87[_0x22e6('0x16')]+')'));return;}var _0x2ab007='';_0xf6dd87['on'](_0x22e6('0x1e'),function(_0x2462eb){_0x2ab007+=_0x2462eb;});_0xf6dd87['on'](_0x22e6('0x1f'),function(){_0x4293c3(_0x2ab007);});})['on']('error',function(_0x493f6a){_0x340cd5(_0x493f6a);})[_0x22e6('0x1f')]();});}function convertFile(_0x36b2aa,_0x2a214f){return new BPromise(function(_0x3f8cf6,_0x2d677b){var _0x236ff1=sox[_0x22e6('0x20')](_0x36b2aa,_0x2a214f,{'sampleRate':0x1f40,'format':_0x22e6('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x236ff1['on'](_0x22e6('0x13'),function(_0x4af894){logger[_0x22e6('0x13')]('error\x20convert',_0x4af894);_0x2d677b(_0x4af894);});_0x236ff1['on'](_0x22e6('0x1f'),function(){logger['info'](_0x22e6('0x22'));_0x3f8cf6();});_0x236ff1[_0x22e6('0x23')]();});}function base64Encode(_0x3cb6f1){var _0x2b9f13=fs[_0x22e6('0x24')](_0x3cb6f1);return new Buffer(_0x2b9f13)['toString'](_0x22e6('0x25'));}exports['googleTTS']=function(_0x573577,_0x196e69){var _0x57ba07,_0x23a289;return tts(_0x573577,_0x196e69||'en',0x1)[_0x22e6('0x26')](function(_0x595228){logger[_0x22e6('0x27')](_0x595228);_0x57ba07=path[_0x22e6('0x28')](__dirname,'tmp',rs[_0x22e6('0x29')](0x4)+_0x22e6('0x2a'));return downloadFile(_0x595228,_0x57ba07);})[_0x22e6('0x26')](function(){_0x23a289=path[_0x22e6('0x28')](__dirname,_0x22e6('0x2b'),rs[_0x22e6('0x29')](0x4)+_0x22e6('0x2c'));return convertFile(_0x57ba07,_0x23a289);})[_0x22e6('0x26')](function(){try{fs['unlink'](_0x57ba07);fs[_0x22e6('0x2d')](_0x23a289,_0x22e6('0x2e'));}catch(_0x1efd55){logger[_0x22e6('0x13')](_0x1efd55);}logger[_0x22e6('0x27')](_0x22e6('0x2f'),_0x23a289[_0x22e6('0x30')]('.')[0x0]);return _0x23a289[_0x22e6('0x30')]('.')[0x0];});};exports['googleASR']=function(_0x515fb1,_0x3bfe0d,_0xc4fc97){return google[_0x22e6('0x31')](_0x515fb1,_0x3bfe0d,_0xc4fc97)[_0x22e6('0x26')](function(_0xf8cc3d){logger[_0x22e6('0x27')](_0xf8cc3d['uri']);return rp(_0xf8cc3d);})[_0x22e6('0x26')](function(_0x2030df){var _0x186b9b='';var _0x287aae=0x0;try{fs[_0x22e6('0x1a')](_0x515fb1);}catch(_0x16c173){logger[_0x22e6('0x13')](_0x16c173);}if(_0x2030df&&_0x2030df[_0x22e6('0x32')]){_0x186b9b=_0x2030df[_0x22e6('0x32')][_0x22e6('0x33')](function(_0x58c005){return _0x58c005&&_0x58c005[_0x22e6('0x34')][0x0]&&_0x58c005[_0x22e6('0x34')][0x0][_0x22e6('0x35')]?_0x58c005['alternatives'][0x0][_0x22e6('0x35')]:'';})[_0x22e6('0x36')]('\x0a');_0x287aae=_0x2030df[_0x22e6('0x32')][_0x22e6('0x33')](function(_0x35594e){return _0x35594e&&_0x35594e[_0x22e6('0x34')][0x0]&&_0x35594e[_0x22e6('0x34')][0x0][_0x22e6('0x37')]?_0x35594e[_0x22e6('0x34')][0x0]['confidence']:0x0;})[_0x22e6('0x36')]('\x0a');}logger[_0x22e6('0x27')](_0x22e6('0x38'),_0x186b9b);logger[_0x22e6('0x27')](_0x22e6('0x39'),_0x287aae);return{'transcript':_0x186b9b,'confidence':_0x287aae};})[_0x22e6('0x3a')](function(_0x3aa963){logger['error'](_0x22e6('0x3b'),_0x3aa963[_0x22e6('0x12')],_0x3aa963[_0x22e6('0x3c')],_0x3aa963[_0x22e6('0x3d')]);});};exports['googleDialogflow']=function(_0x18a533,_0x109976,_0xe79a1b,_0x5339c1){var _0x44e4e5=apiai(_0x109976,{'language':_0x5339c1||'en'});return _0x44e4e5[_0x22e6('0x3e')](_0xe79a1b,{'sessionId':_0x18a533})['then'](function(_0x5a34d8){logger[_0x22e6('0x27')](JSON['stringify'](_0x5a34d8));return{'source':_0x5a34d8[_0x22e6('0x3f')][_0x22e6('0x40')],'resolvedQuery':_0x5a34d8[_0x22e6('0x3f')][_0x22e6('0x41')],'action':_0x5a34d8['result'][_0x22e6('0x42')],'actionIncomplete':_0x5a34d8[_0x22e6('0x3f')][_0x22e6('0x43')],'speech':_0x5a34d8[_0x22e6('0x3f')][_0x22e6('0x44')][_0x22e6('0x45')],'score':_0x5a34d8[_0x22e6('0x3f')]['score'],'statusCode':_0x5a34d8[_0x22e6('0x46')][_0x22e6('0x47')]};});};exports[_0x22e6('0x48')]=function(_0x156466,_0x2978cc,_0x2eed64,_0x19bc4a){return tilde['asr'](_0x156466,_0x2978cc,_0x2eed64,_0x19bc4a)[_0x22e6('0x26')](function(_0x192df0){try{fs['unlink'](_0x156466);}catch(_0x484c24){logger[_0x22e6('0x13')](_0x484c24);}logger[_0x22e6('0x27')]('Tilde\x20ASR\x20transcription',_0x192df0[_0x22e6('0x35')]);logger[_0x22e6('0x27')](_0x22e6('0x49'),_0x192df0[_0x22e6('0x37')]);return _0x192df0;});};exports[_0x22e6('0x4a')]=function(_0x5e9475,_0x5871c0,_0x13da5e,_0x157360,_0x4bbf54,_0x113387){var _0x322c06=path[_0x22e6('0x28')](__dirname,_0x22e6('0x2b'),rs[_0x22e6('0x29')](0x4)+_0x22e6('0x2a'));var _0x2fec19;return aws[_0x22e6('0x4b')](_0x5e9475,_0x5871c0,_0x13da5e,_0x157360,_0x4bbf54,_0x113387,_0x322c06)[_0x22e6('0x26')](function(){_0x2fec19=path[_0x22e6('0x28')](__dirname,_0x22e6('0x2b'),rs[_0x22e6('0x29')](0x4)+_0x22e6('0x2c'));return convertFile(_0x322c06,_0x2fec19);})[_0x22e6('0x26')](function(){try{fs[_0x22e6('0x1a')](_0x322c06);fs[_0x22e6('0x2d')](_0x2fec19,_0x22e6('0x2e'));}catch(_0x16a146){logger[_0x22e6('0x13')](_0x16a146);}return _0x2fec19['split']('.')[0x0];});};exports[_0x22e6('0x4c')]=function(_0xf20ce7,_0x399079,_0x2e8b7f,_0x27f18d){var _0x2dcb56=util[_0x22e6('0x4d')](_0x22e6('0x4e'),ISPEECH_API,_0xf20ce7,encodeURIComponent(_0x399079),_0x2e8b7f,_0x27f18d);var _0x2d96a6=path[_0x22e6('0x28')](__dirname,_0x22e6('0x2b'),rs[_0x22e6('0x29')](0x4)+_0x22e6('0x2a'));var _0xaa4dfc;return downloadFile(_0x2dcb56,_0x2d96a6)[_0x22e6('0x26')](function(){_0xaa4dfc=path[_0x22e6('0x28')](__dirname,'tmp',rs[_0x22e6('0x29')](0x4)+_0x22e6('0x2c'));return convertFile(_0x2d96a6,_0xaa4dfc);})[_0x22e6('0x26')](function(){try{fs[_0x22e6('0x1a')](_0x2d96a6);fs['chmodSync'](_0xaa4dfc,_0x22e6('0x2e'));}catch(_0x249a97){logger['error'](_0x249a97);}return _0xaa4dfc[_0x22e6('0x30')]('.')[0x0];});};exports[_0x22e6('0x4f')]=function(_0x1427e,_0x691d83,_0x24d57c,_0x2d486f){var _0x526989=util[_0x22e6('0x4d')](_0x22e6('0x50'),ISPEECH_API,_0x691d83,_0x24d57c,base64Encode(_0x1427e),_0x2d486f?util[_0x22e6('0x4d')](_0x22e6('0x51'),encodeURIComponent(_0x2d486f)):_0x22e6('0x52'));return uploadFile(_0x526989)[_0x22e6('0x26')](function(_0x43130e){return querystring[_0x22e6('0x3')](_0x43130e);});};exports[_0x22e6('0x53')]=function(){return __dirname;}; \ No newline at end of file +var _0xff8f=['statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','toString','base64','googleTTS','then','resolve','tmp','.mp3','generate','.wav','chmodSync','777','goggleTTS\x20path','split','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','dirName','http','https','parse','bluebird','randomstring','sox','request-promise','util','querystring','moment','google-tts-api','./google','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','path','WHAT_EVER','get','statusCode','error'];(function(_0x498caf,_0x2d64a6){var _0x1521ec=function(_0x12e626){while(--_0x12e626){_0x498caf['push'](_0x498caf['shift']());}};_0x1521ec(++_0x2d64a6);}(_0xff8f,0x1b4));var _0xfff8=function(_0x436b97,_0x49798a){_0x436b97=_0x436b97-0x0;var _0x247566=_0xff8f[_0x436b97];return _0x247566;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0xfff8('0x0'));var https=require(_0xfff8('0x1'));var urlParse=require('url')[_0xfff8('0x2')];var BPromise=require(_0xfff8('0x3'));var rs=require(_0xfff8('0x4'));var sox=require(_0xfff8('0x5'));var rp=require(_0xfff8('0x6'));var util=require(_0xfff8('0x7'));var querystring=require(_0xfff8('0x8'));var moment=require(_0xfff8('0x9'));var tts=require(_0xfff8('0xa'));var apiai=require('apiai-promise');var google=require(_0xfff8('0xb'));var aws=require(_0xfff8('0xc'));var tilde=require(_0xfff8('0xd'));var logger=require(_0xfff8('0xe'))(_0xfff8('0xf'));var ISPEECH_API=_0xfff8('0x10');function downloadFile(_0x15ed35,_0xe36a41){return new BPromise(function(_0x215954,_0xf3423a){var _0x124c9b=urlParse(_0x15ed35);var _0x194cac=_0x124c9b[_0xfff8('0x11')]===_0xfff8('0x12')?https:http;var _0x13ecb9={'host':_0x124c9b['host'],'path':_0x124c9b[_0xfff8('0x13')],'headers':{'user-agent':_0xfff8('0x14')}};_0x194cac[_0xfff8('0x15')](_0x13ecb9,function(_0x4088d8){if(_0x4088d8[_0xfff8('0x16')]!==0xc8){logger[_0xfff8('0x17')]('request\x20to\x20'+_0x15ed35+'\x20failed,\x20status\x20code\x20=\x20'+_0x4088d8[_0xfff8('0x16')]+'\x20('+_0x4088d8[_0xfff8('0x18')]+')');_0xf3423a(new Error(_0xfff8('0x19')+_0x15ed35+'\x20failed,\x20status\x20code\x20=\x20'+_0x4088d8[_0xfff8('0x16')]+'\x20('+_0x4088d8[_0xfff8('0x18')]+')'));return;}var _0x4f31c3=fs[_0xfff8('0x1a')](_0xe36a41);_0x4f31c3['on'](_0xfff8('0x1b'),function(){logger[_0xfff8('0x1c')](_0xfff8('0x1d'));_0x4f31c3['close'](_0x215954);});_0x4f31c3['on']('error',function(_0x59d911){fs[_0xfff8('0x1e')](_0xe36a41);logger['error'](_0xfff8('0x1f'),_0x59d911);_0xf3423a(_0x59d911);});_0x4088d8[_0xfff8('0x20')](_0x4f31c3);})['on'](_0xfff8('0x17'),function(_0x5d1178){logger[_0xfff8('0x17')](_0x5d1178);_0xf3423a(_0x5d1178);})[_0xfff8('0x21')]();});}function uploadFile(_0x33b677){return new BPromise(function(_0x122210,_0x520a98){var _0xbada22=urlParse(_0x33b677);var _0x229531=_0xbada22[_0xfff8('0x11')]===_0xfff8('0x12')?https:http;var _0x30179e={'host':_0xbada22[_0xfff8('0x22')],'path':_0xbada22[_0xfff8('0x13')],'headers':{'user-agent':_0xfff8('0x14')}};_0x229531[_0xfff8('0x15')](_0x30179e,function(_0x4d4074){if(_0x4d4074[_0xfff8('0x16')]!==0xc8){_0x520a98(new Error('request\x20to\x20'+_0x33b677+'\x20failed,\x20status\x20code\x20=\x20'+_0x4d4074[_0xfff8('0x16')]+'\x20('+_0x4d4074['statusMessage']+')'));return;}var _0x5741ff='';_0x4d4074['on'](_0xfff8('0x23'),function(_0x28747f){_0x5741ff+=_0x28747f;});_0x4d4074['on'](_0xfff8('0x21'),function(){_0x122210(_0x5741ff);});})['on'](_0xfff8('0x17'),function(_0x365656){_0x520a98(_0x365656);})[_0xfff8('0x21')]();});}function convertFile(_0x4641fc,_0x9c181e){return new BPromise(function(_0x3e5bb6,_0x1d30dc){var _0x42e32d=sox[_0xfff8('0x24')](_0x4641fc,_0x9c181e,{'sampleRate':0x1f40,'format':_0xfff8('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x42e32d['on'](_0xfff8('0x17'),function(_0x193c62){logger[_0xfff8('0x17')](_0xfff8('0x26'),_0x193c62);_0x1d30dc(_0x193c62);});_0x42e32d['on'](_0xfff8('0x21'),function(){logger[_0xfff8('0x1c')](_0xfff8('0x27'));_0x3e5bb6();});_0x42e32d[_0xfff8('0x28')]();});}function base64Encode(_0x25e16d){var _0x40183b=fs['readFileSync'](_0x25e16d);return new Buffer(_0x40183b)[_0xfff8('0x29')](_0xfff8('0x2a'));}exports[_0xfff8('0x2b')]=function(_0x268831,_0x4c1839){var _0x371a53,_0x2670e0;return tts(_0x268831,_0x4c1839||'en',0x1)[_0xfff8('0x2c')](function(_0x2b2683){logger[_0xfff8('0x1c')](_0x2b2683);_0x371a53=path[_0xfff8('0x2d')](__dirname,_0xfff8('0x2e'),rs['generate'](0x4)+_0xfff8('0x2f'));return downloadFile(_0x2b2683,_0x371a53);})[_0xfff8('0x2c')](function(){_0x2670e0=path[_0xfff8('0x2d')](__dirname,_0xfff8('0x2e'),rs[_0xfff8('0x30')](0x4)+_0xfff8('0x31'));return convertFile(_0x371a53,_0x2670e0);})[_0xfff8('0x2c')](function(){try{fs[_0xfff8('0x1e')](_0x371a53);fs[_0xfff8('0x32')](_0x2670e0,_0xfff8('0x33'));}catch(_0x54942c){logger['error'](_0x54942c);}logger['info'](_0xfff8('0x34'),_0x2670e0[_0xfff8('0x35')]('.')[0x0]);return _0x2670e0[_0xfff8('0x35')]('.')[0x0];});};exports[_0xfff8('0x36')]=function(_0x302225,_0x3a44dd,_0x3b2b2a){return google[_0xfff8('0x37')](_0x302225,_0x3a44dd,_0x3b2b2a)[_0xfff8('0x2c')](function(_0x16fd8c){logger[_0xfff8('0x1c')](_0x16fd8c[_0xfff8('0x38')]);return rp(_0x16fd8c);})[_0xfff8('0x2c')](function(_0x326394){var _0x31ca78='';var _0x38a456=0x0;try{fs[_0xfff8('0x1e')](_0x302225);}catch(_0x96bcef){logger[_0xfff8('0x17')](_0x96bcef);}if(_0x326394&&_0x326394[_0xfff8('0x39')]){_0x31ca78=_0x326394[_0xfff8('0x39')][_0xfff8('0x3a')](function(_0x3232bc){return _0x3232bc&&_0x3232bc[_0xfff8('0x3b')][0x0]&&_0x3232bc[_0xfff8('0x3b')][0x0][_0xfff8('0x3c')]?_0x3232bc[_0xfff8('0x3b')][0x0][_0xfff8('0x3c')]:'';})['join']('\x0a');_0x38a456=_0x326394['results'][_0xfff8('0x3a')](function(_0x5ac319){return _0x5ac319&&_0x5ac319[_0xfff8('0x3b')][0x0]&&_0x5ac319[_0xfff8('0x3b')][0x0]['confidence']?_0x5ac319[_0xfff8('0x3b')][0x0][_0xfff8('0x3d')]:0x0;})[_0xfff8('0x3e')]('\x0a');}logger[_0xfff8('0x1c')](_0xfff8('0x3f'),_0x31ca78);logger['info']('googleASR\x20confidence',_0x38a456);return{'transcript':_0x31ca78,'confidence':_0x38a456};})[_0xfff8('0x40')](function(_0x466fe1){logger[_0xfff8('0x17')](_0xfff8('0x41'),_0x466fe1['statusCode'],_0x466fe1['name'],_0x466fe1[_0xfff8('0x42')]);});};exports[_0xfff8('0x43')]=function(_0x3354e9,_0x373096,_0x319cf0,_0x57eb27){var _0x3731ea=apiai(_0x373096,{'language':_0x57eb27||'en'});return _0x3731ea[_0xfff8('0x44')](_0x319cf0,{'sessionId':_0x3354e9})['then'](function(_0x49b3d0){logger[_0xfff8('0x1c')](JSON[_0xfff8('0x45')](_0x49b3d0));return{'source':_0x49b3d0[_0xfff8('0x46')][_0xfff8('0x47')],'resolvedQuery':_0x49b3d0[_0xfff8('0x46')][_0xfff8('0x48')],'action':_0x49b3d0[_0xfff8('0x46')][_0xfff8('0x49')],'actionIncomplete':_0x49b3d0[_0xfff8('0x46')][_0xfff8('0x4a')],'speech':_0x49b3d0['result'][_0xfff8('0x4b')][_0xfff8('0x4c')],'score':_0x49b3d0['result'][_0xfff8('0x4d')],'statusCode':_0x49b3d0[_0xfff8('0x4e')][_0xfff8('0x4f')]};});};exports[_0xfff8('0x50')]=function(_0xc05b6f,_0x3e7438,_0x342a8a,_0x18b03b){return tilde[_0xfff8('0x37')](_0xc05b6f,_0x3e7438,_0x342a8a,_0x18b03b)[_0xfff8('0x2c')](function(_0x306a56){try{fs[_0xfff8('0x1e')](_0xc05b6f);}catch(_0x2c2e3b){logger[_0xfff8('0x17')](_0x2c2e3b);}logger[_0xfff8('0x1c')](_0xfff8('0x51'),_0x306a56[_0xfff8('0x3c')]);logger[_0xfff8('0x1c')](_0xfff8('0x52'),_0x306a56[_0xfff8('0x3d')]);return _0x306a56;});};exports[_0xfff8('0x53')]=function(_0x185823,_0x43c90f,_0x4ab61b,_0x1e258e,_0x491d17,_0x3dbc9f){var _0x54704b=path['resolve'](__dirname,_0xfff8('0x2e'),rs['generate'](0x4)+_0xfff8('0x2f'));var _0x17a538;return aws[_0xfff8('0x54')](_0x185823,_0x43c90f,_0x4ab61b,_0x1e258e,_0x491d17,_0x3dbc9f,_0x54704b)['then'](function(){_0x17a538=path[_0xfff8('0x2d')](__dirname,'tmp',rs[_0xfff8('0x30')](0x4)+_0xfff8('0x31'));return convertFile(_0x54704b,_0x17a538);})[_0xfff8('0x2c')](function(){try{fs[_0xfff8('0x1e')](_0x54704b);fs['chmodSync'](_0x17a538,_0xfff8('0x33'));}catch(_0xf226b0){logger[_0xfff8('0x17')](_0xf226b0);}return _0x17a538[_0xfff8('0x35')]('.')[0x0];});};exports[_0xfff8('0x55')]=function(_0x3ca85d,_0x392268,_0x42e4e7,_0x4f1919){var _0x741bd3=util[_0xfff8('0x56')](_0xfff8('0x57'),ISPEECH_API,_0x3ca85d,encodeURIComponent(_0x392268),_0x42e4e7,_0x4f1919);var _0x33f783=path[_0xfff8('0x2d')](__dirname,_0xfff8('0x2e'),rs[_0xfff8('0x30')](0x4)+'.mp3');var _0x1ba2b6;return downloadFile(_0x741bd3,_0x33f783)[_0xfff8('0x2c')](function(){_0x1ba2b6=path['resolve'](__dirname,_0xfff8('0x2e'),rs[_0xfff8('0x30')](0x4)+_0xfff8('0x31'));return convertFile(_0x33f783,_0x1ba2b6);})[_0xfff8('0x2c')](function(){try{fs[_0xfff8('0x1e')](_0x33f783);fs[_0xfff8('0x32')](_0x1ba2b6,_0xfff8('0x33'));}catch(_0x593052){logger[_0xfff8('0x17')](_0x593052);}return _0x1ba2b6['split']('.')[0x0];});};exports[_0xfff8('0x58')]=function(_0x25233d,_0x4368a4,_0x28ec8c,_0x419547){var _0x33bbb9=util[_0xfff8('0x56')](_0xfff8('0x59'),ISPEECH_API,_0x4368a4,_0x28ec8c,base64Encode(_0x25233d),_0x419547?util[_0xfff8('0x56')]('model=%s',encodeURIComponent(_0x419547)):_0xfff8('0x5a'));return uploadFile(_0x33bbb9)['then'](function(_0x58708a){return querystring[_0xfff8('0x2')](_0x58708a);});};exports[_0xfff8('0x5b')]=function(){return __dirname;}; \ 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 088c16a..5dac88c 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 _0xfeb1=['./lib/api','exports'];(function(_0x55768b,_0x3dbd37){var _0x32c5bf=function(_0x11b381){while(--_0x11b381){_0x55768b['push'](_0x55768b['shift']());}};_0x32c5bf(++_0x3dbd37);}(_0xfeb1,0x188));var _0x1feb=function(_0x3887f0,_0x5e07c1){_0x3887f0=_0x3887f0-0x0;var _0x508365=_0xfeb1[_0x3887f0];return _0x508365;};'use strict';var asr=require(_0x1feb('0x0'));module[_0x1feb('0x1')]=function(_0x566bc2,_0x124bd9,_0x1216ad,_0x3eff66){return asr(_0x566bc2,_0x124bd9,_0x1216ad,_0x3eff66);}; \ No newline at end of file +var _0xa500=['./lib/api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa500,0x184));var _0x0a50=function(_0x11284c,_0x681901){_0x11284c=_0x11284c-0x0;var _0x413cce=_0xa500[_0x11284c];return _0x413cce;};'use strict';var asr=require(_0x0a50('0x0'));module['exports']=function(_0x4863ec,_0xaf7a44,_0x683365,_0x42dfb4){return asr(_0x4863ec,_0xaf7a44,_0x683365,_0x42dfb4);}; \ 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 97fbcd6..d68c754 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 _0xf4c9=['Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','EOS'];(function(_0x57f9dd,_0x1e8470){var _0x26c636=function(_0x1e9f09){while(--_0x1e9f09){_0x57f9dd['push'](_0x57f9dd['shift']());}};_0x26c636(++_0x1e8470);}(_0xf4c9,0x18e));var _0x9f4c=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xf4c9[_0x29d94e];return _0x106237;};'use strict';var BPromise=require(_0x9f4c('0x0'));var _=require(_0x9f4c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9f4c('0x2'));var crypto=require(_0x9f4c('0x3'));var logger=require(_0x9f4c('0x4'))(_0x9f4c('0x5'));module[_0x9f4c('0x6')]=function(_0x2497f5,_0x540c74,_0x2cbed1,_0x7126f3){return new BPromise(function(_0x1eff0e,_0xc684be){logger['info'](_0x9f4c('0x7'),_0x7126f3||_0x9f4c('0x8'));var _0x314016=new WebSocket(_0x7126f3||_0x9f4c('0x8'),{'perMessageDeflate':![]});var _0x406b5a='';var _0x1f4ac0='0';var _0x4d5654='1';var _0x4cb077=_0x9f4c('0x9');function _0x36b8f8(_0x549696){var _0x539342=crypto[_0x9f4c('0xa')](_0x9f4c('0xb'));_0x539342[_0x9f4c('0xc')](_0x549696);return _0x539342[_0x9f4c('0xd')]('hex');}function _0x2eff49(){try{logger[_0x9f4c('0xe')](_0x9f4c('0xf'));var _0x383abb=moment()['unix']();var _0x92fc76=_0x36b8f8(_0x383abb+_0x540c74+_0x2cbed1);_0x314016[_0x9f4c('0x10')](JSON[_0x9f4c('0x11')]({'appID':_0x540c74,'timestamp':_0x383abb,'appKey':_0x92fc76}));var _0x2eb446=fs['createReadStream'](_0x2497f5);_0x2eb446['on'](_0x9f4c('0x12'),function(_0x14d193){_0x314016[_0x9f4c('0x10')](_0x14d193);});_0x2eb446['on']('close',function(){_0x314016[_0x9f4c('0x10')](_0x9f4c('0x13'));});}catch(_0x2f9c6f){logger['error'](_0x9f4c('0x14'),JSON[_0x9f4c('0x11')](_0x2f9c6f));_0x314016[_0x9f4c('0x15')]();}}function _0x44597c(_0x3bef3e){try{if(_0x3bef3e){var _0x3b9b5c=JSON['parse'](_0x3bef3e);switch(_0x3b9b5c[_0x9f4c('0x16')]){case 0x0:if(_0x3b9b5c[_0x9f4c('0x17')]){if(_0x3b9b5c[_0x9f4c('0x17')]['final']){logger[_0x9f4c('0xe')](_0x9f4c('0x18'),JSON['stringify'](_0x3b9b5c[_0x9f4c('0x17')][_0x9f4c('0x19')]));_0x406b5a=_0x3b9b5c[_0x9f4c('0x17')][_0x9f4c('0x19')][0x0][_0x9f4c('0x1a')];_0x1f4ac0=_0x3b9b5c[_0x9f4c('0x17')]['hypotheses'][0x0][_0x9f4c('0x1b')];_0x4d5654='0';_0x4cb077=_0x9f4c('0x1c');_0x314016[_0x9f4c('0x15')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4d5654='1';_0x4cb077=_0x9f4c('0x9');break;case 0x2:logger[_0x9f4c('0xe')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4d5654='2';_0x4cb077='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x9f4c('0x1d'));_0x4d5654='9';_0x4cb077=_0x9f4c('0x1d');break;case 0xa:logger[_0x9f4c('0xe')](_0x9f4c('0x1e'));_0x4d5654='10';_0x4cb077='Authentication\x20failed.';break;case 0xb:logger[_0x9f4c('0xe')](_0x9f4c('0x1f'));_0x4d5654='11';_0x4cb077=_0x9f4c('0x1f');}}}catch(_0x762730){logger[_0x9f4c('0x20')](_0x9f4c('0x21'),JSON[_0x9f4c('0x11')](_0x762730));_0x314016[_0x9f4c('0x15')]();}}function _0x2ef5d3(){logger[_0x9f4c('0xe')](_0x9f4c('0x22'));_0x1eff0e({'transcript':_0x406b5a,'confidence':_0x1f4ac0,'status':_0x4d5654,'status_message':_0x4cb077});}function _0x2714d6(_0x385f9d){logger[_0x9f4c('0x20')](_0x9f4c('0x23'));if(!_['isNil'](_0x385f9d)){logger['error'](_['isObject'](_0x385f9d)?JSON['stringify'](_0x385f9d):_0x385f9d);}}_0x314016['on']('open',_0x2eff49);_0x314016['on'](_0x9f4c('0x24'),_0x44597c);_0x314016['on'](_0x9f4c('0x25'),_0x2ef5d3);_0x314016['on'](_0x9f4c('0x20'),_0x2714d6);});}; \ No newline at end of file +var _0xac27=['../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','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','terminate','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','lodash','moment','crypto'];(function(_0x30d33c,_0x263291){var _0x329f06=function(_0x3e2cd6){while(--_0x3e2cd6){_0x30d33c['push'](_0x30d33c['shift']());}};_0x329f06(++_0x263291);}(_0xac27,0x13d));var _0x7ac2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xac27[_0x21a9d9];return _0x46adce;};'use strict';var BPromise=require('bluebird');var _=require(_0x7ac2('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7ac2('0x1'));var crypto=require(_0x7ac2('0x2'));var logger=require(_0x7ac2('0x3'))(_0x7ac2('0x4'));module[_0x7ac2('0x5')]=function(_0x5e7bec,_0xd3e60,_0x35fda1,_0x422c35){return new BPromise(function(_0xead256,_0x23d831){logger['info'](_0x7ac2('0x6'),_0x422c35||_0x7ac2('0x7'));var _0x4367c6=new WebSocket(_0x422c35||_0x7ac2('0x7'),{'perMessageDeflate':![]});var _0x90d1e1='';var _0x4f66c2='0';var _0xb5e5bc='1';var _0x30cca5=_0x7ac2('0x8');function _0xd37491(_0x5f0b6d){var _0x3687df=crypto['createHash'](_0x7ac2('0x9'));_0x3687df[_0x7ac2('0xa')](_0x5f0b6d);return _0x3687df[_0x7ac2('0xb')](_0x7ac2('0xc'));}function _0x2cf267(){try{logger[_0x7ac2('0xd')](_0x7ac2('0xe'));var _0x4dd57b=moment()[_0x7ac2('0xf')]();var _0xe39145=_0xd37491(_0x4dd57b+_0xd3e60+_0x35fda1);_0x4367c6[_0x7ac2('0x10')](JSON['stringify']({'appID':_0xd3e60,'timestamp':_0x4dd57b,'appKey':_0xe39145}));var _0x3e3546=fs[_0x7ac2('0x11')](_0x5e7bec);_0x3e3546['on'](_0x7ac2('0x12'),function(_0x236566){_0x4367c6[_0x7ac2('0x10')](_0x236566);});_0x3e3546['on']('close',function(){_0x4367c6[_0x7ac2('0x10')](_0x7ac2('0x13'));});}catch(_0x475556){logger[_0x7ac2('0x14')](_0x7ac2('0x15'),JSON[_0x7ac2('0x16')](_0x475556));_0x4367c6['terminate']();}}function _0x3ed71a(_0x3986a8){try{if(_0x3986a8){var _0x5bb4a5=JSON[_0x7ac2('0x17')](_0x3986a8);switch(_0x5bb4a5['status']){case 0x0:if(_0x5bb4a5[_0x7ac2('0x18')]){if(_0x5bb4a5['result']['final']){logger[_0x7ac2('0xd')](_0x7ac2('0x19'),JSON[_0x7ac2('0x16')](_0x5bb4a5[_0x7ac2('0x18')][_0x7ac2('0x1a')]));_0x90d1e1=_0x5bb4a5['result'][_0x7ac2('0x1a')][0x0][_0x7ac2('0x1b')];_0x4f66c2=_0x5bb4a5['result'][_0x7ac2('0x1a')][0x0][_0x7ac2('0x1c')];_0xb5e5bc='0';_0x30cca5=_0x7ac2('0x1d');_0x4367c6['terminate']();}}break;case 0x1:logger[_0x7ac2('0xd')](_0x7ac2('0x8'));_0xb5e5bc='1';_0x30cca5=_0x7ac2('0x8');break;case 0x2:logger[_0x7ac2('0xd')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xb5e5bc='2';_0x30cca5='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x7ac2('0xd')](_0x7ac2('0x1e'));_0xb5e5bc='9';_0x30cca5=_0x7ac2('0x1e');break;case 0xa:logger[_0x7ac2('0xd')](_0x7ac2('0x1f'));_0xb5e5bc='10';_0x30cca5=_0x7ac2('0x1f');break;case 0xb:logger[_0x7ac2('0xd')](_0x7ac2('0x20'));_0xb5e5bc='11';_0x30cca5=_0x7ac2('0x20');}}}catch(_0x5285a4){logger[_0x7ac2('0x14')](_0x7ac2('0x21'),JSON[_0x7ac2('0x16')](_0x5285a4));_0x4367c6[_0x7ac2('0x22')]();}}function _0x57d5b5(){logger[_0x7ac2('0xd')](_0x7ac2('0x23'));_0xead256({'transcript':_0x90d1e1,'confidence':_0x4f66c2,'status':_0xb5e5bc,'status_message':_0x30cca5});}function _0x5f46b(_0x230ca7){logger[_0x7ac2('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x7ac2('0x24')](_0x230ca7)){logger['error'](_[_0x7ac2('0x25')](_0x230ca7)?JSON[_0x7ac2('0x16')](_0x230ca7):_0x230ca7);}}_0x4367c6['on'](_0x7ac2('0x26'),_0x2cf267);_0x4367c6['on']('message',_0x3ed71a);_0x4367c6['on'](_0x7ac2('0x27'),_0x57d5b5);_0x4367c6['on']('error',_0x5f46b);});}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 7a5131a..3b4e5a1 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 _0x01a6=['connection','getConnections','error','E_AGI_SERVER_ERROR','destroy','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','./error','./channel','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x1d03f1,_0x7f2edf){var _0x40c77e=function(_0x2f1025){while(--_0x2f1025){_0x1d03f1['push'](_0x1d03f1['shift']());}};_0x40c77e(++_0x7f2edf);}(_0x01a6,0x83));var _0x601a=function(_0x74e929,_0x26b684){_0x74e929=_0x74e929-0x0;var _0x3f6ee3=_0x01a6[_0x74e929];return _0x3f6ee3;};'use strict';var util=require('util');var net=require(_0x601a('0x0'));var EventEmitter=require(_0x601a('0x1'))['EventEmitter'];var AGIError=require(_0x601a('0x2'));var AGIChannel=require(_0x601a('0x3'));var AGIServer=function(_0x310ed2,_0x25ffb0,_0x27defc){var _0x4cc5dd=this,_0x310ed2=_0x310ed2||0x11dd,_0x25ffb0=_0x25ffb0||'0.0.0.0',_0x133605=null,_0x240bbb=0x0;EventEmitter[_0x601a('0x4')](_0x4cc5dd);function _0x2ebaa9(){if(!_0x310ed2){_0x4cc5dd[_0x601a('0x5')]('error',new AGIError(_0x601a('0x6')));return![];}_0x133605=net[_0x601a('0x7')]();_0x133605[_0x601a('0x8')](_0x310ed2,_0x25ffb0);_0x133605['on']('listening',function(){_0x4cc5dd[_0x601a('0x5')]('listening');});_0x133605['on'](_0x601a('0x9'),function(_0x56496a){_0x133605[_0x601a('0xa')](function(_0x36f675,_0x4b1dc0){if(_0x36f675){_0x4cc5dd[_0x601a('0x5')](_0x601a('0xb'),new AGIError(_0x601a('0xc'),_0x36f675));}else if(_0x27defc&&_0x27defc<0x0){_0x4cc5dd['emit'](_0x601a('0xb'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x56496a['destroy']();}else if(_0x27defc&&_0x27defc>0x0&&_0x27defc<_0x4b1dc0){_0x240bbb+=0x1;_0x4cc5dd[_0x601a('0x5')](_0x601a('0xb'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x240bbb));_0x56496a[_0x601a('0xd')]();}else{var _0x4d2c30=new AGIChannel(_0x56496a);_0x4d2c30['on'](_0x601a('0xe'),function(){_0x4cc5dd[_0x601a('0x5')](_0x601a('0x9'),_0x4d2c30);});}});});_0x133605['on']('error',function(_0x3685e3){_0x4cc5dd['emit'](_0x601a('0xb'),new AGIError(_0x601a('0xc'),_0x3685e3['code']));});_0x133605['on'](_0x601a('0xf'),function(){_0x4cc5dd[_0x601a('0x5')](_0x601a('0xf'),new AGIError(_0x601a('0x10')));});}process[_0x601a('0x11')](function(){_0x2ebaa9();});};util[_0x601a('0x12')](AGIServer,EventEmitter);module[_0x601a('0x13')]=function(_0x427b3b,_0x2dbfa8,_0xf1eecb){return new AGIServer(_0x427b3b,_0x2dbfa8,_0xf1eecb);}; \ No newline at end of file +var _0xd6eb=['call','emit','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','./channel','0.0.0.0'];(function(_0x46345f,_0x45e74e){var _0x5ceac4=function(_0x491784){while(--_0x491784){_0x46345f['push'](_0x46345f['shift']());}};_0x5ceac4(++_0x45e74e);}(_0xd6eb,0x1f1));var _0xbd6e=function(_0x2103cc,_0x86e9c8){_0x2103cc=_0x2103cc-0x0;var _0x1b3ca8=_0xd6eb[_0x2103cc];return _0x1b3ca8;};'use strict';var util=require('util');var net=require(_0xbd6e('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0xbd6e('0x1'));var AGIServer=function(_0x5de04f,_0x48e85f,_0x47c3c4){var _0x3599e6=this,_0x5de04f=_0x5de04f||0x11dd,_0x48e85f=_0x48e85f||_0xbd6e('0x2'),_0x1db4b3=null,_0x32e77a=0x0;EventEmitter[_0xbd6e('0x3')](_0x3599e6);function _0x37f03a(){if(!_0x5de04f){_0x3599e6[_0xbd6e('0x4')]('error',new AGIError(_0xbd6e('0x5')));return![];}_0x1db4b3=net[_0xbd6e('0x6')]();_0x1db4b3['listen'](_0x5de04f,_0x48e85f);_0x1db4b3['on']('listening',function(){_0x3599e6[_0xbd6e('0x4')](_0xbd6e('0x7'));});_0x1db4b3['on'](_0xbd6e('0x8'),function(_0xe004a7){_0x1db4b3[_0xbd6e('0x9')](function(_0x15d3d8,_0x3a3d58){if(_0x15d3d8){_0x3599e6['emit'](_0xbd6e('0xa'),new AGIError(_0xbd6e('0xb'),_0x15d3d8));}else if(_0x47c3c4&&_0x47c3c4<0x0){_0x3599e6['emit'](_0xbd6e('0xa'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0xe004a7['destroy']();}else if(_0x47c3c4&&_0x47c3c4>0x0&&_0x47c3c4<_0x3a3d58){_0x32e77a+=0x1;_0x3599e6[_0xbd6e('0x4')](_0xbd6e('0xa'),new AGIError(_0xbd6e('0xc'),_0x32e77a));_0xe004a7[_0xbd6e('0xd')]();}else{var _0x3b7313=new AGIChannel(_0xe004a7);_0x3b7313['on'](_0xbd6e('0xe'),function(){_0x3599e6[_0xbd6e('0x4')](_0xbd6e('0x8'),_0x3b7313);});}});});_0x1db4b3['on'](_0xbd6e('0xa'),function(_0x1cc061){_0x3599e6[_0xbd6e('0x4')](_0xbd6e('0xa'),new AGIError(_0xbd6e('0xb'),_0x1cc061[_0xbd6e('0xf')]));});_0x1db4b3['on'](_0xbd6e('0x10'),function(){_0x3599e6[_0xbd6e('0x4')]('close',new AGIError(_0xbd6e('0x11')));});}process[_0xbd6e('0x12')](function(){_0x37f03a();});};util['inherits'](AGIServer,EventEmitter);module[_0xbd6e('0x13')]=function(_0x374345,_0x4ecde5,_0x5cb612){return new AGIServer(_0x374345,_0x4ecde5,_0x5cb612);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 64aef36..5a5705d 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 _0x9a72=['getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','channel','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','dnid','file','createCmContact','random','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPauseById','agentPause','isNil','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','trim','replace','google_tts_language','googleDialogflow','key','text','dialogflow_language','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','googleASR','google_asr_language','tildeASR','uri','clone','isString','replaceAllVariables','length','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','sync','retry','maxRetry','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','result','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','options','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','debug','sip_id','no\x20user\x20found','opts','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','hasOwnProperty','DIALOGFLOW_%s','toUpperCase','speech','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','variable_id','getData','response','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','%s.%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','stringify','gotoc','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','unlink','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','isArray','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','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','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','port','secure','authentication','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','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','exports','path','util','shelljs','odbc','randomstring','moment','mustache','agi','../../config/environment','./scripts','menu','getdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch'];(function(_0x21f7c2,_0x1b2426){var _0x3f3279=function(_0xaa480f){while(--_0xaa480f){_0x21f7c2['push'](_0x21f7c2['shift']());}};_0x3f3279(++_0x1b2426);}(_0x9a72,0x162));var _0x29a7=function(_0x15e2a3,_0x2c540c){_0x15e2a3=_0x15e2a3-0x0;var _0xfe1f98=_0x9a72[_0x15e2a3];return _0xfe1f98;};'use strict';var fs=require('fs');var path=require(_0x29a7('0x0'));var util=require(_0x29a7('0x1'));var _=require('lodash');var sh=require(_0x29a7('0x2'));var odbc=require(_0x29a7('0x3'))();var rs=require(_0x29a7('0x4'));var moment=require(_0x29a7('0x5'));var Mustache=require(_0x29a7('0x6'));var logger=require('../../config/logger')(_0x29a7('0x7'));var config=require(_0x29a7('0x8'));var scripts=require(_0x29a7('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var verticesWithRetry=[_0x29a7('0xa'),_0x29a7('0xb'),'getsecretdigits'];var AGIVertices=function(_0x35e9c1,_0x1dd3ad,_0x245cdf){this['channel']=_0x35e9c1;this[_0x29a7('0xc')]=_0x1dd3ad;this[_0x29a7('0xd')]=_0x245cdf;};AGIVertices[_0x29a7('0xe')][_0x29a7('0xf')]=function(_0x4703ec,_0x1667c0){this[_0x29a7('0xc')][_0x29a7('0x10')](_0x4703ec)[_0x29a7('0x11')](function(_0x266492){_0x1667c0(null,_0x266492?_0x266492[_0x29a7('0x12')]:![]);})[_0x29a7('0x13')](function(_0x37dbe9){_0x1667c0(_0x37dbe9);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x5cb8fa,_0x461699){this[_0x29a7('0xc')]['getVoiceQueueById'](_0x5cb8fa)['then'](function(_0x1f71ec){_0x461699(null,_0x1f71ec?_0x1f71ec[_0x29a7('0x12')]:![]);})[_0x29a7('0x13')](function(_0x53ec50){_0x461699(_0x53ec50);});};AGIVertices[_0x29a7('0xe')]['getSquareProject']=function(_0x996c50,_0xdf564a){this['rpc'][_0x29a7('0x14')](_0x996c50)[_0x29a7('0x11')](function(_0x5ee7d8){_0xdf564a(null,_0x5ee7d8?_0x5ee7d8[_0x29a7('0x12')]:![]);})[_0x29a7('0x13')](function(_0x391c4f){_0xdf564a(_0x391c4f);});};AGIVertices['prototype'][_0x29a7('0x15')]=function(_0x4852c5,_0x4d8cb1){this[_0x29a7('0xc')]['getSquareOdbcById'](_0x4852c5)['then'](function(_0x5432f7){_0x4d8cb1(null,_0x5432f7?_0x5432f7[_0x29a7('0x16')]:![]);})[_0x29a7('0x13')](function(_0x3e0c22){_0x4d8cb1(_0x3e0c22);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x17')]=function(_0x409303,_0x4ab505){this[_0x29a7('0xc')]['getUserById'](_0x409303)[_0x29a7('0x11')](function(_0x38705b){_0x4ab505(null,_0x38705b?_0x38705b[_0x29a7('0x12')]:![]);})[_0x29a7('0x13')](function(_0x3bf1d0){_0x4ab505(_0x3bf1d0);});};AGIVertices[_0x29a7('0xe')]['getTrunk']=function(_0x4fc97f,_0x37b018){this[_0x29a7('0xc')][_0x29a7('0x18')](_0x4fc97f)['then'](function(_0x2e4a1c){_0x37b018(null,_0x2e4a1c?_0x2e4a1c['name']:![]);})['catch'](function(_0x40b637){_0x37b018(_0x40b637);});};AGIVertices[_0x29a7('0xe')]['getSound']=function(_0x9edda6,_0x5226e9){var _0x118163=this;this[_0x29a7('0xc')][_0x29a7('0x19')](_0x9edda6)[_0x29a7('0x11')](function(_0x444f65){_0x5226e9(null,_0x444f65?_0x118163[_0x29a7('0x1a')](_0x444f65[_0x29a7('0x1b')]):![]);})[_0x29a7('0x13')](function(_0x23b4d4){_0x5226e9(_0x23b4d4);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x1c')]=function(_0x162a1c,_0x20d9c4){this[_0x29a7('0xc')]['getMailAccountById'](_0x162a1c)['then'](function(_0x3c8f48){_0x20d9c4(null,_0x3c8f48?_0x3c8f48:![]);})[_0x29a7('0x13')](function(_0x33be12){_0x20d9c4(_0x33be12);});};AGIVertices['prototype'][_0x29a7('0x1d')]=function(_0x3f6887,_0x5819a5,_0x331fad){this[_0x29a7('0xd')]['sendMailMessage'](_0x3f6887,_0x5819a5)['then'](function(){_0x331fad(null);})[_0x29a7('0x13')](function(_0x809164){_0x331fad(_0x809164);});};AGIVertices['prototype']['getIntervals']=function(_0x419393,_0x518803){this[_0x29a7('0xc')][_0x29a7('0x1e')](_0x419393)[_0x29a7('0x11')](function(_0x18b31b){if(_0x18b31b){if(_0x18b31b[_0x29a7('0x1f')]){_0x518803(null,[_0x18b31b[_0x29a7('0x20')]]);}else{_0x518803(null,_[_0x29a7('0x21')](_0x18b31b[_0x29a7('0x22')],_0x29a7('0x20')));}}else{_0x518803(null,![]);}})[_0x29a7('0x13')](function(_0x325099){_0x518803(_0x325099);});};AGIVertices['prototype'][_0x29a7('0x1a')]=function(_0xd57a92){return util[_0x29a7('0x23')](_0x29a7('0x24'),FILES_PATH,_0xd57a92);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x25')]=function(_0x188f0b,_0x5e6199,_0x25afbe){odbc[_0x29a7('0x26')](_0x188f0b,function(_0x2ad5d4){if(_0x2ad5d4){logger[_0x29a7('0x27')](_0x29a7('0x28'),_0x2ad5d4);_0x25afbe(_0x2ad5d4);}else{logger[_0x29a7('0x29')](_0x29a7('0x2a'));odbc[_0x29a7('0x2b')](_0x5e6199,function(_0x4213c7,_0x411cb9){if(_0x4213c7){logger[_0x29a7('0x29')](_0x29a7('0x2c'),_0x5e6199);_0x25afbe(_0x4213c7);}else{logger[_0x29a7('0x29')](_0x29a7('0x2d'),_0x5e6199);odbc['close'](function(_0x434f45){if(_0x434f45){logger[_0x29a7('0x27')](_0x29a7('0x2e'),_0x434f45);}_0x25afbe(null,_0x411cb9);});}});}});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x2f')]=function(_0x2f0ad5,_0x520de4){this[_0x29a7('0xc')][_0x29a7('0x30')](_0x2f0ad5)['then'](function(_0x58c6f1){_0x520de4(null,_0x58c6f1?_0x58c6f1:![]);})[_0x29a7('0x13')](function(_0x41b924){_0x520de4(_0x41b924);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x31')]=function(_0x58ed21,_0xa4038d){this[_0x29a7('0xc')][_0x29a7('0x31')](_0x58ed21)[_0x29a7('0x11')](function(_0x260e32){_0xa4038d(null,_0x260e32);})[_0x29a7('0x13')](function(_0x3c3fa6){_0xa4038d(_0x3c3fa6);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x32')]=function(_0x552a8e,_0x4946b6,_0x163f1a){this[_0x29a7('0xc')][_0x29a7('0x32')]({'uniqueid':this['channel']['uniqueid'],'node':_0x552a8e[_0x29a7('0x33')],'application':_0x552a8e[_0x29a7('0x34')],'data':_0x4946b6||null,'project_name':this[_0x29a7('0x35')][_0x29a7('0x36')],'callerid':this[_0x29a7('0x35')][_0x29a7('0x37')]})[_0x29a7('0x11')](function(_0x2882ae){_0x163f1a(null,_0x2882ae);})[_0x29a7('0x13')](function(_0x2dbc3a){_0x163f1a(_0x2dbc3a);});};AGIVertices['prototype'][_0x29a7('0x38')]=function(_0x320795,_0x434ac8,_0x5c105c,_0x7c48c1){this[_0x29a7('0xc')][_0x29a7('0x38')]({'uniqueid':this[_0x29a7('0x35')][_0x29a7('0x39')],'callerid':this[_0x29a7('0x35')]['callerid'],'calleridname':this[_0x29a7('0x35')][_0x29a7('0x3a')],'context':this[_0x29a7('0x35')][_0x29a7('0x3b')],'extension':this[_0x29a7('0x35')][_0x29a7('0x3c')],'priority':this[_0x29a7('0x35')][_0x29a7('0x3d')],'accountcode':this[_0x29a7('0x35')]['accountcode'],'dnid':this['channel'][_0x29a7('0x3e')],'projectName':this['channel'][_0x29a7('0x36')],'saveName':_0x434ac8,'filename':_0x320795[_0x29a7('0x3f')]||_0x434ac8,'savePath':_0x5c105c})[_0x29a7('0x11')](function(_0x53fb15){_0x7c48c1(null,_0x53fb15);})[_0x29a7('0x13')](function(_0x24309c){_0x7c48c1(_0x24309c);});};AGIVertices['prototype'][_0x29a7('0x40')]=function(_0x53028b,_0xbdbe7d){this[_0x29a7('0xc')][_0x29a7('0x40')]({'firstName':_['isEmpty'](_0x53028b[_0x29a7('0x12')])||_['isNil'](_0x53028b[_0x29a7('0x12')])?'callback_'+Math[_0x29a7('0x41')]():_0x53028b['name'],'lastName':_[_0x29a7('0x42')](_0x53028b[_0x29a7('0x43')])||_['isNil'](_0x53028b['lastName'])?null:_0x53028b[_0x29a7('0x43')],'phone':_0x53028b[_0x29a7('0x44')],'ListId':_0x53028b[_0x29a7('0x45')],'scheduledAt':_0x53028b['scheduledAt'],'callbackUniqueid':this[_0x29a7('0x35')][_0x29a7('0x39')],'tags':_0x29a7('0x46'),'description':_0x29a7('0x47')+_0x53028b[_0x29a7('0x48')][_0x29a7('0x49')](),'priority':_0x53028b[_0x29a7('0x4a')]})[_0x29a7('0x11')](function(_0x5ec5be){_0xbdbe7d(null,_0x5ec5be);})['catch'](function(_0x310587){_0xbdbe7d(_0x310587);});};AGIVertices['prototype']['getPause']=function(_0x283299,_0x1450ce){this[_0x29a7('0xc')][_0x29a7('0x4b')](_0x283299)[_0x29a7('0x11')](function(_0x5b3b55){_0x1450ce(null,_0x5b3b55?_0x5b3b55['name']:![]);})['catch'](function(_0x55eef8){_0x1450ce(_0x55eef8);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x4c')]=function(_0x365860,_0x56d738,_0x580818){var _0x58acb0={'role':'agent'};_0x58acb0[_0x365860]=this['channel'][_0x29a7('0x37')];this['rpc'][_0x29a7('0x4c')](_0x58acb0,_0x56d738,this[_0x29a7('0x35')][_0x29a7('0x39')])[_0x29a7('0x11')](function(_0x597ad8){_0x580818(null,_[_0x29a7('0x4d')](_0x597ad8)?![]:!![]);})[_0x29a7('0x13')](function(_0x350f79){logger[_0x29a7('0x27')](_0x350f79);_0x580818(null,![]);});};AGIVertices['prototype'][_0x29a7('0x4e')]=function(_0x327fa6,_0x448511){var _0x1dd0cc={'role':'agent'};_0x1dd0cc[_0x327fa6]=this[_0x29a7('0x35')][_0x29a7('0x37')];this[_0x29a7('0xc')]['agentUnpause'](_0x1dd0cc)[_0x29a7('0x11')](function(_0x4764e7){_0x448511(null,_[_0x29a7('0x4d')](_0x4764e7)?![]:!![]);})[_0x29a7('0x13')](function(_0x64e97f){logger[_0x29a7('0x27')](_0x64e97f);_0x448511(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x319690,_0x1f212e){var _0x7f42bb={'role':_0x29a7('0x4f')};_0x7f42bb[_0x319690]=this[_0x29a7('0x35')]['callerid'];this[_0x29a7('0xc')][_0x29a7('0x50')](_0x7f42bb)[_0x29a7('0x11')](function(_0x1d1427){_0x1f212e(null,_[_0x29a7('0x4d')](_0x1d1427)?![]:!![]);})[_0x29a7('0x13')](function(_0x1e3df5){logger['error'](_0x1e3df5);_0x1f212e(null,![]);});};AGIVertices['prototype'][_0x29a7('0x51')]=function(_0x4efe24,_0x5aa4d4){var _0x4eb7c3={'role':_0x29a7('0x4f')};_0x4eb7c3[_0x4efe24]=this[_0x29a7('0x35')][_0x29a7('0x37')];var _0x3f9b8a=_0x4efe24!=_0x29a7('0x52')?util[_0x29a7('0x23')](_0x29a7('0x53'),'LOCAL',this[_0x29a7('0x35')][_0x29a7('0x37')]):undefined;this[_0x29a7('0xc')][_0x29a7('0x51')](_0x4eb7c3,_0x3f9b8a)['then'](function(_0x61667c){_0x5aa4d4(null,_['isNil'](_0x61667c)?![]:!![]);})[_0x29a7('0x13')](function(_0x163cfa){logger[_0x29a7('0x27')](_0x163cfa);_0x5aa4d4(null,![]);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x54')]=function(_0x78cbe2,_0xcc6a26){sh['exec'](_[_0x29a7('0x55')](_0x78cbe2),function(_0x151c41,_0x5f3d01){var _0x42c70b=_0x5f3d01[_0x29a7('0x56')](/(\r\n|\n|\r)/gm,'');_0xcc6a26(null,_0x42c70b);});};AGIVertices[_0x29a7('0xe')]['googleTTS']=function(_0x492426,_0x184768){scripts['googleTTS'](_0x492426['text'],_0x492426[_0x29a7('0x57')]||'en',0x1)[_0x29a7('0x11')](function(_0x2aad2f){_0x184768(null,_0x2aad2f);})[_0x29a7('0x13')](function(_0x197641){_0x184768(_0x197641);});};AGIVertices['prototype'][_0x29a7('0x58')]=function(_0x2ffbdf,_0x157b85){scripts[_0x29a7('0x58')](this[_0x29a7('0x35')][_0x29a7('0x39')],_0x2ffbdf[_0x29a7('0x59')],_0x2ffbdf[_0x29a7('0x5a')],_0x2ffbdf[_0x29a7('0x5b')]||'en')[_0x29a7('0x11')](function(_0x16fdf4){_0x157b85(null,_0x16fdf4);})['catch'](function(_0x59d527){_0x157b85(_0x59d527);});};AGIVertices['prototype'][_0x29a7('0x5c')]=function(_0x3f2bfa,_0x378f98){scripts[_0x29a7('0x5c')](_0x3f2bfa[_0x29a7('0x59')],_0x3f2bfa[_0x29a7('0x5a')],_0x3f2bfa[_0x29a7('0x5d')]||_0x29a7('0x5e'),_0x3f2bfa['speed'])['then'](function(_0x41f902){_0x378f98(null,_0x41f902);})[_0x29a7('0x13')](function(_0x150bf8){_0x378f98(_0x150bf8);});};AGIVertices['prototype'][_0x29a7('0x5f')]=function(_0x350a43,_0x3ef4f9,_0xc958de){scripts[_0x29a7('0x5f')](_0x3ef4f9,_0x350a43[_0x29a7('0x59')],_0x350a43[_0x29a7('0x60')]||_0x29a7('0x5e'),this['isConfigured'](_0x350a43[_0x29a7('0x61')])?_0x350a43[_0x29a7('0x61')]:undefined)[_0x29a7('0x11')](function(_0x30b1cf){_0xc958de(null,_0x30b1cf);})[_0x29a7('0x13')](function(_0x5710ae){_0xc958de(_0x5710ae);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x62')]=function(_0x532f50,_0xe19b25){scripts[_0x29a7('0x62')](_0x532f50[_0x29a7('0x63')],_0x532f50[_0x29a7('0x64')],_0x532f50['aws_polly_region'],_0x532f50[_0x29a7('0x65')]||_0x29a7('0x66'),_0x532f50[_0x29a7('0x5a')],_0x532f50[_0x29a7('0x67')]||_0x29a7('0x5a'))[_0x29a7('0x11')](function(_0xe74b6){_0xe19b25(null,_0xe74b6);})[_0x29a7('0x13')](function(_0x1e8801){_0xe19b25(_0x1e8801);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x68')]=function(_0xeac67c,_0x4472dc,_0x3b69ed){scripts['googleASR'](_0x4472dc,_0xeac67c[_0x29a7('0x59')],_0xeac67c[_0x29a7('0x69')]||_0x29a7('0x5e'))[_0x29a7('0x11')](function(_0x45d27c){_0x3b69ed(null,_0x45d27c);})[_0x29a7('0x13')](function(_0xb5c011){_0x3b69ed(_0xb5c011);});};AGIVertices[_0x29a7('0xe')][_0x29a7('0x6a')]=function(_0x563571,_0x1758d2,_0x2872c3){scripts[_0x29a7('0x6a')](_0x1758d2,_0x563571['appid'],_0x563571['appsecret'],_0x563571[_0x29a7('0x6b')])[_0x29a7('0x11')](function(_0x2d05d8){_0x2872c3(null,_0x2d05d8);})[_0x29a7('0x13')](function(_0x58223f){_0x2872c3(_0x58223f);});};AGIVertices[_0x29a7('0xe')]['clear']=function(_0x58d8fd){var _0x59aa45=_['includes'](verticesWithRetry,_0x58d8fd[_0x29a7('0x34')])?_0x58d8fd:_[_0x29a7('0x6c')](_0x58d8fd);for(var _0x4e235e in _0x59aa45){if(_0x59aa45['hasOwnProperty'](_0x4e235e)){if(_0x59aa45[_0x4e235e]&&_[_0x29a7('0x6d')](_0x59aa45[_0x4e235e])){_0x59aa45[_0x4e235e]=this[_0x29a7('0x6e')](_0x59aa45[_0x4e235e]);}}}return _0x59aa45;};AGIVertices[_0x29a7('0xe')][_0x29a7('0x6e')]=function(_0x4dd1b1){var _0x2cefd8=_0x4dd1b1['split']('{');for(var _0x5ec684=0x1;_0x5ec684<_0x2cefd8[_0x29a7('0x6f')];_0x5ec684+=0x1){var _0x3fffaa=_0x2cefd8[_0x5ec684]['split']('}');if(_0x3fffaa[_0x29a7('0x6f')]>0x1){_0x4dd1b1=_0x4dd1b1[_0x29a7('0x70')]('{'+_0x3fffaa[0x0]+'}',this[_0x29a7('0x35')][_0x29a7('0xf')](_0x3fffaa[0x0])[_0x29a7('0x71')]||_0x3fffaa[0x0]);}}if(_0x2cefd8[_0x29a7('0x6f')]===0x1){return _0x4dd1b1[_0x29a7('0x49')]();}return this[_0x29a7('0x6e')](_0x4dd1b1);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x72')]=function(_0x35ea8e,_0x9a7c6a){var _0x105d0b=this['channel'][_0x29a7('0xf')](_0x35ea8e);if(_0x105d0b['result']===-0x1){return _0x105d0b;}logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x73'),_0x9a7c6a,_0x105d0b[_0x29a7('0x71')]));return this['channel'][_0x29a7('0x74')](_0x9a7c6a,_0x105d0b[_0x29a7('0x71')]);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x75')]=function(_0x54f3bd){return _0x54f3bd&&_0x54f3bd!=='0'&&_0x54f3bd!=='-1'&&_0x54f3bd!=='';};AGIVertices[_0x29a7('0xe')]['maxRetry']=function(_0x39b15a){this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x39b15a,'-');_0x39b15a[_0x29a7('0x77')]=_0x39b15a[_0x29a7('0x78')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x29a7('0xe')][_0x29a7('0x7')]=function(_0x1df434){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x79'),_0x1df434[_0x29a7('0x33')]));return this['channel'][_0x29a7('0x7')]([_0x1df434[_0x29a7('0x7a')],_0x1df434[_0x29a7('0x7b')]]);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x7c')]=function(_0x511ae9){logger['info'](util[_0x29a7('0x23')](_0x29a7('0x7d'),_0x511ae9[_0x29a7('0x33')]));if(this['isConfigured'](_0x511ae9[_0x29a7('0x7e')])){logger[_0x29a7('0x29')](util['format'](_0x29a7('0x7f'),_0x511ae9[_0x29a7('0x7e')]));var _0x23fc96=this[_0x29a7('0x35')][_0x29a7('0x80')](_0x511ae9[_0x29a7('0x7e')]);if(_0x23fc96[_0x29a7('0x81')]===-0x1){return _0x23fc96;}}return this[_0x29a7('0x35')]['answer']();};AGIVertices[_0x29a7('0xe')]['callback']=function(_0x343e3b){logger['info'](util[_0x29a7('0x23')](_0x29a7('0x82'),_0x343e3b[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x343e3b[_0x29a7('0x45')])){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x343e3b,_0x29a7('0x83'));}_0x343e3b[_0x29a7('0x48')]=moment();if(this[_0x29a7('0x75')](_0x343e3b[_0x29a7('0x84')])){_0x343e3b[_0x29a7('0x48')]=moment()['add'](_0x343e3b[_0x29a7('0x84')],_0x29a7('0x85'));}if(!this[_0x29a7('0x75')](_0x343e3b['callback_priority'])){_0x343e3b[_0x29a7('0x4a')]=0x2;}this[_0x29a7('0x40')][_0x29a7('0x76')](this,_0x343e3b);return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x87'),_0x343e3b[_0x29a7('0x44')],_0x343e3b[_0x29a7('0x45')],_0x343e3b[_0x29a7('0x48')]));};AGIVertices[_0x29a7('0xe')][_0x29a7('0x88')]=function(_0x22e3ea){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x89'),_0x22e3ea[_0x29a7('0x33')]));var _0x580601=this[_0x29a7('0x35')]['exec'](_0x22e3ea[_0x29a7('0x8a')],_0x22e3ea[_0x29a7('0x8b')]);if(_0x580601[_0x29a7('0x81')]===-0x1){return _0x580601;}return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x8c'),_0x22e3ea[_0x29a7('0x8a')],_0x22e3ea['options']));};AGIVertices[_0x29a7('0xe')]['lumenvoxtts']=function(_0x43ce0e){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x8d'),_0x43ce0e[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x43ce0e['text'])){return this[_0x29a7('0x35')]['noop']('no\x20text\x20configured');}var _0x3b7645='\x22'+_0x43ce0e[_0x29a7('0x5a')]+'\x22';if(this['isConfigured'](_0x43ce0e[_0x29a7('0x8b')])){_0x3b7645+=','+_0x43ce0e[_0x29a7('0x8b')];}var _0x458c5e=this[_0x29a7('0x35')][_0x29a7('0x8e')](_0x29a7('0x8f'),_0x3b7645);if(_0x458c5e[_0x29a7('0x81')]===-0x1){return _0x458c5e;}return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x90'),_0x3b7645));};AGIVertices[_0x29a7('0xe')][_0x29a7('0x91')]=function(_0x38f9cb){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x92'),_0x38f9cb[_0x29a7('0x33')]));if(!this['isConfigured'](_0x38f9cb['grammar'])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0x93'));}var _0x5ec9f0=_0x38f9cb['grammar'];if(this['isConfigured'](_0x38f9cb[_0x29a7('0x8b')])){_0x5ec9f0+=','+_0x38f9cb[_0x29a7('0x8b')];}var _0x44f967=this[_0x29a7('0x35')][_0x29a7('0x8e')]('MRCPRecog',_0x5ec9f0);if(_0x44f967[_0x29a7('0x81')]===-0x1){return _0x44f967;}var _0x4855e8=this[_0x29a7('0x72')]('RECOG_CONFIDENCE()',_0x29a7('0x94'));if(_0x4855e8[_0x29a7('0x81')]===-0x1){return _0x4855e8;}var _0x1838a8=this['getAndSetVariable']('RECOG_INPUT()',_0x29a7('0x95'));if(_0x1838a8[_0x29a7('0x81')]===-0x1){return _0x1838a8;}var _0x2ac28f=this['getAndSetVariable'](_0x29a7('0x96'),_0x29a7('0x97'));if(_0x2ac28f[_0x29a7('0x81')]===-0x1){return _0x2ac28f;}return this['channel']['noop'](util[_0x29a7('0x23')](_0x29a7('0x98'),_0x5ec9f0));};AGIVertices[_0x29a7('0xe')][_0x29a7('0x99')]=function(_0x26f0c1){logger['info'](util['format'](_0x29a7('0x9a'),_0x26f0c1[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x26f0c1[_0x29a7('0x9b')])){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x26f0c1,_0x29a7('0x9c'));}var _0x2f9ff7=this[_0x29a7('0x15')][_0x29a7('0x76')](this,_0x26f0c1[_0x29a7('0x9b')]);if(!_0x2f9ff7){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x26f0c1,_0x29a7('0x9d'));}if(!this['isConfigured'](_0x26f0c1[_0x29a7('0x2b')])){return this[_0x29a7('0x35')]['error'](_0x26f0c1,_0x29a7('0x9e'));}var _0x4adde5=_0x26f0c1[_0x29a7('0x2b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x9f'),_0x4adde5));var _0xb61c4a=this['getQueryOdbc']['sync'](this,_0x2f9ff7,_0x4adde5);this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x26f0c1,_0x4adde5);if(!this[_0x29a7('0x75')](_0x26f0c1['variable_id'])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0xa0'));}var _0x1b47e3=this[_0x29a7('0xf')][_0x29a7('0x76')](this,_0x26f0c1['variable_id']);if(!_0x1b47e3){return this[_0x29a7('0x35')]['error'](_0x26f0c1,_0x29a7('0xa1'));}var _0x46eb48=this;_0xb61c4a[_0x29a7('0xa2')](function(_0x1d8d31,_0x29de5a){Object[_0x29a7('0xa3')](_0x1d8d31)['forEach'](function(_0x9a8503){_0x46eb48[_0x29a7('0x35')][_0x29a7('0x74')](util[_0x29a7('0x23')](_0x29a7('0xa4'),_0x1b47e3,_0x29de5a,_0x9a8503),_0x1d8d31[_0x9a8503]);});});this['channel']['setVariable'](util[_0x29a7('0x23')]('%s_ROWS_COUNT',_0x1b47e3),_0xb61c4a[_0x29a7('0x6f')]);return this['channel'][_0x29a7('0x86')](util['format']('variable\x20%s\x20set',_0x1b47e3));};AGIVertices['prototype'][_0x29a7('0xa5')]=function(_0x2c1a15){logger[_0x29a7('0xa6')](util[_0x29a7('0x23')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2c1a15[_0x29a7('0x33')]));if(!this['isConfigured'](_0x2c1a15[_0x29a7('0xa7')])){return this['channel'][_0x29a7('0x27')](_0x2c1a15,'no\x20user\x20selected');}var _0x3e5a60=this[_0x29a7('0x17')][_0x29a7('0x76')](this,_0x2c1a15['sip_id']);if(!_0x3e5a60){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x2c1a15,_0x29a7('0xa8'));}var _0x51bede=this[_0x29a7('0x35')][_0x29a7('0x8e')]('DIAL',[util['format']('SIP/%s',_0x3e5a60),_0x2c1a15['timeout'],_0x2c1a15[_0x29a7('0xa9')],_0x2c1a15[_0x29a7('0xaa')]]);if(_0x51bede[_0x29a7('0x81')]===-0x1){return _0x51bede;}return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xab'),'DIAL'));};AGIVertices[_0x29a7('0xe')][_0x29a7('0xac')]=function(_0x1472ed){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0xad'),_0x1472ed[_0x29a7('0x33')]));if(!this['isConfigured'](_0x1472ed[_0x29a7('0x59')])){return this[_0x29a7('0x35')]['noop'](_0x29a7('0xae'));}if(!this[_0x29a7('0x75')](_0x1472ed[_0x29a7('0x5a')])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0xaf'));}this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')]('Trying\x20Dialogflow:\x20%s',_0x1472ed['text']));var _0x23f723=this[_0x29a7('0x58')][_0x29a7('0x76')](this,_0x1472ed);if(_0x23f723){for(var _0x1936f1 in _0x23f723){if(_0x23f723[_0x29a7('0xb0')](_0x1936f1)){this[_0x29a7('0x35')][_0x29a7('0x74')](util['format'](_0x29a7('0xb1'),_0x1936f1[_0x29a7('0xb2')]()),_0x23f723[_0x1936f1]);}}return this[_0x29a7('0x35')]['noop'](util[_0x29a7('0x23')]('Dialogflow\x20Result\x20%s',_0x23f723[_0x29a7('0xb3')]));}return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x1472ed,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x29a7('0xe')][_0x29a7('0xb4')]=function(_0x158893){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('Enter\x20in\x20END\x20(%s)\x20block',_0x158893[_0x29a7('0x33')]));return this[_0x29a7('0x35')][_0x29a7('0x86')]('end');};AGIVertices[_0x29a7('0xe')][_0x29a7('0xb5')]=function(_0x17b5fc){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x17b5fc[_0x29a7('0x33')]));var _0x5d954d='';if(_0x17b5fc[_0x29a7('0xb6')]){if(!this['isConfigured'](_0x17b5fc[_0x29a7('0xb6')])){return this[_0x29a7('0x35')]['error'](_0x17b5fc,_0x29a7('0xb7'));}else{var _0x12e058=parseInt(_0x17b5fc[_0x29a7('0xb6')],0xa);if(isNaN(_0x12e058)){_0x5d954d=_0x17b5fc['trunk_id'];}else{_0x5d954d=this['getTrunk']['sync'](this,_0x17b5fc[_0x29a7('0xb6')]);if(!_0x5d954d){return this[_0x29a7('0x35')]['error'](_0x17b5fc,_0x29a7('0xb8'));}}}}else if(_0x17b5fc['trunk_name']){_0x5d954d=_0x17b5fc[_0x29a7('0xb9')];}else{return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x17b5fc,'no\x20trunk\x20selected');}var _0x47a5c8=this['channel']['exec'](_0x29a7('0xba'),[util[_0x29a7('0x23')](_0x29a7('0xbb'),_0x5d954d,_0x17b5fc[_0x29a7('0x44')]),_0x17b5fc[_0x29a7('0x7e')],_0x17b5fc[_0x29a7('0xa9')],_0x17b5fc[_0x29a7('0xaa')]]);if(_0x47a5c8[_0x29a7('0x81')]===-0x1){return _0x47a5c8;}return this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xab'),_0x29a7('0xba')));};AGIVertices[_0x29a7('0xe')][_0x29a7('0xbc')]=function(_0x239add){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0xbd'),_0x239add[_0x29a7('0x33')]));return this[_0x29a7('0x35')][_0x29a7('0x86')]('finally');};AGIVertices[_0x29a7('0xe')][_0x29a7('0xb')]=function(_0x519d60){logger['info'](util[_0x29a7('0x23')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x519d60[_0x29a7('0x33')]));if(_0x519d60[_0x29a7('0x77')]===0x0){return this[_0x29a7('0x78')](_0x519d60);}_0x519d60[_0x29a7('0x77')]-=0x1;if(!this[_0x29a7('0x75')](_0x519d60['file_id'])){return this['channel'][_0x29a7('0x27')](_0x519d60,_0x29a7('0xbe'));}var _0x4b875c=this['getSound'][_0x29a7('0x76')](this,_0x519d60[_0x29a7('0xbf')]);if(!_0x4b875c){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x519d60,'no\x20file\x20audio\x20found');}if(!this[_0x29a7('0x75')](_0x519d60[_0x29a7('0xc0')])){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x29a7('0xa0'));}var _0x52062c=this[_0x29a7('0x35')][_0x29a7('0xc1')](_0x4b875c,_0x519d60[_0x29a7('0xc2')],_0x519d60[_0x29a7('0xc3')]);var _0x2a1b0f=_0x52062c[_0x29a7('0x81')]?_0x52062c[_0x29a7('0x81')][_0x29a7('0x49')]():'';logger[_0x29a7('0x29')]('test',JSON['stringify'](_0x52062c));if(_0x52062c[_0x29a7('0x81')]===-0x1){this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x519d60,_0x2a1b0f);return _0x52062c;}else if(_0x52062c[_0x29a7('0x71')]===_0x29a7('0x7e')){_0x52062c[_0x29a7('0x81')]=_0x2a1b0f['length']>=parseInt(_0x519d60[_0x29a7('0xc4')])?'x':'i';}else{_0x52062c['result']=_0x2a1b0f[_0x29a7('0x6f')]>=parseInt(_0x519d60['mindigit'])&&_0x2a1b0f['length']<=parseInt(_0x519d60[_0x29a7('0xc3')])?'x':'i';}var _0x45af48=this[_0x29a7('0xf')][_0x29a7('0x76')](this,_0x519d60['variable_id']);if(!_0x45af48){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x519d60,_0x29a7('0xa1'));}this[_0x29a7('0x35')][_0x29a7('0x74')](_0x45af48,_0x2a1b0f);if(this[_0x29a7('0x75')](_0x519d60[_0x29a7('0xc5')])){var _0x17e9c7=parseInt(_0x519d60[_0x29a7('0xc5')],0xa);var _0x409b92=rs['generate']({'charset':'*','length':_0x17e9c7});var _0x5f162c=_0x2a1b0f['length'];if(_0x5f162c>0x0){if(_0x5f162c>_0x17e9c7){this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x519d60,_0x519d60[_0x29a7('0xc6')]==='first'?_0x409b92+_0x2a1b0f[_0x29a7('0xc7')](_0x17e9c7):_0x2a1b0f[_0x29a7('0xc7')](0x0,_0x5f162c-_0x17e9c7)+_0x409b92);}else{this[_0x29a7('0x32')]['sync'](this,_0x519d60,rs[_0x29a7('0xc8')]({'charset':'*','length':_0x5f162c}));}}else{this[_0x29a7('0x32')]['sync'](this,_0x519d60,'');}}else{this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x519d60,_0x2a1b0f);}return _0x52062c;};AGIVertices[_0x29a7('0xe')][_0x29a7('0xc9')]=function(_0x5ca1a3){logger['info'](util[_0x29a7('0x23')](_0x29a7('0xca'),_0x5ca1a3[_0x29a7('0x33')]));return this[_0x29a7('0xb')](_0x5ca1a3);};AGIVertices[_0x29a7('0xe')][_0x29a7('0xcb')]=function(_0x379276){logger[_0x29a7('0x29')](util['format'](_0x29a7('0xcc'),_0x379276[_0x29a7('0x33')]));this['createSquareDetailsReport'][_0x29a7('0x76')](this,_0x379276,_0x379276[_0x29a7('0xcd')]);return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xce'),_0x379276[_0x29a7('0xcd')]));};AGIVertices[_0x29a7('0xe')][_0x29a7('0xcf')]=function(_0x3017c9){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3017c9[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x3017c9[_0x29a7('0x63')])||!this[_0x29a7('0x75')](_0x3017c9[_0x29a7('0x64')])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0xd0'));}if(!this[_0x29a7('0x75')](_0x3017c9[_0x29a7('0x5a')])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0xaf'));}this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xd1'),_0x3017c9[_0x29a7('0x5a')]));var _0x4e7b22=this[_0x29a7('0x62')][_0x29a7('0x76')](this,_0x3017c9);if(_0x4e7b22){this[_0x29a7('0x35')]['noop'](util['format'](_0x29a7('0xd2'),_0x4e7b22));var _0x2872fc=this['channel']['streamFile'](_0x4e7b22);try{fs['unlink'](_0x4e7b22+_0x29a7('0xd3'));}catch(_0x1fddeb){logger['error'](_0x1fddeb);}return _0x2872fc;}return this[_0x29a7('0x35')]['error'](_0x3017c9,_0x29a7('0xd4'));};AGIVertices['prototype'][_0x29a7('0xd5')]=function(_0x2b956a){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2b956a[_0x29a7('0x33')],_0x2b956a[_0x29a7('0x7e')]));if(!this[_0x29a7('0x75')](_0x2b956a[_0x29a7('0x59')])){return this['channel'][_0x29a7('0x86')]('no\x20key\x20configured');}var _0x2051e2=_0x29a7('0xd6');var _0x506d75=util[_0x29a7('0x23')](_0x29a7('0xd7'),FILES_PATH,rs[_0x29a7('0xc8')](0x4));var _0x5bf870=util['format'](_0x29a7('0xd8'),_0x506d75,_0x2051e2);var _0x2e5946=!![];if(_0x2b956a[_0x29a7('0xd9')]===_0x29a7('0xda')){_0x2e5946=![];}var _0x4ba406=this[_0x29a7('0x35')][_0x29a7('0xdb')](_0x506d75,_0x2051e2,_0x2b956a[_0x29a7('0xdc')],_0x2b956a[_0x29a7('0x7e')],undefined,_0x2e5946);if(_0x4ba406[_0x29a7('0x81')]!==-0x1){this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xdd'),_0x5bf870));var _0x10abbb=this[_0x29a7('0x68')][_0x29a7('0x76')](this,_0x2b956a,_0x5bf870);if(_0x10abbb){for(var _0x93ae3e in _0x10abbb){if(_0x10abbb[_0x29a7('0xb0')](_0x93ae3e)){this[_0x29a7('0x35')][_0x29a7('0x74')](util[_0x29a7('0x23')](_0x29a7('0xde'),_0x93ae3e[_0x29a7('0xb2')]()),_0x10abbb[_0x93ae3e]);}}return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xdf'),JSON['stringify'](_0x10abbb)));}}return _0x4ba406;};AGIVertices[_0x29a7('0xe')]['tildeasr']=function(_0x4880f6){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4880f6['label']));if(!this[_0x29a7('0x75')](_0x4880f6['appid'])){return this['channel'][_0x29a7('0x86')](_0x29a7('0xe0'));}if(!this[_0x29a7('0x75')](_0x4880f6[_0x29a7('0xe1')])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0xe2'));}var _0x24d57a=_0x29a7('0xd6');var _0x155db0=util[_0x29a7('0x23')]('%s/recordings/%s',FILES_PATH,rs[_0x29a7('0xc8')](0x4));var _0x1677a0=util[_0x29a7('0x23')](_0x29a7('0xd8'),_0x155db0,_0x24d57a);var _0xbd5568=!![];if(_0x4880f6[_0x29a7('0xd9')]===_0x29a7('0xda')){_0xbd5568=![];}var _0x50538b=this[_0x29a7('0x35')][_0x29a7('0xdb')](_0x155db0,_0x24d57a,_0x4880f6[_0x29a7('0xdc')],_0x4880f6[_0x29a7('0x7e')],undefined,_0xbd5568);if(_0x50538b[_0x29a7('0x81')]!==-0x1){this[_0x29a7('0x35')]['noop'](util['format'](_0x29a7('0xe3'),_0x1677a0));var _0x439a0d=this['tildeASR'][_0x29a7('0x76')](this,_0x4880f6,_0x1677a0);if(_0x439a0d){for(var _0x128c26 in _0x439a0d){if(_0x439a0d[_0x29a7('0xb0')](_0x128c26)){this[_0x29a7('0x35')][_0x29a7('0x74')](util[_0x29a7('0x23')]('TILDE_ASR_%s',_0x128c26[_0x29a7('0xb2')]()),_0x439a0d[_0x128c26]);}}return this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xe4'),JSON[_0x29a7('0xe5')](_0x439a0d)));}}return _0x50538b;};AGIVertices[_0x29a7('0xe')][_0x29a7('0xe6')]=function(_0x1fa539){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1fa539[_0x29a7('0x33')]));return this[_0x29a7('0x35')][_0x29a7('0xe7')](_0x1fa539[_0x29a7('0x3b')],_0x1fa539[_0x29a7('0x3c')],_0x1fa539[_0x29a7('0x3d')]);};AGIVertices['prototype'][_0x29a7('0xe8')]=function(_0xb4f7b1){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xb4f7b1['label']));if(!this[_0x29a7('0x75')](_0xb4f7b1[_0x29a7('0xe9')])){return this[_0x29a7('0x35')]['error'](_0xb4f7b1,_0x29a7('0xea'));}try{var _0x3fc9b2=eval(_0xb4f7b1[_0x29a7('0xe9')])?_0x29a7('0xeb'):'false';this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')]('EVAL\x20CONDITION\x20%s\x20%s',_0xb4f7b1[_0x29a7('0xe9')],_0x3fc9b2));return{'code':0xc8,'result':_0x3fc9b2};}catch(_0x48d331){return{'code':0xc8,'result':_0x29a7('0xec')};}};AGIVertices[_0x29a7('0xe')][_0x29a7('0xed')]=function(_0x17ab3f){logger[_0x29a7('0x29')](util['format'](_0x29a7('0xee'),_0x17ab3f[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x17ab3f[_0x29a7('0xef')])){return this[_0x29a7('0x35')]['error'](_0x17ab3f,_0x29a7('0xf0'));}var _0x5e0224=this['getIntervals'][_0x29a7('0x76')](this,_0x17ab3f[_0x29a7('0xef')]);if(!_0x5e0224){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x17ab3f,_0x29a7('0xf1'));}for(var _0x363634=0x0;_0x363634<_0x5e0224[_0x29a7('0x6f')];_0x363634+=0x1){var _0x5e4d49=this[_0x29a7('0x35')]['getVariable'](util[_0x29a7('0x23')]('IFTIME(%s?true:false)',_0x5e0224[_0x363634]));if(_0x5e4d49[_0x29a7('0x81')]===-0x1){return _0x5e4d49;}logger[_0x29a7('0x29')](util['format'](_0x29a7('0xf2'),_0x5e0224[_0x363634],_0x5e4d49[_0x29a7('0x71')]));if(_0x5e4d49[_0x29a7('0x71')]===_0x29a7('0xeb')){logger['info'](util[_0x29a7('0x23')]('IFTIME\x20%s\x20%s',_0x5e0224[_0x363634],_0x29a7('0xeb')));this[_0x29a7('0x35')]['noop'](util[_0x29a7('0x23')](_0x29a7('0xf2'),_0x5e0224[_0x363634],'true'));return{'code':0xc8,'result':_0x29a7('0xeb')};}else{logger[_0x29a7('0x29')](util['format'](_0x29a7('0xf2'),_0x5e0224[_0x363634],'false'));this[_0x29a7('0x35')][_0x29a7('0x86')](util['format'](_0x29a7('0xf2'),_0x5e0224[_0x363634],_0x29a7('0xec')));}}return{'code':0xc8,'result':_0x29a7('0xec')};};AGIVertices['prototype'][_0x29a7('0xf3')]=function(_0x4fde83){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0xf4'),_0x4fde83['label']));return this[_0x29a7('0x35')]['hangup']();};AGIVertices[_0x29a7('0xe')]['ispeechasr']=function(_0x221f8e){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0xf5'),_0x221f8e['label']));if(!this['isConfigured'](_0x221f8e['key'])){return this[_0x29a7('0x35')]['noop']('no\x20key\x20configured');}var _0x4c6476=_0x29a7('0xd6');var _0x1e5cf6=util[_0x29a7('0x23')](_0x29a7('0xd7'),FILES_PATH,rs[_0x29a7('0xc8')](0x4));var _0x48b6c8=util[_0x29a7('0x23')](_0x29a7('0xd8'),_0x1e5cf6,_0x4c6476);var _0x358f40=!![];if(_0x221f8e[_0x29a7('0xd9')]===_0x29a7('0xda')){_0x358f40=![];}var _0x2c5b9d=this[_0x29a7('0x35')][_0x29a7('0xdb')](_0x1e5cf6,_0x4c6476,_0x221f8e[_0x29a7('0xdc')],_0x221f8e[_0x29a7('0x7e')],undefined,_0x358f40);if(_0x2c5b9d[_0x29a7('0x81')]!==-0x1){this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xf6'),_0x48b6c8));var _0x3e366b=this[_0x29a7('0x5f')]['sync'](this,_0x221f8e,_0x48b6c8);if(_0x3e366b){for(var _0x53b1bf in _0x3e366b){if(_0x3e366b[_0x29a7('0xb0')](_0x53b1bf)){this[_0x29a7('0x35')][_0x29a7('0x74')](util['format']('ISPEECH_ASR_%s',_0x53b1bf[_0x29a7('0xb2')]()),_0x3e366b[_0x53b1bf]);}}return this[_0x29a7('0x35')]['noop'](util[_0x29a7('0x23')]('IspeechASR\x20Result\x20%s',JSON[_0x29a7('0xe5')](_0x3e366b)));}}return _0x2c5b9d;};AGIVertices[_0x29a7('0xe')][_0x29a7('0xf7')]=function(_0x48f049){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0xf8'),_0x48f049[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x48f049[_0x29a7('0x59')])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0xae'));}if(!this['isConfigured'](_0x48f049[_0x29a7('0x5a')])){return this[_0x29a7('0x35')]['noop'](_0x29a7('0xaf'));}this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xf9'),_0x48f049['text']));var _0xe6fc78=this[_0x29a7('0x5c')]['sync'](this,_0x48f049);if(_0xe6fc78){this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0xf6'),_0xe6fc78));var _0xc21a69=this[_0x29a7('0x35')][_0x29a7('0xfa')](_0xe6fc78,_0x48f049[_0x29a7('0xdc')]);try{fs[_0x29a7('0xfb')](_0xe6fc78+_0x29a7('0xd3'));}catch(_0x7ee977){logger[_0x29a7('0x27')](_0x7ee977);}return _0xc21a69;}return this[_0x29a7('0x35')]['error'](_0x48f049,_0x29a7('0xfc'));};AGIVertices[_0x29a7('0xe')][_0x29a7('0xfd')]=function(_0x2c7e05){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2c7e05[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x2c7e05[_0x29a7('0xfe')])){return this[_0x29a7('0x35')]['error'](_0x2c7e05,_0x29a7('0xff'));}logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x100'),this[_0x29a7('0x35')]['callerid'],_0x2c7e05[_0x29a7('0xfe')]));var _0x1e33fe=this[_0x29a7('0x51')][_0x29a7('0x76')](this,_0x2c7e05[_0x29a7('0xfe')]);if(_0x1e33fe){logger[_0x29a7('0x29')](util['format'](_0x29a7('0x101'),this[_0x29a7('0x35')][_0x29a7('0x37')],_0x2c7e05[_0x29a7('0xfe')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x29a7('0x35')]['callerid'],_0x2c7e05[_0x29a7('0xfe')]));return{'code':0xc8,'result':_0x29a7('0x102')};}else{logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x103'),this[_0x29a7('0x35')][_0x29a7('0x37')],_0x2c7e05[_0x29a7('0xfe')]));this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x29a7('0x35')][_0x29a7('0x37')],_0x2c7e05[_0x29a7('0xfe')]));return{'code':0xc8,'result':_0x29a7('0x104')};}};AGIVertices[_0x29a7('0xe')][_0x29a7('0x105')]=function(_0x2765d7){logger['info'](util[_0x29a7('0x23')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x2765d7[_0x29a7('0x33')]));if(!this['isConfigured'](_0x2765d7[_0x29a7('0xfe')])){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x2765d7,_0x29a7('0xff'));}logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x100'),this[_0x29a7('0x35')][_0x29a7('0x37')],_0x2765d7[_0x29a7('0xfe')]));var _0x55aa3b=this[_0x29a7('0x50')]['sync'](this,_0x2765d7[_0x29a7('0xfe')]);if(_0x55aa3b){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x29a7('0x35')][_0x29a7('0x37')],_0x2765d7[_0x29a7('0xfe')]));this[_0x29a7('0x35')][_0x29a7('0x86')](util['format'](_0x29a7('0x101'),this[_0x29a7('0x35')][_0x29a7('0x37')],_0x2765d7[_0x29a7('0xfe')]));return{'code':0xc8,'result':'success'};}else{logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x29a7('0x35')]['callerid'],_0x2765d7[_0x29a7('0xfe')]));this['channel'][_0x29a7('0x86')](util['format'](_0x29a7('0x103'),this[_0x29a7('0x35')][_0x29a7('0x37')],_0x2765d7[_0x29a7('0xfe')]));return{'code':0xc8,'result':_0x29a7('0x104')};}};AGIVertices[_0x29a7('0xe')]['math']=function(_0x2f5534){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x106'),_0x2f5534[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x2f5534[_0x29a7('0x107')])){return this[_0x29a7('0x35')]['error'](_0x2f5534,_0x29a7('0x108'));}this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')]('math\x20%s',_0x2f5534[_0x29a7('0x107')]));var _0x3a5b03=eval(_0x2f5534[_0x29a7('0x107')]);if(!this[_0x29a7('0x75')](_0x2f5534[_0x29a7('0xc0')])){return this[_0x29a7('0x35')]['noop'](_0x29a7('0xa0'));}var _0x3f2b13=this['getVariable'][_0x29a7('0x76')](this,_0x2f5534[_0x29a7('0xc0')]);if(!_0x3f2b13){return this['channel'][_0x29a7('0x27')](_0x2f5534,'no\x20variable\x20found');}if(_[_0x29a7('0x109')](_0x3a5b03)){var _0x210fe0=this;_0x3a5b03['forEach'](function(_0x21e872,_0x189bbd){_0x210fe0['channel']['setVariable'](util[_0x29a7('0x23')]('%s[%s]',_0x3f2b13,_0x189bbd),_0x21e872);});return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x10a'),_0x3f2b13));}else{return this['channel'][_0x29a7('0x74')](_0x3f2b13,_0x3a5b03);}};AGIVertices[_0x29a7('0xe')]['menu']=function(_0x18118f){logger['info'](util['format'](_0x29a7('0x10b'),_0x18118f[_0x29a7('0x33')]));if(_0x18118f[_0x29a7('0x77')]===0x0){return this['maxRetry'](_0x18118f);}_0x18118f['retry']-=0x1;if(!this[_0x29a7('0x75')](_0x18118f[_0x29a7('0xbf')])){return this['channel'][_0x29a7('0x27')](_0x18118f,_0x29a7('0xbe'));}var _0x41bf93=this[_0x29a7('0x10c')][_0x29a7('0x76')](this,_0x18118f[_0x29a7('0xbf')]);if(!_0x41bf93){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x18118f,_0x29a7('0x10d'));}var _0x43fc62=this['channel'][_0x29a7('0xc1')](_0x41bf93,_0x18118f['response'],_0x18118f[_0x29a7('0x10e')]);var _0x5e9e6a=_0x43fc62[_0x29a7('0x81')];if(_0x43fc62[_0x29a7('0x81')]===-0x1){this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x18118f,'-1');return _0x43fc62;}else if(_0x43fc62[_0x29a7('0x71')]==='timeout'){_0x43fc62[_0x29a7('0x81')]=_0x43fc62[_0x29a7('0x81')][_0x29a7('0x6f')]>0x0?_0x43fc62[_0x29a7('0x81')]:'t';}else if(_['isEmpty'](_0x43fc62['result'])){_0x43fc62['result']='#';_0x5e9e6a='#';}if(!this['isConfigured'](_0x18118f[_0x29a7('0xc0')])){this[_0x29a7('0x35')]['noop'](_0x29a7('0xa0'));}else{var _0x508c21=this[_0x29a7('0xf')][_0x29a7('0x76')](this,_0x18118f[_0x29a7('0xc0')]);if(!_0x508c21){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x18118f,_0x29a7('0xa1'));}this['channel'][_0x29a7('0x74')](_0x508c21,_0x5e9e6a);}this['createSquareDetailsReport'][_0x29a7('0x76')](this,_0x18118f,_0x5e9e6a);return _0x43fc62;};AGIVertices['prototype']['noop']=function(_0x1a8e7b){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x10f'),_0x1a8e7b[_0x29a7('0x33')]));return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x1a8e7b['output']||_0x1a8e7b[_0x29a7('0x33')]);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x110')]=function(_0x382bfb){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x111'),_0x382bfb[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x382bfb[_0x29a7('0xfe')])){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x382bfb,_0x29a7('0xff'));}logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x100'),this['channel']['callerid'],_0x382bfb[_0x29a7('0xfe')]));var _0x5d87fe=this[_0x29a7('0x112')][_0x29a7('0x76')](this,_0x382bfb[_0x29a7('0x113')]);var _0x3ac9fc=this['agentPause'][_0x29a7('0x76')](this,_0x382bfb[_0x29a7('0xfe')],_0x5d87fe);if(_0x3ac9fc){logger[_0x29a7('0x29')](util['format'](_0x29a7('0x101'),this[_0x29a7('0x35')][_0x29a7('0x37')],_0x382bfb['findBy']));this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x101'),this[_0x29a7('0x35')][_0x29a7('0x37')],_0x382bfb[_0x29a7('0xfe')]));return{'code':0xc8,'result':_0x29a7('0x102')};}else{logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x103'),this[_0x29a7('0x35')]['callerid'],_0x382bfb[_0x29a7('0xfe')]));this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x382bfb[_0x29a7('0xfe')]));return{'code':0xc8,'result':_0x29a7('0x104')};}};AGIVertices['prototype'][_0x29a7('0x114')]=function(_0x2f6790){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2f6790[_0x29a7('0x33')]));if(!this['isConfigured'](_0x2f6790[_0x29a7('0xbf')])){return this['channel'][_0x29a7('0x27')](_0x2f6790,_0x29a7('0xbe'));}var _0x29c1c1=this['getSound'][_0x29a7('0x76')](this,_0x2f6790[_0x29a7('0xbf')]);if(!_0x29c1c1){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x2f6790,_0x29a7('0x10d'));}var _0x132fb7=this['channel']['exec'](_0x29a7('0x115'),[_0x29c1c1,_0x2f6790[_0x29a7('0xa9')]]);if(_0x132fb7[_0x29a7('0x81')]===-0x1){return _0x132fb7;}return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x8c'),_0x29a7('0x115'),_0x29c1c1));};AGIVertices['prototype'][_0x29a7('0x116')]=function(_0x4bbf77){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x117'),_0x4bbf77[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x4bbf77[_0x29a7('0x118')])){return this[_0x29a7('0x35')]['error'](_0x4bbf77,_0x29a7('0x119'));}var _0x337290='';var _0x4a8b01=parseInt(_0x4bbf77['queue_id'],0xa);if(isNaN(_0x4a8b01)){_0x337290=_0x4bbf77[_0x29a7('0x118')];}else{_0x337290=this[_0x29a7('0x11a')][_0x29a7('0x76')](this,_0x4bbf77[_0x29a7('0x118')]);if(!_0x337290){return this['channel'][_0x29a7('0x27')](_0x4bbf77,_0x29a7('0x11b'));}}var _0x1420f9='';if(this['isConfigured'](_0x4bbf77[_0x29a7('0xbf')])){var _0x36b64d=this['getSound'][_0x29a7('0x76')](this,_0x4bbf77['file_id']);if(_0x36b64d){_0x1420f9=_0x36b64d;}}this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x4bbf77,_0x337290);if(_0x4bbf77[_0x29a7('0xa9')][_0x29a7('0x11c')]('x')<0x0){_0x4bbf77['opts']+='x';}if(_0x4bbf77['opts'][_0x29a7('0x11c')]('X')<0x0){_0x4bbf77[_0x29a7('0xa9')]+='X';}this[_0x29a7('0x35')][_0x29a7('0x74')](_0x29a7('0x11d'),_0x337290?_0x337290[_0x29a7('0x11e')]():'');var _0x1c1228=this[_0x29a7('0x35')][_0x29a7('0x8e')]('QUEUE',[_0x337290,_0x4bbf77[_0x29a7('0xa9')],_0x4bbf77[_0x29a7('0xaa')],_0x1420f9,_0x4bbf77[_0x29a7('0x7e')],_0x4bbf77['agi'],_0x4bbf77[_0x29a7('0x11f')],_0x4bbf77[_0x29a7('0x120')],'',_0x4bbf77[_0x29a7('0x121')]]);if(_0x1c1228[_0x29a7('0x81')]===-0x1){return _0x1c1228;}return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x8c'),_0x29a7('0x122'),_0x337290));};AGIVertices[_0x29a7('0xe')][_0x29a7('0x123')]=function(_0x573dd9){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x124'),_0x573dd9[_0x29a7('0x33')]));var _0x58219c=_0x573dd9[_0x29a7('0x125')]||_0x29a7('0xd6');var _0x6e30f=util[_0x29a7('0x23')](_0x29a7('0x126'),this['channel'][_0x29a7('0x39')],rs['generate'](0x5));var _0x159dec=util[_0x29a7('0x23')](_0x29a7('0x127'),FILES_PATH,_0x6e30f,_0x58219c);var _0x359703=util['format'](_0x29a7('0xd7'),FILES_PATH,_0x6e30f);this['createSquareRecording'][_0x29a7('0x76')](this,_0x573dd9,_0x6e30f,_0x159dec);this[_0x29a7('0x35')][_0x29a7('0x74')](_0x29a7('0x128'),_0x6e30f);logger['info'](_0x29a7('0x129'),_0x359703,_0x58219c,_0x573dd9[_0x29a7('0x12a')],_0x573dd9[_0x29a7('0x7e')]);return this[_0x29a7('0x35')]['recordFile'](_0x359703,_0x58219c,_0x573dd9[_0x29a7('0x12a')],_0x573dd9[_0x29a7('0x7e')],undefined,!![]);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x12b')]=function(_0x6a288e){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x12c'),_0x6a288e[_0x29a7('0x33')]));return this[_0x29a7('0x35')][_0x29a7('0x12d')](_0x6a288e[_0x29a7('0x12e')]['replace'](/\s+/g,''),_0x6a288e[_0x29a7('0x12a')]);};AGIVertices['prototype'][_0x29a7('0x12f')]=function(_0x540b8f){logger['info'](util['format'](_0x29a7('0x130'),_0x540b8f[_0x29a7('0x33')]));return this[_0x29a7('0x35')][_0x29a7('0x131')](_0x540b8f[_0x29a7('0x132')][_0x29a7('0x56')](/\s+/g,''),_0x540b8f[_0x29a7('0x12a')]);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x133')]=function(_0x2e74c3){logger['info'](util[_0x29a7('0x23')](_0x29a7('0x134'),_0x2e74c3[_0x29a7('0x33')]));return this[_0x29a7('0x35')][_0x29a7('0x135')](_0x2e74c3[_0x29a7('0x5a')],_0x2e74c3['escape_digits']);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x136')]=function(_0x3d7b16){logger['info'](util[_0x29a7('0x23')](_0x29a7('0x137'),_0x3d7b16[_0x29a7('0x33')]));if(!this['isConfigured'](_0x3d7b16['account_id'])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0x138'));}var _0x42beff=this['getMailAccount'][_0x29a7('0x76')](this,_0x3d7b16[_0x29a7('0x139')]);if(!_0x42beff||!_0x42beff[_0x29a7('0x13a')]){return this[_0x29a7('0x35')]['error'](_0x3d7b16,'no\x20mail\x20account\x20found');}var _0x1606de={'from':util['format'](_0x29a7('0x13b'),_0x42beff['name'],_0x42beff[_0x29a7('0x13c')]||_0x42beff[_0x29a7('0x13a')][_0x29a7('0x13d')]),'to':_0x3d7b16['to']||'','cc':_0x3d7b16['cc']||'','bcc':_0x3d7b16[_0x29a7('0x13e')]||'','subject':_0x3d7b16[_0x29a7('0x13f')],'html':_0x3d7b16[_0x29a7('0x5a')],'text':_0x3d7b16['text']};var _0x47175={'tls':{'rejectUnauthorized':![]}};if(_0x42beff[_0x29a7('0x13a')][_0x29a7('0x140')]){_0x47175[_0x29a7('0x140')]=_0x42beff['Smtp'][_0x29a7('0x140')];}else{_0x47175['host']=_0x42beff['Smtp']['host'];_0x47175[_0x29a7('0x141')]=_0x42beff['Smtp'][_0x29a7('0x141')];_0x47175[_0x29a7('0x142')]=_0x42beff[_0x29a7('0x13a')]['secure'];}if(_0x42beff['Smtp'][_0x29a7('0x143')]){_0x47175['auth']={'user':_0x42beff[_0x29a7('0x13a')][_0x29a7('0x13d')],'pass':_0x42beff[_0x29a7('0x13a')][_0x29a7('0x144')]};}if(this[_0x29a7('0x75')](_0x3d7b16['template_id'])){}logger[_0x29a7('0xa6')](_0x29a7('0x145'),JSON[_0x29a7('0xe5')](_0x1606de));this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x3d7b16,_0x3d7b16[_0x29a7('0x139')]);this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x146'),_0x42beff['name']));this['sendMailMessage']['sync'](this,_0x47175,_0x1606de);return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0x147'));};AGIVertices[_0x29a7('0xe')]['sendFax']=function(_0x36fae6){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x148'),_0x36fae6[_0x29a7('0x33')]));return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0x149'));};AGIVertices[_0x29a7('0xe')][_0x29a7('0x14a')]=function(_0x5384c4){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x14b'),_0x5384c4['label']));if(!this[_0x29a7('0x75')](_0x5384c4[_0x29a7('0x14c')])){return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0x14d'));}var _0x140a4d=this[_0x29a7('0x2f')][_0x29a7('0x76')](this,_0x5384c4[_0x29a7('0x14c')]);if(!_0x140a4d){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x5384c4,_0x29a7('0x14e'));}var _0x38596e={'body':_0x5384c4[_0x29a7('0x14f')],'phone':_0x5384c4['to']||'','SmsAccountId':_0x140a4d['id']};logger[_0x29a7('0xa6')](_0x29a7('0x150'),JSON['stringify'](_0x38596e));this['createSquareDetailsReport'][_0x29a7('0x76')](this,_0x5384c4,_0x5384c4['sms_account_id']);this[_0x29a7('0x35')][_0x29a7('0x86')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x140a4d[_0x29a7('0x12')]));this[_0x29a7('0x31')][_0x29a7('0x76')](this,_0x38596e);return this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0x151'));};AGIVertices[_0x29a7('0xe')]['set']=function(_0x1fbe28){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x152'),_0x1fbe28[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x1fbe28[_0x29a7('0xc0')])){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x1fbe28,_0x29a7('0x153'));}var _0x174520=this['getVariable'][_0x29a7('0x76')](this,_0x1fbe28[_0x29a7('0xc0')]);if(!_0x174520){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x1fbe28,_0x29a7('0xa1'));}return this[_0x29a7('0x35')][_0x29a7('0x74')](_0x174520,_0x1fbe28[_0x29a7('0x154')]);};AGIVertices[_0x29a7('0xe')][_0x29a7('0x155')]=function(_0x598b1f){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x156'),_0x598b1f[_0x29a7('0x33')]));this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0x157'));if(_0x598b1f[_0x29a7('0x7c')]===_0x29a7('0x158')){this[_0x29a7('0x35')][_0x29a7('0x86')](_0x29a7('0x159'));return this['channel'][_0x29a7('0x7c')]();}return this[_0x29a7('0x35')]['noop'](_0x29a7('0x15a'));};AGIVertices[_0x29a7('0xe')][_0x29a7('0x15b')]=function(_0x4374fa){logger['info'](util[_0x29a7('0x23')](_0x29a7('0x15c'),_0x4374fa['label']));if(!this[_0x29a7('0x75')](_0x4374fa[_0x29a7('0x15d')])){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x4374fa,_0x29a7('0x15e'));}var _0x929563=this[_0x29a7('0x15f')]['sync'](this,_0x4374fa[_0x29a7('0x15d')]);if(!this[_0x29a7('0x75')](_0x929563)){return this['channel']['error'](_0x4374fa,util['format'](_0x29a7('0x160'),_0x4374fa['project_id']));}if(_0x929563===this['channel'][_0x29a7('0x36')]){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x4374fa,_0x29a7('0x161'));}this[_0x29a7('0x32')][_0x29a7('0x76')](this,_0x4374fa,_0x929563);var _0x4a4790=this[_0x29a7('0x35')][_0x29a7('0x8e')](_0x29a7('0x162'),util[_0x29a7('0x23')](_0x29a7('0x163'),config['agi'][_0x29a7('0x164')]||'127.0.0.1',_0x929563,this['channel'][_0x29a7('0x36')]));if(_0x4a4790[_0x29a7('0x81')]===-0x1){return _0x4a4790;}return this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x8c'),_0x29a7('0x162'),_0x929563));};AGIVertices['prototype'][_0x29a7('0x165')]=function(_0x1b8f88){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x166'),_0x1b8f88[_0x29a7('0x33')]));var _0x47949f=this[_0x29a7('0x54')]['sync'](this,_0x1b8f88[_0x29a7('0x7a')]);this['createSquareDetailsReport'][_0x29a7('0x76')](this,_0x1b8f88,_0x1b8f88[_0x29a7('0x7a')]);if(this[_0x29a7('0x75')](_0x1b8f88[_0x29a7('0xc0')])){var _0x5d2756=this[_0x29a7('0xf')][_0x29a7('0x76')](this,_0x1b8f88[_0x29a7('0xc0')]);if(_0x5d2756){this[_0x29a7('0x35')]['setVariable'](_0x5d2756,_0x47949f);return this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x167'),_0x1b8f88['command'],_0x5d2756));}}return this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x168'),_0x1b8f88[_0x29a7('0x7a')]));};AGIVertices[_0x29a7('0xe')]['tts']=function(_0xa50e60){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x169'),_0xa50e60[_0x29a7('0x33')]));if(!this['isConfigured'](_0xa50e60['text'])){return this[_0x29a7('0x35')]['noop'](_0x29a7('0xaf'));}this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x16a'),_0xa50e60['text']));var _0x376ed8=this['googleTTS'][_0x29a7('0x76')](this,_0xa50e60);if(_0x376ed8){this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x16b'),_0x376ed8));var _0x4bcce3=this[_0x29a7('0x35')]['streamFile'](_0x376ed8);try{fs[_0x29a7('0xfb')](_0x376ed8+'.wav');}catch(_0x4da1f0){logger[_0x29a7('0x27')](_0x4da1f0);}return _0x4bcce3;}return this[_0x29a7('0x35')][_0x29a7('0x27')](_0xa50e60,_0x29a7('0x16c'));};AGIVertices[_0x29a7('0xe')][_0x29a7('0x16d')]=function(_0x57ed38){logger[_0x29a7('0x29')](util[_0x29a7('0x23')](_0x29a7('0x16e'),_0x57ed38[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x57ed38['findBy'])){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x57ed38,_0x29a7('0xff'));}logger['info'](util[_0x29a7('0x23')](_0x29a7('0x100'),this['channel']['callerid'],_0x57ed38[_0x29a7('0xfe')]));var _0x29a9b3=this['agentUnpause'][_0x29a7('0x76')](this,_0x57ed38[_0x29a7('0xfe')]);if(_0x29a9b3){logger[_0x29a7('0x29')](util['format'](_0x29a7('0x101'),this[_0x29a7('0x35')]['callerid'],_0x57ed38[_0x29a7('0xfe')]));this['channel'][_0x29a7('0x86')](util[_0x29a7('0x23')](_0x29a7('0x101'),this['channel']['callerid'],_0x57ed38[_0x29a7('0xfe')]));return{'code':0xc8,'result':_0x29a7('0x102')};}else{logger['info'](util[_0x29a7('0x23')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x29a7('0x35')]['callerid'],_0x57ed38[_0x29a7('0xfe')]));this[_0x29a7('0x35')][_0x29a7('0x86')](util[_0x29a7('0x23')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x29a7('0x35')]['callerid'],_0x57ed38[_0x29a7('0xfe')]));return{'code':0xc8,'result':_0x29a7('0x104')};}};AGIVertices[_0x29a7('0xe')][_0x29a7('0x16f')]=function(_0x1fda2a){logger[_0x29a7('0x29')](util[_0x29a7('0x23')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1fda2a[_0x29a7('0x33')]));var _0x128921=this['channel']['exec'](_0x29a7('0x170'),[_0x1fda2a[_0x29a7('0x171')],_0x1fda2a[_0x29a7('0x8b')]]);if(_0x128921[_0x29a7('0x81')]===-0x1){return _0x128921;}return this[_0x29a7('0x35')][_0x29a7('0x86')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x1fda2a[_0x29a7('0x171')]));};AGIVertices['prototype'][_0x29a7('0x172')]=function(_0x573094){logger[_0x29a7('0x29')](util['format'](_0x29a7('0x173'),_0x573094[_0x29a7('0x33')]));if(!this[_0x29a7('0x75')](_0x573094[_0x29a7('0xc0')])){return this['channel'][_0x29a7('0x27')](_0x573094,_0x29a7('0x153'));}var _0xdc1ee6=this['getVariable'][_0x29a7('0x76')](this,_0x573094['variable_id']);if(!_0xdc1ee6){return this[_0x29a7('0x35')][_0x29a7('0x27')](_0x573094,_0x29a7('0xa1'));}var _0x44e0fd=this['channel'][_0x29a7('0xf')](_0xdc1ee6);return{'code':0xc8,'result':_0x44e0fd[_0x29a7('0x71')]?_0x44e0fd[_0x29a7('0x71')]:'-'};};String[_0x29a7('0xe')][_0x29a7('0x70')]=function(_0x4c0cc2,_0x478ff7){return this['split'](_0x4c0cc2)[_0x29a7('0x174')](_0x478ff7);};module[_0x29a7('0x175')]=AGIVertices; \ No newline at end of file +var _0x0e3b=['sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','path','util','lodash','shelljs','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','interval','map','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','extension','priority','accountcode','dnid','file','createCmContact','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentLogout','agentLogin','exec','trim','googleTTS','text','google_tts_language','googleDialogflow','dialogflow_language','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','googleASR','tildeASR','appid','appsecret','uri','includes','clone','hasOwnProperty','isString','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','sync','retry','maxRetry','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','options','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','url','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','toUpperCase','Dialogflow\x20Result\x20%s','speech','Google\x20TTS\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','test','mindigit','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','wav','%s/recordings/%s','%s.%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','stringify','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','isEmpty','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','saydigits','sayDigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','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','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','shellCommand'];(function(_0x5c9179,_0x42ad81){var _0x312042=function(_0x26621d){while(--_0x26621d){_0x5c9179['push'](_0x5c9179['shift']());}};_0x312042(++_0x42ad81);}(_0x0e3b,0x185));var _0xb0e3=function(_0x3ce032,_0xe9006a){_0x3ce032=_0x3ce032-0x0;var _0x573bca=_0x0e3b[_0x3ce032];return _0x573bca;};'use strict';var fs=require('fs');var path=require(_0xb0e3('0x0'));var util=require(_0xb0e3('0x1'));var _=require(_0xb0e3('0x2'));var sh=require(_0xb0e3('0x3'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xb0e3('0x4'));var Mustache=require(_0xb0e3('0x5'));var logger=require(_0xb0e3('0x6'))(_0xb0e3('0x7'));var config=require(_0xb0e3('0x8'));var scripts=require(_0xb0e3('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var verticesWithRetry=['menu',_0xb0e3('0xa'),_0xb0e3('0xb')];var AGIVertices=function(_0x3b79f8,_0x3b2c48,_0x2264ab){this[_0xb0e3('0xc')]=_0x3b79f8;this[_0xb0e3('0xd')]=_0x3b2c48;this['mailRpc']=_0x2264ab;};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xf')]=function(_0xbbe58,_0x370479){this[_0xb0e3('0xd')][_0xb0e3('0x10')](_0xbbe58)[_0xb0e3('0x11')](function(_0x2a4cf0){_0x370479(null,_0x2a4cf0?_0x2a4cf0[_0xb0e3('0x12')]:![]);})['catch'](function(_0x322d83){_0x370479(_0x322d83);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x13')]=function(_0x1bb2a3,_0x276d0b){this['rpc'][_0xb0e3('0x14')](_0x1bb2a3)['then'](function(_0x48c454){_0x276d0b(null,_0x48c454?_0x48c454[_0xb0e3('0x12')]:![]);})[_0xb0e3('0x15')](function(_0x1863c3){_0x276d0b(_0x1863c3);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x16')]=function(_0x267149,_0x49b724){this[_0xb0e3('0xd')][_0xb0e3('0x17')](_0x267149)[_0xb0e3('0x11')](function(_0x1d990d){_0x49b724(null,_0x1d990d?_0x1d990d[_0xb0e3('0x12')]:![]);})[_0xb0e3('0x15')](function(_0x305c1d){_0x49b724(_0x305c1d);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x18')]=function(_0x4ac076,_0x415c3a){this[_0xb0e3('0xd')][_0xb0e3('0x19')](_0x4ac076)['then'](function(_0x319581){_0x415c3a(null,_0x319581?_0x319581[_0xb0e3('0x1a')]:![]);})['catch'](function(_0x2ac2ec){_0x415c3a(_0x2ac2ec);});};AGIVertices['prototype'][_0xb0e3('0x1b')]=function(_0x2955d5,_0x493890){this['rpc']['getUserById'](_0x2955d5)[_0xb0e3('0x11')](function(_0x21493b){_0x493890(null,_0x21493b?_0x21493b[_0xb0e3('0x12')]:![]);})[_0xb0e3('0x15')](function(_0x5d4c32){_0x493890(_0x5d4c32);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x1c')]=function(_0x23c560,_0x3d8689){this['rpc']['getTrunkById'](_0x23c560)['then'](function(_0x594988){_0x3d8689(null,_0x594988?_0x594988[_0xb0e3('0x12')]:![]);})[_0xb0e3('0x15')](function(_0x1d1d4a){_0x3d8689(_0x1d1d4a);});};AGIVertices['prototype'][_0xb0e3('0x1d')]=function(_0x5a65f1,_0x3a9034){var _0x43c6fa=this;this[_0xb0e3('0xd')][_0xb0e3('0x1e')](_0x5a65f1)[_0xb0e3('0x11')](function(_0x32cc51){_0x3a9034(null,_0x32cc51?_0x43c6fa[_0xb0e3('0x1f')](_0x32cc51[_0xb0e3('0x20')]):![]);})['catch'](function(_0x2a1c69){_0x3a9034(_0x2a1c69);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x21')]=function(_0x450259,_0x9c1cc9){this[_0xb0e3('0xd')][_0xb0e3('0x22')](_0x450259)[_0xb0e3('0x11')](function(_0x5c3343){_0x9c1cc9(null,_0x5c3343?_0x5c3343:![]);})[_0xb0e3('0x15')](function(_0x4c1074){_0x9c1cc9(_0x4c1074);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x23')]=function(_0x364ade,_0x328084,_0x240787){this[_0xb0e3('0x24')][_0xb0e3('0x23')](_0x364ade,_0x328084)[_0xb0e3('0x11')](function(){_0x240787(null);})[_0xb0e3('0x15')](function(_0x143bb1){_0x240787(_0x143bb1);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x25')]=function(_0x3f7cef,_0x3b4d13){this[_0xb0e3('0xd')][_0xb0e3('0x26')](_0x3f7cef)[_0xb0e3('0x11')](function(_0x95eb8b){if(_0x95eb8b){if(_0x95eb8b['IntervalId']){_0x3b4d13(null,[_0x95eb8b[_0xb0e3('0x27')]]);}else{_0x3b4d13(null,_[_0xb0e3('0x28')](_0x95eb8b['Intervals'],'interval'));}}else{_0x3b4d13(null,![]);}})['catch'](function(_0x4cd9f9){_0x3b4d13(_0x4cd9f9);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x1f')]=function(_0x418110){return util[_0xb0e3('0x29')](_0xb0e3('0x2a'),FILES_PATH,_0x418110);};AGIVertices[_0xb0e3('0xe')]['getQueryOdbc']=function(_0x1a6dc8,_0x38854e,_0x3ccc80){odbc[_0xb0e3('0x2b')](_0x1a6dc8,function(_0x4e216d){if(_0x4e216d){logger[_0xb0e3('0x2c')](_0xb0e3('0x2d'),_0x4e216d);_0x3ccc80(_0x4e216d);}else{logger[_0xb0e3('0x2e')](_0xb0e3('0x2f'));odbc['query'](_0x38854e,function(_0x1c194f,_0x2459f3){if(_0x1c194f){logger[_0xb0e3('0x2e')](_0xb0e3('0x30'),_0x38854e);_0x3ccc80(_0x1c194f);}else{logger[_0xb0e3('0x2e')](_0xb0e3('0x31'),_0x38854e);odbc[_0xb0e3('0x32')](function(_0x18c0c6){if(_0x18c0c6){logger[_0xb0e3('0x2c')](_0xb0e3('0x33'),_0x18c0c6);}_0x3ccc80(null,_0x2459f3);});}});}});};AGIVertices['prototype'][_0xb0e3('0x34')]=function(_0xff531c,_0x4d1967){this[_0xb0e3('0xd')]['getSmsAccountById'](_0xff531c)[_0xb0e3('0x11')](function(_0x58aa72){_0x4d1967(null,_0x58aa72?_0x58aa72:![]);})['catch'](function(_0xf30f4f){_0x4d1967(_0xf30f4f);});};AGIVertices[_0xb0e3('0xe')]['createSmsMessage']=function(_0x133226,_0xc94af9){this['rpc'][_0xb0e3('0x35')](_0x133226)[_0xb0e3('0x11')](function(_0x2a24c8){_0xc94af9(null,_0x2a24c8);})[_0xb0e3('0x15')](function(_0x49e4ca){_0xc94af9(_0x49e4ca);});};AGIVertices['prototype'][_0xb0e3('0x36')]=function(_0x4800a0,_0x32df5f,_0x220530){this[_0xb0e3('0xd')][_0xb0e3('0x36')]({'uniqueid':this[_0xb0e3('0xc')][_0xb0e3('0x37')],'node':_0x4800a0[_0xb0e3('0x38')],'application':_0x4800a0[_0xb0e3('0x39')],'data':_0x32df5f||null,'project_name':this[_0xb0e3('0xc')][_0xb0e3('0x3a')],'callerid':this['channel']['callerid']})[_0xb0e3('0x11')](function(_0x2556b1){_0x220530(null,_0x2556b1);})[_0xb0e3('0x15')](function(_0x4eab00){_0x220530(_0x4eab00);});};AGIVertices['prototype'][_0xb0e3('0x3b')]=function(_0x13df0c,_0x141294,_0xa6e220,_0x1fda4e){this[_0xb0e3('0xd')][_0xb0e3('0x3b')]({'uniqueid':this['channel'][_0xb0e3('0x37')],'callerid':this['channel'][_0xb0e3('0x3c')],'calleridname':this[_0xb0e3('0xc')]['calleridname'],'context':this['channel'][_0xb0e3('0x3d')],'extension':this[_0xb0e3('0xc')][_0xb0e3('0x3e')],'priority':this[_0xb0e3('0xc')][_0xb0e3('0x3f')],'accountcode':this[_0xb0e3('0xc')][_0xb0e3('0x40')],'dnid':this[_0xb0e3('0xc')][_0xb0e3('0x41')],'projectName':this['channel'][_0xb0e3('0x3a')],'saveName':_0x141294,'filename':_0x13df0c[_0xb0e3('0x42')]||_0x141294,'savePath':_0xa6e220})[_0xb0e3('0x11')](function(_0xf43e18){_0x1fda4e(null,_0xf43e18);})[_0xb0e3('0x15')](function(_0x22138f){_0x1fda4e(_0x22138f);});};AGIVertices[_0xb0e3('0xe')]['createCmContact']=function(_0x548835,_0x348ff6){this['rpc'][_0xb0e3('0x43')]({'firstName':_['isEmpty'](_0x548835['name'])||_['isNil'](_0x548835['name'])?_0xb0e3('0x44')+Math[_0xb0e3('0x45')]():_0x548835[_0xb0e3('0x12')],'lastName':_['isEmpty'](_0x548835[_0xb0e3('0x46')])||_['isNil'](_0x548835['lastName'])?null:_0x548835[_0xb0e3('0x46')],'phone':_0x548835[_0xb0e3('0x47')],'ListId':_0x548835['list_id'],'scheduledAt':_0x548835[_0xb0e3('0x48')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xb0e3('0x49'),'description':_0xb0e3('0x4a')+_0x548835[_0xb0e3('0x48')][_0xb0e3('0x4b')](),'priority':_0x548835[_0xb0e3('0x4c')]})[_0xb0e3('0x11')](function(_0x1aec59){_0x348ff6(null,_0x1aec59);})['catch'](function(_0x47745f){_0x348ff6(_0x47745f);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x4d')]=function(_0x10f7b3,_0x19ad12){this[_0xb0e3('0xd')][_0xb0e3('0x4e')](_0x10f7b3)[_0xb0e3('0x11')](function(_0x1064c6){_0x19ad12(null,_0x1064c6?_0x1064c6[_0xb0e3('0x12')]:![]);})['catch'](function(_0x2f32db){_0x19ad12(_0x2f32db);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x4f')]=function(_0xc7815c,_0x3dcdec,_0x1aadfd){var _0x38d6fb={'role':_0xb0e3('0x50')};_0x38d6fb[_0xc7815c]=this[_0xb0e3('0xc')][_0xb0e3('0x3c')];this[_0xb0e3('0xd')][_0xb0e3('0x4f')](_0x38d6fb,_0x3dcdec,this[_0xb0e3('0xc')][_0xb0e3('0x37')])[_0xb0e3('0x11')](function(_0xc4f5e6){_0x1aadfd(null,_['isNil'](_0xc4f5e6)?![]:!![]);})[_0xb0e3('0x15')](function(_0x5b23ab){logger[_0xb0e3('0x2c')](_0x5b23ab);_0x1aadfd(null,![]);});};AGIVertices[_0xb0e3('0xe')]['agentUnpause']=function(_0x113015,_0x3b1f08){var _0x9811dd={'role':_0xb0e3('0x50')};_0x9811dd[_0x113015]=this[_0xb0e3('0xc')][_0xb0e3('0x3c')];this[_0xb0e3('0xd')]['agentUnpause'](_0x9811dd)['then'](function(_0x9b8a26){_0x3b1f08(null,_[_0xb0e3('0x51')](_0x9b8a26)?![]:!![]);})[_0xb0e3('0x15')](function(_0x2879e8){logger[_0xb0e3('0x2c')](_0x2879e8);_0x3b1f08(null,![]);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x52')]=function(_0x1abfd0,_0x3f177e){var _0x372898={'role':_0xb0e3('0x50')};_0x372898[_0x1abfd0]=this[_0xb0e3('0xc')][_0xb0e3('0x3c')];this[_0xb0e3('0xd')][_0xb0e3('0x52')](_0x372898)[_0xb0e3('0x11')](function(_0x109da1){_0x3f177e(null,_[_0xb0e3('0x51')](_0x109da1)?![]:!![]);})[_0xb0e3('0x15')](function(_0x52d8a6){logger[_0xb0e3('0x2c')](_0x52d8a6);_0x3f177e(null,![]);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x53')]=function(_0x52d4b2,_0x4d5537){var _0x3409c0={'role':_0xb0e3('0x50')};_0x3409c0[_0x52d4b2]=this[_0xb0e3('0xc')][_0xb0e3('0x3c')];var _0x5b6695=_0x52d4b2!='internal'?util[_0xb0e3('0x29')]('%s/%s@from-sip/n','LOCAL',this[_0xb0e3('0xc')][_0xb0e3('0x3c')]):undefined;this[_0xb0e3('0xd')][_0xb0e3('0x53')](_0x3409c0,_0x5b6695)[_0xb0e3('0x11')](function(_0x33f95d){_0x4d5537(null,_['isNil'](_0x33f95d)?![]:!![]);})['catch'](function(_0x569e9a){logger['error'](_0x569e9a);_0x4d5537(null,![]);});};AGIVertices[_0xb0e3('0xe')]['shellCommand']=function(_0x405bad,_0x1a1478){sh[_0xb0e3('0x54')](_[_0xb0e3('0x55')](_0x405bad),function(_0x42d1f1,_0x1b4788){var _0x251e90=_0x1b4788['replace'](/(\r\n|\n|\r)/gm,'');_0x1a1478(null,_0x251e90);});};AGIVertices['prototype']['googleTTS']=function(_0x49b523,_0x59900d){scripts[_0xb0e3('0x56')](_0x49b523[_0xb0e3('0x57')],_0x49b523[_0xb0e3('0x58')]||'en',0x1)[_0xb0e3('0x11')](function(_0x6ed047){_0x59900d(null,_0x6ed047);})[_0xb0e3('0x15')](function(_0x52e358){_0x59900d(_0x52e358);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x59')]=function(_0x1060db,_0x2220ac){scripts[_0xb0e3('0x59')](this[_0xb0e3('0xc')][_0xb0e3('0x37')],_0x1060db['key'],_0x1060db[_0xb0e3('0x57')],_0x1060db[_0xb0e3('0x5a')]||'en')[_0xb0e3('0x11')](function(_0x52fd5d){_0x2220ac(null,_0x52fd5d);})[_0xb0e3('0x15')](function(_0x2cd281){_0x2220ac(_0x2cd281);});};AGIVertices[_0xb0e3('0xe')]['ispeechTTS']=function(_0x2b0aa8,_0xb74d50){scripts[_0xb0e3('0x5b')](_0x2b0aa8[_0xb0e3('0x5c')],_0x2b0aa8['text'],_0x2b0aa8[_0xb0e3('0x5d')]||'en-US',_0x2b0aa8[_0xb0e3('0x5e')])['then'](function(_0x208425){_0xb74d50(null,_0x208425);})[_0xb0e3('0x15')](function(_0x36b508){_0xb74d50(_0x36b508);});};AGIVertices['prototype'][_0xb0e3('0x5f')]=function(_0x2bdb4b,_0x661091,_0x224eb5){scripts[_0xb0e3('0x5f')](_0x661091,_0x2bdb4b['key'],_0x2bdb4b[_0xb0e3('0x60')]||_0xb0e3('0x61'),this[_0xb0e3('0x62')](_0x2bdb4b[_0xb0e3('0x63')])?_0x2bdb4b[_0xb0e3('0x63')]:undefined)[_0xb0e3('0x11')](function(_0x42aa19){_0x224eb5(null,_0x42aa19);})['catch'](function(_0x54d0d7){_0x224eb5(_0x54d0d7);});};AGIVertices['prototype'][_0xb0e3('0x64')]=function(_0x3a16f3,_0x111aa1){scripts[_0xb0e3('0x64')](_0x3a16f3[_0xb0e3('0x65')],_0x3a16f3['aws_secret_access_key'],_0x3a16f3[_0xb0e3('0x66')],_0x3a16f3['aws_polly_voice']||_0xb0e3('0x67'),_0x3a16f3['text'],_0x3a16f3[_0xb0e3('0x68')]||_0xb0e3('0x57'))[_0xb0e3('0x11')](function(_0x5cdc83){_0x111aa1(null,_0x5cdc83);})['catch'](function(_0x59407f){_0x111aa1(_0x59407f);});};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x69')]=function(_0x4dadab,_0xe8d940,_0xc91fe9){scripts[_0xb0e3('0x69')](_0xe8d940,_0x4dadab[_0xb0e3('0x5c')],_0x4dadab['google_asr_language']||_0xb0e3('0x61'))['then'](function(_0x452d68){_0xc91fe9(null,_0x452d68);})['catch'](function(_0x33e7d5){_0xc91fe9(_0x33e7d5);});};AGIVertices['prototype'][_0xb0e3('0x6a')]=function(_0x459ec9,_0x2417e7,_0x5b15e8){scripts[_0xb0e3('0x6a')](_0x2417e7,_0x459ec9[_0xb0e3('0x6b')],_0x459ec9[_0xb0e3('0x6c')],_0x459ec9[_0xb0e3('0x6d')])[_0xb0e3('0x11')](function(_0x2e8e25){_0x5b15e8(null,_0x2e8e25);})[_0xb0e3('0x15')](function(_0x1ef4a1){_0x5b15e8(_0x1ef4a1);});};AGIVertices[_0xb0e3('0xe')]['clear']=function(_0x5e7255){var _0x2dcfda=_[_0xb0e3('0x6e')](verticesWithRetry,_0x5e7255[_0xb0e3('0x39')])?_0x5e7255:_[_0xb0e3('0x6f')](_0x5e7255);for(var _0x942170 in _0x2dcfda){if(_0x2dcfda[_0xb0e3('0x70')](_0x942170)){if(_0x2dcfda[_0x942170]&&_[_0xb0e3('0x71')](_0x2dcfda[_0x942170])){_0x2dcfda[_0x942170]=this['replaceAllVariables'](_0x2dcfda[_0x942170]);}}}return _0x2dcfda;};AGIVertices['prototype']['replaceAllVariables']=function(_0x170e60){var _0x5f06ad=_0x170e60[_0xb0e3('0x72')]('{');for(var _0x1d93bf=0x1;_0x1d93bf<_0x5f06ad[_0xb0e3('0x73')];_0x1d93bf+=0x1){var _0x69cd4c=_0x5f06ad[_0x1d93bf][_0xb0e3('0x72')]('}');if(_0x69cd4c[_0xb0e3('0x73')]>0x1){_0x170e60=_0x170e60[_0xb0e3('0x74')]('{'+_0x69cd4c[0x0]+'}',this[_0xb0e3('0xc')][_0xb0e3('0xf')](_0x69cd4c[0x0])[_0xb0e3('0x75')]||_0x69cd4c[0x0]);}}if(_0x5f06ad[_0xb0e3('0x73')]===0x1){return _0x170e60[_0xb0e3('0x4b')]();}return this['replaceAllVariables'](_0x170e60);};AGIVertices['prototype'][_0xb0e3('0x76')]=function(_0x2f1b1f,_0x266eec){var _0x1a3fca=this[_0xb0e3('0xc')][_0xb0e3('0xf')](_0x2f1b1f);if(_0x1a3fca[_0xb0e3('0x77')]===-0x1){return _0x1a3fca;}logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x78'),_0x266eec,_0x1a3fca['extra']));return this[_0xb0e3('0xc')][_0xb0e3('0x79')](_0x266eec,_0x1a3fca[_0xb0e3('0x75')]);};AGIVertices['prototype'][_0xb0e3('0x62')]=function(_0x43e5e6){return _0x43e5e6&&_0x43e5e6!=='0'&&_0x43e5e6!=='-1'&&_0x43e5e6!=='';};AGIVertices['prototype']['maxRetry']=function(_0x54860b){this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x54860b,'-');_0x54860b[_0xb0e3('0x7b')]=_0x54860b[_0xb0e3('0x7c')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x7')]=function(_0x159439){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x159439['label']));return this['channel'][_0xb0e3('0x7')]([_0x159439[_0xb0e3('0x7d')],_0x159439['args']]);};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x7e')]=function(_0x555b4a){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x7f'),_0x555b4a[_0xb0e3('0x38')]));if(this[_0xb0e3('0x62')](_0x555b4a[_0xb0e3('0x80')])){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x81'),_0x555b4a['timeout']));var _0x5931af=this[_0xb0e3('0xc')]['wait'](_0x555b4a['timeout']);if(_0x5931af[_0xb0e3('0x77')]===-0x1){return _0x5931af;}}return this[_0xb0e3('0xc')]['answer']();};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x49')]=function(_0x17ccb0){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x82'),_0x17ccb0['label']));if(!this[_0xb0e3('0x62')](_0x17ccb0[_0xb0e3('0x83')])){return this['channel'][_0xb0e3('0x2c')](_0x17ccb0,_0xb0e3('0x84'));}_0x17ccb0[_0xb0e3('0x48')]=moment();if(this[_0xb0e3('0x62')](_0x17ccb0[_0xb0e3('0x85')])){_0x17ccb0[_0xb0e3('0x48')]=moment()[_0xb0e3('0x86')](_0x17ccb0[_0xb0e3('0x85')],_0xb0e3('0x87'));}if(!this['isConfigured'](_0x17ccb0[_0xb0e3('0x4c')])){_0x17ccb0[_0xb0e3('0x4c')]=0x2;}this['createCmContact'][_0xb0e3('0x7a')](this,_0x17ccb0);return this[_0xb0e3('0xc')]['noop'](util[_0xb0e3('0x29')](_0xb0e3('0x88'),_0x17ccb0['phone'],_0x17ccb0['list_id'],_0x17ccb0['scheduledAt']));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x89')]=function(_0x33d5fa){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x8a'),_0x33d5fa[_0xb0e3('0x38')]));var _0x1850f2=this[_0xb0e3('0xc')][_0xb0e3('0x54')](_0x33d5fa[_0xb0e3('0x8b')],_0x33d5fa['options']);if(_0x1850f2['result']===-0x1){return _0x1850f2;}return this['channel']['noop'](util['format'](_0xb0e3('0x8c'),_0x33d5fa[_0xb0e3('0x8b')],_0x33d5fa[_0xb0e3('0x8d')]));};AGIVertices[_0xb0e3('0xe')]['lumenvoxtts']=function(_0x56763e){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x8e'),_0x56763e['label']));if(!this[_0xb0e3('0x62')](_0x56763e['text'])){return this[_0xb0e3('0xc')]['noop'](_0xb0e3('0x8f'));}var _0x55a28c='\x22'+_0x56763e[_0xb0e3('0x57')]+'\x22';if(this[_0xb0e3('0x62')](_0x56763e['options'])){_0x55a28c+=','+_0x56763e['options'];}var _0x405513=this[_0xb0e3('0xc')][_0xb0e3('0x54')](_0xb0e3('0x90'),_0x55a28c);if(_0x405513[_0xb0e3('0x77')]===-0x1){return _0x405513;}return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x55a28c));};AGIVertices[_0xb0e3('0xe')]['lumenvoxasr']=function(_0x20b081){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x92'),_0x20b081[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x20b081[_0xb0e3('0x93')])){return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0x94'));}var _0x31c100=_0x20b081[_0xb0e3('0x93')];if(this[_0xb0e3('0x62')](_0x20b081['options'])){_0x31c100+=','+_0x20b081['options'];}var _0x1f271f=this['channel'][_0xb0e3('0x54')](_0xb0e3('0x95'),_0x31c100);if(_0x1f271f[_0xb0e3('0x77')]===-0x1){return _0x1f271f;}var _0x12fd86=this[_0xb0e3('0x76')](_0xb0e3('0x96'),_0xb0e3('0x97'));if(_0x12fd86[_0xb0e3('0x77')]===-0x1){return _0x12fd86;}var _0x35ec10=this[_0xb0e3('0x76')]('RECOG_INPUT()',_0xb0e3('0x98'));if(_0x35ec10[_0xb0e3('0x77')]===-0x1){return _0x35ec10;}var _0x484897=this[_0xb0e3('0x76')](_0xb0e3('0x99'),'LUMENVOX_ASR_INSTANCE');if(_0x484897[_0xb0e3('0x77')]===-0x1){return _0x484897;}return this['channel'][_0xb0e3('0x91')](util[_0xb0e3('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x31c100));};AGIVertices[_0xb0e3('0xe')]['database']=function(_0x202e97){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x9a'),_0x202e97['label']));if(!this[_0xb0e3('0x62')](_0x202e97[_0xb0e3('0x9b')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x202e97,'no\x20database\x20selected');}var _0x18b725=this[_0xb0e3('0x18')][_0xb0e3('0x7a')](this,_0x202e97[_0xb0e3('0x9b')]);if(!_0x18b725){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x202e97,_0xb0e3('0x9c'));}if(!this[_0xb0e3('0x62')](_0x202e97['query'])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x202e97,_0xb0e3('0x9d'));}var _0x1f69d3=_0x202e97[_0xb0e3('0x9e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xb0e3('0xc')][_0xb0e3('0x91')](util['format'](_0xb0e3('0x9f'),_0x1f69d3));var _0x4687cb=this[_0xb0e3('0xa0')][_0xb0e3('0x7a')](this,_0x18b725,_0x1f69d3);this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x202e97,_0x1f69d3);if(!this[_0xb0e3('0x62')](_0x202e97[_0xb0e3('0xa1')])){return this[_0xb0e3('0xc')]['noop'](_0xb0e3('0xa2'));}var _0x5afa06=this['getVariable'][_0xb0e3('0x7a')](this,_0x202e97[_0xb0e3('0xa1')]);if(!_0x5afa06){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x202e97,_0xb0e3('0xa3'));}var _0x5e3bba=this;_0x4687cb['forEach'](function(_0x24e2b7,_0x2eabab){Object[_0xb0e3('0xa4')](_0x24e2b7)[_0xb0e3('0xa5')](function(_0x488dd2){_0x5e3bba[_0xb0e3('0xc')][_0xb0e3('0x79')](util['format'](_0xb0e3('0xa6'),_0x5afa06,_0x2eabab,_0x488dd2),_0x24e2b7[_0x488dd2]);});});this['channel'][_0xb0e3('0x79')](util[_0xb0e3('0x29')]('%s_ROWS_COUNT',_0x5afa06),_0x4687cb[_0xb0e3('0x73')]);return this['channel']['noop'](util[_0xb0e3('0x29')](_0xb0e3('0xa7'),_0x5afa06));};AGIVertices['prototype'][_0xb0e3('0xa8')]=function(_0x556cf0){logger['debug'](util[_0xb0e3('0x29')](_0xb0e3('0xa9'),_0x556cf0[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x556cf0['sip_id'])){return this[_0xb0e3('0xc')]['error'](_0x556cf0,'no\x20user\x20selected');}var _0x479f8a=this[_0xb0e3('0x1b')][_0xb0e3('0x7a')](this,_0x556cf0[_0xb0e3('0xaa')]);if(!_0x479f8a){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x556cf0,_0xb0e3('0xab'));}var _0x362211=this[_0xb0e3('0xc')]['exec']('DIAL',[util[_0xb0e3('0x29')](_0xb0e3('0xac'),_0x479f8a),_0x556cf0[_0xb0e3('0x80')],_0x556cf0[_0xb0e3('0xad')],_0x556cf0[_0xb0e3('0xae')]]);if(_0x362211['result']===-0x1){return _0x362211;}return this['channel'][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xaf'),_0xb0e3('0xb0')));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xb1')]=function(_0x35d908){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xb2'),_0x35d908[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x35d908[_0xb0e3('0x5c')])){return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0xb3'));}if(!this[_0xb0e3('0x62')](_0x35d908['text'])){return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0x8f'));}this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xb4'),_0x35d908[_0xb0e3('0x57')]));var _0x2cf83d=this['googleDialogflow'][_0xb0e3('0x7a')](this,_0x35d908);if(_0x2cf83d){for(var _0x2df41f in _0x2cf83d){if(_0x2cf83d['hasOwnProperty'](_0x2df41f)){this[_0xb0e3('0xc')][_0xb0e3('0x79')](util[_0xb0e3('0x29')]('DIALOGFLOW_%s',_0x2df41f[_0xb0e3('0xb5')]()),_0x2cf83d[_0x2df41f]);}}return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xb6'),_0x2cf83d[_0xb0e3('0xb7')]));}return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x35d908,_0xb0e3('0xb8'));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xb9')]=function(_0x2819d9){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xba'),_0x2819d9['label']));return this['channel'][_0xb0e3('0x91')](_0xb0e3('0xb9'));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xbb')]=function(_0x560b43){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0xbc'),_0x560b43[_0xb0e3('0x38')]));var _0xa088f3='';if(_0x560b43[_0xb0e3('0xbd')]){if(!this[_0xb0e3('0x62')](_0x560b43[_0xb0e3('0xbd')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x560b43,_0xb0e3('0xbe'));}else{var _0x4787a9=parseInt(_0x560b43[_0xb0e3('0xbd')],0xa);if(isNaN(_0x4787a9)){_0xa088f3=_0x560b43[_0xb0e3('0xbd')];}else{_0xa088f3=this[_0xb0e3('0x1c')][_0xb0e3('0x7a')](this,_0x560b43[_0xb0e3('0xbd')]);if(!_0xa088f3){return this['channel'][_0xb0e3('0x2c')](_0x560b43,'no\x20trunk\x20found');}}}}else if(_0x560b43[_0xb0e3('0xbf')]){_0xa088f3=_0x560b43[_0xb0e3('0xbf')];}else{return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x560b43,_0xb0e3('0xbe'));}var _0x22a18a=this[_0xb0e3('0xc')][_0xb0e3('0x54')](_0xb0e3('0xb0'),[util[_0xb0e3('0x29')](_0xb0e3('0xc0'),_0xa088f3,_0x560b43[_0xb0e3('0x47')]),_0x560b43[_0xb0e3('0x80')],_0x560b43['opts'],_0x560b43['url']]);if(_0x22a18a['result']===-0x1){return _0x22a18a;}return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xaf'),_0xb0e3('0xb0')));};AGIVertices[_0xb0e3('0xe')]['finally']=function(_0x1e6a04){logger['info'](util['format'](_0xb0e3('0xc1'),_0x1e6a04[_0xb0e3('0x38')]));return this[_0xb0e3('0xc')][_0xb0e3('0x91')]('finally');};AGIVertices[_0xb0e3('0xe')]['getdigits']=function(_0x1f51ad){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xc2'),_0x1f51ad[_0xb0e3('0x38')]));if(_0x1f51ad['retry']===0x0){return this[_0xb0e3('0x7c')](_0x1f51ad);}_0x1f51ad[_0xb0e3('0x7b')]-=0x1;if(!this[_0xb0e3('0x62')](_0x1f51ad[_0xb0e3('0xc3')])){return this[_0xb0e3('0xc')]['error'](_0x1f51ad,_0xb0e3('0xc4'));}var _0x3931f2=this[_0xb0e3('0x1d')]['sync'](this,_0x1f51ad['file_id']);if(!_0x3931f2){return this[_0xb0e3('0xc')]['error'](_0x1f51ad,'no\x20file\x20audio\x20found');}if(!this[_0xb0e3('0x62')](_0x1f51ad[_0xb0e3('0xa1')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0xb0e3('0xa2'));}var _0x7970ab=this[_0xb0e3('0xc')][_0xb0e3('0xc5')](_0x3931f2,_0x1f51ad['response'],_0x1f51ad[_0xb0e3('0xc6')]);var _0x77152d=_0x7970ab[_0xb0e3('0x77')]?_0x7970ab['result']['toString']():'';logger['info'](_0xb0e3('0xc7'),JSON['stringify'](_0x7970ab));if(_0x7970ab[_0xb0e3('0x77')]===-0x1){this[_0xb0e3('0x36')]['sync'](this,_0x1f51ad,_0x77152d);return _0x7970ab;}else if(_0x7970ab[_0xb0e3('0x75')]==='timeout'){_0x7970ab[_0xb0e3('0x77')]=_0x77152d[_0xb0e3('0x73')]>=parseInt(_0x1f51ad[_0xb0e3('0xc8')])?'x':'i';}else{_0x7970ab[_0xb0e3('0x77')]=_0x77152d[_0xb0e3('0x73')]>=parseInt(_0x1f51ad[_0xb0e3('0xc8')])&&_0x77152d['length']<=parseInt(_0x1f51ad['maxdigit'])?'x':'i';}var _0x51602b=this[_0xb0e3('0xf')][_0xb0e3('0x7a')](this,_0x1f51ad[_0xb0e3('0xa1')]);if(!_0x51602b){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x1f51ad,_0xb0e3('0xa3'));}this[_0xb0e3('0xc')][_0xb0e3('0x79')](_0x51602b,_0x77152d);if(this[_0xb0e3('0x62')](_0x1f51ad['hiddendigitsnum'])){var _0x3687bd=parseInt(_0x1f51ad['hiddendigitsnum'],0xa);var _0x287a50=rs['generate']({'charset':'*','length':_0x3687bd});var _0x3f2d38=_0x77152d['length'];if(_0x3f2d38>0x0){if(_0x3f2d38>_0x3687bd){this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x1f51ad,_0x1f51ad['hiddendigitspos']===_0xb0e3('0xc9')?_0x287a50+_0x77152d[_0xb0e3('0xca')](_0x3687bd):_0x77152d[_0xb0e3('0xca')](0x0,_0x3f2d38-_0x3687bd)+_0x287a50);}else{this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x1f51ad,rs[_0xb0e3('0xcb')]({'charset':'*','length':_0x3f2d38}));}}else{this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x1f51ad,'');}}else{this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x1f51ad,_0x77152d);}return _0x7970ab;};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xb')]=function(_0x4e3f04){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xcc'),_0x4e3f04[_0xb0e3('0x38')]));return this['getdigits'](_0x4e3f04);};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xcd')]=function(_0x5860e0){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xce'),_0x5860e0[_0xb0e3('0x38')]));this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x5860e0,_0x5860e0[_0xb0e3('0xcf')]);return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util['format'](_0xb0e3('0xd0'),_0x5860e0[_0xb0e3('0xcf')]));};AGIVertices[_0xb0e3('0xe')]['awspolly']=function(_0x1edf7e){logger[_0xb0e3('0x2e')](util['format'](_0xb0e3('0xd1'),_0x1edf7e[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x1edf7e[_0xb0e3('0x65')])||!this[_0xb0e3('0x62')](_0x1edf7e[_0xb0e3('0xd2')])){return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0xd3'));}if(!this[_0xb0e3('0x62')](_0x1edf7e[_0xb0e3('0x57')])){return this[_0xb0e3('0xc')]['noop'](_0xb0e3('0x8f'));}this['channel'][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xd4'),_0x1edf7e[_0xb0e3('0x57')]));var _0x5008d3=this[_0xb0e3('0x64')][_0xb0e3('0x7a')](this,_0x1edf7e);if(_0x5008d3){this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xd5'),_0x5008d3));var _0x5dd78d=this[_0xb0e3('0xc')]['streamFile'](_0x5008d3);try{fs[_0xb0e3('0xd6')](_0x5008d3+'.wav');}catch(_0x53f0b8){logger['error'](_0x53f0b8);}return _0x5dd78d;}return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x1edf7e,_0xb0e3('0xd7'));};AGIVertices[_0xb0e3('0xe')]['googleasr']=function(_0x3b23f2){logger['info'](util[_0xb0e3('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3b23f2['label'],_0x3b23f2[_0xb0e3('0x80')]));if(!this['isConfigured'](_0x3b23f2[_0xb0e3('0x5c')])){return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0xb3'));}var _0x49f2c4=_0xb0e3('0xd8');var _0x2d033b=util[_0xb0e3('0x29')](_0xb0e3('0xd9'),FILES_PATH,rs[_0xb0e3('0xcb')](0x4));var _0x5f196f=util[_0xb0e3('0x29')](_0xb0e3('0xda'),_0x2d033b,_0x49f2c4);var _0x4f594a=!![];if(_0x3b23f2[_0xb0e3('0xdb')]==='NOBEEP'){_0x4f594a=![];}var _0xb1c0c=this['channel'][_0xb0e3('0xdc')](_0x2d033b,_0x49f2c4,_0x3b23f2[_0xb0e3('0xdd')],_0x3b23f2[_0xb0e3('0x80')],undefined,_0x4f594a);if(_0xb1c0c['result']!==-0x1){this['channel'][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xde'),_0x5f196f));var _0x28a939=this[_0xb0e3('0x69')]['sync'](this,_0x3b23f2,_0x5f196f);if(_0x28a939){for(var _0x333a73 in _0x28a939){if(_0x28a939[_0xb0e3('0x70')](_0x333a73)){this[_0xb0e3('0xc')][_0xb0e3('0x79')](util[_0xb0e3('0x29')](_0xb0e3('0xdf'),_0x333a73['toUpperCase']()),_0x28a939[_0x333a73]);}}return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xe0'),JSON[_0xb0e3('0xe1')](_0x28a939)));}}return _0xb1c0c;};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xe2')]=function(_0x1b8f01){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xe3'),_0x1b8f01[_0xb0e3('0x38')]));if(!this['isConfigured'](_0x1b8f01[_0xb0e3('0x6b')])){return this[_0xb0e3('0xc')]['noop'](_0xb0e3('0xe4'));}if(!this[_0xb0e3('0x62')](_0x1b8f01[_0xb0e3('0x6c')])){return this[_0xb0e3('0xc')]['noop'](_0xb0e3('0xe5'));}var _0x26c773=_0xb0e3('0xd8');var _0x58172f=util[_0xb0e3('0x29')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x304842=util['format']('%s.%s',_0x58172f,_0x26c773);var _0xf32541=!![];if(_0x1b8f01['beep']===_0xb0e3('0xe6')){_0xf32541=![];}var _0x1eec0e=this[_0xb0e3('0xc')][_0xb0e3('0xdc')](_0x58172f,_0x26c773,_0x1b8f01['intKey'],_0x1b8f01[_0xb0e3('0x80')],undefined,_0xf32541);if(_0x1eec0e[_0xb0e3('0x77')]!==-0x1){this['channel'][_0xb0e3('0x91')](util['format'](_0xb0e3('0xe7'),_0x304842));var _0x53aa0c=this['tildeASR']['sync'](this,_0x1b8f01,_0x304842);if(_0x53aa0c){for(var _0x3807af in _0x53aa0c){if(_0x53aa0c[_0xb0e3('0x70')](_0x3807af)){this[_0xb0e3('0xc')][_0xb0e3('0x79')](util[_0xb0e3('0x29')](_0xb0e3('0xe8'),_0x3807af['toUpperCase']()),_0x53aa0c[_0x3807af]);}}return this['channel'][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xe9'),JSON[_0xb0e3('0xe1')](_0x53aa0c)));}}return _0x1eec0e;};AGIVertices[_0xb0e3('0xe')]['gotoc']=function(_0x157694){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x157694[_0xb0e3('0x38')]));return this[_0xb0e3('0xc')][_0xb0e3('0xea')](_0x157694['context'],_0x157694[_0xb0e3('0x3e')],_0x157694[_0xb0e3('0x3f')]);};AGIVertices[_0xb0e3('0xe')]['gotoif']=function(_0x1ea52d){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xeb'),_0x1ea52d['label']));if(!this['isConfigured'](_0x1ea52d[_0xb0e3('0xec')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x1ea52d,_0xb0e3('0xed'));}try{var _0x533ad3=eval(_0x1ea52d[_0xb0e3('0xec')])?'true':_0xb0e3('0xee');this['channel']['noop'](util[_0xb0e3('0x29')](_0xb0e3('0xef'),_0x1ea52d[_0xb0e3('0xec')],_0x533ad3));return{'code':0xc8,'result':_0x533ad3};}catch(_0x5a23c2){return{'code':0xc8,'result':_0xb0e3('0xee')};}};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xf0')]=function(_0x18b75c){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x18b75c[_0xb0e3('0x38')]));if(!this['isConfigured'](_0x18b75c[_0xb0e3('0xf1')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x18b75c,_0xb0e3('0xf2'));}var _0x5d5fab=this[_0xb0e3('0x25')]['sync'](this,_0x18b75c[_0xb0e3('0xf1')]);if(!_0x5d5fab){return this[_0xb0e3('0xc')]['error'](_0x18b75c,_0xb0e3('0xf3'));}for(var _0x27e22a=0x0;_0x27e22a<_0x5d5fab[_0xb0e3('0x73')];_0x27e22a+=0x1){var _0x3251d2=this[_0xb0e3('0xc')]['getVariable'](util[_0xb0e3('0x29')]('IFTIME(%s?true:false)',_0x5d5fab[_0x27e22a]));if(_0x3251d2['result']===-0x1){return _0x3251d2;}logger['info'](util['format'](_0xb0e3('0xf4'),_0x5d5fab[_0x27e22a],_0x3251d2[_0xb0e3('0x75')]));if(_0x3251d2[_0xb0e3('0x75')]===_0xb0e3('0xf5')){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')]('IFTIME\x20%s\x20%s',_0x5d5fab[_0x27e22a],_0xb0e3('0xf5')));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xf4'),_0x5d5fab[_0x27e22a],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0xf4'),_0x5d5fab[_0x27e22a],_0xb0e3('0xee')));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xf4'),_0x5d5fab[_0x27e22a],_0xb0e3('0xee')));}}return{'code':0xc8,'result':_0xb0e3('0xee')};};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xf6')]=function(_0x40f857){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xf7'),_0x40f857[_0xb0e3('0x38')]));return this['channel'][_0xb0e3('0xf6')]();};AGIVertices['prototype'][_0xb0e3('0xf8')]=function(_0x56422e){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0xf9'),_0x56422e[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x56422e['key'])){return this[_0xb0e3('0xc')]['noop'](_0xb0e3('0xb3'));}var _0x7f3617=_0xb0e3('0xd8');var _0x32b31f=util[_0xb0e3('0x29')](_0xb0e3('0xd9'),FILES_PATH,rs[_0xb0e3('0xcb')](0x4));var _0x2b6bc3=util[_0xb0e3('0x29')]('%s.%s',_0x32b31f,_0x7f3617);var _0x357694=!![];if(_0x56422e[_0xb0e3('0xdb')]===_0xb0e3('0xe6')){_0x357694=![];}var _0x3366a2=this[_0xb0e3('0xc')][_0xb0e3('0xdc')](_0x32b31f,_0x7f3617,_0x56422e['intKey'],_0x56422e[_0xb0e3('0x80')],undefined,_0x357694);if(_0x3366a2[_0xb0e3('0x77')]!==-0x1){this['channel'][_0xb0e3('0x91')](util['format'](_0xb0e3('0xfa'),_0x2b6bc3));var _0x10b529=this[_0xb0e3('0x5f')][_0xb0e3('0x7a')](this,_0x56422e,_0x2b6bc3);if(_0x10b529){for(var _0xf90d13 in _0x10b529){if(_0x10b529[_0xb0e3('0x70')](_0xf90d13)){this['channel'][_0xb0e3('0x79')](util['format'](_0xb0e3('0xfb'),_0xf90d13['toUpperCase']()),_0x10b529[_0xf90d13]);}}return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xfc'),JSON['stringify'](_0x10b529)));}}return _0x3366a2;};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0xfd')]=function(_0x3fb75e){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0xfe'),_0x3fb75e[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x3fb75e[_0xb0e3('0x5c')])){return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0xb3'));}if(!this[_0xb0e3('0x62')](_0x3fb75e[_0xb0e3('0x57')])){return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0x8f'));}this['channel'][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xff'),_0x3fb75e[_0xb0e3('0x57')]));var _0x2763f4=this[_0xb0e3('0x5b')][_0xb0e3('0x7a')](this,_0x3fb75e);if(_0x2763f4){this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0xfa'),_0x2763f4));var _0x33888e=this[_0xb0e3('0xc')][_0xb0e3('0x100')](_0x2763f4,_0x3fb75e['intKey']);try{fs[_0xb0e3('0xd6')](_0x2763f4+_0xb0e3('0x101'));}catch(_0x2887b4){logger[_0xb0e3('0x2c')](_0x2887b4);}return _0x33888e;}return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x3fb75e,_0xb0e3('0x102'));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x103')]=function(_0x5b350f){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x104'),_0x5b350f[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x5b350f['findBy'])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x5b350f,_0xb0e3('0x105'));}logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x106'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x5b350f[_0xb0e3('0x107')]));var _0x323480=this[_0xb0e3('0x53')][_0xb0e3('0x7a')](this,_0x5b350f[_0xb0e3('0x107')]);if(_0x323480){logger['info'](util[_0xb0e3('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb0e3('0x3c')],_0x5b350f['findBy']));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x5b350f[_0xb0e3('0x107')]));return{'code':0xc8,'result':_0xb0e3('0x108')};}else{logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xb0e3('0x3c')],_0x5b350f[_0xb0e3('0x107')]));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x109'),this['channel'][_0xb0e3('0x3c')],_0x5b350f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x10a')]=function(_0x2909b1){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x10b'),_0x2909b1[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x2909b1[_0xb0e3('0x107')])){return this[_0xb0e3('0xc')]['error'](_0x2909b1,'no\x20find\x20by\x20configured');}logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x106'),this['channel'][_0xb0e3('0x3c')],_0x2909b1[_0xb0e3('0x107')]));var _0x24aaa9=this[_0xb0e3('0x52')][_0xb0e3('0x7a')](this,_0x2909b1['findBy']);if(_0x24aaa9){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x10c'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x2909b1[_0xb0e3('0x107')]));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x10c'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x2909b1[_0xb0e3('0x107')]));return{'code':0xc8,'result':_0xb0e3('0x108')};}else{logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x109'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x2909b1[_0xb0e3('0x107')]));this['channel']['noop'](util[_0xb0e3('0x29')](_0xb0e3('0x109'),this[_0xb0e3('0xc')]['callerid'],_0x2909b1['findBy']));return{'code':0xc8,'result':_0xb0e3('0x10d')};}};AGIVertices['prototype']['math']=function(_0x2ccd11){logger[_0xb0e3('0x2e')](util['format'](_0xb0e3('0x10e'),_0x2ccd11[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x2ccd11[_0xb0e3('0x10f')])){return this[_0xb0e3('0xc')]['error'](_0x2ccd11,_0xb0e3('0x110'));}this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x111'),_0x2ccd11[_0xb0e3('0x10f')]));var _0xdb405=eval(_0x2ccd11['operation']);if(!this[_0xb0e3('0x62')](_0x2ccd11['variable_id'])){return this[_0xb0e3('0xc')]['noop'](_0xb0e3('0xa2'));}var _0x3e7d60=this['getVariable'][_0xb0e3('0x7a')](this,_0x2ccd11[_0xb0e3('0xa1')]);if(!_0x3e7d60){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x2ccd11,_0xb0e3('0xa3'));}if(_[_0xb0e3('0x112')](_0xdb405)){var _0x5ef183=this;_0xdb405['forEach'](function(_0x41b4e5,_0x1571c5){_0x5ef183[_0xb0e3('0xc')][_0xb0e3('0x79')](util['format'](_0xb0e3('0x113'),_0x3e7d60,_0x1571c5),_0x41b4e5);});return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x114'),_0x3e7d60));}else{return this['channel'][_0xb0e3('0x79')](_0x3e7d60,_0xdb405);}};AGIVertices['prototype']['menu']=function(_0x146bc5){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x115'),_0x146bc5[_0xb0e3('0x38')]));if(_0x146bc5[_0xb0e3('0x7b')]===0x0){return this[_0xb0e3('0x7c')](_0x146bc5);}_0x146bc5['retry']-=0x1;if(!this[_0xb0e3('0x62')](_0x146bc5['file_id'])){return this['channel'][_0xb0e3('0x2c')](_0x146bc5,_0xb0e3('0xc4'));}var _0x5de0e7=this[_0xb0e3('0x1d')][_0xb0e3('0x7a')](this,_0x146bc5[_0xb0e3('0xc3')]);if(!_0x5de0e7){return this['channel']['error'](_0x146bc5,_0xb0e3('0x116'));}var _0x14d3b5=this[_0xb0e3('0xc')][_0xb0e3('0xc5')](_0x5de0e7,_0x146bc5['response'],_0x146bc5[_0xb0e3('0x117')]);var _0x493c9e=_0x14d3b5[_0xb0e3('0x77')];if(_0x14d3b5[_0xb0e3('0x77')]===-0x1){this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x146bc5,'-1');return _0x14d3b5;}else if(_0x14d3b5[_0xb0e3('0x75')]===_0xb0e3('0x80')){_0x14d3b5['result']=_0x14d3b5[_0xb0e3('0x77')][_0xb0e3('0x73')]>0x0?_0x14d3b5['result']:'t';}else if(_[_0xb0e3('0x118')](_0x14d3b5[_0xb0e3('0x77')])){_0x14d3b5[_0xb0e3('0x77')]='#';_0x493c9e='#';}if(!this[_0xb0e3('0x62')](_0x146bc5[_0xb0e3('0xa1')])){this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0xa2'));}else{var _0x5f320d=this[_0xb0e3('0xf')][_0xb0e3('0x7a')](this,_0x146bc5[_0xb0e3('0xa1')]);if(!_0x5f320d){return this[_0xb0e3('0xc')]['error'](_0x146bc5,_0xb0e3('0xa3'));}this[_0xb0e3('0xc')][_0xb0e3('0x79')](_0x5f320d,_0x493c9e);}this[_0xb0e3('0x36')]['sync'](this,_0x146bc5,_0x493c9e);return _0x14d3b5;};AGIVertices[_0xb0e3('0xe')]['noop']=function(_0x1871c6){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x119'),_0x1871c6['label']));return this['channel'][_0xb0e3('0x91')](_0x1871c6[_0xb0e3('0x11a')]||_0x1871c6['label']);};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x11b')]=function(_0xfc2aba){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x11c'),_0xfc2aba[_0xb0e3('0x38')]));if(!this['isConfigured'](_0xfc2aba[_0xb0e3('0x107')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0xfc2aba,_0xb0e3('0x105'));}logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x106'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0xfc2aba[_0xb0e3('0x107')]));var _0x1aa03e=this[_0xb0e3('0x4d')][_0xb0e3('0x7a')](this,_0xfc2aba[_0xb0e3('0x11d')]);var _0x39974d=this['agentPause'][_0xb0e3('0x7a')](this,_0xfc2aba[_0xb0e3('0x107')],_0x1aa03e);if(_0x39974d){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x10c'),this[_0xb0e3('0xc')]['callerid'],_0xfc2aba[_0xb0e3('0x107')]));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb0e3('0xc')]['callerid'],_0xfc2aba[_0xb0e3('0x107')]));return{'code':0xc8,'result':_0xb0e3('0x108')};}else{logger[_0xb0e3('0x2e')](util['format'](_0xb0e3('0x109'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0xfc2aba[_0xb0e3('0x107')]));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb0e3('0xc')]['callerid'],_0xfc2aba['findBy']));return{'code':0xc8,'result':_0xb0e3('0x10d')};}};AGIVertices[_0xb0e3('0xe')]['playback']=function(_0x12ee96){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x11e'),_0x12ee96['label']));if(!this['isConfigured'](_0x12ee96[_0xb0e3('0xc3')])){return this[_0xb0e3('0xc')]['error'](_0x12ee96,_0xb0e3('0xc4'));}var _0x25a3ee=this[_0xb0e3('0x1d')]['sync'](this,_0x12ee96[_0xb0e3('0xc3')]);if(!_0x25a3ee){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x12ee96,_0xb0e3('0x116'));}var _0xeeb09a=this[_0xb0e3('0xc')]['exec'](_0xb0e3('0x11f'),[_0x25a3ee,_0x12ee96[_0xb0e3('0xad')]]);if(_0xeeb09a[_0xb0e3('0x77')]===-0x1){return _0xeeb09a;}return this[_0xb0e3('0xc')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xb0e3('0x11f'),_0x25a3ee));};AGIVertices[_0xb0e3('0xe')]['queue']=function(_0x3560f4){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x120'),_0x3560f4[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x3560f4[_0xb0e3('0x121')])){return this[_0xb0e3('0xc')]['error'](_0x3560f4,_0xb0e3('0x122'));}var _0x534adb='';var _0x327f0f=parseInt(_0x3560f4[_0xb0e3('0x121')],0xa);if(isNaN(_0x327f0f)){_0x534adb=_0x3560f4[_0xb0e3('0x121')];}else{_0x534adb=this[_0xb0e3('0x13')][_0xb0e3('0x7a')](this,_0x3560f4['queue_id']);if(!_0x534adb){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x3560f4,'no\x20queue\x20found');}}var _0x717911='';if(this[_0xb0e3('0x62')](_0x3560f4[_0xb0e3('0xc3')])){var _0x4b5bc3=this['getSound'][_0xb0e3('0x7a')](this,_0x3560f4[_0xb0e3('0xc3')]);if(_0x4b5bc3){_0x717911=_0x4b5bc3;}}this[_0xb0e3('0x36')]['sync'](this,_0x3560f4,_0x534adb);if(_0x3560f4[_0xb0e3('0xad')]['indexOf']('x')<0x0){_0x3560f4[_0xb0e3('0xad')]+='x';}if(_0x3560f4['opts'][_0xb0e3('0x123')]('X')<0x0){_0x3560f4['opts']+='X';}this[_0xb0e3('0xc')][_0xb0e3('0x79')]('XMCS-QUEUE',_0x534adb?_0x534adb[_0xb0e3('0x124')]():'');var _0x3a6eb1=this['channel'][_0xb0e3('0x54')](_0xb0e3('0x125'),[_0x534adb,_0x3560f4[_0xb0e3('0xad')],_0x3560f4[_0xb0e3('0xae')],_0x717911,_0x3560f4[_0xb0e3('0x80')],_0x3560f4[_0xb0e3('0x7')],_0x3560f4['macro'],_0x3560f4['gosub'],'',_0x3560f4['position']]);if(_0x3a6eb1[_0xb0e3('0x77')]===-0x1){return _0x3a6eb1;}return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')]('Executed\x20command\x20%s\x20%s',_0xb0e3('0x125'),_0x534adb));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x126')]=function(_0x23032f){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x127'),_0x23032f[_0xb0e3('0x38')]));var _0x35d47f=_0x23032f[_0xb0e3('0x128')]||_0xb0e3('0xd8');var _0x2f58ce=util[_0xb0e3('0x29')](_0xb0e3('0x129'),this[_0xb0e3('0xc')][_0xb0e3('0x37')],rs[_0xb0e3('0xcb')](0x5));var _0xdf4b59=util[_0xb0e3('0x29')](_0xb0e3('0x12a'),FILES_PATH,_0x2f58ce,_0x35d47f);var _0x37bb04=util[_0xb0e3('0x29')](_0xb0e3('0xd9'),FILES_PATH,_0x2f58ce);this[_0xb0e3('0x3b')][_0xb0e3('0x7a')](this,_0x23032f,_0x2f58ce,_0xdf4b59);this[_0xb0e3('0xc')][_0xb0e3('0x79')]('RECORDING_SAVENAME',_0x2f58ce);logger[_0xb0e3('0x2e')](_0xb0e3('0x12b'),_0x37bb04,_0x35d47f,_0x23032f[_0xb0e3('0x12c')],_0x23032f[_0xb0e3('0x80')]);return this[_0xb0e3('0xc')][_0xb0e3('0xdc')](_0x37bb04,_0x35d47f,_0x23032f[_0xb0e3('0x12c')],_0x23032f[_0xb0e3('0x80')],undefined,!![]);};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x12d')]=function(_0x5986f9){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5986f9['label']));return this[_0xb0e3('0xc')][_0xb0e3('0x12e')](_0x5986f9[_0xb0e3('0x12f')][_0xb0e3('0x130')](/\s+/g,''),_0x5986f9[_0xb0e3('0x12c')]);};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x131')]=function(_0x1c0c86){logger['info'](util['format'](_0xb0e3('0x132'),_0x1c0c86[_0xb0e3('0x38')]));return this[_0xb0e3('0xc')][_0xb0e3('0x133')](_0x1c0c86['number'][_0xb0e3('0x130')](/\s+/g,''),_0x1c0c86[_0xb0e3('0x12c')]);};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x134')]=function(_0x4e1a87){logger[_0xb0e3('0x2e')](util['format'](_0xb0e3('0x135'),_0x4e1a87['label']));return this['channel'][_0xb0e3('0x136')](_0x4e1a87['text'],_0x4e1a87['escape_digits']);};AGIVertices[_0xb0e3('0xe')]['sendMail']=function(_0x493aa7){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x137'),_0x493aa7[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x493aa7[_0xb0e3('0x138')])){return this[_0xb0e3('0xc')]['noop'](_0xb0e3('0x139'));}var _0x34e8e8=this[_0xb0e3('0x21')][_0xb0e3('0x7a')](this,_0x493aa7[_0xb0e3('0x138')]);if(!_0x34e8e8||!_0x34e8e8[_0xb0e3('0x13a')]){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x493aa7,_0xb0e3('0x13b'));}var _0x1a09c2={'from':util[_0xb0e3('0x29')](_0xb0e3('0x13c'),_0x34e8e8['name'],_0x34e8e8[_0xb0e3('0x13d')]||_0x34e8e8[_0xb0e3('0x13a')][_0xb0e3('0x13e')]),'to':_0x493aa7['to']||'','cc':_0x493aa7['cc']||'','bcc':_0x493aa7[_0xb0e3('0x13f')]||'','subject':_0x493aa7[_0xb0e3('0x140')],'html':_0x493aa7[_0xb0e3('0x57')],'text':_0x493aa7[_0xb0e3('0x57')]};var _0x13a8c7={'tls':{'rejectUnauthorized':![]}};if(_0x34e8e8[_0xb0e3('0x13a')][_0xb0e3('0x141')]){_0x13a8c7[_0xb0e3('0x141')]=_0x34e8e8[_0xb0e3('0x13a')][_0xb0e3('0x141')];}else{_0x13a8c7[_0xb0e3('0x142')]=_0x34e8e8[_0xb0e3('0x13a')]['host'];_0x13a8c7[_0xb0e3('0x143')]=_0x34e8e8[_0xb0e3('0x13a')][_0xb0e3('0x143')];_0x13a8c7[_0xb0e3('0x144')]=_0x34e8e8[_0xb0e3('0x13a')][_0xb0e3('0x144')];}if(_0x34e8e8[_0xb0e3('0x13a')]['authentication']){_0x13a8c7[_0xb0e3('0x145')]={'user':_0x34e8e8[_0xb0e3('0x13a')][_0xb0e3('0x13e')],'pass':_0x34e8e8['Smtp'][_0xb0e3('0x146')]};}if(this[_0xb0e3('0x62')](_0x493aa7[_0xb0e3('0x147')])){}logger[_0xb0e3('0x148')](_0xb0e3('0x149'),JSON[_0xb0e3('0xe1')](_0x1a09c2));this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x493aa7,_0x493aa7[_0xb0e3('0x138')]);this[_0xb0e3('0xc')]['noop'](util[_0xb0e3('0x29')](_0xb0e3('0x14a'),_0x34e8e8[_0xb0e3('0x12')]));this[_0xb0e3('0x23')][_0xb0e3('0x7a')](this,_0x13a8c7,_0x1a09c2);return this['channel'][_0xb0e3('0x91')](_0xb0e3('0x14b'));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x14c')]=function(_0x38cf39){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x38cf39['label']));return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0x14d'));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x14e')]=function(_0x30ce85){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x14f'),_0x30ce85[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x30ce85[_0xb0e3('0x150')])){return this['channel'][_0xb0e3('0x91')](_0xb0e3('0x151'));}var _0x349bcc=this[_0xb0e3('0x34')][_0xb0e3('0x7a')](this,_0x30ce85[_0xb0e3('0x150')]);if(!_0x349bcc){return this['channel'][_0xb0e3('0x2c')](_0x30ce85,_0xb0e3('0x152'));}var _0x5d9b73={'body':_0x30ce85[_0xb0e3('0x153')],'phone':_0x30ce85['to']||'','SmsAccountId':_0x349bcc['id']};logger[_0xb0e3('0x148')]('sendSMS\x20message',JSON[_0xb0e3('0xe1')](_0x5d9b73));this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x30ce85,_0x30ce85[_0xb0e3('0x150')]);this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x154'),_0x349bcc[_0xb0e3('0x12')]));this[_0xb0e3('0x35')][_0xb0e3('0x7a')](this,_0x5d9b73);return this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0x155'));};AGIVertices[_0xb0e3('0xe')]['set']=function(_0x6be5e5){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x156'),_0x6be5e5[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x6be5e5[_0xb0e3('0xa1')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x6be5e5,'no\x20variable\x20selected');}var _0x4bc2a7=this[_0xb0e3('0xf')]['sync'](this,_0x6be5e5[_0xb0e3('0xa1')]);if(!_0x4bc2a7){return this['channel'][_0xb0e3('0x2c')](_0x6be5e5,_0xb0e3('0xa3'));}return this[_0xb0e3('0xc')]['setVariable'](_0x4bc2a7,_0x6be5e5[_0xb0e3('0x157')]);};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x158')]=function(_0x575b19){logger[_0xb0e3('0x2e')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x575b19[_0xb0e3('0x38')]));this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0x159'));if(_0x575b19['answer']===_0xb0e3('0x15a')){this[_0xb0e3('0xc')][_0xb0e3('0x91')](_0xb0e3('0x15b'));return this[_0xb0e3('0xc')][_0xb0e3('0x7e')]();}return this[_0xb0e3('0xc')][_0xb0e3('0x91')]('Skipped\x20Answer');};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x15c')]=function(_0x43f93c){logger['info'](util[_0xb0e3('0x29')](_0xb0e3('0x15d'),_0x43f93c[_0xb0e3('0x38')]));if(!this[_0xb0e3('0x62')](_0x43f93c[_0xb0e3('0x15e')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x43f93c,_0xb0e3('0x15f'));}var _0x1cdb6a=this[_0xb0e3('0x16')]['sync'](this,_0x43f93c[_0xb0e3('0x15e')]);if(!this[_0xb0e3('0x62')](_0x1cdb6a)){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x43f93c,util[_0xb0e3('0x29')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x43f93c['project_id']));}if(_0x1cdb6a===this[_0xb0e3('0xc')][_0xb0e3('0x3a')]){return this['channel']['error'](_0x43f93c,_0xb0e3('0x160'));}this[_0xb0e3('0x36')][_0xb0e3('0x7a')](this,_0x43f93c,_0x1cdb6a);var _0x4e2cbf=this[_0xb0e3('0xc')][_0xb0e3('0x54')](_0xb0e3('0x161'),util[_0xb0e3('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xb0e3('0x7')]['host']||_0xb0e3('0x162'),_0x1cdb6a,this['channel'][_0xb0e3('0x3a')]));if(_0x4e2cbf['result']===-0x1){return _0x4e2cbf;}return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util['format']('Executed\x20command\x20%s\x20%s',_0xb0e3('0x161'),_0x1cdb6a));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x163')]=function(_0xb4bd24){logger['info'](util[_0xb0e3('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xb4bd24[_0xb0e3('0x38')]));var _0x293d5a=this[_0xb0e3('0x164')]['sync'](this,_0xb4bd24[_0xb0e3('0x7d')]);this[_0xb0e3('0x36')]['sync'](this,_0xb4bd24,_0xb4bd24[_0xb0e3('0x7d')]);if(this['isConfigured'](_0xb4bd24[_0xb0e3('0xa1')])){var _0x3f870e=this['getVariable'][_0xb0e3('0x7a')](this,_0xb4bd24[_0xb0e3('0xa1')]);if(_0x3f870e){this[_0xb0e3('0xc')]['setVariable'](_0x3f870e,_0x293d5a);return this[_0xb0e3('0xc')]['noop'](util[_0xb0e3('0x29')](_0xb0e3('0x165'),_0xb4bd24[_0xb0e3('0x7d')],_0x3f870e));}}return this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x166'),_0xb4bd24[_0xb0e3('0x7d')]));};AGIVertices['prototype'][_0xb0e3('0x167')]=function(_0x5a25cd){logger[_0xb0e3('0x2e')](util['format'](_0xb0e3('0x168'),_0x5a25cd['label']));if(!this[_0xb0e3('0x62')](_0x5a25cd[_0xb0e3('0x57')])){return this[_0xb0e3('0xc')][_0xb0e3('0x91')]('no\x20text\x20configured');}this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x169'),_0x5a25cd[_0xb0e3('0x57')]));var _0x1f7c86=this['googleTTS']['sync'](this,_0x5a25cd);if(_0x1f7c86){this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x16a'),_0x1f7c86));var _0x47f334=this['channel'][_0xb0e3('0x100')](_0x1f7c86);try{fs[_0xb0e3('0xd6')](_0x1f7c86+_0xb0e3('0x101'));}catch(_0x5bcc7b){logger[_0xb0e3('0x2c')](_0x5bcc7b);}return _0x47f334;}return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x5a25cd,_0xb0e3('0xb8'));};AGIVertices[_0xb0e3('0xe')]['unpause']=function(_0x39a4b2){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x16b'),_0x39a4b2['label']));if(!this[_0xb0e3('0x62')](_0x39a4b2[_0xb0e3('0x107')])){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x39a4b2,'no\x20find\x20by\x20configured');}logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x106'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x39a4b2[_0xb0e3('0x107')]));var _0x29caf8=this[_0xb0e3('0x16c')][_0xb0e3('0x7a')](this,_0x39a4b2['findBy']);if(_0x29caf8){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x39a4b2['findBy']));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util[_0xb0e3('0x29')](_0xb0e3('0x10c'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x39a4b2[_0xb0e3('0x107')]));return{'code':0xc8,'result':_0xb0e3('0x108')};}else{logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x109'),this[_0xb0e3('0xc')]['callerid'],_0x39a4b2[_0xb0e3('0x107')]));this[_0xb0e3('0xc')][_0xb0e3('0x91')](util['format'](_0xb0e3('0x109'),this[_0xb0e3('0xc')][_0xb0e3('0x3c')],_0x39a4b2[_0xb0e3('0x107')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x16d')]=function(_0x33998e){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x16e'),_0x33998e[_0xb0e3('0x38')]));var _0x5eff00=this[_0xb0e3('0xc')][_0xb0e3('0x54')](_0xb0e3('0x16f'),[_0x33998e[_0xb0e3('0x170')],_0x33998e['options']]);if(_0x5eff00[_0xb0e3('0x77')]===-0x1){return _0x5eff00;}return this[_0xb0e3('0xc')]['noop'](util[_0xb0e3('0x29')](_0xb0e3('0x8c'),_0xb0e3('0x16f'),_0x33998e[_0xb0e3('0x170')]));};AGIVertices[_0xb0e3('0xe')][_0xb0e3('0x171')]=function(_0x5dedc7){logger[_0xb0e3('0x2e')](util[_0xb0e3('0x29')](_0xb0e3('0x172'),_0x5dedc7['label']));if(!this[_0xb0e3('0x62')](_0x5dedc7[_0xb0e3('0xa1')])){return this[_0xb0e3('0xc')]['error'](_0x5dedc7,_0xb0e3('0x173'));}var _0x532094=this[_0xb0e3('0xf')][_0xb0e3('0x7a')](this,_0x5dedc7[_0xb0e3('0xa1')]);if(!_0x532094){return this[_0xb0e3('0xc')][_0xb0e3('0x2c')](_0x5dedc7,'no\x20variable\x20found');}var _0xa798e9=this[_0xb0e3('0xc')][_0xb0e3('0xf')](_0x532094);return{'code':0xc8,'result':_0xa798e9[_0xb0e3('0x75')]?_0xa798e9[_0xb0e3('0x75')]:'-'};};String[_0xb0e3('0xe')][_0xb0e3('0x74')]=function(_0x2a4eb4,_0x47cf20){return this[_0xb0e3('0x72')](_0x2a4eb4)[_0xb0e3('0x174')](_0x47cf20);};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 0a22a0c..9b9298a 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 _0x37df=['[TIMER][STOP][AGENT:%s]','update','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','isUndefined','attended','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][ATTENDEDTRANSFER:UNIQUEID]','origtransfereruniqueid','origtransfererlinkedid','[%s][ATTENDEDTRANSFER:LINKEDID]','format','SIP/%s','localtwoconnectedlinename','transfertargetuniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','acw','../rpc/user','../rpc/voiceAgentReport','socket.io-emitter','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','ACW','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s'];(function(_0x282a3b,_0x1c534d){var _0xe7dc37=function(_0x54440f){while(--_0x54440f){_0x282a3b['push'](_0x282a3b['shift']());}};_0xe7dc37(++_0x1c534d);}(_0x37df,0x76));var _0xf37d=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x37df[_0x34232c];return _0x4d4f4e;};'use strict';var util=require(_0xf37d('0x0'));var _=require(_0xf37d('0x1'));var moment=require(_0xf37d('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0xf37d('0x3'));var RpcUser=require(_0xf37d('0x4'));var RpcVoiceAgentReport=require(_0xf37d('0x5'));var io=require(_0xf37d('0x6'))({'host':'localhost','port':0x18eb});function Acw(_0x5ddf55){this[_0xf37d('0x7')]=_0x5ddf55[_0xf37d('0x7')];this['agents']=_0x5ddf55[_0xf37d('0x8')];this[_0xf37d('0x9')]=_0x5ddf55[_0xf37d('0x9')];this[_0xf37d('0xa')]={};ami['on'](_0xf37d('0xb'),this[_0xf37d('0xc')][_0xf37d('0xd')](this));ami['on'](_0xf37d('0xe'),this[_0xf37d('0xf')]['bind'](this));ami['on'](_0xf37d('0x10'),this['syncHangup'][_0xf37d('0xd')](this));ami['on'](_0xf37d('0x11'),this[_0xf37d('0x12')][_0xf37d('0xd')](this));ami['on']('attendedtransfer',this[_0xf37d('0x13')][_0xf37d('0xd')](this));ami['on']('blindtransfer',this[_0xf37d('0x14')][_0xf37d('0xd')](this));ami['on'](_0xf37d('0x15'),this[_0xf37d('0x16')]['bind'](this));}function getDiff(_0x9e59dd){var _0x1f0048=moment()[_0xf37d('0x17')](0x0);var _0x172093=moment(_0x9e59dd)[_0xf37d('0x17')](0x0);return _0x1f0048[_0xf37d('0x18')](_0x172093,_0xf37d('0x19'));}Acw[_0xf37d('0x1a')][_0xf37d('0x1b')]=function(_0x56cb8d){try{var _0x4cdf98=this;var _0x39fc86=this[_0xf37d('0xa')][_0x56cb8d][_0xf37d('0x1c')];var _0x4b38f3=this[_0xf37d('0xa')][_0x56cb8d][_0xf37d('0x1d')];ami['Action']({'action':_0xf37d('0x1e'),'interface':_0x39fc86,'paused':!![],'reason':'ACW'})[_0xf37d('0x1f')](function(_0x2967fd){if(_0x4cdf98[_0xf37d('0x8')][_0x39fc86]){return RpcUser[_0xf37d('0x20')](_0x4cdf98[_0xf37d('0x8')][_0x39fc86]['id'])[_0xf37d('0x1f')](function(_0x268604){if(_0x268604&&!_0x268604[_0xf37d('0x21')]){logger['info'](_0xf37d('0x22'),_0x56cb8d,_0x39fc86,_0x4b38f3);return RpcUser['savePause'](_0x4cdf98['agents'][_0x39fc86],_0xf37d('0x23'),_0x56cb8d)['then'](function(_0x25f9c2){_0x4cdf98[_0xf37d('0x9')][_0x39fc86]={};logger[_0xf37d('0x24')](_0xf37d('0x25'),_0x56cb8d,_0x4cdf98['voiceQueues'][_0x4b38f3][_0xf37d('0x26')],_0x39fc86,_0x4b38f3);_0x4cdf98[_0xf37d('0x9')][_0x39fc86][_0xf37d('0x27')]=setTimeout(_0x4cdf98[_0xf37d('0x28')][_0xf37d('0xd')](_0x4cdf98,_0x39fc86),_0x4cdf98[_0xf37d('0x7')][_0x4b38f3][_0xf37d('0x26')]*0x3e8);_0x4cdf98[_0xf37d('0x9')][_0x39fc86][_0xf37d('0x29')]=_0x25f9c2[_0xf37d('0x29')];_0x4cdf98['timers'][_0x39fc86][_0xf37d('0x2a')]=_0x56cb8d;_0x4cdf98['timers'][_0x39fc86][_0xf37d('0x1d')]=_0x4b38f3;_0x4cdf98[_0xf37d('0x9')][_0x39fc86][_0xf37d('0x2b')]=function(){var _0x203a1b=getDiff(_0x4cdf98[_0xf37d('0x9')][_0x39fc86][_0xf37d('0x29')]);clearTimeout(_0x4cdf98[_0xf37d('0x9')][_0x39fc86]['timer']);RpcVoiceAgentReport['update']({'acwtime':_0x203a1b},_0x4cdf98[_0xf37d('0x9')][_0x39fc86]['uniqueid'],_0x39fc86)[_0xf37d('0x1f')](function(_0x232e6b){logger['info'](_0xf37d('0x2c'),_0x56cb8d,_0x203a1b,_0x232e6b);})['catch'](function(_0x179f1a){logger[_0xf37d('0x2d')](_0xf37d('0x2e'),_0x56cb8d,_0x179f1a);});delete _0x4cdf98['timers'][_0x39fc86];};});}else{logger[_0xf37d('0x24')](_0xf37d('0x2f'),_0x56cb8d,_0x39fc86,_0x4b38f3);}});}})['catch'](function(_0x9bea52){logger[_0xf37d('0x2d')](_0xf37d('0x25'),_0x56cb8d,_0x4cdf98['voiceQueues'][_0x4b38f3][_0xf37d('0x26')],_0x39fc86,_0x4b38f3);})[_0xf37d('0x30')](function(){delete _0x4cdf98[_0xf37d('0xa')][_0x56cb8d];});}catch(_0x20225f){logger[_0xf37d('0x2d')](_0xf37d('0x31'),_0x20225f['message']);}};Acw[_0xf37d('0x1a')][_0xf37d('0x28')]=function(_0x18d080){try{var _0x58e093=this;if(_0x58e093['timers'][_0x18d080]){var _0x2e9704=_0x58e093[_0xf37d('0x9')][_0x18d080]['uniqueid'];var _0x415990=_0x58e093[_0xf37d('0x9')][_0x18d080][_0xf37d('0x1d')];var _0x46c040=_0x58e093[_0xf37d('0x7')][_0x415990]['acwTimeout'];logger[_0xf37d('0x24')](_0xf37d('0x32'),_0x18d080);RpcUser['saveUnpause'](this[_0xf37d('0x8')][_0x18d080]);RpcVoiceAgentReport[_0xf37d('0x33')]({'acwtime':_0x46c040,'agentacw':!![]},_0x2e9704,_0x18d080)['then'](function(_0xef336b){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x2e9704,_0x46c040,_0xef336b);})[_0xf37d('0x34')](function(_0x23b7c9){logger['error'](_0xf37d('0x2e'),_0x2e9704,_0x23b7c9);});}else{logger[_0xf37d('0x2d')](_0xf37d('0x35'),_0x18d080);if(_0x58e093[_0xf37d('0x9')]){logger[_0xf37d('0x24')]('[ACW][TIMERS]',JSON[_0xf37d('0x36')](_0x58e093[_0xf37d('0x9')]));}}}catch(_0xd0683a){logger[_0xf37d('0x2d')](_0xf37d('0x37'),_0xd0683a[_0xf37d('0x38')]);}};Acw[_0xf37d('0x1a')][_0xf37d('0xc')]=function(_0x38ada2){try{if(this[_0xf37d('0x7')][_0x38ada2['queue']]&&this[_0xf37d('0x7')][_0x38ada2[_0xf37d('0x1d')]][_0xf37d('0x3')]){if(this[_0xf37d('0x8')][_0x38ada2[_0xf37d('0x1c')]]){this[_0xf37d('0xa')][_0x38ada2['uniqueid']]={'queue':_0x38ada2[_0xf37d('0x1d')],'interface':_0x38ada2['interface']};}}}catch(_0x2c6018){logger[_0xf37d('0x2d')]('[ACW][syncAgentConnect]\x20%s',_0x2c6018['message']);}};Acw[_0xf37d('0x1a')]['syncAgentConnectPreview']=function(_0x260bfb){try{if(this[_0xf37d('0x7')][_0x260bfb[_0xf37d('0x1d')]]&&this[_0xf37d('0x7')][_0x260bfb[_0xf37d('0x1d')]][_0xf37d('0x3')]){if(this['agents'][_0x260bfb[_0xf37d('0x1c')]]){this[_0xf37d('0xa')][_0x260bfb[_0xf37d('0x2a')]]={'queue':_0x260bfb[_0xf37d('0x1d')],'interface':_0x260bfb[_0xf37d('0x1c')]};}}}catch(_0x9c3395){logger[_0xf37d('0x2d')]('[ACW][syncAgentConnectPreview]\x20%s',_0x9c3395['message']);}};Acw[_0xf37d('0x1a')][_0xf37d('0xf')]=function(_0x52de36){try{if(this[_0xf37d('0xa')][_0x52de36['uniqueid']]&&_[_0xf37d('0x39')](this[_0xf37d('0xa')][_0x52de36[_0xf37d('0x2a')]][_0xf37d('0x3a')])){logger[_0xf37d('0x24')](_0xf37d('0x3b'),_0x52de36['uniqueid']);this[_0xf37d('0x1b')](_0x52de36[_0xf37d('0x2a')]);}else if(this['channels'][_0x52de36['linkedid']]&&_[_0xf37d('0x39')](this[_0xf37d('0xa')][_0x52de36['linkedid']]['attended'])){logger[_0xf37d('0x24')](_0xf37d('0x3c'),_0x52de36[_0xf37d('0x3d')]);this[_0xf37d('0x1b')](_0x52de36[_0xf37d('0x3d')]);}}catch(_0xb8c120){logger[_0xf37d('0x2d')](_0xf37d('0x3e'),_0xb8c120['message']);}};Acw['prototype'][_0xf37d('0x3f')]=function(_0x219a72){try{if(this[_0xf37d('0xa')][_0x219a72[_0xf37d('0x2a')]]&&this['channels'][_0x219a72[_0xf37d('0x2a')]][_0xf37d('0x3a')]){logger[_0xf37d('0x24')](_0xf37d('0x40'),_0x219a72[_0xf37d('0x2a')]);this[_0xf37d('0x1b')](_0x219a72[_0xf37d('0x2a')]);}}catch(_0x4f07e5){logger[_0xf37d('0x2d')]('[ACW][syncHangup]\x20%s',_0x4f07e5[_0xf37d('0x38')]);}};Acw[_0xf37d('0x1a')][_0xf37d('0x13')]=function(_0x1e19f3){try{if(this[_0xf37d('0xa')][_0x1e19f3['origtransfereruniqueid']]){logger[_0xf37d('0x24')](_0xf37d('0x41'),_0x1e19f3[_0xf37d('0x42')]);this[_0xf37d('0x1b')](_0x1e19f3[_0xf37d('0x42')]);}else if(this[_0xf37d('0xa')][_0x1e19f3[_0xf37d('0x43')]]){logger['info'](_0xf37d('0x44'),_0x1e19f3['origtransfererlinkedid']);this[_0xf37d('0x1b')](_0x1e19f3[_0xf37d('0x43')]);}logger['info']('[%s][ATTENDEDTRANSFER:TRANSFERTARGETUNIQUEID]',_0x1e19f3['transfertargetuniqueid']);this[_0xf37d('0xa')][_0x1e19f3['transfertargetuniqueid']]=_['find'](this[_0xf37d('0xa')],[_0xf37d('0x1c'),util[_0xf37d('0x45')](_0xf37d('0x46'),_0x1e19f3[_0xf37d('0x47')])]);if(this[_0xf37d('0xa')][_0x1e19f3[_0xf37d('0x48')]]){this[_0xf37d('0xa')][_0x1e19f3[_0xf37d('0x48')]][_0xf37d('0x3a')]=!![];delete this[_0xf37d('0xa')][_['findKey'](this[_0xf37d('0xa')],[_0xf37d('0x1c'),util[_0xf37d('0x45')](_0xf37d('0x46'),_0x1e19f3['localtwoconnectedlinename'])])];}}catch(_0x561261){logger[_0xf37d('0x2d')](_0xf37d('0x49'),_0x561261['message']);}};Acw['prototype'][_0xf37d('0x14')]=function(_0x36aaa7){try{if(this[_0xf37d('0xa')][_0x36aaa7['transfereruniqueid']]){logger[_0xf37d('0x24')](_0xf37d('0x4a'),JSON[_0xf37d('0x36')](_0x36aaa7['transfereruniqueid']));this[_0xf37d('0x1b')](_0x36aaa7[_0xf37d('0x4b')]);}else if(this['channels'][_0x36aaa7[_0xf37d('0x4c')]]){logger[_0xf37d('0x24')](_0xf37d('0x4d'),JSON[_0xf37d('0x36')](_0x36aaa7['transfererlinkedid']));this[_0xf37d('0x1b')](_0x36aaa7['transfererlinkedid']);}}catch(_0x49ab41){logger[_0xf37d('0x2d')](_0xf37d('0x4e'),_0x49ab41[_0xf37d('0x38')]);}};Acw[_0xf37d('0x1a')]['syncAgentRingNoAnswer']=function(_0x30498c){try{if(this[_0xf37d('0x7')][_0x30498c[_0xf37d('0x1d')]]&&this['voiceQueues'][_0x30498c[_0xf37d('0x1d')]][_0xf37d('0x4f')]===_0xf37d('0x50')){if(this[_0xf37d('0x8')][_0x30498c['interface']]){logger[_0xf37d('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x30498c[_0xf37d('0x2a')],_0x30498c[_0xf37d('0x1c')],_0x30498c['queue']);return RpcUser[_0xf37d('0x51')](this['agents'][_0x30498c[_0xf37d('0x1c')]],_0xf37d('0x52'),_0x30498c[_0xf37d('0x2a')]);}}}catch(_0x4bb61a){logger[_0xf37d('0x2d')](_0xf37d('0x53'),_0x4bb61a[_0xf37d('0x38')]);}};module['exports']=Acw; \ No newline at end of file +var _0xa04a=['acwTimeout','lastPauseAt','updateAcw','uniqueid','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','origtransfereruniqueid','[%s][ATTENDEDTRANSFER:UNIQUEID]','[%s][ATTENDEDTRANSFER:LINKEDID]','origtransfererlinkedid','[%s][ATTENDEDTRANSFER:TRANSFERTARGETUNIQUEID]','transfertargetuniqueid','find','SIP/%s','findKey','format','localtwoconnectedlinename','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','queue','Action','QueuePause','ACW','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','timer','stopAcw'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xa04a,0x139));var _0xaa04=function(_0x13cbfb,_0x5b397d){_0x13cbfb=_0x13cbfb-0x0;var _0x2b4439=_0xa04a[_0x13cbfb];return _0x2b4439;};'use strict';var util=require(_0xaa04('0x0'));var _=require(_0xaa04('0x1'));var moment=require(_0xaa04('0x2'));var ami=require(_0xaa04('0x3'));var logger=require(_0xaa04('0x4'))(_0xaa04('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xaa04('0x6'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function Acw(_0x4db356){this[_0xaa04('0x7')]=_0x4db356[_0xaa04('0x7')];this[_0xaa04('0x8')]=_0x4db356[_0xaa04('0x8')];this['timers']=_0x4db356[_0xaa04('0x9')];this[_0xaa04('0xa')]={};ami['on'](_0xaa04('0xb'),this[_0xaa04('0xc')][_0xaa04('0xd')](this));ami['on'](_0xaa04('0xe'),this['syncHangupRequest'][_0xaa04('0xd')](this));ami['on'](_0xaa04('0xf'),this[_0xaa04('0x10')][_0xaa04('0xd')](this));ami['on'](_0xaa04('0x11'),this[_0xaa04('0x12')]['bind'](this));ami['on'](_0xaa04('0x13'),this[_0xaa04('0x14')][_0xaa04('0xd')](this));ami['on'](_0xaa04('0x15'),this[_0xaa04('0x16')][_0xaa04('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xaa04('0x17')][_0xaa04('0xd')](this));}function getDiff(_0x58e546){var _0x2b7023=moment()[_0xaa04('0x18')](0x0);var _0x1436db=moment(_0x58e546)[_0xaa04('0x18')](0x0);return _0x2b7023[_0xaa04('0x19')](_0x1436db,'seconds');}Acw[_0xaa04('0x1a')]['startAcw']=function(_0x42d15e){try{var _0x5086da=this;var _0x333a6d=this[_0xaa04('0xa')][_0x42d15e]['interface'];var _0x11e2bf=this[_0xaa04('0xa')][_0x42d15e][_0xaa04('0x1b')];ami[_0xaa04('0x1c')]({'action':_0xaa04('0x1d'),'interface':_0x333a6d,'paused':!![],'reason':_0xaa04('0x1e')})[_0xaa04('0x1f')](function(_0x55016b){if(_0x5086da['agents'][_0x333a6d]){return RpcUser[_0xaa04('0x20')](_0x5086da[_0xaa04('0x8')][_0x333a6d]['id'])[_0xaa04('0x1f')](function(_0x527630){if(_0x527630&&!_0x527630[_0xaa04('0x21')]){logger[_0xaa04('0x22')](_0xaa04('0x23'),_0x42d15e,_0x333a6d,_0x11e2bf);return RpcUser[_0xaa04('0x24')](_0x5086da['agents'][_0x333a6d],_0xaa04('0x1e'),_0x42d15e)[_0xaa04('0x1f')](function(_0x16c1d4){_0x5086da[_0xaa04('0x9')][_0x333a6d]={};logger[_0xaa04('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x42d15e,_0x5086da[_0xaa04('0x7')][_0x11e2bf]['acwTimeout'],_0x333a6d,_0x11e2bf);_0x5086da['timers'][_0x333a6d][_0xaa04('0x25')]=setTimeout(_0x5086da[_0xaa04('0x26')][_0xaa04('0xd')](_0x5086da,_0x333a6d),_0x5086da[_0xaa04('0x7')][_0x11e2bf][_0xaa04('0x27')]*0x3e8);_0x5086da[_0xaa04('0x9')][_0x333a6d]['lastPauseAt']=_0x16c1d4[_0xaa04('0x28')];_0x5086da[_0xaa04('0x9')][_0x333a6d]['uniqueid']=_0x42d15e;_0x5086da[_0xaa04('0x9')][_0x333a6d][_0xaa04('0x1b')]=_0x11e2bf;_0x5086da['timers'][_0x333a6d][_0xaa04('0x29')]=function(){var _0x27c2fb=getDiff(_0x5086da[_0xaa04('0x9')][_0x333a6d][_0xaa04('0x28')]);clearTimeout(_0x5086da[_0xaa04('0x9')][_0x333a6d][_0xaa04('0x25')]);RpcVoiceAgentReport['update']({'acwtime':_0x27c2fb},_0x5086da['timers'][_0x333a6d][_0xaa04('0x2a')],_0x333a6d)[_0xaa04('0x1f')](function(_0x404acd){logger[_0xaa04('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x42d15e,_0x27c2fb,_0x404acd);})[_0xaa04('0x2b')](function(_0x2a55aa){logger[_0xaa04('0x2c')](_0xaa04('0x2d'),_0x42d15e,_0x2a55aa);});delete _0x5086da['timers'][_0x333a6d];};});}else{logger[_0xaa04('0x22')](_0xaa04('0x2e'),_0x42d15e,_0x333a6d,_0x11e2bf);}});}})['catch'](function(_0x47271f){logger['error'](_0xaa04('0x2f'),_0x42d15e,_0x5086da['voiceQueues'][_0x11e2bf][_0xaa04('0x27')],_0x333a6d,_0x11e2bf);})[_0xaa04('0x30')](function(){delete _0x5086da['channels'][_0x42d15e];});}catch(_0x23128b){logger[_0xaa04('0x2c')](_0xaa04('0x31'),_0x23128b[_0xaa04('0x32')]);}};Acw[_0xaa04('0x1a')][_0xaa04('0x26')]=function(_0xa56f62){try{var _0x4e5978=this;if(_0x4e5978[_0xaa04('0x9')][_0xa56f62]){var _0x3f32f0=_0x4e5978[_0xaa04('0x9')][_0xa56f62][_0xaa04('0x2a')];var _0x28ddf9=_0x4e5978[_0xaa04('0x9')][_0xa56f62]['queue'];var _0x3cc7ba=_0x4e5978['voiceQueues'][_0x28ddf9][_0xaa04('0x27')];logger[_0xaa04('0x22')](_0xaa04('0x33'),_0xa56f62);RpcUser[_0xaa04('0x34')](this[_0xaa04('0x8')][_0xa56f62]);RpcVoiceAgentReport['update']({'acwtime':_0x3cc7ba,'agentacw':!![]},_0x3f32f0,_0xa56f62)['then'](function(_0x3d70b1){logger[_0xaa04('0x22')](_0xaa04('0x35'),_0x3f32f0,_0x3cc7ba,_0x3d70b1);})[_0xaa04('0x2b')](function(_0x4f64ee){logger[_0xaa04('0x2c')](_0xaa04('0x2d'),_0x3f32f0,_0x4f64ee);});}else{logger['error'](_0xaa04('0x36'),_0xa56f62);if(_0x4e5978[_0xaa04('0x9')]){logger['info'](_0xaa04('0x37'),JSON[_0xaa04('0x38')](_0x4e5978[_0xaa04('0x9')]));}}}catch(_0x15af08){logger[_0xaa04('0x2c')]('[ACW][STOP]\x20%s',_0x15af08[_0xaa04('0x32')]);}};Acw[_0xaa04('0x1a')]['syncAgentConnect']=function(_0xd62ac2){try{if(this['voiceQueues'][_0xd62ac2[_0xaa04('0x1b')]]&&this[_0xaa04('0x7')][_0xd62ac2[_0xaa04('0x1b')]][_0xaa04('0x5')]){if(this[_0xaa04('0x8')][_0xd62ac2[_0xaa04('0x39')]]){this['channels'][_0xd62ac2[_0xaa04('0x2a')]]={'queue':_0xd62ac2[_0xaa04('0x1b')],'interface':_0xd62ac2['interface']};}}}catch(_0x462fb8){logger['error'](_0xaa04('0x3a'),_0x462fb8[_0xaa04('0x32')]);}};Acw[_0xaa04('0x1a')][_0xaa04('0x17')]=function(_0x4a10ca){try{if(this['voiceQueues'][_0x4a10ca[_0xaa04('0x1b')]]&&this[_0xaa04('0x7')][_0x4a10ca[_0xaa04('0x1b')]][_0xaa04('0x5')]){if(this[_0xaa04('0x8')][_0x4a10ca[_0xaa04('0x39')]]){this[_0xaa04('0xa')][_0x4a10ca[_0xaa04('0x2a')]]={'queue':_0x4a10ca[_0xaa04('0x1b')],'interface':_0x4a10ca['interface']};}}}catch(_0x135133){logger[_0xaa04('0x2c')](_0xaa04('0x3b'),_0x135133['message']);}};Acw[_0xaa04('0x1a')][_0xaa04('0x3c')]=function(_0x9773b3){try{if(this[_0xaa04('0xa')][_0x9773b3[_0xaa04('0x2a')]]&&_[_0xaa04('0x3d')](this[_0xaa04('0xa')][_0x9773b3[_0xaa04('0x2a')]]['attended'])){logger[_0xaa04('0x22')](_0xaa04('0x3e'),_0x9773b3[_0xaa04('0x2a')]);this[_0xaa04('0x3f')](_0x9773b3[_0xaa04('0x2a')]);}else if(this[_0xaa04('0xa')][_0x9773b3[_0xaa04('0x40')]]&&_[_0xaa04('0x3d')](this[_0xaa04('0xa')][_0x9773b3[_0xaa04('0x40')]][_0xaa04('0x41')])){logger['info'](_0xaa04('0x42'),_0x9773b3['linkedid']);this[_0xaa04('0x3f')](_0x9773b3[_0xaa04('0x40')]);}}catch(_0x2e2656){logger[_0xaa04('0x2c')](_0xaa04('0x43'),_0x2e2656[_0xaa04('0x32')]);}};Acw[_0xaa04('0x1a')][_0xaa04('0x10')]=function(_0x4a2529){try{if(this[_0xaa04('0xa')][_0x4a2529['uniqueid']]&&this[_0xaa04('0xa')][_0x4a2529[_0xaa04('0x2a')]][_0xaa04('0x41')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x4a2529[_0xaa04('0x2a')]);this[_0xaa04('0x3f')](_0x4a2529[_0xaa04('0x2a')]);}}catch(_0x10692f){logger[_0xaa04('0x2c')](_0xaa04('0x44'),_0x10692f[_0xaa04('0x32')]);}};Acw[_0xaa04('0x1a')][_0xaa04('0x14')]=function(_0x5de3d1){try{if(this[_0xaa04('0xa')][_0x5de3d1[_0xaa04('0x45')]]){logger[_0xaa04('0x22')](_0xaa04('0x46'),_0x5de3d1[_0xaa04('0x45')]);this['startAcw'](_0x5de3d1['origtransfereruniqueid']);}else if(this[_0xaa04('0xa')][_0x5de3d1['origtransfererlinkedid']]){logger[_0xaa04('0x22')](_0xaa04('0x47'),_0x5de3d1['origtransfererlinkedid']);this[_0xaa04('0x3f')](_0x5de3d1[_0xaa04('0x48')]);}logger[_0xaa04('0x22')](_0xaa04('0x49'),_0x5de3d1[_0xaa04('0x4a')]);this[_0xaa04('0xa')][_0x5de3d1[_0xaa04('0x4a')]]=_[_0xaa04('0x4b')](this[_0xaa04('0xa')],[_0xaa04('0x39'),util['format'](_0xaa04('0x4c'),_0x5de3d1['localtwoconnectedlinename'])]);if(this[_0xaa04('0xa')][_0x5de3d1[_0xaa04('0x4a')]]){this[_0xaa04('0xa')][_0x5de3d1[_0xaa04('0x4a')]]['attended']=!![];delete this[_0xaa04('0xa')][_[_0xaa04('0x4d')](this['channels'],['interface',util[_0xaa04('0x4e')]('SIP/%s',_0x5de3d1[_0xaa04('0x4f')])])];}}catch(_0xae2f70){logger[_0xaa04('0x2c')](_0xaa04('0x50'),_0xae2f70['message']);}};Acw['prototype'][_0xaa04('0x16')]=function(_0x1aabf0){try{if(this[_0xaa04('0xa')][_0x1aabf0[_0xaa04('0x51')]]){logger[_0xaa04('0x22')](_0xaa04('0x52'),JSON['stringify'](_0x1aabf0['transfereruniqueid']));this['startAcw'](_0x1aabf0[_0xaa04('0x51')]);}else if(this[_0xaa04('0xa')][_0x1aabf0[_0xaa04('0x53')]]){logger[_0xaa04('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x1aabf0[_0xaa04('0x53')]));this['startAcw'](_0x1aabf0[_0xaa04('0x53')]);}}catch(_0x5297b8){logger[_0xaa04('0x2c')](_0xaa04('0x54'),_0x5297b8[_0xaa04('0x32')]);}};Acw[_0xaa04('0x1a')][_0xaa04('0x12')]=function(_0xe0fc38){try{if(this[_0xaa04('0x7')][_0xe0fc38[_0xaa04('0x1b')]]&&this[_0xaa04('0x7')][_0xe0fc38['queue']][_0xaa04('0x55')]===_0xaa04('0x56')){if(this[_0xaa04('0x8')][_0xe0fc38[_0xaa04('0x39')]]){logger[_0xaa04('0x22')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xe0fc38[_0xaa04('0x2a')],_0xe0fc38[_0xaa04('0x39')],_0xe0fc38[_0xaa04('0x1b')]);return RpcUser[_0xaa04('0x24')](this[_0xaa04('0x8')][_0xe0fc38[_0xaa04('0x39')]],'Auto-Pause',_0xe0fc38[_0xaa04('0x2a')]);}}}catch(_0x434aa1){logger[_0xaa04('0x2c')](_0xaa04('0x57'),_0x434aa1[_0xaa04('0x32')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index eca20e6..3ae5ba0 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 _0x7a54=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','info','action:','SipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','SipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','resolve','then','catch','log','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','../../config/environment','asterisk','port','keepConnected','Action','action'];(function(_0x44b387,_0x15ecb3){var _0x458ed0=function(_0x554ce2){while(--_0x554ce2){_0x44b387['push'](_0x44b387['shift']());}};_0x458ed0(++_0x15ecb3);}(_0x7a54,0x106));var _0x47a5=function(_0x130caa,_0x31da30){_0x130caa=_0x130caa-0x0;var _0x2375ef=_0x7a54[_0x130caa];return _0x2375ef;};'use strict';var Manager=require(_0x47a5('0x0'));var BPromise=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var _=require(_0x47a5('0x3'));var logger=require(_0x47a5('0x4'))('ami');var config=require(_0x47a5('0x5'));var ami=new Manager(config[_0x47a5('0x6')][_0x47a5('0x7')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')]['username'],config[_0x47a5('0x6')]['password'],!![]);ami[_0x47a5('0x8')]();ami[_0x47a5('0x9')]=BPromise['promisify'](ami[_0x47a5('0xa')]);function error(_0x5077f3){logger['error'](util['format'](_0x47a5('0xb'),config[_0x47a5('0x6')]['username'],config[_0x47a5('0x6')]['ip'],config['asterisk']['port'],util[_0x47a5('0xc')](_0x5077f3,![],null)));}function close(){logger[_0x47a5('0xd')](util[_0x47a5('0xe')](_0x47a5('0xf'),config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config['asterisk'][_0x47a5('0x7')]));}ami[_0x47a5('0x11')]=function(){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x47a5('0x14'));return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x15')});};};ami[_0x47a5('0x16')]=function(){logger['info'](_0x47a5('0x13'),_0x47a5('0x14'));return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x17')});};};ami[_0x47a5('0x18')]=function(){logger['info']('action:',_0x47a5('0x19'));return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x47a5('0x1a')]=function(){return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x1b')});};};ami[_0x47a5('0x1c')]=function(){return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x1d')});};};function connect(_0x2763d6){logger[_0x47a5('0x12')](util[_0x47a5('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config['asterisk']['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')]));ami[_0x47a5('0x1e')]('error',error);ami[_0x47a5('0x1e')](_0x47a5('0x1f'),close);}ami['on'](_0x47a5('0x20'),connect);ami['on'](_0x47a5('0x21'),function(_0x5ef1b1){logger[_0x47a5('0x12')](util[_0x47a5('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')],util['inspect'](_0x5ef1b1,![],null)));});ami['on']('fullybooted',function(_0x136745){logger['info'](util[_0x47a5('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')]));return BPromise[_0x47a5('0x22')]()[_0x47a5('0x23')](ami[_0x47a5('0x11')]())[_0x47a5('0x23')](ami[_0x47a5('0x16')]())[_0x47a5('0x23')](ami[_0x47a5('0x18')]())[_0x47a5('0x23')](ami['actionQueueSummary']())[_0x47a5('0x23')](ami['actionCoreShowChannels']())[_0x47a5('0x24')](function(_0x9ac908){console[_0x47a5('0x25')](_0x9ac908);});});ami['once'](_0x47a5('0xd'),error);ami[_0x47a5('0x1e')](_0x47a5('0x1f'),close);module[_0x47a5('0x26')]=ami; \ No newline at end of file +var _0x7a54=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','info','action:','SipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','SipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','resolve','then','catch','log','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','../../config/environment','asterisk','port','keepConnected','Action','action'];(function(_0x17d314,_0x4c6cc8){var _0x58e7d3=function(_0x33a2c3){while(--_0x33a2c3){_0x17d314['push'](_0x17d314['shift']());}};_0x58e7d3(++_0x4c6cc8);}(_0x7a54,0x106));var _0x47a5=function(_0x3e9886,_0x5dcd80){_0x3e9886=_0x3e9886-0x0;var _0x470e73=_0x7a54[_0x3e9886];return _0x470e73;};'use strict';var Manager=require(_0x47a5('0x0'));var BPromise=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var _=require(_0x47a5('0x3'));var logger=require(_0x47a5('0x4'))('ami');var config=require(_0x47a5('0x5'));var ami=new Manager(config[_0x47a5('0x6')][_0x47a5('0x7')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')]['username'],config[_0x47a5('0x6')]['password'],!![]);ami[_0x47a5('0x8')]();ami[_0x47a5('0x9')]=BPromise['promisify'](ami[_0x47a5('0xa')]);function error(_0x5077f3){logger['error'](util['format'](_0x47a5('0xb'),config[_0x47a5('0x6')]['username'],config[_0x47a5('0x6')]['ip'],config['asterisk']['port'],util[_0x47a5('0xc')](_0x5077f3,![],null)));}function close(){logger[_0x47a5('0xd')](util[_0x47a5('0xe')](_0x47a5('0xf'),config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config['asterisk'][_0x47a5('0x7')]));}ami[_0x47a5('0x11')]=function(){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x47a5('0x14'));return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x15')});};};ami[_0x47a5('0x16')]=function(){logger['info'](_0x47a5('0x13'),_0x47a5('0x14'));return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x17')});};};ami[_0x47a5('0x18')]=function(){logger['info']('action:',_0x47a5('0x19'));return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x47a5('0x1a')]=function(){return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x1b')});};};ami[_0x47a5('0x1c')]=function(){return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x1d')});};};function connect(_0x2763d6){logger[_0x47a5('0x12')](util[_0x47a5('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config['asterisk']['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')]));ami[_0x47a5('0x1e')]('error',error);ami[_0x47a5('0x1e')](_0x47a5('0x1f'),close);}ami['on'](_0x47a5('0x20'),connect);ami['on'](_0x47a5('0x21'),function(_0x5ef1b1){logger[_0x47a5('0x12')](util[_0x47a5('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')],util['inspect'](_0x5ef1b1,![],null)));});ami['on']('fullybooted',function(_0x136745){logger['info'](util[_0x47a5('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')]));return BPromise[_0x47a5('0x22')]()[_0x47a5('0x23')](ami[_0x47a5('0x11')]())[_0x47a5('0x23')](ami[_0x47a5('0x16')]())[_0x47a5('0x23')](ami[_0x47a5('0x18')]())[_0x47a5('0x23')](ami['actionQueueSummary']())[_0x47a5('0x23')](ami['actionCoreShowChannels']())[_0x47a5('0x24')](function(_0x9ac908){console[_0x47a5('0x25')](_0x9ac908);});});ami['once'](_0x47a5('0xd'),error);ami[_0x47a5('0x1e')](_0x47a5('0x1f'),close);module[_0x47a5('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2172dfd..57b9685 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 _0x40ab=['request','then','debug','rpc','error','memberReport','message','exports','jayson/promise','bluebird','../../config/logger','ami','client','http','Request'];(function(_0x22e69c,_0x77e0aa){var _0xfc34ec=function(_0x57c873){while(--_0x57c873){_0x22e69c['push'](_0x22e69c['shift']());}};_0xfc34ec(++_0x77e0aa);}(_0x40ab,0x152));var _0xb40a=function(_0x313b00,_0x315f8d){_0x313b00=_0x313b00-0x0;var _0x35245f=_0x40ab[_0x313b00];return _0x35245f;};'use strict';var jayson=require(_0xb40a('0x0'));var BPromise=require(_0xb40a('0x1'));var logger=require(_0xb40a('0x2'))(_0xb40a('0x3'));var client=jayson[_0xb40a('0x4')][_0xb40a('0x5')]({'port':0x2329});client[_0xb40a('0x6')]=function(_0x6e0554,_0x55eee6){return new BPromise(function(_0x832b52,_0x2d03fb){return client[_0xb40a('0x7')](_0x6e0554,_0x55eee6)[_0xb40a('0x8')](function(_0xe97153){logger[_0xb40a('0x9')](_0xb40a('0xa'),'memberReport',_0x6e0554,_0x55eee6,_0xe97153);if(_0xe97153[_0xb40a('0xb')]){logger[_0xb40a('0xb')]('rpc',_0xb40a('0xc'),_0x6e0554,_0xe97153[_0xb40a('0xb')][_0xb40a('0xd')],_0x55eee6);return _0x2d03fb(_0xe97153[_0xb40a('0xb')][_0xb40a('0xd')]);}else{return _0x832b52(_0xe97153['result']);}})['catch'](function(_0x33e6a8){logger[_0xb40a('0xb')](_0xb40a('0xa'),_0xb40a('0xc'),_0x6e0554,_0x33e6a8,_0x55eee6);return _0x2d03fb(_0x33e6a8);});});};module[_0xb40a('0xe')]=client; \ No newline at end of file +var _0x37a5=['request','then','memberReport','error','rpc','message','result','exports','../../config/logger','client','http','Request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x37a5,0x188));var _0x537a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x37a5[_0x3d42d8];return _0x27fc41;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x537a('0x0'))('ami');var client=jayson[_0x537a('0x1')][_0x537a('0x2')]({'port':0x2329});client[_0x537a('0x3')]=function(_0x486ece,_0x24f41){return new BPromise(function(_0x3f9efb,_0x313628){return client[_0x537a('0x4')](_0x486ece,_0x24f41)[_0x537a('0x5')](function(_0x4ecc22){logger['debug']('rpc',_0x537a('0x6'),_0x486ece,_0x24f41,_0x4ecc22);if(_0x4ecc22[_0x537a('0x7')]){logger[_0x537a('0x7')](_0x537a('0x8'),_0x537a('0x6'),_0x486ece,_0x4ecc22['error'][_0x537a('0x9')],_0x24f41);return _0x313628(_0x4ecc22['error'][_0x537a('0x9')]);}else{return _0x3f9efb(_0x4ecc22[_0x537a('0xa')]);}})['catch'](function(_0x54c47f){logger[_0x537a('0x7')](_0x537a('0x8'),_0x537a('0x6'),_0x486ece,_0x54c47f,_0x24f41);return _0x313628(_0x54c47f);});});};module[_0x537a('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 754e19b..9a6a325 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 _0x05bc=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xc05b('0x0'));var moment=require('moment');function checkNameSurname(_0x1ece7f,_0x2762de,_0x59d194){var _0x36c0ca='';if(!_[_0xc05b('0x1')](_0x2762de)&&_0xc05b('0x2')===typeof _0x2762de){_0x36c0ca+=_0x2762de;}if(!_[_0xc05b('0x1')](_0x59d194)&&_0xc05b('0x2')===typeof _0x59d194){_0x36c0ca+='\x20'+_0x59d194;}if(_0x36c0ca!==''){return _0x36c0ca;}return _0x1ece7f;}function Action(_0x46d195,_0x2514a1,_0x22c8db){this[_0xc05b('0x3')]=_0x46d195;this[_0xc05b('0x4')]=_0x22c8db||undefined;this[_0xc05b('0x5')]=checkNameSurname(_0x2514a1[_0xc05b('0x6')][_0xc05b('0x7')],_0x2514a1[_0xc05b('0x6')]['firstName'],_0x2514a1['Contact'][_0xc05b('0x8')]);this[_0xc05b('0x9')]=_0x2514a1[_0xc05b('0x6')][_0xc05b('0x7')];this[_0xc05b('0xa')]=_0x46d195[_0xc05b('0x5')];this[_0xc05b('0xb')]=_0x2514a1[_0xc05b('0xb')]||![];this[_0xc05b('0xc')]=_0x46d195['type'];this[_0xc05b('0xd')]=_0x46d195[_0xc05b('0xd')]||0x3;this[_0xc05b('0xe')]=_0x2514a1[_0xc05b('0xe')];this[_0xc05b('0xf')]=_0x2514a1[_0xc05b('0xf')];this['countcongestionretry']=_0x2514a1[_0xc05b('0x10')];this[_0xc05b('0x11')]=_0x2514a1['countnoanswerretry'];this['ContactId']=_0x2514a1[_0xc05b('0x12')];this[_0xc05b('0x13')]=_0x2514a1[_0xc05b('0x13')];this[_0xc05b('0x14')]=_0x2514a1[_0xc05b('0x14')];this[_0xc05b('0x15')]=_0x2514a1[_0xc05b('0x15')];this['CampaignId']=_0x2514a1[_0xc05b('0x16')];this[_0xc05b('0x17')]=_0x2514a1['id'];this[_0xc05b('0x18')]=_0x2514a1[_0xc05b('0x6')][_0xc05b('0x19')]||'';this[_0xc05b('0x1a')]=moment()['format'](_0xc05b('0x1b'));this['callback']=_0x2514a1[_0xc05b('0x1c')];this[_0xc05b('0x1d')]=_0x2514a1[_0xc05b('0x1d')];this[_0xc05b('0x1e')]=_0x2514a1[_0xc05b('0x1e')];this['recallme']=_0x2514a1[_0xc05b('0x1f')];this[_0xc05b('0x20')]='';this[_0xc05b('0x21')]='';}Action[_0xc05b('0x22')]['getCaller']=function(){return util[_0xc05b('0x23')](_0xc05b('0x24'),this[_0xc05b('0x5')],this[_0xc05b('0x3')][_0xc05b('0x25')]>0x0?this[_0xc05b('0x9')]['substring'](this['voiceQueue'][_0xc05b('0x25')]):this[_0xc05b('0x9')]);};Action['prototype'][_0xc05b('0x26')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0xa630=['number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','util','lodash','string','isNil','voiceQueue','uniqueid','name','Contact','phone','lastName'];(function(_0x35027c,_0x4af623){var _0x4bba7d=function(_0x1d84f9){while(--_0x1d84f9){_0x35027c['push'](_0x35027c['shift']());}};_0x4bba7d(++_0x4af623);}(_0xa630,0xbe));var _0x0a63=function(_0x3cc126,_0x4e0bd9){_0x3cc126=_0x3cc126-0x0;var _0x568ca5=_0xa630[_0x3cc126];return _0x568ca5;};'use strict';var util=require(_0x0a63('0x0'));var _=require(_0x0a63('0x1'));var moment=require('moment');function checkNameSurname(_0x52ad93,_0x1a9586,_0x4f6b34){var _0xd0a045='';if(!_['isNil'](_0x1a9586)&&_0x0a63('0x2')===typeof _0x1a9586){_0xd0a045+=_0x1a9586;}if(!_[_0x0a63('0x3')](_0x4f6b34)&&_0x0a63('0x2')===typeof _0x4f6b34){_0xd0a045+='\x20'+_0x4f6b34;}if(_0xd0a045!==''){return _0xd0a045;}return _0x52ad93;}function Action(_0x2380f8,_0x37b4c9,_0x4b7474){this[_0x0a63('0x4')]=_0x2380f8;this[_0x0a63('0x5')]=_0x4b7474||undefined;this[_0x0a63('0x6')]=checkNameSurname(_0x37b4c9[_0x0a63('0x7')][_0x0a63('0x8')],_0x37b4c9[_0x0a63('0x7')]['firstName'],_0x37b4c9[_0x0a63('0x7')][_0x0a63('0x9')]);this[_0x0a63('0xa')]=_0x37b4c9[_0x0a63('0x7')][_0x0a63('0x8')];this[_0x0a63('0xb')]=_0x2380f8[_0x0a63('0x6')];this[_0x0a63('0xc')]=_0x37b4c9[_0x0a63('0xc')]||![];this[_0x0a63('0xd')]=_0x2380f8['type'];this[_0x0a63('0xe')]=_0x2380f8[_0x0a63('0xe')]||0x3;this[_0x0a63('0xf')]=_0x37b4c9[_0x0a63('0xf')];this['countbusyretry']=_0x37b4c9[_0x0a63('0x10')];this['countcongestionretry']=_0x37b4c9[_0x0a63('0x11')];this[_0x0a63('0x12')]=_0x37b4c9[_0x0a63('0x12')];this[_0x0a63('0x13')]=_0x37b4c9[_0x0a63('0x13')];this[_0x0a63('0x14')]=_0x37b4c9[_0x0a63('0x14')];this[_0x0a63('0x15')]=_0x37b4c9['UserId'];this[_0x0a63('0x16')]=_0x37b4c9['VoiceQueueId'];this[_0x0a63('0x17')]=_0x37b4c9[_0x0a63('0x17')];this[_0x0a63('0x18')]=_0x37b4c9['id'];this[_0x0a63('0x19')]=_0x37b4c9[_0x0a63('0x7')][_0x0a63('0x1a')]||'';this[_0x0a63('0x1b')]=moment()[_0x0a63('0x1c')](_0x0a63('0x1d'));this[_0x0a63('0x1e')]=_0x37b4c9[_0x0a63('0x1e')];this['callbackuniqueid']=_0x37b4c9['callbackuniqueid'];this[_0x0a63('0x1f')]=_0x37b4c9['callbackat'];this[_0x0a63('0x20')]=_0x37b4c9['recallme'];this[_0x0a63('0x21')]='';this[_0x0a63('0x22')]='';}Action[_0x0a63('0x23')][_0x0a63('0x24')]=function(){return util['format'](_0x0a63('0x25'),this['name'],this[_0x0a63('0x4')][_0x0a63('0x26')]>0x0?this[_0x0a63('0xa')][_0x0a63('0x27')](this[_0x0a63('0x4')][_0x0a63('0x26')]):this[_0x0a63('0xa')]);};Action[_0x0a63('0x23')]['getQueue']=function(){return this['queue'];};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 c9fdcbf..2c447d0 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 _0x89f2=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countnoanswerretry','countglobal','countbusyretry','countcongestionretry'];(function(_0x3fd837,_0x1e9bc4){var _0x450dfd=function(_0x518a7c){while(--_0x518a7c){_0x3fd837['push'](_0x3fd837['shift']());}};_0x450dfd(++_0x1e9bc4);}(_0x89f2,0x147));var _0x289f=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x89f2[_0xd1d19a];return _0x52a79d;};'use strict';var util=require('util');var _=require(_0x289f('0x0'));var moment=require(_0x289f('0x1'));function getSeconds(_0xdf3156,_0x23ffce){var _0x2d2e62=moment(_0xdf3156)['milliseconds'](0x0);var _0xec5203=moment(_0x23ffce)[_0x289f('0x2')](0x0);return _0x2d2e62[_0x289f('0x3')](_0xec5203,_0x289f('0x4'));}function AgentComplete(_0x566473,_0x24c504){this[_0x289f('0x5')]=0x4;this[_0x289f('0x6')]=_0x289f('0x7');this['scheduledat']=_0x566473[_0x289f('0x8')];this[_0x289f('0x9')]=_0x566473[_0x289f('0x9')];this[_0x289f('0xa')]=_0x566473[_0x289f('0x9')]===_0x289f('0xb')?_0x289f('0xc'):_0x566473[_0x289f('0x9')];this['countbusyretry']=_0x566473['countbusyretry'];this['countcongestionretry']=_0x566473['countcongestionretry'];this[_0x289f('0xd')]=_0x566473[_0x289f('0xd')];this[_0x289f('0xe')]=_0x566473[_0x289f('0xf')]+_0x566473[_0x289f('0x10')]+_0x566473[_0x289f('0xd')];this[_0x289f('0x11')]=_0x24c504['uniqueid'];this[_0x289f('0x12')]=_0x566473[_0x289f('0x13')];this[_0x289f('0x14')]=_0x566473[_0x289f('0x15')];this['starttime']=_0x566473[_0x289f('0x16')];this['responsetime']=_0x566473[_0x289f('0x17')];this['answertime']=_0x566473[_0x289f('0x18')];this[_0x289f('0x19')]=moment()[_0x289f('0x1a')](_0x289f('0x1b'));this[_0x289f('0x1c')]=getSeconds(_0x566473[_0x289f('0x17')],_0x566473['starttime']);this[_0x289f('0x1d')]=getSeconds(_0x566473[_0x289f('0x18')],_0x566473[_0x289f('0x17')]);this['talktime']=getSeconds(this[_0x289f('0x19')],_0x566473[_0x289f('0x18')]);this[_0x289f('0xc')]=_0x24c504['queue'];this[_0x289f('0x1e')]=_0x24c504[_0x289f('0x1e')];this[_0x289f('0x1f')]=_0x24c504['reason'];this[_0x289f('0x20')]=_0x566473[_0x289f('0x20')];this[_0x289f('0x21')]=_0x566473['callbackuniqueid'];this[_0x289f('0x22')]=_0x566473[_0x289f('0x22')];this[_0x289f('0x23')]=_0x566473[_0x289f('0x23')];this['ContactId']=_0x566473[_0x289f('0x24')];this[_0x289f('0x25')]=_0x566473['ListId'];this[_0x289f('0x26')]=_0x566473[_0x289f('0x26')];this[_0x289f('0x27')]=_0x566473[_0x289f('0x27')];this[_0x289f('0x28')]=_0x566473[_0x289f('0x28')];this[_0x289f('0x29')]=_0x566473[_0x289f('0x29')]||'';this['originatecalleridname']=_0x566473[_0x289f('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x5db0=['name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid'];(function(_0x186400,_0x22a10d){var _0x1dc6f4=function(_0x3422a4){while(--_0x3422a4){_0x186400['push'](_0x186400['shift']());}};_0x1dc6f4(++_0x22a10d);}(_0x5db0,0x1b2));var _0x05db=function(_0x302e96,_0x5067b6){_0x302e96=_0x302e96-0x0;var _0x109692=_0x5db0[_0x302e96];return _0x109692;};'use strict';var util=require(_0x05db('0x0'));var _=require(_0x05db('0x1'));var moment=require(_0x05db('0x2'));function getSeconds(_0xc69bfb,_0xaab9bf){var _0x391d8a=moment(_0xc69bfb)[_0x05db('0x3')](0x0);var _0x345b05=moment(_0xaab9bf)['milliseconds'](0x0);return _0x391d8a[_0x05db('0x4')](_0x345b05,'seconds');}function AgentComplete(_0x2199a2,_0x22f5ec){this['state']=0x4;this[_0x05db('0x5')]=_0x05db('0x6');this[_0x05db('0x7')]=_0x2199a2['scheduledat'];this[_0x05db('0x8')]=_0x2199a2['type'];this[_0x05db('0x9')]=_0x2199a2[_0x05db('0x8')]===_0x05db('0xa')?_0x05db('0xb'):_0x2199a2[_0x05db('0x8')];this[_0x05db('0xc')]=_0x2199a2['countbusyretry'];this[_0x05db('0xd')]=_0x2199a2['countcongestionretry'];this[_0x05db('0xe')]=_0x2199a2[_0x05db('0xe')];this[_0x05db('0xf')]=_0x2199a2['countbusyretry']+_0x2199a2[_0x05db('0xd')]+_0x2199a2[_0x05db('0xe')];this['uniqueid']=_0x22f5ec[_0x05db('0x10')];this['calleridname']=_0x2199a2[_0x05db('0x11')];this['calleridnum']=_0x2199a2[_0x05db('0x12')];this[_0x05db('0x13')]=_0x2199a2['starttime'];this[_0x05db('0x14')]=_0x2199a2['responsetime'];this[_0x05db('0x15')]=_0x2199a2['answertime'];this[_0x05db('0x16')]=moment()[_0x05db('0x17')](_0x05db('0x18'));this[_0x05db('0x19')]=getSeconds(_0x2199a2[_0x05db('0x14')],_0x2199a2[_0x05db('0x13')]);this[_0x05db('0x1a')]=getSeconds(_0x2199a2[_0x05db('0x15')],_0x2199a2[_0x05db('0x14')]);this['talktime']=getSeconds(this[_0x05db('0x16')],_0x2199a2[_0x05db('0x15')]);this[_0x05db('0xb')]=_0x22f5ec[_0x05db('0xb')];this[_0x05db('0x1b')]=_0x22f5ec[_0x05db('0x1b')];this[_0x05db('0x1c')]=_0x22f5ec['reason'];this[_0x05db('0x1d')]=_0x2199a2[_0x05db('0x1d')];this[_0x05db('0x1e')]=_0x2199a2[_0x05db('0x1e')];this[_0x05db('0x1f')]=_0x2199a2[_0x05db('0x1f')];this[_0x05db('0x20')]=_0x2199a2[_0x05db('0x20')];this[_0x05db('0x21')]=_0x2199a2['ContactId'];this[_0x05db('0x22')]=_0x2199a2[_0x05db('0x22')];this[_0x05db('0x23')]=_0x2199a2[_0x05db('0x23')];this[_0x05db('0x24')]=_0x2199a2[_0x05db('0x24')];this['CampaignId']=_0x2199a2[_0x05db('0x25')];this[_0x05db('0x26')]=_0x2199a2['originatecalleridnum']||'';this[_0x05db('0x27')]=_0x2199a2[_0x05db('0x27')]||'';}module[_0x05db('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 50ca71a..a7e1ae1 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 _0x1228=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','calleridname','calleridnum','starttime'];(function(_0x179f20,_0x3e7a96){var _0x2afe43=function(_0x4579c5){while(--_0x4579c5){_0x179f20['push'](_0x179f20['shift']());}};_0x2afe43(++_0x3e7a96);}(_0x1228,0x12f));var _0x8122=function(_0xe15787,_0x477c83){_0xe15787=_0xe15787-0x0;var _0x3c9449=_0x1228[_0xe15787];return _0x3c9449;};'use strict';var util=require(_0x8122('0x0'));var _=require('lodash');var moment=require(_0x8122('0x1'));function getSeconds(_0x57c278,_0x3ecf7e){var _0x4400e7=moment(_0x57c278)[_0x8122('0x2')](0x0);var _0x49a540=moment(_0x3ecf7e)[_0x8122('0x2')](0x0);return _0x4400e7[_0x8122('0x3')](_0x49a540,'seconds');}function Final(_0x274936){this[_0x8122('0x4')]=_0x274936['uniqueid'];this[_0x8122('0x5')]=_0x274936[_0x8122('0x5')];this['type']=_0x274936[_0x8122('0x6')];this[_0x8122('0x7')]=_0x274936['type']===_0x8122('0x8')?_0x8122('0x9'):_0x274936['type'];this['countbusyretry']=_0x274936['countbusyretry'];this['countcongestionretry']=_0x274936[_0x8122('0xa')];this['countnoanswerretry']=_0x274936[_0x8122('0xb')];this[_0x8122('0xc')]=_0x274936[_0x8122('0xd')]+_0x274936['countcongestionretry']+_0x274936[_0x8122('0xb')];this['queue']=_0x274936[_0x8122('0x9')];this[_0x8122('0xe')]=_0x274936[_0x8122('0xe')];this[_0x8122('0xf')]=_0x274936[_0x8122('0xf')];this[_0x8122('0x10')]=_0x274936[_0x8122('0x10')];this[_0x8122('0x11')]=_0x274936[_0x8122('0x11')];this[_0x8122('0x12')]=_0x274936[_0x8122('0x11')];this[_0x8122('0x13')]=_0x274936['ringtime']||0x0;this[_0x8122('0x14')]=_0x274936['holdtime']||0x0;this[_0x8122('0x15')]=_0x274936['talktime']||0x0;this[_0x8122('0x16')]=_0x274936[_0x8122('0x16')];this[_0x8122('0x17')]=_0x274936[_0x8122('0x17')];this['callbackat']=_0x274936['callbackat'];this['recallme']=_0x274936['recallme'];this[_0x8122('0x18')]=_0x274936[_0x8122('0x18')];this[_0x8122('0x19')]=_0x274936['ListId'];this['UserId']=_0x274936[_0x8122('0x1a')];this[_0x8122('0x1b')]=_0x274936[_0x8122('0x1b')];this['CampaignId']=_0x274936[_0x8122('0x1c')];this[_0x8122('0x1d')]=_0x274936[_0x8122('0x1d')]||'';this[_0x8122('0x1e')]=_0x274936[_0x8122('0x1e')]||'';}module[_0x8122('0x1f')]=Final; \ No newline at end of file +var _0x6829=['originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0xa34270,_0x35a055){var _0x1e0a05=function(_0x1f3719){while(--_0x1f3719){_0xa34270['push'](_0xa34270['shift']());}};_0x1e0a05(++_0x35a055);}(_0x6829,0x14c));var _0x9682=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x6829[_0x45d3f0];return _0x314b79;};'use strict';var util=require(_0x9682('0x0'));var _=require(_0x9682('0x1'));var moment=require('moment');function getSeconds(_0x5d8a24,_0x4d254c){var _0xa4de43=moment(_0x5d8a24)[_0x9682('0x2')](0x0);var _0x1bfe61=moment(_0x4d254c)[_0x9682('0x2')](0x0);return _0xa4de43[_0x9682('0x3')](_0x1bfe61,_0x9682('0x4'));}function Final(_0x33a972){this[_0x9682('0x5')]=_0x33a972[_0x9682('0x5')];this[_0x9682('0x6')]=_0x33a972[_0x9682('0x6')];this[_0x9682('0x7')]=_0x33a972['type'];this['campaigntype']=_0x33a972['type']===_0x9682('0x8')?_0x9682('0x9'):_0x33a972['type'];this[_0x9682('0xa')]=_0x33a972['countbusyretry'];this[_0x9682('0xb')]=_0x33a972['countcongestionretry'];this[_0x9682('0xc')]=_0x33a972[_0x9682('0xc')];this[_0x9682('0xd')]=_0x33a972['countbusyretry']+_0x33a972['countcongestionretry']+_0x33a972[_0x9682('0xc')];this[_0x9682('0x9')]=_0x33a972['queue'];this[_0x9682('0xe')]=_0x33a972['calleridname'];this[_0x9682('0xf')]=_0x33a972[_0x9682('0xf')];this[_0x9682('0x10')]=_0x33a972[_0x9682('0x10')];this[_0x9682('0x11')]=_0x33a972[_0x9682('0x11')];this[_0x9682('0x12')]=_0x33a972[_0x9682('0x11')];this[_0x9682('0x13')]=_0x33a972[_0x9682('0x13')]||0x0;this['holdtime']=_0x33a972[_0x9682('0x14')]||0x0;this['talktime']=_0x33a972[_0x9682('0x15')]||0x0;this[_0x9682('0x16')]=_0x33a972[_0x9682('0x16')];this['callbackuniqueid']=_0x33a972[_0x9682('0x17')];this['callbackat']=_0x33a972[_0x9682('0x18')];this['recallme']=_0x33a972[_0x9682('0x19')];this[_0x9682('0x1a')]=_0x33a972[_0x9682('0x1a')];this[_0x9682('0x1b')]=_0x33a972[_0x9682('0x1b')];this['UserId']=_0x33a972['UserId'];this['VoiceQueueId']=_0x33a972[_0x9682('0x1c')];this['CampaignId']=_0x33a972[_0x9682('0x1d')];this[_0x9682('0x1e')]=_0x33a972['originatecalleridnum']||'';this[_0x9682('0x1f')]=_0x33a972[_0x9682('0x1f')]||'';}module[_0x9682('0x20')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 211d4e5..1503d9b 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(_0x581d90,_0x40fa2a){var _0x39247f=function(_0x2dfc96){while(--_0x2dfc96){_0x581d90['push'](_0x581d90['shift']());}};_0x39247f(++_0x40fa2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x3ee905,_0xdf66f1){var _0x216b78=function(_0x2a5a92){while(--_0x2a5a92){_0x3ee905['push'](_0x3ee905['shift']());}};_0x216b78(++_0xdf66f1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 3770072..e4f06cf 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 _0xf373=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','calleridname','name','calleridnum'];(function(_0xb42239,_0x3b93b8){var _0x5ba924=function(_0x52cf29){while(--_0x52cf29){_0xb42239['push'](_0xb42239['shift']());}};_0x5ba924(++_0x3b93b8);}(_0xf373,0x1b6));var _0x3f37=function(_0x272bd6,_0x2b50b5){_0x272bd6=_0x272bd6-0x0;var _0x3f1c80=_0xf373[_0x272bd6];return _0x3f1c80;};'use strict';var util=require(_0x3f37('0x0'));var _=require(_0x3f37('0x1'));var moment=require(_0x3f37('0x2'));function getSeconds(_0x449082,_0x5228e6){var _0x9c1a1d=moment(_0x449082)[_0x3f37('0x3')](0x0);var _0x52c68b=moment(_0x5228e6)['milliseconds'](0x0);return _0x9c1a1d[_0x3f37('0x4')](_0x52c68b,_0x3f37('0x5'));}function History(_0xcd583d){this[_0x3f37('0x6')]=_0xcd583d[_0x3f37('0x6')];this[_0x3f37('0x7')]=_0xcd583d[_0x3f37('0x7')]||undefined;this[_0x3f37('0x8')]=_0xcd583d[_0x3f37('0x8')];this[_0x3f37('0x9')]=_0xcd583d[_0x3f37('0x8')]==='outbound'?_0x3f37('0xa'):_0xcd583d['type'];this[_0x3f37('0xb')]=_0xcd583d[_0x3f37('0xb')];this[_0x3f37('0xc')]=_0xcd583d[_0x3f37('0xc')];this[_0x3f37('0xd')]=_0xcd583d[_0x3f37('0xd')];this['countglobal']=_0xcd583d[_0x3f37('0xb')]+_0xcd583d['countcongestionretry']+_0xcd583d[_0x3f37('0xd')];this['queue']=_0xcd583d[_0x3f37('0xa')];this[_0x3f37('0xe')]=_0xcd583d[_0x3f37('0xf')];this[_0x3f37('0x10')]=_0xcd583d['number'];this[_0x3f37('0x11')]=_0xcd583d['starttime'];this[_0x3f37('0x12')]=_0xcd583d[_0x3f37('0x12')];this[_0x3f37('0x13')]=_0xcd583d['responsetime'];this[_0x3f37('0x14')]=getSeconds(_0xcd583d[_0x3f37('0x12')],_0xcd583d['starttime']);this[_0x3f37('0x15')]=0x0;this[_0x3f37('0x16')]=0x0;this[_0x3f37('0x17')]=_0xcd583d[_0x3f37('0x17')];this['callbackuniqueid']=_0xcd583d[_0x3f37('0x18')];this[_0x3f37('0x19')]=_0xcd583d[_0x3f37('0x19')];this['recallme']=_0xcd583d[_0x3f37('0x1a')];this[_0x3f37('0x1b')]=_0xcd583d['ContactId'];this[_0x3f37('0x1c')]=_0xcd583d[_0x3f37('0x1c')];this['UserId']=_0xcd583d[_0x3f37('0x1d')];this['VoiceQueueId']=_0xcd583d[_0x3f37('0x1e')];this[_0x3f37('0x1f')]=_0xcd583d[_0x3f37('0x1f')];this[_0x3f37('0x20')]=_0xcd583d[_0x3f37('0x20')]||'';this[_0x3f37('0x21')]=_0xcd583d[_0x3f37('0x21')]||'';}module[_0x3f37('0x22')]=History; \ No newline at end of file +var _0x52e1=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','name','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x3af749,_0x342a60){var _0xe297d4=function(_0x4e74f3){while(--_0x4e74f3){_0x3af749['push'](_0x3af749['shift']());}};_0xe297d4(++_0x342a60);}(_0x52e1,0x1d2));var _0x152e=function(_0x16c314,_0x4bcd8e){_0x16c314=_0x16c314-0x0;var _0x1b0580=_0x52e1[_0x16c314];return _0x1b0580;};'use strict';var util=require(_0x152e('0x0'));var _=require('lodash');var moment=require(_0x152e('0x1'));function getSeconds(_0x403753,_0x3e9019){var _0x1ca279=moment(_0x403753)[_0x152e('0x2')](0x0);var _0xcb6a10=moment(_0x3e9019)['milliseconds'](0x0);return _0x1ca279[_0x152e('0x3')](_0xcb6a10,_0x152e('0x4'));}function History(_0x3d4b6a){this[_0x152e('0x5')]=_0x3d4b6a[_0x152e('0x5')];this[_0x152e('0x6')]=_0x3d4b6a[_0x152e('0x6')]||undefined;this[_0x152e('0x7')]=_0x3d4b6a[_0x152e('0x7')];this[_0x152e('0x8')]=_0x3d4b6a[_0x152e('0x7')]===_0x152e('0x9')?_0x152e('0xa'):_0x3d4b6a['type'];this['countbusyretry']=_0x3d4b6a[_0x152e('0xb')];this[_0x152e('0xc')]=_0x3d4b6a[_0x152e('0xc')];this[_0x152e('0xd')]=_0x3d4b6a[_0x152e('0xd')];this[_0x152e('0xe')]=_0x3d4b6a[_0x152e('0xb')]+_0x3d4b6a[_0x152e('0xc')]+_0x3d4b6a[_0x152e('0xd')];this[_0x152e('0xa')]=_0x3d4b6a[_0x152e('0xa')];this[_0x152e('0xf')]=_0x3d4b6a[_0x152e('0x10')];this['calleridnum']=_0x3d4b6a['number'];this[_0x152e('0x11')]=_0x3d4b6a[_0x152e('0x11')];this[_0x152e('0x12')]=_0x3d4b6a[_0x152e('0x12')];this[_0x152e('0x13')]=_0x3d4b6a[_0x152e('0x12')];this[_0x152e('0x14')]=getSeconds(_0x3d4b6a['responsetime'],_0x3d4b6a['starttime']);this[_0x152e('0x15')]=0x0;this[_0x152e('0x16')]=0x0;this[_0x152e('0x17')]=_0x3d4b6a[_0x152e('0x17')];this[_0x152e('0x18')]=_0x3d4b6a[_0x152e('0x18')];this[_0x152e('0x19')]=_0x3d4b6a['callbackat'];this['recallme']=_0x3d4b6a[_0x152e('0x1a')];this[_0x152e('0x1b')]=_0x3d4b6a[_0x152e('0x1b')];this[_0x152e('0x1c')]=_0x3d4b6a['ListId'];this[_0x152e('0x1d')]=_0x3d4b6a['UserId'];this[_0x152e('0x1e')]=_0x3d4b6a['VoiceQueueId'];this['CampaignId']=_0x3d4b6a[_0x152e('0x1f')];this['originatecalleridnum']=_0x3d4b6a[_0x152e('0x20')]||'';this[_0x152e('0x21')]=_0x3d4b6a[_0x152e('0x21')]||'';}module[_0x152e('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 80e235b..6455d19 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 _0x5f9d=['checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','variable','isNil','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncMachineIvr][createHistory]','[syncMachineIvr]','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','answertime','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','queueCallerAbandonCreateState','predictiveIntervalDroppedCallsCallersExit','Abandoned','CALLEREXIT','actionid','paused','stateinterface','locked','rrmemory','queueBooked','push','merge','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','command','interval','content','true','iftime\x20%s,%s','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','dialMethod','loggedIn','[syncQueueSummary]','dialGlobalInterval','dialTimezone','pow','replace','match','actionOriginate','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','countbusyretry','countcongestionretry','countnoanswerretry','add','dialNoAnswerRetryFrequency','minutes','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','outboundNoSuchCallsDay','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','dialNoAnswerMaxRetry','createStateFinal','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','countglobal','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','dialGlobalMaxRetry','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','floor','erlangCalls','erlangAbandonmentRate','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','Agent\x20free','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','averageHandleTime','getDataPredictive','startMethodPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','outboundQueuePauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[handlePredictive]','Failure\x20','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','ACTIVE','tryOriginatePredictive','[handlePredictive][limitChannel]','[abandonmentRate]','\x20m\x20=\x20','\x20interval\x20=\x20','\x20Ts\x20=\x20','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','\x20Umin\x20=\x20','util','lodash','bluebird','uuid','md5','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../../../config/environment/','../ami','socket.io-emitter','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','enqueue','tail','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','bind','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','sumBillable','sumDuration','talking','total','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','stringify','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','info','[checkGetDataPredictive][avgTalktime]','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','startPredictive','[freeVariablesPredictive]','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','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','Action','status','channel','No\x20such\x20channel','updateOriginated','voiceQueues','queue','[Dialer][checkChannel]','ivr','[Dialer][checkChannel][ivr]','resolve','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','then'];(function(_0x2b5b13,_0x1dbe7d){var _0x3dd34e=function(_0x229c3f){while(--_0x229c3f){_0x2b5b13['push'](_0x2b5b13['shift']());}};_0x3dd34e(++_0x1dbe7d);}(_0x5f9d,0x138));var _0xd5f9=function(_0xc6d111,_0x5bd107){_0xc6d111=_0xc6d111-0x0;var _0x8ed673=_0x5f9d[_0xc6d111];return _0x8ed673;};'use strict';var util=require(_0xd5f9('0x0'));var _=require(_0xd5f9('0x1'));var BPromise=require(_0xd5f9('0x2'));var uuid=require(_0xd5f9('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xd5f9('0x4'));var logger=require(_0xd5f9('0x5'))('dialer');var loggerBooked=require(_0xd5f9('0x5'))('booked');var loggerPredictive=require(_0xd5f9('0x5'))(_0xd5f9('0x6'));var loggerPredictiveCalls=require(_0xd5f9('0x5'))(_0xd5f9('0x7'));var loggerSyncQueueSummary=require(_0xd5f9('0x5'))(_0xd5f9('0x8'));var config=require(_0xd5f9('0x9'));var ami=require(_0xd5f9('0xa'));var io=require(_0xd5f9('0xb'))({'host':_0xd5f9('0xc'),'port':0x18eb});var cmHopper=require(_0xd5f9('0xd'));var cmHopperFinal=require(_0xd5f9('0xe'));var cmHopperHistory=require(_0xd5f9('0xf'));var cmHopperBlack=require(_0xd5f9('0x10'));var voiceQueueRt=require(_0xd5f9('0x11'));var Action=require(_0xd5f9('0x12'));var History=require(_0xd5f9('0x13'));var Final=require(_0xd5f9('0x14'));var AgentComplete=require(_0xd5f9('0x15'));var QueueCallerAbandon=require(_0xd5f9('0x16'));var Hangup=require(_0xd5f9('0x17'));var ipAgi=process[_0xd5f9('0x18')][_0xd5f9('0x19')]||_0xd5f9('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':_0xd5f9('0x1b')};var Sequence=function(){};Sequence['prototype'][_0xd5f9('0x1c')]=function(_0x3d0fd4){this['tail']=this[_0xd5f9('0x1d')]?this[_0xd5f9('0x1d')]['finally'](_0x3d0fd4):_0x3d0fd4();};function Dialer(_0x1a33f4,_0x537f02){this[_0xd5f9('0x1e')]=new Sequence();this[_0xd5f9('0x1f')]=_0x537f02;this['voiceQueues']=_0x1a33f4['voiceQueues'];this[_0xd5f9('0x20')]=_0x1a33f4[_0xd5f9('0x20')];this['agents']=_0x1a33f4[_0xd5f9('0x21')];this[_0xd5f9('0x22')]=_0x1a33f4[_0xd5f9('0x22')];this[_0xd5f9('0x23')]=config[_0xd5f9('0x23')]||0x2;this[_0xd5f9('0x24')]={};this[_0xd5f9('0x25')]={};this[_0xd5f9('0x26')]={};this[_0xd5f9('0x27')]={};this[_0xd5f9('0x28')]={};this['startPredictive']={};this[_0xd5f9('0x29')]={};this[_0xd5f9('0x2a')]={};this['queueBooked']={};this[_0xd5f9('0x2b')]={};ami['on'](_0xd5f9('0x2c'),this[_0xd5f9('0x2d')]['bind'](this));ami['on'](_0xd5f9('0x2e'),this['syncQueueCallerAbandon'][_0xd5f9('0x2f')](this));ami['on']('originateresponse',this[_0xd5f9('0x30')][_0xd5f9('0x2f')](this));ami['on']('agentcomplete',this[_0xd5f9('0x31')]['bind'](this));ami['on'](_0xd5f9('0x32'),this['syncQueueSummary']['bind'](this));ami['on'](_0xd5f9('0x33'),this[_0xd5f9('0x34')][_0xd5f9('0x2f')](this));ami['on'](_0xd5f9('0x35'),this[_0xd5f9('0x36')][_0xd5f9('0x2f')](this));ami['on']('varset',this[_0xd5f9('0x37')][_0xd5f9('0x2f')](this));ami['on'](_0xd5f9('0x38'),this[_0xd5f9('0x39')]['bind'](this));ami['on'](_0xd5f9('0x3a'),this[_0xd5f9('0x3b')][_0xd5f9('0x2f')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x24e340){return _0x24e340!==null&&!_[_0xd5f9('0x3c')](_0x24e340);}function checkIsLoggedIn(_0x4001d2,_0x531d33){return function(){if(_0x531d33<=0x0){_0x4001d2['message']=_0xd5f9('0x3d');throw _0x4001d2[_0xd5f9('0x3e')]+_0xd5f9('0x3f');}};}function isActive(_0x3855c7){return _0x3855c7;}function checkIsActive(_0x37a061,_0x4f8be5){return function(){if(!isActive(_0x4f8be5)){_0x37a061[_0xd5f9('0x40')]=_0xd5f9('0x41');throw _0x37a061[_0xd5f9('0x3e')]+'\x20NOT\x20Active';}};}function checkInterval(_0x1fc49d){return function(){if(!isNotNull(_0x1fc49d[_0xd5f9('0x42')])){_0x1fc49d[_0xd5f9('0x40')]=_0xd5f9('0x43');throw _0x1fc49d[_0xd5f9('0x3e')]+_0xd5f9('0x44');}if(!isNotNull(_0x1fc49d[_0xd5f9('0x42')]['Intervals'])){_0x1fc49d[_0xd5f9('0x40')]='INTERVAL_IS_NULL';throw _0x1fc49d[_0xd5f9('0x3e')]+_0xd5f9('0x44');}if(!isNotNull(_['isEmpty'](_0x1fc49d['Interval'][_0xd5f9('0x45')]))){_0x1fc49d[_0xd5f9('0x40')]='INTERVAL_IS_NULL';throw _0x1fc49d[_0xd5f9('0x3e')]+_0xd5f9('0x44');}};}function msgResponse(_0x36c26a,_0x2636ab,_0x59138f){return{'action':_0x36c26a,'response':_0x2636ab,'message':_0x59138f};}function myreject(_0x39bbe8){return function(_0x22faf4){return _0x39bbe8(msgResponse(_0xd5f9('0x46'),_0xd5f9('0x47'),JSON['stringify'](_0x22faf4)));};}function getSeconds(_0xe038e6,_0x3fc8fb){var _0x12e868=moment(_0xe038e6)[_0xd5f9('0x48')](0x0);var _0x5748ff=moment(_0x3fc8fb)[_0xd5f9('0x48')](0x0);return _0x12e868[_0xd5f9('0x49')](_0x5748ff,_0xd5f9('0x4a'));}function emit(_0x693cd7,_0x23a95f,_0x46bad9){io['to'](_0x693cd7)[_0xd5f9('0x4b')](_0x23a95f,_0x46bad9);}function emitVoiceQueueSummary(_0x18bb36){if(_0x18bb36[_0xd5f9('0x4c')]===_0xd5f9('0x4d')){var _0x57d5d9={'id':_0x18bb36['id'],'name':_0x18bb36[_0xd5f9('0x3e')],'strategy':_0x18bb36[_0xd5f9('0x4e')],'answered':_0x18bb36['answered'],'available':_0x18bb36['available'],'loggedIn':_0x18bb36['loggedIn'],'pTalking':_0x18bb36['pTalking'],'sumBillable':_0x18bb36[_0xd5f9('0x4f')],'sumDuration':_0x18bb36[_0xd5f9('0x50')],'sumHoldTime':_0x18bb36['sumHoldTime']||0x0,'talking':_0x18bb36[_0xd5f9('0x51')],'total':_0x18bb36[_0xd5f9('0x52')],'type':_0x18bb36[_0xd5f9('0x4c')],'unmanaged':_0x18bb36['unmanaged'],'waiting':_0x18bb36[_0xd5f9('0x53')],'loggedInDb':_0x18bb36['loggedInDb'],'dialActive':_0x18bb36[_0xd5f9('0x54')],'dialMethod':_0x18bb36['dialMethod'],'dialOriginateCallerIdName':_0x18bb36[_0xd5f9('0x55')],'dialOriginateCallerIdNumber':_0x18bb36[_0xd5f9('0x56')],'dialOriginateTimeout':_0x18bb36[_0xd5f9('0x57')],'dialPrefix':_0x18bb36[_0xd5f9('0x58')],'outboundAnswerAgiCallsDay':_0x18bb36[_0xd5f9('0x59')],'outboundAnswerCallsDay':_0x18bb36[_0xd5f9('0x5a')],'outboundBlacklistCallsDay':_0x18bb36[_0xd5f9('0x5b')],'outboundBusyCallsDay':_0x18bb36['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x18bb36[_0xd5f9('0x5c')],'outboundDropCallsDayACS':_0x18bb36[_0xd5f9('0x5d')],'outboundDropCallsDayCallersExit':_0x18bb36['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x18bb36['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x18bb36[_0xd5f9('0x5e')],'outboundNoSuchCallsDay':_0x18bb36['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x18bb36[_0xd5f9('0x5f')],'outboundReCallsDay':_0x18bb36['outboundReCallsDay'],'outboundRejectCallsDay':_0x18bb36[_0xd5f9('0x60')],'outboundUnknownCallsDay':_0x18bb36[_0xd5f9('0x61')],'predictiveIntervalAnsweredCalls':_0x18bb36[_0xd5f9('0x62')],'predictiveIntervalAvgHoldtime':_0x18bb36[_0xd5f9('0x63')],'predictiveIntervalAvgTalktime':_0x18bb36[_0xd5f9('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x18bb36['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x18bb36[_0xd5f9('0x65')],'predictiveIntervalErlangCalls':_0x18bb36[_0xd5f9('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x18bb36[_0xd5f9('0x67')],'predictiveIntervalHitRate':_0x18bb36[_0xd5f9('0x68')],'predictiveIntervalLowerLimit':_0x18bb36[_0xd5f9('0x69')],'predictiveIntervalMultiplicativeFactor':_0x18bb36[_0xd5f9('0x6a')],'predictiveIntervalPauses':_0x18bb36[_0xd5f9('0x6b')],'predictiveIntervalTotalCalls':_0x18bb36[_0xd5f9('0x6c')],'message':_0x18bb36[_0xd5f9('0x40')],'originated':_0x18bb36[_0xd5f9('0x6d')]};if(_0x18bb36[_0xd5f9('0x6e')]){_0x57d5d9[_0xd5f9('0x6e')]={'id':_0x18bb36[_0xd5f9('0x6e')]['id'],'name':_0x18bb36['Trunk'][_0xd5f9('0x3e')],'active':_0x18bb36[_0xd5f9('0x6e')][_0xd5f9('0x6f')],'callerid':_0x18bb36[_0xd5f9('0x6e')]['callerid']};}if(_0x18bb36[_0xd5f9('0x42')]){_0x57d5d9[_0xd5f9('0x42')]={'id':_0x18bb36[_0xd5f9('0x42')]['id'],'name':_0x18bb36[_0xd5f9('0x42')]['name']};}var _0x381530=md5(JSON[_0xd5f9('0x70')](_0x57d5d9));if(_0x18bb36[_0xd5f9('0x4')]!==_0x381530){_0x18bb36['md5']=_0x381530;emit(util[_0xd5f9('0x71')](_0xd5f9('0x72'),_0x57d5d9[_0xd5f9('0x3e')]),_0xd5f9('0x73'),_0x57d5d9);}}}function emitCampaignSummary(_0x2c83a1){if(_0x2c83a1[_0xd5f9('0x4c')]==='ivr'){emit(util[_0xd5f9('0x71')](_0xd5f9('0x74'),_0x2c83a1['name']),_0xd5f9('0x75'),_0x2c83a1);}}function checkGetDataPredictive(_0x45985a){if(isNotNull(_0x45985a)){if(!_[_0xd5f9('0x76')](_0x45985a)){if(_0x45985a[_0xd5f9('0x6c')]>0x0){if(!_[_0xd5f9('0x3c')](_0x45985a[_0xd5f9('0x64')])&&_0x45985a[_0xd5f9('0x64')]>0x0){return!![];}else{loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x78'),JSON[_0xd5f9('0x70')](_0x45985a));}if(!_[_0xd5f9('0x3c')](_0x45985a[_0xd5f9('0x63')])&&_0x45985a[_0xd5f9('0x63')]>0x0){return!![];}else{loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x79'),JSON[_0xd5f9('0x70')](_0x45985a));}}else{loggerPredictive['info'](_0xd5f9('0x7a'),JSON[_0xd5f9('0x70')](_0x45985a));}}else{loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x7b'),JSON['stringify'](_0x45985a));}}else{loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x7c'),JSON[_0xd5f9('0x70')](_0x45985a));}return![];}function mergeDataErlangB(_0x17f8ef){return function(_0x4f0450){loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x7d'),JSON[_0xd5f9('0x70')](_0x4f0450));_['merge'](_0x17f8ef,_0x4f0450);};}function getDiff(_0x174bac){var _0xd2206f=moment()[_0xd5f9('0x48')](0x0);var _0x50ecca=moment(_0x174bac)['milliseconds'](0x0);return _0xd2206f[_0xd5f9('0x49')](_0x50ecca,_0xd5f9('0x4a'));}function ifInterval(_0x440e14,_0x39a882){if(_['isUndefined'](_0x39a882)){return![];}if(getDiff(_0x39a882)<_0x440e14*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x38708d){if(isNotNull(_0x38708d)){if(!_[_0xd5f9('0x3c')](_0x38708d[_0xd5f9('0x29')])){_0x38708d[_0xd5f9('0x29')]=undefined;loggerPredictive[_0xd5f9('0x77')]('[freeVariablesPredictive]',_0xd5f9('0x29'),_0x38708d[_0xd5f9('0x3e')]);}if(!_[_0xd5f9('0x3c')](_0x38708d[_0xd5f9('0x7e')])){_0x38708d[_0xd5f9('0x7e')]=undefined;loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x7f'),_0xd5f9('0x7e'),_0x38708d[_0xd5f9('0x3e')]);}if(!_[_0xd5f9('0x3c')](_0x38708d['handlePredictive'])){clearInterval(_0x38708d['handlePredictive']);_0x38708d['handlePredictive']=undefined;loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x7f'),_0xd5f9('0x80'),_0x38708d[_0xd5f9('0x3e')]);}}}function erlangb(_0x3308da,_0x48be0a){if(_0x48be0a===0x0){return 0x0;}var _0xec820a=0x1;for(var _0x11016d=0x1;_0x11016d<=_0x48be0a;_0x11016d+=0x1){_0xec820a=0x1+_0xec820a*_0x11016d/_0x3308da;}return 0x1/_0xec820a;}function isVoiceQueueOutbound(_0xe4be5){return _0xe4be5===_0xd5f9('0x4d');}function isNotPreview(_0x34ea92){return _0x34ea92!==_0xd5f9('0x1f');}function isCampaignIvr(_0x577141){return _0x577141==='ivr';}function getCallerId(_0x1359e5,_0x2bd48a,_0x241c5e){if(!_[_0xd5f9('0x3c')](_0x241c5e)&&'string'===typeof _0x241c5e&&!_[_0xd5f9('0x76')](_0x241c5e)){if(!_[_0xd5f9('0x3c')](_0x2bd48a)&&_0xd5f9('0x81')===typeof _0x2bd48a&&!_[_0xd5f9('0x76')](_0x2bd48a)){return util[_0xd5f9('0x71')]('\x22%s\x22\x20<%s>',_0x2bd48a,_0x241c5e);}return util[_0xd5f9('0x71')](_0xd5f9('0x82'),_0x241c5e,_0x241c5e);}if(!_[_0xd5f9('0x3c')](_0x1359e5)&&_0xd5f9('0x81')===typeof _0x1359e5&&!_[_0xd5f9('0x76')](_0x1359e5)){return _0x1359e5;}return _0xd5f9('0x83');}function loggerCatchQueueSummary(_0x4ad9eb,_0x3d256c){return function(_0x193621){freeVariablesPredictive(_0x3d256c);emitVoiceQueueSummary(_0x3d256c);emitCampaignSummary(_0x3d256c);loggerSyncQueueSummary['error'](_0x4ad9eb,util['inspect'](_0x193621,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x7ed4b9,_0x35c93a){return function(_0xdf6403){loggerPredictive['error'](_0x7ed4b9,JSON['stringify'](_0xdf6403));freeVariablesPredictive(_0x35c93a);};}function loggerCatch(_0x255647){return function(_0x3183b3){logger[_0xd5f9('0x84')](_0x255647,util[_0xd5f9('0x85')](_0x3183b3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x55192a){return _0x55192a&&!_[_0xd5f9('0x3c')](_0x55192a)&&_0x55192a[_0xd5f9('0x86')]>0x0;}function decremetOriginate(_0x501183){if(!_[_0xd5f9('0x3c')](_0x501183)&&_0x501183!==null){if(_0x501183['hasOwnProperty'](_0xd5f9('0x6d'))){if(_0x501183['originated']>0x0){_0x501183[_0xd5f9('0x6d')]-=0x1;}else{logger[_0xd5f9('0x84')](_0xd5f9('0x87'));}}}else{logger[_0xd5f9('0x84')](_0xd5f9('0x88'));}}function checkContactLowerLimitOriginate(_0x517de3,_0x483dac,_0x30dd55){if(_0x483dac>_0x30dd55){for(var _0x21ed3c=0x0;_0x21ed3c<_0x483dac-_0x30dd55;_0x21ed3c+=0x1){decremetOriginate(_0x517de3);}}}function loggerGetContactDialer(_0x47bd01,_0x46f2a7,_0x50aca1){return function(_0xaf3ff3){checkContactLowerLimitOriginate(_0x46f2a7,_0x50aca1,0x0);logger[_0xd5f9('0x84')](_0x47bd01,util[_0xd5f9('0x85')](_0xaf3ff3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4aca95){return function(_0x205d89){if(isNotNull(_0x205d89)&&isNotNull(_0x205d89[0x0])){if(_0x205d89[0x0]['contactsRescheduled']>0x0){_0x4aca95[_0xd5f9('0x40')]=_0xd5f9('0x89');logger['info']('[getContactDialer2][ReScheduled]'+_0x4aca95[_0xd5f9('0x3e')],_0x205d89[0x0][_0xd5f9('0x8a')],_0xd5f9('0x8b'));}else{_0x4aca95['message']=_0xd5f9('0x8c');logger[_0xd5f9('0x77')](_0xd5f9('0x8d')+_0x4aca95[_0xd5f9('0x3e')]);}}};}function notSendMessagesQueue(_0x34dab8){if(_0x34dab8[_0xd5f9('0x8e')]){freeVariablesPredictive(_0x34dab8);if(_0x34dab8[_0xd5f9('0x6d')]===0x0&&_0x34dab8[_0xd5f9('0x51')]===0x0&&_0x34dab8[_0xd5f9('0x53')]===0x0&&(_0x34dab8[_0xd5f9('0x8f')]||0x0)===0x0){_0x34dab8['sendMessageOneNotActive']=![];_0x34dab8[_0xd5f9('0x90')]=0x0;_0x34dab8[_0xd5f9('0x40')]=_0xd5f9('0x41');loggerSyncQueueSummary[_0xd5f9('0x84')](_0xd5f9('0x91'),_0x34dab8[_0xd5f9('0x3e')],_0xd5f9('0x92'));}else{_0x34dab8['message']=_0xd5f9('0x93');loggerSyncQueueSummary[_0xd5f9('0x84')](_0xd5f9('0x91'),_0x34dab8[_0xd5f9('0x3e')],'is\x20disactive');}emitVoiceQueueSummary(_0x34dab8);}}function notSendMessagesCampaign(_0x261b11){if(_0x261b11[_0xd5f9('0x8e')]){if(_0x261b11[_0xd5f9('0x6d')]===0x0){_0x261b11['sendMessageOneNotActive']=![];_0x261b11[_0xd5f9('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xd5f9('0x84')](_0xd5f9('0x94'),_0x261b11[_0xd5f9('0x3e')],_0xd5f9('0x92'));}else{_0x261b11[_0xd5f9('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xd5f9('0x84')](_0xd5f9('0x94'),_0x261b11[_0xd5f9('0x3e')],_0xd5f9('0x95'));}emitCampaignSummary(_0x261b11);}}function createObjHistory(_0x391bdb,_0x2fdd95,_0x32f14c,_0x22ee11,_0x383990){_0x391bdb[_0xd5f9('0x40')]=_0x32f14c;var _0x4e4222=new Action(_0x391bdb,_0x2fdd95);var _0x46e59b=new History(_0x4e4222);_0x46e59b[_0xd5f9('0x96')]=_0x22ee11;_0x46e59b[_0xd5f9('0x97')]=_0x383990;_0x46e59b['endtime']=_0x4e4222[_0xd5f9('0x98')];return _0x46e59b;}Dialer[_0xd5f9('0x99')][_0xd5f9('0x9a')]=function(){var _0x28ed99=this;setInterval(function(){_0x28ed99[_0xd5f9('0x9b')](_0x28ed99[_0xd5f9('0x27')],_0xd5f9('0x9c'));_0x28ed99[_0xd5f9('0x9b')](_0x28ed99['actions'],_0xd5f9('0x9d'));},0x32c8);};Dialer[_0xd5f9('0x99')][_0xd5f9('0x9b')]=function(_0x31bfa7,_0x277836){var _0x25d85c=this;for(var _0x1f6e63 in _0x31bfa7){if(_0x31bfa7[_0xd5f9('0x9e')](_0x1f6e63)){this[_0xd5f9('0x1e')][_0xd5f9('0x1c')](function(){if(!_['isNil'](_0x31bfa7[_0x1f6e63])){return ami[_0xd5f9('0x9f')]({'action':_0xd5f9('0xa0'),'channel':_0x31bfa7[_0x1f6e63][_0xd5f9('0xa1')]})['catch'](function(_0x104403){if(_0x104403[_0xd5f9('0x40')]===_0xd5f9('0xa2')){setTimeout(function(){if(_0x31bfa7[_0x1f6e63]&&_0x31bfa7[_0x1f6e63][_0xd5f9('0x4c')]!=='ivr'){_0x25d85c[_0xd5f9('0xa3')](_0x25d85c[_0xd5f9('0xa4')][_0x31bfa7[_0x1f6e63][_0xd5f9('0xa5')]]);logger[_0xd5f9('0x84')](_0xd5f9('0xa6'),_0x277836,_0x1f6e63,_0x31bfa7[_0x1f6e63][_0xd5f9('0xa5')]);delete _0x31bfa7[_0x1f6e63];}if(_0x31bfa7[_0x1f6e63]&&_0x31bfa7[_0x1f6e63][_0xd5f9('0x4c')]===_0xd5f9('0xa7')){_0x25d85c[_0xd5f9('0xa3')](_0x25d85c[_0xd5f9('0x20')][_0x31bfa7[_0x1f6e63][_0xd5f9('0xa5')]]);logger[_0xd5f9('0x84')](_0xd5f9('0xa8'),_0x277836,_0x1f6e63,_0x31bfa7[_0x1f6e63][_0xd5f9('0xa5')]);delete _0x31bfa7[_0x1f6e63];}},0x2328);}});}});}}};Dialer[_0xd5f9('0x99')]['countReScheduled']=function(_0x198ae4){return BPromise[_0xd5f9('0xa9')]()['then'](cmHopper[_0xd5f9('0xaa')](_0x198ae4))[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xac')));};Dialer[_0xd5f9('0x99')][_0xd5f9('0xad')]=function(_0x3fbe53){return BPromise[_0xd5f9('0xa9')]()[_0xd5f9('0xae')](cmHopperBlack[_0xd5f9('0xad')](_0x3fbe53))[_0xd5f9('0xab')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xd5f9('0x99')][_0xd5f9('0xaf')]=function(_0x1a39e9){return BPromise[_0xd5f9('0xa9')]()[_0xd5f9('0xae')](cmHopperBlack[_0xd5f9('0xaf')](_0x1a39e9))[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xb0')));};Dialer[_0xd5f9('0x99')]['averageHandleTime']=function(_0x4215f6){return BPromise['resolve']()['then'](cmHopperHistory[_0xd5f9('0xb1')](_0x4215f6))[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xb2')));};Dialer[_0xd5f9('0x99')][_0xd5f9('0xb3')]=function(_0x3d0c93){return BPromise[_0xd5f9('0xa9')]()[_0xd5f9('0xae')](cmHopper[_0xd5f9('0xb3')](_0x3d0c93))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xd5f9('0x99')][_0xd5f9('0xb4')]=function(_0x5ce417,_0x813bc0,_0x3e59f8,_0x28eec0){return BPromise['resolve']()[_0xd5f9('0xae')](cmHopper[_0xd5f9('0xb4')](_0x5ce417,_0x813bc0,_0x3e59f8,_0x28eec0))[_0xd5f9('0xab')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xd5f9('0x99')][_0xd5f9('0xb5')]=function(_0x41357b,_0x41b413,_0x562ead){return BPromise['resolve']()[_0xd5f9('0xae')](cmHopper['getContactDialerIvr'](_0x41357b,_0x41b413,_0x562ead))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype'][_0xd5f9('0xb6')]=function(_0x54ff24){return BPromise['resolve']()[_0xd5f9('0xae')](voiceQueueRt[_0xd5f9('0xb6')](_0x54ff24))[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xb7')));};Dialer[_0xd5f9('0x99')][_0xd5f9('0xb8')]=function(_0x28803f){return BPromise['resolve']()['then'](cmHopper[_0xd5f9('0xb8')](_0x28803f))[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xb9')));};Dialer[_0xd5f9('0x99')][_0xd5f9('0xba')]=function(_0x18fad3){return BPromise[_0xd5f9('0xa9')]()['then'](cmHopperHistory[_0xd5f9('0xba')](_0x18fad3))[_0xd5f9('0xab')](loggerCatch('[createHistory]\x20'));};Dialer[_0xd5f9('0x99')]['updateOriginated']=function(_0x8e1f6d){if(!_[_0xd5f9('0x3c')](_0x8e1f6d)&&_0x8e1f6d!==null){if(_0x8e1f6d[_0xd5f9('0x9e')](_0xd5f9('0x6d'))){if(_0x8e1f6d[_0xd5f9('0x6d')]>0x0){_0x8e1f6d[_0xd5f9('0x6d')]-=0x1;}else{logger[_0xd5f9('0x84')](_0xd5f9('0xbb'));}}}else{logger[_0xd5f9('0x84')](_0xd5f9('0xbc'));}};Dialer[_0xd5f9('0x99')][_0xd5f9('0xbd')]=function(_0x3b4594,_0x13993b){var _0xacedec=this;return function(_0x212c46){_0xacedec[_0xd5f9('0xa3')](_0x13993b);logger[_0xd5f9('0x84')](_0x3b4594,util['inspect'](_0x212c46,{'showHidden':![],'depth':null}));};};Dialer[_0xd5f9('0x99')][_0xd5f9('0xbe')]=function(_0x5835cd,_0x45d51b,_0x5be4fd){var _0x107740={'state':0x19,'statedesc':_0xd5f9('0xbf')};this['updateOriginated'](_0x45d51b);this[_0xd5f9('0xc0')](_['merge'](_0x107740,_['pick'](_0x5be4fd,[_0xd5f9('0xc1'),_0xd5f9('0xc2'),_0xd5f9('0xc3'),_0xd5f9('0xc4'),_0xd5f9('0xc5')])),_0xd5f9('0xc6'),'[emptyContact]');logger[_0xd5f9('0x84')](_0x5835cd);};Dialer[_0xd5f9('0x99')][_0xd5f9('0xc7')]=function(_0x507a29){return _0x507a29===_0xd5f9('0xc8');};Dialer[_0xd5f9('0x99')][_0xd5f9('0xc9')]=function(_0x4a2920){return!_[_0xd5f9('0x3c')](_0x4a2920)&&_0x4a2920&&!_['isUndefined'](_0x4a2920[_0xd5f9('0x3e')])&&!_['isUndefined'](_0x4a2920[_0xd5f9('0x6f')])&&_0x4a2920[_0xd5f9('0x6f')]&&(this[_0xd5f9('0x22')][util['format'](_0xd5f9('0xca'),_0x4a2920[_0xd5f9('0x3e')])][_0xd5f9('0xa0')]===_0xd5f9('0xcb')||this['trunks'][util[_0xd5f9('0x71')]('SIP/%s',_0x4a2920['name'])]['status']===_0xd5f9('0xcc'));};Dialer[_0xd5f9('0x99')][_0xd5f9('0xc0')]=function(_0x2091ea,_0x3ed548,_0x3f2172){this['createHistory'](_0x2091ea)[_0xd5f9('0xab')](loggerCatch(_0x3ed548));this[_0xd5f9('0xb8')](_0x2091ea)[_0xd5f9('0xab')](loggerCatch(_0x3f2172));};Dialer[_0xd5f9('0x99')][_0xd5f9('0x37')]=function(_0x133f94){var _0x9533c5=this[_0xd5f9('0x27')][_0x133f94['uniqueid']];var _0x49feb2;if(!_['isNil'](_0x133f94)&&!_['isNil'](_0x133f94[_0xd5f9('0xcd')])&&!_[_0xd5f9('0xce')](_0x133f94['variable'][_0xd5f9('0xcf')])&&_0x133f94['exten']===_0xd5f9('0xd0')&&_0x9533c5){if(_0x9533c5['type']!=='ivr'&&this[_0xd5f9('0xa4')][_0x9533c5[_0xd5f9('0xa5')]][_0xd5f9('0xd1')]&&_0x133f94[_0xd5f9('0xd2')]===_0xd5f9('0xd3')){delete this[_0xd5f9('0x27')][_0x133f94[_0xd5f9('0xd4')]];this['updateOriginated'](this[_0xd5f9('0xa4')][_0x9533c5['queue']]);this[_0xd5f9('0xa4')][_0x9533c5['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xd5f9('0xa4')][_0x9533c5[_0xd5f9('0xa5')]][_0xd5f9('0x59')]+=0x1;_0x49feb2=new Hangup(_0x9533c5,_0x133f94);_0x49feb2[_0xd5f9('0x96')]=0x12;_0x49feb2[_0xd5f9('0x97')]=_0xd5f9('0xd5');_0x49feb2[_0xd5f9('0xd6')]=_0xd5f9('0xd7');this['saveInDb'](_0x49feb2,_0xd5f9('0xd8'),_0xd5f9('0xd9'));}if(_0x9533c5[_0xd5f9('0x4c')]!==_0xd5f9('0xa7')&&this[_0xd5f9('0xa4')][_0x9533c5[_0xd5f9('0xa5')]]['dialAMDActive']&&_0x133f94[_0xd5f9('0xd2')]===_0xd5f9('0xda')){delete this[_0xd5f9('0x27')][_0x133f94[_0xd5f9('0xd4')]];this['updateOriginated'](this[_0xd5f9('0xa4')][_0x9533c5[_0xd5f9('0xa5')]]);this['voiceQueues'][_0x9533c5['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xd5f9('0xa4')][_0x9533c5[_0xd5f9('0xa5')]][_0xd5f9('0x59')]+=0x1;_0x49feb2=new Hangup(_0x9533c5,_0x133f94);_0x49feb2[_0xd5f9('0x96')]=0x13;_0x49feb2['statedesc']='Machine';_0x49feb2['membername']='AMD';_0x49feb2[_0xd5f9('0xdb')]=!![];this[_0xd5f9('0xc0')](_0x49feb2,'[syncMachine][createHistory]','[syncMachine]');}if(_0x9533c5[_0xd5f9('0x4c')]==='ivr'&&this[_0xd5f9('0x20')][_0x9533c5[_0xd5f9('0xa5')]][_0xd5f9('0xd1')]&&_0x133f94[_0xd5f9('0xd2')]==='HANGUP'){delete this[_0xd5f9('0x27')][_0x133f94['uniqueid']];this['updateOriginated'](this[_0xd5f9('0x20')][_0x9533c5[_0xd5f9('0xa5')]]);_0x49feb2=new Hangup(_0x9533c5,_0x133f94);_0x49feb2[_0xd5f9('0x96')]=0x12;_0x49feb2[_0xd5f9('0x97')]=_0xd5f9('0xd5');_0x49feb2[_0xd5f9('0xd6')]=_0xd5f9('0xd7');this[_0xd5f9('0xc0')](_0x49feb2,_0xd5f9('0xdc'),_0xd5f9('0xdd'));}if(_0x9533c5[_0xd5f9('0x4c')]===_0xd5f9('0xa7')&&this['campaigns'][_0x9533c5['queue']][_0xd5f9('0xd1')]&&_0x133f94['value']===_0xd5f9('0xda')){delete this[_0xd5f9('0x27')][_0x133f94['uniqueid']];this[_0xd5f9('0xa3')](this[_0xd5f9('0x20')][_0x9533c5[_0xd5f9('0xa5')]]);_0x49feb2=new Hangup(_0x9533c5,_0x133f94);_0x49feb2[_0xd5f9('0x96')]=0x13;_0x49feb2[_0xd5f9('0x97')]=_0xd5f9('0xde');_0x49feb2[_0xd5f9('0xd6')]=_0xd5f9('0xd7');_0x49feb2[_0xd5f9('0xdb')]=!![];this['saveInDb'](_0x49feb2,_0xd5f9('0xdf'),_0xd5f9('0xe0'));}}};Dialer[_0xd5f9('0x99')][_0xd5f9('0x34')]=function(_0x4392c3){var _0x4312c8=this[_0xd5f9('0x27')][_0x4392c3['uniqueid']];var _0x323c02=this;var _0x4bcd68;if(_0x4312c8&&_0x4312c8[_0xd5f9('0x4c')]==='ivr'){delete this[_0xd5f9('0x27')][_0x4392c3[_0xd5f9('0xd4')]];this[_0xd5f9('0xa3')](this[_0xd5f9('0x20')][_0x4312c8['queue']]);this[_0xd5f9('0x20')][_0x4312c8[_0xd5f9('0xa5')]]['ivrAnswerCallsDay']+=0x1;_0x4bcd68=new Hangup(_0x4312c8,_0x4392c3);this[_0xd5f9('0xba')](_0x4bcd68)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xe1')));this[_0xd5f9('0xb8')](_0x4bcd68)[_0xd5f9('0xab')](loggerCatch('[syncHangupIvr]'));}if(_0x4312c8&&_0x4312c8['type']!==_0xd5f9('0xa7')&&isNotNull(this[_0xd5f9('0xa4')][_0x4312c8[_0xd5f9('0xa5')]][_0xd5f9('0xe2')])){delete this[_0xd5f9('0x27')][_0x4392c3[_0xd5f9('0xd4')]];this[_0xd5f9('0xa3')](this[_0xd5f9('0xa4')][_0x4312c8[_0xd5f9('0xa5')]]);this[_0xd5f9('0xa4')][_0x4312c8[_0xd5f9('0xa5')]]['outboundAnswerCallsDay']+=0x1;this[_0xd5f9('0xa4')][_0x4312c8[_0xd5f9('0xa5')]][_0xd5f9('0x59')]+=0x1;_0x4bcd68=new Hangup(_0x4312c8,_0x4392c3);_0x4bcd68['state']=0x10;_0x4bcd68[_0xd5f9('0x97')]=_0xd5f9('0xe3');_0x4bcd68[_0xd5f9('0xd6')]=_0xd5f9('0xe4');this[_0xd5f9('0xba')](_0x4bcd68)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xd5f9('0xb8')](_0x4bcd68)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xe5')));}if(_0x4312c8&&_0x4312c8[_0xd5f9('0x4c')]!==_0xd5f9('0xa7')&&!isNotNull(this[_0xd5f9('0xa4')][_0x4312c8['queue']][_0xd5f9('0xe2')])){delete this[_0xd5f9('0x27')][_0x4392c3[_0xd5f9('0xd4')]];this[_0xd5f9('0xa3')](this['voiceQueues'][_0x4312c8[_0xd5f9('0xa5')]]);this['voiceQueues'][_0x4312c8[_0xd5f9('0xa5')]]['outboundUnknownCallsDay']+=0x1;_0x4bcd68=new Hangup(_0x4312c8,_0x4392c3);_0x4bcd68['state']=0xc;_0x4bcd68[_0xd5f9('0x97')]=_0x4392c3[_0xd5f9('0xe6')];_0x4bcd68['membername']=_0xd5f9('0xe7');this['createHistory'](_0x4bcd68)[_0xd5f9('0xab')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xd5f9('0xb8')](_0x4bcd68)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xe5')));}};Dialer['prototype'][_0xd5f9('0x31')]=function(_0x4c9f52){var _0x533b7c=this[_0xd5f9('0x27')][_0x4c9f52[_0xd5f9('0xd4')]];var _0x1a3c98=this;if(this[_0xd5f9('0xa4')][_0x4c9f52[_0xd5f9('0xa5')]]){if(_0x533b7c&&_0x533b7c[_0xd5f9('0x4c')]!==_0xd5f9('0xa7')){delete this['uniqueId'][_0x4c9f52[_0xd5f9('0xd4')]];this[_0xd5f9('0xa4')][_0x4c9f52[_0xd5f9('0xa5')]][_0xd5f9('0x5a')]+=0x1;var _0x363346=new AgentComplete(_0x533b7c,_0x4c9f52);if(_0x4c9f52[_0xd5f9('0xe8')]===_0xd5f9('0xe9')){_0x363346[_0xd5f9('0xea')]=this[_0xd5f9('0xa4')][_0x4c9f52[_0xd5f9('0xa5')]][_0xd5f9('0xeb')]&&this[_0xd5f9('0xa4')][_0x4c9f52['queue']]['dialAgiAfterHangupAgent']?moment()[_0xd5f9('0x71')](_0xd5f9('0xec')):undefined;}this[_0xd5f9('0xba')](_0x363346)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xed')));this[_0xd5f9('0xb8')](_0x363346)[_0xd5f9('0xab')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xd5f9('0x99')][_0xd5f9('0x2d')]=function(_0x106818){if(this[_0xd5f9('0xa4')][_0x106818[_0xd5f9('0xa5')]]){if(this[_0xd5f9('0x27')][_0x106818[_0xd5f9('0xd4')]]&&this['uniqueId'][_0x106818[_0xd5f9('0xd4')]][_0xd5f9('0x4c')]!==_0xd5f9('0xa7')){this['updateOriginated'](this[_0xd5f9('0xa4')][_0x106818['queue']]);this[_0xd5f9('0x27')][_0x106818['uniqueid']][_0xd5f9('0xee')]=moment()['format'](_0xd5f9('0xec'));}}};Dialer[_0xd5f9('0x99')]['queueCallerAbandonCreateState']=function(_0x2af9ce){this[_0xd5f9('0xba')](_0x2af9ce)['catch'](loggerCatch(_0xd5f9('0xed')));this['moveContactManagedDialer'](_0x2af9ce)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xef')));};Dialer['prototype'][_0xd5f9('0xf0')]=function(_0x5ba13b){var _0x40581f=this[_0xd5f9('0x27')][_0x5ba13b['uniqueid']];var _0x10c699=this;if(this[_0xd5f9('0xa4')][_0x5ba13b['queue']]){if(_0x40581f&&_0x40581f[_0xd5f9('0x4c')]!==_0xd5f9('0xa7')){delete this[_0xd5f9('0x27')][_0x5ba13b[_0xd5f9('0xd4')]];this['updateOriginated'](this[_0xd5f9('0xa4')][_0x5ba13b[_0xd5f9('0xa5')]]);_0x40581f[_0xd5f9('0xf1')]=moment()[_0xd5f9('0x71')](_0xd5f9('0xec'));var _0x515736=new QueueCallerAbandon(_0x40581f,_0x5ba13b);if(getSeconds(_0x40581f['droptime'],_0x40581f[_0xd5f9('0xf2')])>=_0x40581f[_0xd5f9('0xf3')]){this['voiceQueues'][_0x5ba13b[_0xd5f9('0xa5')]][_0xd5f9('0x65')]+=0x1;this[_0xd5f9('0xa4')][_0x5ba13b[_0xd5f9('0xa5')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xd5f9('0xa4')][_0x5ba13b['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x515736['state']=0xa;_0x515736['statedesc']=_0xd5f9('0xf4');_0x515736[_0xd5f9('0xf5')]='TIMEOUT';_0x515736[_0xd5f9('0xea')]=this[_0xd5f9('0xa4')][_0x5ba13b[_0xd5f9('0xa5')]][_0xd5f9('0xeb')]?moment()[_0xd5f9('0x71')](_0xd5f9('0xec')):undefined;this[_0xd5f9('0xf6')](_0x515736);}else{this[_0xd5f9('0xa4')][_0x5ba13b['queue']][_0xd5f9('0xf7')]+=0x1;this[_0xd5f9('0xa4')][_0x5ba13b[_0xd5f9('0xa5')]]['outboundDropCallsDayCallersExit']+=0x1;_0x515736['state']=0xb;_0x515736[_0xd5f9('0x97')]=_0xd5f9('0xf8');_0x515736[_0xd5f9('0xf5')]=_0xd5f9('0xf9');this['queueCallerAbandonCreateState'](_0x515736);}}}};Dialer[_0xd5f9('0x99')][_0xd5f9('0x36')]=function(_0x924134){if(this['actions'][_0x924134[_0xd5f9('0xd4')]]){this[_0xd5f9('0x25')][_0x924134[_0xd5f9('0xd4')]][_0xd5f9('0xa1')]=_0x924134[_0xd5f9('0xa1')];}if(this[_0xd5f9('0x27')][_0x924134['uniqueid']]){this[_0xd5f9('0x27')][_0x924134[_0xd5f9('0xd4')]][_0xd5f9('0xa1')]=_0x924134['channel'];}};Dialer[_0xd5f9('0x99')]['syncQueueMember']=function(_0x48b8df){if(strategy[this[_0xd5f9('0xa4')][this['actions'][_0x48b8df[_0xd5f9('0xfa')]]['queue']][_0xd5f9('0x4e')]]===_0xd5f9('0x1b')){if(this[_0xd5f9('0x25')][_0x48b8df[_0xd5f9('0xfa')]]&&_[_0xd5f9('0xce')](this[_0xd5f9('0x25')][_0x48b8df[_0xd5f9('0xfa')]]['locked'])&&_0x48b8df[_0xd5f9('0xa0')]==='1'&&_0x48b8df[_0xd5f9('0xfb')]==='0'){if(this['agents'][_0x48b8df[_0xd5f9('0xfc')]]){if(!this['agents'][_0x48b8df[_0xd5f9('0xfc')]][_0xd5f9('0xfd')]){this['agents'][_0x48b8df['stateinterface']][_0xd5f9('0xfd')]=!![];this[_0xd5f9('0x25')][_0x48b8df[_0xd5f9('0xfa')]]['locked']=!![];this[_0xd5f9('0x25')][_0x48b8df['actionid']][_0xd5f9('0xfc')]=_0x48b8df[_0xd5f9('0xfc')];}}}}else if((strategy[this[_0xd5f9('0xa4')][this['actions'][_0x48b8df[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]]['strategy']]||'rrmemory')===_0xd5f9('0xfe')){if(this[_0xd5f9('0x25')][_0x48b8df[_0xd5f9('0xfa')]]){if(this[_0xd5f9('0x21')][_0x48b8df[_0xd5f9('0xfc')]]){this['actions'][_0x48b8df[_0xd5f9('0xfa')]][_0xd5f9('0xfc')]=_0x48b8df[_0xd5f9('0xfc')];if(_[_0xd5f9('0xce')](this[_0xd5f9('0xff')][this[_0xd5f9('0x25')][_0x48b8df[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]])){this[_0xd5f9('0xff')][this[_0xd5f9('0x25')][_0x48b8df[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]]=[];}this['queueBooked'][this[_0xd5f9('0x25')][_0x48b8df['actionid']][_0xd5f9('0xa5')]][_0xd5f9('0x100')](_[_0xd5f9('0x101')](_['pick'](this[_0xd5f9('0x25')][_0x48b8df[_0xd5f9('0xfa')]],[_0xd5f9('0x102'),_0xd5f9('0xfc')]),{'status':_0x48b8df[_0xd5f9('0xa0')],'paused':_0x48b8df[_0xd5f9('0xfb')]}));}}}};function unlockQueueStatus(_0x28b2f8,_0x3a1d2f){setTimeout(function(){if(_[_0xd5f9('0x3c')](_0x28b2f8[_0xd5f9('0x103')])){loggerBooked[_0xd5f9('0x84')](_0xd5f9('0x104'),_0x3a1d2f);}_0x28b2f8[_0xd5f9('0x103')]=!![];loggerBooked[_0xd5f9('0x77')](_0xd5f9('0x105'),_0x3a1d2f,JSON[_0xd5f9('0x70')](_[_0xd5f9('0x106')](_0x28b2f8,[_0xd5f9('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xd5f9('0x99')]['syncQueueStatusComplete']=function(_0xdc982e){var _0x55fb0b=this;var _0x20a8cf=_0x55fb0b['voiceQueues'][_0x55fb0b['actions'][_0xdc982e[_0xd5f9('0xfa')]]['queue']];if(strategy[this[_0xd5f9('0xa4')][this['actions'][_0xdc982e['actionid']][_0xd5f9('0xa5')]][_0xd5f9('0x4e')]]===_0xd5f9('0x1b')){if(this['actions'][_0xdc982e[_0xd5f9('0xfa')]]&&this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xfc')]){this[_0xd5f9('0x1f')][_0xd5f9('0x107')](this[_0xd5f9('0x25')][_0xdc982e['actionid']]['idHopper'],this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xfc')])[_0xd5f9('0xab')](function(_0x5d036c){logger[_0xd5f9('0x84')](_0xd5f9('0x108'),util[_0xd5f9('0x85')](_0x5d036c,{'showHidden':![],'depth':null}));})[_0xd5f9('0x109')](function(){_0x55fb0b['updateOriginated'](_0x55fb0b[_0xd5f9('0xa4')][_0x55fb0b[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]]['queue']]);_0x55fb0b[_0xd5f9('0x21')][_0x55fb0b[_0xd5f9('0x25')][_0xdc982e['actionid']][_0xd5f9('0xfc')]][_0xd5f9('0xfd')]=![];delete _0x55fb0b[_0xd5f9('0x25')][_0xdc982e['actionid']];unlockQueueStatus(_0x20a8cf);});}else{this[_0xd5f9('0xa3')](this['voiceQueues'][this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]]);this[_0xd5f9('0xb3')]({'active':![],'ContactId':this['actions'][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xc1')],'ListId':this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]]['ListId'],'VoiceQueueId':this['actions'][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xc4')]||undefined,'CampaignId':this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xc5')]||undefined})[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x10a')));delete this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]];unlockQueueStatus(_0x20a8cf);}}else if((strategy[this[_0xd5f9('0xa4')][this['actions'][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]]['strategy']]||_0xd5f9('0xfe'))==='rrmemory'){var _0x59346b;if(this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]]&&!_[_0xd5f9('0x76')](this[_0xd5f9('0xff')][this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]])){if(this['queueBookedRR'][_0x55fb0b['actions'][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]]){this[_0xd5f9('0x2b')][_0x55fb0b[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]]['queue']]=this[_0xd5f9('0x2b')][this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]]?this['queueBookedRR'][this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]]['queue']]:this[_0xd5f9('0xff')][this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]]?this[_0xd5f9('0xff')][this[_0xd5f9('0x25')][_0xdc982e['actionid']][_0xd5f9('0xa5')]]['_rr']||0x0:0x0;}this[_0xd5f9('0xff')][this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]][_0xd5f9('0x10b')]=this[_0xd5f9('0x2b')][this[_0xd5f9('0x25')][_0xdc982e[_0xd5f9('0xfa')]][_0xd5f9('0xa5')]];for(var _0x5914bb=0x0;_0x5914bb=0x0?!![]:![];})[_0xd5f9('0xab')](myreject(_0x1ad43d)));}}else{_0xbdaba4['push'](ami[_0xd5f9('0x9f')]({'action':'command','command':util[_0xd5f9('0x71')](_0xd5f9('0x123'),_0x10d6ed,!_[_0xd5f9('0x3c')](config[_0xd5f9('0x11e')][_0x280d5a])?_0x280d5a:'')})[_0xd5f9('0xae')](function(_0x4fd51c){return _0x4fd51c['content'][_0xd5f9('0x124')](_0xd5f9('0x122'))>=0x0?!![]:![];})['catch'](myreject(_0x1ad43d)));}BPromise[_0xd5f9('0x125')](_0xbdaba4)[_0xd5f9('0xae')](function(_0x217350){var _0x2c5e93=_['some'](_0x217350);if(_0x2c5e93){return _0x3d40a2(_0x2c5e93);}else{_0x574f55[_0xd5f9('0x40')]=_0x133c4a?_0xd5f9('0x126'):'INTERVAL_IS_OVERTIME';return _0x1ad43d(msgResponse(_0xd5f9('0x127'),_0xd5f9('0x11b'),_0xd5f9('0x128')+_0x133c4a+'\x20'+_0x2067b7+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x10d6ed,{'showHidden':![],'depth':null})+_0xd5f9('0x129')+_0x280d5a));}})[_0xd5f9('0xab')](function(_0x11aa2b){return _0x1ad43d(msgResponse(_0xd5f9('0x119'),_0xd5f9('0x11b'),JSON[_0xd5f9('0x70')](_0x11aa2b)));});});};Dialer['prototype'][_0xd5f9('0x12a')]=function(_0x21d498){var _0x40b329=this;return function(){switch(_0x21d498['dialMethod']){case _0xd5f9('0x12b'):freeVariablesPredictive(_0x21d498);_0x40b329[_0xd5f9('0x12c')](_0x21d498,0x1);break;case _0xd5f9('0x12d'):freeVariablesPredictive(_0x21d498);_0x40b329[_0xd5f9('0x12c')](_0x21d498,_0x21d498[_0xd5f9('0x12e')]);break;case _0xd5f9('0x6'):_0x40b329[_0xd5f9('0x6')](_0x21d498);break;case _0xd5f9('0x12f'):freeVariablesPredictive(_0x21d498);_0x40b329[_0xd5f9('0x12c')](_0x21d498,0x1);break;default:freeVariablesPredictive(_0x21d498);logger[_0xd5f9('0x84')](_0xd5f9('0x130'),_0x21d498[_0xd5f9('0x3e')],_0xd5f9('0x131'));}};};Dialer['prototype'][_0xd5f9('0x132')]=function(_0x4fb8f5){var _0x5ab9e5=this;return function(){_0x5ab9e5['handleIvr'](_0x4fb8f5);};};Dialer[_0xd5f9('0x99')][_0xd5f9('0x8')]=function(_0x45c13e){var _0x8b1aaa=this;if(isNotPreview(_0x45c13e[_0xd5f9('0x133')])){if(isVoiceQueueOutbound(_0x45c13e[_0xd5f9('0x4c')])&&isActive(_0x45c13e[_0xd5f9('0x54')])){_0x45c13e[_0xd5f9('0x8e')]=!![];BPromise[_0xd5f9('0xa9')]()[_0xd5f9('0xae')](checkIsLoggedIn(_0x45c13e,_0x45c13e[_0xd5f9('0x134')]))[_0xd5f9('0xae')](checkIsActive(_0x45c13e,_0x45c13e['dialActive']))[_0xd5f9('0xae')](checkInterval(_0x45c13e))[_0xd5f9('0xae')](_0x8b1aaa['checkIsTrunkReachable'](_0x45c13e))[_0xd5f9('0xae')](_0x8b1aaa[_0xd5f9('0x118')](_0x45c13e['dialGlobalInterval'],_0x45c13e['dialTimezone'],_0x45c13e[_0xd5f9('0x3e')],_0x45c13e))[_0xd5f9('0xae')](_0x8b1aaa[_0xd5f9('0x11a')](_0x45c13e[_0xd5f9('0x42')],_0x45c13e['dialTimezone'],_0x45c13e[_0xd5f9('0x3e')],_0x45c13e))[_0xd5f9('0xae')](_0x8b1aaa[_0xd5f9('0x12a')](_0x45c13e))[_0xd5f9('0xab')](loggerCatchQueueSummary(_0xd5f9('0x135'),_0x45c13e));}else{notSendMessagesQueue(_0x45c13e);}}else{freeVariablesPredictive(_0x45c13e);}};Dialer[_0xd5f9('0x99')][_0xd5f9('0x113')]=function(){var _0x179574=this;var _0x44a3e4;for(var _0x3f2896 in this[_0xd5f9('0x20')]){if(this['campaigns'][_0xd5f9('0x9e')](_0x3f2896)){_0x44a3e4=this['campaigns'][_0x3f2896];if(isCampaignIvr(_0x44a3e4[_0xd5f9('0x4c')])&&isActive(_0x44a3e4['active'])){_0x44a3e4[_0xd5f9('0x8e')]=!![];BPromise[_0xd5f9('0xa9')]()['then'](checkIsActive(_0x44a3e4,_0x44a3e4['active']))[_0xd5f9('0xae')](checkInterval(_0x44a3e4))[_0xd5f9('0xae')](_0x179574[_0xd5f9('0x114')](_0x44a3e4))[_0xd5f9('0xae')](_0x179574[_0xd5f9('0x118')](_0x44a3e4[_0xd5f9('0x136')],_0x44a3e4[_0xd5f9('0x137')],_0x44a3e4[_0xd5f9('0x3e')],_0x44a3e4))[_0xd5f9('0xae')](_0x179574[_0xd5f9('0x11a')](_0x44a3e4[_0xd5f9('0x42')],_0x44a3e4[_0xd5f9('0x137')],_0x44a3e4['name'],_0x44a3e4))[_0xd5f9('0xae')](_0x179574[_0xd5f9('0x132')](_0x44a3e4))[_0xd5f9('0xab')](loggerCatchQueueSummary('[syncCampaigns]',_0x44a3e4));}else{notSendMessagesCampaign(_0x44a3e4);}}}};function getCallerIdRandom(_0x3e85e1,_0x5ed8a2){var _0x132029,_0x54f33e,_0x1733c4;if(_0x5ed8a2<=0x0){_0x5ed8a2=0x1;}_0x132029=new RegExp('\x5cw{0,'+_0x5ed8a2+'}$');_0x54f33e=Math[_0xd5f9('0x138')](0xa,_0x5ed8a2-0x1);_0x1733c4=Math[_0xd5f9('0x138')](0xa,_0x5ed8a2)-0x1;return util[_0xd5f9('0x71')]('%s',_[_0xd5f9('0x139')](_0x3e85e1,_0x132029,_['random'](_0x54f33e,_0x1733c4)));}function extractCalleridName(_0x15bedf){var _0x54587f=_0x15bedf[_0xd5f9('0x13a')](/"(.*?)"/);return _0x54587f?_0x54587f[0x1]:_0x15bedf;}function extractCalleridNumber(_0x493d23){var _0x5bbf9a=_0x493d23[_0xd5f9('0x13a')](/<(.*?)>/);return _0x5bbf9a?_0x5bbf9a[0x1]:_0x493d23;}Dialer['prototype'][_0xd5f9('0x13b')]=function(_0x2fb237,_0x10ddac){var _0x2b5772=this;var _0x45e30f=uuid['v4']();this[_0xd5f9('0x25')][_0x45e30f]=new Action(_0x2fb237,_0x10ddac,_0x45e30f);return new BPromise(function(_0x3ef643,_0x38ef18){if(_[_0xd5f9('0x3c')](_0x2fb237)&&'object'!==typeof _0x2fb237){return _0x38ef18(msgResponse(_0xd5f9('0x13c'),_0xd5f9('0x11b'),'voiceQueue\x20is\x20undefine'));}if(_[_0xd5f9('0x3c')](_0x10ddac[_0xd5f9('0x13d')][_0xd5f9('0x13e')])||_0x10ddac[_0xd5f9('0x13d')][_0xd5f9('0x13e')]===null){return _0x38ef18(msgResponse(_0xd5f9('0x13c'),'Failure',_0xd5f9('0x13f')));}var _0x1bb29a={'XMD-CALLERID':_0x2b5772[_0xd5f9('0x25')][_0x45e30f][_0xd5f9('0x140')](),'XMD-AGI':_0x2fb237[_0xd5f9('0xe2')]?util[_0xd5f9('0x71')](_0xd5f9('0x141'),ipAgi,_0x2fb237[_0xd5f9('0xe2')]):_0xd5f9('0x142'),'XMD-AGIAFTER':_0x2fb237['dialQueueProject2']?util['format'](_0xd5f9('0x141'),ipAgi,_0x2fb237['dialQueueProject2']):'NONE','XMD-QUEUE':_0x2fb237['type']===_0xd5f9('0x4d')?util[_0xd5f9('0x71')](_0xd5f9('0x143'),_0x2fb237['name'],_0x2fb237[_0xd5f9('0x144')]||'',_0x2fb237[_0xd5f9('0x145')]?'c':'',_0x2fb237[_0xd5f9('0xf3')]||0x3):_0xd5f9('0x142'),'XMD-CONTACTID':_0x10ddac[_0xd5f9('0xc1')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2b5772[_0xd5f9('0x25')][_0x45e30f][_0xd5f9('0x140')](),'XMD-AMD':_0x2fb237['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':_0xd5f9('0xd0')};if(_0x2fb237[_0xd5f9('0xd1')]){_0x1bb29a[_0xd5f9('0x146')]=_0x2fb237[_0xd5f9('0x147')]||0x9c4;_0x1bb29a[_0xd5f9('0x148')]=_0x2fb237['dialAMDGreeting']||0x5dc;_0x1bb29a[_0xd5f9('0x149')]=_0x2fb237['dialAMDAfterGreetingSilence']||0x320;_0x1bb29a[_0xd5f9('0x14a')]=_0x2fb237['dialAMDTotalAnalysisTime']||0x1388;_0x1bb29a[_0xd5f9('0x14b')]=_0x2fb237[_0xd5f9('0x14c')]||0x64;_0x1bb29a[_0xd5f9('0x14d')]=_0x2fb237[_0xd5f9('0x14e')]||0x32;_0x1bb29a[_0xd5f9('0x14f')]=_0x2fb237[_0xd5f9('0x150')]||0x3;_0x1bb29a[_0xd5f9('0x151')]=_0x2fb237['dialAMDSilenceThreshold']||0x100;_0x1bb29a[_0xd5f9('0x152')]=_0x2fb237[_0xd5f9('0x153')]||0x1388;}if(_0x2fb237[_0xd5f9('0x4c')]===_0xd5f9('0x4d')){_0x1bb29a[_0xd5f9('0x154')]=_0x10ddac[_0xd5f9('0xc4')];}else{_0x1bb29a[_0xd5f9('0x155')]=_0x10ddac['CampaignId'];}for(var _0x22f289 in _0x10ddac[_0xd5f9('0x13d')]){if(_0x10ddac[_0xd5f9('0x13d')][_0xd5f9('0x9e')](_0x22f289)){if(isNotNull(_0x10ddac['Contact'][_0x22f289])&&_0x22f289!=='id'&&_0x22f289!==_0xd5f9('0x156')&&_0x22f289!==_0xd5f9('0x157')&&_0x22f289!==_0xd5f9('0x158')){_0x1bb29a[util[_0xd5f9('0x71')](_0xd5f9('0x159'),_0xd5f9('0x15a'),_['toUpper'](_0x22f289))]=_0x10ddac[_0xd5f9('0x13d')][_0x22f289];}}}var _0x53a279=_0x2b5772[_0xd5f9('0xc9')](_0x2fb237[_0xd5f9('0x6e')])?getCallerId(_0x2fb237['Trunk'][_0xd5f9('0x15b')],_0x2fb237[_0xd5f9('0x55')],_0x2fb237[_0xd5f9('0x15c')]>0x0?getCallerIdRandom(_0x2fb237[_0xd5f9('0x56')],_0x2fb237[_0xd5f9('0x15c')]):_0x2fb237['dialOriginateCallerIdNumber']):getCallerId(_[_0xd5f9('0xce')](_0x2fb237['TrunkBackup'])?_0x2fb237['Trunk'][_0xd5f9('0x15b')]:_0x2fb237[_0xd5f9('0x115')][_0xd5f9('0x15b')],_0x2fb237['dialOriginateCallerIdName'],_0x2fb237[_0xd5f9('0x15c')]>0x0?getCallerIdRandom(_0x2fb237[_0xd5f9('0x56')],_0x2fb237[_0xd5f9('0x15c')]):_0x2fb237[_0xd5f9('0x56')]);if(_0x53a279){_0x1bb29a[_0xd5f9('0x15d')]=_0x2b5772[_0xd5f9('0x25')][_0x45e30f][_0xd5f9('0x15e')]=extractCalleridName(_0x53a279);_0x1bb29a[_0xd5f9('0x15f')]=_0x2b5772['actions'][_0x45e30f][_0xd5f9('0x160')]=extractCalleridNumber(_0x53a279);}return ami['Action']({'actionid':_0x45e30f,'action':_0xd5f9('0x13c'),'channel':_0x2b5772[_0xd5f9('0xc9')](_0x2fb237[_0xd5f9('0x6e')])?util[_0xd5f9('0x71')](_0xd5f9('0x161'),_0x2fb237['Trunk'][_0xd5f9('0x3e')],isNotNull(_0x2fb237['dialPrefix'])?_0x2fb237[_0xd5f9('0x58')][_0xd5f9('0x162')]()||'':'',_0x2fb237[_0xd5f9('0x163')]>0x0?_0x10ddac[_0xd5f9('0x13d')]['phone']['substring'](_0x2fb237[_0xd5f9('0x163')]):_0x10ddac[_0xd5f9('0x13d')][_0xd5f9('0x13e')]):util[_0xd5f9('0x71')](_0xd5f9('0x161'),_['isNil'](_0x2fb237[_0xd5f9('0x115')])?_0x2fb237['Trunk'][_0xd5f9('0x3e')]:_0x2fb237['TrunkBackup'][_0xd5f9('0x3e')],isNotNull(_0x2fb237['dialPrefix'])?_0x2fb237[_0xd5f9('0x58')][_0xd5f9('0x162')]()||'':'',_0x2fb237['dialCutDigit']>0x0?_0x10ddac[_0xd5f9('0x13d')][_0xd5f9('0x13e')][_0xd5f9('0x164')](_0x2fb237['dialCutDigit']):_0x10ddac[_0xd5f9('0x13d')][_0xd5f9('0x13e')]),'callerid':_0x53a279,'Exten':_0xd5f9('0xd0'),'Context':_0xd5f9('0x165'),'Priority':'1','variable':_0x1bb29a,'timeout':(_0x2fb237[_0xd5f9('0x57')]||0x1e)*0x3e8,'async':!![],'channelid':_0x45e30f})[_0xd5f9('0xae')](function(_0x1f7b80){return _0x3ef643(_0x1f7b80);})['catch'](function(_0x2e3dab){_0x2fb237[_0xd5f9('0x5f')]+=0x1;var _0x3ad029=new History(_0x2b5772[_0xd5f9('0x25')][_0x45e30f]);logger['error'](util[_0xd5f9('0x71')]('[originateError]:\x20%s',JSON[_0xd5f9('0x70')](_0x2e3dab)));_0x3ad029[_0xd5f9('0x96')]=0xe;_0x3ad029[_0xd5f9('0x97')]=_0xd5f9('0x166');_0x3ad029[_0xd5f9('0x98')]=moment()[_0xd5f9('0x71')](_0xd5f9('0xec'));_0x3ad029['endtime']=_0x3ad029['starttime'];_0x2b5772['createHistory'](_0x3ad029)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x167')));_0x2b5772[_0xd5f9('0xb8')](_0x3ad029)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x167')))[_0xd5f9('0x109')](function(){delete _0x2b5772['actions'][_0x45e30f];return _0x38ef18(msgResponse('originate','Error',_0xd5f9('0x168')));});});});};Dialer['prototype'][_0xd5f9('0x30')]=function(_0x55cc76){var _0x54ce3e=this['actions'][_0x55cc76[_0xd5f9('0xfa')]];var _0x349d61=this;if(_0x54ce3e){delete this[_0xd5f9('0x25')][_0x55cc76[_0xd5f9('0xfa')]];_0x54ce3e[_0xd5f9('0xf2')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1cb201=_0x54ce3e[_0xd5f9('0x4c')]===_0xd5f9('0xa7')?this[_0xd5f9('0x20')][_0x54ce3e[_0xd5f9('0xa5')]]:this['voiceQueues'][_0x54ce3e[_0xd5f9('0x169')]()];if(!this[_0xd5f9('0xc7')](_0x55cc76[_0xd5f9('0x16a')])){this[_0xd5f9('0xa3')](_0x1cb201);return this[_0xd5f9('0x16b')](_0x54ce3e,_0x1cb201,_0x55cc76)['then'](function(_0x5b3a9b){})[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x16c')));}else{this[_0xd5f9('0x27')][_0x55cc76[_0xd5f9('0xd4')]]=_0x54ce3e;}}};Dialer[_0xd5f9('0x99')]['checkRetriveMax']=function(_0x29e644,_0x28621c,_0x24cf25){var _0x1c3d3c=new History(_0x28621c);if(_0x1c3d3c[_0xd5f9('0x16d')]+_0x1c3d3c[_0xd5f9('0x16e')]+_0x1c3d3c['countnoanswerretry']>=_0x24cf25['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x29e644){case 0x3:if(_0x1c3d3c['countnoanswerretry']>=_0x24cf25['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0xd5f9('0xb3')]({'active':![],'countnoanswerretry':_0x1c3d3c[_0xd5f9('0x16f')]+=0x1,'scheduledat':moment()[_0xd5f9('0x170')](_0x24cf25[_0xd5f9('0x171')],_0xd5f9('0x172'))[_0xd5f9('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c3d3c[_0xd5f9('0xc1')],'ListId':_0x1c3d3c[_0xd5f9('0xc2')],'VoiceQueueId':_0x1c3d3c['VoiceQueueId']||undefined,'CampaignId':_0x1c3d3c[_0xd5f9('0xc5')]||undefined})[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x173')));}break;case 0x5:if(_0x1c3d3c['countbusyretry']>=_0x24cf25[_0xd5f9('0x174')]-0x1){return!![];}else{this[_0xd5f9('0xb3')]({'active':![],'countbusyretry':_0x1c3d3c['countbusyretry']+=0x1,'scheduledat':moment()[_0xd5f9('0x170')](_0x24cf25['dialBusyRetryFrequency'],'minutes')[_0xd5f9('0x71')](_0xd5f9('0xec')),'ContactId':_0x1c3d3c[_0xd5f9('0xc1')],'ListId':_0x1c3d3c['ListId'],'VoiceQueueId':_0x1c3d3c[_0xd5f9('0xc4')]||undefined,'CampaignId':_0x1c3d3c[_0xd5f9('0xc5')]||undefined})[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x175')));}break;case 0x8:if(_0x1c3d3c[_0xd5f9('0x16e')]>=_0x24cf25['dialCongestionMaxRetry']-0x1){return!![];}else{this[_0xd5f9('0xb3')]({'active':![],'countcongestionretry':_0x1c3d3c[_0xd5f9('0x16e')]+=0x1,'scheduledat':moment()[_0xd5f9('0x170')](_0x24cf25[_0xd5f9('0x176')],_0xd5f9('0x172'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c3d3c['ContactId'],'ListId':_0x1c3d3c[_0xd5f9('0xc2')],'VoiceQueueId':_0x1c3d3c[_0xd5f9('0xc4')]||undefined,'CampaignId':_0x1c3d3c['CampaignId']||undefined})[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x177')));}break;default:return!![];}};Dialer['prototype'][_0xd5f9('0x16b')]=function(_0x184cc9,_0x3ea5e0,_0x93245d){var _0x6c52cf=this;var _0x12e520=new History(_0x184cc9);return new BPromise(function(_0x435169,_0x3f3f50){if(_['isUndefined'](_0x3ea5e0)&&'object'!==typeof _0x3ea5e0){return _0x3f3f50(msgResponse(_0xd5f9('0x178'),_0xd5f9('0x11b'),_0xd5f9('0x179')));}if(_[_0xd5f9('0x3c')](_0x93245d)&&_0xd5f9('0x17a')!==typeof _0x93245d){return _0x3f3f50(msgResponse(_0xd5f9('0x178'),_0xd5f9('0x11b'),_0xd5f9('0x17b')));}switch(_0x93245d[_0xd5f9('0xe8')]){case'0':_0x3ea5e0[_0xd5f9('0x17c')]+=0x1;_0x12e520[_0xd5f9('0x96')]=0x0;_0x12e520['statedesc']='NoSuchNumber';_0x6c52cf[_0xd5f9('0xba')](_0x12e520)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x17d')));if(_0x6c52cf['checkRetriveMax'](0x0,_0x184cc9,_0x3ea5e0)){if(_0x12e520[_0xd5f9('0x16d')]+_0x12e520[_0xd5f9('0x16e')]+_0x12e520[_0xd5f9('0x16f')]>=_0x3ea5e0['dialGlobalMaxRetry']){_0x6c52cf[_0xd5f9('0x17e')](_0x12e520,_0x435169,_0x3f3f50,_0xd5f9('0x17f'));}else{_0x6c52cf['createStateFinal'](_0x12e520,_0x435169,_0x3f3f50,_0xd5f9('0x17f'));}}break;case'3':_0x3ea5e0[_0xd5f9('0x5e')]+=0x1;_0x12e520[_0xd5f9('0x96')]=0x3;_0x12e520[_0xd5f9('0x97')]=_0xd5f9('0x180');_0x12e520[_0xd5f9('0x16f')]+=0x1;_0x12e520['countglobal']+=0x1;_0x6c52cf[_0xd5f9('0xba')](_0x12e520)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x181')));if(_0x6c52cf[_0xd5f9('0x182')](0x3,_0x184cc9,_0x3ea5e0)){if(_0x12e520[_0xd5f9('0x16f')]>=_0x3ea5e0[_0xd5f9('0x183')]){_0x6c52cf[_0xd5f9('0x184')](_0x12e520,_0x435169,_0x3f3f50,_0xd5f9('0x185'));}else{_0x6c52cf[_0xd5f9('0x17e')](_0x12e520,_0x435169,_0x3f3f50,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3ea5e0[_0xd5f9('0x186')]+=0x1;_0x12e520[_0xd5f9('0x96')]=0x5;_0x12e520[_0xd5f9('0x97')]=_0xd5f9('0x187');_0x12e520[_0xd5f9('0x16d')]+=0x1;_0x12e520[_0xd5f9('0x188')]+=0x1;_0x6c52cf['createHistory'](_0x12e520)[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x189')));if(_0x6c52cf[_0xd5f9('0x182')](0x5,_0x184cc9,_0x3ea5e0)){if(_0x12e520['countbusyretry']>=_0x3ea5e0['dialBusyMaxRetry']){_0x6c52cf['createStateFinal'](_0x12e520,_0x435169,_0x3f3f50,_0xd5f9('0x18a'));}else{_0x6c52cf[_0xd5f9('0x17e')](_0x12e520,_0x435169,_0x3f3f50,_0xd5f9('0x18a'));}}break;case'8':_0x3ea5e0[_0xd5f9('0x5c')]+=0x1;_0x12e520[_0xd5f9('0x96')]=0x8;_0x12e520[_0xd5f9('0x97')]='Congestion';_0x12e520['countcongestionretry']+=0x1;_0x12e520[_0xd5f9('0x188')]+=0x1;_0x6c52cf['createHistory'](_0x12e520)['catch'](loggerCatch(_0xd5f9('0x18b')));if(_0x6c52cf[_0xd5f9('0x182')](0x8,_0x184cc9,_0x3ea5e0)){if(_0x12e520[_0xd5f9('0x16e')]>=_0x3ea5e0[_0xd5f9('0x18c')]){_0x6c52cf[_0xd5f9('0x184')](_0x12e520,_0x435169,_0x3f3f50,_0xd5f9('0x18d'));}else{_0x6c52cf[_0xd5f9('0x17e')](_0x12e520,_0x435169,_0x3f3f50,'reason\x208\x20congestion');}}break;default:_0x3ea5e0[_0xd5f9('0x61')]+=0x1;_0x12e520[_0xd5f9('0x96')]=0xc;_0x12e520[_0xd5f9('0x97')]=_0x93245d[_0xd5f9('0xe8')];_0x6c52cf['createHistory'](_0x12e520)[_0xd5f9('0xab')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x6c52cf[_0xd5f9('0x182')](_0x93245d[_0xd5f9('0xe8')],_0x184cc9,_0x3ea5e0)){if(_0x12e520[_0xd5f9('0x16d')]+_0x12e520['countcongestionretry']+_0x12e520[_0xd5f9('0x16f')]>=_0x3ea5e0[_0xd5f9('0x18e')]){_0x6c52cf['stateGlobal'](_0x12e520,_0x435169,_0x3f3f50,_0x93245d[_0xd5f9('0xe8')]);}else{_0x6c52cf[_0xd5f9('0x184')](_0x12e520,_0x435169,_0x3f3f50,_0x93245d[_0xd5f9('0xe8')]);}}}});};Dialer[_0xd5f9('0x99')][_0xd5f9('0x17e')]=function(_0x566dea,_0x1197e2,_0x304948,_0x3b6f6d){var _0x4a53c7=new Final(_0x566dea);_0x4a53c7[_0xd5f9('0x96')]=0xf;_0x4a53c7[_0xd5f9('0x97')]=_0xd5f9('0x18f');this[_0xd5f9('0x184')](_0x4a53c7,_0x1197e2,_0x304948,_0x3b6f6d);};Dialer[_0xd5f9('0x99')]['createStateFinal']=function(_0x15f8b8,_0x508455,_0x59acb5,_0x4cfe91){this[_0xd5f9('0xb8')](_0x15f8b8)[_0xd5f9('0xae')](function(_0x3ee3a7){return _0x508455(msgResponse(_0xd5f9('0x178'),_0xd5f9('0xc8'),_0x4cfe91));})[_0xd5f9('0xab')](function(_0x7f9d5e){return _0x59acb5(msgResponse(_0xd5f9('0x190'),'Failure',_0xd5f9('0x191')));});};Dialer[_0xd5f9('0x99')]['predictive']=function(_0x3221b2){var _0xb3590b=this;var _0x192f5e=_0x3221b2[_0xd5f9('0x192')]/0x64;var _0x543faa=_0x3221b2[_0xd5f9('0x193')]/(_0x3221b2[_0xd5f9('0x193')]+_0x3221b2[_0xd5f9('0x5a')]);var _0x32de52=_0x3221b2['loggedIn']-_0x3221b2['predictiveIntervalPauses']-_0x3221b2['waiting']-_0x3221b2[_0xd5f9('0x6d')]-_0x3221b2[_0xd5f9('0x51')];var _0x4d2934=(_0x3221b2['loggedIn']-_0x3221b2[_0xd5f9('0x6b')])*_0x3221b2['predictiveIntervalLowerLimit'];var _0x452255=Math[_0xd5f9('0x194')](_0x3221b2[_0xd5f9('0x195')]*_0x3221b2[_0xd5f9('0x196')]*_0x3221b2['predictiveIntervalHitRate']*_0x3221b2[_0xd5f9('0x6a')]);if(_[_0xd5f9('0x3c')](_0x3221b2['startProgressive'])){loggerPredictive['info'](_0xd5f9('0x197'));if(!_['isUndefined'](_0x3221b2[_0xd5f9('0x7e')])){_0x3221b2['startPredictive']=undefined;loggerPredictive['error'](_0xd5f9('0x198'),_0xd5f9('0x199'));}if(!_[_0xd5f9('0x3c')](_0x3221b2[_0xd5f9('0x80')])){loggerPredictive['error'](_0xd5f9('0x198'),_0xd5f9('0x19a'));clearInterval(_0x3221b2['handlePredictive']);_0x3221b2[_0xd5f9('0x80')]=undefined;}_0x3221b2[_0xd5f9('0x29')]=moment()[_0xd5f9('0x71')](_0xd5f9('0xec'));loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x19b'),_0x3221b2[_0xd5f9('0x29')],_0x3221b2['name']);this[_0xd5f9('0x12c')](_0x3221b2,0x1);}else if(ifInterval(_0x3221b2['dialPredictiveInterval'],_0x3221b2[_0xd5f9('0x29')])){this[_0xd5f9('0x12c')](_0x3221b2,0x1);loggerPredictiveCalls[_0xd5f9('0x77')](_0xd5f9('0x19c'),_0x3221b2[_0xd5f9('0x29')],_0x3221b2[_0xd5f9('0x3e')]);_0x3221b2[_0xd5f9('0x195')]=0x0;_0x3221b2['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x192f5e<_0x543faa&&_0x3221b2[_0xd5f9('0x19d')]===_0xd5f9('0x19e')){freeVariablesPredictive(_0x3221b2);loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x19f'),_0xd5f9('0x1a0'),_0x543faa,_0xd5f9('0x29'),_0x3221b2[_0xd5f9('0x3e')]);}else if(_0x32de52>_0x4d2934){freeVariablesPredictive(_0x3221b2);loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x1a1'),_0xd5f9('0x1a2'),_0x32de52,'agent\x20max\x20free\x20',_0x4d2934);}else if(_0x452255<_0x3221b2['predictiveIntervalErlangCallsDroppedCalls']&&_0x3221b2[_0xd5f9('0x19d')]===_0xd5f9('0x19e')){freeVariablesPredictive(_0x3221b2);loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x1a3'),_0xd5f9('0x1a4'),_0x452255,_0xd5f9('0x1a5'),_0x3221b2[_0xd5f9('0x67')],_0xd5f9('0x29'),_0x3221b2['name']);}else if(!ifInterval(_0x3221b2[_0xd5f9('0x1a6')],_0x3221b2['startProgressive'])&&_[_0xd5f9('0x3c')](_0x3221b2[_0xd5f9('0x7e')])&&!_[_0xd5f9('0x3c')](_0x3221b2['startProgressive'])){_0x3221b2['startPredictive']=moment()['format'](_0xd5f9('0xec'));loggerPredictive[_0xd5f9('0x77')]('[startMethodPredictive][StartPredictive][First]',_0x3221b2[_0xd5f9('0x7e')],_0x3221b2[_0xd5f9('0x3e')]);this[_0xd5f9('0x1a7')](_0x3221b2[_0xd5f9('0x1a6')])[_0xd5f9('0xae')](this[_0xd5f9('0x1a8')](_0x3221b2))[_0xd5f9('0xae')](mergeDataErlangB(_0x3221b2))[_0xd5f9('0xae')](this[_0xd5f9('0x1a9')](_0x3221b2))['catch'](loggerCatchPredictive(_0xd5f9('0x1aa'),_0x3221b2));}else if(!ifInterval(_0x3221b2['dialPredictiveInterval'],_0x3221b2['startPredictive'])){_0x3221b2[_0xd5f9('0x67')]=0x0;_0x3221b2[_0xd5f9('0x7e')]=moment()[_0xd5f9('0x71')](_0xd5f9('0xec'));loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x1ab'),_0x3221b2[_0xd5f9('0x7e')],_0x3221b2[_0xd5f9('0x3e')]);clearInterval(_0x3221b2[_0xd5f9('0x80')]);_0x3221b2[_0xd5f9('0x80')]=undefined;this[_0xd5f9('0x1a7')](_0x3221b2[_0xd5f9('0x1a6')])['then'](this[_0xd5f9('0x1a8')](_0x3221b2))['then'](mergeDataErlangB(_0x3221b2))[_0xd5f9('0xae')](this['startMethodPredictive'](_0x3221b2))['catch'](loggerCatchPredictive(_0xd5f9('0x1aa'),_0x3221b2));}};Dialer['prototype'][_0xd5f9('0x1a8')]=function(_0x3dcb78){var _0x216fa9=this;return function(_0x3335db){return new BPromise(function(_0x119aed,_0x552cca){_[_0xd5f9('0x101')](_0x3dcb78,_0x3335db[0x0]);if(checkGetDataPredictive(_0x3335db[0x0])){loggerPredictive[_0xd5f9('0x77')](JSON[_0xd5f9('0x70')](_0x3335db[0x0]));if(_0x3dcb78[_0xd5f9('0x19d')]==='dropRate'){return _0x216fa9[_0xd5f9('0xb6')](_0x3dcb78['id'])[_0xd5f9('0xae')](function(_0x1d8129){var _0x3425c7=_0x3dcb78[_0xd5f9('0x134')]-_0x1d8129[0x0][_0xd5f9('0x1ac')];var _0x20ceb5=_0x3dcb78[_0xd5f9('0x1a6')]*0x3c;var _0x3cfeef=_0x3335db[0x0][_0xd5f9('0x64')]+_0x3335db[0x0][_0xd5f9('0x63')];var _0x4a62f6=(_0x3335db[0x0][_0xd5f9('0x62')]+_0x3335db[0x0][_0xd5f9('0x65')]+_0x3335db[0x0][_0xd5f9('0xf7')])/_0x3335db[0x0]['predictiveIntervalTotalCalls'];var _0x3952b2=_0x3dcb78[_0xd5f9('0x192')]/0x64;_0x3dcb78[_0xd5f9('0x6b')]=_0x1d8129[0x0][_0xd5f9('0x1ac')]||0x0;_0x3dcb78[_0xd5f9('0x68')]=_0x4a62f6>0x0?_0x4a62f6:0x1;return _0x216fa9[_0xd5f9('0x1ad')](_0x3425c7,_0x20ceb5,_0x3cfeef,_0x4a62f6,_0x3952b2);})[_0xd5f9('0xae')](function(_0x308f29){return _0x119aed(_0x308f29);})[_0xd5f9('0xab')](function(_0x48d39c){return _0x552cca(msgResponse(_0xd5f9('0x1ae'),'Failure',JSON[_0xd5f9('0x70')](_0x48d39c)));});}if(_0x3dcb78[_0xd5f9('0x19d')]===_0xd5f9('0x1af')){return _0x216fa9[_0xd5f9('0xb6')](_0x3dcb78['id'])['then'](function(_0x4c7973){var _0x4ca38c=_0x3dcb78[_0xd5f9('0x134')]-_0x4c7973[0x0]['outboundQueuePauses'];var _0x5e190e=_0x3dcb78[_0xd5f9('0x1a6')]*0x3c;var _0xe04158=_0x3335db[0x0][_0xd5f9('0x64')]+_0x3335db[0x0][_0xd5f9('0x63')];var _0x50b855=(_0x3335db[0x0][_0xd5f9('0x62')]+_0x3335db[0x0][_0xd5f9('0x65')]+_0x3335db[0x0][_0xd5f9('0xf7')])/_0x3335db[0x0][_0xd5f9('0x6c')];var _0x52f1b6=_0x3dcb78['dialPredictiveOptimizationPercentage']/0x64;_0x3dcb78[_0xd5f9('0x6b')]=_0x4c7973[0x0][_0xd5f9('0x1ac')]||0x0;_0x3dcb78['predictiveIntervalHitRate']=_0x50b855>0x0?_0x50b855:0x1;return _0x216fa9[_0xd5f9('0x1b0')](_0x4ca38c,_0x5e190e,_0xe04158,_0x50b855,_0x52f1b6);})[_0xd5f9('0xae')](function(_0x3f54a7){return _0x119aed(_0x3f54a7);})[_0xd5f9('0xab')](function(_0x5c95e3){return _0x552cca(msgResponse('[CatchErlangB]',_0xd5f9('0x11b'),JSON['stringify'](_0x5c95e3)));});}}else{return _0x552cca(msgResponse(_0xd5f9('0x1b1'),_0xd5f9('0x11b'),_0xd5f9('0x1b2')));}});};};Dialer[_0xd5f9('0x99')][_0xd5f9('0x1a9')]=function(_0x21296d){var _0x39d35b=this;return function(){var _0x2a9244=0x0;var _0x4b9ecc=Math[_0xd5f9('0x194')](_0x21296d[_0xd5f9('0x1b3')]*0x3e8);if(_0x4b9ecc>0x0){_0x4b9ecc=_0x4b9ecc<0x64?0x64:_0x4b9ecc;loggerPredictive['info'](_0xd5f9('0x1b4'),_0x4b9ecc);_0x21296d[_0xd5f9('0x80')]=setInterval(function(){_0x39d35b[_0xd5f9('0x80')](_0x21296d);loggerPredictiveCalls[_0xd5f9('0x77')](_0xd5f9('0x1b5'),_0x2a9244+=0x1);},_0x4b9ecc);}else{loggerPredictive[_0xd5f9('0x77')]('[startMethodPredictive][milliseconds]\x20',_0xd5f9('0x1b6'),_0x4b9ecc);}};};Dialer[_0xd5f9('0x99')][_0xd5f9('0x1b7')]=function(_0x2167aa,_0x2e6ad2){var _0x54ea7c=this;return function(_0x5421ae){if(_[_0xd5f9('0x76')](_0x5421ae)){if(_[_0xd5f9('0xce')](_0x2e6ad2[_0xd5f9('0xc3')])||!_0x2e6ad2[_0xd5f9('0x1b8')]){if(_0x2167aa[_0xd5f9('0x133')]===_0xd5f9('0x12f')){_0x2167aa[_0xd5f9('0x103')]=_[_0xd5f9('0x3c')](_0x2167aa[_0xd5f9('0x103')])?!![]:_0x2167aa['queueStatusComplete'];var _0x216eb4=uuid['v4']();_0x54ea7c[_0xd5f9('0x25')][_0x216eb4]=new Action(_0x2167aa,_0x2e6ad2,_0x216eb4);loggerBooked[_0xd5f9('0x77')](_0xd5f9('0x1b9'),_0x216eb4,_0xd5f9('0x1ba'),JSON[_0xd5f9('0x70')](_0x2167aa[_0xd5f9('0x103')]),_0xd5f9('0x1bb'),_0x2167aa['name']);if(_0x2167aa['queueStatusComplete']){_0x2167aa['queueStatusComplete']=![];_0x54ea7c[_0xd5f9('0xff')][_0x54ea7c[_0xd5f9('0x25')][_0x216eb4][_0xd5f9('0xa5')]]=[];ami[_0xd5f9('0x9f')]({'actionid':_0x216eb4,'action':'queuestatus','queue':_0x2167aa[_0xd5f9('0x3e')]})[_0xd5f9('0xab')](function(_0x110703){_0x54ea7c['updateOriginated'](_0x2167aa);_0x54ea7c[_0xd5f9('0xb3')]({'active':![],'ContactId':_0x54ea7c[_0xd5f9('0x25')][_0x216eb4][_0xd5f9('0xc1')],'ListId':_0x54ea7c['actions'][_0x216eb4]['ListId'],'VoiceQueueId':_0x54ea7c['actions'][_0x216eb4]['VoiceQueueId']||undefined,'CampaignId':_0x54ea7c[_0xd5f9('0x25')][_0x216eb4]['CampaignId']||undefined})[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x1bc')));delete _0x54ea7c[_0xd5f9('0x25')][_0x216eb4];});}else{loggerBooked[_0xd5f9('0x77')](_0xd5f9('0x1bd'),JSON[_0xd5f9('0x70')](_0x2167aa[_0xd5f9('0x103')]),_0xd5f9('0x1bb'),_0x2167aa['name']);_0x54ea7c[_0xd5f9('0xa3')](_0x2167aa);_0x54ea7c[_0xd5f9('0xb3')]({'active':![],'ContactId':_0x54ea7c[_0xd5f9('0x25')][_0x216eb4][_0xd5f9('0xc1')],'ListId':_0x54ea7c[_0xd5f9('0x25')][_0x216eb4]['ListId'],'VoiceQueueId':_0x54ea7c[_0xd5f9('0x25')][_0x216eb4][_0xd5f9('0xc4')]||undefined,'CampaignId':_0x54ea7c[_0xd5f9('0x25')][_0x216eb4]['CampaignId']||undefined})[_0xd5f9('0xab')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x54ea7c['actions'][_0x216eb4];}}else{return _0x54ea7c[_0xd5f9('0x13b')](_0x2167aa,_0x2e6ad2);}}else{if(getDiff(_0x2e6ad2[_0xd5f9('0x1be')])<_0x2167aa['dialRecallMeTimeout']*0x3c){_0x54ea7c[_0xd5f9('0x1f')][_0xd5f9('0x107')](_0x2e6ad2['id'])[_0xd5f9('0x109')](function(){_0x54ea7c[_0xd5f9('0xa3')](_0x2167aa);});}else{_0x2167aa[_0xd5f9('0x1bf')]+=0x1;_0x54ea7c[_0xd5f9('0xa3')](_0x2167aa);if(_0x2167aa[_0xd5f9('0x1c0')]){_0x54ea7c['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e6ad2[_0xd5f9('0xc1')],'ListId':_0x2e6ad2['ListId'],'VoiceQueueId':_0x2e6ad2[_0xd5f9('0xc4')]||undefined,'CampaignId':_0x2e6ad2['CampaignId']||undefined})['catch'](loggerCatch(_0xd5f9('0x1c1')));_0x54ea7c['createHistory'](createObjHistory(_0x2167aa,_0x2e6ad2,_0xd5f9('0x1c2'),0x17,_0xd5f9('0x1c3')))[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0x1c4')));}else{_0x54ea7c['saveInDb'](createObjHistory(_0x2167aa,_0x2e6ad2,_0xd5f9('0x1c5'),0x16,_0xd5f9('0x1c6')),_0xd5f9('0x1c7'),_0xd5f9('0x1c8'));}}}}else{_0x2167aa[_0xd5f9('0x5b')]+=0x1;_0x54ea7c['saveInDb'](createObjHistory(_0x2167aa,_0x2e6ad2,_0xd5f9('0x1c9'),0xd,_0xd5f9('0x1ca')),_0xd5f9('0x1cb'),_0xd5f9('0x1cc'));throw _0xd5f9('0x1cd');}};};Dialer[_0xd5f9('0x99')][_0xd5f9('0x1ce')]=function(_0xe956e5){var _0x4a8d2a=this;var _0x3070d2=[];var _0x262cdf=_0xe956e5[_0xd5f9('0x1cf')]-_0xe956e5['originated']-_0xe956e5[_0xd5f9('0x1d0')];emitCampaignSummary(_0xe956e5);if(_0x262cdf>0x0){if(_0x262cdf>this['maxNumberOriginate']){_0x262cdf=this[_0xd5f9('0x23')];}_0xe956e5[_0xd5f9('0x1d0')]+=_0x262cdf;this[_0xd5f9('0xb5')](_0xe956e5['id'],_0x262cdf,_0xe956e5['dialOrderByScheduledAt'])[_0xd5f9('0xae')](function(_0x21e28f){_0xe956e5['temp']-=_0x262cdf;_0xe956e5[_0xd5f9('0x1d0')]=_0xe956e5[_0xd5f9('0x1d0')]>0x0?_0xe956e5['temp']:0x0;if(!checkContactEmpty(_0x21e28f)){_0xe956e5[_0xd5f9('0x40')]=_0xd5f9('0x8c');logger[_0xd5f9('0x77')](_0xd5f9('0x1d1')+_0xe956e5['name']);}else{_0xe956e5[_0xd5f9('0x6d')]+=_0x21e28f['length'];_0xe956e5['message']=_0xd5f9('0x1d2');for(var _0x5e7867=0x0;_0x5e7867<_0x21e28f[_0xd5f9('0x86')];_0x5e7867+=0x1){_0xe956e5['ivrTotalCallsDays']+=0x1;if(_[_0xd5f9('0xce')](_0x21e28f[_0x5e7867])||_['isNil'](_0x21e28f[_0x5e7867][_0xd5f9('0x13d')])||_[_0xd5f9('0xce')](_0x21e28f[_0x5e7867][_0xd5f9('0x13d')][_0xd5f9('0x13e')])){_0x4a8d2a[_0xd5f9('0xbe')](_0xd5f9('0x1d3'),_0xe956e5,_0x21e28f[_0x5e7867]);}else{_0x4a8d2a[_0xd5f9('0xaf')](_['pick'](_0x21e28f[_0x5e7867],['CampaignId',_0xd5f9('0x1d4')]))['then'](_0x4a8d2a[_0xd5f9('0x1b7')](_0xe956e5,_0x21e28f[_0x5e7867]))[_0xd5f9('0xab')](_0x4a8d2a[_0xd5f9('0xbd')](_0xd5f9('0x1d5'),_0xe956e5));}}}})[_0xd5f9('0xab')](loggerGetContactDialer(_0xd5f9('0x1d6'),_0xe956e5,_0x262cdf));}};Dialer['prototype'][_0xd5f9('0x12c')]=function(_0x3efbd1,_0xcb5299){var _0x314412=this;var _0x50c520=[];var _0x5ed7ae=_0xcb5299>=0x1?_0xcb5299:0x1;var _0xfd668f=[];if(_0x3efbd1[_0xd5f9('0x133')]==='booked'){_0x5ed7ae=0x1;}var _0x5c9306=Math['floor'](_0x3efbd1[_0xd5f9('0x90')]*_0x5ed7ae)-_0x3efbd1[_0xd5f9('0x6d')]-_0x3efbd1['temp'];emitVoiceQueueSummary(_0x3efbd1);if(_0x3efbd1[_0xd5f9('0x1d7')]>0x0){var _0x15cfea=_0x3efbd1[_0xd5f9('0x1d7')]-_0x3efbd1[_0xd5f9('0x6d')]-_0x3efbd1[_0xd5f9('0x51')]-_0x3efbd1[_0xd5f9('0x1d0')]-_0x3efbd1[_0xd5f9('0x8f')];if(_0x5c9306>_0x15cfea){_0x5c9306=_0x15cfea;}}if(_0x5c9306>0x0){if(_0x3efbd1[_0xd5f9('0x133')]==='booked'){_0x5c9306=0x1;}if(_0x5c9306>this[_0xd5f9('0x23')]){_0x5c9306=this[_0xd5f9('0x23')];}_0x3efbd1[_0xd5f9('0x1d0')]+=_0x5c9306;for(var _0x32ea1d in this[_0xd5f9('0x21')]){if(this[_0xd5f9('0x21')][_0xd5f9('0x9e')](_0x32ea1d)){if(this[_0xd5f9('0x21')][_0x32ea1d]['state']===_0xd5f9('0x1d8')&&this[_0xd5f9('0x21')][_0x32ea1d][_0xd5f9('0xa0')]==='reachable'){_0x50c520['push'](this['agents'][_0x32ea1d]['id']);}}}this['getContactDialer'](_0x3efbd1['id'],_0x50c520,_0x5c9306,_0x3efbd1[_0xd5f9('0x1d9')])['then'](function(_0x3a7a2c){_0x3efbd1['temp']-=_0x5c9306;_0x3efbd1['temp']=_0x3efbd1[_0xd5f9('0x1d0')]>0x0?_0x3efbd1[_0xd5f9('0x1d0')]:0x0;if(!checkContactEmpty(_0x3a7a2c)){_0x314412[_0xd5f9('0xaa')](_0x3efbd1)[_0xd5f9('0xae')](sendMessageReschedule(_0x3efbd1))[_0xd5f9('0xab')](loggerCatch('[countReScheduled]\x20'));}else{_0x3efbd1[_0xd5f9('0x6d')]+=_0x3a7a2c[_0xd5f9('0x86')];_0x3efbd1['message']=_0x3efbd1[_0xd5f9('0x133')]===_0xd5f9('0x12f')?_0xd5f9('0x1da'):'RUNNING';for(var _0x5a7a15=0x0;_0x5a7a15<_0x3a7a2c[_0xd5f9('0x86')];_0x5a7a15+=0x1){if(_[_0xd5f9('0xce')](_0x3a7a2c[_0x5a7a15])||_[_0xd5f9('0xce')](_0x3a7a2c[_0x5a7a15][_0xd5f9('0x13d')])||_['isNil'](_0x3a7a2c[_0x5a7a15]['Contact'][_0xd5f9('0x13e')])){_0x314412[_0xd5f9('0xbe')](_0xd5f9('0x1d3'),_0x3efbd1,_0x3a7a2c[_0x5a7a15]);}else{_0x314412[_0xd5f9('0xad')](_[_0xd5f9('0x106')](_0x3a7a2c[_0x5a7a15],[_0xd5f9('0xc4'),_0xd5f9('0x1d4')]))[_0xd5f9('0xae')](_0x314412['checkContactBlack'](_0x3efbd1,_0x3a7a2c[_0x5a7a15]))['catch'](_0x314412[_0xd5f9('0xbd')]('[actionOriginate]\x20',_0x3efbd1));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x3efbd1,_0x5c9306));}};Dialer[_0xd5f9('0x99')][_0xd5f9('0x80')]=function(_0x329f83){var _0x3391f5=this;if(_0x329f83[_0xd5f9('0x1d7')]>0x0){var _0x59f7e5=_0x329f83[_0xd5f9('0x1d7')]-_0x329f83[_0xd5f9('0x6d')]-_0x329f83[_0xd5f9('0x51')];if(_0x59f7e5>0x0){this[_0xd5f9('0x1db')](_0x329f83);}else{loggerPredictiveCalls[_0xd5f9('0x77')](_0xd5f9('0x1dc'));}}else{this[_0xd5f9('0x1db')](_0x329f83);}};Dialer[_0xd5f9('0x99')][_0xd5f9('0x1db')]=function(_0x474b8c){var _0x38c2b2=this;var _0x561e24=[];_0x474b8c[_0xd5f9('0x6d')]+=0x1;for(var _0x15fc2a in this[_0xd5f9('0x21')]){if(this['agents'][_0xd5f9('0x9e')](_0x15fc2a)){if(this[_0xd5f9('0x21')][_0x15fc2a]['state']==='not_inuse'&&this[_0xd5f9('0x21')][_0x15fc2a]['status']==='reachable'){_0x561e24[_0xd5f9('0x100')](this[_0xd5f9('0x21')][_0x15fc2a]['id']);}}}this['getContactDialer'](_0x474b8c['id'],_0x561e24,0x1,_0x474b8c[_0xd5f9('0x1d9')])[_0xd5f9('0xae')](function(_0x1c46ed){if(!checkContactEmpty(_0x1c46ed)){checkContactLowerLimitOriginate(_0x474b8c,0x1,0x0);_0x38c2b2[_0xd5f9('0xaa')](_0x474b8c)[_0xd5f9('0xae')](sendMessageReschedule(_0x474b8c))[_0xd5f9('0xab')](loggerCatch(_0xd5f9('0xac')));}else{_0x474b8c[_0xd5f9('0x40')]=_0xd5f9('0x1d2');if(_[_0xd5f9('0xce')](_0x1c46ed[0x0])||_['isNil'](_0x1c46ed[0x0][_0xd5f9('0x13d')])||_[_0xd5f9('0xce')](_0x1c46ed[0x0][_0xd5f9('0x13d')]['phone'])){_0x38c2b2[_0xd5f9('0xbe')](_0xd5f9('0x1d3'),_0x474b8c,_0x1c46ed[0x0]);}else{_0x38c2b2[_0xd5f9('0xad')](_[_0xd5f9('0x106')](_0x1c46ed[0x0],[_0xd5f9('0xc4'),_0xd5f9('0x1d4')]))[_0xd5f9('0xae')](_0x38c2b2['checkContactBlack'](_0x474b8c,_0x1c46ed[0x0]))[_0xd5f9('0xab')](_0x38c2b2[_0xd5f9('0xbd')]('[actionOriginatePredictive]\x20',_0x474b8c));}}})[_0xd5f9('0xab')](loggerGetContactDialer('[getContactDialerPredictive]',_0x474b8c,0x1));emitVoiceQueueSummary(_0x474b8c);};Dialer[_0xd5f9('0x99')][_0xd5f9('0x1ad')]=function(_0x24f83a,_0x4cdc47,_0x1c9480,_0x376e61,_0x3f63d7,_0xa92954){loggerPredictive[_0xd5f9('0x77')](_0xd5f9('0x1dd'),_0xd5f9('0x1de'),_0x24f83a,_0xd5f9('0x1df'),_0x4cdc47,_0xd5f9('0x1e0'),_0x1c9480,'\x20p\x20=\x20',_0x376e61,'\x20Amax\x20=\x20',_0x3f63d7);return new BPromise(function(_0x7d13d6,_0x5b3bf2){if(_0x24f83a<=0x0||isNaN(_0x24f83a)){return _0x5b3bf2(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),_0xd5f9('0x1e1')+_0x24f83a));}if(_0x1c9480<=0x0||isNaN(_0x1c9480)){return _0x5b3bf2(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),_0xd5f9('0x1e2')+_0x1c9480));}if(_0x376e61<=0x0||isNaN(_0x376e61)){return _0x5b3bf2(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),_0xd5f9('0x1e3')+_0x376e61));}if(_0x4cdc47<=0x0||isNaN(_0x4cdc47)){return _0x5b3bf2(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),_0xd5f9('0x1e4')+_0x4cdc47));}if(_0x3f63d7<=0x0||isNaN(_0x3f63d7)){return _0x5b3bf2(msgResponse('[abandonmentRate]',_0xd5f9('0x47'),_0xd5f9('0x1e5')+_0x3f63d7));}_0xa92954=_0xa92954||0x0;var _0x4cfe57=0x1/_0x1c9480;var _0x5c0ff3=0x0;var _0x2f0bef=0x0;var _0x4c6afb=0x0;var _0x41694a=0x0;for(var _0x1aeaa6=0x0;_0x4c6afb<_0x3f63d7;_0x1aeaa6+=0x1){_0x2f0bef=_0x1aeaa6/_0x4cdc47;_0x5c0ff3=(_0x376e61*_0x2f0bef+_0xa92954)/_0x4cfe57;_0x4c6afb=erlangb(_0x5c0ff3,_0x24f83a);_0x41694a=_0x5c0ff3/_0x24f83a*(0x1-erlangb(_0x5c0ff3,_0x24f83a));}return _0x7d13d6({'erlangCalls':_0x1aeaa6,'erlangCallToSecond':_0x4cdc47/_0x1aeaa6,'erlangAbandonmentRate':_0x4c6afb,'erlangBusyFactor':_0x41694a});});};Dialer[_0xd5f9('0x99')]['busyFactor']=function(_0x4fd3a1,_0x25e5ad,_0xba8e28,_0x58f4dd,_0x3ee442,_0x14d4e8){loggerPredictive['info']('[busyFactor]',_0xd5f9('0x1de'),_0x4fd3a1,_0xd5f9('0x1df'),_0x25e5ad,_0xd5f9('0x1e0'),_0xba8e28,'\x20p\x20=\x20',_0x58f4dd,_0xd5f9('0x1e6'),_0x3ee442);return new BPromise(function(_0x1ba545,_0x5c5a3b){if(_0x4fd3a1<=0x0||isNaN(_0x4fd3a1)){return _0x5c5a3b(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),_0xd5f9('0x1e1')+_0x4fd3a1));}if(_0xba8e28<=0x0||isNaN(_0xba8e28)){return _0x5c5a3b(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),_0xd5f9('0x1e2')+_0xba8e28));}if(_0x58f4dd<=0x0||isNaN(_0x58f4dd)){return _0x5c5a3b(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),'p\x20=\x20'+_0x58f4dd));}if(_0x25e5ad<=0x0||isNaN(_0x25e5ad)){return _0x5c5a3b(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),_0xd5f9('0x1e4')+_0x25e5ad));}if(_0x3ee442<=0x0||isNaN(_0x3ee442)){return _0x5c5a3b(msgResponse(_0xd5f9('0x1dd'),_0xd5f9('0x47'),'Amax\x20=\x20'+_0x3ee442));}_0x14d4e8=_0x14d4e8||0x0;var _0x98c395=0x1/_0xba8e28;var _0x522fd8=0x0;var _0x504344=0x0;var _0x2bf2a5=0x0;var _0xb5d09d=0x0;for(var _0x160524=0x0;_0xb5d09d<_0x3ee442;_0x160524+=0x1){_0x504344=_0x160524/_0x25e5ad;_0x522fd8=(_0x58f4dd*_0x504344+_0x14d4e8)/_0x98c395;_0x2bf2a5=erlangb(_0x522fd8,_0x4fd3a1);_0xb5d09d=_0x522fd8/_0x4fd3a1*(0x1-erlangb(_0x522fd8,_0x4fd3a1));}return _0x1ba545({'erlangCalls':_0x160524,'erlangCallToSecond':_0x25e5ad/_0x160524,'erlangAbandonmentRate':_0x2bf2a5,'erlangBusyFactor':_0xb5d09d});});};module['exports']=Dialer; \ No newline at end of file +var _0x65bf=['inspect','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','endtime','starttime','clearZombieChannels','[actions]','hasOwnProperty','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','amd','[syncMachine][createHistory]','[syncMachine]','[syncHangupInAMDIvr][createHistory]','Machine','[syncMachineIvr][createHistory]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','[syncHangupIvr]','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','YYYY-MM-DD\x20HH:mm:ss','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','Abandoned','actionid','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','VoiceQueueId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','content','true','command','iftime\x20%s,%s','indexOf','GLOBAL_INTERVAL_IS_OVERTIME','checkDialMethod','handlePower','power','dialPowerLevel','predictive','booked','method\x20not\x20recognized','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','dialer','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','dialGlobalMaxRetry','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','minutes','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','add','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','reason\x203\x20ringing\x20no\x20answer','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','floor','erlangAbandonmentRate','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','agent\x20max\x20free\x20','[startMethodPredictive][StartPredictive][First]','startMethodPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','getDataPredictive','outboundQueuePauses','predictiveIntervalAnsweredCalls','[CatchErlangB]','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','[handlePredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','checkContactBlack','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','dialLimitQueue','not_inuse','length','ACTIVE','tryOriginatePredictive','[handlePredictive][limitChannel]','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','[abandonmentRate]','\x20Ts\x20=\x20','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','\x20m\x20=\x20','\x20interval\x20=\x20','\x20p\x20=\x20','\x20Umin\x20=\x20','Ts\x20=\x20','bluebird','uuid','moment','md5','../../../config/logger','predictiveCalls','syncQueueSummary','../../../config/environment/','socket.io-emitter','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','diff','seconds','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','isEmpty','info','[checkGetDataPredictive][avgTalktime]','predictiveIntervalAvgHoldtime','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','merge','milliseconds','startProgressive','[freeVariablesPredictive]','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error'];(function(_0x48c2d3,_0x8af7ea){var _0x19459b=function(_0xdc0683){while(--_0xdc0683){_0x48c2d3['push'](_0x48c2d3['shift']());}};_0x19459b(++_0x8af7ea);}(_0x65bf,0x14b));var _0xf65b=function(_0x1e10bb,_0x7973a9){_0x1e10bb=_0x1e10bb-0x0;var _0x1a0e4d=_0x65bf[_0x1e10bb];return _0x1a0e4d;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xf65b('0x0'));var uuid=require(_0xf65b('0x1'));var moment=require(_0xf65b('0x2'));var rr=require('rr');var md5=require(_0xf65b('0x3'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xf65b('0x4'))('booked');var loggerPredictive=require(_0xf65b('0x4'))('predictive');var loggerPredictiveCalls=require(_0xf65b('0x4'))(_0xf65b('0x5'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xf65b('0x6'));var config=require(_0xf65b('0x7'));var ami=require('../ami');var io=require(_0xf65b('0x8'))({'host':_0xf65b('0x9'),'port':0x18eb});var cmHopper=require(_0xf65b('0xa'));var cmHopperFinal=require(_0xf65b('0xb'));var cmHopperHistory=require(_0xf65b('0xc'));var cmHopperBlack=require(_0xf65b('0xd'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xf65b('0xe'));var History=require('./history');var Final=require(_0xf65b('0xf'));var AgentComplete=require(_0xf65b('0x10'));var QueueCallerAbandon=require(_0xf65b('0x11'));var Hangup=require(_0xf65b('0x12'));var ipAgi=process['env'][_0xf65b('0x13')]||_0xf65b('0x14');var strategy={'rrmemory':_0xf65b('0x15'),'roundrobin':_0xf65b('0x16')};var Sequence=function(){};Sequence[_0xf65b('0x17')][_0xf65b('0x18')]=function(_0x3710a1){this[_0xf65b('0x19')]=this[_0xf65b('0x19')]?this[_0xf65b('0x19')][_0xf65b('0x1a')](_0x3710a1):_0x3710a1();};function Dialer(_0x189bdf,_0x416b25){this[_0xf65b('0x1b')]=new Sequence();this[_0xf65b('0x1c')]=_0x416b25;this[_0xf65b('0x1d')]=_0x189bdf[_0xf65b('0x1d')];this[_0xf65b('0x1e')]=_0x189bdf[_0xf65b('0x1e')];this[_0xf65b('0x1f')]=_0x189bdf['agents'];this[_0xf65b('0x20')]=_0x189bdf[_0xf65b('0x20')];this[_0xf65b('0x21')]=config[_0xf65b('0x21')]||0x2;this[_0xf65b('0x22')]={};this[_0xf65b('0x23')]={};this[_0xf65b('0x24')]={};this[_0xf65b('0x25')]={};this[_0xf65b('0x26')]={};this[_0xf65b('0x27')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xf65b('0x28')]={};this['queueBookedRR']={};ami['on'](_0xf65b('0x29'),this[_0xf65b('0x2a')][_0xf65b('0x2b')](this));ami['on'](_0xf65b('0x2c'),this[_0xf65b('0x2d')][_0xf65b('0x2b')](this));ami['on'](_0xf65b('0x2e'),this[_0xf65b('0x2f')]['bind'](this));ami['on'](_0xf65b('0x30'),this[_0xf65b('0x31')]['bind'](this));ami['on'](_0xf65b('0x32'),this['syncQueueSummary'][_0xf65b('0x2b')](this));ami['on'](_0xf65b('0x33'),this[_0xf65b('0x34')][_0xf65b('0x2b')](this));ami['on'](_0xf65b('0x35'),this[_0xf65b('0x36')][_0xf65b('0x2b')](this));ami['on'](_0xf65b('0x37'),this[_0xf65b('0x38')][_0xf65b('0x2b')](this));ami['on'](_0xf65b('0x39'),this[_0xf65b('0x3a')]['bind'](this));ami['on'](_0xf65b('0x3b'),this[_0xf65b('0x3c')][_0xf65b('0x2b')](this));this[_0xf65b('0x3d')]();this[_0xf65b('0x3e')]();}function isNotNull(_0x2ab00e){return _0x2ab00e!==null&&!_[_0xf65b('0x3f')](_0x2ab00e);}function checkIsLoggedIn(_0x30b079,_0x6cb577){return function(){if(_0x6cb577<=0x0){_0x30b079[_0xf65b('0x40')]=_0xf65b('0x41');throw _0x30b079[_0xf65b('0x42')]+_0xf65b('0x43');}};}function isActive(_0x2d09b6){return _0x2d09b6;}function checkIsActive(_0x37ebf7,_0x5854e9){return function(){if(!isActive(_0x5854e9)){_0x37ebf7[_0xf65b('0x40')]=_0xf65b('0x44');throw _0x37ebf7[_0xf65b('0x42')]+_0xf65b('0x45');}};}function checkInterval(_0xddf0f4){return function(){if(!isNotNull(_0xddf0f4['Interval'])){_0xddf0f4[_0xf65b('0x40')]=_0xf65b('0x46');throw _0xddf0f4[_0xf65b('0x42')]+_0xf65b('0x47');}if(!isNotNull(_0xddf0f4[_0xf65b('0x48')][_0xf65b('0x49')])){_0xddf0f4['message']='INTERVAL_IS_NULL';throw _0xddf0f4[_0xf65b('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0xddf0f4[_0xf65b('0x48')][_0xf65b('0x49')]))){_0xddf0f4[_0xf65b('0x40')]='INTERVAL_IS_NULL';throw _0xddf0f4['name']+_0xf65b('0x47');}};}function msgResponse(_0x55d308,_0x596198,_0x3816f5){return{'action':_0x55d308,'response':_0x596198,'message':_0x3816f5};}function myreject(_0x5620a9){return function(_0xbda16f){return _0x5620a9(msgResponse(_0xf65b('0x4a'),_0xf65b('0x4b'),JSON[_0xf65b('0x4c')](_0xbda16f)));};}function getSeconds(_0xebd7cb,_0xab7eeb){var _0x40504a=moment(_0xebd7cb)['milliseconds'](0x0);var _0x6d658d=moment(_0xab7eeb)['milliseconds'](0x0);return _0x40504a[_0xf65b('0x4d')](_0x6d658d,_0xf65b('0x4e'));}function emit(_0x27b486,_0x1fc232,_0x49609a){io['to'](_0x27b486)['emit'](_0x1fc232,_0x49609a);}function emitVoiceQueueSummary(_0x1ae1ec){if(_0x1ae1ec['type']===_0xf65b('0x4f')){var _0x329b1e={'id':_0x1ae1ec['id'],'name':_0x1ae1ec[_0xf65b('0x42')],'strategy':_0x1ae1ec[_0xf65b('0x50')],'answered':_0x1ae1ec[_0xf65b('0x51')],'available':_0x1ae1ec[_0xf65b('0x52')],'loggedIn':_0x1ae1ec[_0xf65b('0x53')],'pTalking':_0x1ae1ec[_0xf65b('0x54')],'sumBillable':_0x1ae1ec[_0xf65b('0x55')],'sumDuration':_0x1ae1ec[_0xf65b('0x56')],'sumHoldTime':_0x1ae1ec[_0xf65b('0x57')]||0x0,'talking':_0x1ae1ec[_0xf65b('0x58')],'total':_0x1ae1ec[_0xf65b('0x59')],'type':_0x1ae1ec[_0xf65b('0x5a')],'unmanaged':_0x1ae1ec[_0xf65b('0x5b')],'waiting':_0x1ae1ec[_0xf65b('0x5c')],'loggedInDb':_0x1ae1ec[_0xf65b('0x5d')],'dialActive':_0x1ae1ec[_0xf65b('0x5e')],'dialMethod':_0x1ae1ec[_0xf65b('0x5f')],'dialOriginateCallerIdName':_0x1ae1ec[_0xf65b('0x60')],'dialOriginateCallerIdNumber':_0x1ae1ec[_0xf65b('0x61')],'dialOriginateTimeout':_0x1ae1ec[_0xf65b('0x62')],'dialPrefix':_0x1ae1ec['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1ae1ec['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1ae1ec[_0xf65b('0x63')],'outboundBlacklistCallsDay':_0x1ae1ec[_0xf65b('0x64')],'outboundBusyCallsDay':_0x1ae1ec[_0xf65b('0x65')],'outboundCongestionCallsDay':_0x1ae1ec['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1ae1ec['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1ae1ec[_0xf65b('0x66')],'outboundDropCallsDayTimeout':_0x1ae1ec[_0xf65b('0x67')],'outboundNoAnswerCallsDay':_0x1ae1ec[_0xf65b('0x68')],'outboundNoSuchCallsDay':_0x1ae1ec[_0xf65b('0x69')],'outboundOriginateFailureCallsDay':_0x1ae1ec[_0xf65b('0x6a')],'outboundReCallsDay':_0x1ae1ec[_0xf65b('0x6b')],'outboundRejectCallsDay':_0x1ae1ec[_0xf65b('0x6c')],'outboundUnknownCallsDay':_0x1ae1ec['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x1ae1ec['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1ae1ec['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1ae1ec[_0xf65b('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x1ae1ec[_0xf65b('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x1ae1ec[_0xf65b('0x6f')],'predictiveIntervalErlangCalls':_0x1ae1ec[_0xf65b('0x70')],'predictiveIntervalErlangCallsDroppedCalls':_0x1ae1ec[_0xf65b('0x71')],'predictiveIntervalHitRate':_0x1ae1ec[_0xf65b('0x72')],'predictiveIntervalLowerLimit':_0x1ae1ec[_0xf65b('0x73')],'predictiveIntervalMultiplicativeFactor':_0x1ae1ec[_0xf65b('0x74')],'predictiveIntervalPauses':_0x1ae1ec[_0xf65b('0x75')],'predictiveIntervalTotalCalls':_0x1ae1ec[_0xf65b('0x76')],'message':_0x1ae1ec['message'],'originated':_0x1ae1ec[_0xf65b('0x77')]};if(_0x1ae1ec[_0xf65b('0x78')]){_0x329b1e[_0xf65b('0x78')]={'id':_0x1ae1ec[_0xf65b('0x78')]['id'],'name':_0x1ae1ec[_0xf65b('0x78')][_0xf65b('0x42')],'active':_0x1ae1ec['Trunk'][_0xf65b('0x79')],'callerid':_0x1ae1ec[_0xf65b('0x78')]['callerid']};}if(_0x1ae1ec[_0xf65b('0x48')]){_0x329b1e[_0xf65b('0x48')]={'id':_0x1ae1ec['Interval']['id'],'name':_0x1ae1ec[_0xf65b('0x48')][_0xf65b('0x42')]};}var _0x217d50=md5(JSON[_0xf65b('0x4c')](_0x329b1e));if(_0x1ae1ec['md5']!==_0x217d50){_0x1ae1ec[_0xf65b('0x3')]=_0x217d50;emit(util[_0xf65b('0x7a')](_0xf65b('0x7b'),_0x329b1e[_0xf65b('0x42')]),_0xf65b('0x7c'),_0x329b1e);}}}function emitCampaignSummary(_0x17c7a9){if(_0x17c7a9[_0xf65b('0x5a')]===_0xf65b('0x7d')){emit(util[_0xf65b('0x7a')]('campaign:ivr:%s',_0x17c7a9['name']),_0xf65b('0x7e'),_0x17c7a9);}}function checkGetDataPredictive(_0x24f7f0){if(isNotNull(_0x24f7f0)){if(!_[_0xf65b('0x7f')](_0x24f7f0)){if(_0x24f7f0[_0xf65b('0x76')]>0x0){if(!_[_0xf65b('0x3f')](_0x24f7f0[_0xf65b('0x6d')])&&_0x24f7f0[_0xf65b('0x6d')]>0x0){return!![];}else{loggerPredictive[_0xf65b('0x80')](_0xf65b('0x81'),JSON[_0xf65b('0x4c')](_0x24f7f0));}if(!_[_0xf65b('0x3f')](_0x24f7f0['predictiveIntervalAvgHoldtime'])&&_0x24f7f0[_0xf65b('0x82')]>0x0){return!![];}else{loggerPredictive['info']('[checkGetDataPredictive][avgHoldtime]',JSON[_0xf65b('0x4c')](_0x24f7f0));}}else{loggerPredictive[_0xf65b('0x80')]('[checkGetDataPredictive][totalCalls]',JSON['stringify'](_0x24f7f0));}}else{loggerPredictive[_0xf65b('0x80')](_0xf65b('0x83'),JSON[_0xf65b('0x4c')](_0x24f7f0));}}else{loggerPredictive[_0xf65b('0x80')](_0xf65b('0x84'),JSON[_0xf65b('0x4c')](_0x24f7f0));}return![];}function mergeDataErlangB(_0x26625a){return function(_0x5ae217){loggerPredictive[_0xf65b('0x80')](_0xf65b('0x85'),JSON[_0xf65b('0x4c')](_0x5ae217));_[_0xf65b('0x86')](_0x26625a,_0x5ae217);};}function getDiff(_0x515ec0){var _0x5210f0=moment()['milliseconds'](0x0);var _0x2908a7=moment(_0x515ec0)[_0xf65b('0x87')](0x0);return _0x5210f0[_0xf65b('0x4d')](_0x2908a7,_0xf65b('0x4e'));}function ifInterval(_0x27fa33,_0x3f7b14){if(_[_0xf65b('0x3f')](_0x3f7b14)){return![];}if(getDiff(_0x3f7b14)<_0x27fa33*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x41c599){if(isNotNull(_0x41c599)){if(!_['isUndefined'](_0x41c599[_0xf65b('0x88')])){_0x41c599[_0xf65b('0x88')]=undefined;loggerPredictive[_0xf65b('0x80')]('[freeVariablesPredictive]',_0xf65b('0x88'),_0x41c599[_0xf65b('0x42')]);}if(!_['isUndefined'](_0x41c599['startPredictive'])){_0x41c599[_0xf65b('0x27')]=undefined;loggerPredictive[_0xf65b('0x80')](_0xf65b('0x89'),_0xf65b('0x27'),_0x41c599['name']);}if(!_['isUndefined'](_0x41c599[_0xf65b('0x8a')])){clearInterval(_0x41c599[_0xf65b('0x8a')]);_0x41c599[_0xf65b('0x8a')]=undefined;loggerPredictive['info'](_0xf65b('0x89'),_0xf65b('0x8a'),_0x41c599[_0xf65b('0x42')]);}}}function erlangb(_0x2ba5fc,_0x2b8806){if(_0x2b8806===0x0){return 0x0;}var _0x4b234c=0x1;for(var _0x335317=0x1;_0x335317<=_0x2b8806;_0x335317+=0x1){_0x4b234c=0x1+_0x4b234c*_0x335317/_0x2ba5fc;}return 0x1/_0x4b234c;}function isVoiceQueueOutbound(_0x33fe5b){return _0x33fe5b==='outbound';}function isNotPreview(_0x47c523){return _0x47c523!==_0xf65b('0x1c');}function isCampaignIvr(_0x27c8e5){return _0x27c8e5===_0xf65b('0x7d');}function getCallerId(_0x5cd0be,_0xd74a25,_0x4ce4e5){if(!_['isUndefined'](_0x4ce4e5)&&_0xf65b('0x8b')===typeof _0x4ce4e5&&!_['isEmpty'](_0x4ce4e5)){if(!_[_0xf65b('0x3f')](_0xd74a25)&&_0xf65b('0x8b')===typeof _0xd74a25&&!_[_0xf65b('0x7f')](_0xd74a25)){return util['format'](_0xf65b('0x8c'),_0xd74a25,_0x4ce4e5);}return util[_0xf65b('0x7a')]('\x22%s\x22\x20<%s>',_0x4ce4e5,_0x4ce4e5);}if(!_['isUndefined'](_0x5cd0be)&&_0xf65b('0x8b')===typeof _0x5cd0be&&!_[_0xf65b('0x7f')](_0x5cd0be)){return _0x5cd0be;}return _0xf65b('0x8d');}function loggerCatchQueueSummary(_0x2c65c0,_0x492070){return function(_0x3380d6){freeVariablesPredictive(_0x492070);emitVoiceQueueSummary(_0x492070);emitCampaignSummary(_0x492070);loggerSyncQueueSummary[_0xf65b('0x8e')](_0x2c65c0,util[_0xf65b('0x8f')](_0x3380d6,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3508cd,_0x4d7fb3){return function(_0x358cd5){loggerPredictive['error'](_0x3508cd,JSON[_0xf65b('0x4c')](_0x358cd5));freeVariablesPredictive(_0x4d7fb3);};}function loggerCatch(_0x480cf2){return function(_0x558ef3){logger[_0xf65b('0x8e')](_0x480cf2,util[_0xf65b('0x8f')](_0x558ef3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3de3e8){return _0x3de3e8&&!_[_0xf65b('0x3f')](_0x3de3e8)&&_0x3de3e8['length']>0x0;}function decremetOriginate(_0x2d8b43){if(!_[_0xf65b('0x3f')](_0x2d8b43)&&_0x2d8b43!==null){if(_0x2d8b43['hasOwnProperty'](_0xf65b('0x77'))){if(_0x2d8b43[_0xf65b('0x77')]>0x0){_0x2d8b43[_0xf65b('0x77')]-=0x1;}else{logger[_0xf65b('0x8e')](_0xf65b('0x90'));}}}else{logger[_0xf65b('0x8e')](_0xf65b('0x91'));}}function checkContactLowerLimitOriginate(_0x503edd,_0x3cca1d,_0x3b9b1b){if(_0x3cca1d>_0x3b9b1b){for(var _0x3084bd=0x0;_0x3084bd<_0x3cca1d-_0x3b9b1b;_0x3084bd+=0x1){decremetOriginate(_0x503edd);}}}function loggerGetContactDialer(_0x224e41,_0x4d087d,_0x5cfca6){return function(_0x56c03a){checkContactLowerLimitOriginate(_0x4d087d,_0x5cfca6,0x0);logger[_0xf65b('0x8e')](_0x224e41,util[_0xf65b('0x8f')](_0x56c03a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x472a3b){return function(_0x1d022e){if(isNotNull(_0x1d022e)&&isNotNull(_0x1d022e[0x0])){if(_0x1d022e[0x0][_0xf65b('0x92')]>0x0){_0x472a3b[_0xf65b('0x40')]=_0xf65b('0x93');logger['info'](_0xf65b('0x94')+_0x472a3b[_0xf65b('0x42')],_0x1d022e[0x0]['contactsRescheduled'],_0xf65b('0x95'));}else{_0x472a3b[_0xf65b('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xf65b('0x96')+_0x472a3b[_0xf65b('0x42')]);}}};}function notSendMessagesQueue(_0x5a5237){if(_0x5a5237['sendMessageOneNotActive']){freeVariablesPredictive(_0x5a5237);if(_0x5a5237[_0xf65b('0x77')]===0x0&&_0x5a5237['talking']===0x0&&_0x5a5237['waiting']===0x0&&(_0x5a5237[_0xf65b('0x54')]||0x0)===0x0){_0x5a5237[_0xf65b('0x97')]=![];_0x5a5237[_0xf65b('0x52')]=0x0;_0x5a5237[_0xf65b('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5a5237[_0xf65b('0x42')],_0xf65b('0x98'));}else{_0x5a5237['message']=_0xf65b('0x99');loggerSyncQueueSummary[_0xf65b('0x8e')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5a5237[_0xf65b('0x42')],'is\x20disactive');}emitVoiceQueueSummary(_0x5a5237);}}function notSendMessagesCampaign(_0x3f1d54){if(_0x3f1d54['sendMessageOneNotActive']){if(_0x3f1d54[_0xf65b('0x77')]===0x0){_0x3f1d54[_0xf65b('0x97')]=![];_0x3f1d54[_0xf65b('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xf65b('0x8e')](_0xf65b('0x9a'),_0x3f1d54[_0xf65b('0x42')],_0xf65b('0x98'));}else{_0x3f1d54[_0xf65b('0x40')]=_0xf65b('0x99');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3f1d54[_0xf65b('0x42')],_0xf65b('0x9b'));}emitCampaignSummary(_0x3f1d54);}}function createObjHistory(_0x340d2b,_0x3f117c,_0x2f3604,_0x31f3c6,_0x3c4561){_0x340d2b['message']=_0x2f3604;var _0x3caa26=new Action(_0x340d2b,_0x3f117c);var _0x424e68=new History(_0x3caa26);_0x424e68[_0xf65b('0x9c')]=_0x31f3c6;_0x424e68['statedesc']=_0x3c4561;_0x424e68[_0xf65b('0x9d')]=_0x3caa26[_0xf65b('0x9e')];return _0x424e68;}Dialer[_0xf65b('0x17')][_0xf65b('0x3e')]=function(){var _0x283862=this;setInterval(function(){_0x283862[_0xf65b('0x9f')](_0x283862[_0xf65b('0x25')],'[uniqueid]');_0x283862[_0xf65b('0x9f')](_0x283862[_0xf65b('0x23')],_0xf65b('0xa0'));},0x32c8);};Dialer['prototype'][_0xf65b('0x9f')]=function(_0x59b95e,_0x4b2777){var _0x557d76=this;for(var _0x49ea06 in _0x59b95e){if(_0x59b95e[_0xf65b('0xa1')](_0x49ea06)){this[_0xf65b('0x1b')][_0xf65b('0x18')](function(){if(!_['isNil'](_0x59b95e[_0x49ea06])){return ami[_0xf65b('0xa2')]({'action':_0xf65b('0xa3'),'channel':_0x59b95e[_0x49ea06][_0xf65b('0xa4')]})[_0xf65b('0xa5')](function(_0x547a66){if(_0x547a66[_0xf65b('0x40')]===_0xf65b('0xa6')){setTimeout(function(){if(_0x59b95e[_0x49ea06]&&_0x59b95e[_0x49ea06]['type']!==_0xf65b('0x7d')){_0x557d76[_0xf65b('0xa7')](_0x557d76[_0xf65b('0x1d')][_0x59b95e[_0x49ea06][_0xf65b('0xa8')]]);logger[_0xf65b('0x8e')](_0xf65b('0xa9'),_0x4b2777,_0x49ea06,_0x59b95e[_0x49ea06]['queue']);delete _0x59b95e[_0x49ea06];}if(_0x59b95e[_0x49ea06]&&_0x59b95e[_0x49ea06][_0xf65b('0x5a')]===_0xf65b('0x7d')){_0x557d76[_0xf65b('0xa7')](_0x557d76[_0xf65b('0x1e')][_0x59b95e[_0x49ea06][_0xf65b('0xa8')]]);logger[_0xf65b('0x8e')]('[Dialer][checkChannel][ivr]',_0x4b2777,_0x49ea06,_0x59b95e[_0x49ea06][_0xf65b('0xa8')]);delete _0x59b95e[_0x49ea06];}},0x2328);}});}});}}};Dialer[_0xf65b('0x17')]['countReScheduled']=function(_0x519a16){return BPromise[_0xf65b('0xaa')]()[_0xf65b('0xab')](cmHopper[_0xf65b('0xac')](_0x519a16))[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xad')));};Dialer[_0xf65b('0x17')]['checkIsBlackList']=function(_0x3d6592){return BPromise['resolve']()[_0xf65b('0xab')](cmHopperBlack['checkIsBlackList'](_0x3d6592))[_0xf65b('0xa5')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x15f301){return BPromise[_0xf65b('0xaa')]()['then'](cmHopperBlack[_0xf65b('0xae')](_0x15f301))[_0xf65b('0xa5')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0xf65b('0xaf')]=function(_0x14db95){return BPromise['resolve']()['then'](cmHopperHistory[_0xf65b('0xb0')](_0x14db95))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xf65b('0x17')][_0xf65b('0xb1')]=function(_0x483174){return BPromise[_0xf65b('0xaa')]()['then'](cmHopper[_0xf65b('0xb1')](_0x483174))[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xb2')));};Dialer[_0xf65b('0x17')][_0xf65b('0xb3')]=function(_0x44b5c5,_0x3419d8,_0xba6d68,_0x2e7633){return BPromise[_0xf65b('0xaa')]()[_0xf65b('0xab')](cmHopper[_0xf65b('0xb3')](_0x44b5c5,_0x3419d8,_0xba6d68,_0x2e7633))['catch'](loggerCatch(_0xf65b('0xb4')));};Dialer['prototype'][_0xf65b('0xb5')]=function(_0x5680f8,_0x389eb5,_0x5801f6){return BPromise[_0xf65b('0xaa')]()[_0xf65b('0xab')](cmHopper[_0xf65b('0xb5')](_0x5680f8,_0x389eb5,_0x5801f6))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x5649e6){return BPromise[_0xf65b('0xaa')]()[_0xf65b('0xab')](voiceQueueRt[_0xf65b('0xb6')](_0x5649e6))['catch'](loggerCatch(_0xf65b('0xb7')));};Dialer[_0xf65b('0x17')][_0xf65b('0xb8')]=function(_0x23cd68){return BPromise[_0xf65b('0xaa')]()[_0xf65b('0xab')](cmHopper[_0xf65b('0xb8')](_0x23cd68))[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xb9')));};Dialer['prototype'][_0xf65b('0xba')]=function(_0x2b4ac4){return BPromise['resolve']()[_0xf65b('0xab')](cmHopperHistory[_0xf65b('0xba')](_0x2b4ac4))[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xbb')));};Dialer[_0xf65b('0x17')][_0xf65b('0xa7')]=function(_0x3b8c53){if(!_['isUndefined'](_0x3b8c53)&&_0x3b8c53!==null){if(_0x3b8c53[_0xf65b('0xa1')](_0xf65b('0x77'))){if(_0x3b8c53[_0xf65b('0x77')]>0x0){_0x3b8c53['originated']-=0x1;}else{logger[_0xf65b('0x8e')](_0xf65b('0xbc'));}}}else{logger[_0xf65b('0x8e')](_0xf65b('0xbd'));}};Dialer['prototype'][_0xf65b('0xbe')]=function(_0x5e7e29,_0x46bd3f){var _0x4914e0=this;return function(_0x2d58a3){_0x4914e0[_0xf65b('0xa7')](_0x46bd3f);logger[_0xf65b('0x8e')](_0x5e7e29,util['inspect'](_0x2d58a3,{'showHidden':![],'depth':null}));};};Dialer[_0xf65b('0x17')][_0xf65b('0xbf')]=function(_0x503da3,_0x5dae39,_0x2d78a4){var _0x2ec672={'state':0x19,'statedesc':_0xf65b('0xc0')};this[_0xf65b('0xa7')](_0x5dae39);this[_0xf65b('0xc1')](_[_0xf65b('0x86')](_0x2ec672,_[_0xf65b('0xc2')](_0x2d78a4,[_0xf65b('0xc3'),_0xf65b('0xc4'),_0xf65b('0xc5'),'VoiceQueueId',_0xf65b('0xc6')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xf65b('0x8e')](_0x503da3);};Dialer['prototype'][_0xf65b('0xc7')]=function(_0x504ee5){return _0x504ee5===_0xf65b('0xc8');};Dialer['prototype']['isTrunkReachable']=function(_0x32f891){return!_[_0xf65b('0x3f')](_0x32f891)&&_0x32f891&&!_[_0xf65b('0x3f')](_0x32f891['name'])&&!_[_0xf65b('0x3f')](_0x32f891['active'])&&_0x32f891['active']&&(this[_0xf65b('0x20')][util[_0xf65b('0x7a')](_0xf65b('0xc9'),_0x32f891['name'])][_0xf65b('0xa3')]===_0xf65b('0xca')||this[_0xf65b('0x20')][util['format']('SIP/%s',_0x32f891[_0xf65b('0x42')])][_0xf65b('0xa3')]===_0xf65b('0xcb'));};Dialer[_0xf65b('0x17')]['saveInDb']=function(_0x3b06e4,_0x462474,_0x3c0ea2){this[_0xf65b('0xba')](_0x3b06e4)[_0xf65b('0xa5')](loggerCatch(_0x462474));this[_0xf65b('0xb8')](_0x3b06e4)[_0xf65b('0xa5')](loggerCatch(_0x3c0ea2));};Dialer[_0xf65b('0x17')][_0xf65b('0x38')]=function(_0x19f158){var _0x4f8e88=this[_0xf65b('0x25')][_0x19f158[_0xf65b('0xcc')]];var _0x29b460;if(!_[_0xf65b('0xcd')](_0x19f158)&&!_[_0xf65b('0xcd')](_0x19f158[_0xf65b('0xce')])&&!_[_0xf65b('0xcd')](_0x19f158[_0xf65b('0xce')][_0xf65b('0xcf')])&&_0x19f158[_0xf65b('0xd0')]==='xcally-motion-dialer'&&_0x4f8e88){if(_0x4f8e88['type']!==_0xf65b('0x7d')&&this[_0xf65b('0x1d')][_0x4f8e88[_0xf65b('0xa8')]][_0xf65b('0xd1')]&&_0x19f158['value']===_0xf65b('0xd2')){delete this[_0xf65b('0x25')][_0x19f158[_0xf65b('0xcc')]];this['updateOriginated'](this[_0xf65b('0x1d')][_0x4f8e88[_0xf65b('0xa8')]]);this[_0xf65b('0x1d')][_0x4f8e88[_0xf65b('0xa8')]][_0xf65b('0x63')]+=0x1;this['voiceQueues'][_0x4f8e88[_0xf65b('0xa8')]][_0xf65b('0xd3')]+=0x1;_0x29b460=new Hangup(_0x4f8e88,_0x19f158);_0x29b460['state']=0x12;_0x29b460[_0xf65b('0xd4')]=_0xf65b('0xd5');_0x29b460[_0xf65b('0xd6')]=_0xf65b('0xd7');this[_0xf65b('0xc1')](_0x29b460,_0xf65b('0xd8'),_0xf65b('0xd9'));}if(_0x4f8e88['type']!=='ivr'&&this[_0xf65b('0x1d')][_0x4f8e88['queue']][_0xf65b('0xd1')]&&_0x19f158[_0xf65b('0xda')]===_0xf65b('0xdb')){delete this['uniqueId'][_0x19f158[_0xf65b('0xcc')]];this[_0xf65b('0xa7')](this[_0xf65b('0x1d')][_0x4f8e88[_0xf65b('0xa8')]]);this[_0xf65b('0x1d')][_0x4f8e88[_0xf65b('0xa8')]]['outboundAnswerCallsDay']+=0x1;this[_0xf65b('0x1d')][_0x4f8e88[_0xf65b('0xa8')]][_0xf65b('0xd3')]+=0x1;_0x29b460=new Hangup(_0x4f8e88,_0x19f158);_0x29b460[_0xf65b('0x9c')]=0x13;_0x29b460[_0xf65b('0xd4')]='Machine';_0x29b460[_0xf65b('0xd6')]=_0xf65b('0xd7');_0x29b460[_0xf65b('0xdc')]=!![];this[_0xf65b('0xc1')](_0x29b460,_0xf65b('0xdd'),_0xf65b('0xde'));}if(_0x4f8e88[_0xf65b('0x5a')]==='ivr'&&this[_0xf65b('0x1e')][_0x4f8e88[_0xf65b('0xa8')]][_0xf65b('0xd1')]&&_0x19f158[_0xf65b('0xda')]==='HANGUP'){delete this[_0xf65b('0x25')][_0x19f158[_0xf65b('0xcc')]];this['updateOriginated'](this[_0xf65b('0x1e')][_0x4f8e88[_0xf65b('0xa8')]]);_0x29b460=new Hangup(_0x4f8e88,_0x19f158);_0x29b460[_0xf65b('0x9c')]=0x12;_0x29b460[_0xf65b('0xd4')]=_0xf65b('0xd5');_0x29b460[_0xf65b('0xd6')]='AMD';this[_0xf65b('0xc1')](_0x29b460,_0xf65b('0xdf'),'[syncHangupInAMDIvr]');}if(_0x4f8e88[_0xf65b('0x5a')]==='ivr'&&this[_0xf65b('0x1e')][_0x4f8e88[_0xf65b('0xa8')]]['dialAMDActive']&&_0x19f158[_0xf65b('0xda')]===_0xf65b('0xdb')){delete this[_0xf65b('0x25')][_0x19f158['uniqueid']];this[_0xf65b('0xa7')](this[_0xf65b('0x1e')][_0x4f8e88[_0xf65b('0xa8')]]);_0x29b460=new Hangup(_0x4f8e88,_0x19f158);_0x29b460[_0xf65b('0x9c')]=0x13;_0x29b460[_0xf65b('0xd4')]=_0xf65b('0xe0');_0x29b460[_0xf65b('0xd6')]=_0xf65b('0xd7');_0x29b460[_0xf65b('0xdc')]=!![];this[_0xf65b('0xc1')](_0x29b460,_0xf65b('0xe1'),'[syncMachineIvr]');}}};Dialer[_0xf65b('0x17')][_0xf65b('0x34')]=function(_0x41fa80){var _0x4f6fbb=this[_0xf65b('0x25')][_0x41fa80[_0xf65b('0xcc')]];var _0x2c0f79=this;var _0x356b88;if(_0x4f6fbb&&_0x4f6fbb[_0xf65b('0x5a')]==='ivr'){delete this[_0xf65b('0x25')][_0x41fa80[_0xf65b('0xcc')]];this[_0xf65b('0xa7')](this[_0xf65b('0x1e')][_0x4f6fbb[_0xf65b('0xa8')]]);this['campaigns'][_0x4f6fbb[_0xf65b('0xa8')]][_0xf65b('0xe2')]+=0x1;_0x356b88=new Hangup(_0x4f6fbb,_0x41fa80);this['createHistory'](_0x356b88)[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xe3')));this[_0xf65b('0xb8')](_0x356b88)[_0xf65b('0xa5')](loggerCatch('[syncHangupIvr]'));}if(_0x4f6fbb&&_0x4f6fbb[_0xf65b('0x5a')]!=='ivr'&&isNotNull(this[_0xf65b('0x1d')][_0x4f6fbb[_0xf65b('0xa8')]][_0xf65b('0xe4')])){delete this[_0xf65b('0x25')][_0x41fa80[_0xf65b('0xcc')]];this[_0xf65b('0xa7')](this[_0xf65b('0x1d')][_0x4f6fbb[_0xf65b('0xa8')]]);this[_0xf65b('0x1d')][_0x4f6fbb[_0xf65b('0xa8')]][_0xf65b('0x63')]+=0x1;this['voiceQueues'][_0x4f6fbb[_0xf65b('0xa8')]][_0xf65b('0xd3')]+=0x1;_0x356b88=new Hangup(_0x4f6fbb,_0x41fa80);_0x356b88['state']=0x10;_0x356b88[_0xf65b('0xd4')]=_0xf65b('0xe5');_0x356b88[_0xf65b('0xd6')]=_0xf65b('0xe6');this[_0xf65b('0xba')](_0x356b88)[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xe3')));this[_0xf65b('0xb8')](_0x356b88)[_0xf65b('0xa5')](loggerCatch('[syncHangupIvr]'));}if(_0x4f6fbb&&_0x4f6fbb[_0xf65b('0x5a')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x4f6fbb[_0xf65b('0xa8')]][_0xf65b('0xe4')])){delete this[_0xf65b('0x25')][_0x41fa80[_0xf65b('0xcc')]];this[_0xf65b('0xa7')](this['voiceQueues'][_0x4f6fbb[_0xf65b('0xa8')]]);this[_0xf65b('0x1d')][_0x4f6fbb['queue']][_0xf65b('0xe7')]+=0x1;_0x356b88=new Hangup(_0x4f6fbb,_0x41fa80);_0x356b88[_0xf65b('0x9c')]=0xc;_0x356b88[_0xf65b('0xd4')]=_0x41fa80['cause-txt'];_0x356b88[_0xf65b('0xd6')]=_0xf65b('0xe8');this['createHistory'](_0x356b88)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf65b('0xb8')](_0x356b88)['catch'](loggerCatch(_0xf65b('0xe9')));}};Dialer[_0xf65b('0x17')]['syncAgentComplete']=function(_0x46a9ea){var _0x165513=this[_0xf65b('0x25')][_0x46a9ea['uniqueid']];var _0x2b109c=this;if(this[_0xf65b('0x1d')][_0x46a9ea[_0xf65b('0xa8')]]){if(_0x165513&&_0x165513[_0xf65b('0x5a')]!==_0xf65b('0x7d')){delete this['uniqueId'][_0x46a9ea[_0xf65b('0xcc')]];this['voiceQueues'][_0x46a9ea[_0xf65b('0xa8')]]['outboundAnswerCallsDay']+=0x1;var _0x37d626=new AgentComplete(_0x165513,_0x46a9ea);if(_0x46a9ea[_0xf65b('0xea')]===_0xf65b('0xeb')){_0x37d626[_0xf65b('0xec')]=this[_0xf65b('0x1d')][_0x46a9ea['queue']]['dialQueueProject2']&&this[_0xf65b('0x1d')][_0x46a9ea[_0xf65b('0xa8')]]['dialAgiAfterHangupAgent']?moment()[_0xf65b('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x37d626)[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xed')));this[_0xf65b('0xb8')](_0x37d626)[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xee')));}}};Dialer[_0xf65b('0x17')][_0xf65b('0x2a')]=function(_0x16bf9a){if(this[_0xf65b('0x1d')][_0x16bf9a[_0xf65b('0xa8')]]){if(this['uniqueId'][_0x16bf9a[_0xf65b('0xcc')]]&&this[_0xf65b('0x25')][_0x16bf9a[_0xf65b('0xcc')]][_0xf65b('0x5a')]!==_0xf65b('0x7d')){this[_0xf65b('0xa7')](this['voiceQueues'][_0x16bf9a[_0xf65b('0xa8')]]);this['uniqueId'][_0x16bf9a[_0xf65b('0xcc')]][_0xf65b('0xef')]=moment()[_0xf65b('0x7a')](_0xf65b('0xf0'));}}};Dialer[_0xf65b('0x17')][_0xf65b('0xf1')]=function(_0x3ed857){this[_0xf65b('0xba')](_0x3ed857)['catch'](loggerCatch(_0xf65b('0xed')));this['moveContactManagedDialer'](_0x3ed857)[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xf2')));};Dialer[_0xf65b('0x17')][_0xf65b('0x2d')]=function(_0xaf8194){var _0x5dd4ed=this[_0xf65b('0x25')][_0xaf8194[_0xf65b('0xcc')]];var _0x539807=this;if(this[_0xf65b('0x1d')][_0xaf8194[_0xf65b('0xa8')]]){if(_0x5dd4ed&&_0x5dd4ed[_0xf65b('0x5a')]!==_0xf65b('0x7d')){delete this[_0xf65b('0x25')][_0xaf8194[_0xf65b('0xcc')]];this['updateOriginated'](this[_0xf65b('0x1d')][_0xaf8194['queue']]);_0x5dd4ed[_0xf65b('0xf3')]=moment()[_0xf65b('0x7a')](_0xf65b('0xf0'));var _0x540e11=new QueueCallerAbandon(_0x5dd4ed,_0xaf8194);if(getSeconds(_0x5dd4ed['droptime'],_0x5dd4ed[_0xf65b('0xf4')])>=_0x5dd4ed[_0xf65b('0xf5')]){this['voiceQueues'][_0xaf8194[_0xf65b('0xa8')]][_0xf65b('0x6f')]+=0x1;this['voiceQueues'][_0xaf8194[_0xf65b('0xa8')]][_0xf65b('0x67')]+=0x1;this[_0xf65b('0x1d')][_0xaf8194[_0xf65b('0xa8')]][_0xf65b('0x71')]+=0x1;_0x540e11[_0xf65b('0x9c')]=0xa;_0x540e11['statedesc']=_0xf65b('0xf6');_0x540e11[_0xf65b('0xf7')]=_0xf65b('0xf8');_0x540e11[_0xf65b('0xec')]=this[_0xf65b('0x1d')][_0xaf8194['queue']][_0xf65b('0xf9')]?moment()[_0xf65b('0x7a')](_0xf65b('0xf0')):undefined;this[_0xf65b('0xf1')](_0x540e11);}else{this[_0xf65b('0x1d')][_0xaf8194[_0xf65b('0xa8')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xf65b('0x1d')][_0xaf8194[_0xf65b('0xa8')]][_0xf65b('0x66')]+=0x1;_0x540e11['state']=0xb;_0x540e11['statedesc']=_0xf65b('0xfa');_0x540e11[_0xf65b('0xf7')]='CALLEREXIT';this['queueCallerAbandonCreateState'](_0x540e11);}}}};Dialer[_0xf65b('0x17')][_0xf65b('0x36')]=function(_0x1c4b78){if(this[_0xf65b('0x23')][_0x1c4b78['uniqueid']]){this[_0xf65b('0x23')][_0x1c4b78[_0xf65b('0xcc')]][_0xf65b('0xa4')]=_0x1c4b78[_0xf65b('0xa4')];}if(this[_0xf65b('0x25')][_0x1c4b78[_0xf65b('0xcc')]]){this[_0xf65b('0x25')][_0x1c4b78['uniqueid']][_0xf65b('0xa4')]=_0x1c4b78[_0xf65b('0xa4')];}};Dialer[_0xf65b('0x17')][_0xf65b('0x3a')]=function(_0x3479c7){if(strategy[this[_0xf65b('0x1d')][this[_0xf65b('0x23')][_0x3479c7[_0xf65b('0xfb')]][_0xf65b('0xa8')]][_0xf65b('0x50')]]===_0xf65b('0x16')){if(this[_0xf65b('0x23')][_0x3479c7[_0xf65b('0xfb')]]&&_[_0xf65b('0xcd')](this[_0xf65b('0x23')][_0x3479c7['actionid']][_0xf65b('0xfc')])&&_0x3479c7[_0xf65b('0xa3')]==='1'&&_0x3479c7['paused']==='0'){if(this[_0xf65b('0x1f')][_0x3479c7[_0xf65b('0xfd')]]){if(!this['agents'][_0x3479c7[_0xf65b('0xfd')]][_0xf65b('0xfc')]){this['agents'][_0x3479c7[_0xf65b('0xfd')]]['locked']=!![];this['actions'][_0x3479c7['actionid']]['locked']=!![];this['actions'][_0x3479c7[_0xf65b('0xfb')]][_0xf65b('0xfd')]=_0x3479c7[_0xf65b('0xfd')];}}}}else if((strategy[this[_0xf65b('0x1d')][this[_0xf65b('0x23')][_0x3479c7['actionid']][_0xf65b('0xa8')]][_0xf65b('0x50')]]||_0xf65b('0x15'))===_0xf65b('0x15')){if(this['actions'][_0x3479c7['actionid']]){if(this[_0xf65b('0x1f')][_0x3479c7[_0xf65b('0xfd')]]){this[_0xf65b('0x23')][_0x3479c7[_0xf65b('0xfb')]][_0xf65b('0xfd')]=_0x3479c7[_0xf65b('0xfd')];if(_[_0xf65b('0xcd')](this[_0xf65b('0x28')][this['actions'][_0x3479c7[_0xf65b('0xfb')]]['queue']])){this[_0xf65b('0x28')][this[_0xf65b('0x23')][_0x3479c7[_0xf65b('0xfb')]][_0xf65b('0xa8')]]=[];}this[_0xf65b('0x28')][this[_0xf65b('0x23')][_0x3479c7['actionid']][_0xf65b('0xa8')]][_0xf65b('0xfe')](_[_0xf65b('0x86')](_[_0xf65b('0xc2')](this[_0xf65b('0x23')][_0x3479c7[_0xf65b('0xfb')]],[_0xf65b('0xff'),_0xf65b('0xfd')]),{'status':_0x3479c7[_0xf65b('0xa3')],'paused':_0x3479c7[_0xf65b('0x100')]}));}}}};function unlockQueueStatus(_0x47dad3,_0x334215){setTimeout(function(){if(_[_0xf65b('0x3f')](_0x47dad3[_0xf65b('0x101')])){loggerBooked[_0xf65b('0x8e')](_0xf65b('0x102'),_0x334215);}_0x47dad3['queueStatusComplete']=!![];loggerBooked[_0xf65b('0x80')](_0xf65b('0x103'),_0x334215,JSON['stringify'](_['pick'](_0x47dad3,[_0xf65b('0x42'),_0xf65b('0x101')])));},0x1f3);}Dialer['prototype'][_0xf65b('0x3c')]=function(_0x1eaa25){var _0x227bce=this;var _0x287ab1=_0x227bce[_0xf65b('0x1d')][_0x227bce[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]];if(strategy[this[_0xf65b('0x1d')][this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]]['queue']][_0xf65b('0x50')]]==='roundrobin'){if(this[_0xf65b('0x23')][_0x1eaa25['actionid']]&&this['actions'][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xfd')]){this[_0xf65b('0x1c')]['run'](this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xff')],this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xfd')])[_0xf65b('0xa5')](function(_0x46d124){logger[_0xf65b('0x8e')](_0xf65b('0x104'),util['inspect'](_0x46d124,{'showHidden':![],'depth':null}));})[_0xf65b('0x1a')](function(){_0x227bce[_0xf65b('0xa7')](_0x227bce[_0xf65b('0x1d')][_0x227bce[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]]);_0x227bce[_0xf65b('0x1f')][_0x227bce[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xfd')]][_0xf65b('0xfc')]=![];delete _0x227bce[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]];unlockQueueStatus(_0x287ab1);});}else{this[_0xf65b('0xa7')](this[_0xf65b('0x1d')][this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]]);this[_0xf65b('0xb1')]({'active':![],'ContactId':this[_0xf65b('0x23')][_0x1eaa25['actionid']][_0xf65b('0xc3')],'ListId':this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]]['ListId'],'VoiceQueueId':this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0x105')]||undefined,'CampaignId':this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xc6')]||undefined})['catch'](loggerCatch(_0xf65b('0x106')));delete this['actions'][_0x1eaa25['actionid']];unlockQueueStatus(_0x287ab1);}}else if((strategy[this['voiceQueues'][this[_0xf65b('0x23')][_0x1eaa25['actionid']][_0xf65b('0xa8')]][_0xf65b('0x50')]]||_0xf65b('0x15'))==='rrmemory'){var _0x4d5dd7;if(this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]]&&!_[_0xf65b('0x7f')](this[_0xf65b('0x28')][this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]]['queue']])){if(this['queueBookedRR'][_0x227bce['actions'][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]]){this['queueBookedRR'][_0x227bce[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]]=this[_0xf65b('0x107')][this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]]['queue']]?this['queueBookedRR'][this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]]:this[_0xf65b('0x28')][this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]]?this[_0xf65b('0x28')][this[_0xf65b('0x23')][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]][_0xf65b('0x108')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]][_0xf65b('0x108')]=this['queueBookedRR'][this['actions'][_0x1eaa25[_0xf65b('0xfb')]][_0xf65b('0xa8')]];for(var _0x27b08d=0x0;_0x27b08d=0x0?!![]:![];})['catch'](myreject(_0x575905)));}}else{_0x20bd75[_0xf65b('0xfe')](ami['Action']({'action':_0xf65b('0x120'),'command':util[_0xf65b('0x7a')](_0xf65b('0x121'),_0x5c31d4,!_[_0xf65b('0x3f')](config[_0xf65b('0x11a')][_0x275d97])?_0x275d97:'')})[_0xf65b('0xab')](function(_0x4dd94c){return _0x4dd94c['content'][_0xf65b('0x122')](_0xf65b('0x11f'))>=0x0?!![]:![];})[_0xf65b('0xa5')](myreject(_0x575905)));}BPromise['all'](_0x20bd75)[_0xf65b('0xab')](function(_0x3bd6eb){var _0xc821b1=_['some'](_0x3bd6eb);if(_0xc821b1){return _0x474906(_0xc821b1);}else{_0x50fec0['message']=_0x110a66?_0xf65b('0x123'):'INTERVAL_IS_OVERTIME';return _0x575905(msgResponse('[ifTime][promiseAll]',_0xf65b('0x117'),'Global:\x20'+_0x110a66+'\x20'+_0x5a0dea+'\x20Interval\x20is\x20overtime:\x20'+util[_0xf65b('0x8f')](_0x5c31d4,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x275d97));}})['catch'](function(_0x592bbc){return _0x575905(msgResponse('ifTime',_0xf65b('0x117'),JSON[_0xf65b('0x4c')](_0x592bbc)));});});};Dialer[_0xf65b('0x17')][_0xf65b('0x124')]=function(_0x1c1a6b){var _0x2435fc=this;return function(){switch(_0x1c1a6b[_0xf65b('0x5f')]){case'progressive':freeVariablesPredictive(_0x1c1a6b);_0x2435fc[_0xf65b('0x125')](_0x1c1a6b,0x1);break;case _0xf65b('0x126'):freeVariablesPredictive(_0x1c1a6b);_0x2435fc['handlePower'](_0x1c1a6b,_0x1c1a6b[_0xf65b('0x127')]);break;case _0xf65b('0x128'):_0x2435fc[_0xf65b('0x128')](_0x1c1a6b);break;case _0xf65b('0x129'):freeVariablesPredictive(_0x1c1a6b);_0x2435fc['handlePower'](_0x1c1a6b,0x1);break;default:freeVariablesPredictive(_0x1c1a6b);logger['error']('Queue',_0x1c1a6b[_0xf65b('0x42')],_0xf65b('0x12a'));}};};Dialer[_0xf65b('0x17')]['launchHandleIvr']=function(_0xe2b22a){var _0x34bf42=this;return function(){_0x34bf42['handleIvr'](_0xe2b22a);};};Dialer[_0xf65b('0x17')][_0xf65b('0x6')]=function(_0x14be2d){var _0x1bff94=this;if(isNotPreview(_0x14be2d['dialMethod'])){if(isVoiceQueueOutbound(_0x14be2d[_0xf65b('0x5a')])&&isActive(_0x14be2d[_0xf65b('0x5e')])){_0x14be2d[_0xf65b('0x97')]=!![];BPromise[_0xf65b('0xaa')]()['then'](checkIsLoggedIn(_0x14be2d,_0x14be2d['loggedIn']))[_0xf65b('0xab')](checkIsActive(_0x14be2d,_0x14be2d[_0xf65b('0x5e')]))[_0xf65b('0xab')](checkInterval(_0x14be2d))[_0xf65b('0xab')](_0x1bff94[_0xf65b('0x110')](_0x14be2d))[_0xf65b('0xab')](_0x1bff94[_0xf65b('0x114')](_0x14be2d[_0xf65b('0x12b')],_0x14be2d[_0xf65b('0x12c')],_0x14be2d[_0xf65b('0x42')],_0x14be2d))[_0xf65b('0xab')](_0x1bff94[_0xf65b('0x115')](_0x14be2d[_0xf65b('0x48')],_0x14be2d[_0xf65b('0x12c')],_0x14be2d[_0xf65b('0x42')],_0x14be2d))[_0xf65b('0xab')](_0x1bff94[_0xf65b('0x124')](_0x14be2d))['catch'](loggerCatchQueueSummary(_0xf65b('0x12d'),_0x14be2d));}else{notSendMessagesQueue(_0x14be2d);}}else{freeVariablesPredictive(_0x14be2d);}};Dialer[_0xf65b('0x17')][_0xf65b('0x10f')]=function(){var _0x309241=this;var _0x28a297;for(var _0x5a2269 in this['campaigns']){if(this[_0xf65b('0x1e')][_0xf65b('0xa1')](_0x5a2269)){_0x28a297=this[_0xf65b('0x1e')][_0x5a2269];if(isCampaignIvr(_0x28a297[_0xf65b('0x5a')])&&isActive(_0x28a297['active'])){_0x28a297[_0xf65b('0x97')]=!![];BPromise[_0xf65b('0xaa')]()[_0xf65b('0xab')](checkIsActive(_0x28a297,_0x28a297['active']))[_0xf65b('0xab')](checkInterval(_0x28a297))[_0xf65b('0xab')](_0x309241[_0xf65b('0x110')](_0x28a297))[_0xf65b('0xab')](_0x309241[_0xf65b('0x114')](_0x28a297[_0xf65b('0x12b')],_0x28a297[_0xf65b('0x12c')],_0x28a297[_0xf65b('0x42')],_0x28a297))[_0xf65b('0xab')](_0x309241[_0xf65b('0x115')](_0x28a297[_0xf65b('0x48')],_0x28a297[_0xf65b('0x12c')],_0x28a297[_0xf65b('0x42')],_0x28a297))[_0xf65b('0xab')](_0x309241[_0xf65b('0x12e')](_0x28a297))[_0xf65b('0xa5')](loggerCatchQueueSummary(_0xf65b('0x12f'),_0x28a297));}else{notSendMessagesCampaign(_0x28a297);}}}};function getCallerIdRandom(_0xd8d449,_0x1680e9){var _0x5132e3,_0x7f07e8,_0x5a4a01;if(_0x1680e9<=0x0){_0x1680e9=0x1;}_0x5132e3=new RegExp(_0xf65b('0x130')+_0x1680e9+'}$');_0x7f07e8=Math[_0xf65b('0x131')](0xa,_0x1680e9-0x1);_0x5a4a01=Math[_0xf65b('0x131')](0xa,_0x1680e9)-0x1;return util[_0xf65b('0x7a')]('%s',_['replace'](_0xd8d449,_0x5132e3,_[_0xf65b('0x132')](_0x7f07e8,_0x5a4a01)));}function extractCalleridName(_0x2eb563){var _0x53dd20=_0x2eb563[_0xf65b('0x133')](/"(.*?)"/);return _0x53dd20?_0x53dd20[0x1]:_0x2eb563;}function extractCalleridNumber(_0x582ffd){var _0x23fddc=_0x582ffd['match'](/<(.*?)>/);return _0x23fddc?_0x23fddc[0x1]:_0x582ffd;}Dialer[_0xf65b('0x17')][_0xf65b('0x134')]=function(_0x20274e,_0x7f10af){var _0x520bc6=this;var _0x27c52f=uuid['v4']();this[_0xf65b('0x23')][_0x27c52f]=new Action(_0x20274e,_0x7f10af,_0x27c52f);return new BPromise(function(_0x42c2be,_0x5605ee){if(_[_0xf65b('0x3f')](_0x20274e)&&_0xf65b('0x135')!==typeof _0x20274e){return _0x5605ee(msgResponse('originate',_0xf65b('0x117'),_0xf65b('0x136')));}if(_[_0xf65b('0x3f')](_0x7f10af[_0xf65b('0x137')][_0xf65b('0x138')])||_0x7f10af[_0xf65b('0x137')][_0xf65b('0x138')]===null){return _0x5605ee(msgResponse(_0xf65b('0x139'),'Failure',_0xf65b('0x13a')));}var _0x212b47={'XMD-CALLERID':_0x520bc6[_0xf65b('0x23')][_0x27c52f][_0xf65b('0x13b')](),'XMD-AGI':_0x20274e[_0xf65b('0xe4')]?util[_0xf65b('0x7a')](_0xf65b('0x13c'),ipAgi,_0x20274e[_0xf65b('0xe4')]):_0xf65b('0x13d'),'XMD-AGIAFTER':_0x20274e[_0xf65b('0xf9')]?util['format'](_0xf65b('0x13c'),ipAgi,_0x20274e[_0xf65b('0xf9')]):_0xf65b('0x13d'),'XMD-QUEUE':_0x20274e[_0xf65b('0x5a')]===_0xf65b('0x4f')?util[_0xf65b('0x7a')]('\x22%s,%s%s,,,%s\x22',_0x20274e[_0xf65b('0x42')],_0x20274e[_0xf65b('0x13e')]||'',_0x20274e[_0xf65b('0x13f')]?'c':'',_0x20274e['dialQueueTimeout']||0x3):_0xf65b('0x13d'),'XMD-CONTACTID':_0x7f10af[_0xf65b('0xc3')],'XMD-CDRTYPE':_0xf65b('0x140'),'CALLERID(all)':_0x520bc6['actions'][_0x27c52f][_0xf65b('0x13b')](),'XMD-AMD':_0x20274e[_0xf65b('0xd1')]?'ACTIVE':_0xf65b('0x13d'),'XMD-DESTINATION':_0xf65b('0x141')};if(_0x20274e[_0xf65b('0xd1')]){_0x212b47[_0xf65b('0x142')]=_0x20274e['dialAMDInitialSilence']||0x9c4;_0x212b47[_0xf65b('0x143')]=_0x20274e[_0xf65b('0x144')]||0x5dc;_0x212b47[_0xf65b('0x145')]=_0x20274e['dialAMDAfterGreetingSilence']||0x320;_0x212b47[_0xf65b('0x146')]=_0x20274e[_0xf65b('0x147')]||0x1388;_0x212b47[_0xf65b('0x148')]=_0x20274e[_0xf65b('0x149')]||0x64;_0x212b47[_0xf65b('0x14a')]=_0x20274e[_0xf65b('0x14b')]||0x32;_0x212b47[_0xf65b('0x14c')]=_0x20274e[_0xf65b('0x14d')]||0x3;_0x212b47[_0xf65b('0x14e')]=_0x20274e['dialAMDSilenceThreshold']||0x100;_0x212b47[_0xf65b('0x14f')]=_0x20274e['dialAMDMaximumWordLength']||0x1388;}if(_0x20274e[_0xf65b('0x5a')]==='outbound'){_0x212b47[_0xf65b('0x150')]=_0x7f10af[_0xf65b('0x105')];}else{_0x212b47['XMD-CAMPAIGNID']=_0x7f10af[_0xf65b('0xc6')];}for(var _0x4e1532 in _0x7f10af[_0xf65b('0x137')]){if(_0x7f10af[_0xf65b('0x137')][_0xf65b('0xa1')](_0x4e1532)){if(isNotNull(_0x7f10af[_0xf65b('0x137')][_0x4e1532])&&_0x4e1532!=='id'&&_0x4e1532!==_0xf65b('0x151')&&_0x4e1532!==_0xf65b('0x152')&&_0x4e1532!==_0xf65b('0x153')){_0x212b47[util[_0xf65b('0x7a')](_0xf65b('0x154'),_0xf65b('0x155'),_[_0xf65b('0x156')](_0x4e1532))]=_0x7f10af['Contact'][_0x4e1532];}}}var _0x311db0=_0x520bc6[_0xf65b('0x111')](_0x20274e[_0xf65b('0x78')])?getCallerId(_0x20274e['Trunk'][_0xf65b('0x157')],_0x20274e['dialOriginateCallerIdName'],_0x20274e[_0xf65b('0x158')]>0x0?getCallerIdRandom(_0x20274e[_0xf65b('0x61')],_0x20274e[_0xf65b('0x158')]):_0x20274e[_0xf65b('0x61')]):getCallerId(_['isNil'](_0x20274e[_0xf65b('0x159')])?_0x20274e['Trunk']['callerid']:_0x20274e[_0xf65b('0x159')][_0xf65b('0x157')],_0x20274e['dialOriginateCallerIdName'],_0x20274e[_0xf65b('0x158')]>0x0?getCallerIdRandom(_0x20274e[_0xf65b('0x61')],_0x20274e[_0xf65b('0x158')]):_0x20274e[_0xf65b('0x61')]);if(_0x311db0){_0x212b47[_0xf65b('0x15a')]=_0x520bc6[_0xf65b('0x23')][_0x27c52f][_0xf65b('0x15b')]=extractCalleridName(_0x311db0);_0x212b47[_0xf65b('0x15c')]=_0x520bc6['actions'][_0x27c52f]['originatecalleridnum']=extractCalleridNumber(_0x311db0);}return ami[_0xf65b('0xa2')]({'actionid':_0x27c52f,'action':_0xf65b('0x139'),'channel':_0x520bc6[_0xf65b('0x111')](_0x20274e[_0xf65b('0x78')])?util[_0xf65b('0x7a')](_0xf65b('0x15d'),_0x20274e['Trunk'][_0xf65b('0x42')],isNotNull(_0x20274e[_0xf65b('0x15e')])?_0x20274e[_0xf65b('0x15e')][_0xf65b('0x15f')]()||'':'',_0x20274e[_0xf65b('0x160')]>0x0?_0x7f10af[_0xf65b('0x137')]['phone'][_0xf65b('0x161')](_0x20274e[_0xf65b('0x160')]):_0x7f10af[_0xf65b('0x137')][_0xf65b('0x138')]):util[_0xf65b('0x7a')](_0xf65b('0x15d'),_[_0xf65b('0xcd')](_0x20274e[_0xf65b('0x159')])?_0x20274e[_0xf65b('0x78')][_0xf65b('0x42')]:_0x20274e['TrunkBackup'][_0xf65b('0x42')],isNotNull(_0x20274e['dialPrefix'])?_0x20274e[_0xf65b('0x15e')][_0xf65b('0x15f')]()||'':'',_0x20274e[_0xf65b('0x160')]>0x0?_0x7f10af['Contact']['phone'][_0xf65b('0x161')](_0x20274e[_0xf65b('0x160')]):_0x7f10af[_0xf65b('0x137')]['phone']),'callerid':_0x311db0,'Exten':_0xf65b('0x141'),'Context':'from-sip','Priority':'1','variable':_0x212b47,'timeout':(_0x20274e[_0xf65b('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x27c52f})[_0xf65b('0xab')](function(_0x4ae66c){return _0x42c2be(_0x4ae66c);})[_0xf65b('0xa5')](function(_0x103342){_0x20274e[_0xf65b('0x6a')]+=0x1;var _0x6522c6=new History(_0x520bc6['actions'][_0x27c52f]);logger['error'](util[_0xf65b('0x7a')](_0xf65b('0x162'),JSON[_0xf65b('0x4c')](_0x103342)));_0x6522c6[_0xf65b('0x9c')]=0xe;_0x6522c6[_0xf65b('0xd4')]=_0xf65b('0x163');_0x6522c6['starttime']=moment()['format'](_0xf65b('0xf0'));_0x6522c6[_0xf65b('0x9d')]=_0x6522c6[_0xf65b('0x9e')];_0x520bc6[_0xf65b('0xba')](_0x6522c6)['catch'](loggerCatch(_0xf65b('0x164')));_0x520bc6[_0xf65b('0xb8')](_0x6522c6)[_0xf65b('0xa5')](loggerCatch(_0xf65b('0x164')))[_0xf65b('0x1a')](function(){delete _0x520bc6[_0xf65b('0x23')][_0x27c52f];return _0x5605ee(msgResponse('originate',_0xf65b('0x4b'),'originate\x20action\x20Error'));});});});};Dialer[_0xf65b('0x17')][_0xf65b('0x2f')]=function(_0x306fc1){var _0x54ac8d=this[_0xf65b('0x23')][_0x306fc1[_0xf65b('0xfb')]];var _0x37ee54=this;if(_0x54ac8d){delete this[_0xf65b('0x23')][_0x306fc1[_0xf65b('0xfb')]];_0x54ac8d[_0xf65b('0xf4')]=moment()['format'](_0xf65b('0xf0'));var _0x2a03c4=_0x54ac8d[_0xf65b('0x5a')]===_0xf65b('0x7d')?this[_0xf65b('0x1e')][_0x54ac8d[_0xf65b('0xa8')]]:this[_0xf65b('0x1d')][_0x54ac8d[_0xf65b('0x165')]()];if(!this[_0xf65b('0xc7')](_0x306fc1['response'])){this[_0xf65b('0xa7')](_0x2a03c4);return this[_0xf65b('0x166')](_0x54ac8d,_0x2a03c4,_0x306fc1)[_0xf65b('0xab')](function(_0x3f6b03){})['catch'](loggerCatch(_0xf65b('0x167')));}else{this[_0xf65b('0x25')][_0x306fc1[_0xf65b('0xcc')]]=_0x54ac8d;}}};Dialer['prototype'][_0xf65b('0x168')]=function(_0x4db1ef,_0x2555cc,_0x4ac67a){var _0x245740=new History(_0x2555cc);if(_0x245740[_0xf65b('0x169')]+_0x245740[_0xf65b('0x16a')]+_0x245740['countnoanswerretry']>=_0x4ac67a[_0xf65b('0x16b')]-0x1){return!![];}switch(_0x4db1ef){case 0x3:if(_0x245740[_0xf65b('0x16c')]>=_0x4ac67a[_0xf65b('0x16d')]-0x1){return!![];}else{this[_0xf65b('0xb1')]({'active':![],'countnoanswerretry':_0x245740[_0xf65b('0x16c')]+=0x1,'scheduledat':moment()['add'](_0x4ac67a[_0xf65b('0x16e')],_0xf65b('0x16f'))[_0xf65b('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x245740['ContactId'],'ListId':_0x245740[_0xf65b('0xc4')],'VoiceQueueId':_0x245740[_0xf65b('0x105')]||undefined,'CampaignId':_0x245740[_0xf65b('0xc6')]||undefined})[_0xf65b('0xa5')](loggerCatch(_0xf65b('0x170')));}break;case 0x5:if(_0x245740['countbusyretry']>=_0x4ac67a['dialBusyMaxRetry']-0x1){return!![];}else{this[_0xf65b('0xb1')]({'active':![],'countbusyretry':_0x245740[_0xf65b('0x169')]+=0x1,'scheduledat':moment()['add'](_0x4ac67a[_0xf65b('0x171')],'minutes')[_0xf65b('0x7a')](_0xf65b('0xf0')),'ContactId':_0x245740[_0xf65b('0xc3')],'ListId':_0x245740['ListId'],'VoiceQueueId':_0x245740['VoiceQueueId']||undefined,'CampaignId':_0x245740[_0xf65b('0xc6')]||undefined})['catch'](loggerCatch(_0xf65b('0x172')));}break;case 0x8:if(_0x245740['countcongestionretry']>=_0x4ac67a[_0xf65b('0x173')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x245740[_0xf65b('0x16a')]+=0x1,'scheduledat':moment()[_0xf65b('0x174')](_0x4ac67a['dialCongestionRetryFrequency'],_0xf65b('0x16f'))[_0xf65b('0x7a')](_0xf65b('0xf0')),'ContactId':_0x245740[_0xf65b('0xc3')],'ListId':_0x245740[_0xf65b('0xc4')],'VoiceQueueId':_0x245740[_0xf65b('0x105')]||undefined,'CampaignId':_0x245740['CampaignId']||undefined})[_0xf65b('0xa5')](loggerCatch(_0xf65b('0x175')));}break;default:return!![];}};Dialer[_0xf65b('0x17')]['callProgressDetecting']=function(_0x288b76,_0x4f0a8e,_0x1eb4dd){var _0x2e9d21=this;var _0x96a9c1=new History(_0x288b76);return new BPromise(function(_0x100b8a,_0x105907){if(_[_0xf65b('0x3f')](_0x4f0a8e)&&_0xf65b('0x135')!==typeof _0x4f0a8e){return _0x105907(msgResponse(_0xf65b('0x176'),'Failure',_0xf65b('0x177')));}if(_['isUndefined'](_0x1eb4dd)&&_0xf65b('0x135')!==typeof _0x1eb4dd){return _0x105907(msgResponse('[callProgressDetecting]',_0xf65b('0x117'),_0xf65b('0x178')));}switch(_0x1eb4dd[_0xf65b('0xea')]){case'0':_0x4f0a8e[_0xf65b('0x69')]+=0x1;_0x96a9c1[_0xf65b('0x9c')]=0x0;_0x96a9c1['statedesc']=_0xf65b('0x179');_0x2e9d21['createHistory'](_0x96a9c1)['catch'](loggerCatch(_0xf65b('0x17a')));if(_0x2e9d21['checkRetriveMax'](0x0,_0x288b76,_0x4f0a8e)){if(_0x96a9c1['countbusyretry']+_0x96a9c1['countcongestionretry']+_0x96a9c1[_0xf65b('0x16c')]>=_0x4f0a8e[_0xf65b('0x16b')]){_0x2e9d21[_0xf65b('0x17b')](_0x96a9c1,_0x100b8a,_0x105907,_0xf65b('0x17c'));}else{_0x2e9d21[_0xf65b('0x17d')](_0x96a9c1,_0x100b8a,_0x105907,_0xf65b('0x17c'));}}break;case'3':_0x4f0a8e[_0xf65b('0x68')]+=0x1;_0x96a9c1[_0xf65b('0x9c')]=0x3;_0x96a9c1[_0xf65b('0xd4')]=_0xf65b('0x17e');_0x96a9c1[_0xf65b('0x16c')]+=0x1;_0x96a9c1[_0xf65b('0x17f')]+=0x1;_0x2e9d21[_0xf65b('0xba')](_0x96a9c1)[_0xf65b('0xa5')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2e9d21[_0xf65b('0x168')](0x3,_0x288b76,_0x4f0a8e)){if(_0x96a9c1['countnoanswerretry']>=_0x4f0a8e[_0xf65b('0x16d')]){_0x2e9d21[_0xf65b('0x17d')](_0x96a9c1,_0x100b8a,_0x105907,_0xf65b('0x180'));}else{_0x2e9d21[_0xf65b('0x17b')](_0x96a9c1,_0x100b8a,_0x105907,_0xf65b('0x180'));}}break;case'5':_0x4f0a8e['outboundBusyCallsDay']+=0x1;_0x96a9c1['state']=0x5;_0x96a9c1[_0xf65b('0xd4')]='Busy';_0x96a9c1[_0xf65b('0x169')]+=0x1;_0x96a9c1['countglobal']+=0x1;_0x2e9d21[_0xf65b('0xba')](_0x96a9c1)[_0xf65b('0xa5')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2e9d21[_0xf65b('0x168')](0x5,_0x288b76,_0x4f0a8e)){if(_0x96a9c1['countbusyretry']>=_0x4f0a8e[_0xf65b('0x181')]){_0x2e9d21[_0xf65b('0x17d')](_0x96a9c1,_0x100b8a,_0x105907,_0xf65b('0x182'));}else{_0x2e9d21[_0xf65b('0x17b')](_0x96a9c1,_0x100b8a,_0x105907,_0xf65b('0x182'));}}break;case'8':_0x4f0a8e[_0xf65b('0x183')]+=0x1;_0x96a9c1[_0xf65b('0x9c')]=0x8;_0x96a9c1['statedesc']=_0xf65b('0x184');_0x96a9c1[_0xf65b('0x16a')]+=0x1;_0x96a9c1['countglobal']+=0x1;_0x2e9d21[_0xf65b('0xba')](_0x96a9c1)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2e9d21[_0xf65b('0x168')](0x8,_0x288b76,_0x4f0a8e)){if(_0x96a9c1[_0xf65b('0x16a')]>=_0x4f0a8e['dialCongestionMaxRetry']){_0x2e9d21[_0xf65b('0x17d')](_0x96a9c1,_0x100b8a,_0x105907,_0xf65b('0x185'));}else{_0x2e9d21[_0xf65b('0x17b')](_0x96a9c1,_0x100b8a,_0x105907,_0xf65b('0x185'));}}break;default:_0x4f0a8e[_0xf65b('0xe7')]+=0x1;_0x96a9c1[_0xf65b('0x9c')]=0xc;_0x96a9c1[_0xf65b('0xd4')]=_0x1eb4dd[_0xf65b('0xea')];_0x2e9d21[_0xf65b('0xba')](_0x96a9c1)['catch'](loggerCatch(_0xf65b('0x186')));if(_0x2e9d21[_0xf65b('0x168')](_0x1eb4dd[_0xf65b('0xea')],_0x288b76,_0x4f0a8e)){if(_0x96a9c1['countbusyretry']+_0x96a9c1[_0xf65b('0x16a')]+_0x96a9c1[_0xf65b('0x16c')]>=_0x4f0a8e[_0xf65b('0x16b')]){_0x2e9d21[_0xf65b('0x17b')](_0x96a9c1,_0x100b8a,_0x105907,_0x1eb4dd[_0xf65b('0xea')]);}else{_0x2e9d21[_0xf65b('0x17d')](_0x96a9c1,_0x100b8a,_0x105907,_0x1eb4dd[_0xf65b('0xea')]);}}}});};Dialer['prototype'][_0xf65b('0x17b')]=function(_0x1db163,_0x1dd2f6,_0x367e82,_0x160817){var _0x54345e=new Final(_0x1db163);_0x54345e['state']=0xf;_0x54345e['statedesc']=_0xf65b('0x187');this[_0xf65b('0x17d')](_0x54345e,_0x1dd2f6,_0x367e82,_0x160817);};Dialer[_0xf65b('0x17')][_0xf65b('0x17d')]=function(_0x1a8a82,_0x301f23,_0x292dea,_0x5111b3){this['moveContactManagedDialer'](_0x1a8a82)[_0xf65b('0xab')](function(_0x196c4b){return _0x301f23(msgResponse(_0xf65b('0x176'),_0xf65b('0xc8'),_0x5111b3));})['catch'](function(_0x10ac88){return _0x292dea(msgResponse(_0xf65b('0x188'),_0xf65b('0x117'),_0xf65b('0x189')));});};Dialer[_0xf65b('0x17')][_0xf65b('0x128')]=function(_0x1f9a50){var _0x363dc5=this;var _0x5978dc=_0x1f9a50[_0xf65b('0x18a')]/0x64;var _0x3f893e=_0x1f9a50[_0xf65b('0x67')]/(_0x1f9a50[_0xf65b('0x67')]+_0x1f9a50[_0xf65b('0x63')]);var _0x235254=_0x1f9a50[_0xf65b('0x53')]-_0x1f9a50[_0xf65b('0x75')]-_0x1f9a50[_0xf65b('0x5c')]-_0x1f9a50[_0xf65b('0x77')]-_0x1f9a50[_0xf65b('0x58')];var _0x133bab=(_0x1f9a50[_0xf65b('0x53')]-_0x1f9a50[_0xf65b('0x75')])*_0x1f9a50[_0xf65b('0x73')];var _0x2d8f53=Math[_0xf65b('0x18b')](_0x1f9a50['erlangCalls']*_0x1f9a50[_0xf65b('0x18c')]*_0x1f9a50['predictiveIntervalHitRate']*_0x1f9a50[_0xf65b('0x74')]);if(_[_0xf65b('0x3f')](_0x1f9a50[_0xf65b('0x88')])){loggerPredictive[_0xf65b('0x80')](_0xf65b('0x18d'));if(!_['isUndefined'](_0x1f9a50[_0xf65b('0x27')])){_0x1f9a50[_0xf65b('0x27')]=undefined;loggerPredictive[_0xf65b('0x8e')](_0xf65b('0x18e'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x1f9a50[_0xf65b('0x8a')])){loggerPredictive[_0xf65b('0x8e')](_0xf65b('0x18e'),_0xf65b('0x18f'));clearInterval(_0x1f9a50[_0xf65b('0x8a')]);_0x1f9a50[_0xf65b('0x8a')]=undefined;}_0x1f9a50[_0xf65b('0x88')]=moment()[_0xf65b('0x7a')](_0xf65b('0xf0'));loggerPredictive[_0xf65b('0x80')](_0xf65b('0x190'),_0x1f9a50[_0xf65b('0x88')],_0x1f9a50[_0xf65b('0x42')]);this['handlePower'](_0x1f9a50,0x1);}else if(ifInterval(_0x1f9a50[_0xf65b('0x191')],_0x1f9a50['startProgressive'])){this['handlePower'](_0x1f9a50,0x1);loggerPredictiveCalls[_0xf65b('0x80')](_0xf65b('0x192'),_0x1f9a50[_0xf65b('0x88')],_0x1f9a50[_0xf65b('0x42')]);_0x1f9a50['erlangCalls']=0x0;_0x1f9a50[_0xf65b('0x71')]=0x0;}else if(_0x5978dc<_0x3f893e&&_0x1f9a50[_0xf65b('0x193')]===_0xf65b('0x194')){freeVariablesPredictive(_0x1f9a50);loggerPredictive['info'](_0xf65b('0x195'),_0xf65b('0x196'),_0x3f893e,_0xf65b('0x88'),_0x1f9a50[_0xf65b('0x42')]);}else if(_0x235254>_0x133bab){freeVariablesPredictive(_0x1f9a50);loggerPredictive['info'](_0xf65b('0x197'),'Agent\x20free',_0x235254,_0xf65b('0x198'),_0x133bab);}else if(_0x2d8f53<_0x1f9a50['predictiveIntervalErlangCallsDroppedCalls']&&_0x1f9a50[_0xf65b('0x193')]===_0xf65b('0x194')){freeVariablesPredictive(_0x1f9a50);loggerPredictive[_0xf65b('0x80')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x2d8f53,'Drop\x20in\x20this\x20interval',_0x1f9a50[_0xf65b('0x71')],_0xf65b('0x88'),_0x1f9a50[_0xf65b('0x42')]);}else if(!ifInterval(_0x1f9a50['dialPredictiveInterval'],_0x1f9a50[_0xf65b('0x88')])&&_['isUndefined'](_0x1f9a50['startPredictive'])&&!_[_0xf65b('0x3f')](_0x1f9a50[_0xf65b('0x88')])){_0x1f9a50[_0xf65b('0x27')]=moment()['format'](_0xf65b('0xf0'));loggerPredictive[_0xf65b('0x80')](_0xf65b('0x199'),_0x1f9a50[_0xf65b('0x27')],_0x1f9a50[_0xf65b('0x42')]);this[_0xf65b('0xaf')](_0x1f9a50[_0xf65b('0x191')])['then'](this['getDataPredictive'](_0x1f9a50))['then'](mergeDataErlangB(_0x1f9a50))[_0xf65b('0xab')](this[_0xf65b('0x19a')](_0x1f9a50))[_0xf65b('0xa5')](loggerCatchPredictive(_0xf65b('0x19b'),_0x1f9a50));}else if(!ifInterval(_0x1f9a50['dialPredictiveInterval'],_0x1f9a50[_0xf65b('0x27')])){_0x1f9a50[_0xf65b('0x71')]=0x0;_0x1f9a50[_0xf65b('0x27')]=moment()[_0xf65b('0x7a')](_0xf65b('0xf0'));loggerPredictive[_0xf65b('0x80')](_0xf65b('0x19c'),_0x1f9a50[_0xf65b('0x27')],_0x1f9a50[_0xf65b('0x42')]);clearInterval(_0x1f9a50[_0xf65b('0x8a')]);_0x1f9a50[_0xf65b('0x8a')]=undefined;this['averageHandleTime'](_0x1f9a50[_0xf65b('0x191')])[_0xf65b('0xab')](this['getDataPredictive'](_0x1f9a50))['then'](mergeDataErlangB(_0x1f9a50))['then'](this[_0xf65b('0x19a')](_0x1f9a50))[_0xf65b('0xa5')](loggerCatchPredictive('[averageHandleTime][ErlangB]\x20',_0x1f9a50));}};Dialer[_0xf65b('0x17')][_0xf65b('0x19d')]=function(_0x28d125){var _0x5d2e43=this;return function(_0x2bd627){return new BPromise(function(_0x50dd5b,_0x19c36d){_[_0xf65b('0x86')](_0x28d125,_0x2bd627[0x0]);if(checkGetDataPredictive(_0x2bd627[0x0])){loggerPredictive[_0xf65b('0x80')](JSON[_0xf65b('0x4c')](_0x2bd627[0x0]));if(_0x28d125[_0xf65b('0x193')]===_0xf65b('0x194')){return _0x5d2e43[_0xf65b('0xb6')](_0x28d125['id'])[_0xf65b('0xab')](function(_0x3ffd55){var _0x3f85ef=_0x28d125[_0xf65b('0x53')]-_0x3ffd55[0x0][_0xf65b('0x19e')];var _0x563e60=_0x28d125[_0xf65b('0x191')]*0x3c;var _0x4d5093=_0x2bd627[0x0]['predictiveIntervalAvgTalktime']+_0x2bd627[0x0][_0xf65b('0x82')];var _0x2ae69a=(_0x2bd627[0x0][_0xf65b('0x19f')]+_0x2bd627[0x0][_0xf65b('0x6f')]+_0x2bd627[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2bd627[0x0][_0xf65b('0x76')];var _0x1a3172=_0x28d125[_0xf65b('0x18a')]/0x64;_0x28d125['predictiveIntervalPauses']=_0x3ffd55[0x0]['outboundQueuePauses']||0x0;_0x28d125[_0xf65b('0x72')]=_0x2ae69a>0x0?_0x2ae69a:0x1;return _0x5d2e43['abandonmentRate'](_0x3f85ef,_0x563e60,_0x4d5093,_0x2ae69a,_0x1a3172);})[_0xf65b('0xab')](function(_0x532fdd){return _0x50dd5b(_0x532fdd);})['catch'](function(_0x957635){return _0x19c36d(msgResponse(_0xf65b('0x1a0'),'Failure',JSON[_0xf65b('0x4c')](_0x957635)));});}if(_0x28d125[_0xf65b('0x193')]===_0xf65b('0x1a1')){return _0x5d2e43[_0xf65b('0xb6')](_0x28d125['id'])[_0xf65b('0xab')](function(_0x1ab42e){var _0x430857=_0x28d125[_0xf65b('0x53')]-_0x1ab42e[0x0][_0xf65b('0x19e')];var _0x9aa083=_0x28d125[_0xf65b('0x191')]*0x3c;var _0x1e5049=_0x2bd627[0x0]['predictiveIntervalAvgTalktime']+_0x2bd627[0x0][_0xf65b('0x82')];var _0x56db60=(_0x2bd627[0x0]['predictiveIntervalAnsweredCalls']+_0x2bd627[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2bd627[0x0][_0xf65b('0x6e')])/_0x2bd627[0x0][_0xf65b('0x76')];var _0xac6cc7=_0x28d125[_0xf65b('0x18a')]/0x64;_0x28d125[_0xf65b('0x75')]=_0x1ab42e[0x0][_0xf65b('0x19e')]||0x0;_0x28d125['predictiveIntervalHitRate']=_0x56db60>0x0?_0x56db60:0x1;return _0x5d2e43[_0xf65b('0x1a2')](_0x430857,_0x9aa083,_0x1e5049,_0x56db60,_0xac6cc7);})[_0xf65b('0xab')](function(_0x58437c){return _0x50dd5b(_0x58437c);})[_0xf65b('0xa5')](function(_0x3b930e){return _0x19c36d(msgResponse(_0xf65b('0x1a0'),_0xf65b('0x117'),JSON[_0xf65b('0x4c')](_0x3b930e)));});}}else{return _0x19c36d(msgResponse(_0xf65b('0x1a3'),'Failure',_0xf65b('0x1a4')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x320305){var _0x4ac12a=this;return function(){var _0x108f45=0x0;var _0x172736=Math[_0xf65b('0x18b')](_0x320305['erlangCallToSecond']*0x3e8);if(_0x172736>0x0){_0x172736=_0x172736<0x64?0x64:_0x172736;loggerPredictive[_0xf65b('0x80')]('[startMethodPredictive]',_0x172736);_0x320305['handlePredictive']=setInterval(function(){_0x4ac12a[_0xf65b('0x8a')](_0x320305);loggerPredictiveCalls['info'](_0xf65b('0x1a5'),_0x108f45+=0x1);},_0x172736);}else{loggerPredictive[_0xf65b('0x80')](_0xf65b('0x1a6'),_0xf65b('0x1a7'),_0x172736);}};};Dialer[_0xf65b('0x17')][_0xf65b('0x1a8')]=function(_0x2aa49c,_0x3fef86){var _0x332603=this;return function(_0x3c6760){if(_[_0xf65b('0x7f')](_0x3c6760)){if(_[_0xf65b('0xcd')](_0x3fef86['UserId'])||!_0x3fef86['recallme']){if(_0x2aa49c[_0xf65b('0x5f')]===_0xf65b('0x129')){_0x2aa49c[_0xf65b('0x101')]=_[_0xf65b('0x3f')](_0x2aa49c[_0xf65b('0x101')])?!![]:_0x2aa49c[_0xf65b('0x101')];var _0x52b08=uuid['v4']();_0x332603[_0xf65b('0x23')][_0x52b08]=new Action(_0x2aa49c,_0x3fef86,_0x52b08);loggerBooked[_0xf65b('0x80')]('[booked][checkContactBlack]',_0x52b08,'queueStatusComplete:\x20',JSON['stringify'](_0x2aa49c[_0xf65b('0x101')]),_0xf65b('0x1a9'),_0x2aa49c[_0xf65b('0x42')]);if(_0x2aa49c[_0xf65b('0x101')]){_0x2aa49c[_0xf65b('0x101')]=![];_0x332603[_0xf65b('0x28')][_0x332603[_0xf65b('0x23')][_0x52b08][_0xf65b('0xa8')]]=[];ami[_0xf65b('0xa2')]({'actionid':_0x52b08,'action':_0xf65b('0x1aa'),'queue':_0x2aa49c[_0xf65b('0x42')]})[_0xf65b('0xa5')](function(_0x51db29){_0x332603['updateOriginated'](_0x2aa49c);_0x332603[_0xf65b('0xb1')]({'active':![],'ContactId':_0x332603[_0xf65b('0x23')][_0x52b08][_0xf65b('0xc3')],'ListId':_0x332603[_0xf65b('0x23')][_0x52b08][_0xf65b('0xc4')],'VoiceQueueId':_0x332603[_0xf65b('0x23')][_0x52b08][_0xf65b('0x105')]||undefined,'CampaignId':_0x332603[_0xf65b('0x23')][_0x52b08]['CampaignId']||undefined})[_0xf65b('0xa5')](loggerCatch(_0xf65b('0x1ab')));delete _0x332603[_0xf65b('0x23')][_0x52b08];});}else{loggerBooked[_0xf65b('0x80')](_0xf65b('0x1ac'),JSON[_0xf65b('0x4c')](_0x2aa49c[_0xf65b('0x101')]),_0xf65b('0x1a9'),_0x2aa49c[_0xf65b('0x42')]);_0x332603[_0xf65b('0xa7')](_0x2aa49c);_0x332603['rescheduleContact']({'active':![],'ContactId':_0x332603[_0xf65b('0x23')][_0x52b08][_0xf65b('0xc3')],'ListId':_0x332603['actions'][_0x52b08][_0xf65b('0xc4')],'VoiceQueueId':_0x332603[_0xf65b('0x23')][_0x52b08][_0xf65b('0x105')]||undefined,'CampaignId':_0x332603[_0xf65b('0x23')][_0x52b08][_0xf65b('0xc6')]||undefined})[_0xf65b('0xa5')](loggerCatch(_0xf65b('0x1ab')));delete _0x332603[_0xf65b('0x23')][_0x52b08];}}else{return _0x332603[_0xf65b('0x134')](_0x2aa49c,_0x3fef86);}}else{if(getDiff(_0x3fef86[_0xf65b('0x1ad')])<_0x2aa49c[_0xf65b('0x1ae')]*0x3c){_0x332603['preview'][_0xf65b('0x10b')](_0x3fef86['id'])[_0xf65b('0x1a')](function(){_0x332603['updateOriginated'](_0x2aa49c);});}else{_0x2aa49c[_0xf65b('0x6b')]+=0x1;_0x332603[_0xf65b('0xa7')](_0x2aa49c);if(_0x2aa49c[_0xf65b('0x1af')]){_0x332603[_0xf65b('0xb1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3fef86['ContactId'],'ListId':_0x3fef86[_0xf65b('0xc4')],'VoiceQueueId':_0x3fef86[_0xf65b('0x105')]||undefined,'CampaignId':_0x3fef86[_0xf65b('0xc6')]||undefined})[_0xf65b('0xa5')](loggerCatch(_0xf65b('0x1b0')));_0x332603['createHistory'](createObjHistory(_0x2aa49c,_0x3fef86,_0xf65b('0x1b1'),0x17,_0xf65b('0x1b2')))[_0xf65b('0xa5')](loggerCatch(_0xf65b('0x1b3')));}else{_0x332603[_0xf65b('0xc1')](createObjHistory(_0x2aa49c,_0x3fef86,_0xf65b('0x1b4'),0x16,_0xf65b('0x1b5')),_0xf65b('0x1b6'),'[Originate][HistoryRecallClose]');}}}}else{_0x2aa49c[_0xf65b('0x64')]+=0x1;_0x332603['saveInDb'](createObjHistory(_0x2aa49c,_0x3fef86,_0xf65b('0x1b7'),0xd,_0xf65b('0x1b8')),_0xf65b('0x1b9'),_0xf65b('0x1ba'));throw _0xf65b('0x1bb');}};};Dialer[_0xf65b('0x17')][_0xf65b('0x1bc')]=function(_0x3f88df){var _0x24e318=this;var _0x1c47a0=[];var _0x1a65d1=_0x3f88df[_0xf65b('0x1bd')]-_0x3f88df['originated']-_0x3f88df[_0xf65b('0x1be')];emitCampaignSummary(_0x3f88df);if(_0x1a65d1>0x0){if(_0x1a65d1>this[_0xf65b('0x21')]){_0x1a65d1=this[_0xf65b('0x21')];}_0x3f88df[_0xf65b('0x1be')]+=_0x1a65d1;this[_0xf65b('0xb5')](_0x3f88df['id'],_0x1a65d1,_0x3f88df[_0xf65b('0x1bf')])[_0xf65b('0xab')](function(_0x1626a3){_0x3f88df['temp']-=_0x1a65d1;_0x3f88df[_0xf65b('0x1be')]=_0x3f88df[_0xf65b('0x1be')]>0x0?_0x3f88df[_0xf65b('0x1be')]:0x0;if(!checkContactEmpty(_0x1626a3)){_0x3f88df[_0xf65b('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xf65b('0x80')](_0xf65b('0x1c0')+_0x3f88df[_0xf65b('0x42')]);}else{_0x3f88df[_0xf65b('0x77')]+=_0x1626a3['length'];_0x3f88df[_0xf65b('0x40')]=_0xf65b('0x1c1');for(var _0x18db6d=0x0;_0x18db6d<_0x1626a3['length'];_0x18db6d+=0x1){_0x3f88df[_0xf65b('0x1c2')]+=0x1;if(_[_0xf65b('0xcd')](_0x1626a3[_0x18db6d])||_[_0xf65b('0xcd')](_0x1626a3[_0x18db6d][_0xf65b('0x137')])||_[_0xf65b('0xcd')](_0x1626a3[_0x18db6d][_0xf65b('0x137')][_0xf65b('0x138')])){_0x24e318[_0xf65b('0xbf')](_0xf65b('0x1c3'),_0x3f88df,_0x1626a3[_0x18db6d]);}else{_0x24e318['checkIsBlackListIvr'](_['pick'](_0x1626a3[_0x18db6d],[_0xf65b('0xc6'),_0xf65b('0x1c4')]))['then'](_0x24e318['checkContactBlack'](_0x3f88df,_0x1626a3[_0x18db6d]))['catch'](_0x24e318['loggerHandler']('[actionOriginateIvr]\x20',_0x3f88df));}}}})[_0xf65b('0xa5')](loggerGetContactDialer('[getContactCampaign2]',_0x3f88df,_0x1a65d1));}};Dialer[_0xf65b('0x17')][_0xf65b('0x125')]=function(_0x38f55c,_0xfdc921){var _0x22bdca=this;var _0x4999dc=[];var _0x4b46cf=_0xfdc921>=0x1?_0xfdc921:0x1;var _0x2733f6=[];if(_0x38f55c[_0xf65b('0x5f')]==='booked'){_0x4b46cf=0x1;}var _0x3e7b71=Math['floor'](_0x38f55c['available']*_0x4b46cf)-_0x38f55c[_0xf65b('0x77')]-_0x38f55c[_0xf65b('0x1be')];emitVoiceQueueSummary(_0x38f55c);if(_0x38f55c[_0xf65b('0x1c5')]>0x0){var _0x237fa7=_0x38f55c[_0xf65b('0x1c5')]-_0x38f55c[_0xf65b('0x77')]-_0x38f55c['talking']-_0x38f55c[_0xf65b('0x1be')]-_0x38f55c[_0xf65b('0x54')];if(_0x3e7b71>_0x237fa7){_0x3e7b71=_0x237fa7;}}if(_0x3e7b71>0x0){if(_0x38f55c[_0xf65b('0x5f')]==='booked'){_0x3e7b71=0x1;}if(_0x3e7b71>this['maxNumberOriginate']){_0x3e7b71=this[_0xf65b('0x21')];}_0x38f55c[_0xf65b('0x1be')]+=_0x3e7b71;for(var _0x1d755a in this[_0xf65b('0x1f')]){if(this[_0xf65b('0x1f')][_0xf65b('0xa1')](_0x1d755a)){if(this[_0xf65b('0x1f')][_0x1d755a][_0xf65b('0x9c')]===_0xf65b('0x1c6')&&this['agents'][_0x1d755a][_0xf65b('0xa3')]===_0xf65b('0xca')){_0x4999dc[_0xf65b('0xfe')](this[_0xf65b('0x1f')][_0x1d755a]['id']);}}}this[_0xf65b('0xb3')](_0x38f55c['id'],_0x4999dc,_0x3e7b71,_0x38f55c['dialOrderByScheduledAt'])['then'](function(_0x2c40ce){_0x38f55c['temp']-=_0x3e7b71;_0x38f55c[_0xf65b('0x1be')]=_0x38f55c[_0xf65b('0x1be')]>0x0?_0x38f55c['temp']:0x0;if(!checkContactEmpty(_0x2c40ce)){_0x22bdca[_0xf65b('0xac')](_0x38f55c)[_0xf65b('0xab')](sendMessageReschedule(_0x38f55c))[_0xf65b('0xa5')](loggerCatch(_0xf65b('0xad')));}else{_0x38f55c[_0xf65b('0x77')]+=_0x2c40ce[_0xf65b('0x1c7')];_0x38f55c[_0xf65b('0x40')]=_0x38f55c['dialMethod']===_0xf65b('0x129')?_0xf65b('0x1c8'):_0xf65b('0x1c1');for(var _0x1a2f50=0x0;_0x1a2f50<_0x2c40ce[_0xf65b('0x1c7')];_0x1a2f50+=0x1){if(_[_0xf65b('0xcd')](_0x2c40ce[_0x1a2f50])||_['isNil'](_0x2c40ce[_0x1a2f50]['Contact'])||_['isNil'](_0x2c40ce[_0x1a2f50]['Contact'][_0xf65b('0x138')])){_0x22bdca[_0xf65b('0xbf')](_0xf65b('0x1c3'),_0x38f55c,_0x2c40ce[_0x1a2f50]);}else{_0x22bdca['checkIsBlackList'](_[_0xf65b('0xc2')](_0x2c40ce[_0x1a2f50],[_0xf65b('0x105'),_0xf65b('0x1c4')]))[_0xf65b('0xab')](_0x22bdca[_0xf65b('0x1a8')](_0x38f55c,_0x2c40ce[_0x1a2f50]))[_0xf65b('0xa5')](_0x22bdca[_0xf65b('0xbe')]('[actionOriginate]\x20',_0x38f55c));}}}})[_0xf65b('0xa5')](loggerGetContactDialer('[getContactDialer2]',_0x38f55c,_0x3e7b71));}};Dialer['prototype']['handlePredictive']=function(_0x4d5b3b){var _0x5111d1=this;if(_0x4d5b3b[_0xf65b('0x1c5')]>0x0){var _0x3ca634=_0x4d5b3b['dialLimitQueue']-_0x4d5b3b['originated']-_0x4d5b3b['talking'];if(_0x3ca634>0x0){this[_0xf65b('0x1c9')](_0x4d5b3b);}else{loggerPredictiveCalls[_0xf65b('0x80')](_0xf65b('0x1ca'));}}else{this[_0xf65b('0x1c9')](_0x4d5b3b);}};Dialer[_0xf65b('0x17')][_0xf65b('0x1c9')]=function(_0x331936){var _0x10dbba=this;var _0x51f51a=[];_0x331936[_0xf65b('0x77')]+=0x1;for(var _0xd63c36 in this[_0xf65b('0x1f')]){if(this[_0xf65b('0x1f')][_0xf65b('0xa1')](_0xd63c36)){if(this[_0xf65b('0x1f')][_0xd63c36][_0xf65b('0x9c')]===_0xf65b('0x1c6')&&this[_0xf65b('0x1f')][_0xd63c36][_0xf65b('0xa3')]===_0xf65b('0xca')){_0x51f51a[_0xf65b('0xfe')](this[_0xf65b('0x1f')][_0xd63c36]['id']);}}}this[_0xf65b('0xb3')](_0x331936['id'],_0x51f51a,0x1,_0x331936['dialOrderByScheduledAt'])[_0xf65b('0xab')](function(_0x5336ac){if(!checkContactEmpty(_0x5336ac)){checkContactLowerLimitOriginate(_0x331936,0x1,0x0);_0x10dbba['countReScheduled'](_0x331936)[_0xf65b('0xab')](sendMessageReschedule(_0x331936))['catch'](loggerCatch(_0xf65b('0xad')));}else{_0x331936['message']=_0xf65b('0x1c1');if(_[_0xf65b('0xcd')](_0x5336ac[0x0])||_[_0xf65b('0xcd')](_0x5336ac[0x0][_0xf65b('0x137')])||_['isNil'](_0x5336ac[0x0]['Contact'][_0xf65b('0x138')])){_0x10dbba[_0xf65b('0xbf')](_0xf65b('0x1c3'),_0x331936,_0x5336ac[0x0]);}else{_0x10dbba[_0xf65b('0x1cb')](_[_0xf65b('0xc2')](_0x5336ac[0x0],['VoiceQueueId',_0xf65b('0x1c4')]))[_0xf65b('0xab')](_0x10dbba[_0xf65b('0x1a8')](_0x331936,_0x5336ac[0x0]))[_0xf65b('0xa5')](_0x10dbba[_0xf65b('0xbe')](_0xf65b('0x1cc'),_0x331936));}}})[_0xf65b('0xa5')](loggerGetContactDialer(_0xf65b('0x1cd'),_0x331936,0x1));emitVoiceQueueSummary(_0x331936);};Dialer[_0xf65b('0x17')]['abandonmentRate']=function(_0x20bce3,_0x319b35,_0x3f6999,_0xcf7c1b,_0x354576,_0x48e9ec){loggerPredictive['info'](_0xf65b('0x1ce'),'\x20m\x20=\x20',_0x20bce3,'\x20interval\x20=\x20',_0x319b35,_0xf65b('0x1cf'),_0x3f6999,'\x20p\x20=\x20',_0xcf7c1b,'\x20Amax\x20=\x20',_0x354576);return new BPromise(function(_0x89c6ee,_0xabb522){if(_0x20bce3<=0x0||isNaN(_0x20bce3)){return _0xabb522(msgResponse(_0xf65b('0x1ce'),_0xf65b('0x4b'),_0xf65b('0x1d0')+_0x20bce3));}if(_0x3f6999<=0x0||isNaN(_0x3f6999)){return _0xabb522(msgResponse(_0xf65b('0x1ce'),_0xf65b('0x4b'),'Ts\x20=\x20'+_0x3f6999));}if(_0xcf7c1b<=0x0||isNaN(_0xcf7c1b)){return _0xabb522(msgResponse(_0xf65b('0x1ce'),_0xf65b('0x4b'),_0xf65b('0x1d1')+_0xcf7c1b));}if(_0x319b35<=0x0||isNaN(_0x319b35)){return _0xabb522(msgResponse(_0xf65b('0x1ce'),_0xf65b('0x4b'),_0xf65b('0x1d2')+_0x319b35));}if(_0x354576<=0x0||isNaN(_0x354576)){return _0xabb522(msgResponse(_0xf65b('0x1ce'),_0xf65b('0x4b'),_0xf65b('0x1d3')+_0x354576));}_0x48e9ec=_0x48e9ec||0x0;var _0x46ee24=0x1/_0x3f6999;var _0x51c0ae=0x0;var _0x117e55=0x0;var _0x537cc9=0x0;var _0x551f8f=0x0;for(var _0x1fe633=0x0;_0x537cc9<_0x354576;_0x1fe633+=0x1){_0x117e55=_0x1fe633/_0x319b35;_0x51c0ae=(_0xcf7c1b*_0x117e55+_0x48e9ec)/_0x46ee24;_0x537cc9=erlangb(_0x51c0ae,_0x20bce3);_0x551f8f=_0x51c0ae/_0x20bce3*(0x1-erlangb(_0x51c0ae,_0x20bce3));}return _0x89c6ee({'erlangCalls':_0x1fe633,'erlangCallToSecond':_0x319b35/_0x1fe633,'erlangAbandonmentRate':_0x537cc9,'erlangBusyFactor':_0x551f8f});});};Dialer['prototype'][_0xf65b('0x1a2')]=function(_0x50e265,_0x44d715,_0x3d27aa,_0x5c3592,_0x15500b,_0x33b2a6){loggerPredictive[_0xf65b('0x80')](_0xf65b('0x1d4'),_0xf65b('0x1d5'),_0x50e265,_0xf65b('0x1d6'),_0x44d715,_0xf65b('0x1cf'),_0x3d27aa,_0xf65b('0x1d7'),_0x5c3592,_0xf65b('0x1d8'),_0x15500b);return new BPromise(function(_0x2d8989,_0x4a80c7){if(_0x50e265<=0x0||isNaN(_0x50e265)){return _0x4a80c7(msgResponse(_0xf65b('0x1ce'),_0xf65b('0x4b'),'m\x20=\x20'+_0x50e265));}if(_0x3d27aa<=0x0||isNaN(_0x3d27aa)){return _0x4a80c7(msgResponse(_0xf65b('0x1ce'),_0xf65b('0x4b'),_0xf65b('0x1d9')+_0x3d27aa));}if(_0x5c3592<=0x0||isNaN(_0x5c3592)){return _0x4a80c7(msgResponse(_0xf65b('0x1ce'),_0xf65b('0x4b'),_0xf65b('0x1d1')+_0x5c3592));}if(_0x44d715<=0x0||isNaN(_0x44d715)){return _0x4a80c7(msgResponse(_0xf65b('0x1ce'),'Error','interval\x20=\x20'+_0x44d715));}if(_0x15500b<=0x0||isNaN(_0x15500b)){return _0x4a80c7(msgResponse('[abandonmentRate]',_0xf65b('0x4b'),_0xf65b('0x1d3')+_0x15500b));}_0x33b2a6=_0x33b2a6||0x0;var _0x67f760=0x1/_0x3d27aa;var _0x372f53=0x0;var _0x221824=0x0;var _0x4fa281=0x0;var _0x31dda3=0x0;for(var _0xc50655=0x0;_0x31dda3<_0x15500b;_0xc50655+=0x1){_0x221824=_0xc50655/_0x44d715;_0x372f53=(_0x5c3592*_0x221824+_0x33b2a6)/_0x67f760;_0x4fa281=erlangb(_0x372f53,_0x50e265);_0x31dda3=_0x372f53/_0x50e265*(0x1-erlangb(_0x372f53,_0x50e265));}return _0x2d8989({'erlangCalls':_0xc50655,'erlangCallToSecond':_0x44d715/_0xc50655,'erlangAbandonmentRate':_0x4fa281,'erlangBusyFactor':_0x31dda3});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index a812d8a..8165a7d 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 _0x6014=['seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','diff'];(function(_0x50043f,_0x14ef11){var _0x6ab814=function(_0x273066){while(--_0x273066){_0x50043f['push'](_0x50043f['shift']());}};_0x6ab814(++_0x14ef11);}(_0x6014,0x8f));var _0x4601=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x6014[_0x24b477];return _0x4041a6;};'use strict';var util=require(_0x4601('0x0'));var _=require(_0x4601('0x1'));var moment=require(_0x4601('0x2'));function getSeconds(_0x5bb395,_0x771d25){var _0x293740=moment(_0x5bb395)[_0x4601('0x3')](0x0);var _0x4fe83f=moment(_0x771d25)['milliseconds'](0x0);return _0x293740[_0x4601('0x4')](_0x4fe83f,_0x4601('0x5'));}function QueueCallerAbandon(_0x4c7a24,_0x2f78f1){this['scheduledat']=_0x4c7a24[_0x4601('0x6')];this['type']=_0x4c7a24[_0x4601('0x7')];this[_0x4601('0x8')]=_0x4c7a24[_0x4601('0x7')]===_0x4601('0x9')?_0x4601('0xa'):_0x4c7a24[_0x4601('0x7')];this[_0x4601('0xb')]=_0x4c7a24[_0x4601('0xb')];this['countcongestionretry']=_0x4c7a24['countcongestionretry'];this[_0x4601('0xc')]=_0x4c7a24[_0x4601('0xc')];this[_0x4601('0xd')]=_0x4c7a24[_0x4601('0xb')]+_0x4c7a24[_0x4601('0xe')]+_0x4c7a24['countnoanswerretry'];this[_0x4601('0xf')]=_0x2f78f1['uniqueid'];this[_0x4601('0x10')]=_0x4c7a24[_0x4601('0x11')];this[_0x4601('0x12')]=_0x4c7a24[_0x4601('0x13')];this[_0x4601('0x14')]=_0x4c7a24['starttime'];this[_0x4601('0x15')]=_0x4c7a24['responsetime'];this['droptime']=_0x4c7a24[_0x4601('0x16')];this[_0x4601('0x17')]=this['droptime'];this['ringtime']=getSeconds(_0x4c7a24[_0x4601('0x15')],_0x4c7a24[_0x4601('0x14')]);this['holdtime']=getSeconds(this['droptime'],_0x4c7a24['responsetime']);this[_0x4601('0x18')]=0x0;this['queue']=_0x2f78f1['queue'];this[_0x4601('0x19')]=_0x2f78f1['connectedlinename'];this[_0x4601('0x1a')]=_0x2f78f1[_0x4601('0x1a')];this[_0x4601('0x1b')]=_0x4c7a24['callback'];this[_0x4601('0x1c')]=_0x4c7a24[_0x4601('0x1c')];this['callbackat']=_0x4c7a24[_0x4601('0x1d')];this[_0x4601('0x1e')]=_0x4c7a24['recallme'];this['ContactId']=_0x4c7a24[_0x4601('0x1f')];this[_0x4601('0x20')]=_0x4c7a24[_0x4601('0x20')];this['UserId']=_0x4c7a24[_0x4601('0x21')];this['VoiceQueueId']=_0x4c7a24[_0x4601('0x22')];this[_0x4601('0x23')]=_0x4c7a24[_0x4601('0x23')];this['originatecalleridnum']=_0x4c7a24['originatecalleridnum']||'';this[_0x4601('0x24')]=_0x4c7a24[_0x4601('0x24')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x19ae=['util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','number','starttime','responsetime','droptime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0xe4f896,_0x4da53e){var _0x1c8d4a=function(_0x5724db){while(--_0x5724db){_0xe4f896['push'](_0xe4f896['shift']());}};_0x1c8d4a(++_0x4da53e);}(_0x19ae,0x156));var _0xe19a=function(_0xf9f239,_0x30c0df){_0xf9f239=_0xf9f239-0x0;var _0x536d3d=_0x19ae[_0xf9f239];return _0x536d3d;};'use strict';var util=require(_0xe19a('0x0'));var _=require(_0xe19a('0x1'));var moment=require(_0xe19a('0x2'));function getSeconds(_0xca8155,_0x4a965a){var _0x989c91=moment(_0xca8155)[_0xe19a('0x3')](0x0);var _0x5a8098=moment(_0x4a965a)[_0xe19a('0x3')](0x0);return _0x989c91[_0xe19a('0x4')](_0x5a8098,_0xe19a('0x5'));}function QueueCallerAbandon(_0x46a44c,_0x1107dd){this[_0xe19a('0x6')]=_0x46a44c[_0xe19a('0x6')];this[_0xe19a('0x7')]=_0x46a44c[_0xe19a('0x7')];this[_0xe19a('0x8')]=_0x46a44c[_0xe19a('0x7')]===_0xe19a('0x9')?_0xe19a('0xa'):_0x46a44c[_0xe19a('0x7')];this[_0xe19a('0xb')]=_0x46a44c['countbusyretry'];this[_0xe19a('0xc')]=_0x46a44c[_0xe19a('0xc')];this[_0xe19a('0xd')]=_0x46a44c[_0xe19a('0xd')];this[_0xe19a('0xe')]=_0x46a44c[_0xe19a('0xb')]+_0x46a44c[_0xe19a('0xc')]+_0x46a44c[_0xe19a('0xd')];this[_0xe19a('0xf')]=_0x1107dd[_0xe19a('0xf')];this[_0xe19a('0x10')]=_0x46a44c[_0xe19a('0x11')];this['calleridnum']=_0x46a44c[_0xe19a('0x12')];this[_0xe19a('0x13')]=_0x46a44c[_0xe19a('0x13')];this[_0xe19a('0x14')]=_0x46a44c[_0xe19a('0x14')];this[_0xe19a('0x15')]=_0x46a44c[_0xe19a('0x15')];this['endtime']=this[_0xe19a('0x15')];this['ringtime']=getSeconds(_0x46a44c[_0xe19a('0x14')],_0x46a44c['starttime']);this[_0xe19a('0x16')]=getSeconds(this[_0xe19a('0x15')],_0x46a44c[_0xe19a('0x14')]);this[_0xe19a('0x17')]=0x0;this[_0xe19a('0xa')]=_0x1107dd[_0xe19a('0xa')];this['membername']=_0x1107dd[_0xe19a('0x18')];this[_0xe19a('0x19')]=_0x1107dd[_0xe19a('0x19')];this[_0xe19a('0x1a')]=_0x46a44c['callback'];this[_0xe19a('0x1b')]=_0x46a44c['callbackuniqueid'];this[_0xe19a('0x1c')]=_0x46a44c[_0xe19a('0x1c')];this[_0xe19a('0x1d')]=_0x46a44c['recallme'];this[_0xe19a('0x1e')]=_0x46a44c[_0xe19a('0x1e')];this[_0xe19a('0x1f')]=_0x46a44c['ListId'];this[_0xe19a('0x20')]=_0x46a44c['UserId'];this[_0xe19a('0x21')]=_0x46a44c[_0xe19a('0x21')];this[_0xe19a('0x22')]=_0x46a44c[_0xe19a('0x22')];this['originatecalleridnum']=_0x46a44c[_0xe19a('0x23')]||'';this[_0xe19a('0x24')]=_0x46a44c[_0xe19a('0x24')]||'';}module[_0xe19a('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 4a1f39a..1690691 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 _0x23a8=['format','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports','lodash','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x23a8,0x172));var _0x823a=function(_0x5cb615,_0x533f8a){_0x5cb615=_0x5cb615-0x0;var _0x4b9572=_0x23a8[_0x5cb615];return _0x4b9572;};'use strict';var util=require('util');var _=require(_0x823a('0x0'));var moment=require('moment');function Action(_0x333a68,_0x52f424,_0x39a117){this[_0x823a('0x1')]=_0x333a68||undefined;this['channel']=util[_0x823a('0x2')]('%s/%s/%s',_0x52f424[_0x823a('0x3')],_0x52f424[_0x823a('0x4')][_0x823a('0x5')],_0x39a117[_0x823a('0x6')]);this['localstationid']=_0x52f424[_0x823a('0x7')];this[_0x823a('0x8')]=_0x52f424['headerinfo'];this[_0x823a('0x9')]=_0x39a117[_0x823a('0x9')];this['AttachmentId']=_0x39a117[_0x823a('0xa')];}module[_0x823a('0xb')]=Action; \ No newline at end of file +var _0xd802=['AttachmentId','exports','lodash','moment','uniqueid','channel','format','%s/%s/%s','name','fax','localstationid','headerinfo'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xd802,0x7a));var _0x2d80=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0xd802[_0x364cf8];return _0x6a59ee;};'use strict';var util=require('util');var _=require(_0x2d80('0x0'));var moment=require(_0x2d80('0x1'));function Action(_0x48309d,_0x3a698c,_0x5f0153){this[_0x2d80('0x2')]=_0x48309d||undefined;this[_0x2d80('0x3')]=util[_0x2d80('0x4')](_0x2d80('0x5'),_0x3a698c['tech'],_0x3a698c['Trunk'][_0x2d80('0x6')],_0x5f0153[_0x2d80('0x7')]);this[_0x2d80('0x8')]=_0x3a698c['localstationid'];this[_0x2d80('0x9')]=_0x3a698c[_0x2d80('0x9')];this['path']=_0x5f0153['path'];this['AttachmentId']=_0x5f0153[_0x2d80('0xa')];}module[_0x2d80('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 1762bb4..affe4a7 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 _0xe882=['execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','moment','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','\x20result\x20conversion\x20file\x20','message','create','.pdf','application/pdf','then','notify','parse','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path'];(function(_0xec2172,_0x3def75){var _0x203f38=function(_0x312aec){while(--_0x312aec){_0xec2172['push'](_0xec2172['shift']());}};_0x203f38(++_0x3def75);}(_0xe882,0xfb));var _0x2e88=function(_0x1996f7,_0x29d229){_0x1996f7=_0x1996f7-0x0;var _0x5afd0b=_0xe882[_0x1996f7];return _0x5afd0b;};'use strict';var util=require(_0x2e88('0x0'));var _=require(_0x2e88('0x1'));var BPromise=require(_0x2e88('0x2'));var uuid=require('uuid');var moment=require(_0x2e88('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x2e88('0x4'));var logger=require(_0x2e88('0x5'))(_0x2e88('0x6'));var ami=require(_0x2e88('0x7'));var rpcDb=require(_0x2e88('0x8'));var Channel=require(_0x2e88('0x9'));var ut=require('./util/util');var Action=require(_0x2e88('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x2e88('0xb'));var faxMessage=require(_0x2e88('0xc'));function Fax(_0x732642){this[_0x2e88('0xd')]={};this[_0x2e88('0xe')]=_0x732642['faxAccounts'];this[_0x2e88('0xf')]=_0x732642[_0x2e88('0xf')];this[_0x2e88('0x10')]={};ami['on'](_0x2e88('0x11'),this['syncNewchannel'][_0x2e88('0x12')](this));ami['on']('varset',this[_0x2e88('0x13')][_0x2e88('0x12')](this));ami['on'](_0x2e88('0x14'),this[_0x2e88('0x15')][_0x2e88('0x12')](this));ami['on'](_0x2e88('0x16'),this[_0x2e88('0x17')][_0x2e88('0x12')](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x2e88('0x18'),this[_0x2e88('0x19')][_0x2e88('0x12')](this));ami['on'](_0x2e88('0x1a'),this[_0x2e88('0x1b')][_0x2e88('0x12')](this));ami['on'](_0x2e88('0x1c'),this[_0x2e88('0x1d')][_0x2e88('0x12')](this));}Fax[_0x2e88('0x1e')][_0x2e88('0x1f')]=function(_0x1ab632){if(_0x1ab632[_0x2e88('0x20')]===_0x2e88('0x21')){for(var _0x1cce67 in this[_0x2e88('0xe')]){if(this[_0x2e88('0xe')][_0x2e88('0x22')](_0x1cce67)){if(_0x1ab632['exten']===this['faxAccounts'][_0x1cce67][_0x2e88('0x23')]){this[_0x2e88('0xd')][_0x1ab632['uniqueid']]={};this[_0x2e88('0xd')][_0x1ab632['uniqueid']][_0x2e88('0x24')]=_0x1ab632[_0x2e88('0x24')];this['channels'][_0x1ab632['uniqueid']]['id']=this[_0x2e88('0xe')][_0x1cce67]['id'];this[_0x2e88('0xd')][_0x1ab632[_0x2e88('0x25')]]['name']=this['faxAccounts'][_0x1cce67][_0x2e88('0x26')];logger[_0x2e88('0x27')](_0x1ab632[_0x2e88('0x25')],_0x2e88('0x28'));}}}}if(this[_0x2e88('0x10')][_0x1ab632[_0x2e88('0x25')]]){this['channels'][_0x1ab632[_0x2e88('0x25')]]={};this[_0x2e88('0xd')][_0x1ab632[_0x2e88('0x25')]][_0x2e88('0x24')]=_0x1ab632[_0x2e88('0x24')];logger[_0x2e88('0x27')](_0x1ab632[_0x2e88('0x25')],_0x2e88('0x28'));}};Fax['prototype'][_0x2e88('0x13')]=function(_0x3dbd5e){if(this['channels'][_0x3dbd5e[_0x2e88('0x25')]]){for(var _0x158a31 in _0x3dbd5e[_0x2e88('0x29')]){if(_0x3dbd5e['variable'][_0x2e88('0x22')](_0x158a31)){this[_0x2e88('0xd')][_0x3dbd5e[_0x2e88('0x25')]][_0x158a31]=_0x3dbd5e[_0x2e88('0x2a')];}}}};Fax[_0x2e88('0x1e')]['syncNewState']=function(_0x13db72){if(this[_0x2e88('0xd')][_0x13db72[_0x2e88('0x25')]]){this[_0x2e88('0xd')][_0x13db72[_0x2e88('0x25')]][_0x2e88('0x2b')]=_0x13db72[_0x2e88('0x2b')];this[_0x2e88('0xd')][_0x13db72[_0x2e88('0x25')]][_0x2e88('0x2c')]=_0x13db72[_0x2e88('0x2c')];}};Fax['prototype'][_0x2e88('0x17')]=function(_0x2c9196){if(this[_0x2e88('0xd')][_0x2c9196[_0x2e88('0x25')]]){for(var _0x329248 in _0x2c9196[_0x2e88('0x29')]){if(_0x2c9196[_0x2e88('0x29')][_0x2e88('0x22')](_0x329248)){this[_0x2e88('0xd')][_0x2c9196[_0x2e88('0x25')]][_0x329248]=_0x2c9196[_0x2e88('0x2a')];}}}};Fax[_0x2e88('0x1e')]['syncFaxStatus']=function(_0x2bcc61){if(this['channels'][_0x2bcc61['uniqueid']]){this[_0x2e88('0xd')][_0x2bcc61['uniqueid']][_0x2e88('0x2d')]=_0x2bcc61[_0x2e88('0x2d')];this['channels'][_0x2bcc61[_0x2e88('0x25')]][_0x2e88('0x2e')]=_0x2bcc61[_0x2e88('0x2e')];this[_0x2e88('0xd')][_0x2bcc61[_0x2e88('0x25')]]['localstationid']=_0x2bcc61['localstationid'];this[_0x2e88('0xd')][_0x2bcc61[_0x2e88('0x25')]]['filename']=_0x2bcc61['filename'];logger['info'](_0x2bcc61[_0x2e88('0x25')],_0x2e88('0x2f'));}};Fax[_0x2e88('0x1e')][_0x2e88('0x19')]=function(_0x4d6e89){var _0x5c469a=this;if(this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]]){var _0x158644=this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]]['id'];this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]][_0x2e88('0x30')]=_0x4d6e89[_0x2e88('0x30')];this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]][_0x2e88('0x31')]=_0x4d6e89[_0x2e88('0x31')];this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]][_0x2e88('0x23')]=_0x4d6e89['localstationid'];this['channels'][_0x4d6e89[_0x2e88('0x25')]][_0x2e88('0x32')]=_0x4d6e89[_0x2e88('0x32')];this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]]['transferrate']=_0x4d6e89[_0x2e88('0x33')];this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]][_0x2e88('0x34')]=_0x4d6e89[_0x2e88('0x34')];this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]]['calleridnum']=_0x4d6e89[_0x2e88('0x35')];if(this[_0x2e88('0xd')][_0x4d6e89[_0x2e88('0x25')]][_0x2e88('0x31')]>0x0){tiff2pdf(_0x4d6e89['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x3f02a5){logger[_0x2e88('0x27')](_0x4d6e89[_0x2e88('0x25')],_0x2e88('0x36'),_0x3f02a5[_0x2e88('0x37')]);attachment[_0x2e88('0x38')]({'name':path['parse'](_0x4d6e89[_0x2e88('0x34')])[_0x2e88('0x26')],'basename':path['parse'](_0x4d6e89[_0x2e88('0x34')])[_0x2e88('0x26')]+_0x2e88('0x39'),'type':_0x2e88('0x3a')})[_0x2e88('0x3b')](function(_0x22c506){faxAccount[_0x2e88('0x3c')](_0x158644,{'from':_0x4d6e89[_0x2e88('0x35')],'mapKey':_0x2e88('0x6'),'body':path[_0x2e88('0x3d')](_0x4d6e89[_0x2e88('0x34')])[_0x2e88('0x26')]+_0x2e88('0x39'),'AttachmentId':_0x22c506['id']})[_0x2e88('0x3e')](function(_0x15f3b5){logger['error'](_0x4d6e89['uniqueid'],_0x2e88('0x3f'),JSON[_0x2e88('0x40')](_0x15f3b5));});})[_0x2e88('0x3e')](function(_0x151c59){logger[_0x2e88('0x41')](_0x4d6e89[_0x2e88('0x25')],_0x2e88('0x42'),JSON[_0x2e88('0x40')](_0x151c59));});});}logger[_0x2e88('0x27')](_0x4d6e89[_0x2e88('0x25')],_0x2e88('0x42'));}};Fax['prototype'][_0x2e88('0x1d')]=function(_0x4af4c0){if(this['actions'][_0x4af4c0[_0x2e88('0x25')]]){_['merge'](this[_0x2e88('0xd')][_0x4af4c0[_0x2e88('0x25')]],_[_0x2e88('0x43')](_0x4af4c0,[_0x2e88('0x44'),'reason']));}};function updateStatus(_0x346a09){if(_0x346a09[_0x2e88('0x45')]){faxMessage['update'](_0x346a09[_0x2e88('0x45')],{'failMessage':_0x2e88('0x46')})['then'](function(_0x1ccba8){ut['logger']('[Fax][Message][Error][Updated]',_0x1ccba8);})[_0x2e88('0x3e')](function(_0x3a0f4a){ut[_0x2e88('0x47')](_0x2e88('0x48'),_0x3a0f4a);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x2e88('0x1e')][_0x2e88('0x49')]=function(_0x381b53,_0x5ac05f,_0x12acd9){var _0x183fb3=this;var _0x19aa16={};if(_0x5ac05f){_0x19aa16={'read':_0x5ac05f};}else{_0x19aa16={'failMessage':_0x12acd9};}if(this[_0x2e88('0x10')][_0x381b53][_0x2e88('0x45')]){faxMessage[_0x2e88('0x4a')](this[_0x2e88('0x10')][_0x381b53][_0x2e88('0x45')],_0x19aa16)[_0x2e88('0x3b')](function(_0xe261e4){ut[_0x2e88('0x47')]('[Fax][Message][Updated]',_0xe261e4);})[_0x2e88('0x3e')](function(_0x287cdc){ut[_0x2e88('0x47')](_0x2e88('0x4b'),_0x287cdc);})[_0x2e88('0x4c')](function(){delete _0x183fb3['channels'][_0x381b53];delete _0x183fb3[_0x2e88('0x10')][_0x381b53];});}else{ut[_0x2e88('0x47')](_0x2e88('0x4d'));delete this['channels'][_0x381b53];delete this['actions'][_0x381b53];}};Fax['prototype']['syncHangup']=function(_0x2be88d){var _0x3c8d3e=this;if(this[_0x2e88('0xd')][_0x2be88d[_0x2e88('0x25')]]){if(this['actions'][_0x2be88d[_0x2e88('0x25')]]){this[_0x2e88('0xd')][_0x2be88d[_0x2e88('0x25')]]['id']=this['actions'][_0x2be88d[_0x2e88('0x25')]]['id'];this[_0x2e88('0xd')][_0x2be88d['uniqueid']][_0x2e88('0x26')]=this[_0x2e88('0x10')][_0x2be88d[_0x2e88('0x25')]][_0x2e88('0x26')];}logger['info'](_0x2be88d[_0x2e88('0x25')],this['actions'][_0x2be88d[_0x2e88('0x25')]]?'\x20hangup\x20sendFile\x20':_0x2e88('0x4e'),JSON[_0x2e88('0x40')](this[_0x2e88('0xd')][_0x2be88d[_0x2e88('0x25')]]));if(this[_0x2e88('0x10')][_0x2be88d['uniqueid']]){if(this[_0x2e88('0xd')][_0x2be88d[_0x2e88('0x25')]][_0x2e88('0x4f')]>0x0&&this[_0x2e88('0xd')][_0x2be88d[_0x2e88('0x25')]]['faxstatus']==='SUCCESS'){this[_0x2e88('0x49')](_0x2be88d['uniqueid'],!![]);}else{this[_0x2e88('0x49')](_0x2be88d[_0x2e88('0x25')],![],this['channels'][_0x2be88d['uniqueid']][_0x2e88('0x50')]?_0x2e88('0x51')+this['channels'][_0x2be88d['uniqueid']][_0x2e88('0x50')]:_0x2e88('0x52'));}}}};Fax['prototype']['send']=function(_0x4cdeaa){var _0x38a10f=this;return new BPromise(function(_0x1de57e,_0x44f08b){_0x38a10f['execOriginate'](_0x4cdeaa,_0x38a10f[_0x2e88('0xe')][_0x4cdeaa['FaxAccountId']])[_0x2e88('0x3b')](function(_0x2b5a69){ut[_0x2e88('0x47')](_0x2e88('0x53'),_0x2b5a69);_0x1de57e(ut[_0x2e88('0x37')]('Fax\x20received'));})[_0x2e88('0x3e')](function(_0x2693b6){ut[_0x2e88('0x47')](_0x2e88('0x54'),_0x2693b6);updateStatus(_0x4cdeaa);_0x44f08b(ut[_0x2e88('0x37')]('Fax\x20failed'));});});};Fax[_0x2e88('0x1e')][_0x2e88('0x55')]=function(_0x39b02f){var _0x45c488=this;return new BPromise(function(_0x207c26,_0x5e3838){var _0x310e0b=_0x45c488[_0x2e88('0x56')](_0x45c488[_0x2e88('0xe')][_0x39b02f[_0x2e88('0x57')]][_0x2e88('0x58')],_0x39b02f);if(_0x310e0b[_0x2e88('0x59')]){_0x207c26(ut[_0x2e88('0x37')](_0x2e88('0x5a')));}else{_0x5e3838(ut[_0x2e88('0x37')](_0x310e0b['message']));}});};function originate(_0x87dbc5,_0x363711,_0x2f2c78){return new BPromise(function(_0x116806,_0x1ef126){if(_0x2f2c78){var _0x4717bc=util[_0x2e88('0x5b')](_0x2e88('0x5c'),path[_0x2e88('0x3d')](_0x87dbc5[_0x2e88('0x5d')])[_0x2e88('0x26')],_0x87dbc5[_0x2e88('0x5d')]);gs[_0x2e88('0x5e')](_0x4717bc)[_0x2e88('0x3b')](function(){_0x87dbc5[_0x2e88('0x5d')]=util[_0x2e88('0x5b')](_0x2e88('0x5f'),path[_0x2e88('0x3d')](_0x87dbc5['path'])[_0x2e88('0x60')],path[_0x2e88('0x3d')](_0x87dbc5[_0x2e88('0x5d')])['name']);_0x363711[_0x2e88('0x61')]=_0x87dbc5[_0x2e88('0x5d')];ut['logger'](_0x2e88('0x62'),'');ami[_0x2e88('0x63')](ut['variablesAction'](_0x87dbc5,_0x363711))[_0x2e88('0x3b')](function(_0x2205ec){_0x116806(_0x2205ec);})[_0x2e88('0x3e')](function(_0x49d02a){_0x1ef126(_0x49d02a);});})[_0x2e88('0x3e')](function(_0x219c6c){_0x1ef126(_0x219c6c);});}else{ami[_0x2e88('0x63')](ut[_0x2e88('0x64')](_0x87dbc5,_0x363711))['then'](function(_0x1846e5){_0x116806(_0x1846e5);})[_0x2e88('0x3e')](function(_0x3682e3){_0x1ef126(_0x3682e3);});}});}Fax[_0x2e88('0x1e')][_0x2e88('0x65')]=function(_0x5f1e4e,_0x419d82){var _0x1cdf06=this;return new BPromise(function(_0x39a6cf,_0x2ff193){var _0x2ac358=uuid['v4']();var _0x434669=ut['addVariables'](_0x5f1e4e,_0x419d82);_0x1cdf06['actions'][_0x2ac358]=new Action(_0x2ac358,_0x419d82,_0x5f1e4e);var _0x533b7c=_0x1cdf06[_0x2e88('0x10')][_0x2ac358];if(path[_0x2e88('0x3d')](_0x5f1e4e['path'])['ext']===_0x2e88('0x39')){originate(_0x533b7c,_0x434669,!![])[_0x2e88('0x3b')](function(_0x5ee405){_0x39a6cf(_0x5ee405);})['catch'](function(_0x33512){_0x2ff193(_0x33512);});}else{originate(_0x533b7c,_0x434669,![])[_0x2e88('0x3b')](function(_0x62d2ad){_0x39a6cf(_0x62d2ad);})[_0x2e88('0x3e')](function(_0x5c6590){_0x2ff193(_0x5c6590);});}});};Fax['prototype']['isTrunkReachable']=function(_0x58e62a){return!_['isNil'](_0x58e62a)&&!_[_0x2e88('0x66')](_0x58e62a[_0x2e88('0x26')])&&!_[_0x2e88('0x66')](_0x58e62a[_0x2e88('0x67')])&&_0x58e62a[_0x2e88('0x67')]&&!_[_0x2e88('0x66')](this['trunks'][util['format'](_0x2e88('0x68'),_0x58e62a[_0x2e88('0x26')])])&&!_[_0x2e88('0x66')](this[_0x2e88('0xf')][util[_0x2e88('0x5b')](_0x2e88('0x68'),_0x58e62a[_0x2e88('0x26')])][_0x2e88('0x2e')])&&(this[_0x2e88('0xf')][util[_0x2e88('0x5b')]('SIP/%s',_0x58e62a[_0x2e88('0x26')])][_0x2e88('0x2e')]===_0x2e88('0x69')||this['trunks'][util[_0x2e88('0x5b')](_0x2e88('0x68'),_0x58e62a['name'])][_0x2e88('0x2e')]===_0x2e88('0x6a'));};Fax[_0x2e88('0x1e')][_0x2e88('0x56')]=function(_0xac75ec,_0x265d67){if(!this[_0x2e88('0x6b')](_0xac75ec)){ut['logger'](_0x2e88('0x6c'),_[_0x2e88('0x66')](_0xac75ec)?'':_0xac75ec[_0x2e88('0x26')]+_0x2e88('0x6d'));return{'isValid':![],'message':_0x2e88('0x6e')};}if(_['isNil'](_0x265d67[_0x2e88('0x6')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x2e88('0x40')](_0x265d67));return{'isValid':![],'message':_0x2e88('0x6f')};}if(_['isNil'](_0x265d67[_0x2e88('0x5d')])){ut[_0x2e88('0x47')](_0x2e88('0x70'),JSON[_0x2e88('0x40')](_0x265d67));return{'isValid':![],'message':_0x2e88('0x71')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x2e88('0x72')]=Fax; \ No newline at end of file +var _0x4d01=['remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','execOriginate','addVariables','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','../rpc/faxMessage','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewExten','faxstatus','syncReceiveFax','syncHangup','originateresponse','context','faxAccounts','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncFaxStatus','status','localstationid','filename','\x20syncFaxStatus\x20'];(function(_0xfe41c5,_0x67b2d1){var _0x3e04be=function(_0x285995){while(--_0x285995){_0xfe41c5['push'](_0xfe41c5['shift']());}};_0x3e04be(++_0x67b2d1);}(_0x4d01,0xbf));var _0x14d0=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x4d01[_0x1857c6];return _0x51011c;};'use strict';var util=require(_0x14d0('0x0'));var _=require(_0x14d0('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x14d0('0x2'));var path=require(_0x14d0('0x3'));var tiff2pdf=require(_0x14d0('0x4'));var gs=require(_0x14d0('0x5'));var logger=require(_0x14d0('0x6'))(_0x14d0('0x7'));var ami=require(_0x14d0('0x8'));var rpcDb=require(_0x14d0('0x9'));var Channel=require('./channel');var ut=require('./util/util');var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x14d0('0xa'));function Fax(_0x360056){this['channels']={};this['faxAccounts']=_0x360056['faxAccounts'];this[_0x14d0('0xb')]=_0x360056[_0x14d0('0xb')];this[_0x14d0('0xc')]={};ami['on'](_0x14d0('0xd'),this[_0x14d0('0xe')][_0x14d0('0xf')](this));ami['on'](_0x14d0('0x10'),this[_0x14d0('0x11')]['bind'](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on']('newexten',this[_0x14d0('0x12')][_0x14d0('0xf')](this));ami['on'](_0x14d0('0x13'),this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0x14d0('0x14')][_0x14d0('0xf')](this));ami['on']('hangup',this[_0x14d0('0x15')][_0x14d0('0xf')](this));ami['on'](_0x14d0('0x16'),this['syncOriginateResponse'][_0x14d0('0xf')](this));}Fax['prototype'][_0x14d0('0xe')]=function(_0x241ddc){if(_0x241ddc[_0x14d0('0x17')]==='from-voip-provider'){for(var _0xc576ee in this[_0x14d0('0x18')]){if(this[_0x14d0('0x18')][_0x14d0('0x19')](_0xc576ee)){if(_0x241ddc[_0x14d0('0x1a')]===this[_0x14d0('0x18')][_0xc576ee]['localstationid']){this[_0x14d0('0x1b')][_0x241ddc['uniqueid']]={};this['channels'][_0x241ddc[_0x14d0('0x1c')]][_0x14d0('0x1d')]=_0x241ddc['channel'];this[_0x14d0('0x1b')][_0x241ddc[_0x14d0('0x1c')]]['id']=this[_0x14d0('0x18')][_0xc576ee]['id'];this[_0x14d0('0x1b')][_0x241ddc['uniqueid']][_0x14d0('0x1e')]=this[_0x14d0('0x18')][_0xc576ee]['name'];logger[_0x14d0('0x1f')](_0x241ddc[_0x14d0('0x1c')],'\x20syncNewchannel\x20');}}}}if(this[_0x14d0('0xc')][_0x241ddc[_0x14d0('0x1c')]]){this[_0x14d0('0x1b')][_0x241ddc[_0x14d0('0x1c')]]={};this['channels'][_0x241ddc[_0x14d0('0x1c')]][_0x14d0('0x1d')]=_0x241ddc['channel'];logger[_0x14d0('0x1f')](_0x241ddc[_0x14d0('0x1c')],_0x14d0('0x20'));}};Fax[_0x14d0('0x21')]['syncVarSet']=function(_0x1db9e4){if(this[_0x14d0('0x1b')][_0x1db9e4[_0x14d0('0x1c')]]){for(var _0x3e2c11 in _0x1db9e4['variable']){if(_0x1db9e4[_0x14d0('0x22')][_0x14d0('0x19')](_0x3e2c11)){this[_0x14d0('0x1b')][_0x1db9e4[_0x14d0('0x1c')]][_0x3e2c11]=_0x1db9e4[_0x14d0('0x23')];}}}};Fax[_0x14d0('0x21')]['syncNewState']=function(_0x32ea86){if(this[_0x14d0('0x1b')][_0x32ea86['uniqueid']]){this[_0x14d0('0x1b')][_0x32ea86[_0x14d0('0x1c')]][_0x14d0('0x24')]=_0x32ea86[_0x14d0('0x24')];this[_0x14d0('0x1b')][_0x32ea86[_0x14d0('0x1c')]][_0x14d0('0x25')]=_0x32ea86[_0x14d0('0x25')];}};Fax[_0x14d0('0x21')][_0x14d0('0x12')]=function(_0x4021c8){if(this[_0x14d0('0x1b')][_0x4021c8[_0x14d0('0x1c')]]){for(var _0x20b7d0 in _0x4021c8[_0x14d0('0x22')]){if(_0x4021c8[_0x14d0('0x22')]['hasOwnProperty'](_0x20b7d0)){this[_0x14d0('0x1b')][_0x4021c8[_0x14d0('0x1c')]][_0x20b7d0]=_0x4021c8[_0x14d0('0x23')];}}}};Fax[_0x14d0('0x21')][_0x14d0('0x26')]=function(_0x46fc11){if(this[_0x14d0('0x1b')][_0x46fc11[_0x14d0('0x1c')]]){this['channels'][_0x46fc11['uniqueid']]['operation']=_0x46fc11['operation'];this[_0x14d0('0x1b')][_0x46fc11[_0x14d0('0x1c')]][_0x14d0('0x27')]=_0x46fc11[_0x14d0('0x27')];this[_0x14d0('0x1b')][_0x46fc11[_0x14d0('0x1c')]][_0x14d0('0x28')]=_0x46fc11['localstationid'];this[_0x14d0('0x1b')][_0x46fc11['uniqueid']][_0x14d0('0x29')]=_0x46fc11[_0x14d0('0x29')];logger[_0x14d0('0x1f')](_0x46fc11[_0x14d0('0x1c')],_0x14d0('0x2a'));}};Fax['prototype'][_0x14d0('0x14')]=function(_0x5a9c37){var _0x12d175=this;if(this['channels'][_0x5a9c37['uniqueid']]){var _0xc2cf53=this[_0x14d0('0x1b')][_0x5a9c37['uniqueid']]['id'];this[_0x14d0('0x1b')][_0x5a9c37['uniqueid']][_0x14d0('0x2b')]=_0x5a9c37[_0x14d0('0x2b')];this[_0x14d0('0x1b')][_0x5a9c37[_0x14d0('0x1c')]][_0x14d0('0x2c')]=_0x5a9c37[_0x14d0('0x2c')];this[_0x14d0('0x1b')][_0x5a9c37[_0x14d0('0x1c')]][_0x14d0('0x28')]=_0x5a9c37[_0x14d0('0x28')];this[_0x14d0('0x1b')][_0x5a9c37[_0x14d0('0x1c')]][_0x14d0('0x2d')]=_0x5a9c37[_0x14d0('0x2d')];this[_0x14d0('0x1b')][_0x5a9c37[_0x14d0('0x1c')]]['transferrate']=_0x5a9c37[_0x14d0('0x2e')];this[_0x14d0('0x1b')][_0x5a9c37[_0x14d0('0x1c')]][_0x14d0('0x29')]=_0x5a9c37[_0x14d0('0x29')];this[_0x14d0('0x1b')][_0x5a9c37[_0x14d0('0x1c')]][_0x14d0('0x2f')]=_0x5a9c37['calleridnum'];if(this[_0x14d0('0x1b')][_0x5a9c37[_0x14d0('0x1c')]]['pagestransferred']>0x0){tiff2pdf(_0x5a9c37['filename'],_0x14d0('0x30'),function(_0x2c3fee){logger[_0x14d0('0x1f')](_0x5a9c37[_0x14d0('0x1c')],_0x14d0('0x31'),_0x2c3fee[_0x14d0('0x32')]);attachment[_0x14d0('0x33')]({'name':path['parse'](_0x5a9c37['filename'])[_0x14d0('0x1e')],'basename':path[_0x14d0('0x34')](_0x5a9c37[_0x14d0('0x29')])['name']+_0x14d0('0x35'),'type':_0x14d0('0x36')})[_0x14d0('0x37')](function(_0x5296a3){faxAccount[_0x14d0('0x38')](_0xc2cf53,{'from':_0x5a9c37[_0x14d0('0x2f')],'mapKey':_0x14d0('0x7'),'body':path[_0x14d0('0x34')](_0x5a9c37[_0x14d0('0x29')])[_0x14d0('0x1e')]+_0x14d0('0x35'),'AttachmentId':_0x5296a3['id']})['catch'](function(_0x1fa593){logger[_0x14d0('0x39')](_0x5a9c37[_0x14d0('0x1c')],_0x14d0('0x3a'),JSON[_0x14d0('0x3b')](_0x1fa593));});})[_0x14d0('0x3c')](function(_0x2d0f08){logger[_0x14d0('0x39')](_0x5a9c37[_0x14d0('0x1c')],'\x20receiveFax\x20',JSON['stringify'](_0x2d0f08));});});}logger[_0x14d0('0x1f')](_0x5a9c37[_0x14d0('0x1c')],'\x20receiveFax\x20');}};Fax[_0x14d0('0x21')][_0x14d0('0x3d')]=function(_0x3a11b4){if(this[_0x14d0('0xc')][_0x3a11b4[_0x14d0('0x1c')]]){_[_0x14d0('0x3e')](this[_0x14d0('0x1b')][_0x3a11b4['uniqueid']],_[_0x14d0('0x3f')](_0x3a11b4,[_0x14d0('0x40'),_0x14d0('0x41')]));}};function updateStatus(_0x3662ac){if(_0x3662ac[_0x14d0('0x42')]){faxMessage[_0x14d0('0x43')](_0x3662ac[_0x14d0('0x42')],{'failMessage':_0x14d0('0x44')})[_0x14d0('0x37')](function(_0x497ee7){ut[_0x14d0('0x45')]('[Fax][Message][Error][Updated]',_0x497ee7);})[_0x14d0('0x3c')](function(_0x21e114){ut[_0x14d0('0x45')](_0x14d0('0x46'),_0x21e114);});}else{ut['logger'](_0x14d0('0x47'));}}Fax[_0x14d0('0x21')][_0x14d0('0x48')]=function(_0x4c198c,_0x4b2ad0,_0x50c569){var _0x3f7439=this;var _0x2eb7bc={};if(_0x4b2ad0){_0x2eb7bc={'read':_0x4b2ad0};}else{_0x2eb7bc={'failMessage':_0x50c569};}if(this[_0x14d0('0xc')][_0x4c198c]['AttachmentId']){faxMessage['update'](this[_0x14d0('0xc')][_0x4c198c][_0x14d0('0x42')],_0x2eb7bc)['then'](function(_0x11ec2d){ut[_0x14d0('0x45')]('[Fax][Message][Updated]',_0x11ec2d);})['catch'](function(_0x26933e){ut[_0x14d0('0x45')](_0x14d0('0x49'),_0x26933e);})[_0x14d0('0x4a')](function(){delete _0x3f7439[_0x14d0('0x1b')][_0x4c198c];delete _0x3f7439['actions'][_0x4c198c];});}else{ut[_0x14d0('0x45')](_0x14d0('0x4b'));delete this[_0x14d0('0x1b')][_0x4c198c];delete this[_0x14d0('0xc')][_0x4c198c];}};Fax[_0x14d0('0x21')][_0x14d0('0x15')]=function(_0x35ceff){var _0x12459c=this;if(this[_0x14d0('0x1b')][_0x35ceff['uniqueid']]){if(this['actions'][_0x35ceff['uniqueid']]){this[_0x14d0('0x1b')][_0x35ceff['uniqueid']]['id']=this[_0x14d0('0xc')][_0x35ceff[_0x14d0('0x1c')]]['id'];this['channels'][_0x35ceff['uniqueid']][_0x14d0('0x1e')]=this[_0x14d0('0xc')][_0x35ceff[_0x14d0('0x1c')]][_0x14d0('0x1e')];}logger[_0x14d0('0x1f')](_0x35ceff['uniqueid'],this['actions'][_0x35ceff['uniqueid']]?_0x14d0('0x4c'):_0x14d0('0x4d'),JSON['stringify'](this[_0x14d0('0x1b')][_0x35ceff[_0x14d0('0x1c')]]));if(this['actions'][_0x35ceff[_0x14d0('0x1c')]]){if(this[_0x14d0('0x1b')][_0x35ceff['uniqueid']][_0x14d0('0x4e')]>0x0&&this[_0x14d0('0x1b')][_0x35ceff[_0x14d0('0x1c')]]['faxstatus']===_0x14d0('0x4f')){this[_0x14d0('0x48')](_0x35ceff[_0x14d0('0x1c')],!![]);}else{this['updateStatus'](_0x35ceff[_0x14d0('0x1c')],![],this['channels'][_0x35ceff[_0x14d0('0x1c')]][_0x14d0('0x50')]?_0x14d0('0x51')+this[_0x14d0('0x1b')][_0x35ceff[_0x14d0('0x1c')]][_0x14d0('0x50')]:'SENDING\x20FAILED');}}}};Fax[_0x14d0('0x21')][_0x14d0('0x52')]=function(_0x4e9e13){var _0x273323=this;return new BPromise(function(_0x20fe85,_0x1fb4b1){_0x273323['execOriginate'](_0x4e9e13,_0x273323['faxAccounts'][_0x4e9e13[_0x14d0('0x53')]])[_0x14d0('0x37')](function(_0x256d5b){ut[_0x14d0('0x45')](_0x14d0('0x54'),_0x256d5b);_0x20fe85(ut[_0x14d0('0x32')](_0x14d0('0x55')));})[_0x14d0('0x3c')](function(_0x5e628e){ut[_0x14d0('0x45')](_0x14d0('0x56'),_0x5e628e);updateStatus(_0x4e9e13);_0x1fb4b1(ut[_0x14d0('0x32')](_0x14d0('0x57')));});});};Fax[_0x14d0('0x21')][_0x14d0('0x58')]=function(_0x37e362){var _0xcc173e=this;return new BPromise(function(_0x346685,_0x442796){var _0x5a7eba=_0xcc173e[_0x14d0('0x59')](_0xcc173e[_0x14d0('0x18')][_0x37e362[_0x14d0('0x53')]][_0x14d0('0x5a')],_0x37e362);if(_0x5a7eba[_0x14d0('0x5b')]){_0x346685(ut[_0x14d0('0x32')](_0x14d0('0x5c')));}else{_0x442796(ut[_0x14d0('0x32')](_0x5a7eba[_0x14d0('0x32')]));}});};function originate(_0x465bcf,_0x2ac0bc,_0x371689){return new BPromise(function(_0x1fc036,_0x4c1089){if(_0x371689){var _0x19fa0c=util[_0x14d0('0x5d')](_0x14d0('0x5e'),path[_0x14d0('0x34')](_0x465bcf[_0x14d0('0x3')])[_0x14d0('0x1e')],_0x465bcf[_0x14d0('0x3')]);gs[_0x14d0('0x5f')](_0x19fa0c)[_0x14d0('0x37')](function(){_0x465bcf[_0x14d0('0x3')]=util['format'](_0x14d0('0x60'),path[_0x14d0('0x34')](_0x465bcf[_0x14d0('0x3')])[_0x14d0('0x61')],path[_0x14d0('0x34')](_0x465bcf[_0x14d0('0x3')])[_0x14d0('0x1e')]);_0x2ac0bc[_0x14d0('0x62')]=_0x465bcf[_0x14d0('0x3')];ut[_0x14d0('0x45')]('Convert\x20pdf\x20to\x20tif','');ami[_0x14d0('0x63')](ut['variablesAction'](_0x465bcf,_0x2ac0bc))[_0x14d0('0x37')](function(_0x2a3d9c){_0x1fc036(_0x2a3d9c);})[_0x14d0('0x3c')](function(_0x46a19b){_0x4c1089(_0x46a19b);});})[_0x14d0('0x3c')](function(_0x2846df){_0x4c1089(_0x2846df);});}else{ami['Action'](ut['variablesAction'](_0x465bcf,_0x2ac0bc))[_0x14d0('0x37')](function(_0xe593cd){_0x1fc036(_0xe593cd);})[_0x14d0('0x3c')](function(_0x566f99){_0x4c1089(_0x566f99);});}});}Fax['prototype'][_0x14d0('0x64')]=function(_0x1fcbc0,_0x29e3b4){var _0x18177d=this;return new BPromise(function(_0x9bea0b,_0x481fe2){var _0x16a56f=uuid['v4']();var _0xe1a5a0=ut[_0x14d0('0x65')](_0x1fcbc0,_0x29e3b4);_0x18177d['actions'][_0x16a56f]=new Action(_0x16a56f,_0x29e3b4,_0x1fcbc0);var _0x22ce60=_0x18177d[_0x14d0('0xc')][_0x16a56f];if(path[_0x14d0('0x34')](_0x1fcbc0[_0x14d0('0x3')])[_0x14d0('0x66')]===_0x14d0('0x35')){originate(_0x22ce60,_0xe1a5a0,!![])['then'](function(_0x2eea5d){_0x9bea0b(_0x2eea5d);})[_0x14d0('0x3c')](function(_0x425619){_0x481fe2(_0x425619);});}else{originate(_0x22ce60,_0xe1a5a0,![])['then'](function(_0x3bb883){_0x9bea0b(_0x3bb883);})[_0x14d0('0x3c')](function(_0x37725e){_0x481fe2(_0x37725e);});}});};Fax[_0x14d0('0x21')]['isTrunkReachable']=function(_0xb8dfc1){return!_[_0x14d0('0x67')](_0xb8dfc1)&&!_[_0x14d0('0x67')](_0xb8dfc1['name'])&&!_[_0x14d0('0x67')](_0xb8dfc1[_0x14d0('0x68')])&&_0xb8dfc1[_0x14d0('0x68')]&&!_[_0x14d0('0x67')](this[_0x14d0('0xb')][util[_0x14d0('0x5d')](_0x14d0('0x69'),_0xb8dfc1[_0x14d0('0x1e')])])&&!_[_0x14d0('0x67')](this['trunks'][util[_0x14d0('0x5d')]('SIP/%s',_0xb8dfc1[_0x14d0('0x1e')])][_0x14d0('0x27')])&&(this[_0x14d0('0xb')][util[_0x14d0('0x5d')](_0x14d0('0x69'),_0xb8dfc1[_0x14d0('0x1e')])][_0x14d0('0x27')]==='reachable'||this[_0x14d0('0xb')][util[_0x14d0('0x5d')](_0x14d0('0x69'),_0xb8dfc1[_0x14d0('0x1e')])][_0x14d0('0x27')]===_0x14d0('0x6a'));};Fax[_0x14d0('0x21')][_0x14d0('0x59')]=function(_0x494605,_0x60d0c6){if(!this[_0x14d0('0x6b')](_0x494605)){ut['logger'](_0x14d0('0x6c'),_['isNil'](_0x494605)?'':_0x494605[_0x14d0('0x1e')]+_0x14d0('0x6d'));return{'isValid':![],'message':_0x14d0('0x6e')};}if(_[_0x14d0('0x67')](_0x60d0c6['fax'])){ut[_0x14d0('0x45')](_0x14d0('0x6f'),JSON['stringify'](_0x60d0c6));return{'isValid':![],'message':_0x14d0('0x70')};}if(_[_0x14d0('0x67')](_0x60d0c6[_0x14d0('0x3')])){ut['logger'](_0x14d0('0x71'),JSON[_0x14d0('0x3b')](_0x60d0c6));return{'isValid':![],'message':_0x14d0('0x72')};}return{'isValid':!![],'message':_0x14d0('0x73')};};module[_0x14d0('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index fb866bb..f8e7257 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 _0x75f9=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20','util','bluebird'];(function(_0x252295,_0x4ebe9c){var _0x2b5b19=function(_0x314eb0){while(--_0x314eb0){_0x252295['push'](_0x252295['shift']());}};_0x2b5b19(++_0x4ebe9c);}(_0x75f9,0xfa));var _0x975f=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x75f9[_0x39096d];return _0x13da4f;};'use strict';var util=require(_0x975f('0x0'));var BPromise=require(_0x975f('0x1'));var logger=require(_0x975f('0x2'))(_0x975f('0x3'));var _=require(_0x975f('0x4'));var faxAccount=require(_0x975f('0x5'));function loggerCatch(_0x463fb4){return function(_0x5d2a7f){logger[_0x975f('0x6')](_0x463fb4,util[_0x975f('0x7')](_0x5d2a7f,{'showHidden':![],'depth':null}));};}exports[_0x975f('0x8')]=function(_0x19c190,_0x1e48c0){return BPromise[_0x975f('0x9')]()['then'](faxAccount['notify'](_0x19c190,_0x1e48c0))[_0x975f('0xa')](loggerCatch(_0x975f('0xb')));}; \ No newline at end of file +var _0x6e04=['resolve','then','catch','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0x1fa149,_0x452da3){var _0x2e7f13=function(_0x3dad97){while(--_0x3dad97){_0x1fa149['push'](_0x1fa149['shift']());}};_0x2e7f13(++_0x452da3);}(_0x6e04,0x99));var _0x46e0=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0x6e04[_0x499210];return _0x2e153d;};'use strict';var util=require(_0x46e0('0x0'));var BPromise=require('bluebird');var logger=require(_0x46e0('0x1'))(_0x46e0('0x2'));var _=require(_0x46e0('0x3'));var faxAccount=require(_0x46e0('0x4'));function loggerCatch(_0x2a413f){return function(_0x174013){logger[_0x46e0('0x5')](_0x2a413f,util[_0x46e0('0x6')](_0x174013,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x31e7ba,_0x34c25e){return BPromise[_0x46e0('0x7')]()[_0x46e0('0x8')](faxAccount['notify'](_0x31e7ba,_0x34c25e))[_0x46e0('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 971b154..cddb2cd 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 _0x0208=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger'];(function(_0x4f973a,_0x1b853c){var _0x46a43a=function(_0x50f2d4){while(--_0x50f2d4){_0x4f973a['push'](_0x4f973a['shift']());}};_0x46a43a(++_0x1b853c);}(_0x0208,0xe4));var _0x8020=function(_0x227c55,_0x49db56){_0x227c55=_0x227c55-0x0;var _0x49e02b=_0x0208[_0x227c55];return _0x49e02b;};'use strict';var util=require(_0x8020('0x0'));var logger=require(_0x8020('0x1'))(_0x8020('0x2'));var BPromise=require(_0x8020('0x3'));var exec=require(_0x8020('0x4'))[_0x8020('0x5')];exports[_0x8020('0x6')]=function(_0x12f0fe){return new BPromise(function(_0x20264c,_0x30c76c){exec(_0x12f0fe,function(_0x74ef1d,_0x3148f3,_0xaf44ea){logger[_0x8020('0x7')]('Exec\x20gs',_0x3148f3);if(_0x74ef1d){logger['info'](_0x8020('0x8'),'\x20Error\x20:',util[_0x8020('0x9')](_0x74ef1d,{'showHidden':![],'depth':null}),_0x3148f3,_0xaf44ea);_0x30c76c(_0x74ef1d);}_0x20264c(_0x3148f3);});});}; \ No newline at end of file +var _0x6695=['info','Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','child_process','exec','execute'];(function(_0x10d18b,_0x3e06c8){var _0x2c87ad=function(_0xa2aeed){while(--_0xa2aeed){_0x10d18b['push'](_0x10d18b['shift']());}};_0x2c87ad(++_0x3e06c8);}(_0x6695,0x1bc));var _0x5669=function(_0x17a064,_0x2f3b96){_0x17a064=_0x17a064-0x0;var _0x3300eb=_0x6695[_0x17a064];return _0x3300eb;};'use strict';var util=require(_0x5669('0x0'));var logger=require('../../../../config/logger')(_0x5669('0x1'));var BPromise=require(_0x5669('0x2'));var exec=require(_0x5669('0x3'))[_0x5669('0x4')];exports[_0x5669('0x5')]=function(_0x3b6e72){return new BPromise(function(_0x4c4bc2,_0x189ed4){exec(_0x3b6e72,function(_0x4a757f,_0x573be6,_0x3f9c23){logger[_0x5669('0x6')]('Exec\x20gs',_0x573be6);if(_0x4a757f){logger[_0x5669('0x6')](_0x5669('0x7'),_0x5669('0x8'),util[_0x5669('0x9')](_0x4a757f,{'showHidden':![],'depth':null}),_0x573be6,_0x3f9c23);_0x189ed4(_0x4a757f);}_0x4c4bc2(_0x573be6);});});}; \ 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 752e93f..3f94536 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 _0x11db=['t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway'];(function(_0x2f7700,_0x4d56fd){var _0x20eb69=function(_0x259f86){while(--_0x259f86){_0x2f7700['push'](_0x2f7700['shift']());}};_0x20eb69(++_0x4d56fd);}(_0x11db,0xd7));var _0xb11d=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0x11db[_0x419550];return _0x55f9ef;};'use strict';var util=require(_0xb11d('0x0'));var _=require(_0xb11d('0x1'));var moment=require('moment');var logger=require(_0xb11d('0x2'))(_0xb11d('0x3'));exports[_0xb11d('0x4')]=function(_0x36aea7){return{'message':_0x36aea7};};exports[_0xb11d('0x5')]=function(_0x352456,_0x34e9a0){logger['info'](_0x352456,util[_0xb11d('0x6')](_0x34e9a0,{'showHidden':![],'depth':null}));};exports[_0xb11d('0x7')]=function(_0x1645d7,_0x52801b){var _0x5ceb2a={'XMF-ECM':_0x52801b[_0xb11d('0x8')],'XMF-HEADERINFO':_0x52801b[_0xb11d('0x9')],'XMF-MINRATE':_0x52801b[_0xb11d('0xa')],'XMF-MAXRATE':_0x52801b['maxrate'],'XMF-MODEM':util[_0xb11d('0xb')](_0xb11d('0xc'),_0x52801b[_0xb11d('0xd')]),'XMF-GATEWAY':_0x52801b[_0xb11d('0xe')],'XMF-FAXDETECT':_0x52801b['faxdetect'],'XMF-T38TIMEOUT':_0x52801b[_0xb11d('0xf')],'XMF-LOCALSTATIONID':_0x52801b[_0xb11d('0x10')],'XMF-PATH':_0x1645d7[_0xb11d('0x11')]};return _0x5ceb2a;};exports['variablesAction']=function(_0x7734,_0x404f1c){return{'actionid':_0x7734[_0xb11d('0x12')],'action':'originate','channel':_0x7734[_0xb11d('0x13')],'Exten':_0xb11d('0x14'),'Context':_0xb11d('0x15'),'Priority':'1','callerid':util[_0xb11d('0xb')](_0xb11d('0x16'),_0x7734['headerinfo']?_0x7734[_0xb11d('0x9')]:'',_0x7734[_0xb11d('0x10')]),'variable':_0x404f1c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x7734[_0xb11d('0x12')]};}; \ No newline at end of file +var _0x9b8c=['message','logger','inspect','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','variablesAction','uniqueid','originate','channel','xcally-motion-fax','util','lodash','moment','../../../../config/logger'];(function(_0x58fda8,_0x4a1dcf){var _0x3fc8ce=function(_0x32f898){while(--_0x32f898){_0x58fda8['push'](_0x58fda8['shift']());}};_0x3fc8ce(++_0x4a1dcf);}(_0x9b8c,0x1df));var _0xc9b8=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x9b8c[_0x4c184d];return _0x23d997;};'use strict';var util=require(_0xc9b8('0x0'));var _=require(_0xc9b8('0x1'));var moment=require(_0xc9b8('0x2'));var logger=require(_0xc9b8('0x3'))('fax');exports[_0xc9b8('0x4')]=function(_0x2b51da){return{'message':_0x2b51da};};exports[_0xc9b8('0x5')]=function(_0x4c62ec,_0x5ad3ad){logger['info'](_0x4c62ec,util[_0xc9b8('0x6')](_0x5ad3ad,{'showHidden':![],'depth':null}));};exports[_0xc9b8('0x7')]=function(_0xc0b591,_0xb11de0){var _0xcc90b8={'XMF-ECM':_0xb11de0[_0xc9b8('0x8')],'XMF-HEADERINFO':_0xb11de0[_0xc9b8('0x9')],'XMF-MINRATE':_0xb11de0['minrate'],'XMF-MAXRATE':_0xb11de0[_0xc9b8('0xa')],'XMF-MODEM':util['format'](_0xc9b8('0xb'),_0xb11de0[_0xc9b8('0xc')]),'XMF-GATEWAY':_0xb11de0[_0xc9b8('0xd')],'XMF-FAXDETECT':_0xb11de0[_0xc9b8('0xe')],'XMF-T38TIMEOUT':_0xb11de0[_0xc9b8('0xf')],'XMF-LOCALSTATIONID':_0xb11de0['localstationid'],'XMF-PATH':_0xc0b591['path']};return _0xcc90b8;};exports[_0xc9b8('0x10')]=function(_0x2b72ea,_0xef39fc){return{'actionid':_0x2b72ea[_0xc9b8('0x11')],'action':_0xc9b8('0x12'),'channel':_0x2b72ea[_0xc9b8('0x13')],'Exten':_0xc9b8('0x14'),'Context':'from-sip','Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x2b72ea['headerinfo']?_0x2b72ea[_0xc9b8('0x9')]:'',_0x2b72ea['localstationid']),'variable':_0xef39fc,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2b72ea[_0xc9b8('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e0a9ae6..41b7eb9 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 _0x6756=['getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./report','./acw','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x47cde9,_0x19d013){var _0x26fdf1=function(_0x32fb69){while(--_0x32fb69){_0x47cde9['push'](_0x47cde9['shift']());}};_0x26fdf1(++_0x19d013);}(_0x6756,0x1a1));var _0x6675=function(_0x35c013,_0x456f78){_0x35c013=_0x35c013-0x0;var _0x3e1e17=_0x6756[_0x35c013];return _0x3e1e17;};'use strict';var BPromise=require(_0x6675('0x0'));var util=require(_0x6675('0x1'));var moment=require(_0x6675('0x2'));var server=require(_0x6675('0x3'));var Realtime=require('./realtime');var Report=require(_0x6675('0x4'));var Acw=require(_0x6675('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x6675('0x6'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x6675('0x7'));var voiceQueue=require(_0x6675('0x8'));var voiceQueueReport=require(_0x6675('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x6675('0xa'));var template=require(_0x6675('0xb'));var cmHopperHistory=require(_0x6675('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x6675('0xd'));var faxAccount=require(_0x6675('0xe'));var zendesk=require(_0x6675('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x6675('0x10'));var desk=require(_0x6675('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x6675('0x12'));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()[_0x6675('0x13')](_0x6675('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6675('0x13')](_0x6675('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6675('0x15')]()[_0x6675('0x16')](user[_0x6675('0x17')]())[_0x6675('0x16')](realtime[_0x6675('0x18')]())[_0x6675('0x16')](user['getTelephones']())[_0x6675('0x16')](realtime[_0x6675('0x19')]())[_0x6675('0x16')](trunk['getTrunks']())['then'](realtime[_0x6675('0x1a')]())[_0x6675('0x16')](voiceQueue[_0x6675('0x1b')]())[_0x6675('0x16')](realtime[_0x6675('0x1c')]())[_0x6675('0x16')](trigger['getTriggers']())[_0x6675('0x16')](realtime[_0x6675('0x1d')]())[_0x6675('0x16')](template[_0x6675('0x1e')]())['then'](realtime[_0x6675('0x1f')]())[_0x6675('0x16')](zendesk['getZendeskAccounts']())[_0x6675('0x16')](realtime[_0x6675('0x20')]())['then'](salesforce[_0x6675('0x21')]())[_0x6675('0x16')](realtime[_0x6675('0x22')]())[_0x6675('0x16')](sugarcrm[_0x6675('0x23')]())['then'](realtime[_0x6675('0x24')]())[_0x6675('0x16')](freshdesk[_0x6675('0x25')]())[_0x6675('0x16')](realtime[_0x6675('0x26')]())['then'](desk[_0x6675('0x27')]())[_0x6675('0x16')](realtime['initDeskAccounts']())['then'](zoho[_0x6675('0x28')]())[_0x6675('0x16')](realtime['initZohoAccounts']())[_0x6675('0x16')](vtiger[_0x6675('0x29')]())[_0x6675('0x16')](realtime[_0x6675('0x2a')]())[_0x6675('0x16')](campaign[_0x6675('0x2b')]())['then'](realtime[_0x6675('0x2c')]())['then'](voiceExtension[_0x6675('0x2d')]())[_0x6675('0x16')](realtime[_0x6675('0x2e')]())['then'](faxAccount[_0x6675('0x2f')]())[_0x6675('0x16')](realtime[_0x6675('0x30')]())[_0x6675('0x16')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x6675('0x16')](voiceQueueReport['getVoiceQueueReports']())[_0x6675('0x16')](realtime[_0x6675('0x31')]())[_0x6675('0x16')](cmHopperHistory[_0x6675('0x32')]())[_0x6675('0x16')](realtime[_0x6675('0x33')]())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0x6675('0x16')](voiceCallReport[_0x6675('0x34')]())['then'](realtime[_0x6675('0x35')]())[_0x6675('0x16')](function(_0x3624ad){})[_0x6675('0x36')](function(_0x901287){console[_0x6675('0x37')](_0x901287);});}function main(){return server[_0x6675('0x38')](realtime,preview,fax)[_0x6675('0x16')](function(_0x2bd0ec){return initRealtime();})[_0x6675('0x16')](function(){return initParams();})[_0x6675('0x16')](function(){report[_0x6675('0x39')]();setInterval(initRealtime,0x1388);})[_0x6675('0x36')](function(_0x139508){console[_0x6675('0x37')](_0x139508);});}main(); \ No newline at end of file +var _0xa9ae=['./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','get','hour','resolve','initAgents','then','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueueReport'];(function(_0x58c3ab,_0x3fa414){var _0x308f05=function(_0x1eecf3){while(--_0x1eecf3){_0x58c3ab['push'](_0x58c3ab['shift']());}};_0x308f05(++_0x3fa414);}(_0xa9ae,0x193));var _0xea9a=function(_0x5641b3,_0x5ef88f){_0x5641b3=_0x5641b3-0x0;var _0x2e96c1=_0xa9ae[_0x5641b3];return _0x2e96c1;};'use strict';var BPromise=require(_0xea9a('0x0'));var util=require(_0xea9a('0x1'));var moment=require(_0xea9a('0x2'));var server=require(_0xea9a('0x3'));var Realtime=require('./realtime');var Report=require(_0xea9a('0x4'));var Acw=require(_0xea9a('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xea9a('0x6'));var Preview=require(_0xea9a('0x7'));var Fax=require(_0xea9a('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xea9a('0x9'));var voiceCallReport=require(_0xea9a('0xa'));var trunk=require(_0xea9a('0xb'));var trigger=require(_0xea9a('0xc'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xea9a('0xd'));var zendesk=require(_0xea9a('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xea9a('0xf'));var desk=require(_0xea9a('0x10'));var zoho=require(_0xea9a('0x11'));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()[_0xea9a('0x12')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xea9a('0x12')](_0xea9a('0x13'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xea9a('0x14')]()['then'](user['getAgents']())['then'](realtime[_0xea9a('0x15')]())[_0xea9a('0x16')](user[_0xea9a('0x17')]())[_0xea9a('0x16')](realtime[_0xea9a('0x18')]())[_0xea9a('0x16')](trunk['getTrunks']())[_0xea9a('0x16')](realtime[_0xea9a('0x19')]())[_0xea9a('0x16')](voiceQueue[_0xea9a('0x1a')]())[_0xea9a('0x16')](realtime[_0xea9a('0x1b')]())[_0xea9a('0x16')](trigger['getTriggers']())[_0xea9a('0x16')](realtime[_0xea9a('0x1c')]())['then'](template[_0xea9a('0x1d')]())[_0xea9a('0x16')](realtime[_0xea9a('0x1e')]())['then'](zendesk[_0xea9a('0x1f')]())[_0xea9a('0x16')](realtime[_0xea9a('0x20')]())['then'](salesforce['getSalesforceAccounts']())[_0xea9a('0x16')](realtime[_0xea9a('0x21')]())['then'](sugarcrm[_0xea9a('0x22')]())[_0xea9a('0x16')](realtime[_0xea9a('0x23')]())['then'](freshdesk[_0xea9a('0x24')]())[_0xea9a('0x16')](realtime[_0xea9a('0x25')]())['then'](desk[_0xea9a('0x26')]())[_0xea9a('0x16')](realtime[_0xea9a('0x27')]())[_0xea9a('0x16')](zoho[_0xea9a('0x28')]())[_0xea9a('0x16')](realtime[_0xea9a('0x29')]())[_0xea9a('0x16')](vtiger[_0xea9a('0x2a')]())['then'](realtime[_0xea9a('0x2b')]())[_0xea9a('0x16')](campaign[_0xea9a('0x2c')]())[_0xea9a('0x16')](realtime['initCampaigns']())[_0xea9a('0x16')](voiceExtension[_0xea9a('0x2d')]())['then'](realtime[_0xea9a('0x2e')]())[_0xea9a('0x16')](faxAccount[_0xea9a('0x2f')]())['then'](realtime['initFaxAccounts']())[_0xea9a('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0xea9a('0x14')]()[_0xea9a('0x16')](voiceQueueReport[_0xea9a('0x30')]())['then'](realtime[_0xea9a('0x31')]())[_0xea9a('0x16')](cmHopperHistory[_0xea9a('0x32')]())[_0xea9a('0x16')](realtime['initVoiceQueueHopperHistory']())[_0xea9a('0x16')](cmHopperHistory[_0xea9a('0x33')]())[_0xea9a('0x16')](realtime[_0xea9a('0x34')]())[_0xea9a('0x16')](voiceCallReport[_0xea9a('0x35')]())[_0xea9a('0x16')](realtime[_0xea9a('0x36')]())[_0xea9a('0x16')](function(_0x3d7b3f){})[_0xea9a('0x37')](function(_0x4e9d72){console[_0xea9a('0x38')](_0x4e9d72);});}function main(){return server[_0xea9a('0x39')](realtime,preview,fax)[_0xea9a('0x16')](function(_0x39b80d){return initRealtime();})[_0xea9a('0x16')](function(){return initParams();})[_0xea9a('0x16')](function(){report[_0xea9a('0x3a')]();setInterval(initRealtime,0x1388);})[_0xea9a('0x37')](function(_0x4cf69d){console['log'](_0x4cf69d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 6803207..9bc29a7 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 _0x1520=['unknown','address','phone','mobile','online','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','voiceStatusTime','toNumber','format','voiceStatus','stringify','user:%s','emit','user:save','exports','lodash','util','moment','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x1520,0xc7));var _0x0152=function(_0x51bfc9,_0xa6e56c){_0x51bfc9=_0x51bfc9-0x0;var _0x4acdef=_0x1520[_0x51bfc9];return _0x4acdef;};'use strict';var _=require(_0x0152('0x0'));var util=require(_0x0152('0x1'));var moment=require(_0x0152('0x2'));var md5=require('md5');var io=require(_0x0152('0x3'))({'host':'localhost','port':0x18eb});function Agent(_0x3e391f){this['id']=_0x3e391f['id']||0x0;this[_0x0152('0x4')]=_0x3e391f[_0x0152('0x4')]||'';this[_0x0152('0x5')]=_0x3e391f[_0x0152('0x5')]||'';this[_0x0152('0x6')]=_0x3e391f[_0x0152('0x6')]||'';this[_0x0152('0x7')]=_0x3e391f[_0x0152('0x7')]||'';this[_0x0152('0x8')]='unknown';this[_0x0152('0x9')]=0x0;this[_0x0152('0xa')]=_0x0152('0xb');this[_0x0152('0xc')]='';this[_0x0152('0xd')]='';this[_0x0152('0xe')]='';this[_0x0152('0xf')]=_0x3e391f[_0x0152('0xf')]||![];this['voiceStatus']=_0x0152('0xb');this['voiceStatusTime']=0x0;this[_0x0152('0x10')]='';this[_0x0152('0x11')]='';this[_0x0152('0x12')]=![];this[_0x0152('0x13')]='';}Agent[_0x0152('0x14')][_0x0152('0x15')]=function(_0x1ff6cf){var _0x25d908;if(_0x1ff6cf&&_0x1ff6cf[_0x0152('0x8')]){_0x25d908=_0x1ff6cf['state']['toLowerCase']();switch(_0x25d908){case _0x0152('0x16'):_0x25d908='idle';break;case _0x0152('0x17'):_0x25d908=_0x0152('0x18');break;}}if(_0x25d908&&this['voiceStatus']!==_0x25d908||_0x1ff6cf[_0x0152('0x19')]){this[_0x0152('0x1a')]=_[_0x0152('0x1b')](moment()[_0x0152('0x1c')]('x'));}if(_0x25d908){this[_0x0152('0x1d')]=_0x25d908;}var _0x1d85c4={'id':this['id'],'name':this[_0x0152('0x4')],'email':this[_0x0152('0x5')],'accountcode':this[_0x0152('0x6')],'fullname':this[_0x0152('0x7')],'state':this[_0x0152('0x8')],'stateTime':this[_0x0152('0x9')],'status':this['status'],'address':this['address'],'online':this[_0x0152('0xf')],'voiceStatus':this[_0x0152('0x1d')],'voiceStatusTime':this[_0x0152('0x1a')],'voiceStatusCallerIdNumber':this[_0x0152('0x10')],'voiceStatusQueue':this[_0x0152('0x11')]};var _0x363373=md5(JSON[_0x0152('0x1e')](_0x1d85c4));if(this[_0x0152('0x13')]!==_0x363373){this[_0x0152('0x13')]=_0x363373;io['to'](util['format'](_0x0152('0x1f'),_0x1d85c4[_0x0152('0x4')]))[_0x0152('0x20')](_0x0152('0x21'),_0x1d85c4);}};module[_0x0152('0x22')]=Agent; \ No newline at end of file +var _0xd5d7=['stateTime','status','phone','online','voiceStatus','voiceStatusTime','voiceStatusQueue','local','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','statePause','format','voiceStatusCallerIdNumber','stringify','user:%s','user:save','exports','util','moment','md5','localhost','name','accountcode','fullname','state','unknown'];(function(_0x2139b1,_0x1318ad){var _0x13639b=function(_0x5bf590){while(--_0x5bf590){_0x2139b1['push'](_0x2139b1['shift']());}};_0x13639b(++_0x1318ad);}(_0xd5d7,0x136));var _0x7d5d=function(_0x454d61,_0x36ae92){_0x454d61=_0x454d61-0x0;var _0x48a1ec=_0xd5d7[_0x454d61];return _0x48a1ec;};'use strict';var _=require('lodash');var util=require(_0x7d5d('0x0'));var moment=require(_0x7d5d('0x1'));var md5=require(_0x7d5d('0x2'));var io=require('socket.io-emitter')({'host':_0x7d5d('0x3'),'port':0x18eb});function Agent(_0x939ed0){this['id']=_0x939ed0['id']||0x0;this[_0x7d5d('0x4')]=_0x939ed0[_0x7d5d('0x4')]||'';this['email']=_0x939ed0['email']||'';this[_0x7d5d('0x5')]=_0x939ed0[_0x7d5d('0x5')]||'';this[_0x7d5d('0x6')]=_0x939ed0['fullname']||'';this[_0x7d5d('0x7')]=_0x7d5d('0x8');this[_0x7d5d('0x9')]=0x0;this[_0x7d5d('0xa')]='unknown';this['address']='';this[_0x7d5d('0xb')]='';this['mobile']='';this[_0x7d5d('0xc')]=_0x939ed0[_0x7d5d('0xc')]||![];this[_0x7d5d('0xd')]=_0x7d5d('0x8');this[_0x7d5d('0xe')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x7d5d('0xf')]='';this[_0x7d5d('0x10')]=![];this['md5']='';}Agent['prototype'][_0x7d5d('0x11')]=function(_0x3ada6b){var _0x8f991d;if(_0x3ada6b&&_0x3ada6b['state']){_0x8f991d=_0x3ada6b[_0x7d5d('0x7')][_0x7d5d('0x12')]();switch(_0x8f991d){case _0x7d5d('0x13'):_0x8f991d=_0x7d5d('0x14');break;case'inuse':_0x8f991d=_0x7d5d('0x15');break;}}if(_0x8f991d&&this[_0x7d5d('0xd')]!==_0x8f991d||_0x3ada6b[_0x7d5d('0x16')]){this[_0x7d5d('0xe')]=_['toNumber'](moment()[_0x7d5d('0x17')]('x'));}if(_0x8f991d){this[_0x7d5d('0xd')]=_0x8f991d;}var _0x32b619={'id':this['id'],'name':this[_0x7d5d('0x4')],'email':this['email'],'accountcode':this[_0x7d5d('0x5')],'fullname':this['fullname'],'state':this[_0x7d5d('0x7')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x7d5d('0xc')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x7d5d('0x18')],'voiceStatusQueue':this[_0x7d5d('0xf')]};var _0x13eb8e=md5(JSON[_0x7d5d('0x19')](_0x32b619));if(this['md5']!==_0x13eb8e){this['md5']=_0x13eb8e;io['to'](util[_0x7d5d('0x17')](_0x7d5d('0x1a'),_0x32b619[_0x7d5d('0x4')]))['emit'](_0x7d5d('0x1b'),_0x32b619);}};module[_0x7d5d('0x1c')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5ea4e95..63db40b 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 _0x9d02=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive'];(function(_0x47c038,_0x1f7096){var _0x1e0f88=function(_0x6dd838){while(--_0x6dd838){_0x47c038['push'](_0x47c038['shift']());}};_0x1e0f88(++_0x1f7096);}(_0x9d02,0x118));var _0x29d0=function(_0x21f102,_0x4cf925){_0x21f102=_0x21f102-0x0;var _0x3553e1=_0x9d02[_0x21f102];return _0x3553e1;};'use strict';function Campaign(_0x5691da){this['id']=_0x5691da['id']||0x0;this['name']=_0x5691da[_0x29d0('0x0')]||'';this['type']=_0x5691da[_0x29d0('0x1')]||'campaign';this[_0x29d0('0x2')]=0x0;this[_0x29d0('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x29d0('0x4')]=0x0;this[_0x29d0('0x5')]='';this[_0x29d0('0x6')]=!![];this['active']=_0x5691da['active'];this['limitCalls']=_0x5691da[_0x29d0('0x7')];this[_0x29d0('0x8')]=_0x5691da['dialTimezone']||null;this[_0x29d0('0x9')]=_0x5691da[_0x29d0('0x9')]?_0x5691da['dialGlobalInterval']:null;this[_0x29d0('0xa')]=_0x5691da[_0x29d0('0xa')];this['dialOriginateCallerIdNumber']=_0x5691da[_0x29d0('0xb')];this[_0x29d0('0xc')]=_0x5691da[_0x29d0('0xc')]||0x1e;this[_0x29d0('0xd')]=_0x5691da['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x5691da[_0x29d0('0xe')];this[_0x29d0('0xf')]=_0x5691da[_0x29d0('0xf')];this[_0x29d0('0x10')]=_0x5691da[_0x29d0('0x10')];this[_0x29d0('0x11')]=_0x5691da[_0x29d0('0x11')];this[_0x29d0('0x12')]=_0x5691da[_0x29d0('0x12')];this['dialGlobalMaxRetry']=_0x5691da[_0x29d0('0x13')];this[_0x29d0('0x14')]=_0x5691da[_0x29d0('0x14')]||_0x29d0('0x15');this[_0x29d0('0x16')]=_0x5691da[_0x29d0('0x16')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5691da[_0x29d0('0x17')]||undefined;this[_0x29d0('0x18')]=_0x5691da[_0x29d0('0x18')]||undefined;this['TrunkBackup']=_0x5691da[_0x29d0('0x19')]?_0x5691da[_0x29d0('0x19')]:undefined;this[_0x29d0('0x1a')]=_0x5691da[_0x29d0('0x1a')]?_0x5691da[_0x29d0('0x1a')]:undefined;this[_0x29d0('0x1b')]=_0x5691da['Interval']?_0x5691da[_0x29d0('0x1b')]:undefined;this[_0x29d0('0x1c')]=_0x5691da[_0x29d0('0x1c')]?_0x5691da[_0x29d0('0x1c')]:undefined;this[_0x29d0('0x1d')]=_0x5691da[_0x29d0('0x1c')]?_0x5691da['SquareProject'][_0x29d0('0x0')]:undefined;this[_0x29d0('0x1e')]=_0x5691da[_0x29d0('0x1e')]||![];this['dialAMDInitialSilence']=_0x5691da[_0x29d0('0x1f')];this[_0x29d0('0x20')]=_0x5691da[_0x29d0('0x20')];this[_0x29d0('0x21')]=_0x5691da['dialAMDAfterGreetingSilence'];this[_0x29d0('0x22')]=_0x5691da[_0x29d0('0x22')];this[_0x29d0('0x23')]=_0x5691da['dialAMDMinWordLength'];this[_0x29d0('0x24')]=_0x5691da[_0x29d0('0x24')];this[_0x29d0('0x25')]=_0x5691da[_0x29d0('0x25')];this[_0x29d0('0x26')]=_0x5691da[_0x29d0('0x26')];this[_0x29d0('0x27')]=_0x5691da['dialAMDMaximumWordLength'];}module[_0x29d0('0x28')]=Campaign; \ No newline at end of file +var _0xee11=['originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0xee11,0x146));var _0x1ee1=function(_0x11a84d,_0x4dbd0e){_0x11a84d=_0x11a84d-0x0;var _0x1e6b48=_0xee11[_0x11a84d];return _0x1e6b48;};'use strict';function Campaign(_0x2613a6){this['id']=_0x2613a6['id']||0x0;this['name']=_0x2613a6['name']||'';this[_0x1ee1('0x0')]=_0x2613a6[_0x1ee1('0x0')]||_0x1ee1('0x1');this[_0x1ee1('0x2')]=0x0;this[_0x1ee1('0x3')]=0x0;this[_0x1ee1('0x4')]=0x0;this[_0x1ee1('0x5')]=0x0;this[_0x1ee1('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x1ee1('0x7')]=_0x2613a6[_0x1ee1('0x7')];this[_0x1ee1('0x8')]=_0x2613a6[_0x1ee1('0x8')];this[_0x1ee1('0x9')]=_0x2613a6['dialTimezone']||null;this['dialGlobalInterval']=_0x2613a6[_0x1ee1('0xa')]?_0x2613a6[_0x1ee1('0xa')]:null;this[_0x1ee1('0xb')]=_0x2613a6[_0x1ee1('0xb')];this['dialOriginateCallerIdNumber']=_0x2613a6[_0x1ee1('0xc')];this['dialOriginateTimeout']=_0x2613a6[_0x1ee1('0xd')]||0x1e;this[_0x1ee1('0xe')]=_0x2613a6[_0x1ee1('0xe')];this[_0x1ee1('0xf')]=_0x2613a6['dialCongestionRetryFrequency'];this[_0x1ee1('0x10')]=_0x2613a6[_0x1ee1('0x10')];this['dialBusyRetryFrequency']=_0x2613a6[_0x1ee1('0x11')];this[_0x1ee1('0x12')]=_0x2613a6[_0x1ee1('0x12')];this[_0x1ee1('0x13')]=_0x2613a6[_0x1ee1('0x13')];this[_0x1ee1('0x14')]=_0x2613a6[_0x1ee1('0x14')];this[_0x1ee1('0x15')]=_0x2613a6[_0x1ee1('0x15')]||_0x1ee1('0x16');this[_0x1ee1('0x17')]=_0x2613a6[_0x1ee1('0x17')]||undefined;this[_0x1ee1('0x18')]=_0x2613a6[_0x1ee1('0x18')]||undefined;this['dialCutDigit']=_0x2613a6['dialCutDigit']||undefined;this[_0x1ee1('0x19')]=_0x2613a6[_0x1ee1('0x19')]?_0x2613a6[_0x1ee1('0x19')]:undefined;this[_0x1ee1('0x1a')]=_0x2613a6[_0x1ee1('0x1a')]?_0x2613a6[_0x1ee1('0x1a')]:undefined;this['Interval']=_0x2613a6[_0x1ee1('0x1b')]?_0x2613a6[_0x1ee1('0x1b')]:undefined;this['SquareProject']=_0x2613a6[_0x1ee1('0x1c')]?_0x2613a6[_0x1ee1('0x1c')]:undefined;this['dialQueueProject']=_0x2613a6['SquareProject']?_0x2613a6[_0x1ee1('0x1c')][_0x1ee1('0x1d')]:undefined;this[_0x1ee1('0x1e')]=_0x2613a6[_0x1ee1('0x1e')]||![];this['dialAMDInitialSilence']=_0x2613a6[_0x1ee1('0x1f')];this[_0x1ee1('0x20')]=_0x2613a6[_0x1ee1('0x20')];this['dialAMDAfterGreetingSilence']=_0x2613a6[_0x1ee1('0x21')];this[_0x1ee1('0x22')]=_0x2613a6[_0x1ee1('0x22')];this[_0x1ee1('0x23')]=_0x2613a6[_0x1ee1('0x23')];this[_0x1ee1('0x24')]=_0x2613a6['dialAMDBetweenWordsSilence'];this[_0x1ee1('0x25')]=_0x2613a6['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x2613a6[_0x1ee1('0x26')];this[_0x1ee1('0x27')]=_0x2613a6['dialAMDMaximumWordLength'];}module[_0x1ee1('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 0ef29e2..004c4da 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 _0x44e8=['disposition','monitor','queue','mohtime','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','exten','answertime','endtime','unmanaged','lastapplication','billableseconds','type','tag'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x44e8,0x10e));var _0x844e=function(_0x3f59de,_0x510b7d){_0x3f59de=_0x3f59de-0x0;var _0x239fd9=_0x44e8[_0x3f59de];return _0x239fd9;};'use strict';function Channel(){this[_0x844e('0x0')]=null;this['channel']='';this[_0x844e('0x1')]='';this['calleridnum']=0x0;this[_0x844e('0x2')]='';this[_0x844e('0x3')]=undefined;this[_0x844e('0x4')]=undefined;this[_0x844e('0x5')]=0x0;this[_0x844e('0x6')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x844e('0x7')]=0x0;this['answered']=![];this[_0x844e('0x8')]=null;this[_0x844e('0x9')]=null;this[_0x844e('0xa')]=![];this[_0x844e('0xb')]='';this['lastdata']='';this['duration']=0x0;this[_0x844e('0xc')]=0x0;this['holdtime']=0x0;this[_0x844e('0xd')]=null;this[_0x844e('0xe')]=null;this[_0x844e('0xf')]=null;this[_0x844e('0x10')]=![];this['monitorFilename']=null;this[_0x844e('0x11')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x844e('0x12')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x29b6=['monitors','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answertime','endtime','unmanaged','lastapplication','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29b6,0x17e));var _0x629b=function(_0x2cf7e4,_0x1141bd){_0x2cf7e4=_0x2cf7e4-0x0;var _0x56578c=_0x29b6[_0x2cf7e4];return _0x56578c;};'use strict';function Channel(){this[_0x629b('0x0')]=null;this[_0x629b('0x1')]='';this[_0x629b('0x2')]='';this[_0x629b('0x3')]=0x0;this[_0x629b('0x4')]='';this[_0x629b('0x5')]=undefined;this[_0x629b('0x6')]=undefined;this[_0x629b('0x7')]=0x0;this[_0x629b('0x8')]='';this[_0x629b('0x9')]=0x0;this['linkedid']=0x0;this[_0x629b('0xa')]=0x0;this['answered']=![];this[_0x629b('0xb')]=null;this[_0x629b('0xc')]=null;this[_0x629b('0xd')]=![];this[_0x629b('0xe')]='';this['lastdata']='';this[_0x629b('0xf')]=0x0;this[_0x629b('0x10')]=0x0;this['holdtime']=0x0;this[_0x629b('0x11')]=null;this[_0x629b('0x12')]=null;this[_0x629b('0x13')]=null;this[_0x629b('0x14')]=![];this[_0x629b('0x15')]=null;this[_0x629b('0x16')]=null;this[_0x629b('0x17')]=[];this[_0x629b('0x18')]=undefined;this[_0x629b('0x19')]=undefined;this[_0x629b('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0272af1..4b0d9f0 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 _0x7f77=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x23c047,_0x3dca4e){var _0x581e4e=function(_0x499e46){while(--_0x499e46){_0x23c047['push'](_0x23c047['shift']());}};_0x581e4e(++_0x3dca4e);}(_0x7f77,0x98));var _0x77f7=function(_0x58c396,_0x3740c4){_0x58c396=_0x58c396-0x0;var _0x136585=_0x7f77[_0x58c396];return _0x136585;};'use strict';function DeskAccount(_0x172320){this['id']=_0x172320['id']||0x0;this[_0x77f7('0x0')]=_0x172320['name']||'';this[_0x77f7('0x1')]=_0x172320['username']||'';this[_0x77f7('0x2')]=_0x172320[_0x77f7('0x2')]||'';this['authType']=_0x172320[_0x77f7('0x3')]||'';this[_0x77f7('0x4')]=_0x172320[_0x77f7('0x4')]||'';this[_0x77f7('0x5')]=_0x172320[_0x77f7('0x5')]||'';this[_0x77f7('0x6')]=_0x172320['consumerSecret']||'';this['token']=_0x172320[_0x77f7('0x7')]||'';this[_0x77f7('0x8')]=_0x172320[_0x77f7('0x8')]||'';this['type']=_0x172320[_0x77f7('0x9')]||'';this[_0x77f7('0xa')]=_0x172320[_0x77f7('0xa')]||'';this['Configurations']=_0x172320[_0x77f7('0xb')]||{};}module[_0x77f7('0xc')]=DeskAccount; \ No newline at end of file +var _0x897b=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x897b,0xa8));var _0xb897=function(_0x4fab07,_0x1b6650){_0x4fab07=_0x4fab07-0x0;var _0x4281ab=_0x897b[_0x4fab07];return _0x4281ab;};'use strict';function DeskAccount(_0x38fc25){this['id']=_0x38fc25['id']||0x0;this[_0xb897('0x0')]=_0x38fc25['name']||'';this[_0xb897('0x1')]=_0x38fc25[_0xb897('0x1')]||'';this[_0xb897('0x2')]=_0x38fc25[_0xb897('0x2')]||'';this[_0xb897('0x3')]=_0x38fc25[_0xb897('0x3')]||'';this['password']=_0x38fc25[_0xb897('0x4')]||'';this[_0xb897('0x5')]=_0x38fc25[_0xb897('0x5')]||'';this[_0xb897('0x6')]=_0x38fc25[_0xb897('0x6')]||'';this['token']=_0x38fc25[_0xb897('0x7')]||'';this[_0xb897('0x8')]=_0x38fc25[_0xb897('0x8')]||'';this[_0xb897('0x9')]=_0x38fc25['type']||'';this['serverUrl']=_0x38fc25[_0xb897('0xa')]||'';this['Configurations']=_0x38fc25['Configurations']||{};}module[_0xb897('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 972adea..cbc7871 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 _0x0bb5=['v17,v27,v29','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x3023b6,_0xe2668c){var _0x20f4cb=function(_0x11abcd){while(--_0x11abcd){_0x3023b6['push'](_0x3023b6['shift']());}};_0x20f4cb(++_0xe2668c);}(_0x0bb5,0x148));var _0x50bb=function(_0x3ba42c,_0x4cce71){_0x3ba42c=_0x3ba42c-0x0;var _0x1ac367=_0x0bb5[_0x3ba42c];return _0x1ac367;};'use strict';function FaxAccount(_0x4878e5){this['id']=_0x4878e5['id']||0x0;this[_0x50bb('0x0')]=_0x4878e5['name']||'';this['description']=_0x4878e5[_0x50bb('0x1')];this[_0x50bb('0x2')]=_0x4878e5[_0x50bb('0x2')];this[_0x50bb('0x3')]=_0x4878e5[_0x50bb('0x3')];this[_0x50bb('0x4')]=_0x4878e5[_0x50bb('0x4')];this[_0x50bb('0x5')]=_0x4878e5['minrate']||0x960;this['maxrate']=_0x4878e5[_0x50bb('0x6')]||0x3840;this[_0x50bb('0x7')]=_0x4878e5[_0x50bb('0x7')]||_0x50bb('0x8');this['gateway']=_0x4878e5['gateway']||'no';this[_0x50bb('0x9')]=_0x4878e5[_0x50bb('0x9')]||'no';this[_0x50bb('0xa')]=_0x4878e5[_0x50bb('0xa')]||0x1388;this['tech']=_0x4878e5[_0x50bb('0xb')]||_0x50bb('0xc');this[_0x50bb('0xd')]=_0x4878e5[_0x50bb('0xd')]?_0x4878e5[_0x50bb('0xd')]:undefined;this[_0x50bb('0xe')]=_0x4878e5[_0x50bb('0xe')];this['key']=_0x4878e5[_0x50bb('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xd8b0=['ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';function FaxAccount(_0x5d04de){this['id']=_0x5d04de['id']||0x0;this[_0x0d8b('0x0')]=_0x5d04de['name']||'';this['description']=_0x5d04de['description'];this[_0x0d8b('0x1')]=_0x5d04de[_0x0d8b('0x1')];this[_0x0d8b('0x2')]=_0x5d04de[_0x0d8b('0x2')];this[_0x0d8b('0x3')]=_0x5d04de['localstationid'];this['minrate']=_0x5d04de[_0x0d8b('0x4')]||0x960;this[_0x0d8b('0x5')]=_0x5d04de[_0x0d8b('0x5')]||0x3840;this['modem']=_0x5d04de[_0x0d8b('0x6')]||_0x0d8b('0x7');this['gateway']=_0x5d04de[_0x0d8b('0x8')]||'no';this[_0x0d8b('0x9')]=_0x5d04de[_0x0d8b('0x9')]||'no';this[_0x0d8b('0xa')]=_0x5d04de[_0x0d8b('0xa')]||0x1388;this[_0x0d8b('0xb')]=_0x5d04de[_0x0d8b('0xb')]||_0x0d8b('0xc');this['Trunk']=_0x5d04de[_0x0d8b('0xd')]?_0x5d04de['Trunk']:undefined;this[_0x0d8b('0xe')]=_0x5d04de[_0x0d8b('0xe')];this[_0x0d8b('0xf')]=_0x5d04de[_0x0d8b('0xf')];}module[_0x0d8b('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 331457c..4788d83 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 _0xec23=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x57afd5,_0x257760){var _0x41d4cb=function(_0x1cac99){while(--_0x1cac99){_0x57afd5['push'](_0x57afd5['shift']());}};_0x41d4cb(++_0x257760);}(_0xec23,0x11e));var _0x3ec2=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0xec23[_0x5e9876];return _0x576c48;};'use strict';function FreshdeskAccount(_0x3a299f){this['id']=_0x3a299f['id']||0x0;this[_0x3ec2('0x0')]=_0x3a299f[_0x3ec2('0x0')]||'';this['username']=_0x3a299f['username']||'';this[_0x3ec2('0x1')]=_0x3a299f[_0x3ec2('0x2')]||'';this[_0x3ec2('0x3')]=_0x3a299f[_0x3ec2('0x3')]||'';this['serverUrl']=_0x3a299f[_0x3ec2('0x4')]||'';this[_0x3ec2('0x5')]=_0x3a299f['Configurations']||{};}module[_0x3ec2('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xfcf7=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2b6dc7,_0x590dc8){var _0x24c28a=function(_0x599830){while(--_0x599830){_0x2b6dc7['push'](_0x2b6dc7['shift']());}};_0x24c28a(++_0x590dc8);}(_0xfcf7,0x1d4));var _0x7fcf=function(_0x228e36,_0x42877c){_0x228e36=_0x228e36-0x0;var _0x40a1ee=_0xfcf7[_0x228e36];return _0x40a1ee;};'use strict';function FreshdeskAccount(_0x450dbd){this['id']=_0x450dbd['id']||0x0;this[_0x7fcf('0x0')]=_0x450dbd[_0x7fcf('0x0')]||'';this[_0x7fcf('0x1')]=_0x450dbd[_0x7fcf('0x1')]||'';this[_0x7fcf('0x2')]=_0x450dbd['token']||'';this[_0x7fcf('0x3')]=_0x450dbd['remoteUri']||'';this[_0x7fcf('0x4')]=_0x450dbd[_0x7fcf('0x4')]||'';this['Configurations']=_0x450dbd[_0x7fcf('0x5')]||{};}module[_0x7fcf('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index ccf6358..752e817 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 _0x3d93=['queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridnum','queue'];(function(_0x25282d,_0x59c9ff){var _0x40576a=function(_0x441f1a){while(--_0x441f1a){_0x25282d['push'](_0x25282d['shift']());}};_0x40576a(++_0x59c9ff);}(_0x3d93,0x74));var _0x33d9=function(_0x33bed3,_0x12f44e){_0x33bed3=_0x33bed3-0x0;var _0x5157b3=_0x3d93[_0x33bed3];return _0x5157b3;};'use strict';function QueueReport(){this['type']=_0x33d9('0x0');this[_0x33d9('0x1')]='';this[_0x33d9('0x2')]='';this['calleridname']='';this[_0x33d9('0x3')]='';this['queuecallerjoinAt']=null;this[_0x33d9('0x4')]=null;this['position']=0x1;this[_0x33d9('0x5')]=0x1;this[_0x33d9('0x6')]=![];this[_0x33d9('0x7')]=null;this[_0x33d9('0x8')]=![];this[_0x33d9('0x9')]=null;this[_0x33d9('0xa')]=![];this[_0x33d9('0xb')]=null;this[_0x33d9('0xc')]=0x1;this[_0x33d9('0xd')]='';this[_0x33d9('0xe')]='';this[_0x33d9('0xf')]='';this['accountcode']='';this[_0x33d9('0x10')]='';this['exten']='';this[_0x33d9('0x11')]='';this[_0x33d9('0x12')]=0x0;this[_0x33d9('0x13')]=![];this[_0x33d9('0x14')]='';this[_0x33d9('0x15')]=0x0;this[_0x33d9('0x16')]={};}module[_0x33d9('0x17')]=QueueReport; \ No newline at end of file +var _0xa2d9=['queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinename','accountcode','context','exten','holdtime','assigned','mohtime','variables','exports','inbound','uniqueid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa2d9,0x1cc));var _0x9a2d=function(_0x591498,_0x287ffb){_0x591498=_0x591498-0x0;var _0x78607c=_0xa2d9[_0x591498];return _0x78607c;};'use strict';function QueueReport(){this['type']=_0x9a2d('0x0');this[_0x9a2d('0x1')]='';this['calleridnum']='';this['calleridname']='';this[_0x9a2d('0x2')]='';this[_0x9a2d('0x3')]=null;this[_0x9a2d('0x4')]=null;this[_0x9a2d('0x5')]=0x1;this[_0x9a2d('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x9a2d('0x7')]=null;this[_0x9a2d('0x8')]=![];this[_0x9a2d('0x9')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x9a2d('0xa')]=0x1;this[_0x9a2d('0xb')]='';this['connectedlinenum']='';this[_0x9a2d('0xc')]='';this[_0x9a2d('0xd')]='';this[_0x9a2d('0xe')]='';this[_0x9a2d('0xf')]='';this['priority']='';this[_0x9a2d('0x10')]=0x0;this[_0x9a2d('0x11')]=![];this['lastAssignedTo']='';this[_0x9a2d('0x12')]=0x0;this[_0x9a2d('0x13')]={};}module[_0x9a2d('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 139d3e8..5ff33ed 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 _0xd2b6=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x46bc61,_0x45ad5e){var _0x3dbad9=function(_0x523cda){while(--_0x523cda){_0x46bc61['push'](_0x46bc61['shift']());}};_0x3dbad9(++_0x45ad5e);}(_0xd2b6,0x13a));var _0x6d2b=function(_0x1c1def,_0x3d466b){_0x1c1def=_0x1c1def-0x0;var _0x585bc9=_0xd2b6[_0x1c1def];return _0x585bc9;};'use strict';function SalesforceAccount(_0x522e47){this['id']=_0x522e47['id']||0x0;this[_0x6d2b('0x0')]=_0x522e47[_0x6d2b('0x0')]||'';this[_0x6d2b('0x1')]=_0x522e47['username']||'';this[_0x6d2b('0x2')]=_0x522e47['remoteUri']||'';this['password']=_0x522e47[_0x6d2b('0x3')]||'';this[_0x6d2b('0x4')]=_0x522e47[_0x6d2b('0x4')]||'';this[_0x6d2b('0x5')]=_0x522e47['clientSecret']||'';this[_0x6d2b('0x6')]=_0x522e47['securityToken']||'';this[_0x6d2b('0x7')]=_0x522e47['type']||_0x6d2b('0x8');this[_0x6d2b('0x9')]=_0x522e47[_0x6d2b('0x9')]||'';this[_0x6d2b('0xa')]=_0x522e47[_0x6d2b('0xa')]||{};}module[_0x6d2b('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x44d9=['Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x89f23f,_0x253bb1){var _0x34760f=function(_0x11e32a){while(--_0x11e32a){_0x89f23f['push'](_0x89f23f['shift']());}};_0x34760f(++_0x253bb1);}(_0x44d9,0x1c4));var _0x944d=function(_0x53938c,_0x57f377){_0x53938c=_0x53938c-0x0;var _0x4ac058=_0x44d9[_0x53938c];return _0x4ac058;};'use strict';function SalesforceAccount(_0x4661d1){this['id']=_0x4661d1['id']||0x0;this[_0x944d('0x0')]=_0x4661d1[_0x944d('0x0')]||'';this[_0x944d('0x1')]=_0x4661d1[_0x944d('0x1')]||'';this[_0x944d('0x2')]=_0x4661d1['remoteUri']||'';this[_0x944d('0x3')]=_0x4661d1[_0x944d('0x3')]||'';this[_0x944d('0x4')]=_0x4661d1[_0x944d('0x4')]||'';this[_0x944d('0x5')]=_0x4661d1['clientSecret']||'';this[_0x944d('0x6')]=_0x4661d1[_0x944d('0x6')]||'';this['type']=_0x4661d1[_0x944d('0x7')]||_0x944d('0x8');this[_0x944d('0x9')]=_0x4661d1[_0x944d('0x9')]||'';this['Configurations']=_0x4661d1[_0x944d('0xa')]||{};}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 a1657a2..4847a41 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 _0xb254=['serverUrl','Configurations','name','password','remoteUri'];(function(_0x1e5af2,_0x4c4709){var _0x14d767=function(_0x47f4e7){while(--_0x47f4e7){_0x1e5af2['push'](_0x1e5af2['shift']());}};_0x14d767(++_0x4c4709);}(_0xb254,0x151));var _0x4b25=function(_0x12a8f5,_0x4aeffe){_0x12a8f5=_0x12a8f5-0x0;var _0x5bcee5=_0xb254[_0x12a8f5];return _0x5bcee5;};'use strict';function SugarcrmAccount(_0x3edd71){this['id']=_0x3edd71['id']||0x0;this[_0x4b25('0x0')]=_0x3edd71[_0x4b25('0x0')]||'';this['username']=_0x3edd71['username']||'';this[_0x4b25('0x1')]=_0x3edd71['password']||'';this[_0x4b25('0x2')]=_0x3edd71[_0x4b25('0x2')]||'';this[_0x4b25('0x3')]=_0x3edd71[_0x4b25('0x3')]||'';this['Configurations']=_0x3edd71[_0x4b25('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x5935=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5935,0x6e));var _0x5593=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x5935[_0x2ae2ad];return _0x26dbd7;};'use strict';function SugarcrmAccount(_0xf7da3e){this['id']=_0xf7da3e['id']||0x0;this[_0x5593('0x0')]=_0xf7da3e[_0x5593('0x0')]||'';this[_0x5593('0x1')]=_0xf7da3e[_0x5593('0x1')]||'';this[_0x5593('0x2')]=_0xf7da3e[_0x5593('0x2')]||'';this[_0x5593('0x3')]=_0xf7da3e[_0x5593('0x3')]||'';this[_0x5593('0x4')]=_0xf7da3e['serverUrl']||'';this[_0x5593('0x5')]=_0xf7da3e[_0x5593('0x5')]||{};}module[_0x5593('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 d293e68..90efffa 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 _0xa113=['unknown','status','exports','name','state'];(function(_0x5d026d,_0x14f96){var _0x48fb71=function(_0x1394ca){while(--_0x1394ca){_0x5d026d['push'](_0x5d026d['shift']());}};_0x48fb71(++_0x14f96);}(_0xa113,0xa3));var _0x3a11=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa113[_0x1c546c];return _0x2cc384;};'use strict';function Telephone(_0x4f1e19){this['id']=_0x4f1e19['id']||0x0;this[_0x3a11('0x0')]=_0x4f1e19['name']||'';this[_0x3a11('0x1')]=_0x3a11('0x2');this['stateTime']=0x0;this[_0x3a11('0x3')]='unknown';this['address']='';}module[_0x3a11('0x4')]=Telephone; \ No newline at end of file +var _0x834e=['unknown','address','exports','name','state','stateTime','status'];(function(_0x4b90aa,_0x5a873d){var _0x14c0b5=function(_0xb30fa3){while(--_0xb30fa3){_0x4b90aa['push'](_0x4b90aa['shift']());}};_0x14c0b5(++_0x5a873d);}(_0x834e,0x168));var _0xe834=function(_0x3a3c3d,_0x3b8542){_0x3a3c3d=_0x3a3c3d-0x0;var _0xf3142f=_0x834e[_0x3a3c3d];return _0xf3142f;};'use strict';function Telephone(_0x2ff68b){this['id']=_0x2ff68b['id']||0x0;this[_0xe834('0x0')]=_0x2ff68b['name']||'';this[_0xe834('0x1')]='unknown';this[_0xe834('0x2')]=0x0;this[_0xe834('0x3')]=_0xe834('0x4');this[_0xe834('0x5')]='';}module[_0xe834('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 69f1c06..2048d61 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 _0x9c44=['exports','name','html'];(function(_0x46b057,_0x25aa56){var _0x25cf84=function(_0x324ba6){while(--_0x324ba6){_0x46b057['push'](_0x46b057['shift']());}};_0x25cf84(++_0x25aa56);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';function template(_0x2fa01d){this['id']=_0x2fa01d['id']||0x0;this['name']=_0x2fa01d[_0x49c4('0x0')]||'';this[_0x49c4('0x1')]=_0x2fa01d[_0x49c4('0x1')]||'';}module[_0x49c4('0x2')]=template; \ No newline at end of file +var _0x4fdb=['name','html','exports'];(function(_0x30da49,_0x4293a4){var _0x3fb26b=function(_0x36ee10){while(--_0x36ee10){_0x30da49['push'](_0x30da49['shift']());}};_0x3fb26b(++_0x4293a4);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x104874,_0xc6432a){_0x104874=_0x104874-0x0;var _0x26863b=_0x4fdb[_0x104874];return _0x26863b;};'use strict';function template(_0x2c8d00){this['id']=_0x2c8d00['id']||0x0;this[_0xb4fd('0x0')]=_0x2c8d00[_0xb4fd('0x0')]||'';this[_0xb4fd('0x1')]=_0x2c8d00[_0xb4fd('0x1')]||'';}module[_0xb4fd('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index cd5fc34..690a573 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 _0xbc26=['voice','status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x1cc6bc,_0x24f9b5){var _0x513e1d=function(_0x490180){while(--_0x490180){_0x1cc6bc['push'](_0x1cc6bc['shift']());}};_0x513e1d(++_0x24f9b5);}(_0xbc26,0x1d3));var _0x6bc2=function(_0x1e764c,_0x29277){_0x1e764c=_0x1e764c-0x0;var _0x41512d=_0xbc26[_0x1e764c];return _0x41512d;};'use strict';function Trigger(_0x46c7d9){this['id']=_0x46c7d9['id']||0x0;this[_0x6bc2('0x0')]=_0x46c7d9[_0x6bc2('0x0')]||'';this['channel']=_0x46c7d9[_0x6bc2('0x1')]||_0x6bc2('0x2');this[_0x6bc2('0x3')]=_0x46c7d9[_0x6bc2('0x3')]||![];this['AllConditions']=_0x46c7d9[_0x6bc2('0x4')]||[];this[_0x6bc2('0x5')]=_0x46c7d9[_0x6bc2('0x5')]||[];this[_0x6bc2('0x6')]=_0x46c7d9[_0x6bc2('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x091e=['voice','status','AllConditions','AnyConditions','name','channel'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x091e,0x154));var _0xe091=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x091e[_0x465028];return _0xb783d4;};'use strict';function Trigger(_0x389939){this['id']=_0x389939['id']||0x0;this['name']=_0x389939[_0xe091('0x0')]||'';this[_0xe091('0x1')]=_0x389939[_0xe091('0x1')]||_0xe091('0x2');this[_0xe091('0x3')]=_0x389939['status']||![];this['AllConditions']=_0x389939[_0xe091('0x4')]||[];this[_0xe091('0x5')]=_0x389939['AnyConditions']||[];this['Actions']=_0x389939['Actions']||[];}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 9bff482..094a439 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 _0x0c84=['port','domain','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown','stateTime','status','registry','indexOf'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0c84,0x188));var _0x40c8=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0c84[_0x13d07a];return _0x5ee0ee;};'use strict';function Trunk(_0x5447d3){this['id']=_0x5447d3['id']||0x0;this[_0x40c8('0x0')]=_0x5447d3[_0x40c8('0x0')]||![];this[_0x40c8('0x1')]=_0x5447d3[_0x40c8('0x1')]||'';this[_0x40c8('0x2')]=_0x40c8('0x3');this[_0x40c8('0x4')]=0x0;this[_0x40c8('0x5')]=_0x40c8('0x3');this[_0x40c8('0x6')]=_0x5447d3[_0x40c8('0x6')]&&_0x5447d3[_0x40c8('0x6')][_0x40c8('0x7')](':')?_0x5447d3[_0x40c8('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x40c8('0x8')]='';this[_0x40c8('0x9')]='';this[_0x40c8('0xa')]='';this[_0x40c8('0xb')]='';this[_0x40c8('0xc')]=_0x40c8('0x3');this[_0x40c8('0xd')]='';this[_0x40c8('0xe')]='';}module[_0x40c8('0xf')]=Trunk; \ No newline at end of file +var _0xfa2f=['refresh','stateRegistry','exports','active','name','state','unknown','status','registry','indexOf','host','port','domain','domainport'];(function(_0x3c8077,_0x5a492d){var _0x43db0b=function(_0x2a9f5c){while(--_0x2a9f5c){_0x3c8077['push'](_0x3c8077['shift']());}};_0x43db0b(++_0x5a492d);}(_0xfa2f,0xd5));var _0xffa2=function(_0x58d34b,_0x422006){_0x58d34b=_0x58d34b-0x0;var _0x2782ed=_0xfa2f[_0x58d34b];return _0x2782ed;};'use strict';function Trunk(_0x37ec4e){this['id']=_0x37ec4e['id']||0x0;this[_0xffa2('0x0')]=_0x37ec4e[_0xffa2('0x0')]||![];this[_0xffa2('0x1')]=_0x37ec4e[_0xffa2('0x1')]||'';this[_0xffa2('0x2')]=_0xffa2('0x3');this['stateTime']=0x0;this[_0xffa2('0x4')]='unknown';this[_0xffa2('0x5')]=_0x37ec4e[_0xffa2('0x5')]&&_0x37ec4e[_0xffa2('0x5')][_0xffa2('0x6')](':')?_0x37ec4e[_0xffa2('0x5')]['split'](':')[0x0]:'';this[_0xffa2('0x7')]='';this[_0xffa2('0x8')]='';this[_0xffa2('0x9')]='';this[_0xffa2('0xa')]='';this[_0xffa2('0xb')]='';this[_0xffa2('0xc')]=_0xffa2('0x3');this['registrationtime']='';this['address']='';}module[_0xffa2('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 20df443..2635be1 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 _0x54ef=['none','exports','exten','recordingFormat'];(function(_0x4fa738,_0x2a491c){var _0x55bf55=function(_0x185d53){while(--_0x185d53){_0x4fa738['push'](_0x4fa738['shift']());}};_0x55bf55(++_0x2a491c);}(_0x54ef,0x112));var _0xf54e=function(_0x4a398e,_0xf5d54f){_0x4a398e=_0x4a398e-0x0;var _0x37e864=_0x54ef[_0x4a398e];return _0x37e864;};'use strict';function voiceExtension(_0x19d4d5){this['id']=_0x19d4d5['id']||0x0;this[_0xf54e('0x0')]=_0x19d4d5[_0xf54e('0x0')]||'';this['recordingFormat']=_0x19d4d5[_0xf54e('0x1')]||_0xf54e('0x2');}module[_0xf54e('0x3')]=voiceExtension; \ No newline at end of file +var _0xaa88=['recordingFormat','none','exports','exten'];(function(_0x3c0db9,_0x56eca0){var _0x1c7e29=function(_0x408ff6){while(--_0x408ff6){_0x3c0db9['push'](_0x3c0db9['shift']());}};_0x1c7e29(++_0x56eca0);}(_0xaa88,0x137));var _0x8aa8=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0xaa88[_0x1f239e];return _0x826971;};'use strict';function voiceExtension(_0x2d8583){this['id']=_0x2d8583['id']||0x0;this[_0x8aa8('0x0')]=_0x2d8583[_0x8aa8('0x0')]||'';this[_0x8aa8('0x1')]=_0x2d8583['recordingFormat']||_0x8aa8('0x2');}module[_0x8aa8('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 9755b64..ba70e46 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 _0x481a=['dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalLowerLimit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','exports','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x481a,0xbb));var _0xa481=function(_0x4b766b,_0x4f9ebb){_0x4b766b=_0x4b766b-0x0;var _0x481890=_0x481a[_0x4b766b];return _0x481890;};'use strict';var statusDesc=[_0xa481('0x0'),_0xa481('0x1'),_0xa481('0x2'),_0xa481('0x3'),_0xa481('0x4'),'unavailable',_0xa481('0x5'),_0xa481('0x6'),_0xa481('0x7')];var monitorFormat={'wav':_0xa481('0x8'),'wav49':_0xa481('0x9'),'gsm':_0xa481('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xa481('0xb')};function VoiceQueue(_0xea134){this['id']=_0xea134['id']||0x0;this[_0xa481('0xc')]=_0xea134[_0xa481('0xc')]||'';this[_0xa481('0xd')]=_0xea134[_0xa481('0xd')]||'';this[_0xa481('0xe')]=_0xea134[_0xa481('0xe')]||'inbound';this[_0xa481('0xf')]=0x0;this[_0xa481('0x10')]=0x0;this[_0xa481('0x11')]=0x0;this['answered']=0x0;this[_0xa481('0x12')]=0x0;this[_0xa481('0x13')]=0x0;this[_0xa481('0x14')]=0x0;this[_0xa481('0x15')]=0x0;this[_0xa481('0x16')]=0x0;this[_0xa481('0x17')]=0x0;this[_0xa481('0x18')]=_0xea134[_0xa481('0x18')]||![];this[_0xa481('0x19')]=_0xea134['acwTimeout']||0xa;this[_0xa481('0x1a')]=_0xea134['autopause']||'no';this[_0xa481('0x1b')]=!![];this[_0xa481('0x1c')]='';this[_0xa481('0x1d')]=0x0;this[_0xa481('0x1e')]=0x0;this[_0xa481('0x1f')]=_0xea134['dialTimezone']||null;this['dialGlobalInterval']=_0xea134['dialGlobalInterval']?_0xea134[_0xa481('0x20')]:null;this[_0xa481('0x21')]=_0xea134[_0xa481('0x21')];this['dialMethod']=_0xea134[_0xa481('0x22')]||'progressive';this[_0xa481('0x23')]=_0xea134[_0xa481('0x23')]||0x0;this[_0xa481('0x24')]=_0xea134['dialLimitQueue']||0x0;this[_0xa481('0x25')]=_0xea134[_0xa481('0x25')]||0x1;this[_0xa481('0x26')]=_0xea134[_0xa481('0x26')]||'dropRate';this[_0xa481('0x27')]=_0xea134[_0xa481('0x27')]||0.03;this[_0xa481('0x28')]=_0xea134[_0xa481('0x28')]||0x258;this[_0xa481('0x29')]=_0xea134[_0xa481('0x29')]||'anonymous';this[_0xa481('0x2a')]=_0xea134[_0xa481('0x2a')]||_0xa481('0x2b');this[_0xa481('0x2c')]=_0xea134[_0xa481('0x2c')]||0x1e;this['dialQueueOptions']=_0xea134[_0xa481('0x2d')]||_0xa481('0x2e');this['dialQueueTimeout']=_0xea134[_0xa481('0x2f')]||0x3;this[_0xa481('0x30')]=_0xea134['dialQueueProject']||undefined;this[_0xa481('0x31')]=_0xea134[_0xa481('0x31')]||0x3;this[_0xa481('0x32')]=_0xea134[_0xa481('0x32')]||0x96;this['dialBusyMaxRetry']=_0xea134[_0xa481('0x33')]||0x3;this[_0xa481('0x34')]=_0xea134[_0xa481('0x34')]||0x96;this[_0xa481('0x35')]=_0xea134[_0xa481('0x35')]||0x3;this['dialNoAnswerRetryFrequency']=_0xea134[_0xa481('0x36')]||0x96;this[_0xa481('0x37')]=_0xea134[_0xa481('0x37')]||0x4;this[_0xa481('0x38')]=_0xea134['Trunk']?_0xea134[_0xa481('0x38')]:undefined;this['TrunkBackup']=_0xea134[_0xa481('0x39')]?_0xea134['TrunkBackup']:undefined;this[_0xa481('0x3a')]=_0xea134['dialPrefix']||undefined;this[_0xa481('0x3b')]=_0xea134['Interval']?_0xea134['Interval']:undefined;this[_0xa481('0x3c')]=_0xea134['dialOrderByScheduledAt']||_0xa481('0x3d');this[_0xa481('0x3e')]=_0xea134['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0xea134['dialCutDigit']||undefined;this[_0xa481('0x3f')]=strategy[_0xea134[_0xa481('0x3f')]]||_0xa481('0x40');this[_0xa481('0x41')]=!![];this['dialAMDActive']=_0xea134[_0xa481('0x42')]||![];this['dialAMDInitialSilence']=_0xea134[_0xa481('0x43')];this[_0xa481('0x44')]=_0xea134['dialAMDGreeting'];this[_0xa481('0x45')]=_0xea134[_0xa481('0x45')];this[_0xa481('0x46')]=_0xea134[_0xa481('0x46')];this[_0xa481('0x47')]=_0xea134[_0xa481('0x47')];this[_0xa481('0x48')]=_0xea134[_0xa481('0x48')];this['dialAMDMaximumNumberOfWords']=_0xea134[_0xa481('0x49')];this[_0xa481('0x4a')]=_0xea134[_0xa481('0x4a')];this[_0xa481('0x4b')]=_0xea134[_0xa481('0x4b')];this[_0xa481('0x4c')]=0x0;this[_0xa481('0x4d')]=0x0;this[_0xa481('0x4e')]=_0xea134[_0xa481('0x4e')];this['outboundAnswerCallsDay']=0x0;this[_0xa481('0x4f')]=0x0;this[_0xa481('0x50')]=0x0;this[_0xa481('0x51')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xa481('0x52')]=0x0;this[_0xa481('0x53')]=0x0;this[_0xa481('0x54')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xa481('0x55')]=0x0;this[_0xa481('0x56')]=0x0;this[_0xa481('0x57')]=0x0;this[_0xa481('0x58')]=0x0;this[_0xa481('0x59')]=undefined;this[_0xa481('0x5a')]=undefined;this['handlePredictive']=undefined;this[_0xa481('0x5b')]=1.05;this[_0xa481('0x5c')]=0x0;this[_0xa481('0x5d')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xa481('0x5e')]=0x0;this[_0xa481('0x5f')]=0x0;this[_0xa481('0x60')]=0x0;this[_0xa481('0x61')]=0.4;this[_0xa481('0x62')]=0x0;this[_0xa481('0x63')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xa481('0x64')]=0x0;this[_0xa481('0x65')]=0x0;this[_0xa481('0x66')]=0x0;this[_0xa481('0x67')]=0x0;this['dialRecallMeTimeout']=_0xea134['dialRecallMeTimeout']||0x1e;this[_0xa481('0x68')]=_0xea134[_0xa481('0x68')]||![];this[_0xa481('0x69')]=_0xea134[_0xa481('0x69')]||undefined;this[_0xa481('0x6a')]=_0xea134[_0xa481('0x6a')]||![];this[_0xa481('0x6b')]=_0xea134[_0xa481('0x6b')]||![];this[_0xa481('0xd')]=monitorFormat[_0xea134[_0xa481('0xd')]]?monitorFormat[_0xea134[_0xa481('0xd')]]:undefined;}module[_0xa481('0x6c')]=VoiceQueue; \ No newline at end of file +var _0xf97b=['dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangBusyFactor','dialRecallMeTimeout'];(function(_0x57e552,_0x1b855f){var _0x58199d=function(_0x251a7c){while(--_0x251a7c){_0x57e552['push'](_0x57e552['shift']());}};_0x58199d(++_0x1b855f);}(_0xf97b,0x19c));var _0xbf97=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf97b[_0x2be8c2];return _0x97f531;};'use strict';var statusDesc=[_0xbf97('0x0'),_0xbf97('0x1'),_0xbf97('0x2'),_0xbf97('0x3'),_0xbf97('0x4'),'unavailable',_0xbf97('0x5'),_0xbf97('0x6'),_0xbf97('0x7')];var monitorFormat={'wav':_0xbf97('0x8'),'wav49':_0xbf97('0x9'),'gsm':_0xbf97('0xa')};var strategy={'rrmemory':_0xbf97('0xb'),'roundrobin':_0xbf97('0xc')};function VoiceQueue(_0x6f9034){this['id']=_0x6f9034['id']||0x0;this[_0xbf97('0xd')]=_0x6f9034[_0xbf97('0xd')]||'';this[_0xbf97('0xe')]=_0x6f9034['monitor_format']||'';this[_0xbf97('0xf')]=_0x6f9034[_0xbf97('0xf')]||_0xbf97('0x10');this[_0xbf97('0x11')]=0x0;this[_0xbf97('0x12')]=0x0;this['total']=0x0;this[_0xbf97('0x13')]=0x0;this[_0xbf97('0x14')]=0x0;this['sumHoldTime']=0x0;this[_0xbf97('0x15')]=0x0;this[_0xbf97('0x16')]=0x0;this[_0xbf97('0x17')]=0x0;this[_0xbf97('0x18')]=0x0;this['acw']=_0x6f9034[_0xbf97('0x19')]||![];this[_0xbf97('0x1a')]=_0x6f9034['acwTimeout']||0xa;this['autopause']=_0x6f9034['autopause']||'no';this[_0xbf97('0x1b')]=!![];this[_0xbf97('0x1c')]='';this[_0xbf97('0x1d')]=0x0;this[_0xbf97('0x1e')]=0x0;this[_0xbf97('0x1f')]=_0x6f9034['dialTimezone']||null;this[_0xbf97('0x20')]=_0x6f9034[_0xbf97('0x20')]?_0x6f9034[_0xbf97('0x20')]:null;this[_0xbf97('0x21')]=_0x6f9034[_0xbf97('0x21')];this['dialMethod']=_0x6f9034[_0xbf97('0x22')]||'progressive';this[_0xbf97('0x23')]=_0x6f9034['dialLimitChannel']||0x0;this[_0xbf97('0x24')]=_0x6f9034['dialLimitQueue']||0x0;this[_0xbf97('0x25')]=_0x6f9034[_0xbf97('0x25')]||0x1;this[_0xbf97('0x26')]=_0x6f9034[_0xbf97('0x26')]||_0xbf97('0x27');this[_0xbf97('0x28')]=_0x6f9034[_0xbf97('0x28')]||0.03;this['dialPredictiveInterval']=_0x6f9034[_0xbf97('0x29')]||0x258;this[_0xbf97('0x2a')]=_0x6f9034[_0xbf97('0x2a')]||_0xbf97('0x2b');this[_0xbf97('0x2c')]=_0x6f9034['dialOriginateCallerIdNumber']||_0xbf97('0x2b');this[_0xbf97('0x2d')]=_0x6f9034[_0xbf97('0x2d')]||0x1e;this['dialQueueOptions']=_0x6f9034['dialQueueOptions']||_0xbf97('0x2e');this[_0xbf97('0x2f')]=_0x6f9034[_0xbf97('0x2f')]||0x3;this['dialQueueProject']=_0x6f9034[_0xbf97('0x30')]||undefined;this[_0xbf97('0x31')]=_0x6f9034[_0xbf97('0x31')]||0x3;this[_0xbf97('0x32')]=_0x6f9034[_0xbf97('0x32')]||0x96;this[_0xbf97('0x33')]=_0x6f9034[_0xbf97('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x6f9034[_0xbf97('0x34')]||0x96;this[_0xbf97('0x35')]=_0x6f9034[_0xbf97('0x35')]||0x3;this[_0xbf97('0x36')]=_0x6f9034['dialNoAnswerRetryFrequency']||0x96;this[_0xbf97('0x37')]=_0x6f9034['dialGlobalMaxRetry']||0x4;this[_0xbf97('0x38')]=_0x6f9034[_0xbf97('0x38')]?_0x6f9034[_0xbf97('0x38')]:undefined;this['TrunkBackup']=_0x6f9034[_0xbf97('0x39')]?_0x6f9034[_0xbf97('0x39')]:undefined;this['dialPrefix']=_0x6f9034[_0xbf97('0x3a')]||undefined;this[_0xbf97('0x3b')]=_0x6f9034[_0xbf97('0x3b')]?_0x6f9034['Interval']:undefined;this[_0xbf97('0x3c')]=_0x6f9034[_0xbf97('0x3c')]||'DESC';this[_0xbf97('0x3d')]=_0x6f9034[_0xbf97('0x3d')]||undefined;this[_0xbf97('0x3e')]=_0x6f9034[_0xbf97('0x3e')]||undefined;this[_0xbf97('0x3f')]=strategy[_0x6f9034[_0xbf97('0x3f')]]||_0xbf97('0xb');this[_0xbf97('0x40')]=!![];this['dialAMDActive']=_0x6f9034['dialAMDActive']||![];this[_0xbf97('0x41')]=_0x6f9034['dialAMDInitialSilence'];this[_0xbf97('0x42')]=_0x6f9034['dialAMDGreeting'];this[_0xbf97('0x43')]=_0x6f9034[_0xbf97('0x43')];this[_0xbf97('0x44')]=_0x6f9034[_0xbf97('0x44')];this[_0xbf97('0x45')]=_0x6f9034[_0xbf97('0x45')];this[_0xbf97('0x46')]=_0x6f9034['dialAMDBetweenWordsSilence'];this[_0xbf97('0x47')]=_0x6f9034[_0xbf97('0x47')];this[_0xbf97('0x48')]=_0x6f9034[_0xbf97('0x48')];this['dialAMDMaximumWordLength']=_0x6f9034[_0xbf97('0x49')];this[_0xbf97('0x4a')]=0x0;this['pTalking']=0x0;this[_0xbf97('0x4b')]=_0x6f9034[_0xbf97('0x4b')];this[_0xbf97('0x4c')]=0x0;this[_0xbf97('0x4d')]=0x0;this[_0xbf97('0x4e')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xbf97('0x4f')]=0x0;this[_0xbf97('0x50')]=0x0;this[_0xbf97('0x51')]=0x0;this[_0xbf97('0x52')]=0x0;this[_0xbf97('0x53')]=0x0;this[_0xbf97('0x54')]=0x0;this[_0xbf97('0x55')]=0x0;this[_0xbf97('0x56')]=0x0;this['outboundReCallsDay']=0x0;this[_0xbf97('0x57')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xbf97('0x58')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xbf97('0x59')]=0x0;this[_0xbf97('0x5a')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xbf97('0x5b')]=0x0;this[_0xbf97('0x5c')]=0x0;this['predictiveIntervalLowerLimit']=0.4;this[_0xbf97('0x5d')]=0x0;this[_0xbf97('0x5e')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xbf97('0x5f')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xbf97('0x60')]=0x0;this[_0xbf97('0x61')]=_0x6f9034[_0xbf97('0x61')]||0x1e;this['dialRecallInQueue']=_0x6f9034[_0xbf97('0x62')]||![];this[_0xbf97('0x63')]=_0x6f9034['dialQueueProject2']||undefined;this[_0xbf97('0x64')]=_0x6f9034[_0xbf97('0x64')]||![];this[_0xbf97('0x65')]=_0x6f9034[_0xbf97('0x65')]||![];this[_0xbf97('0xe')]=monitorFormat[_0x6f9034['monitor_format']]?monitorFormat[_0x6f9034[_0xbf97('0xe')]]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b92f1d4..278cb13 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 _0xadd6=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0xc811fd,_0x4d5d0d){var _0x4aadbf=function(_0x221639){while(--_0x221639){_0xc811fd['push'](_0xc811fd['shift']());}};_0x4aadbf(++_0x4d5d0d);}(_0xadd6,0x1e3));var _0x6add=function(_0x8d5844,_0x48eb67){_0x8d5844=_0x8d5844-0x0;var _0x56726c=_0xadd6[_0x8d5844];return _0x56726c;};'use strict';function VtigerAccount(_0x788f3){this['id']=_0x788f3['id']||0x0;this['name']=_0x788f3[_0x6add('0x0')]||'';this[_0x6add('0x1')]=_0x788f3[_0x6add('0x1')]||'';this[_0x6add('0x2')]=_0x788f3[_0x6add('0x2')]||'';this[_0x6add('0x3')]=_0x788f3['remoteUri']||'';this[_0x6add('0x4')]=_0x788f3[_0x6add('0x4')]||'';this[_0x6add('0x5')]=_0x788f3[_0x6add('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xb18a=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xb18a,0x146));var _0xab18=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xb18a[_0x54d4a8];return _0x3b321b;};'use strict';function VtigerAccount(_0x509cfe){this['id']=_0x509cfe['id']||0x0;this[_0xab18('0x0')]=_0x509cfe[_0xab18('0x0')]||'';this['username']=_0x509cfe[_0xab18('0x1')]||'';this[_0xab18('0x2')]=_0x509cfe[_0xab18('0x2')]||'';this[_0xab18('0x3')]=_0x509cfe[_0xab18('0x3')]||'';this[_0xab18('0x4')]=_0x509cfe[_0xab18('0x4')]||'';this[_0xab18('0x5')]=_0x509cfe[_0xab18('0x5')]||{};}module[_0xab18('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 169c43e..ae655ca 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 _0xdb51=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x717fa4,_0x177e5c){var _0x5d8910=function(_0x3aa0ec){while(--_0x3aa0ec){_0x717fa4['push'](_0x717fa4['shift']());}};_0x5d8910(++_0x177e5c);}(_0xdb51,0x15f));var _0x1db5=function(_0x5d9999,_0x3f0321){_0x5d9999=_0x5d9999-0x0;var _0x1d15ed=_0xdb51[_0x5d9999];return _0x1d15ed;};'use strict';function ZendeskAccount(_0xad9ee6){this['id']=_0xad9ee6['id']||0x0;this[_0x1db5('0x0')]=_0xad9ee6[_0x1db5('0x0')]||'';this[_0x1db5('0x1')]=_0xad9ee6[_0x1db5('0x1')]||'';this[_0x1db5('0x2')]=_0xad9ee6[_0x1db5('0x2')]||'';this[_0x1db5('0x3')]=_0xad9ee6[_0x1db5('0x3')]||'';this[_0x1db5('0x4')]=_0xad9ee6[_0x1db5('0x4')]||'';this[_0x1db5('0x5')]=_0xad9ee6[_0x1db5('0x5')]||'';this[_0x1db5('0x6')]=_0xad9ee6[_0x1db5('0x6')]||_0x1db5('0x7');this[_0x1db5('0x8')]=_0xad9ee6[_0x1db5('0x8')]||'';this['Configurations']=_0xad9ee6[_0x1db5('0x9')]||{};}module[_0x1db5('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x9649=['exports','name','username','password','token','remoteUri','type','integrationTab','serverUrl','Configurations'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0x9649,0xc9));var _0x9964=function(_0x1b146c,_0x5058ff){_0x1b146c=_0x1b146c-0x0;var _0x20e394=_0x9649[_0x1b146c];return _0x20e394;};'use strict';function ZendeskAccount(_0x3afa0c){this['id']=_0x3afa0c['id']||0x0;this['name']=_0x3afa0c[_0x9964('0x0')]||'';this[_0x9964('0x1')]=_0x3afa0c[_0x9964('0x1')]||'';this['password']=_0x3afa0c[_0x9964('0x2')]||'';this['token']=_0x3afa0c[_0x9964('0x3')]||'';this['remoteUri']=_0x3afa0c[_0x9964('0x4')]||'';this['authType']=_0x3afa0c['authType']||'';this[_0x9964('0x5')]=_0x3afa0c['type']||_0x9964('0x6');this['serverUrl']=_0x3afa0c[_0x9964('0x7')]||'';this[_0x9964('0x8')]=_0x3afa0c[_0x9964('0x8')]||{};}module[_0x9964('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 41a2ee9..15eb71f 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(_0x36092f,_0x52c9f2){var _0x23ec97=function(_0x49f498){while(--_0x49f498){_0x36092f['push'](_0x36092f['shift']());}};_0x23ec97(++_0x52c9f2);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'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 _0x2eb2=['name','authToken','host','Configurations','exports'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0x2eb2,0x19f));var _0x22eb=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2eb2[_0x6131cd];return _0x47e916;};'use strict';function ZohoAccount(_0x12836c){this['id']=_0x12836c['id']||0x0;this[_0x22eb('0x0')]=_0x12836c[_0x22eb('0x0')]||'';this[_0x22eb('0x1')]=_0x12836c[_0x22eb('0x1')]||'';this[_0x22eb('0x2')]=_0x12836c[_0x22eb('0x2')]||'';this['Configurations']=_0x12836c[_0x22eb('0x3')]||{};this['serverUrl']=_0x12836c['serverUrl']||'';}module[_0x22eb('0x4')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ae0a610..2ece96c 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 _0x2096=['format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent'];(function(_0x4f2885,_0x442ec1){var _0x2c82d2=function(_0x4ffc9c){while(--_0x4ffc9c){_0x4f2885['push'](_0x4f2885['shift']());}};_0x2c82d2(++_0x442ec1);}(_0x2096,0x6b));var _0x6209=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x2096[_0x2e4e19];return _0x9ba20b;};'use strict';var util=require(_0x6209('0x0'));var _=require(_0x6209('0x1'));var moment=require('moment');function checkNameSurname(_0x293be6,_0x69ac84,_0x412eea){var _0x424c69='';if(!_[_0x6209('0x2')](_0x69ac84)&&'string'===typeof _0x69ac84){_0x424c69+=_0x69ac84;}if(!_[_0x6209('0x2')](_0x412eea)&&_0x6209('0x3')===typeof _0x412eea){_0x424c69+='\x20'+_0x412eea;}if(_0x424c69!==''){return _0x424c69;}return _0x293be6;}function Action(_0x153a78,_0x5a791b,_0x333983,_0x507ad1,_0x2ea612){this[_0x6209('0x4')]=_0x333983||undefined;this[_0x6209('0x5')]=_0x153a78['id'];this['queue']=_0x5a791b[_0x6209('0x6')];this[_0x6209('0x7')]=_0x5a791b[_0x6209('0x7')];this[_0x6209('0x8')]=_0x6209('0x9');this[_0x6209('0xa')]=![];this[_0x6209('0xb')]=_[_0x6209('0x2')](_0x153a78[_0x6209('0xc')])?undefined:_0x153a78['Agent']['name'];this['channelAgent']=this['membername']?util[_0x6209('0xd')](_0x6209('0xe'),this[_0x6209('0xb')]):_0x507ad1||undefined;this[_0x6209('0xf')]=checkNameSurname(_0x153a78[_0x6209('0x10')][_0x6209('0x11')],_0x153a78[_0x6209('0x10')]['firstName'],_0x153a78['Contact'][_0x6209('0x12')]);this[_0x6209('0x13')]=_0x153a78['active']||![];this[_0x6209('0x14')]=_0x153a78['Contact'][_0x6209('0x11')];this[_0x6209('0x15')]=_0x153a78[_0x6209('0x15')];this[_0x6209('0x16')]=_0x153a78['countbusyretry']||0x0;this[_0x6209('0x17')]=_0x153a78['countcongestionretry']||0x0;this['countnoanswerretry']=_0x153a78[_0x6209('0x18')]||0x0;this[_0x6209('0x19')]=(_0x153a78[_0x6209('0x16')]||0x0)+(_0x153a78[_0x6209('0x17')]||0x0)+(_0x153a78['countnoanswerretry']||0x0);this[_0x6209('0x1a')]=_0x153a78[_0x6209('0x1a')];this[_0x6209('0x1b')]=_0x153a78[_0x6209('0x1b')];this[_0x6209('0x1c')]=_0x153a78[_0x6209('0x1c')];this[_0x6209('0x1d')]=_0x153a78[_0x6209('0x1d')];this[_0x6209('0x1e')]=_0x153a78['ContactId'];this[_0x6209('0x1f')]=_0x153a78[_0x6209('0x1f')];this[_0x6209('0x20')]=_[_0x6209('0x2')](_0x153a78[_0x6209('0xc')])?_0x153a78['UserId']:_0x153a78[_0x6209('0xc')]['id'];this['VoiceQueueId']=_0x153a78[_0x6209('0x21')];this[_0x6209('0x22')]='';this[_0x6209('0x23')]='';}Action[_0x6209('0x24')][_0x6209('0x25')]=function(){return util[_0x6209('0xd')](_0x6209('0x26'),this[_0x6209('0xf')],this[_0x6209('0x27')]);};module['exports']=Action; \ No newline at end of file +var _0x2590=['name','format','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','Agent','VoiceQueueId','originatecalleridnum','prototype','getCaller','number','exports','lodash','moment','isNil','string','uniqueid','idContact','type','campaigntype','queue','membername'];(function(_0x2070b6,_0x45c04d){var _0x10f5f7=function(_0x573058){while(--_0x573058){_0x2070b6['push'](_0x2070b6['shift']());}};_0x10f5f7(++_0x45c04d);}(_0x2590,0xce));var _0x0259=function(_0x1139d0,_0x5246ae){_0x1139d0=_0x1139d0-0x0;var _0x89961f=_0x2590[_0x1139d0];return _0x89961f;};'use strict';var util=require('util');var _=require(_0x0259('0x0'));var moment=require(_0x0259('0x1'));function checkNameSurname(_0x5845b5,_0x58cd1b,_0x1aad38){var _0x538dac='';if(!_[_0x0259('0x2')](_0x58cd1b)&&'string'===typeof _0x58cd1b){_0x538dac+=_0x58cd1b;}if(!_[_0x0259('0x2')](_0x1aad38)&&_0x0259('0x3')===typeof _0x1aad38){_0x538dac+='\x20'+_0x1aad38;}if(_0x538dac!==''){return _0x538dac;}return _0x5845b5;}function Action(_0x50b2db,_0x41bb3f,_0x2e9170,_0x4ed23d,_0x1c221e){this[_0x0259('0x4')]=_0x2e9170||undefined;this[_0x0259('0x5')]=_0x50b2db['id'];this['queue']=_0x41bb3f['name'];this[_0x0259('0x6')]=_0x41bb3f[_0x0259('0x6')];this[_0x0259('0x7')]=_0x0259('0x8');this['dialAnswer']=![];this[_0x0259('0x9')]=_[_0x0259('0x2')](_0x50b2db['Agent'])?undefined:_0x50b2db['Agent'][_0x0259('0xa')];this['channelAgent']=this[_0x0259('0x9')]?util[_0x0259('0xb')]('SIP/%s',this[_0x0259('0x9')]):_0x4ed23d||undefined;this[_0x0259('0xc')]=checkNameSurname(_0x50b2db[_0x0259('0xd')][_0x0259('0xe')],_0x50b2db['Contact']['firstName'],_0x50b2db['Contact'][_0x0259('0xf')]);this['active']=_0x50b2db[_0x0259('0x10')]||![];this[_0x0259('0x11')]=_0x50b2db['Contact']['phone'];this[_0x0259('0x12')]=_0x50b2db[_0x0259('0x12')];this[_0x0259('0x13')]=_0x50b2db[_0x0259('0x13')]||0x0;this[_0x0259('0x14')]=_0x50b2db[_0x0259('0x14')]||0x0;this[_0x0259('0x15')]=_0x50b2db['countnoanswerretry']||0x0;this[_0x0259('0x16')]=(_0x50b2db[_0x0259('0x13')]||0x0)+(_0x50b2db[_0x0259('0x14')]||0x0)+(_0x50b2db[_0x0259('0x15')]||0x0);this[_0x0259('0x17')]=_0x50b2db[_0x0259('0x17')];this[_0x0259('0x18')]=_0x50b2db[_0x0259('0x18')];this[_0x0259('0x19')]=_0x50b2db[_0x0259('0x19')];this[_0x0259('0x1a')]=_0x50b2db[_0x0259('0x1a')];this['ContactId']=_0x50b2db['ContactId'];this[_0x0259('0x1b')]=_0x50b2db[_0x0259('0x1b')];this[_0x0259('0x1c')]=_[_0x0259('0x2')](_0x50b2db[_0x0259('0x1d')])?_0x50b2db[_0x0259('0x1c')]:_0x50b2db['Agent']['id'];this[_0x0259('0x1e')]=_0x50b2db[_0x0259('0x1e')];this[_0x0259('0x1f')]='';this['originatecalleridname']='';}Action[_0x0259('0x20')][_0x0259('0x21')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x0259('0xc')],this[_0x0259('0x22')]);};module[_0x0259('0x23')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1868d21..5363b54 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 _0xb079=['addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','exports','util','lodash','bluebird','moment','md5','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','answered','available','sumDuration','talking','total','unmanaged','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','originated:\x20','stringify','queue','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','then','isNil','length','getDiff','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','complete','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','Busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','countbusyretry','unlockAgent','activeContact','NOANSWER','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','scheduledAt','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','AgentReject','idContact','disableContact','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','transfer','unlockContact','[syncHangup][talking][transfer]','destuniqueid'];(function(_0x52a481,_0x2b32d7){var _0x595997=function(_0x157221){while(--_0x157221){_0x52a481['push'](_0x52a481['shift']());}};_0x595997(++_0x2b32d7);}(_0xb079,0x133));var _0x9b07=function(_0x2ceb7b,_0x45e271){_0x2ceb7b=_0x2ceb7b-0x0;var _0x13ce71=_0xb079[_0x2ceb7b];return _0x13ce71;};'use strict';var util=require(_0x9b07('0x0'));var _=require(_0x9b07('0x1'));var BPromise=require(_0x9b07('0x2'));var uuid=require('uuid');var moment=require(_0x9b07('0x3'));var md5=require(_0x9b07('0x4'));var logger=require(_0x9b07('0x5'))(_0x9b07('0x6'));var loggerAction=require('../../../config/logger')(_0x9b07('0x7'));var ami=require(_0x9b07('0x8'));var rpcDb=require(_0x9b07('0x9'));var Action=require('./action');var ut=require(_0x9b07('0xa'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});var Sequence=function(){};Sequence[_0x9b07('0xb')][_0x9b07('0xc')]=function(_0x1fd218){this[_0x9b07('0xd')]=this[_0x9b07('0xd')]?this[_0x9b07('0xd')][_0x9b07('0xe')](_0x1fd218):_0x1fd218();};function Preview(_0x61c7d8){this['sequence']=new Sequence();this['campaignsPreview']=_0x61c7d8[_0x9b07('0xf')];this[_0x9b07('0x10')]=_0x61c7d8[_0x9b07('0x10')];this[_0x9b07('0x11')]={};this[_0x9b07('0x12')]=_0x61c7d8[_0x9b07('0x12')];this[_0x9b07('0x13')]=0x0;ami['on'](_0x9b07('0x14'),this['syncOriginateResponse'][_0x9b07('0x15')](this));ami['on']('hangup',this[_0x9b07('0x16')]['bind'](this));ami['on'](_0x9b07('0x17'),this[_0x9b07('0x18')][_0x9b07('0x15')](this));ami['on'](_0x9b07('0x19'),this[_0x9b07('0x1a')][_0x9b07('0x15')](this));ami['on'](_0x9b07('0x1b'),this[_0x9b07('0x1c')][_0x9b07('0x15')](this));ami['on'](_0x9b07('0x1d'),this[_0x9b07('0x1e')][_0x9b07('0x15')](this));ami['on']('attendedtransfer',this[_0x9b07('0x1f')][_0x9b07('0x15')](this));ami['on'](_0x9b07('0x20'),this['syncBlindTransfer']['bind'](this));this[_0x9b07('0x21')](this[_0x9b07('0x22')]);}function emit(_0x3d2780,_0x5df816,_0x160a35){io['to'](_0x3d2780)[_0x9b07('0x23')](_0x5df816,_0x160a35);}function emitCampaignPreview(_0xbf5f65){if(_0xbf5f65[_0x9b07('0x24')]===_0x9b07('0x25')){var _0x48c430={'id':_0xbf5f65['id'],'name':_0xbf5f65[_0x9b07('0x26')],'strategy':_0xbf5f65[_0x9b07('0x27')],'answered':_0xbf5f65[_0x9b07('0x28')],'available':_0xbf5f65[_0x9b07('0x29')],'loggedIn':_0xbf5f65['loggedIn'],'pTalking':_0xbf5f65['pTalking'],'sumBillable':_0xbf5f65['sumBillable'],'sumDuration':_0xbf5f65[_0x9b07('0x2a')],'sumHoldTime':_0xbf5f65['sumHoldTime']||0x0,'talking':_0xbf5f65[_0x9b07('0x2b')],'total':_0xbf5f65[_0x9b07('0x2c')],'type':_0xbf5f65[_0x9b07('0x24')],'unmanaged':_0xbf5f65[_0x9b07('0x2d')],'waiting':_0xbf5f65['waiting'],'loggedInDb':_0xbf5f65['loggedInDb'],'dialActive':_0xbf5f65['dialActive'],'dialMethod':_0xbf5f65[_0x9b07('0x2e')],'dialOriginateCallerIdName':_0xbf5f65[_0x9b07('0x2f')],'dialOriginateCallerIdNumber':_0xbf5f65[_0x9b07('0x30')],'dialOriginateTimeout':_0xbf5f65[_0x9b07('0x31')],'dialPrefix':_0xbf5f65[_0x9b07('0x32')],'outboundAnswerAgiCallsDay':_0xbf5f65['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0xbf5f65[_0x9b07('0x33')],'outboundBlacklistCallsDay':_0xbf5f65[_0x9b07('0x34')],'outboundBusyCallsDay':_0xbf5f65[_0x9b07('0x35')],'outboundCongestionCallsDay':_0xbf5f65['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xbf5f65['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0xbf5f65['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xbf5f65['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0xbf5f65[_0x9b07('0x36')],'outboundNoSuchCallsDay':_0xbf5f65[_0x9b07('0x37')],'outboundOriginateFailureCallsDay':_0xbf5f65[_0x9b07('0x38')],'outboundReCallsDay':_0xbf5f65['outboundReCallsDay'],'outboundRejectCallsDay':_0xbf5f65[_0x9b07('0x39')],'outboundUnknownCallsDay':_0xbf5f65[_0x9b07('0x3a')],'predictiveIntervalAnsweredCalls':_0xbf5f65['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xbf5f65['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0xbf5f65[_0x9b07('0x3b')],'predictiveIntervalDroppedCallsCallersExit':_0xbf5f65[_0x9b07('0x3c')],'predictiveIntervalDroppedCallsTimeout':_0xbf5f65[_0x9b07('0x3d')],'predictiveIntervalErlangCalls':_0xbf5f65[_0x9b07('0x3e')],'predictiveIntervalErlangCallsDroppedCalls':_0xbf5f65[_0x9b07('0x3f')],'predictiveIntervalHitRate':_0xbf5f65[_0x9b07('0x40')],'predictiveIntervalLowerLimit':_0xbf5f65[_0x9b07('0x41')],'predictiveIntervalMultiplicativeFactor':_0xbf5f65[_0x9b07('0x42')],'predictiveIntervalPauses':_0xbf5f65['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0xbf5f65[_0x9b07('0x43')],'message':_0xbf5f65[_0x9b07('0x44')],'originated':_0xbf5f65[_0x9b07('0x45')]};if(_0xbf5f65[_0x9b07('0x46')]){_0x48c430['Trunk']={'id':_0xbf5f65[_0x9b07('0x46')]['id'],'name':_0xbf5f65['Trunk'][_0x9b07('0x26')],'active':_0xbf5f65[_0x9b07('0x46')][_0x9b07('0x47')],'callerid':_0xbf5f65['Trunk'][_0x9b07('0x48')]};}if(_0xbf5f65[_0x9b07('0x49')]){_0x48c430[_0x9b07('0x49')]={'id':_0xbf5f65['Interval']['id'],'name':_0xbf5f65[_0x9b07('0x49')][_0x9b07('0x26')]};}var _0xefc512=md5(JSON['stringify'](_0x48c430));if(_0xbf5f65[_0x9b07('0x4')]!==_0xefc512){_0xbf5f65['md5']=_0xefc512;emit(util[_0x9b07('0x4a')](_0x9b07('0x4b'),_0x48c430['name']),_0x9b07('0x4c'),_0x48c430);}}}function emitVoiceQueueChannelRemove(_0x4d2595){emit(util['format'](_0x9b07('0x4b'),_0x4d2595[_0x9b07('0x26')]),_0x9b07('0x4d'),_0x4d2595);}function notSendMessagesQueue(_0x136e59){if(_0x136e59[_0x9b07('0x4e')]){if(_0x136e59[_0x9b07('0x45')]===0x0&&_0x136e59['pTalking']===0x0){_0x136e59[_0x9b07('0x4e')]=![];_0x136e59[_0x9b07('0x29')]=0x0;_0x136e59[_0x9b07('0x4f')]=0x0;_0x136e59[_0x9b07('0x44')]=_0x9b07('0x50');ut[_0x9b07('0x51')](_0x9b07('0x52'),_0x136e59[_0x9b07('0x26')]+'\x20is\x20not\x20active');}else{_0x136e59['message']=_0x9b07('0x53');ut[_0x9b07('0x51')](_0x9b07('0x52'),_0x136e59[_0x9b07('0x26')]+_0x9b07('0x54'));}emitCampaignPreview(_0x136e59);}}Preview[_0x9b07('0xb')][_0x9b07('0x21')]=function(){var _0x3e607e=this;setInterval(function(){_0x3e607e[_0x9b07('0x55')]();},0x7cf);};Preview[_0x9b07('0xb')][_0x9b07('0x55')]=function(){var _0x5ccc5=this[_0x9b07('0x22')];this[_0x9b07('0x13')]+=0x1;for(var _0x2219a9 in _0x5ccc5){if(_0x5ccc5[_0x9b07('0x56')](_0x2219a9)&&(_0x5ccc5[_0x2219a9][_0x9b07('0x2e')]===_0x9b07('0x6')||_0x5ccc5[_0x2219a9][_0x9b07('0x2e')]===_0x9b07('0x57'))&&_0x5ccc5[_0x2219a9][_0x9b07('0x24')]===_0x9b07('0x25')){if(this['clockClearZombieChannels']>0x7){this[_0x9b07('0x13')]=0x0;this[_0x9b07('0x58')]();}}if(_0x5ccc5[_0x9b07('0x56')](_0x2219a9)&&_0x5ccc5[_0x2219a9][_0x9b07('0x2e')]==='preview'&&_0x5ccc5[_0x2219a9][_0x9b07('0x24')]===_0x9b07('0x25')){if(_0x5ccc5[_0x2219a9][_0x9b07('0x59')]){this['setMessage'](_0x5ccc5[_0x2219a9]);this[_0x9b07('0x5a')](_0x5ccc5[_0x2219a9]);}else{notSendMessagesQueue(_0x5ccc5[_0x2219a9]);}}}};Preview[_0x9b07('0xb')][_0x9b07('0x5b')]=function(_0x567be1){var _0x49e1dc=this;this['sequence'][_0x9b07('0xc')](function(){if(!_['isNil'](_0x49e1dc[_0x9b07('0x11')][_0x567be1])){loggerAction[_0x9b07('0x5c')](_0x9b07('0x5d'),_0x567be1,'Queue',_0x49e1dc[_0x9b07('0x11')][_0x567be1]['queue'],_0x9b07('0x5e'),JSON[_0x9b07('0x5f')](_0x49e1dc[_0x9b07('0x22')][_0x49e1dc[_0x9b07('0x11')][_0x567be1][_0x9b07('0x60')]][_0x9b07('0x45')]),_0x9b07('0x61'),JSON[_0x9b07('0x5f')](_0x49e1dc[_0x9b07('0x22')][_0x49e1dc[_0x9b07('0x11')][_0x567be1][_0x9b07('0x60')]][_0x9b07('0x62')]),JSON[_0x9b07('0x5f')](_0x49e1dc[_0x9b07('0x11')][_0x567be1][_0x9b07('0x63')]),JSON['stringify'](_[_0x9b07('0x64')](_0x49e1dc[_0x9b07('0x11')][_0x567be1],[_0x9b07('0x65'),_0x9b07('0x66'),_0x9b07('0x67'),_0x9b07('0x68')])));return ami[_0x9b07('0x69')]({'action':_0x9b07('0x6a'),'channel':_0x49e1dc[_0x9b07('0x11')][_0x567be1][_0x9b07('0x6b')]})[_0x9b07('0x6c')](function(_0x23a3af){if(_0x23a3af[_0x9b07('0x44')]===_0x9b07('0x6d')){setTimeout(function(){if(_0x49e1dc[_0x9b07('0x11')][_0x567be1]){ut[_0x9b07('0x6e')](_0x49e1dc[_0x9b07('0x22')][_0x49e1dc[_0x9b07('0x11')][_0x567be1]['queue']],_0x9b07('0x6f'));if(_0x49e1dc[_0x9b07('0x11')][_0x567be1]['dialAnswer']===!![]){ut[_0x9b07('0x70')](_0x49e1dc[_0x9b07('0x22')][_0x49e1dc[_0x9b07('0x11')][_0x567be1][_0x9b07('0x60')]],'[clearZombieChannel]');ut[_0x9b07('0x71')](_0x9b07('0x72')+_0x567be1,_0x49e1dc[_0x9b07('0x11')][_0x567be1]['queue']);}ut[_0x9b07('0x71')](_0x9b07('0x73')+_0x567be1,_0x49e1dc[_0x9b07('0x11')][_0x567be1][_0x9b07('0x60')]);delete _0x49e1dc[_0x9b07('0x11')][_0x567be1];}},0x2328);}});}});};Preview['prototype'][_0x9b07('0x58')]=function(){var _0x5425c5=this;loggerAction[_0x9b07('0x5c')]('[action]',_[_0x9b07('0x74')](this[_0x9b07('0x11')]));for(var _0x4ff545 in this[_0x9b07('0x11')]){if(_0x5425c5['actions'][_0x9b07('0x56')](_0x4ff545)){_0x5425c5['clearZombieChannel'](_0x4ff545);}}};Preview[_0x9b07('0xb')]['recallMe']=function(_0x1a7ae8){var _0x1e68f0=this;rpcDb[_0x9b07('0x75')](_0x1a7ae8['id'],ut['agentReadyId'](this[_0x9b07('0x12')]))[_0x9b07('0x76')](function(_0x5ecb93){if(!_[_0x9b07('0x77')](_0x5ecb93)){for(var _0x19db19=0x0;_0x19db19<_0x5ecb93[_0x9b07('0x78')];_0x19db19+=0x1){if(ut[_0x9b07('0x79')](_0x5ecb93[_0x19db19]['scheduledat'])<_0x1a7ae8[_0x9b07('0x7a')]*0x3c){_0x1e68f0[_0x9b07('0x7b')](_0x5ecb93[_0x19db19]['id'])[_0x9b07('0x76')](ut[_0x9b07('0x7c')](_0x9b07('0x7d')))[_0x9b07('0x6c')](ut[_0x9b07('0x7c')]('[RecallMe]'));}else{var _0x5da08b=new Action(_0x5ecb93[_0x19db19],_0x1a7ae8);_0x5da08b[_0x9b07('0x7e')]=moment()[_0x9b07('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a7ae8[_0x9b07('0x7f')]+=0x1;ut[_0x9b07('0x80')](_0x5da08b,0x17,_0x9b07('0x81'));if(_0x1a7ae8[_0x9b07('0x82')]){rpcDb[_0x9b07('0x83')](ut[_0x9b07('0x84')](_0x5ecb93[_0x19db19]));rpcDb[_0x9b07('0x85')](_0x5da08b,_0x9b07('0x86'));}else{ut[_0x9b07('0x80')](_0x5da08b,0x16,_0x9b07('0x87'));rpcDb[_0x9b07('0x85')](_0x5da08b,_0x9b07('0x88'));rpcDb[_0x9b07('0x89')](_0x5da08b,_0x9b07('0x88'));}}}}})[_0x9b07('0x6c')](ut[_0x9b07('0x7c')]('[getContactRecallMe]'));};Preview[_0x9b07('0xb')]['setMessage']=function(_0x34de06){_0x34de06['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x34de06['loggedIn'])){_0x34de06[_0x9b07('0x44')]=_0x9b07('0x8a');}else if(!ut[_0x9b07('0x8b')](_0x34de06['dialActive'])){_0x34de06[_0x9b07('0x44')]=_0x9b07('0x50');}else if(!this['isTrunkReachable'](_0x34de06[_0x9b07('0x46')])){if(!this[_0x9b07('0x8c')](_0x34de06[_0x9b07('0x8d')])){_0x34de06[_0x9b07('0x44')]=_0x9b07('0x8e');}else{_0x34de06[_0x9b07('0x44')]=_0x9b07('0x8f');}}else{_0x34de06[_0x9b07('0x44')]=_0x9b07('0x8f');}emitCampaignPreview(_0x34de06);};Preview[_0x9b07('0xb')][_0x9b07('0x90')]=function(_0x5b0c01,_0x33b060,_0x4ad6c4){var _0x4b15af=this;var _0x413166=this[_0x9b07('0x11')][_0x33b060];var _0x8f1801=this[_0x9b07('0x22')][_0x413166['queue']];var _0x139767;if(_0x8f1801){switch(_0x4ad6c4){case'1':_0x8f1801[_0x9b07('0x37')]+=0x1;_0x413166['countglobal']=ut[_0x9b07('0x91')](_0x413166);ut[_0x9b07('0x80')](_0x413166,0x0,'NoSuchNumber');rpcDb[_0x9b07('0x85')](_0x413166,_0x9b07('0x92'));if(ut[_0x9b07('0x91')](_0x413166)>=_0x8f1801[_0x9b07('0x93')]){_0x139767=ut[_0x9b07('0x94')](_0x413166,0xf,'Global');rpcDb['createCustomerFinal'](_0x139767,_0x9b07('0x95'));}else{rpcDb[_0x9b07('0x89')](_0x413166,_0x9b07('0x95'));}delete this['actions'][_0x5b0c01[_0x9b07('0x96')]];break;case _0x9b07('0x97'):var _0x4b3e5f=moment()[_0x9b07('0x4a')](_0x9b07('0x98'));_0x413166[_0x9b07('0x99')]=_0x4b3e5f;_0x413166[_0x9b07('0x9a')]=_0x4b3e5f;_0x413166[_0x9b07('0x63')]=!![];_0x8f1801['pTalking']+=0x1;logger[_0x9b07('0x5c')](_0x9b07('0x9b'),_0x413166[_0x9b07('0x9c')],'\x20Queue',_0x8f1801[_0x9b07('0x26')],_0x9b07('0x61'),_0x8f1801[_0x9b07('0x62')]);ami['emit'](_0x9b07('0x9d'),ut[_0x9b07('0x9e')](_0x413166,'connect'));if(_0x8f1801[_0x9b07('0x9f')]){ami[_0x9b07('0x23')](_0x9b07('0xa0'),ut['buildAcw'](_0x413166));}break;case'16':ami[_0x9b07('0x23')]('custom:agentcomplete',ut[_0x9b07('0x9e')](_0x413166,_0x9b07('0xa1')));emitVoiceQueueChannelRemove(ut[_0x9b07('0x9e')](_0x413166,_0x9b07('0xa1')));_0x8f1801[_0x9b07('0x33')]+=0x1;_0x8f1801[_0x9b07('0x2c')]+=0x1;_0x8f1801[_0x9b07('0x28')]+=0x1;ut[_0x9b07('0x70')](_0x8f1801,'[16]');_0x413166[_0x9b07('0xa2')]=ut['totalGlobal'](_0x413166);ut[_0x9b07('0x80')](_0x413166,0x4,_0x9b07('0xa3'));rpcDb[_0x9b07('0x85')](_0x413166,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x9b07('0x89')](_0x413166,_0x9b07('0xa4'));rpcDb[_0x9b07('0xa5')](_0x413166);_0x8f1801[_0x9b07('0x2a')]+=_0x413166[_0x9b07('0xa6')];_0x8f1801['sumBillable']+=_0x413166[_0x9b07('0xa6')];logger[_0x9b07('0x5c')](_0x9b07('0xa7'),_0x413166[_0x9b07('0x9c')],'\x20Queue',_0x8f1801[_0x9b07('0x26')],_0x9b07('0x61'),_0x8f1801['pTalking']);delete this[_0x9b07('0x11')][_0x5b0c01[_0x9b07('0x96')]];break;case _0x9b07('0xa8'):_0x8f1801['outboundBusyCallsDay']+=0x1;_0x413166['countbusyretry']+=0x1;_0x413166[_0x9b07('0xa2')]=ut[_0x9b07('0x91')](_0x413166);ut[_0x9b07('0x80')](_0x413166,0x5,_0x9b07('0xa9'));rpcDb[_0x9b07('0x85')](_0x413166,_0x9b07('0xaa'));if(ut[_0x9b07('0x91')](_0x413166)>=_0x8f1801[_0x9b07('0x93')]){_0x139767=ut[_0x9b07('0x94')](_0x413166,0xf,_0x9b07('0xab'));rpcDb[_0x9b07('0x89')](_0x139767,_0x9b07('0xac'));}else{if(_0x413166['countbusyretry']>=_0x8f1801[_0x9b07('0xad')]){rpcDb[_0x9b07('0x89')](_0x413166,_0x9b07('0xaa'));}else{rpcDb[_0x9b07('0xae')](ut['scheduledAt'](_0x413166,_0x9b07('0xaf'),_0x8f1801['dialBusyRetryFrequency']),_0x413166[_0x9b07('0xb0')],_0x413166[_0x9b07('0xb1')]);}}break;case _0x9b07('0xb2'):_0x8f1801[_0x9b07('0x36')]+=0x1;_0x413166[_0x9b07('0xb3')]+=0x1;_0x413166[_0x9b07('0xa2')]=ut[_0x9b07('0x91')](_0x413166);ut['logCustomer'](_0x413166,0x3,'NoAnswer');rpcDb[_0x9b07('0x85')](_0x413166,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x9b07('0x91')](_0x413166)>=_0x8f1801[_0x9b07('0x93')]){_0x139767=ut[_0x9b07('0x94')](_0x413166,0xf,_0x9b07('0xab'));rpcDb['createCustomerFinal'](_0x139767,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x413166[_0x9b07('0xb3')]>=_0x8f1801[_0x9b07('0xb4')]){rpcDb[_0x9b07('0x89')](_0x413166,_0x9b07('0xb5'));}else{rpcDb[_0x9b07('0xae')](ut[_0x9b07('0xb6')](_0x413166,'countnoanswerretry',_0x8f1801[_0x9b07('0xb7')]),_0x413166[_0x9b07('0xb0')],_0x413166[_0x9b07('0xb1')]);}}break;case _0x9b07('0xb8'):_0x8f1801[_0x9b07('0xb9')]+=0x1;_0x413166[_0x9b07('0xba')]+=0x1;_0x413166[_0x9b07('0xa2')]=ut['totalGlobal'](_0x413166);ut[_0x9b07('0x80')](_0x413166,0x8,'Congestion');rpcDb['createCustomerHistory'](_0x413166,_0x9b07('0xbb'));if(ut[_0x9b07('0x91')](_0x413166)>=_0x8f1801['dialGlobalMaxRetry']){_0x139767=ut['cloneAction'](_0x413166,0xf,_0x9b07('0xab'));rpcDb[_0x9b07('0x89')](_0x139767,_0x9b07('0xbc'));}else{if(_0x413166['countcongestionretry']>=_0x8f1801['dialCongestionMaxRetry']){rpcDb[_0x9b07('0x89')](_0x413166,_0x9b07('0xbb'));}else{rpcDb[_0x9b07('0xae')](ut[_0x9b07('0xb6')](_0x413166,_0x9b07('0xba'),_0x8f1801['dialBusyRetryFrequency']),_0x413166[_0x9b07('0xb0')],_0x413166['activeContact']);}}break;case _0x9b07('0xbd'):_0x8f1801[_0x9b07('0x39')]+=0x1;_0x413166[_0x9b07('0xa2')]=ut['totalGlobal'](_0x413166);ut[_0x9b07('0x80')](_0x413166,0x14,_0x9b07('0xbe'));rpcDb[_0x9b07('0x85')](_0x413166,'[syncHangupRequest][logAgentReject]');if(_0x413166['unlockAgent']){rpcDb['unlockContact'](_0x413166[_0x9b07('0xbf')]);}if(_0x413166[_0x9b07('0xb1')]){rpcDb[_0x9b07('0xc0')](_0x413166[_0x9b07('0xbf')]);}break;default:if(_0x413166[_0x9b07('0x63')]){ut[_0x9b07('0x70')](_0x8f1801,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x8f1801[_0x9b07('0x26')],_0x5b0c01);}_0x8f1801[_0x9b07('0x3a')]+=0x1;_0x413166[_0x9b07('0xa2')]=ut[_0x9b07('0x91')](_0x413166);ut[_0x9b07('0x80')](_0x413166,0xc,_0x5b0c01[_0x9b07('0xc1')]||_0x5b0c01[_0x9b07('0xc2')]);rpcDb[_0x9b07('0x85')](_0x413166,_0x9b07('0xc3'));if(ut['totalGlobal'](_0x413166)>=_0x8f1801[_0x9b07('0x93')]){_0x139767=ut[_0x9b07('0x94')](_0x413166,0xf,'Global');rpcDb[_0x9b07('0x89')](_0x139767,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x9b07('0x89')](_0x413166,_0x9b07('0xc4'));}delete this[_0x9b07('0x11')][_0x5b0c01[_0x9b07('0x96')]];}if(!(_0x413166[_0x9b07('0x63')]&&_0x4ad6c4==='16')){ut[_0x9b07('0x6e')](_0x8f1801,_0x9b07('0xc5'));logger[_0x9b07('0x5c')](_0x9b07('0xc6'),_0x413166[_0x9b07('0x9c')],_0x9b07('0xc7'),_0x8f1801[_0x9b07('0x26')],'originated:\x20',_0x8f1801['originated']);}if(_0x4ad6c4!==_0x9b07('0x97')){delete this[_0x9b07('0x11')][_0x5b0c01[_0x9b07('0x96')]];delete this['actions'][_0x5b0c01[_0x9b07('0xc8')]];}}};Preview[_0x9b07('0xb')][_0x9b07('0xc9')]=function(_0xd3f53d,_0x519a8a,_0x37c537){if(_[_0x9b07('0xca')](_0x519a8a)&&_0x9b07('0xcb')!==typeof _0x519a8a){return;}if(_['isUndefined'](_0x37c537)&&'object'!==typeof _0x37c537){return;}switch(_0x37c537[_0x9b07('0xcc')]){case'0':ut[_0x9b07('0xcd')](_0xd3f53d,0x0,_0x9b07('0xce'));rpcDb[_0x9b07('0xcf')](_0xd3f53d,_0x9b07('0xd0'));break;case'3':ut[_0x9b07('0xcd')](_0xd3f53d,0x3,'NoAnswer');rpcDb[_0x9b07('0xcf')](_0xd3f53d,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x9b07('0xcd')](_0xd3f53d,0x5,'Busy');rpcDb[_0x9b07('0xcf')](_0xd3f53d,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x9b07('0xcd')](_0xd3f53d,0x8,_0x9b07('0xd1'));rpcDb[_0x9b07('0xcf')](_0xd3f53d,_0x9b07('0xd2'));break;case'22':ut[_0x9b07('0xcd')](_0xd3f53d,0x16,_0x9b07('0xd3'));rpcDb[_0x9b07('0xcf')](_0xd3f53d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x9b07('0xcd')](_0xd3f53d,0xc,_0x37c537[_0x9b07('0xcc')]);rpcDb[_0x9b07('0xcf')](_0xd3f53d,_0x9b07('0xd2'));}ut['updateOriginated'](_0x519a8a,_0x9b07('0xd4'));logger[_0x9b07('0x5c')]('[originated][decrement][callProgressDetectingAgent]',_0xd3f53d[_0x9b07('0x9c')],_0x9b07('0xc7'),_0x519a8a['name'],_0x9b07('0x5e'),_0x519a8a[_0x9b07('0x45')]);delete this[_0x9b07('0x11')][_0xd3f53d[_0x9b07('0x9c')]];};Preview[_0x9b07('0xb')][_0x9b07('0xd5')]=function(_0x43bebd,_0x577bdf,_0x425e22,_0x2c29b2,_0x24edaf){var _0x5c8483=this;return new BPromise(function(_0x3e36a3,_0x160358){if(_['isNil'](_0x577bdf)||_[_0x9b07('0x77')](_0x577bdf[_0x9b07('0xd6')])||_['isNil'](_0x577bdf['Contact'][_0x9b07('0xd7')])||_['isNil'](_0x577bdf['VoiceQueueId'])){_0x160358(ut[_0x9b07('0x44')]('Contact\x20is\x20undefined',_0x2c29b2,_0x24edaf));return;}var _0x215f46=uuid['v4']();var _0x27a1af=_0x5c8483[_0x9b07('0x22')][_0x577bdf[_0x9b07('0xd8')][_0x9b07('0x26')]];var _0x19059f=_0x425e22?_0x5c8483[_0x9b07('0x12')][_0x425e22]['id']:undefined;_0x5c8483['actions'][_0x215f46]=new Action(_0x577bdf,_0x27a1af,_0x215f46,_0x425e22,_0x19059f);var _0x4aad94=_0x5c8483[_0x9b07('0x11')][_0x215f46];_0x4aad94[_0x9b07('0xb0')]=_0x2c29b2;_0x4aad94[_0x9b07('0xb1')]=_0x24edaf;_0x4aad94[_0x9b07('0xd9')]=_0x425e22;if(_[_0x9b07('0xda')](_0x43bebd)){_0x5c8483[_0x9b07('0xdb')](_0x4aad94,_0x27a1af,_0x577bdf,_0x425e22)[_0x9b07('0x76')](function(_0x28756f){logger[_0x9b07('0x5c')](_0x9b07('0xdc'),_0x9b07('0xdd')+_0x4aad94['queue']+_0x9b07('0xde')+_0x4aad94[_0x9b07('0xbf')],JSON[_0x9b07('0x5f')](_0x28756f));ami[_0x9b07('0x23')](_0x9b07('0xdf'),ut[_0x9b07('0x9e')](_0x4aad94,'called'));_0x3e36a3(ut[_0x9b07('0x44')](_0x9b07('0xe0')));})[_0x9b07('0x6c')](function(_0x57aaa2){ut['logger'](_0x9b07('0xe1'),_0x57aaa2);_0x160358(ut[_0x9b07('0x44')](_0x9b07('0xe2'),_0x2c29b2,_0x24edaf));});}else{_0x27a1af[_0x9b07('0x34')]+=0x1;ut['logBlacklist'](_0x4aad94);rpcDb[_0x9b07('0xe3')](_0x4aad94,'[Blacklist][error]');delete _0x5c8483[_0x9b07('0x11')][_0x215f46];_0x160358(ut[_0x9b07('0x44')](_0x9b07('0xe4'),_0x2c29b2,_0x24edaf));}});};Preview[_0x9b07('0xb')]['isTrunkReachable']=function(_0x4d630f){return!_[_0x9b07('0x77')](_0x4d630f)&&!_['isNil'](_0x4d630f[_0x9b07('0x26')])&&!_['isNil'](_0x4d630f[_0x9b07('0x47')])&&_0x4d630f[_0x9b07('0x47')]&&!_[_0x9b07('0x77')](this[_0x9b07('0x10')][util[_0x9b07('0x4a')]('SIP/%s',_0x4d630f[_0x9b07('0x26')])])&&!_[_0x9b07('0x77')](this[_0x9b07('0x10')][util[_0x9b07('0x4a')](_0x9b07('0xe5'),_0x4d630f[_0x9b07('0x26')])][_0x9b07('0x6a')])&&(this[_0x9b07('0x10')][util[_0x9b07('0x4a')](_0x9b07('0xe5'),_0x4d630f[_0x9b07('0x26')])][_0x9b07('0x6a')]==='reachable'||this[_0x9b07('0x10')][util[_0x9b07('0x4a')]('SIP/%s',_0x4d630f['name'])][_0x9b07('0x6a')]===_0x9b07('0xe6'));};Preview[_0x9b07('0xb')][_0x9b07('0x7b')]=function(_0x3c5cf6,_0xc9bf83){var _0x21541c=this;return new BPromise(function(_0x460042,_0x38c05d){_0x21541c[_0x9b07('0xe7')](_0x3c5cf6,_0xc9bf83)['then'](function(_0xc5e41f){_0x460042(_[_0x9b07('0x64')](_0xc5e41f,[_0x9b07('0x44')]));})[_0x9b07('0x6c')](function(_0x1436d4){if(_0x1436d4[_0x9b07('0xe8')]){rpcDb['unlockContact'](_0x3c5cf6);}if(_0x1436d4[_0x9b07('0x47')]){rpcDb[_0x9b07('0xc0')](_0x3c5cf6);}_0x38c05d(_[_0x9b07('0x64')](_0x1436d4,[_0x9b07('0x44')]));});});};Preview[_0x9b07('0xb')][_0x9b07('0xe7')]=function(_0x42b84e,_0x5e756e){var _0x4a2f39=this;return new BPromise(function(_0x594405,_0x41de0f){var _0x3b24c3,_0x129612;rpcDb[_0x9b07('0xe9')](_0x42b84e)[_0x9b07('0x76')](function(_0x4f6e23){if(!_['isNil'](_0x4f6e23[0x0])){_0x129612=_0x4f6e23[0x0][_0x9b07('0xea')]?![]:!![];_0x3b24c3=_0x4f6e23[0x0][_0x9b07('0xea')]?!![]:![];_0x3b24c3=_0x5e756e?!![]:_0x3b24c3;}var _0x56de6d=_0x4a2f39[_0x9b07('0xeb')](_0x4f6e23);if(_0x56de6d[_0x9b07('0xec')]){rpcDb[_0x9b07('0xed')](_['pick'](_0x4f6e23[0x0],[_0x9b07('0x67'),_0x9b07('0xee')]))[_0x9b07('0x76')](function(_0x2da462){_0x4a2f39['checkInBlack'](_0x2da462,_0x4f6e23[0x0],_0x5e756e,_0x129612,_0x3b24c3)['then'](function(_0x12ae75){_0x594405(_0x12ae75);})['catch'](function(_0x3a4cb8){_0x41de0f(_0x3a4cb8);});})[_0x9b07('0x6c')](function(_0x9f46df){ut[_0x9b07('0x51')](_0x9b07('0xef'),_0x9f46df);_0x41de0f(ut[_0x9b07('0x44')](_0x9b07('0xf0'),_0x129612,_0x3b24c3));});}else{_0x41de0f(ut[_0x9b07('0x44')](_0x56de6d[_0x9b07('0x44')],_0x129612,_0x3b24c3));}})[_0x9b07('0x6c')](function(_0x45702d){ut['logger']('[Preview][getContactPreview]',_0x45702d);_0x41de0f(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0x9b07('0xb')][_0x9b07('0xeb')]=function(_0x1a466d){if(_[_0x9b07('0x77')](_0x1a466d)||_[_0x9b07('0xda')](_0x1a466d)||!_[_0x9b07('0x77')](_0x1a466d[0x0]['Agent'])&&_['isNil'](_0x1a466d[0x0][_0x9b07('0xf1')][_0x9b07('0x26')])){ut[_0x9b07('0x51')](_0x9b07('0xf2'),_0x1a466d);return{'isValid':![],'message':_0x9b07('0xf3')};}var _0x2e33f0=this[_0x9b07('0x22')][_0x1a466d[0x0][_0x9b07('0xd8')][_0x9b07('0x26')]];_0x2e33f0[_0x9b07('0x44')]=_0x9b07('0x8f');if(_[_0x9b07('0x77')](_0x2e33f0)){ut[_0x9b07('0x51')](_0x9b07('0xf4'),_0x2e33f0);return{'isValid':![],'message':_0x9b07('0xf5')};}if(!this['isTrunkReachable'](_0x2e33f0['Trunk'])){ut[_0x9b07('0x51')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x2e33f0['name']+_0x9b07('0xf6'));if(!this['isTrunkReachable'](_0x2e33f0['TrunkBackup'])){ut[_0x9b07('0x51')](_0x9b07('0xf7'),_0x2e33f0['name']+_0x9b07('0xf8'));return{'isValid':![],'message':_0x9b07('0xf9')};}}if(!ut[_0x9b07('0x8b')](_0x2e33f0['dialActive'])){ut[_0x9b07('0x51')]('[Preview][validateContact][Campaign\x20Active]',_0x2e33f0[_0x9b07('0x26')]+_0x9b07('0xfa'));return{'isValid':![],'message':_0x9b07('0xfb')+_0x2e33f0[_0x9b07('0x26')]+_0x9b07('0xfa')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x9b07('0xdb')]=function(_0x3e7978,_0x3eb6c2,_0x194bd2,_0x4e262c){var _0x564029=this;return new BPromise(function(_0x288a71,_0x20dc48){var _0x1756c7=_0x3e7978['uniqueid'];var _0x162dc6=_0x564029[_0x9b07('0x8c')](_0x3eb6c2[_0x9b07('0x46')])?util['format'](_0x9b07('0xfc'),_0x3eb6c2[_0x9b07('0x46')]['name'],_['isNil'](_0x3eb6c2['dialPrefix'])?'':_0x3eb6c2[_0x9b07('0x32')][_0x9b07('0xfd')]()||'',_0x3eb6c2[_0x9b07('0xfe')]>0x0?_0x194bd2[_0x9b07('0xd6')][_0x9b07('0xd7')]['substring'](_0x3eb6c2[_0x9b07('0xfe')]):_0x194bd2[_0x9b07('0xd6')][_0x9b07('0xd7')]):util[_0x9b07('0x4a')](_0x9b07('0xfc'),_[_0x9b07('0x77')](_0x3eb6c2[_0x9b07('0x8d')])?_0x3eb6c2[_0x9b07('0x46')][_0x9b07('0x26')]:_0x3eb6c2['TrunkBackup']['name'],_[_0x9b07('0x77')](_0x3eb6c2[_0x9b07('0x32')])?'':_0x3eb6c2[_0x9b07('0x32')]['trim']()||'',_0x3eb6c2[_0x9b07('0xfe')]>0x0?_0x194bd2['Contact'][_0x9b07('0xd7')][_0x9b07('0xff')](_0x3eb6c2[_0x9b07('0xfe')]):_0x194bd2[_0x9b07('0xd6')][_0x9b07('0xd7')]);var _0x48acb8=_0x564029[_0x9b07('0x8c')](_0x3eb6c2[_0x9b07('0x46')])?ut[_0x9b07('0x100')](_0x3eb6c2[_0x9b07('0x46')][_0x9b07('0x48')],_0x3eb6c2[_0x9b07('0x2f')],_0x3eb6c2[_0x9b07('0x101')]>0x0?ut['getCallerIdRandom'](_0x3eb6c2['dialOriginateCallerIdNumber'],_0x3eb6c2[_0x9b07('0x101')]):_0x3eb6c2[_0x9b07('0x30')]):ut['getCallerId'](_['isNil'](_0x3eb6c2['TrunkBackup'])?_0x3eb6c2[_0x9b07('0x46')][_0x9b07('0x48')]:_0x3eb6c2[_0x9b07('0x8d')]['callerid'],_0x3eb6c2[_0x9b07('0x2f')],_0x3eb6c2[_0x9b07('0x101')]>0x0?ut[_0x9b07('0x102')](_0x3eb6c2[_0x9b07('0x30')],_0x3eb6c2[_0x9b07('0x101')]):_0x3eb6c2[_0x9b07('0x30')]);if(_0x48acb8){_0x3e7978['originatecalleridname']=ut[_0x9b07('0x103')](_0x48acb8);_0x3e7978[_0x9b07('0x104')]=ut[_0x9b07('0x105')](_0x48acb8);}var _0x5f4920=ut['addVariables'](_0x3eb6c2,_0x194bd2,_0x162dc6,_0x48acb8,_0x1756c7,_0x3e7978);_[_0x9b07('0x106')](_0x3e7978,ut[_0x9b07('0x107')](_0x5f4920));_0x3e7978[_0x9b07('0x7e')]=moment()['format'](_0x9b07('0x98'));ami['Action'](ut[_0x9b07('0x108')](_0x3e7978,_0x3eb6c2,_0x5f4920,_0x3e7978[_0x9b07('0xb1')],_0x4e262c))['then'](function(_0x2f3058){_0x3eb6c2[_0x9b07('0x45')]+=0x1;logger['info'](_0x9b07('0x109'),_0x1756c7,_0x9b07('0xc7'),_0x3eb6c2[_0x9b07('0x26')],_0x9b07('0x5e'),_0x3eb6c2[_0x9b07('0x45')]);_0x288a71(_0x2f3058);})[_0x9b07('0x6c')](function(_0x4b2b1a){ut[_0x9b07('0xcd')](_0x3e7978,0xe,_0x9b07('0x10a'));rpcDb[_0x9b07('0xcf')](_0x3e7978,_0x9b07('0x10b'));_0x20dc48(_0x4b2b1a);});});};Preview['prototype'][_0x9b07('0x1c')]=function(_0x478079){if(this[_0x9b07('0x11')][_0x478079[_0x9b07('0x96')]]){this['actions'][_0x478079[_0x9b07('0x96')]]['channel']=_0x478079['channel'];}};Preview[_0x9b07('0xb')][_0x9b07('0x10c')]=function(_0xdf0567){var _0x2e7f6b=this;var _0x49f8e8=this[_0x9b07('0x11')][_0xdf0567[_0x9b07('0x10d')]];if(_0x49f8e8){if(_0x49f8e8[_0x9b07('0xd9')]&&this[_0x9b07('0x12')][_0x49f8e8[_0x9b07('0xd9')]]){ut[_0x9b07('0x10e')](_0x49f8e8,this['agents'][_0x49f8e8['lookAgent']][_0x9b07('0x26')],this[_0x9b07('0x12')][_0x49f8e8[_0x9b07('0xd9')]]['id']);}var _0x2502b6=_[_0x9b07('0x10f')](_0x49f8e8);_0x2502b6[_0x9b07('0x99')]=moment()[_0x9b07('0x4a')](_0x9b07('0x98'));var _0x4deeb8=_0x2e7f6b['campaignsPreview'][_0x49f8e8[_0x9b07('0x60')]];if(ut[_0x9b07('0x110')](_0xdf0567[_0x9b07('0x111')])){if(_0x49f8e8[_0x9b07('0xb0')]){rpcDb['unlockContact'](_0x49f8e8[_0x9b07('0xbf')]);}if(_0x49f8e8['activeContact']){rpcDb[_0x9b07('0xc0')](_0x49f8e8[_0x9b07('0xbf')]);}ami['emit'](_0x9b07('0x112'),ut[_0x9b07('0x9e')](_0x49f8e8,'rejected'));this[_0x9b07('0xc9')](_0x2502b6,_0x4deeb8,_0xdf0567);}else{_0x49f8e8[_0x9b07('0x7e')]=moment()[_0x9b07('0x4a')](_0x9b07('0x98'));ut[_0x9b07('0xcd')](_0x2502b6,0x4,'Answer');rpcDb['createAgentHistory'](_0x2502b6,_0x9b07('0x113'));}}};Preview[_0x9b07('0xb')]['syncHangup']=function(_0x456cda){var _0x40bbec=this;var _0x2b516d=this[_0x9b07('0x11')][_0x456cda[_0x9b07('0x96')]];var _0x3f70b9;if(_0x2b516d){_0x3f70b9=this[_0x9b07('0x22')][_0x2b516d[_0x9b07('0x60')]];logger[_0x9b07('0x5c')](_0x9b07('0x114'),_0x456cda[_0x9b07('0x96')],_0x9b07('0xc7'),_0x3f70b9[_0x9b07('0x26')],'pTalking:\x20',_0x3f70b9['pTalking']);}if(this[_0x9b07('0x11')][_0x456cda[_0x9b07('0x96')]]&&_0x456cda[_0x9b07('0x96')]!==_0x456cda[_0x9b07('0x9c')]){if(_0x456cda[_0x9b07('0x115')]==='16'&&this[_0x9b07('0x11')][_0x456cda[_0x9b07('0x96')]]['dialAnswer']){this[_0x9b07('0x90')](_0x456cda,_0x456cda['linkedid'],_0x456cda[_0x9b07('0x115')]);}else if(this[_0x9b07('0x11')][_0x456cda['linkedid']][_0x9b07('0x63')]){logger[_0x9b07('0x5c')](_0x9b07('0x116'),_0x456cda[_0x9b07('0x96')],_0x456cda['cause'],_0x9b07('0xc7'),_0x3f70b9[_0x9b07('0x26')],_0x9b07('0x61'),_0x3f70b9[_0x9b07('0x62')]);this['callProgressDetectingCustomer'](_0x456cda,_0x456cda[_0x9b07('0x96')],_0x456cda[_0x9b07('0x115')]);}}else if(_0x2b516d&&_[_0x9b07('0x77')](_0x2b516d['statedesc'])&&_0x3f70b9['dialQueueProject']&&_0x456cda[_0x9b07('0x96')]===_0x456cda['uniqueid']&&_['isNil'](_0x456cda[_0x9b07('0xcc')])&&_0x456cda[_0x9b07('0x115')]==='16'&&_0x456cda['channelstate']==='6'&&_[_0x9b07('0xca')](_0x2b516d[_0x9b07('0x117')])){if(_0x2b516d[_0x9b07('0xb0')]){rpcDb[_0x9b07('0x118')](_0x2b516d[_0x9b07('0xbf')]);}if(_0x2b516d['activeContact']){rpcDb[_0x9b07('0xc0')](_0x2b516d[_0x9b07('0xbf')]);}_0x456cda[_0x9b07('0xcc')]='22';this[_0x9b07('0xc9')](_0x2b516d,_0x3f70b9,_0x456cda);}else if(_0x2b516d&&_0x2b516d['transfer']){if(_0x456cda[_0x9b07('0x115')]==='16'&&this[_0x9b07('0x11')][_0x456cda[_0x9b07('0x96')]]['dialAnswer']){logger[_0x9b07('0x5c')](_0x9b07('0x119'),_0x456cda[_0x9b07('0x96')],_0x456cda[_0x9b07('0x115')],_0x9b07('0xc7'),_0x3f70b9[_0x9b07('0x26')],_0x9b07('0x61'),_0x3f70b9[_0x9b07('0x62')]);this[_0x9b07('0x90')](_0x456cda,_0x456cda[_0x9b07('0x96')],_0x456cda[_0x9b07('0x115')]);}else if(this[_0x9b07('0x11')][_0x456cda[_0x9b07('0x96')]][_0x9b07('0x63')]){logger[_0x9b07('0x5c')]('[syncHangup][talking][cause]',_0x456cda[_0x9b07('0x96')],_0x456cda[_0x9b07('0x115')],_0x9b07('0xc7'),_0x3f70b9[_0x9b07('0x26')],_0x9b07('0x61'),_0x3f70b9[_0x9b07('0x62')]);this[_0x9b07('0x90')](_0x456cda,_0x456cda[_0x9b07('0x96')],_0x456cda[_0x9b07('0x115')]);}}};Preview[_0x9b07('0xb')][_0x9b07('0x1a')]=function(_0x4b7cda){if(this[_0x9b07('0x11')][_0x4b7cda[_0x9b07('0xc8')]]&&_0x4b7cda[_0x9b07('0xc8')]!==_0x4b7cda[_0x9b07('0x11a')]){this[_0x9b07('0x90')](_0x4b7cda,_0x4b7cda[_0x9b07('0xc8')],_0x4b7cda[_0x9b07('0xc2')]);}};Preview['prototype'][_0x9b07('0x18')]=function(_0x316fa0){if(this['actions'][_0x316fa0[_0x9b07('0x96')]]&&_0x316fa0[_0x9b07('0x96')]!==_0x316fa0[_0x9b07('0x9c')]&&!this[_0x9b07('0x11')][_0x316fa0[_0x9b07('0x96')]][_0x9b07('0x63')]){if(_0x316fa0[_0x9b07('0x115')]==='1'){this[_0x9b07('0x90')](_0x316fa0,_0x316fa0['linkedid'],_0x316fa0[_0x9b07('0x115')]);}}};Preview['prototype'][_0x9b07('0x11b')]=function(_0x32750f,_0x46dbec,_0x5c88f4){if(this[_0x9b07('0x11')][_0x32750f]){if(_[_0x9b07('0x77')](this[_0x9b07('0x11')][_0x32750f][_0x9b07('0x11c')])){this[_0x9b07('0x11')][_0x32750f]['variables']={};}this['actions'][_0x32750f][_0x9b07('0x11c')][_0x46dbec]=_0x5c88f4;}};Preview[_0x9b07('0xb')]['syncVarSet']=function(_0x124fb1){try{if(!_[_0x9b07('0x77')](_0x124fb1)){if(ut[_0x9b07('0x11d')](_[_0x9b07('0x11e')](_0x124fb1[_0x9b07('0x11f')])[0x0])){this[_0x9b07('0x11b')](_0x124fb1[_0x9b07('0x9c')],_[_0x9b07('0x11e')](_0x124fb1[_0x9b07('0x11f')])[0x0],_0x124fb1[_0x9b07('0x120')]);}}}catch(_0x55e24c){logger[_0x9b07('0x121')](_0x9b07('0x122'),util[_0x9b07('0x123')](_0x55e24c,{'showHidden':![],'depth':null}));}};Preview[_0x9b07('0xb')][_0x9b07('0x1f')]=function(_0x16e04d){if(_0x16e04d){if(this[_0x9b07('0x11')][_0x16e04d[_0x9b07('0x124')]]){this[_0x9b07('0x11')][_0x16e04d[_0x9b07('0x124')]][_0x9b07('0x117')]=!![];}}};Preview[_0x9b07('0xb')][_0x9b07('0x125')]=function(_0x53cd24){if(_0x53cd24){if(this[_0x9b07('0x11')][_0x53cd24['transfererlinkedid']]){this['actions'][_0x53cd24['transfererlinkedid']]['transfer']=!![];}}};module[_0x9b07('0x126')]=Preview; \ No newline at end of file +var _0x1ae7=['originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','clone','response','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','../../../config/logger','preview','./rpcDb','./util/util','socket.io-emitter','localhost','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumDuration','talking','total','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','dialActive','setMessage','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','ListId','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','recallMe','getContactRecallMe','then','getDiff','dialRecallMeTimeout','run','logger2','[RecallMe]','catch','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','unlockAgent','activeContact','CONGESTION','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','idContact','disableContact','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','pick','recallme','validateContact','VoiceQueueId','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','Agent','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','phone','trim','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName'];(function(_0x1a6067,_0x5a08f2){var _0x2ad4b2=function(_0x4532b3){while(--_0x4532b3){_0x1a6067['push'](_0x1a6067['shift']());}};_0x2ad4b2(++_0x5a08f2);}(_0x1ae7,0x150));var _0x71ae=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x1ae7[_0x1d9aa0];return _0x226868;};'use strict';var util=require(_0x71ae('0x0'));var _=require(_0x71ae('0x1'));var BPromise=require(_0x71ae('0x2'));var uuid=require(_0x71ae('0x3'));var moment=require('moment');var md5=require(_0x71ae('0x4'));var logger=require(_0x71ae('0x5'))(_0x71ae('0x6'));var loggerAction=require(_0x71ae('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0x71ae('0x7'));var Action=require('./action');var ut=require(_0x71ae('0x8'));var io=require(_0x71ae('0x9'))({'host':_0x71ae('0xa'),'port':0x18eb});var Sequence=function(){};Sequence[_0x71ae('0xb')][_0x71ae('0xc')]=function(_0xf8bd95){this[_0x71ae('0xd')]=this[_0x71ae('0xd')]?this[_0x71ae('0xd')][_0x71ae('0xe')](_0xf8bd95):_0xf8bd95();};function Preview(_0x396f8a){this[_0x71ae('0xf')]=new Sequence();this['campaignsPreview']=_0x396f8a[_0x71ae('0x10')];this[_0x71ae('0x11')]=_0x396f8a[_0x71ae('0x11')];this[_0x71ae('0x12')]={};this[_0x71ae('0x13')]=_0x396f8a[_0x71ae('0x13')];this[_0x71ae('0x14')]=0x0;ami['on'](_0x71ae('0x15'),this[_0x71ae('0x16')][_0x71ae('0x17')](this));ami['on'](_0x71ae('0x18'),this[_0x71ae('0x19')][_0x71ae('0x17')](this));ami['on'](_0x71ae('0x1a'),this['syncHangupRequest'][_0x71ae('0x17')](this));ami['on'](_0x71ae('0x1b'),this[_0x71ae('0x1c')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x71ae('0x17')](this));ami['on'](_0x71ae('0x1d'),this[_0x71ae('0x1e')][_0x71ae('0x17')](this));ami['on']('attendedtransfer',this[_0x71ae('0x1f')][_0x71ae('0x17')](this));ami['on'](_0x71ae('0x20'),this[_0x71ae('0x21')][_0x71ae('0x17')](this));this[_0x71ae('0x22')](this[_0x71ae('0x23')]);}function emit(_0x1f6188,_0x2c5afe,_0x27b891){io['to'](_0x1f6188)[_0x71ae('0x24')](_0x2c5afe,_0x27b891);}function emitCampaignPreview(_0x32f41f){if(_0x32f41f[_0x71ae('0x25')]===_0x71ae('0x26')){var _0x28cc37={'id':_0x32f41f['id'],'name':_0x32f41f[_0x71ae('0x27')],'strategy':_0x32f41f[_0x71ae('0x28')],'answered':_0x32f41f['answered'],'available':_0x32f41f[_0x71ae('0x29')],'loggedIn':_0x32f41f[_0x71ae('0x2a')],'pTalking':_0x32f41f[_0x71ae('0x2b')],'sumBillable':_0x32f41f['sumBillable'],'sumDuration':_0x32f41f[_0x71ae('0x2c')],'sumHoldTime':_0x32f41f['sumHoldTime']||0x0,'talking':_0x32f41f[_0x71ae('0x2d')],'total':_0x32f41f[_0x71ae('0x2e')],'type':_0x32f41f[_0x71ae('0x25')],'unmanaged':_0x32f41f['unmanaged'],'waiting':_0x32f41f[_0x71ae('0x2f')],'loggedInDb':_0x32f41f[_0x71ae('0x30')],'dialActive':_0x32f41f['dialActive'],'dialMethod':_0x32f41f[_0x71ae('0x31')],'dialOriginateCallerIdName':_0x32f41f[_0x71ae('0x32')],'dialOriginateCallerIdNumber':_0x32f41f[_0x71ae('0x33')],'dialOriginateTimeout':_0x32f41f[_0x71ae('0x34')],'dialPrefix':_0x32f41f[_0x71ae('0x35')],'outboundAnswerAgiCallsDay':_0x32f41f[_0x71ae('0x36')],'outboundAnswerCallsDay':_0x32f41f[_0x71ae('0x37')],'outboundBlacklistCallsDay':_0x32f41f[_0x71ae('0x38')],'outboundBusyCallsDay':_0x32f41f[_0x71ae('0x39')],'outboundCongestionCallsDay':_0x32f41f[_0x71ae('0x3a')],'outboundDropCallsDayACS':_0x32f41f['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x32f41f['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x32f41f[_0x71ae('0x3b')],'outboundNoAnswerCallsDay':_0x32f41f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x32f41f[_0x71ae('0x3c')],'outboundOriginateFailureCallsDay':_0x32f41f[_0x71ae('0x3d')],'outboundReCallsDay':_0x32f41f[_0x71ae('0x3e')],'outboundRejectCallsDay':_0x32f41f[_0x71ae('0x3f')],'outboundUnknownCallsDay':_0x32f41f['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x32f41f[_0x71ae('0x40')],'predictiveIntervalAvgHoldtime':_0x32f41f[_0x71ae('0x41')],'predictiveIntervalAvgTalktime':_0x32f41f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x32f41f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x32f41f[_0x71ae('0x42')],'predictiveIntervalErlangCalls':_0x32f41f[_0x71ae('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x32f41f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x32f41f[_0x71ae('0x44')],'predictiveIntervalLowerLimit':_0x32f41f[_0x71ae('0x45')],'predictiveIntervalMultiplicativeFactor':_0x32f41f[_0x71ae('0x46')],'predictiveIntervalPauses':_0x32f41f['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x32f41f[_0x71ae('0x47')],'message':_0x32f41f[_0x71ae('0x48')],'originated':_0x32f41f['originated']};if(_0x32f41f[_0x71ae('0x49')]){_0x28cc37[_0x71ae('0x49')]={'id':_0x32f41f[_0x71ae('0x49')]['id'],'name':_0x32f41f['Trunk'][_0x71ae('0x27')],'active':_0x32f41f[_0x71ae('0x49')][_0x71ae('0x4a')],'callerid':_0x32f41f[_0x71ae('0x49')][_0x71ae('0x4b')]};}if(_0x32f41f[_0x71ae('0x4c')]){_0x28cc37[_0x71ae('0x4c')]={'id':_0x32f41f[_0x71ae('0x4c')]['id'],'name':_0x32f41f[_0x71ae('0x4c')][_0x71ae('0x27')]};}var _0x4605f4=md5(JSON[_0x71ae('0x4d')](_0x28cc37));if(_0x32f41f[_0x71ae('0x4')]!==_0x4605f4){_0x32f41f[_0x71ae('0x4')]=_0x4605f4;emit(util[_0x71ae('0x4e')](_0x71ae('0x4f'),_0x28cc37['name']),_0x71ae('0x50'),_0x28cc37);}}}function emitVoiceQueueChannelRemove(_0x4426d3){emit(util[_0x71ae('0x4e')](_0x71ae('0x4f'),_0x4426d3[_0x71ae('0x27')]),_0x71ae('0x51'),_0x4426d3);}function notSendMessagesQueue(_0xdf3da6){if(_0xdf3da6[_0x71ae('0x52')]){if(_0xdf3da6[_0x71ae('0x53')]===0x0&&_0xdf3da6[_0x71ae('0x2b')]===0x0){_0xdf3da6[_0x71ae('0x52')]=![];_0xdf3da6[_0x71ae('0x29')]=0x0;_0xdf3da6[_0x71ae('0x54')]=0x0;_0xdf3da6['message']=_0x71ae('0x55');ut[_0x71ae('0x56')](_0x71ae('0x57'),_0xdf3da6[_0x71ae('0x27')]+_0x71ae('0x58'));}else{_0xdf3da6[_0x71ae('0x48')]=_0x71ae('0x59');ut[_0x71ae('0x56')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xdf3da6[_0x71ae('0x27')]+_0x71ae('0x5a'));}emitCampaignPreview(_0xdf3da6);}}Preview[_0x71ae('0xb')][_0x71ae('0x22')]=function(){var _0x42349c=this;setInterval(function(){_0x42349c['syncCampaigns']();},0x7cf);};Preview['prototype'][_0x71ae('0x5b')]=function(){var _0x50aa99=this[_0x71ae('0x23')];this[_0x71ae('0x14')]+=0x1;for(var _0x1ddc48 in _0x50aa99){if(_0x50aa99['hasOwnProperty'](_0x1ddc48)&&(_0x50aa99[_0x1ddc48][_0x71ae('0x31')]==='preview'||_0x50aa99[_0x1ddc48][_0x71ae('0x31')]===_0x71ae('0x5c'))&&_0x50aa99[_0x1ddc48][_0x71ae('0x25')]===_0x71ae('0x26')){if(this[_0x71ae('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x71ae('0x5d')]();}}if(_0x50aa99[_0x71ae('0x5e')](_0x1ddc48)&&_0x50aa99[_0x1ddc48]['dialMethod']===_0x71ae('0x6')&&_0x50aa99[_0x1ddc48][_0x71ae('0x25')]===_0x71ae('0x26')){if(_0x50aa99[_0x1ddc48][_0x71ae('0x5f')]){this[_0x71ae('0x60')](_0x50aa99[_0x1ddc48]);this['recallMe'](_0x50aa99[_0x1ddc48]);}else{notSendMessagesQueue(_0x50aa99[_0x1ddc48]);}}}};Preview[_0x71ae('0xb')][_0x71ae('0x61')]=function(_0x3b35f4){var _0x31dc2b=this;this[_0x71ae('0xf')][_0x71ae('0xc')](function(){if(!_[_0x71ae('0x62')](_0x31dc2b[_0x71ae('0x12')][_0x3b35f4])){loggerAction[_0x71ae('0x63')](_0x71ae('0x64'),_0x3b35f4,_0x71ae('0x65'),_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x66')],_0x71ae('0x67'),JSON[_0x71ae('0x4d')](_0x31dc2b[_0x71ae('0x23')][_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x66')]]['originated']),_0x71ae('0x68'),JSON['stringify'](_0x31dc2b['campaignsPreview'][_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x66')]][_0x71ae('0x2b')]),JSON[_0x71ae('0x4d')](_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x69')]),JSON['stringify'](_['pick'](_0x31dc2b[_0x71ae('0x12')][_0x3b35f4],[_0x71ae('0x6a'),'UserId','VoiceQueueId',_0x71ae('0x6b')])));return ami['Action']({'action':_0x71ae('0x6c'),'channel':_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x6d')]})['catch'](function(_0x7349ba){if(_0x7349ba[_0x71ae('0x48')]===_0x71ae('0x6e')){setTimeout(function(){if(_0x31dc2b['actions'][_0x3b35f4]){ut[_0x71ae('0x6f')](_0x31dc2b[_0x71ae('0x23')][_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x66')]],_0x71ae('0x70'));if(_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x69')]===!![]){ut[_0x71ae('0x71')](_0x31dc2b[_0x71ae('0x23')][_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x66')]],_0x71ae('0x70'));ut[_0x71ae('0x72')](_0x71ae('0x73')+_0x3b35f4,_0x31dc2b[_0x71ae('0x12')][_0x3b35f4][_0x71ae('0x66')]);}ut[_0x71ae('0x72')](_0x71ae('0x74')+_0x3b35f4,_0x31dc2b['actions'][_0x3b35f4][_0x71ae('0x66')]);delete _0x31dc2b[_0x71ae('0x12')][_0x3b35f4];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x1e847d=this;loggerAction['info'](_0x71ae('0x75'),_['size'](this[_0x71ae('0x12')]));for(var _0x3e6ed4 in this[_0x71ae('0x12')]){if(_0x1e847d['actions']['hasOwnProperty'](_0x3e6ed4)){_0x1e847d['clearZombieChannel'](_0x3e6ed4);}}};Preview[_0x71ae('0xb')][_0x71ae('0x76')]=function(_0x149e1e){var _0x569c44=this;rpcDb[_0x71ae('0x77')](_0x149e1e['id'],ut['agentReadyId'](this[_0x71ae('0x13')]))[_0x71ae('0x78')](function(_0x1c4f92){if(!_[_0x71ae('0x62')](_0x1c4f92)){for(var _0x1e81cc=0x0;_0x1e81cc<_0x1c4f92['length'];_0x1e81cc+=0x1){if(ut[_0x71ae('0x79')](_0x1c4f92[_0x1e81cc]['scheduledat'])<_0x149e1e[_0x71ae('0x7a')]*0x3c){_0x569c44[_0x71ae('0x7b')](_0x1c4f92[_0x1e81cc]['id'])[_0x71ae('0x78')](ut[_0x71ae('0x7c')](_0x71ae('0x7d')))[_0x71ae('0x7e')](ut[_0x71ae('0x7c')](_0x71ae('0x7d')));}else{var _0x46c9da=new Action(_0x1c4f92[_0x1e81cc],_0x149e1e);_0x46c9da['starttime']=moment()[_0x71ae('0x4e')](_0x71ae('0x7f'));_0x149e1e['outboundReCallsDay']+=0x1;ut[_0x71ae('0x80')](_0x46c9da,0x17,_0x71ae('0x81'));if(_0x149e1e[_0x71ae('0x82')]){rpcDb[_0x71ae('0x83')](ut[_0x71ae('0x84')](_0x1c4f92[_0x1e81cc]));rpcDb[_0x71ae('0x85')](_0x46c9da,_0x71ae('0x86'));}else{ut[_0x71ae('0x80')](_0x46c9da,0x16,_0x71ae('0x87'));rpcDb['createCustomerHistory'](_0x46c9da,_0x71ae('0x88'));rpcDb['createCustomerFinal'](_0x46c9da,_0x71ae('0x88'));}}}}})[_0x71ae('0x7e')](ut[_0x71ae('0x7c')]('[getContactRecallMe]'));};Preview[_0x71ae('0xb')][_0x71ae('0x60')]=function(_0x174af8){_0x174af8[_0x71ae('0x52')]=!![];if(ut[_0x71ae('0x89')](_0x174af8[_0x71ae('0x2a')])){_0x174af8['message']=_0x71ae('0x8a');}else if(!ut[_0x71ae('0x8b')](_0x174af8['dialActive'])){_0x174af8[_0x71ae('0x48')]=_0x71ae('0x55');}else if(!this[_0x71ae('0x8c')](_0x174af8[_0x71ae('0x49')])){if(!this[_0x71ae('0x8c')](_0x174af8['TrunkBackup'])){_0x174af8[_0x71ae('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x174af8[_0x71ae('0x48')]=_0x71ae('0x8d');}}else{_0x174af8[_0x71ae('0x48')]=_0x71ae('0x8d');}emitCampaignPreview(_0x174af8);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x1249d7,_0x33eefe,_0x1411ab){var _0x3efa2e=this;var _0x512f99=this[_0x71ae('0x12')][_0x33eefe];var _0xbfb725=this[_0x71ae('0x23')][_0x512f99[_0x71ae('0x66')]];var _0x481581;if(_0xbfb725){switch(_0x1411ab){case'1':_0xbfb725[_0x71ae('0x3c')]+=0x1;_0x512f99[_0x71ae('0x8e')]=ut[_0x71ae('0x8f')](_0x512f99);ut[_0x71ae('0x80')](_0x512f99,0x0,_0x71ae('0x90'));rpcDb[_0x71ae('0x85')](_0x512f99,_0x71ae('0x91'));if(ut[_0x71ae('0x8f')](_0x512f99)>=_0xbfb725[_0x71ae('0x92')]){_0x481581=ut[_0x71ae('0x93')](_0x512f99,0xf,_0x71ae('0x94'));rpcDb['createCustomerFinal'](_0x481581,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x71ae('0x95')](_0x512f99,_0x71ae('0x96'));}delete this[_0x71ae('0x12')][_0x1249d7[_0x71ae('0x97')]];break;case _0x71ae('0x98'):var _0x977755=moment()['format'](_0x71ae('0x7f'));_0x512f99[_0x71ae('0x99')]=_0x977755;_0x512f99['answertime']=_0x977755;_0x512f99[_0x71ae('0x69')]=!![];_0xbfb725[_0x71ae('0x2b')]+=0x1;logger[_0x71ae('0x63')](_0x71ae('0x9a'),_0x512f99[_0x71ae('0x9b')],_0x71ae('0x9c'),_0xbfb725[_0x71ae('0x27')],_0x71ae('0x68'),_0xbfb725[_0x71ae('0x2b')]);ami[_0x71ae('0x24')](_0x71ae('0x9d'),ut[_0x71ae('0x9e')](_0x512f99,'connect'));if(_0xbfb725[_0x71ae('0x9f')]){ami['emit'](_0x71ae('0xa0'),ut[_0x71ae('0xa1')](_0x512f99));}break;case'16':ami[_0x71ae('0x24')](_0x71ae('0xa2'),ut[_0x71ae('0x9e')](_0x512f99,_0x71ae('0xa3')));emitVoiceQueueChannelRemove(ut[_0x71ae('0x9e')](_0x512f99,_0x71ae('0xa3')));_0xbfb725[_0x71ae('0x37')]+=0x1;_0xbfb725[_0x71ae('0x2e')]+=0x1;_0xbfb725[_0x71ae('0xa4')]+=0x1;ut['decrementTalkink'](_0xbfb725,'[16]');_0x512f99['countglobal']=ut[_0x71ae('0x8f')](_0x512f99);ut[_0x71ae('0x80')](_0x512f99,0x4,_0x71ae('0xa5'));rpcDb['createCustomerHistory'](_0x512f99,_0x71ae('0xa6'));rpcDb[_0x71ae('0x95')](_0x512f99,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x71ae('0xa7')](_0x512f99);_0xbfb725[_0x71ae('0x2c')]+=_0x512f99[_0x71ae('0xa8')];_0xbfb725[_0x71ae('0xa9')]+=_0x512f99['talktime'];logger[_0x71ae('0x63')](_0x71ae('0xaa'),_0x512f99[_0x71ae('0x9b')],_0x71ae('0x9c'),_0xbfb725['name'],_0x71ae('0x68'),_0xbfb725['pTalking']);delete this[_0x71ae('0x12')][_0x1249d7[_0x71ae('0x97')]];break;case _0x71ae('0xab'):_0xbfb725['outboundBusyCallsDay']+=0x1;_0x512f99[_0x71ae('0xac')]+=0x1;_0x512f99[_0x71ae('0x8e')]=ut[_0x71ae('0x8f')](_0x512f99);ut[_0x71ae('0x80')](_0x512f99,0x5,_0x71ae('0xad'));rpcDb[_0x71ae('0x85')](_0x512f99,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x71ae('0x8f')](_0x512f99)>=_0xbfb725[_0x71ae('0x92')]){_0x481581=ut[_0x71ae('0x93')](_0x512f99,0xf,_0x71ae('0x94'));rpcDb[_0x71ae('0x95')](_0x481581,_0x71ae('0xae'));}else{if(_0x512f99[_0x71ae('0xac')]>=_0xbfb725[_0x71ae('0xaf')]){rpcDb[_0x71ae('0x95')](_0x512f99,_0x71ae('0xb0'));}else{rpcDb['rescheduleContact'](ut[_0x71ae('0xb1')](_0x512f99,_0x71ae('0xac'),_0xbfb725[_0x71ae('0xb2')]),_0x512f99['unlockAgent'],_0x512f99['activeContact']);}}break;case'NOANSWER':_0xbfb725['outboundNoAnswerCallsDay']+=0x1;_0x512f99[_0x71ae('0xb3')]+=0x1;_0x512f99[_0x71ae('0x8e')]=ut[_0x71ae('0x8f')](_0x512f99);ut[_0x71ae('0x80')](_0x512f99,0x3,_0x71ae('0xb4'));rpcDb['createCustomerHistory'](_0x512f99,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x512f99)>=_0xbfb725[_0x71ae('0x92')]){_0x481581=ut[_0x71ae('0x93')](_0x512f99,0xf,_0x71ae('0x94'));rpcDb[_0x71ae('0x95')](_0x481581,_0x71ae('0xb5'));}else{if(_0x512f99[_0x71ae('0xb3')]>=_0xbfb725[_0x71ae('0xb6')]){rpcDb['createCustomerFinal'](_0x512f99,_0x71ae('0xb7'));}else{rpcDb['rescheduleContact'](ut[_0x71ae('0xb1')](_0x512f99,_0x71ae('0xb3'),_0xbfb725[_0x71ae('0xb8')]),_0x512f99[_0x71ae('0xb9')],_0x512f99[_0x71ae('0xba')]);}}break;case _0x71ae('0xbb'):_0xbfb725[_0x71ae('0x3a')]+=0x1;_0x512f99['countcongestionretry']+=0x1;_0x512f99[_0x71ae('0x8e')]=ut['totalGlobal'](_0x512f99);ut[_0x71ae('0x80')](_0x512f99,0x8,'Congestion');rpcDb[_0x71ae('0x85')](_0x512f99,_0x71ae('0xbc'));if(ut['totalGlobal'](_0x512f99)>=_0xbfb725[_0x71ae('0x92')]){_0x481581=ut[_0x71ae('0x93')](_0x512f99,0xf,'Global');rpcDb[_0x71ae('0x95')](_0x481581,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x512f99[_0x71ae('0xbd')]>=_0xbfb725[_0x71ae('0xbe')]){rpcDb[_0x71ae('0x95')](_0x512f99,_0x71ae('0xbc'));}else{rpcDb['rescheduleContact'](ut[_0x71ae('0xb1')](_0x512f99,'countcongestionretry',_0xbfb725['dialBusyRetryFrequency']),_0x512f99[_0x71ae('0xb9')],_0x512f99['activeContact']);}}break;case _0x71ae('0xbf'):_0xbfb725[_0x71ae('0x3f')]+=0x1;_0x512f99[_0x71ae('0x8e')]=ut[_0x71ae('0x8f')](_0x512f99);ut['logCustomer'](_0x512f99,0x14,_0x71ae('0xc0'));rpcDb[_0x71ae('0x85')](_0x512f99,_0x71ae('0xc1'));if(_0x512f99[_0x71ae('0xb9')]){rpcDb['unlockContact'](_0x512f99[_0x71ae('0xc2')]);}if(_0x512f99[_0x71ae('0xba')]){rpcDb[_0x71ae('0xc3')](_0x512f99[_0x71ae('0xc2')]);}break;default:if(_0x512f99[_0x71ae('0x69')]){ut['decrementTalkink'](_0xbfb725,'[default]');ut[_0x71ae('0x72')](_0x71ae('0xc4')+_0xbfb725['name'],_0x1249d7);}_0xbfb725[_0x71ae('0xc5')]+=0x1;_0x512f99[_0x71ae('0x8e')]=ut[_0x71ae('0x8f')](_0x512f99);ut[_0x71ae('0x80')](_0x512f99,0xc,_0x1249d7['cause-txt']||_0x1249d7['dialstatus']);rpcDb['createCustomerHistory'](_0x512f99,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x71ae('0x8f')](_0x512f99)>=_0xbfb725[_0x71ae('0x92')]){_0x481581=ut[_0x71ae('0x93')](_0x512f99,0xf,'Global');rpcDb['createCustomerFinal'](_0x481581,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x71ae('0x95')](_0x512f99,_0x71ae('0xc6'));}delete this[_0x71ae('0x12')][_0x1249d7[_0x71ae('0x97')]];}if(!(_0x512f99[_0x71ae('0x69')]&&_0x1411ab==='16')){ut[_0x71ae('0x6f')](_0xbfb725,'[callProgressDetectingCustomer]');logger[_0x71ae('0x63')]('[originated][decrement][callProgressDetectingCustomer]',_0x512f99[_0x71ae('0x9b')],_0x71ae('0x9c'),_0xbfb725[_0x71ae('0x27')],_0x71ae('0x67'),_0xbfb725[_0x71ae('0x53')]);}if(_0x1411ab!==_0x71ae('0x98')){delete this['actions'][_0x1249d7[_0x71ae('0x97')]];delete this[_0x71ae('0x12')][_0x1249d7[_0x71ae('0xc7')]];}}};Preview[_0x71ae('0xb')]['callProgressDetectingAgent']=function(_0x471b5d,_0x4f05a3,_0x289801){if(_[_0x71ae('0xc8')](_0x4f05a3)&&_0x71ae('0xc9')!==typeof _0x4f05a3){return;}if(_['isUndefined'](_0x289801)&&_0x71ae('0xc9')!==typeof _0x289801){return;}switch(_0x289801[_0x71ae('0xca')]){case'0':ut[_0x71ae('0xcb')](_0x471b5d,0x0,_0x71ae('0x90'));rpcDb[_0x71ae('0xcc')](_0x471b5d,_0x71ae('0xcd'));break;case'3':ut[_0x71ae('0xcb')](_0x471b5d,0x3,_0x71ae('0xb4'));rpcDb[_0x71ae('0xcc')](_0x471b5d,_0x71ae('0xce'));break;case'5':ut['logAgent'](_0x471b5d,0x5,_0x71ae('0xad'));rpcDb[_0x71ae('0xcc')](_0x471b5d,_0x71ae('0xcf'));break;case'8':ut[_0x71ae('0xcb')](_0x471b5d,0x8,_0x71ae('0xd0'));rpcDb[_0x71ae('0xcc')](_0x471b5d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x71ae('0xcb')](_0x471b5d,0x16,_0x71ae('0xd1'));rpcDb[_0x71ae('0xcc')](_0x471b5d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x71ae('0xcb')](_0x471b5d,0xc,_0x289801[_0x71ae('0xca')]);rpcDb[_0x71ae('0xcc')](_0x471b5d,_0x71ae('0xd2'));}ut['updateOriginated'](_0x4f05a3,_0x71ae('0xd3'));logger[_0x71ae('0x63')](_0x71ae('0xd4'),_0x471b5d[_0x71ae('0x9b')],_0x71ae('0x9c'),_0x4f05a3[_0x71ae('0x27')],_0x71ae('0x67'),_0x4f05a3[_0x71ae('0x53')]);delete this[_0x71ae('0x12')][_0x471b5d['uniqueid']];};Preview[_0x71ae('0xb')][_0x71ae('0xd5')]=function(_0x187736,_0x3f7058,_0x508939,_0xf022f6,_0x89f89f){var _0x4d529c=this;return new BPromise(function(_0x212a3c,_0x4f2ee9){if(_[_0x71ae('0x62')](_0x3f7058)||_[_0x71ae('0x62')](_0x3f7058[_0x71ae('0xd6')])||_['isNil'](_0x3f7058[_0x71ae('0xd6')]['phone'])||_[_0x71ae('0x62')](_0x3f7058['VoiceQueueId'])){_0x4f2ee9(ut['message'](_0x71ae('0xd7'),_0xf022f6,_0x89f89f));return;}var _0x11ddce=uuid['v4']();var _0x5a89fe=_0x4d529c[_0x71ae('0x23')][_0x3f7058[_0x71ae('0x65')][_0x71ae('0x27')]];var _0x125ea9=_0x508939?_0x4d529c['agents'][_0x508939]['id']:undefined;_0x4d529c[_0x71ae('0x12')][_0x11ddce]=new Action(_0x3f7058,_0x5a89fe,_0x11ddce,_0x508939,_0x125ea9);var _0x4f3f81=_0x4d529c['actions'][_0x11ddce];_0x4f3f81[_0x71ae('0xb9')]=_0xf022f6;_0x4f3f81[_0x71ae('0xba')]=_0x89f89f;_0x4f3f81[_0x71ae('0xd8')]=_0x508939;if(_['isEmpty'](_0x187736)){_0x4d529c['execCall'](_0x4f3f81,_0x5a89fe,_0x3f7058,_0x508939)[_0x71ae('0x78')](function(_0x4e61f0){logger[_0x71ae('0x63')](_0x71ae('0xd9'),'Queue:\x20'+_0x4f3f81[_0x71ae('0x66')]+'\x20IdHopper:\x20'+_0x4f3f81[_0x71ae('0xc2')],JSON[_0x71ae('0x4d')](_0x4e61f0));ami[_0x71ae('0x24')](_0x71ae('0xda'),ut['buildObj'](_0x4f3f81,_0x71ae('0xdb')));_0x212a3c(ut[_0x71ae('0x48')](_0x71ae('0xdc')));})['catch'](function(_0x93a9e4){ut[_0x71ae('0x56')](_0x71ae('0xdd'),_0x93a9e4);_0x4f2ee9(ut[_0x71ae('0x48')]('Call\x20failed',_0xf022f6,_0x89f89f));});}else{_0x5a89fe[_0x71ae('0x38')]+=0x1;ut[_0x71ae('0xde')](_0x4f3f81);rpcDb[_0x71ae('0xdf')](_0x4f3f81,_0x71ae('0xe0'));delete _0x4d529c['actions'][_0x11ddce];_0x4f2ee9(ut['message'](_0x71ae('0xe1'),_0xf022f6,_0x89f89f));}});};Preview[_0x71ae('0xb')][_0x71ae('0x8c')]=function(_0x1a1368){return!_[_0x71ae('0x62')](_0x1a1368)&&!_[_0x71ae('0x62')](_0x1a1368['name'])&&!_['isNil'](_0x1a1368[_0x71ae('0x4a')])&&_0x1a1368['active']&&!_[_0x71ae('0x62')](this[_0x71ae('0x11')][util[_0x71ae('0x4e')](_0x71ae('0xe2'),_0x1a1368[_0x71ae('0x27')])])&&!_[_0x71ae('0x62')](this['trunks'][util['format'](_0x71ae('0xe2'),_0x1a1368[_0x71ae('0x27')])][_0x71ae('0x6c')])&&(this[_0x71ae('0x11')][util['format'](_0x71ae('0xe2'),_0x1a1368[_0x71ae('0x27')])][_0x71ae('0x6c')]===_0x71ae('0xe3')||this['trunks'][util['format'](_0x71ae('0xe2'),_0x1a1368[_0x71ae('0x27')])][_0x71ae('0x6c')]===_0x71ae('0xe4'));};Preview[_0x71ae('0xb')][_0x71ae('0x7b')]=function(_0x4f936b,_0x21a64f){var _0x36307e=this;return new BPromise(function(_0x4367de,_0x25dd2d){_0x36307e[_0x71ae('0xe5')](_0x4f936b,_0x21a64f)[_0x71ae('0x78')](function(_0x2c5fa1){_0x4367de(_['pick'](_0x2c5fa1,['message']));})[_0x71ae('0x7e')](function(_0x12c6bf){if(_0x12c6bf[_0x71ae('0xe6')]){rpcDb[_0x71ae('0xe7')](_0x4f936b);}if(_0x12c6bf[_0x71ae('0x4a')]){rpcDb[_0x71ae('0xc3')](_0x4f936b);}_0x25dd2d(_[_0x71ae('0xe8')](_0x12c6bf,[_0x71ae('0x48')]));});});};Preview[_0x71ae('0xb')][_0x71ae('0xe5')]=function(_0x18a8da,_0x36e6d8){var _0x2c0ea7=this;return new BPromise(function(_0x598006,_0x5cf4fb){var _0x1ce958,_0x549808;rpcDb['getContactPreview'](_0x18a8da)['then'](function(_0xe09cbf){if(!_[_0x71ae('0x62')](_0xe09cbf[0x0])){_0x549808=_0xe09cbf[0x0][_0x71ae('0xe9')]?![]:!![];_0x1ce958=_0xe09cbf[0x0][_0x71ae('0xe9')]?!![]:![];_0x1ce958=_0x36e6d8?!![]:_0x1ce958;}var _0x466875=_0x2c0ea7[_0x71ae('0xea')](_0xe09cbf);if(_0x466875['isValid']){rpcDb['checkIsBlackList'](_[_0x71ae('0xe8')](_0xe09cbf[0x0],[_0x71ae('0xeb'),_0x71ae('0xec')]))['then'](function(_0x464095){_0x2c0ea7[_0x71ae('0xd5')](_0x464095,_0xe09cbf[0x0],_0x36e6d8,_0x549808,_0x1ce958)['then'](function(_0x21dc5b){_0x598006(_0x21dc5b);})[_0x71ae('0x7e')](function(_0x33b5d7){_0x5cf4fb(_0x33b5d7);});})[_0x71ae('0x7e')](function(_0x1c37c9){ut['logger'](_0x71ae('0xed'),_0x1c37c9);_0x5cf4fb(ut[_0x71ae('0x48')]('Call\x20unsuccessful',_0x549808,_0x1ce958));});}else{_0x5cf4fb(ut[_0x71ae('0x48')](_0x466875['message'],_0x549808,_0x1ce958));}})[_0x71ae('0x7e')](function(_0x212257){ut[_0x71ae('0x56')]('[Preview][getContactPreview]',_0x212257);_0x5cf4fb(ut[_0x71ae('0x48')](_0x71ae('0xee'),![],!![]));});});};Preview[_0x71ae('0xb')][_0x71ae('0xea')]=function(_0x427c2e){if(_['isNil'](_0x427c2e)||_[_0x71ae('0xef')](_0x427c2e)||!_[_0x71ae('0x62')](_0x427c2e[0x0]['Agent'])&&_[_0x71ae('0x62')](_0x427c2e[0x0][_0x71ae('0xf0')]['name'])){ut[_0x71ae('0x56')]('[Preview][validateContact][Empty\x20Contact]',_0x427c2e);return{'isValid':![],'message':_0x71ae('0xf1')};}var _0x26f5f1=this['campaignsPreview'][_0x427c2e[0x0][_0x71ae('0x65')][_0x71ae('0x27')]];_0x26f5f1[_0x71ae('0x48')]=_0x71ae('0x8d');if(_[_0x71ae('0x62')](_0x26f5f1)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x26f5f1);return{'isValid':![],'message':_0x71ae('0xf2')};}if(!this['isTrunkReachable'](_0x26f5f1['Trunk'])){ut['logger'](_0x71ae('0xf3'),_0x71ae('0xf4')+_0x26f5f1['name']+_0x71ae('0xf5'));if(!this['isTrunkReachable'](_0x26f5f1[_0x71ae('0xf6')])){ut[_0x71ae('0x56')](_0x71ae('0xf3'),_0x26f5f1[_0x71ae('0x27')]+_0x71ae('0xf7'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x26f5f1[_0x71ae('0x5f')])){ut['logger'](_0x71ae('0xf8'),_0x26f5f1[_0x71ae('0x27')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x71ae('0xf4')+_0x26f5f1[_0x71ae('0x27')]+_0x71ae('0xf9')};}return{'isValid':!![],'message':_0x71ae('0xfa')};};Preview['prototype'][_0x71ae('0xfb')]=function(_0x4dbeac,_0x467f72,_0x25dade,_0x5aebc1){var _0x3913bc=this;return new BPromise(function(_0x18613c,_0x5b8932){var _0x394604=_0x4dbeac[_0x71ae('0x9b')];var _0x2fd3bf=_0x3913bc[_0x71ae('0x8c')](_0x467f72[_0x71ae('0x49')])?util[_0x71ae('0x4e')](_0x71ae('0xfc'),_0x467f72[_0x71ae('0x49')]['name'],_['isNil'](_0x467f72[_0x71ae('0x35')])?'':_0x467f72[_0x71ae('0x35')]['trim']()||'',_0x467f72[_0x71ae('0xfd')]>0x0?_0x25dade[_0x71ae('0xd6')][_0x71ae('0xfe')]['substring'](_0x467f72[_0x71ae('0xfd')]):_0x25dade['Contact'][_0x71ae('0xfe')]):util[_0x71ae('0x4e')](_0x71ae('0xfc'),_['isNil'](_0x467f72[_0x71ae('0xf6')])?_0x467f72[_0x71ae('0x49')][_0x71ae('0x27')]:_0x467f72[_0x71ae('0xf6')]['name'],_['isNil'](_0x467f72[_0x71ae('0x35')])?'':_0x467f72[_0x71ae('0x35')][_0x71ae('0xff')]()||'',_0x467f72[_0x71ae('0xfd')]>0x0?_0x25dade[_0x71ae('0xd6')][_0x71ae('0xfe')][_0x71ae('0x100')](_0x467f72['dialCutDigit']):_0x25dade['Contact'][_0x71ae('0xfe')]);var _0x87c363=_0x3913bc[_0x71ae('0x8c')](_0x467f72[_0x71ae('0x49')])?ut[_0x71ae('0x101')](_0x467f72[_0x71ae('0x49')]['callerid'],_0x467f72['dialOriginateCallerIdName'],_0x467f72[_0x71ae('0x102')]>0x0?ut[_0x71ae('0x103')](_0x467f72[_0x71ae('0x33')],_0x467f72[_0x71ae('0x102')]):_0x467f72['dialOriginateCallerIdNumber']):ut[_0x71ae('0x101')](_[_0x71ae('0x62')](_0x467f72[_0x71ae('0xf6')])?_0x467f72[_0x71ae('0x49')]['callerid']:_0x467f72['TrunkBackup']['callerid'],_0x467f72[_0x71ae('0x32')],_0x467f72[_0x71ae('0x102')]>0x0?ut[_0x71ae('0x103')](_0x467f72['dialOriginateCallerIdNumber'],_0x467f72[_0x71ae('0x102')]):_0x467f72['dialOriginateCallerIdNumber']);if(_0x87c363){_0x4dbeac[_0x71ae('0x104')]=ut[_0x71ae('0x105')](_0x87c363);_0x4dbeac[_0x71ae('0x106')]=ut[_0x71ae('0x107')](_0x87c363);}var _0x29253f=ut[_0x71ae('0x108')](_0x467f72,_0x25dade,_0x2fd3bf,_0x87c363,_0x394604,_0x4dbeac);_[_0x71ae('0x109')](_0x4dbeac,ut[_0x71ae('0x10a')](_0x29253f));_0x4dbeac[_0x71ae('0x10b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x71ae('0x10c')](ut[_0x71ae('0x10d')](_0x4dbeac,_0x467f72,_0x29253f,_0x4dbeac[_0x71ae('0xba')],_0x5aebc1))['then'](function(_0x2b7380){_0x467f72[_0x71ae('0x53')]+=0x1;logger[_0x71ae('0x63')](_0x71ae('0x10e'),_0x394604,_0x71ae('0x9c'),_0x467f72[_0x71ae('0x27')],_0x71ae('0x67'),_0x467f72['originated']);_0x18613c(_0x2b7380);})[_0x71ae('0x7e')](function(_0x5b76f2){ut[_0x71ae('0xcb')](_0x4dbeac,0xe,_0x71ae('0x10f'));rpcDb[_0x71ae('0xcc')](_0x4dbeac,_0x71ae('0x110'));_0x5b8932(_0x5b76f2);});});};Preview[_0x71ae('0xb')][_0x71ae('0x111')]=function(_0x55c2e0){if(this[_0x71ae('0x12')][_0x55c2e0[_0x71ae('0x97')]]){this[_0x71ae('0x12')][_0x55c2e0['linkedid']]['channel']=_0x55c2e0['channel'];}};Preview[_0x71ae('0xb')][_0x71ae('0x16')]=function(_0x48d4d7){var _0x4354a1=this;var _0x2c7f20=this['actions'][_0x48d4d7[_0x71ae('0x112')]];if(_0x2c7f20){if(_0x2c7f20['lookAgent']&&this['agents'][_0x2c7f20[_0x71ae('0xd8')]]){ut['logLookAgent'](_0x2c7f20,this['agents'][_0x2c7f20[_0x71ae('0xd8')]][_0x71ae('0x27')],this[_0x71ae('0x13')][_0x2c7f20[_0x71ae('0xd8')]]['id']);}var _0x8fd2b6=_[_0x71ae('0x113')](_0x2c7f20);_0x8fd2b6[_0x71ae('0x99')]=moment()[_0x71ae('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x14ff9d=_0x4354a1['campaignsPreview'][_0x2c7f20[_0x71ae('0x66')]];if(ut['isFailure'](_0x48d4d7[_0x71ae('0x114')])){if(_0x2c7f20['unlockAgent']){rpcDb[_0x71ae('0xe7')](_0x2c7f20[_0x71ae('0xc2')]);}if(_0x2c7f20[_0x71ae('0xba')]){rpcDb[_0x71ae('0xc3')](_0x2c7f20[_0x71ae('0xc2')]);}ami[_0x71ae('0x24')]('custom:agentringnoanswer',ut[_0x71ae('0x9e')](_0x2c7f20,_0x71ae('0x115')));this[_0x71ae('0x116')](_0x8fd2b6,_0x14ff9d,_0x48d4d7);}else{_0x2c7f20[_0x71ae('0x10b')]=moment()[_0x71ae('0x4e')](_0x71ae('0x7f'));ut['logAgent'](_0x8fd2b6,0x4,_0x71ae('0xa5'));rpcDb[_0x71ae('0xcc')](_0x8fd2b6,_0x71ae('0x117'));}}};Preview[_0x71ae('0xb')][_0x71ae('0x19')]=function(_0x23a2c4){var _0x26ef33=this;var _0x12e4d6=this[_0x71ae('0x12')][_0x23a2c4[_0x71ae('0x97')]];var _0x2c8a68;if(_0x12e4d6){_0x2c8a68=this[_0x71ae('0x23')][_0x12e4d6['queue']];logger['info'](_0x71ae('0x118'),_0x23a2c4['linkedid'],'\x20Queue',_0x2c8a68['name'],_0x71ae('0x68'),_0x2c8a68[_0x71ae('0x2b')]);}if(this[_0x71ae('0x12')][_0x23a2c4['linkedid']]&&_0x23a2c4['linkedid']!==_0x23a2c4[_0x71ae('0x9b')]){if(_0x23a2c4['cause']==='16'&&this['actions'][_0x23a2c4['linkedid']][_0x71ae('0x69')]){this[_0x71ae('0x119')](_0x23a2c4,_0x23a2c4[_0x71ae('0x97')],_0x23a2c4[_0x71ae('0x11a')]);}else if(this['actions'][_0x23a2c4[_0x71ae('0x97')]][_0x71ae('0x69')]){logger[_0x71ae('0x63')](_0x71ae('0x11b'),_0x23a2c4['linkedid'],_0x23a2c4[_0x71ae('0x11a')],_0x71ae('0x9c'),_0x2c8a68['name'],_0x71ae('0x68'),_0x2c8a68[_0x71ae('0x2b')]);this['callProgressDetectingCustomer'](_0x23a2c4,_0x23a2c4[_0x71ae('0x97')],_0x23a2c4[_0x71ae('0x11a')]);}}else if(_0x12e4d6&&_[_0x71ae('0x62')](_0x12e4d6['statedesc'])&&_0x2c8a68[_0x71ae('0x11c')]&&_0x23a2c4[_0x71ae('0x97')]===_0x23a2c4[_0x71ae('0x9b')]&&_[_0x71ae('0x62')](_0x23a2c4[_0x71ae('0xca')])&&_0x23a2c4[_0x71ae('0x11a')]==='16'&&_0x23a2c4[_0x71ae('0x11d')]==='6'&&_['isUndefined'](_0x12e4d6[_0x71ae('0x11e')])){if(_0x12e4d6[_0x71ae('0xb9')]){rpcDb[_0x71ae('0xe7')](_0x12e4d6[_0x71ae('0xc2')]);}if(_0x12e4d6[_0x71ae('0xba')]){rpcDb[_0x71ae('0xc3')](_0x12e4d6['idContact']);}_0x23a2c4[_0x71ae('0xca')]='22';this[_0x71ae('0x116')](_0x12e4d6,_0x2c8a68,_0x23a2c4);}else if(_0x12e4d6&&_0x12e4d6[_0x71ae('0x11e')]){if(_0x23a2c4[_0x71ae('0x11a')]==='16'&&this[_0x71ae('0x12')][_0x23a2c4[_0x71ae('0x97')]][_0x71ae('0x69')]){logger[_0x71ae('0x63')](_0x71ae('0x11f'),_0x23a2c4[_0x71ae('0x97')],_0x23a2c4[_0x71ae('0x11a')],_0x71ae('0x9c'),_0x2c8a68[_0x71ae('0x27')],_0x71ae('0x68'),_0x2c8a68['pTalking']);this[_0x71ae('0x119')](_0x23a2c4,_0x23a2c4[_0x71ae('0x97')],_0x23a2c4[_0x71ae('0x11a')]);}else if(this[_0x71ae('0x12')][_0x23a2c4[_0x71ae('0x97')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x23a2c4[_0x71ae('0x97')],_0x23a2c4[_0x71ae('0x11a')],'\x20Queue',_0x2c8a68[_0x71ae('0x27')],'pTalking:\x20',_0x2c8a68['pTalking']);this[_0x71ae('0x119')](_0x23a2c4,_0x23a2c4[_0x71ae('0x97')],_0x23a2c4[_0x71ae('0x11a')]);}}};Preview[_0x71ae('0xb')][_0x71ae('0x1c')]=function(_0x25d5d1){if(this[_0x71ae('0x12')][_0x25d5d1['destlinkedid']]&&_0x25d5d1[_0x71ae('0xc7')]!==_0x25d5d1[_0x71ae('0x120')]){this[_0x71ae('0x119')](_0x25d5d1,_0x25d5d1[_0x71ae('0xc7')],_0x25d5d1['dialstatus']);}};Preview[_0x71ae('0xb')]['syncHangupRequest']=function(_0x1c5e4c){if(this['actions'][_0x1c5e4c[_0x71ae('0x97')]]&&_0x1c5e4c['linkedid']!==_0x1c5e4c[_0x71ae('0x9b')]&&!this[_0x71ae('0x12')][_0x1c5e4c[_0x71ae('0x97')]]['dialAnswer']){if(_0x1c5e4c[_0x71ae('0x11a')]==='1'){this['callProgressDetectingCustomer'](_0x1c5e4c,_0x1c5e4c[_0x71ae('0x97')],_0x1c5e4c['cause']);}}};Preview[_0x71ae('0xb')][_0x71ae('0x121')]=function(_0x44b02f,_0x431911,_0x557cb1){if(this[_0x71ae('0x12')][_0x44b02f]){if(_[_0x71ae('0x62')](this[_0x71ae('0x12')][_0x44b02f][_0x71ae('0x122')])){this[_0x71ae('0x12')][_0x44b02f][_0x71ae('0x122')]={};}this['actions'][_0x44b02f][_0x71ae('0x122')][_0x431911]=_0x557cb1;}};Preview[_0x71ae('0xb')]['syncVarSet']=function(_0x201569){try{if(!_[_0x71ae('0x62')](_0x201569)){if(ut['filterKey'](_[_0x71ae('0x123')](_0x201569[_0x71ae('0x124')])[0x0])){this['addVariable'](_0x201569['uniqueid'],_[_0x71ae('0x123')](_0x201569[_0x71ae('0x124')])[0x0],_0x201569[_0x71ae('0x125')]);}}}catch(_0x5a9444){logger[_0x71ae('0x126')](_0x71ae('0x127'),util['inspect'](_0x5a9444,{'showHidden':![],'depth':null}));}};Preview[_0x71ae('0xb')][_0x71ae('0x1f')]=function(_0x3d5337){if(_0x3d5337){if(this[_0x71ae('0x12')][_0x3d5337['transfertargetlinkedid']]){this[_0x71ae('0x12')][_0x3d5337[_0x71ae('0x128')]]['transfer']=!![];}}};Preview[_0x71ae('0xb')]['syncBlindTransfer']=function(_0x262852){if(_0x262852){if(this['actions'][_0x262852[_0x71ae('0x129')]]){this[_0x71ae('0x12')][_0x262852['transfererlinkedid']]['transfer']=!![];}}};module[_0x71ae('0x12a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 79bfb15..111ee47 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 _0x2cad=['queuecallercompleteAt','endtime','connectedlinename','context','from-sip','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete'];(function(_0x228acb,_0x3d4196){var _0x294939=function(_0x2673fc){while(--_0x2673fc){_0x228acb['push'](_0x228acb['shift']());}};_0x294939(++_0x3d4196);}(_0x2cad,0x18d));var _0xd2ca=function(_0x14a1b4,_0x2c72b0){_0x14a1b4=_0x14a1b4-0x0;var _0x3cb209=_0x2cad[_0x14a1b4];return _0x3cb209;};'use strict';var util=require(_0xd2ca('0x0'));var BPromise=require(_0xd2ca('0x1'));var logger=require(_0xd2ca('0x2'))(_0xd2ca('0x3'));var _=require(_0xd2ca('0x4'));var cmHopper=require(_0xd2ca('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xd2ca('0x6'));var cmHopperBlack=require(_0xd2ca('0x7'));var voiceQueueRt=require(_0xd2ca('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xd2ca('0x9'));function loggerCatch(_0x4a46a2){return function(_0x2f7a48){logger[_0xd2ca('0xa')](_0x4a46a2,util[_0xd2ca('0xb')](_0x2f7a48,{'showHidden':![],'depth':null}));};}function create(_0xf2c2f5){return BPromise[_0xd2ca('0xc')]()[_0xd2ca('0xd')](cmHopperHistory[_0xd2ca('0xe')](_0xf2c2f5))[_0xd2ca('0xf')](loggerCatch(_0xd2ca('0x10')));}function createAgent(_0x14fed6){return BPromise[_0xd2ca('0xc')]()['then'](agentReportPreview[_0xd2ca('0xe')](_0x14fed6))['catch'](loggerCatch(_0xd2ca('0x10')));}function moveContact(_0x49da41){return BPromise[_0xd2ca('0xc')]()[_0xd2ca('0xd')](cmHopper['moveContactManagedDialer'](_0x49da41,!![]))[_0xd2ca('0xf')](loggerCatch(_0xd2ca('0x11')));}exports['checkIsBlackList']=function(_0x1b76ff){return BPromise['resolve']()['then'](cmHopperBlack[_0xd2ca('0x12')](_0x1b76ff))['catch'](loggerCatch(_0xd2ca('0x13')));};exports[_0xd2ca('0x14')]=function(_0x36cad9){return BPromise['resolve']()['then'](cmHopper[_0xd2ca('0x14')](_0x36cad9))['catch'](loggerCatch(_0xd2ca('0x15')));};exports[_0xd2ca('0xe')]=function(_0x58ff2f,_0x890052){create(_0x58ff2f)[_0xd2ca('0xf')](loggerCatch(_0x890052));moveContact(_0x58ff2f)[_0xd2ca('0xf')](loggerCatch(_0x890052));};exports[_0xd2ca('0x16')]=function(_0x3bcbe3,_0x482d22){createAgent(_0x3bcbe3)[_0xd2ca('0xf')](loggerCatch(_0x482d22));};exports[_0xd2ca('0x17')]=function(_0x551edd,_0x4e9f3a){create(_0x551edd)['catch'](loggerCatch(_0x4e9f3a));};exports[_0xd2ca('0x18')]=function(_0x67b608,_0x34b3d7){moveContact(_0x67b608)[_0xd2ca('0xf')](loggerCatch(_0x34b3d7));};exports[_0xd2ca('0x19')]=function(_0x1f01f1,_0x302373,_0x17af6e){if(_0x302373){_0x1f01f1[_0xd2ca('0x1a')]=null;}if(_0x17af6e){_0x1f01f1['active']=![];}return BPromise[_0xd2ca('0xc')]()[_0xd2ca('0xd')](cmHopper['rescheduleContact'](_0x1f01f1))[_0xd2ca('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xd2ca('0x1b')]=function(_0x18b3f4){return BPromise['resolve']()[_0xd2ca('0xd')](cmHopper[_0xd2ca('0x1b')](_0x18b3f4))[_0xd2ca('0xf')](loggerCatch(_0xd2ca('0x1c')));};exports[_0xd2ca('0x1d')]=function(_0x191a99){return BPromise['resolve']()[_0xd2ca('0xd')](cmHopper[_0xd2ca('0x1d')]({'UserId':null},_0x191a99,0x1))['catch'](loggerCatch(_0xd2ca('0x1e')));};exports[_0xd2ca('0x1f')]=function(_0xfe6a81){return BPromise[_0xd2ca('0xc')]()[_0xd2ca('0xd')](cmHopper[_0xd2ca('0x1d')]({'active':![]},_0xfe6a81,0x1))[_0xd2ca('0xf')](loggerCatch(_0xd2ca('0x20')));};exports[_0xd2ca('0x21')]=function(_0x2143de){var _0xd4adf8={};_0xd4adf8[_0xd2ca('0x22')]=_0x2143de['type'];_0xd4adf8[_0xd2ca('0x23')]=_0x2143de[_0xd2ca('0x23')];_0xd4adf8[_0xd2ca('0x24')]=_0x2143de[_0xd2ca('0x24')];_0xd4adf8[_0xd2ca('0x25')]=_0x2143de[_0xd2ca('0x25')];_0xd4adf8['queue']=_0x2143de[_0xd2ca('0x26')];_0xd4adf8[_0xd2ca('0x27')]=_0x2143de[_0xd2ca('0x28')];_0xd4adf8[_0xd2ca('0x29')]=_0x2143de[_0xd2ca('0x28')];_0xd4adf8[_0xd2ca('0x2a')]=0x1;_0xd4adf8[_0xd2ca('0x2b')]=_0x2143de[_0xd2ca('0x2c')];_0xd4adf8[_0xd2ca('0x2d')]=_0x2143de['membername'];_0xd4adf8[_0xd2ca('0x2e')]=_0xd2ca('0x2f');_0xd4adf8['exten']=_0xd2ca('0x30');_0xd4adf8[_0xd2ca('0x31')]=0x0;_0xd4adf8['assigned']=0x1;_0xd4adf8['lastAssignedTo']=_0x2143de['membername'];_0xd4adf8[_0xd2ca('0x32')]=_0xd2ca('0x33');return BPromise['resolve']()[_0xd2ca('0xd')](voiceQueueReport[_0xd2ca('0x34')](_0xd4adf8))['catch'](loggerCatch(_0xd2ca('0x35')));};exports['getContactRecallMe']=function(_0x8c16e7,_0x592073){return BPromise['resolve']()[_0xd2ca('0xd')](cmHopper['getContactRecallMe'](_0x8c16e7,_0x592073))[_0xd2ca('0xf')](loggerCatch(_0xd2ca('0x36')));};exports['rescheduleContactInQueue']=function(_0x32d8b8){return BPromise[_0xd2ca('0xc')]()[_0xd2ca('0xd')](cmHopper[_0xd2ca('0x19')](_0x32d8b8,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x2c62=['calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid'];(function(_0x5afc15,_0x24640b){var _0x4d1286=function(_0x88928){while(--_0x88928){_0x5afc15['push'](_0x5afc15['shift']());}};_0x4d1286(++_0x24640b);}(_0x2c62,0xc0));var _0x22c6=function(_0xf46ef1,_0x12c3e7){_0xf46ef1=_0xf46ef1-0x0;var _0x5d9a3c=_0x2c62[_0xf46ef1];return _0x5d9a3c;};'use strict';var util=require(_0x22c6('0x0'));var BPromise=require('bluebird');var logger=require(_0x22c6('0x1'))(_0x22c6('0x2'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x22c6('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x22c6('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x22c6('0x5'));function loggerCatch(_0xa828d2){return function(_0x5b9de1){logger[_0x22c6('0x6')](_0xa828d2,util[_0x22c6('0x7')](_0x5b9de1,{'showHidden':![],'depth':null}));};}function create(_0x44db26){return BPromise['resolve']()['then'](cmHopperHistory[_0x22c6('0x8')](_0x44db26))['catch'](loggerCatch(_0x22c6('0x9')));}function createAgent(_0x5a16b6){return BPromise[_0x22c6('0xa')]()[_0x22c6('0xb')](agentReportPreview[_0x22c6('0x8')](_0x5a16b6))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x9')));}function moveContact(_0x422694){return BPromise[_0x22c6('0xa')]()[_0x22c6('0xb')](cmHopper[_0x22c6('0xd')](_0x422694,!![]))[_0x22c6('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x553a15){return BPromise['resolve']()[_0x22c6('0xb')](cmHopperBlack[_0x22c6('0xe')](_0x553a15))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x22c6('0xf')]=function(_0x165823){return BPromise['resolve']()['then'](cmHopper[_0x22c6('0xf')](_0x165823))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x10')));};exports[_0x22c6('0x8')]=function(_0x2acbbd,_0xf03d60){create(_0x2acbbd)[_0x22c6('0xc')](loggerCatch(_0xf03d60));moveContact(_0x2acbbd)[_0x22c6('0xc')](loggerCatch(_0xf03d60));};exports[_0x22c6('0x11')]=function(_0x5659a1,_0x2e40b3){createAgent(_0x5659a1)[_0x22c6('0xc')](loggerCatch(_0x2e40b3));};exports['createCustomerHistory']=function(_0x2aa73f,_0x382941){create(_0x2aa73f)[_0x22c6('0xc')](loggerCatch(_0x382941));};exports[_0x22c6('0x12')]=function(_0x5848c0,_0x3d7ddd){moveContact(_0x5848c0)[_0x22c6('0xc')](loggerCatch(_0x3d7ddd));};exports[_0x22c6('0x13')]=function(_0x4796c7,_0x5e1abd,_0x26868e){if(_0x5e1abd){_0x4796c7[_0x22c6('0x14')]=null;}if(_0x26868e){_0x4796c7[_0x22c6('0x15')]=![];}return BPromise['resolve']()[_0x22c6('0xb')](cmHopper[_0x22c6('0x13')](_0x4796c7))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x16')));};exports[_0x22c6('0x17')]=function(_0x5037d8){return BPromise['resolve']()[_0x22c6('0xb')](cmHopper[_0x22c6('0x17')](_0x5037d8))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x18')));};exports[_0x22c6('0x19')]=function(_0x583c36){return BPromise[_0x22c6('0xa')]()[_0x22c6('0xb')](cmHopper[_0x22c6('0x19')]({'UserId':null},_0x583c36,0x1))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x1a')));};exports[_0x22c6('0x1b')]=function(_0x278362){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'active':![]},_0x278362,0x1))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x1c')));};exports[_0x22c6('0x1d')]=function(_0x399a28){var _0x28a1a4={};_0x28a1a4['type']=_0x399a28[_0x22c6('0x1e')];_0x28a1a4['uniqueid']=_0x399a28[_0x22c6('0x1f')];_0x28a1a4[_0x22c6('0x20')]=_0x399a28[_0x22c6('0x20')];_0x28a1a4[_0x22c6('0x21')]=_0x399a28[_0x22c6('0x21')];_0x28a1a4['queue']=_0x399a28[_0x22c6('0x22')];_0x28a1a4[_0x22c6('0x23')]=_0x399a28[_0x22c6('0x24')];_0x28a1a4[_0x22c6('0x25')]=_0x399a28[_0x22c6('0x24')];_0x28a1a4[_0x22c6('0x26')]=0x1;_0x28a1a4[_0x22c6('0x27')]=_0x399a28[_0x22c6('0x28')];_0x28a1a4[_0x22c6('0x29')]=_0x399a28[_0x22c6('0x2a')];_0x28a1a4[_0x22c6('0x2b')]=_0x22c6('0x2c');_0x28a1a4['exten']='xcally-motion-preview';_0x28a1a4[_0x22c6('0x2d')]=0x0;_0x28a1a4[_0x22c6('0x2e')]=0x1;_0x28a1a4[_0x22c6('0x2f')]=_0x399a28[_0x22c6('0x2a')];_0x28a1a4[_0x22c6('0x30')]=_0x22c6('0x31');return BPromise[_0x22c6('0xa')]()['then'](voiceQueueReport[_0x22c6('0x32')](_0x28a1a4))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x33')));};exports[_0x22c6('0x34')]=function(_0x3779a8,_0x41c5c8){return BPromise[_0x22c6('0xa')]()[_0x22c6('0xb')](cmHopper[_0x22c6('0x34')](_0x3779a8,_0x41c5c8))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x35')));};exports[_0x22c6('0x36')]=function(_0x31766f){return BPromise['resolve']()[_0x22c6('0xb')](cmHopper[_0x22c6('0x13')](_0x31766f,!![],!![]))[_0x22c6('0xc')](loggerCatch(_0x22c6('0x37')));}; \ 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 9ccac6d..433e6cc 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 _0x81ea=['from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','cloneAction','Global','active','add','minutes','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','agentReadyId','not_inuse','reachable','push','getDiff','diff','createBody','ListId','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countbusyretry','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isNil','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','logAgent','state','responsetime','ringtime','membername','UserId','endtime','talktime','answertime','isFailure','Failure','RECALL','calleridname','uniqueid','originate','channelAgent'];(function(_0xf37f96,_0xa1f1ae){var _0x48acac=function(_0x531b7e){while(--_0x531b7e){_0xf37f96['push'](_0xf37f96['shift']());}};_0x48acac(++_0xa1f1ae);}(_0x81ea,0x1e7));var _0xa81e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x81ea[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xa81e('0x0'));var _=require(_0xa81e('0x1'));var moment=require(_0xa81e('0x2'));var logger=require(_0xa81e('0x3'))(_0xa81e('0x4'));var ipAgi=process[_0xa81e('0x5')][_0xa81e('0x6')]||'127.0.0.1';function getSeconds(_0xf995ef,_0x4e8fcd){var _0x6d30ce=moment(_0xf995ef)[_0xa81e('0x7')](0x0);var _0x167c1e=moment(_0x4e8fcd)[_0xa81e('0x7')](0x0);return _0x6d30ce['diff'](_0x167c1e,_0xa81e('0x8'));}exports[_0xa81e('0x9')]=function(_0x4d89d0){return function(_0x5bc7eb){logger[_0xa81e('0xa')](_0x4d89d0,util[_0xa81e('0xb')](_0x5bc7eb,{'showHidden':![],'depth':null}));};};exports[_0xa81e('0xc')]=function(_0x205ba0,_0x23f1d1){logger['info'](_0x205ba0,util[_0xa81e('0xb')](_0x23f1d1,{'showHidden':![],'depth':null}));};exports[_0xa81e('0xd')]=function(_0x572954,_0x2280fd){logger[_0xa81e('0xa')](_0x572954,util[_0xa81e('0xb')](_0x2280fd,{'showHidden':![],'depth':null}));};exports[_0xa81e('0xe')]=function(_0x5c1321){return function(_0x2071e7){logger[_0xa81e('0xf')](_0x5c1321,util['inspect'](_0x2071e7,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1b6fb1,_0x504fc6,_0x5ecebd){return{'message':_0x1b6fb1,'unlock':_0x504fc6,'active':_0x5ecebd};};exports[_0xa81e('0x10')]=function(_0x2325f9,_0x8bae,_0x3d5cff){if(!_[_0xa81e('0x11')](_0x3d5cff)&&_0xa81e('0x12')===typeof _0x3d5cff&&!_[_0xa81e('0x13')](_0x3d5cff)){if(!_[_0xa81e('0x11')](_0x8bae)&&_0xa81e('0x12')===typeof _0x8bae&&!_[_0xa81e('0x13')](_0x8bae)){return util['format'](_0xa81e('0x14'),_0x8bae,_0x3d5cff);}return util[_0xa81e('0x15')](_0xa81e('0x14'),_0x3d5cff,_0x3d5cff);}if(!_['isUndefined'](_0x2325f9)&&'string'===typeof _0x2325f9&&!_[_0xa81e('0x13')](_0x2325f9)){return _0x2325f9;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x508437){if(_[_0xa81e('0x16')](_0x508437)){return![];}return _0x508437;};exports[_0xa81e('0x17')]=function(_0x3d9c49,_0x3c51ae,_0x44e5d0,_0x349f9d,_0x294525,_0xbfac61){var _0x3fab64={'XMD-QUEUE':_0x3c51ae['Queue']?_0x3c51ae[_0xa81e('0x18')][_0xa81e('0x19')]:'','XMD-CALLERID':_0x349f9d,'XMD-CALLERID-PREVIEW':_0xbfac61?util['format'](_0xa81e('0x14'),_0xbfac61['calleridname'],_0xbfac61[_0xa81e('0x1a')]):_0x349f9d,'XMD-DIALID':_0x294525,'XMD-CONTACTID':_0x3c51ae[_0xa81e('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x349f9d,'XMD-VOICEQUEUEID':_0x3c51ae[_0xa81e('0x1c')],'XMD-DIALCHANNEL':_0x44e5d0,'XMD-DIALTIMEOUT':_0x3d9c49[_0xa81e('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xa81e('0x15')](_0xa81e('0x1e'),_0x3d9c49[_0xa81e('0x1f')]?'g':'',_[_0xa81e('0x13')](_0x3d9c49[_0xa81e('0x20')])?'':_0xa81e('0x21')),'XMD-DIALURL':_0x3d9c49[_0xa81e('0x22')]||'','XMD-AGI':_0x3d9c49[_0xa81e('0x23')]?util[_0xa81e('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3d9c49[_0xa81e('0x23')]):'NONE','XMD-AGIAFTER':_0x3d9c49[_0xa81e('0x1f')]?util[_0xa81e('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3d9c49[_0xa81e('0x1f')]):_0xa81e('0x24'),'XMD-ORIGINATECALLERIDNUM':_0xbfac61?_0xbfac61[_0xa81e('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0xbfac61?_0xbfac61[_0xa81e('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xa81e('0x13')](_0x3d9c49[_0xa81e('0x20')])){_0x3fab64[util[_0xa81e('0x15')]('%s',_0xa81e('0x27'))]=_0x3d9c49['monitor_format'];_0x3fab64[util[_0xa81e('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x294525;}if(_0x3c51ae&&_0x3c51ae['Contact']){for(var _0x4a5e8c in _0x3c51ae[_0xa81e('0x28')]){if(_0x3c51ae[_0xa81e('0x28')][_0xa81e('0x29')](_0x4a5e8c)){if(!_[_0xa81e('0x16')](_0x3c51ae[_0xa81e('0x28')][_0x4a5e8c])&&_0x4a5e8c!=='id'&&_0x4a5e8c!=='tags'&&_0x4a5e8c!==_0xa81e('0x2a')&&_0x4a5e8c!==_0xa81e('0x2b')){_0x3fab64[util[_0xa81e('0x15')](_0xa81e('0x2c'),'XMD-',_[_0xa81e('0x2d')](_0x4a5e8c))]=_0x3c51ae[_0xa81e('0x28')][_0x4a5e8c];}}}}return _0x3fab64;};exports[_0xa81e('0x2e')]=function(_0x35f2cb){var _0x1524d0={};for(var _0x1fc730 in _0x35f2cb){if(_0x35f2cb[_0xa81e('0x29')](_0x1fc730)){_0x1524d0[util[_0xa81e('0x15')]('%s',_[_0xa81e('0x2f')](_0x1fc730))]=_0x35f2cb[_0x1fc730];}}return{'variables':_0x1524d0};};exports[_0xa81e('0x30')]=function(_0x2a61a6,_0x316b44){if(!_['isNil'](_0x2a61a6)){if(_0x2a61a6[_0xa81e('0x29')](_0xa81e('0x31'))){if(_0x2a61a6[_0xa81e('0x31')]>0x0){_0x2a61a6[_0xa81e('0x31')]-=0x1;}else{logger['error'](_0xa81e('0x32'),_0x316b44);}}}else{logger['error'](_0xa81e('0x33'),_0x316b44);}};exports[_0xa81e('0x34')]=function(_0xc0a726){var _0x1c984d=moment()['format'](_0xa81e('0x35'));_0xc0a726['state']=0xd;_0xc0a726[_0xa81e('0x36')]=_0xa81e('0x37');_0xc0a726[_0xa81e('0x38')]=_0x1c984d;_0xc0a726['responsetime']=_0x1c984d;_0xc0a726['endtime']=_0x1c984d;};exports[_0xa81e('0x39')]=function(_0x42f455,_0x505e06,_0xd0daf8){var _0x387e1f=moment()[_0xa81e('0x15')](_0xa81e('0x35'));_0x42f455[_0xa81e('0x3a')]=_0x505e06;_0x42f455[_0xa81e('0x36')]=_0xd0daf8;_0x42f455[_0xa81e('0x3b')]=_0x387e1f;_0x42f455[_0xa81e('0x3c')]=getSeconds(_0x42f455[_0xa81e('0x3b')],_0x42f455[_0xa81e('0x38')]);};exports['logLookAgent']=function(_0x5e2097,_0x3fc076,_0x5b1b6d){_0x5e2097[_0xa81e('0x3d')]=_0x3fc076;_0x5e2097[_0xa81e('0x3e')]=_0x5b1b6d;};exports['logCustomer']=function(_0x148cb4,_0x44b66f,_0x2a924f){var _0x36976e=moment()['format'](_0xa81e('0x35'));_0x148cb4['state']=_0x44b66f;_0x148cb4['statedesc']=_0x2a924f;_0x148cb4['responsetime']=_0x148cb4['responsetime']?_0x148cb4[_0xa81e('0x3b')]:_0x36976e;_0x148cb4['endtime']=_0x148cb4[_0xa81e('0x3f')]?_0x148cb4['endtime']:_0x36976e;_0x148cb4[_0xa81e('0x3c')]=getSeconds(_0x148cb4[_0xa81e('0x3b')]||0x0,_0x148cb4[_0xa81e('0x38')]||0x0);_0x148cb4[_0xa81e('0x40')]=_0x148cb4[_0xa81e('0x41')]?getSeconds(_0x148cb4[_0xa81e('0x3f')],_0x148cb4[_0xa81e('0x41')]):0x0;};exports[_0xa81e('0x42')]=function(_0x377511){return _0x377511===_0xa81e('0x43');};exports['variablesAction']=function(_0x592d23,_0x1c98b1,_0xccf248,_0x224f86,_0x1ce5ba){var _0x59855a=_0x224f86?_0xa81e('0x44'):_0x592d23[_0xa81e('0x45')];_0x59855a=_0x1ce5ba?'BOOKED':_0x59855a;return{'actionid':_0x592d23[_0xa81e('0x46')],'action':_0xa81e('0x47'),'channel':_0x592d23[_0xa81e('0x48')],'callerid':util[_0xa81e('0x15')](_0xa81e('0x14'),_0x59855a,_0x592d23[_0xa81e('0x1a')]),'Exten':'xcally-motion-preview','Context':_0xa81e('0x49'),'Priority':'1','variable':_0xccf248,'timeout':(_0x1c98b1[_0xa81e('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x592d23[_0xa81e('0x46')]};};exports[_0xa81e('0x4b')]=function(_0x485427){return _0x485427['countbusyretry']+_0x485427[_0xa81e('0x4c')]+_0x485427[_0xa81e('0x4d')];};exports[_0xa81e('0x4e')]=function(_0x29df28){var _0x15528d=_['clone'](_0x29df28);_0x15528d['state']=0xf;_0x15528d[_0xa81e('0x36')]=_0xa81e('0x4f');return _0x15528d;};exports['scheduledAt']=function(_0x4bd9b1,_0x55faf7,_0xa7a8cd){var _0x270f55={};_0x270f55[_0x55faf7]=_0x4bd9b1[_0x55faf7];_0x270f55[_0xa81e('0x50')]=![];_0x270f55['scheduledat']=moment()[_0xa81e('0x51')](_0xa7a8cd,_0xa81e('0x52'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x270f55[_0xa81e('0x1b')]=_0x4bd9b1[_0xa81e('0x1b')];_0x270f55['ListId']=_0x4bd9b1['ListId'];_0x270f55[_0xa81e('0x1c')]=_0x4bd9b1['VoiceQueueId']||undefined;return _0x270f55;};exports[_0xa81e('0x53')]=function(_0x394493,_0x62f701){if(!_['isNil'](_0x394493)){if(_0x394493['pTalking']>0x0){_0x394493[_0xa81e('0x54')]-=0x1;}else{logger[_0xa81e('0xa')](_0x62f701,_0xa81e('0x55'));}}else{logger[_0xa81e('0xa')](_0x62f701,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xa81e('0x56')]=function(_0x3f5220){if(_0x3f5220<=0x0){return!![];}return![];};exports[_0xa81e('0x57')]=function(_0x1443bc,_0x1109aa){_0x1443bc[_0xa81e('0x58')]=_0x1109aa;_0x1443bc[_0xa81e('0x19')]=_0x1443bc[_0xa81e('0x59')];_0x1443bc[_0xa81e('0x5a')]=_0x1443bc['channelAgent'];return _0x1443bc;};exports['buildAcw']=function(_0x4b1ab6){var _0x4567a4={};_0x4567a4['queue']=_0x4b1ab6['queue'];_0x4567a4[_0xa81e('0x5a')]=_0x4b1ab6[_0xa81e('0x48')];_0x4567a4[_0xa81e('0x46')]=_0x4b1ab6[_0xa81e('0x46')];return _0x4567a4;};exports[_0xa81e('0x5b')]=function(_0x2f52be){var _0x23ff11=[];for(var _0x54ed72 in _0x2f52be){if(_0x2f52be['hasOwnProperty'](_0x54ed72)){if(!_[_0xa81e('0x16')](_0x2f52be[_0x54ed72])&&_0x2f52be[_0x54ed72][_0xa81e('0x3a')]===_0xa81e('0x5c')&&_0x2f52be[_0x54ed72]['status']===_0xa81e('0x5d')){_0x23ff11[_0xa81e('0x5e')](_0x2f52be[_0x54ed72]['id']);}}}return _0x23ff11;};exports[_0xa81e('0x5f')]=function(_0x14de79){var _0xa556d0=moment()[_0xa81e('0x7')](0x0);var _0x31c5a0=moment(_0x14de79)['milliseconds'](0x0);return _0xa556d0[_0xa81e('0x60')](_0x31c5a0,_0xa81e('0x8'));};exports[_0xa81e('0x61')]=function(_0x32c03f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x32c03f['ContactId'],'ListId':_0x32c03f[_0xa81e('0x62')],'VoiceQueueId':_0x32c03f[_0xa81e('0x1c')]||undefined,'CampaignId':_0x32c03f[_0xa81e('0x63')]||undefined};};exports[_0xa81e('0x64')]=function(_0x5ab653){if(_0x5ab653===_0xa81e('0x46')||_0x5ab653===_0xa81e('0x65')||_0x5ab653===_0xa81e('0x59')||_0x5ab653===_0xa81e('0x66')||_0x5ab653===_0xa81e('0x67')||_0x5ab653===_0xa81e('0x68')||_0x5ab653===_0xa81e('0x3d')||_0x5ab653===_0xa81e('0x48')||_0x5ab653==='calleridname'||_0x5ab653===_0xa81e('0x50')||_0x5ab653===_0xa81e('0x1a')||_0x5ab653===_0xa81e('0x69')||_0x5ab653===_0xa81e('0x6a')||_0x5ab653===_0xa81e('0x4c')||_0x5ab653===_0xa81e('0x4d')||_0x5ab653===_0xa81e('0x6b')||_0x5ab653==='callback'||_0x5ab653===_0xa81e('0x6c')||_0x5ab653===_0xa81e('0x6d')||_0x5ab653===_0xa81e('0x6e')||_0x5ab653===_0xa81e('0x1b')||_0x5ab653===_0xa81e('0x62')||_0x5ab653===_0xa81e('0x3e')||_0x5ab653===_0xa81e('0x1c')||_0x5ab653===_0xa81e('0x6f')||_0x5ab653===_0xa81e('0x70')||_0x5ab653===_0xa81e('0x71')||_0x5ab653===_0xa81e('0x72')||_0x5ab653===_0xa81e('0x73')||_0x5ab653==='xmd-dialurl'||_0x5ab653===_0xa81e('0x74')||_0x5ab653===_0xa81e('0x75')||_0x5ab653===_0xa81e('0x76')||_0x5ab653===_0xa81e('0x77')||_0x5ab653==='xmd-contactid'||_0x5ab653==='xmd-cdrtype'||_0x5ab653===_0xa81e('0x78')||_0x5ab653===_0xa81e('0x79')||_0x5ab653==='xmd-agi'||_0x5ab653==='rtpaudioqos'||_0x5ab653===_0xa81e('0x7a')||_0x5ab653===_0xa81e('0x7b')||_0x5ab653==='rtpaudioqosjitterbridged'||_0x5ab653===_0xa81e('0x7c')||_0x5ab653==='rtpaudioqoslossbridged'||_0x5ab653===_0xa81e('0x7d')||_0x5ab653===_0xa81e('0x7e')||_0x5ab653===_0xa81e('0x7f')||_0x5ab653==='rtpaudioqosbridged'||_0x5ab653===_0xa81e('0x7b')||_0x5ab653===_0xa81e('0x80')||_0x5ab653===_0xa81e('0x7c')||_0x5ab653===_0xa81e('0x81')||_0x5ab653===_0xa81e('0x7d')||_0x5ab653==='rtpaudioqosrttbridged'||_0x5ab653===_0xa81e('0x82')||_0x5ab653===_0xa81e('0x83')||_0x5ab653===_0xa81e('0x3a')||_0x5ab653===_0xa81e('0x36')){return![];}return!![];};exports[_0xa81e('0x84')]=function(_0x37ec3e,_0x218d23){var _0x38d5ad,_0x91bc1e,_0x22960d;if(_0x218d23<=0x0){_0x218d23=0x1;}_0x38d5ad=new RegExp(_0xa81e('0x85')+_0x218d23+'}$');_0x91bc1e=Math[_0xa81e('0x86')](0xa,_0x218d23-0x1);_0x22960d=Math['pow'](0xa,_0x218d23)-0x1;return util['format']('%s',_[_0xa81e('0x87')](_0x37ec3e,_0x38d5ad,_[_0xa81e('0x88')](_0x91bc1e,_0x22960d)));};exports[_0xa81e('0x89')]=function(_0x31a60a){var _0x23633d=_0x31a60a[_0xa81e('0x8a')](/"(.*?)"/);return _0x23633d?_0x23633d[0x1]:_0x31a60a;};exports[_0xa81e('0x8b')]=function(_0x34dcfe){var _0x49b94f=_0x34dcfe['match'](/<(.*?)>/);return _0x49b94f?_0x49b94f[0x1]:_0x34dcfe;}; \ No newline at end of file +var _0xb9da=['createBody','filterKey','idContact','type','campaigntype','countcongestionretry','countglobal','callbackuniqueid','callbackat','ListId','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','inspect','loggerError','logger2','info','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','agentReadyId','status','reachable','push'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xb9da,0x1d6));var _0xab9d=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0xb9da[_0x98db33];return _0x5ae63a;};'use strict';var util=require(_0xab9d('0x0'));var _=require(_0xab9d('0x1'));var moment=require(_0xab9d('0x2'));var logger=require(_0xab9d('0x3'))('preview');var ipAgi=process[_0xab9d('0x4')][_0xab9d('0x5')]||_0xab9d('0x6');function getSeconds(_0x2ee162,_0x560717){var _0x557129=moment(_0x2ee162)[_0xab9d('0x7')](0x0);var _0x3fb01a=moment(_0x560717)[_0xab9d('0x7')](0x0);return _0x557129[_0xab9d('0x8')](_0x3fb01a,_0xab9d('0x9'));}exports[_0xab9d('0xa')]=function(_0x46fb17){return function(_0x59e162){logger[_0xab9d('0xb')](_0x46fb17,util['inspect'](_0x59e162,{'showHidden':![],'depth':null}));};};exports[_0xab9d('0xc')]=function(_0xffcebd,_0x332ae0){logger['info'](_0xffcebd,util[_0xab9d('0xd')](_0x332ae0,{'showHidden':![],'depth':null}));};exports[_0xab9d('0xe')]=function(_0x24a65d,_0x40ce02){logger['error'](_0x24a65d,util['inspect'](_0x40ce02,{'showHidden':![],'depth':null}));};exports[_0xab9d('0xf')]=function(_0x169b34){return function(_0xdb144e){logger[_0xab9d('0x10')](_0x169b34,util[_0xab9d('0xd')](_0xdb144e,{'showHidden':![],'depth':null}));};};exports[_0xab9d('0x11')]=function(_0x35ff1a,_0x218803,_0x4e9c25){return{'message':_0x35ff1a,'unlock':_0x218803,'active':_0x4e9c25};};exports[_0xab9d('0x12')]=function(_0x4431bc,_0x4a0a66,_0x18246a){if(!_['isUndefined'](_0x18246a)&&_0xab9d('0x13')===typeof _0x18246a&&!_[_0xab9d('0x14')](_0x18246a)){if(!_[_0xab9d('0x15')](_0x4a0a66)&&'string'===typeof _0x4a0a66&&!_[_0xab9d('0x14')](_0x4a0a66)){return util[_0xab9d('0x16')](_0xab9d('0x17'),_0x4a0a66,_0x18246a);}return util[_0xab9d('0x16')](_0xab9d('0x17'),_0x18246a,_0x18246a);}if(!_[_0xab9d('0x15')](_0x4431bc)&&'string'===typeof _0x4431bc&&!_['isEmpty'](_0x4431bc)){return _0x4431bc;}return'\x22\x22\x20<>';};exports[_0xab9d('0x18')]=function(_0x4c7a61){if(_[_0xab9d('0x19')](_0x4c7a61)){return![];}return _0x4c7a61;};exports[_0xab9d('0x1a')]=function(_0x1f1584,_0x2ed7db,_0x48db08,_0x4b1816,_0x2fb63b,_0x5abaec){var _0x2f5065={'XMD-QUEUE':_0x2ed7db[_0xab9d('0x1b')]?_0x2ed7db[_0xab9d('0x1b')]['name']:'','XMD-CALLERID':_0x4b1816,'XMD-CALLERID-PREVIEW':_0x5abaec?util['format'](_0xab9d('0x17'),_0x5abaec[_0xab9d('0x1c')],_0x5abaec[_0xab9d('0x1d')]):_0x4b1816,'XMD-DIALID':_0x2fb63b,'XMD-CONTACTID':_0x2ed7db[_0xab9d('0x1e')],'XMD-CDRTYPE':_0xab9d('0x1f'),'CALLERID(all)':_0x4b1816,'XMD-VOICEQUEUEID':_0x2ed7db[_0xab9d('0x20')],'XMD-DIALCHANNEL':_0x48db08,'XMD-DIALTIMEOUT':_0x1f1584[_0xab9d('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0xab9d('0x16')]('\x22rtTxX%s%s\x22',_0x1f1584[_0xab9d('0x22')]?'g':'',_[_0xab9d('0x14')](_0x1f1584['monitor_format'])?'':_0xab9d('0x23')),'XMD-DIALURL':_0x1f1584[_0xab9d('0x24')]||'','XMD-AGI':_0x1f1584[_0xab9d('0x25')]?util['format'](_0xab9d('0x26'),ipAgi,_0x1f1584[_0xab9d('0x25')]):'NONE','XMD-AGIAFTER':_0x1f1584[_0xab9d('0x22')]?util[_0xab9d('0x16')](_0xab9d('0x26'),ipAgi,_0x1f1584['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5abaec?_0x5abaec[_0xab9d('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x5abaec?_0x5abaec[_0xab9d('0x28')]:'','XMD-DESTINATION':_0xab9d('0x29')};if(!_[_0xab9d('0x14')](_0x1f1584[_0xab9d('0x2a')])){_0x2f5065[util[_0xab9d('0x16')]('%s',_0xab9d('0x2b'))]=_0x1f1584[_0xab9d('0x2a')];_0x2f5065[util['format']('%s',_0xab9d('0x2c'))]=_0x2fb63b;}if(_0x2ed7db&&_0x2ed7db['Contact']){for(var _0x17c203 in _0x2ed7db[_0xab9d('0x2d')]){if(_0x2ed7db[_0xab9d('0x2d')][_0xab9d('0x2e')](_0x17c203)){if(!_['isNil'](_0x2ed7db[_0xab9d('0x2d')][_0x17c203])&&_0x17c203!=='id'&&_0x17c203!=='tags'&&_0x17c203!=='createdAt'&&_0x17c203!=='updatedAt'){_0x2f5065[util[_0xab9d('0x16')](_0xab9d('0x2f'),_0xab9d('0x30'),_[_0xab9d('0x31')](_0x17c203))]=_0x2ed7db[_0xab9d('0x2d')][_0x17c203];}}}}return _0x2f5065;};exports[_0xab9d('0x32')]=function(_0x5eaa20){var _0xe5e9e2={};for(var _0x13d300 in _0x5eaa20){if(_0x5eaa20[_0xab9d('0x2e')](_0x13d300)){_0xe5e9e2[util[_0xab9d('0x16')]('%s',_[_0xab9d('0x33')](_0x13d300))]=_0x5eaa20[_0x13d300];}}return{'variables':_0xe5e9e2};};exports[_0xab9d('0x34')]=function(_0x437122,_0x3b0573){if(!_['isNil'](_0x437122)){if(_0x437122[_0xab9d('0x2e')](_0xab9d('0x35'))){if(_0x437122[_0xab9d('0x35')]>0x0){_0x437122[_0xab9d('0x35')]-=0x1;}else{logger[_0xab9d('0xb')](_0xab9d('0x36'),_0x3b0573);}}}else{logger[_0xab9d('0xb')](_0xab9d('0x37'),_0x3b0573);}};exports[_0xab9d('0x38')]=function(_0x4868b2){var _0x4f9d3a=moment()[_0xab9d('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x4868b2[_0xab9d('0x39')]=0xd;_0x4868b2[_0xab9d('0x3a')]='Blacklist';_0x4868b2[_0xab9d('0x3b')]=_0x4f9d3a;_0x4868b2[_0xab9d('0x3c')]=_0x4f9d3a;_0x4868b2[_0xab9d('0x3d')]=_0x4f9d3a;};exports[_0xab9d('0x3e')]=function(_0x3ff5b1,_0x275817,_0x331281){var _0x378054=moment()[_0xab9d('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ff5b1[_0xab9d('0x39')]=_0x275817;_0x3ff5b1[_0xab9d('0x3a')]=_0x331281;_0x3ff5b1[_0xab9d('0x3c')]=_0x378054;_0x3ff5b1[_0xab9d('0x3f')]=getSeconds(_0x3ff5b1['responsetime'],_0x3ff5b1['starttime']);};exports[_0xab9d('0x40')]=function(_0x2b887d,_0x5f3d4e,_0x3249ab){_0x2b887d[_0xab9d('0x41')]=_0x5f3d4e;_0x2b887d['UserId']=_0x3249ab;};exports[_0xab9d('0x42')]=function(_0x3b0695,_0x338c54,_0x315dd2){var _0x15424b=moment()[_0xab9d('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b0695['state']=_0x338c54;_0x3b0695[_0xab9d('0x3a')]=_0x315dd2;_0x3b0695[_0xab9d('0x3c')]=_0x3b0695[_0xab9d('0x3c')]?_0x3b0695[_0xab9d('0x3c')]:_0x15424b;_0x3b0695[_0xab9d('0x3d')]=_0x3b0695[_0xab9d('0x3d')]?_0x3b0695[_0xab9d('0x3d')]:_0x15424b;_0x3b0695[_0xab9d('0x3f')]=getSeconds(_0x3b0695[_0xab9d('0x3c')]||0x0,_0x3b0695[_0xab9d('0x3b')]||0x0);_0x3b0695[_0xab9d('0x43')]=_0x3b0695['answertime']?getSeconds(_0x3b0695['endtime'],_0x3b0695[_0xab9d('0x44')]):0x0;};exports[_0xab9d('0x45')]=function(_0x351f1f){return _0x351f1f==='Failure';};exports[_0xab9d('0x46')]=function(_0x1e8b45,_0x3e3e69,_0x2a9109,_0xd49104,_0x42e8aa){var _0x256e80=_0xd49104?_0xab9d('0x47'):_0x1e8b45['calleridname'];_0x256e80=_0x42e8aa?_0xab9d('0x48'):_0x256e80;return{'actionid':_0x1e8b45['uniqueid'],'action':_0xab9d('0x49'),'channel':_0x1e8b45[_0xab9d('0x4a')],'callerid':util['format'](_0xab9d('0x17'),_0x256e80,_0x1e8b45[_0xab9d('0x1d')]),'Exten':_0xab9d('0x29'),'Context':_0xab9d('0x4b'),'Priority':'1','variable':_0x2a9109,'timeout':(_0x3e3e69[_0xab9d('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1e8b45[_0xab9d('0x4d')]};};exports[_0xab9d('0x4e')]=function(_0x164d33){return _0x164d33[_0xab9d('0x4f')]+_0x164d33['countcongestionretry']+_0x164d33[_0xab9d('0x50')];};exports[_0xab9d('0x51')]=function(_0x3bb7c1){var _0x2bbb7b=_[_0xab9d('0x52')](_0x3bb7c1);_0x2bbb7b[_0xab9d('0x39')]=0xf;_0x2bbb7b[_0xab9d('0x3a')]=_0xab9d('0x53');return _0x2bbb7b;};exports[_0xab9d('0x54')]=function(_0x348184,_0x47901c,_0x3b5f06){var _0x20c70b={};_0x20c70b[_0x47901c]=_0x348184[_0x47901c];_0x20c70b[_0xab9d('0x55')]=![];_0x20c70b[_0xab9d('0x56')]=moment()[_0xab9d('0x57')](_0x3b5f06,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x20c70b[_0xab9d('0x1e')]=_0x348184['ContactId'];_0x20c70b['ListId']=_0x348184['ListId'];_0x20c70b[_0xab9d('0x20')]=_0x348184[_0xab9d('0x20')]||undefined;return _0x20c70b;};exports[_0xab9d('0x58')]=function(_0xf60c41,_0x273fbc){if(!_[_0xab9d('0x19')](_0xf60c41)){if(_0xf60c41[_0xab9d('0x59')]>0x0){_0xf60c41[_0xab9d('0x59')]-=0x1;}else{logger[_0xab9d('0xb')](_0x273fbc,_0xab9d('0x5a'));}}else{logger['error'](_0x273fbc,_0xab9d('0x5b'));}};exports[_0xab9d('0x5c')]=function(_0x5d54d2){if(_0x5d54d2<=0x0){return!![];}return![];};exports[_0xab9d('0x5d')]=function(_0x3d0715,_0x13182a){_0x3d0715[_0xab9d('0x5e')]=_0x13182a;_0x3d0715[_0xab9d('0x5f')]=_0x3d0715[_0xab9d('0x60')];_0x3d0715['interface']=_0x3d0715[_0xab9d('0x4a')];return _0x3d0715;};exports['buildAcw']=function(_0x258473){var _0x590a4b={};_0x590a4b[_0xab9d('0x60')]=_0x258473[_0xab9d('0x60')];_0x590a4b[_0xab9d('0x61')]=_0x258473[_0xab9d('0x4a')];_0x590a4b['uniqueid']=_0x258473[_0xab9d('0x4d')];return _0x590a4b;};exports[_0xab9d('0x62')]=function(_0x3fcc7a){var _0x1cc430=[];for(var _0x2dfd6c in _0x3fcc7a){if(_0x3fcc7a[_0xab9d('0x2e')](_0x2dfd6c)){if(!_['isNil'](_0x3fcc7a[_0x2dfd6c])&&_0x3fcc7a[_0x2dfd6c][_0xab9d('0x39')]==='not_inuse'&&_0x3fcc7a[_0x2dfd6c][_0xab9d('0x63')]===_0xab9d('0x64')){_0x1cc430[_0xab9d('0x65')](_0x3fcc7a[_0x2dfd6c]['id']);}}}return _0x1cc430;};exports['getDiff']=function(_0x25cb13){var _0x5ca552=moment()[_0xab9d('0x7')](0x0);var _0x51672d=moment(_0x25cb13)[_0xab9d('0x7')](0x0);return _0x5ca552[_0xab9d('0x8')](_0x51672d,'seconds');};exports[_0xab9d('0x66')]=function(_0x411c8d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x411c8d[_0xab9d('0x1e')],'ListId':_0x411c8d['ListId'],'VoiceQueueId':_0x411c8d[_0xab9d('0x20')]||undefined,'CampaignId':_0x411c8d['CampaignId']||undefined};};exports[_0xab9d('0x67')]=function(_0x5dc0ff){if(_0x5dc0ff===_0xab9d('0x4d')||_0x5dc0ff===_0xab9d('0x68')||_0x5dc0ff==='queue'||_0x5dc0ff===_0xab9d('0x69')||_0x5dc0ff===_0xab9d('0x6a')||_0x5dc0ff==='dialAnswer'||_0x5dc0ff===_0xab9d('0x41')||_0x5dc0ff===_0xab9d('0x4a')||_0x5dc0ff===_0xab9d('0x1c')||_0x5dc0ff===_0xab9d('0x55')||_0x5dc0ff==='calleridnum'||_0x5dc0ff===_0xab9d('0x56')||_0x5dc0ff===_0xab9d('0x4f')||_0x5dc0ff===_0xab9d('0x6b')||_0x5dc0ff==='countnoanswerretry'||_0x5dc0ff===_0xab9d('0x6c')||_0x5dc0ff==='callback'||_0x5dc0ff===_0xab9d('0x6d')||_0x5dc0ff===_0xab9d('0x6e')||_0x5dc0ff==='recallme'||_0x5dc0ff===_0xab9d('0x1e')||_0x5dc0ff===_0xab9d('0x6f')||_0x5dc0ff===_0xab9d('0x70')||_0x5dc0ff==='VoiceQueueId'||_0x5dc0ff===_0xab9d('0x71')||_0x5dc0ff===_0xab9d('0x72')||_0x5dc0ff===_0xab9d('0x73')||_0x5dc0ff===_0xab9d('0x74')||_0x5dc0ff===_0xab9d('0x75')||_0x5dc0ff==='xmd-dialurl'||_0x5dc0ff==='xmd-dialtimeout'||_0x5dc0ff===_0xab9d('0x76')||_0x5dc0ff===_0xab9d('0x77')||_0x5dc0ff===_0xab9d('0x78')||_0x5dc0ff===_0xab9d('0x79')||_0x5dc0ff===_0xab9d('0x7a')||_0x5dc0ff===_0xab9d('0x7b')||_0x5dc0ff===_0xab9d('0x7c')||_0x5dc0ff===_0xab9d('0x7d')||_0x5dc0ff===_0xab9d('0x7e')||_0x5dc0ff==='rtpaudioqosbridged'||_0x5dc0ff===_0xab9d('0x7f')||_0x5dc0ff===_0xab9d('0x80')||_0x5dc0ff===_0xab9d('0x81')||_0x5dc0ff===_0xab9d('0x82')||_0x5dc0ff==='rtpaudioqosrtt'||_0x5dc0ff===_0xab9d('0x83')||_0x5dc0ff===_0xab9d('0x7e')||_0x5dc0ff===_0xab9d('0x84')||_0x5dc0ff===_0xab9d('0x7f')||_0x5dc0ff===_0xab9d('0x80')||_0x5dc0ff===_0xab9d('0x81')||_0x5dc0ff===_0xab9d('0x82')||_0x5dc0ff===_0xab9d('0x85')||_0x5dc0ff===_0xab9d('0x83')||_0x5dc0ff===_0xab9d('0x86')||_0x5dc0ff===_0xab9d('0x87')||_0x5dc0ff===_0xab9d('0x39')||_0x5dc0ff==='statedesc'){return![];}return!![];};exports[_0xab9d('0x88')]=function(_0x1685b6,_0x2e7c6f){var _0x12da6e,_0x335de0,_0x5945d0;if(_0x2e7c6f<=0x0){_0x2e7c6f=0x1;}_0x12da6e=new RegExp('\x5cw{0,'+_0x2e7c6f+'}$');_0x335de0=Math[_0xab9d('0x89')](0xa,_0x2e7c6f-0x1);_0x5945d0=Math[_0xab9d('0x89')](0xa,_0x2e7c6f)-0x1;return util[_0xab9d('0x16')]('%s',_[_0xab9d('0x8a')](_0x1685b6,_0x12da6e,_[_0xab9d('0x8b')](_0x335de0,_0x5945d0)));};exports[_0xab9d('0x8c')]=function(_0x34a90f){var _0x53ba66=_0x34a90f[_0xab9d('0x8d')](/"(.*?)"/);return _0x53ba66?_0x53ba66[0x1]:_0x34a90f;};exports[_0xab9d('0x8e')]=function(_0x15f6e8){var _0x2028cd=_0x15f6e8[_0xab9d('0x8d')](/<(.*?)>/);return _0x2028cd?_0x2028cd[0x1]:_0x15f6e8;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 39781f9..5f49e0f 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 _0xcee8=['reload','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause'];(function(_0x3bb69d,_0x10f7b8){var _0x350f77=function(_0x22e1ba){while(--_0x22e1ba){_0x3bb69d['push'](_0x3bb69d['shift']());}};_0x350f77(++_0x10f7b8);}(_0xcee8,0xb1));var _0x8cee=function(_0x4e8eaa,_0xcfb9ed){_0x4e8eaa=_0x4e8eaa-0x0;var _0x93e4dd=_0xcee8[_0x4e8eaa];return _0x93e4dd;};'use strict';exports[_0x8cee('0x0')]={'queue':{'type':_0x8cee('0x1'),'required':!![]},'interface':{'type':_0x8cee('0x1'),'required':!![]},'membername':{'type':_0x8cee('0x1'),'required':!![]},'penalty':{'type':_0x8cee('0x2'),'required':![]},'paused':{'type':_0x8cee('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x8cee('0x1'),'required':!![]},'interface':{'type':_0x8cee('0x1'),'required':!![]}};exports[_0x8cee('0x4')]={'interface':{'type':_0x8cee('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x8cee('0x1'),'required':![]}};exports[_0x8cee('0x5')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x8cee('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x8cee('0x1'),'required':!![]},'filename':{'type':_0x8cee('0x1')},'format':{'type':_0x8cee('0x1')},'mixmonitorid':{'type':_0x8cee('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x8cee('0x1'),'required':!![]}};exports[_0x8cee('0x6')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8cee('0x1'),'required':!![]},'context':{'type':_0x8cee('0x1')}}; \ No newline at end of file +var _0x96aa=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload'];(function(_0x396f60,_0x14a4c1){var _0x54872c=function(_0x425c47){while(--_0x425c47){_0x396f60['push'](_0x396f60['shift']());}};_0x54872c(++_0x14a4c1);}(_0x96aa,0x67));var _0xa96a=function(_0x340876,_0x15349c){_0x340876=_0x340876-0x0;var _0x39f8d4=_0x96aa[_0x340876];return _0x39f8d4;};'use strict';exports[_0xa96a('0x0')]={'queue':{'type':_0xa96a('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xa96a('0x1'),'required':!![]},'penalty':{'type':_0xa96a('0x2'),'required':![]},'paused':{'type':_0xa96a('0x3'),'required':![]}};exports[_0xa96a('0x4')]={'queue':{'type':_0xa96a('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xa96a('0x5')]={'interface':{'type':_0xa96a('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xa96a('0x1'),'required':![]}};exports[_0xa96a('0x6')]={'module':{'type':_0xa96a('0x1'),'required':![]}};exports[_0xa96a('0x7')]={'uniqueid':{'type':_0xa96a('0x1'),'required':!![]}};exports[_0xa96a('0x8')]={'uniqueid':{'type':_0xa96a('0x1'),'required':!![]},'filename':{'type':_0xa96a('0x1')},'format':{'type':_0xa96a('0x1')},'mixmonitorid':{'type':_0xa96a('0x1')}};exports[_0xa96a('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa96a('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xa96a('0x1'),'required':!![]},'context':{'type':_0xa96a('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0711881..6e2576f 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 _0x5da4=['queuecallerleaveAt','initVoiceCallReports','disposition','duration','billableseconds','initCampaigns','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','telephones','trunks','campaigns','templates','outbound','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','initAgents','agents','length','format','isUndefined','mergeFromDatabase','initTrunks','voiceQueues','initTriggers','triggers','initTemplates','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercompleteAt'];(function(_0x624185,_0x3becbf){var _0x1c08c4=function(_0x2df663){while(--_0x2df663){_0x624185['push'](_0x624185['shift']());}};_0x1c08c4(++_0x3becbf);}(_0x5da4,0x65));var _0x45da=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5da4[_0x167cc1];return _0x10bc4b;};'use strict';var BPromise=require('bluebird');var util=require(_0x45da('0x0'));var _=require(_0x45da('0x1'));var moment=require(_0x45da('0x2'));var Agent=require(_0x45da('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0x45da('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x45da('0x5'));var Campaign=require(_0x45da('0x6'));var VoiceExtension=require(_0x45da('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x45da('0x8'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x45da('0x9'));var DeskAccount=require(_0x45da('0xa'));var VtigerAccount=require(_0x45da('0xb'));var FaxAccount=require(_0x45da('0xc'));var Realtime=function(){this['agents']={};this[_0x45da('0xd')]={};this[_0x45da('0xe')]={};this['voiceQueues']={};this['triggers']={};this[_0x45da('0xf')]={};this[_0x45da('0x10')]={};this[_0x45da('0x11')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x45da('0x12')]={};this[_0x45da('0x13')]={};this[_0x45da('0x14')]={};this['timers']={};this[_0x45da('0x15')]={};this[_0x45da('0x16')]={};this[_0x45da('0x17')]={};this[_0x45da('0x18')]={};this[_0x45da('0x19')]={};this[_0x45da('0x1a')]={};this[_0x45da('0x1b')]={};this[_0x45da('0x1c')]={};};function freeIsNotKey(_0x234aaf,_0x490b71,_0x1ab08d){var _0x346794=_[_0x45da('0x1d')](_0x234aaf,function(_0x59cfed,_0x3021d5){return _0x59cfed[_0x1ab08d];});for(var _0x26409a in _0x490b71){if(_0x490b71[_0x45da('0x1e')](_0x26409a)){if(!_0x346794[_0x26409a]){delete _0x490b71[_0x26409a];}}}}function freeIsNotKeySip(_0x238059,_0x2e9f78){var _0x462f42=_[_0x45da('0x1d')](_0x238059,function(_0x3cf9d2,_0x336f0f){return util['format'](_0x45da('0x1f'),_0x3cf9d2[_0x45da('0x20')]);});for(var _0xbb8d03 in _0x2e9f78){if(_0x2e9f78[_0x45da('0x1e')](_0xbb8d03)){if(!_0x462f42[_0xbb8d03]){delete _0x2e9f78[_0xbb8d03];}}}}function clearVoiceCallReports(_0x36819a){_0x36819a[_0x45da('0x21')]=0x0;_0x36819a[_0x45da('0x22')]=0x0;_0x36819a[_0x45da('0x23')]=0x0;_0x36819a[_0x45da('0x24')]=0x0;_0x36819a[_0x45da('0x25')]=0x0;}function clearCampaigns(_0x38e842){if(!_['isEmpty'](_0x38e842)){for(var _0x10080b in _0x38e842){if(_0x38e842[_0x45da('0x1e')](_0x10080b)){_0x38e842[_0x10080b][_0x45da('0x26')]=0x0;_0x38e842[_0x10080b][_0x45da('0x27')]=0x0;}}}}function clearVoiceQueues(_0x101f85){if(!_['isEmpty'](_0x101f85)){for(var _0x4cac92 in _0x101f85){if(_0x101f85[_0x45da('0x1e')](_0x4cac92)){_0x101f85[_0x4cac92]['total']=0x0;_0x101f85[_0x4cac92][_0x45da('0x22')]=0x0;_0x101f85[_0x4cac92]['unmanaged']=0x0;_0x101f85[_0x4cac92][_0x45da('0x23')]=0x0;_0x101f85[_0x4cac92][_0x45da('0x24')]=0x0;_0x101f85[_0x4cac92]['sumBillable']=0x0;_0x101f85[_0x4cac92][_0x45da('0x28')]=0x0;_0x101f85[_0x4cac92]['outboundNoAnswerCallsDay']=0x0;_0x101f85[_0x4cac92]['outboundBusyCallsDay']=0x0;_0x101f85[_0x4cac92]['outboundCongestionCallsDay']=0x0;_0x101f85[_0x4cac92][_0x45da('0x29')]=0x0;_0x101f85[_0x4cac92][_0x45da('0x2a')]=0x0;_0x101f85[_0x4cac92][_0x45da('0x2b')]=0x0;_0x101f85[_0x4cac92][_0x45da('0x2c')]=0x0;_0x101f85[_0x4cac92]['outboundBlacklistCallsDay']=0x0;_0x101f85[_0x4cac92]['outboundOriginateFailureCallsDay']=0x0;_0x101f85[_0x4cac92][_0x45da('0x2d')]=0x0;_0x101f85[_0x4cac92][_0x45da('0x2e')]=0x0;_0x101f85[_0x4cac92][_0x45da('0x28')]=0x0;_0x101f85[_0x4cac92][_0x45da('0x2f')]=0x0;_0x101f85[_0x4cac92]['queueStatusComplete']=!![];}}}}Realtime[_0x45da('0x30')]['mergeFromDatabase']=function(_0x3ecef1,_0x53b8c0){for(var _0x544c94 in _0x53b8c0){if(_0x3ecef1[_0x45da('0x1e')](_0x544c94)){_0x3ecef1[_0x544c94]=_0x53b8c0[_0x544c94];}}};Realtime[_0x45da('0x30')][_0x45da('0x31')]=function(){var _0x2f012f=this;return function(_0x405158){if(_0x405158){freeIsNotKeySip(_0x405158,_0x2f012f[_0x45da('0x32')]);for(var _0x4e7e68=0x0,_0x5e6a86={},_0x49b5b7={};_0x4e7e68<_0x405158[_0x45da('0x33')];_0x4e7e68+=0x1){_0x5e6a86=_0x405158[_0x4e7e68];if(_['isUndefined'](_0x2f012f['agents'][util[_0x45da('0x34')](_0x45da('0x1f'),_0x5e6a86[_0x45da('0x20')])])){_0x2f012f[_0x45da('0x32')][util[_0x45da('0x34')](_0x45da('0x1f'),_0x5e6a86[_0x45da('0x20')])]=new Agent(_0x5e6a86);}else{_0x2f012f['mergeFromDatabase'](_0x2f012f[_0x45da('0x32')][util['format'](_0x45da('0x1f'),_0x5e6a86['name'])],_0x5e6a86);}}}return _0x2f012f['agents'];};};Realtime[_0x45da('0x30')]['initTelephones']=function(){var _0x35aacc=this;return function(_0x54404a){if(_0x54404a){freeIsNotKeySip(_0x54404a,_0x35aacc[_0x45da('0xd')]);for(var _0x542a56=0x0,_0x2242a8={},_0x16afcb={};_0x542a56<_0x54404a['length'];_0x542a56+=0x1){_0x2242a8=_0x54404a[_0x542a56];if(_[_0x45da('0x35')](_0x35aacc[_0x45da('0xd')][util[_0x45da('0x34')]('SIP/%s',_0x2242a8[_0x45da('0x20')])])){_0x35aacc[_0x45da('0xd')][util[_0x45da('0x34')](_0x45da('0x1f'),_0x2242a8['name'])]=new Telephone(_0x2242a8);}else{_0x35aacc[_0x45da('0x36')](_0x35aacc[_0x45da('0xd')][util['format'](_0x45da('0x1f'),_0x2242a8[_0x45da('0x20')])],_0x2242a8);}}}return _0x35aacc[_0x45da('0xd')];};};Realtime[_0x45da('0x30')][_0x45da('0x37')]=function(){var _0xf48c22=this;return function(_0x1bd3bb){if(_0x1bd3bb){freeIsNotKeySip(_0x1bd3bb,_0xf48c22[_0x45da('0xe')]);for(var _0x55ef98=0x0,_0x4d8d28={},_0x5c023e={};_0x55ef98<_0x1bd3bb['length'];_0x55ef98+=0x1){_0x4d8d28=_0x1bd3bb[_0x55ef98];if(_['isUndefined'](_0xf48c22[_0x45da('0xe')][util[_0x45da('0x34')]('SIP/%s',_0x4d8d28[_0x45da('0x20')])])){_0xf48c22['trunks'][util['format'](_0x45da('0x1f'),_0x4d8d28['name'])]=new Trunk(_0x4d8d28);}else{_0xf48c22[_0x45da('0x36')](_0xf48c22[_0x45da('0xe')][util[_0x45da('0x34')]('SIP/%s',_0x4d8d28[_0x45da('0x20')])],_0x4d8d28);}}}return _0xf48c22['trunks'];};};Realtime[_0x45da('0x30')]['initVoiceQueues']=function(){var _0x9ba96=this;return function(_0x54dac8){if(_0x54dac8){freeIsNotKey(_0x54dac8,_0x9ba96[_0x45da('0x38')],_0x45da('0x20'));for(var _0x33c3ae=0x0,_0xf2f73c={},_0x2a08dd={};_0x33c3ae<_0x54dac8[_0x45da('0x33')];_0x33c3ae+=0x1){_0xf2f73c=_0x54dac8[_0x33c3ae];if(_['isUndefined'](_0x9ba96[_0x45da('0x38')][_0xf2f73c['name']])){_0x9ba96[_0x45da('0x38')][_0xf2f73c['name']]=new VoiceQueue(_0xf2f73c);}else{_0x9ba96[_0x45da('0x36')](_0x9ba96[_0x45da('0x38')][_0xf2f73c[_0x45da('0x20')]],_0xf2f73c);}}}return _0x9ba96[_0x45da('0x38')];};};Realtime[_0x45da('0x30')][_0x45da('0x39')]=function(){var _0x1aa5ae=this;return function(_0x5ae64a){if(_0x5ae64a){freeIsNotKey(_0x5ae64a,_0x1aa5ae[_0x45da('0x3a')],'id');for(var _0x3a923d=0x0,_0x2ebf80={},_0x103992={};_0x3a923d<_0x5ae64a[_0x45da('0x33')];_0x3a923d+=0x1){_0x2ebf80=_0x5ae64a[_0x3a923d];if(_[_0x45da('0x35')](_0x1aa5ae[_0x45da('0x3a')][_0x2ebf80['id']])){_0x1aa5ae[_0x45da('0x3a')][_0x2ebf80['id']]=new Trigger(_0x2ebf80);}else{_0x1aa5ae[_0x45da('0x36')](_0x1aa5ae[_0x45da('0x3a')][_0x2ebf80['id']],_0x2ebf80);}}}return _0x1aa5ae[_0x45da('0x3a')];};};Realtime[_0x45da('0x30')][_0x45da('0x3b')]=function(){var _0x483388=this;return function(_0x394d5a){if(_0x394d5a){freeIsNotKey(_0x394d5a,_0x483388['templates'],'id');for(var _0x37f9b9=0x0,_0x5580aa={},_0x25e967={};_0x37f9b9<_0x394d5a[_0x45da('0x33')];_0x37f9b9+=0x1){_0x5580aa=_0x394d5a[_0x37f9b9];if(_['isUndefined'](_0x483388[_0x45da('0x10')][_0x5580aa['id']])){_0x483388[_0x45da('0x10')][_0x5580aa['id']]=new Template(_0x5580aa);}else{_0x483388[_0x45da('0x36')](_0x483388[_0x45da('0x10')][_0x5580aa['id']],_0x5580aa);}}}return _0x483388['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x53ef3c=this;return function(_0x3b9c4b){if(_0x3b9c4b){freeIsNotKey(_0x3b9c4b,_0x53ef3c[_0x45da('0x15')],'id');for(var _0x42cf17=0x0,_0x442e74={},_0x1a6741={};_0x42cf17<_0x3b9c4b[_0x45da('0x33')];_0x42cf17+=0x1){_0x442e74=_0x3b9c4b[_0x42cf17];if(_[_0x45da('0x35')](_0x53ef3c[_0x45da('0x15')][_0x442e74['id']])){_0x53ef3c[_0x45da('0x15')][_0x442e74['id']]=new ZendeskAccount(_0x442e74);}else{_0x53ef3c['mergeFromDatabase'](_0x53ef3c['zendeskAccounts'][_0x442e74['id']],_0x442e74);}}}return _0x53ef3c[_0x45da('0x15')];};};Realtime[_0x45da('0x30')][_0x45da('0x3c')]=function(){var _0x491663=this;return function(_0xe609f3){if(_0xe609f3){freeIsNotKey(_0xe609f3,_0x491663[_0x45da('0x16')],'id');for(var _0x157fb0=0x0,_0x4530be={},_0x5b863c={};_0x157fb0<_0xe609f3[_0x45da('0x33')];_0x157fb0+=0x1){_0x4530be=_0xe609f3[_0x157fb0];if(_[_0x45da('0x35')](_0x491663[_0x45da('0x16')][_0x4530be['id']])){_0x491663[_0x45da('0x16')][_0x4530be['id']]=new SalesforceAccount(_0x4530be);}else{_0x491663['mergeFromDatabase'](_0x491663['salesforceAccounts'][_0x4530be['id']],_0x4530be);}}}return _0x491663[_0x45da('0x16')];};};Realtime[_0x45da('0x30')]['initFreshdeskAccounts']=function(){var _0x24da18=this;return function(_0x246375){if(_0x246375){freeIsNotKey(_0x246375,_0x24da18['freshdeskAccounts'],'id');for(var _0x525161=0x0,_0x3c1370={},_0x33913f={};_0x525161<_0x246375[_0x45da('0x33')];_0x525161+=0x1){_0x3c1370=_0x246375[_0x525161];if(_[_0x45da('0x35')](_0x24da18[_0x45da('0x18')][_0x3c1370['id']])){_0x24da18[_0x45da('0x18')][_0x3c1370['id']]=new FreshdeskAccount(_0x3c1370);}else{_0x24da18[_0x45da('0x36')](_0x24da18['freshdeskAccounts'][_0x3c1370['id']],_0x3c1370);}}}return _0x24da18[_0x45da('0x18')];};};Realtime[_0x45da('0x30')][_0x45da('0x3d')]=function(){var _0xb1ca5=this;return function(_0x6c041d){if(_0x6c041d){freeIsNotKey(_0x6c041d,_0xb1ca5[_0x45da('0x19')],'id');for(var _0x486fcc=0x0,_0x156433={},_0x5cb669={};_0x486fcc<_0x6c041d[_0x45da('0x33')];_0x486fcc+=0x1){_0x156433=_0x6c041d[_0x486fcc];if(_['isUndefined'](_0xb1ca5[_0x45da('0x19')][_0x156433['id']])){_0xb1ca5[_0x45da('0x19')][_0x156433['id']]=new ZohoAccount(_0x156433);}else{_0xb1ca5[_0x45da('0x36')](_0xb1ca5[_0x45da('0x19')][_0x156433['id']],_0x156433);}}}return _0xb1ca5[_0x45da('0x19')];};};Realtime[_0x45da('0x30')][_0x45da('0x3e')]=function(){var _0x80db95=this;return function(_0xc2c33f){if(_0xc2c33f){freeIsNotKey(_0xc2c33f,_0x80db95[_0x45da('0x1a')],'id');for(var _0x817776=0x0,_0x17d233={},_0x41ca53={};_0x817776<_0xc2c33f['length'];_0x817776+=0x1){_0x17d233=_0xc2c33f[_0x817776];if(_['isUndefined'](_0x80db95['deskAccounts'][_0x17d233['id']])){_0x80db95[_0x45da('0x1a')][_0x17d233['id']]=new DeskAccount(_0x17d233);}else{_0x80db95[_0x45da('0x36')](_0x80db95[_0x45da('0x1a')][_0x17d233['id']],_0x17d233);}}}return _0x80db95['deskAccounts'];};};Realtime['prototype'][_0x45da('0x3f')]=function(){var _0x5f27d0=this;return function(_0x86a0c2){if(_0x86a0c2){freeIsNotKey(_0x86a0c2,_0x5f27d0[_0x45da('0x17')],'id');for(var _0x9e5ea9=0x0,_0x323c5d={},_0x30599f={};_0x9e5ea9<_0x86a0c2[_0x45da('0x33')];_0x9e5ea9+=0x1){_0x323c5d=_0x86a0c2[_0x9e5ea9];if(_[_0x45da('0x35')](_0x5f27d0[_0x45da('0x17')][_0x323c5d['id']])){_0x5f27d0[_0x45da('0x17')][_0x323c5d['id']]=new SugarcrmAccount(_0x323c5d);}else{_0x5f27d0[_0x45da('0x36')](_0x5f27d0[_0x45da('0x17')][_0x323c5d['id']],_0x323c5d);}}}return _0x5f27d0[_0x45da('0x17')];};};Realtime[_0x45da('0x30')][_0x45da('0x40')]=function(){var _0x4fd240=this;return function(_0x37d15b){if(_0x37d15b){freeIsNotKey(_0x37d15b,_0x4fd240[_0x45da('0x1b')],'id');for(var _0xed11a4=0x0,_0x479261={},_0x1494dc={};_0xed11a4<_0x37d15b[_0x45da('0x33')];_0xed11a4+=0x1){_0x479261=_0x37d15b[_0xed11a4];if(_['isUndefined'](_0x4fd240[_0x45da('0x1b')][_0x479261['id']])){_0x4fd240[_0x45da('0x1b')][_0x479261['id']]=new VtigerAccount(_0x479261);}else{_0x4fd240[_0x45da('0x36')](_0x4fd240['vtigerAccounts'][_0x479261['id']],_0x479261);}}}return _0x4fd240[_0x45da('0x1b')];};};Realtime[_0x45da('0x30')][_0x45da('0x41')]=function(){var _0x3e7177=this;return function(_0xc3a5a){for(var _0xa3a209=0x0;_0xa3a209<_0xc3a5a[_0x45da('0x33')];_0xa3a209+=0x1){_[_0x45da('0x42')](_0x3e7177[_0x45da('0x38')][_0xc3a5a[_0xa3a209][_0x45da('0x20')]],_0xc3a5a[_0xa3a209]);}return _0x3e7177[_0x45da('0x38')];};};Realtime[_0x45da('0x30')][_0x45da('0x43')]=function(){var _0x1dd82f=this;return function(_0x3b7d4f){clearVoiceQueues(_0x1dd82f['voiceQueues']);if(_0x3b7d4f){_0x3b7d4f=_[_0x45da('0x44')](_0x3b7d4f,_0x45da('0x45'));for(var _0x3d4449 in _0x3b7d4f){if(_0x3b7d4f[_0x45da('0x1e')](_0x3d4449)){var _0x5441be={};for(var _0x1d6d2c=0x0;_0x1d6d2c<_0x3b7d4f[_0x3d4449][_0x45da('0x33')];_0x1d6d2c+=0x1){var _0x519405=_0x3b7d4f[_0x3d4449][_0x1d6d2c][_0x45da('0x46')];if(_0x1dd82f[_0x45da('0x38')][_0x519405]){if(_0x3b7d4f[_0x3d4449][_0x1d6d2c][_0x45da('0x47')]){_0x1dd82f[_0x45da('0x38')][_0x519405][_0x45da('0x48')]+=0x1;}_0x1dd82f['voiceQueues'][_0x519405][_0x45da('0x23')]+=moment(_0x3b7d4f[_0x3d4449][_0x1d6d2c]['queuecallerleaveAt'])[_0x45da('0x49')](moment(_0x3b7d4f[_0x3d4449][_0x1d6d2c][_0x45da('0x4a')]),_0x45da('0x4b'))||0x0;if(_0x1d6d2c===_0x3b7d4f[_0x3d4449][_0x45da('0x33')]-0x1){_0x1dd82f[_0x45da('0x38')][_0x519405]['sumDuration']+=moment(_0x3b7d4f[_0x3d4449][_0x1d6d2c]['queuecallercompleteAt']||_0x3b7d4f[_0x3d4449][_0x1d6d2c][_0x45da('0x4c')]||_0x3b7d4f[_0x3d4449][_0x1d6d2c][_0x45da('0x4d')])[_0x45da('0x49')](moment(_0x3b7d4f[_0x3d4449][_0x1d6d2c][_0x45da('0x4a')]),_0x45da('0x4b'))||0x0;_0x1dd82f[_0x45da('0x38')][_0x519405][_0x45da('0x21')]+=0x1;if(_0x3b7d4f[_0x3d4449][_0x1d6d2c]['queuecallercomplete']){_0x1dd82f[_0x45da('0x38')][_0x519405][_0x45da('0x22')]+=0x1;_0x1dd82f['voiceQueues'][_0x519405][_0x45da('0x25')]+=moment(_0x3b7d4f[_0x3d4449][_0x1d6d2c][_0x45da('0x4e')])[_0x45da('0x49')](moment(_0x3b7d4f[_0x3d4449][_0x1d6d2c][_0x45da('0x4f')]),'seconds')||0x0;}}else{_0x1dd82f[_0x45da('0x38')][_0x519405][_0x45da('0x24')]+=_0x1dd82f['voiceQueues'][_0x519405]['sumHoldTime']||0x0;}}}}}}return _0x1dd82f[_0x45da('0x38')];};};Realtime[_0x45da('0x30')][_0x45da('0x50')]=function(){var _0x404e0a=this;return function(_0x12c910){clearVoiceCallReports(_0x404e0a[_0x45da('0x11')]);if(_0x12c910){for(var _0x5f199a=0x0;_0x5f199a<_0x12c910[_0x45da('0x33')];_0x5f199a+=0x1){_0x404e0a[_0x45da('0x11')][_0x45da('0x21')]+=0x1;_0x404e0a[_0x45da('0x11')][_0x45da('0x24')]+=_0x12c910[_0x5f199a]['duration'];if(_0x12c910[_0x5f199a][_0x45da('0x51')]==='ANSWERED'){_0x404e0a[_0x45da('0x11')][_0x45da('0x22')]+=0x1;_0x404e0a[_0x45da('0x11')]['sumHoldTime']+=_0x12c910[_0x5f199a][_0x45da('0x52')]-_0x12c910[_0x5f199a]['billableseconds']||0x0;_0x404e0a[_0x45da('0x11')]['sumBillable']+=_0x12c910[_0x5f199a][_0x45da('0x53')];}}}return _0x404e0a[_0x45da('0x11')];};};Realtime[_0x45da('0x30')][_0x45da('0x54')]=function(){var _0x15efbc=this;return function(_0x358a29){if(_0x358a29){freeIsNotKey(_0x358a29,_0x15efbc[_0x45da('0xf')],'name');for(var _0x5cd2bc=0x0,_0x85684b={};_0x5cd2bc<_0x358a29[_0x45da('0x33')];_0x5cd2bc+=0x1){_0x85684b=_0x358a29[_0x5cd2bc];if(_[_0x45da('0x35')](_0x15efbc[_0x45da('0xf')][_0x85684b[_0x45da('0x20')]])){_0x15efbc[_0x45da('0xf')][_0x85684b[_0x45da('0x20')]]=new Campaign(_0x85684b);}else{_0x15efbc['mergeFromDatabase'](_0x15efbc['campaigns'][_0x85684b['name']],_0x85684b);}}}return _0x15efbc['campaigns'];};};Realtime['prototype'][_0x45da('0x55')]=function(){var _0xa50a0c=this;return function(_0x2c2dd7){if(_0x2c2dd7){freeIsNotKey(_0x2c2dd7,_0xa50a0c['voiceExtensions'],'id');for(var _0x5ae533=0x0,_0x244658={};_0x5ae533<_0x2c2dd7[_0x45da('0x33')];_0x5ae533+=0x1){_0x244658=_0x2c2dd7[_0x5ae533];if(_[_0x45da('0x35')](_0xa50a0c[_0x45da('0x56')][_0x244658['id']])){_0xa50a0c['voiceExtensions'][_0x244658['id']]=new VoiceExtension(_0x244658);}else{_0xa50a0c[_0x45da('0x36')](_0xa50a0c[_0x45da('0x56')][_0x244658['id']],_0x244658);}}}return _0xa50a0c[_0x45da('0x56')];};};Realtime[_0x45da('0x30')][_0x45da('0x57')]=function(){var _0x5bbe1e=this;return function(_0x2d033e){clearCampaigns(_0x5bbe1e[_0x45da('0xf')]);for(var _0xa99cbf=0x0;_0xa99cbf<_0x2d033e[_0x45da('0x33')];_0xa99cbf+=0x1){_[_0x45da('0x42')](_0x5bbe1e[_0x45da('0xf')][_0x2d033e[_0xa99cbf]['name']],_0x2d033e[_0xa99cbf]);}return _0x5bbe1e[_0x45da('0xf')];};};Realtime['prototype'][_0x45da('0x58')]=function(){var _0x5ba5ae=this;return function(_0x1082b6){if(_0x1082b6){freeIsNotKey(_0x1082b6,_0x5ba5ae[_0x45da('0x1c')],'id');for(var _0x263f20=0x0,_0x27d781={},_0x3e1aff={};_0x263f20<_0x1082b6['length'];_0x263f20+=0x1){_0x27d781=_0x1082b6[_0x263f20];if(_['isUndefined'](_0x5ba5ae['faxAccounts'][_0x27d781['id']])){_0x5ba5ae[_0x45da('0x1c')][_0x27d781['id']]=new FaxAccount(_0x27d781);}else{_0x5ba5ae['mergeFromDatabase'](_0x5ba5ae[_0x45da('0x1c')][_0x27d781['id']],_0x27d781);}}}return _0x5ba5ae[_0x45da('0x1c')];};};module[_0x45da('0x59')]=Realtime; \ No newline at end of file +var _0xe620=['../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','total','sumHoldTime','isEmpty','ivrTotalCallsDays','answered','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','name','initTelephones','isUndefined','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerleaveAt','diff','seconds','sumDuration','queuecallerexitAt','queuecallerjoinAt','queuecallercompleteAt','duration','disposition','billableseconds','initCampaigns','campaigns','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger'];(function(_0x276bc4,_0x580a50){var _0x2874b1=function(_0x1925d0){while(--_0x1925d0){_0x276bc4['push'](_0x276bc4['shift']());}};_0x2874b1(++_0x580a50);}(_0xe620,0x171));var _0x0e62=function(_0x5a3ba1,_0x23c154){_0x5a3ba1=_0x5a3ba1-0x0;var _0x5dcc34=_0xe620[_0x5a3ba1];return _0x5dcc34;};'use strict';var BPromise=require(_0x0e62('0x0'));var util=require('util');var _=require(_0x0e62('0x1'));var moment=require(_0x0e62('0x2'));var Agent=require(_0x0e62('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x0e62('0x4'));var VoiceQueue=require(_0x0e62('0x5'));var Trigger=require(_0x0e62('0x6'));var Template=require(_0x0e62('0x7'));var Campaign=require(_0x0e62('0x8'));var VoiceExtension=require(_0x0e62('0x9'));var ZendeskAccount=require(_0x0e62('0xa'));var SalesforceAccount=require(_0x0e62('0xb'));var FreshdeskAccount=require(_0x0e62('0xc'));var SugarcrmAccount=require(_0x0e62('0xd'));var ZohoAccount=require(_0x0e62('0xe'));var DeskAccount=require(_0x0e62('0xf'));var VtigerAccount=require(_0x0e62('0x10'));var FaxAccount=require(_0x0e62('0x11'));var Realtime=function(){this[_0x0e62('0x12')]={};this[_0x0e62('0x13')]={};this[_0x0e62('0x14')]={};this[_0x0e62('0x15')]={};this[_0x0e62('0x16')]={};this['campaigns']={};this['templates']={};this[_0x0e62('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x0e62('0x18')]={};this[_0x0e62('0x19')]={};this[_0x0e62('0x1a')]={};this[_0x0e62('0x1b')]={};this[_0x0e62('0x1c')]={};this[_0x0e62('0x1d')]={};this[_0x0e62('0x1e')]={};this['sugarcrmAccounts']={};this[_0x0e62('0x1f')]={};this[_0x0e62('0x20')]={};this['deskAccounts']={};this[_0x0e62('0x21')]={};this[_0x0e62('0x22')]={};};function freeIsNotKey(_0x1d411b,_0x11f001,_0x592d19){var _0x108fad=_[_0x0e62('0x23')](_0x1d411b,function(_0x118339,_0x25998d){return _0x118339[_0x592d19];});for(var _0x2112dd in _0x11f001){if(_0x11f001[_0x0e62('0x24')](_0x2112dd)){if(!_0x108fad[_0x2112dd]){delete _0x11f001[_0x2112dd];}}}}function freeIsNotKeySip(_0xb0be4c,_0x333d07){var _0x48f29c=_[_0x0e62('0x23')](_0xb0be4c,function(_0x515749,_0x8231ba){return util[_0x0e62('0x25')](_0x0e62('0x26'),_0x515749['name']);});for(var _0x245e94 in _0x333d07){if(_0x333d07['hasOwnProperty'](_0x245e94)){if(!_0x48f29c[_0x245e94]){delete _0x333d07[_0x245e94];}}}}function clearVoiceCallReports(_0x236876){_0x236876[_0x0e62('0x27')]=0x0;_0x236876['answered']=0x0;_0x236876[_0x0e62('0x28')]=0x0;_0x236876['sumDuration']=0x0;_0x236876['sumBillable']=0x0;}function clearCampaigns(_0x328577){if(!_[_0x0e62('0x29')](_0x328577)){for(var _0x15265a in _0x328577){if(_0x328577[_0x0e62('0x24')](_0x15265a)){_0x328577[_0x15265a][_0x0e62('0x2a')]=0x0;_0x328577[_0x15265a]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x39fdc1){if(!_['isEmpty'](_0x39fdc1)){for(var _0x4eee12 in _0x39fdc1){if(_0x39fdc1[_0x0e62('0x24')](_0x4eee12)){_0x39fdc1[_0x4eee12][_0x0e62('0x27')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x2b')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x2c')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x28')]=0x0;_0x39fdc1[_0x4eee12]['sumDuration']=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x2d')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x2e')]=0x0;_0x39fdc1[_0x4eee12]['outboundNoAnswerCallsDay']=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x2f')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x30')]=0x0;_0x39fdc1[_0x4eee12]['outboundNoSuchCallsDay']=0x0;_0x39fdc1[_0x4eee12]['outboundUnknownCallsDay']=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x31')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x32')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x33')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x34')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x35')]=0x0;_0x39fdc1[_0x4eee12]['outboundReCallsDay']=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x2e')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x36')]=0x0;_0x39fdc1[_0x4eee12][_0x0e62('0x37')]=!![];}}}}Realtime[_0x0e62('0x38')][_0x0e62('0x39')]=function(_0x7b45ce,_0x4a167f){for(var _0x59bc86 in _0x4a167f){if(_0x7b45ce[_0x0e62('0x24')](_0x59bc86)){_0x7b45ce[_0x59bc86]=_0x4a167f[_0x59bc86];}}};Realtime[_0x0e62('0x38')][_0x0e62('0x3a')]=function(){var _0x2789d6=this;return function(_0x1f857a){if(_0x1f857a){freeIsNotKeySip(_0x1f857a,_0x2789d6[_0x0e62('0x12')]);for(var _0x16a46a=0x0,_0x62245e={},_0x20de35={};_0x16a46a<_0x1f857a[_0x0e62('0x3b')];_0x16a46a+=0x1){_0x62245e=_0x1f857a[_0x16a46a];if(_['isUndefined'](_0x2789d6[_0x0e62('0x12')][util[_0x0e62('0x25')](_0x0e62('0x26'),_0x62245e[_0x0e62('0x3c')])])){_0x2789d6['agents'][util[_0x0e62('0x25')](_0x0e62('0x26'),_0x62245e[_0x0e62('0x3c')])]=new Agent(_0x62245e);}else{_0x2789d6[_0x0e62('0x39')](_0x2789d6[_0x0e62('0x12')][util[_0x0e62('0x25')](_0x0e62('0x26'),_0x62245e[_0x0e62('0x3c')])],_0x62245e);}}}return _0x2789d6[_0x0e62('0x12')];};};Realtime[_0x0e62('0x38')][_0x0e62('0x3d')]=function(){var _0x2e4204=this;return function(_0x2f0265){if(_0x2f0265){freeIsNotKeySip(_0x2f0265,_0x2e4204[_0x0e62('0x13')]);for(var _0x149c59=0x0,_0x480c1f={},_0x19a390={};_0x149c59<_0x2f0265[_0x0e62('0x3b')];_0x149c59+=0x1){_0x480c1f=_0x2f0265[_0x149c59];if(_[_0x0e62('0x3e')](_0x2e4204[_0x0e62('0x13')][util[_0x0e62('0x25')](_0x0e62('0x26'),_0x480c1f[_0x0e62('0x3c')])])){_0x2e4204['telephones'][util[_0x0e62('0x25')](_0x0e62('0x26'),_0x480c1f[_0x0e62('0x3c')])]=new Telephone(_0x480c1f);}else{_0x2e4204[_0x0e62('0x39')](_0x2e4204[_0x0e62('0x13')][util[_0x0e62('0x25')]('SIP/%s',_0x480c1f['name'])],_0x480c1f);}}}return _0x2e4204[_0x0e62('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x1d203d=this;return function(_0x155b81){if(_0x155b81){freeIsNotKeySip(_0x155b81,_0x1d203d[_0x0e62('0x14')]);for(var _0x167495=0x0,_0x280068={},_0x2376a5={};_0x167495<_0x155b81[_0x0e62('0x3b')];_0x167495+=0x1){_0x280068=_0x155b81[_0x167495];if(_[_0x0e62('0x3e')](_0x1d203d[_0x0e62('0x14')][util['format']('SIP/%s',_0x280068[_0x0e62('0x3c')])])){_0x1d203d[_0x0e62('0x14')][util[_0x0e62('0x25')](_0x0e62('0x26'),_0x280068[_0x0e62('0x3c')])]=new Trunk(_0x280068);}else{_0x1d203d['mergeFromDatabase'](_0x1d203d[_0x0e62('0x14')][util[_0x0e62('0x25')](_0x0e62('0x26'),_0x280068['name'])],_0x280068);}}}return _0x1d203d[_0x0e62('0x14')];};};Realtime[_0x0e62('0x38')][_0x0e62('0x3f')]=function(){var _0xe43c28=this;return function(_0x5b8413){if(_0x5b8413){freeIsNotKey(_0x5b8413,_0xe43c28['voiceQueues'],_0x0e62('0x3c'));for(var _0x3e79b0=0x0,_0x3a0d61={},_0x3c2f8f={};_0x3e79b0<_0x5b8413[_0x0e62('0x3b')];_0x3e79b0+=0x1){_0x3a0d61=_0x5b8413[_0x3e79b0];if(_[_0x0e62('0x3e')](_0xe43c28['voiceQueues'][_0x3a0d61[_0x0e62('0x3c')]])){_0xe43c28['voiceQueues'][_0x3a0d61[_0x0e62('0x3c')]]=new VoiceQueue(_0x3a0d61);}else{_0xe43c28[_0x0e62('0x39')](_0xe43c28[_0x0e62('0x15')][_0x3a0d61[_0x0e62('0x3c')]],_0x3a0d61);}}}return _0xe43c28[_0x0e62('0x15')];};};Realtime[_0x0e62('0x38')][_0x0e62('0x40')]=function(){var _0x3d127d=this;return function(_0x120ef9){if(_0x120ef9){freeIsNotKey(_0x120ef9,_0x3d127d[_0x0e62('0x16')],'id');for(var _0x310963=0x0,_0x50fe71={},_0x479f0b={};_0x310963<_0x120ef9[_0x0e62('0x3b')];_0x310963+=0x1){_0x50fe71=_0x120ef9[_0x310963];if(_['isUndefined'](_0x3d127d[_0x0e62('0x16')][_0x50fe71['id']])){_0x3d127d['triggers'][_0x50fe71['id']]=new Trigger(_0x50fe71);}else{_0x3d127d[_0x0e62('0x39')](_0x3d127d[_0x0e62('0x16')][_0x50fe71['id']],_0x50fe71);}}}return _0x3d127d[_0x0e62('0x16')];};};Realtime['prototype'][_0x0e62('0x41')]=function(){var _0x25e09e=this;return function(_0xa76194){if(_0xa76194){freeIsNotKey(_0xa76194,_0x25e09e['templates'],'id');for(var _0x133d71=0x0,_0x19671c={},_0x392871={};_0x133d71<_0xa76194['length'];_0x133d71+=0x1){_0x19671c=_0xa76194[_0x133d71];if(_[_0x0e62('0x3e')](_0x25e09e[_0x0e62('0x42')][_0x19671c['id']])){_0x25e09e[_0x0e62('0x42')][_0x19671c['id']]=new Template(_0x19671c);}else{_0x25e09e[_0x0e62('0x39')](_0x25e09e[_0x0e62('0x42')][_0x19671c['id']],_0x19671c);}}}return _0x25e09e[_0x0e62('0x42')];};};Realtime['prototype'][_0x0e62('0x43')]=function(){var _0x558407=this;return function(_0x5c1f40){if(_0x5c1f40){freeIsNotKey(_0x5c1f40,_0x558407['zendeskAccounts'],'id');for(var _0x3228dc=0x0,_0x55e126={},_0x5e0b63={};_0x3228dc<_0x5c1f40[_0x0e62('0x3b')];_0x3228dc+=0x1){_0x55e126=_0x5c1f40[_0x3228dc];if(_[_0x0e62('0x3e')](_0x558407[_0x0e62('0x1d')][_0x55e126['id']])){_0x558407[_0x0e62('0x1d')][_0x55e126['id']]=new ZendeskAccount(_0x55e126);}else{_0x558407[_0x0e62('0x39')](_0x558407[_0x0e62('0x1d')][_0x55e126['id']],_0x55e126);}}}return _0x558407[_0x0e62('0x1d')];};};Realtime[_0x0e62('0x38')][_0x0e62('0x44')]=function(){var _0x598d8c=this;return function(_0x3f5015){if(_0x3f5015){freeIsNotKey(_0x3f5015,_0x598d8c[_0x0e62('0x1e')],'id');for(var _0x363f38=0x0,_0x5709ce={},_0x3f1445={};_0x363f38<_0x3f5015['length'];_0x363f38+=0x1){_0x5709ce=_0x3f5015[_0x363f38];if(_[_0x0e62('0x3e')](_0x598d8c[_0x0e62('0x1e')][_0x5709ce['id']])){_0x598d8c[_0x0e62('0x1e')][_0x5709ce['id']]=new SalesforceAccount(_0x5709ce);}else{_0x598d8c[_0x0e62('0x39')](_0x598d8c[_0x0e62('0x1e')][_0x5709ce['id']],_0x5709ce);}}}return _0x598d8c[_0x0e62('0x1e')];};};Realtime[_0x0e62('0x38')][_0x0e62('0x45')]=function(){var _0x6d7570=this;return function(_0x2a4ba9){if(_0x2a4ba9){freeIsNotKey(_0x2a4ba9,_0x6d7570[_0x0e62('0x1f')],'id');for(var _0x3e2cb1=0x0,_0x466fab={},_0x487d77={};_0x3e2cb1<_0x2a4ba9[_0x0e62('0x3b')];_0x3e2cb1+=0x1){_0x466fab=_0x2a4ba9[_0x3e2cb1];if(_[_0x0e62('0x3e')](_0x6d7570[_0x0e62('0x1f')][_0x466fab['id']])){_0x6d7570['freshdeskAccounts'][_0x466fab['id']]=new FreshdeskAccount(_0x466fab);}else{_0x6d7570['mergeFromDatabase'](_0x6d7570[_0x0e62('0x1f')][_0x466fab['id']],_0x466fab);}}}return _0x6d7570[_0x0e62('0x1f')];};};Realtime[_0x0e62('0x38')]['initZohoAccounts']=function(){var _0x5329ed=this;return function(_0x4ddebd){if(_0x4ddebd){freeIsNotKey(_0x4ddebd,_0x5329ed[_0x0e62('0x20')],'id');for(var _0x3927bb=0x0,_0xf42467={},_0x323142={};_0x3927bb<_0x4ddebd['length'];_0x3927bb+=0x1){_0xf42467=_0x4ddebd[_0x3927bb];if(_['isUndefined'](_0x5329ed['zohoAccounts'][_0xf42467['id']])){_0x5329ed[_0x0e62('0x20')][_0xf42467['id']]=new ZohoAccount(_0xf42467);}else{_0x5329ed['mergeFromDatabase'](_0x5329ed[_0x0e62('0x20')][_0xf42467['id']],_0xf42467);}}}return _0x5329ed[_0x0e62('0x20')];};};Realtime[_0x0e62('0x38')][_0x0e62('0x46')]=function(){var _0x6ccfd2=this;return function(_0x193b47){if(_0x193b47){freeIsNotKey(_0x193b47,_0x6ccfd2[_0x0e62('0x47')],'id');for(var _0x2ca2b6=0x0,_0x14ed24={},_0x3c744d={};_0x2ca2b6<_0x193b47[_0x0e62('0x3b')];_0x2ca2b6+=0x1){_0x14ed24=_0x193b47[_0x2ca2b6];if(_[_0x0e62('0x3e')](_0x6ccfd2[_0x0e62('0x47')][_0x14ed24['id']])){_0x6ccfd2[_0x0e62('0x47')][_0x14ed24['id']]=new DeskAccount(_0x14ed24);}else{_0x6ccfd2[_0x0e62('0x39')](_0x6ccfd2[_0x0e62('0x47')][_0x14ed24['id']],_0x14ed24);}}}return _0x6ccfd2['deskAccounts'];};};Realtime[_0x0e62('0x38')][_0x0e62('0x48')]=function(){var _0x326c53=this;return function(_0x28b2de){if(_0x28b2de){freeIsNotKey(_0x28b2de,_0x326c53[_0x0e62('0x49')],'id');for(var _0x34d06c=0x0,_0x3ba8ed={},_0x163d9a={};_0x34d06c<_0x28b2de[_0x0e62('0x3b')];_0x34d06c+=0x1){_0x3ba8ed=_0x28b2de[_0x34d06c];if(_['isUndefined'](_0x326c53[_0x0e62('0x49')][_0x3ba8ed['id']])){_0x326c53[_0x0e62('0x49')][_0x3ba8ed['id']]=new SugarcrmAccount(_0x3ba8ed);}else{_0x326c53[_0x0e62('0x39')](_0x326c53[_0x0e62('0x49')][_0x3ba8ed['id']],_0x3ba8ed);}}}return _0x326c53[_0x0e62('0x49')];};};Realtime[_0x0e62('0x38')][_0x0e62('0x4a')]=function(){var _0x1d8452=this;return function(_0x1c6a7d){if(_0x1c6a7d){freeIsNotKey(_0x1c6a7d,_0x1d8452[_0x0e62('0x21')],'id');for(var _0x2906ef=0x0,_0x16fc98={},_0x43b6ca={};_0x2906ef<_0x1c6a7d[_0x0e62('0x3b')];_0x2906ef+=0x1){_0x16fc98=_0x1c6a7d[_0x2906ef];if(_[_0x0e62('0x3e')](_0x1d8452[_0x0e62('0x21')][_0x16fc98['id']])){_0x1d8452[_0x0e62('0x21')][_0x16fc98['id']]=new VtigerAccount(_0x16fc98);}else{_0x1d8452[_0x0e62('0x39')](_0x1d8452['vtigerAccounts'][_0x16fc98['id']],_0x16fc98);}}}return _0x1d8452['vtigerAccounts'];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x55509c=this;return function(_0x3928b6){for(var _0x5ab792=0x0;_0x5ab792<_0x3928b6[_0x0e62('0x3b')];_0x5ab792+=0x1){_[_0x0e62('0x4b')](_0x55509c[_0x0e62('0x15')][_0x3928b6[_0x5ab792][_0x0e62('0x3c')]],_0x3928b6[_0x5ab792]);}return _0x55509c[_0x0e62('0x15')];};};Realtime[_0x0e62('0x38')][_0x0e62('0x4c')]=function(){var _0x3c083f=this;return function(_0x428c00){clearVoiceQueues(_0x3c083f[_0x0e62('0x15')]);if(_0x428c00){_0x428c00=_[_0x0e62('0x4d')](_0x428c00,_0x0e62('0x4e'));for(var _0x4845af in _0x428c00){if(_0x428c00[_0x0e62('0x24')](_0x4845af)){var _0xfedd4b={};for(var _0x11e5fe=0x0;_0x11e5fe<_0x428c00[_0x4845af][_0x0e62('0x3b')];_0x11e5fe+=0x1){var _0x1dfd01=_0x428c00[_0x4845af][_0x11e5fe]['queue'];if(_0x3c083f[_0x0e62('0x15')][_0x1dfd01]){if(_0x428c00[_0x4845af][_0x11e5fe][_0x0e62('0x4f')]){_0x3c083f[_0x0e62('0x15')][_0x1dfd01][_0x0e62('0x2c')]+=0x1;}_0x3c083f[_0x0e62('0x15')][_0x1dfd01]['sumHoldTime']+=moment(_0x428c00[_0x4845af][_0x11e5fe][_0x0e62('0x50')])[_0x0e62('0x51')](moment(_0x428c00[_0x4845af][_0x11e5fe]['queuecallerjoinAt']),_0x0e62('0x52'))||0x0;if(_0x11e5fe===_0x428c00[_0x4845af]['length']-0x1){_0x3c083f['voiceQueues'][_0x1dfd01][_0x0e62('0x53')]+=moment(_0x428c00[_0x4845af][_0x11e5fe]['queuecallercompleteAt']||_0x428c00[_0x4845af][_0x11e5fe]['queuecallerabandonAt']||_0x428c00[_0x4845af][_0x11e5fe][_0x0e62('0x54')])[_0x0e62('0x51')](moment(_0x428c00[_0x4845af][_0x11e5fe][_0x0e62('0x55')]),_0x0e62('0x52'))||0x0;_0x3c083f[_0x0e62('0x15')][_0x1dfd01]['total']+=0x1;if(_0x428c00[_0x4845af][_0x11e5fe]['queuecallercomplete']){_0x3c083f['voiceQueues'][_0x1dfd01][_0x0e62('0x2b')]+=0x1;_0x3c083f[_0x0e62('0x15')][_0x1dfd01]['sumBillable']+=moment(_0x428c00[_0x4845af][_0x11e5fe][_0x0e62('0x56')])[_0x0e62('0x51')](moment(_0x428c00[_0x4845af][_0x11e5fe][_0x0e62('0x50')]),_0x0e62('0x52'))||0x0;}}else{_0x3c083f['voiceQueues'][_0x1dfd01][_0x0e62('0x53')]+=_0x3c083f[_0x0e62('0x15')][_0x1dfd01][_0x0e62('0x28')]||0x0;}}}}}}return _0x3c083f[_0x0e62('0x15')];};};Realtime[_0x0e62('0x38')]['initVoiceCallReports']=function(){var _0x9242fd=this;return function(_0x5f0453){clearVoiceCallReports(_0x9242fd[_0x0e62('0x17')]);if(_0x5f0453){for(var _0x5cd00b=0x0;_0x5cd00b<_0x5f0453[_0x0e62('0x3b')];_0x5cd00b+=0x1){_0x9242fd[_0x0e62('0x17')][_0x0e62('0x27')]+=0x1;_0x9242fd['outbound'][_0x0e62('0x53')]+=_0x5f0453[_0x5cd00b][_0x0e62('0x57')];if(_0x5f0453[_0x5cd00b][_0x0e62('0x58')]==='ANSWERED'){_0x9242fd[_0x0e62('0x17')][_0x0e62('0x2b')]+=0x1;_0x9242fd[_0x0e62('0x17')]['sumHoldTime']+=_0x5f0453[_0x5cd00b][_0x0e62('0x57')]-_0x5f0453[_0x5cd00b][_0x0e62('0x59')]||0x0;_0x9242fd[_0x0e62('0x17')]['sumBillable']+=_0x5f0453[_0x5cd00b][_0x0e62('0x59')];}}}return _0x9242fd['outbound'];};};Realtime[_0x0e62('0x38')][_0x0e62('0x5a')]=function(){var _0x4ab720=this;return function(_0x2a1687){if(_0x2a1687){freeIsNotKey(_0x2a1687,_0x4ab720[_0x0e62('0x5b')],'name');for(var _0x2bdfb8=0x0,_0x453f74={};_0x2bdfb8<_0x2a1687[_0x0e62('0x3b')];_0x2bdfb8+=0x1){_0x453f74=_0x2a1687[_0x2bdfb8];if(_[_0x0e62('0x3e')](_0x4ab720[_0x0e62('0x5b')][_0x453f74[_0x0e62('0x3c')]])){_0x4ab720[_0x0e62('0x5b')][_0x453f74[_0x0e62('0x3c')]]=new Campaign(_0x453f74);}else{_0x4ab720['mergeFromDatabase'](_0x4ab720[_0x0e62('0x5b')][_0x453f74['name']],_0x453f74);}}}return _0x4ab720[_0x0e62('0x5b')];};};Realtime[_0x0e62('0x38')]['initVoiceExtensions']=function(){var _0x374fdf=this;return function(_0x4efe54){if(_0x4efe54){freeIsNotKey(_0x4efe54,_0x374fdf[_0x0e62('0x18')],'id');for(var _0x35dbcf=0x0,_0x54e649={};_0x35dbcf<_0x4efe54[_0x0e62('0x3b')];_0x35dbcf+=0x1){_0x54e649=_0x4efe54[_0x35dbcf];if(_['isUndefined'](_0x374fdf[_0x0e62('0x18')][_0x54e649['id']])){_0x374fdf[_0x0e62('0x18')][_0x54e649['id']]=new VoiceExtension(_0x54e649);}else{_0x374fdf[_0x0e62('0x39')](_0x374fdf['voiceExtensions'][_0x54e649['id']],_0x54e649);}}}return _0x374fdf['voiceExtensions'];};};Realtime[_0x0e62('0x38')]['initCampaignHopperHistory']=function(){var _0xc6e8a7=this;return function(_0x40b189){clearCampaigns(_0xc6e8a7[_0x0e62('0x5b')]);for(var _0x553bd6=0x0;_0x553bd6<_0x40b189[_0x0e62('0x3b')];_0x553bd6+=0x1){_['merge'](_0xc6e8a7['campaigns'][_0x40b189[_0x553bd6][_0x0e62('0x3c')]],_0x40b189[_0x553bd6]);}return _0xc6e8a7[_0x0e62('0x5b')];};};Realtime['prototype'][_0x0e62('0x5c')]=function(){var _0x50252e=this;return function(_0x33bd5a){if(_0x33bd5a){freeIsNotKey(_0x33bd5a,_0x50252e[_0x0e62('0x22')],'id');for(var _0x5bca5b=0x0,_0x365cde={},_0x1763d9={};_0x5bca5b<_0x33bd5a[_0x0e62('0x3b')];_0x5bca5b+=0x1){_0x365cde=_0x33bd5a[_0x5bca5b];if(_[_0x0e62('0x3e')](_0x50252e[_0x0e62('0x22')][_0x365cde['id']])){_0x50252e[_0x0e62('0x22')][_0x365cde['id']]=new FaxAccount(_0x365cde);}else{_0x50252e['mergeFromDatabase'](_0x50252e[_0x0e62('0x22')][_0x365cde['id']],_0x365cde);}}}return _0x50252e['faxAccounts'];};};module[_0x0e62('0x5d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 59676a2..d664469 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 _0xef83=['calleridname','monitor','createdAt','monitors','exports','bluebird','lodash','moment','util','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','prototype','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','length','queuecallercomplete','create','match','destination','exten','dialer','queue','lastdata','context','from-voip-provider','accountcode','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','channel','callerid','connectedlinenum','format','\x22%s\x22\x20<%s>'];(function(_0x3a4651,_0x5365a5){var _0x37ae01=function(_0x16b2bd){while(--_0x16b2bd){_0x3a4651['push'](_0x3a4651['shift']());}};_0x37ae01(++_0x5365a5);}(_0xef83,0x71));var _0x3ef8=function(_0x18f396,_0x174d17){_0x18f396=_0x18f396-0x0;var _0x3ba532=_0xef83[_0x18f396];return _0x3ba532;};'use strict';var BPromise=require(_0x3ef8('0x0'));var _=require(_0x3ef8('0x1'));var moment=require(_0x3ef8('0x2'));var util=require(_0x3ef8('0x3'));var logger=require(_0x3ef8('0x4'))('ami');var ami=require(_0x3ef8('0x5'));var RpcVoiceAgentReport=require(_0x3ef8('0x6'));var RpcVoiceCallReport=require(_0x3ef8('0x7'));var RpcVoiceDialReport=require(_0x3ef8('0x8'));var RpcMemberReport=require(_0x3ef8('0x9'));var RpcVoiceQueueReport=require(_0x3ef8('0xa'));var RpcVoiceRecording=require(_0x3ef8('0xb'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x3ef8('0xc'));var VoiceCallReport=require(_0x3ef8('0xd'));var VoiceAgentReport=require(_0x3ef8('0xe'));var VoiceDialReport=require(_0x3ef8('0xf'));var UserReport=require('./userReport');function Report(_0x4c2e57){this[_0x3ef8('0x10')]=_0x4c2e57;}Report[_0x3ef8('0x11')]['sync']=function(_0x435406){var _0x49d8b2=new VoiceQueueReport(this['realtime']);var _0x25d36e=new VoiceAgentReport(this['realtime']);var _0x2d164f=new VoiceDialReport(this['realtime']);var _0x311ce1=new VoiceCallReport(this[_0x3ef8('0x10')]);var _0x330b91=new UserReport(this['realtime']);ami['on'](_0x3ef8('0x12'),this[_0x3ef8('0x13')][_0x3ef8('0x14')](this));ami['on'](_0x3ef8('0x15'),this[_0x3ef8('0x16')][_0x3ef8('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0x3ef8('0x17')]['bind'](this));ami['on'](_0x3ef8('0x18'),this[_0x3ef8('0x19')][_0x3ef8('0x14')](this));ami['on']('blindtransfer',this[_0x3ef8('0x1a')]['bind'](this));ami['on']('attendedtransfer',this[_0x3ef8('0x1b')]['bind'](this));};Report[_0x3ef8('0x11')][_0x3ef8('0x13')]=function(_0x422295){for(var _0x2afe5b=0x0;_0x2afe5b<_0x422295[_0x3ef8('0x1c')];_0x2afe5b+=0x1){if(_0x422295[_0x2afe5b][_0x3ef8('0x1d')]){RpcMemberReport[_0x3ef8('0x13')](_0x422295[_0x2afe5b]);}RpcVoiceQueueReport[_0x3ef8('0x1e')](_0x422295[_0x2afe5b]);}};function extractCalleridNumber(_0x3c838f){var _0x240d81=_0x3c838f[_0x3ef8('0x1f')](/<(.*?)>/);return _0x240d81?_0x240d81[0x1]:_0x3c838f;}Report[_0x3ef8('0x11')][_0x3ef8('0x16')]=function(_0x394e5f){_0x394e5f['destination']=_0x394e5f[_0x3ef8('0x20')]||_0x394e5f[_0x3ef8('0x21')];if(_0x394e5f['type']==_0x3ef8('0x22')){_0x394e5f['lastapplication']=_0x3ef8('0x23');_0x394e5f[_0x3ef8('0x24')]=_0x394e5f[_0x3ef8('0x23')];if(_0x394e5f[_0x3ef8('0x25')]==_0x3ef8('0x26')){_0x394e5f[_0x3ef8('0x27')]='';_0x394e5f[_0x3ef8('0x20')]=extractCalleridNumber(_0x394e5f['callerid']);}else if(_0x394e5f[_0x3ef8('0x25')]==_0x3ef8('0x28')){if(_0x394e5f['destination']==_0x3ef8('0x29')){_0x394e5f[_0x3ef8('0x20')]=extractCalleridNumber(_0x394e5f['calleridpreview']);_0x394e5f[_0x3ef8('0x2a')]=_0x394e5f[_0x3ef8('0x2b')];_0x394e5f['destinationchannel']=[_0x394e5f['channel'],_0x394e5f[_0x3ef8('0x2c')]=_0x394e5f['destinationchannel']][0x0];_0x394e5f[_0x3ef8('0x2d')]=_0x394e5f['calleridpreview'];}else{_0x394e5f[_0x3ef8('0x20')]=_0x394e5f['calleridnum'];_0x394e5f[_0x3ef8('0x2a')]=_0x394e5f[_0x3ef8('0x2b')];if(_0x394e5f['disposition']=='ANSWERED'){_0x394e5f[_0x3ef8('0x27')]=_0x394e5f[_0x3ef8('0x2e')];}else{_0x394e5f[_0x3ef8('0x27')]='';}}}}else{_0x394e5f['callerid']=util[_0x3ef8('0x2f')](_0x3ef8('0x30'),_0x394e5f[_0x3ef8('0x31')],_0x394e5f[_0x3ef8('0x2a')]);}if(_0x394e5f[_0x3ef8('0x32')]){for(var _0x4e9612=0x0;_0x4e9612<_0x394e5f['monitors'][_0x3ef8('0x1c')];_0x4e9612+=0x1){_0x394e5f['monitorFilename']=_0x394e5f['monitors'][_0x4e9612]['filename'];_0x394e5f[_0x3ef8('0x33')]=_0x394e5f[_0x3ef8('0x34')][_0x4e9612][_0x3ef8('0x33')];RpcVoiceRecording['create'](_0x394e5f);}}RpcVoiceCallReport['create'](_0x394e5f);};Report[_0x3ef8('0x11')][_0x3ef8('0x17')]=function(_0x3a9335){for(var _0x6cb085=0x0;_0x6cb085<_0x3a9335[_0x3ef8('0x1c')];_0x6cb085+=0x1){RpcVoiceAgentReport['create'](_0x3a9335[_0x6cb085]);}};Report['prototype'][_0x3ef8('0x19')]=function(_0x6783e8){RpcVoiceDialReport[_0x3ef8('0x1e')](_0x6783e8);RpcMemberReport[_0x3ef8('0x19')](_0x6783e8);};Report[_0x3ef8('0x11')][_0x3ef8('0x1a')]=function(_0x5b79b1){RpcVoiceTransferReport[_0x3ef8('0x1a')](_0x5b79b1);};Report[_0x3ef8('0x11')][_0x3ef8('0x1b')]=function(_0x472fcb){RpcVoiceTransferReport[_0x3ef8('0x1b')](_0x472fcb);};module[_0x3ef8('0x35')]=Report; \ No newline at end of file +var _0x8dbc=['calleridname','monitors','length','monitorFilename','filename','createdAt','attendedTransfer','exports','bluebird','moment','util','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','prototype','sync','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','queuecallercomplete','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','accountcode','callerid','calleridnum','destinationchannel','channel','calleridpreview','originatecalleridnum','disposition','ANSWERED','format'];(function(_0x2ed3c1,_0x276288){var _0x245c8a=function(_0x31f7af){while(--_0x31f7af){_0x2ed3c1['push'](_0x2ed3c1['shift']());}};_0x245c8a(++_0x276288);}(_0x8dbc,0x1a5));var _0xc8db=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x8dbc[_0xdea41a];return _0x15d0d8;};'use strict';var BPromise=require(_0xc8db('0x0'));var _=require('lodash');var moment=require(_0xc8db('0x1'));var util=require(_0xc8db('0x2'));var logger=require(_0xc8db('0x3'))('ami');var ami=require(_0xc8db('0x4'));var RpcVoiceAgentReport=require(_0xc8db('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc8db('0x6'));var RpcMemberReport=require(_0xc8db('0x7'));var RpcVoiceQueueReport=require(_0xc8db('0x8'));var RpcVoiceRecording=require(_0xc8db('0x9'));var RpcVoiceTransferReport=require(_0xc8db('0xa'));var VoiceQueueReport=require(_0xc8db('0xb'));var VoiceCallReport=require(_0xc8db('0xc'));var VoiceAgentReport=require(_0xc8db('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x473c49){this[_0xc8db('0xe')]=_0x473c49;}Report[_0xc8db('0xf')][_0xc8db('0x10')]=function(_0x3c9144){var _0x2c8cb0=new VoiceQueueReport(this['realtime']);var _0x1b7f36=new VoiceAgentReport(this[_0xc8db('0xe')]);var _0x1c2c7c=new VoiceDialReport(this[_0xc8db('0xe')]);var _0xe6c0be=new VoiceCallReport(this[_0xc8db('0xe')]);var _0xb4bfe=new UserReport(this[_0xc8db('0xe')]);ami['on'](_0xc8db('0x11'),this[_0xc8db('0x12')][_0xc8db('0x13')](this));ami['on'](_0xc8db('0x14'),this[_0xc8db('0x15')][_0xc8db('0x13')](this));ami['on'](_0xc8db('0x16'),this[_0xc8db('0x17')][_0xc8db('0x13')](this));ami['on'](_0xc8db('0x18'),this[_0xc8db('0x19')]['bind'](this));ami['on'](_0xc8db('0x1a'),this[_0xc8db('0x1b')][_0xc8db('0x13')](this));ami['on'](_0xc8db('0x1c'),this['attendedTransfer'][_0xc8db('0x13')](this));};Report[_0xc8db('0xf')][_0xc8db('0x12')]=function(_0x2c5a91){for(var _0x121ff0=0x0;_0x121ff0<_0x2c5a91['length'];_0x121ff0+=0x1){if(_0x2c5a91[_0x121ff0][_0xc8db('0x1d')]){RpcMemberReport[_0xc8db('0x12')](_0x2c5a91[_0x121ff0]);}RpcVoiceQueueReport[_0xc8db('0x1e')](_0x2c5a91[_0x121ff0]);}};function extractCalleridNumber(_0x50faf9){var _0x1eb7e3=_0x50faf9[_0xc8db('0x1f')](/<(.*?)>/);return _0x1eb7e3?_0x1eb7e3[0x1]:_0x50faf9;}Report[_0xc8db('0xf')][_0xc8db('0x15')]=function(_0x19538d){_0x19538d[_0xc8db('0x20')]=_0x19538d[_0xc8db('0x20')]||_0x19538d[_0xc8db('0x21')];if(_0x19538d[_0xc8db('0x22')]==_0xc8db('0x23')){_0x19538d[_0xc8db('0x24')]=_0xc8db('0x25');_0x19538d[_0xc8db('0x26')]=_0x19538d[_0xc8db('0x25')];if(_0x19538d[_0xc8db('0x27')]==_0xc8db('0x28')){_0x19538d[_0xc8db('0x29')]='';_0x19538d[_0xc8db('0x20')]=extractCalleridNumber(_0x19538d[_0xc8db('0x2a')]);}else if(_0x19538d['context']=='from-sip'){if(_0x19538d[_0xc8db('0x20')]=='xcally-motion-preview'){_0x19538d[_0xc8db('0x20')]=extractCalleridNumber(_0x19538d['calleridpreview']);_0x19538d[_0xc8db('0x2b')]=_0x19538d['originatecalleridnum'];_0x19538d[_0xc8db('0x2c')]=[_0x19538d[_0xc8db('0x2d')],_0x19538d['channel']=_0x19538d[_0xc8db('0x2c')]][0x0];_0x19538d['callerid']=_0x19538d[_0xc8db('0x2e')];}else{_0x19538d[_0xc8db('0x20')]=_0x19538d[_0xc8db('0x2b')];_0x19538d[_0xc8db('0x2b')]=_0x19538d[_0xc8db('0x2f')];if(_0x19538d[_0xc8db('0x30')]==_0xc8db('0x31')){_0x19538d[_0xc8db('0x29')]=_0x19538d['connectedlinenum'];}else{_0x19538d['accountcode']='';}}}}else{_0x19538d['callerid']=util[_0xc8db('0x32')]('\x22%s\x22\x20<%s>',_0x19538d[_0xc8db('0x33')],_0x19538d[_0xc8db('0x2b')]);}if(_0x19538d['monitor']){for(var _0x24eab9=0x0;_0x24eab9<_0x19538d[_0xc8db('0x34')][_0xc8db('0x35')];_0x24eab9+=0x1){_0x19538d[_0xc8db('0x36')]=_0x19538d['monitors'][_0x24eab9][_0xc8db('0x37')];_0x19538d[_0xc8db('0x38')]=_0x19538d[_0xc8db('0x34')][_0x24eab9]['createdAt'];RpcVoiceRecording[_0xc8db('0x1e')](_0x19538d);}}RpcVoiceCallReport[_0xc8db('0x1e')](_0x19538d);};Report[_0xc8db('0xf')][_0xc8db('0x17')]=function(_0x35a3f0){for(var _0x163ff7=0x0;_0x163ff7<_0x35a3f0[_0xc8db('0x35')];_0x163ff7+=0x1){RpcVoiceAgentReport['create'](_0x35a3f0[_0x163ff7]);}};Report[_0xc8db('0xf')][_0xc8db('0x19')]=function(_0x49c7cc){RpcVoiceDialReport[_0xc8db('0x1e')](_0x49c7cc);RpcMemberReport[_0xc8db('0x19')](_0x49c7cc);};Report[_0xc8db('0xf')]['blindTransfer']=function(_0x2f3b75){RpcVoiceTransferReport['blindTransfer'](_0x2f3b75);};Report[_0xc8db('0xf')]['attendedTransfer']=function(_0x25b8d5){RpcVoiceTransferReport[_0xc8db('0x39')](_0x25b8d5);};module[_0xc8db('0x3a')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 33a10d6..f18df33 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 _0x2220=['device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','startsWith','substring','indexOf','mobile','phone','[syncDeviceState][UserReport]','syncPeerStatus','peerstatus','registered','peer','status','address','[syncPeerStatus][UserReport]','lodash','bluebird','../../../config/logger','ami','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','loopSyncRealTimeShow','resolve','actionDeviceStateList','then','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','isUndefined','emit','find','stateRegistry','state','merge','event','actionid','username','format','trunk:%s','trunk:save','[syncRegistry][UserReport]','isNotNull'];(function(_0x35466c,_0xdd0e7a){var _0xed6308=function(_0x37787f){while(--_0x37787f){_0x35466c['push'](_0x35466c['shift']());}};_0xed6308(++_0xdd0e7a);}(_0x2220,0x1e6));var _0x0222=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x2220[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x0222('0x0'));var moment=require('moment');var BPromise=require(_0x0222('0x1'));var util=require('util');var logger=require(_0x0222('0x2'))(_0x0222('0x3'));var ami=require('../ami');var io=require(_0x0222('0x4'))({'host':'localhost','port':0x18eb});function UserReport(_0x3c48cd){this['trunks']=_0x3c48cd[_0x0222('0x5')];this[_0x0222('0x6')]=_0x3c48cd['agents'];this['telephones']=_0x3c48cd[_0x0222('0x7')];ami['on'](_0x0222('0x8'),this[_0x0222('0x9')][_0x0222('0xa')](this));ami['on']('registry',this[_0x0222('0x9')]['bind'](this));ami['on'](_0x0222('0xb'),this[_0x0222('0xc')][_0x0222('0xa')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x0222('0xa')](this));this[_0x0222('0xd')]();return BPromise[_0x0222('0xe')]()['then'](ami['actionSipShowRegistry']())['then'](ami[_0x0222('0xf')]())[_0x0222('0x10')](ami[_0x0222('0x11')]())['catch'](loggerCatch(_0x0222('0x12')));}function loggerCatch(_0x3261d3){return function(_0x5d46c4){logger[_0x0222('0x13')](_0x3261d3,util[_0x0222('0x14')](_0x5d46c4,{'showHidden':![],'depth':null}));};}UserReport[_0x0222('0x15')][_0x0222('0xd')]=function(){setInterval(function(){BPromise[_0x0222('0xe')]()[_0x0222('0x10')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0x0222('0x10')](ami[_0x0222('0x11')]())['catch'](loggerCatch(_0x0222('0x12')));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x1605b3){return _0x1605b3!==null&&!_[_0x0222('0x16')](_0x1605b3);};UserReport['prototype'][_0x0222('0x17')]=function(_0x2daf44,_0x537266,_0x42124b){io['to'](_0x2daf44)[_0x0222('0x17')](_0x537266,_0x42124b);};UserReport[_0x0222('0x15')][_0x0222('0x9')]=function(_0x2013b5){try{if(this['isNotNull'](_0x2013b5)){var _0x34052d=_[_0x0222('0x18')](this[_0x0222('0x5')],{'registry':_0x2013b5['username']});if(_0x34052d){_0x2013b5[_0x0222('0x19')]=_0x2013b5[_0x0222('0x1a')];_[_0x0222('0x1b')](_0x34052d,_['omit'](_0x2013b5,[_0x0222('0x1c'),_0x0222('0x1d'),_0x0222('0x1e'),_0x0222('0x1a')]));this[_0x0222('0x17')](util[_0x0222('0x1f')](_0x0222('0x20'),_0x34052d['name']),_0x0222('0x21'),_0x34052d);}}}catch(_0x45c95b){logger[_0x0222('0x13')](_0x0222('0x22'),util[_0x0222('0x14')](_0x45c95b,{'showHidden':![],'depth':null}));}};UserReport[_0x0222('0x15')][_0x0222('0xc')]=function(_0x3d9514){try{if(this[_0x0222('0x23')](_0x3d9514)){if(this[_0x0222('0x6')][_0x3d9514[_0x0222('0x24')]]){if(!this[_0x0222('0x6')][_0x3d9514[_0x0222('0x24')]][_0x0222('0x25')]||_0x3d9514[_0x0222('0x1a')][_0x0222('0x26')]()==_0x0222('0x27')){this[_0x0222('0x6')][_0x3d9514['device']][_0x0222('0x25')]=![];if(this[_0x0222('0x6')][_0x3d9514['device']][_0x0222('0x1a')]!==_0x3d9514['state']['toLowerCase']()){this[_0x0222('0x6')][_0x3d9514[_0x0222('0x24')]][_0x0222('0x28')]=_[_0x0222('0x29')](moment()['format']('x'));}this[_0x0222('0x6')][_0x3d9514['device']][_0x0222('0x1a')]=_0x3d9514[_0x0222('0x1a')][_0x0222('0x26')]();this[_0x0222('0x6')][_0x3d9514[_0x0222('0x24')]][_0x0222('0x2a')](_0x3d9514);}}else if(this['telephones'][_0x3d9514[_0x0222('0x24')]]){if(this[_0x0222('0x7')][_0x3d9514[_0x0222('0x24')]]['state']!==_0x3d9514[_0x0222('0x1a')][_0x0222('0x26')]()){this['telephones'][_0x3d9514['device']][_0x0222('0x28')]=_['toNumber'](moment()[_0x0222('0x1f')]('x'));}this['telephones'][_0x3d9514[_0x0222('0x24')]][_0x0222('0x1a')]=_0x3d9514[_0x0222('0x1a')][_0x0222('0x26')]();this[_0x0222('0x17')](util[_0x0222('0x1f')](_0x0222('0x2b'),this[_0x0222('0x7')][_0x3d9514['device']]['name']),_0x0222('0x2c'),this['telephones'][_0x3d9514[_0x0222('0x24')]]);}else if(this['trunks'][_0x3d9514[_0x0222('0x24')]]){if(this[_0x0222('0x5')][_0x3d9514[_0x0222('0x24')]][_0x0222('0x1a')]!==_0x3d9514['state'][_0x0222('0x26')]()){this[_0x0222('0x5')][_0x3d9514[_0x0222('0x24')]][_0x0222('0x28')]=_[_0x0222('0x29')](moment()[_0x0222('0x1f')]('x'));}this[_0x0222('0x5')][_0x3d9514['device']][_0x0222('0x1a')]=_0x3d9514[_0x0222('0x1a')]['toLowerCase']();this[_0x0222('0x17')](util[_0x0222('0x1f')]('trunk:%s',this[_0x0222('0x5')][_0x3d9514[_0x0222('0x24')]]['name']),_0x0222('0x21'),this['trunks'][_0x3d9514[_0x0222('0x24')]]);}else if(_[_0x0222('0x2d')](_0x3d9514['device'],'Queue')){}else if(_[_0x0222('0x2d')](_0x3d9514[_0x0222('0x24')],'Local')){var _0x10c9e5=_0x3d9514[_0x0222('0x24')];var _0x21fad7=_0x10c9e5[_0x0222('0x2e')](_0x10c9e5[_0x0222('0x2f')]('/')+0x1,_0x10c9e5['indexOf']('@'));var _0x2bd4e5=_['find'](this['agents'],function(_0x5ae630){return _0x5ae630[_0x0222('0x30')]==_0x21fad7||_0x5ae630[_0x0222('0x31')]==_0x21fad7||_0x5ae630['accountcode']==_0x21fad7;});if(_0x2bd4e5){if(_0x2bd4e5[_0x0222('0x1a')]!==_0x3d9514['state']['toLowerCase']()){_0x2bd4e5[_0x0222('0x28')]=_['toNumber'](moment()[_0x0222('0x1f')]('x'));}_0x2bd4e5[_0x0222('0x1a')]=_0x3d9514[_0x0222('0x1a')][_0x0222('0x26')]();_0x2bd4e5[_0x0222('0x25')]=!![];_0x2bd4e5['updateStatusRealtime'](_0x3d9514);}}else{}}}catch(_0x58f556){logger[_0x0222('0x13')](_0x0222('0x32'),util[_0x0222('0x14')](_0x58f556,{'showHidden':![],'depth':null}));}};UserReport[_0x0222('0x15')][_0x0222('0x33')]=function(_0x5e4611){try{if(this['isNotNull'](_0x5e4611)&&this[_0x0222('0x23')](_0x5e4611[_0x0222('0x34')])){if(this[_0x0222('0x6')][_0x5e4611['peer']]){if(!this[_0x0222('0x6')][_0x5e4611['peer']][_0x0222('0x25')]||_0x5e4611[_0x0222('0x34')][_0x0222('0x26')]()==_0x0222('0x35')){this['agents'][_0x5e4611[_0x0222('0x36')]]['local']=![];this[_0x0222('0x6')][_0x5e4611[_0x0222('0x36')]][_0x0222('0x37')]=_0x5e4611[_0x0222('0x34')][_0x0222('0x26')]();this['agents'][_0x5e4611['peer']]['address']=_0x5e4611[_0x0222('0x38')];this[_0x0222('0x6')][_0x5e4611[_0x0222('0x36')]][_0x0222('0x2a')](_0x5e4611);}}else if(this[_0x0222('0x7')][_0x5e4611[_0x0222('0x36')]]){this[_0x0222('0x7')][_0x5e4611[_0x0222('0x36')]][_0x0222('0x37')]=_0x5e4611[_0x0222('0x34')][_0x0222('0x26')]();this[_0x0222('0x7')][_0x5e4611['peer']][_0x0222('0x38')]=_0x5e4611[_0x0222('0x38')];this[_0x0222('0x17')](util[_0x0222('0x1f')](_0x0222('0x2b'),this[_0x0222('0x7')][_0x5e4611['peer']]['name']),'telephone:save',this[_0x0222('0x7')][_0x5e4611[_0x0222('0x36')]]);}else if(this[_0x0222('0x5')][_0x5e4611['peer']]){this[_0x0222('0x5')][_0x5e4611[_0x0222('0x36')]][_0x0222('0x37')]=_0x5e4611[_0x0222('0x34')][_0x0222('0x26')]();this[_0x0222('0x5')][_0x5e4611[_0x0222('0x36')]][_0x0222('0x38')]=_0x5e4611[_0x0222('0x38')];this['emit'](util[_0x0222('0x1f')](_0x0222('0x20'),this[_0x0222('0x5')][_0x5e4611[_0x0222('0x36')]]['name']),'trunk:save',this[_0x0222('0x5')][_0x5e4611[_0x0222('0x36')]]);}else{}}}catch(_0x6c1e87){logger['error'](_0x0222('0x39'),util[_0x0222('0x14')](_0x6c1e87,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x4dcc=['resolve','actionSipShowRegistry','actionDeviceStateList','then','catch','[loopSyncRealTimeShow]','error','inspect','actionSipPeerStatus','prototype','isNotNull','emit','syncRegistry','find','username','stateRegistry','state','omit','event','actionid','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','toLowerCase','inuse','stateTime','toNumber','format','updateStatusRealtime','telephone:%s','telephone:save','trunks','startsWith','Queue','Local','substring','mobile','phone','accountcode','local','registered','peer','status','peerstatus','address','[syncPeerStatus][UserReport]','util','../../../config/logger','ami','../ami','socket.io-emitter','agents','telephones','registryentry','bind','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow'];(function(_0x1523fe,_0x47b2b5){var _0x106c92=function(_0x1b12a5){while(--_0x1b12a5){_0x1523fe['push'](_0x1523fe['shift']());}};_0x106c92(++_0x47b2b5);}(_0x4dcc,0x15c));var _0xc4dc=function(_0x2cdf41,_0x4a277c){_0x2cdf41=_0x2cdf41-0x0;var _0x39a70e=_0x4dcc[_0x2cdf41];return _0x39a70e;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xc4dc('0x0'));var logger=require(_0xc4dc('0x1'))(_0xc4dc('0x2'));var ami=require(_0xc4dc('0x3'));var io=require(_0xc4dc('0x4'))({'host':'localhost','port':0x18eb});function UserReport(_0x51c209){this['trunks']=_0x51c209['trunks'];this[_0xc4dc('0x5')]=_0x51c209[_0xc4dc('0x5')];this[_0xc4dc('0x6')]=_0x51c209[_0xc4dc('0x6')];ami['on'](_0xc4dc('0x7'),this['syncRegistry'][_0xc4dc('0x8')](this));ami['on']('registry',this['syncRegistry'][_0xc4dc('0x8')](this));ami['on']('devicestatechange',this[_0xc4dc('0x9')]['bind'](this));ami['on']('peerstatus',this[_0xc4dc('0xa')][_0xc4dc('0x8')](this));this[_0xc4dc('0xb')]();return BPromise[_0xc4dc('0xc')]()['then'](ami[_0xc4dc('0xd')]())['then'](ami[_0xc4dc('0xe')]())[_0xc4dc('0xf')](ami['actionSipPeerStatus']())[_0xc4dc('0x10')](loggerCatch(_0xc4dc('0x11')));}function loggerCatch(_0x5ebc2e){return function(_0x1970e2){logger[_0xc4dc('0x12')](_0x5ebc2e,util[_0xc4dc('0x13')](_0x1970e2,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0xc4dc('0xb')]=function(){setInterval(function(){BPromise[_0xc4dc('0xc')]()[_0xc4dc('0xf')](ami[_0xc4dc('0xd')]())[_0xc4dc('0xf')](ami['actionDeviceStateList']())[_0xc4dc('0xf')](ami[_0xc4dc('0x14')]())[_0xc4dc('0x10')](loggerCatch(_0xc4dc('0x11')));},0x32c8);};UserReport[_0xc4dc('0x15')][_0xc4dc('0x16')]=function(_0x37baf1){return _0x37baf1!==null&&!_['isUndefined'](_0x37baf1);};UserReport[_0xc4dc('0x15')]['emit']=function(_0x2cfad6,_0x35f215,_0x12f395){io['to'](_0x2cfad6)[_0xc4dc('0x17')](_0x35f215,_0x12f395);};UserReport[_0xc4dc('0x15')][_0xc4dc('0x18')]=function(_0x119742){try{if(this[_0xc4dc('0x16')](_0x119742)){var _0x2bbdb5=_[_0xc4dc('0x19')](this['trunks'],{'registry':_0x119742[_0xc4dc('0x1a')]});if(_0x2bbdb5){_0x119742[_0xc4dc('0x1b')]=_0x119742[_0xc4dc('0x1c')];_['merge'](_0x2bbdb5,_[_0xc4dc('0x1d')](_0x119742,[_0xc4dc('0x1e'),_0xc4dc('0x1f'),_0xc4dc('0x1a'),_0xc4dc('0x1c')]));this[_0xc4dc('0x17')](util['format'](_0xc4dc('0x20'),_0x2bbdb5[_0xc4dc('0x21')]),_0xc4dc('0x22'),_0x2bbdb5);}}}catch(_0xc4fba4){logger[_0xc4dc('0x12')](_0xc4dc('0x23'),util['inspect'](_0xc4fba4,{'showHidden':![],'depth':null}));}};UserReport[_0xc4dc('0x15')][_0xc4dc('0x9')]=function(_0x7e9c45){try{if(this[_0xc4dc('0x16')](_0x7e9c45)){if(this['agents'][_0x7e9c45[_0xc4dc('0x24')]]){if(!this['agents'][_0x7e9c45['device']]['local']||_0x7e9c45[_0xc4dc('0x1c')][_0xc4dc('0x25')]()==_0xc4dc('0x26')){this[_0xc4dc('0x5')][_0x7e9c45[_0xc4dc('0x24')]]['local']=![];if(this[_0xc4dc('0x5')][_0x7e9c45['device']][_0xc4dc('0x1c')]!==_0x7e9c45[_0xc4dc('0x1c')]['toLowerCase']()){this[_0xc4dc('0x5')][_0x7e9c45[_0xc4dc('0x24')]][_0xc4dc('0x27')]=_[_0xc4dc('0x28')](moment()[_0xc4dc('0x29')]('x'));}this[_0xc4dc('0x5')][_0x7e9c45[_0xc4dc('0x24')]][_0xc4dc('0x1c')]=_0x7e9c45[_0xc4dc('0x1c')]['toLowerCase']();this['agents'][_0x7e9c45['device']][_0xc4dc('0x2a')](_0x7e9c45);}}else if(this['telephones'][_0x7e9c45[_0xc4dc('0x24')]]){if(this[_0xc4dc('0x6')][_0x7e9c45['device']][_0xc4dc('0x1c')]!==_0x7e9c45[_0xc4dc('0x1c')]['toLowerCase']()){this['telephones'][_0x7e9c45[_0xc4dc('0x24')]]['stateTime']=_[_0xc4dc('0x28')](moment()[_0xc4dc('0x29')]('x'));}this[_0xc4dc('0x6')][_0x7e9c45[_0xc4dc('0x24')]][_0xc4dc('0x1c')]=_0x7e9c45['state']['toLowerCase']();this[_0xc4dc('0x17')](util[_0xc4dc('0x29')](_0xc4dc('0x2b'),this[_0xc4dc('0x6')][_0x7e9c45[_0xc4dc('0x24')]][_0xc4dc('0x21')]),_0xc4dc('0x2c'),this[_0xc4dc('0x6')][_0x7e9c45[_0xc4dc('0x24')]]);}else if(this['trunks'][_0x7e9c45['device']]){if(this[_0xc4dc('0x2d')][_0x7e9c45['device']][_0xc4dc('0x1c')]!==_0x7e9c45[_0xc4dc('0x1c')][_0xc4dc('0x25')]()){this[_0xc4dc('0x2d')][_0x7e9c45[_0xc4dc('0x24')]][_0xc4dc('0x27')]=_[_0xc4dc('0x28')](moment()['format']('x'));}this[_0xc4dc('0x2d')][_0x7e9c45[_0xc4dc('0x24')]][_0xc4dc('0x1c')]=_0x7e9c45[_0xc4dc('0x1c')][_0xc4dc('0x25')]();this[_0xc4dc('0x17')](util[_0xc4dc('0x29')](_0xc4dc('0x20'),this[_0xc4dc('0x2d')][_0x7e9c45[_0xc4dc('0x24')]][_0xc4dc('0x21')]),_0xc4dc('0x22'),this[_0xc4dc('0x2d')][_0x7e9c45[_0xc4dc('0x24')]]);}else if(_[_0xc4dc('0x2e')](_0x7e9c45[_0xc4dc('0x24')],_0xc4dc('0x2f'))){}else if(_[_0xc4dc('0x2e')](_0x7e9c45['device'],_0xc4dc('0x30'))){var _0x448ebd=_0x7e9c45[_0xc4dc('0x24')];var _0x1898ec=_0x448ebd[_0xc4dc('0x31')](_0x448ebd['indexOf']('/')+0x1,_0x448ebd['indexOf']('@'));var _0x3355b7=_[_0xc4dc('0x19')](this[_0xc4dc('0x5')],function(_0x5d9900){return _0x5d9900[_0xc4dc('0x32')]==_0x1898ec||_0x5d9900[_0xc4dc('0x33')]==_0x1898ec||_0x5d9900[_0xc4dc('0x34')]==_0x1898ec;});if(_0x3355b7){if(_0x3355b7[_0xc4dc('0x1c')]!==_0x7e9c45[_0xc4dc('0x1c')][_0xc4dc('0x25')]()){_0x3355b7['stateTime']=_[_0xc4dc('0x28')](moment()['format']('x'));}_0x3355b7[_0xc4dc('0x1c')]=_0x7e9c45[_0xc4dc('0x1c')]['toLowerCase']();_0x3355b7[_0xc4dc('0x35')]=!![];_0x3355b7[_0xc4dc('0x2a')](_0x7e9c45);}}else{}}}catch(_0x428009){logger[_0xc4dc('0x12')]('[syncDeviceState][UserReport]',util[_0xc4dc('0x13')](_0x428009,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc4dc('0xa')]=function(_0x4c296c){try{if(this[_0xc4dc('0x16')](_0x4c296c)&&this['isNotNull'](_0x4c296c['peerstatus'])){if(this[_0xc4dc('0x5')][_0x4c296c['peer']]){if(!this[_0xc4dc('0x5')][_0x4c296c['peer']][_0xc4dc('0x35')]||_0x4c296c['peerstatus'][_0xc4dc('0x25')]()==_0xc4dc('0x36')){this[_0xc4dc('0x5')][_0x4c296c[_0xc4dc('0x37')]][_0xc4dc('0x35')]=![];this[_0xc4dc('0x5')][_0x4c296c[_0xc4dc('0x37')]][_0xc4dc('0x38')]=_0x4c296c[_0xc4dc('0x39')]['toLowerCase']();this['agents'][_0x4c296c[_0xc4dc('0x37')]][_0xc4dc('0x3a')]=_0x4c296c[_0xc4dc('0x3a')];this[_0xc4dc('0x5')][_0x4c296c['peer']]['updateStatusRealtime'](_0x4c296c);}}else if(this[_0xc4dc('0x6')][_0x4c296c[_0xc4dc('0x37')]]){this[_0xc4dc('0x6')][_0x4c296c[_0xc4dc('0x37')]]['status']=_0x4c296c[_0xc4dc('0x39')][_0xc4dc('0x25')]();this[_0xc4dc('0x6')][_0x4c296c[_0xc4dc('0x37')]][_0xc4dc('0x3a')]=_0x4c296c['address'];this[_0xc4dc('0x17')](util[_0xc4dc('0x29')](_0xc4dc('0x2b'),this['telephones'][_0x4c296c['peer']]['name']),'telephone:save',this[_0xc4dc('0x6')][_0x4c296c[_0xc4dc('0x37')]]);}else if(this['trunks'][_0x4c296c[_0xc4dc('0x37')]]){this[_0xc4dc('0x2d')][_0x4c296c[_0xc4dc('0x37')]][_0xc4dc('0x38')]=_0x4c296c[_0xc4dc('0x39')][_0xc4dc('0x25')]();this[_0xc4dc('0x2d')][_0x4c296c[_0xc4dc('0x37')]][_0xc4dc('0x3a')]=_0x4c296c[_0xc4dc('0x3a')];this[_0xc4dc('0x17')](util['format'](_0xc4dc('0x20'),this[_0xc4dc('0x2d')][_0x4c296c[_0xc4dc('0x37')]][_0xc4dc('0x21')]),_0xc4dc('0x22'),this[_0xc4dc('0x2d')][_0x4c296c['peer']]);}else{}}}catch(_0x920191){logger[_0xc4dc('0x12')](_0xc4dc('0x3b'),util['inspect'](_0x920191,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 3b6b0d1..8cc34b6 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 _0x6ba2=['rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ami','../ami','localhost','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','called','queue','inbound','merge','event','custom:agentcalled','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','lastevent','holdtime','connectedlinenum','connectedlinename','interface','destconnectedlinenum','user:%s','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','syncAgentComplete','agentcompleteAt','complete','talktime','acwtime','acwTimeout','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','value','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ba2,0x72));var _0x26ba=function(_0x10a8d8,_0x28f292){_0x10a8d8=_0x10a8d8-0x0;var _0x3b2b79=_0x6ba2[_0x10a8d8];return _0x3b2b79;};'use strict';var _=require(_0x26ba('0x0'));var moment=require(_0x26ba('0x1'));var util=require(_0x26ba('0x2'));var logger=require('../../../config/logger')(_0x26ba('0x3'));var ami=require(_0x26ba('0x4'));var io=require('socket.io-emitter')({'host':_0x26ba('0x5'),'port':0x18eb});function VoiceAgentReport(_0x1e2e79){this[_0x26ba('0x6')]={};this['voiceQueues']=_0x1e2e79[_0x26ba('0x7')];this[_0x26ba('0x8')]=_0x1e2e79[_0x26ba('0x8')];this[_0x26ba('0x9')]={};ami['on']('agentcalled',this[_0x26ba('0xa')][_0x26ba('0xb')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x26ba('0xb')](this));ami['on'](_0x26ba('0xc'),this[_0x26ba('0xd')][_0x26ba('0xb')](this));ami['on'](_0x26ba('0xe'),this[_0x26ba('0xf')][_0x26ba('0xb')](this));ami['on'](_0x26ba('0x10'),this['syncAgentComplete'][_0x26ba('0xb')](this));ami['on'](_0x26ba('0x11'),this[_0x26ba('0x12')][_0x26ba('0xb')](this));ami['on'](_0x26ba('0x13'),this[_0x26ba('0x14')][_0x26ba('0xb')](this));ami['on'](_0x26ba('0x15'),this[_0x26ba('0x16')][_0x26ba('0xb')](this));ami['on']('musiconholdstop',this[_0x26ba('0x17')][_0x26ba('0xb')](this));}VoiceAgentReport[_0x26ba('0x18')][_0x26ba('0x19')]=function(_0x3365e7,_0x56a166,_0x4967cf){io['to'](_0x3365e7)['emit'](_0x56a166,_0x4967cf);};VoiceAgentReport['prototype'][_0x26ba('0x1a')]=function(_0xbf5692){return _0xbf5692!==null&&!_['isUndefined'](_0xbf5692);};VoiceAgentReport[_0x26ba('0x18')][_0x26ba('0xa')]=function(_0x314c95){try{if(this[_0x26ba('0x1a')](_0x314c95)){if(_[_0x26ba('0x1b')](this[_0x26ba('0x6')][_0x314c95['uniqueid']])){this[_0x26ba('0x6')][_0x314c95[_0x26ba('0x1c')]]={};}if(_[_0x26ba('0x1b')](this[_0x26ba('0x6')][_0x314c95['uniqueid']][_0x314c95[_0x26ba('0x1d')]])){this[_0x26ba('0x6')][_0x314c95[_0x26ba('0x1c')]][_0x314c95[_0x26ba('0x1d')]]={'agentcalledAt':moment()[_0x26ba('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x26ba('0x1f'),'variables':this['variables'][_0x314c95['uniqueid']],'type':this[_0x26ba('0x7')][_0x314c95['queue']]?this['voiceQueues'][_0x314c95[_0x26ba('0x20')]]['type']||_0x26ba('0x21'):_0x26ba('0x21')};}_[_0x26ba('0x22')](this[_0x26ba('0x6')][_0x314c95[_0x26ba('0x1c')]][_0x314c95[_0x26ba('0x1d')]],_['omit'](_0x314c95,[_0x26ba('0x23'),'privilege']));ami[_0x26ba('0x19')](_0x26ba('0x24'),this[_0x26ba('0x6')][_0x314c95[_0x26ba('0x1c')]][_0x314c95['destuniqueid']]);this[_0x26ba('0x19')](util[_0x26ba('0x1e')]('user:%s',_0x314c95[_0x26ba('0x25')]),_0x26ba('0x26'),this[_0x26ba('0x6')][_0x314c95['uniqueid']][_0x314c95['destuniqueid']]);}}catch(_0x142100){logger[_0x26ba('0x27')](_0x26ba('0x28'),util[_0x26ba('0x29')](_0x142100,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x26ba('0x18')]['syncAgentConnect']=function(_0x5b408b){try{if(this[_0x26ba('0x1a')](_0x5b408b)){if(this[_0x26ba('0x6')][_0x5b408b['uniqueid']]){for(var _0x37a0ed in this['channels'][_0x5b408b[_0x26ba('0x1c')]]){if(this['channels'][_0x5b408b[_0x26ba('0x1c')]][_0x26ba('0x2a')](_0x37a0ed)){if(_0x5b408b[_0x26ba('0x1d')]===_0x37a0ed){this[_0x26ba('0x6')][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed][_0x26ba('0x2b')]=moment()[_0x26ba('0x1e')](_0x26ba('0x2c'));this[_0x26ba('0x6')][_0x5b408b['uniqueid']][_0x37a0ed][_0x26ba('0x2d')]='connect';this[_0x26ba('0x6')][_0x5b408b['uniqueid']][_0x37a0ed][_0x26ba('0x2e')]=_0x5b408b[_0x26ba('0x2e')];this[_0x26ba('0x6')][_0x5b408b['uniqueid']][_0x37a0ed][_0x26ba('0x2f')]=_0x5b408b[_0x26ba('0x2f')];this['channels'][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed][_0x26ba('0x30')]=_0x5b408b[_0x26ba('0x30')];this[_0x26ba('0x6')][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed]['destchannelstate']=_0x5b408b['destchannelstate'];this[_0x26ba('0x6')][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed]['destchannelstatedesc']=_0x5b408b['destchannelstatedesc'];_[_0x26ba('0x22')](this[_0x26ba('0x8')][_0x5b408b[_0x26ba('0x31')]],_['pick'](_0x5b408b,[_0x26ba('0x20'),_0x26ba('0x32')]));this[_0x26ba('0x19')](util[_0x26ba('0x1e')](_0x26ba('0x33'),_0x5b408b[_0x26ba('0x25')]),_0x26ba('0x34'),this[_0x26ba('0x6')][_0x5b408b['uniqueid']][_0x5b408b['destuniqueid']]);ami[_0x26ba('0x19')]('custom:agentconnect',this[_0x26ba('0x6')][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed]);}else if(this['isNotNull'](this[_0x26ba('0x6')][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed][_0x26ba('0xc')])){this[_0x26ba('0x6')][_0x5b408b['uniqueid']][_0x37a0ed]['agentringnoanswer']=!![];this[_0x26ba('0x6')][_0x5b408b['uniqueid']][_0x37a0ed][_0x26ba('0x35')]=moment()[_0x26ba('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed][_0x26ba('0x36')]=_0x26ba('0x37');this[_0x26ba('0x6')][_0x5b408b['uniqueid']][_0x37a0ed]['lastevent']=_0x26ba('0x37');this[_0x26ba('0x6')][_0x5b408b['uniqueid']][_0x37a0ed][_0x26ba('0x38')]=_0x5b408b[_0x26ba('0x1d')];this[_0x26ba('0x6')][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed][_0x26ba('0x39')]=_0x5b408b[_0x26ba('0x25')];ami[_0x26ba('0x19')](_0x26ba('0x3a'),this['channels'][_0x5b408b[_0x26ba('0x1c')]][_0x37a0ed]);}}}}}}catch(_0x10cd70){logger['error']('[syncAgentConnect][VoiceAgentReport]',util[_0x26ba('0x29')](_0x10cd70,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x26ba('0xd')]=function(_0x4f8598){try{if(this[_0x26ba('0x1a')](_0x4f8598)){if(this[_0x26ba('0x6')][_0x4f8598[_0x26ba('0x1c')]]&&this[_0x26ba('0x6')][_0x4f8598['uniqueid']][_0x4f8598[_0x26ba('0x1d')]]&&_[_0x26ba('0x1b')](this[_0x26ba('0x6')][_0x4f8598[_0x26ba('0x1c')]][_0x4f8598[_0x26ba('0x1d')]][_0x26ba('0xc')])){this[_0x26ba('0x6')][_0x4f8598[_0x26ba('0x1c')]][_0x4f8598[_0x26ba('0x1d')]][_0x26ba('0xc')]=!![];this[_0x26ba('0x6')][_0x4f8598[_0x26ba('0x1c')]][_0x4f8598[_0x26ba('0x1d')]][_0x26ba('0x35')]=moment()[_0x26ba('0x1e')](_0x26ba('0x2c'));this[_0x26ba('0x6')][_0x4f8598['uniqueid']][_0x4f8598[_0x26ba('0x1d')]][_0x26ba('0x36')]=_0x26ba('0x3b');this[_0x26ba('0x6')][_0x4f8598[_0x26ba('0x1c')]][_0x4f8598[_0x26ba('0x1d')]][_0x26ba('0x2d')]=_0x26ba('0x3b');ami[_0x26ba('0x19')](_0x26ba('0x3c'),this[_0x26ba('0x6')][_0x4f8598['uniqueid']][_0x4f8598[_0x26ba('0x1d')]]);}}}catch(_0x438cfb){logger[_0x26ba('0x27')](_0x26ba('0x3d'),util['inspect'](_0x438cfb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x26ba('0x18')][_0x26ba('0xf')]=function(_0x383bfc){try{if(this[_0x26ba('0x1a')](_0x383bfc)){if(this['channels'][_0x383bfc[_0x26ba('0x1c')]]){for(var _0x5c41e8 in this[_0x26ba('0x6')][_0x383bfc['uniqueid']]){if(this[_0x26ba('0x6')][_0x383bfc[_0x26ba('0x1c')]]['hasOwnProperty'](_0x5c41e8)&&_['isUndefined'](this[_0x26ba('0x6')][_0x383bfc[_0x26ba('0x1c')]][_0x5c41e8][_0x26ba('0xc')])){this[_0x26ba('0x6')][_0x383bfc[_0x26ba('0x1c')]][_0x5c41e8][_0x26ba('0xc')]=!![];this[_0x26ba('0x6')][_0x383bfc['uniqueid']][_0x5c41e8][_0x26ba('0x35')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x26ba('0x6')][_0x383bfc[_0x26ba('0x1c')]][_0x5c41e8]['reason']='abandoned';this[_0x26ba('0x6')][_0x383bfc[_0x26ba('0x1c')]][_0x5c41e8][_0x26ba('0x2d')]=_0x26ba('0x3e');ami['emit'](_0x26ba('0x3f'),this[_0x26ba('0x6')][_0x383bfc[_0x26ba('0x1c')]][_0x5c41e8]);}}}}}catch(_0x393322){logger[_0x26ba('0x27')](_0x26ba('0x40'),util[_0x26ba('0x29')](_0x393322,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x26ba('0x18')][_0x26ba('0x41')]=function(_0x3bc216){try{if(this['isNotNull'](_0x3bc216)){if(this['channels'][_0x3bc216['uniqueid']]&&this['channels'][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216[_0x26ba('0x1d')]]&&_['isUndefined'](this['channels'][_0x3bc216['uniqueid']][_0x3bc216[_0x26ba('0x1d')]][_0x26ba('0x10')])){this[_0x26ba('0x6')][_0x3bc216['uniqueid']][_0x3bc216[_0x26ba('0x1d')]]['agentcomplete']=!![];this[_0x26ba('0x6')][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216[_0x26ba('0x1d')]][_0x26ba('0x42')]=moment()[_0x26ba('0x1e')](_0x26ba('0x2c'));this[_0x26ba('0x6')][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216['destuniqueid']][_0x26ba('0x2d')]=_0x26ba('0x43');this[_0x26ba('0x6')][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216[_0x26ba('0x1d')]][_0x26ba('0x44')]=_0x3bc216[_0x26ba('0x44')];this[_0x26ba('0x6')][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216[_0x26ba('0x1d')]]['reason']=_0x3bc216[_0x26ba('0x36')];if(this[_0x26ba('0x7')][_0x3bc216[_0x26ba('0x20')]]&&this[_0x26ba('0x7')][_0x3bc216[_0x26ba('0x20')]]['acw']){this[_0x26ba('0x6')][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216['destuniqueid']]['agentacw']=!![];this[_0x26ba('0x6')][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216['destuniqueid']][_0x26ba('0x45')]=this[_0x26ba('0x7')][_0x3bc216[_0x26ba('0x20')]][_0x26ba('0x46')];}this[_0x26ba('0x8')][_0x3bc216[_0x26ba('0x31')]]=_['omit'](this[_0x26ba('0x8')][_0x3bc216[_0x26ba('0x31')]],[_0x26ba('0x20'),_0x26ba('0x32')]);this[_0x26ba('0x19')](util['format'](_0x26ba('0x33'),_0x3bc216[_0x26ba('0x25')]),'user:agentcomplete',this[_0x26ba('0x6')][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216['destuniqueid']]);ami[_0x26ba('0x19')](_0x26ba('0x47'),this[_0x26ba('0x6')][_0x3bc216[_0x26ba('0x1c')]][_0x3bc216[_0x26ba('0x1d')]]);}}}catch(_0x4f4c90){logger[_0x26ba('0x27')](_0x26ba('0x48'),util[_0x26ba('0x29')](_0x4f4c90,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x43595d){try{if(this[_0x26ba('0x1a')](_0x43595d)){this[_0x26ba('0x49')](_0x43595d[_0x26ba('0x1c')],_['keys'](_0x43595d[_0x26ba('0x4a')])[0x0],_0x43595d[_0x26ba('0x4b')]);if(this[_0x26ba('0x6')][_0x43595d[_0x26ba('0x1c')]]){for(var _0x2ed677 in this['channels'][_0x43595d[_0x26ba('0x1c')]]){if(this[_0x26ba('0x6')][_0x43595d[_0x26ba('0x1c')]][_0x26ba('0x2a')](_0x2ed677)){if(_[_0x26ba('0x1b')](this[_0x26ba('0x6')][_0x43595d[_0x26ba('0x1c')]][_0x2ed677]['variables'])){this['channels'][_0x43595d[_0x26ba('0x1c')]][_0x2ed677][_0x26ba('0x9')]={};}this[_0x26ba('0x6')][_0x43595d[_0x26ba('0x1c')]][_0x2ed677][_0x26ba('0x9')]=this[_0x26ba('0x9')][_0x43595d['uniqueid']];}}}}}catch(_0x849f68){logger[_0x26ba('0x27')]('[syncVarSet][VoiceAgentReport]',util[_0x26ba('0x29')](_0x849f68,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x26ba('0x18')][_0x26ba('0x49')]=function(_0x143ce8,_0x2b91c2,_0x470962){var _0x2eaa04=[_0x26ba('0x4c'),'rtpaudioqosbridged',_0x26ba('0x4d'),_0x26ba('0x4e'),_0x26ba('0x4f'),'rtpaudioqoslossbridged',_0x26ba('0x50'),_0x26ba('0x51'),_0x26ba('0x52'),_0x26ba('0x53'),_0x26ba('0x54'),_0x26ba('0x55'),'membercalls',_0x26ba('0x56'),_0x26ba('0x57'),'memberlastcall',_0x26ba('0x25'),_0x26ba('0x58'),_0x26ba('0x59')];if(!_[_0x26ba('0x5a')](_0x2b91c2)&&!_['includes'](_0x2eaa04,_0x2b91c2)){if(_[_0x26ba('0x1b')](this[_0x26ba('0x9')][_0x143ce8])){this['variables'][_0x143ce8]={};}this[_0x26ba('0x9')][_0x143ce8][_0x2b91c2]=_0x470962;}};VoiceAgentReport[_0x26ba('0x18')][_0x26ba('0x14')]=function(_0x30c200){try{if(this['isNotNull'](_0x30c200)){if(this[_0x26ba('0x6')][_0x30c200['uniqueid']]){ami[_0x26ba('0x19')](_0x26ba('0x5b'),_[_0x26ba('0x5c')](this[_0x26ba('0x6')][_0x30c200[_0x26ba('0x1c')]]));delete this[_0x26ba('0x6')][_0x30c200[_0x26ba('0x1c')]];}if(this[_0x26ba('0x9')][_0x30c200['uniqueid']]){delete this[_0x26ba('0x9')][_0x30c200[_0x26ba('0x1c')]];}}}catch(_0x432550){logger['error'](_0x26ba('0x5d'),util[_0x26ba('0x29')](_0x432550,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x26ba('0x18')]['syncMusicOnHoldStart']=function(_0x53b13a){try{if(this[_0x26ba('0x1a')](_0x53b13a)){if(this['channels'][_0x53b13a['uniqueid']]){}}}catch(_0x337808){logger[_0x26ba('0x27')](_0x26ba('0x5e'),util[_0x26ba('0x29')](_0x337808,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x26ba('0x18')][_0x26ba('0x17')]=function(_0x30227e){try{if(this[_0x26ba('0x1a')](_0x30227e)){if(this[_0x26ba('0x6')][_0x30227e[_0x26ba('0x1c')]]){}}}catch(_0x4e6e5e){logger[_0x26ba('0x27')](_0x26ba('0x5f'),util[_0x26ba('0x29')](_0x4e6e5e,{'showHidden':![],'depth':null}));}};module[_0x26ba('0x60')]=VoiceAgentReport; \ No newline at end of file +var _0x0764=['bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','agentcomplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','emit','isUndefined','isNotNull','uniqueid','destuniqueid','called','queue','type','inbound','merge','omit','privilege','custom:agentcalled','format','user:%s','membername','error','[syncAgentCalled][VoiceAgentReport]','inspect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','prototype','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','complete','talktime','acw','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','hasOwnProperty','variables','[syncVarSet][VoiceAgentReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','../../../config/logger','../ami','channels','voiceQueues','agents','agentcalled','syncAgentCalled'];(function(_0x1b2de7,_0x318ca2){var _0x462a3a=function(_0x3bc833){while(--_0x3bc833){_0x1b2de7['push'](_0x1b2de7['shift']());}};_0x462a3a(++_0x318ca2);}(_0x0764,0x186));var _0x4076=function(_0x57af44,_0x583053){_0x57af44=_0x57af44-0x0;var _0x49ec92=_0x0764[_0x57af44];return _0x49ec92;};'use strict';var _=require(_0x4076('0x0'));var moment=require(_0x4076('0x1'));var util=require(_0x4076('0x2'));var logger=require(_0x4076('0x3'))('ami');var ami=require(_0x4076('0x4'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function VoiceAgentReport(_0x510db9){this[_0x4076('0x5')]={};this[_0x4076('0x6')]=_0x510db9[_0x4076('0x6')];this[_0x4076('0x7')]=_0x510db9[_0x4076('0x7')];this['variables']={};ami['on'](_0x4076('0x8'),this[_0x4076('0x9')][_0x4076('0xa')](this));ami['on'](_0x4076('0xb'),this[_0x4076('0xc')][_0x4076('0xa')](this));ami['on'](_0x4076('0xd'),this[_0x4076('0xe')][_0x4076('0xa')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x4076('0xa')](this));ami['on'](_0x4076('0xf'),this['syncAgentComplete'][_0x4076('0xa')](this));ami['on'](_0x4076('0x10'),this[_0x4076('0x11')][_0x4076('0xa')](this));ami['on']('hangup',this[_0x4076('0x12')][_0x4076('0xa')](this));ami['on'](_0x4076('0x13'),this[_0x4076('0x14')][_0x4076('0xa')](this));ami['on'](_0x4076('0x15'),this[_0x4076('0x16')][_0x4076('0xa')](this));}VoiceAgentReport['prototype'][_0x4076('0x17')]=function(_0x335206,_0x483bae,_0x1c9545){io['to'](_0x335206)[_0x4076('0x17')](_0x483bae,_0x1c9545);};VoiceAgentReport['prototype']['isNotNull']=function(_0x10bb26){return _0x10bb26!==null&&!_[_0x4076('0x18')](_0x10bb26);};VoiceAgentReport['prototype'][_0x4076('0x9')]=function(_0xa66240){try{if(this[_0x4076('0x19')](_0xa66240)){if(_[_0x4076('0x18')](this[_0x4076('0x5')][_0xa66240[_0x4076('0x1a')]])){this[_0x4076('0x5')][_0xa66240[_0x4076('0x1a')]]={};}if(_[_0x4076('0x18')](this['channels'][_0xa66240[_0x4076('0x1a')]][_0xa66240[_0x4076('0x1b')]])){this[_0x4076('0x5')][_0xa66240['uniqueid']][_0xa66240['destuniqueid']]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x4076('0x1c'),'variables':this['variables'][_0xa66240[_0x4076('0x1a')]],'type':this['voiceQueues'][_0xa66240['queue']]?this['voiceQueues'][_0xa66240[_0x4076('0x1d')]][_0x4076('0x1e')]||_0x4076('0x1f'):_0x4076('0x1f')};}_[_0x4076('0x20')](this[_0x4076('0x5')][_0xa66240[_0x4076('0x1a')]][_0xa66240[_0x4076('0x1b')]],_[_0x4076('0x21')](_0xa66240,['event',_0x4076('0x22')]));ami[_0x4076('0x17')](_0x4076('0x23'),this[_0x4076('0x5')][_0xa66240[_0x4076('0x1a')]][_0xa66240[_0x4076('0x1b')]]);this[_0x4076('0x17')](util[_0x4076('0x24')](_0x4076('0x25'),_0xa66240[_0x4076('0x26')]),'user:called',this[_0x4076('0x5')][_0xa66240['uniqueid']][_0xa66240['destuniqueid']]);}}catch(_0x31600a){logger[_0x4076('0x27')](_0x4076('0x28'),util[_0x4076('0x29')](_0x31600a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x280ae1){try{if(this[_0x4076('0x19')](_0x280ae1)){if(this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]]){for(var _0x151a83 in this[_0x4076('0x5')][_0x280ae1['uniqueid']]){if(this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]]['hasOwnProperty'](_0x151a83)){if(_0x280ae1[_0x4076('0x1b')]===_0x151a83){this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0x2a')]=moment()['format'](_0x4076('0x2b'));this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0x2c')]=_0x4076('0x2d');this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0x2e')]=_0x280ae1[_0x4076('0x2e')];this['channels'][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0x2f')]=_0x280ae1[_0x4076('0x2f')];this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0x30')]=_0x280ae1[_0x4076('0x30')];this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0x31')]=_0x280ae1[_0x4076('0x31')];this[_0x4076('0x5')][_0x280ae1['uniqueid']][_0x151a83][_0x4076('0x32')]=_0x280ae1['destchannelstatedesc'];_[_0x4076('0x20')](this[_0x4076('0x7')][_0x280ae1[_0x4076('0x33')]],_[_0x4076('0x34')](_0x280ae1,[_0x4076('0x1d'),_0x4076('0x35')]));this[_0x4076('0x17')](util[_0x4076('0x24')](_0x4076('0x25'),_0x280ae1[_0x4076('0x26')]),_0x4076('0x36'),this['channels'][_0x280ae1['uniqueid']][_0x280ae1[_0x4076('0x1b')]]);ami[_0x4076('0x17')](_0x4076('0x37'),this['channels'][_0x280ae1['uniqueid']][_0x151a83]);}else if(this[_0x4076('0x19')](this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0xd')])){this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83]['agentringnoanswer']=!![];this['channels'][_0x280ae1[_0x4076('0x1a')]][_0x151a83]['agentringnoanswerAt']=moment()[_0x4076('0x24')](_0x4076('0x2b'));this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0x38')]=_0x4076('0x39');this[_0x4076('0x5')][_0x280ae1['uniqueid']][_0x151a83]['lastevent']=_0x4076('0x39');this[_0x4076('0x5')][_0x280ae1[_0x4076('0x1a')]][_0x151a83][_0x4076('0x3a')]=_0x280ae1[_0x4076('0x1b')];this['channels'][_0x280ae1['uniqueid']][_0x151a83][_0x4076('0x3b')]=_0x280ae1[_0x4076('0x26')];ami[_0x4076('0x17')]('custom:agentansweredelsewhere',this['channels'][_0x280ae1[_0x4076('0x1a')]][_0x151a83]);}}}}}}catch(_0x55c294){logger[_0x4076('0x27')]('[syncAgentConnect][VoiceAgentReport]',util[_0x4076('0x29')](_0x55c294,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4076('0x3c')]['syncAgentRingNoAnswer']=function(_0x27dd7c){try{if(this[_0x4076('0x19')](_0x27dd7c)){if(this['channels'][_0x27dd7c[_0x4076('0x1a')]]&&this[_0x4076('0x5')][_0x27dd7c[_0x4076('0x1a')]][_0x27dd7c[_0x4076('0x1b')]]&&_[_0x4076('0x18')](this['channels'][_0x27dd7c[_0x4076('0x1a')]][_0x27dd7c['destuniqueid']][_0x4076('0xd')])){this[_0x4076('0x5')][_0x27dd7c[_0x4076('0x1a')]][_0x27dd7c[_0x4076('0x1b')]]['agentringnoanswer']=!![];this[_0x4076('0x5')][_0x27dd7c[_0x4076('0x1a')]][_0x27dd7c[_0x4076('0x1b')]][_0x4076('0x3d')]=moment()[_0x4076('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4076('0x5')][_0x27dd7c[_0x4076('0x1a')]][_0x27dd7c[_0x4076('0x1b')]][_0x4076('0x38')]='rejected';this[_0x4076('0x5')][_0x27dd7c['uniqueid']][_0x27dd7c[_0x4076('0x1b')]]['lastevent']=_0x4076('0x3e');ami[_0x4076('0x17')](_0x4076('0x3f'),this[_0x4076('0x5')][_0x27dd7c[_0x4076('0x1a')]][_0x27dd7c['destuniqueid']]);}}}catch(_0x464331){logger[_0x4076('0x27')](_0x4076('0x40'),util[_0x4076('0x29')](_0x464331,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4076('0x41')]=function(_0x241633){try{if(this[_0x4076('0x19')](_0x241633)){if(this['channels'][_0x241633[_0x4076('0x1a')]]){for(var _0xf582a in this['channels'][_0x241633[_0x4076('0x1a')]]){if(this[_0x4076('0x5')][_0x241633[_0x4076('0x1a')]]['hasOwnProperty'](_0xf582a)&&_[_0x4076('0x18')](this[_0x4076('0x5')][_0x241633['uniqueid']][_0xf582a][_0x4076('0xd')])){this[_0x4076('0x5')][_0x241633['uniqueid']][_0xf582a][_0x4076('0xd')]=!![];this[_0x4076('0x5')][_0x241633[_0x4076('0x1a')]][_0xf582a]['agentringnoanswerAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x241633['uniqueid']][_0xf582a][_0x4076('0x38')]=_0x4076('0x42');this[_0x4076('0x5')][_0x241633['uniqueid']][_0xf582a][_0x4076('0x2c')]=_0x4076('0x42');ami[_0x4076('0x17')](_0x4076('0x43'),this[_0x4076('0x5')][_0x241633[_0x4076('0x1a')]][_0xf582a]);}}}}}catch(_0x519b0c){logger[_0x4076('0x27')](_0x4076('0x44'),util[_0x4076('0x29')](_0x519b0c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4076('0x3c')]['syncAgentComplete']=function(_0x65bd00){try{if(this[_0x4076('0x19')](_0x65bd00)){if(this[_0x4076('0x5')][_0x65bd00[_0x4076('0x1a')]]&&this[_0x4076('0x5')][_0x65bd00['uniqueid']][_0x65bd00[_0x4076('0x1b')]]&&_['isUndefined'](this['channels'][_0x65bd00[_0x4076('0x1a')]][_0x65bd00[_0x4076('0x1b')]][_0x4076('0xf')])){this[_0x4076('0x5')][_0x65bd00[_0x4076('0x1a')]][_0x65bd00[_0x4076('0x1b')]][_0x4076('0xf')]=!![];this[_0x4076('0x5')][_0x65bd00['uniqueid']][_0x65bd00[_0x4076('0x1b')]]['agentcompleteAt']=moment()[_0x4076('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4076('0x5')][_0x65bd00[_0x4076('0x1a')]][_0x65bd00[_0x4076('0x1b')]][_0x4076('0x2c')]=_0x4076('0x45');this['channels'][_0x65bd00['uniqueid']][_0x65bd00[_0x4076('0x1b')]][_0x4076('0x46')]=_0x65bd00[_0x4076('0x46')];this[_0x4076('0x5')][_0x65bd00[_0x4076('0x1a')]][_0x65bd00[_0x4076('0x1b')]][_0x4076('0x38')]=_0x65bd00[_0x4076('0x38')];if(this['voiceQueues'][_0x65bd00[_0x4076('0x1d')]]&&this[_0x4076('0x6')][_0x65bd00[_0x4076('0x1d')]][_0x4076('0x47')]){this[_0x4076('0x5')][_0x65bd00[_0x4076('0x1a')]][_0x65bd00[_0x4076('0x1b')]]['agentacw']=!![];this[_0x4076('0x5')][_0x65bd00['uniqueid']][_0x65bd00['destuniqueid']]['acwtime']=this[_0x4076('0x6')][_0x65bd00[_0x4076('0x1d')]][_0x4076('0x48')];}this[_0x4076('0x7')][_0x65bd00[_0x4076('0x33')]]=_[_0x4076('0x21')](this[_0x4076('0x7')][_0x65bd00[_0x4076('0x33')]],[_0x4076('0x1d'),_0x4076('0x35')]);this['emit'](util[_0x4076('0x24')](_0x4076('0x25'),_0x65bd00[_0x4076('0x26')]),_0x4076('0x49'),this[_0x4076('0x5')][_0x65bd00[_0x4076('0x1a')]][_0x65bd00[_0x4076('0x1b')]]);ami[_0x4076('0x17')](_0x4076('0x4a'),this[_0x4076('0x5')][_0x65bd00[_0x4076('0x1a')]][_0x65bd00['destuniqueid']]);}}}catch(_0x1888cd){logger[_0x4076('0x27')](_0x4076('0x4b'),util[_0x4076('0x29')](_0x1888cd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x7b983d){try{if(this[_0x4076('0x19')](_0x7b983d)){this['addVariable'](_0x7b983d[_0x4076('0x1a')],_[_0x4076('0x4c')](_0x7b983d[_0x4076('0x4d')])[0x0],_0x7b983d['value']);if(this[_0x4076('0x5')][_0x7b983d[_0x4076('0x1a')]]){for(var _0x56ec30 in this[_0x4076('0x5')][_0x7b983d[_0x4076('0x1a')]]){if(this[_0x4076('0x5')][_0x7b983d[_0x4076('0x1a')]][_0x4076('0x4e')](_0x56ec30)){if(_[_0x4076('0x18')](this['channels'][_0x7b983d[_0x4076('0x1a')]][_0x56ec30][_0x4076('0x4f')])){this['channels'][_0x7b983d[_0x4076('0x1a')]][_0x56ec30][_0x4076('0x4f')]={};}this[_0x4076('0x5')][_0x7b983d[_0x4076('0x1a')]][_0x56ec30][_0x4076('0x4f')]=this['variables'][_0x7b983d['uniqueid']];}}}}}catch(_0x54f9a8){logger[_0x4076('0x27')](_0x4076('0x50'),util[_0x4076('0x29')](_0x54f9a8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x168216,_0x3878a5,_0x5a5544){var _0x4441f0=['rtpaudioqos',_0x4076('0x51'),_0x4076('0x52'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged',_0x4076('0x53'),_0x4076('0x54'),_0x4076('0x55'),_0x4076('0x56'),'bridgepeer',_0x4076('0x57'),_0x4076('0x58'),_0x4076('0x59'),_0x4076('0x5a'),'memberlastcall','membername',_0x4076('0x5b'),_0x4076('0x5c')];if(!_[_0x4076('0x5d')](_0x3878a5)&&!_[_0x4076('0x5e')](_0x4441f0,_0x3878a5)){if(_[_0x4076('0x18')](this[_0x4076('0x4f')][_0x168216])){this['variables'][_0x168216]={};}this[_0x4076('0x4f')][_0x168216][_0x3878a5]=_0x5a5544;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x382bad){try{if(this[_0x4076('0x19')](_0x382bad)){if(this[_0x4076('0x5')][_0x382bad[_0x4076('0x1a')]]){ami['emit'](_0x4076('0x5f'),_[_0x4076('0x60')](this[_0x4076('0x5')][_0x382bad[_0x4076('0x1a')]]));delete this[_0x4076('0x5')][_0x382bad[_0x4076('0x1a')]];}if(this[_0x4076('0x4f')][_0x382bad[_0x4076('0x1a')]]){delete this[_0x4076('0x4f')][_0x382bad[_0x4076('0x1a')]];}}}catch(_0x22d712){logger[_0x4076('0x27')](_0x4076('0x61'),util[_0x4076('0x29')](_0x22d712,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4076('0x14')]=function(_0x1b0663){try{if(this[_0x4076('0x19')](_0x1b0663)){if(this[_0x4076('0x5')][_0x1b0663[_0x4076('0x1a')]]){}}}catch(_0x27b90b){logger[_0x4076('0x27')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0x4076('0x29')](_0x27b90b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4076('0x3c')]['syncMusicOnHoldStop']=function(_0x49ae3d){try{if(this[_0x4076('0x19')](_0x49ae3d)){if(this['channels'][_0x49ae3d[_0x4076('0x1a')]]){}}}catch(_0x1b0381){logger[_0x4076('0x27')](_0x4076('0x62'),util[_0x4076('0x29')](_0x1b0381,{'showHidden':![],'depth':null}));}};module[_0x4076('0x63')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index b2b971f..e562eff 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 _0xa99f=['NO\x20ANSWER','ANSWERED','BUSY','socket.io-emitter','localhost','channels','agents','coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','newcallerid','attendedtransfer','syncAttendedTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','resolve','catch','prototype','isNotNull','isUndefined','emit','syncNewCallerId','linkedid','uniqueid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','channel','split','destconnectedlinenum','user:%s','user:agentconnect','accountcode','exten','[syncNewChannel][VoiceCallReport]','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','name','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','variable','mixmonitor_filename','xmd-phone','xmd-callerid','callerid','value','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','syncHangup','endtime','diff','billableseconds','holdtime','omit','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfercalleridnum','transfereecalleridnum','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','mohstarttime','mohtime','exports','lodash','moment','path','../../../config/logger','ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','set','queue','agi','playback','FAILED'];(function(_0x39ea5e,_0xacac04){var _0x58c9e4=function(_0x19824f){while(--_0x19824f){_0x39ea5e['push'](_0x39ea5e['shift']());}};_0x58c9e4(++_0xacac04);}(_0xa99f,0x7f));var _0xfa99=function(_0x4e181b,_0x4c650d){_0x4e181b=_0x4e181b-0x0;var _0x348fb6=_0xa99f[_0x4e181b];return _0x348fb6;};'use strict';var BPromise=require('bluebird');var _=require(_0xfa99('0x0'));var moment=require(_0xfa99('0x1'));var util=require('util');var path=require(_0xfa99('0x2'));var logger=require(_0xfa99('0x3'))(_0xfa99('0x4'));var ami=require('../ami');var Channel=require(_0xfa99('0x5'));var statusDesc=[_0xfa99('0x6'),_0xfa99('0x7'),_0xfa99('0x8'),_0xfa99('0x9'),_0xfa99('0xa'),'unavailable','ringing','ringinuse','onhold'];var applications=[_0xfa99('0xb'),_0xfa99('0xc'),_0xfa99('0xd'),'dial',_0xfa99('0xe'),'voicemail'];var dispositions=['NO\x20ANSWER','FAILED',_0xfa99('0xf'),_0xfa99('0x10'),'NO\x20ANSWER',_0xfa99('0x10'),_0xfa99('0x11'),_0xfa99('0x12'),_0xfa99('0xf'),_0xfa99('0xf'),_0xfa99('0xf')];var actions={};var io=require(_0xfa99('0x13'))({'host':_0xfa99('0x14'),'port':0x18eb});function VoiceCallReport(_0x479b98){this['channels']=_0x479b98[_0xfa99('0x15')];this[_0xfa99('0x16')]=_0x479b98[_0xfa99('0x16')];ami['on'](_0xfa99('0x17'),this[_0xfa99('0x18')]['bind'](this));ami['on'](_0xfa99('0x19'),this[_0xfa99('0x18')][_0xfa99('0x1a')](this));ami['on'](_0xfa99('0x1b'),this[_0xfa99('0x1c')]['bind'](this));ami['on'](_0xfa99('0x1d'),this[_0xfa99('0x1e')][_0xfa99('0x1a')](this));ami['on'](_0xfa99('0x1f'),this[_0xfa99('0x20')][_0xfa99('0x1a')](this));ami['on']('hangup',this['syncHangup'][_0xfa99('0x1a')](this));ami['on'](_0xfa99('0x21'),this['syncNewCallerId'][_0xfa99('0x1a')](this));ami['on'](_0xfa99('0x22'),this[_0xfa99('0x23')][_0xfa99('0x1a')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xfa99('0x1a')](this));ami['on'](_0xfa99('0x24'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xfa99('0x25'),this[_0xfa99('0x26')][_0xfa99('0x1a')](this));return BPromise[_0xfa99('0x27')]()['then'](ami['actionCoreShowChannels']())[_0xfa99('0x28')](function(_0x31403e){console['log'](_0x31403e);});}VoiceCallReport[_0xfa99('0x29')][_0xfa99('0x2a')]=function(_0x557d84){return _0x557d84!==null&&!_[_0xfa99('0x2b')](_0x557d84);};VoiceCallReport['prototype'][_0xfa99('0x2c')]=function(_0x224f65,_0x407df9,_0x5decf4){io['to'](_0x224f65)[_0xfa99('0x2c')](_0x407df9,_0x5decf4);};VoiceCallReport[_0xfa99('0x29')][_0xfa99('0x2d')]=function(_0x234fc0){try{if(this[_0xfa99('0x2a')](_0x234fc0)){if(_0x234fc0['uniqueid']===_0x234fc0[_0xfa99('0x2e')]){if(!_[_0xfa99('0x2b')](this[_0xfa99('0x15')][_0x234fc0[_0xfa99('0x2f')]])){_[_0xfa99('0x30')](this[_0xfa99('0x15')][_0x234fc0['uniqueid']],_[_0xfa99('0x31')](_0x234fc0,_[_0xfa99('0x32')](this[_0xfa99('0x15')][_0x234fc0[_0xfa99('0x2f')]])));}}}}catch(_0x2159bc){logger[_0xfa99('0x33')](_0xfa99('0x34'),util[_0xfa99('0x35')](_0x2159bc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa99('0x29')][_0xfa99('0x1c')]=function(_0x599cb4){try{if(this[_0xfa99('0x2a')](_0x599cb4)){if(_0x599cb4[_0xfa99('0x2f')]===_0x599cb4[_0xfa99('0x2e')]&&_0x599cb4['channel']!='OutgoingSpoolFailed'){if(_[_0xfa99('0x2b')](this[_0xfa99('0x15')][_0x599cb4[_0xfa99('0x2f')]])){this[_0xfa99('0x15')][_0x599cb4['uniqueid']]=new Channel();this['channels'][_0x599cb4['uniqueid']][_0xfa99('0x36')]=moment()[_0xfa99('0x37')](_0xfa99('0x38'));this[_0xfa99('0x15')][_0x599cb4[_0xfa99('0x2f')]][_0xfa99('0x39')]=dispositions[_[_0xfa99('0x3a')](_0x599cb4[_0xfa99('0x3b')])];_['merge'](this['channels'][_0x599cb4['uniqueid']],_[_0xfa99('0x31')](_0x599cb4,_[_0xfa99('0x32')](this['channels'][_0x599cb4[_0xfa99('0x2f')]])));if(_0x599cb4[_0xfa99('0x3c')]==='from-sip'){if(this[_0xfa99('0x16')][_0x599cb4[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]]){this[_0xfa99('0x16')][_0x599cb4[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]][_0xfa99('0x3f')]=_0x599cb4['exten'];this[_0xfa99('0x2c')](util[_0xfa99('0x37')](_0xfa99('0x40'),this['agents'][_0x599cb4['channel'][_0xfa99('0x3e')]('-')[0x0]]['name']),_0xfa99('0x41'),{'destaccountcode':this['agents'][_0x599cb4[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]][_0xfa99('0x42')],'destconnectedlinenum':_0x599cb4[_0xfa99('0x43')]});}}}}}}catch(_0x4517ab){logger[_0xfa99('0x33')](_0xfa99('0x44'),util[_0xfa99('0x35')](_0x4517ab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa99('0x29')][_0xfa99('0x18')]=function(_0x535dd9){try{if(this[_0xfa99('0x2a')](_0x535dd9)){if(_0x535dd9['uniqueid']===_0x535dd9['linkedid']&&_0x535dd9[_0xfa99('0x43')]!='h'&&_0x535dd9['channel']!=_0xfa99('0x45')){_0x535dd9[_0xfa99('0x46')]=_0x535dd9[_0xfa99('0x46')][_0xfa99('0x47')]();_0x535dd9[_0xfa99('0x48')]=(_0x535dd9[_0xfa99('0x49')]||_0x535dd9[_0xfa99('0x48')])['toLowerCase']();if(_[_0xfa99('0x2b')](this[_0xfa99('0x15')][_0x535dd9['uniqueid']])){this[_0xfa99('0x15')][_0x535dd9[_0xfa99('0x2f')]]=new Channel();this['channels'][_0x535dd9['uniqueid']]['starttime']=_0x535dd9['duration']?moment()['subtract'](moment['duration'](_0x535dd9[_0xfa99('0x4a')])[_0xfa99('0x4b')](),_0xfa99('0x4b'))[_0xfa99('0x37')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xfa99('0x37')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfa99('0x15')][_0x535dd9[_0xfa99('0x2f')]][_0xfa99('0x39')]=_0xfa99('0x10');}_[_0xfa99('0x30')](this[_0xfa99('0x15')][_0x535dd9['uniqueid']],_[_0xfa99('0x31')](_0x535dd9,_['keys'](this['channels'][_0x535dd9[_0xfa99('0x2f')]])));if(_[_0xfa99('0x4c')](applications,_0x535dd9[_0xfa99('0x46')])){this['channels'][_0x535dd9['uniqueid']][_0xfa99('0x4d')]=_0x535dd9[_0xfa99('0x46')];this[_0xfa99('0x15')][_0x535dd9['uniqueid']][_0xfa99('0x4e')]=_0x535dd9[_0xfa99('0x48')];if(_0x535dd9[_0xfa99('0x46')]===_0xfa99('0xb')&&_[_0xfa99('0x4f')](_0x535dd9[_0xfa99('0x48')],_0xfa99('0x50'))){var _0x5a3c87=_0x535dd9[_0xfa99('0x48')]['split']('=');var _0x5f106e=_0x5a3c87[0x0][_0xfa99('0x51')](/cdr\((.*)\)/);if(_0x5f106e){this[_0xfa99('0x15')][_0x535dd9[_0xfa99('0x2f')]][_0x5f106e[0x1]]=_0x5a3c87[0x1];}}else if(_0x535dd9[_0xfa99('0x46')]===_0xfa99('0xc')){this[_0xfa99('0x15')][_0x535dd9[_0xfa99('0x2f')]][_0xfa99('0xc')]=_0x535dd9[_0xfa99('0x48')][_0xfa99('0x3e')](',')[0x0];}}}}}catch(_0x59441e){logger[_0xfa99('0x33')](_0xfa99('0x52'),util['inspect'](_0x59441e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa99('0x29')]['syncNewState']=function(_0xd6d0ca){try{if(this[_0xfa99('0x2a')](_0xd6d0ca)){if(_0xd6d0ca['uniqueid']!==_0xd6d0ca[_0xfa99('0x2e')]){if(this[_0xfa99('0x15')][_0xd6d0ca[_0xfa99('0x2e')]]){if(_0xd6d0ca[_0xfa99('0x3b')]==='6'){if(!this[_0xfa99('0x15')][_0xd6d0ca['linkedid']]['answered']){this[_0xfa99('0x15')][_0xd6d0ca['linkedid']][_0xfa99('0x53')]=!![];this[_0xfa99('0x15')][_0xd6d0ca[_0xfa99('0x2e')]][_0xfa99('0x54')]=moment()[_0xfa99('0x37')](_0xfa99('0x38'));}this[_0xfa99('0x15')][_0xd6d0ca[_0xfa99('0x2e')]][_0xfa99('0x2e')]=_0xd6d0ca['uniqueid'];if(_0xd6d0ca['calleridnum']!==_0xfa99('0x55')){this['channels'][_0xd6d0ca[_0xfa99('0x2e')]][_0xfa99('0x56')]=_0xd6d0ca[_0xfa99('0x57')];}this['channels'][_0xd6d0ca[_0xfa99('0x2e')]][_0xfa99('0x58')]=_0xd6d0ca[_0xfa99('0x59')];this[_0xfa99('0x15')][_0xd6d0ca[_0xfa99('0x2e')]]['destinationchannel']=_0xd6d0ca[_0xfa99('0x3d')];this[_0xfa99('0x15')][_0xd6d0ca[_0xfa99('0x2e')]][_0xfa99('0x39')]=dispositions[_[_0xfa99('0x3a')](_0xd6d0ca['channelstate'])];if(this['agents'][_0xd6d0ca[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]]){this[_0xfa99('0x15')][_0xd6d0ca[_0xfa99('0x2e')]]['UserId']=this[_0xfa99('0x16')][_0xd6d0ca[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]]['id'];this[_0xfa99('0x15')][_0xd6d0ca[_0xfa99('0x2e')]]['membername']=this['agents'][_0xd6d0ca[_0xfa99('0x3d')]['split']('-')[0x0]][_0xfa99('0x5a')];}}}}else{if(this['channels'][_0xd6d0ca[_0xfa99('0x2f')]]){if(_0xd6d0ca[_0xfa99('0x3b')]==='6'){if(this[_0xfa99('0x16')][_0xd6d0ca['channel']['split']('-')[0x0]]){this[_0xfa99('0x15')][_0xd6d0ca[_0xfa99('0x2f')]][_0xfa99('0x5b')]=this[_0xfa99('0x16')][_0xd6d0ca[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]]['id'];this['channels'][_0xd6d0ca[_0xfa99('0x2f')]][_0xfa99('0x5c')]=this['agents'][_0xd6d0ca['channel'][_0xfa99('0x3e')]('-')[0x0]][_0xfa99('0x5a')];}}}}}}catch(_0x3898ce){logger[_0xfa99('0x33')](_0xfa99('0x5d'),util[_0xfa99('0x35')](_0x3898ce,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfa99('0x5e')]=function(_0x42adcb,_0x52e1c9){if(this[_0xfa99('0x15')][_0x42adcb]){this[_0xfa99('0x15')][_0x42adcb][_0xfa99('0x5f')]=!![];if(_[_0xfa99('0x60')](_0x52e1c9,_0xfa99('0x61'))){_0x52e1c9=_0x52e1c9[_0xfa99('0x62')]('.wav49',_0xfa99('0x63'));}this[_0xfa99('0x15')][_0x42adcb]['monitorFilename']=_0x52e1c9;var _0x4b96f0=_[_0xfa99('0x64')](this[_0xfa99('0x15')][_0x42adcb][_0xfa99('0x65')],{'filename':_0x52e1c9});if(_[_0xfa99('0x66')](_0x4b96f0)){this[_0xfa99('0x15')][_0x42adcb][_0xfa99('0x65')][_0xfa99('0x67')]({'filename':_0x52e1c9,'createdAt':moment()['format'](_0xfa99('0x38')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0xfa99('0x29')][_0xfa99('0x20')]=function(_0x577123){try{if(this[_0xfa99('0x2a')](_0x577123)){if(this[_0xfa99('0x15')][_0x577123[_0xfa99('0x2f')]]&&_0x577123[_0xfa99('0x3d')]!=_0xfa99('0x45')){if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')])){if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')][_0xfa99('0x69')])){this[_0xfa99('0x5e')](_0x577123);}else if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')][_0xfa99('0x6a')])){this[_0xfa99('0x15')][_0x577123['uniqueid']][_0xfa99('0x57')]=_0x577123['value'];}else if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')][_0xfa99('0x6b')])){this[_0xfa99('0x15')][_0x577123['uniqueid']][_0xfa99('0x6c')]=_0x577123[_0xfa99('0x6d')];}else if(this['isNotNull'](_0x577123[_0xfa99('0x68')][_0xfa99('0x6e')])){this[_0xfa99('0x15')][_0x577123[_0xfa99('0x2f')]][_0xfa99('0x6f')]=_0x577123['value'];}else if(this[_0xfa99('0x2a')](_0x577123['variable'][_0xfa99('0x70')])){this[_0xfa99('0x15')][_0x577123[_0xfa99('0x2f')]][_0xfa99('0xc')]=_0x577123[_0xfa99('0x6d')][_0xfa99('0x3e')](',')[0x0];}else if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')][_0xfa99('0x71')])){this['channels'][_0x577123[_0xfa99('0x2f')]][_0xfa99('0x72')]=_0x577123[_0xfa99('0x6d')];}else if(this['isNotNull'](_0x577123[_0xfa99('0x68')]['xmd-destination'])){this[_0xfa99('0x15')][_0x577123[_0xfa99('0x2f')]]['destination']=_0x577123[_0xfa99('0x6d')];}else if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')][_0xfa99('0x73')])){this[_0xfa99('0x15')][_0x577123[_0xfa99('0x2f')]][_0xfa99('0x74')]=_0x577123[_0xfa99('0x6d')];}else if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')][_0xfa99('0x75')])){this[_0xfa99('0x15')][_0x577123['uniqueid']]['queue']=_0x577123[_0xfa99('0x6d')];}else if(this[_0xfa99('0x2a')](_0x577123['variable']['sipcallid'])){this[_0xfa99('0x15')][_0x577123['uniqueid']][_0xfa99('0x76')]=_0x577123[_0xfa99('0x6d')];}}}else if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')][_0xfa99('0x69')])){if(_0x577123[_0xfa99('0x6d')]){var _0x577e53=path[_0xfa99('0x77')](_0x577123[_0xfa99('0x6d')])['name'];this[_0xfa99('0x5e')](_0x577e53,_0x577123[_0xfa99('0x6d')]);}}else if(this[_0xfa99('0x15')][_0x577123[_0xfa99('0x2e')]]){if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')])){if(this[_0xfa99('0x2a')](_0x577123[_0xfa99('0x68')][_0xfa99('0x78')])){this[_0xfa99('0x15')][_0x577123['linkedid']][_0xfa99('0x79')]=_0x577123['value'];}}}}}catch(_0x168957){logger['error'](_0xfa99('0x7a'),util[_0xfa99('0x35')](_0x168957,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa99('0x29')][_0xfa99('0x7b')]=function(_0x5ad804){try{if(this[_0xfa99('0x2a')](_0x5ad804)){if(this[_0xfa99('0x15')][_0x5ad804[_0xfa99('0x2f')]]){var _0x413e32=moment();this[_0xfa99('0x15')][_0x5ad804[_0xfa99('0x2f')]][_0xfa99('0x7c')]=_0x413e32[_0xfa99('0x37')](_0xfa99('0x38'));this['channels'][_0x5ad804['uniqueid']][_0xfa99('0x4a')]=_0x413e32[_0xfa99('0x7d')](this['channels'][_0x5ad804['uniqueid']]['starttime'],_0xfa99('0x4b'));if(this[_0xfa99('0x15')][_0x5ad804[_0xfa99('0x2f')]][_0xfa99('0x53')]){this[_0xfa99('0x15')][_0x5ad804[_0xfa99('0x2f')]][_0xfa99('0x7e')]=_0x413e32[_0xfa99('0x7d')](this[_0xfa99('0x15')][_0x5ad804['uniqueid']][_0xfa99('0x54')],_0xfa99('0x4b'));this['channels'][_0x5ad804[_0xfa99('0x2f')]][_0xfa99('0x7f')]=this['channels'][_0x5ad804['uniqueid']][_0xfa99('0x4a')]-this[_0xfa99('0x15')][_0x5ad804[_0xfa99('0x2f')]]['billableseconds'];}if(_0x5ad804['context']==='from-sip'){if(this[_0xfa99('0x16')][_0x5ad804[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]]){this[_0xfa99('0x16')][_0x5ad804[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]]=_[_0xfa99('0x80')](this['agents'][_0x5ad804['channel']['split']('-')[0x0]],[_0xfa99('0x3f')]);this[_0xfa99('0x2c')](util[_0xfa99('0x37')](_0xfa99('0x40'),this[_0xfa99('0x16')][_0x5ad804['channel'][_0xfa99('0x3e')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this['agents'][_0x5ad804[_0xfa99('0x3d')][_0xfa99('0x3e')]('-')[0x0]][_0xfa99('0x42')]});}}ami['emit'](_0xfa99('0x81'),this[_0xfa99('0x15')][_0x5ad804[_0xfa99('0x2f')]]);delete this[_0xfa99('0x15')][_0x5ad804[_0xfa99('0x2f')]];}}}catch(_0x3c376c){logger['error'](_0xfa99('0x82'),util[_0xfa99('0x35')](_0x3c376c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa99('0x29')][_0xfa99('0x23')]=function(_0x342258){try{if(this[_0xfa99('0x2a')](_0x342258)){if(this['channels'][_0x342258['transfereeuniqueid']]){this['channels'][_0x342258[_0xfa99('0x83')]]['transfercalleridnum']=_0x342258[_0xfa99('0x84')];this[_0xfa99('0x15')][_0x342258['transfereeuniqueid']][_0xfa99('0x85')]=_0x342258[_0xfa99('0x86')];var _0x259b5b=this[_0xfa99('0x15')][_0x342258[_0xfa99('0x87')]];this[_0xfa99('0x15')][_0x342258[_0xfa99('0x87')]]=this[_0xfa99('0x15')][_0x342258[_0xfa99('0x83')]];this[_0xfa99('0x15')][_0x342258[_0xfa99('0x83')]]=_0x259b5b;}}}catch(_0x5aed9c){logger[_0xfa99('0x33')]('[syncAttendedTransfer][VoiceCallReport]',util[_0xfa99('0x35')](_0x5aed9c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa99('0x29')]['syncBlindTransfer']=function(_0x113b4d){try{if(this[_0xfa99('0x2a')](_0x113b4d)){if(this[_0xfa99('0x15')][_0x113b4d[_0xfa99('0x83')]]){this[_0xfa99('0x15')][_0x113b4d[_0xfa99('0x83')]][_0xfa99('0x88')]=_0x113b4d[_0xfa99('0x89')];this['channels'][_0x113b4d[_0xfa99('0x83')]][_0xfa99('0x85')]=_0x113b4d['extension'];this[_0xfa99('0x7b')]({'event':_0xfa99('0x8a'),'uniqueid':_0x113b4d[_0xfa99('0x83')],'context':_0x113b4d[_0xfa99('0x3c')],'channel':_0x113b4d['transfererchannel']});}}}catch(_0x5dadae){logger[_0xfa99('0x33')](_0xfa99('0x8b'),util['inspect'](_0x5dadae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa99('0x29')]['syncMusicOnHoldStart']=function(_0x5bd09e){try{if(this[_0xfa99('0x2a')](_0x5bd09e)){if(this['channels'][_0x5bd09e[_0xfa99('0x2f')]]){if(!_[_0xfa99('0x66')](this[_0xfa99('0x15')][_0x5bd09e[_0xfa99('0x2f')]][_0xfa99('0x54')])){this[_0xfa99('0x15')][_0x5bd09e[_0xfa99('0x2f')]][_0xfa99('0x8c')]=moment()[_0xfa99('0x37')](_0xfa99('0x38'));}}}}catch(_0xea0c47){logger[_0xfa99('0x33')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0xfa99('0x35')](_0xea0c47,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa99('0x29')][_0xfa99('0x26')]=function(_0x3d1f4e){try{if(this['isNotNull'](_0x3d1f4e)){if(this[_0xfa99('0x15')][_0x3d1f4e[_0xfa99('0x2f')]]){if(!_[_0xfa99('0x66')](this[_0xfa99('0x15')][_0x3d1f4e[_0xfa99('0x2f')]][_0xfa99('0x8c')])){this['channels'][_0x3d1f4e[_0xfa99('0x2f')]][_0xfa99('0x8d')]+=moment()['milliseconds'](0x0)[_0xfa99('0x7d')](this[_0xfa99('0x15')][_0x3d1f4e['uniqueid']]['mohstarttime'],_0xfa99('0x4b'));delete this['channels'][_0x3d1f4e[_0xfa99('0x2f')]][_0xfa99('0x8c')];}}}}catch(_0x588761){logger[_0xfa99('0x33')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0xfa99('0x35')](_0x588761,{'showHidden':![],'depth':null}));}};module[_0xfa99('0x8e')]=VoiceCallReport; \ No newline at end of file +var _0xa758=['diff','mohstarttime','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','util','path','../../../config/logger','ami','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','newcallerid','syncNewCallerId','blindtransfer','syncBlindTransfer','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','prototype','isNotNull','isUndefined','emit','linkedid','uniqueid','merge','pick','[syncNewCallerId][VoiceCallReport]','inspect','channel','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','keys','context','from-sip','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','OutgoingSpoolFailed','application','applicationdata','starttime','duration','subtract','seconds','includes','lastdata','set','startsWith','match','queue','[syncNewExten][VoiceCallReport]','answered','answertime','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','toNumber','membername','UserId','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','rec','syncVarSet','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','xmd-cdrtype','type','originatecalleridnum','calleridpreview','xmcs-queue','sipcallid','parse','syncMixMonitorFilename','error','[syncVarSet][VoiceCallReport]','syncHangup','endtime','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfercalleridnum','origtransferercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds'];(function(_0x323f99,_0x906add){var _0x35eb59=function(_0x21162d){while(--_0x21162d){_0x323f99['push'](_0x323f99['shift']());}};_0x35eb59(++_0x906add);}(_0xa758,0x1ba));var _0x8a75=function(_0x58f678,_0x18b3cc){_0x58f678=_0x58f678-0x0;var _0x238aef=_0xa758[_0x58f678];return _0x238aef;};'use strict';var BPromise=require('bluebird');var _=require(_0x8a75('0x0'));var moment=require('moment');var util=require(_0x8a75('0x1'));var path=require(_0x8a75('0x2'));var logger=require(_0x8a75('0x3'))(_0x8a75('0x4'));var ami=require('../ami');var Channel=require('../model/channel');var statusDesc=[_0x8a75('0x5'),_0x8a75('0x6'),_0x8a75('0x7'),_0x8a75('0x8'),_0x8a75('0x9'),_0x8a75('0xa'),_0x8a75('0xb'),_0x8a75('0xc'),_0x8a75('0xd')];var applications=['set','queue',_0x8a75('0xe'),_0x8a75('0xf'),'playback',_0x8a75('0x10')];var dispositions=[_0x8a75('0x11'),_0x8a75('0x12'),_0x8a75('0x12'),_0x8a75('0x11'),_0x8a75('0x11'),_0x8a75('0x11'),_0x8a75('0x13'),_0x8a75('0x14'),_0x8a75('0x12'),_0x8a75('0x12'),'FAILED'];var actions={};var io=require('socket.io-emitter')({'host':_0x8a75('0x15'),'port':0x18eb});function VoiceCallReport(_0x1a95b0){this[_0x8a75('0x16')]=_0x1a95b0['channels'];this[_0x8a75('0x17')]=_0x1a95b0[_0x8a75('0x17')];ami['on'](_0x8a75('0x18'),this[_0x8a75('0x19')][_0x8a75('0x1a')](this));ami['on'](_0x8a75('0x1b'),this[_0x8a75('0x19')][_0x8a75('0x1a')](this));ami['on'](_0x8a75('0x1c'),this[_0x8a75('0x1d')][_0x8a75('0x1a')](this));ami['on'](_0x8a75('0x1e'),this[_0x8a75('0x1f')][_0x8a75('0x1a')](this));ami['on'](_0x8a75('0x20'),this['syncVarSet'][_0x8a75('0x1a')](this));ami['on'](_0x8a75('0x21'),this['syncHangup'][_0x8a75('0x1a')](this));ami['on'](_0x8a75('0x22'),this[_0x8a75('0x23')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x8a75('0x1a')](this));ami['on'](_0x8a75('0x24'),this[_0x8a75('0x25')][_0x8a75('0x1a')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this[_0x8a75('0x26')][_0x8a75('0x1a')](this));return BPromise['resolve']()[_0x8a75('0x27')](ami[_0x8a75('0x28')]())[_0x8a75('0x29')](function(_0x2a6f74){console['log'](_0x2a6f74);});}VoiceCallReport[_0x8a75('0x2a')][_0x8a75('0x2b')]=function(_0x5b60c7){return _0x5b60c7!==null&&!_[_0x8a75('0x2c')](_0x5b60c7);};VoiceCallReport[_0x8a75('0x2a')][_0x8a75('0x2d')]=function(_0x4633f8,_0xed12ab,_0x15c7b1){io['to'](_0x4633f8)['emit'](_0xed12ab,_0x15c7b1);};VoiceCallReport[_0x8a75('0x2a')][_0x8a75('0x23')]=function(_0x33d822){try{if(this[_0x8a75('0x2b')](_0x33d822)){if(_0x33d822['uniqueid']===_0x33d822[_0x8a75('0x2e')]){if(!_[_0x8a75('0x2c')](this[_0x8a75('0x16')][_0x33d822[_0x8a75('0x2f')]])){_[_0x8a75('0x30')](this['channels'][_0x33d822[_0x8a75('0x2f')]],_[_0x8a75('0x31')](_0x33d822,_['keys'](this['channels'][_0x33d822[_0x8a75('0x2f')]])));}}}}catch(_0x75333b){logger['error'](_0x8a75('0x32'),util[_0x8a75('0x33')](_0x75333b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a75('0x2a')]['syncNewChannel']=function(_0x45c2da){try{if(this['isNotNull'](_0x45c2da)){if(_0x45c2da[_0x8a75('0x2f')]===_0x45c2da['linkedid']&&_0x45c2da[_0x8a75('0x34')]!='OutgoingSpoolFailed'){if(_[_0x8a75('0x2c')](this[_0x8a75('0x16')][_0x45c2da[_0x8a75('0x2f')]])){this[_0x8a75('0x16')][_0x45c2da[_0x8a75('0x2f')]]=new Channel();this['channels'][_0x45c2da['uniqueid']]['starttime']=moment()[_0x8a75('0x35')](_0x8a75('0x36'));this[_0x8a75('0x16')][_0x45c2da['uniqueid']][_0x8a75('0x37')]=dispositions[_['toNumber'](_0x45c2da[_0x8a75('0x38')])];_[_0x8a75('0x30')](this['channels'][_0x45c2da[_0x8a75('0x2f')]],_['pick'](_0x45c2da,_[_0x8a75('0x39')](this[_0x8a75('0x16')][_0x45c2da[_0x8a75('0x2f')]])));if(_0x45c2da[_0x8a75('0x3a')]===_0x8a75('0x3b')){if(this[_0x8a75('0x17')][_0x45c2da[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]]){this[_0x8a75('0x17')][_0x45c2da[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]][_0x8a75('0x3d')]=_0x45c2da[_0x8a75('0x3e')];this[_0x8a75('0x2d')](util['format'](_0x8a75('0x3f'),this['agents'][_0x45c2da[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]][_0x8a75('0x40')]),_0x8a75('0x41'),{'destaccountcode':this[_0x8a75('0x17')][_0x45c2da[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]][_0x8a75('0x42')],'destconnectedlinenum':_0x45c2da[_0x8a75('0x3e')]});}}}}}}catch(_0x478a52){logger['error'](_0x8a75('0x43'),util['inspect'](_0x478a52,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a75('0x2a')]['syncNewExten']=function(_0x1d3341){try{if(this[_0x8a75('0x2b')](_0x1d3341)){if(_0x1d3341[_0x8a75('0x2f')]===_0x1d3341[_0x8a75('0x2e')]&&_0x1d3341[_0x8a75('0x3e')]!='h'&&_0x1d3341[_0x8a75('0x34')]!=_0x8a75('0x44')){_0x1d3341[_0x8a75('0x45')]=_0x1d3341[_0x8a75('0x45')]['toLowerCase']();_0x1d3341[_0x8a75('0x46')]=(_0x1d3341['appdata']||_0x1d3341[_0x8a75('0x46')])['toLowerCase']();if(_[_0x8a75('0x2c')](this[_0x8a75('0x16')][_0x1d3341[_0x8a75('0x2f')]])){this['channels'][_0x1d3341['uniqueid']]=new Channel();this[_0x8a75('0x16')][_0x1d3341[_0x8a75('0x2f')]][_0x8a75('0x47')]=_0x1d3341[_0x8a75('0x48')]?moment()[_0x8a75('0x49')](moment[_0x8a75('0x48')](_0x1d3341[_0x8a75('0x48')])[_0x8a75('0x4a')](),_0x8a75('0x4a'))[_0x8a75('0x35')](_0x8a75('0x36')):moment()[_0x8a75('0x35')](_0x8a75('0x36'));this[_0x8a75('0x16')][_0x1d3341[_0x8a75('0x2f')]]['disposition']='NO\x20ANSWER';}_[_0x8a75('0x30')](this[_0x8a75('0x16')][_0x1d3341[_0x8a75('0x2f')]],_[_0x8a75('0x31')](_0x1d3341,_[_0x8a75('0x39')](this[_0x8a75('0x16')][_0x1d3341[_0x8a75('0x2f')]])));if(_[_0x8a75('0x4b')](applications,_0x1d3341[_0x8a75('0x45')])){this[_0x8a75('0x16')][_0x1d3341[_0x8a75('0x2f')]]['lastapplication']=_0x1d3341[_0x8a75('0x45')];this[_0x8a75('0x16')][_0x1d3341[_0x8a75('0x2f')]][_0x8a75('0x4c')]=_0x1d3341[_0x8a75('0x46')];if(_0x1d3341[_0x8a75('0x45')]===_0x8a75('0x4d')&&_[_0x8a75('0x4e')](_0x1d3341['applicationdata'],'cdr(')){var _0x261b45=_0x1d3341['applicationdata'][_0x8a75('0x3c')]('=');var _0x22301a=_0x261b45[0x0][_0x8a75('0x4f')](/cdr\((.*)\)/);if(_0x22301a){this[_0x8a75('0x16')][_0x1d3341[_0x8a75('0x2f')]][_0x22301a[0x1]]=_0x261b45[0x1];}}else if(_0x1d3341[_0x8a75('0x45')]===_0x8a75('0x50')){this['channels'][_0x1d3341[_0x8a75('0x2f')]][_0x8a75('0x50')]=_0x1d3341[_0x8a75('0x46')][_0x8a75('0x3c')](',')[0x0];}}}}}catch(_0x1fc97f){logger['error'](_0x8a75('0x51'),util[_0x8a75('0x33')](_0x1fc97f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a75('0x2a')][_0x8a75('0x1f')]=function(_0x2b8080){try{if(this['isNotNull'](_0x2b8080)){if(_0x2b8080[_0x8a75('0x2f')]!==_0x2b8080['linkedid']){if(this['channels'][_0x2b8080['linkedid']]){if(_0x2b8080['channelstate']==='6'){if(!this[_0x8a75('0x16')][_0x2b8080['linkedid']][_0x8a75('0x52')]){this[_0x8a75('0x16')][_0x2b8080[_0x8a75('0x2e')]][_0x8a75('0x52')]=!![];this['channels'][_0x2b8080[_0x8a75('0x2e')]][_0x8a75('0x53')]=moment()[_0x8a75('0x35')](_0x8a75('0x36'));}this['channels'][_0x2b8080[_0x8a75('0x2e')]]['linkedid']=_0x2b8080[_0x8a75('0x2f')];if(_0x2b8080['calleridnum']!==_0x8a75('0x54')){this['channels'][_0x2b8080[_0x8a75('0x2e')]][_0x8a75('0x55')]=_0x2b8080[_0x8a75('0x56')];}this[_0x8a75('0x16')][_0x2b8080[_0x8a75('0x2e')]][_0x8a75('0x57')]=_0x2b8080[_0x8a75('0x58')];this['channels'][_0x2b8080[_0x8a75('0x2e')]][_0x8a75('0x59')]=_0x2b8080[_0x8a75('0x34')];this[_0x8a75('0x16')][_0x2b8080[_0x8a75('0x2e')]]['disposition']=dispositions[_[_0x8a75('0x5a')](_0x2b8080[_0x8a75('0x38')])];if(this[_0x8a75('0x17')][_0x2b8080[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]]){this[_0x8a75('0x16')][_0x2b8080[_0x8a75('0x2e')]]['UserId']=this[_0x8a75('0x17')][_0x2b8080['channel'][_0x8a75('0x3c')]('-')[0x0]]['id'];this[_0x8a75('0x16')][_0x2b8080['linkedid']][_0x8a75('0x5b')]=this['agents'][_0x2b8080[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]][_0x8a75('0x40')];}}}}else{if(this['channels'][_0x2b8080['uniqueid']]){if(_0x2b8080[_0x8a75('0x38')]==='6'){if(this[_0x8a75('0x17')][_0x2b8080[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]]){this['channels'][_0x2b8080[_0x8a75('0x2f')]][_0x8a75('0x5c')]=this[_0x8a75('0x17')][_0x2b8080[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]]['id'];this['channels'][_0x2b8080[_0x8a75('0x2f')]]['membername']=this['agents'][_0x2b8080['channel']['split']('-')[0x0]][_0x8a75('0x40')];}}}}}}catch(_0x3c396f){logger['error']('[syncNewState][VoiceCallReport]',util[_0x8a75('0x33')](_0x3c396f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a75('0x2a')]['syncMixMonitorFilename']=function(_0x3c8bb8,_0x80636b){if(this[_0x8a75('0x16')][_0x3c8bb8]){this[_0x8a75('0x16')][_0x3c8bb8][_0x8a75('0x5d')]=!![];if(_[_0x8a75('0x5e')](_0x80636b,_0x8a75('0x5f'))){_0x80636b=_0x80636b[_0x8a75('0x60')](_0x8a75('0x5f'),_0x8a75('0x61'));}this[_0x8a75('0x16')][_0x3c8bb8]['monitorFilename']=_0x80636b;var _0x8a5421=_[_0x8a75('0x62')](this[_0x8a75('0x16')][_0x3c8bb8][_0x8a75('0x63')],{'filename':_0x80636b});if(_[_0x8a75('0x64')](_0x8a5421)){this[_0x8a75('0x16')][_0x3c8bb8][_0x8a75('0x63')][_0x8a75('0x65')]({'filename':_0x80636b,'createdAt':moment()[_0x8a75('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x8a75('0x66')});}}};VoiceCallReport['prototype'][_0x8a75('0x67')]=function(_0x24a8df){try{if(this[_0x8a75('0x2b')](_0x24a8df)){if(this['channels'][_0x24a8df[_0x8a75('0x2f')]]&&_0x24a8df[_0x8a75('0x34')]!=_0x8a75('0x44')){if(this['isNotNull'](_0x24a8df[_0x8a75('0x68')])){if(this[_0x8a75('0x2b')](_0x24a8df[_0x8a75('0x68')][_0x8a75('0x69')])){this['syncMixMonitorFilename'](_0x24a8df[_0x8a75('0x2f')],_0x24a8df[_0x8a75('0x6a')]);}else if(this[_0x8a75('0x2b')](_0x24a8df['variable'][_0x8a75('0x6b')])){this[_0x8a75('0x16')][_0x24a8df[_0x8a75('0x2f')]][_0x8a75('0x56')]=_0x24a8df[_0x8a75('0x6a')];}else if(this[_0x8a75('0x2b')](_0x24a8df[_0x8a75('0x68')][_0x8a75('0x6c')])){this[_0x8a75('0x16')][_0x24a8df[_0x8a75('0x2f')]]['callerid']=_0x24a8df[_0x8a75('0x6a')];}else if(this['isNotNull'](_0x24a8df[_0x8a75('0x68')][_0x8a75('0x6d')])){this[_0x8a75('0x16')][_0x24a8df[_0x8a75('0x2f')]][_0x8a75('0x6e')]=_0x24a8df['value'];}else if(this[_0x8a75('0x2b')](_0x24a8df[_0x8a75('0x68')]['xmd-queue'])){this['channels'][_0x24a8df[_0x8a75('0x2f')]][_0x8a75('0x50')]=_0x24a8df[_0x8a75('0x6a')][_0x8a75('0x3c')](',')[0x0];}else if(this[_0x8a75('0x2b')](_0x24a8df[_0x8a75('0x68')]['xmd-originatecalleridnum'])){this[_0x8a75('0x16')][_0x24a8df[_0x8a75('0x2f')]][_0x8a75('0x6f')]=_0x24a8df[_0x8a75('0x6a')];}else if(this['isNotNull'](_0x24a8df[_0x8a75('0x68')]['xmd-destination'])){this['channels'][_0x24a8df[_0x8a75('0x2f')]]['destination']=_0x24a8df['value'];}else if(this[_0x8a75('0x2b')](_0x24a8df[_0x8a75('0x68')]['xmd-callerid-preview'])){this[_0x8a75('0x16')][_0x24a8df[_0x8a75('0x2f')]][_0x8a75('0x70')]=_0x24a8df[_0x8a75('0x6a')];}else if(this[_0x8a75('0x2b')](_0x24a8df[_0x8a75('0x68')][_0x8a75('0x71')])){this[_0x8a75('0x16')][_0x24a8df[_0x8a75('0x2f')]][_0x8a75('0x50')]=_0x24a8df['value'];}else if(this['isNotNull'](_0x24a8df[_0x8a75('0x68')][_0x8a75('0x72')])){this[_0x8a75('0x16')][_0x24a8df[_0x8a75('0x2f')]]['sipcalluniqueid']=_0x24a8df[_0x8a75('0x6a')];}}}else if(this[_0x8a75('0x2b')](_0x24a8df[_0x8a75('0x68')][_0x8a75('0x69')])){if(_0x24a8df[_0x8a75('0x6a')]){var _0x5ba689=path[_0x8a75('0x73')](_0x24a8df[_0x8a75('0x6a')])[_0x8a75('0x40')];this[_0x8a75('0x74')](_0x5ba689,_0x24a8df[_0x8a75('0x6a')]);}}else if(this[_0x8a75('0x16')][_0x24a8df['linkedid']]){if(this['isNotNull'](_0x24a8df[_0x8a75('0x68')])){if(this[_0x8a75('0x2b')](_0x24a8df[_0x8a75('0x68')][_0x8a75('0x72')])){this[_0x8a75('0x16')][_0x24a8df[_0x8a75('0x2e')]]['sipcalllinkedid']=_0x24a8df[_0x8a75('0x6a')];}}}}}catch(_0xb8712d){logger[_0x8a75('0x75')](_0x8a75('0x76'),util[_0x8a75('0x33')](_0xb8712d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8a75('0x77')]=function(_0x50e373){try{if(this[_0x8a75('0x2b')](_0x50e373)){if(this[_0x8a75('0x16')][_0x50e373[_0x8a75('0x2f')]]){var _0x55665a=moment();this[_0x8a75('0x16')][_0x50e373[_0x8a75('0x2f')]][_0x8a75('0x78')]=_0x55665a['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a75('0x16')][_0x50e373[_0x8a75('0x2f')]][_0x8a75('0x48')]=_0x55665a['diff'](this['channels'][_0x50e373[_0x8a75('0x2f')]]['starttime'],_0x8a75('0x4a'));if(this['channels'][_0x50e373[_0x8a75('0x2f')]][_0x8a75('0x52')]){this[_0x8a75('0x16')][_0x50e373[_0x8a75('0x2f')]][_0x8a75('0x79')]=_0x55665a['diff'](this[_0x8a75('0x16')][_0x50e373[_0x8a75('0x2f')]][_0x8a75('0x53')],_0x8a75('0x4a'));this[_0x8a75('0x16')][_0x50e373[_0x8a75('0x2f')]]['holdtime']=this['channels'][_0x50e373['uniqueid']]['duration']-this[_0x8a75('0x16')][_0x50e373['uniqueid']]['billableseconds'];}if(_0x50e373['context']===_0x8a75('0x3b')){if(this['agents'][_0x50e373[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]]){this['agents'][_0x50e373['channel'][_0x8a75('0x3c')]('-')[0x0]]=_[_0x8a75('0x7a')](this['agents'][_0x50e373['channel'][_0x8a75('0x3c')]('-')[0x0]],[_0x8a75('0x3d')]);this[_0x8a75('0x2d')](util[_0x8a75('0x35')](_0x8a75('0x3f'),this['agents'][_0x50e373[_0x8a75('0x34')]['split']('-')[0x0]]['name']),_0x8a75('0x7b'),{'destaccountcode':this[_0x8a75('0x17')][_0x50e373[_0x8a75('0x34')][_0x8a75('0x3c')]('-')[0x0]][_0x8a75('0x42')]});}}ami['emit'](_0x8a75('0x7c'),this[_0x8a75('0x16')][_0x50e373[_0x8a75('0x2f')]]);delete this[_0x8a75('0x16')][_0x50e373[_0x8a75('0x2f')]];}}}catch(_0x18ec0a){logger['error'](_0x8a75('0x7d'),util[_0x8a75('0x33')](_0x18ec0a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a75('0x2a')][_0x8a75('0x7e')]=function(_0x2830e1){try{if(this[_0x8a75('0x2b')](_0x2830e1)){if(this['channels'][_0x2830e1['transfereeuniqueid']]){this[_0x8a75('0x16')][_0x2830e1['transfereeuniqueid']][_0x8a75('0x7f')]=_0x2830e1[_0x8a75('0x80')];this[_0x8a75('0x16')][_0x2830e1[_0x8a75('0x81')]][_0x8a75('0x82')]=_0x2830e1['transfertargetcalleridnum'];var _0x1ff0f1=this[_0x8a75('0x16')][_0x2830e1[_0x8a75('0x83')]];this[_0x8a75('0x16')][_0x2830e1['secondtransfereruniqueid']]=this['channels'][_0x2830e1[_0x8a75('0x81')]];this[_0x8a75('0x16')][_0x2830e1['transfereeuniqueid']]=_0x1ff0f1;}}}catch(_0x30374f){logger['error'](_0x8a75('0x84'),util[_0x8a75('0x33')](_0x30374f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a75('0x2a')]['syncBlindTransfer']=function(_0x4de634){try{if(this[_0x8a75('0x2b')](_0x4de634)){if(this[_0x8a75('0x16')][_0x4de634[_0x8a75('0x81')]]){this[_0x8a75('0x16')][_0x4de634[_0x8a75('0x81')]][_0x8a75('0x7f')]=_0x4de634[_0x8a75('0x85')];this[_0x8a75('0x16')][_0x4de634[_0x8a75('0x81')]][_0x8a75('0x82')]=_0x4de634[_0x8a75('0x86')];this[_0x8a75('0x77')]({'event':_0x8a75('0x87'),'uniqueid':_0x4de634['transfereeuniqueid'],'context':_0x4de634[_0x8a75('0x3a')],'channel':_0x4de634[_0x8a75('0x88')]});}}}catch(_0x1a6760){logger[_0x8a75('0x75')](_0x8a75('0x89'),util[_0x8a75('0x33')](_0x1a6760,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a75('0x2a')][_0x8a75('0x8a')]=function(_0xe37002){try{if(this[_0x8a75('0x2b')](_0xe37002)){if(this[_0x8a75('0x16')][_0xe37002['uniqueid']]){if(!_[_0x8a75('0x64')](this['channels'][_0xe37002[_0x8a75('0x2f')]][_0x8a75('0x53')])){this['channels'][_0xe37002[_0x8a75('0x2f')]]['mohstarttime']=moment()[_0x8a75('0x35')](_0x8a75('0x36'));}}}}catch(_0x27d466){logger[_0x8a75('0x75')](_0x8a75('0x8b'),util[_0x8a75('0x33')](_0x27d466,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a75('0x2a')][_0x8a75('0x26')]=function(_0x357fbd){try{if(this[_0x8a75('0x2b')](_0x357fbd)){if(this[_0x8a75('0x16')][_0x357fbd['uniqueid']]){if(!_[_0x8a75('0x64')](this[_0x8a75('0x16')][_0x357fbd[_0x8a75('0x2f')]]['mohstarttime'])){this['channels'][_0x357fbd[_0x8a75('0x2f')]][_0x8a75('0x8c')]+=moment()[_0x8a75('0x8d')](0x0)[_0x8a75('0x8e')](this[_0x8a75('0x16')][_0x357fbd[_0x8a75('0x2f')]]['mohstarttime'],_0x8a75('0x4a'));delete this['channels'][_0x357fbd[_0x8a75('0x2f')]][_0x8a75('0x8f')];}}}}catch(_0x26ae89){logger[_0x8a75('0x75')](_0x8a75('0x90'),util[_0x8a75('0x33')](_0x26ae89,{'showHidden':![],'depth':null}));}};module[_0x8a75('0x91')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 2c0cfaa..7c63cf5 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 _0xa6f5=['outboundrouteid','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberrealtime','isNil','includes','duration','endtime','starttime','seconds','answered','holdtime','diff','billableseconds','sumDuration','custom:dialend','voice_outbound:save','voice_outbound_channel:remove','exports','lodash','moment','../../../config/logger','ami','../ami','localhost','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','channels','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','error','inspect','syncVarSet','addVariable','keys','variable'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xa6f5,0x149));var _0x5a6f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa6f5[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x5a6f('0x0'));var moment=require(_0x5a6f('0x1'));var util=require('util');var logger=require(_0x5a6f('0x2'))(_0x5a6f('0x3'));var ami=require(_0x5a6f('0x4'));var io=require('socket.io-emitter')({'host':_0x5a6f('0x5'),'port':0x18eb});function VoiceDialReport(_0x87101b){this['channels']=_0x87101b[_0x5a6f('0x6')];this['outbound']=_0x87101b[_0x5a6f('0x7')];this[_0x5a6f('0x8')]={};ami['on'](_0x5a6f('0x9'),this[_0x5a6f('0xa')][_0x5a6f('0xb')](this));ami['on']('dialend',this['syncDialEnd'][_0x5a6f('0xb')](this));ami['on']('varset',this['syncVarSet'][_0x5a6f('0xb')](this));ami['on'](_0x5a6f('0xc'),this[_0x5a6f('0xd')]['bind'](this));}VoiceDialReport[_0x5a6f('0xe')][_0x5a6f('0xf')]=function(_0x55030e){return _0x55030e!==null&&!_[_0x5a6f('0x10')](_0x55030e);};VoiceDialReport[_0x5a6f('0xe')][_0x5a6f('0x11')]=function(_0x29007c,_0x16b4db,_0xf7a65b){io['to'](_0x29007c)[_0x5a6f('0x11')](_0x16b4db,_0xf7a65b);};VoiceDialReport[_0x5a6f('0xe')][_0x5a6f('0xa')]=function(_0x5181b6){try{if(this[_0x5a6f('0xf')](_0x5181b6)){if(this[_0x5a6f('0x12')][_0x5181b6[_0x5a6f('0x13')]]){_['merge'](this['channels'][_0x5181b6[_0x5a6f('0x13')]],{'starttime':moment()[_0x5a6f('0x14')](_0x5a6f('0x15')),'lastevent':_0x5a6f('0x16'),'interface':_0x5181b6[_0x5a6f('0x17')][_0x5a6f('0x18')](0x0,_0x5181b6[_0x5a6f('0x17')][_0x5a6f('0x19')]('-')),'membername':_0x5181b6[_0x5a6f('0x17')][_0x5a6f('0x18')](_0x5181b6[_0x5a6f('0x17')]['lastIndexOf']('/')+0x1,_0x5181b6['channel'][_0x5a6f('0x19')]('-'))},_[_0x5a6f('0x1a')](_0x5181b6,['event',_0x5a6f('0x1b')]));this['emit'](_0x5a6f('0x1c'),_0x5a6f('0x1d'),this['channels'][_0x5181b6[_0x5a6f('0x13')]]);ami['emit'](_0x5a6f('0x1e'),this[_0x5a6f('0x12')][_0x5181b6[_0x5a6f('0x13')]]);}}}catch(_0xb893f2){logger['error']('[syncDialBegin][VoiceDialReport]',util['inspect'](_0xb893f2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5a6f('0xe')][_0x5a6f('0x1f')]=function(_0x3addee){try{if(this['isNotNull'](_0x3addee)){if(this[_0x5a6f('0x12')][_0x3addee[_0x5a6f('0x13')]]){this[_0x5a6f('0x12')][_0x3addee[_0x5a6f('0x13')]]['dialstatus']=_0x3addee[_0x5a6f('0x20')];if(_0x3addee['dialstatus']===_0x5a6f('0x21')){this[_0x5a6f('0x12')][_0x3addee[_0x5a6f('0x13')]][_0x5a6f('0x22')]=_0x3addee[_0x5a6f('0x22')];this['channels'][_0x3addee[_0x5a6f('0x13')]][_0x5a6f('0x23')]=_0x3addee['connectedlinename'];this[_0x5a6f('0x12')][_0x3addee['uniqueid']][_0x5a6f('0x24')]=moment()[_0x5a6f('0x14')](_0x5a6f('0x15'));this[_0x5a6f('0x12')][_0x3addee[_0x5a6f('0x13')]][_0x5a6f('0x25')]=_0x5a6f('0x26');ami[_0x5a6f('0x11')](_0x5a6f('0x27'),this[_0x5a6f('0x12')][_0x3addee[_0x5a6f('0x13')]]);}this[_0x5a6f('0x11')](_0x5a6f('0x1c'),'voice_outbound_channel:save',this['channels'][_0x3addee[_0x5a6f('0x13')]]);}}}catch(_0x406d63){logger[_0x5a6f('0x28')]('[syncDialEnd][VoiceDialReport]',util[_0x5a6f('0x29')](_0x406d63,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5a6f('0xe')][_0x5a6f('0x2a')]=function(_0x530b3f){try{if(this[_0x5a6f('0xf')](_0x530b3f)){this[_0x5a6f('0x2b')](_0x530b3f[_0x5a6f('0x13')],_[_0x5a6f('0x2c')](_0x530b3f[_0x5a6f('0x2d')])[0x0],_0x530b3f['value']);if(this['isNotNull'](_0x530b3f[_0x5a6f('0x2d')])&&this[_0x5a6f('0xf')](_0x530b3f[_0x5a6f('0x2d')][_0x5a6f('0x2e')])){if(_[_0x5a6f('0x10')](this[_0x5a6f('0x12')][_0x530b3f[_0x5a6f('0x13')]])){this[_0x5a6f('0x12')][_0x530b3f['uniqueid']]={'routeId':_0x530b3f['value'],'variables':this[_0x5a6f('0x8')][_0x530b3f[_0x5a6f('0x13')]]};this['emit'](_0x5a6f('0x1c'),_0x5a6f('0x1d'),this['channels'][_0x530b3f[_0x5a6f('0x13')]]);}}}}catch(_0x18d167){logger[_0x5a6f('0x28')]('[syncVarSet][VoiceDialReport]',util['inspect'](_0x18d167,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5a6f('0x2b')]=function(_0x47d18f,_0x5406e3,_0x5929c1){var _0x109421=['rtpaudioqos',_0x5a6f('0x2f'),_0x5a6f('0x30'),'rtpaudioqosjitterbridged',_0x5a6f('0x31'),_0x5a6f('0x32'),_0x5a6f('0x33'),'rtpaudioqosrttbridged','sipcallid','sipuri',_0x5a6f('0x34'),_0x5a6f('0x35'),_0x5a6f('0x36'),_0x5a6f('0x37'),_0x5a6f('0x38'),_0x5a6f('0x39'),_0x5a6f('0x3a'),'memberpenalty',_0x5a6f('0x3b')];if(!_[_0x5a6f('0x3c')](_0x5406e3)&&!_[_0x5a6f('0x3d')](_0x109421,_0x5406e3)){if(_[_0x5a6f('0x10')](this['variables'][_0x47d18f])){this['variables'][_0x47d18f]={};}this['variables'][_0x47d18f][_0x5406e3]=_0x5929c1;}};VoiceDialReport[_0x5a6f('0xe')][_0x5a6f('0xd')]=function(_0x5c051d){try{if(this[_0x5a6f('0xf')](_0x5c051d)){if(this[_0x5a6f('0x12')][_0x5c051d['uniqueid']]){this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]]['endtime']=moment()[_0x5a6f('0x14')](_0x5a6f('0x15'));this[_0x5a6f('0x12')][_0x5c051d['uniqueid']][_0x5a6f('0x3e')]=moment(this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x3f')])['diff'](this['channels'][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x40')],_0x5a6f('0x41'));this['channels'][_0x5c051d['uniqueid']][_0x5a6f('0x25')]='complete';this[_0x5a6f('0x7')]['total']+=0x1;if(this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x24')]){this[_0x5a6f('0x7')][_0x5a6f('0x42')]+=0x1;this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x43')]=moment(this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]]['answertime'])[_0x5a6f('0x44')](this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]]['starttime'],'seconds');this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x45')]=moment(this['channels'][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x3f')])[_0x5a6f('0x44')](this['channels'][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x24')],'seconds');this[_0x5a6f('0x7')]['sumHoldTime']+=this['channels'][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x43')]||0x0;this[_0x5a6f('0x7')]['sumBillable']+=this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]]['billableseconds'];}this[_0x5a6f('0x7')][_0x5a6f('0x46')]+=this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]][_0x5a6f('0x3e')];ami[_0x5a6f('0x11')]('custom:voiceDialReport',this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]]);ami[_0x5a6f('0x11')](_0x5a6f('0x47'),this['channels'][_0x5c051d[_0x5a6f('0x13')]]);this[_0x5a6f('0x11')](_0x5a6f('0x1c'),_0x5a6f('0x48'),this[_0x5a6f('0x7')]);this[_0x5a6f('0x11')](_0x5a6f('0x1c'),_0x5a6f('0x49'),this['channels'][_0x5c051d[_0x5a6f('0x13')]]);delete this[_0x5a6f('0x12')][_0x5c051d[_0x5a6f('0x13')]];}if(this['variables'][_0x5c051d['uniqueid']]){delete this['variables'][_0x5c051d[_0x5a6f('0x13')]];}}}catch(_0x3cb670){logger['error']('[syncHangup][VoiceDialReport]',util[_0x5a6f('0x29')](_0x3cb670,{'showHidden':![],'depth':null}));}};module[_0x5a6f('0x4a')]=VoiceDialReport; \ No newline at end of file +var _0x47d1=['[syncDialEnd][VoiceDialReport]','value','variable','outboundrouteid','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','endtime','duration','diff','starttime','lastevent','complete','total','answered','holdtime','seconds','billableseconds','sumHoldTime','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','util','../../../config/logger','ami','localhost','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','syncHangup','prototype','isUndefined','emit','channels','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','isNotNull','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect'];(function(_0x461372,_0x3a346b){var _0x45a76b=function(_0x3ea45e){while(--_0x3ea45e){_0x461372['push'](_0x461372['shift']());}};_0x45a76b(++_0x3a346b);}(_0x47d1,0x120));var _0x147d=function(_0x31d523,_0x37858a){_0x31d523=_0x31d523-0x0;var _0x7fb160=_0x47d1[_0x31d523];return _0x7fb160;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x147d('0x0'));var logger=require(_0x147d('0x1'))(_0x147d('0x2'));var ami=require('../ami');var io=require('socket.io-emitter')({'host':_0x147d('0x3'),'port':0x18eb});function VoiceDialReport(_0x4cfbab){this['channels']=_0x4cfbab['outboundChannels'];this[_0x147d('0x4')]=_0x4cfbab[_0x147d('0x4')];this[_0x147d('0x5')]={};ami['on'](_0x147d('0x6'),this[_0x147d('0x7')][_0x147d('0x8')](this));ami['on']('dialend',this[_0x147d('0x9')][_0x147d('0x8')](this));ami['on'](_0x147d('0xa'),this[_0x147d('0xb')][_0x147d('0x8')](this));ami['on']('hangup',this[_0x147d('0xc')][_0x147d('0x8')](this));}VoiceDialReport[_0x147d('0xd')]['isNotNull']=function(_0x32b31f){return _0x32b31f!==null&&!_[_0x147d('0xe')](_0x32b31f);};VoiceDialReport[_0x147d('0xd')][_0x147d('0xf')]=function(_0x1ae8a9,_0x26e3b3,_0x4b3405){io['to'](_0x1ae8a9)['emit'](_0x26e3b3,_0x4b3405);};VoiceDialReport[_0x147d('0xd')][_0x147d('0x7')]=function(_0x22ab0e){try{if(this['isNotNull'](_0x22ab0e)){if(this[_0x147d('0x10')][_0x22ab0e[_0x147d('0x11')]]){_[_0x147d('0x12')](this[_0x147d('0x10')][_0x22ab0e[_0x147d('0x11')]],{'starttime':moment()[_0x147d('0x13')](_0x147d('0x14')),'lastevent':_0x147d('0x15'),'interface':_0x22ab0e[_0x147d('0x16')][_0x147d('0x17')](0x0,_0x22ab0e[_0x147d('0x16')][_0x147d('0x18')]('-')),'membername':_0x22ab0e[_0x147d('0x16')][_0x147d('0x17')](_0x22ab0e[_0x147d('0x16')][_0x147d('0x18')]('/')+0x1,_0x22ab0e[_0x147d('0x16')][_0x147d('0x18')]('-'))},_[_0x147d('0x19')](_0x22ab0e,[_0x147d('0x1a'),_0x147d('0x1b')]));this[_0x147d('0xf')](_0x147d('0x1c'),_0x147d('0x1d'),this[_0x147d('0x10')][_0x22ab0e[_0x147d('0x11')]]);ami['emit']('custom:dialbegin',this[_0x147d('0x10')][_0x22ab0e['uniqueid']]);}}}catch(_0x4156db){logger[_0x147d('0x1e')](_0x147d('0x1f'),util[_0x147d('0x20')](_0x4156db,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x147d('0xd')][_0x147d('0x9')]=function(_0x1bd5cb){try{if(this[_0x147d('0x21')](_0x1bd5cb)){if(this[_0x147d('0x10')][_0x1bd5cb['uniqueid']]){this['channels'][_0x1bd5cb[_0x147d('0x11')]][_0x147d('0x22')]=_0x1bd5cb[_0x147d('0x22')];if(_0x1bd5cb['dialstatus']===_0x147d('0x23')){this['channels'][_0x1bd5cb[_0x147d('0x11')]][_0x147d('0x24')]=_0x1bd5cb[_0x147d('0x24')];this[_0x147d('0x10')][_0x1bd5cb[_0x147d('0x11')]][_0x147d('0x25')]=_0x1bd5cb[_0x147d('0x25')];this[_0x147d('0x10')][_0x1bd5cb['uniqueid']][_0x147d('0x26')]=moment()[_0x147d('0x13')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x147d('0x10')][_0x1bd5cb[_0x147d('0x11')]]['lastevent']=_0x147d('0x27');ami['emit']('custom:dialconnect',this['channels'][_0x1bd5cb[_0x147d('0x11')]]);}this[_0x147d('0xf')](_0x147d('0x1c'),_0x147d('0x1d'),this['channels'][_0x1bd5cb[_0x147d('0x11')]]);}}}catch(_0x230fd1){logger[_0x147d('0x1e')](_0x147d('0x28'),util[_0x147d('0x20')](_0x230fd1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x147d('0xd')][_0x147d('0xb')]=function(_0x398330){try{if(this[_0x147d('0x21')](_0x398330)){this['addVariable'](_0x398330[_0x147d('0x11')],_['keys'](_0x398330['variable'])[0x0],_0x398330[_0x147d('0x29')]);if(this[_0x147d('0x21')](_0x398330[_0x147d('0x2a')])&&this[_0x147d('0x21')](_0x398330['variable'][_0x147d('0x2b')])){if(_[_0x147d('0xe')](this[_0x147d('0x10')][_0x398330[_0x147d('0x11')]])){this[_0x147d('0x10')][_0x398330[_0x147d('0x11')]]={'routeId':_0x398330['value'],'variables':this[_0x147d('0x5')][_0x398330['uniqueid']]};this[_0x147d('0xf')](_0x147d('0x1c'),_0x147d('0x1d'),this[_0x147d('0x10')][_0x398330[_0x147d('0x11')]]);}}}}catch(_0x144d42){logger[_0x147d('0x1e')]('[syncVarSet][VoiceDialReport]',util['inspect'](_0x144d42,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x147d('0xd')][_0x147d('0x2c')]=function(_0x244284,_0x318b6e,_0x534d49){var _0x5fb4c0=[_0x147d('0x2d'),_0x147d('0x2e'),_0x147d('0x2f'),_0x147d('0x30'),_0x147d('0x31'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x147d('0x32'),_0x147d('0x33'),'sipuri',_0x147d('0x34'),_0x147d('0x35'),_0x147d('0x36'),_0x147d('0x37'),_0x147d('0x38'),_0x147d('0x39'),_0x147d('0x3a'),_0x147d('0x3b'),_0x147d('0x3c')];if(!_[_0x147d('0x3d')](_0x318b6e)&&!_[_0x147d('0x3e')](_0x5fb4c0,_0x318b6e)){if(_[_0x147d('0xe')](this[_0x147d('0x5')][_0x244284])){this['variables'][_0x244284]={};}this[_0x147d('0x5')][_0x244284][_0x318b6e]=_0x534d49;}};VoiceDialReport[_0x147d('0xd')][_0x147d('0xc')]=function(_0x109b10){try{if(this['isNotNull'](_0x109b10)){if(this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]]){this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]][_0x147d('0x3f')]=moment()[_0x147d('0x13')](_0x147d('0x14'));this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]][_0x147d('0x40')]=moment(this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]][_0x147d('0x3f')])[_0x147d('0x41')](this[_0x147d('0x10')][_0x109b10['uniqueid']][_0x147d('0x42')],'seconds');this[_0x147d('0x10')][_0x109b10['uniqueid']][_0x147d('0x43')]=_0x147d('0x44');this[_0x147d('0x4')][_0x147d('0x45')]+=0x1;if(this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]][_0x147d('0x26')]){this[_0x147d('0x4')][_0x147d('0x46')]+=0x1;this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]][_0x147d('0x47')]=moment(this['channels'][_0x109b10['uniqueid']]['answertime'])[_0x147d('0x41')](this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]][_0x147d('0x42')],_0x147d('0x48'));this[_0x147d('0x10')][_0x109b10['uniqueid']][_0x147d('0x49')]=moment(this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]][_0x147d('0x3f')])[_0x147d('0x41')](this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]][_0x147d('0x26')],_0x147d('0x48'));this[_0x147d('0x4')][_0x147d('0x4a')]+=this[_0x147d('0x10')][_0x109b10['uniqueid']][_0x147d('0x47')]||0x0;this['outbound']['sumBillable']+=this['channels'][_0x109b10[_0x147d('0x11')]][_0x147d('0x49')];}this['outbound'][_0x147d('0x4b')]+=this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]]['duration'];ami[_0x147d('0xf')](_0x147d('0x4c'),this[_0x147d('0x10')][_0x109b10[_0x147d('0x11')]]);ami[_0x147d('0xf')](_0x147d('0x4d'),this[_0x147d('0x10')][_0x109b10['uniqueid']]);this['emit']('voice:outbound',_0x147d('0x4e'),this[_0x147d('0x4')]);this[_0x147d('0xf')]('voice:outbound',_0x147d('0x4f'),this[_0x147d('0x10')][_0x109b10['uniqueid']]);delete this['channels'][_0x109b10[_0x147d('0x11')]];}if(this['variables'][_0x109b10['uniqueid']]){delete this[_0x147d('0x5')][_0x109b10[_0x147d('0x11')]];}}}catch(_0x35394d){logger[_0x147d('0x1e')](_0x147d('0x50'),util[_0x147d('0x20')](_0x35394d,{'showHidden':![],'depth':null}));}};module[_0x147d('0x51')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 2ee64cb..5008969 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 _0x2139=['uniqueid','queuecallerjoinAt','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','last','queuecallerleaveAt','connectedlinenum','[syncQueueCallerLeave][VoiceQueueReport]','assigned','membername','','startsWith','interface','toLowerCase','sip/','transfer','queuecallerexit','add','seconds','queuecallerexitreason','FORWARDTRANSFER','transfertype','transferexten','destexten','connectedlinename','fullname','destcalleridnum','destcalleridname','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','reason','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','queuestatus','CONTINUE','queueposition','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','syncHangup','length','diff','milliseconds','answered','lastevent','abandoned','custom:queuecallerunmanaged','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[syncAttendedTransfer][VoiceQueueReport]','BLIND','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','[syncMusicOnHoldStop][VoiceQueueReport]','exports','moment','bluebird','util','md5','../../../config/logger','ami','../ami','../model/queueReport','socket.io-emitter','localhost','prototype','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','varset','syncVarSet','hangup','fullybooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','channels','status','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','emitVoiceQueueChannelRemove','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','available','sumDuration','sumHoldTime','total','unmanaged','waiting','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','isUndefined','queues','Action','then','[queuesummary]','queue','callers','toNumber','loggedIn','loggedin','[syncQueueSummary][VoiceQueueReport]','syncQueueSummaryComplete','syncNewExten'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x2139,0x115));var _0x9213=function(_0x173f85,_0x412d00){_0x173f85=_0x173f85-0x0;var _0x30d116=_0x2139[_0x173f85];return _0x30d116;};'use strict';var _=require('lodash');var moment=require(_0x9213('0x0'));var BPromise=require(_0x9213('0x1'));var util=require(_0x9213('0x2'));var md5=require(_0x9213('0x3'));var logger=require(_0x9213('0x4'))(_0x9213('0x5'));var ami=require(_0x9213('0x6'));var QueueReport=require(_0x9213('0x7'));var io=require(_0x9213('0x8'))({'host':_0x9213('0x9'),'port':0x18eb});var Sequence=function(){};Sequence[_0x9213('0xa')][_0x9213('0xb')]=function(_0x393044){this[_0x9213('0xc')]=this[_0x9213('0xc')]?this['tail'][_0x9213('0xd')](_0x393044):_0x393044();};function VoiceQueueReport(_0x3a249e){this[_0x9213('0xe')]=new Sequence();this[_0x9213('0xf')]={};this[_0x9213('0x10')]=_0x3a249e['agents'];this['channels']=_0x3a249e[_0x9213('0x11')];this[_0x9213('0x12')]=_0x3a249e[_0x9213('0x12')];this[_0x9213('0x13')]=!![];this[_0x9213('0x14')]=_0x3a249e[_0x9213('0x14')];this[_0x9213('0x15')]={};ami['on'](_0x9213('0x16'),this[_0x9213('0x17')][_0x9213('0x18')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0x9213('0x18')](this));ami['on'](_0x9213('0x19'),this[_0x9213('0x1a')][_0x9213('0x18')](this));ami['on'](_0x9213('0x1b'),this['syncQueueCallerAbandon'][_0x9213('0x18')](this));ami['on'](_0x9213('0x1c'),this[_0x9213('0x1d')][_0x9213('0x18')](this));ami['on'](_0x9213('0x1e'),this['syncAgentComplete']['bind'](this));ami['on'](_0x9213('0x1f'),this[_0x9213('0x20')]['bind'](this));ami['on'](_0x9213('0x21'),this['syncHangup']['bind'](this));ami['on'](_0x9213('0x22'),this['syncFullyBooted'][_0x9213('0x18')](this));ami['on']('musiconholdstart',this[_0x9213('0x23')]['bind'](this));ami['on'](_0x9213('0x24'),this[_0x9213('0x25')][_0x9213('0x18')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x9213('0x18')](this));ami['on'](_0x9213('0x26'),this[_0x9213('0x27')]['bind'](this));this[_0x9213('0x28')]();this[_0x9213('0x29')]();}function isNotNull(_0x342b55){return _0x342b55!==null&&!_['isUndefined'](_0x342b55);}function clearChannels(_0x5856f7){if(!_[_0x9213('0x2a')](_0x5856f7)){for(var _0x265b84 in _0x5856f7){if(_0x5856f7[_0x9213('0x2b')](_0x265b84)){delete _0x5856f7[_0x265b84];}}}}function clearCampaigns(_0x5f424e){if(!_[_0x9213('0x2a')](_0x5f424e)){for(var _0x55c2ed in _0x5f424e){if(_0x5f424e[_0x9213('0x2b')](_0x55c2ed)){_0x5f424e[_0x55c2ed][_0x9213('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x40cc07){if(!_[_0x9213('0x2a')](_0x40cc07)){for(var _0x30a20b in _0x40cc07){if(_0x40cc07['hasOwnProperty'](_0x30a20b)){_0x40cc07[_0x30a20b][_0x9213('0x2c')]=0x0;_0x40cc07[_0x30a20b][_0x9213('0x2d')]=0x0;_0x40cc07[_0x30a20b][_0x9213('0x2e')]=0x0;_0x40cc07[_0x30a20b]['waiting']=0x0;_0x40cc07[_0x30a20b][_0x9213('0x2f')]=!![];}}}}function clearAgentBooked(_0x5f1eed){if(!_[_0x9213('0x2a')](_0x5f1eed)){for(var _0xbcc437 in _0x5f1eed){if(_0x5f1eed[_0x9213('0x2b')](_0xbcc437)){_0x5f1eed[_0xbcc437][_0x9213('0x30')]=!![];}}}}VoiceQueueReport[_0x9213('0xa')][_0x9213('0x31')]=function(){var _0x3d871d=this;for(var _0x427dec in this[_0x9213('0x32')]){if(this[_0x9213('0x32')][_0x9213('0x2b')](_0x427dec)){this[_0x9213('0xe')][_0x9213('0xb')](function(){if(!_['isNil'](_0x3d871d[_0x9213('0x32')][_0x427dec])){return ami['Action']({'action':_0x9213('0x33'),'channel':_0x3d871d[_0x9213('0x32')][_0x427dec][_0x9213('0x34')]})[_0x9213('0x35')](function(_0x2e982f){if(_0x2e982f[_0x9213('0x36')]===_0x9213('0x37')){setTimeout(function(){if(_0x3d871d[_0x9213('0x32')][_0x427dec]){delete _0x3d871d['channels'][_0x427dec];logger[_0x9213('0x38')]('[voiceQueueReport][checkChannel]',_0x427dec);}if(_0x3d871d[_0x9213('0xf')][_0x427dec]){delete _0x3d871d['queueReports'][_0x427dec];logger[_0x9213('0x38')]('[voiceQueueReport][checkQueueReport]',_0x427dec);}if(_0x3d871d[_0x9213('0x15')][_0x427dec]){delete _0x3d871d[_0x9213('0x15')][_0x427dec];logger['error'](_0x9213('0x39'),_0x427dec);}},0x1f40);}});}});}}};VoiceQueueReport[_0x9213('0xa')]['syncFullyBooted']=function(){logger[_0x9213('0x38')](_0x9213('0x3a'));clearChannels(this['channels']);this[_0x9213('0x3b')](this[_0x9213('0xf')]);clearAgentBooked(this[_0x9213('0x10')]);clearVoiceQueues(this[_0x9213('0x12')]);clearCampaigns(this[_0x9213('0x14')]);};VoiceQueueReport['prototype'][_0x9213('0x3b')]=function(_0x175dae){var _0x34f190=this;if(!_[_0x9213('0x2a')](_0x175dae)){for(var _0x54a7f0 in _0x175dae){if(_0x175dae['hasOwnProperty'](_0x54a7f0)){_0x34f190['emitVoiceQueueChannelRemove'](_0x175dae[_0x54a7f0]);delete _0x175dae[_0x54a7f0];}}}};function loggerCatch(_0x2924cd){return function(_0xa6c928){logger[_0x9213('0x38')](_0x2924cd,util[_0x9213('0x3c')](_0xa6c928,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x9213('0xa')][_0x9213('0x3d')]=function(_0x1cefa4,_0x598b17,_0x474900){io['to'](_0x1cefa4)['emit'](_0x598b17,_0x474900);};VoiceQueueReport[_0x9213('0xa')][_0x9213('0x3e')]=function(_0x221daf){this[_0x9213('0x3d')](util[_0x9213('0x3f')](_0x9213('0x40'),_0x221daf[_0x9213('0x41')]),'voice_queue_channel:save',_0x221daf);};VoiceQueueReport['prototype'][_0x9213('0x42')]=function(_0x2f3c86){this[_0x9213('0x3d')](util['format'](_0x9213('0x40'),_0x2f3c86[_0x9213('0x41')]),_0x9213('0x43'),_0x2f3c86);};VoiceQueueReport[_0x9213('0xa')][_0x9213('0x44')]=function(_0x445356){if(_0x445356[_0x9213('0x45')]===_0x9213('0x46')){var _0x3cf52d={'id':_0x445356['id'],'name':_0x445356[_0x9213('0x41')],'strategy':_0x445356[_0x9213('0x47')],'answered':_0x445356['answered'],'available':_0x445356[_0x9213('0x48')],'loggedIn':_0x445356['loggedIn'],'pTalking':_0x445356[_0x9213('0x2e')],'sumBillable':_0x445356['sumBillable'],'sumDuration':_0x445356[_0x9213('0x49')],'sumHoldTime':_0x445356[_0x9213('0x4a')]||0x0,'talking':_0x445356[_0x9213('0x2d')],'total':_0x445356[_0x9213('0x4b')],'type':_0x445356[_0x9213('0x45')],'unmanaged':_0x445356[_0x9213('0x4c')],'waiting':_0x445356[_0x9213('0x4d')]};if(_0x445356[_0x9213('0x4e')]){_0x3cf52d[_0x9213('0x4e')]={'id':_0x445356[_0x9213('0x4e')]['id'],'name':_0x445356['Trunk']['name'],'active':_0x445356[_0x9213('0x4e')][_0x9213('0x4f')],'callerid':_0x445356[_0x9213('0x4e')][_0x9213('0x50')]};}if(_0x445356[_0x9213('0x51')]){_0x3cf52d['Interval']={'id':_0x445356['Interval']['id'],'name':_0x445356[_0x9213('0x51')][_0x9213('0x41')]};}var _0x275823=md5(JSON['stringify'](_0x3cf52d));if(_0x445356['md5']!==_0x275823){_0x445356[_0x9213('0x3')]=_0x275823;this[_0x9213('0x3d')](util[_0x9213('0x3f')](_0x9213('0x40'),_0x3cf52d[_0x9213('0x41')]),_0x9213('0x52'),_0x3cf52d);}}};VoiceQueueReport[_0x9213('0xa')][_0x9213('0x53')]=function(_0x280ced){return _0x280ced!==null&&!_[_0x9213('0x54')](_0x280ced);};VoiceQueueReport['prototype'][_0x9213('0x29')]=function(){var _0x1285f1=this;setInterval(function(){_0x1285f1[_0x9213('0x31')]();ami['Action']({'action':_0x9213('0x55')})[_0x9213('0x35')](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport[_0x9213('0xa')]['loopQueueSummary']=function(){var _0x272acd=this;setInterval(function(){if(_0x272acd[_0x9213('0x13')]){return ami[_0x9213('0x56')]({'action':_0x9213('0x16')})[_0x9213('0x57')](function(_0x4597e0){_0x272acd[_0x9213('0x13')]=![];})[_0x9213('0x35')](loggerCatch(_0x9213('0x58')));}},0x3e8);};VoiceQueueReport[_0x9213('0xa')]['syncQueueSummary']=function(_0x586ee4){try{if(this[_0x9213('0x53')](_0x586ee4)&&this['isNotNull'](_0x586ee4[_0x9213('0x59')])){if(this[_0x9213('0x12')][_0x586ee4[_0x9213('0x59')]]){var _0x110d57=_['countBy'](this[_0x9213('0x32')],_0x9213('0x59'))[_0x586ee4[_0x9213('0x59')]]||0x0;var _0x5d6e6e=_0x110d57-_0x586ee4[_0x9213('0x5a')];if(this['voiceQueues'][_0x586ee4[_0x9213('0x59')]][_0x9213('0x4d')]!==_[_0x9213('0x5b')](_0x586ee4[_0x9213('0x5a')])||this[_0x9213('0x12')][_0x586ee4[_0x9213('0x59')]][_0x9213('0x5c')]!==_['toNumber'](_0x586ee4[_0x9213('0x5d')])||this[_0x9213('0x12')][_0x586ee4[_0x9213('0x59')]]['available']!==_[_0x9213('0x5b')](_0x586ee4[_0x9213('0x48')])||this[_0x9213('0x12')][_0x586ee4[_0x9213('0x59')]][_0x9213('0x2d')]!==_0x5d6e6e){this[_0x9213('0x12')][_0x586ee4[_0x9213('0x59')]][_0x9213('0x4d')]=_[_0x9213('0x5b')](_0x586ee4[_0x9213('0x5a')]);this[_0x9213('0x12')][_0x586ee4[_0x9213('0x59')]][_0x9213('0x5c')]=_[_0x9213('0x5b')](_0x586ee4[_0x9213('0x5d')]);this['voiceQueues'][_0x586ee4[_0x9213('0x59')]]['available']=_[_0x9213('0x5b')](_0x586ee4[_0x9213('0x48')]);this[_0x9213('0x12')][_0x586ee4['queue']]['talking']=_0x5d6e6e>0x0?_0x5d6e6e:0x0;this['voiceQueues'][_0x586ee4[_0x9213('0x59')]][_0x9213('0x2d')]=this[_0x9213('0x12')][_0x586ee4['queue']][_0x9213('0x2d')]>_['toNumber'](_0x586ee4['loggedin'])?_[_0x9213('0x5b')](_0x586ee4[_0x9213('0x5d')]):this['voiceQueues'][_0x586ee4[_0x9213('0x59')]][_0x9213('0x2d')];this[_0x9213('0x44')](this[_0x9213('0x12')][_0x586ee4[_0x9213('0x59')]]);}ami['emit']('custom:queuesummary',this[_0x9213('0x12')][_0x586ee4[_0x9213('0x59')]]);}}}catch(_0xfe9e6b){logger[_0x9213('0x38')](_0x9213('0x5e'),util[_0x9213('0x3c')](_0xfe9e6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9213('0x5f')]=function(_0x3a435b){this[_0x9213('0x13')]=!![];};VoiceQueueReport[_0x9213('0xa')][_0x9213('0x60')]=function(_0x608d76){};VoiceQueueReport['prototype'][_0x9213('0x1a')]=function(_0x7426b1){try{if(this['isNotNull'](_0x7426b1)){if(_[_0x9213('0x54')](this[_0x9213('0xf')][_0x7426b1[_0x9213('0x61')]])){this[_0x9213('0xf')][_0x7426b1[_0x9213('0x61')]]=[];this[_0x9213('0x32')][_0x7426b1[_0x9213('0x61')]]={};}var _0x133922=new QueueReport();_0x133922[_0x9213('0x41')]=_0x7426b1['queue'];_0x133922[_0x9213('0x45')]=this[_0x9213('0x12')][_0x133922[_0x9213('0x41')]]&&this[_0x9213('0x12')][_0x133922[_0x9213('0x41')]][_0x9213('0x45')]?this[_0x9213('0x12')][_0x133922['name']][_0x9213('0x45')]||'inbound':'inbound';_0x133922[_0x9213('0x59')]=_0x7426b1[_0x9213('0x59')];_0x133922[_0x9213('0x62')]=moment()[_0x9213('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');_0x133922[_0x9213('0x63')]=_0x7426b1[_0x9213('0x63')];_0x133922[_0x9213('0x64')]=_0x7426b1[_0x9213('0x64')];_[_0x9213('0x65')](_0x133922,_[_0x9213('0x66')](_0x7426b1,_[_0x9213('0x67')](_0x133922)));this[_0x9213('0xf')][_0x7426b1['uniqueid']][_0x9213('0x68')](_0x133922);this[_0x9213('0x32')][_0x7426b1[_0x9213('0x61')]]=_0x133922;this[_0x9213('0x3e')](_0x133922);}}catch(_0x383fc4){logger[_0x9213('0x38')](_0x9213('0x69'),util['inspect'](_0x383fc4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9213('0xa')][_0x9213('0x6a')]=function(_0x2cf2d0){try{if(this[_0x9213('0x53')](_0x2cf2d0)){if(this[_0x9213('0xf')][_0x2cf2d0['uniqueid']]){var _0x5a9792=_['last'](this['queueReports'][_0x2cf2d0[_0x9213('0x61')]]);_0x5a9792[_0x9213('0x6b')]=_0x2cf2d0[_0x9213('0x6b')];_0x5a9792['originalposition']=_0x2cf2d0[_0x9213('0x6c')];_0x5a9792[_0x9213('0x1b')]=!![];_0x5a9792[_0x9213('0x6d')]=moment()['format'](_0x9213('0x6e'));_0x5a9792['queuecallerexitreason']=_0x9213('0x6f');_0x5a9792[_0x9213('0x70')]=null;this[_0x9213('0x32')][_0x2cf2d0[_0x9213('0x61')]]=_0x5a9792;this['emitVoiceQueueChannelRemove'](_0x5a9792);}}}catch(_0x2c874e){logger[_0x9213('0x38')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0x9213('0x3c')](_0x2c874e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9213('0xa')]['syncQueueCallerLeave']=function(_0x3b0cdb){try{if(this[_0x9213('0x53')](_0x3b0cdb)){if(this[_0x9213('0xf')][_0x3b0cdb[_0x9213('0x61')]]){var _0x4601ce=_[_0x9213('0x71')](this['queueReports'][_0x3b0cdb[_0x9213('0x61')]]);_0x4601ce[_0x9213('0x72')]=moment()[_0x9213('0x3f')](_0x9213('0x6e'));_0x4601ce['connectedlinenum']=_0x3b0cdb[_0x9213('0x73')];_0x4601ce['connectedlinename']=_0x3b0cdb['connectedlinename'];this[_0x9213('0x32')][_0x3b0cdb[_0x9213('0x61')]]=_0x4601ce;this[_0x9213('0x3e')](_0x4601ce);}}}catch(_0x3ad067){logger[_0x9213('0x38')](_0x9213('0x74'),util['inspect'](_0x3ad067,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x5c8e59){try{if(this[_0x9213('0x53')](_0x5c8e59)){if(this[_0x9213('0xf')][_0x5c8e59[_0x9213('0x61')]]){var _0x3662dc=_[_0x9213('0x71')](this[_0x9213('0xf')][_0x5c8e59['uniqueid']]);_0x3662dc[_0x9213('0x1b')]=![];_0x3662dc[_0x9213('0x6d')]=null;_0x3662dc[_0x9213('0x75')]=!![];_0x3662dc['lastAssignedTo']=_0x5c8e59[_0x9213('0x76')];_0x3662dc['holdtime']=_0x5c8e59[_0x9213('0x6b')];if(_0x5c8e59[_0x9213('0x73')]===_0x9213('0x77')&&_[_0x9213('0x78')](_0x5c8e59[_0x9213('0x79')][_0x9213('0x7a')](),_0x9213('0x7b'))){if(!_0x3662dc[_0x9213('0x7c')]){_0x3662dc[_0x9213('0x7d')]=!![];_0x3662dc['queuecallerexitAt']=moment(_0x3662dc[_0x9213('0x62')])[_0x9213('0x7e')](_0x5c8e59[_0x9213('0x6b')],_0x9213('0x7f'))[_0x9213('0x3f')](_0x9213('0x6e'));_0x3662dc[_0x9213('0x80')]=_0x9213('0x81');_0x3662dc[_0x9213('0x7c')]=!![];_0x3662dc[_0x9213('0x82')]='FORWARD';_0x3662dc[_0x9213('0x83')]=_0x5c8e59[_0x9213('0x84')];_0x3662dc['transferuniqueid']=_0x5c8e59['uniqueid'];}if(this[_0x9213('0x10')][_0x5c8e59['interface']]){_0x3662dc[_0x9213('0x73')]=this['agents'][_0x5c8e59[_0x9213('0x79')]]['accountcode'];_0x3662dc[_0x9213('0x85')]=this[_0x9213('0x10')][_0x5c8e59[_0x9213('0x79')]][_0x9213('0x86')];_0x3662dc[_0x9213('0x87')]=this[_0x9213('0x10')][_0x5c8e59[_0x9213('0x79')]]['accountcode'];_0x3662dc[_0x9213('0x88')]=this[_0x9213('0x10')][_0x5c8e59[_0x9213('0x79')]][_0x9213('0x86')];}}else{_0x3662dc[_0x9213('0x89')]=!![];_0x3662dc[_0x9213('0x8a')]=moment()[_0x9213('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3662dc[_0x9213('0x7d')]=![];_0x3662dc[_0x9213('0x8b')]=null;if(_0x5c8e59[_0x9213('0x8c')]!==_0x9213('0x7c')){_0x3662dc[_0x9213('0x80')]='COMPLETEDBY'+_0x5c8e59[_0x9213('0x8c')][_0x9213('0x8d')]();}}this['channels'][_0x5c8e59[_0x9213('0x61')]]=_0x3662dc;this[_0x9213('0x42')](_0x3662dc);}}}catch(_0x2bbf66){logger[_0x9213('0x38')](_0x9213('0x8e'),util[_0x9213('0x3c')](_0x2bbf66,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9213('0xa')]['syncVarSet']=function(_0x1770ab){try{if(this['isNotNull'](_0x1770ab)){this[_0x9213('0x8f')](_0x1770ab[_0x9213('0x61')],_[_0x9213('0x67')](_0x1770ab[_0x9213('0x90')])[0x0],_0x1770ab[_0x9213('0x91')]);if(this[_0x9213('0xf')][_0x1770ab['uniqueid']]){var _0x47eec8=_[_0x9213('0x71')](this[_0x9213('0xf')][_0x1770ab[_0x9213('0x61')]]);if(_0x47eec8){if(this[_0x9213('0x53')](_0x1770ab[_0x9213('0x90')])&&this[_0x9213('0x53')](_0x1770ab['variable'][_0x9213('0x92')])){switch(_0x1770ab[_0x9213('0x91')]){case _0x9213('0x93'):_0x47eec8['queuecallerexit']=![];_0x47eec8[_0x9213('0x8b')]=null;break;default:_0x47eec8['queuecallerexit']=!![];_0x47eec8[_0x9213('0x8b')]=moment()[_0x9213('0x3f')](_0x9213('0x6e'));_0x47eec8[_0x9213('0x72')]=moment()[_0x9213('0x3f')](_0x9213('0x6e'));}_0x47eec8['queuecallerabandon']=![];_0x47eec8['queuecallerabandonAt']=null;_0x47eec8[_0x9213('0x80')]=_0x1770ab[_0x9213('0x91')];this[_0x9213('0x32')][_0x1770ab[_0x9213('0x61')]]=_0x47eec8;this['emitVoiceQueueChannelRemove'](_0x47eec8);}else if(this[_0x9213('0x53')](_0x1770ab[_0x9213('0x90')])&&this['isNotNull'](_0x1770ab[_0x9213('0x90')][_0x9213('0x94')])){if(!_0x47eec8['queuecallerabandon']){_0x47eec8['queuecallerexit']=!![];_0x47eec8['queuecallerexitAt']=moment()[_0x9213('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');_0x47eec8[_0x9213('0x80')]=_0x9213('0x95');_0x47eec8[_0x9213('0x72')]=moment()[_0x9213('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9213('0x32')][_0x1770ab[_0x9213('0x61')]]=_0x47eec8;}}_0x47eec8['variables']=this[_0x9213('0x15')][_0x1770ab['uniqueid']];}}}}catch(_0x430a8a){logger[_0x9213('0x38')]('[syncVarSet][VoiceQueueReport]',util[_0x9213('0x3c')](_0x430a8a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9213('0xa')][_0x9213('0x8f')]=function(_0x1d1a23,_0x288625,_0x825ff6){var _0x45a8a5=[_0x9213('0x96'),_0x9213('0x97'),_0x9213('0x98'),_0x9213('0x99'),_0x9213('0x9a'),_0x9213('0x9b'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x9213('0x9c'),_0x9213('0x9d'),_0x9213('0x9e'),'bridgepvtcallid','membercalls',_0x9213('0x9f'),_0x9213('0xa0'),_0x9213('0xa1'),_0x9213('0x76'),_0x9213('0xa2'),'memberrealtime'];if(!_[_0x9213('0xa3')](_0x288625)&&!_['includes'](_0x45a8a5,_0x288625)){if(_[_0x9213('0x54')](this[_0x9213('0x15')][_0x1d1a23])){this[_0x9213('0x15')][_0x1d1a23]={};}this[_0x9213('0x15')][_0x1d1a23][_0x288625]=_0x825ff6;}};VoiceQueueReport[_0x9213('0xa')][_0x9213('0xa4')]=function(_0x4e5517){try{if(this[_0x9213('0x53')](_0x4e5517)){if(this[_0x9213('0xf')][_0x4e5517['uniqueid']]){for(var _0x362b27=0x0,_0x5eda20={};_0x362b27','toLowerCase','queuecallerexitAt','add','seconds','transfer','transfertype','transferexten','destexten','transferuniqueid','interface','accountcode','fullname','destcalleridname','queuecallercomplete','queuecallercompleteAt','queuecallerexit','reason','addVariable','variable','value','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberrealtime','isNil','includes','syncHangup','length','sumHoldTime','diff','total','abandoned','lastevent','custom:queuecallerunmanaged','custom:voiceQueueReport','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','[syncAttendedTransfer][VoiceQueueReport]','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime','milliseconds','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','util','../../../config/logger','ami','../ami','../model/queueReport','localhost','enqueue','tail','finally','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','waiting','unlockRR','prototype','clearZombieChannels','sequence','Action','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','format'];(function(_0x10e33b,_0x283377){var _0x30ff88=function(_0xf1a0eb){while(--_0xf1a0eb){_0x10e33b['push'](_0x10e33b['shift']());}};_0x30ff88(++_0x283377);}(_0xfa89,0x1e3));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9fa8('0x0'));var moment=require(_0x9fa8('0x1'));var BPromise=require('bluebird');var util=require(_0x9fa8('0x2'));var md5=require('md5');var logger=require(_0x9fa8('0x3'))(_0x9fa8('0x4'));var ami=require(_0x9fa8('0x5'));var QueueReport=require(_0x9fa8('0x6'));var io=require('socket.io-emitter')({'host':_0x9fa8('0x7'),'port':0x18eb});var Sequence=function(){};Sequence['prototype'][_0x9fa8('0x8')]=function(_0x3a3187){this[_0x9fa8('0x9')]=this[_0x9fa8('0x9')]?this[_0x9fa8('0x9')][_0x9fa8('0xa')](_0x3a3187):_0x3a3187();};function VoiceQueueReport(_0x3f9f01){this['sequence']=new Sequence();this['queueReports']={};this[_0x9fa8('0xb')]=_0x3f9f01[_0x9fa8('0xb')];this[_0x9fa8('0xc')]=_0x3f9f01[_0x9fa8('0xd')];this['voiceQueues']=_0x3f9f01[_0x9fa8('0xe')];this[_0x9fa8('0xf')]=!![];this[_0x9fa8('0x10')]=_0x3f9f01[_0x9fa8('0x10')];this[_0x9fa8('0x11')]={};ami['on'](_0x9fa8('0x12'),this[_0x9fa8('0x13')][_0x9fa8('0x14')](this));ami['on'](_0x9fa8('0x15'),this[_0x9fa8('0x16')][_0x9fa8('0x14')](this));ami['on'](_0x9fa8('0x17'),this[_0x9fa8('0x18')][_0x9fa8('0x14')](this));ami['on']('queuecallerabandon',this[_0x9fa8('0x19')][_0x9fa8('0x14')](this));ami['on'](_0x9fa8('0x1a'),this[_0x9fa8('0x1b')]['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x9fa8('0x14')](this));ami['on'](_0x9fa8('0x1c'),this[_0x9fa8('0x1d')][_0x9fa8('0x14')](this));ami['on'](_0x9fa8('0x1e'),this['syncHangup']['bind'](this));ami['on'](_0x9fa8('0x1f'),this[_0x9fa8('0x20')][_0x9fa8('0x14')](this));ami['on'](_0x9fa8('0x21'),this[_0x9fa8('0x22')][_0x9fa8('0x14')](this));ami['on']('musiconholdstop',this[_0x9fa8('0x23')]['bind'](this));ami['on']('attendedtransfer',this[_0x9fa8('0x24')][_0x9fa8('0x14')](this));ami['on'](_0x9fa8('0x25'),this['syncBlindTransfer'][_0x9fa8('0x14')](this));this[_0x9fa8('0x26')]();this['loopQueueShow']();}function isNotNull(_0x5d8cde){return _0x5d8cde!==null&&!_['isUndefined'](_0x5d8cde);}function clearChannels(_0x4a7a78){if(!_[_0x9fa8('0x27')](_0x4a7a78)){for(var _0x5b6439 in _0x4a7a78){if(_0x4a7a78['hasOwnProperty'](_0x5b6439)){delete _0x4a7a78[_0x5b6439];}}}}function clearCampaigns(_0x234420){if(!_[_0x9fa8('0x27')](_0x234420)){for(var _0x310c18 in _0x234420){if(_0x234420[_0x9fa8('0x28')](_0x310c18)){_0x234420[_0x310c18]['originated']=0x0;}}}}function clearVoiceQueues(_0x14ef51){if(!_['isEmpty'](_0x14ef51)){for(var _0x19e44f in _0x14ef51){if(_0x14ef51[_0x9fa8('0x28')](_0x19e44f)){_0x14ef51[_0x19e44f][_0x9fa8('0x29')]=0x0;_0x14ef51[_0x19e44f][_0x9fa8('0x2a')]=0x0;_0x14ef51[_0x19e44f]['pTalking']=0x0;_0x14ef51[_0x19e44f][_0x9fa8('0x2b')]=0x0;_0x14ef51[_0x19e44f]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x44bc13){if(!_['isEmpty'](_0x44bc13)){for(var _0x2bedd7 in _0x44bc13){if(_0x44bc13['hasOwnProperty'](_0x2bedd7)){_0x44bc13[_0x2bedd7][_0x9fa8('0x2c')]=!![];}}}}VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x2e')]=function(){var _0x1a0ab9=this;for(var _0x3ba7a4 in this[_0x9fa8('0xc')]){if(this['channels'][_0x9fa8('0x28')](_0x3ba7a4)){this[_0x9fa8('0x2f')]['enqueue'](function(){if(!_['isNil'](_0x1a0ab9[_0x9fa8('0xc')][_0x3ba7a4])){return ami[_0x9fa8('0x30')]({'action':'status','channel':_0x1a0ab9[_0x9fa8('0xc')][_0x3ba7a4][_0x9fa8('0x31')]})[_0x9fa8('0x32')](function(_0x15b5f4){if(_0x15b5f4[_0x9fa8('0x33')]===_0x9fa8('0x34')){setTimeout(function(){if(_0x1a0ab9[_0x9fa8('0xc')][_0x3ba7a4]){delete _0x1a0ab9[_0x9fa8('0xc')][_0x3ba7a4];logger[_0x9fa8('0x35')](_0x9fa8('0x36'),_0x3ba7a4);}if(_0x1a0ab9[_0x9fa8('0x37')][_0x3ba7a4]){delete _0x1a0ab9[_0x9fa8('0x37')][_0x3ba7a4];logger['error'](_0x9fa8('0x38'),_0x3ba7a4);}if(_0x1a0ab9[_0x9fa8('0x11')][_0x3ba7a4]){delete _0x1a0ab9[_0x9fa8('0x11')][_0x3ba7a4];logger[_0x9fa8('0x35')]('[voiceQueueReport][checkVariables]',_0x3ba7a4);}},0x1f40);}});}});}}};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x20')]=function(){logger[_0x9fa8('0x35')](_0x9fa8('0x39'));clearChannels(this[_0x9fa8('0xc')]);this[_0x9fa8('0x3a')](this[_0x9fa8('0x37')]);clearAgentBooked(this[_0x9fa8('0xb')]);clearVoiceQueues(this[_0x9fa8('0xe')]);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype'][_0x9fa8('0x3a')]=function(_0x28b896){var _0x29ddd1=this;if(!_[_0x9fa8('0x27')](_0x28b896)){for(var _0x17dc65 in _0x28b896){if(_0x28b896[_0x9fa8('0x28')](_0x17dc65)){_0x29ddd1[_0x9fa8('0x3b')](_0x28b896[_0x17dc65]);delete _0x28b896[_0x17dc65];}}}};function loggerCatch(_0x152fa9){return function(_0x5a4192){logger[_0x9fa8('0x35')](_0x152fa9,util[_0x9fa8('0x3c')](_0x5a4192,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x9fa8('0x2d')]['emit']=function(_0x756b62,_0x55c76e,_0x5bf4de){io['to'](_0x756b62)[_0x9fa8('0x3d')](_0x55c76e,_0x5bf4de);};VoiceQueueReport[_0x9fa8('0x2d')]['emitVoiceQueueChannelSave']=function(_0x487a96){this[_0x9fa8('0x3d')](util[_0x9fa8('0x3e')](_0x9fa8('0x3f'),_0x487a96['name']),_0x9fa8('0x40'),_0x487a96);};VoiceQueueReport[_0x9fa8('0x2d')]['emitVoiceQueueChannelRemove']=function(_0x509986){this[_0x9fa8('0x3d')](util['format']('voice:queue:%s',_0x509986[_0x9fa8('0x41')]),_0x9fa8('0x42'),_0x509986);};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x43')]=function(_0x4a550f){if(_0x4a550f[_0x9fa8('0x44')]===_0x9fa8('0x45')){var _0x3d32fe={'id':_0x4a550f['id'],'name':_0x4a550f[_0x9fa8('0x41')],'strategy':_0x4a550f[_0x9fa8('0x46')],'answered':_0x4a550f[_0x9fa8('0x47')],'available':_0x4a550f[_0x9fa8('0x48')],'loggedIn':_0x4a550f['loggedIn'],'pTalking':_0x4a550f['pTalking'],'sumBillable':_0x4a550f['sumBillable'],'sumDuration':_0x4a550f[_0x9fa8('0x49')],'sumHoldTime':_0x4a550f['sumHoldTime']||0x0,'talking':_0x4a550f[_0x9fa8('0x2a')],'total':_0x4a550f['total'],'type':_0x4a550f[_0x9fa8('0x44')],'unmanaged':_0x4a550f[_0x9fa8('0x4a')],'waiting':_0x4a550f['waiting']};if(_0x4a550f[_0x9fa8('0x4b')]){_0x3d32fe[_0x9fa8('0x4b')]={'id':_0x4a550f[_0x9fa8('0x4b')]['id'],'name':_0x4a550f[_0x9fa8('0x4b')][_0x9fa8('0x41')],'active':_0x4a550f[_0x9fa8('0x4b')][_0x9fa8('0x4c')],'callerid':_0x4a550f[_0x9fa8('0x4b')][_0x9fa8('0x4d')]};}if(_0x4a550f[_0x9fa8('0x4e')]){_0x3d32fe[_0x9fa8('0x4e')]={'id':_0x4a550f[_0x9fa8('0x4e')]['id'],'name':_0x4a550f[_0x9fa8('0x4e')][_0x9fa8('0x41')]};}var _0x39e43f=md5(JSON[_0x9fa8('0x4f')](_0x3d32fe));if(_0x4a550f[_0x9fa8('0x50')]!==_0x39e43f){_0x4a550f[_0x9fa8('0x50')]=_0x39e43f;this['emit'](util['format'](_0x9fa8('0x3f'),_0x3d32fe[_0x9fa8('0x41')]),_0x9fa8('0x51'),_0x3d32fe);}}};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x52')]=function(_0x5e5f00){return _0x5e5f00!==null&&!_[_0x9fa8('0x53')](_0x5e5f00);};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x54')]=function(){var _0x2ff064=this;setInterval(function(){_0x2ff064[_0x9fa8('0x2e')]();ami['Action']({'action':_0x9fa8('0x55')})[_0x9fa8('0x32')](loggerCatch(_0x9fa8('0x56')));},0x2710);};VoiceQueueReport['prototype'][_0x9fa8('0x26')]=function(){var _0x870c80=this;setInterval(function(){if(_0x870c80[_0x9fa8('0xf')]){return ami['Action']({'action':_0x9fa8('0x12')})[_0x9fa8('0x57')](function(_0x2cdba4){_0x870c80['flagQueueSummary']=![];})[_0x9fa8('0x32')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0x9fa8('0x2d')]['syncQueueSummary']=function(_0x3d769){try{if(this['isNotNull'](_0x3d769)&&this['isNotNull'](_0x3d769['queue'])){if(this[_0x9fa8('0xe')][_0x3d769[_0x9fa8('0x58')]]){var _0x13a28b=_[_0x9fa8('0x59')](this[_0x9fa8('0xc')],_0x9fa8('0x58'))[_0x3d769[_0x9fa8('0x58')]]||0x0;var _0x15fcb5=_0x13a28b-_0x3d769['callers'];if(this[_0x9fa8('0xe')][_0x3d769[_0x9fa8('0x58')]][_0x9fa8('0x2b')]!==_[_0x9fa8('0x5a')](_0x3d769[_0x9fa8('0x5b')])||this[_0x9fa8('0xe')][_0x3d769['queue']][_0x9fa8('0x5c')]!==_[_0x9fa8('0x5a')](_0x3d769['loggedin'])||this[_0x9fa8('0xe')][_0x3d769[_0x9fa8('0x58')]][_0x9fa8('0x48')]!==_[_0x9fa8('0x5a')](_0x3d769[_0x9fa8('0x48')])||this[_0x9fa8('0xe')][_0x3d769['queue']][_0x9fa8('0x2a')]!==_0x15fcb5){this[_0x9fa8('0xe')][_0x3d769[_0x9fa8('0x58')]][_0x9fa8('0x2b')]=_[_0x9fa8('0x5a')](_0x3d769[_0x9fa8('0x5b')]);this[_0x9fa8('0xe')][_0x3d769[_0x9fa8('0x58')]][_0x9fa8('0x5c')]=_['toNumber'](_0x3d769[_0x9fa8('0x5d')]);this[_0x9fa8('0xe')][_0x3d769[_0x9fa8('0x58')]][_0x9fa8('0x48')]=_[_0x9fa8('0x5a')](_0x3d769[_0x9fa8('0x48')]);this[_0x9fa8('0xe')][_0x3d769[_0x9fa8('0x58')]][_0x9fa8('0x2a')]=_0x15fcb5>0x0?_0x15fcb5:0x0;this['voiceQueues'][_0x3d769['queue']][_0x9fa8('0x2a')]=this['voiceQueues'][_0x3d769[_0x9fa8('0x58')]][_0x9fa8('0x2a')]>_[_0x9fa8('0x5a')](_0x3d769[_0x9fa8('0x5d')])?_[_0x9fa8('0x5a')](_0x3d769[_0x9fa8('0x5d')]):this['voiceQueues'][_0x3d769[_0x9fa8('0x58')]]['talking'];this[_0x9fa8('0x43')](this['voiceQueues'][_0x3d769[_0x9fa8('0x58')]]);}ami[_0x9fa8('0x3d')]('custom:queuesummary',this[_0x9fa8('0xe')][_0x3d769[_0x9fa8('0x58')]]);}}}catch(_0x5bbb05){logger[_0x9fa8('0x35')](_0x9fa8('0x5e'),util[_0x9fa8('0x3c')](_0x5bbb05,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x16')]=function(_0x20cf14){this[_0x9fa8('0xf')]=!![];};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x5f')]=function(_0x21d37a){};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x360bb5){try{if(this[_0x9fa8('0x52')](_0x360bb5)){if(_[_0x9fa8('0x53')](this['queueReports'][_0x360bb5[_0x9fa8('0x60')]])){this['queueReports'][_0x360bb5[_0x9fa8('0x60')]]=[];this['channels'][_0x360bb5[_0x9fa8('0x60')]]={};}var _0x11095d=new QueueReport();_0x11095d[_0x9fa8('0x41')]=_0x360bb5[_0x9fa8('0x58')];_0x11095d[_0x9fa8('0x44')]=this['voiceQueues'][_0x11095d['name']]&&this[_0x9fa8('0xe')][_0x11095d[_0x9fa8('0x41')]][_0x9fa8('0x44')]?this[_0x9fa8('0xe')][_0x11095d[_0x9fa8('0x41')]]['type']||_0x9fa8('0x45'):_0x9fa8('0x45');_0x11095d[_0x9fa8('0x58')]=_0x360bb5['queue'];_0x11095d[_0x9fa8('0x61')]=moment()[_0x9fa8('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x11095d['position']=_0x360bb5[_0x9fa8('0x62')];_0x11095d[_0x9fa8('0x63')]=_0x360bb5[_0x9fa8('0x63')];_['merge'](_0x11095d,_[_0x9fa8('0x64')](_0x360bb5,_[_0x9fa8('0x65')](_0x11095d)));this['queueReports'][_0x360bb5[_0x9fa8('0x60')]]['push'](_0x11095d);this[_0x9fa8('0xc')][_0x360bb5[_0x9fa8('0x60')]]=_0x11095d;this[_0x9fa8('0x66')](_0x11095d);}}catch(_0x217858){logger[_0x9fa8('0x35')](_0x9fa8('0x67'),util[_0x9fa8('0x3c')](_0x217858,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x19')]=function(_0x3b5f4c){try{if(this[_0x9fa8('0x52')](_0x3b5f4c)){if(this[_0x9fa8('0x37')][_0x3b5f4c[_0x9fa8('0x60')]]){var _0x56cba8=_[_0x9fa8('0x68')](this[_0x9fa8('0x37')][_0x3b5f4c['uniqueid']]);_0x56cba8[_0x9fa8('0x69')]=_0x3b5f4c[_0x9fa8('0x69')];_0x56cba8[_0x9fa8('0x6a')]=_0x3b5f4c[_0x9fa8('0x6a')];_0x56cba8[_0x9fa8('0x6b')]=!![];_0x56cba8['queuecallerabandonAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x56cba8[_0x9fa8('0x6c')]='ABANDONED';_0x56cba8[_0x9fa8('0x6d')]=null;this[_0x9fa8('0xc')][_0x3b5f4c[_0x9fa8('0x60')]]=_0x56cba8;this[_0x9fa8('0x3b')](_0x56cba8);}}}catch(_0x374708){logger[_0x9fa8('0x35')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0x9fa8('0x3c')](_0x374708,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x1b')]=function(_0x3c115d){try{if(this['isNotNull'](_0x3c115d)){if(this[_0x9fa8('0x37')][_0x3c115d[_0x9fa8('0x60')]]){var _0x4b751c=_['last'](this['queueReports'][_0x3c115d[_0x9fa8('0x60')]]);_0x4b751c[_0x9fa8('0x6e')]=moment()[_0x9fa8('0x3e')](_0x9fa8('0x6f'));_0x4b751c[_0x9fa8('0x70')]=_0x3c115d[_0x9fa8('0x70')];_0x4b751c[_0x9fa8('0x71')]=_0x3c115d[_0x9fa8('0x71')];this[_0x9fa8('0xc')][_0x3c115d['uniqueid']]=_0x4b751c;this[_0x9fa8('0x66')](_0x4b751c);}}}catch(_0x1250f3){logger['error'](_0x9fa8('0x72'),util[_0x9fa8('0x3c')](_0x1250f3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9fa8('0x2d')]['syncAgentComplete']=function(_0xc85d57){try{if(this[_0x9fa8('0x52')](_0xc85d57)){if(this[_0x9fa8('0x37')][_0xc85d57[_0x9fa8('0x60')]]){var _0x57f122=_['last'](this[_0x9fa8('0x37')][_0xc85d57['uniqueid']]);_0x57f122[_0x9fa8('0x6b')]=![];_0x57f122[_0x9fa8('0x73')]=null;_0x57f122['assigned']=!![];_0x57f122['lastAssignedTo']=_0xc85d57['membername'];_0x57f122[_0x9fa8('0x69')]=_0xc85d57[_0x9fa8('0x69')];if(_0xc85d57[_0x9fa8('0x70')]===_0x9fa8('0x74')&&_['startsWith'](_0xc85d57['interface'][_0x9fa8('0x75')](),'sip/')){if(!_0x57f122['transfer']){_0x57f122['queuecallerexit']=!![];_0x57f122[_0x9fa8('0x76')]=moment(_0x57f122[_0x9fa8('0x61')])[_0x9fa8('0x77')](_0xc85d57['holdtime'],_0x9fa8('0x78'))['format'](_0x9fa8('0x6f'));_0x57f122['queuecallerexitreason']='FORWARDTRANSFER';_0x57f122[_0x9fa8('0x79')]=!![];_0x57f122[_0x9fa8('0x7a')]='FORWARD';_0x57f122[_0x9fa8('0x7b')]=_0xc85d57[_0x9fa8('0x7c')];_0x57f122[_0x9fa8('0x7d')]=_0xc85d57[_0x9fa8('0x60')];}if(this[_0x9fa8('0xb')][_0xc85d57[_0x9fa8('0x7e')]]){_0x57f122[_0x9fa8('0x70')]=this[_0x9fa8('0xb')][_0xc85d57[_0x9fa8('0x7e')]][_0x9fa8('0x7f')];_0x57f122[_0x9fa8('0x71')]=this[_0x9fa8('0xb')][_0xc85d57[_0x9fa8('0x7e')]][_0x9fa8('0x80')];_0x57f122['destcalleridnum']=this['agents'][_0xc85d57[_0x9fa8('0x7e')]][_0x9fa8('0x7f')];_0x57f122[_0x9fa8('0x81')]=this[_0x9fa8('0xb')][_0xc85d57['interface']][_0x9fa8('0x80')];}}else{_0x57f122[_0x9fa8('0x82')]=!![];_0x57f122[_0x9fa8('0x83')]=moment()[_0x9fa8('0x3e')](_0x9fa8('0x6f'));_0x57f122[_0x9fa8('0x84')]=![];_0x57f122[_0x9fa8('0x76')]=null;if(_0xc85d57[_0x9fa8('0x85')]!==_0x9fa8('0x79')){_0x57f122[_0x9fa8('0x6c')]='COMPLETEDBY'+_0xc85d57['reason']['toUpperCase']();}}this[_0x9fa8('0xc')][_0xc85d57[_0x9fa8('0x60')]]=_0x57f122;this['emitVoiceQueueChannelRemove'](_0x57f122);}}}catch(_0xf0c023){logger['error']('[syncAgentComplete][VoiceQueueReport]',util[_0x9fa8('0x3c')](_0xf0c023,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9fa8('0x2d')]['syncVarSet']=function(_0x490eda){try{if(this['isNotNull'](_0x490eda)){this[_0x9fa8('0x86')](_0x490eda[_0x9fa8('0x60')],_[_0x9fa8('0x65')](_0x490eda[_0x9fa8('0x87')])[0x0],_0x490eda['value']);if(this[_0x9fa8('0x37')][_0x490eda['uniqueid']]){var _0x49b7e5=_[_0x9fa8('0x68')](this[_0x9fa8('0x37')][_0x490eda[_0x9fa8('0x60')]]);if(_0x49b7e5){if(this[_0x9fa8('0x52')](_0x490eda[_0x9fa8('0x87')])&&this['isNotNull'](_0x490eda[_0x9fa8('0x87')]['queuestatus'])){switch(_0x490eda[_0x9fa8('0x88')]){case'CONTINUE':_0x49b7e5[_0x9fa8('0x84')]=![];_0x49b7e5[_0x9fa8('0x76')]=null;break;default:_0x49b7e5[_0x9fa8('0x84')]=!![];_0x49b7e5['queuecallerexitAt']=moment()[_0x9fa8('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x49b7e5[_0x9fa8('0x6e')]=moment()['format'](_0x9fa8('0x6f'));}_0x49b7e5[_0x9fa8('0x6b')]=![];_0x49b7e5[_0x9fa8('0x73')]=null;_0x49b7e5['queuecallerexitreason']=_0x490eda['value'];this[_0x9fa8('0xc')][_0x490eda[_0x9fa8('0x60')]]=_0x49b7e5;this[_0x9fa8('0x3b')](_0x49b7e5);}else if(this[_0x9fa8('0x52')](_0x490eda[_0x9fa8('0x87')])&&this['isNotNull'](_0x490eda[_0x9fa8('0x87')][_0x9fa8('0x89')])){if(!_0x49b7e5[_0x9fa8('0x6b')]){_0x49b7e5[_0x9fa8('0x84')]=!![];_0x49b7e5['queuecallerexitAt']=moment()[_0x9fa8('0x3e')](_0x9fa8('0x6f'));_0x49b7e5['queuecallerexitreason']=_0x9fa8('0x8a');_0x49b7e5[_0x9fa8('0x6e')]=moment()[_0x9fa8('0x3e')](_0x9fa8('0x6f'));this[_0x9fa8('0xc')][_0x490eda[_0x9fa8('0x60')]]=_0x49b7e5;}}_0x49b7e5[_0x9fa8('0x11')]=this['variables'][_0x490eda[_0x9fa8('0x60')]];}}}}catch(_0xbcac84){logger['error'](_0x9fa8('0x8b'),util[_0x9fa8('0x3c')](_0xbcac84,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x86')]=function(_0x166373,_0x27d8b0,_0x473a50){var _0x25ec3e=[_0x9fa8('0x8c'),_0x9fa8('0x8d'),_0x9fa8('0x8e'),'rtpaudioqosjitterbridged',_0x9fa8('0x8f'),_0x9fa8('0x90'),'rtpaudioqosrtt',_0x9fa8('0x91'),'sipcallid',_0x9fa8('0x92'),_0x9fa8('0x93'),_0x9fa8('0x94'),_0x9fa8('0x95'),_0x9fa8('0x96'),'memberinterface',_0x9fa8('0x97'),_0x9fa8('0x98'),'memberpenalty',_0x9fa8('0x99')];if(!_[_0x9fa8('0x9a')](_0x27d8b0)&&!_[_0x9fa8('0x9b')](_0x25ec3e,_0x27d8b0)){if(_[_0x9fa8('0x53')](this[_0x9fa8('0x11')][_0x166373])){this[_0x9fa8('0x11')][_0x166373]={};}this['variables'][_0x166373][_0x27d8b0]=_0x473a50;}};VoiceQueueReport[_0x9fa8('0x2d')][_0x9fa8('0x9c')]=function(_0x4ae725){try{if(this[_0x9fa8('0x52')](_0x4ae725)){if(this[_0x9fa8('0x37')][_0x4ae725['uniqueid']]){for(var _0x545e12=0x0,_0x154852={};_0x545e12=0x0?moment(_0xca02c1['endtime'])[_0xfff5('0x15')](_0xca02c1[_0xfff5('0x13')],_0xfff5('0x9')):null,'data1':_0xfff5('0x16'),'data2':_0xca02c1[_0xfff5('0xf')],'data3':_0xca02c1[_0xfff5('0xc')],'data4':_0xca02c1[_0xfff5('0x17')]||null,'role':_0xfff5('0xe'),'internal':_0xca02c1[_0xfff5('0xf')]?_['toNumber'](_0xca02c1['accountcode']):undefined,'uniqueid':_0xca02c1[_0xfff5('0x18')]},'log':_0xfff5('0x2')});}; \ No newline at end of file +var _0xd8e1=['dialstring','moment','../client','voiceQueueReport','Request','CreateMemberReport','voice','lastAssignedTo','SIP/','TALKING','queuecallerleaveAt','queuecallercompleteAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','channel','split','starttime','endtime','outbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8e1,0x1a5));var _0x1d8e=function(_0xdfe83a,_0x445418){_0xdfe83a=_0xdfe83a-0x0;var _0x33e4d3=_0xd8e1[_0xdfe83a];return _0x33e4d3;};'use strict';var moment=require(_0x1d8e('0x0'));var _=require('lodash');var client=require(_0x1d8e('0x1'));exports[_0x1d8e('0x2')]=function(_0x593fda){return client[_0x1d8e('0x3')](_0x1d8e('0x4'),{'body':{'channel':_0x1d8e('0x5'),'membername':_0x593fda[_0x1d8e('0x6')],'interface':_0x1d8e('0x7')+_0x593fda[_0x1d8e('0x6')],'type':_0x1d8e('0x8'),'enterAt':_0x593fda[_0x1d8e('0x9')],'exitAt':_0x593fda[_0x1d8e('0xa')],'duration':moment(_0x593fda[_0x1d8e('0xa')])[_0x1d8e('0xb')](_0x593fda['queuecallerleaveAt'],_0x1d8e('0xc')),'data1':_0x1d8e('0xd'),'data2':_0x593fda[_0x1d8e('0xe')],'data3':_0x593fda[_0x1d8e('0xf')],'data4':null,'data5':_0x593fda[_0x1d8e('0x10')],'role':_0x1d8e('0x11'),'internal':_0x593fda[_0x1d8e('0x12')]?_[_0x1d8e('0x13')](_0x593fda[_0x1d8e('0x12')]):undefined,'uniqueid':_0x593fda[_0x1d8e('0x14')]},'log':_0x1d8e('0x4')});};exports[_0x1d8e('0x15')]=function(_0x5200d7){return client[_0x1d8e('0x3')]('CreateMemberReport',{'body':{'channel':_0x1d8e('0x5'),'membername':_0x5200d7['channel']?_0x5200d7[_0x1d8e('0x16')][_0x1d8e('0x17')](/\/|-/)[0x1]:undefined,'interface':_0x5200d7[_0x1d8e('0x16')]?_0x5200d7['channel'][_0x1d8e('0x17')]('-')[0x0]:undefined,'type':'TALKING','enterAt':_0x5200d7[_0x1d8e('0x18')],'exitAt':_0x5200d7[_0x1d8e('0x19')],'duration':moment(_0x5200d7['endtime'])[_0x1d8e('0xb')](_0x5200d7[_0x1d8e('0x18')],'seconds')>=0x0?moment(_0x5200d7[_0x1d8e('0x19')])['diff'](_0x5200d7[_0x1d8e('0x18')],'seconds'):null,'data1':_0x1d8e('0x1a'),'data2':_0x5200d7[_0x1d8e('0x12')],'data3':_0x5200d7[_0x1d8e('0xf')],'data4':_0x5200d7[_0x1d8e('0x1b')]||null,'role':_0x1d8e('0x11'),'internal':_0x5200d7[_0x1d8e('0x12')]?_['toNumber'](_0x5200d7[_0x1d8e('0x12')]):undefined,'uniqueid':_0x5200d7[_0x1d8e('0x14')]},'log':_0x1d8e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index aa87283..5a7cf3b 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 _0xb8af=['../client','GetTemplate','html'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0xb8af,0xe1));var _0xfb8a=function(_0x2c8208,_0x3600de){_0x2c8208=_0x2c8208-0x0;var _0x56afa7=_0xb8af[_0x2c8208];return _0x56afa7;};'use strict';var client=require(_0xfb8a('0x0'));exports['getTemplates']=function(_0x183b6f){return function(_0x46dabe){return client['Request'](_0xfb8a('0x1'),{'options':{'raw':!![],'attributes':['id','name',_0xfb8a('0x2')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x911d=['getTemplates','Request','GetTemplate','html','../client'];(function(_0x40a397,_0x476404){var _0x8ce76=function(_0x161da3){while(--_0x161da3){_0x40a397['push'](_0x40a397['shift']());}};_0x8ce76(++_0x476404);}(_0x911d,0xea));var _0xd911=function(_0x3aaf97,_0x4fa2e8){_0x3aaf97=_0x3aaf97-0x0;var _0xeba75e=_0x911d[_0x3aaf97];return _0xeba75e;};'use strict';var client=require(_0xd911('0x0'));exports[_0xd911('0x1')]=function(_0x2683b6){return function(_0x4afd3b){return client[_0xd911('0x2')](_0xd911('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xd911('0x4')]},'log':_0xd911('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2004c07..d608533 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(_0x2a114b,_0x249344){var _0x108ba8=function(_0x497568){while(--_0x497568){_0x2a114b['push'](_0x2a114b['shift']());}};_0x108ba8(++_0x249344);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x5a7917,_0x5bd279){var _0x45ff24=function(_0x1ece74){while(--_0x1ece74){_0x5a7917['push'](_0x5a7917['shift']());}};_0x45ff24(++_0x5bd279);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 904bb6f..11687ac 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 _0xaf86=['name','registry','../client','getTrunks','Request','GetTrunk'];(function(_0xb85452,_0x268465){var _0x28657b=function(_0xa8ad0){while(--_0xa8ad0){_0xb85452['push'](_0xb85452['shift']());}};_0x28657b(++_0x268465);}(_0xaf86,0x18e));var _0x6af8=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0xaf86[_0xed4881];return _0x7fcbd5;};'use strict';var client=require(_0x6af8('0x0'));exports[_0x6af8('0x1')]=function(_0x43bdf0){return function(_0x551bc2){return client[_0x6af8('0x2')](_0x6af8('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6af8('0x4'),_0x6af8('0x5')]},'log':_0x6af8('0x3')});};}; \ No newline at end of file +var _0x46de=['name','../client','getTrunks','Request','GetTrunk'];(function(_0x557ebb,_0x44d513){var _0x3feb52=function(_0x38a0ab){while(--_0x38a0ab){_0x557ebb['push'](_0x557ebb['shift']());}};_0x3feb52(++_0x44d513);}(_0x46de,0x1b4));var _0xe46d=function(_0x5d1dad,_0x2cbdd4){_0x5d1dad=_0x5d1dad-0x0;var _0x334f8d=_0x46de[_0x5d1dad];return _0x334f8d;};'use strict';var client=require(_0xe46d('0x0'));exports[_0xe46d('0x1')]=function(_0x5655e8){return function(_0x418806){return client[_0xe46d('0x2')](_0xe46d('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe46d('0x4'),'registry']},'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 67f76a5..ef12f0d 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 _0xf4a5=['UnpauseUser','ShowUser','getAgent','getAgents','Request','GetUser','agent','name','email','fullname','online','lastPauseAt','voicePause','phone','mobile','getTelephones','telephone','savePause','PauseUser','saveUnpause'];(function(_0x49d31e,_0x401f11){var _0xba6fa2=function(_0x259480){while(--_0x259480){_0x49d31e['push'](_0x49d31e['shift']());}};_0xba6fa2(++_0x401f11);}(_0xf4a5,0x1cf));var _0x5f4a=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xf4a5[_0xf73c09];return _0xa8923c;};'use strict';var client=require('../client');exports[_0x5f4a('0x0')]=function(){return function(){return client[_0x5f4a('0x1')](_0x5f4a('0x2'),{'options':{'raw':![],'where':{'role':_0x5f4a('0x3')},'attributes':['id',_0x5f4a('0x4'),_0x5f4a('0x5'),'accountcode',_0x5f4a('0x6'),_0x5f4a('0x7'),'lastLoginAt','pauseType',_0x5f4a('0x8'),_0x5f4a('0x9'),_0x5f4a('0xa'),_0x5f4a('0xb')]},'log':_0x5f4a('0x0')});};};exports[_0x5f4a('0xc')]=function(){return function(){return client[_0x5f4a('0x1')](_0x5f4a('0x2'),{'options':{'raw':!![],'where':{'role':_0x5f4a('0xd')},'attributes':['id',_0x5f4a('0x4')]},'log':_0x5f4a('0xc')});};};exports[_0x5f4a('0xe')]=function(_0x105808,_0x5d3542,_0x1bd430){return client[_0x5f4a('0x1')](_0x5f4a('0xf'),{'body':{'type':_0x5d3542,'uniqueid':_0x1bd430},'options':{'where':{'id':_0x105808['id']}},'log':'savePause'});};exports[_0x5f4a('0x10')]=function(_0xbe42b3){return client['Request'](_0x5f4a('0x11'),{'body':{},'options':{'where':{'id':_0xbe42b3['id']}},'log':_0x5f4a('0xe')});};exports['getAgent']=function(_0x52e4d1){return client[_0x5f4a('0x1')](_0x5f4a('0x12'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52e4d1},'attributes':['id','name',_0x5f4a('0x5'),'accountcode',_0x5f4a('0x6'),_0x5f4a('0x7'),'lastLoginAt','pauseType',_0x5f4a('0x8'),_0x5f4a('0x9')]},'log':_0x5f4a('0x13')});}; \ No newline at end of file +var _0x2b51=['pauseType','voicePause','phone','mobile','getTelephones','savePause','UnpauseUser','getAgent','ShowUser','agent','online','../client','getAgents','Request','GetUser','name','email','accountcode','fullname','lastLoginAt'];(function(_0x594ced,_0xa8963d){var _0x3e733c=function(_0x31bd22){while(--_0x31bd22){_0x594ced['push'](_0x594ced['shift']());}};_0x3e733c(++_0xa8963d);}(_0x2b51,0xe7));var _0x12b5=function(_0x3b5ce3,_0x465fc4){_0x3b5ce3=_0x3b5ce3-0x0;var _0x3682ea=_0x2b51[_0x3b5ce3];return _0x3682ea;};'use strict';var client=require(_0x12b5('0x0'));exports[_0x12b5('0x1')]=function(){return function(){return client[_0x12b5('0x2')](_0x12b5('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x12b5('0x4'),_0x12b5('0x5'),_0x12b5('0x6'),_0x12b5('0x7'),'online',_0x12b5('0x8'),_0x12b5('0x9'),'lastPauseAt',_0x12b5('0xa'),_0x12b5('0xb'),_0x12b5('0xc')]},'log':_0x12b5('0x1')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0x12b5('0x3'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x12b5('0x4')]},'log':_0x12b5('0xd')});};};exports['savePause']=function(_0x3a5d42,_0x2c0d6e,_0x24fe9a){return client[_0x12b5('0x2')]('PauseUser',{'body':{'type':_0x2c0d6e,'uniqueid':_0x24fe9a},'options':{'where':{'id':_0x3a5d42['id']}},'log':_0x12b5('0xe')});};exports['saveUnpause']=function(_0x1cb333){return client[_0x12b5('0x2')](_0x12b5('0xf'),{'body':{},'options':{'where':{'id':_0x1cb333['id']}},'log':_0x12b5('0xe')});};exports[_0x12b5('0x10')]=function(_0x5c9ac8){return client[_0x12b5('0x2')](_0x12b5('0x11'),{'options':{'raw':![],'where':{'role':_0x12b5('0x12'),'id':_0x5c9ac8},'attributes':['id','name',_0x12b5('0x5'),_0x12b5('0x6'),_0x12b5('0x7'),_0x12b5('0x13'),_0x12b5('0x8'),_0x12b5('0x9'),'lastPauseAt','voicePause']},'log':_0x12b5('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index fdeb6a7..9cc05a6 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 _0x108b=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x108b,0x176));var _0xb108=function(_0x2c8b7a,_0x483fe0){_0x2c8b7a=_0x2c8b7a-0x0;var _0x1c1cf9=_0x108b[_0x2c8b7a];return _0x1c1cf9;};'use strict';var client=require(_0xb108('0x0'));exports['create']=function(_0xcb7642){return client[_0xb108('0x1')](_0xb108('0x2'),{'body':_0xcb7642,'log':_0xb108('0x2')});};exports['update']=function(_0x3fae27,_0x199126,_0x4013f2){return client[_0xb108('0x1')](_0xb108('0x3'),{'body':_0x3fae27,'options':{'where':{'uniqueid':_0x199126,'interface':_0x4013f2}},'log':_0xb108('0x3')});}; \ No newline at end of file +var _0xe3f1=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport','update'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0xe3f1,0xec));var _0x1e3f=function(_0x2997eb,_0x26f437){_0x2997eb=_0x2997eb-0x0;var _0x6bf768=_0xe3f1[_0x2997eb];return _0x6bf768;};'use strict';var client=require('../client');exports[_0x1e3f('0x0')]=function(_0x2cae70){return client[_0x1e3f('0x1')](_0x1e3f('0x2'),{'body':_0x2cae70,'log':_0x1e3f('0x2')});};exports[_0x1e3f('0x3')]=function(_0x5f7842,_0x2ec2b4,_0x5f42c0){return client['Request'](_0x1e3f('0x4'),{'body':_0x5f7842,'options':{'where':{'uniqueid':_0x2ec2b4,'interface':_0x5f42c0}},'log':_0x1e3f('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 66f58ca..76e5fde 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 _0xade9=['getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','merge','calleridnum','context'];(function(_0x2f7be9,_0x173b28){var _0x22b2ad=function(_0x2f50e4){while(--_0x2f50e4){_0x2f7be9['push'](_0x2f7be9['shift']());}};_0x22b2ad(++_0x173b28);}(_0xade9,0x188));var _0x9ade=function(_0x43f4c8,_0x22a037){_0x43f4c8=_0x43f4c8-0x0;var _0x3a2e0c=_0xade9[_0x43f4c8];return _0x3a2e0c;};'use strict';var moment=require(_0x9ade('0x0'));var util=require(_0x9ade('0x1'));var _=require(_0x9ade('0x2'));var client=require(_0x9ade('0x3'));exports[_0x9ade('0x4')]=function(_0x297feb){return client['Request']('CreateVoiceCallReport',{'body':_[_0x9ade('0x5')](_0x297feb,{'source':_0x297feb[_0x9ade('0x6')],'destinationcontext':_0x297feb[_0x9ade('0x7')],'callerid':_0x297feb['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x9ade('0x8')]=function(){return function(){return client[_0x9ade('0x9')](_0x9ade('0xa'),{'options':{'where':{'type':[_0x9ade('0xb')],'createdAt':{'$between':[moment()[_0x9ade('0xc')](_0x9ade('0xd'))['format'](_0x9ade('0xe')),moment()[_0x9ade('0xf')]('day')[_0x9ade('0x10')](_0x9ade('0xe'))]}},'attributes':['type',_0x9ade('0x11'),_0x9ade('0x12'),'billableseconds']},'log':_0x9ade('0x13')});};}; \ No newline at end of file +var _0xe245=['context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','merge','calleridnum'];(function(_0x5062ad,_0x565a80){var _0x542939=function(_0x510073){while(--_0x510073){_0x5062ad['push'](_0x5062ad['shift']());}};_0x542939(++_0x565a80);}(_0xe245,0xb5));var _0x5e24=function(_0x59e008,_0x19cd68){_0x59e008=_0x59e008-0x0;var _0x5c1f5e=_0xe245[_0x59e008];return _0x5c1f5e;};'use strict';var moment=require(_0x5e24('0x0'));var util=require(_0x5e24('0x1'));var _=require(_0x5e24('0x2'));var client=require(_0x5e24('0x3'));exports[_0x5e24('0x4')]=function(_0x180185){return client[_0x5e24('0x5')]('CreateVoiceCallReport',{'body':_[_0x5e24('0x6')](_0x180185,{'source':_0x180185[_0x5e24('0x7')],'destinationcontext':_0x180185[_0x5e24('0x8')],'callerid':_0x180185[_0x5e24('0x9')],'amaflags':_0x5e24('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0x5e24('0xb')]=function(){return function(){return client[_0x5e24('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x5e24('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x5e24('0xd'))[_0x5e24('0xe')](_0x5e24('0xf')),moment()[_0x5e24('0x10')](_0x5e24('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x5e24('0x11'),_0x5e24('0x12'),'duration',_0x5e24('0x13')]},'log':_0x5e24('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8be57bd..7d58048 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 _0x11e4=['create','CreateVoiceDialReport','../client'];(function(_0x48d1f0,_0x47f788){var _0x3987d8=function(_0x196006){while(--_0x196006){_0x48d1f0['push'](_0x48d1f0['shift']());}};_0x3987d8(++_0x47f788);}(_0x11e4,0x158));var _0x411e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x11e4[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x411e('0x0'));exports[_0x411e('0x1')]=function(_0x5cd6fa){return client['Request'](_0x411e('0x2'),{'body':_0x5cd6fa,'log':_0x411e('0x2')});}; \ No newline at end of file +var _0x0f36=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0f36,0x1b8));var _0x60f3=function(_0xe1d065,_0x39ab64){_0xe1d065=_0xe1d065-0x0;var _0x481700=_0x0f36[_0xe1d065];return _0x481700;};'use strict';var client=require(_0x60f3('0x0'));exports[_0x60f3('0x1')]=function(_0x387fba){return client[_0x60f3('0x2')]('CreateVoiceDialReport',{'body':_0x387fba,'log':_0x60f3('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index eae599e..022a32c 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 _0x6985=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x50adae,_0x471708){var _0x4b6283=function(_0x1b842f){while(--_0x1b842f){_0x50adae['push'](_0x50adae['shift']());}};_0x4b6283(++_0x471708);}(_0x6985,0xbb));var _0x5698=function(_0x55fcb3,_0x18beec){_0x55fcb3=_0x55fcb3-0x0;var _0x675135=_0x6985[_0x55fcb3];return _0x675135;};'use strict';var client=require(_0x5698('0x0'));exports[_0x5698('0x1')]=function(){return function(){return client[_0x5698('0x2')](_0x5698('0x3'),{'options':{'raw':!![],'attributes':['id',_0x5698('0x4'),_0x5698('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x5698('0x1')});};}; \ No newline at end of file +var _0x065e=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x27e8bc,_0x37a821){var _0x5690ee=function(_0x53ad11){while(--_0x53ad11){_0x27e8bc['push'](_0x27e8bc['shift']());}};_0x5690ee(++_0x37a821);}(_0x065e,0x87));var _0xe065=function(_0x24d22f,_0xfa6241){_0x24d22f=_0x24d22f-0x0;var _0x33b153=_0x065e[_0x24d22f];return _0x33b153;};'use strict';var client=require('../client');exports[_0xe065('0x0')]=function(){return function(){return client[_0xe065('0x1')](_0xe065('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe065('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xe065('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 518a952..938ecf1 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 _0x235b=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout'];(function(_0x1e4687,_0x6356c4){var _0x2c20fb=function(_0x58d87e){while(--_0x58d87e){_0x1e4687['push'](_0x1e4687['shift']());}};_0x2c20fb(++_0x6356c4);}(_0x235b,0x1ed));var _0xb235=function(_0x1efad4,_0x4b42b8){_0x1efad4=_0x1efad4-0x0;var _0x4b9250=_0x235b[_0x1efad4];return _0x4b9250;};'use strict';var client=require(_0xb235('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xb235('0x1'),{'options':{'raw':![],'attributes':['id',_0xb235('0x2'),_0xb235('0x3'),_0xb235('0x4'),_0xb235('0x5'),_0xb235('0x6'),'type',_0xb235('0x7'),_0xb235('0x8'),_0xb235('0x9'),'dialLimitQueue',_0xb235('0xa'),_0xb235('0xb'),_0xb235('0xc'),_0xb235('0xd'),_0xb235('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xb235('0xf'),_0xb235('0x10'),_0xb235('0x11'),_0xb235('0x12'),_0xb235('0x13'),_0xb235('0x14'),_0xb235('0x15'),_0xb235('0x16'),'dialNoAnswerRetryFrequency',_0xb235('0x17'),_0xb235('0x18'),_0xb235('0x19'),'dialPrefix',_0xb235('0x1a'),'dialAMDActive',_0xb235('0x1b'),_0xb235('0x1c'),_0xb235('0x1d'),_0xb235('0x1e'),_0xb235('0x1f'),_0xb235('0x20'),_0xb235('0x21'),'dialAMDSilenceThreshold',_0xb235('0x22'),_0xb235('0x23'),_0xb235('0x24'),_0xb235('0x25'),_0xb235('0x26'),_0xb235('0x27'),_0xb235('0x28'),_0xb235('0x29'),_0xb235('0x6'),_0xb235('0x2a'),_0xb235('0x2b'),_0xb235('0x2c')],'include':[{'model':_0xb235('0x2d'),'as':'Trunk','attributes':['id',_0xb235('0x2'),'callerid',_0xb235('0x2e')]},{'model':'Trunk','as':_0xb235('0x2f'),'attributes':['id',_0xb235('0x2'),'callerid',_0xb235('0x2e')]},{'model':_0xb235('0x30'),'as':_0xb235('0x30'),'attributes':['id',_0xb235('0x2')],'include':[{'model':_0xb235('0x30'),'as':'Intervals','attributes':['id',_0xb235('0x2'),_0xb235('0x31')]}]}]},'log':_0xb235('0x32')});};}; \ No newline at end of file +var _0x58cc=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','Trunk','active','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType'];(function(_0x320f42,_0x1c4672){var _0x58c84b=function(_0x4bf144){while(--_0x4bf144){_0x320f42['push'](_0x320f42['shift']());}};_0x58c84b(++_0x1c4672);}(_0x58cc,0x7a));var _0xc58c=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x58cc[_0x47e549];return _0x251374;};'use strict';var client=require(_0xc58c('0x0'));exports[_0xc58c('0x1')]=function(){return function(){return client[_0xc58c('0x2')](_0xc58c('0x3'),{'options':{'raw':![],'attributes':['id',_0xc58c('0x4'),_0xc58c('0x5'),'acwTimeout',_0xc58c('0x6'),_0xc58c('0x7'),_0xc58c('0x8'),_0xc58c('0x9'),_0xc58c('0xa'),_0xc58c('0xb'),'dialLimitQueue','dialPowerLevel',_0xc58c('0xc'),_0xc58c('0xd'),'dialPredictiveInterval',_0xc58c('0xe'),_0xc58c('0xf'),'dialOriginateTimeout',_0xc58c('0x10'),'dialQueueTimeout',_0xc58c('0x11'),_0xc58c('0x12'),_0xc58c('0x13'),_0xc58c('0x14'),_0xc58c('0x15'),_0xc58c('0x16'),'dialNoAnswerRetryFrequency',_0xc58c('0x17'),_0xc58c('0x18'),_0xc58c('0x19'),_0xc58c('0x1a'),_0xc58c('0x1b'),_0xc58c('0x1c'),_0xc58c('0x1d'),_0xc58c('0x1e'),_0xc58c('0x1f'),_0xc58c('0x20'),'dialAMDMinWordLength',_0xc58c('0x21'),'dialAMDMaximumNumberOfWords',_0xc58c('0x22'),_0xc58c('0x23'),_0xc58c('0x24'),_0xc58c('0x25'),_0xc58c('0x26'),_0xc58c('0x27'),_0xc58c('0x28'),_0xc58c('0x29'),_0xc58c('0x2a'),_0xc58c('0x7'),_0xc58c('0x2b'),'dialRandomLastDigitCallerIdNumber',_0xc58c('0x2c')],'include':[{'model':_0xc58c('0x2d'),'as':_0xc58c('0x2d'),'attributes':['id',_0xc58c('0x4'),'callerid',_0xc58c('0x2e')]},{'model':_0xc58c('0x2d'),'as':_0xc58c('0x2f'),'attributes':['id','name','callerid','active']},{'model':_0xc58c('0x30'),'as':_0xc58c('0x30'),'attributes':['id',_0xc58c('0x4')],'include':[{'model':_0xc58c('0x30'),'as':'Intervals','attributes':['id','name',_0xc58c('0x31')]}]}]},'log':_0xc58c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d37b03d..c54b71e 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 _0xf0d9=['queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x5ec4eb,_0x2dc478){var _0x1f3253=function(_0x1794d5){while(--_0x1794d5){_0x5ec4eb['push'](_0x5ec4eb['shift']());}};_0x1f3253(++_0x2dc478);}(_0xf0d9,0x122));var _0x9f0d=function(_0x153887,_0x5c56ec){_0x153887=_0x153887-0x0;var _0x376d0e=_0xf0d9[_0x153887];return _0x376d0e;};'use strict';var moment=require(_0x9f0d('0x0'));var _=require(_0x9f0d('0x1'));var client=require(_0x9f0d('0x2'));exports[_0x9f0d('0x3')]=function(_0x31f2e0){return client[_0x9f0d('0x4')]('CreateVoiceQueueReport',{'body':_0x31f2e0,'log':_0x9f0d('0x5')});};exports[_0x9f0d('0x6')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x9f0d('0x7')]('day')['format'](_0x9f0d('0x8')),moment()[_0x9f0d('0x9')](_0x9f0d('0xa'))[_0x9f0d('0xb')](_0x9f0d('0x8'))]}},'attributes':[_0x9f0d('0xc'),_0x9f0d('0xd'),_0x9f0d('0xe'),_0x9f0d('0xf'),_0x9f0d('0x10'),_0x9f0d('0x11'),_0x9f0d('0x12'),_0x9f0d('0x13'),'queuecallerabandon',_0x9f0d('0x14')]},'log':_0x9f0d('0x15')});};}; \ No newline at end of file +var _0xcac4=['Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','../client'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0xcac4,0xfa));var _0x4cac=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0xcac4[_0x513047];return _0x15b779;};'use strict';var moment=require(_0x4cac('0x0'));var _=require('lodash');var client=require(_0x4cac('0x1'));exports['create']=function(_0xc6c828){return client[_0x4cac('0x2')]('CreateVoiceQueueReport',{'body':_0xc6c828,'log':_0x4cac('0x3')});};exports[_0x4cac('0x4')]=function(){return function(){return client[_0x4cac('0x2')](_0x4cac('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x4cac('0x6')](_0x4cac('0x7'))[_0x4cac('0x8')](_0x4cac('0x9')),moment()[_0x4cac('0xa')](_0x4cac('0x7'))[_0x4cac('0x8')](_0x4cac('0x9'))]}},'attributes':['uniqueid',_0x4cac('0xb'),'queuecallerjoinAt',_0x4cac('0xc'),_0x4cac('0xd'),'queuecallercompleteAt',_0x4cac('0xe'),'queuecallerexitAt',_0x4cac('0xf'),_0x4cac('0x10')]},'log':_0x4cac('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 2c62f30..b779681 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 _0x2a12=['../client','getVoiceQueueRtPauses','Request'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x2a12,0xa8));var _0x22a1=function(_0x7ad478,_0x2e89ef){_0x7ad478=_0x7ad478-0x0;var _0x1c660c=_0x2a12[_0x7ad478];return _0x1c660c;};'use strict';var client=require(_0x22a1('0x0'));exports[_0x22a1('0x1')]=function(_0x466355){return function(){return client[_0x22a1('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x466355,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x19c3=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0x19c3,0xc5));var _0x319c=function(_0x1d7fca,_0x54997){_0x1d7fca=_0x1d7fca-0x0;var _0x32bdca=_0x19c3[_0x1d7fca];return _0x32bdca;};'use strict';var client=require(_0x319c('0x0'));exports[_0x319c('0x1')]=function(_0x3eb67f){return function(){return client[_0x319c('0x2')](_0x319c('0x3'),{'options':{'where':{'VoiceQueueId':_0x3eb67f,'paused':!![]},'raw':!![]},'log':_0x319c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3e97ed2..6ffbdce 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 _0xde46=['CreateVoiceRecording','merge','monitorFilename','../client','create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xde46,0x1f2));var _0x6de4=function(_0x41246f,_0x4d582d){_0x41246f=_0x41246f-0x0;var _0x456248=_0xde46[_0x41246f];return _0x456248;};'use strict';var _=require('lodash');var client=require(_0x6de4('0x0'));exports[_0x6de4('0x1')]=function(_0x5601b5){return client['Request'](_0x6de4('0x2'),{'body':_[_0x6de4('0x3')](_0x5601b5,{'value':_0x5601b5[_0x6de4('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xf339=['monitorFilename','lodash','../client','CreateVoiceRecording','merge'];(function(_0x541ec1,_0x3190e9){var _0x163af5=function(_0x1189cf){while(--_0x1189cf){_0x541ec1['push'](_0x541ec1['shift']());}};_0x163af5(++_0x3190e9);}(_0xf339,0x178));var _0x9f33=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf339[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x9f33('0x0'));var client=require(_0x9f33('0x1'));exports['create']=function(_0x2af488){return client['Request'](_0x9f33('0x2'),{'body':_[_0x9f33('0x3')](_0x2af488,{'value':_0x2af488[_0x9f33('0x4')]}),'log':_0x9f33('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index dc2920e..9acda99 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 _0xe791=['transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum'];(function(_0x502417,_0x3b4a19){var _0x32e1f8=function(_0x5d2b6d){while(--_0x5d2b6d){_0x502417['push'](_0x502417['shift']());}};_0x32e1f8(++_0x3b4a19);}(_0xe791,0x128));var _0x1e79=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe791[_0x8c43de];return _0xa6591b;};'use strict';var client=require(_0x1e79('0x0'));exports['blindTransfer']=function(_0x13dd98){return client[_0x1e79('0x1')](_0x1e79('0x2'),{'body':{'result':_0x13dd98[_0x1e79('0x3')],'transfererchannel':_0x13dd98[_0x1e79('0x4')],'transferercalleridnum':_0x13dd98[_0x1e79('0x5')],'transferercalleridname':_0x13dd98[_0x1e79('0x6')],'transfererconnectedlinenum':_0x13dd98[_0x1e79('0x7')],'transfererconnectedlinename':_0x13dd98[_0x1e79('0x8')],'transfereraccountcode':_0x13dd98[_0x1e79('0x9')],'transferercontext':_0x13dd98['transferercontext'],'transfererexten':_0x13dd98['transfererexten'],'transfererlinkedid':_0x13dd98[_0x1e79('0xa')],'transfereechannel':_0x13dd98[_0x1e79('0xb')],'transfereecalleridnum':_0x13dd98[_0x1e79('0xc')],'transfereecalleridname':_0x13dd98['transfereecalleridname'],'transfereeconnectedlinenum':_0x13dd98['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x13dd98[_0x1e79('0xd')],'transfereeaccountcode':_0x13dd98[_0x1e79('0xe')],'transfereecontext':_0x13dd98[_0x1e79('0xf')],'transfereeexten':_0x13dd98['transfereeexten'],'transfereelinkedid':_0x13dd98[_0x1e79('0x10')],'isexternal':_0x13dd98[_0x1e79('0x11')],'context':_0x13dd98['context'],'extension':_0x13dd98[_0x1e79('0x12')],'type':_0x1e79('0x13')},'log':_0x1e79('0x2')});};exports[_0x1e79('0x14')]=function(_0x14f4be){return client[_0x1e79('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x14f4be[_0x1e79('0x3')],'transfererchannel':_0x14f4be[_0x1e79('0x15')],'transferercalleridnum':_0x14f4be[_0x1e79('0x16')],'transferercalleridname':_0x14f4be['origtransferercalleridname'],'transfererconnectedlinenum':_0x14f4be[_0x1e79('0x17')],'transfererconnectedlinename':_0x14f4be[_0x1e79('0x18')],'transfereraccountcode':_0x14f4be[_0x1e79('0x19')],'transferercontext':_0x14f4be[_0x1e79('0x1a')],'transfererexten':_0x14f4be[_0x1e79('0x1b')],'transfererlinkedid':_0x14f4be['origtransfererlinkedid'],'transfereechannel':_0x14f4be[_0x1e79('0x1c')],'transfereecalleridnum':_0x14f4be[_0x1e79('0x1d')],'transfereecalleridname':_0x14f4be[_0x1e79('0x1e')],'transfereeconnectedlinenum':_0x14f4be[_0x1e79('0x1f')],'transfereeconnectedlinename':_0x14f4be['transfertargetconnectedlinename'],'transfereeaccountcode':_0x14f4be[_0x1e79('0x20')],'transfereecontext':_0x14f4be[_0x1e79('0x21')],'transfereeexten':_0x14f4be[_0x1e79('0x22')],'transfereelinkedid':_0x14f4be[_0x1e79('0x23')],'isexternal':_0x14f4be['isexternal'],'context':_0x14f4be[_0x1e79('0x24')],'extension':_0x14f4be['origtransfererexten'],'type':_0x1e79('0x25')},'log':_0x1e79('0x2')});}; \ No newline at end of file +var _0xfc18=['transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename'];(function(_0x70504d,_0x34e810){var _0x47e29b=function(_0x119dfe){while(--_0x119dfe){_0x70504d['push'](_0x70504d['shift']());}};_0x47e29b(++_0x34e810);}(_0xfc18,0x94));var _0x8fc1=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0xfc18[_0x6dfbaa];return _0xfbe02;};'use strict';var client=require('../client');exports[_0x8fc1('0x0')]=function(_0x57a0c3){return client[_0x8fc1('0x1')](_0x8fc1('0x2'),{'body':{'result':_0x57a0c3[_0x8fc1('0x3')],'transfererchannel':_0x57a0c3[_0x8fc1('0x4')],'transferercalleridnum':_0x57a0c3[_0x8fc1('0x5')],'transferercalleridname':_0x57a0c3['transferercalleridname'],'transfererconnectedlinenum':_0x57a0c3[_0x8fc1('0x6')],'transfererconnectedlinename':_0x57a0c3[_0x8fc1('0x7')],'transfereraccountcode':_0x57a0c3[_0x8fc1('0x8')],'transferercontext':_0x57a0c3[_0x8fc1('0x9')],'transfererexten':_0x57a0c3[_0x8fc1('0xa')],'transfererlinkedid':_0x57a0c3[_0x8fc1('0xb')],'transfereechannel':_0x57a0c3[_0x8fc1('0xc')],'transfereecalleridnum':_0x57a0c3['transfereecalleridnum'],'transfereecalleridname':_0x57a0c3['transfereecalleridname'],'transfereeconnectedlinenum':_0x57a0c3[_0x8fc1('0xd')],'transfereeconnectedlinename':_0x57a0c3[_0x8fc1('0xe')],'transfereeaccountcode':_0x57a0c3[_0x8fc1('0xf')],'transfereecontext':_0x57a0c3[_0x8fc1('0x10')],'transfereeexten':_0x57a0c3[_0x8fc1('0x11')],'transfereelinkedid':_0x57a0c3[_0x8fc1('0x12')],'isexternal':_0x57a0c3[_0x8fc1('0x13')],'context':_0x57a0c3['context'],'extension':_0x57a0c3[_0x8fc1('0x14')],'type':_0x8fc1('0x15')},'log':_0x8fc1('0x2')});};exports[_0x8fc1('0x16')]=function(_0x1b78f3){return client[_0x8fc1('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x1b78f3[_0x8fc1('0x3')],'transfererchannel':_0x1b78f3[_0x8fc1('0x17')],'transferercalleridnum':_0x1b78f3['origtransferercalleridnum'],'transferercalleridname':_0x1b78f3[_0x8fc1('0x18')],'transfererconnectedlinenum':_0x1b78f3[_0x8fc1('0x19')],'transfererconnectedlinename':_0x1b78f3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1b78f3[_0x8fc1('0x1a')],'transferercontext':_0x1b78f3[_0x8fc1('0x1b')],'transfererexten':_0x1b78f3['secondtransfererexten'],'transfererlinkedid':_0x1b78f3[_0x8fc1('0x1c')],'transfereechannel':_0x1b78f3[_0x8fc1('0x1d')],'transfereecalleridnum':_0x1b78f3['transfertargetcalleridnum'],'transfereecalleridname':_0x1b78f3[_0x8fc1('0x1e')],'transfereeconnectedlinenum':_0x1b78f3[_0x8fc1('0x1f')],'transfereeconnectedlinename':_0x1b78f3[_0x8fc1('0x20')],'transfereeaccountcode':_0x1b78f3['transfertargetaccountcode'],'transfereecontext':_0x1b78f3[_0x8fc1('0x21')],'transfereeexten':_0x1b78f3[_0x8fc1('0x22')],'transfereelinkedid':_0x1b78f3[_0x8fc1('0x23')],'isexternal':_0x1b78f3[_0x8fc1('0x13')],'context':_0x1b78f3[_0x8fc1('0x24')],'extension':_0x1b78f3[_0x8fc1('0x25')],'type':_0x8fc1('0x26')},'log':_0x8fc1('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 04c9b81..5c5cc8e 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 _0x6132=['outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','Trunk','active','callerid','Interval','push','values','channels','voicechannel','length','map','filename','uniqueid','wav','Action','channel','monitors','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','find','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','/var/spool/asterisk/monitor/','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','campaigns','custom:','faxAccounts','send','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','action','Reload','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0x421e69,_0x53f1ee){var _0x486ec1=function(_0x13dc1e){while(--_0x13dc1e){_0x421e69['push'](_0x421e69['shift']());}};_0x486ec1(++_0x53f1ee);}(_0x6132,0x13a));var _0x2613=function(_0x4dfe9d,_0x53b36d){_0x4dfe9d=_0x4dfe9d-0x0;var _0x2f76bd=_0x6132[_0x4dfe9d];return _0x2f76bd;};'use strict';var _=require(_0x2613('0x0'));var util=require(_0x2613('0x1'));var jayson=require(_0x2613('0x2'));var schema=require(_0x2613('0x3'));var BPromise=require('bluebird');var moment=require(_0x2613('0x4'));var config=require(_0x2613('0x5'));var properties=require(_0x2613('0x6'));var ami=require(_0x2613('0x7'));exports['listen']=function(_0x8d00d8,_0x4b96c6,_0x59240d){return new BPromise(function(_0x30cac4,_0x309663){var _0x369931={'QueuePause':function(_0x465a32){return new Promise(function(_0xe295ea,_0x4b6a40){var _0x370d75=util[_0x2613('0x8')](_0x2613('0x9'),'SIP',_0x465a32[_0x2613('0xa')]);if(_0x8d00d8[_0x2613('0xb')]&&_0x8d00d8[_0x2613('0xb')][_0x370d75]&&_0x8d00d8[_0x2613('0xb')][_0x370d75][_0x2613('0xc')]){_0x8d00d8[_0x2613('0xb')][_0x370d75][_0x2613('0xd')]();}if(_0x8d00d8[_0x2613('0xe')][_0x370d75]){_0x8d00d8[_0x2613('0xe')][_0x370d75][_0x2613('0xf')]({'statePause':_0x465a32['pause']?!![]:![]});}_0xe295ea({'code':0xc8,'message':_0x2613('0x10')});});},'Reload':function(_0x1bdad4){var _0x3121e1=this;return new Promise(function(_0x34cbc4,_0x5e7fef){if(ami[_0x2613('0x11')]()==![]){return _0x5e7fef(_0x3121e1[_0x2613('0x12')](0x1f4,[config[_0x2613('0x13')]['ip'],config[_0x2613('0x13')]['username'],_0x2613('0x14')][_0x2613('0x15')]('\x20')));}_0x1bdad4=_[_0x2613('0x16')](_0x1bdad4,_[_0x2613('0x17')](properties['module']));_0x1bdad4[_0x2613('0x18')]=_0x2613('0x19');return ami['Action'](_0x1bdad4)[_0x2613('0x1a')](function(_0x226197){_0x34cbc4({'code':0xc8,'message':_0x226197[_0x2613('0x1b')]});})[_0x2613('0x1c')](function(_0x2954f3){_0x5e7fef(_0x3121e1['error'](0x1f5,_0x2954f3[_0x2613('0x1b')]));});});},'Command':function(_0x20877a){var _0x544a15=this;return new Promise(function(_0x249263,_0x2b5242){if(ami[_0x2613('0x11')]()==![]){return _0x2b5242(_0x544a15[_0x2613('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x2613('0x13')]['username'],'ami\x20disconnected'][_0x2613('0x15')]('\x20')));}_0x20877a=_['pick'](_0x20877a,_0x2613('0x1d'));_0x20877a[_0x2613('0x18')]=_0x2613('0x1e');return ami['Action'](_0x20877a)['then'](function(_0x54a779){_0x249263({'code':0xc8,'message':_0x54a779[_0x2613('0x1f')]});})['catch'](function(_0x1db1e9){_0x2b5242(_0x544a15[_0x2613('0x12')](0x1f5,_0x1db1e9[_0x2613('0x1b')]));});});},'VoiceQueues':function(_0x434c08){return new Promise(function(_0x28e206,_0x115f6f){var _0x16a222=[];for(var _0xad2c6c in _0x8d00d8['voiceQueues']){if(_0x8d00d8[_0x2613('0x20')][_0x2613('0x21')](_0xad2c6c)){var _0x19fb11=_0x8d00d8[_0x2613('0x20')][_0xad2c6c];var _0xf81db={'id':_0x19fb11['id'],'name':_0x19fb11[_0x2613('0xa')],'strategy':_0x19fb11[_0x2613('0x22')],'answered':_0x19fb11[_0x2613('0x23')],'available':_0x19fb11[_0x2613('0x24')],'loggedIn':_0x19fb11['loggedIn'],'pTalking':_0x19fb11[_0x2613('0x25')],'sumBillable':_0x19fb11[_0x2613('0x26')],'sumDuration':_0x19fb11[_0x2613('0x27')],'sumHoldTime':_0x19fb11[_0x2613('0x28')]||0x0,'talking':_0x19fb11[_0x2613('0x29')],'total':_0x19fb11[_0x2613('0x2a')],'type':_0x19fb11[_0x2613('0x2b')],'unmanaged':_0x19fb11[_0x2613('0x2c')],'waiting':_0x19fb11['waiting'],'loggedInDb':_0x19fb11[_0x2613('0x2d')]};if(_0x19fb11[_0x2613('0x2b')]===_0x2613('0x2e')){_0xf81db[_0x2613('0x2f')]=_0x19fb11[_0x2613('0x2f')];_0xf81db[_0x2613('0x30')]=_0x19fb11['dialMethod'];_0xf81db[_0x2613('0x31')]=_0x19fb11['dialOriginateCallerIdName'];_0xf81db[_0x2613('0x32')]=_0x19fb11['dialOriginateCallerIdNumber'];_0xf81db[_0x2613('0x33')]=_0x19fb11['dialOriginateTimeout'];_0xf81db[_0x2613('0x34')]=_0x19fb11[_0x2613('0x34')];_0xf81db[_0x2613('0x35')]=_0x19fb11[_0x2613('0x35')];_0xf81db[_0x2613('0x36')]=_0x19fb11['outboundAnswerCallsDay'];_0xf81db[_0x2613('0x37')]=_0x19fb11[_0x2613('0x37')];_0xf81db[_0x2613('0x38')]=_0x19fb11['outboundBusyCallsDay'];_0xf81db['outboundCongestionCallsDay']=_0x19fb11[_0x2613('0x39')];_0xf81db[_0x2613('0x3a')]=_0x19fb11[_0x2613('0x3a')];_0xf81db[_0x2613('0x3b')]=_0x19fb11[_0x2613('0x3b')];_0xf81db[_0x2613('0x3c')]=_0x19fb11['outboundDropCallsDayTimeout'];_0xf81db['outboundNoAnswerCallsDay']=_0x19fb11[_0x2613('0x3d')];_0xf81db['outboundNoSuchCallsDay']=_0x19fb11['outboundNoSuchCallsDay'];_0xf81db[_0x2613('0x3e')]=_0x19fb11[_0x2613('0x3e')];_0xf81db['outboundReCallsDay']=_0x19fb11[_0x2613('0x3f')];_0xf81db['outboundRejectCallsDay']=_0x19fb11[_0x2613('0x40')];_0xf81db[_0x2613('0x41')]=_0x19fb11['outboundUnknownCallsDay'];_0xf81db['predictiveIntervalAnsweredCalls']=_0x19fb11['predictiveIntervalAnsweredCalls'];_0xf81db[_0x2613('0x42')]=_0x19fb11[_0x2613('0x42')];_0xf81db[_0x2613('0x43')]=_0x19fb11['predictiveIntervalAvgTalktime'];_0xf81db[_0x2613('0x44')]=_0x19fb11[_0x2613('0x44')];_0xf81db[_0x2613('0x45')]=_0x19fb11[_0x2613('0x45')];_0xf81db[_0x2613('0x46')]=_0x19fb11['predictiveIntervalErlangCalls'];_0xf81db['predictiveIntervalErlangCallsDroppedCalls']=_0x19fb11[_0x2613('0x47')];_0xf81db[_0x2613('0x48')]=_0x19fb11[_0x2613('0x48')];_0xf81db['predictiveIntervalLowerLimit']=_0x19fb11['predictiveIntervalLowerLimit'];_0xf81db[_0x2613('0x49')]=_0x19fb11[_0x2613('0x49')];_0xf81db[_0x2613('0x4a')]=_0x19fb11['predictiveIntervalPauses'];_0xf81db['predictiveIntervalTotalCalls']=_0x19fb11['predictiveIntervalTotalCalls'];_0xf81db[_0x2613('0x1b')]=_0x19fb11[_0x2613('0x1b')];_0xf81db[_0x2613('0x4b')]=_0x19fb11[_0x2613('0x4b')];}if(_0x19fb11[_0x2613('0x4c')]){_0xf81db[_0x2613('0x4c')]={'id':_0x19fb11[_0x2613('0x4c')]['id'],'name':_0x19fb11[_0x2613('0x4c')][_0x2613('0xa')],'active':_0x19fb11[_0x2613('0x4c')][_0x2613('0x4d')],'callerid':_0x19fb11[_0x2613('0x4c')][_0x2613('0x4e')]};}if(_0x19fb11['Interval']){_0xf81db[_0x2613('0x4f')]={'id':_0x19fb11['Interval']['id'],'name':_0x19fb11[_0x2613('0x4f')][_0x2613('0xa')]};}_0x16a222[_0x2613('0x50')](_0xf81db);}}_0x28e206({'count':_0x16a222['length'],'rows':_0x16a222});});},'VoiceChannels':function(_0x4c14b8){return new Promise(function(_0x2e4038,_0x158b39){var _0x728ff8=_[_0x2613('0x51')](_0x8d00d8[_0x2613('0x52')]);_0x2e4038({'count':_0x728ff8['length'],'rows':_0x728ff8});});},'VoiceChannelMixMonitor':function(_0x5b0006){var _0x4fdf35=this;return new Promise(function(_0x2a851c,_0x3e4761){if(ami[_0x2613('0x11')]()==![]){return _0x3e4761(_0x4fdf35[_0x2613('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x2613('0x13')]['username'],_0x2613('0x14')]['join']('\x20')));}var _0x54cd21=schema(properties[_0x2613('0x53')])[_0x2613('0x3')](_0x5b0006);if(_0x54cd21[_0x2613('0x54')]>0x0){return _0x3e4761(_0x4fdf35[_0x2613('0x12')](0x1f4,_[_0x2613('0x55')](_0x54cd21,_0x2613('0x1b'))[_0x2613('0x15')](',\x20')));}var _0x3daa46=_['find'](_0x8d00d8[_0x2613('0x52')],{'uniqueid':_0x5b0006['uniqueid']});if(_0x3daa46&&_0x3daa46['channel']){var _0x1b0069=util[_0x2613('0x8')]('%s.%s',_0x5b0006[_0x2613('0x56')]||_0x5b0006[_0x2613('0x57')],_0x5b0006['format']||_0x2613('0x58'));return ami[_0x2613('0x59')]({'action':'MixMonitor','channel':_0x3daa46[_0x2613('0x5a')],'file':_0x1b0069,'options':'ai(mixmonitorid)'})[_0x2613('0x1a')](function(_0x3d4b20){var _0x2481da=_['find'](_0x3daa46[_0x2613('0x5b')],{'filename':'/var/spool/asterisk/monitor/'+_0x1b0069[_0x2613('0x5c')]()});if(_['isNil'](_0x2481da)){_0x3daa46[_0x2613('0x5b')][_0x2613('0x50')]({'filename':'/var/spool/asterisk/monitor/'+_0x1b0069[_0x2613('0x5c')](),'createdAt':moment()[_0x2613('0x8')](_0x2613('0x5d')),'mixmonitorid':_0x3d4b20[_0x2613('0x5e')],'status':_0x2613('0x5f')});}else{_0x2481da[_0x2613('0x5e')]=_0x3d4b20['mixmonitorid'];_0x2481da[_0x2613('0x60')]=_0x2613('0x5f');}_0x2a851c({'code':0xc8,'message':[_0x5b0006[_0x2613('0x57')],_0x2613('0x61'),_0x3d4b20[_0x2613('0x5e')]]['join']('\x20'),'mixmonitorid':_0x3d4b20[_0x2613('0x5e')]});})[_0x2613('0x1c')](function(_0x1cb3a3){_0x3e4761(_0x4fdf35[_0x2613('0x12')](0x1f5,[_0x5b0006['uniqueid'],_0x1cb3a3[_0x2613('0x1b')]['toLowerCase']()][_0x2613('0x15')]('\x20')));});}else{return _0x3e4761(_0x4fdf35[_0x2613('0x12')](0x1f5,_0x2613('0x62')));}});},'VoiceChannelStopMixMonitor':function(_0x5d2cc4){var _0x451d90=this;return new Promise(function(_0x59462a,_0x590592){if(ami['isConnected']()==![]){return _0x590592(_0x451d90[_0x2613('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x2613('0x14')][_0x2613('0x15')]('\x20')));}var _0xbea153=schema(properties[_0x2613('0x53')])[_0x2613('0x3')](_0x5d2cc4);if(_0xbea153[_0x2613('0x54')]>0x0){return _0x590592(_0x451d90['error'](0x1f4,_[_0x2613('0x55')](_0xbea153,_0x2613('0x1b'))[_0x2613('0x15')](',\x20')));}var _0x170432=_[_0x2613('0x63')](_0x8d00d8[_0x2613('0x52')],{'uniqueid':_0x5d2cc4[_0x2613('0x57')]});if(_0x170432){return BPromise[_0x2613('0x64')]()['then'](function(){if(_0x170432[_0x2613('0x5a')]){return ami[_0x2613('0x59')]({'action':_0x2613('0x65'),'channel':_0x170432[_0x2613('0x5a')],'mixmonitorid':_0x5d2cc4[_0x2613('0x5e')]})[_0x2613('0x1c')](function(_0x28e9ce){});}})['then'](function(){if(_0x170432[_0x2613('0x66')]){return ami[_0x2613('0x59')]({'action':'StopMixMonitor','channel':_0x170432[_0x2613('0x66')],'mixmonitorid':_0x5d2cc4['mixmonitorid']})[_0x2613('0x1c')](function(_0x2c81f5){});}})[_0x2613('0x1a')](function(_0x5df758){var _0x29786f=_[_0x2613('0x63')](_0x170432[_0x2613('0x5b')],{'mixmonitorid':_0x5d2cc4[_0x2613('0x5e')]});if(_0x29786f){_0x29786f[_0x2613('0x60')]=_0x2613('0x67');}})['then'](function(){var _0x33acb4=util[_0x2613('0x8')](_0x2613('0x68'),_0x5d2cc4[_0x2613('0x56')]||_0x5d2cc4[_0x2613('0x57')],_0x5d2cc4[_0x2613('0x8')]||_0x2613('0x58'));var _0x17b66c=_[_0x2613('0x63')](_0x170432[_0x2613('0x5b')],{'filename':_0x2613('0x69')+_0x33acb4['toLowerCase']()});if(_0x17b66c){_0x17b66c['status']=_0x2613('0x67');}})['then'](function(){_0x59462a({'code':0xc8,'message':[_0x5d2cc4['uniqueid'],'StopMixMonitor\x20Success'][_0x2613('0x15')]('\x20')});})[_0x2613('0x1c')](function(_0x17ec77){_0x590592(_0x451d90[_0x2613('0x12')](0x1f5,[_0x5d2cc4[_0x2613('0x57')],_0x17ec77[_0x2613('0x1b')]['toLowerCase']()][_0x2613('0x15')]('\x20')));});}else{return _0x590592(_0x451d90[_0x2613('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x24f2c4){return new Promise(function(_0x50c32a,_0x191262){var _0x550ac1=_[_0x2613('0x51')](_0x8d00d8[_0x2613('0x6a')]);_0x50c32a({'count':_0x550ac1[_0x2613('0x54')],'rows':_0x550ac1});});},'VoiceQueuesChannel':function(_0x464382){var _0xd14604=this;return new Promise(function(_0x169545,_0x460bf1){var _0x40f636=schema(properties[_0x2613('0x6b')])[_0x2613('0x3')](_0x464382);if(_0x40f636[_0x2613('0x54')]>0x0){return _0x460bf1(_0xd14604[_0x2613('0x12')](0x1f4,_[_0x2613('0x55')](_0x40f636,_0x2613('0x1b'))['join'](',\x20')));}var _0x23e8bd=_['find'](_0x8d00d8['queueChannels'],{'uniqueid':_0x464382[_0x2613('0x57')]});if(_0x23e8bd){_0x169545(_0x23e8bd);}else{return _0x460bf1(_0xd14604[_0x2613('0x12')](0x1f5,_0x2613('0x62')));}});},'VoiceQueuesChannelHangup':function(_0x32afa7){var _0xfef9b7=this;return new Promise(function(_0x3925f8,_0xee9d43){if(ami[_0x2613('0x11')]()==![]){return _0xee9d43(_0xfef9b7[_0x2613('0x12')](0x1f4,[config[_0x2613('0x13')]['ip'],config[_0x2613('0x13')]['username'],_0x2613('0x14')][_0x2613('0x15')]('\x20')));}var _0x534bf3=schema(properties[_0x2613('0x6c')])[_0x2613('0x3')](_0x32afa7);if(_0x534bf3[_0x2613('0x54')]>0x0){return _0xee9d43(_0xfef9b7['error'](0x1f4,_[_0x2613('0x55')](_0x534bf3,_0x2613('0x1b'))[_0x2613('0x15')](',\x20')));}var _0x417114=_[_0x2613('0x63')](_0x8d00d8[_0x2613('0x6a')],{'uniqueid':_0x32afa7['uniqueid']});if(_0x417114&&_0x417114[_0x2613('0x5a')]){return ami['Action']({'action':_0x2613('0x6d'),'channel':_0x417114[_0x2613('0x5a')]})[_0x2613('0x1a')](function(_0x553da2){_0x3925f8({'code':0xc8,'message':[_0x32afa7[_0x2613('0x57')],_0x553da2[_0x2613('0x1b')][_0x2613('0x5c')]()][_0x2613('0x15')]('\x20')});})['catch'](function(_0x599e52){_0xee9d43(_0xfef9b7[_0x2613('0x12')](0x1f5,[_0x32afa7[_0x2613('0x57')],_0x599e52[_0x2613('0x1b')][_0x2613('0x5c')]()]['join']('\x20')));});}else{return _0xee9d43(_0xfef9b7[_0x2613('0x12')](0x1f5,_0x2613('0x62')));}});},'VoiceQueuesChannelRedirect':function(_0x4774c1){var _0x490ee2=this;return new Promise(function(_0x926518,_0x76e211){if(ami[_0x2613('0x11')]()==![]){return _0x76e211(_0x490ee2[_0x2613('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x2613('0x13')]['username'],'ami\x20disconnected'][_0x2613('0x15')]('\x20')));}var _0x5505fd=schema(properties[_0x2613('0x6e')])[_0x2613('0x3')](_0x4774c1);if(_0x5505fd[_0x2613('0x54')]>0x0){return _0x76e211(_0x490ee2[_0x2613('0x12')](0x1f4,_['map'](_0x5505fd,_0x2613('0x1b'))[_0x2613('0x15')](',\x20')));}var _0x7aef1a=_[_0x2613('0x63')](_0x8d00d8[_0x2613('0x6a')],{'uniqueid':_0x4774c1[_0x2613('0x57')]});if(_0x7aef1a&&_0x7aef1a[_0x2613('0x5a')]){return ami[_0x2613('0x59')]({'action':_0x2613('0x6f'),'channel':_0x7aef1a[_0x2613('0x5a')],'exten':_0x4774c1[_0x2613('0x70')],'context':_0x4774c1['context']||_0x7aef1a[_0x2613('0x71')],'priority':0x1})[_0x2613('0x1a')](function(_0xb886db){_0x926518({'code':0xc8,'message':[_0x4774c1['uniqueid'],_0xb886db[_0x2613('0x1b')]['toLowerCase']()]['join']('\x20')});})[_0x2613('0x1c')](function(_0x179e82){_0x76e211(_0x490ee2[_0x2613('0x12')](0x1f5,[_0x4774c1['uniqueid'],_0x179e82[_0x2613('0x1b')]['toLowerCase']()][_0x2613('0x15')]('\x20')));});}else{return _0x76e211(_0x490ee2['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x26f685){return new Promise(function(_0x580ed6,_0x4c1db9){var _0x51ae37=_[_0x2613('0x51')](_0x8d00d8['agents']);_0x580ed6({'count':_0x51ae37[_0x2613('0x54')],'rows':_0x51ae37});});},'Telephones':function(_0x511877){return new Promise(function(_0x41ec02,_0x12e5c2){var _0x4856f4=_[_0x2613('0x51')](_0x8d00d8[_0x2613('0x72')]);_0x41ec02({'count':_0x4856f4['length'],'rows':_0x4856f4});});},'Trunks':function(_0x8a47c6){return new Promise(function(_0x483c4c,_0x4454c2){var _0x432cb2=_['values'](_0x8d00d8['trunks']);_0x483c4c({'count':_0x432cb2[_0x2613('0x54')],'rows':_0x432cb2});});},'OutboundChannels':function(_0x308579){return new Promise(function(_0x45a8a9,_0x5354a3){var _0x450f34=_[_0x2613('0x51')](_0x8d00d8['outboundChannels']);_0x45a8a9({'count':_0x450f34[_0x2613('0x54')],'rows':_0x450f34});});},'Outbound':function(_0x59bcb1){return new Promise(function(_0x15e422,_0x179a41){_0x15e422(_0x8d00d8[_0x2613('0x2e')]);});},'Campaigns':function(_0x344a0c){return new Promise(function(_0x274518,_0x32f0ee){var _0x1af72c=_[_0x2613('0x51')](_0x8d00d8[_0x2613('0x73')]);_0x274518({'count':_0x1af72c[_0x2613('0x54')],'rows':_0x1af72c});});},'VoiceQueuesPreview':function(_0x502f8f){var _0x28d9c8=this;return new Promise(function(_0x5f433b,_0x1898b8){_0x4b96c6['run'](_0x502f8f['id'])[_0x2613('0x1a')](function(_0x407e78){_0x5f433b({'code':0xc8,'message':_0x407e78['message']});})['catch'](function(_0x58d6d6){_0x1898b8(_0x28d9c8[_0x2613('0x12')](0x1f4,_0x58d6d6['message']));});});},'EventManager':function(_0x29768b){var _0x2f53a6=this;return new Promise(function(_0x8503b9,_0x3a764c){if(!_0x29768b['event']){return _0x3a764c(_0x2f53a6[_0x2613('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x2613('0x74')+_0x29768b['event'],_0x29768b[_0x2613('0x1b')]);_0x8503b9({'code':0xc8,'message':_0x29768b});});},'FaxAccounts':function(_0x12458b){return new Promise(function(_0xb23b88,_0x11e851){var _0x2b5169=_[_0x2613('0x51')](_0x8d00d8[_0x2613('0x75')]);_0xb23b88({'count':_0x2b5169['length'],'rows':_0x2b5169});});},'SendFax':function(_0x3bb7f0){var _0x1b2ff3=this;return new Promise(function(_0x13454b,_0xdfc5bc){_0x59240d[_0x2613('0x76')](_0x3bb7f0)['then'](function(_0x238a5f){_0x13454b({'code':0xc8,'message':_0x238a5f['message']});})[_0x2613('0x1c')](function(_0x2c9042){_0xdfc5bc(_0x1b2ff3[_0x2613('0x12')](0x1f4,_0x2c9042[_0x2613('0x1b')]));});});},'CheckAfterSend':function(_0x1e1933){var _0x5130c1=this;return new Promise(function(_0x1b0bae,_0x9a66cd){_0x59240d['checkAfterSend'](_0x1e1933)[_0x2613('0x1a')](function(_0x26105e){_0x1b0bae({'code':0xc8,'message':_0x26105e[_0x2613('0x1b')]});})['catch'](function(_0x398872){_0x9a66cd(_0x5130c1[_0x2613('0x12')](0x1f4,_0x398872['message']));});});}};var _0x4d37c5=jayson[_0x2613('0x77')](_0x369931)[_0x2613('0x78')]();_0x4d37c5['on']('error',function(_0x51e0ad){return _0x309663(_0x51e0ad);});_0x4d37c5['listen'](0x232a,'127.0.0.1',function(){console['log'](_0x2613('0x79'),0x232a);return _0x30cac4(_0x2613('0x7a')+0x232a);});});}; \ No newline at end of file +var _0xa6b0=['filename','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','moment','../../../config/environment','../ami','listen','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','catch','command','Command','Action','content','voiceQueues','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','Trunk','Interval','push','values','length','voicechannel','validate','find','channels','uniqueid','channel','%s.%s'];(function(_0x14f7ac,_0x3a3a72){var _0x4afc9a=function(_0x1a8465){while(--_0x1a8465){_0x14f7ac['push'](_0x14f7ac['shift']());}};_0x4afc9a(++_0x3a3a72);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x59be96,_0x396461){_0x59be96=_0x59be96-0x0;var _0x1a9ca9=_0xa6b0[_0x59be96];return _0x1a9ca9;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x0a6b('0x2'));var moment=require(_0x0a6b('0x3'));var config=require(_0x0a6b('0x4'));var properties=require('../properties');var ami=require(_0x0a6b('0x5'));exports[_0x0a6b('0x6')]=function(_0x195697,_0xc7140c,_0x3dc2b0){return new BPromise(function(_0x3b6967,_0x1b5fb5){var _0xa908dd={'QueuePause':function(_0x26f761){return new Promise(function(_0x340a33,_0x8e89f){var _0xdcc3e5=util['format']('%s/%s',_0x0a6b('0x7'),_0x26f761[_0x0a6b('0x8')]);if(_0x195697[_0x0a6b('0x9')]&&_0x195697[_0x0a6b('0x9')][_0xdcc3e5]&&_0x195697[_0x0a6b('0x9')][_0xdcc3e5][_0x0a6b('0xa')]){_0x195697[_0x0a6b('0x9')][_0xdcc3e5][_0x0a6b('0xb')]();}if(_0x195697[_0x0a6b('0xc')][_0xdcc3e5]){_0x195697[_0x0a6b('0xc')][_0xdcc3e5][_0x0a6b('0xd')]({'statePause':_0x26f761[_0x0a6b('0xe')]?!![]:![]});}_0x340a33({'code':0xc8,'message':_0x0a6b('0xf')});});},'Reload':function(_0x3cd9a4){var _0x592872=this;return new Promise(function(_0x5e59a5,_0x9afc84){if(ami[_0x0a6b('0x10')]()==![]){return _0x9afc84(_0x592872[_0x0a6b('0x11')](0x1f4,[config[_0x0a6b('0x12')]['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],_0x0a6b('0x14')][_0x0a6b('0x15')]('\x20')));}_0x3cd9a4=_[_0x0a6b('0x16')](_0x3cd9a4,_[_0x0a6b('0x17')](properties['module']));_0x3cd9a4[_0x0a6b('0x18')]=_0x0a6b('0x19');return ami['Action'](_0x3cd9a4)[_0x0a6b('0x1a')](function(_0x4d0e3b){_0x5e59a5({'code':0xc8,'message':_0x4d0e3b[_0x0a6b('0x1b')]});})[_0x0a6b('0x1c')](function(_0x2cb10b){_0x9afc84(_0x592872[_0x0a6b('0x11')](0x1f5,_0x2cb10b['message']));});});},'Command':function(_0x33c278){var _0x296162=this;return new Promise(function(_0x4aadfe,_0x19848c){if(ami[_0x0a6b('0x10')]()==![]){return _0x19848c(_0x296162[_0x0a6b('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],_0x0a6b('0x14')]['join']('\x20')));}_0x33c278=_[_0x0a6b('0x16')](_0x33c278,_0x0a6b('0x1d'));_0x33c278[_0x0a6b('0x18')]=_0x0a6b('0x1e');return ami[_0x0a6b('0x1f')](_0x33c278)['then'](function(_0x1e5065){_0x4aadfe({'code':0xc8,'message':_0x1e5065[_0x0a6b('0x20')]});})[_0x0a6b('0x1c')](function(_0x5c77fb){_0x19848c(_0x296162[_0x0a6b('0x11')](0x1f5,_0x5c77fb[_0x0a6b('0x1b')]));});});},'VoiceQueues':function(_0x1bbb0f){return new Promise(function(_0x1b8b78,_0x3b12a2){var _0x5b2229=[];for(var _0x3e6a1d in _0x195697[_0x0a6b('0x21')]){if(_0x195697[_0x0a6b('0x21')]['hasOwnProperty'](_0x3e6a1d)){var _0x3a9092=_0x195697['voiceQueues'][_0x3e6a1d];var _0xecbf0c={'id':_0x3a9092['id'],'name':_0x3a9092[_0x0a6b('0x8')],'strategy':_0x3a9092[_0x0a6b('0x22')],'answered':_0x3a9092['answered'],'available':_0x3a9092['available'],'loggedIn':_0x3a9092[_0x0a6b('0x23')],'pTalking':_0x3a9092[_0x0a6b('0x24')],'sumBillable':_0x3a9092[_0x0a6b('0x25')],'sumDuration':_0x3a9092[_0x0a6b('0x26')],'sumHoldTime':_0x3a9092[_0x0a6b('0x27')]||0x0,'talking':_0x3a9092[_0x0a6b('0x28')],'total':_0x3a9092['total'],'type':_0x3a9092[_0x0a6b('0x29')],'unmanaged':_0x3a9092[_0x0a6b('0x2a')],'waiting':_0x3a9092['waiting'],'loggedInDb':_0x3a9092[_0x0a6b('0x2b')]};if(_0x3a9092['type']==='outbound'){_0xecbf0c[_0x0a6b('0x2c')]=_0x3a9092[_0x0a6b('0x2c')];_0xecbf0c[_0x0a6b('0x2d')]=_0x3a9092[_0x0a6b('0x2d')];_0xecbf0c[_0x0a6b('0x2e')]=_0x3a9092['dialOriginateCallerIdName'];_0xecbf0c['dialOriginateCallerIdNumber']=_0x3a9092[_0x0a6b('0x2f')];_0xecbf0c[_0x0a6b('0x30')]=_0x3a9092[_0x0a6b('0x30')];_0xecbf0c[_0x0a6b('0x31')]=_0x3a9092['dialPrefix'];_0xecbf0c[_0x0a6b('0x32')]=_0x3a9092[_0x0a6b('0x32')];_0xecbf0c['outboundAnswerCallsDay']=_0x3a9092['outboundAnswerCallsDay'];_0xecbf0c[_0x0a6b('0x33')]=_0x3a9092[_0x0a6b('0x33')];_0xecbf0c['outboundBusyCallsDay']=_0x3a9092[_0x0a6b('0x34')];_0xecbf0c[_0x0a6b('0x35')]=_0x3a9092[_0x0a6b('0x35')];_0xecbf0c[_0x0a6b('0x36')]=_0x3a9092[_0x0a6b('0x36')];_0xecbf0c[_0x0a6b('0x37')]=_0x3a9092[_0x0a6b('0x37')];_0xecbf0c[_0x0a6b('0x38')]=_0x3a9092[_0x0a6b('0x38')];_0xecbf0c[_0x0a6b('0x39')]=_0x3a9092[_0x0a6b('0x39')];_0xecbf0c[_0x0a6b('0x3a')]=_0x3a9092['outboundNoSuchCallsDay'];_0xecbf0c[_0x0a6b('0x3b')]=_0x3a9092[_0x0a6b('0x3b')];_0xecbf0c['outboundReCallsDay']=_0x3a9092[_0x0a6b('0x3c')];_0xecbf0c[_0x0a6b('0x3d')]=_0x3a9092[_0x0a6b('0x3d')];_0xecbf0c[_0x0a6b('0x3e')]=_0x3a9092[_0x0a6b('0x3e')];_0xecbf0c[_0x0a6b('0x3f')]=_0x3a9092[_0x0a6b('0x3f')];_0xecbf0c[_0x0a6b('0x40')]=_0x3a9092[_0x0a6b('0x40')];_0xecbf0c['predictiveIntervalAvgTalktime']=_0x3a9092[_0x0a6b('0x41')];_0xecbf0c[_0x0a6b('0x42')]=_0x3a9092[_0x0a6b('0x42')];_0xecbf0c[_0x0a6b('0x43')]=_0x3a9092[_0x0a6b('0x43')];_0xecbf0c[_0x0a6b('0x44')]=_0x3a9092[_0x0a6b('0x44')];_0xecbf0c[_0x0a6b('0x45')]=_0x3a9092[_0x0a6b('0x45')];_0xecbf0c['predictiveIntervalHitRate']=_0x3a9092[_0x0a6b('0x46')];_0xecbf0c[_0x0a6b('0x47')]=_0x3a9092[_0x0a6b('0x47')];_0xecbf0c[_0x0a6b('0x48')]=_0x3a9092[_0x0a6b('0x48')];_0xecbf0c[_0x0a6b('0x49')]=_0x3a9092[_0x0a6b('0x49')];_0xecbf0c[_0x0a6b('0x4a')]=_0x3a9092[_0x0a6b('0x4a')];_0xecbf0c['message']=_0x3a9092[_0x0a6b('0x1b')];_0xecbf0c['originated']=_0x3a9092['originated'];}if(_0x3a9092[_0x0a6b('0x4b')]){_0xecbf0c['Trunk']={'id':_0x3a9092['Trunk']['id'],'name':_0x3a9092[_0x0a6b('0x4b')][_0x0a6b('0x8')],'active':_0x3a9092[_0x0a6b('0x4b')]['active'],'callerid':_0x3a9092[_0x0a6b('0x4b')]['callerid']};}if(_0x3a9092['Interval']){_0xecbf0c[_0x0a6b('0x4c')]={'id':_0x3a9092['Interval']['id'],'name':_0x3a9092[_0x0a6b('0x4c')]['name']};}_0x5b2229[_0x0a6b('0x4d')](_0xecbf0c);}}_0x1b8b78({'count':_0x5b2229['length'],'rows':_0x5b2229});});},'VoiceChannels':function(_0x498592){return new Promise(function(_0x3593bd,_0x113e49){var _0x2b937c=_[_0x0a6b('0x4e')](_0x195697['channels']);_0x3593bd({'count':_0x2b937c[_0x0a6b('0x4f')],'rows':_0x2b937c});});},'VoiceChannelMixMonitor':function(_0xf92e0f){var _0x202748=this;return new Promise(function(_0x15beea,_0xa83e2b){if(ami[_0x0a6b('0x10')]()==![]){return _0xa83e2b(_0x202748[_0x0a6b('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],_0x0a6b('0x14')][_0x0a6b('0x15')]('\x20')));}var _0x1ca269=schema(properties[_0x0a6b('0x50')])[_0x0a6b('0x51')](_0xf92e0f);if(_0x1ca269[_0x0a6b('0x4f')]>0x0){return _0xa83e2b(_0x202748[_0x0a6b('0x11')](0x1f4,_['map'](_0x1ca269,_0x0a6b('0x1b'))[_0x0a6b('0x15')](',\x20')));}var _0x2f4ddf=_[_0x0a6b('0x52')](_0x195697[_0x0a6b('0x53')],{'uniqueid':_0xf92e0f[_0x0a6b('0x54')]});if(_0x2f4ddf&&_0x2f4ddf[_0x0a6b('0x55')]){var _0x5d2631=util['format'](_0x0a6b('0x56'),_0xf92e0f[_0x0a6b('0x57')]||_0xf92e0f[_0x0a6b('0x54')],_0xf92e0f[_0x0a6b('0x58')]||_0x0a6b('0x59'));return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x5a'),'channel':_0x2f4ddf[_0x0a6b('0x55')],'file':_0x5d2631,'options':_0x0a6b('0x5b')})['then'](function(_0x2eee7f){var _0x2118f4=_[_0x0a6b('0x52')](_0x2f4ddf[_0x0a6b('0x5c')],{'filename':_0x0a6b('0x5d')+_0x5d2631['toLowerCase']()});if(_[_0x0a6b('0x5e')](_0x2118f4)){_0x2f4ddf[_0x0a6b('0x5c')][_0x0a6b('0x4d')]({'filename':_0x0a6b('0x5d')+_0x5d2631[_0x0a6b('0x5f')](),'createdAt':moment()[_0x0a6b('0x58')](_0x0a6b('0x60')),'mixmonitorid':_0x2eee7f[_0x0a6b('0x61')],'status':_0x0a6b('0x62')});}else{_0x2118f4[_0x0a6b('0x61')]=_0x2eee7f['mixmonitorid'];_0x2118f4['status']=_0x0a6b('0x62');}_0x15beea({'code':0xc8,'message':[_0xf92e0f['uniqueid'],_0x0a6b('0x63'),_0x2eee7f['mixmonitorid']][_0x0a6b('0x15')]('\x20'),'mixmonitorid':_0x2eee7f[_0x0a6b('0x61')]});})[_0x0a6b('0x1c')](function(_0x58971d){_0xa83e2b(_0x202748[_0x0a6b('0x11')](0x1f5,[_0xf92e0f[_0x0a6b('0x54')],_0x58971d['message'][_0x0a6b('0x5f')]()]['join']('\x20')));});}else{return _0xa83e2b(_0x202748[_0x0a6b('0x11')](0x1f5,_0x0a6b('0x64')));}});},'VoiceChannelStopMixMonitor':function(_0x4c6424){var _0x37bc1a=this;return new Promise(function(_0x52d4e5,_0x236bbf){if(ami[_0x0a6b('0x10')]()==![]){return _0x236bbf(_0x37bc1a[_0x0a6b('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],_0x0a6b('0x14')][_0x0a6b('0x15')]('\x20')));}var _0x1ad7a9=schema(properties[_0x0a6b('0x50')])['validate'](_0x4c6424);if(_0x1ad7a9['length']>0x0){return _0x236bbf(_0x37bc1a['error'](0x1f4,_[_0x0a6b('0x65')](_0x1ad7a9,'message')[_0x0a6b('0x15')](',\x20')));}var _0x34e4da=_['find'](_0x195697['channels'],{'uniqueid':_0x4c6424['uniqueid']});if(_0x34e4da){return BPromise[_0x0a6b('0x66')]()[_0x0a6b('0x1a')](function(){if(_0x34e4da['channel']){return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x67'),'channel':_0x34e4da[_0x0a6b('0x55')],'mixmonitorid':_0x4c6424[_0x0a6b('0x61')]})[_0x0a6b('0x1c')](function(_0x5f0efe){});}})['then'](function(){if(_0x34e4da['destinationchannel']){return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x67'),'channel':_0x34e4da['destinationchannel'],'mixmonitorid':_0x4c6424[_0x0a6b('0x61')]})['catch'](function(_0x3457d2){});}})[_0x0a6b('0x1a')](function(_0xa8b509){var _0x2dbd49=_[_0x0a6b('0x52')](_0x34e4da['monitors'],{'mixmonitorid':_0x4c6424[_0x0a6b('0x61')]});if(_0x2dbd49){_0x2dbd49[_0x0a6b('0x68')]=_0x0a6b('0x69');}})[_0x0a6b('0x1a')](function(){var _0x4e5af0=util[_0x0a6b('0x58')](_0x0a6b('0x56'),_0x4c6424[_0x0a6b('0x57')]||_0x4c6424[_0x0a6b('0x54')],_0x4c6424[_0x0a6b('0x58')]||'wav');var _0xcb7f2e=_[_0x0a6b('0x52')](_0x34e4da[_0x0a6b('0x5c')],{'filename':_0x0a6b('0x5d')+_0x4e5af0[_0x0a6b('0x5f')]()});if(_0xcb7f2e){_0xcb7f2e[_0x0a6b('0x68')]=_0x0a6b('0x69');}})[_0x0a6b('0x1a')](function(){_0x52d4e5({'code':0xc8,'message':[_0x4c6424['uniqueid'],_0x0a6b('0x6a')][_0x0a6b('0x15')]('\x20')});})[_0x0a6b('0x1c')](function(_0x1048ac){_0x236bbf(_0x37bc1a['error'](0x1f5,[_0x4c6424[_0x0a6b('0x54')],_0x1048ac[_0x0a6b('0x1b')][_0x0a6b('0x5f')]()][_0x0a6b('0x15')]('\x20')));});}else{return _0x236bbf(_0x37bc1a[_0x0a6b('0x11')](0x1f5,_0x0a6b('0x64')));}});},'VoiceQueuesChannels':function(_0x3db026){return new Promise(function(_0x45f990,_0x3c78bd){var _0x13f6ce=_[_0x0a6b('0x4e')](_0x195697[_0x0a6b('0x6b')]);_0x45f990({'count':_0x13f6ce[_0x0a6b('0x4f')],'rows':_0x13f6ce});});},'VoiceQueuesChannel':function(_0x17a42e){var _0x1408fd=this;return new Promise(function(_0x495450,_0x55b386){var _0x3703c3=schema(properties[_0x0a6b('0x6c')])['validate'](_0x17a42e);if(_0x3703c3[_0x0a6b('0x4f')]>0x0){return _0x55b386(_0x1408fd[_0x0a6b('0x11')](0x1f4,_[_0x0a6b('0x65')](_0x3703c3,_0x0a6b('0x1b'))[_0x0a6b('0x15')](',\x20')));}var _0x41de0b=_[_0x0a6b('0x52')](_0x195697[_0x0a6b('0x6b')],{'uniqueid':_0x17a42e[_0x0a6b('0x54')]});if(_0x41de0b){_0x495450(_0x41de0b);}else{return _0x55b386(_0x1408fd[_0x0a6b('0x11')](0x1f5,_0x0a6b('0x64')));}});},'VoiceQueuesChannelHangup':function(_0x4b86cd){var _0x3b6b10=this;return new Promise(function(_0x5430eb,_0xd05912){if(ami[_0x0a6b('0x10')]()==![]){return _0xd05912(_0x3b6b10[_0x0a6b('0x11')](0x1f4,[config[_0x0a6b('0x12')]['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],_0x0a6b('0x14')]['join']('\x20')));}var _0x2137a5=schema(properties[_0x0a6b('0x6d')])[_0x0a6b('0x51')](_0x4b86cd);if(_0x2137a5[_0x0a6b('0x4f')]>0x0){return _0xd05912(_0x3b6b10[_0x0a6b('0x11')](0x1f4,_['map'](_0x2137a5,_0x0a6b('0x1b'))['join'](',\x20')));}var _0x51b6f1=_[_0x0a6b('0x52')](_0x195697[_0x0a6b('0x6b')],{'uniqueid':_0x4b86cd[_0x0a6b('0x54')]});if(_0x51b6f1&&_0x51b6f1[_0x0a6b('0x55')]){return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x6e'),'channel':_0x51b6f1[_0x0a6b('0x55')]})[_0x0a6b('0x1a')](function(_0x1c00ab){_0x5430eb({'code':0xc8,'message':[_0x4b86cd[_0x0a6b('0x54')],_0x1c00ab[_0x0a6b('0x1b')][_0x0a6b('0x5f')]()]['join']('\x20')});})[_0x0a6b('0x1c')](function(_0x245389){_0xd05912(_0x3b6b10[_0x0a6b('0x11')](0x1f5,[_0x4b86cd[_0x0a6b('0x54')],_0x245389['message'][_0x0a6b('0x5f')]()]['join']('\x20')));});}else{return _0xd05912(_0x3b6b10[_0x0a6b('0x11')](0x1f5,_0x0a6b('0x64')));}});},'VoiceQueuesChannelRedirect':function(_0x48b991){var _0x496de9=this;return new Promise(function(_0x3af01c,_0x4da8c2){if(ami[_0x0a6b('0x10')]()==![]){return _0x4da8c2(_0x496de9['error'](0x1f4,[config[_0x0a6b('0x12')]['ip'],config['asterisk'][_0x0a6b('0x13')],_0x0a6b('0x14')]['join']('\x20')));}var _0x4ffe36=schema(properties[_0x0a6b('0x6f')])[_0x0a6b('0x51')](_0x48b991);if(_0x4ffe36[_0x0a6b('0x4f')]>0x0){return _0x4da8c2(_0x496de9[_0x0a6b('0x11')](0x1f4,_['map'](_0x4ffe36,_0x0a6b('0x1b'))['join'](',\x20')));}var _0x4541b5=_[_0x0a6b('0x52')](_0x195697[_0x0a6b('0x6b')],{'uniqueid':_0x48b991[_0x0a6b('0x54')]});if(_0x4541b5&&_0x4541b5[_0x0a6b('0x55')]){return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x70'),'channel':_0x4541b5[_0x0a6b('0x55')],'exten':_0x48b991['exten'],'context':_0x48b991[_0x0a6b('0x71')]||_0x4541b5['context'],'priority':0x1})[_0x0a6b('0x1a')](function(_0x2a7aad){_0x3af01c({'code':0xc8,'message':[_0x48b991[_0x0a6b('0x54')],_0x2a7aad[_0x0a6b('0x1b')]['toLowerCase']()][_0x0a6b('0x15')]('\x20')});})[_0x0a6b('0x1c')](function(_0x4c2fec){_0x4da8c2(_0x496de9[_0x0a6b('0x11')](0x1f5,[_0x48b991['uniqueid'],_0x4c2fec[_0x0a6b('0x1b')][_0x0a6b('0x5f')]()]['join']('\x20')));});}else{return _0x4da8c2(_0x496de9['error'](0x1f5,_0x0a6b('0x64')));}});},'Agents':function(_0x12408c){return new Promise(function(_0x4f7472,_0x1066d3){var _0x43ab84=_['values'](_0x195697[_0x0a6b('0xc')]);_0x4f7472({'count':_0x43ab84[_0x0a6b('0x4f')],'rows':_0x43ab84});});},'Telephones':function(_0xc5a72c){return new Promise(function(_0x567775,_0x486c70){var _0x25dd26=_[_0x0a6b('0x4e')](_0x195697[_0x0a6b('0x72')]);_0x567775({'count':_0x25dd26['length'],'rows':_0x25dd26});});},'Trunks':function(_0x3eab25){return new Promise(function(_0x5dd383,_0x5dba4e){var _0xc6405a=_[_0x0a6b('0x4e')](_0x195697[_0x0a6b('0x73')]);_0x5dd383({'count':_0xc6405a[_0x0a6b('0x4f')],'rows':_0xc6405a});});},'OutboundChannels':function(_0x548b25){return new Promise(function(_0x366b60,_0x3834eb){var _0x3c7b04=_[_0x0a6b('0x4e')](_0x195697[_0x0a6b('0x74')]);_0x366b60({'count':_0x3c7b04[_0x0a6b('0x4f')],'rows':_0x3c7b04});});},'Outbound':function(_0x2d25ac){return new Promise(function(_0xd5e4ad,_0x3b6ad9){_0xd5e4ad(_0x195697[_0x0a6b('0x75')]);});},'Campaigns':function(_0x40187b){return new Promise(function(_0x33ce34,_0xdf0acc){var _0x516170=_['values'](_0x195697[_0x0a6b('0x76')]);_0x33ce34({'count':_0x516170['length'],'rows':_0x516170});});},'VoiceQueuesPreview':function(_0x2d73c2){var _0xb5e93d=this;return new Promise(function(_0x5004fb,_0x42e0eb){_0xc7140c[_0x0a6b('0x77')](_0x2d73c2['id'])[_0x0a6b('0x1a')](function(_0x3158e9){_0x5004fb({'code':0xc8,'message':_0x3158e9['message']});})[_0x0a6b('0x1c')](function(_0x4d868a){_0x42e0eb(_0xb5e93d[_0x0a6b('0x11')](0x1f4,_0x4d868a[_0x0a6b('0x1b')]));});});},'EventManager':function(_0xfd4b1e){var _0x74ce8d=this;return new Promise(function(_0x948bbb,_0x465edc){if(!_0xfd4b1e[_0x0a6b('0x78')]){return _0x465edc(_0x74ce8d[_0x0a6b('0x11')](0x1f4,_0x0a6b('0x79')));}ami[_0x0a6b('0x7a')](_0x0a6b('0x7b')+_0xfd4b1e[_0x0a6b('0x78')],_0xfd4b1e[_0x0a6b('0x1b')]);_0x948bbb({'code':0xc8,'message':_0xfd4b1e});});},'FaxAccounts':function(_0x242b55){return new Promise(function(_0x48d5d1,_0x4387d0){var _0x3b837d=_['values'](_0x195697[_0x0a6b('0x7c')]);_0x48d5d1({'count':_0x3b837d[_0x0a6b('0x4f')],'rows':_0x3b837d});});},'SendFax':function(_0x270dcb){var _0x5c4b7e=this;return new Promise(function(_0x63e98b,_0x3dcd4b){_0x3dc2b0[_0x0a6b('0x7d')](_0x270dcb)['then'](function(_0x2b529a){_0x63e98b({'code':0xc8,'message':_0x2b529a['message']});})[_0x0a6b('0x1c')](function(_0x59b482){_0x3dcd4b(_0x5c4b7e[_0x0a6b('0x11')](0x1f4,_0x59b482[_0x0a6b('0x1b')]));});});},'CheckAfterSend':function(_0x57b5d4){var _0x4b6b9a=this;return new Promise(function(_0x5a714f,_0x19320f){_0x3dc2b0[_0x0a6b('0x7e')](_0x57b5d4)[_0x0a6b('0x1a')](function(_0x3d3faf){_0x5a714f({'code':0xc8,'message':_0x3d3faf[_0x0a6b('0x1b')]});})[_0x0a6b('0x1c')](function(_0x443e13){_0x19320f(_0x4b6b9a['error'](0x1f4,_0x443e13[_0x0a6b('0x1b')]));});});}};var _0x3a2543=jayson['server'](_0xa908dd)[_0x0a6b('0x7f')]();_0x3a2543['on']('error',function(_0x5b8e37){return _0x1b5fb5(_0x5b8e37);});_0x3a2543[_0x0a6b('0x6')](0x232a,_0x0a6b('0x80'),function(){console['log'](_0x0a6b('0x81'),0x232a);return _0x3b6967(_0x0a6b('0x82')+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 43e4fb8..cf85984 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 _0xcba9=['destcalleridnum','phone','resolve','then','showContact','omit','format','name','trigger:%s','action','toLowerCase','createContact','xmd-contactid2','user:%s','merge','catch','error','bluebird','util','lodash','trigger','../../rpc/cmContact','info','stringify','emit','exec','data2','data1','firstName','calleridname','calleridnum','uniqueid','destcalleridname',''];(function(_0x2a7225,_0x3c804f){var _0x439a85=function(_0x45936f){while(--_0x45936f){_0x2a7225['push'](_0x2a7225['shift']());}};_0x439a85(++_0x3c804f);}(_0xcba9,0x1cb));var _0x9cba=function(_0x9541a3,_0x99b1a2){_0x9541a3=_0x9541a3-0x0;var _0x274245=_0xcba9[_0x9541a3];return _0x274245;};'use strict';var BPromise=require(_0x9cba('0x0'));var util=require(_0x9cba('0x1'));var _=require(_0x9cba('0x2'));var logger=require('../../../../config/logger')(_0x9cba('0x3'));var cmContactRpc=require(_0x9cba('0x4'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function emit(_0x18fa8f,_0x53763a,_0x1e045e){logger[_0x9cba('0x5')](_0x18fa8f,_0x53763a,JSON[_0x9cba('0x6')](_0x1e045e));io['to'](_0x18fa8f)[_0x9cba('0x7')](_0x53763a,_0x1e045e);}exports[_0x9cba('0x8')]=function(_0x9d4431,_0x3930ed,_0x298469){_0x298469['autoCreate']=0x0;if(_0x3930ed[_0x9cba('0x9')]&&parseInt(_0x3930ed[_0x9cba('0x9')],0xa)){var _0x1683b8={'ListId':parseInt(_0x3930ed[_0x9cba('0xa')],0xa),'phone':_0x298469['calleridnum']};if(_['isNil'](_0x298469['routeId'])){_0x1683b8[_0x9cba('0xb')]=_0x298469[_0x9cba('0xc')]&&_0x298469[_0x9cba('0xc')]!==''?_0x298469['calleridname']:_0x298469[_0x9cba('0xd')]||_0x298469[_0x9cba('0xe')];}else{_0x1683b8['firstName']=_0x298469[_0x9cba('0xf')]&&_0x298469[_0x9cba('0xf')]!==_0x9cba('0x10')?_0x298469['destcalleridname']:_0x298469[_0x9cba('0x11')]||_0x298469[_0x9cba('0xe')];_0x1683b8[_0x9cba('0x12')]=_0x298469['destcalleridname']&&_0x298469['destcalleridname']!==''?_0x298469['destcalleridname']:_0x298469[_0x9cba('0x11')]||_0x298469[_0x9cba('0xe')];}BPromise[_0x9cba('0x13')]()[_0x9cba('0x14')](cmContactRpc[_0x9cba('0x15')]({'where':_[_0x9cba('0x16')](_0x1683b8,[_0x9cba('0xb')])}))[_0x9cba('0x14')](function(_0x5908d1){if(_0x5908d1){_0x298469['xmd-contactid2']=_0x5908d1['id'];emit(util[_0x9cba('0x17')]('user:%s',_0x9d4431[_0x9cba('0x18')]),util[_0x9cba('0x17')](_0x9cba('0x19'),_0x3930ed[_0x9cba('0x1a')][_0x9cba('0x1b')]()),_['merge'](_0x298469,{'ListId':parseInt(_0x3930ed[_0x9cba('0xa')],0xa)}));return;}else{return BPromise['resolve']()[_0x9cba('0x14')](cmContactRpc[_0x9cba('0x1c')](_0x1683b8));}})[_0x9cba('0x14')](function(_0x55b0fa){if(_0x55b0fa){_0x298469[_0x9cba('0x1d')]=_0x55b0fa['id'];emit(util['format'](_0x9cba('0x1e'),_0x9d4431[_0x9cba('0x18')]),util[_0x9cba('0x17')](_0x9cba('0x19'),_0x3930ed['action'][_0x9cba('0x1b')]()),_[_0x9cba('0x1f')](_0x298469,{'ListId':parseInt(_0x3930ed['data1'],0xa)}));}})[_0x9cba('0x20')](function(_0x45f757){logger[_0x9cba('0x21')]('Error\x20creating\x20contact',JSON[_0x9cba('0x6')](_0x45f757));});}else{if(_0x9d4431){emit(util[_0x9cba('0x17')]('user:%s',_0x9d4431[_0x9cba('0x18')]),util[_0x9cba('0x17')](_0x9cba('0x19'),_0x3930ed['action'][_0x9cba('0x1b')]()),_[_0x9cba('0x1f')]({'ListId':parseInt(_0x3930ed[_0x9cba('0xa')],0xa)},_0x298469));}}}; \ No newline at end of file +var _0xdd70=['bluebird','util','lodash','../../../../config/logger','trigger','localhost','info','stringify','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','toLowerCase','createContact','name','action','merge','catch','error','Error\x20creating\x20contact','trigger:%s'];(function(_0x4abfcd,_0x346eb7){var _0xb01833=function(_0x258c3f){while(--_0x258c3f){_0x4abfcd['push'](_0x4abfcd['shift']());}};_0xb01833(++_0x346eb7);}(_0xdd70,0x17c));var _0x0dd7=function(_0x2240ad,_0x5c8d8a){_0x2240ad=_0x2240ad-0x0;var _0x694424=_0xdd70[_0x2240ad];return _0x694424;};'use strict';var BPromise=require(_0x0dd7('0x0'));var util=require(_0x0dd7('0x1'));var _=require(_0x0dd7('0x2'));var logger=require(_0x0dd7('0x3'))(_0x0dd7('0x4'));var cmContactRpc=require('../../rpc/cmContact');var io=require('socket.io-emitter')({'host':_0x0dd7('0x5'),'port':0x18eb});function emit(_0x4993e4,_0x762c4f,_0x3a650b){logger[_0x0dd7('0x6')](_0x4993e4,_0x762c4f,JSON[_0x0dd7('0x7')](_0x3a650b));io['to'](_0x4993e4)['emit'](_0x762c4f,_0x3a650b);}exports[_0x0dd7('0x8')]=function(_0x258c04,_0x2128cf,_0x26d2d4){_0x26d2d4[_0x0dd7('0x9')]=0x0;if(_0x2128cf['data2']&&parseInt(_0x2128cf[_0x0dd7('0xa')],0xa)){var _0x253e1a={'ListId':parseInt(_0x2128cf[_0x0dd7('0xb')],0xa),'phone':_0x26d2d4[_0x0dd7('0xc')]};if(_[_0x0dd7('0xd')](_0x26d2d4[_0x0dd7('0xe')])){_0x253e1a[_0x0dd7('0xf')]=_0x26d2d4[_0x0dd7('0x10')]&&_0x26d2d4['calleridname']!==_0x0dd7('0x11')?_0x26d2d4['calleridname']:_0x26d2d4['calleridnum']||_0x26d2d4[_0x0dd7('0x12')];}else{_0x253e1a[_0x0dd7('0xf')]=_0x26d2d4[_0x0dd7('0x13')]&&_0x26d2d4[_0x0dd7('0x13')]!==_0x0dd7('0x11')?_0x26d2d4[_0x0dd7('0x13')]:_0x26d2d4[_0x0dd7('0x14')]||_0x26d2d4[_0x0dd7('0x12')];_0x253e1a[_0x0dd7('0x15')]=_0x26d2d4['destcalleridname']&&_0x26d2d4['destcalleridname']!==_0x0dd7('0x11')?_0x26d2d4[_0x0dd7('0x13')]:_0x26d2d4[_0x0dd7('0x14')]||_0x26d2d4[_0x0dd7('0x12')];}BPromise[_0x0dd7('0x16')]()[_0x0dd7('0x17')](cmContactRpc[_0x0dd7('0x18')]({'where':_[_0x0dd7('0x19')](_0x253e1a,[_0x0dd7('0xf')])}))['then'](function(_0x5b0340){if(_0x5b0340){_0x26d2d4[_0x0dd7('0x1a')]=_0x5b0340['id'];emit(util[_0x0dd7('0x1b')](_0x0dd7('0x1c'),_0x258c04['name']),util['format']('trigger:%s',_0x2128cf['action'][_0x0dd7('0x1d')]()),_['merge'](_0x26d2d4,{'ListId':parseInt(_0x2128cf[_0x0dd7('0xb')],0xa)}));return;}else{return BPromise[_0x0dd7('0x16')]()[_0x0dd7('0x17')](cmContactRpc[_0x0dd7('0x1e')](_0x253e1a));}})[_0x0dd7('0x17')](function(_0x2a81b3){if(_0x2a81b3){_0x26d2d4[_0x0dd7('0x1a')]=_0x2a81b3['id'];emit(util[_0x0dd7('0x1b')](_0x0dd7('0x1c'),_0x258c04[_0x0dd7('0x1f')]),util[_0x0dd7('0x1b')]('trigger:%s',_0x2128cf[_0x0dd7('0x20')]['toLowerCase']()),_[_0x0dd7('0x21')](_0x26d2d4,{'ListId':parseInt(_0x2128cf[_0x0dd7('0xb')],0xa)}));}})[_0x0dd7('0x22')](function(_0xd5ab0a){logger[_0x0dd7('0x23')](_0x0dd7('0x24'),JSON['stringify'](_0xd5ab0a));});}else{if(_0x258c04){emit(util[_0x0dd7('0x1b')](_0x0dd7('0x1c'),_0x258c04['name']),util[_0x0dd7('0x1b')](_0x0dd7('0x25'),_0x2128cf[_0x0dd7('0x20')]['toLowerCase']()),_[_0x0dd7('0x21')]({'ListId':parseInt(_0x2128cf[_0x0dd7('0xb')],0xa)},_0x26d2d4));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fb37530..a0f0db3 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 _0xbd0f=['./urlforward','./cmContact','../rpc/cmContact','../ami','integration','urlforward','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','checkTriggers','hasOwnProperty','checkTrigger','merge','length','Actions','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','isNil','data3','data4','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','interface','name','format','trigger:%s:%s','jscripty','user:%s','trigger:%s','queue','routeId','exec','parse','query','search','every','AllConditions','checkConditions','channel','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','lastevent','exports','util','lodash','url','mustache','bluebird'];(function(_0x22e1d2,_0x1a5299){var _0x41f79c=function(_0x17c9b3){while(--_0x17c9b3){_0x22e1d2['push'](_0x22e1d2['shift']());}};_0x41f79c(++_0x1a5299);}(_0xbd0f,0x187));var _0xfbd0=function(_0x27c48c,_0x40c8e4){_0x27c48c=_0x27c48c-0x0;var _0x1d2dd2=_0xbd0f[_0x27c48c];return _0x1d2dd2;};'use strict';var util=require(_0xfbd0('0x0'));var _=require(_0xfbd0('0x1'));var url=require(_0xfbd0('0x2'));var Mustache=require(_0xfbd0('0x3'));var BPromise=require(_0xfbd0('0x4'));var urlforward=require(_0xfbd0('0x5'));var integration=require('./integration');var cmContact=require(_0xfbd0('0x6'));var cmContactRpc=require(_0xfbd0('0x7'));var logger=require('../../../config/logger')('trigger');var ami=require(_0xfbd0('0x8'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});var operators={'equals':function(_0x408531,_0x5c2aad){return _0x408531==_0x5c2aad;},'not_equals':function(_0x350946,_0x1918f3){return _0x350946!=_0x1918f3;}};var serverActions=[_0xfbd0('0x9'),_0xfbd0('0xa')];var barAndWebActions=[_0xfbd0('0xb'),_0xfbd0('0x2'),_0xfbd0('0xc')];function Trigger(_0x28a916){this[_0xfbd0('0xd')]=_0x28a916[_0xfbd0('0xd')];this[_0xfbd0('0xe')]=_0x28a916[_0xfbd0('0xe')];this[_0xfbd0('0xf')]=_0x28a916[_0xfbd0('0xf')];this[_0xfbd0('0x10')]=_0x28a916[_0xfbd0('0x10')];this['voiceExtensions']=_0x28a916[_0xfbd0('0x11')];this[_0xfbd0('0x12')]=_0x28a916[_0xfbd0('0x12')];this[_0xfbd0('0x13')]=_0x28a916[_0xfbd0('0x13')];this[_0xfbd0('0x14')]=_0x28a916[_0xfbd0('0x14')];this[_0xfbd0('0x15')]=_0x28a916[_0xfbd0('0x15')];this['zohoAccounts']=_0x28a916[_0xfbd0('0x16')];this['deskAccounts']=_0x28a916[_0xfbd0('0x17')];this[_0xfbd0('0x18')]=_0x28a916['vtigerAccounts'];this[_0xfbd0('0x19')]={'zendesk':this[_0xfbd0('0x12')],'salesforce':this[_0xfbd0('0x14')],'freshdesk':this[_0xfbd0('0x13')],'sugarcrm':this[_0xfbd0('0x15')],'zoho':this[_0xfbd0('0x16')],'desk':this[_0xfbd0('0x17')],'vtiger':this[_0xfbd0('0x18')]};ami['on'](_0xfbd0('0x1a'),this[_0xfbd0('0x1b')][_0xfbd0('0x1c')](this));ami['on'](_0xfbd0('0x1d'),this[_0xfbd0('0x1b')][_0xfbd0('0x1c')](this));ami['on'](_0xfbd0('0x1e'),this['syncCustomEvent'][_0xfbd0('0x1c')](this));ami['on']('custom:agentcomplete',this[_0xfbd0('0x1b')][_0xfbd0('0x1c')](this));ami['on'](_0xfbd0('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfbd0('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfbd0('0x21'),this[_0xfbd0('0x1b')]['bind'](this));ami['on']('custom:dialend',this[_0xfbd0('0x1b')][_0xfbd0('0x1c')](this));ami['on'](_0xfbd0('0x22'),this[_0xfbd0('0x1b')][_0xfbd0('0x1c')](this));ami['on'](_0xfbd0('0x23'),this['syncCustomEvent'][_0xfbd0('0x1c')](this));ami['on'](_0xfbd0('0x24'),this[_0xfbd0('0x1b')][_0xfbd0('0x1c')](this));ami['on'](_0xfbd0('0x25'),this[_0xfbd0('0x1b')][_0xfbd0('0x1c')](this));ami['on']('custom:acceptmessage',this[_0xfbd0('0x1b')]['bind'](this));ami['on'](_0xfbd0('0x26'),this[_0xfbd0('0x1b')]['bind'](this));}Trigger[_0xfbd0('0x27')][_0xfbd0('0x28')]=function(_0xba3a86,_0x16670d,_0x556f37){logger[_0xfbd0('0x29')](_0xba3a86,_0x16670d,JSON[_0xfbd0('0x2a')](_0x556f37));io['to'](_0xba3a86)[_0xfbd0('0x28')](_0x16670d,_0x556f37);};Trigger[_0xfbd0('0x27')]['syncCustomEvent']=function(_0x49a02b){this['checkTriggers'](_0x49a02b);};Trigger[_0xfbd0('0x27')][_0xfbd0('0x2b')]=function(_0xea3ac5){var _0x229bc2;for(var _0x29195a in this[_0xfbd0('0xd')]){if(this[_0xfbd0('0xd')][_0xfbd0('0x2c')](_0x29195a)){if(this[_0xfbd0('0xd')][_0x29195a]['status']){_0x229bc2=this[_0xfbd0('0x2d')](this[_0xfbd0('0xd')][_0x29195a],_0xea3ac5);if(_0x229bc2){_[_0xfbd0('0x2e')](_0xea3ac5,_0xea3ac5['variables']);for(var _0x15fa00=0x0,_0x38fd1b,_0x496d01,_0x501c01;_0x15fa000x0){_0x30413a=_[_0xe7ef('0x29')](_0x5c1a2a,_0x43053b);}return _0x30413a;}function getCustomFields(_0x3f8c37,_0x35aa45){var _0x2d0e64=[];var _0x40e93c={'custom_fields':{}};if(_0x3f8c37[_0xe7ef('0x28')]>0x0){_[_0xe7ef('0x2a')](_0x3f8c37,function(_0x47c458){if(_0x47c458[_0xe7ef('0x2b')]==='string'&&_0x47c458[_0xe7ef('0x2c')]&&!_0x47c458[_0xe7ef('0x2d')]){_0x40e93c[_0x47c458[_0xe7ef('0x2c')][_0xe7ef('0x2e')]()]=_0x47c458[_0xe7ef('0x2f')][_0xe7ef('0x20')]();}else if(_0x47c458[_0xe7ef('0x2b')]===_0xe7ef('0x30')&&_0x47c458[_0xe7ef('0x31')]&&_0x47c458[_0xe7ef('0x2d')]){_0x40e93c[_0xe7ef('0x32')][_0x47c458[_0xe7ef('0x31')]]=_0x47c458[_0xe7ef('0x2f')][_0xe7ef('0x20')]();}else if(_0x47c458[_0xe7ef('0x2b')]===_0xe7ef('0x33')&&_0x47c458[_0xe7ef('0x34')]&&_0x47c458['idField']&&_0x47c458['customField']){_0x35aa45[_0x47c458['variableName']]&&(_0x40e93c['custom_fields'][_0x47c458['idField']]=_0x35aa45[_0x47c458[_0xe7ef('0x34')]][_0xe7ef('0x20')]());}else if(_0x47c458[_0xe7ef('0x2b')]==='customVariable'&&_0x47c458[_0xe7ef('0x35')]&&_0x47c458['Variable'][_0xe7ef('0x36')]&&_0x47c458['idField']&&_0x47c458['customField']){_0x35aa45[_0x47c458['Variable'][_0xe7ef('0x36')][_0xe7ef('0x2e')]()]&&(_0x40e93c[_0xe7ef('0x32')][_0x47c458['idField']]=_0x35aa45[_0x47c458['Variable'][_0xe7ef('0x36')][_0xe7ef('0x2e')]()][_0xe7ef('0x20')]());}});}if(_0x40e93c[_0xe7ef('0x37')]){_0x40e93c[_0xe7ef('0x37')]=Number(_0x40e93c[_0xe7ef('0x37')]);}return _0x40e93c;}function getTicket(_0x45649b,_0x41cfbf,_0x1122be,_0x5875d4,_0x3cdb36){logger[_0xe7ef('0xa')](_0xe7ef('0x38'));var _0x3040b0=_[_0xe7ef('0x39')]({'subject':intUtil['getString'](_0x5875d4[_0xe7ef('0x3a')],_0x3cdb36,'\x20'),'type':_0xe7ef('0x3b'),'status':_0xe7ef('0x3c'),'labels':[_0xe7ef('0x3d'),'Motion',_0xe7ef('0x3e')][_0xe7ef('0x3f')](getTags(_0x5875d4[_0xe7ef('0x40')],_0xe7ef('0x36'))),'description':intUtil[_0xe7ef('0x41')](_0x5875d4[_0xe7ef('0x42')],_0x3cdb36,'\x0a'),'_links':{'assigned_user':{'href':util[_0xe7ef('0xc')](_0xe7ef('0x43'),_0x41cfbf['id']),'class':_0xe7ef('0x44')}},'message':{'direction':'in','body':intUtil[_0xe7ef('0x41')](_0x5875d4[_0xe7ef('0x42')],_0x3cdb36,'\x0a')}},getCustomFields(_0x5875d4[_0xe7ef('0x45')],_0x3cdb36));return request({'uri':util[_0xe7ef('0xc')]('%s/customers/%d/cases',_0x45649b[_0xe7ef('0xe')],_0x1122be['id']),'method':'POST','body':_0x3040b0});}exports['queue']=function(_0x352cb5,_0x106c85,_0x2a31e6,_0x36e4ff,_0x10d197,_0x4a7785){var _0x28a103,_0x1a09d1;_0x4a7785[_0xe7ef('0xe')]=intUtil['stripTrailingSlash'](_0x4a7785['remoteUri']);_0x4a7785[_0xe7ef('0x46')]=intUtil[_0xe7ef('0x47')](_0x4a7785['serverUrl']);if(_0x10d197&&_0x10d197[_0xe7ef('0x48')]){logger['info'](_0xe7ef('0x49'),'Recording\x20is\x20enabled!');_0x106c85[_0xe7ef('0x4a')]=util[_0xe7ef('0xc')](_0xe7ef('0x4b'),_0x4a7785[_0xe7ef('0x46')],_0x106c85[_0xe7ef('0x4c')],md5(_0x106c85[_0xe7ef('0x4c')]));}else{_0x106c85[_0xe7ef('0x4a')]='';}headers['Authorization']=getAuth(_0x4a7785);return getUser(_0x4a7785,_0x36e4ff[_0xe7ef('0x4d')])[_0xe7ef('0xf')](function(_0x235a59){_0x28a103=_0x235a59;logger[_0xe7ef('0xa')](_0xe7ef('0x4e'),_0x28a103['id']);return getEndUser(_0x4a7785,_0x106c85[_0xe7ef('0x4f')],_0x106c85[_0xe7ef('0x50')]);})[_0xe7ef('0xf')](function(_0x55d2ea){_0x1a09d1=_0x55d2ea;logger[_0xe7ef('0xa')](_0xe7ef('0x51'),_0x1a09d1['id']);return getTicket(_0x4a7785,_0x28a103,_0x1a09d1,_0x2a31e6,_0x106c85);})[_0xe7ef('0xf')](function(_0x5b2783){if(_0x5b2783){logger['info'](_0xe7ef('0x52'));logger[_0xe7ef('0xa')](_0xe7ef('0x53'),_0x5b2783['id']);switch(_0x4a7785[_0xe7ef('0x2b')]){case'integrationTab':logger[_0xe7ef('0xa')](_0xe7ef('0x49'),_0xe7ef('0x54'));emit(util[_0xe7ef('0xc')](_0xe7ef('0x55'),_0x36e4ff[_0xe7ef('0x36')]),_0xe7ef('0x56'),{'recordId':_0x5b2783['id']});break;case _0xe7ef('0x57'):logger[_0xe7ef('0xa')](_0xe7ef('0x49'),_0xe7ef('0x58'));emit(util['format'](_0xe7ef('0x55'),_0x36e4ff['name']),_0xe7ef('0x59'),{'uri':util[_0xe7ef('0xc')]('https://xcally.desk.com/web/agent/case/%d',_0x5b2783['id'])});break;default:logger[_0xe7ef('0x5a')]('[QUEUE]',_0xe7ef('0x5b'));}}})[_0xe7ef('0x5c')](function(_0x256d22){console['error'](_0x256d22);logger[_0xe7ef('0x5a')](_0xe7ef('0x49'),JSON[_0xe7ef('0x17')](_0x256d22));});};exports['outbound']=function(_0x4f326a,_0x725280,_0x1c0e30,_0x1bb996,_0x8937ad,_0x489f2b,_0x20749f){var _0x38f167,_0x2333e8;_0x489f2b[_0xe7ef('0xe')]=intUtil[_0xe7ef('0x47')](_0x489f2b['remoteUri']);_0x489f2b[_0xe7ef('0x46')]=intUtil['stripTrailingSlash'](_0x489f2b[_0xe7ef('0x46')]);if(_0x20749f&&_0x20749f[_0xe7ef('0x5d')]&&_0x20749f[_0xe7ef('0x5d')]!==_0xe7ef('0x5e')){logger['info']('[OUTBOUND]',_0xe7ef('0x5f'));_0x725280[_0xe7ef('0x4a')]=util[_0xe7ef('0xc')](_0xe7ef('0x4b'),_0x489f2b[_0xe7ef('0x46')],_0x725280['uniqueid'],md5(_0x725280['uniqueid']));}headers['Authorization']=getAuth(_0x489f2b);return getUser(_0x489f2b,_0x1bb996[_0xe7ef('0x4d')])['then'](function(_0xa0b464){_0x38f167=_0xa0b464;logger[_0xe7ef('0xa')](_0xe7ef('0x4e'),_0x38f167['id']);return getEndUser(_0x489f2b,_0x725280[_0xe7ef('0x60')],_0x725280[_0xe7ef('0x61')]);})['then'](function(_0x4f40d3){_0x2333e8=_0x4f40d3;logger['info'](_0xe7ef('0x51'),_0x2333e8['id']);return getTicket(_0x489f2b,_0x38f167,_0x2333e8,_0x1c0e30,_0x725280);})[_0xe7ef('0xf')](function(_0x1d157a){if(_0x1d157a){logger[_0xe7ef('0xa')](_0xe7ef('0x52'));logger[_0xe7ef('0xa')](_0xe7ef('0x53'),_0x1d157a['id']);switch(_0x489f2b[_0xe7ef('0x2b')]){case _0xe7ef('0x62'):logger[_0xe7ef('0xa')](_0xe7ef('0x49'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x1bb996[_0xe7ef('0x36')]),_0xe7ef('0x56'),{'recordId':_0x1d157a['id']});break;case _0xe7ef('0x57'):logger[_0xe7ef('0xa')](_0xe7ef('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe7ef('0xc')](_0xe7ef('0x55'),_0x1bb996[_0xe7ef('0x36')]),_0xe7ef('0x59'),{'uri':util[_0xe7ef('0xc')]('%s/agent/tickets/%s',_0x489f2b[_0xe7ef('0xe')],_0x1d157a['id'])});break;default:logger['error'](_0xe7ef('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xe7ef('0x5c')](function(_0x2d74ba){logger[_0xe7ef('0x5a')]('[OUTBOUND]',JSON[_0xe7ef('0x17')](_0x2d74ba));});};exports[_0xe7ef('0x64')]=function(_0x2c7597,_0x4005eb,_0x5d16f2,_0x2e56cc,_0x49c541,_0x1464a5){var _0x1e47ae,_0x212e91;_0x1464a5[_0xe7ef('0xe')]=intUtil[_0xe7ef('0x47')](_0x1464a5[_0xe7ef('0xe')]);_0x1464a5[_0xe7ef('0x46')]=intUtil['stripTrailingSlash'](_0x1464a5[_0xe7ef('0x46')]);if(_0x49c541&&_0x49c541[_0xe7ef('0x48')]){logger[_0xe7ef('0xa')](_0xe7ef('0x65'),_0xe7ef('0x5f'));_0x4005eb[_0xe7ef('0x4a')]=util[_0xe7ef('0xc')](_0xe7ef('0x4b'),_0x1464a5['serverUrl'],_0x4005eb[_0xe7ef('0x4c')],md5(_0x4005eb[_0xe7ef('0x4c')]));}else{_0x4005eb[_0xe7ef('0x4a')]='';}headers[_0xe7ef('0x66')]=getAuth(_0x1464a5);return getUser(_0x1464a5)['then'](function(_0x38c775){_0x1e47ae=_0x38c775;logger[_0xe7ef('0xa')](_0xe7ef('0x4e'),_0x1e47ae['id']);return getEndUser(_0x1464a5,_0x4005eb[_0xe7ef('0x4f')],_0x4005eb[_0xe7ef('0x50')]);})[_0xe7ef('0xf')](function(_0x472dc9){_0x212e91=_0x472dc9;logger[_0xe7ef('0xa')]('The\x20Enduser\x20ID\x20is:',_0x212e91['id']);return getTicket(_0x1464a5,_0x1e47ae,_0x212e91,_0x5d16f2,_0x4005eb);})[_0xe7ef('0xf')](function(_0x25dec2){if(_0x25dec2){logger[_0xe7ef('0xa')](_0xe7ef('0x52'));logger[_0xe7ef('0xa')](_0xe7ef('0x53'),_0x25dec2['id']);}})[_0xe7ef('0x5c')](function(_0x52c1d2){logger[_0xe7ef('0x5a')](_0xe7ef('0x65'),JSON[_0xe7ef('0x17')](_0x52c1d2));});}; \ No newline at end of file +var _0x6e30=['serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','[OUTBOUND]','Authorization','The\x20Ticket\x20ID\x20is:','trigger:desk:display','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','calleridnum','[ABANDONED]','request-promise','md5','util','../../../../config/logger','desk','socket.io-emitter','localhost','emit','application/json','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','info','%s/users/me','debug','stringify','GET','authType','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','base64','%s/customers/search','total_entries','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','length','type','string','nameField','toLowerCase','content','idField','customField','custom_fields','variable','variableName','customVariable','Variable','name','Creating\x20new\x20ticket...','merge','phone','new','xCALLY','Motion','CTI','concat','getString','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6e30,0x7e));var _0x06e3=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x6e30[_0x202d24];return _0x2b3a8e;};'use strict';var _=require('lodash');var rp=require(_0x06e3('0x0'));var md5=require(_0x06e3('0x1'));var util=require(_0x06e3('0x2'));var intUtil=require('./util');var logger=require(_0x06e3('0x3'))(_0x06e3('0x4'));var io=require(_0x06e3('0x5'))({'host':_0x06e3('0x6'),'port':0x18eb});function emit(_0x305636,_0x29065e,_0x3c0512){io['to'](_0x305636)[_0x06e3('0x7')](_0x29065e,_0x3c0512);}var headers={'Content-Type':_0x06e3('0x8'),'Accept':_0x06e3('0x8')};function getUser(_0x3bcc04,_0x2e5556){logger['info'](_0x06e3('0x9'),_0x2e5556);return request({'uri':util[_0x06e3('0xa')](_0x06e3('0xb'),_0x3bcc04[_0x06e3('0xc')])})[_0x06e3('0xd')](function(_0x2bab6b){if(_0x2bab6b['total_entries']){return _['find'](_0x2bab6b['_embedded']['entries'],{'email':_0x2e5556});}})['then'](function(_0x211367){if(_0x211367){logger[_0x06e3('0xe')]('Agent\x20found!');return _0x211367;}else{logger[_0x06e3('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x06e3('0xa')](_0x06e3('0xf'),_0x3bcc04[_0x06e3('0xc')])});}});}function request(_0x2f97d7){logger[_0x06e3('0x10')]('[HTTP]',JSON[_0x06e3('0x11')](_0x2f97d7));return rp(_['defaults'](_0x2f97d7,{'method':_0x06e3('0x12'),'headers':headers,'json':!![]}));}function getAuth(_0x3d5a20){var _0x2ea3c7;if(_0x3d5a20[_0x06e3('0x13')]==='basic'){_0x2ea3c7=util[_0x06e3('0xa')](_0x06e3('0x14'),_0x3d5a20[_0x06e3('0x15')],_0x3d5a20['password']);}else if(_0x3d5a20['authType']==='token'){_0x2ea3c7=util[_0x06e3('0xa')](_0x06e3('0x16'),_0x3d5a20['username'],_0x3d5a20[_0x06e3('0x17')]);}return util[_0x06e3('0xa')](_0x06e3('0x18'),new Buffer(_0x2ea3c7)[_0x06e3('0x19')](_0x06e3('0x1a')));}function getEndUser(_0x2299e7,_0xeb0c22,_0x4f8c2d){logger[_0x06e3('0xe')]('Searching\x20enduser\x20with\x20phone',_0x4f8c2d);return request({'uri':util[_0x06e3('0xa')](_0x06e3('0x1b'),_0x2299e7[_0x06e3('0xc')]),'qs':{'phone':_0x4f8c2d}})[_0x06e3('0xd')](function(_0x4eafbb){if(_0x4eafbb[_0x06e3('0x1c')]){logger[_0x06e3('0xe')](_0x06e3('0x1d'));return _0x4eafbb[_0x06e3('0x1e')]['entries'][0x0];}else{logger[_0x06e3('0xe')](_0x06e3('0x1f'));return request({'uri':util['format'](_0x06e3('0x20'),_0x2299e7['remoteUri']),'method':_0x06e3('0x21'),'body':{'first_name':_0xeb0c22,'title':_0xeb0c22,'phone_numbers':[{'type':_0x06e3('0x22'),'value':_0x4f8c2d}]}});}});}function getTags(_0x36586c,_0x3a838d){var _0x2097e8=[];if(_0x36586c&&_0x36586c[_0x06e3('0x23')]>0x0){_0x2097e8=_['map'](_0x36586c,_0x3a838d);}return _0x2097e8;}function getCustomFields(_0x518027,_0x155d38){var _0x30bbb1=[];var _0x2acd85={'custom_fields':{}};if(_0x518027[_0x06e3('0x23')]>0x0){_['forEach'](_0x518027,function(_0x542e5b){if(_0x542e5b[_0x06e3('0x24')]===_0x06e3('0x25')&&_0x542e5b[_0x06e3('0x26')]&&!_0x542e5b['customField']){_0x2acd85[_0x542e5b['nameField'][_0x06e3('0x27')]()]=_0x542e5b[_0x06e3('0x28')]['toString']();}else if(_0x542e5b[_0x06e3('0x24')]===_0x06e3('0x25')&&_0x542e5b[_0x06e3('0x29')]&&_0x542e5b[_0x06e3('0x2a')]){_0x2acd85[_0x06e3('0x2b')][_0x542e5b[_0x06e3('0x29')]]=_0x542e5b['content'][_0x06e3('0x19')]();}else if(_0x542e5b[_0x06e3('0x24')]===_0x06e3('0x2c')&&_0x542e5b[_0x06e3('0x2d')]&&_0x542e5b[_0x06e3('0x29')]&&_0x542e5b[_0x06e3('0x2a')]){_0x155d38[_0x542e5b[_0x06e3('0x2d')]]&&(_0x2acd85[_0x06e3('0x2b')][_0x542e5b[_0x06e3('0x29')]]=_0x155d38[_0x542e5b['variableName']]['toString']());}else if(_0x542e5b['type']===_0x06e3('0x2e')&&_0x542e5b[_0x06e3('0x2f')]&&_0x542e5b['Variable'][_0x06e3('0x30')]&&_0x542e5b[_0x06e3('0x29')]&&_0x542e5b[_0x06e3('0x2a')]){_0x155d38[_0x542e5b['Variable'][_0x06e3('0x30')]['toLowerCase']()]&&(_0x2acd85[_0x06e3('0x2b')][_0x542e5b[_0x06e3('0x29')]]=_0x155d38[_0x542e5b[_0x06e3('0x2f')][_0x06e3('0x30')][_0x06e3('0x27')]()]['toString']());}});}if(_0x2acd85['priority']){_0x2acd85['priority']=Number(_0x2acd85['priority']);}return _0x2acd85;}function getTicket(_0x1c1f91,_0x4f5167,_0x165053,_0x167a5b,_0x30ebbf){logger[_0x06e3('0xe')](_0x06e3('0x31'));var _0x41ad2a=_[_0x06e3('0x32')]({'subject':intUtil['getString'](_0x167a5b['Subjects'],_0x30ebbf,'\x20'),'type':_0x06e3('0x33'),'status':_0x06e3('0x34'),'labels':[_0x06e3('0x35'),_0x06e3('0x36'),_0x06e3('0x37')][_0x06e3('0x38')](getTags(_0x167a5b['Tags'],'name')),'description':intUtil[_0x06e3('0x39')](_0x167a5b[_0x06e3('0x3a')],_0x30ebbf,'\x0a'),'_links':{'assigned_user':{'href':util[_0x06e3('0xa')]('/api/v2/users/%d',_0x4f5167['id']),'class':_0x06e3('0x3b')}},'message':{'direction':'in','body':intUtil[_0x06e3('0x39')](_0x167a5b[_0x06e3('0x3a')],_0x30ebbf,'\x0a')}},getCustomFields(_0x167a5b[_0x06e3('0x3c')],_0x30ebbf));return request({'uri':util['format'](_0x06e3('0x3d'),_0x1c1f91['remoteUri'],_0x165053['id']),'method':_0x06e3('0x21'),'body':_0x41ad2a});}exports[_0x06e3('0x3e')]=function(_0x38fcc2,_0x1b641a,_0x19ed00,_0x2bdad3,_0x56f890,_0x49d7f8){var _0x2dc124,_0x504ebe;_0x49d7f8[_0x06e3('0xc')]=intUtil[_0x06e3('0x3f')](_0x49d7f8['remoteUri']);_0x49d7f8[_0x06e3('0x40')]=intUtil[_0x06e3('0x3f')](_0x49d7f8[_0x06e3('0x40')]);if(_0x56f890&&_0x56f890[_0x06e3('0x41')]){logger['info'](_0x06e3('0x42'),_0x06e3('0x43'));_0x1b641a[_0x06e3('0x44')]=util[_0x06e3('0xa')](_0x06e3('0x45'),_0x49d7f8[_0x06e3('0x40')],_0x1b641a['uniqueid'],md5(_0x1b641a[_0x06e3('0x46')]));}else{_0x1b641a[_0x06e3('0x44')]='';}headers['Authorization']=getAuth(_0x49d7f8);return getUser(_0x49d7f8,_0x2bdad3[_0x06e3('0x47')])[_0x06e3('0xd')](function(_0x26a373){_0x2dc124=_0x26a373;logger[_0x06e3('0xe')](_0x06e3('0x48'),_0x2dc124['id']);return getEndUser(_0x49d7f8,_0x1b641a[_0x06e3('0x49')],_0x1b641a['calleridnum']);})['then'](function(_0x498461){_0x504ebe=_0x498461;logger[_0x06e3('0xe')](_0x06e3('0x4a'),_0x504ebe['id']);return getTicket(_0x49d7f8,_0x2dc124,_0x504ebe,_0x19ed00,_0x1b641a);})['then'](function(_0x1c8602){if(_0x1c8602){logger[_0x06e3('0xe')](_0x06e3('0x4b'));logger[_0x06e3('0xe')]('The\x20Ticket\x20ID\x20is:',_0x1c8602['id']);switch(_0x49d7f8[_0x06e3('0x24')]){case _0x06e3('0x4c'):logger[_0x06e3('0xe')]('[QUEUE]',_0x06e3('0x4d'));emit(util[_0x06e3('0xa')]('user:%s',_0x2bdad3[_0x06e3('0x30')]),'trigger:desk:display',{'recordId':_0x1c8602['id']});break;case _0x06e3('0x4e'):logger[_0x06e3('0xe')](_0x06e3('0x42'),_0x06e3('0x4f'));emit(util['format'](_0x06e3('0x50'),_0x2bdad3[_0x06e3('0x30')]),_0x06e3('0x51'),{'uri':util[_0x06e3('0xa')](_0x06e3('0x52'),_0x1c8602['id'])});break;default:logger[_0x06e3('0x53')](_0x06e3('0x42'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x06e3('0x54')](function(_0x107061){console[_0x06e3('0x53')](_0x107061);logger['error'](_0x06e3('0x42'),JSON[_0x06e3('0x11')](_0x107061));});};exports[_0x06e3('0x55')]=function(_0x3b6602,_0x4b6c5e,_0x476010,_0x319422,_0xd8baec,_0x21c51e,_0x5ab489){var _0x4df795,_0x25ae27;_0x21c51e[_0x06e3('0xc')]=intUtil[_0x06e3('0x3f')](_0x21c51e[_0x06e3('0xc')]);_0x21c51e[_0x06e3('0x40')]=intUtil['stripTrailingSlash'](_0x21c51e[_0x06e3('0x40')]);if(_0x5ab489&&_0x5ab489['recordingFormat']&&_0x5ab489[_0x06e3('0x56')]!=='none'){logger[_0x06e3('0xe')](_0x06e3('0x57'),_0x06e3('0x43'));_0x4b6c5e['recordingURL']=util[_0x06e3('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21c51e[_0x06e3('0x40')],_0x4b6c5e[_0x06e3('0x46')],md5(_0x4b6c5e['uniqueid']));}headers[_0x06e3('0x58')]=getAuth(_0x21c51e);return getUser(_0x21c51e,_0x319422[_0x06e3('0x47')])[_0x06e3('0xd')](function(_0x47f5ef){_0x4df795=_0x47f5ef;logger['info'](_0x06e3('0x48'),_0x4df795['id']);return getEndUser(_0x21c51e,_0x4b6c5e['destcalleridname'],_0x4b6c5e['destcalleridnum']);})[_0x06e3('0xd')](function(_0x39354c){_0x25ae27=_0x39354c;logger['info'](_0x06e3('0x4a'),_0x25ae27['id']);return getTicket(_0x21c51e,_0x4df795,_0x25ae27,_0x476010,_0x4b6c5e);})[_0x06e3('0xd')](function(_0x5f19c3){if(_0x5f19c3){logger[_0x06e3('0xe')](_0x06e3('0x4b'));logger[_0x06e3('0xe')](_0x06e3('0x59'),_0x5f19c3['id']);switch(_0x21c51e[_0x06e3('0x24')]){case _0x06e3('0x4c'):logger['info'](_0x06e3('0x42'),_0x06e3('0x4d'));emit(util[_0x06e3('0xa')](_0x06e3('0x50'),_0x319422[_0x06e3('0x30')]),_0x06e3('0x5a'),{'recordId':_0x5f19c3['id']});break;case _0x06e3('0x4e'):logger[_0x06e3('0xe')](_0x06e3('0x42'),_0x06e3('0x4f'));emit(util['format']('user:%s',_0x319422[_0x06e3('0x30')]),_0x06e3('0x51'),{'uri':util[_0x06e3('0xa')](_0x06e3('0x5b'),_0x21c51e[_0x06e3('0xc')],_0x5f19c3['id'])});break;default:logger[_0x06e3('0x53')](_0x06e3('0x57'),_0x06e3('0x5c'));}}})[_0x06e3('0x54')](function(_0x91e79e){logger[_0x06e3('0x53')](_0x06e3('0x57'),JSON[_0x06e3('0x11')](_0x91e79e));});};exports['abandoned']=function(_0x58f965,_0x39aa2e,_0x1bdb27,_0x59eab0,_0x40fc2d,_0x50a8da){var _0x231798,_0x2175ca;_0x50a8da[_0x06e3('0xc')]=intUtil[_0x06e3('0x3f')](_0x50a8da[_0x06e3('0xc')]);_0x50a8da['serverUrl']=intUtil[_0x06e3('0x3f')](_0x50a8da['serverUrl']);if(_0x40fc2d&&_0x40fc2d[_0x06e3('0x41')]){logger['info']('[ABANDONED]','Recording\x20is\x20enabled!');_0x39aa2e['recordingURL']=util['format'](_0x06e3('0x45'),_0x50a8da['serverUrl'],_0x39aa2e[_0x06e3('0x46')],md5(_0x39aa2e[_0x06e3('0x46')]));}else{_0x39aa2e[_0x06e3('0x44')]='';}headers['Authorization']=getAuth(_0x50a8da);return getUser(_0x50a8da)[_0x06e3('0xd')](function(_0x1e6d91){_0x231798=_0x1e6d91;logger['info'](_0x06e3('0x48'),_0x231798['id']);return getEndUser(_0x50a8da,_0x39aa2e[_0x06e3('0x49')],_0x39aa2e[_0x06e3('0x5d')]);})[_0x06e3('0xd')](function(_0x168c6d){_0x2175ca=_0x168c6d;logger['info'](_0x06e3('0x4a'),_0x2175ca['id']);return getTicket(_0x50a8da,_0x231798,_0x2175ca,_0x1bdb27,_0x39aa2e);})[_0x06e3('0xd')](function(_0x80814e){if(_0x80814e){logger['info']('Ticket\x20created!');logger['info'](_0x06e3('0x59'),_0x80814e['id']);}})['catch'](function(_0x131e27){logger[_0x06e3('0x53')](_0x06e3('0x5e'),JSON['stringify'](_0x131e27));});}; \ 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 788e2d6..74720ee 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 _0xbdb7=['variable','variableName','push','customVariable','name','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','abandoned','[ABANDONED]','lodash','request-promise','md5','util','./util','../../../../config/logger','freshdesk','socket.io-emitter','localhost','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','Fields','keyBy','custom_fields','remoteUri','POST','then','info','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','defaults','GET','map','forEach','type','nameField','customField','content','string','idField'];(function(_0x5da946,_0x29d2b7){var _0x15770c=function(_0xf99e73){while(--_0xf99e73){_0x5da946['push'](_0x5da946['shift']());}};_0x15770c(++_0x29d2b7);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x13530a,_0x44630c){_0x13530a=_0x13530a-0x0;var _0x587e70=_0xbdb7[_0x13530a];return _0x587e70;};'use strict';var _=require(_0x7bdb('0x0'));var rp=require(_0x7bdb('0x1'));var md5=require(_0x7bdb('0x2'));var util=require(_0x7bdb('0x3'));var intUtil=require(_0x7bdb('0x4'));var logger=require(_0x7bdb('0x5'))(_0x7bdb('0x6'));var io=require(_0x7bdb('0x7'))({'host':_0x7bdb('0x8'),'port':0x18eb});var headers={'Content-Type':'application/json','Accept':_0x7bdb('0x9')};function emit(_0x4fd1ad,_0x4b5fff,_0xffdc86){io['to'](_0x4fd1ad)[_0x7bdb('0xa')](_0x4b5fff,_0xffdc86);}function getTicket(_0x493bde,_0x513cba,_0x468041,_0x11a877,_0x530f81){logger['info'](_0x7bdb('0xb'));var _0x1a6b61=_[_0x7bdb('0xc')]({'responder_id':_0x513cba['id'],'requester_id':_0x468041['id'],'name':util[_0x7bdb('0xd')](_0x7bdb('0xe'),_0x530f81[_0x7bdb('0xf')]),'phone':_0x530f81[_0x7bdb('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7bdb('0x11')](_0x11a877['Subjects'],_0x530f81,'\x20'),'description':intUtil['getString'](_0x11a877['Descriptions'],_0x530f81,_0x7bdb('0x12')),'tags':getTags(_0x11a877[_0x7bdb('0x13')],'name')},getCustomFields(_0x11a877[_0x7bdb('0x14')],_0x530f81));_0x1a6b61['custom_fields']=_['mapValues'](_[_0x7bdb('0x15')](_0x1a6b61[_0x7bdb('0x16')],'id'),'value');return request({'uri':util['format']('%s/api/v2/tickets',_0x493bde[_0x7bdb('0x17')]),'method':_0x7bdb('0x18'),'body':_0x1a6b61})[_0x7bdb('0x19')](function(_0x25d417){logger[_0x7bdb('0x1a')](_0x7bdb('0x1b'));return _0x25d417;});}function getUser(_0x3e96ac,_0x1b2d9b){logger['info'](_0x7bdb('0x1c'),_0x1b2d9b);return request({'uri':util[_0x7bdb('0xd')](_0x7bdb('0x1d'),_0x3e96ac[_0x7bdb('0x17')]),'qs':{'email':_0x1b2d9b}})['then'](function(_0x41f540){if(_0x41f540[_0x7bdb('0x1e')]){logger['info'](_0x7bdb('0x1f'));return _[_0x7bdb('0x20')](_0x41f540,function(_0x9143e8){return _0x9143e8[_0x7bdb('0x21')][_0x7bdb('0x22')]===_0x1b2d9b;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7bdb('0xd')](_0x7bdb('0x23'),_0x3e96ac['remoteUri'])})[_0x7bdb('0x19')](function(_0x118ea1){logger[_0x7bdb('0x1a')](_0x7bdb('0x24'));return _0x118ea1;});}});}function getEndUser(_0x3a1d0f,_0x4d668e,_0x1d37ac){logger[_0x7bdb('0x1a')](_0x7bdb('0x25'),_0x1d37ac);return request({'uri':util[_0x7bdb('0xd')]('%s/api/v2/contacts',_0x3a1d0f['remoteUri']),'qs':{'phone':_0x1d37ac}})[_0x7bdb('0x19')](function(_0x5eface){if(_0x5eface['length']){logger['info'](_0x7bdb('0x26'));return _['find'](_0x5eface,{'phone':_0x1d37ac});}else{logger[_0x7bdb('0x1a')](_0x7bdb('0x27'));return request({'uri':util[_0x7bdb('0xd')](_0x7bdb('0x28'),_0x3a1d0f[_0x7bdb('0x17')]),'method':'POST','body':{'name':_0x4d668e,'phone':_0x1d37ac}})[_0x7bdb('0x19')](function(_0x32242d){logger[_0x7bdb('0x1a')](_0x7bdb('0x29'));return _0x32242d;});}});}function getAuth(_0x371e8a){return util[_0x7bdb('0xd')](_0x7bdb('0x2a'),new Buffer(_0x371e8a[_0x7bdb('0x2b')]+':X')[_0x7bdb('0x2c')](_0x7bdb('0x2d')));}function request(_0x9ec48d){logger[_0x7bdb('0x2e')]('[HTTP]',JSON[_0x7bdb('0x2f')](_0x9ec48d));return rp(_[_0x7bdb('0x30')](_0x9ec48d,{'method':_0x7bdb('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x9f5c1,_0x29eac5){var _0x5da819=[];if(_0x9f5c1&&_0x9f5c1[_0x7bdb('0x1e')]>0x0){_0x5da819=_[_0x7bdb('0x32')](_0x9f5c1,_0x29eac5);}return _0x5da819;}function getCustomFields(_0x9ac56,_0x103585){var _0x58c6b7=[];var _0x4f43b9={'custom_fields':[]};if(_0x9ac56['length']>0x0){_[_0x7bdb('0x33')](_0x9ac56,function(_0x56def2){if(_0x56def2[_0x7bdb('0x34')]==='string'&&_0x56def2[_0x7bdb('0x35')]&&!_0x56def2[_0x7bdb('0x36')]){_0x4f43b9[_0x56def2[_0x7bdb('0x35')]['toLowerCase']()]=_0x56def2[_0x7bdb('0x37')]['toString']();}else if(_0x56def2['type']===_0x7bdb('0x38')&&_0x56def2['idField']&&_0x56def2[_0x7bdb('0x36')]){_0x4f43b9['custom_fields']['push']({'id':_0x56def2[_0x7bdb('0x39')],'value':_0x56def2[_0x7bdb('0x37')][_0x7bdb('0x2c')]()});}else if(_0x56def2[_0x7bdb('0x34')]===_0x7bdb('0x3a')&&_0x56def2[_0x7bdb('0x3b')]&&_0x56def2['idField']&&_0x56def2[_0x7bdb('0x36')]){_0x103585[_0x56def2[_0x7bdb('0x3b')]]&&_0x4f43b9[_0x7bdb('0x16')][_0x7bdb('0x3c')]({'id':_0x56def2[_0x7bdb('0x39')],'value':_0x103585[_0x56def2[_0x7bdb('0x3b')]][_0x7bdb('0x2c')]()});}else if(_0x56def2[_0x7bdb('0x34')]===_0x7bdb('0x3d')&&_0x56def2['Variable']&&_0x56def2['Variable'][_0x7bdb('0x3e')]&&_0x56def2[_0x7bdb('0x39')]&&_0x56def2[_0x7bdb('0x36')]){_0x103585[_0x56def2[_0x7bdb('0x3f')][_0x7bdb('0x3e')]['toLowerCase']()]&&_0x4f43b9['custom_fields'][_0x7bdb('0x3c')]({'id':_0x56def2['idField'],'value':_0x103585[_0x56def2[_0x7bdb('0x3f')]['name'][_0x7bdb('0x40')]()]['toString']()});}});}return _0x4f43b9;}exports['queue']=function(_0x21dae7,_0x2d578e,_0x192a2b,_0x29435f,_0x43c7d3,_0x2b4829){var _0x2e10f3,_0x501aff;_0x2b4829['remoteUri']=intUtil[_0x7bdb('0x41')](_0x2b4829[_0x7bdb('0x17')]);_0x2b4829[_0x7bdb('0x42')]=intUtil[_0x7bdb('0x41')](_0x2b4829[_0x7bdb('0x42')]);if(_0x43c7d3&&_0x43c7d3[_0x7bdb('0x43')]){logger[_0x7bdb('0x1a')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2d578e[_0x7bdb('0x44')]=util[_0x7bdb('0xd')](_0x7bdb('0x45'),_0x2b4829[_0x7bdb('0x42')],_0x2d578e['uniqueid'],md5(_0x2d578e[_0x7bdb('0x46')]));}else{_0x2d578e['recordingURL']='';}headers[_0x7bdb('0x47')]=getAuth(_0x2b4829);return getUser(_0x2b4829,_0x29435f[_0x7bdb('0x22')])[_0x7bdb('0x19')](function(_0x264f3a){_0x2e10f3=_0x264f3a;logger[_0x7bdb('0x1a')](_0x7bdb('0x48'),_0x2e10f3['id']);return getEndUser(_0x2b4829,_0x2d578e[_0x7bdb('0xf')],_0x2d578e[_0x7bdb('0x10')]);})[_0x7bdb('0x19')](function(_0x4b9878){_0x501aff=_0x4b9878;logger[_0x7bdb('0x1a')](_0x7bdb('0x49'),_0x501aff['id']);return getTicket(_0x2b4829,_0x2e10f3,_0x501aff,_0x192a2b,_0x2d578e);})['then'](function(_0x7c784){if(_0x7c784&&_0x7c784['id']){logger['info'](_0x7bdb('0x1b'));logger[_0x7bdb('0x1a')](_0x7bdb('0x4a'),_0x7c784['id']);logger[_0x7bdb('0x1a')](_0x7bdb('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7bdb('0xd')](_0x7bdb('0x4c'),_0x29435f[_0x7bdb('0x3e')]),_0x7bdb('0x4d'),{'uri':util[_0x7bdb('0xd')]('%s/helpdesk/tickets/%d',_0x2b4829[_0x7bdb('0x17')],_0x7c784['id'])});}})[_0x7bdb('0x4e')](function(_0x1fdf82){logger[_0x7bdb('0x4f')](_0x7bdb('0x4b'),JSON[_0x7bdb('0x2f')](_0x1fdf82));});};exports[_0x7bdb('0x50')]=function(_0x176508,_0x38c00f,_0x13b0fd,_0x58e21d,_0x189cf8,_0x58c4bc,_0x47cccd){var _0x1a7cbf,_0x451f90;_0x58c4bc['remoteUri']=intUtil[_0x7bdb('0x41')](_0x58c4bc[_0x7bdb('0x17')]);_0x58c4bc['serverUrl']=intUtil['stripTrailingSlash'](_0x58c4bc['serverUrl']);if(_0x47cccd&&_0x47cccd[_0x7bdb('0x51')]&&_0x47cccd[_0x7bdb('0x51')]!==_0x7bdb('0x52')){logger[_0x7bdb('0x1a')](_0x7bdb('0x53'),_0x7bdb('0x54'));_0x38c00f[_0x7bdb('0x44')]=util[_0x7bdb('0xd')](_0x7bdb('0x45'),_0x58c4bc[_0x7bdb('0x42')],_0x38c00f['uniqueid'],md5(_0x38c00f[_0x7bdb('0x46')]));}headers['Authorization']=getAuth(_0x58c4bc);return getUser(_0x58c4bc,_0x58e21d[_0x7bdb('0x22')])[_0x7bdb('0x19')](function(_0x5d564d){_0x1a7cbf=_0x5d564d;logger[_0x7bdb('0x1a')]('The\x20User\x20ID\x20is:',_0x1a7cbf['id']);return getEndUser(_0x58c4bc,_0x38c00f[_0x7bdb('0x55')],_0x38c00f['destcalleridnum']);})['then'](function(_0x1439c3){_0x451f90=_0x1439c3;logger[_0x7bdb('0x1a')]('The\x20Enduser\x20ID\x20is:',_0x451f90['id']);return getTicket(_0x58c4bc,_0x1a7cbf,_0x451f90,_0x13b0fd,_0x38c00f);})['then'](function(_0x49bb3f){if(_0x49bb3f&&_0x49bb3f['id']){logger[_0x7bdb('0x1a')]('Ticket\x20created!');logger['info'](_0x7bdb('0x4a'),_0x49bb3f['id']);logger[_0x7bdb('0x1a')](_0x7bdb('0x53'),_0x7bdb('0x56'));emit(util['format'](_0x7bdb('0x4c'),_0x58e21d['name']),_0x7bdb('0x4d'),{'uri':util[_0x7bdb('0xd')](_0x7bdb('0x57'),_0x58c4bc[_0x7bdb('0x17')],_0x49bb3f['id'])});}})[_0x7bdb('0x4e')](function(_0x9beb5c){logger['error'](_0x7bdb('0x53'),JSON[_0x7bdb('0x2f')](_0x9beb5c));});};exports[_0x7bdb('0x58')]=function(_0x58658e,_0x2b5493,_0x1d9927,_0x4d813f,_0x2b1887,_0x56e88f){var _0x7ecc9f,_0xc3a0cb;_0x56e88f['remoteUri']=intUtil['stripTrailingSlash'](_0x56e88f[_0x7bdb('0x17')]);_0x56e88f[_0x7bdb('0x42')]=intUtil['stripTrailingSlash'](_0x56e88f[_0x7bdb('0x42')]);if(_0x2b1887&&_0x2b1887['monitor_format']){logger[_0x7bdb('0x1a')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x2b5493[_0x7bdb('0x44')]=util[_0x7bdb('0xd')](_0x7bdb('0x45'),_0x56e88f[_0x7bdb('0x42')],_0x2b5493[_0x7bdb('0x46')],md5(_0x2b5493[_0x7bdb('0x46')]));}else{_0x2b5493[_0x7bdb('0x44')]='';}headers[_0x7bdb('0x47')]=getAuth(_0x56e88f);return getUser(_0x56e88f,_0x4d813f[_0x7bdb('0x22')])[_0x7bdb('0x19')](function(_0x414ac7){_0x7ecc9f=_0x414ac7;logger[_0x7bdb('0x1a')]('The\x20User\x20ID\x20is:',_0x7ecc9f['id']);return getEndUser(_0x56e88f,_0x2b5493[_0x7bdb('0xf')],_0x2b5493[_0x7bdb('0x10')]);})['then'](function(_0x288aa8){_0xc3a0cb=_0x288aa8;logger[_0x7bdb('0x1a')](_0x7bdb('0x49'),_0xc3a0cb['id']);return getTicket(_0x56e88f,_0x7ecc9f,_0xc3a0cb,_0x1d9927,_0x2b5493);})[_0x7bdb('0x19')](function(_0x85c7b8){if(_0x85c7b8){logger['info'](_0x7bdb('0x1b'));logger[_0x7bdb('0x1a')](_0x7bdb('0x4a'),_0x85c7b8['id']);}})['catch'](function(_0x3dbcf){logger[_0x7bdb('0x4f')](_0x7bdb('0x59'),JSON[_0x7bdb('0x2f')](_0x3dbcf));});}; \ No newline at end of file +var _0xedd9=['request-promise','md5','util','./util','../../../../config/logger','freshdesk','socket.io-emitter','localhost','application/json','info','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/api/v2/agents','length','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','abandoned','[ABANDONED]','catch'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xedd9,0xfc));var _0x9edd=function(_0x5216ad,_0x52dd40){_0x5216ad=_0x5216ad-0x0;var _0x3f69ca=_0xedd9[_0x5216ad];return _0x3f69ca;};'use strict';var _=require('lodash');var rp=require(_0x9edd('0x0'));var md5=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var intUtil=require(_0x9edd('0x3'));var logger=require(_0x9edd('0x4'))(_0x9edd('0x5'));var io=require(_0x9edd('0x6'))({'host':_0x9edd('0x7'),'port':0x18eb});var headers={'Content-Type':'application/json','Accept':_0x9edd('0x8')};function emit(_0x2cd163,_0x268f9e,_0x34c1a7){io['to'](_0x2cd163)['emit'](_0x268f9e,_0x34c1a7);}function getTicket(_0xf0b2d8,_0x571af9,_0x172522,_0x190185,_0x1355be){logger[_0x9edd('0x9')]('Creating\x20new\x20ticket...');var _0x494a24=_['merge']({'responder_id':_0x571af9['id'],'requester_id':_0x172522['id'],'name':util[_0x9edd('0xa')](_0x9edd('0xb'),_0x1355be['calleridname']),'phone':_0x1355be[_0x9edd('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9edd('0xd')](_0x190185['Subjects'],_0x1355be,'\x20'),'description':intUtil[_0x9edd('0xd')](_0x190185[_0x9edd('0xe')],_0x1355be,_0x9edd('0xf')),'tags':getTags(_0x190185[_0x9edd('0x10')],_0x9edd('0x11'))},getCustomFields(_0x190185[_0x9edd('0x12')],_0x1355be));_0x494a24[_0x9edd('0x13')]=_[_0x9edd('0x14')](_['keyBy'](_0x494a24[_0x9edd('0x13')],'id'),_0x9edd('0x15'));return request({'uri':util[_0x9edd('0xa')](_0x9edd('0x16'),_0xf0b2d8[_0x9edd('0x17')]),'method':_0x9edd('0x18'),'body':_0x494a24})[_0x9edd('0x19')](function(_0x75a4ab){logger['info'](_0x9edd('0x1a'));return _0x75a4ab;});}function getUser(_0x448996,_0x449cee){logger['info'](_0x9edd('0x1b'),_0x449cee);return request({'uri':util[_0x9edd('0xa')](_0x9edd('0x1c'),_0x448996['remoteUri']),'qs':{'email':_0x449cee}})[_0x9edd('0x19')](function(_0x5d879c){if(_0x5d879c[_0x9edd('0x1d')]){logger[_0x9edd('0x9')]('Agent\x20found!');return _['find'](_0x5d879c,function(_0x45c3ab){return _0x45c3ab['contact'][_0x9edd('0x1e')]===_0x449cee;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9edd('0xa')](_0x9edd('0x1f'),_0x448996['remoteUri'])})['then'](function(_0x341d67){logger[_0x9edd('0x9')](_0x9edd('0x20'));return _0x341d67;});}});}function getEndUser(_0x542172,_0x3741c8,_0x1dca43){logger[_0x9edd('0x9')](_0x9edd('0x21'),_0x1dca43);return request({'uri':util[_0x9edd('0xa')]('%s/api/v2/contacts',_0x542172[_0x9edd('0x17')]),'qs':{'phone':_0x1dca43}})[_0x9edd('0x19')](function(_0x3a1ea5){if(_0x3a1ea5[_0x9edd('0x1d')]){logger[_0x9edd('0x9')]('Enduser\x20found!');return _['find'](_0x3a1ea5,{'phone':_0x1dca43});}else{logger[_0x9edd('0x9')](_0x9edd('0x22'));return request({'uri':util[_0x9edd('0xa')](_0x9edd('0x23'),_0x542172[_0x9edd('0x17')]),'method':'POST','body':{'name':_0x3741c8,'phone':_0x1dca43}})['then'](function(_0x214d0a){logger[_0x9edd('0x9')](_0x9edd('0x24'));return _0x214d0a;});}});}function getAuth(_0x52746a){return util[_0x9edd('0xa')](_0x9edd('0x25'),new Buffer(_0x52746a[_0x9edd('0x26')]+':X')[_0x9edd('0x27')]('base64'));}function request(_0x2155a1){logger[_0x9edd('0x28')](_0x9edd('0x29'),JSON[_0x9edd('0x2a')](_0x2155a1));return rp(_[_0x9edd('0x2b')](_0x2155a1,{'method':_0x9edd('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x209aba,_0x1fba7b){var _0x19b6c1=[];if(_0x209aba&&_0x209aba[_0x9edd('0x1d')]>0x0){_0x19b6c1=_[_0x9edd('0x2d')](_0x209aba,_0x1fba7b);}return _0x19b6c1;}function getCustomFields(_0x138002,_0x6907a5){var _0xa55906=[];var _0x1a6c23={'custom_fields':[]};if(_0x138002['length']>0x0){_[_0x9edd('0x2e')](_0x138002,function(_0x259259){if(_0x259259[_0x9edd('0x2f')]==='string'&&_0x259259[_0x9edd('0x30')]&&!_0x259259[_0x9edd('0x31')]){_0x1a6c23[_0x259259[_0x9edd('0x30')][_0x9edd('0x32')]()]=_0x259259[_0x9edd('0x33')][_0x9edd('0x27')]();}else if(_0x259259[_0x9edd('0x2f')]===_0x9edd('0x34')&&_0x259259[_0x9edd('0x35')]&&_0x259259[_0x9edd('0x31')]){_0x1a6c23[_0x9edd('0x13')][_0x9edd('0x36')]({'id':_0x259259[_0x9edd('0x35')],'value':_0x259259[_0x9edd('0x33')]['toString']()});}else if(_0x259259[_0x9edd('0x2f')]==='variable'&&_0x259259[_0x9edd('0x37')]&&_0x259259[_0x9edd('0x35')]&&_0x259259[_0x9edd('0x31')]){_0x6907a5[_0x259259[_0x9edd('0x37')]]&&_0x1a6c23[_0x9edd('0x13')]['push']({'id':_0x259259[_0x9edd('0x35')],'value':_0x6907a5[_0x259259[_0x9edd('0x37')]][_0x9edd('0x27')]()});}else if(_0x259259[_0x9edd('0x2f')]===_0x9edd('0x38')&&_0x259259[_0x9edd('0x39')]&&_0x259259[_0x9edd('0x39')][_0x9edd('0x11')]&&_0x259259[_0x9edd('0x35')]&&_0x259259[_0x9edd('0x31')]){_0x6907a5[_0x259259['Variable'][_0x9edd('0x11')]['toLowerCase']()]&&_0x1a6c23[_0x9edd('0x13')]['push']({'id':_0x259259[_0x9edd('0x35')],'value':_0x6907a5[_0x259259[_0x9edd('0x39')][_0x9edd('0x11')]['toLowerCase']()][_0x9edd('0x27')]()});}});}return _0x1a6c23;}exports[_0x9edd('0x3a')]=function(_0x2f8f61,_0x48958a,_0x1b5a43,_0x51ad91,_0x1fc4fb,_0xfbc492){var _0x50be2c,_0x315f52;_0xfbc492[_0x9edd('0x17')]=intUtil[_0x9edd('0x3b')](_0xfbc492[_0x9edd('0x17')]);_0xfbc492['serverUrl']=intUtil[_0x9edd('0x3b')](_0xfbc492['serverUrl']);if(_0x1fc4fb&&_0x1fc4fb[_0x9edd('0x3c')]){logger[_0x9edd('0x9')]('[QUEUE]',_0x9edd('0x3d'));_0x48958a['recordingURL']=util['format'](_0x9edd('0x3e'),_0xfbc492[_0x9edd('0x3f')],_0x48958a[_0x9edd('0x40')],md5(_0x48958a[_0x9edd('0x40')]));}else{_0x48958a[_0x9edd('0x41')]='';}headers[_0x9edd('0x42')]=getAuth(_0xfbc492);return getUser(_0xfbc492,_0x51ad91[_0x9edd('0x1e')])[_0x9edd('0x19')](function(_0x18c149){_0x50be2c=_0x18c149;logger[_0x9edd('0x9')](_0x9edd('0x43'),_0x50be2c['id']);return getEndUser(_0xfbc492,_0x48958a[_0x9edd('0x44')],_0x48958a[_0x9edd('0xc')]);})[_0x9edd('0x19')](function(_0x46e9f4){_0x315f52=_0x46e9f4;logger['info'](_0x9edd('0x45'),_0x315f52['id']);return getTicket(_0xfbc492,_0x50be2c,_0x315f52,_0x1b5a43,_0x48958a);})[_0x9edd('0x19')](function(_0x2231c1){if(_0x2231c1&&_0x2231c1['id']){logger[_0x9edd('0x9')](_0x9edd('0x1a'));logger[_0x9edd('0x9')](_0x9edd('0x46'),_0x2231c1['id']);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9edd('0xa')]('user:%s',_0x51ad91[_0x9edd('0x11')]),_0x9edd('0x47'),{'uri':util[_0x9edd('0xa')](_0x9edd('0x48'),_0xfbc492[_0x9edd('0x17')],_0x2231c1['id'])});}})['catch'](function(_0x387fb8){logger[_0x9edd('0x49')](_0x9edd('0x4a'),JSON['stringify'](_0x387fb8));});};exports[_0x9edd('0x4b')]=function(_0xfd7bd1,_0x2159aa,_0x293b03,_0x1d78c4,_0x35bdec,_0x4d4f33,_0x441e4a){var _0x237e91,_0x596b71;_0x4d4f33[_0x9edd('0x17')]=intUtil[_0x9edd('0x3b')](_0x4d4f33['remoteUri']);_0x4d4f33[_0x9edd('0x3f')]=intUtil[_0x9edd('0x3b')](_0x4d4f33[_0x9edd('0x3f')]);if(_0x441e4a&&_0x441e4a['recordingFormat']&&_0x441e4a[_0x9edd('0x4c')]!==_0x9edd('0x4d')){logger[_0x9edd('0x9')](_0x9edd('0x4e'),'Recording\x20is\x20enabled!');_0x2159aa[_0x9edd('0x41')]=util[_0x9edd('0xa')](_0x9edd('0x3e'),_0x4d4f33['serverUrl'],_0x2159aa[_0x9edd('0x40')],md5(_0x2159aa[_0x9edd('0x40')]));}headers['Authorization']=getAuth(_0x4d4f33);return getUser(_0x4d4f33,_0x1d78c4[_0x9edd('0x1e')])['then'](function(_0x336494){_0x237e91=_0x336494;logger[_0x9edd('0x9')](_0x9edd('0x43'),_0x237e91['id']);return getEndUser(_0x4d4f33,_0x2159aa[_0x9edd('0x4f')],_0x2159aa[_0x9edd('0x50')]);})[_0x9edd('0x19')](function(_0x2334d4){_0x596b71=_0x2334d4;logger[_0x9edd('0x9')](_0x9edd('0x45'),_0x596b71['id']);return getTicket(_0x4d4f33,_0x237e91,_0x596b71,_0x293b03,_0x2159aa);})[_0x9edd('0x19')](function(_0x31272d){if(_0x31272d&&_0x31272d['id']){logger['info'](_0x9edd('0x1a'));logger[_0x9edd('0x9')](_0x9edd('0x46'),_0x31272d['id']);logger['info'](_0x9edd('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1d78c4[_0x9edd('0x11')]),_0x9edd('0x47'),{'uri':util[_0x9edd('0xa')](_0x9edd('0x48'),_0x4d4f33['remoteUri'],_0x31272d['id'])});}})['catch'](function(_0x4e3c3e){logger[_0x9edd('0x49')](_0x9edd('0x4e'),JSON[_0x9edd('0x2a')](_0x4e3c3e));});};exports[_0x9edd('0x51')]=function(_0x2e2920,_0x41ec97,_0x25906c,_0x1e3087,_0x4eb780,_0x16dfdc){var _0x49d0ce,_0x421e82;_0x16dfdc[_0x9edd('0x17')]=intUtil['stripTrailingSlash'](_0x16dfdc[_0x9edd('0x17')]);_0x16dfdc[_0x9edd('0x3f')]=intUtil[_0x9edd('0x3b')](_0x16dfdc['serverUrl']);if(_0x4eb780&&_0x4eb780[_0x9edd('0x3c')]){logger[_0x9edd('0x9')](_0x9edd('0x52'),_0x9edd('0x3d'));_0x41ec97[_0x9edd('0x41')]=util[_0x9edd('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x16dfdc['serverUrl'],_0x41ec97[_0x9edd('0x40')],md5(_0x41ec97['uniqueid']));}else{_0x41ec97[_0x9edd('0x41')]='';}headers[_0x9edd('0x42')]=getAuth(_0x16dfdc);return getUser(_0x16dfdc,_0x1e3087[_0x9edd('0x1e')])[_0x9edd('0x19')](function(_0x5df1d7){_0x49d0ce=_0x5df1d7;logger[_0x9edd('0x9')]('The\x20User\x20ID\x20is:',_0x49d0ce['id']);return getEndUser(_0x16dfdc,_0x41ec97[_0x9edd('0x44')],_0x41ec97[_0x9edd('0xc')]);})[_0x9edd('0x19')](function(_0x5ca123){_0x421e82=_0x5ca123;logger[_0x9edd('0x9')]('The\x20Enduser\x20ID\x20is:',_0x421e82['id']);return getTicket(_0x16dfdc,_0x49d0ce,_0x421e82,_0x25906c,_0x41ec97);})[_0x9edd('0x19')](function(_0x4e1eda){if(_0x4e1eda){logger['info'](_0x9edd('0x1a'));logger['info'](_0x9edd('0x46'),_0x4e1eda['id']);}})[_0x9edd('0x53')](function(_0x307a61){logger['error'](_0x9edd('0x52'),JSON[_0x9edd('0x2a')](_0x307a61));});}; \ 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 413f439..25d6a29 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 _0x3322=['toLowerCase','data2','find','Configurations','queue','outbound','log','abandoned','unknown\x20integration','../../../../config/logger','data1','error','[EXEC]','format','data3','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','exec','includes'];(function(_0x400e8a,_0x350494){var _0x5c07a9=function(_0x5ef6cf){while(--_0x5ef6cf){_0x400e8a['push'](_0x400e8a['shift']());}};_0x5c07a9(++_0x350494);}(_0x3322,0xe9));var _0x2332=function(_0x6ca37c,_0x23b09f){_0x6ca37c=_0x6ca37c-0x0;var _0x4db7a6=_0x3322[_0x6ca37c];return _0x4db7a6;};'use strict';var _=require(_0x2332('0x0'));var util=require('util');var zendesk=require(_0x2332('0x1'));var salesforce=require(_0x2332('0x2'));var sugarcrm=require(_0x2332('0x3'));var freshdesk=require(_0x2332('0x4'));var zoho=require('./zoho');var desk=require(_0x2332('0x5'));var vtiger=require(_0x2332('0x6'));var integrations=[_0x2332('0x7'),_0x2332('0x8'),_0x2332('0x9'),_0x2332('0xa'),_0x2332('0xb'),'desk',_0x2332('0xc')];exports[_0x2332('0xd')]=function(_0x1e55eb,_0x1526dc,_0x1c28ff,_0x1db16a,_0x3c4afa,_0x20597d){if(_0x1c28ff){if(_[_0x2332('0xe')](integrations,_0x1e55eb['data1'][_0x2332('0xf')]())){try{var _0x3df1f0=null;var _0x53bae3='';var _0x14f420=_0x1c28ff[_0x1e55eb['data1'][_0x2332('0xf')]()];if(_0x14f420){var _0x3b376d=_0x14f420[_0x1e55eb[_0x2332('0x10')]];if(_0x3b376d){var _0x2f5a55=_[_0x2332('0x11')](_0x3b376d[_0x2332('0x12')],{'id':parseInt(_0x1e55eb['data3'],0xa)});if(_0x2f5a55){if(_0x1db16a){if(_0x3c4afa&&_0x1526dc[_0x2332('0x13')]){_0x53bae3=_0x2332('0x13');}else if(_0x1526dc['routeId']){_0x53bae3=_0x2332('0x14');}else{console[_0x2332('0x15')]('EVENT\x20UNKNOWN',_0x1526dc);}}else{_0x53bae3=_0x2332('0x16');}switch(_0x1e55eb['data1'][_0x2332('0xf')]()){case _0x2332('0x7'):zendesk[_0x53bae3](_0x1e55eb,_0x1526dc,_0x2f5a55,_0x1db16a,_0x3c4afa,_0x3b376d,_0x20597d);break;case _0x2332('0x8'):salesforce[_0x53bae3](_0x1e55eb,_0x1526dc,_0x2f5a55,_0x1db16a,_0x3c4afa,_0x3b376d,_0x20597d);break;case'sugarcrm':sugarcrm[_0x53bae3](_0x1e55eb,_0x1526dc,_0x2f5a55,_0x1db16a,_0x3c4afa,_0x3b376d,_0x20597d);break;case'freshdesk':freshdesk[_0x53bae3](_0x1e55eb,_0x1526dc,_0x2f5a55,_0x1db16a,_0x3c4afa,_0x3b376d,_0x20597d);break;case _0x2332('0xb'):zoho[_0x53bae3](_0x1e55eb,_0x1526dc,_0x2f5a55,_0x1db16a,_0x3c4afa,_0x3b376d,_0x20597d);break;case'desk':desk[_0x53bae3](_0x1e55eb,_0x1526dc,_0x2f5a55,_0x1db16a,_0x3c4afa,_0x3b376d,_0x20597d);break;case _0x2332('0xc'):vtiger[_0x53bae3](_0x1e55eb,_0x1526dc,_0x2f5a55,_0x1db16a,_0x3c4afa,_0x3b376d,_0x20597d);break;default:console[_0x2332('0x15')](_0x2332('0x17'));}}else{_0x3df1f0=require(_0x2332('0x18'))(_0x1e55eb[_0x2332('0x19')]['toLowerCase']());_0x3df1f0[_0x2332('0x1a')](_0x2332('0x1b'),util[_0x2332('0x1c')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1e55eb[_0x2332('0x19')][_0x2332('0xf')](),_0x1e55eb[_0x2332('0x1d')]));}}else{_0x3df1f0=require(_0x2332('0x18'))(_0x1e55eb[_0x2332('0x19')][_0x2332('0xf')]());_0x3df1f0['error']('[EXEC]',util[_0x2332('0x1c')](_0x2332('0x1e'),_0x1e55eb[_0x2332('0x19')][_0x2332('0xf')](),_0x1e55eb[_0x2332('0x10')]));}}else{}}catch(_0x463ab9){console['error'](_0x463ab9);}}}}; \ No newline at end of file +var _0x9858=['EVENT\x20UNKNOWN','abandoned','zendesk','salesforce','freshdesk','desk','log','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','sugarcrm','zoho','vtiger','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound'];(function(_0x1ba2bc,_0x1fca6f){var _0x2ee25d=function(_0x5a3e1e){while(--_0x5a3e1e){_0x1ba2bc['push'](_0x1ba2bc['shift']());}};_0x2ee25d(++_0x1fca6f);}(_0x9858,0x116));var _0x8985=function(_0x4056e0,_0x4b824e){_0x4056e0=_0x4056e0-0x0;var _0x4000a2=_0x9858[_0x4056e0];return _0x4000a2;};'use strict';var _=require(_0x8985('0x0'));var util=require(_0x8985('0x1'));var zendesk=require(_0x8985('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x8985('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x8985('0x4'));var desk=require(_0x8985('0x5'));var vtiger=require(_0x8985('0x6'));var integrations=['zendesk','salesforce',_0x8985('0x7'),'freshdesk',_0x8985('0x8'),'desk',_0x8985('0x9')];exports[_0x8985('0xa')]=function(_0x29bdf1,_0x139458,_0x533afe,_0xdbb9f9,_0x3ff09a,_0x120d1c){if(_0x533afe){if(_[_0x8985('0xb')](integrations,_0x29bdf1[_0x8985('0xc')][_0x8985('0xd')]())){try{var _0x557b50=null;var _0x520ae9='';var _0x123476=_0x533afe[_0x29bdf1[_0x8985('0xc')]['toLowerCase']()];if(_0x123476){var _0x34ed86=_0x123476[_0x29bdf1[_0x8985('0xe')]];if(_0x34ed86){var _0x4320de=_['find'](_0x34ed86[_0x8985('0xf')],{'id':parseInt(_0x29bdf1[_0x8985('0x10')],0xa)});if(_0x4320de){if(_0xdbb9f9){if(_0x3ff09a&&_0x139458[_0x8985('0x11')]){_0x520ae9='queue';}else if(_0x139458['routeId']){_0x520ae9=_0x8985('0x12');}else{console['log'](_0x8985('0x13'),_0x139458);}}else{_0x520ae9=_0x8985('0x14');}switch(_0x29bdf1['data1'][_0x8985('0xd')]()){case _0x8985('0x15'):zendesk[_0x520ae9](_0x29bdf1,_0x139458,_0x4320de,_0xdbb9f9,_0x3ff09a,_0x34ed86,_0x120d1c);break;case _0x8985('0x16'):salesforce[_0x520ae9](_0x29bdf1,_0x139458,_0x4320de,_0xdbb9f9,_0x3ff09a,_0x34ed86,_0x120d1c);break;case'sugarcrm':sugarcrm[_0x520ae9](_0x29bdf1,_0x139458,_0x4320de,_0xdbb9f9,_0x3ff09a,_0x34ed86,_0x120d1c);break;case _0x8985('0x17'):freshdesk[_0x520ae9](_0x29bdf1,_0x139458,_0x4320de,_0xdbb9f9,_0x3ff09a,_0x34ed86,_0x120d1c);break;case _0x8985('0x8'):zoho[_0x520ae9](_0x29bdf1,_0x139458,_0x4320de,_0xdbb9f9,_0x3ff09a,_0x34ed86,_0x120d1c);break;case _0x8985('0x18'):desk[_0x520ae9](_0x29bdf1,_0x139458,_0x4320de,_0xdbb9f9,_0x3ff09a,_0x34ed86,_0x120d1c);break;case'vtiger':vtiger[_0x520ae9](_0x29bdf1,_0x139458,_0x4320de,_0xdbb9f9,_0x3ff09a,_0x34ed86,_0x120d1c);break;default:console[_0x8985('0x19')](_0x8985('0x1a'));}}else{_0x557b50=require(_0x8985('0x1b'))(_0x29bdf1['data1'][_0x8985('0xd')]());_0x557b50[_0x8985('0x1c')]('[EXEC]',util[_0x8985('0x1d')](_0x8985('0x1e'),_0x29bdf1[_0x8985('0xc')]['toLowerCase'](),_0x29bdf1['data3']));}}else{_0x557b50=require(_0x8985('0x1b'))(_0x29bdf1[_0x8985('0xc')]['toLowerCase']());_0x557b50['error'](_0x8985('0x1f'),util['format'](_0x8985('0x20'),_0x29bdf1[_0x8985('0xc')][_0x8985('0xd')](),_0x29bdf1[_0x8985('0xe')]));}}else{}}catch(_0x355811){console['error'](_0x355811);}}}}; \ 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 8ce626a..1e03464 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 _0x17f4=['stringify','abandoned','[ABANDONED]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','request-promise','bluebird','md5','jsforce','util','./util','salesforce','socket.io-emitter','localhost','utc','Subjects','getString','Descriptions','WhoId','sobject','create','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','length','Lead','contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','Company','No\x20Company','upperFirst','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','clientId','username','Connection\x20established.','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','catch'];(function(_0x435678,_0x4cb7e9){var _0x1611e4=function(_0x26b15b){while(--_0x26b15b){_0x435678['push'](_0x435678['shift']());}};_0x1611e4(++_0x4cb7e9);}(_0x17f4,0x12e));var _0x417f=function(_0x411631,_0x5cc5c3){_0x411631=_0x411631-0x0;var _0x490190=_0x17f4[_0x411631];return _0x490190;};'use strict';var _=require('lodash');var rp=require(_0x417f('0x0'));var moment=require('moment');var BPromise=require(_0x417f('0x1'));var md5=require(_0x417f('0x2'));var jsforce=require(_0x417f('0x3'));var util=require(_0x417f('0x4'));var intUtil=require(_0x417f('0x5'));var logger=require('../../../../config/logger')(_0x417f('0x6'));var io=require(_0x417f('0x7'))({'host':_0x417f('0x8'),'port':0x18eb});function emit(_0x4b1688,_0x2c51df,_0x5248db){io['to'](_0x4b1688)['emit'](_0x2c51df,_0x5248db);}function getTicket(_0x2e60a4,_0x5559c7,_0x355024,_0x54307c,_0x5e61ff,_0x415d54,_0x42e825){var _0x25439c=_['merge']({'OwnerId':_0x5559c7['id'],'ActivityDate':moment[_0x417f('0x9')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x54307c[_0x417f('0xa')],_0x5e61ff,'\x20'),'Description':intUtil[_0x417f('0xb')](_0x54307c[_0x417f('0xc')],_0x5e61ff,'\x0a')},getCustomFields(_0x415d54,_0x5e61ff));if(_0x355024){_0x25439c[_0x417f('0xd')]=_0x355024['id'];}return _0x42e825[_0x417f('0xe')]('Task')[_0x417f('0xf')](_0x25439c);}function getUser(_0xb53a67,_0x51f8f0,_0x5e8ce4){var _0x188461={'Email':_0x51f8f0};var _0x485ba8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5e8ce4[_0x417f('0xe')](_0x417f('0x10'))[_0x417f('0x11')](_0x188461,_0x485ba8)[_0x417f('0x12')]()[_0x417f('0x13')](function(_0x5f4e8b){if(_0x5f4e8b['length']){var _0x497fdb=_[_0x417f('0x11')](_0x5f4e8b,function(_0x3db350){return _0x3db350[_0x417f('0x14')]===_0x51f8f0;});if(_0x497fdb){logger['info'](_0x417f('0x15'),_0x51f8f0);return BPromise[_0x417f('0x16')]({'id':_0x497fdb['Id'],'name':_0x497fdb[_0x417f('0x17')]});}}else{logger[_0x417f('0x18')](_0x417f('0x19'),_0x51f8f0);return _0x5e8ce4[_0x417f('0x1a')]()['then'](function(_0x4ad673){return BPromise[_0x417f('0x16')]({'id':_0x4ad673[_0x417f('0x1b')],'name':_0x4ad673[_0x417f('0x1c')]});});}});}function getEndUser(_0x1bda23,_0x22154b,_0x372b96,_0x43e48a,_0x5c20f6){var _0x32fa1d={'Phone':_0x43e48a};var _0x2324c9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x417f('0x16')]()[_0x417f('0x13')](function(){logger[_0x417f('0x18')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x43e48a,_0x22154b[_0x417f('0x1d')]);switch(_0x22154b[_0x417f('0x1d')]){case _0x417f('0x1e'):return _0x5c20f6['sobject']('Contact')[_0x417f('0x11')](_0x32fa1d,_0x2324c9)[_0x417f('0x12')]()[_0x417f('0x13')](function(_0x597e16){if(_0x597e16&&_0x597e16[_0x417f('0x1f')]){return _0x597e16;}else{return _0x5c20f6[_0x417f('0xe')](_0x417f('0x20'))[_0x417f('0x11')](_0x32fa1d,_0x2324c9);}});case _0x417f('0x21'):return _0x5c20f6[_0x417f('0xe')](_0x417f('0x22'))['find'](_0x32fa1d,_0x2324c9)[_0x417f('0x12')]();case _0x417f('0x23'):return _0x5c20f6[_0x417f('0xe')](_0x417f('0x20'))['find'](_0x32fa1d,_0x2324c9);default:return null;}})[_0x417f('0x13')](function(_0x4e6da2){if(_0x4e6da2&&_0x4e6da2['length']){var _0x8e140f=_[_0x417f('0x11')](_0x4e6da2,function(_0x4e8eb3){return _0x4e8eb3[_0x417f('0x24')]===_0x43e48a;});if(_0x8e140f){return BPromise[_0x417f('0x16')]({'id':_0x8e140f['Id'],'name':_0x8e140f[_0x417f('0x17')],'phone':_0x8e140f[_0x417f('0x24')]});}}})[_0x417f('0x13')](function(_0x1afd61){if(_0x1afd61){logger[_0x417f('0x18')](_0x417f('0x25'),_0x43e48a);return BPromise[_0x417f('0x16')](_0x1afd61);}else{logger['info'](_0x417f('0x26'),_0x43e48a);var _0xc5bb37={'LastName':_0x372b96!==_0x417f('0x27')?_0x372b96:util[_0x417f('0x28')]('Caller\x20-\x20%s',_0x43e48a),'Phone':_0x43e48a};if(_0x22154b['moduleCreate']){switch(_0x22154b['moduleCreate']){case _0x417f('0x21'):logger['info'](_0x417f('0x29'),_0x43e48a,_0x22154b[_0x417f('0x2a')]);break;case _0x417f('0x23'):logger[_0x417f('0x18')](_0x417f('0x29'),_0x43e48a,_0x22154b[_0x417f('0x2a')]);_0xc5bb37[_0x417f('0x2b')]=_0x417f('0x2c');break;default:return null;}}return _0x5c20f6[_0x417f('0xe')](_[_0x417f('0x2d')](_0x22154b[_0x417f('0x2a')]))[_0x417f('0xf')](_0xc5bb37);}});}function getCustomFields(_0x452fb5,_0x64fca7){var _0x101f27={};if(_0x452fb5[_0x417f('0x1f')]>0x0){_[_0x417f('0x2e')](_0x452fb5,function(_0x3b77a9){if(_0x3b77a9[_0x417f('0x2f')]==='string'&&_0x3b77a9[_0x417f('0x30')]){_0x101f27[_0x3b77a9[_0x417f('0x30')]]=_0x3b77a9[_0x417f('0x31')][_0x417f('0x32')]();}else if(_0x3b77a9[_0x417f('0x2f')]===_0x417f('0x33')&&_0x3b77a9['variableName']&&_0x3b77a9[_0x417f('0x30')]){_0x64fca7[_0x3b77a9[_0x417f('0x34')]]&&(_0x101f27[_0x3b77a9['idField']]=_0x64fca7[_0x3b77a9[_0x417f('0x34')]][_0x417f('0x32')]());}else if(_0x3b77a9[_0x417f('0x2f')]===_0x417f('0x35')&&_0x3b77a9[_0x417f('0x36')]&&_0x3b77a9['Variable'][_0x417f('0x37')]&&_0x3b77a9['idField']){_0x64fca7[_0x3b77a9['Variable'][_0x417f('0x37')][_0x417f('0x38')]()]&&(_0x101f27[_0x3b77a9[_0x417f('0x30')]]=_0x64fca7[_0x3b77a9[_0x417f('0x36')][_0x417f('0x37')]['toLowerCase']()][_0x417f('0x32')]());}});}return _0x101f27;}function getConnection(_0x15c774){var _0x494897=_0x15c774[_0x417f('0x39')][_0x417f('0x3a')](_0x15c774['securityToken']);var _0x12c34a=new jsforce[(_0x417f('0x3b'))]({'oauth2':{'loginUrl':_0x15c774[_0x417f('0x3c')]||'https://login.salesforce.com','clientId':_0x15c774[_0x417f('0x3d')],'clientSecret':_0x15c774['clientSecret']}});return _0x12c34a['login'](_0x15c774[_0x417f('0x3e')],_0x494897)[_0x417f('0x13')](function(){logger[_0x417f('0x18')](_0x417f('0x3f'));return _0x12c34a;});}exports['queue']=function(_0x1dce24,_0x56e0ee,_0x275942,_0x462aa4,_0x2cacab,_0x267244){var _0x12d8ae,_0x34f596,_0x51ca74,_0x178b61;_0x267244[_0x417f('0x40')]=intUtil['stripTrailingSlash'](_0x267244['serverUrl']);if(_0x2cacab&&_0x2cacab[_0x417f('0x41')]){logger[_0x417f('0x18')](_0x417f('0x42'),_0x417f('0x43'));_0x56e0ee[_0x417f('0x44')]=util[_0x417f('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x267244['serverUrl'],_0x56e0ee[_0x417f('0x45')],md5(_0x56e0ee[_0x417f('0x45')]));}else{_0x56e0ee[_0x417f('0x44')]='';}return getConnection(_0x267244)[_0x417f('0x13')](function(_0x12739a){_0x178b61=_0x12739a;return getUser(_0x267244,_0x462aa4[_0x417f('0x46')],_0x178b61);})['then'](function(_0x3010c5){_0x12d8ae=_0x3010c5;return getEndUser(_0x267244,_0x275942,_0x56e0ee[_0x417f('0x47')],_0x56e0ee['calleridnum'],_0x178b61);})[_0x417f('0x13')](function(_0x40a4bf){_0x34f596=_0x40a4bf;return getTicket(_0x267244,_0x12d8ae,_0x34f596,_0x275942,_0x56e0ee,_0x275942[_0x417f('0x48')],_0x178b61);})[_0x417f('0x13')](function(_0x50c8c2){_0x51ca74=_0x50c8c2;logger['info'](_0x417f('0x49'),_0x51ca74['id']);logger[_0x417f('0x18')](_0x417f('0x4a'),_0x51ca74['id'],_0x462aa4[_0x417f('0x37')],_0x267244[_0x417f('0x2f')]);switch(_0x267244[_0x417f('0x2f')]){case _0x417f('0x4b'):emit(util['format'](_0x417f('0x4c'),_0x462aa4[_0x417f('0x37')]),'trigger:salesforce:display',{'recordId':_0x51ca74['id']});break;case _0x417f('0x4d'):emit(util[_0x417f('0x28')](_0x417f('0x4c'),_0x462aa4[_0x417f('0x37')]),'trigger:browser:url',{'uri':util['format'](_0x417f('0x4e'),_0x178b61[_0x417f('0x4f')],_0x51ca74['id'])});break;default:logger[_0x417f('0x50')](_0x417f('0x51'));}})['catch'](function(_0x5e7c66){logger[_0x417f('0x50')](_0x417f('0x42'),JSON['stringify'](_0x5e7c66));});};exports[_0x417f('0x52')]=function(_0x5dac8c,_0x4ec312,_0x26087,_0x321ffe,_0x4c2f90,_0x5a1c3b,_0x57bea2){var _0x96bb63,_0x3f6a81,_0x1d264d,_0x14dfdf;_0x5a1c3b[_0x417f('0x40')]=intUtil['stripTrailingSlash'](_0x5a1c3b['serverUrl']);if(_0x57bea2&&_0x57bea2[_0x417f('0x53')]&&_0x57bea2['recordingFormat']!==_0x417f('0x54')){logger[_0x417f('0x18')](_0x417f('0x55'),_0x417f('0x43'));_0x4ec312[_0x417f('0x44')]=util[_0x417f('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a1c3b['serverUrl'],_0x4ec312['uniqueid'],md5(_0x4ec312['uniqueid']));}return getConnection(_0x5a1c3b)[_0x417f('0x13')](function(_0x13a857){_0x14dfdf=_0x13a857;return getUser(_0x5a1c3b,_0x321ffe[_0x417f('0x46')],_0x14dfdf);})['then'](function(_0x574c38){_0x96bb63=_0x574c38;return getEndUser(_0x5a1c3b,_0x26087,_0x4ec312[_0x417f('0x56')],_0x4ec312[_0x417f('0x57')],_0x14dfdf);})[_0x417f('0x13')](function(_0x5c6552){_0x3f6a81=_0x5c6552;return getTicket(_0x5a1c3b,_0x96bb63,_0x3f6a81,_0x26087,_0x4ec312,_0x26087[_0x417f('0x48')],_0x14dfdf);})[_0x417f('0x13')](function(_0x423204){_0x1d264d=_0x423204;logger[_0x417f('0x18')](_0x417f('0x58'),_0x1d264d['id']);logger[_0x417f('0x18')](_0x417f('0x59'),_0x1d264d['id'],_0x321ffe['name'],_0x5a1c3b[_0x417f('0x2f')]);switch(_0x5a1c3b[_0x417f('0x2f')]){case _0x417f('0x4b'):emit(util[_0x417f('0x28')](_0x417f('0x4c'),_0x321ffe[_0x417f('0x37')]),_0x417f('0x5a'),{'recordId':_0x1d264d['id']});break;case _0x417f('0x4d'):emit(util[_0x417f('0x28')](_0x417f('0x4c'),_0x321ffe[_0x417f('0x37')]),_0x417f('0x5b'),{'uri':util[_0x417f('0x28')](_0x417f('0x4e'),_0x14dfdf[_0x417f('0x4f')],_0x1d264d['id'])});break;default:logger[_0x417f('0x50')]('[OUTBOUND]',_0x417f('0x5c'));}})[_0x417f('0x5d')](function(_0x15b75d){logger['error'](_0x417f('0x55'),JSON[_0x417f('0x5e')](_0x15b75d));});};exports[_0x417f('0x5f')]=function(_0x19779c,_0x558c8e,_0x48e6fa,_0x3dbb97,_0x16df56,_0x1b8124){var _0x3e3787,_0x4f9a13,_0xa312b4,_0x4208d4;_0x1b8124['serverUrl']=intUtil['stripTrailingSlash'](_0x1b8124[_0x417f('0x40')]);if(_0x16df56&&_0x16df56['monitor_format']){logger['info'](_0x417f('0x60'),_0x417f('0x43'));_0x558c8e[_0x417f('0x44')]=util[_0x417f('0x28')](_0x417f('0x61'),_0x1b8124[_0x417f('0x40')],_0x558c8e['uniqueid'],md5(_0x558c8e[_0x417f('0x45')]));}else{_0x558c8e[_0x417f('0x44')]='';}return getConnection(_0x1b8124)[_0x417f('0x13')](function(_0x5a5dfe){_0x4208d4=_0x5a5dfe;return getUser(_0x1b8124,_0x3dbb97['email'],_0x4208d4);})[_0x417f('0x13')](function(_0x3b4252){_0x3e3787=_0x3b4252;return getEndUser(_0x1b8124,_0x48e6fa,_0x558c8e[_0x417f('0x47')],_0x558c8e[_0x417f('0x62')],_0x4208d4);})[_0x417f('0x13')](function(_0x14b911){_0x4f9a13=_0x14b911;return getTicket(_0x1b8124,_0x3e3787,_0x4f9a13,_0x48e6fa,_0x558c8e,_0x48e6fa[_0x417f('0x48')],_0x4208d4);})[_0x417f('0x13')](function(_0x51ea23){_0xa312b4=_0x51ea23;logger[_0x417f('0x18')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0xa312b4['id']);logger['info']('[ABANDONED]\x20Integration\x20account\x20type\x20%s.',_0x1b8124['type']);})[_0x417f('0x5d')](function(_0x19895e){logger[_0x417f('0x50')](_0x417f('0x60'),JSON['stringify'](_0x19895e));});}; \ No newline at end of file +var _0x3208=['toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','stringify','abandoned','[ABANDONED]','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','salesforce','socket.io-emitter','localhost','emit','merge','utc','getString','Subjects','WhoId','sobject','create','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','info','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','execute','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Company','forEach','type','string','idField','content','toString','variable','variableName','Variable','name'];(function(_0x2e4a84,_0x3de6e1){var _0x16ffe8=function(_0x43382f){while(--_0x43382f){_0x2e4a84['push'](_0x2e4a84['shift']());}};_0x16ffe8(++_0x3de6e1);}(_0x3208,0x15e));var _0x8320=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3208[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x8320('0x0'));var rp=require(_0x8320('0x1'));var moment=require('moment');var BPromise=require(_0x8320('0x2'));var md5=require(_0x8320('0x3'));var jsforce=require(_0x8320('0x4'));var util=require(_0x8320('0x5'));var intUtil=require('./util');var logger=require('../../../../config/logger')(_0x8320('0x6'));var io=require(_0x8320('0x7'))({'host':_0x8320('0x8'),'port':0x18eb});function emit(_0x13ee67,_0x29f25f,_0x2fb0af){io['to'](_0x13ee67)[_0x8320('0x9')](_0x29f25f,_0x2fb0af);}function getTicket(_0x3b16aa,_0x3c34a1,_0x396590,_0x8cffd8,_0x41b635,_0x5e05da,_0x278467){var _0x1c71b6=_[_0x8320('0xa')]({'OwnerId':_0x3c34a1['id'],'ActivityDate':moment[_0x8320('0xb')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x8320('0xc')](_0x8cffd8[_0x8320('0xd')],_0x41b635,'\x20'),'Description':intUtil[_0x8320('0xc')](_0x8cffd8['Descriptions'],_0x41b635,'\x0a')},getCustomFields(_0x5e05da,_0x41b635));if(_0x396590){_0x1c71b6[_0x8320('0xe')]=_0x396590['id'];}return _0x278467[_0x8320('0xf')]('Task')[_0x8320('0x10')](_0x1c71b6);}function getUser(_0x212aa5,_0xe649ac,_0x5c569a){var _0x740907={'Email':_0xe649ac};var _0x48918e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5c569a[_0x8320('0xf')](_0x8320('0x11'))[_0x8320('0x12')](_0x740907,_0x48918e)['execute']()[_0x8320('0x13')](function(_0x2af318){if(_0x2af318[_0x8320('0x14')]){var _0x3cc8ef=_[_0x8320('0x12')](_0x2af318,function(_0x387479){return _0x387479[_0x8320('0x15')]===_0xe649ac;});if(_0x3cc8ef){logger['info'](_0x8320('0x16'),_0xe649ac);return BPromise[_0x8320('0x17')]({'id':_0x3cc8ef['Id'],'name':_0x3cc8ef[_0x8320('0x18')]});}}else{logger['info'](_0x8320('0x19'),_0xe649ac);return _0x5c569a[_0x8320('0x1a')]()[_0x8320('0x13')](function(_0x3ed0bd){return BPromise[_0x8320('0x17')]({'id':_0x3ed0bd[_0x8320('0x1b')],'name':_0x3ed0bd[_0x8320('0x1c')]});});}});}function getEndUser(_0x4433e9,_0x396d36,_0x5965b3,_0x4ce5bc,_0x5a0339){var _0x2a467c={'Phone':_0x4ce5bc};var _0xde9312={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x8320('0x13')](function(){logger[_0x8320('0x1d')](_0x8320('0x1e'),_0x4ce5bc,_0x396d36[_0x8320('0x1f')]);switch(_0x396d36[_0x8320('0x1f')]){case _0x8320('0x20'):return _0x5a0339[_0x8320('0xf')](_0x8320('0x21'))[_0x8320('0x12')](_0x2a467c,_0xde9312)['execute']()[_0x8320('0x13')](function(_0x2d3a0c){if(_0x2d3a0c&&_0x2d3a0c[_0x8320('0x14')]){return _0x2d3a0c;}else{return _0x5a0339[_0x8320('0xf')](_0x8320('0x22'))[_0x8320('0x12')](_0x2a467c,_0xde9312);}});case _0x8320('0x23'):return _0x5a0339[_0x8320('0xf')](_0x8320('0x21'))[_0x8320('0x12')](_0x2a467c,_0xde9312)[_0x8320('0x24')]();case _0x8320('0x25'):return _0x5a0339[_0x8320('0xf')]('Lead')[_0x8320('0x12')](_0x2a467c,_0xde9312);default:return null;}})[_0x8320('0x13')](function(_0x4e30bf){if(_0x4e30bf&&_0x4e30bf['length']){var _0x18e9c0=_[_0x8320('0x12')](_0x4e30bf,function(_0x343457){return _0x343457[_0x8320('0x26')]===_0x4ce5bc;});if(_0x18e9c0){return BPromise[_0x8320('0x17')]({'id':_0x18e9c0['Id'],'name':_0x18e9c0[_0x8320('0x18')],'phone':_0x18e9c0[_0x8320('0x26')]});}}})[_0x8320('0x13')](function(_0x533eb0){if(_0x533eb0){logger['info'](_0x8320('0x27'),_0x4ce5bc);return BPromise[_0x8320('0x17')](_0x533eb0);}else{logger[_0x8320('0x1d')](_0x8320('0x28'),_0x4ce5bc);var _0x186c34={'LastName':_0x5965b3!==''?_0x5965b3:util['format'](_0x8320('0x29'),_0x4ce5bc),'Phone':_0x4ce5bc};if(_0x396d36['moduleCreate']){switch(_0x396d36['moduleCreate']){case _0x8320('0x23'):logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4ce5bc,_0x396d36[_0x8320('0x2a')]);break;case _0x8320('0x25'):logger[_0x8320('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4ce5bc,_0x396d36[_0x8320('0x2a')]);_0x186c34[_0x8320('0x2b')]='No\x20Company';break;default:return null;}}return _0x5a0339[_0x8320('0xf')](_['upperFirst'](_0x396d36[_0x8320('0x2a')]))[_0x8320('0x10')](_0x186c34);}});}function getCustomFields(_0x1e91e7,_0x16aa57){var _0x1103d1={};if(_0x1e91e7[_0x8320('0x14')]>0x0){_[_0x8320('0x2c')](_0x1e91e7,function(_0x22d977){if(_0x22d977[_0x8320('0x2d')]===_0x8320('0x2e')&&_0x22d977[_0x8320('0x2f')]){_0x1103d1[_0x22d977[_0x8320('0x2f')]]=_0x22d977[_0x8320('0x30')][_0x8320('0x31')]();}else if(_0x22d977['type']===_0x8320('0x32')&&_0x22d977[_0x8320('0x33')]&&_0x22d977[_0x8320('0x2f')]){_0x16aa57[_0x22d977[_0x8320('0x33')]]&&(_0x1103d1[_0x22d977[_0x8320('0x2f')]]=_0x16aa57[_0x22d977[_0x8320('0x33')]][_0x8320('0x31')]());}else if(_0x22d977[_0x8320('0x2d')]==='customVariable'&&_0x22d977['Variable']&&_0x22d977[_0x8320('0x34')][_0x8320('0x35')]&&_0x22d977[_0x8320('0x2f')]){_0x16aa57[_0x22d977[_0x8320('0x34')][_0x8320('0x35')][_0x8320('0x36')]()]&&(_0x1103d1[_0x22d977['idField']]=_0x16aa57[_0x22d977[_0x8320('0x34')][_0x8320('0x35')]['toLowerCase']()][_0x8320('0x31')]());}});}return _0x1103d1;}function getConnection(_0x58591b){var _0x363594=_0x58591b[_0x8320('0x37')]['concat'](_0x58591b[_0x8320('0x38')]);var _0x56ed7d=new jsforce[(_0x8320('0x39'))]({'oauth2':{'loginUrl':_0x58591b[_0x8320('0x3a')]||_0x8320('0x3b'),'clientId':_0x58591b['clientId'],'clientSecret':_0x58591b[_0x8320('0x3c')]}});return _0x56ed7d[_0x8320('0x3d')](_0x58591b[_0x8320('0x3e')],_0x363594)[_0x8320('0x13')](function(){logger[_0x8320('0x1d')](_0x8320('0x3f'));return _0x56ed7d;});}exports[_0x8320('0x40')]=function(_0x1d237f,_0x5ee405,_0x15c1b7,_0x37b35e,_0x19dfc2,_0x21a8c3){var _0x457598,_0x1f8902,_0x48c714,_0x4d7d41;_0x21a8c3[_0x8320('0x41')]=intUtil[_0x8320('0x42')](_0x21a8c3['serverUrl']);if(_0x19dfc2&&_0x19dfc2[_0x8320('0x43')]){logger[_0x8320('0x1d')](_0x8320('0x44'),_0x8320('0x45'));_0x5ee405[_0x8320('0x46')]=util[_0x8320('0x47')](_0x8320('0x48'),_0x21a8c3['serverUrl'],_0x5ee405[_0x8320('0x49')],md5(_0x5ee405['uniqueid']));}else{_0x5ee405[_0x8320('0x46')]='';}return getConnection(_0x21a8c3)['then'](function(_0x5c66e9){_0x4d7d41=_0x5c66e9;return getUser(_0x21a8c3,_0x37b35e['email'],_0x4d7d41);})[_0x8320('0x13')](function(_0x5d21be){_0x457598=_0x5d21be;return getEndUser(_0x21a8c3,_0x15c1b7,_0x5ee405[_0x8320('0x4a')],_0x5ee405[_0x8320('0x4b')],_0x4d7d41);})[_0x8320('0x13')](function(_0xd95ecc){_0x1f8902=_0xd95ecc;return getTicket(_0x21a8c3,_0x457598,_0x1f8902,_0x15c1b7,_0x5ee405,_0x15c1b7[_0x8320('0x4c')],_0x4d7d41);})[_0x8320('0x13')](function(_0x5c5dd0){_0x48c714=_0x5c5dd0;logger[_0x8320('0x1d')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x48c714['id']);logger['info'](_0x8320('0x4d'),_0x48c714['id'],_0x37b35e[_0x8320('0x35')],_0x21a8c3[_0x8320('0x2d')]);switch(_0x21a8c3[_0x8320('0x2d')]){case _0x8320('0x4e'):emit(util[_0x8320('0x47')](_0x8320('0x4f'),_0x37b35e['name']),_0x8320('0x50'),{'recordId':_0x48c714['id']});break;case _0x8320('0x51'):emit(util['format'](_0x8320('0x4f'),_0x37b35e[_0x8320('0x35')]),_0x8320('0x52'),{'uri':util[_0x8320('0x47')](_0x8320('0x53'),_0x4d7d41['instanceUrl'],_0x48c714['id'])});break;default:logger[_0x8320('0x54')](_0x8320('0x55'));}})[_0x8320('0x56')](function(_0x1bcf64){logger['error'](_0x8320('0x44'),JSON['stringify'](_0x1bcf64));});};exports[_0x8320('0x57')]=function(_0x23533a,_0x3b38a6,_0x3ba8af,_0x454f15,_0x560cb5,_0x489f11,_0x4ed7fb){var _0x300d81,_0x1c9c06,_0x48a5da,_0x4d3699;_0x489f11[_0x8320('0x41')]=intUtil[_0x8320('0x42')](_0x489f11[_0x8320('0x41')]);if(_0x4ed7fb&&_0x4ed7fb[_0x8320('0x58')]&&_0x4ed7fb[_0x8320('0x58')]!==_0x8320('0x59')){logger['info'](_0x8320('0x5a'),'Recording\x20is\x20enabled!');_0x3b38a6[_0x8320('0x46')]=util[_0x8320('0x47')](_0x8320('0x48'),_0x489f11[_0x8320('0x41')],_0x3b38a6[_0x8320('0x49')],md5(_0x3b38a6[_0x8320('0x49')]));}return getConnection(_0x489f11)[_0x8320('0x13')](function(_0x4adbe8){_0x4d3699=_0x4adbe8;return getUser(_0x489f11,_0x454f15[_0x8320('0x5b')],_0x4d3699);})[_0x8320('0x13')](function(_0x540c37){_0x300d81=_0x540c37;return getEndUser(_0x489f11,_0x3ba8af,_0x3b38a6['destcalleridname'],_0x3b38a6[_0x8320('0x5c')],_0x4d3699);})[_0x8320('0x13')](function(_0x22de78){_0x1c9c06=_0x22de78;return getTicket(_0x489f11,_0x300d81,_0x1c9c06,_0x3ba8af,_0x3b38a6,_0x3ba8af[_0x8320('0x4c')],_0x4d3699);})[_0x8320('0x13')](function(_0x482e52){_0x48a5da=_0x482e52;logger['info'](_0x8320('0x5d'),_0x48a5da['id']);logger[_0x8320('0x1d')](_0x8320('0x5e'),_0x48a5da['id'],_0x454f15[_0x8320('0x35')],_0x489f11[_0x8320('0x2d')]);switch(_0x489f11[_0x8320('0x2d')]){case'integrationTab':emit(util[_0x8320('0x47')](_0x8320('0x4f'),_0x454f15['name']),_0x8320('0x50'),{'recordId':_0x48a5da['id']});break;case _0x8320('0x51'):emit(util[_0x8320('0x47')]('user:%s',_0x454f15['name']),_0x8320('0x52'),{'uri':util[_0x8320('0x47')](_0x8320('0x53'),_0x4d3699[_0x8320('0x5f')],_0x48a5da['id'])});break;default:logger[_0x8320('0x54')](_0x8320('0x5a'),_0x8320('0x60'));}})[_0x8320('0x56')](function(_0x4bc4a4){logger[_0x8320('0x54')]('[OUTBOUND]',JSON[_0x8320('0x61')](_0x4bc4a4));});};exports[_0x8320('0x62')]=function(_0x13d609,_0x13a14f,_0x12f7b7,_0x6536d8,_0x316a22,_0x5804d9){var _0x40f9e7,_0x3eb0f4,_0x3ec23e,_0x1c9daf;_0x5804d9[_0x8320('0x41')]=intUtil[_0x8320('0x42')](_0x5804d9['serverUrl']);if(_0x316a22&&_0x316a22[_0x8320('0x43')]){logger[_0x8320('0x1d')](_0x8320('0x63'),_0x8320('0x45'));_0x13a14f[_0x8320('0x46')]=util['format'](_0x8320('0x48'),_0x5804d9[_0x8320('0x41')],_0x13a14f['uniqueid'],md5(_0x13a14f['uniqueid']));}else{_0x13a14f[_0x8320('0x46')]='';}return getConnection(_0x5804d9)[_0x8320('0x13')](function(_0x4369bd){_0x1c9daf=_0x4369bd;return getUser(_0x5804d9,_0x6536d8[_0x8320('0x5b')],_0x1c9daf);})[_0x8320('0x13')](function(_0x3e3e1f){_0x40f9e7=_0x3e3e1f;return getEndUser(_0x5804d9,_0x12f7b7,_0x13a14f[_0x8320('0x4a')],_0x13a14f[_0x8320('0x4b')],_0x1c9daf);})[_0x8320('0x13')](function(_0x1f8cba){_0x3eb0f4=_0x1f8cba;return getTicket(_0x5804d9,_0x40f9e7,_0x3eb0f4,_0x12f7b7,_0x13a14f,_0x12f7b7[_0x8320('0x4c')],_0x1c9daf);})[_0x8320('0x13')](function(_0x368f18){_0x3ec23e=_0x368f18;logger[_0x8320('0x1d')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0x3ec23e['id']);logger[_0x8320('0x1d')](_0x8320('0x64'),_0x5804d9[_0x8320('0x2d')]);})[_0x8320('0x56')](function(_0x2e89e2){logger[_0x8320('0x54')]('[ABANDONED]',JSON['stringify'](_0x2e89e2));});}; \ 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 1488d45..7633a19 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 _0xe3c5=['type','string','nameField','content','customField','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','error','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','abandoned','[ABANDONED]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','lodash','request-promise','bluebird','md5','./util','sugarcrm','localhost','POST','info','Creating\x20new\x20ticket...','name','Subjects','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','variableName','push','idField','set_entry','JSON','stringify','Calls','apiKey','toString','get_server_info','format','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]'];(function(_0x397ff7,_0x5318b2){var _0x4ee2f6=function(_0x271048){while(--_0x271048){_0x397ff7['push'](_0x397ff7['shift']());}};_0x4ee2f6(++_0x5318b2);}(_0xe3c5,0x1d9));var _0x5e3c=function(_0x5743e3,_0x4a2aab){_0x5743e3=_0x5743e3-0x0;var _0x24d100=_0xe3c5[_0x5743e3];return _0x24d100;};'use strict';var _=require(_0x5e3c('0x0'));var rp=require(_0x5e3c('0x1'));var BPromise=require(_0x5e3c('0x2'));var md5=require(_0x5e3c('0x3'));var util=require('util');var intUtil=require(_0x5e3c('0x4'));var logger=require('../../../../config/logger')(_0x5e3c('0x5'));var io=require('socket.io-emitter')({'host':_0x5e3c('0x6'),'port':0x18eb});var def={'method':_0x5e3c('0x7'),'json':!![]};function emit(_0x17945e,_0x51a734,_0x10a121){io['to'](_0x17945e)['emit'](_0x51a734,_0x10a121);}function getTicket(_0x4f8535,_0x3409e5,_0x2f5858,_0x568589,_0x314479,_0x144217,_0x1ec381){logger[_0x5e3c('0x8')](_0x5e3c('0x9'));var _0x5ba53e=new Date();var _0x3c5a7c=[{'name':_0x5e3c('0xa'),'value':intUtil['getString'](_0x568589[_0x5e3c('0xb')],_0x314479,'\x20')},{'name':_0x5e3c('0xc'),'value':_0x3409e5['id']},{'name':_0x5e3c('0xd'),'value':_0x3409e5['id']},{'name':_0x5e3c('0xe'),'value':intUtil['getString'](_0x568589[_0x5e3c('0xf')],_0x314479,'\x0a')},{'name':_0x5e3c('0x10'),'value':_0x5ba53e[_0x5e3c('0x11')]()[_0x5e3c('0x12')](0x0,0x13)[_0x5e3c('0x13')]('T','\x20')},{'name':_0x5e3c('0x14'),'value':'0'},{'name':_0x5e3c('0x15'),'value':'15'},{'name':_0x5e3c('0x16'),'value':_0x2f5858['id']},{'name':_0x5e3c('0x17'),'value':_0x5e3c('0x18')},{'name':_0x5e3c('0x19'),'value':_0x2f5858['name']}];if(_0x144217[_0x5e3c('0x1a')]){_[_0x5e3c('0x1b')](_0x144217,function(_0x238feb){if(_0x314479[_0x238feb[_0x5e3c('0x1c')]]){_0x3c5a7c[_0x5e3c('0x1d')]({'name':_0x238feb[_0x5e3c('0x1e')],'value':_0x314479[_0x238feb[_0x5e3c('0x1c')]]});}});}return request({'form':{'method':_0x5e3c('0x1f'),'input_type':_0x5e3c('0x20'),'response_type':'JSON','rest_data':JSON[_0x5e3c('0x21')]({'session':_0x1ec381['id'],'module_name':_0x5e3c('0x22'),'name_value_list':_0x3c5a7c})}});}function getAuth(_0x2b0c2e){return util['format']('Basic\x20%s',new Buffer(_0x2b0c2e[_0x5e3c('0x23')]+':X')[_0x5e3c('0x24')]('base64'));}function getServerInfo(_0xb57756){return request({'form':{'method':_0x5e3c('0x25'),'input_type':'JSON','response_type':_0x5e3c('0x20'),'rest_data':JSON[_0x5e3c('0x21')]({'session':_0xb57756['id']})}});}function getUser(_0x4f25bb,_0x2ddd00,_0x2a1e76){logger['info']('Getting\x20agent\x20with\x20name',_0x2ddd00);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x5e3c('0x20'),'rest_data':JSON['stringify']({'session':_0x2a1e76['id'],'module_name':'Employees','query':util[_0x5e3c('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2ddd00),'order_by':'','offset':'0','select_fields':['id',_0x5e3c('0xa'),_0x5e3c('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5e3c('0x28')](function(_0x4ca3fc){if(_0x4ca3fc[_0x5e3c('0x29')][_0x5e3c('0x1a')]){var _0x178af6=_[_0x5e3c('0x2a')](_0x4ca3fc[_0x5e3c('0x29')],function(_0x16da72){return _0x16da72[_0x5e3c('0x2b')][_0x5e3c('0x27')][_0x5e3c('0x2c')]===_0x2ddd00;});if(_0x178af6){logger[_0x5e3c('0x8')](_0x5e3c('0x2d'));return BPromise[_0x5e3c('0x2e')]({'id':_0x178af6[_0x5e3c('0x2b')]['id'][_0x5e3c('0x2c')],'name':_0x178af6['name_value_list'][_0x5e3c('0xa')][_0x5e3c('0x2c')]});}}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5e3c('0x2e')]({'id':_0x2a1e76[_0x5e3c('0x2b')][_0x5e3c('0x2f')]['id'],'name':_0x2a1e76[_0x5e3c('0x2b')]['user_name']['id']});}});}function getEndUser(_0x29ee8d,_0xa3462,_0x1c08dc,_0x2076c4){logger['info'](_0x5e3c('0x30'),_0x1c08dc);return request({'form':{'method':_0x5e3c('0x31'),'input_type':_0x5e3c('0x20'),'response_type':'JSON','rest_data':JSON[_0x5e3c('0x21')]({'session':_0x2076c4['id'],'module_name':'Contacts','query':util['format'](_0x5e3c('0x32'),_0x1c08dc),'order_by':'','offset':'0','select_fields':['id',_0x5e3c('0xa'),_0x5e3c('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5e3c('0x28')](function(_0x4129df){if(_0x4129df[_0x5e3c('0x29')]['length']){var _0x18a98c=_[_0x5e3c('0x2a')](_0x4129df[_0x5e3c('0x29')],function(_0x3b7229){return _0x3b7229[_0x5e3c('0x2b')][_0x5e3c('0x33')][_0x5e3c('0x2c')]===_0x1c08dc;});if(_0x18a98c){logger['info']('Enduser\x20found!');return BPromise[_0x5e3c('0x2e')]({'id':_0x18a98c['name_value_list']['id'][_0x5e3c('0x2c')],'name':_0x18a98c[_0x5e3c('0x2b')][_0x5e3c('0xa')][_0x5e3c('0x2c')],'phone':_0x18a98c[_0x5e3c('0x2b')][_0x5e3c('0x33')][_0x5e3c('0x2c')]});}}else{logger[_0x5e3c('0x8')](_0x5e3c('0x34'));return request({'form':{'method':_0x5e3c('0x1f'),'input_type':_0x5e3c('0x20'),'response_type':'JSON','rest_data':JSON[_0x5e3c('0x21')]({'session':_0x2076c4['id'],'module_name':_0x5e3c('0x18'),'name_value_list':[{'name':_0x5e3c('0x35'),'value':_0xa3462!==''?_0xa3462:util[_0x5e3c('0x26')](_0x5e3c('0x36'),_0x1c08dc)},{'name':_0x5e3c('0x33'),'value':_0x1c08dc}]})}})['then'](function(_0xb96f4e){logger[_0x5e3c('0x8')](_0x5e3c('0x37'));return BPromise[_0x5e3c('0x2e')]({'id':_0xb96f4e['id'],'name':_0xb96f4e['entry_list'][_0x5e3c('0x35')][_0x5e3c('0x2c')],'phone':_0xb96f4e['entry_list'][_0x5e3c('0x33')][_0x5e3c('0x2c')]});});}});}function request(_0x33dc8e){logger['debug'](_0x5e3c('0x38'),JSON[_0x5e3c('0x21')](_0x33dc8e));return rp(_['merge'](def,_0x33dc8e));}function getTags(_0x279057,_0x44db5e){var _0x387248=[];if(_0x279057&&_0x279057[_0x5e3c('0x1a')]>0x0){_0x387248=_['map'](_0x279057,_0x44db5e);}return _0x387248;}function getCustomFields(_0x353716,_0x4d137e){var _0x5f1b3a=[];var _0xc6b95c={'custom_fields':[]};if(_0x353716[_0x5e3c('0x1a')]>0x0){_[_0x5e3c('0x1b')](_0x353716,function(_0x262695){if(_0x262695[_0x5e3c('0x39')]===_0x5e3c('0x3a')&&_0x262695[_0x5e3c('0x3b')]&&!_0x262695['customField']){_0xc6b95c[_0x262695[_0x5e3c('0x3b')]['toLowerCase']()]=_0x262695[_0x5e3c('0x3c')][_0x5e3c('0x24')]();}else if(_0x262695[_0x5e3c('0x39')]===_0x5e3c('0x3a')&&_0x262695[_0x5e3c('0x1e')]&&_0x262695[_0x5e3c('0x3d')]){_0xc6b95c[_0x5e3c('0x3e')][_0x5e3c('0x1d')]({'id':_0x262695[_0x5e3c('0x1e')],'value':_0x262695[_0x5e3c('0x3c')][_0x5e3c('0x24')]()});}else if(_0x262695[_0x5e3c('0x39')]===_0x5e3c('0x3f')&&_0x262695[_0x5e3c('0x1c')]&&_0x262695[_0x5e3c('0x1e')]&&_0x262695[_0x5e3c('0x3d')]){_0x4d137e[_0x262695[_0x5e3c('0x1c')]]&&_0xc6b95c[_0x5e3c('0x3e')]['push']({'id':_0x262695[_0x5e3c('0x1e')],'value':_0x4d137e[_0x262695[_0x5e3c('0x1c')]][_0x5e3c('0x24')]()});}else if(_0x262695['type']===_0x5e3c('0x40')&&_0x262695[_0x5e3c('0x41')]&&_0x262695[_0x5e3c('0x41')]['name']&&_0x262695['idField']&&_0x262695['customField']){_0x4d137e[_0x262695[_0x5e3c('0x41')][_0x5e3c('0xa')][_0x5e3c('0x42')]()]&&_0xc6b95c[_0x5e3c('0x3e')][_0x5e3c('0x1d')]({'id':_0x262695[_0x5e3c('0x1e')],'value':_0x4d137e[_0x262695['Variable'][_0x5e3c('0xa')]['toLowerCase']()][_0x5e3c('0x24')]()});}});}return _0xc6b95c;}function getConnection(_0x4a4d16){return request({'method':_0x5e3c('0x7'),'form':{'method':_0x5e3c('0x43'),'input_type':_0x5e3c('0x20'),'response_type':_0x5e3c('0x20'),'rest_data':JSON[_0x5e3c('0x21')]({'user_auth':{'user_name':_0x4a4d16[_0x5e3c('0x44')],'password':_0x4a4d16['password'],'encryption':_0x5e3c('0x45')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x5e3c('0x28')](function(_0x5b94b7){var _0x46ebcd=_0x5b94b7;if(_0x46ebcd['id']){def[_0x5e3c('0x46')]=_0x46ebcd['id'];return BPromise['resolve'](_0x46ebcd);}else{throw new Error(util[_0x5e3c('0x26')](_0x5e3c('0x47'),_0x4a4d16['id']));}});}function setRelationship(_0x538b08,_0x5a7262,_0x174187,_0x236e34){return request({'form':{'method':'set_relationship','input_type':_0x5e3c('0x20'),'response_type':_0x5e3c('0x20'),'rest_data':JSON[_0x5e3c('0x21')]({'session':_0x538b08['id'],'module_name':'Calls','module_id':_0x174187['id'],'link_field_name':_0x236e34,'related_ids':[_0x5a7262['id']]})}});}exports[_0x5e3c('0x48')]=function(_0x42d41a,_0x41f5ff,_0x5759af,_0x28b4ab,_0xca994e,_0x340475){var _0x2ba314,_0x28a60,_0x11763d,_0x3fbf9a;_0x340475[_0x5e3c('0x49')]=intUtil[_0x5e3c('0x4a')](_0x340475[_0x5e3c('0x49')]);_0x340475['serverUrl']=intUtil[_0x5e3c('0x4a')](_0x340475[_0x5e3c('0x4b')]);def[_0x5e3c('0x4c')]=util['format'](_0x5e3c('0x4d'),_0x340475[_0x5e3c('0x49')]);if(_0xca994e&&_0xca994e[_0x5e3c('0x4e')]){logger[_0x5e3c('0x8')](_0x5e3c('0x4f'),_0x5e3c('0x50'));_0x41f5ff[_0x5e3c('0x51')]=util[_0x5e3c('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x340475[_0x5e3c('0x4b')],_0x41f5ff[_0x5e3c('0x52')],md5(_0x41f5ff[_0x5e3c('0x52')]));}else{_0x41f5ff[_0x5e3c('0x51')]='';}return getConnection(_0x340475)[_0x5e3c('0x28')](function(_0x21f820){_0x3fbf9a=_0x21f820;return getUser(_0x340475,_0x28b4ab[_0x5e3c('0xa')],_0x3fbf9a);})['then'](function(_0x1ed81f){_0x2ba314=_0x1ed81f;logger['info'](_0x5e3c('0x53'),_0x2ba314['id']);return getEndUser(_0x340475,_0x41f5ff['calleridname'],_0x41f5ff[_0x5e3c('0x54')],_0x3fbf9a);})[_0x5e3c('0x28')](function(_0x5f1c47){_0x28a60=_0x5f1c47;logger[_0x5e3c('0x8')](_0x5e3c('0x55'),_0x28a60['id']);return getTicket(_0x340475,_0x2ba314,_0x28a60,_0x5759af,_0x41f5ff,_0x5759af[_0x5e3c('0x56')],_0x3fbf9a);})[_0x5e3c('0x28')](function(_0x19659a){_0x11763d=_0x19659a;logger[_0x5e3c('0x8')](_0x5e3c('0x57'));logger[_0x5e3c('0x8')](_0x5e3c('0x58'),_0x11763d['id']);return setRelationship(_0x3fbf9a,_0x2ba314,_0x11763d,_0x5e3c('0x59'));})[_0x5e3c('0x28')](function(){return setRelationship(_0x3fbf9a,_0x28a60,_0x11763d,_0x5e3c('0x5a'));})[_0x5e3c('0x28')](function(){return getServerInfo(_0x3fbf9a);})[_0x5e3c('0x28')](function(_0x4f4ea2){var _0x5027e8=parseInt(_0x4f4ea2['version'][_0x5e3c('0x5b')](0x0));var _0x3874e6=util[_0x5e3c('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x340475['remoteUri'],_0x11763d['id']);if(_0x5027e8>0x6){_0x3874e6=util['format'](_0x5e3c('0x5c'),_0x340475[_0x5e3c('0x49')],_0x11763d['id']);}logger['info'](_0x5e3c('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5e3c('0x26')]('user:%s',_0x28b4ab[_0x5e3c('0xa')]),_0x5e3c('0x5d'),{'uri':_0x3874e6});})[_0x5e3c('0x5e')](function(_0x3ddfb9){logger[_0x5e3c('0x5f')](_0x5e3c('0x4f'),JSON[_0x5e3c('0x21')](_0x3ddfb9));});};exports['outbound']=function(_0x1b0ca5,_0x1f1885,_0x2e5516,_0x5169f0,_0x3382ef,_0x1f0fae,_0x5b4762){var _0x4d0dc5,_0x34ba24,_0x35fe9e,_0x4ec78e;_0x1f0fae[_0x5e3c('0x49')]=intUtil[_0x5e3c('0x4a')](_0x1f0fae[_0x5e3c('0x49')]);_0x1f0fae[_0x5e3c('0x4b')]=intUtil[_0x5e3c('0x4a')](_0x1f0fae[_0x5e3c('0x4b')]);def[_0x5e3c('0x4c')]=util[_0x5e3c('0x26')](_0x5e3c('0x4d'),_0x1f0fae[_0x5e3c('0x49')]);if(_0x5b4762&&_0x5b4762[_0x5e3c('0x60')]&&_0x5b4762[_0x5e3c('0x60')]!=='none'){logger[_0x5e3c('0x8')](_0x5e3c('0x61'),_0x5e3c('0x50'));_0x1f1885[_0x5e3c('0x51')]=util[_0x5e3c('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f0fae[_0x5e3c('0x4b')],_0x1f1885[_0x5e3c('0x52')],md5(_0x1f1885[_0x5e3c('0x52')]));}return getConnection(_0x1f0fae)['then'](function(_0x97f8e2){_0x4ec78e=_0x97f8e2;return getUser(_0x1f0fae,_0x5169f0[_0x5e3c('0xa')],_0x4ec78e);})['then'](function(_0x35e172){_0x4d0dc5=_0x35e172;logger[_0x5e3c('0x8')](_0x5e3c('0x53'),_0x4d0dc5['id']);return getEndUser(_0x1f0fae,_0x1f1885[_0x5e3c('0x62')],_0x1f1885[_0x5e3c('0x63')],_0x4ec78e);})[_0x5e3c('0x28')](function(_0x1d591c){_0x34ba24=_0x1d591c;logger['info'](_0x5e3c('0x55'),_0x34ba24['id']);return getTicket(_0x1f0fae,_0x4d0dc5,_0x34ba24,_0x2e5516,_0x1f1885,_0x2e5516[_0x5e3c('0x56')],_0x4ec78e);})[_0x5e3c('0x28')](function(_0x1726ad){_0x35fe9e=_0x1726ad;logger[_0x5e3c('0x8')](_0x5e3c('0x57'));logger[_0x5e3c('0x8')](_0x5e3c('0x58'),_0x35fe9e['id']);return setRelationship(_0x4ec78e,_0x4d0dc5,_0x35fe9e,'users');})[_0x5e3c('0x28')](function(){return setRelationship(_0x4ec78e,_0x34ba24,_0x35fe9e,'contacts');})[_0x5e3c('0x28')](function(){return getServerInfo(_0x4ec78e);})['then'](function(_0x422b8d){var _0x4695c9=parseInt(_0x422b8d['version']['charAt'](0x0));var _0x4c0027=util[_0x5e3c('0x26')](_0x5e3c('0x64'),_0x1f0fae[_0x5e3c('0x49')],_0x35fe9e['id']);if(_0x4695c9>0x6){_0x4c0027=util['format'](_0x5e3c('0x5c'),_0x1f0fae[_0x5e3c('0x49')],_0x35fe9e['id']);}logger[_0x5e3c('0x8')](_0x5e3c('0x61'),_0x5e3c('0x65'));emit(util['format']('user:%s',_0x5169f0['name']),_0x5e3c('0x5d'),{'uri':_0x4c0027});})[_0x5e3c('0x5e')](function(_0x20c3bc){logger[_0x5e3c('0x5f')](_0x5e3c('0x61'),JSON['stringify'](_0x20c3bc));});};exports[_0x5e3c('0x66')]=function(_0x5715ed,_0x530649,_0x4b4979,_0x49d4a4,_0x11972d,_0x353cfd){var _0x118d93,_0x99ff47,_0x3eb3da,_0x17f4fd;_0x353cfd[_0x5e3c('0x49')]=intUtil[_0x5e3c('0x4a')](_0x353cfd[_0x5e3c('0x49')]);_0x353cfd['serverUrl']=intUtil[_0x5e3c('0x4a')](_0x353cfd['serverUrl']);def[_0x5e3c('0x4c')]=util[_0x5e3c('0x26')](_0x5e3c('0x4d'),_0x353cfd[_0x5e3c('0x49')]);if(_0x11972d&&_0x11972d['monitor_format']){logger[_0x5e3c('0x8')](_0x5e3c('0x67'),'Recording\x20is\x20enabled!');_0x530649['recordingURL']=util[_0x5e3c('0x26')](_0x5e3c('0x68'),_0x353cfd[_0x5e3c('0x4b')],_0x530649['uniqueid'],md5(_0x530649[_0x5e3c('0x52')]));}else{_0x530649[_0x5e3c('0x51')]='';}return getConnection(_0x353cfd)['then'](function(_0x5f432c){_0x17f4fd=_0x5f432c;return getUser(_0x353cfd,_0x49d4a4[_0x5e3c('0xa')],_0x17f4fd);})[_0x5e3c('0x28')](function(_0x4f4dd2){_0x118d93=_0x4f4dd2;logger['info'](_0x5e3c('0x53'),_0x118d93['id']);return getEndUser(_0x353cfd,_0x530649[_0x5e3c('0x69')],_0x530649[_0x5e3c('0x54')],_0x17f4fd);})[_0x5e3c('0x28')](function(_0x18d5fa){_0x99ff47=_0x18d5fa;logger['info'](_0x5e3c('0x55'),_0x99ff47['id']);return getTicket(_0x353cfd,_0x118d93,_0x99ff47,_0x4b4979,_0x530649,_0x4b4979[_0x5e3c('0x56')],_0x17f4fd);})[_0x5e3c('0x28')](function(_0x369deb){_0x3eb3da=_0x369deb;logger[_0x5e3c('0x8')](_0x5e3c('0x57'));logger[_0x5e3c('0x8')](_0x5e3c('0x58'),_0x3eb3da['id']);return setRelationship(_0x17f4fd,_0x118d93,_0x3eb3da,_0x5e3c('0x59'));})[_0x5e3c('0x28')](function(){return setRelationship(_0x17f4fd,_0x99ff47,_0x3eb3da,'contacts');})[_0x5e3c('0x28')](function(){return getServerInfo(_0x17f4fd);})[_0x5e3c('0x5e')](function(_0xe5b1de){logger[_0x5e3c('0x5f')](_0x5e3c('0x67'),JSON[_0x5e3c('0x21')](_0xe5b1de));});}; \ No newline at end of file +var _0x4521=['Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','users','[OUTBOUND]','abandoned','[ABANDONED]','calleridnum','The\x20Ticket\x20ID\x20is:','lodash','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','localhost','emit','info','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_id','length','forEach','variableName','push','idField','JSON','stringify','Calls','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','then','entry_list','find','value','resolve','name_value_list','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!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Contacts','Caller\x20-\x20%s','first_name','debug','merge','map','type','string','nameField','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]'];(function(_0x5177cf,_0x3926c9){var _0x2b35ee=function(_0x3c2912){while(--_0x3c2912){_0x5177cf['push'](_0x5177cf['shift']());}};_0x2b35ee(++_0x3926c9);}(_0x4521,0x16d));var _0x1452=function(_0x5d01ff,_0x1257c0){_0x5d01ff=_0x5d01ff-0x0;var _0x110533=_0x4521[_0x5d01ff];return _0x110533;};'use strict';var _=require(_0x1452('0x0'));var rp=require('request-promise');var BPromise=require(_0x1452('0x1'));var md5=require(_0x1452('0x2'));var util=require(_0x1452('0x3'));var intUtil=require(_0x1452('0x4'));var logger=require(_0x1452('0x5'))(_0x1452('0x6'));var io=require('socket.io-emitter')({'host':_0x1452('0x7'),'port':0x18eb});var def={'method':'POST','json':!![]};function emit(_0x223549,_0x138d4,_0x3f2eaf){io['to'](_0x223549)[_0x1452('0x8')](_0x138d4,_0x3f2eaf);}function getTicket(_0x2b6839,_0x4cc86c,_0x420261,_0x29adcb,_0xaec3e3,_0x1ef8cd,_0x19148d){logger[_0x1452('0x9')]('Creating\x20new\x20ticket...');var _0x710b52=new Date();var _0x88493=[{'name':_0x1452('0xa'),'value':intUtil[_0x1452('0xb')](_0x29adcb[_0x1452('0xc')],_0xaec3e3,'\x20')},{'name':_0x1452('0xd'),'value':_0x4cc86c['id']},{'name':'created_by','value':_0x4cc86c['id']},{'name':_0x1452('0xe'),'value':intUtil['getString'](_0x29adcb[_0x1452('0xf')],_0xaec3e3,'\x0a')},{'name':'date_start','value':_0x710b52[_0x1452('0x10')]()[_0x1452('0x11')](0x0,0x13)['replace']('T','\x20')},{'name':_0x1452('0x12'),'value':'0'},{'name':_0x1452('0x13'),'value':'15'},{'name':_0x1452('0x14'),'value':_0x420261['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0x420261[_0x1452('0xa')]}];if(_0x1ef8cd[_0x1452('0x15')]){_[_0x1452('0x16')](_0x1ef8cd,function(_0x3023e2){if(_0xaec3e3[_0x3023e2[_0x1452('0x17')]]){_0x88493[_0x1452('0x18')]({'name':_0x3023e2[_0x1452('0x19')],'value':_0xaec3e3[_0x3023e2[_0x1452('0x17')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x1452('0x1a'),'response_type':_0x1452('0x1a'),'rest_data':JSON[_0x1452('0x1b')]({'session':_0x19148d['id'],'module_name':_0x1452('0x1c'),'name_value_list':_0x88493})}});}function getAuth(_0x502bbf){return util['format']('Basic\x20%s',new Buffer(_0x502bbf[_0x1452('0x1d')]+':X')[_0x1452('0x1e')](_0x1452('0x1f')));}function getServerInfo(_0x3cc96f){return request({'form':{'method':_0x1452('0x20'),'input_type':_0x1452('0x1a'),'response_type':_0x1452('0x1a'),'rest_data':JSON[_0x1452('0x1b')]({'session':_0x3cc96f['id']})}});}function getUser(_0x335181,_0xbafeb6,_0x2876d0){logger[_0x1452('0x9')](_0x1452('0x21'),_0xbafeb6);return request({'form':{'method':_0x1452('0x22'),'input_type':_0x1452('0x1a'),'response_type':_0x1452('0x1a'),'rest_data':JSON['stringify']({'session':_0x2876d0['id'],'module_name':_0x1452('0x23'),'query':util[_0x1452('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xbafeb6),'order_by':'','offset':'0','select_fields':['id',_0x1452('0xa'),_0x1452('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1452('0x26')](function(_0x390b11){if(_0x390b11[_0x1452('0x27')][_0x1452('0x15')]){var _0x33a0f6=_[_0x1452('0x28')](_0x390b11[_0x1452('0x27')],function(_0x13e8b7){return _0x13e8b7['name_value_list']['user_name'][_0x1452('0x29')]===_0xbafeb6;});if(_0x33a0f6){logger['info']('Agent\x20found!');return BPromise[_0x1452('0x2a')]({'id':_0x33a0f6[_0x1452('0x2b')]['id'][_0x1452('0x29')],'name':_0x33a0f6[_0x1452('0x2b')][_0x1452('0xa')]['value']});}}else{logger['info'](_0x1452('0x2c'));return BPromise['resolve']({'id':_0x2876d0[_0x1452('0x2b')][_0x1452('0x2d')]['id'],'name':_0x2876d0[_0x1452('0x2b')][_0x1452('0x25')]['id']});}});}function getEndUser(_0x1bf1a9,_0x5749ae,_0x2b7982,_0x35ba03){logger[_0x1452('0x9')](_0x1452('0x2e'),_0x2b7982);return request({'form':{'method':_0x1452('0x22'),'input_type':'JSON','response_type':_0x1452('0x1a'),'rest_data':JSON[_0x1452('0x1b')]({'session':_0x35ba03['id'],'module_name':'Contacts','query':util[_0x1452('0x24')](_0x1452('0x2f'),_0x2b7982),'order_by':'','offset':'0','select_fields':['id',_0x1452('0xa'),_0x1452('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x517b0a){if(_0x517b0a[_0x1452('0x27')][_0x1452('0x15')]){var _0x17163a=_[_0x1452('0x28')](_0x517b0a[_0x1452('0x27')],function(_0x448c0b){return _0x448c0b['name_value_list'][_0x1452('0x30')][_0x1452('0x29')]===_0x2b7982;});if(_0x17163a){logger[_0x1452('0x9')](_0x1452('0x31'));return BPromise['resolve']({'id':_0x17163a['name_value_list']['id']['value'],'name':_0x17163a[_0x1452('0x2b')]['name']['value'],'phone':_0x17163a[_0x1452('0x2b')]['phone_home'][_0x1452('0x29')]});}}else{logger[_0x1452('0x9')](_0x1452('0x32'));return request({'form':{'method':_0x1452('0x33'),'input_type':_0x1452('0x1a'),'response_type':_0x1452('0x1a'),'rest_data':JSON[_0x1452('0x1b')]({'session':_0x35ba03['id'],'module_name':_0x1452('0x34'),'name_value_list':[{'name':'first_name','value':_0x5749ae!==''?_0x5749ae:util[_0x1452('0x24')](_0x1452('0x35'),_0x2b7982)},{'name':_0x1452('0x30'),'value':_0x2b7982}]})}})[_0x1452('0x26')](function(_0xe143a7){logger[_0x1452('0x9')]('Enduser\x20created.');return BPromise['resolve']({'id':_0xe143a7['id'],'name':_0xe143a7['entry_list'][_0x1452('0x36')]['value'],'phone':_0xe143a7[_0x1452('0x27')][_0x1452('0x30')][_0x1452('0x29')]});});}});}function request(_0x5c201b){logger[_0x1452('0x37')]('[HTTP]',JSON['stringify'](_0x5c201b));return rp(_[_0x1452('0x38')](def,_0x5c201b));}function getTags(_0x5a9eb3,_0x36f41c){var _0xb42b4e=[];if(_0x5a9eb3&&_0x5a9eb3['length']>0x0){_0xb42b4e=_[_0x1452('0x39')](_0x5a9eb3,_0x36f41c);}return _0xb42b4e;}function getCustomFields(_0xebbbe9,_0x531212){var _0x46afc0=[];var _0x56566b={'custom_fields':[]};if(_0xebbbe9['length']>0x0){_[_0x1452('0x16')](_0xebbbe9,function(_0x4a0b01){if(_0x4a0b01[_0x1452('0x3a')]===_0x1452('0x3b')&&_0x4a0b01[_0x1452('0x3c')]&&!_0x4a0b01[_0x1452('0x3d')]){_0x56566b[_0x4a0b01['nameField'][_0x1452('0x3e')]()]=_0x4a0b01['content']['toString']();}else if(_0x4a0b01[_0x1452('0x3a')]===_0x1452('0x3b')&&_0x4a0b01['idField']&&_0x4a0b01['customField']){_0x56566b['custom_fields'][_0x1452('0x18')]({'id':_0x4a0b01[_0x1452('0x19')],'value':_0x4a0b01[_0x1452('0x3f')][_0x1452('0x1e')]()});}else if(_0x4a0b01[_0x1452('0x3a')]===_0x1452('0x40')&&_0x4a0b01['variableName']&&_0x4a0b01[_0x1452('0x19')]&&_0x4a0b01[_0x1452('0x3d')]){_0x531212[_0x4a0b01['variableName']]&&_0x56566b[_0x1452('0x41')][_0x1452('0x18')]({'id':_0x4a0b01[_0x1452('0x19')],'value':_0x531212[_0x4a0b01['variableName']][_0x1452('0x1e')]()});}else if(_0x4a0b01[_0x1452('0x3a')]===_0x1452('0x42')&&_0x4a0b01[_0x1452('0x43')]&&_0x4a0b01[_0x1452('0x43')]['name']&&_0x4a0b01[_0x1452('0x19')]&&_0x4a0b01[_0x1452('0x3d')]){_0x531212[_0x4a0b01[_0x1452('0x43')][_0x1452('0xa')][_0x1452('0x3e')]()]&&_0x56566b['custom_fields'][_0x1452('0x18')]({'id':_0x4a0b01['idField'],'value':_0x531212[_0x4a0b01[_0x1452('0x43')][_0x1452('0xa')][_0x1452('0x3e')]()][_0x1452('0x1e')]()});}});}return _0x56566b;}function getConnection(_0x21a33a){return request({'method':_0x1452('0x44'),'form':{'method':'login','input_type':'JSON','response_type':_0x1452('0x1a'),'rest_data':JSON[_0x1452('0x1b')]({'user_auth':{'user_name':_0x21a33a[_0x1452('0x45')],'password':_0x21a33a[_0x1452('0x46')],'encryption':_0x1452('0x47')},'application':_0x1452('0x48')})}})[_0x1452('0x26')](function(_0x31b200){var _0x46c834=_0x31b200;if(_0x46c834['id']){def[_0x1452('0x49')]=_0x46c834['id'];return BPromise['resolve'](_0x46c834);}else{throw new Error(util[_0x1452('0x24')](_0x1452('0x4a'),_0x21a33a['id']));}});}function setRelationship(_0xf4ee52,_0x36f593,_0x5187eb,_0x16da6c){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x1452('0x1a'),'rest_data':JSON[_0x1452('0x1b')]({'session':_0xf4ee52['id'],'module_name':'Calls','module_id':_0x5187eb['id'],'link_field_name':_0x16da6c,'related_ids':[_0x36f593['id']]})}});}exports[_0x1452('0x4b')]=function(_0x3d20e4,_0x4b4110,_0x41ed1b,_0x43c76a,_0xa33152,_0x582d68){var _0x57c4e5,_0x3bd1ff,_0x4afbec,_0x3c02e4;_0x582d68[_0x1452('0x4c')]=intUtil[_0x1452('0x4d')](_0x582d68[_0x1452('0x4c')]);_0x582d68[_0x1452('0x4e')]=intUtil['stripTrailingSlash'](_0x582d68[_0x1452('0x4e')]);def[_0x1452('0x4f')]=util[_0x1452('0x24')](_0x1452('0x50'),_0x582d68[_0x1452('0x4c')]);if(_0xa33152&&_0xa33152[_0x1452('0x51')]){logger[_0x1452('0x9')](_0x1452('0x52'),_0x1452('0x53'));_0x4b4110['recordingURL']=util[_0x1452('0x24')](_0x1452('0x54'),_0x582d68['serverUrl'],_0x4b4110[_0x1452('0x55')],md5(_0x4b4110['uniqueid']));}else{_0x4b4110[_0x1452('0x56')]='';}return getConnection(_0x582d68)[_0x1452('0x26')](function(_0x351179){_0x3c02e4=_0x351179;return getUser(_0x582d68,_0x43c76a[_0x1452('0xa')],_0x3c02e4);})[_0x1452('0x26')](function(_0x5489a4){_0x57c4e5=_0x5489a4;logger['info'](_0x1452('0x57'),_0x57c4e5['id']);return getEndUser(_0x582d68,_0x4b4110[_0x1452('0x58')],_0x4b4110['calleridnum'],_0x3c02e4);})['then'](function(_0x1ef0b8){_0x3bd1ff=_0x1ef0b8;logger[_0x1452('0x9')](_0x1452('0x59'),_0x3bd1ff['id']);return getTicket(_0x582d68,_0x57c4e5,_0x3bd1ff,_0x41ed1b,_0x4b4110,_0x41ed1b[_0x1452('0x5a')],_0x3c02e4);})[_0x1452('0x26')](function(_0x439f4b){_0x4afbec=_0x439f4b;logger[_0x1452('0x9')](_0x1452('0x5b'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4afbec['id']);return setRelationship(_0x3c02e4,_0x57c4e5,_0x4afbec,'users');})[_0x1452('0x26')](function(){return setRelationship(_0x3c02e4,_0x3bd1ff,_0x4afbec,_0x1452('0x5c'));})[_0x1452('0x26')](function(){return getServerInfo(_0x3c02e4);})[_0x1452('0x26')](function(_0x35becc){var _0x2f3552=parseInt(_0x35becc[_0x1452('0x5d')]['charAt'](0x0));var _0x16c22f=util[_0x1452('0x24')](_0x1452('0x5e'),_0x582d68[_0x1452('0x4c')],_0x4afbec['id']);if(_0x2f3552>0x6){_0x16c22f=util['format'](_0x1452('0x5f'),_0x582d68['remoteUri'],_0x4afbec['id']);}logger[_0x1452('0x9')](_0x1452('0x52'),_0x1452('0x60'));emit(util[_0x1452('0x24')](_0x1452('0x61'),_0x43c76a[_0x1452('0xa')]),_0x1452('0x62'),{'uri':_0x16c22f});})[_0x1452('0x63')](function(_0x463175){logger[_0x1452('0x64')]('[QUEUE]',JSON[_0x1452('0x1b')](_0x463175));});};exports[_0x1452('0x65')]=function(_0x2d28b5,_0x1ed115,_0x25adb2,_0x15e149,_0x22e2f9,_0x2a86e8,_0x37bddd){var _0x512f20,_0x1a4c02,_0x9df42b,_0x1c18d6;_0x2a86e8['remoteUri']=intUtil[_0x1452('0x4d')](_0x2a86e8[_0x1452('0x4c')]);_0x2a86e8[_0x1452('0x4e')]=intUtil['stripTrailingSlash'](_0x2a86e8[_0x1452('0x4e')]);def['uri']=util[_0x1452('0x24')]('%s/service/v4_1/rest.php',_0x2a86e8[_0x1452('0x4c')]);if(_0x37bddd&&_0x37bddd[_0x1452('0x66')]&&_0x37bddd[_0x1452('0x66')]!==_0x1452('0x67')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1ed115[_0x1452('0x56')]=util[_0x1452('0x24')](_0x1452('0x54'),_0x2a86e8[_0x1452('0x4e')],_0x1ed115[_0x1452('0x55')],md5(_0x1ed115[_0x1452('0x55')]));}return getConnection(_0x2a86e8)['then'](function(_0x1de93b){_0x1c18d6=_0x1de93b;return getUser(_0x2a86e8,_0x15e149[_0x1452('0xa')],_0x1c18d6);})['then'](function(_0x59ba06){_0x512f20=_0x59ba06;logger[_0x1452('0x9')](_0x1452('0x57'),_0x512f20['id']);return getEndUser(_0x2a86e8,_0x1ed115[_0x1452('0x68')],_0x1ed115[_0x1452('0x69')],_0x1c18d6);})[_0x1452('0x26')](function(_0x19b81a){_0x1a4c02=_0x19b81a;logger['info'](_0x1452('0x59'),_0x1a4c02['id']);return getTicket(_0x2a86e8,_0x512f20,_0x1a4c02,_0x25adb2,_0x1ed115,_0x25adb2[_0x1452('0x5a')],_0x1c18d6);})[_0x1452('0x26')](function(_0x3c8b1b){_0x9df42b=_0x3c8b1b;logger[_0x1452('0x9')](_0x1452('0x5b'));logger[_0x1452('0x9')]('The\x20Ticket\x20ID\x20is:',_0x9df42b['id']);return setRelationship(_0x1c18d6,_0x512f20,_0x9df42b,_0x1452('0x6a'));})[_0x1452('0x26')](function(){return setRelationship(_0x1c18d6,_0x1a4c02,_0x9df42b,_0x1452('0x5c'));})[_0x1452('0x26')](function(){return getServerInfo(_0x1c18d6);})[_0x1452('0x26')](function(_0x1c9f75){var _0x54170a=parseInt(_0x1c9f75['version']['charAt'](0x0));var _0x4faa09=util[_0x1452('0x24')](_0x1452('0x5e'),_0x2a86e8[_0x1452('0x4c')],_0x9df42b['id']);if(_0x54170a>0x6){_0x4faa09=util[_0x1452('0x24')](_0x1452('0x5f'),_0x2a86e8['remoteUri'],_0x9df42b['id']);}logger[_0x1452('0x9')](_0x1452('0x6b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1452('0x24')]('user:%s',_0x15e149[_0x1452('0xa')]),_0x1452('0x62'),{'uri':_0x4faa09});})[_0x1452('0x63')](function(_0x33c9e3){logger['error'](_0x1452('0x6b'),JSON[_0x1452('0x1b')](_0x33c9e3));});};exports[_0x1452('0x6c')]=function(_0x3c4459,_0x5f04c1,_0x49d0a3,_0x1a2e03,_0x2b2f29,_0x53299e){var _0x1ca5a4,_0x15ff74,_0xf15ee8,_0x2c452b;_0x53299e[_0x1452('0x4c')]=intUtil[_0x1452('0x4d')](_0x53299e[_0x1452('0x4c')]);_0x53299e[_0x1452('0x4e')]=intUtil[_0x1452('0x4d')](_0x53299e[_0x1452('0x4e')]);def[_0x1452('0x4f')]=util[_0x1452('0x24')](_0x1452('0x50'),_0x53299e[_0x1452('0x4c')]);if(_0x2b2f29&&_0x2b2f29['monitor_format']){logger[_0x1452('0x9')](_0x1452('0x6d'),'Recording\x20is\x20enabled!');_0x5f04c1[_0x1452('0x56')]=util[_0x1452('0x24')](_0x1452('0x54'),_0x53299e[_0x1452('0x4e')],_0x5f04c1[_0x1452('0x55')],md5(_0x5f04c1[_0x1452('0x55')]));}else{_0x5f04c1[_0x1452('0x56')]='';}return getConnection(_0x53299e)['then'](function(_0x3a8a79){_0x2c452b=_0x3a8a79;return getUser(_0x53299e,_0x1a2e03[_0x1452('0xa')],_0x2c452b);})[_0x1452('0x26')](function(_0x5f53a9){_0x1ca5a4=_0x5f53a9;logger[_0x1452('0x9')](_0x1452('0x57'),_0x1ca5a4['id']);return getEndUser(_0x53299e,_0x5f04c1['calleridname'],_0x5f04c1[_0x1452('0x6e')],_0x2c452b);})[_0x1452('0x26')](function(_0x5d2d60){_0x15ff74=_0x5d2d60;logger[_0x1452('0x9')]('The\x20Enduser\x20ID\x20is:',_0x15ff74['id']);return getTicket(_0x53299e,_0x1ca5a4,_0x15ff74,_0x49d0a3,_0x5f04c1,_0x49d0a3['Fields'],_0x2c452b);})[_0x1452('0x26')](function(_0xe68d55){_0xf15ee8=_0xe68d55;logger[_0x1452('0x9')]('Ticket\x20created!');logger[_0x1452('0x9')](_0x1452('0x6f'),_0xf15ee8['id']);return setRelationship(_0x2c452b,_0x1ca5a4,_0xf15ee8,_0x1452('0x6a'));})[_0x1452('0x26')](function(){return setRelationship(_0x2c452b,_0x15ff74,_0xf15ee8,_0x1452('0x5c'));})[_0x1452('0x26')](function(){return getServerInfo(_0x2c452b);})[_0x1452('0x63')](function(_0xd31294){logger['error'](_0x1452('0x6d'),JSON[_0x1452('0x1b')](_0xd31294));});}; \ 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 05f9d82..cdbc851 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 _0x518f=['util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','format','%s:\x20%s','join','stripTrailingSlash','lodash'];(function(_0xe9f4a2,_0x50f0c4){var _0x25e066=function(_0x32557f){while(--_0x32557f){_0xe9f4a2['push'](_0xe9f4a2['shift']());}};_0x25e066(++_0x50f0c4);}(_0x518f,0xe5));var _0xf518=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0x518f[_0xcf4569];return _0x7fef;};'use strict';var _=require(_0xf518('0x0'));var util=require(_0xf518('0x1'));exports[_0xf518('0x2')]=function(_0x2cfc42,_0x40ce8a,_0x1738b3){var _0x38d894=[];if(_0x2cfc42[_0xf518('0x3')]>0x0){var _0x522bbf=_[_0xf518('0x4')](_0x2cfc42,['id']);for(var _0x55e1e8=0x0;_0x55e1e8<_0x522bbf['length'];_0x55e1e8++){var _0x29e00d=_0x522bbf[_0x55e1e8];if(_0x29e00d[_0xf518('0x5')]===_0xf518('0x6')){_0x38d894[_0xf518('0x7')](_0x29e00d['content']);}else if(_0x29e00d['type']===_0xf518('0x8')&&_0x29e00d['variableName']){_0x40ce8a[_0x29e00d['variableName']]&&_0x38d894[_0xf518('0x7')](_0x40ce8a[_0x29e00d[_0xf518('0x9')]][_0xf518('0xa')]());}else if(_0x29e00d['type']===_0xf518('0xb')&&_0x29e00d[_0xf518('0xc')]&&_0x29e00d['Variable']['name']){_0x40ce8a[_0x29e00d[_0xf518('0xc')][_0xf518('0xd')][_0xf518('0xe')]()]&&_0x38d894[_0xf518('0x7')](_0x40ce8a[_0x29e00d[_0xf518('0xc')][_0xf518('0xd')][_0xf518('0xe')]()][_0xf518('0xa')]());}else if(_0x29e00d[_0xf518('0x5')]===_0xf518('0xf')){if(_0x29e00d[_0xf518('0x10')]==='string'&&_0x29e00d[_0xf518('0x11')]){_0x38d894['push'](util['format']('%s:\x20%s',_0x29e00d[_0xf518('0x11')],_0x29e00d[_0xf518('0x12')]));}else if(_0x29e00d[_0xf518('0x10')]===_0xf518('0x8')&&_0x29e00d[_0xf518('0x9')]&&_0x29e00d[_0xf518('0x11')]){_0x40ce8a[_0x29e00d['variableName']]&&_0x38d894['push'](util[_0xf518('0x13')](_0xf518('0x14'),_0x29e00d['key'],_0x40ce8a[_0x29e00d[_0xf518('0x9')]]));}else if(_0x29e00d['keyType']===_0xf518('0xb')&&_0x29e00d[_0xf518('0xc')]&&_0x29e00d['Variable']['name']&&_0x29e00d['key']){_0x40ce8a[_0x29e00d[_0xf518('0xc')][_0xf518('0xd')][_0xf518('0xe')]()]&&_0x38d894[_0xf518('0x7')](util['format']('%s:\x20%s',_0x29e00d['key'],_0x40ce8a[_0x29e00d[_0xf518('0xc')]['name']['toLowerCase']()]));}}}}return _0x38d894[_0xf518('0x15')](_0x1738b3);};exports[_0xf518('0x16')]=function(_0x402b42){if(_0x402b42&&_0x402b42['substr'](-0x1)==='/'){return _0x402b42['substr'](0x0,_0x402b42[_0xf518('0x3')]-0x1);}return _0x402b42;}; \ No newline at end of file +var _0xcb9f=['sortBy','type','string','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','push','format','keyType','%s:\x20%s','join','stripTrailingSlash','substr','lodash','util','getString','length'];(function(_0x3790c6,_0x279fd5){var _0x494a6e=function(_0x49da1e){while(--_0x49da1e){_0x3790c6['push'](_0x3790c6['shift']());}};_0x494a6e(++_0x279fd5);}(_0xcb9f,0x9d));var _0xfcb9=function(_0x3dcf54,_0x4c434c){_0x3dcf54=_0x3dcf54-0x0;var _0x3330ed=_0xcb9f[_0x3dcf54];return _0x3330ed;};'use strict';var _=require(_0xfcb9('0x0'));var util=require(_0xfcb9('0x1'));exports[_0xfcb9('0x2')]=function(_0x152f53,_0x3398e2,_0xe42521){var _0x2caacb=[];if(_0x152f53[_0xfcb9('0x3')]>0x0){var _0x426856=_[_0xfcb9('0x4')](_0x152f53,['id']);for(var _0x4cf284=0x0;_0x4cf284<_0x426856[_0xfcb9('0x3')];_0x4cf284++){var _0xc0504a=_0x426856[_0x4cf284];if(_0xc0504a[_0xfcb9('0x5')]===_0xfcb9('0x6')){_0x2caacb['push'](_0xc0504a['content']);}else if(_0xc0504a[_0xfcb9('0x5')]===_0xfcb9('0x7')&&_0xc0504a[_0xfcb9('0x8')]){_0x3398e2[_0xc0504a[_0xfcb9('0x8')]]&&_0x2caacb['push'](_0x3398e2[_0xc0504a[_0xfcb9('0x8')]][_0xfcb9('0x9')]());}else if(_0xc0504a[_0xfcb9('0x5')]===_0xfcb9('0xa')&&_0xc0504a[_0xfcb9('0xb')]&&_0xc0504a[_0xfcb9('0xb')]['name']){_0x3398e2[_0xc0504a[_0xfcb9('0xb')][_0xfcb9('0xc')][_0xfcb9('0xd')]()]&&_0x2caacb['push'](_0x3398e2[_0xc0504a['Variable'][_0xfcb9('0xc')][_0xfcb9('0xd')]()][_0xfcb9('0x9')]());}else if(_0xc0504a[_0xfcb9('0x5')]===_0xfcb9('0xe')){if(_0xc0504a['keyType']===_0xfcb9('0x6')&&_0xc0504a[_0xfcb9('0xf')]){_0x2caacb[_0xfcb9('0x10')](util[_0xfcb9('0x11')]('%s:\x20%s',_0xc0504a[_0xfcb9('0xf')],_0xc0504a['keyContent']));}else if(_0xc0504a[_0xfcb9('0x12')]==='variable'&&_0xc0504a['variableName']&&_0xc0504a[_0xfcb9('0xf')]){_0x3398e2[_0xc0504a['variableName']]&&_0x2caacb['push'](util[_0xfcb9('0x11')](_0xfcb9('0x13'),_0xc0504a[_0xfcb9('0xf')],_0x3398e2[_0xc0504a[_0xfcb9('0x8')]]));}else if(_0xc0504a[_0xfcb9('0x12')]===_0xfcb9('0xa')&&_0xc0504a['Variable']&&_0xc0504a[_0xfcb9('0xb')][_0xfcb9('0xc')]&&_0xc0504a['key']){_0x3398e2[_0xc0504a[_0xfcb9('0xb')][_0xfcb9('0xc')]['toLowerCase']()]&&_0x2caacb[_0xfcb9('0x10')](util[_0xfcb9('0x11')](_0xfcb9('0x13'),_0xc0504a['key'],_0x3398e2[_0xc0504a[_0xfcb9('0xb')]['name']['toLowerCase']()]));}}}}return _0x2caacb[_0xfcb9('0x14')](_0xe42521);};exports[_0xfcb9('0x15')]=function(_0x292a2d){if(_0x292a2d&&_0x292a2d[_0xfcb9('0x16')](-0x1)==='/'){return _0x292a2d[_0xfcb9('0x16')](0x0,_0x292a2d[_0xfcb9('0x3')]-0x1);}return _0x292a2d;}; \ 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 95b6018..fbba71c 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 _0xcf33=['toString','variable','variableName','customVariable','name','Variable','toLowerCase','info','Creating\x20new\x20ticket...','Subjects','getString','Descriptions','POST','format','%s/webservice.php','admin','sessionName','HelpDesk','stringify','then','success','resolve','error','catch','test','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','Enduser\x20created.','lastname','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','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','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','abandoned','monitor_format','[ABANDONED]','lodash','md5','util','./util','vTiger','localhost','emit','length','forEach','type','string','idField','content'];(function(_0x25581d,_0x211ce8){var _0x1cf610=function(_0xc211ce){while(--_0xc211ce){_0x25581d['push'](_0x25581d['shift']());}};_0x1cf610(++_0x211ce8);}(_0xcf33,0x11f));var _0x3cf3=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xcf33[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x3cf3('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x3cf3('0x1'));var util=require(_0x3cf3('0x2'));var intUtil=require(_0x3cf3('0x3'));var logger=require('../../../../config/logger')(_0x3cf3('0x4'));var io=require('socket.io-emitter')({'host':_0x3cf3('0x5'),'port':0x18eb});function emit(_0x3186ae,_0x1d8edd,_0x717db7){io['to'](_0x3186ae)[_0x3cf3('0x6')](_0x1d8edd,_0x717db7);}function getCustomFields(_0x5bce77,_0x4ff789){var _0xb1eaf7={};if(_0x5bce77[_0x3cf3('0x7')]>0x0){_[_0x3cf3('0x8')](_0x5bce77,function(_0x2f2b66){if(_0x2f2b66[_0x3cf3('0x9')]===_0x3cf3('0xa')&&_0x2f2b66[_0x3cf3('0xb')]){_0xb1eaf7[_0x2f2b66['idField']]=_0x2f2b66[_0x3cf3('0xc')][_0x3cf3('0xd')]();}else if(_0x2f2b66['type']===_0x3cf3('0xe')&&_0x2f2b66[_0x3cf3('0xf')]&&_0x2f2b66[_0x3cf3('0xb')]&&_0x4ff789[_0x2f2b66['variableName']]){_0xb1eaf7[_0x2f2b66[_0x3cf3('0xb')]]=_0x4ff789[_0x2f2b66[_0x3cf3('0xf')]]['toString']();}else if(_0x2f2b66[_0x3cf3('0x9')]===_0x3cf3('0x10')&&_0x2f2b66['Variable']&&_0x2f2b66['Variable'][_0x3cf3('0x11')]&&_0x2f2b66[_0x3cf3('0xb')]&&_0x4ff789[_0x2f2b66[_0x3cf3('0x12')]['name'][_0x3cf3('0x13')]()]){_0xb1eaf7[_0x2f2b66[_0x3cf3('0xb')]]=_0x4ff789[_0x2f2b66['Variable'][_0x3cf3('0x11')][_0x3cf3('0x13')]()]['toString']();}});}return _0xb1eaf7;}function createTicket(_0x43c54b,_0x11632f,_0x2597b2,_0x42625e,_0x2578dd,_0x2c05fa,_0xfc2d1){logger[_0x3cf3('0x14')](_0x3cf3('0x15'));var _0x30e9e4=_['merge']({'parent_id':'','assigned_user_id':_0x11632f['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil['getString'](_0x42625e[_0x3cf3('0x16')],_0x2578dd,'\x20'),'description':intUtil[_0x3cf3('0x17')](_0x42625e[_0x3cf3('0x18')],_0x2578dd,'\x0a'),'contact_id':_0x2597b2['id']},getCustomFields(_0x2c05fa,_0x2578dd));var _0x25c371={'method':_0x3cf3('0x19'),'uri':util[_0x3cf3('0x1a')](_0x3cf3('0x1b'),_0x43c54b['remoteUri']),'form':{'operation':'create','username':_0x3cf3('0x1c'),'sessionName':_0xfc2d1[_0x3cf3('0x1d')],'elementType':_0x3cf3('0x1e'),'element':JSON[_0x3cf3('0x1f')](_0x30e9e4)},'json':!![]};return request(_0x25c371)[_0x3cf3('0x20')](function(_0x250c44){if(_0x250c44[_0x3cf3('0x21')]){return BPromise[_0x3cf3('0x22')]({'id':_0x250c44['result']['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON['stringify'](_0x250c44[_0x3cf3('0x23')])));}})[_0x3cf3('0x24')](function(_0x22ef35){var _0x45b002=req['query'][_0x3cf3('0x25')]?0x1f4:_0x22ef35[_0x3cf3('0x26')]||0x1f4;logger['error'](_0x3cf3('0x27'),_0x3cf3('0x28'),_0x45b002,JSON['stringify'](_0x22ef35));});}function getUser(_0x3a9a93,_0x5f546e,_0x1cb0e9){logger[_0x3cf3('0x14')](_0x3cf3('0x29'),_0x5f546e);return request({'method':_0x3cf3('0x2a'),'uri':util['format'](_0x3cf3('0x1b'),_0x3a9a93['remoteUri']),'qs':{'operation':_0x3cf3('0x2b'),'username':_0x3cf3('0x1c'),'sessionName':_0x1cb0e9[_0x3cf3('0x1d')],'query':util[_0x3cf3('0x1a')](_0x3cf3('0x2c'),_0x5f546e)},'json':!![]})[_0x3cf3('0x20')](function(_0x4561da){if(_0x4561da['success']&&_0x4561da[_0x3cf3('0x2d')][_0x3cf3('0x7')]){logger[_0x3cf3('0x14')]('Agent\x20found!');return BPromise['resolve']({'id':_0x4561da[_0x3cf3('0x2d')][0x0]['id'],'email':_0x4561da[_0x3cf3('0x2d')][0x0][_0x3cf3('0x2e')],'name':_0x4561da[_0x3cf3('0x2d')][0x0][_0x3cf3('0x2f')]+'\x20'+_0x4561da[_0x3cf3('0x2d')][_0x3cf3('0x30')]});}else{logger[_0x3cf3('0x14')](_0x3cf3('0x31'));return BPromise[_0x3cf3('0x22')]({'id':_0x1cb0e9['userId'],'email':_0x3a9a93[_0x3cf3('0x32')],'name':_0x3cf3('0x1c')});}})[_0x3cf3('0x24')](function(_0x483091){var _0x512548=req[_0x3cf3('0x2b')][_0x3cf3('0x25')]?0x1f4:_0x483091[_0x3cf3('0x26')]||0x1f4;logger[_0x3cf3('0x23')](_0x3cf3('0x27'),_0x3cf3('0x33'),_0x512548,JSON['stringify'](_0x483091));});}function getEndUser(_0x303f85,_0x473102,_0x4d3335,_0x203dbb){logger[_0x3cf3('0x14')](_0x3cf3('0x34'),_0x4d3335);return request({'method':_0x3cf3('0x2a'),'uri':util[_0x3cf3('0x1a')](_0x3cf3('0x1b'),_0x303f85[_0x3cf3('0x35')]),'qs':{'operation':_0x3cf3('0x2b'),'username':_0x3cf3('0x1c'),'sessionName':_0x203dbb['sessionName'],'query':util[_0x3cf3('0x1a')]('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;',_0x4d3335,_0x4d3335,_0x4d3335,_0x4d3335,_0x4d3335)},'json':!![]})['then'](function(_0x7e9f65){if(_0x7e9f65[_0x3cf3('0x21')]&&_0x7e9f65[_0x3cf3('0x2d')][_0x3cf3('0x7')]){logger['info'](_0x3cf3('0x36'));return BPromise['resolve']({'id':_0x7e9f65[_0x3cf3('0x2d')][0x0]['id'],'name':_0x7e9f65[_0x3cf3('0x2d')][0x0][_0x3cf3('0x37')]+'\x20'+_0x7e9f65[_0x3cf3('0x2d')][0x0]['lastname'],'phone':_0x4d3335});}else{logger[_0x3cf3('0x14')](_0x3cf3('0x38'));return request({'method':_0x3cf3('0x19'),'uri':util['format']('%s/webservice.php',_0x303f85[_0x3cf3('0x35')]),'form':{'operation':_0x3cf3('0x39'),'sessionName':_0x203dbb[_0x3cf3('0x1d')],'elementType':_0x3cf3('0x3a'),'element':JSON['stringify']({'lastname':_0x473102,'phone':_0x4d3335,'assigned_user_id':'\x20'})},'json':!![]})[_0x3cf3('0x20')](function(_0x5479bd){logger[_0x3cf3('0x14')](_0x3cf3('0x3b'));return BPromise[_0x3cf3('0x22')]({'id':_0x5479bd[_0x3cf3('0x2d')]['id'],'name':_0x5479bd[_0x3cf3('0x2d')][_0x3cf3('0x3c')],'phone':_0x5479bd['result'][_0x3cf3('0x3d')]});})[_0x3cf3('0x24')](function(_0x177842){var _0x32fe83=req['query'][_0x3cf3('0x25')]?0x1f4:_0x177842['statusCode']||0x1f4;logger[_0x3cf3('0x23')](_0x3cf3('0x27'),_0x3cf3('0x3e'),_0x32fe83,JSON[_0x3cf3('0x1f')](_0x177842));});}});}function getConnection(_0x49c4cc){var _0x50d051=_0x49c4cc[_0x3cf3('0x32')];var _0x5b4bc0=_0x49c4cc[_0x3cf3('0x3f')];return request({'method':_0x3cf3('0x2a'),'uri':util['format'](_0x3cf3('0x1b'),_0x49c4cc[_0x3cf3('0x35')]),'qs':{'operation':_0x3cf3('0x40'),'username':_0x50d051},'json':!![]})[_0x3cf3('0x20')](function(_0x34fb56){if(_0x34fb56[_0x3cf3('0x21')]){return request({'method':_0x3cf3('0x19'),'uri':util[_0x3cf3('0x1a')]('%s/webservice.php',_0x49c4cc['remoteUri']),'form':{'operation':_0x3cf3('0x41'),'username':'admin','accessKey':md5(_0x34fb56[_0x3cf3('0x2d')][_0x3cf3('0x42')]+_0x5b4bc0)},'json':!![]});}})[_0x3cf3('0x20')](function(_0x2de680){if(_0x2de680[_0x3cf3('0x21')]){return BPromise[_0x3cf3('0x22')](_0x2de680[_0x3cf3('0x2d')]);}else{throw new Error(util[_0x3cf3('0x1a')](_0x3cf3('0x43'),_0x49c4cc['id']));}})[_0x3cf3('0x24')](function(_0x484021){var _0x5422e4=req[_0x3cf3('0x2b')]['test']?0x1f4:_0x484021[_0x3cf3('0x26')]||0x1f4;logger[_0x3cf3('0x23')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x3cf3('0x44'),_0x5422e4,JSON['stringify'](_0x484021));});}function request(_0x27eb0a){logger[_0x3cf3('0x14')](_0x3cf3('0x45'),JSON[_0x3cf3('0x1f')](_0x27eb0a));return rp(_0x27eb0a);}exports[_0x3cf3('0x46')]=function(_0x29da15,_0x4b47fc,_0x35b23c,_0x2f7b9c,_0x37f244,_0x3f733a){var _0x2b3bfc,_0x4128d7,_0x53a2bd,_0x2de0a4;_0x3f733a[_0x3cf3('0x35')]=intUtil[_0x3cf3('0x47')](_0x3f733a[_0x3cf3('0x35')]);if(_0x37f244&&_0x37f244['monitor_format']){logger[_0x3cf3('0x14')](_0x3cf3('0x48'),_0x3cf3('0x49'));_0x4b47fc[_0x3cf3('0x4a')]=util[_0x3cf3('0x1a')](_0x3cf3('0x4b'),_0x3f733a[_0x3cf3('0x4c')],_0x4b47fc['uniqueid'],md5(_0x4b47fc[_0x3cf3('0x4d')]));}else{_0x4b47fc[_0x3cf3('0x4a')]='';}return getConnection(_0x3f733a)['then'](function(_0x5e14e3){_0x2de0a4=_0x5e14e3;return getUser(_0x3f733a,_0x2f7b9c?_0x2f7b9c[_0x3cf3('0x4e')]:'',_0x2de0a4);})[_0x3cf3('0x20')](function(_0x8204e9){_0x2b3bfc=_0x8204e9;logger[_0x3cf3('0x14')]('The\x20User\x20ID\x20is:',_0x2b3bfc['id']);return getEndUser(_0x3f733a,_0x4b47fc[_0x3cf3('0x4f')],_0x4b47fc[_0x3cf3('0x50')],_0x2de0a4);})[_0x3cf3('0x20')](function(_0x302379){_0x4128d7=_0x302379;logger[_0x3cf3('0x14')](_0x3cf3('0x51'),_0x4128d7['id']);return createTicket(_0x3f733a,_0x2b3bfc,_0x4128d7,_0x35b23c,_0x4b47fc,_0x35b23c[_0x3cf3('0x52')],_0x2de0a4);})[_0x3cf3('0x20')](function(_0x5e4e1d){_0x53a2bd=_0x5e4e1d;logger[_0x3cf3('0x14')](_0x3cf3('0x53'));logger[_0x3cf3('0x14')](_0x3cf3('0x54'),_0x53a2bd['id']);var _0x32d2d8=util['format'](_0x3cf3('0x55'),_0x3f733a[_0x3cf3('0x35')],_[_0x3cf3('0x56')](_0x53a2bd['id'],'x')[0x1]);logger['info'](_0x3cf3('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3cf3('0x1a')](_0x3cf3('0x57'),_0x2f7b9c[_0x3cf3('0x11')]),_0x3cf3('0x58'),{'uri':_0x32d2d8});})[_0x3cf3('0x24')](function(_0x4e1ad9){logger[_0x3cf3('0x23')]('[QUEUE]',JSON[_0x3cf3('0x1f')](_0x4e1ad9));});};exports[_0x3cf3('0x59')]=function(_0x3021c3,_0x396936,_0x5ae067,_0x379b25,_0x575655,_0x27d9e2,_0x159ad4){var _0x44d265,_0x29ba1b,_0x56ea55,_0x4c7a9b;_0x27d9e2[_0x3cf3('0x35')]=intUtil[_0x3cf3('0x47')](_0x27d9e2['remoteUri']);_0x27d9e2[_0x3cf3('0x4c')]=intUtil['stripTrailingSlash'](_0x27d9e2[_0x3cf3('0x4c')]);if(_0x159ad4&&_0x159ad4[_0x3cf3('0x5a')]&&_0x159ad4[_0x3cf3('0x5a')]!==_0x3cf3('0x5b')){logger[_0x3cf3('0x14')](_0x3cf3('0x5c'),_0x3cf3('0x49'));_0x396936[_0x3cf3('0x4a')]=util['format'](_0x3cf3('0x4b'),_0x27d9e2[_0x3cf3('0x4c')],_0x396936[_0x3cf3('0x4d')],md5(_0x396936[_0x3cf3('0x4d')]));}return getConnection(_0x27d9e2)[_0x3cf3('0x20')](function(_0x32edf4){_0x4c7a9b=_0x32edf4;return getUser(_0x27d9e2,_0x379b25?_0x379b25['email']:'',_0x4c7a9b);})[_0x3cf3('0x20')](function(_0xa8677a){_0x44d265=_0xa8677a;logger[_0x3cf3('0x14')](_0x3cf3('0x5d'),_0x44d265['id']);return getEndUser(_0x27d9e2,_0x396936[_0x3cf3('0x5e')],_0x396936[_0x3cf3('0x5f')],_0x4c7a9b);})['then'](function(_0xa050df){_0x29ba1b=_0xa050df;logger[_0x3cf3('0x14')](_0x3cf3('0x51'),_0x29ba1b['id']);return createTicket(_0x27d9e2,_0x44d265,_0x29ba1b,_0x5ae067,_0x396936,_0x5ae067[_0x3cf3('0x52')],_0x4c7a9b);})['then'](function(_0x2781f6){_0x56ea55=_0x2781f6;logger['info'](_0x3cf3('0x53'));logger[_0x3cf3('0x14')](_0x3cf3('0x54'),_0x56ea55['id']);var _0x155ce4=util['format'](_0x3cf3('0x55'),_0x27d9e2[_0x3cf3('0x35')],_['split'](_0x56ea55['id'],'x')[0x1]);logger['info']('[OUTBOUND]',_0x3cf3('0x60'));emit(util['format']('user:%s',_0x379b25[_0x3cf3('0x11')]),_0x3cf3('0x58'),{'uri':_0x155ce4});})[_0x3cf3('0x24')](function(_0x46eb17){logger[_0x3cf3('0x23')]('[OUTBOUND]',JSON['stringify'](_0x46eb17));});};exports[_0x3cf3('0x61')]=function(_0x4a7ce6,_0x38ba59,_0x394cdc,_0x205bee,_0x49839a,_0x265472){var _0xf0da81,_0x356d01,_0x5e3386,_0x3469b3;_0x265472[_0x3cf3('0x35')]=intUtil['stripTrailingSlash'](_0x265472['remoteUri']);_0x265472[_0x3cf3('0x4c')]=intUtil['stripTrailingSlash'](_0x265472['serverUrl']);if(_0x49839a&&_0x49839a[_0x3cf3('0x62')]){logger[_0x3cf3('0x14')](_0x3cf3('0x63'),_0x3cf3('0x49'));_0x38ba59[_0x3cf3('0x4a')]=util['format'](_0x3cf3('0x4b'),_0x265472[_0x3cf3('0x4c')],_0x38ba59[_0x3cf3('0x4d')],md5(_0x38ba59['uniqueid']));}else{_0x38ba59[_0x3cf3('0x4a')]='';}return getConnection(_0x265472)['then'](function(_0x160942){_0x3469b3=_0x160942;return getUser(_0x265472,_0x205bee?_0x205bee[_0x3cf3('0x4e')]:'',_0x3469b3);})[_0x3cf3('0x20')](function(_0x14a393){_0xf0da81=_0x14a393;logger['info'](_0x3cf3('0x5d'),_0xf0da81['id']);return getEndUser(_0x265472,_0x38ba59[_0x3cf3('0x4f')],_0x38ba59[_0x3cf3('0x50')],_0x3469b3);})['then'](function(_0x176567){_0x356d01=_0x176567;logger[_0x3cf3('0x14')](_0x3cf3('0x51'),_0x356d01['id']);return createTicket(_0x265472,_0xf0da81,_0x356d01,_0x394cdc,_0x38ba59,_0x394cdc[_0x3cf3('0x52')],_0x3469b3);})[_0x3cf3('0x20')](function(_0x28c592){_0x5e3386=_0x28c592;logger[_0x3cf3('0x14')](_0x3cf3('0x53'));logger['info'](_0x3cf3('0x54'),_0x5e3386['id']);})[_0x3cf3('0x24')](function(_0x1595bc){logger[_0x3cf3('0x23')](_0x3cf3('0x63'),JSON['stringify'](_0x1595bc));});}; \ No newline at end of file +var _0x466f=['split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','trigger:browser:url','abandoned','monitor_format','[ABANDONED]','calleridname','request-promise','bluebird','util','./util','../../../../config/logger','vTiger','socket.io-emitter','localhost','emit','length','forEach','type','string','content','variable','variableName','idField','toString','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','getString','Subjects','Descriptions','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','query','test','statusCode','createTicket','Getting\x20agent\x20with\x20email','GET','admin','then','result','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','[vTiger],\x20%s,\x20%s,\x20%s','Searching\x20end\x20user\x20with\x20phone','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/webservice.php','Contacts','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','[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:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x466f,0x73));var _0xf466=function(_0x98b4b3,_0x28ada3){_0x98b4b3=_0x98b4b3-0x0;var _0x1cbc04=_0x466f[_0x98b4b3];return _0x1cbc04;};'use strict';var _=require('lodash');var rp=require(_0xf466('0x0'));var BPromise=require(_0xf466('0x1'));var md5=require('md5');var util=require(_0xf466('0x2'));var intUtil=require(_0xf466('0x3'));var logger=require(_0xf466('0x4'))(_0xf466('0x5'));var io=require(_0xf466('0x6'))({'host':_0xf466('0x7'),'port':0x18eb});function emit(_0x114399,_0x49922c,_0x7be502){io['to'](_0x114399)[_0xf466('0x8')](_0x49922c,_0x7be502);}function getCustomFields(_0x2bc2ff,_0x2d57c0){var _0x45337b={};if(_0x2bc2ff[_0xf466('0x9')]>0x0){_[_0xf466('0xa')](_0x2bc2ff,function(_0xfe7ba8){if(_0xfe7ba8[_0xf466('0xb')]===_0xf466('0xc')&&_0xfe7ba8['idField']){_0x45337b[_0xfe7ba8['idField']]=_0xfe7ba8[_0xf466('0xd')]['toString']();}else if(_0xfe7ba8[_0xf466('0xb')]===_0xf466('0xe')&&_0xfe7ba8[_0xf466('0xf')]&&_0xfe7ba8[_0xf466('0x10')]&&_0x2d57c0[_0xfe7ba8[_0xf466('0xf')]]){_0x45337b[_0xfe7ba8[_0xf466('0x10')]]=_0x2d57c0[_0xfe7ba8['variableName']][_0xf466('0x11')]();}else if(_0xfe7ba8['type']==='customVariable'&&_0xfe7ba8[_0xf466('0x12')]&&_0xfe7ba8['Variable'][_0xf466('0x13')]&&_0xfe7ba8[_0xf466('0x10')]&&_0x2d57c0[_0xfe7ba8['Variable'][_0xf466('0x13')][_0xf466('0x14')]()]){_0x45337b[_0xfe7ba8[_0xf466('0x10')]]=_0x2d57c0[_0xfe7ba8[_0xf466('0x12')][_0xf466('0x13')][_0xf466('0x14')]()]['toString']();}});}return _0x45337b;}function createTicket(_0x439e30,_0x599460,_0x5ec708,_0x2b804d,_0xd199b4,_0x243fa8,_0x4ca91c){logger[_0xf466('0x15')](_0xf466('0x16'));var _0x6cf755=_[_0xf466('0x17')]({'parent_id':'','assigned_user_id':_0x599460['id'],'ticketpriorities':'Normal','ticketstatus':_0xf466('0x18'),'ticket_title':intUtil[_0xf466('0x19')](_0x2b804d[_0xf466('0x1a')],_0xd199b4,'\x20'),'description':intUtil[_0xf466('0x19')](_0x2b804d[_0xf466('0x1b')],_0xd199b4,'\x0a'),'contact_id':_0x5ec708['id']},getCustomFields(_0x243fa8,_0xd199b4));var _0x118d2c={'method':_0xf466('0x1c'),'uri':util[_0xf466('0x1d')]('%s/webservice.php',_0x439e30[_0xf466('0x1e')]),'form':{'operation':_0xf466('0x1f'),'username':'admin','sessionName':_0x4ca91c[_0xf466('0x20')],'elementType':_0xf466('0x21'),'element':JSON[_0xf466('0x22')](_0x6cf755)},'json':!![]};return request(_0x118d2c)['then'](function(_0x503513){if(_0x503513[_0xf466('0x23')]){return BPromise[_0xf466('0x24')]({'id':_0x503513['result']['id']});}else{throw new Error(util['format'](_0xf466('0x25'),JSON[_0xf466('0x22')](_0x503513[_0xf466('0x26')])));}})[_0xf466('0x27')](function(_0x1a2702){var _0x1d6118=req[_0xf466('0x28')][_0xf466('0x29')]?0x1f4:_0x1a2702[_0xf466('0x2a')]||0x1f4;logger[_0xf466('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xf466('0x2b'),_0x1d6118,JSON[_0xf466('0x22')](_0x1a2702));});}function getUser(_0x78ce9c,_0x3abdc0,_0x443a64){logger[_0xf466('0x15')](_0xf466('0x2c'),_0x3abdc0);return request({'method':_0xf466('0x2d'),'uri':util[_0xf466('0x1d')]('%s/webservice.php',_0x78ce9c['remoteUri']),'qs':{'operation':_0xf466('0x28'),'username':_0xf466('0x2e'),'sessionName':_0x443a64[_0xf466('0x20')],'query':util[_0xf466('0x1d')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x3abdc0)},'json':!![]})[_0xf466('0x2f')](function(_0x37b643){if(_0x37b643['success']&&_0x37b643[_0xf466('0x30')][_0xf466('0x9')]){logger[_0xf466('0x15')](_0xf466('0x31'));return BPromise[_0xf466('0x24')]({'id':_0x37b643[_0xf466('0x30')][0x0]['id'],'email':_0x37b643[_0xf466('0x30')][0x0][_0xf466('0x32')],'name':_0x37b643[_0xf466('0x30')][0x0][_0xf466('0x33')]+'\x20'+_0x37b643['result']['last_name']});}else{logger[_0xf466('0x15')](_0xf466('0x34'));return BPromise['resolve']({'id':_0x443a64[_0xf466('0x35')],'email':_0x78ce9c[_0xf466('0x36')],'name':_0xf466('0x2e')});}})[_0xf466('0x27')](function(_0x2f8df3){var _0x4ce01b=req[_0xf466('0x28')][_0xf466('0x29')]?0x1f4:_0x2f8df3[_0xf466('0x2a')]||0x1f4;logger[_0xf466('0x26')](_0xf466('0x37'),'getUser',_0x4ce01b,JSON['stringify'](_0x2f8df3));});}function getEndUser(_0x549451,_0x1c5965,_0x177a45,_0x48a675){logger[_0xf466('0x15')](_0xf466('0x38'),_0x177a45);return request({'method':'GET','uri':util[_0xf466('0x1d')]('%s/webservice.php',_0x549451[_0xf466('0x1e')]),'qs':{'operation':_0xf466('0x28'),'username':_0xf466('0x2e'),'sessionName':_0x48a675[_0xf466('0x20')],'query':util[_0xf466('0x1d')]('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;',_0x177a45,_0x177a45,_0x177a45,_0x177a45,_0x177a45)},'json':!![]})[_0xf466('0x2f')](function(_0x156231){if(_0x156231['success']&&_0x156231[_0xf466('0x30')]['length']){logger[_0xf466('0x15')]('Enduser\x20found!');return BPromise[_0xf466('0x24')]({'id':_0x156231[_0xf466('0x30')][0x0]['id'],'name':_0x156231[_0xf466('0x30')][0x0][_0xf466('0x39')]+'\x20'+_0x156231[_0xf466('0x30')][0x0][_0xf466('0x3a')],'phone':_0x177a45});}else{logger[_0xf466('0x15')](_0xf466('0x3b'));return request({'method':'POST','uri':util[_0xf466('0x1d')](_0xf466('0x3c'),_0x549451[_0xf466('0x1e')]),'form':{'operation':_0xf466('0x1f'),'sessionName':_0x48a675[_0xf466('0x20')],'elementType':_0xf466('0x3d'),'element':JSON['stringify']({'lastname':_0x1c5965,'phone':_0x177a45,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x49c30f){logger['info']('Enduser\x20created.');return BPromise[_0xf466('0x24')]({'id':_0x49c30f[_0xf466('0x30')]['id'],'name':_0x49c30f[_0xf466('0x30')][_0xf466('0x3a')],'phone':_0x49c30f[_0xf466('0x30')][_0xf466('0x3e')]});})[_0xf466('0x27')](function(_0x335cc7){var _0x13619f=req[_0xf466('0x28')]['test']?0x1f4:_0x335cc7[_0xf466('0x2a')]||0x1f4;logger[_0xf466('0x26')](_0xf466('0x37'),_0xf466('0x3f'),_0x13619f,JSON[_0xf466('0x22')](_0x335cc7));});}});}function getConnection(_0x5175ad){var _0x3131b7=_0x5175ad[_0xf466('0x36')];var _0x2aee32=_0x5175ad[_0xf466('0x40')];return request({'method':_0xf466('0x2d'),'uri':util[_0xf466('0x1d')](_0xf466('0x3c'),_0x5175ad['remoteUri']),'qs':{'operation':_0xf466('0x41'),'username':_0x3131b7},'json':!![]})[_0xf466('0x2f')](function(_0xa965da){if(_0xa965da['success']){return request({'method':'POST','uri':util['format'](_0xf466('0x3c'),_0x5175ad[_0xf466('0x1e')]),'form':{'operation':_0xf466('0x42'),'username':_0xf466('0x2e'),'accessKey':md5(_0xa965da[_0xf466('0x30')][_0xf466('0x43')]+_0x2aee32)},'json':!![]});}})[_0xf466('0x2f')](function(_0x30456d){if(_0x30456d[_0xf466('0x23')]){return BPromise[_0xf466('0x24')](_0x30456d[_0xf466('0x30')]);}else{throw new Error(util[_0xf466('0x1d')](_0xf466('0x44'),_0x5175ad['id']));}})[_0xf466('0x27')](function(_0x1d965b){var _0x5d18d4=req[_0xf466('0x28')][_0xf466('0x29')]?0x1f4:_0x1d965b['statusCode']||0x1f4;logger[_0xf466('0x26')](_0xf466('0x37'),_0xf466('0x45'),_0x5d18d4,JSON['stringify'](_0x1d965b));});}function request(_0x4cc376){logger[_0xf466('0x15')]('[HTTP]',JSON[_0xf466('0x22')](_0x4cc376));return rp(_0x4cc376);}exports[_0xf466('0x46')]=function(_0x389fc7,_0x73be2,_0x4e725d,_0x17d207,_0x1d1a03,_0x149b97){var _0xa10f53,_0x333d99,_0x41dffd,_0x945984;_0x149b97['remoteUri']=intUtil['stripTrailingSlash'](_0x149b97['remoteUri']);if(_0x1d1a03&&_0x1d1a03['monitor_format']){logger[_0xf466('0x15')](_0xf466('0x47'),_0xf466('0x48'));_0x73be2[_0xf466('0x49')]=util['format'](_0xf466('0x4a'),_0x149b97[_0xf466('0x4b')],_0x73be2[_0xf466('0x4c')],md5(_0x73be2['uniqueid']));}else{_0x73be2['recordingURL']='';}return getConnection(_0x149b97)[_0xf466('0x2f')](function(_0x5f12e7){_0x945984=_0x5f12e7;return getUser(_0x149b97,_0x17d207?_0x17d207[_0xf466('0x4d')]:'',_0x945984);})[_0xf466('0x2f')](function(_0x4c03db){_0xa10f53=_0x4c03db;logger[_0xf466('0x15')](_0xf466('0x4e'),_0xa10f53['id']);return getEndUser(_0x149b97,_0x73be2['calleridname'],_0x73be2[_0xf466('0x4f')],_0x945984);})[_0xf466('0x2f')](function(_0x2ac806){_0x333d99=_0x2ac806;logger[_0xf466('0x15')](_0xf466('0x50'),_0x333d99['id']);return createTicket(_0x149b97,_0xa10f53,_0x333d99,_0x4e725d,_0x73be2,_0x4e725d[_0xf466('0x51')],_0x945984);})[_0xf466('0x2f')](function(_0x366428){_0x41dffd=_0x366428;logger[_0xf466('0x15')](_0xf466('0x52'));logger[_0xf466('0x15')](_0xf466('0x53'),_0x41dffd['id']);var _0x1de126=util['format'](_0xf466('0x54'),_0x149b97['remoteUri'],_[_0xf466('0x55')](_0x41dffd['id'],'x')[0x1]);logger[_0xf466('0x15')](_0xf466('0x47'),_0xf466('0x56'));emit(util[_0xf466('0x1d')](_0xf466('0x57'),_0x17d207[_0xf466('0x13')]),'trigger:browser:url',{'uri':_0x1de126});})[_0xf466('0x27')](function(_0x3b1d25){logger[_0xf466('0x26')](_0xf466('0x47'),JSON[_0xf466('0x22')](_0x3b1d25));});};exports[_0xf466('0x58')]=function(_0x218cb3,_0x4c915c,_0x596164,_0x1be671,_0x336c66,_0x32f789,_0x4f2420){var _0x2bddc2,_0x3d5cd7,_0x46f4c1,_0x858581;_0x32f789[_0xf466('0x1e')]=intUtil['stripTrailingSlash'](_0x32f789[_0xf466('0x1e')]);_0x32f789[_0xf466('0x4b')]=intUtil[_0xf466('0x59')](_0x32f789[_0xf466('0x4b')]);if(_0x4f2420&&_0x4f2420[_0xf466('0x5a')]&&_0x4f2420[_0xf466('0x5a')]!==_0xf466('0x5b')){logger[_0xf466('0x15')](_0xf466('0x5c'),_0xf466('0x48'));_0x4c915c['recordingURL']=util[_0xf466('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32f789[_0xf466('0x4b')],_0x4c915c[_0xf466('0x4c')],md5(_0x4c915c[_0xf466('0x4c')]));}return getConnection(_0x32f789)[_0xf466('0x2f')](function(_0x5857f3){_0x858581=_0x5857f3;return getUser(_0x32f789,_0x1be671?_0x1be671[_0xf466('0x4d')]:'',_0x858581);})[_0xf466('0x2f')](function(_0x36898c){_0x2bddc2=_0x36898c;logger['info']('The\x20User\x20ID\x20is:',_0x2bddc2['id']);return getEndUser(_0x32f789,_0x4c915c[_0xf466('0x5d')],_0x4c915c[_0xf466('0x5e')],_0x858581);})[_0xf466('0x2f')](function(_0x38425b){_0x3d5cd7=_0x38425b;logger[_0xf466('0x15')](_0xf466('0x50'),_0x3d5cd7['id']);return createTicket(_0x32f789,_0x2bddc2,_0x3d5cd7,_0x596164,_0x4c915c,_0x596164[_0xf466('0x51')],_0x858581);})[_0xf466('0x2f')](function(_0x360e6e){_0x46f4c1=_0x360e6e;logger[_0xf466('0x15')](_0xf466('0x52'));logger[_0xf466('0x15')](_0xf466('0x53'),_0x46f4c1['id']);var _0x13d862=util[_0xf466('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x32f789[_0xf466('0x1e')],_[_0xf466('0x55')](_0x46f4c1['id'],'x')[0x1]);logger[_0xf466('0x15')](_0xf466('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf466('0x1d')]('user:%s',_0x1be671[_0xf466('0x13')]),_0xf466('0x5f'),{'uri':_0x13d862});})['catch'](function(_0x3ca00e){logger[_0xf466('0x26')](_0xf466('0x5c'),JSON[_0xf466('0x22')](_0x3ca00e));});};exports[_0xf466('0x60')]=function(_0x40587a,_0x211982,_0x31db0f,_0x56db17,_0x43b4c7,_0x5acfad){var _0x542a4b,_0x49f18e,_0x3c5813,_0xe0d8de;_0x5acfad[_0xf466('0x1e')]=intUtil['stripTrailingSlash'](_0x5acfad[_0xf466('0x1e')]);_0x5acfad[_0xf466('0x4b')]=intUtil['stripTrailingSlash'](_0x5acfad[_0xf466('0x4b')]);if(_0x43b4c7&&_0x43b4c7[_0xf466('0x61')]){logger[_0xf466('0x15')](_0xf466('0x62'),'Recording\x20is\x20enabled!');_0x211982[_0xf466('0x49')]=util[_0xf466('0x1d')](_0xf466('0x4a'),_0x5acfad[_0xf466('0x4b')],_0x211982[_0xf466('0x4c')],md5(_0x211982[_0xf466('0x4c')]));}else{_0x211982[_0xf466('0x49')]='';}return getConnection(_0x5acfad)[_0xf466('0x2f')](function(_0x33157a){_0xe0d8de=_0x33157a;return getUser(_0x5acfad,_0x56db17?_0x56db17[_0xf466('0x4d')]:'',_0xe0d8de);})[_0xf466('0x2f')](function(_0x441966){_0x542a4b=_0x441966;logger[_0xf466('0x15')](_0xf466('0x4e'),_0x542a4b['id']);return getEndUser(_0x5acfad,_0x211982[_0xf466('0x63')],_0x211982[_0xf466('0x4f')],_0xe0d8de);})[_0xf466('0x2f')](function(_0x2bbab3){_0x49f18e=_0x2bbab3;logger['info'](_0xf466('0x50'),_0x49f18e['id']);return createTicket(_0x5acfad,_0x542a4b,_0x49f18e,_0x31db0f,_0x211982,_0x31db0f['Fields'],_0xe0d8de);})[_0xf466('0x2f')](function(_0x4ff39e){_0x3c5813=_0x4ff39e;logger['info'](_0xf466('0x52'));logger[_0xf466('0x15')](_0xf466('0x53'),_0x3c5813['id']);})['catch'](function(_0x5b55f0){logger['error']('[ABANDONED]',JSON['stringify'](_0x5b55f0));});}; \ 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 e99826e..378a2bb 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 _0xe80e=['emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','Enduser\x20found!','find','results','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','username','token','Basic\x20%s','toString','debug','stringify','defaults','GET','length','map','type','string','toLowerCase','content','idField','customField','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','error','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','calleridnum','request-promise','md5','util','./util','../../../../config/logger','zendesk','socket.io-emitter','localhost'];(function(_0x35e21a,_0x689d32){var _0x50949e=function(_0x4ef65d){while(--_0x4ef65d){_0x35e21a['push'](_0x35e21a['shift']());}};_0x50949e(++_0x689d32);}(_0xe80e,0x112));var _0xee80=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xe80e[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var rp=require(_0xee80('0x0'));var md5=require(_0xee80('0x1'));var util=require(_0xee80('0x2'));var intUtil=require(_0xee80('0x3'));var logger=require(_0xee80('0x4'))(_0xee80('0x5'));var io=require(_0xee80('0x6'))({'host':_0xee80('0x7'),'port':0x18eb});function emit(_0x455bf3,_0x5c11dd,_0x1972e9){io['to'](_0x455bf3)[_0xee80('0x8')](_0x5c11dd,_0x1972e9);}var headers={'Content-Type':_0xee80('0x9'),'Accept':_0xee80('0x9')};function getTicket(_0x4a7bd8,_0x4037cd,_0x275d68,_0x31d4b0,_0x5dc175){logger[_0xee80('0xa')](_0xee80('0xb'));return request({'uri':util[_0xee80('0xc')](_0xee80('0xd'),_0x4a7bd8['remoteUri']),'method':_0xee80('0xe'),'body':{'ticket':_[_0xee80('0xf')]({'requester_id':_0x275d68['id'],'submitter_id':_0x4037cd?_0x4037cd['id']:undefined,'assignee_id':_0x4037cd?_0x4037cd['id']:undefined,'tags':getTags(_0x31d4b0['Tags'],_0xee80('0x10')),'subject':intUtil[_0xee80('0x11')](_0x31d4b0[_0xee80('0x12')],_0x5dc175,'\x20'),'description':intUtil['getString'](_0x31d4b0[_0xee80('0x13')],_0x5dc175,'\x0a'),'comment':{'public':![],'body':intUtil[_0xee80('0x11')](_0x31d4b0['Descriptions'],_0x5dc175,'\x0a')}},getCustomFields(_0x31d4b0[_0xee80('0x14')],_0x5dc175))}})[_0xee80('0x15')](function(_0x2ac890){logger[_0xee80('0xa')](_0xee80('0x16'));return _0x2ac890['ticket'];});}function getUser(_0x52bd9f,_0x668d25){logger[_0xee80('0xa')]('Getting\x20agent\x20with\x20email',_0x668d25);return request({'uri':util[_0xee80('0xc')]('%s/search.json',_0x52bd9f[_0xee80('0x17')]),'qs':{'query':util['format'](_0xee80('0x18'),_0x668d25)}})[_0xee80('0x15')](function(_0x4c1ca0){if(_0x4c1ca0[_0xee80('0x19')]){logger['info'](_0xee80('0x1a'));return _['find'](_0x4c1ca0['results'],{'email':_0x668d25,'role':_0xee80('0x1b')});}else{logger[_0xee80('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xee80('0xc')](_0xee80('0x1c'),_0x52bd9f[_0xee80('0x17')])})[_0xee80('0x15')](function(_0x181a29){logger[_0xee80('0xa')]('Admin\x20account\x20selected.');return _0x181a29[_0xee80('0x1d')];});}});}function getEndUser(_0x39a947,_0x235637,_0x59ff26){logger[_0xee80('0xa')](_0xee80('0x1e'),_0x59ff26);return request({'uri':util[_0xee80('0xc')]('%s/search.json',_0x39a947[_0xee80('0x17')]),'qs':{'query':util[_0xee80('0xc')](_0xee80('0x1f'),_0x59ff26)}})[_0xee80('0x15')](function(_0x16ac3c){if(_0x16ac3c[_0xee80('0x19')]){logger[_0xee80('0xa')](_0xee80('0x20'));return _[_0xee80('0x21')](_0x16ac3c[_0xee80('0x22')],{'phone':_0x59ff26,'role':_0xee80('0x23')});}else{logger[_0xee80('0xa')](_0xee80('0x24'));return request({'uri':util[_0xee80('0xc')](_0xee80('0x25'),_0x39a947[_0xee80('0x17')]),'method':_0xee80('0xe'),'body':{'user':{'role':'end-user','name':util[_0xee80('0xc')]('Caller\x20-\x20%s',_0x235637||_0x59ff26),'phone':_0x59ff26}}})[_0xee80('0x15')](function(_0x5cc470){logger['info'](_0xee80('0x26'));return _0x5cc470[_0xee80('0x1d')];});}});}function getAuth(_0x7cf7f9){var _0x44ad41;if(_0x7cf7f9[_0xee80('0x27')]==='password'){_0x44ad41=util[_0xee80('0xc')]('%s:%s',_0x7cf7f9[_0xee80('0x28')],_0x7cf7f9['password']);}else if(_0x7cf7f9[_0xee80('0x27')]===_0xee80('0x29')){_0x44ad41=util[_0xee80('0xc')]('%s/token:%s',_0x7cf7f9[_0xee80('0x28')],_0x7cf7f9['token']);}return util[_0xee80('0xc')](_0xee80('0x2a'),new Buffer(_0x44ad41)[_0xee80('0x2b')]('base64'));}function request(_0x404619){logger[_0xee80('0x2c')]('[HTTP]',JSON[_0xee80('0x2d')](_0x404619));return rp(_[_0xee80('0x2e')](_0x404619,{'method':_0xee80('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x12f1bc,_0x4c00f9){var _0x49e933=[];if(_0x12f1bc&&_0x12f1bc[_0xee80('0x30')]>0x0){_0x49e933=_[_0xee80('0x31')](_0x12f1bc,_0x4c00f9);}return _0x49e933;}function getCustomFields(_0x360696,_0x13dcff){var _0x361766=[];var _0x125bd3={'custom_fields':[]};if(_0x360696[_0xee80('0x30')]>0x0){_['forEach'](_0x360696,function(_0x3ec988){if(_0x3ec988[_0xee80('0x32')]===_0xee80('0x33')&&_0x3ec988['nameField']&&!_0x3ec988['customField']){_0x125bd3[_0x3ec988['nameField'][_0xee80('0x34')]()]=_0x3ec988[_0xee80('0x35')]['toString']();}else if(_0x3ec988[_0xee80('0x32')]==='string'&&_0x3ec988[_0xee80('0x36')]&&_0x3ec988[_0xee80('0x37')]){_0x125bd3[_0xee80('0x38')][_0xee80('0x39')]({'id':_0x3ec988[_0xee80('0x36')],'value':_0x3ec988[_0xee80('0x35')][_0xee80('0x2b')]()});}else if(_0x3ec988[_0xee80('0x32')]==='variable'&&_0x3ec988['variableName']&&_0x3ec988[_0xee80('0x36')]&&_0x3ec988[_0xee80('0x37')]){_0x13dcff[_0x3ec988[_0xee80('0x3a')]]&&_0x125bd3[_0xee80('0x38')]['push']({'id':_0x3ec988[_0xee80('0x36')],'value':_0x13dcff[_0x3ec988[_0xee80('0x3a')]][_0xee80('0x2b')]()});}else if(_0x3ec988[_0xee80('0x32')]===_0xee80('0x3b')&&_0x3ec988[_0xee80('0x3c')]&&_0x3ec988[_0xee80('0x3c')][_0xee80('0x10')]&&_0x3ec988[_0xee80('0x36')]&&_0x3ec988[_0xee80('0x37')]){_0x13dcff[_0x3ec988[_0xee80('0x3c')][_0xee80('0x10')][_0xee80('0x34')]()]&&_0x125bd3[_0xee80('0x38')][_0xee80('0x39')]({'id':_0x3ec988[_0xee80('0x36')],'value':_0x13dcff[_0x3ec988[_0xee80('0x3c')][_0xee80('0x10')][_0xee80('0x34')]()]['toString']()});}});}return _0x125bd3;}exports[_0xee80('0x3d')]=function(_0x17f99b,_0x41f269,_0x119dc2,_0x1d45d8,_0x194965,_0x5990b9){var _0x5b4a20,_0x13815e;_0x5990b9[_0xee80('0x17')]=intUtil[_0xee80('0x3e')](_0x5990b9[_0xee80('0x17')]);_0x5990b9[_0xee80('0x3f')]=intUtil[_0xee80('0x3e')](_0x5990b9[_0xee80('0x3f')]);if(_0x194965&&_0x194965[_0xee80('0x40')]){logger[_0xee80('0xa')](_0xee80('0x41'),'Recording\x20is\x20enabled!');_0x41f269[_0xee80('0x42')]=util[_0xee80('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5990b9[_0xee80('0x3f')],_0x41f269[_0xee80('0x43')],md5(_0x41f269['uniqueid']));}else{_0x41f269[_0xee80('0x42')]='';}headers['Authorization']=getAuth(_0x5990b9);return getUser(_0x5990b9,_0x1d45d8['email'])[_0xee80('0x15')](function(_0x566457){_0x5b4a20=_0x566457;logger[_0xee80('0xa')](_0xee80('0x44'),_0x5b4a20['id']);return getEndUser(_0x5990b9,_0x41f269[_0xee80('0x45')],_0x41f269['calleridnum']);})[_0xee80('0x15')](function(_0x4def89){_0x13815e=_0x4def89;logger['info']('The\x20Enduser\x20ID\x20is:',_0x13815e['id']);return getTicket(_0x5990b9,_0x5b4a20,_0x13815e,_0x119dc2,_0x41f269);})['then'](function(_0x4901ff){if(_0x4901ff){logger['info'](_0xee80('0x46'),_0x4901ff['id']);switch(_0x5990b9[_0xee80('0x32')]){case _0xee80('0x47'):logger[_0xee80('0xa')]('[QUEUE]',_0xee80('0x48'));return request({'uri':util[_0xee80('0xc')](_0xee80('0x49'),_0x5990b9[_0xee80('0x17')],_0x5b4a20['id'],_0x4901ff['id']),'method':_0xee80('0xe')});case _0xee80('0x4a'):logger['info'](_0xee80('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xee80('0xc')](_0xee80('0x4b'),_0x1d45d8['name']),'trigger:browser:url',{'uri':util[_0xee80('0xc')]('%s/agent/tickets/%s',_0x5990b9[_0xee80('0x17')],_0x4901ff['id'])});break;default:logger[_0xee80('0x4c')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xee80('0x4d')](function(_0x479081){logger[_0xee80('0x4c')](_0xee80('0x41'),JSON[_0xee80('0x2d')](_0x479081));});};exports[_0xee80('0x4e')]=function(_0x4390df,_0x563611,_0x52c7e2,_0x4d7b24,_0x41f5de,_0x5a60c1,_0x51f582){var _0x26391c,_0x3dc8a4;_0x5a60c1[_0xee80('0x17')]=intUtil['stripTrailingSlash'](_0x5a60c1[_0xee80('0x17')]);_0x5a60c1[_0xee80('0x3f')]=intUtil[_0xee80('0x3e')](_0x5a60c1[_0xee80('0x3f')]);if(_0x51f582&&_0x51f582[_0xee80('0x4f')]&&_0x51f582[_0xee80('0x4f')]!=='none'){logger[_0xee80('0xa')](_0xee80('0x50'),_0xee80('0x51'));_0x563611['recordingURL']=util[_0xee80('0xc')](_0xee80('0x52'),_0x5a60c1[_0xee80('0x3f')],_0x563611[_0xee80('0x43')],md5(_0x563611[_0xee80('0x43')]));}headers[_0xee80('0x53')]=getAuth(_0x5a60c1);return getUser(_0x5a60c1,_0x4d7b24[_0xee80('0x54')])['then'](function(_0x897b5){_0x26391c=_0x897b5;logger[_0xee80('0xa')]('The\x20User\x20ID\x20is:',_0x26391c['id']);return getEndUser(_0x5a60c1,_0x563611[_0xee80('0x55')],_0x563611[_0xee80('0x56')]);})[_0xee80('0x15')](function(_0x394e4b){_0x3dc8a4=_0x394e4b;logger[_0xee80('0xa')](_0xee80('0x57'),_0x3dc8a4['id']);return getTicket(_0x5a60c1,_0x26391c,_0x3dc8a4,_0x52c7e2,_0x563611);})[_0xee80('0x15')](function(_0x589568){if(_0x589568){logger[_0xee80('0xa')](_0xee80('0x46'),_0x589568['id']);switch(_0x5a60c1[_0xee80('0x32')]){case _0xee80('0x47'):logger['info'](_0xee80('0x50'),_0xee80('0x48'));return request({'uri':util[_0xee80('0xc')](_0xee80('0x49'),_0x5a60c1[_0xee80('0x17')],_0x26391c['id'],_0x589568['id']),'method':_0xee80('0xe')});case _0xee80('0x4a'):logger['info'](_0xee80('0x50'),_0xee80('0x58'));emit(util[_0xee80('0xc')](_0xee80('0x4b'),_0x4d7b24[_0xee80('0x10')]),_0xee80('0x59'),{'uri':util[_0xee80('0xc')]('%s/agent/tickets/%s',_0x5a60c1['remoteUri'],_0x589568['id'])});break;default:logger[_0xee80('0x4c')](_0xee80('0x50'),_0xee80('0x5a'));}}})[_0xee80('0x4d')](function(_0x1effda){logger[_0xee80('0x4c')](_0xee80('0x50'),JSON[_0xee80('0x2d')](_0x1effda));});};exports[_0xee80('0x5b')]=function(_0x4f1fce,_0x49fef1,_0x585696,_0x4028b9,_0x318b36,_0x4930df){var _0xb9e48c,_0x5ea75c;_0x4930df[_0xee80('0x17')]=intUtil['stripTrailingSlash'](_0x4930df[_0xee80('0x17')]);_0x4930df['serverUrl']=intUtil[_0xee80('0x3e')](_0x4930df[_0xee80('0x3f')]);if(_0x318b36&&_0x318b36[_0xee80('0x40')]){logger[_0xee80('0xa')](_0xee80('0x5c'),_0xee80('0x51'));_0x49fef1['recordingURL']=util['format'](_0xee80('0x52'),_0x4930df[_0xee80('0x3f')],_0x49fef1[_0xee80('0x43')],md5(_0x49fef1[_0xee80('0x43')]));}else{_0x49fef1[_0xee80('0x42')]='';}headers[_0xee80('0x53')]=getAuth(_0x4930df);return getUser(_0x4930df)[_0xee80('0x15')](function(_0x16a187){_0xb9e48c=_0x16a187;logger[_0xee80('0xa')](_0xee80('0x44'),_0xb9e48c['id']);return getEndUser(_0x4930df,_0x49fef1[_0xee80('0x45')],_0x49fef1[_0xee80('0x5d')]);})[_0xee80('0x15')](function(_0x1c3791){_0x5ea75c=_0x1c3791;logger[_0xee80('0xa')](_0xee80('0x57'),_0x5ea75c['id']);return getTicket(_0x4930df,_0xb9e48c,_0x5ea75c,_0x585696,_0x49fef1);})['then'](function(_0x444bee){if(_0x444bee){logger['info'](_0xee80('0x46'),_0x444bee['id']);}})[_0xee80('0x4d')](function(_0x37aaf0){logger[_0xee80('0x4c')](_0xee80('0x5c'),JSON['stringify'](_0x37aaf0));});}; \ No newline at end of file +var _0x6986=['[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','abandoned','monitor_format','[ABANDONED]','lodash','request-promise','md5','util','./util','../../../../config/logger','zendesk','socket.io-emitter','localhost','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','getString','Descriptions','Fields','then','info','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','Enduser\x20found!','find','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','token','username','Basic\x20%s','toString','debug','stringify','defaults','length','map','forEach','type','string','customField','nameField','toLowerCase','idField','push','content','variable','variableName','custom_fields','customVariable','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6986,0x194));var _0x6698=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x6986[_0x4d8a8f];return _0xfc4adc;};'use strict';var _=require(_0x6698('0x0'));var rp=require(_0x6698('0x1'));var md5=require(_0x6698('0x2'));var util=require(_0x6698('0x3'));var intUtil=require(_0x6698('0x4'));var logger=require(_0x6698('0x5'))(_0x6698('0x6'));var io=require(_0x6698('0x7'))({'host':_0x6698('0x8'),'port':0x18eb});function emit(_0x32c665,_0x28beea,_0x1a470c){io['to'](_0x32c665)[_0x6698('0x9')](_0x28beea,_0x1a470c);}var headers={'Content-Type':'application/json','Accept':_0x6698('0xa')};function getTicket(_0x2b4202,_0xe2c240,_0x3e9cdc,_0x489452,_0x2a73e4){logger['info'](_0x6698('0xb'));return request({'uri':util[_0x6698('0xc')](_0x6698('0xd'),_0x2b4202[_0x6698('0xe')]),'method':_0x6698('0xf'),'body':{'ticket':_[_0x6698('0x10')]({'requester_id':_0x3e9cdc['id'],'submitter_id':_0xe2c240?_0xe2c240['id']:undefined,'assignee_id':_0xe2c240?_0xe2c240['id']:undefined,'tags':getTags(_0x489452[_0x6698('0x11')],'name'),'subject':intUtil['getString'](_0x489452[_0x6698('0x12')],_0x2a73e4,'\x20'),'description':intUtil[_0x6698('0x13')](_0x489452[_0x6698('0x14')],_0x2a73e4,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6698('0x13')](_0x489452[_0x6698('0x14')],_0x2a73e4,'\x0a')}},getCustomFields(_0x489452[_0x6698('0x15')],_0x2a73e4))}})[_0x6698('0x16')](function(_0x49c9f5){logger[_0x6698('0x17')](_0x6698('0x18'));return _0x49c9f5['ticket'];});}function getUser(_0x58cbce,_0x48bf7f){logger[_0x6698('0x17')](_0x6698('0x19'),_0x48bf7f);return request({'uri':util['format'](_0x6698('0x1a'),_0x58cbce[_0x6698('0xe')]),'qs':{'query':util[_0x6698('0xc')](_0x6698('0x1b'),_0x48bf7f)}})['then'](function(_0x44faac){if(_0x44faac[_0x6698('0x1c')]){logger[_0x6698('0x17')](_0x6698('0x1d'));return _['find'](_0x44faac[_0x6698('0x1e')],{'email':_0x48bf7f,'role':_0x6698('0x1f')});}else{logger[_0x6698('0x17')](_0x6698('0x20'));return request({'uri':util[_0x6698('0xc')](_0x6698('0x21'),_0x58cbce[_0x6698('0xe')])})[_0x6698('0x16')](function(_0xe8c6eb){logger[_0x6698('0x17')](_0x6698('0x22'));return _0xe8c6eb['user'];});}});}function getEndUser(_0x2acc16,_0xf8fe95,_0x3da425){logger[_0x6698('0x17')](_0x6698('0x23'),_0x3da425);return request({'uri':util['format'](_0x6698('0x1a'),_0x2acc16[_0x6698('0xe')]),'qs':{'query':util[_0x6698('0xc')](_0x6698('0x24'),_0x3da425)}})[_0x6698('0x16')](function(_0x3faea7){if(_0x3faea7[_0x6698('0x1c')]){logger[_0x6698('0x17')](_0x6698('0x25'));return _[_0x6698('0x26')](_0x3faea7['results'],{'phone':_0x3da425,'role':_0x6698('0x27')});}else{logger['info'](_0x6698('0x28'));return request({'uri':util[_0x6698('0xc')](_0x6698('0x29'),_0x2acc16[_0x6698('0xe')]),'method':'POST','body':{'user':{'role':_0x6698('0x27'),'name':util['format']('Caller\x20-\x20%s',_0xf8fe95||_0x3da425),'phone':_0x3da425}}})[_0x6698('0x16')](function(_0x115fda){logger['info']('Enduser\x20created.');return _0x115fda['user'];});}});}function getAuth(_0x4d02c4){var _0x64bbbc;if(_0x4d02c4[_0x6698('0x2a')]===_0x6698('0x2b')){_0x64bbbc=util[_0x6698('0xc')]('%s:%s',_0x4d02c4['username'],_0x4d02c4[_0x6698('0x2b')]);}else if(_0x4d02c4['authType']===_0x6698('0x2c')){_0x64bbbc=util[_0x6698('0xc')]('%s/token:%s',_0x4d02c4[_0x6698('0x2d')],_0x4d02c4[_0x6698('0x2c')]);}return util['format'](_0x6698('0x2e'),new Buffer(_0x64bbbc)[_0x6698('0x2f')]('base64'));}function request(_0x585215){logger[_0x6698('0x30')]('[HTTP]',JSON[_0x6698('0x31')](_0x585215));return rp(_[_0x6698('0x32')](_0x585215,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xe4fe55,_0x2b49ab){var _0x1c5b49=[];if(_0xe4fe55&&_0xe4fe55[_0x6698('0x33')]>0x0){_0x1c5b49=_[_0x6698('0x34')](_0xe4fe55,_0x2b49ab);}return _0x1c5b49;}function getCustomFields(_0x3e2b87,_0x4903e8){var _0x1dc9ef=[];var _0x2c8f42={'custom_fields':[]};if(_0x3e2b87[_0x6698('0x33')]>0x0){_[_0x6698('0x35')](_0x3e2b87,function(_0x4f087d){if(_0x4f087d[_0x6698('0x36')]===_0x6698('0x37')&&_0x4f087d['nameField']&&!_0x4f087d[_0x6698('0x38')]){_0x2c8f42[_0x4f087d[_0x6698('0x39')][_0x6698('0x3a')]()]=_0x4f087d['content']['toString']();}else if(_0x4f087d[_0x6698('0x36')]===_0x6698('0x37')&&_0x4f087d[_0x6698('0x3b')]&&_0x4f087d[_0x6698('0x38')]){_0x2c8f42['custom_fields'][_0x6698('0x3c')]({'id':_0x4f087d[_0x6698('0x3b')],'value':_0x4f087d[_0x6698('0x3d')][_0x6698('0x2f')]()});}else if(_0x4f087d[_0x6698('0x36')]===_0x6698('0x3e')&&_0x4f087d[_0x6698('0x3f')]&&_0x4f087d['idField']&&_0x4f087d[_0x6698('0x38')]){_0x4903e8[_0x4f087d['variableName']]&&_0x2c8f42[_0x6698('0x40')][_0x6698('0x3c')]({'id':_0x4f087d[_0x6698('0x3b')],'value':_0x4903e8[_0x4f087d[_0x6698('0x3f')]]['toString']()});}else if(_0x4f087d[_0x6698('0x36')]===_0x6698('0x41')&&_0x4f087d['Variable']&&_0x4f087d[_0x6698('0x42')][_0x6698('0x43')]&&_0x4f087d[_0x6698('0x3b')]&&_0x4f087d[_0x6698('0x38')]){_0x4903e8[_0x4f087d[_0x6698('0x42')]['name']['toLowerCase']()]&&_0x2c8f42[_0x6698('0x40')][_0x6698('0x3c')]({'id':_0x4f087d[_0x6698('0x3b')],'value':_0x4903e8[_0x4f087d[_0x6698('0x42')][_0x6698('0x43')]['toLowerCase']()]['toString']()});}});}return _0x2c8f42;}exports['queue']=function(_0x3e32cc,_0x21f737,_0x4fc87d,_0x3f96ef,_0x4fa1bf,_0x166d2f){var _0x596c34,_0x33fae1;_0x166d2f['remoteUri']=intUtil[_0x6698('0x44')](_0x166d2f[_0x6698('0xe')]);_0x166d2f[_0x6698('0x45')]=intUtil[_0x6698('0x44')](_0x166d2f['serverUrl']);if(_0x4fa1bf&&_0x4fa1bf['monitor_format']){logger[_0x6698('0x17')](_0x6698('0x46'),_0x6698('0x47'));_0x21f737[_0x6698('0x48')]=util['format'](_0x6698('0x49'),_0x166d2f[_0x6698('0x45')],_0x21f737[_0x6698('0x4a')],md5(_0x21f737[_0x6698('0x4a')]));}else{_0x21f737[_0x6698('0x48')]='';}headers['Authorization']=getAuth(_0x166d2f);return getUser(_0x166d2f,_0x3f96ef[_0x6698('0x4b')])['then'](function(_0x346b62){_0x596c34=_0x346b62;logger['info'](_0x6698('0x4c'),_0x596c34['id']);return getEndUser(_0x166d2f,_0x21f737['calleridname'],_0x21f737[_0x6698('0x4d')]);})[_0x6698('0x16')](function(_0x3e9308){_0x33fae1=_0x3e9308;logger[_0x6698('0x17')](_0x6698('0x4e'),_0x33fae1['id']);return getTicket(_0x166d2f,_0x596c34,_0x33fae1,_0x4fc87d,_0x21f737);})['then'](function(_0x2a8a16){if(_0x2a8a16){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2a8a16['id']);switch(_0x166d2f[_0x6698('0x36')]){case _0x6698('0x4f'):logger['info'](_0x6698('0x46'),_0x6698('0x50'));return request({'uri':util[_0x6698('0xc')](_0x6698('0x51'),_0x166d2f['remoteUri'],_0x596c34['id'],_0x2a8a16['id']),'method':_0x6698('0xf')});case _0x6698('0x52'):logger[_0x6698('0x17')](_0x6698('0x46'),_0x6698('0x53'));emit(util[_0x6698('0xc')](_0x6698('0x54'),_0x3f96ef[_0x6698('0x43')]),_0x6698('0x55'),{'uri':util['format']('%s/agent/tickets/%s',_0x166d2f[_0x6698('0xe')],_0x2a8a16['id'])});break;default:logger[_0x6698('0x56')]('[QUEUE]',_0x6698('0x57'));}}})[_0x6698('0x58')](function(_0x36ad07){logger[_0x6698('0x56')]('[QUEUE]',JSON[_0x6698('0x31')](_0x36ad07));});};exports[_0x6698('0x59')]=function(_0x5b1ebc,_0x47d9dc,_0x3d974a,_0x402598,_0x242eed,_0x2caaee,_0x43e8a7){var _0x285aaf,_0x2fc64a;_0x2caaee['remoteUri']=intUtil[_0x6698('0x44')](_0x2caaee[_0x6698('0xe')]);_0x2caaee[_0x6698('0x45')]=intUtil[_0x6698('0x44')](_0x2caaee[_0x6698('0x45')]);if(_0x43e8a7&&_0x43e8a7[_0x6698('0x5a')]&&_0x43e8a7['recordingFormat']!=='none'){logger[_0x6698('0x17')](_0x6698('0x5b'),_0x6698('0x47'));_0x47d9dc['recordingURL']=util[_0x6698('0xc')](_0x6698('0x49'),_0x2caaee[_0x6698('0x45')],_0x47d9dc[_0x6698('0x4a')],md5(_0x47d9dc[_0x6698('0x4a')]));}headers[_0x6698('0x5c')]=getAuth(_0x2caaee);return getUser(_0x2caaee,_0x402598[_0x6698('0x4b')])[_0x6698('0x16')](function(_0x11c8ae){_0x285aaf=_0x11c8ae;logger[_0x6698('0x17')](_0x6698('0x4c'),_0x285aaf['id']);return getEndUser(_0x2caaee,_0x47d9dc[_0x6698('0x5d')],_0x47d9dc[_0x6698('0x5e')]);})[_0x6698('0x16')](function(_0x4ee16d){_0x2fc64a=_0x4ee16d;logger[_0x6698('0x17')]('The\x20Enduser\x20ID\x20is:',_0x2fc64a['id']);return getTicket(_0x2caaee,_0x285aaf,_0x2fc64a,_0x3d974a,_0x47d9dc);})['then'](function(_0x599955){if(_0x599955){logger[_0x6698('0x17')](_0x6698('0x5f'),_0x599955['id']);switch(_0x2caaee[_0x6698('0x36')]){case _0x6698('0x4f'):logger['info']('[OUTBOUND]',_0x6698('0x50'));return request({'uri':util['format'](_0x6698('0x51'),_0x2caaee[_0x6698('0xe')],_0x285aaf['id'],_0x599955['id']),'method':_0x6698('0xf')});case _0x6698('0x52'):logger[_0x6698('0x17')](_0x6698('0x5b'),_0x6698('0x53'));emit(util['format'](_0x6698('0x54'),_0x402598[_0x6698('0x43')]),_0x6698('0x55'),{'uri':util['format']('%s/agent/tickets/%s',_0x2caaee['remoteUri'],_0x599955['id'])});break;default:logger[_0x6698('0x56')](_0x6698('0x5b'),_0x6698('0x57'));}}})[_0x6698('0x58')](function(_0xd52ded){logger[_0x6698('0x56')](_0x6698('0x5b'),JSON['stringify'](_0xd52ded));});};exports[_0x6698('0x60')]=function(_0x45d2f0,_0x1e8fc7,_0x22c6a2,_0xcede6f,_0x418400,_0x4815d8){var _0xf2942e,_0x5d9e5e;_0x4815d8[_0x6698('0xe')]=intUtil[_0x6698('0x44')](_0x4815d8[_0x6698('0xe')]);_0x4815d8[_0x6698('0x45')]=intUtil['stripTrailingSlash'](_0x4815d8[_0x6698('0x45')]);if(_0x418400&&_0x418400[_0x6698('0x61')]){logger[_0x6698('0x17')](_0x6698('0x62'),_0x6698('0x47'));_0x1e8fc7['recordingURL']=util['format'](_0x6698('0x49'),_0x4815d8[_0x6698('0x45')],_0x1e8fc7[_0x6698('0x4a')],md5(_0x1e8fc7[_0x6698('0x4a')]));}else{_0x1e8fc7[_0x6698('0x48')]='';}headers[_0x6698('0x5c')]=getAuth(_0x4815d8);return getUser(_0x4815d8)[_0x6698('0x16')](function(_0x517912){_0xf2942e=_0x517912;logger[_0x6698('0x17')](_0x6698('0x4c'),_0xf2942e['id']);return getEndUser(_0x4815d8,_0x1e8fc7['calleridname'],_0x1e8fc7[_0x6698('0x4d')]);})['then'](function(_0x265097){_0x5d9e5e=_0x265097;logger[_0x6698('0x17')](_0x6698('0x4e'),_0x5d9e5e['id']);return getTicket(_0x4815d8,_0xf2942e,_0x5d9e5e,_0x22c6a2,_0x1e8fc7);})[_0x6698('0x16')](function(_0x5e4d58){if(_0x5e4d58){logger[_0x6698('0x17')]('The\x20Ticket\x20ID\x20is:',_0x5e4d58['id']);}})[_0x6698('0x58')](function(_0xe6a62b){logger['error'](_0x6698('0x62'),JSON[_0x6698('0x31')](_0xe6a62b));});}; \ 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 b75f546..1850068 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 _0x7acd=['content','((Phone:%s))','Leads','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','encodeXML','recorddetail','Enduser\x20created.','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20creation:\x20','debug','[HTTP]','forEach','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','queue','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','abandoned','monitor_format','[ABANDONED]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','lodash','md5','util','./util','xml2json','entities','zoho','socket.io-emitter','localhost','emit','application/json','info','Creating\x20new\x20call...','merge','inbound','outbound','starttime','agentcalledAt','YYYY-MM-DD\x20HH:mm:ss','getString','Subjects','Fields','lastevent','called','Call\x20Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','Call\x20Duration','utc','format','answertime','endtime','diff','mm:ss','CONTACTID','SEMODULE','LEADID','','hasOwnProperty','%s','','https://crm.%s/crm/private/xml/Calls/insertRecords','host','authToken','crmapi','parse','toJson','response','result','Error\x20on\x20call\x20creation:\x20','stringify','Getting\x20agent\x20with\x20email','https://crm.%s/crm/private/json/Users/getUsers','then','users','user','Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','error','The\x20failing\x20result\x20is','Searching\x20enduser\x20with\x20phone','GET','Enduser\x20found\x20in\x20Contacts!','Contacts','row','length','val'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0x7acd,0x1aa));var _0xd7ac=function(_0x3f62d2,_0x11100f){_0x3f62d2=_0x3f62d2-0x0;var _0x5d168c=_0x7acd[_0x3f62d2];return _0x5d168c;};'use strict';var _=require(_0xd7ac('0x0'));var rp=require('request-promise');var md5=require(_0xd7ac('0x1'));var util=require(_0xd7ac('0x2'));var intUtil=require(_0xd7ac('0x3'));var parser=require(_0xd7ac('0x4'));var entities=require(_0xd7ac('0x5'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xd7ac('0x6'));var io=require(_0xd7ac('0x7'))({'host':_0xd7ac('0x8'),'port':0x18eb});function emit(_0x3d428e,_0x4c0b79,_0x45211e){io['to'](_0x3d428e)[_0xd7ac('0x9')](_0x4c0b79,_0x45211e);}var headers={'Content-Type':_0xd7ac('0xa'),'Accept':'application/json'};function getCall(_0x2f06cf,_0x53a3fb,_0x2d981d,_0xd0aae4,_0x3e655b,_0x58e023){logger[_0xd7ac('0xb')](_0xd7ac('0xc'));var _0x55d9da=_[_0xd7ac('0xd')]({'SMOWNERID':_0x53a3fb['id'],'Call Type':_0x58e023||_0xd7ac('0xe'),'Call Start Time':(_0x58e023===_0xd7ac('0xf')?_0x3e655b[_0xd7ac('0x10')]:_0x3e655b[_0xd7ac('0x11')])||moment()['format'](_0xd7ac('0x12')),'Subject':intUtil[_0xd7ac('0x13')](_0xd0aae4[_0xd7ac('0x14')],_0x3e655b,'\x20'),'Description':intUtil[_0xd7ac('0x13')](_0xd0aae4['Descriptions'],_0x3e655b,'\x0a')},getCustomFields(_0xd0aae4[_0xd7ac('0x15')],_0x3e655b));switch(_0x3e655b[_0xd7ac('0x16')]){case _0xd7ac('0x17'):_0x55d9da[_0xd7ac('0x18')]=_0xd7ac('0x19');break;case _0xd7ac('0x1a'):case _0xd7ac('0x1b'):_0x55d9da[_0xd7ac('0x18')]=_0xd7ac('0x1c');break;case _0xd7ac('0x1d'):_0x55d9da[_0xd7ac('0x18')]=_0xd7ac('0x1e');break;case'abandoned':_0x55d9da['Call\x20Result']=_0xd7ac('0x1f');break;default:}if(_0x3e655b['talktime']){_0x55d9da[_0xd7ac('0x20')]=moment[_0xd7ac('0x21')](parseInt(_0x3e655b['talktime'])*0x3e8)[_0xd7ac('0x22')]('mm:ss');}else if(_0x3e655b[_0xd7ac('0x23')]&&_0x3e655b[_0xd7ac('0x24')]){_0x55d9da['Call\x20Duration']=moment['utc'](moment(_0x3e655b[_0xd7ac('0x24')],_0xd7ac('0x12'))[_0xd7ac('0x25')](moment(_0x3e655b[_0xd7ac('0x10')],_0xd7ac('0x12'))))[_0xd7ac('0x22')](_0xd7ac('0x26'));}if(_0x2d981d[_0xd7ac('0x27')]){_0x55d9da['CONTACTID']=_0x2d981d[_0xd7ac('0x27')];}else if(_0x2d981d['LEADID']){_0x55d9da[_0xd7ac('0x28')]='Leads';_0x55d9da['SEID']=_0x2d981d[_0xd7ac('0x29')];}var _0x1a1341=_0xd7ac('0x2a');for(var _0x1a205e in _0x55d9da){if(_0x55d9da[_0xd7ac('0x2b')](_0x1a205e)){_0x1a1341+=util['format'](_0xd7ac('0x2c'),entities['encodeXML'](_0x1a205e),entities['encodeXML'](_0x55d9da[_0x1a205e]));}}_0x1a1341+=_0xd7ac('0x2d');return request({'method':'POST','uri':util['format'](_0xd7ac('0x2e'),_0x2f06cf[_0xd7ac('0x2f')]),'qs':{'authtoken':_0x2f06cf[_0xd7ac('0x30')],'scope':_0xd7ac('0x31'),'xmlData':_0x1a1341},'json':!![]})['then'](function(_0xff67b8){_0xff67b8=JSON[_0xd7ac('0x32')](parser[_0xd7ac('0x33')](_0xff67b8));if(_0xff67b8[_0xd7ac('0x34')]){if(_0xff67b8[_0xd7ac('0x34')][_0xd7ac('0x35')]&&_0xff67b8['response'][_0xd7ac('0x35')]['recorddetail']){logger[_0xd7ac('0xb')]('Call\x20created!');return{'id':_0xff67b8['response'][_0xd7ac('0x35')]['recorddetail']['FL'][0x0]['$t']};}}throw new Error(_0xd7ac('0x36')+JSON[_0xd7ac('0x37')](_0xff67b8));});}function getUser(_0x2ce990,_0x210a9d){_0x210a9d&&logger[_0xd7ac('0xb')](_0xd7ac('0x38'),_0x210a9d);return request({'method':'GET','uri':util[_0xd7ac('0x22')](_0xd7ac('0x39'),_0x2ce990[_0xd7ac('0x2f')]),'qs':{'type':'AllUsers','authtoken':_0x2ce990[_0xd7ac('0x30')],'scope':_0xd7ac('0x31')},'json':!![]})[_0xd7ac('0x3a')](function(_0x238ef7){if(_0x238ef7[_0xd7ac('0x3b')]&&_0x238ef7[_0xd7ac('0x3b')][_0xd7ac('0x3c')]){var _0xcbc5d9;if(_0x210a9d){_0xcbc5d9=_['find'](_0x238ef7['users'][_0xd7ac('0x3c')],{'email':_0x210a9d,'profile':_0xd7ac('0x3d')});}if(_0xcbc5d9){logger[_0xd7ac('0xb')](_0xd7ac('0x3e'));}else{logger[_0xd7ac('0xb')](_0xd7ac('0x3f'));_0xcbc5d9=_['find'](_0x238ef7[_0xd7ac('0x3b')][_0xd7ac('0x3c')],{'profile':_0xd7ac('0x40')});}return _0xcbc5d9;}else{logger[_0xd7ac('0x41')](_0xd7ac('0x42'),JSON[_0xd7ac('0x37')](_0x238ef7));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd7ac('0x37')](_0x238ef7));}});}function getEndUser(_0x2804aa,_0x1bd318,_0x31c9b4){logger[_0xd7ac('0xb')](_0xd7ac('0x43'),_0x31c9b4);return request({'method':_0xd7ac('0x44'),'uri':util[_0xd7ac('0x22')]('https://crm.%s/crm/private/json/Contacts/searchRecords',_0x2804aa[_0xd7ac('0x2f')]),'qs':{'authtoken':_0x2804aa['authToken'],'scope':_0xd7ac('0x31'),'criteria':util[_0xd7ac('0x22')]('((Phone:%s))',_0x31c9b4)},'json':!![]})[_0xd7ac('0x3a')](function(_0x33972b){if(_0x33972b[_0xd7ac('0x34')]&&_0x33972b['response'][_0xd7ac('0x35')]){logger['info'](_0xd7ac('0x45'));var _0x127121={};var _0x3f2c63=_0x33972b['response'][_0xd7ac('0x35')][_0xd7ac('0x46')][_0xd7ac('0x47')]['no']?_0x33972b[_0xd7ac('0x34')][_0xd7ac('0x35')][_0xd7ac('0x46')][_0xd7ac('0x47')]['FL']:_0x33972b['response']['result'][_0xd7ac('0x46')][_0xd7ac('0x47')][0x0]['FL'];for(var _0x54bdac=0x0,_0x1822cb=_0x3f2c63[_0xd7ac('0x48')];_0x54bdac<_0x1822cb;_0x54bdac++){_0x127121[_0x3f2c63[_0x54bdac][_0xd7ac('0x49')]]=_0x3f2c63[_0x54bdac][_0xd7ac('0x4a')];}return _0x127121;}else{return request({'method':_0xd7ac('0x44'),'uri':util[_0xd7ac('0x22')]('https://crm.%s/crm/private/json/Leads/searchRecords',_0x2804aa[_0xd7ac('0x2f')]),'qs':{'authtoken':_0x2804aa[_0xd7ac('0x30')],'scope':_0xd7ac('0x31'),'criteria':util[_0xd7ac('0x22')](_0xd7ac('0x4b'),_0x31c9b4)},'json':!![]})[_0xd7ac('0x3a')](function(_0x4f22e7){if(_0x4f22e7[_0xd7ac('0x34')]&&_0x4f22e7[_0xd7ac('0x34')][_0xd7ac('0x35')]){logger[_0xd7ac('0xb')]('Enduser\x20found\x20in\x20Leads!');var _0x37d555={};var _0x3af3e9=_0x4f22e7[_0xd7ac('0x34')]['result'][_0xd7ac('0x4c')][_0xd7ac('0x47')]['no']?_0x4f22e7[_0xd7ac('0x34')][_0xd7ac('0x35')]['Leads'][_0xd7ac('0x47')]['FL']:_0x4f22e7[_0xd7ac('0x34')][_0xd7ac('0x35')][_0xd7ac('0x4c')][_0xd7ac('0x47')][0x0]['FL'];for(var _0x5a8695=0x0,_0x5969d5=_0x3af3e9[_0xd7ac('0x48')];_0x5a8695<_0x5969d5;_0x5a8695++){_0x37d555[_0x3af3e9[_0x5a8695][_0xd7ac('0x49')]]=_0x3af3e9[_0x5a8695][_0xd7ac('0x4a')];}return _0x37d555;}else{logger[_0xd7ac('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x1bd318=getName(_0x1bd318);return request({'method':'POST','uri':util[_0xd7ac('0x22')](_0xd7ac('0x4d'),_0x2804aa['host']),'qs':{'authtoken':_0x2804aa['authToken'],'scope':_0xd7ac('0x31'),'xmlData':util[_0xd7ac('0x22')](_0xd7ac('0x4e'),entities[_0xd7ac('0x4f')](_0x1bd318[0x0]),entities[_0xd7ac('0x4f')](_0x1bd318[0x1]),_0x31c9b4)},'json':!![]})[_0xd7ac('0x3a')](function(_0xac8f81){_0xac8f81=JSON[_0xd7ac('0x32')](parser['toJson'](_0xac8f81));if(_0xac8f81[_0xd7ac('0x34')]){if(_0xac8f81[_0xd7ac('0x34')][_0xd7ac('0x35')]&&_0xac8f81[_0xd7ac('0x34')][_0xd7ac('0x35')][_0xd7ac('0x50')]){logger[_0xd7ac('0xb')](_0xd7ac('0x51'));return request({'method':_0xd7ac('0x44'),'uri':util[_0xd7ac('0x22')](_0xd7ac('0x52'),_0x2804aa[_0xd7ac('0x2f')]),'qs':{'authtoken':_0x2804aa[_0xd7ac('0x30')],'scope':_0xd7ac('0x31'),'id':_0xac8f81[_0xd7ac('0x34')][_0xd7ac('0x35')][_0xd7ac('0x50')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0xd7ac('0x53')+JSON['stringify'](_0xac8f81));})['then'](function(_0x1638e4){if(_0x1638e4[_0xd7ac('0x34')]){if(_0x1638e4['response'][_0xd7ac('0x35')]){var _0x58616b={};for(var _0x2e89b1=0x0,_0x1adacd=_0x1638e4['response'][_0xd7ac('0x35')][_0xd7ac('0x4c')][_0xd7ac('0x47')]['FL'][_0xd7ac('0x48')];_0x2e89b1<_0x1adacd;_0x2e89b1++){_0x58616b[_0x1638e4[_0xd7ac('0x34')][_0xd7ac('0x35')][_0xd7ac('0x4c')][_0xd7ac('0x47')]['FL'][_0x2e89b1][_0xd7ac('0x49')]]=_0x1638e4[_0xd7ac('0x34')][_0xd7ac('0x35')][_0xd7ac('0x4c')][_0xd7ac('0x47')]['FL'][_0x2e89b1][_0xd7ac('0x4a')];}return _0x58616b;}}throw new Error('Error\x20on\x20Lead\x20retrieve:\x20'+JSON[_0xd7ac('0x37')](_0x1638e4));});}});}});}function request(_0xbf0077){logger[_0xd7ac('0x54')](_0xd7ac('0x55'),JSON[_0xd7ac('0x37')](_0xbf0077));return rp(_0xbf0077);}function getCustomFields(_0x54485d,_0x5c0802){var _0x218d38={};if(_0x54485d['length']>0x0){_[_0xd7ac('0x56')](_0x54485d,function(_0x5a163e){if(_0x5a163e['type']==='string'&&_0x5a163e[_0xd7ac('0x57')]){_0x218d38[_0x5a163e['idField']]=_0x5a163e[_0xd7ac('0x4a')][_0xd7ac('0x58')]();}else if(_0x5a163e[_0xd7ac('0x59')]===_0xd7ac('0x5a')&&_0x5a163e[_0xd7ac('0x5b')]&&_0x5a163e[_0xd7ac('0x57')]&&_0x5c0802[_0x5a163e[_0xd7ac('0x5b')]]){_0x218d38[_0x5a163e['idField']]=_0x5c0802[_0x5a163e[_0xd7ac('0x5b')]][_0xd7ac('0x58')]();}else if(_0x5a163e[_0xd7ac('0x59')]===_0xd7ac('0x5c')&&_0x5a163e[_0xd7ac('0x5d')]&&_0x5a163e['Variable'][_0xd7ac('0x5e')]&&_0x5a163e[_0xd7ac('0x57')]&&_0x5c0802[_0x5a163e[_0xd7ac('0x5d')]['name'][_0xd7ac('0x5f')]()]){_0x218d38[_0x5a163e[_0xd7ac('0x57')]]=_0x5c0802[_0x5a163e[_0xd7ac('0x5d')][_0xd7ac('0x5e')][_0xd7ac('0x5f')]()]['toString']();}});}return _0x218d38;}function getName(_0x498f67){if(_0x498f67[_0xd7ac('0x60')]('\x20')>0x0){var _0x379d08=_0x498f67[_0xd7ac('0x61')](/ (.+)/);if(_0x379d08[0x1]){return _0x379d08;}}return[_0x498f67,_0x498f67];}exports[_0xd7ac('0x62')]=function(_0x121b95,_0x1c1ce2,_0x5e3ef7,_0x9a83d2,_0x2dacb6,_0x516ae3){var _0x386643,_0x373c43;if(_0x2dacb6&&_0x2dacb6['monitor_format']){logger[_0xd7ac('0xb')](_0xd7ac('0x63'),_0xd7ac('0x64'));_0x1c1ce2[_0xd7ac('0x65')]=util[_0xd7ac('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x516ae3[_0xd7ac('0x66')],_0x1c1ce2[_0xd7ac('0x67')],md5(_0x1c1ce2[_0xd7ac('0x67')]));}else{_0x1c1ce2[_0xd7ac('0x65')]='';}return getUser(_0x516ae3,_0x9a83d2[_0xd7ac('0x68')])[_0xd7ac('0x3a')](function(_0x1231e4){_0x386643=_0x1231e4;logger['info'](_0xd7ac('0x69'),_0x386643['id']);return getEndUser(_0x516ae3,_0x1c1ce2['calleridname'],_0x1c1ce2[_0xd7ac('0x6a')]);})[_0xd7ac('0x3a')](function(_0x48a5c6){_0x373c43=_0x48a5c6;logger[_0xd7ac('0xb')](_0xd7ac('0x6b'),_0x373c43[_0xd7ac('0x27')]||_0x373c43[_0xd7ac('0x29')]);return getCall(_0x516ae3,_0x386643,_0x373c43,_0x5e3ef7,_0x1c1ce2,_0xd7ac('0x6c'));})[_0xd7ac('0x3a')](function(_0x249e3a){if(_0x249e3a){logger['info'](_0xd7ac('0x6d'),_0x249e3a['id']);logger[_0xd7ac('0xb')](_0xd7ac('0x63'),_0xd7ac('0x6e'));emit(util[_0xd7ac('0x22')](_0xd7ac('0x6f'),_0x9a83d2[_0xd7ac('0x5e')]),'trigger:browser:url',{'uri':util['format'](_0xd7ac('0x70'),_0x516ae3[_0xd7ac('0x2f')],_0x249e3a['id'])});}})[_0xd7ac('0x71')](function(_0x27a439){logger[_0xd7ac('0x41')](_0xd7ac('0x63'),JSON[_0xd7ac('0x37')](_0x27a439));});};exports[_0xd7ac('0xf')]=function(_0x5da723,_0x2a06d7,_0x36ee49,_0x4790aa,_0xa7996e,_0xfdfe88,_0x1d76cc){var _0x30be42,_0x8c3b9c;if(_0x1d76cc&&_0x1d76cc[_0xd7ac('0x72')]&&_0x1d76cc[_0xd7ac('0x72')]!==_0xd7ac('0x73')){logger[_0xd7ac('0xb')]('[OUTBOUND]',_0xd7ac('0x64'));_0x2a06d7[_0xd7ac('0x65')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfdfe88[_0xd7ac('0x66')],_0x2a06d7[_0xd7ac('0x67')],md5(_0x2a06d7[_0xd7ac('0x67')]));}return getUser(_0xfdfe88,_0x4790aa[_0xd7ac('0x68')])['then'](function(_0x5e2c46){_0x30be42=_0x5e2c46;logger[_0xd7ac('0xb')]('The\x20User\x20ID\x20is:',_0x30be42['id']);return getEndUser(_0xfdfe88,_0x2a06d7[_0xd7ac('0x74')],_0x2a06d7[_0xd7ac('0x75')]);})[_0xd7ac('0x3a')](function(_0x4d760a){_0x8c3b9c=_0x4d760a;logger['info'](_0xd7ac('0x6b'),_0x8c3b9c[_0xd7ac('0x27')]||_0x8c3b9c[_0xd7ac('0x29')]);return getCall(_0xfdfe88,_0x30be42,_0x8c3b9c,_0x36ee49,_0x2a06d7,_0xd7ac('0x76'));})[_0xd7ac('0x3a')](function(_0x1dd23b){if(_0x1dd23b){logger['info'](_0xd7ac('0x6d'),_0x1dd23b['id']);logger['info'](_0xd7ac('0x77'),_0xd7ac('0x6e'));emit(util[_0xd7ac('0x22')]('user:%s',_0x4790aa[_0xd7ac('0x5e')]),'trigger:browser:url',{'uri':util['format'](_0xd7ac('0x70'),_0xfdfe88['host'],_0x1dd23b['id'])});}})['catch'](function(_0x4623b2){logger['error']('[OUTBOUND]',JSON[_0xd7ac('0x37')](_0x4623b2));});};exports[_0xd7ac('0x78')]=function(_0x43931a,_0x174570,_0x4b5c01,_0x178de8,_0x322a5e,_0x336006){var _0xf97063,_0x4e07d1;if(_0x322a5e&&_0x322a5e[_0xd7ac('0x79')]){logger['info'](_0xd7ac('0x7a'),_0xd7ac('0x64'));_0x174570[_0xd7ac('0x65')]=util[_0xd7ac('0x22')](_0xd7ac('0x7b'),_0x336006[_0xd7ac('0x66')],_0x174570[_0xd7ac('0x67')],md5(_0x174570[_0xd7ac('0x67')]));}else{_0x174570[_0xd7ac('0x65')]='';}return getUser(_0x336006)[_0xd7ac('0x3a')](function(_0x1f1da5){_0xf97063=_0x1f1da5;logger[_0xd7ac('0xb')]('The\x20User\x20ID\x20is:',_0xf97063['id']);return getEndUser(_0x336006,_0x174570[_0xd7ac('0x7c')],_0x174570['calleridnum']);})['then'](function(_0x5ca77f){_0x4e07d1=_0x5ca77f;logger[_0xd7ac('0xb')](_0xd7ac('0x6b'),_0x4e07d1[_0xd7ac('0x27')]||_0x4e07d1[_0xd7ac('0x29')]);return getCall(_0x336006,_0xf97063,_0x4e07d1,_0x4b5c01,_0x174570,'Inbound');})['then'](function(_0x2ca5e4){if(_0x2ca5e4){logger[_0xd7ac('0xb')](_0xd7ac('0x6d'),_0x2ca5e4['id']);}})['catch'](function(_0x2633d8){logger[_0xd7ac('0x41')]('[ABANDONED]',JSON[_0xd7ac('0x37')](_0x2633d8));});}; \ No newline at end of file +var _0x4162=['CONTACTID','LEADID','SEMODULE','Leads','SEID','','hasOwnProperty','%s','encodeXML','','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','authToken','crmapi','parse','toJson','response','result','recorddetail','Call\x20created!','Error\x20on\x20call\x20creation:\x20','stringify','Getting\x20agent\x20with\x20email','https://crm.%s/crm/private/json/Users/getUsers','host','AllUsers','then','users','user','find','Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','GET','https://crm.%s/crm/private/json/Contacts/searchRecords','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','row','Contacts','length','val','content','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','Enduser\x20created.','Error\x20on\x20Lead\x20creation:\x20','[HTTP]','forEach','string','idField','toString','type','variableName','Variable','name','toLowerCase','indexOf','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','abandoned','[ABANDONED]','serverUrl','calleridname','calleridnum','The\x20Call\x20ID\x20is:','lodash','util','xml2json','entities','moment','../../../../config/logger','localhost','application/json','info','merge','outbound','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','getString','Subjects','Called','complete','connect','Call\x20Result','rejected','Rejected','Abandoned','talktime','Call\x20Duration','utc','mm:ss','answertime','endtime','diff','starttime'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x4162,0x143));var _0x2416=function(_0x31411f,_0x2f95ec){_0x31411f=_0x31411f-0x0;var _0x3d51ee=_0x4162[_0x31411f];return _0x3d51ee;};'use strict';var _=require(_0x2416('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x2416('0x1'));var intUtil=require('./util');var parser=require(_0x2416('0x2'));var entities=require(_0x2416('0x3'));var moment=require(_0x2416('0x4'));var logger=require(_0x2416('0x5'))('zoho');var io=require('socket.io-emitter')({'host':_0x2416('0x6'),'port':0x18eb});function emit(_0x3e2d24,_0x5b48da,_0x48ff74){io['to'](_0x3e2d24)['emit'](_0x5b48da,_0x48ff74);}var headers={'Content-Type':'application/json','Accept':_0x2416('0x7')};function getCall(_0x14aa58,_0x57c8ff,_0x336c50,_0x13324b,_0x1ab64f,_0x10cf69){logger[_0x2416('0x8')]('Creating\x20new\x20call...');var _0x50617c=_[_0x2416('0x9')]({'SMOWNERID':_0x57c8ff['id'],'Call Type':_0x10cf69||'inbound','Call Start Time':(_0x10cf69===_0x2416('0xa')?_0x1ab64f['starttime']:_0x1ab64f[_0x2416('0xb')])||moment()[_0x2416('0xc')](_0x2416('0xd')),'Subject':intUtil[_0x2416('0xe')](_0x13324b[_0x2416('0xf')],_0x1ab64f,'\x20'),'Description':intUtil['getString'](_0x13324b['Descriptions'],_0x1ab64f,'\x0a')},getCustomFields(_0x13324b['Fields'],_0x1ab64f));switch(_0x1ab64f['lastevent']){case'called':_0x50617c['Call\x20Result']=_0x2416('0x10');break;case _0x2416('0x11'):case _0x2416('0x12'):_0x50617c[_0x2416('0x13')]='Answered';break;case _0x2416('0x14'):_0x50617c['Call\x20Result']=_0x2416('0x15');break;case'abandoned':_0x50617c['Call\x20Result']=_0x2416('0x16');break;default:}if(_0x1ab64f[_0x2416('0x17')]){_0x50617c[_0x2416('0x18')]=moment[_0x2416('0x19')](parseInt(_0x1ab64f['talktime'])*0x3e8)[_0x2416('0xc')](_0x2416('0x1a'));}else if(_0x1ab64f[_0x2416('0x1b')]&&_0x1ab64f[_0x2416('0x1c')]){_0x50617c['Call\x20Duration']=moment[_0x2416('0x19')](moment(_0x1ab64f[_0x2416('0x1c')],_0x2416('0xd'))[_0x2416('0x1d')](moment(_0x1ab64f[_0x2416('0x1e')],'YYYY-MM-DD\x20HH:mm:ss')))[_0x2416('0xc')](_0x2416('0x1a'));}if(_0x336c50[_0x2416('0x1f')]){_0x50617c[_0x2416('0x1f')]=_0x336c50[_0x2416('0x1f')];}else if(_0x336c50[_0x2416('0x20')]){_0x50617c[_0x2416('0x21')]=_0x2416('0x22');_0x50617c[_0x2416('0x23')]=_0x336c50['LEADID'];}var _0x3ef5be=_0x2416('0x24');for(var _0x2cd787 in _0x50617c){if(_0x50617c[_0x2416('0x25')](_0x2cd787)){_0x3ef5be+=util['format'](_0x2416('0x26'),entities[_0x2416('0x27')](_0x2cd787),entities['encodeXML'](_0x50617c[_0x2cd787]));}}_0x3ef5be+=_0x2416('0x28');return request({'method':_0x2416('0x29'),'uri':util[_0x2416('0xc')](_0x2416('0x2a'),_0x14aa58['host']),'qs':{'authtoken':_0x14aa58[_0x2416('0x2b')],'scope':_0x2416('0x2c'),'xmlData':_0x3ef5be},'json':!![]})['then'](function(_0x33e6ce){_0x33e6ce=JSON[_0x2416('0x2d')](parser[_0x2416('0x2e')](_0x33e6ce));if(_0x33e6ce[_0x2416('0x2f')]){if(_0x33e6ce[_0x2416('0x2f')][_0x2416('0x30')]&&_0x33e6ce[_0x2416('0x2f')][_0x2416('0x30')][_0x2416('0x31')]){logger[_0x2416('0x8')](_0x2416('0x32'));return{'id':_0x33e6ce[_0x2416('0x2f')][_0x2416('0x30')][_0x2416('0x31')]['FL'][0x0]['$t']};}}throw new Error(_0x2416('0x33')+JSON[_0x2416('0x34')](_0x33e6ce));});}function getUser(_0x154c39,_0x588797){_0x588797&&logger[_0x2416('0x8')](_0x2416('0x35'),_0x588797);return request({'method':'GET','uri':util['format'](_0x2416('0x36'),_0x154c39[_0x2416('0x37')]),'qs':{'type':_0x2416('0x38'),'authtoken':_0x154c39[_0x2416('0x2b')],'scope':_0x2416('0x2c')},'json':!![]})[_0x2416('0x39')](function(_0x4ef126){if(_0x4ef126[_0x2416('0x3a')]&&_0x4ef126[_0x2416('0x3a')][_0x2416('0x3b')]){var _0x529e95;if(_0x588797){_0x529e95=_[_0x2416('0x3c')](_0x4ef126[_0x2416('0x3a')][_0x2416('0x3b')],{'email':_0x588797,'profile':_0x2416('0x3d')});}if(_0x529e95){logger['info'](_0x2416('0x3e'));}else{logger[_0x2416('0x8')](_0x2416('0x3f'));_0x529e95=_['find'](_0x4ef126['users'][_0x2416('0x3b')],{'profile':_0x2416('0x40')});}return _0x529e95;}else{logger[_0x2416('0x41')](_0x2416('0x42'),JSON['stringify'](_0x4ef126));throw new Error(_0x2416('0x43')+JSON[_0x2416('0x34')](_0x4ef126));}});}function getEndUser(_0x58efd4,_0x4e9c4b,_0x547efc){logger[_0x2416('0x8')](_0x2416('0x44'),_0x547efc);return request({'method':_0x2416('0x45'),'uri':util[_0x2416('0xc')](_0x2416('0x46'),_0x58efd4[_0x2416('0x37')]),'qs':{'authtoken':_0x58efd4[_0x2416('0x2b')],'scope':'crmapi','criteria':util[_0x2416('0xc')](_0x2416('0x47'),_0x547efc)},'json':!![]})[_0x2416('0x39')](function(_0x5120f5){if(_0x5120f5[_0x2416('0x2f')]&&_0x5120f5[_0x2416('0x2f')]['result']){logger[_0x2416('0x8')](_0x2416('0x48'));var _0x4c15b3={};var _0x1127b8=_0x5120f5[_0x2416('0x2f')][_0x2416('0x30')]['Contacts'][_0x2416('0x49')]['no']?_0x5120f5[_0x2416('0x2f')]['result'][_0x2416('0x4a')][_0x2416('0x49')]['FL']:_0x5120f5[_0x2416('0x2f')]['result']['Contacts'][_0x2416('0x49')][0x0]['FL'];for(var _0x4b4b01=0x0,_0x1bb13f=_0x1127b8[_0x2416('0x4b')];_0x4b4b01<_0x1bb13f;_0x4b4b01++){_0x4c15b3[_0x1127b8[_0x4b4b01][_0x2416('0x4c')]]=_0x1127b8[_0x4b4b01][_0x2416('0x4d')];}return _0x4c15b3;}else{return request({'method':_0x2416('0x45'),'uri':util[_0x2416('0xc')]('https://crm.%s/crm/private/json/Leads/searchRecords',_0x58efd4['host']),'qs':{'authtoken':_0x58efd4['authToken'],'scope':'crmapi','criteria':util[_0x2416('0xc')](_0x2416('0x47'),_0x547efc)},'json':!![]})[_0x2416('0x39')](function(_0x3606da){if(_0x3606da[_0x2416('0x2f')]&&_0x3606da[_0x2416('0x2f')][_0x2416('0x30')]){logger[_0x2416('0x8')]('Enduser\x20found\x20in\x20Leads!');var _0x5a3a6d={};var _0x1cede4=_0x3606da[_0x2416('0x2f')][_0x2416('0x30')][_0x2416('0x22')][_0x2416('0x49')]['no']?_0x3606da[_0x2416('0x2f')][_0x2416('0x30')]['Leads'][_0x2416('0x49')]['FL']:_0x3606da[_0x2416('0x2f')][_0x2416('0x30')][_0x2416('0x22')]['row'][0x0]['FL'];for(var _0x7763b8=0x0,_0x491a6b=_0x1cede4[_0x2416('0x4b')];_0x7763b8<_0x491a6b;_0x7763b8++){_0x5a3a6d[_0x1cede4[_0x7763b8]['val']]=_0x1cede4[_0x7763b8][_0x2416('0x4d')];}return _0x5a3a6d;}else{logger[_0x2416('0x8')](_0x2416('0x4e'));_0x4e9c4b=getName(_0x4e9c4b);return request({'method':_0x2416('0x29'),'uri':util[_0x2416('0xc')](_0x2416('0x4f'),_0x58efd4['host']),'qs':{'authtoken':_0x58efd4[_0x2416('0x2b')],'scope':_0x2416('0x2c'),'xmlData':util[_0x2416('0xc')](_0x2416('0x50'),entities[_0x2416('0x27')](_0x4e9c4b[0x0]),entities[_0x2416('0x27')](_0x4e9c4b[0x1]),_0x547efc)},'json':!![]})['then'](function(_0x1f20e2){_0x1f20e2=JSON['parse'](parser[_0x2416('0x2e')](_0x1f20e2));if(_0x1f20e2[_0x2416('0x2f')]){if(_0x1f20e2[_0x2416('0x2f')][_0x2416('0x30')]&&_0x1f20e2['response'][_0x2416('0x30')][_0x2416('0x31')]){logger['info'](_0x2416('0x51'));return request({'method':_0x2416('0x45'),'uri':util['format']('https://crm.%s/crm/private/json/Leads/getRecordById',_0x58efd4[_0x2416('0x37')]),'qs':{'authtoken':_0x58efd4[_0x2416('0x2b')],'scope':_0x2416('0x2c'),'id':_0x1f20e2[_0x2416('0x2f')][_0x2416('0x30')][_0x2416('0x31')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x2416('0x52')+JSON[_0x2416('0x34')](_0x1f20e2));})['then'](function(_0x1e1aba){if(_0x1e1aba[_0x2416('0x2f')]){if(_0x1e1aba[_0x2416('0x2f')][_0x2416('0x30')]){var _0x52ad8f={};for(var _0x4064d5=0x0,_0x180600=_0x1e1aba['response'][_0x2416('0x30')][_0x2416('0x22')]['row']['FL'][_0x2416('0x4b')];_0x4064d5<_0x180600;_0x4064d5++){_0x52ad8f[_0x1e1aba[_0x2416('0x2f')][_0x2416('0x30')][_0x2416('0x22')][_0x2416('0x49')]['FL'][_0x4064d5][_0x2416('0x4c')]]=_0x1e1aba[_0x2416('0x2f')][_0x2416('0x30')][_0x2416('0x22')]['row']['FL'][_0x4064d5][_0x2416('0x4d')];}return _0x52ad8f;}}throw new Error('Error\x20on\x20Lead\x20retrieve:\x20'+JSON[_0x2416('0x34')](_0x1e1aba));});}});}});}function request(_0x6e0026){logger['debug'](_0x2416('0x53'),JSON[_0x2416('0x34')](_0x6e0026));return rp(_0x6e0026);}function getCustomFields(_0x163460,_0x4c204){var _0x6bcb52={};if(_0x163460[_0x2416('0x4b')]>0x0){_[_0x2416('0x54')](_0x163460,function(_0x59c4db){if(_0x59c4db['type']===_0x2416('0x55')&&_0x59c4db[_0x2416('0x56')]){_0x6bcb52[_0x59c4db['idField']]=_0x59c4db['content'][_0x2416('0x57')]();}else if(_0x59c4db[_0x2416('0x58')]==='variable'&&_0x59c4db[_0x2416('0x59')]&&_0x59c4db[_0x2416('0x56')]&&_0x4c204[_0x59c4db[_0x2416('0x59')]]){_0x6bcb52[_0x59c4db[_0x2416('0x56')]]=_0x4c204[_0x59c4db[_0x2416('0x59')]][_0x2416('0x57')]();}else if(_0x59c4db[_0x2416('0x58')]==='customVariable'&&_0x59c4db['Variable']&&_0x59c4db[_0x2416('0x5a')][_0x2416('0x5b')]&&_0x59c4db[_0x2416('0x56')]&&_0x4c204[_0x59c4db[_0x2416('0x5a')][_0x2416('0x5b')]['toLowerCase']()]){_0x6bcb52[_0x59c4db[_0x2416('0x56')]]=_0x4c204[_0x59c4db[_0x2416('0x5a')][_0x2416('0x5b')][_0x2416('0x5c')]()]['toString']();}});}return _0x6bcb52;}function getName(_0x5e3c95){if(_0x5e3c95[_0x2416('0x5d')]('\x20')>0x0){var _0x4ac987=_0x5e3c95['split'](/ (.+)/);if(_0x4ac987[0x1]){return _0x4ac987;}}return[_0x5e3c95,_0x5e3c95];}exports['queue']=function(_0x1f4aee,_0x136a78,_0x40c5ab,_0xc148fc,_0x3dc57f,_0x469d7c){var _0x109b60,_0x13ef65;if(_0x3dc57f&&_0x3dc57f[_0x2416('0x5e')]){logger[_0x2416('0x8')](_0x2416('0x5f'),_0x2416('0x60'));_0x136a78[_0x2416('0x61')]=util[_0x2416('0xc')](_0x2416('0x62'),_0x469d7c['serverUrl'],_0x136a78[_0x2416('0x63')],md5(_0x136a78[_0x2416('0x63')]));}else{_0x136a78[_0x2416('0x61')]='';}return getUser(_0x469d7c,_0xc148fc['email'])['then'](function(_0x3d10f6){_0x109b60=_0x3d10f6;logger[_0x2416('0x8')](_0x2416('0x64'),_0x109b60['id']);return getEndUser(_0x469d7c,_0x136a78['calleridname'],_0x136a78['calleridnum']);})[_0x2416('0x39')](function(_0x261423){_0x13ef65=_0x261423;logger[_0x2416('0x8')](_0x2416('0x65'),_0x13ef65['CONTACTID']||_0x13ef65[_0x2416('0x20')]);return getCall(_0x469d7c,_0x109b60,_0x13ef65,_0x40c5ab,_0x136a78,'Inbound');})[_0x2416('0x39')](function(_0x5d8eba){if(_0x5d8eba){logger[_0x2416('0x8')]('The\x20Call\x20ID\x20is:',_0x5d8eba['id']);logger[_0x2416('0x8')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2416('0xc')]('user:%s',_0xc148fc[_0x2416('0x5b')]),_0x2416('0x66'),{'uri':util[_0x2416('0xc')](_0x2416('0x67'),_0x469d7c['host'],_0x5d8eba['id'])});}})[_0x2416('0x68')](function(_0x2b7e6a){logger[_0x2416('0x41')](_0x2416('0x5f'),JSON[_0x2416('0x34')](_0x2b7e6a));});};exports[_0x2416('0xa')]=function(_0x3ffd4d,_0x36eb2b,_0x3f6077,_0x34d9f6,_0x5b83d6,_0x24343a,_0x4b4357){var _0x31351e,_0x2d7a79;if(_0x4b4357&&_0x4b4357['recordingFormat']&&_0x4b4357['recordingFormat']!==_0x2416('0x69')){logger[_0x2416('0x8')](_0x2416('0x6a'),_0x2416('0x60'));_0x36eb2b['recordingURL']=util[_0x2416('0xc')](_0x2416('0x62'),_0x24343a['serverUrl'],_0x36eb2b[_0x2416('0x63')],md5(_0x36eb2b[_0x2416('0x63')]));}return getUser(_0x24343a,_0x34d9f6[_0x2416('0x6b')])['then'](function(_0x59759a){_0x31351e=_0x59759a;logger['info'](_0x2416('0x64'),_0x31351e['id']);return getEndUser(_0x24343a,_0x36eb2b[_0x2416('0x6c')],_0x36eb2b[_0x2416('0x6d')]);})[_0x2416('0x39')](function(_0x6a4d1e){_0x2d7a79=_0x6a4d1e;logger['info'](_0x2416('0x65'),_0x2d7a79[_0x2416('0x1f')]||_0x2d7a79[_0x2416('0x20')]);return getCall(_0x24343a,_0x31351e,_0x2d7a79,_0x3f6077,_0x36eb2b,'Outbound');})[_0x2416('0x39')](function(_0x2acc23){if(_0x2acc23){logger[_0x2416('0x8')]('The\x20Call\x20ID\x20is:',_0x2acc23['id']);logger[_0x2416('0x8')](_0x2416('0x6a'),_0x2416('0x6e'));emit(util['format'](_0x2416('0x6f'),_0x34d9f6[_0x2416('0x5b')]),_0x2416('0x66'),{'uri':util[_0x2416('0xc')](_0x2416('0x67'),_0x24343a[_0x2416('0x37')],_0x2acc23['id'])});}})['catch'](function(_0x236a6a){logger[_0x2416('0x41')](_0x2416('0x6a'),JSON[_0x2416('0x34')](_0x236a6a));});};exports[_0x2416('0x70')]=function(_0x4b0c93,_0x28949b,_0x45b1b9,_0x1b7d65,_0x5f1d39,_0x1b791b){var _0x524ed5,_0x39d43d;if(_0x5f1d39&&_0x5f1d39[_0x2416('0x5e')]){logger[_0x2416('0x8')](_0x2416('0x71'),'Recording\x20is\x20enabled!');_0x28949b['recordingURL']=util[_0x2416('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b791b[_0x2416('0x72')],_0x28949b['uniqueid'],md5(_0x28949b['uniqueid']));}else{_0x28949b[_0x2416('0x61')]='';}return getUser(_0x1b791b)[_0x2416('0x39')](function(_0x18a9dd){_0x524ed5=_0x18a9dd;logger[_0x2416('0x8')](_0x2416('0x64'),_0x524ed5['id']);return getEndUser(_0x1b791b,_0x28949b[_0x2416('0x73')],_0x28949b[_0x2416('0x74')]);})['then'](function(_0x14b01c){_0x39d43d=_0x14b01c;logger['info'](_0x2416('0x65'),_0x39d43d[_0x2416('0x1f')]||_0x39d43d[_0x2416('0x20')]);return getCall(_0x1b791b,_0x524ed5,_0x39d43d,_0x45b1b9,_0x28949b,'Inbound');})[_0x2416('0x39')](function(_0x351001){if(_0x351001){logger['info'](_0x2416('0x75'),_0x351001['id']);}})[_0x2416('0x68')](function(_0xc95661){logger[_0x2416('0x41')](_0x2416('0x71'),JSON[_0x2416('0x34')](_0xc95661));});}; \ 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 35dc8b8..5e3a929 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 _0x27c3=['data2','data1','POST','body','format','catch','%s\x20%s\x20%s\x20[%s]:%s','statusCode','name','request-promise','util','mustache','../../../../config/logger','trigger','exec','toUpperCase','render'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x27c3,0xf7));var _0x327c=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0x27c3[_0x4c2f30];return _0xb8854d;};'use strict';var rp=require(_0x327c('0x0'));var util=require(_0x327c('0x1'));var Mustache=require(_0x327c('0x2'));var logger=require(_0x327c('0x3'))(_0x327c('0x4'));exports[_0x327c('0x5')]=function(_0xf76689,_0x3d38d7){var _0x2c2eec={'method':_0xf76689['data1'][_0x327c('0x6')](),'uri':encodeURI(Mustache[_0x327c('0x7')](_0xf76689[_0x327c('0x8')],_0x3d38d7)),'json':!![],'resolveWithFullResponse':!![]};switch(_0xf76689[_0x327c('0x9')][_0x327c('0x6')]()){case'GET':_0x2c2eec['qs']=_0x3d38d7;break;case _0x327c('0xa'):_0x2c2eec[_0x327c('0xb')]=_0xf76689['data7']?Mustache['render'](_0xf76689['data7'],_0x3d38d7):_0x3d38d7;break;}rp(_0x2c2eec)['then'](function(_0x2a1661){logger['info'](util[_0x327c('0xc')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s',_0xf76689['data1'],_0xf76689[_0x327c('0x8')],_0x2a1661['statusCode'],_0x2a1661[_0x327c('0xb')]));})[_0x327c('0xd')](function(_0xd3db34){logger['error'](util['format'](_0x327c('0xe'),_0xf76689['data1'],_0xf76689['data2'],_0xd3db34[_0x327c('0xf')],_0xd3db34[_0x327c('0x10')],_0xd3db34['message']));});}; \ No newline at end of file +var _0x447c=['trigger','exec','data1','toUpperCase','data2','GET','POST','body','data7','render','then','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','error','message','request-promise','util','mustache','../../../../config/logger'];(function(_0x1d94b7,_0x5988e5){var _0x40a258=function(_0x3da766){while(--_0x3da766){_0x1d94b7['push'](_0x1d94b7['shift']());}};_0x40a258(++_0x5988e5);}(_0x447c,0x1e2));var _0xc447=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x447c[_0x263a74];return _0x2aa86c;};'use strict';var rp=require(_0xc447('0x0'));var util=require(_0xc447('0x1'));var Mustache=require(_0xc447('0x2'));var logger=require(_0xc447('0x3'))(_0xc447('0x4'));exports[_0xc447('0x5')]=function(_0x89c222,_0x158067){var _0x1bc399={'method':_0x89c222[_0xc447('0x6')][_0xc447('0x7')](),'uri':encodeURI(Mustache['render'](_0x89c222[_0xc447('0x8')],_0x158067)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x89c222['data1'][_0xc447('0x7')]()){case _0xc447('0x9'):_0x1bc399['qs']=_0x158067;break;case _0xc447('0xa'):_0x1bc399[_0xc447('0xb')]=_0x89c222[_0xc447('0xc')]?Mustache[_0xc447('0xd')](_0x89c222[_0xc447('0xc')],_0x158067):_0x158067;break;}rp(_0x1bc399)[_0xc447('0xe')](function(_0x1ef1fd){logger['info'](util['format'](_0xc447('0xf'),_0x89c222[_0xc447('0x6')],_0x89c222[_0xc447('0x8')],_0x1ef1fd['statusCode'],_0x1ef1fd[_0xc447('0xb')]));})['catch'](function(_0x24d605){logger[_0xc447('0x10')](util['format']('%s\x20%s\x20%s\x20[%s]:%s',_0x89c222[_0xc447('0x6')],_0x89c222[_0xc447('0x8')],_0x24d605['statusCode'],_0x24d605['name'],_0x24d605[_0xc447('0x11')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c9d2112..68f6cb9 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 _0x6c32=['error','rpc','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug'];(function(_0x1f1e7e,_0x3064bd){var _0x6ca600=function(_0x504893){while(--_0x504893){_0x1f1e7e['push'](_0x1f1e7e['shift']());}};_0x6ca600(++_0x3064bd);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x26c3('0x0'));var BPromise=require(_0x26c3('0x1'));var logger=require(_0x26c3('0x2'))(_0x26c3('0x3'));var client=jayson[_0x26c3('0x4')][_0x26c3('0x5')]({'port':0x2329});client[_0x26c3('0x6')]=function(_0x321cc5,_0x36528a){return new BPromise(function(_0x49d4a1,_0x2bd400){return client[_0x26c3('0x7')](_0x321cc5,_0x36528a)[_0x26c3('0x8')](function(_0x57d915){logger[_0x26c3('0x9')]('rpc',_0x26c3('0x3'),_0x321cc5,_0x36528a,_0x57d915);if(_0x57d915[_0x26c3('0xa')]){logger[_0x26c3('0xa')](_0x26c3('0xb'),_0x26c3('0x3'),_0x321cc5,_0x57d915[_0x26c3('0xa')][_0x26c3('0xc')],_0x36528a);return _0x2bd400(_0x57d915[_0x26c3('0xa')][_0x26c3('0xc')]);}else{return _0x49d4a1(_0x57d915[_0x26c3('0xd')]);}})['catch'](function(_0x498d88){logger['error']('rpc',_0x26c3('0x3'),_0x321cc5,_0x498d88,_0x36528a);return _0x2bd400(_0x498d88);});});};module[_0x26c3('0xe')]=client; \ No newline at end of file +var _0x6ec9=['jayson/promise','../../config/logger','client','Request','request','then','error','routing','message','catch','rpc','exports'];(function(_0x4f1946,_0x2d29f4){var _0xf6b11a=function(_0x251f23){while(--_0x251f23){_0x4f1946['push'](_0x4f1946['shift']());}};_0xf6b11a(++_0x2d29f4);}(_0x6ec9,0x174));var _0x96ec=function(_0x879727,_0x51646a){_0x879727=_0x879727-0x0;var _0x141c95=_0x6ec9[_0x879727];return _0x141c95;};'use strict';var jayson=require(_0x96ec('0x0'));var BPromise=require('bluebird');var logger=require(_0x96ec('0x1'))('routing');var client=jayson[_0x96ec('0x2')]['http']({'port':0x2329});client[_0x96ec('0x3')]=function(_0x51fc7c,_0x112569){return new BPromise(function(_0x286bd7,_0x47a972){return client[_0x96ec('0x4')](_0x51fc7c,_0x112569)[_0x96ec('0x5')](function(_0x2fcbb7){logger['debug']('rpc','routing',_0x51fc7c,_0x112569,_0x2fcbb7);if(_0x2fcbb7[_0x96ec('0x6')]){logger[_0x96ec('0x6')]('rpc',_0x96ec('0x7'),_0x51fc7c,_0x2fcbb7[_0x96ec('0x6')][_0x96ec('0x8')],_0x112569);return _0x47a972(_0x2fcbb7[_0x96ec('0x6')]['message']);}else{return _0x286bd7(_0x2fcbb7['result']);}})[_0x96ec('0x9')](function(_0x45dfa7){logger[_0x96ec('0x6')](_0x96ec('0xa'),_0x96ec('0x7'),_0x51fc7c,_0x45dfa7,_0x112569);return _0x47a972(_0x45dfa7);});});};module[_0x96ec('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f08e0d6..04e1bda 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 _0x1744=['log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','catch'];(function(_0x20e487,_0x5365db){var _0x3c78a4=function(_0x1a4201){while(--_0x1a4201){_0x20e487['push'](_0x20e487['shift']());}};_0x3c78a4(++_0x5365db);}(_0x1744,0xef));var _0x4174=function(_0x5204d9,_0x23cdab){_0x5204d9=_0x5204d9-0x0;var _0x1825cd=_0x1744[_0x5204d9];return _0x1825cd;};'use strict';var BPromise=require(_0x4174('0x0'));var server=require(_0x4174('0x1'));var Realtime=require(_0x4174('0x2'));var EmailChannel=require(_0x4174('0x3'));var mailAccount=require(_0x4174('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x4174('0x5')]()['then'](mailAccount[_0x4174('0x6')]())[_0x4174('0x7')](realtime[_0x4174('0x8')]())[_0x4174('0x7')](function(){email[_0x4174('0x9')](realtime[_0x4174('0xa')]);return realtime;});}function main(){return server[_0x4174('0xb')](realtime,email)[_0x4174('0x7')](function(_0x5c2ac5){return initRealtime();})['then'](function(_0xbbc6f0){return setInterval(initRealtime,0x2710);})[_0x4174('0xc')](function(_0x2a015b){console[_0x4174('0xd')](_0x2a015b);});}main(); \ No newline at end of file +var _0x0710=['bluebird','./realtime','./lib/email','then','mailAccounts','listen','catch','log'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0710,0x110));var _0x0071=function(_0x530bfb,_0x47e6ba){_0x530bfb=_0x530bfb-0x0;var _0xb8e7cf=_0x0710[_0x530bfb];return _0xb8e7cf;};'use strict';var BPromise=require(_0x0071('0x0'));var server=require('./server');var Realtime=require(_0x0071('0x1'));var EmailChannel=require(_0x0071('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x0071('0x3')](mailAccount['getMailAccounts']())['then'](realtime['initMailAccounts']())[_0x0071('0x3')](function(){email['refresh'](realtime[_0x0071('0x4')]);return realtime;});}function main(){return server[_0x0071('0x5')](realtime,email)[_0x0071('0x3')](function(_0xc10571){return initRealtime();})[_0x0071('0x3')](function(_0x2a3983){return setInterval(initRealtime,0x2710);})[_0x0071('0x6')](function(_0x1670dc){console[_0x0071('0x7')](_0x1670dc);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1d84bf5..0f0f438 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 _0xf66e=['./imap','./smtp','../../../config/logger','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','active','email','box','handleImapEmail','bind','end','handleImapEnd','handleImapError','isNil','status','disabled','handleImapBox','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','info','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','error','send','verifySmtp','Smtp','lastSync','then','catch','lodash','moment','bluebird','md5','socket.io-emitter','localhost'];(function(_0xcd3891,_0x41db47){var _0x1f0719=function(_0x3c7ec2){while(--_0x3c7ec2){_0xcd3891['push'](_0xcd3891['shift']());}};_0x1f0719(++_0x41db47);}(_0xf66e,0xf4));var _0xef66=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf66e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xef66('0x0'));var moment=require(_0xef66('0x1'));var BPromise=require(_0xef66('0x2'));var md5=require(_0xef66('0x3'));var io=require(_0xef66('0x4'))({'host':_0xef66('0x5'),'port':0x18eb});var EmailImap=require(_0xef66('0x6'));var EmailSmtp=require(_0xef66('0x7'));var logger=require(_0xef66('0x8'))('email');var mailAccount=require(_0xef66('0x9'));var md5Accounts={};function EmailChannel(_0x3f255c){logger['info']('start\x20email\x20channel');this[_0xef66('0xa')]=_0x3f255c[_0xef66('0xa')];this[_0xef66('0xb')]={};this[_0xef66('0xc')]=new EmailSmtp();}EmailChannel[_0xef66('0xd')][_0xef66('0xe')]=function(_0x160a71){var _0x5b8011=this[_0xef66('0xa')][_0x160a71];var _0x3746a7={'id':_0x5b8011['id'],'name':_0x5b8011[_0xef66('0xf')],'key':_0x5b8011[_0xef66('0x10')],'active':_0x5b8011['active'],'Imap':{'status':_0x5b8011[_0xef66('0x11')]['status'],'messageStatus':_0x5b8011['Imap'][_0xef66('0x12')],'total':_0x5b8011[_0xef66('0x11')][_0xef66('0x13')]}};if(_['isNil'](md5Accounts[_0x160a71])){md5Accounts[_0x160a71]={};}var _0x573898=md5(JSON[_0xef66('0x14')](_0x3746a7));if(md5Accounts[_0x160a71][_0xef66('0x3')]!==_0x573898){md5Accounts[_0x160a71]['md5']=_0x573898;io[_0xef66('0xe')](_0xef66('0x15'),_0x3746a7);}};EmailChannel[_0xef66('0xd')][_0xef66('0x16')]=function(_0x3ebbdb){for(var _0x1cbcde in _0x3ebbdb){if(_0x3ebbdb[_0xef66('0x17')](_0x1cbcde)){if(_0x3ebbdb[_0x1cbcde][_0xef66('0x11')]&&_0x3ebbdb[_0x1cbcde][_0xef66('0x18')]){var _0x559d3e=_0x3ebbdb[_0x1cbcde][_0xef66('0x11')];if(!this[_0xef66('0xb')][_0xef66('0x17')](_0x559d3e['id'])){this['imapAccounts'][_0x559d3e['id']]=new EmailImap(_0x559d3e,_0x3ebbdb[_0x1cbcde][_0xef66('0x19')]);this['imapAccounts'][_0x559d3e['id']]['on'](_0xef66('0x1a'),this['handleImapBox']['bind'](this,_0x1cbcde));this[_0xef66('0xb')][_0x559d3e['id']]['on']('email',this[_0xef66('0x1b')][_0xef66('0x1c')](this,_0x1cbcde));this[_0xef66('0xb')][_0x559d3e['id']]['on'](_0xef66('0x1d'),this[_0xef66('0x1e')]['bind'](this,_0x1cbcde));this[_0xef66('0xb')][_0x559d3e['id']]['on']('error',this[_0xef66('0x1f')][_0xef66('0x1c')](this,_0x1cbcde));}}else{if(_[_0xef66('0x20')](this['mailAccounts'][_0x1cbcde][_0xef66('0x11')])){this['mailAccounts'][_0x1cbcde][_0xef66('0x11')]={};}this[_0xef66('0xa')][_0x1cbcde]['Imap'][_0xef66('0x21')]=_0xef66('0x22');this[_0xef66('0xa')][_0x1cbcde][_0xef66('0x11')][_0xef66('0x12')]='';this[_0xef66('0xe')](_0x1cbcde);}}}};EmailChannel[_0xef66('0xd')][_0xef66('0x23')]=function(_0x2b5f33,_0x2c5df0){if(this['mailAccounts'][_0x2b5f33]){this['mailAccounts'][_0x2b5f33][_0xef66('0x11')][_0xef66('0x21')]='connected';this['mailAccounts'][_0x2b5f33][_0xef66('0x11')]['messageStatus']=_0x2c5df0[_0xef66('0xf')];if(_0x2c5df0[_0xef66('0x24')]){this[_0xef66('0xa')][_0x2b5f33][_0xef66('0x11')][_0xef66('0x13')]=_0x2c5df0[_0xef66('0x24')][_0xef66('0x13')];}return this[_0xef66('0xe')](_0x2b5f33);}};EmailChannel[_0xef66('0xd')][_0xef66('0x1b')]=function(_0x1a91ef,_0x472f46){logger['info'](_0xef66('0x25'),_0x472f46['firstName'],_0x472f46[_0xef66('0x26')],_0x472f46[_0xef66('0x27')],_0x1a91ef);if(this[_0xef66('0xa')][_0x1a91ef]){return mailAccount['notify'](_0x1a91ef,_0x472f46)['then'](function(_0x3e178f){if(_0x3e178f){logger[_0xef66('0x28')](_0xef66('0x29'));}})['catch'](function(_0x283939){logger['error'](_0xef66('0x2a'),JSON[_0xef66('0x14')](_0x283939));});}};EmailChannel['prototype'][_0xef66('0x1e')]=function(_0x2f8bb8){if(this[_0xef66('0xa')][_0x2f8bb8]&&this[_0xef66('0xa')][_0x2f8bb8][_0xef66('0x11')]){if(this[_0xef66('0xb')][this[_0xef66('0xa')][_0x2f8bb8][_0xef66('0x11')]['id']]){delete this['imapAccounts'][this[_0xef66('0xa')][_0x2f8bb8][_0xef66('0x11')]['id']];}this[_0xef66('0xa')][_0x2f8bb8][_0xef66('0x11')]['lastSync']=moment();this[_0xef66('0xe')](_0x2f8bb8);}};EmailChannel['prototype']['handleImapError']=function(_0x43c39c,_0x44e2f0){if(this[_0xef66('0xa')][_0x43c39c]){this[_0xef66('0xa')][_0x43c39c][_0xef66('0x11')][_0xef66('0x21')]=_0xef66('0x2b');this[_0xef66('0xa')][_0x43c39c][_0xef66('0x11')]['messageStatus']=_0x44e2f0;return this[_0xef66('0xe')](_0x43c39c);}};EmailChannel[_0xef66('0xd')]['sendMail']=function(_0x1ed503,_0x107e12){return this[_0xef66('0xc')][_0xef66('0x2c')](_0x1ed503,_0x107e12);};EmailChannel[_0xef66('0xd')][_0xef66('0x2d')]=function(_0x82bf4e){var _0x5e3b30=this;if(this[_0xef66('0xa')][_0x82bf4e['id']]){if(_['isNil'](this['mailAccounts'][_0x82bf4e['id']][_0xef66('0x2e')])){this[_0xef66('0xa')][_0x82bf4e['id']]['Smtp']={};}this[_0xef66('0xa')][_0x82bf4e['id']][_0xef66('0x2e')][_0xef66('0x2f')]=moment();return new BPromise(function(_0x113111,_0x5bb077){return _0x5e3b30['smtp']['verify'](_0x82bf4e)[_0xef66('0x30')](function(_0x40dd3b){_0x5e3b30[_0xef66('0xa')][_0x82bf4e['id']][_0xef66('0x2e')][_0xef66('0x21')]='verified';_0x5e3b30[_0xef66('0xa')][_0x82bf4e['id']][_0xef66('0x2e')][_0xef66('0x12')]='';_0x5e3b30['emit'](_0x82bf4e['id']);_0x113111(_0x40dd3b);})[_0xef66('0x31')](function(_0x92be89){_0x5e3b30[_0xef66('0xa')][_0x82bf4e['id']][_0xef66('0x2e')]['status']='error';_0x5e3b30[_0xef66('0xa')][_0x82bf4e['id']]['Smtp'][_0xef66('0x12')]=_0x92be89;_0x5e3b30[_0xef66('0xe')](_0x82bf4e['id']);_0x5bb077(_0x92be89);});});}return this[_0xef66('0xc')]['verify'](_0x82bf4e);};module['exports']=EmailChannel; \ No newline at end of file +var _0xd666=['handleImapBox','handleImapEmail','bind','handleImapEnd','error','handleImapError','isNil','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','Smtp','verify','exports','lodash','moment','socket.io-emitter','localhost','./imap','./smtp','email','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','md5','mailAccount:update','refresh','hasOwnProperty','box'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0xd666,0x110));var _0x6d66=function(_0x3bf2d5,_0x36116c){_0x3bf2d5=_0x3bf2d5-0x0;var _0x29e958=_0xd666[_0x3bf2d5];return _0x29e958;};'use strict';var _=require(_0x6d66('0x0'));var moment=require(_0x6d66('0x1'));var BPromise=require('bluebird');var md5=require('md5');var io=require(_0x6d66('0x2'))({'host':_0x6d66('0x3'),'port':0x18eb});var EmailImap=require(_0x6d66('0x4'));var EmailSmtp=require(_0x6d66('0x5'));var logger=require('../../../config/logger')(_0x6d66('0x6'));var mailAccount=require(_0x6d66('0x7'));var md5Accounts={};function EmailChannel(_0xc6929c){logger[_0x6d66('0x8')](_0x6d66('0x9'));this['mailAccounts']=_0xc6929c[_0x6d66('0xa')];this[_0x6d66('0xb')]={};this[_0x6d66('0xc')]=new EmailSmtp();}EmailChannel[_0x6d66('0xd')][_0x6d66('0xe')]=function(_0x266db1){var _0x7d339b=this[_0x6d66('0xa')][_0x266db1];var _0x510ab6={'id':_0x7d339b['id'],'name':_0x7d339b[_0x6d66('0xf')],'key':_0x7d339b[_0x6d66('0x10')],'active':_0x7d339b[_0x6d66('0x11')],'Imap':{'status':_0x7d339b[_0x6d66('0x12')][_0x6d66('0x13')],'messageStatus':_0x7d339b[_0x6d66('0x12')][_0x6d66('0x14')],'total':_0x7d339b[_0x6d66('0x12')][_0x6d66('0x15')]}};if(_['isNil'](md5Accounts[_0x266db1])){md5Accounts[_0x266db1]={};}var _0xa138bb=md5(JSON[_0x6d66('0x16')](_0x510ab6));if(md5Accounts[_0x266db1][_0x6d66('0x17')]!==_0xa138bb){md5Accounts[_0x266db1][_0x6d66('0x17')]=_0xa138bb;io[_0x6d66('0xe')](_0x6d66('0x18'),_0x510ab6);}};EmailChannel['prototype'][_0x6d66('0x19')]=function(_0x2b5c04){for(var _0x3f954b in _0x2b5c04){if(_0x2b5c04[_0x6d66('0x1a')](_0x3f954b)){if(_0x2b5c04[_0x3f954b][_0x6d66('0x12')]&&_0x2b5c04[_0x3f954b][_0x6d66('0x11')]){var _0x24ca97=_0x2b5c04[_0x3f954b]['Imap'];if(!this[_0x6d66('0xb')][_0x6d66('0x1a')](_0x24ca97['id'])){this[_0x6d66('0xb')][_0x24ca97['id']]=new EmailImap(_0x24ca97,_0x2b5c04[_0x3f954b][_0x6d66('0x6')]);this[_0x6d66('0xb')][_0x24ca97['id']]['on'](_0x6d66('0x1b'),this[_0x6d66('0x1c')]['bind'](this,_0x3f954b));this[_0x6d66('0xb')][_0x24ca97['id']]['on'](_0x6d66('0x6'),this[_0x6d66('0x1d')][_0x6d66('0x1e')](this,_0x3f954b));this[_0x6d66('0xb')][_0x24ca97['id']]['on']('end',this[_0x6d66('0x1f')]['bind'](this,_0x3f954b));this[_0x6d66('0xb')][_0x24ca97['id']]['on'](_0x6d66('0x20'),this[_0x6d66('0x21')][_0x6d66('0x1e')](this,_0x3f954b));}}else{if(_[_0x6d66('0x22')](this[_0x6d66('0xa')][_0x3f954b][_0x6d66('0x12')])){this[_0x6d66('0xa')][_0x3f954b][_0x6d66('0x12')]={};}this[_0x6d66('0xa')][_0x3f954b]['Imap']['status']='disabled';this[_0x6d66('0xa')][_0x3f954b][_0x6d66('0x12')][_0x6d66('0x14')]='';this[_0x6d66('0xe')](_0x3f954b);}}}};EmailChannel[_0x6d66('0xd')]['handleImapBox']=function(_0x58a8d8,_0xf57789){if(this[_0x6d66('0xa')][_0x58a8d8]){this[_0x6d66('0xa')][_0x58a8d8][_0x6d66('0x12')][_0x6d66('0x13')]=_0x6d66('0x23');this[_0x6d66('0xa')][_0x58a8d8][_0x6d66('0x12')][_0x6d66('0x14')]=_0xf57789['name'];if(_0xf57789['messages']){this[_0x6d66('0xa')][_0x58a8d8][_0x6d66('0x12')][_0x6d66('0x15')]=_0xf57789[_0x6d66('0x24')]['total'];}return this[_0x6d66('0xe')](_0x58a8d8);}};EmailChannel[_0x6d66('0xd')]['handleImapEmail']=function(_0x6d2feb,_0x55cbc8){logger[_0x6d66('0x8')](_0x6d66('0x25'),_0x55cbc8['firstName'],_0x55cbc8[_0x6d66('0x26')],_0x55cbc8[_0x6d66('0x27')],_0x6d2feb);if(this[_0x6d66('0xa')][_0x6d2feb]){return mailAccount[_0x6d66('0x28')](_0x6d2feb,_0x55cbc8)[_0x6d66('0x29')](function(_0x437069){if(_0x437069){logger[_0x6d66('0x8')](_0x6d66('0x2a'));}})[_0x6d66('0x2b')](function(_0x3c2ffd){logger[_0x6d66('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x6d66('0x16')](_0x3c2ffd));});}};EmailChannel['prototype'][_0x6d66('0x1f')]=function(_0x2ad381){if(this[_0x6d66('0xa')][_0x2ad381]&&this['mailAccounts'][_0x2ad381][_0x6d66('0x12')]){if(this[_0x6d66('0xb')][this[_0x6d66('0xa')][_0x2ad381][_0x6d66('0x12')]['id']]){delete this['imapAccounts'][this[_0x6d66('0xa')][_0x2ad381][_0x6d66('0x12')]['id']];}this[_0x6d66('0xa')][_0x2ad381][_0x6d66('0x12')][_0x6d66('0x2c')]=moment();this[_0x6d66('0xe')](_0x2ad381);}};EmailChannel[_0x6d66('0xd')]['handleImapError']=function(_0x3e5635,_0x30acbc){if(this['mailAccounts'][_0x3e5635]){this[_0x6d66('0xa')][_0x3e5635][_0x6d66('0x12')][_0x6d66('0x13')]=_0x6d66('0x20');this[_0x6d66('0xa')][_0x3e5635][_0x6d66('0x12')][_0x6d66('0x14')]=_0x30acbc;return this[_0x6d66('0xe')](_0x3e5635);}};EmailChannel[_0x6d66('0xd')][_0x6d66('0x2d')]=function(_0x2fb871,_0x10b8c2){return this[_0x6d66('0xc')][_0x6d66('0x2e')](_0x2fb871,_0x10b8c2);};EmailChannel[_0x6d66('0xd')]['verifySmtp']=function(_0x1e27ea){var _0x264846=this;if(this[_0x6d66('0xa')][_0x1e27ea['id']]){if(_[_0x6d66('0x22')](this['mailAccounts'][_0x1e27ea['id']][_0x6d66('0x2f')])){this[_0x6d66('0xa')][_0x1e27ea['id']][_0x6d66('0x2f')]={};}this[_0x6d66('0xa')][_0x1e27ea['id']][_0x6d66('0x2f')][_0x6d66('0x2c')]=moment();return new BPromise(function(_0x552755,_0x4f5fb0){return _0x264846[_0x6d66('0xc')][_0x6d66('0x30')](_0x1e27ea)[_0x6d66('0x29')](function(_0x517e25){_0x264846[_0x6d66('0xa')][_0x1e27ea['id']][_0x6d66('0x2f')][_0x6d66('0x13')]='verified';_0x264846[_0x6d66('0xa')][_0x1e27ea['id']]['Smtp']['messageStatus']='';_0x264846[_0x6d66('0xe')](_0x1e27ea['id']);_0x552755(_0x517e25);})['catch'](function(_0xbbfc7d){_0x264846['mailAccounts'][_0x1e27ea['id']][_0x6d66('0x2f')][_0x6d66('0x13')]=_0x6d66('0x20');_0x264846['mailAccounts'][_0x1e27ea['id']][_0x6d66('0x2f')][_0x6d66('0x14')]=_0xbbfc7d;_0x264846[_0x6d66('0xe')](_0x1e27ea['id']);_0x4f5fb0(_0xbbfc7d);});});}return this[_0x6d66('0xc')][_0x6d66('0x30')](_0x1e27ea);};module[_0x6d66('0x31')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 447d2fb..efcd14b 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 _0x13f6=['upperFirst','exports','path','util','randomstring','mailparser','simpleParser','EventEmitter','./utils','../../../config/logger','imap','account','once','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','password','host','port','tls','autotls','getHost','email','mailbox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes','handleSimpleParser','emit','parser','stringify','textCode','hasOwnProperty'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x13f6,0x124));var _0x613f=function(_0x104553,_0x32a3c0){_0x104553=_0x104553-0x0;var _0x3faae0=_0x13f6[_0x104553];return _0x3faae0;};'use strict';var fs=require('fs');var path=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require(_0x613f('0x2'));var simpleParser=require(_0x613f('0x3'))[_0x613f('0x4')];var EventEmitter=require('events')[_0x613f('0x5')];var utils=require(_0x613f('0x6'));var logger=require(_0x613f('0x7'))('email');function EmailImap(_0x3f3525,_0x2367b3){this['mailbox']='INBOX';this['account']=this['getAccount'](_0x3f3525,_0x2367b3);this[_0x613f('0x8')]=new Imap(this[_0x613f('0x9')]);this[_0x613f('0x8')][_0x613f('0xa')]('ready',this[_0x613f('0xb')][_0x613f('0xc')](this));this[_0x613f('0x8')]['once'](_0x613f('0xd'),this[_0x613f('0xe')][_0x613f('0xc')](this));this['imap']['on'](_0x613f('0xf'),this[_0x613f('0x10')]['bind'](this));this['imap']['connect']();}util[_0x613f('0x11')](EmailImap,EventEmitter);EmailImap[_0x613f('0x12')][_0x613f('0x13')]=function(_0x375db1,_0x329fcf){var _0x4a6fc={'connTimeout':_0x375db1[_0x613f('0x14')]?_0x375db1[_0x613f('0x14')]*0x3e8:0x2710,'authTimeout':_0x375db1[_0x613f('0x15')]?_0x375db1[_0x613f('0x15')]*0x3e8:0x1388};if(_['isNil'](_0x375db1[_0x613f('0x16')])){if(_0x375db1['authentication']){_0x4a6fc['user']=_0x375db1[_0x613f('0x17')];_0x4a6fc[_0x613f('0x18')]=_0x375db1['password'];}_0x4a6fc[_0x613f('0x19')]=_0x375db1['host'];_0x4a6fc[_0x613f('0x1a')]=_0x375db1[_0x613f('0x1a')]||0x3e1;if(_0x375db1[_0x613f('0x1b')]){_0x4a6fc[_0x613f('0x1b')]=!![];}else{_0x4a6fc[_0x613f('0x1b')]=![];_0x4a6fc[_0x613f('0x1c')]='required';}}else{_0x4a6fc['user']=_0x375db1[_0x613f('0x17')];_0x4a6fc['password']=_0x375db1['password'];_0x4a6fc[_0x613f('0x19')]=utils[_0x613f('0x1d')](_0x375db1['service']);_0x4a6fc[_0x613f('0x1a')]=0x3e1;_0x4a6fc[_0x613f('0x1b')]=!![];}_0x4a6fc[_0x613f('0x1e')]=_0x329fcf||_0x375db1['user']||'anonymous@xcally.com';return _0x4a6fc;};EmailImap[_0x613f('0x12')][_0x613f('0xb')]=function(){this[_0x613f('0x8')]['openBox'](this[_0x613f('0x1f')],![],this[_0x613f('0x20')][_0x613f('0xc')](this));};EmailImap[_0x613f('0x12')][_0x613f('0x20')]=function(_0x4e3d5a,_0x30fb15){if(_0x4e3d5a){this[_0x613f('0x10')](_0x4e3d5a,!![]);}else{this['emit'](_0x613f('0x21'),_0x30fb15);this[_0x613f('0x22')]();}};EmailImap[_0x613f('0x12')]['handleCloseBox']=function(_0x53e32b){if(_0x53e32b){this['handleError'](_0x53e32b,!![]);}else{this[_0x613f('0x8')]['end']();}};EmailImap[_0x613f('0x12')][_0x613f('0x22')]=function(){this['imap'][_0x613f('0x23')]([_0x613f('0x24')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x613f('0x25')]=function(_0x7c1a94,_0xcad8d6){if(_0x7c1a94){this['handleError'](_0x7c1a94,!![]);}else{if(_0xcad8d6[_0x613f('0x26')]){try{var _0x439478=this[_0x613f('0x8')][_0x613f('0x27')](_0xcad8d6,{'bodies':'','markSeen':!![]});_0x439478['on']('message',this[_0x613f('0x28')][_0x613f('0xc')](this));_0x439478[_0x613f('0xa')](_0x613f('0xf'),this[_0x613f('0x29')][_0x613f('0xc')](this));_0x439478['once'](_0x613f('0xd'),this[_0x613f('0x2a')][_0x613f('0xc')](this));}catch(_0x4d8b98){logger[_0x613f('0xf')](_0x4d8b98);}}else{this['imap'][_0x613f('0x2b')](!![],this[_0x613f('0x2c')][_0x613f('0xc')](this));}}};EmailImap[_0x613f('0x12')][_0x613f('0x28')]=function(_0x2e5590,_0x589157){_0x2e5590['on'](_0x613f('0x2d'),this[_0x613f('0x2e')][_0x613f('0xc')](this));_0x2e5590[_0x613f('0xa')](_0x613f('0x2f'),this['handleMessageAttributes']['bind'](this));_0x2e5590['once'](_0x613f('0xd'),this[_0x613f('0x30')][_0x613f('0xc')](this));};EmailImap[_0x613f('0x12')]['handleMessageBody']=function(_0x2fc02e,_0xaedbbd){simpleParser(_0x2fc02e,this['handleSimpleParser'][_0x613f('0xc')](this));};EmailImap['prototype'][_0x613f('0x31')]=function(_0x56c669){};EmailImap[_0x613f('0x12')]['handleMessageEnd']=function(){};EmailImap[_0x613f('0x12')][_0x613f('0x32')]=function(_0x46842f,_0x511bb7){if(_0x46842f){logger[_0x613f('0xf')](_0x46842f);}else{this[_0x613f('0x33')](_0x613f('0x1e'),utils[_0x613f('0x34')](this[_0x613f('0x9')],_0x511bb7));}};EmailImap[_0x613f('0x12')][_0x613f('0x2a')]=function(){this[_0x613f('0x8')][_0x613f('0x2b')](!![],this[_0x613f('0x2c')]['bind'](this));};EmailImap[_0x613f('0x12')][_0x613f('0x29')]=function(_0x2a8470){this[_0x613f('0x10')](_0x2a8470);this[_0x613f('0x8')][_0x613f('0x2b')](!![],this[_0x613f('0x2c')]['bind'](this));};EmailImap[_0x613f('0x12')][_0x613f('0xe')]=function(){this[_0x613f('0x33')](_0x613f('0xd'));};EmailImap[_0x613f('0x12')][_0x613f('0x10')]=function(_0x1040ba,_0x4fdb35){logger[_0x613f('0xf')](_0x613f('0x10'),this[_0x613f('0x9')][_0x613f('0x1e')],JSON[_0x613f('0x35')](_0x1040ba));var _0x1c63ec='';if(_0x1040ba){if(_0x1040ba[_0x613f('0x36')]){_0x1c63ec=_0x1040ba[_0x613f('0x36')];}else{for(var _0x403feb in _0x1040ba){if(_0x1040ba[_0x613f('0x37')](_0x403feb)){_0x1c63ec+=_[_0x613f('0x38')](_0x403feb)+':\x20'+_0x1040ba[_0x403feb]+'\x0a';}}}}if(_0x4fdb35){this[_0x613f('0x8')][_0x613f('0xd')]();}else{this['emit'](_0x613f('0xf'),_0x1c63ec);this[_0x613f('0x33')](_0x613f('0xd'));}};module[_0x613f('0x39')]=EmailImap; \ No newline at end of file +var _0x236c=['required','password','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','end','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleCloseBox','stringify','textCode','upperFirst','exports','path','imap','lodash','randomstring','mailparser','simpleParser','EventEmitter','./utils','../../../config/logger','email','INBOX','account','ready','handleReady','bind','once','handleEnd','error','handleError','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','autotls'];(function(_0x57e284,_0x33f367){var _0x557630=function(_0x2c3e55){while(--_0x2c3e55){_0x57e284['push'](_0x57e284['shift']());}};_0x557630(++_0x33f367);}(_0x236c,0x155));var _0xc236=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0x236c[_0x1f78cb];return _0x2cf6b8;};'use strict';var fs=require('fs');var path=require(_0xc236('0x0'));var util=require('util');var Imap=require(_0xc236('0x1'));var _=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var simpleParser=require(_0xc236('0x4'))[_0xc236('0x5')];var EventEmitter=require('events')[_0xc236('0x6')];var utils=require(_0xc236('0x7'));var logger=require(_0xc236('0x8'))(_0xc236('0x9'));function EmailImap(_0x23d3cc,_0x461c3a){this['mailbox']=_0xc236('0xa');this[_0xc236('0xb')]=this['getAccount'](_0x23d3cc,_0x461c3a);this['imap']=new Imap(this['account']);this[_0xc236('0x1')]['once'](_0xc236('0xc'),this[_0xc236('0xd')][_0xc236('0xe')](this));this[_0xc236('0x1')][_0xc236('0xf')]('end',this[_0xc236('0x10')][_0xc236('0xe')](this));this['imap']['on'](_0xc236('0x11'),this[_0xc236('0x12')]['bind'](this));this[_0xc236('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xc236('0x13')][_0xc236('0x14')]=function(_0x2184c9,_0x71bce2){var _0x5052db={'connTimeout':_0x2184c9[_0xc236('0x15')]?_0x2184c9['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2184c9['authTimeout']?_0x2184c9[_0xc236('0x16')]*0x3e8:0x1388};if(_[_0xc236('0x17')](_0x2184c9[_0xc236('0x18')])){if(_0x2184c9[_0xc236('0x19')]){_0x5052db[_0xc236('0x1a')]=_0x2184c9['user'];_0x5052db['password']=_0x2184c9['password'];}_0x5052db[_0xc236('0x1b')]=_0x2184c9[_0xc236('0x1b')];_0x5052db[_0xc236('0x1c')]=_0x2184c9['port']||0x3e1;if(_0x2184c9[_0xc236('0x1d')]){_0x5052db['tls']=!![];}else{_0x5052db['tls']=![];_0x5052db[_0xc236('0x1e')]=_0xc236('0x1f');}}else{_0x5052db[_0xc236('0x1a')]=_0x2184c9[_0xc236('0x1a')];_0x5052db[_0xc236('0x20')]=_0x2184c9[_0xc236('0x20')];_0x5052db[_0xc236('0x1b')]=utils[_0xc236('0x21')](_0x2184c9[_0xc236('0x18')]);_0x5052db[_0xc236('0x1c')]=0x3e1;_0x5052db[_0xc236('0x1d')]=!![];}_0x5052db['email']=_0x71bce2||_0x2184c9[_0xc236('0x1a')]||_0xc236('0x22');return _0x5052db;};EmailImap[_0xc236('0x13')][_0xc236('0xd')]=function(){this[_0xc236('0x1')][_0xc236('0x23')](this[_0xc236('0x24')],![],this[_0xc236('0x25')][_0xc236('0xe')](this));};EmailImap[_0xc236('0x13')][_0xc236('0x25')]=function(_0x5d4edc,_0x308cd6){if(_0x5d4edc){this[_0xc236('0x12')](_0x5d4edc,!![]);}else{this[_0xc236('0x26')](_0xc236('0x27'),_0x308cd6);this['readUnseen']();}};EmailImap[_0xc236('0x13')]['handleCloseBox']=function(_0x5351bc){if(_0x5351bc){this[_0xc236('0x12')](_0x5351bc,!![]);}else{this['imap'][_0xc236('0x28')]();}};EmailImap['prototype'][_0xc236('0x29')]=function(){this['imap'][_0xc236('0x2a')]([_0xc236('0x2b')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xc236('0x13')][_0xc236('0x2c')]=function(_0x1f4995,_0x6ad83f){if(_0x1f4995){this['handleError'](_0x1f4995,!![]);}else{if(_0x6ad83f['length']){try{var _0x28ffa5=this['imap'][_0xc236('0x2d')](_0x6ad83f,{'bodies':'','markSeen':!![]});_0x28ffa5['on']('message',this[_0xc236('0x2e')][_0xc236('0xe')](this));_0x28ffa5['once']('error',this[_0xc236('0x2f')][_0xc236('0xe')](this));_0x28ffa5[_0xc236('0xf')](_0xc236('0x28'),this[_0xc236('0x30')][_0xc236('0xe')](this));}catch(_0x259c0f){logger[_0xc236('0x11')](_0x259c0f);}}else{this[_0xc236('0x1')]['closeBox'](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0xc236('0x13')][_0xc236('0x2e')]=function(_0x32a59a,_0x3b09a9){_0x32a59a['on'](_0xc236('0x31'),this[_0xc236('0x32')][_0xc236('0xe')](this));_0x32a59a['once'](_0xc236('0x33'),this[_0xc236('0x34')][_0xc236('0xe')](this));_0x32a59a['once'](_0xc236('0x28'),this[_0xc236('0x35')][_0xc236('0xe')](this));};EmailImap[_0xc236('0x13')]['handleMessageBody']=function(_0x12348b,_0x40ec71){simpleParser(_0x12348b,this[_0xc236('0x36')][_0xc236('0xe')](this));};EmailImap[_0xc236('0x13')][_0xc236('0x34')]=function(_0x282c8c){};EmailImap[_0xc236('0x13')][_0xc236('0x35')]=function(){};EmailImap[_0xc236('0x13')][_0xc236('0x36')]=function(_0x6aa23b,_0x2664ba){if(_0x6aa23b){logger[_0xc236('0x11')](_0x6aa23b);}else{this[_0xc236('0x26')](_0xc236('0x9'),utils[_0xc236('0x37')](this['account'],_0x2664ba));}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0xc236('0x38')](!![],this['handleCloseBox'][_0xc236('0xe')](this));};EmailImap[_0xc236('0x13')][_0xc236('0x2f')]=function(_0x32df56){this[_0xc236('0x12')](_0x32df56);this[_0xc236('0x1')][_0xc236('0x38')](!![],this[_0xc236('0x39')][_0xc236('0xe')](this));};EmailImap[_0xc236('0x13')][_0xc236('0x10')]=function(){this[_0xc236('0x26')](_0xc236('0x28'));};EmailImap[_0xc236('0x13')][_0xc236('0x12')]=function(_0x594ffc,_0x31bd91){logger[_0xc236('0x11')]('handleError',this[_0xc236('0xb')]['email'],JSON[_0xc236('0x3a')](_0x594ffc));var _0x5e3910='';if(_0x594ffc){if(_0x594ffc[_0xc236('0x3b')]){_0x5e3910=_0x594ffc[_0xc236('0x3b')];}else{for(var _0x8d04c9 in _0x594ffc){if(_0x594ffc['hasOwnProperty'](_0x8d04c9)){_0x5e3910+=_[_0xc236('0x3c')](_0x8d04c9)+':\x20'+_0x594ffc[_0x8d04c9]+'\x0a';}}}}if(_0x31bd91){this[_0xc236('0x1')][_0xc236('0x28')]();}else{this['emit'](_0xc236('0x11'),_0x5e3910);this[_0xc236('0x26')](_0xc236('0x28'));}};module[_0xc236('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c6db658..4f74307 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 _0x12fa=['prototype','createTransport','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0xa69a73,_0x406f11){var _0x7a1d64=function(_0x3d7322){while(--_0x3d7322){_0xa69a73['push'](_0xa69a73['shift']());}};_0x7a1d64(++_0x406f11);}(_0x12fa,0x130));var _0xa12f=function(_0x42f797,_0x2c7393){_0x42f797=_0x42f797-0x0;var _0x252015=_0x12fa[_0x42f797];return _0x252015;};'use strict';var nodemailer=require(_0xa12f('0x0'));var BPromise=require(_0xa12f('0x1'));function EmailSmtp(){}EmailSmtp[_0xa12f('0x2')]['send']=function(_0x37207a,_0x26613a){return new BPromise(function(_0x46d961,_0x3c00b6){var _0x538979=nodemailer[_0xa12f('0x3')](_0x37207a);_0x538979[_0xa12f('0x4')](_0x26613a,function(_0x917f82,_0x2d81a3){if(_0x917f82){_0x3c00b6(_0x917f82[_0xa12f('0x5')]());}else{_0x46d961(_0x2d81a3);}});});};EmailSmtp[_0xa12f('0x2')][_0xa12f('0x6')]=function(_0x165c0d){return new BPromise(function(_0x51c5ee,_0x316340){var _0x5a48e8=nodemailer[_0xa12f('0x3')](_0x165c0d);_0x5a48e8[_0xa12f('0x6')](function(_0x286df5,_0x374884){if(_0x286df5){_0x316340(_0x286df5['toString']());}else{if(_0x374884){_0x51c5ee(_0x374884);}else{_0x316340(_0xa12f('0x7'));}}});});};module[_0xa12f('0x8')]=EmailSmtp; \ No newline at end of file +var _0x55e9=['sendMail','verify','Not\x20verifired','bluebird','prototype','send','createTransport'];(function(_0x4e27e4,_0x3264ad){var _0x5d8928=function(_0x2c17b8){while(--_0x2c17b8){_0x4e27e4['push'](_0x4e27e4['shift']());}};_0x5d8928(++_0x3264ad);}(_0x55e9,0x1f4));var _0x955e=function(_0x435592,_0x363aed){_0x435592=_0x435592-0x0;var _0x2d544d=_0x55e9[_0x435592];return _0x2d544d;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x955e('0x0'));function EmailSmtp(){}EmailSmtp[_0x955e('0x1')][_0x955e('0x2')]=function(_0x3ab9ec,_0x666f2){return new BPromise(function(_0x290954,_0x566625){var _0x52446a=nodemailer[_0x955e('0x3')](_0x3ab9ec);_0x52446a[_0x955e('0x4')](_0x666f2,function(_0x3b7406,_0x15230b){if(_0x3b7406){_0x566625(_0x3b7406['toString']());}else{_0x290954(_0x15230b);}});});};EmailSmtp[_0x955e('0x1')][_0x955e('0x5')]=function(_0xe0000e){return new BPromise(function(_0x30035c,_0x37ffc8){var _0x2e355e=nodemailer[_0x955e('0x3')](_0xe0000e);_0x2e355e['verify'](function(_0x4581c5,_0x505e97){if(_0x4581c5){_0x37ffc8(_0x4581c5['toString']());}else{if(_0x505e97){_0x30035c(_0x505e97);}else{_0x37ffc8(_0x955e('0x6'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 048d7fa..0a0c04e 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 _0x756b=['originTo','isEmpty','message','originCc','includes','bcc','attachments','attach','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','content','push','contentType','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','127.0.0.1','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','generate','name','length','join','Anonymous','split','pop','anonymous','parser','from','email','subject','date','YYYY-MM-DD\x20HH:mm:ss','html','test','replace','body','0x1?_0x3146aa[_0xb756('0xe')]():'';}return'';}function getMails(_0x2f4ab3,_0x5a7d37){var _0x50ac38='';for(var _0xd33199=0x0;_0xd33199<_0x5a7d37[_0xb756('0x6')][_0xb756('0xa')];_0xd33199+=0x1){if(_0x5a7d37[_0xb756('0x6')][_0xd33199][_0xb756('0x7')]!==_0x2f4ab3){if(!_['isEmpty'](_0x50ac38)){_0x50ac38+=',';}_0x50ac38+=_0x5a7d37['value'][_0xd33199][_0xb756('0x9')]||_0x5a7d37[_0xb756('0x6')][_0xd33199][_0xb756('0x7')]||'';_0x50ac38+='\x20<';_0x50ac38+=_0x5a7d37['value'][_0xd33199][_0xb756('0x7')]?_0x5a7d37['value'][_0xd33199][_0xb756('0x7')]:_0xb756('0xf')+random[_0xb756('0x8')](0x6)+'@xcally.com';_0x50ac38+='>';}}return _0x50ac38;}exports[_0xb756('0x10')]=function(_0x3b6002,_0x1c4ee3){var _0x3e745a={'from':getAddress(_0x1c4ee3['from']),'firstName':getFirstName(_0x1c4ee3['from']),'lastName':getLastName(_0x1c4ee3[_0xb756('0x11')]),'mapKey':'email','message':{'from':getMails(_0x3b6002['email'],_0x1c4ee3[_0xb756('0x11')]),'to':_0x3b6002[_0xb756('0x12')],'cc':'','subject':_0x1c4ee3[_0xb756('0x13')]||'','messageId':_0x1c4ee3['messageId'],'inReplyTo':_0x1c4ee3['inReplyTo'],'sentAt':moment(_0x1c4ee3[_0xb756('0x14')])['format'](_0xb756('0x15')),'attach':![],'attachments':[]}};if(_0x1c4ee3[_0xb756('0x16')]){var _0x21b0d7=/)<[^<]*)*<\/script>/gi;while(_0x21b0d7[_0xb756('0x17')](_0x1c4ee3[_0xb756('0x16')])){_0x1c4ee3[_0xb756('0x16')]=_0x1c4ee3[_0xb756('0x16')][_0xb756('0x18')](_0x21b0d7,'');}_0x3e745a[_0xb756('0x19')]=_0x1c4ee3['html'];}else{_0x3e745a['body']=_0x1c4ee3['textAsHtml'];}if(_0x3e745a[_0xb756('0x19')]){_0x3e745a[_0xb756('0x19')]=_0x3e745a[_0xb756('0x19')][_0xb756('0x18')](/0x1?_0x33b47f['pop']():'';}return'';}function getMails(_0x5ed35a,_0x1b4fff){var _0x1eaf98='';for(var _0x2088ec=0x0;_0x2088ec<_0x1b4fff[_0x0585('0x5')][_0x0585('0xb')];_0x2088ec+=0x1){if(_0x1b4fff[_0x0585('0x5')][_0x2088ec][_0x0585('0x6')]!==_0x5ed35a){if(!_['isEmpty'](_0x1eaf98)){_0x1eaf98+=',';}_0x1eaf98+=_0x1b4fff[_0x0585('0x5')][_0x2088ec][_0x0585('0x9')]||_0x1b4fff[_0x0585('0x5')][_0x2088ec][_0x0585('0x6')]||'';_0x1eaf98+='\x20<';_0x1eaf98+=_0x1b4fff['value'][_0x2088ec][_0x0585('0x6')]?_0x1b4fff[_0x0585('0x5')][_0x2088ec][_0x0585('0x6')]:_0x0585('0x7')+random['generate'](0x6)+_0x0585('0xc');_0x1eaf98+='>';}}return _0x1eaf98;}exports[_0x0585('0xd')]=function(_0x35d6c1,_0x47362d){var _0x518f36={'from':getAddress(_0x47362d[_0x0585('0xe')]),'firstName':getFirstName(_0x47362d[_0x0585('0xe')]),'lastName':getLastName(_0x47362d[_0x0585('0xe')]),'mapKey':_0x0585('0xf'),'message':{'from':getMails(_0x35d6c1[_0x0585('0xf')],_0x47362d[_0x0585('0xe')]),'to':_0x35d6c1[_0x0585('0xf')],'cc':'','subject':_0x47362d[_0x0585('0x10')]||'','messageId':_0x47362d[_0x0585('0x11')],'inReplyTo':_0x47362d['inReplyTo'],'sentAt':moment(_0x47362d[_0x0585('0x12')])[_0x0585('0x13')](_0x0585('0x14')),'attach':![],'attachments':[]}};if(_0x47362d['html']){var _0x2bc936=/)<[^<]*)*<\/script>/gi;while(_0x2bc936[_0x0585('0x15')](_0x47362d[_0x0585('0x16')])){_0x47362d[_0x0585('0x16')]=_0x47362d['html']['replace'](_0x2bc936,'');}_0x518f36[_0x0585('0x17')]=_0x47362d['html'];}else{_0x518f36[_0x0585('0x17')]=_0x47362d[_0x0585('0x18')];}if(_0x518f36[_0x0585('0x17')]){_0x518f36[_0x0585('0x17')]=_0x518f36[_0x0585('0x17')][_0x0585('0x19')](/0x0){if(this[_0x202a05+_0x7231('0x1f')]>0x0&&this[_0x202a05+_0x7231('0x1e')]>=this[_0x202a05+_0x7231('0x1f')]){return _0x7231('0x20');}else{return _0x7231('0x21');}}else{return'idle';}};Agent[_0x7231('0x1c')][_0x7231('0x1b')]=function(){var _0x3ac500=[_0x7231('0x22'),_0x7231('0x23'),'openchannel',_0x7231('0x24'),_0x7231('0x25')];for(var _0x588406=0x0;_0x588406<_0x3ac500[_0x7231('0x26')];_0x588406+=0x1){var _0x42ad07=this[_0x7231('0x1d')](_0x3ac500[_0x588406]);if(this[_0x3ac500[_0x588406]+_0x7231('0x27')]!==_0x42ad07){this[_0x3ac500[_0x588406]+_0x7231('0x28')]=_[_0x7231('0x29')](moment()[_0x7231('0x2a')]('x'));}this[_0x3ac500[_0x588406]+_0x7231('0x27')]=_0x42ad07;}io['emit'](_0x7231('0x2b'),this);};module[_0x7231('0x2c')]=Agent; \ No newline at end of file +var _0x6a69=['updateRealtime','prototype','getChannelStatus','CurrentCapacity','fax','sms','length','Status','StatusTime','format','emit','user:save','exports','lodash','moment','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsCapacity','smsCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue'];(function(_0x1b9b74,_0xd2ba13){var _0x33a515=function(_0x1b4d6b){while(--_0x1b4d6b){_0x1b9b74['push'](_0x1b9b74['shift']());}};_0x33a515(++_0xd2ba13);}(_0x6a69,0x12c));var _0x96a6=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x6a69[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0x96a6('0x0'));var moment=require(_0x96a6('0x1'));var io=require(_0x96a6('0x2'))({'host':'localhost','port':0x18eb});function Agent(_0x68289){this['id']=_0x68289['id']||0x0;this[_0x96a6('0x3')]=_0x68289[_0x96a6('0x3')]||'';this['online']=_0x68289[_0x96a6('0x4')]||!![];this['voicePause']=_0x68289[_0x96a6('0x5')]||![];this[_0x96a6('0x6')]=_0x68289[_0x96a6('0x6')]||![];this['mailPause']=_0x68289['mailPause']||![];this[_0x96a6('0x7')]=_0x68289[_0x96a6('0x7')]||![];this[_0x96a6('0x8')]=_0x68289[_0x96a6('0x8')]||![];this[_0x96a6('0x9')]=_0x68289[_0x96a6('0x9')]||![];this[_0x96a6('0xa')]='unknown';this[_0x96a6('0xb')]=0x0;this[_0x96a6('0xc')]=_0x68289[_0x96a6('0xc')]||0x0;this[_0x96a6('0xd')]=0x0;this['mailStatus']=_0x96a6('0xe');this[_0x96a6('0xf')]=0x0;this['mailCapacity']=_0x68289[_0x96a6('0x10')]||0x0;this[_0x96a6('0x11')]=0x0;this[_0x96a6('0x12')]='unknown';this[_0x96a6('0x13')]=0x0;this[_0x96a6('0x14')]=_0x68289[_0x96a6('0x14')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x96a6('0xe');this['smsStatusTime']=0x0;this[_0x96a6('0x15')]=_0x68289['smsCapacity']||0x0;this[_0x96a6('0x16')]=0x0;this['openchannelStatus']=_0x96a6('0xe');this[_0x96a6('0x17')]=0x0;this[_0x96a6('0x18')]=_0x68289[_0x96a6('0x18')]||0x0;this[_0x96a6('0x19')]=0x0;this[_0x96a6('0x1a')]=![];this[_0x96a6('0x1b')]=undefined;this[_0x96a6('0x1c')]();}Agent[_0x96a6('0x1d')][_0x96a6('0x1e')]=function(_0x571a67){if(this[_0x571a67+_0x96a6('0x1f')]>0x0){if(this[_0x571a67+'Capacity']>0x0&&this[_0x571a67+_0x96a6('0x1f')]>=this[_0x571a67+'Capacity']){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0xe702c6=['mail','chat','openchannel',_0x96a6('0x20'),_0x96a6('0x21')];for(var _0x417fd0=0x0;_0x417fd0<_0xe702c6[_0x96a6('0x22')];_0x417fd0+=0x1){var _0x4c1eb0=this['getChannelStatus'](_0xe702c6[_0x417fd0]);if(this[_0xe702c6[_0x417fd0]+_0x96a6('0x23')]!==_0x4c1eb0){this[_0xe702c6[_0x417fd0]+_0x96a6('0x24')]=_['toNumber'](moment()[_0x96a6('0x25')]('x'));}this[_0xe702c6[_0x417fd0]+'Status']=_0x4c1eb0;}io[_0x96a6('0x26')](_0x96a6('0x27'),this);};module[_0x96a6('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0c11b79..24e4223 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 _0xcb91=['waiting','md5','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','length','online','chatPause','paused','available','format','chat:queue:%s','emit','chat_queue:save','util','socket.io-emitter','localhost','name','timeout','strategy','Agents'];(function(_0x398088,_0x4d3c6e){var _0x53c820=function(_0x58f2ad){while(--_0x58f2ad){_0x398088['push'](_0x398088['shift']());}};_0x53c820(++_0x4d3c6e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xcb91[_0x1db251];return _0x56685a;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var io=require(_0x1cb9('0x1'))({'host':_0x1cb9('0x2'),'port':0x18eb});function ChatQueue(_0x22c4b8){this['id']=_0x22c4b8['id']||0x0;this['name']=_0x22c4b8[_0x1cb9('0x3')]||'';this[_0x1cb9('0x4')]=_0x22c4b8['timeout']||0xa;this[_0x1cb9('0x5')]=_0x22c4b8[_0x1cb9('0x5')]||'beepall';this[_0x1cb9('0x6')]=_0x22c4b8[_0x1cb9('0x6')];this['mapAgentsId']={};this[_0x1cb9('0x7')]=0x0;this[_0x1cb9('0x8')]='';this['updateRouting']();this[_0x1cb9('0x9')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x45a12f=this[_0x1cb9('0xa')][_0x1cb9('0xb')];this[_0x1cb9('0xa')]=_[_0x1cb9('0xc')](this['Agents'],'id');this[_0x1cb9('0xa')][_0x1cb9('0xb')]=_0x45a12f;};ChatQueue[_0x1cb9('0xd')][_0x1cb9('0x9')]=function(){this[_0x1cb9('0xe')]=0x0;this['paused']=0x0;for(var _0x5e3c19=0x0;_0x5e3c19=0x0?this[_0x1cb9('0x13')]:0x0;var _0x3cc765={'id':this['id'],'available':this[_0x1cb9('0x13')],'loggedIn':this[_0x1cb9('0xe')],'name':this[_0x1cb9('0x3')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x7')]};var _0x4e1340=md5(JSON['stringify'](_0x3cc765));if(this[_0x1cb9('0x8')]!==_0x4e1340){this[_0x1cb9('0x8')]=_0x4e1340;io['to'](util[_0x1cb9('0x14')](_0x1cb9('0x15'),_0x3cc765[_0x1cb9('0x3')]))[_0x1cb9('0x16')](_0x1cb9('0x17'),_0x3cc765);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x34e8=['prototype','_rr','map','paused','length','online','loggedIn','chatPause','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x535596,_0x5b54bf){var _0x21b5da=function(_0x2e6a03){while(--_0x2e6a03){_0x535596['push'](_0x535596['shift']());}};_0x21b5da(++_0x5b54bf);}(_0x34e8,0x12c));var _0x834e=function(_0x2bfdff,_0x5ecf80){_0x2bfdff=_0x2bfdff-0x0;var _0x4ea9de=_0x34e8[_0x2bfdff];return _0x4ea9de;};'use strict';var _=require(_0x834e('0x0'));var md5=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var io=require(_0x834e('0x3'))({'host':'localhost','port':0x18eb});function ChatQueue(_0x832422){this['id']=_0x832422['id']||0x0;this[_0x834e('0x4')]=_0x832422[_0x834e('0x4')]||'';this[_0x834e('0x5')]=_0x832422[_0x834e('0x5')]||0xa;this[_0x834e('0x6')]=_0x832422[_0x834e('0x6')]||'beepall';this[_0x834e('0x7')]=_0x832422['Agents'];this[_0x834e('0x8')]={};this[_0x834e('0x9')]=0x0;this[_0x834e('0x1')]='';this[_0x834e('0xa')]();this[_0x834e('0xb')]();}ChatQueue[_0x834e('0xc')][_0x834e('0xa')]=function(){var _0x1af45a=this[_0x834e('0x8')][_0x834e('0xd')];this[_0x834e('0x8')]=_[_0x834e('0xe')](this[_0x834e('0x7')],'id');this[_0x834e('0x8')][_0x834e('0xd')]=_0x1af45a;};ChatQueue[_0x834e('0xc')][_0x834e('0xb')]=function(){this['loggedIn']=0x0;this[_0x834e('0xf')]=0x0;for(var _0x6cd9b9=0x0;_0x6cd9b9=0x0?this['available']:0x0;var _0x43ac41={'id':this['id'],'available':this[_0x834e('0x14')],'loggedIn':this[_0x834e('0x12')],'name':this['name'],'paused':this[_0x834e('0xf')],'waiting':this[_0x834e('0x9')]};var _0x34e41a=md5(JSON[_0x834e('0x15')](_0x43ac41));if(this[_0x834e('0x1')]!==_0x34e41a){this[_0x834e('0x1')]=_0x34e41a;io['to'](util[_0x834e('0x16')]('chat:queue:%s',_0x43ac41[_0x834e('0x4')]))[_0x834e('0x17')](_0x834e('0x18'),_0x43ac41);}};module[_0x834e('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index a675949..ff7d560 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 _0x562b=['paused','length','online','available','stringify','emit','fax_queue:save','exports','lodash','md5','socket.io-emitter','name','timeout','strategy','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn'];(function(_0x100e0e,_0x4a11c6){var _0x47c77b=function(_0x216848){while(--_0x216848){_0x100e0e['push'](_0x100e0e['shift']());}};_0x47c77b(++_0x4a11c6);}(_0x562b,0x152));var _0xb562=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x562b[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0xb562('0x0'));var md5=require(_0xb562('0x1'));var util=require('util');var io=require(_0xb562('0x2'))({'host':'localhost','port':0x18eb});function FaxQueue(_0x2a938c){this['id']=_0x2a938c['id']||0x0;this[_0xb562('0x3')]=_0x2a938c[_0xb562('0x3')]||'';this['timeout']=_0x2a938c[_0xb562('0x4')]||0xa;this['strategy']=_0x2a938c[_0xb562('0x5')]||'beepall';this[_0xb562('0x6')]=_0x2a938c[_0xb562('0x6')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb562('0x1')]='';this['updateRouting']();this[_0xb562('0x7')]();}FaxQueue[_0xb562('0x8')][_0xb562('0x9')]=function(){var _0x2f37ba=this[_0xb562('0xa')][_0xb562('0xb')];this['mapAgentsId']=_[_0xb562('0xc')](this[_0xb562('0x6')],'id');this[_0xb562('0xa')][_0xb562('0xb')]=_0x2f37ba;};FaxQueue[_0xb562('0x8')]['updateRealtime']=function(){this[_0xb562('0xd')]=0x0;this[_0xb562('0xe')]=0x0;for(var _0x3e2981=0x0;_0x3e2981=0x0?this['available']:0x0;var _0x2f135d={'id':this['id'],'available':this[_0xb562('0x11')],'loggedIn':this[_0xb562('0xd')],'name':this[_0xb562('0x3')],'paused':this[_0xb562('0xe')],'waiting':this['waiting']};var _0x4f91cf=md5(JSON[_0xb562('0x12')](_0x2f135d));if(this[_0xb562('0x1')]!==_0x4f91cf){this[_0xb562('0x1')]=_0x4f91cf;io['to'](util['format']('fax:queue:%s',_0x2f135d['name']))[_0xb562('0x13')](_0xb562('0x14'),_0x2f135d);}};module[_0xb562('0x15')]=FaxQueue; \ No newline at end of file +var _0x36a5=['available','fax:queue:%s','fax_queue:save','exports','lodash','md5','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','online','loggedIn','faxPause','paused'];(function(_0x3a558a,_0x47525d){var _0x46d15b=function(_0x16cef0){while(--_0x16cef0){_0x3a558a['push'](_0x3a558a['shift']());}};_0x46d15b(++_0x47525d);}(_0x36a5,0x1e4));var _0x536a=function(_0x4a775e,_0x1ec23f){_0x4a775e=_0x4a775e-0x0;var _0x3601f5=_0x36a5[_0x4a775e];return _0x3601f5;};'use strict';var _=require(_0x536a('0x0'));var md5=require(_0x536a('0x1'));var util=require('util');var io=require(_0x536a('0x2'))({'host':_0x536a('0x3'),'port':0x18eb});function FaxQueue(_0x3e8fd2){this['id']=_0x3e8fd2['id']||0x0;this[_0x536a('0x4')]=_0x3e8fd2['name']||'';this[_0x536a('0x5')]=_0x3e8fd2[_0x536a('0x5')]||0xa;this[_0x536a('0x6')]=_0x3e8fd2[_0x536a('0x6')]||_0x536a('0x7');this[_0x536a('0x8')]=_0x3e8fd2[_0x536a('0x8')];this[_0x536a('0x9')]={};this[_0x536a('0xa')]=0x0;this[_0x536a('0x1')]='';this['updateRouting']();this[_0x536a('0xb')]();}FaxQueue[_0x536a('0xc')][_0x536a('0xd')]=function(){var _0x5dbdaa=this[_0x536a('0x9')][_0x536a('0xe')];this[_0x536a('0x9')]=_[_0x536a('0xf')](this[_0x536a('0x8')],'id');this[_0x536a('0x9')]['_rr']=_0x5dbdaa;};FaxQueue[_0x536a('0xc')][_0x536a('0xb')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1ff437=0x0;_0x1ff437=0x0?this['available']:0x0;var _0x46c50e={'id':this['id'],'available':this[_0x536a('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x536a('0xa')]};var _0x25f30c=md5(JSON['stringify'](_0x46c50e));if(this[_0x536a('0x1')]!==_0x25f30c){this[_0x536a('0x1')]=_0x25f30c;io['to'](util['format'](_0x536a('0x15'),_0x46c50e['name']))['emit'](_0x536a('0x16'),_0x46c50e);}};module[_0x536a('0x17')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 64ed884..43bcea0 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 _0x7fe7=['Intervals','exports','name'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x7fe7,0x1a6));var _0x77fe=function(_0x261832,_0x5a24e6){_0x261832=_0x261832-0x0;var _0x186143=_0x7fe7[_0x261832];return _0x186143;};'use strict';function Interval(_0x2ccb82){this['id']=_0x2ccb82['id']||0x0;this[_0x77fe('0x0')]=_0x2ccb82[_0x77fe('0x0')]||'';this[_0x77fe('0x1')]=_0x2ccb82['Intervals']||{};}module[_0x77fe('0x2')]=Interval; \ No newline at end of file +var _0x4757=['exports','name','Intervals'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x4757,0x157));var _0x7475=function(_0x15bbf1,_0x40ef96){_0x15bbf1=_0x15bbf1-0x0;var _0x5c4b47=_0x4757[_0x15bbf1];return _0x5c4b47;};'use strict';function Interval(_0x27dc76){this['id']=_0x27dc76['id']||0x0;this[_0x7475('0x0')]=_0x27dc76[_0x7475('0x0')]||'';this[_0x7475('0x1')]=_0x27dc76[_0x7475('0x1')]||{};}module[_0x7475('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 3cf44c6..30e0977 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 _0x4c7b=['md5','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','_rr','paused','online','loggedIn','mailPause','available','stringify','format','emit','exports','lodash'];(function(_0x39e15b,_0x555185){var _0x4e5766=function(_0x45ef45){while(--_0x45ef45){_0x39e15b['push'](_0x39e15b['shift']());}};_0x4e5766(++_0x555185);}(_0x4c7b,0xd1));var _0xb4c7=function(_0x34f692,_0x104b8e){_0x34f692=_0x34f692-0x0;var _0x505470=_0x4c7b[_0x34f692];return _0x505470;};'use strict';var _=require(_0xb4c7('0x0'));var md5=require(_0xb4c7('0x1'));var util=require('util');var io=require(_0xb4c7('0x2'))({'host':'localhost','port':0x18eb});function MailQueue(_0x454619){this['id']=_0x454619['id']||0x0;this['name']=_0x454619[_0xb4c7('0x3')]||'';this[_0xb4c7('0x4')]=_0x454619[_0xb4c7('0x4')]||0xa;this[_0xb4c7('0x5')]=_0x454619['strategy']||_0xb4c7('0x6');this[_0xb4c7('0x7')]=_0x454619[_0xb4c7('0x7')];this[_0xb4c7('0x8')]={};this[_0xb4c7('0x9')]=0x0;this['md5']='';this['updateRouting']();this[_0xb4c7('0xa')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4c5fef=this[_0xb4c7('0x8')][_0xb4c7('0xb')];this[_0xb4c7('0x8')]=_['map'](this[_0xb4c7('0x7')],'id');this[_0xb4c7('0x8')]['_rr']=_0x4c5fef;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xb4c7('0xc')]=0x0;for(var _0x44757a=0x0;_0x44757a=0x0?this[_0xb4c7('0x10')]:0x0;var _0x23876e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb4c7('0xe')],'name':this[_0xb4c7('0x3')],'paused':this[_0xb4c7('0xc')],'waiting':this['waiting']};var _0x16aaa3=md5(JSON[_0xb4c7('0x11')](_0x23876e));if(this[_0xb4c7('0x1')]!==_0x16aaa3){this[_0xb4c7('0x1')]=_0x16aaa3;io['to'](util[_0xb4c7('0x12')]('mail:queue:%s',_0x23876e['name']))[_0xb4c7('0x13')]('mail_queue:save',_0x23876e);}};module[_0xb4c7('0x14')]=MailQueue; \ No newline at end of file +var _0xbd75=['available','waiting','md5','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online','mailPause'];(function(_0x2082a8,_0x451225){var _0x53100b=function(_0x486b2d){while(--_0x486b2d){_0x2082a8['push'](_0x2082a8['shift']());}};_0x53100b(++_0x451225);}(_0xbd75,0x120));var _0x5bd7=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xbd75[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x5bd7('0x0'));var md5=require('md5');var util=require(_0x5bd7('0x1'));var io=require(_0x5bd7('0x2'))({'host':_0x5bd7('0x3'),'port':0x18eb});function MailQueue(_0x460615){this['id']=_0x460615['id']||0x0;this[_0x5bd7('0x4')]=_0x460615[_0x5bd7('0x4')]||'';this[_0x5bd7('0x5')]=_0x460615[_0x5bd7('0x5')]||0xa;this[_0x5bd7('0x6')]=_0x460615[_0x5bd7('0x6')]||_0x5bd7('0x7');this[_0x5bd7('0x8')]=_0x460615[_0x5bd7('0x8')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x5bd7('0x9')]();this['updateRealtime']();}MailQueue[_0x5bd7('0xa')][_0x5bd7('0x9')]=function(){var _0x235a8d=this['mapAgentsId']['_rr'];this[_0x5bd7('0xb')]=_[_0x5bd7('0xc')](this[_0x5bd7('0x8')],'id');this[_0x5bd7('0xb')][_0x5bd7('0xd')]=_0x235a8d;};MailQueue['prototype'][_0x5bd7('0xe')]=function(){this[_0x5bd7('0xf')]=0x0;this[_0x5bd7('0x10')]=0x0;for(var _0x1d1a29=0x0;_0x1d1a29=0x0?this[_0x5bd7('0x14')]:0x0;var _0xfc5ee0={'id':this['id'],'available':this[_0x5bd7('0x14')],'loggedIn':this[_0x5bd7('0xf')],'name':this[_0x5bd7('0x4')],'paused':this[_0x5bd7('0x10')],'waiting':this[_0x5bd7('0x15')]};var _0x436477=md5(JSON['stringify'](_0xfc5ee0));if(this[_0x5bd7('0x16')]!==_0x436477){this['md5']=_0x436477;io['to'](util[_0x5bd7('0x17')](_0x5bd7('0x18'),_0xfc5ee0['name']))[_0x5bd7('0x19')](_0x5bd7('0x1a'),_0xfc5ee0);}};module[_0x5bd7('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 3cd56e1..9f7d0f1 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 _0xac4b=['format','openchannel:queue:%s','openchannel_queue:save','exports','lodash','md5','util','name','timeout','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','openchannelPause','available'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0xac4b,0xb4));var _0xbac4=function(_0x3a1654,_0x48b251){_0x3a1654=_0x3a1654-0x0;var _0x231e87=_0xac4b[_0x3a1654];return _0x231e87;};'use strict';var _=require(_0xbac4('0x0'));var md5=require(_0xbac4('0x1'));var util=require(_0xbac4('0x2'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function OpenchannelQueue(_0x419b80){this['id']=_0x419b80['id']||0x0;this[_0xbac4('0x3')]=_0x419b80[_0xbac4('0x3')]||'';this[_0xbac4('0x4')]=_0x419b80[_0xbac4('0x4')]||0xa;this['strategy']=_0x419b80['strategy']||_0xbac4('0x5');this[_0xbac4('0x6')]=_0x419b80[_0xbac4('0x6')];this['mapAgentsId']={};this[_0xbac4('0x7')]=0x0;this[_0xbac4('0x1')]='';this['updateRouting']();this[_0xbac4('0x8')]();}OpenchannelQueue[_0xbac4('0x9')]['updateRouting']=function(){var _0x5970a2=this[_0xbac4('0xa')][_0xbac4('0xb')];this[_0xbac4('0xa')]=_[_0xbac4('0xc')](this[_0xbac4('0x6')],'id');this[_0xbac4('0xa')][_0xbac4('0xb')]=_0x5970a2;};OpenchannelQueue['prototype']['updateRealtime']=function(){this[_0xbac4('0xd')]=0x0;this[_0xbac4('0xe')]=0x0;for(var _0x5287c=0x0;_0x5287c=0x0?this[_0xbac4('0x11')]:0x0;var _0x472057={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbac4('0xd')],'name':this[_0xbac4('0x3')],'paused':this[_0xbac4('0xe')],'waiting':this[_0xbac4('0x7')]};var _0x4c0c33=md5(JSON['stringify'](_0x472057));if(this[_0xbac4('0x1')]!==_0x4c0c33){this['md5']=_0x4c0c33;io['to'](util[_0xbac4('0x12')](_0xbac4('0x13'),_0x472057['name']))['emit'](_0xbac4('0x14'),_0x472057);}};module[_0xbac4('0x15')]=OpenchannelQueue; \ No newline at end of file +var _0x4ab1=['stringify','format','openchannel:queue:%s','openchannel_queue:save','exports','lodash','md5','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','paused','length','online','loggedIn','openchannelPause','available'];(function(_0x527627,_0x11810d){var _0x448dbc=function(_0x24295e){while(--_0x24295e){_0x527627['push'](_0x527627['shift']());}};_0x448dbc(++_0x11810d);}(_0x4ab1,0x6d));var _0x14ab=function(_0x2a49e9,_0x5b0194){_0x2a49e9=_0x2a49e9-0x0;var _0x383ab4=_0x4ab1[_0x2a49e9];return _0x383ab4;};'use strict';var _=require(_0x14ab('0x0'));var md5=require(_0x14ab('0x1'));var util=require('util');var io=require(_0x14ab('0x2'))({'host':_0x14ab('0x3'),'port':0x18eb});function OpenchannelQueue(_0x5da392){this['id']=_0x5da392['id']||0x0;this[_0x14ab('0x4')]=_0x5da392[_0x14ab('0x4')]||'';this[_0x14ab('0x5')]=_0x5da392[_0x14ab('0x5')]||0xa;this[_0x14ab('0x6')]=_0x5da392[_0x14ab('0x6')]||_0x14ab('0x7');this[_0x14ab('0x8')]=_0x5da392[_0x14ab('0x8')];this[_0x14ab('0x9')]={};this['waiting']=0x0;this[_0x14ab('0x1')]='';this['updateRouting']();this[_0x14ab('0xa')]();}OpenchannelQueue[_0x14ab('0xb')][_0x14ab('0xc')]=function(){var _0x34a68e=this[_0x14ab('0x9')][_0x14ab('0xd')];this[_0x14ab('0x9')]=_[_0x14ab('0xe')](this[_0x14ab('0x8')],'id');this['mapAgentsId'][_0x14ab('0xd')]=_0x34a68e;};OpenchannelQueue['prototype'][_0x14ab('0xa')]=function(){this['loggedIn']=0x0;this[_0x14ab('0xf')]=0x0;for(var _0x405ed4=0x0;_0x405ed4=0x0?this[_0x14ab('0x14')]:0x0;var _0x5bb519={'id':this['id'],'available':this['available'],'loggedIn':this[_0x14ab('0x12')],'name':this[_0x14ab('0x4')],'paused':this[_0x14ab('0xf')],'waiting':this['waiting']};var _0x40b6d2=md5(JSON[_0x14ab('0x15')](_0x5bb519));if(this[_0x14ab('0x1')]!==_0x40b6d2){this[_0x14ab('0x1')]=_0x40b6d2;io['to'](util[_0x14ab('0x16')](_0x14ab('0x17'),_0x5bb519[_0x14ab('0x4')]))['emit'](_0x14ab('0x18'),_0x5bb519);}};module[_0x14ab('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index cd0b3ac..45124ab 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 _0x70e0=['map','Agents','_rr','loggedIn','paused','online','available','stringify','format','sms:queue:%s','emit','lodash','md5','util','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId'];(function(_0x88e87a,_0x263b7f){var _0x27839c=function(_0x22cd31){while(--_0x22cd31){_0x88e87a['push'](_0x88e87a['shift']());}};_0x27839c(++_0x263b7f);}(_0x70e0,0x17b));var _0x070e=function(_0x2d85b0,_0x157451){_0x2d85b0=_0x2d85b0-0x0;var _0x56ec1c=_0x70e0[_0x2d85b0];return _0x56ec1c;};'use strict';var _=require(_0x070e('0x0'));var md5=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function SmsQueue(_0x16e651){this['id']=_0x16e651['id']||0x0;this[_0x070e('0x3')]=_0x16e651[_0x070e('0x3')]||'';this[_0x070e('0x4')]=_0x16e651['timeout']||0xa;this[_0x070e('0x5')]=_0x16e651['strategy']||_0x070e('0x6');this['Agents']=_0x16e651['Agents'];this['mapAgentsId']={};this[_0x070e('0x7')]=0x0;this[_0x070e('0x1')]='';this[_0x070e('0x8')]();this[_0x070e('0x9')]();}SmsQueue[_0x070e('0xa')][_0x070e('0x8')]=function(){var _0x11ffa8=this['mapAgentsId']['_rr'];this[_0x070e('0xb')]=_[_0x070e('0xc')](this[_0x070e('0xd')],'id');this[_0x070e('0xb')][_0x070e('0xe')]=_0x11ffa8;};SmsQueue[_0x070e('0xa')][_0x070e('0x9')]=function(){this[_0x070e('0xf')]=0x0;this[_0x070e('0x10')]=0x0;for(var _0x5bf079=0x0;_0x5bf079=0x0?this[_0x070e('0x12')]:0x0;var _0x19d9da={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x070e('0x3')],'paused':this[_0x070e('0x10')],'waiting':this[_0x070e('0x7')]};var _0x2060cc=md5(JSON[_0x070e('0x13')](_0x19d9da));if(this['md5']!==_0x2060cc){this[_0x070e('0x1')]=_0x2060cc;io['to'](util[_0x070e('0x14')](_0x070e('0x15'),_0x19d9da[_0x070e('0x3')]))[_0x070e('0x16')]('sms_queue:save',_0x19d9da);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x750a=['smsPause','available','sms:queue:%s','emit','exports','md5','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','prototype','paused','online','loggedIn'];(function(_0x2fa31e,_0x377b0c){var _0x338b03=function(_0x1e6c6f){while(--_0x1e6c6f){_0x2fa31e['push'](_0x2fa31e['shift']());}};_0x338b03(++_0x377b0c);}(_0x750a,0x140));var _0xa750=function(_0x2022c4,_0x51d00f){_0x2022c4=_0x2022c4-0x0;var _0x25604a=_0x750a[_0x2022c4];return _0x25604a;};'use strict';var _=require('lodash');var md5=require(_0xa750('0x0'));var util=require('util');var io=require('socket.io-emitter')({'host':_0xa750('0x1'),'port':0x18eb});function SmsQueue(_0xeb020d){this['id']=_0xeb020d['id']||0x0;this[_0xa750('0x2')]=_0xeb020d[_0xa750('0x2')]||'';this[_0xa750('0x3')]=_0xeb020d[_0xa750('0x3')]||0xa;this[_0xa750('0x4')]=_0xeb020d[_0xa750('0x4')]||_0xa750('0x5');this[_0xa750('0x6')]=_0xeb020d[_0xa750('0x6')];this[_0xa750('0x7')]={};this[_0xa750('0x8')]=0x0;this['md5']='';this['updateRouting']();this[_0xa750('0x9')]();}SmsQueue['prototype'][_0xa750('0xa')]=function(){var _0x1760f5=this['mapAgentsId'][_0xa750('0xb')];this[_0xa750('0x7')]=_['map'](this['Agents'],'id');this[_0xa750('0x7')]['_rr']=_0x1760f5;};SmsQueue[_0xa750('0xc')][_0xa750('0x9')]=function(){this['loggedIn']=0x0;this[_0xa750('0xd')]=0x0;for(var _0x1c5657=0x0;_0x1c5657=0x0?this[_0xa750('0x11')]:0x0;var _0x29480c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa750('0x2')],'paused':this['paused'],'waiting':this[_0xa750('0x8')]};var _0x1bde87=md5(JSON['stringify'](_0x29480c));if(this[_0xa750('0x0')]!==_0x1bde87){this['md5']=_0x1bde87;io['to'](util['format'](_0xa750('0x12'),_0x29480c['name']))[_0xa750('0x13')]('sms_queue:save',_0x29480c);}};module[_0xa750('0x14')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 058df71..cb57791 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 _0x6a04=['util','lodash','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','chatQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','mergeFromDatabase','initIntervals','intervals','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','exports','bluebird'];(function(_0x4f6272,_0x3759ac){var _0x213993=function(_0x125466){while(--_0x125466){_0x4f6272['push'](_0x4f6272['shift']());}};_0x213993(++_0x3759ac);}(_0x6a04,0xdd));var _0x46a0=function(_0x468b61,_0x521b95){_0x468b61=_0x468b61-0x0;var _0x560f6e=_0x6a04[_0x468b61];return _0x560f6e;};'use strict';var BPromise=require(_0x46a0('0x0'));var util=require(_0x46a0('0x1'));var _=require(_0x46a0('0x2'));var moment=require('moment');var Agent=require(_0x46a0('0x3'));var Interval=require(_0x46a0('0x4'));var OpenchannelQueue=require(_0x46a0('0x5'));var ChatQueue=require(_0x46a0('0x6'));var SmsQueue=require(_0x46a0('0x7'));var MailQueue=require(_0x46a0('0x8'));var FaxQueue=require(_0x46a0('0x9'));var Realtime=function(){this[_0x46a0('0xa')]={};this['intervals']={};this['openchannelQueues']={};this[_0x46a0('0xb')]={};this[_0x46a0('0xc')]={};this['mailQueues']={};this[_0x46a0('0xd')]={};this['chatQueuesWaitingInteractions']={};this[_0x46a0('0xe')]={};this[_0x46a0('0xf')]={};this[_0x46a0('0x10')]={};this[_0x46a0('0x11')]={};};function freeIsNotKey(_0x38aba8,_0x4345d9,_0x273f56){var _0x571a57=_[_0x46a0('0x12')](_0x38aba8,function(_0x9f381f,_0x24c12a){return _0x9f381f[_0x273f56];});for(var _0x1ed309 in _0x4345d9){if(_0x4345d9[_0x46a0('0x13')](_0x1ed309)){if(!_0x571a57[_0x1ed309]){delete _0x4345d9[_0x1ed309];}}}}Realtime[_0x46a0('0x14')]['mergeFromDatabase']=function(_0x3fc433,_0xc42eac){for(var _0x3649c6 in _0xc42eac){if(_0x3fc433[_0x46a0('0x13')](_0x3649c6)){_0x3fc433[_0x3649c6]=_0xc42eac[_0x3649c6];}}};Realtime[_0x46a0('0x14')][_0x46a0('0x15')]=function(){var _0x258c71=this;return function(_0x30d743){if(_0x30d743){freeIsNotKey(_0x30d743,_0x258c71[_0x46a0('0xa')],'id');for(var _0x3745df=0x0,_0x4ff780={},_0x5c7384={};_0x3745df<_0x30d743[_0x46a0('0x16')];_0x3745df+=0x1){_0x4ff780=_0x30d743[_0x3745df];if(_[_0x46a0('0x17')](_0x258c71[_0x46a0('0xa')][_0x4ff780['id']])){_0x258c71[_0x46a0('0xa')][_0x4ff780['id']]=new Agent(_0x4ff780);}else{_0x258c71[_0x46a0('0x18')](_0x258c71['agents'][_0x4ff780['id']],_0x4ff780);}}}return _0x258c71[_0x46a0('0xa')];};};Realtime['prototype'][_0x46a0('0x19')]=function(){var _0x1243e4=this;return function(_0xe06357){if(_0xe06357){freeIsNotKey(_0xe06357,_0x1243e4[_0x46a0('0x1a')],'id');for(var _0x530e08=0x0,_0x3c18e5={},_0x335fb0={};_0x530e08<_0xe06357[_0x46a0('0x16')];_0x530e08+=0x1){_0x3c18e5=_0xe06357[_0x530e08];if(_[_0x46a0('0x17')](_0x1243e4[_0x46a0('0x1a')][_0x3c18e5['id']])){_0x1243e4[_0x46a0('0x1a')][_0x3c18e5['id']]=new Interval(_0x3c18e5);}else{_0x1243e4[_0x46a0('0x18')](_0x1243e4[_0x46a0('0x1a')][_0x3c18e5['id']],_0x3c18e5);}}}return _0x1243e4[_0x46a0('0x1a')];};};Realtime[_0x46a0('0x14')][_0x46a0('0x1b')]=function(){var _0x2eb5ee=this;return function(_0x11efb5){if(_0x11efb5){freeIsNotKey(_0x11efb5,_0x2eb5ee[_0x46a0('0x1c')],'id');for(var _0x51ecce=0x0,_0x6c6486={},_0x3cbaf7={};_0x51ecce<_0x11efb5[_0x46a0('0x16')];_0x51ecce+=0x1){_0x6c6486=_0x11efb5[_0x51ecce];if(_[_0x46a0('0x17')](_0x2eb5ee[_0x46a0('0x1c')][_0x6c6486['id']])){_0x2eb5ee['openchannelQueues'][_0x6c6486['id']]=new OpenchannelQueue(_0x6c6486);}else{_0x2eb5ee[_0x46a0('0x18')](_0x2eb5ee['openchannelQueues'][_0x6c6486['id']],_0x6c6486);}_0x2eb5ee[_0x46a0('0x1c')][_0x6c6486['id']][_0x46a0('0x1d')]();_0x2eb5ee[_0x46a0('0x1c')][_0x6c6486['id']][_0x46a0('0x1e')]();}}return _0x2eb5ee[_0x46a0('0x1c')];};};Realtime[_0x46a0('0x14')][_0x46a0('0x1f')]=function(){var _0x542f62=this;return function(_0x528d88){if(_0x528d88){freeIsNotKey(_0x528d88,_0x542f62[_0x46a0('0xb')],'id');for(var _0x380173=0x0,_0xa49ffe={},_0x30494={};_0x380173<_0x528d88['length'];_0x380173+=0x1){_0xa49ffe=_0x528d88[_0x380173];if(_[_0x46a0('0x17')](_0x542f62[_0x46a0('0xb')][_0xa49ffe['id']])){_0x542f62['chatQueues'][_0xa49ffe['id']]=new ChatQueue(_0xa49ffe);}else{_0x542f62['mergeFromDatabase'](_0x542f62['chatQueues'][_0xa49ffe['id']],_0xa49ffe);}_0x542f62[_0x46a0('0xb')][_0xa49ffe['id']][_0x46a0('0x1d')]();_0x542f62[_0x46a0('0xb')][_0xa49ffe['id']][_0x46a0('0x1e')]();}}return _0x542f62[_0x46a0('0xb')];};};Realtime[_0x46a0('0x14')][_0x46a0('0x20')]=function(){var _0x449706=this;return function(_0x8b8729){if(_0x8b8729){freeIsNotKey(_0x8b8729,_0x449706[_0x46a0('0xc')],'id');for(var _0x293a37=0x0,_0x38311b={},_0x3753bb={};_0x293a37<_0x8b8729[_0x46a0('0x16')];_0x293a37+=0x1){_0x38311b=_0x8b8729[_0x293a37];if(_['isUndefined'](_0x449706[_0x46a0('0xc')][_0x38311b['id']])){_0x449706[_0x46a0('0xc')][_0x38311b['id']]=new SmsQueue(_0x38311b);}else{_0x449706[_0x46a0('0x18')](_0x449706['smsQueues'][_0x38311b['id']],_0x38311b);}_0x449706[_0x46a0('0xc')][_0x38311b['id']][_0x46a0('0x1d')]();_0x449706['smsQueues'][_0x38311b['id']][_0x46a0('0x1e')]();}}return _0x449706[_0x46a0('0xc')];};};Realtime[_0x46a0('0x14')][_0x46a0('0x21')]=function(){var _0x4cb105=this;return function(_0x3f02bc){if(_0x3f02bc){freeIsNotKey(_0x3f02bc,_0x4cb105['mailQueues'],'id');for(var _0x39b2b6=0x0,_0xf5ca1d={},_0x203b66={};_0x39b2b6<_0x3f02bc[_0x46a0('0x16')];_0x39b2b6+=0x1){_0xf5ca1d=_0x3f02bc[_0x39b2b6];if(_['isUndefined'](_0x4cb105[_0x46a0('0x22')][_0xf5ca1d['id']])){_0x4cb105[_0x46a0('0x22')][_0xf5ca1d['id']]=new MailQueue(_0xf5ca1d);}else{_0x4cb105[_0x46a0('0x18')](_0x4cb105[_0x46a0('0x22')][_0xf5ca1d['id']],_0xf5ca1d);}_0x4cb105[_0x46a0('0x22')][_0xf5ca1d['id']]['updateRouting']();_0x4cb105[_0x46a0('0x22')][_0xf5ca1d['id']][_0x46a0('0x1e')]();}}return _0x4cb105[_0x46a0('0x22')];};};Realtime['prototype'][_0x46a0('0x23')]=function(){var _0x4bd2b0=this;return function(_0x1e5764){if(_0x1e5764){freeIsNotKey(_0x1e5764,_0x4bd2b0['faxQueues'],'id');for(var _0x2e45df=0x0,_0x59048b={},_0x3ca5ba={};_0x2e45df<_0x1e5764[_0x46a0('0x16')];_0x2e45df+=0x1){_0x59048b=_0x1e5764[_0x2e45df];if(_['isUndefined'](_0x4bd2b0[_0x46a0('0xd')][_0x59048b['id']])){_0x4bd2b0[_0x46a0('0xd')][_0x59048b['id']]=new FaxQueue(_0x59048b);}else{_0x4bd2b0[_0x46a0('0x18')](_0x4bd2b0[_0x46a0('0xd')][_0x59048b['id']],_0x59048b);}_0x4bd2b0['faxQueues'][_0x59048b['id']][_0x46a0('0x1d')]();_0x4bd2b0['faxQueues'][_0x59048b['id']][_0x46a0('0x1e')]();}}return _0x4bd2b0['faxQueues'];};};module[_0x46a0('0x24')]=Realtime; \ No newline at end of file +var _0x124d=['lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','mergeFromDatabase','updateRouting','updateRealtime','initSmsQueues','smsQueues','initMailQueues','bluebird','util'];(function(_0x442e1f,_0x3e328f){var _0x4d7d17=function(_0x1c7d90){while(--_0x1c7d90){_0x442e1f['push'](_0x442e1f['shift']());}};_0x4d7d17(++_0x3e328f);}(_0x124d,0xbe));var _0xd124=function(_0x1ff42e,_0x3c8f4f){_0x1ff42e=_0x1ff42e-0x0;var _0x879a31=_0x124d[_0x1ff42e];return _0x879a31;};'use strict';var BPromise=require(_0xd124('0x0'));var util=require(_0xd124('0x1'));var _=require(_0xd124('0x2'));var moment=require(_0xd124('0x3'));var Agent=require('../model/agent');var Interval=require(_0xd124('0x4'));var OpenchannelQueue=require(_0xd124('0x5'));var ChatQueue=require(_0xd124('0x6'));var SmsQueue=require(_0xd124('0x7'));var MailQueue=require(_0xd124('0x8'));var FaxQueue=require(_0xd124('0x9'));var Realtime=function(){this[_0xd124('0xa')]={};this[_0xd124('0xb')]={};this[_0xd124('0xc')]={};this[_0xd124('0xd')]={};this['smsQueues']={};this[_0xd124('0xe')]={};this[_0xd124('0xf')]={};this['chatQueuesWaitingInteractions']={};this[_0xd124('0x10')]={};this[_0xd124('0x11')]={};this[_0xd124('0x12')]={};this[_0xd124('0x13')]={};};function freeIsNotKey(_0x25ec2f,_0x319657,_0x40edcb){var _0xe03426=_[_0xd124('0x14')](_0x25ec2f,function(_0xe352b5,_0x505c4f){return _0xe352b5[_0x40edcb];});for(var _0x441033 in _0x319657){if(_0x319657[_0xd124('0x15')](_0x441033)){if(!_0xe03426[_0x441033]){delete _0x319657[_0x441033];}}}}Realtime[_0xd124('0x16')]['mergeFromDatabase']=function(_0x9bdd0e,_0x74d260){for(var _0x5f3cae in _0x74d260){if(_0x9bdd0e[_0xd124('0x15')](_0x5f3cae)){_0x9bdd0e[_0x5f3cae]=_0x74d260[_0x5f3cae];}}};Realtime['prototype'][_0xd124('0x17')]=function(){var _0x15c6e4=this;return function(_0x54b098){if(_0x54b098){freeIsNotKey(_0x54b098,_0x15c6e4[_0xd124('0xa')],'id');for(var _0x4768f1=0x0,_0x285940={},_0x491cb9={};_0x4768f1<_0x54b098[_0xd124('0x18')];_0x4768f1+=0x1){_0x285940=_0x54b098[_0x4768f1];if(_[_0xd124('0x19')](_0x15c6e4[_0xd124('0xa')][_0x285940['id']])){_0x15c6e4[_0xd124('0xa')][_0x285940['id']]=new Agent(_0x285940);}else{_0x15c6e4[_0xd124('0x1a')](_0x15c6e4[_0xd124('0xa')][_0x285940['id']],_0x285940);}}}return _0x15c6e4[_0xd124('0xa')];};};Realtime['prototype']['initIntervals']=function(){var _0x2597d9=this;return function(_0x50347b){if(_0x50347b){freeIsNotKey(_0x50347b,_0x2597d9[_0xd124('0xb')],'id');for(var _0x59a217=0x0,_0x1e1fd6={},_0x4a8594={};_0x59a217<_0x50347b[_0xd124('0x18')];_0x59a217+=0x1){_0x1e1fd6=_0x50347b[_0x59a217];if(_[_0xd124('0x19')](_0x2597d9['intervals'][_0x1e1fd6['id']])){_0x2597d9[_0xd124('0xb')][_0x1e1fd6['id']]=new Interval(_0x1e1fd6);}else{_0x2597d9[_0xd124('0x1a')](_0x2597d9[_0xd124('0xb')][_0x1e1fd6['id']],_0x1e1fd6);}}}return _0x2597d9[_0xd124('0xb')];};};Realtime[_0xd124('0x16')]['initOpenchannelQueues']=function(){var _0x40c957=this;return function(_0x1591ba){if(_0x1591ba){freeIsNotKey(_0x1591ba,_0x40c957['openchannelQueues'],'id');for(var _0x4da6b8=0x0,_0x1abc75={},_0x673fba={};_0x4da6b8<_0x1591ba['length'];_0x4da6b8+=0x1){_0x1abc75=_0x1591ba[_0x4da6b8];if(_['isUndefined'](_0x40c957[_0xd124('0xc')][_0x1abc75['id']])){_0x40c957[_0xd124('0xc')][_0x1abc75['id']]=new OpenchannelQueue(_0x1abc75);}else{_0x40c957[_0xd124('0x1a')](_0x40c957[_0xd124('0xc')][_0x1abc75['id']],_0x1abc75);}_0x40c957[_0xd124('0xc')][_0x1abc75['id']][_0xd124('0x1b')]();_0x40c957[_0xd124('0xc')][_0x1abc75['id']][_0xd124('0x1c')]();}}return _0x40c957[_0xd124('0xc')];};};Realtime['prototype']['initChatQueues']=function(){var _0x5c0e8e=this;return function(_0x32c1c8){if(_0x32c1c8){freeIsNotKey(_0x32c1c8,_0x5c0e8e[_0xd124('0xd')],'id');for(var _0x2e6d3b=0x0,_0x1b9f5b={},_0x5d4da4={};_0x2e6d3b<_0x32c1c8[_0xd124('0x18')];_0x2e6d3b+=0x1){_0x1b9f5b=_0x32c1c8[_0x2e6d3b];if(_[_0xd124('0x19')](_0x5c0e8e[_0xd124('0xd')][_0x1b9f5b['id']])){_0x5c0e8e[_0xd124('0xd')][_0x1b9f5b['id']]=new ChatQueue(_0x1b9f5b);}else{_0x5c0e8e[_0xd124('0x1a')](_0x5c0e8e['chatQueues'][_0x1b9f5b['id']],_0x1b9f5b);}_0x5c0e8e[_0xd124('0xd')][_0x1b9f5b['id']]['updateRouting']();_0x5c0e8e[_0xd124('0xd')][_0x1b9f5b['id']]['updateRealtime']();}}return _0x5c0e8e[_0xd124('0xd')];};};Realtime[_0xd124('0x16')][_0xd124('0x1d')]=function(){var _0x587103=this;return function(_0x51844d){if(_0x51844d){freeIsNotKey(_0x51844d,_0x587103[_0xd124('0x1e')],'id');for(var _0x27cac1=0x0,_0x4d58be={},_0x14686e={};_0x27cac1<_0x51844d['length'];_0x27cac1+=0x1){_0x4d58be=_0x51844d[_0x27cac1];if(_[_0xd124('0x19')](_0x587103[_0xd124('0x1e')][_0x4d58be['id']])){_0x587103[_0xd124('0x1e')][_0x4d58be['id']]=new SmsQueue(_0x4d58be);}else{_0x587103[_0xd124('0x1a')](_0x587103['smsQueues'][_0x4d58be['id']],_0x4d58be);}_0x587103[_0xd124('0x1e')][_0x4d58be['id']][_0xd124('0x1b')]();_0x587103[_0xd124('0x1e')][_0x4d58be['id']][_0xd124('0x1c')]();}}return _0x587103[_0xd124('0x1e')];};};Realtime['prototype'][_0xd124('0x1f')]=function(){var _0x5cc472=this;return function(_0x1552ca){if(_0x1552ca){freeIsNotKey(_0x1552ca,_0x5cc472['mailQueues'],'id');for(var _0x2a42d3=0x0,_0x1130f8={},_0x3eb6d2={};_0x2a42d3<_0x1552ca[_0xd124('0x18')];_0x2a42d3+=0x1){_0x1130f8=_0x1552ca[_0x2a42d3];if(_[_0xd124('0x19')](_0x5cc472['mailQueues'][_0x1130f8['id']])){_0x5cc472[_0xd124('0xe')][_0x1130f8['id']]=new MailQueue(_0x1130f8);}else{_0x5cc472['mergeFromDatabase'](_0x5cc472['mailQueues'][_0x1130f8['id']],_0x1130f8);}_0x5cc472[_0xd124('0xe')][_0x1130f8['id']]['updateRouting']();_0x5cc472[_0xd124('0xe')][_0x1130f8['id']][_0xd124('0x1c')]();}}return _0x5cc472[_0xd124('0xe')];};};Realtime[_0xd124('0x16')]['initFaxQueues']=function(){var _0x37992a=this;return function(_0x46b990){if(_0x46b990){freeIsNotKey(_0x46b990,_0x37992a[_0xd124('0xf')],'id');for(var _0x3d439c=0x0,_0x11010c={},_0x38b2c2={};_0x3d439c<_0x46b990[_0xd124('0x18')];_0x3d439c+=0x1){_0x11010c=_0x46b990[_0x3d439c];if(_[_0xd124('0x19')](_0x37992a['faxQueues'][_0x11010c['id']])){_0x37992a[_0xd124('0xf')][_0x11010c['id']]=new FaxQueue(_0x11010c);}else{_0x37992a[_0xd124('0x1a')](_0x37992a['faxQueues'][_0x11010c['id']],_0x11010c);}_0x37992a[_0xd124('0xf')][_0x11010c['id']][_0xd124('0x1b')]();_0x37992a[_0xd124('0xf')][_0x11010c['id']][_0xd124('0x1c')]();}}return _0x37992a['faxQueues'];};};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 4b23927..0b5087c 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 _0x45c8=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x4fc7c0,_0x4b7949){var _0x1b00f0=function(_0x23abeb){while(--_0x23abeb){_0x4fc7c0['push'](_0x4fc7c0['shift']());}};_0x1b00f0(++_0x4b7949);}(_0x45c8,0x140));var _0x845c=function(_0x16d82c,_0x5d0851){_0x16d82c=_0x16d82c-0x0;var _0x4ea56b=_0x45c8[_0x16d82c];return _0x4ea56b;};'use strict';var client=require(_0x845c('0x0'));exports['update']=function(_0x22a994,_0x5968dd){return client[_0x845c('0x1')](_0x845c('0x2'),{'body':_0x5968dd,'options':{'where':{'id':_0x22a994}},'log':_0x845c('0x3')});};exports['addTags']=function(_0x72dacc,_0x52eab8){return client[_0x845c('0x1')](_0x845c('0x4'),{'body':_0x52eab8,'options':{'where':{'id':_0x72dacc}},'log':_0x845c('0x5')});}; \ No newline at end of file +var _0x75dd=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x75dd,0x174));var _0xd75d=function(_0x3730e8,_0x84b5a6){_0x3730e8=_0x3730e8-0x0;var _0x416abe=_0x75dd[_0x3730e8];return _0x416abe;};'use strict';var client=require(_0xd75d('0x0'));exports[_0xd75d('0x1')]=function(_0x53b0e8,_0x214d34){return client[_0xd75d('0x2')](_0xd75d('0x3'),{'body':_0x214d34,'options':{'where':{'id':_0x53b0e8}},'log':'updateChatInteraction'});};exports[_0xd75d('0x4')]=function(_0x51d131,_0x395883){return client['Request'](_0xd75d('0x5'),{'body':_0x395883,'options':{'where':{'id':_0x51d131}},'log':_0xd75d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 5e21ae2..6cf5837 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 _0x02a0=['../client','Request'];(function(_0x762c94,_0x57faab){var _0x12bbf2=function(_0xe2effb){while(--_0xe2effb){_0x762c94['push'](_0x762c94['shift']());}};_0x12bbf2(++_0x57faab);}(_0x02a0,0xd0));var _0x002a=function(_0x2fe42d,_0x2a6d25){_0x2fe42d=_0x2fe42d-0x0;var _0x150522=_0x02a0[_0x2fe42d];return _0x150522;};'use strict';var client=require(_0x002a('0x0'));exports['create']=function(_0x47e69b){return client[_0x002a('0x1')]('CreateChatMessage',{'body':_0x47e69b,'log':'createChatMessage'});}; \ No newline at end of file +var _0x997d=['../client','create','Request','createChatMessage'];(function(_0x512bce,_0x17590a){var _0xcbcdf9=function(_0x3493f7){while(--_0x3493f7){_0x512bce['push'](_0x512bce['shift']());}};_0xcbcdf9(++_0x17590a);}(_0x997d,0x98));var _0xd997=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0x997d[_0x596c43];return _0x4e1315;};'use strict';var client=require(_0xd997('0x0'));exports[_0xd997('0x1')]=function(_0x9ca9bf){return client[_0xd997('0x2')]('CreateChatMessage',{'body':_0x9ca9bf,'log':_0xd997('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 89e1345..9097de9 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 _0xf7f1=['User','Agents','online','../client','getChatQueues','Request','name','timeout','strategy'];(function(_0x1bd45d,_0x1a774f){var _0x15b94d=function(_0x52853b){while(--_0x52853b){_0x1bd45d['push'](_0x1bd45d['shift']());}};_0x15b94d(++_0x1a774f);}(_0xf7f1,0x9c));var _0x1f7f=function(_0x33f94f,_0x18a6ca){_0x33f94f=_0x33f94f-0x0;var _0xcfcb39=_0xf7f1[_0x33f94f];return _0xcfcb39;};'use strict';var client=require(_0x1f7f('0x0'));exports[_0x1f7f('0x1')]=function(){return function(){return client[_0x1f7f('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x1f7f('0x3'),_0x1f7f('0x4'),_0x1f7f('0x5')],'include':[{'model':_0x1f7f('0x6'),'as':_0x1f7f('0x7'),'attributes':['id',_0x1f7f('0x3'),_0x1f7f('0x8'),'chatPause']}]},'log':_0x1f7f('0x1')});};}; \ No newline at end of file +var _0x7e91=['timeout','strategy','Agents','online','chatPause','getChatQueues','GetChatQueue','name'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x7e91,0x11d));var _0x17e9=function(_0x2d777f,_0x522da4){_0x2d777f=_0x2d777f-0x0;var _0x1b59ee=_0x7e91[_0x2d777f];return _0x1b59ee;};'use strict';var client=require('../client');exports[_0x17e9('0x0')]=function(){return function(){return client['Request'](_0x17e9('0x1'),{'options':{'raw':![],'attributes':['id',_0x17e9('0x2'),_0x17e9('0x3'),_0x17e9('0x4')],'include':[{'model':'User','as':_0x17e9('0x5'),'attributes':['id',_0x17e9('0x2'),_0x17e9('0x6'),_0x17e9('0x7')]}]},'log':_0x17e9('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 4a368e1..976d0a0 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 _0xc831=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','create'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc831,0x103));var _0x1c83=function(_0x22ada5,_0x2ac187){_0x22ada5=_0x22ada5-0x0;var _0x17b270=_0xc831[_0x22ada5];return _0x17b270;};'use strict';var client=require('../client');exports[_0x1c83('0x0')]=function(_0xb982da){return client[_0x1c83('0x1')](_0x1c83('0x2'),{'body':_0xb982da,'log':_0x1c83('0x2')});};exports[_0x1c83('0x3')]=function(_0x282a11,_0x28441e){return client[_0x1c83('0x1')](_0x1c83('0x4'),{'body':_0x28441e,'options':{'where':{'uniqueid':_0x282a11},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xaf93=['DESC','../client','create','CreateChatQueueReport','Request','UpdateChatQueueReport'];(function(_0x50e373,_0x43664e){var _0x529633=function(_0x193c98){while(--_0x193c98){_0x50e373['push'](_0x50e373['shift']());}};_0x529633(++_0x43664e);}(_0xaf93,0x151));var _0x3af9=function(_0x292541,_0x767479){_0x292541=_0x292541-0x0;var _0x37b9ad=_0xaf93[_0x292541];return _0x37b9ad;};'use strict';var client=require(_0x3af9('0x0'));exports[_0x3af9('0x1')]=function(_0x482d3c){return client['Request'](_0x3af9('0x2'),{'body':_0x482d3c,'log':_0x3af9('0x2')});};exports['update']=function(_0x1319bc,_0x44ae6e){return client[_0x3af9('0x3')](_0x3af9('0x4'),{'body':_0x44ae6e,'options':{'where':{'uniqueid':_0x1319bc},'order':[['id',_0x3af9('0x5')]],'limit':0x1},'log':_0x3af9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 263ecdb..effbc99 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 _0x80e8=['addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','updateFaxInteraction'];(function(_0x38f811,_0x484eed){var _0x178e99=function(_0x3a9f3e){while(--_0x3a9f3e){_0x38f811['push'](_0x38f811['shift']());}};_0x178e99(++_0x484eed);}(_0x80e8,0x90));var _0x880e=function(_0x30a6ec,_0x252cec){_0x30a6ec=_0x30a6ec-0x0;var _0x59b5fb=_0x80e8[_0x30a6ec];return _0x59b5fb;};'use strict';var client=require(_0x880e('0x0'));exports[_0x880e('0x1')]=function(_0x263d86,_0x58f4b2){return client['Request']('UpdateFaxInteraction',{'body':_0x58f4b2,'options':{'where':{'id':_0x263d86}},'log':_0x880e('0x2')});};exports[_0x880e('0x3')]=function(_0x52a73e,_0xbb770f){return client[_0x880e('0x4')](_0x880e('0x5'),{'body':_0xbb770f,'options':{'where':{'id':_0x52a73e}},'log':_0x880e('0x6')});}; \ No newline at end of file +var _0x9014=['UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update','Request'];(function(_0x22023e,_0x252931){var _0x47ce9b=function(_0x4a4df1){while(--_0x4a4df1){_0x22023e['push'](_0x22023e['shift']());}};_0x47ce9b(++_0x252931);}(_0x9014,0x1d9));var _0x4901=function(_0x49b2fc,_0x5f0ad9){_0x49b2fc=_0x49b2fc-0x0;var _0xf56d25=_0x9014[_0x49b2fc];return _0xf56d25;};'use strict';var client=require(_0x4901('0x0'));exports[_0x4901('0x1')]=function(_0x17b2f1,_0x42610d){return client[_0x4901('0x2')](_0x4901('0x3'),{'body':_0x42610d,'options':{'where':{'id':_0x17b2f1}},'log':_0x4901('0x4')});};exports[_0x4901('0x5')]=function(_0x4b3b7b,_0x3c5f5a){return client[_0x4901('0x2')](_0x4901('0x6'),{'body':_0x3c5f5a,'options':{'where':{'id':_0x4b3b7b}},'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 4c73fd2..54c1702 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 _0x0d18=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x4d9e3c,_0x2d3987){var _0x5ed169=function(_0x348e2d){while(--_0x348e2d){_0x4d9e3c['push'](_0x4d9e3c['shift']());}};_0x5ed169(++_0x2d3987);}(_0x0d18,0x1b7));var _0x80d1=function(_0x207614,_0x1779f2){_0x207614=_0x207614-0x0;var _0x594228=_0x0d18[_0x207614];return _0x594228;};'use strict';var client=require(_0x80d1('0x0'));exports[_0x80d1('0x1')]=function(_0x285d3f){return client['Request'](_0x80d1('0x2'),{'body':_0x285d3f,'log':_0x80d1('0x3')});}; \ No newline at end of file +var _0x56e0=['create','Request','CreateFaxMessage'];(function(_0x1ad9bb,_0x2d48e5){var _0xeaafc5=function(_0x4e4795){while(--_0x4e4795){_0x1ad9bb['push'](_0x1ad9bb['shift']());}};_0xeaafc5(++_0x2d48e5);}(_0x56e0,0x1d7));var _0x056e=function(_0x952a19,_0x2797f9){_0x952a19=_0x952a19-0x0;var _0x5b20f2=_0x56e0[_0x952a19];return _0x5b20f2;};'use strict';var client=require('../client');exports[_0x056e('0x0')]=function(_0x3f561c){return client[_0x056e('0x1')](_0x056e('0x2'),{'body':_0x3f561c,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index cf9ee50..64aea95 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 _0xd437=['Request','GetFaxQueue','name','timeout','strategy','User','Agents','faxPause','../client','getFaxQueues'];(function(_0xa85ce3,_0x3ff7c7){var _0x365083=function(_0x79a498){while(--_0x79a498){_0xa85ce3['push'](_0xa85ce3['shift']());}};_0x365083(++_0x3ff7c7);}(_0xd437,0xb2));var _0x7d43=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0xd437[_0x57fc2a];return _0xa839b;};'use strict';var client=require(_0x7d43('0x0'));exports[_0x7d43('0x1')]=function(){return function(){return client[_0x7d43('0x2')](_0x7d43('0x3'),{'options':{'raw':![],'attributes':['id',_0x7d43('0x4'),_0x7d43('0x5'),_0x7d43('0x6')],'include':[{'model':_0x7d43('0x7'),'as':_0x7d43('0x8'),'attributes':['id',_0x7d43('0x4'),'online',_0x7d43('0x9')]}]},'log':_0x7d43('0x1')});};}; \ No newline at end of file +var _0xc371=['getFaxQueues','GetFaxQueue','timeout','User','name','online'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xc371,0xf6));var _0x1c37=function(_0x2aa0bf,_0x1222a4){_0x2aa0bf=_0x2aa0bf-0x0;var _0x1fb315=_0xc371[_0x2aa0bf];return _0x1fb315;};'use strict';var client=require('../client');exports[_0x1c37('0x0')]=function(){return function(){return client['Request'](_0x1c37('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x1c37('0x2'),'strategy'],'include':[{'model':_0x1c37('0x3'),'as':'Agents','attributes':['id',_0x1c37('0x4'),_0x1c37('0x5'),'faxPause']}]},'log':_0x1c37('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0146eb0..6481716 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 _0xcd9e=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x5651ef,_0x4fd99a){var _0x392fba=function(_0x14c7dd){while(--_0x14c7dd){_0x5651ef['push'](_0x5651ef['shift']());}};_0x392fba(++_0x4fd99a);}(_0xcd9e,0x6e));var _0xecd9=function(_0x4878ce,_0x55246b){_0x4878ce=_0x4878ce-0x0;var _0x353769=_0xcd9e[_0x4878ce];return _0x353769;};'use strict';var client=require(_0xecd9('0x0'));exports[_0xecd9('0x1')]=function(_0x39878b){return client[_0xecd9('0x2')](_0xecd9('0x3'),{'body':_0x39878b,'log':_0xecd9('0x3')});};exports['update']=function(_0xf52683,_0x45c7f0){return client['Request'](_0xecd9('0x4'),{'body':_0x45c7f0,'options':{'where':{'uniqueid':_0xf52683},'order':[['id',_0xecd9('0x5')]],'limit':0x1},'log':_0xecd9('0x4')});}; \ No newline at end of file +var _0x9033=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','../client'];(function(_0x162b50,_0x4b9344){var _0x1d7809=function(_0x43c26f){while(--_0x43c26f){_0x162b50['push'](_0x162b50['shift']());}};_0x1d7809(++_0x4b9344);}(_0x9033,0xf7));var _0x3903=function(_0x32e894,_0x4869fb){_0x32e894=_0x32e894-0x0;var _0x813943=_0x9033[_0x32e894];return _0x813943;};'use strict';var client=require(_0x3903('0x0'));exports['create']=function(_0x3130c9){return client[_0x3903('0x1')](_0x3903('0x2'),{'body':_0x3130c9,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x29fd42,_0x19c7f0){return client[_0x3903('0x1')](_0x3903('0x3'),{'body':_0x19c7f0,'options':{'where':{'uniqueid':_0x29fd42},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6d5d543..a4be728 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 _0xd757=['getIntervals','Request','GetInterval','Intervals','name','../client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd757,0x1e5));var _0x7d75=function(_0x3d16b6,_0x23a5c2){_0x3d16b6=_0x3d16b6-0x0;var _0x5817d0=_0xd757[_0x3d16b6];return _0x5817d0;};'use strict';var client=require(_0x7d75('0x0'));exports[_0x7d75('0x1')]=function(){return function(){return client[_0x7d75('0x2')](_0x7d75('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x7d75('0x4'),'attributes':['id',_0x7d75('0x5'),'interval']}]},'log':_0x7d75('0x1')});};}; \ No newline at end of file +var _0xc2da=['name','Intervals','interval','getIntervals','../client','Request'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xc2da,0x124));var _0xac2d=function(_0x39ded1,_0xaee436){_0x39ded1=_0x39ded1-0x0;var _0x2e248e=_0xc2da[_0x39ded1];return _0x2e248e;};'use strict';var client=require(_0xac2d('0x0'));exports['getIntervals']=function(){return function(){return client[_0xac2d('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xac2d('0x2')],'include':[{'model':'Interval','as':_0xac2d('0x3'),'attributes':['id',_0xac2d('0x2'),_0xac2d('0x4')]}]},'log':_0xac2d('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 9bf1392..5003641 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 _0x5bd2=['Request','UpdateMailInteraction','addTagsToChatInteraction','../client'];(function(_0x483047,_0x4258d0){var _0x137902=function(_0x184d49){while(--_0x184d49){_0x483047['push'](_0x483047['shift']());}};_0x137902(++_0x4258d0);}(_0x5bd2,0x143));var _0x25bd=function(_0x29f2f4,_0x53d522){_0x29f2f4=_0x29f2f4-0x0;var _0x35d3d5=_0x5bd2[_0x29f2f4];return _0x35d3d5;};'use strict';var client=require(_0x25bd('0x0'));exports['update']=function(_0x56abff,_0x15992e){return client[_0x25bd('0x1')](_0x25bd('0x2'),{'body':_0x15992e,'options':{'where':{'id':_0x56abff}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x3fd2b1,_0x51eff3){return client['Request']('AddTagsToMailInteraction',{'body':_0x51eff3,'options':{'where':{'id':_0x3fd2b1}},'log':_0x25bd('0x3')});}; \ No newline at end of file +var _0x0300=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0300,0x104));var _0x0030=function(_0x9ba5c6,_0x4b46f5){_0x9ba5c6=_0x9ba5c6-0x0;var _0x421d5a=_0x0300[_0x9ba5c6];return _0x421d5a;};'use strict';var client=require(_0x0030('0x0'));exports[_0x0030('0x1')]=function(_0x57f655,_0x456444){return client[_0x0030('0x2')](_0x0030('0x3'),{'body':_0x456444,'options':{'where':{'id':_0x57f655}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x5db253,_0x3c5894){return client['Request'](_0x0030('0x4'),{'body':_0x3c5894,'options':{'where':{'id':_0x5db253}},'log':_0x0030('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b441c41..1c5890d 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 _0x7e04=['CreateMailMessage','../client','create','Request'];(function(_0x5e11d6,_0x4b4d4c){var _0x11667e=function(_0x544ba0){while(--_0x544ba0){_0x5e11d6['push'](_0x5e11d6['shift']());}};_0x11667e(++_0x4b4d4c);}(_0x7e04,0x179));var _0x47e0=function(_0x2bcba1,_0x4ca700){_0x2bcba1=_0x2bcba1-0x0;var _0x318356=_0x7e04[_0x2bcba1];return _0x318356;};'use strict';var client=require(_0x47e0('0x0'));exports[_0x47e0('0x1')]=function(_0x1443f6){return client[_0x47e0('0x2')](_0x47e0('0x3'),{'body':_0x1443f6,'log':'createMailMessage'});}; \ No newline at end of file +var _0xea4c=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0xea4c,0x148));var _0xcea4=function(_0x292430,_0xc4bbd0){_0x292430=_0x292430-0x0;var _0xd596bf=_0xea4c[_0x292430];return _0xd596bf;};'use strict';var client=require(_0xcea4('0x0'));exports[_0xcea4('0x1')]=function(_0x145acc){return client[_0xcea4('0x2')](_0xcea4('0x3'),{'body':_0x145acc,'log':_0xcea4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 236e0ad..5224446 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 _0xb0e3=['User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x5b6a03,_0x111bc3){var _0x46cd77=function(_0x2683c7){while(--_0x2683c7){_0x5b6a03['push'](_0x5b6a03['shift']());}};_0x46cd77(++_0x111bc3);}(_0xb0e3,0x18a));var _0x3b0e=function(_0x1f94a3,_0x15a540){_0x1f94a3=_0x1f94a3-0x0;var _0x49e4a1=_0xb0e3[_0x1f94a3];return _0x49e4a1;};'use strict';var client=require(_0x3b0e('0x0'));exports[_0x3b0e('0x1')]=function(){return function(){return client[_0x3b0e('0x2')](_0x3b0e('0x3'),{'options':{'raw':![],'attributes':['id',_0x3b0e('0x4'),'timeout',_0x3b0e('0x5')],'include':[{'model':_0x3b0e('0x6'),'as':_0x3b0e('0x7'),'attributes':['id','name',_0x3b0e('0x8'),_0x3b0e('0x9')]}]},'log':_0x3b0e('0x1')});};}; \ No newline at end of file +var _0xb227=['name','online','mailPause','getMailQueues','../client','Request','timeout','strategy','User','Agents'];(function(_0x40b0b9,_0x59cd60){var _0x28e0e2=function(_0x2b75c6){while(--_0x2b75c6){_0x40b0b9['push'](_0x40b0b9['shift']());}};_0x28e0e2(++_0x59cd60);}(_0xb227,0x194));var _0x7b22=function(_0x1f802b,_0x3a8f37){_0x1f802b=_0x1f802b-0x0;var _0x3ce8cf=_0xb227[_0x1f802b];return _0x3ce8cf;};'use strict';var client=require(_0x7b22('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x7b22('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x7b22('0x2'),_0x7b22('0x3')],'include':[{'model':_0x7b22('0x4'),'as':_0x7b22('0x5'),'attributes':['id',_0x7b22('0x6'),_0x7b22('0x7'),_0x7b22('0x8')]}]},'log':_0x7b22('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 81199b9..cd6afab 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 _0x53fc=['DESC','../client','create','Request','update','UpdateMailQueueReport'];(function(_0x5920c9,_0x562f1e){var _0x1781de=function(_0x33cc8b){while(--_0x33cc8b){_0x5920c9['push'](_0x5920c9['shift']());}};_0x1781de(++_0x562f1e);}(_0x53fc,0x1b1));var _0xc53f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x53fc[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xc53f('0x0'));exports[_0xc53f('0x1')]=function(_0x290eee){return client[_0xc53f('0x2')]('CreateMailQueueReport',{'body':_0x290eee,'log':'CreateMailQueueReport'});};exports[_0xc53f('0x3')]=function(_0x4a5c24,_0x20e359){return client[_0xc53f('0x2')](_0xc53f('0x4'),{'body':_0x20e359,'options':{'where':{'uniqueid':_0x4a5c24},'order':[['id',_0xc53f('0x5')]],'limit':0x1},'log':_0xc53f('0x4')});}; \ No newline at end of file +var _0x1c80=['update','UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0x48653b,_0x4452f1){var _0x389d1f=function(_0x113b54){while(--_0x113b54){_0x48653b['push'](_0x48653b['shift']());}};_0x389d1f(++_0x4452f1);}(_0x1c80,0x188));var _0x01c8=function(_0x3c47cf,_0x352125){_0x3c47cf=_0x3c47cf-0x0;var _0x38372c=_0x1c80[_0x3c47cf];return _0x38372c;};'use strict';var client=require('../client');exports[_0x01c8('0x0')]=function(_0x58e5f5){return client[_0x01c8('0x1')](_0x01c8('0x2'),{'body':_0x58e5f5,'log':'CreateMailQueueReport'});};exports[_0x01c8('0x3')]=function(_0x40ed3b,_0x1eaaa6){return client[_0x01c8('0x1')](_0x01c8('0x4'),{'body':_0x1eaaa6,'options':{'where':{'uniqueid':_0x40ed3b},'order':[['id','DESC']],'limit':0x1},'log':_0x01c8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 4f3ade6..93a19fa 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 _0xcbb7=['addTags','AddTagsToOpenchannelInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0xcbb7,0x92));var _0x7cbb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcbb7[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x7cbb('0x0'));exports[_0x7cbb('0x1')]=function(_0x3a00f9,_0x20a7ad){return client['Request'](_0x7cbb('0x2'),{'body':_0x20a7ad,'options':{'where':{'id':_0x3a00f9}},'log':_0x7cbb('0x3')});};exports[_0x7cbb('0x4')]=function(_0x4b79e9,_0xc777cb){return client['Request'](_0x7cbb('0x5'),{'body':_0xc777cb,'options':{'where':{'id':_0x4b79e9}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe65b=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','Request'];(function(_0xae313c,_0x402e7b){var _0x507cc2=function(_0xdce4bb){while(--_0xdce4bb){_0xae313c['push'](_0xae313c['shift']());}};_0x507cc2(++_0x402e7b);}(_0xe65b,0x153));var _0xbe65=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe65b[_0x138adb];return _0x1b27f2;};'use strict';var client=require('../client');exports['update']=function(_0x2c64b7,_0x5023cb){return client[_0xbe65('0x0')]('UpdateOpenchannelInteraction',{'body':_0x5023cb,'options':{'where':{'id':_0x2c64b7}},'log':_0xbe65('0x1')});};exports[_0xbe65('0x2')]=function(_0x107d76,_0x1a2381){return client['Request'](_0xbe65('0x3'),{'body':_0x1a2381,'options':{'where':{'id':_0x107d76}},'log':_0xbe65('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b197e3a..a552dee 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 _0xedd9=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e4754,_0x630867){_0x5e4754=_0x5e4754-0x0;var _0x267ab7=_0xedd9[_0x5e4754];return _0x267ab7;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x3')});}; \ No newline at end of file +var _0x9a19=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x4036d4,_0x5994ab){var _0x3bc2a4=function(_0x4303f7){while(--_0x4303f7){_0x4036d4['push'](_0x4036d4['shift']());}};_0x3bc2a4(++_0x5994ab);}(_0x9a19,0x114));var _0x99a1=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x9a19[_0x2fee96];return _0x2e6ad1;};'use strict';var client=require(_0x99a1('0x0'));exports[_0x99a1('0x1')]=function(_0x3d860b){return client['Request'](_0x99a1('0x2'),{'body':_0x3d860b,'log':_0x99a1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d4f127f..3898c02 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 _0xd95c=['Request','GetOpenchannelQueue','timeout','strategy','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x206fc3,_0x251f21){var _0xea0c75=function(_0x34a9e2){while(--_0x34a9e2){_0x206fc3['push'](_0x206fc3['shift']());}};_0xea0c75(++_0x251f21);}(_0xd95c,0x1a7));var _0xcd95=function(_0x18f451,_0x2df3ba){_0x18f451=_0x18f451-0x0;var _0x58590a=_0xd95c[_0x18f451];return _0x58590a;};'use strict';var client=require('../client');exports[_0xcd95('0x0')]=function(){return function(){return client[_0xcd95('0x1')](_0xcd95('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xcd95('0x3'),_0xcd95('0x4')],'include':[{'model':'User','as':_0xcd95('0x5'),'attributes':['id','name',_0xcd95('0x6'),_0xcd95('0x7')]}]},'log':_0xcd95('0x0')});};}; \ No newline at end of file +var _0x0f7a=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x0f7a,0x1af));var _0xa0f7=function(_0x40b972,_0x5d6fc5){_0x40b972=_0x40b972-0x0;var _0xfe2e93=_0x0f7a[_0x40b972];return _0xfe2e93;};'use strict';var client=require(_0xa0f7('0x0'));exports[_0xa0f7('0x1')]=function(){return function(){return client[_0xa0f7('0x2')](_0xa0f7('0x3'),{'options':{'raw':![],'attributes':['id',_0xa0f7('0x4'),_0xa0f7('0x5'),_0xa0f7('0x6')],'include':[{'model':_0xa0f7('0x7'),'as':_0xa0f7('0x8'),'attributes':['id',_0xa0f7('0x4'),'online',_0xa0f7('0x9')]}]},'log':_0xa0f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c6d9a59..98cfffb 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 _0x8f70=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x36addf,_0x55bc84){var _0x50f6aa=function(_0x56891e){while(--_0x56891e){_0x36addf['push'](_0x36addf['shift']());}};_0x50f6aa(++_0x55bc84);}(_0x8f70,0x120));var _0x08f7=function(_0x304a17,_0x2406c4){_0x304a17=_0x304a17-0x0;var _0x184d43=_0x8f70[_0x304a17];return _0x184d43;};'use strict';var client=require('../client');exports['create']=function(_0x59d0b7){return client['Request'](_0x08f7('0x0'),{'body':_0x59d0b7,'log':'CreateOpenchannelQueueReport'});};exports[_0x08f7('0x1')]=function(_0x5571af,_0x129421){return client['Request'](_0x08f7('0x2'),{'body':_0x129421,'options':{'where':{'uniqueid':_0x5571af},'order':[['id',_0x08f7('0x3')]],'limit':0x1},'log':_0x08f7('0x2')});}; \ No newline at end of file +var _0x22c5=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create','Request'];(function(_0x5865bf,_0x5a9030){var _0x11da0a=function(_0x532bb7){while(--_0x532bb7){_0x5865bf['push'](_0x5865bf['shift']());}};_0x11da0a(++_0x5a9030);}(_0x22c5,0x18a));var _0x522c=function(_0x84b7a7,_0x31ba92){_0x84b7a7=_0x84b7a7-0x0;var _0x5dfb9a=_0x22c5[_0x84b7a7];return _0x5dfb9a;};'use strict';var client=require('../client');exports[_0x522c('0x0')]=function(_0x9f18cd){return client[_0x522c('0x1')](_0x522c('0x2'),{'body':_0x9f18cd,'log':_0x522c('0x2')});};exports[_0x522c('0x3')]=function(_0x23e14e,_0x2997d1){return client[_0x522c('0x1')](_0x522c('0x4'),{'body':_0x2997d1,'options':{'where':{'uniqueid':_0x23e14e},'order':[['id',_0x522c('0x5')]],'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 5d20d85..fd07e9d 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 _0x7af0=['addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','Request'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x7af0,0x139));var _0x07af=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x7af0[_0x28aea5];return _0x6a55f9;};'use strict';var client=require(_0x07af('0x0'));exports[_0x07af('0x1')]=function(_0x4f95a9,_0x47f263){return client['Request'](_0x07af('0x2'),{'body':_0x47f263,'options':{'where':{'id':_0x4f95a9}},'log':_0x07af('0x3')});};exports['addTags']=function(_0x1ea2d1,_0xd79a24){return client[_0x07af('0x4')]('AddTagsToSmsInteraction',{'body':_0xd79a24,'options':{'where':{'id':_0x1ea2d1}},'log':_0x07af('0x5')});}; \ No newline at end of file +var _0x92ea=['../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0x92ea,0xcc));var _0xa92e=function(_0x1e6492,_0x4e0586){_0x1e6492=_0x1e6492-0x0;var _0xc0a494=_0x92ea[_0x1e6492];return _0xc0a494;};'use strict';var client=require(_0xa92e('0x0'));exports['update']=function(_0x1eb0dd,_0x24f9ad){return client[_0xa92e('0x1')](_0xa92e('0x2'),{'body':_0x24f9ad,'options':{'where':{'id':_0x1eb0dd}},'log':_0xa92e('0x3')});};exports['addTags']=function(_0x3c5868,_0x134cf6){return client[_0xa92e('0x1')]('AddTagsToSmsInteraction',{'body':_0x134cf6,'options':{'where':{'id':_0x3c5868}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7d6d9e9..d4acebc 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 _0x1ef5=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x5aabcb,_0x219fbd){var _0x4b6e71=function(_0x1546ee){while(--_0x1546ee){_0x5aabcb['push'](_0x5aabcb['shift']());}};_0x4b6e71(++_0x219fbd);}(_0x1ef5,0x18b));var _0x51ef=function(_0x479dd8,_0x4e3ab8){_0x479dd8=_0x479dd8-0x0;var _0x1f8d28=_0x1ef5[_0x479dd8];return _0x1f8d28;};'use strict';var client=require(_0x51ef('0x0'));exports[_0x51ef('0x1')]=function(_0x8b6b11){return client[_0x51ef('0x2')](_0x51ef('0x3'),{'body':_0x8b6b11,'log':_0x51ef('0x4')});}; \ No newline at end of file +var _0xb425=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x160c54,_0x40018d){var _0x548899=function(_0x5b5558){while(--_0x5b5558){_0x160c54['push'](_0x160c54['shift']());}};_0x548899(++_0x40018d);}(_0xb425,0x1ed));var _0x5b42=function(_0x537c11,_0x34f837){_0x537c11=_0x537c11-0x0;var _0x16dbed=_0xb425[_0x537c11];return _0x16dbed;};'use strict';var client=require('../client');exports[_0x5b42('0x0')]=function(_0x37abef){return client[_0x5b42('0x1')](_0x5b42('0x2'),{'body':_0x37abef,'log':_0x5b42('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c99c170..fe5b5ef 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 _0x5344=['name','strategy','User','getSmsQueues','Request','GetSmsQueue'];(function(_0x225815,_0x5db310){var _0x47a32e=function(_0xafe283){while(--_0xafe283){_0x225815['push'](_0x225815['shift']());}};_0x47a32e(++_0x5db310);}(_0x5344,0x6f));var _0x4534=function(_0xa5039e,_0x5a12bb){_0xa5039e=_0xa5039e-0x0;var _0x13ddab=_0x5344[_0xa5039e];return _0x13ddab;};'use strict';var client=require('../client');exports[_0x4534('0x0')]=function(){return function(){return client[_0x4534('0x1')](_0x4534('0x2'),{'options':{'raw':![],'attributes':['id',_0x4534('0x3'),'timeout',_0x4534('0x4')],'include':[{'model':_0x4534('0x5'),'as':'Agents','attributes':['id',_0x4534('0x3'),'online','smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xf6ea=['timeout','strategy','User','Agents','../client','getSmsQueues','Request','name'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0xf6ea,0x14c));var _0xaf6e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xf6ea[_0x465028];return _0xb783d4;};'use strict';var client=require(_0xaf6e('0x0'));exports[_0xaf6e('0x1')]=function(){return function(){return client[_0xaf6e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xaf6e('0x3'),_0xaf6e('0x4'),_0xaf6e('0x5')],'include':[{'model':_0xaf6e('0x6'),'as':_0xaf6e('0x7'),'attributes':['id',_0xaf6e('0x3'),'online','smsPause']}]},'log':_0xaf6e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 57dfb8d..86edc56 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 _0xa962=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x14570f,_0x4ed40d){var _0x317c34=function(_0x145a1a){while(--_0x145a1a){_0x14570f['push'](_0x14570f['shift']());}};_0x317c34(++_0x4ed40d);}(_0xa962,0xea));var _0x2a96=function(_0x468ecf,_0x4eabcc){_0x468ecf=_0x468ecf-0x0;var _0x157b14=_0xa962[_0x468ecf];return _0x157b14;};'use strict';var client=require(_0x2a96('0x0'));exports[_0x2a96('0x1')]=function(_0x5127b1){return client[_0x2a96('0x2')](_0x2a96('0x3'),{'body':_0x5127b1,'log':_0x2a96('0x3')});};exports[_0x2a96('0x4')]=function(_0x557ef5,_0x34bcff){return client[_0x2a96('0x2')](_0x2a96('0x5'),{'body':_0x34bcff,'options':{'where':{'uniqueid':_0x557ef5},'order':[['id','DESC']],'limit':0x1},'log':_0x2a96('0x5')});}; \ No newline at end of file +var _0x1691=['UpdateSmsQueueReport','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x1bcd7b,_0x27727e){var _0x285448=function(_0x23791a){while(--_0x23791a){_0x1bcd7b['push'](_0x1bcd7b['shift']());}};_0x285448(++_0x27727e);}(_0x1691,0x1ed));var _0x1169=function(_0x4c731a,_0x51977d){_0x4c731a=_0x4c731a-0x0;var _0x2109f1=_0x1691[_0x4c731a];return _0x2109f1;};'use strict';var client=require(_0x1169('0x0'));exports[_0x1169('0x1')]=function(_0x4d91d2){return client[_0x1169('0x2')](_0x1169('0x3'),{'body':_0x4d91d2,'log':_0x1169('0x3')});};exports[_0x1169('0x4')]=function(_0x3f3684,_0xe879ee){return client[_0x1169('0x2')](_0x1169('0x5'),{'body':_0xe879ee,'options':{'where':{'uniqueid':_0x3f3684},'order':[['id','DESC']],'limit':0x1},'log':_0x1169('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 28ec717..90240f0 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 _0x638f=['chatCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','Request','agent','name','online','lastPauseAt','voicePause','mailPause','faxPause','smsPause','openchannelPause'];(function(_0x59958a,_0x322ee0){var _0x4a2c8c=function(_0x547141){while(--_0x547141){_0x59958a['push'](_0x59958a['shift']());}};_0x4a2c8c(++_0x322ee0);}(_0x638f,0x13f));var _0xf638=function(_0x4cdebe,_0x60c1be){_0x4cdebe=_0x4cdebe-0x0;var _0x827148=_0x638f[_0x4cdebe];return _0x827148;};'use strict';var client=require(_0xf638('0x0'));exports['getAgents']=function(){return function(){return client[_0xf638('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xf638('0x2')},'attributes':['id',_0xf638('0x3'),_0xf638('0x4'),'pauseType',_0xf638('0x5'),_0xf638('0x6'),'chatPause',_0xf638('0x7'),_0xf638('0x8'),_0xf638('0x9'),_0xf638('0xa'),_0xf638('0xb'),'mailCapacity',_0xf638('0xc'),_0xf638('0xd'),_0xf638('0xe')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x1af3=['voicePause','chatPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','getAgents','../client','GetUser','agent','name','online'];(function(_0x4be2a2,_0xa936a2){var _0x55ac6d=function(_0x496e26){while(--_0x496e26){_0x4be2a2['push'](_0x4be2a2['shift']());}};_0x55ac6d(++_0xa936a2);}(_0x1af3,0x1ea));var _0x31af=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1af3[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x31af('0x0'));exports['getAgents']=function(){return function(){return client['Request'](_0x31af('0x1'),{'options':{'raw':!![],'where':{'role':_0x31af('0x2')},'attributes':['id',_0x31af('0x3'),_0x31af('0x4'),'pauseType','lastPauseAt',_0x31af('0x5'),_0x31af('0x6'),'mailPause','faxPause',_0x31af('0x7'),_0x31af('0x8'),_0x31af('0x9'),_0x31af('0xa'),_0x31af('0xb'),_0x31af('0xc'),_0x31af('0xd')]},'log':_0x31af('0xe')});};}; \ 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 a8d0ecf..7621607 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 _0xb10b=['[%s][QUEUE]\x20%s','stringify','validate','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','createQueue','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f1699,_0x13be45){_0x5f1699=_0x5f1699-0x0;var _0x62c71f=_0xb10b[_0x5f1699];return _0x62c71f;};'use strict';var schema=require(_0xbb10('0x0'));var _=require('lodash');var util=require(_0xbb10('0x1'));var seqqueue=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('routing');var strategy=require(_0xbb10('0x4'));var queue=schema({'name':{'type':_0xbb10('0x5'),'required':!![],'message':_0xbb10('0x6')},'timeout':{'type':_0xbb10('0x7'),'message':_0xbb10('0x8')}});function writeLog(_0x312b72,_0x481979,_0x328583){return logger[_0xbb10('0x9')](util['format'](_0xbb10('0xa'),_0x312b72,_0x481979[_0xbb10('0xb')],_0x328583));}function handleFindAgent(_0x21370f){return function(_0x1c3ee5){return _0x1c3ee5[_0xbb10('0xb')][_0xbb10('0xc')]()===_0x21370f[_0xbb10('0xc')]();};}exports[_0xbb10('0xd')]=function(_0x5ab04a,_0x4e47f8,_0x20bd61,_0x118a74){return function(_0xce64f3){try{var _0x5e136d={'name':_0x4e47f8[0x0],'timeout':_0x4e47f8[0x1]};var _0x408248=queue['validate'](_0x5e136d,{'typecast':!![]});if(_0x408248[_0xbb10('0xe')]){logger[_0xbb10('0xf')](_0xbb10('0x10'),_0x5ab04a,_[_0xbb10('0x11')](_0x408248,_0xbb10('0x12'))[_0xbb10('0x13')](',\x20'));_0xce64f3['stop']();}else{var _0x26e021=_[_0xbb10('0x14')](_0x20bd61[_0xbb10('0x15')],handleFindAgent(_0x5e136d[_0xbb10('0xb')]));if(_0x26e021){var _0x3df17b=(_0x5e136d[_0xbb10('0x16')]||0xa)*0x3e8;var _0x24a57b,_0x36b5e8;var _0x3e26f4=seqqueue[_0xbb10('0x17')](_0x3df17b);_0x3e26f4['id']=_0x5ab04a;_0x3e26f4['atimeout']=_0x3df17b;_0x3e26f4[_0xbb10('0x18')]=_0x118a74[_0xbb10('0x18')];writeLog(_0x5ab04a,_0x26e021,util[_0xbb10('0x19')](_0xbb10('0x1a'),_0x3df17b));_0x24a57b=setInterval(function(){if(_0x20bd61[_0xbb10('0x1b')]&&!_0x20bd61[_0xbb10('0x1b')][_0x5ab04a]){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x5ab04a);clearInterval(_0x24a57b);clearTimeout(_0x36b5e8);_0x36b5e8=undefined;_0x3e26f4[_0xbb10('0x1d')](!![]);_0xce64f3[_0xbb10('0x1e')]();}},0x3e8);_0x36b5e8=setTimeout(function(){logger['info'](_0xbb10('0x1f'),_0x5ab04a);clearInterval(_0x24a57b);_0x24a57b=undefined;_0x3e26f4[_0xbb10('0x1d')](!![]);_0xce64f3[_0xbb10('0x20')]();},_0x3df17b);strategy[_0xbb10('0x21')](_0x3e26f4,_0x26e021,_0x20bd61,_0x118a74);}else{logger[_0xbb10('0xf')](_0xbb10('0x22'),_0x5ab04a,_0x5e136d['name']);_0xce64f3[_0xbb10('0x1e')]();}}}catch(_0x12ef77){console['log'](_0x12ef77);logger['error'](_0xbb10('0x23'),_0x5ab04a,JSON[_0xbb10('0x24')](_0x12ef77));_0xce64f3[_0xbb10('0x1e')]();}};}; \ No newline at end of file +var _0xb10b=['[%s][QUEUE]\x20%s','stringify','validate','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','createQueue','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0xb10b,0x12a));var _0xbb10=function(_0x34b64f,_0x2cbd48){_0x34b64f=_0x34b64f-0x0;var _0x40c2c7=_0xb10b[_0x34b64f];return _0x40c2c7;};'use strict';var schema=require(_0xbb10('0x0'));var _=require('lodash');var util=require(_0xbb10('0x1'));var seqqueue=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('routing');var strategy=require(_0xbb10('0x4'));var queue=schema({'name':{'type':_0xbb10('0x5'),'required':!![],'message':_0xbb10('0x6')},'timeout':{'type':_0xbb10('0x7'),'message':_0xbb10('0x8')}});function writeLog(_0x312b72,_0x481979,_0x328583){return logger[_0xbb10('0x9')](util['format'](_0xbb10('0xa'),_0x312b72,_0x481979[_0xbb10('0xb')],_0x328583));}function handleFindAgent(_0x21370f){return function(_0x1c3ee5){return _0x1c3ee5[_0xbb10('0xb')][_0xbb10('0xc')]()===_0x21370f[_0xbb10('0xc')]();};}exports[_0xbb10('0xd')]=function(_0x5ab04a,_0x4e47f8,_0x20bd61,_0x118a74){return function(_0xce64f3){try{var _0x5e136d={'name':_0x4e47f8[0x0],'timeout':_0x4e47f8[0x1]};var _0x408248=queue['validate'](_0x5e136d,{'typecast':!![]});if(_0x408248[_0xbb10('0xe')]){logger[_0xbb10('0xf')](_0xbb10('0x10'),_0x5ab04a,_[_0xbb10('0x11')](_0x408248,_0xbb10('0x12'))[_0xbb10('0x13')](',\x20'));_0xce64f3['stop']();}else{var _0x26e021=_[_0xbb10('0x14')](_0x20bd61[_0xbb10('0x15')],handleFindAgent(_0x5e136d[_0xbb10('0xb')]));if(_0x26e021){var _0x3df17b=(_0x5e136d[_0xbb10('0x16')]||0xa)*0x3e8;var _0x24a57b,_0x36b5e8;var _0x3e26f4=seqqueue[_0xbb10('0x17')](_0x3df17b);_0x3e26f4['id']=_0x5ab04a;_0x3e26f4['atimeout']=_0x3df17b;_0x3e26f4[_0xbb10('0x18')]=_0x118a74[_0xbb10('0x18')];writeLog(_0x5ab04a,_0x26e021,util[_0xbb10('0x19')](_0xbb10('0x1a'),_0x3df17b));_0x24a57b=setInterval(function(){if(_0x20bd61[_0xbb10('0x1b')]&&!_0x20bd61[_0xbb10('0x1b')][_0x5ab04a]){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x5ab04a);clearInterval(_0x24a57b);clearTimeout(_0x36b5e8);_0x36b5e8=undefined;_0x3e26f4[_0xbb10('0x1d')](!![]);_0xce64f3[_0xbb10('0x1e')]();}},0x3e8);_0x36b5e8=setTimeout(function(){logger['info'](_0xbb10('0x1f'),_0x5ab04a);clearInterval(_0x24a57b);_0x24a57b=undefined;_0x3e26f4[_0xbb10('0x1d')](!![]);_0xce64f3[_0xbb10('0x20')]();},_0x3df17b);strategy[_0xbb10('0x21')](_0x3e26f4,_0x26e021,_0x20bd61,_0x118a74);}else{logger[_0xbb10('0xf')](_0xbb10('0x22'),_0x5ab04a,_0x5e136d['name']);_0xce64f3[_0xbb10('0x1e')]();}}}catch(_0x12ef77){console['log'](_0x12ef77);logger['error'](_0xbb10('0x23'),_0x5ab04a,JSON[_0xbb10('0x24')](_0x12ef77));_0xce64f3[_0xbb10('0x1e')]();}};}; \ 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 69d67c6..be3bea6 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 _0xd8b0=['upperFirst','AccountId','InteractionId','Message','service','Smtp','host','port','secure','pass','html','replace','','messageId','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account'];(function(_0x154906,_0x429a62){var _0x63d91a=function(_0x27d5e0){while(--_0x27d5e0){_0x154906['push'](_0x154906['shift']());}};_0x63d91a(++_0x429a62);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x0d8b('0x2')),'openchannelMessage':require(_0x0d8b('0x3')),'mailMessage':require(_0x0d8b('0x4')),'smsMessage':require(_0x0d8b('0x5')),'faxMessage':require(_0x0d8b('0x6'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3f8b6f,_0x227c63){return function(_0x39f43a){try{if(_0x227c63[0x0]==='1'&&(_['isNil'](this[_0x0d8b('0x7')][_0x0d8b('0x8')])||!this['interaction'][_0x0d8b('0x8')])){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,_0x0d8b('0xb'));return _0x39f43a[_0x0d8b('0xc')]();}var _0x1cac62=this[_0x0d8b('0xd')];var _0x28f87c={'body':utils['getMustacheRender'](_0x227c63[0x1],this),'ContactId':this[_0x0d8b('0xe')]['id'],'sentAt':moment()['format'](_0x0d8b('0xf')),'direction':_0x0d8b('0x10')};if(this[_0x0d8b('0x11')]){_0x28f87c['to']=this[_0x0d8b('0x11')][_0x0d8b('0x12')]||'';_0x28f87c['cc']=this[_0x0d8b('0x11')]['cc']||'';_0x28f87c[_0x0d8b('0x12')]=this[_0x0d8b('0x11')]['to']||'';_0x28f87c[_0x0d8b('0x13')]=this[_0x0d8b('0x11')][_0x0d8b('0x13')]||'';_0x28f87c[_0x0d8b('0x14')]=!![];if(this[_0x0d8b('0x11')][_0x0d8b('0x15')]){_0x28f87c['subject']='';_0x28f87c[_0x0d8b('0x15')]+=_[_0x0d8b('0x16')](this[_0x0d8b('0x11')][_0x0d8b('0x15')],_0x0d8b('0x17'))?'':'Re:\x20';_0x28f87c[_0x0d8b('0x15')]+=this[_0x0d8b('0x11')][_0x0d8b('0x15')];}}if(this[_0x0d8b('0xd')]===_0x0d8b('0x18')){_0x28f87c[_0x0d8b('0x19')]=this[_0x0d8b('0x1a')]['id'];}else{_0x28f87c[_[_0x0d8b('0x1b')](this['channel'])+_0x0d8b('0x1c')]=this[_0x0d8b('0x1a')]['id'];}_0x28f87c[_[_0x0d8b('0x1b')](this[_0x0d8b('0xd')])+_0x0d8b('0x1d')]=this[_0x0d8b('0x7')]['id'];if(rpc[this[_0x0d8b('0xd')]+_0x0d8b('0x1e')]){if(this['channel']==='mail'){var _0x33fb87={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x33fb87[_0x0d8b('0x1f')]=this[_0x0d8b('0x1a')][_0x0d8b('0x20')][_0x0d8b('0x1f')];}else{_0x33fb87[_0x0d8b('0x21')]=this[_0x0d8b('0x1a')][_0x0d8b('0x20')][_0x0d8b('0x21')];_0x33fb87[_0x0d8b('0x22')]=this['account'][_0x0d8b('0x20')][_0x0d8b('0x22')];_0x33fb87['secure']=this[_0x0d8b('0x1a')]['Smtp'][_0x0d8b('0x23')];}if(this[_0x0d8b('0x1a')][_0x0d8b('0x20')]['authentication']){_0x33fb87['auth']={'user':this[_0x0d8b('0x1a')][_0x0d8b('0x20')]['user'],'pass':this[_0x0d8b('0x1a')]['Smtp'][_0x0d8b('0x24')]};}_0x28f87c['inReplyTo']=this[_0x0d8b('0x11')]['messageId'];_0x28f87c[_0x0d8b('0x25')]=''+_[_0x0d8b('0x26')](_0x28f87c['body'],_0x0d8b('0x27'),_0x0d8b('0x28'))+_0x0d8b('0x29');return mailRpc['sendMailMessage'](_0x33fb87,_0x28f87c)['then'](function(_0x51cf32){logger[_0x0d8b('0x9')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3f8b6f);_0x28f87c[_0x0d8b('0x2a')]=_0x51cf32['message']['messageId'];return rpc[_0x1cac62+_0x0d8b('0x1e')][_0x0d8b('0x2b')](_0x28f87c);})[_0x0d8b('0x2c')](function(_0xdeee5d){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0xdeee5d));})[_0x0d8b('0x2e')](function(_0x553e03){logger[_0x0d8b('0x2f')](_0x0d8b('0x30'),_0x3f8b6f,JSON['stringify'](_0x553e03));})[_0x0d8b('0x31')](function(){_0x39f43a[_0x0d8b('0xc')]();});}else{return rpc[this[_0x0d8b('0xd')]+'Message'][_0x0d8b('0x2b')](_0x28f87c)[_0x0d8b('0x2c')](function(_0x206157){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,_0x28f87c['body']);})[_0x0d8b('0x2e')](function(_0x1649fc){logger['error'](_0x0d8b('0xa'),_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0x1649fc));})[_0x0d8b('0x31')](function(){_0x39f43a[_0x0d8b('0xc')]();});}}}catch(_0x373544){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0x373544));_0x39f43a['stop']();}};}; \ No newline at end of file +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(_0x34245b,_0xa0a883){var _0x44ae46=function(_0x366835){while(--_0x366835){_0x34245b['push'](_0x34245b['shift']());}};_0x44ae46(++_0xa0a883);}(_0x70e0,0x17b));var _0x070e=function(_0x393f21,_0x1c1868){_0x393f21=_0x393f21-0x0;var _0x22d7b4=_0x70e0[_0x393f21];return _0x22d7b4;};'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'],']+(>|$)/g,''),'priorityTrue':_0x38267c[0x1],'priorityFalse':_0x38267c[0x2]};var _0x3ad8b5=gotoif[_0xafae('0x0')](_0x4c82be,{'typecast':!![]});if(_0x3ad8b5[_0xafae('0xb')]){logger[_0xafae('0xc')](_0xafae('0xd'),_0x3ff3f8,_['map'](_0x3ad8b5,_0xafae('0xe'))[_0xafae('0xf')](',\x20'));_0x5d23de[_0xafae('0x10')]();}else{try{var _0x3ebc98=eval('('+_0x4c82be[_0xafae('0x11')]+')');var _0x4082de=_0x3ebc98?_0x4c82be[_0xafae('0x12')]:_0x4c82be[_0xafae('0x13')];logger[_0xafae('0x14')](_0xafae('0x15'),_0x3ff3f8,_0x4c82be[_0xafae('0x11')],_0x3ebc98,_0x4082de||_0xafae('0x16'));if(_0x4082de){var _0x4a1e8d=_['findIndex'](_0x5d23de[_0xafae('0x17')](),{'p':_0x4082de});if(_0x4a1e8d>=0x0){logger['info'](_0xafae('0x18'),_0x3ff3f8,_0x4082de||_0xafae('0x16'),_0x4a1e8d);_0x5d23de[_0xafae('0x16')](_0x4a1e8d);}else{logger[_0xafae('0x14')](_0xafae('0x19'),_0x3ff3f8,_0x4082de||_0xafae('0x16'));_0x5d23de[_0xafae('0x10')]();}}else{_0x5d23de[_0xafae('0x16')]();}}catch(_0x21559c){logger[_0xafae('0xc')](_0xafae('0x1a'),_0x3ff3f8,_0x21559c[_0xafae('0xe')]);_0x5d23de[_0xafae('0x10')]();}}}catch(_0x559ba3){logger[_0xafae('0xc')](_0xafae('0xd'),_0x3ff3f8,JSON[_0xafae('0x1b')](_0x559ba3));_0x5d23de[_0xafae('0x10')]();}};}; \ No newline at end of file +var _0x3688=['priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3688,0x19c));var _0x8368=function(_0x3f9833,_0x1bec74){_0x3f9833=_0x3f9833-0x0;var _0xdb9fc7=_0x3688[_0x3f9833];return _0xdb9fc7;};'use strict';var schema=require(_0x8368('0x0'));var _=require(_0x8368('0x1'));var htmlToText=require(_0x8368('0x2'));var utils=require(_0x8368('0x3'));var logger=require(_0x8368('0x4'))(_0x8368('0x5'));var gotoif=schema({'condition':{'type':_0x8368('0x6'),'required':!![],'message':_0x8368('0x7')},'priorityTrue':{'type':_0x8368('0x8'),'message':_0x8368('0x9')},'priorityFalse':{'type':_0x8368('0x8'),'message':_0x8368('0xa')}});exports[_0x8368('0xb')]=function(_0x2c653a,_0x46e423){return function(_0x46cd0d){try{var _0x2ea278={'condition':htmlToText[_0x8368('0xc')](utils[_0x8368('0xd')](_0x46e423[0x0],this),{'wordwrap':![]})[_0x8368('0xe')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x46e423[0x1],'priorityFalse':_0x46e423[0x2]};var _0x434bcb=gotoif[_0x8368('0x0')](_0x2ea278,{'typecast':!![]});if(_0x434bcb[_0x8368('0xf')]){logger[_0x8368('0x10')](_0x8368('0x11'),_0x2c653a,_[_0x8368('0x12')](_0x434bcb,'message')[_0x8368('0x13')](',\x20'));_0x46cd0d[_0x8368('0x14')]();}else{try{var _0x43ce08=eval('('+_0x2ea278[_0x8368('0x15')]+')');var _0x2800da=_0x43ce08?_0x2ea278['priorityTrue']:_0x2ea278[_0x8368('0x16')];logger[_0x8368('0x17')](_0x8368('0x18'),_0x2c653a,_0x2ea278[_0x8368('0x15')],_0x43ce08,_0x2800da||_0x8368('0x19'));if(_0x2800da){var _0x357a57=_['findIndex'](_0x46cd0d['rules'](),{'p':_0x2800da});if(_0x357a57>=0x0){logger['info'](_0x8368('0x1a'),_0x2c653a,_0x2800da||_0x8368('0x19'),_0x357a57);_0x46cd0d[_0x8368('0x19')](_0x357a57);}else{logger[_0x8368('0x17')](_0x8368('0x1b'),_0x2c653a,_0x2800da||_0x8368('0x19'));_0x46cd0d[_0x8368('0x14')]();}}else{_0x46cd0d[_0x8368('0x19')]();}}catch(_0xb07ed9){logger[_0x8368('0x10')](_0x8368('0x1c'),_0x2c653a,_0xb07ed9[_0x8368('0x1d')]);_0x46cd0d[_0x8368('0x14')]();}}}catch(_0x5d02c8){logger[_0x8368('0x10')](_0x8368('0x11'),_0x2c653a,JSON[_0x8368('0x1e')](_0x5d02c8));_0x46cd0d[_0x8368('0x14')]();}};}; \ 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 f4907fd..67343e5 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 _0x5a7c=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','join','stop'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5a7c,0xbd));var _0xc5a7=function(_0x222a9b,_0x14513c){_0x222a9b=_0x222a9b-0x0;var _0x48d0b3=_0x5a7c[_0x222a9b];return _0x48d0b3;};'use strict';var schema=require(_0xc5a7('0x0'));var _=require(_0xc5a7('0x1'));var logger=require(_0xc5a7('0x2'))(_0xc5a7('0x3'));var gotop=schema({'priority':{'type':_0xc5a7('0x4'),'required':!![],'message':_0xc5a7('0x5')}});exports[_0xc5a7('0x6')]=function(_0x104d6c,_0x3b0c6d){return function(_0x4f9165){try{var _0x9e31aa={'priority':_0x3b0c6d[0x0]};var _0x4973da=gotop['validate'](_0x9e31aa,{'typecast':!![]});if(_0x4973da[_0xc5a7('0x7')]){logger['error'](_0xc5a7('0x8'),_0x104d6c,_['map'](_0x4973da,'message')[_0xc5a7('0x9')](',\x20'));_0x4f9165[_0xc5a7('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x104d6c,_0x9e31aa[_0xc5a7('0xb')]);if(_0x9e31aa[_0xc5a7('0xb')]){var _0x145f3a=_[_0xc5a7('0xc')](_0x4f9165[_0xc5a7('0xd')](),{'p':_0x9e31aa['priority']});if(_0x145f3a>=0x0){logger['info'](_0xc5a7('0xe'),_0x104d6c,_0x9e31aa[_0xc5a7('0xb')]||_0xc5a7('0xf'),_0x145f3a);_0x4f9165['next'](_0x145f3a);}else{logger[_0xc5a7('0x10')](_0xc5a7('0x11'),_0x104d6c,_0x9e31aa['priority']||_0xc5a7('0xf'));_0x4f9165['stop']();}}else{_0x4f9165['next']();}}}catch(_0x3d8283){logger[_0xc5a7('0x12')](_0xc5a7('0x8'),_0x104d6c,JSON[_0xc5a7('0x13')](_0x3d8283));_0x4f9165[_0xc5a7('0xa')]();}};}; \ No newline at end of file +var _0xf706=['map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s'];(function(_0x25cd2c,_0x57498e){var _0x1e364c=function(_0x35ac2e){while(--_0x35ac2e){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x1e364c(++_0x57498e);}(_0xf706,0x12b));var _0x6f70=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xf706[_0x277107];return _0x1da046;};'use strict';var schema=require(_0x6f70('0x0'));var _=require(_0x6f70('0x1'));var logger=require(_0x6f70('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x6f70('0x3')}});exports['consequence']=function(_0x15e849,_0x4d739b){return function(_0x15c243){try{var _0x47368a={'priority':_0x4d739b[0x0]};var _0x62b19d=gotop[_0x6f70('0x0')](_0x47368a,{'typecast':!![]});if(_0x62b19d[_0x6f70('0x4')]){logger[_0x6f70('0x5')](_0x6f70('0x6'),_0x15e849,_[_0x6f70('0x7')](_0x62b19d,_0x6f70('0x8'))['join'](',\x20'));_0x15c243[_0x6f70('0x9')]();}else{logger[_0x6f70('0xa')](_0x6f70('0xb'),_0x15e849,_0x47368a[_0x6f70('0xc')]);if(_0x47368a['priority']){var _0x47ae4a=_['findIndex'](_0x15c243[_0x6f70('0xd')](),{'p':_0x47368a[_0x6f70('0xc')]});if(_0x47ae4a>=0x0){logger[_0x6f70('0xa')](_0x6f70('0xe'),_0x15e849,_0x47368a[_0x6f70('0xc')]||'next',_0x47ae4a);_0x15c243[_0x6f70('0xf')](_0x47ae4a);}else{logger[_0x6f70('0xa')](_0x6f70('0x10'),_0x15e849,_0x47368a[_0x6f70('0xc')]||_0x6f70('0xf'));_0x15c243[_0x6f70('0x9')]();}}else{_0x15c243[_0x6f70('0xf')]();}}}catch(_0x5f29c6){logger[_0x6f70('0x5')](_0x6f70('0x6'),_0x15e849,JSON[_0x6f70('0x11')](_0x5f29c6));_0x15c243[_0x6f70('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index f33585a..947d9ec 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 _0xcede=['error','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x13f11b,_0x54e553){var _0x482f1f=function(_0x39f3c3){while(--_0x39f3c3){_0x13f11b['push'](_0x13f11b['shift']());}};_0x482f1f(++_0x54e553);}(_0xcede,0x1bd));var _0xeced=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcede[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xeced('0x0'));var utils=require('./utils');var logger=require(_0xeced('0x1'))('routing');var rpc={'chatMessage':require(_0xeced('0x2')),'openchannelMessage':require(_0xeced('0x3')),'mailMessage':require(_0xeced('0x4')),'smsMessage':require(_0xeced('0x5')),'faxMessage':require('../../rpc/faxMessage')};exports[_0xeced('0x6')]=function(_0x280887,_0x13819c){return function(_0x2d23cf){try{var _0x37473b={'body':utils[_0xeced('0x7')](_0x13819c[0x0],this),'ContactId':this[_0xeced('0x8')]['id']};if(this[_0xeced('0x9')]===_0xeced('0xa')){_0x37473b[_0xeced('0xb')]=this['account']['id'];}else{_0x37473b[_[_0xeced('0xc')](this[_0xeced('0x9')])+_0xeced('0xd')]=this['account']['id'];}_0x37473b[_[_0xeced('0xc')](this[_0xeced('0x9')])+'InteractionId']=this[_0xeced('0xe')]['id'];if(rpc[this['channel']+_0xeced('0xf')]){return rpc[this[_0xeced('0x9')]+_0xeced('0xf')][_0xeced('0x10')](_0x37473b)[_0xeced('0x11')](function(_0x42b7fe){logger[_0xeced('0x12')](_0xeced('0x13'),_0x280887,_0x37473b[_0xeced('0x14')]);_0x2d23cf[_0xeced('0x15')]();})[_0xeced('0x16')](function(_0x4d23ba){logger[_0xeced('0x17')](_0xeced('0x13'),_0x280887,JSON[_0xeced('0x18')](_0x4d23ba));_0x2d23cf[_0xeced('0x19')]();});}}catch(_0x39d75d){logger['error'](_0xeced('0x13'),_0x280887,JSON[_0xeced('0x18')](_0x39d75d));_0x2d23cf['stop']();}};}; \ No newline at end of file +var _0x3dba=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','contact','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x2cec07,_0x560e96){var _0xb56292=function(_0x4b5d02){while(--_0x4b5d02){_0x2cec07['push'](_0x2cec07['shift']());}};_0xb56292(++_0x560e96);}(_0x3dba,0x86));var _0xa3db=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x3dba[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0xa3db('0x0'));var utils=require(_0xa3db('0x1'));var logger=require(_0xa3db('0x2'))(_0xa3db('0x3'));var rpc={'chatMessage':require(_0xa3db('0x4')),'openchannelMessage':require(_0xa3db('0x5')),'mailMessage':require(_0xa3db('0x6')),'smsMessage':require(_0xa3db('0x7')),'faxMessage':require(_0xa3db('0x8'))};exports['consequence']=function(_0x591d49,_0x5a7225){return function(_0x1fe521){try{var _0x3a0fa0={'body':utils[_0xa3db('0x9')](_0x5a7225[0x0],this),'ContactId':this[_0xa3db('0xa')]['id']};if(this[_0xa3db('0xb')]===_0xa3db('0xc')){_0x3a0fa0['ChatWebsiteId']=this[_0xa3db('0xd')]['id'];}else{_0x3a0fa0[_[_0xa3db('0xe')](this[_0xa3db('0xb')])+'AccountId']=this[_0xa3db('0xd')]['id'];}_0x3a0fa0[_[_0xa3db('0xe')](this[_0xa3db('0xb')])+_0xa3db('0xf')]=this[_0xa3db('0x10')]['id'];if(rpc[this[_0xa3db('0xb')]+_0xa3db('0x11')]){return rpc[this[_0xa3db('0xb')]+'Message'][_0xa3db('0x12')](_0x3a0fa0)[_0xa3db('0x13')](function(_0x313c79){logger[_0xa3db('0x14')](_0xa3db('0x15'),_0x591d49,_0x3a0fa0[_0xa3db('0x16')]);_0x1fe521[_0xa3db('0x17')]();})[_0xa3db('0x18')](function(_0x4317e3){logger['error'](_0xa3db('0x15'),_0x591d49,JSON[_0xa3db('0x19')](_0x4317e3));_0x1fe521[_0xa3db('0x1a')]();});}}catch(_0x54390e){logger[_0xa3db('0x1b')]('[%s][MESSAGE]\x20%s',_0x591d49,JSON[_0xa3db('0x19')](_0x54390e));_0x1fe521[_0xa3db('0x1a')]();}};}; \ 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 e2b9bcf..99338fd 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 _0x549d=['./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x549d,0xf0));var _0xd549=function(_0x45abb7,_0x49389f){_0x45abb7=_0x45abb7-0x0;var _0x310a0a=_0x549d[_0x45abb7];return _0x310a0a;};'use strict';var utils=require(_0xd549('0x0'));var logger=require('../../../../config/logger')(_0xd549('0x1'));exports[_0xd549('0x2')]=function(_0x8796b5,_0x516a66){return function(_0x327922){try{logger[_0xd549('0x3')](_0xd549('0x4'),_0x8796b5,utils[_0xd549('0x5')](_0x516a66[0x0],this));_0x327922['next']();}catch(_0x144e6f){logger[_0xd549('0x6')](_0xd549('0x4'),_0x8796b5,JSON[_0xd549('0x7')](_0x144e6f));_0x327922['stop']();}};}; \ No newline at end of file +var _0x7707=['consequence','info','getMustacheRender','next','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger'];(function(_0x4308ae,_0x51e793){var _0x1fbbb4=function(_0x32d837){while(--_0x32d837){_0x4308ae['push'](_0x4308ae['shift']());}};_0x1fbbb4(++_0x51e793);}(_0x7707,0x187));var _0x7770=function(_0x22a3a,_0x51ac28){_0x22a3a=_0x22a3a-0x0;var _0x225520=_0x7707[_0x22a3a];return _0x225520;};'use strict';var utils=require('./utils');var logger=require(_0x7770('0x0'))('routing');exports[_0x7770('0x1')]=function(_0x7d99ee,_0x528f0c){return function(_0x26ffd0){try{logger[_0x7770('0x2')]('[%s][NOOP]\x20%s',_0x7d99ee,utils[_0x7770('0x3')](_0x528f0c[0x0],this));_0x26ffd0[_0x7770('0x4')]();}catch(_0x5b3ee7){logger['error'](_0x7770('0x5'),_0x7d99ee,JSON[_0x7770('0x6')](_0x5b3ee7));_0x26ffd0[_0x7770('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 5c5cfff..a7da0ee 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 _0x4243=['beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stringify','validate','lodash','util','seq-queue','moment','../../../../config/logger','routing','./strategy','localhost','queue_id','account','queue','from','joinAt','emit','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','join','stop','find','createQueue','atimeout','qtimeout','close','rrmemory'];(function(_0x16d0f4,_0x37b1db){var _0x692e9d=function(_0x11267b){while(--_0x11267b){_0x16d0f4['push'](_0x16d0f4['shift']());}};_0x692e9d(++_0x37b1db);}(_0x4243,0x177));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x3424('0x0'));var _=require(_0x3424('0x1'));var util=require(_0x3424('0x2'));var seqqueue=require(_0x3424('0x3'));var moment=require(_0x3424('0x4'));var logger=require(_0x3424('0x5'))(_0x3424('0x6'));var strategy=require(_0x3424('0x7'));var io=require('socket.io-emitter')({'host':_0x3424('0x8'),'port':0x18eb});var attributes=['id',_0x3424('0x9'),_0x3424('0xa'),_0x3424('0xb'),_0x3424('0xc'),_0x3424('0xd')];function emit(_0x5de7ac,_0x440e03,_0x230572){io['to'](_0x5de7ac)[_0x3424('0xe')](_0x440e03,_0x230572);}function emitChannelQueueInteraction(_0x3f9228,_0x3714d6,_0x1cb625,_0x1d13e8,_0x2b2812,_0x310fb9,_0x3e5a4b,_0x5e1c06){_0x1cb625[_0x3424('0x9')]=_0x5e1c06;_0x1cb625[_0x3424('0xb')]=_0x3714d6;_0x1cb625['account']=_0x1d13e8;_0x1cb625['id']=_0x2b2812;if(_0x310fb9){_0x3e5a4b[util['format'](_0x3424('0xf'),_0x3f9228)][_0x2b2812]=_['pick'](_0x1cb625,attributes);}else{delete _0x3e5a4b[util[_0x3424('0x10')](_0x3424('0xf'),_0x3f9228)][_0x2b2812];}emit(util['format'](_0x3424('0x11'),_0x3f9228,_0x3714d6),util[_0x3424('0x10')](_0x3424('0x12'),_0x3f9228,_0x310fb9?_0x3424('0x13'):_0x3424('0x14')),_[_0x3424('0x15')](_0x1cb625,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3424('0x16')),'chatQueueReport':require(_0x3424('0x17')),'smsQueueReport':require(_0x3424('0x18')),'faxQueueReport':require(_0x3424('0x19'))};var queue=schema({'name':{'type':_0x3424('0x1a'),'required':!![],'message':_0x3424('0x1b')},'timeout':{'type':_0x3424('0x1c'),'message':_0x3424('0x1d')}});function startRouting(_0xb6fd3a,_0x4502cb,_0x5e52b0,_0x2b11b1){if(_0xb6fd3a&&_0x4502cb&&_0x5e52b0){_0x4502cb[_0x3424('0x1e')]+=0x1;var _0x327835={'uniqueid':_0xb6fd3a,'from':_0x5e52b0[_0x3424('0x1f')]?_0x5e52b0[_0x3424('0x1f')][_0x3424('0xc')]:'','joinAt':moment()[_0x3424('0x10')](_0x3424('0x20')),'ContactId':_0x5e52b0[_0x3424('0x21')]?_0x5e52b0[_0x3424('0x21')]['id']:null,'ListId':_0x5e52b0[_0x3424('0x22')]?_0x5e52b0['list']['id']:null};_0x327835[_[_0x3424('0x23')](_0x5e52b0[_0x3424('0x24')])+_0x3424('0x25')]=_0x4502cb['id']||null;_0x327835[_[_0x3424('0x23')](_0x5e52b0[_0x3424('0x24')])+_0x3424('0x26')]=_0x5e52b0[_0x3424('0x27')]?_0x5e52b0['interaction']['id']:null;_0x327835[_[_0x3424('0x23')](_0x5e52b0[_0x3424('0x24')])+_0x3424('0x28')]=_0x5e52b0[_0x3424('0x29')]?_0x5e52b0[_0x3424('0x29')]['id']:null;_0x327835[_[_0x3424('0x23')](_0x5e52b0['channel'])+(_0x5e52b0['channel']!==_0x3424('0x2a')?_0x3424('0x2b'):_0x3424('0x2c'))]=_0x5e52b0[_0x3424('0xa')]?_0x5e52b0[_0x3424('0xa')]['id']:null;logger[_0x3424('0x2d')](util[_0x3424('0x10')]('[%s][START:QUEUE][NAME:%s]',_0xb6fd3a,_0x4502cb['name']));emitChannelQueueInteraction(_0x5e52b0['channel'],_0x4502cb[_0x3424('0x2e')],_0x327835,_0x5e52b0[_0x3424('0xa')][_0x3424('0x2e')],_0x5e52b0['message']['id'],!![],_0x2b11b1,_0x4502cb['id']);if(rpc[_0x5e52b0['channel']+_0x3424('0x2f')]){return rpc[_0x5e52b0[_0x3424('0x24')]+'QueueReport'][_0x3424('0x30')](_0x327835)[_0x3424('0x31')](function(_0x3a6fe1){logger[_0x3424('0x32')](_0x3424('0x33'));});}}}function stopRouting(_0x39aba2,_0x5d2cfd,_0x2157f1,_0xa01847){if(_0x39aba2&&_0x5d2cfd){_0x5d2cfd[_0x3424('0x1e')]-=0x1;var _0x23677a={'leaveAt':moment()['format'](_0x3424('0x20')),'acceptAt':moment()[_0x3424('0x10')](_0x3424('0x20')),'reason':_0x3424('0x34')};logger['info'](util[_0x3424('0x10')](_0x3424('0x35'),_0x39aba2,_0x5d2cfd[_0x3424('0x2e')]));emitChannelQueueInteraction(_0x2157f1['channel'],_0x5d2cfd[_0x3424('0x2e')],_0x2157f1[_0x3424('0x1f')],_0x2157f1[_0x3424('0xa')][_0x3424('0x2e')],_0x2157f1['message']['id'],![],_0xa01847,_0x5d2cfd['id']);if(rpc[_0x2157f1[_0x3424('0x24')]+_0x3424('0x2f')]){return rpc[_0x2157f1[_0x3424('0x24')]+_0x3424('0x2f')][_0x3424('0x36')](_0x39aba2,_0x23677a)[_0x3424('0x31')](function(_0x43f443){logger[_0x3424('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x158a37,_0x12655f,_0x4428bd,_0x8c43f){if(_0x158a37&&_0x12655f){_0x12655f[_0x3424('0x1e')]-=0x1;var _0x5aff33={'leaveAt':moment()[_0x3424('0x10')](_0x3424('0x20')),'exitAt':moment()[_0x3424('0x10')](_0x3424('0x20')),'reason':_0x3424('0x37')};logger[_0x3424('0x2d')](util[_0x3424('0x10')](_0x3424('0x38'),_0x158a37,_0x12655f[_0x3424('0x2e')]));emitChannelQueueInteraction(_0x4428bd[_0x3424('0x24')],_0x12655f[_0x3424('0x2e')],_0x4428bd[_0x3424('0x1f')],_0x4428bd[_0x3424('0xa')][_0x3424('0x2e')],_0x4428bd[_0x3424('0x29')]['id'],![],_0x8c43f);if(rpc[_0x4428bd[_0x3424('0x24')]+_0x3424('0x2f')]){return rpc[_0x4428bd[_0x3424('0x24')]+'QueueReport'][_0x3424('0x36')](_0x158a37,_0x5aff33)[_0x3424('0x31')](function(_0x51ec91){logger[_0x3424('0x32')](_0x3424('0x39'));});}}}function handleFindQueue(_0x502fef){return function(_0x3dfafe){return _0x3dfafe[_0x3424('0x2e')][_0x3424('0x3a')]()===_0x502fef[_0x3424('0x3a')]();};}exports[_0x3424('0x3b')]=function(_0x4d4627,_0x312bed,_0xd8be46,_0x5c5aa5){return function(_0x2e1a22){try{var _0x4671ed={'name':_0x312bed[0x0],'timeout':_0x312bed[0x1]};var _0x21805b=queue['validate'](_0x4671ed,{'typecast':!![]});if(_0x21805b[_0x3424('0x3c')]){logger[_0x3424('0x32')]('[%s][QUEUE]\x20%s',_0x4d4627,_['map'](_0x21805b,'message')[_0x3424('0x3d')](',\x20'));_0x2e1a22[_0x3424('0x3e')]();}else{var _0x2652e4=_[_0x3424('0x3f')](_0xd8be46[_0x5c5aa5[_0x3424('0x24')]+'Queues'],handleFindQueue(_0x4671ed[_0x3424('0x2e')]));if(_0x2652e4){startRouting(_0x4d4627,_0x2652e4,_0x5c5aa5,_0xd8be46);var _0x499e99=(_0x2652e4[_0x3424('0x37')]||0xa)*0x3e8;var _0x3969f3=(_0x4671ed[_0x3424('0x37')]||0x14)*0x3e8;var _0x19b940,_0x10a823;if(_0x499e99>_0x3969f3){_0x3969f3=_0x499e99;}var _0x31e45c=seqqueue[_0x3424('0x40')](_0x499e99);_0x31e45c['id']=_0x4d4627;_0x31e45c[_0x3424('0x41')]=_0x499e99;_0x31e45c[_0x3424('0x42')]=_0x3969f3;_0x31e45c[_0x3424('0x24')]=_0x5c5aa5[_0x3424('0x24')];_0x10a823=setInterval(function(){if(_0xd8be46['rules']&&!_0xd8be46['rules'][_0x4d4627]){stopRouting(_0x4d4627,_0x2652e4,_0x5c5aa5,_0xd8be46);clearTimeout(_0x19b940);clearInterval(_0x10a823);_0x19b940=undefined;_0x31e45c[_0x3424('0x43')](!![]);_0x2e1a22[_0x3424('0x3e')]();}},0x3e8);_0x19b940=setTimeout(function(){endRouting(_0x4d4627,_0x2652e4,_0x5c5aa5,_0xd8be46);clearInterval(_0x10a823);_0x10a823=undefined;_0x31e45c[_0x3424('0x43')](!![]);_0x2e1a22['next']();},_0x3969f3);switch(_0x2652e4['strategy']){case _0x3424('0x44'):strategy[_0x3424('0x44')](_0x31e45c,_0x2652e4,_0xd8be46,_0x5c5aa5);break;default:strategy[_0x3424('0x45')](_0x31e45c,_0x2652e4,_0xd8be46,_0x5c5aa5);}}else{logger[_0x3424('0x32')](_0x3424('0x46'),_0x4d4627,_0x4671ed[_0x3424('0x2e')]);_0x2e1a22['stop']();}}}catch(_0x3cef8d){console[_0x3424('0x47')](_0x3cef8d);logger[_0x3424('0x32')](_0x3424('0x48'),_0x4d4627,JSON[_0x3424('0x49')](_0x3cef8d));_0x2e1a22[_0x3424('0x3e')]();}};}; \ No newline at end of file +var _0x9932=['queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','upperFirst','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','timeout','createQueue','qtimeout','rules','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stringify','seq-queue','moment','../../../../config/logger','routing','./strategy','socket.io-emitter','queue_id','account'];(function(_0x4f6991,_0x2847ca){var _0xbabffc=function(_0x49a200){while(--_0x49a200){_0x4f6991['push'](_0x4f6991['shift']());}};_0xbabffc(++_0x2847ca);}(_0x9932,0x1db));var _0x2993=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x9932[_0x37e845];return _0x59e55b;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0x2993('0x0'));var moment=require(_0x2993('0x1'));var logger=require(_0x2993('0x2'))(_0x2993('0x3'));var strategy=require(_0x2993('0x4'));var io=require(_0x2993('0x5'))({'host':'localhost','port':0x18eb});var attributes=['id',_0x2993('0x6'),_0x2993('0x7'),_0x2993('0x8'),_0x2993('0x9'),_0x2993('0xa')];function emit(_0x5ebded,_0x1e37c4,_0x4002e7){io['to'](_0x5ebded)[_0x2993('0xb')](_0x1e37c4,_0x4002e7);}function emitChannelQueueInteraction(_0x29f9da,_0xd4920e,_0xd00b0,_0x4f5a11,_0x14372f,_0x371b29,_0x94685f,_0x3a0d1a){_0xd00b0[_0x2993('0x6')]=_0x3a0d1a;_0xd00b0[_0x2993('0x8')]=_0xd4920e;_0xd00b0['account']=_0x4f5a11;_0xd00b0['id']=_0x14372f;if(_0x371b29){_0x94685f[util[_0x2993('0xc')]('%sQueuesWaitingInteractions',_0x29f9da)][_0x14372f]=_['pick'](_0xd00b0,attributes);}else{delete _0x94685f[util[_0x2993('0xc')](_0x2993('0xd'),_0x29f9da)][_0x14372f];}emit(util[_0x2993('0xc')](_0x2993('0xe'),_0x29f9da,_0xd4920e),util[_0x2993('0xc')]('%s_queue_waiting_interaction:%s',_0x29f9da,_0x371b29?_0x2993('0xf'):_0x2993('0x10')),_[_0x2993('0x11')](_0xd00b0,attributes));}var rpc={'openchannelQueueReport':require(_0x2993('0x12')),'mailQueueReport':require(_0x2993('0x13')),'chatQueueReport':require(_0x2993('0x14')),'smsQueueReport':require(_0x2993('0x15')),'faxQueueReport':require(_0x2993('0x16'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x2993('0x17')},'timeout':{'type':'number','message':_0x2993('0x18')}});function startRouting(_0x1a3c77,_0x1d7ca5,_0x1afc0e,_0x3a43e3){if(_0x1a3c77&&_0x1d7ca5&&_0x1afc0e){_0x1d7ca5[_0x2993('0x19')]+=0x1;var _0x19d912={'uniqueid':_0x1a3c77,'from':_0x1afc0e[_0x2993('0x1a')]?_0x1afc0e[_0x2993('0x1a')][_0x2993('0x9')]:'','joinAt':moment()[_0x2993('0xc')](_0x2993('0x1b')),'ContactId':_0x1afc0e[_0x2993('0x1c')]?_0x1afc0e[_0x2993('0x1c')]['id']:null,'ListId':_0x1afc0e[_0x2993('0x1d')]?_0x1afc0e[_0x2993('0x1d')]['id']:null};_0x19d912[_['upperFirst'](_0x1afc0e[_0x2993('0x1e')])+'QueueId']=_0x1d7ca5['id']||null;_0x19d912[_[_0x2993('0x1f')](_0x1afc0e['channel'])+_0x2993('0x20')]=_0x1afc0e[_0x2993('0x21')]?_0x1afc0e[_0x2993('0x21')]['id']:null;_0x19d912[_['upperFirst'](_0x1afc0e[_0x2993('0x1e')])+'MessageId']=_0x1afc0e[_0x2993('0x22')]?_0x1afc0e[_0x2993('0x22')]['id']:null;_0x19d912[_['upperFirst'](_0x1afc0e[_0x2993('0x1e')])+(_0x1afc0e['channel']!==_0x2993('0x23')?_0x2993('0x24'):_0x2993('0x25'))]=_0x1afc0e[_0x2993('0x7')]?_0x1afc0e['account']['id']:null;logger[_0x2993('0x26')](util[_0x2993('0xc')]('[%s][START:QUEUE][NAME:%s]',_0x1a3c77,_0x1d7ca5[_0x2993('0x27')]));emitChannelQueueInteraction(_0x1afc0e[_0x2993('0x1e')],_0x1d7ca5[_0x2993('0x27')],_0x19d912,_0x1afc0e['account']['name'],_0x1afc0e['message']['id'],!![],_0x3a43e3,_0x1d7ca5['id']);if(rpc[_0x1afc0e[_0x2993('0x1e')]+_0x2993('0x28')]){return rpc[_0x1afc0e[_0x2993('0x1e')]+_0x2993('0x28')][_0x2993('0x29')](_0x19d912)[_0x2993('0x2a')](function(_0x5d0e9a){logger[_0x2993('0x2b')](_0x2993('0x2c'));});}}}function stopRouting(_0x380ed0,_0x7e662a,_0x623582,_0x5b0ac3){if(_0x380ed0&&_0x7e662a){_0x7e662a[_0x2993('0x19')]-=0x1;var _0x231012={'leaveAt':moment()[_0x2993('0xc')](_0x2993('0x1b')),'acceptAt':moment()[_0x2993('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2993('0x2d')};logger[_0x2993('0x26')](util[_0x2993('0xc')](_0x2993('0x2e'),_0x380ed0,_0x7e662a['name']));emitChannelQueueInteraction(_0x623582[_0x2993('0x1e')],_0x7e662a['name'],_0x623582[_0x2993('0x1a')],_0x623582['account']['name'],_0x623582['message']['id'],![],_0x5b0ac3,_0x7e662a['id']);if(rpc[_0x623582[_0x2993('0x1e')]+_0x2993('0x28')]){return rpc[_0x623582['channel']+_0x2993('0x28')][_0x2993('0x2f')](_0x380ed0,_0x231012)[_0x2993('0x2a')](function(_0x1f78c0){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x4ecc3e,_0x69027a,_0x2bff3a,_0x1b614a){if(_0x4ecc3e&&_0x69027a){_0x69027a[_0x2993('0x19')]-=0x1;var _0x5d32ac={'leaveAt':moment()[_0x2993('0xc')](_0x2993('0x1b')),'exitAt':moment()[_0x2993('0xc')](_0x2993('0x1b')),'reason':'timeout'};logger[_0x2993('0x26')](util[_0x2993('0xc')](_0x2993('0x30'),_0x4ecc3e,_0x69027a[_0x2993('0x27')]));emitChannelQueueInteraction(_0x2bff3a[_0x2993('0x1e')],_0x69027a[_0x2993('0x27')],_0x2bff3a[_0x2993('0x1a')],_0x2bff3a[_0x2993('0x7')][_0x2993('0x27')],_0x2bff3a[_0x2993('0x22')]['id'],![],_0x1b614a);if(rpc[_0x2bff3a['channel']+'QueueReport']){return rpc[_0x2bff3a[_0x2993('0x1e')]+_0x2993('0x28')][_0x2993('0x2f')](_0x4ecc3e,_0x5d32ac)[_0x2993('0x2a')](function(_0x3a79ee){logger[_0x2993('0x2b')](_0x2993('0x31'));});}}}function handleFindQueue(_0x233404){return function(_0x1f010c){return _0x1f010c[_0x2993('0x27')][_0x2993('0x32')]()===_0x233404[_0x2993('0x32')]();};}exports[_0x2993('0x33')]=function(_0x58359d,_0x452a2f,_0x4e456d,_0x1d24fe){return function(_0x20e5dd){try{var _0x11f7ab={'name':_0x452a2f[0x0],'timeout':_0x452a2f[0x1]};var _0x139802=queue['validate'](_0x11f7ab,{'typecast':!![]});if(_0x139802[_0x2993('0x34')]){logger[_0x2993('0x2b')](_0x2993('0x35'),_0x58359d,_[_0x2993('0x36')](_0x139802,_0x2993('0x22'))['join'](',\x20'));_0x20e5dd[_0x2993('0x37')]();}else{var _0x488351=_['find'](_0x4e456d[_0x1d24fe[_0x2993('0x1e')]+_0x2993('0x38')],handleFindQueue(_0x11f7ab[_0x2993('0x27')]));if(_0x488351){startRouting(_0x58359d,_0x488351,_0x1d24fe,_0x4e456d);var _0x2da7e6=(_0x488351['timeout']||0xa)*0x3e8;var _0x54e5cd=(_0x11f7ab[_0x2993('0x39')]||0x14)*0x3e8;var _0x56a8d8,_0x3c6a1c;if(_0x2da7e6>_0x54e5cd){_0x54e5cd=_0x2da7e6;}var _0x3937a1=seqqueue[_0x2993('0x3a')](_0x2da7e6);_0x3937a1['id']=_0x58359d;_0x3937a1['atimeout']=_0x2da7e6;_0x3937a1[_0x2993('0x3b')]=_0x54e5cd;_0x3937a1[_0x2993('0x1e')]=_0x1d24fe[_0x2993('0x1e')];_0x3c6a1c=setInterval(function(){if(_0x4e456d['rules']&&!_0x4e456d[_0x2993('0x3c')][_0x58359d]){stopRouting(_0x58359d,_0x488351,_0x1d24fe,_0x4e456d);clearTimeout(_0x56a8d8);clearInterval(_0x3c6a1c);_0x56a8d8=undefined;_0x3937a1[_0x2993('0x3d')](!![]);_0x20e5dd[_0x2993('0x37')]();}},0x3e8);_0x56a8d8=setTimeout(function(){endRouting(_0x58359d,_0x488351,_0x1d24fe,_0x4e456d);clearInterval(_0x3c6a1c);_0x3c6a1c=undefined;_0x3937a1[_0x2993('0x3d')](!![]);_0x20e5dd[_0x2993('0x3e')]();},_0x54e5cd);switch(_0x488351[_0x2993('0x3f')]){case _0x2993('0x40'):strategy[_0x2993('0x40')](_0x3937a1,_0x488351,_0x4e456d,_0x1d24fe);break;default:strategy[_0x2993('0x41')](_0x3937a1,_0x488351,_0x4e456d,_0x1d24fe);}}else{logger[_0x2993('0x2b')](_0x2993('0x42'),_0x58359d,_0x11f7ab['name']);_0x20e5dd[_0x2993('0x37')]();}}}catch(_0x27c402){console[_0x2993('0x43')](_0x27c402);logger[_0x2993('0x2b')](_0x2993('0x35'),_0x58359d,JSON[_0x2993('0x44')](_0x27c402));_0x20e5dd[_0x2993('0x37')]();}};}; \ 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 94b029d..84597a9 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 _0x4b50=['[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','forcedOwnership','busyQueue','[%s][AGENT]\x20timeout\x20with\x20%s','isNil','TIMEOUT','notificationId','exports','lodash','uuid','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','bind','drained','handleTimeout','prototype','done','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b50,0x195));var _0x04b5=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x4b50[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x04b5('0x0'));var uuid=require(_0x04b5('0x1'));var util=require('./util');var logger=require(_0x04b5('0x2'))(_0x04b5('0x3'));var Agent=function(_0x4f6bc5,_0x3bd450,_0x2f3c88,_0x2489e5){this['notificationId']=uuid['v4']();this[_0x04b5('0x4')]=_0x4f6bc5;this[_0x04b5('0x5')]=_0x3bd450;this[_0x04b5('0x6')]=_0x2f3c88;this['routing']=_0x2489e5;this[_0x04b5('0x4')][_0x04b5('0x7')](this[_0x04b5('0x8')]['bind'](this),this['handleTimeout'][_0x04b5('0x9')](this));this['squeue']['on'](_0x04b5('0xa'),this[_0x04b5('0xb')][_0x04b5('0x9')](this));};Agent[_0x04b5('0xc')]['push']=function(){this[_0x04b5('0x4')][_0x04b5('0x7')](this['handleRun']['bind'](this),this['handleTimeout'][_0x04b5('0x9')](this));};Agent[_0x04b5('0xc')][_0x04b5('0xd')]=function(_0x3196a1){if(_0x3196a1){setTimeout(this[_0x04b5('0x7')][_0x04b5('0x9')](this),0x3e8);_0x3196a1[_0x04b5('0xd')]();}};Agent[_0x04b5('0xc')][_0x04b5('0x8')]=function(_0x2a3772){logger[_0x04b5('0xe')](_0x04b5('0xf'),this['squeue']['id'],this[_0x04b5('0x5')]['id']);if(_['isNil'](this[_0x04b5('0x6')][_0x04b5('0x10')][this['agent']['id']])){logger[_0x04b5('0xe')](_0x04b5('0x11'),this[_0x04b5('0x4')]['id'],this['agent']['id']);this[_0x04b5('0xd')](_0x2a3772);}else{if(this['routing']['forcedOwnership']||util[_0x04b5('0x12')](this[_0x04b5('0x4')]['id'],this[_0x04b5('0x6')][_0x04b5('0x10')][this[_0x04b5('0x5')]['id']],this['squeue'][_0x04b5('0x13')],![])){util[_0x04b5('0x14')](this[_0x04b5('0x4')]['id'],this['realtime'][_0x04b5('0x10')][this['agent']['id']],'RINGING'+(this['routing'][_0x04b5('0x15')]?':FORCED':''));this[_0x04b5('0x6')][_0x04b5('0x10')][this[_0x04b5('0x5')]['id']]['busy']=!![];this[_0x04b5('0x6')][_0x04b5('0x10')][this[_0x04b5('0x5')]['id']][_0x04b5('0x16')]=undefined;util['showNotification'](this['notificationId'],this[_0x04b5('0x4')]['id'],this[_0x04b5('0x6')][_0x04b5('0x10')][this['agent']['id']],null,this[_0x04b5('0x3')]);}else{this[_0x04b5('0xd')](_0x2a3772);}}};Agent[_0x04b5('0xc')][_0x04b5('0xb')]=function(){logger[_0x04b5('0xe')](_0x04b5('0x17'),this[_0x04b5('0x4')]['id'],this[_0x04b5('0x5')]['id']);if(_[_0x04b5('0x18')](this[_0x04b5('0x6')]['agents'][this['agent']['id']])){return logger['info'](_0x04b5('0x11'),this[_0x04b5('0x4')]['id'],this['agent']['id']);}else{util[_0x04b5('0x14')](this[_0x04b5('0x4')]['id'],this[_0x04b5('0x6')][_0x04b5('0x10')][this[_0x04b5('0x5')]['id']],_0x04b5('0x19'));this[_0x04b5('0x6')][_0x04b5('0x10')][this[_0x04b5('0x5')]['id']]['busy']=![];this[_0x04b5('0x6')]['agents'][this['agent']['id']][_0x04b5('0x16')]=undefined;util['hideNotification'](this[_0x04b5('0x1a')],this[_0x04b5('0x4')]['id'],this[_0x04b5('0x6')]['agents'][this[_0x04b5('0x5')]['id']],null,this[_0x04b5('0x3')]);}};function agent(_0x22b3f0,_0x26b5e1,_0x3daa02,_0x1e996a){return new Agent(_0x22b3f0,_0x26b5e1,_0x3daa02,_0x1e996a);}module[_0x04b5('0x1b')]=agent; \ No newline at end of file +var _0xb07a=['lodash','./util','routing','notificationId','agent','realtime','push','handleRun','handleTimeout','bind','squeue','prototype','done','[%s][AGENT]\x20try\x20with\x20%s','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','writeLog','RINGING',':FORCED','busy','busyQueue','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','hideNotification','exports'];(function(_0xaa2ce9,_0x28e7d5){var _0x3e33c7=function(_0x2a5325){while(--_0x2a5325){_0xaa2ce9['push'](_0xaa2ce9['shift']());}};_0x3e33c7(++_0x28e7d5);}(_0xb07a,0x186));var _0xab07=function(_0x1a32fe,_0xdab6ac){_0x1a32fe=_0x1a32fe-0x0;var _0x1abca6=_0xb07a[_0x1a32fe];return _0x1abca6;};'use strict';var _=require(_0xab07('0x0'));var uuid=require('uuid');var util=require(_0xab07('0x1'));var logger=require('../../../../../config/logger')(_0xab07('0x2'));var Agent=function(_0x54f2bc,_0x92b36a,_0x2f9bba,_0x5750d4){this[_0xab07('0x3')]=uuid['v4']();this['squeue']=_0x54f2bc;this[_0xab07('0x4')]=_0x92b36a;this[_0xab07('0x5')]=_0x2f9bba;this[_0xab07('0x2')]=_0x5750d4;this['squeue'][_0xab07('0x6')](this[_0xab07('0x7')]['bind'](this),this[_0xab07('0x8')][_0xab07('0x9')](this));this[_0xab07('0xa')]['on']('drained',this['handleTimeout'][_0xab07('0x9')](this));};Agent[_0xab07('0xb')][_0xab07('0x6')]=function(){this[_0xab07('0xa')]['push'](this[_0xab07('0x7')][_0xab07('0x9')](this),this['handleTimeout'][_0xab07('0x9')](this));};Agent[_0xab07('0xb')]['done']=function(_0x2915af){if(_0x2915af){setTimeout(this['push'][_0xab07('0x9')](this),0x3e8);_0x2915af[_0xab07('0xc')]();}};Agent[_0xab07('0xb')][_0xab07('0x7')]=function(_0x3b9739){logger['info'](_0xab07('0xd'),this[_0xab07('0xa')]['id'],this[_0xab07('0x4')]['id']);if(_[_0xab07('0xe')](this[_0xab07('0x5')]['agents'][this[_0xab07('0x4')]['id']])){logger[_0xab07('0xf')](_0xab07('0x10'),this[_0xab07('0xa')]['id'],this[_0xab07('0x4')]['id']);this[_0xab07('0xc')](_0x3b9739);}else{if(this[_0xab07('0x2')][_0xab07('0x11')]||util[_0xab07('0x12')](this[_0xab07('0xa')]['id'],this[_0xab07('0x5')][_0xab07('0x13')][this[_0xab07('0x4')]['id']],this['squeue'][_0xab07('0x14')],![])){util[_0xab07('0x15')](this['squeue']['id'],this['realtime'][_0xab07('0x13')][this[_0xab07('0x4')]['id']],_0xab07('0x16')+(this[_0xab07('0x2')][_0xab07('0x11')]?_0xab07('0x17'):''));this[_0xab07('0x5')][_0xab07('0x13')][this['agent']['id']][_0xab07('0x18')]=!![];this[_0xab07('0x5')][_0xab07('0x13')][this[_0xab07('0x4')]['id']][_0xab07('0x19')]=undefined;util['showNotification'](this[_0xab07('0x3')],this[_0xab07('0xa')]['id'],this[_0xab07('0x5')]['agents'][this['agent']['id']],null,this[_0xab07('0x2')]);}else{this[_0xab07('0xc')](_0x3b9739);}}};Agent[_0xab07('0xb')]['handleTimeout']=function(){logger['info'](_0xab07('0x1a'),this[_0xab07('0xa')]['id'],this[_0xab07('0x4')]['id']);if(_[_0xab07('0xe')](this['realtime'][_0xab07('0x13')][this[_0xab07('0x4')]['id']])){return logger[_0xab07('0xf')](_0xab07('0x10'),this[_0xab07('0xa')]['id'],this['agent']['id']);}else{util[_0xab07('0x15')](this[_0xab07('0xa')]['id'],this[_0xab07('0x5')][_0xab07('0x13')][this[_0xab07('0x4')]['id']],_0xab07('0x1b'));this['realtime'][_0xab07('0x13')][this[_0xab07('0x4')]['id']]['busy']=![];this[_0xab07('0x5')][_0xab07('0x13')][this[_0xab07('0x4')]['id']][_0xab07('0x19')]=undefined;util[_0xab07('0x1c')](this[_0xab07('0x3')],this['squeue']['id'],this[_0xab07('0x5')][_0xab07('0x13')][this[_0xab07('0x4')]['id']],null,this[_0xab07('0x2')]);}};function agent(_0x50a381,_0x49a2bf,_0xaf950f,_0x311d95){return new Agent(_0x50a381,_0x49a2bf,_0xaf950f,_0x311d95);}module[_0xab07('0x1d')]=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 72e341c..f4a6965 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 _0x0102=['[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','TIMEOUT','busyQueue','exports','uuid','./util','../../../../../config/logger','routing','squeue','queue','realtime','floor','qtimeout','module','atimeout','length','push','handleRun','bind','handleTimeout','drained','prototype','done','isNil','Agents','agents','isAgentAvailable','channel','writeLog','RINGING','busy','showNotification','notificationId','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0102,0x186));var _0x2010=function(_0x4b0190,_0x3906ac){_0x4b0190=_0x4b0190-0x0;var _0x4bdc80=_0x0102[_0x4b0190];return _0x4bdc80;};'use strict';var _=require('lodash');var uuid=require(_0x2010('0x0'));var util=require(_0x2010('0x1'));var logger=require(_0x2010('0x2'))(_0x2010('0x3'));var Beepall=function(_0x54090f,_0x530694,_0x575b0a,_0x4e30b3){this['notificationId']=uuid['v4']();this[_0x2010('0x4')]=_0x54090f;this[_0x2010('0x5')]=_0x530694;this[_0x2010('0x6')]=_0x575b0a;this[_0x2010('0x3')]=_0x4e30b3;this['length']=Math[_0x2010('0x7')](this['squeue'][_0x2010('0x8')]/this[_0x2010('0x4')]['atimeout']);this[_0x2010('0x9')]=this[_0x2010('0x4')][_0x2010('0x8')]%this[_0x2010('0x4')][_0x2010('0xa')];for(var _0x2a27b0=0x0;_0x2a27b00x0){for(var _0x131a26=0x0,_0x4f621c;_0x131a260x0){for(var _0x998ab5=0x0,_0x5238a8;_0x998ab50x0&&_0x576157[_0x56309e+_0xbe8f('0x1b')]>=_0x576157[_0x56309e+_0xbe8f('0x1a')]){writeLog(_0x530d45,_0x576157,_0x56309e[_0xbe8f('0x1c')]()+_0xbe8f('0x1d'));return![];}}return!![];};exports[_0xbe8f('0x1e')]=function(_0x36a44f,_0x197f60,_0x504736,_0x195e39,_0x1c18e2){return sendNotification(!![],_0x36a44f,_0x197f60,_0x504736,_0x195e39,_0x1c18e2);};exports[_0xbe8f('0x1f')]=function(_0x1cc7bd,_0x55e088,_0x1ce279,_0x3e9855,_0x3c8658){return sendNotification(![],_0x1cc7bd,_0x55e088,_0x1ce279,_0x3e9855,_0x3c8658);};exports[_0xbe8f('0x20')]=writeLog; \ No newline at end of file +var _0x6121=['remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','hideNotification','util','../utils','mustache','../../../../../config/logger','routing','localhost','emit','format','user:%s','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','name','notification:%s','save'];(function(_0x569a85,_0x367c07){var _0x1546da=function(_0x16c0c0){while(--_0x16c0c0){_0x569a85['push'](_0x569a85['shift']());}};_0x1546da(++_0x367c07);}(_0x6121,0x163));var _0x1612=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6121[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x1612('0x0'));var utils=require(_0x1612('0x1'));var Mustache=require(_0x1612('0x2'));var logger=require(_0x1612('0x3'))(_0x1612('0x4'));var io=require('socket.io-emitter')({'host':_0x1612('0x5'),'port':0x18eb});function emit(_0x1f704c,_0x3dfa20,_0x1f2ed9){io['to'](_0x1f704c)[_0x1612('0x6')](_0x3dfa20,_0x1f2ed9);}function sendNotification(_0x507b3c,_0x5bee90,_0x373393,_0x400ef8,_0x2594ff,_0x1a2309){io['to'](util[_0x1612('0x7')](_0x1612('0x8'),_0x400ef8['name']))[_0x1612('0x6')]('user:save',_0x400ef8);var _0x188302=_0x1a2309||{};var _0x47928b=_0x373393[_0x1612('0x9')]('.');var _0xf89e47={'uniqueid':_0x5bee90,'channel':_0x47928b[0x0],'id':_0x47928b[0x1],'title':_0x47928b[0x0]+_0x1612('0xa'),'interactionId':_0x47928b[0x2],'queue':_0x2594ff?_0x2594ff['name']:null,'sound':_0x188302[_0x1612('0xb')][_0x1612('0xc')],'shake':_0x188302[_0x1612('0xb')][_0x1612('0xd')]};try{if(!_0x188302['body']){_0x188302['body']={};}if(_0x2594ff){_0x188302['body']['queue']=_0x2594ff;}else if(_0x188302[_0x1612('0xe')][_0x1612('0xf')]){delete _0x188302[_0x1612('0xe')][_0x1612('0xf')];}_0xf89e47['msg']=utils[_0x1612('0x10')](_0x188302[_0x1612('0xb')]['notificationTemplate'],_0x188302);}catch(_0x3cc9cb){_0xf89e47[_0x1612('0x11')]=_0x1612('0x12');logger[_0x1612('0x13')](util[_0x1612('0x7')](_0x1612('0x14'),_0x5bee90,_0x3cc9cb[_0x1612('0x15')]));}io['to'](util['format'](_0x1612('0x8'),_0x400ef8[_0x1612('0x16')]))['emit'](util['format'](_0x1612('0x17'),_0x507b3c?_0x1612('0x18'):_0x1612('0x19')),_0xf89e47);}function writeLog(_0x3fa439,_0x1221bf,_0x2121fd){return logger[_0x1612('0x1a')](util[_0x1612('0x7')](_0x1612('0x1b'),_0x3fa439,_0x1221bf[_0x1612('0x16')],_0x2121fd));}exports[_0x1612('0x1c')]=function(_0x5acfd0,_0x45571f,_0x5ef40c,_0xe3c467){if(_0x45571f['busy']){writeLog(_0x5acfd0,_0x45571f,_0x1612('0x1d'));return![];}if(!_0x45571f[_0x1612('0x1e')]){writeLog(_0x5acfd0,_0x45571f,_0x1612('0x1f'));return![];}if(_0x45571f[_0x5ef40c+'Pause']){writeLog(_0x5acfd0,_0x45571f,_0x1612('0x20'));return![];}if(_0xe3c467&&_0x45571f[_0x1612('0x21')](_0x5ef40c+_0x1612('0x22'))&&_0x45571f['hasOwnProperty'](_0x5ef40c+_0x1612('0x23'))){if(_0x45571f[_0x5ef40c+_0x1612('0x22')]>0x0&&_0x45571f[_0x5ef40c+_0x1612('0x23')]>=_0x45571f[_0x5ef40c+_0x1612('0x22')]){writeLog(_0x5acfd0,_0x45571f,_0x5ef40c['toUpperCase']()+_0x1612('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x46b9cb,_0x20e620,_0x4dd3c1,_0x17f51f,_0x505ac8){return sendNotification(!![],_0x46b9cb,_0x20e620,_0x4dd3c1,_0x17f51f,_0x505ac8);};exports[_0x1612('0x25')]=function(_0x7a6023,_0x164e78,_0x4e838d,_0x4702b0,_0x5cf6da){return sendNotification(![],_0x7a6023,_0x164e78,_0x4e838d,_0x4702b0,_0x5cf6da);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 625943b..9cf4f55 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 _0x5c28=['map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x265184,_0x4c488c){var _0x313a32=function(_0x36ed54){while(--_0x36ed54){_0x265184['push'](_0x265184['shift']());}};_0x313a32(++_0x4c488c);}(_0x5c28,0x1c3));var _0x85c2=function(_0x393fff,_0x364d52){_0x393fff=_0x393fff-0x0;var _0x5e5d78=_0x5c28[_0x393fff];return _0x5e5d78;};'use strict';var schema=require(_0x85c2('0x0'));var sh=require(_0x85c2('0x1'));var _=require(_0x85c2('0x2'));var utils=require('./utils');var logger=require(_0x85c2('0x3'))(_0x85c2('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x85c2('0x5')}});exports[_0x85c2('0x6')]=function(_0x567197,_0x502750){return function(_0x5faebe){try{var _0x580fe8={'command':_0x502750[0x0]};var _0x284fd5=system['validate'](_0x580fe8,{'typecast':!![]});if(_0x284fd5[_0x85c2('0x7')]){logger['error']('[%s][SYSTEM]\x20%s',_0x567197,_[_0x85c2('0x8')](_0x284fd5,_0x85c2('0x9'))[_0x85c2('0xa')](',\x20'));logger[_0x85c2('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x567197);_0x5faebe[_0x85c2('0xc')]();}else{var _0x33f618=this;var _0x365d82=utils[_0x85c2('0xd')](_0x502750[0x0],this);logger[_0x85c2('0xb')](_0x85c2('0xe'),_0x567197,_0x365d82);sh['exec'](_['trim'](_0x365d82),function(_0x371acc,_0x397e18){logger[_0x85c2('0xb')](_0x85c2('0xf'),_0x567197,_0x371acc);if(_0x371acc==0x0){var _0x103163=_0x397e18[_0x85c2('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x85c2('0x11')](_0x502750[0x1])||_[_0x85c2('0x12')](_0x502750[0x1])){logger[_0x85c2('0xb')](_0x85c2('0x13'),_0x567197);_0x33f618[_0x85c2('0x14')][_0x502750[0x1]]=_0x103163;}else{logger[_0x85c2('0xb')](_0x85c2('0x15'),_0x567197,_0x502750[0x1],_0x103163);_0x33f618['body'][_0x502750[0x1]]=_0x103163;}}_0x5faebe['next']();});}}catch(_0x187c45){logger[_0x85c2('0x16')](_0x85c2('0x17'),_0x567197,_[_0x85c2('0x18')](_0x187c45)?JSON[_0x85c2('0x19')](_0x187c45):_0x187c45);logger[_0x85c2('0xb')](_0x85c2('0x1a'),_0x567197);_0x5faebe[_0x85c2('0xc')]();}};}; \ No newline at end of file +var _0x8636=['./utils','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs'];(function(_0x3daf4d,_0x2ede25){var _0x8b6b9d=function(_0x21d21d){while(--_0x21d21d){_0x3daf4d['push'](_0x3daf4d['shift']());}};_0x8b6b9d(++_0x2ede25);}(_0x8636,0x136));var _0x6863=function(_0x433ab5,_0x16e711){_0x433ab5=_0x433ab5-0x0;var _0x315911=_0x8636[_0x433ab5];return _0x315911;};'use strict';var schema=require(_0x6863('0x0'));var sh=require(_0x6863('0x1'));var _=require('lodash');var utils=require(_0x6863('0x2'));var logger=require(_0x6863('0x3'))(_0x6863('0x4'));var system=schema({'command':{'type':_0x6863('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6863('0x6')]=function(_0x45bd0c,_0x1deda1){return function(_0x38e2f1){try{var _0x50b94f={'command':_0x1deda1[0x0]};var _0xa423e0=system[_0x6863('0x0')](_0x50b94f,{'typecast':!![]});if(_0xa423e0[_0x6863('0x7')]){logger[_0x6863('0x8')](_0x6863('0x9'),_0x45bd0c,_[_0x6863('0xa')](_0xa423e0,_0x6863('0xb'))[_0x6863('0xc')](',\x20'));logger[_0x6863('0xd')](_0x6863('0xe'),_0x45bd0c);_0x38e2f1[_0x6863('0xf')]();}else{var _0x410fc4=this;var _0x3c3f96=utils[_0x6863('0x10')](_0x1deda1[0x0],this);logger[_0x6863('0xd')](_0x6863('0x11'),_0x45bd0c,_0x3c3f96);sh[_0x6863('0x12')](_['trim'](_0x3c3f96),function(_0x3de426,_0x299c93){logger[_0x6863('0xd')](_0x6863('0x13'),_0x45bd0c,_0x3de426);if(_0x3de426==0x0){var _0x456e46=_0x299c93[_0x6863('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1deda1[0x1])||_[_0x6863('0x15')](_0x1deda1[0x1])){logger['info'](_0x6863('0x16'),_0x45bd0c);_0x410fc4[_0x6863('0x17')][_0x1deda1[0x1]]=_0x456e46;}else{logger[_0x6863('0xd')](_0x6863('0x18'),_0x45bd0c,_0x1deda1[0x1],_0x456e46);_0x410fc4[_0x6863('0x17')][_0x1deda1[0x1]]=_0x456e46;}}_0x38e2f1[_0x6863('0xf')]();});}}catch(_0x4afac5){logger['error'](_0x6863('0x9'),_0x45bd0c,_['isObject'](_0x4afac5)?JSON[_0x6863('0x19')](_0x4afac5):_0x4afac5);logger[_0x6863('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x45bd0c);_0x38e2f1[_0x6863('0xf')]();}};}; \ 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 c530f91..bf43636 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 _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x3a05a6,_0x5a2916){var _0x55a922=function(_0x333dd2){while(--_0x333dd2){_0x3a05a6['push'](_0x3a05a6['shift']());}};_0x55a922(++_0x5a2916);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ 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(_0x3fae8d,_0x5396ed){var _0x58935d=function(_0x25f27d){while(--_0x25f27d){_0x3fae8d['push'](_0x3fae8d['shift']());}};_0x58935d(++_0x5396ed);}(_0x7a54,0x106));var _0x47a5=function(_0x57544e,_0x18c271){_0x57544e=_0x57544e-0x0;var _0x30df63=_0x7a54[_0x57544e];return _0x30df63;};'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 c1523d8..90a1a02 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 _0x295f=['lodash','exports','render','merge','message','account','interaction','list'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x295f,0x168));var _0xf295=function(_0x3ebf03,_0x45f931){_0x3ebf03=_0x3ebf03-0x0;var _0x1619e1=_0x295f[_0x3ebf03];return _0x1619e1;};'use strict';var Mustache=require('mustache');var _=require(_0xf295('0x0'));module[_0xf295('0x1')]={'getMustacheRender':function(_0x35f58d,_0x588a38){return Mustache[_0xf295('0x2')](_0x35f58d,_[_0xf295('0x3')](_0x588a38['body'],{'contact':_0x588a38['contact'],'message':_0x588a38[_0xf295('0x4')],'account':_0x588a38[_0xf295('0x5')],'interaction':_0x588a38[_0xf295('0x6')],'list':_0x588a38[_0xf295('0x7')]}))||'';}}; \ No newline at end of file +var _0x20ce=['contact','message','account','interaction','list','mustache','lodash','exports','render','merge','body'];(function(_0x2da5a8,_0x40a86b){var _0x1bddfc=function(_0x25d40d){while(--_0x25d40d){_0x2da5a8['push'](_0x2da5a8['shift']());}};_0x1bddfc(++_0x40a86b);}(_0x20ce,0x10d));var _0xe20c=function(_0x49b368,_0x487d7b){_0x49b368=_0x49b368-0x0;var _0x26ff5d=_0x20ce[_0x49b368];return _0x26ff5d;};'use strict';var Mustache=require(_0xe20c('0x0'));var _=require(_0xe20c('0x1'));module[_0xe20c('0x2')]={'getMustacheRender':function(_0x597c57,_0x377a74){return Mustache[_0xe20c('0x3')](_0x597c57,_[_0xe20c('0x4')](_0x377a74[_0xe20c('0x5')],{'contact':_0x377a74[_0xe20c('0x6')],'message':_0x377a74[_0xe20c('0x7')],'account':_0x377a74[_0xe20c('0x8')],'interaction':_0x377a74[_0xe20c('0x9')],'list':_0x377a74[_0xe20c('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 751e9c0..2f60843 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 _0x9a87=['RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','interaction','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','push','dialogflow','slice','message','tag','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!'];(function(_0x6f801,_0x24bbff){var _0x5b774e=function(_0x4e596f){while(--_0x4e596f){_0x6f801['push'](_0x6f801['shift']());}};_0x5b774e(++_0x24bbff);}(_0x9a87,0x100));var _0x79a8=function(_0x5e9850,_0x291edf){_0x5e9850=_0x5e9850-0x0;var _0x2d3d96=_0x9a87[_0x5e9850];return _0x2d3d96;};'use strict';var _=require(_0x79a8('0x0'));var util=require(_0x79a8('0x1'));var path=require(_0x79a8('0x2'));var fs=require('fs');var jayson=require(_0x79a8('0x3'));var BPromise=require(_0x79a8('0x4'));var uuid=require(_0x79a8('0x5'));var config=require('../../../config/environment');var logger=require(_0x79a8('0x6'))(_0x79a8('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require(_0x79a8('0x8')),'mailQueueReport':require(_0x79a8('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x79a8('0xa')),'faxQueueReport':require(_0x79a8('0xb'))};var RuleEngine=require(_0x79a8('0xc'));function getId(_0x2d94e5,_0x249917,_0x205123){return util[_0x79a8('0xd')](_0x79a8('0xe'),_0x2d94e5,_0x249917||0x0,_0x205123||0x0);}function getIntervals(_0x5a0a10,_0x1daa00){var _0xebfaa=[];if(!_[_0x79a8('0xf')](_0x1daa00['IntervalId'])&&!_[_0x79a8('0xf')](_0x5a0a10[_0x1daa00[_0x79a8('0x10')]])&&!_[_0x79a8('0xf')](_0x5a0a10[_0x1daa00[_0x79a8('0x10')]][_0x79a8('0x11')])){_0xebfaa=_['map'](_0x5a0a10[_0x1daa00[_0x79a8('0x10')]][_0x79a8('0x11')],_0x79a8('0x12'));}else if(!_[_0x79a8('0xf')](_0x1daa00[_0x79a8('0x12')])){_0xebfaa=[_0x1daa00[_0x79a8('0x12')]];}return _0xebfaa;}exports[_0x79a8('0x13')]=function(_0x3e06df){_0x3e06df['rules']={};return new BPromise(function(_0x70316,_0x396fae){var _0x405d11={'Start':function(_0x4be86){var _0x497a73=this;return new Promise(function(_0x2c3002,_0x497476){if(_0x4be86){try{var _0x3489ba=[];var _0x464f22=getId(_0x4be86[_0x79a8('0x14')],_0x4be86['message']?_0x4be86['message']['id']:0x0,_0x4be86[_0x79a8('0x15')]?_0x4be86['interaction']['id']:0x0);if(_0x4be86[_0x79a8('0x16')]&&_['isArray'](_0x4be86[_0x79a8('0x16')])&&_0x4be86['applications'][_0x79a8('0x17')]){for(var _0x3136a6=0x0;_0x3136a6<_0x4be86[_0x79a8('0x16')]['length'];_0x3136a6+=0x1){var _0x896584=_0x4be86[_0x79a8('0x16')][_0x3136a6];if(fs['existsSync'](path[_0x79a8('0x18')](__dirname,_0x79a8('0x16'),_0x896584[_0x79a8('0x19')]+_0x79a8('0x1a')))){var _0x5d8013=[];switch(_0x896584[_0x79a8('0x19')][_0x79a8('0x1b')]()){case _0x79a8('0x1c'):var _0x160c47=_0x896584[_0x79a8('0x1d')][_0x79a8('0x1e')](',');_0x5d8013[_0x79a8('0x1f')](_0x160c47[0x0]);_0x5d8013[_0x79a8('0x1f')](_0x160c47['slice'](0x1,_0x160c47[_0x79a8('0x17')])['join'](','));break;case _0x79a8('0x20'):var _0x160c47=_0x896584[_0x79a8('0x1d')][_0x79a8('0x1e')](',');_0x5d8013['push'](_0x160c47[0x0]);_0x5d8013[_0x79a8('0x1f')](_0x160c47[0x1]);_0x5d8013[_0x79a8('0x1f')](_0x160c47[_0x79a8('0x21')](0x2,_0x160c47[_0x79a8('0x17')])[_0x79a8('0x18')](','));break;case _0x79a8('0x22'):_0x5d8013[_0x79a8('0x1f')](_0x896584[_0x79a8('0x1d')]);break;case _0x79a8('0x23'):_0x5d8013['push'](_0x896584['TagId']);_0x5d8013[_0x79a8('0x1f')](_0x896584[_0x79a8('0x1d')]);break;default:_0x5d8013=_['isNil'](_0x896584[_0x79a8('0x1d')])?[]:_0x896584['appdata']['split'](',');}var _0x5bb7aa={'id':util[_0x79a8('0xd')](_0x79a8('0x24'),_0x464f22,_0x896584['id'],_0x896584[_0x79a8('0x19')]),'condition':require(_0x79a8('0x25'))[_0x79a8('0x26')](_0x464f22,getIntervals(_0x3e06df[_0x79a8('0x27')],_0x896584),_0x3e06df),'consequence':require(_0x79a8('0x28')+_0x896584[_0x79a8('0x19')])[_0x79a8('0x29')](_0x464f22,_0x5d8013,_0x3e06df,_0x4be86),'p':_0x896584[_0x79a8('0x2a')]||0x0};logger[_0x79a8('0x2b')](_0x79a8('0x2c'),_0x5bb7aa['id'],_0x79a8('0x2d'),getIntervals(_0x3e06df[_0x79a8('0x27')],_0x896584)[_0x79a8('0x18')](_0x79a8('0x2e')));_0x3489ba[_0x79a8('0x1f')](_0x5bb7aa);}else{logger[_0x79a8('0x2f')](_0x79a8('0x30'),path[_0x79a8('0x18')](__dirname,_0x79a8('0x16'),_0x896584[_0x79a8('0x19')]+_0x79a8('0x1a')));}}_0x3e06df['rules'][_0x464f22]=new RuleEngine(_0x3489ba);_0x3e06df[_0x79a8('0x31')][_0x464f22][_0x79a8('0x32')](_0x4be86,function(_0xfc50b3){logger[_0x79a8('0x2b')](_0x79a8('0x33'),JSON['stringify'](_0xfc50b3['matchPath']));if(_0x3e06df['rules'][_0x464f22]){delete _0x3e06df[_0x79a8('0x31')][_0x464f22];}});return _0x2c3002({'code':0xc8,'message':_0x4be86});}else{logger[_0x79a8('0x2b')]('No\x20applications\x20to\x20execute');return _0x2c3002({'code':0xc8,'message':_0x4be86});}}catch(_0x3cade1){logger[_0x79a8('0x2f')](JSON[_0x79a8('0x34')](_0x3cade1));return _0x497476(_0x497a73['error'](0x1f4,_0x3cade1));}}return _0x497476('routing\x20is\x20empty');});},'AcceptMessage':function(_0x439a62){var _0x41783f=this;return new Promise(function(_0x4377d1,_0x21389f){if(_0x439a62[_0x79a8('0x22')]&&_0x439a62['message']['id']){try{var _0x335b1c=getId(_0x439a62[_0x79a8('0x14')],_0x439a62[_0x79a8('0x22')]?_0x439a62['message']['id']:0x0,_0x439a62['interaction']?_0x439a62[_0x79a8('0x15')]['id']:0x0);if(_0x3e06df['rules'][_0x335b1c]){delete _0x3e06df[_0x79a8('0x31')][_0x335b1c];if(rpc[_0x439a62[_0x79a8('0x14')]+_0x79a8('0x35')]){rpc[_0x439a62[_0x79a8('0x14')]+_0x79a8('0x35')][_0x79a8('0x36')](_0x335b1c,{'UserId':_0x439a62[_0x79a8('0x22')][_0x79a8('0x37')]})[_0x79a8('0x38')](function(_0x565ebd){logger['error'](_0x79a8('0x39'));});}}return _0x4377d1({'code':0xc8,'message':_0x439a62});}catch(_0x6eaeff){logger['error'](JSON[_0x79a8('0x34')](_0x6eaeff));return _0x21389f(_0x41783f[_0x79a8('0x2f')](0x1f4,_0x6eaeff));}}logger['error'](_0x79a8('0x3a'));return _0x21389f(_0x41783f[_0x79a8('0x2f')](0x1f4,_0x79a8('0x3a')));});},'RejectMessage':function(_0x4df009){var _0x2f614a=this;return new Promise(function(_0x297e53,_0x564078){if(_0x4df009[_0x79a8('0x3b')]&&_0x4df009[_0x79a8('0x3b')]['id']){try{if(_0x3e06df[_0x79a8('0x3c')][_0x4df009[_0x79a8('0x3b')]['id']]){_0x3e06df['agents'][_0x4df009['agent']['id']]['busy']=![];_0x3e06df[_0x79a8('0x3c')][_0x4df009[_0x79a8('0x3b')]['id']][_0x79a8('0x3d')]=undefined;}return _0x297e53({'code':0xc8,'message':_0x4df009});}catch(_0x307ddf){logger[_0x79a8('0x2f')](JSON['stringify'](_0x307ddf));return _0x564078(_0x2f614a[_0x79a8('0x2f')](0x1f4,_0x307ddf));}}logger['error']('message\x20is\x20empty');return _0x564078(_0x2f614a[_0x79a8('0x2f')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xc975aa){var _0x5402be=this;return new Promise(function(_0x283cbc,_0x526331){if(_0xc975aa[_0x79a8('0x14')]&&_0xc975aa['interaction']&&_0xc975aa[_0x79a8('0x15')]['id']){try{var _0x40f398=getId(_0xc975aa[_0x79a8('0x14')],_0xc975aa[_0x79a8('0x22')]?_0xc975aa[_0x79a8('0x22')]['id']:0x0,_0xc975aa[_0x79a8('0x15')]?_0xc975aa[_0x79a8('0x15')]['id']:0x0);if(_0x3e06df[_0x79a8('0x31')][_0x40f398]){delete _0x3e06df[_0x79a8('0x31')][_0x40f398];}return _0x283cbc({'code':0xc8,'message':_0xc975aa});}catch(_0x4d1f6f){logger['error'](JSON['stringify'](_0x4d1f6f));return _0x526331(_0x5402be[_0x79a8('0x2f')](0x1f4,_0x4d1f6f));}}logger[_0x79a8('0x2f')](_0x79a8('0x3a'));return _0x526331(_0x5402be['error'](0x1f4,_0x79a8('0x3a')));});},'AgentCapacity':function(_0x38faf3){var _0x84815d=this;return new Promise(function(_0x56c3e4,_0x33c751){if(_0x3e06df[_0x79a8('0x3c')][_0x79a8('0x3e')](_0x38faf3['id'])){for(var _0x348658 in _0x38faf3['capacity']){if(_0x38faf3[_0x79a8('0x3f')]['hasOwnProperty'](_0x348658)){if(_0x3e06df[_0x79a8('0x3c')][_0x38faf3['id']][_0x79a8('0x3e')](_0x348658+_0x79a8('0x40'))){_0x3e06df[_0x79a8('0x3c')][_0x38faf3['id']][_0x348658+_0x79a8('0x40')]=parseInt(_0x38faf3[_0x79a8('0x3f')][_0x348658],0xa);_0x3e06df[_0x79a8('0x3c')][_0x38faf3['id']][_0x79a8('0x41')]();}}}return _0x56c3e4({'code':0xc8,'message':_0x3e06df[_0x79a8('0x3c')][_0x38faf3['id']]});}else{return _0x33c751(_0x84815d[_0x79a8('0x2f')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x4444b2){return new Promise(function(_0xef375d,_0x228f86){var _0x14962b=_[_0x79a8('0x42')](_0x3e06df['agents']);_0xef375d({'count':_0x14962b[_0x79a8('0x17')],'rows':_0x14962b});});},'ChatQueues':function(_0xab8cff){return new Promise(function(_0x4c02b9,_0x904935){var _0x904742=[];for(var _0x3d02b0 in _0x3e06df[_0x79a8('0x43')]){if(_0x3e06df['chatQueues'][_0x79a8('0x3e')](_0x3d02b0)){var _0xf1518c=_0x3e06df['chatQueues'][_0x3d02b0];var _0x19d234={'id':_0xf1518c['id'],'available':_0xf1518c[_0x79a8('0x44')],'loggedIn':_0xf1518c[_0x79a8('0x45')],'name':_0xf1518c[_0x79a8('0x46')],'paused':_0xf1518c[_0x79a8('0x47')],'waiting':_0xf1518c[_0x79a8('0x48')]};_0x904742[_0x79a8('0x1f')](_0x19d234);}}_0x4c02b9({'count':_0x904742[_0x79a8('0x17')],'rows':_0x904742});});},'MailQueues':function(_0x9a5238){return new Promise(function(_0x3b0a99,_0x322da8){var _0x40b4b=[];for(var _0x12adf4 in _0x3e06df['mailQueues']){if(_0x3e06df['mailQueues'][_0x79a8('0x3e')](_0x12adf4)){var _0x57e27a=_0x3e06df[_0x79a8('0x49')][_0x12adf4];var _0x3d9a19={'id':_0x57e27a['id'],'available':_0x57e27a[_0x79a8('0x44')],'loggedIn':_0x57e27a[_0x79a8('0x45')],'name':_0x57e27a['name'],'paused':_0x57e27a['paused'],'waiting':_0x57e27a[_0x79a8('0x48')]};_0x40b4b[_0x79a8('0x1f')](_0x3d9a19);}}_0x3b0a99({'count':_0x40b4b[_0x79a8('0x17')],'rows':_0x40b4b});});},'OpenchannelQueues':function(_0x4f3620){return new Promise(function(_0x4c76ac,_0x41026c){var _0x3cf3e5=[];for(var _0x51ad51 in _0x3e06df[_0x79a8('0x4a')]){if(_0x3e06df[_0x79a8('0x4a')][_0x79a8('0x3e')](_0x51ad51)){var _0x327f2a=_0x3e06df[_0x79a8('0x4a')][_0x51ad51];var _0x254749={'id':_0x327f2a['id'],'available':_0x327f2a[_0x79a8('0x44')],'loggedIn':_0x327f2a[_0x79a8('0x45')],'name':_0x327f2a['name'],'paused':_0x327f2a[_0x79a8('0x47')],'waiting':_0x327f2a[_0x79a8('0x48')]};_0x3cf3e5[_0x79a8('0x1f')](_0x254749);}}_0x4c76ac({'count':_0x3cf3e5[_0x79a8('0x17')],'rows':_0x3cf3e5});});},'SmsQueues':function(_0x3fa5c4){return new Promise(function(_0x9d3510,_0x1fc353){var _0x52ea81=[];for(var _0x4a9576 in _0x3e06df[_0x79a8('0x4b')]){if(_0x3e06df['smsQueues'][_0x79a8('0x3e')](_0x4a9576)){var _0x3dd5c4=_0x3e06df[_0x79a8('0x4b')][_0x4a9576];var _0x2e166e={'id':_0x3dd5c4['id'],'available':_0x3dd5c4['available'],'loggedIn':_0x3dd5c4[_0x79a8('0x45')],'name':_0x3dd5c4[_0x79a8('0x46')],'paused':_0x3dd5c4[_0x79a8('0x47')],'waiting':_0x3dd5c4[_0x79a8('0x48')]};_0x52ea81[_0x79a8('0x1f')](_0x2e166e);}}_0x9d3510({'count':_0x52ea81[_0x79a8('0x17')],'rows':_0x52ea81});});},'FaxQueues':function(_0x77b6e6){return new Promise(function(_0x24e950,_0x50c6b8){var _0x236711=[];for(var _0x2feae4 in _0x3e06df[_0x79a8('0x4c')]){if(_0x3e06df[_0x79a8('0x4c')]['hasOwnProperty'](_0x2feae4)){var _0x28e413=_0x3e06df['faxQueues'][_0x2feae4];var _0x693019={'id':_0x28e413['id'],'available':_0x28e413[_0x79a8('0x44')],'loggedIn':_0x28e413[_0x79a8('0x45')],'name':_0x28e413[_0x79a8('0x46')],'paused':_0x28e413['paused'],'waiting':_0x28e413[_0x79a8('0x48')]};_0x236711['push'](_0x693019);}}_0x24e950({'count':_0x236711[_0x79a8('0x17')],'rows':_0x236711});});},'ChatQueuesWaitingInteractions':function(_0x1ca9ba){return new Promise(function(_0x3ff311,_0x5b4aca){var _0x2d8255=_[_0x79a8('0x42')](_0x3e06df[_0x79a8('0x4d')]);_0x3ff311({'count':_0x2d8255[_0x79a8('0x17')],'rows':_0x2d8255});});},'MailQueuesWaitingInteractions':function(_0x4359e2){return new Promise(function(_0x308846,_0x9b9552){var _0x3609d6=_['values'](_0x3e06df[_0x79a8('0x4e')]);_0x308846({'count':_0x3609d6['length'],'rows':_0x3609d6});});},'OpenchannelQueuesWaitingInteractions':function(_0x9d53b9){return new Promise(function(_0x15808a,_0x3a6bda){var _0x27bbc7=_[_0x79a8('0x42')](_0x3e06df['openchannelQueuesWaitingInteractions']);_0x15808a({'count':_0x27bbc7[_0x79a8('0x17')],'rows':_0x27bbc7});});},'SmsQueuesWaitingInteractions':function(_0x12704b){return new Promise(function(_0x3f0c48,_0x3a7c99){var _0x55094f=_[_0x79a8('0x42')](_0x3e06df['smsQueuesWaitingInteractions']);_0x3f0c48({'count':_0x55094f['length'],'rows':_0x55094f});});},'FaxQueuesWaitingInteractions':function(_0x50ca15){return new Promise(function(_0x328d78,_0x330c0a){var _0x370ad8=_[_0x79a8('0x42')](_0x3e06df[_0x79a8('0x4f')]);_0x328d78({'count':_0x370ad8[_0x79a8('0x17')],'rows':_0x370ad8});});}};var _0x501358=jayson[_0x79a8('0x50')](_0x405d11)[_0x79a8('0x51')]();_0x501358['on']('error',function(_0x29d23f){logger[_0x79a8('0x2f')](JSON[_0x79a8('0x34')](_0x29d23f));return _0x396fae(_0x29d23f);});_0x501358[_0x79a8('0x13')](0x232c,'127.0.0.1',function(){console[_0x79a8('0x52')](_0x79a8('0x53'),0x232c);return _0x70316(_0x79a8('0x54')+0x232c);});});}; \ No newline at end of file +var _0x4ca2=['server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','push','slice','dialogflow','tag','TagId','format','%s:%s:%s','./interval','intervals','./applications/','priority','info','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','No\x20applications\x20to\x20execute','routing\x20is\x20empty','QueueReport','update','UserId','error\x20update\x20queue\x20report','agent','agents','busy','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x316d59,_0x46390a){var _0x53770b=function(_0x607d30){while(--_0x607d30){_0x316d59['push'](_0x316d59['shift']());}};_0x53770b(++_0x46390a);}(_0x4ca2,0xaf));var _0x24ca=function(_0x2e852e,_0x5150b2){_0x2e852e=_0x2e852e-0x0;var _0x4439a2=_0x4ca2[_0x2e852e];return _0x4439a2;};'use strict';var _=require(_0x24ca('0x0'));var util=require(_0x24ca('0x1'));var path=require(_0x24ca('0x2'));var fs=require('fs');var jayson=require(_0x24ca('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require(_0x24ca('0x4'));var logger=require(_0x24ca('0x5'))(_0x24ca('0x6'));var rpc={'openchannelQueueReport':require(_0x24ca('0x7'))};var rpc={'openchannelQueueReport':require(_0x24ca('0x7')),'mailQueueReport':require(_0x24ca('0x8')),'chatQueueReport':require(_0x24ca('0x9')),'smsQueueReport':require(_0x24ca('0xa')),'faxQueueReport':require(_0x24ca('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x5ddb2c,_0x5e54d6,_0xa56cf8){return util['format']('%s.%s.%s',_0x5ddb2c,_0x5e54d6||0x0,_0xa56cf8||0x0);}function getIntervals(_0x29aa7f,_0x254dea){var _0x481646=[];if(!_[_0x24ca('0xc')](_0x254dea[_0x24ca('0xd')])&&!_[_0x24ca('0xc')](_0x29aa7f[_0x254dea[_0x24ca('0xd')]])&&!_[_0x24ca('0xc')](_0x29aa7f[_0x254dea['IntervalId']][_0x24ca('0xe')])){_0x481646=_[_0x24ca('0xf')](_0x29aa7f[_0x254dea['IntervalId']][_0x24ca('0xe')],_0x24ca('0x10'));}else if(!_[_0x24ca('0xc')](_0x254dea['interval'])){_0x481646=[_0x254dea[_0x24ca('0x10')]];}return _0x481646;}exports[_0x24ca('0x11')]=function(_0x508c64){_0x508c64[_0x24ca('0x12')]={};return new BPromise(function(_0x20a3bf,_0x3ca3ea){var _0x3fb320={'Start':function(_0x1060f2){var _0x139af4=this;return new Promise(function(_0x32dbe1,_0x29cbc9){if(_0x1060f2){try{var _0x2c1ff0=[];var _0x385b54=getId(_0x1060f2[_0x24ca('0x13')],_0x1060f2[_0x24ca('0x14')]?_0x1060f2[_0x24ca('0x14')]['id']:0x0,_0x1060f2[_0x24ca('0x15')]?_0x1060f2[_0x24ca('0x15')]['id']:0x0);if(_0x1060f2[_0x24ca('0x16')]&&_[_0x24ca('0x17')](_0x1060f2[_0x24ca('0x16')])&&_0x1060f2[_0x24ca('0x16')][_0x24ca('0x18')]){for(var _0x3c549e=0x0;_0x3c549e<_0x1060f2[_0x24ca('0x16')][_0x24ca('0x18')];_0x3c549e+=0x1){var _0x1321d1=_0x1060f2[_0x24ca('0x16')][_0x3c549e];if(fs[_0x24ca('0x19')](path[_0x24ca('0x1a')](__dirname,'applications',_0x1321d1[_0x24ca('0x1b')]+_0x24ca('0x1c')))){var _0x2ebf08=[];switch(_0x1321d1[_0x24ca('0x1b')]['toLowerCase']()){case _0x24ca('0x1d'):var _0x562a30=_0x1321d1[_0x24ca('0x1e')][_0x24ca('0x1f')](',');_0x2ebf08['push'](_0x562a30[0x0]);_0x2ebf08[_0x24ca('0x20')](_0x562a30[_0x24ca('0x21')](0x1,_0x562a30[_0x24ca('0x18')])[_0x24ca('0x1a')](','));break;case _0x24ca('0x22'):var _0x562a30=_0x1321d1[_0x24ca('0x1e')][_0x24ca('0x1f')](',');_0x2ebf08[_0x24ca('0x20')](_0x562a30[0x0]);_0x2ebf08[_0x24ca('0x20')](_0x562a30[0x1]);_0x2ebf08[_0x24ca('0x20')](_0x562a30['slice'](0x2,_0x562a30[_0x24ca('0x18')])['join'](','));break;case _0x24ca('0x14'):_0x2ebf08['push'](_0x1321d1[_0x24ca('0x1e')]);break;case _0x24ca('0x23'):_0x2ebf08[_0x24ca('0x20')](_0x1321d1[_0x24ca('0x24')]);_0x2ebf08[_0x24ca('0x20')](_0x1321d1[_0x24ca('0x1e')]);break;default:_0x2ebf08=_[_0x24ca('0xc')](_0x1321d1[_0x24ca('0x1e')])?[]:_0x1321d1['appdata']['split'](',');}var _0x15139a={'id':util[_0x24ca('0x25')](_0x24ca('0x26'),_0x385b54,_0x1321d1['id'],_0x1321d1[_0x24ca('0x1b')]),'condition':require(_0x24ca('0x27'))['condition'](_0x385b54,getIntervals(_0x508c64[_0x24ca('0x28')],_0x1321d1),_0x508c64),'consequence':require(_0x24ca('0x29')+_0x1321d1['app'])['consequence'](_0x385b54,_0x2ebf08,_0x508c64,_0x1060f2),'p':_0x1321d1[_0x24ca('0x2a')]||0x0};logger[_0x24ca('0x2b')]('Push\x20new\x20rule',_0x15139a['id'],'on\x20interval',getIntervals(_0x508c64[_0x24ca('0x28')],_0x1321d1)[_0x24ca('0x1a')](_0x24ca('0x2c')));_0x2c1ff0[_0x24ca('0x20')](_0x15139a);}else{logger[_0x24ca('0x2d')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x1321d1[_0x24ca('0x1b')]+_0x24ca('0x1c')));}}_0x508c64['rules'][_0x385b54]=new RuleEngine(_0x2c1ff0);_0x508c64[_0x24ca('0x12')][_0x385b54][_0x24ca('0x2e')](_0x1060f2,function(_0x4c0a83){logger[_0x24ca('0x2b')](_0x24ca('0x2f'),JSON[_0x24ca('0x30')](_0x4c0a83[_0x24ca('0x31')]));if(_0x508c64[_0x24ca('0x12')][_0x385b54]){delete _0x508c64['rules'][_0x385b54];}});return _0x32dbe1({'code':0xc8,'message':_0x1060f2});}else{logger[_0x24ca('0x2b')](_0x24ca('0x32'));return _0x32dbe1({'code':0xc8,'message':_0x1060f2});}}catch(_0x4c89c9){logger[_0x24ca('0x2d')](JSON[_0x24ca('0x30')](_0x4c89c9));return _0x29cbc9(_0x139af4[_0x24ca('0x2d')](0x1f4,_0x4c89c9));}}return _0x29cbc9(_0x24ca('0x33'));});},'AcceptMessage':function(_0x319bd9){var _0x5cdaec=this;return new Promise(function(_0x10b13d,_0x44dfcd){if(_0x319bd9[_0x24ca('0x14')]&&_0x319bd9[_0x24ca('0x14')]['id']){try{var _0x1c99f1=getId(_0x319bd9[_0x24ca('0x13')],_0x319bd9[_0x24ca('0x14')]?_0x319bd9[_0x24ca('0x14')]['id']:0x0,_0x319bd9[_0x24ca('0x15')]?_0x319bd9[_0x24ca('0x15')]['id']:0x0);if(_0x508c64[_0x24ca('0x12')][_0x1c99f1]){delete _0x508c64[_0x24ca('0x12')][_0x1c99f1];if(rpc[_0x319bd9['channel']+_0x24ca('0x34')]){rpc[_0x319bd9['channel']+_0x24ca('0x34')][_0x24ca('0x35')](_0x1c99f1,{'UserId':_0x319bd9[_0x24ca('0x14')][_0x24ca('0x36')]})['catch'](function(_0x1b9188){logger['error'](_0x24ca('0x37'));});}}return _0x10b13d({'code':0xc8,'message':_0x319bd9});}catch(_0x1928ed){logger['error'](JSON[_0x24ca('0x30')](_0x1928ed));return _0x44dfcd(_0x5cdaec[_0x24ca('0x2d')](0x1f4,_0x1928ed));}}logger[_0x24ca('0x2d')]('message\x20is\x20empty');return _0x44dfcd(_0x5cdaec[_0x24ca('0x2d')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x531281){var _0x151fe9=this;return new Promise(function(_0xfc2891,_0x1b261d){if(_0x531281[_0x24ca('0x38')]&&_0x531281[_0x24ca('0x38')]['id']){try{if(_0x508c64[_0x24ca('0x39')][_0x531281[_0x24ca('0x38')]['id']]){_0x508c64[_0x24ca('0x39')][_0x531281['agent']['id']][_0x24ca('0x3a')]=![];_0x508c64[_0x24ca('0x39')][_0x531281[_0x24ca('0x38')]['id']][_0x24ca('0x3b')]=undefined;}return _0xfc2891({'code':0xc8,'message':_0x531281});}catch(_0x7ede40){logger[_0x24ca('0x2d')](JSON[_0x24ca('0x30')](_0x7ede40));return _0x1b261d(_0x151fe9[_0x24ca('0x2d')](0x1f4,_0x7ede40));}}logger[_0x24ca('0x2d')](_0x24ca('0x3c'));return _0x1b261d(_0x151fe9[_0x24ca('0x2d')](0x1f4,_0x24ca('0x3c')));});},'AbandonInteraction':function(_0x47b387){var _0x36d0bc=this;return new Promise(function(_0x4b32de,_0x19dd0e){if(_0x47b387['channel']&&_0x47b387[_0x24ca('0x15')]&&_0x47b387[_0x24ca('0x15')]['id']){try{var _0x487653=getId(_0x47b387[_0x24ca('0x13')],_0x47b387['message']?_0x47b387[_0x24ca('0x14')]['id']:0x0,_0x47b387['interaction']?_0x47b387['interaction']['id']:0x0);if(_0x508c64['rules'][_0x487653]){delete _0x508c64[_0x24ca('0x12')][_0x487653];}return _0x4b32de({'code':0xc8,'message':_0x47b387});}catch(_0x6a5dd8){logger[_0x24ca('0x2d')](JSON[_0x24ca('0x30')](_0x6a5dd8));return _0x19dd0e(_0x36d0bc['error'](0x1f4,_0x6a5dd8));}}logger[_0x24ca('0x2d')](_0x24ca('0x3c'));return _0x19dd0e(_0x36d0bc[_0x24ca('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4c6c37){var _0xbb9663=this;return new Promise(function(_0x29c4b6,_0x2e8adf){if(_0x508c64['agents'][_0x24ca('0x3d')](_0x4c6c37['id'])){for(var _0x754c24 in _0x4c6c37[_0x24ca('0x3e')]){if(_0x4c6c37[_0x24ca('0x3e')]['hasOwnProperty'](_0x754c24)){if(_0x508c64[_0x24ca('0x39')][_0x4c6c37['id']]['hasOwnProperty'](_0x754c24+_0x24ca('0x3f'))){_0x508c64[_0x24ca('0x39')][_0x4c6c37['id']][_0x754c24+_0x24ca('0x3f')]=parseInt(_0x4c6c37[_0x24ca('0x3e')][_0x754c24],0xa);_0x508c64[_0x24ca('0x39')][_0x4c6c37['id']][_0x24ca('0x40')]();}}}return _0x29c4b6({'code':0xc8,'message':_0x508c64['agents'][_0x4c6c37['id']]});}else{return _0x2e8adf(_0xbb9663[_0x24ca('0x2d')](0x1f4,_0x24ca('0x41')));}});},'Agents':function(_0x18bbcb){return new Promise(function(_0xe8570a,_0x2af5bf){var _0x3722fc=_[_0x24ca('0x42')](_0x508c64[_0x24ca('0x39')]);_0xe8570a({'count':_0x3722fc['length'],'rows':_0x3722fc});});},'ChatQueues':function(_0x407a7f){return new Promise(function(_0x47a390,_0x5510d2){var _0x9e74ee=[];for(var _0x2af94c in _0x508c64[_0x24ca('0x43')]){if(_0x508c64[_0x24ca('0x43')]['hasOwnProperty'](_0x2af94c)){var _0x30645e=_0x508c64['chatQueues'][_0x2af94c];var _0x109f92={'id':_0x30645e['id'],'available':_0x30645e[_0x24ca('0x44')],'loggedIn':_0x30645e['loggedIn'],'name':_0x30645e[_0x24ca('0x45')],'paused':_0x30645e[_0x24ca('0x46')],'waiting':_0x30645e[_0x24ca('0x47')]};_0x9e74ee[_0x24ca('0x20')](_0x109f92);}}_0x47a390({'count':_0x9e74ee[_0x24ca('0x18')],'rows':_0x9e74ee});});},'MailQueues':function(_0xbe9fef){return new Promise(function(_0x57d75e,_0x354a78){var _0x599670=[];for(var _0x28cccb in _0x508c64[_0x24ca('0x48')]){if(_0x508c64[_0x24ca('0x48')]['hasOwnProperty'](_0x28cccb)){var _0x2eb919=_0x508c64[_0x24ca('0x48')][_0x28cccb];var _0x1e619d={'id':_0x2eb919['id'],'available':_0x2eb919[_0x24ca('0x44')],'loggedIn':_0x2eb919[_0x24ca('0x49')],'name':_0x2eb919['name'],'paused':_0x2eb919[_0x24ca('0x46')],'waiting':_0x2eb919[_0x24ca('0x47')]};_0x599670[_0x24ca('0x20')](_0x1e619d);}}_0x57d75e({'count':_0x599670[_0x24ca('0x18')],'rows':_0x599670});});},'OpenchannelQueues':function(_0xfaf327){return new Promise(function(_0x506722,_0xdd9bb7){var _0x2d7d39=[];for(var _0x4ed439 in _0x508c64[_0x24ca('0x4a')]){if(_0x508c64[_0x24ca('0x4a')]['hasOwnProperty'](_0x4ed439)){var _0x48f5a3=_0x508c64[_0x24ca('0x4a')][_0x4ed439];var _0x2e3ddf={'id':_0x48f5a3['id'],'available':_0x48f5a3[_0x24ca('0x44')],'loggedIn':_0x48f5a3[_0x24ca('0x49')],'name':_0x48f5a3[_0x24ca('0x45')],'paused':_0x48f5a3[_0x24ca('0x46')],'waiting':_0x48f5a3['waiting']};_0x2d7d39[_0x24ca('0x20')](_0x2e3ddf);}}_0x506722({'count':_0x2d7d39[_0x24ca('0x18')],'rows':_0x2d7d39});});},'SmsQueues':function(_0x4d02ab){return new Promise(function(_0x5a5906,_0x4122d7){var _0x429387=[];for(var _0x547128 in _0x508c64[_0x24ca('0x4b')]){if(_0x508c64[_0x24ca('0x4b')]['hasOwnProperty'](_0x547128)){var _0x41e961=_0x508c64['smsQueues'][_0x547128];var _0xa94b83={'id':_0x41e961['id'],'available':_0x41e961[_0x24ca('0x44')],'loggedIn':_0x41e961[_0x24ca('0x49')],'name':_0x41e961[_0x24ca('0x45')],'paused':_0x41e961['paused'],'waiting':_0x41e961[_0x24ca('0x47')]};_0x429387['push'](_0xa94b83);}}_0x5a5906({'count':_0x429387[_0x24ca('0x18')],'rows':_0x429387});});},'FaxQueues':function(_0x1c8630){return new Promise(function(_0x3f3457,_0x5ad2cb){var _0x25d367=[];for(var _0x481fdd in _0x508c64[_0x24ca('0x4c')]){if(_0x508c64[_0x24ca('0x4c')]['hasOwnProperty'](_0x481fdd)){var _0x3853e1=_0x508c64[_0x24ca('0x4c')][_0x481fdd];var _0x38a416={'id':_0x3853e1['id'],'available':_0x3853e1[_0x24ca('0x44')],'loggedIn':_0x3853e1['loggedIn'],'name':_0x3853e1[_0x24ca('0x45')],'paused':_0x3853e1[_0x24ca('0x46')],'waiting':_0x3853e1[_0x24ca('0x47')]};_0x25d367['push'](_0x38a416);}}_0x3f3457({'count':_0x25d367[_0x24ca('0x18')],'rows':_0x25d367});});},'ChatQueuesWaitingInteractions':function(_0x193f6d){return new Promise(function(_0x3db73f,_0x4520ec){var _0x5db669=_[_0x24ca('0x42')](_0x508c64[_0x24ca('0x4d')]);_0x3db73f({'count':_0x5db669[_0x24ca('0x18')],'rows':_0x5db669});});},'MailQueuesWaitingInteractions':function(_0x36e8d3){return new Promise(function(_0x11ef3a,_0x51d56b){var _0xf3874b=_['values'](_0x508c64['mailQueuesWaitingInteractions']);_0x11ef3a({'count':_0xf3874b[_0x24ca('0x18')],'rows':_0xf3874b});});},'OpenchannelQueuesWaitingInteractions':function(_0x3f7208){return new Promise(function(_0x376e86,_0x1b0b99){var _0x48c4c3=_[_0x24ca('0x42')](_0x508c64[_0x24ca('0x4e')]);_0x376e86({'count':_0x48c4c3[_0x24ca('0x18')],'rows':_0x48c4c3});});},'SmsQueuesWaitingInteractions':function(_0x3bbaeb){return new Promise(function(_0x58a1e6,_0x4f95b4){var _0x3dfdb5=_[_0x24ca('0x42')](_0x508c64['smsQueuesWaitingInteractions']);_0x58a1e6({'count':_0x3dfdb5[_0x24ca('0x18')],'rows':_0x3dfdb5});});},'FaxQueuesWaitingInteractions':function(_0xb46ec2){return new Promise(function(_0x4998e5,_0x8b76f0){var _0xab3c20=_[_0x24ca('0x42')](_0x508c64[_0x24ca('0x4f')]);_0x4998e5({'count':_0xab3c20[_0x24ca('0x18')],'rows':_0xab3c20});});}};var _0xdce8a7=jayson[_0x24ca('0x50')](_0x3fb320)['http']();_0xdce8a7['on']('error',function(_0x4d2c73){logger[_0x24ca('0x2d')](JSON['stringify'](_0x4d2c73));return _0x3ca3ea(_0x4d2c73);});_0xdce8a7[_0x24ca('0x11')](0x232c,_0x24ca('0x51'),function(){console[_0x24ca('0x52')](_0x24ca('0x53'),0x232c);return _0x20a3bf(_0x24ca('0x54')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6b91ec2..8798d7b 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 _0x4d97=['push','Command','format','iftime\x20%s','message','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20','stringify','util','bluebird','jayson/promise','../../../config/logger','routing','client','then','error','result','catch','condition','rules','info','stop','length'];(function(_0x49c243,_0x2debca){var _0x55e378=function(_0x3577ef){while(--_0x3577ef){_0x49c243['push'](_0x49c243['shift']());}};_0x55e378(++_0x2debca);}(_0x4d97,0x73));var _0x74d9=function(_0x20fed6,_0x46b521){_0x20fed6=_0x20fed6-0x0;var _0x4ad8a9=_0x4d97[_0x20fed6];return _0x4ad8a9;};'use strict';var util=require(_0x74d9('0x0'));var BPromise=require(_0x74d9('0x1'));var jayson=require(_0x74d9('0x2'));var _=require('lodash');var logger=require(_0x74d9('0x3'))(_0x74d9('0x4'));var client=jayson[_0x74d9('0x5')]['http']({'port':0x232a});function request(_0x4fbd80,_0x45a3fe){return new BPromise(function(_0x501727,_0x39f35d){return client['request'](_0x4fbd80,_0x45a3fe)[_0x74d9('0x6')](function(_0x44d79a){if(_0x44d79a['error']){return _0x39f35d(_0x44d79a[_0x74d9('0x7')]['message']);}else{return _0x501727(_0x44d79a[_0x74d9('0x8')]);}})[_0x74d9('0x9')](function(_0x1dbf6e){return _0x39f35d(_0x1dbf6e);});});}exports[_0x74d9('0xa')]=function(_0x552729,_0x2ceca6,_0xe932dd){return function(_0x9458d7){if(_0xe932dd[_0x74d9('0xb')]&&!_0xe932dd[_0x74d9('0xb')][_0x552729]){logger[_0x74d9('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x552729);return _0x9458d7[_0x74d9('0xd')]();}var _0x44dedc=[];for(var _0x49a893=0x0;_0x49a893<_0x2ceca6[_0x74d9('0xe')];_0x49a893+=0x1){_0x44dedc[_0x74d9('0xf')](request(_0x74d9('0x10'),{'command':util[_0x74d9('0x11')](_0x74d9('0x12'),_0x2ceca6[_0x49a893])})[_0x74d9('0x6')](function(_0x62c8bb){return _0x62c8bb&&_0x62c8bb[_0x74d9('0x13')]&&_0x62c8bb['message']['indexOf']('true')>=0x0?!![]:![];})[_0x74d9('0x9')](function(_0xada47){logger[_0x74d9('0x7')]('[%s][INTERVAL]\x20%s',_0x552729,_0x2ceca6[_0x49a893]);}));}BPromise['all'](_0x44dedc)[_0x74d9('0x6')](function(_0x34e64e){var _0x219ded=_[_0x74d9('0x14')](_0x34e64e);logger[_0x74d9('0xc')](_0x74d9('0x15'),_0x552729,_0x2ceca6[_0x74d9('0x16')]('\x20|\x20'),_0x219ded);_0x9458d7['when'](_0x219ded);})[_0x74d9('0x9')](function(_0x43c627){console[_0x74d9('0x17')](_0x43c627);logger[_0x74d9('0x7')](_0x74d9('0x15'),_0x552729,_0x2ceca6[_0x74d9('0x16')](_0x74d9('0x18')),JSON[_0x74d9('0x19')](_0x43c627));_0x9458d7[_0x74d9('0xd')]();});};}; \ No newline at end of file +var _0x5449=['push','Command','format','iftime\x20%s','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stringify','stop','util','jayson/promise','lodash','../../../config/logger','http','request','then','error','message','result','condition','rules','info','length'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5449,0xf7));var _0x9544=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x5449[_0x369151];return _0x4292d5;};'use strict';var util=require(_0x9544('0x0'));var BPromise=require('bluebird');var jayson=require(_0x9544('0x1'));var _=require(_0x9544('0x2'));var logger=require(_0x9544('0x3'))('routing');var client=jayson['client'][_0x9544('0x4')]({'port':0x232a});function request(_0x29108b,_0xddc0c4){return new BPromise(function(_0x1bb86d,_0xd74038){return client[_0x9544('0x5')](_0x29108b,_0xddc0c4)[_0x9544('0x6')](function(_0x436f4f){if(_0x436f4f[_0x9544('0x7')]){return _0xd74038(_0x436f4f[_0x9544('0x7')][_0x9544('0x8')]);}else{return _0x1bb86d(_0x436f4f[_0x9544('0x9')]);}})['catch'](function(_0x17cea3){return _0xd74038(_0x17cea3);});});}exports[_0x9544('0xa')]=function(_0x5de2c3,_0x41e921,_0x23e6f4){return function(_0x4b7409){if(_0x23e6f4['rules']&&!_0x23e6f4[_0x9544('0xb')][_0x5de2c3]){logger[_0x9544('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5de2c3);return _0x4b7409['stop']();}var _0xe2b575=[];for(var _0x464f5d=0x0;_0x464f5d<_0x41e921[_0x9544('0xd')];_0x464f5d+=0x1){_0xe2b575[_0x9544('0xe')](request(_0x9544('0xf'),{'command':util[_0x9544('0x10')](_0x9544('0x11'),_0x41e921[_0x464f5d])})[_0x9544('0x6')](function(_0x224f47){return _0x224f47&&_0x224f47[_0x9544('0x8')]&&_0x224f47['message']['indexOf'](_0x9544('0x12'))>=0x0?!![]:![];})[_0x9544('0x13')](function(_0x4d1fda){logger[_0x9544('0x7')](_0x9544('0x14'),_0x5de2c3,_0x41e921[_0x464f5d]);}));}BPromise[_0x9544('0x15')](_0xe2b575)[_0x9544('0x6')](function(_0xcefc5c){var _0x152478=_[_0x9544('0x16')](_0xcefc5c);logger[_0x9544('0xc')](_0x9544('0x17'),_0x5de2c3,_0x41e921[_0x9544('0x18')](_0x9544('0x19')),_0x152478);_0x4b7409[_0x9544('0x1a')](_0x152478);})[_0x9544('0x13')](function(_0x3adad7){console['log'](_0x3adad7);logger[_0x9544('0x7')](_0x9544('0x17'),_0x5de2c3,_0x41e921[_0x9544('0x18')](_0x9544('0x19')),JSON[_0x9544('0x1b')](_0x3adad7));_0x4b7409[_0x9544('0x1c')]();});};}; \ No newline at end of file